Merge pull request #34 from ogerlach/master

Updated sidebarlogo to produce valid HTML and provide a better user interface
This commit is contained in:
Garvin Hicking 2013-11-27 10:20:25 -08:00
commit 6cc660cb7f
3 changed files with 302 additions and 135 deletions

View file

@ -0,0 +1,54 @@
<?php #
/**
* @version 0.4
* @author Oliver Gerlach (http://www.stumblingpilgrim.net/)
* EN-Revision: Revision of lang_en.inc.php
*/
@define('PLUGIN_SIDEBARLOGO_NAME', 'SideBar Logo');
@define('PLUGIN_SIDEBARLOGO_DESC', 'Zeigt ein Logo mit einer Beschreibung und allen relevanten Informationen in der Seitenleiste (eine Aboutbox).');
@define('PLUGIN_SIDEBARLOGO_AUTH', 'Adam Krause & Oliver Gerlach');
@define('PLUGIN_SIDEBARLOGO_GROUP_MOREOPTIONS', 'Weitere Felder & Optionen');
@define('PLUGIN_SIDEBARLOGO_GROUP_STYLES', 'Styling');
@define('PLUGIN_SIDEBARLOGO_TITLE', 'Titel');
@define('PLUGIN_SIDEBARLOGO_TITLE_DESC', 'Titeltext für das Seitenleistenelement');
@define('PLUGIN_SIDEBARLOGO_IMAGE', 'Logo');
@define('PLUGIN_SIDEBARLOGO_IMAGE_DESC', 'Bild aus der Medienbibliothek, das neben der Beschreibung angezeigt werden soll. Leer lassen, um kein Bild anzuzeigen.');
@define('PLUGIN_SIDEBARLOGO_IMAGEWIDTH', 'Bildbreite');
@define('PLUGIN_SIDEBARLOGO_IMAGEWIDTH_DESC', 'Bildbreite des Logos (CSS-Definitionen wie 50px or 200% verwewnden oder leer lassen)');
@define('PLUGIN_SIDEBARLOGO_IMAGEHEIGHT', 'Bildhöhe');
@define('PLUGIN_SIDEBARLOGO_IMAGEHEIGHT_DESC', 'Bildhöhe des Logos (CSS-Definitionen wie 50px or 200% verwewnden oder leer lassen)');
@define('PLUGIN_SIDEBARLOGO_IMAGETEXT', 'Bildbeschreibung');
@define('PLUGIN_SIDEBARLOGO_IMAGETEXT_DESC', 'beschreibender Text für das Bild (erforderlich)');
@define('PLUGIN_SIDEBARLOGO_IMAGETEXT_MISSING', 'keine Beschreibung');
@define('PLUGIN_SIDEBARLOGO_DESCRIPTION', 'Beschreibung');
@define('PLUGIN_SIDEBARLOGO_DESCRIPTION_DESC', 'Beschreibung für das Blog oder was auch immer im Element angezeigt werden soll. HTML kann für weitere Formatierung verwendet werden.');
@define('PLUGIN_SIDEBARLOGO_IMAGESTYLE', 'Bildstil');
@define('PLUGIN_SIDEBARLOGO_IMAGESTYLE_DESC', 'CSS-Stil, der für das Bild verwendet werden soll. Mit dem Zeichen "." beginnen, um eine CSS-ID zu spezifizieren, mit "#" beginnen, um eine Klasse zu spezifizieren oder alternativ einen Inline-Stil direkt eingeben');
@define('PLUGIN_SIDEBARLOGO_DESCRIPTIONSTYLE', 'Beschreibungstil');
@define('PLUGIN_SIDEBARLOGO_DESCRIPTIONSTYLE_DESC', 'CSS-Stil, der für die Beschreibung verwenden werden soll. to use for your description. Mit dem Zeichen "." beginnen, um eine CSS-ID zu spezifizieren, mit "#" beginnen, um eine Klasse zu spezifizieren, direkt Inline-Stil definieren oder frei lassen, um das Standardseitenleistenstyling zu verwenden (empfohlen)');
@define('PLUGIN_SIDEBARLOGO_DEFAULT_DESCRIPTION', 'Hier Text einfügen');
@define('PLUGIN_SIDEBARLOGO_SITENAME', 'Seitenname');
@define('PLUGIN_SIDEBARLOGO_SITENAME_DESC', 'Der Name der Webseite (z.B. Mein neuer Blog)');
@define('PLUGIN_SIDEBARLOGO_SITENAMESTYLE', 'Seitennamensstil');
@define('PLUGIN_SIDEBARLOGO_SITENAMESTYLE_DESC', 'CSS-Stil, der für den Seitennamen verwendet werden soll. Mit dem Zeichen "." beginnen, um eine CSS-ID zu spezifizieren, mit "#" beginnen, um eine Klasse zu spezifizieren oder alternativ einen Inline-Stil direkt eingeben');
@define('PLUGIN_SIDEBARLOGO_SITETAG', 'Motto');
@define('PLUGIN_SIDEBARLOGO_SITETAG_DESC', 'das Seitenmotto (z.B. Blogger aus Leidenschaft)');
@define('PLUGIN_SIDEBARLOGO_SITETAGSTYLE', 'Mottostil');
@define('PLUGIN_SIDEBARLOGO_SITETAGSTYLE_DESC', 'CSS-Stil, der für das Seitenmotto verwendet werden soll. Mit dem Zeichen "." beginnen, um eine CSS-ID zu spezifizieren, mit "#" beginnen, um eine Klasse zu spezifizieren oder alternativ einen Inline-Stil direkt eingeben');
@define('PLUGIN_SIDEBARLOGO_CONTACT', 'Kontaktinformationen');
@define('PLUGIN_SIDEBARLOGO_CONTACT_DESC', 'eine E-Mail-Adresse oder ein Maillink ("Kontakt: <a href=mailto:max@mustermann.de>Max Mustermann</a>")');
@define('PLUGIN_SIDEBARLOGO_CONTACTSTYLE', 'Kontaktstil');
@define('PLUGIN_SIDEBARLOGO_CONTACTSTYLE_DESC', 'CSS-Stil, der für die Kontaktinformationen verwendet werden soll. Mit dem Zeichen "." beginnen, um eine CSS-ID zu spezifizieren, mit "#" beginnen, um eine Klasse zu spezifizieren oder alternativ einen Inline-Stil direkt eingeben');
@define('PLUGIN_SIDEBARLOGO_COPYRIGHT', 'Copyright');
@define('PLUGIN_SIDEBARLOGO_COPYRIGHT_DESC', 'Kleiner Text, der am besten für Copyright oder Rechtshinweise verwendet wird (Copyright-Symbol: "&copy;")');
@define('PLUGIN_SIDEBARLOGO_COPYRIGHTSTYLE', 'Copyrightstil');
@define('PLUGIN_SIDEBARLOGO_COPYRIGHTSTYLE_DESC', 'CSS-Stil, der für das Copyright verwendet werden soll. Mit dem Zeichen "." beginnen, um eine CSS-ID zu spezifizieren, mit "#" beginnen, um eine Klasse zu spezifizieren oder alternativ einen Inline-Stil direkt eingeben');
@define('PLUGIN_SIDEBARLOGO_DELIMITER', 'Trenner');
@define('PLUGIN_SIDEBARLOGO_DELIMITERSTYLE', 'Trenner-Stil');
@define('PLUGIN_SIDEBARLOGO_DELIMITERSTYLE_DESC', 'Stil für den Trenner. Der Trenner ist ein Element zur Textflusskontrolle. Es zwingt den Rest der Box bzw. der Seite, unter dem Bild weiterzugehen. Normalerweise muss dieser Stil nicht angepasst werden. Das ist nur nötig, wenn entsprechende Änderung am Bidlstil vorgenommen wurden.');
@define('PLUGIN_SIDEBARLOGO_SEQUENCE', 'Sequenz');
@define('PLUGIN_SIDEBARLOGO_SEQUENCE_DESC', 'Lege die Sequenz der Elemente von SideBar Logo fest und aktiviere bzw. deaktiviere sie (Standard ist: Bild, Beschreibung, Trenner).');
?>

