當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Controller_Router_Rewrite::addConfig方法代碼示例

本文整理匯總了PHP中Zend_Controller_Router_Rewrite::addConfig方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Controller_Router_Rewrite::addConfig方法的具體用法?PHP Zend_Controller_Router_Rewrite::addConfig怎麽用?PHP Zend_Controller_Router_Rewrite::addConfig使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Controller_Router_Rewrite的用法示例。


在下文中一共展示了Zend_Controller_Router_Rewrite::addConfig方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getRouter

    /**
     * Retrieve router object
     *
     * @return Zend_Controller_Router_Rewrite
     */
    public function getRouter()
    {
        if (null === $this->_router) {
            $bootstrap = $this->getBootstrap();
            $bootstrap->bootstrap('FrontController');
            $this->_router = $bootstrap->getContainer()->frontcontroller->getRouter();

            $options = $this->getOptions();
            if (!isset($options['routes'])) {
                $options['routes'] = array();
            }

            if (isset($options['chainNameSeparator'])) {
                $this->_router->setChainNameSeparator($options['chainNameSeparator']);
            }

            if (isset($options['useRequestParametersAsGlobal'])) {
                $this->_router->useRequestParametersAsGlobal($options['useRequestParametersAsGlobal']);
            }

            $this->_router->addConfig(new Zend_Config($options['routes']));
        }

        return $this->_router;
    }
開發者ID:nhp,項目名稱:shopware-4,代碼行數:30,代碼來源:Router.php

示例2: getRouter

 /**
  * Retrieve router object
  *
  * @return Zend_Controller_Router_Rewrite
  */
 public function getRouter()
 {
     if (null === $this->_router) {
         $bootstrap = $this->getBootstrap();
         $bootstrap->bootstrap('FrontController');
         $front = $bootstrap->getContainer()->frontcontroller;
         $options = $this->getOptions();
         if (!isset($options['routes'])) {
             $options['routes'] = array();
         }
         $this->_router = $front->getRouter();
         $this->_router->addConfig(new Zend_Config($options['routes']));
     }
     return $this->_router;
 }
開發者ID:VUW-SIM-FIS,項目名稱:emiemi,代碼行數:20,代碼來源:Router.php

示例3: _initRouter

 protected function _initRouter()
 {
     $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/routes.ini');
     $router = new Zend_Controller_Router_Rewrite();
     $router->addConfig($config);
     Zend_Controller_Front::getInstance()->setRouter($router);
 }
開發者ID:komik966,項目名稱:rek-php-task2,代碼行數:7,代碼來源:Bootstrap.php

示例4: setUp

 protected function setUp()
 {
     parent::setUp();
     foreach (array_keys($_POST) as $key) {
         unset($_POST[$key]);
     }
     Zend_Auth::getInstance()->setStorage(new Zend_Auth_Storage_NonPersistent());
     $this->clean();
     $front = Zend_Controller_Front::getInstance();
     $router = new Zend_Controller_Router_Rewrite();
     $routes_config = new USVN_Config_Ini(USVN_ROUTES_CONFIG_FILE, USVN_CONFIG_SECTION);
     $router->addConfig($routes_config, 'routes');
     $front->setRouter($router);
     $table = new USVN_Db_Table_Users();
     $this->user = $table->fetchNew();
     $this->user->setFromArray(array('users_login' => 'john', 'users_password' => 'pinocchio'));
     $this->user->save();
     $this->admin_user = $table->fetchNew();
     $this->admin_user->setFromArray(array('users_login' => 'god', 'users_password' => 'ingodwetrust', 'users_is_admin' => true));
     $this->admin_user->save();
     $authAdapter = new USVN_Auth_Adapter_Database('john', 'pinocchio');
     Zend_Auth::getInstance()->authenticate($authAdapter);
     $front->setControllerDirectory(USVN_CONTROLLERS_DIR);
     $this->request = new USVN_Controller_Request_Http();
     $front->setRequest($this->request);
     $this->response = new Zend_Controller_Response_Cli();
     $front->setResponse($this->response);
     $router->addRoute('default', new Zend_Controller_Router_Route_Module(array(), $front->getDispatcher(), $front->getRequest()));
 }
開發者ID:phpscr,項目名稱:usvn,代碼行數:29,代碼來源:Controller.php

