Index: branches/5.2.x/core/units/categories/categories_tag_processor.php
===================================================================
diff -u -N -r14585 -r14628
--- branches/5.2.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 14585)
+++ branches/5.2.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 14628)
@@ -1,6 +1,6 @@
Application->recallObject($this->getPrefixSpecial(), $this->Prefix.'_List');
+ /* @var $cat_object kDBList */
+
$sql = 'SELECT '.$this->getTitleField().'
FROM '.$cat_object->TableName.'
WHERE CategoryId = '.(int)$this->Application->GetVar('m_cat_id');
@@ -213,13 +215,16 @@
function getTitleField()
{
$ml_formatter =& $this->Application->recallObject('kMultiLanguage');
+ /* @var $ml_formatter kMultiLanguage */
+
return $ml_formatter->LangFieldName('Name');
}
/**
* Returns symlinked category for given category
*
- * @param $category_id
+ * @param int $category_id
+ * @return int
*/
function getCategorySymLink($category_id)
{
@@ -536,42 +541,41 @@
*
* @param Array $params
* @return string
+ * @access protected
*/
- function SaveWarning($params)
+ protected function SaveWarning($params)
{
- if ($this->Prefix == 'st') {
+ if ( $this->Prefix == 'st' ) {
// don't use this method for other prefixes then Category, that use this tag processor
return parent::SaveWarning($params);
}
$main_prefix = getArrayValue($params, 'main_prefix');
- if ($main_prefix && $main_prefix != '$main_prefix') {
+ if ( $main_prefix && $main_prefix != '$main_prefix' ) {
$top_prefix = $main_prefix;
}
else {
$top_prefix = $this->Application->GetTopmostPrefix($this->Prefix);
}
- $temp_tables = substr($this->Application->GetVar($top_prefix.'_mode'), 0, 1) == 't';
- $modified = $this->Application->RecallVar($top_prefix.'_modified');
+ $temp_tables = substr($this->Application->GetVar($top_prefix . '_mode'), 0, 1) == 't';
+ $modified = $this->Application->RecallVar($top_prefix . '_modified');
- if (!$temp_tables) {
- $this->Application->RemoveVar($top_prefix.'_modified');
+ if ( !$temp_tables ) {
+ $this->Application->RemoveVar($top_prefix . '_modified');
return '';
}
$block_name = $this->SelectParam($params, 'render_as,name');
- if ($block_name) {
+ if ( $block_name ) {
$block_params = $this->prepareTagParams($params);
$block_params['name'] = $block_name;
$block_params['edit_mode'] = $temp_tables ? 1 : 0;
$block_params['display'] = $temp_tables && $modified ? 1 : 0;
return $this->Application->ParseBlock($block_params);
}
- else {
- return $temp_tables && $modified ? 1 : 0;
- }
- return ;
+
+ return $temp_tables && $modified ? 1 : 0;
}
/**
@@ -602,6 +606,8 @@
function IsRootCategory($params)
{
$object =& $this->getObject($params);
+ /* @var $object CategoriesItem */
+
return $object->IsRoot();
}
@@ -681,19 +687,19 @@
{
static $current_path = null;
- if (!isset($current_path)) {
+ if ( !isset($current_path) ) {
$sql = 'SELECT ParentPath
FROM ' . TABLE_PREFIX . 'Category
WHERE CategoryId = ' . (int)$this->Application->GetVar('m_cat_id');
$current_path = $this->Conn->GetOne($sql);
}
- if (array_key_exists('parent_path', $params)) {
+ if ( array_key_exists('parent_path', $params) ) {
$test_path = $params['parent_path'];
}
else {
$template = $params['template'];
- if ($template) {
+ if ( $template ) {
// when using from "c:CachedMenu" tag
$sql = 'SELECT ParentPath
FROM ' . TABLE_PREFIX . 'Category
@@ -703,16 +709,18 @@
else {
// when using from "c:PrintList" tag
$cat_id = array_key_exists('cat_id', $params) && $params['cat_id'] ? $params['cat_id'] : false;
- if ($cat_id === false) {
+ if ( $cat_id === false ) {
// category not supplied -> get current from PrintList
$category =& $this->getObject($params);
}
else {
- if ("$cat_id" == 'Root') {
+ if ( "$cat_id" == 'Root' ) {
$cat_id = $this->Application->findModule('Name', $params['module'], 'RootCat');
}
$category =& $this->Application->recallObject($this->Prefix . '.-c' . $cat_id, $this->Prefix, Array ('skip_autoload' => true));
+ /* @var $category CategoriesItem */
+
$category->Load($cat_id);
}
@@ -769,8 +777,8 @@
$row_data = $this->Application->getCache($cache_key);
- if ($row_data === false) {
- if ($local && ($category_id > 0)) {
+ if ( $row_data === false ) {
+ if ( $local && ($category_id > 0) ) {
// scan only current category & it's children
list ($tree_left, $tree_right) = $this->Application->getTreeIndex($category_id);
@@ -789,17 +797,20 @@
$this->Application->setCache($cache_key, $row_data);
}
- if (!$row_data) {
+ if ( !$row_data ) {
return '';
}
- $date = $row_data[ $row_data['NewDate'] > $row_data['ModDate'] ? 'NewDate' : 'ModDate' ];
+ $date = $row_data[$row_data['NewDate'] > $row_data['ModDate'] ? 'NewDate' : 'ModDate'];
// format date
$format = isset($params['format']) ? $params['format'] : '_regional_DateTimeFormat';
- if (preg_match("/_regional_(.*)/", $format, $regs)) {
+
+ if ( preg_match("/_regional_(.*)/", $format, $regs) ) {
$lang =& $this->Application->recallObject('lang.current');
- if ($regs[1] == 'DateTimeFormat') {
+ /* @var $lang LanguagesItem */
+
+ if ( $regs[1] == 'DateTimeFormat' ) {
// combined format
$format = $lang->GetDBField('DateFormat') . ' ' . $lang->GetDBField('TimeFormat');
}
@@ -902,19 +913,20 @@
*
* @param Array $params
* @return string
+ * @access protected
*/
- function SpellingSuggestions($params)
+ protected function SpellingSuggestions($params)
{
$keywords = kUtil::unhtmlentities( trim($this->Application->GetVar('keywords')) );
- if (!$keywords) {
- return ;
+ if ( !$keywords ) {
+ return '';
}
// 1. try to get already cached suggestion
$cache_key = 'search.suggestion[%SpellingDictionary%]:' . $keywords;
$suggestion = $this->Application->getCache($cache_key);
- if ($suggestion !== false) {
+ if ( $suggestion !== false ) {
return $suggestion;
}
@@ -927,8 +939,9 @@
WHERE MisspelledWord = ' . $this->Conn->qstr($keywords);
$suggestion = $this->Conn->GetOne($sql);
- if ($suggestion !== false) {
+ if ( $suggestion !== false ) {
$this->Application->setCache($cache_key, $suggestion);
+
return $suggestion;
}
@@ -939,22 +952,20 @@
$curl_helper =& $this->Application->recallObject('CurlHelper');
/* @var $curl_helper kCurlHelper */
- $xml_data = $curl_helper->Send($url . urlencode($keywords));
+ $xml_data = $curl_helper->Send( $url . urlencode($keywords) );
$xml_helper =& $this->Application->recallObject('kXMLHelper');
/* @var $xml_helper kXMLHelper */
$root_node =& $xml_helper->Parse($xml_data);
+ /* @var $root_node kXMLNode */
$result = $root_node->FindChild('RESULT');
/* @var $result kXMLNode */
- if (is_object($result)) {
+ if ( is_object($result) ) {
// webservice responded -> save in local database
- $fields_hash = Array (
- 'MisspelledWord' => $keywords,
- 'SuggestedCorrection' => $result->Data,
- );
+ $fields_hash = Array ('MisspelledWord' => $keywords, 'SuggestedCorrection' => $result->Data);
$this->Conn->doInsert($fields_hash, $table_name);
$this->Application->setCache($cache_key, $result->Data);
@@ -1075,7 +1086,7 @@
* Returns page object based on requested params
*
* @param Array $params
- * @return PagesItem
+ * @return CategoriesItem
*/
function &_getPage($params)
{
@@ -1323,14 +1334,14 @@
/**
* Includes admin css and js, that are required for cms usage on Front-Edn
*
- *
* @param Array $params
* @return string
+ * @access protected
*/
- function EditingScripts($params)
+ protected function EditingScripts($params)
{
- if ($this->Application->GetVar('admin_scripts_included') || !EDITING_MODE) {
- return ;
+ if ( $this->Application->GetVar('admin_scripts_included') || !EDITING_MODE ) {
+ return '';
}
$this->Application->SetVar('admin_scripts_included', 1);
@@ -1344,17 +1355,16 @@
$js_url . '/../incs/cms.css',
);
- $css_compressed = $minify_helper->CompressScriptTag( Array ('files' => implode('|', $to_compress)) );
+ $css_compressed = $minify_helper->CompressScriptTag(Array ('files' => implode('|', $to_compress)));
$ret = '' . "\n";
- if (EDITING_MODE == EDITING_MODE_DESIGN) {
+ if ( EDITING_MODE == EDITING_MODE_DESIGN ) {
$ret .= ' ';
}
-
$ret .= '' . "\n";
$ret .= '' . "\n";
@@ -1389,19 +1399,19 @@
$ret .= "var \$use_popups = " . ($use_popups > 0 ? 'true' : 'false') . ";\n";
$ret .= "var \$modal_windows = " . ($use_popups == 2 ? 'true' : 'false') . ";\n";
- if (EDITING_MODE != EDITING_MODE_BROWSE) {
+ if ( EDITING_MODE != EDITING_MODE_BROWSE ) {
$ret .= "var base_url = '" . $this->Application->BaseURL() . "';" . "\n";
$ret .= 'TB.closeHtml = \'
\';' . "\n";
- $url_params = Array('m_theme' => '', 'pass' => 'm', 'm_opener' => 'r', '__NO_REWRITE__' => 1, 'no_amp' => 1);
+ $url_params = Array ('m_theme' => '', 'pass' => 'm', 'm_opener' => 'r', '__NO_REWRITE__' => 1, 'no_amp' => 1);
$browse_url = $this->Application->HREF('catalog/catalog', ADMIN_DIRECTORY, $url_params, 'index.php');
$browse_url = preg_replace('/&(admin|editing_mode)=[\d]/', '', $browse_url);
$ret .= '
var topmost = window.top;
topmost.document.title = document.title + \' - ' . addslashes($this->Application->Phrase('la_AdministrativeConsole', false)) . '\';
- t = \''.$this->Application->GetVar('t').'\';
+ t = \'' . $this->Application->GetVar('t') . '\';
if (window.parent.frames["menu"] != undefined) {
if ( $.isFunction(window.parent.frames["menu"].SyncActive) ) {
@@ -1413,7 +1423,7 @@
$ret .= '' . "\n";
- if (EDITING_MODE != EDITING_MODE_BROWSE) {
+ if ( EDITING_MODE != EDITING_MODE_BROWSE ) {
// add form, so admin scripts could work
$ret .= '