function test_remote() { $api = new ApiCLI('test'); $api->setConfig('url_prefix', ''); $api->setConfig('url_postfix', '.yey'); $api->add('Controller_PageManager')->setURL('http://yahoo.com/admin/'); return $api->url('http://google.com/xx')->absolute(); }
/** Redefine this function instead of default constructor */ function init() { $this->getLogger(); // Verify Licensing $this->licenseCheck('atk4'); // send headers, no caching $this->sendHeaders(); $this->cleanMagicQuotes(); parent::init(); /** In addition to default initialization, set up logger and template */ $this->initializeTemplate(); if (get_class($this) == 'ApiWeb') { $this->setConfig(array('url_postfix' => '.php', 'url_prefix' => '')); } }
/** Redifine this function instead of default constructor */ function init() { // Do not initialize unless requsetd //$this->initializeSession(); // find out which page is to display //$this->calculatePageName(); $this->add('PageManager'); // send headers, no caching $this->sendHeaders(); parent::init(); /** In addition to default initialization, set up logger and template */ $this->getLogger(); $this->initializeTemplate(); if (get_class($this) == 'ApiWeb') { $this->setConfig(array('url_postfix' => '.php', 'url_prefix' => '')); } }
function initDefaults() { ApiCLI::initDefaults(); // DTP constant checked if (strpos($_GET['page'], ';') !== false) { list($namespace, $_GET['page']) = explode(';', $_GET['page']); if (!isset($this->namespaces[$namespace])) { throw new BaseException('Specified namespace (' . $namespace . ') can\'t be found'); // it's also } $this->ns = $this->namespaces[$namespace]; $this->ns->initLayout(); } else { // do nothing! //$this->initLayout(); } }
require'../lib/AbstractController.php'; require'../lib/Model.php'; require'../lib/Controller/Data.php'; require'../lib/Controller/Data/Array.php'; require'../lib/Dummy.php'; require'../lib/BaseException.php'; require'../lib/Exception/Logic.php'; require'../lib/Exception/InitError.php'; require'../lib/Exception/Hook.php'; require'../lib/Exception/ForUser.php'; require'../lib/PathFinder.php'; require'../lib/ApiCLI.php'; require'../lib/Page.php'; require'../lib/Page/Tester.php'; */ $api = new ApiCLI('sample_project'); $tests = $api->add('Model_AgileTest'); $result = 'OK'; foreach ($tests as $row) { foreach ($row as $key => $val) { if ($key == 'name') { $val = str_pad($val, 10); } if ($key == 'failures') { continue; } echo "{$key}: {$val}\t"; } if ($row['fail']) { $result = 'FAIL'; }
function test_add9_hook($t) { $result = "FAIL"; $app = new ApiCLI(); $app->addHook('beforeObjectInit', function () use(&$result) { $result = "OK"; }); $t = $app->add('MyObject'); return $result; }