consistent plugin usage - authors
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:
@ -1,16 +1,22 @@
|
||||
<?php
|
||||
|
||||
class serendipity_plugin_authors extends serendipity_plugin {
|
||||
if (IN_serendipity !== true) {
|
||||
die ("Don't hack!");
|
||||
}
|
||||
|
||||
class serendipity_plugin_authors extends serendipity_plugin
|
||||
{
|
||||
var $title = AUTHORS;
|
||||
|
||||
function introspect(&$propbag) {
|
||||
function introspect(&$propbag)
|
||||
{
|
||||
global $serendipity;
|
||||
|
||||
$propbag->add('name', AUTHORS);
|
||||
$propbag->add('description', AUTHOR_PLUGIN_DESC);
|
||||
$propbag->add('stackable', true);
|
||||
$propbag->add('author', 'Serendipity Team');
|
||||
$propbag->add('version', '2.1');
|
||||
$propbag->add('version', '2.2');
|
||||
$propbag->add('configuration', array('image', 'allow_select', 'title', 'showartcount', 'mincount'));
|
||||
$propbag->add('groups', array('FRONTEND_VIEWS'));
|
||||
}
|
||||
@ -18,7 +24,9 @@ class serendipity_plugin_authors extends serendipity_plugin {
|
||||
function introspect_config_item($name, &$propbag)
|
||||
{
|
||||
global $serendipity;
|
||||
|
||||
switch($name) {
|
||||
|
||||
case 'title':
|
||||
$propbag->add('type', 'string');
|
||||
$propbag->add('name', TITLE);
|
||||
@ -37,7 +45,7 @@ class serendipity_plugin_authors extends serendipity_plugin {
|
||||
$propbag->add('type', 'boolean');
|
||||
$propbag->add('name', AUTHORS_SHOW_ARTICLE_COUNT);
|
||||
$propbag->add('description', AUTHORS_SHOW_ARTICLE_COUNT_DESC);
|
||||
$propbag->add('default', false);
|
||||
$propbag->add('default', 'false');
|
||||
break;
|
||||
|
||||
case 'mincount':
|
||||
@ -53,21 +61,22 @@ class serendipity_plugin_authors extends serendipity_plugin {
|
||||
return true;
|
||||
}
|
||||
|
||||
function generate_content(&$title) {
|
||||
function generate_content(&$title)
|
||||
{
|
||||
global $serendipity;
|
||||
|
||||
$title = $this->get_config('title', $this->title);
|
||||
|
||||
$sort = $this->get_config('sort_order');
|
||||
if ($sort == 'none') {
|
||||
$sort = '';
|
||||
$sort = '';
|
||||
} else {
|
||||
$sort .= ' ' . $this->get_config('sort_method');
|
||||
}
|
||||
$is_count = serendipity_db_bool($this->get_config('showartcount'));
|
||||
$mincount = (int)$this->get_config('mincount');
|
||||
$authors = serendipity_fetchUsers(null, 'hidden', $is_count);
|
||||
$html = '';
|
||||
$is_count = serendipity_db_bool($this->get_config('showartcount', 'false'));
|
||||
$mincount = (int)$this->get_config('mincount');
|
||||
$authors = serendipity_fetchUsers(null, 'hidden', $is_count);
|
||||
$html = '';
|
||||
|
||||
$image = $this->get_config('image', serendipity_getTemplateFile('img/xml.gif'));
|
||||
$image = (($image == "'none'" || $image == 'none') ? '' : $image);
|
||||
@ -89,9 +98,9 @@ class serendipity_plugin_authors extends serendipity_plugin {
|
||||
$html .= '<li>';
|
||||
|
||||
if ( !empty($image) ) {
|
||||
$html .= '<a class="serendipity_xml_icon" href="'. serendipity_feedAuthorURL($auth, 'serendipityHTTPPath') .'"><img src="'. $image .'" alt="XML" style="border: 0px" /></a> ';
|
||||
$html .= ' <a class="serendipity_xml_icon" href="'. serendipity_feedAuthorURL($auth, 'serendipityHTTPPath') .'"><img src="'. $image .'" alt="XML" style="border: 0px" /></a> ';
|
||||
}
|
||||
$html .= '<a href="'. serendipity_authorURL($auth, 'serendipityHTTPPath') .'" title="'. serendipity_specialchars($auth['realname']) .'">'. serendipity_specialchars($auth['realname']) . $entrycount . '</a>';
|
||||
$html .= ' <a href="'. serendipity_authorURL($auth, 'serendipityHTTPPath') .'" title="'. serendipity_specialchars($auth['realname']) .'">'. serendipity_specialchars($auth['realname']) . $entrycount . '</a>';
|
||||
$html .= '</li>' . "\n";
|
||||
}
|
||||
}
|
||||
@ -99,7 +108,7 @@ class serendipity_plugin_authors extends serendipity_plugin {
|
||||
$html .= '</ul>' . "\n";
|
||||
|
||||
$html .= sprintf(
|
||||
'<div><a href="%s" title="%s">%s</a></div>',
|
||||
'<div><a href="%s" title="%s">%s</a></div>'."\n",
|
||||
|
||||
$serendipity['serendipityHTTPPath'] . $serendipity['indexFile'],
|
||||
ALL_AUTHORS,
|
||||
|
Reference in New Issue
Block a user