@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | while ($line = $sth->fetch()) { |
| 61 | 61 | |
| 62 | 62 | $cat = array(); |
| 63 | - $cat['id'] = 'CAT:' . $line['id']; |
|
| 64 | - $cat['bare_id'] = (int)$line['id']; |
|
| 63 | + $cat['id'] = 'CAT:'.$line['id']; |
|
| 64 | + $cat['bare_id'] = (int) $line['id']; |
|
| 65 | 65 | $cat['name'] = $line['title']; |
| 66 | 66 | $cat['items'] = array(); |
| 67 | 67 | $cat['checkbox'] = false; |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | while ($feed_line = $fsth->fetch()) { |
| 95 | 95 | $feed = array(); |
| 96 | - $feed['id'] = 'FEED:' . $feed_line['id']; |
|
| 97 | - $feed['bare_id'] = (int)$feed_line['id']; |
|
| 96 | + $feed['id'] = 'FEED:'.$feed_line['id']; |
|
| 97 | + $feed['bare_id'] = (int) $feed_line['id']; |
|
| 98 | 98 | $feed['auxcounter'] = -1; |
| 99 | 99 | $feed['name'] = $feed_line['title']; |
| 100 | 100 | $feed['checkbox'] = false; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $feed['icon'] = Feeds::getFeedIcon($feed_line['id']); |
| 104 | 104 | $feed['param'] = make_local_datetime( |
| 105 | 105 | $feed_line['last_updated'], true); |
| 106 | - $feed['updates_disabled'] = (int)($feed_line['update_interval'] < 0); |
|
| 106 | + $feed['updates_disabled'] = (int) ($feed_line['update_interval'] < 0); |
|
| 107 | 107 | |
| 108 | 108 | array_push($items, $feed); |
| 109 | 109 | } |
@@ -151,8 +151,8 @@ discard block |
||
| 151 | 151 | $feed_id = PluginHost::pfeed_to_feed_id($feed['id']); |
| 152 | 152 | |
| 153 | 153 | $item = array(); |
| 154 | - $item['id'] = 'FEED:' . $feed_id; |
|
| 155 | - $item['bare_id'] = (int)$feed_id; |
|
| 154 | + $item['id'] = 'FEED:'.$feed_id; |
|
| 155 | + $item['bare_id'] = (int) $feed_id; |
|
| 156 | 156 | $item['auxcounter'] = -1; |
| 157 | 157 | $item['name'] = $feed['title']; |
| 158 | 158 | $item['checkbox'] = false; |
@@ -216,8 +216,8 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | while ($line = $sth->fetch()) { |
| 218 | 218 | $cat = array(); |
| 219 | - $cat['id'] = 'CAT:' . $line['id']; |
|
| 220 | - $cat['bare_id'] = (int)$line['id']; |
|
| 219 | + $cat['id'] = 'CAT:'.$line['id']; |
|
| 220 | + $cat['bare_id'] = (int) $line['id']; |
|
| 221 | 221 | $cat['auxcounter'] = -1; |
| 222 | 222 | $cat['name'] = $line['title']; |
| 223 | 223 | $cat['items'] = array(); |
@@ -261,8 +261,8 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | while ($feed_line = $fsth->fetch()) { |
| 263 | 263 | $feed = array(); |
| 264 | - $feed['id'] = 'FEED:' . $feed_line['id']; |
|
| 265 | - $feed['bare_id'] = (int)$feed_line['id']; |
|
| 264 | + $feed['id'] = 'FEED:'.$feed_line['id']; |
|
| 265 | + $feed['bare_id'] = (int) $feed_line['id']; |
|
| 266 | 266 | $feed['auxcounter'] = -1; |
| 267 | 267 | $feed['name'] = $feed_line['title']; |
| 268 | 268 | $feed['checkbox'] = false; |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | $feed_line['last_updated'], true); |
| 273 | 273 | $feed['unread'] = -1; |
| 274 | 274 | $feed['type'] = 'feed'; |
| 275 | - $feed['updates_disabled'] = (int)($feed_line['update_interval'] < 0); |
|
| 275 | + $feed['updates_disabled'] = (int) ($feed_line['update_interval'] < 0); |
|
| 276 | 276 | |
| 277 | 277 | array_push($cat['items'], $feed); |
| 278 | 278 | } |
@@ -296,8 +296,8 @@ discard block |
||
| 296 | 296 | |
| 297 | 297 | while ($feed_line = $fsth->fetch()) { |
| 298 | 298 | $feed = array(); |
| 299 | - $feed['id'] = 'FEED:' . $feed_line['id']; |
|
| 300 | - $feed['bare_id'] = (int)$feed_line['id']; |
|
| 299 | + $feed['id'] = 'FEED:'.$feed_line['id']; |
|
| 300 | + $feed['bare_id'] = (int) $feed_line['id']; |
|
| 301 | 301 | $feed['auxcounter'] = -1; |
| 302 | 302 | $feed['name'] = $feed_line['title']; |
| 303 | 303 | $feed['checkbox'] = false; |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | $feed_line['last_updated'], true); |
| 308 | 308 | $feed['unread'] = -1; |
| 309 | 309 | $feed['type'] = 'feed'; |
| 310 | - $feed['updates_disabled'] = (int)($feed_line['update_interval'] < 0); |
|
| 310 | + $feed['updates_disabled'] = (int) ($feed_line['update_interval'] < 0); |
|
| 311 | 311 | |
| 312 | 312 | array_push($root['items'], $feed); |
| 313 | 313 | } |
@@ -348,11 +348,11 @@ discard block |
||
| 348 | 348 | |
| 349 | 349 | Debug::log("$prefix C: $item_id P: $parent_id"); |
| 350 | 350 | |
| 351 | - $bare_item_id = substr($item_id, strpos($item_id, ':')+1); |
|
| 351 | + $bare_item_id = substr($item_id, strpos($item_id, ':') + 1); |
|
| 352 | 352 | |
| 353 | 353 | if ($item_id != 'root') { |
| 354 | 354 | if ($parent_id && $parent_id != 'root') { |
| 355 | - $parent_bare_id = substr($parent_id, strpos($parent_id, ':')+1); |
|
| 355 | + $parent_bare_id = substr($parent_id, strpos($parent_id, ':') + 1); |
|
| 356 | 356 | $parent_qpart = $parent_bare_id; |
| 357 | 357 | } else { |
| 358 | 358 | $parent_qpart = null; |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | if ($cat && is_array($cat)) { |
| 372 | 372 | foreach ($cat as $item) { |
| 373 | 373 | $id = $item['_reference']; |
| 374 | - $bare_id = substr($id, strpos($id, ':')+1); |
|
| 374 | + $bare_id = substr($id, strpos($id, ':') + 1); |
|
| 375 | 375 | |
| 376 | 376 | Debug::log("$prefix [$order_id] $id/$bare_id"); |
| 377 | 377 | |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | |
| 390 | 390 | } else if (strpos($id, "CAT:") === 0) { |
| 391 | 391 | $this->process_category_order($data_map, $item['_reference'], $item_id, |
| 392 | - $nest_level+1); |
|
| 392 | + $nest_level + 1); |
|
| 393 | 393 | |
| 394 | 394 | $sth = $this->pdo->prepare("UPDATE ttrss_feed_categories |
| 395 | 395 | SET order_id = ? WHERE id = ? AND |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | $sth->execute([$feed_id, $_SESSION['uid']]); |
| 447 | 447 | |
| 448 | 448 | if ($sth->fetch()) { |
| 449 | - @unlink(ICONS_DIR . "/$feed_id.ico"); |
|
| 449 | + @unlink(ICONS_DIR."/$feed_id.ico"); |
|
| 450 | 450 | |
| 451 | 451 | $sth = $this->pdo->prepare("UPDATE ttrss_feeds SET favicon_avg_color = NULL where id = ?"); |
| 452 | 452 | $sth->execute([$feed_id]); |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | header("Content-type: text/html"); |
| 458 | 458 | |
| 459 | 459 | if (is_uploaded_file($_FILES['icon_file']['tmp_name'])) { |
| 460 | - $tmp_file = tempnam(CACHE_DIR . '/upload', 'icon'); |
|
| 460 | + $tmp_file = tempnam(CACHE_DIR.'/upload', 'icon'); |
|
| 461 | 461 | |
| 462 | 462 | $result = move_uploaded_file($_FILES['icon_file']['tmp_name'], |
| 463 | 463 | $tmp_file); |
@@ -480,8 +480,8 @@ discard block |
||
| 480 | 480 | $sth->execute([$feed_id, $_SESSION['uid']]); |
| 481 | 481 | |
| 482 | 482 | if ($sth->fetch()) { |
| 483 | - @unlink(ICONS_DIR . "/$feed_id.ico"); |
|
| 484 | - if (rename($icon_file, ICONS_DIR . "/$feed_id.ico")) { |
|
| 483 | + @unlink(ICONS_DIR."/$feed_id.ico"); |
|
| 484 | + if (rename($icon_file, ICONS_DIR."/$feed_id.ico")) { |
|
| 485 | 485 | |
| 486 | 486 | $sth = $this->pdo->prepare("UPDATE ttrss_feeds SET favicon_avg_color = '' WHERE id = ?"); |
| 487 | 487 | $sth->execute([$feed_id]); |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | |
| 541 | 541 | print "<fieldset>"; |
| 542 | 542 | |
| 543 | - print "<label>" . __('URL:') . "</label> "; |
|
| 543 | + print "<label>".__('URL:')."</label> "; |
|
| 544 | 544 | print "<input dojoType='dijit.form.ValidationTextBox' required='1' |
| 545 | 545 | placeHolder=\"".__("Feed URL")."\" |
| 546 | 546 | regExp='^(http|https)://.*' style='width : 300px' |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | |
| 564 | 564 | print "<fieldset>"; |
| 565 | 565 | |
| 566 | - print "<label>" . __('Place in category:') . "</label> "; |
|
| 566 | + print "<label>".__('Place in category:')."</label> "; |
|
| 567 | 567 | |
| 568 | 568 | print_feed_cat_select("cat_id", $cat_id, |
| 569 | 569 | 'dojoType="fox.form.Select"'); |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | |
| 578 | 578 | print "<fieldset>"; |
| 579 | 579 | |
| 580 | - print "<label>" . __('Site URL:') . "</label> "; |
|
| 580 | + print "<label>".__('Site URL:')."</label> "; |
|
| 581 | 581 | print "<input dojoType='dijit.form.ValidationTextBox' required='1' |
| 582 | 582 | placeHolder=\"".__("Site URL")."\" |
| 583 | 583 | regExp='^(http|https)://.*' style='width : 300px' |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | |
| 596 | 596 | print "<fieldset>"; |
| 597 | 597 | |
| 598 | - print "<label>" . __('Language:') . "</label> "; |
|
| 598 | + print "<label>".__('Language:')."</label> "; |
|
| 599 | 599 | print_select("feed_language", $feed_language, $this::get_ts_languages(), |
| 600 | 600 | 'dojoType="fox.form.Select"'); |
| 601 | 601 | |
@@ -626,10 +626,10 @@ discard block |
||
| 626 | 626 | |
| 627 | 627 | print "<fieldset>"; |
| 628 | 628 | |
| 629 | - print "<label>" . __('Article purging:') . "</label> "; |
|
| 629 | + print "<label>".__('Article purging:')."</label> "; |
|
| 630 | 630 | |
| 631 | 631 | print_select_hash("purge_interval", $purge_interval, $purge_intervals, |
| 632 | - 'dojoType="fox.form.Select" ' . |
|
| 632 | + 'dojoType="fox.form.Select" '. |
|
| 633 | 633 | ((FORCE_ARTICLE_PURGE == 0) ? "" : 'disabled="1"')); |
| 634 | 634 | |
| 635 | 635 | print "</fieldset>"; |
@@ -736,7 +736,7 @@ discard block |
||
| 736 | 736 | print "<fieldset class='narrow'>"; |
| 737 | 737 | |
| 738 | 738 | print "<label class='checkbox'><input dojoType='dijit.form.CheckBox' type='checkbox' id='cache_images' |
| 739 | - name='cache_images' $checked> ". __('Cache media')."</label>"; |
|
| 739 | + name='cache_images' $checked> ".__('Cache media')."</label>"; |
|
| 740 | 740 | |
| 741 | 741 | print "</fieldset>"; |
| 742 | 742 | |
@@ -818,7 +818,7 @@ discard block |
||
| 818 | 818 | |
| 819 | 819 | print "<fieldset>"; |
| 820 | 820 | |
| 821 | - print "<label>" . __('Place in category:') . "</label> "; |
|
| 821 | + print "<label>".__('Place in category:')."</label> "; |
|
| 822 | 822 | |
| 823 | 823 | print_feed_cat_select("cat_id", false, |
| 824 | 824 | 'disabled="1" dojoType="fox.form.Select"'); |
@@ -833,7 +833,7 @@ discard block |
||
| 833 | 833 | if (DB_TYPE == "pgsql") { |
| 834 | 834 | print "<fieldset>"; |
| 835 | 835 | |
| 836 | - print "<label>" . __('Language:') . "</label> "; |
|
| 836 | + print "<label>".__('Language:')."</label> "; |
|
| 837 | 837 | print_select("feed_language", "", $this::get_ts_languages(), |
| 838 | 838 | 'disabled="1" dojoType="fox.form.Select"'); |
| 839 | 839 | |
@@ -866,7 +866,7 @@ discard block |
||
| 866 | 866 | |
| 867 | 867 | print "<fieldset>"; |
| 868 | 868 | |
| 869 | - print "<label>" . __('Article purging:') . "</label> "; |
|
| 869 | + print "<label>".__('Article purging:')."</label> "; |
|
| 870 | 870 | |
| 871 | 871 | print_select_hash("purge_interval", "", $purge_intervals, |
| 872 | 872 | 'disabled="1" dojoType="fox.form.Select"'); |
@@ -1026,12 +1026,12 @@ discard block |
||
| 1026 | 1026 | ":purge_intl" => $purge_intl, |
| 1027 | 1027 | ":auth_login" => $auth_login, |
| 1028 | 1028 | ":auth_pass" => $auth_pass, |
| 1029 | - ":private" => (int)$private, |
|
| 1030 | - ":cache_images" => (int)$cache_images, |
|
| 1031 | - ":hide_images" => (int)$hide_images, |
|
| 1032 | - ":include_in_digest" => (int)$include_in_digest, |
|
| 1033 | - ":always_display_enclosures" => (int)$always_display_enclosures, |
|
| 1034 | - ":mark_unread_on_update" => (int)$mark_unread_on_update, |
|
| 1029 | + ":private" => (int) $private, |
|
| 1030 | + ":cache_images" => (int) $cache_images, |
|
| 1031 | + ":hide_images" => (int) $hide_images, |
|
| 1032 | + ":include_in_digest" => (int) $include_in_digest, |
|
| 1033 | + ":always_display_enclosures" => (int) $always_display_enclosures, |
|
| 1034 | + ":mark_unread_on_update" => (int) $mark_unread_on_update, |
|
| 1035 | 1035 | ":feed_language" => $feed_language, |
| 1036 | 1036 | ":id" => $feed_id, |
| 1037 | 1037 | ":uid" => $_SESSION['uid']]); |
@@ -1062,57 +1062,57 @@ discard block |
||
| 1062 | 1062 | |
| 1063 | 1063 | switch ($k) { |
| 1064 | 1064 | case "title": |
| 1065 | - $qpart = "title = " . $this->pdo->quote($feed_title); |
|
| 1065 | + $qpart = "title = ".$this->pdo->quote($feed_title); |
|
| 1066 | 1066 | break; |
| 1067 | 1067 | |
| 1068 | 1068 | case "feed_url": |
| 1069 | - $qpart = "feed_url = " . $this->pdo->quote($feed_url); |
|
| 1069 | + $qpart = "feed_url = ".$this->pdo->quote($feed_url); |
|
| 1070 | 1070 | break; |
| 1071 | 1071 | |
| 1072 | 1072 | case "update_interval": |
| 1073 | - $qpart = "update_interval = " . $this->pdo->quote($upd_intl); |
|
| 1073 | + $qpart = "update_interval = ".$this->pdo->quote($upd_intl); |
|
| 1074 | 1074 | break; |
| 1075 | 1075 | |
| 1076 | 1076 | case "purge_interval": |
| 1077 | - $qpart = "purge_interval =" . $this->pdo->quote($purge_intl); |
|
| 1077 | + $qpart = "purge_interval =".$this->pdo->quote($purge_intl); |
|
| 1078 | 1078 | break; |
| 1079 | 1079 | |
| 1080 | 1080 | case "auth_login": |
| 1081 | - $qpart = "auth_login = " . $this->pdo->quote($auth_login); |
|
| 1081 | + $qpart = "auth_login = ".$this->pdo->quote($auth_login); |
|
| 1082 | 1082 | break; |
| 1083 | 1083 | |
| 1084 | 1084 | case "auth_pass": |
| 1085 | - $qpart = "auth_pass =" . $this->pdo->quote($auth_pass). ", auth_pass_encrypted = false"; |
|
| 1085 | + $qpart = "auth_pass =".$this->pdo->quote($auth_pass).", auth_pass_encrypted = false"; |
|
| 1086 | 1086 | break; |
| 1087 | 1087 | |
| 1088 | 1088 | case "private": |
| 1089 | - $qpart = "private = " . $this->pdo->quote($private); |
|
| 1089 | + $qpart = "private = ".$this->pdo->quote($private); |
|
| 1090 | 1090 | break; |
| 1091 | 1091 | |
| 1092 | 1092 | case "include_in_digest": |
| 1093 | - $qpart = "include_in_digest = " . $this->pdo->quote($include_in_digest); |
|
| 1093 | + $qpart = "include_in_digest = ".$this->pdo->quote($include_in_digest); |
|
| 1094 | 1094 | break; |
| 1095 | 1095 | |
| 1096 | 1096 | case "always_display_enclosures": |
| 1097 | - $qpart = "always_display_enclosures = " . $this->pdo->quote($always_display_enclosures); |
|
| 1097 | + $qpart = "always_display_enclosures = ".$this->pdo->quote($always_display_enclosures); |
|
| 1098 | 1098 | break; |
| 1099 | 1099 | |
| 1100 | 1100 | case "mark_unread_on_update": |
| 1101 | - $qpart = "mark_unread_on_update = " . $this->pdo->quote($mark_unread_on_update); |
|
| 1101 | + $qpart = "mark_unread_on_update = ".$this->pdo->quote($mark_unread_on_update); |
|
| 1102 | 1102 | break; |
| 1103 | 1103 | |
| 1104 | 1104 | case "cache_images": |
| 1105 | - $qpart = "cache_images = " . $this->pdo->quote($cache_images); |
|
| 1105 | + $qpart = "cache_images = ".$this->pdo->quote($cache_images); |
|
| 1106 | 1106 | break; |
| 1107 | 1107 | |
| 1108 | 1108 | case "hide_images": |
| 1109 | - $qpart = "hide_images = " . $this->pdo->quote($hide_images); |
|
| 1109 | + $qpart = "hide_images = ".$this->pdo->quote($hide_images); |
|
| 1110 | 1110 | break; |
| 1111 | 1111 | |
| 1112 | 1112 | case "cat_id": |
| 1113 | 1113 | if (get_pref('ENABLE_FEED_CATS')) { |
| 1114 | 1114 | if ($cat_id) { |
| 1115 | - $qpart = "cat_id = " . $this->pdo->quote($cat_id); |
|
| 1115 | + $qpart = "cat_id = ".$this->pdo->quote($cat_id); |
|
| 1116 | 1116 | } else { |
| 1117 | 1117 | $qpart = 'cat_id = NULL'; |
| 1118 | 1118 | } |
@@ -1123,7 +1123,7 @@ discard block |
||
| 1123 | 1123 | break; |
| 1124 | 1124 | |
| 1125 | 1125 | case "feed_language": |
| 1126 | - $qpart = "feed_language = " . $this->pdo->quote($feed_language); |
|
| 1126 | + $qpart = "feed_language = ".$this->pdo->quote($feed_language); |
|
| 1127 | 1127 | break; |
| 1128 | 1128 | |
| 1129 | 1129 | } |
@@ -1184,14 +1184,14 @@ discard block |
||
| 1184 | 1184 | |
| 1185 | 1185 | $error_button = "<button dojoType=\"dijit.form.Button\" |
| 1186 | 1186 | onclick=\"CommonDialogs.showFeedsWithErrors()\" id=\"errorButton\">" . |
| 1187 | - __("Feeds with errors") . "</button>"; |
|
| 1187 | + __("Feeds with errors")."</button>"; |
|
| 1188 | 1188 | } |
| 1189 | 1189 | |
| 1190 | 1190 | $inactive_button = "<button dojoType=\"dijit.form.Button\" |
| 1191 | 1191 | id=\"pref_feeds_inactive_btn\" |
| 1192 | 1192 | style=\"display : none\" |
| 1193 | 1193 | onclick=\"dijit.byId('feedTree').showInactiveFeeds()\">" . |
| 1194 | - __("Inactive feeds") . "</button>"; |
|
| 1194 | + __("Inactive feeds")."</button>"; |
|
| 1195 | 1195 | |
| 1196 | 1196 | $feed_search = clean($_REQUEST["search"]); |
| 1197 | 1197 | |
@@ -1213,7 +1213,7 @@ discard block |
||
| 1213 | 1213 | </div>"; |
| 1214 | 1214 | |
| 1215 | 1215 | print "<div dojoType=\"fox.form.DropDownButton\">". |
| 1216 | - "<span>" . __('Select')."</span>"; |
|
| 1216 | + "<span>".__('Select')."</span>"; |
|
| 1217 | 1217 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
| 1218 | 1218 | print "<div onclick=\"dijit.byId('feedTree').model.setAllChecked(true)\" |
| 1219 | 1219 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; |
@@ -1222,7 +1222,7 @@ discard block |
||
| 1222 | 1222 | print "</div></div>"; |
| 1223 | 1223 | |
| 1224 | 1224 | print "<div dojoType=\"fox.form.DropDownButton\">". |
| 1225 | - "<span>" . __('Feeds')."</span>"; |
|
| 1225 | + "<span>".__('Feeds')."</span>"; |
|
| 1226 | 1226 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
| 1227 | 1227 | print "<div onclick=\"CommonDialogs.quickAddFeed()\" |
| 1228 | 1228 | dojoType=\"dijit.MenuItem\">".__('Subscribe to feed')."</div>"; |
@@ -1238,7 +1238,7 @@ discard block |
||
| 1238 | 1238 | |
| 1239 | 1239 | if (get_pref('ENABLE_FEED_CATS')) { |
| 1240 | 1240 | print "<div dojoType=\"fox.form.DropDownButton\">". |
| 1241 | - "<span>" . __('Categories')."</span>"; |
|
| 1241 | + "<span>".__('Categories')."</span>"; |
|
| 1242 | 1242 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
| 1243 | 1243 | print "<div onclick=\"dijit.byId('feedTree').createCategory()\" |
| 1244 | 1244 | dojoType=\"dijit.MenuItem\">".__('Add category')."</div>"; |
@@ -1305,7 +1305,7 @@ discard block |
||
| 1305 | 1305 | print "<div dojoType='dijit.layout.AccordionPane' |
| 1306 | 1306 | title='<i class=\"material-icons\">import_export</i> ".__('OPML')."'>"; |
| 1307 | 1307 | |
| 1308 | - print "<h3>" . __("Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings.") . "</h3>"; |
|
| 1308 | + print "<h3>".__("Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings.")."</h3>"; |
|
| 1309 | 1309 | |
| 1310 | 1310 | print_notice("Only main settings profile can be migrated using OPML."); |
| 1311 | 1311 | |
@@ -1322,7 +1322,7 @@ discard block |
||
| 1322 | 1322 | <input type='hidden' name='op' value='dlg'> |
| 1323 | 1323 | <input type='hidden' name='method' value='importOpml'> |
| 1324 | 1324 | <button dojoType='dijit.form.Button' class='alt-primary' onclick=\"return Helpers.OPML.import();\" type=\"submit\">" . |
| 1325 | - __('Import OPML') . "</button>"; |
|
| 1325 | + __('Import OPML')."</button>"; |
|
| 1326 | 1326 | |
| 1327 | 1327 | print "</form>"; |
| 1328 | 1328 | |
@@ -1330,22 +1330,22 @@ discard block |
||
| 1330 | 1330 | |
| 1331 | 1331 | print "<button dojoType='dijit.form.Button' |
| 1332 | 1332 | onclick='Helpers.OPML.export()' >" . |
| 1333 | - __('Export OPML') . "</button>"; |
|
| 1333 | + __('Export OPML')."</button>"; |
|
| 1334 | 1334 | |
| 1335 | 1335 | print " <label class='checkbox'>"; |
| 1336 | 1336 | print_checkbox("include_settings", true, "1", ""); |
| 1337 | - print " " . __("Include settings"); |
|
| 1337 | + print " ".__("Include settings"); |
|
| 1338 | 1338 | print "</label>"; |
| 1339 | 1339 | |
| 1340 | 1340 | print "</form>"; |
| 1341 | 1341 | |
| 1342 | 1342 | print "<p/>"; |
| 1343 | 1343 | |
| 1344 | - print "<h2>" . __("Published OPML") . "</h2>"; |
|
| 1344 | + print "<h2>".__("Published OPML")."</h2>"; |
|
| 1345 | 1345 | |
| 1346 | - print "<p>" . __('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.') . |
|
| 1347 | - " " . |
|
| 1348 | - __("Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds.") . "</p>"; |
|
| 1346 | + print "<p>".__('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.'). |
|
| 1347 | + " ". |
|
| 1348 | + __("Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds.")."</p>"; |
|
| 1349 | 1349 | |
| 1350 | 1350 | print "<button dojoType='dijit.form.Button' class='alt-primary' onclick=\"return App.displayDlg('".__("Public OPML URL")."','pubOPMLUrl')\">". |
| 1351 | 1351 | __('Display published OPML URL')."</button> "; |
@@ -1358,10 +1358,10 @@ discard block |
||
| 1358 | 1358 | print "<div dojoType=\"dijit.layout.AccordionPane\" |
| 1359 | 1359 | title=\"<i class='material-icons'>share</i> ".__('Published & shared articles / Generated feeds')."\">"; |
| 1360 | 1360 | |
| 1361 | - print "<h3>" . __('Published articles can be subscribed by anyone who knows the following URL:') . "</h3>"; |
|
| 1361 | + print "<h3>".__('Published articles can be subscribed by anyone who knows the following URL:')."</h3>"; |
|
| 1362 | 1362 | |
| 1363 | - $rss_url = '-2::' . htmlspecialchars(get_self_url_prefix() . |
|
| 1364 | - "/public.php?op=rss&id=-2&view-mode=all_articles");; |
|
| 1363 | + $rss_url = '-2::'.htmlspecialchars(get_self_url_prefix(). |
|
| 1364 | + "/public.php?op=rss&id=-2&view-mode=all_articles"); ; |
|
| 1365 | 1365 | |
| 1366 | 1366 | print "<button dojoType='dijit.form.Button' class='alt-primary' onclick=\"return App.displayDlg('".__("Show as feed")."','generatedFeed', '$rss_url')\">". |
| 1367 | 1367 | __('Display URL')."</button> "; |
@@ -1390,7 +1390,7 @@ discard block |
||
| 1390 | 1390 | $cat_unread = Feeds::getCategoryUnread($cat_id); |
| 1391 | 1391 | } |
| 1392 | 1392 | |
| 1393 | - $obj['id'] = 'CAT:' . $cat_id; |
|
| 1393 | + $obj['id'] = 'CAT:'.$cat_id; |
|
| 1394 | 1394 | $obj['items'] = array(); |
| 1395 | 1395 | $obj['name'] = Feeds::getCategoryTitle($cat_id); |
| 1396 | 1396 | $obj['type'] = 'category'; |
@@ -1410,7 +1410,7 @@ discard block |
||
| 1410 | 1410 | if ($unread === false) |
| 1411 | 1411 | $unread = getFeedUnread($feed_id, false); |
| 1412 | 1412 | |
| 1413 | - $obj['id'] = 'FEED:' . $feed_id; |
|
| 1413 | + $obj['id'] = 'FEED:'.$feed_id; |
|
| 1414 | 1414 | $obj['name'] = $title; |
| 1415 | 1415 | $obj['unread'] = (int) $unread; |
| 1416 | 1416 | $obj['type'] = 'feed'; |
@@ -1446,7 +1446,7 @@ discard block |
||
| 1446 | 1446 | |
| 1447 | 1447 | print "<div dojoType='fox.Toolbar'>"; |
| 1448 | 1448 | print "<div dojoType='fox.form.DropDownButton'>". |
| 1449 | - "<span>" . __('Select')."</span>"; |
|
| 1449 | + "<span>".__('Select')."</span>"; |
|
| 1450 | 1450 | print "<div dojoType='dijit.Menu' style='display: none'>"; |
| 1451 | 1451 | print "<div onclick=\"Tables.select('inactive-feeds-list', true)\" |
| 1452 | 1452 | dojoType='dijit.MenuItem'>".__('All')."</div>"; |
@@ -1503,7 +1503,7 @@ discard block |
||
| 1503 | 1503 | |
| 1504 | 1504 | print "<div dojoType=\"fox.Toolbar\">"; |
| 1505 | 1505 | print "<div dojoType=\"fox.form.DropDownButton\">". |
| 1506 | - "<span>" . __('Select')."</span>"; |
|
| 1506 | + "<span>".__('Select')."</span>"; |
|
| 1507 | 1507 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
| 1508 | 1508 | print "<div onclick=\"Tables.select('error-feeds-list', true)\" |
| 1509 | 1509 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; |
@@ -1567,7 +1567,7 @@ discard block |
||
| 1567 | 1567 | |
| 1568 | 1568 | public static function remove_feed($id, $owner_uid) { |
| 1569 | 1569 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_UNSUBSCRIBE_FEED) as $p) { |
| 1570 | - if (! $p->hook_unsubscribe_feed($id, $owner_uid)) { |
|
| 1570 | + if (!$p->hook_unsubscribe_feed($id, $owner_uid)) { |
|
| 1571 | 1571 | user_error("feed $id (owner: $owner_uid) not removed due to plugin error (HOOK_UNSUBSCRIBE_FEED).", E_USER_WARNING); |
| 1572 | 1572 | return; |
| 1573 | 1573 | } |
@@ -1599,7 +1599,7 @@ discard block |
||
| 1599 | 1599 | $res = $pdo->query("SELECT MAX(id) AS id FROM ttrss_archived_feeds"); |
| 1600 | 1600 | $row = $res->fetch(); |
| 1601 | 1601 | |
| 1602 | - $new_feed_id = (int)$row['id'] + 1; |
|
| 1602 | + $new_feed_id = (int) $row['id'] + 1; |
|
| 1603 | 1603 | |
| 1604 | 1604 | $sth = $pdo->prepare("INSERT INTO ttrss_archived_feeds |
| 1605 | 1605 | (id, owner_uid, title, feed_url, site_url, created) |
@@ -1631,8 +1631,8 @@ discard block |
||
| 1631 | 1631 | |
| 1632 | 1632 | $pdo->commit(); |
| 1633 | 1633 | |
| 1634 | - if (file_exists(ICONS_DIR . "/$id.ico")) { |
|
| 1635 | - unlink(ICONS_DIR . "/$id.ico"); |
|
| 1634 | + if (file_exists(ICONS_DIR."/$id.ico")) { |
|
| 1635 | + unlink(ICONS_DIR."/$id.ico"); |
|
| 1636 | 1636 | } |
| 1637 | 1637 | |
| 1638 | 1638 | CCache::remove($id, $owner_uid); |
@@ -1656,7 +1656,7 @@ discard block |
||
| 1656 | 1656 | |
| 1657 | 1657 | if (get_pref('ENABLE_FEED_CATS')) { |
| 1658 | 1658 | print "<fieldset>"; |
| 1659 | - print "<label>" . __('Place in category:') . "</label> "; |
|
| 1659 | + print "<label>".__('Place in category:')."</label> "; |
|
| 1660 | 1660 | print_feed_cat_select("cat", false, 'dojoType="fox.form.Select"'); |
| 1661 | 1661 | print "</fieldset>"; |
| 1662 | 1662 | } |
@@ -1665,7 +1665,7 @@ discard block |
||
| 1665 | 1665 | |
| 1666 | 1666 | print "<div id='feedDlg_loginContainer' style='display : none'>"; |
| 1667 | 1667 | |
| 1668 | - print "<header>" . __("Authentication") . "</header>"; |
|
| 1668 | + print "<header>".__("Authentication")."</header>"; |
|
| 1669 | 1669 | print "<section>"; |
| 1670 | 1670 | |
| 1671 | 1671 | print "<input dojoType='dijit.form.TextBox' name='login' placeHolder=\"".__("Login")."\"> |
@@ -1784,12 +1784,12 @@ discard block |
||
| 1784 | 1784 | $sth->execute([$_SESSION['uid']]); |
| 1785 | 1785 | |
| 1786 | 1786 | if ($row = $sth->fetch()) { |
| 1787 | - print (int)$row["num_inactive"]; |
|
| 1787 | + print (int) $row["num_inactive"]; |
|
| 1788 | 1788 | } |
| 1789 | 1789 | } |
| 1790 | 1790 | |
| 1791 | 1791 | public static function subscribe_to_feed_url() { |
| 1792 | - $url_path = get_self_url_prefix() . |
|
| 1792 | + $url_path = get_self_url_prefix(). |
|
| 1793 | 1793 | "/public.php?op=subscribe&feed_url=%s"; |
| 1794 | 1794 | return $url_path; |
| 1795 | 1795 | } |
@@ -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 | public 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 | public 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 | public 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 | - public function get_method_url($sender, $method, $params) { |
|
| 499 | - return get_self_url_prefix() . "/backend.php?" . |
|
| 498 | + public 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 | - public function get_public_method_url($sender, $method, $params) { |
|
| 511 | + public 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 | } |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | class Backend extends Handler { |
| 3 | 3 | public function loading() { |
| 4 | 4 | header("Content-type: text/html"); |
| 5 | - print __("Loading, please wait...") . " " . |
|
| 5 | + print __("Loading, please wait...")." ". |
|
| 6 | 6 | "<img src='images/indicator_tiny.gif'>"; |
| 7 | 7 | } |
| 8 | 8 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | foreach ($info as $section => $hotkeys) { |
| 42 | 42 | |
| 43 | 43 | if ($cur_section) print "<li> </li>"; |
| 44 | - print "<li><h3>" . $section . "</h3></li>"; |
|
| 44 | + print "<li><h3>".$section."</h3></li>"; |
|
| 45 | 45 | $cur_section = $section; |
| 46 | 46 | |
| 47 | 47 | foreach ($hotkeys as $action => $description) { |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | foreach ($omap[$action] as $sequence) { |
| 51 | 51 | if (strpos($sequence, "|") !== false) { |
| 52 | 52 | $sequence = substr($sequence, |
| 53 | - strpos($sequence, "|")+1, |
|
| 53 | + strpos($sequence, "|") + 1, |
|
| 54 | 54 | strlen($sequence)); |
| 55 | 55 | } else { |
| 56 | 56 | $keys = explode(" ", $sequence); |
@@ -61,10 +61,10 @@ discard block |
||
| 61 | 61 | foreach (str_split($keys[$i]) as $c) { |
| 62 | 62 | switch ($c) { |
| 63 | 63 | case '*': |
| 64 | - $tmp .= __('Shift') . '+'; |
|
| 64 | + $tmp .= __('Shift').'+'; |
|
| 65 | 65 | break; |
| 66 | 66 | case '^': |
| 67 | - $tmp .= __('Ctrl') . '+'; |
|
| 67 | + $tmp .= __('Ctrl').'+'; |
|
| 68 | 68 | break; |
| 69 | 69 | default: |
| 70 | 70 | $tmp .= $c; |
@@ -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 | |
@@ -15,13 +15,13 @@ discard block |
||
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | if (is_numeric($port) && $port > 0) { |
| 18 | - $string = "$string port=" . $port; |
|
| 18 | + $string = "$string port=".$port; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $this->link = pg_connect($string); |
| 22 | 22 | |
| 23 | 23 | if (!$this->link) { |
| 24 | - print("Unable to connect to database (as $user to $host, database $db):" . pg_last_error()); |
|
| 24 | + print("Unable to connect to database (as $user to $host, database $db):".pg_last_error()); |
|
| 25 | 25 | exit(102); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | @pg_query($this->link, "ROLLBACK"); |
| 46 | 46 | $query = htmlspecialchars($query); // just in case |
| 47 | - user_error("query $query failed: " . ($this->link ? $this->last_error : "No connection"), |
|
| 47 | + user_error("query $query failed: ".($this->link ? $this->last_error : "No connection"), |
|
| 48 | 48 | $die_on_error ? E_USER_ERROR : E_USER_WARNING); |
| 49 | 49 | } |
| 50 | 50 | return $result; |
@@ -7,11 +7,11 @@ discard block |
||
| 7 | 7 | if ($k != "feed" && isset($v)) { |
| 8 | 8 | $x = strip_tags(is_array($v) ? implode(",", $v) : $v); |
| 9 | 9 | |
| 10 | - $tmp .= sha1("$k:" . sha1($x)); |
|
| 10 | + $tmp .= sha1("$k:".sha1($x)); |
|
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | - return sha1(implode(",", $pluginhost->get_plugin_names()) . $tmp); |
|
| 14 | + return sha1(implode(",", $pluginhost->get_plugin_names()).$tmp); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // Strips utf8mb4 characters (i.e. emoji) for mysql |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | //update_rss_feed($line["id"], true); |
| 138 | 138 | |
| 139 | 139 | if ($tline = $usth->fetch()) { |
| 140 | - Debug::log(" => " . $tline["last_updated"] . ", " . $tline["id"] . " " . $tline["owner_uid"]); |
|
| 140 | + Debug::log(" => ".$tline["last_updated"].", ".$tline["id"]." ".$tline["owner_uid"]); |
|
| 141 | 141 | |
| 142 | 142 | if (array_search($tline["owner_uid"], $batch_owners) === false) |
| 143 | 143 | array_push($batch_owners, $tline["owner_uid"]); |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | |
| 324 | 324 | $date_feed_processed = date('Y-m-d H:i'); |
| 325 | 325 | |
| 326 | - $cache_filename = CACHE_DIR . "/feeds/" . sha1($fetch_url) . ".xml"; |
|
| 326 | + $cache_filename = CACHE_DIR."/feeds/".sha1($fetch_url).".xml"; |
|
| 327 | 327 | |
| 328 | 328 | $pluginhost = new PluginHost(); |
| 329 | 329 | $user_plugins = get_pref("_ENABLED_PLUGINS", $owner_uid); |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | Debug::log("running HOOK_FETCH_FEED handlers...", Debug::$LOG_VERBOSE); |
| 341 | 341 | |
| 342 | 342 | foreach ($pluginhost->get_hooks(PluginHost::HOOK_FETCH_FEED) as $plugin) { |
| 343 | - Debug::log("... " . get_class($plugin), Debug::$LOG_VERBOSE); |
|
| 343 | + Debug::log("... ".get_class($plugin), Debug::$LOG_VERBOSE); |
|
| 344 | 344 | $start = microtime(true); |
| 345 | 345 | $feed_data = $plugin->hook_fetch_feed($feed_data, $fetch_url, $owner_uid, $feed, 0, $auth_login, $auth_pass); |
| 346 | 346 | Debug::log(sprintf("=== %.4f (sec)", microtime(true) - $start), Debug::$LOG_VERBOSE); |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | $feed_data = trim($feed_data); |
| 403 | 403 | |
| 404 | 404 | Debug::log("fetch done.", Debug::$LOG_VERBOSE); |
| 405 | - Debug::log("source last modified: " . $fetch_last_modified, Debug::$LOG_VERBOSE); |
|
| 405 | + Debug::log("source last modified: ".$fetch_last_modified, Debug::$LOG_VERBOSE); |
|
| 406 | 406 | |
| 407 | 407 | if ($feed_data && $fetch_last_modified != $stored_last_modified) { |
| 408 | 408 | $sth = $pdo->prepare("UPDATE ttrss_feeds SET last_modified = ? WHERE id = ?"); |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | // cache vanilla feed data for re-use |
| 413 | - if ($feed_data && !$auth_pass && !$auth_login && is_writable(CACHE_DIR . "/feeds")) { |
|
| 413 | + if ($feed_data && !$auth_pass && !$auth_login && is_writable(CACHE_DIR."/feeds")) { |
|
| 414 | 414 | $new_rss_hash = sha1($feed_data); |
| 415 | 415 | |
| 416 | 416 | if ($new_rss_hash != $rss_hash) { |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | $feed_data_checksum = md5($feed_data); |
| 446 | 446 | |
| 447 | 447 | foreach ($pluginhost->get_hooks(PluginHost::HOOK_FEED_FETCHED) as $plugin) { |
| 448 | - Debug::log("... " . get_class($plugin), Debug::$LOG_VERBOSE); |
|
| 448 | + Debug::log("... ".get_class($plugin), Debug::$LOG_VERBOSE); |
|
| 449 | 449 | $start = microtime(true); |
| 450 | 450 | $feed_data = $plugin->hook_feed_fetched($feed_data, $fetch_url, $owner_uid, $feed); |
| 451 | 451 | Debug::log(sprintf("=== %.4f (sec)", microtime(true) - $start), Debug::$LOG_VERBOSE); |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | // We use local pluginhost here because we need to load different per-user feed plugins |
| 468 | 468 | |
| 469 | 469 | foreach ($pluginhost->get_hooks(PluginHost::HOOK_FEED_PARSED) as $plugin) { |
| 470 | - Debug::log("... " . get_class($plugin), Debug::$LOG_VERBOSE); |
|
| 470 | + Debug::log("... ".get_class($plugin), Debug::$LOG_VERBOSE); |
|
| 471 | 471 | $start = microtime(true); |
| 472 | 472 | $plugin->hook_feed_parsed($rss); |
| 473 | 473 | Debug::log(sprintf("=== %.4f (sec)", microtime(true) - $start), Debug::$LOG_VERBOSE); |
@@ -499,14 +499,14 @@ discard block |
||
| 499 | 499 | $site_url = mb_substr(rewrite_relative_url($fetch_url, clean($rss->get_link())), 0, 245); |
| 500 | 500 | |
| 501 | 501 | Debug::log("site_url: $site_url", Debug::$LOG_VERBOSE); |
| 502 | - Debug::log("feed_title: " . clean($rss->get_title()), Debug::$LOG_VERBOSE); |
|
| 502 | + Debug::log("feed_title: ".clean($rss->get_title()), Debug::$LOG_VERBOSE); |
|
| 503 | 503 | |
| 504 | 504 | if ($favicon_needs_check || $force_refetch) { |
| 505 | 505 | |
| 506 | 506 | /* terrible hack: if we crash on floicon shit here, we won't check |
| 507 | 507 | * the icon avgcolor again (unless the icon got updated) */ |
| 508 | 508 | |
| 509 | - $favicon_file = ICONS_DIR . "/$feed.ico"; |
|
| 509 | + $favicon_file = ICONS_DIR."/$feed.ico"; |
|
| 510 | 510 | $favicon_modified = @filemtime($favicon_file); |
| 511 | 511 | |
| 512 | 512 | Debug::log("checking favicon...", Debug::$LOG_VERBOSE); |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | |
| 528 | 528 | $favicon_color = calculate_avg_color($favicon_file); |
| 529 | 529 | |
| 530 | - $favicon_colorstring = ",favicon_avg_color = " . $pdo->quote($favicon_color); |
|
| 530 | + $favicon_colorstring = ",favicon_avg_color = ".$pdo->quote($favicon_color); |
|
| 531 | 531 | |
| 532 | 532 | } else if ($favicon_avg_color == 'fail') { |
| 533 | 533 | Debug::log("floicon failed on this file, not trying to recalculate avg color", Debug::$LOG_VERBOSE); |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | print_r($filters); |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | - Debug::log("" . count($filters) . " filters loaded.", Debug::$LOG_VERBOSE); |
|
| 549 | + Debug::log("".count($filters)." filters loaded.", Debug::$LOG_VERBOSE); |
|
| 550 | 550 | |
| 551 | 551 | $items = $rss->get_items(); |
| 552 | 552 | |
@@ -588,13 +588,13 @@ discard block |
||
| 588 | 588 | |
| 589 | 589 | $entry_guid = "$owner_uid,$entry_guid"; |
| 590 | 590 | |
| 591 | - $entry_guid_hashed = 'SHA1:' . sha1($entry_guid); |
|
| 591 | + $entry_guid_hashed = 'SHA1:'.sha1($entry_guid); |
|
| 592 | 592 | |
| 593 | 593 | Debug::log("guid $entry_guid / $entry_guid_hashed", Debug::$LOG_VERBOSE); |
| 594 | 594 | |
| 595 | - $entry_timestamp = (int)$item->get_date(); |
|
| 595 | + $entry_timestamp = (int) $item->get_date(); |
|
| 596 | 596 | |
| 597 | - Debug::log("orig date: " . $item->get_date(), Debug::$LOG_VERBOSE); |
|
| 597 | + Debug::log("orig date: ".$item->get_date(), Debug::$LOG_VERBOSE); |
|
| 598 | 598 | |
| 599 | 599 | $entry_title = strip_tags($item->get_title()); |
| 600 | 600 | |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | Debug::log("link $entry_link", Debug::$LOG_VERBOSE); |
| 607 | 607 | Debug::log("language $entry_language", Debug::$LOG_VERBOSE); |
| 608 | 608 | |
| 609 | - if (!$entry_title) $entry_title = date("Y-m-d H:i:s", $entry_timestamp);; |
|
| 609 | + if (!$entry_title) $entry_title = date("Y-m-d H:i:s", $entry_timestamp); ; |
|
| 610 | 610 | |
| 611 | 611 | $entry_content = $item->get_content(); |
| 612 | 612 | if (!$entry_content) $entry_content = $item->get_description(); |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | Debug::log("looking for tags...", Debug::$LOG_VERBOSE); |
| 628 | 628 | |
| 629 | 629 | $entry_tags = $item->get_categories(); |
| 630 | - Debug::log("tags found: " . join(", ", $entry_tags), Debug::$LOG_VERBOSE); |
|
| 630 | + Debug::log("tags found: ".join(", ", $entry_tags), Debug::$LOG_VERBOSE); |
|
| 631 | 631 | |
| 632 | 632 | Debug::log("done collecting data.", Debug::$LOG_VERBOSE); |
| 633 | 633 | |
@@ -692,14 +692,14 @@ discard block |
||
| 692 | 692 | Debug::log("hash differs, applying plugin filters:", Debug::$LOG_VERBOSE); |
| 693 | 693 | |
| 694 | 694 | foreach ($pluginhost->get_hooks(PluginHost::HOOK_ARTICLE_FILTER) as $plugin) { |
| 695 | - Debug::log("... " . get_class($plugin), Debug::$LOG_VERBOSE); |
|
| 695 | + Debug::log("... ".get_class($plugin), Debug::$LOG_VERBOSE); |
|
| 696 | 696 | |
| 697 | 697 | $start = microtime(true); |
| 698 | 698 | $article = $plugin->hook_article_filter($article); |
| 699 | 699 | |
| 700 | 700 | Debug::log(sprintf("=== %.4f (sec)", microtime(true) - $start), Debug::$LOG_VERBOSE); |
| 701 | 701 | |
| 702 | - $entry_plugin_data .= mb_strtolower(get_class($plugin)) . ","; |
|
| 702 | + $entry_plugin_data .= mb_strtolower(get_class($plugin)).","; |
|
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | if (Debug::get_loglevel() >= 3) { |
@@ -772,7 +772,7 @@ discard block |
||
| 772 | 772 | Debug::log("applying plugin filter actions...", Debug::$LOG_VERBOSE); |
| 773 | 773 | |
| 774 | 774 | foreach ($plugin_filter_names as $pfn) { |
| 775 | - list($pfclass,$pfaction) = explode(":", $pfn["param"]); |
|
| 775 | + list($pfclass, $pfaction) = explode(":", $pfn["param"]); |
|
| 776 | 776 | |
| 777 | 777 | if (isset($plugin_filter_actions[$pfclass])) { |
| 778 | 778 | $plugin = $pluginhost->get_plugin($pfclass); |
@@ -867,7 +867,7 @@ discard block |
||
| 867 | 867 | $entry_current_hash, |
| 868 | 868 | $date_feed_processed, |
| 869 | 869 | $entry_comments, |
| 870 | - (int)$num_comments, |
|
| 870 | + (int) $num_comments, |
|
| 871 | 871 | $entry_plugin_data, |
| 872 | 872 | "$entry_language", |
| 873 | 873 | "$entry_author"]); |
@@ -979,7 +979,7 @@ discard block |
||
| 979 | 979 | ":content" => "$entry_content", |
| 980 | 980 | ":content_hash" => $entry_current_hash, |
| 981 | 981 | ":updated" => $entry_timestamp_fmt, |
| 982 | - ":num_comments" => (int)$num_comments, |
|
| 982 | + ":num_comments" => (int) $num_comments, |
|
| 983 | 983 | ":plugin_data" => $entry_plugin_data, |
| 984 | 984 | ":author" => "$entry_author", |
| 985 | 985 | ":lang" => $entry_language, |
@@ -987,7 +987,7 @@ discard block |
||
| 987 | 987 | |
| 988 | 988 | if (DB_TYPE == "pgsql") { |
| 989 | 989 | $params[":ts_lang"] = $feed_language; |
| 990 | - $params[":ts_content"] = mb_substr(strip_tags($entry_title . " " . $entry_content), 0, 900000); |
|
| 990 | + $params[":ts_content"] = mb_substr(strip_tags($entry_title." ".$entry_content), 0, 900000); |
|
| 991 | 991 | } |
| 992 | 992 | |
| 993 | 993 | $sth->execute($params); |
@@ -1067,7 +1067,7 @@ discard block |
||
| 1067 | 1067 | foreach ($enclosures as $enc) { |
| 1068 | 1068 | $enc_url = $enc[0]; |
| 1069 | 1069 | $enc_type = $enc[1]; |
| 1070 | - $enc_dur = (int)$enc[2]; |
|
| 1070 | + $enc_dur = (int) $enc[2]; |
|
| 1071 | 1071 | $enc_title = $enc[3]; |
| 1072 | 1072 | $enc_width = intval($enc[4]); |
| 1073 | 1073 | $enc_height = intval($enc[5]); |
@@ -1075,7 +1075,7 @@ discard block |
||
| 1075 | 1075 | $esth->execute([$enc_url, $enc_type, $entry_ref_id]); |
| 1076 | 1076 | |
| 1077 | 1077 | if (!$esth->fetch()) { |
| 1078 | - $usth->execute([$enc_url, $enc_type, (string)$enc_title, $enc_dur, $entry_ref_id, $enc_width, $enc_height]); |
|
| 1078 | + $usth->execute([$enc_url, $enc_type, (string) $enc_title, $enc_dur, $entry_ref_id, $enc_width, $enc_height]); |
|
| 1079 | 1079 | } |
| 1080 | 1080 | } |
| 1081 | 1081 | |
@@ -1109,7 +1109,7 @@ discard block |
||
| 1109 | 1109 | $filtered_tags = array_unique($filtered_tags); |
| 1110 | 1110 | |
| 1111 | 1111 | if (Debug::get_loglevel() >= Debug::$LOG_VERBOSE) { |
| 1112 | - Debug::log("filtered tags: " . implode(", ", $filtered_tags), Debug::$LOG_VERBOSE); |
|
| 1112 | + Debug::log("filtered tags: ".implode(", ", $filtered_tags), Debug::$LOG_VERBOSE); |
|
| 1113 | 1113 | |
| 1114 | 1114 | } |
| 1115 | 1115 | |
@@ -1297,11 +1297,11 @@ discard block |
||
| 1297 | 1297 | $num_deleted = 0; |
| 1298 | 1298 | |
| 1299 | 1299 | if (is_writable(LOCK_DIRECTORY)) { |
| 1300 | - $files = glob(LOCK_DIRECTORY . "/*.lock"); |
|
| 1300 | + $files = glob(LOCK_DIRECTORY."/*.lock"); |
|
| 1301 | 1301 | |
| 1302 | 1302 | if ($files) { |
| 1303 | 1303 | foreach ($files as $file) { |
| 1304 | - if (!file_is_locked(basename($file)) && time() - filemtime($file) > 86400*2) { |
|
| 1304 | + if (!file_is_locked(basename($file)) && time() - filemtime($file) > 86400 * 2) { |
|
| 1305 | 1305 | unlink($file); |
| 1306 | 1306 | ++$num_deleted; |
| 1307 | 1307 | } |
@@ -1516,7 +1516,7 @@ discard block |
||
| 1516 | 1516 | public static function check_feed_favicon($site_url, $feed) { |
| 1517 | 1517 | # print "FAVICON [$site_url]: $favicon_url\n"; |
| 1518 | 1518 | |
| 1519 | - $icon_file = ICONS_DIR . "/$feed.ico"; |
|
| 1519 | + $icon_file = ICONS_DIR."/$feed.ico"; |
|
| 1520 | 1520 | |
| 1521 | 1521 | if (!file_exists($icon_file)) { |
| 1522 | 1522 | $favicon_url = RSSUtils::get_favicon_url($site_url); |
@@ -1570,14 +1570,14 @@ discard block |
||
| 1570 | 1570 | |
| 1571 | 1571 | public static function is_gzipped($feed_data) { |
| 1572 | 1572 | return strpos(substr($feed_data, 0, 3), |
| 1573 | - "\x1f" . "\x8b" . "\x08", 0) === 0; |
|
| 1573 | + "\x1f"."\x8b"."\x08", 0) === 0; |
|
| 1574 | 1574 | } |
| 1575 | 1575 | |
| 1576 | 1576 | public static function load_filters($feed_id, $owner_uid) { |
| 1577 | 1577 | $filters = array(); |
| 1578 | 1578 | |
| 1579 | 1579 | $feed_id = (int) $feed_id; |
| 1580 | - $cat_id = (int)Feeds::getFeedCategory($feed_id); |
|
| 1580 | + $cat_id = (int) Feeds::getFeedCategory($feed_id); |
|
| 1581 | 1581 | |
| 1582 | 1582 | if ($cat_id == 0) |
| 1583 | 1583 | $null_cat_qpart = "cat_id IS NULL OR"; |
@@ -57,13 +57,13 @@ discard block |
||
| 57 | 57 | print "<fieldset class='narrow'>"; |
| 58 | 58 | print "<label class='checkbox'>"; |
| 59 | 59 | print_checkbox("enable_readability", $enable_readability); |
| 60 | - print " " . __("Extract missing content using Readability (requires af_readability)") . "</label>"; |
|
| 60 | + print " ".__("Extract missing content using Readability (requires af_readability)")."</label>"; |
|
| 61 | 61 | print "</fieldset>"; |
| 62 | 62 | |
| 63 | 63 | print "<fieldset class='narrow'>"; |
| 64 | 64 | print "<label class='checkbox'>"; |
| 65 | 65 | print_checkbox("enable_content_dupcheck", $enable_content_dupcheck); |
| 66 | - print " " . __("Enable additional duplicate checking") . "</label>"; |
|
| 66 | + print " ".__("Enable additional duplicate checking")."</label>"; |
|
| 67 | 67 | print "</fieldset>"; |
| 68 | 68 | |
| 69 | 69 | print_button("submit", __("Save"), 'class="alt-primary"'); |
@@ -96,14 +96,14 @@ discard block |
||
| 96 | 96 | foreach ($entries as $entry) { |
| 97 | 97 | if ($entry->hasAttribute("href") && strpos($entry->getAttribute("href"), "reddit.com") === false) { |
| 98 | 98 | |
| 99 | - Debug::log("processing href: " . $entry->getAttribute("href"), Debug::$LOG_VERBOSE); |
|
| 99 | + Debug::log("processing href: ".$entry->getAttribute("href"), Debug::$LOG_VERBOSE); |
|
| 100 | 100 | |
| 101 | 101 | $matches = array(); |
| 102 | 102 | |
| 103 | 103 | if (!$found && preg_match("/^https?:\/\/twitter.com\/(.*?)\/status\/(.*)/", $entry->getAttribute("href"), $matches)) { |
| 104 | - Debug::log("handling as twitter: " . $matches[1] . " " . $matches[2], Debug::$LOG_VERBOSE); |
|
| 104 | + Debug::log("handling as twitter: ".$matches[1]." ".$matches[2], Debug::$LOG_VERBOSE); |
|
| 105 | 105 | |
| 106 | - $oembed_result = fetch_file_contents("https://publish.twitter.com/oembed?url=" . urlencode($entry->getAttribute("href"))); |
|
| 106 | + $oembed_result = fetch_file_contents("https://publish.twitter.com/oembed?url=".urlencode($entry->getAttribute("href"))); |
|
| 107 | 107 | |
| 108 | 108 | if ($oembed_result) { |
| 109 | 109 | $oembed_result = json_decode($oembed_result, true); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | if ($oembed_result && isset($oembed_result["html"])) { |
| 112 | 112 | |
| 113 | 113 | $tmp = new DOMDocument(); |
| 114 | - if ($tmp->loadHTML('<?xml encoding="utf-8" ?>' . $oembed_result["html"])) { |
|
| 114 | + if ($tmp->loadHTML('<?xml encoding="utf-8" ?>'.$oembed_result["html"])) { |
|
| 115 | 115 | $p = $doc->createElement("p"); |
| 116 | 116 | |
| 117 | 117 | $p->appendChild($doc->importNode( |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | Debug::log("Handling as Gfycat", Debug::$LOG_VERBOSE); |
| 137 | 137 | |
| 138 | - $source_stream = 'https://giant.gfycat.com/' . $matches[2] . '.mp4'; |
|
| 139 | - $poster_url = 'https://thumbs.gfycat.com/' . $matches[2] . '-mobile.jpg'; |
|
| 138 | + $source_stream = 'https://giant.gfycat.com/'.$matches[2].'.mp4'; |
|
| 139 | + $poster_url = 'https://thumbs.gfycat.com/'.$matches[2].'-mobile.jpg'; |
|
| 140 | 140 | |
| 141 | 141 | $content_type = $this->get_content_type($source_stream); |
| 142 | 142 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | if (!$source_stream) { |
| 187 | - $source_stream = "https://v.redd.it/" . $matches[1] . "/DASH_600_K"; |
|
| 187 | + $source_stream = "https://v.redd.it/".$matches[1]."/DASH_600_K"; |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | $this->handle_as_video($doc, $entry, $source_stream, $poster_url); |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | |
| 543 | 543 | // do not try to embed posts linking back to other reddit posts |
| 544 | 544 | // readability.php requires PHP 5.6 |
| 545 | - if ($url && strpos($url, "reddit.com") === false && version_compare(PHP_VERSION, '5.6.0', '>=')) { |
|
| 545 | + if ($url && strpos($url, "reddit.com") === false && version_compare(PHP_VERSION, '5.6.0', '>=')) { |
|
| 546 | 546 | |
| 547 | 547 | /* link may lead to a huge video file or whatever, we need to check content type before trying to |
| 548 | 548 | parse it which p much requires curl */ |
@@ -69,17 +69,17 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | /* not really important, this one; perhaps I could've put it inline with |
| 71 | 71 | * the rest. */ |
| 72 | -function find_match($curlscore,$curcscore,$curgtlang,$langval,$charval, |
|
| 72 | +function find_match($curlscore, $curcscore, $curgtlang, $langval, $charval, |
|
| 73 | 73 | $gtlang) |
| 74 | 74 | { |
| 75 | - if($curlscore < $langval) { |
|
| 76 | - $curlscore=$langval; |
|
| 77 | - $curcscore=$charval; |
|
| 78 | - $curgtlang=$gtlang; |
|
| 75 | + if ($curlscore < $langval) { |
|
| 76 | + $curlscore = $langval; |
|
| 77 | + $curcscore = $charval; |
|
| 78 | + $curgtlang = $gtlang; |
|
| 79 | 79 | } else if ($curlscore == $langval) { |
| 80 | - if($curcscore < $charval) { |
|
| 81 | - $curcscore=$charval; |
|
| 82 | - $curgtlang=$gtlang; |
|
| 80 | + if ($curcscore < $charval) { |
|
| 81 | + $curcscore = $charval; |
|
| 82 | + $curgtlang = $gtlang; |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | return array($curlscore, $curcscore, $curgtlang); |
@@ -87,22 +87,20 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | function al2gt($gettextlangs, $mime) { |
| 89 | 89 | /* default to "everything is acceptable", as RFC2616 specifies */ |
| 90 | - $acceptLang=(($_SERVER["HTTP_ACCEPT_LANGUAGE"] == '') ? '*' : |
|
| 91 | - $_SERVER["HTTP_ACCEPT_LANGUAGE"]); |
|
| 92 | - $acceptChar=(($_SERVER["HTTP_ACCEPT_CHARSET"] == '') ? '*' : |
|
| 93 | - $_SERVER["HTTP_ACCEPT_CHARSET"]); |
|
| 94 | - $alparts=@preg_split("/,/",$acceptLang); |
|
| 95 | - $acparts=@preg_split("/,/",$acceptChar); |
|
| 90 | + $acceptLang = (($_SERVER["HTTP_ACCEPT_LANGUAGE"] == '') ? '*' : $_SERVER["HTTP_ACCEPT_LANGUAGE"]); |
|
| 91 | + $acceptChar = (($_SERVER["HTTP_ACCEPT_CHARSET"] == '') ? '*' : $_SERVER["HTTP_ACCEPT_CHARSET"]); |
|
| 92 | + $alparts = @preg_split("/,/", $acceptLang); |
|
| 93 | + $acparts = @preg_split("/,/", $acceptChar); |
|
| 96 | 94 | |
| 97 | 95 | /* Parse the contents of the Accept-Language header.*/ |
| 98 | - foreach($alparts as $part) { |
|
| 99 | - $part=trim($part); |
|
| 100 | - if(preg_match("/;/", $part)) { |
|
| 101 | - $lang=@preg_split("/;/",$part); |
|
| 102 | - $score=@preg_split("/=/",$lang[1]); |
|
| 103 | - $alscores[$lang[0]]=$score[1]; |
|
| 96 | + foreach ($alparts as $part) { |
|
| 97 | + $part = trim($part); |
|
| 98 | + if (preg_match("/;/", $part)) { |
|
| 99 | + $lang = @preg_split("/;/", $part); |
|
| 100 | + $score = @preg_split("/=/", $lang[1]); |
|
| 101 | + $alscores[$lang[0]] = $score[1]; |
|
| 104 | 102 | } else { |
| 105 | - $alscores[$part]=1; |
|
| 103 | + $alscores[$part] = 1; |
|
| 106 | 104 | } |
| 107 | 105 | } |
| 108 | 106 | |
@@ -116,20 +114,20 @@ discard block |
||
| 116 | 114 | * Making it 2 for the time being, so that we |
| 117 | 115 | * can distinguish between "not specified" and "specified as 1" later |
| 118 | 116 | * on. */ |
| 119 | - $acscores["ISO-8859-1"]=2; |
|
| 117 | + $acscores["ISO-8859-1"] = 2; |
|
| 120 | 118 | |
| 121 | - foreach($acparts as $part) { |
|
| 122 | - $part=trim($part); |
|
| 123 | - if(preg_match("/;/", $part)) { |
|
| 124 | - $cs=@preg_split("/;/",$part); |
|
| 125 | - $score=@preg_split("/=/",$cs[1]); |
|
| 126 | - $acscores[strtoupper($cs[0])]=$score[1]; |
|
| 119 | + foreach ($acparts as $part) { |
|
| 120 | + $part = trim($part); |
|
| 121 | + if (preg_match("/;/", $part)) { |
|
| 122 | + $cs = @preg_split("/;/", $part); |
|
| 123 | + $score = @preg_split("/=/", $cs[1]); |
|
| 124 | + $acscores[strtoupper($cs[0])] = $score[1]; |
|
| 127 | 125 | } else { |
| 128 | - $acscores[strtoupper($part)]=1; |
|
| 126 | + $acscores[strtoupper($part)] = 1; |
|
| 129 | 127 | } |
| 130 | 128 | } |
| 131 | - if($acscores["ISO-8859-1"]==2) { |
|
| 132 | - $acscores["ISO-8859-1"]=(isset($acscores["*"])?$acscores["*"]:1); |
|
| 129 | + if ($acscores["ISO-8859-1"] == 2) { |
|
| 130 | + $acscores["ISO-8859-1"] = (isset($acscores["*"]) ? $acscores["*"] : 1); |
|
| 133 | 131 | } |
| 134 | 132 | |
| 135 | 133 | /* |
@@ -137,18 +135,18 @@ discard block |
||
| 137 | 135 | * with the highest score, excluding the ones with a charset the user |
| 138 | 136 | * did not include. |
| 139 | 137 | */ |
| 140 | - $curlscore=0; |
|
| 141 | - $curcscore=0; |
|
| 142 | - $curgtlang=null; |
|
| 143 | - foreach($gettextlangs as $gtlang) { |
|
| 138 | + $curlscore = 0; |
|
| 139 | + $curcscore = 0; |
|
| 140 | + $curgtlang = null; |
|
| 141 | + foreach ($gettextlangs as $gtlang) { |
|
| 144 | 142 | |
| 145 | - $tmp1=preg_replace("/\_/","-",$gtlang); |
|
| 146 | - $tmp2=@preg_split("/\./",$tmp1); |
|
| 147 | - $allang=strtolower($tmp2[0]); |
|
| 148 | - $gtcs=strtoupper($tmp2[1]); |
|
| 149 | - $noct=@preg_split("/-/",$allang); |
|
| 143 | + $tmp1 = preg_replace("/\_/", "-", $gtlang); |
|
| 144 | + $tmp2 = @preg_split("/\./", $tmp1); |
|
| 145 | + $allang = strtolower($tmp2[0]); |
|
| 146 | + $gtcs = strtoupper($tmp2[1]); |
|
| 147 | + $noct = @preg_split("/-/", $allang); |
|
| 150 | 148 | |
| 151 | - $testvals=array( |
|
| 149 | + $testvals = array( |
|
| 152 | 150 | array(@$alscores[$allang], @$acscores[$gtcs]), |
| 153 | 151 | array(@$alscores[$noct[0]], @$acscores[$gtcs]), |
| 154 | 152 | array(@$alscores[$allang], @$acscores["*"]), |
@@ -156,15 +154,15 @@ discard block |
||
| 156 | 154 | array(@$alscores["*"], @$acscores[$gtcs]), |
| 157 | 155 | array(@$alscores["*"], @$acscores["*"])); |
| 158 | 156 | |
| 159 | - $found=false; |
|
| 160 | - foreach($testvals as $tval) { |
|
| 161 | - if(!$found && isset($tval[0]) && isset($tval[1])) { |
|
| 162 | - $arr=find_match($curlscore, $curcscore, $curgtlang, $tval[0], |
|
| 157 | + $found = false; |
|
| 158 | + foreach ($testvals as $tval) { |
|
| 159 | + if (!$found && isset($tval[0]) && isset($tval[1])) { |
|
| 160 | + $arr = find_match($curlscore, $curcscore, $curgtlang, $tval[0], |
|
| 163 | 161 | $tval[1], $gtlang); |
| 164 | - $curlscore=$arr[0]; |
|
| 165 | - $curcscore=$arr[1]; |
|
| 166 | - $curgtlang=$arr[2]; |
|
| 167 | - $found=true; |
|
| 162 | + $curlscore = $arr[0]; |
|
| 163 | + $curcscore = $arr[1]; |
|
| 164 | + $curgtlang = $arr[2]; |
|
| 165 | + $found = true; |
|
| 168 | 166 | } |
| 169 | 167 | } |
| 170 | 168 | } |
@@ -172,10 +170,10 @@ discard block |
||
| 172 | 170 | /* We must re-parse the gettext-string now, since we may have found it |
| 173 | 171 | * through a "*" qualifier.*/ |
| 174 | 172 | |
| 175 | - $gtparts=@preg_split("/\./",$curgtlang); |
|
| 176 | - $tmp=strtolower($gtparts[0]); |
|
| 177 | - $lang=preg_replace("/\_/", "-", $tmp); |
|
| 178 | - $charset=$gtparts[1]; |
|
| 173 | + $gtparts = @preg_split("/\./", $curgtlang); |
|
| 174 | + $tmp = strtolower($gtparts[0]); |
|
| 175 | + $lang = preg_replace("/\_/", "-", $tmp); |
|
| 176 | + $charset = $gtparts[1]; |
|
| 179 | 177 | |
| 180 | 178 | header("Content-Language: $lang"); |
| 181 | 179 | header("Content-Type: $mime; charset=$charset"); |
@@ -58,10 +58,10 @@ discard block |
||
| 58 | 58 | //---------------------------------------------------------------------- |
| 59 | 59 | public function __construct(QRinput $input) |
| 60 | 60 | {
|
| 61 | - $spec = array(0,0,0,0,0); |
|
| 61 | + $spec = array(0, 0, 0, 0, 0); |
|
| 62 | 62 | |
| 63 | 63 | $this->datacode = $input->getByteStream(); |
| 64 | - if(is_null($this->datacode)) {
|
|
| 64 | + if (is_null($this->datacode)) {
|
|
| 65 | 65 | throw new Exception('null imput string');
|
| 66 | 66 | } |
| 67 | 67 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $this->blocks = QRspec::rsBlockNum($spec); |
| 76 | 76 | |
| 77 | 77 | $ret = $this->init($spec); |
| 78 | - if($ret < 0) {
|
|
| 78 | + if ($ret < 0) {
|
|
| 79 | 79 | throw new Exception('block alloc error');
|
| 80 | 80 | return null; |
| 81 | 81 | } |
@@ -94,29 +94,29 @@ discard block |
||
| 94 | 94 | $blockNo = 0; |
| 95 | 95 | $dataPos = 0; |
| 96 | 96 | $eccPos = 0; |
| 97 | - for($i=0; $i<QRspec::rsBlockNum1($spec); $i++) {
|
|
| 98 | - $ecc = array_slice($this->ecccode,$eccPos); |
|
| 99 | - $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs); |
|
| 100 | - $this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc); |
|
| 97 | + for ($i = 0; $i < QRspec::rsBlockNum1($spec); $i++) {
|
|
| 98 | + $ecc = array_slice($this->ecccode, $eccPos); |
|
| 99 | + $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs); |
|
| 100 | + $this->ecccode = array_merge(array_slice($this->ecccode, 0, $eccPos), $ecc); |
|
| 101 | 101 | |
| 102 | 102 | $dataPos += $dl; |
| 103 | 103 | $eccPos += $el; |
| 104 | 104 | $blockNo++; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - if(QRspec::rsBlockNum2($spec) == 0) |
|
| 107 | + if (QRspec::rsBlockNum2($spec) == 0) |
|
| 108 | 108 | return 0; |
| 109 | 109 | |
| 110 | 110 | $dl = QRspec::rsDataCodes2($spec); |
| 111 | 111 | $el = QRspec::rsEccCodes2($spec); |
| 112 | 112 | $rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el); |
| 113 | 113 | |
| 114 | - if($rs == null) return -1; |
|
| 114 | + if ($rs == null) return -1; |
|
| 115 | 115 | |
| 116 | - for($i=0; $i<QRspec::rsBlockNum2($spec); $i++) {
|
|
| 117 | - $ecc = array_slice($this->ecccode,$eccPos); |
|
| 116 | + for ($i = 0; $i < QRspec::rsBlockNum2($spec); $i++) {
|
|
| 117 | + $ecc = array_slice($this->ecccode, $eccPos); |
|
| 118 | 118 | $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs); |
| 119 | - $this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc); |
|
| 119 | + $this->ecccode = array_merge(array_slice($this->ecccode, 0, $eccPos), $ecc); |
|
| 120 | 120 | |
| 121 | 121 | $dataPos += $dl; |
| 122 | 122 | $eccPos += $el; |
@@ -131,14 +131,14 @@ discard block |
||
| 131 | 131 | {
|
| 132 | 132 | $ret = 0; |
| 133 | 133 | |
| 134 | - if($this->count < $this->dataLength) {
|
|
| 134 | + if ($this->count < $this->dataLength) {
|
|
| 135 | 135 | $row = $this->count % $this->blocks; |
| 136 | 136 | $col = $this->count / $this->blocks; |
| 137 | - if($col >= $this->rsblocks[0]->dataLength) {
|
|
| 137 | + if ($col >= $this->rsblocks[0]->dataLength) {
|
|
| 138 | 138 | $row += $this->b1; |
| 139 | 139 | } |
| 140 | 140 | $ret = $this->rsblocks[$row]->data[$col]; |
| 141 | - } else if($this->count < $this->dataLength + $this->eccLength) {
|
|
| 141 | + } else if ($this->count < $this->dataLength + $this->eccLength) {
|
|
| 142 | 142 | $row = ($this->count - $this->dataLength) % $this->blocks; |
| 143 | 143 | $col = ($this->count - $this->dataLength) / $this->blocks; |
| 144 | 144 | $ret = $this->rsblocks[$row]->ecc[$col]; |
@@ -162,10 +162,10 @@ discard block |
||
| 162 | 162 | //---------------------------------------------------------------------- |
| 163 | 163 | public function encodeMask(QRinput $input, $mask) |
| 164 | 164 | {
|
| 165 | - if($input->getVersion() < 0 || $input->getVersion() > QRSPEC_VERSION_MAX) {
|
|
| 165 | + if ($input->getVersion() < 0 || $input->getVersion() > QRSPEC_VERSION_MAX) {
|
|
| 166 | 166 | throw new Exception('wrong version');
|
| 167 | 167 | } |
| 168 | - if($input->getErrorCorrectionLevel() > QR_ECLEVEL_H) {
|
|
| 168 | + if ($input->getErrorCorrectionLevel() > QR_ECLEVEL_H) {
|
|
| 169 | 169 | throw new Exception('wrong level');
|
| 170 | 170 | } |
| 171 | 171 | |
@@ -178,15 +178,15 @@ discard block |
||
| 178 | 178 | $frame = QRspec::newFrame($version); |
| 179 | 179 | |
| 180 | 180 | $filler = new FrameFiller($width, $frame); |
| 181 | - if(is_null($filler)) {
|
|
| 181 | + if (is_null($filler)) {
|
|
| 182 | 182 | return null; |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | // inteleaved data and ecc codes |
| 186 | - for($i=0; $i<$raw->dataLength + $raw->eccLength; $i++) {
|
|
| 186 | + for ($i = 0; $i < $raw->dataLength + $raw->eccLength; $i++) {
|
|
| 187 | 187 | $code = $raw->getCode(); |
| 188 | 188 | $bit = 0x80; |
| 189 | - for($j=0; $j<8; $j++) {
|
|
| 189 | + for ($j = 0; $j < 8; $j++) {
|
|
| 190 | 190 | $addr = $filler->next(); |
| 191 | 191 | $filler->setFrameAt($addr, 0x02 | (($bit & $code) != 0)); |
| 192 | 192 | $bit = $bit >> 1; |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | // remainder bits |
| 201 | 201 | $j = QRspec::getRemainder($version); |
| 202 | - for($i=0; $i<$j; $i++) {
|
|
| 202 | + for ($i = 0; $i < $j; $i++) {
|
|
| 203 | 203 | $addr = $filler->next(); |
| 204 | 204 | $filler->setFrameAt($addr, 0x02); |
| 205 | 205 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | // masking |
| 212 | 212 | $maskObj = new QRmask(); |
| 213 | - if($mask < 0) {
|
|
| 213 | + if ($mask < 0) {
|
|
| 214 | 214 | |
| 215 | 215 | if (QR_FIND_BEST_MASK) {
|
| 216 | 216 | $masked = $maskObj->mask($width, $frame, $input->getErrorCorrectionLevel()); |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | $masked = $maskObj->makeMask($width, $frame, $mask, $input->getErrorCorrectionLevel()); |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - if($masked == null) {
|
|
| 224 | + if ($masked == null) {
|
|
| 225 | 225 | return null; |
| 226 | 226 | } |
| 227 | 227 | |
@@ -243,16 +243,16 @@ discard block |
||
| 243 | 243 | //---------------------------------------------------------------------- |
| 244 | 244 | public function encodeString8bit($string, $version, $level) |
| 245 | 245 | {
|
| 246 | - if(string == null) {
|
|
| 246 | + if (string == null) {
|
|
| 247 | 247 | throw new Exception('empty string!');
|
| 248 | 248 | return null; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | $input = new QRinput($version, $level); |
| 252 | - if($input == null) return null; |
|
| 252 | + if ($input == null) return null; |
|
| 253 | 253 | |
| 254 | 254 | $ret = $input->append($input, QR_MODE_8, strlen($string), str_split($string)); |
| 255 | - if($ret < 0) {
|
|
| 255 | + if ($ret < 0) {
|
|
| 256 | 256 | unset($input); |
| 257 | 257 | return null; |
| 258 | 258 | } |
@@ -263,16 +263,16 @@ discard block |
||
| 263 | 263 | public function encodeString($string, $version, $level, $hint, $casesensitive) |
| 264 | 264 | {
|
| 265 | 265 | |
| 266 | - if($hint != QR_MODE_8 && $hint != QR_MODE_KANJI) {
|
|
| 266 | + if ($hint != QR_MODE_8 && $hint != QR_MODE_KANJI) {
|
|
| 267 | 267 | throw new Exception('bad hint');
|
| 268 | 268 | return null; |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | $input = new QRinput($version, $level); |
| 272 | - if($input == null) return null; |
|
| 272 | + if ($input == null) return null; |
|
| 273 | 273 | |
| 274 | 274 | $ret = QRsplit::splitStringToQRinput($string, $input, $hint, $casesensitive); |
| 275 | - if($ret < 0) {
|
|
| 275 | + if ($ret < 0) {
|
|
| 276 | 276 | return null; |
| 277 | 277 | } |
| 278 | 278 | |
@@ -280,10 +280,10 @@ discard block |
||
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | //---------------------------------------------------------------------- |
| 283 | - public static function png($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint=false) |
|
| 283 | + public static function png($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint = false) |
|
| 284 | 284 | {
|
| 285 | 285 | $enc = QRencode::factory($level, $size, $margin); |
| 286 | - return $enc->encodePNG($text, $outfile, $saveandprint=false); |
|
| 286 | + return $enc->encodePNG($text, $outfile, $saveandprint = false); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | //---------------------------------------------------------------------- |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | {
|
| 341 | 341 | do {
|
| 342 | 342 | |
| 343 | - if($this->bit == -1) {
|
|
| 343 | + if ($this->bit == -1) {
|
|
| 344 | 344 | $this->bit = 0; |
| 345 | 345 | return array('x'=>$this->x, 'y'=>$this->y);
|
| 346 | 346 | } |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | $y = $this->y; |
| 350 | 350 | $w = $this->width; |
| 351 | 351 | |
| 352 | - if($this->bit == 0) {
|
|
| 352 | + if ($this->bit == 0) {
|
|
| 353 | 353 | $x--; |
| 354 | 354 | $this->bit++; |
| 355 | 355 | } else {
|
@@ -358,33 +358,33 @@ discard block |
||
| 358 | 358 | $this->bit--; |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | - if($this->dir < 0) {
|
|
| 362 | - if($y < 0) {
|
|
| 361 | + if ($this->dir < 0) {
|
|
| 362 | + if ($y < 0) {
|
|
| 363 | 363 | $y = 0; |
| 364 | 364 | $x -= 2; |
| 365 | 365 | $this->dir = 1; |
| 366 | - if($x == 6) {
|
|
| 366 | + if ($x == 6) {
|
|
| 367 | 367 | $x--; |
| 368 | 368 | $y = 9; |
| 369 | 369 | } |
| 370 | 370 | } |
| 371 | 371 | } else {
|
| 372 | - if($y == $w) {
|
|
| 372 | + if ($y == $w) {
|
|
| 373 | 373 | $y = $w - 1; |
| 374 | 374 | $x -= 2; |
| 375 | 375 | $this->dir = -1; |
| 376 | - if($x == 6) {
|
|
| 376 | + if ($x == 6) {
|
|
| 377 | 377 | $x--; |
| 378 | 378 | $y -= 8; |
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | } |
| 382 | - if($x < 0 || $y < 0) return null; |
|
| 382 | + if ($x < 0 || $y < 0) return null; |
|
| 383 | 383 | |
| 384 | 384 | $this->x = $x; |
| 385 | 385 | $this->y = $y; |
| 386 | 386 | |
| 387 | - } while(ord($this->frame[$y][$x]) & 0x80); |
|
| 387 | + } while (ord($this->frame[$y][$x]) & 0x80); |
|
| 388 | 388 | |
| 389 | 389 | return array('x'=>$x, 'y'=>$y);
|
| 390 | 390 | } |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | {
|
| 448 | 448 | $code = new QRcode(); |
| 449 | 449 | |
| 450 | - if($this->eightbit) {
|
|
| 450 | + if ($this->eightbit) {
|
|
| 451 | 451 | $code->encodeString8bit($intext, $this->version, $this->level); |
| 452 | 452 | } else {
|
| 453 | 453 | $code->encodeString($intext, $this->version, $this->level, $this->hint, $this->casesensitive); |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | {
|
| 462 | 462 | $code = new QRcode(); |
| 463 | 463 | |
| 464 | - if($this->eightbit) {
|
|
| 464 | + if ($this->eightbit) {
|
|
| 465 | 465 | $code->encodeString8bit($intext, $this->version, $this->level); |
| 466 | 466 | } else {
|
| 467 | 467 | $code->encodeString($intext, $this->version, $this->level, $this->hint, $this->casesensitive); |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | |
| 470 | 470 | QRtools::markTime('after_encode');
|
| 471 | 471 | |
| 472 | - if ($outfile!== false) {
|
|
| 472 | + if ($outfile !== false) {
|
|
| 473 | 473 | file_put_contents($outfile, join("\n", QRtools::binarize($code->data)));
|
| 474 | 474 | } else {
|
| 475 | 475 | return QRtools::binarize($code->data); |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | //---------------------------------------------------------------------- |
| 480 | - public function encodePNG($intext, $outfile = false,$saveandprint=false) |
|
| 480 | + public function encodePNG($intext, $outfile = false, $saveandprint = false) |
|
| 481 | 481 | {
|
| 482 | 482 | try {
|
| 483 | 483 | |
@@ -489,9 +489,9 @@ discard block |
||
| 489 | 489 | if ($err != '') |
| 490 | 490 | QRtools::log($outfile, $err); |
| 491 | 491 | |
| 492 | - $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin)); |
|
| 492 | + $maxSize = (int) (QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin)); |
|
| 493 | 493 | |
| 494 | - QRimage::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint); |
|
| 494 | + QRimage::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin, $saveandprint); |
|
| 495 | 495 | |
| 496 | 496 | } catch (Exception $e) {
|
| 497 | 497 | |