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


PHP Path::instance方法代码示例

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


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

示例1: getInstance

 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:gingifruden,项目名称:salty-lighty,代码行数:7,代码来源:Path.php

示例2: __construct

 public function __construct()
 {
     parent::__construct(\Path::instance()->currentProject('etc.conf.@database.xml'));
     $this->collection = new \DB\Config();
     $config = $this->dom;
     $connection_nodes = $config->getElementsByTagNameNS('http://lab.zigmoyd.net/xmlns/bong', 'connection');
     $connections = array();
     foreach ($connection_nodes as $connection_node) {
         /*{ Connection attributes*/
         $name = $connection_node->getAttribute('name');
         $dsn = $connection_node->getAttribute('dsn');
         $user = $connection_node->getAttribute('user');
         $pass = $connection_node->getAttribute('pass');
         $connection = new \DB\Connection($name, $dsn, $user, $pass);
         /*}*/
         /*{ PDO Params*/
         $params = array();
         $param_nodes = $connection_node->getElementsByTagNameNS('http://lab.zigmoyd.net/xmlns/bong', 'param');
         foreach ($param_nodes as $param_node) {
             $name = $param_node->getAttribute('name');
             $value = $param_node->getAttribute('value');
             $param = new \DB\ConnectionParam($name, $value);
             $connection->addParam($param);
         }
         /*}*/
         $this->collection->addConnection($connection);
     }
     $model_nodes = $config->getElementsByTagNameNS('http://lab.zigmoyd.net/xmlns/bong', 'model');
     $model_node = $model_nodes->item(0);
     $default_connection = $model_node->getAttribute('default');
     $autoconnect = constant($model_node->getAttribute('autoconnect'));
     $this->collection->setDefault($default_connection);
     $this->collection->setAutoconnect($autoconnect);
     //echo ">> DatabaseConfig::__construct()\n";
 }
开发者ID:neel,项目名称:bong,代码行数:35,代码来源:DatabaseConfig.php

示例3: _createFromReflection

 /**
  * @load
  * @param ReflectionMethod $reflection
  */
 protected function _createFromReflection($reflection)
 {
     $this->_type = Method::SpiritMethod;
     parent::_createFromReflection($reflection);
     //{ Add Views
     if ($this->isPublic()) {
         $viewPath = \Path::instance()->evaluate(':' . $this->controller()->project()->name() . '.*' . $this->controller()->name() . '.view.-' . $this->name());
         if (file_exists($viewPath)) {
             $dh = opendir($viewPath);
             $viewsFound = array();
             while (false !== ($file = readdir($dh))) {
                 if ($file != "." && $file != ".." && strtolower(pathinfo($file, PATHINFO_EXTENSION)) == 'php') {
                     $viewFilePath = rtrim($viewPath, '/') . "/{$file}";
                     $viewsFound[$file] = $viewFilePath;
                     $this->addView(SpiritView::create($this, pathinfo($file, PATHINFO_FILENAME)));
                 }
             }
             closedir($dh);
             if (array_key_exists('view.php', $viewsFound)) {
                 $this->setHasDefaultView();
             }
         }
     }
     //}
 }
开发者ID:neel,项目名称:bong,代码行数:29,代码来源:SpiritMethod.php

示例4: go_to

 public static function go_to($url)
 {
     if (!isset(self::$instance)) {
         self::$instance = new self();
     }
     return self::$root_path . $url;
 }
开发者ID:nakedwarrior,项目名称:NakedMVC,代码行数:7,代码来源:path.php

示例5: _createFromReflection

 private function _createFromReflection($projectName)
 {
     $this->_name = $projectName;
     $this->_dir = \Fstab::instance()->projectDirectory($projectName);
     $controllerBasePath = rtrim(\Path::instance()->evaluate(":{$this->_name}.apps.controller"), "/\\");
     foreach (glob($controllerBasePath . "/*.php") as $filePath) {
         $fileName = pathinfo($filePath, PATHINFO_FILENAME);
         $controllerClassName = $fileName . 'Controller';
         if (!class_exists($controllerClassName)) {
             require $filePath;
         }
         if (class_exists($controllerClassName)) {
             $reflection = new \ReflectionClass($controllerClassName);
             $this->_controllers[] = AppController::create($this, $reflection);
         }
     }
     $spiritBasePath = rtrim(\Path::instance()->evaluate(":{$this->_name}.spiritPath"), "/\\");
     foreach (glob($spiritBasePath . "/*", GLOB_ONLYDIR) as $dirName) {
         $spiritName = pathinfo($dirName, PATHINFO_FILENAME);
         $spiritFileName = rtrim($dirName, "/\\") . '/abstractor.php';
         $spiritAbstractorClassName = $spiritName . 'Abstractor';
         if (!class_exists($spiritAbstractorClassName) && file_exists($spiritFileName)) {
             require $spiritFileName;
         }
         if (class_exists($spiritAbstractorClassName)) {
             $reflection = new \ReflectionClass($spiritAbstractorClassName);
             $this->_spirits[] = SpiritController::create($this, $reflection);
         }
     }
 }
开发者ID:neel,项目名称:bong,代码行数:30,代码来源:Project.php

示例6: run

 public function run()
 {
     $fsm = \FSM\Engine::parse('site');
     $path = Path::instance()->evaluate('common') . '/fsm.php';
     ob_start();
     require $path;
     $this->responseBuffer = ob_get_contents();
     ob_end_clean();
 }
开发者ID:neel,项目名称:bong,代码行数:9,代码来源:FSMEngine.php

示例7: __construct

 public function __construct($controllerName)
 {
     $controllerPath = Path::instance()->currentProject("apps.+&{$controllerName}.@&{$controllerName}.php");
     parent::__construct($controllerPath);
     $this->registerParam(new BongExceptionParam("controllerName", "controller Name", true));
     $this->registerParam(new BongExceptionParam("controllerPath", "controller Path", true));
     $this->setParam("controllerName", $controllerName);
     $this->setParam("controllerPath", $controllerPath);
 }
开发者ID:neel,项目名称:bong,代码行数:9,代码来源:ControllerNotReadableException.php

示例8: genParams

 public function genParams()
 {
     if (!$this->_params) {
         $viewPath = \Path::instance()->evaluate(':' . $this->project()->name() . ".apps.layout.+{$this->name()}.@params.php");
         $this->_params = Params::create($viewPath . '/params.php');
         return $this->_params->generate();
     }
     return false;
 }
开发者ID:neel,项目名称:bong,代码行数:9,代码来源:AppController.php

示例9: genParams

 public function genParams()
 {
     if (!$this->_hasParams) {
         $viewPath = \Path::instance()->evaluate(':' . $this->controller()->project()->name() . '.apps.view.+' . $this->controller()->name() . '.-' . $this->name());
         $this->_params = Params::create($viewPath . '/params.php');
         $this->setHasParams();
         return $this->_params->generate();
     }
     return false;
 }
开发者ID:neel,项目名称:bong,代码行数:10,代码来源:ControllerMethod.php

示例10: __construct

 public function __construct($controllerName, $controllerPath = null)
 {
     if (!$controllerPath) {
         $controllerPath = Path::instance()->currentProject("apps.+&{$controllerName}.@&{$controllerName}.php");
     }
     if (!$controllerPath) {
         !($controllerPath = 'Unknown/could/not/determine/path');
     }
     parent::__construct($controllerPath);
     $this->registerParam(new BongExceptionParam("controllerName", "controller Name", true));
     $this->registerParam(new BongExceptionParam("controllerPath", "controller Path", true));
     $this->setParam("controllerName", $controllerName);
     $this->setParam("controllerPath", $controllerPath);
 }
开发者ID:neel,项目名称:bong,代码行数:14,代码来源:ControllerNotFoundException.php

