From 5c01994f283a27dae057ce5f822810ecfdbe29cf Mon Sep 17 00:00:00 2001 From: joomla-ua Date: Mon, 8 Oct 2018 04:27:14 +0300 Subject: [PATCH] Update to 7.1.2 --- build.xml | 167 +++++++++ .../plg_jumultithumb/adapters/com_content.php | 37 +- .../adapters/com_fjrelated.php | 24 +- packages/plg_jumultithumb/fields/css.php | 6 +- packages/plg_jumultithumb/fields/csscode.php | 2 +- packages/plg_jumultithumb/fields/head.php | 4 +- packages/plg_jumultithumb/fields/toggler.php | 4 +- .../plg_jumultithumb/fields/toggler34.php | 52 +-- packages/plg_jumultithumb/fields/upload.php | 6 +- packages/plg_jumultithumb/jumultithumb.php | 334 +++++++++--------- packages/plg_jumultithumb/jumultithumb.xml | 4 +- .../en-GB/en-GB.plg_content_jumultithumb.ini | 8 +- .../uk-UA/uk-UA.plg_content_jumultithumb.ini | 10 +- packages/plg_jumultithumb/lib/links.php | 15 +- packages/plg_jumultithumb/load/css.php | 54 +-- .../load/watermark/watermark.php | 121 ++++--- .../media/colorbox/style2/colorbox.css | 10 +- .../media/colorbox/style3/colorbox.css | 2 +- .../media/colorbox/style4/colorbox.css | 10 +- .../jumultithumb_contentform.php | 8 +- .../jumultithumb_contentform.xml | 4 +- .../assets/jqueryFileTree.php | 12 +- .../plg_jumultithumb_editorbutton/form.php | 20 +- .../jumultithumb_editorbutton.php | 14 +- .../jumultithumb_editorbutton.xml | 4 +- .../jumultithumb_gallery.php | 117 +++--- .../jumultithumb_gallery.xml | 4 +- pkg_jumultithumb.xml | 9 +- script.php | 62 ++-- 29 files changed, 647 insertions(+), 477 deletions(-) create mode 100644 build.xml diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..e1b90ab --- /dev/null +++ b/build.xml @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/plg_jumultithumb/adapters/com_content.php b/packages/plg_jumultithumb/adapters/com_content.php index fb9a5e5..d5867e7 100644 --- a/packages/plg_jumultithumb/adapters/com_content.php +++ b/packages/plg_jumultithumb/adapters/com_content.php @@ -14,16 +14,19 @@ class plgContentJUMultiThumb_com_content { - var $plugin; + public $plugin; /** * plgContentJUMultiThumb_com_content constructor. * * @param $plugin + * + * @since 7.0 */ public function __construct(&$plugin) { $this->plugin = &$plugin; + $this->app = JFactory::getApplication(); } /** @@ -31,41 +34,40 @@ public function __construct(&$plugin) * * @return bool * - * @since 6.0 + * @throws Exception + * @since 7.0 */ public function jView($jlayout) { - $app = JFactory::getApplication(); - - $option = $app->input->get('option'); - $view = $app->input->get('view'); - $layout = $app->input->get('layout'); - $print = $app->input->get('print'); + $option = $this->app->input->get('option'); + $view = $this->app->input->get('view'); + $layout = $this->app->input->get('layout'); + $print = $this->app->input->get('print'); switch ($jlayout) { case 'Component': - return ($option == 'com_content'); + return ($option === 'com_content'); break; case 'CatBlog': - return (($view == 'category' && ($layout == 'blog')) || ($view == 'category' && ($layout == 'card'))); + return (($view === 'category' && ($layout === 'blog')) || ($view === 'category' && ($layout === 'card'))); break; case 'Blog': - return ($layout == 'blog'); + return ($layout === 'blog'); break; case 'Category': - return ($view == 'categories' && !($layout)); + return ($view === 'categories' && !$layout); break; case 'Categories': - return ($view == 'categories'); + return ($view === 'categories'); break; case 'Featured': - return ($view == 'featured'); + return ($view === 'featured'); break; case 'Print': @@ -73,7 +75,7 @@ public function jView($jlayout) break; case 'Article': - return ($view == 'article'); + return ($view === 'article'); break; } @@ -85,11 +87,12 @@ public function jView($jlayout) * * @return JURI * - * @since 6.0 + * @throws Exception + * @since 7.0 */ public function jViewLink($article) { - require_once(JPATH_SITE . '/components/com_content/helpers/route.php'); + require_once JPATH_SITE . '/components/com_content/helpers/route.php'; if($article->params->get('access-view')) { diff --git a/packages/plg_jumultithumb/adapters/com_fjrelated.php b/packages/plg_jumultithumb/adapters/com_fjrelated.php index db0c762..3966f96 100644 --- a/packages/plg_jumultithumb/adapters/com_fjrelated.php +++ b/packages/plg_jumultithumb/adapters/com_fjrelated.php @@ -12,34 +12,35 @@ defined('_JEXEC') or die; +use Joomla\CMS\Factory; + class plgContentJUMultiThumb_com_fjrelated { - var $plugin; + public $plugin; public function __construct(&$plugin) { $this->plugin = &$plugin; + $this->app = Factory::getApplication(); } public function jView($jlayout) { - $app = JFactory::getApplication(); - - $option = $app->input->get('option'); - $view = $app->input->get('view'); - $layout = $app->input->get('layout'); - $print = $app->input->get('print'); + $option = $this->app->input->get('option'); + $view = $this->app->input->get('view'); + $layout = $this->app->input->get('layout'); + $print = $this->app->input->get('print'); switch ($jlayout) { case 'Component': - return ($option == 'com_fjrelated'); + return ($option === 'com_fjrelated'); break; case 'CatBlog': - return ($view == 'fjrelated' && ($layout == 'blog')); + return ($view === 'fjrelated' && $layout === 'blog'); break; case 'Blog': - return ($layout == 'blog'); + return ($layout === 'blog'); break; case 'Print': return ($print == '1'); @@ -51,7 +52,6 @@ public function jView($jlayout) public function jViewLink($article) { - require_once JPATH_SITE . '/components/com_content/helpers/route.php'; if($article->params->get('access-view')) @@ -60,7 +60,7 @@ public function jViewLink($article) } else { - $menu = JFactory::getApplication()->getMenu(); + $menu = $this->app->getMenu(); $active = $menu->getActive(); $itemId = $active->id; $link1 = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId); diff --git a/packages/plg_jumultithumb/fields/css.php b/packages/plg_jumultithumb/fields/css.php index c1b59ee..5cb7e18 100644 --- a/packages/plg_jumultithumb/fields/css.php +++ b/packages/plg_jumultithumb/fields/css.php @@ -22,13 +22,13 @@ class JFormFieldModal_CSS extends JFormField * * @return string * - * @since 6.0 + * @since 7.0 */ protected function getInput() { JHtml::_('behavior.modal', 'a.modal'); - $script = array(); + $script = []; $script[] = ' function jSelectArticle_' . $this->id . '(id, title, catid, object) {'; $script[] = ' document.id("' . $this->id . '_id").value = id;'; $script[] = ' document.id("' . $this->id . '_name").value = title;'; @@ -37,7 +37,7 @@ protected function getInput() JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); - $html = array(); + $html = []; $link = str_replace('administrator/', '', JURI::base()) . 'plugins/content/jumultithumb/load/css.php'; $html[] = ' ' . JText::_('PLG_JUMULTITHUMB_CSS_UPLOAD') . ''; diff --git a/packages/plg_jumultithumb/fields/csscode.php b/packages/plg_jumultithumb/fields/csscode.php index 4aa09d3..4cad3f4 100644 --- a/packages/plg_jumultithumb/fields/csscode.php +++ b/packages/plg_jumultithumb/fields/csscode.php @@ -22,7 +22,7 @@ class JFormFieldCSSCode extends JFormField * * @return string * - * @since 6.0 + * @since 7.0 */ protected function getInput() { diff --git a/packages/plg_jumultithumb/fields/head.php b/packages/plg_jumultithumb/fields/head.php index 4f994d5..a528e6e 100644 --- a/packages/plg_jumultithumb/fields/head.php +++ b/packages/plg_jumultithumb/fields/head.php @@ -12,7 +12,9 @@ defined('JPATH_BASE') or die; -$doc = JFactory::getDocument(); +use Joomla\CMS\Factory; + +$doc = Factory::getDocument(); $adm_url = str_replace('/administrator', '', JURI::base()); $doc->addStyleSheet($adm_url . 'plugins/content/jumultithumb/assets/css/jumultithumb.css?v=2'); diff --git a/packages/plg_jumultithumb/fields/toggler.php b/packages/plg_jumultithumb/fields/toggler.php index 59ca92e..f52a802 100644 --- a/packages/plg_jumultithumb/fields/toggler.php +++ b/packages/plg_jumultithumb/fields/toggler.php @@ -12,5 +12,5 @@ defined( '_JEXEC' ) or die(); -include('head.php'); -include('toggler34.php'); \ No newline at end of file +include 'head.php'; +include 'toggler34.php'; \ No newline at end of file diff --git a/packages/plg_jumultithumb/fields/toggler34.php b/packages/plg_jumultithumb/fields/toggler34.php index 5a303b7..54e1770 100644 --- a/packages/plg_jumultithumb/fields/toggler34.php +++ b/packages/plg_jumultithumb/fields/toggler34.php @@ -24,6 +24,8 @@ defined('_JEXEC') or die; +use Joomla\CMS\Factory; + class JFormFieldNN_Toggler extends JFormField { public $type = 'Toggler'; @@ -43,39 +45,35 @@ protected function getInput() class nnFieldToggler { - function getInput($params) + public function getInput($params) { $this->params = $params; - $option = JFactory::getApplication()->input->get('option'); - - if ($option == 'com_joomfish') return ''; - - $param = $this->get('param'); - $value = $this->get('value'); - $nofx = $this->get('nofx'); + $param = $this->get('param'); + $value = $this->get('value'); + $nofx = $this->get('nofx'); $method = $this->get('method'); - $div = $this->get('div', 0); + $div = $this->get('div', 0); JHtml::_('jquery.framework'); - JFactory::getDocument()->addScriptVersion(JURI::root(true) . '/plugins/content/jumultithumb/assets/js/script34.js'); - JFactory::getDocument()->addScriptVersion(JURI::root(true) . '/plugins/content/jumultithumb/assets/js/toggler34.js'); + Factory::getDocument()->addScriptVersion(JURI::root(true) . '/plugins/content/jumultithumb/assets/js/script34.js'); + Factory::getDocument()->addScriptVersion(JURI::root(true) . '/plugins/content/jumultithumb/assets/js/toggler34.js'); $param = preg_replace('#^\s*(.*?)\s*$#', '\1', $param); $param = preg_replace('#\s*\|\s*#', '|', $param); - $html = array(); - if ($param != '') + $html = []; + if($param != '') { - $param = preg_replace('#[^a-z0-9-\.\|\@]#', '_', $param); - $param = str_replace('@', '_', $param); + $param = preg_replace('#[^a-z0-9-.\|@]#', '_', $param); + $param = str_replace('@', '_', $param); $set_groups = explode('|', $param); $set_values = explode('|', $value); - $ids = array(); + $ids = []; foreach ($set_groups as $i => $group) { $count = $i; - if ($count >= count($set_values)) + if($count >= count($set_values)) { $count = 0; } @@ -86,23 +84,29 @@ function getInput($params) } } - if (!$div) { + if(!$div) + { $html[] = ''; } - $html[] = '
'; - if (!$div) { + if(!$div) + { $html[] = '
'; } - } else { + } + else + { $html[] = '
'; } @@ -113,4 +117,4 @@ private function get($val, $default = '') { return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default; } -} +} \ No newline at end of file diff --git a/packages/plg_jumultithumb/fields/upload.php b/packages/plg_jumultithumb/fields/upload.php index 59132a4..bf7978d 100644 --- a/packages/plg_jumultithumb/fields/upload.php +++ b/packages/plg_jumultithumb/fields/upload.php @@ -22,13 +22,13 @@ class JFormFieldModal_Upload extends JFormField * * @return string * - * @since 6.0 + * @since 7.0 */ protected function getInput() { JHtml::_('behavior.modal', 'a.modal'); - $script = array(); + $script = []; $script[] = ' function jSelectArticle_' . $this->id . '(id, title, catid, object) {'; $script[] = ' document.id("' . $this->id . '_id").value = id;'; $script[] = ' document.id("' . $this->id . '_name").value = title;'; @@ -37,7 +37,7 @@ protected function getInput() JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); - $html = array(); + $html = []; $link = str_replace('administrator/', '', JURI::base()) . 'plugins/content/jumultithumb/load/watermark/watermark.php'; $html[] = ' ' . JText::_('PLG_JUMULTITHUMB_WATERMARK_UPLOAD') . ''; diff --git a/packages/plg_jumultithumb/jumultithumb.php b/packages/plg_jumultithumb/jumultithumb.php index 5a53d16..bef9812 100644 --- a/packages/plg_jumultithumb/jumultithumb.php +++ b/packages/plg_jumultithumb/jumultithumb.php @@ -12,33 +12,40 @@ defined('_JEXEC') or die; +use Joomla\CMS\Factory; + jimport('joomla.plugin.plugin'); jimport('joomla.filesystem.file'); -require_once(JPATH_SITE . '/plugins/content/jumultithumb/lib/links.php'); -require_once(JPATH_SITE . '/libraries/julib/image.php'); +require_once JPATH_SITE . '/plugins/content/jumultithumb/lib/links.php'; +require_once JPATH_SITE . '/libraries/julib/image.php'; class plgContentjumultithumb extends JPlugin { - var $modeHelper; + public $modeHelper; /** * plgContentjumultithumb constructor. * * @param $subject * @param $config + * + * @throws Exception + * @since 7.0 */ public function __construct(& $subject, $config) { parent::__construct($subject, $config); $this->loadLanguage(); - $option = JFactory::getApplication()->input->get('option'); + $this->app = Factory::getApplication(); + + $option = $this->app->input->get('option'); $adapter = JPATH_SITE . '/plugins/content/jumultithumb/adapters/' . $option . '.php'; if(JFile::exists($adapter)) { - require_once($adapter); + require_once $adapter; $mode_option = 'plgContentJUMultiThumb_' . $option; $this->modeHelper = new $mode_option($this); } @@ -50,22 +57,21 @@ public function __construct(& $subject, $config) * @param $params * @param $limitstart * - * @return bool + * @return void * - * @since 6.0 + * @throws Exception + * @since 7.0 */ public function onContentBeforeDisplay($context, &$article, &$params, $limitstart) { - $app = JFactory::getApplication(); - - if($app->getName() != 'site') + if($this->app->getName() !== 'site') { - return true; + return; } if(!($this->modeHelper && $this->modeHelper->jView('Component'))) { - return true; + return; } if($this->modeHelper && $this->modeHelper->jView('Article')) @@ -93,13 +99,12 @@ public function onContentBeforeDisplay($context, &$article, &$params, $limitstar * * @return bool * - * @since 6.0 + * @throws Exception + * @since 7.0 */ public function onContentPrepare($context, &$article, &$params, $limitstart) { - $app = JFactory::getApplication(); - - if($app->getName() != 'site') + if($this->app->getName() !== 'site') { return true; } @@ -116,17 +121,19 @@ public function onContentPrepare($context, &$article, &$params, $limitstart) if(isset($article->fulltext)) { - $use_wm = 1; - if($this->params->get('wm_tab', 0) == '1') + $attribs = json_decode($article->attribs); + + $watermark_into_only = 0; + if(isset($attribs->watermark_intro_only)) { - $attribs = json_decode($article->attribs); $watermark_into_only = $attribs->watermark_intro_only; + } + + $use_wm = 1; + if($watermark_into_only == 1) + { $use_wm = 0; - if($watermark_into_only == '1') - { - $use_wm = 1; - } } $article->fulltext = @$this->ImgReplace($article->fulltext, $article, $use_wm); @@ -142,9 +149,10 @@ public function onContentPrepare($context, &$article, &$params, $limitstart) * * @return mixed|null|string|string[] * - * @since 6.0 + * @throws Exception + * @since 7.0 */ - public function ImgReplace($text, &$article, $use_wm) + public function ImgReplace($text, &$article, $use_wm = 1) { $param = $this->params; @@ -152,17 +160,11 @@ public function ImgReplace($text, &$article, $use_wm) $only_image_category = $param->get('only_image_category'); $only_image_featured = $param->get('only_image_featured'); - $watermark_o = 1; - $watermark_s = 1; + $attribs = json_decode($article->attribs); + $watermark_o = $attribs->watermark; + $watermark_s = $attribs->watermark_s; - if($this->params->get('wm_tab', 0) == '1') - { - $attribs = json_decode($article->attribs); - $watermark_o = $attribs->watermark; - $watermark_s = $attribs->watermark_s; - } - - if($use_wm == '0') + if($use_wm == 0) { $watermark_o = '0'; $watermark_s = '0'; @@ -204,21 +206,20 @@ public function ImgReplace($text, &$article, $use_wm) * * @return string * - * @since 6.0 + * @throws Exception + * @since 7.0 */ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_s) { - $app = JFactory::getApplication(); - $JUImg = new JUImg(); - $Itemid = $app->input->getInt('Itemid'); + $Itemid = $this->app->input->getInt('Itemid'); $param = $this->params; // params $quality = $param->get('quality'); $noimage_class = $param->def('noimage_class'); - $thumb_filtercolor = intval($param->get('thumb_filtercolor', 0)); + $thumb_filtercolor = (int) $param->get('thumb_filtercolor', 0); $colorized = $param->get('colorized', '25'); $colorpicker = $param->get('colorpicker', '#0000ff'); $thumb_th_seting = $param->get('thumb_th_seting', 0); @@ -237,48 +238,48 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ switch ($thumb_filtercolor) { case '1': - $imp_filtercolor = array('fltr_1' => 'gray'); + $imp_filtercolor = ['fltr_1' => 'gray']; break; case '2': - $imp_filtercolor = array('fltr_1' => 'sep'); + $imp_filtercolor = ['fltr_1' => 'sep']; break; case '3': - $imp_filtercolor = array('fltr_1' => 'th|' . $thumb_th_seting); + $imp_filtercolor = ['fltr_1' => 'th|' . $thumb_th_seting]; break; case '4': - $imp_filtercolor = array('fltr_1' => 'clr|' . $colorized . '|' . str_replace('#', '', $colorpicker)); + $imp_filtercolor = ['fltr_1' => 'clr|' . $colorized . '|' . str_replace('#', '', $colorpicker)]; break; default: - $imp_filtercolor = array(); + $imp_filtercolor = []; break; } - $usm_filtercolor = array(); + $usm_filtercolor = []; if($usm == '1' && $thumb_filters == '1') { - $usm_filtercolor = array('fltr_2' => 'usm|' . $thumb_unsharp_amount . '|' . $thumb_unsharp_radius . '|' . $thumb_unsharp_threshold); + $usm_filtercolor = ['fltr_2' => 'usm|' . $thumb_unsharp_amount . '|' . $thumb_unsharp_radius . '|' . $thumb_unsharp_threshold]; } - $blur_filtercolor = array(); + $blur_filtercolor = []; if($thumb_blur == '1' && $thumb_filters == '1') { - $blur_filtercolor = array('fltr_3' => 'blur|' . $thumb_blur_seting); + $blur_filtercolor = ['fltr_3' => 'blur|' . $thumb_blur_seting]; } - $brit_filtercolor = array(); + $brit_filtercolor = []; if($thumb_brit == '1' && $thumb_filters == '1') { - $brit_filtercolor = array('fltr_4' => 'brit|' . $thumb_brit_seting); + $brit_filtercolor = ['fltr_4' => 'brit|' . $thumb_brit_seting]; } - $cont_filtercolor = array(); + $cont_filtercolor = []; if($thumb_cont == '1' && $thumb_filters == '1') { - $cont_filtercolor = array('fltr_5' => 'cont|' . $thumb_cont_seting); + $cont_filtercolor = ['fltr_5' => 'cont|' . $thumb_cont_seting]; } // image replacer @@ -287,7 +288,7 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ preg_match_all('/(width|height|src|alt|title|class|align|style)=("[^"]*")/i', $_img, $imgAttr); $countAttr = count($imgAttr[0]); - $img = array(); + $img = []; for ($i = 0; $i < $countAttr; $i++) { $img[$imgAttr[1][$i]] = str_replace('"', '', $imgAttr[2][$i]); @@ -318,18 +319,18 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ } // attributes - $img_class = 'juimage ' . $imgclass . $img_class . 'juimg-' . $app->input->get('view'); + $img_class = 'juimage ' . $imgclass . $img_class . 'juimg-' . $this->app->input->get('view'); $imgalt = mb_strtoupper(mb_substr($imgalt, 0, 1)) . mb_substr($imgalt, 1); $img_alt = $imgalt; $imgtitle = mb_strtoupper(mb_substr($imgtitle, 0, 1)) . mb_substr($imgtitle, 1); - $img_title = ($imgalt ? $imgalt : $imgtitle); - $img_title = ($img_title ? $img_title : $article->title); + $img_title = ($imgalt ?: $imgtitle); + $img_title = ($img_title ?: $article->title); $img_title = ($img_title ? ' title="' . $img_title . '"' : ''); $_image_noresize = 0; - if($param->get('resall') == '0' && $img['class'] != "juimage") + if($param->get('resall') == '0' && $img['class'] !== 'juimage') { $size = getimagesize(JPATH_SITE . '/' . $originalsource); $limage = $this->_image($originalsource, $size[0], $size[1], $imgclass, $img_alt, 1, 1, $img_title); @@ -340,10 +341,10 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ if( $param->get('resall') == '1' && ( - $img['class'] == "nothumb" || - $img['class'] == "noimage" || - $img['class'] == "nothumbnail" || - $img['class'] == "jugallery" || + $img['class'] === 'nothumb' || + $img['class'] === 'noimage' || + $img['class'] === 'nothumbnail' || + $img['class'] === 'jugallery' || $img['class'] == $noimage_class ) && $img['class'] != '' @@ -356,15 +357,14 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ return $limage; } - else - { - $_image_noresize = 1; - } + + $_image_noresize = 1; } + if($this->modeHelper && $this->modeHelper->jView('CatBlog')) { - if(in_array($Itemid, ($param->get('menu_item1')) ? $param->get('menu_item1') : array())) + if(in_array($Itemid, $param->get('menu_item1') ?: [], true)) { $b_newwidth = $param->get('b_widthnew1'); $b_newheight = $param->get('b_heightnew1'); @@ -379,7 +379,7 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ $b_sxnew = $param->def('b_sxnew1'); $b_synew = $param->def('b_synew1'); } - elseif(in_array($Itemid, ($param->get('menu_item2')) ? $param->get('menu_item2') : array())) + elseif(in_array($Itemid, $param->get('menu_item2') ?: [], true)) { $b_newwidth = $param->get('b_widthnew2'); $b_newheight = $param->get('b_heightnew2'); @@ -394,7 +394,7 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ $b_sxnew = $param->def('b_sxnew2'); $b_synew = $param->def('b_synew2'); } - elseif(in_array($Itemid, ($param->get('menu_item3')) ? $param->get('menu_item3') : array())) + elseif(in_array($Itemid, $param->get('menu_item3') ?: [], true)) { $b_newwidth = $param->get('b_widthnew3'); $b_newheight = $param->get('b_heightnew3'); @@ -409,7 +409,7 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ $b_sxnew = $param->def('b_sxnew3'); $b_synew = $param->def('b_synew3'); } - elseif(in_array($Itemid, ($param->get('menu_item4')) ? $param->get('menu_item4') : array())) + elseif(in_array($Itemid, $param->get('menu_item4') ?: [], true)) { $b_newwidth = $param->get('b_widthnew4'); $b_newheight = $param->get('b_heightnew4'); @@ -424,7 +424,7 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ $b_sxnew = $param->def('b_sxnew4'); $b_synew = $param->def('b_synew4'); } - elseif(in_array($Itemid, ($param->get('menu_item5')) ? $param->get('menu_item5') : array())) + elseif(in_array($Itemid, $param->get('menu_item5') ?: [], true)) { $b_newwidth = $param->get('b_widthnew5'); $b_newheight = $param->get('b_heightnew5'); @@ -464,27 +464,27 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ if($aspect >= '1' && $b_newauto_zoomcrop == '1') { - $new_imgparams = array( + $new_imgparams = [ 'far' => '1', 'bg' => str_replace('#', '', $b_newfarcropbg) - ); + ]; } else { - $new_imgparams = array( - 'zc' => ($b_newcropzoom == 1 ? $b_newzoomcrop_params : '') - ); + $new_imgparams = [ + 'zc' => $b_newcropzoom == 1 ? $b_newzoomcrop_params : '' + ]; } if($b_newfarcrop == '1') { - $new_imgparams = array( + $new_imgparams = [ 'far' => $b_newfarcrop_params, 'bg' => str_replace('#', '', $b_newfarcropbg) - ); + ]; } - $imgparams = array( + $imgparams = [ 'w' => $b_newwidth, 'h' => $b_newheight, 'aoe' => $b_aoenew, @@ -492,7 +492,7 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ 'sy' => $b_synew, 'q' => $quality, 'cache' => 'img' - ); + ]; $_imgparams = array_merge( $imp_filtercolor, @@ -509,14 +509,14 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ $limage = $this->_image($thumb_img, $b_newwidth, $b_newheight, $img_class, $img_alt, 0, 0); } elseif( - $this->modeHelper && $this->modeHelper->jView('Article') || - $this->modeHelper && $this->modeHelper->jView('Categories') || - $this->modeHelper && $this->modeHelper->jView('Category') + ($this->modeHelper && $this->modeHelper->jView('Article')) || + ($this->modeHelper && $this->modeHelper->jView('Categories')) || + ($this->modeHelper && $this->modeHelper->jView('Category')) ) { if($this->modeHelper && $this->modeHelper->jView('Article')) { - if(in_array($Itemid, ($param->get('menu_item1')) ? $param->get('menu_item1') : array())) + if(in_array($Itemid, $param->get('menu_item1') ?: [], true)) { $newmaxwidth = $param->get('maxwidthnew1'); $newmaxheight = $param->get('maxheightnew1'); @@ -535,7 +535,7 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ $newnoresize = $param->get('noresizenew1'); $newnofullimg = $param->get('nofullimgnew1'); } - elseif(in_array($Itemid, ($param->get('menu_item2')) ? $param->get('menu_item2') : array())) + elseif(in_array($Itemid, $param->get('menu_item2') ?: [], true)) { $newmaxwidth = $param->get('maxwidthnew2'); $newmaxheight = $param->get('maxheightnew2'); @@ -554,7 +554,7 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ $newnoresize = $param->get('noresizenew2'); $newnofullimg = $param->get('nofullimgnew2'); } - elseif(in_array($Itemid, ($param->get('menu_item3')) ? $param->get('menu_item3') : array())) + elseif(in_array($Itemid, $param->get('menu_item3') ?: [], true)) { $newmaxwidth = $param->get('maxwidthnew3'); $newmaxheight = $param->get('maxheightnew3'); @@ -573,7 +573,7 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ $newnoresize = $param->get('noresizenew3'); $newnofullimg = $param->get('nofullimgnew3'); } - elseif(in_array($Itemid, ($param->get('menu_item4')) ? $param->get('menu_item4') : array())) + elseif(in_array($Itemid, $param->get('menu_item4') ?: [], true)) { $newmaxwidth = $param->get('maxwidthnew4'); $newmaxheight = $param->get('maxheightnew4'); @@ -592,7 +592,7 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ $newnoresize = $param->get('noresizenew4'); $newnofullimg = $param->get('nofullimgnew4'); } - elseif(in_array($Itemid, ($param->get('menu_item5')) ? $param->get('menu_item5') : array())) + elseif(in_array($Itemid, $param->get('menu_item5') ?: [], true)) { $newmaxwidth = $param->get('maxwidthnew5'); $newmaxheight = $param->get('maxheightnew5'); @@ -633,11 +633,11 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ } } elseif( - $this->modeHelper && $this->modeHelper->jView('Categories') || - $this->modeHelper && $this->modeHelper->jView('Category') + ($this->modeHelper && $this->modeHelper->jView('Categories')) || + ($this->modeHelper && $this->modeHelper->jView('Category')) ) { - if(in_array($Itemid, ($param->get('cat_menu_item1')) ? $param->get('cat_menu_item1') : array())) + if(in_array($Itemid, $param->get('cat_menu_item1') ?: [], true)) { $newmaxwidth = $param->get('cat_maxwidthnew1'); $newmaxheight = $param->get('cat_maxheightnew1'); @@ -656,7 +656,7 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ $newnoresize = $param->get('cat_noresizenew1'); $newnofullimg = $param->get('cat_nofullimgnew1'); } - elseif(in_array($Itemid, ($param->get('cat_menu_item2')) ? $param->get('cat_menu_item2') : array())) + elseif(in_array($Itemid, $param->get('cat_menu_item2') ?: [], true)) { $newmaxwidth = $param->get('cat_maxwidthnew2'); $newmaxheight = $param->get('cat_maxheightnew2'); @@ -675,7 +675,7 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ $newnoresize = $param->get('cat_noresizenew2'); $newnofullimg = $param->get('cat_nofullimgnew2'); } - elseif(in_array($Itemid, ($param->get('cat_menu_item3')) ? $param->get('cat_menu_item3') : array())) + elseif(in_array($Itemid, $param->get('cat_menu_item3') ?: [], true)) { $newmaxwidth = $param->get('cat_maxwidthnew3'); $newmaxheight = $param->get('cat_maxheightnew3'); @@ -694,7 +694,7 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ $newnoresize = $param->get('cat_noresizenew3'); $newnofullimg = $param->get('cat_nofullimgnew3'); } - elseif(in_array($Itemid, ($param->get('cat_menu_item4')) ? $param->get('cat_menu_item4') : array())) + elseif(in_array($Itemid, $param->get('cat_menu_item4') ?: [], true)) { $newmaxwidth = $param->get('cat_maxwidthnew4'); $newmaxheight = $param->get('cat_maxheightnew4'); @@ -713,7 +713,7 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ $newnoresize = $param->get('cat_noresizenew4'); $newnofullimg = $param->get('cat_nofullimgnew4'); } - elseif(in_array($Itemid, ($param->get('cat_menu_item5')) ? $param->get('cat_menu_item5') : array())) + elseif(in_array($Itemid, $param->get('cat_menu_item5') ?: [], true)) { $newmaxwidth = $param->get('cat_maxwidthnew5'); $newmaxheight = $param->get('cat_maxheightnew5'); @@ -756,7 +756,7 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ if($newnoresize == '1') // || $cat_newnoresize == '1' { - $juimgresmatche = str_replace(array(' /', JURI::base()), '', $originalsource); + $juimgresmatche = str_replace([' /', JURI::base()], '', $originalsource); $limage = $this->_image(JURI::base() . $juimgresmatche, $newmaxwidth, $newmaxheight, $img_class, $img_alt, 1, 1); return $limage; @@ -765,16 +765,14 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ // Watermark $wmi = ''; if( - $watermark_o == '1' && - ( - $_image_noresize == '1' || - $param->get('a_watermark') == '1' || - $param->get('a_watermarknew1') == '1' || - $param->get('a_watermarknew2') == '1' || - $param->get('a_watermarknew3') == '1' || - $param->get('a_watermarknew4') == '1' || - $param->get('a_watermarknew5') == '1' - ) + $watermark_o == '1' || + $_image_noresize == '1' || + $param->get('a_watermark') == '1' || + $param->get('a_watermarknew1') == '1' || + $param->get('a_watermarknew2') == '1' || + $param->get('a_watermarknew3') == '1' || + $param->get('a_watermarknew4') == '1' || + $param->get('a_watermarknew5') == '1' ) { $wmfile = JPATH_SITE . '/plugins/content/jumultithumb/load/watermark/w.png'; @@ -791,7 +789,6 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ $wmi = 'wmi|' . $watermark . '|' . $param->get('wmposition') . '|' . $param->get('wmopst') . '|' . $param->get('wmx') . '|' . $param->get('wmy'); } - $_width = ''; $_height = ''; if( @@ -805,29 +802,27 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ $link_img = $imgsource; if( - $watermark_o == '1' && - ( - $_image_noresize == '1' || - $param->get('a_watermark') == '1' || - $param->get('a_watermarknew1') == '1' || - $param->get('a_watermarknew2') == '1' || - $param->get('a_watermarknew3') == '1' || - $param->get('a_watermarknew4') == '1' || - $param->get('a_watermarknew5') == '1' || - - $param->get('maxsize_orig') == '1' || - $param->get('cat_newmaxsize_orig') == '1' - ) + $watermark_o == '1' || + $_image_noresize == '1' || + $param->get('a_watermark') == '1' || + $param->get('a_watermarknew1') == '1' || + $param->get('a_watermarknew2') == '1' || + $param->get('a_watermarknew3') == '1' || + $param->get('a_watermarknew4') == '1' || + $param->get('a_watermarknew5') == '1' || + + $param->get('maxsize_orig') == '1' || + $param->get('cat_newmaxsize_orig') == '1' ) { - $link_imgparams = array( + $link_imgparams = [ 'w' => $_width, 'h' => $_height, 'aoe' => $newaoe, - 'fltr' => ($wmi != '' ? $wmi : ''), + 'fltr' => $wmi != '' ? $wmi : '', 'q' => $quality, 'cache' => 'img' - ); + ]; $_link_imgparams = array_merge( $imp_filtercolor, @@ -844,15 +839,13 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ // Small watermark $wmi_s = ''; if( - $watermark_s == '1' && - ( - $param->get('a_watermark_s') == '1' || - $param->get('a_watermarknew1_s') == '1' || - $param->get('a_watermarknew2_s') == '1' || - $param->get('a_watermarknew3_s') == '1' || - $param->get('a_watermarknew4_s') == '1' || - $param->get('a_watermarknew5_s') == '1' - ) + $watermark_s == '1' || + $param->get('a_watermark_s') == '1' || + $param->get('a_watermarknew1_s') == '1' || + $param->get('a_watermarknew2_s') == '1' || + $param->get('a_watermarknew3_s') == '1' || + $param->get('a_watermarknew4_s') == '1' || + $param->get('a_watermarknew5_s') == '1' ) { $wmfile = JPATH_SITE . '/plugins/content/jumultithumb/load/watermark/ws.png'; @@ -888,36 +881,36 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ if($aspect >= '1' && $newauto_zoomcrop == '1') { - $new_imgparams = array( + $new_imgparams = [ 'far' => '1', 'bg' => str_replace('#', '', $newfarcropbg) - ); + ]; } else { - $new_imgparams = array( - 'zc' => ($newcropzoom == 1 ? $newzoomcrop_params : '') - ); + $new_imgparams = [ + 'zc' => $newcropzoom == 1 ? $newzoomcrop_params : '' + ]; } if($newfarcrop == '1') { - $new_imgparams = array( + $new_imgparams = [ 'far' => $newfarcrop_params, 'bg' => str_replace('#', '', $newfarcropbg) - ); + ]; } - $imgparams = array( + $imgparams = [ 'w' => $newwidth, 'h' => $newheight, 'aoe' => $newaoe, 'sx' => $newsx, 'sy' => $newsy, - 'fltr' => ($wmi_s != '' ? $wmi_s : ''), + 'fltr' => $wmi_s != '' ? $wmi_s : '', 'q' => $quality, 'cache' => 'img' - ); + ]; $_imgparams = array_merge( $imp_filtercolor, @@ -965,27 +958,27 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ if($aspect >= '1' && $f_newauto_zoomcrop == '1') { - $new_imgparams = array( + $new_imgparams = [ 'far' => '1', 'bg' => str_replace('#', '', $f_newfarcropbg) - ); + ]; } else { - $new_imgparams = array( - 'zc' => ($f_newcropzoom == 1 ? $f_newzoomcrop_params : '') - ); + $new_imgparams = [ + 'zc' => $f_newcropzoom == 1 ? $f_newzoomcrop_params : '' + ]; } if($f_newfarcrop == '1') { - $new_imgparams = array( + $new_imgparams = [ 'far' => $f_newfarcrop_params, 'bg' => str_replace('#', '', $f_newfarcropbg) - ); + ]; } - $imgparams = array( + $imgparams = [ 'w' => $f_newwidth, 'h' => $f_newheight, 'aoe' => $f_aoenew, @@ -993,7 +986,7 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ 'sy' => $f_synew, 'q' => $quality, 'cache' => 'img' - ); + ]; $_imgparams = array_merge( $imp_filtercolor, @@ -1028,12 +1021,12 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_ * * @return string * - * @since 6.0 + * @throws Exception + * @since 7.0 */ public function _image($_img, $_w, $_h, $_class = null, $_alt = null, $_caption = null, $_noresize = null, $_title = null, $_link_img = null, $_orig_img = null, $_lightbox = null) { - $app = JFactory::getApplication(); - $template = $app->getTemplate(); + $template = $this->app->getTemplate(); switch ($_lightbox) { @@ -1067,7 +1060,7 @@ public function _image($_img, $_w, $_h, $_class = null, $_alt = null, $_caption * * @return string * - * @since 6.0 + * @since 7.0 */ public function getTmpl($template, $name) { @@ -1092,29 +1085,27 @@ public function getTmpl($template, $name) * * @return float|int * - * @since 6.0 + * @since 7.0 */ - public static function _aspect($html, $_cropaspect) + public function _aspect($html, $_cropaspect) { $size = getimagesize(rawurldecode(JPATH_SITE . '/' . $html)); $width = $size[0]; $height = $size[1] * ($_cropaspect != '' ? $_cropaspect : '0'); - $aspect = $height / $width; - return $aspect; + return $height / $width; } /** * * @return bool * - * @since 6.0 + * @throws Exception + * @since 7.0 */ public function onBeforeCompileHead() { - $app = JFactory::getApplication(); - - if($app->getName() != 'site') + if($this->app->getName() !== 'site') { return true; } @@ -1124,7 +1115,7 @@ public function onBeforeCompileHead() return true; } - $doc = JFactory::getDocument(); + $doc = Factory::getDocument(); $param = $this->params; $selectlightbox = $param->get('selectlightbox'); @@ -1132,16 +1123,19 @@ public function onBeforeCompileHead() if( $param->get('uselightbox', '1') == '1' && ( - $this->modeHelper && $this->modeHelper->jView('Article') || - $this->modeHelper && $this->modeHelper->jView('Categories') || - $this->modeHelper && $this->modeHelper->jView('CatBlog') + ($this->modeHelper && $this->modeHelper->jView('Article')) || + ($this->modeHelper && $this->modeHelper->jView('Categories')) || + ($this->modeHelper && $this->modeHelper->jView('CatBlog')) ) && !($this->modeHelper && $this->modeHelper->jView('Print')) ) { - if($param->get("jujq") == '0') $doc->addScript(JURI::root(true) . '/media/jui/js/jquery.min.js'); + if($param->get('jujq') == '0') + { + $doc->addScript(JURI::root(true) . '/media/jui/js/jquery.min.js'); + } - $juhead = ""; + $juhead = ''; switch ($selectlightbox) { @@ -1157,7 +1151,7 @@ public function onBeforeCompileHead() $jsparams = "\r"; if($param->get('colorboxparam')) { - $jsparams = "{\n " . str_replace("
", "\n ", $param->get('colorboxparam')) . "\n }"; + $jsparams = "{\n " . str_replace('
', "\n ", $param->get('colorboxparam')) . "\n }"; } $doc->addStyleSheet(JURI::base() . 'media/plg_jumultithumb/colorbox/' . $param->get('colorboxstyle') . '/colorbox.css'); diff --git a/packages/plg_jumultithumb/jumultithumb.xml b/packages/plg_jumultithumb/jumultithumb.xml index b1d2ede..575e4b1 100644 --- a/packages/plg_jumultithumb/jumultithumb.xml +++ b/packages/plg_jumultithumb/jumultithumb.xml @@ -2,13 +2,13 @@ PLG_JUMULTITHUMB Denys Nosov - 05.12.2018 + @date@ (C) 2007-2018 Denys Nosov. All rights reserved. http://creativecommons.org/licenses/by-nc-nd/3.0/ Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License denys@joomla-ua.org www.joomla-ua.org - 7.0.5 + @version@ PLG_JUMULTITHUMB_DESCRIPTION diff --git a/packages/plg_jumultithumb/language/en-GB/en-GB.plg_content_jumultithumb.ini b/packages/plg_jumultithumb/language/en-GB/en-GB.plg_content_jumultithumb.ini index 74c7b3e..6344eeb 100644 --- a/packages/plg_jumultithumb/language/en-GB/en-GB.plg_content_jumultithumb.ini +++ b/packages/plg_jumultithumb/language/en-GB/en-GB.plg_content_jumultithumb.ini @@ -121,7 +121,6 @@ PLG_JUMULTITHUMB_MODE_SELECT="Select mode" ; version 4.0.7 COM_PLUGINS_GALLERY_FIELDSET_LABEL="Gallery" PLG_JUMULTITHUMB_GALLERY_READMORE="Using the gallery
At the bottom of the article editor click on the gallery button and select a folder of photos to be displayed in a gallery.
In the editor inserted code like {gallery folder_path}, where folder_path - path to the gallery folder in folder /images,
you can choose below." -PLG_JUMULTITHUMB_GALLERY_TITLE="Gallery title" PLG_JUMULTITHUMB_GALLERY_CSS_CLASS="Gallery CSS class" PLG_JUMULTITHUMB_GALLERY_SELECT_FOLDER="Select folder" PLG_JUMULTITHUMB_GALLERY_INSERT_TAG="Insert gallery tag" @@ -178,8 +177,6 @@ PLG_JUMULTITHUMB_FILTER_TH_DESC="Default - 10" ; version 6.5.3 PLG_JUMULTITHUMB_TITLE="JUMultiThumb" PLG_JUMULTITHUMB_DESCRIPTION="JUMultiThumb - best plugin for resize image in article

Multifunction plugin for creating thumbnails of images, using LightBox libraries, watermark, etc..." -PLG_JUMULTITHUMB_EXTENSION="Extensions" -PLG_JUMULTITHUMB_REMOVE_OLD_FILES="Remove old files" PLG_JUMULTITHUMB_ERROR_DB_SUPPORT="This release of JUMultiThumb is not compatible with your database driver." PLG_JUMULTITHUMB_ERROR_INSTALL_JVERSION="This release of Podcast Manager requires Joomla! 1.6 or newer" @@ -213,7 +210,4 @@ PLG_JUMULTITHUMB_IMAGE_FAR="Force set proportion. The image is created with the PLG_JUMULTITHUMB_IMAGE_FAR_PARAMS="Options forced proportions" ; version 6.5.8 -PLG_JUMULTITHUMB_WATERMARK_INTROTEXT_IMG="Watermark Image only for the introductory text" - -; version 6.5.8 -PLG_JUMULTITHUMB_WM_TAB="Use tab in Article for control Watermark" \ No newline at end of file +PLG_JUMULTITHUMB_WATERMARK_INTROTEXT_IMG="Watermark Image only for the introductory text" \ No newline at end of file diff --git a/packages/plg_jumultithumb/language/uk-UA/uk-UA.plg_content_jumultithumb.ini b/packages/plg_jumultithumb/language/uk-UA/uk-UA.plg_content_jumultithumb.ini index 9b9fbac..a3f4c35 100644 --- a/packages/plg_jumultithumb/language/uk-UA/uk-UA.plg_content_jumultithumb.ini +++ b/packages/plg_jumultithumb/language/uk-UA/uk-UA.plg_content_jumultithumb.ini @@ -121,7 +121,6 @@ PLG_JUMULTITHUMB_MODE_SELECT="Обрати режим" ; version 4.0.7 COM_PLUGINS_GALLERY_FIELDSET_LABEL="Gallery" PLG_JUMULTITHUMB_GALLERY_READMORE="Використання галереї:
Під редактором у статті натисніть на кнопку галереї та оберіть теку з фотографіями, які потрібно відобразити у вигляді галереї.
У редактор вставиться подібний код {gallery folder_path}, де folder_path — шлях до теки фотогалереї у теці /images,
яку ви можете обрати нижче." -PLG_JUMULTITHUMB_GALLERY_TITLE="Назва галереї" PLG_JUMULTITHUMB_GALLERY_CSS_CLASS="CSS-клас галереї" PLG_JUMULTITHUMB_GALLERY_SELECT_FOLDER="Оберіть теку з вашою галереєю" PLG_JUMULTITHUMB_GALLERY_INSERT_TAG="Вставити тег галереї" @@ -179,17 +178,15 @@ PLG_JUMULTITHUMB_FILTER_TH_DESC="За замовчуванням - 10" PLG_JUMULTITHUMB_TITLE="JUMultiThumb" PLG_JUMULTITHUMB_DESCRIPTION="JUMultiThumb - чудовий плагін для створення ескізів зображення в статті

Багатофункціональний плагін для створення ескізів з оригінальних зображень статті із використанням різних бібліотек лайтбоксів, водяних знаків, тощо..." PLG_JUMULTITHUMB_EXTENSION="Розширення" -PLG_JUMULTITHUMB_REMOVE_OLD_FILES="Видалення старих файлів" PLG_JUMULTITHUMB_ERROR_DB_SUPPORT="This release of JUMultiThumb is not compatible with your database driver." PLG_JUMULTITHUMB_ERROR_INSTALL_JVERSION="This release of Podcast Manager requires Joomla! 1.6 or newer" PLG_JUMULTITHUMB_ERROR_INSTALL_PHPVERSION="This release of JUMultiThumb requires PHP 5.0 or newer" -PLG_JUMULTITHUMB_EXTENSION="Extension" PLG_JUMULTITHUMB_INSTALLED="Installed" PLG_JUMULTITHUMB_NA="N/A" PLG_JUMULTITHUMB_NOT_INSTALLED="Not Installed" PLG_JUMULTITHUMB_TYPE="Type" -PLG_JUMULTITHUMB_REMOVE_OLD_FILES="Remove old files and folders" +PLG_JUMULTITHUMB_REMOVE_OLD_FILES="Видалення старих файлів та тек" ; version 6.5.7 PLG_JUMULTITHUMB_IMAGE_FILTERS_GREY="Відтінки сірого" @@ -213,7 +210,4 @@ PLG_JUMULTITHUMB_IMAGE_FAR="Примусово задати пропорції. PLG_JUMULTITHUMB_IMAGE_FAR_PARAMS="Параметри примусової пропорції" ; version 6.5.8 -PLG_JUMULTITHUMB_WATERMARK_INTROTEXT_IMG="Водяний знак тільки для зображення вступного тексту" - -; version 7.0.5 -PLG_JUMULTITHUMB_WM_TAB="Використовувати налаштування вкладки \"Водяний знак\" у статті, для перевизначення налаштувань водяного знаку з опцій плагіну" \ No newline at end of file +PLG_JUMULTITHUMB_WATERMARK_INTROTEXT_IMG="Водяний знак тільки для зображення вступного тексту" \ No newline at end of file diff --git a/packages/plg_jumultithumb/lib/links.php b/packages/plg_jumultithumb/lib/links.php index 65157cd..6013153 100644 --- a/packages/plg_jumultithumb/lib/links.php +++ b/packages/plg_jumultithumb/lib/links.php @@ -22,7 +22,7 @@ class AutoLinks * * @return null|string|string[] * - * @since 6.0 + * @since 7.0 */ public function handleImgLinks(&$text, $title, $link, $onlyFirstImage) { @@ -31,16 +31,16 @@ public function handleImgLinks(&$text, $title, $link, $onlyFirstImage) return $text; } - $regex = "/]+>/i"; + $regex = '/]+>/i'; $this->_replaceImg(null, $link, $title); if($onlyFirstImage) { - $text = preg_replace_callback($regex, array($this, '_replaceImg'), $text, 1); + $text = preg_replace_callback($regex, [$this, '_replaceImg'], $text, 1); } else { - $text = preg_replace_callback($regex, array($this, '_replaceImg'), $text); + $text = preg_replace_callback($regex, [$this, '_replaceImg'], $text); } return $text; @@ -53,7 +53,7 @@ public function handleImgLinks(&$text, $title, $link, $onlyFirstImage) * * @return string * - * @since 6.0 + * @since 7.0 */ public function _replaceImg($matches, $link = null, $title = null) { @@ -61,11 +61,10 @@ public function _replaceImg($matches, $link = null, $title = null) static $_title; - if(isset($link) && isset($title)) + if($title !== null) { $_link = $link; - $title = str_replace("'", ' ', $title); - $title = str_replace('"', ' ', $title); + $title = str_replace(["'", '"'], ' ', $title); $_title = $title; $html = ''; } diff --git a/packages/plg_jumultithumb/load/css.php b/packages/plg_jumultithumb/load/css.php index b85daa1..5d97acd 100644 --- a/packages/plg_jumultithumb/load/css.php +++ b/packages/plg_jumultithumb/load/css.php @@ -11,15 +11,17 @@ */ define('_JEXEC', 1); -define('JPATH_BASE', __DIR__ . "/../../../.."); -define("MAX_SIZE", "500"); +define('JPATH_BASE', __DIR__ . '/../../../..'); +define('MAX_SIZE', '500'); -require_once(JPATH_BASE . '/includes/defines.php'); -require_once(JPATH_BASE . '/includes/framework.php'); +require_once JPATH_BASE . '/includes/defines.php'; +require_once JPATH_BASE . '/includes/framework.php'; -$mainframe = JFactory::getApplication('administrator'); -$joomlaUser = JFactory::getUser(); -$lang = JFactory::getLanguage(); +use Joomla\CMS\Factory; + +$mainframe = Factory::getApplication('administrator'); +$joomlaUser = Factory::getUser(); +$lang = Factory::getLanguage(); $lang->load('plg_content_jumultithumb', JPATH_ADMINISTRATOR); $csslink = ' @@ -27,12 +29,12 @@ function alert($text, $error) { - if($error == 'message') + if($error === 'message') { $error = 'alert-info'; } - if($error == 'notice') + if($error === 'notice') { $error = 'alert-error'; } @@ -92,27 +94,24 @@ function alert($text, $error) if(!file_exists($style)) { - $file = fopen($style, 'w'); - fputs($file, $newcss); + $file = fopen($style, 'wb'); + fwrite($file, $newcss); fclose($file); $notice = alert(JText::_('PLG_JUMULTITHUMB_NOTICE1') . '
' . JText::_('PLG_JUMULTITHUMB_NOTICE2'), 'notice'); } -if(file_exists($style)) +if(file_exists($style) && !empty($_POST['txt'])) { - if(!empty($_POST['txt'])) - { - $file = fopen($style, 'w'); - fputs($file, $_POST['txt']); - fclose($file); - $notice = alert(JText::_('PLG_JUMULTITHUMB_NOTICE3'), 'message'); - } + $file = fopen($style, 'wb'); + fwrite($file, $_POST['txt']); + fclose($file); + $notice = alert(JText::_('PLG_JUMULTITHUMB_NOTICE3'), 'message'); } if(filesize($style) < 3) { - $file = fopen($style, 'w'); - fputs($file, $newcss); + $file = fopen($style, 'wb'); + fwrite($file, $newcss); fclose($file); $notice = alert(JText::_('PLG_JUMULTITHUMB_NOTICE4') . '
' . JText::_('PLG_JUMULTITHUMB_NOTICE5'), 'notice'); } @@ -140,14 +139,15 @@ function alert($text, $error) - +
- - - - + + diff --git a/packages/plg_jumultithumb/load/watermark/watermark.php b/packages/plg_jumultithumb/load/watermark/watermark.php index e5f201d..f77b13b 100644 --- a/packages/plg_jumultithumb/load/watermark/watermark.php +++ b/packages/plg_jumultithumb/load/watermark/watermark.php @@ -11,16 +11,17 @@ */ define('_JEXEC', 1); -define('JPATH_BASE', __DIR__ . "/../../../../.."); -define("MAX_SIZE", "500"); +define('JPATH_BASE', __DIR__ . '/../../../../..'); +define('MAX_SIZE', '500'); -require_once(JPATH_BASE . '/includes/defines.php'); -require_once(JPATH_BASE . '/includes/framework.php'); +require_once JPATH_BASE . '/includes/defines.php'; +require_once JPATH_BASE . '/includes/framework.php'; -$mainframe = JFactory::getApplication('administrator'); +use Joomla\CMS\Factory; -$joomlaUser = JFactory::getUser(); -$lang = JFactory::getLanguage(); +$app = Factory::getApplication('administrator'); +$joomlaUser = Factory::getUser(); +$lang = Factory::getLanguage(); $lang->load('plg_content_jumultithumb', JPATH_ADMINISTRATOR); /** @@ -29,16 +30,16 @@ * * @return string * - * @since 6.0 + * @since 7.0 */ function alert($text, $error) { - if($error == 'message') + if($error === 'message') { $error = 'alert-info'; } - if($error == 'notice') + if($error === 'notice') { $error = 'alert-error'; } @@ -51,21 +52,20 @@ function alert($text, $error) * * @return bool|string * - * @since 6.0 + * @since 7.0 */ function getExtension($str) { - $i = strrpos($str, "."); + $i = strrpos($str, '.'); if(!$i) { - return ""; + return ''; } - $l = strlen($str) - $i; - $ext = substr($str, $i + 1, $l); + $l = strlen($str) - $i; - return $ext; + return substr($str, $i + 1, $l); } $csslink = ''; @@ -83,86 +83,83 @@ function getExtension($str) } $errors = 0; -if(isset($_POST['Submit'])) +if(isset($_POST['Submit'], $_FILES['image']['name'])) { - if(isset($_FILES['image']['name'])) - { - $filename = stripslashes($_FILES['image']['name']); - $extension = getExtension($filename); - $extension = strtolower($extension); + $filename = stripslashes($_FILES['image']['name']); + $extension = getExtension($filename); + $extension = strtolower($extension); - if(($extension != "png")) + if($extension != 'png') + { + if(isset($_POST['watermark']) == 'big') + { + $unknownext = alert(JText::_('PLG_JUMULTITHUMB_NOTICE6'), 'notice'); + } + elseif(isset($_POST['watermark']) == 'small') + { + $unknownext_s = alert(JText::_('PLG_JUMULTITHUMB_NOTICE6'), 'notice'); + } + $errors = 1; + } + else + { + $size = $_FILES['image']['size']; + if($size > MAX_SIZE * 1000024) { if(isset($_POST['watermark']) == 'big') { - $unknownext = alert(JText::_('PLG_JUMULTITHUMB_NOTICE6'), 'notice'); + $limitimg = alert(JText::_('PLG_JUMULTITHUMB_NOTICE7'), 'notice'); } elseif(isset($_POST['watermark']) == 'small') { - $unknownext_s = alert(JText::_('PLG_JUMULTITHUMB_NOTICE6'), 'notice'); + $limitimg_s = alert(JText::_('PLG_JUMULTITHUMB_NOTICE7'), 'notice'); } + $errors = 1; } - else + + if($_POST['watermark'] == 'big') + { + $image_name = 'w.png'; + } + elseif($_POST['watermark'] == 'small') + { + $image_name = 'ws.png'; + } + + if(!($size > MAX_SIZE * 1000024)) { - $size = $_FILES['image']['size']; - if($size > MAX_SIZE * 1000024) + $newname = JPATH_SITE . '/plugins/content/jumultithumb/load/watermark/' . $image_name; + + if(!move_uploaded_file($_FILES['image']['tmp_name'], $newname)) { if(isset($_POST['watermark']) == 'big') { - $limitimg = alert(JText::_('PLG_JUMULTITHUMB_NOTICE7'), 'notice'); + $uploadunsuccessfull = alert(JText::_('PLG_JUMULTITHUMB_NOTICE8'), 'notice'); } elseif(isset($_POST['watermark']) == 'small') { - $limitimg_s = alert(JText::_('PLG_JUMULTITHUMB_NOTICE7'), 'notice'); + $uploadunsuccessfull_s = alert(JText::_('PLG_JUMULTITHUMB_NOTICE8'), 'notice'); } - $errors = 1; } - - if($_POST['watermark'] == 'big') - { - $image_name = 'w.png'; - } - elseif($_POST['watermark'] == 'small') - { - $image_name = 'ws.png'; - } - - if(!($size > MAX_SIZE * 1000024)) - { - $newname = JPATH_SITE . '/plugins/content/jumultithumb/load/watermark/' . $image_name; - - if(!move_uploaded_file($_FILES['image']['tmp_name'], $newname)) - { - if(isset($_POST['watermark']) == 'big') - { - $uploadunsuccessfull = alert(JText::_('PLG_JUMULTITHUMB_NOTICE8'), 'notice'); - } - elseif(isset($_POST['watermark']) == 'small') - { - $uploadunsuccessfull_s = alert(JText::_('PLG_JUMULTITHUMB_NOTICE8'), 'notice'); - } - $errors = 1; - } - } } } } if(isset($_POST['Submit']) && !$errors) { - if(isset($_POST['watermark']) == 'big') + if(isset($_POST['watermark']) === 'big') { $uploadsucess = alert(JText::_('PLG_JUMULTITHUMB_NOTICE9'), 'message'); } - elseif(isset($_POST['watermark']) == 'small') + elseif(isset($_POST['watermark']) === 'small') { $uploadsucess_s = alert(JText::_('PLG_JUMULTITHUMB_NOTICE9'), 'message'); } } -if(JRequest::getString('del') == 'big') +if($app->input->getCmd('del') === 'big') { if(is_file(JPATH_SITE . '/plugins/content/jumultithumb/load/watermark/w.png')) { @@ -174,7 +171,7 @@ function getExtension($str) $noticewb = alert(JText::_('PLG_JUMULTITHUMB_NOTICE11'), 'notice'); } } -elseif(JRequest::getString('del') == 'small') +elseif($app->input->getCmd('del') === 'small') { if(is_file(JPATH_SITE . '/plugins/content/jumultithumb/load/watermark/ws.png')) { diff --git a/packages/plg_jumultithumb/media/colorbox/style2/colorbox.css b/packages/plg_jumultithumb/media/colorbox/style2/colorbox.css index 208b8ee..a56b71b 100644 --- a/packages/plg_jumultithumb/media/colorbox/style2/colorbox.css +++ b/packages/plg_jumultithumb/media/colorbox/style2/colorbox.css @@ -37,14 +37,14 @@ /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */ #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;} - #cboxPrevious{background-position:0px 0px; right:44px;} - #cboxPrevious:hover{background-position:0px -25px;} - #cboxNext{background-position:-25px 0px; right:22px;} + #cboxPrevious{background-position:0 0; right:44px;} + #cboxPrevious:hover{background-position:0 -25px;} + #cboxNext{background-position:-25px 0; right:22px;} #cboxNext:hover{background-position:-25px -25px;} - #cboxClose{background-position:-50px 0px; right:0;} + #cboxClose{background-position:-50px 0; right:0;} #cboxClose:hover{background-position:-50px -25px;} .cboxSlideshow_on #cboxPrevious, .cboxSlideshow_off #cboxPrevious{right:66px;} .cboxSlideshow_on #cboxSlideshow{background-position:-75px -25px; right:44px;} .cboxSlideshow_on #cboxSlideshow:hover{background-position:-100px -25px;} - .cboxSlideshow_off #cboxSlideshow{background-position:-100px 0px; right:44px;} + .cboxSlideshow_off #cboxSlideshow{background-position:-100px 0; right:44px;} .cboxSlideshow_off #cboxSlideshow:hover{background-position:-75px -25px;} diff --git a/packages/plg_jumultithumb/media/colorbox/style3/colorbox.css b/packages/plg_jumultithumb/media/colorbox/style3/colorbox.css index 0bf753f..7dfcd9c 100644 --- a/packages/plg_jumultithumb/media/colorbox/style3/colorbox.css +++ b/packages/plg_jumultithumb/media/colorbox/style3/colorbox.css @@ -27,7 +27,7 @@ #cboxError{padding:50px; border:1px solid #ccc;} #cboxLoadedContent{border:5px solid #000; background:#fff;} #cboxTitle{position:absolute; top:-20px; left:0; color:#ccc;} - #cboxCurrent{position:absolute; top:-20px; right:0px; color:#ccc;} + #cboxCurrent{position:absolute; top:-20px; right:0; color:#ccc;} #cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;} /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */ diff --git a/packages/plg_jumultithumb/media/colorbox/style4/colorbox.css b/packages/plg_jumultithumb/media/colorbox/style4/colorbox.css index 523896a..63c5cc3 100644 --- a/packages/plg_jumultithumb/media/colorbox/style4/colorbox.css +++ b/packages/plg_jumultithumb/media/colorbox/style4/colorbox.css @@ -34,8 +34,8 @@ .cboxIframe{background:#fff;} #cboxError{padding:50px; border:1px solid #ccc;} #cboxLoadedContent{margin-bottom:20px;} - #cboxTitle{position:absolute; bottom:0px; left:0; text-align:center; width:100%; color:#999;} - #cboxCurrent{position:absolute; bottom:0px; left:100px; color:#999;} + #cboxTitle{position:absolute; bottom:0; left:0; text-align:center; width:100%; color:#999;} + #cboxCurrent{position:absolute; bottom:0; left:100px; color:#999;} #cboxLoadingOverlay{background:#fff url(images/loading.gif) no-repeat 5px 5px;} /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */ @@ -44,9 +44,9 @@ /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */ #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;} - #cboxSlideshow{position:absolute; bottom:0px; right:42px; color:#444;} - #cboxPrevious{position:absolute; bottom:0px; left:0; color:#444;} - #cboxNext{position:absolute; bottom:0px; left:63px; color:#444;} + #cboxSlideshow{position:absolute; bottom:0; right:42px; color:#444;} + #cboxPrevious{position:absolute; bottom:0; left:0; color:#444;} + #cboxNext{position:absolute; bottom:0; left:63px; color:#444;} #cboxClose{position:absolute; bottom:0; right:0; display:block; color:#444;} /* diff --git a/packages/plg_jumultithumb_contentform/jumultithumb_contentform.php b/packages/plg_jumultithumb_contentform/jumultithumb_contentform.php index c9600b8..8296907 100644 --- a/packages/plg_jumultithumb_contentform/jumultithumb_contentform.php +++ b/packages/plg_jumultithumb_contentform/jumultithumb_contentform.php @@ -21,6 +21,8 @@ class plgContentJUMultithumb_ContentForm extends JPlugin * * @param $subject * @param $config + * + * @since 7.0 */ public function __construct(& $subject, $config) { @@ -33,9 +35,9 @@ public function __construct(& $subject, $config) * * @return bool * - * @since 6.0 + * @since 7.0 */ - function onContentPrepareForm($form, $data) + public function onContentPrepareForm($form, $data) { if(!($form instanceof JForm)) { @@ -44,7 +46,7 @@ function onContentPrepareForm($form, $data) return false; } - if(in_array($form->getName(), array('com_content.article')) == false) + if($form->getName() !== 'com_content.article') { return true; } diff --git a/packages/plg_jumultithumb_contentform/jumultithumb_contentform.xml b/packages/plg_jumultithumb_contentform/jumultithumb_contentform.xml index c73b10e..b558b57 100644 --- a/packages/plg_jumultithumb_contentform/jumultithumb_contentform.xml +++ b/packages/plg_jumultithumb_contentform/jumultithumb_contentform.xml @@ -2,13 +2,13 @@ PLG_JUMULTITHUMB_CONTENTFORM Denys Nosov - 05.01.2018 + @date@ (C) 2007-2018 Denys Nosov. All rights reserved. http://creativecommons.org/licenses/by-nc-nd/3.0/ Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License denys@joomla-ua.org joomla-ua.org - 7.0.5 + @version@ JUMultiThumb Content Form diff --git a/packages/plg_jumultithumb_editorbutton/assets/jqueryFileTree.php b/packages/plg_jumultithumb_editorbutton/assets/jqueryFileTree.php index 0b7de44..e5d7865 100644 --- a/packages/plg_jumultithumb_editorbutton/assets/jqueryFileTree.php +++ b/packages/plg_jumultithumb_editorbutton/assets/jqueryFileTree.php @@ -27,7 +27,7 @@ header('Access-Control-Allow-Origin: *'); } -if(strtolower($_SERVER['REQUEST_METHOD']) == 'options') +if(strtolower($_SERVER['REQUEST_METHOD']) === 'options') { header('Access-Control-Allow-Methods: GET, POST, OPTIONS'); header('Access-Control-Allow-Headers: X-Requested-With, Accept'); @@ -40,23 +40,23 @@ if(file_exists($_POST['dir'])) { - $files = scandir($_POST['dir']); + $files = scandir($_POST['dir'], SCANDIR_SORT_NONE); natcasesort($files); if(count($files) > 2) { /* The 2 accounts for . and .. */ - echo "
    "; + echo '"; + echo '
'; } } \ No newline at end of file diff --git a/packages/plg_jumultithumb_editorbutton/form.php b/packages/plg_jumultithumb_editorbutton/form.php index 452843d..29dd6b7 100644 --- a/packages/plg_jumultithumb_editorbutton/form.php +++ b/packages/plg_jumultithumb_editorbutton/form.php @@ -12,23 +12,25 @@ define('_JEXEC', 1); define('DS', DIRECTORY_SEPARATOR); -define('JPATH_BASE', __DIR__ . "/../../.."); -define("MAX_SIZE", "500"); +define('JPATH_BASE', __DIR__ . '/../../..'); +define('MAX_SIZE', '500'); -require_once(JPATH_BASE . '/includes/defines.php'); -require_once(JPATH_BASE . '/includes/framework.php'); +require_once JPATH_BASE . '/includes/defines.php'; +require_once JPATH_BASE . '/includes/framework.php'; -$mainframe = JFactory::getApplication('administrator'); -$mainframe->initialise(); +use Joomla\CMS\Factory; -$joomlaUser = JFactory::getUser(); +$app = Factory::getApplication('administrator'); +$app->execute(); -$lang = JFactory::getLanguage(); +$joomlaUser = Factory::getUser(); + +$lang = Factory::getLanguage(); $lang->load('plg_content_jumultithumb', JPATH_ADMINISTRATOR); $language = mb_strtolower($lang->getTag()); -$doc = JFactory::getDocument(); +$doc = Factory::getDocument(); $doc->addStyleSheet('/media/jui/css/bootstrap.min.css'); diff --git a/packages/plg_jumultithumb_editorbutton/jumultithumb_editorbutton.php b/packages/plg_jumultithumb_editorbutton/jumultithumb_editorbutton.php index e4f5d16..201b1a5 100644 --- a/packages/plg_jumultithumb_editorbutton/jumultithumb_editorbutton.php +++ b/packages/plg_jumultithumb_editorbutton/jumultithumb_editorbutton.php @@ -23,7 +23,8 @@ class plgButtonJUmultithumb_EditorButton extends JPlugin * * @return bool|JObject * - * @since 6.0 + * @throws Exception + * @since 7.0 */ public function onDisplay($name, $asset, $author) { @@ -31,7 +32,10 @@ public function onDisplay($name, $asset, $author) $user = JFactory::getUser(); $extension = $app->input->get('option'); - if($asset == '') $asset = $extension; + if($asset == '') + { + $asset = $extension; + } if($user->authorise('core.edit', $asset) || $user->authorise('core.create', $asset) @@ -55,9 +59,7 @@ public function onDisplay($name, $asset, $author) return $button; } - else - { - return false; - } + + return false; } } \ No newline at end of file diff --git a/packages/plg_jumultithumb_editorbutton/jumultithumb_editorbutton.xml b/packages/plg_jumultithumb_editorbutton/jumultithumb_editorbutton.xml index 25f4918..6dec902 100644 --- a/packages/plg_jumultithumb_editorbutton/jumultithumb_editorbutton.xml +++ b/packages/plg_jumultithumb_editorbutton/jumultithumb_editorbutton.xml @@ -2,13 +2,13 @@ plg_jumultithumb_editorbutton Denys Nosov - 05.01.2018 + @date@ (C) 2007-2018 Denys Nosov. All rights reserved. http://creativecommons.org/licenses/by-nc-nd/3.0/ Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License denys@joomla-ua.org joomla-ua.org - 7.0.5 + @version@ PLG_JUMULTITHUMB_XML_DESCRIPTION jumultithumb_editorbutton.php diff --git a/packages/plg_jumultithumb_gallery/jumultithumb_gallery.php b/packages/plg_jumultithumb_gallery/jumultithumb_gallery.php index 871258a..5ccfb7a 100644 --- a/packages/plg_jumultithumb_gallery/jumultithumb_gallery.php +++ b/packages/plg_jumultithumb_gallery/jumultithumb_gallery.php @@ -12,33 +12,40 @@ defined('_JEXEC') or die; +use Joomla\CMS\Factory; + jimport('joomla.plugin.plugin'); jimport('joomla.filesystem.file'); -require_once(JPATH_SITE . '/plugins/content/jumultithumb/lib/links.php'); -require_once(JPATH_SITE . '/libraries/julib/image.php'); +require_once JPATH_SITE . '/plugins/content/jumultithumb/lib/links.php'; +require_once JPATH_SITE . '/libraries/julib/image.php'; class plgContentJUMULTITHUMB_Gallery extends JPlugin { - var $modeHelper; + public $modeHelper; /** * plgContentJUMULTITHUMB_Gallery constructor. * * @param $subject * @param $config + * + * @throws Exception + * @since 7.0 */ public function __construct(& $subject, $config) { parent::__construct($subject, $config); $this->loadLanguage(); - $option = JRequest::getCmd('option'); + $this->app = Factory::getApplication(); + + $option = $this->app->input->getCmd('option'); $adapter = JPATH_SITE . '/plugins/content/jumultithumb/adapters/' . $option . '.php'; if(JFile::exists($adapter)) { - require_once($adapter); + require_once $adapter; $mode_option = 'plgContentJUMultiThumb_' . $option; $this->modeHelper = new $mode_option($this); @@ -51,22 +58,21 @@ public function __construct(& $subject, $config) * @param $params * @param $limitstart * - * @return bool + * @return void * - * @since 6.0 + * @throws Exception + * @since 7.0 */ public function onContentBeforeDisplay($context, &$article, &$params, $limitstart) { - $app = JFactory::getApplication(); - - if($app->getName() != 'site') + if($this->app->getName() !== 'site') { - return true; + return; } if(!($this->modeHelper && $this->modeHelper->jView('Component'))) { - return true; + return; } if($this->modeHelper && $this->modeHelper->jView('Article')) @@ -90,13 +96,12 @@ public function onContentBeforeDisplay($context, &$article, &$params, $limitstar * * @return bool * - * @since 6.0 + * @throws Exception + * @since 7.0 */ public function onContentPrepare($context, &$article, &$params, $limitstart) { - $app = JFactory::getApplication(); - - if($app->getName() != 'site') + if($this->app->getName() !== 'site') { return true; } @@ -138,12 +143,11 @@ public function onContentPrepare($context, &$article, &$params, $limitstart) * * @return null|string|string[] * - * @since 6.0 + * @throws Exception + * @since 7.0 */ public function GalleryReplace($text, &$article) { - $app = JFactory::getApplication(); - $JUImg = new JUImg(); $regex = "/

\s*{gallery\s+(.*?)}\s*<\/p>/i"; @@ -151,7 +155,7 @@ public function GalleryReplace($text, &$article) if($matches) { - $Itemid = $app->input->getInt('Itemid'); + $Itemid = $this->app->input->getInt('Itemid'); $param = $this->params; $plugin = JPluginHelper::getPlugin('content', 'jumultithumb'); @@ -189,7 +193,7 @@ public function GalleryReplace($text, &$article) $matcheslist[3] = $gallstyle; } - if(in_array($Itemid, ($param->get('menu_item1')) ? $param->get('menu_item1') : array())) + if(in_array($Itemid, $param->get('menu_item1') ?: [])) { $maxsize_orignew = $param->get('maxsize_orignew1'); $newmaxwidth = $param->get('maxwidthnew1'); @@ -204,7 +208,7 @@ public function GalleryReplace($text, &$article) $a_watermarkgall_s = $param->get('watermark_gall_s1'); $a_watermarkgall = $param->get('watermark_gall1'); } - elseif(in_array($Itemid, ($param->get('menu_item2')) ? $param->get('menu_item2') : array())) + elseif(in_array($Itemid, $param->get('menu_item2') ?: [])) { $maxsize_orignew = $param->get('maxsize_orignew2'); $newmaxwidth = $param->get('maxwidthnew2'); @@ -219,7 +223,7 @@ public function GalleryReplace($text, &$article) $a_watermarkgall_s = $param->get('watermark_gall_s2'); $a_watermarkgall = $param->get('watermark_gall2'); } - elseif(in_array($Itemid, ($param->get('menu_item3')) ? $param->get('menu_item3') : array())) + elseif(in_array($Itemid, $param->get('menu_item3') ?: [])) { $maxsize_orignew = $param->get('maxsize_orignew3'); $newmaxwidth = $param->get('maxwidthnew3'); @@ -234,7 +238,7 @@ public function GalleryReplace($text, &$article) $a_watermarkgall_s = $param->get('watermark_gall_s3'); $a_watermarkgall = $param->get('watermark_gall3'); } - elseif(in_array($Itemid, ($param->get('menu_item4')) ? $param->get('menu_item4') : array())) + elseif(in_array($Itemid, $param->get('menu_item4') ?: [])) { $maxsize_orignew = $param->get('maxsize_orignew4'); $newmaxwidth = $param->get('maxwidthnew4'); @@ -249,7 +253,7 @@ public function GalleryReplace($text, &$article) $a_watermarkgall_s = $param->get('watermark_gall_s4'); $a_watermarkgall = $param->get('watermark_gall4'); } - elseif(in_array($Itemid, ($param->get('menu_item5')) ? $param->get('menu_item5') : array())) + elseif(in_array($Itemid, $param->get('menu_item5') ?: [])) { $maxsize_orignew = $param->get('maxsize_orignew5'); $newmaxwidth = $param->get('maxwidthnew5'); @@ -289,7 +293,7 @@ public function GalleryReplace($text, &$article) $img_cache = $param->get('img_cache'); - $img_title = preg_replace("/\"/", "'", $article->title); + $img_title = preg_replace('/"/', "'", $article->title); $lightbox = $param->get('selectlightbox'); @@ -301,70 +305,70 @@ public function GalleryReplace($text, &$article) $html = ''; if(is_dir($img_folder)) { - $images = glob($img_folder . "/{*.[jJ][pP][gG],*.[jJ][pP][eE][gG],*.[gG][iI][fF],*.[pP][nN][gG],*.[bB][mM][pP],*.[tT][iI][fF],*.[tT][iI][fF][fF]}", GLOB_BRACE); + $images = glob($img_folder . '/{*.[jJ][pP][gG],*.[jJ][pP][eE][gG],*.[gG][iI][fF],*.[pP][nN][gG],*.[bB][mM][pP],*.[tT][iI][fF],*.[tT][iI][fF][fF]}', GLOB_BRACE); $images = str_replace($root, '', $images); - $_gallery = array(); + $_gallery = []; foreach ($images as $file) { switch ($json->thumb_filtercolor) { case '1': - $imp_filtercolor = array('fltr_1' => 'gray'); + $imp_filtercolor = ['fltr_1' => 'gray']; break; case '2': - $imp_filtercolor = array('fltr_1' => 'sep'); + $imp_filtercolor = ['fltr_1' => 'sep']; break; case '3': - $imp_filtercolor = array('fltr_1' => 'th|' . $json->thumb_th_seting); + $imp_filtercolor = ['fltr_1' => 'th|' . $json->thumb_th_seting]; break; case '4': - $imp_filtercolor = array('fltr_1' => 'clr|' . $json->colorized . '|' . str_replace('#', '', $json->colorpicker)); + $imp_filtercolor = ['fltr_1' => 'clr|' . $json->colorized . '|' . str_replace('#', '', $json->colorpicker)]; break; default: - $imp_filtercolor = array(); + $imp_filtercolor = []; break; } - $usm_filtercolor = array(); + $usm_filtercolor = []; if($json->thumb_unsharp == 1) { - $usm_filtercolor = array('fltr_2' => 'usm|' . $json->thumb_unsharp_amount . '|' . $json->thumb_unsharp_radius . '|' . $json->thumb_unsharp_threshold); + $usm_filtercolor = ['fltr_2' => 'usm|' . $json->thumb_unsharp_amount . '|' . $json->thumb_unsharp_radius . '|' . $json->thumb_unsharp_threshold]; } - $blur_filtercolor = array(); + $blur_filtercolor = []; if($json->thumb_blur == 1) { - $blur_filtercolor = array('fltr_3' => 'blur|' . $json->thumb_blur_seting); + $blur_filtercolor = ['fltr_3' => 'blur|' . $json->thumb_blur_seting]; } - $brit_filtercolor = array(); + $brit_filtercolor = []; if($json->thumb_brit == 1) { - $brit_filtercolor = array('fltr_4' => 'brit|' . $json->thumb_brit_seting); + $brit_filtercolor = ['fltr_4' => 'brit|' . $json->thumb_brit_seting]; } - $cont_filtercolor = array(); + $cont_filtercolor = []; if($json->thumb_cont == 1) { - $cont_filtercolor = array('fltr_5' => 'cont|' . $json->thumb_cont_seting); + $cont_filtercolor = ['fltr_5' => 'cont|' . $json->thumb_cont_seting]; } if(!($this->modeHelper && $this->modeHelper->jView('Article')) && ($param->get('useimgagegallery') == '1')) { $_title = mb_strtoupper(mb_substr($img_title, 0, 1)) . mb_substr($img_title, 1); - $imgparams = array( + $imgparams = [ 'w' => $param->get('width'), 'h' => $param->get('height'), 'aoe' => '1', 'zc' => $param->get('cropzoom'), 'cache' => $img_cache - ); + ]; $_imgparams = array_merge( $imp_filtercolor, @@ -402,12 +406,12 @@ public function GalleryReplace($text, &$article) $imgsource = $file; if($watermark_gallery == '1' || $a_watermarkgall == '1') { - $link_imgparams = array( - 'w' => ($param->get('maxsize_orignew') == '1' ? $newmaxwidth : ''), - 'h' => ($param->get('maxsize_orignew') == '1' ? $newmaxheight : ''), - 'fltr' => ($wmi != '' ? $wmi : ''), + $link_imgparams = [ + 'w' => $param->get('maxsize_orignew') == '1' ? $newmaxwidth : '', + 'h' => $param->get('maxsize_orignew') == '1' ? $newmaxheight : '', + 'fltr' => $wmi != '' ? $wmi : '', 'cache' => $img_cache - ); + ]; $_link_imgparams = array_merge( $imp_filtercolor, @@ -438,14 +442,14 @@ public function GalleryReplace($text, &$article) $wmi_s = 'wmi|' . $watermark_s . '|' . $param->get('wmposition_s') . '|' . $param->get('wmopst_s') . '|' . $param->get('wmx_s') . '|' . $param->get('wmy_s'); } - $imgparams = array( - 'fltr' => ($wmi_s != '' ? $wmi_s : ''), + $imgparams = [ + 'fltr' => $wmi_s != '' ? $wmi_s : '', 'w' => $gallwidth, 'h' => $gallheight, 'aoe' => '1', 'zc' => $gallcropzoom, 'cache' => $img_cache - ); + ]; $_imgparams = array_merge( $imp_filtercolor, @@ -466,8 +470,7 @@ public function GalleryReplace($text, &$article) $gallery = implode($_gallery); - $app = JFactory::getApplication(); - $template = $app->getTemplate(); + $template = $this->app->getTemplate(); $tmpl = $this->getTmpl($template, 'gallery'); ob_start(); @@ -497,12 +500,12 @@ public function GalleryReplace($text, &$article) * * @return string * - * @since 6.0 + * @throws Exception + * @since 7.0 */ public function _image($_img, $_w, $_h, $_class = null, $_alt = null, $_caption = null, $_title = null, $_link_img = null, $_orig_img = null, $_lightbox = null) { - $app = JFactory::getApplication(); - $template = $app->getTemplate(); + $template = $this->app->getTemplate(); switch ($_lightbox) { @@ -542,7 +545,7 @@ public function _image($_img, $_w, $_h, $_class = null, $_alt = null, $_caption * * @return string * - * @since 6.0 + * @since 7.0 */ public function getTmpl($template, $name) { diff --git a/packages/plg_jumultithumb_gallery/jumultithumb_gallery.xml b/packages/plg_jumultithumb_gallery/jumultithumb_gallery.xml index 1ba21e4..a1ee89f 100644 --- a/packages/plg_jumultithumb_gallery/jumultithumb_gallery.xml +++ b/packages/plg_jumultithumb_gallery/jumultithumb_gallery.xml @@ -2,13 +2,13 @@ PLG_JUMULTITHUMB_GALLERY Denys Nosov - 05.01.2018 + @date@ (C) 2007-2018 Denys Nosov. All rights reserved. http://creativecommons.org/licenses/by-nc-nd/3.0/ Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License denys@joomla-ua.org joomla-ua.org - 7.0.5 + @version@ PLG_JUMULTITHUMB_XML_DESCRIPTION diff --git a/pkg_jumultithumb.xml b/pkg_jumultithumb.xml index 7255066..b7d33fc 100644 --- a/pkg_jumultithumb.xml +++ b/pkg_jumultithumb.xml @@ -2,16 +2,15 @@ PLG_JUMULTITHUMB jumultithumb - 05.01.2018 + @date@ Joomla! Ukraine (C) 2007-2018 Denys Nosov, Joomla! Ukraine https://joomla-ua.org Denys Nosov, Joomla! Ukraine denys@joomla-ua.org https://joomla-ua.org - 7.0.5 - GNU/GPL Version 2 or later and Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License - + @version@ + GNU/GPL Version 2 or later and Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License PLG_JUMULTITHUMB_XML_DESCRIPTION script.php https://joomla-ua.org/update/plg/jumultithumb.xml @@ -24,7 +23,7 @@ plg_jumultithumb_contentform.zip plg_jumultithumb_gallery.zip plg_jumultithumb_editorbutton.zip - lib_julib.zip + lib_julib_v@julib@.zip en-GB/en-GB.pkg_jumultithumb.ini diff --git a/script.php b/script.php index 3b6fdaa..7d7479e 100644 --- a/script.php +++ b/script.php @@ -10,6 +10,8 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ +use Joomla\CMS\Factory; + jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); jimport('joomla.filesystem.archive'); @@ -18,7 +20,7 @@ class Pkg_JUMultiThumbInstallerScript { - protected $dbSupport = array('mysql', 'mysqli', 'postgresql', 'sqlsrv', 'sqlazure'); + protected $dbSupport = ['mysql', 'mysqli', 'postgresql', 'sqlsrv', 'sqlazure']; protected $message; protected $status; protected $sourcePath; @@ -29,7 +31,8 @@ class Pkg_JUMultiThumbInstallerScript * * @return bool * - * @since 6.0 + * @throws Exception + * @since 7.0 */ public function preflight($type, $parent) { @@ -43,7 +46,7 @@ public function preflight($type, $parent) $lang = JFactory::getLanguage(); $lang->load('plg_content_jumultithumb', JPATH_ADMINISTRATOR); - if(!in_array(JFactory::getDbo()->name, $this->dbSupport)) + if(!in_array(JFactory::getDbo()->name, $this->dbSupport, true)) { JFactory::getApplication()->enqueueMessage(JText::_('PLG_JUMULTITHUMB_ERROR_DB_SUPPORT'), 'error'); @@ -69,17 +72,17 @@ public function preflight($type, $parent) * * @return bool * - * @since 6.0 + * @since 7.0 */ public function MakeDirectory($dir, $mode) { - if(is_dir($dir) || @mkdir($dir, $mode)) + if(mkdir($dir, $mode) || is_dir($dir)) { $indexfile = $dir . '/index.html'; if(!file_exists($indexfile)) { - $file = fopen($indexfile, 'w'); - fputs($file, ''); + $file = fopen($indexfile, 'wb'); + fwrite($file, ''); fclose($file); } @@ -106,35 +109,30 @@ public function update($parent) public function postflight($type, $parent, $results) { - $enabled = array(); - $newalert = ''; + $enabled = []; $db = JFactory::getDbo(); $query = $db->getQuery(true); - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $version = new JVersion; $joomla = substr($version->getShortVersion(), 0, 3); - $qv = $db->getQuery(true); $qv = 'UPDATE `#__extensions` SET `enabled` = 1, `ordering` = -100 WHERE `element` = ' . $db->Quote('jumultithumb') . ' AND `type` = ' . $db->Quote('plugin') . ' AND `client_id` = 0'; $db->setQuery($qv); - $db->query(); + $db->execute(); - $qv = $db->getQuery(true); $qv = 'UPDATE `#__extensions` SET `enabled` = 1, `ordering` = -99 WHERE `element` = ' . $db->Quote('jumultithumb_gallery') . ' AND `type` = ' . $db->Quote('plugin') . ' AND `client_id` = 0'; $db->setQuery($qv); - $db->query(); + $db->execute(); - $qv = $db->getQuery(true); $qv = 'UPDATE `#__extensions` SET `enabled` = 1 WHERE `element` = ' . $db->Quote('jumultithumb_editorbutton') . ' AND `type` = ' . $db->Quote('plugin') . ' AND `client_id` = 0'; $db->setQuery($qv); - $db->query(); + $db->execute(); - $qv = $db->getQuery(true); $qv = 'UPDATE `#__extensions` SET `enabled` = 1 WHERE `element` = ' . $db->Quote('jumultithumb_contentform') . ' AND `type` = ' . $db->Quote('plugin') . ' AND `client_id` = 0'; $db->setQuery($qv); - $db->query(); + $db->execute(); foreach ($results as $result) { @@ -239,28 +237,34 @@ public function postflight($type, $parent, $results) $path = JPATH_SITE . '/plugins/content/jumultithumb/'; - $files = array( + $files = [ $path . 'assets/jumultithumb.jpg', $path . 'assets/close.png', $path . 'assets/toggler.js', $path . 'assets/script.js', $path . 'assets/style.css' - ); + ]; - $folders = array( + $folders = [ $path . 'img' - ); + ]; $i = 0; foreach ($files AS $file) { - if(file_exists($file)) $i++; + if(file_exists($file)) + { + $i++; + } } $j = 0; foreach ($folders AS $folder) { - if(is_dir($folder)) $j++; + if(is_dir($folder)) + { + $j++; + } } if(($i + $j) > 0) @@ -325,7 +329,8 @@ public function postflight($type, $parent, $results) * @param $deleteRootToo * * - * @since 6.0 + * @since 7.0 + * @return string|void */ public function unlinkRecursive($dir, $deleteRootToo) { @@ -336,7 +341,7 @@ public function unlinkRecursive($dir, $deleteRootToo) while (false !== ($obj = readdir($dh))) { - if($obj == '.' || $obj == '..') + if($obj === '.' || $obj === '..') { continue; } @@ -349,7 +354,10 @@ public function unlinkRecursive($dir, $deleteRootToo) closedir($dh); - if($deleteRootToo) @rmdir($dir); + if($deleteRootToo) + { + @rmdir($dir); + } return; }