85 lines
2.5 KiB
PHP
85 lines
2.5 KiB
PHP
<?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 plgPagebuilderckImage extends JPlugin {
|
|
|
|
private $context = 'PLG_PAGEBUILDERCK_IMAGE';
|
|
|
|
private $type = 'image';
|
|
|
|
function __construct(&$subject, $params) {
|
|
|
|
parent::__construct($subject, $params);
|
|
}
|
|
|
|
/*
|
|
* Construct the Menu Item to drag into the interface
|
|
*
|
|
* Return Object with item data
|
|
*/
|
|
public function onPagebuilderckAddItemToMenu() {
|
|
// 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/image/assets/images/image.svg';
|
|
|
|
return $menuitem;
|
|
}
|
|
|
|
/*
|
|
* Display the html code for the item to be used into the interface
|
|
*
|
|
* Return String the html code
|
|
*/
|
|
public function onPagebuilderckLoadItemContentImage() {
|
|
$input = JFactory::getApplication()->input;
|
|
$id = $input->get('ckid', '', 'string');
|
|
// ckstyle and inner classes are needed to get the styles from the interface
|
|
?>
|
|
<div id="<?php echo $id; ?>" class="cktype" data-type="image" onshow="ckAddDndForImageUpload(jQuery('#<?php echo $id; ?>')[0]);">
|
|
<div class="tab_image ckprops" imagewidth="100%" imageheight="auto" fieldslist="imagewidth,imageheight"></div>
|
|
<div class="ckstyle">
|
|
</div>
|
|
<div class="imageck">
|
|
<img width="100%" height="auto" src="<?php echo JUri::root(true); ?>/plugins/pagebuilderck/image/assets/images/image_example.svg" data-src="/plugins/pagebuilderck/image/assets/images/image_example.svg" />
|
|
</div>
|
|
</div>
|
|
<?php
|
|
}
|
|
|
|
/*
|
|
* Load the interface for the item edition
|
|
*
|
|
* Return String the html code
|
|
*/
|
|
public function onPagebuilderckLoadItemOptionsImage() {
|
|
// load the language files of the plugin
|
|
$this->loadLanguage();
|
|
// load the interface for the options
|
|
$tpl = JPATH_SITE . '/plugins/pagebuilderck/image/layouts/edit_image.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 onPagebuilderckRenderItemImage($item) {
|
|
return $item->innertext;
|
|
}
|
|
}
|