Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving some memory for echo. #1182

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,8 @@ protected function dbConfig($values = array()) {
$this->input('dbCharset', 'DB Charset', $values['dbCharset']);
echo "<p style='width: 135px; float: left; margin-top: 0;'><label>DB Engine</label><br />";
echo "<select name='dbEngine'>";
echo "<option value='MyISAM'" . ($values['dbEngine'] != 'InnoDB' ? " selected" : "") . ">MyISAM</option>";
echo "<option value='InnoDB'" . ($values['dbEngine'] == 'InnoDB' ? " selected" : "") . ">InnoDB</option>";
echo "<option value='MyISAM'" , ($values['dbEngine'] != 'InnoDB' ? " selected" : "") , ">MyISAM</option>";
echo "<option value='InnoDB'" , ($values['dbEngine'] == 'InnoDB' ? " selected" : "") , ">InnoDB</option>";
echo "</select></p>";
echo "</div>";

Expand Down Expand Up @@ -496,7 +496,7 @@ protected function dbConfig($values = array()) {
$this->p("What host names will this installation run on now and in the future? Please enter one host per line. You may also choose to leave this blank to auto-detect on each request, but we recommend using this whitelist for the best security in production environments.");
$this->p("This field is recommended but not required. You can set this later by editing the file <u>/site/config.php</u> (setting \$config->httpHosts).", "detail");
$rows = substr_count($values['httpHosts'], "\n") + 2;
echo "<p><textarea name='httpHosts' rows='$rows' style='width: 100%;'>" . htmlentities($values['httpHosts'], ENT_QUOTES, 'UTF-8') . "</textarea></p>";
echo "<p><textarea name='httpHosts' rows='$rows' style='width: 100%;'>" , htmlentities($values['httpHosts'], ENT_QUOTES, 'UTF-8') , "</textarea></p>";

$this->btn("Continue", 4);

Expand Down Expand Up @@ -871,7 +871,7 @@ protected function adminAccount($wire = null) {
$this->input("admin_name", "Admin Login URL", $clean['admin_name'], false, "name");
$js = "$('link#colors').attr('href', $('link#colors').attr('href').replace(/main-.*$/, 'main-' + $(this).val() + '.css'))";
echo "<p class='ui-helper-clearfix'><label>Color Theme<br /><select name='colors' id='colors' onchange=\"$js\">";
foreach($this->colors as $color) echo "<option value='$color'>" . ucfirst($color) . "</option>";
foreach($this->colors as $color) echo "<option value='$color'>" , ucfirst($color) , "</option>";
echo "</select></label> <span class='detail'><i class='fa fa-angle-left'></i> Change for a live preview</span></p>";

$this->p("<i class='fa fa-info-circle'></i> You can change the admin URL later by editing the admin page and changing the name on the settings tab.<br /><i class='fa fa-info-circle'></i> You can change the colors later by going to Admin <i class='fa fa-angle-right'></i> Modules <i class='fa fa-angle-right detail'></i> Core <i class='fa fa-angle-right detail'></i> Admin Theme <i class='fa fa-angle-right'></i> Settings.", "detail");
Expand Down
2 changes: 1 addition & 1 deletion site-beginner/templates/basic-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div id='content'><?php

// output 'headline' if available, otherwise 'title'
echo "<h1>" . $page->get('headline|title') . "</h1>";
echo "<h1>" , $page->get('headline|title') , "</h1>";

// output bodycopy
echo $page->body;
Expand Down
2 changes: 1 addition & 1 deletion site-beginner/templates/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div id='content'><?php

// output 'headline' if available, otherwise 'title'
echo "<h1>" . $page->get('headline|title') . "</h1>";
echo "<h1>" , $page->get('headline|title') , "</h1>";

// output bodycopy
echo $page->body;
Expand Down
6 changes: 3 additions & 3 deletions site-languages/templates/_main.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
}

// output an "Edit" link if this page happens to be editable by the current user
if($page->editable()) echo "<li class='edit'><a href='$page->editUrl'>" . __('Edit') . "</a></li>";
if($page->editable()) echo "<li class='edit'><a href='$page->editUrl'>" , __('Edit') , "</a></li>";
?></ul>

<!-- breadcrumbs -->
Expand Down Expand Up @@ -138,10 +138,10 @@
<?php
if($user->isLoggedin()) {
// if user is logged in, show a logout link
echo "<a href='{$config->urls->admin}login/logout/'>" . sprintf(__('Logout (%s)'), $user->name) . "</a>";
echo "<a href='{$config->urls->admin}login/logout/'>" , sprintf(__('Logout (%s)'), $user->name) , "</a>";
} else {
// if user not logged in, show a login link
echo "<a href='{$config->urls->admin}'>" . __('Admin Login') . "</a>";
echo "<a href='{$config->urls->admin}'>" , __('Admin Login') , "</a>";
}
?>

Expand Down
4 changes: 2 additions & 2 deletions wire/modules/AdminTheme/AdminThemeDefault/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<?php
if($user->isLoggedin()) {
echo $searchForm;
echo "\n\n<ul id='topnav'>" . $helpers->renderTopNavItems() . "</ul>";
echo "\n\n<ul id='topnav'>" , $helpers->renderTopNavItems() , "</ul>";
}
echo $extras['masthead'];
?>
Expand Down Expand Up @@ -111,7 +111,7 @@
<a class='action' href='<?php echo $config->urls->admin; ?>login/logout/'><?php echo $helpers->_('Logout'); ?></a>
</span>
<?php endif; ?>
ProcessWire <?php echo $config->versionName . ' <!--v' . $config->systemVersion; ?>--> &copy; <?php echo date("Y"); ?>
ProcessWire <?php echo $config->versionName , ' <!--v' , $config->systemVersion; ?>--> &copy; <?php echo date("Y"); ?>
</p>

<?php
Expand Down
22 changes: 11 additions & 11 deletions wire/modules/AdminTheme/AdminThemeReno/debug.inc
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
<?php
foreach($fuel as $key => $value) {
if(!is_object($value)) continue;
echo "\n<tr><td><a target='_blank' href='http://processwire.com/api/variables/$key/'>\$$key</a></td>" .
"<td>" . get_class($value) . "</td></tr>";
echo "\n<tr><td><a target='_blank' href='http://processwire.com/api/variables/$key/'>\$$key</a></td>" ,
"<td>" , get_class($value) , "</td></tr>";
}
?>
</tbody>
Expand All @@ -64,7 +64,7 @@
foreach($session as $key => $value) {
if(is_object($value)) $value = (string) $value;
if(is_array($value)) $value = print_r($value, true);
echo "<tr><td>$key</td><td><pre>" . $sanitizer->entities($value) . "</pre></td></tr>";
echo "<tr><td>$key</td><td><pre>" , $sanitizer->entities($value) , "</pre></td></tr>";
}
?>
</tbody>
Expand Down Expand Up @@ -104,7 +104,7 @@
</tbody>
</table>
<p class='description'><?php echo
sprintf(__('%d modules loaded', __FILE__), $numLoaded) . ' / ' .
sprintf(__('%d modules loaded', __FILE__), $numLoaded) , ' / ' ,
sprintf(__('%d not loaded', __FILE__), $numSkipped);
?></p>
</div>
Expand Down Expand Up @@ -133,11 +133,11 @@
$toMethod = $hook['toMethod'];
if(is_callable($toMethod)) $toMethod = 'anonymous function';
echo "<tr>";
echo "<td>" . ($hook['options']['before'] ? 'before ' : '') . ($hook['options']['after'] ? 'after' : '') . "</td>";
echo "<td>" . ($hook['options']['fromClass'] ? $hook['options']['fromClass'] . '::' : '') . "$hook[method]$suffix</td>";
echo "<td>" . ($toObject ? "$toObject::$toMethod" : $toMethod) . "()</td>";
echo "<td>" . ($hook['options']['allInstances'] || $hook['options']['fromClass'] ? "class " : "instance ") . $hook['options']['type'] . "</td>";
echo "<td>" . $hook['options']['priority'] . "</td>";
echo "<td>" , ($hook['options']['before'] ? 'before ' : '') , ($hook['options']['after'] ? 'after' : '') , "</td>";
echo "<td>" , ($hook['options']['fromClass'] ? $hook['options']['fromClass'] . '::' : '') , "$hook[method]$suffix</td>";
echo "<td>" , ($toObject ? "$toObject::$toMethod" : $toMethod) , "()</td>";
echo "<td>" , ($hook['options']['allInstances'] || $hook['options']['fromClass'] ? "class " : "instance ") , $hook['options']['type'] , "</td>";
echo "<td>" , $hook['options']['priority'] , "</td>";
echo "</tr>";
}
?>
Expand Down Expand Up @@ -192,7 +192,7 @@ Debug::saveTimer('timer-name', 'optional notes'); // stop and save timer
</table>
<?php else: ?>
<p>Mysqli was instantiated but no queries executed. Here are the callers that should be converted to PDO:</p>
<ul><?php foreach($db->getCallers() as $n => $caller) echo "<li>" . ($n+1) . ". $caller</li>"; ?></ul>
<ul><?php foreach($db->getCallers() as $n => $caller) echo "<li>" , ($n+1) , ". $caller</li>"; ?></ul>
<?php
endif;
unset($queries);
Expand Down Expand Up @@ -238,7 +238,7 @@ Debug::saveTimer('timer-name', 'optional notes'); // stop and save timer
<?php
foreach($i as $key => $value) {
if(is_array($value)) $value = print_r($value, true);
echo "<tr><td>" . $sanitizer->entities($key) . "</td><td><pre>" . $sanitizer->entities($value) . "</pre></td></tr>";
echo "<tr><td>" , $sanitizer->entities($key) , "</td><td><pre>" , $sanitizer->entities($value) , "</pre></td></tr>";
}
?>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion wire/modules/AdminTheme/AdminThemeReno/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<a class="action" href="<?php echo $config->urls->admin; ?>login/logout/"><i class="fa fa-times"></i> <?php echo $helpers->_('Logout'); ?></a>
</span>
<?php endif; ?>
ProcessWire <?php echo $config->versionName . ' <!--v' . $config->systemVersion; ?>--> &copy; <?php echo date("Y"); ?>
ProcessWire <?php echo $config->versionName , ' <!--v' , $config->systemVersion; ?>--> &copy; <?php echo date("Y"); ?>
</p>

<?php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
if(!preg_match('/^[-A-Z0-9\., ]+$/iD', $city)) continue;

// print the city
echo "\n\t<li>" . htmlspecialchars($city) . "</li>";
echo "\n\t<li>" , htmlspecialchars($city) , "</li>";
}

