Exemple #1
0
 /**
  * Run The Filter
  *
  * @return void
  */
 public function run()
 {
     $environment = App::getInstance()->environment();
     if ($environment != 'dev') {
         $this->response->send404();
     }
 }
Exemple #2
0
 /**
  * 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;
     }
 }
Exemple #3
0
 /**
  * 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;
 }
Exemple #4
0
 public function test_app_can_return_instance()
 {
     $this->assertInstanceOf('Peon\\Application\\App', App::getInstance());
 }
Exemple #5
0
 /**
  * Create A New Controller
  */
 public function __construct()
 {
     $this->app = App::getInstance();
 }
Exemple #6
0
 /**
  * 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;
 }
Exemple #7
0
 public function test_connection_without_parameters()
 {
     require App::getRootPath() . '/.env';
     $pdo = new PdoBase();
     $this->assertInstanceOf('PDO', $pdo->getPdo());
 }