/** * Run The Filter * * @return void */ public function run() { $environment = App::getInstance()->environment(); if ($environment != 'dev') { $this->response->send404(); } }
/** * Return 'active' If Segment Matches Value * * @param integer $position * @param string $value * @param mixed $default * @return mixed */ function activate_if($position, $value, $default = 'active') { $router = App::getInstance()->router; if ($router->getSegment($position) == $value) { return $default; } }
/** * Load Config File * * @return boolean */ private function loadConfigFile() { $file = App::getInstance()->getRootPath() . "/config/{$this->file}.php"; if (file_exists($file)) { $this->config = (require $file); return true; } return false; }
public function test_app_can_return_instance() { $this->assertInstanceOf('Peon\\Application\\App', App::getInstance()); }
/** * Create A New Controller */ public function __construct() { $this->app = App::getInstance(); }
/** * Radio * * @param string $label * @param string $name * @param mixed $value * @param array $options * @return void */ public static function radio($label, $name, $value = null, $options) { $session = App::getInstance()->make('session'); $errors = $session->getFlash('errors'); $hasError = isset($errors[$name]) ? ' has-error' : ''; $error = isset($errors[$name]) ? $errors[$name] : ''; $id = 'radio-' . $name; $help = 'help-' . $id; echo '<div class="form-group' . $hasError . '">' . PHP_EOL . ' <label>' . $label . '</label>' . PHP_EOL . ' <div class="radio">' . PHP_EOL; foreach ($options as $key => $option) { $checked = $value == $option ? ' checked' : ''; echo ' <label>' . PHP_EOL . ' <input type="radio" name="' . $name . '" value="' . $option . '"' . $checked . '>' . PHP_EOL . ' ' . $key . PHP_EOL . ' </label>' . PHP_EOL; } echo ' </div>' . PHP_EOL . ' <span id="' . $help . '" class="help-block">' . $error . '</span>' . PHP_EOL . '</div>' . PHP_EOL; }