Index: branches/5.3.x/core/install/install_toolkit.php =================================================================== --- branches/5.3.x/core/install/install_toolkit.php +++ branches/5.3.x/core/install/install_toolkit.php @@ -74,7 +74,10 @@ */ var $_installator = null; - function kInstallToolkit() + /** + * Creates instance of kInstallToolkit class. + */ + public function __construct() { $this->systemConfig = new kSystemConfig(true, false); Index: branches/5.3.x/core/kernel/db/db_connection.php =================================================================== --- branches/5.3.x/core/kernel/db/db_connection.php +++ branches/5.3.x/core/kernel/db/db_connection.php @@ -390,16 +390,7 @@ */ protected function callErrorHandler($sql) { - if (is_array($this->errorHandler)) { - $func = $this->errorHandler[1]; - $ret = $this->errorHandler[0]->$func($this->errorCode, $this->errorMessage, $sql); - } - else { - $func = $this->errorHandler; - $ret = $func($this->errorCode, $this->errorMessage, $sql); - } - - return $ret; + return call_user_func($this->errorHandler, $this->errorCode, $this->errorMessage, $sql); } /** Index: branches/5.3.x/core/kernel/db/dblist.php =================================================================== --- branches/5.3.x/core/kernel/db/dblist.php +++ branches/5.3.x/core/kernel/db/dblist.php @@ -261,12 +261,14 @@ parent::__construct(); $this->OrderFields = Array(); - - $filters = $this->getFilterStructure(); - - foreach ($filters as $filter_params) { - $filter =& $this->$filter_params['type']; - $filter[ $filter_params['class'] ] = $this->Application->makeClass('kMultipleFilter', Array ($filter_params['join_using'])); + foreach ( $this->getFilterStructure() as $filter_params ) { + $property_name = $filter_params['type']; + $filter_group =& $this->$property_name; + + $filter_group[$filter_params['class']] = $this->Application->makeClass( + 'kMultipleFilter', + array($filter_params['join_using']) + ); } $this->PerPage = -1; @@ -317,19 +319,7 @@ */ public function addFilter($name, $clause, $filter_type = self::WHERE_FILTER, $filter_scope = self::FLT_SYSTEM) { - $filter_source = Array ( - self::WHERE_FILTER => 'WhereFilter', - self::HAVING_FILTER => 'HavingFilter', - self::AGGREGATE_FILTER => 'AggregateFilter' - ); - - $filter_name = $filter_source[$filter_type]; - - $filter =& $this->$filter_name; - $filter =& $filter[$filter_scope]; - /* @var $filter kMultipleFilter */ - - $filter->addFilter($name, $clause); + $this->getFilterCollection($filter_type, $filter_scope)->addFilter($name, $clause); } /** @@ -343,19 +333,7 @@ */ public function getFilter($name, $filter_type = self::WHERE_FILTER, $filter_scope = self::FLT_SYSTEM) { - $filter_source = Array ( - self::WHERE_FILTER => 'WhereFilter', - self::HAVING_FILTER => 'HavingFilter', - self::AGGREGATE_FILTER => 'AggregateFilter' - ); - - $filter_name = $filter_source[$filter_type]; - - $filter =& $this->$filter_name; - $filter =& $filter[$filter_scope]; - /* @var $filter kMultipleFilter */ - - return $filter->getFilter($name); + return $this->getFilterCollection($filter_type, $filter_scope)->getFilter($name); } /** @@ -368,19 +346,30 @@ */ public function removeFilter($name, $filter_type = self::WHERE_FILTER, $filter_scope = self::FLT_SYSTEM) { - $filter_source = Array ( + $this->getFilterCollection($filter_type, $filter_scope)->removeFilter($name); + } + + /** + * Returns filter collection. + * + * @param integer $filter_type Is filter having filter or where filter. + * @param integer $filter_scope Filter subtype: FLT_NORMAL,FLT_SYSTEM,FLT_SEARCH,FLT_VIEW,FLT_CUSTOM. + * + * @return kMultipleFilter + */ + protected function getFilterCollection($filter_type = self::WHERE_FILTER, $filter_scope = self::FLT_SYSTEM) + { + $filter_source = array( self::WHERE_FILTER => 'WhereFilter', self::HAVING_FILTER => 'HavingFilter', self::AGGREGATE_FILTER => 'AggregateFilter' ); - $filter_name = $filter_source[$filter_type]; - - $filter =& $this->$filter_name; - $filter =& $filter[$filter_scope]; - /* @var $filter kMultipleFilter */ + /** @var kMultipleFilter[] $filters */ + $property_name = $filter_source[$filter_type]; + $filters =& $this->$property_name; - $filter->removeFilter($name); + return $filters[$filter_scope]; } /** @@ -390,11 +379,11 @@ */ public function clearFilters() { - $filters = $this->getFilterStructure(); + foreach ( $this->getFilterStructure() as $filter_params ) { + $property_name = $filter_params['type']; + $filter_group =& $this->$property_name; - foreach ($filters as $filter_params) { - $filter =& $this->$filter_params['type']; - $filter[ $filter_params['class'] ]->clearFilters(); + $filter_group[$filter_params['class']]->clearFilters(); } } Index: branches/5.3.x/core/units/categories/cache_updater.php =================================================================== --- branches/5.3.x/core/units/categories/cache_updater.php +++ branches/5.3.x/core/units/categories/cache_updater.php @@ -18,7 +18,10 @@ var $Stack; - function clsRecursionStack() + /** + * Creates instance of clsRecursionStack class. + */ + public function __construct() { $this->Stack = Array(); } @@ -73,9 +76,15 @@ */ var $table = ''; - function clsCachedPermissions($CatId, $table_name) + /** + * Creates class instance. + * + * @param integer $cat_id Category ID. + * @param string $table_name Table name. + */ + public function __construct($cat_id, $table_name) { - $this->CatId = $CatId; + $this->CatId = $cat_id; $this->table = $table_name; } @@ -541,4 +550,4 @@ $this->SaveData(); } - } \ No newline at end of file + } Index: branches/5.3.x/core/units/helpers/json_helper.php =================================================================== --- branches/5.3.x/core/units/helpers/json_helper.php +++ branches/5.3.x/core/units/helpers/json_helper.php @@ -25,10 +25,9 @@ /** * Object constructor - * - * @return JSONHelper */ - function JSONHelper() { + public function __construct() + { } @@ -75,7 +74,7 @@ $data = 'null'; } } - + return $data; } @@ -170,4 +169,4 @@ // 0x0c => \f // return str_replace(array(chr(0x08), chr(0x0C)), array('\b', '\f'), $string); } - } \ No newline at end of file + } Index: branches/5.3.x/core/units/helpers/mailbox_helper.php =================================================================== --- branches/5.3.x/core/units/helpers/mailbox_helper.php +++ branches/5.3.x/core/units/helpers/mailbox_helper.php @@ -261,9 +261,9 @@ $good['fromemail'] = $esender->ExtractRecipientEmail($this->headers['from']); $good['fromname'] = $esender->ExtractRecipientName($this->headers['from'], $good['fromemail']); - // Get the list of recipients - if (!$verify_callback[0]->$verify_callback[1]($callback_params)) { - // error: mail is propably spam + // Get the list of recipients. + if ( !call_user_func($verify_callback, $callback_params) ) { + // Error: mail is probably spam. return false; } @@ -356,7 +356,7 @@ 'Size' => strlen($message), ); - return $process_callback[0]->$process_callback[1]($callback_params, $fields_hash); + return call_user_func($process_callback, $callback_params, $fields_hash); } /** @@ -492,4 +492,4 @@ $parts['headers'] = $decoded->headers; // headers of next parts overwrite previous part headers } - } \ No newline at end of file + } Index: branches/5.3.x/core/units/images/image_tag_processor.php =================================================================== --- branches/5.3.x/core/units/images/image_tag_processor.php +++ branches/5.3.x/core/units/images/image_tag_processor.php @@ -70,7 +70,9 @@ function ItemImageTag($params) { $this->LoadItemImage($params); - return $this->$params['original_tag']($params); + $tag_name = $params['original_tag']; + + return $this->$tag_name($params); } function LargeImageExists($params)