From: Sebastian N. <no...@us...> - 2004-10-17 15:21:22
|
Update of /cvsroot/php-blog/additional_plugins/serendipity_event_staticpage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15761/serendipity_event_staticpage Added Files: serendipity_event_staticpage.php Log Message: Initial commit. Merged work of Marco Rink and Allesandro Pellizzari --- NEW FILE: serendipity_event_staticpage.php --- <?php # $Id: serendipity_event_staticpage.php,v 1.1 2004/10/17 15:21:12 nohn Exp $ # (c) by Marco Rinck aka romulus, http://www.romulus23.de, licensed under BSD license, see http://www.fsf.org/licenses/info/BSD_3Clause.html switch ($serendipity['lang']) { 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_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('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; case 'it': @define('STATICPAGE_HEADLINE', 'Intestazione'); @define('STATICPAGE_HEADLINE_BLAHBLAH', 'Mostra un\'intestazione sopra il contenuto, che viene mostrata come tutte le altre intestazioni all\'interno del blog'); @define('STATICPAGE_TITLE', 'Pagina statica'); @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('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; 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_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; } 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_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 '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': $propbag->add('type', 'boolean'); $propbag->add('name', DO_MARKUP); $propbag->add('description', DO_MARKUP_DESCRIPTION); $propbag->add('default', 'true'); break; 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').')'; 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; $hooks = &$bag->get('event_hooks'); 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; } } } /* vim: set sts=4 ts=4 expandtab : */ ?> |