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

PHP ControllerFactory类代码示例

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

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



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

示例1: run

 /** Lance le serveur */
 function run()
 {
     // racine du serveur a enregistrer qq part (pour l'instant ici)
     $root = '/blogmarks/servers/atom';
     // On construit le tableau d'arguments pour les filtres
     $args = array();
     // on extrait l'URI relative
     $uri = $_SERVER['REQUEST_URI'];
     //***** DEBUG echo $uri."<br/>".$root;
     $uri = ereg_replace($root, '', $uri);
     $args['uri'] = $uri;
     $args['method'] = $_SERVER['REQUEST_METHOD'];
     $args['content'] = $_GLOBALS['HTTP_RAW_POST_DATA'];
     // On filtre la requête
     $filter = new FilterChainRoot(array(new ContextBuilderFilter(), new AuthenticateFilter()));
     $ret = $filter->execute(&$args);
     if (BlogMarks::isError($ret)) {
         // erreur de filtre
         echo $ret->getMessage();
         return;
     }
     // **** DEBUG
     echo "objet : " . $args['object'] . "<br/>";
     echo "method : " . $args['method'] . "<br/>";
     echo "tag : " . $args['tag'] . "<br/>";
     echo "user : " . $args['user'] . "<br/>";
     echo "id : " . $args['id'] . "<br/>";
     echo "auth_str :" . $args['auth_str'] . "<br/>";
     // **********
     // On construit le controlleur selon le type d'objet de la requête
     $ctrlerFactory = new ControllerFactory();
     $ctrler = $ctrlerFactory->createController($args['object']);
     if (BlogMarks::isError($ctrler)) {
         echo $ctrler->getMessage();
         exit(1);
     }
     // On lance le controlleur pour l'objet de la requête
     $response = $ctrler->execute($args);
     if (BlogMarks::isError($response)) {
         // erreur du controlleur de requête
         return;
     }
     // On applique le renderer atom a la reponse et on la renvoit
     $rendererFactory = new rendererFactory();
     $renderer = $rendererFactory->createRenderer($args['object']);
     // GERER LA REPONSE HTTP
     echo "HTTP/1.1 200 Ok\n";
     $response->accept($renderer);
     echo $renderer->render();
 }
开发者ID:BackupTheBerlios,项目名称:blogmarks,代码行数:51,代码来源:Atom.php


示例2: execute

 /**
  * Perform execution of the application. This method is called from index2.php
  */
 function execute()
 {
     global $sugar_config;
     if (!empty($sugar_config['default_module'])) {
         $this->default_module = $sugar_config['default_module'];
     }
     $module = $this->default_module;
     if (!empty($_REQUEST['module'])) {
         $module = $_REQUEST['module'];
     }
     insert_charset_header();
     $this->setupPrint();
     $this->controller = ControllerFactory::getController($module);
     // if the entry point is defined to not need auth, then don't authenicate
     if (empty($_REQUEST['entryPoint']) || $this->controller->checkEntryPointRequiresAuth($_REQUEST['entryPoint'])) {
         $this->loadUser();
         $this->ACLFilter();
         $this->preProcess();
         $this->controller->preProcess();
     }
     if (ini_get('session.auto_start') !== false) {
         $_SESSION['breadCrumbs'] = new BreadCrumbStack($GLOBALS['current_user']->id);
     }
     SugarThemeRegistry::buildRegistry();
     $this->loadLanguages();
     $this->checkDatabaseVersion();
     $this->loadDisplaySettings();
     $this->loadLicense();
     $this->loadGlobals();
     $this->setupResourceManagement($module);
     $this->controller->execute();
     sugar_cleanup();
 }
开发者ID:klr2003,项目名称:sourceread,代码行数:36,代码来源:SugarApplication.php


示例3: execute

 /**
  * Perform execution of the application. This method is called from index2.php
  */
 function execute()
 {
     global $sugar_config;
     if (!empty($sugar_config['default_module'])) {
         $this->default_module = $sugar_config['default_module'];
     }
     $module = $this->default_module;
     if (!empty($_REQUEST['module'])) {
         $module = $_REQUEST['module'];
     }
     insert_charset_header();
     $this->setupPrint();
     $this->controller = ControllerFactory::getController($module);
     // If the entry point is defined to not need auth, then don't authenticate.
     if (empty($_REQUEST['entryPoint']) || $this->controller->checkEntryPointRequiresAuth($_REQUEST['entryPoint'])) {
         $this->loadUser();
         $this->ACLFilter();
         $this->preProcess();
         $this->controller->preProcess();
         $this->checkHTTPReferer();
     }
     SugarThemeRegistry::buildRegistry();
     $this->loadLanguages();
     $this->checkDatabaseVersion();
     $this->loadDisplaySettings();
     //$this->loadLicense();
     $this->loadGlobals();
     $this->setupResourceManagement($module);
     $this->controller->execute();
     sugar_cleanup();
 }
