• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Typecho_Plugin类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Typecho_Plugin的典型用法代码示例。如果您正苦于以下问题:PHP Typecho_Plugin类的具体用法?PHP Typecho_Plugin怎么用?PHP Typecho_Plugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Typecho_Plugin类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: activate

 public static function activate()
 {
     // 触发机制
     Typecho_Plugin::factory('index.php')->begin = array('TypechoXcache_Plugin', 'getCache');
     Typecho_Plugin::factory('index.php')->end = array('TypechoXcache_Plugin', 'setCache');
     Typecho_Plugin::factory('Widget_Feedback')->finishComment = array('TypechoXcache_Plugin', 'finish');
     Typecho_Plugin::factory('Widget_Contents_Post_Edit')->finishPublish = array('TypechoXcache_Plugin', 'clearCache');
     // $cache_dir = './usr/plugins/TypechoXcache/Cache/';
     // if (!file_exists($cache_dir)) {
     // 	if (mkdir($cache_dir, 0777) && chmod($cache_dir, 0777)) {
     // 		return ('建立缓存文件夹成功, 插件成功激活!');
     // 	} else {
     // 		throw new Typecho_Plugin_Exception('建立缓存文件夹失败, 请检查权限设置!');
     // 	}
     // } else {
     // 	// 这边 return 一个在顶部的提示
     // 	return ('缓存文件夹已存在, 插件成功激活!');
     // }
     // Typecho_Plugin::factory('admin/menu.php')->navBar = array('TypechoXcache_Plugin', 'render');
     if (!function_exists('xcache_count')) {
         throw new Typecho_Plugin_Exception('开启插件失败,缺少xcache环境!');
     } else {
         return '开启成功!';
     }
     // xcache_count();
 }
开发者ID:NAMAKABE,项目名称:TypechoXcache,代码行数:26,代码来源:Plugin.php


示例2: activate

 /**
  * 激活插件方法,如果激活失败,直接抛出异常
  *
  * @access public
  * @return void
  * @throws Typecho_Plugin_Exception
  */
 public static function activate()
 {
     Typecho_Plugin::factory('admin/write-post.php')->bottom = array('XiaMiPlayer_Plugin', 'Insert');
     Typecho_Plugin::factory('admin/write-page.php')->bottom = array('XiaMiPlayer_Plugin', 'Insert');
     Typecho_Plugin::factory('Widget_Archive')->header = array('XiaMiPlayer_Plugin', 'header');
     Typecho_Plugin::factory('Widget_Abstract_Contents')->contentEx = array('XiaMiPlayer_Plugin', 'ParseXiaMi');
 }
开发者ID:duxiangfei,项目名称:plugins,代码行数:14,代码来源:Plugin.php


示例3: execute

 /**
  * 入口函数,初始化路由器
  *
  * @access public
  * @return void
  */
 public function execute()
 {
     /** 对变量赋值 */
     $options = $this->widget('Widget_Options');
     /** 开始会话 */
     @session_start();
     /** 初始化charset */
     Typecho_Common::$charset = $options->charset;
     /** 初始化exception */
     Typecho_Common::$exceptionHandle = 'Widget_ExceptionHandle';
     /** 设置路径 */
     if (defined('__TYPECHO_PATHINFO_ENCODING__')) {
         $pathInfo = $this->request->getPathInfo(__TYPECHO_PATHINFO_ENCODING__, $options->charset);
     } else {
         $pathInfo = $this->request->getPathInfo();
     }
     Typecho_Router::setPathInfo($pathInfo);
     /** 初始化路由器 */
     Typecho_Router::setRoutes($options->routingTable);
     /** 初始化插件 */
     Typecho_Plugin::init($options->plugins);
     /** 初始化回执 */
     $this->response->setCharset($options->charset);
     $this->response->setContentType($options->contentType);
     /** 默认时区 */
     if (!ini_get("date.timezone") && function_exists("date_default_timezone_set")) {
         @date_default_timezone_set('UTC');
     }
     /** 初始化时区 */
     Typecho_Date::setTimezoneOffset($options->timezone);
     /** 监听缓冲区 */
     ob_start();
 }