View file

@ -1,34 +1,53 @@
<?php #
/**
* @version 0.0.1
* @author Translator Name <webmaster@oxygenws.com>
* @version 0.4
* @author Adam Krause (http://www.pigslipstick.com/), Oliver Gerlach (http://stumblingpilgrim.net/)
* EN-Revision: Revision of lang_en.inc.php
*/
@define('PLUGIN_SIDEBARLOGO_NAME', 'SideBar Logo 0.0.2');
@define('PLUGIN_SIDEBARLOGO_DESC', 'Displays a panel containing your logo, site name, and other relevant informaion about your site.');
@define('PLUGIN_SIDEBARLOGO_AUTH', 'Adam Krause');
@define('PLUGIN_SIDEBARLOGO_NAME', 'SideBar Logo');
@define('PLUGIN_SIDEBARLOGO_DESC', 'Displays a panel containing your logo with a description including all relevant information about your site (an about box).');
@define('PLUGIN_SIDEBARLOGO_AUTH', 'Adam Krause & Oliver Gerlach');
@define('PLUGIN_SIDEBARLOGO_GROUP_MOREOPTIONS', 'More Fields & Options');
@define('PLUGIN_SIDEBARLOGO_GROUP_STYLES', 'Styling');
@define('PLUGIN_SIDEBARLOGO_TITLE', 'Title');
@define('PLUGIN_SIDEBARLOGO_TITLE_DESC', 'The Text that displays in the SideBar Logo panel');
@define('PLUGIN_SIDEBARLOGO_SITENAME', 'Name');
@define('PLUGIN_SIDEBARLOGO_SITENAME_DESC', 'The name of your web site (Volkswagen of America)');
@define('PLUGIN_SIDEBARLOGO_SITETAG', 'Tag Line');
@define('PLUGIN_SIDEBARLOGO_SITETAG_DESC', 'A slogan or tag line (Autobahn for All)');
@define('PLUGIN_SIDEBARLOGO_TITLE_DESC', 'Text for sidebar item title bar');
@define('PLUGIN_SIDEBARLOGO_IMAGE', 'Logo');
@define('PLUGIN_SIDEBARLOGO_IMAGE_DESC', 'Select an image from your Serendipity Media Library');
@define('PLUGIN_SIDEBARLOGO_IMAGE_DESC', 'image from media library to display in content section or leave blank for no image');
@define('PLUGIN_SIDEBARLOGO_IMAGEWIDTH', 'Image Width');
@define('PLUGIN_SIDEBARLOGO_IMAGEWIDTH_DESC', 'Constrain logo width (leave blank for no constraint, 50px, or 200%)');
@define('PLUGIN_SIDEBARLOGO_IMAGEWIDTH_DESC', 'display width of logo (use CSS definitions like 50px or 200% or leave blank for no constraint)');
@define('PLUGIN_SIDEBARLOGO_IMAGEHEIGHT', 'Image Height');
@define('PLUGIN_SIDEBARLOGO_IMAGEHEIGHT_DESC', 'Constrain logo height (leave blank for no constraint, 50px or 200%)');
@define('PLUGIN_SIDEBARLOGO_DESCRIPTION', 'Description');
@define('PLUGIN_SIDEBARLOGO_DESCRIPTION_DESC', 'Describes the purpose of your site');
@define('PLUGIN_SIDEBARLOGO_CONTACT', 'Contact');
@define('PLUGIN_SIDEBARLOGO_CONTACT_DESC', 'An email address or mailto link ("Contact me: <a href=mailto:john@xyz.com>John</a>")');
@define('PLUGIN_SIDEBARLOGO_IMAGEHEIGHT_DESC', 'display height of logo (use CSS definitions like 50px or 200% or leave blank for no constraint)');
@define('PLUGIN_SIDEBARLOGO_IMAGETEXT', 'Image Text');
@define('PLUGIN_SIDEBARLOGO_IMAGETEXT_DESC', 'descriptive text for image (required)');
@define('PLUGIN_SIDEBARLOGO_IMAGETEXT_MISSING', 'no description');
@define('PLUGIN_SIDEBARLOGO_DESCRIPTION', 'Description text');
@define('PLUGIN_SIDEBARLOGO_DESCRIPTION_DESC', 'Descriptive text for your blog or whatever you want to write. HTML can be used for further formatting.');
@define('PLUGIN_SIDEBARLOGO_IMAGESTYLE', 'Image Style');
@define('PLUGIN_SIDEBARLOGO_IMAGESTYLE_DESC', 'style to use for your logo. Start text with "." to provide a CSS id, with a "#" to provide a class or use inline styling directly');
@define('PLUGIN_SIDEBARLOGO_DESCRIPTIONSTYLE', 'Description Style');
@define('PLUGIN_SIDEBARLOGO_DESCRIPTIONSTYLE_DESC', 'style to use for your description. Start text with "." to provide a CSS id, with a "#" to provide a class, use direct styling or leave it blank to use default sidebar styling (recommended)');
@define('PLUGIN_SIDEBARLOGO_DEFAULT_DESCRIPTION', 'Enter your text here');
@define('PLUGIN_SIDEBARLOGO_SITENAME', 'Site Name');
@define('PLUGIN_SIDEBARLOGO_SITENAME_DESC', 'The name of your web site (e.g. My New Blog)');
@define('PLUGIN_SIDEBARLOGO_SITENAMESTYLE', 'Site Name Style');
@define('PLUGIN_SIDEBARLOGO_SITENAMESTYLE_DESC', 'style to use for your site name. Start text with "." to provide a CSS id, with a "#" to provide a class or use inline styling directly');
@define('PLUGIN_SIDEBARLOGO_SITETAG', 'Tag Line');
@define('PLUGIN_SIDEBARLOGO_SITETAG_DESC', 'a slogan or tag line (e.g. Blogging for life)');
@define('PLUGIN_SIDEBARLOGO_SITETAGSTYLE', 'Site Tag Style');
@define('PLUGIN_SIDEBARLOGO_SITETAGSTYLE_DESC', 'style to use for your site tag. Start text with "." to provide a CSS id, with a "#" to provide a class or use inline styling directly');
@define('PLUGIN_SIDEBARLOGO_CONTACT', 'Contact Information');
@define('PLUGIN_SIDEBARLOGO_CONTACT_DESC', 'An email address or mailto link ("Contact me: <a href=mailto:john@doe.com>John Doe</a>")');
@define('PLUGIN_SIDEBARLOGO_CONTACTSTYLE', 'Contact style');
@define('PLUGIN_SIDEBARLOGO_CONTACTSTYLE_DESC', 'style to use for your contact information. Start text with "." to provide a CSS id, with a "#" to provide a class or use inline styling directly');
@define('PLUGIN_SIDEBARLOGO_COPYRIGHT', 'Copyright');
@define('PLUGIN_SIDEBARLOGO_COPYRIGHT_DESC', 'Tiny text, best used for copyright or legal statement (copyright symbol: "&copy;")');
@define('PLUGIN_SIDEBARLOGO_STYLE', 'Content Styling');
@define('PLUGIN_SIDEBARLOGO_STYLE_DESC', 'Style your panel content (clear the field and save 2X to reload defaults)');
@define('PLUGIN_SIDEBARLOGO_COPYRIGHTSTYLE', 'Copyright Style');
@define('PLUGIN_SIDEBARLOGO_COPYRIGHTSTYLE_DESC', 'style to use for your contact information. Start text with "." to provide a CSS id, with a "#" to provide a class or use inline styling directly');
@define('PLUGIN_SIDEBARLOGO_DELIMITER', 'Delimiter');
@define('PLUGIN_SIDEBARLOGO_DELIMITERSTYLE', 'Delimiter Styling');
@define('PLUGIN_SIDEBARLOGO_DELIMITERSTYLE_DESC', 'Styling for the delimiter. The delimiter is a text flow control elment. It forces the rest of the box or the page to continue below the logo. Normally you do not need to change this style. Only do if you change your image style as well.');
@define('PLUGIN_SIDEBARLOGO_SEQUENCE', 'Sequence');
@define('PLUGIN_SIDEBARLOGO_SEQUENCE_DESC', 'Define the sequence of your SideBar Logo elements');
@define('PLUGIN_SIDEBARLOGO_SEQUENCE_DESC', 'Define the sequence of your SideBar Logo elements and enable or disable them (Default is logo, description, delimiter).');
?>

