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


PHP Loader::controller方法代码示例

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


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

示例1: on_start

 public function on_start()
 {
     $c = Page::getByPath('/dashboard/blocks/stacks');
     $cp = new Permissions($c);
     if ($cp->canViewPage()) {
         $c = Page::getCurrentPage();
         $pcp = new Permissions($c);
         if (!$pcp->canViewPageVersions() || $_GET['vtask'] != 'view_versions' && $_GET['vtask'] != 'compare') {
             $cID = $c->getCollectionID();
             $this->redirect('/dashboard/blocks/stacks', 'view_details', $cID);
         } else {
             $this->theme = 'dashboard';
         }
     } else {
         global $c;
         // ugh
         $v = View::getInstance();
         $c = new Page();
         $c->loadError(COLLECTION_NOT_FOUND);
         $v->setCollectionObject($c);
         $this->c = $c;
         $cont = Loader::controller("/page_not_found");
         $v->setController($cont);
         $v->render('/page_not_found');
     }
 }
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:26,代码来源:core_stack.php

示例2: update_group

	public function update_group() {
		$g = Group::getByID(intval($_REQUEST['gID']));
		$txt = Loader::helper('text');
		$valt = Loader::helper('validation/token');
		$gName = $txt->sanitize($_POST['gName']);
		$gDescription = $_POST['gDescription'];
		
		if (!$gName) {
			$this->error->add(t("Name required."));
		}
		
		if (!$valt->validate('add_or_update_group')) {
			$this->error->add($valt->getErrorMessage());
		}
		
		$g1 = Group::getByName($gName);
		if ($g1 instanceof Group) {
			if ((!is_object($g)) || $g->getGroupID() != $g1->getGroupID()) {
				$this->error->add(t('A group named "%s" already exists', $g1->getGroupName()));
			}
		}
		
		if (count($error) == 0) {
			$g->update($gName, $_POST['gDescription']);
			$cnta = Loader::controller('/dashboard/users/add_group');
			$cnta->checkExpirationOptions($g);
			$this->redirect('/dashboard/users/groups', 'group_updated');
		}	
	}
开发者ID:nbourguig,项目名称:concrete5,代码行数:29,代码来源:groups.php

示例3: controller

 private function controller()
 {
     Loader::core('Controller');
     self::$router->routers = $c = self::$router->parse_url();
     //var_dump(self::$router->routers);
     Loader::controller(ucfirst(strtolower($c['controller'])), $c['method'], $c['var']);
 }
开发者ID:pgfeng,项目名称:ssy.9icode.club,代码行数:7,代码来源:Router.class.php