开发者ID:raindali,项目名称:express,代码行数:39,代码来源:Init.php


示例4: activate

 /**
  * 激活插件方法,如果激活失败,直接抛出异常
  * 
  * @access public
  * @return void
  * @throws Typecho_Plugin_Exception
  */
 public static function activate()
 {
     Typecho_Plugin::factory('Widget_Archive')->header = array('CodeBox_Plugin', 'addheader');
     Typecho_Plugin::factory('Widget_Abstract_Contents')->contentEx = array('CodeBox_Plugin', 'parse');
     Typecho_Plugin::factory('Widget_Abstract_Contents')->excerptEx = array('CodeBox_Plugin', 'parse');
     Typecho_Plugin::factory('Widget_Abstract_Comments')->contentEx = array('CodeBox_Plugin', 'parse');
 }
开发者ID:wujunze,项目名称:wujunze.com,代码行数:14,代码来源:Plugin.php


示例5: activate

 /**
  * 激活插件方法,如果激活失败,直接抛出异常
  * 
  * @access public
  * @return void
  * @throws Typecho_Plugin_Exception
  */
 public static function activate()
 {
     if (false == Typecho_Http_Client::get()) {
         throw new Typecho_Plugin_Exception(_t('对不起, 您的主机不支持 php-curl 扩展而且没有打开 allow_url_fopen 功能, 无法正常使用此功能'));
     }
     Typecho_Plugin::factory('admin/menu.php')->navBar = array('Qiniu_Plugin', 'render');
 }
开发者ID:jiusanzhou,项目名称:spacms,代码行数:14,代码来源:Plugin---.php


示例6: activate

 /**
  * 激活插件方法,如果激活失败,直接抛出异常
  *
  * @access public
  * @return void
  * @throws Typecho_Plugin_Exception
  */
 public static function activate()
 {
     Typecho_Plugin::factory('Widget_Abstract_Contents')->contentEx = array('GithubCard_Plugin', 'parse');
     Typecho_Plugin::factory('Widget_Abstract_Contents')->excerptEx = array('GithubCard_Plugin', 'parse');
     Typecho_Plugin::factory('Widget_Abstract_Comments')->contentEx = array('GithubCard_Plugin', 'parse');
     Typecho_Plugin::factory('Widget_Archive')->footer = array('GithubCard_Plugin', 'footer');
 }
开发者ID:veryer,项目名称:typecho-github-card,代码行数:14,代码来源:Plugin.php


示例7: activate

 /**
  * 激活插件方法,如果激活失败,直接抛出异常
  *
  * @access public
  * @return void
  * @throws Typecho_Plugin_Exception
  */
 public static function activate()
 {
     //注入CSS
     Typecho_Plugin::factory('Widget_Archive')->header = array(__CLASS__, 'outputHeader');
     Typecho_Plugin::factory('Widget_Archive')->footer = array(__CLASS__, 'outputFooter');
     return _t('日历插件启动成功');
 }
开发者ID:istobran,项目名称:typecho-calender-plugin,代码行数:14,代码来源:Plugin.php


示例8: activate

 public static function activate()
 {
     $meg = Robots_Plugin::install();
     Helper::addPanel(1, 'Robots/Logs.php', '蜘蛛日志', '查看蜘蛛日志', 'administrator');
     Typecho_Plugin::factory('Widget_Archive')->header = array('Robots_Plugin', 'isbot');
     return _t($meg);
 }
开发者ID:kirileec,项目名称:usr,代码行数:7,代码来源:Plugin.php


示例9: activate

 public static function activate()
 {
     $msg = Access_Plugin::install();
     Helper::addPanel(1, self::$panel, 'Access控制台', 'Access插件控制台', 'subscriber');
     Typecho_Plugin::factory('Widget_Archive')->header = array('Access_Plugin', 'start');
     return _t($msg);
 }
开发者ID:ClayMoreBoy,项目名称:typecho-plugin-Access,代码行数:7,代码来源:Plugin.php


