update license and fix PSR2 codding style
This commit is contained in:
parent
16ffcf67d3
commit
e7a3cb0fa1
@ -1,53 +1,45 @@
|
|||||||
postExpired xxxx.xx.xx
|
postExpired xxxx.xx.xx
|
||||||
===========================================================
|
|
||||||
* Not fix: Wrong timezone on admin vs public expired date
|
* Not fix: Wrong timezone on admin vs public expired date
|
||||||
|
|
||||||
|
postExpired 2021.08.19
|
||||||
|
* update license and fix PSR2 coding style
|
||||||
|
|
||||||
postExpired 2013.11.13
|
postExpired 2013.11.13
|
||||||
===========================================================
|
|
||||||
* Fixed wrong field name for category
|
* Fixed wrong field name for category
|
||||||
|
|
||||||
postExpired 2013.11.03
|
postExpired 2013.11.03
|
||||||
===========================================================
|
|
||||||
* Switch to Dotclear 2.6
|
* Switch to Dotclear 2.6
|
||||||
* Use new posts actions
|
* Use new posts actions
|
||||||
* Save all options in one meta
|
* Save all options in one meta
|
||||||
* Limit plugin to contentadmin
|
* Limit plugin to contentadmin
|
||||||
|
|
||||||
postExpired 2013.06.30
|
postExpired 2013.06.30
|
||||||
===========================================================
|
|
||||||
* Fixed post_type and posts_actions
|
* Fixed post_type and posts_actions
|
||||||
|
|
||||||
postExpired 0.5 - 2010-08-17
|
postExpired 0.5 - 2010-08-17
|
||||||
===========================================================
|
|
||||||
* Added compatibility with plugins 'pages' and 'muppet'
|
* Added compatibility with plugins 'pages' and 'muppet'
|
||||||
|
|
||||||
postExpired 0.4 - 2010-08-03
|
postExpired 0.4 - 2010-08-03
|
||||||
===========================================================
|
|
||||||
* Added actions (comments, trackbacks) (closes #525)
|
* Added actions (comments, trackbacks) (closes #525)
|
||||||
* Speed up public part (less sql resquests)
|
* Speed up public part (less sql resquests)
|
||||||
* Fixed typo
|
* Fixed typo
|
||||||
|
|
||||||
postExpired 0.3.1 - 2010-06-21
|
postExpired 0.3.1 - 2010-06-21
|
||||||
===========================================================
|
|
||||||
* Fixed user rights
|
* Fixed user rights
|
||||||
* Fixed (again) PHP 5.3 compatibility
|
* Fixed (again) PHP 5.3 compatibility
|
||||||
* Fixed typo
|
* Fixed typo
|
||||||
|
|
||||||
postExpired 0.3 - 2010-06-08
|
postExpired 0.3 - 2010-06-08
|
||||||
===========================================================
|
|
||||||
* Switched to DC 2.2 (settings,meta)
|
* Switched to DC 2.2 (settings,meta)
|
||||||
|
|
||||||
postExpired 0.2.1 - 2010-05-28
|
postExpired 0.2.1 - 2010-05-28
|
||||||
===========================================================
|
|
||||||
* Fixed DC 2.1.7 settings bugs
|
* Fixed DC 2.1.7 settings bugs
|
||||||
|
|
||||||
postExpired 0.2 - 2010-04-14
|
postExpired 0.2 - 2010-04-14
|
||||||
===========================================================
|
|
||||||
* Added actions choice (status,category,selected)
|
* Added actions choice (status,category,selected)
|
||||||
* Added template block and value
|
* Added template block and value
|
||||||
* Added behaviors to open choices
|
* Added behaviors to open choices
|
||||||
* Enhanced db resquest on public side
|
* Enhanced db resquest on public side
|
||||||
|
|
||||||
postExpired 0.1 - 2010-04-10
|
postExpired 0.1 - 2010-04-10
|
||||||
===========================================================
|
|
||||||
* First lab release
|
* First lab release
|
@ -30,3 +30,9 @@ Notes:
|
|||||||
|
|
||||||
* Only one expired date per post is supported
|
* Only one expired date per post is supported
|
||||||
* Expired dates are checked from public home page and feed page
|
* Expired dates are checked from public home page and feed page
|
||||||
|
|
||||||
|
## MORE
|
||||||
|
|
||||||
|
* License : GNU GPL v2
|
||||||
|
* Source & contribution : [GitHub Page](https://github.com/JcDenis/postExpired)
|
||||||
|
* Packages & details: [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/postExpired)
|
44
_admin.php
44
_admin.php
@ -3,8 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This file is part of postExpired, a plugin for Dotclear 2.
|
# This file is part of postExpired, a plugin for Dotclear 2.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
|
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||||
# contact@jcdenis.fr http://jcd.lv
|
|
||||||
#
|
#
|
||||||
# Licensed under the GPL version 2.0 license.
|
# Licensed under the GPL version 2.0 license.
|
||||||
# A copy of this license is available in LICENSE file or at
|
# A copy of this license is available in LICENSE file or at
|
||||||
@ -13,70 +12,67 @@
|
|||||||
# -- END LICENSE BLOCK ------------------------------------
|
# -- END LICENSE BLOCK ------------------------------------
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check plugin version
|
# Check plugin version
|
||||||
if ($core->getVersion('postExpired') != $core->plugins->moduleInfo('postExpired', 'version')) {
|
if ($core->getVersion('postExpired') != $core->plugins->moduleInfo('postExpired', 'version')) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check user right
|
# Check user right
|
||||||
if (!$core->auth->check('contentadmin', $core->blog->id)) {
|
if (!$core->auth->check('contentadmin', $core->blog->id)) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Admin behaviors
|
# Admin behaviors
|
||||||
$core->addBehavior(
|
$core->addBehavior(
|
||||||
'adminPostsActionsPage',
|
'adminPostsActionsPage',
|
||||||
array('adminBehaviorPostExpired', 'adminPostsActionsPage')
|
['adminBehaviorPostExpired', 'adminPostsActionsPage']
|
||||||
);
|
);
|
||||||
$core->addBehavior(
|
$core->addBehavior(
|
||||||
'adminPagesActionsPage',
|
'adminPagesActionsPage',
|
||||||
array('adminBehaviorPostExpired', 'adminPostsActionsPage')
|
['adminBehaviorPostExpired', 'adminPostsActionsPage']
|
||||||
);
|
);
|
||||||
$core->addBehavior(
|
$core->addBehavior(
|
||||||
'adminPostHeaders',
|
'adminPostHeaders',
|
||||||
array('adminBehaviorPostExpired', 'adminPostHeaders')
|
['adminBehaviorPostExpired', 'adminPostHeaders']
|
||||||
);
|
);
|
||||||
$core->addBehavior(
|
$core->addBehavior(
|
||||||
'adminPageHeaders',
|
'adminPageHeaders',
|
||||||
array('adminBehaviorPostExpired', 'adminPostHeaders')
|
['adminBehaviorPostExpired', 'adminPostHeaders']
|
||||||
);
|
);
|
||||||
$core->addBehavior(
|
$core->addBehavior(
|
||||||
'adminPostFormItems',
|
'adminPostFormItems',
|
||||||
array('adminBehaviorPostExpired', 'adminPostFormItems')
|
['adminBehaviorPostExpired', 'adminPostFormItems']
|
||||||
);
|
);
|
||||||
$core->addBehavior(
|
$core->addBehavior(
|
||||||
'adminPageFormItems',
|
'adminPageFormItems',
|
||||||
array('adminBehaviorPostExpired', 'adminPostFormItems')
|
['adminBehaviorPostExpired', 'adminPostFormItems']
|
||||||
);
|
);
|
||||||
$core->addBehavior(
|
$core->addBehavior(
|
||||||
'adminBeforePostDelete',
|
'adminBeforePostDelete',
|
||||||
array('adminBehaviorPostExpired', 'adminBeforePostDelete')
|
['adminBehaviorPostExpired', 'adminBeforePostDelete']
|
||||||
);
|
);
|
||||||
$core->addBehavior(
|
$core->addBehavior(
|
||||||
'adminBeforePageDelete',
|
'adminBeforePageDelete',
|
||||||
array('adminBehaviorPostExpired', 'adminBeforePostDelete')
|
['adminBehaviorPostExpired', 'adminBeforePostDelete']
|
||||||
);
|
);
|
||||||
$core->addBehavior(
|
$core->addBehavior(
|
||||||
'adminAfterPostUpdate',
|
'adminAfterPostUpdate',
|
||||||
array('adminBehaviorPostExpired', 'adminAfterPostSave')
|
['adminBehaviorPostExpired', 'adminAfterPostSave']
|
||||||
);
|
);
|
||||||
$core->addBehavior(
|
$core->addBehavior(
|
||||||
'adminAfterPageUpdate',
|
'adminAfterPageUpdate',
|
||||||
array('adminBehaviorPostExpired', 'adminAfterPostSave')
|
['adminBehaviorPostExpired', 'adminAfterPostSave']
|
||||||
);
|
);
|
||||||
$core->addBehavior(
|
$core->addBehavior(
|
||||||
'adminAfterPostCreate',
|
'adminAfterPostCreate',
|
||||||
array('adminBehaviorPostExpired', 'adminAfterPostSave')
|
['adminBehaviorPostExpired', 'adminAfterPostSave']
|
||||||
);
|
);
|
||||||
$core->addBehavior(
|
$core->addBehavior(
|
||||||
'adminAfterPageCreate',
|
'adminAfterPageCreate',
|
||||||
array('adminBehaviorPostExpired', 'adminAfterPostSave')
|
['adminBehaviorPostExpired', 'adminAfterPostSave']
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -133,7 +129,6 @@ class adminBehaviorPostExpired
|
|||||||
public static function adminPostFormItems(ArrayObject $main_items, ArrayObject $sidebar_items, $post)
|
public static function adminPostFormItems(ArrayObject $main_items, ArrayObject $sidebar_items, $post)
|
||||||
{
|
{
|
||||||
if ($post === null) {
|
if ($post === null) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,8 +169,7 @@ class adminBehaviorPostExpired
|
|||||||
|| !empty($_POST['post_expired_category'])
|
|| !empty($_POST['post_expired_category'])
|
||||||
|| !empty($_POST['post_expired_selected'])
|
|| !empty($_POST['post_expired_selected'])
|
||||||
|| !empty($_POST['post_expired_comment'])
|
|| !empty($_POST['post_expired_comment'])
|
||||||
|| !empty($_POST['post_expired_trackback']))
|
|| !empty($_POST['post_expired_trackback']))) {
|
||||||
) {
|
|
||||||
self::setPostExpired($core, $post_id, $_POST);
|
self::setPostExpired($core, $post_id, $_POST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -201,8 +195,7 @@ class adminBehaviorPostExpired
|
|||||||
|| !empty($post['post_expired_category'])
|
|| !empty($post['post_expired_category'])
|
||||||
|| !empty($post['post_expired_selected'])
|
|| !empty($post['post_expired_selected'])
|
||||||
|| !empty($post['post_expired_comment'])
|
|| !empty($post['post_expired_comment'])
|
||||||
|| !empty($post['post_expired_trackback']))
|
|| !empty($post['post_expired_trackback']))) {
|
||||||
) {
|
|
||||||
foreach($posts_ids as $post_id) {
|
foreach($posts_ids as $post_id) {
|
||||||
self::delPostExpired($core, $post_id);
|
self::delPostExpired($core, $post_id);
|
||||||
self::setPostExpired($core, $post_id, $post);
|
self::setPostExpired($core, $post_id, $post);
|
||||||
@ -210,10 +203,9 @@ class adminBehaviorPostExpired
|
|||||||
|
|
||||||
dcPage::addSuccessNotice(__('Expired date added.'));
|
dcPage::addSuccessNotice(__('Expired date added.'));
|
||||||
$pa->redirect(true);
|
$pa->redirect(true);
|
||||||
}
|
|
||||||
|
|
||||||
# Display form
|
# Display form
|
||||||
else {
|
} else {
|
||||||
# Get records to know post type
|
# Get records to know post type
|
||||||
$posts = $pa->getRS();
|
$posts = $pa->getRS();
|
||||||
|
|
||||||
@ -447,9 +439,7 @@ class adminBehaviorPostExpired
|
|||||||
'!'.$categories->cat_id
|
'!'.$categories->cat_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch (Exception $e) {
|
|
||||||
|
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
30
_define.php
30
_define.php
@ -3,8 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This file is part of postExpired, a plugin for Dotclear 2.
|
# This file is part of postExpired, a plugin for Dotclear 2.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
|
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||||
# contact@jcdenis.fr http://jcd.lv
|
|
||||||
#
|
#
|
||||||
# Licensed under the GPL version 2.0 license.
|
# Licensed under the GPL version 2.0 license.
|
||||||
# A copy of this license is available in LICENSE file or at
|
# A copy of this license is available in LICENSE file or at
|
||||||
@ -12,23 +11,20 @@
|
|||||||
#
|
#
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
# -- END LICENSE BLOCK ------------------------------------
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')){return;}
|
if (!defined('DC_RC_PATH')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$this->registerModule(
|
$this->registerModule(
|
||||||
/* Name */
|
'Expired entries',
|
||||||
"Expired entries",
|
'Change entries options at a given date',
|
||||||
/* Description*/
|
'Jean-Christian Denis and Contributors',
|
||||||
"Change entries options at a given date",
|
'2021.08.19',
|
||||||
/* Author */
|
[
|
||||||
"Jean-Christian Denis",
|
|
||||||
/* Version */
|
|
||||||
'2013.11.13',
|
|
||||||
/* Properies */
|
|
||||||
array(
|
|
||||||
'permissions' => 'usage,contentadmin',
|
'permissions' => 'usage,contentadmin',
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
'dc_min' => '2.6',
|
'dc_min' => '2.18',
|
||||||
'support' => 'http://jcd.lv/q=postExpired',
|
'support' => 'https://github.com/JcDenis/postExpired',
|
||||||
'details' => 'http://plugins.dotaddict.org/dc2/details/postExpired'
|
'details' => 'https://plugins.dotaddict.org/dc2/details/postExpired'
|
||||||
)
|
]
|
||||||
);
|
);
|
15
_install.php
15
_install.php
@ -3,8 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This file is part of postExpired, a plugin for Dotclear 2.
|
# This file is part of postExpired, a plugin for Dotclear 2.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
|
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||||
# contact@jcdenis.fr http://jcd.lv
|
|
||||||
#
|
#
|
||||||
# Licensed under the GPL version 2.0 license.
|
# Licensed under the GPL version 2.0 license.
|
||||||
# A copy of this license is available in LICENSE file or at
|
# A copy of this license is available in LICENSE file or at
|
||||||
@ -13,26 +12,21 @@
|
|||||||
# -- END LICENSE BLOCK ------------------------------------
|
# -- END LICENSE BLOCK ------------------------------------
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
# -- Module specs --
|
# -- Module specs --
|
||||||
|
$dc_min = '2.18';
|
||||||
$dc_min = '2.6';
|
|
||||||
$mod_id = 'postExpired';
|
$mod_id = 'postExpired';
|
||||||
|
|
||||||
# -- Nothing to change below --
|
# -- Nothing to change below --
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
# Check module version
|
# Check module version
|
||||||
if (version_compare(
|
if (version_compare(
|
||||||
$core->getVersion($mod_id),
|
$core->getVersion($mod_id),
|
||||||
$core->plugins->moduleInfo($mod_id, 'version'),
|
$core->plugins->moduleInfo($mod_id, 'version'),
|
||||||
'>='
|
'>='
|
||||||
)) {
|
)) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,11 +45,8 @@ try {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch (Exception $e) {
|
|
||||||
$core->error->add($e->getMessage());
|
$core->error->add($e->getMessage());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
@ -3,8 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This file is part of postExpired, a plugin for Dotclear 2.
|
# This file is part of postExpired, a plugin for Dotclear 2.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
|
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||||
# contact@jcdenis.fr http://jcd.lv
|
|
||||||
#
|
#
|
||||||
# Licensed under the GPL version 2.0 license.
|
# Licensed under the GPL version 2.0 license.
|
||||||
# A copy of this license is available in LICENSE file or at
|
# A copy of this license is available in LICENSE file or at
|
||||||
@ -13,7 +12,6 @@
|
|||||||
# -- END LICENSE BLOCK ------------------------------------
|
# -- END LICENSE BLOCK ------------------------------------
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
43
_public.php
43
_public.php
@ -3,8 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This file is part of postExpired, a plugin for Dotclear 2.
|
# This file is part of postExpired, a plugin for Dotclear 2.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
|
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||||
# contact@jcdenis.fr http://jcd.lv
|
|
||||||
#
|
#
|
||||||
# Licensed under the GPL version 2.0 license.
|
# Licensed under the GPL version 2.0 license.
|
||||||
# A copy of this license is available in LICENSE file or at
|
# A copy of this license is available in LICENSE file or at
|
||||||
@ -13,12 +12,10 @@
|
|||||||
# -- END LICENSE BLOCK ------------------------------------
|
# -- END LICENSE BLOCK ------------------------------------
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($core->getVersion('postExpired') != $core->plugins->moduleInfo('postExpired', 'version')) {
|
if ($core->getVersion('postExpired') != $core->plugins->moduleInfo('postExpired', 'version')) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,24 +26,24 @@ __('This entry has no expiration date');
|
|||||||
if (in_array($core->url->type, array('default', 'feed'))) {
|
if (in_array($core->url->type, array('default', 'feed'))) {
|
||||||
$core->addBehavior(
|
$core->addBehavior(
|
||||||
'publicBeforeDocument',
|
'publicBeforeDocument',
|
||||||
array('publicBehaviorPostExpired', 'publicBeforeDocument')
|
['publicBehaviorPostExpired', 'publicBeforeDocument']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$core->addBehavior(
|
$core->addBehavior(
|
||||||
'coreBlogGetPosts',
|
'coreBlogGetPosts',
|
||||||
array('publicBehaviorPostExpired', 'coreBlogGetPosts')
|
['publicBehaviorPostExpired', 'coreBlogGetPosts']
|
||||||
);
|
);
|
||||||
$core->tpl->addBlock(
|
$core->tpl->addBlock(
|
||||||
'EntryExpiredIf',
|
'EntryExpiredIf',
|
||||||
array('tplPostExpired', 'EntryExpiredIf')
|
['tplPostExpired', 'EntryExpiredIf']
|
||||||
);
|
);
|
||||||
$core->tpl->addValue(
|
$core->tpl->addValue(
|
||||||
'EntryExpiredDate',
|
'EntryExpiredDate',
|
||||||
array('tplPostExpired', 'EntryExpiredDate')
|
['tplPostExpired', 'EntryExpiredDate']
|
||||||
);
|
);
|
||||||
$core->tpl->addValue(
|
$core->tpl->addValue(
|
||||||
'EntryExpiredTime',
|
'EntryExpiredTime',
|
||||||
array('tplPostExpired', 'EntryExpiredTime')
|
['tplPostExpired', 'EntryExpiredTime']
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,7 +74,6 @@ class publicBehaviorPostExpired
|
|||||||
|
|
||||||
# No expired date
|
# No expired date
|
||||||
if ($posts->isEmpty()) {
|
if ($posts->isEmpty()) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,8 +93,7 @@ class publicBehaviorPostExpired
|
|||||||
# Check if post is outdated
|
# Check if post is outdated
|
||||||
$now_tz = $now + dt::getTimeOffset($posts->post_tz, $now);
|
$now_tz = $now + dt::getTimeOffset($posts->post_tz, $now);
|
||||||
$meta_tz = strtotime($post_expired['date']);
|
$meta_tz = strtotime($post_expired['date']);
|
||||||
if ($now_tz > $meta_tz)
|
if ($now_tz > $meta_tz) {
|
||||||
{
|
|
||||||
# Delete meta for expired date
|
# Delete meta for expired date
|
||||||
$core->auth->sudo(
|
$core->auth->sudo(
|
||||||
array($core->meta, 'delPostMeta'),
|
array($core->meta, 'delPostMeta'),
|
||||||
@ -111,8 +106,7 @@ class publicBehaviorPostExpired
|
|||||||
$post_cur->post_upddt = date('Y-m-d H:i:s', $now_tz);
|
$post_cur->post_upddt = date('Y-m-d H:i:s', $now_tz);
|
||||||
|
|
||||||
# Loop through actions
|
# Loop through actions
|
||||||
foreach($post_expired as $k => $v)
|
foreach($post_expired as $k => $v) {
|
||||||
{
|
|
||||||
if (empty($v)) {
|
if (empty($v)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -195,7 +189,6 @@ class rsExtPostExpiredPublic extends rsExtPost
|
|||||||
));
|
));
|
||||||
|
|
||||||
if ($rs_date->isEmpty()) {
|
if ($rs_date->isEmpty()) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,8 +222,7 @@ class tplPostExpired
|
|||||||
if (isset($attr['has_date'])) {
|
if (isset($attr['has_date'])) {
|
||||||
$sign = (boolean) $attr['has_date'] ? '!' : '=';
|
$sign = (boolean) $attr['has_date'] ? '!' : '=';
|
||||||
$if[] = '(null ' . $sign . '== $_ctx->posts->postExpiredDate())';
|
$if[] = '(null ' . $sign . '== $_ctx->posts->postExpiredDate())';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$if[] = '(null !== $_ctx->posts->postExpiredDate())';
|
$if[] = '(null !== $_ctx->posts->postExpiredDate())';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,14 +243,15 @@ class tplPostExpired
|
|||||||
addslashes($attr['format']) : '';
|
addslashes($attr['format']) : '';
|
||||||
$f = $GLOBALS['core']->tpl->getFilters($attr);
|
$f = $GLOBALS['core']->tpl->getFilters($attr);
|
||||||
|
|
||||||
if (!empty($attr['rfc822']))
|
if (!empty($attr['rfc822'])) {
|
||||||
$res = sprintf($f, "dt::rfc822(strtotime(\$_ctx->posts->postExpiredDate()),\$_ctx->posts->post_tz)");
|
$res = sprintf($f, "dt::rfc822(strtotime(\$_ctx->posts->postExpiredDate()),\$_ctx->posts->post_tz)");
|
||||||
elseif (!empty($attr['iso8601']))
|
} elseif (!empty($attr['iso8601'])) {
|
||||||
$res = sprintf($f, "dt::iso8601(strtotime(\$_ctx->posts->postExpiredDate(),\$_ctx->posts->post_tz)");
|
$res = sprintf($f, "dt::iso8601(strtotime(\$_ctx->posts->postExpiredDate(),\$_ctx->posts->post_tz)");
|
||||||
elseif ($format)
|
} elseif ($format) {
|
||||||
$res = sprintf($f, "dt::dt2str('" . $format . "',\$_ctx->posts->postExpiredDate())");
|
$res = sprintf($f, "dt::dt2str('" . $format . "',\$_ctx->posts->postExpiredDate())");
|
||||||
else
|
} else {
|
||||||
$res = sprintf($f, "dt::dt2str(\$core->blog->settings->system->date_format,\$_ctx->posts->postExpiredDate())");
|
$res = sprintf($f, "dt::dt2str(\$core->blog->settings->system->date_format,\$_ctx->posts->postExpiredDate())");
|
||||||
|
}
|
||||||
|
|
||||||
return '<?php if (null !== $_ctx->posts->postExpiredDate()) { echo ' . $res . '; } ?>';
|
return '<?php if (null !== $_ctx->posts->postExpiredDate()) { echo ' . $res . '; } ?>';
|
||||||
}
|
}
|
||||||
@ -270,7 +263,13 @@ class tplPostExpired
|
|||||||
*/
|
*/
|
||||||
public static function EntryExpiredTime($attr)
|
public static function EntryExpiredTime($attr)
|
||||||
{
|
{
|
||||||
return '<?php if (null !== $_ctx->posts->postExpiredDate()) { echo '.sprintf($GLOBALS['core']->tpl->getFilters($attr),"dt::dt2str(".(!empty($attr['format']) ? "'".addslashes($attr['format'])."'" : "\$core->blog->settings->system->time_format").",\$_ctx->posts->postExpiredDate())").'; } ?>';
|
return
|
||||||
|
'<?php if (null !== $_ctx->posts->postExpiredDate()) { echo ' . sprintf(
|
||||||
|
$GLOBALS['core']->tpl->getFilters($attr), "dt::dt2str(" .
|
||||||
|
(!empty($attr['format']) ?
|
||||||
|
"'" . addslashes($attr['format']) . "'" : "\$core->blog->settings->system->time_format"
|
||||||
|
) . ",\$_ctx->posts->postExpiredDate())"
|
||||||
|
) . '; } ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user