[Php-blog-plugin-cvs] additional_plugins/serendipity_event_staticpage serendipity_event_staticpage.p
A reliable, secure & extensible PHP blog | Not mainstream since 2002
Brought to you by:
garvinhicking,
jhermanns
From: Garvin H. <gar...@us...> - 2004-11-24 13:26:49
|
Update of /cvsroot/php-blog/additional_plugins/serendipity_event_staticpage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5711/serendipity_event_staticpage Modified Files: serendipity_event_staticpage.php Log Message: added jannis head nugget plugin updated staticpage plugin Index: serendipity_event_staticpage.php =================================================================== RCS file: /cvsroot/php-blog/additional_plugins/serendipity_event_staticpage/serendipity_event_staticpage.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- serendipity_event_staticpage.php 17 Oct 2004 15:21:12 -0000 1.1 +++ serendipity_event_staticpage.php 24 Nov 2004 13:26:33 -0000 1.2 @@ -1,4 +1,4 @@ -<?php # $Id$ +<?php # $Id: serendipity_event_staticpage.php, v0.3 2004/10/16 # (c) by Marco Rinck aka romulus, http://www.romulus23.de, licensed under BSD license, see http://www.fsf.org/licenses/info/BSD_3Clause.html @@ -6,14 +6,14 @@ case 'de': @define('STATICPAGE_HEADLINE', 'Kopfzeile'); @define('STATICPAGE_HEADLINE_BLAHBLAH', 'zeigt eine Kopfzeile als Titel der statischen Seite an'); - @define('STATICPAGE_TITLE', 'Statische Seite'); - @define('STATICPAGE_TITLE_BLAHBLAH', 'Zeigt eine statische Seite innerhalb des Blogs mit dem Blog-Design und allen Formatierungen'); + @define('STATICPAGE_TITLE', 'Statische Seite'); + @define('STATICPAGE_TITLE_BLAHBLAH', 'Zeigt eine statische Seite innerhalb des Blogs mit dem Blog-Design und allen Formatierungen'); @define('STATICPAGE_PAGETITLE', 'Titel der Seite für die URL'); @define('STATICPAGE_PAGETITLE_BLAHBLAH', 'definiert den Namen der Unterseite die in der URL aufgerufen werden muss, www.yourblog.com/s9y/index.php?serendipity[subpage]=pagetitle'); - @define('CONTENT_BLAHBLAH', 'der Inhalt'); + @define('CONTENT_BLAHBLAH', 'der Inhalt'); @define('STATICPAGE_ARTICLEFORMAT', 'Als Artikel formatieren?'); @define('STATICPAGE_ARTICLEFORMAT_BLAHBLAH', 'legt fest ob die Ausgabe automatisch wie ein Artikel formatiert werden soll (Farben, Ränder, etc.) (Standard: ja)'); - break; + break; case 'it': @define('STATICPAGE_HEADLINE', 'Intestazione'); @@ -22,123 +22,133 @@ @define('STATICPAGE_TITLE_BLAHBLAH', 'Visualizza una pagina statica nel tuo blog con la stessa grafica e formattazione del blog stesso'); @define('STATICPAGE_PAGETITLE', 'Titolo del link'); @define('STATICPAGE_PAGETITLE_BLAHBLAH', 'Definisce il titolo da usare nell\'URL, per esempio www.yourblog.com/s9y/index.php?serendipity[subpage]=pagetitle'); - @define('CONTENT_BLAHBLAH', 'Il contenuto'); + @define('CONTENT_BLAHBLAH', 'Il contenuto'); @define('STATICPAGE_ARTICLEFORMAT', 'Formatta come un articolo?'); @define('STATICPAGE_ARTICLEFORMAT_BLAHBLAH', 'Se impostato a sì, la pagina viene formattata automaticamente come un articolo (colori, bordi, ecc.) (default: sì)'); - break; + break; default: @define('STATICPAGE_HEADLINE', 'Headline'); @define('STATICPAGE_HEADLINE_BLAHBLAH', 'Shows a headline above the content which is rendered as every other headline in your blog'); - @define('STATICPAGE_TITLE', 'Static Page'); + @define('STATICPAGE_TITLE', 'Static Page'); @define('STATICPAGE_TITLE_BLAHBLAH', 'Shows an static page inside your blog with your blogs design and all formattings'); @define('CONTENT_BLAHBLAH', 'the Content'); @define('STATICPAGE_PAGETITLE', 'title of link'); @define('STATICPAGE_PAGETITLE_BLAHBLAH', 'defines link title to form the URL, e.g. www.yourblog.com/s9y/index.php?serendipity[subpage]=pagetitle'); @define('STATICPAGE_ARTICLEFORMAT', 'Format as article?'); @define('STATICPAGE_ARTICLEFORMAT_BLAHBLAH', 'if yes the output is automatically formatted as an article (colors, borders, etc.) (default: yes)'); - - break; + break; } class serendipity_event_staticpage extends serendipity_event { - function introspect(&$propbag) { - global $serendipity; - - $propbag->add('name', STATICPAGE_TITLE . ': ' . $this->get_config('pagetitle')); - $propbag->add('description', STATICPAGE_TITLE_BLAHBLAH); - $propbag->add('event_hooks', array('entry_display' => true)); - $propbag->add('configuration', array('headline', 'content', 'pagetitle', 'markup', 'articleformat') - ); + function introspect(&$propbag) { + global $serendipity; - } + $propbag->add('name', STATICPAGE_TITLE . ': ' . $this->get_config('pagetitle')); + $propbag->add('description', STATICPAGE_TITLE_BLAHBLAH); + $propbag->add('event_hooks', array('entries_header' => true, 'entry_display' => true)); + $propbag->add('configuration', array('headline', 'content', 'pagetitle', 'markup', 'articleformat')); + $propbag->add('author', 'Marco Rinck'); + $propbag->add('version', '1.4'); + $propbag->add('stackable', true); + } function introspect_config_item($name, &$propbag) { switch($name) { - case 'headline': - $propbag->add('type', 'string'); - $propbag->add('name', STATICPAGE_HEADLINE); - $propbag->add('description', STATICPAGE_HEADLINE_BLAHBLAH); - $propbag->add('default', ''); - break; + case 'headline': + $propbag->add('type', 'string'); + $propbag->add('name', STATICPAGE_HEADLINE); + $propbag->add('description', STATICPAGE_HEADLINE_BLAHBLAH); + $propbag->add('default', ''); + break; - case 'content': - $propbag->add('type', 'html'); + case 'content': + $propbag->add('type', 'html'); $propbag->add('name', CONTENT); $propbag->add('description', CONTENT_BLAHBLAH); $propbag->add('default', ''); break; - case 'pagetitle': - $propbag->add('type', 'string'); - $propbag->add('name', STATICPAGE_PAGETITLE); - $propbag->add('description', STATICPAGE_PAGETITLE_BLAHBLAH); - $propbag->add('default', 'pagetitle'); - break; - case 'markup': + case 'pagetitle': + $propbag->add('type', 'string'); + $propbag->add('name', STATICPAGE_PAGETITLE); + $propbag->add('description', STATICPAGE_PAGETITLE_BLAHBLAH); + $propbag->add('default', 'pagetitle'); + break; + + case 'markup': $propbag->add('type', 'boolean'); $propbag->add('name', DO_MARKUP); $propbag->add('description', DO_MARKUP_DESCRIPTION); $propbag->add('default', 'true'); break; - case 'articleformat': + + case 'articleformat': $propbag->add('type', 'boolean'); $propbag->add('name', STATICPAGE_ARTICLEFORMAT); $propbag->add('description', STATICPAGE_ARTICLEFORMAT_BLAHBLAH); $propbag->add('default', 'true'); break; - - default: return false; } return true; } - function generate_content(&$title) { - $title = STATICPAGE_TITLE.' ('.$this->get_config('pagetitle').')'; + function generate_content(&$title) { + $title = STATICPAGE_TITLE.' ('.$this->get_config('pagetitle').')'; - if ($this->get_config('articleformat') == TRUE) { - echo '<div class="serendipity_Entry_Date"><div class="serendipity_entry">'; - } - echo '<h4 class="serendipity_title">' . $this->get_config('headline') . '</h4>'; - if ($this->get_config('markup') == TRUE) { - $entry = array('body' => $this->get_config('content')); - serendipity_plugin_api::hook_event('frontend_display', $entry); + if ($this->get_config('articleformat') == TRUE) { + echo '<div class="serendipity_Entry_Date"><div class="serendipity_entry">'; + } + + echo '<h4 class="serendipity_title">' . $this->get_config('headline') . '</h4>'; + + if ($this->get_config('markup') == TRUE) { + $entry = array('body' => $this->get_config('content')); + serendipity_plugin_api::hook_event('frontend_display', $entry); echo $entry['body']; } else { echo $this->get_config('content'); } - if ($this->get_config('articleformat') == TRUE) { - echo '</div></div>'; - } - } - function event_hook($event, &$bag, &$eventData, $addData = null) { - global $serendipity; + if ($this->get_config('articleformat') == TRUE) { + echo '</div></div>'; + } + } - $hooks = &$bag->get('event_hooks'); + function event_hook($event, &$bag, &$eventData, $addData = null) { + global $serendipity; - if (isset($hooks[$event])) { - switch($event) { - case 'entry_display': - if ($serendipity['GET']['subpage'] == $this->get_config('pagetitle')) { - $title = ''; - $this->generate_content($title); - $eventData['clean_page'] = true; // This is important to not display an entry list! - } - return true; - break; - default: - return false; - break; - } - } else { - return false; - } - } + $hooks = &$bag->get('event_hooks'); + + if (isset($hooks[$event])) { + switch($event) { + case 'entry_display': + if ($serendipity['GET']['subpage'] == $this->get_config('pagetitle')) { + $eventData['clean_page'] = true; // This is important to not display an entry list! + } + return true; + break; + + case 'entries_header': + if ($serendipity['GET']['subpage'] == $this->get_config('pagetitle')) { + $title = ''; + $this->generate_content($title); + } + + return true; + break; + + default: + return false; + break; + } + } else { + return false; + } + } } -/* vim: set sts=4 ts=4 expandtab : */ -?> \ No newline at end of file +/* vim: set sts=4 ts=4 expandtab : */ \ No newline at end of file |