示例10: removePlugin

 /**
  * 强行删除某个插件
  *
  * @access public
  * @param string $pluginName 插件名称
  * @return void
  */
 public static function removePlugin($pluginName)
 {
     try {
         /** 获取插件入口 */
         list($pluginFileName, $className) = Typecho_Plugin::portal($pluginName, __TYPECHO_ROOT_DIR__ . '/' . __TYPECHO_PLUGIN_DIR__);
         /** 获取已启用插件 */
         $plugins = Typecho_Plugin::export();
         $activatedPlugins = $plugins['activated'];
         /** 载入插件 */
         require_once $pluginFileName;
         /** 判断实例化是否成功 */
         if (!isset($activatedPlugins[$pluginName]) || !class_exists($className) || !method_exists($className, 'deactivate')) {
             throw new Typecho_Widget_Exception(_t('无法禁用插件'), 500);
         }
         $result = call_user_func(array($className, 'deactivate'));
     } catch (Exception $e) {
         //nothing to do
     }
     $db = Typecho_Db::get();
     try {
         Typecho_Plugin::deactivate($pluginName);
         $db->query($db->update('table.options')->rows(array('value' => serialize(Typecho_Plugin::export())))->where('name = ?', 'plugins'));
     } catch (Typecho_Plugin_Exception $e) {
         //nothing to do
     }
     $db->query($db->delete('table.options')->where('name = ?', 'plugin:' . $pluginName));
 }
开发者ID:hongweipeng,项目名称:typecho,代码行数:34,代码来源:Helper.php


示例11: activate

 /**
  * 激活插件方法,如果激活失败,直接抛出异常
  *
  * @access public
  * @return void
  * @throws Typecho_Plugin_Exception
  */
 public static function activate()
 {
     Typecho_Plugin::factory('Widget_Abstract_Contents')->contentEx = array('TableOfContents_Plugin', 'replace');
     Typecho_Plugin::factory('Widget_Abstract_Contents')->excerptEx = array('TableOfContents_Plugin', 'replace');
     Typecho_Plugin::factory('Widget_Archive')->header = array('TableOfContents_Plugin', 'header');
     Typecho_Plugin::factory('Widget_Archive')->footer = array('TableOfContents_Plugin', 'footer');
 }
开发者ID:xyh968200,项目名称:typecho,代码行数:14,代码来源:Plugin.php


示例12: activate

 public static function activate()
 {
     Typecho_Plugin::factory('Widget_Abstract_Contents')->contentEx = array('Prismjs_Plugin', 'parse');
     Typecho_Plugin::factory('Widget_Abstract_Comments')->contentEx = array('Prismjs_Plugin', 'parse');
     Typecho_Plugin::factory('Widget_Archive')->header = array('Prismjs_Plugin', 'header');
     Typecho_Plugin::factory('Widget_Archive')->footer = array('Prismjs_Plugin', 'footer');
 }
开发者ID:WiseClock,项目名称:Prismjs,代码行数:7,代码来源:Plugin.php


示例13: execute

 /**
  * 执行函数
  *
  * @access public
  * @return void
  */
 public function execute()
 {
     $themes = $this->getThemes();
     if ($themes) {
         $options = $this->widget('Widget_Options');
         $siteUrl = $options->siteUrl;
         $adminUrl = $options->adminUrl;
         $activated = 0;
         $result = array();
         foreach ($themes as $key => $theme) {
             $themeFile = $theme . '/index.php';
             if (file_exists($themeFile)) {
                 $info = Typecho_Plugin::parseInfo($themeFile);
                 $info['name'] = $this->getTheme($theme, $key);
                 if ($info['activated'] = $options->theme == $info['name']) {
                     $activated = $key;
                 }
                 $screen = glob($theme . '/screen*.{jpg,png,gif,bmp,jpeg,JPG,PNG,GIF,BMG,JPEG}', GLOB_BRACE);
                 if ($screen) {
                     $info['screen'] = $options->themeUrl(basename(current($screen)), $info['name']);
                 } else {
                     $info['screen'] = Typecho_Common::url('noscreen.png', $options->adminStaticUrl('img'));
                 }
                 $result[$key] = $info;
             }
         }
         $clone = $result[$activated];
         unset($result[$activated]);
         array_unshift($result, $clone);
         array_filter($result, array($this, 'push'));
     }
 }
开发者ID:hongweipeng,项目名称:typecho,代码行数:38,代码来源:List.php


