@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | /** |
| 168 | 168 | * IXR_Message constructor. |
| 169 | - * @param $message |
|
| 169 | + * @param string|boolean $message |
|
| 170 | 170 | */ |
| 171 | 171 | public function __construct($message) { |
| 172 | 172 | $this->message = $message; |
@@ -863,7 +863,7 @@ discard block |
||
| 863 | 863 | |
| 864 | 864 | /** |
| 865 | 865 | * IXR_Base64 constructor. |
| 866 | - * @param $data |
|
| 866 | + * @param string $data |
|
| 867 | 867 | */ |
| 868 | 868 | public function __construct($data) { |
| 869 | 869 | $this->data = $data; |
@@ -906,10 +906,10 @@ discard block |
||
| 906 | 906 | } |
| 907 | 907 | |
| 908 | 908 | /** |
| 909 | - * @param $method |
|
| 910 | - * @param $callback |
|
| 911 | - * @param $args |
|
| 912 | - * @param $help |
|
| 909 | + * @param string $method |
|
| 910 | + * @param string $callback |
|
| 911 | + * @param string[] $args |
|
| 912 | + * @param string $help |
|
| 913 | 913 | */ |
| 914 | 914 | public function addCallback($method, $callback, $args, $help) { |
| 915 | 915 | $this->callbacks[$method] = $callback; |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | if ($type === 'array') { |
| 38 | - for ($i = 0, $j = count($this->data); $i < $j; ++$i) { |
|
| 38 | + for ($i = 0, $j = count($this->data); $i<$j; ++$i) { |
|
| 39 | 39 | $this->data[$i] = new IXR_Value($this->data[$i]); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | /* We have an array - is it an array or a struct ? */ |
| 74 | 74 | if ($this->isStruct($this->data)) { |
| 75 | 75 | return 'struct'; |
| 76 | - } else { |
|
| 76 | + }else { |
|
| 77 | 77 | return 'array'; |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -85,31 +85,31 @@ discard block |
||
| 85 | 85 | /* Return XML for this value */ |
| 86 | 86 | switch ($this->type) { |
| 87 | 87 | case 'boolean': |
| 88 | - return '<boolean>' . ($this->data ? '1' : '0') . '</boolean>'; |
|
| 88 | + return '<boolean>'.($this->data ? '1' : '0').'</boolean>'; |
|
| 89 | 89 | break; |
| 90 | 90 | case 'int': |
| 91 | - return '<int>' . $this->data . '</int>'; |
|
| 91 | + return '<int>'.$this->data.'</int>'; |
|
| 92 | 92 | break; |
| 93 | 93 | case 'double': |
| 94 | - return '<double>' . $this->data . '</double>'; |
|
| 94 | + return '<double>'.$this->data.'</double>'; |
|
| 95 | 95 | break; |
| 96 | 96 | case 'string': |
| 97 | - return '<string>' . htmlspecialchars($this->data) . '</string>'; |
|
| 97 | + return '<string>'.htmlspecialchars($this->data).'</string>'; |
|
| 98 | 98 | break; |
| 99 | 99 | case 'array': |
| 100 | - $return = '<array><data>' . "\n"; |
|
| 100 | + $return = '<array><data>'."\n"; |
|
| 101 | 101 | foreach ($this->data as $item) { |
| 102 | - $return .= ' <value>' . $item->getXml() . "</value>\n"; |
|
| 102 | + $return .= ' <value>'.$item->getXml()."</value>\n"; |
|
| 103 | 103 | } |
| 104 | 104 | $return .= '</data></array>'; |
| 105 | 105 | |
| 106 | 106 | return $return; |
| 107 | 107 | break; |
| 108 | 108 | case 'struct': |
| 109 | - $return = '<struct>' . "\n"; |
|
| 109 | + $return = '<struct>'."\n"; |
|
| 110 | 110 | foreach ($this->data as $name => $value) { |
| 111 | 111 | $return .= " <member><name>$name</name><value>"; |
| 112 | - $return .= $value->getXml() . "</value></member>\n"; |
|
| 112 | + $return .= $value->getXml()."</value></member>\n"; |
|
| 113 | 113 | } |
| 114 | 114 | $return .= '</struct>'; |
| 115 | 115 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | /* Nasty function to check if an array is a struct or not */ |
| 133 | 133 | $expected = 0; |
| 134 | 134 | foreach ($array as $key => $value) { |
| 135 | - if ((string)$key != (string)$expected) { |
|
| 135 | + if ((string) $key != (string) $expected) { |
|
| 136 | 136 | return true; |
| 137 | 137 | } |
| 138 | 138 | ++$expected; |
@@ -148,15 +148,15 @@ discard block |
||
| 148 | 148 | class IXR_Message |
| 149 | 149 | { |
| 150 | 150 | public $message; |
| 151 | - public $messageType; // methodCall / methodResponse / fault |
|
| 151 | + public $messageType; // methodCall / methodResponse / fault |
|
| 152 | 152 | public $faultCode; |
| 153 | 153 | public $faultString; |
| 154 | 154 | public $methodName; |
| 155 | 155 | public $params; |
| 156 | 156 | // Current variable stacks |
| 157 | - public $_arraystructs = array(); // The stack used to keep track of the current array/struct |
|
| 157 | + public $_arraystructs = array(); // The stack used to keep track of the current array/struct |
|
| 158 | 158 | public $_arraystructstypes = array(); // Stack keeping track of if things are structs or array |
| 159 | - public $_currentStructName = array(); // A stack as well |
|
| 159 | + public $_currentStructName = array(); // A stack as well |
|
| 160 | 160 | public $_param; |
| 161 | 161 | public $_value; |
| 162 | 162 | public $_currentTag; |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | public function parse() { |
| 179 | 179 | // first remove the XML declaration |
| 180 | - $this->message = preg_replace('/<\?xml(.*)?\?' . '>/', '', $this->message); |
|
| 180 | + $this->message = preg_replace('/<\?xml(.*)?\?'.'>/', '', $this->message); |
|
| 181 | 181 | if (trim($this->message) == '') { |
| 182 | 182 | return false; |
| 183 | 183 | } |
@@ -247,17 +247,17 @@ discard block |
||
| 247 | 247 | switch ($tag) { |
| 248 | 248 | case 'int': |
| 249 | 249 | case 'i4': |
| 250 | - $value = (int)trim($this->_currentTagContents); |
|
| 250 | + $value = (int) trim($this->_currentTagContents); |
|
| 251 | 251 | $this->_currentTagContents = ''; |
| 252 | 252 | $valueFlag = true; |
| 253 | 253 | break; |
| 254 | 254 | case 'double': |
| 255 | - $value = (double)trim($this->_currentTagContents); |
|
| 255 | + $value = (double) trim($this->_currentTagContents); |
|
| 256 | 256 | $this->_currentTagContents = ''; |
| 257 | 257 | $valueFlag = true; |
| 258 | 258 | break; |
| 259 | 259 | case 'string': |
| 260 | - $value = (string)trim($this->_currentTagContents); |
|
| 260 | + $value = (string) trim($this->_currentTagContents); |
|
| 261 | 261 | $this->_currentTagContents = ''; |
| 262 | 262 | $valueFlag = true; |
| 263 | 263 | break; |
@@ -270,13 +270,13 @@ discard block |
||
| 270 | 270 | case 'value': |
| 271 | 271 | // "If no type is indicated, the type is string." |
| 272 | 272 | if (trim($this->_currentTagContents) != '') { |
| 273 | - $value = (string)$this->_currentTagContents; |
|
| 273 | + $value = (string) $this->_currentTagContents; |
|
| 274 | 274 | $this->_currentTagContents = ''; |
| 275 | 275 | $valueFlag = true; |
| 276 | 276 | } |
| 277 | 277 | break; |
| 278 | 278 | case 'boolean': |
| 279 | - $value = (boolean)trim($this->_currentTagContents); |
|
| 279 | + $value = (boolean) trim($this->_currentTagContents); |
|
| 280 | 280 | $this->_currentTagContents = ''; |
| 281 | 281 | $valueFlag = true; |
| 282 | 282 | break; |
@@ -310,17 +310,17 @@ discard block |
||
| 310 | 310 | $value = trim($value); |
| 311 | 311 | } |
| 312 | 312 | */ |
| 313 | - if (count($this->_arraystructs) > 0) { |
|
| 313 | + if (count($this->_arraystructs)>0) { |
|
| 314 | 314 | // Add value to struct or array |
| 315 | - if ($this->_arraystructstypes[count($this->_arraystructstypes) - 1] === 'struct') { |
|
| 315 | + if ($this->_arraystructstypes[count($this->_arraystructstypes)-1] === 'struct') { |
|
| 316 | 316 | // Add to struct |
| 317 | 317 | $this->_arraystructs[count($this->_arraystructs) |
| 318 | - - 1][$this->_currentStructName[count($this->_currentStructName) - 1]] = $value; |
|
| 319 | - } else { |
|
| 318 | + - 1][$this->_currentStructName[count($this->_currentStructName)-1]] = $value; |
|
| 319 | + }else { |
|
| 320 | 320 | // Add to array |
| 321 | - $this->_arraystructs[count($this->_arraystructs) - 1][] = $value; |
|
| 321 | + $this->_arraystructs[count($this->_arraystructs)-1][] = $value; |
|
| 322 | 322 | } |
| 323 | - } else { |
|
| 323 | + }else { |
|
| 324 | 324 | // Just add as a paramater |
| 325 | 325 | $this->params[] = $value; |
| 326 | 326 | } |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | */ |
| 403 | 403 | public function call($methodname, $args) { |
| 404 | 404 | if (!$this->hasMethod($methodname)) { |
| 405 | - return new IXR_Error(-32601, 'server error. requested method ' . $methodname . ' does not exist.'); |
|
| 405 | + return new IXR_Error(-32601, 'server error. requested method '.$methodname.' does not exist.'); |
|
| 406 | 406 | } |
| 407 | 407 | $method = $this->callbacks[$methodname]; |
| 408 | 408 | // Perform the callback and send the response |
@@ -415,19 +415,19 @@ discard block |
||
| 415 | 415 | // It's a class method - check it exists |
| 416 | 416 | $method = substr($method, 5); |
| 417 | 417 | if (!method_exists($this, $method)) { |
| 418 | - return new IXR_Error(-32601, 'server error. requested class method "' . $method . '" does not exist.'); |
|
| 418 | + return new IXR_Error(-32601, 'server error. requested class method "'.$method.'" does not exist.'); |
|
| 419 | 419 | } |
| 420 | 420 | // Call the method |
| 421 | 421 | $result = $this->$method($args); |
| 422 | - } else { |
|
| 422 | + }else { |
|
| 423 | 423 | // It's a function - does it exist? |
| 424 | 424 | if (is_array($method)) { |
| 425 | 425 | if (!method_exists($method[0], $method[1])) { |
| 426 | 426 | return new IXR_Error(-32601, |
| 427 | - 'server error. requested object method "' . $method[1] . '" does not exist.'); |
|
| 427 | + 'server error. requested object method "'.$method[1].'" does not exist.'); |
|
| 428 | 428 | } |
| 429 | 429 | } elseif (!function_exists($method)) { |
| 430 | - return new IXR_Error(-32601, 'server error. requested function "' . $method . '" does not exist.'); |
|
| 430 | + return new IXR_Error(-32601, 'server error. requested function "'.$method.'" does not exist.'); |
|
| 431 | 431 | } |
| 432 | 432 | // Call the function |
| 433 | 433 | $result = call_user_func($method, $args); |
@@ -452,12 +452,12 @@ discard block |
||
| 452 | 452 | * @param $xml |
| 453 | 453 | */ |
| 454 | 454 | public function output($xml) { |
| 455 | - $xml = '<?xml version="1.0"?>' . "\n" . $xml; |
|
| 455 | + $xml = '<?xml version="1.0"?>'."\n".$xml; |
|
| 456 | 456 | $length = strlen($xml); |
| 457 | 457 | header('Connection: close'); |
| 458 | - header('Content-Length: ' . $length); |
|
| 458 | + header('Content-Length: '.$length); |
|
| 459 | 459 | header('Content-Type: text/xml'); |
| 460 | - header('Date: ' . date('r')); |
|
| 460 | + header('Date: '.date('r')); |
|
| 461 | 461 | echo $xml; |
| 462 | 462 | exit; |
| 463 | 463 | } |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | $params = $call['params']; |
| 525 | 525 | if ($method === 'system.multicall') { |
| 526 | 526 | $result = new IXR_Error(-32600, 'Recursive calls to system.multicall are forbidden'); |
| 527 | - } else { |
|
| 527 | + }else { |
|
| 528 | 528 | $result = $this->call($method, $params); |
| 529 | 529 | } |
| 530 | 530 | if (is_a($result, 'IXR_Error')) { |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | 'faultCode' => $result->code, |
| 533 | 533 | 'faultString' => $result->message |
| 534 | 534 | ); |
| 535 | - } else { |
|
| 535 | + }else { |
|
| 536 | 536 | $return[] = array($result); |
| 537 | 537 | } |
| 538 | 538 | } |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | if (!$this->path) { |
| 626 | 626 | $this->path = '/'; |
| 627 | 627 | } |
| 628 | - } else { |
|
| 628 | + }else { |
|
| 629 | 629 | $this->server = $server; |
| 630 | 630 | $this->path = $path; |
| 631 | 631 | $this->port = $port; |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | $request .= $xml; |
| 653 | 653 | // Now send the request |
| 654 | 654 | if ($this->debug) { |
| 655 | - echo '<pre>' . htmlspecialchars($request) . "\n</pre>\n\n"; |
|
| 655 | + echo '<pre>'.htmlspecialchars($request)."\n</pre>\n\n"; |
|
| 656 | 656 | } |
| 657 | 657 | $fp = @fsockopen($this->server, $this->port, $errno, $errstr, $this->timeout); |
| 658 | 658 | if (!$fp) { |
@@ -679,11 +679,11 @@ discard block |
||
| 679 | 679 | $gettingHeaders = false; |
| 680 | 680 | } |
| 681 | 681 | if (!$gettingHeaders) { |
| 682 | - $contents .= trim($line) . "\n"; |
|
| 682 | + $contents .= trim($line)."\n"; |
|
| 683 | 683 | } |
| 684 | 684 | } |
| 685 | 685 | if ($this->debug) { |
| 686 | - echo '<pre>' . htmlspecialchars($contents) . "\n</pre>\n\n"; |
|
| 686 | + echo '<pre>'.htmlspecialchars($contents)."\n</pre>\n\n"; |
|
| 687 | 687 | } |
| 688 | 688 | // Now parse what we've got back |
| 689 | 689 | $this->message = new IXR_Message($contents); |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | // $time can be a PHP timestamp or an ISO one |
| 802 | 802 | if (is_numeric($time)) { |
| 803 | 803 | $this->parseTimestamp($time); |
| 804 | - } else { |
|
| 804 | + }else { |
|
| 805 | 805 | $this->parseIso($time); |
| 806 | 806 | } |
| 807 | 807 | } |
@@ -835,7 +835,7 @@ discard block |
||
| 835 | 835 | * @return string |
| 836 | 836 | */ |
| 837 | 837 | public function getIso() { |
| 838 | - return $this->year . $this->month . $this->day . 'T' . $this->hour . ':' . $this->minute . ':' . $this->second |
|
| 838 | + return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second |
|
| 839 | 839 | . $this->timezone; |
| 840 | 840 | } |
| 841 | 841 | |
@@ -843,7 +843,7 @@ discard block |
||
| 843 | 843 | * @return string |
| 844 | 844 | */ |
| 845 | 845 | public function getXml() { |
| 846 | - return '<dateTime.iso8601>' . $this->getIso() . '</dateTime.iso8601>'; |
|
| 846 | + return '<dateTime.iso8601>'.$this->getIso().'</dateTime.iso8601>'; |
|
| 847 | 847 | } |
| 848 | 848 | |
| 849 | 849 | /** |
@@ -873,7 +873,7 @@ discard block |
||
| 873 | 873 | * @return string |
| 874 | 874 | */ |
| 875 | 875 | public function getXml() { |
| 876 | - return '<base64>' . base64_encode($this->data) . '</base64>'; |
|
| 876 | + return '<base64>'.base64_encode($this->data).'</base64>'; |
|
| 877 | 877 | } |
| 878 | 878 | } |
| 879 | 879 | |
@@ -930,7 +930,7 @@ discard block |
||
| 930 | 930 | // Over-rides default call method, adds signature check |
| 931 | 931 | if (!$this->hasMethod($methodname)) { |
| 932 | 932 | return new IXR_Error(-32601, |
| 933 | - 'server error. requested method "' . $this->message->methodName . '" not specified.'); |
|
| 933 | + 'server error. requested method "'.$this->message->methodName.'" not specified.'); |
|
| 934 | 934 | } |
| 935 | 935 | $method = $this->callbacks[$methodname]; |
| 936 | 936 | $signature = $this->signatures[$methodname]; |
@@ -943,7 +943,7 @@ discard block |
||
| 943 | 943 | // Check the argument types |
| 944 | 944 | $ok = true; |
| 945 | 945 | $argsbackup = $args; |
| 946 | - for ($i = 0, $j = count($args); $i < $j; ++$i) { |
|
| 946 | + for ($i = 0, $j = count($args); $i<$j; ++$i) { |
|
| 947 | 947 | $arg = array_shift($args); |
| 948 | 948 | $type = array_shift($signature); |
| 949 | 949 | switch ($type) { |
@@ -992,7 +992,7 @@ discard block |
||
| 992 | 992 | */ |
| 993 | 993 | public function methodSignature($method) { |
| 994 | 994 | if (!$this->hasMethod($method)) { |
| 995 | - return new IXR_Error(-32601, 'server error. requested method "' . $method . '" not specified.'); |
|
| 995 | + return new IXR_Error(-32601, 'server error. requested method "'.$method.'" not specified.'); |
|
| 996 | 996 | } |
| 997 | 997 | // We should be returning an array of types |
| 998 | 998 | $types = $this->signatures[$method]; |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | public $_feed; |
| 353 | 353 | |
| 354 | 354 | /** |
| 355 | - * @param $format |
|
| 355 | + * @param string $format |
|
| 356 | 356 | */ |
| 357 | 357 | public function _setFormat($format) { |
| 358 | 358 | switch (strtoupper($format)) { |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | /** |
| 530 | 530 | * Adds an FeedItem to the feed. |
| 531 | 531 | * |
| 532 | - * @param $item |
|
| 532 | + * @param FeedItem $item |
|
| 533 | 533 | * @internal param FeedItem $object $item The FeedItem to add to the feed. |
| 534 | 534 | * @access public |
| 535 | 535 | */ |
@@ -547,6 +547,7 @@ discard block |
||
| 547 | 547 | * @static |
| 548 | 548 | * @param string string A string to be truncated. |
| 549 | 549 | * @param int length the maximum length the string should be truncated to |
| 550 | + * @param integer $length |
|
| 550 | 551 | * @return string the truncated string |
| 551 | 552 | */ |
| 552 | 553 | public function iTrunc($string, $length) { |
@@ -652,7 +653,7 @@ discard block |
||
| 652 | 653 | /** |
| 653 | 654 | * @since 1.4 |
| 654 | 655 | * @access private |
| 655 | - * @param $filename |
|
| 656 | + * @param string $filename |
|
| 656 | 657 | */ |
| 657 | 658 | public function _redirect($filename) { |
| 658 | 659 | // attention, heavily-commented-out-area |
@@ -807,7 +808,7 @@ discard block |
||
| 807 | 808 | /** |
| 808 | 809 | * Gets the date stored in this FeedDate as an RFC 822 date. |
| 809 | 810 | * |
| 810 | - * @return a date in RFC 822 format |
|
| 811 | + * @return string date in RFC 822 format |
|
| 811 | 812 | */ |
| 812 | 813 | public function rfc822() { |
| 813 | 814 | //return gmdate("r",$this->unix); |
@@ -822,7 +823,7 @@ discard block |
||
| 822 | 823 | /** |
| 823 | 824 | * Gets the date stored in this FeedDate as an ISO 8601 date. |
| 824 | 825 | * |
| 825 | - * @return a date in ISO 8601 format |
|
| 826 | + * @return string date in ISO 8601 format |
|
| 826 | 827 | */ |
| 827 | 828 | public function iso8601() { |
| 828 | 829 | $date = gmdate("Y-m-d\TH:i:sO", $this->unix); |
@@ -949,7 +950,7 @@ discard block |
||
| 949 | 950 | /** |
| 950 | 951 | * Sets this RSS feed's version number. |
| 951 | 952 | * @access private |
| 952 | - * @param $version |
|
| 953 | + * @param string $version |
|
| 953 | 954 | */ |
| 954 | 955 | public function _setRSSVersion($version) { |
| 955 | 956 | $this->RSSVersion = $version; |
@@ -325,11 +325,11 @@ discard block |
||
| 325 | 325 | if (!$this->rawFieldContent) { |
| 326 | 326 | $result = ''; |
| 327 | 327 | } elseif ($this->syndicateHtml) { |
| 328 | - $result = '<![CDATA[' . $this->rawFieldContent . ']]>'; |
|
| 329 | - } else { |
|
| 328 | + $result = '<![CDATA['.$this->rawFieldContent.']]>'; |
|
| 329 | + }else { |
|
| 330 | 330 | if ($this->truncSize && is_int($this->truncSize)) { |
| 331 | 331 | $result = FeedCreator::iTrunc(htmlspecialchars($this->rawFieldContent), $this->truncSize); |
| 332 | - } else { |
|
| 332 | + }else { |
|
| 333 | 333 | $result = htmlspecialchars($this->rawFieldContent); |
| 334 | 334 | } |
| 335 | 335 | } |
@@ -550,29 +550,29 @@ discard block |
||
| 550 | 550 | * @return string the truncated string |
| 551 | 551 | */ |
| 552 | 552 | public function iTrunc($string, $length) { |
| 553 | - if (strlen($string) <= $length) { |
|
| 553 | + if (strlen($string)<=$length) { |
|
| 554 | 554 | return $string; |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | $pos = strrpos($string, '.'); |
| 558 | - if ($pos >= $length - 4) { |
|
| 559 | - $string = substr($string, 0, $length - 4); |
|
| 558 | + if ($pos>=$length-4) { |
|
| 559 | + $string = substr($string, 0, $length-4); |
|
| 560 | 560 | $pos = strrpos($string, '.'); |
| 561 | 561 | } |
| 562 | - if ($pos >= $length * 0.4) { |
|
| 563 | - return substr($string, 0, $pos + 1) . ' ...'; |
|
| 562 | + if ($pos>=$length*0.4) { |
|
| 563 | + return substr($string, 0, $pos+1).' ...'; |
|
| 564 | 564 | } |
| 565 | 565 | |
| 566 | 566 | $pos = strrpos($string, ' '); |
| 567 | - if ($pos >= $length - 4) { |
|
| 568 | - $string = substr($string, 0, $length - 4); |
|
| 567 | + if ($pos>=$length-4) { |
|
| 568 | + $string = substr($string, 0, $length-4); |
|
| 569 | 569 | $pos = strrpos($string, ' '); |
| 570 | 570 | } |
| 571 | - if ($pos >= $length * 0.4) { |
|
| 572 | - return substr($string, 0, $pos) . ' ...'; |
|
| 571 | + if ($pos>=$length*0.4) { |
|
| 572 | + return substr($string, 0, $pos).' ...'; |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | - return substr($string, 0, $length - 4) . ' ...'; |
|
| 575 | + return substr($string, 0, $length-4).' ...'; |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | /** |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | * Syndic8.com. |
| 582 | 582 | */ |
| 583 | 583 | public function _createGeneratorComment() { |
| 584 | - return "<!-- generator=\"" . FEEDCREATOR_VERSION . "\" -->\n"; |
|
| 584 | + return "<!-- generator=\"".FEEDCREATOR_VERSION."\" -->\n"; |
|
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | /** |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | $ae = ''; |
| 598 | 598 | if (is_array($elements)) { |
| 599 | 599 | foreach ($elements as $key => $value) { |
| 600 | - $ae .= $indentString . "<$key>$value</$key>\n"; |
|
| 600 | + $ae .= $indentString."<$key>$value</$key>\n"; |
|
| 601 | 601 | } |
| 602 | 602 | } |
| 603 | 603 | |
@@ -610,10 +610,10 @@ discard block |
||
| 610 | 610 | public function _createStylesheetReferences() { |
| 611 | 611 | $xml = ''; |
| 612 | 612 | if ($this->cssStyleSheet) { |
| 613 | - $xml .= "<?xml-stylesheet href=\"" . $this->cssStyleSheet . "\" type=\"text/css\"?>\n"; |
|
| 613 | + $xml .= "<?xml-stylesheet href=\"".$this->cssStyleSheet."\" type=\"text/css\"?>\n"; |
|
| 614 | 614 | } |
| 615 | 615 | if ($this->xslStyleSheet) { |
| 616 | - $xml .= "<?xml-stylesheet href=\"" . $this->xslStyleSheet . "\" type=\"text/xsl\"?>\n"; |
|
| 616 | + $xml .= "<?xml-stylesheet href=\"".$this->xslStyleSheet."\" type=\"text/xsl\"?>\n"; |
|
| 617 | 617 | } |
| 618 | 618 | |
| 619 | 619 | return $xml; |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | public function _generateFilename() { |
| 647 | 647 | $fileInfo = pathinfo($_SERVER['PHP_SELF']); |
| 648 | 648 | |
| 649 | - return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension']) + 1)) . '.xml'; |
|
| 649 | + return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension'])+1)).'.xml'; |
|
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | /** |
@@ -668,9 +668,9 @@ discard block |
||
| 668 | 668 | // HTTP redirect, some feed readers' simple HTTP implementations don't follow it |
| 669 | 669 | //Header("Location: ".$filename); |
| 670 | 670 | |
| 671 | - header('Content-Type: ' . $this->contentType . '; charset=' . $this->encoding . '; filename=' |
|
| 671 | + header('Content-Type: '.$this->contentType.'; charset='.$this->encoding.'; filename=' |
|
| 672 | 672 | . basename($filename)); |
| 673 | - header('Content-Disposition: inline; filename=' . basename($filename)); |
|
| 673 | + header('Content-Disposition: inline; filename='.basename($filename)); |
|
| 674 | 674 | readfile($filename, 'r'); |
| 675 | 675 | die(); |
| 676 | 676 | } |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | if ($filename == '') { |
| 692 | 692 | $filename = $this->_generateFilename(); |
| 693 | 693 | } |
| 694 | - if (file_exists($filename) && (time() - filemtime($filename) < $timeout)) { |
|
| 694 | + if (file_exists($filename) && (time()-filemtime($filename)<$timeout)) { |
|
| 695 | 695 | $this->_redirect($filename); |
| 696 | 696 | } |
| 697 | 697 | } |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | if ($displayContents) { |
| 717 | 717 | $this->_redirect($filename); |
| 718 | 718 | } |
| 719 | - } else { |
|
| 719 | + }else { |
|
| 720 | 720 | echo '<br><b>Error creating feed file, please check write permissions.</b><br>'; |
| 721 | 721 | } |
| 722 | 722 | } |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | } |
| 750 | 750 | 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+(.*)~", |
| 751 | 751 | $dateString, $matches)) { |
| 752 | - $months = array( |
|
| 752 | + $months = array( |
|
| 753 | 753 | 'Jan' => 1, |
| 754 | 754 | 'Feb' => 2, |
| 755 | 755 | 'Mar' => 3, |
@@ -765,15 +765,15 @@ discard block |
||
| 765 | 765 | ); |
| 766 | 766 | $this->unix = mktime($matches[4], $matches[5], $matches[6], $months[$matches[2]], $matches[1], $matches[3]); |
| 767 | 767 | if (substr($matches[7], 0, 1) == '+' || substr($matches[7], 0, 1) == '-') { |
| 768 | - $tzOffset = (substr($matches[7], 0, 3) * 60 + substr($matches[7], -2)) * 60; |
|
| 769 | - } else { |
|
| 768 | + $tzOffset = (substr($matches[7], 0, 3)*60+substr($matches[7], -2))*60; |
|
| 769 | + }else { |
|
| 770 | 770 | if (strlen($matches[7]) == 1) { |
| 771 | 771 | $oneHour = 3600; |
| 772 | 772 | $ord = ord($matches[7]); |
| 773 | - if ($ord < ord('M')) { |
|
| 774 | - $tzOffset = (ord('A') - $ord - 1) * $oneHour; |
|
| 775 | - } elseif ($ord >= ord('M') && $matches[7] !== 'Z') { |
|
| 776 | - $tzOffset = ($ord - ord('M')) * $oneHour; |
|
| 773 | + if ($ord<ord('M')) { |
|
| 774 | + $tzOffset = (ord('A')-$ord-1)*$oneHour; |
|
| 775 | + } elseif ($ord>=ord('M') && $matches[7] !== 'Z') { |
|
| 776 | + $tzOffset = ($ord-ord('M'))*$oneHour; |
|
| 777 | 777 | } elseif ($matches[7] === 'Z') { |
| 778 | 778 | $tzOffset = 0; |
| 779 | 779 | } |
@@ -791,8 +791,8 @@ discard block |
||
| 791 | 791 | if (preg_match("~(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(.*)~", $dateString, $matches)) { |
| 792 | 792 | $this->unix = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); |
| 793 | 793 | if (substr($matches[7], 0, 1) == '+' || substr($matches[7], 0, 1) == '-') { |
| 794 | - $tzOffset = (substr($matches[7], 0, 3) * 60 + substr($matches[7], -2)) * 60; |
|
| 795 | - } else { |
|
| 794 | + $tzOffset = (substr($matches[7], 0, 3)*60+substr($matches[7], -2))*60; |
|
| 795 | + }else { |
|
| 796 | 796 | if ($matches[7] === 'Z') { |
| 797 | 797 | $tzOffset = 0; |
| 798 | 798 | } |
@@ -813,7 +813,7 @@ discard block |
||
| 813 | 813 | //return gmdate("r",$this->unix); |
| 814 | 814 | $date = gmdate('D, d M Y H:i:s', $this->unix); |
| 815 | 815 | if (TIME_ZONE != '') { |
| 816 | - $date .= ' ' . str_replace(':', '', TIME_ZONE); |
|
| 816 | + $date .= ' '.str_replace(':', '', TIME_ZONE); |
|
| 817 | 817 | } |
| 818 | 818 | |
| 819 | 819 | return $date; |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | */ |
| 827 | 827 | public function iso8601() { |
| 828 | 828 | $date = gmdate("Y-m-d\TH:i:sO", $this->unix); |
| 829 | - $date = substr($date, 0, 22) . ':' . substr($date, -2); |
|
| 829 | + $date = substr($date, 0, 22).':'.substr($date, -2); |
|
| 830 | 830 | if (TIME_ZONE != '') { |
| 831 | 831 | $date = str_replace('+00:00', TIME_ZONE, $date); |
| 832 | 832 | } |
@@ -859,7 +859,7 @@ discard block |
||
| 859 | 859 | * @return string the feed's complete text |
| 860 | 860 | */ |
| 861 | 861 | public function createFeed() { |
| 862 | - $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n"; |
|
| 862 | + $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n"; |
|
| 863 | 863 | $feed .= $this->_createGeneratorComment(); |
| 864 | 864 | if ($this->cssStyleSheet == '') { |
| 865 | 865 | $cssStyleSheet = 'http://www.w3.org/2000/08/w3c-synd/style.css'; |
@@ -870,50 +870,50 @@ discard block |
||
| 870 | 870 | $feed .= " xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n"; |
| 871 | 871 | $feed .= " xmlns:slash=\"http://purl.org/rss/1.0/modules/slash/\"\n"; |
| 872 | 872 | $feed .= " xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n"; |
| 873 | - $feed .= " <channel rdf:about=\"" . $this->syndicationURL . "\">\n"; |
|
| 874 | - $feed .= ' <title>' . htmlspecialchars($this->title) . "</title>\n"; |
|
| 875 | - $feed .= ' <description>' . htmlspecialchars($this->description) . "</description>\n"; |
|
| 876 | - $feed .= ' <link>' . $this->link . "</link>\n"; |
|
| 873 | + $feed .= " <channel rdf:about=\"".$this->syndicationURL."\">\n"; |
|
| 874 | + $feed .= ' <title>'.htmlspecialchars($this->title)."</title>\n"; |
|
| 875 | + $feed .= ' <description>'.htmlspecialchars($this->description)."</description>\n"; |
|
| 876 | + $feed .= ' <link>'.$this->link."</link>\n"; |
|
| 877 | 877 | if ($this->image != null) { |
| 878 | - $feed .= " <image rdf:resource=\"" . $this->image->url . "\" />\n"; |
|
| 878 | + $feed .= " <image rdf:resource=\"".$this->image->url."\" />\n"; |
|
| 879 | 879 | } |
| 880 | 880 | $now = new FeedDate(); |
| 881 | - $feed .= ' <dc:date>' . htmlspecialchars($now->iso8601()) . "</dc:date>\n"; |
|
| 881 | + $feed .= ' <dc:date>'.htmlspecialchars($now->iso8601())."</dc:date>\n"; |
|
| 882 | 882 | $feed .= " <items>\n"; |
| 883 | 883 | $feed .= " <rdf:Seq>\n"; |
| 884 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
| 885 | - $feed .= " <rdf:li rdf:resource=\"" . htmlspecialchars($this->items[$i]->link) . "\"/>\n"; |
|
| 884 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
| 885 | + $feed .= " <rdf:li rdf:resource=\"".htmlspecialchars($this->items[$i]->link)."\"/>\n"; |
|
| 886 | 886 | } |
| 887 | 887 | $feed .= " </rdf:Seq>\n"; |
| 888 | 888 | $feed .= " </items>\n"; |
| 889 | 889 | $feed .= " </channel>\n"; |
| 890 | 890 | if ($this->image != null) { |
| 891 | - $feed .= " <image rdf:about=\"" . $this->image->url . "\">\n"; |
|
| 892 | - $feed .= ' <title>' . $this->image->title . "</title>\n"; |
|
| 893 | - $feed .= ' <link>' . $this->image->link . "</link>\n"; |
|
| 894 | - $feed .= ' <url>' . $this->image->url . "</url>\n"; |
|
| 891 | + $feed .= " <image rdf:about=\"".$this->image->url."\">\n"; |
|
| 892 | + $feed .= ' <title>'.$this->image->title."</title>\n"; |
|
| 893 | + $feed .= ' <link>'.$this->image->link."</link>\n"; |
|
| 894 | + $feed .= ' <url>'.$this->image->url."</url>\n"; |
|
| 895 | 895 | $feed .= " </image>\n"; |
| 896 | 896 | } |
| 897 | 897 | $feed .= $this->_createAdditionalElements($this->additionalElements, ' '); |
| 898 | 898 | |
| 899 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
| 900 | - $feed .= " <item rdf:about=\"" . htmlspecialchars($this->items[$i]->link) . "\">\n"; |
|
| 899 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
| 900 | + $feed .= " <item rdf:about=\"".htmlspecialchars($this->items[$i]->link)."\">\n"; |
|
| 901 | 901 | //$feed.= " <dc:type>Posting</dc:type>\n"; |
| 902 | 902 | $feed .= " <dc:format>text/html</dc:format>\n"; |
| 903 | 903 | if ($this->items[$i]->date != null) { |
| 904 | 904 | $itemDate = new FeedDate($this->items[$i]->date); |
| 905 | - $feed .= ' <dc:date>' . htmlspecialchars($itemDate->iso8601()) . "</dc:date>\n"; |
|
| 905 | + $feed .= ' <dc:date>'.htmlspecialchars($itemDate->iso8601())."</dc:date>\n"; |
|
| 906 | 906 | } |
| 907 | 907 | if ($this->items[$i]->source != '') { |
| 908 | - $feed .= ' <dc:source>' . htmlspecialchars($this->items[$i]->source) . "</dc:source>\n"; |
|
| 908 | + $feed .= ' <dc:source>'.htmlspecialchars($this->items[$i]->source)."</dc:source>\n"; |
|
| 909 | 909 | } |
| 910 | 910 | if ($this->items[$i]->author != '') { |
| 911 | - $feed .= ' <dc:creator>' . htmlspecialchars($this->items[$i]->author) . "</dc:creator>\n"; |
|
| 911 | + $feed .= ' <dc:creator>'.htmlspecialchars($this->items[$i]->author)."</dc:creator>\n"; |
|
| 912 | 912 | } |
| 913 | - $feed .= ' <title>' . htmlspecialchars(strip_tags(strtr($this->items[$i]->title, "\n\r", ' '))) |
|
| 913 | + $feed .= ' <title>'.htmlspecialchars(strip_tags(strtr($this->items[$i]->title, "\n\r", ' '))) |
|
| 914 | 914 | . "</title>\n"; |
| 915 | - $feed .= ' <link>' . htmlspecialchars($this->items[$i]->link) . "</link>\n"; |
|
| 916 | - $feed .= ' <description>' . htmlspecialchars($this->items[$i]->description) . "</description>\n"; |
|
| 915 | + $feed .= ' <link>'.htmlspecialchars($this->items[$i]->link)."</link>\n"; |
|
| 916 | + $feed .= ' <description>'.htmlspecialchars($this->items[$i]->description)."</description>\n"; |
|
| 917 | 917 | $feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, ' '); |
| 918 | 918 | $feed .= " </item>\n"; |
| 919 | 919 | } |
@@ -961,84 +961,84 @@ discard block |
||
| 961 | 961 | * @return string the feed's complete text |
| 962 | 962 | */ |
| 963 | 963 | public function createFeed() { |
| 964 | - $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n"; |
|
| 964 | + $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n"; |
|
| 965 | 965 | $feed .= $this->_createGeneratorComment(); |
| 966 | 966 | $feed .= $this->_createStylesheetReferences(); |
| 967 | - $feed .= "<rss version=\"" . $this->RSSVersion . "\">\n"; |
|
| 967 | + $feed .= "<rss version=\"".$this->RSSVersion."\">\n"; |
|
| 968 | 968 | $feed .= " <channel>\n"; |
| 969 | - $feed .= ' <title>' . FeedCreator::iTrunc(htmlspecialchars($this->title), 100) . "</title>\n"; |
|
| 969 | + $feed .= ' <title>'.FeedCreator::iTrunc(htmlspecialchars($this->title), 100)."</title>\n"; |
|
| 970 | 970 | $this->descriptionTruncSize = 500; |
| 971 | - $feed .= ' <description>' . $this->getDescription() . "</description>\n"; |
|
| 972 | - $feed .= ' <link>' . $this->link . "</link>\n"; |
|
| 971 | + $feed .= ' <description>'.$this->getDescription()."</description>\n"; |
|
| 972 | + $feed .= ' <link>'.$this->link."</link>\n"; |
|
| 973 | 973 | $now = new FeedDate(); |
| 974 | - $feed .= ' <lastBuildDate>' . htmlspecialchars($now->rfc822()) . "</lastBuildDate>\n"; |
|
| 975 | - $feed .= ' <generator>' . FEEDCREATOR_VERSION . "</generator>\n"; |
|
| 974 | + $feed .= ' <lastBuildDate>'.htmlspecialchars($now->rfc822())."</lastBuildDate>\n"; |
|
| 975 | + $feed .= ' <generator>'.FEEDCREATOR_VERSION."</generator>\n"; |
|
| 976 | 976 | |
| 977 | 977 | if ($this->image != null) { |
| 978 | 978 | $feed .= " <image>\n"; |
| 979 | - $feed .= ' <url>' . $this->image->url . "</url>\n"; |
|
| 980 | - $feed .= ' <title>' . FeedCreator::iTrunc(htmlspecialchars($this->image->title), 100) |
|
| 979 | + $feed .= ' <url>'.$this->image->url."</url>\n"; |
|
| 980 | + $feed .= ' <title>'.FeedCreator::iTrunc(htmlspecialchars($this->image->title), 100) |
|
| 981 | 981 | . "</title>\n"; |
| 982 | - $feed .= ' <link>' . $this->image->link . "</link>\n"; |
|
| 982 | + $feed .= ' <link>'.$this->image->link."</link>\n"; |
|
| 983 | 983 | if ($this->image->width != '') { |
| 984 | - $feed .= ' <width>' . $this->image->width . "</width>\n"; |
|
| 984 | + $feed .= ' <width>'.$this->image->width."</width>\n"; |
|
| 985 | 985 | } |
| 986 | 986 | if ($this->image->height != '') { |
| 987 | - $feed .= ' <height>' . $this->image->height . "</height>\n"; |
|
| 987 | + $feed .= ' <height>'.$this->image->height."</height>\n"; |
|
| 988 | 988 | } |
| 989 | 989 | if ($this->image->description != '') { |
| 990 | - $feed .= ' <description>' . $this->image->getDescription() . "</description>\n"; |
|
| 990 | + $feed .= ' <description>'.$this->image->getDescription()."</description>\n"; |
|
| 991 | 991 | } |
| 992 | 992 | $feed .= " </image>\n"; |
| 993 | 993 | } |
| 994 | 994 | if ($this->language != '') { |
| 995 | - $feed .= ' <language>' . $this->language . "</language>\n"; |
|
| 995 | + $feed .= ' <language>'.$this->language."</language>\n"; |
|
| 996 | 996 | } |
| 997 | 997 | if ($this->copyright != '') { |
| 998 | - $feed .= ' <copyright>' . FeedCreator::iTrunc(htmlspecialchars($this->copyright), 100) |
|
| 998 | + $feed .= ' <copyright>'.FeedCreator::iTrunc(htmlspecialchars($this->copyright), 100) |
|
| 999 | 999 | . "</copyright>\n"; |
| 1000 | 1000 | } |
| 1001 | 1001 | if ($this->editor != '') { |
| 1002 | - $feed .= ' <managingEditor>' . FeedCreator::iTrunc(htmlspecialchars($this->editor), 100) |
|
| 1002 | + $feed .= ' <managingEditor>'.FeedCreator::iTrunc(htmlspecialchars($this->editor), 100) |
|
| 1003 | 1003 | . "</managingEditor>\n"; |
| 1004 | 1004 | } |
| 1005 | 1005 | if ($this->webmaster != '') { |
| 1006 | - $feed .= ' <webMaster>' . FeedCreator::iTrunc(htmlspecialchars($this->webmaster), 100) |
|
| 1006 | + $feed .= ' <webMaster>'.FeedCreator::iTrunc(htmlspecialchars($this->webmaster), 100) |
|
| 1007 | 1007 | . "</webMaster>\n"; |
| 1008 | 1008 | } |
| 1009 | 1009 | if ($this->pubDate != '') { |
| 1010 | 1010 | $pubDate = new FeedDate($this->pubDate); |
| 1011 | - $feed .= ' <pubDate>' . htmlspecialchars($pubDate->rfc822()) . "</pubDate>\n"; |
|
| 1011 | + $feed .= ' <pubDate>'.htmlspecialchars($pubDate->rfc822())."</pubDate>\n"; |
|
| 1012 | 1012 | } |
| 1013 | 1013 | if ($this->category != '') { |
| 1014 | - $feed .= ' <category>' . htmlspecialchars($this->category) . "</category>\n"; |
|
| 1014 | + $feed .= ' <category>'.htmlspecialchars($this->category)."</category>\n"; |
|
| 1015 | 1015 | } |
| 1016 | 1016 | if ($this->docs != '') { |
| 1017 | - $feed .= ' <docs>' . FeedCreator::iTrunc(htmlspecialchars($this->docs), 500) . "</docs>\n"; |
|
| 1017 | + $feed .= ' <docs>'.FeedCreator::iTrunc(htmlspecialchars($this->docs), 500)."</docs>\n"; |
|
| 1018 | 1018 | } |
| 1019 | 1019 | if ($this->ttl != '') { |
| 1020 | - $feed .= ' <ttl>' . htmlspecialchars($this->ttl) . "</ttl>\n"; |
|
| 1020 | + $feed .= ' <ttl>'.htmlspecialchars($this->ttl)."</ttl>\n"; |
|
| 1021 | 1021 | } |
| 1022 | 1022 | if ($this->rating != '') { |
| 1023 | - $feed .= ' <rating>' . FeedCreator::iTrunc(htmlspecialchars($this->rating), 500) . "</rating>\n"; |
|
| 1023 | + $feed .= ' <rating>'.FeedCreator::iTrunc(htmlspecialchars($this->rating), 500)."</rating>\n"; |
|
| 1024 | 1024 | } |
| 1025 | 1025 | if ($this->skipHours != '') { |
| 1026 | - $feed .= ' <skipHours>' . htmlspecialchars($this->skipHours) . "</skipHours>\n"; |
|
| 1026 | + $feed .= ' <skipHours>'.htmlspecialchars($this->skipHours)."</skipHours>\n"; |
|
| 1027 | 1027 | } |
| 1028 | 1028 | if ($this->skipDays != '') { |
| 1029 | - $feed .= ' <skipDays>' . htmlspecialchars($this->skipDays) . "</skipDays>\n"; |
|
| 1029 | + $feed .= ' <skipDays>'.htmlspecialchars($this->skipDays)."</skipDays>\n"; |
|
| 1030 | 1030 | } |
| 1031 | 1031 | $feed .= $this->_createAdditionalElements($this->additionalElements, ' '); |
| 1032 | 1032 | |
| 1033 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
| 1033 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
| 1034 | 1034 | $feed .= " <item>\n"; |
| 1035 | - $feed .= ' <title>' . FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), |
|
| 1036 | - 100) . "</title>\n"; |
|
| 1037 | - $feed .= ' <link>' . htmlspecialchars($this->items[$i]->link) . "</link>\n"; |
|
| 1038 | - $feed .= ' <description>' . $this->items[$i]->getDescription() . "</description>\n"; |
|
| 1035 | + $feed .= ' <title>'.FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), |
|
| 1036 | + 100)."</title>\n"; |
|
| 1037 | + $feed .= ' <link>'.htmlspecialchars($this->items[$i]->link)."</link>\n"; |
|
| 1038 | + $feed .= ' <description>'.$this->items[$i]->getDescription()."</description>\n"; |
|
| 1039 | 1039 | |
| 1040 | 1040 | if ($this->items[$i]->author != '') { |
| 1041 | - $feed .= ' <author>' . htmlspecialchars($this->items[$i]->author) . "</author>\n"; |
|
| 1041 | + $feed .= ' <author>'.htmlspecialchars($this->items[$i]->author)."</author>\n"; |
|
| 1042 | 1042 | } |
| 1043 | 1043 | /* |
| 1044 | 1044 | // on hold |
@@ -1047,17 +1047,17 @@ discard block |
||
| 1047 | 1047 | } |
| 1048 | 1048 | */ |
| 1049 | 1049 | if ($this->items[$i]->category != '') { |
| 1050 | - $feed .= ' <category>' . htmlspecialchars($this->items[$i]->category) . "</category>\n"; |
|
| 1050 | + $feed .= ' <category>'.htmlspecialchars($this->items[$i]->category)."</category>\n"; |
|
| 1051 | 1051 | } |
| 1052 | 1052 | if ($this->items[$i]->comments != '') { |
| 1053 | - $feed .= ' <comments>' . htmlspecialchars($this->items[$i]->comments) . "</comments>\n"; |
|
| 1053 | + $feed .= ' <comments>'.htmlspecialchars($this->items[$i]->comments)."</comments>\n"; |
|
| 1054 | 1054 | } |
| 1055 | 1055 | if ($this->items[$i]->date != '') { |
| 1056 | 1056 | $itemDate = new FeedDate($this->items[$i]->date); |
| 1057 | - $feed .= ' <pubDate>' . htmlspecialchars($itemDate->rfc822()) . "</pubDate>\n"; |
|
| 1057 | + $feed .= ' <pubDate>'.htmlspecialchars($itemDate->rfc822())."</pubDate>\n"; |
|
| 1058 | 1058 | } |
| 1059 | 1059 | if ($this->items[$i]->guid != '') { |
| 1060 | - $feed .= ' <guid>' . htmlspecialchars($this->items[$i]->guid) . "</guid>\n"; |
|
| 1060 | + $feed .= ' <guid>'.htmlspecialchars($this->items[$i]->guid)."</guid>\n"; |
|
| 1061 | 1061 | } |
| 1062 | 1062 | $feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, ' '); |
| 1063 | 1063 | $feed .= " </item>\n"; |
@@ -1107,33 +1107,33 @@ discard block |
||
| 1107 | 1107 | * @return string |
| 1108 | 1108 | */ |
| 1109 | 1109 | public function createFeed() { |
| 1110 | - $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n"; |
|
| 1110 | + $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n"; |
|
| 1111 | 1111 | $feed .= $this->_createStylesheetReferences(); |
| 1112 | 1112 | $feed .= "<feed version=\"0.1\" xmlns=\"http://example.com/newformat#\">\n"; |
| 1113 | - $feed .= ' <title>' . FeedCreator::iTrunc(htmlspecialchars($this->title), 100) . "</title>\n"; |
|
| 1113 | + $feed .= ' <title>'.FeedCreator::iTrunc(htmlspecialchars($this->title), 100)."</title>\n"; |
|
| 1114 | 1114 | $this->truncSize = 500; |
| 1115 | - $feed .= ' <subtitle>' . $this->getDescription() . "</subtitle>\n"; |
|
| 1116 | - $feed .= ' <link>' . $this->link . "</link>\n"; |
|
| 1117 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
| 1115 | + $feed .= ' <subtitle>'.$this->getDescription()."</subtitle>\n"; |
|
| 1116 | + $feed .= ' <link>'.$this->link."</link>\n"; |
|
| 1117 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
| 1118 | 1118 | $feed .= " <entry>\n"; |
| 1119 | - $feed .= ' <title>' . FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), 100) |
|
| 1119 | + $feed .= ' <title>'.FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), 100) |
|
| 1120 | 1120 | . "</title>\n"; |
| 1121 | - $feed .= ' <link>' . htmlspecialchars($this->items[$i]->link) . "</link>\n"; |
|
| 1121 | + $feed .= ' <link>'.htmlspecialchars($this->items[$i]->link)."</link>\n"; |
|
| 1122 | 1122 | $itemDate = new FeedDate($this->items[$i]->date); |
| 1123 | - $feed .= ' <created>' . htmlspecialchars($itemDate->iso8601()) . "</created>\n"; |
|
| 1124 | - $feed .= ' <issued>' . htmlspecialchars($itemDate->iso8601()) . "</issued>\n"; |
|
| 1125 | - $feed .= ' <modified>' . htmlspecialchars($itemDate->iso8601()) . "</modified>\n"; |
|
| 1126 | - $feed .= ' <id>' . htmlspecialchars($this->items[$i]->guid) . "</id>\n"; |
|
| 1123 | + $feed .= ' <created>'.htmlspecialchars($itemDate->iso8601())."</created>\n"; |
|
| 1124 | + $feed .= ' <issued>'.htmlspecialchars($itemDate->iso8601())."</issued>\n"; |
|
| 1125 | + $feed .= ' <modified>'.htmlspecialchars($itemDate->iso8601())."</modified>\n"; |
|
| 1126 | + $feed .= ' <id>'.htmlspecialchars($this->items[$i]->guid)."</id>\n"; |
|
| 1127 | 1127 | if ($this->items[$i]->author != '') { |
| 1128 | 1128 | $feed .= " <author>\n"; |
| 1129 | - $feed .= ' <name>' . htmlspecialchars($this->items[$i]->author) . "</name>\n"; |
|
| 1129 | + $feed .= ' <name>'.htmlspecialchars($this->items[$i]->author)."</name>\n"; |
|
| 1130 | 1130 | if ($this->items[$i]->authorEmail != '') { |
| 1131 | - $feed .= ' <email>' . $this->items[$i]->authorEmail . "</email>\n"; |
|
| 1131 | + $feed .= ' <email>'.$this->items[$i]->authorEmail."</email>\n"; |
|
| 1132 | 1132 | } |
| 1133 | 1133 | $feed .= " </author>\n"; |
| 1134 | 1134 | } |
| 1135 | 1135 | $feed .= " <content type=\"text/html\" xml:lang=\"en-us\">\n"; |
| 1136 | - $feed .= " <div xmlns=\"http://www.w3.org/1999/xhtml\">" . $this->items[$i]->getDescription() |
|
| 1136 | + $feed .= " <div xmlns=\"http://www.w3.org/1999/xhtml\">".$this->items[$i]->getDescription() |
|
| 1137 | 1137 | . "</div>\n"; |
| 1138 | 1138 | $feed .= " </content>\n"; |
| 1139 | 1139 | $feed .= " </entry>\n"; |
@@ -1174,51 +1174,51 @@ discard block |
||
| 1174 | 1174 | * @return string |
| 1175 | 1175 | */ |
| 1176 | 1176 | public function createFeed() { |
| 1177 | - $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n"; |
|
| 1177 | + $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n"; |
|
| 1178 | 1178 | $feed .= $this->_createGeneratorComment(); |
| 1179 | 1179 | $feed .= $this->_createStylesheetReferences(); |
| 1180 | 1180 | $feed .= "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\""; |
| 1181 | 1181 | if ($this->language != '') { |
| 1182 | - $feed .= " xml:lang=\"" . $this->language . "\""; |
|
| 1182 | + $feed .= " xml:lang=\"".$this->language."\""; |
|
| 1183 | 1183 | } |
| 1184 | 1184 | $feed .= ">\n"; |
| 1185 | - $feed .= ' <title>' . htmlspecialchars($this->title) . "</title>\n"; |
|
| 1186 | - $feed .= ' <tagline>' . htmlspecialchars($this->description) . "</tagline>\n"; |
|
| 1187 | - $feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"" . htmlspecialchars($this->link) . "\"/>\n"; |
|
| 1188 | - $feed .= ' <id>' . htmlspecialchars($this->link) . "</id>\n"; |
|
| 1185 | + $feed .= ' <title>'.htmlspecialchars($this->title)."</title>\n"; |
|
| 1186 | + $feed .= ' <tagline>'.htmlspecialchars($this->description)."</tagline>\n"; |
|
| 1187 | + $feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"".htmlspecialchars($this->link)."\"/>\n"; |
|
| 1188 | + $feed .= ' <id>'.htmlspecialchars($this->link)."</id>\n"; |
|
| 1189 | 1189 | $now = new FeedDate(); |
| 1190 | - $feed .= ' <modified>' . htmlspecialchars($now->iso8601()) . "</modified>\n"; |
|
| 1190 | + $feed .= ' <modified>'.htmlspecialchars($now->iso8601())."</modified>\n"; |
|
| 1191 | 1191 | if ($this->editor != '') { |
| 1192 | 1192 | $feed .= " <author>\n"; |
| 1193 | - $feed .= ' <name>' . $this->editor . "</name>\n"; |
|
| 1193 | + $feed .= ' <name>'.$this->editor."</name>\n"; |
|
| 1194 | 1194 | if ($this->editorEmail != '') { |
| 1195 | - $feed .= ' <email>' . $this->editorEmail . "</email>\n"; |
|
| 1195 | + $feed .= ' <email>'.$this->editorEmail."</email>\n"; |
|
| 1196 | 1196 | } |
| 1197 | 1197 | $feed .= " </author>\n"; |
| 1198 | 1198 | } |
| 1199 | - $feed .= ' <generator>' . FEEDCREATOR_VERSION . "</generator>\n"; |
|
| 1199 | + $feed .= ' <generator>'.FEEDCREATOR_VERSION."</generator>\n"; |
|
| 1200 | 1200 | $feed .= $this->_createAdditionalElements($this->additionalElements, ' '); |
| 1201 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
| 1201 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
| 1202 | 1202 | $feed .= " <entry>\n"; |
| 1203 | - $feed .= ' <title>' . htmlspecialchars(strip_tags($this->items[$i]->title)) . "</title>\n"; |
|
| 1203 | + $feed .= ' <title>'.htmlspecialchars(strip_tags($this->items[$i]->title))."</title>\n"; |
|
| 1204 | 1204 | $feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"" |
| 1205 | - . htmlspecialchars($this->items[$i]->link) . "\"/>\n"; |
|
| 1205 | + . htmlspecialchars($this->items[$i]->link)."\"/>\n"; |
|
| 1206 | 1206 | if ($this->items[$i]->date == '') { |
| 1207 | 1207 | $this->items[$i]->date = time(); |
| 1208 | 1208 | } |
| 1209 | 1209 | $itemDate = new FeedDate($this->items[$i]->date); |
| 1210 | - $feed .= ' <created>' . htmlspecialchars($itemDate->iso8601()) . "</created>\n"; |
|
| 1211 | - $feed .= ' <issued>' . htmlspecialchars($itemDate->iso8601()) . "</issued>\n"; |
|
| 1212 | - $feed .= ' <modified>' . htmlspecialchars($itemDate->iso8601()) . "</modified>\n"; |
|
| 1213 | - $feed .= ' <id>' . htmlspecialchars($this->items[$i]->link) . "</id>\n"; |
|
| 1210 | + $feed .= ' <created>'.htmlspecialchars($itemDate->iso8601())."</created>\n"; |
|
| 1211 | + $feed .= ' <issued>'.htmlspecialchars($itemDate->iso8601())."</issued>\n"; |
|
| 1212 | + $feed .= ' <modified>'.htmlspecialchars($itemDate->iso8601())."</modified>\n"; |
|
| 1213 | + $feed .= ' <id>'.htmlspecialchars($this->items[$i]->link)."</id>\n"; |
|
| 1214 | 1214 | $feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, ' '); |
| 1215 | 1215 | if ($this->items[$i]->author != '') { |
| 1216 | 1216 | $feed .= " <author>\n"; |
| 1217 | - $feed .= ' <name>' . htmlspecialchars($this->items[$i]->author) . "</name>\n"; |
|
| 1217 | + $feed .= ' <name>'.htmlspecialchars($this->items[$i]->author)."</name>\n"; |
|
| 1218 | 1218 | $feed .= " </author>\n"; |
| 1219 | 1219 | } |
| 1220 | 1220 | if ($this->items[$i]->description != '') { |
| 1221 | - $feed .= ' <summary>' . htmlspecialchars($this->items[$i]->description) . "</summary>\n"; |
|
| 1221 | + $feed .= ' <summary>'.htmlspecialchars($this->items[$i]->description)."</summary>\n"; |
|
| 1222 | 1222 | } |
| 1223 | 1223 | $feed .= " </entry>\n"; |
| 1224 | 1224 | } |
@@ -1260,23 +1260,23 @@ discard block |
||
| 1260 | 1260 | //$line = rtrim($line); // remove trailing white space -> no =20\r\n necessary |
| 1261 | 1261 | $linlen = strlen($line); |
| 1262 | 1262 | $newline = ''; |
| 1263 | - for ($i = 0; $i < $linlen; ++$i) { |
|
| 1263 | + for ($i = 0; $i<$linlen; ++$i) { |
|
| 1264 | 1264 | $c = substr($line, $i, 1); |
| 1265 | 1265 | $dec = ord($c); |
| 1266 | - if (($dec == 32) && ($i == ($linlen - 1))) { // convert space at eol only |
|
| 1266 | + if (($dec == 32) && ($i == ($linlen-1))) { // convert space at eol only |
|
| 1267 | 1267 | $c = '=20'; |
| 1268 | - } elseif (($dec == 61) || ($dec < 32) || ($dec > 126)) { // always encode "\t", which is *not* required |
|
| 1269 | - $h2 = floor($dec / 16); |
|
| 1270 | - $h1 = floor($dec % 16); |
|
| 1271 | - $c = $escape . $hex["$h2"] . $hex["$h1"]; |
|
| 1268 | + } elseif (($dec == 61) || ($dec<32) || ($dec>126)) { // always encode "\t", which is *not* required |
|
| 1269 | + $h2 = floor($dec/16); |
|
| 1270 | + $h1 = floor($dec%16); |
|
| 1271 | + $c = $escape.$hex["$h2"].$hex["$h1"]; |
|
| 1272 | 1272 | } |
| 1273 | - if ((strlen($newline) + strlen($c)) >= $line_max) { // CRLF is not counted |
|
| 1274 | - $output .= $newline . $escape . $eol; // soft line break; " =\r\n" is okay |
|
| 1273 | + if ((strlen($newline)+strlen($c))>=$line_max) { // CRLF is not counted |
|
| 1274 | + $output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay |
|
| 1275 | 1275 | $newline = ''; |
| 1276 | 1276 | } |
| 1277 | 1277 | $newline .= $c; |
| 1278 | 1278 | } // end of for |
| 1279 | - $output .= $newline . $eol; |
|
| 1279 | + $output .= $newline.$eol; |
|
| 1280 | 1280 | } |
| 1281 | 1281 | |
| 1282 | 1282 | return trim($output); |
@@ -1287,22 +1287,22 @@ discard block |
||
| 1287 | 1287 | * @return string the feed's complete text |
| 1288 | 1288 | */ |
| 1289 | 1289 | public function createFeed() { |
| 1290 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
| 1290 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
| 1291 | 1291 | if ($this->items[$i]->author != '') { |
| 1292 | 1292 | $from = $this->items[$i]->author; |
| 1293 | - } else { |
|
| 1293 | + }else { |
|
| 1294 | 1294 | $from = $this->title; |
| 1295 | 1295 | } |
| 1296 | 1296 | $itemDate = new FeedDate($this->items[$i]->date); |
| 1297 | - $feed .= 'From ' . strtr(MBOXCreator::qp_enc($from), ' ', '_') . ' ' . date('D M d H:i:s Y', |
|
| 1298 | - $itemDate->unix()) . "\n"; |
|
| 1297 | + $feed .= 'From '.strtr(MBOXCreator::qp_enc($from), ' ', '_').' '.date('D M d H:i:s Y', |
|
| 1298 | + $itemDate->unix())."\n"; |
|
| 1299 | 1299 | $feed .= "Content-Type: text/plain;\n"; |
| 1300 | - $feed .= " charset=\"" . $this->encoding . "\"\n"; |
|
| 1300 | + $feed .= " charset=\"".$this->encoding."\"\n"; |
|
| 1301 | 1301 | $feed .= "Content-Transfer-Encoding: quoted-printable\n"; |
| 1302 | 1302 | $feed .= "Content-Type: text/plain\n"; |
| 1303 | - $feed .= "From: \"" . MBOXCreator::qp_enc($from) . "\"\n"; |
|
| 1304 | - $feed .= 'Date: ' . $itemDate->rfc822() . "\n"; |
|
| 1305 | - $feed .= 'Subject: ' . MBOXCreator::qp_enc(FeedCreator::iTrunc($this->items[$i]->title, 100)) . "\n"; |
|
| 1303 | + $feed .= "From: \"".MBOXCreator::qp_enc($from)."\"\n"; |
|
| 1304 | + $feed .= 'Date: '.$itemDate->rfc822()."\n"; |
|
| 1305 | + $feed .= 'Subject: '.MBOXCreator::qp_enc(FeedCreator::iTrunc($this->items[$i]->title, 100))."\n"; |
|
| 1306 | 1306 | $feed .= "\n"; |
| 1307 | 1307 | $body = chunk_split(MBOXCreator::qp_enc($this->items[$i]->description)); |
| 1308 | 1308 | $feed .= preg_replace("~\nFrom ([^\n]*)(\n?)~", "\n>From $1$2\n", $body); |
@@ -1322,7 +1322,7 @@ discard block |
||
| 1322 | 1322 | public function _generateFilename() { |
| 1323 | 1323 | $fileInfo = pathinfo($_SERVER['PHP_SELF']); |
| 1324 | 1324 | |
| 1325 | - return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension']) + 1)) . '.mbox'; |
|
| 1325 | + return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension'])+1)).'.mbox'; |
|
| 1326 | 1326 | } |
| 1327 | 1327 | } |
| 1328 | 1328 | |
@@ -1346,35 +1346,35 @@ discard block |
||
| 1346 | 1346 | * @return string |
| 1347 | 1347 | */ |
| 1348 | 1348 | public function createFeed() { |
| 1349 | - $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n"; |
|
| 1349 | + $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n"; |
|
| 1350 | 1350 | $feed .= $this->_createGeneratorComment(); |
| 1351 | 1351 | $feed .= $this->_createStylesheetReferences(); |
| 1352 | 1352 | $feed .= "<opml xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n"; |
| 1353 | 1353 | $feed .= " <head>\n"; |
| 1354 | - $feed .= ' <title>' . htmlspecialchars($this->title) . "</title>\n"; |
|
| 1354 | + $feed .= ' <title>'.htmlspecialchars($this->title)."</title>\n"; |
|
| 1355 | 1355 | if ($this->pubDate != '') { |
| 1356 | 1356 | $date = new FeedDate($this->pubDate); |
| 1357 | - $feed .= ' <dateCreated>' . $date->rfc822() . "</dateCreated>\n"; |
|
| 1357 | + $feed .= ' <dateCreated>'.$date->rfc822()."</dateCreated>\n"; |
|
| 1358 | 1358 | } |
| 1359 | 1359 | if ($this->lastBuildDate != '') { |
| 1360 | 1360 | $date = new FeedDate($this->lastBuildDate); |
| 1361 | - $feed .= ' <dateModified>' . $date->rfc822() . "</dateModified>\n"; |
|
| 1361 | + $feed .= ' <dateModified>'.$date->rfc822()."</dateModified>\n"; |
|
| 1362 | 1362 | } |
| 1363 | 1363 | if ($this->editor != '') { |
| 1364 | - $feed .= ' <ownerName>' . $this->editor . "</ownerName>\n"; |
|
| 1364 | + $feed .= ' <ownerName>'.$this->editor."</ownerName>\n"; |
|
| 1365 | 1365 | } |
| 1366 | 1366 | if ($this->editorEmail != '') { |
| 1367 | - $feed .= ' <ownerEmail>' . $this->editorEmail . "</ownerEmail>\n"; |
|
| 1367 | + $feed .= ' <ownerEmail>'.$this->editorEmail."</ownerEmail>\n"; |
|
| 1368 | 1368 | } |
| 1369 | 1369 | $feed .= " </head>\n"; |
| 1370 | 1370 | $feed .= " <body>\n"; |
| 1371 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
| 1371 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
| 1372 | 1372 | $feed .= " <outline type=\"rss\" "; |
| 1373 | 1373 | $title = htmlspecialchars(strip_tags(strtr($this->items[$i]->title, "\n\r", ' '))); |
| 1374 | - $feed .= " title=\"" . $title . "\""; |
|
| 1375 | - $feed .= " text=\"" . $title . "\""; |
|
| 1374 | + $feed .= " title=\"".$title."\""; |
|
| 1375 | + $feed .= " text=\"".$title."\""; |
|
| 1376 | 1376 | //$feed.= " description=\"".htmlspecialchars($this->items[$i]->description)."\""; |
| 1377 | - $feed .= " url=\"" . htmlspecialchars($this->items[$i]->link) . "\""; |
|
| 1377 | + $feed .= " url=\"".htmlspecialchars($this->items[$i]->link)."\""; |
|
| 1378 | 1378 | $feed .= "/>\n"; |
| 1379 | 1379 | } |
| 1380 | 1380 | $feed .= " </body>\n"; |
@@ -1449,7 +1449,7 @@ discard block |
||
| 1449 | 1449 | |
| 1450 | 1450 | //if no stylePrefix is set, generate it yourself depending on the script name |
| 1451 | 1451 | if ($this->stylePrefix == '') { |
| 1452 | - $this->stylePrefix = str_replace('.', '_', $this->_generateFilename()) . '_'; |
|
| 1452 | + $this->stylePrefix = str_replace('.', '_', $this->_generateFilename()).'_'; |
|
| 1453 | 1453 | } |
| 1454 | 1454 | |
| 1455 | 1455 | //set an openInNewWindow_token_to be inserted or not |
@@ -1460,26 +1460,26 @@ discard block |
||
| 1460 | 1460 | // use this array to put the lines in and implode later with "document.write" javascript |
| 1461 | 1461 | $feedArray = array(); |
| 1462 | 1462 | if ($this->image != null) { |
| 1463 | - $imageStr = "<a href='" . $this->image->link . "'" . $targetInsert . '>' . "<img src='" . $this->image->url |
|
| 1464 | - . "' border='0' alt='" . FeedCreator::iTrunc(htmlspecialchars($this->image->title), 100) |
|
| 1465 | - . "' align='" . $this->imageAlign . "' "; |
|
| 1463 | + $imageStr = "<a href='".$this->image->link."'".$targetInsert.'>'."<img src='".$this->image->url |
|
| 1464 | + . "' border='0' alt='".FeedCreator::iTrunc(htmlspecialchars($this->image->title), 100) |
|
| 1465 | + . "' align='".$this->imageAlign."' "; |
|
| 1466 | 1466 | if ($this->image->width) { |
| 1467 | - $imageStr .= " width='" . $this->image->width . "' "; |
|
| 1467 | + $imageStr .= " width='".$this->image->width."' "; |
|
| 1468 | 1468 | } |
| 1469 | 1469 | if ($this->image->height) { |
| 1470 | - $imageStr .= " height='" . $this->image->height . "' "; |
|
| 1470 | + $imageStr .= " height='".$this->image->height."' "; |
|
| 1471 | 1471 | } |
| 1472 | 1472 | $imageStr .= '/></a>'; |
| 1473 | 1473 | $feedArray[] = $imageStr; |
| 1474 | 1474 | } |
| 1475 | 1475 | |
| 1476 | 1476 | if ($this->title) { |
| 1477 | - $feedArray[] = "<div class='" . $this->stylePrefix . "title'><a href='" . $this->link . "' " . $targetInsert |
|
| 1478 | - . " class='" . $this->stylePrefix . "title'>" |
|
| 1479 | - . FeedCreator::iTrunc(htmlspecialchars($this->title), 100) . '</a></div>'; |
|
| 1477 | + $feedArray[] = "<div class='".$this->stylePrefix."title'><a href='".$this->link."' ".$targetInsert |
|
| 1478 | + . " class='".$this->stylePrefix."title'>" |
|
| 1479 | + . FeedCreator::iTrunc(htmlspecialchars($this->title), 100).'</a></div>'; |
|
| 1480 | 1480 | } |
| 1481 | 1481 | if ($this->getDescription()) { |
| 1482 | - $feedArray[] = "<div class='" . $this->stylePrefix . "description'>" . str_replace(']]>', '', |
|
| 1482 | + $feedArray[] = "<div class='".$this->stylePrefix."description'>".str_replace(']]>', '', |
|
| 1483 | 1483 | str_replace('<![CDATA[', |
| 1484 | 1484 | '', |
| 1485 | 1485 | $this->getDescription())) |
@@ -1487,29 +1487,29 @@ discard block |
||
| 1487 | 1487 | } |
| 1488 | 1488 | |
| 1489 | 1489 | if ($this->header) { |
| 1490 | - $feedArray[] = "<div class='" . $this->stylePrefix . "header'>" . $this->header . '</div>'; |
|
| 1490 | + $feedArray[] = "<div class='".$this->stylePrefix."header'>".$this->header.'</div>'; |
|
| 1491 | 1491 | } |
| 1492 | 1492 | |
| 1493 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
| 1494 | - if ($this->separator && $i > 0) { |
|
| 1495 | - $feedArray[] = "<div class='" . $this->stylePrefix . "separator'>" . $this->separator . '</div>'; |
|
| 1493 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
| 1494 | + if ($this->separator && $i>0) { |
|
| 1495 | + $feedArray[] = "<div class='".$this->stylePrefix."separator'>".$this->separator.'</div>'; |
|
| 1496 | 1496 | } |
| 1497 | 1497 | |
| 1498 | 1498 | if ($this->items[$i]->title) { |
| 1499 | 1499 | if ($this->items[$i]->link) { |
| 1500 | - $feedArray[] = "<div class='" . $this->stylePrefix . "item_title'><a href='" |
|
| 1501 | - . $this->items[$i]->link . "' class='" . $this->stylePrefix . "item_title'" |
|
| 1502 | - . $targetInsert . '>' |
|
| 1500 | + $feedArray[] = "<div class='".$this->stylePrefix."item_title'><a href='" |
|
| 1501 | + . $this->items[$i]->link."' class='".$this->stylePrefix."item_title'" |
|
| 1502 | + . $targetInsert.'>' |
|
| 1503 | 1503 | . FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), 100) |
| 1504 | 1504 | . '</a></div>'; |
| 1505 | - } else { |
|
| 1506 | - $feedArray[] = "<div class='" . $this->stylePrefix . "item_title'>" |
|
| 1505 | + }else { |
|
| 1506 | + $feedArray[] = "<div class='".$this->stylePrefix."item_title'>" |
|
| 1507 | 1507 | . FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), 100) |
| 1508 | 1508 | . '</div>'; |
| 1509 | 1509 | } |
| 1510 | 1510 | } |
| 1511 | 1511 | if ($this->items[$i]->getDescription()) { |
| 1512 | - $feedArray[] = "<div class='" . $this->stylePrefix . "item_description'>" . str_replace(']]>', '', |
|
| 1512 | + $feedArray[] = "<div class='".$this->stylePrefix."item_description'>".str_replace(']]>', '', |
|
| 1513 | 1513 | str_replace('<![CDATA[', |
| 1514 | 1514 | '', |
| 1515 | 1515 | $this->items[$i]->getDescription())) |
@@ -1517,10 +1517,10 @@ discard block |
||
| 1517 | 1517 | } |
| 1518 | 1518 | } |
| 1519 | 1519 | if ($this->footer) { |
| 1520 | - $feedArray[] = "<div class='" . $this->stylePrefix . "footer'>" . $this->footer . '</div>'; |
|
| 1520 | + $feedArray[] = "<div class='".$this->stylePrefix."footer'>".$this->footer.'</div>'; |
|
| 1521 | 1521 | } |
| 1522 | 1522 | |
| 1523 | - $feed = '' . implode($feedArray, "\r\n"); |
|
| 1523 | + $feed = ''.implode($feedArray, "\r\n"); |
|
| 1524 | 1524 | |
| 1525 | 1525 | return $feed; |
| 1526 | 1526 | } |
@@ -1535,7 +1535,7 @@ discard block |
||
| 1535 | 1535 | public function _generateFilename() { |
| 1536 | 1536 | $fileInfo = pathinfo($_SERVER['PHP_SELF']); |
| 1537 | 1537 | |
| 1538 | - return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension']) + 1)) . '.html'; |
|
| 1538 | + return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension'])+1)).'.html'; |
|
| 1539 | 1539 | } |
| 1540 | 1540 | } |
| 1541 | 1541 | |
@@ -1559,7 +1559,7 @@ discard block |
||
| 1559 | 1559 | |
| 1560 | 1560 | $jsFeed = ''; |
| 1561 | 1561 | foreach ($feedArray as $value) { |
| 1562 | - $jsFeed .= "document.write('" . trim(addslashes($value)) . "');\n"; |
|
| 1562 | + $jsFeed .= "document.write('".trim(addslashes($value))."');\n"; |
|
| 1563 | 1563 | } |
| 1564 | 1564 | |
| 1565 | 1565 | return $jsFeed; |
@@ -1575,7 +1575,7 @@ discard block |
||
| 1575 | 1575 | public function _generateFilename() { |
| 1576 | 1576 | $fileInfo = pathinfo($_SERVER['PHP_SELF']); |
| 1577 | 1577 | |
| 1578 | - return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension']) + 1)) . '.js'; |
|
| 1578 | + return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension'])+1)).'.js'; |
|
| 1579 | 1579 | } |
| 1580 | 1580 | } |
| 1581 | 1581 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | |
| 303 | 303 | // smart append - field and namespace aware |
| 304 | 304 | /** |
| 305 | - * @param $el |
|
| 305 | + * @param string $el |
|
| 306 | 306 | * @param $text |
| 307 | 307 | */ |
| 308 | 308 | public function append($el, $text) { |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | /** |
| 387 | - * @return bool |
|
| 387 | + * @return string|false |
|
| 388 | 388 | */ |
| 389 | 389 | public function is_rss() { |
| 390 | 390 | if ($this->feed_type == RSS) { |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | /** |
| 398 | - * @return bool |
|
| 398 | + * @return string|false |
|
| 399 | 399 | */ |
| 400 | 400 | public function is_atom() { |
| 401 | 401 | if ($this->feed_type == ATOM) { |
@@ -407,10 +407,10 @@ discard block |
||
| 407 | 407 | |
| 408 | 408 | /** |
| 409 | 409 | * return XML parser, and possibly re-encoded source |
| 410 | - * @param $source |
|
| 411 | - * @param $out_enc |
|
| 412 | - * @param $in_enc |
|
| 413 | - * @param $detect |
|
| 410 | + * @param string $source |
|
| 411 | + * @param string $out_enc |
|
| 412 | + * @param string|null $in_enc |
|
| 413 | + * @param boolean $detect |
|
| 414 | 414 | * @return array |
| 415 | 415 | */ |
| 416 | 416 | public function create_parser($source, $out_enc, $in_enc, $detect) { |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | |
| 518 | 518 | /** |
| 519 | 519 | * @param $enc |
| 520 | - * @return bool|string |
|
| 520 | + * @return string|false |
|
| 521 | 521 | */ |
| 522 | 522 | public function known_encoding($enc) { |
| 523 | 523 | $enc = strtoupper($enc); |
@@ -35,16 +35,16 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | public $parser; |
| 37 | 37 | |
| 38 | - public $current_item = array(); // item currently being parsed |
|
| 39 | - public $items = array(); // collection of parsed items |
|
| 40 | - public $channel = array(); // hash of channel fields |
|
| 38 | + public $current_item = array(); // item currently being parsed |
|
| 39 | + public $items = array(); // collection of parsed items |
|
| 40 | + public $channel = array(); // hash of channel fields |
|
| 41 | 41 | public $textinput = array(); |
| 42 | 42 | public $image = array(); |
| 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,7 +101,7 @@ 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', |
|
| 104 | + $this->error("Failed to load PHP's XML Extension. ".'http://www.php.net/manual/en/ref.xml.php', |
|
| 105 | 105 | E_USER_ERROR); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -218,8 +218,8 @@ discard block |
||
| 218 | 218 | elseif ($this->feed_type == ATOM && $el === 'link') { |
| 219 | 219 | if (isset($attrs['rel']) && $attrs['rel'] === 'alternate') { |
| 220 | 220 | $link_el = 'link'; |
| 221 | - } else { |
|
| 222 | - $link_el = 'link_' . $attrs['rel']; |
|
| 221 | + }else { |
|
| 222 | + $link_el = 'link_'.$attrs['rel']; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | $this->append($link_el, $attrs['href']); |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | public function feed_cdata($p, $text) { |
| 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 | } |
@@ -266,12 +266,12 @@ discard block |
||
| 266 | 266 | // note: i don't think this is actually neccessary |
| 267 | 267 | if ($this->stack[0] == $el) { |
| 268 | 268 | $this->append_content("</$el>"); |
| 269 | - } else { |
|
| 269 | + }else { |
|
| 270 | 270 | $this->append_content("<$el />"); |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | array_shift($this->stack); |
| 274 | - } else { |
|
| 274 | + }else { |
|
| 275 | 275 | array_shift($this->stack); |
| 276 | 276 | } |
| 277 | 277 | |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | } elseif ($this->inimage) { |
| 320 | 320 | $this->concat($this->image[$this->current_namespace][$el], $text); |
| 321 | 321 | } |
| 322 | - } else { |
|
| 322 | + }else { |
|
| 323 | 323 | if ($this->initem) { |
| 324 | 324 | $this->concat($this->current_item[$el], $text); |
| 325 | 325 | } elseif ($this->intextinput) { |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | // if atom populate rss fields |
| 337 | 337 | if ($this->is_atom()) { |
| 338 | 338 | $this->channel['description'] = $this->channel['tagline']; |
| 339 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
| 339 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
| 340 | 340 | $item = $this->items[$i]; |
| 341 | 341 | if (isset($item['summary'])) { |
| 342 | 342 | $item['description'] = $item['summary']; |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | $atom_date = isset($item['issued']) ? $item['issued'] : @$item['modified']; |
| 349 | 349 | if ($atom_date) { |
| 350 | 350 | $epoch = @parse_w3cdtf($atom_date); |
| 351 | - if ($epoch && $epoch > 0) { |
|
| 351 | + if ($epoch && $epoch>0) { |
|
| 352 | 352 | $item['date_timestamp'] = $epoch; |
| 353 | 353 | } |
| 354 | 354 | } |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | } |
| 358 | 358 | } elseif ($this->is_rss()) { |
| 359 | 359 | $this->channel['tagline'] = $this->channel['description']; |
| 360 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
| 360 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
| 361 | 361 | $item = $this->items[$i]; |
| 362 | 362 | if (isset($item['description'])) { |
| 363 | 363 | $item['summary'] = $item['description']; |
@@ -368,12 +368,12 @@ discard block |
||
| 368 | 368 | |
| 369 | 369 | if ($this->is_rss() === '1.0' && isset($item['dc']['date'])) { |
| 370 | 370 | $epoch = @parse_w3cdtf($item['dc']['date']); |
| 371 | - if ($epoch && $epoch > 0) { |
|
| 371 | + if ($epoch && $epoch>0) { |
|
| 372 | 372 | $item['date_timestamp'] = $epoch; |
| 373 | 373 | } |
| 374 | 374 | } elseif (isset($item['pubdate'])) { |
| 375 | 375 | $epoch = @strtotime($item['pubdate']); |
| 376 | - if ($epoch > 0) { |
|
| 376 | + if ($epoch>0) { |
|
| 377 | 377 | $item['date_timestamp'] = $epoch; |
| 378 | 378 | } |
| 379 | 379 | } |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | public function is_rss() { |
| 390 | 390 | if ($this->feed_type == RSS) { |
| 391 | 391 | return $this->feed_version; |
| 392 | - } else { |
|
| 392 | + }else { |
|
| 393 | 393 | return false; |
| 394 | 394 | } |
| 395 | 395 | } |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | public function is_atom() { |
| 401 | 401 | if ($this->feed_type == ATOM) { |
| 402 | 402 | return $this->feed_version; |
| 403 | - } else { |
|
| 403 | + }else { |
|
| 404 | 404 | return false; |
| 405 | 405 | } |
| 406 | 406 | } |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | public function create_parser($source, $out_enc, $in_enc, $detect) { |
| 417 | 417 | if (substr(phpversion(), 0, 1) == 5) { |
| 418 | 418 | $parser = $this->php5_create_parser($in_enc, $detect); |
| 419 | - } else { |
|
| 419 | + }else { |
|
| 420 | 420 | list($parser, $source) = $this->php4_create_parser($source, $in_enc, $detect); |
| 421 | 421 | } |
| 422 | 422 | if ($out_enc) { |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | // by default php5 does a fine job of detecting input encodings |
| 443 | 443 | if (!$detect && $in_enc) { |
| 444 | 444 | return xml_parser_create($in_enc); |
| 445 | - } else { |
|
| 445 | + }else { |
|
| 446 | 446 | return xml_parser_create(''); |
| 447 | 447 | } |
| 448 | 448 | } |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/m', $source, $m)) { |
| 475 | 475 | $in_enc = strtoupper($m[1]); |
| 476 | 476 | $this->source_encoding = $in_enc; |
| 477 | - } else { |
|
| 477 | + }else { |
|
| 478 | 478 | $in_enc = 'UTF-8'; |
| 479 | 479 | } |
| 480 | 480 | } |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | $enc = strtoupper($enc); |
| 524 | 524 | if (in_array($enc, $this->_KNOWN_ENCODINGS)) { |
| 525 | 525 | return $enc; |
| 526 | - } else { |
|
| 526 | + }else { |
|
| 527 | 527 | return false; |
| 528 | 528 | } |
| 529 | 529 | } |
@@ -539,14 +539,14 @@ discard block |
||
| 539 | 539 | } |
| 540 | 540 | if (MAGPIE_DEBUG) { |
| 541 | 541 | trigger_error($errormsg, $lvl); |
| 542 | - } else { |
|
| 542 | + }else { |
|
| 543 | 543 | error_log($errormsg, 0); |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | $notices = E_USER_NOTICE | E_NOTICE; |
| 547 | 547 | if ($lvl & $notices) { |
| 548 | 548 | $this->WARNING = $errormsg; |
| 549 | - } else { |
|
| 549 | + }else { |
|
| 550 | 550 | $this->ERROR = $errormsg; |
| 551 | 551 | } |
| 552 | 552 | } |
@@ -580,12 +580,12 @@ discard block |
||
| 580 | 580 | ); |
| 581 | 581 | |
| 582 | 582 | # calc epoch for current date assuming GMT |
| 583 | - $epoch = gmmktime((int)$hours, (int)$minutes, (int)$seconds, (int)$month, (int)$day, (int)$year); |
|
| 583 | + $epoch = gmmktime((int) $hours, (int) $minutes, (int) $seconds, (int) $month, (int) $day, (int) $year); |
|
| 584 | 584 | |
| 585 | 585 | $offset = 0; |
| 586 | 586 | if ($match[10] === 'Z') { |
| 587 | 587 | # zulu time, aka GMT |
| 588 | - } else { |
|
| 588 | + }else { |
|
| 589 | 589 | list($tz_mod, $tz_hour, $tz_min) = array($match[8], $match[9], $match[10]); |
| 590 | 590 | |
| 591 | 591 | # zero out the variables |
@@ -596,20 +596,20 @@ discard block |
||
| 596 | 596 | $tz_min = 0; |
| 597 | 597 | } |
| 598 | 598 | |
| 599 | - $offset_secs = (($tz_hour * 60) + $tz_min) * 60; |
|
| 599 | + $offset_secs = (($tz_hour*60)+$tz_min)*60; |
|
| 600 | 600 | |
| 601 | 601 | # is timezone ahead of GMT? then subtract offset |
| 602 | 602 | # |
| 603 | 603 | if ($tz_mod == '+') { |
| 604 | - $offset_secs = $offset_secs * -1; |
|
| 604 | + $offset_secs = $offset_secs*-1; |
|
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | $offset = $offset_secs; |
| 608 | 608 | } |
| 609 | - $epoch = $epoch + $offset; |
|
| 609 | + $epoch = $epoch+$offset; |
|
| 610 | 610 | |
| 611 | 611 | return $epoch; |
| 612 | - } else { |
|
| 612 | + }else { |
|
| 613 | 613 | return -1; |
| 614 | 614 | } |
| 615 | 615 | } |
@@ -83,7 +83,7 @@ |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | - * @return bool|string |
|
| 86 | + * @return string|false |
|
| 87 | 87 | */ |
| 88 | 88 | public function is_atom() { |
| 89 | 89 | if ($this->feed_type == ATOM) { |
@@ -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 |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $this->feed_version = empty($this->feed_version) ? '0.3' : $this->feed_version; |
| 91 | 91 | |
| 92 | 92 | return $this->feed_version; |
| 93 | - } else { |
|
| 93 | + }else { |
|
| 94 | 94 | return false; |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $this->channel['tagline'] = @$this->channel['subtitle']; |
| 103 | 103 | unset($this->channel['subtitle']); |
| 104 | 104 | } |
| 105 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
| 105 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
| 106 | 106 | // ATOM time |
| 107 | 107 | if ($date = @$this->items[$i]['modified']) { |
| 108 | 108 | continue; |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $this->items[$i]['modified'] = $date; |
| 123 | 123 | } |
| 124 | 124 | elseif ($this->is_rss() !== '1.0'): |
| 125 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
| 125 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
| 126 | 126 | if ($date = @$this->items[$i]['pubdate']) { |
| 127 | 127 | continue; |
| 128 | 128 | } |
@@ -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'])) { |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | foreach (array_keys($val) as $key) { |
| 203 | 203 | $val[$key] = $this->_encoding($val[$key]); |
| 204 | 204 | } |
| 205 | - } else { |
|
| 205 | + }else { |
|
| 206 | 206 | $val = XoopsLocal::convert_encoding($val, $this->charset_out, $this->charset_in); |
| 207 | 207 | } |
| 208 | 208 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * @var mixed $pattern |
| 109 | 109 | * @var mixed $replacement |
| 110 | 110 | * |
| 111 | - * @return bool true on success |
|
| 111 | + * @return null|boolean true on success |
|
| 112 | 112 | */ |
| 113 | 113 | function planet_parse_class($class_string, $pattern = '', $replacement = '') { |
| 114 | 114 | if (empty($class_string)) { |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @var mixed $pattern |
| 144 | 144 | * @var mixed $replacement |
| 145 | 145 | * |
| 146 | - * @return bool true on success |
|
| 146 | + * @return null|boolean true on success |
|
| 147 | 147 | */ |
| 148 | 148 | function planet_parse_function($function_string, $pattern = '', $replacement = '') { |
| 149 | 149 | if (empty($function_string)) { |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | |
| 495 | 495 | /** |
| 496 | 496 | * @param $url |
| 497 | - * @return bool|string |
|
| 497 | + * @return false|string |
|
| 498 | 498 | */ |
| 499 | 499 | function planet_fetch_fopen($url) { |
| 500 | 500 | if (!$fp = @fopen($url, 'r')) { |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | if (!defined('planet_FUNCTIONS')): |
| 38 | 38 | define('planet_FUNCTIONS', 1); |
| 39 | 39 | |
| 40 | - require XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/vars.php'; |
|
| 41 | - include_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
| 42 | - include_once XOOPS_ROOT_PATH . '/Frameworks/art/functions.php'; |
|
| 40 | + require XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/vars.php'; |
|
| 41 | + include_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
| 42 | + include_once XOOPS_ROOT_PATH.'/Frameworks/art/functions.php'; |
|
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * Function to display messages |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * - "&" in a string |
| 67 | 67 | */ |
| 68 | 68 | function planet_parse_args(&$args_numeric, &$args, &$args_string) { |
| 69 | - $args_abb = array( |
|
| 69 | + $args_abb = array( |
|
| 70 | 70 | 'a' => 'article', |
| 71 | 71 | 'b' => 'blog', |
| 72 | 72 | 'c' => 'category', |
@@ -81,24 +81,24 @@ discard block |
||
| 81 | 81 | if (preg_match("/[^\?]*\.php[\/|\?]([^\?]*)/i", $_SERVER['REQUEST_URI'], $matches)) { |
| 82 | 82 | $vars = preg_split("/[\/|&]/", $matches[1]); |
| 83 | 83 | $vars = array_map('trim', $vars); |
| 84 | - if (count($vars) > 0) { |
|
| 84 | + if (count($vars)>0) { |
|
| 85 | 85 | foreach ($vars as $var) { |
| 86 | 86 | if (is_numeric($var)) { |
| 87 | 87 | $args_numeric[] = $var; |
| 88 | 88 | } elseif (false === strpos($var, '=')) { |
| 89 | 89 | if (is_numeric(substr($var, 1))) { |
| 90 | - $args[$args_abb[strtolower($var{0})]] = (int)substr($var, 1); |
|
| 91 | - } else { |
|
| 90 | + $args[$args_abb[strtolower($var{0})]] = (int) substr($var, 1); |
|
| 91 | + }else { |
|
| 92 | 92 | $args_string[] = urldecode($var); |
| 93 | 93 | } |
| 94 | - } else { |
|
| 94 | + }else { |
|
| 95 | 95 | parse_str($var, $args); |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - return (count($args) + count($args_numeric) + count($args_string) == 0) ? null : true; |
|
| 101 | + return (count($args)+count($args_numeric)+count($args_string) == 0) ? null : true; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $pattern = array($pattern); |
| 121 | 121 | $replacement = array($replacement); |
| 122 | 122 | } |
| 123 | - if (is_array($pattern) && count($pattern) > 0) { |
|
| 123 | + if (is_array($pattern) && count($pattern)>0) { |
|
| 124 | 124 | $ii = 0; |
| 125 | 125 | foreach ($pattern as $pat) { |
| 126 | 126 | if (!in_array($pat, $patterns)) { |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $pattern = array($pattern); |
| 156 | 156 | $replacement = array($replacement); |
| 157 | 157 | } |
| 158 | - if (is_array($pattern) && count($pattern) > 0) { |
|
| 158 | + if (is_array($pattern) && count($pattern)>0) { |
|
| 159 | 159 | $ii = 0; |
| 160 | 160 | foreach ($pattern as $pat) { |
| 161 | 161 | if (!in_array($pat, $patterns)) { |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | if (!is_array($userid)) { |
| 197 | 197 | $userid = array($userid); |
| 198 | 198 | } |
| 199 | - $users =& mod_getUnameFromIds($userid, $usereal, $linked); |
|
| 199 | + $users = & mod_getUnameFromIds($userid, $usereal, $linked); |
|
| 200 | 200 | |
| 201 | 201 | return $users; |
| 202 | 202 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $myts = MyTextSanitizer::getInstance(); |
| 213 | 213 | $link_array = preg_split("/(\r\n|\r|\n)( *)/", $text); |
| 214 | 214 | $links = array(); |
| 215 | - if (count($link_array) > 0) { |
|
| 215 | + if (count($link_array)>0) { |
|
| 216 | 216 | foreach ($link_array as $link) { |
| 217 | 217 | @list($url, $title) = array_map('trim', preg_split('/ /', $link, 2)); |
| 218 | 218 | if (empty($url)) { |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | * @return string |
| 232 | 232 | */ |
| 233 | 233 | function planet_getTemplate($pagename) { |
| 234 | - return $GLOBALS['VAR_PREFIX'] . '_' . $pagename . '.tpl'; |
|
| 234 | + return $GLOBALS['VAR_PREFIX'].'_'.$pagename.'.tpl'; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /** |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | return false; |
| 258 | 258 | } |
| 259 | 259 | @list($pat, $rep) = array_map('trim', preg_split("#[\s]+#", $pattern)); |
| 260 | - $trackback_url = preg_replace('#' . $pat . '#', $rep, $article_obj->getVar('art_link')); |
|
| 260 | + $trackback_url = preg_replace('#'.$pat.'#', $rep, $article_obj->getVar('art_link')); |
|
| 261 | 261 | |
| 262 | 262 | return planet_trackback($trackback_url, $article); |
| 263 | 263 | } |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | |
| 273 | 273 | $title = $article->getVar('art_title'); |
| 274 | 274 | $excerpt = $article->getVar('art_content'); |
| 275 | - $blog_name = $xoopsConfig['sitename'] . '-' . $xoopsModule->getVar('name'); |
|
| 275 | + $blog_name = $xoopsConfig['sitename'].'-'.$xoopsModule->getVar('name'); |
|
| 276 | 276 | $title = xoops_utf8_encode($title); |
| 277 | 277 | $excerpt = xoops_utf8_encode($excerpt); |
| 278 | 278 | $blog_name = xoops_utf8_encode($blog_name); |
@@ -280,18 +280,18 @@ discard block |
||
| 280 | 280 | $title1 = urlencode($title); |
| 281 | 281 | $excerpt1 = urlencode($excerpt); |
| 282 | 282 | $name1 = urlencode($blog_name); |
| 283 | - $url = urlencode(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' |
|
| 284 | - . URL_DELIMITER . '' . $article->getVar('art_id')); |
|
| 283 | + $url = urlencode(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php' |
|
| 284 | + . URL_DELIMITER.''.$article->getVar('art_id')); |
|
| 285 | 285 | $query_string = "title=$title1&url=$url&blog_name=$name1&excerpt=$excerpt1&charset=$charset"; |
| 286 | 286 | $trackback_url = parse_url($trackback_url); |
| 287 | 287 | |
| 288 | - $http_request = 'POST ' . $trackback_url['path'] . ($trackback_url['query'] ? '?' |
|
| 288 | + $http_request = 'POST '.$trackback_url['path'].($trackback_url['query'] ? '?' |
|
| 289 | 289 | . $trackback_url['query'] : '') |
| 290 | 290 | . " HTTP/1.0\r\n"; |
| 291 | - $http_request .= 'Host: ' . $trackback_url['host'] . "\r\n"; |
|
| 292 | - $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . $charset . "\r\n"; |
|
| 293 | - $http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n"; |
|
| 294 | - $http_request .= 'User-Agent: XOOPS Blogs/' . XOOPS_VERSION; |
|
| 291 | + $http_request .= 'Host: '.$trackback_url['host']."\r\n"; |
|
| 292 | + $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset='.$charset."\r\n"; |
|
| 293 | + $http_request .= 'Content-Length: '.strlen($query_string)."\r\n"; |
|
| 294 | + $http_request .= 'User-Agent: XOOPS Blogs/'.XOOPS_VERSION; |
|
| 295 | 295 | $http_request .= "\r\n\r\n"; |
| 296 | 296 | $http_request .= $query_string; |
| 297 | 297 | if ('' == $trackback_url['port']) { |
@@ -300,11 +300,11 @@ discard block |
||
| 300 | 300 | $fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 4); |
| 301 | 301 | @fwrite($fs, $http_request); |
| 302 | 302 | if ($xoopsModuleConfig['do_debug']) { |
| 303 | - $debug_file = XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '_trackback.log'; |
|
| 303 | + $debug_file = XOOPS_CACHE_PATH.'/'.$GLOBALS['moddirname'].'_trackback.log'; |
|
| 304 | 304 | $fr = "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n"; |
| 305 | 305 | $fr .= "CHARSET:$charset\n"; |
| 306 | 306 | $fr .= "NAME:$blog_name\n"; |
| 307 | - $fr .= 'TITLE:' . $title . "\n"; |
|
| 307 | + $fr .= 'TITLE:'.$title."\n"; |
|
| 308 | 308 | $fr .= "EXCERPT:$excerpt\n\n"; |
| 309 | 309 | while (!@feof($fs)) { |
| 310 | 310 | $fr .= @fgets($fs, 4096); |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | if ($fp = fopen($debug_file, 'a')) { |
| 315 | 315 | fwrite($fp, $fr); |
| 316 | 316 | fclose($fp); |
| 317 | - } else { |
|
| 317 | + }else { |
|
| 318 | 318 | } |
| 319 | 319 | } |
| 320 | 320 | @fclose($fs); |
@@ -333,19 +333,19 @@ discard block |
||
| 333 | 333 | planet_ping($serv, $id); |
| 334 | 334 | } |
| 335 | 335 | } |
| 336 | - include_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/class-IXR.php'; |
|
| 336 | + include_once XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/class-IXR.php'; |
|
| 337 | 337 | |
| 338 | 338 | // using a timeout of 3 seconds should be enough to cover slow servers |
| 339 | 339 | $client = new IXR_Client($server, false); |
| 340 | 340 | $client->timeout = 3; |
| 341 | - $client->useragent .= ' -- XOOPS Article/' . XOOPS_VERSION; |
|
| 341 | + $client->useragent .= ' -- XOOPS Article/'.XOOPS_VERSION; |
|
| 342 | 342 | |
| 343 | 343 | // when set to true, this outputs debug messages by itself |
| 344 | 344 | $client->debug = false; |
| 345 | 345 | |
| 346 | 346 | $blogname = xoops_utf8_encode($GLOBALS['xoopsModule']->getVar('name')); |
| 347 | - $home = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/'; |
|
| 348 | - $rss2_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php' . URL_DELIMITER . 'rss2.0/' . $id; |
|
| 347 | + $home = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/'; |
|
| 348 | + $rss2_url = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/xml.php'.URL_DELIMITER.'rss2.0/'.$id; |
|
| 349 | 349 | |
| 350 | 350 | if (!$client->query('weblogUpdates.extendedPing', $blogname, $home, $rss2_url)) { // then try a normal ping |
| 351 | 351 | $client->query('weblogUpdates.ping', $blogname, $home); |
@@ -360,16 +360,16 @@ discard block |
||
| 360 | 360 | function planet_trackback_response($error = 0, $error_message = '') { |
| 361 | 361 | $charset = 'utf-8'; |
| 362 | 362 | $error_message = xoops_utf8_encode($error_message); |
| 363 | - header('Content-Type: text/xml; charset="' . $charset . '"'); |
|
| 363 | + header('Content-Type: text/xml; charset="'.$charset.'"'); |
|
| 364 | 364 | if ($error) { |
| 365 | - echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n"; |
|
| 365 | + echo '<?xml version="1.0" encoding="'.$charset.'"?'.">\n"; |
|
| 366 | 366 | echo "<response>\n"; |
| 367 | 367 | echo "<error>1</error>\n"; |
| 368 | 368 | echo "<message>$error_message</message>\n"; |
| 369 | 369 | echo '</response>'; |
| 370 | 370 | die(); |
| 371 | - } else { |
|
| 372 | - echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n"; |
|
| 371 | + }else { |
|
| 372 | + echo '<?xml version="1.0" encoding="'.$charset.'"?'.">\n"; |
|
| 373 | 373 | echo "<response>\n"; |
| 374 | 374 | echo "<error>0</error>\n"; |
| 375 | 375 | echo '</response>'; |
@@ -388,11 +388,11 @@ discard block |
||
| 388 | 388 | if (is_array($string)) { |
| 389 | 389 | $value = array(); |
| 390 | 390 | foreach ($string as $key => $val) { |
| 391 | - $value[] = $key . '|' . $val; |
|
| 391 | + $value[] = $key.'|'.$val; |
|
| 392 | 392 | } |
| 393 | 393 | $string = implode(',', $value); |
| 394 | 394 | } |
| 395 | - setcookie($GLOBALS['VAR_PREFIX'] . $name, $string, (int)$expire, '/'); |
|
| 395 | + setcookie($GLOBALS['VAR_PREFIX'].$name, $string, (int) $expire, '/'); |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | /** |
@@ -401,14 +401,14 @@ discard block |
||
| 401 | 401 | * @return array|null |
| 402 | 402 | */ |
| 403 | 403 | function planet_getcookie($name, $isArray = false) { |
| 404 | - $value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'] . $name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'] . $name] : null; |
|
| 404 | + $value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'].$name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'].$name] : null; |
|
| 405 | 405 | if ($isArray) { |
| 406 | 406 | $_value = $value ? explode(',', $value) : array(); |
| 407 | 407 | $value = array(); |
| 408 | - if (count($_value) > 0) { |
|
| 408 | + if (count($_value)>0) { |
|
| 409 | 409 | foreach ($_value as $string) { |
| 410 | 410 | $key = substr($string, 0, strpos($string, '|')); |
| 411 | - $val = substr($string, strpos($string, '|') + 1); |
|
| 411 | + $val = substr($string, strpos($string, '|')+1); |
|
| 412 | 412 | $value[$key] = $val; |
| 413 | 413 | } |
| 414 | 414 | } |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | * @return string |
| 463 | 463 | */ |
| 464 | 464 | function planet_fetch_snoopy($url) { |
| 465 | - require_once XOOPS_ROOT_PATH . '/class/snoopy.php'; |
|
| 465 | + require_once XOOPS_ROOT_PATH.'/class/snoopy.php'; |
|
| 466 | 466 | $snoopy = new Snoopy; |
| 467 | 467 | $data = ''; |
| 468 | 468 | if (@$snoopy->fetch($url)) { |
@@ -480,10 +480,10 @@ discard block |
||
| 480 | 480 | if (!function_exists('curl_init')) { |
| 481 | 481 | return false; |
| 482 | 482 | } |
| 483 | - $ch = curl_init(); // initialize curl handle |
|
| 483 | + $ch = curl_init(); // initialize curl handle |
|
| 484 | 484 | curl_setopt($ch, CURLOPT_URL, $url); // set url to post to |
| 485 | 485 | curl_setopt($ch, CURLOPT_FAILONERROR, 1); |
| 486 | - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects |
|
| 486 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects |
|
| 487 | 487 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable |
| 488 | 488 | curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 31s |
| 489 | 489 | $data = curl_exec($ch); // run the whole process |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | if ($index === false) { |
| 524 | 524 | return false; |
| 525 | 525 | } |
| 526 | - $index = strlen($haystack) - strlen($needle) - $index; |
|
| 526 | + $index = strlen($haystack)-strlen($needle)-$index; |
|
| 527 | 527 | |
| 528 | 528 | return $index; |
| 529 | 529 | } |
@@ -293,7 +293,7 @@ |
||
| 293 | 293 | // Used in get_calendar |
| 294 | 294 | /** |
| 295 | 295 | * @param $num |
| 296 | - * @return mixed |
|
| 296 | + * @return double |
|
| 297 | 297 | */ |
| 298 | 298 | function planet_calendar_week_mod($num) { |
| 299 | 299 | $base = 7; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | // URL: http://xoops.org // |
| 25 | 25 | // Project: Article Project // |
| 26 | 26 | // ------------------------------------------------------------------------ // |
| 27 | -include __DIR__ . '/header.php'; |
|
| 27 | +include __DIR__.'/header.php'; |
|
| 28 | 28 | |
| 29 | 29 | if (planet_parse_args($args_num, $args, $args_str)) { |
| 30 | 30 | $args['year'] = @$args_num[0]; |
@@ -32,37 +32,37 @@ discard block |
||
| 32 | 32 | $args['day'] = @$args_num[2]; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | -$day = (int)(empty($_GET['day']) ? @$args['day'] : $_GET['day']); |
|
| 36 | -$year = (int)(empty($_GET['year']) ? @$args['year'] : $_GET['year']); |
|
| 37 | -$month = (int)(empty($_GET['month']) ? @$args['month'] : $_GET['month']); |
|
| 38 | -$blog_id = (int)(empty($_GET['blog']) ? @$args['blog'] : $_GET['blog']); |
|
| 39 | -$start = (int)(empty($_GET['start']) ? @$args['start'] : $_GET['start']); |
|
| 35 | +$day = (int) (empty($_GET['day']) ? @$args['day'] : $_GET['day']); |
|
| 36 | +$year = (int) (empty($_GET['year']) ? @$args['year'] : $_GET['year']); |
|
| 37 | +$month = (int) (empty($_GET['month']) ? @$args['month'] : $_GET['month']); |
|
| 38 | +$blog_id = (int) (empty($_GET['blog']) ? @$args['blog'] : $_GET['blog']); |
|
| 39 | +$start = (int) (empty($_GET['start']) ? @$args['start'] : $_GET['start']); |
|
| 40 | 40 | |
| 41 | 41 | $page['title'] = planet_constant('MD_ACHIVE'); |
| 42 | 42 | |
| 43 | 43 | $article_handler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); |
| 44 | 44 | $blog_handler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
| 45 | 45 | |
| 46 | -$xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name') . ' - ' . planet_constant('MD_ACHIVE'); |
|
| 46 | +$xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name').' - '.planet_constant('MD_ACHIVE'); |
|
| 47 | 47 | $xoopsOption['template_main'] = planet_getTemplate('archive'); |
| 48 | -include_once XOOPS_ROOT_PATH . '/header.php'; |
|
| 49 | -include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
| 48 | +include_once XOOPS_ROOT_PATH.'/header.php'; |
|
| 49 | +include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'; |
|
| 50 | 50 | |
| 51 | 51 | $year = empty($year) ? date('Y') : $year; |
| 52 | -if ($month < 1) { |
|
| 52 | +if ($month<1) { |
|
| 53 | 53 | $month = $day = 0; |
| 54 | 54 | $page['time'] = sprintf(planet_constant('MD_TIME_Y'), $year); |
| 55 | -} elseif ($day < 1) { |
|
| 55 | +} elseif ($day<1) { |
|
| 56 | 56 | $day = 0; |
| 57 | 57 | $page['time'] = sprintf(planet_constant('MD_TIME_YM'), $year, $month); |
| 58 | -} else { |
|
| 58 | +}else { |
|
| 59 | 59 | $page['time'] = sprintf(planet_constant('MD_TIME_YMD'), $year, $month, $day); |
| 60 | 60 | } |
| 61 | 61 | $time = array('year' => $year, 'month' => $month, 'day' => $day); |
| 62 | 62 | if ($xoopsUser) { |
| 63 | - $timeoffset = ($xoopsUser->getVar('timezone_offset') - $xoopsConfig['server_TZ']) * 3600; |
|
| 64 | -} else { |
|
| 65 | - $timeoffset = ($xoopsConfig['default_TZ'] - $xoopsConfig['server_TZ']) * 3600; |
|
| 63 | + $timeoffset = ($xoopsUser->getVar('timezone_offset')-$xoopsConfig['server_TZ'])*3600; |
|
| 64 | +}else { |
|
| 65 | + $timeoffset = ($xoopsConfig['default_TZ']-$xoopsConfig['server_TZ'])*3600; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | $criteria = new CriteriaCompo(); |
@@ -79,13 +79,13 @@ discard block |
||
| 79 | 79 | $criteria->setStart($start); |
| 80 | 80 | $criteria->setLimit($xoopsModuleConfig['articles_perpage']); |
| 81 | 81 | |
| 82 | -$articles_obj =& $article_handler->getAll($criteria, array('uid', 'art_title', 'art_time', 'blog_id', 'art_content')); |
|
| 82 | +$articles_obj = & $article_handler->getAll($criteria, array('uid', 'art_title', 'art_time', 'blog_id', 'art_content')); |
|
| 83 | 83 | $articles_count = $article_handler->getCount($criteria); |
| 84 | 84 | |
| 85 | 85 | $articles = array(); |
| 86 | 86 | $blogs_id = array(); |
| 87 | 87 | foreach ($articles_obj as $id => $article) { |
| 88 | - $articles[] = array( |
|
| 88 | + $articles[] = array( |
|
| 89 | 89 | 'id' => $id, |
| 90 | 90 | 'blog' => array('id' => $article->getVar('blog_id'), 'title' => ''), |
| 91 | 91 | 'title' => $article->getVar('art_title'), |
@@ -96,22 +96,22 @@ discard block |
||
| 96 | 96 | $blogs_id[$article->getVar('blog_id')] = 1; |
| 97 | 97 | unset($_article); |
| 98 | 98 | } |
| 99 | -$criteria_blog = new Criteria('blog_id', '(' . implode(',', array_keys($blog_array)) . ')', 'IN'); |
|
| 99 | +$criteria_blog = new Criteria('blog_id', '('.implode(',', array_keys($blog_array)).')', 'IN'); |
|
| 100 | 100 | $blogs = $blog_handler->getList($criteria_blog); |
| 101 | 101 | foreach (array_keys($articles) as $key) { |
| 102 | 102 | $articles[$key]['blog']['title'] = $blogs[$articles[$key]['blog']['id']]; |
| 103 | 103 | } |
| 104 | -if ($blog_id > 0) { |
|
| 105 | - $page['blog'] = $blogs[$blog_id];; |
|
| 104 | +if ($blog_id>0) { |
|
| 105 | + $page['blog'] = $blogs[$blog_id]; ; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | -if ($articles_count > $xoopsModuleConfig['articles_perpage']) { |
|
| 109 | - include XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
| 108 | +if ($articles_count>$xoopsModuleConfig['articles_perpage']) { |
|
| 109 | + include XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
| 110 | 110 | $nav = new XoopsPageNav($articles_count, $xoopsModuleConfig['articles_perpage'], $start, 'start', |
| 111 | - 'month=' . $month . '&day=' . $day . '&year=' . $year . '&blog=' |
|
| 112 | - . (int)$blog_id); |
|
| 111 | + 'month='.$month.'&day='.$day.'&year='.$year.'&blog=' |
|
| 112 | + . (int) $blog_id); |
|
| 113 | 113 | $pagenav = $nav->renderNav(4); |
| 114 | -} else { |
|
| 114 | +}else { |
|
| 115 | 115 | $pagenav = ''; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -120,46 +120,46 @@ 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 = array(); |
| 137 | 137 | while ($myrow = $xoopsDB->fetchArray($result)) { |
| 138 | 138 | $months[] = array( |
| 139 | - 'title' => planet_constant('MD_MONTH_' . (int)$myrow['mon']) . ' (' . (int)$myrow['count'] . ')', |
|
| 140 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' |
|
| 141 | - . $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.'' |
|
| 141 | + . $year.'/'.$myrow['mon'].'/b'.$blog_id |
|
| 142 | 142 | ); |
| 143 | 143 | } |
| 144 | 144 | $timenav['prev'] = array( |
| 145 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' |
|
| 146 | - . ($year - 1) . '/b' . $blog_id, |
|
| 147 | - 'title' => sprintf(planet_constant('MD_TIME_Y'), $year - 1) |
|
| 145 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.'' |
|
| 146 | + . ($year-1).'/b'.$blog_id, |
|
| 147 | + 'title' => sprintf(planet_constant('MD_TIME_Y'), $year-1) |
|
| 148 | 148 | ); |
| 149 | - if ($year < date('Y')) { |
|
| 149 | + if ($year<date('Y')) { |
|
| 150 | 150 | $timenav['next'] = array( |
| 151 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' |
|
| 152 | - . ($year + 1) . '/b' . $blog_id, |
|
| 153 | - 'title' => sprintf(planet_constant('MD_TIME_Y'), $year + 1) |
|
| 151 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.'' |
|
| 152 | + . ($year+1).'/b'.$blog_id, |
|
| 153 | + 'title' => sprintf(planet_constant('MD_TIME_Y'), $year+1) |
|
| 154 | 154 | ); |
| 155 | 155 | } |
| 156 | 156 | } // Get daily list |
| 157 | 157 | elseif (empty($day)) { |
| 158 | - $sql = "SELECT DAY(FROM_UNIXTIME(art_time - $timeoffset)) AS day, COUNT(DISTINCT a.art_id) AS count |
|
| 159 | - FROM " . planet_DB_prefix('article') . " |
|
| 158 | + $sql = "SELECT DAY(FROM_UNIXTIME(art_time - $timeoffset)) AS day, COUNT(DISTINCT a.art_id) AS count |
|
| 159 | + FROM ".planet_DB_prefix('article')." |
|
| 160 | 160 | WHERE YEAR(FROM_UNIXTIME(art_time - $timeoffset)) = $year |
| 161 | 161 | AND MONTH(FROM_UNIXTIME(art_time - $timeoffset)) = $month |
| 162 | - " . $blog_criteria . ' |
|
| 162 | + ".$blog_criteria.' |
|
| 163 | 163 | GROUP BY day |
| 164 | 164 | '; |
| 165 | 165 | $result = $xoopsDB->query($sql); |
@@ -167,38 +167,38 @@ discard block |
||
| 167 | 167 | while ($myrow = $xoopsDB->fetchArray($result)) { |
| 168 | 168 | $days[$myrow['day']]['count'] = $myrow['count']; |
| 169 | 169 | } |
| 170 | - for ($i = 1; $i <= 31; ++$i) { |
|
| 170 | + for ($i = 1; $i<=31; ++$i) { |
|
| 171 | 171 | if (!isset($days[$i])) { |
| 172 | 172 | continue; |
| 173 | 173 | } |
| 174 | 174 | $days[$i] = array( |
| 175 | 175 | 'title' => $days[$i]['count'], |
| 176 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' |
|
| 177 | - . $year . '/' . $month . '/' . $i . '/b' . $blog_id |
|
| 176 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.'' |
|
| 177 | + . $year.'/'.$month.'/'.$i.'/b'.$blog_id |
|
| 178 | 178 | ); |
| 179 | 179 | } |
| 180 | 180 | $calendar = planet_getCalendar($year, $month, $days); |
| 181 | - $month_next = $month + 1; |
|
| 182 | - $month_prev = $month - 1; |
|
| 181 | + $month_next = $month+1; |
|
| 182 | + $month_prev = $month-1; |
|
| 183 | 183 | $_year = $year; |
| 184 | 184 | if ($month == 12) { |
| 185 | 185 | $month_next = 1; |
| 186 | - $_year = $year + 1; |
|
| 186 | + $_year = $year+1; |
|
| 187 | 187 | } |
| 188 | 188 | if ($month == 1) { |
| 189 | 189 | $month_pre = 12; |
| 190 | - $_year = $year - 1; |
|
| 190 | + $_year = $year-1; |
|
| 191 | 191 | } |
| 192 | 192 | $timenav['prev'] = array( |
| 193 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' |
|
| 194 | - . $_year . '/' . $month_prev . '/b' . $blog_id, |
|
| 195 | - 'title' => planet_constant('MD_MONTH_' . $month_prev) |
|
| 193 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.'' |
|
| 194 | + . $_year.'/'.$month_prev.'/b'.$blog_id, |
|
| 195 | + 'title' => planet_constant('MD_MONTH_'.$month_prev) |
|
| 196 | 196 | ); |
| 197 | - if ($year < date('Y') || $month < date('n')) { |
|
| 197 | + if ($year<date('Y') || $month<date('n')) { |
|
| 198 | 198 | $timenav['next'] = array( |
| 199 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' |
|
| 200 | - . $_year . '/' . $month_next . '/b' . $blog_id, |
|
| 201 | - 'title' => planet_constant('MD_MONTH_' . $month_next) |
|
| 199 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.'' |
|
| 200 | + . $_year.'/'.$month_next.'/b'.$blog_id, |
|
| 201 | + 'title' => planet_constant('MD_MONTH_'.$month_next) |
|
| 202 | 202 | ); |
| 203 | 203 | } |
| 204 | 204 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $xoopsTpl->assign('timenav', $timenav); |
| 219 | 219 | $xoopsTpl->assign('pagenav', $pagenav); |
| 220 | 220 | |
| 221 | -include_once __DIR__ . '/footer.php'; |
|
| 221 | +include_once __DIR__.'/footer.php'; |
|
| 222 | 222 | |
| 223 | 223 | /** |
| 224 | 224 | * @param null $year |
@@ -234,25 +234,25 @@ discard block |
||
| 234 | 234 | ob_start(); |
| 235 | 235 | echo '<table id="calendar">'; |
| 236 | 236 | echo '<caption>'; |
| 237 | - printf(planet_constant('MD_TIME_YM'), $year, planet_constant('MD_MONTH_' . $month)); |
|
| 237 | + printf(planet_constant('MD_TIME_YM'), $year, planet_constant('MD_MONTH_'.$month)); |
|
| 238 | 238 | echo '</caption>'; |
| 239 | 239 | |
| 240 | - for ($i = 1; $i <= 7; ++$i) { |
|
| 241 | - echo "\n\t\t<th abbr=\"" . planet_constant('MD_WEEK_' . $i) . "\" scope=\"col\" title=\"" |
|
| 242 | - . planet_constant('MD_WEEK_' . $i) . "\">" . planet_constant('MD_WEEK_' . $i) . '</th>'; |
|
| 240 | + for ($i = 1; $i<=7; ++$i) { |
|
| 241 | + echo "\n\t\t<th abbr=\"".planet_constant('MD_WEEK_'.$i)."\" scope=\"col\" title=\"" |
|
| 242 | + . planet_constant('MD_WEEK_'.$i)."\">".planet_constant('MD_WEEK_'.$i).'</th>'; |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | echo '<tr>'; |
| 246 | 246 | |
| 247 | 247 | // See how much we should pad in the beginning |
| 248 | 248 | $week_begins = 1; |
| 249 | - $pad = planet_calendar_week_mod(date('w', $unixmonth) - $week_begins); |
|
| 249 | + $pad = planet_calendar_week_mod(date('w', $unixmonth)-$week_begins); |
|
| 250 | 250 | if (0 != $pad) { |
| 251 | - echo "\n\t\t" . '<td colspan="' . $pad . '"> </td>'; |
|
| 251 | + echo "\n\t\t".'<td colspan="'.$pad.'"> </td>'; |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | - $daysinmonth = (int)date('t', $unixmonth); |
|
| 255 | - for ($day = 1; $day <= $daysinmonth; ++$day) { |
|
| 254 | + $daysinmonth = (int) date('t', $unixmonth); |
|
| 255 | + for ($day = 1; $day<=$daysinmonth; ++$day) { |
|
| 256 | 256 | if (isset($newrow) && $newrow) { |
| 257 | 257 | echo "\n\t</tr>\n\t<tr>\n\t\t"; |
| 258 | 258 | } |
@@ -261,26 +261,26 @@ discard block |
||
| 261 | 261 | echo '<td>'; |
| 262 | 262 | |
| 263 | 263 | if (!empty($days[$day]['url'])) { |
| 264 | - echo '<a href="' . $days[$day]['url'] . "\""; |
|
| 264 | + echo '<a href="'.$days[$day]['url']."\""; |
|
| 265 | 265 | if (!empty($days[$day]['title'])) { |
| 266 | - echo "title=\"" . $days[$day]['title'] . "\""; |
|
| 266 | + echo "title=\"".$days[$day]['title']."\""; |
|
| 267 | 267 | } |
| 268 | 268 | echo ">$day</a>"; |
| 269 | 269 | } elseif (!empty($days[$day]['title'])) { |
| 270 | - echo "<acronym title=\"" . $days[$day]['title'] . "\">$day</acronym>"; |
|
| 271 | - } else { |
|
| 270 | + echo "<acronym title=\"".$days[$day]['title']."\">$day</acronym>"; |
|
| 271 | + }else { |
|
| 272 | 272 | echo $day; |
| 273 | 273 | } |
| 274 | 274 | echo '</td>'; |
| 275 | 275 | |
| 276 | - if (6 == planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year)) - $week_begins)) { |
|
| 276 | + if (6 == planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year))-$week_begins)) { |
|
| 277 | 277 | $newrow = true; |
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - $pad = 7 - planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year)) - $week_begins); |
|
| 281 | + $pad = 7-planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year))-$week_begins); |
|
| 282 | 282 | if ($pad != 0 && $pad != 7) { |
| 283 | - echo "\n\t\t" . '<td class="pad" colspan="' . $pad . '"> </td>'; |
|
| 283 | + echo "\n\t\t".'<td class="pad" colspan="'.$pad.'"> </td>'; |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | echo "\n\t</tr>\n\t</tbody>\n\t</table>"; |
@@ -298,5 +298,5 @@ discard block |
||
| 298 | 298 | function planet_calendar_week_mod($num) { |
| 299 | 299 | $base = 7; |
| 300 | 300 | |
| 301 | - return ($num - $base * floor($num / $base)); |
|
| 301 | + return ($num-$base*floor($num/$base)); |
|
| 302 | 302 | } |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | // URL: http://xoops.org // |
| 25 | 25 | // Project: Article Project // |
| 26 | 26 | // ------------------------------------------------------------------------ // |
| 27 | -include __DIR__ . '/header.php'; |
|
| 27 | +include __DIR__.'/header.php'; |
|
| 28 | 28 | |
| 29 | 29 | if (preg_match("/\/notification_update\.php/i", $_SERVER['REQUEST_URI'], $matches)) { |
| 30 | - include XOOPS_ROOT_PATH . '/include/notification_update.php'; |
|
| 30 | + include XOOPS_ROOT_PATH.'/include/notification_update.php'; |
|
| 31 | 31 | exit(); |
| 32 | 32 | } |
| 33 | 33 | |
@@ -37,17 +37,17 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /* Start */ |
| 40 | -$start = (int)(empty($_GET['start']) ? @$args['start'] : $_GET['start']); |
|
| 40 | +$start = (int) (empty($_GET['start']) ? @$args['start'] : $_GET['start']); |
|
| 41 | 41 | /* Specified Category */ |
| 42 | -$category_id = (int)(empty($_GET['category']) ? @$args['category'] : $_GET['category']); |
|
| 42 | +$category_id = (int) (empty($_GET['category']) ? @$args['category'] : $_GET['category']); |
|
| 43 | 43 | /* Specified Blog */ |
| 44 | -$blog_id = (int)(empty($_GET['blog']) ? @$args['blog'] : $_GET['blog']); |
|
| 44 | +$blog_id = (int) (empty($_GET['blog']) ? @$args['blog'] : $_GET['blog']); |
|
| 45 | 45 | /* Specified Bookmar(Favorite) UID */ |
| 46 | -$uid = (int)(empty($_GET['uid']) ? @$args['uid'] : $_GET['uid']); |
|
| 46 | +$uid = (int) (empty($_GET['uid']) ? @$args['uid'] : $_GET['uid']); |
|
| 47 | 47 | /* Sort by term */ |
| 48 | 48 | $sort = empty($_GET['sort']) ? @$args['sort'] : $_GET['sort']; |
| 49 | 49 | /* Display as list */ |
| 50 | -$list = (int)(empty($_GET['list']) ? @$args['list'] : $_GET['list']); |
|
| 50 | +$list = (int) (empty($_GET['list']) ? @$args['list'] : $_GET['list']); |
|
| 51 | 51 | |
| 52 | 52 | // restore $_SERVER['REQUEST_URI'] |
| 53 | 53 | if (!empty($REQUEST_URI_parsed)) { |
@@ -55,35 +55,35 @@ discard block |
||
| 55 | 55 | $_args = array('start', 'sort', 'uid', 'list'); |
| 56 | 56 | foreach ($_args as $arg) { |
| 57 | 57 | if (!empty(${$arg})) { |
| 58 | - $args_REQUEST_URI[] = $arg . '=' . ${$arg}; |
|
| 58 | + $args_REQUEST_URI[] = $arg.'='.${$arg}; |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | if (!empty($blog_id)) { |
| 62 | - $args_REQUEST_URI[] = 'blog=' . $blog_id; |
|
| 62 | + $args_REQUEST_URI[] = 'blog='.$blog_id; |
|
| 63 | 63 | } |
| 64 | 64 | if (!empty($category_id)) { |
| 65 | - $args_REQUEST_URI[] = 'category=' . $category_id; |
|
| 65 | + $args_REQUEST_URI[] = 'category='.$category_id; |
|
| 66 | 66 | } |
| 67 | - $_SERVER['REQUEST_URI'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' |
|
| 68 | - . (empty($args_REQUEST_URI) ? '' : '?' . implode('&', $args_REQUEST_URI)); |
|
| 67 | + $_SERVER['REQUEST_URI'] = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php' |
|
| 68 | + . (empty($args_REQUEST_URI) ? '' : '?'.implode('&', $args_REQUEST_URI)); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $xoopsOption['template_main'] = planet_getTemplate('index'); |
| 72 | 72 | $xoops_module_header = ' |
| 73 | - <link rel="alternate" type="application/rss+xml" title="' . $xoopsModule->getVar('name') . ' rss" href="' |
|
| 74 | - . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php".URL_DELIMITER."rss/c' |
|
| 75 | - . $category_id . '/b' . $blog_id . '/u' . $uid . '" /> |
|
| 76 | - <link rel="alternate" type="application/rss+xml" title="' . $xoopsModule->getVar('name') . ' rdf" href="' |
|
| 77 | - . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php".URL_DELIMITER."rdf/c' |
|
| 78 | - . $category_id . '/b' . $blog_id . '/u' . $uid . '" /> |
|
| 79 | - <link rel="alternate" type="application/atom+xml" title="' . $xoopsModule->getVar('name') . ' atom" href="' |
|
| 80 | - . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php".URL_DELIMITER."atom/c' |
|
| 81 | - . $category_id . '/b' . $blog_id . '/u' . $uid . '" /> |
|
| 73 | + <link rel="alternate" type="application/rss+xml" title="' . $xoopsModule->getVar('name').' rss" href="' |
|
| 74 | + . XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/xml.php".URL_DELIMITER."rss/c' |
|
| 75 | + . $category_id.'/b'.$blog_id.'/u'.$uid.'" /> |
|
| 76 | + <link rel="alternate" type="application/rss+xml" title="' . $xoopsModule->getVar('name').' rdf" href="' |
|
| 77 | + . XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/xml.php".URL_DELIMITER."rdf/c' |
|
| 78 | + . $category_id.'/b'.$blog_id.'/u'.$uid.'" /> |
|
| 79 | + <link rel="alternate" type="application/atom+xml" title="' . $xoopsModule->getVar('name').' atom" href="' |
|
| 80 | + . XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/xml.php".URL_DELIMITER."atom/c' |
|
| 81 | + . $category_id.'/b'.$blog_id.'/u'.$uid.'" /> |
|
| 82 | 82 | '; |
| 83 | 83 | |
| 84 | 84 | $xoopsOption['xoops_module_header'] = $xoops_module_header; |
| 85 | -include_once XOOPS_ROOT_PATH . '/header.php'; |
|
| 86 | -include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
| 85 | +include_once XOOPS_ROOT_PATH.'/header.php'; |
|
| 86 | +include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'; |
|
| 87 | 87 | |
| 88 | 88 | // Following part will not be executed after cache |
| 89 | 89 | $category_handler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $criteria = new CriteriaCompo(); |
| 96 | 96 | $article_prefix = ''; |
| 97 | 97 | /* Specific category */ |
| 98 | -if ($category_id > 0) { |
|
| 98 | +if ($category_id>0) { |
|
| 99 | 99 | $category_obj = $category_handler->get($category_id); |
| 100 | 100 | $criteria->add(new Criteria('bc.cat_id', $category_id)); |
| 101 | 101 | $uid = 0; |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | $article_prefix = 'a.'; |
| 106 | 106 | } |
| 107 | 107 | /* Specific blog */ |
| 108 | -if ($blog_id > 0) { |
|
| 109 | - $blog_obj =& $blog_handler->get($blog_id); |
|
| 108 | +if ($blog_id>0) { |
|
| 109 | + $blog_obj = & $blog_handler->get($blog_id); |
|
| 110 | 110 | if ($blog_obj->getVar('blog_status') |
| 111 | 111 | || (is_object($xoopsUser) |
| 112 | 112 | && $xoopsUser->getVar('uid') == $blog_obj->getVar('blog_submitter')) |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $article_prefix = ''; |
| 134 | 134 | } |
| 135 | 135 | /* User bookmarks(favorites) */ |
| 136 | -if ($uid > 0) { |
|
| 136 | +if ($uid>0) { |
|
| 137 | 137 | $criteria->add(new Criteria('bm.bm_uid', $uid)); |
| 138 | 138 | $category_id = 0; |
| 139 | 139 | $blog_id = 0; |
@@ -152,13 +152,13 @@ discard block |
||
| 152 | 152 | $sort = empty($sort) ? 'time' : $sort; |
| 153 | 153 | switch ($sort) { |
| 154 | 154 | case 'views': |
| 155 | - $sortby = $article_prefix . 'art_views'; |
|
| 155 | + $sortby = $article_prefix.'art_views'; |
|
| 156 | 156 | break; |
| 157 | 157 | case 'rating': |
| 158 | - $sortby = $article_prefix . 'art_rating'; |
|
| 158 | + $sortby = $article_prefix.'art_rating'; |
|
| 159 | 159 | break; |
| 160 | 160 | case 'time': |
| 161 | - $sortby = $article_prefix . 'art_time'; |
|
| 161 | + $sortby = $article_prefix.'art_time'; |
|
| 162 | 162 | break; |
| 163 | 163 | case 'default': |
| 164 | 164 | default: |
@@ -171,33 +171,33 @@ discard block |
||
| 171 | 171 | $criteria->setLimit($limit); |
| 172 | 172 | |
| 173 | 173 | $tags = empty($list) ? '' : array( |
| 174 | - $article_prefix . 'art_title', |
|
| 175 | - $article_prefix . 'blog_id', |
|
| 176 | - $article_prefix . 'art_time' |
|
| 174 | + $article_prefix.'art_title', |
|
| 175 | + $article_prefix.'blog_id', |
|
| 176 | + $article_prefix.'art_time' |
|
| 177 | 177 | ); |
| 178 | 178 | switch ($query_type) { |
| 179 | 179 | case 'category': |
| 180 | - $articles_obj =& $article_handler->getByCategory($criteria, $tags); |
|
| 180 | + $articles_obj = & $article_handler->getByCategory($criteria, $tags); |
|
| 181 | 181 | $count_article = $article_handler->getCountByCategory($criteria); |
| 182 | 182 | break; |
| 183 | 183 | case 'bookmark': |
| 184 | - $articles_obj =& $article_handler->getByBookmark($criteria, $tags); |
|
| 184 | + $articles_obj = & $article_handler->getByBookmark($criteria, $tags); |
|
| 185 | 185 | $count_article = $article_handler->getCountByBookmark($criteria); |
| 186 | 186 | break; |
| 187 | 187 | default: |
| 188 | - $articles_obj =& $article_handler->getAll($criteria, $tags); |
|
| 188 | + $articles_obj = & $article_handler->getAll($criteria, $tags); |
|
| 189 | 189 | $count_article = $article_handler->getCount($criteria); |
| 190 | 190 | break; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | if (!empty($blog_data)) { |
| 194 | 194 | $blogs[$blog_data['id']] = $blog_data['title']; |
| 195 | -} else { |
|
| 195 | +}else { |
|
| 196 | 196 | $blog_array = array(); |
| 197 | 197 | foreach (array_keys($articles_obj) as $id) { |
| 198 | 198 | $blog_array[$articles_obj[$id]->getVar('blog_id')] = 1; |
| 199 | 199 | } |
| 200 | - $criteria_blog = new Criteria('blog_id', '(' . implode(',', array_keys($blog_array)) . ')', 'IN'); |
|
| 200 | + $criteria_blog = new Criteria('blog_id', '('.implode(',', array_keys($blog_array)).')', 'IN'); |
|
| 201 | 201 | $blogs = $blog_handler->getList($criteria_blog); |
| 202 | 202 | } |
| 203 | 203 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | )); |
| 224 | 224 | if (!empty($xoopsModuleConfig['display_summary'])) { |
| 225 | 225 | $_article['content'] = $articles_obj[$id]->getSummary(); |
| 226 | - } else { |
|
| 226 | + }else { |
|
| 227 | 227 | $_article['content'] = $articles_obj[$id]->getVar('art_content'); |
| 228 | 228 | } |
| 229 | 229 | } |
@@ -232,24 +232,24 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | unset($articles_obj); |
| 234 | 234 | |
| 235 | -if ($count_article > $limit) { |
|
| 236 | - include XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
| 235 | +if ($count_article>$limit) { |
|
| 236 | + include XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
| 237 | 237 | $start_link = array(); |
| 238 | 238 | if ($sort) { |
| 239 | - $start_link[] = 'sort=' . $sort; |
|
| 239 | + $start_link[] = 'sort='.$sort; |
|
| 240 | 240 | } |
| 241 | 241 | if ($category_id) { |
| 242 | - $start_link[] = 'category=' . $category_id; |
|
| 242 | + $start_link[] = 'category='.$category_id; |
|
| 243 | 243 | } |
| 244 | 244 | if ($blog_id) { |
| 245 | - $start_link[] = 'blog=' . $blog_id; |
|
| 245 | + $start_link[] = 'blog='.$blog_id; |
|
| 246 | 246 | } |
| 247 | 247 | if ($list) { |
| 248 | - $start_link[] = 'list=' . $list; |
|
| 248 | + $start_link[] = 'list='.$list; |
|
| 249 | 249 | } |
| 250 | 250 | $nav = new XoopsPageNav($count_article, $limit, $start, 'start', implode('&', $start_link)); |
| 251 | 251 | $pagenav = $nav->renderNav(4); |
| 252 | -} else { |
|
| 252 | +}else { |
|
| 253 | 253 | $pagenav = ''; |
| 254 | 254 | } |
| 255 | 255 | |
@@ -258,36 +258,36 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | if ($category_id || $blog_id || $uid) { |
| 260 | 260 | $xoopsTpl->assign('link_index', |
| 261 | - "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/index.php\" title=\"" |
|
| 262 | - . planet_constant('MD_INDEX') . "\" target=\"_self\">" . planet_constant('MD_INDEX') . '</a>'); |
|
| 261 | + "<a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname']."/index.php\" title=\"" |
|
| 262 | + . planet_constant('MD_INDEX')."\" target=\"_self\">".planet_constant('MD_INDEX').'</a>'); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | -$link_switch = "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' |
|
| 266 | - . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) |
|
| 267 | - . (empty($blog_id) ? '' : '/b' . $blog_id) . (empty($list) ? '/l1' : '') . "\" title=\"" |
|
| 268 | - . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW')) . "\">" |
|
| 269 | - . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW')) . '</a>'; |
|
| 265 | +$link_switch = "<a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php' |
|
| 266 | + . (empty($category_id) ? '' : '/c'.$category_id).(empty($uid) ? '' : '/u'.$uid) |
|
| 267 | + . (empty($blog_id) ? '' : '/b'.$blog_id).(empty($list) ? '/l1' : '')."\" title=\"" |
|
| 268 | + . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))."\">" |
|
| 269 | + . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW')).'</a>'; |
|
| 270 | 270 | $xoopsTpl->assign('link_switch', $link_switch); |
| 271 | 271 | |
| 272 | -$link_blogs = "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' |
|
| 273 | - . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) . "\" title=\"" |
|
| 274 | - . planet_constant('MD_BLOGS') . "\">" . planet_constant('MD_BLOGS') . '</a>'; |
|
| 272 | +$link_blogs = "<a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.blogs.php' |
|
| 273 | + . (empty($category_id) ? '' : '/c'.$category_id).(empty($uid) ? '' : '/u'.$uid)."\" title=\"" |
|
| 274 | + . planet_constant('MD_BLOGS')."\">".planet_constant('MD_BLOGS').'</a>'; |
|
| 275 | 275 | $xoopsTpl->assign('link_blogs', $link_blogs); |
| 276 | 276 | |
| 277 | 277 | if (empty($uid) && is_object($xoopsUser)) { |
| 278 | 278 | $xoopsTpl->assign('link_bookmark', |
| 279 | - "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER |
|
| 280 | - . 'u' . $xoopsUser->getVar('uid') . "\" title=\"" . planet_constant('MD_BOOKMARKS') |
|
| 281 | - . "\" target=\"_self\">" . planet_constant('MD_BOOKMARKS') . '</a>'); |
|
| 279 | + "<a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER |
|
| 280 | + . 'u'.$xoopsUser->getVar('uid')."\" title=\"".planet_constant('MD_BOOKMARKS') |
|
| 281 | + . "\" target=\"_self\">".planet_constant('MD_BOOKMARKS').'</a>'); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | if ($xoopsModuleConfig['newblog_submit'] == 1 || is_object($xoopsUser)) { |
| 285 | 285 | $xoopsTpl->assign('link_submit', |
| 286 | - "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/action.blog.php\" title=\"" |
|
| 287 | - . _SUBMIT . "\" target=\"_blank\">" . _SUBMIT . '</a>'); |
|
| 286 | + "<a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname']."/action.blog.php\" title=\"" |
|
| 287 | + . _SUBMIT."\" target=\"_blank\">"._SUBMIT.'</a>'); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | -$xoopsTpl->assign('pagetitle', $xoopsModule->getVar('name') . '::' . planet_constant('MD_ARTICLES')); |
|
| 290 | +$xoopsTpl->assign('pagetitle', $xoopsModule->getVar('name').'::'.planet_constant('MD_ARTICLES')); |
|
| 291 | 291 | $xoopsTpl->assign('category', @$category_data); |
| 292 | 292 | $xoopsTpl->assign('blog', @$blog_data); |
| 293 | 293 | $xoopsTpl->assign('user', @$user_data); |
@@ -297,13 +297,13 @@ discard block |
||
| 297 | 297 | |
| 298 | 298 | $xoopsTpl->assign('user_level', !is_object($xoopsUser) ? 0 : ($xoopsUser->isAdmin() ? 2 : 1)); |
| 299 | 299 | if (empty($xoopsModuleConfig['anonymous_rate']) && !is_object($xoopsUser)) { |
| 300 | -} elseif ($blog_id > 0) { |
|
| 300 | +} elseif ($blog_id>0) { |
|
| 301 | 301 | $xoopsTpl->assign('canrate', 1); |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | -$sort_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . (empty($category_id) ? '' : '/c' |
|
| 304 | +$sort_link = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.(empty($category_id) ? '' : '/c' |
|
| 305 | 305 | . $category_id) |
| 306 | - . (empty($uid) ? '' : '/u' . $uid) . (empty($blog_id) ? '' : '/b' . $blog_id) |
|
| 306 | + . (empty($uid) ? '' : '/u'.$uid).(empty($blog_id) ? '' : '/b'.$blog_id) |
|
| 307 | 307 | . (empty($list) ? '' : '/l1'); |
| 308 | 308 | $valid_sorts = array( |
| 309 | 309 | 'views' => planet_constant('MD_VIEWS'), |
@@ -311,12 +311,12 @@ discard block |
||
| 311 | 311 | 'time' => planet_constant('MD_TIME'), |
| 312 | 312 | 'default' => planet_constant('MD_DEFAULT') |
| 313 | 313 | ); |
| 314 | -$sortlinks = array(); |
|
| 314 | +$sortlinks = array(); |
|
| 315 | 315 | foreach ($valid_sorts as $val => $name) { |
| 316 | 316 | if ($val == $sort) { |
| 317 | 317 | continue; |
| 318 | 318 | } |
| 319 | - $sortlinks[] = "<a href=\"" . $sort_link . '/' . $val . "\">" . $name . '</a>'; |
|
| 319 | + $sortlinks[] = "<a href=\"".$sort_link.'/'.$val."\">".$name.'</a>'; |
|
| 320 | 320 | } |
| 321 | 321 | $xoopsTpl->assign('link_sort', implode(' | ', $sortlinks)); |
| 322 | 322 | $xoopsTpl->assign('version', $xoopsModule->getVar('version')); |
@@ -329,4 +329,4 @@ discard block |
||
| 329 | 329 | $_GET['blog'] = $blog_id; |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | -include_once __DIR__ . '/footer.php'; |
|
| 332 | +include_once __DIR__.'/footer.php'; |
|
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | // Project: Article Project // |
| 26 | 26 | // ------------------------------------------------------------------------ // |
| 27 | 27 | |
| 28 | -include __DIR__ . '/header.php'; |
|
| 28 | +include __DIR__.'/header.php'; |
|
| 29 | 29 | |
| 30 | 30 | $op = !empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : ''); |
| 31 | 31 | $blog_id = !empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0); |
| 32 | -$blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int)$blog_id; |
|
| 32 | +$blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int) $blog_id; |
|
| 33 | 33 | |
| 34 | 34 | if (empty($xoopsModuleConfig['newblog_submit']) && (!is_object($xoopsUser) || !$xoopsUser->isAdmin())) { |
| 35 | 35 | redirect_header('index.php', 2, _NOPERM); |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | if ($op === 'save' && !$GLOBALS['xoopsSecurity']->check()) { |
| 43 | - redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID') . ': security check failed'); |
|
| 43 | + redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID').': security check failed'); |
|
| 44 | 44 | } |
| 45 | -include XOOPS_ROOT_PATH . '/header.php'; |
|
| 46 | -include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
| 45 | +include XOOPS_ROOT_PATH.'/header.php'; |
|
| 46 | +include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'; |
|
| 47 | 47 | |
| 48 | 48 | $blog_handler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
| 49 | 49 | $category_handler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
@@ -53,25 +53,25 @@ discard block |
||
| 53 | 53 | case 'save': |
| 54 | 54 | |
| 55 | 55 | if ($blog_id) { |
| 56 | - $blog_obj =& $blog_handler->get($blog_id); |
|
| 56 | + $blog_obj = & $blog_handler->get($blog_id); |
|
| 57 | 57 | if ($xoopsUser->isAdmin()) { |
| 58 | 58 | $blog_obj->setVar('blog_status', @$_POST['blog_status']); |
| 59 | 59 | } |
| 60 | - } else { |
|
| 60 | + }else { |
|
| 61 | 61 | if ($blog_exists = $blog_handler->getCount(new Criteria('blog_feed', |
| 62 | 62 | $myts->addSlashes(trim($_POST['blog_feed'])))) |
| 63 | 63 | ) { |
| 64 | 64 | redirect_header('index.php', 2, planet_constant('MD_BLOGEXISTS')); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $blog_obj =& $blog_handler->create(); |
|
| 67 | + $blog_obj = & $blog_handler->create(); |
|
| 68 | 68 | $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : planet_getIP(true)); |
| 69 | 69 | |
| 70 | 70 | switch ($xoopsModuleConfig['newblog_submit']) { |
| 71 | 71 | case 2: |
| 72 | 72 | if (!is_object($xoopsUser)) { |
| 73 | 73 | $status = 0; |
| 74 | - } else { |
|
| 74 | + }else { |
|
| 75 | 75 | $status = 1; |
| 76 | 76 | } |
| 77 | 77 | break; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | default: |
| 84 | 84 | if (!is_object($xoopsUser) || !$xoopsUser->isAdmin()) { |
| 85 | 85 | $status = 0; |
| 86 | - } else { |
|
| 86 | + }else { |
|
| 87 | 87 | $status = 1; |
| 88 | 88 | } |
| 89 | 89 | break; |
@@ -113,22 +113,22 @@ discard block |
||
| 113 | 113 | $blog_handler->setCategories($blog_id, $_POST['categories']); |
| 114 | 114 | } |
| 115 | 115 | $message = planet_constant('MD_DBUPDATED'); |
| 116 | - redirect_header('index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); |
|
| 116 | + redirect_header('index.php'.URL_DELIMITER.'b'.$blog_id, 2, $message); |
|
| 117 | 117 | |
| 118 | 118 | /* edit a single blog */ |
| 119 | 119 | case 'edit': |
| 120 | 120 | default: |
| 121 | 121 | if (!empty($_POST['fetch'])) { |
| 122 | - $blog_obj =& $blog_handler->fetch($_POST['blog_feed']); |
|
| 122 | + $blog_obj = & $blog_handler->fetch($_POST['blog_feed']); |
|
| 123 | 123 | $blog_obj->setVar('blog_id', $blog_id); |
| 124 | - } else { |
|
| 125 | - $blog_obj =& $blog_handler->get($blog_id); |
|
| 124 | + }else { |
|
| 125 | + $blog_obj = & $blog_handler->get($blog_id); |
|
| 126 | 126 | } |
| 127 | 127 | $categories = isset($_POST['categories']) ? $_POST['categories'] : array(); |
| 128 | 128 | if (in_array('-1', $categories)) { |
| 129 | 129 | $categories = array(); |
| 130 | 130 | } |
| 131 | - if (empty($categories) && $blog_id > 0) { |
|
| 131 | + if (empty($categories) && $blog_id>0) { |
|
| 132 | 132 | $crit = new Criteria('bc.blog_id', $blog_id); |
| 133 | 133 | $categories = array_keys($category_handler->getByBlog($crit)); |
| 134 | 134 | } |
@@ -136,24 +136,24 @@ discard block |
||
| 136 | 136 | $categories = array(0 => _NONE); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; |
|
| 139 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._EDIT.'</legend>'; |
|
| 140 | 140 | echo '<br>'; |
| 141 | 141 | if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { |
| 142 | 142 | $criteria = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); |
| 143 | - $blogs_obj =& $blog_handler->getList($criteria); |
|
| 144 | - if (count($blogs_obj) > 0) { |
|
| 145 | - echo "<div class=\"errorMsg\">" . planet_constant('MD_BLOGEXISTS'); |
|
| 143 | + $blogs_obj = & $blog_handler->getList($criteria); |
|
| 144 | + if (count($blogs_obj)>0) { |
|
| 145 | + echo "<div class=\"errorMsg\">".planet_constant('MD_BLOGEXISTS'); |
|
| 146 | 146 | foreach (array_keys($blogs_obj) as $bid) { |
| 147 | - echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' |
|
| 148 | - . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>'; |
|
| 147 | + echo "<br><a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php' |
|
| 148 | + . URL_DELIMITER.'b'.$bid."\" target=\"_blank\">".$blogs_obj[$bid].'</a>'; |
|
| 149 | 149 | } |
| 150 | 150 | echo '</div>'; |
| 151 | 151 | unset($blogs_obj, $criteria); |
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | - include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; |
|
| 154 | + include XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/form.blog.php'; |
|
| 155 | 155 | echo '</fieldset>'; |
| 156 | 156 | break; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | -include XOOPS_ROOT_PATH . '/footer.php'; |
|
| 159 | +include XOOPS_ROOT_PATH.'/footer.php'; |
|
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | // Project: Article Project // |
| 26 | 26 | // ------------------------------------------------------------------------ // |
| 27 | 27 | |
| 28 | -include __DIR__ . '/header.php'; |
|
| 28 | +include __DIR__.'/header.php'; |
|
| 29 | 29 | |
| 30 | 30 | // trackback is done by a POST |
| 31 | 31 | $art_id = explode('/', $_SERVER['REQUEST_URI']); |
| 32 | -$article_id = (int)$art_id[count($art_id) - 1]; |
|
| 32 | +$article_id = (int) $art_id[count($art_id)-1]; |
|
| 33 | 33 | $url = $_POST['url']; |
| 34 | 34 | $title = $_POST['title']; |
| 35 | 35 | $excerpt = $_POST['excerpt']; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | if (empty($xoopsModuleConfig['trackback_option'])) { |
| 40 | 40 | planet_trackback_response(1, 'Trackback is closed'); |
| 41 | 41 | } |
| 42 | -if (!strlen($title . $url . $blog_name)) { |
|
| 42 | +if (!strlen($title.$url.$blog_name)) { |
|
| 43 | 43 | planet_trackback_response(1, planet_constant('MD_INVALID')); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $trackback_handler = xoops_getModuleHandler('trackback', $GLOBALS['moddirname']); |
| 48 | 48 | $criteria = new CriteriaCompo(new Criteria('art_id', $article_id)); |
| 49 | 49 | $criteria->add(new Criteria('tb_url', $url)); |
| 50 | - if ($trackback_handler->getCount($criteria) > 0) { |
|
| 50 | + if ($trackback_handler->getCount($criteria)>0) { |
|
| 51 | 51 | planet_trackback_response(1, 'We already have a ping from that URI for this article.'); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -55,17 +55,17 @@ discard block |
||
| 55 | 55 | $title = XoopsLocal::convert_encoding($title, _CHARSET, $charset); |
| 56 | 56 | $excerpt = XoopsLocal::convert_encoding($excerpt, _CHARSET, $charset); |
| 57 | 57 | $blog_name = XoopsLocal::convert_encoding($blog_name, _CHARSET, $charset); |
| 58 | - $tb_status = (int)$xoopsModuleConfig['trackback_option']; |
|
| 58 | + $tb_status = (int) $xoopsModuleConfig['trackback_option']; |
|
| 59 | 59 | |
| 60 | 60 | $com_pid = 0; |
| 61 | 61 | $com_itemid = $article_id; |
| 62 | 62 | $com_rootid = 0; |
| 63 | 63 | $com_title = $title; |
| 64 | 64 | $com_text = $excerpt; |
| 65 | - $com_text .= "\n\n[TRACKBACK]" . _POSTEDBY . ': '; |
|
| 65 | + $com_text .= "\n\n[TRACKBACK]"._POSTEDBY.': '; |
|
| 66 | 66 | if (!empty($url)) { |
| 67 | - $com_text .= '[url=' . $url . ']' . $blog_name . '[/url]'; |
|
| 68 | - } else { |
|
| 67 | + $com_text .= '[url='.$url.']'.$blog_name.'[/url]'; |
|
| 68 | + }else { |
|
| 69 | 69 | $com_text .= $blog_name; |
| 70 | 70 | } |
| 71 | 71 | $com_modid = $xoopsModule->getVar('mid'); |
@@ -122,14 +122,14 @@ discard block |
||
| 122 | 122 | if (isset($comment_config['callbackFile'])) { |
| 123 | 123 | $callbackfile = trim($comment_config['callbackFile']); |
| 124 | 124 | if ($callbackfile != '' |
| 125 | - && file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile) |
|
| 125 | + && file_exists(XOOPS_ROOT_PATH.'/modules/'.$moddir.'/'.$callbackfile) |
|
| 126 | 126 | ) { |
| 127 | - include_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile; |
|
| 127 | + include_once XOOPS_ROOT_PATH.'/modules/'.$moddir.'/'.$callbackfile; |
|
| 128 | 128 | } |
| 129 | 129 | if (!function_exists($comment_config['callback']['approve'])) { |
| 130 | 130 | $skip = true; |
| 131 | 131 | } |
| 132 | - } else { |
|
| 132 | + }else { |
|
| 133 | 133 | $skip = true; |
| 134 | 134 | } |
| 135 | 135 | } |
@@ -147,14 +147,14 @@ discard block |
||
| 147 | 147 | if (isset($comment_config['callbackFile'])) { |
| 148 | 148 | $callbackfile = trim($comment_config['callbackFile']); |
| 149 | 149 | if ($callbackfile != '' |
| 150 | - && file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile) |
|
| 150 | + && file_exists(XOOPS_ROOT_PATH.'/modules/'.$moddir.'/'.$callbackfile) |
|
| 151 | 151 | ) { |
| 152 | - include_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile; |
|
| 152 | + include_once XOOPS_ROOT_PATH.'/modules/'.$moddir.'/'.$callbackfile; |
|
| 153 | 153 | } |
| 154 | 154 | if (!function_exists($comment_config['callback']['update'])) { |
| 155 | 155 | $skip = true; |
| 156 | 156 | } |
| 157 | - } else { |
|
| 157 | + }else { |
|
| 158 | 158 | $skip = true; |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -172,8 +172,8 @@ discard block |
||
| 172 | 172 | // trigger notification event if necessary |
| 173 | 173 | if ($notify_event) { |
| 174 | 174 | $not_modid = $com_modid; |
| 175 | - include_once XOOPS_ROOT_PATH . '/include/notification_functions.php'; |
|
| 176 | - $not_catinfo =& notificationCommentCategoryInfo($not_modid); |
|
| 175 | + include_once XOOPS_ROOT_PATH.'/include/notification_functions.php'; |
|
| 176 | + $not_catinfo = & notificationCommentCategoryInfo($not_modid); |
|
| 177 | 177 | $not_category = $not_catinfo['name']; |
| 178 | 178 | $not_itemid = $com_itemid; |
| 179 | 179 | $not_event = $notify_event; |
@@ -181,23 +181,23 @@ discard block |
||
| 181 | 181 | // point to a viewable page (i.e. not the system administration |
| 182 | 182 | // module). |
| 183 | 183 | $comment_tags = array(); |
| 184 | - $not_module =& $xoopsModule; |
|
| 184 | + $not_module = & $xoopsModule; |
|
| 185 | 185 | if (!isset($comment_url)) { |
| 186 | - $com_config =& $not_module->getInfo('comments'); |
|
| 187 | - $comment_url = $com_config['pageName'] . '?'; |
|
| 186 | + $com_config = & $not_module->getInfo('comments'); |
|
| 187 | + $comment_url = $com_config['pageName'].'?'; |
|
| 188 | 188 | $comment_url .= $com_config['itemName']; |
| 189 | 189 | } |
| 190 | - $comment_tags['X_COMMENT_URL'] = XOOPS_URL . '/modules/' . $not_module->getVar('dirname') . '/' |
|
| 191 | - . $comment_url . '=' . $com_itemid . '&com_id=' . $newcid |
|
| 192 | - . '&com_rootid=' . $com_rootid . '&com_mode=' . $com_mode |
|
| 193 | - . '&com_order=' . $com_order . '#comment' . $newcid; |
|
| 194 | - $notification_handler = xoops_getHandler('notification'); |
|
| 190 | + $comment_tags['X_COMMENT_URL'] = XOOPS_URL.'/modules/'.$not_module->getVar('dirname').'/' |
|
| 191 | + . $comment_url.'='.$com_itemid.'&com_id='.$newcid |
|
| 192 | + . '&com_rootid='.$com_rootid.'&com_mode='.$com_mode |
|
| 193 | + . '&com_order='.$com_order.'#comment'.$newcid; |
|
| 194 | + $notification_handler = xoops_getHandler('notification'); |
|
| 195 | 195 | $notification_handler->triggerEvent($not_category, $not_itemid, $not_event, $comment_tags, false, |
| 196 | 196 | $not_modid); |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | planet_trackback_response(0); |
| 200 | - } else { |
|
| 200 | + }else { |
|
| 201 | 201 | planet_trackback_response(1, xoops_error($comment->getHtmlErrors())); |
| 202 | 202 | } |
| 203 | 203 | } |