Spade
Mini Shell
| Directory:~$ /home/lmsyaran/public_html/joomla4/ |
| [Home] [System Details] [Kill Me] |
node.php000064400000005760151155625410006217 0ustar00<?php
/**
* @package Joomla.Legacy
* @subpackage Base
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('JPATH_PLATFORM') or die;
/**
* Tree Node Class.
*
* @since 1.5
* @deprecated 3.0
*/
class JNode extends JObject
{
/**
* Parent node
*
* @var JNode
* @since 1.5
* @deprecated 3.0
*/
protected $_parent = null;
/**
* Array of Children
*
* @var JNode[]
* @since 1.5
* @deprecated 3.0
*/
protected $_children = array();
/**
* Constructor
*
* @since 1.5
* @deprecated 3.0
*/
public function __construct()
{
JLog::add('JNode::__construct() is deprecated.', JLog::WARNING,
'deprecated');
return true;
}
/**
* Add child to this node
*
* If the child already has a parent, the link is unset
*
* @param JNode &$child The child to be added
*
* @return void
*
* @since 1.5
* @deprecated 3.0
*/
public function addChild(&$child)
{
JLog::add('JNode::addChild() is deprecated.', JLog::WARNING,
'deprecated');
if ($child instanceof Jnode)
{
$child->setParent($this);
}
}
/**
* Set the parent of a this node
*
* If the node already has a parent, the link is unset
*
* @param JNode|null &$parent The JNode for parent to be set or
null
*
* @return void
*
* @since 1.5
* @deprecated 3.0
*/
public function setParent(&$parent)
{
JLog::add('JNode::setParent() is deprecated.', JLog::WARNING,
'deprecated');
if ($parent instanceof JNode || $parent === null)
{
$hash = spl_object_hash($this);
if ($this->_parent !== null)
{
unset($this->_parent->children[$hash]);
}
if ($parent !== null)
{
$parent->_children[$hash] = & $this;
}
$this->_parent = & $parent;
}
}
/**
* Get the children of this node
*
* @return JNode[] The children
*
* @since 1.5
* @deprecated 3.0
*/
public function &getChildren()
{
JLog::add('JNode::getChildren() is deprecated.', JLog::WARNING,
'deprecated');
return $this->_children;
}
/**
* Get the parent of this node
*
* @return JNode|null JNode object with the parent or null for no parent
*
* @since 1.5
* @deprecated 3.0
*/
public function &getParent()
{
JLog::add('JNode::getParent() is deprecated.', JLog::WARNING,
'deprecated');
return $this->_parent;
}
/**
* Test if this node has children
*
* @return boolean True if there are children
*
* @since 1.5
* @deprecated 3.0
*/
public function hasChildren()
{
JLog::add('JNode::hasChildren() is deprecated.', JLog::WARNING,
'deprecated');
return (bool) count($this->_children);
}
/**
* Test if this node has a parent
*
* @return boolean True if there is a parent
*
* @since 1.6
* @deprecated 3.0
*/
public function hasParent()
{
JLog::add('JNode::hasParent() is deprecated.', JLog::WARNING,
'deprecated');
return $this->getParent() != null;
}
}
observable.php000064400000007070151155625410007412 0ustar00<?php
/**
* @package Joomla.Legacy
* @subpackage Base
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('JPATH_PLATFORM') or die;
/**
* Abstract observable class to implement the observer design pattern
*
* @since 1.5
* @deprecated 2.5
*/
class JObservable extends JObject
{
/**
* An array of Observer objects to notify
*
* @var array
* @since 1.5
* @deprecated 2.5
*/
protected $_observers = array();
/**
* The state of the observable object
*
* @var mixed
* @since 1.5
* @deprecated 2.5
*/
protected $_state = null;
/**
* A multi dimensional array of [function][] = key for observers
*
* @var array
* @since 1.6
* @deprecated 2.5
*/
protected $_methods = array();
/**
* Constructor
*
* Note: Make Sure it's not directly instantiated
*
* @since 1.5
* @deprecated 2.5
*/
public function __construct()
{
$this->_observers = array();
}
/**
* Get the state of the JObservable object
*
* @return mixed The state of the object.
*
* @since 1.5
* @deprecated 2.5
*/
public function getState()
{
return $this->_state;
}
/**
* Update each attached observer object and return an array of their
return values
*
* @return array Array of return values from the observers
*
* @since 1.5
* @deprecated 2.5
*/
public function notify()
{
// Iterate through the _observers array
foreach ($this->_observers as $observer)
{
$return[] = $observer->update();
}
return $return;
}
/**
* Attach an observer object
*
* @param object $observer An observer object to attach
*
* @return void
*
* @since 1.5
* @deprecated 2.5
*/
public function attach($observer)
{
if (is_array($observer))
{
if (!isset($observer['handler']) ||
!isset($observer['event']) ||
!is_callable($observer['handler']))
{
return;
}
// Make sure we haven't already attached this array as an observer
foreach ($this->_observers as $check)
{
if (is_array($check) && $check['event'] ==
$observer['event'] && $check['handler'] ==
$observer['handler'])
{
return;
}
}
$this->_observers[] = $observer;
end($this->_observers);
$methods = array($observer['event']);
}
else
{
if (!($observer instanceof JObserver))
{
return;
}
// Make sure we haven't already attached this object as an observer
$class = get_class($observer);
foreach ($this->_observers as $check)
{
if ($check instanceof $class)
{
return;
}
}
$this->_observers[] = $observer;
$methods = array_diff(get_class_methods($observer),
get_class_methods('JPlugin'));
}
$key = key($this->_observers);
foreach ($methods as $method)
{
$method = strtolower($method);
if (!isset($this->_methods[$method]))
{
$this->_methods[$method] = array();
}
$this->_methods[$method][] = $key;
}
}
/**
* Detach an observer object
*
* @param object $observer An observer object to detach.
*
* @return boolean True if the observer object was detached.
*
* @since 1.5
* @deprecated 2.5
*/
public function detach($observer)
{
$retval = false;
$key = array_search($observer, $this->_observers);
if ($key !== false)
{
unset($this->_observers[$key]);
$retval = true;
foreach ($this->_methods as &$method)
{
$k = array_search($key, $method);
if ($k !== false)
{
unset($method[$k]);
}
}
}
return $retval;
}
}
observer.php000064400000002160151155625410007110 0ustar00<?php
/**
* @package Joomla.Legacy
* @subpackage Base
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('JPATH_PLATFORM') or die;
/**
* Abstract observer class to implement the observer design pattern
*
* @since 1.5
* @deprecated 2.5
*/
abstract class JObserver extends JObject
{
/**
* Event object to observe.
*
* @var object
* @since 1.5
* @deprecated 2.5
*/
protected $_subject = null;
/**
* Constructor
*
* @param object &$subject The object to observe.
*
* @since 1.5
* @deprecated 2.5
*/
public function __construct(&$subject)
{
// Register the observer ($this) so we can be notified
$subject->attach($this);
// Set the subject to observe
$this->_subject = &$subject;
}
/**
* Method to update the state of observable objects
*
* @param array &$args An array of arguments to pass to the
listener.
*
* @return mixed
*
* @since 1.5
* @deprecated 2.5
*/
abstract public function update(&$args);
}
tree.php000064400000003463151155625410006227 0ustar00<?php
/**
* @package Joomla.Legacy
* @subpackage Base
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('JPATH_PLATFORM') or die;
/**
* Tree Class.
*
* @since 1.5
* @deprecated 3.0
*/
class JTree extends JObject
{
/**
* Root node
*
* @var JNode
* @since 1.5
* @deprecated 3.0
*/
protected $_root = null;
/**
* Current working node
*
* @var JNode
* @since 1.5
* @deprecated 3.0
*/
protected $_current = null;
/**
* Constructor
*
* @since 1.5
* @deprecated 3.0
*/
public function __construct()
{
JLog::add('JTree::__construct() is deprecated.', JLog::WARNING,
'deprecated');
$this->_root = new JNode('ROOT');
$this->_current = & $this->_root;
}
/**
* Method to add a child
*
* @param array &$node The node to process
* @param boolean $setCurrent True to set as current working node
*
* @return void
*
* @since 1.5
* @deprecated 3.0
*/
public function addChild(&$node, $setCurrent = false)
{
JLog::add('JTree::addChild() is deprecated.', JLog::WARNING,
'deprecated');
$this->_current->addChild($node);
if ($setCurrent)
{
$this->_current = &$node;
}
}
/**
* Method to get the parent
*
* @return void
*
* @since 1.5
* @deprecated 3.0
*/
public function getParent()
{
JLog::add('JTree::getParent() is deprecated.', JLog::WARNING,
'deprecated');
$this->_current = &$this->_current->getParent();
}
/**
* Method to get the parent
*
* @return void
*
* @since 1.5
* @deprecated 3.0
*/
public function reset()
{
JLog::add('JTree::reset() is deprecated.', JLog::WARNING,
'deprecated');
$this->_current = &$this->_root;
}
}
adapter.php000064400000010615151157126370006710 0ustar00<?php
/**
* @package Joomla.Platform
* @subpackage Base
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* Adapter Class
* Retains common adapter pattern functions
* Class harvested from joomla.installer.installer
*
* @since 1.6
* @deprecated 5.0 Will be removed without replacement
*/
class JAdapter extends JObject
{
/**
* Associative array of adapters
*
* @var JAdapterInstance[]
* @since 1.6
*/
protected $_adapters = array();
/**
* Adapter Folder
*
* @var string
* @since 1.6
*/
protected $_adapterfolder = 'adapters';
/**
* Adapter Class Prefix
*
* @var string
* @since 1.6
*/
protected $_classprefix = 'J';
/**
* Base Path for the adapter instance
*
* @var string
* @since 1.6
*/
protected $_basepath = null;
/**
* Database Connector Object
*
* @var JDatabaseDriver
* @since 1.6
*/
protected $_db;
/**
* Constructor
*
* @param string $basepath Base Path of the adapters
* @param string $classprefix Class prefix of adapters
* @param string $adapterfolder Name of folder to append to base path
*
* @since 1.6
*/
public function __construct($basepath, $classprefix = null, $adapterfolder
= null)
{
$this->_basepath = $basepath;
$this->_classprefix = $classprefix ? $classprefix : 'J';
$this->_adapterfolder = $adapterfolder ? $adapterfolder :
'adapters';
$this->_db = JFactory::getDbo();
}
/**
* Get the database connector object
*
* @return JDatabaseDriver Database connector object
*
* @since 1.6
*/
public function getDbo()
{
return $this->_db;
}
/**
* Return an adapter.
*
* @param string $name Name of adapter to return
* @param array $options Adapter options
*
* @return JAdapterInstance|boolean Adapter of type 'name' or
false
*
* @since 1.6
*/
public function getAdapter($name, $options = array())
{
if (array_key_exists($name, $this->_adapters))
{
return $this->_adapters[$name];
}
if ($this->setAdapter($name, $options))
{
return $this->_adapters[$name];
}
return false;
}
/**
* Set an adapter by name
*
* @param string $name Adapter name
* @param object &$adapter Adapter object
* @param array $options Adapter options
*
* @return boolean True if successful
*
* @since 1.6
*/
public function setAdapter($name, &$adapter = null, $options =
array())
{
if (is_object($adapter))
{
$this->_adapters[$name] = &$adapter;
return true;
}
$class = rtrim($this->_classprefix, '\\') . '\\' .
ucfirst($name);
if (class_exists($class))
{
$this->_adapters[$name] = new $class($this, $this->_db, $options);
return true;
}
$class = rtrim($this->_classprefix, '\\') . '\\' .
ucfirst($name) . 'Adapter';
if (class_exists($class))
{
$this->_adapters[$name] = new $class($this, $this->_db, $options);
return true;
}
$fullpath = $this->_basepath . '/' .
$this->_adapterfolder . '/' . strtolower($name) .
'.php';
if (!file_exists($fullpath))
{
return false;
}
// Try to load the adapter object
$class = $this->_classprefix . ucfirst($name);
JLoader::register($class, $fullpath);
if (!class_exists($class))
{
return false;
}
$this->_adapters[$name] = new $class($this, $this->_db, $options);
return true;
}
/**
* Loads all adapters.
*
* @param array $options Adapter options
*
* @return void
*
* @since 1.6
*/
public function loadAllAdapters($options = array())
{
$files = new DirectoryIterator($this->_basepath . '/' .
$this->_adapterfolder);
/* @type $file DirectoryIterator */
foreach ($files as $file)
{
$fileName = $file->getFilename();
// Only load for php files.
if (!$file->isFile() || $file->getExtension() != 'php')
{
continue;
}
// Try to load the adapter object
require_once $this->_basepath . '/' .
$this->_adapterfolder . '/' . $fileName;
// Derive the class name from the filename.
$name = str_ireplace('.php', '',
ucfirst(trim($fileName)));
$class = $this->_classprefix . ucfirst($name);
if (!class_exists($class))
{
// Skip to next one
continue;
}
$adapter = new $class($this, $this->_db, $options);
$this->_adapters[$name] = clone $adapter;
}
}
}
adapterinstance.php000064400000002554151157126370010440 0ustar00<?php
/**
* @package Joomla.Platform
* @subpackage Base
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* Adapter Instance Class
*
* @since 1.6
* @deprecated 5.0 Will be removed without replacement
*/
class JAdapterInstance extends JObject
{
/**
* Parent
*
* @var JAdapter
* @since 1.6
*/
protected $parent = null;
/**
* Database
*
* @var JDatabaseDriver
* @since 1.6
*/
protected $db = null;
/**
* Constructor
*
* @param JAdapter $parent Parent object
* @param JDatabaseDriver $db Database object
* @param array $options Configuration Options
*
* @since 1.6
*/
public function __construct(JAdapter $parent, JDatabaseDriver $db, array
$options = array())
{
// Set the properties from the options array that is passed in
$this->setProperties($options);
// Set the parent and db in case $options for some reason overrides it.
$this->parent = $parent;
// Pull in the global dbo in case something happened to it.
$this->db = $db ?: JFactory::getDbo();
}
/**
* Retrieves the parent object
*
* @return JAdapter
*
* @since 1.6
*/
public function getParent()
{
return $this->parent;
}
}