Azeri
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
vhosts
/
chipionatv.com
/
httpdocs
/
libraries
/
joomla
/
utilities
/
Filename :
utility.php
back
Copy
<?php /** * @package Joomla.Platform * @subpackage Utilities * * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; /** * JUtility is a utility functions class * * @since 11.1 */ class JUtility { /** * 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) { $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; } }