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


PHP Library::classExists方法代码示例

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


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

示例1: instantiateProvider

 /**
  * Locate the pdo driver specific data source provider, instantiate, and return.
  * Throws ProviderDoesNotExistException for a pdo driver without a Recess provider.
  *
  * @return IPdoDataSourceProvider
  */
 protected function instantiateProvider()
 {
     $driver = ucfirst(parent::getAttribute(PDO::ATTR_DRIVER_NAME));
     $providerClass = $driver . self::PROVIDER_CLASS_SUFFIX;
     $providerFullyQualified = self::PROVIDER_CLASS_LOCATION . $providerClass;
     // Library::import($providerFullyQualified);
     if (Library::classExists($providerFullyQualified)) {
         $provider = new $providerClass();
         $provider->init($this);
         return $provider;
     } else {
         throw new ProviderDoesNotExistException($providerClass, get_defined_vars());
     }
 }
开发者ID:rday,项目名称:recess,代码行数:20,代码来源:PdoDataSource.class.php

示例2: addRoutesToRouter

 function addRoutesToRouter(RtNode $router)
 {
     $classes = $this->listControllers();
     foreach ($classes as $class) {
         if (Library::classExists($this->controllersPrefix . $class)) {
             $instance = new $class($this);
         } else {
             continue;
         }
         if ($instance instanceof Controller) {
             $routes = Controller::getRoutes($instance);
             if (!is_array($routes)) {
                 continue;
             }
             foreach ($routes as $route) {
                 $router->addRoute($this, $route, $this->routingPrefix);
             }
         }
     }
     return $router;
 }
开发者ID:nmcteam,项目名称:recess,代码行数:21,代码来源:Application.class.php

示例3: init

 static function init()
 {
     if (self::$mode == self::PRODUCTION) {
         self::$useTurboSpeed = true;
     }
     $_ENV['dir.recess'] = self::$recessDir;
     $_ENV['dir.apps'] = self::$appsDir;
     $_ENV['dir.plugins'] = self::$pluginsDir;
     $_ENV['dir.temp'] = self::$dataDir . 'temp/';
     $_ENV['dir.test'] = self::$recessDir . 'test/';
     if (!isset($_ENV['url.assetbase'])) {
         $_ENV['url.assetbase'] = $_ENV['url.base'];
     }
     date_default_timezone_set(self::$defaultTimeZone);
     require_once $_ENV['dir.recess'] . 'recess/lang/Library.class.php';
     Library::addClassPath(self::$recessDir);
     Library::addClassPath(self::$pluginsDir);
     Library::addClassPath(self::$appsDir);
     if (self::$useTurboSpeed) {
         Library::$useNamedRuns = true;
         $cacheProvidersReversed = array_reverse(self::$cacheProviders);
         foreach ($cacheProvidersReversed as $provider) {
             $provider = $provider . 'CacheProvider';
             Cache::reportsTo(new $provider());
         }
     }
     Library::init();
     Library::beginNamedRun('recess');
     Library::import('recess.database.Databases');
     Library::import('recess.database.orm.ModelDataSource');
     if (empty(RecessConf::$defaultDatabase)) {
         $message = 'Congratulations, Recess is almost setup!<br />';
         $message .= '<strong>Next Step(s):</strong>';
         $message .= '<ul>';
         $pdoMessages = array();
         if (!extension_loaded('PDO')) {
             $pdoMessages[] = 'Install PHP\'s PDO Extension';
             $pdoMessages[] = 'Install Sqlite or MySQL PDO Driver';
         } else {
             $drivers = pdo_drivers();
             $hasMySql = in_array('mysql', $drivers);
             $hasSqlite = in_array('sqlite', $drivers);
             if (!$hasMySql && !$hasSqlite) {
                 $pdoMessages[] = 'Install Sqlite and/or MySQL PDO Driver';
             } else {
                 $databases = '';
                 if ($hasSqlite) {
                     $databases = 'Sqlite';
                 }
                 if ($hasMySql) {
                     if ($databases != '') {
                         $databases .= ', ';
                     }
                     $databases .= 'MySql';
                 }
                 $pdoMessages[] = 'You have drivers for the following databases: ' . $databases;
             }
         }
         $pdoMessages[] = 'Setup <strong>recess-conf.php</strong> to point to your database.';
         $pdoMessages[] = 'Checkout the <strong>README.textile</strong> file for instructions.';
         $pdoMessages = '<li>' . implode('</li><li>', $pdoMessages) . '</li>';
         $message .= $pdoMessages . '</ul>';
         die($message);
     }
     try {
         Databases::setDefaultSource(new ModelDataSource(RecessConf::$defaultDatabase));
     } catch (DataSourceCouldNotConnectException $e) {
         $databaseType = parse_url(RecessConf::$defaultDatabase[0], PHP_URL_SCHEME);
         if (!in_array($databaseType, pdo_drivers())) {
             $message = 'It looks like PHP could not load the driver needed to connect to <strong>' . RecessConf::$defaultDatabase[0] . '</strong><br />';
             $message .= 'Please install the <strong>' . ucfirst($databaseType) . '</strong> PDO driver and enable it in php.ini';
         } else {
             $message = 'Error connecting to data source: ' . $e->getMessage();
         }
         die($message);
     }
     if (!empty(RecessConf::$namedDatabases)) {
         foreach (RecessConf::$namedDatabases as $name => $sourceInfo) {
             Databases::addSource($name, new ModelDataSource($sourceInfo));
         }
     }
     Library::import('recess.framework.Application');
     foreach (self::$applications as $key => $app) {
         if (!Library::classExists($app)) {
             die('Application "' . $app . '" does not exist. Remove it from recess-conf.php, RecessConf::$applications array.');
         } else {
             $app = Library::getClassName($app);
             self::$applications[$key] = new $app();
         }
     }
     Library::import('recess.framework.DefaultPolicy');
     self::$policy = new DefaultPolicy();
 }
开发者ID:KrisJordan,项目名称:recess,代码行数:93,代码来源:bootstrap.php

示例4: createTable

 /** !Route GET, class/$fullyQualifiedModel/create */
 function createTable($fullyQualifiedModel)
 {
     if (!Library::classExists($fullyQualifiedModel)) {
         return new NotFoundResponse($this->request);
     }
     $class = Library::getClassName($fullyQualifiedModel);
     Model::createTableFor($class);
 }
开发者ID:amitshukla30,项目名称:recess,代码行数:9,代码来源:RecessToolsCodeController.class.php


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