开发者ID:switcode,项目名称:SuiteCRM,代码行数:34,代码来源:SugarApplication.php


示例4: dispatch

 public function dispatch()
 {
     $helper = HelperFactory::getHelper("Http");
     $conf = $helper->parseGet($_GET);
     try {
         $staticRoute = $this->getCotrollerByAlias(ucfirst($conf["controller"]));
         if ($staticRoute !== false) {
             $conf["controller"] = $staticRoute['controller'];
             if ($staticRoute['action'] != '') {
                 $conf["action"] = $staticRoute['action'];
             }
         }
         $controller = ControllerFactory::getController(ucfirst($conf["controller"]));
         $controller->applyFilters($conf);
         $action = $conf["action"] . "Action";
         $controller->startUp($conf);
         call_user_func_array(array($controller, $action), $conf["param"]);
         $controller->render($conf["action"]);
     } catch (Doctrine_Connection_Exception $e) {
         exit($e->getMessage());
         ErrorHandler::displayError("Found a Doctrine connection error.<br>\n\t\t\t\t\t\t\t\t\t \tMake suere that you have started the Doctrine\n\t\t\t\t\t\t\t\t\t \tsubsystem.<br>");
     } catch (MissingControllerException $e) {
         exit("<h1>ERROR</h1><br><h2>Missing Controller</h2>");
     } catch (MissingClassException $e) {
         exit("<h1>ERROR</h1><br><h2>Missing class</h2>");
     } catch (Exception $e) {
         exit($e->getMessage());
         $controller = ControllerFactory::getController("_404");
         $controller->startUp();
         $controller->render("index");
     }
 }
开发者ID:p1r0,项目名称:MuffinPHP,代码行数:32,代码来源:DefaultDispatcher.php


示例5: dispatch

 private static function dispatch()
 {
     $control_name = CONTROLLER_NAME . 'Controller';
     $action_name = ACTION_NAME . 'Action';
     $factory = ControllerFactory::getInstance();
     $controller = $factory->getController($control_name);
     $controller->{$action_name}();
 }
开发者ID:glianyi,项目名称:MyPHP,代码行数:8,代码来源:main.php


示例6: testControllerNameFromClass

 function testControllerNameFromClass()
 {
     $this->assertEqual(ControllerFactory::get_controller_name_from_class("FPDFController"), "fpdf", "Il nome del controller non corrisponde! : " . ControllerFactory::get_controller_name_from_class("FPDFController"));
     $this->assertEqual(ControllerFactory::get_controller_name_from_class("FPDFStaticController"), "fpdf_static", "Il nome del controller non corrisponde! : " . ControllerFactory::get_controller_name_from_class("FPDFStaticController"));
     $this->assertEqual(ControllerFactory::get_controller_name_from_class("StaticRSSController"), "static_rss", "Il nome del controller non corrisponde! : " . ControllerFactory::get_controller_name_from_class("StaticRSSController"));
     $this->assertEqual(ControllerFactory::get_controller_name_from_class("PippoPlutoController"), "pippo_pluto", "Il nome del controller non corrisponde! : " . ControllerFactory::get_controller_name_from_class("PippoPlutoController"));
     $this->assertEqual(ControllerFactory::get_controller_name_from_class("Pippo_PlutoController"), "pippo_pluto", "Il nome del controller non corrisponde! : " . ControllerFactory::get_controller_name_from_class("pippo_plutoController"));
     $this->assertEqual(ControllerFactory::get_controller_name_from_class("__Pippo__PlutoController"), "__pippo_pluto", "Il nome del controller non corrisponde! : " . ControllerFactory::get_controller_name_from_class("__pippo__plutoController"));
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:9,代码来源:controller_factory_test.php


示例7: getInstance

 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new ControllerFactory();
         return self::$instance;
     } else {
         return self::$instance;
     }
 }
开发者ID:glianyi,项目名称:MyPHP,代码行数:9,代码来源:controllerfactory.php