示例5: _initRouter

 /**
  * Initialize the routes
  *
  * @return void
  */
 protected function _initRouter()
 {
     $routes = new Zend_Config_Xml(APPLICATION_PATH . '/configs/frontend_routes.xml');
     $router = new Zend_Controller_Router_Rewrite();
     $router->addConfig($routes);
     $front = Zend_Controller_Front::getInstance();
     $front->setRouter($router);
 }
開發者ID:omusico,項目名稱:logica,代碼行數:13,代碼來源:CliBootstrap.php

示例6: _initRewrite

 /**
  *
  * Initialize router
  */
 protected function _initRewrite()
 {
     $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/routes.ini', 'production');
     $objRouter = new Zend_Controller_Router_Rewrite();
     $router = $objRouter->addConfig($config, 'routes');
     $front = Zend_Controller_Front::getInstance();
     $front->setRouter($router);
 }
開發者ID:alienpham,項目名稱:resume-manager,代碼行數:12,代碼來源:Bootstrap.php

示例7: _initRoutes

 /**
  * Initialize router
  *
  * @return \Zend_Controller_Router_Rewrite
  */
 protected function _initRoutes()
 {
     $config = new Zend_Config_Json(APPLICATION_PATH . '/configs/routes/en.json', 'routes', array('ignore_constants' => true, 'skip_extends' => true));
     $router = new Zend_Controller_Router_Rewrite();
     $router->addConfig($config);
     $front = Zend_Controller_Front::getInstance();
     $front->setRouter($router);
     return $router;
 }
開發者ID:georgetutuianu,項目名稱:licenta,代碼行數:14,代碼來源:Bootstrap.php

示例8: _initLoadRouter

 protected function _initLoadRouter()
 {
     $config = new Zend_Config_Ini(CONFIG_PATH . '/routers.ini', 'setup-router');
     $objRouter = new Zend_Controller_Router_Rewrite();
     //new Zend_Controller_Router_Route_Regex()
     $router = $objRouter->addConfig($config, 'routers');
     $front = Zend_Controller_Front::getInstance();
     $front->setRouter($router);
 }
開發者ID:rongandat,項目名稱:phanloaicanbo,代碼行數:9,代碼來源:Bootstrap.php

示例9: _initRouter

 protected function _initRouter()
 {
     // Loads routes from specific config file
     $front = $this->bootstrap('FrontController')->getResource('FrontController');
     $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/routes.ini', 'production');
     $routing = new Zend_Controller_Router_Rewrite();
     $routing->addConfig($config, 'routes');
     $front->setRouter($routing);
 }
開發者ID:berliozd,項目名稱:cherbouquin,代碼行數:9,代碼來源:Bootstrap.php

示例10: recentAction

 public function recentAction()
 {
     //@todo route: do it the right way!
     $router = new Zend_Controller_Router_Rewrite();
     $routeConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/defaultRoutes.ini');
     $router->addConfig($routeConfig, 'routes');
     $registry = Zend_Registry::getInstance();
     $config = $registry->get("config");
     $this->_helper->verifyIdentity();
     $recent = new Ml_Model_Recent();
     if (!$registry->isRegistered("authedUserInfo")) {
         throw new Exception("Not authenticated.");
     }
     $userInfo = $registry->get("authedUserInfo");
     $uploads = $recent->contactsUploads($userInfo['id']);
     //send response
     $doc = new Ml_Model_Dom();
     $doc->formatOutput = true;
     $rootElement = $doc->createElement("items");
     $doc->appendChild($rootElement);
     foreach ($uploads as $share) {
         $shareElement = $doc->createElement("item");
         $avatarInfo = unserialize($share['people.avatarInfo']);
         if (isset($avatarInfo['secret'])) {
             $iconSecret = $avatarInfo['secret'];
         } else {
             $iconSecret = '';
         }
         $shareData = array("type" => "file", "id" => $share['id']);
         foreach ($shareData as $name => $field) {
             $shareElement->appendChild($doc->newTextAttribute($name, $field));
         }
         $shareData = array("title" => $share['share.title'], "short" => $share['share.short'], "url" => "http://" . $config['webhost'] . $router->assemble(array("username" => $share['people.alias'], "share_id" => $share['id']), "sharepage_1stpage"));
         foreach ($shareData as $name => $field) {
             $shareElement->appendChild($doc->newTextElement($name, $field));
         }
         $filesizeElement = $doc->createElement("filesize");
         $filesizeElement->appendChild($doc->newTextAttribute("bits", $share['share.fileSize']));
         $filesizeElement->appendChild($doc->newTextAttribute("kbytes", ceil($share['share.fileSize'] / (1024 * 8))));
         $shareElement->appendChild($filesizeElement);
         $ownerElement = $doc->createElement("owner");
         $shareData = array("id" => $share['people.id'], "alias" => $share['people.alias'], "realname" => $share['people.name'], "iconsecret" => $iconSecret);
         foreach ($shareData as $name => $field) {
             $ownerElement->appendChild($doc->newTextAttribute($name, $field));
         }
         $shareElement->appendChild($ownerElement);
         $rootElement->appendChild($shareElement);
     }
     $this->_helper->printResponse($doc);
 }
