Esempio n. 1
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'));
 }
Esempio n. 2
0
 public function __call($method, $args)
 {
     if (!EE::is_set('pdo_query_logger')) {
         EE::set('pdo_query_logger', array());
     }
     if ($method == 'execute') {
         EE::set('pdo_query_logger', md5($this->statement), array('statement' => $this->statement, 'args' => isset($args[0]) ? $args[0] : array(), 'sql' => self::params($this->statement, $args[0])));
     }
     return call_user_func_array(array($this->res, $method), $args);
 }
Esempio n. 3
0
 public function testBasePathRouting()
 {
     $routes = array('base_path' => '/testing', 'routes' => array('/another/:num' => array('controller' => 'test', 'action' => 'another'), '/something' => array('controller' => 'test', 'action' => 'something'), '/something/:any' => array('controller' => 'test', 'action' => 'something'), '/custom/(.+?)/(.+?)' => array('controller' => 'test', 'action' => 'custom'), '/:any' => array('controller' => 'test')));
     //$this -> assertSame ( null, null, EE::route ( '/', $routes ) );
     $this->assertSame(array(array('controller' => 'test'), array('/testing/')), EE::route('/testing/', $routes));
     $this->assertSame(array(array('controller' => 'test'), array('/testing/here/I/come', 'here/I/come')), EE::route('/testing/here/I/come', $routes));
     $this->assertSame(array(array('controller' => 'test', 'action' => 'something'), null), EE::route('/testing/something', $routes));
     $this->assertSame(array(array('controller' => 'test', 'action' => 'something'), array('/testing/something/is', 'is')), EE::route('/testing/something/is', $routes));
     $this->assertSame(array(array('controller' => 'test', 'action' => 'something'), array('/testing/something/is/here', 'is/here')), EE::route('/testing/something/is/here', $routes));
     $this->assertSame(array(array('controller' => 'test', 'action' => 'another'), array('/testing/another/20', '20')), EE::route('/testing/another/20', $routes));
     $this->assertSame(array(array('controller' => 'test'), array('/testing/another/not_number', 'another/not_number')), EE::route('/testing/another/not_number', $routes));
     $this->assertSame(array(array('controller' => 'test', 'action' => 'custom'), array('/testing/custom/regex/here', 'regex', 'here')), EE::route('/testing/custom/regex/here', $routes));
 }
Esempio n. 4
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;
     }
 }
Esempio n. 5
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;
 }
Esempio n. 6
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'));
 }
Esempio n. 7
0
 function __construct()
 {
     echo 'MAKING E';
     parent::__construct();
 }
Esempio n. 8
0
<html>
    <head>
        <meta charset="utf-8" />
        <title><?php 
echo locale::translate('title');
?>
</title>
    </head>
    <body>
        <?php 
if (isset($__page)) {
    EE::view($__page);
}
?>
    </body>
</html>
Esempio n. 9
0
 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';
 }
Esempio n. 10
0
 public function custom_bar_action($path)
 {
     $id = isset($path[0]) ? $path[0] : null;
     EE::set('id', $id);
     $this->load_view('bar');
 }
Esempio n. 11
0
<?php

// Bootstrap file
// Require main framework class
require dirname(__FILE__) . '/ee.php';
// Initialize and load configs/routes
EE::init();
// Load and execute page
EE::load_page();