diff --git a/_prepend.php b/_prepend.php index fea8911..c85bd34 100644 --- a/_prepend.php +++ b/_prepend.php @@ -15,27 +15,9 @@ if (!defined('DC_RC_PATH')) { return null; } -# Check Dotclear version -if (!method_exists('dcUtils', 'versionsCompare') - || dcUtils::versionsCompare(DC_VERSION, '2.18', '<', false)) { - return null; -} - $d = dirname(__FILE__) . '/inc/'; # DB class -$__autoload['periodical'] = $d . 'class.periodical.php'; +$__autoload['periodical'] = $d . 'class.periodical.php'; # Admin list and pagers -$__autoload['adminPeriodicalList'] = $d . 'lib.index.pager.php'; - -# Add to plugn soCialMe (writer part) -$__autoload['periodicalSoCialMeWriter'] = $d . 'lib.periodical.socialmewriter.php'; - -$core->addBehavior( - 'soCialMeWriterMarker', - ['periodicalSoCialMeWriter', 'soCialMeWriterMarker'] -); -$core->addBehavior( - 'periodicalAfterPublishedPeriodicalEntry', - ['periodicalSoCialMeWriter', 'periodicalAfterPublishedPeriodicalEntry'] -); \ No newline at end of file +$__autoload['adminPeriodicalList'] = $d . 'lib.index.pager.php'; \ No newline at end of file diff --git a/inc/lib.periodical.socialmewriter.php b/inc/lib.periodical.socialmewriter.php deleted file mode 100644 index 811087e..0000000 --- a/inc/lib.periodical.socialmewriter.php +++ /dev/null @@ -1,90 +0,0 @@ - __('New periodical publication'), - 'description' => __('When an entry is published on a period'), - 'action' => ['Message', 'Link'], - 'format' => ['Message'], - 'wildcards' => ['Message' => ['%posttitle%','%posturl%','%shortposturl%','%postauthor%','%sitetitle%','%siteurl%','%shortsiteurl%']] - ]; - } - - public static function periodicalAfterPublishedPeriodicalEntry($core, $post, $period) - { - $key = 'periodicalcreate'; - - # Is install - if (!$core->plugins->moduleExists('soCialMe')) { - return; - } - # Is active - if (!$core->blog->settings->soCialMeWriter->active) { - return; - } - # Load services - $soCialMeWriter = new soCialMeWriter($core); - - # List of service per action - $actions = $soCialMeWriter->getMarker('action'); - - # List of format per type - $formats = $soCialMeWriter->getMarker('format'); - - # prepare data - $shortposturl = soCialMeWriter::reduceURL($post->getURL()); - $shortposturl = $shortposturl ? $shortposturl : $post->getURL(); - - $shortsiteurl = soCialMeWriter::reduceURL($core->blog->url); - $shortsiteurl = $shortsiteurl ? $shortsiteurl : $core->blog->url; - - # sendMessage - if (!empty($formats[$key]['Message']) && !empty($actions[$key]['Message'])) { - // parse message - $message_txt = str_replace( - ['%posttitle%', '%posturl%', '%shortposturl%', '%postauthor%', '%sitetitle%', '%siteurl%', '%shortsiteurl%'], - [$post->post_title, $post->getURL(), $shortposturl, $post->getUserCN(), $core->blog->name, $core->blog->url, $shortsiteurl], - $formats[$key]['Message'] - ); - - // send message - if (!empty($message_txt)) { - foreach($actions[$key]['Message'] as $service_id) { - $soCialMeWriter->play($service_id, 'Message', 'Content', $message_txt); - } - } - } - - # sendLink - if (!empty($actions[$key]['Link'])) { - foreach($actions[$key]['Link'] as $service_id) { - $soCialMeWriter->play($service_id, 'Link', 'Content', $post->post_title, $shortposturl); - } - } - - # sendData - // not yet implemented - - #sendArticle - // not yet implemented - } -} \ No newline at end of file