File manager - Edit - /home/jardides/www/Jardi-design/old/plugins/pagebuilderck/gallery/gallery.php
Back
<?php /** * @copyright Copyright (C) 2015 Cédric KEIFLIN alias ced1870 * https://www.template-creator.com * https://www.joomlack.fr * @license GNU/GPL * */ defined('_JEXEC') or die('Restricted access'); jimport('joomla.event.plugin'); class plgPagebuilderckGallery extends JPlugin { private $context = 'PLG_PAGEBUILDERCK_GALLERY'; private $type = 'gallery'; function __construct(&$subject, $params) { parent::__construct($subject, $params); } public function callAssets() { // load the files in the page in admin and front PagebuilderckFrontHelper::addStylesheet(JUri::root(true) . '/plugins/pagebuilderck/gallery/assets/gallery.css'); } /* * Construct the Menu Item to drag into the interface * * Return Object with item data */ public function onPagebuilderckAddItemToMenu() { $this->callAssets(); // load the language files of the plugin $this->loadLanguage(); // create the menu item $menuitem = new stdClass(); $menuitem->type = $this->type; $menuitem->group = 'image'; $menuitem->title = JText::_($this->context . '_MENUITEM_TITLE'); $menuitem->description = JText::_($this->context . '_MENUITEM_DESC'); $menuitem->image = JUri::root(true) . '/plugins/pagebuilderck/gallery/assets/images/images.png'; return $menuitem; } /* * Display the html code for the item to be used into the interface * * Return String the html code */ public function onPagebuilderckLoadItemContentGallery() { $input = JFactory::getApplication()->input; $id = $input->get('ckid', '', 'string'); ?> <div id="<?php echo $id; ?>" class="cktype" data-type="<?php echo $this->type ?>"> <div class="tab_galleryoptions ckprops" usecaption0="checked" uselightbox0="checked" autolinkimages0="checked" fieldslist="usecaption1,usecaption0,uselightbox0,uselightbox1,autolinkimages1,autolinkimages0"></div> <div class="ckstyle"> </div> <div class="pbck_gallery inner"> <div class="pbck_gallery_wrap"> <figure class="pbck_gallery_item fitie"> <div class="pbck_gallery_item_img" style="background-image: url('<?php echo JUri::root(true); ?>/plugins/pagebuilderck/gallery/assets/images/slides/gallery1.jpg')"> <img src="<?php echo JUri::root(true); ?>/plugins/pagebuilderck/gallery/assets/images/slides/gallery1.jpg" width="100%" height="auto"> </div> </figure> <figure class="pbck_gallery_item fitie"> <div class="pbck_gallery_item_img" style="background-image: url('<?php echo JUri::root(true); ?>/plugins/pagebuilderck/gallery/assets/images/slides/gallery2.jpg')"> <img src="<?php echo JUri::root(true); ?>/plugins/pagebuilderck/gallery/assets/images/slides/gallery2.jpg" width="100%" height="auto"> </div> </figure> <figure class="pbck_gallery_item fitie"> <div class="pbck_gallery_item_img" style="background-image: url('<?php echo JUri::root(true); ?>/plugins/pagebuilderck/gallery/assets/images/slides/gallery3.jpg')"> <img src="<?php echo JUri::root(true); ?>/plugins/pagebuilderck/gallery/assets/images/slides/gallery3.jpg" width="100%" height="auto"> </div> </figure> <figure class="pbck_gallery_item fitie"> <div class="pbck_gallery_item_img" style="background-image: url('<?php echo JUri::root(true); ?>/plugins/pagebuilderck/gallery/assets/images/slides/gallery4.jpg')"> <img src="<?php echo JUri::root(true); ?>/plugins/pagebuilderck/gallery/assets/images/slides/gallery4.jpg" width="100%" height="auto"> </div> </figure> <figure class="pbck_gallery_item fitie"> <div class="pbck_gallery_item_img" style="background-image: url('<?php echo JUri::root(true); ?>/plugins/pagebuilderck/gallery/assets/images/slides/gallery5.jpg')"> <img src="<?php echo JUri::root(true); ?>/plugins/pagebuilderck/gallery/assets/images/slides/gallery5.jpg" width="100%" height="auto"> </div> </figure> <figure class="pbck_gallery_item fitie"> <div class="pbck_gallery_item_img" style="background-image: url('<?php echo JUri::root(true); ?>/plugins/pagebuilderck/gallery/assets/images/slides/gallery6.jpg')"> <img src="<?php echo JUri::root(true); ?>/plugins/pagebuilderck/gallery/assets/images/slides/gallery6.jpg" width="100%" height="auto"> </div> </figure> </div> </div> </div> <?php } /* * Display the html code for the item to be used into the interface * * Return String the html code */ public function onPagebuilderckLoadItemOptionsGallery() { // load the language files of the plugin $this->loadLanguage(); // load the interface for the options $tpl = JPATH_SITE . '/plugins/pagebuilderck/gallery/layouts/edit_gallery.php'; return $tpl; } /* * Display the html code for the item to be used into the frontend page * @param string the item object from simple_html_dom * * Return String the html code */ public function onPagebuilderckRenderItemGallery($item) { $this->callAssets(); $html = $item->innertext; $layout_attrs = $item->find('.tab_galleryoptions'); $this->layout_params = PagebuilderckFrontHelper::createParamsFromElement($layout_attrs); $layout_items = $item->find('.tab_items'); $this->items_params = PagebuilderckFrontHelper::createParamsFromElement($layout_items); $styles = '@media only screen and (max-width:' . (int)$this->layout_params->get('responsiveresolution', '640') . 'px){ #'.$item->attr['id'].' .pbck_gallery .pbck_gallery_item { width: 100% !important; } }'; if ($this->items_params->get('imagesource') === 'folder') { include_once(PAGEBUILDERCK_PATH . '/helpers/loaders/folder.php'); $images = PagebuilderckLoaderFolder::getItems($this->items_params); // ckstyle and inner classes are needed to get the styles from the interface $ckstyle = $item->find('.ckstyle'); $styles .= count($ckstyle) ? $ckstyle[0]->innertext : ''; // ckstyle and inner classes are needed to get the styles from the interface $ckstyleresponsives = $item->find('.ckstyleresponsive'); if (! empty($ckstyleresponsives)) { foreach ($ckstyleresponsives as $ckstyleresponsive) { $styles .= $ckstyleresponsive->outertext; } } /* * nbcols : width: calc(50% - 15px); OK * gutter: 0px 0px 30px; OK * usecaption0/1 * imagecssclass * autolinkimages0/1 * linktarget * Image Effect >> no input to store the option (shall be in a hidden input) * uselightbox0/1 * showlightboxtitle0/1 * showlightboxdesc0/1 */ $nbcols = (int)$this->layout_params->get('nbcols', '0'); $gutter = PagebuilderckFrontHelper::testUnit((int)$this->layout_params->get('gutter', '10')); if ($nbcols > 0) { $witem = 'calc(100% / ' . $nbcols . ' - ' . $gutter . ' * ' . ($nbcols-1) . ' / ' . $nbcols . ');'; $marginitem = '0 0 ' . $gutter . ' 0'; } else { $witem = ''; $marginitem = '0 ' . $gutter . ' ' . $gutter . ' 0;'; } $styles .= '.pbck_gallery .pbck_gallery_item {' . 'width: ' . $witem . 'margin: ' . $marginitem . '}'; $autolinkimages = $this->layout_params->get('autolinkimages1', '') === 'checked'; $uselightbox = $this->layout_params->get('uselightbox1', '') === 'checked'; $showlightboxtitle = $this->layout_params->get('showlightboxtitle1', '') === 'checked'; $showlightboxdesc = $this->layout_params->get('showlightboxdesc1', '') === 'checked'; $linktarget = $this->layout_params->get('linktarget', '_parent'); $imagecssclass = $this->layout_params->get('imagecssclass', ''); $html = '<div class="ckstyle"> '. $styles . ' </div> <div id="' . $item->attr['id'] . '" class="cktype" data-type="gallery"> <div class="pbck_gallery inner' . ($nbcols > 0 ? ' pbck_gallery_hascolumns' : '') . '"> <div class="pbck_gallery_wrap">'; foreach ($images as $image) { $imgsrc = $image->image; $title = isset($image->title) ? $image->title : null; $text = isset($image->text) ? $image->text : null; $link = isset($image->link) ? $image->link : null; $target = isset($image->target) ? $image->target : $linktarget; $more = isset($image->more) ? $image->more : null; $html .= ' <figure class="pbck_gallery_item fitie' . ($imagecssclass ? ' ' . $imagecssclass : '') . '">'; if ($autolinkimages || $link) { $html .= '<a class="pbck_gallery_item_link" href="' . $imgsrc . '"' . ($uselightbox ? ' rel="lightbox[' . $item->attr['id'] . ']"' : '') . ($target !== '_parent' ? ' target="' . $target . '"' : '') . '></a>'; } $html .= '<div class="pbck_gallery_item_img" style="background-image: url(\'' . $imgsrc . '\')"> <img src="' . $imgsrc . '" width="100%" height="auto">'; if ($title || $text) { $html .= '<figcaption class="pbck_gallery_item_caption">' . '<div>' . '<div class="pbck_gallery_item_title">' . $title . '</div>' . '<div class="pbck_gallery_item_desc">' . $text . '</div>' . '</div>' . '</figcaption>'; } $html .= '</div> </figure>'; } $html .=' </div> </div> </div>' ; } else { $html = '<div class="ckstyle"> '. $styles . ' </div>' . $html; } return $html; } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings