예제 #1
0
 public function prepare($statement, $options = array())
 {
     if (EE::get('env') == 'dev' || isset($_COOKIE['mysql_dev'])) {
         return new db_query_wrapper($this, $statement, $options);
     }
     return $this->pdo_prepare($statement, $options);
 }
예제 #2
0
 public function testVariableDelete()
 {
     $this->assertSame('oof', EE::get('foo'));
     $this->assertTrue(EE::un_set('foo'));
     $this->assertNull(EE::get('foo'));
     $this->assertFalse(EE::un_set('cat', 'dog', 'x'));
     $this->assertTrue(EE::un_set('x', 'y'));
     $this->assertTrue(EE::un_set('x'));
 }
예제 #3
0
 public static function start()
 {
     if (!self::$started) {
         $session_config = EE::is_set('_config', 'session') ? EE::get('_config', 'session') : array();
         if (sizeof($session_config)) {
             foreach ($session_config as $key => $value) {
                 ini_set('session.' . $key, $value);
             }
         }
         session_start();
         self::$started = true;
     }
 }
예제 #4
0
 public static function load($locale = null)
 {
     self::$translations = array();
     if (!$locale && EE::is_set('_config', 'locale')) {
         $locale = EE::get('_config', 'locale');
     }
     if ($locale) {
         $file = EE::get('_dir') . '/' . EE::APP_TRANSLATIONS_DIR . '/' . $locale . '.php';
         if (file_exists($file)) {
             self::$translations = (require $file);
             return true;
         }
     }
     return false;
 }
예제 #5
0
 public function testWithBasePath()
 {
     $config = array();
     $routes = array('base_path' => '/testing', 'routes' => array('/another/:num' => array('controller' => 'test', 'action' => 'another'), '/custom/(.+?)/(.+?)' => array('controller' => 'test', 'action' => 'custom'), '/something/:any' => array('controller' => 'test', 'action' => 'something'), '/:any' => array('controller' => 'test')));
     EE::init($config, $routes);
     $this->assertSame($routes, EE::get('_routes'));
     // Default index route
     $this->assertSame('index', EE::load_page(false, '/testing/'));
     // Auto mapped route
     $this->assertSame('foobarbaz', EE::load_page(false, '/testing/foobar'));
     // Not existing route
     $this->assertSame('Not Found', EE::load_page(false, '/testing/non_existing_url'));
     // Mapped route
     $this->assertSame('something', EE::load_page(false, '/testing/something'));
     // Dynamic Mapped route
     $this->assertSame('another ', EE::load_page(false, '/testing/another/'));
     // Dynamic Mapped route
     $this->assertSame('another 2', EE::load_page(false, '/testing/another/2'));
     // Custom route
     $this->assertSame('regex-here', EE::load_page(false, '/testing/custom/regex/here'));
 }
예제 #6
0
파일: ee.php 프로젝트: kokareff/easyembed
 public static function view($name, $args = null)
 {
     $global_args = EE::get();
     if (is_array($args) && sizeof($args)) {
         $global_args = array_merge($global_args, $args);
     }
     extract($global_args);
     require self::$dir . '/' . self::APP_VIEWS_DIR . '/' . $name . '_view.php';
 }