echo "\n</ul>";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected function renderAjax(Page $page, Field $field) {
if(!$inputfield) return;
echo $inputfield->render();
if($this->notes) {
echo "<p class='notes'>" . $this->wire('sanitizer')->entities($this->notes) . "</p>";
echo "<p class='notes'>" , $this->wire('sanitizer')->entities($this->notes) , "</p>";
$this->notes = '';
}
exit;
Expand Down
24 changes: 12 additions & 12 deletions wire/templates-admin/debug.inc
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
<?php
foreach($fuel as $key => $value) {
if(!is_object($value)) continue;
echo "\n<tr><td><a target='_blank' href='http://processwire.com/api/variables/$key/'>\$$key</a></td>" .
"<td>" . get_class($value) . "</td></tr>";
echo "\n<tr><td><a target='_blank' href='http://processwire.com/api/variables/$key/'>\$$key</a></td>" ,
"<td>" , get_class($value) , "</td></tr>";
}
?>
</tbody>
Expand All @@ -71,7 +71,7 @@
foreach($session as $key => $value) {
if(is_object($value)) $value = (string) $value;
if(is_array($value)) $value = print_r($value, true);
echo "<tr><td>$key</td><td><pre>" . $sanitizer->entities($value) . "</pre></td></tr>";
echo "<tr><td>$key</td><td><pre>" , $sanitizer->entities($value) , "</pre></td></tr>";
}
?>
</tbody>
Expand Down Expand Up @@ -113,7 +113,7 @@
</tbody>
</table>
<p class='description'><?php echo
sprintf(__('%d modules loaded', __FILE__), $numLoaded) . ' / ' .
sprintf(__('%d modules loaded', __FILE__), $numLoaded) , ' / ' ,
sprintf(__('%d not loaded', __FILE__), $numSkipped);
?></p>
</div>
Expand Down Expand Up @@ -144,11 +144,11 @@
$toMethod = $hook['toMethod'];
if(is_callable($toMethod)) $toMethod = 'anonymous function';
echo "<tr>";
echo "<td>" . ($hook['options']['before'] ? 'before ' : '') . ($hook['options']['after'] ? 'after' : '') . "</td>";
echo "<td>" . ($hook['options']['fromClass'] ? $hook['options']['fromClass'] . '::' : '') . "$hook[method]$suffix</td>";
echo "<td>" . ($toObject ? "$toObject::$toMethod" : $toMethod) . "()</td>";
echo "<td>" . ($hook['options']['allInstances'] || $hook['options']['fromClass'] ? "class " : "instance ") . $hook['options']['type'] . "</td>";
echo "<td>" . $hook['options']['priority'] . "</td>";
echo "<td>" , ($hook['options']['before'] ? 'before ' : '') , ($hook['options']['after'] ? 'after' : '') , "</td>";
echo "<td>" , ($hook['options']['fromClass'] ? $hook['options']['fromClass'] . '::' : '') , "$hook[method]$suffix</td>";
echo "<td>" , ($toObject ? "$toObject::$toMethod" : $toMethod) , "()</td>";
echo "<td>" , ($hook['options']['allInstances'] || $hook['options']['fromClass'] ? "class " : "instance ") , $hook['options']['type'] , "</td>";
echo "<td>" , $hook['options']['priority'] , "</td>";
echo "</tr>";
}
?>
Expand Down Expand Up @@ -207,7 +207,7 @@ Debug::saveTimer('timer-name', 'optional notes'); // stop and save timer
</table>
<?php else: ?>
<p>Mysqli was instantiated but no queries executed. Here are the callers that should be converted to PDO:</p>
<ul><?php foreach($db->getCallers() as $n => $caller) echo "<li>" . ($n+1) . ". $caller</li>"; ?></ul>
<ul><?php foreach($db->getCallers() as $n => $caller) echo "<li>" , ($n+1) , ". $caller</li>"; ?></ul>
<?php
endif;
unset($queries);
Expand Down Expand Up @@ -255,7 +255,7 @@ Debug::saveTimer('timer-name', 'optional notes'); // stop and save timer
<?php
foreach($i as $key => $value) {
if(is_array($value)) $value = print_r($value, true);
echo "<tr><td>" . $sanitizer->entities($key) . "</td><td><pre>" . $sanitizer->entities($value) . "</pre></td></tr>";
echo "<tr><td>" , $sanitizer->entities($key) , "</td><td><pre>" , $sanitizer->entities($value) , "</pre></td></tr>";
}
?>
</tbody>
Expand All @@ -272,7 +272,7 @@ Debug::saveTimer('timer-name', 'optional notes'); // stop and save timer
<?php
foreach($cache->getInfo() as $info) {
echo "<table class=''><thead><tr><th colspan='2'>";
echo $sanitizer->entities($info['name']) . "</th></tr></thead><tbody>";
echo $sanitizer->entities($info['name']) , "</th></tr></thead><tbody>";
foreach($info as $key => $value) {
if($key == 'name') continue;
if($key == 'size') $value = wireBytesStr($value);
Expand Down
2 changes: 1 addition & 1 deletion wire/templates-admin/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@

<?php endif; ?>

ProcessWire <?php echo $config->version . ' <!--v' . $config->systemVersion; ?>--> &copy; <?php echo date("Y"); ?> Ryan Cramer
ProcessWire <?php echo $config->version , ' <!--v' , $config->systemVersion; ?>--> &copy; <?php echo date("Y"); ?> Ryan Cramer
</p>

<?php if($config->debug && $this->user->isSuperuser()) include($config->paths->adminTemplates . "debug.inc"); ?>
Expand Down