示例14: activate

 /**
  * 激活插件方法,如果激活失败,直接抛出异常
  * 
  * @access public
  * @return void
  * @throws Typecho_Plugin_Exception
  */
 public static function activate()
 {
     $db = Typecho_Db::get();
     $prefix = $db->getPrefix();
     // 查看数
     if (!array_key_exists('viewsNum', $db->fetchRow($db->select()->from('table.contents')))) {
         $db->query('ALTER TABLE `' . $prefix . 'contents` ADD `viewsNum` INT(10) DEFAULT 0;');
     }
     // 喜欢数
     if (!array_key_exists('likesNum', $db->fetchRow($db->select()->from('table.contents')))) {
         $db->query('ALTER TABLE `' . $prefix . 'contents` ADD `likesNum` INT(10) DEFAULT 0;');
     }
     //增加浏览数
     Typecho_Plugin::factory('Widget_Archive')->singleHandle = array('Jianshu_Plugin', 'viewCounter');
     //把新增的字段添加到查询中
     Typecho_Plugin::factory('Widget_Archive')->select = array('Jianshu_Plugin', 'selectHandle');
     //处理内容
     Typecho_Plugin::factory('Widget_Archive')->beforeRender = array('Jianshu_Plugin', 'beforeRender');
     //处理用户字段
     Typecho_Plugin::factory('Widget_Abstract_Users')->filter = array('Jianshu_Plugin', 'filterUser');
     //sitemap
     Helper::addRoute('sitemap', '/sitemap.xml', 'Jianshu_Action', 'sitemap');
     //工具提供的操作
     Helper::addAction('tools', 'Jianshu_Action');
 }
开发者ID:jiangmuzi,项目名称:jianshu,代码行数:32,代码来源:Plugin.php


示例15: execute

 /**
  * 执行函数
  *
  * @access public
  * @return void
  */
 public function execute()
 {
     $themes = glob(__TYPECHO_ROOT_DIR__ . __TYPECHO_THEME_DIR__ . '/*');
     if ($themes) {
         $options = $this->widget('Widget_Options');
         $siteUrl = $options->siteUrl;
         $adminUrl = $options->adminUrl;
         $activated = 0;
         $result = array();
         foreach ($themes as $key => $theme) {
             $themeFile = $theme . '/index.php';
             if (file_exists($themeFile)) {
                 $info = Typecho_Plugin::parseInfo($themeFile);
                 $info['name'] = basename($theme);
                 if ($info['activated'] = $options->theme == $info['name']) {
                     $activated = $key;
                 }
                 $screen = glob($theme . '/screen*.{jpg,png,gif,bmp,jpeg,JPG,PNG,GIF,BMG,JPEG}', GLOB_BRACE);
                 if ($screen) {
                     $info['screen'] = Typecho_Common::url(trim(__TYPECHO_THEME_DIR__, '/') . '/' . $info['name'] . '/' . basename(current($screen)), $siteUrl);
                 } else {
                     $info['screen'] = Typecho_Common::url('/images/noscreen.gif', $adminUrl);
                 }
                 $result[$key] = $info;
             }
         }
         $clone = $result[$activated];
         unset($result[$activated]);
         array_unshift($result, $clone);
         array_filter($result, array($this, 'push'));
     }
 }
开发者ID:raindali,项目名称:express,代码行数:38,代码来源:List.php


示例16: activate

 /**
  * 激活插件方法,如果激活失败,直接抛出异常
  * 
  * @access public
  * @return void
  * @throws Typecho_Plugin_Exception
  */
 public static function activate()
 {
     Typecho_Plugin::factory('Widget_Abstract_Contents')->filter = array('JWPlayer_Plugin', 'jwfilter');
     Typecho_Plugin::factory('Widget_Abstract_Contents')->contentEx = array('JWPlayer_Plugin', 'jwparse');
     Typecho_Plugin::factory('Widget_Abstract_Contents')->excerptEx = array('JWPlayer_Plugin', 'jwparse');
     Typecho_Plugin::factory('Widget_Archive')->header = array('JWPlayer_Plugin', 'jwjs');
 }
