consistent plugin usage - superuser

this and followup commits touches:
    class method parenthesis "\n{\n    <code>\n}\n",
    case break switches,
    consistent boolean usage,
    append css to eventData
    and other cleanups
This commit is contained in:
Ian 2016-01-26 13:58:12 +01:00
parent d2cdb8f2ba
commit f7bfa7123b

View File

@ -1,6 +1,11 @@
<?php <?php
class serendipity_plugin_superuser extends serendipity_plugin { if (IN_serendipity !== true) {
die ("Don't hack!");
}
class serendipity_plugin_superuser extends serendipity_plugin
{
var $title = SUPERUSER; var $title = SUPERUSER;
function introspect(&$propbag) function introspect(&$propbag)
@ -9,27 +14,11 @@ class serendipity_plugin_superuser extends serendipity_plugin {
$propbag->add('description', ALLOWS_YOU_BLAHBLAH); $propbag->add('description', ALLOWS_YOU_BLAHBLAH);
$propbag->add('stackable', false); $propbag->add('stackable', false);
$propbag->add('author', 'Serendipity Team'); $propbag->add('author', 'Serendipity Team');
$propbag->add('version', '1.0'); $propbag->add('version', '1.1');
$propbag->add('configuration', array('https')); $propbag->add('configuration', array('https'));
$propbag->add('groups', array('FRONTEND_FEATURES')); $propbag->add('groups', array('FRONTEND_FEATURES'));
} }
function generate_content(&$title)
{
global $serendipity;
$title = $this->title;
if ($this->get_config('https', 'false') == 'true') {
$base = str_replace('http://', 'https://', $serendipity['baseURL']);
} else {
$base = $serendipity['serendipityHTTPPath'];
}
$link = $base . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] .'?/' : '') . PATH_ADMIN;
$text = (($_SESSION['serendipityAuthedUser'] === true) ? SUPERUSER_OPEN_ADMIN : SUPERUSER_OPEN_LOGIN);
echo '<a href="' . $link . '" rel="nofollow" title="'. $text .'">'. $text .'</a>';
}
function introspect_config_item($name, &$propbag) function introspect_config_item($name, &$propbag)
{ {
switch($name) { switch($name) {
@ -45,6 +34,23 @@ class serendipity_plugin_superuser extends serendipity_plugin {
} }
return true; return true;
} }
function generate_content(&$title)
{
global $serendipity;
$title = $this->title;
if (serendipity_db_bool($this->get_config('https', 'false'))) {
$base = str_replace('http://', 'https://', $serendipity['baseURL']);
} else {
$base = $serendipity['serendipityHTTPPath'];
}
$link = $base . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] .'?/' : '') . PATH_ADMIN;
$text = (($_SESSION['serendipityAuthedUser'] === true) ? SUPERUSER_OPEN_ADMIN : SUPERUSER_OPEN_LOGIN);
echo '<a href="' . $link . '" rel="nofollow" title="'. $text .'">'. $text .'</a>';
}
} }
?> ?>