📄 serendipity_event_templatechooser.php
字号:
<?php # $Id: serendipity_event_templatechooser.php,v 1.2 2004/04/03 17:36:18 isotopp Exp $/*******************************************************汉化作者:youngong(http://youngong.blogbus.com) **官方主页:http://www.s9y.corg **我的信箱:youngong@163.com **如果有问题,欢迎和作者及汉化作者联系。 ********************************************************/switch ($serendipity['lang']) { case 'de': @define('PLUGIN_EVENT_TEMPLATECHOOSER_NAME', 'Templateauswahl'); @define('PLUGIN_EVENT_TEMPLATECHOOSER_DESC', 'Erm鰃licht Besuchern das Template zu 鋘dern'); break; case 'cn': @define('PLUGIN_EVENT_TEMPLATECHOOSER_NAME', '模板切换'); @define('PLUGIN_EVENT_TEMPLATECHOOSER_DESC', '允许浏览者切换模板'); break; case 'en': default: @define('PLUGIN_EVENT_TEMPLATECHOOSER_NAME', 'Template chooser'); @define('PLUGIN_EVENT_TEMPLATECHOOSER_DESC', 'Allows users to change the template'); break;}class serendipity_event_templatechooser extends serendipity_event{ function introspect(&$propbag) { global $serendipity; $propbag->add('name', PLUGIN_EVENT_TEMPLATECHOOSER_NAME); $propbag->add('description', PLUGIN_EVENT_TEMPLATECHOOSER_DESC); $propbag->add('event_hooks', array('frontend_configure' => true)); // Register (multiple) dependencies. KEY is the name of the depending plugin. VALUE is a mode of either 'remove' or 'keep'. // If the mode 'remove' is set, removing the plugin results in a removal of the depending plugin. 'Keep' meens to // not touch the depending plugin. $this->dependencies = array('serendipity_plugin_templatedropdown' => 'remove'); } function generate_content(&$title) { $title = PLUGIN_EVENT_TEMPLATECHOOSER_NAME; } function event_hook($event, &$bag, &$eventData) { global $serendipity; $hooks = &$bag->get('event_hooks'); if (isset($hooks[$event])) { switch($event) { case 'frontend_configure': if (isset($_REQUEST['user_template']) && (in_array($_REQUEST['user_template'], serendipity_fetchTemplates())) ) { $_SESSION['serendipityUseTemplate'] = $_REQUEST['user_template']; } if (isset($_SESSION['serendipityUseTemplate']) ) { $eventData['CONFIG']['template'] = $_SESSION['serendipityUseTemplate']; } return true; break; default: return false; } } else { return false; } }}/* vim: set sts=4 ts=4 expandtab : */?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -