diff --git a/_admin.php b/_admin.php index 9521971..96621e2 100644 --- a/_admin.php +++ b/_admin.php @@ -1,12 +1,12 @@ addItem( +dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem( __('Noodles'), - $core->adminurl->get('admin.plugin.noodles'), + dcCore::app()->adminurl->get('admin.plugin.noodles'), dcPage::getPF('noodles/icon.png'), preg_match('/noodles(&.*)?$/', $_SERVER['REQUEST_URI']), - $core->auth->check('admin', $core->blog->id) -); \ No newline at end of file + dcCore::app()->auth->check(dcAuth::PERMISSION_CONTENT_ADMIN, dcCore::app()->blog->id) +); diff --git a/_define.php b/_define.php index d76943d..87d0b0c 100644 --- a/_define.php +++ b/_define.php @@ -1,12 +1,12 @@ registerModule( 'Noodles', 'Add users gravatars everywhere', 'Jean-Christian Denis and contributors', - '0.8', + '0.9', [ - 'requires' => [['core', '2.19']], - 'permissions' => 'admin', + 'requires' => [['core', '2.24']], + 'permissions' => dcAuth::PERMISSION_CONTENT_ADMIN, 'type' => 'plugin', 'support' => 'https://github.com/JcDenis/noodles', 'details' => 'http://plugins.dotaddict.org/dc2/details/noodles', 'repository' => 'https://raw.githubusercontent.com/JcDenis/noodles/master/dcstore.xml', 'settings' => [ - 'self' => '' - ] + 'self' => '', + ], ] -); \ No newline at end of file +); diff --git a/_install.php b/_install.php index 2dbf955..b0dff8c 100644 --- a/_install.php +++ b/_install.php @@ -1,12 +1,12 @@ plugins->moduleInfo('noodles', 'version'); -$old_version = $core->getVersion('noodles'); +$new_version = dcCore::app()->plugins->moduleInfo('noodles', 'version'); +$old_version = dcCore::app()->getVersion('noodles'); if (version_compare($old_version, $new_version, '>=')) { return null; } try { - $core->blog->settings->addNamespace('noodles'); - $core->blog->settings->noodles->put( + dcCore::app()->blog->settings->addNamespace('noodles'); + dcCore::app()->blog->settings->noodles->put( 'noodles_active', false, 'boolean', @@ -31,7 +31,7 @@ try { false, true ); - $core->blog->settings->noodles->put( + dcCore::app()->blog->settings->noodles->put( 'noodles_api', 'http://www.gravatar.com/', 'string', @@ -39,7 +39,7 @@ try { false, true ); - $core->blog->settings->noodles->put( + dcCore::app()->blog->settings->noodles->put( 'noodles_image', '', 'string', @@ -47,7 +47,7 @@ try { false, true ); - $core->blog->settings->noodles->put( + dcCore::app()->blog->settings->noodles->put( 'noodles_object', '', 'string', @@ -55,11 +55,11 @@ try { false, true ); - $core->setVersion('noodles', $new_version); + dcCore::app()->setVersion('noodles', $new_version); return true; } catch (Exception $e) { - $core->error->add($e->getMessage()); + dcCore::app()->error->add($e->getMessage()); } -return false; \ No newline at end of file +return false; diff --git a/_prepend.php b/_prepend.php index 8f741fd..e78d814 100644 --- a/_prepend.php +++ b/_prepend.php @@ -1,12 +1,12 @@ autoload(['noodlesImg' => __DIR__ . '/inc/lib.noodles.img.php']); +Clearbricks::lib()->autoload(['noodlesLibImagePath' => __DIR__ . '/inc/lib.image.path.php']); -$core->blog->settings->addNamespace('noodles'); +dcCore::app()->blog->settings->addNamespace('noodles'); -$core->url->register( +dcCore::app()->url->register( 'noodlesmodule', 'noodles', '^noodles/(.+)$', ['urlNoodles', 'noodles'] ); -$core->url->register( +dcCore::app()->url->register( 'noodlesservice', 'noodle', '^noodle/$', ['urlNoodles', 'service'] ); -$core->url->register( +dcCore::app()->url->register( 'noodlescss', 'noodles.css', '^noodles\.css', ['urlNoodles', 'css'] ); -$core->url->register( +dcCore::app()->url->register( 'noodlesjs', 'noodles.js', '^noodles\.js', ['urlNoodles', 'js'] -); \ No newline at end of file +); diff --git a/_public.php b/_public.php index 9af9770..c7b0a1e 100644 --- a/_public.php +++ b/_public.php @@ -1,12 +1,12 @@ blog->settings->noodles->noodles_active) { +if (!dcCore::app()->blog->settings->noodles->noodles_active) { return null; } -include dirname(__FILE__) . '/inc/_default_noodles.php'; -require_once dirname(__FILE__) . '/inc/_noodles_functions.php'; +include __DIR__ . '/inc/_default_noodles.php'; +require_once __DIR__ . '/inc/_noodles_functions.php'; -$core->addBehavior('publicHeadContent', ['publicNoodles', 'publicHeadContent']); +dcCore::app()->addBehavior('publicHeadContent', ['publicNoodles', 'publicHeadContent']); -$core->tpl->setPath($core->tpl->getPath(), dirname(__FILE__) . '/default-templates'); +dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), __DIR__ . '/default-templates'); global $__noodles; -$__noodles = noodles::decode($core->blog->settings->noodles->noodles_object); +$__noodles = noodles::decode(dcCore::app()->blog->settings->noodles->noodles_object); if ($__noodles->isEmpty()) { $__noodles = $__default_noodles; @@ -36,18 +36,18 @@ if ($__noodles->isEmpty()) { foreach ($__noodles->noodles() as $noodle) { if ($noodle->active && $noodle->hasPhpCallback()) { - $noodle->phpCallback($core); + $noodle->phpCallback(dcCore::app()); } } class publicNoodles { - public static function publicHeadContent($core) + public static function publicHeadContent() { echo - dcUtils::cssLoad($core->blog->url . $core->url->getURLFor('noodlescss')) . - dcUtils::jsLoad($core->blog->url . $core->url->getBase('noodlesmodule') . '/js/jquery.noodles.js') . - dcUtils::jsLoad($core->blog->url . $core->url->getURLFor('noodlesjs')); + dcUtils::cssLoad(dcCore::app()->blog->url . dcCore::app()->url->getURLFor('noodlescss')) . + dcUtils::jsLoad(dcCore::app()->blog->url . dcCore::app()->url->getBase('noodlesmodule') . '/js/jquery.noodles.js') . + dcUtils::jsLoad(dcCore::app()->blog->url . dcCore::app()->url->getURLFor('noodlesjs')); } } @@ -55,7 +55,7 @@ class urlNoodles extends dcUrlHandlers { public static function css($args) { - global $core, $__noodles; + global $__noodles; $css = ''; foreach ($__noodles->noodles() as $noodle) { @@ -74,7 +74,7 @@ class urlNoodles extends dcUrlHandlers public static function js($args) { - global $core, $__noodles; + global $__noodles; $targets = []; foreach ($__noodles->noodles() as $noodle) { @@ -91,7 +91,7 @@ class urlNoodles extends dcUrlHandlers echo "\$(function(){if(!document.getElementById){return;} \n" . - "\$.fn.noodles.defaults.service_url = '" . html::escapeJS($core->blog->url . $core->url->getBase('noodlesservice') . '/') . "'; \n" . + "\$.fn.noodles.defaults.service_url = '" . html::escapeJS(dcCore::app()->blog->url . dcCore::app()->url->getBase('noodlesservice') . '/') . "'; \n" . "\$.fn.noodles.defaults.service_func = '" . html::escapeJS('getNoodle') . "'; \n" . implode("\n", $targets) . "})\n"; @@ -101,8 +101,6 @@ class urlNoodles extends dcUrlHandlers public static function service($args) { - global $core; - header('Content-Type: text/xml; charset=UTF-8'); $rsp = new xmlTag('rsp'); @@ -110,23 +108,23 @@ class urlNoodles extends dcUrlHandlers $i = !empty($_POST['noodleId']) ? $_POST['noodleId'] : null; $c = !empty($_POST['noodleContent']) ? $_POST['noodleContent'] : null; - if (!$core->blog->settings->noodles->noodles_active) { + if (!dcCore::app()->blog->settings->noodles->noodles_active) { $rsp->status = 'failed'; $rsp->message(__('noodles is disabled on this blog')); - echo $rsp->toXML(1); + echo $rsp->toXML(true); return false; } if ($i === null || $c === null) { $rsp->status = 'failed'; $rsp->message(__('noodles failed because of missing informations')); - echo $rsp->toXML(1); + echo $rsp->toXML(true); return false; } try { - $__noodles = noodles::decode($core->blog->settings->noodles->noodles_object); + $__noodles = noodles::decode(dcCore::app()->blog->settings->noodles->noodles_object); if ($__noodles->isEmpty()) { $__noodles = $GLOBALS['__default_noodles']; @@ -134,7 +132,7 @@ class urlNoodles extends dcUrlHandlers } catch (Excetpion $e) { $rsp->status = 'failed'; $rsp->message(__('Failed to load default noodles')); - echo $rsp->toXML(1); + echo $rsp->toXML(true); return false; } @@ -142,7 +140,7 @@ class urlNoodles extends dcUrlHandlers if (!$__noodles->exists($i)) { $rsp->status = 'failed'; $rsp->message(__('Failed to load noodle')); - echo $rsp->toXML(1); + echo $rsp->toXML(true); return false; } @@ -150,10 +148,10 @@ class urlNoodles extends dcUrlHandlers $m = $__noodles->get($i)->jsCallback($__noodles->get($i), $c); $s = $__noodles->get($i)->size; $r = $__noodles->get($i)->rating; - $d = $core->blog->settings->noodles->noodles_image ? - urlencode(noodlesLibImagePath::getUrl($core, 'noodles')) : ''; + $d = dcCore::app()->blog->settings->noodles->noodles_image ? + urlencode(noodlesLibImagePath::getUrl('noodles')) : ''; - $u = $core->blog->settings->noodles->noodles_api; + $u = dcCore::app()->blog->settings->noodles->noodles_api; if (empty($u)) { $u = 'http://www.gravatar.com/'; } @@ -174,15 +172,13 @@ class urlNoodles extends dcUrlHandlers $rsp->insertNode($im); $rsp->status = 'ok'; - echo $rsp->toXML(1); + echo $rsp->toXML(true); exit; } public static function noodles($args) { - global $core; - - if (!$core->blog->settings->noodles->noodles_active) { + if (!dcCore::app()->blog->settings->noodles->noodles_active) { self::p404(); return; @@ -213,12 +209,12 @@ class urlNoodles extends dcUrlHandlers header('Content-Type: ' . $type . '; charset=UTF-8'); header('Content-Length: ' . filesize($f)); - if ($type != 'text/css' || $core->blog->settings->system->url_scan == 'path_info') { + if ($type != 'text/css' || dcCore::app()->blog->settings->system->url_scan == 'path_info') { readfile($f); } else { echo preg_replace( '#url\((?!(http:)|/)#', - 'url(' . $core->blog->url . $core->url->getBase('noodlesmodule') . '/', + 'url(' . dcCore::app()->blog->url . dcCore::app()->url->getBase('noodlesmodule') . '/', file_get_contents($f) ); } @@ -231,7 +227,7 @@ class urlNoodles extends dcUrlHandlers if (strstr($file, '..') !== false) { return false; } - $paths = $GLOBALS['core']->tpl->getPath(); + $paths = dcCore::app()->tpl->getPath(); foreach ($paths as $path) { if (preg_match('/tpl(\/|)$/', $path)) { @@ -244,4 +240,4 @@ class urlNoodles extends dcUrlHandlers return false; } -} \ No newline at end of file +} diff --git a/_uninstall.php b/_uninstall.php index 970e389..4ecd19b 100644 --- a/_uninstall.php +++ b/_uninstall.php @@ -1,12 +1,12 @@ addDirectAction( 'noodles', /* description */ sprintf(__('delete %s plugin files'), 'noodles') -); \ No newline at end of file +); diff --git a/inc/_default_noodles.php b/inc/_default_noodles.php index dc65f1d..87f2801 100644 --- a/inc/_default_noodles.php +++ b/inc/_default_noodles.php @@ -1,12 +1,12 @@ target('.post-title a') ->css('margin-right:2px;'); -if ($core->plugins->moduleExists('widgets')) { +if (dcCore::app()->plugins->moduleExists('widgets')) { # Widget Selected entries $__default_noodles ->add('bestof', __('Selected entries'), ['genericNoodles', 'postURL']) @@ -60,8 +60,8 @@ if ($core->plugins->moduleExists('widgets')) { } # Plugin auhtorMode -if ($core->plugins->moduleExists('authorMode') - && $core->blog->settings->authormode->authormode_active +if (dcCore::app()->plugins->moduleExists('authorMode') + && dcCore::app()->blog->settings->authormode->authormode_active ) { $__default_noodles ->add('authorswidget', __('Authors widget'), ['authormodeNoodles', 'authors']) @@ -84,8 +84,8 @@ if ($core->plugins->moduleExists('authorMode') } # Plugin rateIt -if ($core->plugins->moduleExists('rateIt') - && $core->blog->settings->rateit->rateit_active +if (dcCore::app()->plugins->moduleExists('rateIt') + && dcCore::app()->blog->settings->rateit->rateit_active ) { $__default_noodles ->add('rateitpostsrank', __('Top rated entries'), ['genericNoodles', 'postURL']) @@ -94,7 +94,7 @@ if ($core->plugins->moduleExists('rateIt') } # Plugin lastpostsExtend -if ($core->plugins->moduleExists('lastpostsExtend')) { +if (dcCore::app()->plugins->moduleExists('lastpostsExtend')) { $__default_noodles ->add('lastpostsextend', __('Last entries (extend)'), ['genericNoodles', 'postURL']) ->target('.lastpostsextend ul li a') @@ -102,4 +102,4 @@ if ($core->plugins->moduleExists('lastpostsExtend')) { } # --BEHAVIOR-- initDefaultNoodles -$core->callBehavior('initDefaultNoodles', $__default_noodles); \ No newline at end of file +dcCore::app()->callBehavior('initDefaultNoodles', $__default_noodles); diff --git a/inc/_noodles_functions.php b/inc/_noodles_functions.php index a2bbdde..693f02f 100644 --- a/inc/_noodles_functions.php +++ b/inc/_noodles_functions.php @@ -1,12 +1,12 @@ getPostTypes(); - $reg = '@^' . str_replace('%s', '(.*?)', preg_quote($core->blog->url . $types['post']['public_url'])) . '$@'; + $types = dcCore::app()->getPostTypes(); + $reg = '@^' . str_replace('%s', '(.*?)', preg_quote(dcCore::app()->blog->url . $types['post']['public_url'])) . '$@'; $ok = preg_match($reg, $content, $m); if (!$ok || !$m[1]) { return ''; } - $rs = $core->blog->getPosts(['no_content' => 1, 'post_url' => urldecode($m[1]), 'limit' => 1]); + $rs = dcCore::app()->blog->getPosts(['no_content' => 1, 'post_url' => urldecode($m[1]), 'limit' => 1]); if ($rs->isEmpty()) { return ''; } @@ -38,7 +36,7 @@ class genericNoodles # Miscellaneous class othersNoodles { - public static function publicPosts($core, $noodle) + public static function publicPosts($noodle) { if (!$noodle->active) { return null; @@ -46,19 +44,19 @@ class othersNoodles $bhv = $noodle->place == 'prepend' || $noodle->place == 'before' ? 'publicEntryBeforeContent' : 'publicEntryAfterContent'; - $core->addBehavior($bhv, ['othersNoodles', 'publicEntryContent']); + dcCore::app()->addBehavior($bhv, ['othersNoodles', 'publicEntryContent']); } public static function publicEntryContent() { - global $core,$_ctx,$__noodles; + global $__noodles; - $m = $_ctx->posts->getAuthorEmail(false); + $m = dcCore::app()->ctx->posts->getAuthorEmail(false); $c = $__noodles->posts->css; $s = $__noodles->posts->size; $r = $__noodles->posts->rating; - $d = $core->blog->settings->noodles->noodles_image ? - urlencode(noodlesLibImagePath::getUrl($core, 'noodles')) : ''; + $d = dcCore::app()->blog->settings->noodles->noodles_image ? + urlencode(noodlesLibImagePath::getUrl('noodles')) : ''; echo ''; } - public static function publicComments($core, $noodle) + public static function publicComments($noodle) { if (!$noodle->active) { return null; @@ -75,19 +73,19 @@ class othersNoodles $bhv = $noodle->place == 'prepend' || $noodle->place == 'before' ? 'publicCommentBeforeContent' : 'publicCommentAfterContent'; - $core->addBehavior($bhv, ['othersNoodles', 'publicCommentContent']); + dcCore::app()->addBehavior($bhv, ['othersNoodles', 'publicCommentContent']); } public static function publicCommentContent() { - global $core,$_ctx,$__noodles; + global $__noodles; - $m = $_ctx->comments->getEmail(false); + $m = dcCore::app()->ctx->comments->getEmail(false); $c = $__noodles->comments->css; $s = $__noodles->comments->size; $r = $__noodles->comments->rating; - $d = $core->blog->settings->noodles->noodles_image ? - urlencode(noodlesLibImagePath::getUrl($core, 'noodles')) : ''; + $d = dcCore::app()->blog->settings->noodles->noodles_image ? + urlencode(noodlesLibImagePath::getUrl('noodles')) : ''; echo 'blog->getComments(['no_content' => 1, 'comment_id' => $m[1], 'limit' => 1]); + $rs = dcCore::app()->blog->getComments(['no_content' => 1, 'comment_id' => $m[1], 'limit' => 1]); if (!$rs->isEmpty()) { return $rs->comment_email; } @@ -121,13 +117,11 @@ class authormodeNoodles { public static function authors($noodle, $content = '') { - global $core; - $ok = preg_match('@\/([^\/]*?)$@', $content, $m); if (!$ok || !$m[1]) { return ''; } - $rs = $core->getUser($m[1]); + $rs = dcCore::app()->getUser($m[1]); if ($rs->isEmpty()) { return ''; } @@ -135,29 +129,29 @@ class authormodeNoodles return $rs->user_email; } - public static function author($core, $noodle) + public static function author($noodle) { if ($noodle->active) { - $core->addBehavior('publicHeadContent', ['authormodeNoodles', 'publicHeadContent']); + dcCore::app()->addBehavior('publicHeadContent', ['authormodeNoodles', 'publicHeadContent']); } } public static function publicHeadContent() { - global $core, $_ctx, $__noodles; + global $__noodles; - if ($_ctx->current_tpl != 'author.html') { + if (dcCore::app()->ctx->current_tpl != 'author.html') { return null; } - $id = $_ctx->users->user_id; - $u = $core->getUser($id); + $id = dcCore::app()->ctx->users->user_id; + $u = dcCore::app()->getUser($id); $m = $u->user_email; $c = $__noodles->author->css; $s = $__noodles->author->size; $r = $__noodles->author->rating; - $d = $core->blog->settings->noodles->noodles_image ? - urlencode(noodlesLibImagePath::getUrl($core, 'noodles')) : ''; + $d = dcCore::app()->blog->settings->noodles->noodles_image ? + urlencode(noodlesLibImagePath::getUrl('noodles')) : ''; echo '\n"; } -} \ No newline at end of file +} diff --git a/inc/class.noodles.php b/inc/class.noodles.php index c163352..ad46c9d 100644 --- a/inc/class.noodles.php +++ b/inc/class.noodles.php @@ -1,12 +1,12 @@ 'g', 'size' => 16, 'target' => '', - 'place' => 'prepend' + 'place' => 'prepend', ]; public function __construct($id, $name, $js_callback, $php_callback = null) @@ -122,13 +122,13 @@ class noodle return !empty($this->js_callback); } - public function phpCallback($core) + public function phpCallback() { if (!is_callable($this->php_callback)) { return null; } - return call_user_func($this->php_callback, $core, $this); + return call_user_func($this->php_callback, $this); } public function hasPhpCallback() @@ -142,32 +142,32 @@ class noodle case 'active': $this->settings['active'] = abs((int) $value); - break; + break; case 'rating': $this->settings['rating'] = in_array($value, ['g', 'pg', 'r', 'x']) ? $value : 'g'; - break; + break; case 'size': $this->settings['size'] = in_array($value, [16, 24, 32, 48, 56, 64, 92, 128, 256]) ? $value : 16; - break; + break; case 'css': $this->settings['css'] = (string) $value; - break; + break; case 'target': $this->settings['target'] = (string) $value; - break; + break; case 'place': $this->settings['place'] = in_array($value, ['append', 'prepend', 'before', 'after']) ? $value : 'prepend'; - break; + break; } return $this; @@ -217,4 +217,4 @@ class noodle { return $this->get($type); } -} \ No newline at end of file +} diff --git a/inc/lib.image.path.php b/inc/lib.image.path.php index 3cdd126..77ce26d 100644 --- a/inc/lib.image.path.php +++ b/inc/lib.image.path.php @@ -1,12 +1,12 @@ plugins->moduleExists($m) - || !$core->url->getBase($m . 'module') + if (!dcCore::app()->plugins->moduleExists($m) + || !dcCore::app()->url->getBase($m . 'module') ) { return [ 'theme' => ['dir' => null, 'url' => null], @@ -32,23 +32,23 @@ class noodlesLibImagePath return [ 'theme' => [ - 'dir' => path::real($core->blog->themes_path . '/' . $core->blog->settings->system->theme . '/img') . '/' . $m . '-default-image.png', - 'url' => $core->blog->settings->system->themes_url . $core->blog->settings->system->theme . '/img/' . $m . '-default-image.png' + 'dir' => path::real(dcCore::app()->blog->themes_path . '/' . dcCore::app()->blog->settings->system->theme . '/img') . '/' . $m . '-default-image.png', + 'url' => dcCore::app()->blog->settings->system->themes_url . dcCore::app()->blog->settings->system->theme . '/img/' . $m . '-default-image.png', ], 'public' => [ - 'dir' => path::real($core->blog->public_path) . '/' . $m . '-default-image.png', - 'url' => $core->blog->host . path::clean($core->blog->settings->system->public_url) . '/' . $m . '-default-image.png' + 'dir' => path::real(dcCore::app()->blog->public_path) . '/' . $m . '-default-image.png', + 'url' => dcCore::app()->blog->host . path::clean(dcCore::app()->blog->settings->system->public_url) . '/' . $m . '-default-image.png', ], 'module' => [ - 'dir' => path::real($core->plugins->moduleRoot($m) . '/default-templates/img') . '/' . $m . '-default-image.png', - 'url' => $core->blog->url . $core->url->getBase($m . 'module') . '/img/' . $m . '-default-image.png' - ] + 'dir' => path::real(dcCore::app()->plugins->moduleRoot($m) . '/default-templates/img') . '/' . $m . '-default-image.png', + 'url' => dcCore::app()->blog->url . dcCore::app()->url->getBase($m . 'module') . '/img/' . $m . '-default-image.png', + ], ]; } - public static function getUrl($core, $m = '') + public static function getUrl($m = '') { - $files = self::getArray($core, $m); + $files = self::getArray($m); foreach ($files as $k => $file) { if (file_exists($files[$k]['dir'])) { return $files[$k]['url']; @@ -58,9 +58,9 @@ class noodlesLibImagePath return null; } - public static function getPath($core, $m = '') + public static function getPath($m = '') { - $files = self::getArray($core, $m); + $files = self::getArray($m); foreach ($files as $k => $file) { if (file_exists($files[$k]['dir'])) { return $files[$k]['dir']; @@ -70,13 +70,13 @@ class noodlesLibImagePath return null; } - public static function getSize($core, $m = '') + public static function getSize($m = '') { - if (!($img = self::getPath($core, $m))) { + if (!($img = self::getPath($m))) { return ['w' => 16, 'h' => 16]; } $info = getimagesize($img); return ['w' => $info[0], 'h' => floor($info[1] / 3)]; } -} \ No newline at end of file +} diff --git a/index.php b/index.php index be4aa66..1cfb65b 100644 --- a/index.php +++ b/index.php @@ -1,12 +1,12 @@ blog->settings->noodles; +$s = dcCore::app()->blog->settings->noodles; $__noodles = noodles::decode($s->noodles_object); if ($__noodles->isEmpty()) { @@ -32,11 +32,11 @@ if ($__noodles->isEmpty()) { $__noodles->set($id, $noodle); } } -$public_path = path::real($core->blog->public_path); +$public_path = path::real(dcCore::app()->blog->public_path); if (!is_dir($public_path) || !is_writable($public_path)) { $public_path = false; } -$default_images = files::scandir(dirname(__FILE__) . '/default-templates/img/'); +$default_images = files::scandir(__DIR__ . '/default-templates/img/'); if (!is_array($default_images)) { $default_images = []; } @@ -44,20 +44,20 @@ $default_image = $s->noodles_image; $combo_api = [ 'gravatar' => 'http://www.gravatar.com/', - 'libravatar' => 'http://cdn.libravatar.org/' + 'libravatar' => 'http://cdn.libravatar.org/', ]; $combo_place = [ __('Begin') => 'prepend', __('End') => 'append', __('Before') => 'before', - __('After') => 'after' + __('After') => 'after', ]; $combo_rating = [ 'G' => 'g', 'PG' => 'pg', 'R' => 'r', - 'X' => 'x' + 'X' => 'x', ]; $combo_size = [ '16px' => 16, @@ -68,7 +68,7 @@ $combo_size = [ '64px' => 64, '92px' => 92, '128px' => 128, - '256px' => 256 + '256px' => 256, ]; if (!empty($_POST['save'])) { @@ -94,7 +94,7 @@ if (!empty($_POST['save'])) { throw new Exception(__('Failed to save image')); } - // Default gravatar.com avatar + // Default gravatar.com avatar } elseif ($_POST['noodles_image'] == 'gravatar.com') { $s->put('noodles_image', 0, 'boolean'); @@ -126,28 +126,28 @@ if (!empty($_POST['save'])) { ->set('css', $bloc['css'] ?? '') ->set('target', $bloc['target'] ?? '') ->set('place', $bloc['place'] ?? 'prepend') - ; + ; } $s->put('noodles_object', $__noodles->encode(), 'string'); - $core->blog->triggerBlog(); - dcPage::addSuccessNotice(__('Configuration successfully updated')); - $core->adminurl->redirect('admin.plugin.noodles'); + dcCore::app()->blog->triggerBlog(); + dcAdminNotices::addSuccessNotice(__('Configuration successfully updated')); + dcCore::app()->adminurl->redirect('admin.plugin.noodles'); } catch (Exception $e) { - $core->error->add($e->getMessage()); + dcCore::app()->error->add($e->getMessage()); } } echo '