开发者ID:visense,项目名称:JWPlayer-2,代码行数:14,代码来源:Plugin.php


示例17: config

 /**
  * 配置插件
  *
  * @access public
  * @return Typecho_Widget_Helper_Form
  * @throws Typecho_Widget_Exception
  */
 public function config()
 {
     /** 获取插件名称 */
     $pluginName = $this->request->filter('slug')->config;
     /** 获取已启用插件 */
     $plugins = Typecho_Plugin::export();
     $activatedPlugins = $plugins['activated'];
     /** 判断实例化是否成功 */
     if (!$this->info['config'] || !isset($activatedPlugins[$pluginName])) {
         throw new Typecho_Widget_Exception(_t('无法配置插件'), 500);
     }
     /** 载入插件 */
     require_once $this->_pluginFileName;
     $form = new Typecho_Widget_Helper_Form($this->security->getIndex('/action/plugins-edit?config=' . $pluginName), Typecho_Widget_Helper_Form::POST_METHOD);
     call_user_func(array($this->_className, 'config'), $form);
     $options = $this->options->plugin($pluginName);
     if (!empty($options)) {
         foreach ($options as $key => $val) {
             $form->getInput($key)->value($val);
         }
     }
     $submit = new Typecho_Widget_Helper_Form_Element_Submit(NULL, NULL, _t('保存设置'));
     $submit->input->setAttribute('class', 'btn primary');
     $form->addItem($submit);
     return $form;
 }
开发者ID:r0ker,项目名称:hctf2015-all-problems,代码行数:33,代码来源:Config.php


示例18: activate

 /**
  * 激活插件方法,如果激活失败,直接抛出异常
  * 
  * @access public
  * @return void
  * @throws Typecho_Plugin_Exception
  */
 public static function activate()
 {
     //离线浏览器都是所见即所得模式
     Typecho_Plugin::factory('Widget_XmlRpc')->fromOfflineEditor = array('FlashMp3Player_Plugin', 'toCodeEditor');
     /** 前端输出处理接口 */
     Typecho_Plugin::factory('Widget_Abstract_Contents')->excerptEx = array('FlashMp3Player_Plugin', 'parse');
     Typecho_Plugin::factory('Widget_Abstract_Contents')->contentEx = array('FlashMp3Player_Plugin', 'parse');
 }
开发者ID:luobenyu,项目名称:plugins,代码行数:15,代码来源:Plugin.php


示例19: activate

 public static function activate()
 {
     Typecho_Plugin::factory('Widget_Upload')->uploadHandle = array('QiniuFile_Plugin', 'uploadHandle');
     Typecho_Plugin::factory('Widget_Upload')->modifyHandle = array('QiniuFile_Plugin', 'modifyHandle');
     Typecho_Plugin::factory('Widget_Upload')->deleteHandle = array('QiniuFile_Plugin', 'deleteHandle');
     Typecho_Plugin::factory('Widget_Upload')->attachmentHandle = array('QiniuFile_Plugin', 'attachmentHandle');
     return _t('插件已经激活,需先配置七牛的信息!');
 }
开发者ID:Fengtalk,项目名称:QiniuFile,代码行数:8,代码来源:Plugin.php


示例20: activate

 /**
  * 激活插件方法,如果激活失败,直接抛出异常
  * 
  * @access public
  * @return void
  * @throws Typecho_Plugin_Exception
  */
 public static function activate()
 {
     Typecho_Plugin::factory("index.php")->begin = array(__CLASS__, "startTimer");
     Typecho_Plugin::factory("index.php")->end = array(__CLASS__, "finalize");
     Typecho_Plugin::factory("admin/footer.php")->end = array(__CLASS__, "finalize_admin");
     Typecho_Plugin::factory("Widget_Contents_Post_Edit")->finishPublish = array(__CLASS__, "writePost");
     Typecho_Plugin::factory("Widget_Feedback")->finishComment = array(__CLASS__, "finishComment");
 }
开发者ID:nbdarling,项目名称:typechoi7-master,代码行数:15,代码来源:Plugin.php



注:本文中的Typecho_Plugin类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Typecho_Router类代码示例发布时间:2022-05-23
下一篇:
PHP Typecho_Db类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap