Use return instead of echo in the remaining core
Debug-messages still may use echo, and some functions in functions_image and trackback still use it to generate progress messages, which should get cleaned up as well but is not that urgent
This commit is contained in:
parent
0614fcdf51
commit
d80a8334c8
@ -16,7 +16,8 @@
|
||||
|
||||
* New additional option to render smarty-functions: serendipity_smarty_show($template, $data)
|
||||
|
||||
* A number of functions now returns their result instead of echoing them (TODO: Make that "all functions"):
|
||||
* A number of functions now returns their result instead of echoing them (TODO: a bunch of image- and
|
||||
trackback-functions still use echo for messages"):
|
||||
serendipity_plugin_config
|
||||
serendipity_printEntryForm
|
||||
serendipity_printEntries
|
||||
@ -24,6 +25,12 @@
|
||||
serendipity_showPropertyForm
|
||||
showMediaLibrary
|
||||
serendipity_guessInput
|
||||
memSnap
|
||||
serendipity_displayTopUrlList
|
||||
serendipity_displayTopExits
|
||||
serendipity_displayTopReferrers
|
||||
serendipity_printConfigTemplate
|
||||
show_plugins
|
||||
|
||||
* Functions removed from the core:
|
||||
serendipity_printConfigJS
|
||||
@ -77,4 +84,6 @@
|
||||
|
||||
* jQuery in the backend no longer runs in noConflict-mode. Use $(...) instead of jQuery(...)
|
||||
|
||||
* The entryproperty-plugin will now always delete its cache on uninstall, not only if the cache is activated then
|
||||
* The entryproperty-plugin will now always delete its cache on uninstall, not only if the cache is activated then
|
||||
|
||||
* serendipity_is_iframe now really only checks for iframe and doesn't also echo it
|
@ -68,10 +68,7 @@ switch ($_POST['installAction'] && serendipity_checkFormToken()) {
|
||||
default:
|
||||
$from = &$serendipity;
|
||||
$t = serendipity_parseTemplate(S9Y_CONFIG_TEMPLATE);
|
||||
ob_start();
|
||||
serendipity_printConfigTemplate($t, $from, false, true);
|
||||
$data['config'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$data['config'] = serendipity_printConfigTemplate($t, $from, false, true);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -325,17 +325,11 @@ if ( (int)$serendipity['GET']['step'] == 0 ) {
|
||||
|
||||
} elseif ( $serendipity['GET']['step'] == '2a' ) {
|
||||
$config = serendipity_parseTemplate(S9Y_CONFIG_TEMPLATE, null, array('simpleInstall'));
|
||||
ob_start();
|
||||
serendipity_printConfigTemplate($config, $from, true, false, false);
|
||||
$data['ob_serendipity_printConfigTemplate'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$data['ob_serendipity_printConfigTemplate'] = serendipity_printConfigTemplate($config, $from, true, false, false);
|
||||
|
||||
} elseif ( $serendipity['GET']['step'] == '2b' ) {
|
||||
$config = serendipity_parseTemplate(S9Y_CONFIG_TEMPLATE);
|
||||
ob_start();
|
||||
serendipity_printConfigTemplate($config, $from, true, false, false);
|
||||
$data['ob_serendipity_printConfigTemplate'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$data['ob_serendipity_printConfigTemplate'] = serendipity_printConfigTemplate($config, $from, true, false, false);
|
||||
|
||||
} elseif ( $serendipity['GET']['step'] == '3' ) {
|
||||
$serendipity['dbPrefix'] = $_POST['dbPrefix'];
|
||||
|
@ -105,10 +105,7 @@ $user = serendipity_fetchUsers($serendipity['authorid']);
|
||||
$from = $user[0];
|
||||
$from['groups'] = serendipity_getGroups($serendipity['authorid']);
|
||||
unset($from['password']);
|
||||
ob_start();
|
||||
serendipity_printConfigTemplate($template, $from, true, false);
|
||||
$data['config'] = ob_get_contents();
|
||||
ob_get_clean();
|
||||
$data['config'] = serendipity_printConfigTemplate($template, $from, true, false);
|
||||
|
||||
|
||||
$add = array('internal' => true);
|
||||
|
@ -389,20 +389,14 @@ if (isset($_GET['serendipity']['plugin_to_conf'])) {
|
||||
$data['backend_plugins_sidebar_header'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
ob_start();
|
||||
show_plugins(false, $sidebars);
|
||||
$data['sidebar_plugins'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$data['sidebar_plugins'] = show_plugins(false, $sidebars);
|
||||
|
||||
ob_start();
|
||||
serendipity_plugin_api::hook_event('backend_plugins_event_header', $serendipity);
|
||||
$data['backend_plugins_event_header'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
ob_start();
|
||||
show_plugins(true);
|
||||
$data['event_plugins'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$data['event_plugins'] = show_plugins(true);
|
||||
|
||||
if (count($serendipity['memSnaps']) > 0) {
|
||||
$data['$memsnaps'] = $serendipity['memSnaps'];
|
||||
@ -410,10 +404,6 @@ if (isset($_GET['serendipity']['plugin_to_conf'])) {
|
||||
|
||||
}
|
||||
|
||||
if (!is_object($serendipity['smarty'])) {
|
||||
serendipity_smarty_init();
|
||||
}
|
||||
|
||||
echo serendipity_smarty_show('admin/plugins.inc.tpl', $data);
|
||||
|
||||
/* vim: set sts=4 ts=4 expandtab : */
|
||||
|
@ -228,10 +228,7 @@ if ( ($serendipity['GET']['adminAction'] == 'edit' && serendipity_checkPermissio
|
||||
$from['groups'] = array();
|
||||
}
|
||||
|
||||
ob_start();
|
||||
serendipity_printConfigTemplate($config, $from, true, false, true, true);
|
||||
$data['config'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$data['config'] = serendipity_printConfigTemplate($config, $from, true, false, true, true);
|
||||
|
||||
} elseif ($serendipity['GET']['adminAction'] == 'delete' && serendipity_checkPermission('adminUsersDelete')) {
|
||||
$user = serendipity_fetchUsers($serendipity['GET']['userid']);
|
||||
@ -246,11 +243,6 @@ if ( ($serendipity['GET']['adminAction'] == 'edit' && serendipity_checkPermissio
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_object($serendipity['smarty'])) {
|
||||
serendipity_smarty_init();
|
||||
}
|
||||
|
||||
|
||||
echo serendipity_smarty_show('admin/users.inc.tpl', $data);
|
||||
|
||||
/* vim: set sts=4 ts=4 expandtab : */
|
||||
|
@ -58,8 +58,8 @@ function memSnap($tshow = '') {
|
||||
}
|
||||
|
||||
$current = memory_get_usage();
|
||||
echo '[' . date('d.m.Y H:i') . '] ' . number_format($current - $memUsage, 2, ',', '.') . ' label "' . $tshow . '", totalling ' . number_format($current, 2, ',', '.') . '<br />' . "\n";
|
||||
$memUsage = $current;
|
||||
return '[' . date('d.m.Y H:i') . '] ' . number_format($current - $memUsage, 2, ',', '.') . ' label "' . $tshow . '", totalling ' . number_format($current, 2, ',', '.') . '<br />' . "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -856,7 +856,7 @@ function serendipity_track_url($list, $url, $entry_id = 0) {
|
||||
* @return string List of Top referrers
|
||||
*/
|
||||
function serendipity_displayTopReferrers($limit = 10, $use_links = true, $interval = 7) {
|
||||
serendipity_displayTopUrlList('referrers', $limit, $use_links, $interval);
|
||||
return serendipity_displayTopUrlList('referrers', $limit, $use_links, $interval);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -870,7 +870,7 @@ function serendipity_displayTopReferrers($limit = 10, $use_links = true, $interv
|
||||
* @return string List of Top exits
|
||||
*/
|
||||
function serendipity_displayTopExits($limit = 10, $use_links = true, $interval = 7) {
|
||||
serendipity_displayTopUrlList('exits', $limit, $use_links, $interval);
|
||||
return serendipity_displayTopUrlList('exits', $limit, $use_links, $interval);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -913,18 +913,18 @@ function serendipity_displayTopUrlList($list, $limit, $use_links = true, $interv
|
||||
}
|
||||
|
||||
$rows = serendipity_db_query($query);
|
||||
echo "<span class='serendipityReferer'>";
|
||||
$output = "<span class='serendipityReferer'>";
|
||||
if (is_array($rows)) {
|
||||
foreach ($rows as $row) {
|
||||
if ($use_links) {
|
||||
printf(
|
||||
$output .= sprintf(
|
||||
'<span class="block_level"><a href="%1$s://%2$s" title="%2$s" >%2$s</a> (%3$s)</span>',
|
||||
htmlspecialchars($row['scheme']),
|
||||
htmlspecialchars($row['host']),
|
||||
htmlspecialchars($row['total'])
|
||||
);
|
||||
} else {
|
||||
printf(
|
||||
$output .= sprintf(
|
||||
'<span class="block_level">%1$s (%2$s)</span>',
|
||||
htmlspecialchars($row['host']),
|
||||
htmlspecialchars($row['total'])
|
||||
@ -932,7 +932,8 @@ function serendipity_displayTopUrlList($list, $limit, $use_links = true, $interv
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</span>";
|
||||
$output .= "</span>";
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,6 +110,7 @@ function serendipity_set_config_var($name, $val, $authorid = 0) {
|
||||
}
|
||||
|
||||
if (is_string($r)) {
|
||||
# if $r is a string, it is the error-message from the insert
|
||||
echo $r;
|
||||
}
|
||||
}
|
||||
@ -737,18 +738,6 @@ function serendipity_is_iframe() {
|
||||
global $serendipity;
|
||||
|
||||
if ($serendipity['GET']['is_iframe'] && is_array($_SESSION['save_entry'])) {
|
||||
include_once S9Y_INCLUDE_PATH . 'include/functions_entries_admin.inc.php';
|
||||
// An iframe may NOT contain <html> and </html> tags, that's why we emit different headers here than on serendipity_admin.php
|
||||
|
||||
// We need to restore GET/POST variables to that depending plugins inside the iframe
|
||||
// can still fetch all that variables; and we also tighten security by not allowing
|
||||
// to pass any different GET/POST variables to our iframe.
|
||||
$iframe_mode = $serendipity['GET']['iframe_mode'];
|
||||
$serendipity['POST'] = &$_SESSION['save_entry_POST'];
|
||||
$serendipity['GET'] = &$_SESSION['save_entry_POST']; // GET-Vars are the same as POST to ensure compatibility.
|
||||
$serendipity['hidefooter'] = true;
|
||||
ignore_user_abort(true);
|
||||
echo serendipity_iframe($_SESSION['save_entry'], $iframe_mode);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -494,7 +494,7 @@ function serendipity_printConfigTemplate($config, $from = false, $noForm = false
|
||||
}
|
||||
}
|
||||
$data['config'] = $config;
|
||||
echo serendipity_smarty_show('admin/config_template.tpl', $data);
|
||||
return serendipity_smarty_show('admin/config_template.tpl', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -203,7 +203,7 @@ function show_plugins($event_only = false, $sidebars = null)
|
||||
}
|
||||
|
||||
$data['total'] = $i;
|
||||
echo serendipity_smarty_show('admin/show_plugins.fnc.tpl', $data);
|
||||
return serendipity_smarty_show('admin/show_plugins.fnc.tpl', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -625,10 +625,7 @@ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_nam
|
||||
|
||||
if ($showExample && method_exists($plugin, 'example') ) {
|
||||
$data['showExample'] = true;
|
||||
ob_start();
|
||||
echo $plugin->example();
|
||||
$data['plugin_example'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$data['plugin_example'] = $plugin->example();
|
||||
}
|
||||
|
||||
if ($spawnNuggets && isset($serendipity['wysiwyg']) && $serendipity['wysiwyg'] && count($htmlnugget) > 0) {
|
||||
|
@ -14,7 +14,7 @@ class serendipity_event_statistics extends serendipity_event
|
||||
$propbag->add('description', PLUGIN_EVENT_STATISTICS_DESC);
|
||||
$propbag->add('stackable', false);
|
||||
$propbag->add('author', 'Arnan de Gans, Garvin Hicking, Fredrik Sandberg, kalkin');
|
||||
$propbag->add('version', '1.51');
|
||||
$propbag->add('version', '1.52');
|
||||
$propbag->add('requirements', array(
|
||||
'serendipity' => '0.8',
|
||||
'smarty' => '2.6.7',
|
||||
@ -532,11 +532,11 @@ class serendipity_event_statistics extends serendipity_event
|
||||
|
||||
<br />
|
||||
<dt><strong><?php echo TOP_REFERRER; ?></strong></dt>
|
||||
<dd><?php serendipity_displayTopReferrers($max_items, true); ?></dd>
|
||||
<dd><?php echo serendipity_displayTopReferrers($max_items, true); ?></dd>
|
||||
|
||||
<br />
|
||||
<dt><strong><?php echo TOP_EXITS; ?></strong></dt>
|
||||
<dd><?php serendipity_displayTopExits($max_items, true); ?></dd>
|
||||
<dd><?php echo serendipity_displayTopExits($max_items, true); ?></dd>
|
||||
</dl>
|
||||
<hr />
|
||||
<?php serendipity_plugin_api::hook_event('event_additional_statistics', $eventData, array('maxitems' => $max_items)); ?>
|
||||
|
@ -9,7 +9,7 @@ class serendipity_plugin_topexits extends serendipity_plugin {
|
||||
$propbag->add('description', SHOWS_TOP_EXIT);
|
||||
$propbag->add('stackable', false);
|
||||
$propbag->add('author', 'Serendipity Team');
|
||||
$propbag->add('version', '1.0');
|
||||
$propbag->add('version', '1.1');
|
||||
$propbag->add('configuration', array('limit', 'use_links', 'interval'));
|
||||
$propbag->add('groups', array('STATISTICS'));
|
||||
}
|
||||
@ -62,7 +62,7 @@ class serendipity_plugin_topexits extends serendipity_plugin {
|
||||
$use_links = serendipity_db_bool($use_links);
|
||||
}
|
||||
|
||||
serendipity_displayTopExits($this->get_config('limit', 10), $use_links, $this->get_config('interval', 7));
|
||||
echo serendipity_displayTopExits($this->get_config('limit', 10), $use_links, $this->get_config('interval', 7));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ class serendipity_plugin_topreferrers extends serendipity_plugin {
|
||||
$propbag->add('description', SHOWS_TOP_SITES);
|
||||
$propbag->add('stackable', false);
|
||||
$propbag->add('author', 'Serendipity Team');
|
||||
$propbag->add('version', '1.1');
|
||||
$propbag->add('version', '1.2');
|
||||
$propbag->add('configuration', array('limit', 'use_links', 'interval'));
|
||||
$propbag->add('groups', array('STATISTICS'));
|
||||
}
|
||||
@ -61,7 +61,7 @@ class serendipity_plugin_topreferrers extends serendipity_plugin {
|
||||
} else {
|
||||
$use_links = serendipity_db_bool($use_links);
|
||||
}
|
||||
serendipity_displayTopReferrers($this->get_config('limit', 10), $use_links, $this->get_config('interval', 7));
|
||||
echo serendipity_displayTopReferrers($this->get_config('limit', 10), $use_links, $this->get_config('interval', 7));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,18 @@ if (isset($serendipity['GET']['adminModule']) && $serendipity['GET']['adminModul
|
||||
|
||||
// If we are inside an iframe, halt the script
|
||||
if (serendipity_is_iframe() !== false) {
|
||||
include_once S9Y_INCLUDE_PATH . 'include/functions_entries_admin.inc.php';
|
||||
// An iframe may NOT contain <html> and </html> tags, that's why we emit different headers here than on serendipity_admin.php
|
||||
|
||||
// We need to restore GET/POST variables to that depending plugins inside the iframe
|
||||
// can still fetch all that variables; and we also tighten security by not allowing
|
||||
// to pass any different GET/POST variables to our iframe.
|
||||
$iframe_mode = $serendipity['GET']['iframe_mode'];
|
||||
$serendipity['POST'] = &$_SESSION['save_entry_POST'];
|
||||
$serendipity['GET'] = &$_SESSION['save_entry_POST']; // GET-Vars are the same as POST to ensure compatibility.
|
||||
$serendipity['hidefooter'] = true;
|
||||
ignore_user_abort(true);
|
||||
echo serendipity_iframe($_SESSION['save_entry'], $iframe_mode);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ if (!defined('IN_serendipity')) {
|
||||
|
||||
include(S9Y_INCLUDE_PATH . 'include/compat.inc.php');
|
||||
if (defined('USE_MEMSNAP')) {
|
||||
memSnap('Framework init');
|
||||
echo memSnap('Framework init');
|
||||
}
|
||||
|
||||
// The version string
|
||||
@ -296,7 +296,7 @@ if (!serendipity_db_connect()) {
|
||||
*/
|
||||
|
||||
if (defined('USE_MEMSNAP')) {
|
||||
memSnap('Framework init');
|
||||
echo memSnap('Framework init');
|
||||
}
|
||||
|
||||
serendipity_load_configuration();
|
||||
|
Loading…
x
Reference in New Issue
Block a user