0byt3m1n1-V2
Path:
/
home
/
a
/
c
/
a
/
academiac
/
www
/
[
Home
]
File: ini.php.tar
home/academiac/www/plugins/content/geshi/geshi/geshi/ini.php 0000644 00000007462 15137465235 0020153 0 ustar 00 <?php // no direct access defined('_JEXEC') or die; /************************************************************************************* * ini.php * -------- * Author: deguix (cevo_deguix@yahoo.com.br) * Copyright: (c) 2005 deguix * Release Version: 1.0.8.10 * Date Started: 2005/03/27 * * INI language file for GeSHi. * * CHANGES * ------- * 2008/05/23 (1.0.7.22) * - Added description of extra language features (SF#1970248) * 2005/12/28 (1.0.1) * - Removed unnecessary keyword style index * - Added support for " strings * 2005/04/05 (1.0.0) * - First Release * * TODO (updated 2005/03/27) * ------------------------- * ************************************************************************************* * * This file is part of GeSHi. * * GeSHi is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * GeSHi is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GeSHi; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ************************************************************************************/ $language_data = array ( 'LANG_NAME' => 'INI', 'COMMENT_SINGLE' => array(0 => ';'), 'COMMENT_MULTI' => array(), 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, 'QUOTEMARKS' => array('"'), 'ESCAPE_CHAR' => '', 'KEYWORDS' => array( ), 'SYMBOLS' => array( '[', ']', '=' ), 'CASE_SENSITIVE' => array( GESHI_COMMENTS => false ), 'STYLES' => array( 'KEYWORDS' => array( ), 'COMMENTS' => array( 0 => 'color: #666666; font-style: italic;' ), 'ESCAPE_CHAR' => array( 0 => '' ), 'BRACKETS' => array( 0 => '' ), 'STRINGS' => array( 0 => 'color: #933;' ), 'NUMBERS' => array( 0 => '' ), 'METHODS' => array( 0 => '' ), 'SYMBOLS' => array( 0 => 'color: #000066; font-weight:bold;' ), 'REGEXPS' => array( 0 => 'color: #000066; font-weight:bold;', 1 => 'color: #000099;', 2 => 'color: #660066;' ), 'SCRIPT' => array( 0 => '' ) ), 'URLS' => array( ), 'OOLANG' => false, 'OBJECT_SPLITTERS' => array( ), 'REGEXPS' => array( //Section names 0 => '\[.+\]', //Entry names 1 => array( GESHI_SEARCH => '^(\s*)([a-zA-Z0-9_\-]+)(\s*=)', GESHI_REPLACE => '\\2', GESHI_MODIFIERS => 'm', GESHI_BEFORE => '\\1', GESHI_AFTER => '\\3' ), //Entry values 2 => array( // Evil hackery to get around GeSHi bug: <>" and ; are added so <span>s can be matched // Explicit match on variable names because if a comment is before the first < of the span // gets chewed up... GESHI_SEARCH => '([<>";a-zA-Z0-9_]+\s*)=(.*)', GESHI_REPLACE => '\\2', GESHI_MODIFIERS => '', GESHI_BEFORE => '\\1=', GESHI_AFTER => '' ) ), 'STRICT_MODE_APPLIES' => GESHI_NEVER, 'SCRIPT_DELIMITERS' => array( ), 'HIGHLIGHT_STRICT_BLOCK' => array( ) ); ?> home/academiac/www/libraries/joomla/registry/format/ini.php 0000644 00000012740 15140600351 0020073 0 ustar 00 <?php /** * @package Joomla.Platform * @subpackage Registry * * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; /** * INI format handler for JRegistry. * * @package Joomla.Platform * @subpackage Registry * @since 11.1 */ class JRegistryFormatINI extends JRegistryFormat { protected static $cache = array(); /** * Converts an object into an INI formatted string * - Unfortunately, there is no way to have ini values nested further than two * levels deep. Therefore we will only go through the first two levels of * the object. * * @param object $object Data source object. * @param array $options Options used by the formatter. * * @return string INI formatted string. * * @since 11.1 */ public function objectToString($object, $options = array()) { // Initialize variables. $local = array(); $global = array(); // Iterate over the object to set the properties. foreach (get_object_vars($object) as $key => $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; } }
©
2018.