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


PHP DefaultController類代碼示例

本文整理匯總了PHP中DefaultController的典型用法代碼示例。如果您正苦於以下問題:PHP DefaultController類的具體用法?PHP DefaultController怎麽用?PHP DefaultController使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: handle

 public function handle($params)
 {
     if ($this->_cName == null) {
         // above parseRoute() failed (controller not found) => run Default Controller (if specified)
         global $app_i;
         $def = trim($app_i['default_controller']);
         if ($def != '' && file_exists(BASE . $def)) {
             require_once BASE . $def;
             $ctr = new DefaultController();
             $ctr->handle(null);
             $this->log->debug('Invalid URI. DefaultController called.');
             return;
         }
     }
     // URI parsed OK!
     $fullpath = '/app/' . $this->_cPath . '/' . $this->_cName . '.php';
     $this->log->debug('handle() route: ' . $fullpath);
     $fullpath = BASE . $fullpath;
     if (file_exists($fullpath)) {
         // load parsed Controller
         require_once $fullpath;
         $ctr = new $this->_cName();
         $ctr->handle($this->_cParams);
     } else {
         die('MainController: Error: Controller not found!');
     }
     $this->log->debug('handle() ended');
 }
開發者ID:rsanaie,項目名稱:Thin-PHP-Framework,代碼行數:28,代碼來源:MainController.php

示例2: __construct

 public function __construct()
 {
     $this->splitUrl();
     if (!$this->url_controller) {
         require APP . 'controller/DefaultController.php';
         $page = new DefaultController();
         $page->index();
     } elseif (file_exists(APP . 'controller/' . ucfirst($this->url_controller) . 'Controller.php')) {
         $this->url_controller = ucfirst($this->url_controller) . 'Controller';
         require APP . 'controller/' . $this->url_controller . '.php';
         $this->url_controller = new $this->url_controller();
         if (method_exists($this->url_controller, $this->url_action)) {
             if (!empty($this->url_params)) {
                 call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
             } else {
                 $this->url_controller->{$this->url_action}();
             }
         } else {
             if (strlen($this->url_action) == 0) {
                 $this->url_controller->index();
             } else {
                 header('location: ' . URL . 'error');
             }
         }
     } else {
         header('location: ' . URL . 'error');
     }
 }
開發者ID:robStack,項目名稱:prototype-mvc,代碼行數:28,代碼來源:App.php

示例3: testIndexAction

 public function testIndexAction()
 {
     $view = $this->getServiceMockBuilder('FooView')->getMock();
     $view->expects($this->once())->method('setTemplate')->with('FooBundle:Default:index.twig')->will($this->returnValue(null));
     $view->expects($this->once())->method('handle')->with()->will($this->returnValue('success'));
     $controller = new DefaultController($view);
     $this->assertEquals('success', $controller->indexAction());
 }
開發者ID:nicolas-grekas,項目名稱:workshop-symfony3,代碼行數:8,代碼來源:ExampleHtml5Test.php

示例4: testHelloWorld

 public function testHelloWorld()
 {
     /**
      * @var \Waddle\Classes\App $app
      */
     $app = $this->getMockBuilder('Waddle\\Classes\\App')->disableOriginalConstructor()->getMock();
     $controller = new DefaultController($app);
     $this->expectOutputRegex('/<h1>Hello, World!<\\/h1>/');
     $controller->indexAction('World!');
 }
開發者ID:boggad,項目名稱:waddle-mvc,代碼行數:10,代碼來源:DefaultControllerTest.php

示例5: socialLogin

 public static function socialLogin($uid, $name, $email, $password, $hash)
 {
     $model = UsersModel::model()->where("`social_uid`='{$uid}'  OR `email`='" . $email . "'")->findRow();
     if (!$model) {
         $random_password = rand(10000, 99999);
         $model = new UsersModel();
         $name = trim($name);
         $email = trim($email);
         $password = trim($password);
         $model->name = $name;
         $model->login = $email;
         $model->password = md5($password);
         $model->email = $email;
         $model->is_admin = 0;
         $model->status = 1;
         $model->card_main_id = 1;
         $model->card_main_new_id = 2;
         $model->social_uid = $uid;
         $model->hash = $hash;
         $model->type = 2;
         $model->save();
         DefaultController::sendEmailToUser($model->email, $password, $model->hash, $model->password);
     } else {
         if ($model->status != 0) {
             self::setFields($model);
         } else {
             header("Location: /deactivate");
             exit;
         }
         header("Location: /");
     }
     self::setFields($model);
     header("Location: /");
 }
