You've already forked joomla_test
first commit
This commit is contained in:
1
libraries/legacy/base/index.html
Normal file
1
libraries/legacy/base/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
157
libraries/legacy/base/node.php
Normal file
157
libraries/legacy/base/node.php
Normal file
@ -0,0 +1,157 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Legacy
|
||||
* @subpackage Base
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Tree Node Class.
|
||||
*
|
||||
* @package Joomla.Legacy
|
||||
* @subpackage Base
|
||||
* @since 11.1
|
||||
* @deprecated 12.3 (Platform) & 4.0 (CMS)
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class JNode extends JObject
|
||||
{
|
||||
/**
|
||||
* Parent node
|
||||
* @var object
|
||||
*
|
||||
* @since 11.1
|
||||
*/
|
||||
protected $_parent = null;
|
||||
|
||||
/**
|
||||
* Array of Children
|
||||
*
|
||||
* @var array
|
||||
* @since 11.1
|
||||
*/
|
||||
protected $_children = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @since 11.1
|
||||
*/
|
||||
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 11.1
|
||||
*/
|
||||
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 mixed &$parent The JNode for parent to be set or null
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.1
|
||||
*/
|
||||
public function setParent(&$parent)
|
||||
{
|
||||
JLog::add('JNode::setParent() is deprecated.', JLog::WARNING, 'deprecated');
|
||||
|
||||
if ($parent instanceof JNode || is_null($parent))
|
||||
{
|
||||
$hash = spl_object_hash($this);
|
||||
if (!is_null($this->_parent))
|
||||
{
|
||||
unset($this->_parent->children[$hash]);
|
||||
}
|
||||
if (!is_null($parent))
|
||||
{
|
||||
$parent->_children[$hash] = & $this;
|
||||
}
|
||||
$this->_parent = & $parent;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the children of this node
|
||||
*
|
||||
* @return array The children
|
||||
*
|
||||
* @since 11.1
|
||||
*/
|
||||
public function &getChildren()
|
||||
{
|
||||
JLog::add('JNode::getChildren() is deprecated.', JLog::WARNING, 'deprecated');
|
||||
|
||||
return $this->_children;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent of this node
|
||||
*
|
||||
* @return mixed JNode object with the parent or null for no parent
|
||||
*
|
||||
* @since 11.1
|
||||
*/
|
||||
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 11.1
|
||||
*/
|
||||
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 11.1
|
||||
*/
|
||||
public function hasParent()
|
||||
{
|
||||
JLog::add('JNode::hasParent() is deprecated.', JLog::WARNING, 'deprecated');
|
||||
|
||||
return $this->getParent() != null;
|
||||
}
|
||||
}
|
197
libraries/legacy/base/observable.php
Normal file
197
libraries/legacy/base/observable.php
Normal file
@ -0,0 +1,197 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Legacy
|
||||
* @subpackage Base
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Abstract observable class to implement the observer design pattern
|
||||
*
|
||||
* @package Joomla.Legacy
|
||||
* @subpackage Base
|
||||
* @since 11.1
|
||||
* @deprecated 12.3 (Platform) & 4.0 (CMS)
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class JObservable extends JObject
|
||||
{
|
||||
/**
|
||||
* An array of Observer objects to notify
|
||||
*
|
||||
* @var array
|
||||
* @since 11.1
|
||||
* @deprecated 12.3
|
||||
*/
|
||||
protected $_observers = array();
|
||||
|
||||
/**
|
||||
* The state of the observable object
|
||||
*
|
||||
* @var mixed
|
||||
* @since 11.1
|
||||
* @deprecated 12.3
|
||||
*/
|
||||
protected $_state = null;
|
||||
|
||||
/**
|
||||
* A multi dimensional array of [function][] = key for observers
|
||||
*
|
||||
* @var array
|
||||
* @since 11.1
|
||||
* @deprecated 12.3
|
||||
*/
|
||||
protected $_methods = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* Note: Make Sure it's not directly instantiated
|
||||
*
|
||||
* @deprecated 12.3
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_observers = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the state of the JObservable object
|
||||
*
|
||||
* @return mixed The state of the object.
|
||||
*
|
||||
* @since 11.1
|
||||
* @deprecated 12.3
|
||||
*/
|
||||
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 11.1
|
||||
* @deprecated 12.3
|
||||
*/
|
||||
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 11.1
|
||||
* @deprecated 12.3
|
||||
*/
|
||||
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 11.1
|
||||
* @deprecated 12.3
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
60
libraries/legacy/base/observer.php
Normal file
60
libraries/legacy/base/observer.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Legacy
|
||||
* @subpackage Base
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Abstract observer class to implement the observer design pattern
|
||||
*
|
||||
* @package Joomla.Legacy
|
||||
* @subpackage Base
|
||||
* @since 11.1
|
||||
* @deprecated 12.3 (Platform) & 4.0 (CMS)
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
abstract class JObserver extends JObject
|
||||
{
|
||||
/**
|
||||
* Event object to observe.
|
||||
*
|
||||
* @var object
|
||||
* @since 11.1
|
||||
* @deprecated 12.3
|
||||
*/
|
||||
protected $_subject = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object &$subject The object to observe.
|
||||
*
|
||||
* @since 11.1
|
||||
* @deprecated 12.3
|
||||
*/
|
||||
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 11.1
|
||||
* @deprecated 12.3
|
||||
*/
|
||||
public abstract function update(&$args);
|
||||
}
|
100
libraries/legacy/base/tree.php
Normal file
100
libraries/legacy/base/tree.php
Normal file
@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Legacy
|
||||
* @subpackage Base
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Tree Class.
|
||||
*
|
||||
* @package Joomla.Legacy
|
||||
* @subpackage Base
|
||||
* @since 11.1
|
||||
* @deprecated 12.3 (Platform) & 4.0 (CMS)
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class JTree extends JObject
|
||||
{
|
||||
/**
|
||||
* Root node
|
||||
*
|
||||
* @var object
|
||||
* @since 11.1
|
||||
*/
|
||||
protected $_root = null;
|
||||
|
||||
/**
|
||||
* Current working node
|
||||
*
|
||||
* @var object
|
||||
* @since 11.1
|
||||
*/
|
||||
protected $_current = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @since 11.1
|
||||
*/
|
||||
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 mixed
|
||||
*
|
||||
* @since 11.1
|
||||
*/
|
||||
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 11.1
|
||||
*/
|
||||
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 11.1
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
JLog::add('JTree::reset() is deprecated.', JLog::WARNING, 'deprecated');
|
||||
|
||||
$this->_current = &$this->_root;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user