| Server IP : 46.105.57.169 / Your IP : 216.73.216.144 Web Server : Apache System : Linux webd003.cluster120.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : maitricfuz ( 93378) PHP Version : 8.4.10 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/m/a/i/maitricfuz/www/new-saint-martin/plugins/pagebuilderck/gallery/ |
Upload File : |
<?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 \Joomla\CMS\Plugin\CMSPlugin {
private $context = 'PLG_PAGEBUILDERCK_GALLERY';
private $type = 'gallery';
protected $layout_params;
protected $items_params;
function __construct(&$subject, $params) {
parent::__construct($subject, $params);
}
public function callAssets() {
$doc = \Joomla\CMS\Factory::getDocument();
// load the files in the page in admin and front
PagebuilderckFrontHelper::addStylesheet(\Joomla\CMS\Uri\Uri::root(true) . '/plugins/pagebuilderck/gallery/assets/gallery.css');
$doc->addScript(\Joomla\CMS\Uri\Uri::root(true) . '/plugins/pagebuilderck/gallery/assets/gallery.js');
}
/*
* 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 = \Joomla\CMS\Language\Text::_($this->context . '_MENUITEM_TITLE');
$menuitem->description = \Joomla\CMS\Language\Text::_($this->context . '_MENUITEM_DESC');
$menuitem->image = \Joomla\CMS\Uri\Uri::root(true) . '/plugins/pagebuilderck/gallery/assets/images/gallery.svg';
return $menuitem;
}
/*
* Display the html code for the item to be used into the interface
*
* Return String the html code
*/
public function onPagebuilderckLoadItemContentGallery() {
$input = \Joomla\CMS\Factory::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 \Joomla\CMS\Uri\Uri::root(true); ?>/plugins/pagebuilderck/gallery/assets/images/slides/gallery1.jpg')">
<img src="<?php echo \Joomla\CMS\Uri\Uri::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 \Joomla\CMS\Uri\Uri::root(true); ?>/plugins/pagebuilderck/gallery/assets/images/slides/gallery2.jpg')">
<img src="<?php echo \Joomla\CMS\Uri\Uri::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 \Joomla\CMS\Uri\Uri::root(true); ?>/plugins/pagebuilderck/gallery/assets/images/slides/gallery3.jpg')">
<img src="<?php echo \Joomla\CMS\Uri\Uri::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 \Joomla\CMS\Uri\Uri::root(true); ?>/plugins/pagebuilderck/gallery/assets/images/slides/gallery4.jpg')">
<img src="<?php echo \Joomla\CMS\Uri\Uri::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 \Joomla\CMS\Uri\Uri::root(true); ?>/plugins/pagebuilderck/gallery/assets/images/slides/gallery5.jpg')">
<img src="<?php echo \Joomla\CMS\Uri\Uri::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 \Joomla\CMS\Uri\Uri::root(true); ?>/plugins/pagebuilderck/gallery/assets/images/slides/gallery6.jpg')">
<img src="<?php echo \Joomla\CMS\Uri\Uri::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);
$number = (int)$this->layout_params->get('nbcols', '0');
$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 ($number && $this->layout_params->get('usepagination1', '') === 'checked') {
$styles .= '#'.$item->attr['id'].' .pbck_gallery_item:not(.pbck-show):nth-child(n+' . ($number + 1) . ') { display: none; }';
$styles .= '#'.$item->attr['id'].' .pbck_gallery_item:nth-child(' . ($number) . 'n+' . ($number) . ') { margin-right: 0; }';
}
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 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>'
;
} else {
$html = '<div class="ckstyle">
'. $styles . '
</div>'
. $html;
}
return $html;
}
private function renderNavigation() {
// navigation
$html = '<div class="mediaboxck-navigation">';
$html .= ' <div class="mediaboxck-navigation-prev"></div>';
$html .= ' <div class="mediaboxck-navigation-next"></div>';
$html .= '</div>';
return $html;
}
}