示例8: process

 public function process()
 {
     try {
         $request = new Request();
         $action = ControllerFactory::runAction($request);
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }
开发者ID:romamolodyko,项目名称:gallery,代码行数:9,代码来源:AppController.php


示例9: Begin

	public function Begin() {
	
		$url = $_GET;

		/** 
		 * pseudocode: 
		 * $url = split($_GET, '/');
		 * $controllerName = $url[0];
		 * $actionName = $url[1];
		 * $queryParams = $url[2...];
		 **/
		
		$controllerFactory = new ControllerFactory();
		$controller = $controllerFactory->CreateController($controllerName, $actionName);
		
		$controller->OnActionExecuting();
		$controller->ExecuteAction($queryParams);
		$controller->OnActionExecuted();
	}
开发者ID:Grinderofl,项目名称:PhpMvc,代码行数:19,代码来源:Router.php


示例10: run

 public function run()
 {
     //Nécessaire pour l'affichage de la vue
     include_once 'Models/Template.php';
     include_once 'Models/Model.php';
     include_once 'functions.php';
     //Création de controlleur----------------------------
     include_once 'Controllers/ControllerFactory.php';
     $controller = ControllerFactory::createController();
     //On lance l'action
     $action = self::getInstance()->getActionName($controller);
     $controller->{$action}();
 }
开发者ID:jayjaydelac,项目名称:test,代码行数:13,代码来源:App.php


示例11: __construct

 function __construct($controller_name, $action, $format, $params)
 {
     //vecchio setup, e' stata aggiunta la creazione del controller
     $this->controller = ControllerFactory::create($controller_name);
     //hack per supportare i vecchi mapping con "php".
     //$format = DataFormatManager::getFormatString($format);
     $this->__check_reserved_action($action);
     if ($format !== "raw") {
         $this->__check_protected_action($action, $format);
     }
     DataFormatManager::checkFormatSupported($format);
     $this->action = $action;
     $this->format = $format;
     $this->params = $params;
     $this->format_helper = DataFormatManager::getFormat($format);
     $this->execute_action = true;
     $this->action_result = null;
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:18,代码来源:ControllerCall.class.php


示例12: testIsControllerClass2

 function testIsControllerClass2()
 {
     $this->assertTrue(ControllerFactory::is_controller_class("ErrorController"), "ErrorController non e' un controller!");
     $this->assertTrue(ControllerFactory::is_controller_class("ModuliController"), "ModuliController non e' un controller!");
     $this->assertFalse(ControllerFactory::is_controller_class("FolderPeer"), "FolderPeer e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("ImmaginiDO"), "ImmaginiDO e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("EventiPeer"), "EventiPeer e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("XMLBuilder"), "XMLBuilder e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("DataHolder"), "DataHolder e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("ArrayUtils"), "ArrayUtils e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("ProfileMap"), "ProfileMap e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("PageLoader"), "PageLoader e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("ModulePlug"), "ModulePlug e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("FileWriter"), "FileWriter e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("FormWriter"), "FormWriter e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("RouteMatch"), "RouteMatch e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("EpiTwitter"), "EpiTwitter e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("Securimage"), "Securimage e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("AjaxHelper"), "AjaxHelper e' un controller!!");
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:20,代码来源:controller_factory_test.php


示例13: display

 function display()
 {
     global $mod_strings, $export_module, $current_language, $theme, $current_user;
     echo get_module_title("Activities", $mod_strings['LBL_MODULE_TITLE'], true);
     $mod_strings = return_module_language($current_language, 'Calls');
     // Overload the export module since the user got here by clicking the "Activities" tab
     $export_module = "Calls";
     $_REQUEST['module'] = 'Calls';
     $controller = ControllerFactory::getController('Calls');
     $controller->loadBean();
     $controller->preProcess();
     $controller->process();
     //Manipulate view directly to not display header, js and footer again
     $view = ViewFactory::loadView($controller->view, $controller->module, $controller->bean, $controller->view_object_map);
     $view->options['show_header'] = false;
     $view->options['show_title'] = false;
     $view->options['show_javascript'] = false;
     $view->process();
     die;
 }
开发者ID:nerdystudmuffin,项目名称:dashlet-subpanels,代码行数:20,代码来源:view.list.php


示例14: run

 public function run()
 {
     require dirname(__FILE__) . '/init.php';
     try {
         ConfLoader::loadConfig();
         $context = ApplicationContext::getContext();
         $map = $context->getControllerMap();
         $url = new Url();
         $actionMap = $map->getAction($url->getPackage(), $url->getAction());
         $controller = ControllerFactory::Create($actionMap['class']);
         $actionAppointer = ActionAppointer::getInstance();
         $actionAppointer->setController($controller);
         $actionAppointer->appointer($actionMap);
     } catch (FileException $fe) {
         $fe->getTraceAsString();
     } catch (CheckedException $ce) {
         $ce->getTraceAsString();
     } catch (Exception $e) {
         $e->getTraceAsString();
     }
 }
开发者ID:JulianSong,项目名称:Sherry,代码行数:21,代码来源:Sherry.php


示例15: validate

 private static function validate($name)
 {
     try {
         $url = URL::getInstance();
         if ($name == null) {
             if (Session::getInstance()->isStarted()) {
                 $url->setController(DEFAULT_SESSION_CONTROLLER);
                 $url->setAction(DEFAULT_SESSION_ACTION);
                 return DEFAULT_SESSION_CONTROLLER;
             } else {
                 $url->setController(DEFAULT_REQUEST_CONTROLLER);
                 $url->setAction(DEFAULT_REQUEST_ACTION);
                 return DEFAULT_REQUEST_CONTROLLER;
             }
         }
         $controller = $name . CONTROLLER;
         $class = new ReflectionClass($controller);
         if ($class->isAbstract()) {
             throw new LogicException();
         }
         $classScope = $class->getConstant('SCOPE');
         if ($class->implementsInterface('Context')) {
             if (Scope::isAcceptable($classScope)) {
                 return $name;
             }
             if ($classScope == Scope::SESSION) {
                 $url->setController(DEFAULT_REQUEST_CONTROLLER);
                 $url->setAction(DEFAULT_REQUEST_ACTION);
                 return DEFAULT_REQUEST_CONTROLLER;
             }
             if ($classScope == Scope::REQUEST) {
                 ControllerFactory::create(DEFAULT_APPLICATION_CONTROLLER)->redirectToError();
             }
         }
         return DEFAULT_APPLICATION_CONTROLLER;
     } catch (LogicException $e) {
         $e->getTraceAsString();
         ControllerFactory::create(DEFAULT_APPLICATION_CONTROLLER)->redirectToError();
     }
 }
开发者ID:anzasolutions,项目名称:simlandia,代码行数:40,代码来源:router.class.php


示例16: testOpportunityNameValueFilled

 /**
  * @group bug39787
  */
 public function testOpportunityNameValueFilled()
 {
     $lead = SugarTestLeadUtilities::createLead();
     $lead->opportunity_name = 'SBizzle Dollar Store';
     $lead->save();
     $_REQUEST['module'] = 'Leads';
     $_REQUEST['action'] = 'ConvertLead';
     $_REQUEST['record'] = $lead->id;
     // Check that the opportunity name doesn't get populated when it's not in the Leads editview layout
     require_once 'include/MVC/Controller/ControllerFactory.php';
     require_once 'include/MVC/View/ViewFactory.php';
     $GLOBALS['app']->controller = ControllerFactory::getController($_REQUEST['module']);
     ob_start();
     $GLOBALS['app']->controller->execute();
     $output = ob_get_clean();
     $matches_one = array();
     $pattern = '/SBizzle Dollar Store/';
     preg_match($pattern, $output, $matches_one);
     $this->assertTrue(count($matches_one) == 0, "Opportunity name got carried over to the Convert Leads page when it shouldn't have.");
     // Add the opportunity_name to the Leads EditView
     SugarTestStudioUtilities::addFieldToLayout('Leads', 'editview', 'opportunity_name');
     // Check that the opportunity name now DOES get populated now that it's in the Leads editview layout
     ob_start();
     $GLOBALS['app']->controller = ControllerFactory::getController($_REQUEST['module']);
     $GLOBALS['app']->controller->execute();
     $output = ob_get_clean();
     $matches_two = array();
     $pattern = '/SBizzle Dollar Store/';
     preg_match($pattern, $output, $matches_two);
     $this->assertTrue(count($matches_two) > 0, "Opportunity name did not carry over to the Convert Leads page when it should have.");
     SugarTestStudioUtilities::removeAllCreatedFields();
     unset($GLOBALS['app']->controller);
     unset($_REQUEST['module']);
     unset($_REQUEST['action']);
     unset($_REQUEST['record']);
     SugarTestLeadUtilities::removeAllCreatedLeads();
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:40,代码来源:ConvertLeadTests.php


示例17: define

<?php

/*
* 2012 TAS
*/
define('IN_TAS', true);
require dirname(__FILE__) . '/config/config.inc.php';
ControllerFactory::getController('RoomStockController')->run();
开发者ID:khuyennd,项目名称:dev-tasagent,代码行数:8,代码来源:room_stock.php


示例18: dirname

<?php

require dirname(__FILE__) . '/config/config.inc.php';
ControllerFactory::getController('DesignEnquiryController')->run();
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:4,代码来源:designenquiries.php


示例19: dirname

<?php

/*
* 2007-2011 PrestaShop 
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2011 PrestaShop SA
*  @version  Release: $Revision: 6594 $
*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
require dirname(__FILE__) . '/config/config.inc.php';
ControllerFactory::getController('OrderSlipController')->run();
开发者ID:greench,项目名称:prestashop,代码行数:29,代码来源:order-slip.php


示例20: dirname

<?php

/*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2012 PrestaShop SA
*  @version  Release: $Revision: 14007 $
*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
require dirname(__FILE__) . '/config/config.inc.php';
ControllerFactory::getController('CompareController')->run();
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:29,代码来源:products-comparison.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP ControllerSecurityUtil类代码示例发布时间:2022-05-23
下一篇:
PHP ControllerBase类代码示例发布时间: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