/** * print information about this application * * @param array $params */ public function action_info($params) { $app = \ClanCats::runtime(); // print the app name $this->line(\CCForge_Php::make('comment', $app::$name . PHP_EOL . "*" . PHP_EOL . "Running on ClanCatsFramework " . \ClanCats::VERSION . PHP_EOL . "© 2010 - " . date('Y') . " ClanCats GmbH" . PHP_EOL), 'cyan'); // list printer $list = function ($array) { foreach ($array as $key => $value) { $this->line($key . ': ' . CCCli::color($value, 'green')); } }; // print info $list(array('Runtime Class' => $app, 'CCF Version' => \ClanCats::version(), 'CCF Environment' => \ClanCats::environment(), 'Development env' => var_export(\ClanCats::in_development(), true), 'File extention' => EXT, 'Core namespace' => CCCORE_NAMESPACE)); // paths $this->line(PHP_EOL . "Paths", 'cyan'); $list(\ClanCats::paths()); // paths $this->line(PHP_EOL . "Directories", 'cyan'); $list(\ClanCats::directories()); // autoloader $this->line(PHP_EOL . "Autoloader - namespaces", 'cyan'); $list(\CCFinder::$namespaces); }
/** * the index function is just "function <controller_name>Index() {}" */ public function action_index() { $this->theme->topic = "Willkommen"; $this->view = $this->theme->view('welcome', array('runtime_name' => ClanCats::runtime('name'), 'environment' => ClanCats::environment())); }
/** * Test CC environment */ public function testEnvironment() { $this->assertEquals('phpunit', \ClanCats::environment()); }
/** * start the ccf lifecycle * * this method sets the current environment, loads the configuration * and wakes the application * * @param string $environment * @return void */ public static function wake($environment) { if (!is_null(static::$environment)) { throw new CCException("ClanCats::wake - you cannot wake the application twice."); } // set environment static::$environment = $environment; // load the main configuration static::$config = CCConfig::create('main'); // setup the application error tables CCError_Inspector::info_callback('ClanCatsFramework', function () { return array('Runtime Class' => \ClanCats::runtime(), 'CCF Version' => \ClanCats::version(), 'CCF Environment' => \ClanCats::environment(), 'Development env' => var_export(\ClanCats::in_development(), true), 'File extention' => EXT, 'Core namespace' => CCCORE_NAMESPACE); }); CCError_Inspector::info_callback('CCF Paths', array('ClanCats', 'paths')); CCError_Inspector::info_callback('CCF Directories', array('ClanCats', 'directories')); CCError_Inspector::info_callback('Namespaces', function () { return \CCFinder::$namespaces; }); }
</div> <div class="form-group"> <label for="input-subject">Subject</label> <input name="subject" type="text" class="form-control" id="input-subject" value="Dev Mail Sandbox" placeholder="E-Mail"> </div> <div class="form-group"> <label for="input-from_name">Message</label> <textarea name="message" class="form-control" rows="3"></textarea> </div> <div class="checkbox"> <label> <input value="1" name="plaintext" type="checkbox"> Plaintext? </label> </div> <button type="submit" class="btn btn-primary">Send</button> </form> </div> <div class="col-md-6"> <h4>Enirnoment <small><?php echo ClanCats::environment(); ?> </small></h4> <pre style="overflow: auto; overflow-x:scroll;white-space: nowrap;"><?php echo $config_dump; ?> </pre> </div> </div>
/** * generates a path for a config name * * @param string $name * @param bool $env */ protected function path($name, $env = false) { $conf = CCPath::get($name, \CCDIR_CONFIG, static::EXT); if (!$env) { return $conf; } $env_conf = CCPath::get($name, \CCDIR_CONFIG . ClanCats::environment() . '/', static::EXT); if (file_exists($env_conf)) { return $env_conf; } return $conf; }