AAAAPK b4A\$~ð¢ï ï json.phpnu W+A„¶ false))
{
// Fix legacy API.
if (is_bool($options))
{
$options = array('processSections' => $options);
// Deprecation warning.
JLog::add('JRegistryFormatJSON::stringToObject() second argument should not be a boolean.', JLog::WARNING, 'deprecated');
}
$data = trim($data);
if ((substr($data, 0, 1) != '{') && (substr($data, -1, 1) != '}'))
{
$ini = JRegistryFormat::getInstance('INI');
$obj = $ini->stringToObject($data, $options);
}
else
{
$obj = json_decode($data);
}
return $obj;
}
}
PK b4A\®)ÕÐ .htaccessnu W+A„¶
Order allow,deny
Deny from all
PK b4A\ù5Œà xml.phpnu W+A„¶ ');
// Iterate over the object members.
$this->getXmlChildren($root, $object, $nodeName);
return $root->asXML();
}
/**
* Parse a XML formatted string and convert it into an object.
*
* @param string $data XML formatted string to convert.
* @param array $options Options used by the formatter.
*
* @return object Data object.
*
* @since 11.1
*/
public function stringToObject($data, $options = array())
{
// Initialize variables.
$obj = new stdClass;
// Parse the XML string.
$xml = simplexml_load_string($data);
foreach ($xml->children() as $node)
{
$obj->$node['name'] = $this->getValueFromNode($node);
}
return $obj;
}
/**
* Method to get a PHP native value for a SimpleXMLElement object. -- called recursively
*
* @param object $node SimpleXMLElement object for which to get the native value.
*
* @return mixed Native value of the SimpleXMLElement object.
*
* @since 11.1
*/
protected function getValueFromNode($node)
{
switch ($node['type'])
{
case 'integer':
$value = (string) $node;
return (int) $value;
break;
case 'string':
return (string) $node;
break;
case 'boolean':
$value = (string) $node;
return (bool) $value;
break;
case 'double':
$value = (string) $node;
return (float) $value;
break;
case 'array':
$value = array();
foreach ($node->children() as $child)
{
$value[(string) $child['name']] = $this->getValueFromNode($child);
}
break;
default:
$value = new stdClass;
foreach ($node->children() as $child)
{
$value->$child['name'] = $this->getValueFromNode($child);
}
break;
}
return $value;
}
/**
* Method to build a level of the XML string -- called recursively
*
* @param SimpleXMLElement &$node SimpleXMLElement object to attach children.
* @param object $var Object that represents a node of the XML document.
* @param string $nodeName The name to use for node elements.
*
* @return void
*
* @since 11.1
*/
protected function getXmlChildren(&$node, $var, $nodeName)
{
// Iterate over the object members.
foreach ((array) $var as $k => $v)
{
if (is_scalar($v))
{
$n = $node->addChild($nodeName, $v);
$n->addAttribute('name', $k);
$n->addAttribute('type', gettype($v));
}
else
{
$n = $node->addChild($nodeName);
$n->addAttribute('name', $k);
$n->addAttribute('type', gettype($v));
$this->getXmlChildren($n, $v, $nodeName);
}
}
}
}
PK b4A\¦V‰
index.htmlnu W+A„¶
PK b4A\ý¥» php.phpnu W+A„¶ $v)
{
if (is_scalar($v))
{
$vars .= "\tpublic $" . $k . " = '" . addcslashes($v, '\\\'') . "';\n";
}
elseif (is_array($v) || is_object($v))
{
$vars .= "\tpublic $" . $k . " = " . $this->getArrayString((array) $v) . ";\n";
}
}
$str = "";
}
return $str;
}
/**
* Parse a PHP class formatted string and convert it into an object.
*
* @param string $data PHP Class formatted string to convert.
* @param array $options Options used by the formatter.
*
* @return object Data object.
*
* @since 11.1
*/
public function stringToObject($data, $options = array())
{
return true;
}
/**
* Method to get an array as an exported string.
*
* @param array $a The array to get as a string.
*
* @return array
*
* @since 11.1
*/
protected function getArrayString($a)
{
$s = 'array(';
$i = 0;
foreach ($a as $k => $v)
{
$s .= ($i) ? ', ' : '';
$s .= '"' . $k . '" => ';
if (is_array($v) || is_object($v))
{
$s .= $this->getArrayString((array) $v);
}
else
{
$s .= '"' . addslashes($v) . '"';
}
$i++;
}
$s .= ')';
return $s;
}
}
PK b4A\µ)p à à ini.phpnu W+A„¶ $value)
{
// If the value is an object then we need to put it in a local section.
if (is_object($value))
{
// Add the section line.
$local[] = '';
$local[] = '[' . $key . ']';
// Add the properties for this section.
foreach (get_object_vars($value) as $k => $v)
{
$local[] = $k . '=' . $this->getValueAsINI($v);
}
}
else
{
// Not in a section so add the property to the global array.
$global[] = $key . '=' . $this->getValueAsINI($value);
}
}
return implode("\n", array_merge($global, $local));
}
/**
* Parse an INI formatted string and convert it into an object.
*
* @param string $data INI formatted string to convert.
* @param mixed $options An array of options used by the formatter, or a boolean setting to process sections.
*
* @return object Data object.
*
* @since 11.1
*/
public function stringToObject($data, $options = array())
{
// Initialise options.
if (is_array($options))
{
$sections = (isset($options['processSections'])) ? $options['processSections'] : false;
}
else
{
// Backward compatibility for 1.5 usage.
//@deprecated
$sections = (boolean) $options;
}
// Check the memory cache for already processed strings.
$hash = md5($data . ':' . (int) $sections);
if (isset(self::$cache[$hash]))
{
return self::$cache[$hash];
}
// If no lines present just return the object.
if (empty($data))
{
return new stdClass;
}
// Initialize variables.
$obj = new stdClass;
$section = false;
$lines = explode("\n", $data);
// Process the lines.
foreach ($lines as $line)
{
// Trim any unnecessary whitespace.
$line = trim($line);
// Ignore empty lines and comments.
if (empty($line) || ($line{0} == ';'))
{
continue;
}
if ($sections)
{
$length = strlen($line);
// If we are processing sections and the line is a section add the object and continue.
if (($line[0] == '[') && ($line[$length - 1] == ']'))
{
$section = substr($line, 1, $length - 2);
$obj->$section = new stdClass;
continue;
}
}
elseif ($line{0} == '[')
{
continue;
}
// Check that an equal sign exists and is not the first character of the line.
if (!strpos($line, '='))
{
// Maybe throw exception?
continue;
}
// Get the key and value for the line.
list ($key, $value) = explode('=', $line, 2);
// Validate the key.
if (preg_match('/[^A-Z0-9_]/i', $key))
{
// Maybe throw exception?
continue;
}
// If the value is quoted then we assume it is a string.
$length = strlen($value);
if ($length && ($value[0] == '"') && ($value[$length - 1] == '"'))
{
// Strip the quotes and Convert the new line characters.
$value = stripcslashes(substr($value, 1, ($length - 2)));
$value = str_replace('\n', "\n", $value);
}
else
{
// If the value is not quoted, we assume it is not a string.
// If the value is 'false' assume boolean false.
if ($value == 'false')
{
$value = false;
}
// If the value is 'true' assume boolean true.
elseif ($value == 'true')
{
$value = true;
}
// If the value is numeric than it is either a float or int.
elseif (is_numeric($value))
{
// If there is a period then we assume a float.
if (strpos($value, '.') !== false)
{
$value = (float) $value;
}
else
{
$value = (int) $value;
}
}
}
// If a section is set add the key/value to the section, otherwise top level.
if ($section)
{
$obj->$section->$key = $value;
}
else
{
$obj->$key = $value;
}
}
// Cache the string to save cpu cycles -- thus the world :)
self::$cache[$hash] = clone ($obj);
return $obj;
}
/**
* Method to get a value in an INI format.
*
* @param mixed $value The value to convert to INI format.
*
* @return string The value in INI format.
*
* @since 11.1
*/
protected function getValueAsINI($value)
{
// Initialize variables.
$string = '';
switch (gettype($value))
{
case 'integer':
case 'double':
$string = $value;
break;
case 'boolean':
$string = $value ? 'true' : 'false';
break;
case 'string':
// Sanitize any CRLF characters..
$string = '"' . str_replace(array("\r\n", "\n"), '\\n', $value) . '"';
break;
}
return $string;
}
}
PK b4A\$~ð¢ï ï json.phpnu W+A„¶ PK b4A\®)ÕÐ ' .htaccessnu W+A„¶ PK b4A\ù5Œà ß xml.phpnu W+A„¶ PK b4A\¦V‰
¶ index.htmlnu W+A„¶ PK b4A\ý¥» php.phpnu W+A„¶ PK b4A\µ)p à à M ini.phpnu W+A„¶ PK ° d6