cosmetics
This commit is contained in:
parent
d2a2b18308
commit
ebfc5f0710
8 changed files with 108 additions and 124 deletions
18
_prepend.php
18
_prepend.php
|
@ -12,17 +12,13 @@
|
|||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
$__autoload['postWidgetText'] =
|
||||
dirname(__FILE__).'/inc/class.postwidgettext.php';
|
||||
$__autoload['postWidgetTextDashboard'] =
|
||||
dirname(__FILE__).'/inc/lib.pwt.dashboard.php';
|
||||
$__autoload['postWidgetTextAdmin'] =
|
||||
dirname(__FILE__).'/inc/lib.pwt.admin.php';
|
||||
$__autoload['postWidgetTextBackup'] =
|
||||
dirname(__FILE__).'/inc/lib.pwt.backup.php';
|
||||
$__autoload['postWidgetTextList'] =
|
||||
dirname(__FILE__).'/inc/lib.pwt.list.php';
|
||||
$d = dirname(__FILE__) . '/inc/';
|
||||
|
||||
$__autoload['postWidgetText'] = $d . 'class.postwidgettext.php';
|
||||
$__autoload['postWidgetTextDashboard'] = $d . 'lib.pwt.dashboard.php';
|
||||
$__autoload['postWidgetTextAdmin'] = $d . 'lib.pwt.admin.php';
|
||||
$__autoload['postWidgetTextBackup'] = $d . 'lib.pwt.backup.php';
|
||||
$__autoload['postWidgetTextList'] = $d . 'lib.pwt.list.php';
|
|
@ -12,7 +12,6 @@
|
|||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -58,7 +57,7 @@ class postWidgetText
|
|||
|
||||
public function getWidgets($params, $count_only = false)
|
||||
{
|
||||
if (!isset($params['columns'])) $params['columns'] = array();
|
||||
if (!isset($params['columns'])) $params['columns'] = [];
|
||||
$params['columns'][] = 'option_id';
|
||||
$params['columns'][] = 'option_creadt';
|
||||
$params['columns'][] = 'option_upddt';
|
||||
|
@ -230,11 +229,11 @@ class postWidgetText
|
|||
$excerpt = $excerpt_xhtml = '';
|
||||
|
||||
# --BEHAVIOR-- coreAfterPostContentFormat
|
||||
$this->core->callBehavior('coreAfterPostContentFormat',array(
|
||||
$this->core->callBehavior('coreAfterPostContentFormat', [
|
||||
'excerpt' => &$excerpt,
|
||||
'content' => &$content,
|
||||
'excerpt_xhtml' => &$excerpt_xhtml,
|
||||
'content_xhtml' => &$content_xhtml
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -12,7 +12,6 @@
|
|||
*/
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -52,15 +51,15 @@ class postWidgetTextAdmin
|
|||
public static function form($main, $sidebar, $post)
|
||||
{
|
||||
# _POST fields
|
||||
$title = empty($_POST['post_wtitle']) ? '' : $_POST['post_wtitle'];
|
||||
$content = empty($_POST['post_wtext']) ? '' : $_POST['post_wtext'];
|
||||
$title = $_POST['post_wtitle'] ?? '';
|
||||
$content = $_POST['post_wtext'] ?? '';
|
||||
|
||||
# Existing post
|
||||
if ($post) {
|
||||
$post_id = (integer) $post->post_id;
|
||||
|
||||
$pwt = new postWidgetText($GLOBALS['core']);
|
||||
$w = $pwt->getWidgets(array('post_id' => $post_id));
|
||||
$w = $pwt->getWidgets(['post_id' => $post_id]);
|
||||
|
||||
# Existing widget
|
||||
if (!$w->isEmpty()) {
|
||||
|
@ -73,7 +72,7 @@ class postWidgetTextAdmin
|
|||
'<div id="post-wtext-form">' .
|
||||
'<h4>' . __('Additional widget') . '</h4>' .
|
||||
|
||||
'<p class="col">'.
|
||||
'<p class="col">'
|
||||
'<label class="bold" for="post_wtitle">' . __('Widget title:') . '</label>' .
|
||||
form::field('post_wtitle', 20, 255, html::escapeHTML($title), 'maximal') .
|
||||
'</p>' .
|
||||
|
@ -91,16 +90,14 @@ class postWidgetTextAdmin
|
|||
$post_id = (integer) $post_id;
|
||||
|
||||
# _POST fields
|
||||
$title = isset($_POST['post_wtitle']) && !empty($_POST['post_wtitle']) ?
|
||||
$_POST['post_wtitle'] : '';
|
||||
$content = isset($_POST['post_wtext']) && !empty($_POST['post_wtext']) ?
|
||||
$_POST['post_wtext'] : '';
|
||||
$title = $_POST['post_wtitle'] ?? '';
|
||||
$content = $_POST['post_wtext'] ?? '';
|
||||
|
||||
# Object
|
||||
$pwt = new postWidgetText($GLOBALS['core']);
|
||||
|
||||
# Get existing widget
|
||||
$w = $pwt->getWidgets(array('post_id'=>$post_id));
|
||||
$w = $pwt->getWidgets(['post_id' => $post_id]);
|
||||
|
||||
# If new content is empty, delete old existing widget
|
||||
if (empty($title) && empty($content) && !$w->isEmpty()) {
|
||||
|
@ -136,7 +133,7 @@ class postWidgetTextAdmin
|
|||
$pwt = new postWidgetText($GLOBALS['core']);
|
||||
|
||||
# Get existing widget
|
||||
$w = $pwt->getWidgets(array('post_id'=>$post_id));
|
||||
$w = $pwt->getWidgets(['post_id' => $post_id]);
|
||||
|
||||
# If new content is empty, delete old existing widget
|
||||
if (!$w->isEmpty()) {
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
*/
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -63,9 +62,9 @@ class postWidgetTextBackup
|
|||
) {
|
||||
$line->post_id = $bk->old_ids['post'][(integer) $line->post_id];
|
||||
|
||||
$exists = $bk->postwidgettext->getWidgets(array(
|
||||
'post_id' => $line->post_id)
|
||||
);
|
||||
$exists = $bk->postwidgettext->getWidgets([
|
||||
'post_id' => $line->post_id
|
||||
]);
|
||||
|
||||
if ($exists->isEmpty()) {
|
||||
$bk->cur_postwidgettext->clean();
|
||||
|
@ -93,9 +92,9 @@ class postWidgetTextBackup
|
|||
public static function importFull($line, $bk, dcCore $core)
|
||||
{
|
||||
if ($line->__name == 'postwidgettext') {
|
||||
$exists = $bk->postwidgettext->getWidgets(array(
|
||||
'post_id' => $line->post_id)
|
||||
);
|
||||
$exists = $bk->postwidgettext->getWidgets([
|
||||
'post_id' => $line->post_id
|
||||
]);
|
||||
|
||||
if ($exists->isEmpty()) {
|
||||
$bk->cur_postwidgettext->clean();
|
||||
|
|
|
@ -31,20 +31,14 @@ class postWidgetTextDashboard
|
|||
*/
|
||||
public static function favorites(dcCore $core, $favs)
|
||||
{
|
||||
$favs->register('postWidgetText', array(
|
||||
$favs->register('postWidgetText', [
|
||||
'title' => __('Post widget text'),
|
||||
'url' => 'plugin.php?p=postWidgetText',
|
||||
'small-icon' => 'index.php?pf=postWidgetText/icon.png',
|
||||
'large-icon' => 'index.php?pf=postWidgetText/icon-big.png',
|
||||
'permissions' => $core->auth->check(
|
||||
'usage,contentadmin',
|
||||
$core->blog->id
|
||||
),
|
||||
'active_cb' => array(
|
||||
'postWidgetTextDashboard',
|
||||
'active'
|
||||
)
|
||||
));
|
||||
'url' => $core->adminurl->get('admin.plugin.postWidgetText'),
|
||||
'small-icon' => dcPage::getPF('postWidgetText/icon.png'),
|
||||
'large-icon' => dcPage::getPF('postWidgetText/icon-big.png'),
|
||||
'permissions' => $core->auth->check('usage,contentadmin', $core->blog->id),
|
||||
'active_cb' => ['postWidgetTextDashboard', 'active']
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue