AAAAPKX ?\z)cßß buffer.phpnuW+A„¶name = $url["host"]; $this->_buffers[$this->name] = null; $this->position = 0; return true; } /** * Read stream * * @param integer $count How many bytes of data from the current position should be returned. * * @return mixed The data from the stream up to the specified number of bytes (all data if * the total number of bytes in the stream is less than $count. Null if * the stream is empty. * * @see streamWrapper::stream_read * @since 11.1 */ public function stream_read($count) { $ret = substr($this->_buffers[$this->name], $this->position, $count); $this->position += strlen($ret); return $ret; } /** * Write stream * * @param string $data The data to write to the stream. * * @return integer * * @see streamWrapper::stream_write * @since 11.1 */ public function stream_write($data) { $left = substr($this->_buffers[$this->name], 0, $this->position); $right = substr($this->_buffers[$this->name], $this->position + strlen($data)); $this->_buffers[$this->name] = $left . $data . $right; $this->position += strlen($data); return strlen($data); } /** * Function to get the current position of the stream * * @return integer * * @see streamWrapper::stream_tell * @since 11.1 */ public function stream_tell() { return $this->position; } /** * Function to test for end of file pointer * * @return boolean True if the pointer is at the end of the stream * * @see streamWrapper::stream_eof * @since 11.1 */ public function stream_eof() { return $this->position >= strlen($this->_buffers[$this->name]); } /** * The read write position updates in response to $offset and $whence * * @param integer $offset The offset in bytes * @param integer $whence Position the offset is added to * Options are SEEK_SET, SEEK_CUR, and SEEK_END * * @return boolean True if updated * * @see streamWrapper::stream_seek * @since 11.1 */ public function stream_seek($offset, $whence) { switch ($whence) { case SEEK_SET: if ($offset < strlen($this->_buffers[$this->name]) && $offset >= 0) { $this->position = $offset; return true; } else { return false; } break; case SEEK_CUR: if ($offset >= 0) { $this->position += $offset; return true; } else { return false; } break; case SEEK_END: if (strlen($this->_buffers[$this->name]) + $offset >= 0) { $this->position = strlen($this->_buffers[$this->name]) + $offset; return true; } else { return false; } break; default: return false; } } } // Register the stream stream_wrapper_register("buffer", "JBuffer"); PKX ?\¾•*ÒÒsimplecrypt.phpnuW+A„¶_key = (string) $key; } else { $conf = &JFactory::getConfig(); $this->_key = md5($conf->get('secret')); } } /** * Decrypt a string * * @param string $s String to decrypt * * @return string * * @since 11.1 * @deprecated 12.3 Use JCrypt instead. */ public function decrypt($s) { $ai = $this->_hexToIntArray($s); (string) $s1 = $this->_xorString($ai); return $s1; } /** * Encrypt a string * * @param string $s String to encrypt * * @return string * * @since 11.1 * @deprecated 12.3 Use JCrypt instead. */ public function encrypt($s) { $ai = $this->_xorCharString($s); $s1 = ''; for ($i = 0, $count = count($ai); $i < $count; $i++) { $s1 = $s1 . $this->_intToHex((int) $ai[$i]); } return $s1; } /** * Convert hex to an integer * * @param string $s The hex string to convert. * @param integer $i The offset? * * @return integer * * @since 11.1 * @deprecated 12.3 Use JCrypt instead. */ protected function _hexToInt($s, $i) { (int) $j = $i * 2; (string) $s1 = $s; (string) $c = substr($s1, $j, 1); // get the char at position $j, length 1 (string) $c1 = substr($s1, $j + 1, 1); // get the char at postion $j + 1, length 1 (int) $k = 0; switch ($c) { case "A": $k += 160; break; case "B": $k += 176; break; case "C": $k += 192; break; case "D": $k += 208; break; case "E": $k += 224; break; case "F": $k += 240; break; case " ": $k += 0; break; default: (int) $k = $k + (16 * (int) $c); break; } switch ($c1) { case "A": $k += 10; break; case "B": $k += 11; break; case "C": $k += 12; break; case "D": $k += 13; break; case "E": $k += 14; break; case "F": $k += 15; break; case " ": $k += 0; break; default: $k += (int) $c1; break; } return $k; } /** * Convert hex to an array of integers * * @param string $s The hex string to convert to an integer array. * * @return array An array of integers. * * @since 11.1 * @deprecated 12.3 Use JCrypt instead. */ protected function _hexToIntArray($s) { (string) $s1 = $s; (int) $i = strlen($s1); (int) $j = $i / 2; for ($l = 0; $l < $j; $l++) { (int) $k = $this->_hexToInt($s1, $l); $ai[$l] = $k; } return $ai; } /** * Convert character string to integer * * @param string $c The character to convert to an integer. * * @return integer * * @since 11.1 * @deprecated 12.3 Use JCrypt instead. */ protected function _charToInt($c) { $ac[0] = $c; return $ac; } /** * XorString * * @param string $ai The string. * * @return string * * @since 11.1 * @deprecated 12.3 Use JCrypt instead. */ protected function _xorString($ai) { $s = $this->_key; (int) $i = strlen($s); $ai1 = $ai; (int) $j = count($ai1); for ($i = 0; $i < $j; $i = strlen($s)) { $s = $s . $s; } for ($k = 0; $k < $j; $k++) { (string) $c = substr($s, $k, 1); $ac[$k] = chr($ai1[$k] ^ ord($c)); } (string) $s1 = implode('', $ac); return $s1; } /** * Convert integer to hex * * @param integer $i An integer value to convert. * * @return string * * @since 11.1 * @deprecated 12.3 Use JCrypt instead. */ protected function _intToHex($i) { (int) $j = (int) $i / 16; if ((int) $j == 0) { (string) $s = " "; } else { (string) $s = strtoupper(dechex($j)); } (int) $k = (int) $i - (int) $j * 16; (string) $s = $s . strtoupper(dechex($k)); return $s; } /** * Use xor encryption * * @param string $s The string. * * @return array An array of integers * * @since 11.1 * @deprecated 12.3 Use JCrypt instead. */ protected function _xorCharString($s) { $ac = preg_split('//', $s, -1, PREG_SPLIT_NO_EMPTY); (string) $s1 = $this->_key; (int) $i = strlen($s1); (int) $j = count($ac); for ($i = 0; $i < $j; $i = strlen($s1)) { $s1 = $s1 . $s1; } for ($k = 0; $k < $j; $k++) { $c = substr($s1, $k, 1); $ai[$k] = ord($c) ^ ord($ac[$k]); } return $ai; } } PKX ?\®)ÕÐ .htaccessnuW+A„¶ Order allow,deny Deny from all PKX ?\¦V‰ index.htmlnuW+A„¶ PKX ?\À£ÕþËË string.phpnuW+A„¶getName(); } /** * Legacy method to get the element data. * * @return string * * @deprecated 12.1 * @since 11.1 */ public function data() { // Deprecation warning. JLog::add('JXMLElement::data() is deprecated.', JLog::WARNING, 'deprecated'); return (string) $this; } /** * Legacy method gets an elements attribute by name. * * @param string $name Attribute to get * * @return string * * @since 11.1 * * @deprecated 12.1 * @see SimpleXMLElement::attributes */ public function getAttribute($name) { // Deprecation warning. JLog::add('JXMLelement::getAttributes() is deprecated.', JLog::WARNING, 'deprecated'); return (string) $this->attributes()->$name; } /** * Return a well-formed XML string based on SimpleXML element * * @param boolean $compressed Should we use indentation and newlines ? * @param integer $indent Indention level. * @param integer $level The level within the document which informs the indentation. * * @return string * * @since 11.1 * @deprecated 13.3 Use SimpleXMLElement::asXML() instead. */ public function asFormattedXML($compressed = false, $indent = "\t", $level = 0) { JLog::add('JXMLElement::asFormattedXML() is deprecated, use SimpleXMLElement::asXML() instead.', JLog::WARNING, 'deprecated'); $out = ''; // Start a new line, indent by the number indicated in $level $out .= ($compressed) ? '' : "\n" . str_repeat($indent, $level); // Add a <, and add the name of the tag $out .= '<' . $this->getName(); // For each attribute, add attr="value" foreach ($this->attributes() as $attr) { $out .= ' ' . $attr->getName() . '="' . htmlspecialchars((string) $attr, ENT_COMPAT, 'UTF-8') . '"'; } // If there are no children and it contains no data, end it off with a /> if (!count($this->children()) && !(string) $this) { $out .= " />"; } else { // If there are children if (count($this->children())) { // Close off the start tag $out .= '>'; $level++; // For each child, call the asFormattedXML function (this will ensure that all children are added recursively) foreach ($this->children() as $child) { $out .= $child->asFormattedXML($compressed, $indent, $level); } $level--; // Add the newline and indentation to go along with the close tag $out .= ($compressed) ? '' : "\n" . str_repeat($indent, $level); } elseif ((string) $this) { // If there is data, close off the start tag and add the data $out .= '>' . htmlspecialchars((string) $this, ENT_COMPAT, 'UTF-8'); } // Add the end tag $out .= 'getName() . '>'; } return $out; } } PKX ?\Ä®¬²??date.phpnuW+A„¶ 'Etc/GMT-12', '-11' => 'Pacific/Midway', '-10' => 'Pacific/Honolulu', '-9.5' => 'Pacific/Marquesas', '-9' => 'US/Alaska', '-8' => 'US/Pacific', '-7' => 'US/Mountain', '-6' => 'US/Central', '-5' => 'US/Eastern', '-4.5' => 'America/Caracas', '-4' => 'America/Barbados', '-3.5' => 'Canada/Newfoundland', '-3' => 'America/Buenos_Aires', '-2' => 'Atlantic/South_Georgia', '-1' => 'Atlantic/Azores', '0' => 'Europe/London', '1' => 'Europe/Amsterdam', '2' => 'Europe/Istanbul', '3' => 'Asia/Riyadh', '3.5' => 'Asia/Tehran', '4' => 'Asia/Muscat', '4.5' => 'Asia/Kabul', '5' => 'Asia/Karachi', '5.5' => 'Asia/Calcutta', '5.75' => 'Asia/Katmandu', '6' => 'Asia/Dhaka', '6.5' => 'Indian/Cocos', '7' => 'Asia/Bangkok', '8' => 'Australia/Perth', '8.75' => 'Australia/West', '9' => 'Asia/Tokyo', '9.5' => 'Australia/Adelaide', '10' => 'Australia/Brisbane', '10.5' => 'Australia/Lord_Howe', '11' => 'Pacific/Kosrae', '11.5' => 'Pacific/Norfolk', '12' => 'Pacific/Auckland', '12.75' => 'Pacific/Chatham', '13' => 'Pacific/Tongatapu', '14' => 'Pacific/Kiritimati'); /** * The DateTimeZone object for usage in rending dates as strings. * * @var object * @since 11.1 */ protected $_tz; /** * Constructor. * * @param string $date String in a format accepted by strtotime(), defaults to "now". * @param mixed $tz Time zone to be used for the date. * * @since 11.1 * * @throws JException */ public function __construct($date = 'now', $tz = null) { // Create the base GMT and server time zone objects. if (empty(self::$gmt) || empty(self::$stz)) { self::$gmt = new DateTimeZone('GMT'); self::$stz = new DateTimeZone(@date_default_timezone_get()); } // If the time zone object is not set, attempt to build it. if (!($tz instanceof DateTimeZone)) { if ($tz === null) { $tz = self::$gmt; } elseif (is_numeric($tz)) { // Translate from offset. $tz = new DateTimeZone(self::$offsets[(string) $tz]); } elseif (is_string($tz)) { $tz = new DateTimeZone($tz); } } // If the date is numeric assume a unix timestamp and convert it. date_default_timezone_set('UTC'); $date = is_numeric($date) ? date('c', $date) : $date; // Call the DateTime constructor. parent::__construct($date, $tz); // reset the timezone for 3rd party libraries/extension that does not use JDate date_default_timezone_set(self::$stz->getName()); // Set the timezone object for access later. $this->_tz = $tz; } /** * Magic method to access properties of the date given by class to the format method. * * @param string $name The name of the property. * * @return mixed A value if the property name is valid, null otherwise. * * @since 11.1 */ public function __get($name) { $value = null; switch ($name) { case 'daysinmonth': $value = $this->format('t', true); break; case 'dayofweek': $value = $this->format('N', true); break; case 'dayofyear': $value = $this->format('z', true); break; case 'isleapyear': $value = (boolean) $this->format('L', true); break; case 'day': $value = $this->format('d', true); break; case 'hour': $value = $this->format('H', true); break; case 'minute': $value = $this->format('i', true); break; case 'second': $value = $this->format('s', true); break; case 'month': $value = $this->format('m', true); break; case 'ordinal': $value = $this->format('S', true); break; case 'week': $value = $this->format('W', true); break; case 'year': $value = $this->format('Y', true); break; default: $trace = debug_backtrace(); trigger_error( 'Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_NOTICE ); } return $value; } /** * Magic method to render the date object in the format specified in the public * static member JDate::$format. * * @return string The date as a formatted string. * * @since 11.1 */ public function __toString() { return (string) parent::format(self::$format); } /** * Proxy for new JDate(). * * @param string $date String in a format accepted by strtotime(), defaults to "now". * @param mixed $tz Time zone to be used for the date. * * @return JDate * * @since 11.3 * @throws JException */ public static function getInstance($date = 'now', $tz = null) { return new JDate($date, $tz); } /** * Translates day of week number to a string. * * @param integer $day The numeric day of the week. * @param boolean $abbr Return the abbreviated day string? * * @return string The day of the week. * * @since 11.1 */ public function dayToString($day, $abbr = false) { switch ($day) { case 0: return $abbr ? JText::_('SUN') : JText::_('SUNDAY'); case 1: return $abbr ? JText::_('MON') : JText::_('MONDAY'); case 2: return $abbr ? JText::_('TUE') : JText::_('TUESDAY'); case 3: return $abbr ? JText::_('WED') : JText::_('WEDNESDAY'); case 4: return $abbr ? JText::_('THU') : JText::_('THURSDAY'); case 5: return $abbr ? JText::_('FRI') : JText::_('FRIDAY'); case 6: return $abbr ? JText::_('SAT') : JText::_('SATURDAY'); } } /** * Gets the date as a formatted string in a local calendar. * * @param string $format The date format specification string (see {@link PHP_MANUAL#date}) * @param boolean $local True to return the date string in the local time zone, false to return it in GMT. * @param boolean $translate True to translate localised strings * * @return string The date string in the specified format format. * * @since 11.1 */ public function calendar($format, $local = false, $translate = true) { return $this->format($format, $local, $translate); } /** * Gets the date as a formatted string. * * @param string $format The date format specification string (see {@link PHP_MANUAL#date}) * @param boolean $local True to return the date string in the local time zone, false to return it in GMT. * @param boolean $translate True to translate localised strings * * @return string The date string in the specified format format. * * @since 11.1 */ public function format($format, $local = false, $translate = true) { if ($translate) { // Do string replacements for date format options that can be translated. $format = preg_replace('/(^|[^\\\])D/', "\\1" . self::DAY_ABBR, $format); $format = preg_replace('/(^|[^\\\])l/', "\\1" . self::DAY_NAME, $format); $format = preg_replace('/(^|[^\\\])M/', "\\1" . self::MONTH_ABBR, $format); $format = preg_replace('/(^|[^\\\])F/', "\\1" . self::MONTH_NAME, $format); } // If the returned time should not be local use GMT. if ($local == false) { parent::setTimezone(self::$gmt); } // Format the date. $return = parent::format($format); if ($translate) { // Manually modify the month and day strings in the formatted time. if (strpos($return, self::DAY_ABBR) !== false) { $return = str_replace(self::DAY_ABBR, $this->dayToString(parent::format('w'), true), $return); } if (strpos($return, self::DAY_NAME) !== false) { $return = str_replace(self::DAY_NAME, $this->dayToString(parent::format('w')), $return); } if (strpos($return, self::MONTH_ABBR) !== false) { $return = str_replace(self::MONTH_ABBR, $this->monthToString(parent::format('n'), true), $return); } if (strpos($return, self::MONTH_NAME) !== false) { $return = str_replace(self::MONTH_NAME, $this->monthToString(parent::format('n')), $return); } } if ($local == false) { parent::setTimezone($this->_tz); } return $return; } /** * Get the time offset from GMT in hours or seconds. * * @param boolean $hours True to return the value in hours. * * @return float The time offset from GMT either in hours or in seconds. * * @since 11.1 */ public function getOffsetFromGMT($hours = false) { return (float) $hours ? ($this->_tz->getOffset($this) / 3600) : $this->_tz->getOffset($this); } /** * Translates month number to a string. * * @param integer $month The numeric month of the year. * @param boolean $abbr If true, return the abbreviated month string * * @return string The month of the year. * * @since 11.1 */ public function monthToString($month, $abbr = false) { switch ($month) { case 1: return $abbr ? JText::_('JANUARY_SHORT') : JText::_('JANUARY'); case 2: return $abbr ? JText::_('FEBRUARY_SHORT') : JText::_('FEBRUARY'); case 3: return $abbr ? JText::_('MARCH_SHORT') : JText::_('MARCH'); case 4: return $abbr ? JText::_('APRIL_SHORT') : JText::_('APRIL'); case 5: return $abbr ? JText::_('MAY_SHORT') : JText::_('MAY'); case 6: return $abbr ? JText::_('JUNE_SHORT') : JText::_('JUNE'); case 7: return $abbr ? JText::_('JULY_SHORT') : JText::_('JULY'); case 8: return $abbr ? JText::_('AUGUST_SHORT') : JText::_('AUGUST'); case 9: return $abbr ? JText::_('SEPTEMBER_SHORT') : JText::_('SEPTEMBER'); case 10: return $abbr ? JText::_('OCTOBER_SHORT') : JText::_('OCTOBER'); case 11: return $abbr ? JText::_('NOVEMBER_SHORT') : JText::_('NOVEMBER'); case 12: return $abbr ? JText::_('DECEMBER_SHORT') : JText::_('DECEMBER'); } } /** * Set the date offset (in hours). * * @param float $offset The offset in hours. * * @return boolean True on success. * * @since 11.1 * * @deprecated 12.1 Use setTimezone instead. */ public function setOffset($offset) { // Deprecation warning. JLog::add('JDate::setOffset() is deprecated.', JLog::WARNING, 'deprecated'); // Only set the timezone if the offset exists. if (isset(self::$offsets[(string) $offset])) { $this->_tz = new DateTimeZone(self::$offsets[(string) $offset]); $this->setTimezone($this->_tz); return true; } return false; } /** * Method to wrap the setTimezone() function and set the internal * time zone object. * * @param object $tz The new DateTimeZone object. * * @return DateTimeZone The old DateTimeZone object. * * @since 11.1 */ public function setTimezone($tz) { $this->_tz = $tz; return parent::setTimezone($tz); } /** * Gets the date in a specific format * * Returns a string formatted according to the given format. Month and weekday names and * other language dependent strings respect the current locale * * @param string $format The date format specification string (see {@link PHP_MANUAL#strftime}) * @param boolean $local True to return the date string in the local time zone, false to return it in GMT. * * @return string The date as a formatted string. * * @deprecated Use JDate::format() instead. * * @deprecated 12.1 Use JDate::format() instead. */ public function toFormat($format = '%Y-%m-%d %H:%M:%S', $local = false) { // Deprecation warning. JLog::add('JDate::toFormat() is deprecated.', JLog::WARNING, 'deprecated'); // Set time zone to GMT as strftime formats according locale setting. date_default_timezone_set('GMT'); // Generate the timestamp. $time = (int) parent::format('U'); // If the returned time should be local add the GMT offset. if ($local) { $time += $this->getOffsetFromGMT(); } // Manually modify the month and day strings in the format. if (strpos($format, '%a') !== false) { $format = str_replace('%a', $this->dayToString(date('w', $time), true), $format); } if (strpos($format, '%A') !== false) { $format = str_replace('%A', $this->dayToString(date('w', $time)), $format); } if (strpos($format, '%b') !== false) { $format = str_replace('%b', $this->monthToString(date('n', $time), true), $format); } if (strpos($format, '%B') !== false) { $format = str_replace('%B', $this->monthToString(date('n', $time)), $format); } // Generate the formatted string. $date = strftime($format, $time); // reset the timezone for 3rd party libraries/extension that does not use JDate date_default_timezone_set(self::$stz->getName()); return $date; } /** * Gets the date as an ISO 8601 string. IETF RFC 3339 defines the ISO 8601 format * and it can be found at the IETF Web site. * * @param boolean $local True to return the date string in the local time zone, false to return it in GMT. * * @return string The date string in ISO 8601 format. * * @link http://www.ietf.org/rfc/rfc3339.txt * @since 11.1 */ public function toISO8601($local = false) { return $this->format(DateTime::RFC3339, $local, false); } /** * Gets the date as an MySQL datetime string. * * @param boolean $local True to return the date string in the local time zone, false to return it in GMT. * * @return string The date string in MySQL datetime format. * * @link http://dev.mysql.com/doc/refman/5.0/en/datetime.html * @since 11.1 * @deprecated 12.1 Use JDate::toSql() */ public function toMySQL($local = false) { JLog::add('JDate::toMySQL() is deprecated. Use JDate::toSql() instead.', JLog::WARNING, 'deprecated'); return $this->format('Y-m-d H:i:s', $local, false); } /** * Gets the date as an SQL datetime string. * * @param boolean $local True to return the date string in the local time zone, false to return it in GMT. * @param JDatabase $dbo The database driver or null to use JFactory::getDbo() * * @return string The date string in SQL datetime format. * * @link http://dev.mysql.com/doc/refman/5.0/en/datetime.html * @since 11.4 */ public function toSql($local = false, JDatabase $dbo = null) { if ($dbo === null) { $dbo = JFactory::getDbo(); } return $this->format($dbo->getDateFormat(), $local, false); } /** * Gets the date as an RFC 822 string. IETF RFC 2822 supercedes RFC 822 and its definition * can be found at the IETF Web site. * * @param boolean $local True to return the date string in the local time zone, false to return it in GMT. * * @return string The date string in RFC 822 format. * * @link http://www.ietf.org/rfc/rfc2822.txt * @since 11.1 */ public function toRFC822($local = false) { return $this->format(DateTime::RFC2822, $local, false); } /** * Gets the date as UNIX time stamp. * * @return integer The date as a UNIX timestamp. * * @since 11.1 */ public function toUnix() { return (int) parent::format('U'); } } PKX ?\NÏã/ã/arrayhelper.phpnuW+A„¶ $v) { $array[$i] = (int) $v; } } else { if ($default === null) { $array = array(); } elseif (is_array($default)) { JArrayHelper::toInteger($default, null); $array = $default; } else { $array = array((int) $default); } } } /** * Utility function to map an array to a stdClass object. * * @param array &$array The array to map. * @param string $class Name of the class to create * * @return object The object mapped from the given array * * @since 11.1 */ public static function toObject(&$array, $class = 'stdClass') { $obj = null; if (is_array($array)) { $obj = new $class; foreach ($array as $k => $v) { if (is_array($v)) { $obj->$k = JArrayHelper::toObject($v, $class); } else { $obj->$k = $v; } } } return $obj; } /** * Utility function to map an array to a string. * * @param array $array The array to map. * @param string $inner_glue The glue (optional, defaults to '=') between the key and the value. * @param string $outer_glue The glue (optional, defaults to ' ') between array elements. * @param boolean $keepOuterKey True if final key should be kept. * * @return string The string mapped from the given array * * @since 11.1 */ public static function toString($array = null, $inner_glue = '=', $outer_glue = ' ', $keepOuterKey = false) { $output = array(); if (is_array($array)) { foreach ($array as $key => $item) { if (is_array($item)) { if ($keepOuterKey) { $output[] = $key; } // This is value is an array, go and do it again! $output[] = JArrayHelper::toString($item, $inner_glue, $outer_glue, $keepOuterKey); } else { $output[] = $key . $inner_glue . '"' . $item . '"'; } } } return implode($outer_glue, $output); } /** * Utility function to map an object to an array * * @param object $p_obj The source object * @param boolean $recurse True to recurse through multi-level objects * @param string $regex An optional regular expression to match on field names * * @return array The array mapped from the given object * * @since 11.1 */ public static function fromObject($p_obj, $recurse = true, $regex = null) { if (is_object($p_obj)) { return self::_fromObject($p_obj, $recurse, $regex); } else { return null; } } /** * Utility function to map an object or array to an array * * @param mixed $item The source object or array * @param boolean $recurse True to recurse through multi-level objects * @param string $regex An optional regular expression to match on field names * * @return array The array mapped from the given object * * @since 11.1 */ protected static function _fromObject($item, $recurse, $regex) { if (is_object($item)) { $result = array(); foreach (get_object_vars($item) as $k => $v) { if (!$regex || preg_match($regex, $k)) { if ($recurse) { $result[$k] = self::_fromObject($v, $recurse, $regex); } else { $result[$k] = $v; } } } } elseif (is_array($item)) { $result = array(); foreach ($item as $k => $v) { $result[$k] = self::_fromObject($v, $recurse, $regex); } } else { $result = $item; } return $result; } /** * Extracts a column from an array of arrays or objects * * @param array &$array The source array * @param string $index The index of the column or name of object property * * @return array Column of values from the source array * * @since 11.1 */ public static function getColumn(&$array, $index) { $result = array(); if (is_array($array)) { $n = count($array); for ($i = 0; $i < $n; $i++) { $item = &$array[$i]; if (is_array($item) && isset($item[$index])) { $result[] = $item[$index]; } elseif (is_object($item) && isset($item->$index)) { $result[] = $item->$index; } // else ignore the entry } } return $result; } /** * Utility function to return a value from a named array or a specified default * * @param array &$array A named array * @param string $name The key to search for * @param mixed $default The default value to give if no key found * @param string $type Return type for the variable (INT, FLOAT, STRING, WORD, BOOLEAN, ARRAY) * * @return mixed The value from the source array * * @since 11.1 */ public static function getValue(&$array, $name, $default = null, $type = '') { // Initialise variables. $result = null; if (isset($array[$name])) { $result = $array[$name]; } // Handle the default case if (is_null($result)) { $result = $default; } // Handle the type constraint switch (strtoupper($type)) { case 'INT': case 'INTEGER': // Only use the first integer value @preg_match('/-?[0-9]+/', $result, $matches); $result = @(int) $matches[0]; break; case 'FLOAT': case 'DOUBLE': // Only use the first floating point value @preg_match('/-?[0-9]+(\.[0-9]+)?/', $result, $matches); $result = @(float) $matches[0]; break; case 'BOOL': case 'BOOLEAN': $result = (bool) $result; break; case 'ARRAY': if (!is_array($result)) { $result = array($result); } break; case 'STRING': $result = (string) $result; break; case 'WORD': $result = (string) preg_replace('#\W#', '', $result); break; case 'NONE': default: // No casting necessary break; } return $result; } /** * Method to determine if an array is an associative array. * * @param array $array An array to test. * * @return boolean True if the array is an associative array. * * @since 11.1 */ public static function isAssociative($array) { if (is_array($array)) { foreach (array_keys($array) as $k => $v) { if ($k !== $v) { return true; } } } return false; } /** * Pivots an array to create a reverse lookup of an array of scalars, arrays or objects. * * @param array $source The source array. * @param string $key Where the elements of the source array are objects or arrays, the key to pivot on. * * @return array An array of arrays pivoted either on the value of the keys, or an individual key of an object or array. * * @since 11.3 */ public static function pivot($source, $key = null) { $result = array(); $counter = array(); foreach ($source as $index => $value) { // Determine the name of the pivot key, and its value. if (is_array($value)) { // If the key does not exist, ignore it. if (!isset($value[$key])) { continue; } $resultKey = $value[$key]; $resultValue = &$source[$index]; } elseif (is_object($value)) { // If the key does not exist, ignore it. if (!isset($value->$key)) { continue; } $resultKey = $value->$key; $resultValue = &$source[$index]; } else { // Just a scalar value. $resultKey = $value; $resultValue = $index; } // The counter tracks how many times a key has been used. if (empty($counter[$resultKey])) { // The first time around we just assign the value to the key. $result[$resultKey] = $resultValue; $counter[$resultKey] = 1; } elseif ($counter[$resultKey] == 1) { // If there is a second time, we convert the value into an array. $result[$resultKey] = array( $result[$resultKey], $resultValue, ); $counter[$resultKey]++; } else { // After the second time, no need to track any more. Just append to the existing array. $result[$resultKey][] = $resultValue; } } unset($counter); return $result; } /** * Utility function to sort an array of objects on a given field * * @param array &$a An array of objects * @param mixed $k The key (string) or a array of key to sort on * @param mixed $direction Direction (integer) or an array of direction to sort in [1 = Ascending] [-1 = Descending] * @param mixed $caseSensitive Boolean or array of booleans to let sort occur case sensitive or insensitive * @param mixed $locale Boolean or array of booleans to let sort occur using the locale language or not * * @return array The sorted array of objects * * @since 11.1 */ public static function sortObjects(&$a, $k, $direction = 1, $caseSensitive = true, $locale = false) { if (!is_array($locale) or !is_array($locale[0])) { $locale = array($locale); } self::$sortCase = (array) $caseSensitive; self::$sortDirection = (array) $direction; self::$sortKey = (array) $k; self::$sortLocale = $locale; usort($a, array(__CLASS__, '_sortObjects')); self::$sortCase = null; self::$sortDirection = null; self::$sortKey = null; self::$sortLocale = null; return $a; } /** * Callback function for sorting an array of objects on a key * * @param array &$a An array of objects * @param array &$b An array of objects * * @return integer Comparison status * * @see JArrayHelper::sortObjects() * @since 11.1 */ protected static function _sortObjects(&$a, &$b) { $key = self::$sortKey; for ($i = 0, $count = count($key); $i < $count; $i++) { if (isset(self::$sortDirection[$i])) { $direction = self::$sortDirection[$i]; } if (isset(self::$sortCase[$i])) { $caseSensitive = self::$sortCase[$i]; } if (isset(self::$sortLocale[$i])) { $locale = self::$sortLocale[$i]; } $va = $a->$key[$i]; $vb = $b->$key[$i]; if ((is_bool($va) or is_numeric($va)) and (is_bool($vb) or is_numeric($vb))) { $cmp = $va - $vb; } elseif ($caseSensitive) { $cmp = JString::strcmp($va, $vb, $locale); } else { $cmp = JString::strcasecmp($va, $vb, $locale); } if ($cmp > 0) { return $direction; } if ($cmp < 0) { return -$direction; } } return 0; } /** * Multidimensional array safe unique test * * @param array $myArray The array to make unique. * * @return array * * @see http://php.net/manual/en/function.array-unique.php * @since 11.2 */ public static function arrayUnique($myArray) { if (!is_array($myArray)) { return $myArray; } foreach ($myArray as &$myvalue) { $myvalue = serialize($myvalue); } $myArray = array_unique($myArray); foreach ($myArray as &$myvalue) { $myvalue = unserialize($myvalue); } return $myArray; } } PKX ?\ïÆvs½U½U simplexml.phpnuW+A„¶document->node instead of $xml->node * You cannot access CDATA using array syntax. Use the method data() instead * You cannot access attributes directly with array syntax. Use attributes() * to read them. * Comments are ignored. * Last and least, this is not as fast as PHP5 SimpleXML--it is pure PHP4. * * Example: * * :simple.xml: * * * * Tom Foo * Tamara Bar * * * * --- * * // read and write a document * $xml = new JSimpleXML; * $xml->loadFile('simple.xml'); * print $xml->document->toString(); * * // access a given node's CDATA * print $xml->root->node->child[0]->data(); // Tom Foo * * // access attributes * $attr = $xml->root->node->child[1]->attributes(); * print $attr['gender']; // f * * // access children * foreach($xml->root->node->children() as $child) { * print $child->data(); * } * * * Note: JSimpleXML cannot be used to access sophisticated XML doctypes * using datatype ANY (e.g. XHTML). With a DOM implementation you can * handle this. * * @package Joomla.Platform * @subpackage Utilities * @see http://www.php.net/manual/en/book.simplexml.php * @since 11.1 * @deprecated 12.1 Use SimpleXML instead */ class JSimpleXML extends JObject { /** * The XML parser * * @var resource * @since 11.1 */ private $_parser = null; /** * Document element * * @var object * @since 11.1 */ public $document = null; /** * Current object depth * * @var array * @since 11.1 */ private $_stack = array(); /** * Constructor. * * @param array $options Options * * @deprecated 12.1 Use SimpleXML instead. * @see http://www.php.net/manual/en/book.simplexml.php * @since 11.1 */ public function __construct($options = null) { // Deprecation warning. JLog::add('JSimpleXML::__construct() is deprecated.', JLog::WARNING, 'deprecated'); if (! function_exists('xml_parser_create')) { // TODO throw warning return false; } // Create the parser resource and make sure both versions of PHP autodetect the format. $this->_parser = xml_parser_create(''); // Check parser resource xml_set_object($this->_parser, $this); xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, 0); if (is_array($options)) { foreach ($options as $option => $value) { xml_parser_set_option($this->_parser, $option, $value); } } // Set the handlers xml_set_element_handler($this->_parser, '_startElement', '_endElement'); xml_set_character_data_handler($this->_parser, '_characterData'); } /** * Interprets a string of XML into an object * * This function will take the well-formed XML string data and return an object of class * JSimpleXMLElement with properties containing the data held within the XML document. * If any errors occur, it returns FALSE. * * @param string $string Well-formed XML string data * @param string $classname currently ignored * * @return object JSimpleXMLElement * * @since 11.1 * * @deprecated 12.1 Use simpleXML_load_string * @see http://www.php.net/manual/en/function.simplexml-load-string.php */ public function loadString($string, $classname = null) { // Deprecation warning. JLog::add('JSimpleXML::loadString() is deprecated.', JLog::WARNING, 'deprecated'); $this->_parse($string); return true; } /** * Interprets an XML file into an object * * This function will convert the well-formed XML document in the file specified by filename * to an object of class JSimpleXMLElement. If any errors occur during file access or * interpretation, the function returns FALSE. * * @param string $path Path to XML file containing a well-formed XML document * @param string $classname currently ignored * * @return boolean True if successful, false if file empty * * @deprecated 12.1 Use simplexml_load_file instead * @see http://www.php.net/manual/en/function.simplexml-load-file.php * @since 11.1 */ public function loadFile($path, $classname = null) { // Deprecation warning. JLog::add('JSimpleXML::loadfile() is deprecated.', JLog::WARNING, 'deprecated'); //Check to see of the path exists if (!file_exists($path)) { return false; } //Get the XML document loaded into a variable $xml = trim(file_get_contents($path)); if ($xml == '') { return false; } else { $this->_parse($xml); return true; } } /** * Get a JSimpleXMLElement object from a DOM node. * * This function takes a node of a DOM document and makes it into a JSimpleXML node. * This new object can then be used as a native JSimpleXML element. If any errors occur, * it returns FALSE. * * @param string $node DOM document * @param string $classname currently ignored * * @return mixed JSimpleXMLElement or false if any errors occur * * @deprecated 12.1 use simplexml_import_dom instead. * @see http://www.php.net/manual/en/function.simplexml-import-dom.php * @since 11.1 */ public function importDOM($node, $classname = null) { // Deprecation warning. JLog::add('JSimpleXML::importDOM() is deprecated.', JLog::WARNING, 'deprecated'); return false; } /** * Get the parser * * @return resource XML parser resource handle * * @deprecated 12.1 Use SimpleXMLElement * @see http://www.php.net/manual/en/class.simplexmlelement.php * @since 11.1 */ public function getParser() { // Deprecation warning. JLog::add('JSimpleXML::getParser() is deprecated.', JLog::WARNING, 'deprecated'); return $this->_parser; } /** * Set the parser * * @param resource $parser XML parser resource handle. * * @return void * * @deprecated 12.1 Use SimpleXML * @see http://www.php.net/manual/en/class.simplexml.php * @since 11.1 */ public function setParser($parser) { // Deprecation warning. JLog::add('JSimpleXML::setParser() is deprecated.', JLog::WARNING, 'deprecated'); $this->_parser = $parser; } /** * Start parsing an XML document * * Parses an XML document. The handlers for the configured events are called as many times as necessary. * * @param string $data data to parse * * @return void * * @deprecated 12.1 * @see http://www.php.net/manual/en/class.simplexml.php * @since 11.1 */ protected function _parse($data = '') { // Deprecation warning. JLog::add('JSimpleXML::_parse() is deprecated.', JLog::WARNING, 'deprecated'); //Error handling if (!xml_parse($this->_parser, $data)) { $this->_handleError( xml_get_error_code($this->_parser), xml_get_current_line_number($this->_parser), xml_get_current_column_number($this->_parser) ); } //Free the parser xml_parser_free($this->_parser); } /** * Handles an XML parsing error * * @param integer $code XML Error Code. * @param integer $line Line on which the error happened. * @param integer $col Column on which the error happened. * * @return void * * @deprecated 12.1 * @since 11.1 * * @deprecated 12.1 Use PHP Exception */ protected function _handleError($code, $line, $col) { // Deprecation warning. JLog::add('JSimpleXML::_handleError() is deprecated.', JLog::WARNING, 'deprecated'); JError::raiseWarning('SOME_ERROR_CODE', 'XML Parsing Error at ' . $line . ':' . $col . '. Error ' . $code . ': ' . xml_error_string($code)); } /** * Gets the reference to the current direct parent * * @return object * * @since 11.1 * * @deprecated 12.1 */ protected function _getStackLocation() { // Deprecation warning. JLog::add('JSimpleXML::_getStackLocation() is deprecated.', JLog::WARNING, 'deprecated'); $return = ''; foreach ($this->_stack as $stack) { $return .= $stack . '->'; } return rtrim($return, '->'); } /** * Handler function for the start of a tag * * @param resource $parser The XML parser. * @param string $name The name of the element. * @param array $attrs A key-value array (optional) of the attributes for the element. * * @return void * * @since 11.1 * * @deprecated 12.1 */ protected function _startElement($parser, $name, $attrs = array()) { // Deprecation warning. JLog::add('JSimpleXML::startElement() is deprecated.', JLog::WARNING, 'deprecated'); // Check to see if tag is root-level $count = count($this->_stack); if ($count == 0) { // If so, set the document as the current tag $classname = get_class($this) . 'Element'; $this->document = new $classname($name, $attrs); // And start out the stack with the document tag $this->_stack = array('document'); } // If it isn't root level, use the stack to find the parent else { // Get the name which points to the current direct parent, relative to $this $parent = $this->_getStackLocation(); // Add the child eval('$this->' . $parent . '->addChild($name, $attrs, ' . $count . ');'); // Update the stack eval('$this->_stack[] = $name.\'[\'.(count($this->' . $parent . '->' . $name . ') - 1).\']\';'); } } /** * Handler function for the end of a tag * * @param resource $parser The XML parser. * @param string $name The name of the element. * * @return void * * @deprecated 12.1 * @since 11.1 */ protected function _endElement($parser, $name) { // Deprecation warning. JLog::add('JSimpleXML::endElement() is deprecated.', JLog::WARNING, 'deprecated'); //Update stack by removing the end value from it as the parent array_pop($this->_stack); } /** * Handler function for the character data within a tag * * @param resource $parser The XML parser. * @param string $data The CDATA for the element. * * @return void * * @deprecated 12.1 * @since 11.1 */ protected function _characterData($parser, $data) { // Deprecation warning. JLog::add('JSimpleXML::_characterData() is deprecated.', JLog::WARNING, 'deprecated'); // Get the reference to the current parent object $tag = $this->_getStackLocation(); // Assign data to it eval('$this->' . $tag . '->_data .= $data;'); } } /** * SimpleXML Element * * This object stores all of the direct children of itself in the $children array. * They are also stored by type as arrays. So, if, for example, this tag had 2 * tags as children, there would be a class member called $font created as an array. * $font[0] would be the first font tag, and $font[1] would be the second. * * To loop through all of the direct children of this object, the $children member * should be used. * * To loop through all of the direct children of a specific tag for this object, it * is probably easier to use the arrays of the specific tag names, as explained above. * * @package Joomla.Platform * @subpackage Utilities * @see http://www.php.net/manual/en/class.simplexmlelement.php * @since 11.1 * @deprecated 12.1 Use SimpleXMLElement instead */ class JSimpleXMLElement extends JObject { /** * Array with the attributes of this XML element * * @var array * @since 11.1 */ public $_attributes = array(); /** * The name of the element * * @var string * @since 11.1 */ public $_name = ''; /** * The data the element contains * * @var string * @since 11.1 */ public $_data = ''; /** * Array of references to the objects of all direct children of this XML object * * @var array * @since 11.1 */ public $_children = array(); /** * The level of this XML element * * @var int * @since 11.1 */ public $_level = 0; /** * Constructor, sets up all the default values * * @param string $name The name of the element. * @param array $attrs A key-value array (optional) of the attributes for the element. * @param integer $level The level (optional) of the element. * * @deprecated 12.1 Use SimpleXMLElement * @since 11.1 */ public function __construct($name, $attrs = array(), $level = 0) { // Deprecation warning. JLog::add('JSimpleXMLElement::__construct() is deprecated.', JLog::WARNING, 'deprecated'); //Make the keys of the attr array lower case, and store the value $this->_attributes = array_change_key_case($attrs, CASE_LOWER); //Make the name lower case and store the value $this->_name = strtolower($name); //Set the level $this->_level = $level; } /** * Get the name of the element * * @return string * * @deprecated 12.1 * @since 11.1 */ public function name() { // Deprecation warning. JLog::add('JSimpleXMLElement::name() is deprecated.', JLog::WARNING, 'deprecated'); return $this->_name; } /** * Get the an attribute of the element * * @param string $attribute The name of the attribute * * @return mixed If an attribute is given will return the attribute if it exist. * If no attribute is given will return the complete attributes array * * @deprecated 12.1 * @since 11.1 */ public function attributes($attribute = null) { // Deprecation warning. JLog::add('JSimpleXMLElement::attributes() is deprecated.', JLog::WARNING, 'deprecated'); if (!isset($attribute)) { return $this->_attributes; } return isset($this->_attributes[$attribute]) ? $this->_attributes[$attribute] : null; } /** * Get the data of the element * * @return string * * @deprecated 12.1 Use SimpleXMLElement * @since 11.1 */ public function data() { // Deprecation warning. JLog::add('JSimpleXMLElement::data() is deprecated.', JLog::WARNING, 'deprecated'); return $this->_data; } /** * Set the data of the element * * @param string $data The CDATA for the element. * * @return string * * @deprecated 12.1 Use SimpleXMLElement * @since 11.1 */ public function setData($data) { // Deprecation warning. JLog::add('JSimpleXMLElement::data() is deprecated.', JLog::WARNING, 'deprecated'); $this->_data = $data; } /** * Get the children of the element * * @return array * * @deprecated 12.1 * @since 11.1 */ public function children() { // Deprecation warning. JLog::add('JSimpleXMLElement::children() is deprecated.', JLog::WARNING, 'deprecated'); return $this->_children; } /** * Get the level of the element * * @return integer * * @since 11.1 * @deprecated 12.1 */ public function level() { // Deprecation warning. JLog::add('JSimpleXMLElement::level() is deprecated.', JLog::WARNING, 'deprecated'); return $this->_level; } /** * Adds an attribute to the element * * @param string $name The key * @param array $value The value for the key * * @return void * * @deprecated 12.1 * @since 11.1 */ public function addAttribute($name, $value) { // Deprecation warning. JLog::add('JSimpleXMLElement::addAttribute() is deprecated.', JLog::WARNING, 'deprecated'); // Add the attribute to the element, override if it already exists $this->_attributes[$name] = $value; } /** * Removes an attribute from the element * * @param string $name The name of the attribute. * * @return void * * @deprecated 12.1 * @since 11.1 */ public function removeAttribute($name) { // Deprecation warning. JLog::add('JSimpleXMLElement::removeAttribute() is deprecated.', JLog::WARNING, 'deprecated'); unset($this->_attributes[$name]); } /** * Adds a direct child to the element * * @param string $name The name of the element. * @param array $attrs An key-value array of the element attributes. * @param integer $level The level of the element (optional). * * @return JSimpleXMLElement The added child object * * @deprecated 12.1 * @since 11.1 */ public function addChild($name, $attrs = array(), $level = null) { // Deprecation warning. JLog::add('JSimpleXMLElement::addChild() is deprecated.', JLog::WARNING, 'deprecated'); //If there is no array already set for the tag name being added, //create an empty array for it if (!isset($this->$name)) { $this->$name = array(); } // set the level if not already specified if ($level == null) { $level = ($this->_level + 1); } //Create the child object itself $classname = get_class($this); $child = new $classname($name, $attrs, $level); //Add the reference of it to the end of an array member named for the elements name $this->{$name}[] = &$child; //Add the reference to the children array member $this->_children[] = &$child; //return the new child return $child; } /** * Remove the child node. * * @param JSimpleXmlElement &$child The child element to remove. * * @return void * * @since 11.1 * @deprecated 12.1 */ public function removeChild(&$child) { // Deprecation warning. JLog::add('JSimpleXMLElement::removeChild() is deprecated.', JLog::WARNING, 'deprecated'); $name = $child->name(); for ($i = 0, $n = count($this->_children); $i < $n; $i++) { if ($this->_children[$i] == $child) { unset($this->_children[$i]); } } for ($i = 0, $n = count($this->{$name}); $i < $n; $i++) { if ($this->{$name}[$i] == $child) { unset($this->{$name}[$i]); } } $this->_children = array_values($this->_children); $this->{$name} = array_values($this->{$name}); unset($child); } /** * Get an element in the document by / separated path * * @param string $path The / separated path to the element * * @return object JSimpleXMLElement * * @deprecated 12.1 * @since 11.1 */ public function getElementByPath($path) { // Deprecation warning. JLog::add('JSimpleXMLElement::getElementByPath() is deprecated.', JLog::WARNING, 'deprecated'); $tmp = &$this; $parts = explode('/', trim($path, '/')); foreach ($parts as $node) { $found = false; foreach ($tmp->_children as $child) { if (strtoupper($child->_name) == strtoupper($node)) { $tmp = &$child; $found = true; break; } } if (!$found) { break; } } if ($found) { return $tmp; } return false; } /** * Traverses the tree calling the $callback(JSimpleXMLElement * $this, mixed $args=array()) function with each JSimpleXMLElement. * * @param string $callback Function name * @param array $args The arguments (optional) for the function callback. * * @return void * * @deprecated 12.1 * @since 11.1 */ public function map($callback, $args = array()) { // Deprecation warning. JLog::add('JSimpleXMLElement::map) is deprecated.', JLog::WARNING, 'deprecated'); $callback($this, $args); // Map to all children if ($n = count($this->_children)) { for ($i = 0; $i < $n; $i++) { $this->_children[$i]->map($callback, $args); } } } /** * Return a well-formed XML string based on SimpleXML element * * @param boolean $whitespace True if whitespace should be prepended to the string * * @return string * * @deprecated 12.1 * @since 11.1 */ public function toString($whitespace = true) { // Deprecation warning. JLog::add('JSimpleXMLElement::toString() is deprecated.', JLog::WARNING, 'deprecated'); // Start a new line, indent by the number indicated in $this->level, add a <, and add the name of the tag if ($whitespace) { $out = "\n" . str_repeat("\t", $this->_level) . '<' . $this->_name; } else { $out = '<' . $this->_name; } // For each attribute, add attr="value" foreach ($this->_attributes as $attr => $value) { $out .= ' ' . $attr . '="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '"'; } // If there are no children and it contains no data, end it off with a /> if (empty($this->_children) && empty($this->_data)) { $out .= " />"; } // Otherwise... else { // If there are children if (!empty($this->_children)) { // Close off the start tag $out .= '>'; // For each child, call the asXML function (this will ensure that all children are added recursively) foreach ($this->_children as $child) { $out .= $child->toString($whitespace); } // Add the newline and indentation to go along with the close tag if ($whitespace) { $out .= "\n" . str_repeat("\t", $this->_level); } } // If there is data, close off the start tag and add the data elseif (!empty($this->_data)) $out .= '>' . htmlspecialchars($this->_data, ENT_COMPAT, 'UTF-8'); // Add the end tag $out .= '_name . '>'; } //Return the final output return $out; } } PKX ?\Ú˜ì›ff utility.phpnuW+A„¶sendMail($from, $fromname, $recipient, $subject, $body, $mode, $cc, $bcc, $attachment, $replyto, $replytoname); } /** * Sends mail to administrator for approval of a user submission * * @param string $adminName Name of administrator * @param string $adminEmail Email address of administrator * @param string $email [NOT USED] * @param string $type Type of item to approve * @param string $title Title of item to approve * @param string $author Author of item to approve * @param string $url url * * @return boolean True on success * * @deprecated 12.1 * @see JMail::sendAdminMail() * @since 11.1 */ public static function sendAdminMail($adminName, $adminEmail, $email, $type, $title, $author, $url = null) { // Deprecation warning. JLog::add('JUtility::sendAdminMail() is deprecated.', JLog::WARNING, 'deprecated'); // Get a JMail instance $mail = JFactory::getMailer(); return $mail->sendAdminMail($adminName, $adminEmail, $email, $type, $title, $author, $url); } /** * Provides a secure hash based on a seed * * @param string $seed Seed string. * * @return string * * @deprecated 12.1 Use JApplication::getHash() instead. * @see JApplication::getHash() * @since 11.1 */ public static function getHash($seed) { // Deprecation warning. JLog::add('JUtility::getHash() is deprecated. Use JApplication::getHash() instead.', JLog::WARNING, 'deprecated'); return JApplication::getHash($seed); } /** * Method to determine a hash for anti-spoofing variable names * * @param boolean $forceNew Force creation of a new token. * * @return string Hashed var name * * @deprecated 12.1 Use JSession::getFormToken() instead * @see JSession::getFormToken() * @since 11.1 */ public static function getToken($forceNew = false) { // Deprecation warning. JLog::add('JUtility::getToken() is deprecated. Use JSession::getFormToken() instead.', JLog::WARNING, 'deprecated'); $session = JFactory::getSession(); return $session->getFormToken($forceNew); } /** * Method to extract key/value pairs out of a string with XML style attributes * * @param string $string String containing XML style attributes * * @return array Key/Value pairs for the attributes * * @since 11.1 */ public static function parseAttributes($string) { // Initialise variables. $attr = array(); $retarray = array(); // Let's grab all the key/value pairs using a regular expression preg_match_all('/([\w:-]+)[\s]?=[\s]?"([^"]*)"/i', $string, $attr); if (is_array($attr)) { $numPairs = count($attr[1]); for ($i = 0; $i < $numPairs; $i++) { $retarray[$attr[1][$i]] = $attr[2][$i]; } } return $retarray; } /** * Method to determine if the host OS is Windows. * * @return boolean True if Windows OS. * * @deprecated 12.1 * @see JApplication::isWinOS() * @since 11.1 */ public static function isWinOS() { // Deprecation warning. JLog::add('JUtility::isWinOS() is deprecated.', JLog::WARNING, 'deprecated'); $application = JFactory::getApplication(); return $application->isWinOS(); } /** * Method to dump the structure of a variable for debugging purposes * * @param mixed &$var A variable * @param boolean $htmlSafe True to ensure all characters are htmlsafe * * @return string * * @deprecated 12.1 * @since 11.1 */ public static function dump(&$var, $htmlSafe = true) { // Deprecation warning. JLog::add('JUtility::dump() is deprecated.', JLog::WARNING, 'deprecated'); $result = var_export($var, true); return '
' . ($htmlSafe ? htmlspecialchars($result, ENT_COMPAT, 'UTF-8') : $result) . '
'; } /** * Prepend a reference to an element to the beginning of an array. * Renumbers numeric keys, so $value is always inserted to $array[0] * * @param array &$array Array to be modified * @param mixed &$value Value to add * * @return integer * * @deprecated 12.1 * @see http://www.php.net/manual/en/function.array-unshift.php#40270 * @note PHP no longer supports array_unshift of references. * @since 11.1 */ public function array_unshift_ref(&$array, &$value) { // Deprecation warning. JLog::add('JUtility::array_unshift_ref() is deprecated.', JLog::WARNING, 'deprecated'); $return = array_unshift($array, ''); $array[0] = &$value; return $return; } /** * Return the byte value of a particular string * * @param string $val String optionally with G, M or K suffix * * @return integer Size in bytes * * @deprecated 12.1 * @see JHtmlNumber::bytes * @since 11.1 */ public function return_bytes($val) { // Deprecation warning. JLog::add('JUtility::return_bytes() is deprecated.', JLog::WARNING, 'deprecated'); $val = trim($val); $last = strtolower($val{strlen($val) - 1}); switch ($last) { // The 'G' modifier is available since PHP 5.1.0 case 'g': $val *= 1024; case 'm': $val *= 1024; case 'k': $val *= 1024; } return $val; } } PKX ?\z)cßß buffer.phpnuW+A„¶PKX ?\¾•*ÒÒsimplecrypt.phpnuW+A„¶PKX ?\®)ÕÐ *&.htaccessnuW+A„¶PKX ?\¦V‰ â&index.htmlnuW+A„¶PKX ?\À£ÕþËË ;'string.phpnuW+A„¶PKX ?\h‡ï ï @)xmlelement.phpnuW+A„¶PKX ?\Ä®¬²??m7date.phpnuW+A„¶PKX ?\NÏã/ã/¥varrayhelper.phpnuW+A„¶PKX ?\ïÆvs½U½U Ǧsimplexml.phpnuW+A„¶PKX ?\Ú˜ì›ff Áüutility.phpnuW+A„¶PK ób