| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Old Sites/Engineering/V2/plugins/editors/jckeditor/includes/ckeditor/plugins/ |
Upload File : |
<?php
/**
* @version $Id: helper.php 10707 2008-08-21 09:52:47Z eddieajau $
* @package Joomla.Framework
* @subpackage Plugin
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
// Check to ensure this file is within the rest of the framework
defined('JPATH_BASE') or die();
//lets set Joomla user
jckimport('ckeditor.user.user');
/**
* Plugin helper class
*
* @static
* @package Joomla.Framework
* @subpackage Plugin
* @since 1.5
*/
class JCKPluginsHelper
{
/**
* Loads the plugin file
*
* @access private
* @return boolean True if success
*/
function storePlugins($type)
{
$path = dirname(__FILE__);
$path .= DS.$type;
$plugins = JFolder::files($path);
foreach($plugins as $plugin)
{
$plugin = preg_replace('/\.php$/','',$plugin); //remove php extension
JCKPluginsHelper::storePlugin($type,$plugin);
}
}
function storePlugin($type,$name)
{
$session =& JCKUser::getSession();
$plugin = new stdclass;
$plugin->type = $type;
$plugin->name = $name;
$jckplugins =& $session->get('jckplugins');
if(!isset($jckplugins))
$session->set('jckplugins',array($plugin));
else
{
$jckplugins[] = $plugin;
}
}
function removePlugin($type,$name)
{
$session =& JCKUser::getSession();
$plugins =& $session->get('jckplugins');
if(isset($plugins))
{
for($i = 0; $i < count($plugins); $i++)
{
if ($plugins[$i]->type == $type && $plugins[$i]->name == $name)
{
unset($plugins[$i]);
break;
}
}
}
}
function &getPlugin($type, $plugin = null)
{
$result = array();
$plugins = JCKPluginsHelper::_load();
$total = count($plugins);
for($i = 0; $i < $total; $i++)
{
if(is_null($plugin))
{
if($plugins[$i]->type == $type) {
$result[] = $plugins[$i];
}
}
else
{
if($plugins[$i]->type == $type && $plugins[$i]->name == $plugin) {
$result = $plugins[$i];
break;
}
}
}
return $result;
}
function importPlugin($type, $plugin = null, $autocreate = true, $dispatcher = null)
{
$result = false;
$plugins = JCKPluginsHelper::_load();
$session =& JCKUser::getSession();
$total = count($plugins);
for($i = 0; $i < $total; $i++) {
if($plugins[$i]->type == $type && ($plugins[$i]->name == $plugin || $plugin === null)) {
JCKPluginsHelper::_import( $plugins[$i], $autocreate, $dispatcher );
$result = true;
}
}
return $result;
}
function _import( &$plugin, $autocreate = true, $dispatcher = null )
{
static $paths;
if (!$paths) {
$paths = array();
}
$result = false;
$plugin->type = preg_replace('/[^A-Z0-9_\.-]/i', '', $plugin->type);
$plugin->name = preg_replace('/[^A-Z0-9_\.-]/i', '', $plugin->name);
$base_path = dirname(__FILE__);
$path = $base_path.DS.$plugin->type.DS.$plugin->name.'.php';
if (!isset( $paths[$path] ))
{
if (file_exists( $path ))
{
//needed for backwards compatibility
jimport('joomla.plugin.plugin');
require_once( $path );
$paths[$path] = true;
if($autocreate)
{
// Makes sure we have an event dispatcher
if(!is_object($dispatcher)) {
$dispatcher = & JDispatcher::getInstance();
}
$className = 'plg'.$plugin->type.$plugin->name;
if(class_exists($className))
{
// load plugin parameters
$plugin =& JCKPluginsHelper::getPlugin($plugin->type, $plugin->name);
// create the plugin
$instance = new $className($dispatcher, (array)($plugin));
}
}
}
else
{
$paths[$path] = false;
}
}
}
/**
* Loads the published plugins
*
* @access private
*/
function _load()
{
static $plugins;
if (isset($plugins)) {
return $plugins;
}
$session =& JCKUser::getSession();
$jckplugins =& $session->get('jckplugins');
if (!empty($jckplugins))
$plugins =& $jckplugins;
else
return false;
return $plugins;
}
}