File manager - Edit - /home/jardides/www/Jardi-design/plugins/content/beforeafter/beforeafter.php
Back
<?php /** * @copyright Copyright (C) 2005 - 2013 Michael Richey. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; class plgContentBeforeAfter extends JPlugin { public $_initializedjs = false; public function onContentPrepare($context, &$article, &$params, $page = 0) { if ($context == 'com_finder.indexer') { return true; } $this->loadLanguage(); if(!preg_match('/plg_content_beforeafter/',$article->text)) return; if(!$this->_initializedjs) { $style=array('.plg_content_beforeafter img { max-width: none !important; }'); JFactory::getDocument()->addStyleDeclaration(implode("\n",$style)); $this->_initializeJS(); } } private function _initializeJS() { // set the flag so we do this only once per page $this->_initializedjs = true; // get the document to inject js $doc = JFactory::getDocument(); // get the config so we load the right javascripts $debug = JFactory::getApplication()->getCfg('debug',false); $plgdebug = $this->params->get('debug',0); // enable jQuery, just in case it isn't enabled in the template if(version_compare(JVERSION,3,'>=')) { JHTML::_('jquery.framework'); JHTML::_('jquery.ui'); } $doc->addScript(JURI::root(true).'/media/plg_content_beforeafter/jquery.ui.draggable'.(!$debug?'.min':'').'.js'); $doc->addScript(JURI::root(true).'/media/plg_content_beforeafter/jquery.ui.touch-punch'.(!$debug?'.min':'').'.js'); // load the default configs $defaultvalues = array( 'animateIntro'=>array("type"=>"bool","value"=>false), 'introDelay'=>array("type"=>"numeric","value"=>1000), 'introDuration'=>array("type"=>"numeric","value"=>1000), 'showFullLinks'=>array("type"=>"bool","value"=>true), 'imagePath'=>array("type"=>"dir","value"=>JURI::root(true).'/media/plg_content_beforeafter/'), 'introPosition'=>array("type"=>"float","value"=>0.5), 'cursor'=>array("type"=>"text","value"=>"pointer"), 'clickSpeed'=>array("type"=>"numeric","value"=>600), 'linkDisplaySpeed'=>array("type"=>"numeric","value"=>200), 'dividerColor'=>array("type"=>"text","value"=>"#888"), 'enableKeyboard'=>array("type"=>"bool","value"=>false), 'keypressAmount'=>array("type"=>"numeric","value"=>20), 'onReady'=>array("type"=>"text","value"=>'') ); $defaults = new stdClass(); foreach($defaultvalues as $name=>$def) { switch($def['type']) { case 'bool': $value = (bool) $this->params->get($name,$def['value']); break; case 'numeric': $value = (integer) $this->params->get($name,$def['value']); break; case 'float': $value = (float) $this->params->get($name,$def['value']); break; case 'dir': $value = $this->params->get($name,$def['value']); if(!strlen(trim($value))) $value = JURI::root(true).'/images/'.$def['value']; default: $value = $this->params->get($name,$def['value']); } if($name == 'onReady' && strlen(trim($value)) == 0) continue; $defaults->$name = $value; } $doc->addScriptDeclaration('window.plg_content_beforeafter = '.json_encode($defaults).';'); // load the language strings for javascript JText::script('PLG_CONTENT_BEFOREAFTER_LINKBEFORETEXT'); JText::script('PLG_CONTENT_BEFOREAFTER_LINKAFTERTEXT'); // load necessary scripts $min = (!($debug||$plgdebug)?'.min':''); $doc->addScript(JURI::root(true).'/media/plg_content_beforeafter/jquery.beforeafter-1.4'.$min.'.js'); $doc->addScript(JURI::root(true).'/media/plg_content_beforeafter/plg_content_beforeafter'.$min.'.js'); } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings