@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | if(!function_exists('removeLastPath')) { |
| 746 | 746 | /** |
| 747 | 747 | * @param string $string |
| 748 | - * @return bool|string |
|
| 748 | + * @return string|false |
|
| 749 | 749 | */ |
| 750 | 750 | function removeLastPath($string) |
| 751 | 751 | { |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | if(!function_exists('getExtension')) { |
| 764 | 764 | /** |
| 765 | 765 | * @param string $string |
| 766 | - * @return bool|string |
|
| 766 | + * @return string|false |
|
| 767 | 767 | */ |
| 768 | 768 | function getExtension($string) |
| 769 | 769 | { |
@@ -357,7 +357,7 @@ |
||
| 357 | 357 | if(!function_exists('getFileContent')) { |
| 358 | 358 | /** |
| 359 | 359 | * @param string $filepath |
| 360 | - * @return bool|string |
|
| 360 | + * @return null|string |
|
| 361 | 361 | */ |
| 362 | 362 | function getFileContent($filepath) |
| 363 | 363 | { |
@@ -268,6 +268,7 @@ discard block |
||
| 268 | 268 | /** |
| 269 | 269 | * @name: delete |
| 270 | 270 | * |
| 271 | + * @param string $from |
|
| 271 | 272 | */ |
| 272 | 273 | public function delete($from, $where = '', $orderby = '', $limit = '') |
| 273 | 274 | { |
@@ -414,6 +415,9 @@ discard block |
||
| 414 | 415 | } |
| 415 | 416 | } |
| 416 | 417 | |
| 418 | + /** |
|
| 419 | + * @param string $table |
|
| 420 | + */ |
|
| 417 | 421 | public function save($fields, $table, $where = '') |
| 418 | 422 | { |
| 419 | 423 | |
@@ -444,6 +448,7 @@ discard block |
||
| 444 | 448 | /** |
| 445 | 449 | * @name: freeResult |
| 446 | 450 | * |
| 451 | + * @param mysqli_result $rs |
|
| 447 | 452 | */ |
| 448 | 453 | public function freeResult($rs) |
| 449 | 454 | { |
@@ -554,6 +559,7 @@ discard block |
||
| 554 | 559 | * @name: getColumn |
| 555 | 560 | * @desc: returns an array of the values found on colun $name |
| 556 | 561 | * @param: $dsq - dataset or query string |
| 562 | + * @param string $name |
|
| 557 | 563 | */ |
| 558 | 564 | public function getColumn($name, $dsq) |
| 559 | 565 | { |
@@ -720,6 +726,9 @@ discard block |
||
| 720 | 726 | return $result; |
| 721 | 727 | } |
| 722 | 728 | |
| 729 | + /** |
|
| 730 | + * @param string $table_name |
|
| 731 | + */ |
|
| 723 | 732 | public function optimize($table_name) |
| 724 | 733 | { |
| 725 | 734 | $rs = $this->query("OPTIMIZE TABLE {$table_name}"); |
@@ -730,6 +739,9 @@ discard block |
||
| 730 | 739 | return $rs; |
| 731 | 740 | } |
| 732 | 741 | |
| 742 | + /** |
|
| 743 | + * @param string $table_name |
|
| 744 | + */ |
|
| 733 | 745 | public function truncate($table_name) |
| 734 | 746 | { |
| 735 | 747 | $rs = $this->query("TRUNCATE {$table_name}"); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * |
| 173 | 173 | * @param string $param |
| 174 | 174 | * @param array $tvsArray |
| 175 | - * @return mixed |
|
| 175 | + * @return string |
|
| 176 | 176 | */ |
| 177 | 177 | function parseTvValues($param, $tvsArray) |
| 178 | 178 | { |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | /** |
| 567 | 567 | * returns an array if a delimiter is present. returns array is a recordset is present |
| 568 | 568 | * |
| 569 | - * @param $src |
|
| 569 | + * @param string $src |
|
| 570 | 570 | * @param string $delim |
| 571 | 571 | * @param string $type |
| 572 | 572 | * @param bool $columns |
@@ -1022,7 +1022,7 @@ discard block |
||
| 1022 | 1022 | |
| 1023 | 1023 | if (! function_exists('ParseIntputOptions')) { |
| 1024 | 1024 | /** |
| 1025 | - * @param string|array|mysqli_result $v |
|
| 1025 | + * @param string $v |
|
| 1026 | 1026 | * @return array |
| 1027 | 1027 | */ |
| 1028 | 1028 | function ParseIntputOptions($v) |
@@ -573,7 +573,8 @@ |
||
| 573 | 573 | * @return array|string |
| 574 | 574 | */ |
| 575 | 575 | function parseInput($src, $delim = "||", $type = "string", $columns = true) |
| 576 | - { // type can be: string, array |
|
| 576 | + { |
|
| 577 | +// type can be: string, array |
|
| 577 | 578 | $modx = evolutionCMS(); |
| 578 | 579 | if ($modx->db->isResult($src)) { |
| 579 | 580 | // must be a recordset |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | * MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php" |
| 267 | 267 | * $extname - extension name in lowercase |
| 268 | 268 | * |
| 269 | - * @param $extname |
|
| 269 | + * @param string $extname |
|
| 270 | 270 | * @param bool $reload |
| 271 | 271 | * @return bool |
| 272 | 272 | */ |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | * @param int $count_attempts |
| 310 | 310 | * @param string $type $type |
| 311 | 311 | * @param string $responseCode |
| 312 | - * @return bool|null |
|
| 312 | + * @return false|null |
|
| 313 | 313 | * @global string $base_url |
| 314 | 314 | * @global string $site_url |
| 315 | 315 | */ |
@@ -1010,7 +1010,7 @@ discard block |
||
| 1010 | 1010 | } |
| 1011 | 1011 | |
| 1012 | 1012 | /** |
| 1013 | - * @param $contents |
|
| 1013 | + * @param string $contents |
|
| 1014 | 1014 | * @return mixed |
| 1015 | 1015 | */ |
| 1016 | 1016 | public function RecoveryEscapedTags($contents) |
@@ -1034,7 +1034,7 @@ discard block |
||
| 1034 | 1034 | } |
| 1035 | 1035 | |
| 1036 | 1036 | /** |
| 1037 | - * @param $tstart |
|
| 1037 | + * @param double $tstart |
|
| 1038 | 1038 | * @return array |
| 1039 | 1039 | */ |
| 1040 | 1040 | public function getTimerStats($tstart) |
@@ -1800,7 +1800,7 @@ discard block |
||
| 1800 | 1800 | |
| 1801 | 1801 | /** |
| 1802 | 1802 | * Remove Comment-Tags from output like <!--@- Comment -@--> |
| 1803 | - * @param $content |
|
| 1803 | + * @param string $content |
|
| 1804 | 1804 | * @param string $left |
| 1805 | 1805 | * @param string $right |
| 1806 | 1806 | * @return mixed |
@@ -1973,7 +1973,7 @@ discard block |
||
| 1973 | 1973 | /** |
| 1974 | 1974 | * Run snippets as per the tags in $documentSource and replace the tags with the returned values. |
| 1975 | 1975 | * |
| 1976 | - * @param $content |
|
| 1976 | + * @param string $content |
|
| 1977 | 1977 | * @return string |
| 1978 | 1978 | * @internal param string $documentSource |
| 1979 | 1979 | */ |
@@ -3008,7 +3008,7 @@ discard block |
||
| 3008 | 3008 | |
| 3009 | 3009 | /** |
| 3010 | 3010 | * @param $templateID |
| 3011 | - * @return mixed |
|
| 3011 | + * @return string |
|
| 3012 | 3012 | */ |
| 3013 | 3013 | public function _getTemplateCodeFromDB($templateID) |
| 3014 | 3014 | { |
@@ -3051,7 +3051,7 @@ discard block |
||
| 3051 | 3051 | /** |
| 3052 | 3052 | * @param $id |
| 3053 | 3053 | * @param int $top |
| 3054 | - * @return mixed |
|
| 3054 | + * @return string |
|
| 3055 | 3055 | */ |
| 3056 | 3056 | public function getUltimateParentId($id, $top = 0) |
| 3057 | 3057 | { |
@@ -3391,7 +3391,7 @@ discard block |
||
| 3391 | 3391 | * |
| 3392 | 3392 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
| 3393 | 3393 | * @param int $id Element- / Resource-id |
| 3394 | - * @return bool |
|
| 3394 | + * @return false|null |
|
| 3395 | 3395 | */ |
| 3396 | 3396 | public function lockElement($type, $id) |
| 3397 | 3397 | { |
@@ -3413,7 +3413,7 @@ discard block |
||
| 3413 | 3413 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
| 3414 | 3414 | * @param int $id Element- / Resource-id |
| 3415 | 3415 | * @param bool $includeAllUsers true = Deletes not only own user-locks |
| 3416 | - * @return bool |
|
| 3416 | + * @return false|null |
|
| 3417 | 3417 | */ |
| 3418 | 3418 | public function unlockElement($type, $id, $includeAllUsers = false) |
| 3419 | 3419 | { |
@@ -3927,7 +3927,7 @@ discard block |
||
| 3927 | 3927 | * Default: 1 |
| 3928 | 3928 | * @param string $fields List of fields |
| 3929 | 3929 | * Default: id, pagetitle, description, alias |
| 3930 | - * @return boolean|array |
|
| 3930 | + * @return string |
|
| 3931 | 3931 | */ |
| 3932 | 3932 | public function getPageInfo($pageid = -1, $active = 1, $fields = 'id, pagetitle, description, alias') |
| 3933 | 3933 | { |
@@ -4019,7 +4019,7 @@ discard block |
||
| 4019 | 4019 | * |
| 4020 | 4020 | * @param string $type |
| 4021 | 4021 | * @param bool $report |
| 4022 | - * @return bool |
|
| 4022 | + * @return boolean|null |
|
| 4023 | 4023 | */ |
| 4024 | 4024 | public function clearCache($type = '', $report = false) |
| 4025 | 4025 | { |
@@ -4385,7 +4385,7 @@ discard block |
||
| 4385 | 4385 | * - Placeholders prefix. Default: '{'. |
| 4386 | 4386 | * @param string $suffix {string} |
| 4387 | 4387 | * - Placeholders suffix. Default: '}'. |
| 4388 | - * @return bool|mixed|string {string; false} - Parsed chunk or false if $chunkArr is not array. |
|
| 4388 | + * @return false|string {string; false} - Parsed chunk or false if $chunkArr is not array. |
|
| 4389 | 4389 | * - Parsed chunk or false if $chunkArr is not array. |
| 4390 | 4390 | */ |
| 4391 | 4391 | public function parseChunk($chunkName, $chunkArr, $prefix = '{', $suffix = '}') |
@@ -5357,7 +5357,7 @@ discard block |
||
| 5357 | 5357 | * Remove event listener - only for use within the current execution cycle |
| 5358 | 5358 | * |
| 5359 | 5359 | * @param string $evtName |
| 5360 | - * @return boolean |
|
| 5360 | + * @return false|null |
|
| 5361 | 5361 | */ |
| 5362 | 5362 | public function removeEventListener($evtName) |
| 5363 | 5363 | { |
@@ -5381,7 +5381,7 @@ discard block |
||
| 5381 | 5381 | * |
| 5382 | 5382 | * @param string $evtName |
| 5383 | 5383 | * @param array $extParams Parameters available to plugins. Each array key will be the PHP variable name, and the array value will be the variable value. |
| 5384 | - * @return boolean|array |
|
| 5384 | + * @return false|null |
|
| 5385 | 5385 | */ |
| 5386 | 5386 | public function invokeEvent($evtName, $extParams = array()) |
| 5387 | 5387 | { |
@@ -5976,7 +5976,7 @@ discard block |
||
| 5976 | 5976 | |
| 5977 | 5977 | /** |
| 5978 | 5978 | * @param string $str |
| 5979 | - * @return bool|mixed|string |
|
| 5979 | + * @return string |
|
| 5980 | 5980 | */ |
| 5981 | 5981 | public function atBindFileContent($str = '') |
| 5982 | 5982 | { |
@@ -6027,8 +6027,8 @@ discard block |
||
| 6027 | 6027 | } |
| 6028 | 6028 | |
| 6029 | 6029 | /** |
| 6030 | - * @param $str |
|
| 6031 | - * @return bool|string |
|
| 6030 | + * @param string $str |
|
| 6031 | + * @return false|string |
|
| 6032 | 6032 | */ |
| 6033 | 6033 | public function getExtFromFilename($str) |
| 6034 | 6034 | { |
@@ -6056,7 +6056,7 @@ discard block |
||
| 6056 | 6056 | * @param string $text Error message |
| 6057 | 6057 | * @param string $file File where the error was detected |
| 6058 | 6058 | * @param string $line Line number within $file |
| 6059 | - * @return boolean |
|
| 6059 | + * @return boolean|null |
|
| 6060 | 6060 | */ |
| 6061 | 6061 | public function phpError($nr, $text, $file, $line) |
| 6062 | 6062 | { |
@@ -6108,7 +6108,7 @@ discard block |
||
| 6108 | 6108 | * @param string $text |
| 6109 | 6109 | * @param string $line |
| 6110 | 6110 | * @param string $output |
| 6111 | - * @return bool |
|
| 6111 | + * @return null|boolean |
|
| 6112 | 6112 | */ |
| 6113 | 6113 | public function messageQuit($msg = 'unspecified error', $query = '', $is_error = true, $nr = '', $file = '', $source = '', $text = '', $line = '', $output = '') |
| 6114 | 6114 | { |
@@ -6523,7 +6523,7 @@ discard block |
||
| 6523 | 6523 | |
| 6524 | 6524 | /** |
| 6525 | 6525 | * @param string $str |
| 6526 | - * @return bool|mixed|string |
|
| 6526 | + * @return string |
|
| 6527 | 6527 | */ |
| 6528 | 6528 | public function atBindInclude($str = '') |
| 6529 | 6529 | { |
@@ -6574,7 +6574,7 @@ discard block |
||
| 6574 | 6574 | * @param $str |
| 6575 | 6575 | * @param int $flags |
| 6576 | 6576 | * @param string $encode |
| 6577 | - * @return mixed |
|
| 6577 | + * @return string |
|
| 6578 | 6578 | */ |
| 6579 | 6579 | public function htmlspecialchars($str, $flags = ENT_COMPAT, $encode = '') |
| 6580 | 6580 | { |
@@ -6583,7 +6583,7 @@ discard block |
||
| 6583 | 6583 | } |
| 6584 | 6584 | |
| 6585 | 6585 | /** |
| 6586 | - * @param $string |
|
| 6586 | + * @param string $string |
|
| 6587 | 6587 | * @param bool $returnData |
| 6588 | 6588 | * @return bool|mixed |
| 6589 | 6589 | */ |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | - * @return mixed |
|
| 66 | + * @return string |
|
| 67 | 67 | */ |
| 68 | 68 | public function getOutput() |
| 69 | 69 | { |
@@ -5,7 +5,8 @@ |
||
| 5 | 5 | * @deprecated EvolutionCMS\Legacy\ErrorHandler |
| 6 | 6 | * @todo could be unnecessary |
| 7 | 7 | */ |
| 8 | -class errorHandler extends EvolutionCMS\Legacy\ErrorHandler { |
|
| 8 | +class errorHandler extends EvolutionCMS\Legacy\ErrorHandler |
|
| 9 | +{ |
|
| 9 | 10 | public function include_lang($context = 'common') |
| 10 | 11 | { |
| 11 | 12 | parent::includeLang($context); |
@@ -3,4 +3,6 @@ |
||
| 3 | 3 | /** |
| 4 | 4 | * @deprecated use EvolutionCMS\Legacy\LogHandler |
| 5 | 5 | */ |
| 6 | -class logHandler extends EvolutionCMS\Legacy\LogHandler{} |
|
| 6 | +class logHandler extends EvolutionCMS\Legacy\LogHandler |
|
| 7 | +{ |
|
| 8 | +} |
|
@@ -1,6 +1,7 @@ discard block |
||
| 1 | 1 | <?php namespace EvolutionCMS\Legacy; |
| 2 | 2 | |
| 3 | -class mgrResources { |
|
| 3 | +class mgrResources |
|
| 4 | +{ |
|
| 4 | 5 | /** |
| 5 | 6 | * @var array |
| 6 | 7 | */ |
@@ -21,7 +22,8 @@ discard block |
||
| 21 | 22 | /** |
| 22 | 23 | * mgrResources constructor. |
| 23 | 24 | */ |
| 24 | - public function __construct() { |
|
| 25 | + public function __construct() |
|
| 26 | + { |
|
| 25 | 27 | $this->setTypes(); |
| 26 | 28 | $this->queryItemsFromDB(); |
| 27 | 29 | $this->prepareCategoryArrays(); |
@@ -30,7 +32,8 @@ discard block |
||
| 30 | 32 | /** |
| 31 | 33 | * @return void |
| 32 | 34 | */ |
| 33 | - public function setTypes() { |
|
| 35 | + public function setTypes() |
|
| 36 | + { |
|
| 34 | 37 | global $_lang; |
| 35 | 38 | $this->types['site_templates'] = array( |
| 36 | 39 | 'title'=>$_lang["manage_templates"], |
@@ -68,7 +71,8 @@ discard block |
||
| 68 | 71 | /** |
| 69 | 72 | * @return void |
| 70 | 73 | */ |
| 71 | - public function queryItemsFromDB() { |
|
| 74 | + public function queryItemsFromDB() |
|
| 75 | + { |
|
| 72 | 76 | foreach($this->types as $resourceTable=>$type) { |
| 73 | 77 | if($this->hasAnyPermissions($type['permissions'])) { |
| 74 | 78 | $nameField = isset($type['name']) ? $type['name'] : 'name'; |
@@ -81,11 +85,13 @@ discard block |
||
| 81 | 85 | * @param array $permissions |
| 82 | 86 | * @return bool |
| 83 | 87 | */ |
| 84 | - public function hasAnyPermissions($permissions) { |
|
| 88 | + public function hasAnyPermissions($permissions) |
|
| 89 | + { |
|
| 85 | 90 | $modx = evolutionCMS(); |
| 86 | 91 | |
| 87 | - foreach($permissions as $p) |
|
| 88 | - if($modx->hasPermission($p)) return true; |
|
| 92 | + foreach($permissions as $p) { |
|
| 93 | + if($modx->hasPermission($p)) return true; |
|
| 94 | + } |
|
| 89 | 95 | |
| 90 | 96 | return false; |
| 91 | 97 | } |
@@ -95,7 +101,8 @@ discard block |
||
| 95 | 101 | * @param string $nameField |
| 96 | 102 | * @return array|bool |
| 97 | 103 | */ |
| 98 | - public function queryResources($resourceTable, $nameField = 'name') { |
|
| 104 | + public function queryResources($resourceTable, $nameField = 'name') |
|
| 105 | + { |
|
| 99 | 106 | $modx = evolutionCMS(); global $_lang; |
| 100 | 107 | |
| 101 | 108 | $allowed = array( |
@@ -112,8 +119,9 @@ discard block |
||
| 112 | 119 | $tvsql = 'site_tmplvars.caption, '; |
| 113 | 120 | $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
| 114 | 121 | $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
| 122 | + } else { |
|
| 123 | + $sttfield = ''; |
|
| 115 | 124 | } |
| 116 | - else $sttfield = ''; |
|
| 117 | 125 | |
| 118 | 126 | $selectableTemplates = $resourceTable === 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
| 119 | 127 | |
@@ -126,7 +134,9 @@ discard block |
||
| 126 | 134 | ); |
| 127 | 135 | $limit = $modx->db->getRecordCount($rs); |
| 128 | 136 | |
| 129 | - if($limit < 1) return false; |
|
| 137 | + if($limit < 1) { |
|
| 138 | + return false; |
|
| 139 | + } |
|
| 130 | 140 | |
| 131 | 141 | $result = array(); |
| 132 | 142 | while ($row = $modx->db->getRow($rs)) { |
@@ -138,7 +148,8 @@ discard block |
||
| 138 | 148 | /** |
| 139 | 149 | * @return void |
| 140 | 150 | */ |
| 141 | - public function prepareCategoryArrays() { |
|
| 151 | + public function prepareCategoryArrays() |
|
| 152 | + { |
|
| 142 | 153 | foreach($this->items as $type=>$items) { |
| 143 | 154 | foreach((array)$items as $item) { |
| 144 | 155 | $catid = $item['catid'] ? $item['catid'] : 0; |
@@ -154,7 +165,7 @@ discard block |
||
| 154 | 165 | |
| 155 | 166 | // Now sort by name |
| 156 | 167 | foreach($this->itemsPerCategory as $catid=>$items) { |
| 157 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
| 168 | + usort($this->itemsPerCategory[$catid], function ($a, $b){ |
|
| 158 | 169 | return strcasecmp($a['name'], $b['name']); |
| 159 | 170 | }); |
| 160 | 171 | } |