@@ -212,7 +212,6 @@ discard block |
||
212 | 212 | |
213 | 213 | /** |
214 | 214 | * @param array $services |
215 | - * @param array $parameters |
|
216 | 215 | */ |
217 | 216 | public function __construct(array $services = array()) |
218 | 217 | { |
@@ -282,6 +281,9 @@ discard block |
||
282 | 281 | return $service; |
283 | 282 | } |
284 | 283 | |
284 | + /** |
|
285 | + * @param string $name |
|
286 | + */ |
|
285 | 287 | private function checkServiceAlias($name){ |
286 | 288 | foreach ($this->providerAliases as $alias => $interface) { |
287 | 289 | if($name === $interface) { |
@@ -319,7 +321,7 @@ discard block |
||
319 | 321 | * |
320 | 322 | * @param object $service The service. |
321 | 323 | * @param string $name The service name. |
322 | - * @param array $callDefinitions The service calls definition. |
|
324 | + * @param boolean $callDefinitions The service calls definition. |
|
323 | 325 | * |
324 | 326 | * @throws Exceptions\ContainerException On failure. |
325 | 327 | */ |
@@ -561,7 +563,7 @@ discard block |
||
561 | 563 | * @param int $count_attempts |
562 | 564 | * @param string $type $type |
563 | 565 | * @param string $responseCode |
564 | - * @return bool|null |
|
566 | + * @return false|null |
|
565 | 567 | * @global string $base_url |
566 | 568 | * @global string $site_url |
567 | 569 | */ |
@@ -1262,7 +1264,7 @@ discard block |
||
1262 | 1264 | } |
1263 | 1265 | |
1264 | 1266 | /** |
1265 | - * @param $contents |
|
1267 | + * @param string $contents |
|
1266 | 1268 | * @return mixed |
1267 | 1269 | */ |
1268 | 1270 | public function RecoveryEscapedTags($contents) |
@@ -1286,7 +1288,7 @@ discard block |
||
1286 | 1288 | } |
1287 | 1289 | |
1288 | 1290 | /** |
1289 | - * @param $tstart |
|
1291 | + * @param double $tstart |
|
1290 | 1292 | * @return array |
1291 | 1293 | */ |
1292 | 1294 | public function getTimerStats($tstart) |
@@ -2052,7 +2054,7 @@ discard block |
||
2052 | 2054 | |
2053 | 2055 | /** |
2054 | 2056 | * Remove Comment-Tags from output like <!--@- Comment -@--> |
2055 | - * @param $content |
|
2057 | + * @param string $content |
|
2056 | 2058 | * @param string $left |
2057 | 2059 | * @param string $right |
2058 | 2060 | * @return mixed |
@@ -2228,7 +2230,7 @@ discard block |
||
2228 | 2230 | /** |
2229 | 2231 | * Run snippets as per the tags in $documentSource and replace the tags with the returned values. |
2230 | 2232 | * |
2231 | - * @param $content |
|
2233 | + * @param string $content |
|
2232 | 2234 | * @return string |
2233 | 2235 | * @internal param string $documentSource |
2234 | 2236 | */ |
@@ -3263,7 +3265,7 @@ discard block |
||
3263 | 3265 | |
3264 | 3266 | /** |
3265 | 3267 | * @param $templateID |
3266 | - * @return mixed |
|
3268 | + * @return string |
|
3267 | 3269 | */ |
3268 | 3270 | public function _getTemplateCodeFromDB($templateID) |
3269 | 3271 | { |
@@ -3306,7 +3308,7 @@ discard block |
||
3306 | 3308 | /** |
3307 | 3309 | * @param $id |
3308 | 3310 | * @param int $top |
3309 | - * @return mixed |
|
3311 | + * @return string |
|
3310 | 3312 | */ |
3311 | 3313 | public function getUltimateParentId($id, $top = 0) |
3312 | 3314 | { |
@@ -3646,7 +3648,7 @@ discard block |
||
3646 | 3648 | * |
3647 | 3649 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
3648 | 3650 | * @param int $id Element- / Resource-id |
3649 | - * @return bool |
|
3651 | + * @return false|null |
|
3650 | 3652 | */ |
3651 | 3653 | public function lockElement($type, $id) |
3652 | 3654 | { |
@@ -3668,7 +3670,7 @@ discard block |
||
3668 | 3670 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
3669 | 3671 | * @param int $id Element- / Resource-id |
3670 | 3672 | * @param bool $includeAllUsers true = Deletes not only own user-locks |
3671 | - * @return bool |
|
3673 | + * @return false|null |
|
3672 | 3674 | */ |
3673 | 3675 | public function unlockElement($type, $id, $includeAllUsers = false) |
3674 | 3676 | { |
@@ -4181,7 +4183,7 @@ discard block |
||
4181 | 4183 | * Default: 1 |
4182 | 4184 | * @param string $fields List of fields |
4183 | 4185 | * Default: id, pagetitle, description, alias |
4184 | - * @return boolean|array |
|
4186 | + * @return string |
|
4185 | 4187 | */ |
4186 | 4188 | public function getPageInfo($pageid = -1, $active = 1, $fields = 'id, pagetitle, description, alias') |
4187 | 4189 | { |
@@ -4273,7 +4275,7 @@ discard block |
||
4273 | 4275 | * |
4274 | 4276 | * @param string $type |
4275 | 4277 | * @param bool $report |
4276 | - * @return bool |
|
4278 | + * @return boolean|null |
|
4277 | 4279 | */ |
4278 | 4280 | public function clearCache($type = '', $report = false) |
4279 | 4281 | { |
@@ -4639,7 +4641,7 @@ discard block |
||
4639 | 4641 | * - Placeholders prefix. Default: '{'. |
4640 | 4642 | * @param string $suffix {string} |
4641 | 4643 | * - Placeholders suffix. Default: '}'. |
4642 | - * @return bool|mixed|string {string; false} - Parsed chunk or false if $chunkArr is not array. |
|
4644 | + * @return false|string {string; false} - Parsed chunk or false if $chunkArr is not array. |
|
4643 | 4645 | * - Parsed chunk or false if $chunkArr is not array. |
4644 | 4646 | */ |
4645 | 4647 | public function parseChunk($chunkName, $chunkArr, $prefix = '{', $suffix = '}') |
@@ -5611,7 +5613,7 @@ discard block |
||
5611 | 5613 | * Remove event listener - only for use within the current execution cycle |
5612 | 5614 | * |
5613 | 5615 | * @param string $evtName |
5614 | - * @return boolean |
|
5616 | + * @return false|null |
|
5615 | 5617 | */ |
5616 | 5618 | public function removeEventListener($evtName) |
5617 | 5619 | { |
@@ -5635,7 +5637,7 @@ discard block |
||
5635 | 5637 | * |
5636 | 5638 | * @param string $evtName |
5637 | 5639 | * @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. |
5638 | - * @return boolean|array |
|
5640 | + * @return false|null |
|
5639 | 5641 | */ |
5640 | 5642 | public function invokeEvent($evtName, $extParams = array()) |
5641 | 5643 | { |
@@ -6280,7 +6282,7 @@ discard block |
||
6280 | 6282 | |
6281 | 6283 | /** |
6282 | 6284 | * @param string $str |
6283 | - * @return bool|mixed|string |
|
6285 | + * @return string |
|
6284 | 6286 | */ |
6285 | 6287 | public function atBindFileContent($str = '') |
6286 | 6288 | { |
@@ -6331,8 +6333,8 @@ discard block |
||
6331 | 6333 | } |
6332 | 6334 | |
6333 | 6335 | /** |
6334 | - * @param $str |
|
6335 | - * @return bool|string |
|
6336 | + * @param string $str |
|
6337 | + * @return false|string |
|
6336 | 6338 | */ |
6337 | 6339 | public function getExtFromFilename($str) |
6338 | 6340 | { |
@@ -6360,7 +6362,7 @@ discard block |
||
6360 | 6362 | * @param string $text Error message |
6361 | 6363 | * @param string $file File where the error was detected |
6362 | 6364 | * @param string $line Line number within $file |
6363 | - * @return boolean |
|
6365 | + * @return boolean|null |
|
6364 | 6366 | */ |
6365 | 6367 | public function phpError($nr, $text, $file, $line) |
6366 | 6368 | { |
@@ -6412,7 +6414,7 @@ discard block |
||
6412 | 6414 | * @param string $text |
6413 | 6415 | * @param string $line |
6414 | 6416 | * @param string $output |
6415 | - * @return bool |
|
6417 | + * @return null|boolean |
|
6416 | 6418 | */ |
6417 | 6419 | public function messageQuit($msg = 'unspecified error', $query = '', $is_error = true, $nr = '', $file = '', $source = '', $text = '', $line = '', $output = '') |
6418 | 6420 | { |
@@ -6827,7 +6829,7 @@ discard block |
||
6827 | 6829 | |
6828 | 6830 | /** |
6829 | 6831 | * @param string $str |
6830 | - * @return bool|mixed|string |
|
6832 | + * @return string |
|
6831 | 6833 | */ |
6832 | 6834 | public function atBindInclude($str = '') |
6833 | 6835 | { |
@@ -6878,7 +6880,7 @@ discard block |
||
6878 | 6880 | * @param $str |
6879 | 6881 | * @param int $flags |
6880 | 6882 | * @param string $encode |
6881 | - * @return mixed |
|
6883 | + * @return null|string |
|
6882 | 6884 | */ |
6883 | 6885 | public function htmlspecialchars($str, $flags = ENT_COMPAT, $encode = '') |
6884 | 6886 | { |
@@ -6886,7 +6888,7 @@ discard block |
||
6886 | 6888 | } |
6887 | 6889 | |
6888 | 6890 | /** |
6889 | - * @param $string |
|
6891 | + * @param string $string |
|
6890 | 6892 | * @param bool $returnData |
6891 | 6893 | * @return bool|mixed |
6892 | 6894 | */ |
@@ -282,7 +282,8 @@ discard block |
||
282 | 282 | return $service; |
283 | 283 | } |
284 | 284 | |
285 | - private function checkServiceAlias($name){ |
|
285 | + private function checkServiceAlias($name) |
|
286 | + { |
|
286 | 287 | foreach ($this->providerAliases as $alias => $interface) { |
287 | 288 | if($name === $interface) { |
288 | 289 | return $alias; |
@@ -962,13 +963,15 @@ discard block |
||
962 | 963 | $this->virtualDir = ''; |
963 | 964 | } |
964 | 965 | |
965 | - if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */ |
|
966 | + if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { |
|
967 | +/* we got an ID returned, check to make sure it's not an alias */ |
|
966 | 968 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
967 | 969 | if ($this->config['use_alias_path'] == 1) { |
968 | 970 | if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) { |
969 | 971 | $this->documentMethod = 'id'; |
970 | 972 | return $q; |
971 | - } else { /* not a valid id in terms of virtualDir, treat as alias */ |
|
973 | + } else { |
|
974 | +/* not a valid id in terms of virtualDir, treat as alias */ |
|
972 | 975 | $this->documentMethod = 'alias'; |
973 | 976 | return $q; |
974 | 977 | } |
@@ -976,7 +979,8 @@ discard block |
||
976 | 979 | $this->documentMethod = 'id'; |
977 | 980 | return $q; |
978 | 981 | } |
979 | - } else { /* we didn't get an ID back, so instead we assume it's an alias */ |
|
982 | + } else { |
|
983 | +/* we didn't get an ID back, so instead we assume it's an alias */ |
|
980 | 984 | if ($this->config['friendly_alias_urls'] != 1) { |
981 | 985 | $q = $qOrig; |
982 | 986 | } |
@@ -1006,13 +1010,14 @@ discard block |
||
1006 | 1010 | * @param $id |
1007 | 1011 | * @return array|mixed|null|string |
1008 | 1012 | */ |
1009 | - public function makePageCacheKey($id){ |
|
1013 | + public function makePageCacheKey($id) |
|
1014 | + { |
|
1010 | 1015 | $hash = $id; |
1011 | 1016 | $tmp = null; |
1012 | 1017 | $params = array(); |
1013 | - if(!empty($this->systemCacheKey)){ |
|
1018 | + if(!empty($this->systemCacheKey)) { |
|
1014 | 1019 | $hash = $this->systemCacheKey; |
1015 | - }else { |
|
1020 | + } else { |
|
1016 | 1021 | if (!empty($_GET)) { |
1017 | 1022 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
1018 | 1023 | $params = $_GET; |
@@ -1021,7 +1026,7 @@ discard block |
||
1021 | 1026 | } |
1022 | 1027 | } |
1023 | 1028 | $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params)); |
1024 | - if (is_array($evtOut) && count($evtOut) > 0){ |
|
1029 | + if (is_array($evtOut) && count($evtOut) > 0) { |
|
1025 | 1030 | $tmp = array_pop($evtOut); |
1026 | 1031 | } |
1027 | 1032 | return empty($tmp) ? $hash : $tmp; |
@@ -1348,7 +1353,8 @@ discard block |
||
1348 | 1353 | $where = "pub_date <= {$timeNow} AND pub_date!=0 AND published=0"; |
1349 | 1354 | $result_pub = $this->getDatabase()->select( 'id', '[+prefix+]site_content', $where); |
1350 | 1355 | $this->getDatabase()->update($field, '[+prefix+]site_content', $where); |
1351 | - if ($this->getDatabase()->getRecordCount($result_pub) >= 1) { //Event unPublished doc |
|
1356 | + if ($this->getDatabase()->getRecordCount($result_pub) >= 1) { |
|
1357 | +//Event unPublished doc |
|
1352 | 1358 | while ($row_pub = $this->getDatabase()->getRow($result_pub)) { |
1353 | 1359 | $this->invokeEvent("OnDocUnPublished", array( |
1354 | 1360 | "docid" => $row_pub['id'] |
@@ -1361,7 +1367,8 @@ discard block |
||
1361 | 1367 | $where = "unpub_date <= {$timeNow} AND unpub_date!=0 AND published=1"; |
1362 | 1368 | $result_unpub = $this->getDatabase()->select( 'id', '[+prefix+]site_content', $where); |
1363 | 1369 | $this->getDatabase()->update($field, '[+prefix+]site_content', $where); |
1364 | - if ($this->getDatabase()->getRecordCount($result_unpub) >= 1) { //Event unPublished doc |
|
1370 | + if ($this->getDatabase()->getRecordCount($result_unpub) >= 1) { |
|
1371 | +//Event unPublished doc |
|
1365 | 1372 | while ($row_unpub = $this->getDatabase()->getRow($result_unpub)) { |
1366 | 1373 | $this->invokeEvent("OnDocUnPublished", array( |
1367 | 1374 | "docid" => $row_unpub['id'] |
@@ -1448,10 +1455,18 @@ discard block |
||
1448 | 1455 | return array(); |
1449 | 1456 | } |
1450 | 1457 | $spacer = md5('<<<EVO>>>'); |
1451 | - if($left==='{{' && strpos($content,';}}')!==false) $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
1452 | - if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
1453 | - if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
1454 | - if($left==='[[' && strpos($content,']]]')!==false) $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
1458 | + if($left==='{{' && strpos($content,';}}')!==false) { |
|
1459 | + $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
1460 | + } |
|
1461 | + if($left==='{{' && strpos($content,'{{}}')!==false) { |
|
1462 | + $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
1463 | + } |
|
1464 | + if($left==='[[' && strpos($content,']]]]')!==false) { |
|
1465 | + $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
1466 | + } |
|
1467 | + if($left==='[[' && strpos($content,']]]')!==false) { |
|
1468 | + $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
1469 | + } |
|
1455 | 1470 | |
1456 | 1471 | $pos['<![CDATA['] = strpos($content, '<![CDATA['); |
1457 | 1472 | $pos[']]>'] = strpos($content, ']]>'); |
@@ -1504,7 +1519,8 @@ discard block |
||
1504 | 1519 | } |
1505 | 1520 | } |
1506 | 1521 | |
1507 | - if (!in_array($fetch, $tags)) { // Avoid double Matches |
|
1522 | + if (!in_array($fetch, $tags)) { |
|
1523 | +// Avoid double Matches |
|
1508 | 1524 | $tags[] = $fetch; // Fetch |
1509 | 1525 | }; |
1510 | 1526 | $fetch = ''; // and reset |
@@ -1522,7 +1538,9 @@ discard block |
||
1522 | 1538 | } |
1523 | 1539 | } |
1524 | 1540 | foreach($tags as $i=>$tag) { |
1525 | - if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag); |
|
1541 | + if(strpos($tag,$spacer)!==false) { |
|
1542 | + $tags[$i] = str_replace($spacer, '', $tag); |
|
1543 | + } |
|
1526 | 1544 | } |
1527 | 1545 | return $tags; |
1528 | 1546 | } |
@@ -1562,7 +1580,10 @@ discard block |
||
1562 | 1580 | } |
1563 | 1581 | |
1564 | 1582 | foreach ($matches[1] as $i => $key) { |
1565 | - if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1583 | + if(strpos($key,'[+')!==false) { |
|
1584 | + continue; |
|
1585 | + } |
|
1586 | + // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1566 | 1587 | if (substr($key, 0, 1) == '#') { |
1567 | 1588 | $key = substr($key, 1); |
1568 | 1589 | } // remove # for QuickEdit format |
@@ -2288,7 +2309,8 @@ discard block |
||
2288 | 2309 | * @return mixed|string |
2289 | 2310 | */ |
2290 | 2311 | public function _getSGVar($value) |
2291 | - { // Get super globals |
|
2312 | + { |
|
2313 | +// Get super globals |
|
2292 | 2314 | $key = $value; |
2293 | 2315 | $_ = $this->config['enable_filter']; |
2294 | 2316 | $this->config['enable_filter'] = 1; |
@@ -2693,7 +2715,8 @@ discard block |
||
2693 | 2715 | if ($this->config['friendly_urls'] == 1) { |
2694 | 2716 | $aliases = array(); |
2695 | 2717 | if (is_array($this->documentListing)) { |
2696 | - foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site! |
|
2718 | + foreach ($this->documentListing as $path => $docid) { |
|
2719 | +// This is big Loop on large site! |
|
2697 | 2720 | $aliases[$docid] = $path; |
2698 | 2721 | $isfolder[$docid] = $this->aliasListing[$docid]['isfolder']; |
2699 | 2722 | } |
@@ -2726,7 +2749,7 @@ discard block |
||
2726 | 2749 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
2727 | 2750 | $pref = $this->config['friendly_url_prefix']; |
2728 | 2751 | $suff = $this->config['friendly_url_suffix']; |
2729 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2752 | + $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){ |
|
2730 | 2753 | global $modx; |
2731 | 2754 | $thealias = $aliases[$m[1]]; |
2732 | 2755 | $thefolder = $isfolder[$m[1]]; |
@@ -4509,7 +4532,8 @@ discard block |
||
4509 | 4532 | if (isset ($this->snippetCache[$snippetName])) { |
4510 | 4533 | $snippet = $this->snippetCache[$snippetName]; |
4511 | 4534 | $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
4512 | - } else { // not in cache so let's check the db |
|
4535 | + } else { |
|
4536 | +// not in cache so let's check the db |
|
4513 | 4537 | $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->getDatabase()->escape($snippetName) . "' AND ss.disabled=0;"; |
4514 | 4538 | $result = $this->getDatabase()->query($sql); |
4515 | 4539 | if ($this->getDatabase()->getRecordCount($result) == 1) { |
@@ -5010,7 +5034,7 @@ discard block |
||
5010 | 5034 | $result = $this->getDatabase()->makeArray($rs); |
5011 | 5035 | |
5012 | 5036 | // get default/built-in template variables |
5013 | - if(is_array($docRow)){ |
|
5037 | + if(is_array($docRow)) { |
|
5014 | 5038 | ksort($docRow); |
5015 | 5039 | |
5016 | 5040 | foreach ($docRow as $key => $value) { |
@@ -5485,12 +5509,16 @@ discard block |
||
5485 | 5509 | return ''; |
5486 | 5510 | } // nothing to register |
5487 | 5511 | if (!is_array($options)) { |
5488 | - if (is_bool($options)) // backward compatibility with old plaintext parameter |
|
5512 | + if (is_bool($options)) { |
|
5513 | + // backward compatibility with old plaintext parameter |
|
5489 | 5514 | { |
5490 | 5515 | $options = array('plaintext' => $options); |
5491 | - } elseif (is_string($options)) // Also allow script name as 2nd param |
|
5516 | + } |
|
5517 | + } elseif (is_string($options)) { |
|
5518 | + // Also allow script name as 2nd param |
|
5492 | 5519 | { |
5493 | 5520 | $options = array('name' => $options); |
5521 | + } |
|
5494 | 5522 | } else { |
5495 | 5523 | $options = array(); |
5496 | 5524 | } |
@@ -5502,7 +5530,8 @@ discard block |
||
5502 | 5530 | unset($overwritepos); // probably unnecessary--just making sure |
5503 | 5531 | |
5504 | 5532 | $useThisVer = true; |
5505 | - if (isset($this->loadedjscripts[$key])) { // a matching script was found |
|
5533 | + if (isset($this->loadedjscripts[$key])) { |
|
5534 | +// a matching script was found |
|
5506 | 5535 | // if existing script is a startup script, make sure the candidate is also a startup script |
5507 | 5536 | if ($this->loadedjscripts[$key]['startup']) { |
5508 | 5537 | $startup = true; |
@@ -5522,7 +5551,8 @@ discard block |
||
5522 | 5551 | // overwrite the old script (the position may be important for dependent scripts) |
5523 | 5552 | $overwritepos = $this->loadedjscripts[$key]['pos']; |
5524 | 5553 | } |
5525 | - } else { // Use the original version |
|
5554 | + } else { |
|
5555 | +// Use the original version |
|
5526 | 5556 | if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) { |
5527 | 5557 | // need to move the exisiting script to the head |
5528 | 5558 | $version = $this->loadedjscripts[$key][$version]; |
@@ -5647,7 +5677,8 @@ discard block |
||
5647 | 5677 | } |
5648 | 5678 | |
5649 | 5679 | $results = null; |
5650 | - foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop |
|
5680 | + foreach ($this->pluginEvent[$evtName] as $pluginName) { |
|
5681 | +// start for loop |
|
5651 | 5682 | if ($this->dumpPlugins) { |
5652 | 5683 | $eventtime = $this->getMicroTime(); |
5653 | 5684 | } |
@@ -5793,8 +5824,7 @@ discard block |
||
5793 | 5824 | } |
5794 | 5825 | } |
5795 | 5826 | } |
5796 | - } |
|
5797 | - elseif(\is_array($propertyString)) { |
|
5827 | + } elseif(\is_array($propertyString)) { |
|
5798 | 5828 | $property = $propertyString; |
5799 | 5829 | } |
5800 | 5830 | if (!empty($elementName) && !empty($elementType)) { |
@@ -6241,7 +6271,8 @@ discard block |
||
6241 | 6271 | * @return bool |
6242 | 6272 | */ |
6243 | 6273 | public function isSafeCode($phpcode = '', $safe_functions = '') |
6244 | - { // return true or false |
|
6274 | + { |
|
6275 | +// return true or false |
|
6245 | 6276 | if ($safe_functions == '') { |
6246 | 6277 | return false; |
6247 | 6278 | } |
@@ -6650,7 +6681,7 @@ discard block |
||
6650 | 6681 | $args = array_pad(array(), $_, '$var'); |
6651 | 6682 | $args = implode(", ", $args); |
6652 | 6683 | $modx = &$this; |
6653 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
6684 | + $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){ |
|
6654 | 6685 | $arg = $val['args'][$tmp - 1]; |
6655 | 6686 | switch (true) { |
6656 | 6687 | case is_null($arg): { |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | |
372 | 372 | /** |
373 | 373 | * @param $fields |
374 | - * @param $table |
|
374 | + * @param string $table |
|
375 | 375 | * @param string $where |
376 | 376 | * @return bool|mixed|mysqli_result |
377 | 377 | */ |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | } |
517 | 517 | |
518 | 518 | /** |
519 | - * @param $name |
|
519 | + * @param string $name |
|
520 | 520 | * @param mysqli_result|string $dsq |
521 | 521 | * @return array |
522 | 522 | */ |
@@ -33,6 +33,9 @@ discard block |
||
33 | 33 | public $renderPagerFncArgs; |
34 | 34 | public static $dataSetPagerCnt; |
35 | 35 | |
36 | + /** |
|
37 | + * @param boolean|string $id |
|
38 | + */ |
|
36 | 39 | public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) { |
37 | 40 | global $_PAGE; // use view state object |
38 | 41 | |
@@ -77,6 +80,9 @@ discard block |
||
77 | 80 | $this->pageSize = $ps; |
78 | 81 | } |
79 | 82 | |
83 | + /** |
|
84 | + * @param DataGrid $fncName |
|
85 | + */ |
|
80 | 86 | public function setRenderRowFnc($fncName, $args = "") { |
81 | 87 | $this->renderRowFnc = &$fncName; |
82 | 88 | $this->renderRowFncArgs = $args; // extra agruments |
@@ -11,7 +11,8 @@ discard block |
||
11 | 11 | # ----------------------------------------- |
12 | 12 | # |
13 | 13 | |
14 | -class DataSetPager implements DataSetPagerInterface{ |
|
14 | +class DataSetPager implements DataSetPagerInterface |
|
15 | +{ |
|
15 | 16 | |
16 | 17 | public $ds; // datasource |
17 | 18 | public $pageSize; |
@@ -33,7 +34,8 @@ discard block |
||
33 | 34 | public $renderPagerFncArgs; |
34 | 35 | public static $dataSetPagerCnt; |
35 | 36 | |
36 | - public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) { |
|
37 | + public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) |
|
38 | + { |
|
37 | 39 | global $_PAGE; // use view state object |
38 | 40 | |
39 | 41 | // set id |
@@ -61,35 +63,42 @@ discard block |
||
61 | 63 | $this->pager = ''; |
62 | 64 | } |
63 | 65 | |
64 | - public function getRenderedPager() { |
|
66 | + public function getRenderedPager() |
|
67 | + { |
|
65 | 68 | return $this->pager; |
66 | 69 | } |
67 | 70 | |
68 | - public function getRenderedRows() { |
|
71 | + public function getRenderedRows() |
|
72 | + { |
|
69 | 73 | return $this->rows; |
70 | 74 | } |
71 | 75 | |
72 | - public function setDataSource($ds) { |
|
76 | + public function setDataSource($ds) |
|
77 | + { |
|
73 | 78 | $this->ds = $ds; |
74 | 79 | } |
75 | 80 | |
76 | - public function setPageSize($ps) { |
|
81 | + public function setPageSize($ps) |
|
82 | + { |
|
77 | 83 | $this->pageSize = $ps; |
78 | 84 | } |
79 | 85 | |
80 | - public function setRenderRowFnc($fncName, $args = "") { |
|
86 | + public function setRenderRowFnc($fncName, $args = "") |
|
87 | + { |
|
81 | 88 | $this->renderRowFnc = &$fncName; |
82 | 89 | $this->renderRowFncArgs = $args; // extra agruments |
83 | 90 | |
84 | 91 | |
85 | 92 | } |
86 | 93 | |
87 | - public function setRenderPagerFnc($fncName, $args = "") { |
|
94 | + public function setRenderPagerFnc($fncName, $args = "") |
|
95 | + { |
|
88 | 96 | $this->renderPagerFnc = $fncName; |
89 | 97 | $this->renderPagerFncArgs = $args; // extra agruments |
90 | 98 | } |
91 | 99 | |
92 | - public function render() { |
|
100 | + public function render() |
|
101 | + { |
|
93 | 102 | $modx = evolutionCMS(); global $_PAGE; |
94 | 103 | |
95 | 104 | $isDataset = $modx->getDatabase()->isResult($this->ds); |
@@ -142,8 +151,10 @@ discard block |
||
142 | 151 | $url = $_SERVER['PHP_SELF'] . '?'; |
143 | 152 | } |
144 | 153 | $i = 0; |
145 | - foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) { |
|
154 | + foreach($_GET as $n => $v) { |
|
155 | + if($n != 'dpgn' . $this->id) { |
|
146 | 156 | $i++; |
157 | + } |
|
147 | 158 | $url .= (($i > 1) ? "&" : "") . "$n=$v"; |
148 | 159 | } |
149 | 160 | if($i >= 1) { |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
6 | -if($modx->getManagerApi()->action!='8' && isset($_SESSION['mgrValidated'])){ |
|
6 | +if($modx->getManagerApi()->action!='8' && isset($_SESSION['mgrValidated'])) { |
|
7 | 7 | |
8 | 8 | $homeurl = $modx->makeUrl($manager_login_startup>0 ? $manager_login_startup:$site_start); |
9 | 9 | $logouturl = MODX_MANAGER_URL.'index.php?a=8'; |
@@ -35,8 +35,7 @@ discard block |
||
35 | 35 | if(substr($target,0,6)==='@CHUNK') { |
36 | 36 | $target = trim(substr($target,7)); |
37 | 37 | $lockout_tpl = $modx->getChunk($target); |
38 | - } |
|
39 | - elseif(substr($target,0,5)==='@FILE') { |
|
38 | + } elseif(substr($target,0,5)==='@FILE') { |
|
40 | 39 | $target = trim(substr($target,6)); |
41 | 40 | $lockout_tpl = file_get_contents($target); |
42 | 41 | } |
@@ -44,24 +43,20 @@ discard block |
||
44 | 43 | $chunk = $modx->getChunk($target); |
45 | 44 | if($chunk!==false && !empty($chunk)) { |
46 | 45 | $lockout_tpl = $chunk; |
47 | - } |
|
48 | - elseif(is_file(MODX_BASE_PATH . $target)) { |
|
46 | + } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
49 | 47 | $target = MODX_BASE_PATH . $target; |
50 | 48 | $lockout_tpl = file_get_contents($target); |
51 | - } |
|
52 | - elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl')) { |
|
49 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl')) { |
|
53 | 50 | $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl'; |
54 | 51 | $lockout_tpl = file_get_contents($target); |
55 | - } |
|
56 | - elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl')) { |
|
52 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl')) { |
|
57 | 53 | $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl'; |
58 | 54 | $login_tpl = file_get_contents($target); |
59 | - } |
|
60 | - elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html')) { // ClipperCMS compatible |
|
55 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html')) { |
|
56 | +// ClipperCMS compatible |
|
61 | 57 | $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html'; |
62 | 58 | $lockout_tpl = file_get_contents($target); |
63 | - } |
|
64 | - else { |
|
59 | + } else { |
|
65 | 60 | $target = MODX_MANAGER_PATH . 'media/style/common/manager.lockout.tpl'; |
66 | 61 | $lockout_tpl = file_get_contents($target); |
67 | 62 | } |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | $warningspresent = 0; |
20 | 20 | |
21 | 21 | $sysfiles_check = $modx->getManagerApi()->checkSystemChecksum(); |
22 | -if ($sysfiles_check!=='0'){ |
|
22 | +if ($sysfiles_check!=='0') { |
|
23 | 23 | $warningspresent = 1; |
24 | 24 | $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
25 | 25 | } |
26 | 26 | |
27 | -if (is_writable("includes/config.inc.php")){ |
|
27 | +if (is_writable("includes/config.inc.php")) { |
|
28 | 28 | // Warn if world writable |
29 | 29 | if(@fileperms('includes/config.inc.php') & 0x0002) { |
30 | 30 | $warningspresent = 1; |
@@ -120,7 +120,8 @@ discard block |
||
120 | 120 | /** |
121 | 121 | * @return bool |
122 | 122 | */ |
123 | - function checkSiteCache() { |
|
123 | + function checkSiteCache() |
|
124 | + { |
|
124 | 125 | $modx = evolutionCMS(); |
125 | 126 | $checked= true; |
126 | 127 | if (file_exists($modx->config['base_path'] . 'assets/cache/siteCache.idx.php')) { |
@@ -159,26 +160,36 @@ discard block |
||
159 | 160 | |
160 | 161 | if ($warningspresent==1) { |
161 | 162 | |
162 | -if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3'; |
|
163 | +if(!isset($modx->config['send_errormail'])) { |
|
164 | + $modx->config['send_errormail']='3'; |
|
165 | +} |
|
163 | 166 | $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>"; |
164 | 167 | |
165 | 168 | for ($i=0;$i<count($warnings);$i++) { |
166 | 169 | switch ($warnings[$i][0]) { |
167 | 170 | case $_lang['configcheck_configinc']; |
168 | 171 | $warnings[$i][1] = $_lang['configcheck_configinc_msg']; |
169 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
172 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
173 | + $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
174 | + } |
|
170 | 175 | break; |
171 | 176 | case $_lang['configcheck_installer'] : |
172 | 177 | $warnings[$i][1] = $_lang['configcheck_installer_msg']; |
173 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
178 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
179 | + $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
180 | + } |
|
174 | 181 | break; |
175 | 182 | case $_lang['configcheck_cache'] : |
176 | 183 | $warnings[$i][1] = $_lang['configcheck_cache_msg']; |
177 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
184 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
185 | + $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
186 | + } |
|
178 | 187 | break; |
179 | 188 | case $_lang['configcheck_images'] : |
180 | 189 | $warnings[$i][1] = $_lang['configcheck_images_msg']; |
181 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
190 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
191 | + $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
192 | + } |
|
182 | 193 | break; |
183 | 194 | case $_lang['configcheck_sysfiles_mod']: |
184 | 195 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
@@ -186,7 +197,9 @@ discard block |
||
186 | 197 | if($modx->hasPermission('settings')) { |
187 | 198 | $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
188 | 199 | } |
189 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
200 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
201 | + $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
202 | + } |
|
190 | 203 | break; |
191 | 204 | case $_lang['configcheck_lang_difference'] : |
192 | 205 | $warnings[$i][1] = $_lang['configcheck_lang_difference_msg']; |
@@ -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->getDatabase()->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->getDatabase()->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 | } |
@@ -2,4 +2,6 @@ |
||
2 | 2 | |
3 | 3 | use Exception; |
4 | 4 | |
5 | -class ServiceNotFoundException extends Exception{} |
|
5 | +class ServiceNotFoundException extends Exception |
|
6 | +{ |
|
7 | +} |
@@ -2,4 +2,6 @@ |
||
2 | 2 | |
3 | 3 | use Exception; |
4 | 4 | |
5 | -class ContainerException extends Exception{} |
|
5 | +class ContainerException extends Exception |
|
6 | +{ |
|
7 | +} |
@@ -1,3 +1,5 @@ |
||
1 | 1 | <?php namespace EvolutionCMS\Interfaces; |
2 | 2 | |
3 | -interface ManagerApiInterface{} |
|
3 | +interface ManagerApiInterface |
|
4 | +{ |
|
5 | +} |