@@ -11,28 +11,28 @@ |
||
11 | 11 | $current_path = str_replace(strpos($current_path, "\\\\", 2) ? "\\\\" : DIRECTORY_SEPARATOR, '/', $current_path); |
12 | 12 | } |
13 | 13 | $url_arr = explode('/', strstr($current_path, '/modules/')); |
14 | -include XOOPS_ROOT_PATH . '/modules/' . $url_arr[2] . '/include/vars.php'; |
|
14 | +include XOOPS_ROOT_PATH.'/modules/'.$url_arr[2].'/include/vars.php'; |
|
15 | 15 | |
16 | -if (defined($GLOBALS['VAR_PREFIXU'] . '_LANG_EN_BLOCKS')) { |
|
16 | +if (defined($GLOBALS['VAR_PREFIXU'].'_LANG_EN_BLOCKS')) { |
|
17 | 17 | return; |
18 | 18 | } |
19 | -define($GLOBALS['VAR_PREFIXU'] . '_LANG_EN_BLOCKS', 1); |
|
19 | +define($GLOBALS['VAR_PREFIXU'].'_LANG_EN_BLOCKS', 1); |
|
20 | 20 | |
21 | -define($GLOBALS['VAR_PREFIXU'] . '_MB_TYPE', 'Type'); |
|
22 | -define($GLOBALS['VAR_PREFIXU'] . '_MB_TYPE_TIME', 'Publish time'); |
|
23 | -define($GLOBALS['VAR_PREFIXU'] . '_MB_TYPE_VIEWS', 'Views'); |
|
24 | -define($GLOBALS['VAR_PREFIXU'] . '_MB_TYPE_RATES', 'Rate times'); |
|
25 | -define($GLOBALS['VAR_PREFIXU'] . '_MB_TYPE_RATING', 'Rating'); |
|
26 | -define($GLOBALS['VAR_PREFIXU'] . '_MB_TYPE_RANDOM', 'Random'); |
|
27 | -define($GLOBALS['VAR_PREFIXU'] . '_MB_TYPE_BOOKMARKS', 'Bookmarks'); |
|
28 | -define($GLOBALS['VAR_PREFIXU'] . '_MB_TYPE_FEATURED', 'Featured'); |
|
29 | -define($GLOBALS['VAR_PREFIXU'] . '_MB_ITEMS', 'Item count'); |
|
30 | -define($GLOBALS['VAR_PREFIXU'] . '_MB_TITLE_LENGTH', 'Title length'); |
|
31 | -define($GLOBALS['VAR_PREFIXU'] . '_MB_TIMEFORMAT', 'Time format'); |
|
32 | -define($GLOBALS['VAR_PREFIXU'] . '_MB_TIMEFORMAT_CUSTOM', 'Custom'); |
|
33 | -define($GLOBALS['VAR_PREFIXU'] . '_MB_SUMMARY_LENGTH', 'Show summary length'); |
|
34 | -define($GLOBALS['VAR_PREFIXU'] . '_MB_SHOWDESC', 'Show description'); |
|
35 | -define($GLOBALS['VAR_PREFIXU'] . '_MB_CATEGORYLIST', 'Allowed categories'); |
|
21 | +define($GLOBALS['VAR_PREFIXU'].'_MB_TYPE', 'Type'); |
|
22 | +define($GLOBALS['VAR_PREFIXU'].'_MB_TYPE_TIME', 'Publish time'); |
|
23 | +define($GLOBALS['VAR_PREFIXU'].'_MB_TYPE_VIEWS', 'Views'); |
|
24 | +define($GLOBALS['VAR_PREFIXU'].'_MB_TYPE_RATES', 'Rate times'); |
|
25 | +define($GLOBALS['VAR_PREFIXU'].'_MB_TYPE_RATING', 'Rating'); |
|
26 | +define($GLOBALS['VAR_PREFIXU'].'_MB_TYPE_RANDOM', 'Random'); |
|
27 | +define($GLOBALS['VAR_PREFIXU'].'_MB_TYPE_BOOKMARKS', 'Bookmarks'); |
|
28 | +define($GLOBALS['VAR_PREFIXU'].'_MB_TYPE_FEATURED', 'Featured'); |
|
29 | +define($GLOBALS['VAR_PREFIXU'].'_MB_ITEMS', 'Item count'); |
|
30 | +define($GLOBALS['VAR_PREFIXU'].'_MB_TITLE_LENGTH', 'Title length'); |
|
31 | +define($GLOBALS['VAR_PREFIXU'].'_MB_TIMEFORMAT', 'Time format'); |
|
32 | +define($GLOBALS['VAR_PREFIXU'].'_MB_TIMEFORMAT_CUSTOM', 'Custom'); |
|
33 | +define($GLOBALS['VAR_PREFIXU'].'_MB_SUMMARY_LENGTH', 'Show summary length'); |
|
34 | +define($GLOBALS['VAR_PREFIXU'].'_MB_SHOWDESC', 'Show description'); |
|
35 | +define($GLOBALS['VAR_PREFIXU'].'_MB_CATEGORYLIST', 'Allowed categories'); |
|
36 | 36 | |
37 | -define($GLOBALS['VAR_PREFIXU'] . '_MB_AUTHOR', 'Author'); |
|
38 | -define($GLOBALS['VAR_PREFIXU'] . '_MB_TIME', 'Time'); |
|
37 | +define($GLOBALS['VAR_PREFIXU'].'_MB_AUTHOR', 'Author'); |
|
38 | +define($GLOBALS['VAR_PREFIXU'].'_MB_TIME', 'Time'); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | /** |
172 | 172 | * IXR_Message constructor. |
173 | - * @param $message |
|
173 | + * @param string|boolean $message |
|
174 | 174 | */ |
175 | 175 | public function __construct($message) |
176 | 176 | { |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | |
898 | 898 | /** |
899 | 899 | * IXR_Base64 constructor. |
900 | - * @param $data |
|
900 | + * @param string $data |
|
901 | 901 | */ |
902 | 902 | public function __construct($data) |
903 | 903 | { |
@@ -939,10 +939,10 @@ discard block |
||
939 | 939 | } |
940 | 940 | |
941 | 941 | /** |
942 | - * @param $method |
|
943 | - * @param $callback |
|
944 | - * @param $args |
|
945 | - * @param $help |
|
942 | + * @param string $method |
|
943 | + * @param string $callback |
|
944 | + * @param string[] $args |
|
945 | + * @param string $help |
|
946 | 946 | */ |
947 | 947 | public function addCallback($method, $callback, $args, $help) |
948 | 948 | { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | } |
38 | 38 | if ($type === 'array') { |
39 | - for ($i = 0, $j = count($this->data); $i < $j; ++$i) { |
|
39 | + for ($i = 0, $j = count($this->data); $i<$j; ++$i) { |
|
40 | 40 | $this->data[$i] = new IXR_Value($this->data[$i]); |
41 | 41 | } |
42 | 42 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | /* We have an array - is it an array or a struct ? */ |
76 | 76 | if ($this->isStruct($this->data)) { |
77 | 77 | return 'struct'; |
78 | - } else { |
|
78 | + }else { |
|
79 | 79 | return 'array'; |
80 | 80 | } |
81 | 81 | } |
@@ -88,31 +88,31 @@ discard block |
||
88 | 88 | /* Return XML for this value */ |
89 | 89 | switch ($this->type) { |
90 | 90 | case 'boolean': |
91 | - return '<boolean>' . ($this->data ? '1' : '0') . '</boolean>'; |
|
91 | + return '<boolean>'.($this->data ? '1' : '0').'</boolean>'; |
|
92 | 92 | break; |
93 | 93 | case 'int': |
94 | - return '<int>' . $this->data . '</int>'; |
|
94 | + return '<int>'.$this->data.'</int>'; |
|
95 | 95 | break; |
96 | 96 | case 'double': |
97 | - return '<double>' . $this->data . '</double>'; |
|
97 | + return '<double>'.$this->data.'</double>'; |
|
98 | 98 | break; |
99 | 99 | case 'string': |
100 | - return '<string>' . htmlspecialchars($this->data) . '</string>'; |
|
100 | + return '<string>'.htmlspecialchars($this->data).'</string>'; |
|
101 | 101 | break; |
102 | 102 | case 'array': |
103 | - $return = '<array><data>' . "\n"; |
|
103 | + $return = '<array><data>'."\n"; |
|
104 | 104 | foreach ($this->data as $item) { |
105 | - $return .= ' <value>' . $item->getXml() . "</value>\n"; |
|
105 | + $return .= ' <value>'.$item->getXml()."</value>\n"; |
|
106 | 106 | } |
107 | 107 | $return .= '</data></array>'; |
108 | 108 | |
109 | 109 | return $return; |
110 | 110 | break; |
111 | 111 | case 'struct': |
112 | - $return = '<struct>' . "\n"; |
|
112 | + $return = '<struct>'."\n"; |
|
113 | 113 | foreach ($this->data as $name => $value) { |
114 | 114 | $return .= " <member><name>$name</name><value>"; |
115 | - $return .= $value->getXml() . "</value></member>\n"; |
|
115 | + $return .= $value->getXml()."</value></member>\n"; |
|
116 | 116 | } |
117 | 117 | $return .= '</struct>'; |
118 | 118 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | /* Nasty function to check if an array is a struct or not */ |
137 | 137 | $expected = 0; |
138 | 138 | foreach ($array as $key => $value) { |
139 | - if ((string)$key != (string)$expected) { |
|
139 | + if ((string) $key != (string) $expected) { |
|
140 | 140 | return true; |
141 | 141 | } |
142 | 142 | ++$expected; |
@@ -152,15 +152,15 @@ discard block |
||
152 | 152 | class IXR_Message |
153 | 153 | { |
154 | 154 | public $message; |
155 | - public $messageType; // methodCall / methodResponse / fault |
|
155 | + public $messageType; // methodCall / methodResponse / fault |
|
156 | 156 | public $faultCode; |
157 | 157 | public $faultString; |
158 | 158 | public $methodName; |
159 | 159 | public $params; |
160 | 160 | // Current variable stacks |
161 | - public $_arraystructs = []; // The stack used to keep track of the current array/struct |
|
161 | + public $_arraystructs = []; // The stack used to keep track of the current array/struct |
|
162 | 162 | public $_arraystructstypes = []; // Stack keeping track of if things are structs or array |
163 | - public $_currentStructName = []; // A stack as well |
|
163 | + public $_currentStructName = []; // A stack as well |
|
164 | 164 | public $_param; |
165 | 165 | public $_value; |
166 | 166 | public $_currentTag; |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | public function parse() |
184 | 184 | { |
185 | 185 | // first remove the XML declaration |
186 | - $this->message = preg_replace('/<\?xml(.*)?\?' . '>/', '', $this->message); |
|
186 | + $this->message = preg_replace('/<\?xml(.*)?\?'.'>/', '', $this->message); |
|
187 | 187 | if (trim($this->message) == '') { |
188 | 188 | return false; |
189 | 189 | } |
@@ -256,17 +256,17 @@ discard block |
||
256 | 256 | switch ($tag) { |
257 | 257 | case 'int': |
258 | 258 | case 'i4': |
259 | - $value = (int)trim($this->_currentTagContents); |
|
259 | + $value = (int) trim($this->_currentTagContents); |
|
260 | 260 | $this->_currentTagContents = ''; |
261 | 261 | $valueFlag = true; |
262 | 262 | break; |
263 | 263 | case 'double': |
264 | - $value = (double)trim($this->_currentTagContents); |
|
264 | + $value = (double) trim($this->_currentTagContents); |
|
265 | 265 | $this->_currentTagContents = ''; |
266 | 266 | $valueFlag = true; |
267 | 267 | break; |
268 | 268 | case 'string': |
269 | - $value = (string)trim($this->_currentTagContents); |
|
269 | + $value = (string) trim($this->_currentTagContents); |
|
270 | 270 | $this->_currentTagContents = ''; |
271 | 271 | $valueFlag = true; |
272 | 272 | break; |
@@ -279,13 +279,13 @@ discard block |
||
279 | 279 | case 'value': |
280 | 280 | // "If no type is indicated, the type is string." |
281 | 281 | if (trim($this->_currentTagContents) != '') { |
282 | - $value = (string)$this->_currentTagContents; |
|
282 | + $value = (string) $this->_currentTagContents; |
|
283 | 283 | $this->_currentTagContents = ''; |
284 | 284 | $valueFlag = true; |
285 | 285 | } |
286 | 286 | break; |
287 | 287 | case 'boolean': |
288 | - $value = (boolean)trim($this->_currentTagContents); |
|
288 | + $value = (boolean) trim($this->_currentTagContents); |
|
289 | 289 | $this->_currentTagContents = ''; |
290 | 290 | $valueFlag = true; |
291 | 291 | break; |
@@ -319,16 +319,16 @@ discard block |
||
319 | 319 | $value = trim($value); |
320 | 320 | } |
321 | 321 | */ |
322 | - if (count($this->_arraystructs) > 0) { |
|
322 | + if (count($this->_arraystructs)>0) { |
|
323 | 323 | // Add value to struct or array |
324 | - if ($this->_arraystructstypes[count($this->_arraystructstypes) - 1] === 'struct') { |
|
324 | + if ($this->_arraystructstypes[count($this->_arraystructstypes)-1] === 'struct') { |
|
325 | 325 | // Add to struct |
326 | - $this->_arraystructs[count($this->_arraystructs) - 1][$this->_currentStructName[count($this->_currentStructName) - 1]] = $value; |
|
327 | - } else { |
|
326 | + $this->_arraystructs[count($this->_arraystructs)-1][$this->_currentStructName[count($this->_currentStructName)-1]] = $value; |
|
327 | + }else { |
|
328 | 328 | // Add to array |
329 | - $this->_arraystructs[count($this->_arraystructs) - 1][] = $value; |
|
329 | + $this->_arraystructs[count($this->_arraystructs)-1][] = $value; |
|
330 | 330 | } |
331 | - } else { |
|
331 | + }else { |
|
332 | 332 | // Just add as a paramater |
333 | 333 | $this->params[] = $value; |
334 | 334 | } |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | public function call($methodname, $args) |
414 | 414 | { |
415 | 415 | if (!$this->hasMethod($methodname)) { |
416 | - return new IXR_Error(-32601, 'server error. requested method ' . $methodname . ' does not exist.'); |
|
416 | + return new IXR_Error(-32601, 'server error. requested method '.$methodname.' does not exist.'); |
|
417 | 417 | } |
418 | 418 | $method = $this->callbacks[$methodname]; |
419 | 419 | // Perform the callback and send the response |
@@ -426,18 +426,18 @@ discard block |
||
426 | 426 | // It's a class method - check it exists |
427 | 427 | $method = substr($method, 5); |
428 | 428 | if (!method_exists($this, $method)) { |
429 | - return new IXR_Error(-32601, 'server error. requested class method "' . $method . '" does not exist.'); |
|
429 | + return new IXR_Error(-32601, 'server error. requested class method "'.$method.'" does not exist.'); |
|
430 | 430 | } |
431 | 431 | // Call the method |
432 | 432 | $result = $this->$method($args); |
433 | - } else { |
|
433 | + }else { |
|
434 | 434 | // It's a function - does it exist? |
435 | 435 | if (is_array($method)) { |
436 | 436 | if (!method_exists($method[0], $method[1])) { |
437 | - return new IXR_Error(-32601, 'server error. requested object method "' . $method[1] . '" does not exist.'); |
|
437 | + return new IXR_Error(-32601, 'server error. requested object method "'.$method[1].'" does not exist.'); |
|
438 | 438 | } |
439 | 439 | } elseif (!function_exists($method)) { |
440 | - return new IXR_Error(-32601, 'server error. requested function "' . $method . '" does not exist.'); |
|
440 | + return new IXR_Error(-32601, 'server error. requested function "'.$method.'" does not exist.'); |
|
441 | 441 | } |
442 | 442 | // Call the function |
443 | 443 | $result = call_user_func($method, $args); |
@@ -464,12 +464,12 @@ discard block |
||
464 | 464 | */ |
465 | 465 | public function output($xml) |
466 | 466 | { |
467 | - $xml = '<?xml version="1.0"?>' . "\n" . $xml; |
|
467 | + $xml = '<?xml version="1.0"?>'."\n".$xml; |
|
468 | 468 | $length = strlen($xml); |
469 | 469 | header('Connection: close'); |
470 | - header('Content-Length: ' . $length); |
|
470 | + header('Content-Length: '.$length); |
|
471 | 471 | header('Content-Type: text/xml'); |
472 | - header('Date: ' . date('r')); |
|
472 | + header('Date: '.date('r')); |
|
473 | 473 | echo $xml; |
474 | 474 | exit; |
475 | 475 | } |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | $params = $call['params']; |
543 | 543 | if ($method === 'system.multicall') { |
544 | 544 | $result = new IXR_Error(-32600, 'Recursive calls to system.multicall are forbidden'); |
545 | - } else { |
|
545 | + }else { |
|
546 | 546 | $result = $this->call($method, $params); |
547 | 547 | } |
548 | 548 | if (is_a($result, 'IXR_Error')) { |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | 'faultCode' => $result->code, |
551 | 551 | 'faultString' => $result->message |
552 | 552 | ]; |
553 | - } else { |
|
553 | + }else { |
|
554 | 554 | $return[] = [$result]; |
555 | 555 | } |
556 | 556 | } |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | EOD; |
587 | 587 | foreach ($this->args as $arg) { |
588 | 588 | $this->xml .= '<param><value>'; |
589 | - $v = new IXR_Value($arg); |
|
589 | + $v = new IXR_Value($arg); |
|
590 | 590 | $this->xml .= $v->getXml(); |
591 | 591 | $this->xml .= "</value></param>\n"; |
592 | 592 | } |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | if (!$this->path) { |
648 | 648 | $this->path = '/'; |
649 | 649 | } |
650 | - } else { |
|
650 | + }else { |
|
651 | 651 | $this->server = $server; |
652 | 652 | $this->path = $path; |
653 | 653 | $this->port = $port; |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | $request .= $xml; |
676 | 676 | // Now send the request |
677 | 677 | if ($this->debug) { |
678 | - echo '<pre>' . htmlspecialchars($request) . "\n</pre>\n\n"; |
|
678 | + echo '<pre>'.htmlspecialchars($request)."\n</pre>\n\n"; |
|
679 | 679 | } |
680 | 680 | $fp = @fsockopen($this->server, $this->port, $errno, $errstr, $this->timeout); |
681 | 681 | if (!$fp) { |
@@ -702,11 +702,11 @@ discard block |
||
702 | 702 | $gettingHeaders = false; |
703 | 703 | } |
704 | 704 | if (!$gettingHeaders) { |
705 | - $contents .= trim($line) . "\n"; |
|
705 | + $contents .= trim($line)."\n"; |
|
706 | 706 | } |
707 | 707 | } |
708 | 708 | if ($this->debug) { |
709 | - echo '<pre>' . htmlspecialchars($contents) . "\n</pre>\n\n"; |
|
709 | + echo '<pre>'.htmlspecialchars($contents)."\n</pre>\n\n"; |
|
710 | 710 | } |
711 | 711 | // Now parse what we've got back |
712 | 712 | $this->message = new IXR_Message($contents); |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | // $time can be a PHP timestamp or an ISO one |
832 | 832 | if (is_numeric($time)) { |
833 | 833 | $this->parseTimestamp($time); |
834 | - } else { |
|
834 | + }else { |
|
835 | 835 | $this->parseIso($time); |
836 | 836 | } |
837 | 837 | } |
@@ -868,7 +868,7 @@ discard block |
||
868 | 868 | */ |
869 | 869 | public function getIso() |
870 | 870 | { |
871 | - return $this->year . $this->month . $this->day . 'T' . $this->hour . ':' . $this->minute . ':' . $this->second . $this->timezone; |
|
871 | + return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second.$this->timezone; |
|
872 | 872 | } |
873 | 873 | |
874 | 874 | /** |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | */ |
877 | 877 | public function getXml() |
878 | 878 | { |
879 | - return '<dateTime.iso8601>' . $this->getIso() . '</dateTime.iso8601>'; |
|
879 | + return '<dateTime.iso8601>'.$this->getIso().'</dateTime.iso8601>'; |
|
880 | 880 | } |
881 | 881 | |
882 | 882 | /** |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | */ |
910 | 910 | public function getXml() |
911 | 911 | { |
912 | - return '<base64>' . base64_encode($this->data) . '</base64>'; |
|
912 | + return '<base64>'.base64_encode($this->data).'</base64>'; |
|
913 | 913 | } |
914 | 914 | } |
915 | 915 | |
@@ -964,7 +964,7 @@ discard block |
||
964 | 964 | } |
965 | 965 | // Over-rides default call method, adds signature check |
966 | 966 | if (!$this->hasMethod($methodname)) { |
967 | - return new IXR_Error(-32601, 'server error. requested method "' . $this->message->methodName . '" not specified.'); |
|
967 | + return new IXR_Error(-32601, 'server error. requested method "'.$this->message->methodName.'" not specified.'); |
|
968 | 968 | } |
969 | 969 | $method = $this->callbacks[$methodname]; |
970 | 970 | $signature = $this->signatures[$methodname]; |
@@ -977,7 +977,7 @@ discard block |
||
977 | 977 | // Check the argument types |
978 | 978 | $ok = true; |
979 | 979 | $argsbackup = $args; |
980 | - for ($i = 0, $j = count($args); $i < $j; ++$i) { |
|
980 | + for ($i = 0, $j = count($args); $i<$j; ++$i) { |
|
981 | 981 | $arg = array_shift($args); |
982 | 982 | $type = array_shift($signature); |
983 | 983 | switch ($type) { |
@@ -1027,7 +1027,7 @@ discard block |
||
1027 | 1027 | public function methodSignature($method) |
1028 | 1028 | { |
1029 | 1029 | if (!$this->hasMethod($method)) { |
1030 | - return new IXR_Error(-32601, 'server error. requested method "' . $method . '" not specified.'); |
|
1030 | + return new IXR_Error(-32601, 'server error. requested method "'.$method.'" not specified.'); |
|
1031 | 1031 | } |
1032 | 1032 | // We should be returning an array of types |
1033 | 1033 | $types = $this->signatures[$method]; |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | public $_feed; |
370 | 370 | |
371 | 371 | /** |
372 | - * @param $format |
|
372 | + * @param string $format |
|
373 | 373 | */ |
374 | 374 | public function _setFormat($format) |
375 | 375 | { |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | /** |
567 | 567 | * Adds an FeedItem to the feed. |
568 | 568 | * |
569 | - * @param $item |
|
569 | + * @param FeedItem $item |
|
570 | 570 | * @internal param FeedItem $object $item The FeedItem to add to the feed. |
571 | 571 | * @access public |
572 | 572 | */ |
@@ -585,6 +585,7 @@ discard block |
||
585 | 585 | * @static |
586 | 586 | * @param string string A string to be truncated. |
587 | 587 | * @param int length the maximum length the string should be truncated to |
588 | + * @param integer $length |
|
588 | 589 | * @return string the truncated string |
589 | 590 | */ |
590 | 591 | public function iTrunc($string, $length) |
@@ -696,7 +697,7 @@ discard block |
||
696 | 697 | /** |
697 | 698 | * @since 1.4 |
698 | 699 | * @access private |
699 | - * @param $filename |
|
700 | + * @param string $filename |
|
700 | 701 | */ |
701 | 702 | public function _redirect($filename) |
702 | 703 | { |
@@ -853,7 +854,7 @@ discard block |
||
853 | 854 | /** |
854 | 855 | * Gets the date stored in this FeedDate as an RFC 822 date. |
855 | 856 | * |
856 | - * @return a date in RFC 822 format |
|
857 | + * @return string date in RFC 822 format |
|
857 | 858 | */ |
858 | 859 | public function rfc822() |
859 | 860 | { |
@@ -869,7 +870,7 @@ discard block |
||
869 | 870 | /** |
870 | 871 | * Gets the date stored in this FeedDate as an ISO 8601 date. |
871 | 872 | * |
872 | - * @return a date in ISO 8601 format |
|
873 | + * @return string date in ISO 8601 format |
|
873 | 874 | */ |
874 | 875 | public function iso8601() |
875 | 876 | { |
@@ -999,7 +1000,7 @@ discard block |
||
999 | 1000 | /** |
1000 | 1001 | * Sets this RSS feed's version number. |
1001 | 1002 | * @access private |
1002 | - * @param $version |
|
1003 | + * @param string $version |
|
1003 | 1004 | */ |
1004 | 1005 | public function _setRSSVersion($version) |
1005 | 1006 | { |
@@ -342,11 +342,11 @@ discard block |
||
342 | 342 | if (!$this->rawFieldContent) { |
343 | 343 | $result = ''; |
344 | 344 | } elseif ($this->syndicateHtml) { |
345 | - $result = '<![CDATA[' . $this->rawFieldContent . ']]>'; |
|
346 | - } else { |
|
345 | + $result = '<![CDATA['.$this->rawFieldContent.']]>'; |
|
346 | + }else { |
|
347 | 347 | if ($this->truncSize && is_int($this->truncSize)) { |
348 | 348 | $result = FeedCreator::iTrunc(htmlspecialchars($this->rawFieldContent), $this->truncSize); |
349 | - } else { |
|
349 | + }else { |
|
350 | 350 | $result = htmlspecialchars($this->rawFieldContent); |
351 | 351 | } |
352 | 352 | } |
@@ -589,29 +589,29 @@ discard block |
||
589 | 589 | */ |
590 | 590 | public function iTrunc($string, $length) |
591 | 591 | { |
592 | - if (strlen($string) <= $length) { |
|
592 | + if (strlen($string)<=$length) { |
|
593 | 593 | return $string; |
594 | 594 | } |
595 | 595 | |
596 | 596 | $pos = strrpos($string, '.'); |
597 | - if ($pos >= $length - 4) { |
|
598 | - $string = substr($string, 0, $length - 4); |
|
597 | + if ($pos>=$length-4) { |
|
598 | + $string = substr($string, 0, $length-4); |
|
599 | 599 | $pos = strrpos($string, '.'); |
600 | 600 | } |
601 | - if ($pos >= $length * 0.4) { |
|
602 | - return substr($string, 0, $pos + 1) . ' ...'; |
|
601 | + if ($pos>=$length*0.4) { |
|
602 | + return substr($string, 0, $pos+1).' ...'; |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | $pos = strrpos($string, ' '); |
606 | - if ($pos >= $length - 4) { |
|
607 | - $string = substr($string, 0, $length - 4); |
|
606 | + if ($pos>=$length-4) { |
|
607 | + $string = substr($string, 0, $length-4); |
|
608 | 608 | $pos = strrpos($string, ' '); |
609 | 609 | } |
610 | - if ($pos >= $length * 0.4) { |
|
611 | - return substr($string, 0, $pos) . ' ...'; |
|
610 | + if ($pos>=$length*0.4) { |
|
611 | + return substr($string, 0, $pos).' ...'; |
|
612 | 612 | } |
613 | 613 | |
614 | - return substr($string, 0, $length - 4) . ' ...'; |
|
614 | + return substr($string, 0, $length-4).' ...'; |
|
615 | 615 | } |
616 | 616 | |
617 | 617 | /** |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | */ |
622 | 622 | public function _createGeneratorComment() |
623 | 623 | { |
624 | - return "<!-- generator=\"" . FEEDCREATOR_VERSION . "\" -->\n"; |
|
624 | + return "<!-- generator=\"".FEEDCREATOR_VERSION."\" -->\n"; |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | /** |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | $ae = ''; |
639 | 639 | if (is_array($elements)) { |
640 | 640 | foreach ($elements as $key => $value) { |
641 | - $ae .= $indentString . "<$key>$value</$key>\n"; |
|
641 | + $ae .= $indentString."<$key>$value</$key>\n"; |
|
642 | 642 | } |
643 | 643 | } |
644 | 644 | |
@@ -652,10 +652,10 @@ discard block |
||
652 | 652 | { |
653 | 653 | $xml = ''; |
654 | 654 | if ($this->cssStyleSheet) { |
655 | - $xml .= "<?xml-stylesheet href=\"" . $this->cssStyleSheet . "\" type=\"text/css\"?>\n"; |
|
655 | + $xml .= "<?xml-stylesheet href=\"".$this->cssStyleSheet."\" type=\"text/css\"?>\n"; |
|
656 | 656 | } |
657 | 657 | if ($this->xslStyleSheet) { |
658 | - $xml .= "<?xml-stylesheet href=\"" . $this->xslStyleSheet . "\" type=\"text/xsl\"?>\n"; |
|
658 | + $xml .= "<?xml-stylesheet href=\"".$this->xslStyleSheet."\" type=\"text/xsl\"?>\n"; |
|
659 | 659 | } |
660 | 660 | |
661 | 661 | return $xml; |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | { |
691 | 691 | $fileInfo = pathinfo($_SERVER['PHP_SELF']); |
692 | 692 | |
693 | - return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension']) + 1)) . '.xml'; |
|
693 | + return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension'])+1)).'.xml'; |
|
694 | 694 | } |
695 | 695 | |
696 | 696 | /** |
@@ -713,8 +713,8 @@ discard block |
||
713 | 713 | // HTTP redirect, some feed readers' simple HTTP implementations don't follow it |
714 | 714 | //Header("Location: ".$filename); |
715 | 715 | |
716 | - header('Content-Type: ' . $this->contentType . '; charset=' . $this->encoding . '; filename=' . basename($filename)); |
|
717 | - header('Content-Disposition: inline; filename=' . basename($filename)); |
|
716 | + header('Content-Type: '.$this->contentType.'; charset='.$this->encoding.'; filename='.basename($filename)); |
|
717 | + header('Content-Disposition: inline; filename='.basename($filename)); |
|
718 | 718 | readfile($filename, 'r'); |
719 | 719 | die(); |
720 | 720 | } |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | if ($filename == '') { |
737 | 737 | $filename = $this->_generateFilename(); |
738 | 738 | } |
739 | - if (file_exists($filename) && (time() - filemtime($filename) < $timeout)) { |
|
739 | + if (file_exists($filename) && (time()-filemtime($filename)<$timeout)) { |
|
740 | 740 | $this->_redirect($filename); |
741 | 741 | } |
742 | 742 | } |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | if ($displayContents) { |
763 | 763 | $this->_redirect($filename); |
764 | 764 | } |
765 | - } else { |
|
765 | + }else { |
|
766 | 766 | echo '<br><b>Error creating feed file, please check write permissions.</b><br>'; |
767 | 767 | } |
768 | 768 | } |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | return; |
796 | 796 | } |
797 | 797 | if (preg_match("~(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),\\s+)?(\\d{1,2})\\s+([a-zA-Z]{3})\\s+(\\d{4})\\s+(\\d{2}):(\\d{2}):(\\d{2})\\s+(.*)~", $dateString, $matches)) { |
798 | - $months = [ |
|
798 | + $months = [ |
|
799 | 799 | 'Jan' => 1, |
800 | 800 | 'Feb' => 2, |
801 | 801 | 'Mar' => 3, |
@@ -811,15 +811,15 @@ discard block |
||
811 | 811 | ]; |
812 | 812 | $this->unix = mktime($matches[4], $matches[5], $matches[6], $months[$matches[2]], $matches[1], $matches[3]); |
813 | 813 | if (substr($matches[7], 0, 1) == '+' || substr($matches[7], 0, 1) == '-') { |
814 | - $tzOffset = (substr($matches[7], 0, 3) * 60 + substr($matches[7], -2)) * 60; |
|
815 | - } else { |
|
814 | + $tzOffset = (substr($matches[7], 0, 3)*60+substr($matches[7], -2))*60; |
|
815 | + }else { |
|
816 | 816 | if (strlen($matches[7]) == 1) { |
817 | 817 | $oneHour = 3600; |
818 | 818 | $ord = ord($matches[7]); |
819 | - if ($ord < ord('M')) { |
|
820 | - $tzOffset = (ord('A') - $ord - 1) * $oneHour; |
|
821 | - } elseif ($ord >= ord('M') && $matches[7] !== 'Z') { |
|
822 | - $tzOffset = ($ord - ord('M')) * $oneHour; |
|
819 | + if ($ord<ord('M')) { |
|
820 | + $tzOffset = (ord('A')-$ord-1)*$oneHour; |
|
821 | + } elseif ($ord>=ord('M') && $matches[7] !== 'Z') { |
|
822 | + $tzOffset = ($ord-ord('M'))*$oneHour; |
|
823 | 823 | } elseif ($matches[7] === 'Z') { |
824 | 824 | $tzOffset = 0; |
825 | 825 | } |
@@ -837,8 +837,8 @@ discard block |
||
837 | 837 | if (preg_match("~(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(.*)~", $dateString, $matches)) { |
838 | 838 | $this->unix = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); |
839 | 839 | if (substr($matches[7], 0, 1) == '+' || substr($matches[7], 0, 1) == '-') { |
840 | - $tzOffset = (substr($matches[7], 0, 3) * 60 + substr($matches[7], -2)) * 60; |
|
841 | - } else { |
|
840 | + $tzOffset = (substr($matches[7], 0, 3)*60+substr($matches[7], -2))*60; |
|
841 | + }else { |
|
842 | 842 | if ($matches[7] === 'Z') { |
843 | 843 | $tzOffset = 0; |
844 | 844 | } |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | //return gmdate("r",$this->unix); |
861 | 861 | $date = gmdate('D, d M Y H:i:s', $this->unix); |
862 | 862 | if (TIME_ZONE != '') { |
863 | - $date .= ' ' . str_replace(':', '', TIME_ZONE); |
|
863 | + $date .= ' '.str_replace(':', '', TIME_ZONE); |
|
864 | 864 | } |
865 | 865 | |
866 | 866 | return $date; |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | public function iso8601() |
875 | 875 | { |
876 | 876 | $date = gmdate("Y-m-d\TH:i:sO", $this->unix); |
877 | - $date = substr($date, 0, 22) . ':' . substr($date, -2); |
|
877 | + $date = substr($date, 0, 22).':'.substr($date, -2); |
|
878 | 878 | if (TIME_ZONE != '') { |
879 | 879 | $date = str_replace('+00:00', TIME_ZONE, $date); |
880 | 880 | } |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | */ |
910 | 910 | public function createFeed() |
911 | 911 | { |
912 | - $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n"; |
|
912 | + $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n"; |
|
913 | 913 | $feed .= $this->_createGeneratorComment(); |
914 | 914 | if ($this->cssStyleSheet == '') { |
915 | 915 | $cssStyleSheet = 'http://www.w3.org/2000/08/w3c-synd/style.css'; |
@@ -920,49 +920,49 @@ discard block |
||
920 | 920 | $feed .= " xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n"; |
921 | 921 | $feed .= " xmlns:slash=\"http://purl.org/rss/1.0/modules/slash/\"\n"; |
922 | 922 | $feed .= " xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n"; |
923 | - $feed .= " <channel rdf:about=\"" . $this->syndicationURL . "\">\n"; |
|
924 | - $feed .= ' <title>' . htmlspecialchars($this->title) . "</title>\n"; |
|
925 | - $feed .= ' <description>' . htmlspecialchars($this->description) . "</description>\n"; |
|
926 | - $feed .= ' <link>' . $this->link . "</link>\n"; |
|
923 | + $feed .= " <channel rdf:about=\"".$this->syndicationURL."\">\n"; |
|
924 | + $feed .= ' <title>'.htmlspecialchars($this->title)."</title>\n"; |
|
925 | + $feed .= ' <description>'.htmlspecialchars($this->description)."</description>\n"; |
|
926 | + $feed .= ' <link>'.$this->link."</link>\n"; |
|
927 | 927 | if ($this->image != null) { |
928 | - $feed .= " <image rdf:resource=\"" . $this->image->url . "\">\n"; |
|
928 | + $feed .= " <image rdf:resource=\"".$this->image->url."\">\n"; |
|
929 | 929 | } |
930 | - $now = new FeedDate(); |
|
931 | - $feed .= ' <dc:date>' . htmlspecialchars($now->iso8601()) . "</dc:date>\n"; |
|
930 | + $now = new FeedDate(); |
|
931 | + $feed .= ' <dc:date>'.htmlspecialchars($now->iso8601())."</dc:date>\n"; |
|
932 | 932 | $feed .= " <items>\n"; |
933 | 933 | $feed .= " <rdf:Seq>\n"; |
934 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
935 | - $feed .= " <rdf:li rdf:resource=\"" . htmlspecialchars($this->items[$i]->link) . "\">\n"; |
|
934 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
935 | + $feed .= " <rdf:li rdf:resource=\"".htmlspecialchars($this->items[$i]->link)."\">\n"; |
|
936 | 936 | } |
937 | 937 | $feed .= " </rdf:Seq>\n"; |
938 | 938 | $feed .= " </items>\n"; |
939 | 939 | $feed .= " </channel>\n"; |
940 | 940 | if ($this->image != null) { |
941 | - $feed .= " <image rdf:about=\"" . $this->image->url . "\">\n"; |
|
942 | - $feed .= ' <title>' . $this->image->title . "</title>\n"; |
|
943 | - $feed .= ' <link>' . $this->image->link . "</link>\n"; |
|
944 | - $feed .= ' <url>' . $this->image->url . "</url>\n"; |
|
941 | + $feed .= " <image rdf:about=\"".$this->image->url."\">\n"; |
|
942 | + $feed .= ' <title>'.$this->image->title."</title>\n"; |
|
943 | + $feed .= ' <link>'.$this->image->link."</link>\n"; |
|
944 | + $feed .= ' <url>'.$this->image->url."</url>\n"; |
|
945 | 945 | $feed .= " </image>\n"; |
946 | 946 | } |
947 | 947 | $feed .= $this->_createAdditionalElements($this->additionalElements, ' '); |
948 | 948 | |
949 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
950 | - $feed .= " <item rdf:about=\"" . htmlspecialchars($this->items[$i]->link) . "\">\n"; |
|
949 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
950 | + $feed .= " <item rdf:about=\"".htmlspecialchars($this->items[$i]->link)."\">\n"; |
|
951 | 951 | //$feed.= " <dc:type>Posting</dc:type>\n"; |
952 | 952 | $feed .= " <dc:format>text/html</dc:format>\n"; |
953 | 953 | if ($this->items[$i]->date != null) { |
954 | 954 | $itemDate = new FeedDate($this->items[$i]->date); |
955 | - $feed .= ' <dc:date>' . htmlspecialchars($itemDate->iso8601()) . "</dc:date>\n"; |
|
955 | + $feed .= ' <dc:date>'.htmlspecialchars($itemDate->iso8601())."</dc:date>\n"; |
|
956 | 956 | } |
957 | 957 | if ($this->items[$i]->source != '') { |
958 | - $feed .= ' <dc:source>' . htmlspecialchars($this->items[$i]->source) . "</dc:source>\n"; |
|
958 | + $feed .= ' <dc:source>'.htmlspecialchars($this->items[$i]->source)."</dc:source>\n"; |
|
959 | 959 | } |
960 | 960 | if ($this->items[$i]->author != '') { |
961 | - $feed .= ' <dc:creator>' . htmlspecialchars($this->items[$i]->author) . "</dc:creator>\n"; |
|
961 | + $feed .= ' <dc:creator>'.htmlspecialchars($this->items[$i]->author)."</dc:creator>\n"; |
|
962 | 962 | } |
963 | - $feed .= ' <title>' . htmlspecialchars(strip_tags(strtr($this->items[$i]->title, "\n\r", ' '))) . "</title>\n"; |
|
964 | - $feed .= ' <link>' . htmlspecialchars($this->items[$i]->link) . "</link>\n"; |
|
965 | - $feed .= ' <description>' . htmlspecialchars($this->items[$i]->description) . "</description>\n"; |
|
963 | + $feed .= ' <title>'.htmlspecialchars(strip_tags(strtr($this->items[$i]->title, "\n\r", ' ')))."</title>\n"; |
|
964 | + $feed .= ' <link>'.htmlspecialchars($this->items[$i]->link)."</link>\n"; |
|
965 | + $feed .= ' <description>'.htmlspecialchars($this->items[$i]->description)."</description>\n"; |
|
966 | 966 | $feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, ' '); |
967 | 967 | $feed .= " </item>\n"; |
968 | 968 | } |
@@ -1013,79 +1013,79 @@ discard block |
||
1013 | 1013 | */ |
1014 | 1014 | public function createFeed() |
1015 | 1015 | { |
1016 | - $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n"; |
|
1016 | + $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n"; |
|
1017 | 1017 | $feed .= $this->_createGeneratorComment(); |
1018 | 1018 | $feed .= $this->_createStylesheetReferences(); |
1019 | - $feed .= "<rss version=\"" . $this->RSSVersion . "\">\n"; |
|
1019 | + $feed .= "<rss version=\"".$this->RSSVersion."\">\n"; |
|
1020 | 1020 | $feed .= " <channel>\n"; |
1021 | - $feed .= ' <title>' . FeedCreator::iTrunc(htmlspecialchars($this->title), 100) . "</title>\n"; |
|
1021 | + $feed .= ' <title>'.FeedCreator::iTrunc(htmlspecialchars($this->title), 100)."</title>\n"; |
|
1022 | 1022 | $this->descriptionTruncSize = 500; |
1023 | - $feed .= ' <description>' . $this->getDescription() . "</description>\n"; |
|
1024 | - $feed .= ' <link>' . $this->link . "</link>\n"; |
|
1023 | + $feed .= ' <description>'.$this->getDescription()."</description>\n"; |
|
1024 | + $feed .= ' <link>'.$this->link."</link>\n"; |
|
1025 | 1025 | $now = new FeedDate(); |
1026 | - $feed .= ' <lastBuildDate>' . htmlspecialchars($now->rfc822()) . "</lastBuildDate>\n"; |
|
1027 | - $feed .= ' <generator>' . FEEDCREATOR_VERSION . "</generator>\n"; |
|
1026 | + $feed .= ' <lastBuildDate>'.htmlspecialchars($now->rfc822())."</lastBuildDate>\n"; |
|
1027 | + $feed .= ' <generator>'.FEEDCREATOR_VERSION."</generator>\n"; |
|
1028 | 1028 | |
1029 | 1029 | if ($this->image != null) { |
1030 | 1030 | $feed .= " <image>\n"; |
1031 | - $feed .= ' <url>' . $this->image->url . "</url>\n"; |
|
1032 | - $feed .= ' <title>' . FeedCreator::iTrunc(htmlspecialchars($this->image->title), 100) . "</title>\n"; |
|
1033 | - $feed .= ' <link>' . $this->image->link . "</link>\n"; |
|
1031 | + $feed .= ' <url>'.$this->image->url."</url>\n"; |
|
1032 | + $feed .= ' <title>'.FeedCreator::iTrunc(htmlspecialchars($this->image->title), 100)."</title>\n"; |
|
1033 | + $feed .= ' <link>'.$this->image->link."</link>\n"; |
|
1034 | 1034 | if ($this->image->width != '') { |
1035 | - $feed .= ' <width>' . $this->image->width . "</width>\n"; |
|
1035 | + $feed .= ' <width>'.$this->image->width."</width>\n"; |
|
1036 | 1036 | } |
1037 | 1037 | if ($this->image->height != '') { |
1038 | - $feed .= ' <height>' . $this->image->height . "</height>\n"; |
|
1038 | + $feed .= ' <height>'.$this->image->height."</height>\n"; |
|
1039 | 1039 | } |
1040 | 1040 | if ($this->image->description != '') { |
1041 | - $feed .= ' <description>' . $this->image->getDescription() . "</description>\n"; |
|
1041 | + $feed .= ' <description>'.$this->image->getDescription()."</description>\n"; |
|
1042 | 1042 | } |
1043 | 1043 | $feed .= " </image>\n"; |
1044 | 1044 | } |
1045 | 1045 | if ($this->language != '') { |
1046 | - $feed .= ' <language>' . $this->language . "</language>\n"; |
|
1046 | + $feed .= ' <language>'.$this->language."</language>\n"; |
|
1047 | 1047 | } |
1048 | 1048 | if ($this->copyright != '') { |
1049 | - $feed .= ' <copyright>' . FeedCreator::iTrunc(htmlspecialchars($this->copyright), 100) . "</copyright>\n"; |
|
1049 | + $feed .= ' <copyright>'.FeedCreator::iTrunc(htmlspecialchars($this->copyright), 100)."</copyright>\n"; |
|
1050 | 1050 | } |
1051 | 1051 | if ($this->editor != '') { |
1052 | - $feed .= ' <managingEditor>' . FeedCreator::iTrunc(htmlspecialchars($this->editor), 100) . "</managingEditor>\n"; |
|
1052 | + $feed .= ' <managingEditor>'.FeedCreator::iTrunc(htmlspecialchars($this->editor), 100)."</managingEditor>\n"; |
|
1053 | 1053 | } |
1054 | 1054 | if ($this->webmaster != '') { |
1055 | - $feed .= ' <webMaster>' . FeedCreator::iTrunc(htmlspecialchars($this->webmaster), 100) . "</webMaster>\n"; |
|
1055 | + $feed .= ' <webMaster>'.FeedCreator::iTrunc(htmlspecialchars($this->webmaster), 100)."</webMaster>\n"; |
|
1056 | 1056 | } |
1057 | 1057 | if ($this->pubDate != '') { |
1058 | 1058 | $pubDate = new FeedDate($this->pubDate); |
1059 | - $feed .= ' <pubDate>' . htmlspecialchars($pubDate->rfc822()) . "</pubDate>\n"; |
|
1059 | + $feed .= ' <pubDate>'.htmlspecialchars($pubDate->rfc822())."</pubDate>\n"; |
|
1060 | 1060 | } |
1061 | 1061 | if ($this->category != '') { |
1062 | - $feed .= ' <category>' . htmlspecialchars($this->category) . "</category>\n"; |
|
1062 | + $feed .= ' <category>'.htmlspecialchars($this->category)."</category>\n"; |
|
1063 | 1063 | } |
1064 | 1064 | if ($this->docs != '') { |
1065 | - $feed .= ' <docs>' . FeedCreator::iTrunc(htmlspecialchars($this->docs), 500) . "</docs>\n"; |
|
1065 | + $feed .= ' <docs>'.FeedCreator::iTrunc(htmlspecialchars($this->docs), 500)."</docs>\n"; |
|
1066 | 1066 | } |
1067 | 1067 | if ($this->ttl != '') { |
1068 | - $feed .= ' <ttl>' . htmlspecialchars($this->ttl) . "</ttl>\n"; |
|
1068 | + $feed .= ' <ttl>'.htmlspecialchars($this->ttl)."</ttl>\n"; |
|
1069 | 1069 | } |
1070 | 1070 | if ($this->rating != '') { |
1071 | - $feed .= ' <rating>' . FeedCreator::iTrunc(htmlspecialchars($this->rating), 500) . "</rating>\n"; |
|
1071 | + $feed .= ' <rating>'.FeedCreator::iTrunc(htmlspecialchars($this->rating), 500)."</rating>\n"; |
|
1072 | 1072 | } |
1073 | 1073 | if ($this->skipHours != '') { |
1074 | - $feed .= ' <skipHours>' . htmlspecialchars($this->skipHours) . "</skipHours>\n"; |
|
1074 | + $feed .= ' <skipHours>'.htmlspecialchars($this->skipHours)."</skipHours>\n"; |
|
1075 | 1075 | } |
1076 | 1076 | if ($this->skipDays != '') { |
1077 | - $feed .= ' <skipDays>' . htmlspecialchars($this->skipDays) . "</skipDays>\n"; |
|
1077 | + $feed .= ' <skipDays>'.htmlspecialchars($this->skipDays)."</skipDays>\n"; |
|
1078 | 1078 | } |
1079 | 1079 | $feed .= $this->_createAdditionalElements($this->additionalElements, ' '); |
1080 | 1080 | |
1081 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
1081 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
1082 | 1082 | $feed .= " <item>\n"; |
1083 | - $feed .= ' <title>' . FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), 100) . "</title>\n"; |
|
1084 | - $feed .= ' <link>' . htmlspecialchars($this->items[$i]->link) . "</link>\n"; |
|
1085 | - $feed .= ' <description>' . $this->items[$i]->getDescription() . "</description>\n"; |
|
1083 | + $feed .= ' <title>'.FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), 100)."</title>\n"; |
|
1084 | + $feed .= ' <link>'.htmlspecialchars($this->items[$i]->link)."</link>\n"; |
|
1085 | + $feed .= ' <description>'.$this->items[$i]->getDescription()."</description>\n"; |
|
1086 | 1086 | |
1087 | 1087 | if ($this->items[$i]->author != '') { |
1088 | - $feed .= ' <author>' . htmlspecialchars($this->items[$i]->author) . "</author>\n"; |
|
1088 | + $feed .= ' <author>'.htmlspecialchars($this->items[$i]->author)."</author>\n"; |
|
1089 | 1089 | } |
1090 | 1090 | /* |
1091 | 1091 | // on hold |
@@ -1094,17 +1094,17 @@ discard block |
||
1094 | 1094 | } |
1095 | 1095 | */ |
1096 | 1096 | if ($this->items[$i]->category != '') { |
1097 | - $feed .= ' <category>' . htmlspecialchars($this->items[$i]->category) . "</category>\n"; |
|
1097 | + $feed .= ' <category>'.htmlspecialchars($this->items[$i]->category)."</category>\n"; |
|
1098 | 1098 | } |
1099 | 1099 | if ($this->items[$i]->comments != '') { |
1100 | - $feed .= ' <comments>' . htmlspecialchars($this->items[$i]->comments) . "</comments>\n"; |
|
1100 | + $feed .= ' <comments>'.htmlspecialchars($this->items[$i]->comments)."</comments>\n"; |
|
1101 | 1101 | } |
1102 | 1102 | if ($this->items[$i]->date != '') { |
1103 | 1103 | $itemDate = new FeedDate($this->items[$i]->date); |
1104 | - $feed .= ' <pubDate>' . htmlspecialchars($itemDate->rfc822()) . "</pubDate>\n"; |
|
1104 | + $feed .= ' <pubDate>'.htmlspecialchars($itemDate->rfc822())."</pubDate>\n"; |
|
1105 | 1105 | } |
1106 | 1106 | if ($this->items[$i]->guid != '') { |
1107 | - $feed .= ' <guid>' . htmlspecialchars($this->items[$i]->guid) . "</guid>\n"; |
|
1107 | + $feed .= ' <guid>'.htmlspecialchars($this->items[$i]->guid)."</guid>\n"; |
|
1108 | 1108 | } |
1109 | 1109 | $feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, ' '); |
1110 | 1110 | $feed .= " </item>\n"; |
@@ -1157,32 +1157,32 @@ discard block |
||
1157 | 1157 | */ |
1158 | 1158 | public function createFeed() |
1159 | 1159 | { |
1160 | - $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n"; |
|
1160 | + $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n"; |
|
1161 | 1161 | $feed .= $this->_createStylesheetReferences(); |
1162 | 1162 | $feed .= "<feed version=\"0.1\" xmlns=\"http://example.com/newformat#\">\n"; |
1163 | - $feed .= ' <title>' . FeedCreator::iTrunc(htmlspecialchars($this->title), 100) . "</title>\n"; |
|
1163 | + $feed .= ' <title>'.FeedCreator::iTrunc(htmlspecialchars($this->title), 100)."</title>\n"; |
|
1164 | 1164 | $this->truncSize = 500; |
1165 | - $feed .= ' <subtitle>' . $this->getDescription() . "</subtitle>\n"; |
|
1166 | - $feed .= ' <link>' . $this->link . "</link>\n"; |
|
1167 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
1165 | + $feed .= ' <subtitle>'.$this->getDescription()."</subtitle>\n"; |
|
1166 | + $feed .= ' <link>'.$this->link."</link>\n"; |
|
1167 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
1168 | 1168 | $feed .= " <entry>\n"; |
1169 | - $feed .= ' <title>' . FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), 100) . "</title>\n"; |
|
1170 | - $feed .= ' <link>' . htmlspecialchars($this->items[$i]->link) . "</link>\n"; |
|
1169 | + $feed .= ' <title>'.FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), 100)."</title>\n"; |
|
1170 | + $feed .= ' <link>'.htmlspecialchars($this->items[$i]->link)."</link>\n"; |
|
1171 | 1171 | $itemDate = new FeedDate($this->items[$i]->date); |
1172 | - $feed .= ' <created>' . htmlspecialchars($itemDate->iso8601()) . "</created>\n"; |
|
1173 | - $feed .= ' <issued>' . htmlspecialchars($itemDate->iso8601()) . "</issued>\n"; |
|
1174 | - $feed .= ' <modified>' . htmlspecialchars($itemDate->iso8601()) . "</modified>\n"; |
|
1175 | - $feed .= ' <id>' . htmlspecialchars($this->items[$i]->guid) . "</id>\n"; |
|
1172 | + $feed .= ' <created>'.htmlspecialchars($itemDate->iso8601())."</created>\n"; |
|
1173 | + $feed .= ' <issued>'.htmlspecialchars($itemDate->iso8601())."</issued>\n"; |
|
1174 | + $feed .= ' <modified>'.htmlspecialchars($itemDate->iso8601())."</modified>\n"; |
|
1175 | + $feed .= ' <id>'.htmlspecialchars($this->items[$i]->guid)."</id>\n"; |
|
1176 | 1176 | if ($this->items[$i]->author != '') { |
1177 | 1177 | $feed .= " <author>\n"; |
1178 | - $feed .= ' <name>' . htmlspecialchars($this->items[$i]->author) . "</name>\n"; |
|
1178 | + $feed .= ' <name>'.htmlspecialchars($this->items[$i]->author)."</name>\n"; |
|
1179 | 1179 | if ($this->items[$i]->authorEmail != '') { |
1180 | - $feed .= ' <email>' . $this->items[$i]->authorEmail . "</email>\n"; |
|
1180 | + $feed .= ' <email>'.$this->items[$i]->authorEmail."</email>\n"; |
|
1181 | 1181 | } |
1182 | 1182 | $feed .= " </author>\n"; |
1183 | 1183 | } |
1184 | 1184 | $feed .= " <content type=\"text/html\" xml:lang=\"en-us\">\n"; |
1185 | - $feed .= " <div xmlns=\"http://www.w3.org/1999/xhtml\">" . $this->items[$i]->getDescription() . "</div>\n"; |
|
1185 | + $feed .= " <div xmlns=\"http://www.w3.org/1999/xhtml\">".$this->items[$i]->getDescription()."</div>\n"; |
|
1186 | 1186 | $feed .= " </content>\n"; |
1187 | 1187 | $feed .= " </entry>\n"; |
1188 | 1188 | } |
@@ -1224,50 +1224,50 @@ discard block |
||
1224 | 1224 | */ |
1225 | 1225 | public function createFeed() |
1226 | 1226 | { |
1227 | - $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n"; |
|
1227 | + $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n"; |
|
1228 | 1228 | $feed .= $this->_createGeneratorComment(); |
1229 | 1229 | $feed .= $this->_createStylesheetReferences(); |
1230 | 1230 | $feed .= "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\""; |
1231 | 1231 | if ($this->language != '') { |
1232 | - $feed .= " xml:lang=\"" . $this->language . "\""; |
|
1232 | + $feed .= " xml:lang=\"".$this->language."\""; |
|
1233 | 1233 | } |
1234 | 1234 | $feed .= ">\n"; |
1235 | - $feed .= ' <title>' . htmlspecialchars($this->title) . "</title>\n"; |
|
1236 | - $feed .= ' <tagline>' . htmlspecialchars($this->description) . "</tagline>\n"; |
|
1237 | - $feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"" . htmlspecialchars($this->link) . "\">\n"; |
|
1238 | - $feed .= ' <id>' . htmlspecialchars($this->link) . "</id>\n"; |
|
1239 | - $now = new FeedDate(); |
|
1240 | - $feed .= ' <modified>' . htmlspecialchars($now->iso8601()) . "</modified>\n"; |
|
1235 | + $feed .= ' <title>'.htmlspecialchars($this->title)."</title>\n"; |
|
1236 | + $feed .= ' <tagline>'.htmlspecialchars($this->description)."</tagline>\n"; |
|
1237 | + $feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"".htmlspecialchars($this->link)."\">\n"; |
|
1238 | + $feed .= ' <id>'.htmlspecialchars($this->link)."</id>\n"; |
|
1239 | + $now = new FeedDate(); |
|
1240 | + $feed .= ' <modified>'.htmlspecialchars($now->iso8601())."</modified>\n"; |
|
1241 | 1241 | if ($this->editor != '') { |
1242 | 1242 | $feed .= " <author>\n"; |
1243 | - $feed .= ' <name>' . $this->editor . "</name>\n"; |
|
1243 | + $feed .= ' <name>'.$this->editor."</name>\n"; |
|
1244 | 1244 | if ($this->editorEmail != '') { |
1245 | - $feed .= ' <email>' . $this->editorEmail . "</email>\n"; |
|
1245 | + $feed .= ' <email>'.$this->editorEmail."</email>\n"; |
|
1246 | 1246 | } |
1247 | 1247 | $feed .= " </author>\n"; |
1248 | 1248 | } |
1249 | - $feed .= ' <generator>' . FEEDCREATOR_VERSION . "</generator>\n"; |
|
1249 | + $feed .= ' <generator>'.FEEDCREATOR_VERSION."</generator>\n"; |
|
1250 | 1250 | $feed .= $this->_createAdditionalElements($this->additionalElements, ' '); |
1251 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
1251 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
1252 | 1252 | $feed .= " <entry>\n"; |
1253 | - $feed .= ' <title>' . htmlspecialchars(strip_tags($this->items[$i]->title)) . "</title>\n"; |
|
1254 | - $feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"" . htmlspecialchars($this->items[$i]->link) . "\">\n"; |
|
1253 | + $feed .= ' <title>'.htmlspecialchars(strip_tags($this->items[$i]->title))."</title>\n"; |
|
1254 | + $feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"".htmlspecialchars($this->items[$i]->link)."\">\n"; |
|
1255 | 1255 | if ($this->items[$i]->date == '') { |
1256 | 1256 | $this->items[$i]->date = time(); |
1257 | 1257 | } |
1258 | 1258 | $itemDate = new FeedDate($this->items[$i]->date); |
1259 | - $feed .= ' <created>' . htmlspecialchars($itemDate->iso8601()) . "</created>\n"; |
|
1260 | - $feed .= ' <issued>' . htmlspecialchars($itemDate->iso8601()) . "</issued>\n"; |
|
1261 | - $feed .= ' <modified>' . htmlspecialchars($itemDate->iso8601()) . "</modified>\n"; |
|
1262 | - $feed .= ' <id>' . htmlspecialchars($this->items[$i]->link) . "</id>\n"; |
|
1259 | + $feed .= ' <created>'.htmlspecialchars($itemDate->iso8601())."</created>\n"; |
|
1260 | + $feed .= ' <issued>'.htmlspecialchars($itemDate->iso8601())."</issued>\n"; |
|
1261 | + $feed .= ' <modified>'.htmlspecialchars($itemDate->iso8601())."</modified>\n"; |
|
1262 | + $feed .= ' <id>'.htmlspecialchars($this->items[$i]->link)."</id>\n"; |
|
1263 | 1263 | $feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, ' '); |
1264 | 1264 | if ($this->items[$i]->author != '') { |
1265 | 1265 | $feed .= " <author>\n"; |
1266 | - $feed .= ' <name>' . htmlspecialchars($this->items[$i]->author) . "</name>\n"; |
|
1266 | + $feed .= ' <name>'.htmlspecialchars($this->items[$i]->author)."</name>\n"; |
|
1267 | 1267 | $feed .= " </author>\n"; |
1268 | 1268 | } |
1269 | 1269 | if ($this->items[$i]->description != '') { |
1270 | - $feed .= ' <summary>' . htmlspecialchars($this->items[$i]->description) . "</summary>\n"; |
|
1270 | + $feed .= ' <summary>'.htmlspecialchars($this->items[$i]->description)."</summary>\n"; |
|
1271 | 1271 | } |
1272 | 1272 | $feed .= " </entry>\n"; |
1273 | 1273 | } |
@@ -1312,23 +1312,23 @@ discard block |
||
1312 | 1312 | //$line = rtrim($line); // remove trailing white space -> no =20\r\n necessary |
1313 | 1313 | $linlen = strlen($line); |
1314 | 1314 | $newline = ''; |
1315 | - for ($i = 0; $i < $linlen; ++$i) { |
|
1315 | + for ($i = 0; $i<$linlen; ++$i) { |
|
1316 | 1316 | $c = substr($line, $i, 1); |
1317 | 1317 | $dec = ord($c); |
1318 | - if (($dec == 32) && ($i == ($linlen - 1))) { // convert space at eol only |
|
1318 | + if (($dec == 32) && ($i == ($linlen-1))) { // convert space at eol only |
|
1319 | 1319 | $c = '=20'; |
1320 | - } elseif (($dec == 61) || ($dec < 32) || ($dec > 126)) { // always encode "\t", which is *not* required |
|
1321 | - $h2 = floor($dec / 16); |
|
1322 | - $h1 = floor($dec % 16); |
|
1323 | - $c = $escape . $hex["$h2"] . $hex["$h1"]; |
|
1320 | + } elseif (($dec == 61) || ($dec<32) || ($dec>126)) { // always encode "\t", which is *not* required |
|
1321 | + $h2 = floor($dec/16); |
|
1322 | + $h1 = floor($dec%16); |
|
1323 | + $c = $escape.$hex["$h2"].$hex["$h1"]; |
|
1324 | 1324 | } |
1325 | - if ((strlen($newline) + strlen($c)) >= $line_max) { // CRLF is not counted |
|
1326 | - $output .= $newline . $escape . $eol; // soft line break; " =\r\n" is okay |
|
1325 | + if ((strlen($newline)+strlen($c))>=$line_max) { // CRLF is not counted |
|
1326 | + $output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay |
|
1327 | 1327 | $newline = ''; |
1328 | 1328 | } |
1329 | 1329 | $newline .= $c; |
1330 | 1330 | } // end of for |
1331 | - $output .= $newline . $eol; |
|
1331 | + $output .= $newline.$eol; |
|
1332 | 1332 | } |
1333 | 1333 | |
1334 | 1334 | return trim($output); |
@@ -1340,23 +1340,23 @@ discard block |
||
1340 | 1340 | */ |
1341 | 1341 | public function createFeed() |
1342 | 1342 | { |
1343 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
1343 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
1344 | 1344 | if ($this->items[$i]->author != '') { |
1345 | 1345 | $from = $this->items[$i]->author; |
1346 | - } else { |
|
1346 | + }else { |
|
1347 | 1347 | $from = $this->title; |
1348 | 1348 | } |
1349 | 1349 | $itemDate = new FeedDate($this->items[$i]->date); |
1350 | - $feed .= 'From ' . strtr(MBOXCreator::qp_enc($from), ' ', '_') . ' ' . date('D M d H:i:s Y', $itemDate->unix()) . "\n"; |
|
1350 | + $feed .= 'From '.strtr(MBOXCreator::qp_enc($from), ' ', '_').' '.date('D M d H:i:s Y', $itemDate->unix())."\n"; |
|
1351 | 1351 | $feed .= "Content-Type: text/plain;\n"; |
1352 | - $feed .= " charset=\"" . $this->encoding . "\"\n"; |
|
1352 | + $feed .= " charset=\"".$this->encoding."\"\n"; |
|
1353 | 1353 | $feed .= "Content-Transfer-Encoding: quoted-printable\n"; |
1354 | 1354 | $feed .= "Content-Type: text/plain\n"; |
1355 | - $feed .= "From: \"" . MBOXCreator::qp_enc($from) . "\"\n"; |
|
1356 | - $feed .= 'Date: ' . $itemDate->rfc822() . "\n"; |
|
1357 | - $feed .= 'Subject: ' . MBOXCreator::qp_enc(FeedCreator::iTrunc($this->items[$i]->title, 100)) . "\n"; |
|
1355 | + $feed .= "From: \"".MBOXCreator::qp_enc($from)."\"\n"; |
|
1356 | + $feed .= 'Date: '.$itemDate->rfc822()."\n"; |
|
1357 | + $feed .= 'Subject: '.MBOXCreator::qp_enc(FeedCreator::iTrunc($this->items[$i]->title, 100))."\n"; |
|
1358 | 1358 | $feed .= "\n"; |
1359 | - $body = chunk_split(MBOXCreator::qp_enc($this->items[$i]->description)); |
|
1359 | + $body = chunk_split(MBOXCreator::qp_enc($this->items[$i]->description)); |
|
1360 | 1360 | $feed .= preg_replace("~\nFrom ([^\n]*)(\n?)~", "\n>From $1$2\n", $body); |
1361 | 1361 | $feed .= "\n"; |
1362 | 1362 | $feed .= "\n"; |
@@ -1375,7 +1375,7 @@ discard block |
||
1375 | 1375 | { |
1376 | 1376 | $fileInfo = pathinfo($_SERVER['PHP_SELF']); |
1377 | 1377 | |
1378 | - return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension']) + 1)) . '.mbox'; |
|
1378 | + return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension'])+1)).'.mbox'; |
|
1379 | 1379 | } |
1380 | 1380 | } |
1381 | 1381 | |
@@ -1401,35 +1401,35 @@ discard block |
||
1401 | 1401 | */ |
1402 | 1402 | public function createFeed() |
1403 | 1403 | { |
1404 | - $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n"; |
|
1404 | + $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n"; |
|
1405 | 1405 | $feed .= $this->_createGeneratorComment(); |
1406 | 1406 | $feed .= $this->_createStylesheetReferences(); |
1407 | 1407 | $feed .= "<opml xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n"; |
1408 | 1408 | $feed .= " <head>\n"; |
1409 | - $feed .= ' <title>' . htmlspecialchars($this->title) . "</title>\n"; |
|
1409 | + $feed .= ' <title>'.htmlspecialchars($this->title)."</title>\n"; |
|
1410 | 1410 | if ($this->pubDate != '') { |
1411 | 1411 | $date = new FeedDate($this->pubDate); |
1412 | - $feed .= ' <dateCreated>' . $date->rfc822() . "</dateCreated>\n"; |
|
1412 | + $feed .= ' <dateCreated>'.$date->rfc822()."</dateCreated>\n"; |
|
1413 | 1413 | } |
1414 | 1414 | if ($this->lastBuildDate != '') { |
1415 | 1415 | $date = new FeedDate($this->lastBuildDate); |
1416 | - $feed .= ' <dateModified>' . $date->rfc822() . "</dateModified>\n"; |
|
1416 | + $feed .= ' <dateModified>'.$date->rfc822()."</dateModified>\n"; |
|
1417 | 1417 | } |
1418 | 1418 | if ($this->editor != '') { |
1419 | - $feed .= ' <ownerName>' . $this->editor . "</ownerName>\n"; |
|
1419 | + $feed .= ' <ownerName>'.$this->editor."</ownerName>\n"; |
|
1420 | 1420 | } |
1421 | 1421 | if ($this->editorEmail != '') { |
1422 | - $feed .= ' <ownerEmail>' . $this->editorEmail . "</ownerEmail>\n"; |
|
1422 | + $feed .= ' <ownerEmail>'.$this->editorEmail."</ownerEmail>\n"; |
|
1423 | 1423 | } |
1424 | 1424 | $feed .= " </head>\n"; |
1425 | 1425 | $feed .= " <body>\n"; |
1426 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
1426 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
1427 | 1427 | $feed .= " <outline type=\"rss\" "; |
1428 | 1428 | $title = htmlspecialchars(strip_tags(strtr($this->items[$i]->title, "\n\r", ' '))); |
1429 | - $feed .= " title=\"" . $title . "\""; |
|
1430 | - $feed .= " text=\"" . $title . "\""; |
|
1429 | + $feed .= " title=\"".$title."\""; |
|
1430 | + $feed .= " text=\"".$title."\""; |
|
1431 | 1431 | //$feed.= " description=\"".htmlspecialchars($this->items[$i]->description)."\""; |
1432 | - $feed .= " url=\"" . htmlspecialchars($this->items[$i]->link) . "\""; |
|
1432 | + $feed .= " url=\"".htmlspecialchars($this->items[$i]->link)."\""; |
|
1433 | 1433 | $feed .= ">\n"; |
1434 | 1434 | } |
1435 | 1435 | $feed .= " </body>\n"; |
@@ -1513,7 +1513,7 @@ discard block |
||
1513 | 1513 | |
1514 | 1514 | //if no stylePrefix is set, generate it yourself depending on the script name |
1515 | 1515 | if ($this->stylePrefix == '') { |
1516 | - $this->stylePrefix = str_replace('.', '_', $this->_generateFilename()) . '_'; |
|
1516 | + $this->stylePrefix = str_replace('.', '_', $this->_generateFilename()).'_'; |
|
1517 | 1517 | } |
1518 | 1518 | |
1519 | 1519 | //set an openInNewWindow_token_to be inserted or not |
@@ -1524,49 +1524,49 @@ discard block |
||
1524 | 1524 | // use this array to put the lines in and implode later with "document.write" javascript |
1525 | 1525 | $feedArray = []; |
1526 | 1526 | if ($this->image != null) { |
1527 | - $imageStr = "<a href='" . $this->image->link . "'" . $targetInsert . '>' . "<img src='" . $this->image->url . "' border='0' alt='" . FeedCreator::iTrunc(htmlspecialchars($this->image->title), 100) . "' align='" . $this->imageAlign . "' "; |
|
1527 | + $imageStr = "<a href='".$this->image->link."'".$targetInsert.'>'."<img src='".$this->image->url."' border='0' alt='".FeedCreator::iTrunc(htmlspecialchars($this->image->title), 100)."' align='".$this->imageAlign."' "; |
|
1528 | 1528 | if ($this->image->width) { |
1529 | - $imageStr .= " width='" . $this->image->width . "' "; |
|
1529 | + $imageStr .= " width='".$this->image->width."' "; |
|
1530 | 1530 | } |
1531 | 1531 | if ($this->image->height) { |
1532 | - $imageStr .= " height='" . $this->image->height . "' "; |
|
1532 | + $imageStr .= " height='".$this->image->height."' "; |
|
1533 | 1533 | } |
1534 | - $imageStr .= '></a>'; |
|
1534 | + $imageStr .= '></a>'; |
|
1535 | 1535 | $feedArray[] = $imageStr; |
1536 | 1536 | } |
1537 | 1537 | |
1538 | 1538 | if ($this->title) { |
1539 | - $feedArray[] = "<div class='" . $this->stylePrefix . "title'><a href='" . $this->link . "' " . $targetInsert . " class='" . $this->stylePrefix . "title'>" . FeedCreator::iTrunc(htmlspecialchars($this->title), 100) . '</a></div>'; |
|
1539 | + $feedArray[] = "<div class='".$this->stylePrefix."title'><a href='".$this->link."' ".$targetInsert." class='".$this->stylePrefix."title'>".FeedCreator::iTrunc(htmlspecialchars($this->title), 100).'</a></div>'; |
|
1540 | 1540 | } |
1541 | 1541 | if ($this->getDescription()) { |
1542 | - $feedArray[] = "<div class='" . $this->stylePrefix . "description'>" . str_replace(']]>', '', str_replace('<![CDATA[', '', $this->getDescription())) . '</div>'; |
|
1542 | + $feedArray[] = "<div class='".$this->stylePrefix."description'>".str_replace(']]>', '', str_replace('<![CDATA[', '', $this->getDescription())).'</div>'; |
|
1543 | 1543 | } |
1544 | 1544 | |
1545 | 1545 | if ($this->header) { |
1546 | - $feedArray[] = "<div class='" . $this->stylePrefix . "header'>" . $this->header . '</div>'; |
|
1546 | + $feedArray[] = "<div class='".$this->stylePrefix."header'>".$this->header.'</div>'; |
|
1547 | 1547 | } |
1548 | 1548 | |
1549 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
1550 | - if ($this->separator && $i > 0) { |
|
1551 | - $feedArray[] = "<div class='" . $this->stylePrefix . "separator'>" . $this->separator . '</div>'; |
|
1549 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
1550 | + if ($this->separator && $i>0) { |
|
1551 | + $feedArray[] = "<div class='".$this->stylePrefix."separator'>".$this->separator.'</div>'; |
|
1552 | 1552 | } |
1553 | 1553 | |
1554 | 1554 | if ($this->items[$i]->title) { |
1555 | 1555 | if ($this->items[$i]->link) { |
1556 | - $feedArray[] = "<div class='" . $this->stylePrefix . "item_title'><a href='" . $this->items[$i]->link . "' class='" . $this->stylePrefix . "item_title'" . $targetInsert . '>' . FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), 100) . '</a></div>'; |
|
1557 | - } else { |
|
1558 | - $feedArray[] = "<div class='" . $this->stylePrefix . "item_title'>" . FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), 100) . '</div>'; |
|
1556 | + $feedArray[] = "<div class='".$this->stylePrefix."item_title'><a href='".$this->items[$i]->link."' class='".$this->stylePrefix."item_title'".$targetInsert.'>'.FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), 100).'</a></div>'; |
|
1557 | + }else { |
|
1558 | + $feedArray[] = "<div class='".$this->stylePrefix."item_title'>".FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), 100).'</div>'; |
|
1559 | 1559 | } |
1560 | 1560 | } |
1561 | 1561 | if ($this->items[$i]->getDescription()) { |
1562 | - $feedArray[] = "<div class='" . $this->stylePrefix . "item_description'>" . str_replace(']]>', '', str_replace('<![CDATA[', '', $this->items[$i]->getDescription())) . '</div>'; |
|
1562 | + $feedArray[] = "<div class='".$this->stylePrefix."item_description'>".str_replace(']]>', '', str_replace('<![CDATA[', '', $this->items[$i]->getDescription())).'</div>'; |
|
1563 | 1563 | } |
1564 | 1564 | } |
1565 | 1565 | if ($this->footer) { |
1566 | - $feedArray[] = "<div class='" . $this->stylePrefix . "footer'>" . $this->footer . '</div>'; |
|
1566 | + $feedArray[] = "<div class='".$this->stylePrefix."footer'>".$this->footer.'</div>'; |
|
1567 | 1567 | } |
1568 | 1568 | |
1569 | - $feed = '' . implode($feedArray, "\r\n"); |
|
1569 | + $feed = ''.implode($feedArray, "\r\n"); |
|
1570 | 1570 | |
1571 | 1571 | return $feed; |
1572 | 1572 | } |
@@ -1582,7 +1582,7 @@ discard block |
||
1582 | 1582 | { |
1583 | 1583 | $fileInfo = pathinfo($_SERVER['PHP_SELF']); |
1584 | 1584 | |
1585 | - return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension']) + 1)) . '.html'; |
|
1585 | + return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension'])+1)).'.html'; |
|
1586 | 1586 | } |
1587 | 1587 | } |
1588 | 1588 | |
@@ -1614,7 +1614,7 @@ discard block |
||
1614 | 1614 | |
1615 | 1615 | $jsFeed = ''; |
1616 | 1616 | foreach ($feedArray as $value) { |
1617 | - $jsFeed .= "document.write('" . trim(addslashes($value)) . "');\n"; |
|
1617 | + $jsFeed .= "document.write('".trim(addslashes($value))."');\n"; |
|
1618 | 1618 | } |
1619 | 1619 | |
1620 | 1620 | return $jsFeed; |
@@ -1631,7 +1631,7 @@ discard block |
||
1631 | 1631 | { |
1632 | 1632 | $fileInfo = pathinfo($_SERVER['PHP_SELF']); |
1633 | 1633 | |
1634 | - return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension']) + 1)) . '.js'; |
|
1634 | + return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension'])+1)).'.js'; |
|
1635 | 1635 | } |
1636 | 1636 | } |
1637 | 1637 |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | // smart append - field and namespace aware |
307 | 307 | |
308 | 308 | /** |
309 | - * @param $el |
|
309 | + * @param string $el |
|
310 | 310 | * @param $text |
311 | 311 | */ |
312 | 312 | public function append($el, $text) |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | } |
391 | 391 | |
392 | 392 | /** |
393 | - * @return bool |
|
393 | + * @return string|false |
|
394 | 394 | */ |
395 | 395 | public function is_rss() |
396 | 396 | { |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | } |
403 | 403 | |
404 | 404 | /** |
405 | - * @return bool |
|
405 | + * @return string|false |
|
406 | 406 | */ |
407 | 407 | public function is_atom() |
408 | 408 | { |
@@ -415,10 +415,10 @@ discard block |
||
415 | 415 | |
416 | 416 | /** |
417 | 417 | * return XML parser, and possibly re-encoded source |
418 | - * @param $source |
|
419 | - * @param $out_enc |
|
420 | - * @param $in_enc |
|
421 | - * @param $detect |
|
418 | + * @param string $source |
|
419 | + * @param string $out_enc |
|
420 | + * @param string|null $in_enc |
|
421 | + * @param boolean $detect |
|
422 | 422 | * @return array |
423 | 423 | */ |
424 | 424 | public function create_parser($source, $out_enc, $in_enc, $detect) |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | |
529 | 529 | /** |
530 | 530 | * @param $enc |
531 | - * @return bool|string |
|
531 | + * @return string|false |
|
532 | 532 | */ |
533 | 533 | public function known_encoding($enc) |
534 | 534 | { |
@@ -35,16 +35,16 @@ discard block |
||
35 | 35 | { |
36 | 36 | public $parser; |
37 | 37 | |
38 | - public $current_item = []; // item currently being parsed |
|
39 | - public $items = []; // collection of parsed items |
|
40 | - public $channel = []; // hash of channel fields |
|
38 | + public $current_item = []; // item currently being parsed |
|
39 | + public $items = []; // collection of parsed items |
|
40 | + public $channel = []; // hash of channel fields |
|
41 | 41 | public $textinput = []; |
42 | 42 | public $image = []; |
43 | 43 | public $feed_type; |
44 | 44 | public $feed_version; |
45 | - public $encoding = ''; // output encoding of parsed rss |
|
45 | + public $encoding = ''; // output encoding of parsed rss |
|
46 | 46 | |
47 | - public $_source_encoding = ''; // only set if we have to parse xml prolog |
|
47 | + public $_source_encoding = ''; // only set if we have to parse xml prolog |
|
48 | 48 | |
49 | 49 | public $ERROR = ''; |
50 | 50 | public $WARNING = ''; |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | # if PHP xml isn't compiled in, die |
102 | 102 | # |
103 | 103 | if (!function_exists('xml_parser_create')) { |
104 | - $this->error("Failed to load PHP's XML Extension. " . 'http://www.php.net/manual/en/ref.xml.php', E_USER_ERROR); |
|
104 | + $this->error("Failed to load PHP's XML Extension. ".'http://www.php.net/manual/en/ref.xml.php', E_USER_ERROR); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | list($parser, $source) = $this->create_parser($source, $output_encoding, $input_encoding, $detect_encoding); |
108 | 108 | |
109 | 109 | if (!is_resource($parser)) { |
110 | - $this->error("Failed to create an instance of PHP's XML parser. " . 'http://www.php.net/manual/en/ref.xml.php', E_USER_ERROR); |
|
110 | + $this->error("Failed to create an instance of PHP's XML parser. ".'http://www.php.net/manual/en/ref.xml.php', E_USER_ERROR); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | $this->parser = $parser; |
@@ -217,8 +217,8 @@ discard block |
||
217 | 217 | elseif ($this->feed_type == ATOM && $el === 'link') { |
218 | 218 | if (isset($attrs['rel']) && $attrs['rel'] === 'alternate') { |
219 | 219 | $link_el = 'link'; |
220 | - } else { |
|
221 | - $link_el = 'link_' . $attrs['rel']; |
|
220 | + }else { |
|
221 | + $link_el = 'link_'.$attrs['rel']; |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | $this->append($link_el, $attrs['href']); |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | { |
237 | 237 | if ($this->feed_type == ATOM && $this->incontent) { |
238 | 238 | $this->append_content($text); |
239 | - } else { |
|
239 | + }else { |
|
240 | 240 | $current_el = implode('_', array_reverse($this->stack)); |
241 | 241 | $this->append($current_el, $text); |
242 | 242 | } |
@@ -267,12 +267,12 @@ discard block |
||
267 | 267 | // note: i don't think this is actually neccessary |
268 | 268 | if ($this->stack[0] == $el) { |
269 | 269 | $this->append_content("</$el>"); |
270 | - } else { |
|
270 | + }else { |
|
271 | 271 | $this->append_content("<$el>"); |
272 | 272 | } |
273 | 273 | |
274 | 274 | array_shift($this->stack); |
275 | - } else { |
|
275 | + }else { |
|
276 | 276 | array_shift($this->stack); |
277 | 277 | } |
278 | 278 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | } elseif ($this->inimage) { |
325 | 325 | $this->concat($this->image[$this->current_namespace][$el], $text); |
326 | 326 | } |
327 | - } else { |
|
327 | + }else { |
|
328 | 328 | if ($this->initem) { |
329 | 329 | $this->concat($this->current_item[$el], $text); |
330 | 330 | } elseif ($this->intextinput) { |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | // if atom populate rss fields |
343 | 343 | if ($this->is_atom()) { |
344 | 344 | $this->channel['description'] = $this->channel['tagline']; |
345 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
345 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
346 | 346 | $item = $this->items[$i]; |
347 | 347 | if (isset($item['summary'])) { |
348 | 348 | $item['description'] = $item['summary']; |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $atom_date = isset($item['issued']) ? $item['issued'] : @$item['modified']; |
355 | 355 | if ($atom_date) { |
356 | 356 | $epoch = @parse_w3cdtf($atom_date); |
357 | - if ($epoch && $epoch > 0) { |
|
357 | + if ($epoch && $epoch>0) { |
|
358 | 358 | $item['date_timestamp'] = $epoch; |
359 | 359 | } |
360 | 360 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | } |
364 | 364 | } elseif ($this->is_rss()) { |
365 | 365 | $this->channel['tagline'] = $this->channel['description']; |
366 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
366 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
367 | 367 | $item = $this->items[$i]; |
368 | 368 | if (isset($item['description'])) { |
369 | 369 | $item['summary'] = $item['description']; |
@@ -374,12 +374,12 @@ discard block |
||
374 | 374 | |
375 | 375 | if ($this->is_rss() === '1.0' && isset($item['dc']['date'])) { |
376 | 376 | $epoch = @parse_w3cdtf($item['dc']['date']); |
377 | - if ($epoch && $epoch > 0) { |
|
377 | + if ($epoch && $epoch>0) { |
|
378 | 378 | $item['date_timestamp'] = $epoch; |
379 | 379 | } |
380 | 380 | } elseif (isset($item['pubdate'])) { |
381 | 381 | $epoch = @strtotime($item['pubdate']); |
382 | - if ($epoch > 0) { |
|
382 | + if ($epoch>0) { |
|
383 | 383 | $item['date_timestamp'] = $epoch; |
384 | 384 | } |
385 | 385 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | { |
397 | 397 | if ($this->feed_type == RSS) { |
398 | 398 | return $this->feed_version; |
399 | - } else { |
|
399 | + }else { |
|
400 | 400 | return false; |
401 | 401 | } |
402 | 402 | } |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | { |
409 | 409 | if ($this->feed_type == ATOM) { |
410 | 410 | return $this->feed_version; |
411 | - } else { |
|
411 | + }else { |
|
412 | 412 | return false; |
413 | 413 | } |
414 | 414 | } |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | { |
426 | 426 | if (substr(PHP_VERSION, 0, 1) == 5) { |
427 | 427 | $parser = $this->php5_create_parser($in_enc, $detect); |
428 | - } else { |
|
428 | + }else { |
|
429 | 429 | list($parser, $source) = $this->php4_create_parser($source, $in_enc, $detect); |
430 | 430 | } |
431 | 431 | if ($out_enc) { |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | // by default php5 does a fine job of detecting input encodings |
453 | 453 | if (!$detect && $in_enc) { |
454 | 454 | return xml_parser_create($in_enc); |
455 | - } else { |
|
455 | + }else { |
|
456 | 456 | return xml_parser_create(''); |
457 | 457 | } |
458 | 458 | } |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/m', $source, $m)) { |
486 | 486 | $in_enc = strtoupper($m[1]); |
487 | 487 | $this->source_encoding = $in_enc; |
488 | - } else { |
|
488 | + }else { |
|
489 | 489 | $in_enc = 'UTF-8'; |
490 | 490 | } |
491 | 491 | } |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | $enc = strtoupper($enc); |
536 | 536 | if (in_array($enc, $this->_KNOWN_ENCODINGS)) { |
537 | 537 | return $enc; |
538 | - } else { |
|
538 | + }else { |
|
539 | 539 | return false; |
540 | 540 | } |
541 | 541 | } |
@@ -552,14 +552,14 @@ discard block |
||
552 | 552 | } |
553 | 553 | if (MAGPIE_DEBUG) { |
554 | 554 | trigger_error($errormsg, $lvl); |
555 | - } else { |
|
555 | + }else { |
|
556 | 556 | error_log($errormsg, 0); |
557 | 557 | } |
558 | 558 | |
559 | 559 | $notices = E_USER_NOTICE | E_NOTICE; |
560 | 560 | if ($lvl & $notices) { |
561 | 561 | $this->WARNING = $errormsg; |
562 | - } else { |
|
562 | + }else { |
|
563 | 563 | $this->ERROR = $errormsg; |
564 | 564 | } |
565 | 565 | } |
@@ -595,12 +595,12 @@ discard block |
||
595 | 595 | ]; |
596 | 596 | |
597 | 597 | # calc epoch for current date assuming GMT |
598 | - $epoch = gmmktime((int)$hours, (int)$minutes, (int)$seconds, (int)$month, (int)$day, (int)$year); |
|
598 | + $epoch = gmmktime((int) $hours, (int) $minutes, (int) $seconds, (int) $month, (int) $day, (int) $year); |
|
599 | 599 | |
600 | 600 | $offset = 0; |
601 | 601 | if ($match[10] === 'Z') { |
602 | 602 | # zulu time, aka GMT |
603 | - } else { |
|
603 | + }else { |
|
604 | 604 | list($tz_mod, $tz_hour, $tz_min) = [$match[8], $match[9], $match[10]]; |
605 | 605 | |
606 | 606 | # zero out the variables |
@@ -611,20 +611,20 @@ discard block |
||
611 | 611 | $tz_min = 0; |
612 | 612 | } |
613 | 613 | |
614 | - $offset_secs = (($tz_hour * 60) + $tz_min) * 60; |
|
614 | + $offset_secs = (($tz_hour*60)+$tz_min)*60; |
|
615 | 615 | |
616 | 616 | # is timezone ahead of GMT? then subtract offset |
617 | 617 | # |
618 | 618 | if ($tz_mod == '+') { |
619 | - $offset_secs = $offset_secs * -1; |
|
619 | + $offset_secs = $offset_secs*-1; |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | $offset = $offset_secs; |
623 | 623 | } |
624 | - $epoch = $epoch + $offset; |
|
624 | + $epoch = $epoch+$offset; |
|
625 | 625 | |
626 | 626 | return $epoch; |
627 | - } else { |
|
627 | + }else { |
|
628 | 628 | return -1; |
629 | 629 | } |
630 | 630 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @var mixed $pattern |
118 | 118 | * @var mixed $replacement |
119 | 119 | * |
120 | - * @return bool true on success |
|
120 | + * @return null|boolean true on success |
|
121 | 121 | */ |
122 | 122 | public static function planetParseClass($class_string, $pattern = '', $replacement = '') |
123 | 123 | { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @var mixed $pattern |
154 | 154 | * @var mixed $replacement |
155 | 155 | * |
156 | - * @return bool true on success |
|
156 | + * @return null|boolean true on success |
|
157 | 157 | */ |
158 | 158 | public static function planetParseFunction($function_string, $pattern = '', $replacement = '') |
159 | 159 | { |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | |
521 | 521 | /** |
522 | 522 | * @param $url |
523 | - * @return bool|string |
|
523 | + * @return false|string |
|
524 | 524 | */ |
525 | 525 | public static function planetFetchFopen($url) |
526 | 526 | { |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | if (!defined('planet_FUNCTIONS')): |
39 | 39 | define('planet_FUNCTIONS', 1); |
40 | 40 | |
41 | - require XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/vars.php'; |
|
42 | - require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
43 | - require_once XOOPS_ROOT_PATH . '/Frameworks/art/functions.php'; |
|
41 | + require XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/vars.php'; |
|
42 | + require_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
43 | + require_once XOOPS_ROOT_PATH.'/Frameworks/art/functions.php'; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Class PlanetUtility |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public static function planetParseArguments(&$args_numeric, &$args, &$args_string) |
77 | 77 | { |
78 | - $args_abb = [ |
|
78 | + $args_abb = [ |
|
79 | 79 | 'a' => 'article', |
80 | 80 | 'b' => 'blog', |
81 | 81 | 'c' => 'category', |
@@ -90,24 +90,24 @@ discard block |
||
90 | 90 | if (preg_match("/[^\?]*\.php[\/|\?]([^\?]*)/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) { |
91 | 91 | $vars = preg_split("/[\/|&]/", $matches[1]); |
92 | 92 | $vars = array_map('trim', $vars); |
93 | - if (count($vars) > 0) { |
|
93 | + if (count($vars)>0) { |
|
94 | 94 | foreach ($vars as $var) { |
95 | 95 | if (is_numeric($var)) { |
96 | 96 | $args_numeric[] = $var; |
97 | 97 | } elseif (false === strpos($var, '=')) { |
98 | 98 | if (is_numeric(substr($var, 1))) { |
99 | - $args[$args_abb[strtolower($var{0})]] = (int)substr($var, 1); |
|
100 | - } else { |
|
99 | + $args[$args_abb[strtolower($var{0})]] = (int) substr($var, 1); |
|
100 | + }else { |
|
101 | 101 | $args_string[] = urldecode($var); |
102 | 102 | } |
103 | - } else { |
|
103 | + }else { |
|
104 | 104 | parse_str($var, $args); |
105 | 105 | } |
106 | 106 | } |
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | - return (count($args) + count($args_numeric) + count($args_string) == 0) ? null : true; |
|
110 | + return (count($args)+count($args_numeric)+count($args_string) == 0) ? null : true; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $pattern = [$pattern]; |
131 | 131 | $replacement = [$replacement]; |
132 | 132 | } |
133 | - if (is_array($pattern) && count($pattern) > 0) { |
|
133 | + if (is_array($pattern) && count($pattern)>0) { |
|
134 | 134 | $ii = 0; |
135 | 135 | foreach ($pattern as $pat) { |
136 | 136 | if (!in_array($pat, $patterns)) { |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $pattern = [$pattern]; |
167 | 167 | $replacement = [$replacement]; |
168 | 168 | } |
169 | - if (is_array($pattern) && count($pattern) > 0) { |
|
169 | + if (is_array($pattern) && count($pattern)>0) { |
|
170 | 170 | $ii = 0; |
171 | 171 | foreach ($pattern as $pat) { |
172 | 172 | if (!in_array($pat, $patterns)) { |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | if (!is_array($userid)) { |
210 | 210 | $userid = [$userid]; |
211 | 211 | } |
212 | - $users =& mod_getUnameFromIds($userid, $usereal, $linked); |
|
212 | + $users = & mod_getUnameFromIds($userid, $usereal, $linked); |
|
213 | 213 | |
214 | 214 | return $users; |
215 | 215 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $myts = MyTextSanitizer::getInstance(); |
227 | 227 | $link_array = preg_split("/(\r\n|\r|\n)( *)/", $text); |
228 | 228 | $links = []; |
229 | - if (count($link_array) > 0) { |
|
229 | + if (count($link_array)>0) { |
|
230 | 230 | foreach ($link_array as $link) { |
231 | 231 | @list($url, $title) = array_map('trim', preg_split('/ /', $link, 2)); |
232 | 232 | if (empty($url)) { |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | */ |
247 | 247 | public static function planetGetTemplate($pagename) |
248 | 248 | { |
249 | - return $GLOBALS['VAR_PREFIX'] . '_' . $pagename . '.tpl'; |
|
249 | + return $GLOBALS['VAR_PREFIX'].'_'.$pagename.'.tpl'; |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | } |
276 | 276 | |
277 | 277 | @list($pat, $rep) = array_map('trim', preg_split("#[\s]+#", $pattern)); |
278 | - $trackback_url = preg_replace('#' . $pat . '#', $rep, $article_obj->getVar('art_link')); |
|
278 | + $trackback_url = preg_replace('#'.$pat.'#', $rep, $article_obj->getVar('art_link')); |
|
279 | 279 | |
280 | 280 | return static::planetTrackback($trackback_url, $article); |
281 | 281 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | |
292 | 292 | $title = $article->getVar('art_title'); |
293 | 293 | $excerpt = $article->getVar('art_content'); |
294 | - $blog_name = $xoopsConfig['sitename'] . '-' . $xoopsModule->getVar('name'); |
|
294 | + $blog_name = $xoopsConfig['sitename'].'-'.$xoopsModule->getVar('name'); |
|
295 | 295 | $title = xoops_utf8_encode($title); |
296 | 296 | $excerpt = xoops_utf8_encode($excerpt); |
297 | 297 | $blog_name = xoops_utf8_encode($blog_name); |
@@ -299,15 +299,15 @@ discard block |
||
299 | 299 | $title1 = urlencode($title); |
300 | 300 | $excerpt1 = urlencode($excerpt); |
301 | 301 | $name1 = urlencode($blog_name); |
302 | - $url = urlencode(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article->getVar('art_id')); |
|
302 | + $url = urlencode(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$article->getVar('art_id')); |
|
303 | 303 | $query_string = "title=$title1&url=$url&blog_name=$name1&excerpt=$excerpt1&charset=$charset"; |
304 | 304 | $trackback_url = parse_url($trackback_url); |
305 | 305 | |
306 | - $http_request = 'POST ' . $trackback_url['path'] . ($trackback_url['query'] ? '?' . $trackback_url['query'] : '') . " HTTP/1.0\r\n"; |
|
307 | - $http_request .= 'Host: ' . $trackback_url['host'] . "\r\n"; |
|
308 | - $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . $charset . "\r\n"; |
|
309 | - $http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n"; |
|
310 | - $http_request .= 'User-Agent: XOOPS Blogs/' . XOOPS_VERSION; |
|
306 | + $http_request = 'POST '.$trackback_url['path'].($trackback_url['query'] ? '?'.$trackback_url['query'] : '')." HTTP/1.0\r\n"; |
|
307 | + $http_request .= 'Host: '.$trackback_url['host']."\r\n"; |
|
308 | + $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset='.$charset."\r\n"; |
|
309 | + $http_request .= 'Content-Length: '.strlen($query_string)."\r\n"; |
|
310 | + $http_request .= 'User-Agent: XOOPS Blogs/'.XOOPS_VERSION; |
|
311 | 311 | $http_request .= "\r\n\r\n"; |
312 | 312 | $http_request .= $query_string; |
313 | 313 | if ('' == $trackback_url['port']) { |
@@ -316,11 +316,11 @@ discard block |
||
316 | 316 | $fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 4); |
317 | 317 | @fwrite($fs, $http_request); |
318 | 318 | if ($xoopsModuleConfig['do_debug']) { |
319 | - $debug_file = XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '_trackback.log'; |
|
319 | + $debug_file = XOOPS_CACHE_PATH.'/'.$GLOBALS['moddirname'].'_trackback.log'; |
|
320 | 320 | $fr = "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n"; |
321 | 321 | $fr .= "CHARSET:$charset\n"; |
322 | 322 | $fr .= "NAME:$blog_name\n"; |
323 | - $fr .= 'TITLE:' . $title . "\n"; |
|
323 | + $fr .= 'TITLE:'.$title."\n"; |
|
324 | 324 | $fr .= "EXCERPT:$excerpt\n\n"; |
325 | 325 | while (!@feof($fs)) { |
326 | 326 | $fr .= @fgets($fs, 4096); |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | if ($fp = fopen($debug_file, 'a')) { |
331 | 331 | fwrite($fp, $fr); |
332 | 332 | fclose($fp); |
333 | - } else { |
|
333 | + }else { |
|
334 | 334 | } |
335 | 335 | } |
336 | 336 | @fclose($fs); |
@@ -350,19 +350,19 @@ discard block |
||
350 | 350 | PlanetUtility::planetGetPing($serv, $id); |
351 | 351 | } |
352 | 352 | } |
353 | - require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/class-IXR.php'; |
|
353 | + require_once XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/class-IXR.php'; |
|
354 | 354 | |
355 | 355 | // using a timeout of 3 seconds should be enough to cover slow servers |
356 | 356 | $client = new IXR_Client($server, false); |
357 | 357 | $client->timeout = 3; |
358 | - $client->useragent .= ' -- XOOPS Article/' . XOOPS_VERSION; |
|
358 | + $client->useragent .= ' -- XOOPS Article/'.XOOPS_VERSION; |
|
359 | 359 | |
360 | 360 | // when set to true, this outputs debug messages by itself |
361 | 361 | $client->debug = false; |
362 | 362 | |
363 | 363 | $blogname = xoops_utf8_encode($GLOBALS['xoopsModule']->getVar('name')); |
364 | - $home = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/'; |
|
365 | - $rss2_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php' . URL_DELIMITER . 'rss2.0/' . $id; |
|
364 | + $home = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/'; |
|
365 | + $rss2_url = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/xml.php'.URL_DELIMITER.'rss2.0/'.$id; |
|
366 | 366 | |
367 | 367 | if (!$client->query('weblogUpdates.extendedPing', $blogname, $home, $rss2_url)) { // then try a normal ping |
368 | 368 | $client->query('weblogUpdates.ping', $blogname, $home); |
@@ -378,16 +378,16 @@ discard block |
||
378 | 378 | { |
379 | 379 | $charset = 'utf-8'; |
380 | 380 | $error_message = xoops_utf8_encode($error_message); |
381 | - header('Content-Type: text/xml; charset="' . $charset . '"'); |
|
381 | + header('Content-Type: text/xml; charset="'.$charset.'"'); |
|
382 | 382 | if ($error) { |
383 | - echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n"; |
|
383 | + echo '<?xml version="1.0" encoding="'.$charset.'"?'.">\n"; |
|
384 | 384 | echo "<response>\n"; |
385 | 385 | echo "<error>1</error>\n"; |
386 | 386 | echo "<message>$error_message</message>\n"; |
387 | 387 | echo '</response>'; |
388 | 388 | die(); |
389 | - } else { |
|
390 | - echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n"; |
|
389 | + }else { |
|
390 | + echo '<?xml version="1.0" encoding="'.$charset.'"?'.">\n"; |
|
391 | 391 | echo "<response>\n"; |
392 | 392 | echo "<error>0</error>\n"; |
393 | 393 | echo '</response>'; |
@@ -407,11 +407,11 @@ discard block |
||
407 | 407 | if (is_array($string)) { |
408 | 408 | $value = []; |
409 | 409 | foreach ($string as $key => $val) { |
410 | - $value[] = $key . '|' . $val; |
|
410 | + $value[] = $key.'|'.$val; |
|
411 | 411 | } |
412 | 412 | $string = implode(',', $value); |
413 | 413 | } |
414 | - setcookie($GLOBALS['VAR_PREFIX'] . $name, $string, (int)$expire, '/'); |
|
414 | + setcookie($GLOBALS['VAR_PREFIX'].$name, $string, (int) $expire, '/'); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | /** |
@@ -421,14 +421,14 @@ discard block |
||
421 | 421 | */ |
422 | 422 | public static function planetGetCookie($name, $isArray = false) |
423 | 423 | { |
424 | - $value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'] . $name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'] . $name] : null; |
|
424 | + $value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'].$name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'].$name] : null; |
|
425 | 425 | if ($isArray) { |
426 | 426 | $_value = $value ? explode(',', $value) : []; |
427 | 427 | $value = []; |
428 | - if (count($_value) > 0) { |
|
428 | + if (count($_value)>0) { |
|
429 | 429 | foreach ($_value as $string) { |
430 | 430 | $key = substr($string, 0, strpos($string, '|')); |
431 | - $val = substr($string, strpos($string, '|') + 1); |
|
431 | + $val = substr($string, strpos($string, '|')+1); |
|
432 | 432 | $value[$key] = $val; |
433 | 433 | } |
434 | 434 | } |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | */ |
488 | 488 | public static function planetFetchSnoopy($url) |
489 | 489 | { |
490 | - require_once XOOPS_ROOT_PATH . '/class/snoopy.php'; |
|
490 | + require_once XOOPS_ROOT_PATH.'/class/snoopy.php'; |
|
491 | 491 | $snoopy = new Snoopy; |
492 | 492 | $data = ''; |
493 | 493 | if (@$snoopy->fetch($url)) { |
@@ -506,10 +506,10 @@ discard block |
||
506 | 506 | if (!function_exists('curl_init')) { |
507 | 507 | return false; |
508 | 508 | } |
509 | - $ch = curl_init(); // initialize curl handle |
|
509 | + $ch = curl_init(); // initialize curl handle |
|
510 | 510 | curl_setopt($ch, CURLOPT_URL, $url); // set url to post to |
511 | 511 | curl_setopt($ch, CURLOPT_FAILONERROR, 1); |
512 | - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects |
|
512 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects |
|
513 | 513 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable |
514 | 514 | curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 31s |
515 | 515 | $data = curl_exec($ch); // run the whole process |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | if ($index === false) { |
552 | 552 | return false; |
553 | 553 | } |
554 | - $index = strlen($haystack) - strlen($needle) - $index; |
|
554 | + $index = strlen($haystack)-strlen($needle)-$index; |
|
555 | 555 | |
556 | 556 | return $index; |
557 | 557 | } |
@@ -84,7 +84,7 @@ |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
87 | - * @return bool|string |
|
87 | + * @return string|false |
|
88 | 88 | */ |
89 | 89 | public function is_atom() |
90 | 90 | { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | global $msg; |
32 | 32 | |
33 | -require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/class/magpie.inc.php'; |
|
33 | +require_once XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/class/magpie.inc.php'; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * XmlParser |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $this->feed_version = empty($this->feed_version) ? '0.3' : $this->feed_version; |
93 | 93 | |
94 | 94 | return $this->feed_version; |
95 | - } else { |
|
95 | + }else { |
|
96 | 96 | return false; |
97 | 97 | } |
98 | 98 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $this->channel['tagline'] = @$this->channel['subtitle']; |
106 | 106 | unset($this->channel['subtitle']); |
107 | 107 | } |
108 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
108 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
109 | 109 | // ATOM time |
110 | 110 | if ($date = @$this->items[$i]['modified']) { |
111 | 111 | continue; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | $this->items[$i]['modified'] = $date; |
126 | 126 | } elseif ($this->is_rss() !== '1.0'): |
127 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
127 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
128 | 128 | if ($date = @$this->items[$i]['pubdate']) { |
129 | 129 | continue; |
130 | 130 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | unset($this->channel['tagline']); |
151 | 151 | } |
152 | 152 | |
153 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
153 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
154 | 154 | if ($date_timestamp = @$this->items[$i]['date_timestamp']) { |
155 | 155 | continue; |
156 | 156 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $this->items[$i]['date_timestamp'] = $date_timestamp; |
159 | 159 | } elseif ($date_timestamp = @$this->items[$i]['dc']['date']) { |
160 | 160 | $this->items[$i]['date_timestamp'] = $date_timestamp; |
161 | - } else { |
|
161 | + }else { |
|
162 | 162 | $this->items[$i]['date_timestamp'] = time(); |
163 | 163 | } |
164 | 164 | if (!is_numeric($this->items[$i]['date_timestamp'])) { |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | foreach (array_keys($val) as $key) { |
205 | 205 | $val[$key] = $this->_encoding($val[$key]); |
206 | 206 | } |
207 | - } else { |
|
207 | + }else { |
|
208 | 208 | $val = XoopsLocal::convert_encoding($val, $this->charset_out, $this->charset_in); |
209 | 209 | } |
210 | 210 |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @var mixed $pattern |
112 | 112 | * @var mixed $replacement |
113 | 113 | * |
114 | - * @return bool true on success |
|
114 | + * @return null|boolean true on success |
|
115 | 115 | */ |
116 | 116 | function planetParseClass($class_string, $pattern = '', $replacement = '') |
117 | 117 | { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @var mixed $pattern |
148 | 148 | * @var mixed $replacement |
149 | 149 | * |
150 | - * @return bool true on success |
|
150 | + * @return null|boolean true on success |
|
151 | 151 | */ |
152 | 152 | function planetParseFunction($function_string, $pattern = '', $replacement = '') |
153 | 153 | { |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | |
513 | 513 | /** |
514 | 514 | * @param $url |
515 | - * @return bool|string |
|
515 | + * @return false|string |
|
516 | 516 | */ |
517 | 517 | function planet_fetch_fopen($url) |
518 | 518 | { |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | if (!defined('planet_FUNCTIONS')): |
39 | 39 | define('planet_FUNCTIONS', 1); |
40 | 40 | |
41 | - require XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/vars.php'; |
|
42 | - require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
43 | - require_once XOOPS_ROOT_PATH . '/Frameworks/art/functions.php'; |
|
41 | + require XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/vars.php'; |
|
42 | + require_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
43 | + require_once XOOPS_ROOT_PATH.'/Frameworks/art/functions.php'; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Function to display messages |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | function planetParseArguments(&$args_numeric, &$args, &$args_string) |
71 | 71 | { |
72 | - $args_abb = [ |
|
72 | + $args_abb = [ |
|
73 | 73 | 'a' => 'article', |
74 | 74 | 'b' => 'blog', |
75 | 75 | 'c' => 'category', |
@@ -84,24 +84,24 @@ discard block |
||
84 | 84 | if (preg_match("/[^\?]*\.php[\/|\?]([^\?]*)/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) { |
85 | 85 | $vars = preg_split("/[\/|&]/", $matches[1]); |
86 | 86 | $vars = array_map('trim', $vars); |
87 | - if (count($vars) > 0) { |
|
87 | + if (count($vars)>0) { |
|
88 | 88 | foreach ($vars as $var) { |
89 | 89 | if (is_numeric($var)) { |
90 | 90 | $args_numeric[] = $var; |
91 | 91 | } elseif (false === strpos($var, '=')) { |
92 | 92 | if (is_numeric(substr($var, 1))) { |
93 | - $args[$args_abb[strtolower($var{0})]] = (int)substr($var, 1); |
|
94 | - } else { |
|
93 | + $args[$args_abb[strtolower($var{0})]] = (int) substr($var, 1); |
|
94 | + }else { |
|
95 | 95 | $args_string[] = urldecode($var); |
96 | 96 | } |
97 | - } else { |
|
97 | + }else { |
|
98 | 98 | parse_str($var, $args); |
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - return (count($args) + count($args_numeric) + count($args_string) == 0) ? null : true; |
|
104 | + return (count($args)+count($args_numeric)+count($args_string) == 0) ? null : true; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $pattern = [$pattern]; |
125 | 125 | $replacement = [$replacement]; |
126 | 126 | } |
127 | - if (is_array($pattern) && count($pattern) > 0) { |
|
127 | + if (is_array($pattern) && count($pattern)>0) { |
|
128 | 128 | $ii = 0; |
129 | 129 | foreach ($pattern as $pat) { |
130 | 130 | if (!in_array($pat, $patterns)) { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $pattern = [$pattern]; |
161 | 161 | $replacement = [$replacement]; |
162 | 162 | } |
163 | - if (is_array($pattern) && count($pattern) > 0) { |
|
163 | + if (is_array($pattern) && count($pattern)>0) { |
|
164 | 164 | $ii = 0; |
165 | 165 | foreach ($pattern as $pat) { |
166 | 166 | if (!in_array($pat, $patterns)) { |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | if (!is_array($userid)) { |
204 | 204 | $userid = [$userid]; |
205 | 205 | } |
206 | - $users =& mod_getUnameFromIds($userid, $usereal, $linked); |
|
206 | + $users = & mod_getUnameFromIds($userid, $usereal, $linked); |
|
207 | 207 | |
208 | 208 | return $users; |
209 | 209 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $myts = MyTextSanitizer::getInstance(); |
221 | 221 | $link_array = preg_split("/(\r\n|\r|\n)( *)/", $text); |
222 | 222 | $links = []; |
223 | - if (count($link_array) > 0) { |
|
223 | + if (count($link_array)>0) { |
|
224 | 224 | foreach ($link_array as $link) { |
225 | 225 | @list($url, $title) = array_map('trim', preg_split('/ /', $link, 2)); |
226 | 226 | if (empty($url)) { |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | function planetGetTemplate($pagename) |
242 | 242 | { |
243 | - return $GLOBALS['VAR_PREFIX'] . '_' . $pagename . '.tpl'; |
|
243 | + return $GLOBALS['VAR_PREFIX'].'_'.$pagename.'.tpl'; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | return false; |
269 | 269 | } |
270 | 270 | @list($pat, $rep) = array_map('trim', preg_split("#[\s]+#", $pattern)); |
271 | - $trackback_url = preg_replace('#' . $pat . '#', $rep, $article_obj->getVar('art_link')); |
|
271 | + $trackback_url = preg_replace('#'.$pat.'#', $rep, $article_obj->getVar('art_link')); |
|
272 | 272 | |
273 | 273 | return planetTrackback($trackback_url, $article); |
274 | 274 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | $title = $article->getVar('art_title'); |
286 | 286 | $excerpt = $article->getVar('art_content'); |
287 | - $blog_name = $xoopsConfig['sitename'] . '-' . $xoopsModule->getVar('name'); |
|
287 | + $blog_name = $xoopsConfig['sitename'].'-'.$xoopsModule->getVar('name'); |
|
288 | 288 | $title = xoops_utf8_encode($title); |
289 | 289 | $excerpt = xoops_utf8_encode($excerpt); |
290 | 290 | $blog_name = xoops_utf8_encode($blog_name); |
@@ -292,15 +292,15 @@ discard block |
||
292 | 292 | $title1 = urlencode($title); |
293 | 293 | $excerpt1 = urlencode($excerpt); |
294 | 294 | $name1 = urlencode($blog_name); |
295 | - $url = urlencode(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article->getVar('art_id')); |
|
295 | + $url = urlencode(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$article->getVar('art_id')); |
|
296 | 296 | $query_string = "title=$title1&url=$url&blog_name=$name1&excerpt=$excerpt1&charset=$charset"; |
297 | 297 | $trackback_url = parse_url($trackback_url); |
298 | 298 | |
299 | - $http_request = 'POST ' . $trackback_url['path'] . ($trackback_url['query'] ? '?' . $trackback_url['query'] : '') . " HTTP/1.0\r\n"; |
|
300 | - $http_request .= 'Host: ' . $trackback_url['host'] . "\r\n"; |
|
301 | - $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . $charset . "\r\n"; |
|
302 | - $http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n"; |
|
303 | - $http_request .= 'User-Agent: XOOPS Blogs/' . XOOPS_VERSION; |
|
299 | + $http_request = 'POST '.$trackback_url['path'].($trackback_url['query'] ? '?'.$trackback_url['query'] : '')." HTTP/1.0\r\n"; |
|
300 | + $http_request .= 'Host: '.$trackback_url['host']."\r\n"; |
|
301 | + $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset='.$charset."\r\n"; |
|
302 | + $http_request .= 'Content-Length: '.strlen($query_string)."\r\n"; |
|
303 | + $http_request .= 'User-Agent: XOOPS Blogs/'.XOOPS_VERSION; |
|
304 | 304 | $http_request .= "\r\n\r\n"; |
305 | 305 | $http_request .= $query_string; |
306 | 306 | if ('' == $trackback_url['port']) { |
@@ -309,11 +309,11 @@ discard block |
||
309 | 309 | $fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 4); |
310 | 310 | @fwrite($fs, $http_request); |
311 | 311 | if ($xoopsModuleConfig['do_debug']) { |
312 | - $debug_file = XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '_trackback.log'; |
|
312 | + $debug_file = XOOPS_CACHE_PATH.'/'.$GLOBALS['moddirname'].'_trackback.log'; |
|
313 | 313 | $fr = "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n"; |
314 | 314 | $fr .= "CHARSET:$charset\n"; |
315 | 315 | $fr .= "NAME:$blog_name\n"; |
316 | - $fr .= 'TITLE:' . $title . "\n"; |
|
316 | + $fr .= 'TITLE:'.$title."\n"; |
|
317 | 317 | $fr .= "EXCERPT:$excerpt\n\n"; |
318 | 318 | while (!@feof($fs)) { |
319 | 319 | $fr .= @fgets($fs, 4096); |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | if ($fp = fopen($debug_file, 'a')) { |
324 | 324 | fwrite($fp, $fr); |
325 | 325 | fclose($fp); |
326 | - } else { |
|
326 | + }else { |
|
327 | 327 | } |
328 | 328 | } |
329 | 329 | @fclose($fs); |
@@ -343,19 +343,19 @@ discard block |
||
343 | 343 | planetGetPing($serv, $id); |
344 | 344 | } |
345 | 345 | } |
346 | - require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/class-IXR.php'; |
|
346 | + require_once XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/class-IXR.php'; |
|
347 | 347 | |
348 | 348 | // using a timeout of 3 seconds should be enough to cover slow servers |
349 | 349 | $client = new IXR_Client($server, false); |
350 | 350 | $client->timeout = 3; |
351 | - $client->useragent .= ' -- XOOPS Article/' . XOOPS_VERSION; |
|
351 | + $client->useragent .= ' -- XOOPS Article/'.XOOPS_VERSION; |
|
352 | 352 | |
353 | 353 | // when set to true, this outputs debug messages by itself |
354 | 354 | $client->debug = false; |
355 | 355 | |
356 | 356 | $blogname = xoops_utf8_encode($GLOBALS['xoopsModule']->getVar('name')); |
357 | - $home = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/'; |
|
358 | - $rss2_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php' . URL_DELIMITER . 'rss2.0/' . $id; |
|
357 | + $home = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/'; |
|
358 | + $rss2_url = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/xml.php'.URL_DELIMITER.'rss2.0/'.$id; |
|
359 | 359 | |
360 | 360 | if (!$client->query('weblogUpdates.extendedPing', $blogname, $home, $rss2_url)) { // then try a normal ping |
361 | 361 | $client->query('weblogUpdates.ping', $blogname, $home); |
@@ -371,16 +371,16 @@ discard block |
||
371 | 371 | { |
372 | 372 | $charset = 'utf-8'; |
373 | 373 | $error_message = xoops_utf8_encode($error_message); |
374 | - header('Content-Type: text/xml; charset="' . $charset . '"'); |
|
374 | + header('Content-Type: text/xml; charset="'.$charset.'"'); |
|
375 | 375 | if ($error) { |
376 | - echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n"; |
|
376 | + echo '<?xml version="1.0" encoding="'.$charset.'"?'.">\n"; |
|
377 | 377 | echo "<response>\n"; |
378 | 378 | echo "<error>1</error>\n"; |
379 | 379 | echo "<message>$error_message</message>\n"; |
380 | 380 | echo '</response>'; |
381 | 381 | die(); |
382 | - } else { |
|
383 | - echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n"; |
|
382 | + }else { |
|
383 | + echo '<?xml version="1.0" encoding="'.$charset.'"?'.">\n"; |
|
384 | 384 | echo "<response>\n"; |
385 | 385 | echo "<error>0</error>\n"; |
386 | 386 | echo '</response>'; |
@@ -400,11 +400,11 @@ discard block |
||
400 | 400 | if (is_array($string)) { |
401 | 401 | $value = []; |
402 | 402 | foreach ($string as $key => $val) { |
403 | - $value[] = $key . '|' . $val; |
|
403 | + $value[] = $key.'|'.$val; |
|
404 | 404 | } |
405 | 405 | $string = implode(',', $value); |
406 | 406 | } |
407 | - setcookie($GLOBALS['VAR_PREFIX'] . $name, $string, (int)$expire, '/'); |
|
407 | + setcookie($GLOBALS['VAR_PREFIX'].$name, $string, (int) $expire, '/'); |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | /** |
@@ -414,14 +414,14 @@ discard block |
||
414 | 414 | */ |
415 | 415 | function planetGetCookie($name, $isArray = false) |
416 | 416 | { |
417 | - $value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'] . $name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'] . $name] : null; |
|
417 | + $value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'].$name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'].$name] : null; |
|
418 | 418 | if ($isArray) { |
419 | 419 | $_value = $value ? explode(',', $value) : []; |
420 | 420 | $value = []; |
421 | - if (count($_value) > 0) { |
|
421 | + if (count($_value)>0) { |
|
422 | 422 | foreach ($_value as $string) { |
423 | 423 | $key = substr($string, 0, strpos($string, '|')); |
424 | - $val = substr($string, strpos($string, '|') + 1); |
|
424 | + $val = substr($string, strpos($string, '|')+1); |
|
425 | 425 | $value[$key] = $val; |
426 | 426 | } |
427 | 427 | } |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | */ |
480 | 480 | function planet_fetch_snoopy($url) |
481 | 481 | { |
482 | - require_once XOOPS_ROOT_PATH . '/class/snoopy.php'; |
|
482 | + require_once XOOPS_ROOT_PATH.'/class/snoopy.php'; |
|
483 | 483 | $snoopy = new Snoopy; |
484 | 484 | $data = ''; |
485 | 485 | if (@$snoopy->fetch($url)) { |
@@ -498,10 +498,10 @@ discard block |
||
498 | 498 | if (!function_exists('curl_init')) { |
499 | 499 | return false; |
500 | 500 | } |
501 | - $ch = curl_init(); // initialize curl handle |
|
501 | + $ch = curl_init(); // initialize curl handle |
|
502 | 502 | curl_setopt($ch, CURLOPT_URL, $url); // set url to post to |
503 | 503 | curl_setopt($ch, CURLOPT_FAILONERROR, 1); |
504 | - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects |
|
504 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects |
|
505 | 505 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable |
506 | 506 | curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 31s |
507 | 507 | $data = curl_exec($ch); // run the whole process |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | if ($index === false) { |
544 | 544 | return false; |
545 | 545 | } |
546 | - $index = strlen($haystack) - strlen($needle) - $index; |
|
546 | + $index = strlen($haystack)-strlen($needle)-$index; |
|
547 | 547 | |
548 | 548 | return $index; |
549 | 549 | } |
@@ -287,7 +287,7 @@ |
||
287 | 287 | // Used in get_calendar |
288 | 288 | /** |
289 | 289 | * @param $num |
290 | - * @return mixed |
|
290 | + * @return double |
|
291 | 291 | */ |
292 | 292 | function planet_calendar_week_mod($num) |
293 | 293 | { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | use Xmf\Request; |
28 | 28 | |
29 | -include __DIR__ . '/header.php'; |
|
29 | +include __DIR__.'/header.php'; |
|
30 | 30 | |
31 | 31 | if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) { |
32 | 32 | $args['year'] = @$args_num[0]; |
@@ -45,26 +45,26 @@ discard block |
||
45 | 45 | $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); |
46 | 46 | $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
47 | 47 | |
48 | -$xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name') . ' - ' . planet_constant('MD_ACHIVE'); |
|
48 | +$xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name').' - '.planet_constant('MD_ACHIVE'); |
|
49 | 49 | $xoopsOption['template_main'] = PlanetUtility::planetGetTemplate('archive'); |
50 | -require_once XOOPS_ROOT_PATH . '/header.php'; |
|
51 | -include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
50 | +require_once XOOPS_ROOT_PATH.'/header.php'; |
|
51 | +include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'; |
|
52 | 52 | |
53 | 53 | $year = empty($year) ? date('Y') : $year; |
54 | -if ($month < 1) { |
|
54 | +if ($month<1) { |
|
55 | 55 | $month = $day = 0; |
56 | 56 | $page['time'] = sprintf(planet_constant('MD_TIME_Y'), $year); |
57 | -} elseif ($day < 1) { |
|
57 | +} elseif ($day<1) { |
|
58 | 58 | $day = 0; |
59 | 59 | $page['time'] = sprintf(planet_constant('MD_TIME_YM'), $year, $month); |
60 | -} else { |
|
60 | +}else { |
|
61 | 61 | $page['time'] = sprintf(planet_constant('MD_TIME_YMD'), $year, $month, $day); |
62 | 62 | } |
63 | 63 | $time = ['year' => $year, 'month' => $month, 'day' => $day]; |
64 | 64 | if ($xoopsUser) { |
65 | - $timeoffset = ($xoopsUser->getVar('timezone_offset') - $xoopsConfig['server_TZ']) * 3600; |
|
66 | -} else { |
|
67 | - $timeoffset = ($xoopsConfig['default_TZ'] - $xoopsConfig['server_TZ']) * 3600; |
|
65 | + $timeoffset = ($xoopsUser->getVar('timezone_offset')-$xoopsConfig['server_TZ'])*3600; |
|
66 | +}else { |
|
67 | + $timeoffset = ($xoopsConfig['default_TZ']-$xoopsConfig['server_TZ'])*3600; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | $criteria = new CriteriaCompo(); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $articles = []; |
88 | 88 | $blogs_id = []; |
89 | 89 | foreach ($articles_obj as $id => $article) { |
90 | - $articles[] = [ |
|
90 | + $articles[] = [ |
|
91 | 91 | 'id' => $id, |
92 | 92 | 'blog' => ['id' => $article->getVar('blog_id'), 'title' => ''], |
93 | 93 | 'title' => $article->getVar('art_title'), |
@@ -98,20 +98,20 @@ discard block |
||
98 | 98 | $blogs_id[$article->getVar('blog_id')] = 1; |
99 | 99 | unset($_article); |
100 | 100 | } |
101 | -$criteria_blog = new Criteria('blog_id', '(' . implode(',', array_keys($blog_array)) . ')', 'IN'); |
|
101 | +$criteria_blog = new Criteria('blog_id', '('.implode(',', array_keys($blog_array)).')', 'IN'); |
|
102 | 102 | $blogs = $blogHandler->getList($criteria_blog); |
103 | 103 | foreach (array_keys($articles) as $key) { |
104 | 104 | $articles[$key]['blog']['title'] = $blogs[$articles[$key]['blog']['id']]; |
105 | 105 | } |
106 | -if ($blog_id > 0) { |
|
106 | +if ($blog_id>0) { |
|
107 | 107 | $page['blog'] = $blogs[$blog_id]; |
108 | 108 | } |
109 | 109 | |
110 | -if ($articles_count > $xoopsModuleConfig['articles_perpage']) { |
|
111 | - include XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
112 | - $nav = new XoopsPageNav($articles_count, $xoopsModuleConfig['articles_perpage'], $start, 'start', 'month=' . $month . '&day=' . $day . '&year=' . $year . '&blog=' . (int)$blog_id); |
|
110 | +if ($articles_count>$xoopsModuleConfig['articles_perpage']) { |
|
111 | + include XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
112 | + $nav = new XoopsPageNav($articles_count, $xoopsModuleConfig['articles_perpage'], $start, 'start', 'month='.$month.'&day='.$day.'&year='.$year.'&blog='.(int) $blog_id); |
|
113 | 113 | $pagenav = $nav->renderNav(4); |
114 | -} else { |
|
114 | +}else { |
|
115 | 115 | $pagenav = ''; |
116 | 116 | } |
117 | 117 | |
@@ -120,43 +120,43 @@ discard block |
||
120 | 120 | $months = null; |
121 | 121 | if (empty($start)) { |
122 | 122 | if ($blog_id) { |
123 | - $blog_criteria = ' AND blog_id=' . $blog_id; |
|
124 | - } else { |
|
123 | + $blog_criteria = ' AND blog_id='.$blog_id; |
|
124 | + }else { |
|
125 | 125 | $blog_criteria = ''; |
126 | 126 | } |
127 | 127 | // Get monthly list |
128 | 128 | if (empty($month)) { |
129 | - $sql = "SELECT MONTH(FROM_UNIXTIME(art_time - $timeoffset)) AS mon, COUNT(DISTINCT art_id) AS count |
|
130 | - FROM " . planet_DB_prefix('article') . " |
|
129 | + $sql = "SELECT MONTH(FROM_UNIXTIME(art_time - $timeoffset)) AS mon, COUNT(DISTINCT art_id) AS count |
|
130 | + FROM ".planet_DB_prefix('article')." |
|
131 | 131 | WHERE YEAR(FROM_UNIXTIME(art_time - $timeoffset)) = $year |
132 | - " . $blog_criteria . ' |
|
132 | + ".$blog_criteria.' |
|
133 | 133 | GROUP BY mon |
134 | 134 | '; |
135 | 135 | $result = $xoopsDB->query($sql); |
136 | 136 | $months = []; |
137 | 137 | while ($myrow = $xoopsDB->fetchArray($result)) { |
138 | 138 | $months[] = [ |
139 | - 'title' => planet_constant('MD_MONTH_' . (int)$myrow['mon']) . ' (' . (int)$myrow['count'] . ')', |
|
140 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $year . '/' . $myrow['mon'] . '/b' . $blog_id |
|
139 | + 'title' => planet_constant('MD_MONTH_'.(int) $myrow['mon']).' ('.(int) $myrow['count'].')', |
|
140 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.''.$year.'/'.$myrow['mon'].'/b'.$blog_id |
|
141 | 141 | ]; |
142 | 142 | } |
143 | 143 | $timenav['prev'] = [ |
144 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . ($year - 1) . '/b' . $blog_id, |
|
145 | - 'title' => sprintf(planet_constant('MD_TIME_Y'), $year - 1) |
|
144 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.''.($year-1).'/b'.$blog_id, |
|
145 | + 'title' => sprintf(planet_constant('MD_TIME_Y'), $year-1) |
|
146 | 146 | ]; |
147 | - if ($year < date('Y')) { |
|
147 | + if ($year<date('Y')) { |
|
148 | 148 | $timenav['next'] = [ |
149 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . ($year + 1) . '/b' . $blog_id, |
|
150 | - 'title' => sprintf(planet_constant('MD_TIME_Y'), $year + 1) |
|
149 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.''.($year+1).'/b'.$blog_id, |
|
150 | + 'title' => sprintf(planet_constant('MD_TIME_Y'), $year+1) |
|
151 | 151 | ]; |
152 | 152 | } |
153 | 153 | } // Get daily list |
154 | 154 | elseif (empty($day)) { |
155 | - $sql = "SELECT DAY(FROM_UNIXTIME(art_time - $timeoffset)) AS day, COUNT(DISTINCT a.art_id) AS count |
|
156 | - FROM " . planet_DB_prefix('article') . " |
|
155 | + $sql = "SELECT DAY(FROM_UNIXTIME(art_time - $timeoffset)) AS day, COUNT(DISTINCT a.art_id) AS count |
|
156 | + FROM ".planet_DB_prefix('article')." |
|
157 | 157 | WHERE YEAR(FROM_UNIXTIME(art_time - $timeoffset)) = $year |
158 | 158 | AND MONTH(FROM_UNIXTIME(art_time - $timeoffset)) = $month |
159 | - " . $blog_criteria . ' |
|
159 | + ".$blog_criteria.' |
|
160 | 160 | GROUP BY day |
161 | 161 | '; |
162 | 162 | $result = $xoopsDB->query($sql); |
@@ -164,35 +164,35 @@ discard block |
||
164 | 164 | while ($myrow = $xoopsDB->fetchArray($result)) { |
165 | 165 | $days[$myrow['day']]['count'] = $myrow['count']; |
166 | 166 | } |
167 | - for ($i = 1; $i <= 31; ++$i) { |
|
167 | + for ($i = 1; $i<=31; ++$i) { |
|
168 | 168 | if (!isset($days[$i])) { |
169 | 169 | continue; |
170 | 170 | } |
171 | 171 | $days[$i] = [ |
172 | 172 | 'title' => $days[$i]['count'], |
173 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $year . '/' . $month . '/' . $i . '/b' . $blog_id |
|
173 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.''.$year.'/'.$month.'/'.$i.'/b'.$blog_id |
|
174 | 174 | ]; |
175 | 175 | } |
176 | 176 | $calendar = planet_getCalendar($year, $month, $days); |
177 | - $month_next = $month + 1; |
|
178 | - $month_prev = $month - 1; |
|
177 | + $month_next = $month+1; |
|
178 | + $month_prev = $month-1; |
|
179 | 179 | $_year = $year; |
180 | 180 | if ($month == 12) { |
181 | 181 | $month_next = 1; |
182 | - $_year = $year + 1; |
|
182 | + $_year = $year+1; |
|
183 | 183 | } |
184 | 184 | if ($month == 1) { |
185 | 185 | $month_pre = 12; |
186 | - $_year = $year - 1; |
|
186 | + $_year = $year-1; |
|
187 | 187 | } |
188 | 188 | $timenav['prev'] = [ |
189 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $_year . '/' . $month_prev . '/b' . $blog_id, |
|
190 | - 'title' => planet_constant('MD_MONTH_' . $month_prev) |
|
189 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.''.$_year.'/'.$month_prev.'/b'.$blog_id, |
|
190 | + 'title' => planet_constant('MD_MONTH_'.$month_prev) |
|
191 | 191 | ]; |
192 | - if ($year < date('Y') || $month < date('n')) { |
|
192 | + if ($year<date('Y') || $month<date('n')) { |
|
193 | 193 | $timenav['next'] = [ |
194 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $_year . '/' . $month_next . '/b' . $blog_id, |
|
195 | - 'title' => planet_constant('MD_MONTH_' . $month_next) |
|
194 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.''.$_year.'/'.$month_next.'/b'.$blog_id, |
|
195 | + 'title' => planet_constant('MD_MONTH_'.$month_next) |
|
196 | 196 | ]; |
197 | 197 | } |
198 | 198 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $xoopsTpl->assign('timenav', $timenav); |
213 | 213 | $xoopsTpl->assign('pagenav', $pagenav); |
214 | 214 | |
215 | -require_once __DIR__ . '/footer.php'; |
|
215 | +require_once __DIR__.'/footer.php'; |
|
216 | 216 | |
217 | 217 | /** |
218 | 218 | * @param null $year |
@@ -229,24 +229,24 @@ discard block |
||
229 | 229 | ob_start(); |
230 | 230 | echo '<table id="calendar">'; |
231 | 231 | echo '<caption>'; |
232 | - printf(planet_constant('MD_TIME_YM'), $year, planet_constant('MD_MONTH_' . $month)); |
|
232 | + printf(planet_constant('MD_TIME_YM'), $year, planet_constant('MD_MONTH_'.$month)); |
|
233 | 233 | echo '</caption>'; |
234 | 234 | |
235 | - for ($i = 1; $i <= 7; ++$i) { |
|
236 | - echo "\n\t\t<th abbr=\"" . planet_constant('MD_WEEK_' . $i) . "\" scope=\"col\" title=\"" . planet_constant('MD_WEEK_' . $i) . "\">" . planet_constant('MD_WEEK_' . $i) . '</th>'; |
|
235 | + for ($i = 1; $i<=7; ++$i) { |
|
236 | + echo "\n\t\t<th abbr=\"".planet_constant('MD_WEEK_'.$i)."\" scope=\"col\" title=\"".planet_constant('MD_WEEK_'.$i)."\">".planet_constant('MD_WEEK_'.$i).'</th>'; |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | echo '<tr>'; |
240 | 240 | |
241 | 241 | // See how much we should pad in the beginning |
242 | 242 | $week_begins = 1; |
243 | - $pad = planet_calendar_week_mod(date('w', $unixmonth) - $week_begins); |
|
243 | + $pad = planet_calendar_week_mod(date('w', $unixmonth)-$week_begins); |
|
244 | 244 | if (0 != $pad) { |
245 | - echo "\n\t\t" . '<td colspan="' . $pad . '"> </td>'; |
|
245 | + echo "\n\t\t".'<td colspan="'.$pad.'"> </td>'; |
|
246 | 246 | } |
247 | 247 | |
248 | - $daysinmonth = (int)date('t', $unixmonth); |
|
249 | - for ($day = 1; $day <= $daysinmonth; ++$day) { |
|
248 | + $daysinmonth = (int) date('t', $unixmonth); |
|
249 | + for ($day = 1; $day<=$daysinmonth; ++$day) { |
|
250 | 250 | if (isset($newrow) && $newrow) { |
251 | 251 | echo "\n\t</tr>\n\t<tr>\n\t\t"; |
252 | 252 | } |
@@ -255,26 +255,26 @@ discard block |
||
255 | 255 | echo '<td>'; |
256 | 256 | |
257 | 257 | if (!empty($days[$day]['url'])) { |
258 | - echo '<a href="' . $days[$day]['url'] . "\""; |
|
258 | + echo '<a href="'.$days[$day]['url']."\""; |
|
259 | 259 | if (!empty($days[$day]['title'])) { |
260 | - echo "title=\"" . $days[$day]['title'] . "\""; |
|
260 | + echo "title=\"".$days[$day]['title']."\""; |
|
261 | 261 | } |
262 | 262 | echo ">$day</a>"; |
263 | 263 | } elseif (!empty($days[$day]['title'])) { |
264 | - echo "<acronym title=\"" . $days[$day]['title'] . "\">$day</acronym>"; |
|
265 | - } else { |
|
264 | + echo "<acronym title=\"".$days[$day]['title']."\">$day</acronym>"; |
|
265 | + }else { |
|
266 | 266 | echo $day; |
267 | 267 | } |
268 | 268 | echo '</td>'; |
269 | 269 | |
270 | - if (6 == planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year)) - $week_begins)) { |
|
270 | + if (6 == planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year))-$week_begins)) { |
|
271 | 271 | $newrow = true; |
272 | 272 | } |
273 | 273 | } |
274 | 274 | |
275 | - $pad = 7 - planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year)) - $week_begins); |
|
275 | + $pad = 7-planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year))-$week_begins); |
|
276 | 276 | if ($pad != 0 && $pad != 7) { |
277 | - echo "\n\t\t" . '<td class="pad" colspan="' . $pad . '"> </td>'; |
|
277 | + echo "\n\t\t".'<td class="pad" colspan="'.$pad.'"> </td>'; |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | echo "\n\t</tr>\n\t</tbody>\n\t</table>"; |
@@ -293,5 +293,5 @@ discard block |
||
293 | 293 | { |
294 | 294 | $base = 7; |
295 | 295 | |
296 | - return ($num - $base * floor($num / $base)); |
|
296 | + return ($num-$base*floor($num/$base)); |
|
297 | 297 | } |
@@ -32,8 +32,8 @@ |
||
32 | 32 | $current_path = str_replace(strpos($current_path, "\\\\", 2) ? "\\\\" : DIRECTORY_SEPARATOR, '/', $current_path); |
33 | 33 | } |
34 | 34 | $url_arr = explode('/', strstr($current_path, '/modules/')); |
35 | -include XOOPS_ROOT_PATH . '/modules/' . $url_arr[2] . '/include/vars.php'; |
|
36 | -include XOOPS_ROOT_PATH . '/modules/' . $url_arr[2] . '/class/utility.php'; |
|
35 | +include XOOPS_ROOT_PATH.'/modules/'.$url_arr[2].'/include/vars.php'; |
|
36 | +include XOOPS_ROOT_PATH.'/modules/'.$url_arr[2].'/class/utility.php'; |
|
37 | 37 | //require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/functions.php'; |
38 | 38 | |
39 | 39 | /** |