@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | time() - $preferred_ts <= 7200 |
| 38 | 38 | ) { |
| 39 | 39 | |
| 40 | - Debug::log("Sending digest for UID:" . $line['id'] . " - " . $line["email"]); |
|
| 40 | + Debug::log("Sending digest for UID:".$line['id']." - ".$line["email"]); |
|
| 41 | 41 | |
| 42 | 42 | $do_catchup = get_pref('DIGEST_CATCHUP', $line['id'], false); |
| 43 | 43 | |
@@ -123,13 +123,13 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | $sth = $pdo->prepare("SELECT ttrss_entries.title, |
| 125 | 125 | ttrss_feeds.title AS feed_title, |
| 126 | - COALESCE(ttrss_feed_categories.title, '" . __('Uncategorized') . "') AS cat_title, |
|
| 126 | + COALESCE(ttrss_feed_categories.title, '" . __('Uncategorized')."') AS cat_title, |
|
| 127 | 127 | date_updated, |
| 128 | 128 | ttrss_user_entries.ref_id, |
| 129 | 129 | link, |
| 130 | 130 | score, |
| 131 | 131 | content, |
| 132 | - " . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated |
|
| 132 | + " . SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated |
|
| 133 | 133 | FROM |
| 134 | 134 | ttrss_user_entries,ttrss_entries,ttrss_feeds |
| 135 | 135 | LEFT JOIN |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $user_id); |
| 166 | 166 | |
| 167 | 167 | if (get_pref('ENABLE_FEED_CATS', $user_id)) { |
| 168 | - $line['feed_title'] = $line['cat_title'] . " / " . $line['feed_title']; |
|
| 168 | + $line['feed_title'] = $line['cat_title']." / ".$line['feed_title']; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | $article_labels = Article::get_article_labels($line["ref_id"], $user_id); |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $sth->execute([":uid" => $owner_uid, ":cat" => $feed_id]); |
| 136 | 136 | |
| 137 | 137 | while ($line = $sth->fetch()) { |
| 138 | - CCache::update((int)$line["id"], $owner_uid, false, false); |
|
| 138 | + CCache::update((int) $line["id"], $owner_uid, false, false); |
|
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | $sth->execute([$owner_uid, $feed_id]); |
| 198 | 198 | |
| 199 | 199 | if ($row = $sth->fetch()) { |
| 200 | - CCache::update((int)$row["cat_id"], $owner_uid, true, true, true); |
|
| 200 | + CCache::update((int) $row["cat_id"], $owner_uid, true, true, true); |
|
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | } |
@@ -175,7 +175,7 @@ |
||
| 175 | 175 | |
| 176 | 176 | // we don't support numeric tags |
| 177 | 177 | if (is_numeric($cat)) |
| 178 | - $cat = 't:' . $cat; |
|
| 178 | + $cat = 't:'.$cat; |
|
| 179 | 179 | |
| 180 | 180 | $cat = preg_replace('/[,\'\"]/', "", $cat); |
| 181 | 181 | |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | require_once "lib/MiniTemplator.class.php"; |
| 9 | 9 | |
| 10 | - $note_style = "background-color : #fff7d5; |
|
| 10 | + $note_style = "background-color : #fff7d5; |
|
| 11 | 11 | border-width : 1px; ". |
| 12 | 12 | "padding : 5px; border-style : dashed; border-color : #e7d796;". |
| 13 | 13 | "margin-bottom : 1em; color : #9a8c59;"; |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | $feed_site_url = $qfh_ret[2]; |
| 74 | 74 | /* $last_error = $qfh_ret[3]; */ |
| 75 | 75 | |
| 76 | - $feed_self_url = get_self_url_prefix() . |
|
| 77 | - "/public.php?op=rss&id=$feed&key=" . |
|
| 76 | + $feed_self_url = get_self_url_prefix(). |
|
| 77 | + "/public.php?op=rss&id=$feed&key=". |
|
| 78 | 78 | Feeds::get_feed_access_key($feed, false, $owner_uid); |
| 79 | 79 | |
| 80 | 80 | if (!$feed_site_url) $feed_site_url = get_self_url_prefix(); |
@@ -102,8 +102,7 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | $tpl->setVariable('ARTICLE_ID', |
| 105 | - htmlspecialchars($orig_guid ? $line['link'] : |
|
| 106 | - $this->make_article_tag_uri($line['id'], $line['date_entered'])), true); |
|
| 105 | + htmlspecialchars($orig_guid ? $line['link'] : $this->make_article_tag_uri($line['id'], $line['date_entered'])), true); |
|
| 107 | 106 | $tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true); |
| 108 | 107 | $tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true); |
| 109 | 108 | $tpl->setVariable('ARTICLE_EXCERPT', $line["content_preview"], true); |
@@ -112,7 +111,7 @@ discard block |
||
| 112 | 111 | $feed_site_url, false, $line["id"]); |
| 113 | 112 | |
| 114 | 113 | if ($line['note']) { |
| 115 | - $content = "<div style=\"$note_style\">Article note: " . $line['note'] . "</div>" . |
|
| 114 | + $content = "<div style=\"$note_style\">Article note: ".$line['note']."</div>". |
|
| 116 | 115 | $content; |
| 117 | 116 | $tpl->setVariable('ARTICLE_NOTE', htmlspecialchars($line['note']), true); |
| 118 | 117 | } |
@@ -201,7 +200,7 @@ discard block |
||
| 201 | 200 | $article = array(); |
| 202 | 201 | |
| 203 | 202 | $article['id'] = $line['link']; |
| 204 | - $article['link'] = $line['link']; |
|
| 203 | + $article['link'] = $line['link']; |
|
| 205 | 204 | $article['title'] = $line['title']; |
| 206 | 205 | $article['excerpt'] = $line["content_preview"]; |
| 207 | 206 | $article['content'] = sanitize($line["content"], false, $owner_uid, $feed_site_url, false, $line["id"]); |
@@ -277,13 +276,13 @@ discard block |
||
| 277 | 276 | WHERE ttrss_users.id = ttrss_settings_profiles.owner_uid AND login = ? ORDER BY title"); |
| 278 | 277 | $sth->execute([$login]); |
| 279 | 278 | |
| 280 | - $rv = [ [ "value" => 0, "label" => __("Default profile") ] ]; |
|
| 279 | + $rv = [["value" => 0, "label" => __("Default profile")]]; |
|
| 281 | 280 | |
| 282 | 281 | while ($line = $sth->fetch()) { |
| 283 | 282 | $id = $line["id"]; |
| 284 | 283 | $title = $line["title"]; |
| 285 | 284 | |
| 286 | - array_push($rv, [ "label" => $title, "value" => $id ]); |
|
| 285 | + array_push($rv, ["label" => $title, "value" => $id]); |
|
| 287 | 286 | } |
| 288 | 287 | } |
| 289 | 288 | |
@@ -384,7 +383,7 @@ discard block |
||
| 384 | 383 | list ($og_image, $og_stream) = Article::get_article_image($enclosures, $line['content'], $line["site_url"]); |
| 385 | 384 | |
| 386 | 385 | if ($og_image) { |
| 387 | - $rv .= "<meta property='og:image' content=\"" . htmlspecialchars($og_image) . "\"/>"; |
|
| 386 | + $rv .= "<meta property='og:image' content=\"".htmlspecialchars($og_image)."\"/>"; |
|
| 388 | 387 | } |
| 389 | 388 | |
| 390 | 389 | $rv .= "<body class='flat ttrss_utility ttrss_zoom'>"; |
@@ -393,9 +392,9 @@ discard block |
||
| 393 | 392 | if ($line["link"]) { |
| 394 | 393 | $rv .= "<h1><a target='_blank' rel='noopener noreferrer' |
| 395 | 394 | title=\"".htmlspecialchars($line['title'])."\" |
| 396 | - href=\"" .htmlspecialchars($line["link"]) . "\">" . $line["title"] . "</a></h1>"; |
|
| 395 | + href=\"" .htmlspecialchars($line["link"])."\">".$line["title"]."</a></h1>"; |
|
| 397 | 396 | } else { |
| 398 | - $rv .= "<h1>" . $line["title"] . "</h1>"; |
|
| 397 | + $rv .= "<h1>".$line["title"]."</h1>"; |
|
| 399 | 398 | } |
| 400 | 399 | |
| 401 | 400 | $rv .= "<div class='content post'>"; |
@@ -448,8 +447,8 @@ discard block |
||
| 448 | 447 | $feed = clean($_REQUEST["id"]); |
| 449 | 448 | $key = clean($_REQUEST["key"]); |
| 450 | 449 | $is_cat = clean($_REQUEST["is_cat"]); |
| 451 | - $limit = (int)clean($_REQUEST["limit"]); |
|
| 452 | - $offset = (int)clean($_REQUEST["offset"]); |
|
| 450 | + $limit = (int) clean($_REQUEST["limit"]); |
|
| 451 | + $offset = (int) clean($_REQUEST["offset"]); |
|
| 453 | 452 | |
| 454 | 453 | $search = clean($_REQUEST["q"]); |
| 455 | 454 | $view_mode = clean($_REQUEST["view-mode"]); |
@@ -692,9 +691,9 @@ discard block |
||
| 692 | 691 | $return = clean($_REQUEST['return']); |
| 693 | 692 | |
| 694 | 693 | if ($_REQUEST['return'] && mb_strpos($return, SELF_URL_PATH) === 0) { |
| 695 | - header("Location: " . clean($_REQUEST['return'])); |
|
| 694 | + header("Location: ".clean($_REQUEST['return'])); |
|
| 696 | 695 | } else { |
| 697 | - header("Location: " . get_self_url_prefix()); |
|
| 696 | + header("Location: ".get_self_url_prefix()); |
|
| 698 | 697 | } |
| 699 | 698 | } |
| 700 | 699 | } |
@@ -786,7 +785,7 @@ discard block |
||
| 786 | 785 | print "<input type='hidden' name='op' value='subscribe'>"; |
| 787 | 786 | |
| 788 | 787 | print "<fieldset>"; |
| 789 | - print "<label style='display : inline'>" . __("Multiple feed URLs found:") . "</label>"; |
|
| 788 | + print "<label style='display : inline'>".__("Multiple feed URLs found:")."</label>"; |
|
| 790 | 789 | print "<select name='feed_url' dojoType='dijit.form.Select'>"; |
| 791 | 790 | |
| 792 | 791 | foreach ($feed_urls as $url => $name) { |
@@ -805,9 +804,9 @@ discard block |
||
| 805 | 804 | print "</form>"; |
| 806 | 805 | } |
| 807 | 806 | |
| 808 | - $tp_uri = get_self_url_prefix() . "/prefs.php"; |
|
| 807 | + $tp_uri = get_self_url_prefix()."/prefs.php"; |
|
| 809 | 808 | |
| 810 | - if ($rc['code'] <= 2){ |
|
| 809 | + if ($rc['code'] <= 2) { |
|
| 811 | 810 | $sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE |
| 812 | 811 | feed_url = ? AND owner_uid = ?"); |
| 813 | 812 | $sth->execute([$feed_url, $_SESSION['uid']]); |
@@ -895,7 +894,7 @@ discard block |
||
| 895 | 894 | list($timestamp, $resetpass_token) = explode(":", $resetpass_token_full); |
| 896 | 895 | |
| 897 | 896 | if ($timestamp && $resetpass_token && |
| 898 | - $timestamp >= time() - 15*60*60 && |
|
| 897 | + $timestamp >= time() - 15 * 60 * 60 && |
|
| 899 | 898 | $resetpass_token == $hash) { |
| 900 | 899 | |
| 901 | 900 | $sth = $this->pdo->prepare("UPDATE ttrss_users SET resetpass_token = NULL |
@@ -935,8 +934,8 @@ discard block |
||
| 935 | 934 | <input dojoType='dijit.form.TextBox' type='email' name='email' value='' required> |
| 936 | 935 | </fieldset>"; |
| 937 | 936 | |
| 938 | - $_SESSION["pwdreset:testvalue1"] = rand(1,10); |
|
| 939 | - $_SESSION["pwdreset:testvalue2"] = rand(1,10); |
|
| 937 | + $_SESSION["pwdreset:testvalue1"] = rand(1, 10); |
|
| 938 | + $_SESSION["pwdreset:testvalue2"] = rand(1, 10); |
|
| 940 | 939 | |
| 941 | 940 | print "<fieldset> |
| 942 | 941 | <label>".T_sprintf("How much is %d + %d:", $_SESSION["pwdreset:testvalue1"], $_SESSION["pwdreset:testvalue2"])."</label> |
@@ -981,8 +980,8 @@ discard block |
||
| 981 | 980 | |
| 982 | 981 | if ($id) { |
| 983 | 982 | $resetpass_token = sha1(get_random_bytes(128)); |
| 984 | - $resetpass_link = get_self_url_prefix() . "/public.php?op=forgotpass&hash=" . $resetpass_token . |
|
| 985 | - "&login=" . urlencode($login); |
|
| 983 | + $resetpass_link = get_self_url_prefix()."/public.php?op=forgotpass&hash=".$resetpass_token. |
|
| 984 | + "&login=".urlencode($login); |
|
| 986 | 985 | |
| 987 | 986 | require_once "lib/MiniTemplator.class.php"; |
| 988 | 987 | |
@@ -1009,7 +1008,7 @@ discard block |
||
| 1009 | 1008 | |
| 1010 | 1009 | if (!$rc) print_error($mailer->error()); |
| 1011 | 1010 | |
| 1012 | - $resetpass_token_full = time() . ":" . $resetpass_token; |
|
| 1011 | + $resetpass_token_full = time().":".$resetpass_token; |
|
| 1013 | 1012 | |
| 1014 | 1013 | $sth = $this->pdo->prepare("UPDATE ttrss_users |
| 1015 | 1014 | SET resetpass_token = ? |
@@ -1099,12 +1098,12 @@ discard block |
||
| 1099 | 1098 | if ($op == "performupdate") { |
| 1100 | 1099 | if ($updater->isUpdateRequired()) { |
| 1101 | 1100 | |
| 1102 | - print "<h2>" . T_sprintf("Performing updates to version %d", SCHEMA_VERSION) . "</h2>"; |
|
| 1101 | + print "<h2>".T_sprintf("Performing updates to version %d", SCHEMA_VERSION)."</h2>"; |
|
| 1103 | 1102 | |
| 1104 | 1103 | for ($i = $updater->getSchemaVersion() + 1; $i <= SCHEMA_VERSION; $i++) { |
| 1105 | 1104 | print "<ul>"; |
| 1106 | 1105 | |
| 1107 | - print "<li class='text-info'>" . T_sprintf("Updating to version %d", $i) . "</li>"; |
|
| 1106 | + print "<li class='text-info'>".T_sprintf("Updating to version %d", $i)."</li>"; |
|
| 1108 | 1107 | |
| 1109 | 1108 | print "<li>"; |
| 1110 | 1109 | $result = $updater->performUpdateTo($i, true); |
@@ -1123,7 +1122,7 @@ discard block |
||
| 1123 | 1122 | |
| 1124 | 1123 | return; |
| 1125 | 1124 | } else { |
| 1126 | - print "<li class='text-success'>" . __("Completed.") . "</li>"; |
|
| 1125 | + print "<li class='text-success'>".__("Completed.")."</li>"; |
|
| 1127 | 1126 | print "</ul>"; |
| 1128 | 1127 | } |
| 1129 | 1128 | } |
@@ -1191,7 +1190,7 @@ discard block |
||
| 1191 | 1190 | |
| 1192 | 1191 | $timestamp = date("Y-m-d", strtotime($timestamp)); |
| 1193 | 1192 | |
| 1194 | - return "tag:" . parse_url(get_self_url_prefix(), PHP_URL_HOST) . ",$timestamp:/$id"; |
|
| 1193 | + return "tag:".parse_url(get_self_url_prefix(), PHP_URL_HOST).",$timestamp:/$id"; |
|
| 1195 | 1194 | } |
| 1196 | 1195 | |
| 1197 | 1196 | // this should be used very carefully because this endpoint is exposed to unauthenticated users |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | if ($error) { |
| 27 | 27 | foreach (libxml_get_errors() as $error) { |
| 28 | 28 | if ($error->level == LIBXML_ERR_FATAL) { |
| 29 | - if(!isset($this->error)) //currently only the first error is reported |
|
| 29 | + if (!isset($this->error)) //currently only the first error is reported |
|
| 30 | 30 | $this->error = $this->format_error($error); |
| 31 | 31 | $this->libxml_errors [] = $this->format_error($error); |
| 32 | 32 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $this->type = $this::FEED_ATOM; |
| 70 | 70 | break; |
| 71 | 71 | default: |
| 72 | - if( !isset($this->error) ){ |
|
| 72 | + if (!isset($this->error)) { |
|
| 73 | 73 | $this->error = "Unknown/unsupported feed type"; |
| 74 | 74 | } |
| 75 | 75 | return; |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | if ($this->link) $this->link = trim($this->link); |
| 167 | 167 | |
| 168 | 168 | } else { |
| 169 | - if( !isset($this->error) ){ |
|
| 169 | + if (!isset($this->error)) { |
|
| 170 | 170 | $this->error = "Unknown/unsupported feed type"; |
| 171 | 171 | } |
| 172 | 172 | return; |
@@ -52,9 +52,9 @@ |
||
| 52 | 52 | $this->pdo->query($line); // PDO returns errors as exceptions now |
| 53 | 53 | } catch (PDOException $e) { |
| 54 | 54 | if ($html_output) { |
| 55 | - print "<div class='text-error'>Error: " . $e->getMessage() . "</div>"; |
|
| 55 | + print "<div class='text-error'>Error: ".$e->getMessage()."</div>"; |
|
| 56 | 56 | } else { |
| 57 | - Debug::log("Error: " . $e->getMessage()); |
|
| 57 | + Debug::log("Error: ".$e->getMessage()); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | $this->pdo->rollBack(); |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . |
|
| 2 | + set_include_path(dirname(__FILE__)."/include".PATH_SEPARATOR. |
|
| 3 | 3 | get_include_path()); |
| 4 | 4 | |
| 5 | 5 | require_once "autoload.php"; |
@@ -14,11 +14,11 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | $op = $_REQUEST['op']; |
| 16 | 16 | |
| 17 | - if ($op == "publish"){ |
|
| 17 | + if ($op == "publish") { |
|
| 18 | 18 | $key = $_REQUEST["key"]; |
| 19 | 19 | $pdo = Db::pdo(); |
| 20 | 20 | |
| 21 | - $sth = $pdo->prepare( "SELECT owner_uid |
|
| 21 | + $sth = $pdo->prepare("SELECT owner_uid |
|
| 22 | 22 | FROM ttrss_access_keys WHERE |
| 23 | 23 | access_key = ? AND feed_id = 'OPML:Publish'"); |
| 24 | 24 | $sth->execute([$key]); |
@@ -89,16 +89,16 @@ discard block |
||
| 89 | 89 | * @access private |
| 90 | 90 | */ |
| 91 | 91 | |
| 92 | -var $maxNestingLevel = 50; // maximum number of block nestings |
|
| 93 | -var $maxInclTemplateSize = 1000000; // maximum length of template string when including subtemplates |
|
| 94 | -var $template; // Template file data |
|
| 95 | -var $varTab; // variables table, array index is variable no |
|
| 92 | +var $maxNestingLevel = 50; // maximum number of block nestings |
|
| 93 | +var $maxInclTemplateSize = 1000000; // maximum length of template string when including subtemplates |
|
| 94 | +var $template; // Template file data |
|
| 95 | +var $varTab; // variables table, array index is variable no |
|
| 96 | 96 | // Fields: |
| 97 | 97 | // varName // variable name |
| 98 | 98 | // varValue // variable value |
| 99 | -var $varTabCnt; // no of entries used in VarTab |
|
| 100 | -var $varNameToNoMap; // maps variable names to variable numbers |
|
| 101 | -var $varRefTab; // variable references table |
|
| 99 | +var $varTabCnt; // no of entries used in VarTab |
|
| 100 | +var $varNameToNoMap; // maps variable names to variable numbers |
|
| 101 | +var $varRefTab; // variable references table |
|
| 102 | 102 | // Contains an entry for each variable reference in the template. Ordered by TemplatePos. |
| 103 | 103 | // Fields: |
| 104 | 104 | // varNo // variable no |
@@ -106,8 +106,8 @@ discard block |
||
| 106 | 106 | // tPosEnd // template position of end of variable reference |
| 107 | 107 | // blockNo // block no of the (innermost) block that contains this variable reference |
| 108 | 108 | // blockVarNo // block variable no. Index into BlockInstTab.BlockVarTab |
| 109 | -var $varRefTabCnt; // no of entries used in VarRefTab |
|
| 110 | -var $blockTab; // Blocks table, array index is block no |
|
| 109 | +var $varRefTabCnt; // no of entries used in VarRefTab |
|
| 110 | +var $blockTab; // Blocks table, array index is block no |
|
| 111 | 111 | // Contains an entry for each block in the template. Ordered by TPosBegin. |
| 112 | 112 | // Fields: |
| 113 | 113 | // blockName // block name |
@@ -126,12 +126,12 @@ discard block |
||
| 126 | 126 | // blockVarCnt // no of variables in block |
| 127 | 127 | // blockVarNoToVarNoMap // maps block variable numbers to variable numbers |
| 128 | 128 | // firstVarRefNo // variable reference no of first variable of this block or -1 |
| 129 | -var $blockTabCnt; // no of entries used in BlockTab |
|
| 130 | -var $blockNameToNoMap; // maps block names to block numbers |
|
| 129 | +var $blockTabCnt; // no of entries used in BlockTab |
|
| 130 | +var $blockNameToNoMap; // maps block names to block numbers |
|
| 131 | 131 | var $openBlocksTab; |
| 132 | 132 | // During parsing, this table contains the block numbers of the open parent blocks (nested outer blocks). |
| 133 | 133 | // Indexed by the block nesting level. |
| 134 | -var $blockInstTab; // block instances table |
|
| 134 | +var $blockInstTab; // block instances table |
|
| 135 | 135 | // This table contains an entry for each block instance that has been added. |
| 136 | 136 | // Indexed by BlockInstNo. |
| 137 | 137 | // Fields: |
@@ -143,14 +143,14 @@ discard block |
||
| 143 | 143 | // nextBlockInstNo // pointer to next instance of this block or -1 |
| 144 | 144 | // Forward chain for instances of same block. |
| 145 | 145 | // blockVarTab // block instance variables |
| 146 | -var $blockInstTabCnt; // no of entries used in BlockInstTab |
|
| 146 | +var $blockInstTabCnt; // no of entries used in BlockInstTab |
|
| 147 | 147 | |
| 148 | -var $currentNestingLevel; // Current block nesting level during parsing. |
|
| 149 | -var $templateValid; // true if a valid template is prepared |
|
| 150 | -var $outputMode; // 0 = to PHP output stream, 1 = to file, 2 = to string |
|
| 151 | -var $outputFileHandle; // file handle during writing of output file |
|
| 152 | -var $outputError; // true when an output error occurred |
|
| 153 | -var $outputString; // string buffer for the generated HTML page |
|
| 148 | +var $currentNestingLevel; // Current block nesting level during parsing. |
|
| 149 | +var $templateValid; // true if a valid template is prepared |
|
| 150 | +var $outputMode; // 0 = to PHP output stream, 1 = to file, 2 = to string |
|
| 151 | +var $outputFileHandle; // file handle during writing of output file |
|
| 152 | +var $outputError; // true when an output error occurred |
|
| 153 | +var $outputString; // string buffer for the generated HTML page |
|
| 154 | 154 | |
| 155 | 155 | /**#@-*/ |
| 156 | 156 | |
@@ -171,9 +171,9 @@ discard block |
||
| 171 | 171 | * @return boolean true on success, false on error. |
| 172 | 172 | * @access public |
| 173 | 173 | */ |
| 174 | -function readTemplateFromFile ($fileName) {
|
|
| 175 | - if (!$this->readFileIntoString($fileName,$s)) {
|
|
| 176 | - $this->triggerError ("Error while reading template file " . $fileName . ".");
|
|
| 174 | +function readTemplateFromFile($fileName) {
|
|
| 175 | + if (!$this->readFileIntoString($fileName, $s)) {
|
|
| 176 | + $this->triggerError("Error while reading template file ".$fileName.".");
|
|
| 177 | 177 | return false; } |
| 178 | 178 | if (!$this->setTemplateString($s)) return false; |
| 179 | 179 | return true; } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | * @return boolean true on success, false on error. |
| 185 | 185 | * @access public |
| 186 | 186 | */ |
| 187 | -function setTemplateString ($templateString) {
|
|
| 187 | +function setTemplateString($templateString) {
|
|
| 188 | 188 | $this->templateValid = false; |
| 189 | 189 | $this->template = $templateString; |
| 190 | 190 | if (!$this->parseTemplate()) return false; |
@@ -197,10 +197,10 @@ discard block |
||
| 197 | 197 | * @return boolean true on success, false on error. |
| 198 | 198 | * @access private |
| 199 | 199 | */ |
| 200 | -function loadSubtemplate ($subtemplateName, &$s) {
|
|
| 201 | - $subtemplateFileName = $this->combineFileSystemPath($this->subtemplateBasePath,$subtemplateName); |
|
| 202 | - if (!$this->readFileIntoString($subtemplateFileName,$s)) {
|
|
| 203 | - $this->triggerError ("Error while reading subtemplate file " . $subtemplateFileName . ".");
|
|
| 200 | +function loadSubtemplate($subtemplateName, &$s) {
|
|
| 201 | + $subtemplateFileName = $this->combineFileSystemPath($this->subtemplateBasePath, $subtemplateName); |
|
| 202 | + if (!$this->readFileIntoString($subtemplateFileName, $s)) {
|
|
| 203 | + $this->triggerError("Error while reading subtemplate file ".$subtemplateFileName.".");
|
|
| 204 | 204 | return false; } |
| 205 | 205 | return true; } |
| 206 | 206 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | function beginMainBlock() {
|
| 244 | 244 | $blockNo = 0; |
| 245 | 245 | $this->registerBlock('@@InternalMainBlock@@', $blockNo);
|
| 246 | - $bte =& $this->blockTab[$blockNo]; |
|
| 246 | + $bte = & $this->blockTab[$blockNo]; |
|
| 247 | 247 | $bte['tPosBegin'] = 0; |
| 248 | 248 | $bte['tPosContentsBegin'] = 0; |
| 249 | 249 | $bte['nestingLevel'] = 0; |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | * @access private |
| 258 | 258 | */ |
| 259 | 259 | function endMainBlock() {
|
| 260 | - $bte =& $this->blockTab[0]; |
|
| 260 | + $bte = & $this->blockTab[0]; |
|
| 261 | 261 | $bte['tPosContentsEnd'] = strlen($this->template); |
| 262 | 262 | $bte['tPosEnd'] = strlen($this->template); |
| 263 | 263 | $bte['definitionIsOpen'] = false; |
@@ -271,15 +271,15 @@ discard block |
||
| 271 | 271 | function parseTemplateCommands() {
|
| 272 | 272 | $p = 0; |
| 273 | 273 | while (true) {
|
| 274 | - $p0 = strpos($this->template,'<!--',$p); |
|
| 274 | + $p0 = strpos($this->template, '<!--', $p); |
|
| 275 | 275 | if ($p0 === false) break; |
| 276 | - $p = strpos($this->template,'-->',$p0); |
|
| 276 | + $p = strpos($this->template, '-->', $p0); |
|
| 277 | 277 | if ($p === false) {
|
| 278 | - $this->triggerError ("Invalid HTML comment in template at offset $p0.");
|
|
| 278 | + $this->triggerError("Invalid HTML comment in template at offset $p0.");
|
|
| 279 | 279 | return false; } |
| 280 | 280 | $p += 3; |
| 281 | - $cmdL = substr($this->template,$p0+4,$p-$p0-7); |
|
| 282 | - if (!$this->processTemplateCommand($cmdL,$p0,$p,$resumeFromStart)) |
|
| 281 | + $cmdL = substr($this->template, $p0 + 4, $p - $p0 - 7); |
|
| 282 | + if (!$this->processTemplateCommand($cmdL, $p0, $p, $resumeFromStart)) |
|
| 283 | 283 | return false; |
| 284 | 284 | if ($resumeFromStart) $p = $p0; } |
| 285 | 285 | return true; } |
@@ -288,29 +288,29 @@ discard block |
||
| 288 | 288 | * @return boolean true on success, false on error. |
| 289 | 289 | * @access private |
| 290 | 290 | */ |
| 291 | -function processTemplateCommand ($cmdL, $cmdTPosBegin, $cmdTPosEnd, &$resumeFromStart) {
|
|
| 291 | +function processTemplateCommand($cmdL, $cmdTPosBegin, $cmdTPosEnd, &$resumeFromStart) {
|
|
| 292 | 292 | $resumeFromStart = false; |
| 293 | 293 | $p = 0; |
| 294 | 294 | $cmd = ''; |
| 295 | - if (!$this->parseWord($cmdL,$p,$cmd)) return true; |
|
| 296 | - $parms = substr($cmdL,$p); |
|
| 295 | + if (!$this->parseWord($cmdL, $p, $cmd)) return true; |
|
| 296 | + $parms = substr($cmdL, $p); |
|
| 297 | 297 | switch (strtoupper($cmd)) {
|
| 298 | 298 | case '$BEGINBLOCK': |
| 299 | - if (!$this->processBeginBlockCmd($parms,$cmdTPosBegin,$cmdTPosEnd)) |
|
| 299 | + if (!$this->processBeginBlockCmd($parms, $cmdTPosBegin, $cmdTPosEnd)) |
|
| 300 | 300 | return false; |
| 301 | 301 | break; |
| 302 | 302 | case '$ENDBLOCK': |
| 303 | - if (!$this->processEndBlockCmd($parms,$cmdTPosBegin,$cmdTPosEnd)) |
|
| 303 | + if (!$this->processEndBlockCmd($parms, $cmdTPosBegin, $cmdTPosEnd)) |
|
| 304 | 304 | return false; |
| 305 | 305 | break; |
| 306 | 306 | case '$INCLUDE': |
| 307 | - if (!$this->processincludeCmd($parms,$cmdTPosBegin,$cmdTPosEnd)) |
|
| 307 | + if (!$this->processincludeCmd($parms, $cmdTPosBegin, $cmdTPosEnd)) |
|
| 308 | 308 | return false; |
| 309 | 309 | $resumeFromStart = true; |
| 310 | 310 | break; |
| 311 | 311 | default: |
| 312 | 312 | if ($cmd{0} == '$' && !(strlen($cmd) >= 2 && $cmd{1} == '{')) {
|
| 313 | - $this->triggerError ("Unknown command \"$cmd\" in template at offset $cmdTPosBegin.");
|
|
| 313 | + $this->triggerError("Unknown command \"$cmd\" in template at offset $cmdTPosBegin.");
|
|
| 314 | 314 | return false; }} |
| 315 | 315 | return true; } |
| 316 | 316 | |
@@ -319,24 +319,24 @@ discard block |
||
| 319 | 319 | * @return boolean true on success, false on error. |
| 320 | 320 | * @access private |
| 321 | 321 | */ |
| 322 | -function processBeginBlockCmd ($parms, $cmdTPosBegin, $cmdTPosEnd) {
|
|
| 322 | +function processBeginBlockCmd($parms, $cmdTPosBegin, $cmdTPosEnd) {
|
|
| 323 | 323 | $p = 0; |
| 324 | - if (!$this->parseWord($parms,$p,$blockName)) {
|
|
| 325 | - $this->triggerError ("Missing block name in \$BeginBlock command in template at offset $cmdTPosBegin.");
|
|
| 324 | + if (!$this->parseWord($parms, $p, $blockName)) {
|
|
| 325 | + $this->triggerError("Missing block name in \$BeginBlock command in template at offset $cmdTPosBegin.");
|
|
| 326 | 326 | return false; } |
| 327 | - if (trim(substr($parms,$p)) != '') {
|
|
| 328 | - $this->triggerError ("Extra parameter in \$BeginBlock command in template at offset $cmdTPosBegin.");
|
|
| 327 | + if (trim(substr($parms, $p)) != '') {
|
|
| 328 | + $this->triggerError("Extra parameter in \$BeginBlock command in template at offset $cmdTPosBegin.");
|
|
| 329 | 329 | return false; } |
| 330 | - $this->registerBlock ($blockName, $blockNo); |
|
| 331 | - $btr =& $this->blockTab[$blockNo]; |
|
| 330 | + $this->registerBlock($blockName, $blockNo); |
|
| 331 | + $btr = & $this->blockTab[$blockNo]; |
|
| 332 | 332 | $btr['tPosBegin'] = $cmdTPosBegin; |
| 333 | 333 | $btr['tPosContentsBegin'] = $cmdTPosEnd; |
| 334 | 334 | $btr['nestingLevel'] = $this->currentNestingLevel; |
| 335 | - $btr['parentBlockNo'] = $this->openBlocksTab[$this->currentNestingLevel-1]; |
|
| 335 | + $btr['parentBlockNo'] = $this->openBlocksTab[$this->currentNestingLevel - 1]; |
|
| 336 | 336 | $this->openBlocksTab[$this->currentNestingLevel] = $blockNo; |
| 337 | 337 | $this->currentNestingLevel += 1; |
| 338 | 338 | if ($this->currentNestingLevel > $this->maxNestingLevel) {
|
| 339 | - $this->triggerError ("Block nesting overflow in template at offset $cmdTPosBegin.");
|
|
| 339 | + $this->triggerError("Block nesting overflow in template at offset $cmdTPosBegin.");
|
|
| 340 | 340 | return false; } |
| 341 | 341 | return true; } |
| 342 | 342 | |
@@ -345,24 +345,24 @@ discard block |
||
| 345 | 345 | * @return boolean true on success, false on error. |
| 346 | 346 | * @access private |
| 347 | 347 | */ |
| 348 | -function processEndBlockCmd ($parms, $cmdTPosBegin, $cmdTPosEnd) {
|
|
| 348 | +function processEndBlockCmd($parms, $cmdTPosBegin, $cmdTPosEnd) {
|
|
| 349 | 349 | $p = 0; |
| 350 | - if (!$this->parseWord($parms,$p,$blockName)) {
|
|
| 351 | - $this->triggerError ("Missing block name in \$EndBlock command in template at offset $cmdTPosBegin.");
|
|
| 350 | + if (!$this->parseWord($parms, $p, $blockName)) {
|
|
| 351 | + $this->triggerError("Missing block name in \$EndBlock command in template at offset $cmdTPosBegin.");
|
|
| 352 | 352 | return false; } |
| 353 | - if (trim(substr($parms,$p)) != '') {
|
|
| 354 | - $this->triggerError ("Extra parameter in \$EndBlock command in template at offset $cmdTPosBegin.");
|
|
| 353 | + if (trim(substr($parms, $p)) != '') {
|
|
| 354 | + $this->triggerError("Extra parameter in \$EndBlock command in template at offset $cmdTPosBegin.");
|
|
| 355 | 355 | return false; } |
| 356 | - if (!$this->lookupBlockName($blockName,$blockNo)) {
|
|
| 357 | - $this->triggerError ("Undefined block name \"$blockName\" in \$EndBlock command in template at offset $cmdTPosBegin.");
|
|
| 356 | + if (!$this->lookupBlockName($blockName, $blockNo)) {
|
|
| 357 | + $this->triggerError("Undefined block name \"$blockName\" in \$EndBlock command in template at offset $cmdTPosBegin.");
|
|
| 358 | 358 | return false; } |
| 359 | 359 | $this->currentNestingLevel -= 1; |
| 360 | - $btr =& $this->blockTab[$blockNo]; |
|
| 360 | + $btr = & $this->blockTab[$blockNo]; |
|
| 361 | 361 | if (!$btr['definitionIsOpen']) {
|
| 362 | - $this->triggerError ("Multiple \$EndBlock command for block \"$blockName\" in template at offset $cmdTPosBegin.");
|
|
| 362 | + $this->triggerError("Multiple \$EndBlock command for block \"$blockName\" in template at offset $cmdTPosBegin.");
|
|
| 363 | 363 | return false; } |
| 364 | 364 | if ($btr['nestingLevel'] != $this->currentNestingLevel) {
|
| 365 | - $this->triggerError ("Block nesting level mismatch at \$EndBlock command for block \"$blockName\" in template at offset $cmdTPosBegin.");
|
|
| 365 | + $this->triggerError("Block nesting level mismatch at \$EndBlock command for block \"$blockName\" in template at offset $cmdTPosBegin.");
|
|
| 366 | 366 | return false; } |
| 367 | 367 | $btr['tPosContentsEnd'] = $cmdTPosBegin; |
| 368 | 368 | $btr['tPosEnd'] = $cmdTPosEnd; |
@@ -374,10 +374,10 @@ discard block |
||
| 374 | 374 | */ |
| 375 | 375 | function registerBlock($blockName, &$blockNo) {
|
| 376 | 376 | $blockNo = $this->blockTabCnt++; |
| 377 | - $btr =& $this->blockTab[$blockNo]; |
|
| 377 | + $btr = & $this->blockTab[$blockNo]; |
|
| 378 | 378 | $btr = array(); |
| 379 | 379 | $btr['blockName'] = $blockName; |
| 380 | - if (!$this->lookupBlockName($blockName,$btr['nextWithSameName'])) |
|
| 380 | + if (!$this->lookupBlockName($blockName, $btr['nextWithSameName'])) |
|
| 381 | 381 | $btr['nextWithSameName'] = -1; |
| 382 | 382 | $btr['definitionIsOpen'] = true; |
| 383 | 383 | $btr['instances'] = 0; |
@@ -394,13 +394,13 @@ discard block |
||
| 394 | 394 | * @access private |
| 395 | 395 | */ |
| 396 | 396 | function checkBlockDefinitionsComplete() {
|
| 397 | - for ($blockNo=0; $blockNo < $this->blockTabCnt; $blockNo++) {
|
|
| 398 | - $btr =& $this->blockTab[$blockNo]; |
|
| 397 | + for ($blockNo = 0; $blockNo < $this->blockTabCnt; $blockNo++) {
|
|
| 398 | + $btr = & $this->blockTab[$blockNo]; |
|
| 399 | 399 | if ($btr['definitionIsOpen']) {
|
| 400 | - $this->triggerError ("Missing \$EndBlock command in template for block " . $btr['blockName'] . ".");
|
|
| 400 | + $this->triggerError("Missing \$EndBlock command in template for block ".$btr['blockName'].".");
|
|
| 401 | 401 | return false; }} |
| 402 | 402 | if ($this->currentNestingLevel != 0) {
|
| 403 | - $this->triggerError ("Block nesting level error at end of template.");
|
|
| 403 | + $this->triggerError("Block nesting level error at end of template.");
|
|
| 404 | 404 | return false; } |
| 405 | 405 | return true; } |
| 406 | 406 | |
@@ -409,29 +409,29 @@ discard block |
||
| 409 | 409 | * @return boolean true on success, false on error. |
| 410 | 410 | * @access private |
| 411 | 411 | */ |
| 412 | -function processIncludeCmd ($parms, $cmdTPosBegin, $cmdTPosEnd) {
|
|
| 412 | +function processIncludeCmd($parms, $cmdTPosBegin, $cmdTPosEnd) {
|
|
| 413 | 413 | $p = 0; |
| 414 | - if (!$this->parseWordOrQuotedString($parms,$p,$subtemplateName)) {
|
|
| 415 | - $this->triggerError ("Missing or invalid subtemplate name in \$Include command in template at offset $cmdTPosBegin.");
|
|
| 414 | + if (!$this->parseWordOrQuotedString($parms, $p, $subtemplateName)) {
|
|
| 415 | + $this->triggerError("Missing or invalid subtemplate name in \$Include command in template at offset $cmdTPosBegin.");
|
|
| 416 | 416 | return false; } |
| 417 | - if (trim(substr($parms,$p)) != '') {
|
|
| 418 | - $this->triggerError ("Extra parameter in \$include command in template at offset $cmdTPosBegin.");
|
|
| 417 | + if (trim(substr($parms, $p)) != '') {
|
|
| 418 | + $this->triggerError("Extra parameter in \$include command in template at offset $cmdTPosBegin.");
|
|
| 419 | 419 | return false; } |
| 420 | - return $this->insertSubtemplate($subtemplateName,$cmdTPosBegin,$cmdTPosEnd); } |
|
| 420 | + return $this->insertSubtemplate($subtemplateName, $cmdTPosBegin, $cmdTPosEnd); } |
|
| 421 | 421 | |
| 422 | 422 | /** |
| 423 | 423 | * Processes the $Include command. |
| 424 | 424 | * @return boolean true on success, false on error. |
| 425 | 425 | * @access private |
| 426 | 426 | */ |
| 427 | -function insertSubtemplate ($subtemplateName, $tPos1, $tPos2) {
|
|
| 427 | +function insertSubtemplate($subtemplateName, $tPos1, $tPos2) {
|
|
| 428 | 428 | if (strlen($this->template) > $this->maxInclTemplateSize) {
|
| 429 | - $this->triggerError ("Subtemplate include aborted because the internal template string is longer than $this->maxInclTemplateSize characters.");
|
|
| 429 | + $this->triggerError("Subtemplate include aborted because the internal template string is longer than $this->maxInclTemplateSize characters.");
|
|
| 430 | 430 | return false; } |
| 431 | - if (!$this->loadSubtemplate($subtemplateName,$subtemplate)) return false; |
|
| 431 | + if (!$this->loadSubtemplate($subtemplateName, $subtemplate)) return false; |
|
| 432 | 432 | // (Copying the template to insert a subtemplate is a bit slow. In a future implementation of MiniTemplator, |
| 433 | 433 | // a table could be used that contains references to the string fragments.) |
| 434 | - $this->template = substr($this->template,0,$tPos1) . $subtemplate . substr($this->template,$tPos2); |
|
| 434 | + $this->template = substr($this->template, 0, $tPos1).$subtemplate.substr($this->template, $tPos2); |
|
| 435 | 435 | return true; } |
| 436 | 436 | |
| 437 | 437 | /** |
@@ -447,24 +447,24 @@ discard block |
||
| 447 | 447 | $p0 = $p; |
| 448 | 448 | $p = strpos($this->template, '}', $p); |
| 449 | 449 | if ($p === false) {
|
| 450 | - $this->triggerError ("Invalid variable reference in template at offset $p0.");
|
|
| 450 | + $this->triggerError("Invalid variable reference in template at offset $p0.");
|
|
| 451 | 451 | return false; } |
| 452 | 452 | $p += 1; |
| 453 | - $varName = trim(substr($this->template, $p0+2, $p-$p0-3)); |
|
| 453 | + $varName = trim(substr($this->template, $p0 + 2, $p - $p0 - 3)); |
|
| 454 | 454 | if (strlen($varName) == 0) {
|
| 455 | - $this->triggerError ("Empty variable name in template at offset $p0.");
|
|
| 455 | + $this->triggerError("Empty variable name in template at offset $p0.");
|
|
| 456 | 456 | return false; } |
| 457 | - $this->registerVariableReference ($varName, $p0, $p); } |
|
| 457 | + $this->registerVariableReference($varName, $p0, $p); } |
|
| 458 | 458 | return true; } |
| 459 | 459 | |
| 460 | 460 | /** |
| 461 | 461 | * @access private |
| 462 | 462 | */ |
| 463 | -function registerVariableReference ($varName, $tPosBegin, $tPosEnd) {
|
|
| 464 | - if (!$this->lookupVariableName($varName,$varNo)) |
|
| 465 | - $this->registerVariable($varName,$varNo); |
|
| 463 | +function registerVariableReference($varName, $tPosBegin, $tPosEnd) {
|
|
| 464 | + if (!$this->lookupVariableName($varName, $varNo)) |
|
| 465 | + $this->registerVariable($varName, $varNo); |
|
| 466 | 466 | $varRefNo = $this->varRefTabCnt++; |
| 467 | - $vrtr =& $this->varRefTab[$varRefNo]; |
|
| 467 | + $vrtr = & $this->varRefTab[$varRefNo]; |
|
| 468 | 468 | $vrtr = array(); |
| 469 | 469 | $vrtr['tPosBegin'] = $tPosBegin; |
| 470 | 470 | $vrtr['tPosEnd'] = $tPosEnd; |
@@ -473,9 +473,9 @@ discard block |
||
| 473 | 473 | /** |
| 474 | 474 | * @access private |
| 475 | 475 | */ |
| 476 | -function registerVariable ($varName, &$varNo) {
|
|
| 476 | +function registerVariable($varName, &$varNo) {
|
|
| 477 | 477 | $varNo = $this->varTabCnt++; |
| 478 | - $vtr =& $this->varTab[$varNo]; |
|
| 478 | + $vtr = & $this->varTab[$varNo]; |
|
| 479 | 479 | $vtr = array(); |
| 480 | 480 | $vtr['varName'] = $varName; |
| 481 | 481 | $vtr['varValue'] = ''; |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | $activeBlockNo = 0; |
| 491 | 491 | $nextBlockNo = 1; |
| 492 | 492 | while ($varRefNo < $this->varRefTabCnt) {
|
| 493 | - $vrtr =& $this->varRefTab[$varRefNo]; |
|
| 493 | + $vrtr = & $this->varRefTab[$varRefNo]; |
|
| 494 | 494 | $varRefTPos = $vrtr['tPosBegin']; |
| 495 | 495 | $varNo = $vrtr['varNo']; |
| 496 | 496 | if ($varRefTPos >= $this->blockTab[$activeBlockNo]['tPosEnd']) {
|
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | $activeBlockNo = $nextBlockNo; |
| 502 | 502 | $nextBlockNo += 1; |
| 503 | 503 | continue; }} |
| 504 | - $btr =& $this->blockTab[$activeBlockNo]; |
|
| 504 | + $btr = & $this->blockTab[$activeBlockNo]; |
|
| 505 | 505 | if ($varRefTPos < $btr['tPosBegin']) |
| 506 | 506 | $this->programLogicError(1); |
| 507 | 507 | $blockVarNo = $btr['blockVarCnt']++; |
@@ -523,10 +523,10 @@ discard block |
||
| 523 | 523 | * @access public |
| 524 | 524 | */ |
| 525 | 525 | function reset() {
|
| 526 | - for ($varNo=0; $varNo<$this->varTabCnt; $varNo++) |
|
| 526 | + for ($varNo = 0; $varNo < $this->varTabCnt; $varNo++) |
|
| 527 | 527 | $this->varTab[$varNo]['varValue'] = ''; |
| 528 | - for ($blockNo=0; $blockNo<$this->blockTabCnt; $blockNo++) {
|
|
| 529 | - $btr =& $this->blockTab[$blockNo]; |
|
| 528 | + for ($blockNo = 0; $blockNo < $this->blockTabCnt; $blockNo++) {
|
|
| 529 | + $btr = & $this->blockTab[$blockNo]; |
|
| 530 | 530 | $btr['instances'] = 0; |
| 531 | 531 | $btr['firstBlockInstNo'] = -1; |
| 532 | 532 | $btr['lastBlockInstNo'] = -1; } |
@@ -548,11 +548,11 @@ discard block |
||
| 548 | 548 | * $isOptional is false). |
| 549 | 549 | * @access public |
| 550 | 550 | */ |
| 551 | -function setVariable ($variableName, $variableValue, $isOptional=false) {
|
|
| 552 | - if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
|
|
| 553 | - if (!$this->lookupVariableName($variableName,$varNo)) {
|
|
| 551 | +function setVariable($variableName, $variableValue, $isOptional = false) {
|
|
| 552 | + if (!$this->templateValid) {$this->triggerError("Template not valid."); return false; }
|
|
| 553 | + if (!$this->lookupVariableName($variableName, $varNo)) {
|
|
| 554 | 554 | if ($isOptional) return true; |
| 555 | - $this->triggerError ("Variable \"$variableName\" not defined in template.");
|
|
| 555 | + $this->triggerError("Variable \"$variableName\" not defined in template.");
|
|
| 556 | 556 | return false; } |
| 557 | 557 | $this->varTab[$varNo]['varValue'] = $variableValue; |
| 558 | 558 | return true; } |
@@ -575,8 +575,8 @@ discard block |
||
| 575 | 575 | * $isOptional is false). |
| 576 | 576 | * @access public |
| 577 | 577 | */ |
| 578 | -function setVariableEsc ($variableName, $variableValue, $isOptional=false) {
|
|
| 579 | - return $this->setVariable($variableName,htmlspecialchars($variableValue,ENT_QUOTES),$isOptional); } |
|
| 578 | +function setVariableEsc($variableName, $variableValue, $isOptional = false) {
|
|
| 579 | + return $this->setVariable($variableName, htmlspecialchars($variableValue, ENT_QUOTES), $isOptional); } |
|
| 580 | 580 | |
| 581 | 581 | /** |
| 582 | 582 | * Checks whether a variable with the specified name exists within the template. |
@@ -585,9 +585,9 @@ discard block |
||
| 585 | 585 | * variable with the specified name exists in the template. |
| 586 | 586 | * @access public |
| 587 | 587 | */ |
| 588 | -function variableExists ($variableName) {
|
|
| 589 | - if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
|
|
| 590 | - return $this->lookupVariableName($variableName,$varNo); } |
|
| 588 | +function variableExists($variableName) {
|
|
| 589 | + if (!$this->templateValid) {$this->triggerError("Template not valid."); return false; }
|
|
| 590 | + return $this->lookupVariableName($variableName, $varNo); } |
|
| 591 | 591 | |
| 592 | 592 | /** |
| 593 | 593 | * Adds an instance of a template block. |
@@ -603,9 +603,9 @@ discard block |
||
| 603 | 603 | * @access public |
| 604 | 604 | */ |
| 605 | 605 | function addBlock($blockName) {
|
| 606 | - if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
|
|
| 607 | - if (!$this->lookupBlockName($blockName,$blockNo)) {
|
|
| 608 | - $this->triggerError ("Block \"$blockName\" not defined in template.");
|
|
| 606 | + if (!$this->templateValid) {$this->triggerError("Template not valid."); return false; }
|
|
| 607 | + if (!$this->lookupBlockName($blockName, $blockNo)) {
|
|
| 608 | + $this->triggerError("Block \"$blockName\" not defined in template.");
|
|
| 609 | 609 | return false; } |
| 610 | 610 | while ($blockNo != -1) {
|
| 611 | 611 | $this->addBlockByNo($blockNo); |
@@ -615,10 +615,10 @@ discard block |
||
| 615 | 615 | /** |
| 616 | 616 | * @access private |
| 617 | 617 | */ |
| 618 | -function addBlockByNo ($blockNo) {
|
|
| 619 | - $btr =& $this->blockTab[$blockNo]; |
|
| 620 | - $this->registerBlockInstance ($blockInstNo); |
|
| 621 | - $bitr =& $this->blockInstTab[$blockInstNo]; |
|
| 618 | +function addBlockByNo($blockNo) {
|
|
| 619 | + $btr = & $this->blockTab[$blockNo]; |
|
| 620 | + $this->registerBlockInstance($blockInstNo); |
|
| 621 | + $bitr = & $this->blockInstTab[$blockInstNo]; |
|
| 622 | 622 | if ($btr['firstBlockInstNo'] == -1) |
| 623 | 623 | $btr['firstBlockInstNo'] = $blockInstNo; |
| 624 | 624 | if ($btr['lastBlockInstNo'] != -1) |
@@ -636,14 +636,14 @@ discard block |
||
| 636 | 636 | $bitr['nextBlockInstNo'] = -1; |
| 637 | 637 | $bitr['blockVarTab'] = array(); |
| 638 | 638 | // copy instance variables for this block |
| 639 | - for ($blockVarNo=0; $blockVarNo<$blockVarCnt; $blockVarNo++) {
|
|
| 639 | + for ($blockVarNo = 0; $blockVarNo < $blockVarCnt; $blockVarNo++) {
|
|
| 640 | 640 | $varNo = $btr['blockVarNoToVarNoMap'][$blockVarNo]; |
| 641 | 641 | $bitr['blockVarTab'][$blockVarNo] = $this->varTab[$varNo]['varValue']; }} |
| 642 | 642 | |
| 643 | 643 | /** |
| 644 | 644 | * @access private |
| 645 | 645 | */ |
| 646 | -function registerBlockInstance (&$blockInstNo) {
|
|
| 646 | +function registerBlockInstance(&$blockInstNo) {
|
|
| 647 | 647 | $blockInstNo = $this->blockInstTabCnt++; } |
| 648 | 648 | |
| 649 | 649 | /** |
@@ -653,9 +653,9 @@ discard block |
||
| 653 | 653 | * block with the specified name exists in the template. |
| 654 | 654 | * @access public |
| 655 | 655 | */ |
| 656 | -function blockExists ($blockName) {
|
|
| 657 | - if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
|
|
| 658 | - return $this->lookupBlockName($blockName,$blockNo); } |
|
| 656 | +function blockExists($blockName) {
|
|
| 657 | + if (!$this->templateValid) {$this->triggerError("Template not valid."); return false; }
|
|
| 658 | + return $this->lookupBlockName($blockName, $blockNo); } |
|
| 659 | 659 | |
| 660 | 660 | //--- output generation --------------------------------------------------------------------------------------------- |
| 661 | 661 | |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | * @return boolean true on success, false on error. |
| 665 | 665 | * @access public |
| 666 | 666 | */ |
| 667 | -function generateOutput () {
|
|
| 667 | +function generateOutput() {
|
|
| 668 | 668 | $this->outputMode = 0; |
| 669 | 669 | if (!$this->generateOutputPage()) return false; |
| 670 | 670 | return true; } |
@@ -675,13 +675,13 @@ discard block |
||
| 675 | 675 | * @return boolean true on success, false on error. |
| 676 | 676 | * @access public |
| 677 | 677 | */ |
| 678 | -function generateOutputToFile ($fileName) {
|
|
| 679 | - $fh = fopen($fileName,"wb"); |
|
| 678 | +function generateOutputToFile($fileName) {
|
|
| 679 | + $fh = fopen($fileName, "wb"); |
|
| 680 | 680 | if ($fh === false) return false; |
| 681 | 681 | $this->outputMode = 1; |
| 682 | 682 | $this->outputFileHandle = $fh; |
| 683 | 683 | $ok = $this->generateOutputPage(); |
| 684 | - fclose ($fh); |
|
| 684 | + fclose($fh); |
|
| 685 | 685 | return $ok; } |
| 686 | 686 | |
| 687 | 687 | /** |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | * @return boolean true on success, false on error. |
| 692 | 692 | * @access public |
| 693 | 693 | */ |
| 694 | -function generateOutputToString (&$outputString) {
|
|
| 694 | +function generateOutputToString(&$outputString) {
|
|
| 695 | 695 | $outputString = "Error"; |
| 696 | 696 | $this->outputMode = 2; |
| 697 | 697 | $this->outputString = ""; |
@@ -704,14 +704,14 @@ discard block |
||
| 704 | 704 | * @return boolean true on success, false on error. |
| 705 | 705 | */ |
| 706 | 706 | function generateOutputPage() {
|
| 707 | - if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
|
|
| 707 | + if (!$this->templateValid) {$this->triggerError("Template not valid."); return false; }
|
|
| 708 | 708 | if ($this->blockTab[0]['instances'] == 0) |
| 709 | - $this->addBlockByNo (0); // add main block |
|
| 710 | - for ($blockNo=0; $blockNo < $this->blockTabCnt; $blockNo++) {
|
|
| 711 | - $btr =& $this->blockTab[$blockNo]; |
|
| 709 | + $this->addBlockByNo(0); // add main block |
|
| 710 | + for ($blockNo = 0; $blockNo < $this->blockTabCnt; $blockNo++) {
|
|
| 711 | + $btr = & $this->blockTab[$blockNo]; |
|
| 712 | 712 | $btr['currBlockInstNo'] = $btr['firstBlockInstNo']; } |
| 713 | 713 | $this->outputError = false; |
| 714 | - $this->writeBlockInstances (0, -1); |
|
| 714 | + $this->writeBlockInstances(0, -1); |
|
| 715 | 715 | if ($this->outputError) return false; |
| 716 | 716 | return true; } |
| 717 | 717 | |
@@ -721,33 +721,33 @@ discard block |
||
| 721 | 721 | * Called recursively. |
| 722 | 722 | * @access private |
| 723 | 723 | */ |
| 724 | -function writeBlockInstances ($blockNo, $parentInstLevel) {
|
|
| 725 | - $btr =& $this->blockTab[$blockNo]; |
|
| 724 | +function writeBlockInstances($blockNo, $parentInstLevel) {
|
|
| 725 | + $btr = & $this->blockTab[$blockNo]; |
|
| 726 | 726 | while (!$this->outputError) {
|
| 727 | 727 | $blockInstNo = $btr['currBlockInstNo']; |
| 728 | 728 | if ($blockInstNo == -1) break; |
| 729 | - $bitr =& $this->blockInstTab[$blockInstNo]; |
|
| 729 | + $bitr = & $this->blockInstTab[$blockInstNo]; |
|
| 730 | 730 | if ($bitr['parentInstLevel'] < $parentInstLevel) |
| 731 | - $this->programLogicError (2); |
|
| 731 | + $this->programLogicError(2); |
|
| 732 | 732 | if ($bitr['parentInstLevel'] > $parentInstLevel) break; |
| 733 | - $this->writeBlockInstance ($blockInstNo); |
|
| 733 | + $this->writeBlockInstance($blockInstNo); |
|
| 734 | 734 | $btr['currBlockInstNo'] = $bitr['nextBlockInstNo']; }} |
| 735 | 735 | |
| 736 | 736 | /** |
| 737 | 737 | * @access private |
| 738 | 738 | */ |
| 739 | 739 | function writeBlockInstance($blockInstNo) {
|
| 740 | - $bitr =& $this->blockInstTab[$blockInstNo]; |
|
| 740 | + $bitr = & $this->blockInstTab[$blockInstNo]; |
|
| 741 | 741 | $blockNo = $bitr['blockNo']; |
| 742 | - $btr =& $this->blockTab[$blockNo]; |
|
| 742 | + $btr = & $this->blockTab[$blockNo]; |
|
| 743 | 743 | $tPos = $btr['tPosContentsBegin']; |
| 744 | 744 | $subBlockNo = $blockNo + 1; |
| 745 | 745 | $varRefNo = $btr['firstVarRefNo']; |
| 746 | 746 | while (!$this->outputError) {
|
| 747 | 747 | $tPos2 = $btr['tPosContentsEnd']; |
| 748 | - $kind = 0; // assume end-of-block |
|
| 748 | + $kind = 0; // assume end-of-block |
|
| 749 | 749 | if ($varRefNo != -1 && $varRefNo < $this->varRefTabCnt) { // check for variable reference
|
| 750 | - $vrtr =& $this->varRefTab[$varRefNo]; |
|
| 750 | + $vrtr = & $this->varRefTab[$varRefNo]; |
|
| 751 | 751 | if ($vrtr['tPosBegin'] < $tPos) {
|
| 752 | 752 | $varRefNo += 1; |
| 753 | 753 | continue; } |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | $tPos2 = $vrtr['tPosBegin']; |
| 756 | 756 | $kind = 1; }} |
| 757 | 757 | if ($subBlockNo < $this->blockTabCnt) { // check for subblock
|
| 758 | - $subBtr =& $this->blockTab[$subBlockNo]; |
|
| 758 | + $subBtr = & $this->blockTab[$subBlockNo]; |
|
| 759 | 759 | if ($subBtr['tPosBegin'] < $tPos) {
|
| 760 | 760 | $subBlockNo += 1; |
| 761 | 761 | continue; } |
@@ -763,24 +763,24 @@ discard block |
||
| 763 | 763 | $tPos2 = $subBtr['tPosBegin']; |
| 764 | 764 | $kind = 2; }} |
| 765 | 765 | if ($tPos2 > $tPos) |
| 766 | - $this->writeString (substr($this->template,$tPos,$tPos2-$tPos)); |
|
| 766 | + $this->writeString(substr($this->template, $tPos, $tPos2 - $tPos)); |
|
| 767 | 767 | switch ($kind) {
|
| 768 | 768 | case 0: // end of block |
| 769 | 769 | return; |
| 770 | 770 | case 1: // variable |
| 771 | - $vrtr =& $this->varRefTab[$varRefNo]; |
|
| 771 | + $vrtr = & $this->varRefTab[$varRefNo]; |
|
| 772 | 772 | if ($vrtr['blockNo'] != $blockNo) |
| 773 | - $this->programLogicError (4); |
|
| 773 | + $this->programLogicError(4); |
|
| 774 | 774 | $variableValue = $bitr['blockVarTab'][$vrtr['blockVarNo']]; |
| 775 | - $this->writeString ($variableValue); |
|
| 775 | + $this->writeString($variableValue); |
|
| 776 | 776 | $tPos = $vrtr['tPosEnd']; |
| 777 | 777 | $varRefNo += 1; |
| 778 | 778 | break; |
| 779 | 779 | case 2: // sub block |
| 780 | - $subBtr =& $this->blockTab[$subBlockNo]; |
|
| 780 | + $subBtr = & $this->blockTab[$subBlockNo]; |
|
| 781 | 781 | if ($subBtr['parentBlockNo'] != $blockNo) |
| 782 | - $this->programLogicError (3); |
|
| 783 | - $this->writeBlockInstances ($subBlockNo, $bitr['instanceLevel']); // recursive call |
|
| 782 | + $this->programLogicError(3); |
|
| 783 | + $this->writeBlockInstances($subBlockNo, $bitr['instanceLevel']); // recursive call |
|
| 784 | 784 | $tPos = $subBtr['tPosEnd']; |
| 785 | 785 | $subBlockNo += 1; |
| 786 | 786 | break; }}} |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | /** |
| 789 | 789 | * @access private |
| 790 | 790 | */ |
| 791 | -function writeString ($s) {
|
|
| 791 | +function writeString($s) {
|
|
| 792 | 792 | if ($this->outputError) return; |
| 793 | 793 | switch ($this->outputMode) {
|
| 794 | 794 | case 0: // output to PHP output stream |
@@ -810,8 +810,8 @@ discard block |
||
| 810 | 810 | * @return boolean true on success, false if the variable is not found. |
| 811 | 811 | * @access private |
| 812 | 812 | */ |
| 813 | -function lookupVariableName ($varName, &$varNo) {
|
|
| 814 | - $x =& $this->varNameToNoMap[strtoupper($varName)]; |
|
| 813 | +function lookupVariableName($varName, &$varNo) {
|
|
| 814 | + $x = & $this->varNameToNoMap[strtoupper($varName)]; |
|
| 815 | 815 | if (!isset($x)) return false; |
| 816 | 816 | $varNo = $x; |
| 817 | 817 | return true; } |
@@ -823,8 +823,8 @@ discard block |
||
| 823 | 823 | * @return boolean true on success, false when the block is not found. |
| 824 | 824 | * @access private |
| 825 | 825 | */ |
| 826 | -function lookupBlockName ($blockName, &$blockNo) {
|
|
| 827 | - $x =& $this->blockNameToNoMap[strtoupper($blockName)]; |
|
| 826 | +function lookupBlockName($blockName, &$blockNo) {
|
|
| 827 | + $x = & $this->blockNameToNoMap[strtoupper($blockName)]; |
|
| 828 | 828 | if (!isset($x)) return false; |
| 829 | 829 | $blockNo = $x; |
| 830 | 830 | return true; } |
@@ -836,17 +836,17 @@ discard block |
||
| 836 | 836 | * @return boolean true on success, false on error. |
| 837 | 837 | * @access private |
| 838 | 838 | */ |
| 839 | -function readFileIntoString ($fileName, &$s) {
|
|
| 840 | - if (function_exists('version_compare') && version_compare(phpversion(),"4.3.0",">=")) {
|
|
| 839 | +function readFileIntoString($fileName, &$s) {
|
|
| 840 | + if (function_exists('version_compare') && version_compare(phpversion(), "4.3.0", ">=")) {
|
|
| 841 | 841 | $s = file_get_contents($fileName); |
| 842 | 842 | if ($s === false) return false; |
| 843 | 843 | return true; } |
| 844 | - $fh = fopen($fileName,"rb"); |
|
| 844 | + $fh = fopen($fileName, "rb"); |
|
| 845 | 845 | if ($fh === false) return false; |
| 846 | 846 | $fileSize = filesize($fileName); |
| 847 | - if ($fileSize === false) {fclose ($fh); return false; }
|
|
| 848 | - $s = fread($fh,$fileSize); |
|
| 849 | - fclose ($fh); |
|
| 847 | + if ($fileSize === false) {fclose($fh); return false; }
|
|
| 848 | + $s = fread($fh, $fileSize); |
|
| 849 | + fclose($fh); |
|
| 850 | 850 | if (strlen($s) != $fileSize) return false; |
| 851 | 851 | return true; } |
| 852 | 852 | |
@@ -854,7 +854,7 @@ discard block |
||
| 854 | 854 | * @access private |
| 855 | 855 | * @return boolean true on success, false when the end of the string is reached. |
| 856 | 856 | */ |
| 857 | -function parseWord ($s, &$p, &$w) {
|
|
| 857 | +function parseWord($s, &$p, &$w) {
|
|
| 858 | 858 | $sLen = strlen($s); |
| 859 | 859 | while ($p < $sLen && ord($s{$p}) <= 32) $p++;
|
| 860 | 860 | if ($p >= $sLen) return false; |
@@ -867,11 +867,11 @@ discard block |
||
| 867 | 867 | * @access private |
| 868 | 868 | * @return boolean true on success, false on error. |
| 869 | 869 | */ |
| 870 | -function parseQuotedString ($s, &$p, &$w) {
|
|
| 870 | +function parseQuotedString($s, &$p, &$w) {
|
|
| 871 | 871 | $sLen = strlen($s); |
| 872 | 872 | while ($p < $sLen && ord($s{$p}) <= 32) $p++;
|
| 873 | 873 | if ($p >= $sLen) return false; |
| 874 | - if (substr($s,$p,1) != '"') return false; |
|
| 874 | + if (substr($s, $p, 1) != '"') return false; |
|
| 875 | 875 | $p++; $p0 = $p; |
| 876 | 876 | while ($p < $sLen && $s{$p} != '"') $p++;
|
| 877 | 877 | if ($p >= $sLen) return false; |
@@ -883,39 +883,39 @@ discard block |
||
| 883 | 883 | * @access private |
| 884 | 884 | * @return boolean true on success, false on error. |
| 885 | 885 | */ |
| 886 | -function parseWordOrQuotedString ($s, &$p, &$w) {
|
|
| 886 | +function parseWordOrQuotedString($s, &$p, &$w) {
|
|
| 887 | 887 | $sLen = strlen($s); |
| 888 | 888 | while ($p < $sLen && ord($s{$p}) <= 32) $p++;
|
| 889 | 889 | if ($p >= $sLen) return false; |
| 890 | - if (substr($s,$p,1) == '"') |
|
| 891 | - return $this->parseQuotedString($s,$p,$w); |
|
| 890 | + if (substr($s, $p, 1) == '"') |
|
| 891 | + return $this->parseQuotedString($s, $p, $w); |
|
| 892 | 892 | else |
| 893 | - return $this->parseWord($s,$p,$w); } |
|
| 893 | + return $this->parseWord($s, $p, $w); } |
|
| 894 | 894 | |
| 895 | 895 | /** |
| 896 | 896 | * Combine two file system paths. |
| 897 | 897 | * @access private |
| 898 | 898 | */ |
| 899 | -function combineFileSystemPath ($path1, $path2) {
|
|
| 899 | +function combineFileSystemPath($path1, $path2) {
|
|
| 900 | 900 | if ($path1 == '' || $path2 == '') return $path2; |
| 901 | 901 | $s = $path1; |
| 902 | - if (substr($s,-1) != '\\' && substr($s,-1) != '/') $s = $s . "/"; |
|
| 903 | - if (substr($path2,0,1) == '\\' || substr($path2,0,1) == '/') |
|
| 904 | - $s = $s . substr($path2,1); |
|
| 902 | + if (substr($s, -1) != '\\' && substr($s, -1) != '/') $s = $s."/"; |
|
| 903 | + if (substr($path2, 0, 1) == '\\' || substr($path2, 0, 1) == '/') |
|
| 904 | + $s = $s.substr($path2, 1); |
|
| 905 | 905 | else |
| 906 | - $s = $s . $path2; |
|
| 906 | + $s = $s.$path2; |
|
| 907 | 907 | return $s; } |
| 908 | 908 | |
| 909 | 909 | /** |
| 910 | 910 | * @access private |
| 911 | 911 | */ |
| 912 | -function triggerError ($msg) {
|
|
| 913 | - trigger_error ("MiniTemplator error: $msg", E_USER_ERROR); }
|
|
| 912 | +function triggerError($msg) {
|
|
| 913 | + trigger_error("MiniTemplator error: $msg", E_USER_ERROR); }
|
|
| 914 | 914 | |
| 915 | 915 | /** |
| 916 | 916 | * @access private |
| 917 | 917 | */ |
| 918 | -function programLogicError ($errorId) {
|
|
| 918 | +function programLogicError($errorId) {
|
|
| 919 | 919 | die ("MiniTemplator: Program logic error $errorId.\n"); }
|
| 920 | 920 | |
| 921 | 921 | } |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | $entry = substr($ico, 6 + 16 * $i, 16); |
| 68 | 68 | if (!$entry || strlen($entry) < 16) |
| 69 | 69 | continue; |
| 70 | - $e = unpack("Cwidth/" . |
|
| 71 | - "Cheight/" . |
|
| 72 | - "Ccolors/" . |
|
| 73 | - "Czero/" . |
|
| 74 | - "vplanes/" . |
|
| 75 | - "vbpp/" . |
|
| 76 | - "Vsize/" . |
|
| 70 | + $e = unpack("Cwidth/". |
|
| 71 | + "Cheight/". |
|
| 72 | + "Ccolors/". |
|
| 73 | + "Czero/". |
|
| 74 | + "vplanes/". |
|
| 75 | + "vbpp/". |
|
| 76 | + "Vsize/". |
|
| 77 | 77 | "Voffset/", |
| 78 | 78 | $entry); |
| 79 | 79 | if ($e["width"] == 0) |
@@ -122,16 +122,16 @@ discard block |
||
| 122 | 122 | // directory entry. |
| 123 | 123 | $bitmapinfo = unpack("Vsize", $data); |
| 124 | 124 | if ($bitmapinfo["size"] == 40) { |
| 125 | - $info = unpack("Vsize/" . |
|
| 126 | - "Vwidth/" . |
|
| 127 | - "Vheight/" . |
|
| 128 | - "vplanes/" . |
|
| 129 | - "vbpp/" . |
|
| 130 | - "Vcompress/" . |
|
| 131 | - "Vsize/" . |
|
| 132 | - "Vxres/" . |
|
| 133 | - "Vyres/" . |
|
| 134 | - "Vpalcolors/" . |
|
| 125 | + $info = unpack("Vsize/". |
|
| 126 | + "Vwidth/". |
|
| 127 | + "Vheight/". |
|
| 128 | + "vplanes/". |
|
| 129 | + "vbpp/". |
|
| 130 | + "Vcompress/". |
|
| 131 | + "Vsize/". |
|
| 132 | + "Vxres/". |
|
| 133 | + "Vyres/". |
|
| 134 | + "Vpalcolors/". |
|
| 135 | 135 | "Vimpcolors/", $data); |
| 136 | 136 | if ($e["bpp"] == 0) { |
| 137 | 137 | $e["bpp"] = $info["bpp"]; |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $pixel1 = $palette[$p >> 4]; |
| 213 | 213 | $pixel2 = $palette[$p & 0x0f]; |
| 214 | 214 | $XOR[$y][$x] = $pixel1; |
| 215 | - $XOR[$y][$x+1] = $pixel2; |
|
| 215 | + $XOR[$y][$x + 1] = $pixel2; |
|
| 216 | 216 | $x += 2; |
| 217 | 217 | $offset++; |
| 218 | 218 | } elseif ($bpp == 8) { |