@@ -132,7 +132,6 @@ discard block |
||
132 | 132 | public $urlProcessor; |
133 | 133 | |
134 | 134 | /** |
135 | - * @param array $services |
|
136 | 135 | */ |
137 | 136 | public function __construct() |
138 | 137 | { |
@@ -317,7 +316,7 @@ discard block |
||
317 | 316 | * @param int $count_attempts |
318 | 317 | * @param string $type $type |
319 | 318 | * @param string $responseCode |
320 | - * @return bool|null |
|
319 | + * @return false|null |
|
321 | 320 | * @global string $base_url |
322 | 321 | * @global string $site_url |
323 | 322 | */ |
@@ -804,7 +803,7 @@ discard block |
||
804 | 803 | } |
805 | 804 | |
806 | 805 | /** |
807 | - * @param $contents |
|
806 | + * @param string $contents |
|
808 | 807 | * @return mixed |
809 | 808 | */ |
810 | 809 | public function RecoveryEscapedTags($contents) |
@@ -1652,7 +1651,7 @@ discard block |
||
1652 | 1651 | |
1653 | 1652 | /** |
1654 | 1653 | * Remove Comment-Tags from output like <!--@- Comment -@--> |
1655 | - * @param $content |
|
1654 | + * @param string $content |
|
1656 | 1655 | * @param string $left |
1657 | 1656 | * @param string $right |
1658 | 1657 | * @return mixed |
@@ -1853,7 +1852,7 @@ discard block |
||
1853 | 1852 | /** |
1854 | 1853 | * Run snippets as per the tags in $documentSource and replace the tags with the returned values. |
1855 | 1854 | * |
1856 | - * @param $content |
|
1855 | + * @param string $content |
|
1857 | 1856 | * @return string |
1858 | 1857 | * @internal param string $documentSource |
1859 | 1858 | */ |
@@ -2298,6 +2297,7 @@ discard block |
||
2298 | 2297 | |
2299 | 2298 | /** |
2300 | 2299 | * @deprecated use UrlProcessor::rewriteUrls() |
2300 | + * @return string |
|
2301 | 2301 | */ |
2302 | 2302 | public function rewriteUrls($documentSource) |
2303 | 2303 | { |
@@ -2761,7 +2761,7 @@ discard block |
||
2761 | 2761 | |
2762 | 2762 | /** |
2763 | 2763 | * @param $templateID |
2764 | - * @return mixed |
|
2764 | + * @return string |
|
2765 | 2765 | */ |
2766 | 2766 | public function _getTemplateCodeFromDB($templateID) |
2767 | 2767 | { |
@@ -2809,7 +2809,7 @@ discard block |
||
2809 | 2809 | /** |
2810 | 2810 | * @param $id |
2811 | 2811 | * @param int $top |
2812 | - * @return mixed |
|
2812 | + * @return string |
|
2813 | 2813 | */ |
2814 | 2814 | public function getUltimateParentId($id, $top = 0) |
2815 | 2815 | { |
@@ -3206,7 +3206,7 @@ discard block |
||
3206 | 3206 | * |
3207 | 3207 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
3208 | 3208 | * @param int $id Element- / Resource-id |
3209 | - * @return bool |
|
3209 | + * @return false|null |
|
3210 | 3210 | */ |
3211 | 3211 | public function lockElement($type, $id) |
3212 | 3212 | { |
@@ -3229,7 +3229,7 @@ discard block |
||
3229 | 3229 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
3230 | 3230 | * @param int $id Element- / Resource-id |
3231 | 3231 | * @param bool $includeAllUsers true = Deletes not only own user-locks |
3232 | - * @return bool |
|
3232 | + * @return false|null |
|
3233 | 3233 | */ |
3234 | 3234 | public function unlockElement($type, $id, $includeAllUsers = false) |
3235 | 3235 | { |
@@ -3784,7 +3784,7 @@ discard block |
||
3784 | 3784 | * Default: 1 |
3785 | 3785 | * @param string $fields List of fields |
3786 | 3786 | * Default: id, pagetitle, description, alias |
3787 | - * @return boolean|array |
|
3787 | + * @return string |
|
3788 | 3788 | */ |
3789 | 3789 | public function getPageInfo($pageid = -1, $active = 1, $fields = 'id, pagetitle, description, alias') |
3790 | 3790 | { |
@@ -3883,7 +3883,7 @@ discard block |
||
3883 | 3883 | * |
3884 | 3884 | * @param string $type |
3885 | 3885 | * @param bool $report |
3886 | - * @return bool |
|
3886 | + * @return boolean|null |
|
3887 | 3887 | */ |
3888 | 3888 | public function clearCache($type = '', $report = false) |
3889 | 3889 | { |
@@ -3926,6 +3926,7 @@ discard block |
||
3926 | 3926 | |
3927 | 3927 | /** |
3928 | 3928 | * @deprecated use UrlProcessor::makeUrl() |
3929 | + * @return string |
|
3929 | 3930 | */ |
3930 | 3931 | public function makeUrl($id, $alias = '', $args = '', $scheme = '') |
3931 | 3932 | { |
@@ -4020,7 +4021,7 @@ discard block |
||
4020 | 4021 | } |
4021 | 4022 | |
4022 | 4023 | /** |
4023 | - * @param string|object $processor |
|
4024 | + * @param string $processor |
|
4024 | 4025 | * @return bool |
4025 | 4026 | */ |
4026 | 4027 | public function isChunkProcessor($processor) |
@@ -4446,9 +4447,9 @@ discard block |
||
4446 | 4447 | * Elements representing a TV consist of an array representing a db row including the fields specified in $fields. |
4447 | 4448 | * |
4448 | 4449 | * @param string|array $idnames {array; '*'} - Which TVs to fetch. Can relate to the TV ids in the db (array elements should be numeric only) or the TV names (array elements should be names only). @required |
4449 | - * @param string|array $fields {comma separated string; '*'} - Fields names in the TV table of MODx database. Default: '*' |
|
4450 | + * @param string $fields {comma separated string; '*'} - Fields names in the TV table of MODx database. Default: '*' |
|
4450 | 4451 | * @param int|string $docid {integer; ''} - Id of a document to get. Default: an empty string which indicates the current document. |
4451 | - * @param int|string $published {0; 1; 'all'} - Document publication status. Once the parameter equals 'all', the result will be returned regardless of whether the ducuments are published or they are not. Default: 1. |
|
4452 | + * @param integer $published {0; 1; 'all'} - Document publication status. Once the parameter equals 'all', the result will be returned regardless of whether the ducuments are published or they are not. Default: 1. |
|
4452 | 4453 | * @param string $sort {comma separated string} - Fields of the TV table to sort by. Default: 'rank'. |
4453 | 4454 | * @param string $dir {'ASC'; 'DESC'} - How to sort the result array (direction). Default: 'ASC'. |
4454 | 4455 | * |
@@ -5098,7 +5099,7 @@ discard block |
||
5098 | 5099 | * Remove event listener - only for use within the current execution cycle |
5099 | 5100 | * |
5100 | 5101 | * @param string $evtName |
5101 | - * @return boolean |
|
5102 | + * @return false|null |
|
5102 | 5103 | */ |
5103 | 5104 | public function removeEventListener($evtName) |
5104 | 5105 | { |
@@ -5150,7 +5151,7 @@ discard block |
||
5150 | 5151 | * |
5151 | 5152 | * @param string $evtName |
5152 | 5153 | * @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. |
5153 | - * @return boolean|array |
|
5154 | + * @return false|null |
|
5154 | 5155 | */ |
5155 | 5156 | public function invokeEvent($evtName, $extParams = array()) |
5156 | 5157 | { |
@@ -5463,6 +5464,7 @@ discard block |
||
5463 | 5464 | |
5464 | 5465 | /** |
5465 | 5466 | * {@inheritdoc} |
5467 | + * @param string $type |
|
5466 | 5468 | */ |
5467 | 5469 | public function findElements($type, $scanPath, array $ext) |
5468 | 5470 | { |
@@ -5604,7 +5606,7 @@ discard block |
||
5604 | 5606 | |
5605 | 5607 | /** |
5606 | 5608 | * @param string $str |
5607 | - * @return bool|mixed|string |
|
5609 | + * @return string |
|
5608 | 5610 | */ |
5609 | 5611 | public function atBindFileContent($str = '') |
5610 | 5612 | { |
@@ -5655,8 +5657,8 @@ discard block |
||
5655 | 5657 | } |
5656 | 5658 | |
5657 | 5659 | /** |
5658 | - * @param $str |
|
5659 | - * @return bool|string |
|
5660 | + * @param string $str |
|
5661 | + * @return false|string |
|
5660 | 5662 | */ |
5661 | 5663 | public function getExtFromFilename($str) |
5662 | 5664 | { |
@@ -5812,7 +5814,7 @@ discard block |
||
5812 | 5814 | * @param string $text Error message |
5813 | 5815 | * @param string $file File where the error was detected |
5814 | 5816 | * @param string $line Line number within $file |
5815 | - * @return boolean |
|
5817 | + * @return boolean|null |
|
5816 | 5818 | * @deprecated |
5817 | 5819 | */ |
5818 | 5820 | public function phpError($nr, $text, $file, $line) |
@@ -5908,6 +5910,7 @@ discard block |
||
5908 | 5910 | |
5909 | 5911 | /** |
5910 | 5912 | * @deprecated use UrlProcessor::getIdFromAlias() |
5913 | + * @param string $alias |
|
5911 | 5914 | */ |
5912 | 5915 | public function getIdFromAlias($alias) |
5913 | 5916 | { |
@@ -5916,7 +5919,7 @@ discard block |
||
5916 | 5919 | |
5917 | 5920 | /** |
5918 | 5921 | * @param string $str |
5919 | - * @return bool|mixed|string |
|
5922 | + * @return string |
|
5920 | 5923 | */ |
5921 | 5924 | public function atBindInclude($str = '') |
5922 | 5925 | { |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | if ($this->hasEvolutionProperty($name)) { |
197 | 197 | if ($this->getConfig('error_reporting', 0) > 1) { |
198 | 198 | trigger_error( |
199 | - 'Property $' . $name . ' is deprecated and should no longer be used. ', |
|
199 | + 'Property $'.$name.' is deprecated and should no longer be used. ', |
|
200 | 200 | E_USER_DEPRECATED |
201 | 201 | ); |
202 | 202 | } |
@@ -232,12 +232,12 @@ discard block |
||
232 | 232 | $info = debug_backtrace(); |
233 | 233 | $m[] = $msg; |
234 | 234 | if (!empty($this->currentSnippet)) { |
235 | - $m[] = 'Snippet - ' . $this->currentSnippet; |
|
235 | + $m[] = 'Snippet - '.$this->currentSnippet; |
|
236 | 236 | } elseif (!empty($this->event->activePlugin)) { |
237 | - $m[] = 'Plugin - ' . $this->event->activePlugin; |
|
237 | + $m[] = 'Plugin - '.$this->event->activePlugin; |
|
238 | 238 | } |
239 | 239 | $m[] = $this->decoded_request_uri; |
240 | - $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')'; |
|
240 | + $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')'; |
|
241 | 241 | $msg = implode('<br />', $m); |
242 | 242 | $this->logEvent(0, $error_type, $msg, $title); |
243 | 243 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | { |
255 | 255 | $flag = false; |
256 | 256 | if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof Interfaces\DatabaseInterface) { |
257 | - $flag = (bool)$this->{$connector}->conn; |
|
257 | + $flag = (bool) $this->{$connector}->conn; |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | return $flag; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | } |
289 | 289 | if (!$out && $flag) { |
290 | 290 | $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname))); |
291 | - $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php"; |
|
291 | + $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php"; |
|
292 | 292 | $out = is_file($filename) ? include $filename : false; |
293 | 293 | } |
294 | 294 | if ($out && !in_array($extname, $this->extensions)) { |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | { |
308 | 308 | list ($usec, $sec) = explode(' ', microtime()); |
309 | 309 | |
310 | - return ((float)$usec + (float)$sec); |
|
310 | + return ((float) $usec + (float) $sec); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -332,8 +332,8 @@ discard block |
||
332 | 332 | $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0; |
333 | 333 | if ($currentNumberOfRedirects > 3) { |
334 | 334 | $this->getService('ExceptionHandler')->messageQuit( |
335 | - 'Redirection attempt failed - please ensure the document you\'re trying to redirect to exists.' . |
|
336 | - '<p>Redirection URL: <i>' . $url . '</i></p>' |
|
335 | + 'Redirection attempt failed - please ensure the document you\'re trying to redirect to exists.'. |
|
336 | + '<p>Redirection URL: <i>'.$url.'</i></p>' |
|
337 | 337 | ); |
338 | 338 | } else { |
339 | 339 | $currentNumberOfRedirects += 1; |
@@ -345,19 +345,19 @@ discard block |
||
345 | 345 | } |
346 | 346 | } |
347 | 347 | if ($type == 'REDIRECT_REFRESH') { |
348 | - $header = 'Refresh: 0;URL=' . $url; |
|
348 | + $header = 'Refresh: 0;URL='.$url; |
|
349 | 349 | } elseif ($type == 'REDIRECT_META') { |
350 | - $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />'; |
|
350 | + $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />'; |
|
351 | 351 | echo $header; |
352 | 352 | exit; |
353 | 353 | } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) { |
354 | 354 | // check if url has /$base_url |
355 | 355 | if (substr($url, 0, strlen(MODX_BASE_URL)) == MODX_BASE_URL) { |
356 | 356 | // append $site_url to make it work with Location: |
357 | - $url = MODX_SITE_URL . substr($url, strlen(MODX_BASE_URL)); |
|
357 | + $url = MODX_SITE_URL.substr($url, strlen(MODX_BASE_URL)); |
|
358 | 358 | } |
359 | 359 | if (strpos($url, "\n") === false) { |
360 | - $header = 'Location: ' . $url; |
|
360 | + $header = 'Location: '.$url; |
|
361 | 361 | } else { |
362 | 362 | $this->getService('ExceptionHandler')->messageQuit('No newline allowed in redirect url.'); |
363 | 363 | } |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
549 | 549 | $params = $_GET; |
550 | 550 | ksort($params); |
551 | - $hash .= '_' . md5(http_build_query($params)); |
|
551 | + $hash .= '_'.md5(http_build_query($params)); |
|
552 | 552 | } |
553 | 553 | } |
554 | 554 | $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params)); |
@@ -703,12 +703,12 @@ discard block |
||
703 | 703 | if ($js = $this->getRegisteredClientStartupScripts()) { |
704 | 704 | // change to just before closing </head> |
705 | 705 | // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent); |
706 | - $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput); |
|
706 | + $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput); |
|
707 | 707 | } |
708 | 708 | |
709 | 709 | // Insert jscripts & html block into template - template must have a </body> tag |
710 | 710 | if ($js = $this->getRegisteredClientScripts()) { |
711 | - $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput); |
|
711 | + $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput); |
|
712 | 712 | } |
713 | 713 | // End fix by sirlancelot |
714 | 714 | |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | // send out content-type and content-disposition headers |
720 | 720 | if (IN_PARSER_MODE == "true") { |
721 | 721 | $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html"; |
722 | - header('Content-Type: ' . $type . '; charset=' . $this->getConfig('modx_charset')); |
|
722 | + header('Content-Type: '.$type.'; charset='.$this->getConfig('modx_charset')); |
|
723 | 723 | // if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error) |
724 | 724 | // header('HTTP/1.0 404 Not Found'); |
725 | 725 | if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) { |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | $name = preg_replace('|-+|', '-', $name); |
738 | 738 | $name = trim($name, '-'); |
739 | 739 | } |
740 | - $header = 'Content-Disposition: attachment; filename=' . $name; |
|
740 | + $header = 'Content-Disposition: attachment; filename='.$name; |
|
741 | 741 | header($header); |
742 | 742 | } |
743 | 743 | } |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | |
746 | 746 | $stats = $this->getTimerStats($this->tstart); |
747 | 747 | |
748 | - $out =& $this->documentOutput; |
|
748 | + $out = & $this->documentOutput; |
|
749 | 749 | $out = str_replace("[^q^]", $stats['queries'], $out); |
750 | 750 | $out = str_replace("[^qt^]", $stats['queryTime'], $out); |
751 | 751 | $out = str_replace("[^p^]", $stats['phpTime'], $out); |
@@ -784,19 +784,19 @@ discard block |
||
784 | 784 | $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet |
785 | 785 | $tt += $t; |
786 | 786 | } |
787 | - echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", |
|
788 | - $tt) . ")</legend>{$sc}</fieldset><br />"; |
|
787 | + echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", |
|
788 | + $tt).")</legend>{$sc}</fieldset><br />"; |
|
789 | 789 | echo $this->snippetsCode; |
790 | 790 | } |
791 | 791 | if ($this->dumpPlugins) { |
792 | 792 | $ps = ""; |
793 | 793 | $tt = 0; |
794 | 794 | foreach ($this->pluginsTime as $s => $t) { |
795 | - $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>"; |
|
795 | + $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>"; |
|
796 | 796 | $tt += $t; |
797 | 797 | } |
798 | - echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", |
|
799 | - $tt * 1000) . ")</legend>{$ps}</fieldset><br />"; |
|
798 | + echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", |
|
799 | + $tt * 1000).")</legend>{$ps}</fieldset><br />"; |
|
800 | 800 | echo $this->pluginsCode; |
801 | 801 | } |
802 | 802 | |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | $srcTags = explode(',', $tags); |
824 | 824 | $repTags = array(); |
825 | 825 | foreach ($srcTags as $tag) { |
826 | - $repTags[] = '\\' . $tag[0] . '\\' . $tag[1]; |
|
826 | + $repTags[] = '\\'.$tag[0].'\\'.$tag[1]; |
|
827 | 827 | } |
828 | 828 | |
829 | 829 | return array($srcTags, $repTags); |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']); |
847 | 847 | $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache"; |
848 | 848 | $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0; |
849 | - $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb"; |
|
849 | + $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb"; |
|
850 | 850 | |
851 | 851 | return $stats; |
852 | 852 | } |
@@ -879,7 +879,7 @@ discard block |
||
879 | 879 | { |
880 | 880 | $cacheRefreshTime = 0; |
881 | 881 | $recent_update = 0; |
882 | - if(file_exists($this->getSitePublishingFilePath())) { |
|
882 | + if (file_exists($this->getSitePublishingFilePath())) { |
|
883 | 883 | @include($this->getSitePublishingFilePath()); |
884 | 884 | } |
885 | 885 | $this->recentUpdate = $recent_update; |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | } |
964 | 964 | |
965 | 965 | $docObjSerial = serialize($this->documentObject); |
966 | - $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent; |
|
966 | + $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent; |
|
967 | 967 | $page_cache_path = $this->getHashFile($this->cacheKey); |
968 | 968 | file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent"); |
969 | 969 | } |
@@ -1024,7 +1024,7 @@ discard block |
||
1024 | 1024 | $pos[']]>'] = strpos($content, ']]>'); |
1025 | 1025 | |
1026 | 1026 | if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) { |
1027 | - $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3); |
|
1027 | + $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3); |
|
1028 | 1028 | } |
1029 | 1029 | |
1030 | 1030 | $lp = explode($left, $content); |
@@ -1165,7 +1165,7 @@ discard block |
||
1165 | 1165 | if (strpos($content, $s) !== false) { |
1166 | 1166 | $content = str_replace($s, $value, $content); |
1167 | 1167 | } elseif ($this->debug) { |
1168 | - $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1168 | + $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1169 | 1169 | } |
1170 | 1170 | } |
1171 | 1171 | |
@@ -1345,7 +1345,7 @@ discard block |
||
1345 | 1345 | if (strpos($content, $s) !== false) { |
1346 | 1346 | $content = str_replace($s, $value, $content); |
1347 | 1347 | } elseif ($this->debug) { |
1348 | - $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1348 | + $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1349 | 1349 | } |
1350 | 1350 | } |
1351 | 1351 | |
@@ -1399,7 +1399,7 @@ discard block |
||
1399 | 1399 | } |
1400 | 1400 | |
1401 | 1401 | $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags |
1402 | - $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1402 | + $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1403 | 1403 | if ($this->getConfig('enable_at_syntax')) { |
1404 | 1404 | $value = $this->mergeConditionalTagsContent($value); |
1405 | 1405 | } |
@@ -1415,7 +1415,7 @@ discard block |
||
1415 | 1415 | if (strpos($content, $s) !== false) { |
1416 | 1416 | $content = str_replace($s, $value, $content); |
1417 | 1417 | } elseif ($this->debug) { |
1418 | - $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1418 | + $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1419 | 1419 | } |
1420 | 1420 | } |
1421 | 1421 | |
@@ -1475,7 +1475,7 @@ discard block |
||
1475 | 1475 | if (strpos($content, $s) !== false) { |
1476 | 1476 | $content = str_replace($s, $value, $content); |
1477 | 1477 | } elseif ($this->debug) { |
1478 | - $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1478 | + $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1479 | 1479 | } |
1480 | 1480 | } |
1481 | 1481 | |
@@ -1496,7 +1496,7 @@ discard block |
||
1496 | 1496 | $elseiftag = '<@ELSEIF:', |
1497 | 1497 | $elsetag = '<@ELSE>', |
1498 | 1498 | $endiftag = '<@ENDIF>' |
1499 | - ) { |
|
1499 | + ){ |
|
1500 | 1500 | if (strpos($content, '@IF') !== false) { |
1501 | 1501 | $content = $this->_prepareCTag($content, $iftag, $elseiftag, $elsetag, $endiftag); |
1502 | 1502 | } |
@@ -1505,7 +1505,7 @@ discard block |
||
1505 | 1505 | return $content; |
1506 | 1506 | } |
1507 | 1507 | |
1508 | - $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#'; |
|
1508 | + $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#'; |
|
1509 | 1509 | $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), |
1510 | 1510 | $content); |
1511 | 1511 | |
@@ -1517,7 +1517,7 @@ discard block |
||
1517 | 1517 | } |
1518 | 1518 | list($cmd, $text) = explode('>', $split, 2); |
1519 | 1519 | $cmd = str_replace("'", "\'", $cmd); |
1520 | - $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1520 | + $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1521 | 1521 | $content .= $text; |
1522 | 1522 | } |
1523 | 1523 | $pieces = explode('<@ELSEIF:', $content); |
@@ -1528,13 +1528,13 @@ discard block |
||
1528 | 1528 | } |
1529 | 1529 | list($cmd, $text) = explode('>', $split, 2); |
1530 | 1530 | $cmd = str_replace("'", "\'", $cmd); |
1531 | - $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1531 | + $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1532 | 1532 | $content .= $text; |
1533 | 1533 | } |
1534 | 1534 | |
1535 | 1535 | $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content); |
1536 | 1536 | ob_start(); |
1537 | - $content = eval('?>' . $content); |
|
1537 | + $content = eval('?>'.$content); |
|
1538 | 1538 | $content = ob_get_clean(); |
1539 | 1539 | $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), |
1540 | 1540 | $content); |
@@ -1556,7 +1556,7 @@ discard block |
||
1556 | 1556 | $elseiftag = '<@ELSEIF:', |
1557 | 1557 | $elsetag = '<@ELSE>', |
1558 | 1558 | $endiftag = '<@ENDIF>' |
1559 | - ) { |
|
1559 | + ){ |
|
1560 | 1560 | if (strpos($content, '<!--@IF ') !== false) { |
1561 | 1561 | $content = str_replace('<!--@IF ', $iftag, $content); |
1562 | 1562 | } // for jp |
@@ -1666,7 +1666,7 @@ discard block |
||
1666 | 1666 | $matches = $this->getTagsFromContent($content, $left, $right); |
1667 | 1667 | if (!empty($matches)) { |
1668 | 1668 | foreach ($matches[0] as $i => $v) { |
1669 | - $addBreakMatches[$i] = $v . "\n"; |
|
1669 | + $addBreakMatches[$i] = $v."\n"; |
|
1670 | 1670 | } |
1671 | 1671 | $content = str_replace($addBreakMatches, '', $content); |
1672 | 1672 | if (strpos($content, $left) !== false) { |
@@ -1701,7 +1701,7 @@ discard block |
||
1701 | 1701 | if (strpos($content, $s) !== false) { |
1702 | 1702 | $content = str_replace($s, $v, $content); |
1703 | 1703 | } elseif ($this->debug) { |
1704 | - $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1704 | + $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1705 | 1705 | } |
1706 | 1706 | } |
1707 | 1707 | |
@@ -1777,8 +1777,8 @@ discard block |
||
1777 | 1777 | ); |
1778 | 1778 | if ($this->isBackend()) { |
1779 | 1779 | $this->event->alert( |
1780 | - 'An error occurred while loading. Please see the event log for more information.' . |
|
1781 | - '<p>' . $msg . '</p>' |
|
1780 | + 'An error occurred while loading. Please see the event log for more information.'. |
|
1781 | + '<p>'.$msg.'</p>' |
|
1782 | 1782 | ); |
1783 | 1783 | } |
1784 | 1784 | } else { |
@@ -1837,8 +1837,8 @@ discard block |
||
1837 | 1837 | ); |
1838 | 1838 | if ($this->isBackend()) { |
1839 | 1839 | $this->event->alert( |
1840 | - 'An error occurred while loading. Please see the event log for more information' . |
|
1841 | - '<p>' . $echo . $return . '</p>' |
|
1840 | + 'An error occurred while loading. Please see the event log for more information'. |
|
1841 | + '<p>'.$echo.$return.'</p>' |
|
1842 | 1842 | ); |
1843 | 1843 | } |
1844 | 1844 | } |
@@ -1846,7 +1846,7 @@ discard block |
||
1846 | 1846 | if (is_array($return) || is_object($return)) { |
1847 | 1847 | return $return; |
1848 | 1848 | } else { |
1849 | - return $echo . $return; |
|
1849 | + return $echo.$return; |
|
1850 | 1850 | } |
1851 | 1851 | } |
1852 | 1852 | |
@@ -1886,7 +1886,7 @@ discard block |
||
1886 | 1886 | if (strpos($content, $s) !== false) { |
1887 | 1887 | $content = str_replace($s, $value, $content); |
1888 | 1888 | } elseif ($this->debug) { |
1889 | - $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1889 | + $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1890 | 1890 | } |
1891 | 1891 | continue; |
1892 | 1892 | } |
@@ -1898,7 +1898,7 @@ discard block |
||
1898 | 1898 | if (strpos($content, $s) !== false) { |
1899 | 1899 | $content = str_replace($s, $value, $content); |
1900 | 1900 | } elseif ($this->debug) { |
1901 | - $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1901 | + $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1902 | 1902 | } |
1903 | 1903 | } |
1904 | 1904 | |
@@ -1991,7 +1991,7 @@ discard block |
||
1991 | 1991 | $code = str_replace("\t", ' ', $this->getPhpCompat()->htmlspecialchars($value)); |
1992 | 1992 | $piece = str_replace("\t", ' ', $this->getPhpCompat()->htmlspecialchars($piece)); |
1993 | 1993 | $print_r_params = str_replace("\t", ' ', |
1994 | - $this->getPhpCompat()->htmlspecialchars('$modx->event->params = ' . print_r($params, true))); |
|
1994 | + $this->getPhpCompat()->htmlspecialchars('$modx->event->params = '.print_r($params, true))); |
|
1995 | 1995 | $this->snippetsCode .= sprintf('<fieldset style="margin:1em;"><legend><b>%s</b>(%s)</legend><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">[[%s]]</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre></fieldset>', |
1996 | 1996 | $snippetObject['name'], $eventtime, $piece, $print_r_params, $code); |
1997 | 1997 | $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime); |
@@ -2257,7 +2257,7 @@ discard block |
||
2257 | 2257 | ->where('disabled', '=', 0) |
2258 | 2258 | ->get(); |
2259 | 2259 | if ($snippetModelCollection->count() > 1) { |
2260 | - exit('Error $modx->_getSnippetObject()' . $snip_name); |
|
2260 | + exit('Error $modx->_getSnippetObject()'.$snip_name); |
|
2261 | 2261 | } elseif ($snippetModelCollection->count() === 1) { |
2262 | 2262 | /** @var Models\SiteSnippet $snippetModel */ |
2263 | 2263 | $snippetModel = $snippetModelCollection->first(); |
@@ -2293,7 +2293,7 @@ discard block |
||
2293 | 2293 | */ |
2294 | 2294 | public function makeFriendlyURL($pre, $suff, $alias, $isfolder = 0, $id = 0) |
2295 | 2295 | { |
2296 | - return UrlProcessor::makeFriendlyURL($pre, $suff, $alias, (bool)$isfolder, (int)$id); |
|
2296 | + return UrlProcessor::makeFriendlyURL($pre, $suff, $alias, (bool) $isfolder, (int) $id); |
|
2297 | 2297 | } |
2298 | 2298 | |
2299 | 2299 | /** |
@@ -2306,7 +2306,7 @@ discard block |
||
2306 | 2306 | |
2307 | 2307 | public function sendStrictURI() |
2308 | 2308 | { |
2309 | - $url = UrlProcessor::strictURI((string)$this->q, (int)$this->documentIdentifier); |
|
2309 | + $url = UrlProcessor::strictURI((string) $this->q, (int) $this->documentIdentifier); |
|
2310 | 2310 | if ($url !== null) { |
2311 | 2311 | $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently'); |
2312 | 2312 | } |
@@ -2351,7 +2351,7 @@ discard block |
||
2351 | 2351 | $docgrp = implode(",", $docgrp); |
2352 | 2352 | } |
2353 | 2353 | // get document |
2354 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2354 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2355 | 2355 | $rs = $this->getDatabase()->select('sc.*', "{$tblsc} sc |
2356 | 2356 | LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1); |
2357 | 2357 | if ($this->getDatabase()->getRecordCount($rs) < 1) { |
@@ -2389,9 +2389,9 @@ discard block |
||
2389 | 2389 | if ($documentObject['template']) { |
2390 | 2390 | // load TVs and merge with document - Orig by Apodigm - Docvars |
2391 | 2391 | $rs = $this->getDatabase()->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", |
2392 | - $this->getDatabase()->getFullTableName("site_tmplvars") . " tv |
|
2393 | - INNER JOIN " . $this->getDatabase()->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
2394 | - LEFT JOIN " . $this->getDatabase()->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", |
|
2392 | + $this->getDatabase()->getFullTableName("site_tmplvars")." tv |
|
2393 | + INNER JOIN " . $this->getDatabase()->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id |
|
2394 | + LEFT JOIN " . $this->getDatabase()->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", |
|
2395 | 2395 | "tvtpl.templateid = '{$documentObject['template']}'"); |
2396 | 2396 | $tmplvars = array(); |
2397 | 2397 | while ($row = $this->getDatabase()->getRow($rs)) { |
@@ -2438,7 +2438,7 @@ discard block |
||
2438 | 2438 | $st = md5($source); |
2439 | 2439 | } |
2440 | 2440 | if ($this->dumpSnippets == 1) { |
2441 | - $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS " . ($i + 1) . "</b></legend><p>The following snippets (if any) were parsed during this pass.</p>"; |
|
2441 | + $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS ".($i + 1)."</b></legend><p>The following snippets (if any) were parsed during this pass.</p>"; |
|
2442 | 2442 | } |
2443 | 2443 | |
2444 | 2444 | // invoke OnParseDocument event |
@@ -2517,7 +2517,7 @@ discard block |
||
2517 | 2517 | // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path |
2518 | 2518 | if ($this->getConfig('use_alias_path') == 1) { |
2519 | 2519 | $virtualDir = UrlProcessor::getFacadeRoot()->virtualDir; |
2520 | - $alias = (strlen($virtualDir) > 0 ? $virtualDir . '/' : '') . $this->documentIdentifier; |
|
2520 | + $alias = (strlen($virtualDir) > 0 ? $virtualDir.'/' : '').$this->documentIdentifier; |
|
2521 | 2521 | if (isset(UrlProcessor::getFacadeRoot()->documentListing[$alias])) { |
2522 | 2522 | $this->documentIdentifier = UrlProcessor::getFacadeRoot()->documentListing[$alias]; |
2523 | 2523 | } else { |
@@ -2539,7 +2539,7 @@ discard block |
||
2539 | 2539 | |
2540 | 2540 | if (!$docId) { |
2541 | 2541 | $alias = $this->q; |
2542 | - if ((int)$this->getConfig('friendly_url_suffix') !== 0) { |
|
2542 | + if ((int) $this->getConfig('friendly_url_suffix') !== 0) { |
|
2543 | 2543 | $pos = strrpos($alias, $this->getConfig('friendly_url_suffix')); |
2544 | 2544 | |
2545 | 2545 | if ($pos !== false) { |
@@ -2580,7 +2580,7 @@ discard block |
||
2580 | 2580 | $docAlias = $this->getDatabase()->escape($this->documentIdentifier); |
2581 | 2581 | $rs = $this->getDatabase()->select('id', $this->getDatabase()->getFullTableName('site_content'), |
2582 | 2582 | "deleted=0 and alias='{$docAlias}'"); |
2583 | - $this->documentIdentifier = (int)$this->getDatabase()->getValue($rs); |
|
2583 | + $this->documentIdentifier = (int) $this->getDatabase()->getValue($rs); |
|
2584 | 2584 | } |
2585 | 2585 | } |
2586 | 2586 | $this->documentMethod = 'id'; |
@@ -2638,7 +2638,7 @@ discard block |
||
2638 | 2638 | $_REQUEST[$n] = $_GET[$n] = $v; |
2639 | 2639 | } |
2640 | 2640 | } |
2641 | - $_SERVER['PHP_SELF'] = MODX_BASE_URL . $qp['path']; |
|
2641 | + $_SERVER['PHP_SELF'] = MODX_BASE_URL.$qp['path']; |
|
2642 | 2642 | $this->q = $qp['path']; |
2643 | 2643 | |
2644 | 2644 | return $qp['path']; |
@@ -2792,15 +2792,15 @@ discard block |
||
2792 | 2792 | $aliasListing = get_by_key(UrlProcessor::getFacadeRoot()->aliasListing, $id, [], 'is_array'); |
2793 | 2793 | $tmp = get_by_key($aliasListing, 'parent'); |
2794 | 2794 | if ($this->getConfig('aliaslistingfolder')) { |
2795 | - $id = $tmp ?? (int)Models\SiteContent::findOrNew($id)->parent; |
|
2795 | + $id = $tmp ?? (int) Models\SiteContent::findOrNew($id)->parent; |
|
2796 | 2796 | } else { |
2797 | 2797 | $id = $tmp; |
2798 | 2798 | } |
2799 | 2799 | |
2800 | - if ((int)$id === 0) { |
|
2800 | + if ((int) $id === 0) { |
|
2801 | 2801 | break; |
2802 | 2802 | } |
2803 | - $parents[$thisid] = (int)$id; |
|
2803 | + $parents[$thisid] = (int) $id; |
|
2804 | 2804 | } |
2805 | 2805 | |
2806 | 2806 | return $parents; |
@@ -2844,15 +2844,15 @@ discard block |
||
2844 | 2844 | if ($this->getConfig('aliaslistingfolder') == 1) { |
2845 | 2845 | |
2846 | 2846 | $res = $this->getDatabase()->select("id,alias,isfolder,parent", |
2847 | - $this->getDatabase()->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'"); |
|
2847 | + $this->getDatabase()->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'"); |
|
2848 | 2848 | $idx = array(); |
2849 | 2849 | while ($row = $this->getDatabase()->getRow($res)) { |
2850 | 2850 | $pAlias = ''; |
2851 | 2851 | if (isset(UrlProcessor::getFacadeRoot()->aliasListing[$row['parent']])) { |
2852 | - $pAlias .= !empty(UrlProcessor::getFacadeRoot()->aliasListing[$row['parent']]['path']) ? UrlProcessor::getFacadeRoot()->aliasListing[$row['parent']]['path'] . '/' : ''; |
|
2853 | - $pAlias .= !empty(UrlProcessor::getFacadeRoot()->aliasListing[$row['parent']]['alias']) ? UrlProcessor::getFacadeRoot()->aliasListing[$row['parent']]['alias'] . '/' : ''; |
|
2852 | + $pAlias .= !empty(UrlProcessor::getFacadeRoot()->aliasListing[$row['parent']]['path']) ? UrlProcessor::getFacadeRoot()->aliasListing[$row['parent']]['path'].'/' : ''; |
|
2853 | + $pAlias .= !empty(UrlProcessor::getFacadeRoot()->aliasListing[$row['parent']]['alias']) ? UrlProcessor::getFacadeRoot()->aliasListing[$row['parent']]['alias'].'/' : ''; |
|
2854 | 2854 | }; |
2855 | - $children[$pAlias . $row['alias']] = $row['id']; |
|
2855 | + $children[$pAlias.$row['alias']] = $row['id']; |
|
2856 | 2856 | if ($row['isfolder'] == 1) { |
2857 | 2857 | $idx[] = $row['id']; |
2858 | 2858 | } |
@@ -2885,7 +2885,7 @@ discard block |
||
2885 | 2885 | $depth--; |
2886 | 2886 | |
2887 | 2887 | foreach ($documentMap_cache[$id] as $childId) { |
2888 | - $pkey = (strlen(UrlProcessor::getFacadeRoot()->aliasListing[$childId]['path']) ? "{UrlProcessor::getFacadeRoot()->aliasListing[$childId]['path']}/" : '') . UrlProcessor::getFacadeRoot()->aliasListing[$childId]['alias']; |
|
2888 | + $pkey = (strlen(UrlProcessor::getFacadeRoot()->aliasListing[$childId]['path']) ? "{UrlProcessor::getFacadeRoot()->aliasListing[$childId]['path']}/" : '').UrlProcessor::getFacadeRoot()->aliasListing[$childId]['alias']; |
|
2889 | 2889 | if (!strlen($pkey)) { |
2890 | 2890 | $pkey = "{$childId}"; |
2891 | 2891 | } |
@@ -2913,15 +2913,15 @@ discard block |
||
2913 | 2913 | { |
2914 | 2914 | global $modx_manager_charset, $modx_lang_attribute, $modx_textdir, $lastInstallTime; |
2915 | 2915 | |
2916 | - if(empty($modx_manager_charset)) { |
|
2916 | + if (empty($modx_manager_charset)) { |
|
2917 | 2917 | $modx_manager_charset = $this->getConfig('modx_charset'); |
2918 | 2918 | } |
2919 | 2919 | |
2920 | - if(empty($modx_lang_attribute)) { |
|
2920 | + if (empty($modx_lang_attribute)) { |
|
2921 | 2921 | $modx_lang_attribute = $this->getConfig('lang_code'); |
2922 | 2922 | } |
2923 | 2923 | |
2924 | - if(empty($modx_textdir)) { |
|
2924 | + if (empty($modx_textdir)) { |
|
2925 | 2925 | $modx_textdir = $this->getConfig('manager_direction'); |
2926 | 2926 | } |
2927 | 2927 | $textdir = $modx_textdir === 'rtl' ? 'rtl' : 'ltr'; |
@@ -2937,7 +2937,7 @@ discard block |
||
2937 | 2937 | $fnc = 'history.back(-1);'; |
2938 | 2938 | break; |
2939 | 2939 | default: |
2940 | - $fnc = "window.location.href='" . addslashes($url) . "';"; |
|
2940 | + $fnc = "window.location.href='".addslashes($url)."';"; |
|
2941 | 2941 | } |
2942 | 2942 | |
2943 | 2943 | $style = ''; |
@@ -2946,9 +2946,9 @@ discard block |
||
2946 | 2946 | $lastInstallTime = time(); |
2947 | 2947 | } |
2948 | 2948 | |
2949 | - $path = 'media/style/' . $this->getConfig('manager_theme') . '/'; |
|
2950 | - $css = file_exists(MODX_MANAGER_PATH . $path . '/css/styles.min.css') ? '/css/styles.min.css' : 'style.css'; |
|
2951 | - $style = '<link rel="stylesheet" type="text/css" href="' . MODX_MANAGER_URL . $path . $css . '?v=' . $lastInstallTime . '"/>'; |
|
2949 | + $path = 'media/style/'.$this->getConfig('manager_theme').'/'; |
|
2950 | + $css = file_exists(MODX_MANAGER_PATH.$path.'/css/styles.min.css') ? '/css/styles.min.css' : 'style.css'; |
|
2951 | + $style = '<link rel="stylesheet" type="text/css" href="'.MODX_MANAGER_URL.$path.$css.'?v='.$lastInstallTime.'"/>'; |
|
2952 | 2952 | } |
2953 | 2953 | |
2954 | 2954 | ob_get_clean(); |
@@ -2986,17 +2986,17 @@ discard block |
||
2986 | 2986 | $state = 0; |
2987 | 2987 | $pms = $_SESSION['mgrPermissions']; |
2988 | 2988 | if ($pms) { |
2989 | - $state = (isset($pms[$pm]) && (bool)$pms[$pm] === true); |
|
2989 | + $state = (isset($pms[$pm]) && (bool) $pms[$pm] === true); |
|
2990 | 2990 | } |
2991 | 2991 | |
2992 | - return (int)$state; |
|
2992 | + return (int) $state; |
|
2993 | 2993 | } |
2994 | 2994 | |
2995 | 2995 | /** |
2996 | 2996 | * @param array $permissions |
2997 | 2997 | * @return bool |
2998 | 2998 | */ |
2999 | - public function hasAnyPermissions(array $permissions) { |
|
2999 | + public function hasAnyPermissions(array $permissions){ |
|
3000 | 3000 | foreach ($permissions as $p) { |
3001 | 3001 | if ($this->hasPermission($p)) { |
3002 | 3002 | return true; |
@@ -3016,8 +3016,8 @@ discard block |
||
3016 | 3016 | */ |
3017 | 3017 | public function elementIsLocked($type, $id, $includeThisUser = false) |
3018 | 3018 | { |
3019 | - $id = (int)$id; |
|
3020 | - $type = (int)$type; |
|
3019 | + $id = (int) $id; |
|
3020 | + $type = (int) $type; |
|
3021 | 3021 | if (!$type || !$id) { |
3022 | 3022 | return null; |
3023 | 3023 | } |
@@ -3067,7 +3067,7 @@ discard block |
||
3067 | 3067 | return $lockedElements; |
3068 | 3068 | } |
3069 | 3069 | |
3070 | - $type = (int)$type; |
|
3070 | + $type = (int) $type; |
|
3071 | 3071 | if (isset($lockedElements[$type])) { |
3072 | 3072 | return $lockedElements[$type]; |
3073 | 3073 | } else { |
@@ -3085,7 +3085,7 @@ discard block |
||
3085 | 3085 | $this->cleanupExpiredLocks(); |
3086 | 3086 | |
3087 | 3087 | $rs = $this->getDatabase()->select('sid,internalKey,elementType,elementId,lasthit,username', |
3088 | - $this->getDatabase()->getFullTableName('active_user_locks') . " ul |
|
3088 | + $this->getDatabase()->getFullTableName('active_user_locks')." ul |
|
3089 | 3089 | LEFT JOIN {$this->getDatabase()->getFullTableName('manager_users')} mu on ul.internalKey = mu.id"); |
3090 | 3090 | while ($row = $this->getDatabase()->getRow($rs)) { |
3091 | 3091 | $this->lockedElements[$row['elementType']][$row['elementId']] = array( |
@@ -3108,7 +3108,7 @@ discard block |
||
3108 | 3108 | public function cleanupExpiredLocks() |
3109 | 3109 | { |
3110 | 3110 | // Clean-up active_user_sessions first |
3111 | - $timeout = (int)$this->getConfig('session_timeout') < 2 ? 120 : $this->getConfig('session_timeout') * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum |
|
3111 | + $timeout = (int) $this->getConfig('session_timeout') < 2 ? 120 : $this->getConfig('session_timeout') * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum |
|
3112 | 3112 | $validSessionTimeLimit = $this->time - $timeout; |
3113 | 3113 | $this->getDatabase()->delete($this->getDatabase()->getFullTableName('active_user_sessions'), |
3114 | 3114 | "lasthit < {$validSessionTimeLimit}"); |
@@ -3123,7 +3123,7 @@ discard block |
||
3123 | 3123 | foreach ($rs as $row) { |
3124 | 3124 | $userSids[] = $row['sid']; |
3125 | 3125 | } |
3126 | - $userSids = "'" . implode("','", $userSids) . "'"; |
|
3126 | + $userSids = "'".implode("','", $userSids)."'"; |
|
3127 | 3127 | $this->getDatabase()->delete($this->getDatabase()->getFullTableName('active_user_locks'), |
3128 | 3128 | "sid NOT IN({$userSids})"); |
3129 | 3129 | } else { |
@@ -3211,8 +3211,8 @@ discard block |
||
3211 | 3211 | public function lockElement($type, $id) |
3212 | 3212 | { |
3213 | 3213 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3214 | - $type = (int)$type; |
|
3215 | - $id = (int)$id; |
|
3214 | + $type = (int) $type; |
|
3215 | + $id = (int) $id; |
|
3216 | 3216 | if (!$type || !$id || !$userId) { |
3217 | 3217 | return false; |
3218 | 3218 | } |
@@ -3234,8 +3234,8 @@ discard block |
||
3234 | 3234 | public function unlockElement($type, $id, $includeAllUsers = false) |
3235 | 3235 | { |
3236 | 3236 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3237 | - $type = (int)$type; |
|
3238 | - $id = (int)$id; |
|
3237 | + $type = (int) $type; |
|
3238 | + $id = (int) $id; |
|
3239 | 3239 | if (!$type || !$id) { |
3240 | 3240 | return false; |
3241 | 3241 | } |
@@ -3311,8 +3311,8 @@ discard block |
||
3311 | 3311 | } |
3312 | 3312 | |
3313 | 3313 | $usertype = $this->isFrontend() ? 1 : 0; |
3314 | - $evtid = (int)$evtid; |
|
3315 | - $type = (int)$type; |
|
3314 | + $evtid = (int) $evtid; |
|
3315 | + $type = (int) $type; |
|
3316 | 3316 | |
3317 | 3317 | // Types: 1 = information, 2 = warning, 3 = error |
3318 | 3318 | if ($type < 1) { |
@@ -3334,8 +3334,8 @@ discard block |
||
3334 | 3334 | if ($this->getConfig('send_errormail', '0') != '0') { |
3335 | 3335 | if ($this->getConfig('send_errormail') <= $type) { |
3336 | 3336 | $this->sendmail(array( |
3337 | - 'subject' => 'Evolution CMS System Error on ' . $this->getConfig('site_name'), |
|
3338 | - 'body' => 'Source: ' . $source . ' - The details of the error could be seen in the Evolution CMS system events log.', |
|
3337 | + 'subject' => 'Evolution CMS System Error on '.$this->getConfig('site_name'), |
|
3338 | + 'body' => 'Source: '.$source.' - The details of the error could be seen in the Evolution CMS system events log.', |
|
3339 | 3339 | 'type' => 'text' |
3340 | 3340 | )); |
3341 | 3341 | } |
@@ -3384,7 +3384,7 @@ discard block |
||
3384 | 3384 | $p['fromname'] = $userinfo['username']; |
3385 | 3385 | } |
3386 | 3386 | if ($msg === '' && !isset($p['body'])) { |
3387 | - $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER']; |
|
3387 | + $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER']; |
|
3388 | 3388 | } elseif (is_string($msg) && 0 < strlen($msg)) { |
3389 | 3389 | $p['body'] = $msg; |
3390 | 3390 | } |
@@ -3425,8 +3425,8 @@ discard block |
||
3425 | 3425 | $files = array(); |
3426 | 3426 | } |
3427 | 3427 | foreach ($files as $f) { |
3428 | - if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) { |
|
3429 | - $this->getMail()->AddAttachment(MODX_BASE_PATH . $f); |
|
3428 | + if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) { |
|
3429 | + $this->getMail()->AddAttachment(MODX_BASE_PATH.$f); |
|
3430 | 3430 | } |
3431 | 3431 | } |
3432 | 3432 | |
@@ -3490,7 +3490,7 @@ discard block |
||
3490 | 3490 | $sort = 'menuindex', |
3491 | 3491 | $dir = 'ASC', |
3492 | 3492 | $fields = 'id, pagetitle, description, parent, alias, menutitle' |
3493 | - ) { |
|
3493 | + ){ |
|
3494 | 3494 | |
3495 | 3495 | $cacheKey = md5(print_r(func_get_args(), true)); |
3496 | 3496 | if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) { |
@@ -3500,14 +3500,14 @@ discard block |
||
3500 | 3500 | $tblsc = $this->getDatabase()->getFullTableName("site_content"); |
3501 | 3501 | $tbldg = $this->getDatabase()->getFullTableName("document_groups"); |
3502 | 3502 | // modify field names to use sc. table reference |
3503 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3504 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3503 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3504 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3505 | 3505 | // get document groups for current user |
3506 | 3506 | if ($docgrp = $this->getUserDocGroups()) { |
3507 | 3507 | $docgrp = implode(",", $docgrp); |
3508 | 3508 | } |
3509 | 3509 | // build query |
3510 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3510 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3511 | 3511 | $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc |
3512 | 3512 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", |
3513 | 3513 | "{$sort} {$dir}"); |
@@ -3533,7 +3533,7 @@ discard block |
||
3533 | 3533 | $sort = 'menuindex', |
3534 | 3534 | $dir = 'ASC', |
3535 | 3535 | $fields = 'id, pagetitle, description, parent, alias, menutitle' |
3536 | - ) { |
|
3536 | + ){ |
|
3537 | 3537 | $cacheKey = md5(print_r(func_get_args(), true)); |
3538 | 3538 | if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) { |
3539 | 3539 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
@@ -3543,14 +3543,14 @@ discard block |
||
3543 | 3543 | $tbldg = $this->getDatabase()->getFullTableName("document_groups"); |
3544 | 3544 | |
3545 | 3545 | // modify field names to use sc. table reference |
3546 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3547 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3546 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3547 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3548 | 3548 | // get document groups for current user |
3549 | 3549 | if ($docgrp = $this->getUserDocGroups()) { |
3550 | 3550 | $docgrp = implode(",", $docgrp); |
3551 | 3551 | } |
3552 | 3552 | // build query |
3553 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3553 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3554 | 3554 | $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc |
3555 | 3555 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", |
3556 | 3556 | "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
@@ -3587,23 +3587,23 @@ discard block |
||
3587 | 3587 | $sort = 'menuindex', |
3588 | 3588 | $dir = 'ASC', |
3589 | 3589 | $limit = '' |
3590 | - ) { |
|
3590 | + ){ |
|
3591 | 3591 | |
3592 | 3592 | $cacheKey = md5(print_r(func_get_args(), true)); |
3593 | 3593 | if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) { |
3594 | 3594 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
3595 | 3595 | } |
3596 | 3596 | |
3597 | - $published = ($published !== 'all') ? 'AND sc.published = ' . $published : ''; |
|
3598 | - $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : ''; |
|
3597 | + $published = ($published !== 'all') ? 'AND sc.published = '.$published : ''; |
|
3598 | + $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : ''; |
|
3599 | 3599 | |
3600 | 3600 | if ($where != '') { |
3601 | - $where = 'AND ' . $where; |
|
3601 | + $where = 'AND '.$where; |
|
3602 | 3602 | } |
3603 | 3603 | |
3604 | 3604 | // modify field names to use sc. table reference |
3605 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3606 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3605 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3606 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3607 | 3607 | |
3608 | 3608 | // get document groups for current user |
3609 | 3609 | if ($docgrp = $this->getUserDocGroups()) { |
@@ -3611,7 +3611,7 @@ discard block |
||
3611 | 3611 | } |
3612 | 3612 | |
3613 | 3613 | // build query |
3614 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3614 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3615 | 3615 | |
3616 | 3616 | $tblsc = $this->getDatabase()->getFullTableName('site_content'); |
3617 | 3617 | $tbldg = $this->getDatabase()->getFullTableName('document_groups'); |
@@ -3654,7 +3654,7 @@ discard block |
||
3654 | 3654 | $sort = 'menuindex', |
3655 | 3655 | $dir = 'ASC', |
3656 | 3656 | $limit = '' |
3657 | - ) { |
|
3657 | + ){ |
|
3658 | 3658 | |
3659 | 3659 | $cacheKey = md5(print_r(func_get_args(), true)); |
3660 | 3660 | if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) { |
@@ -3674,10 +3674,10 @@ discard block |
||
3674 | 3674 | return false; |
3675 | 3675 | } else { |
3676 | 3676 | // modify field names to use sc. table reference |
3677 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3678 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3677 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3678 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3679 | 3679 | if ($where != '') { |
3680 | - $where = 'AND ' . $where; |
|
3680 | + $where = 'AND '.$where; |
|
3681 | 3681 | } |
3682 | 3682 | |
3683 | 3683 | $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : ''; |
@@ -3688,14 +3688,14 @@ discard block |
||
3688 | 3688 | $docgrp = implode(',', $docgrp); |
3689 | 3689 | } |
3690 | 3690 | |
3691 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3691 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3692 | 3692 | |
3693 | 3693 | $tblsc = $this->getDatabase()->getFullTableName('site_content'); |
3694 | 3694 | $tbldg = $this->getDatabase()->getFullTableName('document_groups'); |
3695 | 3695 | |
3696 | 3696 | $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc |
3697 | - LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',', |
|
3698 | - $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", |
|
3697 | + LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (".implode(',', |
|
3698 | + $ids).") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", |
|
3699 | 3699 | ($sort ? "{$sort} {$dir}" : ""), $limit); |
3700 | 3700 | |
3701 | 3701 | $resourceArray = $this->getDatabase()->makeArray($result); |
@@ -3801,12 +3801,12 @@ discard block |
||
3801 | 3801 | $tbldg = $this->getDatabase()->getFullTableName("document_groups"); |
3802 | 3802 | $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : ""; |
3803 | 3803 | // modify field names to use sc. table reference |
3804 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3804 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3805 | 3805 | // get document groups for current user |
3806 | 3806 | if ($docgrp = $this->getUserDocGroups()) { |
3807 | 3807 | $docgrp = implode(",", $docgrp); |
3808 | 3808 | } |
3809 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3809 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3810 | 3810 | $result = $this->getDatabase()->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", |
3811 | 3811 | "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1); |
3812 | 3812 | $pageInfo = $this->getDatabase()->getRow($result); |
@@ -3859,7 +3859,7 @@ discard block |
||
3859 | 3859 | if ($this->currentSnippet) { |
3860 | 3860 | $tbl = $this->getDatabase()->getFullTableName("site_snippets"); |
3861 | 3861 | $rs = $this->getDatabase()->select('id', $tbl, |
3862 | - "name='" . $this->getDatabase()->escape($this->currentSnippet) . "'", '', 1); |
|
3862 | + "name='".$this->getDatabase()->escape($this->currentSnippet)."'", '', 1); |
|
3863 | 3863 | if ($snippetId = $this->getDatabase()->getValue($rs)) { |
3864 | 3864 | return $snippetId; |
3865 | 3865 | } |
@@ -3899,10 +3899,10 @@ discard block |
||
3899 | 3899 | $sync->emptyCache(); |
3900 | 3900 | } elseif (preg_match('@^[1-9]\d*$@', $type)) { |
3901 | 3901 | $key = ($this->getConfig('cache_type') == 2) ? $this->makePageCacheKey($type) : $type; |
3902 | - $file_name = "docid_" . $key . "_*.pageCache.php"; |
|
3903 | - $cache_path = $cache_dir . $file_name; |
|
3902 | + $file_name = "docid_".$key."_*.pageCache.php"; |
|
3903 | + $cache_path = $cache_dir.$file_name; |
|
3904 | 3904 | $files = glob($cache_path); |
3905 | - $files[] = $cache_dir . "docid_" . $key . ".pageCache.php"; |
|
3905 | + $files[] = $cache_dir."docid_".$key.".pageCache.php"; |
|
3906 | 3906 | foreach ($files as $file) { |
3907 | 3907 | if (!is_file($file)) { |
3908 | 3908 | continue; |
@@ -3910,7 +3910,7 @@ discard block |
||
3910 | 3910 | unlink($file); |
3911 | 3911 | } |
3912 | 3912 | } else { |
3913 | - $files = glob($cache_dir . '*'); |
|
3913 | + $files = glob($cache_dir.'*'); |
|
3914 | 3914 | foreach ($files as $file) { |
3915 | 3915 | $name = basename($file); |
3916 | 3916 | if (strpos($name, '.pageCache.php') === false) { |
@@ -3929,7 +3929,7 @@ discard block |
||
3929 | 3929 | */ |
3930 | 3930 | public function makeUrl($id, $alias = '', $args = '', $scheme = '') |
3931 | 3931 | { |
3932 | - return UrlProcessor::makeUrl((int)$id, $alias, $args, $scheme); |
|
3932 | + return UrlProcessor::makeUrl((int) $id, $alias, $args, $scheme); |
|
3933 | 3933 | } |
3934 | 3934 | |
3935 | 3935 | /** |
@@ -3951,7 +3951,7 @@ discard block |
||
3951 | 3951 | { |
3952 | 3952 | if (empty($this->version) || !is_array($this->version)) { |
3953 | 3953 | //include for compatibility modx version < 1.0.10 |
3954 | - $version = include EVO_CORE_PATH . 'factory/version.php'; |
|
3954 | + $version = include EVO_CORE_PATH.'factory/version.php'; |
|
3955 | 3955 | $this->version = $version; |
3956 | 3956 | $this->version['new_version'] = $this->getConfig('newversiontext', ''); |
3957 | 3957 | } |
@@ -3970,12 +3970,12 @@ discard block |
||
3970 | 3970 | { |
3971 | 3971 | if (isset ($this->snippetCache[$snippetName])) { |
3972 | 3972 | $snippet = $this->snippetCache[$snippetName]; |
3973 | - $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
|
3973 | + $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : ''; |
|
3974 | 3974 | } else { // not in cache so let's check the db |
3975 | 3975 | $snippetObject = $this->_getSnippetFromDatabase($snippetName); |
3976 | 3976 | |
3977 | 3977 | $snippet = $this->snippetCache[$snippetName] = $snippetObject['content'] === null ?? "return false;"; |
3978 | - $properties = $this->snippetCache[$snippetName . "Props"] = $snippetObject['properties']; |
|
3978 | + $properties = $this->snippetCache[$snippetName."Props"] = $snippetObject['properties']; |
|
3979 | 3979 | } |
3980 | 3980 | // load default params/properties |
3981 | 3981 | $parameters = $this->parseProperties($properties, $snippetName, 'snippet'); |
@@ -4025,8 +4025,8 @@ discard block |
||
4025 | 4025 | */ |
4026 | 4026 | public function isChunkProcessor($processor) |
4027 | 4027 | { |
4028 | - $value = (string)$this->getConfig('chunk_processor'); |
|
4029 | - if(is_object($processor)) { |
|
4028 | + $value = (string) $this->getConfig('chunk_processor'); |
|
4029 | + if (is_object($processor)) { |
|
4030 | 4030 | $processor = get_class($processor); |
4031 | 4031 | } |
4032 | 4032 | return is_scalar($processor) && mb_strtolower($value) === mb_strtolower($processor) && class_exists($processor, false); |
@@ -4092,8 +4092,8 @@ discard block |
||
4092 | 4092 | } |
4093 | 4093 | if (strpos($tpl, $s) !== false) { |
4094 | 4094 | $tpl = str_replace($s, $value, $tpl); |
4095 | - } elseif($this->debug) { |
|
4096 | - $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
4095 | + } elseif ($this->debug) { |
|
4096 | + $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
4097 | 4097 | } |
4098 | 4098 | } |
4099 | 4099 | |
@@ -4123,8 +4123,7 @@ discard block |
||
4123 | 4123 | } |
4124 | 4124 | |
4125 | 4125 | return $prefix === '[+' && $suffix === '+]' && $this->isChunkProcessor('DLTemplate') ? |
4126 | - \DLTemplate::getInstance($this)->parseChunk($chunkName, $chunkArr) : |
|
4127 | - $this->parseText($this->getChunk($chunkName), $chunkArr, $prefix, $suffix); |
|
4126 | + \DLTemplate::getInstance($this)->parseChunk($chunkName, $chunkArr) : $this->parseText($this->getChunk($chunkName), $chunkArr, $prefix, $suffix); |
|
4128 | 4127 | } |
4129 | 4128 | |
4130 | 4129 | /** |
@@ -4145,7 +4144,7 @@ discard block |
||
4145 | 4144 | case 'CODE': |
4146 | 4145 | break; |
4147 | 4146 | case 'FILE': |
4148 | - $template = file_get_contents(MODX_BASE_PATH . $template); |
|
4147 | + $template = file_get_contents(MODX_BASE_PATH.$template); |
|
4149 | 4148 | break; |
4150 | 4149 | case 'CHUNK': |
4151 | 4150 | $template = $this->getChunk($template); |
@@ -4178,7 +4177,7 @@ discard block |
||
4178 | 4177 | if ($mode !== 'formatOnly' && empty($timestamp)) { |
4179 | 4178 | return '-'; |
4180 | 4179 | } |
4181 | - $timestamp = (int)$timestamp; |
|
4180 | + $timestamp = (int) $timestamp; |
|
4182 | 4181 | |
4183 | 4182 | switch ($this->getConfig('datetime_format')) { |
4184 | 4183 | case 'YYYY/mm/dd': |
@@ -4198,7 +4197,7 @@ discard block |
||
4198 | 4197 | } |
4199 | 4198 | |
4200 | 4199 | if (empty($mode)) { |
4201 | - $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp); |
|
4200 | + $strTime = strftime($dateFormat." %H:%M:%S", $timestamp); |
|
4202 | 4201 | } elseif ($mode == 'dateOnly') { |
4203 | 4202 | $strTime = strftime($dateFormat, $timestamp); |
4204 | 4203 | } elseif ($mode == 'formatOnly') { |
@@ -4252,7 +4251,7 @@ discard block |
||
4252 | 4251 | $S = 0; |
4253 | 4252 | } |
4254 | 4253 | $timeStamp = mktime($H, $M, $S, $m, $d, $Y); |
4255 | - $timeStamp = (int)$timeStamp; |
|
4254 | + $timeStamp = (int) $timeStamp; |
|
4256 | 4255 | return $timeStamp; |
4257 | 4256 | } |
4258 | 4257 | |
@@ -4294,7 +4293,7 @@ discard block |
||
4294 | 4293 | if ($v === 'value') { |
4295 | 4294 | unset($_[$i]); |
4296 | 4295 | } else { |
4297 | - $_[$i] = 'tv.' . $v; |
|
4296 | + $_[$i] = 'tv.'.$v; |
|
4298 | 4297 | } |
4299 | 4298 | } |
4300 | 4299 | $fields = implode(',', $_); |
@@ -4303,12 +4302,12 @@ discard block |
||
4303 | 4302 | } |
4304 | 4303 | |
4305 | 4304 | if ($tvsort != '') { |
4306 | - $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4305 | + $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4307 | 4306 | } |
4308 | 4307 | if ($tvidnames == "*") { |
4309 | 4308 | $query = "tv.id<>0"; |
4310 | 4309 | } else { |
4311 | - $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')"; |
|
4310 | + $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')"; |
|
4312 | 4311 | } |
4313 | 4312 | |
4314 | 4313 | $this->getUserDocGroups(); |
@@ -4320,10 +4319,10 @@ discard block |
||
4320 | 4319 | $rs = $this->getDatabase()->select( |
4321 | 4320 | "{$fields}, IF(tvc.value!='',tvc.value,tv.default_text) as value ", |
4322 | 4321 | |
4323 | - $this->getDatabase()->getFullTableName("site_tmplvars") . |
|
4324 | - " tv INNER JOIN " . $this->getDatabase()->getFullTableName("site_tmplvar_templates") . |
|
4325 | - " tvtpl ON tvtpl.tmplvarid = tv.id LEFT JOIN " . |
|
4326 | - $this->getDatabase()->getFullTableName("site_tmplvar_contentvalues") . |
|
4322 | + $this->getDatabase()->getFullTableName("site_tmplvars"). |
|
4323 | + " tv INNER JOIN ".$this->getDatabase()->getFullTableName("site_tmplvar_templates"). |
|
4324 | + " tvtpl ON tvtpl.tmplvarid = tv.id LEFT JOIN ". |
|
4325 | + $this->getDatabase()->getFullTableName("site_tmplvar_contentvalues"). |
|
4327 | 4326 | " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid='{$docid}'", |
4328 | 4327 | |
4329 | 4328 | "{$query} AND tvtpl.templateid = '{$doc['template']}'", |
@@ -4461,7 +4460,7 @@ discard block |
||
4461 | 4460 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
4462 | 4461 | } |
4463 | 4462 | |
4464 | - if (($idnames !== '*' && !is_array($idnames)) || empty($idnames) ) { |
|
4463 | + if (($idnames !== '*' && !is_array($idnames)) || empty($idnames)) { |
|
4465 | 4464 | return false; |
4466 | 4465 | } else { |
4467 | 4466 | |
@@ -4480,36 +4479,36 @@ discard block |
||
4480 | 4479 | |
4481 | 4480 | // get user defined template variables |
4482 | 4481 | if (!empty($fields) && (is_scalar($fields) || \is_array($fields))) { |
4483 | - if(\is_scalar($fields)) { |
|
4482 | + if (\is_scalar($fields)) { |
|
4484 | 4483 | $fields = explode(',', $fields); |
4485 | 4484 | } |
4486 | - $fields = array_filter(array_map('trim', $fields), function($value) { |
|
4485 | + $fields = array_filter(array_map('trim', $fields), function($value){ |
|
4487 | 4486 | return $value !== 'value'; |
4488 | 4487 | }); |
4489 | - $fields = 'tv.' . implode(',tv.', $fields); |
|
4488 | + $fields = 'tv.'.implode(',tv.', $fields); |
|
4490 | 4489 | } else { |
4491 | 4490 | $fields = 'tv.*'; |
4492 | 4491 | } |
4493 | - $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4492 | + $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4494 | 4493 | |
4495 | 4494 | if ($idnames === '*') { |
4496 | 4495 | $query = 'tv.id<>0'; |
4497 | 4496 | } else { |
4498 | - $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')"; |
|
4497 | + $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')"; |
|
4499 | 4498 | } |
4500 | 4499 | |
4501 | 4500 | $rs = $this->getDatabase()->select( |
4502 | 4501 | "{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", |
4503 | - $this->getDatabase()->getFullTableName('site_tmplvars') . ' tv ' . |
|
4504 | - 'INNER JOIN ' . $this->getDatabase()->getFullTableName('site_tmplvar_templates') . ' tvtpl ON tvtpl.tmplvarid = tv.id ' . |
|
4505 | - 'LEFT JOIN ' . $this->getDatabase()->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid = tv.id AND tvc.contentid = '" . $docid . "'", |
|
4506 | - $query . " AND tvtpl.templateid = '" . $docRow['template'] . "'", |
|
4507 | - ($sort ? ($sort . ' ' . $dir) : '') |
|
4502 | + $this->getDatabase()->getFullTableName('site_tmplvars').' tv '. |
|
4503 | + 'INNER JOIN '.$this->getDatabase()->getFullTableName('site_tmplvar_templates').' tvtpl ON tvtpl.tmplvarid = tv.id '. |
|
4504 | + 'LEFT JOIN '.$this->getDatabase()->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid = tv.id AND tvc.contentid = '".$docid."'", |
|
4505 | + $query." AND tvtpl.templateid = '".$docRow['template']."'", |
|
4506 | + ($sort ? ($sort.' '.$dir) : '') |
|
4508 | 4507 | ); |
4509 | 4508 | $result = $this->getDatabase()->makeArray($rs); |
4510 | 4509 | |
4511 | 4510 | // get default/built-in template variables |
4512 | - if(is_array($docRow)){ |
|
4511 | + if (is_array($docRow)) { |
|
4513 | 4512 | ksort($docRow); |
4514 | 4513 | |
4515 | 4514 | foreach ($docRow as $name => $value) { |
@@ -4544,13 +4543,13 @@ discard block |
||
4544 | 4543 | */ |
4545 | 4544 | public function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '') |
4546 | 4545 | { |
4547 | - if (is_array($idnames) && empty($idnames) ) { |
|
4546 | + if (is_array($idnames) && empty($idnames)) { |
|
4548 | 4547 | return false; |
4549 | 4548 | } else { |
4550 | 4549 | $output = array(); |
4551 | 4550 | $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames); |
4552 | 4551 | |
4553 | - $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier; |
|
4552 | + $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier; |
|
4554 | 4553 | // remove sort for speed |
4555 | 4554 | $result = $this->getTemplateVars($vars, '*', $docid, $published, '', ''); |
4556 | 4555 | |
@@ -4688,8 +4687,8 @@ discard block |
||
4688 | 4687 | $out = false; |
4689 | 4688 | |
4690 | 4689 | if (!empty($context)) { |
4691 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4692 | - $out = $_SESSION[$context . 'InternalKey']; |
|
4690 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4691 | + $out = $_SESSION[$context.'InternalKey']; |
|
4693 | 4692 | } |
4694 | 4693 | } else { |
4695 | 4694 | switch (true) { |
@@ -4717,8 +4716,8 @@ discard block |
||
4717 | 4716 | $out = false; |
4718 | 4717 | |
4719 | 4718 | if (!empty($context)) { |
4720 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4721 | - $out = $_SESSION[$context . 'Shortname']; |
|
4719 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4720 | + $out = $_SESSION[$context.'Shortname']; |
|
4722 | 4721 | } |
4723 | 4722 | } else { |
4724 | 4723 | switch (true) { |
@@ -4768,8 +4767,8 @@ discard block |
||
4768 | 4767 | return $this->tmpCache[__FUNCTION__][$uid]; |
4769 | 4768 | } |
4770 | 4769 | |
4771 | - $from = $this->getDatabase()->getFullTableName('manager_users') . ' mu INNER JOIN ' . |
|
4772 | - $this->getDatabase()->getFullTableName('user_attributes'). ' mua ON mua.internalkey=mu.id'; |
|
4770 | + $from = $this->getDatabase()->getFullTableName('manager_users').' mu INNER JOIN '. |
|
4771 | + $this->getDatabase()->getFullTableName('user_attributes').' mua ON mua.internalkey=mu.id'; |
|
4773 | 4772 | $where = sprintf("mu.id='%s'", $this->getDatabase()->escape($uid)); |
4774 | 4773 | $rs = $this->getDatabase()->select('mu.username, mu.password, mua.*', $from, $where, '', 1); |
4775 | 4774 | |
@@ -4797,8 +4796,8 @@ discard block |
||
4797 | 4796 | { |
4798 | 4797 | $rs = $this->getDatabase()->select( |
4799 | 4798 | 'wu.username, wu.password, wua.*', |
4800 | - $this->getDatabase()->getFullTableName("web_users") . ' wu ' . |
|
4801 | - 'INNER JOIN ' . $this->getDatabase()->getFullTableName("web_user_attributes") . ' wua ' . |
|
4799 | + $this->getDatabase()->getFullTableName("web_users").' wu '. |
|
4800 | + 'INNER JOIN '.$this->getDatabase()->getFullTableName("web_user_attributes").' wua '. |
|
4802 | 4801 | 'ON wua.internalkey=wu.id', |
4803 | 4802 | "wu.id='{$uid}'" |
4804 | 4803 | ); |
@@ -4840,13 +4839,13 @@ discard block |
||
4840 | 4839 | $ds = $this->getDatabase()->select( |
4841 | 4840 | 'name', |
4842 | 4841 | $this->getDatabase()->getFullTableName("documentgroup_names"), |
4843 | - "id IN (" . implode(",", $dg) . ")" |
|
4842 | + "id IN (".implode(",", $dg).")" |
|
4844 | 4843 | ); |
4845 | 4844 | while ($row = $this->getDatabase()->getRow($ds)) { |
4846 | 4845 | $dgn[] = $row['name']; |
4847 | 4846 | } |
4848 | 4847 | // cache docgroup names to session |
4849 | - $_SESSION[$this->getContext() . 'DocgrpNames'] = $dgn; |
|
4848 | + $_SESSION[$this->getContext().'DocgrpNames'] = $dgn; |
|
4850 | 4849 | return $dgn; |
4851 | 4850 | } |
4852 | 4851 | } |
@@ -4865,7 +4864,7 @@ discard block |
||
4865 | 4864 | $rt = false; |
4866 | 4865 | if ($_SESSION["webValidated"] == 1) { |
4867 | 4866 | $tbl = $this->getDatabase()->getFullTableName("web_users"); |
4868 | - $ds = $this->getDatabase()->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
4867 | + $ds = $this->getDatabase()->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'"); |
|
4869 | 4868 | if ($row = $this->getDatabase()->getRow($ds)) { |
4870 | 4869 | if ($row["password"] == md5($oldPwd)) { |
4871 | 4870 | if (strlen($newPwd) < 6) { |
@@ -4875,7 +4874,7 @@ discard block |
||
4875 | 4874 | } else { |
4876 | 4875 | $this->getDatabase()->update(array( |
4877 | 4876 | 'password' => $this->getDatabase()->escape($newPwd), |
4878 | - ), $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
4877 | + ), $tbl, "id='".$this->getLoginUserID()."'"); |
|
4879 | 4878 | // invoke OnWebChangePassword event |
4880 | 4879 | $this->invokeEvent("OnWebChangePassword", array( |
4881 | 4880 | "userid" => $row["id"], |
@@ -4908,8 +4907,8 @@ discard block |
||
4908 | 4907 | if (!is_array($grpNames)) { |
4909 | 4908 | $rs = $this->getDatabase()->select( |
4910 | 4909 | 'wgn.name', |
4911 | - $this->getDatabase()->getFullTableName("webgroup_names") . ' wgn ' . |
|
4912 | - 'INNER JOIN ' . $this->getDatabase()->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'" |
|
4910 | + $this->getDatabase()->getFullTableName("webgroup_names").' wgn '. |
|
4911 | + 'INNER JOIN '.$this->getDatabase()->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'" |
|
4913 | 4912 | ); |
4914 | 4913 | $grpNames = $this->getDatabase()->getColumn("name", $rs); |
4915 | 4914 | // save to cache |
@@ -4943,7 +4942,7 @@ discard block |
||
4943 | 4942 | if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) { |
4944 | 4943 | $this->sjscripts[$nextpos] = $src; |
4945 | 4944 | } else { |
4946 | - $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>'; |
|
4945 | + $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>'; |
|
4947 | 4946 | } |
4948 | 4947 | } |
4949 | 4948 | |
@@ -5022,7 +5021,7 @@ discard block |
||
5022 | 5021 | } |
5023 | 5022 | |
5024 | 5023 | if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) { |
5025 | - $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>'; |
|
5024 | + $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>'; |
|
5026 | 5025 | } |
5027 | 5026 | if ($startup) { |
5028 | 5027 | $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1; |
@@ -5162,7 +5161,7 @@ discard block |
||
5162 | 5161 | |
5163 | 5162 | $this->storeEvent(); |
5164 | 5163 | |
5165 | - $out = $this['events']->dispatch('evolution.' . $evtName, [$extParams]); |
|
5164 | + $out = $this['events']->dispatch('evolution.'.$evtName, [$extParams]); |
|
5166 | 5165 | if ($out === false) { |
5167 | 5166 | $this->restoreEvent(); |
5168 | 5167 | return false; |
@@ -5216,7 +5215,7 @@ discard block |
||
5216 | 5215 | $eventtime = $this->getMicroTime() - $eventtime; |
5217 | 5216 | $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000); |
5218 | 5217 | foreach ($parameter as $k => $v) { |
5219 | - $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>'; |
|
5218 | + $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>'; |
|
5220 | 5219 | } |
5221 | 5220 | $this->pluginsCode .= '</fieldset><br />'; |
5222 | 5221 | $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime; |
@@ -5244,13 +5243,13 @@ discard block |
||
5244 | 5243 | $plugin = array(); |
5245 | 5244 | if (isset ($this->pluginCache[$pluginName])) { |
5246 | 5245 | $pluginCode = $this->pluginCache[$pluginName]; |
5247 | - $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : ''; |
|
5246 | + $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : ''; |
|
5248 | 5247 | } else { |
5249 | 5248 | $pluginName = $this->getDatabase()->escape($pluginName); |
5250 | 5249 | $result = $this->getDatabase()->select('name, plugincode, properties', $this->getDatabase()->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0"); |
5251 | 5250 | if ($row = $this->getDatabase()->getRow($result)) { |
5252 | 5251 | $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode']; |
5253 | - $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties']; |
|
5252 | + $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties']; |
|
5254 | 5253 | } else { |
5255 | 5254 | $pluginCode = $this->pluginCache[$pluginName] = "return false;"; |
5256 | 5255 | $pluginProperties = ''; |
@@ -5274,7 +5273,7 @@ discard block |
||
5274 | 5273 | { |
5275 | 5274 | $property = array(); |
5276 | 5275 | |
5277 | - if(\is_scalar($propertyString)) { |
|
5276 | + if (\is_scalar($propertyString)) { |
|
5278 | 5277 | $propertyString = trim($propertyString); |
5279 | 5278 | $propertyString = str_replace('{}', '', $propertyString); |
5280 | 5279 | $propertyString = str_replace('} {', ',', $propertyString); |
@@ -5328,7 +5327,7 @@ discard block |
||
5328 | 5327 | } |
5329 | 5328 | } |
5330 | 5329 | } |
5331 | - elseif(\is_array($propertyString)) { |
|
5330 | + elseif (\is_array($propertyString)) { |
|
5332 | 5331 | $property = $propertyString; |
5333 | 5332 | } |
5334 | 5333 | if (!empty($elementName) && !empty($elementType)) { |
@@ -5351,7 +5350,7 @@ discard block |
||
5351 | 5350 | /** |
5352 | 5351 | * @deprecated |
5353 | 5352 | */ |
5354 | - public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false) { |
|
5353 | + public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false){ |
|
5355 | 5354 | $data = $this->get('DocBlock')->parseFromFile($element_dir, $filename); |
5356 | 5355 | if ($escapeValues) { |
5357 | 5356 | $data = $this->getDatabase()->escape($data); |
@@ -5362,7 +5361,7 @@ discard block |
||
5362 | 5361 | /** |
5363 | 5362 | * @deprecated |
5364 | 5363 | */ |
5365 | - public function parseDocBlockFromString($string, $escapeValues = false) { |
|
5364 | + public function parseDocBlockFromString($string, $escapeValues = false){ |
|
5366 | 5365 | $data = $this->get('DocBlock')->parseFromString($string); |
5367 | 5366 | if ($escapeValues) { |
5368 | 5367 | $data = $this->getDatabase()->escape($data); |
@@ -5373,14 +5372,14 @@ discard block |
||
5373 | 5372 | /** |
5374 | 5373 | * @deprecated |
5375 | 5374 | */ |
5376 | - public function parseDocBlockLine($line, $docblock_start_found, $name_found, $description_found, $docblock_end_found) { |
|
5375 | + public function parseDocBlockLine($line, $docblock_start_found, $name_found, $description_found, $docblock_end_found){ |
|
5377 | 5376 | return $this->get('DocBlock')->parseLine($line, $docblock_start_found, $name_found, $description_found, $docblock_end_found); |
5378 | 5377 | } |
5379 | 5378 | |
5380 | 5379 | /** |
5381 | 5380 | * @deprecated |
5382 | 5381 | */ |
5383 | - public function convertDocBlockIntoList($parsed) { |
|
5382 | + public function convertDocBlockIntoList($parsed){ |
|
5384 | 5383 | return $this->get('DocBlock')->convertIntoList($parsed); |
5385 | 5384 | } |
5386 | 5385 | |
@@ -5449,8 +5448,8 @@ discard block |
||
5449 | 5448 | */ |
5450 | 5449 | public function addSnippet($name, $phpCode, $namespace = '#', array $defaultParams = array()) |
5451 | 5450 | { |
5452 | - $this->snippetCache[$namespace . $name] = $phpCode; |
|
5453 | - $this->snippetCache[$namespace . $name . 'Props'] = $defaultParams; |
|
5451 | + $this->snippetCache[$namespace.$name] = $phpCode; |
|
5452 | + $this->snippetCache[$namespace.$name.'Props'] = $defaultParams; |
|
5454 | 5453 | } |
5455 | 5454 | |
5456 | 5455 | /** |
@@ -5458,7 +5457,7 @@ discard block |
||
5458 | 5457 | */ |
5459 | 5458 | public function addChunk($name, $text, $namespace = '#') |
5460 | 5459 | { |
5461 | - $this->chunkCache[$namespace . $name] = $text; |
|
5460 | + $this->chunkCache[$namespace.$name] = $text; |
|
5462 | 5461 | } |
5463 | 5462 | |
5464 | 5463 | /** |
@@ -5468,7 +5467,7 @@ discard block |
||
5468 | 5467 | { |
5469 | 5468 | $out = array(); |
5470 | 5469 | |
5471 | - if (! is_dir($scanPath) || empty($ext)) { |
|
5470 | + if (!is_dir($scanPath) || empty($ext)) { |
|
5472 | 5471 | return $out; |
5473 | 5472 | } |
5474 | 5473 | $iterator = new \RecursiveIteratorIterator( |
@@ -5480,22 +5479,22 @@ discard block |
||
5480 | 5479 | * @var \SplFileInfo $item |
5481 | 5480 | */ |
5482 | 5481 | if ($item->isFile() && $item->isReadable() && \in_array($item->getExtension(), $ext)) { |
5483 | - $name = $item->getBasename('.' . $item->getExtension()); |
|
5482 | + $name = $item->getBasename('.'.$item->getExtension()); |
|
5484 | 5483 | $path = ltrim(str_replace( |
5485 | 5484 | array(rtrim($scanPath, '//'), '/'), |
5486 | 5485 | array('', '\\'), |
5487 | - $item->getPath() . '/' |
|
5486 | + $item->getPath().'/' |
|
5488 | 5487 | ), '\\'); |
5489 | 5488 | |
5490 | 5489 | if (!empty($path)) { |
5491 | - $name = $path . $name; |
|
5490 | + $name = $path.$name; |
|
5492 | 5491 | } |
5493 | 5492 | switch ($type) { |
5494 | 5493 | case 'chunk': |
5495 | 5494 | $out[$name] = file_get_contents($item->getRealPath()); |
5496 | 5495 | break; |
5497 | 5496 | case 'snippet': |
5498 | - $out[$name] = "return require '" . $item->getRealPath() . "';"; |
|
5497 | + $out[$name] = "return require '".$item->getRealPath()."';"; |
|
5499 | 5498 | break; |
5500 | 5499 | default: |
5501 | 5500 | throw new \Exception; |
@@ -5539,7 +5538,7 @@ discard block |
||
5539 | 5538 | } |
5540 | 5539 | |
5541 | 5540 | if (!$isSafe) { |
5542 | - $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true); |
|
5541 | + $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true); |
|
5543 | 5542 | $title = sprintf('Unknown eval was executed (%s)', $this->getPhpCompat()->htmlspecialchars(substr(trim($phpcode), 0, 50))); |
5544 | 5543 | $this->getService('ExceptionHandler') |
5545 | 5544 | ->messageQuit($title, '', true, '', '', 'Parser', $msg); |
@@ -5554,7 +5553,7 @@ discard block |
||
5554 | 5553 | return 'array()'; |
5555 | 5554 | } |
5556 | 5555 | |
5557 | - $output = $echo . $return; |
|
5556 | + $output = $echo.$return; |
|
5558 | 5557 | modx_sanitize_gpc($output); |
5559 | 5558 | return $this->getPhpCompat()->htmlspecialchars($output); // Maybe, all html tags are dangerous |
5560 | 5559 | } |
@@ -5572,8 +5571,8 @@ discard block |
||
5572 | 5571 | |
5573 | 5572 | $safe = explode(',', $safe_functions); |
5574 | 5573 | |
5575 | - $phpcode = rtrim($phpcode, ';') . ';'; |
|
5576 | - $tokens = token_get_all('<?php ' . $phpcode); |
|
5574 | + $phpcode = rtrim($phpcode, ';').';'; |
|
5575 | + $tokens = token_get_all('<?php '.$phpcode); |
|
5577 | 5576 | foreach ($tokens as $i => $token) { |
5578 | 5577 | if (!is_array($token)) { |
5579 | 5578 | continue; |
@@ -5609,7 +5608,7 @@ discard block |
||
5609 | 5608 | public function atBindFileContent($str = '') |
5610 | 5609 | { |
5611 | 5610 | |
5612 | - $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->getConfig('rb_base_url') . 'files/', ''); |
|
5611 | + $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->getConfig('rb_base_url').'files/', ''); |
|
5613 | 5612 | |
5614 | 5613 | if (stripos($str, '@FILE') !== 0) { |
5615 | 5614 | return $str; |
@@ -5632,7 +5631,7 @@ discard block |
||
5632 | 5631 | $errorMsg = sprintf("Could not retrieve string '%s'.", $str); |
5633 | 5632 | |
5634 | 5633 | foreach ($search_path as $path) { |
5635 | - $file_path = MODX_BASE_PATH . $path . $str; |
|
5634 | + $file_path = MODX_BASE_PATH.$path.$str; |
|
5636 | 5635 | if (strpos($file_path, MODX_MANAGER_PATH) === 0) { |
5637 | 5636 | return $errorMsg; |
5638 | 5637 | } elseif (is_file($file_path)) { |
@@ -5646,7 +5645,7 @@ discard block |
||
5646 | 5645 | return $errorMsg; |
5647 | 5646 | } |
5648 | 5647 | |
5649 | - $content = (string)file_get_contents($file_path); |
|
5648 | + $content = (string) file_get_contents($file_path); |
|
5650 | 5649 | if ($content === false) { |
5651 | 5650 | return $errorMsg; |
5652 | 5651 | } |
@@ -5723,7 +5722,7 @@ discard block |
||
5723 | 5722 | } |
5724 | 5723 | |
5725 | 5724 | if (isset ($usrType)) { |
5726 | - $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings; |
|
5725 | + $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings; |
|
5727 | 5726 | } // store user settings in session |
5728 | 5727 | } |
5729 | 5728 | if ($this->isFrontend() && $mgrid = $this->getLoginUserID('mgr')) { |
@@ -5765,7 +5764,7 @@ discard block |
||
5765 | 5764 | include $siteCachePath; |
5766 | 5765 | } |
5767 | 5766 | |
5768 | - if (! empty($this->config)) { |
|
5767 | + if (!empty($this->config)) { |
|
5769 | 5768 | return; |
5770 | 5769 | } |
5771 | 5770 | |
@@ -5778,7 +5777,7 @@ discard block |
||
5778 | 5777 | if (is_file($siteCachePath)) { |
5779 | 5778 | include $siteCachePath; |
5780 | 5779 | } |
5781 | - if (! empty($this->config)) { |
|
5780 | + if (!empty($this->config)) { |
|
5782 | 5781 | return; |
5783 | 5782 | } |
5784 | 5783 | |
@@ -5882,7 +5881,7 @@ discard block |
||
5882 | 5881 | $alias = strip_tags($alias); // strip HTML |
5883 | 5882 | $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters |
5884 | 5883 | $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash |
5885 | - $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
5884 | + $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
5886 | 5885 | $alias = trim($alias, '-'); // trim excess |
5887 | 5886 | return $alias; |
5888 | 5887 | } |
@@ -5936,10 +5935,10 @@ discard block |
||
5936 | 5935 | |
5937 | 5936 | if (strpos($str, MODX_MANAGER_PATH) === 0) { |
5938 | 5937 | return false; |
5939 | - } elseif (is_file(MODX_BASE_PATH . $str)) { |
|
5940 | - $file_path = MODX_BASE_PATH . $str; |
|
5941 | - } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) { |
|
5942 | - $file_path = MODX_BASE_PATH . $tpl_dir . $str; |
|
5938 | + } elseif (is_file(MODX_BASE_PATH.$str)) { |
|
5939 | + $file_path = MODX_BASE_PATH.$str; |
|
5940 | + } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) { |
|
5941 | + $file_path = MODX_BASE_PATH.$tpl_dir.$str; |
|
5943 | 5942 | } else { |
5944 | 5943 | return false; |
5945 | 5944 | } |
@@ -6036,7 +6035,7 @@ discard block |
||
6036 | 6035 | $title = 'no title'; |
6037 | 6036 | } |
6038 | 6037 | if (is_array($msg)) { |
6039 | - $msg = '<pre>' . print_r($msg, true) . '</pre>'; |
|
6038 | + $msg = '<pre>'.print_r($msg, true).'</pre>'; |
|
6040 | 6039 | } elseif ($msg === '') { |
6041 | 6040 | $msg = $_SERVER['REQUEST_URI']; |
6042 | 6041 | } |
@@ -898,7 +898,8 @@ discard block |
||
898 | 898 | $where |
899 | 899 | ); |
900 | 900 | $this->getDatabase()->update($field, $this->getDatabase()->getFullTableName('site_content'), $where); |
901 | - if ($this->getDatabase()->getRecordCount($result_pub) >= 1) { //Event unPublished doc |
|
901 | + if ($this->getDatabase()->getRecordCount($result_pub) >= 1) { |
|
902 | +//Event unPublished doc |
|
902 | 903 | while ($row_pub = $this->getDatabase()->getRow($result_pub)) { |
903 | 904 | $this->invokeEvent("OnDocUnPublished", array( |
904 | 905 | "docid" => $row_pub['id'] |
@@ -915,7 +916,8 @@ discard block |
||
915 | 916 | $where |
916 | 917 | ); |
917 | 918 | $this->getDatabase()->update($field, $this->getDatabase()->getFullTableName('site_content'), $where); |
918 | - if ($this->getDatabase()->getRecordCount($result_unpub) >= 1) { //Event unPublished doc |
|
919 | + if ($this->getDatabase()->getRecordCount($result_unpub) >= 1) { |
|
920 | +//Event unPublished doc |
|
919 | 921 | while ($row_unpub = $this->getDatabase()->getRow($result_unpub)) { |
920 | 922 | $this->invokeEvent("OnDocUnPublished", array( |
921 | 923 | "docid" => $row_unpub['id'] |
@@ -1071,7 +1073,8 @@ discard block |
||
1071 | 1073 | } |
1072 | 1074 | } |
1073 | 1075 | |
1074 | - if (!in_array($fetch, $tags)) { // Avoid double Matches |
|
1076 | + if (!in_array($fetch, $tags)) { |
|
1077 | +// Avoid double Matches |
|
1075 | 1078 | $tags[] = $fetch; // Fetch |
1076 | 1079 | }; |
1077 | 1080 | $fetch = ''; // and reset |
@@ -1914,7 +1917,8 @@ discard block |
||
1914 | 1917 | * @return mixed|string |
1915 | 1918 | */ |
1916 | 1919 | public function _getSGVar($value) |
1917 | - { // Get super globals |
|
1920 | + { |
|
1921 | +// Get super globals |
|
1918 | 1922 | $key = $value; |
1919 | 1923 | $_ = $this->getConfig('enable_filter'); |
1920 | 1924 | $this->setConfig('enable_filter', 1); |
@@ -2996,7 +3000,8 @@ discard block |
||
2996 | 3000 | * @param array $permissions |
2997 | 3001 | * @return bool |
2998 | 3002 | */ |
2999 | - public function hasAnyPermissions(array $permissions) { |
|
3003 | + public function hasAnyPermissions(array $permissions) |
|
3004 | + { |
|
3000 | 3005 | foreach ($permissions as $p) { |
3001 | 3006 | if ($this->hasPermission($p)) { |
3002 | 3007 | return true; |
@@ -3971,7 +3976,8 @@ discard block |
||
3971 | 3976 | if (isset ($this->snippetCache[$snippetName])) { |
3972 | 3977 | $snippet = $this->snippetCache[$snippetName]; |
3973 | 3978 | $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
3974 | - } else { // not in cache so let's check the db |
|
3979 | + } else { |
|
3980 | +// not in cache so let's check the db |
|
3975 | 3981 | $snippetObject = $this->_getSnippetFromDatabase($snippetName); |
3976 | 3982 | |
3977 | 3983 | $snippet = $this->snippetCache[$snippetName] = $snippetObject['content'] === null ?? "return false;"; |
@@ -4483,7 +4489,7 @@ discard block |
||
4483 | 4489 | if(\is_scalar($fields)) { |
4484 | 4490 | $fields = explode(',', $fields); |
4485 | 4491 | } |
4486 | - $fields = array_filter(array_map('trim', $fields), function($value) { |
|
4492 | + $fields = array_filter(array_map('trim', $fields), function($value){ |
|
4487 | 4493 | return $value !== 'value'; |
4488 | 4494 | }); |
4489 | 4495 | $fields = 'tv.' . implode(',tv.', $fields); |
@@ -4509,7 +4515,7 @@ discard block |
||
4509 | 4515 | $result = $this->getDatabase()->makeArray($rs); |
4510 | 4516 | |
4511 | 4517 | // get default/built-in template variables |
4512 | - if(is_array($docRow)){ |
|
4518 | + if(is_array($docRow)) { |
|
4513 | 4519 | ksort($docRow); |
4514 | 4520 | |
4515 | 4521 | foreach ($docRow as $name => $value) { |
@@ -4989,7 +4995,8 @@ discard block |
||
4989 | 4995 | unset($overwritepos); // probably unnecessary--just making sure |
4990 | 4996 | |
4991 | 4997 | $useThisVer = true; |
4992 | - if (isset($this->loadedjscripts[$key])) { // a matching script was found |
|
4998 | + if (isset($this->loadedjscripts[$key])) { |
|
4999 | +// a matching script was found |
|
4993 | 5000 | // if existing script is a startup script, make sure the candidate is also a startup script |
4994 | 5001 | if ($this->loadedjscripts[$key]['startup']) { |
4995 | 5002 | $startup = true; |
@@ -5009,7 +5016,8 @@ discard block |
||
5009 | 5016 | // overwrite the old script (the position may be important for dependent scripts) |
5010 | 5017 | $overwritepos = $this->loadedjscripts[$key]['pos']; |
5011 | 5018 | } |
5012 | - } else { // Use the original version |
|
5019 | + } else { |
|
5020 | +// Use the original version |
|
5013 | 5021 | if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) { |
5014 | 5022 | // need to move the exisiting script to the head |
5015 | 5023 | $version = $this->loadedjscripts[$key][$version]; |
@@ -5181,7 +5189,8 @@ discard block |
||
5181 | 5189 | return $results ?? false; |
5182 | 5190 | } |
5183 | 5191 | |
5184 | - foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop |
|
5192 | + foreach ($this->pluginEvent[$evtName] as $pluginName) { |
|
5193 | +// start for loop |
|
5185 | 5194 | if ($this->dumpPlugins) { |
5186 | 5195 | $eventtime = $this->getMicroTime(); |
5187 | 5196 | } |
@@ -5327,8 +5336,7 @@ discard block |
||
5327 | 5336 | } |
5328 | 5337 | } |
5329 | 5338 | } |
5330 | - } |
|
5331 | - elseif(\is_array($propertyString)) { |
|
5339 | + } elseif(\is_array($propertyString)) { |
|
5332 | 5340 | $property = $propertyString; |
5333 | 5341 | } |
5334 | 5342 | if (!empty($elementName) && !empty($elementType)) { |
@@ -5351,7 +5359,8 @@ discard block |
||
5351 | 5359 | /** |
5352 | 5360 | * @deprecated |
5353 | 5361 | */ |
5354 | - public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false) { |
|
5362 | + public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false) |
|
5363 | + { |
|
5355 | 5364 | $data = $this->get('DocBlock')->parseFromFile($element_dir, $filename); |
5356 | 5365 | if ($escapeValues) { |
5357 | 5366 | $data = $this->getDatabase()->escape($data); |
@@ -5362,7 +5371,8 @@ discard block |
||
5362 | 5371 | /** |
5363 | 5372 | * @deprecated |
5364 | 5373 | */ |
5365 | - public function parseDocBlockFromString($string, $escapeValues = false) { |
|
5374 | + public function parseDocBlockFromString($string, $escapeValues = false) |
|
5375 | + { |
|
5366 | 5376 | $data = $this->get('DocBlock')->parseFromString($string); |
5367 | 5377 | if ($escapeValues) { |
5368 | 5378 | $data = $this->getDatabase()->escape($data); |
@@ -5373,14 +5383,16 @@ discard block |
||
5373 | 5383 | /** |
5374 | 5384 | * @deprecated |
5375 | 5385 | */ |
5376 | - public function parseDocBlockLine($line, $docblock_start_found, $name_found, $description_found, $docblock_end_found) { |
|
5386 | + public function parseDocBlockLine($line, $docblock_start_found, $name_found, $description_found, $docblock_end_found) |
|
5387 | + { |
|
5377 | 5388 | return $this->get('DocBlock')->parseLine($line, $docblock_start_found, $name_found, $description_found, $docblock_end_found); |
5378 | 5389 | } |
5379 | 5390 | |
5380 | 5391 | /** |
5381 | 5392 | * @deprecated |
5382 | 5393 | */ |
5383 | - public function convertDocBlockIntoList($parsed) { |
|
5394 | + public function convertDocBlockIntoList($parsed) |
|
5395 | + { |
|
5384 | 5396 | return $this->get('DocBlock')->convertIntoList($parsed); |
5385 | 5397 | } |
5386 | 5398 | |
@@ -5565,7 +5577,8 @@ discard block |
||
5565 | 5577 | * @return bool |
5566 | 5578 | */ |
5567 | 5579 | public function isSafeCode($phpcode = '', $safe_functions = '') |
5568 | - { // return true or false |
|
5580 | + { |
|
5581 | +// return true or false |
|
5569 | 5582 | if ($safe_functions == '') { |
5570 | 5583 | return false; |
5571 | 5584 | } |
@@ -2225,11 +2225,11 @@ discard block |
||
2225 | 2225 | if (array_key_exists($snip_name, $this->snippetCache)) { |
2226 | 2226 | $snippetObject['name'] = $snip_name; |
2227 | 2227 | $snippetObject['content'] = $this->snippetCache[$snip_name]; |
2228 | - if (isset($this->snippetCache["{$snip_name}Props"])) { |
|
2229 | - if (!isset($this->snippetCache["{$snip_name}Props"])) { |
|
2230 | - $this->snippetCache["{$snip_name}Props"] = ''; |
|
2228 | + if (isset($this->snippetCache["{$snip_name}props"])) { |
|
2229 | + if (!isset($this->snippetCache["{$snip_name}props"])) { |
|
2230 | + $this->snippetCache["{$snip_name}props"] = ''; |
|
2231 | 2231 | } |
2232 | - $snippetObject['properties'] = $this->snippetCache["{$snip_name}Props"]; |
|
2232 | + $snippetObject['properties'] = $this->snippetCache["{$snip_name}props"]; |
|
2233 | 2233 | } |
2234 | 2234 | } elseif (substr($snip_name, 0, 1) === '@' && isset($this->pluginEvent[substr($snip_name, 1)])) { |
2235 | 2235 | $snippetObject['name'] = substr($snip_name, 1); |
@@ -2242,7 +2242,7 @@ discard block |
||
2242 | 2242 | $snippetObject = $this->_getSnippetFromDatabase($snip_name); |
2243 | 2243 | |
2244 | 2244 | $this->snippetCache[$snip_name] = $snippetObject['content']; |
2245 | - $this->snippetCache["{$snip_name}Props"] = $snippetObject['properties']; |
|
2245 | + $this->snippetCache["{$snip_name}props"] = $snippetObject['properties']; |
|
2246 | 2246 | } |
2247 | 2247 | |
2248 | 2248 | return $snippetObject; |
@@ -3508,7 +3508,7 @@ discard block |
||
3508 | 3508 | } |
3509 | 3509 | // build query |
3510 | 3510 | $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
3511 | - $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc |
|
3511 | + $result = $this->getDatabase()->select("distinct {$fields}", "{$tblsc} sc |
|
3512 | 3512 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", |
3513 | 3513 | "{$sort} {$dir}"); |
3514 | 3514 | $resourceArray = $this->getDatabase()->makeArray($result); |
@@ -3551,7 +3551,7 @@ discard block |
||
3551 | 3551 | } |
3552 | 3552 | // build query |
3553 | 3553 | $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
3554 | - $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc |
|
3554 | + $result = $this->getDatabase()->select("distinct {$fields}", "{$tblsc} sc |
|
3555 | 3555 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", |
3556 | 3556 | "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
3557 | 3557 | $resourceArray = $this->getDatabase()->makeArray($result); |
@@ -3616,7 +3616,7 @@ discard block |
||
3616 | 3616 | $tblsc = $this->getDatabase()->getFullTableName('site_content'); |
3617 | 3617 | $tbldg = $this->getDatabase()->getFullTableName('document_groups'); |
3618 | 3618 | |
3619 | - $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc |
|
3619 | + $result = $this->getDatabase()->select("distinct {$fields}", "{$tblsc} sc |
|
3620 | 3620 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", |
3621 | 3621 | "sc.parent = '{$parentid}' {$published} {$deleted} {$where} AND ({$access}) GROUP BY sc.id", |
3622 | 3622 | ($sort ? "{$sort} {$dir}" : ""), $limit); |
@@ -3693,7 +3693,7 @@ discard block |
||
3693 | 3693 | $tblsc = $this->getDatabase()->getFullTableName('site_content'); |
3694 | 3694 | $tbldg = $this->getDatabase()->getFullTableName('document_groups'); |
3695 | 3695 | |
3696 | - $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc |
|
3696 | + $result = $this->getDatabase()->select("distinct {$fields}", "{$tblsc} sc |
|
3697 | 3697 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',', |
3698 | 3698 | $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", |
3699 | 3699 | ($sort ? "{$sort} {$dir}" : ""), $limit); |
@@ -4155,7 +4155,7 @@ discard block |
||
4155 | 4155 | $template = $doc['content']; |
4156 | 4156 | break; |
4157 | 4157 | case 'SELECT': |
4158 | - $this->getDatabase()->getValue($this->getDatabase()->query("SELECT {$template}")); |
|
4158 | + $this->getDatabase()->getValue($this->getDatabase()->query("select {$template}")); |
|
4159 | 4159 | break; |
4160 | 4160 | default: |
4161 | 4161 | if (!($template = $this->getChunk($tpl))) { |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | use AgelxNash\Modx\Evo\Database\Database as BaseDatabase; |
4 | 4 | use AgelxNash\Modx\Evo\Database\Drivers\IlluminateDriver; |
5 | -use Exception; |
|
6 | 5 | use AgelxNash\Modx\Evo\Database\Exceptions; |
6 | +use Exception; |
|
7 | 7 | |
8 | 8 | class Database extends BaseDatabase implements Interfaces\DatabaseInterface |
9 | 9 | { |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | public function replaceFullTableName($tableName, $force = false) |
19 | 19 | { |
20 | 20 | $tableName = trim($tableName); |
21 | - if ((bool)$force === true) { |
|
21 | + if ((bool) $force === true) { |
|
22 | 22 | $result = $this->getFullTableName($tableName); |
23 | 23 | } elseif (strpos($tableName, '[+prefix+]') !== false) { |
24 | 24 | $dbase = trim($this->getConfig('database'), '`'); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | $result = preg_replace( |
28 | 28 | '@\[\+prefix\+\](\w+)@', |
29 | - '`' . $dbase . '`.`' . $prefix . '$1`', |
|
29 | + '`'.$dbase.'`.`'.$prefix.'$1`', |
|
30 | 30 | $tableName |
31 | 31 | ); |
32 | 32 | } else { |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $fromTable = '', |
65 | 65 | $where = '', |
66 | 66 | $limit = '' |
67 | - ) { |
|
67 | + ){ |
|
68 | 68 | if (is_array($fields)) { |
69 | 69 | $onlyKeys = true; |
70 | 70 | foreach ($fields as $key => $value) { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
75 | - * @param mixed $data |
|
75 | + * @param string $data |
|
76 | 76 | */ |
77 | 77 | public function addOutput($data) |
78 | 78 | { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
93 | - * @return mixed |
|
93 | + * @return string |
|
94 | 94 | */ |
95 | 95 | public function getOutput() |
96 | 96 | { |
@@ -35,7 +35,7 @@ |
||
35 | 35 | if (is_array($SystemAlertMsgQueque)) { |
36 | 36 | $title = ''; |
37 | 37 | if ($this->name && $this->activePlugin) { |
38 | - $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>"; |
|
38 | + $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>"; |
|
39 | 39 | } |
40 | 40 | $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>"; |
41 | 41 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @param string $text Error message |
97 | 97 | * @param string $file File where the error was detected |
98 | 98 | * @param string $line Line number within $file |
99 | - * @return boolean |
|
99 | + * @return boolean|null |
|
100 | 100 | */ |
101 | 101 | public function phpError($nr, $text, $file, $line) |
102 | 102 | { |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param string $text |
149 | 149 | * @param string $line |
150 | 150 | * @param string $output |
151 | - * @return bool |
|
151 | + * @return null|boolean |
|
152 | 152 | */ |
153 | 153 | public function messageQuit( |
154 | 154 | $msg = 'unspecified error', |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php namespace EvolutionCMS; |
2 | 2 | |
3 | -use Illuminate\Contracts\Container\Container; |
|
4 | 3 | use AgelxNash\Modx\Evo\Database\Exceptions\ConnectException; |
4 | +use EvolutionCMS\Interfaces\TracyPanel; |
|
5 | +use EvolutionCMS\Tracy\Debugger; |
|
5 | 6 | use Exception; |
7 | +use Illuminate\Contracts\Container\Container; |
|
6 | 8 | use Symfony\Component\Debug\Exception\FatalErrorException; |
7 | 9 | use Symfony\Component\Debug\Exception\FatalThrowableError; |
8 | -use EvolutionCMS\Tracy\Debugger; |
|
9 | -use EvolutionCMS\Interfaces\TracyPanel; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @see: https://github.com/laravel/framework/blob/5.6/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | $this->container = $container; |
25 | 25 | |
26 | 26 | Debugger::enable( |
27 | - ! $this->container['config']->get('tracy.active'), |
|
28 | - evolutionCMS()->storagePath() . '/logs' |
|
27 | + !$this->container['config']->get('tracy.active'), |
|
28 | + evolutionCMS()->storagePath().'/logs' |
|
29 | 29 | ); |
30 | 30 | Debugger::$strictMode = false; |
31 | 31 | Debugger::$showLocation = true; |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $line = '', |
162 | 162 | $output = '', |
163 | 163 | $backtrace = array() |
164 | - ) { |
|
164 | + ){ |
|
165 | 165 | if (0 < $this->container->messageQuitCount) { |
166 | 166 | return; |
167 | 167 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : ''; |
178 | 178 | $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : ''; |
179 | - $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI']; |
|
179 | + $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI']; |
|
180 | 180 | $request_uri = $this->container->getPhpCompat()->htmlspecialchars($request_uri, ENT_QUOTES, |
181 | 181 | $this->container->getConfig('modx_charset')); |
182 | 182 | $ua = $this->container->getPhpCompat()->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, |
@@ -186,15 +186,15 @@ discard block |
||
186 | 186 | if ($is_error) { |
187 | 187 | $str = '<h2 style="color:red">« Evo Parse Error »</h2>'; |
188 | 188 | if ($msg != 'PHP Parse Error') { |
189 | - $str .= '<h3 style="color:red">' . $msg . '</h3>'; |
|
189 | + $str .= '<h3 style="color:red">'.$msg.'</h3>'; |
|
190 | 190 | } |
191 | 191 | } else { |
192 | 192 | $str = '<h2 style="color:#003399">« Evo Debug/ stop message »</h2>'; |
193 | - $str .= '<h3 style="color:#003399">' . $msg . '</h3>'; |
|
193 | + $str .= '<h3 style="color:#003399">'.$msg.'</h3>'; |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | if (!empty ($query)) { |
197 | - $str .= '<pre style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL > <span id="sqlHolder">' . $query . '</span></pre>'; |
|
197 | + $str .= '<pre style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL > <span id="sqlHolder">'.$query.'</span></pre>'; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | $errortype = array( |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | |
218 | 218 | if (!empty($nr) || !empty($file)) { |
219 | 219 | if ($text != '') { |
220 | - $str .= '<pre style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</pre>'; |
|
220 | + $str .= '<pre style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</pre>'; |
|
221 | 221 | } |
222 | 222 | if ($output != '') { |
223 | - $str .= '<pre style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</pre>'; |
|
223 | + $str .= '<pre style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</pre>'; |
|
224 | 224 | } |
225 | 225 | if ($nr !== '') { |
226 | - $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]"); |
|
226 | + $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]"); |
|
227 | 227 | } |
228 | 228 | if ($file) { |
229 | 229 | $table[] = array('File', $file); |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | } |
244 | 244 | |
245 | 245 | if (!empty($this->event->activePlugin)) { |
246 | - $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')'); |
|
246 | + $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')'); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | $str .= $MakeTable->create($table, array('Error information', '')); |
@@ -254,11 +254,11 @@ discard block |
||
254 | 254 | |
255 | 255 | if ($this->container->getManagerApi()->action) { |
256 | 256 | $actionName = Legacy\LogHandler::getAction($this->container->getManagerApi()->action); |
257 | - if (! empty($actionName)) { |
|
258 | - $actionName = ' - ' . $actionName; |
|
257 | + if (!empty($actionName)) { |
|
258 | + $actionName = ' - '.$actionName; |
|
259 | 259 | } |
260 | 260 | |
261 | - $table[] = array('Manager action', $this->container->getManagerApi()->action . $actionName); |
|
261 | + $table[] = array('Manager action', $this->container->getManagerApi()->action.$actionName); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | if (preg_match('@^[0-9]+@', $this->container->documentIdentifier)) { |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $url = $this->container->makeUrl($this->container->documentIdentifier, '', '', 'full'); |
267 | 267 | $table[] = array( |
268 | 268 | 'Resource', |
269 | - '[' . $this->container->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>' |
|
269 | + '['.$this->container->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>' |
|
270 | 270 | ); |
271 | 271 | } |
272 | 272 | $table[] = array('Referer', $referer); |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | |
292 | 292 | $mem = memory_get_peak_usage(true); |
293 | 293 | $total_mem = $mem - $this->container->mstart; |
294 | - $total_mem = ($total_mem / 1024 / 1024) . ' mb'; |
|
294 | + $total_mem = ($total_mem / 1024 / 1024).' mb'; |
|
295 | 295 | |
296 | 296 | $queryTime = $this->container->queryTime; |
297 | 297 | $phpTime = $totalTime - $queryTime; |
@@ -308,23 +308,23 @@ discard block |
||
308 | 308 | |
309 | 309 | $php_errormsg = error_get_last(); |
310 | 310 | if (!empty($php_errormsg) && isset($php_errormsg['message'])) { |
311 | - $str = '<b>' . $php_errormsg['message'] . '</b><br />' . PHP_EOL . $str; |
|
311 | + $str = '<b>'.$php_errormsg['message'].'</b><br />'.PHP_EOL.$str; |
|
312 | 312 | } |
313 | 313 | $str .= $this->getBacktrace(empty($backtrace) ? debug_backtrace() : $backtrace); |
314 | 314 | // Log error |
315 | 315 | if (!empty($this->container->currentSnippet)) { |
316 | - $source = 'Snippet - ' . $this->container->currentSnippet; |
|
316 | + $source = 'Snippet - '.$this->container->currentSnippet; |
|
317 | 317 | } elseif (!empty($this->container->event->activePlugin)) { |
318 | - $source = 'Plugin - ' . $this->container->event->activePlugin; |
|
318 | + $source = 'Plugin - '.$this->container->event->activePlugin; |
|
319 | 319 | } elseif ($source !== '') { |
320 | - $source = 'Parser - ' . $source; |
|
320 | + $source = 'Parser - '.$source; |
|
321 | 321 | } elseif ($query !== '') { |
322 | 322 | $source = 'SQL Query'; |
323 | 323 | } else { |
324 | 324 | $source = 'Parser'; |
325 | 325 | } |
326 | 326 | if ($msg) { |
327 | - $source .= ' / ' . $msg; |
|
327 | + $source .= ' / '.$msg; |
|
328 | 328 | } |
329 | 329 | if (isset($actionName) && !empty($actionName)) { |
330 | 330 | $source .= $actionName; |
@@ -361,13 +361,13 @@ discard block |
||
361 | 361 | |
362 | 362 | // Display error |
363 | 363 | if ($this->shouldDisplay()) { |
364 | - echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager ' . $version . ' » ' . $release_date . '</title> |
|
364 | + echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager '.$version.' » '.$release_date.'</title> |
|
365 | 365 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
366 | - <link rel="stylesheet" type="text/css" href="' . MODX_MANAGER_URL . 'media/style/' . $this->container->getConfig('manager_theme', |
|
367 | - 'default') . '/style.css" /> |
|
366 | + <link rel="stylesheet" type="text/css" href="' . MODX_MANAGER_URL.'media/style/'.$this->container->getConfig('manager_theme', |
|
367 | + 'default').'/style.css" /> |
|
368 | 368 | <style type="text/css">body { padding:10px; } td {font:inherit;}</style> |
369 | 369 | </head><body> |
370 | - ' . $str . '</body></html>'; |
|
370 | + ' . $str.'</body></html>'; |
|
371 | 371 | |
372 | 372 | } else { |
373 | 373 | echo 'Error'; |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | switch (get_by_key($val, 'type')) { |
408 | 408 | case '->': |
409 | 409 | case '::': |
410 | - $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function']; |
|
410 | + $functionName = $val['function'] = $val['class'].$val['type'].$val['function']; |
|
411 | 411 | break; |
412 | 412 | default: |
413 | 413 | $functionName = $val['function']; |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | $args = array_pad(array(), $_, '$var'); |
418 | 418 | $args = implode(", ", $args); |
419 | 419 | $modx = &$this; |
420 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
420 | + $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) { |
|
421 | 421 | $arg = $val['args'][$tmp - 1]; |
422 | 422 | switch (true) { |
423 | 423 | case is_null($arg): |
@@ -432,8 +432,8 @@ discard block |
||
432 | 432 | } |
433 | 433 | case is_scalar($arg): |
434 | 434 | { |
435 | - $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->container->getPhpCompat()->htmlspecialchars(str_replace("'", |
|
436 | - "\\'", $arg)) . "'"); |
|
435 | + $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->container->getPhpCompat()->htmlspecialchars(str_replace("'", |
|
436 | + "\\'", $arg))."'"); |
|
437 | 437 | break; |
438 | 438 | } |
439 | 439 | case is_bool($arg): |
@@ -443,17 +443,17 @@ discard block |
||
443 | 443 | } |
444 | 444 | case is_array($arg): |
445 | 445 | { |
446 | - $out = 'array $var' . $tmp; |
|
446 | + $out = 'array $var'.$tmp; |
|
447 | 447 | break; |
448 | 448 | } |
449 | 449 | case is_object($arg): |
450 | 450 | { |
451 | - $out = get_class($arg) . ' $var' . $tmp; |
|
451 | + $out = get_class($arg).' $var'.$tmp; |
|
452 | 452 | break; |
453 | 453 | } |
454 | 454 | default: |
455 | 455 | { |
456 | - $out = '$var' . $tmp; |
|
456 | + $out = '$var'.$tmp; |
|
457 | 457 | } |
458 | 458 | } |
459 | 459 | $tmp++; |
@@ -461,8 +461,8 @@ discard block |
||
461 | 461 | return $out; |
462 | 462 | }, $args); |
463 | 463 | $line = array( |
464 | - "<strong>" . $functionName . "</strong>(" . $args . ")", |
|
465 | - $path . " on line " . $val['line'] |
|
464 | + "<strong>".$functionName."</strong>(".$args.")", |
|
465 | + $path." on line ".$val['line'] |
|
466 | 466 | ); |
467 | 467 | $table[] = array(implode("<br />", $line)); |
468 | 468 | } |
@@ -417,7 +417,7 @@ |
||
417 | 417 | $args = array_pad(array(), $_, '$var'); |
418 | 418 | $args = implode(", ", $args); |
419 | 419 | $modx = &$this; |
420 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
420 | + $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){ |
|
421 | 421 | $arg = $val['args'][$tmp - 1]; |
422 | 422 | switch (true) { |
423 | 423 | case is_null($arg): |
@@ -19,6 +19,7 @@ discard block |
||
19 | 19 | * @param string $phpCode |
20 | 20 | * @param string $namespace |
21 | 21 | * @param array defaultParams |
22 | + * @return void |
|
22 | 23 | */ |
23 | 24 | public function addSnippet($name, $phpCode, $namespace = '#', array $defaultParams = array()); |
24 | 25 | |
@@ -26,6 +27,7 @@ discard block |
||
26 | 27 | * @param string $name |
27 | 28 | * @param string $text |
28 | 29 | * @param string $namespace |
30 | + * @return void |
|
29 | 31 | */ |
30 | 32 | public function addChunk($name, $text, $namespace = '#'); |
31 | 33 |
@@ -4,8 +4,14 @@ discard block |
||
4 | 4 | |
5 | 5 | interface ControllerInterface |
6 | 6 | { |
7 | + /** |
|
8 | + * @return void |
|
9 | + */ |
|
7 | 10 | public function __construct(ManagerThemeInterface $managerTheme, array $data = []); |
8 | 11 | |
12 | + /** |
|
13 | + * @return string |
|
14 | + */ |
|
9 | 15 | public function getView() : ?string; |
10 | 16 | |
11 | 17 | public function setView($view) : bool; |
@@ -24,6 +30,9 @@ discard block |
||
24 | 30 | |
25 | 31 | public function render(array $params = []) : string; |
26 | 32 | |
33 | + /** |
|
34 | + * @return void |
|
35 | + */ |
|
27 | 36 | public function setIndex($index) : void; |
28 | 37 | |
29 | 38 | public function getElementId() : int; |
@@ -6,11 +6,15 @@ |
||
6 | 6 | |
7 | 7 | public function getLang() : string; |
8 | 8 | |
9 | + /** |
|
10 | + * @param string $key |
|
11 | + */ |
|
9 | 12 | public function getStyle($key = null); |
10 | 13 | |
11 | 14 | /** |
12 | 15 | * @param string $message |
13 | 16 | * @param bool $lexicon |
17 | + * @return void |
|
14 | 18 | */ |
15 | 19 | public function alertAndQuit(string $message, $lexicon = true) : void; |
16 | 20 | } |
@@ -252,7 +252,7 @@ |
||
252 | 252 | /** |
253 | 253 | * build siteCache file |
254 | 254 | * @param Interfaces\CoreInterface $modx |
255 | - * @return boolean success |
|
255 | + * @return null|boolean success |
|
256 | 256 | */ |
257 | 257 | public function buildCache($modx) |
258 | 258 | { |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | if (isset($this->aliases[$id])) { |
102 | 102 | if ($this->aliasVisible[$id] == 1) { |
103 | 103 | if ($path != '') { |
104 | - $path = $this->aliases[$id] . '/' . $path; |
|
104 | + $path = $this->aliases[$id].'/'.$path; |
|
105 | 105 | } else { |
106 | 106 | $path = $this->aliases[$id]; |
107 | 107 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $modx->getService('ExceptionHandler')->messageQuit("Cache path not set."); |
126 | 126 | } |
127 | 127 | |
128 | - $files = glob(realpath($this->cachePath) . '/*.pageCache.php'); |
|
128 | + $files = glob(realpath($this->cachePath).'/*.pageCache.php'); |
|
129 | 129 | $filesincache = count($files); |
130 | 130 | $deletedfiles = array(); |
131 | 131 | while ($file = array_shift($files)) { |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | if (isset($opcache)) { |
161 | 161 | echo '<p>Opcache empty.</p>'; |
162 | 162 | } |
163 | - echo '<p>' . $_lang['cache_files_deleted'] . '</p><ul>'; |
|
163 | + echo '<p>'.$_lang['cache_files_deleted'].'</p><ul>'; |
|
164 | 164 | foreach ($deletedfiles as $deletedfile) { |
165 | - echo '<li>' . $deletedfile . '</li>'; |
|
165 | + echo '<li>'.$deletedfile.'</li>'; |
|
166 | 166 | } |
167 | 167 | echo '</ul>'; |
168 | 168 | } |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | |
182 | 182 | |
183 | 183 | // write the file |
184 | - $content = '<?php' . "\n"; |
|
185 | - $content .= '$recent_update=\'' . $this->request_time . '\';' . "\n"; |
|
186 | - $content .= '$cacheRefreshTime=\'' . $cacheRefreshTime . '\';' . "\n"; |
|
184 | + $content = '<?php'."\n"; |
|
185 | + $content .= '$recent_update=\''.$this->request_time.'\';'."\n"; |
|
186 | + $content .= '$cacheRefreshTime=\''.$cacheRefreshTime.'\';'."\n"; |
|
187 | 187 | |
188 | 188 | $filename = evolutionCMS()->getSitePublishingFilePath(); |
189 | 189 | if (!$handle = fopen($filename, 'w')) { |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $result = $modx->getDatabase()->select( |
212 | 212 | 'MIN(pub_date) AS minpub', |
213 | 213 | $modx->getDatabase()->getFullTableName('site_content'), |
214 | - 'pub_date>' . $this->request_time |
|
214 | + 'pub_date>'.$this->request_time |
|
215 | 215 | ); |
216 | 216 | if (!$result) { |
217 | 217 | echo "Couldn't determine next publish event!"; |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $result = $modx->getDatabase()->select( |
226 | 226 | 'MIN(unpub_date) AS minunpub', |
227 | 227 | $modx->getDatabase()->getFullTableName('site_content'), |
228 | - 'unpub_date>' . $this->request_time |
|
228 | + 'unpub_date>'.$this->request_time |
|
229 | 229 | ); |
230 | 230 | if (!$result) { |
231 | 231 | echo "Couldn't determine next unpublish event!"; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $config = array(); |
266 | 266 | $content .= '$c=&$this->config;'; |
267 | 267 | while (list($key, $value) = $modx->getDatabase()->getRow($rs, 'num')) { |
268 | - $content .= '$c[\'' . $modx->getDatabase()->escape($key) . '\']="' . $this->escapeDoubleQuotes($value) . '";'; |
|
268 | + $content .= '$c[\''.$modx->getDatabase()->escape($key).'\']="'.$this->escapeDoubleQuotes($value).'";'; |
|
269 | 269 | $config[$key] = $value; |
270 | 270 | } |
271 | 271 | |
@@ -282,8 +282,8 @@ discard block |
||
282 | 282 | $f['isfolder'] = 'c.isfolder'; |
283 | 283 | $f['alias_visible'] = 'c.alias_visible'; |
284 | 284 | $from = array(); |
285 | - $from[] = $modx->getDatabase()->getFullTableName('site_content') . ' c'; |
|
286 | - $from[] = 'LEFT JOIN ' . $modx->getDatabase()->getFullTableName('site_content') . ' p ON p.id=c.parent'; |
|
285 | + $from[] = $modx->getDatabase()->getFullTableName('site_content').' c'; |
|
286 | + $from[] = 'LEFT JOIN '.$modx->getDatabase()->getFullTableName('site_content').' p ON p.id=c.parent'; |
|
287 | 287 | $where = 'c.deleted=0 AND (c.isfolder=1 OR p.alias_visible=0)'; |
288 | 288 | $rs = $modx->getDatabase()->select($f, $from, $where, 'c.parent, c.menuindex'); |
289 | 289 | } else { |
@@ -305,16 +305,16 @@ discard block |
||
305 | 305 | $docid = $doc['id']; |
306 | 306 | if ($use_alias_path) { |
307 | 307 | $tmpPath = $this->getParents($doc['parent']); |
308 | - $alias = (strlen($tmpPath) > 0 ? "$tmpPath/" : '') . $doc['alias']; |
|
308 | + $alias = (strlen($tmpPath) > 0 ? "$tmpPath/" : '').$doc['alias']; |
|
309 | 309 | $key = $alias; |
310 | 310 | } else { |
311 | 311 | $key = $doc['alias']; |
312 | 312 | } |
313 | 313 | |
314 | 314 | $doc['path'] = $tmpPath; |
315 | - $content .= '$a[' . $docid . ']=array(\'id\'=>' . $docid . ',\'alias\'=>\'' . $doc['alias'] . '\',\'path\'=>\'' . $doc['path'] . '\',\'parent\'=>' . $doc['parent'] . ',\'isfolder\'=>' . $doc['isfolder'] . ',\'alias_visible\'=>' . $doc['alias_visible'] . ');'; |
|
316 | - $content .= '$d[\'' . $key . '\']=' . $docid . ';'; |
|
317 | - $content .= '$m[]=array(' . $doc['parent'] . '=>' . $docid . ');'; |
|
315 | + $content .= '$a['.$docid.']=array(\'id\'=>'.$docid.',\'alias\'=>\''.$doc['alias'].'\',\'path\'=>\''.$doc['path'].'\',\'parent\'=>'.$doc['parent'].',\'isfolder\'=>'.$doc['isfolder'].',\'alias_visible\'=>'.$doc['alias_visible'].');'; |
|
316 | + $content .= '$d[\''.$key.'\']='.$docid.';'; |
|
317 | + $content .= '$m[]=array('.$doc['parent'].'=>'.$docid.');'; |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | // get content types |
@@ -325,37 +325,37 @@ discard block |
||
325 | 325 | ); |
326 | 326 | $content .= '$c=&$this->contentTypes;'; |
327 | 327 | while ($doc = $modx->getDatabase()->getRow($rs)) { |
328 | - $content .= '$c[\'' . $doc['id'] . '\']=\'' . $doc['contentType'] . '\';'; |
|
328 | + $content .= '$c[\''.$doc['id'].'\']=\''.$doc['contentType'].'\';'; |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | // WRITE Chunks to cache file |
332 | 332 | $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('site_htmlsnippets')); |
333 | 333 | $content .= '$c=&$this->chunkCache;'; |
334 | 334 | while ($doc = $modx->getDatabase()->getRow($rs)) { |
335 | - $content .= '$c[\'' . $modx->getDatabase()->escape($doc['name']) . '\']=\'' . ($doc['disabled'] ? '' : $this->escapeSingleQuotes($doc['snippet'])) . '\';'; |
|
335 | + $content .= '$c[\''.$modx->getDatabase()->escape($doc['name']).'\']=\''.($doc['disabled'] ? '' : $this->escapeSingleQuotes($doc['snippet'])).'\';'; |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | // WRITE snippets to cache file |
339 | 339 | $f = 'ss.*, sm.properties as sharedproperties'; |
340 | - $from = $modx->getDatabase()->getFullTableName('site_snippets') . ' ss LEFT JOIN ' . |
|
341 | - $modx->getDatabase()->getFullTableName('site_modules') . ' sm on sm.guid=ss.moduleguid'; |
|
340 | + $from = $modx->getDatabase()->getFullTableName('site_snippets').' ss LEFT JOIN '. |
|
341 | + $modx->getDatabase()->getFullTableName('site_modules').' sm on sm.guid=ss.moduleguid'; |
|
342 | 342 | $rs = $modx->getDatabase()->select($f, $from); |
343 | 343 | $content .= '$s=&$this->snippetCache;'; |
344 | 344 | while ($row = $modx->getDatabase()->getRow($rs)) { |
345 | 345 | $key = $modx->getDatabase()->escape($row['name']); |
346 | 346 | if ($row['disabled']) { |
347 | - $content .= '$s[\'' . $key . '\']=\'return false;\';'; |
|
347 | + $content .= '$s[\''.$key.'\']=\'return false;\';'; |
|
348 | 348 | } else { |
349 | 349 | $value = trim($row['snippet']); |
350 | 350 | if ($modx->getConfig('minifyphp_incache')) { |
351 | 351 | $value = $this->php_strip_whitespace($value); |
352 | 352 | } |
353 | - $content .= '$s[\'' . $key . '\']=\'' . $this->escapeSingleQuotes($value) . '\';'; |
|
353 | + $content .= '$s[\''.$key.'\']=\''.$this->escapeSingleQuotes($value).'\';'; |
|
354 | 354 | $properties = $modx->parseProperties($row['properties']); |
355 | 355 | $sharedproperties = $modx->parseProperties($row['sharedproperties']); |
356 | 356 | $properties = array_merge($sharedproperties, $properties); |
357 | 357 | if (0 < count($properties)) { |
358 | - $content .= '$s[\'' . $key . 'Props\']=\'' . $this->escapeSingleQuotes(json_encode($properties)) . '\';'; |
|
358 | + $content .= '$s[\''.$key.'Props\']=\''.$this->escapeSingleQuotes(json_encode($properties)).'\';'; |
|
359 | 359 | } |
360 | 360 | } |
361 | 361 | } |
@@ -363,8 +363,8 @@ discard block |
||
363 | 363 | // WRITE plugins to cache file |
364 | 364 | $f = 'sp.*, sm.properties as sharedproperties'; |
365 | 365 | $from = []; |
366 | - $from[] = $modx->getDatabase()->getFullTableName('site_plugins') . ' sp'; |
|
367 | - $from[] = 'LEFT JOIN ' . $modx->getDatabase()->getFullTableName('site_modules') . ' sm on sm.guid=sp.moduleguid'; |
|
366 | + $from[] = $modx->getDatabase()->getFullTableName('site_plugins').' sp'; |
|
367 | + $from[] = 'LEFT JOIN '.$modx->getDatabase()->getFullTableName('site_modules').' sm on sm.guid=sp.moduleguid'; |
|
368 | 368 | $rs = $modx->getDatabase()->select($f, $from, 'sp.disabled=0'); |
369 | 369 | $content .= '$p=&$this->pluginCache;'; |
370 | 370 | while ($row = $modx->getDatabase()->getRow($rs)) { |
@@ -373,13 +373,13 @@ discard block |
||
373 | 373 | if ($modx->getConfig('minifyphp_incache')) { |
374 | 374 | $value = $this->php_strip_whitespace($value); |
375 | 375 | } |
376 | - $content .= '$p[\'' . $key . '\']=\'' . $this->escapeSingleQuotes($value) . '\';'; |
|
376 | + $content .= '$p[\''.$key.'\']=\''.$this->escapeSingleQuotes($value).'\';'; |
|
377 | 377 | if ($row['properties'] != '' || $row['sharedproperties'] != '') { |
378 | 378 | $properties = $modx->parseProperties($row['properties']); |
379 | 379 | $sharedproperties = $modx->parseProperties($row['sharedproperties']); |
380 | 380 | $properties = array_merge($sharedproperties, $properties); |
381 | 381 | if (0 < count($properties)) { |
382 | - $content .= '$p[\'' . $key . 'Props\']=\'' . $this->escapeSingleQuotes(json_encode($properties)) . '\';'; |
|
382 | + $content .= '$p[\''.$key.'Props\']=\''.$this->escapeSingleQuotes(json_encode($properties)).'\';'; |
|
383 | 383 | } |
384 | 384 | } |
385 | 385 | } |
@@ -387,9 +387,9 @@ discard block |
||
387 | 387 | // WRITE system event triggers |
388 | 388 | $f = 'sysevt.name as evtname, event.pluginid, plugin.name as pname'; |
389 | 389 | $from = array(); |
390 | - $from[] = $modx->getDatabase()->getFullTableName('system_eventnames') . ' sysevt'; |
|
391 | - $from[] = 'INNER JOIN ' . $modx->getDatabase()->getFullTableName('site_plugin_events') . ' event ON event.evtid=sysevt.id'; |
|
392 | - $from[] = 'INNER JOIN ' . $modx->getDatabase()->getFullTableName('site_plugins') . ' plugin ON plugin.id=event.pluginid'; |
|
390 | + $from[] = $modx->getDatabase()->getFullTableName('system_eventnames').' sysevt'; |
|
391 | + $from[] = 'INNER JOIN '.$modx->getDatabase()->getFullTableName('site_plugin_events').' event ON event.evtid=sysevt.id'; |
|
392 | + $from[] = 'INNER JOIN '.$modx->getDatabase()->getFullTableName('site_plugins').' plugin ON plugin.id=event.pluginid'; |
|
393 | 393 | $rs = $modx->getDatabase()->select($f, $from, 'plugin.disabled=0', 'sysevt.name, event.priority'); |
394 | 394 | $content .= '$e=&$this->pluginEvent;'; |
395 | 395 | $events = array(); |
@@ -402,8 +402,8 @@ discard block |
||
402 | 402 | } |
403 | 403 | foreach ($events as $evtname => $pluginnames) { |
404 | 404 | $events[$evtname] = $pluginnames; |
405 | - $content .= '$e[\'' . $evtname . '\']=array(\'' . implode('\',\'', |
|
406 | - $this->escapeSingleQuotes($pluginnames)) . '\');'; |
|
405 | + $content .= '$e[\''.$evtname.'\']=array(\''.implode('\',\'', |
|
406 | + $this->escapeSingleQuotes($pluginnames)).'\');'; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | $content .= "\n"; |
@@ -418,8 +418,8 @@ discard block |
||
418 | 418 | exit("Cannot write main Evolution CMS cache file! Make sure the assets/cache directory is writable!"); |
419 | 419 | } |
420 | 420 | |
421 | - if (!is_file($this->cachePath . '/.htaccess')) { |
|
422 | - file_put_contents($this->cachePath . '/.htaccess', "order deny,allow\ndeny from all\n"); |
|
421 | + if (!is_file($this->cachePath.'/.htaccess')) { |
|
422 | + file_put_contents($this->cachePath.'/.htaccess', "order deny,allow\ndeny from all\n"); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | // invoke OnCacheUpdate event |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | |
440 | 440 | $source = trim($source); |
441 | 441 | if (substr($source, 0, 5) !== '<?php') { |
442 | - $source = '<?php ' . $source; |
|
442 | + $source = '<?php '.$source; |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | $tokens = token_get_all($source); |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | } |
498 | 498 | } |
499 | 499 | $source = preg_replace(array('@^<\?php@i', '|\s+|', '|<!--|', '|-->|', '|-->\s+<!--|'), |
500 | - array('', ' ', "\n" . '<!--', '-->' . "\n", '-->' . "\n" . '<!--'), $_); |
|
500 | + array('', ' ', "\n".'<!--', '-->'."\n", '-->'."\n".'<!--'), $_); |
|
501 | 501 | $source = trim($source); |
502 | 502 | |
503 | 503 | return $source; |
@@ -82,7 +82,8 @@ discard block |
||
82 | 82 | * @return string |
83 | 83 | */ |
84 | 84 | public function getParents($id, $path = '') |
85 | - { // modx:returns child's parent |
|
85 | + { |
|
86 | +// modx:returns child's parent |
|
86 | 87 | $modx = evolutionCMS(); |
87 | 88 | if (empty($this->aliases)) { |
88 | 89 | $rs = $modx->getDatabase()->select( |
@@ -481,7 +482,8 @@ discard block |
||
481 | 482 | $_ = trim($_); |
482 | 483 | } |
483 | 484 | $lastChar = substr($_, -1); |
484 | - if (!in_array($lastChar, $chars)) {// ,320,327,288,284,289 |
|
485 | + if (!in_array($lastChar, $chars)) { |
|
486 | +// ,320,327,288,284,289 |
|
485 | 487 | if (!in_array($prev_token, |
486 | 488 | array(T_FOREACH, T_WHILE, T_FOR, T_BOOLEAN_AND, T_BOOLEAN_OR, T_DOUBLE_ARROW))) { |
487 | 489 | $_ .= ' '; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | /** |
102 | 102 | * @param string $mode |
103 | 103 | * @param string $modifiers |
104 | - * @return bool|string |
|
104 | + * @return false|string |
|
105 | 105 | */ |
106 | 106 | public function _getDelim($mode, $modifiers) |
107 | 107 | { |
@@ -151,6 +151,13 @@ discard block |
||
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | + /** |
|
155 | + * @param string $mode |
|
156 | + * @param false|string $delim |
|
157 | + * @param string $modifiers |
|
158 | + * |
|
159 | + * @return string |
|
160 | + */ |
|
154 | 161 | public function _getRemainModifiers($mode, $delim, $modifiers) |
155 | 162 | { |
156 | 163 | if ($delim) { |
@@ -187,6 +194,9 @@ discard block |
||
187 | 194 | return substr($string, strpos($string, $delim) + $len); |
188 | 195 | } |
189 | 196 | |
197 | + /** |
|
198 | + * @param string $modifiers |
|
199 | + */ |
|
190 | 200 | public function splitEachModifiers($modifiers) |
191 | 201 | { |
192 | 202 | $modx = evolutionCMS(); |
@@ -259,6 +269,10 @@ discard block |
||
259 | 269 | return $result; |
260 | 270 | } |
261 | 271 | |
272 | + /** |
|
273 | + * @param string $key |
|
274 | + * @param string $value |
|
275 | + */ |
|
262 | 276 | public function parsePhx($key, $value, $modifiers) |
263 | 277 | { |
264 | 278 | $modx = evolutionCMS(); |
@@ -340,6 +354,10 @@ discard block |
||
340 | 354 | } |
341 | 355 | } |
342 | 356 | |
357 | + /** |
|
358 | + * @param string $cmd |
|
359 | + * @param string $opt |
|
360 | + */ |
|
343 | 361 | public function getValueFromPreset($key, $value, $cmd, $opt) |
344 | 362 | { |
345 | 363 | $modx = evolutionCMS(); |
@@ -1285,6 +1303,9 @@ discard block |
||
1285 | 1303 | return $value; |
1286 | 1304 | } |
1287 | 1305 | |
1306 | + /** |
|
1307 | + * @param string $cmd |
|
1308 | + */ |
|
1288 | 1309 | public function includeMdfFile($cmd) |
1289 | 1310 | { |
1290 | 1311 | $modx = evolutionCMS(); |
@@ -1477,6 +1498,10 @@ discard block |
||
1477 | 1498 | } |
1478 | 1499 | |
1479 | 1500 | // Sets a placeholder variable which can only be access by Modifiers |
1501 | + |
|
1502 | + /** |
|
1503 | + * @param string $value |
|
1504 | + */ |
|
1480 | 1505 | public function setModifiersVariable($key, $value) |
1481 | 1506 | { |
1482 | 1507 | if ($key != 'phx' && $key != 'dummy') { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | $this->srcValue = $value; |
84 | 84 | $modifiers = trim($modifiers); |
85 | - $modifiers = ':' . trim($modifiers, ':'); |
|
85 | + $modifiers = ':'.trim($modifiers, ':'); |
|
86 | 86 | $modifiers = str_replace(array("\r\n", "\r"), "\n", $modifiers); |
87 | 87 | $modifiers = $this->splitEachModifiers($modifiers); |
88 | 88 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | { |
130 | 130 | if ($delim) { |
131 | 131 | if ($mode == '(') { |
132 | - return substr($modifiers, 1, strpos($modifiers, $delim . ')') - 1); |
|
132 | + return substr($modifiers, 1, strpos($modifiers, $delim.')') - 1); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | return substr($modifiers, 1, strpos($modifiers, $delim, 1) - 1); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | { |
156 | 156 | if ($delim) { |
157 | 157 | if ($mode == '(') { |
158 | - return $this->_fetchContent($modifiers, $delim . ')'); |
|
158 | + return $this->_fetchContent($modifiers, $delim.')'); |
|
159 | 159 | } else { |
160 | 160 | $modifiers = trim($modifiers); |
161 | 161 | $modifiers = substr($modifiers, 1); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | } elseif (in_array($c, array('+', '-', '*', '/')) && preg_match('@^[0-9]+@', $modifiers, |
218 | 218 | $match)) { // :+3, :-3, :*3 ... |
219 | 219 | $modifiers = substr($modifiers, strlen($match[0])); |
220 | - $result[] = array('cmd' => 'math', 'opt' => '%s' . $c . $match[0]); |
|
220 | + $result[] = array('cmd' => 'math', 'opt' => '%s'.$c.$match[0]); |
|
221 | 221 | $cmd = ''; |
222 | 222 | } elseif ($c === '(' || $c === '=') { |
223 | 223 | $modifiers = $m1 = trim($modifiers); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | } |
333 | 333 | |
334 | 334 | $_ = explode(',', |
335 | - $this->condModifiers . ',_default,default,if,input,or,and,show,this,select,switch,then,else,id,ifempty,smart_desc,smart_description,summary'); |
|
335 | + $this->condModifiers.',_default,default,if,input,or,and,show,this,select,switch,then,else,id,ifempty,smart_desc,smart_description,summary'); |
|
336 | 336 | if (in_array($cmd, $_)) { |
337 | 337 | return false; |
338 | 338 | } else { |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | case 'eq': |
366 | 366 | case 'is': |
367 | 367 | case 'equals': |
368 | - $this->condition[] = (int)($value == $opt); |
|
368 | + $this->condition[] = (int) ($value == $opt); |
|
369 | 369 | break; |
370 | 370 | case 'neq': |
371 | 371 | case 'ne': |
@@ -373,59 +373,59 @@ discard block |
||
373 | 373 | case 'isnot': |
374 | 374 | case 'isnt': |
375 | 375 | case 'not': |
376 | - $this->condition[] = (int)($value != $opt); |
|
376 | + $this->condition[] = (int) ($value != $opt); |
|
377 | 377 | break; |
378 | 378 | case '%': |
379 | - $this->condition[] = (int)($value % $opt == 0); |
|
379 | + $this->condition[] = (int) ($value % $opt == 0); |
|
380 | 380 | break; |
381 | 381 | case 'isempty': |
382 | - $this->condition[] = (int)(empty($value)); |
|
382 | + $this->condition[] = (int) (empty($value)); |
|
383 | 383 | break; |
384 | 384 | case 'isntempty': |
385 | 385 | case 'isnotempty': |
386 | - $this->condition[] = (int)(!empty($value)); |
|
386 | + $this->condition[] = (int) (!empty($value)); |
|
387 | 387 | break; |
388 | 388 | case '>=': |
389 | 389 | case 'gte': |
390 | 390 | case 'eg': |
391 | 391 | case 'isgte': |
392 | - $this->condition[] = (int)($value >= $opt); |
|
392 | + $this->condition[] = (int) ($value >= $opt); |
|
393 | 393 | break; |
394 | 394 | case '<=': |
395 | 395 | case 'lte': |
396 | 396 | case 'el': |
397 | 397 | case 'islte': |
398 | - $this->condition[] = (int)($value <= $opt); |
|
398 | + $this->condition[] = (int) ($value <= $opt); |
|
399 | 399 | break; |
400 | 400 | case '>': |
401 | 401 | case 'gt': |
402 | 402 | case 'greaterthan': |
403 | 403 | case 'isgreaterthan': |
404 | 404 | case 'isgt': |
405 | - $this->condition[] = (int)($value > $opt); |
|
405 | + $this->condition[] = (int) ($value > $opt); |
|
406 | 406 | break; |
407 | 407 | case '<': |
408 | 408 | case 'lt': |
409 | 409 | case 'lowerthan': |
410 | 410 | case 'islowerthan': |
411 | 411 | case 'islt': |
412 | - $this->condition[] = (int)($value < $opt); |
|
412 | + $this->condition[] = (int) ($value < $opt); |
|
413 | 413 | break; |
414 | 414 | case 'find': |
415 | - $this->condition[] = (int)(strpos($value, $opt) !== false); |
|
415 | + $this->condition[] = (int) (strpos($value, $opt) !== false); |
|
416 | 416 | break; |
417 | 417 | case 'inarray': |
418 | 418 | case 'in_array': |
419 | 419 | case 'in': |
420 | 420 | $opt = explode(',', $opt); |
421 | - $this->condition[] = (int)(in_array($value, $opt) !== false); |
|
421 | + $this->condition[] = (int) (in_array($value, $opt) !== false); |
|
422 | 422 | break; |
423 | 423 | case 'wildcard_match': |
424 | 424 | case 'wcard_match': |
425 | 425 | case 'wildcard': |
426 | 426 | case 'wcard': |
427 | 427 | case 'fnmatch': |
428 | - $this->condition[] = (int)(fnmatch($opt, $value) !== false); |
|
428 | + $this->condition[] = (int) (fnmatch($opt, $value) !== false); |
|
429 | 429 | break; |
430 | 430 | case 'is_file': |
431 | 431 | case 'is_dir': |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | if (strpos($path, MODX_BASE_PATH) === false) { |
444 | 444 | $path = ltrim($path, '/'); |
445 | 445 | } |
446 | - $this->condition[] = (int)($cmd($path) !== false); |
|
446 | + $this->condition[] = (int) ($cmd($path) !== false); |
|
447 | 447 | break; |
448 | 448 | case 'is_image': |
449 | 449 | if (!$opt) { |
@@ -456,13 +456,13 @@ discard block |
||
456 | 456 | break; |
457 | 457 | } |
458 | 458 | $_ = getimagesize($path); |
459 | - $this->condition[] = (int)($_[0]); |
|
459 | + $this->condition[] = (int) ($_[0]); |
|
460 | 460 | break; |
461 | 461 | case 'regex': |
462 | 462 | case 'preg': |
463 | 463 | case 'preg_match': |
464 | 464 | case 'isinrole': |
465 | - $this->condition[] = (int)(preg_match($opt, $value)); |
|
465 | + $this->condition[] = (int) (preg_match($opt, $value)); |
|
466 | 466 | break; |
467 | 467 | case 'ir': |
468 | 468 | case 'memberof': |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | case 'show': |
480 | 480 | case 'this': |
481 | 481 | $conditional = implode(' ', $this->condition); |
482 | - $isvalid = (int)(eval("return ({$conditional});")); |
|
482 | + $isvalid = (int) (eval("return ({$conditional});")); |
|
483 | 483 | if ($isvalid) { |
484 | 484 | return $this->srcValue; |
485 | 485 | } |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | return null; |
488 | 488 | case 'then': |
489 | 489 | $conditional = implode(' ', $this->condition); |
490 | - $isvalid = (int)eval("return ({$conditional});"); |
|
490 | + $isvalid = (int) eval("return ({$conditional});"); |
|
491 | 491 | if ($isvalid) { |
492 | 492 | return $opt; |
493 | 493 | } |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | return null; |
496 | 496 | case 'else': |
497 | 497 | $conditional = implode(' ', $this->condition); |
498 | - $isvalid = (int)eval("return ({$conditional});"); |
|
498 | + $isvalid = (int) eval("return ({$conditional});"); |
|
499 | 499 | if (!$isvalid) { |
500 | 500 | return $opt; |
501 | 501 | } |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | return $this->strpos($value, $opt); |
655 | 655 | case 'wordwrap': |
656 | 656 | // default: 70 |
657 | - $wrapat = (int)$opt > 0 ? (int)$opt : 70; |
|
657 | + $wrapat = (int) $opt > 0 ? (int) $opt : 70; |
|
658 | 658 | if (version_compare(PHP_VERSION, '5.3.0') >= 0) { |
659 | 659 | return $this->includeMdfFile('wordwrap'); |
660 | 660 | } else { |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | if (strpos($opt, ',') !== false) { |
687 | 687 | list($b, $e) = explode(',', $opt, 2); |
688 | 688 | |
689 | - return $this->substr($value, $b, (int)$e); |
|
689 | + return $this->substr($value, $b, (int) $e); |
|
690 | 690 | } else { |
691 | 691 | return $this->substr($value, $opt); |
692 | 692 | } |
@@ -705,9 +705,9 @@ discard block |
||
705 | 705 | $str = ''; |
706 | 706 | } |
707 | 707 | if (preg_match('/^[1-9][0-9]*$/', $len)) { |
708 | - return $this->substr($value, 0, $len) . $str; |
|
708 | + return $this->substr($value, 0, $len).$str; |
|
709 | 709 | } elseif (preg_match('/^\-[1-9][0-9]*$/', $len)) { |
710 | - return $str . $this->substr($value, $len); |
|
710 | + return $str.$this->substr($value, $len); |
|
711 | 711 | } |
712 | 712 | break; |
713 | 713 | case 'summary': |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | case 'concatenate': |
773 | 773 | case '.': |
774 | 774 | if ($value !== '') { |
775 | - return $value . $opt; |
|
775 | + return $value.$opt; |
|
776 | 776 | } |
777 | 777 | break; |
778 | 778 | case 'sprintf': |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | case 'money_format': |
791 | 791 | setlocale(LC_MONETARY, setlocale(LC_TIME, 0)); |
792 | 792 | if ($value !== '') { |
793 | - return money_format($opt, (double)$value); |
|
793 | + return money_format($opt, (double) $value); |
|
794 | 794 | } |
795 | 795 | break; |
796 | 796 | case 'tobool': |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | return strtotime($value); |
866 | 866 | ##### mathematical function |
867 | 867 | case 'toint': |
868 | - return (int)$value; |
|
868 | + return (int) $value; |
|
869 | 869 | case 'tofloat': |
870 | 870 | return floatval($value); |
871 | 871 | case 'round': |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | return $cmd($value); |
884 | 884 | case 'math': |
885 | 885 | case 'calc': |
886 | - $value = (int)$value; |
|
886 | + $value = (int) $value; |
|
887 | 887 | if (empty($value)) { |
888 | 888 | $value = '0'; |
889 | 889 | } |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | $where = implode(' AND ', $where); |
1027 | 1027 | $children = $modx->getDocumentChildren($value, $published, '0', 'id', $where); |
1028 | 1028 | $result = array(); |
1029 | - foreach ((array)$children as $child) { |
|
1029 | + foreach ((array) $children as $child) { |
|
1030 | 1030 | $result[] = $child['id']; |
1031 | 1031 | } |
1032 | 1032 | |
@@ -1130,7 +1130,7 @@ discard block |
||
1130 | 1130 | $opt .= '/'; |
1131 | 1131 | } |
1132 | 1132 | |
1133 | - $filename = MODX_BASE_PATH . $opt . $filename; |
|
1133 | + $filename = MODX_BASE_PATH.$opt.$filename; |
|
1134 | 1134 | |
1135 | 1135 | if (is_file($filename)) { |
1136 | 1136 | clearstatcache(); |
@@ -1291,7 +1291,7 @@ discard block |
||
1291 | 1291 | $value = $this->value; |
1292 | 1292 | $opt = $this->opt; |
1293 | 1293 | |
1294 | - return include(MODX_MANAGER_PATH . "includes/extenders/modifiers/mdf_{$cmd}.inc.php"); |
|
1294 | + return include(MODX_MANAGER_PATH."includes/extenders/modifiers/mdf_{$cmd}.inc.php"); |
|
1295 | 1295 | } |
1296 | 1296 | |
1297 | 1297 | public function getValueFromElement($key, $value, $cmd, $opt) |
@@ -1311,13 +1311,13 @@ discard block |
||
1311 | 1311 | $row = $modx->getDatabase()->getRow($result); |
1312 | 1312 | $php = $row['snippet']; |
1313 | 1313 | } elseif ($total == 0) { |
1314 | - $assets_path = MODX_BASE_PATH . 'assets/'; |
|
1315 | - if (is_file($assets_path . "modifiers/mdf_{$cmd}.inc.php")) { |
|
1316 | - $modifiers_path = $assets_path . "modifiers/mdf_{$cmd}.inc.php"; |
|
1317 | - } elseif (is_file($assets_path . "plugins/phx/modifiers/{$cmd}.phx.php")) { |
|
1318 | - $modifiers_path = $assets_path . "plugins/phx/modifiers/{$cmd}.phx.php"; |
|
1319 | - } elseif (is_file(MODX_MANAGER_PATH . "includes/extenders/modifiers/mdf_{$cmd}.inc.php")) { |
|
1320 | - $modifiers_path = MODX_MANAGER_PATH . "includes/extenders/modifiers/mdf_{$cmd}.inc.php"; |
|
1314 | + $assets_path = MODX_BASE_PATH.'assets/'; |
|
1315 | + if (is_file($assets_path."modifiers/mdf_{$cmd}.inc.php")) { |
|
1316 | + $modifiers_path = $assets_path."modifiers/mdf_{$cmd}.inc.php"; |
|
1317 | + } elseif (is_file($assets_path."plugins/phx/modifiers/{$cmd}.phx.php")) { |
|
1318 | + $modifiers_path = $assets_path."plugins/phx/modifiers/{$cmd}.phx.php"; |
|
1319 | + } elseif (is_file(MODX_MANAGER_PATH."includes/extenders/modifiers/mdf_{$cmd}.inc.php")) { |
|
1320 | + $modifiers_path = MODX_MANAGER_PATH."includes/extenders/modifiers/mdf_{$cmd}.inc.php"; |
|
1321 | 1321 | } else { |
1322 | 1322 | $modifiers_path = false; |
1323 | 1323 | } |
@@ -1335,7 +1335,7 @@ discard block |
||
1335 | 1335 | $php = substr($php, 0, -2); |
1336 | 1336 | } |
1337 | 1337 | if ($this->elmName !== '') { |
1338 | - $modx->snippetCache[$this->elmName . 'Props'] = ''; |
|
1338 | + $modx->snippetCache[$this->elmName.'Props'] = ''; |
|
1339 | 1339 | } |
1340 | 1340 | } else { |
1341 | 1341 | $php = false; |
@@ -1372,7 +1372,7 @@ discard block |
||
1372 | 1372 | $custom = eval($php); |
1373 | 1373 | $msg = ob_get_contents(); |
1374 | 1374 | if ($value === $this->bt) { |
1375 | - $value = $msg . $custom; |
|
1375 | + $value = $msg.$custom; |
|
1376 | 1376 | } |
1377 | 1377 | ob_end_clean(); |
1378 | 1378 | } elseif ($html !== false && isset($value) && $value !== '') { |
@@ -1546,7 +1546,7 @@ discard block |
||
1546 | 1546 | public function ucfirst($str) |
1547 | 1547 | { |
1548 | 1548 | if (function_exists('mb_strtoupper')) { |
1549 | - return mb_strtoupper($this->substr($str, 0, 1)) . $this->substr($str, 1, $this->strlen($str)); |
|
1549 | + return mb_strtoupper($this->substr($str, 0, 1)).$this->substr($str, 1, $this->strlen($str)); |
|
1550 | 1550 | } |
1551 | 1551 | |
1552 | 1552 | return ucfirst($str); |
@@ -1555,7 +1555,7 @@ discard block |
||
1555 | 1555 | public function lcfirst($str) |
1556 | 1556 | { |
1557 | 1557 | if (function_exists('mb_strtolower')) { |
1558 | - return mb_strtolower($this->substr($str, 0, 1)) . $this->substr($str, 1, $this->strlen($str)); |
|
1558 | + return mb_strtolower($this->substr($str, 0, 1)).$this->substr($str, 1, $this->strlen($str)); |
|
1559 | 1559 | } |
1560 | 1560 | |
1561 | 1561 | return lcfirst($str); |
@@ -199,7 +199,8 @@ discard block |
||
199 | 199 | $c = substr($modifiers, 0, 1); |
200 | 200 | $modifiers = substr($modifiers, 1); |
201 | 201 | |
202 | - if ($c === ':' && preg_match('@^(!?[<>=]{1,2})@', $modifiers, $match)) { // :=, :!=, :<=, :>=, :!<=, :!>= |
|
202 | + if ($c === ':' && preg_match('@^(!?[<>=]{1,2})@', $modifiers, $match)) { |
|
203 | +// :=, :!=, :<=, :>=, :!<=, :!>= |
|
203 | 204 | $c = substr($modifiers, strlen($match[1]), 1); |
204 | 205 | $debuginfo = "#i=0 #c=[{$c}] #m=[{$modifiers}]"; |
205 | 206 | if ($c === '(') { |
@@ -215,7 +216,8 @@ discard block |
||
215 | 216 | $result[] = array('cmd' => trim($match[1]), 'opt' => $opt, 'debuginfo' => $debuginfo); |
216 | 217 | $cmd = ''; |
217 | 218 | } elseif (in_array($c, array('+', '-', '*', '/')) && preg_match('@^[0-9]+@', $modifiers, |
218 | - $match)) { // :+3, :-3, :*3 ... |
|
219 | + $match)) { |
|
220 | +// :+3, :-3, :*3 ... |
|
219 | 221 | $modifiers = substr($modifiers, strlen($match[0])); |
220 | 222 | $result[] = array('cmd' => 'math', 'opt' => '%s' . $c . $match[0]); |
221 | 223 | $cmd = ''; |