View file

@ -1,7 +1,5 @@
<?php # $Id $
/* Contributed by Adam Krause (http://www.pigslipstick.com/) */
/* Contributed by Adam Krause (http://www.pigslipstick.com/), Oliver Gerlach (http://www.stumblingpilgrim.net/) */
if (IN_serendipity !== true) {
die ("Don't hack!");
@ -14,52 +12,6 @@ if (file_exists($probelang)) {
}
include dirname(__FILE__) . '/lang_en.inc.php';
//include dirname(__FILE__) . '/sidebar_logo_style.css.php';
@define('PLUGIN_SIDEBARLOGO_STYLE_CODE', '
<style type="text/css">
#sblsitename {
text-align: center;
font-size: 120%;
font-weight: bold;
text-decoration: none;
}
#sblsitetag {
text-align: center;
font-size: 105%;
font-weight: bold;
text-decoration: none;
}
#sblimage {
text-align: center;
border: 0px solid red;
}
#sbldescription {
text-align: justify;
font-size: 100%;
font-weight: normal;
text-decoration: none;
}
#sblcontact {
text-align: right;
font-size: 100%;
font-weight: normal;
text-decoration: none;
}
#sblcopyright {
text-align: right;
font-size: 80%;
font-weight: normal;
text-decoration: overline underline;
}
/*********** NOTES ************
1. Suggest setting style attribute "display: none;"
on SideBar Logo elements that are left blank to
reduce empty space on the panel.
************ NOTES ***********/
</style>
');
class serendipity_plugin_sidebarlogo extends serendipity_plugin
{
@ -73,30 +25,56 @@ class serendipity_plugin_sidebarlogo extends serendipity_plugin
$propbag->add('description', PLUGIN_SIDEBARLOGO_DESC);
$propbag->add('stackable', true);
$propbag->add('author', PLUGIN_SIDEBARLOGO_AUTH);
$propbag->add('version', '0.0.2');
$propbag->add('version', '0.4');
$propbag->add('requirements', array('serendipity' => '0.9',
'smarty' => '2.6.7',
'php' => '4.1.0'
));
$propbag->add('configuration', array('title',
'sitename',
'sitetag',
'image',
'imagewidth',
'imageheight',
'imagetext',
'description',
'imagestyle',
'descriptionstyle',
'sitename',
'sitenamestyle',
'sitetag',
'sitetagstyle',
'contact',
'contactstyle',
'copyright',
'style',
'sequence'
'copyrightstyle',
'sequence',
));
// sselect the appropriate groups in spartacus that match this plugin
$propbag->add('groups', array('FRONTEND_FEATURES'));
// group config options. All options not in this list remain ungrouped and are visible always
$propbag->add('config_groups', array(
PLUGIN_SIDEBARLOGO_GROUP_MOREOPTIONS => array(
'sitename',
'sitetag',
'contact',
'copyright',
'sequence'
),
PLUGIN_SIDEBARLOGO_GROUP_STYLES => array(
'imagestyle',
'descriptionstyle',
'sitenamestyle',
'sitetagstyle',
'contactstyle',
'copyrightstyle',
)
));
}
function introspect_config_item($name, &$propbag)
{
switch($name) {
switch($name)
{
case 'title':
$propbag->add('type', 'string');
@ -105,20 +83,6 @@ class serendipity_plugin_sidebarlogo extends serendipity_plugin
$propbag->add('default', 'My Logo');
break;
case 'sitename':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SIDEBARLOGO_SITENAME);
$propbag->add('description', PLUGIN_SIDEBARLOGO_SITENAME_DESC);
$propbag->add('default', '');
break;
case 'sitetag':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SIDEBARLOGO_SITETAG);
$propbag->add('description', PLUGIN_SIDEBARLOGO_SITETAG_DESC);
$propbag->add('default', '');
break;
case 'image':
$propbag->add('type', 'media');
$propbag->add('name', PLUGIN_SIDEBARLOGO_IMAGE);
@ -140,13 +104,62 @@ class serendipity_plugin_sidebarlogo extends serendipity_plugin
$propbag->add('default', '');
break;
case 'imagetext':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SIDEBARLOGO_IMAGETEXT);
$propbag->add('description', PLUGIN_SIDEBARLOGO_IMAGETEXT_DESC);
$propbag->add('default', PLUGIN_SIDEBARLOGO_IMAGETEXT_MISSING);
break;
case 'description':
$propbag->add('type', 'text');
$propbag->add('name', PLUGIN_SIDEBARLOGO_DESCRIPTION);
$propbag->add('description', PLUGIN_SIDEBARLOGO_DESCRIPTION_DESC);
$propbag->add('default', PLUGIN_SIDEBARLOGO_DEFAULT_DESCRIPTION);
break;
case 'imagestyle':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SIDEBARLOGO_IMAGESTYLE);
$propbag->add('description', PLUGIN_SIDEBARLOGO_IMAGESTYLE_DESC);
$propbag->add('default', '.serendipity_imageComment_left');
break;
case 'descriptionstyle':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SIDEBARLOGO_DESCRIPTIONSTYLE);
$propbag->add('description', PLUGIN_SIDEBARLOGO_DESCRIPTIONSTYLE_DESC);
$propbag->add('default', '');
break;
case 'sitename':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SIDEBARLOGO_SITENAME);
$propbag->add('description', PLUGIN_SIDEBARLOGO_SITENAME_DESC);
$propbag->add('default', '');
break;
case 'sitenamestyle':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SIDEBARLOGO_SITENAMESTYLE);
$propbag->add('description', PLUGIN_SIDEBARLOGO_SITENAMESTYLE_DESC);
$propbag->add('default', 'text-align: center; font-size: 120%; font-weight: bold; text-decoration: none;');
break;
case 'sitetag':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SIDEBARLOGO_SITETAG);
$propbag->add('description', PLUGIN_SIDEBARLOGO_SITETAG_DESC);
$propbag->add('default', '');
break;
case 'sitetagstyle':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SIDEBARLOGO_SITETAGSTYLE);
$propbag->add('description', PLUGIN_SIDEBARLOGO_SITETAGSTYLE_DESC);
$propbag->add('default', 'text-align: center; font-size: 105%; font-weight: bold; text-decoration: none;');
break;
case 'contact':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SIDEBARLOGO_CONTACT);
@ -154,6 +167,13 @@ class serendipity_plugin_sidebarlogo extends serendipity_plugin
$propbag->add('default', '');
break;
case 'contactstyle':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SIDEBARLOGO_CONTACTSTYLE);
$propbag->add('description', PLUGIN_SIDEBARLOGO_CONTACTSTYLE_DESC);
$propbag->add('default', 'text-align: right; font-size: 100%; font-weight: normal; text-decoration: none;');
break;
case 'copyright':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SIDEBARLOGO_COPYRIGHT);
@ -161,11 +181,18 @@ class serendipity_plugin_sidebarlogo extends serendipity_plugin
$propbag->add('default', '');
break;
case 'style':
$propbag->add('type', 'html');
$propbag->add('name', PLUGIN_SIDEBARLOGO_STYLE);
$propbag->add('description', PLUGIN_SIDEBARLOGO_STYLE_DESC);
$propbag->add('default', PLUGIN_SIDEBARLOGO_STYLE_CODE);
case 'copyrightstyle':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SIDEBARLOGO_COPYRIGHTSTYLE);
$propbag->add('description', PLUGIN_SIDEBARLOGO_COPYRIGHTSTYLE_DESC);
$propbag->add('default', 'text-align: right; font-size: 80%; font-weight: normal; text-decoration: overline underline;');
break;
case 'delimiterstyle':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SIDEBARLOGO_DELIMITERSTYLE);
$propbag->add('description', PLUGIN_SIDEBARLOGO_DELIMITERSTYLE_DESC);
$propbag->add('default', 'clear:left;');
break;
case 'sequence':
@ -173,13 +200,16 @@ class serendipity_plugin_sidebarlogo extends serendipity_plugin
$propbag->add('type', 'sequence');
$propbag->add('name', PLUGIN_SIDEBARLOGO_SEQUENCE);
$propbag->add('description', PLUGIN_SIDEBARLOGO_SEQUENCE_DESC);
$propbag->add('checkable', true);
$propbag->add('values', array('sitename' => array('display' => PLUGIN_SIDEBARLOGO_SITENAME),
'sitetag' => array('display' => PLUGIN_SIDEBARLOGO_SITETAG),
'image' => array('display' => PLUGIN_SIDEBARLOGO_IMAGE),
'description' => array('display' => PLUGIN_SIDEBARLOGO_DESCRIPTION),
'delimiter' => array('display' => PLUGIN_SIDEBARLOGO_DELIMITER),
'contact' => array('display' => PLUGIN_SIDEBARLOGO_CONTACT),
'copyright' => array('display' => PLUGIN_SIDEBARLOGO_COPYRIGHT)
));
$propbag->add('default', 'image,description,delimiter');
break;
default:
@ -192,58 +222,122 @@ class serendipity_plugin_sidebarlogo extends serendipity_plugin
{
global $serendipity;
$title = $this->get_config('title');
$sitename = $this->get_config('sitename');
$sitetag = $this->get_config('sitetag');
$image = $this->get_config('image');
$imagewidth = $this->get_config('imagewidth');
$imageheight = $this->get_config('imageheight');
$description = $this->get_config('description');
$contact = $this->get_config('contact');
$copyright = $this->get_config('copyright');
$style = $this->get_config('style');
$sequence = $this->get_config('sequence');
$sequence = explode(",", $sequence);
$title = $this->get_config('title');
$image = $this->get_config('image');
$imagewidth = $this->get_config('imagewidth');
$imageheight = $this->get_config('imageheight');
$imagetext = $this->get_config('imagetext');
$description = $this->get_config('description');
$imagestyle = $this->get_config('imagestyle');
$descriptionstyle = $this->get_config('descriptionstyle');
$sitename = $this->get_config('sitename');
$sitenamestyle = $this->get_config('sitenamestyle');
$sitetag = $this->get_config('sitetag');
$sitetagstyle = $this->get_config('sitetagstyle');
$contact = $this->get_config('contact');
$contactstyle = $this->get_config('contactstyle');
$copyright = $this->get_config('copyright');
$copyrightstyle = $this->get_config('copyrightstyle');
$copyrightstyle = $this->get_config('delimiterstyle');
$sequence = $this->get_config('sequence');
// prepare for output
$sequence = explode(",", $sequence);
if ($imagewidth != "") {
$iwidth = "width='$imagewidth'";
if ($imagewidth != "")
{
$iwidth = "width='".$imagewidth."'";
}
if ($imageheight != "") {
$iheight = "height='$imageheight'";
if ($imageheight != "")
{
$iheight = "height='".$imageheight."'";
}
$imagestyle = $this->generate_style_attribute($imagestyle);
$descriptionstyle = $this->generate_style_attribute($descriptionstyle);
$sitenamestyle = $this->generate_style_attribute($sitenamestyle);
$sitetagstyle = $this->generate_style_attribute($sitetagstyle);
$contactstyle = $this->generate_style_attribute($contactstyle);
$copyrightstyle = $this->generate_style_attribute($copyrightstyle);
$delimiterstyle = $this->generate_style_attribute($delimiterstyle);
// output
foreach( $sequence as $val )
{
switch( $val )
{
case 'image':
if ($image != "")
echo "<img ".$iwidth." ".$iheight." src='".$image."' alt='".$imagetext."' ".$imagestyle."/>";
break;
echo $style;
echo "<div style='margin: 0px; padding: 0px; text-align: left;'>";
foreach($sequence as $val) {
switch($val) {
case 'sitename':
echo "<div id='sblsitename'>".$sitename."</div>";
break;
case 'description':
if ( $descriptionstyle != "" )
echo "<div ".$descriptionstyle.">\n";
echo $description."\n";
if ( $descriptionstyle != "" )
echo "</div>\n";
break;
case 'sitetag':
echo "<div id='sblsitetag'>".$sitetag."</div>";
break;
case 'delimiter':
echo "<div ".$delimiterstyle."></div>";
break;
case 'image':
echo "<div id='sblimage'><img $iwidth $iheight src=".$image." /></div>";
break;
case 'sitename':
echo "<div ".$sitenamestyle.">\n";
echo $sitename."\n";
echo "</div>\n";
break;
case 'description':
echo "<div id='sbldescription'>".$description."</div>";
break;
case 'sitetag':
echo "<div ".$sitetagstyle.">\n";
echo $sitetag."\n";
echo "</div>\n";
break;
case 'contact':
echo "<div id='sblcontact'>".$contact."</div>";
break;
case 'contact':
echo "<div ".$contactstyle.">\n";
echo $contact."\n";
echo "</div>\n";
break;
case 'copyright':
echo "<div id='sblcopyright'>".$copyright."</div>";
break;
}
case 'copyright':
echo "<div ".$copyrightstyle.">\n";
echo $copyright."\n";
echo "</div>\n";
break;
}
}
}
echo "</div>";
/**
* @brief create a full HTML attribute from style information
* @param stylestring input string to parse for style information
* @return attribute containing the resulting attribute
*
* Depending on the input string this method either creates a style attribute, a class attribute or an id attribute.
* The choice is made on the first character of the input string.
* A leading '#' denotes an id while a leading '.' denotes a class and everything else is taken as inline CSS.
*/
function generate_style_attribute(&$stylestring)
{
if ( $stylestring != "" )
{
if ( $stylestring[0] == "." )
return "class='".substr($stylestring,1)."'";
else if ( $stylestring[0] == "#" )
return "id='".substr($stylestring,1)."'";
else
return "style='".$stylestring."'";
return "";
}
else
return "";
}
}
/* vim: set sts=4 ts=4 expandtab : */
?>