Esta é uma pré-visualização de arquivo. Entre para ver o arquivo original
carouselck-light/administrator/access.xml carouselck-light/administrator/backup/index.html carouselck-light/administrator/carouselck.php <?php /** * @name Carousel CK * @package com_carouselck * @copyright Copyright (C) 2019. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @author Cedric Keiflin - https://www.template-creator.com - https://www.joomlack.fr */ // no direct access defined('_JEXEC') or die; if (! defined('CK_LOADED')) define('CK_LOADED', 1); // use Carouselck\CKFof; include_once JPATH_ADMINISTRATOR . '/components/com_carouselck/helpers/defines.php'; // Access check. if (!JFactory::getUser()->authorise('core.edit', 'com_carouselck')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } // loads the language files from the frontend $lang = JFactory::getLanguage(); $lang->load('com_carouselck', JPATH_SITE . '/components/com_carouselck', $lang->getTag(), false); $lang->load('com_carouselck', JPATH_SITE, $lang->getTag(), false); // loads the helper in any case require_once CAROUSELCK_PATH . '/helpers/cktext.php'; require_once CAROUSELCK_PATH . '/helpers/ckpath.php'; require_once CAROUSELCK_PATH . '/helpers/ckfile.php'; require_once CAROUSELCK_PATH . '/helpers/ckfolder.php'; require_once CAROUSELCK_PATH . '/helpers/ckuri.php'; require_once CAROUSELCK_PATH . '/helpers/ckfof.php'; require_once CAROUSELCK_PATH . '/helpers/helper.php'; require_once CAROUSELCK_PATH . '/helpers/ckframework.php'; require_once CAROUSELCK_PATH . '/helpers/ckcontroller.php'; require_once CAROUSELCK_PATH . '/helpers/ckmodel.php'; require_once CAROUSELCK_PATH . '/helpers/ckview.php'; \Carouselck\CKFramework::load(); // Include dependancies require_once CAROUSELCK_PATH . '/controller.php'; $controller = \Carouselck\CKController::getInstance('Carouselck'); $controller->execute(JFactory::getApplication()->input->get('task')); //$controller->redirect(); carouselck-light/administrator/config.xml carouselck-light/administrator/controller.php <?php /** * @name Carousel CK * @package com_carouselck * @copyright Copyright (C) 2019. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @author Cedric Keiflin - https://www.template-creator.com - https://www.joomlack.fr */ // No direct access defined('CK_LOADED') or die; use \Carouselck\CKController; use \Carouselck\CKFof; use \Carouselck\CKText; class CarouselckController extends CKController { static function getInstance($prefix = '') { return parent::getInstance('Carouselck'); } public function display($cachable = false, $urlparams = false) { $view = $this->input->get('view', 'styles'); $this->input->set('view', $view); parent::display(); return $this; } public static function ajaxCreateFolder() { // security check if (! CKFof::checkAjaxToken()) { exit(); } if (CKFof::userCan('create', 'com_media')) { $input = CKFof::getInput(); $path = $input->get('path', '', 'string'); $name = $input->get('name', '', 'string'); require_once CAROUSELCK_PATH . '/helpers/ckbrowse.php'; if ($result = CKBrowse::createFolder($path, $name)) { $msg = CKText::_('CK_FOLDER_CREATED_SUCCESS'); } else { $msg = CKText::_('CK_FOLDER_CREATED_ERROR'); } echo '{"status" : "' . ($result == false ? '0' : '1') . '", "message" : "' . $msg . '"}'; } else { echo '{"status" : "2", "message" : "' . CKText::_('CK_ERROR_USER_NO_AUTH') . '"}'; } exit; } /** * Get the file and store it on the server * * @return mixed, the method return */ public function ajaxAddPicture() { require_once CAROUSELCK_PATH . '/helpers/ckbrowse.php'; CKBrowse::ajaxAddPicture(); } } carouselck-light/administrator/controllers/ajax.php <?php /** * @name Carousel CK * @package com_carouselck * @copyright Copyright (C) 2019. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @author Cedric Keiflin - https://www.template-creator.com - https://www.joomlack.fr */ // No direct access defined('CK_LOADED') or die; use \Carouselck\CKController; use \Carouselck\CKFof; use \Carouselck\CKText; class CarouselckControllerAjax extends CKController { function __construct() { // security check if (! CKFof::checkAjaxToken()) exit; parent::__construct(); $plugin = $this->input->get('plugin', '', 'cmd'); $task = $this->input->get('task', '', 'cmd'); if ($plugin) { if (file_exists(CAROUSELCK_PLUGINS_PATH . '/' . $plugin . '/helper/helper_' . $plugin . '.php')) { require_once(CAROUSELCK_PLUGINS_PATH . '/' . $plugin . '/helper/helper_' . $plugin . '.php'); $className = 'CarouselckHelpersource' . ucfirst($plugin); //CarouselckHelpersourceArticles $class = new $className(); if (method_exists($class, $task)) { $class::$task(); exit; } } } die; } } carouselck-light/administrator/controllers/browse.php <?php /** * @name Carousel CK * @package com_carouselck * @copyright Copyright (C) 2019. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @author Cedric Keiflin - https://www.template-creator.com - https://www.joomlack.fr */ // No direct access defined('CK_LOADED') or die; use Carouselck\CKController; use Carouselck\CKFof; require_once CAROUSELCK_PATH . '/helpers/ckbrowse.php'; class CarouselckControllerBrowse extends CKController { public function getFiles() { // security check if (! CKFof::checkAjaxToken()) { exit(); } $folder = $this->input->get('folder', '', 'string'); $type = $this->input->get('type', '', 'string'); $filetypes = CKBrowse::getFileTypes($type); $files = CKBrowse::getImagesInFolder(JPATH_SITE . '/' . $folder, implode('|', $filetypes)); if (empty($files)) { echo JText::_('CK_NO_IMAGE_FOUND'); } else { foreach($files as $file) { ?> <div class="ckfoldertreefile" data-type="<?php echo $type ?>" onclick="ckSelectFile(this)" data-path="<?php echo utf8_encode($folder) ?>" data-filename="<?php echo utf8_encode($file) ?>"> <img src="<?php echo JUri::root(true) . '/' . utf8_encode($folder) . '/' . utf8_encode($file) ?>" title="<?php echo utf8_encode($file); ?>" loading="lazy"> <div class="ckimagetitle"><?php echo utf8_encode($file); ?></div> </div> <?php } } exit; } } carouselck-light/administrator/controllers/index.html carouselck-light/administrator/controllers/menus.php <?php /** * @name Carousel CK * @package com_carouselck * @copyright Copyright (C) 2019. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @author Cedric Keiflin - https://www.template-creator.com - https://www.joomlack.fr */ // No direct access defined('CK_LOADED') or die; use \Carouselck\CKController; use \Carouselck\CKFof; class CarouselckControllerMenus extends CKController { function ajaxShowMenuItems() { // security check if (! CKFof::checkAjaxToken()) { exit(); } $parentId = $this->input->get('parentid', 0, 'int'); $menutype = $this->input->get('menutype', '', 'string'); $model = $this->getModel('Menus', 'Carouselck', array()); $items = $model->getChildrenItems($menutype, $parentId); $links = array(); $imagespath = CAROUSELCK_MEDIA_URI .'/images/'; ?> <div class="cksubfolder"> <?php foreach ($items as $item) { // CKFof::dump($item); $aliasId = $item->id; if ($item->type == 'alias') { $itemParams = new JRegistry($item->params); $aliasId = $itemParams->get('aliasoptions', 0); } $Itemid = substr($item->link,-7,7) == 'Itemid=' ? $aliasId : '&Itemid=' . $aliasId; ?> <div class="ckfoldertree parent"> <div class="ckfoldertreetoggler <?php if ($item->rgt - $item->lft <= 1) { echo 'empty'; } ?>" onclick="ckToggleTreeSub(this, <?php echo $item->id ?>)" data-menutype="<?php echo $item->menutype; ?>"></div> <div class="ckfoldertreename hasTip" title="<?php echo $item->link . $Itemid ?>" onclick="ckSetMenuItemUrl('<?php echo $item->link . $Itemid ?>')"><img src="<?php echo $imagespath ?>folder.png" /><?php echo $item->title; ?></div> </div> <?php } ?> </div> <?php exit; } } carouselck-light/administrator/controllers/style.php <?php /** * @copyright Copyright (C) 2019. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @author Cedric Keiflin - http://www.template-creator.com - http://www.joomlack.fr */ // No direct access defined('_JEXEC') or die; use \Carouselck\CKController; use \Carouselck\CKFof; class CarouselckControllerStyle extends CKController { // public function add() { // $this->edit(0); // Redirect to the edit screen. // CKFof::redirect(CAROUSELCK_ADMIN_URL . '&view=style&layout=edit&id=0&tmpl=component&layout=modal'); // } // public function edit($id = null, $appendUrl = '') { // parent::edit($id, '&layout=modal&tmpl=component'); // } // // public function copy() { // parent::edit('&layout=modal&tmpl=component'); // } /* * Generate the CSS styles from the settings */ public function save() { // security check if (! CKFof::checkAjaxToken()) { exit(); } $id = $this->input->get('id', 0, 'int'); $model = $this->getModel(); $row = $model->getItem($id); // get data $fields = $this->input->get('fields', '', 'raw'); $name = $this->input->get('name', '', 'string'); if (! $name) $name = 'style' . $id; $layoutcss = trim($this->input->get('layoutcss', '', 'html')); // set data $row->params = $fields; $row->name = $name; $row->layoutcss = $layoutcss; if (! $id = $model->save($row)) { echo "{'result': '0', 'id': '" . $row->id . "', 'message': 'Error : Can not save the Styles !'}"; echo($this->_db->getErrorMsg()); exit; } echo '{"result": "1", "id": "' . $id . '", "message": "Styles saved successfully"}'; exit; } /** * copy an existing page * @return void */ // function copy() { // $model = $this->getModel(); // $cid = $this->input->get('cid', '', 'array'); // $this->input->set('id', (int) $cid[0]); // if (!$model->copy()) { // $msg = JText::_('CK_COPY_ERROR'); // $type = 'error'; // } else { // $msg = JText::_('CK_COPY_SUCCESS'); // $type = 'message'; // } // // $this->setRedirect('index.php?option=com_carouselck&view=styles', $msg, $type); // } /* * Generate the CSS styles from the settings */ public function ajaxRenderCss() { $fields = $this->input->get('fields', '', 'raw'); $fields = json_decode($fields); $customstyles = stripslashes( $this->input->get('customstyles', '', 'string')); $customstyles = json_decode($customstyles); $customcss = $this->input->get('customcss', '', 'html'); $css = $this->renderCss($fields, $customstyles); echo $css . $customcss; exit(); } /* * Render the CSS from the settings */ public function renderCss($fields, $customstyles) { include_once CAROUSELCK_PATH . '/helpers/ckstyles.php'; $ckstyles = new \Carouselck\CKStyles(); $css = $ckstyles->create($fields, $customstyles); return $css; } /** * Ajax method to save the json data into the .mmck file * * @return boolean - true on success for the file creation * */ public function exportParams() { // security check if (! CKFof::checkAjaxToken()) { exit(); } // create a backup file with all fields stored in it $fields = $this->input->get('jsonfields', '', 'string'); $backupfile_path = CAROUSELCK_PATH . '/export/exportParamsCarouselckStyle'. $this->input->get('styleid',0,'int') .'.mmck'; if (file_put_contents($backupfile_path, $fields)) { echo '1'; } else { echo '0'; } exit(); } /** * Ajax method to import the .mmck file into the interface * * @return boolean - true on success for the file creation * */ public function uploadParamsFile() { // security check if (! CKFof::checkAjaxToken()) { exit(); } $file = $this->input->files->get('file', '', 'array'); if (!is_array($file)) exit(); $filename = JFile::makeSafe($file['name']); // check if the file exists if (JFile::getExt($filename) != 'mmck') { $msg = JText::_('CK_NOT_MMCK_FILE', true); echo json_encode(array('error'=> $msg)); exit(); } //Set up the source and destination of the file $src = $file['tmp_name']; // check if the file exists if (!$src || !JFile::exists($src)) { $msg = JText::_('CK_FILE_NOT_EXISTS', true); echo json_encode(array('error'=> $msg)); exit(); } // read the file if (!$filecontent = JFile::read($src)) { $msg = JText::_('CK_UNABLE_READ_FILE', true); echo json_encode(array('error'=> $msg)); exit(); } // replace vars to allow data to be moved from another server $filecontent = str_replace("|URIROOT|", JUri::root(true), $filecontent); // $filecontent = str_replace("|qq|", '"', $filecontent); // echo $filecontent; echo json_encode(array('data'=> $filecontent)); exit(); } /** * Ajax method to read the fields values from the selected preset * * @return json - * */ function loadPresetFields() { // security check if (! CKFof::checkAjaxToken()) { exit(); } $preset = $this->input->get('preset', '', 'string'); $folder_path = CAROUSELCK_MEDIA_PATH . '/presets/'; // load the fields $fields = '{}'; if ( file_exists($folder_path . $preset. '.mmck') ) { $fields = @file_get_contents($folder_path . $preset. '.mmck'); $fields = str_replace('\n','', $fields); // $fields = str_replace("{", "|ob|", $fields); // $fields = str_replace("}", "|cb|", $fields); } else { echo '{"result" : 0, "message" : "File Not found : '.$folder_path . $preset. '.mmck'.'"}'; exit(); } echo '{"result" : 1, "fields" : "'.$fields.'", "customcss" : ""}'; exit(); } } carouselck-light/administrator/controllers/styles.php <?php /** * @name Slider CK * @package com_carouselck * @copyright Copyright (C) 2016. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @author Cedric Keiflin - http://www.template-creator.com - http://www.joomlack.fr */ // No direct access. defined('_JEXEC') or die; jimport('joomla.application.component.controlleradmin'); /** * Pages list controller class. */ class CarouselckControllerStyles extends JControllerAdmin { /** * Proxy for getModel. * @since 1.6 */ public function getModel($name = 'style', $prefix = 'CarouselckModel', $config = array()) { $model = parent::getModel($name, $prefix, array('ignore_request' => true)); return $model; } } carouselck-light/administrator/elements/carouselckinterface.php <?php /** * @copyright Copyright (C) 2017 Cedric KEIFLIN alias ced1870 * http://www.joomlack.fr * @license GNU/GPL * */ defined('JPATH_PLATFORM') or die; use Carouselck\CKFramework; include_once JPATH_ROOT . '/administrator/components/com_carouselck/helpers/ckframework.php'; include_once JPATH_ROOT . '/administrator/components/com_carouselck/helpers/defines.php'; JFormHelper::loadFieldClass('hidden'); CKFramework::load(); class JFormFieldCarouselckinterface extends JFormFieldHidden { /** * The form field type. * * @var string * */ protected $type = 'carouselckinterface'; /** * Method to get the field input markup. * * @return string The field input markup. * */ protected function getLabel() { return ''; } /** * Method to get the field label markup. * * @return string The field label markup. * */ protected function getInput() { // loads the language files from the frontend $lang = JFactory::getLanguage(); $lang->load('com_carouselck', JPATH_SITE . '/components/com_carouselck', $lang->getTag(), false); $lang->load('com_carouselck', JPATH_SITE, $lang->getTag(), false); if (version_compare(JVERSION, '4') >= 0) { $css = '.carouselck-field-suffix { display: inline-block; line-height: 25px; transform: translate(0, -50%); position: absolute; top: 20px; height: 25px; right: 20px; } .carouselck-field-icon { display: inline-block; vertical-align: top; margin-top: 10px; width: 20px; } .carouselck-field-icon + input, .carouselck-field-icon + fieldset, .carouselck-field-icon + select { display: inline-block; width: calc(100% - 30px); } .ckbutton-group input[type="text"] { min-height: 28px; box-sizing: border-box; font-size: 13px; }'; } else { $css = '.carouselck-field-icon { display: inline-block; vertical-align: top; margin-top: 4px; width: 20px; }'; } $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css); return ''; } } carouselck-light/administrator/elements/ckbackground.php <?php /** * @copyright Copyright (C) 2011 Cedric KEIFLIN alias ced1870 * https://www.joomlack.fr * @license GNU/GPL * */ // no direct access defined('_JEXEC') or die('Restricted access'); class JFormFieldCkbackground extends JFormField { protected $type = 'ckbackground'; protected function getInput() { $this->mediaPath = JUri::root(true) . '/media/com_carouselck/images/'; $styles = $this->element['styles']; $background = $this->element['background'] ? 'background: url(' . $this->mediaPath . $this->element['background'] . ') left top no-repeat;' : ''; $html = '<p style="' . $background . $styles . '" ></p>'; return $html; } protected function getLabel() { return ''; } } carouselck-light/administrator/elements/ckcolor.php <?php /** * @copyright Copyright (C) 2011 Cedric KEIFLIN alias ced1870 * https://www.joomlack.fr * Module Maximenu CK * @license GNU/GPL * */ // no direct access defined('_JEXEC') or die('Restricted access'); class JFormFieldCkcolor extends JFormField { protected $type = 'ckcolor'; protected function getInput() { $path = 'modules/mod_carouselck/elements/jscolor/'; JHTML::_('script', $path.'jscolor.js'); $html = '<img src="' . $this->getPathToImages() . '/images/color.png" /><input class="color {'; $html.= 'required:false,'; // empty possible $html.= 'pickerPosition:\'top\','; // or left / right / top $html.= 'pickerBorder:2,pickerInset:3,'; // or right / top $html.= 'hash:true'; // # behind value $html.= '}" type="text" value="' . $this->value . '" name="' . $this->name . '" style="width:100px;border-radius:3px;-moz-border-radius:3px;" />'; return $html; } protected function getPathToImages() { $localpath = dirname(__FILE__); $rootpath = JPATH_ROOT; $httppath = trim(JURI::root(), "/"); $pathtoimages = str_replace("\\", "/", str_replace($rootpath, $httppath, $localpath)); return $pathtoimages; } protected function getLabel() { $label = ''; // Get the label text from the XML element, defaulting to the element name. $text = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name']; $text = JText::_($text); // Build the class for the label. $class = !empty($this->description) ? 'hasTip hasTooltip' : ''; $label .= '<label id="' . $this->id . '-lbl" for="' . $this->id . '" class="' . $class . '"'; // If a description is specified, use it to build a tooltip. if (!empty($this->description)) { $label .= ' title="' . htmlspecialchars(trim($text, ':') . '<br />' . JText::_($this->description), ENT_COMPAT, 'UTF-8') . '"'; } $label .= ' style="min-width:150px;max-width:150px;width:150px;display:block;float:left;padding:1px;">' . $text . '</label>'; return $label; } } carouselck-light/administrator/elements/ckdocumentation.php <?php /** * @copyright Copyright (C) 2011 Cedric KEIFLIN alias ced1870 * https://www.joomlack.fr * @license GNU/GPL * */ // no direct access defined('_JEXEC') or die('Restricted access'); class JFormFieldCkdocumentation extends JFormField { protected $type = 'ckdocumentation'; protected function getLabel() { return ''; } protected function getInput() { $html = array(); $icon = $this->element['icon'] ? $this->element['icon'] : 'file-alt'; $url = $this->element['url'] ? $this->element['url'] : 'https://www.joomlack.fr/en/documentation'; $html[] = '<div class="ckinfo"><i class="fas fa-' . $icon . '"></i><a href="' . $url . '" target="_blank">' . JText::_('CAROUSELCK_DOCUMENTATION') . '</a></div>'; return implode('', $html); } } carouselck-light/administrator/elements/ckfolderlist.php <?php /** * @copyright Copyright (C) 2011 Cedric KEIFLIN alias ced1870 * https://www.joomlack.fr * Module Maximenu CK * @license GNU/GPL * */ defined('JPATH_PLATFORM') or die; jimport('joomla.html.html'); jimport('joomla.filesystem.folder'); jimport('joomla.form.formfield'); jimport('joomla.form.helper'); class JFormFieldCkfolderList extends JFormFieldList { public $type = 'CkfolderList'; protected function getOptions() { // Initialize variables. $options = array(); // Initialize some field attributes. $filter = (string) $this->element['filter']; $exclude = (string) $this->element['exclude']; $hideNone = (string) $this->element['hide_none']; $hideDefault = (string) $this->element['hide_default']; // Get the path in which to search for file options. $path = (string) $this->element['directory']; if (!is_dir($path)) { $path = JPATH_ROOT.'/'.$path; } // Prepend some default options based on field attributes. if (!$hideNone) { $options[] = JHtml::_('select.option', '-1', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname))); } if (!$hideDefault) { $options[] = JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname))); } // Get a list of folders in the search path with the given filter. $folders = JFolder::folders($path, $filter); // Build the options list from the list of folders. if (is_array($folders)) { foreach($folders as $folder) { // Check to see if the file is in the exclude mask. if ($exclude) { if (preg_match(chr(1).$exclude.chr(1), $folder)) { continue; } } $options[] = JHtml::_('select.option', $folder, $folder); } } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; } } carouselck-light/administrator/elements/ckformfield.php <?php /** * @copyright Copyright (C) 2011 Cedric KEIFLIN alias ced1870 * https://www.joomlack.fr * @license GNU/GPL * */ // no direct access defined('_JEXEC') or die('Restricted access'); class JFormField extends JFormField { public $mediaPath; public function __construct() { $this->mediaPath = JUri::root(true) . '/media/com_carouselck/images/'; // loads the language files from the frontend $lang = JFactory::getLanguage(); $lang->load('com_carouselck', JPATH_SITE . '/components/com_carouselck', $lang->getTag(), false); $lang->load('com_carouselck', JPATH_SITE, $lang->getTag(), false); parent::__construct(); } protected function getInput() { return ''; } protected function getLabel() { return parent::getLabel(); } /** * Method to get the field options. * * @return array The field option objects. * * @since 11.1 */ protected function getOptions() { $options = array(); foreach ($this->element->children() as $option) { // Only add <option /> elements. if ($option->getName() != 'option') { continue; } // Create a new option object based on the <option /> element. $tmp = JHtml::_( 'select.option', (string) $option['value'], JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)), 'value', 'text', ((string) $option['disabled'] == 'true') ); // Set some option attributes. $tmp->class = (string) $option['class']; // Set some JavaScript option attributes. $tmp->onclick = (string) $option['onclick']; // Add the option object to the result set. $options[] = $tmp; } reset($options); return $options; } } carouselck-light/administrator/elements/ckheight.php <?php /** * @copyright Copyright (C) 2011-2019 Cedric KEIFLIN alias ced1870 * https://www.joomlack.fr * @license GNU/GPL * */ defined('JPATH_PLATFORM') or die; class JFormFieldCkheight extends JFormField { /** * The form field type. * * @var string * * @since 11.1 */ protected $type = 'ckheight'; /** * Method to get the field input markup. * * @return string The field input markup. * * @since 11.1 */ protected function getInput() { // Initialize some field attributes. $icon = $this->element['icon']; $suffix = $this->element['suffix']; $size = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; $maxLength = $this->element['maxlength'] ? ' maxlength="' . (int) $this->element['maxlength'] . '"' : ''; $class = $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : ''; $readonly = ((string) $this->element['readonly'] == 'true') ? ' readonly="readonly"' : ''; $disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : ''; $defautlwidth = $suffix ? '128px' : '150px'; $styles = ' style="width:' . $defautlwidth . ';' . $this->element['styles'] . '"'; // Initialize JavaScript field attributes. $onchange = $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; $html = $icon ? '<div style="display:inline-block;vertical-align:top;margin-top:4px;width:20px;"><img src="' . $this->mediaPath . $icon . '" style="margin-right:5px;" /></div>' : '<div style="display:inline-block;width:20px;"></div>'; $html .= '<div class="ckbutton-group"><input type="text" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . $class . $size . $disabled . $readonly . $onchange . $maxLength . $styles . '/>'; $html .= '<span class="ckbutton" onclick="CKBox.open({handler: \'inline\', content: \'ckheightfieldhelp\', style: {padding: \'10px\'}, size: {x: \'800px\', y: \'550px\'}})"><i class="fas fa-info"></i></span></div>'; $html .= '<div id="ckheightfieldhelp" style="display: none;"><h3>' . JText::_('CAROUSELCK_HEIGHT_FIELD_HELP_TITLE') . '</h3> <p>' . JText::_('CAROUSELCK_HEIGHT_FIELD_HELP_1') . '</p> <p><b>' . JText::_('CAROUSELCK_HEIGHT_FIELD_HELP_2') . '</b></p> <p>' . JText::_('CAROUSELCK_HEIGHT_FIELD_HELP_3') . '</p> <p>' . JText::_('CAROUSELCK_HEIGHT_FIELD_HELP_4') . '</p> <p style="text-align:center;padding:10px;font-size: 18px;">1280 x 800 px</p> <p>' . JText::_('CAROUSELCK_HEIGHT_FIELD_HELP_5') . '</p> <p><b>' . JText::_('CAROUSELCK_CALCULATOR') . '</b></p> <p><label for="ckheightfieldhelpheight">' . JText::_('CAROUSELCK_HEIGHT_LABEL') . '</label><input type="text" id="ckheightfieldhelpheight" onchange="ckHeightFieldHelpCalculator()"/></p> <p><label for="ckheightfieldhelpwidth">' . JText::_('CAROUSELCK_WIDTH_LABEL') . '</label><input type="text" id="ckheightfieldhelpwidth" onchange="ckHeightFieldHelpCalculator()" /></p> <p><label for="ckheightfieldhelpratio">' . JText::_('CAROUSELCK_RATIO_LABEL') . '</label><input type="text" id="ckheightfieldhelpratio" style="font-size: 18px;" /></p> <script>function ckHeightFieldHelpCalculator() { document.getElementById("ckheightfieldhelpratio").value = parseFloat(document.getElementById("ckheightfieldhelpheight").value) / parseFloat(document.getElementById("ckheightfieldhelpwidth").value) * 100; }</script> </div>'; return $html; } } carouselck-light/administrator/elements/ckinfo.php <?php /** * @copyright Copyright (C) 2017 Cedric KEIFLIN alias ced1870 * http://www.joomlack.fr * @license GNU/GPL * */ defined('JPATH_PLATFORM') or die; class JFormFieldCkinfo extends JFormField { /** * The form field type. * * @var string * */ protected $type = 'ckinfo'; /** * Method to get the field input markup. * * @return string The field input markup. * */ protected function getLabel() { return ''; } /** * Method to get the field label markup. * * @return string The field label markup. * */ protected function getInput() { $doc = JFactory::getDocument(); $styles = '.ckinfo {position:relative;background:#efefef;border: none;border-radius: px;color: #333;font-weight: normal;line-height: 24px;padding: 5px 5px 5px 35px;margin: 3px 0;text-align: left;text-decoration: none;} .ckinfo > .fas { font-size: 15px; padding: 3px 5px; background: rgba(0, 0, 0, 0.1); position: absolute; top: 0; bottom: 0; left: 0; line-height: 25px; width: 20px; text-align: center; } .ckinfo img {margin: 0 10px 0 0;} .control-label:empty {display: none;} .control-label:empty + .controls {margin: 0;} '; $doc->addStyleDeclaration($styles); // get the extension version $current_version = $this->getCurrentVersion(JPATH_SITE .'/administrator/components/com_carouselck/carouselck.xml'); $html = ''; $html .= '<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">'; $html .= '<div class="ckinfo"><i class="fas fa-thumbs-up"></i><a href="https://extensions.joomla.org/extension/carousel-ck/" target="_blank">' . JText::_('CAROUSELCK_VOTE_JED') . '</a></div>'; $html .= '<div class="ckinfo"><i class="fas fa-info"></i><b>CAROUSEL CK</b> - ' . JText::_('CAROUSELCK_CURRENT_VERSION') . ' : <span class="label">' . $current_version . '</span></div>'; $html .= '<div class="ckinfo"><i class="fas fa-file-alt"></i><a href="https://www.joomlack.fr/en/documentation/45-carousel-ck" target="_blank">' . JText::_('CAROUSELCK_DOCUMENTATION') . '</a></div>'; return $html; } /* * Get a variable from the manifest file * * @return the current version */ public static function getCurrentVersion($file_url) { // get the version installed $installed_version = 'UNKOWN'; if ($xml_installed = simplexml_load_file($file_url)) { $installed_version = (string)$xml_installed->version; } return $installed_version; } } carouselck-light/administrator/elements/cklight.php <?php /** * @copyright Copyright (C) 2017 Cedric KEIFLIN alias ced1870 * https://www.joomlack.fr * @license GNU/GPL * */ // no direct access defined('JPATH_PLATFORM') or die; class JFormFieldCklight extends JFormField { protected $type = 'cklight'; protected function getLabel() { return ''; } protected function getInput() { $html = array(); // Add the label text and closing tag. $html[] = '<div id="' . $this->id . '-lbl" class="ckinfo">'; $html[] = '<i class="fas fa-info" style="color:orange"></i>'; $html[] = JText::_('CAROUSELCK_USE_FREE_VERSION'); $html[] = ' <a href="https://www.joomlack.fr/en/joomla-extensions/carousel-ck" target="_blank">'; $html[] = '<span class="cklabel cklabel-info"><i class="fas fa-link"></i> ' . JText::_('CAROUSELCK_GET_PRO_INFOS') . '</label>'; $html[] = '</a>'; $html[] = '</div>'; // if (! $testparams) { // $html[] = 'Mettre ici description de la version pro avec les fonctionnalités et le lien'; // } return implode('', $html); } protected function testParams() { if (JFile::exists(JPATH_ROOT.'/plugins/system/carouselckparams/carouselckparams.php')) { $this->state = 'green'; return JText::_('CAROUSELCK_USE_PRO_VERSION'); } return false; } } carouselck-light/administrator/elements/cklist.php <?php /** * @copyright Copyright (C) 2011-2019 Cedric KEIFLIN alias ced1870 * https://www.joomlack.fr * @license GNU/GPL * */ defined('JPATH_PLATFORM') or die; jimport('joomla.html.html'); jimport('joomla.form.formfield'); class JFormFieldCklist extends JFormFieldList { protected $type = 'cklist'; protected function getInput() { // Initialize some field attributes. $icon = $this->element['icon']; $suffix = $this->element['suffix']; $html = $icon ? '<div class="carouselck-field-icon" ' . ($suffix ? 'data-has-suffix="1"' : '') . '><img src="' . CAROUSELCK_MEDIA_URI . '/images/' . $icon . '" style="margin-right:5px;" /></div>' : '<div style="display:inline-block;width:20px;"></div>'; $html .= parent::getInput(); if ($suffix) $html .= '<span class="carouselck-field-suffix">' . $suffix . '</span>'; return $html; } } carouselck-light/administrator/elements/ckmigrate.php <?php /** * @copyright Copyright (C) 2019 Cedric KEIFLIN alias ced1870 * https://www.joomlack.fr * @license GNU/GPL * */ defined('JPATH_PLATFORM') or die; use \Carouselck\CKFof; use \Carouselck\CKFolder; use \Carouselck\CKFile; use \Carouselck\CKText; require_once JPATH_ROOT . '/administrator/components/com_carouselck/helpers/ckfof.php'; require_once JPATH_ROOT . '/administrator/components/com_carouselck/helpers/ckfolder.php'; require_once JPATH_ROOT . '/administrator/components/com_carouselck/helpers/ckfile.php'; require_once JPATH_ROOT . '/administrator/components/com_carouselck/helpers/cktext.php'; class JFormFieldCkmigrate extends JFormField { /** * The form field type. * * @var string * */ protected $type = 'ckmigrate'; private $options; /** * Method to get the field input markup. * * @return string The field input markup. * */ protected function getLabel() { return ''; } /** * Method to get the field label markup. * * @return string The field label markup. * */ protected function getInput() { $input = JFactory::getApplication()->input; $id = $input->get('id', 0, 'int'); $doMigration = $input->get('domigration', 0, 'int'); if (! $id) return ''; $options = $this->getModuleOptions($id); //var_dump($options);die; $params = json_decode($options->params); if (isset($params->slidesssource)) { $this->makeBackup($id, $options->params); if ($doMigration) { $this->doMigration($id, $options->params); } else { CKfof::enqueueMessage(CKText::_('CAROUSELCK_MIGRATION_NEEDED'), 'warning'); CKfof::enqueueMessage('<a href="' . CKFof::getCurrentUri() . '&domigration=1">' . CKText::_('CAROUSELCK_MIGRATION_ACTION') . '</a>', 'warning'); } } if ($this->isPluginEnabled()) { CKFof::dbExecute("UPDATE #__extensions SET enabled = 0 WHERE element = 'carouselckparams'"); CKfof::enqueueMessage(CKText::_('CAROUSELCK_PARAMS_UNPUBLISHED_INFO'), 'warning'); CKfof::enqueueMessage('<a href="https://www.joomlack.fr/en/documentation/45-carousel-ck/246-migration-from-slideshow-ck-version-1-to-version-2" target="_blank">' . CKText::_('CAROUSELCK_PARAMS_MIGRATION_LINK') . '</a>', 'warning'); CKfof::redirect(); } $this->alertObsoletePlugin($params, 'hikashop'); $this->alertObsoletePlugin($params, 'k2'); $this->alertObsoletePlugin($params, 'joomgallery'); } protected function alertObsoletePlugin($params, $plugin) { if (isset($params->source) && $params->source == $plugin && $this->isPluginEnabled('carouselck' . $plugin)) { CKfof::enqueueMessage(CKText::_('CAROUSELCK_WARNING_PLUGIN_OBSOLETE') . ' : ' . '<b>carouselck' . $plugin . '</b>', 'warning'); CKfof::enqueueMessage('<a href="index.php?option=com_plugins&view=plugins&filter_element=carouselck' . $plugin . '" target="_blank">' . CKText::_('CAROUSELCK_DISABLE_PLUGIN') . '</a>', 'warning'); } } protected function isPluginEnabled($plugin = 'carouselckparams') { if (file_exists(JPATH_ROOT . '/plugins/system/' . $plugin)) { $isEnabled = CKFof::dbLoadResult("SELECT enabled FROM #__extensions WHERE element = '" . $plugin . "'"); return (bool)$isEnabled; } return false; } protected function getModuleOptions($id) { if (empty($this->options)) { $this->options = CKFof::dbLoadObject("SELECT * FROM #__modules WHERE id = " . (int)$id); } return $this->options; } protected function doMigration($id, $params) { $find = array('slidesssource', '"autoloadfolder"', 'autoloadarticlecategory', 'imagetarget', 'articlelength', 'showarticletitle', 'lightboxtype', 'lightboxautolinkimages'); $replace = array('source', '"folder"', 'linktarget', 'articles', 'textlength', 'usetitle', 'lightbox', 'linkautoimage'); $newparams = str_replace($find, $replace, $params); $paramsObj = new JRegistry($newparams); if ($paramsObj->get('carouselckhikashop_enable', '0') == '1') $paramsObj->set('source', 'hikashop'); if ($paramsObj->get('carouselckjoomgallery_enable', '0') == '1') $paramsObj->set('source', 'joomgallery'); if ($paramsObj->get('carouselckk2_enable', '0') == '1') $paramsObj->set('source', 'k2'); $newparams = json_encode($paramsObj); $data = CKFof::dbLoad('#__modules', $id); $data->id = $id; $data->params = $newparams; $return = CKFof::dbStore('#__modules', $data); if ($return) { CKfof::enqueueMessage(CKText::_('CAROUSELCK_MIGRATION_SUCCESS'), 'success'); } else { CKfof::enqueueMessage(CKText::_('CAROUSELCK_MIGRATION_ERROR'), 'error'); } CKfof::redirect(); } protected function makeBackup($id, $params) { $path = JPATH_ROOT . '/administrator/components/com_carouselck/backup/'; // create the folder if (! CKFolder::exists($path)) { CKFolder::create($path); } $exportfiledest = $path . '/backup_' . $id . '_' . date("d-m-Y-G-i-s") . '.ssck'; CKFile::write($exportfiledest, $params); } } carouselck-light/administrator/elements/ckpro.php <?php /** * @copyright Copyright (C) 2017 Cedric KEIFLIN alias ced1870 * https://www.joomlack.fr * @license GNU/GPL * */ // no direct access defined('JPATH_PLATFORM') or die; class JFormFieldCkpro extends JFormField { protected $type = 'ckpro'; private $state; protected function getLabel() { return ''; } protected function getInput() { $html = array(); // Add the label text and closing tag. $html[] = '<div id="' . $this->id . '-lbl" class="ckinfo">'; $html[] = '<i class="fas fa-info" style="color:green"></i>'; $html[] = JText::_('CAROUSELCK_USE_PRO_VERSION'); $html[] = ' <a href="https://www.joomlack.fr/en/documentation/miscellaneous/202-license-code" target="_blank">'; $html[] = '<span class="cklabel cklabel-info"><i class="fas fa-link"></i> ' . JText::_('CAROUSELCK_GET_LICENCE_INFOS') . '</label>'; $html[] = '</a>'; $html[] = '</div>'; return implode('', $html); } } carouselck-light/administrator/elements/ckproducts.php <?php /** * @copyright Copyright (C) 2017 Cedric KEIFLIN alias ced1870 * https://www.joomlack.fr * @license GNU/GPL * */ // no direct access defined('JPATH_PLATFORM') or die; class JFormFieldCkproducts extends JFormField { protected $type = 'ckproducts'; protected function getLabel() { return ''; } protected function getInput() { $html = '<style> .ckproduct { padding: 10px 20px; display: inline-block; color: #1f496e; border: 1px solid #1f496e; margin: 3px; border-radius: 2px; transition: 0.3s all; } .ckproduct:hover { background: #1f496e; color: #fff; text-decoration: none; } </style> <h3>' . JText::_('CAROUSELCK_VISIT_OTHER_PRODUCTS') . '</h3> <div> <a class="ckproduct" target="_blank" href="https://www.joomlack.fr/en/joomla-extensions/accordeonmenu-ck">Accordeon Menu CK</a> <a class="ckproduct" target="_blank" href="https://www.joomlack.fr/en/joomla-extensions/beautiful-ck">Beautiful CK</a>' //<a class="ckproduct" target="_blank" href="https://www.joomlack.fr/en/joomla-extensions/carousel-ck">Carousel CK</a> . '<a class="ckproduct" target="_blank" href="https://www.joomlack.fr/en/download-joomla-extensions/view_category/37-cookies-ck">Cookies CK</a> <a class="ckproduct" target="_blank" href="https://www.joomlack.fr/en/joomla-extensions/floating-module-ck">Floating Module CK</a> <a class="ckproduct" target="_blank" href="https://www.joomlack.fr/en/joomla-extensions/image-effect-ck">Image Effect CK</a> <a class="ckproduct" target="_blank" href="https://www.joomlack.fr/en/joomla-extensions/maximenu-ck">Maximenu CK</a> <a class="ckproduct" target="_blank" href="https://www.joomlack.fr/en/joomla-extensions/mediabox-ck">Mediabox CK</a> <a class="ckproduct" target="_blank" href="https://www.joomlack.fr/en/joomla-extensions/menu-manager-ck">Menu Manager CK</a> <a class="ckproduct" target="_blank" href="https://www.joomlack.fr/extensions-joomla/mobile-menu-ck">Mobile Menu CK</a> <a class="ckproduct" target="_blank" href="https://www.joomlack.fr/en/joomla-extensions/modules-manager-ck">Modules Manager CK</a> <a class="ckproduct" target="_blank" href="https://www.joomlack.fr/en/joomla-extensions/page-builder-ck">Page Builder CK</a> <a class="ckproduct" target="_blank" href="https://www.joomlack.fr/en/joomla-extensions/scroll-to-ck">Scroll To CK</a> <a class="ckproduct" target="_blank" href="https://www.joomlack.fr/en/joomla-extensions/slideshow-ck">Slideshow CK</a> <a class="ckproduct" target="_blank" href="https://www.joomlack.fr/extensions-joomla/tooltip-gc">Tooltip CK</a> <a class="ckproduct" target="_blank" href="https://www.template-creator.com">Template Creator CK</a> <a class="ckproduct" target="_blank" href="https://www.joomlack.fr">And more...</a> </div>'; return $html; } } carouselck-light/administrator/elements/ckproonly.php <?php /** * @copyright Copyright (C) 2017 Cedric KEIFLIN alias ced1870 * http://www.joomlack.fr * @license GNU/GPL * */ defined('JPATH_PLATFORM') or die; class JFormFieldCkproonly extends JFormField { /** * The form field type. * * @var string * */ protected $type = 'ckproonly'; /** * Method to get the field input markup. * * @return string The field input markup. * */ protected function getLabel() { return ''; } /** * Method to get the field label markup. * * @return string The field label markup. * */ protected function getInput() { $html = '<div class="ckinfo"><i class="fas fa-info"></i><a href="https://www.joomlack.fr/en/joomla-extensions/carousel-ck" target="_blank">' . JText::_('CAROUSELCK_ONLY_PRO') . '</a></div>'; return $html; } /* * Get a variable from the manifest file * * @return the current version */ public static function getCurrentVersion($file_url) { // get the version installed $installed_version = 'UNKOWN'; if ($xml_installed = simplexml_load_file($file_url)) { $installed_version = (string)$xml_installed->version; } return $installed_version; } } carouselck-light/administrator/elements/ckradio.php <?php /** * @copyright Copyright (C) 2011 Cedric KEIFLIN alias ced1870 * https://www.joomlack.fr * @license GNU/GPL * */ defined('JPATH_PLATFORM') or die; class JFormFieldCkradio extends JFormFieldRadio { protected $type = 'ckradio'; protected function getInput() { // Initialize some field attributes. $icon = $this->element['icon']; $suffix = $this->element['suffix']; $html = $icon ? '<div class="carouselck-field-icon" ' . ($suffix ? 'data-has-suffix="1"' : '') . '><img src="' . CAROUSELCK_MEDIA_URI . '/images/' . $icon . '" style="margin-right:5px;" /></div>' : '<div style="display:inline-block;width:20px;"></div>'; $html .= parent::getInput(); if ($suffix) $html .= '<span class="carouselck-field-suffix">' . $suffix . '</span>'; return $html; } protected function getOptions() { $options = parent::getOptions(); foreach ($options as $option) { if (stristr($option->text, "img:")) $option->text = '<img src="' . CAROUSELCK_MEDIA_URI . '/images/' . str_replace("img:", "", $option->text) . '" style="margin:0; float:none;" />'; } return $options; } } carouselck-light/administrator/elements/ckslidesmanager.php <?php /** * @copyright Copyright (C) 2011 Cedric KEIFLIN alias ced1870 * https://www.joomlack.fr * @license GNU/GPL * */ // no direct access defined('_JEXEC') or die('Restricted access'); require_once JPATH_ADMINISTRATOR . '/components/com_carouselck/helpers/ckframework.php'; require_once JPATH_ADMINISTRATOR . '/components/com_carouselck/helpers/helper.php'; Carouselck\CKFramework::load(); CarouselckHelper::loadCkbox(); JText::script('CAROUSELCK_ADDSLIDE'); JText::script('CAROUSELCK_SELECTIMAGE'); JText::script('CAROUSELCK_SELECT_LINK'); JText::script('CAROUSELCK_REMOVE2'); JText::script('CAROUSELCK_SELECT'); JText::script('CAROUSELCK_CAPTION'); JText::script('CAROUSELCK_USETOSHOW'); JText::script('CAROUSELCK_IMAGE'); JText::script('CAROUSELCK_VIDEO'); JText::script('CAROUSELCK_TEXTOPTIONS'); JText::script('CAROUSELCK_IMAGEOPTIONS'); JText::script('CAROUSELCK_LINKOPTIONS'); JText::script('CAROUSELCK_VIDEOOPTIONS'); JText::script('CAROUSELCK_ALIGNEMENT_LABEL'); JText::script('CAROUSELCK_TOPLEFT'); JText::script('CAROUSELCK_TOPCENTER'); JText::script('CAROUSELCK_TOPRIGHT'); JText::script('CAROUSELCK_MIDDLELEFT'); JText::script('CAROUSELCK_CENTER'); JText::script('CAROUSELCK_MIDDLERIGHT'); JText::script('CAROUSELCK_BOTTOMLEFT'); JText::script('CAROUSELCK_BOTTOMCENTER'); JText::script('CAROUSELCK_BOTTOMRIGHT'); JText::script('CAROUSELCK_LINK'); JText::script('CAROUSELCK_TARGET'); JText::script('CAROUSELCK_SAMEWINDOW'); JText::script('CAROUSELCK_NEWWINDOW'); JText::script('CAROUSELCK_VIDEOURL'); JText::script('CAROUSELCK_REMOVE'); JText::script('CAROUSELCK_IMPORTFROMFOLDER'); JText::script('CAROUSELCK_ARTICLEOPTIONS'); JText::script('CAROUSELCK_SLIDETIME'); JText::script('CAROUSELCK_CLEAR'); JText::script('CAROUSELCK_SELECT'); JText::script('CAROUSELCK_TITLE'); JText::script('CAROUSELCK_STARTDATE'); JText::script('CAROUSELCK_ENDDATE'); JText::script('CAROUSELCK_SAVE'); JText::script('CAROUSELCK_TEXT_CUSTOM'); JText::script('CAROUSELCK_ARTICLE'); JText::script('CAROUSELCK_TEXT'); class JFormFieldCkslidesmanager extends JFormField { protected $type = 'ckslidesmanager'; protected function getInput() { // loads the language files from the frontend $lang = JFactory::getLanguage(); $lang->load('com_carouselck', JPATH_SITE . '/components/com_carouselck', $lang->getTag(), false); $lang->load('com_carouselck', JPATH_SITE, $lang->getTag(), false); require_once(JPATH_ROOT . '/administrator/components/com_carouselck/helpers/defines.js.php'); $path = 'media/com_carouselck/assets/elements/ckslidesmanager/'; JHtml::_('jquery.framework'); // JHtml::_('jquery.ui', array('core', 'sortable')); JHTML::_('script', 'media/com_carouselck/assets/jquery-uick-custom.js'); JHTML::_('script', 'media/com_carouselck/assets/admin.js'); JHTML::_('script', $path . 'ckslidesmanager.js'); if (\Carouselck\CKFof::isSite()) { JHTML::_('stylesheet', 'media/com_carouselck/assets/front-edition.css'); } JHTML::_('stylesheet', 'media/com_carouselck/assets/jquery-ui.min.css'); JHTML::_('stylesheet', $path . 'ckslidesmanager.css'); $html = '<input name="' . $this->name . '" id="ckslides" type="hidden" value="' . $this->value . '" />' . '<div class="ckaddslide ckbutton ckbutton-success" onclick="javascript:ckAddSlide();"><i class="far fa-plus-square"></i> ' . JText::_('CAROUSELCK_ADDSLIDE') . '</div>' . '<ul id="ckslideslist" class="ckinterface" style="clear:both;"></ul>' . '<div class="ckaddslide ckbutton ckbutton-success" onclick="javascript:ckAddSlide();"><i class="far fa-plus-square"></i> ' . JText::_('CAROUSELCK_ADDSLIDE') . '</div>'; return $html; } protected function getLabel() { return ''; } // protected function getArticlesList() { // $db = & JFactory::getDBO(); // // $query = "SELECT id, title FROM #__content WHERE state = 1 LIMIT 2;"; // $db->setQuery($query); // $row = $db->loadObjectList('id'); // var_dump($row); // return json_encode($row); // } } carouselck-light/administrator/elements/cksource.php <?php /** * @copyright Copyright (C) 2019 Cedric KEIFLIN alias ced1870 * https://www.joomlack.fr * @license GNU/GPL * */ defined('JPATH_PLATFORM') or die; class JFormFieldCksource extends JFormFieldList { protected $type = 'cksource'; private $options; function __construct($form = null) { parent::__construct($form); } /** * Method to get the field options. * * @return array The field option objects. * * @since 11.1 */ protected function getOptions() { $options = array(); foreach ($this->element->children() as $option) { // Only add <option /> elements. if ($option->getName() != 'option') { continue; } // Create a new option object based on the <option /> element. $tmp = JHtml::_( 'select.option', (string) $option['value'], JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)), 'value', 'text', ((string) $option['disabled'] == 'true') ); // Set some option attributes. $tmp->class = (string) $option['class']; // Set some JavaScript option attributes. $tmp->onclick = (string) $option['onclick']; // Add the option object to the result set. $options[] = $tmp; } $this->options = $options; // load the custom plugins if (JPluginHelper::isEnabled('system', 'carouselck')) { // load the custom plugins require_once(JPATH_ADMINISTRATOR . '/components/com_carouselck/helpers/ckfof.php'); Carouselck\CKFof::importPlugin('carouselck'); $sources = Carouselck\CKFof::triggerEvent('onCarouselckGetSourceName'); if (count($sources)) { foreach ($sources as $source) { if (! $this->findOption($source)) { $tmp = JHtml::_( 'select.option', (string) $source, JText::alt(trim((string) 'CAROUSELCK_SOURCE_' . strtoupper($source)), preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)), 'value', 'text', '0' ); // Add the option object to the result set. $this->options[] = $tmp; } } } } reset($this->options); return $this->options; } public function findOption($source) { foreach ($this->options as $o) { if ($o->value == $source) return true; } return false; } } carouselck-light/administrator/elements/ckspacer.php <?php /** * @copyright Copyright (C) 2011 Cedric KEIFLIN alias ced1870 * https://www.joomlack.fr * @license GNU/GPL * */ // no direct access defined('_JEXEC') or die('Restricted access'); class JFormFieldCkspacer extends JFormField { protected $type = 'ckspacer'; protected function getLabel() { return ''; } protected function getInput() { $html = array(); $class = $this->element['class'] ? (string) $this->element['class'] : ''; $style = $this->element['style'] ? $this->element['style'] : ''; if ($style == 'title') { $doc = JFactory::getDocument(); $styles = '.ckinfo.cktitle { background:#666; color: #eee; text-transform: uppercase; } '; $doc->addStyleDeclaration($styles); } if ((string) $this->element['hr'] == 'true') { $html[] = '<hr class="' . $class . '" />'; } else { $label = ''; // Get the label text from the XML element, defaulting to the element name. $text = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name']; $text = $this->translateLabel ? JText::_($text) : $text; // Test to see if the patch is installed $testpatch = $this->element['testpatch'] ? $this->testPatch($this->element['testpatch']) : null; $text = $testpatch ? $testpatch : $text; // set the icon $icon = $this->element['icon'] ? $this->element['icon'] : 'info'; $html[] = '<div class="ckinfo' . ($style == 'title' ? ' cktitle' : '') . '">' . ($style == 'title' ? '' : '<i class="fas fa-' . $icon . '"></i>') . $text . '</div>'; } return implode('', $html); } } carouselck-light/administrator/elements/ckstyle.php <?php /** * @copyright Copyright (C) 2016 Cedric KEIFLIN alias ced1870 * http://www.joomlack.fr * @license GNU/GPL * */ defined('JPATH_PLATFORM') or die; JText::script('CAROUSELCK_SAVE_CLOSE'); require_once JPATH_ROOT . '/administrator/components/com_carouselck/helpers/helper.php'; class JFormFieldCkstyle extends JFormField { protected $type = 'ckstyle'; protected function getInput() { $doc = JFactory::getDocument(); // Initialize some field attributes. $js = 'function ckSelectStyle(id, name, close) { if (!close && close != false) close = true; jQuery("#' . $this->id . '").val(id); jQuery("#' . $this->id . 'name").val(name); if (close) CKBox.close(); }'; $doc->addScriptDeclaration($js); $icon = $this->element['icon']; $suffix = $this->element['suffix']; $size = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; $maxLength = $this->element['maxlength'] ? ' maxlength="' . (int) $this->element['maxlength'] . '"' : ''; $class = $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : ''; $readonly = ((string) $this->element['readonly'] == 'true') ? ' readonly="readonly"' : ''; $disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : ''; $defautlwidth = $suffix ? '128px' : '150px'; $styles = ' style="width:'.$defautlwidth.';'.$this->element['styles'].'"'; $styleName = CarouselckHelper::getStyleNameById($this->value); // Initialize JavaScript field attributes. $onchange = $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; $html = $icon ? '<div style="display:inline-block;vertical-align:top;margin-top:4px;width:20px;"><img src="' . CAROUSELCK_MEDIA_URI . '/images/' . $icon . '" style="margin-right:5px;" /></div>' : '<div style="display:inline-block;width:20px;"></div>'; $html .= '<div class="ckbutton-group">'; $html .= '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . $class . $size . $disabled . $readonly . $onchange . $maxLength . $styles . '/>'; $html .= '<input type="text" disabled name="' . $this->name . 'name" id="' . $this->id . 'name"' . ' value="' . htmlspecialchars($styleName) . '"' . $class . $size . $disabled . $readonly . $onchange . $maxLength . $styles . '/>'; $footerHtml = '<a class="ckboxmodal-button" href="javascript:void(0)" onclick="ckSaveIframe(\'test\')">' . JText::_('CK_CREATE_NEW') . '</a>'; $html .= '<div class="ckbutton" onclick="CKBox.open({url: \'index.php?option=com_carouselck&view=styles&tmpl=component&layout=modal\', style: {padding: \'0px\'}})"><i class="fas fa-mouse-pointer "></i> ' . JText::_('CAROUSELCK_SELECT') . '</div>'; $html .= '<div class="ckbutton" onclick="CKBox.open({url: \'index.php?option=com_carouselck&view=style&tmpl=component&layout=modal&id=\'+jQuery(\'#' . $this->id . '\').val()+\'\'})"><i class="fas fa-edit"></i> ' . JText::_('CAROUSELCK_EDIT') . '</div>'; $html .= '<div class="ckbutton cktip" onclick="jQuery(\'#' . $this->id . '\').val(\'\');jQuery(\'#' . $this->id . 'name\').val(\'\');" title="' . JText::_('CAROUSELCK_REMOVE') . '"><i class="fas fa-times"></i></div>'; $html .= '</div>'; return $html; } } carouselck-light/administrator/elements/cktext.php <?php /** * @copyright Copyright (C) 2011-2019 Cedric KEIFLIN alias ced1870 * https://www.joomlack.fr * @license GNU/GPL * */ defined('JPATH_PLATFORM') or die; class JFormFieldCktext extends JFormFieldText { /** * The form field type. * * @var string * * @since 11.1 */ protected $type = 'cktext'; /** * Method to get the field input markup. * * @return string The field input markup. * * @since 11.1 */ protected function getInput() { // Initialize some field attributes. $icon = $this->element['icon']; $suffix = $this->element['suffix']; $html = $icon ? '<div class="carouselck-field-icon" ' . ($suffix ? 'data-has-suffix="1"' : '') . '><img src="' . CAROUSELCK_MEDIA_URI . '/images/' . $icon . '" style="margin-right:5px;" /></div>' : '<div class="carouselck-field-icon"></div>'; $html .= parent::getInput(); if ($suffix) $html .= '<span class="carouselck-field-suffix">' . $suffix . '</span>'; return $html; } } carouselck-light/administrator/export/index.html carouselck-light/administrator/extensions/mod_carouselck/helper.php <?php /** * @copyright Copyright (C) 2011 Cedric KEIFLIN alias ced1870 * https://www.joomlack.fr * Module Carousel CK * @license GNU/GPL * */ // no direct access defined('_JEXEC') or die; /** * NOTE : THIS FILE IS USED FOR B/C OF THE V1 FEATURES ONLY !! */ // $com_path = JPATH_SITE . '/components/com_content/'; // require_once $com_path . 'router.php'; // require_once $com_path . 'helpers/route.php'; // JModelLegacy::addIncludePath($com_path . '/models', 'ContentModel'); jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); class modCarouselckHelper { private static $_params; private static $folderLabels = array(); private static $imagesOrderByLabels = array(); /** * Get a list of the items. * * @param JRegistry $params The module options. * * @return array */ static function getItems(&$params) { // Initialise variables. self::$_params = $params; $db = JFactory::getDbo(); $document = JFactory::getDocument(); // load the libraries //jimport('joomla.application.module.helper'); $items = json_decode(str_replace("|qq|", "\"", $params->get('slides'))); foreach ($items as $i => $item) { if (!$item->imgname) { unset($items[$i]); continue; } // check if the slide is published if (isset($item->state) && $item->state == '0') { unset($items[$i]); continue; } // check the slide start date if (isset($item->startdate) && $item->startdate) { // if (date("d M Y") < $item->startdate) { if (time() < strtotime($item->startdate)) { unset($items[$i]); continue; } } // check the slide end date if (isset($item->enddate) && $item->enddate) { // if (date("d M Y") > $item->enddate) { if (time() > strtotime($item->enddate)) { unset($items[$i]); continue; } } if (isset($item->slidearticleid) && $item->slidearticleid) { $item = self::getArticle($item, $params); } else { $item->article = null; } // create new images for mobile if ($params->get('usemobileimage', '0')) { $resolutions = explode(',', $params->get('mobileimageresolution', '640')); foreach ($resolutions as $resolution) { self::resizeImage($item->imgname, (int)$resolution, '', (int)$resolution, ''); } } if (stristr($item->imgname, "http")) { $item->imgthumb = $item->imgname; } else { // renomme le fichier $thumbext = explode(".", $item->imgname); $thumbext = end($thumbext); // crée la miniature if ($params->get('thumbnails', '1') == '1' && $params->get('autocreatethumbs','1')) { $item->imgthumb = JURI::base(true) . '/' . self::resizeImage($item->imgname, $params->get('thumbnailwidth', '182'), $params->get('thumbnailheight', '187')); } else { $thumbfile = str_replace(JFile::getName($item->imgname), "th/" . JFile::getName($item->imgname), $item->imgname); $thumbfile = str_replace("." . $thumbext, "_th." . $thumbext, $thumbfile); $item->imgthumb = JURI::base(true) . '/' . $thumbfile; } $item->imgname = JURI::base(true) . '/' . $item->imgname; } // set the videolink if ($item->imgvideo) $item->imgvideo = self::setVideolink($item->imgvideo); // manage the title and description if (stristr($item->imgcaption, "||")) { $splitcaption = explode("||", $item->imgcaption); $item->imgcaption = '<div class="carouselck_title">' . $splitcaption[0] . '</div><div class="carouselck_description">' . $splitcaption[1] . '</div>'; } // route the url if (strcasecmp(substr($item->imglink, 0, 4), 'http') && (strpos($item->imglink, 'index.php?') !== false)) { $item->imglink = JRoute::_($item->imglink, true, false); } else { $item->imglink = JRoute::_($item->imglink); } if (!isset($item->imgtitle)) $item->imgtitle = ''; } return $items; } static function getArticle(&$item, $params) { self::$_params = $params; // Access filter $access = !JComponentHelper::getParams('com_content')->get('show_noauth'); $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id')); // Get an instance of the generic articles model $articles = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true)); // Set application parameters in model $app = JFactory::getApplication(); $appParams = $app->getParams(); $articles->setState('params', $appParams); $articles->setState('filter.published', 1); $articles->setState('filter.article_id', $item->slidearticleid); $items2 = $articles->getItems(); $item->article = $items2[0]; // $item->article->text = JHTML::_('content.prepare', $item->article->introtext); $item->article->text = $item->article->introtext; $item->article->text = self::truncate($item->article->text, $params->get('articlelength', '150')); // $item->article->text = JHTML::_('string.truncate',$item->article->introtext,'150'); // set the item link to the article depending on the user rights if ($access || in_array($item->article->access, $authorised)) { // We know that user has the privilege to view the article $item->slug = $item->article->id . ':' . $item->article->alias; $item->catslug = $item->article->catid ? $item->article->catid . ':' . $item->article->category_alias : $item->article->catid; $item->article->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug)); } else { $app = JFactory::getApplication(); $menu = $app->getMenu(); $menuitems = $menu->getItems('link', 'index.php?option=com_users&view=login'); if (isset($menuitems[0])) { $Itemid = $menuitems[0]->id; } elseif (JRequest::getInt('Itemid') > 0) { $Itemid = JRequest::getInt('Itemid'); } $item->article->link = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $Itemid); } return $item; } /** * Get a list of the items. * * @param JRegistry $params The module options. * * @return array */ static function getItemsFromfolder(&$params) { self::$_params = $params; $authorisedExt = array('png', 'jpg', 'JPG', 'JPEG', 'jpeg', 'bmp', 'tiff', 'gif'); $items = json_decode(str_replace("|qq|", "\"", $params->get('slidesfromfolder'))); foreach ($items as & $item) { // $item->imgname = str_replace(JUri::base(), '', $item->imgname); $item->imgthumb = ''; $item->imgname = trim($item->imgname, '/'); $item->imgname = trim($item->imgname, '\\'); // create new images for mobile if ($params->get('usemobileimage', '0')) { self::resizeImage($item->imgname, $params->get('mobileimageresolution', '640'), '', $params->get('mobileimageresolution', '640'), ''); } if ($params->get('thumbnails', '1') == '1') $item->imgthumb = JURI::base(true) . '/' . self::resizeImage($item->imgname, $params->get('thumbnailwidth', '100'), $params->get('thumbnailheight', '75')); $thumbext = explode(".", $item->imgname); $thumbext = end($thumbext); // set the variables $item->imgvideo = null; $item->slideselect = null; $item->slideselect = null; $item->imgcaption = null; $item->article = null; $item->slidearticleid = null; $item->imgalignment = null; $item->imgtarget = 'default'; $item->imgtime = null; $item->imglink = null; $item->imgtitle = null; if (!in_array(strToLower(JFile::getExt($item->imgname)), $authorisedExt)) continue; // load the image data from txt $item = self::getImageDataFromfolder($item, $params); $item->imgname = JURI::base(true) . '/' . $item->imgname; // route the url if (strcasecmp(substr($item->imglink, 0, 4), 'http') && (strpos($item->imglink, 'index.php?') !== false)) { $item->imglink = JRoute::_($item->imglink, true, false); } else { $item->imglink = JRoute::_($item->imglink); } } return $items; } static function getItemsAutoloadfolder(&$params) { self::$_params = $params; $authorisedExt = array('png', 'jpg', 'JPG', 'JPEG', 'jpeg', 'bmp', 'tiff', 'gif'); $folder = trim($params->get('autoloadfoldername'), '/'); if (file_exists($folder . '/labels.txt')) { $items = self::loadImagesFromFolder($folder); } else { $items = JFolder::files($folder, '.jpg|.png|.jpeg|.gif|.JPG|.JPEG|.jpeg', false, true); foreach ($items as $i => $name) { $item = new stdClass(); // $item->imgname = str_replace(JUri::base(),'', $item->imgname); $item->imgthumb = ''; $item->imgname = trim(str_replace('\\','/',$name), '/'); $item->imgname = trim($item->imgname, '\\'); // create new images for mobile if ($params->get('usemobileimage', '0')) { self::resizeImage($item->imgname, $params->get('mobileimageresolution', '640'), '', $params->get('mobileimageresolution', '640'), ''); } if ($params->get('thumbnails', '1') == '1') $item->imgthumb = JURI::base(true) . '/' . self::resizeImage($item->imgname, $params->get('thumbnailwidth', '100'), $params->get('thumbnailheight', '75')); $thumbext = explode(".", $item->imgname); $thumbext = end($thumbext); // set the variables $item->imgvideo = null; $item->slideselect = null; $item->slideselect = null; $item->imgcaption = null; $item->article = null; $item->slidearticleid = null; $item->imgalignment = null; $item->imgtarget = 'default'; $item->imgtime = null; $item->imglink = null; $item->imgtitle = null; if (!in_array(strToLower(JFile::getExt($item->imgname)), $authorisedExt)) continue; // load the image data from txt $item = self::getImageDataFromfolder($item, $params); $item->imgname = JURI::base(true) . '/' . $item->imgname; $items[$i] = $item; // route the url if (strcasecmp(substr($item->imglink, 0, 4), 'http') && (strpos($item->imglink, 'index.php?') !== false)) { $item->imglink = JRoute::_($item->imglink, true, false); } else { $item->imglink = JRoute::_($item->imglink); } } } return $items; } /* * Load the image from the specified folder */ public static function loadImagesFromFolder($directory) { // encode the folder path, needed if contains an accent try { $translatedDirectory = iconv("UTF-8", "ISO-8859-1//TRANSLIT", urldecode($directory)); if ($translatedDirectory) $directory = $translatedDirectory; } catch (Exception $e) { echo 'CK Message : ', $e->getMessage(), "\n"; } // load the files from the folder $files = JFolder::files(trim(trim($directory), '/'), '.', false, true); if (! $files) return 'CK message : No files found in the directory : ' . $directory; self::$imagesOrderByLabels = array(); // load the labels from the folder self::getImageLabelsFromFolder($directory); $order = self::$_params->get('displayorder'); // set the images order if ($order == 'shuffle') { shuffle($files); } else // if(isset($params->order) && $params->order == 'labels') { natsort($files); $files = array_map(array(__CLASS__, 'formatPath'), $files); $baseDir = self::formatPath($directory); $labelsOrder = array_reverse(self::$imagesOrderByLabels); foreach ($labelsOrder as $name) { $imgFile = $baseDir . '/' . $name; array_unshift($files, $imgFile); } // now make it unique $files = array_unique($files); } // else { // natsort($files); // } $authorisedExt = array('png','jpg','jpeg','bmp','tiff','gif'); $items = array(); $i = 0; foreach ($files as $file) { $fileExt = JFile::getExt($file); if (!in_array(strToLower($fileExt),$authorisedExt)) continue; $item = new stdClass(); // set the variables $item->imgvideo = null; $item->slideselect = null; $item->slideselect = null; $item->imgcaption = null; $item->article = null; $item->slidearticleid = null; $item->imgalignment = null; $item->imgtarget = 'default'; $item->imgtime = null; $item->imglink = null; $item->imgtitle = null; // limit the number of images // if (isset($params->number) && $params->number > 0 && $i > (int)$params->number) $show = false; // get the data for the image $filedata = self::getImageDataFromfolder2($file, $directory); $file = str_replace("\\", "/", utf8_encode($file)); if (isset($filedata->link) && $filedata->link) { $item->imglink = $filedata->link; } else { $videoFile = str_replace($fileExt, 'mp4', $file); $hasVideo = file_exists($videoFile); $item->imglink = $hasVideo ? $videoFile : $file; } $item->imgname = JURI::base(true) . '/' . $file; $item->imgthumb = $item->imgname; $item->imgtitle = $filedata->title; $item->imgcaption = $filedata->desc; $item->imgvideo = $filedata->video; // $linktitle = $filedata->title || $filedata->desc ? ($filedata->desc ? $filedata->title . '::' . $filedata->desc : $filedata->title) : $title; $items[$i] = $item; $i++; } return $items; } /* * Remove special character */ private static function cleanName($path) { return preg_replace('/[^a-z0-9]/i', '_', $path); } public static function formatPath($p) { return trim(str_replace("\\", "/", $p), "/"); } private static function getImageLabelsFromFolder($directory) { $dirindex = self::cleanName($directory); if (! empty(self::$folderLabels[$dirindex])) return; $items = array(); $item = new stdClass(); // get the language $lang = JFactory::getLanguage(); $langtag = $lang->getTag(); // returns fr-FR or en-GB // load the image data from txt if (file_exists(JPATH_ROOT . '/' . $directory . '/labels.' . $langtag . '.txt')) { $data = file_get_contents(JPATH_ROOT . '/' . $directory . '/labels.' . $langtag . '.txt'); } else if (file_exists(JPATH_ROOT . '/' . $directory . '/labels.txt')) { $data = file_get_contents(JPATH_ROOT . '/' . $directory . '/labels.txt'); } else { return null; } $doUTF8encode = true; // remove UTF-8 BOM and normalize line endings if (!strcmp("\xEF\xBB\xBF", substr($data,0,3))) { // file starts with UTF-8 BOM $data = substr($data, 3); // remove UTF-8 BOM $doUTF8encode = false; } $data = str_replace("\r", "\n", $data); // normalize line endings // if no data found, exit if(! $data) return null; // explode the file into rows // $imgdatatmp = explode("\n", $data); $imgdatatmp = preg_split("/\r\n|\n|\r/", $data, -1, PREG_SPLIT_NO_EMPTY); $parmsnumb = count($imgdatatmp); for ($i = 0; $i < $parmsnumb; $i++) { $imgdatatmp[$i] = trim($imgdatatmp[$i]); $line = explode('|', $imgdatatmp[$i]); // store the order or files from the TXT file self::$imagesOrderByLabels[] = $line[0]; $item = new stdClass(); $item->index = self::cleanName($line[0]); $item->title = (isset($line[1])) ? ( $doUTF8encode ? (utf8_encode($line[1])) : ($line[1]) ) : ''; $item->desc = (isset($line[2])) ? ( $doUTF8encode ? (utf8_encode($line[2])) : ($line[2]) ) : ''; $item->link = (isset($line[3])) ? ( $doUTF8encode ? (utf8_encode($line[3])) : ($line[3]) ) : ''; $item->video = (isset($line[4])) ? ( $doUTF8encode ? (utf8_encode($line[4])) : ($line[4]) ) : ''; $items[$item->index] = $item; } self::$folderLabels[$dirindex] = $items; } /* * Load the data for the image (title and description) */ private static function getImageDataFromfolder2($file, $directory) { $filename = explode('/', $file); $filename = end($filename); $dirindex = self::cleanName($directory); $fileindex = self::cleanName($filename); if (! empty(self::$folderLabels[$dirindex]) && ! empty(self::$folderLabels[$dirindex][$fileindex])) { $item = self::$folderLabels[$dirindex][$fileindex]; } else { $item = new stdClass(); $item->title = null; $item->desc = null; $item->video = null; // old method, get image data from txt file with image name // TODO : remove // $item = self::getImageDataFromImageTxt($file) } return $item; } /** * Get a list of the items. * * @param JRegistry $params The module options. * * @return array */ static function getItemsAutoloadflickr(&$params) { self::$_params = $params; $url = 'https://api.flickr.com/services/rest/?format=json&method=flickr.photosets.getPhotos&extras=description,original_format,url_sq,url_t,url_s,url_m,url_o&nojsoncallback=1'; $url .= '&api_key=' . $params->get('flickr_apikey'); $url .= '&photoset_id=' . $params->get('flickr_photoset'); if (ini_get('allow_url_fopen') && function_exists('file_get_contents')) { $result = file_get_contents($url); } // look for curl if ($result == '' && extension_loaded('curl')) { $ch = curl_init(); $timeout = 30; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $result = curl_exec($ch); curl_close($ch); } $images = json_decode($result)->photoset->photo; $items = Array(); $i = 0; $flickrSuffixes = array('o', 'k', 'h', 'b', 'z', 'sq', 't', 'sm', 'm'); foreach ($images as & $image) { $items[$i] = new stdClass(); $item = $items[$i]; $suffix = 'o'; foreach ($flickrSuffixes as $flickrSuffixe) { if (isset($image->{'url_' . $flickrSuffixe})) { $suffix = $flickrSuffixe; break; } } $item->imgname = $image->{'url_' . $suffix}; $item->imgthumb = $item->imgname; // create new images for mobile // if ($params->get('usemobileimage', '0')) { // self::resizeImage($item->imgname, $params->get('mobileimageresolution', '640'), '', $params->get('mobileimageresolution', '640'), ''); // } // if ($params->get('thumbnails', '1') == '1') // $item->imgthumb = JURI::base(true) . '/' . self::resizeImage($item->imgname, $params->get('thumbnailwidth', '100'), $params->get('thumbnailheight', '75')); // $thumbext = explode(".", $item->imgname); // $thumbext = end($thumbext); // set the variables $item->imgvideo = null; $item->slideselect = null; $item->slideselect = null; $item->imgcaption = null; $item->article = null; $item->slidearticleid = null; $item->imgalignment = null; $item->imgtarget = 'default'; $item->imgtime = null; $item->imglink = null; $item->imgtitle = null; // show the title and description of the image if ($params->get('flickr_showcaption', '1')) { $item->imgtitle = $image->title; $item->imgcaption = $image->description->_content; } // set the link to the image if ($params->get('flickr_autolink', '0')) { $item->imglink = $image->{'url_' . $suffix}; } $i++; } return $items; } static function getItemsAutoloadarticlecategory(&$params) { $com_path = JPATH_SITE . '/components/com_content/'; require_once $com_path . 'router.php'; require_once $com_path . 'helpers/route.php'; JModelLegacy::addIncludePath($com_path . '/models', 'ContentModel'); // Get an instance of the generic articles model $articles = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true)); // Set application parameters in model $app = JFactory::getApplication(); $appParams = $app->getParams(); $articles->setState('params', $appParams); // Set the filters based on the module params $articles->setState('list.start', 0); // $articles->setState('list.limit', (int) $params->get('count', 0)); // must check if the image exists $articles->setState('list.limit', 0); $articles->setState('filter.published', 1); // Access filter $access = !JComponentHelper::getParams('com_content')->get('show_noauth'); $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id')); $articles->setState('filter.access', $access); // Prep for Normal or Dynamic Modes $mode = $params->get('mode', 'normal'); switch ($mode) { case 'dynamic': $option = JRequest::getCmd('option'); $view = JRequest::getCmd('view'); if ($option === 'com_content') { switch($view) { case 'category': $catids = array(JRequest::getInt('id')); break; case 'categories': $catids = array(JRequest::getInt('id')); break; case 'article': if ($params->get('show_on_article_page', 1)) { $article_id = JRequest::getInt('id'); $catid = JRequest::getInt('catid'); if (!$catid) { // Get an instance of the generic article model $article = JModelLegacy::getInstance('Article', 'ContentModel', array('ignore_request' => true)); $article->setState('params', $appParams); $article->setState('filter.published', 1); $article->setState('article.id', (int) $article_id); $item = $article->getItem(); $catids = array($item->catid); } else { $catids = array($catid); } } else { // Return right away if show_on_article_page option is off return; } break; case 'featured': default: // Return right away if not on the category or article views return; } } else { // Return right away if not on a com_content page return; } break; case 'normal': default: $catids = $params->get('catid'); $articles->setState('filter.category_id.include', (bool) $params->get('category_filtering_type', 1)); break; } // Category filter if ($catids) { if ($params->get('show_child_category_articles', 0) && (int) $params->get('levels', 0) > 0) { // Get an instance of the generic categories model $categories = JModelLegacy::getInstance('Categories', 'ContentModel', array('ignore_request' => true)); $categories->setState('params', $appParams); $levels = $params->get('levels', 1) ? $params->get('levels', 1) : 9999; $categories->setState('filter.get_children', $levels); $categories->setState('filter.published', 1); $categories->setState('filter.access', $access); $additional_catids = array(); foreach($catids as $catid) { $categories->setState('filter.parentId', $catid); $recursive = true; $items = $categories->getItems($recursive); if ($items) { foreach($items as $category) { $condition = (($category->level - $categories->getParent()->level) <= $levels); if ($condition) { $additional_catids[] = $category->id; } } } } $catids = array_unique(array_merge($catids, $additional_catids)); } $articles->setState('filter.category_id', $catids); } // Ordering $articles->setState('list.ordering', $params->get('article_ordering', 'a.ordering')); $articles->setState('list.direction', $params->get('article_ordering_direction', 'ASC')); // New Parameters $articles->setState('filter.featured', $params->get('show_front', 'show')); // $articles->setState('filter.author_id', $params->get('created_by', "")); // $articles->setState('filter.author_id.include', $params->get('author_filtering_type', 1)); // $articles->setState('filter.author_alias', $params->get('created_by_alias', "")); // $articles->setState('filter.author_alias.include', $params->get('author_alias_filtering_type', 1)); $excluded_articles = $params->get('excluded_articles', ''); if ($excluded_articles) { $excluded_articles = explode("\r\n", $excluded_articles); $articles->setState('filter.article_id', $excluded_articles); $articles->setState('filter.article_id.include', false); // Exclude } $date_filtering = $params->get('date_filtering', 'off'); if ($date_filtering !== 'off') { $articles->setState('filter.date_filtering', $date_filtering); $articles->setState('filter.date_field', $params->get('date_field', 'a.created')); $articles->setState('filter.start_date_range', $params->get('start_date_range', '1000-01-01 00:00:00')); $articles->setState('filter.end_date_range', $params->get('end_date_range', '9999-12-31 23:59:59')); $articles->setState('filter.relative_date', $params->get('relative_date', 30)); } // Filter by language $articles->setState('filter.language', $app->getLanguageFilter()); $items = $articles->getItems(); // Display options $show_date = $params->get('show_date',