@@ -16,7 +16,7 @@ |
||
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | function get_js() { |
| 19 | - return file_get_contents(__DIR__ . "/init.js"); |
|
| 19 | + return file_get_contents(__DIR__."/init.js"); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | function hook_main_toolbar_button() { |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | function get_js() { |
| 20 | - return file_get_contents(dirname(__FILE__) . "/note.js"); |
|
| 20 | + return file_get_contents(dirname(__FILE__)."/note.js"); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | |
| 20 | 20 | $doc = new DOMDocument(); |
| 21 | 21 | |
| 22 | - @$doc->loadHTML('<?xml encoding="UTF-8">' . $article["content"]); |
|
| 22 | + @$doc->loadHTML('<?xml encoding="UTF-8">'.$article["content"]); |
|
| 23 | 23 | |
| 24 | 24 | if ($doc) { |
| 25 | 25 | $xpath = new DOMXPath($doc); |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | private function legacy_connect() { |
| 21 | 21 | |
| 22 | - user_error("Legacy connect requested to " . DB_TYPE, E_USER_NOTICE); |
|
| 22 | + user_error("Legacy connect requested to ".DB_TYPE, E_USER_NOTICE); |
|
| 23 | 23 | |
| 24 | 24 | $er = error_reporting(E_ALL); |
| 25 | 25 | |
@@ -31,18 +31,18 @@ discard block |
||
| 31 | 31 | $this->adapter = new Db_Pgsql(); |
| 32 | 32 | break; |
| 33 | 33 | default: |
| 34 | - die("Unknown DB_TYPE: " . DB_TYPE); |
|
| 34 | + die("Unknown DB_TYPE: ".DB_TYPE); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | if (!$this->adapter) { |
| 38 | - print("Error initializing database adapter for " . DB_TYPE); |
|
| 38 | + print("Error initializing database adapter for ".DB_TYPE); |
|
| 39 | 39 | exit(100); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $this->link = $this->adapter->connect(DB_HOST, DB_USER, DB_PASS, DB_NAME, defined('DB_PORT') ? DB_PORT : ""); |
| 43 | 43 | |
| 44 | 44 | if (!$this->link) { |
| 45 | - print("Error connecting through adapter: " . $this->adapter->last_error()); |
|
| 45 | + print("Error connecting through adapter: ".$this->adapter->last_error()); |
|
| 46 | 46 | exit(101); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -53,15 +53,15 @@ discard block |
||
| 53 | 53 | // normal usage is Db::pdo()->prepare(...) etc |
| 54 | 54 | public function pdo_connect() { |
| 55 | 55 | |
| 56 | - $db_port = defined('DB_PORT') && DB_PORT ? ';port=' . DB_PORT : ''; |
|
| 57 | - $db_host = defined('DB_HOST') && DB_HOST ? ';host=' . DB_HOST : ''; |
|
| 56 | + $db_port = defined('DB_PORT') && DB_PORT ? ';port='.DB_PORT : ''; |
|
| 57 | + $db_host = defined('DB_HOST') && DB_HOST ? ';host='.DB_HOST : ''; |
|
| 58 | 58 | |
| 59 | 59 | try { |
| 60 | - $pdo = new PDO(DB_TYPE . ':dbname=' . DB_NAME . $db_host . $db_port, |
|
| 60 | + $pdo = new PDO(DB_TYPE.':dbname='.DB_NAME.$db_host.$db_port, |
|
| 61 | 61 | DB_USER, |
| 62 | 62 | DB_PASS); |
| 63 | 63 | } catch (Exception $e) { |
| 64 | - print "<pre>Exception while creating PDO object:" . $e->getMessage() . "</pre>"; |
|
| 64 | + print "<pre>Exception while creating PDO object:".$e->getMessage()."</pre>"; |
|
| 65 | 65 | exit(101); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $pdo->query("SET time_zone = '+0:0'"); |
| 79 | 79 | |
| 80 | 80 | if (defined('MYSQL_CHARSET') && MYSQL_CHARSET) { |
| 81 | - $pdo->query("SET NAMES " . MYSQL_CHARSET); |
|
| 81 | + $pdo->query("SET NAMES ".MYSQL_CHARSET); |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | private $dir; |
| 4 | 4 | |
| 5 | 5 | public function __construct($dir) { |
| 6 | - $this->dir = CACHE_DIR . "/" . clean_filename($dir); |
|
| 6 | + $this->dir = CACHE_DIR."/".clean_filename($dir); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | public function getDir() { |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | public function getFullPath($filename) { |
| 42 | 42 | $filename = clean_filename($filename); |
| 43 | 43 | |
| 44 | - return $this->dir . "/" . $filename; |
|
| 44 | + return $this->dir."/".$filename; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public function put($filename, $data) { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public function getUrl($filename) { |
| 76 | - return get_self_url_prefix() . "/public.php?op=cached_url&file=" . basename($this->dir) . "/" . $filename; |
|
| 76 | + return get_self_url_prefix()."/public.php?op=cached_url&file=".basename($this->dir)."/".$filename; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | // check for locally cached (media) URLs and rewrite to local versions |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | if (!$res) return ''; |
| 86 | 86 | |
| 87 | 87 | $doc = new DOMDocument(); |
| 88 | - if ($doc->loadHTML('<?xml encoding="UTF-8">' . $res)) { |
|
| 88 | + if ($doc->loadHTML('<?xml encoding="UTF-8">'.$res)) { |
|
| 89 | 89 | $xpath = new DOMXPath($doc); |
| 90 | 90 | $cache = new DiskCache("images"); |
| 91 | 91 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | static function expire() { |
| 129 | - $dirs = array_filter(glob(CACHE_DIR . "/*"), "is_dir"); |
|
| 129 | + $dirs = array_filter(glob(CACHE_DIR."/*"), "is_dir"); |
|
| 130 | 130 | |
| 131 | 131 | foreach ($dirs as $cache_dir) { |
| 132 | 132 | $num_deleted = 0; |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | if ($files) { |
| 138 | 138 | foreach ($files as $file) { |
| 139 | - if (time() - filemtime($file) > 86400*CACHE_MAX_DAYS) { |
|
| 139 | + if (time() - filemtime($file) > 86400 * CACHE_MAX_DAYS) { |
|
| 140 | 140 | unlink($file); |
| 141 | 141 | |
| 142 | 142 | ++$num_deleted; |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | return 0; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - $headers = [ "From: $from_combined", "Content-Type: text/plain; charset=UTF-8" ]; |
|
| 41 | + $headers = ["From: $from_combined", "Content-Type: text/plain; charset=UTF-8"]; |
|
| 42 | 42 | |
| 43 | 43 | return mail($to_combined, $subject, $message, implode("\r\n", array_merge($headers, $additional_headers))); |
| 44 | 44 | } |
@@ -194,12 +194,12 @@ discard block |
||
| 194 | 194 | !is_dir(__DIR__."/../plugins.local/$class_file")) continue; |
| 195 | 195 | |
| 196 | 196 | // try system plugin directory first |
| 197 | - $file = __DIR__ . "/../plugins/$class_file/init.php"; |
|
| 198 | - $vendor_dir = __DIR__ . "/../plugins/$class_file/vendor"; |
|
| 197 | + $file = __DIR__."/../plugins/$class_file/init.php"; |
|
| 198 | + $vendor_dir = __DIR__."/../plugins/$class_file/vendor"; |
|
| 199 | 199 | |
| 200 | 200 | if (!file_exists($file)) { |
| 201 | - $file = __DIR__ . "/../plugins.local/$class_file/init.php"; |
|
| 202 | - $vendor_dir = __DIR__ . "/../plugins.local/$class_file/vendor"; |
|
| 201 | + $file = __DIR__."/../plugins.local/$class_file/init.php"; |
|
| 202 | + $vendor_dir = __DIR__."/../plugins.local/$class_file/vendor"; |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | if (!isset($this->plugins[$class])) { |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | list ($namespace, $class_name) = explode('\\', $class, 2); |
| 218 | 218 | |
| 219 | 219 | if ($namespace && $class_name) { |
| 220 | - $class_file = "$vendor_dir/$namespace/" . str_replace('\\', '/', $class_name) . ".php"; |
|
| 220 | + $class_file = "$vendor_dir/$namespace/".str_replace('\\', '/', $class_name).".php"; |
|
| 221 | 221 | |
| 222 | 222 | if (file_exists($class_file)) |
| 223 | 223 | require_once $class_file; |
@@ -231,12 +231,12 @@ discard block |
||
| 231 | 231 | $plugin_api = $plugin->api_version(); |
| 232 | 232 | |
| 233 | 233 | if ($plugin_api < PluginHost::API_VERSION) { |
| 234 | - user_error("Plugin $class is not compatible with current API version (need: " . PluginHost::API_VERSION . ", got: $plugin_api)", E_USER_WARNING); |
|
| 234 | + user_error("Plugin $class is not compatible with current API version (need: ".PluginHost::API_VERSION.", got: $plugin_api)", E_USER_WARNING); |
|
| 235 | 235 | continue; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - if (file_exists(dirname($file) . "/locale")) { |
|
| 239 | - _bindtextdomain($class, dirname($file) . "/locale"); |
|
| 238 | + if (file_exists(dirname($file)."/locale")) { |
|
| 239 | + _bindtextdomain($class, dirname($file)."/locale"); |
|
| 240 | 240 | _bind_textdomain_codeset($class, "UTF-8"); |
| 241 | 241 | } |
| 242 | 242 | |
@@ -319,13 +319,13 @@ discard block |
||
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | function del_command($command) { |
| 322 | - $command = "-" . strtolower($command); |
|
| 322 | + $command = "-".strtolower($command); |
|
| 323 | 323 | |
| 324 | 324 | unset($this->commands[$command]); |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | function lookup_command($command) { |
| 328 | - $command = "-" . strtolower($command); |
|
| 328 | + $command = "-".strtolower($command); |
|
| 329 | 329 | |
| 330 | 330 | if (is_array($this->commands[$command])) { |
| 331 | 331 | return $this->commands[$command]["class"]; |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | function load_data() { |
| 351 | - if ($this->owner_uid) { |
|
| 351 | + if ($this->owner_uid) { |
|
| 352 | 352 | $sth = $this->pdo->prepare("SELECT name, content FROM ttrss_plugin_storage |
| 353 | 353 | WHERE owner_uid = ?"); |
| 354 | 354 | $sth->execute([$this->owner_uid]); |
@@ -375,13 +375,13 @@ discard block |
||
| 375 | 375 | if ($sth->fetch()) { |
| 376 | 376 | $sth = $this->pdo->prepare("UPDATE ttrss_plugin_storage SET content = ? |
| 377 | 377 | WHERE owner_uid= ? AND name = ?"); |
| 378 | - $sth->execute([(string)$content, $this->owner_uid, $plugin]); |
|
| 378 | + $sth->execute([(string) $content, $this->owner_uid, $plugin]); |
|
| 379 | 379 | |
| 380 | 380 | } else { |
| 381 | 381 | $sth = $this->pdo->prepare("INSERT INTO ttrss_plugin_storage |
| 382 | 382 | (name,owner_uid,content) VALUES |
| 383 | 383 | (?, ?, ?)"); |
| 384 | - $sth->execute([$plugin, $this->owner_uid, (string)$content]); |
|
| 384 | + $sth->execute([$plugin, $this->owner_uid, (string) $content]); |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | $this->pdo->commit(); |
@@ -495,8 +495,8 @@ discard block |
||
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | // handled by classes/pluginhandler.php, requires valid session |
| 498 | - function get_method_url($sender, $method, $params) { |
|
| 499 | - return get_self_url_prefix() . "/backend.php?" . |
|
| 498 | + function get_method_url($sender, $method, $params) { |
|
| 499 | + return get_self_url_prefix()."/backend.php?". |
|
| 500 | 500 | http_build_query( |
| 501 | 501 | array_merge( |
| 502 | 502 | [ |
@@ -508,9 +508,9 @@ discard block |
||
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | // WARNING: endpoint in public.php, exposed to unauthenticated users |
| 511 | - function get_public_method_url($sender, $method, $params) { |
|
| 511 | + function get_public_method_url($sender, $method, $params) { |
|
| 512 | 512 | if ($sender->is_public_method($method)) { |
| 513 | - return get_self_url_prefix() . "/public.php?" . |
|
| 513 | + return get_self_url_prefix()."/public.php?". |
|
| 514 | 514 | http_build_query( |
| 515 | 515 | array_merge( |
| 516 | 516 | [ |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | ], |
| 521 | 521 | $params)); |
| 522 | 522 | } else { |
| 523 | - user_error("get_public_method_url: requested method '$method' of '" . get_class($sender) . "' is private."); |
|
| 523 | + user_error("get_public_method_url: requested method '$method' of '".get_class($sender)."' is private."); |
|
| 524 | 524 | } |
| 525 | 525 | } |
| 526 | 526 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | if ($type_name == "bool") { |
| 103 | 103 | return $value == "true"; |
| 104 | 104 | } else if ($type_name == "integer") { |
| 105 | - return (int)$value; |
|
| 105 | + return (int) $value; |
|
| 106 | 106 | } else { |
| 107 | 107 | return $value; |
| 108 | 108 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $value = "false"; |
| 150 | 150 | } |
| 151 | 151 | } else if ($type_name == "integer") { |
| 152 | - $value = (int)$value; |
|
| 152 | + $value = (int) $value; |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | if ($pref_name == 'USER_TIMEZONE' && $value == '') { |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | return $this->link; |
| 16 | 16 | } else { |
| 17 | - print("Unable to connect to database (as $user to $host, database $db): " . mysqli_connect_error()); |
|
| 17 | + print("Unable to connect to database (as $user to $host, database $db): ".mysqli_connect_error()); |
|
| 18 | 18 | exit(102); |
| 19 | 19 | } |
| 20 | 20 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $this->last_error = @mysqli_error($this->link); |
| 32 | 32 | |
| 33 | 33 | @mysqli_query($this->link, "ROLLBACK"); |
| 34 | - user_error("Query $query failed: " . ($this->link ? $this->last_error : "No connection"), |
|
| 34 | + user_error("Query $query failed: ".($this->link ? $this->last_error : "No connection"), |
|
| 35 | 35 | $die_on_error ? E_USER_ERROR : E_USER_WARNING); |
| 36 | 36 | } |
| 37 | 37 | |