File manager - Edit - /home/jardides/www/Jardi-design/old/plugins/pagebuilderck/code/code.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 plgPagebuilderckCode extends JPlugin { private $context = 'PLG_PAGEBUILDERCK_CODE'; private $type = 'code'; 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() { Pagebuilderck\CKFof::addStyleDeclaration('.ckcode.inner {min-height:75px;background-color:#efefef;border:1px solid #666;}'); // load the language files of the plugin $this->loadLanguage(); // create the menu item $menuitem = new stdClass(); $menuitem->type = $this->type; $menuitem->title = JText::_($this->context . '_MENUITEM_TITLE'); $menuitem->description = JText::_($this->context . '_MENUITEM_DESC'); $menuitem->image = JUri::root(true) . '/plugins/pagebuilderck/code/assets/images/page_white_code.png'; return $menuitem; } /* * Display the html code for the item to be used into the interface * * Return String the html code */ public function onPagebuilderckLoadItemContentCode() { $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="code"> <div class="ckstyle"></div> <div class="ckcode inner"></div> </div> <?php } /* * Load the interface for the item edition * * Return String the html code */ public function onPagebuilderckLoadItemOptionsCode() { // load the language files of the plugin $this->loadLanguage(); // load the interface for the options $tpl = JPATH_SITE . '/plugins/pagebuilderck/code/layouts/edit_code.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 onPagebuilderckRenderItemCode($item) { $code = $item->find('.ckcode')[0]->innertext; $hasPhp = strpos($code, 'ck-php'); // ckstyle and inner classes are needed to get the styles from the interface $ckstyle = $item->find('.ckstyle'); $styles = count($ckstyle) ? $ckstyle[0]->innertext : ''; $html = '<div class="ckstyle"> '. $styles . ' </div> <div class="ckcode inner">'; $code = str_replace (array( '<' ,'>' ,'&' ,'<!ck-php' ,'php-!ck>' ,'<!ck-' ), array( '<' ,'>' ,'&' ,'<?php' ,'?>' ,'<' ) ,$code); if ($hasPhp) { ob_start(); $this->betterEval( htmlspecialchars_decode($code) ); $code = ob_get_contents(); ob_end_clean(); } $html .= $code . '</div>'; return $html; } private function betterEval($code) { $tmp = tmpfile (); $tmpf = stream_get_meta_data ( $tmp ); $tmpf = $tmpf ['uri']; fwrite ( $tmp, $code ); $ret = include ($tmpf); fclose ( $tmp ); return $ret; } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings