move php code to PSR2 and short array
This commit is contained in:
parent
b47931de50
commit
7ed5a1542c
@ -1,5 +1,6 @@
|
||||
periodical 2021.08.xx
|
||||
* update license
|
||||
* update php code to PSR-2 style and short array
|
||||
|
||||
periodical 2013.11.11
|
||||
* Switch to Dotclear 2.6
|
||||
|
59
_admin.php
59
_admin.php
@ -12,7 +12,6 @@
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -33,33 +32,33 @@ if ($core->blog->settings->periodical->periodical_active) {
|
||||
|
||||
$core->addBehavior(
|
||||
'adminDashboardFavorites',
|
||||
array('adminPeriodical', 'adminDashboardFavorites')
|
||||
['adminPeriodical', 'adminDashboardFavorites']
|
||||
);
|
||||
$core->addBehavior(
|
||||
'adminPostHeaders',
|
||||
array('adminPeriodical', 'adminPostHeaders')
|
||||
['adminPeriodical', 'adminPostHeaders']
|
||||
);
|
||||
$core->addBehavior(
|
||||
'adminPostsActionsPage',
|
||||
array('adminPeriodical', 'adminPostsActionsPage')
|
||||
['adminPeriodical', 'adminPostsActionsPage']
|
||||
);
|
||||
$core->addBehavior(
|
||||
'adminPostFormItems',
|
||||
array('adminPeriodical', 'adminPostFormItems')
|
||||
['adminPeriodical', 'adminPostFormItems']
|
||||
);
|
||||
$core->addBehavior(
|
||||
'adminAfterPostUpdate',
|
||||
array('adminPeriodical', 'adminAfterPostSave')
|
||||
['adminPeriodical', 'adminAfterPostSave']
|
||||
);
|
||||
$core->addBehavior(
|
||||
'adminAfterPostCreate',
|
||||
array('adminPeriodical', 'adminAfterPostSave')
|
||||
['adminPeriodical', 'adminAfterPostSave']
|
||||
);
|
||||
}
|
||||
|
||||
$core->addBehavior(
|
||||
'adminBeforePostDelete',
|
||||
array('adminPeriodical', 'adminBeforePostDelete')
|
||||
['adminPeriodical', 'adminBeforePostDelete']
|
||||
);
|
||||
|
||||
/**
|
||||
@ -79,7 +78,7 @@ class adminPeriodical
|
||||
*/
|
||||
public static function adminDashboardFavorites(dcCore $core, $favs)
|
||||
{
|
||||
$favs->register('periodical', array(
|
||||
$favs->register('periodical', [
|
||||
'title' => __('Periodical'),
|
||||
'url' => 'plugin.php?p=periodical',
|
||||
'small-icon' => 'index.php?pf=periodical/icon.png',
|
||||
@ -88,11 +87,11 @@ class adminPeriodical
|
||||
'usage,contentadmin',
|
||||
$core->blog->id
|
||||
),
|
||||
'active_cb' => array(
|
||||
'active_cb' => [
|
||||
'adminPeriodical',
|
||||
'adminDashboardFavoritesActive'
|
||||
)
|
||||
));
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -137,25 +136,16 @@ class adminPeriodical
|
||||
public static function adminPostsActionsPage(dcCore $core, dcPostsActionsPage $pa)
|
||||
{
|
||||
$pa->addAction(
|
||||
array(
|
||||
__('Periodical') => array(
|
||||
__('Add to periodical') => 'periodical_add'
|
||||
)
|
||||
),
|
||||
array('adminPeriodical', 'callbackAdd')
|
||||
[__('Periodical') => [__('Add to periodical') => 'periodical_add']],
|
||||
['adminPeriodical', 'callbackAdd']
|
||||
);
|
||||
|
||||
if (!$core->auth->check('delete,contentadmin', $core->blog->id)) {
|
||||
|
||||
return null;
|
||||
}
|
||||
$pa->addAction(
|
||||
array(
|
||||
__('Periodical') => array(
|
||||
__('Remove from periodical') => 'periodical_remove'
|
||||
)
|
||||
),
|
||||
array('adminPeriodical', 'callbackRemove')
|
||||
[__('Periodical') => [__('Remove from periodical') => 'periodical_remove']],
|
||||
['adminPeriodical', 'callbackRemove']
|
||||
);
|
||||
}
|
||||
|
||||
@ -235,7 +225,7 @@ class adminPeriodical
|
||||
'<p>'.
|
||||
$core->formNonce() .
|
||||
$pa->getHiddenFields() .
|
||||
form::hidden(array('action'), 'periodical_add').
|
||||
form::hidden(['action'], 'periodical_add') .
|
||||
'<input type="submit" value="' . __('Save') . '" /></p>' .
|
||||
'</form>';
|
||||
|
||||
@ -258,7 +248,7 @@ class adminPeriodical
|
||||
$period = '';
|
||||
if ($post) {
|
||||
$per = new periodical($core);
|
||||
$rs = $per->getPosts(array('post_id' => $post->post_id));
|
||||
$rs = $per->getPosts(['post_id' => $post->post_id]);
|
||||
$period = $rs->isEmpty() ? '' : $rs->periodical_id;
|
||||
}
|
||||
|
||||
@ -278,7 +268,6 @@ class adminPeriodical
|
||||
global $core;
|
||||
|
||||
if (!isset($_POST['periodical'])) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -301,7 +290,6 @@ class adminPeriodical
|
||||
$combo = self::comboPeriod($core);
|
||||
|
||||
if (empty($combo)) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -326,11 +314,9 @@ class adminPeriodical
|
||||
$periods = $per->getPeriods();
|
||||
|
||||
if ($periods->isEmpty()) {
|
||||
|
||||
adminPeriodical::$combo_period = array();
|
||||
}
|
||||
else {
|
||||
$combo = array('-' => '');
|
||||
adminPeriodical::$combo_period = [];
|
||||
} else {
|
||||
$combo = ['-' => ''];
|
||||
while ($periods->fetch()) {
|
||||
$combo[html::escapeHTML($periods->periodical_title)] = $periods->periodical_id;
|
||||
}
|
||||
@ -350,7 +336,6 @@ class adminPeriodical
|
||||
protected static function delPeriod(dcCore $core, $post_id)
|
||||
{
|
||||
if ($post_id === null) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -370,7 +355,6 @@ class adminPeriodical
|
||||
{
|
||||
# Not saved
|
||||
if ($post_id === null || empty($period)) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -378,11 +362,10 @@ class adminPeriodical
|
||||
$per = new periodical($core);
|
||||
|
||||
# Get periods
|
||||
$period = $per->getPeriods(array('periodical_id' => $period));
|
||||
$period = $per->getPeriods(['periodical_id' => $period]);
|
||||
|
||||
# No period
|
||||
if ($period->isEmpty()) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
20
_config.php
20
_config.php
@ -12,7 +12,6 @@
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_CONTEXT_MODULE')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -20,15 +19,15 @@ $redir = empty($_REQUEST['redir']) ?
|
||||
$list->getURL() . '#plugins' : $_REQUEST['redir'];
|
||||
|
||||
# -- Combos --
|
||||
$sortby_combo = array(
|
||||
$sortby_combo = [
|
||||
__('Create date') => 'post_creadt',
|
||||
__('Date') => 'post_dt',
|
||||
__('Id') => 'post_id'
|
||||
);
|
||||
$order_combo = array(
|
||||
];
|
||||
$order_combo = [
|
||||
__('Descending') => 'desc',
|
||||
__('Ascending') => 'asc'
|
||||
);
|
||||
];
|
||||
|
||||
# -- Get settings --
|
||||
$core->blog->settings->addNamespace('periodical');
|
||||
@ -44,7 +43,6 @@ $s_order = isset($e_order[1]) && strtolower($e_order[1]) == 'desc' ? 'desc' : '
|
||||
|
||||
# -- Set settings --
|
||||
if (!empty($_POST['save'])) {
|
||||
|
||||
try {
|
||||
$s_active = !empty($_POST['s_active']);
|
||||
$s_upddate = !empty($_POST['s_upddate']);
|
||||
@ -62,12 +60,10 @@ if (!empty($_POST['save'])) {
|
||||
dcPage::addSuccessNotice(
|
||||
__('Configuration has been successfully updated.')
|
||||
);
|
||||
http::redirect(
|
||||
$list->getURL('module=periodical&conf=1&redir='.
|
||||
$list->getRedir())
|
||||
);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
http::redirect($list->getURL(
|
||||
'module=periodical&conf=1&redir=' . $list->getRedir()
|
||||
));
|
||||
} catch (Exception $e) {
|
||||
$core->error->add($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
27
_define.php
27
_define.php
@ -11,23 +11,20 @@
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_RC_PATH')){return;}
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->registerModule(
|
||||
/* Name */
|
||||
"Periodical",
|
||||
/* Description*/
|
||||
"Published periodically entries",
|
||||
/* Author */
|
||||
"Jean-Christian Denis",
|
||||
/* Version */
|
||||
'2013.11.11',
|
||||
/* Properies */
|
||||
array(
|
||||
'Periodical',
|
||||
'Published periodically entries',
|
||||
'Jean-Christian Denis and contributors',
|
||||
'2021.08.20',
|
||||
[
|
||||
'permissions' => 'usage,contentadmin',
|
||||
'type' => 'plugin',
|
||||
'dc_min' => '2.6',
|
||||
'support' => 'http://jcd.lv/q=periodical',
|
||||
'details' => 'http://plugins.dotaddict.org/dc2/details/periodical'
|
||||
)
|
||||
'dc_min' => '2.19',
|
||||
'support' => 'https://github.com/JcDenis/periodical',
|
||||
'details' => 'https://plugins.dotaddict.org/dc2/details/periodical'
|
||||
]
|
||||
);
|
@ -12,16 +12,14 @@
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
$dc_min = '2.6';
|
||||
$dc_min = '2.19';
|
||||
$new_version = $core->plugins->moduleInfo('periodical', 'version');
|
||||
$old_version = $core->getVersion('periodical');
|
||||
|
||||
if (version_compare($old_version, $new_version, '>=')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -67,8 +65,7 @@ try {
|
||||
$core->setVersion('periodical', $new_version);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$core->error->add($e->getMessage());
|
||||
}
|
||||
|
||||
|
@ -12,14 +12,12 @@
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
# Check Dotclear version
|
||||
if (!method_exists('dcUtils', 'versionsCompare')
|
||||
|| dcUtils::versionsCompare(DC_VERSION, '2.6', '<', false)
|
||||
) {
|
||||
|| dcUtils::versionsCompare(DC_VERSION, '2.18', '<', false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -35,9 +33,9 @@ $__autoload['periodicalSoCialMeWriter'] = $d.'lib.periodical.socialmewriter.php'
|
||||
|
||||
$core->addBehavior(
|
||||
'soCialMeWriterMarker',
|
||||
array('periodicalSoCialMeWriter', 'soCialMeWriterMarker')
|
||||
['periodicalSoCialMeWriter', 'soCialMeWriterMarker']
|
||||
);
|
||||
$core->addBehavior(
|
||||
'periodicalAfterPublishedPeriodicalEntry',
|
||||
array('periodicalSoCialMeWriter', 'periodicalAfterPublishedPeriodicalEntry')
|
||||
['periodicalSoCialMeWriter', 'periodicalAfterPublishedPeriodicalEntry']
|
||||
);
|
21
_public.php
21
_public.php
@ -12,12 +12,10 @@
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!in_array($core->url->type, array('default', 'feed'))) {
|
||||
|
||||
if (!in_array($core->url->type, ['default', 'feed'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -25,7 +23,7 @@ $core->blog->settings->addNamespace('periodical');
|
||||
|
||||
$core->addBehavior(
|
||||
'publicBeforeDocument',
|
||||
array('publicPeriodical', 'publicBeforeDocument')
|
||||
['publicPeriodical', 'publicBeforeDocument']
|
||||
);
|
||||
|
||||
/**
|
||||
@ -49,7 +47,7 @@ class publicPeriodical
|
||||
$per->lockUpdate();
|
||||
|
||||
# Get periods
|
||||
$periods = $core->auth->sudo(array($per, 'getPeriods'));
|
||||
$periods = $core->auth->sudo([$per, 'getPeriods']);
|
||||
|
||||
# No period
|
||||
if ($periods->isEmpty()) {
|
||||
@ -91,20 +89,21 @@ class publicPeriodical
|
||||
$loop_tz = $per->getNextTime($loop_tz, $periods->periodical_pub_int);
|
||||
$limit += 1;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
catch (Exception $e) { }
|
||||
|
||||
# If period need update
|
||||
if ($limit > 0) {
|
||||
|
||||
# Get posts to publish related to this period
|
||||
$posts_params = array();
|
||||
$posts_params = [];
|
||||
$posts_params['periodical_id'] = $periods->periodical_id;
|
||||
$posts_params['post_status'] = '-2';
|
||||
$posts_params['order'] = $posts_order;
|
||||
$posts_params['limit'] = $limit * $max_nb;
|
||||
$posts_params['no_content'] = true;
|
||||
$posts = $core->auth->sudo(array($per, 'getPosts'), $posts_params);
|
||||
$posts = $core->auth->sudo([$per, 'getPosts'], $posts_params);
|
||||
|
||||
if (!$posts->isEmpty()) {
|
||||
$cur_post = $core->con->openCursor($core->prefix . 'post');
|
||||
@ -119,8 +118,7 @@ class publicPeriodical
|
||||
if ($s->periodical_upddate) {
|
||||
$cur_post->post_dt = date('Y-m-d H:i:s', $last_tz);
|
||||
$cur_post->post_tz = $periods->periodical_tz;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$cur_post->post_dt = $posts->post_dt;
|
||||
}
|
||||
|
||||
@ -163,8 +161,7 @@ class publicPeriodical
|
||||
}
|
||||
}
|
||||
$per->unlockUpdate();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$per->unlockUpdate();
|
||||
|
||||
return null;
|
||||
|
@ -11,7 +11,9 @@
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_RC_PATH')){return;}
|
||||
if (!defined('DC_RC_PATH')){
|
||||
return;
|
||||
}
|
||||
|
||||
class periodical
|
||||
{
|
||||
@ -37,13 +39,11 @@ class periodical
|
||||
}
|
||||
|
||||
# Get periods
|
||||
public function getPeriods($params=array(),$count_only=false)
|
||||
public function getPeriods($params = [], $count_only = false)
|
||||
{
|
||||
if ($count_only) {
|
||||
$q = 'SELECT count(T.periodical_id) ';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$q = 'SELECT T.periodical_id, T.periodical_type, ';
|
||||
|
||||
if (!empty($params['columns']) && is_array($params['columns'])) {
|
||||
@ -65,20 +65,17 @@ class periodical
|
||||
if (isset($params['periodical_type'])) {
|
||||
if (is_array($params['periodical_type']) && !empty($params['periodical_type'])) {
|
||||
$q .= 'AND T.periodical_type ' . $this->con->in($params['periodical_type']);
|
||||
}
|
||||
elseif ($params['periodical_type'] != '') {
|
||||
} elseif ($params['periodical_type'] != '') {
|
||||
$q .= "AND T.periodical_type = '" . $this->con->escape($params['periodical_type']) . "' ";
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$q .= "AND T.periodical_type = 'post' ";
|
||||
}
|
||||
if (!empty($params['periodical_id'])) {
|
||||
if (is_array($params['periodical_id'])) {
|
||||
array_walk($params['periodical_id'], create_function('&$v,$k', 'if($v!==null){$v=(integer)$v;}'));
|
||||
}
|
||||
else {
|
||||
$params['periodical_id'] = array((integer) $params['periodical_id']);
|
||||
} else {
|
||||
$params['periodical_id'] = [(integer) $params['periodical_id']];
|
||||
}
|
||||
$q .= 'AND T.periodical_id ' . $this->con->in($params['periodical_id']);
|
||||
}
|
||||
@ -91,8 +88,7 @@ class periodical
|
||||
if (!$count_only) {
|
||||
if (!empty($params['order'])) {
|
||||
$q .= 'ORDER BY ' . $this->con->escape($params['order']).' ';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$q .= 'ORDER BY T.periodical_id ASC ';
|
||||
}
|
||||
}
|
||||
@ -110,8 +106,7 @@ class periodical
|
||||
{
|
||||
$this->con->writeLock($this->table);
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
$id = $this->con->select(
|
||||
'SELECT MAX(periodical_id) FROM ' . $this->table
|
||||
)->f(0) + 1;
|
||||
@ -122,9 +117,7 @@ class periodical
|
||||
$cur->periodical_tz = $this->core->auth->getInfo('user_tz');
|
||||
$cur->insert();
|
||||
$this->con->unlock();
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
} catch (Exception $e) {
|
||||
$this->con->unlock();
|
||||
throw $e;
|
||||
}
|
||||
@ -150,7 +143,7 @@ class periodical
|
||||
{
|
||||
$period_id = (integer) $period_id;
|
||||
|
||||
$params = array();
|
||||
$params = [];
|
||||
$params['periodical_id'] = $period_id;
|
||||
$params['post_status'] = '';
|
||||
$rs = $this->getPosts($params);
|
||||
@ -169,13 +162,15 @@ class periodical
|
||||
# Remove all posts related to a period
|
||||
public function delPeriodPosts($period_id)
|
||||
{
|
||||
$params = array();
|
||||
$params = [];
|
||||
$params['post_status'] = '';
|
||||
$params['periodical_id'] = (integer) $period_id;
|
||||
|
||||
$rs = $this->getPosts($params);
|
||||
|
||||
if ($rs->isEmpty()) return;
|
||||
if ($rs->isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$ids = array();
|
||||
while($rs->fetch())
|
||||
@ -183,7 +178,9 @@ class periodical
|
||||
$ids[] = $rs->post_id;
|
||||
}
|
||||
|
||||
if (empty($ids)) return;
|
||||
if (empty($ids)) [
|
||||
return;
|
||||
}
|
||||
|
||||
$this->con->execute(
|
||||
'DELETE FROM ' . $this->core->prefix . 'meta ' .
|
||||
@ -193,11 +190,17 @@ class periodical
|
||||
}
|
||||
|
||||
# Get posts related to periods
|
||||
public function getPosts($params=array(),$count_only=false)
|
||||
public function getPosts($params = [], $count_only = false)
|
||||
{
|
||||
if (!isset($params['columns'])) $params['columns'] = array();
|
||||
if (!isset($params['from'])) $params['from'] = '';
|
||||
if (!isset($params['sql'])) $params['sql'] = '';
|
||||
if (!isset($params['columns'])) {
|
||||
$params['columns'] = [];
|
||||
}
|
||||
if (!isset($params['from'])) {
|
||||
$params['from'] = '';
|
||||
}
|
||||
if (!isset($params['sql'])) {
|
||||
$params['sql'] = '';
|
||||
}
|
||||
|
||||
$params['columns'][] = 'T.periodical_id';
|
||||
$params['columns'][] = 'T.periodical_title';
|
||||
@ -217,9 +220,8 @@ class periodical
|
||||
if (!empty($params['periodical_id'])) {
|
||||
if (is_array($params['periodical_id'])) {
|
||||
array_walk($params['periodical_id'], create_function('&$v,$k', 'if($v!==null){$v=(integer)$v;}'));
|
||||
}
|
||||
else {
|
||||
$params['periodical_id'] = array((integer) $params['periodical_id']);
|
||||
} else {
|
||||
$params['periodical_id'] = [(integer) $params['periodical_id']];
|
||||
}
|
||||
$params['sql'] .= 'AND T.periodical_id ' . $this->con->in($params['periodical_id']);
|
||||
unset($params['periodical_id']);
|
||||
@ -231,8 +233,7 @@ class periodical
|
||||
}
|
||||
unset($params['post_status']);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$params['sql'] .= 'AND P.post_status = -2 ';
|
||||
}
|
||||
|
||||
@ -250,21 +251,20 @@ class periodical
|
||||
|
||||
# Check if exists
|
||||
$rs = $this->getPosts(array('post_id' => $post_id, 'periodical_id' => $period_id));
|
||||
if (!$rs->isEmpty()) return;
|
||||
if (!$rs->isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$cur = $this->con->openCursor($this->core->prefix .'meta');
|
||||
$this->con->writeLock($this->core->prefix . 'meta');
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
$cur->post_id = $post_id;
|
||||
$cur->meta_id = $period_id;
|
||||
$cur->meta_type = 'periodical';
|
||||
$cur->insert();
|
||||
$this->con->unlock();
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
} catch (Exception $e) {
|
||||
$this->con->unlock();
|
||||
throw $e;
|
||||
}
|
||||
@ -286,7 +286,7 @@ class periodical
|
||||
# Remove all posts without pending status from periodical
|
||||
public function cleanPosts($period_id = null)
|
||||
{
|
||||
$params = array();
|
||||
$params = [];
|
||||
$params['post_status'] = '';
|
||||
$params['sql'] = 'AND post_status != -2 ';
|
||||
if ($period_id !== null) {
|
||||
@ -294,15 +294,18 @@ class periodical
|
||||
}
|
||||
$rs = $this->getPosts($params);
|
||||
|
||||
if ($rs->isEmpty()) return;
|
||||
if ($rs->isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$ids = array();
|
||||
while($rs->fetch())
|
||||
{
|
||||
while($rs->fetch()) {
|
||||
$ids[] = $rs->post_id;
|
||||
}
|
||||
|
||||
if (empty($ids)) return;
|
||||
if (empty($ids)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->con->execute(
|
||||
'DELETE FROM ' . $this->core->prefix . 'meta ' .
|
||||
@ -313,13 +316,13 @@ class periodical
|
||||
|
||||
public static function getTimesCombo()
|
||||
{
|
||||
return array(
|
||||
return []
|
||||
__('Hourly') => 'hour',
|
||||
__('twice a day') => 'halfday',
|
||||
__('Daily') => 'day',
|
||||
__('Weekly') => 'week',
|
||||
__('Monthly') => 'month'
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNextTime($ts, $period)
|
||||
@ -359,8 +362,7 @@ class periodical
|
||||
# Lock a file to see if an update is ongoing
|
||||
public function lockUpdate()
|
||||
{
|
||||
try
|
||||
{
|
||||
try {
|
||||
# Need flock function
|
||||
if (!function_exists('flock')) {
|
||||
throw New Exception("Can't call php function named flock");
|
||||
@ -371,7 +373,8 @@ class periodical
|
||||
}
|
||||
# Set file path
|
||||
$f_md5 = md5($this->blog);
|
||||
$cached_file = sprintf('%s/%s/%s/%s/%s.txt',
|
||||
$cached_file = sprintf(
|
||||
'%s/%s/%s/%s/%s.txt',
|
||||
DC_TPL_CACHE,
|
||||
'periodical',
|
||||
substr($f_md5, 0, 2),
|
||||
@ -382,7 +385,6 @@ class periodical
|
||||
$cached_file = path::real($cached_file, false);
|
||||
# Make dir
|
||||
if (!is_dir(dirname($cached_file))) {
|
||||
|
||||
files::makeDir(dirname($cached_file), true);
|
||||
}
|
||||
# Make file
|
||||
@ -404,9 +406,7 @@ class periodical
|
||||
}
|
||||
$this->lock = $fp;
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
return false;
|
||||
@ -418,4 +418,3 @@ class periodical
|
||||
$this->lock = null;
|
||||
}
|
||||
}
|
||||
?>
|
@ -12,7 +12,6 @@
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -28,8 +27,7 @@ class adminPeriodicalList extends adminGenericList
|
||||
$echo = '';
|
||||
if ($this->rs->isEmpty()) {
|
||||
$echo .= '<p><strong>' .__('No period') .'</strong></p>';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$pager = new dcPager($page, $this->rs_count, $nb_per_page, 10);
|
||||
$pager->html_prev = $this->html_prev;
|
||||
$pager->html_next = $this->html_next;
|
||||
@ -72,7 +70,7 @@ class adminPeriodicalList extends adminGenericList
|
||||
|
||||
private function periodLine()
|
||||
{
|
||||
$nb_posts = $this->rs->periodical->getPosts(array('periodical_id' => $this->rs->periodical_id), true);
|
||||
$nb_posts = $this->rs->periodical->getPosts(['periodical_id' => $this->rs->periodical_id], true);
|
||||
$nb_posts = $nb_posts->f(0);
|
||||
$style = !$nb_posts ? ' offline' : '';
|
||||
$posts_links = !$nb_posts ?
|
||||
@ -84,8 +82,9 @@ class adminPeriodicalList extends adminGenericList
|
||||
|
||||
$res =
|
||||
'<tr class="line' . $style . '">' .
|
||||
'<td class="nowrap">'.form::checkbox(array('periods[]'), $this->rs->periodical_id).'</td>'.
|
||||
'<td class="maximal"><a href="plugin.php?p=periodical&part=period&period_id='.$this->rs->periodical_id.'#period" title="'.__('edit period').'">'.html::escapeHTML($this->rs->periodical_title).'</a></td>'.
|
||||
'<td class="nowrap">' . form::checkbox(['periods[]'], $this->rs->periodical_id) . '</td>' .
|
||||
'<td class="maximal"><a href="plugin.php?p=periodical&part=period&period_id=' . $this->rs->periodical_id . '#period" title="' .
|
||||
__('edit period') . '">' . html::escapeHTML($this->rs->periodical_title) . '</a></td>' .
|
||||
'<td class="nowrap">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->periodical_curdt) . '</td>' .
|
||||
'<td class="nowrap">' . $pub_int . '</td>' .
|
||||
'<td class="nowrap">' . $this->rs->periodical_pub_nb .'</td>' .
|
||||
@ -101,8 +100,7 @@ class adminPeriodicalList extends adminGenericList
|
||||
$echo = '';
|
||||
if ($this->rs->isEmpty()) {
|
||||
$echo .= '<p><strong>' . __('No entry') . '</strong></p>';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$pager = new dcPager($page, $this->rs_count, $nb_per_page, 10);
|
||||
$pager->html_prev = $this->html_prev;
|
||||
$pager->html_next = $this->html_next;
|
||||
@ -145,8 +143,7 @@ class adminPeriodicalList extends adminGenericList
|
||||
{
|
||||
if ($this->core->auth->check('categories', $this->core->blog->id)) {
|
||||
$cat_link = '<a href="category.php?id=%s">%s</a>';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$cat_link = '%2$s';
|
||||
}
|
||||
|
||||
@ -156,8 +153,7 @@ class adminPeriodicalList extends adminGenericList
|
||||
$this->rs->cat_id,
|
||||
html::escapeHTML($this->rs->cat_title)
|
||||
);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$cat_title = __('None');
|
||||
}
|
||||
|
||||
@ -200,7 +196,7 @@ class adminPeriodicalList extends adminGenericList
|
||||
|
||||
$res =
|
||||
'<tr class="line">' .
|
||||
'<td class="minimal">'.form::checkbox(array('periodical_entries[]'), $this->rs->post_id,0).'</td>'.
|
||||
'<td class="minimal">' . form::checkbox(['periodical_entries[]'], $this->rs->post_id, 0) . '</td>' .
|
||||
'<td class="maximal"><a href="' . $this->rs->core->getPostAdminURL($this->rs->post_type, $this->rs->post_id) . '" ' .
|
||||
'title="' . html::escapeHTML($this->rs->getURL()) . '">' .
|
||||
html::escapeHTML($this->rs->post_title) . '</a></td>' .
|
||||
|
@ -11,20 +11,22 @@
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_RC_PATH')){return;}
|
||||
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'] = array(
|
||||
$rs['periodicalcreate'] = [
|
||||
'name' => __('New periodical publication'),
|
||||
'description' => __('When an entry is published on a period'),
|
||||
'action' => array('Message','Link'),
|
||||
'format' => array('Message'),
|
||||
'wildcards' => array('Message' => array('%posttitle%','%posturl%','%shortposturl%','%postauthor%','%sitetitle%','%siteurl%','%shortsiteurl%'))
|
||||
);
|
||||
'action' => ['Message', 'Link'],
|
||||
'format' => ['Message'],
|
||||
'wildcards' => ['Message' => ['%posttitle%','%posturl%','%shortposturl%','%postauthor%','%sitetitle%','%siteurl%','%shortsiteurl%']]
|
||||
];
|
||||
}
|
||||
|
||||
public static function periodicalAfterPublishedPeriodicalEntry($core, $post, $period)
|
||||
@ -32,11 +34,13 @@ class periodicalSoCialMeWriter
|
||||
$key = 'periodicalcreate';
|
||||
|
||||
# Is install
|
||||
if (!$core->plugins->moduleExists('soCialMe')) return;
|
||||
|
||||
if (!$core->plugins->moduleExists('soCialMe')) {
|
||||
return;
|
||||
}
|
||||
# Is active
|
||||
if (!$core->blog->settings->soCialMeWriter->active) return;
|
||||
|
||||
if (!$core->blog->settings->soCialMeWriter->active) {
|
||||
return;
|
||||
}
|
||||
# Load services
|
||||
$soCialMeWriter = new soCialMeWriter($core);
|
||||
|
||||
@ -54,30 +58,25 @@ class periodicalSoCialMeWriter
|
||||
$shortsiteurl = $shortsiteurl ? $shortsiteurl : $core->blog->url;
|
||||
|
||||
# sendMessage
|
||||
if (!empty($formats[$key]['Message']) && !empty($actions[$key]['Message']))
|
||||
{
|
||||
if (!empty($formats[$key]['Message']) && !empty($actions[$key]['Message'])) {
|
||||
// parse message
|
||||
$message_txt = str_replace(
|
||||
array('%posttitle%','%posturl%','%shortposturl%','%postauthor%','%sitetitle%','%siteurl%','%shortsiteurl%'),
|
||||
array($post->post_title,$post->getURL(),$shortposturl,$post->getUserCN(),$core->blog->name,$core->blog->url,$shortsiteurl),
|
||||
['%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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (!empty($actions[$key]['Link'])) {
|
||||
foreach($actions[$key]['Link'] as $service_id) {
|
||||
$soCialMeWriter->play($service_id, 'Link', 'Content', $post->post_title, $shortposturl);
|
||||
}
|
||||
}
|
||||
@ -89,4 +88,3 @@ class periodicalSoCialMeWriter
|
||||
// not yet implemented
|
||||
}
|
||||
}
|
||||
?>
|
191
index.php
191
index.php
@ -12,7 +12,6 @@
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -47,14 +46,13 @@ if ($part == 'period') {
|
||||
|
||||
# Get period
|
||||
if (!empty($_REQUEST['period_id'])) {
|
||||
$rs = $per->getPeriods(array(
|
||||
$rs = $per->getPeriods([
|
||||
'periodical_id' => $_REQUEST['period_id']
|
||||
));
|
||||
]);
|
||||
if ($rs->isEmpty()) {
|
||||
$core->error->add(__('This period does not exist.'));
|
||||
$period_id = null;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$period_id = $rs->periodical_id;
|
||||
$period_title = $rs->periodical_title;
|
||||
$period_pub_nb = $rs->periodical_pub_nb;
|
||||
@ -77,8 +75,7 @@ if ($part == 'period') {
|
||||
$period_pub_nb = abs((integer) $_POST['period_pub_nb']);
|
||||
}
|
||||
if (!empty($_POST['period_pub_int'])
|
||||
&& in_array($_POST['period_pub_int'], $per->getTimesCombo())
|
||||
) {
|
||||
&& in_array($_POST['period_pub_int'], $per->getTimesCombo())) {
|
||||
$period_pub_int = $_POST['period_pub_int'];
|
||||
}
|
||||
if (!empty($_POST['period_curdt'])) {
|
||||
@ -89,9 +86,9 @@ if ($part == 'period') {
|
||||
}
|
||||
|
||||
# Check period title and dates
|
||||
$old_titles = $per->getPeriods(array(
|
||||
$old_titles = $per->getPeriods([
|
||||
'periodical_title' => $period_title
|
||||
));
|
||||
]);
|
||||
if (!$old_titles->isEmpty()) {
|
||||
while($old_titles->fetch()) {
|
||||
if (!$period_id || $old_titles->periodical_id != $period_id) {
|
||||
@ -124,9 +121,8 @@ if ($part == 'period') {
|
||||
dcPage::addSuccessNotice(
|
||||
__('Period successfully updated.')
|
||||
);
|
||||
}
|
||||
# Create period
|
||||
else {
|
||||
} else {
|
||||
|
||||
$period_id = $per->addPeriod($cur);
|
||||
|
||||
@ -162,8 +158,7 @@ if ($part == 'period') {
|
||||
$p_url . '&part=period&period_id=' . $period_id . '#posts' :
|
||||
$_POST['redir']
|
||||
);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$core->error->add($e->getMessage());
|
||||
}
|
||||
}
|
||||
@ -185,8 +180,7 @@ if ($part == 'period') {
|
||||
$p_url . '&part=period&period_id=' . $period_id . '#posts' :
|
||||
$_POST['redir']
|
||||
);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$core->error->add($e->getMessage());
|
||||
}
|
||||
}
|
||||
@ -207,8 +201,7 @@ if ($part == 'period') {
|
||||
$p_url . '&part=period&period_id=' . $period_id . '#posts' :
|
||||
$_POST['redir']
|
||||
);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$core->error->add($e->getMessage());
|
||||
}
|
||||
}
|
||||
@ -216,21 +209,19 @@ if ($part == 'period') {
|
||||
|
||||
# Prepare combos for posts list
|
||||
if ($period_id) {
|
||||
|
||||
try {
|
||||
# Getting categories
|
||||
$categories = $core->blog->getCategories(array('post_type' => 'post'));
|
||||
$categories = $core->blog->getCategories(['post_type' => 'post']);
|
||||
|
||||
# Getting authors
|
||||
$users = $core->blog->getPostsUsers();
|
||||
|
||||
# Getting dates
|
||||
$dates = $core->blog->getDates(array('type' => 'month'));
|
||||
$dates = $core->blog->getDates(['type' => 'month']);
|
||||
|
||||
# Getting langs
|
||||
$langs = $core->blog->getLangs();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$core->error->add($e->getMessage());
|
||||
}
|
||||
}
|
||||
@ -240,18 +231,19 @@ if ($part == 'period') {
|
||||
|
||||
# Users combo
|
||||
$users_combo = array_merge(
|
||||
array('-' => ''),
|
||||
['-' => ''],
|
||||
dcAdminCombos::getUsersCombo($users)
|
||||
);
|
||||
|
||||
# Categories combo
|
||||
$categories_combo = array_merge(
|
||||
array(
|
||||
[
|
||||
new formSelectOption('-', ''),
|
||||
new formSelectOption(__('(No cat)'), 'NULL')),
|
||||
new formSelectOption(__('(No cat)'), 'NULL')
|
||||
],
|
||||
dcAdminCombos::getCategoriesCombo($categories, false)
|
||||
);
|
||||
$categories_values = array();
|
||||
$categories_values = [];
|
||||
foreach ($categories_combo as $cat) {
|
||||
if (isset($cat->value)) {
|
||||
$categories_values[$cat->value] = true;
|
||||
@ -260,38 +252,38 @@ if ($part == 'period') {
|
||||
|
||||
# Status combo
|
||||
$status_combo = array_merge(
|
||||
array('-' => ''),
|
||||
['-' => ''],
|
||||
dcAdminCombos::getPostStatusesCombo()
|
||||
);
|
||||
|
||||
# Selection combo
|
||||
$selected_combo = array(
|
||||
$selected_combo = [
|
||||
'-' => '',
|
||||
__('Selected') => '1',
|
||||
__('Not selected') => '0'
|
||||
);
|
||||
];
|
||||
|
||||
# Attachments combo
|
||||
$attachment_combo = array(
|
||||
$attachment_combo = [
|
||||
'-' => '',
|
||||
__('With attachments') => '1',
|
||||
__('Without attachments') => '0'
|
||||
);
|
||||
];
|
||||
|
||||
# Months combo
|
||||
$dt_m_combo = array_merge(
|
||||
array('-' => ''),
|
||||
['-' => ''],
|
||||
dcAdminCombos::getDatesCombo($dates)
|
||||
);
|
||||
|
||||
# Langs combo
|
||||
$lang_combo = array_merge(
|
||||
array('-' => ''),
|
||||
['-' => ''],
|
||||
dcAdminCombos::getLangsCombo($langs, false)
|
||||
);
|
||||
|
||||
# Sort_by combo
|
||||
$sortby_combo = array(
|
||||
$sortby_combo = [
|
||||
__('Date') => 'post_dt',
|
||||
__('Title') => 'post_title',
|
||||
__('Category') => 'cat_title',
|
||||
@ -300,13 +292,13 @@ if ($part == 'period') {
|
||||
__('Selected') => 'post_selected',
|
||||
__('Number of comments') => 'nb_comment',
|
||||
__('Number of trackbacks') => 'nb_trackback'
|
||||
);
|
||||
];
|
||||
|
||||
# order combo
|
||||
$order_combo = array(
|
||||
$order_combo = [
|
||||
__('Descending') => 'desc',
|
||||
__('Ascending') => 'asc'
|
||||
);
|
||||
];
|
||||
|
||||
# parse filters
|
||||
$user_id = !empty($_GET['user_id']) ? $_GET['user_id'] : '';
|
||||
@ -331,7 +323,7 @@ if ($part == 'period') {
|
||||
$nb_per_page = (integer) $_GET['nb'];
|
||||
}
|
||||
|
||||
$params['limit'] = array((($page-1)*$nb_per_page), $nb_per_page);
|
||||
$params['limit'] = [(($page-1)*$nb_per_page), $nb_per_page];
|
||||
$params['no_content'] = true;
|
||||
$params['periodical_id'] = $period_id;
|
||||
|
||||
@ -339,8 +331,7 @@ if ($part == 'period') {
|
||||
if ($user_id !== '' && in_array($user_id, $users_combo)) {
|
||||
$params['user_id'] = $user_id;
|
||||
$show_filters = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$user_id='';
|
||||
}
|
||||
|
||||
@ -348,8 +339,7 @@ if ($part == 'period') {
|
||||
if ($cat_id !== '' && isset($categories_values[$cat_id])) {
|
||||
$params['cat_id'] = $cat_id;
|
||||
$show_filters = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$cat_id='';
|
||||
}
|
||||
|
||||
@ -357,8 +347,7 @@ if ($part == 'period') {
|
||||
if ($status !== '' && in_array($status, $status_combo)) {
|
||||
$params['post_status'] = $status;
|
||||
$show_filters = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$status='';
|
||||
}
|
||||
|
||||
@ -366,8 +355,7 @@ if ($part == 'period') {
|
||||
if ($selected !== '' && in_array($selected, $selected_combo)) {
|
||||
$params['post_selected'] = $selected;
|
||||
$show_filters = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$selected='';
|
||||
}
|
||||
|
||||
@ -376,8 +364,7 @@ if ($part == 'period') {
|
||||
$params['media'] = $attachment;
|
||||
$params['link_type'] = 'attachment';
|
||||
$show_filters = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$attachment='';
|
||||
}
|
||||
|
||||
@ -386,8 +373,7 @@ if ($part == 'period') {
|
||||
$params['post_month'] = substr($month, 4, 2);
|
||||
$params['post_year'] = substr($month, 0, 4);
|
||||
$show_filters = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$month='';
|
||||
}
|
||||
|
||||
@ -395,8 +381,7 @@ if ($part == 'period') {
|
||||
if ($lang !== '' && in_array($lang, $lang_combo)) {
|
||||
$params['post_lang'] = $lang;
|
||||
$show_filters = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$lang='';
|
||||
}
|
||||
|
||||
@ -404,16 +389,14 @@ if ($part == 'period') {
|
||||
if ($sortby !== '' && in_array($sortby, $sortby_combo)) {
|
||||
if ($order !== '' && in_array($order, $order_combo)) {
|
||||
$params['order'] = $sortby.' '.$order;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$order='desc';
|
||||
}
|
||||
|
||||
if ($sortby != 'post_dt' || $order != 'desc') {
|
||||
$show_filters = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$sortby='post_dt';
|
||||
$order='desc';
|
||||
}
|
||||
@ -423,8 +406,7 @@ if ($part == 'period') {
|
||||
$posts = $per->getPosts($params);
|
||||
$counter = $per->getPosts($params, true);
|
||||
$post_list = new adminPeriodicalList($core, $posts, $counter->f(0));
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$core->error->add($e->getMessage());
|
||||
}
|
||||
|
||||
@ -462,11 +444,11 @@ if ($part == 'period') {
|
||||
|
||||
echo
|
||||
dcPage::breadcrumb(
|
||||
array(
|
||||
[
|
||||
html::escapeHTML($core->blog->name) => '',
|
||||
__('Periodical') => $p_url . '&part=periods',
|
||||
(null === $period_id ? __('New period') : __('Edit period')) => ''
|
||||
)
|
||||
]
|
||||
) .
|
||||
dcPage::notices();
|
||||
|
||||
@ -501,9 +483,9 @@ if ($part == 'period') {
|
||||
<div class="clear">
|
||||
<p><input type="submit" name="save" value="' . __('Save') . '" />' .
|
||||
$core->formNonce() .
|
||||
form::hidden(array('action'), 'setperiod').
|
||||
form::hidden(array('period_id'), $period_id).
|
||||
form::hidden(array('part'), 'period').'
|
||||
form::hidden(['action'], 'setperiod') .
|
||||
form::hidden(['period_id'], $period_id) .
|
||||
form::hidden(['part'], 'period') .'
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
@ -581,9 +563,9 @@ if ($part == 'period') {
|
||||
'</div>' .
|
||||
|
||||
'<p><input type="submit" value="' . __('Apply filters and display options') . '" />' .
|
||||
form::hidden(array('p'), 'periodical').
|
||||
form::hidden(array('part'), 'period').
|
||||
form::hidden(array('period_id'), $period_id).
|
||||
form::hidden(['p'], 'periodical') .
|
||||
form::hidden(['part'], 'period') .
|
||||
form::hidden(['period_id'], $period_id) .
|
||||
'<br class="clear" /></p>' . //Opera sucks
|
||||
'</form>';
|
||||
|
||||
@ -600,21 +582,21 @@ if ($part == 'period') {
|
||||
'<p class="col right">' . __('Selected entries action:') . ' ' .
|
||||
form::combo('action', $combo_action) .
|
||||
'<input type="submit" value="' . __('ok') . '" /></p>' .
|
||||
form::hidden(array('period_id'), $period_id).
|
||||
form::hidden(array('user_id'), $user_id).
|
||||
form::hidden(array('cat_id'), $cat_id).
|
||||
form::hidden(array('status'), $status).
|
||||
form::hidden(array('selected'), $selected).
|
||||
form::hidden(array('attachment'), $attachment).
|
||||
form::hidden(array('month'), $month).
|
||||
form::hidden(array('lang'), $lang).
|
||||
form::hidden(array('sortby'), $sortby).
|
||||
form::hidden(array('order'), $order).
|
||||
form::hidden(array('page'), $page).
|
||||
form::hidden(array('nb'), $nb_per_page).
|
||||
form::hidden(array('p'), 'periodical').
|
||||
form::hidden(array('part'), 'period').
|
||||
form::hidden(array('redir'), sprintf($base_url, $page)).
|
||||
form::hidden(['period_id'], $period_id) .
|
||||
form::hidden(['user_id'], $user_id) .
|
||||
form::hidden(['cat_id'], $cat_id) .
|
||||
form::hidden(['status'], $status) .
|
||||
form::hidden(['selected'], $selected) .
|
||||
form::hidden(['attachment'], $attachment) .
|
||||
form::hidden(['month'], $month) .
|
||||
form::hidden(['lang'], $lang) .
|
||||
form::hidden(['sortby'], $sortby) .
|
||||
form::hidden(['order'], $order) .
|
||||
form::hidden(['page'], $page) .
|
||||
form::hidden(['nb'], $nb_per_page) .
|
||||
form::hidden(['p'], 'periodical') .
|
||||
form::hidden(['part'], 'period') .
|
||||
form::hidden(['redir'], sprintf($base_url, $page)) .
|
||||
$core->formNonce() .
|
||||
'</div>' .
|
||||
'</form>'
|
||||
@ -624,15 +606,13 @@ if ($part == 'period') {
|
||||
'</div>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
############################################################
|
||||
#
|
||||
# All periods
|
||||
#
|
||||
############################################################
|
||||
|
||||
else {
|
||||
} else {
|
||||
|
||||
# Delete periods and related posts links
|
||||
if ($action == 'deleteperiods' && !empty($_POST['periods'])) {
|
||||
@ -651,8 +631,7 @@ else {
|
||||
$p_url.'&part=periods' :
|
||||
$_POST['redir']
|
||||
);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$core->error->add($e->getMessage());
|
||||
}
|
||||
}
|
||||
@ -672,25 +651,24 @@ else {
|
||||
$p_url.'&part=periods' :
|
||||
$_POST['redir']
|
||||
);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$core->error->add($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
# Combos
|
||||
$sortby_combo = array(
|
||||
$sortby_combo = [
|
||||
__('Next update') => 'periodical_curdt',
|
||||
__('End date') => 'periodical_enddt',
|
||||
__('Frequence') => 'periodical_pub_int'
|
||||
);
|
||||
];
|
||||
|
||||
$order_combo = array(
|
||||
$order_combo = [
|
||||
__('Descending') => 'desc',
|
||||
__('Ascending') => 'asc'
|
||||
);
|
||||
];
|
||||
|
||||
$combo_action = array();
|
||||
$combo_action = [];
|
||||
$combo_action[__('empty periods')] = 'emptyperiods';
|
||||
$combo_action[__('delete periods')] = 'deleteperiods';
|
||||
|
||||
@ -710,7 +688,7 @@ else {
|
||||
$nb_per_page = (integer) $_GET['nb'];
|
||||
}
|
||||
|
||||
$params['limit'] = array((($page-1)*$nb_per_page), $nb_per_page);
|
||||
$params['limit'] = [(($page-1)*$nb_per_page), $nb_per_page];
|
||||
|
||||
if ($sortby !== '' && in_array($sortby, $sortby_combo)) {
|
||||
if ($order !== '' && in_array($order, $order_combo)) {
|
||||
@ -727,8 +705,7 @@ else {
|
||||
$periods = $per->getPeriods($params);
|
||||
$counter = $per->getPeriods($params, true);
|
||||
$period_list = new adminPeriodicalList($core, $periods, $counter->f(0));
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$core->error->add($e->getMessage());
|
||||
}
|
||||
|
||||
@ -739,7 +716,7 @@ else {
|
||||
'index.php?pf=periodical/js/periodsfilter.js'
|
||||
) .
|
||||
'<script type="text/javascript">' . "\n" .
|
||||
"//<![CDATA["."\n".
|
||||
"//<![CDATA[\n" .
|
||||
dcPage::jsVar(
|
||||
'dotclear.msg.show_filters',
|
||||
$show_filters ? 'true':'false'
|
||||
@ -758,10 +735,10 @@ else {
|
||||
'<body>' .
|
||||
|
||||
dcPage::breadcrumb(
|
||||
array(
|
||||
[
|
||||
html::escapeHTML($core->blog->name) => '',
|
||||
__('Periodical') => ''
|
||||
)
|
||||
]
|
||||
) .
|
||||
dcPage::notices() .
|
||||
|
||||
@ -798,8 +775,8 @@ else {
|
||||
|
||||
'<p>' .
|
||||
'<input type="submit" value="' . __('Apply filters and display options') . '" />' .
|
||||
form::hidden(array('p'), 'periodical').
|
||||
form::hidden(array('part'), 'periods').
|
||||
form::hidden(['p'], 'periodical') .
|
||||
form::hidden(['part'], 'periods') .
|
||||
'<br class="clear" />' . //Opera sucks
|
||||
'</p>' .
|
||||
|
||||
@ -817,12 +794,12 @@ else {
|
||||
'<p class="col right">' . __('Selected periods action:') . ' ' .
|
||||
form::combo('action', $combo_action) .
|
||||
'<input type="submit" value="' . __('ok') . '" /></p>' .
|
||||
form::hidden(array('sortby'), $sortby).
|
||||
form::hidden(array('order'), $order).
|
||||
form::hidden(array('page'), $page).
|
||||
form::hidden(array('nb'), $nb_per_page).
|
||||
form::hidden(array('p'), 'periodical').
|
||||
form::hidden(array('part'), 'periods').
|
||||
form::hidden(['sortby'], $sortby) .
|
||||
form::hidden(['order'], $order) .
|
||||
form::hidden(['page'], $page) .
|
||||
form::hidden(['nb'], $nb_per_page) .
|
||||
form::hidden(['p'], 'periodical') .
|
||||
form::hidden(['part'], 'periods') .
|
||||
$core->formNonce() .
|
||||
'</div>' .
|
||||
'</form>'
|
||||
|
@ -10,9 +10,8 @@
|
||||
<p>If you want some help or contribute to the plugin periodical, follow these links.</p>
|
||||
<ul>
|
||||
<li><a href="http://forum.dotclear.org/viewtopic.php?id=42289">Post on Dotclear's forum</a></li>
|
||||
<li><a href="http://lab.dotclear.org/wiki/plugin/periodical">SVN repository</a></li>
|
||||
<li><a href="https://bitbucket.org/JcDenis/periodical">HG repository</a></li>
|
||||
<li><a href="http://jcd.lv/q=periodical">Post on author's blog</a></li>
|
||||
<li><a href="https://github.com/JcDenis/periodical">Github repository</a></li>
|
||||
<li><a href="https://plugins.dotaddict.org/dc2/details/periodical">Dotaddict repository</a></li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
|
@ -12,7 +12,6 @@
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -10,9 +10,8 @@
|
||||
<p>Si vous souhaitez plus d'aide ou apporter votre contribution à l'extension periodical, voici quelques liens utiles.</p>
|
||||
<ul>
|
||||
<li><a href="http://forum.dotclear.org/viewtopic.php?id=42289">Sujet sur le forum Dotclear</a></li>
|
||||
<li><a href="http://lab.dotclear.org/wiki/plugin/periodical">Dépôt svn</a></li>
|
||||
<li><a href="https://bitbucket.org/JcDenis/periodical">Dépôt hg</a></li>
|
||||
<li><a href="http://jcd.lv/q=periodical">Billet dédié sur le blog de l'auteur</a></li>
|
||||
<li><a href="https://github.com/JcDenis/periodical">Dépôt Github</a></li>
|
||||
<li><a href="https://plugins.dotaddict.org/dc2/details/periodical">Dépôt Dotaddict</a></li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
|
@ -12,7 +12,6 @@
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user