開發者ID:bionicle12,項目名稱:testsite,代碼行數:34,代碼來源:Auth.php

示例6: connectToController

 /**
  * Trigger a controller according the act param from the url
  * 
  * @param   string $act
  */
 public function connectToController($act)
 {
     $act = ucfirst($act);
     if (!empty($act)) {
         $controllerName = __NAMESPACE__ . '\\' . $act . 'Controller';
         if (!$controllerName && !class_exists($controllerName)) {
             return;
         }
         //  instantiate the view specific controller
         $objController = new $controllerName($this->getSystemComponentController(), $this->cx);
     } else {
         // instantiate the default View Controller
         $objController = new DefaultController($this->getSystemComponentController(), $this->cx);
     }
     $objController->parsePage($this->template);
 }
開發者ID:nahakiole,項目名稱:cloudrexx,代碼行數:21,代碼來源:BackendController.class.php

示例7: confirmarSenha

 public static function confirmarSenha($pwd1, $pwd2)
 {
     $pass = $pwd1 == $pwd2;
     if (!$pass) {
         DefaultController::defineException("senha", "Não foi possível confirmar sua senha!");
     }
     return $pass;
 }
開發者ID:DaniloEpic,項目名稱:slast,代碼行數:8,代碼來源:DefaultController.php

示例8: dispatch

 public function dispatch()
 {
     $flag = false;
     if (isset($_GET['ctrl'], $_GET['act'])) {
         $ctrlName = "Imie\\Controllers\\" . ucfirst($_GET['ctrl']) . 'Controller';
         if (class_exists($ctrlName)) {
             $ctrl = new $ctrlName();
             $actName = $_GET['act'] . 'Action';
             if (method_exists($ctrl, $actName)) {
                 $ctrl->{$actName}();
                 $flag = true;
             }
         }
     }
     if (!$flag) {
         $controller = new DefaultController();
         $controller->indexAction();
     }
 }
開發者ID:MarieYu,項目名稱:tp_mvc,代碼行數:19,代碼來源:Router.php

示例9: display

 /**
  * 
  */
 function display()
 {
     if (!$this->site_template) {
         return parent::display();
     }
     return parent::display($this->site_template);
 }
開發者ID:Barthak,項目名稱:voodoo,代碼行數:10,代碼來源:WikiController.php

示例10: error_404

 public function error_404()
 {
     parent::setLayout('defaultLayout');
     parent::setView('404');
     $this->data['parameters'] = $this->parameters;
     parent::renderLayout();
 }
開發者ID:jezekl,項目名稱:logger,代碼行數:7,代碼來源:Error.class.php

示例11: __construct

 public function __construct()
 {
     parent::__construct();
     # initialize the Perms controller
     $this->_model = new Perms();
     $this->activeSection = 'perms';
 }
開發者ID:uberlinuxguy,項目名稱:certis,代碼行數:7,代碼來源:controller.php

示例12: frmAction

 public function frmAction($id = NULL)
 {
     $disque = $this->getInstance($id);
     //TODO 4.4.1
     $this->view->setVars(array("disque" => $disque, "siteUrl" => $this->url->getBaseUri(), "baseHref" => $this->dispatcher->getControllerName()));
     parent::frmAction($id);
 }
開發者ID:leoarmand,項目名稱:Framework_Phalcon,代碼行數:7,代碼來源:DisquesController.php

示例13: frmAction

 public function frmAction($id = NULL)
 {
     $message = $this->getInstance($id);
     $projects = Projet::find();
     $users = User::find();
     $this->view->setVars(array("message" => $message, "users" => $users, "projects" => $projects));
     parent::frmAction($id);
 }
開發者ID:aleboisselier,項目名稱:Increase,代碼行數:8,代碼來源:MessagesController.php

示例14: display

 function display()
 {
     if (!$this->print_preview) {
         return parent::display();
     }
     $this->addStyleSheet('sheetgen/print.css');
     return parent::display('sheet_template', SHEETGEN_TEMPLATES);
 }
開發者ID:Barthak,項目名稱:voodoo-sheetgen,代碼行數:8,代碼來源:SheetgenController.php

示例15: skate

 public function skate()
 {
     parent::isAllowedToAccess();
     parent::setLayout('defaultLayout');
     parent::setView('skate');
     $this->data['parameters'] = $this->parameters;
     $this->data['orders'] = Statistics::getOrdersOverview(1, '2015-12-02', '2015-12-15');
     parent::renderLayout();
 }
開發者ID:jezekl,項目名稱:logger,代碼行數:9,代碼來源:Dashboard.class.php


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