開發者ID:henvic,項目名稱:MediaLab,代碼行數:50,代碼來源:ActivityController.php

示例11: _addRoutesFromConfig

 /**
  * Add routes from options created from application.ini.
  * Router resource cannot be declared in module.ini.
  * 
  * @param array $options | from application.ini
  */
 private function _addRoutesFromConfig($options)
 {
     if (!isset($options['resources']['router']['routes'])) {
         $options['resources']['router']['routes'] = array();
     }
     if (isset($options['resources']['router']['chainNameSeparator'])) {
         $this->_router->setChainNameSeparator($options['resources']['router']['chainNameSeparator']);
     }
     if (isset($options['resources']['router']['useRequestParametersAsGlobal'])) {
         $this->_router->useRequestParametersAsGlobal($options['resources']['router']['useRequestParametersAsGlobal']);
     }
     $this->_router->addConfig(new Zend_Config($options['resources']['router']['routes']));
     // don't trigger Zend_Application_Resource_Router
     unset($options['resources']['router']);
 }
開發者ID:riteshsahu1981,項目名稱:Weadvance,代碼行數:21,代碼來源:App.php

示例12: _initFrontController

 /**
  * Router rewrite Front
  * 
  * @return string url
  */
 protected function _initFrontController()
 {
     $url = $_SERVER['REQUEST_URI'];
     $arr = explode('/', $url);
     $total_arr = sizeof($arr);
     $urlCheck = 3;
     //localhost = 3 server = 2, $arr[1]
     $detail = $total_arr == $urlCheck && preg_match('/^\\d+-\\d+-.*+$/', $arr[2], $matches) ? true : false;
     if ($total_arr == $urlCheck && !empty($arr[2]) && !$detail) {
         $front = Zend_Controller_Front::getInstance();
         $front->setControllerDirectory(array('default' => APPLICATION_PATH . "/modules/front/controllers", 'admin' => APPLICATION_PATH . "/modules/admin/controllers"));
         $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/routers.ini', 'estore');
         $router = new Zend_Controller_Router_Rewrite();
         return $front->setRouter($router->addConfig($config, 'routes'));
     } else {
         $front = Zend_Controller_Front::getInstance();
         $front->setControllerDirectory(array('default' => APPLICATION_PATH . "/modules/front/controllers", 'admin' => APPLICATION_PATH . "/modules/admin/controllers"));
         $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/routers.ini', 'rewriteshopname');
         $router = new Zend_Controller_Router_Rewrite();
         return $front->setRouter($router->addConfig($config, 'routes'));
     }
 }
開發者ID:nhantam,項目名稱:MangoHRM,代碼行數:27,代碼來源:Bootstrap.php

示例13: testChainingWithConfiguredEmptyStaticRoutesMatchesCorrectly

 /**
  * @group ZF-7848
  */
 public function testChainingWithConfiguredEmptyStaticRoutesMatchesCorrectly()
 {
     $routes = array('admin' => array('route' => 'admin', 'defaults' => array('module' => 'admin', 'controller' => 'index', 'action' => 'index'), 'chains' => array('index' => array('type' => 'Zend_Controller_Router_Route_Static', 'route' => '', 'defaults' => array('module' => 'admin', 'controller' => 'index', 'action' => 'index')), 'login' => array('route' => 'login', 'defaults' => array('module' => 'admin', 'controller' => 'login', 'action' => 'index')))));
     $config = new Zend_Config($routes);
     $rewrite = new Zend_Controller_Router_Rewrite();
     $rewrite->addConfig($config);
     $routes = $rewrite->getRoutes();
     $indexRoute = $rewrite->getRoute('admin-index');
     $loginRoute = $rewrite->getRoute('admin-login');
     $request = new Zend_Controller_Request_Http();
     $request->setPathInfo('/admin');
     $values = $indexRoute->match($request);
     $this->assertEquals(array('module' => 'admin', 'controller' => 'index', 'action' => 'index'), $values);
     $request->setPathInfo('/admin/');
     $values = $indexRoute->match($request);
     $this->assertEquals(array('module' => 'admin', 'controller' => 'index', 'action' => 'index'), $values);
     $request->setPathInfo('/admin/login');
     $values = $loginRoute->match($request);
     $this->assertEquals(array('module' => 'admin', 'controller' => 'login', 'action' => 'index'), $values);
 }
