diff --git a/_admin.php b/_admin.php index d40adb8..7c99124 100644 --- a/_admin.php +++ b/_admin.php @@ -14,44 +14,44 @@ if (!defined('DC_CONTEXT_ADMIN')) { return null; } -require dirname(__FILE__) . '/_widgets.php'; +require __DIR__ . '/_widgets.php'; # Admin menu -if ($core->blog->settings->postwidgettext->postwidgettext_active) { - $_menu['Plugins']->addItem( +if (dcCore::app()->blog->settings->postwidgettext->postwidgettext_active) { + dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem( __('Post widget text'), - $core->adminurl->get('admin.plugin.postWidgetText'), + dcCore::app()->adminurl->get('admin.plugin.postWidgetText'), dcPage::getPF('postWidgetText/icon.png'), - preg_match('/' . preg_quote($core->adminurl->get('admin.plugin.postWidgetText')) . '(&.*)?$/', $_SERVER['REQUEST_URI']), - $core->auth->check('contentadmin', $core->blog->id) + preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.postWidgetText')) . '(&.*)?$/', $_SERVER['REQUEST_URI']), + dcCore::app()->auth->check(dcAuth::PERMISSION_CONTENT_ADMIN, dcCore::app()->blog->id) ); - $core->addBehavior('adminDashboardFavorites', ['adminPostWidgetText', 'adminDashboardFavorites']); + dcCore::app()->addBehavior('adminDashboardFavoritesV2', ['adminPostWidgetText', 'adminDashboardFavorites']); } # Pref -$core->addBehavior('adminFiltersLists', ['adminPostWidgetText', 'adminFiltersLists']); -$core->addBehavior('adminBlogPreferencesForm', ['adminPostWidgetText', 'adminBlogPreferencesForm']); -$core->addBehavior('adminBeforeBlogSettingsUpdate', ['adminPostWidgetText', 'adminBeforeBlogSettingsUpdate']); +dcCore::app()->addBehavior('adminFiltersListsV2', ['adminPostWidgetText', 'adminFiltersLists']); +dcCore::app()->addBehavior('adminBlogPreferencesFormV2', ['adminPostWidgetText', 'adminBlogPreferencesForm']); +dcCore::app()->addBehavior('adminBeforeBlogSettingsUpdate', ['adminPostWidgetText', 'adminBeforeBlogSettingsUpdate']); # Post -$core->addBehavior('adminPostHeaders', ['adminPostWidgetText', 'adminPostHeaders']); -$core->addBehavior('adminPostFormItems', ['adminPostWidgetText', 'adminPostFormItems']); -$core->addBehavior('adminAfterPostUpdate', ['adminPostWidgetText', 'adminAfterPostSave']); -$core->addBehavior('adminAfterPostCreate', ['adminPostWidgetText', 'adminAfterPostSave']); -$core->addBehavior('adminBeforePostDelete', ['adminPostWidgetText', 'adminBeforePostDelete']); +dcCore::app()->addBehavior('adminPostHeaders', ['adminPostWidgetText', 'adminPostHeaders']); +dcCore::app()->addBehavior('adminPostFormItems', ['adminPostWidgetText', 'adminPostFormItems']); +dcCore::app()->addBehavior('adminAfterPostUpdate', ['adminPostWidgetText', 'adminAfterPostSave']); +dcCore::app()->addBehavior('adminAfterPostCreate', ['adminPostWidgetText', 'adminAfterPostSave']); +dcCore::app()->addBehavior('adminBeforePostDelete', ['adminPostWidgetText', 'adminBeforePostDelete']); # Plugin "pages" -$core->addBehavior('adminPageHeaders', ['adminPostWidgetText', 'adminPostHeaders']); -$core->addBehavior('adminPageFormItems', ['adminPostWidgetText', 'adminPostFormItems']); -$core->addBehavior('adminAfterPageUpdate', ['adminPostWidgetText', 'adminAfterPostSave']); -$core->addBehavior('adminAfterPageCreate', ['adminPostWidgetText', 'adminAfterPostSave']); -$core->addBehavior('adminBeforePageDelete', ['adminPostWidgetText', 'adminBeforePostDelete']); +dcCore::app()->addBehavior('adminPageHeaders', ['adminPostWidgetText', 'adminPostHeaders']); +dcCore::app()->addBehavior('adminPageFormItems', ['adminPostWidgetText', 'adminPostFormItems']); +dcCore::app()->addBehavior('adminAfterPageUpdate', ['adminPostWidgetText', 'adminAfterPostSave']); +dcCore::app()->addBehavior('adminAfterPageCreate', ['adminPostWidgetText', 'adminAfterPostSave']); +dcCore::app()->addBehavior('adminBeforePageDelete', ['adminPostWidgetText', 'adminBeforePostDelete']); # Plugin "importExport" -if ($core->blog->settings->postwidgettext->postwidgettext_importexport_active) { - $core->addBehavior('exportFull', ['adminPostWidgetText', 'exportFull']); - $core->addBehavior('exportSingle', ['adminPostWidgetText', 'exportSingle']); - $core->addBehavior('importInit', ['adminPostWidgetText', 'importInit']); - $core->addBehavior('importSingle', ['adminPostWidgetText', 'importSingle']); - $core->addBehavior('importFull', ['adminPostWidgetText', 'importFull']); +if (dcCore::app()->blog->settings->postwidgettext->postwidgettext_importexport_active) { + dcCore::app()->addBehavior('exportFull', ['adminPostWidgetText', 'exportFull']); + dcCore::app()->addBehavior('exportSingle', ['adminPostWidgetText', 'exportSingle']); + dcCore::app()->addBehavior('importInit', ['adminPostWidgetText', 'importInit']); + dcCore::app()->addBehavior('importSingle', ['adminPostWidgetText', 'importSingle']); + dcCore::app()->addBehavior('importFull', ['adminPostWidgetText', 'importFull']); } diff --git a/_define.php b/_define.php index 5cf8913..1e8dc01 100644 --- a/_define.php +++ b/_define.php @@ -18,10 +18,13 @@ $this->registerModule( 'Post widget text', 'Add a widget with a text related to an entry', 'Jean-Christian Denis and Contributors', - '2021.11.06', + '2022.11.12', [ - 'requires' => [['core', '2.20']], - 'permissions' => 'usage,contentadmin', + 'requires' => [['core', '2.24']], + 'permissions' => dcCore::app()->auth->makePermissions([ + dcAuth::PERMISSION_USAGE, + dcAuth::PERMISSION_CONTENT_ADMIN, + ]), 'type' => 'plugin', 'support' => 'https://github.com/JcDenis/postWidgetText', 'details' => 'https://plugins.dotaddict.org/dc2/details/postWidgetText', diff --git a/_install.php b/_install.php index 55d7794..f647767 100644 --- a/_install.php +++ b/_install.php @@ -14,8 +14,8 @@ if (!defined('DC_CONTEXT_ADMIN')) { return null; } -$new_version = $core->plugins->moduleInfo('postWidgetText', 'version'); -$old_version = $core->getVersion('postWidgetText'); +$new_version = dcCore::app()->plugins->moduleInfo('postWidgetText', 'version'); +$old_version = dcCore::app()->getVersion('postWidgetText'); if (version_compare($old_version, $new_version, '>=')) { return; @@ -24,7 +24,7 @@ if (version_compare($old_version, $new_version, '>=')) { try { # Table is the same for plugins # pollsFactory, postTask, postWidgetText - $s = new dbStruct($core->con, $core->prefix); + $s = new dbStruct(dcCore::app()->con, dcCore::app()->prefix); $s->post_option ->option_id('bigint', 0, false) ->post_id('bigint', 0, false) @@ -41,12 +41,12 @@ try { ->index('idx_post_option_post', 'btree', 'post_id') ->index('idx_post_option_type', 'btree', 'option_type'); - $si = new dbStruct($core->con, $core->prefix); + $si = new dbStruct(dcCore::app()->con, dcCore::app()->prefix); $changes = $si->synchronize($s); # Settings - $core->blog->settings->addNamespace('postwidgettext'); - $core->blog->settings->postwidgettext->put( + dcCore::app()->blog->settings->addNamespace('postwidgettext'); + dcCore::app()->blog->settings->postwidgettext->put( 'postwidgettext_active', true, 'boolean', @@ -54,7 +54,7 @@ try { false, true ); - $core->blog->settings->postwidgettext->put( + dcCore::app()->blog->settings->postwidgettext->put( 'postwidgettext_importexport_active', true, 'boolean', @@ -64,18 +64,18 @@ try { ); # Transfert records from old table to the new one - if ($core->getVersion('postWidgetText') !== null - && version_compare($core->getVersion('postWidgetText'), '0.5', '<') + if (dcCore::app()->getVersion('postWidgetText') !== null + && version_compare(dcCore::app()->getVersion('postWidgetText'), '0.5', '<') ) { - require_once dirname(__FILE__) . '/inc/patch.0.5.php'; + require_once __DIR__ . '/inc/patch.0.5.php'; } # Set module version - $core->setVersion('postWidgetText', $new_version); + dcCore::app()->setVersion('postWidgetText', $new_version); return true; } catch (Exception $e) { - $core->error->add($e->getMessage()); + dcCore::app()->error->add($e->getMessage()); } return false; diff --git a/_widgets.php b/_widgets.php index 907b1a2..8c1babc 100644 --- a/_widgets.php +++ b/_widgets.php @@ -14,9 +14,9 @@ if (!defined('DC_RC_PATH')) { return null; } -$core->blog->settings->addNamespace('postwidgettext'); +dcCore::app()->blog->settings->addNamespace('postwidgettext'); -$core->addBehavior('initWidgets', ['postWidgetTextWidget', 'init']); +dcCore::app()->addBehavior('initWidgets', ['postWidgetTextWidget', 'init']); /** * @ingroup DC_PLUGIN_POSTWIDGETTEXT @@ -55,15 +55,13 @@ class postWidgetTextWidget public static function display($w) { - global $core, $_ctx; - if ($w->offline) { return null; } - if (!$core->blog->settings->postwidgettext->postwidgettext_active - || !$_ctx->exists('posts') - || !$_ctx->posts->post_id + if (!dcCore::app()->blog->settings->postwidgettext->postwidgettext_active + || !dcCore::app()->ctx->exists('posts') + || !dcCore::app()->ctx->posts->post_id ) { return null; } @@ -71,8 +69,8 @@ class postWidgetTextWidget $title = $w->title ?: null; $content = ''; - $pwt = new postWidgetText($core); - $rs = $pwt->getWidgets(['post_id' => $_ctx->posts->post_id]); + $pwt = new postWidgetText(); + $rs = $pwt->getWidgets(['post_id' => dcCore::app()->ctx->posts->post_id]); if ($rs->isEmpty()) { return null; @@ -85,7 +83,7 @@ class postWidgetTextWidget $content = $rs->option_content_xhtml; } if ('' == $content && $w->excerpt) { - $content = $_ctx->posts->post_excerpt_xhtml; + $content = dcCore::app()->ctx->posts->post_excerpt_xhtml; } return $w->renderDiv( diff --git a/inc/class.postwidgettext.php b/inc/class.postwidgettext.php index 72da245..7be8b31 100644 --- a/inc/class.postwidgettext.php +++ b/inc/class.postwidgettext.php @@ -21,17 +21,15 @@ if (!defined('DC_RC_PATH')) { */ class postWidgetText { - public $core; public $con; private $table; private $blog; - public function __construct($core) + public function __construct() { - $this->core = & $core; - $this->con = & $this->core->con; - $this->table = $this->core->prefix . 'post_option'; - $this->blog = $core->con->escape($core->blog->id); + $this->con = dcCore::app()->con; + $this->table = dcCore::app()->prefix . 'post_option'; + $this->blog = dcCore::app()->con->escape(dcCore::app()->blog->id); } public function tableName() @@ -56,7 +54,7 @@ class postWidgetText public function triggerBlog() { - $this->core->blog->triggerBlog(); + dcCore::app()->blog->triggerBlog(); } public function getWidgets($params, $count_only = false) @@ -77,7 +75,7 @@ class postWidgetText if (!isset($params['from'])) { $params['from'] = ''; } - $params['from'] .= 'LEFT JOIN ' . $this->table . ' W ON P.post_id=W.post_id '; + $params['join'] = 'LEFT JOIN ' . $this->table . ' W ON P.post_id=W.post_id '; if (!isset($params['sql'])) { $params['sql'] = ''; @@ -92,12 +90,15 @@ class postWidgetText $params['post_type'] = ''; } - return $this->core->blog->getPosts($params, $count_only); + return dcCore::app()->blog->getPosts($params, $count_only); } public function addWidget($cur) { - if (!$this->core->auth->check('usage,contentadmin', $this->blog)) { + if (!dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([ + dcAuth::PERMISSION_USAGE, + dcAuth::PERMISSION_CONTENT_ADMIN, + ]), $this->blog)) { throw new Exception(__('You are not allowed to create an entry text widget')); } if ($cur->post_id == '') { @@ -135,7 +136,10 @@ class postWidgetText public function updWidget($id, &$cur) { - if (!$this->core->auth->check('usage,contentadmin', $this->blog)) { + if (!dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([ + dcAuth::PERMISSION_USAGE, + dcAuth::PERMISSION_CONTENT_ADMIN, + ]), $this->blog)) { throw new Exception(__('You are not allowed to update entries text widget')); } @@ -149,9 +153,9 @@ class postWidgetText $cur->option_upddt = date('Y-m-d H:i:s'); - if (!$this->core->auth->check('contentadmin', $this->blog)) { + if (!dcCore::app()->auth->check(dcAuth::PERMISSION_CONTENT_ADMIN, $this->blog)) { $params['option_id'] = $id; - $params['user_id'] = $this->con->escape($this->core->auth->userID()); + $params['user_id'] = $this->con->escape(dcCore::app()->auth->userID()); $params['no_content'] = true; $params['limit'] = 1; @@ -168,7 +172,10 @@ class postWidgetText public function delWidget($id, $type = 'postwidgettext') { - if (!$this->core->auth->check('delete,contentadmin', $this->blog)) { + if (!dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([ + dcAuth::PERMISSION_DELETE, + dcAuth::PERMISSION_CONTENT_ADMIN, + ]), $this->blog)) { throw new Exception(__('You are not allowed to delete entries text widget')); } @@ -178,9 +185,9 @@ class postWidgetText throw new Exception(__('No such ID')); } - if (!$this->core->auth->check('contentadmin', $this->blog)) { + if (!dcCore::app()->auth->check(dcAuth::PERMISSION_CONTENT_ADMIN, $this->blog)) { $params['option_id'] = $id; - $params['user_id'] = $this->con->escape($this->core->auth->userID()); + $params['user_id'] = $this->con->escape(dcCore::app()->auth->userID()); $params['no_content'] = true; $params['limit'] = 1; @@ -220,16 +227,16 @@ class postWidgetText public function setWidgetContent($option_id, $format, $lang, &$content, &$content_xhtml) { if ($format == 'wiki') { - $this->core->initWikiPost(); - $this->core->wiki2xhtml->setOpt('note_prefix', 'wnote-' . $option_id); + dcCore::app()->initWikiPost(); + dcCore::app()->wiki2xhtml->setOpt('note_prefix', 'wnote-' . $option_id); if (strpos($lang, 'fr') === 0) { - $this->core->wiki2xhtml->setOpt('active_fr_syntax', 1); + dcCore::app()->wiki2xhtml->setOpt('active_fr_syntax', 1); } } if ($content) { - $content_xhtml = $this->core->callFormater($format, $content); - $content_xhtml = $this->core->HTMLfilter($content_xhtml); + $content_xhtml = dcCore::app()->callFormater($format, $content); + $content_xhtml = dcCore::app()->HTMLfilter($content_xhtml); } else { $content_xhtml = ''; } @@ -237,7 +244,7 @@ class postWidgetText $excerpt = $excerpt_xhtml = ''; # --BEHAVIOR-- coreAfterPostContentFormat - $this->core->callBehavior('coreAfterPostContentFormat', [ + dcCore::app()->callBehavior('coreAfterPostContentFormat', [ 'excerpt' => &$excerpt, 'content' => &$content, 'excerpt_xhtml' => &$excerpt_xhtml, diff --git a/inc/lib.pwt.admin.php b/inc/lib.pwt.admin.php index b9e2d71..f1101f6 100644 --- a/inc/lib.pwt.admin.php +++ b/inc/lib.pwt.admin.php @@ -27,7 +27,7 @@ class adminPostWidgetText ]; } - public static function adminFiltersLists(dcCore $core, $sorts) + public static function adminFiltersLists($sorts) { $sorts['pwt'] = [ __('Post widget text'), @@ -38,7 +38,7 @@ class adminPostWidgetText ]; } - public static function adminBlogPreferencesForm(dcCore $core, dcSettings $blog_settings) + public static function adminBlogPreferencesForm(dcSettings $blog_settings) { echo '
@@ -65,14 +65,14 @@ class adminPostWidgetText $blog_settings->postwidgettext->put('postwidgettext_importexport_active', !empty($_POST['importexport_active'])); } - public static function adminDashboardFavorites(dcCore $core, $favs) + public static function adminDashboardFavorites(dcFavorites $favs) { $favs->register('postWidgetText', [ 'title' => __('Post widget text'), - 'url' => $core->adminurl->get('admin.plugin.postWidgetText'), + 'url' => dcCore::app()->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), + 'permissions' => dcCore::app()->auth->check('usage,contentadmin', dcCore::app()->blog->id), 'active_cb' => ['adminPostWidgetText', 'adminDashboardFavoritesActive'] ]); } @@ -92,11 +92,10 @@ class adminPostWidgetText public static function adminPostHeaders() { - global $core; - $editor = $core->auth->getOption('editor'); + $editor = dcCore::app()->auth->getOption('editor'); return - $core->callBehavior('adminPostEditor', $editor['xhtml'], 'pwt', ['#post_wtext'], 'xhtml') . + dcCore::app()->callBehavior('adminPostEditor', $editor['xhtml'], 'pwt', ['#post_wtext'], 'xhtml') . dcPage::jsLoad(dcPage::getPF('postWidgetText/js/post.js')); } @@ -110,7 +109,7 @@ class adminPostWidgetText if ($post) { $post_id = (int) $post->post_id; - $pwt = new postWidgetText($GLOBALS['core']); + $pwt = new postWidgetText(); $w = $pwt->getWidgets(['post_id' => $post_id]); # Existing widget @@ -145,7 +144,7 @@ class adminPostWidgetText $content = $_POST['post_wtext'] ?? ''; # Object - $pwt = new postWidgetText($GLOBALS['core']); + $pwt = new postWidgetText(); # Get existing widget $w = $pwt->getWidgets(['post_id' => $post_id]); @@ -181,7 +180,7 @@ class adminPostWidgetText $post_id = (int) $post_id; # Object - $pwt = new postWidgetText($GLOBALS['core']); + $pwt = new postWidgetText(); # Get existing widget $w = $pwt->getWidgets(['post_id' => $post_id]); @@ -198,8 +197,8 @@ class adminPostWidgetText 'postwidgettext', 'SELECT option_type, option_content, ' . 'option_content_xhtml, W.post_id ' . - 'FROM ' . $core->prefix . 'post_option W ' . - 'LEFT JOIN ' . $core->prefix . 'post P ' . + 'FROM ' . dcCore::app()->prefix . 'post_option W ' . + 'LEFT JOIN ' . dcCore::app()->prefix . 'post P ' . 'ON P.post_id = W.post_id ' . "WHERE P.blog_id = '" . $blog_id . "' " . "AND W.option_type = 'postwidgettext' " @@ -212,8 +211,8 @@ class adminPostWidgetText 'postwidgettext', 'SELECT option_type, option_content, ' . 'option_content_xhtml, W.post_id ' . - 'FROM ' . $core->prefix . 'post_option W ' . - 'LEFT JOIN ' . $core->prefix . 'post P ' . + 'FROM ' . dcCore::app()->prefix . 'post_option W ' . + 'LEFT JOIN ' . dcCore::app()->prefix . 'post P ' . 'ON P.post_id = W.post_id ' . "WHERE W.option_type = 'postwidgettext' " ); @@ -221,10 +220,10 @@ class adminPostWidgetText public static function importInit($bk, dcCore $core) { - $bk->cur_postwidgettext = $core->con->openCursor( - $core->prefix . 'post_option' + $bk->cur_postwidgettext = dcCore::app()->con->openCursor( + dcCore::app()->prefix . 'post_option' ); - $bk->postwidgettext = new postWidgetText($core); + $bk->postwidgettext = new postWidgetText(); } public static function importSingle($line, $bk, dcCore $core) diff --git a/inc/lib.pwt.list.php b/inc/lib.pwt.list.php index a378bdf..a4a2bc1 100644 --- a/inc/lib.pwt.list.php +++ b/inc/lib.pwt.list.php @@ -71,7 +71,7 @@ class listPostWidgetText extends adminGenericList !$this->rs->isEditable() ) . '' . '' . diff --git a/inc/patch.0.5.php b/inc/patch.0.5.php index d8cc958..e8954ac 100644 --- a/inc/patch.0.5.php +++ b/inc/patch.0.5.php @@ -10,18 +10,18 @@ * @copyright Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html */ -$records = $core->con->select( - 'SELECT W.*, P.post_lang, P.post_format FROM ' . $core->prefix . 'post_wtext W ' . - 'LEFT JOIN ' . $core->prefix . 'post P ON P.post_id=W.post_id ' +$records = dcCore::app()->con->select( + 'SELECT W.*, P.post_lang, P.post_format FROM ' . dcCore::app()->prefix . 'post_wtext W ' . + 'LEFT JOIN ' . dcCore::app()->prefix . 'post P ON P.post_id=W.post_id ' ); if (!$records->isEmpty()) { - $cur = $core->con->openCursor($core->prefix . 'post_option'); + $cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . 'post_option'); while ($records->fetch()) { - $core->con->writeLock($core->prefix . 'post_option'); + dcCore::app()->con->writeLock(dcCore::app()->prefix . 'post_option'); try { - $id = $core->con->select( - 'SELECT MAX(option_id) FROM ' . $core->prefix . 'post_option' + $id = dcCore::app()->con->select( + 'SELECT MAX(option_id) FROM ' . dcCore::app()->prefix . 'post_option' )->f(0) + 1; $cur->clean(); @@ -38,9 +38,9 @@ if (!$records->isEmpty()) { $cur->option_content_xhtml = $records->wtext_content_xhtml; $cur->insert(); - $core->con->unlock(); + dcCore::app()->con->unlock(); } catch (Exception $e) { - $core->con->unlock(); + dcCore::app()->con->unlock(); throw $e; } diff --git a/index.php b/index.php index 0c6ddec..0a8d0cb 100644 --- a/index.php +++ b/index.php @@ -14,9 +14,12 @@ if (!defined('DC_CONTEXT_ADMIN')) { return null; } -dcPage::check('usage,contentadmin'); +dcPage::check(dcCore::app()->auth->makePermissions([ + dcAuth::PERMISSION_USAGE, + dcAuth::PERMISSION_CONTENT_ADMIN, + ])); -$pwt = new postWidgetText($core); +$pwt = new postWidgetText(); # Delete widgets if (!empty($_POST['save']) && !empty($_POST['widgets'])) { @@ -26,21 +29,21 @@ if (!empty($_POST['save']) && !empty($_POST['widgets'])) { $pwt->delWidget($id); } - dcPage::addSuccessNotice( + dcAdminNotices::addSuccessNotice( __('Posts widgets successfully delete.') ); if (!empty($_POST['redir'])) { http::redirect($_POST['redir']); } else { - $core->adminurl->redirect('admin.plugin.postWidgetText'); + dcCore::app()->adminurl->redirect('admin.plugin.postWidgetText'); } } catch (Exception $e) { - $core->error->add($e->getMessage()); + dcCore::app()->error->add($e->getMessage()); } } # filters -$filter = new adminGenericFilter($core, 'pwt'); +$filter = new adminGenericFilter(dcCore::app(), 'pwt'); $filter->add(dcAdminFilters::getPageFilter()); $params = $filter->params(); @@ -48,16 +51,16 @@ $params = $filter->params(); try { $posts = $pwt->getWidgets($params); $counter = $pwt->getWidgets($params, true); - $posts_list = new listPostWidgetText($core, $posts, $counter->f(0)); + $posts_list = new listPostWidgetText(dcCore::app(), $posts, $counter->f(0)); } catch (Exception $e) { - $core->error->add($e->getMessage()); + dcCore::app()->error->add($e->getMessage()); } # Display echo ' ' . __('Post widget text') . '' . dcPage::jsLoad(dcPage::getPF('postWidgetText/js/index.js')) . -$filter->js($core->adminurl->get('admin.plugin.postWidgetText')) . ' +$filter->js(dcCore::app()->adminurl->get('admin.plugin.postWidgetText')) . ' ' . @@ -72,14 +75,14 @@ $filter->display('admin.plugin.postWidgetText', form::hidden('p', 'postWidgetTex $posts_list->display( $filter->page, $filter->nb, - '
' . + '' . '%s' . '
' . '

' . '

' . '

' . - $core->adminurl->getHiddenFormFields('admin.plugin.postWidgetText', array_merge(['p' => 'postWidgetText'], $filter->values(true))) . - $core->formNonce() . + dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.postWidgetText', array_merge(['p' => 'postWidgetText'], $filter->values(true))) . + dcCore::app()->formNonce() . '
' . '
' );