Spade
Mini Shell
PK`��[s�_���domain/dispatcher.phpnu�[���<?php
/**
* @package FrameworkOnFramework
* @subpackage config
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba
Ltd. All rights reserved.
* @license GNU General Public License version 2, or later
*/
defined('FOF_INCLUDED') or die();
/**
* Configuration parser for the dispatcher-specific settings
*
* @package FrameworkOnFramework
* @since 2.1
*/
class FOFConfigDomainDispatcher implements FOFConfigDomainInterface
{
/**
* Parse the XML data, adding them to the $ret array
*
* @param SimpleXMLElement $xml The XML data of the component's
configuration area
* @param array &$ret The parsed data, in the form of a
hash array
*
* @return void
*/
public function parseDomain(SimpleXMLElement $xml, array &$ret)
{
// Initialise
$ret['dispatcher'] = array();
// Parse the dispatcher configuration
$dispatcherData = $xml->dispatcher;
// Sanity check
if (empty($dispatcherData))
{
return;
}
$options = $xml->xpath('dispatcher/option');
if (!empty($options))
{
foreach ($options as $option)
{
$key = (string) $option['name'];
$ret['dispatcher'][$key] = (string) $option;
}
}
}
/**
* Return a configuration variable
*
* @param string &$configuration Configuration variables (hashed
array)
* @param string $var The variable we want to fetch
* @param mixed $default Default value
*
* @return mixed The variable's value
*/
public function get(&$configuration, $var, $default)
{
if (isset($configuration['dispatcher'][$var]))
{
return $configuration['dispatcher'][$var];
}
else
{
return $default;
}
}
}
PK`��[I{.�^^domain/interface.phpnu�[���<?php
/**
* @package FrameworkOnFramework
* @subpackage config
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba
Ltd. All rights reserved.
* @license GNU General Public License version 2, or later
* @note This file has been modified by the Joomla! Project and no
longer reflects the original work of its author.
*/
defined('FOF_INCLUDED') or die();
/**
* The Interface of an FOFConfigDomain class. The methods are used to parse
and
* provision sensible information to consumers. FOFConfigProvider acts as
an
* adapter to the FOFConfigDomain classes.
*
* @package FrameworkOnFramework
* @since 2.1
*/
interface FOFConfigDomainInterface
{
/**
* Parse the XML data, adding them to the $ret array
*
* @param SimpleXMLElement $xml The XML data of the component's
configuration area
* @param array &$ret The parsed data, in the form of a
hash array
*
* @return void
*/
public function parseDomain(SimpleXMLElement $xml, array &$ret);
/**
* Return a configuration variable
*
* @param string &$configuration Configuration variables (hashed
array)
* @param string $var The variable we want to fetch
* @param mixed $default Default value
*
* @return mixed The variable's value
*/
public function get(&$configuration, $var, $default);
}
PK`��[Y��domain/tables.phpnu�[���<?php
/**
* @package FrameworkOnFramework
* @subpackage config
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba
Ltd. All rights reserved.
* @license GNU General Public License version 2, or later
*/
defined('FOF_INCLUDED') or die();
/**
* Configuration parser for the tables-specific settings
*
* @package FrameworkOnFramework
* @since 2.1
*/
class FOFConfigDomainTables implements FOFConfigDomainInterface
{
/**
* Parse the XML data, adding them to the $ret array
*
* @param SimpleXMLElement $xml The XML data of the component's
configuration area
* @param array &$ret The parsed data, in the form of a
hash array
*
* @return void
*/
public function parseDomain(SimpleXMLElement $xml, array &$ret)
{
// Initialise
$ret['tables'] = array();
// Parse table configuration
$tableData = $xml->xpath('table');
// Sanity check
if (empty($tableData))
{
return;
}
foreach ($tableData as $aTable)
{
$key = (string) $aTable['name'];
$ret['tables'][$key]['behaviors'] = (string)
$aTable->behaviors;
$ret['tables'][$key]['tablealias'] =
$aTable->xpath('tablealias');
$ret['tables'][$key]['fields'] = array();
$ret['tables'][$key]['relations'] = array();
$fieldData = $aTable->xpath('field');
if (!empty($fieldData))
{
foreach ($fieldData as $field)
{
$k = (string) $field['name'];
$ret['tables'][$key]['fields'][$k] = (string)
$field;
}
}
$relationsData = $aTable->xpath('relation');
if (!empty($relationsData))
{
foreach ($relationsData as $relationData)
{
$type = (string)$relationData['type'];
$itemName = (string)$relationData['name'];
if (empty($type) || empty($itemName))
{
continue;
}
$tableClass = (string)$relationData['tableClass'];
$localKey = (string)$relationData['localKey'];
$remoteKey = (string)$relationData['remoteKey'];
$ourPivotKey = (string)$relationData['ourPivotKey'];
$theirPivotKey = (string)$relationData['theirPivotKey'];
$pivotTable = (string)$relationData['pivotTable'];
$default = (string)$relationData['default'];
$default = !in_array($default, array('no',
'false', 0));
$relation = array(
'type' => $type,
'itemName' => $itemName,
'tableClass' => empty($tableClass) ? null : $tableClass,
'localKey' => empty($localKey) ? null : $localKey,
'remoteKey' => empty($remoteKey) ? null : $remoteKey,
'default' => $default,
);
if (!empty($ourPivotKey) || !empty($theirPivotKey) ||
!empty($pivotTable))
{
$relation['ourPivotKey'] = empty($ourPivotKey) ? null :
$ourPivotKey;
$relation['theirPivotKey'] = empty($theirPivotKey) ? null :
$theirPivotKey;
$relation['pivotTable'] = empty($pivotTable) ? null :
$pivotTable;
}
$ret['tables'][$key]['relations'][] = $relation;
}
}
}
}
/**
* Return a configuration variable
*
* @param string &$configuration Configuration variables (hashed
array)
* @param string $var The variable we want to fetch
* @param mixed $default Default value
*
* @return mixed The variable's value
*/
public function get(&$configuration, $var, $default)
{
$parts = explode('.', $var);
$view = $parts[0];
$method = 'get' . ucfirst($parts[1]);
if (!method_exists($this, $method))
{
return $default;
}
array_shift($parts);
array_shift($parts);
$ret = $this->$method($view, $configuration, $parts, $default);
return $ret;
}
/**
* Internal method to return the magic field mapping
*
* @param string $table The table for which we will be
fetching a field map
* @param array &$configuration The configuration parameters hash
array
* @param array $params Extra options; key 0 defines the
table we want to fetch
* @param string $default Default magic field mapping; empty if
not defined
*
* @return array Field map
*/
protected function getField($table, &$configuration, $params, $default
= '')
{
$fieldmap = array();
if (isset($configuration['tables']['*']) &&
isset($configuration['tables']['*']['fields']))
{
$fieldmap =
$configuration['tables']['*']['fields'];
}
if (isset($configuration['tables'][$table]) &&
isset($configuration['tables'][$table]['fields']))
{
$fieldmap = array_merge($fieldmap,
$configuration['tables'][$table]['fields']);
}
$map = $default;
if (empty($params[0]))
{
$map = $fieldmap;
}
elseif (isset($fieldmap[$params[0]]))
{
$map = $fieldmap[$params[0]];
}
return $map;
}
/**
* Internal method to get table alias
*
* @param string $table The table for which we will be
fetching table alias
* @param array &$configuration The configuration parameters hash
array
* @param array $params Extra options; key 0 defines the
table we want to fetch
* @param string $default Default table alias
*
* @return string Table alias
*/
protected function getTablealias($table, &$configuration, $params,
$default = '')
{
$tablealias = $default;
if (isset($configuration['tables']['*'])
&&
isset($configuration['tables']['*']['tablealias'])
&&
isset($configuration['tables']['*']['tablealias'][0]))
{
$tablealias = (string)
$configuration['tables']['*']['tablealias'][0];
}
if (isset($configuration['tables'][$table])
&&
isset($configuration['tables'][$table]['tablealias'])
&&
isset($configuration['tables'][$table]['tablealias'][0]))
{
$tablealias = (string)
$configuration['tables'][$table]['tablealias'][0];
}
return $tablealias;
}
/**
* Internal method to get table behaviours
*
* @param string $table The table for which we will be
fetching table alias
* @param array &$configuration The configuration parameters hash
array
* @param array $params Extra options; key 0 defines the
table we want to fetch
* @param string $default Default table alias
*
* @return string Table behaviours
*/
protected function getBehaviors($table, &$configuration, $params,
$default = '')
{
$behaviors = $default;
if (isset($configuration['tables']['*'])
&&
isset($configuration['tables']['*']['behaviors']))
{
$behaviors = (string)
$configuration['tables']['*']['behaviors'];
}
if (isset($configuration['tables'][$table])
&&
isset($configuration['tables'][$table]['behaviors']))
{
$behaviors = (string)
$configuration['tables'][$table]['behaviors'];
}
return $behaviors;
}
/**
* Internal method to get table relations
*
* @param string $table The table for which we will be
fetching table alias
* @param array &$configuration The configuration parameters hash
array
* @param array $params Extra options; key 0 defines the
table we want to fetch
* @param string $default Default table alias
*
* @return array Table relations
*/
protected function getRelations($table, &$configuration, $params,
$default = '')
{
$relations = $default;
if (isset($configuration['tables']['*'])
&&
isset($configuration['tables']['*']['relations']))
{
$relations =
$configuration['tables']['*']['relations'];
}
if (isset($configuration['tables'][$table])
&&
isset($configuration['tables'][$table]['relations']))
{
$relations =
$configuration['tables'][$table]['relations'];
}
return $relations;
}
}
PK`��[�H_� � domain/views.phpnu�[���<?php
/**
* @package FrameworkOnFramework
* @subpackage config
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba
Ltd. All rights reserved.
* @license GNU General Public License version 2, or later
*/
defined('FOF_INCLUDED') or die();
/**
* Configuration parser for the view-specific settings
*
* @package FrameworkOnFramework
* @since 2.1
*/
class FOFConfigDomainViews implements FOFConfigDomainInterface
{
/**
* Parse the XML data, adding them to the $ret array
*
* @param SimpleXMLElement $xml The XML data of the component's
configuration area
* @param array &$ret The parsed data, in the form of a
hash array
*
* @return void
*/
public function parseDomain(SimpleXMLElement $xml, array &$ret)
{
// Initialise
$ret['views'] = array();
// Parse view configuration
$viewData = $xml->xpath('view');
// Sanity check
if (empty($viewData))
{
return;
}
foreach ($viewData as $aView)
{
$key = (string) $aView['name'];
// Parse ACL options
$ret['views'][$key]['acl'] = array();
$aclData = $aView->xpath('acl/task');
if (!empty($aclData))
{
foreach ($aclData as $acl)
{
$k = (string) $acl['name'];
$ret['views'][$key]['acl'][$k] = (string) $acl;
}
}
// Parse taskmap
$ret['views'][$key]['taskmap'] = array();
$taskmapData = $aView->xpath('taskmap/task');
if (!empty($taskmapData))
{
foreach ($taskmapData as $map)
{
$k = (string) $map['name'];
$ret['views'][$key]['taskmap'][$k] = (string)
$map;
}
}
// Parse controller configuration
$ret['views'][$key]['config'] = array();
$optionData = $aView->xpath('config/option');
if (!empty($optionData))
{
foreach ($optionData as $option)
{
$k = (string) $option['name'];
$ret['views'][$key]['config'][$k] = (string)
$option;
}
}
// Parse the toolbar
$ret['views'][$key]['toolbar'] = array();
$toolBars = $aView->xpath('toolbar');
if (!empty($toolBars))
{
foreach ($toolBars as $toolBar)
{
$taskName = isset($toolBar['task']) ? (string)
$toolBar['task'] : '*';
// If a toolbar title is specified, create a title element.
if (isset($toolBar['title']))
{
$ret['views'][$key]['toolbar'][$taskName]['title']
= array(
'value' => (string) $toolBar['title']
);
}
// Parse the toolbar buttons data
$toolbarData = $toolBar->xpath('button');
if (!empty($toolbarData))
{
foreach ($toolbarData as $button)
{
$k = (string) $button['type'];
$ret['views'][$key]['toolbar'][$taskName][$k] =
current($button->attributes());
$ret['views'][$key]['toolbar'][$taskName][$k]['value']
= (string) $button;
}
}
}
}
}
}
/**
* Return a configuration variable
*
* @param string &$configuration Configuration variables (hashed
array)
* @param string $var The variable we want to fetch
* @param mixed $default Default value
*
* @return mixed The variable's value
*/
public function get(&$configuration, $var, $default)
{
$parts = explode('.', $var);
$view = $parts[0];
$method = 'get' . ucfirst($parts[1]);
if (!method_exists($this, $method))
{
return $default;
}
array_shift($parts);
array_shift($parts);
$ret = $this->$method($view, $configuration, $parts, $default);
return $ret;
}
/**
* Internal function to return the task map for a view
*
* @param string $view The view for which we will be
fetching a task map
* @param array &$configuration The configuration parameters hash
array
* @param array $params Extra options (not used)
* @param array $default ßDefault task map; empty array if
not provided
*
* @return array The task map as a hash array in the format task =>
method
*/
protected function getTaskmap($view, &$configuration, $params,
$default = array())
{
$taskmap = array();
if (isset($configuration['views']['*']) &&
isset($configuration['views']['*']['taskmap']))
{
$taskmap =
$configuration['views']['*']['taskmap'];
}
if (isset($configuration['views'][$view]) &&
isset($configuration['views'][$view]['taskmap']))
{
$taskmap = array_merge($taskmap,
$configuration['views'][$view]['taskmap']);
}
if (empty($taskmap))
{
return $default;
}
return $taskmap;
}
/**
* Internal method to return the ACL mapping (privilege required to access
* a specific task) for the given view's tasks
*
* @param string $view The view for which we will be
fetching a task map
* @param array &$configuration The configuration parameters hash
array
* @param array $params Extra options; key 0 defines the task
we want to fetch
* @param string $default Default ACL option; empty (no ACL
check) if not defined
*
* @return string The privilege required to access this view
*/
protected function getAcl($view, &$configuration, $params, $default =
'')
{
$aclmap = array();
if (isset($configuration['views']['*']) &&
isset($configuration['views']['*']['acl']))
{
$aclmap =
$configuration['views']['*']['acl'];
}
if (isset($configuration['views'][$view]) &&
isset($configuration['views'][$view]['acl']))
{
$aclmap = array_merge($aclmap,
$configuration['views'][$view]['acl']);
}
$acl = $default;
if (isset($aclmap['*']))
{
$acl = $aclmap['*'];
}
if (isset($aclmap[$params[0]]))
{
$acl = $aclmap[$params[0]];
}
return $acl;
}
/**
* Internal method to return the a configuration option for the view.
These
* are equivalent to $config array options passed to the Controller
*
* @param string $view The view for which we will be
fetching a task map
* @param array &$configuration The configuration parameters hash
array
* @param array $params Extra options; key 0 defines the
option variable we want to fetch
* @param mixed $default Default option; null if not defined
*
* @return string The setting for the requested option
*/
protected function getConfig($view, &$configuration, $params, $default
= null)
{
$ret = $default;
if (isset($configuration['views']['*'])
&&
isset($configuration['views']['*']['config'])
&&
isset($configuration['views']['*']['config'][$params[0]]))
{
$ret =
$configuration['views']['*']['config'][$params[0]];
}
if (isset($configuration['views'][$view])
&&
isset($configuration['views'][$view]['config'])
&&
isset($configuration['views'][$view]['config'][$params[0]]))
{
$ret =
$configuration['views'][$view]['config'][$params[0]];
}
return $ret;
}
/**
* Internal method to return the toolbar infos.
*
* @param string $view The view for which we will be
fetching buttons
* @param array &$configuration The configuration parameters hash
array
* @param array $params Extra options
* @param string $default Default option
*
* @return string The toolbar data for this view
*/
protected function getToolbar($view, &$configuration, $params,
$default = '')
{
$toolbar = array();
if (isset($configuration['views']['*'])
&&
isset($configuration['views']['*']['toolbar'])
&&
isset($configuration['views']['*']['toolbar']['*']))
{
$toolbar =
$configuration['views']['*']['toolbar']['*'];
}
if (isset($configuration['views']['*'])
&&
isset($configuration['views']['*']['toolbar'])
&&
isset($configuration['views']['*']['toolbar'][$params[0]]))
{
$toolbar = array_merge($toolbar,
$configuration['views']['*']['toolbar'][$params[0]]);
}
if (isset($configuration['views'][$view])
&&
isset($configuration['views'][$view]['toolbar'])
&&
isset($configuration['views'][$view]['toolbar']['*']))
{
$toolbar = array_merge($toolbar,
$configuration['views'][$view]['toolbar']['*']);
}
if (isset($configuration['views'][$view])
&&
isset($configuration['views'][$view]['toolbar'])
&&
isset($configuration['views'][$view]['toolbar'][$params[0]]))
{
$toolbar = array_merge($toolbar,
$configuration['views'][$view]['toolbar'][$params[0]]);
}
if (empty($toolbar))
{
return $default;
}
return $toolbar;
}
}
PK`��[W�5�provider.phpnu�[���<?php
/**
* @package FrameworkOnFramework
* @subpackage config
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba
Ltd. All rights reserved.
* @license GNU General Public License version 2, or later
* @note This file has been modified by the Joomla! Project and no
longer reflects the original work of its author.
*/
defined('FOF_INCLUDED') or die();
/**
* Reads and parses the fof.xml file in the back-end of a FOF-powered
component,
* provisioning the data to the rest of the FOF framework
*
* @package FrameworkOnFramework
* @since 2.1
*/
class FOFConfigProvider
{
/**
* Cache of FOF components' configuration variables
*
* @var array
*/
public static $configurations = array();
/**
* Parses the configuration of the specified component
*
* @param string $component The name of the component, e.g.
com_foobar
* @param boolean $force Force reload even if it's already
parsed?
*
* @return void
*/
public function parseComponent($component, $force = false)
{
if (!$force && isset(self::$configurations[$component]))
{
return;
}
if (FOFPlatform::getInstance()->isCli())
{
$order = array('cli', 'backend');
}
elseif (FOFPlatform::getInstance()->isBackend())
{
$order = array('backend');
}
else
{
$order = array('frontend');
}
$order[] = 'common';
$order = array_reverse($order);
self::$configurations[$component] = array();
foreach ($order as $area)
{
$config = $this->parseComponentArea($component, $area);
self::$configurations[$component] =
array_merge_recursive(self::$configurations[$component], $config);
}
}
/**
* Returns the value of a variable. Variables use a dot notation, e.g.
* view.config.whatever where the first part is the domain, the rest of
the
* parts specify the path to the variable.
*
* @param string $variable The variable name
* @param mixed $default The default value, or null if not specified
*
* @return mixed The value of the variable
*/
public function get($variable, $default = null)
{
static $domains = null;
if (is_null($domains))
{
$domains = $this->getDomains();
}
list($component, $domain, $var) = explode('.', $variable, 3);
if (!isset(self::$configurations[$component]))
{
$this->parseComponent($component);
}
if (!in_array($domain, $domains))
{
return $default;
}
$class = 'FOFConfigDomain' . ucfirst($domain);
$o = new $class;
return $o->get(self::$configurations[$component], $var, $default);
}
/**
* Parses the configuration options of a specific component area
*
* @param string $component Which component's configuration to
parse
* @param string $area Which area to parse (frontend, backend,
cli)
*
* @return array A hash array with the configuration data
*/
protected function parseComponentArea($component, $area)
{
// Initialise the return array
$ret = array();
// Get the folders of the component
$componentPaths =
FOFPlatform::getInstance()->getComponentBaseDirs($component);
$filesystem =
FOFPlatform::getInstance()->getIntegrationObject('filesystem');
// Check that the path exists
$path = $componentPaths['admin'];
$path = $filesystem->pathCheck($path);
if (!$filesystem->folderExists($path))
{
return $ret;
}
// Read the filename if it exists
$filename = $path . '/fof.xml';
if (!$filesystem->fileExists($filename))
{
return $ret;
}
$data = file_get_contents($filename);
// Load the XML data in a SimpleXMLElement object
$xml = simplexml_load_string($data);
if (!($xml instanceof SimpleXMLElement))
{
return $ret;
}
// Get this area's data
$areaData = $xml->xpath('//' . $area);
if (empty($areaData))
{
return $ret;
}
$xml = array_shift($areaData);
// Parse individual configuration domains
$domains = $this->getDomains();
foreach ($domains as $dom)
{
$class = 'FOFConfigDomain' . ucfirst($dom);
if (class_exists($class, true))
{
$o = new $class;
$o->parseDomain($xml, $ret);
}
}
// Finally, return the result
return $ret;
}
/**
* Gets a list of the available configuration domain adapters
*
* @return array A list of the available domains
*/
protected function getDomains()
{
static $domains = array();
if (empty($domains))
{
$filesystem =
FOFPlatform::getInstance()->getIntegrationObject('filesystem');
$files = $filesystem->folderFiles(__DIR__ . '/domain',
'.php');
if (!empty($files))
{
foreach ($files as $file)
{
$domain = basename($file, '.php');
if ($domain == 'interface')
{
continue;
}
$domain = preg_replace('/[^A-Za-z0-9]/', '',
$domain);
$domains[] = $domain;
}
$domains = array_unique($domains);
}
}
return $domains;
}
}
PK`��[s�_���domain/dispatcher.phpnu�[���PK`��[I{.�^^�domain/interface.phpnu�[���PK`��[Y���domain/tables.phpnu�[���PK`��[�H_�
�
T*domain/views.phpnu�[���PK`��[W�5�-Kprovider.phpnu�[���PK�z^