示例11: createProject

 public function createProject($projectName, $projectDir)
 {
     ControllerTray::instance()->renderLayout = false;
     $this->data->success = false;
     $this->data->projectName = $projectName;
     if (!\Fstab::instance()->addProject($projectName, $projectDir)) {
         return false;
     }
     \Fstab::instance()->save();
     $commonProject = \Path::instance()->evaluate("common.template.prj");
     $projectPath = \Path::instance()->evaluate(":{$projectName}.root") . "{$projectDir}";
     if (!is_dir($projectPath)) {
         if (!recurse_copy($commonProject, $projectPath)) {
             $this->data->success = false;
         } else {
             $this->data->success = true;
         }
     }
 }
开发者ID:neel,项目名称:bong,代码行数:19,代码来源:project.php

示例12: module

 public function module($moduleName)
 {
     $modulePath = Path::instance()->evaluate('lib.module');
     if (file_exists($modulePath . "/{$moduleName}") && is_dir($modulePath . "/{$moduleName}")) {
         if (file_exists($modulePath . "/{$moduleName}/{$moduleName}.xml")) {
             if (is_readable($modulePath . "/{$moduleName}/{$moduleName}.xml")) {
                 foreach (ModuleConf::instance()->dependencies() as $dep) {
                     Loader::instance()->module($dep);
                 }
                 foreach (ModuleConf::instance()->includes() as $inc) {
                     Loader::instance()->inc($modulePath . "/{$moduleName}/" . trim($inc, '/'));
                 }
             } else {
                 return -2;
             }
         } else {
             return -1;
         }
     }
     return 0;
 }
开发者ID:neel,项目名称:bong,代码行数:21,代码来源:loader.php

示例13: _createFromReflection

 /**
  * @load
  * @param ReflectionMethod $reflection
  */
 private function _createFromReflection($reflection)
 {
     $this->_name = $reflection->getName();
     $this->_public = $reflection->isPublic();
     $this->_inherited = !($reflection->getDeclaringClass()->getName() == $this->_controller->className());
     foreach ($reflection->getParameters() as $paramReflection) {
         //Argument::create($this, $paramReflection);
         $this->addArgument(Argument::create($this, $paramReflection));
     }
     //{ Add Views
     if ($this->isAction()) {
         $viewPath = \Path::instance()->evaluate(':' . $this->controller()->project()->name() . '.apps.view.+' . $this->controller()->name() . '.-' . $this->name());
         if (file_exists($viewPath)) {
             $this->setViewDirectoryCreated();
             $dh = opendir($viewPath);
             $viewsFound = array();
             while (false !== ($file = readdir($dh))) {
                 if ($file != "." && $file != ".." && strtolower(pathinfo($file, PATHINFO_EXTENSION)) == 'php') {
                     $viewFilePath = rtrim($viewPath, '/') . "/{$file}";
                     if ($file == 'layout.php') {
                         $this->setHasLayout();
                     } else {
                         if ($file == 'params.php') {
                             $this->setHasParams();
                         } else {
                             $viewsFound[$file] = $viewFilePath;
                             $this->addView(ControllerView::create($this, pathinfo($file, PATHINFO_FILENAME)));
                         }
                     }
                 }
             }
             closedir($dh);
             if (array_key_exists('view.php', $viewsFound)) {
                 $this->setHasDefaultView();
             }
         }
     }
     //}
 }
开发者ID:neel,项目名称:bong,代码行数:43,代码来源:Method.php

示例14: _basePath

 private static function _basePath()
 {
     return rtrim(Path::instance()->currentProject('keys'), "/");
 }
开发者ID:neel,项目名称:bong,代码行数:4,代码来源:secure.php

示例15: controller

 private function controller()
 {
     $controllerPath = Path::instance()->currentProject('apps.+&controller.@&controller.php');
     if (!$controllerPath || !file_exists($controllerPath)) {
         throw new ControllerNotFoundException(MemPool::instance()->get('bong.mvc.controller'), $controllerPath);
     } else {
         if (is_readable($controllerPath)) {
             return $controllerPath;
         } else {
             throw new ControllerNotReadableException(MemPool::instance()->get('bong.mvc.controller'));
         }
     }
 }
开发者ID:neel,项目名称:bong,代码行数:13,代码来源:MVCEngine.php


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