nooku is a Public Portfolio from Assembla

Assembla offers free public and private SVN/Git repositories and project hosting with bug/issue tracking and collaboration tools.

Create your own Portfolio or check out other free and subscription products from Assembla that will help accelerate your development projects.

nooku-framework

Commit 4460

User picture
  • Author: johanjanssens
  • 2012-02-02 21:54 (about 2 years ago)

re #207 : Added ModDefaultHtml::_parseParams() function. Params are parsed either from json or ini format (dependant on the Joomla version) to a KConfig object. JParameter is no longer used.

Files Affected

 
44594460
89
        if($property == 'module') 
89
        if($property == 'module') 
90
        {
90
        {
91
            if(is_string($value->params)) {
91
            if(is_string($value->params)) {
92
                $value->params = new JParameter($value->params);
92
                $value->params = $this->_parseParams($value->params);
93
            }
93
            }
94
        }
94
        }
95
 
95
 
96
        parent::__set($property, $value);
96
        parent::__set($property, $value);
97
    }
97
    }
 
 
98
 
 
 
99
    /**
 
 
100
     * Method to extract key/value pairs out of a string
 
 
101
     *
 
 
102
     * @param   string  String containing the parameters
 
 
103
     * @return  array   Key/Value pairs for the attributes
 
 
104
     */
 
 
105
    protected function _parseParams( $string )
 
 
106
    {
 
 
107
        $params = array();
 
 
108
 
 
 
109
        if(!version_compare(JVERSION,'1.6.0','ge')) 
 
 
110
        {
 
 
111
            $string = trim($string);
 
 
112
 
 
 
113
            if(!empty($string))
 
 
114
            {
 
 
115
                foreach(explode("\n", $string) as $line) 
 
 
116
                {
 
 
117
                    $param = explode("=", $line, 2);
 
 
118
                    $params[$param[0]] = $param[1];
 
 
119
                }
 
 
120
            }
 
 
121
        } 
 
 
122
        else $params = json_decode($value->params);
 
 
123
 
 
 
124
        $params = new KConfig($params);     
 
 
125
        return $params;
 
 
126
    }
98
}
127
}