getClassName() static public method

static public getClassName ( $fullName )
 /**
  * Import and (as required) initialize helpers for use in the view.
  * Helper is the path and name of a class as used by Library::import().
  * For multiple helpers, pass a single array of helpers or use multiple arguments.
  * 
  * @param $helper
  */
 public function loadHelper($helper)
 {
     $helpers = is_array($helper) ? $helper : func_get_args();
     foreach ($helpers as $helper) {
         Library::import($helper);
         $init = array(Library::getClassName($helper), 'init');
         if (is_callable($init)) {
             call_user_func($init, $this);
         }
     }
 }
Beispiel #2
0
 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();
 }
Beispiel #3
0
 function __construct(Route $route)
 {
     $this->c = Library::getClassName($route->class);
     $this->f = $route->function;
     $this->a = $route->app;
 }
Beispiel #4
0
 protected function getControllerFromRouteResult(Request $request, RoutingResult $routeResult)
 {
     $request->meta->app = $routeResult->route->app;
     $request->meta->controllerMethod = $routeResult->route->function;
     $request->meta->controllerMethodArguments = $routeResult->arguments;
     $request->meta->useAssociativeArguments = true;
     $controllerClass = $routeResult->route->class;
     Library::import($controllerClass);
     $controllerClass = Library::getClassName($controllerClass);
     $controller = new $controllerClass($routeResult->route->app);
     $request->meta->controller = $controller;
     return $controller;
 }
Beispiel #5
0
$methods = $routingNode->getMethods();
if (!empty($methods)) {
    foreach ($methods as $method => $rt) {
        $route = $rt->toRoute();
        ?>
		<tr>
		<td><?php 
        echo $method;
        ?>
</td>
		<td><?php 
        echo $fullPath;
        ?>
</td>
		<td><?php 
        echo Html::anchor(Url::action('RecessToolsCodeController::classInfo', $route->class), Library::getClassName($route->class));
        ?>
</td>
		<td><?php 
        echo Html::anchor(Url::action('RecessToolsCodeController::classInfo', $route->class) . '#method_' . $route->function, $route->function);
        ?>
</td>
		</tr>
	<?php 
    }
}
if (!empty($staticPaths) || !empty($parametricPaths)) {
    ksort($staticPaths);
    ksort($parametricPaths);
    foreach ($staticPaths as $path => $node) {
        Part::draw('routes/rows', $node, $fullPath . '/' . $path, $omit);
 /** !Route GET, class/$fullyQualifiedModel/create */
 function createTable($fullyQualifiedModel)
 {
     if (!Library::classExists($fullyQualifiedModel)) {
         return new NotFoundResponse($this->request);
     }
     $class = Library::getClassName($fullyQualifiedModel);
     Model::createTableFor($class);
 }