From 14d5a26a2a15a946e79cebf63fa0aa8547bca37d Mon Sep 17 00:00:00 2001 From: Denys N Date: Mon, 4 Dec 2017 05:17:35 +0200 Subject: [PATCH] Update to 7.0.2 --- .../plg_jumultithumb/adapters/com_content.php | 28 ++- packages/plg_jumultithumb/fields/css.php | 6 + packages/plg_jumultithumb/fields/csscode.php | 6 + packages/plg_jumultithumb/fields/head.php | 6 +- packages/plg_jumultithumb/fields/upload.php | 6 + packages/plg_jumultithumb/jumultithumb.php | 162 ++++++++---- packages/plg_jumultithumb/lib/links.php | 48 +++- packages/plg_jumultithumb/load/css.php | 136 +++++----- .../load/watermark/watermark.php | 49 +++- packages/plg_jumultithumb/tmpl/default.php | 4 +- .../jumultithumb_contentform.php | 22 +- .../plg_jumultithumb_editorbutton/form.php | 237 +++++++++--------- .../jumultithumb_editorbutton.php | 45 ++-- .../jumultithumb_gallery.php | 103 ++++++-- pkg_jumultithumb.xml | 4 +- script.php | 68 +++-- 16 files changed, 614 insertions(+), 316 deletions(-) diff --git a/packages/plg_jumultithumb/adapters/com_content.php b/packages/plg_jumultithumb/adapters/com_content.php index bfb2adc..bd66957 100644 --- a/packages/plg_jumultithumb/adapters/com_content.php +++ b/packages/plg_jumultithumb/adapters/com_content.php @@ -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(); @@ -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; @@ -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')) { diff --git a/packages/plg_jumultithumb/fields/css.php b/packages/plg_jumultithumb/fields/css.php index 446223d..fb31628 100644 --- a/packages/plg_jumultithumb/fields/css.php +++ b/packages/plg_jumultithumb/fields/css.php @@ -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'); diff --git a/packages/plg_jumultithumb/fields/csscode.php b/packages/plg_jumultithumb/fields/csscode.php index b8919b0..cde6b9b 100644 --- a/packages/plg_jumultithumb/fields/csscode.php +++ b/packages/plg_jumultithumb/fields/csscode.php @@ -18,6 +18,12 @@ class JFormFieldCSSCode extends JFormField { protected $type = 'CSSCode'; + /** + * + * @return string + * + * @since 6.0 + */ protected function getInput() { return ' - - + + + + + + + +
+ + + + + + + +
+ \ No newline at end of file diff --git a/packages/plg_jumultithumb/load/watermark/watermark.php b/packages/plg_jumultithumb/load/watermark/watermark.php index d991292..2464bb7 100644 --- a/packages/plg_jumultithumb/load/watermark/watermark.php +++ b/packages/plg_jumultithumb/load/watermark/watermark.php @@ -16,7 +16,6 @@ require_once(JPATH_BASE . '/includes/defines.php'); require_once(JPATH_BASE . '/includes/framework.php'); -require_once(JPATH_BASE . '/libraries/joomla/factory.php'); $mainframe = JFactory::getApplication('administrator'); @@ -24,6 +23,14 @@ $lang = JFactory::getLanguage(); $lang->load('plg_content_jumultithumb', JPATH_ADMINISTRATOR); +/** + * @param $text + * @param $error + * + * @return string + * + * @since 6.0 + */ function alert($text, $error) { if($error == 'message') @@ -39,6 +46,25 @@ function alert($text, $error) return '
' . $text . '
'; } +/** + * @param $str + * + * @return bool|string + * + * @since 6.0 + */ +function getExtension($str) +{ + $i = strrpos($str, "."); + + if(!$i) return ""; + + $l = strlen($str) - $i; + $ext = substr($str, $i + 1, $l); + + return $ext; +} + $csslink = ''; if($joomlaUser->get('id') < 1) @@ -53,18 +79,6 @@ function alert($text, $error) return; } -function getExtension($str) -{ - $i = strrpos($str, "."); - - if(!$i) return ""; - - $l = strlen($str) - $i; - $ext = substr($str, $i + 1, $l); - - return $ext; -} - $errors = 0; if(isset($_POST['Submit'])) { @@ -204,38 +218,47 @@ function getExtension($str) { echo $noticewb; } + if(isset($noticews)) { echo $noticews; } + if(isset($uploadsucess)) { echo $uploadsucess; } + if(isset($unknownext)) { echo $unknownext; } + if(isset($limitimg)) { echo $limitimg; } + if(isset($uploadunsuccessfull)) { echo $uploadunsuccessfull; } + if(isset($uploadsucess_s)) { echo $uploadsucess_s; } + if(isset($unknownext_s)) { echo $unknownext_s; } + if(isset($limitimg_s)) { echo $limitimg_s; } + if(isset($uploadunsuccessfull_s)) { echo $uploadunsuccessfull_s; diff --git a/packages/plg_jumultithumb/tmpl/default.php b/packages/plg_jumultithumb/tmpl/default.php index c9357a5..4c08a02 100644 --- a/packages/plg_jumultithumb/tmpl/default.php +++ b/packages/plg_jumultithumb/tmpl/default.php @@ -37,7 +37,7 @@ class="" itemprop="image" itemscope itemtype="https://schema.org/ImageObject" > - + > @@ -64,7 +64,7 @@ class="" - + diff --git a/packages/plg_jumultithumb_contentform/jumultithumb_contentform.php b/packages/plg_jumultithumb_contentform/jumultithumb_contentform.php index 7f12a32..f22c341 100644 --- a/packages/plg_jumultithumb_contentform/jumultithumb_contentform.php +++ b/packages/plg_jumultithumb_contentform/jumultithumb_contentform.php @@ -16,21 +16,35 @@ class plgContentJUMultithumb_ContentForm extends JPlugin { + /** + * plgContentJUMultithumb_ContentForm constructor. + * + * @param $subject + * @param $config + */ public function __construct(& $subject, $config) - { + { parent::__construct($subject, $config); } + /** + * @param $form + * @param $data + * + * @return bool + * + * @since 6.0 + */ function onContentPrepareForm($form, $data) { - if (!($form instanceof JForm)) + if(!($form instanceof JForm)) { $this->_subject->setError('JERROR_NOT_A_FORM'); - + return false; } - if (in_array($form->getName(), array('com_content.article'))==false) return true; + if(in_array($form->getName(), array('com_content.article')) == false) return true; JForm::addFormPath(__DIR__ . '/forms'); diff --git a/packages/plg_jumultithumb_editorbutton/form.php b/packages/plg_jumultithumb_editorbutton/form.php index e6ba4e7..cda3c54 100644 --- a/packages/plg_jumultithumb_editorbutton/form.php +++ b/packages/plg_jumultithumb_editorbutton/form.php @@ -10,14 +10,13 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -define( '_JEXEC', 1 ); +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 .'/libraries/joomla/factory.php' ); +require_once(JPATH_BASE . '/includes/defines.php'); +require_once(JPATH_BASE . '/includes/framework.php'); $mainframe = JFactory::getApplication('administrator'); $mainframe->initialise(); @@ -33,122 +32,128 @@ $doc->addStyleSheet('/media/jui/css/bootstrap.min.css'); -if ($joomlaUser->get('id') < 1) { -?> - - - - - - - -
-
-
-
    -
  • -
-
-
- - -get('id') < 1) +{ + ?> + + + + + + + +
+
+
+
    +
  • +
+
+
+ + + params); +$json = json_decode($plugin->params); + +$rootfolder = 'images/' . $json->galleryfolder . '/'; -$rootfolder = 'images/'.$json->galleryfolder.'/'; ?> - - <?php echo JText::_('PLG_JUMULTITHUMB_GALLERY_INSERT_TAG'); ?> - - - - - - - - - - - -
-
- -
-

- -
-
-
- -
- -
-
-
- -
- -
-
-
-
- -
-
-
- + + <?php echo JText::_('PLG_JUMULTITHUMB_GALLERY_INSERT_TAG'); ?> + + + + + + + + + + + +
+
+ +
+
+
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/packages/plg_jumultithumb_editorbutton/jumultithumb_editorbutton.php b/packages/plg_jumultithumb_editorbutton/jumultithumb_editorbutton.php index 0a0241c..3024d04 100644 --- a/packages/plg_jumultithumb_editorbutton/jumultithumb_editorbutton.php +++ b/packages/plg_jumultithumb_editorbutton/jumultithumb_editorbutton.php @@ -16,36 +16,47 @@ class plgButtonJUmultithumb_EditorButton extends JPlugin { protected $autoloadLanguage = true; + /** + * @param $name + * @param $asset + * @param $author + * + * @return bool|JObject + * + * @since 6.0 + */ public function onDisplay($name, $asset, $author) { - $app = JFactory::getApplication(); - $user = JFactory::getUser(); + $app = JFactory::getApplication(); + $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) - || (count($user->getAuthorisedCategories($asset, 'core.create')) > 0) - || ($user->authorise('core.edit.own', $asset) && $author == $user->id) - || (count($user->getAuthorisedCategories($extension, 'core.edit')) > 0) - || (count($user->getAuthorisedCategories($extension, 'core.edit.own')) > 0 && $author == $user->id) - ) { + if($user->authorise('core.edit', $asset) + || $user->authorise('core.create', $asset) + || (count($user->getAuthorisedCategories($asset, 'core.create')) > 0) + || ($user->authorise('core.edit.own', $asset) && $author == $user->id) + || (count($user->getAuthorisedCategories($extension, 'core.edit')) > 0) + || (count($user->getAuthorisedCategories($extension, 'core.edit.own')) > 0 && $author == $user->id) + ) + { $link = '../plugins/editors-xtd/jumultithumb_editorbutton/form.php'; JHtml::_('behavior.modal'); $button = new JObject; - - $button->modal = true; - $button->class = 'btn'; - $button->link = $link; - $button->text = JText::_('PLG_JUMULTITHUMB').' - '.JText::_('COM_PLUGINS_GALLERY_FIELDSET_LABEL'); - $button->name = 'image'; + + $button->modal = true; + $button->class = 'btn'; + $button->link = $link; + $button->text = JText::_('PLG_JUMULTITHUMB') . ' - ' . JText::_('COM_PLUGINS_GALLERY_FIELDSET_LABEL'); + $button->name = 'image'; $button->options = "{handler: 'iframe', size: {x: 670, y: 500}}"; return $button; } - else { + else + { return false; } } diff --git a/packages/plg_jumultithumb_gallery/jumultithumb_gallery.php b/packages/plg_jumultithumb_gallery/jumultithumb_gallery.php index d102a4a..7d817fe 100644 --- a/packages/plg_jumultithumb_gallery/jumultithumb_gallery.php +++ b/packages/plg_jumultithumb_gallery/jumultithumb_gallery.php @@ -22,6 +22,12 @@ class plgContentJUMULTITHUMB_Gallery extends JPlugin { var $modeHelper; + /** + * plgContentJUMULTITHUMB_Gallery constructor. + * + * @param $subject + * @param $config + */ public function __construct(& $subject, $config) { parent::__construct($subject, $config); @@ -39,6 +45,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(); @@ -58,7 +74,7 @@ public function onContentBeforeDisplay($context, &$article, &$params, $limitstar return true; } - $autolinks = new AutoLinks($imgTitlePrefix, $imgAltPrefix); + $autolinks = new AutoLinks(); $link = $this->modeHelper->jViewLink($article); $article->text = @$autolinks->handleImgLinks($article->text, $article->title, $link); @@ -66,6 +82,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(); @@ -106,6 +132,14 @@ public function onContentPrepare($context, &$article, &$params, $limitstart) return true; } + /** + * @param $text + * @param $article + * + * @return null|string|string[] + * + * @since 6.0 + */ public function GalleryReplace($text, &$article) { $app = JFactory::getApplication(); @@ -251,8 +285,6 @@ public function GalleryReplace($text, &$article) $img_title = preg_replace("/\"/", "'", $article->title); - $rel = str_replace('/', '', $folder); - $lightbox = $param->get('selectlightbox'); $folder = trim($matcheslist[0]); @@ -274,15 +306,19 @@ public function GalleryReplace($text, &$article) case '1': $imp_filtercolor = array('fltr_1' => 'gray'); break; + case '2': $imp_filtercolor = array('fltr_1' => 'sep'); break; + case '3': $imp_filtercolor = array('fltr_1' => 'th|' . $json->thumb_th_seting); break; + case '4': $imp_filtercolor = array('fltr_1' => 'clr|' . $json->colorized . '|' . str_replace('#', '', $json->colorpicker)); break; + default: $imp_filtercolor = array(); break; @@ -336,7 +372,7 @@ public function GalleryReplace($text, &$article) $thumb_img = $JUImg->Render($file, $_imgparams); $bloggallery = $this->_image($thumb_img, $param->get('width'), $param->get('height'), $img_class, $_title, 0, $_title, ''); - if($a == 0) return $bloggallery; + //if($a == 0) return $bloggallery; } // Watermark @@ -441,23 +477,22 @@ public function GalleryReplace($text, &$article) return $text; } - public function getTmpl($template, $name) - { - - $search = JPATH_SITE . '/templates/' . $template . '/html/plg_jumultithumb_gallery/' . $name . '.php'; - - if(is_file($search)) - { - $tmpl = $search; - } - else - { - $tmpl = JPATH_SITE . '/plugins/content/jumultithumb_gallery/tmpl/' . $name . '.php'; - } - - return $tmpl; - } - + /** + * @param $_img + * @param $_w + * @param $_h + * @param null $_class + * @param null $_alt + * @param null $_caption + * @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, $_title = null, $_link_img = null, $_orig_img = null, $_lightbox = null) { $app = JFactory::getApplication(); @@ -470,11 +505,13 @@ public function _image($_img, $_w, $_h, $_class = null, $_alt = null, $_caption $lightbox = ' '; $lightbox_data = ' ' . ($_link_img ? 'data-src="' . JURI::base() . $_link_img . '"' : '') . ' ' . ($_orig_img ? 'data-download-url="' . JURI::base() . $_orig_img . '"' : ''); break; + case 'colorbox': $link = $_link_img; $lightbox = ' class="lightbox" rel="lightbox[gall]"'; $lightbox_data = ''; break; + default: case 'jmodal': $link = $_link_img; @@ -492,4 +529,28 @@ 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_gallery/' . $name . '.php'; + + if(is_file($search)) + { + $tmpl = $search; + } + else + { + $tmpl = JPATH_SITE . '/plugins/content/jumultithumb_gallery/tmpl/' . $name . '.php'; + } + + return $tmpl; + } } \ No newline at end of file diff --git a/pkg_jumultithumb.xml b/pkg_jumultithumb.xml index 6a651b6..02088d4 100644 --- a/pkg_jumultithumb.xml +++ b/pkg_jumultithumb.xml @@ -2,14 +2,14 @@ PLG_JUMULTITHUMB jumultithumb - 20.03.2017 + 04.12.2017 Joomla! Ukraine (C) 2007-2017 Denys Nosov, Joomla! Ukraine http://joomla-ua.org Denys Nosov, Joomla! Ukraine denys@joomla-ua.org http://joomla-ua.org - 7.0.1 + 7.0.2 GNU/GPL Version 2 or later and Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License PLG_JUMULTITHUMB_XML_DESCRIPTION diff --git a/script.php b/script.php index f763ef3..1bb9b06 100644 --- a/script.php +++ b/script.php @@ -23,9 +23,17 @@ class Pkg_JUMultiThumbInstallerScript protected $status; protected $sourcePath; + /** + * @param $type + * @param $parent + * + * @return bool + * + * @since 6.0 + */ public function preflight($type, $parent) { - if(version_compare(JVERSION, '3.1.0', 'lt')) + if(version_compare(JVERSION, '3.4.0', 'lt')) { JFactory::getApplication()->enqueueMessage('Update for Joomla! 3.4+', 'error'); @@ -55,6 +63,37 @@ public function preflight($type, $parent) return true; } + /** + * @param $dir + * @param $mode + * + * @return bool + * + * @since 6.0 + */ + public function MakeDirectory($dir, $mode) + { + if(is_dir($dir) || @mkdir($dir, $mode)) + { + $indexfile = $dir . '/index.html'; + if(!file_exists($indexfile)) + { + $file = fopen($indexfile, 'w'); + fputs($file, ''); + fclose($file); + } + + return true; + } + + if(!$this->MakeDirectory(dirname($dir), $mode)) + { + return false; + } + + return @mkdir($dir, $mode); + } + public function uninstall($parent) { return true; @@ -281,26 +320,13 @@ public function postflight($type, $parent, $results) return true; } - public function MakeDirectory($dir, $mode) - { - if(is_dir($dir) || @mkdir($dir, $mode)) - { - $indexfile = $dir . '/index.html'; - if(!file_exists($indexfile)) - { - $file = fopen($indexfile, 'w'); - fputs($file, ''); - fclose($file); - } - - return true; - } - - if(!$this->MakeDirectory(dirname($dir), $mode)) return false; - - return @mkdir($dir, $mode); - } - + /** + * @param $dir + * @param $deleteRootToo + * + * + * @since 6.0 + */ public function unlinkRecursive($dir, $deleteRootToo) { if(!$dh = @opendir($dir)) return;