remove old plugin compatibility
This commit is contained in:
parent
d9329a3f5e
commit
72a702485f
22
_prepend.php
22
_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']
|
||||
);
|
||||
$__autoload['adminPeriodicalList'] = $d . 'lib.index.pager.php';
|
@ -1,90 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief periodical, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')){
|
||||
return;
|
||||
}
|
||||
|
||||
# Add ability to send social messages when a feed is update
|
||||
class periodicalSoCialMeWriter
|
||||
{
|
||||
public static function soCialMeWriterMarker($rs)
|
||||
{
|
||||
$rs['periodicalcreate'] = [
|
||||
'name' => __('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
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user