';
}
- } 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)
-
+