From 4301e8c1338f48a59d8d237a7c6951496a59d4b4 Mon Sep 17 00:00:00 2001
From: Jean-Christian Denis
Date: Thu, 17 Nov 2022 22:01:00 +0100
Subject: [PATCH] prepare to DC 2.24
---
_admin.php | 40 ++---
_config.php | 22 +--
_define.php | 8 +-
_install.php | 18 +--
_prepend.php | 20 ++-
_public.php | 167 +++++++++++----------
_widgets.php | 60 ++++----
inc/class.cinecturlink2.php | 46 +++---
inc/lib.cinecturlink2.activityreport.php | 30 ++--
inc/lib.cinecturlink2.context.php | 24 ++-
inc/lib.cinecturlink2.list.php | 18 +--
inc/lib.sitemaps.cinecturlink2.php | 19 ++-
index.php | 180 +++++++++++------------
13 files changed, 316 insertions(+), 336 deletions(-)
diff --git a/_admin.php b/_admin.php
index f551f60..751db23 100644
--- a/_admin.php
+++ b/_admin.php
@@ -14,30 +14,30 @@ if (!defined('DC_CONTEXT_ADMIN')) {
return null;
}
-require_once dirname(__FILE__) . '/_widgets.php';
+require_once __DIR__ . '/_widgets.php';
-$_menu['Plugins']->addItem(
+dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
__('My cinecturlink'),
- $core->adminurl->get('admin.plugin.cinecturlink2'),
+ dcCore::app()->adminurl->get('admin.plugin.cinecturlink2'),
dcPage::getPF('cinecturlink2/icon.png'),
preg_match(
- '/' . preg_quote($core->adminurl->get('admin.plugin.cinecturlink2')) . '(&.*)?$/',
+ '/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.cinecturlink2')) . '(&.*)?$/',
$_SERVER['REQUEST_URI']
),
- $core->auth->check('contentadmin', $core->blog->id)
+ dcCore::app()->auth->check(dcAuth::PERMISSION_CONTENT_ADMIN, dcCore::app()->blog->id)
);
-$core->addBehavior(
- 'adminColumnsLists',
+dcCore::app()->addBehavior(
+ 'adminColumnsListsV2',
['cinecturlink2AdminBehaviors', 'adminColumnsLists']
);
-$core->addBehavior(
- 'adminFiltersLists',
+dcCore::app()->addBehavior(
+ 'adminFiltersListsV2',
['cinecturlink2AdminBehaviors', 'adminFiltersLists']
);
-$core->addBehavior(
- 'adminDashboardFavorites',
+dcCore::app()->addBehavior(
+ 'adminDashboardFavoritesV2',
['cinecturlink2AdminBehaviors', 'adminDashboardFavorites']
);
@@ -52,11 +52,11 @@ class cinecturlink2AdminBehaviors
__('Author') => 'link_author',
__('Description') => 'link_desc',
__('Link') => 'link_url',
- __('Rating') => 'link_note'
+ __('Rating') => 'link_note',
];
}
- public static function adminColumnsLists($core, $cols)
+ public static function adminColumnsLists($cols)
{
$cols['c2link'] = [
__('Cinecturlink'),
@@ -67,30 +67,30 @@ class cinecturlink2AdminBehaviors
'desc' => [false, __('Description')],
'link' => [true, __('Liens')],
'note' => [true, __('Rating')],
- ]
+ ],
];
}
- public static function adminFiltersLists($core, $sorts)
+ public static function adminFiltersLists($sorts)
{
$sorts['c2link'] = [
__('Cinecturlink'),
self::adminSortbyCombo(),
'link_upddt',
'desc',
- [__('Links per page'), 30]
+ [__('Links per page'), 30],
];
}
- public static function adminDashboardFavorites($core, $favs)
+ public static function adminDashboardFavorites($favs)
{
$favs->register('cinecturlink2', [
'title' => __('My cinecturlink'),
- 'url' => $core->adminurl->get('admin.plugin.cinecturlink2') . '#links',
+ 'url' => dcCore::app()->adminurl->get('admin.plugin.cinecturlink2') . '#links',
'small-icon' => dcPage::getPF('cinecturlink2/icon.png'),
'large-icon' => dcPage::getPF('cinecturlink2/icon-big.png'),
- 'permissions' => $core->auth->check('contentadmin', $core->blog->id),
- 'active_cb' => ['cinecturlink2AdminBehaviors', 'adminDashboardFavoritesActive']
+ 'permissions' => dcCore::app()->auth->check('contentadmin', dcCore::app()->blog->id),
+ 'active_cb' => ['cinecturlink2AdminBehaviors', 'adminDashboardFavoritesActive'],
]);
}
diff --git a/_config.php b/_config.php
index 1cd274c..e309ef6 100644
--- a/_config.php
+++ b/_config.php
@@ -15,13 +15,13 @@ if (!defined('DC_CONTEXT_MODULE')) {
}
# Check user perms
-dcPage::check('admin');
+dcPage::check(dcAuth::PERMISSION_ADMIN);
$redir = empty($_REQUEST['redir']) ?
- $list->getURL() . '#plugins' : $_REQUEST['redir'];
+ dcCore::app()->admin->list->getURL() . '#plugins' : $_REQUEST['redir'];
-$core->blog->settings->addNamespace('cinecturlink2');
-$s = $core->blog->settings->cinecturlink2;
+dcCore::app()->blog->settings->addNamespace('cinecturlink2');
+$s = dcCore::app()->blog->settings->cinecturlink2;
$cinecturlink2_active = (bool) $s->cinecturlink2_active;
$cinecturlink2_widthmax = abs((int) $s->cinecturlink2_widthmax);
$cinecturlink2_folder = (string) $s->cinecturlink2_folder;
@@ -34,7 +34,7 @@ if ($cinecturlink2_public_nbrpp < 1) {
$cinecturlink2_public_nbrpp = 10;
}
-$combo_dirs = cinecturlink2::getPublicDirs($core);
+$combo_dirs = cinecturlink2::getPublicDirs();
if (!empty($_POST['save'])) {
try {
@@ -56,7 +56,7 @@ if (!empty($_POST['save'])) {
throw new Exception(__('You must provide a specific folder for images.'));
}
cinecturlink2::makePublicDir(
- DC_ROOT . '/' . $core->blog->settings->system->public_path,
+ DC_ROOT . '/' . dcCore::app()->blog->settings->system->public_path,
$cinecturlink2_folder,
true
);
@@ -69,15 +69,15 @@ if (!empty($_POST['save'])) {
$s->put('cinecturlink2_folder', $cinecturlink2_folder);
$s->put('cinecturlink2_triggeronrandom', $cinecturlink2_triggeronrandom);
- dcPage::addSuccessNotice(
+ dcAdminNotices::addSuccessNotice(
__('Configuration successfully updated.')
);
- $core->adminurl->redirect(
+ dcCore::app()->adminurl->redirect(
'admin.plugins',
- ['module' => 'cinecturlink2', 'conf' => 1, 'redir' => $list->getRedir()]
+ ['module' => 'cinecturlink2', 'conf' => 1, 'redir' => dcCore::app()->admin->list->getRedir()]
);
} catch (Exception $e) {
- $core->error->add($e->getMessage());
+ dcCore::app()->error->add($e->getMessage());
}
}
@@ -116,7 +116,7 @@ __('Update cache when use "Random" or "Number of view" order on widget (Need rel
-' . sprintf(__('Public page has url: %s'), '' . $core->blog->url . $core->url->getBase('cinecturlink2') . '') . '
+' . sprintf(__('Public page has url: %s'), '' . dcCore::app()->blog->url . dcCore::app()->url->getBase('cinecturlink2') . '') . '
' .
form::field('cinecturlink2_public_title', 60, 255, $cinecturlink2_public_title, 'maximal') . '
diff --git a/_define.php b/_define.php
index e7c3ae8..8d61558 100644
--- a/_define.php
+++ b/_define.php
@@ -24,13 +24,13 @@ $this->registerModule(
'Cinecturlink 2',
'Widgets and pages about books, musics, films, blogs you are interested in',
'Jean-Christian Denis and Contributors',
- '1.0.0',
+ '1.1.0',
[
- 'requires' => [['core', '2.20']],
- 'permissions' => 'contentadmin',
+ 'requires' => [['core', '2.24']],
+ 'permissions' => dcAuth::PERMISSION_CONTENT_ADMIN,
'type' => 'plugin',
'support' => 'https://github.com/JcDenis/cinecturlink2',
'details' => 'https://plugins.dotaddict.org/dc2/details/cinecturlink2',
- 'repository' => 'https://raw.githubusercontent.com/JcDenis/cinecturlink2/master/dcstore.xml'
+ 'repository' => 'https://raw.githubusercontent.com/JcDenis/cinecturlink2/master/dcstore.xml',
]
);
diff --git a/_install.php b/_install.php
index 307f244..00f4482 100644
--- a/_install.php
+++ b/_install.php
@@ -14,15 +14,15 @@ if (!defined('DC_CONTEXT_ADMIN')) {
return null;
}
-$new_version = $core->plugins->moduleInfo('cinecturlink2', 'version');
-$old_version = $core->getVersion('cinecturlink2');
+$new_version = dcCore::app()->plugins->moduleInfo('cinecturlink2', 'version');
+$old_version = dcCore::app()->getVersion('cinecturlink2');
if (version_compare($old_version, $new_version, '>=')) {
return;
}
try {
- $s = new dbStruct($core->con, $core->prefix);
+ $s = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
$s->cinecturlink2
->link_id('bigint', 0, false)
->blog_id('varchar', 32, false)
@@ -62,11 +62,11 @@ try {
->index('idx_cinecturlink2_cat_blog_id', 'btree', 'blog_id')
->unique('uk_cinecturlink2_cat_title', 'cat_title', 'blog_id');
- $si = new dbStruct($core->con, $core->prefix);
+ $si = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
$changes = $si->synchronize($s);
- $core->blog->settings->addNamespace('cinecturlink2');
- $s = $core->blog->settings->cinecturlink2;
+ dcCore::app()->blog->settings->addNamespace('cinecturlink2');
+ $s = dcCore::app()->blog->settings->cinecturlink2;
$s->put('cinecturlink2_active', true, 'boolean', 'Enable cinecturlink2', false, true);
$s->put('cinecturlink2_widthmax', 100, 'integer', 'Maximum width of picture', false, true);
$s->put('cinecturlink2_folder', 'cinecturlink', 'string', 'Public folder of pictures', false, true);
@@ -77,14 +77,14 @@ try {
$s->put('cinecturlink2_public_nbrpp', 20, 'integer', 'Number of entries per page on public page', false, true);
$s->put('cinecturlink2_public_caturl', 'c2cat', 'string', 'Part of URL for a category list', false, true);
- $core->setVersion(
+ dcCore::app()->setVersion(
'cinecturlink2',
- $core->plugins->moduleInfo('cinecturlink2', 'version')
+ dcCore::app()->plugins->moduleInfo('cinecturlink2', 'version')
);
return true;
} catch (Exception $e) {
- $core->error->add($e->getMessage());
+ dcCore::app()->error->add($e->getMessage());
}
return false;
diff --git a/_prepend.php b/_prepend.php
index fbeb6d8..ed6065b 100644
--- a/_prepend.php
+++ b/_prepend.php
@@ -14,30 +14,28 @@ if (!defined('DC_RC_PATH')) {
return null;
}
-$d = dirname(__FILE__) . '/inc/';
+Clearbricks::lib()->autoload(['cinecturlink2' => __DIR__ . '/inc/class.cinecturlink2.php']);
+Clearbricks::lib()->autoload(['cinecturlink2Context' => __DIR__ . '/inc/lib.cinecturlink2.context.php']);
+Clearbricks::lib()->autoload(['adminlistCinecturlink2' => __DIR__ . '/inc/lib.cinecturlink2.list.php']);
+Clearbricks::lib()->autoload(['sitemapsCinecturlink2' => __DIR__ . '/inc/lib.sitemaps.cinecturlink2.php']);
+Clearbricks::lib()->autoload(['cinecturlink2ActivityReportBehaviors' => __DIR__ . '/inc/lib.cinecturlink2.activityreport.php']);
-$__autoload['cinecturlink2'] = $d . 'class.cinecturlink2.php';
-$__autoload['cinecturlink2Context'] = $d . 'lib.cinecturlink2.context.php';
-$__autoload['adminlistCinecturlink2'] = $d . 'lib.cinecturlink2.list.php';
-$__autoload['sitemapsCinecturlink2'] = $d . 'lib.sitemaps.cinecturlink2.php';
-$__autoload['cinecturlink2ActivityReportBehaviors'] = $d . 'lib.cinecturlink2.activityreport.php';
-
-$core->url->register(
+dcCore::app()->url->register(
'cinecturlink2',
'cinecturlink',
'^cinecturlink(?:/(.+))?$',
['urlCinecturlink2', 'c2Page']
);
-$core->addBehavior(
+dcCore::app()->addBehavior(
'sitemapsDefineParts',
['sitemapsCinecturlink2', 'sitemapsDefineParts']
);
-$core->addBehavior(
+dcCore::app()->addBehavior(
'sitemapsURLsCollect',
['sitemapsCinecturlink2', 'sitemapsURLsCollect']
);
if (defined('ACTIVITY_REPORT')) {
- cinecturlink2ActivityReportBehaviors::add($core);
+ cinecturlink2ActivityReportBehaviors::add();
}
diff --git a/_public.php b/_public.php
index be7d401..a7bd2db 100644
--- a/_public.php
+++ b/_public.php
@@ -14,9 +14,9 @@ if (!defined('DC_RC_PATH')) {
return null;
}
-require_once dirname(__FILE__) . '/_widgets.php';
+require_once __DIR__ . '/_widgets.php';
-$core->blog->settings->addNamespace('cinecturlink2');
+dcCore::app()->blog->settings->addNamespace('cinecturlink2');
$c2_tpl_values = [
'c2PageFeedID',
@@ -56,7 +56,7 @@ $c2_tpl_values = [
'c2CategoryID',
'c2CategoryTitle',
'c2CategoryDescription',
- 'c2CategoryURL'
+ 'c2CategoryURL',
];
$c2_tpl_blocks = [
@@ -73,19 +73,19 @@ $c2_tpl_blocks = [
'c2Categories',
'c2CategoriesHeader',
'c2CategoriesFooter',
- 'c2CategoryIf'
+ 'c2CategoryIf',
];
-if ($core->blog->settings->cinecturlink2->cinecturlink2_active) {
+if (dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_active) {
foreach ($c2_tpl_blocks as $v) {
- $core->tpl->addBlock($v, ['tplCinecturlink2', $v]);
+ dcCore::app()->tpl->addBlock($v, ['tplCinecturlink2', $v]);
}
foreach ($c2_tpl_values as $v) {
- $core->tpl->addValue($v, ['tplCinecturlink2', $v]);
+ dcCore::app()->tpl->addValue($v, ['tplCinecturlink2', $v]);
}
} else {
foreach (array_merge($c2_tpl_blocks, $c2_tpl_values) as $v) {
- $core->tpl->addBlock($v, ['tplCinecturlink2', 'disable']);
+ dcCore::app()->tpl->addBlock($v, ['tplCinecturlink2', 'disable']);
}
}
@@ -93,19 +93,19 @@ class urlCinecturlink2 extends dcUrlHandlers
{
public static function c2Page($args)
{
- global $core, $_ctx;
- $core->blog->settings->addNamespace('cinecturlink2');
+ dcCore::app()->blog->settings->addNamespace('cinecturlink2');
+ $args = (string) $args;
- if (!$core->blog->settings->cinecturlink2->cinecturlink2_active
- || !$core->blog->settings->cinecturlink2->cinecturlink2_public_active) {
+ if (!dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_active
+ || !dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_public_active) {
self::p404();
return null;
}
- $core->tpl->setPath(
- $core->tpl->getPath(),
- dirname(__FILE__) . '/default-templates/'
+ dcCore::app()->tpl->setPath(
+ dcCore::app()->tpl->getPath(),
+ __DIR__ . '/default-templates/'
);
$params = [];
@@ -115,7 +115,7 @@ class urlCinecturlink2 extends dcUrlHandlers
$GLOBALS['c2_page_number'] = $n;
}
- $caturl = $core->blog->settings->cinecturlink2->cinecturlink2_public_caturl;
+ $caturl = dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_public_caturl;
if (!$caturl) {
$caturl = 'c2cat';
}
@@ -133,12 +133,12 @@ class urlCinecturlink2 extends dcUrlHandlers
if ($f && in_array($f, ['atom', 'rss2'])) {
$mime = $f == 'atom' ? 'application/atom+xml' : 'application/xml';
- //$_ctx->short_feed_items = $core->blog->settings->system->short_feed_items;
+ //dcCore::app()->ctx->short_feed_items = dcCore::app()->blog->settings->system->short_feed_items;
- $params['limit'] = $core->blog->settings->system->nb_post_per_feed;
- $_ctx->c2_page_params = $params;
+ $params['limit'] = dcCore::app()->blog->settings->system->nb_post_per_feed;
+ dcCore::app()->ctx->c2_page_params = $params;
- header('X-Robots-Tag: ' . context::robotsPolicy($core->blog->settings->system->robots_policy, ''));
+ header('X-Robots-Tag: ' . context::robotsPolicy(dcCore::app()->blog->settings->system->robots_policy, ''));
self::serveDocument('cinecturlink2-' . $f . '.xml', $mime);
} else {
$d = self::getPageArgs($args, 'c2detail');
@@ -150,8 +150,8 @@ class urlCinecturlink2 extends dcUrlHandlers
}
}
- $params['limit'] = $core->blog->settings->cinecturlink2->cinecturlink2_public_nbrpp;
- $_ctx->c2_page_params = $params;
+ $params['limit'] = dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_public_nbrpp;
+ dcCore::app()->ctx->c2_page_params = $params;
self::serveDocument('cinecturlink2.html', 'text/html');
}
@@ -180,27 +180,27 @@ class tplCinecturlink2
public static function c2PageURL($a)
{
- return 'tpl->getFilters($a), '$core->blog->url.$core->url->getBase(\'cinecturlink2\')') . '; ?>';
+ return 'tpl->getFilters($a), 'dcCore::app()->blog->url.dcCore::app()->url->getBase(\'cinecturlink2\')') . '; ?>';
}
public static function c2PageTitle($a)
{
- return "blog->settings->cinecturlink2->cinecturlink2_public_title; if (empty(\$title)) { \$title = __('My cinecturlink'); } echo " . sprintf($GLOBALS['core']->tpl->getFilters($a), '$title') . '; ?>';
+ return "blog->settings->cinecturlink2->cinecturlink2_public_title; if (empty(\$title)) { \$title = __('My cinecturlink'); } echo " . sprintf(dcCore::app()->tpl->getFilters($a), '$title') . '; ?>';
}
public static function c2PageFeedURL($a)
{
- return 'tpl->getFilters($a), '$core->blog->url.$core->url->getBase("cinecturlink2")."/feed/' . (!empty($a['type']) && preg_match('#^(rss2|atom)$#', $a['type']) ? $a['type'] : 'atom') . '"') . '; ?>';
+ return 'tpl->getFilters($a), 'dcCore::app()->blog->url.dcCore::app()->url->getBase("cinecturlink2")."/feed/' . (!empty($a['type']) && preg_match('#^(rss2|atom)$#', $a['type']) ? $a['type'] : 'atom') . '"') . '; ?>';
}
public static function c2PageFeedID($a)
{
- return 'urn:md5:blog->id."cinecturlink2"); ?>';
+ return 'urn:md5:blog->id."cinecturlink2"); ?>';
}
public static function c2PageDescription($a)
{
- return 'blog->settings->cinecturlink2->cinecturlink2_public_description; echo ' . sprintf($GLOBALS['core']->tpl->getFilters($a), '$description') . '; ?>';
+ return 'blog->settings->cinecturlink2->cinecturlink2_public_description; echo ' . sprintf(dcCore::app()->tpl->getFilters($a), '$description') . '; ?>';
}
public static function c2If($a, $c)
@@ -211,12 +211,12 @@ class tplCinecturlink2
if (isset($a['request_link'])) {
$sign = (bool) $a['request_link'] ? '' : '!';
- $if[] = $sign . '(isset($_ctx->c2_page_params["link_id"]) || isset($_ctx->c2_page_params["link_title"]))';
+ $if[] = $sign . '(isset(dcCore::app()->ctx->c2_page_params["link_id"]) || isset(dcCore::app()->ctx->c2_page_params["link_title"]))';
}
if (isset($a['request_cat'])) {
$sign = (bool) $a['request_cat'] ? '' : '!';
- $if[] = $sign . '(isset($_ctx->c2_page_params["cat_id"]) || isset($_ctx->c2_page_params["cat_title"]))';
+ $if[] = $sign . '(isset(dcCore::app()->ctx->c2_page_params["cat_id"]) || isset(dcCore::app()->ctx->c2_page_params["cat_title"]))';
}
return empty($if) ? $c : '\n" . $c . "\n";
@@ -258,24 +258,24 @@ class tplCinecturlink2
return
"c2_page_params) ? \$_ctx->c2_page_params : array(); \n" .
+ "\$params = is_array(dcCore::app()->ctx->c2_page_params) ? dcCore::app()->ctx->c2_page_params : array(); \n" .
$res .
- "\$_ctx->c2_params = \$params; unset(\$params);\n" .
- "if (!\$_ctx->exists('cinecturlink')) { \$_ctx->cinecturlink = new cinecturlink2(\$core); } \n" .
- "\$_ctx->c2_entries = \$_ctx->cinecturlink->getLinks(\$_ctx->c2_params); \n" .
- 'while ($_ctx->c2_entries->fetch()) : ?>' . $c . 'c2_entries = null; \$_ctx->c2_params = null; \n" .
+ "dcCore::app()->ctx->c2_params = \$params; unset(\$params);\n" .
+ "if (!dcCore::app()->ctx->exists('cinecturlink')) { dcCore::app()->ctx->cinecturlink = new cinecturlink2(); } \n" .
+ "dcCore::app()->ctx->c2_entries = dcCore::app()->ctx->cinecturlink->getLinks(dcCore::app()->ctx->c2_params); \n" .
+ 'while (dcCore::app()->ctx->c2_entries->fetch()) : ?>' . $c . 'ctx->pop('c2_entries'); dcCore::app()->ctx->pop('c2_params'); \n" .
"?>\n";
}
public static function c2EntriesHeader($a, $c)
{
- return 'c2_entries->isStart()) : ?>' . $c . '';
+ return 'ctx->c2_entries->isStart()) : ?>' . $c . '';
}
public static function c2EntriesFooter($a, $c)
{
- return 'c2_entries->isEnd()) : ?>' . $c . '';
+ return 'ctx->c2_entries->isEnd()) : ?>' . $c . '';
}
public static function c2EntryIf($a, $c)
@@ -286,7 +286,7 @@ class tplCinecturlink2
if (isset($a['has_category'])) {
$sign = (bool) $a['has_category'] ? '!' : '=';
- $if[] = '($_ctx->exists("c2_entries") && "" ' . $sign . '= $_ctx->c2_entries->cat_title)';
+ $if[] = '(dcCore::app()->ctx->exists("c2_entries") && "" ' . $sign . '= dcCore::app()->ctx->c2_entries->cat_title)';
}
return empty($if) ? $c : '\n" . $c . "\n";
@@ -294,106 +294,105 @@ class tplCinecturlink2
public static function c2EntryIfFirst($a)
{
- return 'c2_entries->index() == 0) { echo "' . (isset($a['return']) ? addslashes(html::escapeHTML($a['return'])) : 'first') . '"; } ?>';
+ return 'ctx->c2_entries->index() == 0) { echo "' . (isset($a['return']) ? addslashes(html::escapeHTML($a['return'])) : 'first') . '"; } ?>';
}
public static function c2EntryIfOdd($a)
{
- return 'c2_entries->index()+1)%2 == 1) { echo "' . (isset($a['return']) ? addslashes(html::escapeHTML($a['return'])) : 'odd') . '"; } ?>';
+ return 'ctx->c2_entries->index()+1)%2 == 1) { echo "' . (isset($a['return']) ? addslashes(html::escapeHTML($a['return'])) : 'odd') . '"; } ?>';
}
public static function c2EntryFeedID($a)
{
- return 'urn:md5:c2_entries->blog_id.$_ctx->c2_entries->link_id.$_ctx->c2_entries->link_creadt); ?>';
+ return 'urn:md5:ctx->c2_entries->blog_id.dcCore::app()->ctx->c2_entries->link_id.dcCore::app()->ctx->c2_entries->link_creadt); ?>';
}
public static function c2EntryID($a)
{
- return self::getGenericValue('$_ctx->c2_entries->link_id', $a);
+ return self::getGenericValue('dcCore::app()->ctx->c2_entries->link_id', $a);
}
public static function c2EntryTitle($a)
{
- return self::getGenericValue('$_ctx->c2_entries->link_title', $a);
+ return self::getGenericValue('dcCore::app()->ctx->c2_entries->link_title', $a);
}
public static function c2EntryDescription($a)
{
- return self::getGenericValue('$_ctx->c2_entries->link_desc', $a);
+ return self::getGenericValue('dcCore::app()->ctx->c2_entries->link_desc', $a);
}
public static function c2EntryAuthorCommonName($a)
{
- return self::getGenericValue('dcUtils::getUserCN($_ctx->c2_entries->user_id,$_ctx->c2_entries->user_name,$_ctx->c2_entries->user_firstname,$_ctx->c2_entries->user_displayname)', $a);
+ return self::getGenericValue('dcUtils::getUserCN(dcCore::app()->ctx->c2_entries->user_id,dcCore::app()->ctx->c2_entries->user_name,dcCore::app()->ctx->c2_entries->user_firstname,dcCore::app()->ctx->c2_entries->user_displayname)', $a);
}
public static function c2EntryAuthorDisplayName($a)
{
- return self::getGenericValue('$_ctx->c2_entries->user_displayname', $a);
+ return self::getGenericValue('dcCore::app()->ctx->c2_entries->user_displayname', $a);
}
public static function c2EntryAuthorID($a)
{
- return self::getGenericValue('$_ctx->c2_entries->user_id', $a);
+ return self::getGenericValue('dcCore::app()->ctx->c2_entries->user_id', $a);
}
public static function c2EntryAuthorEmail($a)
{
- return self::getGenericValue((isset($a['spam_protected']) && !$a['spam_protected'] ? '$_ctx->c2_entries->user_email' : "strtr(\$_ctx->c2_entries->user_email,array('@'=>'%40','.'=>'%2e'))"), $a);
+ return self::getGenericValue((isset($a['spam_protected']) && !$a['spam_protected'] ? 'dcCore::app()->ctx->c2_entries->user_email' : "strtr(dcCore::app()->ctx->c2_entries->user_email,array('@'=>'%40','.'=>'%2e'))"), $a);
}
public static function c2EntryAuthorLink($a)
{
- return self::getGenericValue('sprintf(($_ctx->c2_entries->user_url ? \'%1$s\' : \'%1$s\'),html::escapeHTML(dcUtils::getUserCN($_ctx->c2_entries->user_id,$_ctx->c2_entries->user_name,$_ctx->c2_entries->user_firstname,$_ctx->c2_entries->user_displayname)),html::escapeHTML($_ctx->c2_entries->user_url))', $a);
+ return self::getGenericValue('sprintf((dcCore::app()->ctx->c2_entries->user_url ? \'%1$s\' : \'%1$s\'),html::escapeHTML(dcUtils::getUserCN(dcCore::app()->ctx->c2_entries->user_id,dcCore::app()->ctx->c2_entries->user_name,dcCore::app()->ctx->c2_entries->user_firstname,dcCore::app()->ctx->c2_entries->user_displayname)),html::escapeHTML(dcCore::app()->ctx->c2_entries->user_url))', $a);
}
public static function c2EntryAuthorURL($a)
{
- return self::getGenericValue('$_ctx->c2_entries->user_url', $a);
+ return self::getGenericValue('dcCore::app()->ctx->c2_entries->user_url', $a);
}
public static function c2EntryFromAuthor($a)
{
- return self::getGenericValue('$_ctx->c2_entries->link_author', $a);
+ return self::getGenericValue('dcCore::app()->ctx->c2_entries->link_author', $a);
}
public static function c2EntryLang($a)
{
- return self::getGenericValue('$_ctx->c2_entries->link_lang', $a);
+ return self::getGenericValue('dcCore::app()->ctx->c2_entries->link_lang', $a);
}
public static function c2EntryURL($a)
{
- return self::getGenericValue('$_ctx->c2_entries->link_url', $a);
+ return self::getGenericValue('dcCore::app()->ctx->c2_entries->link_url', $a);
}
public static function c2EntryCategory($a)
{
- return self::getGenericValue('$_ctx->c2_entries->cat_title', $a);
+ return self::getGenericValue('dcCore::app()->ctx->c2_entries->cat_title', $a);
}
public static function c2EntryCategoryID($a)
{
- return self::getGenericValue('$_ctx->c2_entries->cat_id', $a);
+ return self::getGenericValue('dcCore::app()->ctx->c2_entries->cat_id', $a);
}
public static function c2EntryCategoryURL($a)
{
- return self::getGenericValue('$core->blog->url.$core->url->getBase("cinecturlink2")."/".$core->blog->settings->cinecturlink2->cinecturlink2_public_caturl."/".urlencode($_ctx->c2_entries->cat_title)', $a);
+ return self::getGenericValue('dcCore::app()->blog->url.dcCore::app()->url->getBase("cinecturlink2")."/".dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_public_caturl."/".urlencode(dcCore::app()->ctx->c2_entries->cat_title)', $a);
}
public static function c2EntryImg($a)
{
- global $core;
- $f = $core->tpl->getFilters($a);
+ $f = dcCore::app()->tpl->getFilters($a);
$style = isset($a['style']) ? html::escapeHTML($a['style']) : '';
return
- "exists('c2_entries')) { " .
- '$widthmax = (integer) $core->blog->settings->cinecturlink2->cinecturlink2_widthmax; ' .
+ "ctx->exists('c2_entries')) { " .
+ '$widthmax = (integer) dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_widthmax; ' .
"\$img = sprintf(''," .
- '$_ctx->c2_entries->link_img, ' .
- "html::escapeHTML(\$_ctx->c2_entries->link_title.' - '.\$_ctx->c2_entries->link_author), " .
+ 'dcCore::app()->ctx->c2_entries->link_img, ' .
+ "html::escapeHTML(dcCore::app()->ctx->c2_entries->link_title.' - '.dcCore::app()->ctx->c2_entries->link_author), " .
"(\$widthmax ? ' style=\"width:'.\$widthmax.'px;$style\"' : '') " .
'); ' .
'echo ' . sprintf($f, '$img') . "; unset(\$img); } ?> \n";
@@ -404,13 +403,13 @@ class tplCinecturlink2
$format = !empty($a['format']) ? addslashes($a['format']) : '';
if (!empty($a['rfc822'])) {
- $p = 'dt::rfc822(strtotime($_ctx->c2_entries->link_creadt), $core->blog->settings->system->blog_timezone)';
+ $p = 'dt::rfc822(strtotime(dcCore::app()->ctx->c2_entries->link_creadt), dcCore::app()->blog->settings->system->blog_timezone)';
} elseif (!empty($a['iso8601'])) {
- $p = 'dt::iso8601(strtotime($_ctx->c2_entries->link_creadt), $core->blog->settings->system->blog_timezone)';
+ $p = 'dt::iso8601(strtotime(dcCore::app()->ctx->c2_entries->link_creadt), dcCore::app()->blog->settings->system->blog_timezone)';
} elseif ($format) {
- $p = "dt::dt2str('" . $format . "', \$_ctx->c2_entries->link_creadt)";
+ $p = "dt::dt2str('" . $format . "', dcCore::app()->ctx->c2_entries->link_creadt)";
} else {
- $p = 'dt::dt2str($core->blog->settings->system->date_format, $_ctx->c2_entries->link_creadt)';
+ $p = 'dt::dt2str(dcCore::app()->blog->settings->system->date_format, dcCore::app()->ctx->c2_entries->link_creadt)';
}
return self::getGenericValue($p, $a);
@@ -418,17 +417,17 @@ class tplCinecturlink2
public static function c2EntryTime($a)
{
- return self::getGenericValue('dt::dt2str(' . (!empty($a['format']) ? "'" . addslashes($a['format']) . "'" : '$core->blog->settings->system->time_format') . ', $_ctx->c2_entries->link_creadt)', $a);
+ return self::getGenericValue('dt::dt2str(' . (!empty($a['format']) ? "'" . addslashes($a['format']) . "'" : 'dcCore::app()->blog->settings->system->time_format') . ', dcCore::app()->ctx->c2_entries->link_creadt)', $a);
}
public static function c2Pagination($a, $c)
{
$p = "c2_params;\n" .
- "\$_ctx->c2_pagination = \$_ctx->cinecturlink->getLinks(\$params,true); unset(\$params);\n" .
+ "\$params = dcCore::app()->ctx->c2_params;\n" .
+ "dcCore::app()->ctx->c2_pagination = dcCore::app()->ctx->cinecturlink->getLinks(\$params,true); unset(\$params);\n" .
"?>\n";
- return isset($a['no_context']) ? $p . $c : $p . 'c2_pagination->f(0) > $_ctx->c2_entries->count()) : ?>' . $c . '';
+ return isset($a['no_context']) ? $p . $c : $p . 'ctx->c2_pagination->f(0) > dcCore::app()->ctx->c2_entries->count()) : ?>' . $c . '';
}
public static function c2PaginationCounter($a)
@@ -466,21 +465,21 @@ class tplCinecturlink2
{
return
"exists('cinecturlink')) { \$_ctx->cinecturlink = new cinecturlink2(\$core); } \n" .
- "\$_ctx->c2_categories = \$_ctx->cinecturlink->getCategories(); \n" .
- 'while ($_ctx->c2_categories->fetch()) : ?>' . $c . 'c2_categories = null; \n" .
+ "if (!dcCore::app()->ctx->exists('cinecturlink')) { dcCore::app()->ctx->cinecturlink = new cinecturlink2(); } \n" .
+ "dcCore::app()->ctx->c2_categories = dcCore::app()->ctx->cinecturlink->getCategories(); \n" .
+ 'while (dcCore::app()->ctx->c2_categories->fetch()) : ?>' . $c . 'ctx->c2_categories = null; \n" .
"?>\n";
}
public static function c2CategoriesHeader($a, $c)
{
- return 'c2_categories->isStart()) : ?>' . $c . '';
+ return 'ctx->c2_categories->isStart()) : ?>' . $c . '';
}
public static function c2CategoriesFooter($a, $c)
{
- return 'c2_categories->isEnd()) : ?>' . $c . '';
+ return 'ctx->c2_categories->isEnd()) : ?>' . $c . '';
}
public static function c2CategoryIf($a, $c)
@@ -493,7 +492,7 @@ class tplCinecturlink2
}
if (isset($a['first'])) {
$sign = (bool) $a['first'] ? '' : '!';
- $if[] = $sign . '$_ctx->c2_categories->isStart()';
+ $if[] = $sign . 'dcCore::app()->ctx->c2_categories->isStart()';
}
return empty($if) ? $c : '' . $c . '';
@@ -507,37 +506,37 @@ class tplCinecturlink2
$p = 'atom';
}
- return 'tpl->getFilters($a), '$core->blog->url.$core->url->getBase("cinecturlink2")."/".$core->blog->settings->cinecturlink2->cinecturlink2_public_caturl."/".urlencode($_ctx->c2_categories->cat_title)."/feed/' . $p . '"') . '; ?>';
+ return 'tpl->getFilters($a), 'dcCore::app()->blog->url.dcCore::app()->url->getBase("cinecturlink2")."/".dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_public_caturl."/".urlencode(dcCore::app()->ctx->c2_categories->cat_title)."/feed/' . $p . '"') . '; ?>';
}
public static function c2CategoryFeedID($a)
{
- return 'urn:md5:blog->id."cinecturlink2".$_ctx->c2_categories->cat_id); ?>';
+ return 'urn:md5:blog->id."cinecturlink2".dcCore::app()->ctx->c2_categories->cat_id); ?>';
}
public static function c2CategoryID($a)
{
- return "exists('c2_categories')) { echo " . sprintf($GLOBALS['core']->tpl->getFilters($a), '$_ctx->c2_categories->cat_id') . '; } ?>';
+ return "ctx->exists('c2_categories')) { echo " . sprintf(dcCore::app()->tpl->getFilters($a), 'dcCore::app()->ctx->c2_categories->cat_id') . '; } ?>';
}
public static function c2CategoryTitle($a)
{
- return "exists('c2_categories')) { echo " . sprintf($GLOBALS['core']->tpl->getFilters($a), '$_ctx->c2_categories->cat_title') . '; } ?>';
+ return "ctx->exists('c2_categories')) { echo " . sprintf(dcCore::app()->tpl->getFilters($a), 'dcCore::app()->ctx->c2_categories->cat_title') . '; } ?>';
}
public static function c2CategoryDescription($a)
{
- return "exists('c2_categories')) { echo " . sprintf($GLOBALS['core']->tpl->getFilters($a), '$_ctx->c2_categories->cat_desc') . '; } ?>';
+ return "ctx->exists('c2_categories')) { echo " . sprintf(dcCore::app()->tpl->getFilters($a), 'dcCore::app()->ctx->c2_categories->cat_desc') . '; } ?>';
}
public static function c2CategoryURL($a)
{
- return "exists('c2_categories')) { echo " . sprintf($GLOBALS['core']->tpl->getFilters($a), '$core->blog->url.$core->url->getBase("cinecturlink2")."/".$core->blog->settings->cinecturlink2->cinecturlink2_public_caturl."/".urlencode($_ctx->c2_categories->cat_title)') . '; } ?>';
+ return "ctx->exists('c2_categories')) { echo " . sprintf(dcCore::app()->tpl->getFilters($a), 'dcCore::app()->blog->url.dcCore::app()->url->getBase("cinecturlink2")."/".dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_public_caturl."/".urlencode(dcCore::app()->ctx->c2_categories->cat_title)') . '; } ?>';
}
protected static function getGenericValue($p, $a)
{
- return "exists('c2_entries')) { echo " . sprintf($GLOBALS['core']->tpl->getFilters($a), "$p") . '; } ?>';
+ return "ctx->exists('c2_entries')) { echo " . sprintf(dcCore::app()->tpl->getFilters($a), "$p") . '; } ?>';
}
protected static function getOperator($op)
diff --git a/_widgets.php b/_widgets.php
index 21843f8..4c1e4ec 100644
--- a/_widgets.php
+++ b/_widgets.php
@@ -14,11 +14,11 @@ if (!defined('DC_RC_PATH')) {
return null;
}
-$core->addBehavior(
+dcCore::app()->addBehavior(
'initWidgets',
['cinecturlink2Widget', 'adminLinks']
);
-$core->addBehavior(
+dcCore::app()->addBehavior(
'initWidgets',
['cinecturlink2Widget', 'adminCats']
);
@@ -27,9 +27,7 @@ class cinecturlink2Widget
{
public static function adminLinks($w)
{
- global $core;
-
- $C2 = new cinecturlink2($core);
+ $C2 = new cinecturlink2();
$categories_combo = ['' => '', __('Uncategorized') => 'null'];
$categories = $C2->getCategories();
@@ -43,11 +41,11 @@ class cinecturlink2Widget
__('My rating') => 'link_note',
__('Title') => 'link_title',
__('Random') => 'RANDOM',
- __('Number of views') => 'COUNTER'
+ __('Number of views') => 'COUNTER',
];
$order_combo = [
__('Ascending') => 'asc',
- __('Descending') => 'desc'
+ __('Descending') => 'desc',
];
$w
@@ -157,18 +155,16 @@ class cinecturlink2Widget
public static function publicLinks($w)
{
- global $core;
+ dcCore::app()->blog->settings->addNamespace('cinecturlink2');
- $core->blog->settings->addNamespace('cinecturlink2');
-
- if (!$core->blog->settings->cinecturlink2->cinecturlink2_active
- || $w->homeonly == 1 && !$core->url->isHome($core->url->type)
- || $w->homeonly == 2 && $core->url->isHome($core->url->type)
+ if (!dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_active
+ || $w->homeonly == 1 && !dcCore::app()->url->isHome(dcCore::app()->url->type)
+ || $w->homeonly == 2 && dcCore::app()->url->isHome(dcCore::app()->url->type)
) {
return null;
}
- $C2 = new cinecturlink2($core);
+ $C2 = new cinecturlink2();
if ($w->category) {
if ($w->category == 'null') {
@@ -214,7 +210,7 @@ class cinecturlink2Widget
return null;
}
- $widthmax = (int) $core->blog->settings->cinecturlink2->cinecturlink2_widthmax;
+ $widthmax = (int) dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_widthmax;
$style = $widthmax ? ' style="width:' . $widthmax . 'px;"' : '';
$entries = [];
@@ -230,7 +226,7 @@ class cinecturlink2Widget
$count = abs((int) $rs->link_count);
# --BEHAVIOR-- cinecturlink2WidgetLinks
- $bhv = $core->callBehavior('cinecturlink2WidgetLinks', $rs->link_id);
+ $bhv = dcCore::app()->callBehavior('cinecturlink2WidgetLinks', $rs->link_id);
$entries[] = '' .
($w->withlink && !empty($url) ? '' : '') .
@@ -242,19 +238,19 @@ class cinecturlink2Widget
'
' . $bhv;
try {
- $cur = $core->con->openCursor($C2->table);
+ $cur = dcCore::app()->con->openCursor($C2->table);
$cur->link_count = ($count + 1);
$C2->updLink($rs->link_id, $cur, false);
} catch (Exception $e) {
}
}
# Tirage aléatoire
- if ($w->sortby == 'RANDOM'
+ if ($w->sortby == 'RANDOM'
|| $w->sortby == 'COUNTER'
) {
shuffle($entries);
- if ($core->blog->settings->cinecturlink2->cinecturlink2_triggeronrandom) {
- $core->blog->triggerBlog();
+ if (dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_triggeronrandom) {
+ dcCore::app()->blog->triggerBlog();
}
}
@@ -264,27 +260,25 @@ class cinecturlink2Widget
'',
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') . implode(' ', $entries) .
(
- $w->showpagelink && $core->blog->settings->cinecturlink2->cinecturlink2_public_active ?
- '' . __('More links') . '
' : ''
+ $w->showpagelink && dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_public_active ?
+ '' . __('More links') . '
' : ''
)
);
}
public static function publicCats($w)
{
- global $core;
+ dcCore::app()->blog->settings->addNamespace('cinecturlink2');
- $core->blog->settings->addNamespace('cinecturlink2');
-
- if (!$core->blog->settings->cinecturlink2->cinecturlink2_active
- || !$core->blog->settings->cinecturlink2->cinecturlink2_public_active
- || $w->homeonly == 1 && !$core->url->isHome($core->url->type)
- || $w->homeonly == 2 && $core->url->isHome($core->url->type)
+ if (!dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_active
+ || !dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_public_active
+ || $w->homeonly == 1 && !dcCore::app()->url->isHome(dcCore::app()->url->type)
+ || $w->homeonly == 2 && dcCore::app()->url->isHome(dcCore::app()->url->type)
) {
return null;
}
- $C2 = new cinecturlink2($core);
+ $C2 = new cinecturlink2();
$rs = $C2->getCategories([]);
if ($rs->isEmpty()) {
return null;
@@ -292,15 +286,15 @@ class cinecturlink2Widget
$res = [];
$res[] = '' . __('all links') .
'' . ($w->shownumlink ? ' (' . ($C2->getLinks([], true)->f(0)) . ')' : '') .
'';
while ($rs->fetch()) {
$res[] = '' .
html::escapeHTML($rs->cat_title) .
diff --git a/inc/class.cinecturlink2.php b/inc/class.cinecturlink2.php
index 02f9f5c..b5ff60e 100644
--- a/inc/class.cinecturlink2.php
+++ b/inc/class.cinecturlink2.php
@@ -21,8 +21,6 @@ if (!defined('DC_RC_PATH')) {
*/
class cinecturlink2
{
- /** @var dcCore dcCore instance */
- public $core;
/** @var dbLayer dbLayer instance */
public $con;
/** @var string Cinecturlink table name */
@@ -32,17 +30,14 @@ class cinecturlink2
/**
* Contructor
- *
- * @param dcCore $core dcCore instance
*/
- public function __construct(dcCore $core)
+ public function __construct()
{
- $core->blog->settings->addNamespace('cinecturlink2');
+ dcCore::app()->blog->settings->addNamespace('cinecturlink2');
- $this->core = $core;
- $this->con = $core->con;
- $this->table = $core->prefix . 'cinecturlink2';
- $this->blog = $core->con->escape($core->blog->id);
+ $this->con = dcCore::app()->con;
+ $this->table = dcCore::app()->prefix . 'cinecturlink2';
+ $this->blog = dcCore::app()->con->escape(dcCore::app()->blog->id);
}
/**
@@ -73,7 +68,7 @@ class cinecturlink2
}
$strReq .= 'FROM ' . $this->table . ' L ' .
- 'INNER JOIN ' . $this->core->prefix . 'user U ON U.user_id = L.user_id ' .
+ 'INNER JOIN ' . dcCore::app()->prefix . 'user U ON U.user_id = L.user_id ' .
'LEFT OUTER JOIN ' . $this->table . '_cat C ON L.cat_id = C.cat_id ';
if (!empty($params['from'])) {
@@ -103,7 +98,9 @@ class cinecturlink2
if (!empty($params['cat_id'])) {
if (is_array($params['cat_id'])) {
- array_walk($params['cat_id'], function (&$v, $k) { if ($v !== null) { $v = (int) $v;}});
+ array_walk($params['cat_id'], function (&$v, $k) { if ($v !== null) {
+ $v = (int) $v;
+ }});
} else {
$params['cat_id'] = [(int) $params['cat_id']];
}
@@ -174,7 +171,7 @@ class cinecturlink2
$cur->link_id = $this->getNextLinkId();
$cur->blog_id = $this->blog;
- $cur->user_id = $this->core->auth->userID();
+ $cur->user_id = dcCore::app()->auth->userID();
$cur->link_creadt = date('Y-m-d H:i:s');
$cur->link_upddt = date('Y-m-d H:i:s');
$cur->link_pos = 0;
@@ -189,7 +186,7 @@ class cinecturlink2
$this->trigger();
# --BEHAVIOR-- cinecturlink2AfterAddLink
- $this->core->callBehavior('cinecturlink2AfterAddLink', $cur);
+ dcCore::app()->callBehavior('cinecturlink2AfterAddLink', $cur);
return $cur->link_id;
}
@@ -216,7 +213,7 @@ class cinecturlink2
if ($behavior) {
# --BEHAVIOR-- cinecturlink2AfterUpdLink
- $this->core->callBehavior('cinecturlink2AfterUpdLink', $cur, $id);
+ dcCore::app()->callBehavior('cinecturlink2AfterUpdLink', $cur, $id);
}
}
@@ -234,7 +231,7 @@ class cinecturlink2
}
# --BEHAVIOR-- cinecturlink2BeforeDelLink
- $this->core->callBehavior('cinecturlink2BeforeDelLink', $id);
+ dcCore::app()->callBehavior('cinecturlink2BeforeDelLink', $id);
$this->con->execute(
'DELETE FROM ' . $this->table . ' ' .
@@ -289,7 +286,9 @@ class cinecturlink2
if (!empty($params['cat_id'])) {
if (is_array($params['cat_id'])) {
- array_walk($params['cat_id'], function (&$v, $k) { if ($v !== null) { $v = (int) $v; }});
+ array_walk($params['cat_id'], function (&$v, $k) { if ($v !== null) {
+ $v = (int) $v;
+ }});
} else {
$params['cat_id'] = [(int) $params['cat_id']];
}
@@ -298,7 +297,9 @@ class cinecturlink2
if (isset($params['exclude_cat_id']) && $params['exclude_cat_id'] !== '') {
if (is_array($params['exclude_cat_id'])) {
- array_walk($params['exclude_cat_id'], function (&$v, $k) { if ($v !== null) {$v = (int) $v;}});
+ array_walk($params['exclude_cat_id'], function (&$v, $k) { if ($v !== null) {
+ $v = (int) $v;
+ }});
} else {
$params['exclude_cat_id'] = [(int) $params['exclude_cat_id']];
}
@@ -441,7 +442,7 @@ class cinecturlink2
*/
private function trigger()
{
- $this->core->blog->triggerBlog();
+ dcCore::app()->blog->triggerBlog();
}
/**
@@ -470,15 +471,14 @@ class cinecturlink2
/**
* Get list of public directories
*
- * @param dcCore $core Core instance
* @return array Directories
*/
- public static function getPublicDirs($core)
+ public static function getPublicDirs()
{
$dirs = [];
- $all = files::getDirList($core->blog->public_path);
+ $all = files::getDirList(dcCore::app()->blog->public_path);
foreach ($all['dirs'] as $dir) {
- $dir = substr($dir, strlen($core->blog->public_path) + 1);
+ $dir = substr($dir, strlen(dcCore::app()->blog->public_path) + 1);
$dirs[$dir] = $dir;
}
diff --git a/inc/lib.cinecturlink2.activityreport.php b/inc/lib.cinecturlink2.activityreport.php
index 5c9a8db..49f1dec 100644
--- a/inc/lib.cinecturlink2.activityreport.php
+++ b/inc/lib.cinecturlink2.activityreport.php
@@ -16,12 +16,12 @@ if (!defined('DC_RC_PATH')) {
class cinecturlink2ActivityReportBehaviors
{
- public static function add($core)
+ public static function add()
{
- $core->activityReport->addGroup('cinecturlink2', __('Plugin cinecturlink2'));
+ dcCore::app()->activityReport->addGroup('cinecturlink2', __('Plugin cinecturlink2'));
// from BEHAVIOR cinecturlink2AfterAddLink in cinecturlink2/inc/class.cinecturlink2.php
- $core->activityReport->addAction(
+ dcCore::app()->activityReport->addAction(
'cinecturlink2',
'create',
__('link creation'),
@@ -30,7 +30,7 @@ class cinecturlink2ActivityReportBehaviors
['cinecturlink2ActivityReportBehaviors', 'addLink']
);
// from BEHAVIOR cinecturlink2AfterUpdLink in cinecturlink2/inc/class.cinecturlink2.php
- $core->activityReport->addAction(
+ dcCore::app()->activityReport->addAction(
'cinecturlink2',
'update',
__('updating link'),
@@ -39,7 +39,7 @@ class cinecturlink2ActivityReportBehaviors
['cinecturlink2ActivityReportBehaviors', 'updLink']
);
// from BEHAVIOR cinecturlink2BeforeDelLink in cinecturlink2/inc/class.cinecturlink2.php
- $core->activityReport->addAction(
+ dcCore::app()->activityReport->addAction(
'cinecturlink2',
'delete',
__('link deletion'),
@@ -51,38 +51,34 @@ class cinecturlink2ActivityReportBehaviors
public static function addLink($cur)
{
- global $core;
-
$logs = [
$cur->link_title,
- $core->auth->getInfo('user_cn')
+ dcCore::app()->auth->getInfo('user_cn'),
];
- $core->activityReport->addLog('cinecturlink2', 'create', $logs);
+ dcCore::app()->activityReport->addLog('cinecturlink2', 'create', $logs);
}
public static function updLink($cur, $id)
{
- global $core;
- $C2 = new cinecturlink2($core);
+ $C2 = new cinecturlink2();
$rs = $C2->getLinks(['link_id' => $id]);
$logs = [
$rs->link_title,
- $core->auth->getInfo('user_cn')
+ dcCore::app()->auth->getInfo('user_cn'),
];
- $core->activityReport->addLog('cinecturlink2', 'update', $logs);
+ dcCore::app()->activityReport->addLog('cinecturlink2', 'update', $logs);
}
public static function delLink($id)
{
- global $core;
- $C2 = new cinecturlink2($core);
+ $C2 = new cinecturlink2();
$rs = $C2->getLinks(['link_id' => $id]);
$logs = [
$rs->link_title,
- $core->auth->getInfo('user_cn')
+ dcCore::app()->auth->getInfo('user_cn'),
];
- $core->activityReport->addLog('cinecturlink2', 'delete', $logs);
+ dcCore::app()->activityReport->addLog('cinecturlink2', 'delete', $logs);
}
}
diff --git a/inc/lib.cinecturlink2.context.php b/inc/lib.cinecturlink2.context.php
index ef3c6f2..99be5d8 100644
--- a/inc/lib.cinecturlink2.context.php
+++ b/inc/lib.cinecturlink2.context.php
@@ -14,13 +14,11 @@ class cinecturlink2Context
{
public static function PaginationNbPages()
{
- global $_ctx;
-
- if ($_ctx->c2_pagination === null) {
+ if (dcCore::app()->ctx->c2_pagination === null) {
return false;
}
- $nb_posts = $_ctx->c2_pagination->f(0);
- $nb_per_page = $_ctx->c2_params['limit'][1];
+ $nb_posts = dcCore::app()->ctx->c2_pagination->f(0);
+ $nb_per_page = dcCore::app()->ctx->c2_params['limit'][1];
$nb_pages = ceil($nb_posts / $nb_per_page);
return $nb_pages;
@@ -68,7 +66,7 @@ class cinecturlink2Context
$args = preg_replace('#(^|/)c2page/([0-9]+)$#', '', $args);
- $url = $GLOBALS['core']->blog->url . $args;
+ $url = dcCore::app()->blog->url . $args;
if ($n > 1) {
$url = preg_replace('#/$#', '', $url);
@@ -85,20 +83,18 @@ class cinecturlink2Context
public static function categoryCurrent()
{
- global $_ctx;
-
- if (!isset($_ctx->c2_page_params['cat_id'])
- && !isset($_ctx->c2_page_params['cat_title'])
+ if (!isset(dcCore::app()->ctx->c2_page_params['cat_id'])
+ && !isset(dcCore::app()->ctx->c2_page_params['cat_title'])
) {
return false;
}
- if (isset($_ctx->c2_page_params['cat_id'])
- && $_ctx->c2_page_params['cat_id'] == $_ctx->c2_categories->cat_id
+ if (isset(dcCore::app()->ctx->c2_page_params['cat_id'])
+ && dcCore::app()->ctx->c2_page_params['cat_id'] == dcCore::app()->ctx->c2_categories->cat_id
) {
return true;
}
- if (isset($_ctx->c2_page_params['cat_title'])
- && $_ctx->c2_page_params['cat_title'] == $_ctx->c2_categories->cat_title
+ if (isset(dcCore::app()->ctx->c2_page_params['cat_title'])
+ && dcCore::app()->ctx->c2_page_params['cat_title'] == dcCore::app()->ctx->c2_categories->cat_title
) {
return true;
}
diff --git a/inc/lib.cinecturlink2.list.php b/inc/lib.cinecturlink2.list.php
index c7a646a..5fd1be2 100644
--- a/inc/lib.cinecturlink2.list.php
+++ b/inc/lib.cinecturlink2.list.php
@@ -18,15 +18,13 @@ class adminlistCinecturlink2
{
public $redir = '';
- protected $core;
protected $rs;
protected $rs_count;
protected $html_prev;
protected $html_next;
- public function __construct(dcCore $core, $rs, $rs_count)
+ public function __construct($rs, $rs_count)
{
- $this->core = &$core;
$this->rs = &$rs;
$this->rs_count = $rs_count;
$this->html_prev = __('« prev.');
@@ -35,7 +33,7 @@ class adminlistCinecturlink2
public function userColumns($type, $cols)
{
- $cols_user = @$this->core->auth->user_prefs->interface->cols;
+ $cols_user = @dcCore::app()->auth->user_prefs->interface->cols;
if (is_array($cols_user) || $cols_user instanceof ArrayObject) {
if (isset($cols_user[$type])) {
foreach ($cols_user[$type] as $cn => $cd) {
@@ -72,7 +70,7 @@ class adminlistCinecturlink2
'link' => '' . __('Links') . ' | ',
'cat' => '' . __('Category') . ' | ',
'note' => '' . __('Rating') . ' | ',
- 'date' => '' . __('Date') . ' | '
+ 'date' => '' . __('Date') . ' | ',
];
$cols = new ArrayObject($cols);
$this->userColumns('c2link', $cols);
@@ -111,7 +109,7 @@ class adminlistCinecturlink2
form::checkbox(['entries[]'], $this->rs->link_id, ['checked' => $checked]) .
'',
'title' => '' .
- 'adminurl->get(
'admin.plugin.cinecturlink2',
['part' => 'link', 'linkid' => $this->rs->link_id, 'redir' => $this->redir]
) . '" title="' . __('Edit') . '">' .
@@ -132,7 +130,7 @@ class adminlistCinecturlink2
'">' . __('image') . ' ' .
' | ',
'cat' => '' .
- 'adminurl->get(
'admin.plugin.cinecturlink2',
['part' => 'cat', 'catid' => $this->rs->cat_id, 'redir' => $this->redir]
) . '" title="' . __('Edit') . '">' .
@@ -144,11 +142,11 @@ class adminlistCinecturlink2
' | ',
'date' => '' .
dt::dt2str(
- $this->core->blog->settings->system->date_format . ', ' . $this->core->blog->settings->system->time_format,
+ dcCore::app()->blog->settings->system->date_format . ', ' . dcCore::app()->blog->settings->system->time_format,
$this->rs->link_upddt,
- $this->core->auth->getInfo('user_tz')
+ dcCore::app()->auth->getInfo('user_tz')
) .
- ' | '
+ '',
];
$cols = new ArrayObject($cols);
diff --git a/inc/lib.sitemaps.cinecturlink2.php b/inc/lib.sitemaps.cinecturlink2.php
index 9852186..a64f7d1 100644
--- a/inc/lib.sitemaps.cinecturlink2.php
+++ b/inc/lib.sitemaps.cinecturlink2.php
@@ -19,23 +19,22 @@ class sitemapsCinecturlink2
public static function sitemapsURLsCollect($sitemaps)
{
- global $core;
- $core->blog->settings->addNamespace('sitemaps');
+ dcCore::app()->blog->settings->addNamespace('sitemaps');
- if ($core->plugins->moduleExists('cinecturlink2')
- && $core->blog->settings->sitemaps->sitemaps_cinecturlink2_url
+ if (dcCore::app()->plugins->moduleExists('cinecturlink2')
+ && dcCore::app()->blog->settings->sitemaps->sitemaps_cinecturlink2_url
) {
- $freq = $sitemaps->getFrequency($core->blog->settings->sitemaps->sitemaps_cinecturlink2_fq);
- $prio = $sitemaps->getPriority($core->blog->settings->sitemaps->sitemaps_cinecturlink2_pr);
- $base = $core->blog->url . $core->url->getBase('cinecturlink2');
+ $freq = $sitemaps->getFrequency(dcCore::app()->blog->settings->sitemaps->sitemaps_cinecturlink2_fq);
+ $prio = $sitemaps->getPriority(dcCore::app()->blog->settings->sitemaps->sitemaps_cinecturlink2_pr);
+ $base = dcCore::app()->blog->url . dcCore::app()->url->getBase('cinecturlink2');
$sitemaps->addEntry($base, $prio, $freq);
- $core->blog->settings->addNamespace('cinecturlink2');
- $C2 = new cinecturlink2($core);
+ dcCore::app()->blog->settings->addNamespace('cinecturlink2');
+ $C2 = new cinecturlink2();
$cats = $C2->getCategories();
while ($cats->fetch()) {
- $sitemaps->addEntry($base . '/' . $core->blog->settings->cinecturlink2->cinecturlink2_public_caturl . '/' . urlencode($cats->cat_title), $prio, $freq);
+ $sitemaps->addEntry($base . '/' . dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_public_caturl . '/' . urlencode($cats->cat_title), $prio, $freq);
}
}
}
diff --git a/index.php b/index.php
index 6037eca..0f29120 100644
--- a/index.php
+++ b/index.php
@@ -14,7 +14,7 @@ if (!defined('DC_CONTEXT_ADMIN')) {
return null;
}
-dcPage::check('contentadmin');
+dcPage::check(dcAuth::PERMISSION_CONTENT_ADMIN);
$linkid = $_REQUEST['linkid'] ?? '';
$linktitle = $_POST['linktitle'] ?? '';
@@ -22,7 +22,7 @@ $linkdesc = $_POST['linkdesc'] ?? '';
$linkauthor = $_POST['linkauthor'] ?? '';
$linkurl = $_POST['linkurl'] ?? '';
$linkcat = $_POST['linkcat'] ?? null;
-$linklang = $_POST['linklang'] ?? $core->auth->getInfo('user_lang');
+$linklang = $_POST['linklang'] ?? dcCore::app()->auth->getInfo('user_lang');
$linkimage = $_POST['linkimage'] ?? '';
$linknote = $_POST['linknote'] ?? '';
$catid = $_REQUEST['catid'] ?? '';
@@ -34,7 +34,7 @@ $entries = $_POST['entries'] ?? [];
$headers = '';
$breadcrumb = [
__('Plugins') => '',
- __('My cinecturlink') => $core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'links'])
+ __('My cinecturlink') => dcCore::app()->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'links']),
];
if (!in_array($part, ['links', 'link', 'cats', 'cat', 'dellinks', 'updlinksnote', 'updlinkscat'])) {
$part = 'links';
@@ -44,7 +44,7 @@ if (!is_array($entries)) {
}
try {
- $C2 = new cinecturlink2($core);
+ $C2 = new cinecturlink2();
$categories = $C2->getCategories();
$categories_combo = ['-' => ''];
while ($categories->fetch()) {
@@ -52,7 +52,7 @@ try {
$categories_combo[$cat_title] = $categories->cat_id;
}
} catch (Exception $e) {
- $core->error->add($e->getMessage());
+ dcCore::app()->error->add($e->getMessage());
}
if ($part == 'dellinks') {
@@ -62,13 +62,13 @@ if ($part == 'dellinks') {
foreach ($entries as $id) {
$C2->delLink($id);
}
- dcPage::addSuccessNotice(
+ dcAdminNotices::addSuccessNotice(
__('Links successfully deleted.')
);
- $core->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'links']);
+ dcCore::app()->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'links']);
}
} catch (Exception $e) {
- $core->error->add($e->getMessage());
+ dcCore::app()->error->add($e->getMessage());
}
$breadcrumb[__('Delete links')] = '';
}
@@ -78,7 +78,7 @@ if (in_array($part, ['updlinksnote', 'updlinkscat'])) {
try {
$links = $C2->getLinks(['link_id' => $entries]);
} catch (Exception $e) {
- $core->error->add($e->getMessage());
+ dcCore::app()->error->add($e->getMessage());
}
}
@@ -88,22 +88,22 @@ if ($part == 'updlinksnote') {
if (!empty($entries) && isset($_POST['newlinknote'])) {
while ($links->fetch()) {
if (in_array($links->link_id, $entries)) {
- $cur = $core->con->openCursor($C2->table);
+ $cur = dcCore::app()->con->openCursor($C2->table);
$cur->link_note = (int) $_POST['newlinknote'];
$C2->updLink($links->link_id, $cur);
}
}
- dcPage::addSuccessNotice(
+ dcAdminNotices::addSuccessNotice(
__('Links successfully updated.')
);
if (!empty($_POST['redir'])) {
http::redirect($redir);
} else {
- $core->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'links']);
+ dcCore::app()->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'links']);
}
}
} catch (Exception $e) {
- $core->error->add($e->getMessage());
+ dcCore::app()->error->add($e->getMessage());
}
$breadcrumb[__('Update links rating')] = '';
}
@@ -114,22 +114,22 @@ if ($part == 'updlinkscat') {
if (!empty($entries) && !empty($_POST['newcatid'])) {
while ($links->fetch()) {
if (in_array($links->link_id, $entries)) {
- $cur = $core->con->openCursor($C2->table);
+ $cur = dcCore::app()->con->openCursor($C2->table);
$cur->cat_id = (int) $_POST['newcatid'];
$C2->updLink($links->link_id, $cur);
}
}
- dcPage::addSuccessNotice(
+ dcAdminNotices::addSuccessNotice(
__('Links successfully updated.')
);
if (!empty($_POST['redir'])) {
http::redirect($redir);
} else {
- $core->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'links']);
+ dcCore::app()->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'links']);
}
}
} catch (Exception $e) {
- $core->error->add($e->getMessage());
+ dcCore::app()->error->add($e->getMessage());
}
$breadcrumb[__('Update links category')] = '';
}
@@ -138,10 +138,10 @@ if ($part == 'links') {
$action_combo = [
__('Delete') => 'dellinks',
__('Change category') => 'updlinkscat',
- __('Change rating') => 'updlinksnote'
+ __('Change rating') => 'updlinksnote',
];
- $c2link_filter = new adminGenericFilter($core, 'c2link');
+ $c2link_filter = new adminGenericFilterV2('c2link');
$c2link_filter->add('part', 'links');
$c2link_filter->add(dcAdminFilters::getPageFilter());
$c2link_filter->add(dcAdminFilters::getSearchFilter());
@@ -161,13 +161,13 @@ if ($part == 'links') {
try {
$links = $C2->getLinks($params);
$links_counter = $C2->getLinks($params, true)->f(0);
- $links_list = new adminlistCinecturlink2($core, $links, $links_counter);
+ $links_list = new adminlistCinecturlink2($links, $links_counter);
} catch (Exception $e) {
- $core->error->add($e->getMessage());
+ dcCore::app()->error->add($e->getMessage());
}
$breadcrumb[__('My cinecturlink')] = '';
- $headers .= dcPage::jsVars(['dotclear.filter_reset_url' => $core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'links'])]) .
+ $headers .= dcPage::jsVars(['dotclear.filter_reset_url' => dcCore::app()->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'links'])]) .
dcPage::jsFilterControl($c2link_filter->show()) .
dcPage::jsLoad(dcPage::getPF('cinecturlink2/js/c2links.js'));
}
@@ -178,11 +178,11 @@ if ($part == 'link') {
$media_combo = $tmp_media_combo = $dir = null;
try {
- $allowed_media = ['png', 'jpg', 'gif', 'bmp', 'jpeg'];
- $core->media = new dcMedia($core);
- $core->media->chdir($core->blog->settings->cinecturlink2->cinecturlink2_folder);
- $core->media->getDir();
- $dir = & $core->media->dir;
+ $allowed_media = ['png', 'jpg', 'gif', 'bmp', 'jpeg'];
+ dcCore::app()->media = new dcMedia();
+ dcCore::app()->media->chdir(dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_folder);
+ dcCore::app()->media->getDir();
+ $dir = & dcCore::app()->media->dir;
foreach ($dir['files'] as $file) {
if (!in_array(files::getExtension($file->relname), $allowed_media)) {
@@ -194,14 +194,14 @@ if ($part == 'link') {
$media_combo = array_merge(['-' => ''], $tmp_media_combo);
}
} catch (Exception $e) {
- //$core->error->add($e->getMessage());
+ //dcCore::app()->error->add($e->getMessage());
}
if (!empty($_POST['save'])) {
try {
cinecturlink2::makePublicDir(
- DC_ROOT . '/' . $core->blog->settings->system->public_path,
- $core->blog->settings->cinecturlink2->cinecturlink2_folder
+ DC_ROOT . '/' . dcCore::app()->blog->settings->system->public_path,
+ dcCore::app()->blog->settings->cinecturlink2->cinecturlink2_folder
);
if (empty($linktitle)) {
throw new Exception(__('You must provide a title.'));
@@ -213,7 +213,7 @@ if ($part == 'link') {
throw new Exception(__('You must provide a link to an image.'));
}
- $cur = $core->con->openCursor($C2->table);
+ $cur = dcCore::app()->con->openCursor($C2->table);
$cur->link_title = $linktitle;
$cur->link_desc = $linkdesc;
$cur->link_author = $linkauthor;
@@ -231,7 +231,7 @@ if ($part == 'link') {
}
$linkid = $C2->addLink($cur);
- dcPage::addSuccessNotice(
+ dcAdminNotices::addSuccessNotice(
__('Link successfully created.')
);
// update a link
@@ -242,20 +242,20 @@ if ($part == 'link') {
}
$C2->updLink($linkid, $cur);
- dcPage::addSuccessNotice(
+ dcAdminNotices::addSuccessNotice(
__('Link successfully updated.')
);
}
- $core->adminurl->redirect(
+ dcCore::app()->adminurl->redirect(
'admin.plugin.cinecturlink2',
[
'part' => 'link',
'linkid' => $linkid,
- 'redir' => $redir
+ 'redir' => $redir,
]
);
} catch (Exception $e) {
- $core->error->add($e->getMessage());
+ dcCore::app()->error->add($e->getMessage());
}
}
@@ -263,16 +263,16 @@ if ($part == 'link') {
try {
$C2->delLink($linkid);
- dcPage::addSuccessNotice(
+ dcAdminNotices::addSuccessNotice(
__('Link successfully deleted.')
);
if (!empty($_POST['redir'])) {
http::redirect($redir);
} else {
- $core->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'links']);
+ dcCore::app()->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'links']);
}
} catch (Exception $e) {
- $core->error->add($e->getMessage());
+ dcCore::app()->error->add($e->getMessage());
}
}
@@ -290,7 +290,7 @@ if ($part == 'link') {
}
}
$breadcrumb[(empty($linkid) ? __('New link') : __('Edit link'))] = '';
- $headers .= dcPage::jsVars(['dotclear.c2_lang' => $core->auth->getInfo('user_lang')]) .
+ $headers .= dcPage::jsVars(['dotclear.c2_lang' => dcCore::app()->auth->getInfo('user_lang')]) .
dcPage::jsLoad(dcPage::getPF('cinecturlink2/js/c2link.js'));
}
@@ -313,33 +313,33 @@ if ($part == 'cats') {
$i = 0;
foreach ($catorder as $id) {
$i++;
- $cur = $core->con->openCursor($C2->table . '_cat');
+ $cur = dcCore::app()->con->openCursor($C2->table . '_cat');
$cur->cat_pos = $i;
$C2->updCategory($id, $cur);
}
- dcPage::addSuccessNotice(
+ dcAdminNotices::addSuccessNotice(
__('Categories successfully reordered.')
);
- $core->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
+ dcCore::app()->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
}
// delete categories
if (!empty($_POST['delete']) && !empty($_POST['items_selected'])) {
foreach ($_POST['items_selected'] as $id) {
$C2->delCategory($id);
}
- dcPage::addSuccessNotice(
+ dcAdminNotices::addSuccessNotice(
__('Categories successfully deleted.')
);
- $core->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
+ dcCore::app()->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
}
} catch (Exception $e) {
- $core->error->add($e->getMessage());
+ dcCore::app()->error->add($e->getMessage());
}
$breadcrumb[__('Categories')] = '';
- $core->auth->user_prefs->addWorkspace('accessibility');
- if (!$core->auth->user_prefs->accessibility->nodragdrop) {
+ dcCore::app()->auth->user_prefs->addWorkspace('accessibility');
+ if (!dcCore::app()->auth->user_prefs->accessibility->nodragdrop) {
$headers .= dcPage::jsLoad('js/jquery/jquery-ui.custom.js') .
dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js') .
dcPage::jsLoad(dcPage::getPF('cinecturlink2/js/c2cats.js'));
@@ -354,16 +354,16 @@ if ($part == 'cat') {
if ($exists) {
throw new Exception(__('Category with same name already exists.'));
}
- $cur = $core->con->openCursor($C2->table . '_cat');
+ $cur = dcCore::app()->con->openCursor($C2->table . '_cat');
$cur->cat_title = $cattitle;
$cur->cat_desc = $catdesc;
$catid = $C2->addCategory($cur);
- dcPage::addSuccessNotice(
+ dcAdminNotices::addSuccessNotice(
__('Category successfully created.')
);
- $core->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
+ dcCore::app()->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
}
// update category
if (!empty($_POST['save']) && !empty($catid) && !empty($cattitle) && !empty($catdesc)) {
@@ -371,30 +371,30 @@ if ($part == 'cat') {
if ($exists) {
throw new Exception(__('Category with same name already exists.'));
}
- $cur = $core->con->openCursor($C2->table . '_cat');
+ $cur = dcCore::app()->con->openCursor($C2->table . '_cat');
$cur->cat_title = $cattitle;
$cur->cat_desc = $catdesc;
$C2->updCategory($catid, $cur);
- dcPage::addSuccessNotice(
+ dcAdminNotices::addSuccessNotice(
__('Category successfully updated.')
);
- $core->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
+ dcCore::app()->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
}
// delete category
if (!empty($_POST['delete']) && !empty($catid)) {
$C2->delCategory($catid);
- dcPage::addSuccessNotice(
+ dcAdminNotices::addSuccessNotice(
__('Category successfully deleted.')
);
- $core->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
+ dcCore::app()->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
}
} catch (Exception $e) {
- $core->error->add($e->getMessage());
+ dcCore::app()->error->add($e->getMessage());
}
- $breadcrumb[__('Categories')] = $core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'cats']);
+ $breadcrumb[__('Categories')] = dcCore::app()->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'cats']);
$breadcrumb[(empty($catid) ? __('New category') : __('Edit category'))] = '';
}
@@ -423,18 +423,18 @@ if ($part == 'updlinksnote') {
echo '';
echo '' . __('Rating') . '
-
' .
'';
}
}
@@ -458,13 +458,13 @@ if ($part == 'updlinkscat') {
echo '';
echo '' . __('Category') . '
- ';
}
}
if ($part == 'links') {
- $links_redir = $core->adminurl->get('admin.plugin.cinecturlink2', $c2link_filter->values());
+ $links_redir = dcCore::app()->adminurl->get('admin.plugin.cinecturlink2', $c2link_filter->values());
echo
'' . __('New Link') . ' ' . __('Edit categories') . '
';
if ($links->isEmpty() && !$c2link_filter->show()) {
@@ -498,7 +498,7 @@ if ($part == 'links') {
$links_list->display(
$c2link_filter->page,
$c2link_filter->nb,
- '',
$c2link_filter->show(),
@@ -521,7 +521,7 @@ if ($part == 'links') {
if ($part == 'link') {
echo '
- ';
}
@@ -593,17 +593,17 @@ if ($part == 'link') {
if ($part == 'cats') {
echo
'' . __('New Category') . '
';
@@ -612,7 +612,7 @@ if ($part == 'cats') {
echo '' . __('There is no category') . '
';
} else {
echo '
-