本文整理汇总了PHP中Helper::addRoute方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::addRoute方法的具体用法?PHP Helper::addRoute怎么用?PHP Helper::addRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Helper
的用法示例。
在下文中一共展示了Helper::addRoute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
示例2: activate
/**
* 激活插件方法,如果激活失败,直接抛出异常
*
* @access public
* @return void
* @throws Typecho_Plugin_Exception
*/
public static function activate()
{
Typecho_Plugin::factory('admin/menu.php')->navBar = array('DevTool_Plugin', 'render');
Helper::addPanel(1, 'DevTool/index.php', self::NAME, self::NAME, 'administrator');
Helper::addRoute('dev-tool_index', __TYPECHO_ADMIN_DIR__ . 'dev-tool/index', 'DevTool_Action', 'index');
Helper::addRoute('dev-tool_options', __TYPECHO_ADMIN_DIR__ . 'dev-tool/options', 'DevTool_Action', 'options');
Helper::addRoute('dev-tool_post', __TYPECHO_ADMIN_DIR__ . 'dev-tool/post', 'DevTool_Action', 'post');
}
示例3: activate
/**
* 激活插件方法,如果激活失败,直接抛出异常
*
* @access public
* @return void
* @throws Typecho_Plugin_Exception
*/
public static function activate()
{
$info = self::installDb();
//SNS帐号登录
Helper::addRoute('oauth', '/oauth', 'TeConnect_Widget', 'oauth');
Helper::addRoute('oauth_callback', '/oauth_callback', 'TeConnect_Widget', 'callback');
return _t($info);
}
示例4: activate
public static function activate()
{
$msg = Access_Plugin::install();
Helper::addPanel(1, self::$panel, 'Access控制台', 'Access插件控制台', 'subscriber');
Helper::addRoute("access_ipip", "/access/i/ipip", "Access_Action", 'ipip');
Typecho_Plugin::factory('Widget_Archive')->header = array('Access_Plugin', 'start');
return _t($msg);
}
示例5: activate
/**
* 激活插件方法,如果激活失败,直接抛出异常
*
* @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);
}
示例6: activate
/**
* 激活插件方法,如果激活失败,直接抛出异常
*
* @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");
}
示例7: activate
public static function activate()
{
$msg = self::install();
//挂载发布文章和页面的接口
Typecho_Plugin::factory('Widget_Contents_Post_Edit')->finishPublish = array('BaiduSubmit_Action', 'send');
Typecho_Plugin::factory('Widget_Contents_Page_Edit')->finishPublish = array('BaiduSubmit_Action', 'send');
//添加网站地图功能
Helper::addRoute('baidu_sitemap', '/baidu_sitemap.xml', 'BaiduSubmit_Action', 'sitemap');
Helper::addPanel(1, 'BaiduSubmit/Logs.php', '百度结构化日志', '百度结构化日志', 'administrator');
Helper::addRoute('baidu_sitemap_advanced', __TYPECHO_ADMIN_DIR__ . 'baidu_sitemap/advanced', 'BaiduSubmit_Action', 'send_all');
return $msg . '请进入设置填写接口调用地址';
}
示例8: activate
public static function activate()
{
if (substr(trim(dirname(__FILE__), '/'), -8) != 'ymplayer') {
throw new Typecho_Plugin_Exception('插件目录名必须为ymplayer');
}
Typecho_Plugin::factory('Widget_Abstract_Contents')->contentEx = array(__CLASS__, 'parse');
Typecho_Plugin::factory('Widget_Abstract_Contents')->excerptEx = array(__CLASS__, 'parse');
Typecho_Plugin::factory('Widget_Archive')->header = array(__CLASS__, 'insertStyle');
Typecho_Plugin::factory('Widget_Archive')->footer = array(__CLASS__, 'insertScript');
Typecho_Plugin::factory('admin/write-post.php')->bottom = array(__CLASS__, 'button');
Typecho_Plugin::factory('admin/write-page.php')->bottom = array(__CLASS__, 'button');
Helper::addRoute('ymplayer_ajax', '/ymplayer.json', 'ymplayer_Action', 'ajax');
}
示例9: activate
/**
* 激活插件方法,如果激活失败,直接抛出异常
*
* @access public
* @return void
* @throws Typecho_Plugin_Exception
*/
public static function activate()
{
//检查是否有curl扩展
if (!extension_loaded('curl')) {
throw new Typecho_Plugin_Exception('缺少curl扩展支持.');
}
//创建下载临时目录
$tempDir = __TYPECHO_ROOT_DIR__ . __TYPECHO_PLUGIN_DIR__ . self::$tempPath;
!file_exists($tempDir) and !@mkdir($tempDir);
//创建菜单和路由
Helper::addPanel(1, 'AppStore/market.php', '应用商店', '应用商店', 'administrator');
Helper::addRoute('app.store.market', __TYPECHO_ADMIN_DIR__ . 'app-store/market', 'AppStore_Action', 'market');
Helper::addRoute('app.store.install', __TYPECHO_ADMIN_DIR__ . 'app-store/install', 'AppStore_Action', 'install');
}
示例10: activate
/**
* 激活插件方法,如果激活失败,直接抛出异常
*
* @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('激活时返回的信息');
}
示例11: edit
/**
* 修改路由
*/
public function edit()
{
$modified = false;
if ($this->request->isPost()) {
foreach ($this->_default as $key => $value) {
if (array_key_exists($key, $this->_restore) && $this->request->__isSet($key) && $this->request->{$key} != $this->_default[$key]['url'] && $key != 'do') {
Helper::removeRoute($key);
Helper::addRoute($key, $this->request->{$key}, $this->_default[$key]['widget'], $this->_default[$key]['action']);
$modified = true;
}
}
}
if ($modified) {
$this->widget('Widget_Notice')->set(_t("路由变更已经保存"), NULL, 'success');
} else {
$this->widget('Widget_Notice')->set(_t("路由未变更"), NULL, 'notice');
}
}
示例12: activate
/**
* 激活插件方法,如果激活失败,直接抛出异常
*
* @access public
* @return void
* @throws Typecho_Plugin_Exception
*/
public static function activate()
{
Helper::addRoute('passport_forgot', '/passport/forgot', 'Passport_Widget', 'doForgot');
Helper::addRoute('passport_reset', '/passport/reset', 'Passport_Widget', 'doReset');
return _t('请配置此插件的SMTP信息, 以使您的插件生效');
}
示例13: activate
/**
* 激活插件方法,如果激活失败,直接抛出异常
*
* @access public
* @return void
* @throws Typecho_Plugin_Exception
*/
public static function activate()
{
Helper::addPanel(1, "TEDbBak/MainView.php", _t("数据库备份"), _t("数据库备份"), 'administrator');
Helper::addAction('kgsoft_dbbak', 'TEDbBak_Action');
Helper::addRoute('forbiddenUrl', '/usr/plugins/TEDbBak/bak/[str:string]', 'TEDbBak_Action', 'forbid', 'index_page');
}
示例14: v0_9r13_11_17
/**
* v0_9r13_11_17
*
* @param mixed $db
* @param mixed $options
* @static
* @access public
* @return void
*/
public static function v0_9r13_11_17($db, $options)
{
Helper::addRoute('archive', '/blog/', 'Widget_Archive', 'render', 'index');
Helper::addRoute('archive_page', '/blog/[page:digital]/', 'Widget_Archive', 'render', 'index_page');
$db->query($db->insert('table.options')->rows(array('name' => 'frontArchive', 'user' => 0, 'value' => 0)));
}
示例15: resetLink
/**
* 重设自定义链接
*/
public function resetLink()
{
$link = $this->request->link;
Helper::removeRoute('go');
Helper::addRoute('go', $link, 'GoLinks_Action', 'golink');
Typecho_Response::throwJson('success');
}