開發者ID:JeancarloPerez,項目名稱:booking-system,代碼行數:23,代碼來源:ChainTest.php

示例14: array

<?php

error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 0);
date_default_timezone_set('America/New_York');
$app_path = "../app/";
set_include_path('.' . PATH_SEPARATOR . $app_path . 'libs/ZendFramework-1.11.2/library/' . PATH_SEPARATOR . get_include_path());
require_once 'Zend/Loader.php';
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->setFallbackAutoloader(true);
$config = new Zend_Config_Ini($app_path . "config.ini", "path");
require_once $config->smarty . 'Smarty.class.php';
require_once $config->views . 'Zend_View_Smarty.class.php';
require_once $config->common . "common_util.php";
Zend_Session::setOptions();
Zend_Session::start();
$device_type = common_util::check_device();
$config_route = new Zend_Config_Ini($app_path . "config.ini", "routing");
$router = new Zend_Controller_Router_Rewrite();
$router->addConfig($config_route, 'routes');
$frontController = Zend_Controller_Front::getInstance();
$frontController->throwExceptions(true);
$frontController->setControllerDirectory($app_path . '/controllers');
$frontController->setParam('useDefaultControllerAlways', true);
$frontController->setRouter($router);
$view = new Zend_View_Smarty($config->views . 'templates', array('compile_dir' => $config->views . 'templates_c', 'config_dir' => $config->views . 'configs', 'cache_dir' => $config->views . 'cache'));
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view)->setViewBasePathSpec($view->getEngine()->template_dir)->setViewScriptPathSpec(':controller/' . $device_type . '_' . ':action.:suffix')->setViewScriptPathNoControllerSpec($device_type . '_' . ':action.:suffix')->setViewSuffix('html');
$frontController->dispatch();
開發者ID:nguyenthehiep,項目名稱:hornburg-pre-owned,代碼行數:30,代碼來源:index.php

示例15: catch

        USVN_Update::runUpdate();
    }
} catch (Exception $e) {
    header('Location: install.php');
    // echo '<pre>' . "\n";
    // echo $e;
    // echo '</pre>' . "\n";
    // exit(0);
}
/* USVN Configuration */
date_default_timezone_set($config->timezone);
USVN_ConsoleUtils::setLocale($config->system->locale);
USVN_Translation::initTranslation($config->translation->locale, USVN_LOCALE_DIR);
USVN_Template::initTemplate($config->template->name, USVN_MEDIAS_DIR);
/* Zend Configuration */
Zend_Registry::set('config', $config);
Zend_Db_Table::setDefaultAdapter(Zend_Db::factory($config->database->adapterName, $config->database->options->toArray()));
if (isset($config->database->prefix)) {
    USVN_Db_Table::$prefix = $config->database->prefix;
}
$front = Zend_Controller_Front::getInstance();
Zend_Layout::startMvc(array('layoutPath' => USVN_LAYOUTS_DIR));
$front->setRequest(new USVN_Controller_Request_Http());
$front->throwExceptions(true);
$front->setBaseUrl($config->url->base);
/* Initialize router */
$router = new Zend_Controller_Router_Rewrite();
$routes_config = new USVN_Config_Ini(USVN_ROUTES_CONFIG_FILE, USVN_CONFIG_SECTION);
$router->addConfig($routes_config, 'routes');
$front->setRouter($router);
$front->setControllerDirectory(USVN_CONTROLLERS_DIR);
開發者ID:royalrex,項目名稱:usvn,代碼行數:31,代碼來源:bootstrap.php


注:本文中的Zend_Controller_Router_Rewrite::addConfig方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。