Skip to content

Commit

Permalink
Update to 7.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
denysdesign committed Dec 4, 2017
1 parent 65ff710 commit 14d5a26
Show file tree
Hide file tree
Showing 16 changed files with 614 additions and 316 deletions.
28 changes: 27 additions & 1 deletion packages/plg_jumultithumb/adapters/com_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,23 @@ class plgContentJUMultiThumb_com_content
{
var $plugin;

/**
* plgContentJUMultiThumb_com_content constructor.
*
* @param $plugin
*/
public function __construct(&$plugin)
{
$this->plugin = &$plugin;
}

/**
* @param $jlayout
*
* @return bool
*
* @since 6.0
*/
public function jView($jlayout)
{
$app = JFactory::getApplication();
Expand All @@ -35,24 +47,31 @@ public function jView($jlayout)
case 'Component':
return ($option == 'com_content');
break;

case 'CatBlog':
return (($view == 'category' && ($layout == 'blog')) || ($view == 'category' && ($layout == 'card')));
break;

case 'Blog':
return ($layout == 'blog');
break;

case 'Category':
return ($view == 'categories' && !($layout));
break;

case 'Categories':
return ($view == 'categories');
break;

case 'Featured':
return ($view == 'featured');
break;

case 'Print':
return ($print == '1');
break;

case 'Article':
return ($view == 'article');
break;
Expand All @@ -61,9 +80,16 @@ public function jView($jlayout)
return true;
}

/**
* @param $article
*
* @return JURI
*
* @since 6.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'))
{
Expand Down
6 changes: 6 additions & 0 deletions packages/plg_jumultithumb/fields/css.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ class JFormFieldModal_CSS extends JFormField
{
protected $type = 'Modal_CSS';

/**
*
* @return string
*
* @since 6.0
*/
protected function getInput()
{
JHtml::_('behavior.modal', 'a.modal');
Expand Down
6 changes: 6 additions & 0 deletions packages/plg_jumultithumb/fields/csscode.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ class JFormFieldCSSCode extends JFormField
{
protected $type = 'CSSCode';

/**
*
* @return string
*
* @since 6.0
*/
protected function getInput()
{
return '<textarea style="width: 350px; height: 250px;" id="css_source" readonly>img[style $=\'width\'] {
Expand Down
6 changes: 3 additions & 3 deletions packages/plg_jumultithumb/fields/head.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

defined('JPATH_BASE') or die;

$doc = JFactory::getDocument();
$doc = JFactory::getDocument();
$adm_url = str_replace('/administrator', '', JURI::base());

$doc->addStyleSheet( $adm_url . 'plugins/content/jumultithumb/assets/css/jumultithumb.css?v=2' );
$doc->addStyleSheet($adm_url . 'plugins/content/jumultithumb/assets/css/jumultithumb.css?v=2');

$snipets = '
jQuery.noConflict();
Expand All @@ -30,4 +30,4 @@

JHtml::_('jquery.framework');

$doc->addScriptDeclaration( $snipets );
$doc->addScriptDeclaration($snipets);
6 changes: 6 additions & 0 deletions packages/plg_jumultithumb/fields/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ class JFormFieldModal_Upload extends JFormField
{
protected $type = 'Modal_Upload';

/**
*
* @return string
*
* @since 6.0
*/
protected function getInput()
{
JHtml::_('behavior.modal', 'a.modal');
Expand Down
162 changes: 120 additions & 42 deletions packages/plg_jumultithumb/jumultithumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ class plgContentjumultithumb extends JPlugin
{
var $modeHelper;

/**
* plgContentjumultithumb constructor.
*
* @param $subject
* @param $config
*/
public function __construct(& $subject, $config)
{
parent::__construct($subject, $config);
Expand All @@ -38,6 +44,16 @@ public function __construct(& $subject, $config)
}
}

/**
* @param $context
* @param $article
* @param $params
* @param $limitstart
*
* @return bool
*
* @since 6.0
*/
public function onContentBeforeDisplay($context, &$article, &$params, $limitstart)
{
$app = JFactory::getApplication();
Expand Down Expand Up @@ -68,6 +84,16 @@ public function onContentBeforeDisplay($context, &$article, &$params, $limitstar
return true;
}

/**
* @param $context
* @param $article
* @param $params
* @param $limitstart
*
* @return bool
*
* @since 6.0
*/
public function onContentPrepare($context, &$article, &$params, $limitstart)
{
$app = JFactory::getApplication();
Expand Down Expand Up @@ -98,6 +124,15 @@ public function onContentPrepare($context, &$article, &$params, $limitstart)
return true;
}

/**
* @param $text
* @param $article
* @param int $use_wm
*
* @return mixed|null|string|string[]
*
* @since 6.0
*/
public function ImgReplace($text, &$article, $use_wm = 1)
{
$param = $this->params;
Expand Down Expand Up @@ -144,6 +179,16 @@ public function ImgReplace($text, &$article, $use_wm = 1)
return $text;
}

/**
* @param $_img
* @param $article
* @param $watermark_o
* @param $watermark_s
*
* @return string
*
* @since 6.0
*/
public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_s)
{
$app = JFactory::getApplication();
Expand Down Expand Up @@ -275,6 +320,7 @@ 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" ||
Expand Down Expand Up @@ -703,9 +749,9 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_
}
}

if($newnoresize == '1' || $cat_newnoresize == '1')
if($newnoresize == '1') // || $cat_newnoresize == '1'
{
$juimgresmatche = str_replace(array(' /', JURI::base()), '', $juimgresmatche);
$juimgresmatche = str_replace(array(' /', JURI::base()), '', $originalsource);
$limage = $this->_image(JURI::base() . $juimgresmatche, $newmaxwidth, $newmaxheight, $img_class, $img_alt, 1, 1);

return $limage;
Expand Down Expand Up @@ -744,16 +790,8 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_
$param->get('cat_newmaxsize_orig') == '1'
)
{
if($this->modeHelper && $this->modeHelper->jView('Article'))
{
$_width = $newmaxwidth;
$_height = $newmaxheight;
}
else
{
$_width = $cat_newmaxwidth;
$_height = $cat_newmaxheight;
}
$_width = $newmaxwidth;
$_height = $newmaxheight;
}

if(
Expand Down Expand Up @@ -882,8 +920,7 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_

$thumb_img = $JUImg->Render($imgsource, $_imgparams);

if($_image_noresize == '1' || $cat_newnofullimg == '1' || $newnofullimg == '1' ||
$cat_newnofullimg == '1' || ($this->modeHelper && $this->modeHelper->jView('Print'))
if($_image_noresize == '1' || $newnofullimg == '1' || ($this->modeHelper && $this->modeHelper->jView('Print'))
)
{
$limage = $this->_image($thumb_img, $newwidth, $newheight, $img_class, $img_alt, 1, $_image_noresize, $img_title);
Expand Down Expand Up @@ -929,7 +966,7 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_
);
}

if($b_newfarcrop == '1')
if($f_newfarcrop == '1')
{
$new_imgparams = array(
'far' => $f_newfarcrop_params,
Expand Down Expand Up @@ -965,33 +1002,23 @@ public function JUMultithumbReplacer($_img, &$article, $watermark_o, $watermark_
return $limage;
}

public static function _aspect($html, $_cropaspect)
{
$size = getimagesize(rawurldecode(JPATH_SITE . '/' . $html));
$width = $size[0];
$height = $size[1] * ($_cropaspect != '' ? $_cropaspect : '0');
$aspect = $height / $width;

return $aspect;
}

public function getTmpl($template, $name)
{

$search = JPATH_SITE . '/templates/' . $template . '/html/plg_jumultithumb/' . $name . '.php';

if(is_file($search))
{
$tmpl = $search;
}
else
{
$tmpl = JPATH_SITE . '/plugins/content/jumultithumb/tmpl/' . $name . '.php';
}

return $tmpl;
}

/**
* @param $_img
* @param $_w
* @param $_h
* @param null $_class
* @param null $_alt
* @param null $_caption
* @param null $_noresize
* @param null $_title
* @param null $_link_img
* @param null $_orig_img
* @param null $_lightbox
*
* @return string
*
* @since 6.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();
Expand All @@ -1002,9 +1029,11 @@ public function _image($_img, $_w, $_h, $_class = null, $_alt = null, $_caption
case 'lightgallery':
$lightbox = ' ' . ($_link_img ? 'data-src="' . JURI::base() . $_link_img . '"' : '') . ' ' . ($_orig_img ? 'data-download-url="' . JURI::base() . $_orig_img . '"' : '');
break;

case 'colorbox':
$lightbox = ' class="lightbox" rel="lightbox[gall]"';
break;

default:
case 'jmodal':
$lightbox = ' class="modal" rel="{handler: \'image\', marginImage: {x: 50, y: 50}}"';
Expand All @@ -1021,6 +1050,55 @@ public function _image($_img, $_w, $_h, $_class = null, $_alt = null, $_caption
return $img;
}

/**
* @param $template
* @param $name
*
* @return string
*
* @since 6.0
*/
public function getTmpl($template, $name)
{

$search = JPATH_SITE . '/templates/' . $template . '/html/plg_jumultithumb/' . $name . '.php';

if(is_file($search))
{
$tmpl = $search;
}
else
{
$tmpl = JPATH_SITE . '/plugins/content/jumultithumb/tmpl/' . $name . '.php';
}

return $tmpl;
}

/**
* @param $html
* @param $_cropaspect
*
* @return float|int
*
* @since 6.0
*/
public static 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 bool
*
* @since 6.0
*/
public function onBeforeCompileHead()
{
$app = JFactory::getApplication();
Expand Down
Loading

0 comments on commit 14d5a26

Please sign in to comment.