示例4: view

 public function view($userID = 0)
 {
     if (!ENABLE_USER_PROFILES) {
         header("HTTP/1.0 404 Not Found");
         $this->render("/page_not_found");
     }
     $html = Loader::helper('html');
     $canEdit = false;
     $u = new User();
     if ($userID > 0) {
         $profile = UserInfo::getByID($userID);
         if (!is_object($profile)) {
             throw new Exception('Invalid User ID.');
         }
     } else {
         if ($u->isRegistered()) {
             $profile = UserInfo::getByID($u->getUserID());
             $canEdit = true;
         } else {
             $this->set('intro_msg', t('You must sign in order to access this page!'));
             Loader::controller('/login');
             $this->render('/login');
         }
     }
     $this->set('profile', $profile);
     $this->set('av', Loader::helper('concrete/avatar'));
     $this->set('t', Loader::helper('text'));
     $this->set('canEdit', $canEdit);
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:29,代码来源:profile.php

示例5: CoreAutoload

function CoreAutoload($class)
{
    $txt = Loader::helper('text');
    if ($class == 'DashboardBaseController') {
        Loader::controller('/dashboard/base');
    }
    if (strpos($class, 'BlockController') > 0) {
        $class = substr($class, 0, strpos($class, 'BlockController'));
        $handle = $txt->uncamelcase($class);
        Loader::block($handle);
    } else {
        if (strpos($class, 'Helper') > 0) {
            $class = substr($class, 0, strpos($class, 'Helper'));
            $handle = $txt->uncamelcase($class);
            $handle = preg_replace('/^site_/', '', $handle);
            Loader::helper($handle);
        } else {
            if (strpos($class, 'AttributeType') > 0) {
                $class = substr($class, 0, strpos($class, 'AttributeType'));
                $handle = $txt->uncamelcase($class);
                $at = AttributeType::getByHandle($handle);
            }
        }
    }
}
开发者ID:nbourguig,项目名称:concrete5,代码行数:25,代码来源:autoload.php

示例6: refresh_database_schema

 public function refresh_database_schema()
 {
     if ($this->token->validate("refresh_database_schema")) {
         $msg = '';
         if ($this->post('refresh_global_schema')) {
             // refresh concrete/config/db.xml and all installed blocks
             $cnt = Loader::controller("/upgrade");
             try {
                 $cnt->refresh_schema();
                 $msg .= t('Core database files and installed blocks refreshed.');
             } catch (Exception $e) {
                 $this->set('error', $e);
             }
         }
         if ($this->post('refresh_local_schema')) {
             // refresh concrete/config/db.xml and all installed blocks
             if (file_exists('config/' . FILENAME_LOCAL_DB)) {
                 try {
                     Package::installDB(DIR_BASE . '/config/' . FILENAME_LOCAL_DB);
                     $msg .= ' ' . t('Local database file refreshed.');
                 } catch (Exception $e) {
                     $this->set('error', $e);
                 }
             }
         }
         $msg = trim($msg);
         $this->set('message', $msg);
     } else {
         $this->set('error', array($this->token->getErrorMessage()));
     }
 }
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:31,代码来源:database.php

示例7: __construct

 public function __construct()
 {
     self::$__instance = $this;
     set_exception_handler('exceptionHandler');
     // setup our loader instance
     $this->loader = new Loader();
     // load a few helpers
     $this->loader->helper('uri', FRAMEWORK_PATH . 'helpers');
     // loader the plugins
     $this->plugins = $this->loader->manager('plugins');
     $this->plugins->loadFrameworkPlugins();
     // what shall we load first?
     $this->route = $this->loader->manager('route')->find();
     // load the controller
     $this->controller = $this->loader->controller($this->route->getController());
     $this->controller->invokeAction($this->route->getAction());
 }
开发者ID:TheProjecter,项目名称:scratch-framework,代码行数:17,代码来源:scratch.php

示例8: on_start

 public function on_start()
 {
     $cnt = Loader::controller('/dashboard/system/backup_restore/update');
     $cnt->secCheck();
     // if you just reverted, but didn't manually clear out your files - cache would be a prob here.
     $ca = new Cache();
     $ca->flush();
     $this->site_version = Config::get('SITE_APP_VERSION');
 }
开发者ID:rmxdave,项目名称:concrete5,代码行数:9,代码来源:upgrade.php

示例9: view_detail

	public function view_detail($fsID, $action = false) {
		Loader::model('file_set');
		$fs = FileSet::getByID($fsID);
		$ph = Loader::controller('/dashboard/system/permissions/files');
		$this->set('ph', $ph);		
		$this->set('fs', $fs);	
		if ($action == 'file_set_updated') {
			$this->set('message', t('File set updated successfully.'));
		}
		$this->view();		
	}		
开发者ID:nveid,项目名称:concrete5,代码行数:11,代码来源:sets.php

示例10: __construct

	public function __construct() {
		$html = Loader::helper('html');
		parent::__construct();
		$u = new User();
		if (!$u->isRegistered()) {
			$this->set('intro_msg', t('You must sign in order to access this page!'));
			Loader::controller('/login');
			$this->render('/login');
		}
		$this->set('ui', UserInfo::getByID($u->getUserID()));
		$this->set('av', Loader::helper('concrete/avatar'));
	}
开发者ID:nveid,项目名称:concrete5,代码行数:12,代码来源:edit.php

示例11: __construct

 public function __construct()
 {
     if (!ENABLE_REGISTRATION) {
         $cont = Loader::controller('/page_not_found');
         $cont->view();
         $this->render("/page_not_found");
     }
     parent::__construct();
     Loader::model('user_attributes');
     $u = new User();
     $this->set('u', $u);
     if (USER_REGISTRATION_WITH_EMAIL_ADDRESS) {
         $this->set('displayUserName', false);
     } else {
         $this->set('displayUserName', true);
     }
 }
开发者ID:r-bansal,项目名称:janeswalk-web-1,代码行数:17,代码来源:register.php

示例12: run

 /**
  * 执行应用程序
  * @access public
  * @return void
  */
 public static function run(array $config = [])
 {
     if (version_compare(PHP_VERSION, '5.4.0', '<')) {
         throw new Exception('require PHP > 5.4.0 !');
     }
     // 日志初始化
     Log::init($config['log']);
     // 缓存初始化
     Cache::connect($config['cache']);
     // 加载框架底层语言包
     if (is_file(THINK_PATH . 'Lang/' . strtolower($config['default_lang']) . EXT)) {
         Lang::set(include THINK_PATH . 'Lang/' . strtolower($config['default_lang']) . EXT);
     }
     if (is_file(APP_PATH . 'build.php')) {
         // 自动化创建脚本
         Create::build(include APP_PATH . 'build.php');
     }
     // 监听app_init
     Hook::listen('app_init');
     // 初始化公共模块
     self::initModule(APP_PATH . $config['common_module'] . '/', $config);
     // 启动session
     if ($config['use_session']) {
         Session::init($config['session']);
     }
     // 应用URL调度
     self::dispatch($config);
     // 监听app_run
     Hook::listen('app_run');
     // 执行操作
     if (!preg_match('/^[A-Za-z](\\/|\\w)*$/', CONTROLLER_NAME)) {
         // 安全检测
         $instance = false;
     } elseif ($config['action_bind_class']) {
         // 操作绑定到类:模块\controller\控制器\操作
         if (is_dir(MODULE_PATH . CONTROLLER_LAYER . '/' . CONTROLLER_NAME)) {
             $namespace = MODULE_NAME . '\\' . CONTROLLER_LAYER . '\\' . CONTROLLER_NAME . '\\';
         } else {
             // 空控制器
             $namespace = MODULE_NAME . '\\' . CONTROLLER_LAYER . '\\' . $config['empty_controller'] . '\\';
         }
         $actionName = strtolower(ACTION_NAME);
         if (class_exists($namespace . $actionName)) {
             $class = $namespace . $actionName;
         } elseif (class_exists($namespace . '_empty')) {
             // 空操作
             $class = $namespace . '_empty';
         } else {
             throw new Exception('_ERROR_ACTION_:' . ACTION_NAME);
         }
         $instance = new $class();
         // 操作绑定到类后 固定执行run入口
         $action = 'run';
     } else {
         $instance = Loader::controller(CONTROLLER_NAME, '', $config['empty_controller']);
         // 获取当前操作名
         $action = ACTION_NAME . $config['action_suffix'];
     }
     if (!$instance) {
         throw new Exception('[ ' . MODULE_NAME . '\\' . CONTROLLER_LAYER . '\\' . Loader::parseName(CONTROLLER_NAME, 1) . ' ] not exists');
     }
     try {
         // 操作方法开始监听
         $call = [$instance, $action];
         Hook::listen('action_begin', $call);
         if (!preg_match('/^[A-Za-z](\\w)*$/', $action)) {
             // 非法操作
             throw new \ReflectionException();
         }
         //执行当前操作
         $method = new \ReflectionMethod($instance, $action);
         if ($method->isPublic()) {
             // URL参数绑定检测
             if ($config['url_params_bind'] && $method->getNumberOfParameters() > 0) {
                 switch ($_SERVER['REQUEST_METHOD']) {
                     case 'POST':
                         $vars = array_merge($_GET, $_POST);
                         break;
                     case 'PUT':
                         parse_str(file_get_contents('php://input'), $vars);
                         break;
                     default:
                         $vars = $_GET;
                 }
                 $params = $method->getParameters();
                 $paramsBindType = $config['url_parmas_bind_type'];
                 foreach ($params as $param) {
                     $name = $param->getName();
                     if (1 == $paramsBindType && !empty($vars)) {
                         $args[] = array_shift($vars);
                     }
                     if (0 == $paramsBindType && isset($vars[$name])) {
                         $args[] = $vars[$name];
                     } elseif ($param->isDefaultValueAvailable()) {
                         $args[] = $param->getDefaultValue();
//.........这里部分代码省略.........
开发者ID:OHOM,项目名称:think,代码行数:101,代码来源:app.php

示例13: module

 private static function module($result, $config)
 {
     if (APP_MULTI_MODULE) {
         // 多模块部署
         $module = strtolower($result[0] ?: $config['default_module']);
         if ($maps = $config['url_module_map']) {
             if (isset($maps[$module])) {
                 // 记录当前别名
                 define('MODULE_ALIAS', $module);
                 // 获取实际的项目名
                 $module = $maps[MODULE_ALIAS];
             } elseif (array_search($module, $maps)) {
                 // 禁止访问原始项目
                 $module = '';
             }
         }
         // 获取模块名称
         define('MODULE_NAME', strip_tags($module));
         // 模块初始化
         if (MODULE_NAME && !in_array(MODULE_NAME, $config['deny_module_list']) && is_dir(APP_PATH . MODULE_NAME)) {
             APP_HOOK && Hook::listen('app_begin');
             define('MODULE_PATH', APP_PATH . MODULE_NAME . DS);
             define('VIEW_PATH', MODULE_PATH . VIEW_LAYER . DS);
             // 初始化模块
             self::initModule(MODULE_NAME, $config);
         } else {
             throw new Exception('module [ ' . MODULE_NAME . ' ] not exists ', 10005);
         }
     } else {
         // 单一模块部署
         define('MODULE_NAME', '');
         define('MODULE_PATH', APP_PATH);
         define('VIEW_PATH', MODULE_PATH . VIEW_LAYER . DS);
     }
     // 获取控制器名
     define('CONTROLLER_NAME', strtolower(strip_tags($result[1] ?: Config::get('default_controller'))));
     // 获取操作名
     define('ACTION_NAME', strtolower(strip_tags($result[2] ?: Config::get('default_action'))));
     // 执行操作
     if (!preg_match('/^[A-Za-z](\\/|\\.|\\w)*$/', CONTROLLER_NAME)) {
         // 安全检测
         throw new Exception('illegal controller name:' . CONTROLLER_NAME, 10000);
     }
     if (Config::get('action_bind_class')) {
         $class = self::bindActionClass(Config::get('empty_controller'));
         $instance = new $class();
         // 操作绑定到类后 固定执行run入口
         $action = 'run';
     } else {
         $instance = Loader::controller(CONTROLLER_NAME, '', Config::get('empty_controller'));
         // 获取当前操作名
         $action = ACTION_NAME . Config::get('action_suffix');
     }
     try {
         // 操作方法开始监听
         $call = [$instance, $action];
         APP_HOOK && Hook::listen('action_begin', $call);
         if (!preg_match('/^[A-Za-z](\\w)*$/', $action)) {
             // 非法操作
             throw new \ReflectionException();
         }
         // 执行操作方法
         $data = self::invokeMethod($call);
     } catch (\ReflectionException $e) {
         // 操作不存在
         if (method_exists($instance, '_empty')) {
             $method = new \ReflectionMethod($instance, '_empty');
             $data = $method->invokeArgs($instance, [$action, '']);
         } else {
             throw new Exception('method [ ' . (new \ReflectionClass($instance))->getName() . '->' . $action . ' ] not exists ', 10002);
         }
     }
     return $data;
 }
开发者ID:pangbob,项目名称:think,代码行数:74,代码来源:App.php

示例14: getInstance

	public function getInstance() {		
		if ($this->instance->cacheBlockRecord() && is_object($this->instance->getBlockControllerData())) {
			$this->instance->__construct();
		} else {
			$this->instance = Loader::controller($this);
		}		
		return $this->instance;
	}
开发者ID:nveid,项目名称:concrete5,代码行数:8,代码来源:block.php

示例15: on_start

 public function on_start()
 {
     $this->error = Loader::helper('validation/error');
     $cnt = Loader::controller('/upgrade');
     $cnt->secCheck();
 }
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:6,代码来源:update.php


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