1
0

show_plugin_config: use return instead of echo

This commit is contained in:
onli
2013-06-21 12:28:43 +02:00
parent 6aa0f69ce0
commit 342d8676bf
3 changed files with 39 additions and 51 deletions

View File

@@ -149,10 +149,7 @@ if (isset($_GET['serendipity']['plugin_to_conf'])) {
} }
$data['license'] = $license; $data['license'] = $license;
ob_start(); $data['config'] = serendipity_plugin_config($plugin, $bag, $name, $desc, $config_names, true, true, true, true, 'plugin', $config_groups);
serendipity_plugin_config($plugin, $bag, $name, $desc, $config_names, true, true, true, true, 'plugin', $config_groups);
$data['config'] = ob_get_contents();
ob_end_clean();
} elseif ( $serendipity['GET']['adminAction'] == 'addnew' ) { } elseif ( $serendipity['GET']['adminAction'] == 'addnew' ) {
$data['adminAction'] = 'addnew'; $data['adminAction'] = 'addnew';

View File

@@ -128,8 +128,7 @@ if (is_array($template_config)) {
$template_options->import($template_config); $template_options->import($template_config);
$template_options->values =& $template_vars; $template_options->values =& $template_vars;
ob_start(); $data["configuration"] = serendipity_plugin_config(
serendipity_plugin_config(
$template_options, $template_options,
$template_vars, $template_vars,
$serendipity['template'], $serendipity['template'],
@@ -142,56 +141,50 @@ if (is_array($template_config)) {
'template', 'template',
$template_config_groups $template_config_groups
); );
$data["configuration"] = ob_get_contents();
ob_end_clean();
serendipity_plugin_api::hook_event('backend_templates_configuration_bottom', $template_config); serendipity_plugin_api::hook_event('backend_templates_configuration_bottom', $template_config);
} else { } else {
serendipity_plugin_api::hook_event('backend_templates_configuration_none', $template_config); serendipity_plugin_api::hook_event('backend_templates_configuration_none', $template_config);
} }
$i = 0; $i = 0;
$stack = array(); $stack = array();
serendipity_plugin_api::hook_event('backend_templates_fetchlist', $stack); serendipity_plugin_api::hook_event('backend_templates_fetchlist', $stack);
$themes = serendipity_fetchTemplates(); $themes = serendipity_fetchTemplates();
$data['templates'] = array(); $data['templates'] = array();
$data['templates'][$theme] = array(); $data['templates'][$theme] = array();
foreach($themes AS $theme) { foreach($themes AS $theme) {
$stack[$theme] = serendipity_fetchTemplateInfo($theme); $stack[$theme] = serendipity_fetchTemplateInfo($theme);
}
ksort($stack);
foreach ($stack as $theme => $info) {
$data['templates'][$theme]['info'] = $info;
/* Sorry, but we don't display engines */
if ( strtolower($info['engine']) == 'yes' ) {
continue;
} }
ksort($stack);
if (file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $theme . '/preview_fullsize.jpg')) {
foreach ($stack as $theme => $info) { $data['templates'][$theme]['fullsize_preview'] = $serendipity['baseURL'] . $serendipity['templatePath'] . $theme . '/preview_fullsize.jpg';
$data['templates'][$theme]['info'] = $info; } elseif (!empty($info['preview_fullsizeURL'])) {
/* Sorry, but we don't display engines */ $data['templates'][$theme]['fullsize_preview'] = $info['preview_fullsizeURL'];
if ( strtolower($info['engine']) == 'yes' ) {
continue;
}
if (file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $theme . '/preview_fullsize.jpg')) {
$data['templates'][$theme]['fullsize_preview'] = $serendipity['baseURL'] . $serendipity['templatePath'] . $theme . '/preview_fullsize.jpg';
} elseif (!empty($info['preview_fullsizeURL'])) {
$data['templates'][$theme]['fullsize_preview'] = $info['preview_fullsizeURL'];
}
if (file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $theme . '/preview.png')) {
$data['templates'][$theme]['preview'] = $serendipity['templatePath'] . $theme . '/preview.png';
} elseif (!empty($info['previewURL'])) {
$data['templates'][$theme]['preview'] = $info['previewURL'] ;
}
$unmetRequirements = array();
if ( isset($info['require serendipity']) && version_compare($info['require serendipity'], serendipity_getCoreVersion($serendipity['version']), '>') ) {
$unmetRequirements[] = 'Serendipity '. $info['require serendipity'];
$data['templates'][$theme]['unmetRequirements'] = sprintf(UNMET_REQUIREMENTS, implode(', ', $unmetRequirements));
}
/* TODO: Smarty versioncheck */
} }
if (!is_object($serendipity['smarty'])) { if (file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $theme . '/preview.png')) {
serendipity_smarty_init(); $data['templates'][$theme]['preview'] = $serendipity['templatePath'] . $theme . '/preview.png';
} elseif (!empty($info['previewURL'])) {
$data['templates'][$theme]['preview'] = $info['previewURL'] ;
}
$unmetRequirements = array();
if ( isset($info['require serendipity']) && version_compare($info['require serendipity'], serendipity_getCoreVersion($serendipity['version']), '>') ) {
$unmetRequirements[] = 'Serendipity '. $info['require serendipity'];
$data['templates'][$theme]['unmetRequirements'] = sprintf(UNMET_REQUIREMENTS, implode(', ', $unmetRequirements));
}
/* TODO: Smarty versioncheck */
} }
echo serendipity_smarty_show('admin/templates.inc.tpl', $data); echo serendipity_smarty_show('admin/templates.inc.tpl', $data);

View File

@@ -224,7 +224,7 @@ function show_plugins($event_only = false, $sidebars = null)
* @param boolean Spawn a plugins' configuration WYSIWYG items? * @param boolean Spawn a plugins' configuration WYSIWYG items?
* @param string The array index name of POSTed values ($serendipity['POST'][xxx]) * @param string The array index name of POSTed values ($serendipity['POST'][xxx])
* @param array An array that groups certain config keys * @param array An array that groups certain config keys
* @return boolean * @return string The configuration HTML
*/ */
function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_names, $showTable = true, $showSubmit = true, $showExample = true, $spawnNuggets = true, $postKey = 'plugin', $config_groups = NULL) { function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_names, $showTable = true, $showSubmit = true, $showExample = true, $spawnNuggets = true, $postKey = 'plugin', $config_groups = NULL) {
global $serendipity; global $serendipity;
@@ -647,7 +647,5 @@ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_nam
$data['ev'] = $ev; $data['ev'] = $ev;
} }
echo serendipity_smarty_show('admin/plugin_config.tpl', $data); return serendipity_smarty_show('admin/plugin_config.tpl', $data);
return true;
} }