当前位置: 首页>>代码示例>>PHP>>正文


PHP Dispatcher::addRoute方法代码示例

本文整理汇总了PHP中Dispatcher::addRoute方法的典型用法代码示例。如果您正苦于以下问题:PHP Dispatcher::addRoute方法的具体用法?PHP Dispatcher::addRoute怎么用?PHP Dispatcher::addRoute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dispatcher的用法示例。


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

示例1: use_helper

// DEFINED ONLY FOR BACKWARDS SUPPORT - to be taken out before 0.9.0
$__FROG_CONN__ = $__CMS_CONN__;
Record::connection($__CMS_CONN__);
Record::getConnection()->exec("set names 'utf8'");
Setting::init();
use_helper('I18n');
AuthUser::load();
if (AuthUser::isLoggedIn()) {
    I18n::setLocale(AuthUser::getRecord()->language);
} else {
    I18n::setLocale(Setting::get('language'));
}
// Only add the cron web bug when necessary
if (defined('USE_POORMANSCRON') && USE_POORMANSCRON && defined('POORMANSCRON_INTERVAL')) {
    Observer::observe('page_before_execute_layout', 'run_cron');
    function run_cron()
    {
        $cron = Cron::findByIdFrom('Cron', '1');
        $now = time();
        $last = $cron->getLastRunTime();
        if ($now - $last > POORMANSCRON_INTERVAL) {
            echo $cron->generateWebBug();
        }
    }
}
Plugin::init();
// Setup admin routes
$admin_routes = array('/' . ADMIN_DIR => Setting::get('default_tab'), '/' . ADMIN_DIR . '/' => Setting::get('default_tab'), '/' . ADMIN_DIR . '/:any' => '$1');
Dispatcher::addRoute($admin_routes);
// run everything!
require APP_PATH . '/main.php';
开发者ID:julpi,项目名称:FreshCMS,代码行数:31,代码来源:index.php

示例2: defined

<?php

defined('IN_CMS') || exit;
Plugin::setInfos(array('id' => 'ckeditor', 'title' => __('CKEditor'), 'description' => __('CKEditor Wysiwyg filter'), 'version' => '2.1.2', 'license' => 'GPLv3', 'author' => 'andrewmman', 'website' => 'http://www.wolfcms.org/forum/topic1957.html', 'update_url' => 'http://andrewmman.byethost7.com/wolfplugins.xml', 'require_wolf_version' => '0.7.5', 'type' => 'both'));
Filter::add('ckeditor', 'ckeditor/filter/Ckeditor.php');
Plugin::addController('ckeditor', 'CKEditor', '', false);
AutoLoader::addFile('CkeditorPublicController', PLUGINS_ROOT . DS . 'ckeditor' . DS . 'classes' . DS . 'CkeditorPublicController.php');
AutoLoader::addFile('CkeditorPluginsController', PLUGINS_ROOT . DS . 'ckeditor' . DS . 'CkeditorPluginsController.php');
if (AuthUser::isLoggedIn()) {
    $CKFILTER_URI = '/wolf/plugins/ckeditor/';
    $CKPLUGINS_URI = $CKFILTER_URI . 'plugins/';
    // Routes needed by the filter to fetch user setup/settings and use filemanager
    Dispatcher::addRoute(array($CKFILTER_URI . 'ckeditor_config.js' => 'plugin/ckeditor/ck_config', $CKFILTER_URI . 'filemanager/:any' => 'plugin/ckeditor/filemanager/$1'));
    // Routes for custom plugins using CkeditorPluginsController
    Dispatcher::addRoute(array($CKPLUGINS_URI . 'wolf_pages.js' => 'ckeditor_plugins/wolf_pages'));
}
Observer::observe('dispatch_route_found', 'ckeditor_filter_setup');
function ckeditor_filter_setup()
{
    $config_path = USE_MOD_REWRITE ? 'ckeditor/' : '../../?/wolf/plugins/ckeditor/';
    $controllers = '(page|snippet)';
    $actions = '(add|edit)';
    $pattern = '/^' . ADMIN_DIR . '\\/' . $controllers . '\\/' . $actions . '/';
    if (preg_match($pattern, CURRENT_URI)) {
        Plugin::addJavascript('ckeditor', 'scripts/ckeditor/ckeditor.js');
        Plugin::addJavascript('ckeditor', 'scripts/init.js');
        /* nasty way of including scripts */
        Plugin::$javascripts[] = $config_path . 'ckeditor_config.js';
        // load it AFTER ckeditor_config!
        //         Plugin::addJavascript('ckeditor', 'scripts/user/config.js');
    }
开发者ID:sindotnet,项目名称:cona,代码行数:31,代码来源:index.php

示例3: __

<?php

if (!defined('IN_CMS')) {
    exit;
}
/**
 * Image manipulation plugin for Wolf CMS <http://www.wolfcms.org> based on the Kohana Image.
 *
 * @package Plugins
 * @subpackage image
 *
 * @author Devi Mandiri <devi[dot]mandiri[at]gmail[dot]com>
 * @license UNLICENSE - http://unlicense.org
 *
 * Kohana license refer to http://kohanaframework.org/license
 */
Plugin::setInfos(array('id' => 'image', 'type' => 'both', 'title' => __('Image'), 'description' => __('Image manipulation using GD library. Allows images to be resized, cropped, etc.'), 'version' => '1.0.1', 'license' => 'Unlicense', 'author' => 'Devi Mandiri', 'website' => 'http://github.com/devi/wolf-image', 'update_url' => 'http://devi.web.id/wolf-plugin-versions.xml', 'require_wolf_version' => '0.7.3'));
AutoLoader::addFile('Image', PLUGINS_ROOT . '/image/image.class.php');
Plugin::addController('image', '', false, false);
// manipulate image on the fly
Dispatcher::addRoute(array('/wolfimage?:any' => '/plugin/image/wolfimage/$1'));
开发者ID:sindotnet,项目名称:cona,代码行数:21,代码来源:index.php

示例4: delete

 /**
  * Add a DELETE route.
  *
  * @param string $pattern 
  * @param \Closure $handler 
  * @return void
  */
 public function delete($pattern, $handler)
 {
     $this->dispatcher->addRoute('delete', $pattern, $handler);
 }
开发者ID:niceboy120,项目名称:verbier,代码行数:11,代码来源:Application.php


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