/** * 激活插件方法,如果激活失败,直接抛出异常 * * @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/write-post.php')->bottom_20 = array('BaiduSlug_Plugin', 'ajax'); Typecho_Plugin::factory('admin/write-page.php')->bottom_20 = array('BaiduSlug_Plugin', 'ajax'); Helper::addAction('baidu-slug', 'BaiduSlug_Action'); return _t('请配置此插件的API KEY, 以使您的插件生效'); }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @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'); }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { Typecho_Plugin::factory('Widget_Archive')->header = array('Ukagaka_Plugin', 'header'); Typecho_Plugin::factory('Widget_Archive')->footer = array('Ukagaka_Plugin', 'footer'); $db = Typecho_Db::get(); $db->query($db->insert('table.options')->rows(array('name' => 'Ukagaka_starttime', 'value' => time(), 'user' => 0))); Helper::addAction('Ukagaka', 'Ukagaka_Action'); }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @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 功能, 无法正常使用此功能')); } Helper::addAction(github_git, 'GitHubGit_Action'); return _t('安装成功') . $error; }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @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 功能, 无法正常使用此功能')); } Helper::addAction('googlecode-svn', 'GoogleCodeSVN_Action'); return _t('请在插件设置里设置 Google Code 的SVN参数') . $error; }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { Typecho_Plugin::factory('admin/write-post.php')->option = array('SyncPost_Plugin', 'render'); Typecho_Plugin::factory('admin/write-page.php')->option = array('SyncPost_Plugin', 'render'); Typecho_Plugin::factory('Widget_Contents_Post_Edit')->write = array('SyncPost_Plugin', 'postRender'); Typecho_Plugin::factory('Widget_Contents_Page_Edit')->write = array('SyncPost_Plugin', 'postRender'); Helper::addAction('SyncPost', 'SyncPost_Action'); }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { $info = DomainTheme_Plugin::install(); Helper::addPanel(1, 'DomainTheme/manage-domaintheme.php', '域名模板', '管理域名模板', 'administrator'); Helper::addAction('DomainTheme-edit', 'DomainTheme_Action'); Typecho_Plugin::factory('Widget_Archive')->handleInit = array(__CLASS__, 'run'); return _t($info); }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { if (!function_exists('curl_init')) { throw new Typecho_Plugin_Exception(_t('对不起, 您的主机没有curl功能, 无法正常使用此插件')); } Helper::addAction('comment-mail-plus', 'CommentMailPlus_Action'); Typecho_Plugin::factory('Widget_Feedback')->finishComment = array('CommentMailPlus_Plugin', 'toMail'); return _t('请到设置面板设置Mailgun。'); }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { if (!ini_get('allow_url_fopen')) { throw new Typecho_Plugin_Exception(_t('对不起, 您的主机没有打开 allow_url_fopen 功能, 无法正常使用此插件')); } Helper::addAction('comment-to-mail', 'CommentToMail_Action'); Typecho_Plugin::factory('Widget_Feedback')->finishComment = array('CommentToMail_Plugin', 'toMail'); return _t('请对插件进行正确设置,以使插件顺利工作!'); }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { $info = self::login_log_install(); //插件注册 Helper::addPanel(3, 'LoginLimit/manage_log.php', '登录日志', '管理登录失败日志', 'administrator'); Helper::addAction('login_log', 'LoginLimit_Action'); Typecho_Plugin::factory('Widget_User')->login = array(__CLASS__, 'dologin'); Typecho_Plugin::factory('Widget_Login')->loginFail = array(__CLASS__, 'loginFail'); }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { if (!Typecho_Db_Adapter_Mysql::isAvailable() && !Typecho_Db_Adapter_Pdo_Mysql::isAvailable()) { throw new Typecho_Plugin_Exception(_t('没有找到任何可用的 Mysql 适配器')); } Helper::addPanel(1, 'EmlogToTypecho/panel.php', _t('从 Emlog 导入数据'), _t('从 Emlog 导入数据'), 'administrator'); Helper::addAction('emlog-to-typecho', 'EmlogToTypecho_Action'); return _t('请在插件设置里设置 Emlog 所在的数据库参数') . $error; }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { $msg = self::install(); // Helper::addPanel(2, 'Notes/add-note.php', '写便签', '新建便签', 'administrator'); Helper::addPanel(3, 'Notes/manage-notes.php', '便签', '管理便签', 'administrator'); // Typecho_Plugin::factory('admin/menu.php')->navBar = array('HelloWorld_Plugin', 'render'); Helper::addAction('notes-manage', 'Notes_Action'); Helper::addRoute('share_note', '/share_note/[key]/', 'Notes_Action', 'shareNote'); return _t($meg); }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { if (!function_exists('gd_info')) { throw new Typecho_Plugin_Exception(_t('对不起, 您的主机不支持 gd 扩展, 无法正常使用此功能')); } Typecho_Plugin::factory('Widget_Feedback')->comment = array('Captcha_Plugin', 'filter'); Typecho_Plugin::factory('Widget_Feedback')->trackback = array('Captcha_Plugin', 'filter'); Typecho_Plugin::factory('Widget_XmlRpc')->pingback = array('Captcha_Plugin', 'filter'); Helper::addAction('captcha', 'Captcha_Action'); }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { $meg = self::install(); Typecho_Plugin::factory('Widget_User')->___sinauthAuthorizeIcon = array('Sinauth_Plugin', 'authorizeIcon'); Helper::addAction('sinauthAuthorize', 'Sinauth_AuthorizeAction'); Helper::addRoute('sinauthAuthorize', '/sinauthAuthorize/', 'Sinauth_AuthorizeAction', 'action'); Helper::addRoute('sinauthCallback', '/sinauthCallback/', 'Sinauth_AuthorizeAction', 'callback'); Helper::addPanel(1, 'Sinauth/panel.php', 'Sinauth', 'Sinauth用户管理', 'administrator'); return _t($meg . '。请进行<a href="options-plugin.php?config=' . self::$pluginName . '">初始化设置</a>'); }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { $info = HuifengMembers_Plugin::membersInstall(); Helper::addPanel(3, 'HuifengMembers/manage-members.php', '会员列表', '管理会员列表', 'administrator'); Helper::addAction('huifeng-members-edit', 'HuifengMembers_Action'); Typecho_Plugin::factory('Widget_Abstract_Contents')->contentEx = array('HuifengMembers_Plugin', 'parse'); Typecho_Plugin::factory('Widget_Abstract_Contents')->excerptEx = array('HuifengMembers_Plugin', 'parse'); Typecho_Plugin::factory('Widget_Abstract_Comments')->contentEx = array('HuifengMembers_Plugin', 'parse'); return _t($info); }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { /* 创建投稿页面及投稿数据表 */ self::initPage(); $result = self::initTable(); /* 添加动作和面板 */ Helper::addAction('contribute', 'Contribute_Action'); Helper::addPanel(3, 'Contribute/panel.php', _t('投稿'), _t('管理投稿'), 'administrator'); return _t($result); }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { $info = Links_Plugin::linksInstall(); Helper::addPanel(3, 'Links/manage-links.php', '友情链接', '管理友情链接', 'administrator'); Helper::addAction('links-edit', 'Links_Action'); Typecho_Plugin::factory('Widget_Abstract_Contents')->contentEx = array('Links_Plugin', 'parse'); Typecho_Plugin::factory('Widget_Abstract_Contents')->excerptEx = array('Links_Plugin', 'parse'); Typecho_Plugin::factory('Widget_Abstract_Comments')->contentEx = array('Links_Plugin', 'parse'); return _t($info); }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { Typecho_Plugin::factory('Widget_Archive')->footer = array('Like_Plugin', 'footer'); Helper::addAction('like', 'Like_Action'); $db = Typecho_Db::get(); $prefix = $db->getPrefix(); // contents 如果没有likes字段,则添加 if (!array_key_exists('likes', $db->fetchRow($db->select()->from('table.contents')))) { $db->query('ALTER TABLE `' . $prefix . 'contents` ADD `likes` INT(10) DEFAULT 0;'); } }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { if (false == self::isAvailable()) { throw new Typecho_Plugin_Exception(_t('对不起, 您的主机没有打开 allow_url_fopen 功能而且不支持 php-curl 扩展, 无法正常使用此功能')); } Typecho_Plugin::factory('Widget_Feedback')->finishComment = array('CommentToMail_Plugin', 'parseComment'); Typecho_Plugin::factory('Widget_Comments_Edit')->finishComment = array('CommentToMail_Plugin', 'parseComment'); Helper::addAction(self::$action, 'CommentToMail_Action'); Helper::addPanel(1, self::$panel, '评论邮件提醒', '评论邮件提醒控制台', 'administrator'); return _t('请设置邮箱信息,以使插件正常使用!'); }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { // 编辑按钮 Typecho_Plugin::factory('admin/editor-js.php')->markdownEditor_30 = array('Remix_Plugin', 'addButton'); // 前端输出 Typecho_Plugin::factory('Widget_Abstract_Contents')->excerptEx_30 = array('Remix_Plugin', 'parse'); Typecho_Plugin::factory('Widget_Abstract_Contents')->contentEx_30 = array('Remix_Plugin', 'parse'); Typecho_Plugin::factory('Widget_Archive')->header_30 = array('Remix_Plugin', 'header'); Typecho_Plugin::factory('Widget_Archive')->footer_30 = array('Remix_Plugin', 'footer'); Helper::addAction('remix', 'Remix_Action'); }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { self::doTable(); Helper::addAction("api", "API_Action"); Typecho_Plugin::factory('admin/custom-fields.php')->before = array('API_Plugin', 'addParser'); Typecho_Plugin::factory('Widget_Contents_Page_Edit')->finishPublish = array('API_Plugin', 'processContent'); Typecho_Plugin::factory('Widget_Contents_Page_Edit')->finishSave = array('API_Plugin', 'processContent'); Helper::addRoute("ChildApi", "/api/[arg1]/[arg2].json/", "API_Action", "detailAction"); Helper::addRoute("MainApi", "/api/[type].json/", "API_Action", "action"); return _t('开启网站API接口,访问路径为:' . "/api"); }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { $meg = MostCache_Plugin::install(); Typecho_Plugin::factory('index.php')->begin = array(self::$pluginName . '_Plugin', 'getCache'); Typecho_Plugin::factory('index.php')->end = array(self::$pluginName . '_Plugin', 'setCache'); Typecho_Plugin::factory('Widget_Feedback')->finishComment = array(self::$pluginName . '_Plugin', 'delCache'); Typecho_Plugin::factory('Widget_Contents_Page_Edit')->write = array(self::$pluginName . '_Plugin', 'delCache'); Typecho_Plugin::factory('Widget_Contents_Post_Edit')->write = array(self::$pluginName . '_Plugin', 'delCache'); Helper::addAction('mostcache', 'MostCache_Action'); Helper::addPanel(1, 'MostCache/panel.php', 'MostCache', 'MostCache缓存管理', 'administrator'); return _t($meg . '。请进行<a href="options-plugin.php?config=' . self::$pluginName . '">初始化设置</a>'); }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { if (!Typecho_Db_Adapter_Mysql::isAvailable() && !Typecho_Db_Adapter_Pdo_Mysql::isAvailable()) { throw new Typecho_Plugin_Exception(_t('没有找到任何可用的 Mysql 适配器')); } $error = NULL; if ((!is_dir(__TYPECHO_ROOT_DIR__ . '/usr/uploads/') || !is_writeable(__TYPECHO_ROOT_DIR__ . '/usr/uploads/')) && !is_writeable(__TYPECHO_ROOT_DIR__ . '/usr/')) { $error = '<br /><strong>' . _t('%s 目录不可写, 可能会导致附件转换不成功', __TYPECHO_ROOT_DIR__ . '/usr/uploads/') . '</strong>'; } Helper::addPanel(1, 'MagikeToTypecho/panel.php', _t('从Magike导入数据'), _t('从Magike导入数据'), 'administrator'); Helper::addAction('magike-to-typecho', 'MagikeToTypecho_Action'); return _t('请在插件设置里设置 Magike 所在的数据库参数') . $error; }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { if (!function_exists('gd_info')) { throw new Typecho_Plugin_Exception(_t('对不起, 您的主机没有PHP中开启GD库支持')); } Typecho_Plugin::factory('Widget_Abstract_Contents')->filter = array('Watermark_Plugin', 'parse'); Helper::addAction('Watermark', 'Watermark_Action'); $dir = __TYPECHO_ROOT_DIR__ . '/usr/img'; if ((is_dir($dir) || @mkdir($dir, 0777)) && is_writable($dir)) { return _t('插件已经激活,请正确设置插件!'); } else { return _t('usr目录权限限制,无法使用缓存功能'); } }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return string * @throws Typecho_Plugin_Exception */ public static function activate() { $info = HighSlide_Plugin::galleryinstall(); Helper::addPanel(3, 'HighSlide/manage-gallery.php', _t('页面相册'), _t('配置页面相册 <span style="color:#999;">(HighSlide全功能版核心支持)</span>'), 'administrator'); Helper::addAction('gallery-edit', 'HighSlide_Action'); Typecho_Plugin::factory('Widget_Archive')->header = array('HighSlide_Plugin', 'headlink'); Typecho_Plugin::factory('Widget_Archive')->footer = array('HighSlide_Plugin', 'footlink'); Typecho_Plugin::factory('Widget_Abstract_Contents')->contentEx = array('HighSlide_Plugin', 'autohighslide'); Typecho_Plugin::factory('Widget_Abstract_Contents')->excerptEx = array('HighSlide_Plugin', 'autohighslide'); Typecho_Plugin::factory('admin/write-post.php')->bottom = array('HighSlide_Plugin', 'jshelper'); Typecho_Plugin::factory('admin/write-page.php')->bottom = array('HighSlide_Plugin', 'jshelper'); Typecho_Plugin::factory('admin/write-post.php')->option = array('HighSlide_Plugin', 'uploadpanel'); return _t($info); }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { // 接口 Typecho_Plugin::factory('接口')->navBar_20 = array('MyPlugin_Plugin', 'functionName'); // 添加菜单 Helper::addMenu('menuName'); // 添加面板, 1 为菜单索引位置, administrator 为进入面板的权限 Helper::addPanel(1, 'MyPlugin/panel.php', 'panelTitle', 'panelSubtitle', 'administrator'); // 添加动作 Helper::addAction('actionName', 'MyPlugin_ActionClassName'); // 添加路由 Helper::addRoute('routeName', '/myroute/route-path', 'MyPlugin_WidgetClassName', 'functionName'); // 激活时返回的信息 return _t('激活时返回的信息'); }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { if (!class_exists('ZipArchive')) { throw new Typecho_Plugin_Exception(_t('对不起, 您的服务器不支持 ZipArchive 类, 无法正常使用此插件')); } if (!is_writable(__TYPECHO_PLUGIN_DIR__)) { throw new Typecho_Plugin_Exception(_t('插件目录无写入权限, 无法正常使用此插件')); } if (!function_exists('file_put_contents') && !function_exists('fopen')) { throw new Typecho_Plugin_Exception(_t('file_put_contents、fopen函数被禁用, 无法正常使用此插件')); throw new Typecho_Plugin_Exception(_t('插件目录无写入权限, 无法正常使用此插件')); } Helper::addPanel(1, 'UploadPlugin/panel.php', _t('上传'), _t('在线插件管理'), 'administrator'); Helper::addAction('upload-plugin', 'UploadPlugin_Action'); }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { $db = Typecho_Db::get(); $golinks = $db->getPrefix() . 'golinks'; $adapter = $db->getAdapterName(); if ("Pdo_SQLite" === $adapter || "SQLite" === $adapter) { $db->query(" CREATE TABLE IF NOT EXISTS " . $golinks . " (\n id INTEGER PRIMARY KEY, \n key TEXT,\n target TEXT,\n count NUMERIC)"); } if ("Pdo_Mysql" === $adapter || "Mysql" === $adapter) { $db->query("CREATE TABLE IF NOT EXISTS " . $golinks . " (\n `id` int(8) NOT NULL AUTO_INCREMENT,\n `key` varchar(32) NOT NULL,\n `target` varchar(10000) NOT NULL,\n `count` int(8) DEFAULT '0',\n PRIMARY KEY (`id`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1"); } Helper::addAction('golinks', 'GoLinks_Action'); Helper::addRoute('go', '/go/[key]/', 'GoLinks_Action', 'golink'); Helper::addPanel(2, 'GoLinks/panel.php', '链接转换', '链接转换管理', 'administrator'); return '数据表 ' . $golinks . ' 创建成功, 插件已经成功激活!'; }
/** * 激活插件方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { try { Links_Plugin::linksInstall(); $err = '建立友情链接数据表,插件启用成功'; } catch (Typecho_Db_Exception $e) { $code = $e->getCode(); if (1050 == $code) { $err = '友情链接数据表已经存在,插件启用成功'; } else { return _t('友情链接插件启用失败'); } } Helper::addPanel(3, 'Links/manage-links.php', '友情链接', '', 'administrator'); Helper::addAction('links-edit', 'Links_Action'); return _t($err); }
/** * 激活duoshuo方法,如果激活失败,直接抛出异常 * * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function activate() { try { Duoshuo_Plugin::duoshuoInstall(); $err = '建立多说信息数据表,duoshuo启用成功'; } catch (Typecho_Db_Exception $e) { $code = $e->getCode(); if (1050 == $code || 1062 == $code || 1060 == $code) { $err = '多说信息数据表数据表已经存在,duoshuo启用成功'; } else { return _t('多说实时同步duoshuo启用失败' . $code); } } Helper::addPanel(3, 'Duoshuo/manage-duoshuo.php', '多说评论', '多说评论管理', 'administrator'); Helper::addAction('duoshuo-edit', 'Duoshuo_Action'); Helper::addRoute('DuoShuoSync', '/DuoShuoSync', 'Duoshuo_Action', 'api'); Typecho_Plugin::factory('Widget_Feedback')->comment = array('Duoshuo_Plugin', 'comments_deny'); //关闭站内留言 return _t($err); }