public function pre() { $this->user = Authenticate::session(); if (!is_a($this->user, 'Kadmin') || $this->user->getType() != 'admin') { throw new Exception('Not Authorized', 401); } $this->targetLanguage = 'en'; C::s('LANG_DIR', realpath(ROOTDIR . '../locale/')); $this->path = C::g('LANG_DIR') . '/' . C::g('LANG_AVAILABLE', $this->targetLanguage) . '/LC_MESSAGES/'; }
/** * Init a routing algo * @param string $from URL source if not provide, Route::go will determine the good route from $_SERVER parameter * @return mixed[] */ public static function go($published = true, $lang = 'FR', $host = null) { $host = !is_string($host) ? $_SERVER['HTTP_HOST'] : $host; C::s('FULLURL', 'http://' . $host); if (array_key_exists('HTTPS', $_SERVER)) { C::s('FULLURL', 'https://' . $host); } $uri = parse_url($_SERVER['REQUEST_URI']); if (substr($uri['path'], -1) == '/') { $uri['path'] = substr($uri['path'], 0, -1); } $route = self::getRoute($host, $uri['path'], $_SERVER['REQUEST_METHOD']); if (!is_a($route, 'KLib\\Router')) { //PAGE $data = \Page::getByUrl($host, $uri['path'], $lang, $published); if (!is_a($data, 'Page') && $lang != C::g('DEFAULT_LANG')) { $data = \Page::getByUrl($host, $uri['path'], C::g('DEFAULT_LANG'), $published); } if (!is_a($data, 'Page')) { throw new \Exception('PAGE NOT FOUND', 404); } $route = new Self($data->getBaseUrl(), $uri['path'], $data->getAction(), $data->getMethod(), array_merge($_GET, array('page' => $data))); } if (!is_a($route, 'KLib\\Router')) { throw new \Exception('PAGE NOT FOUND', 404); } return BaseController::run($route->getController(), $route->getAction(), $route->getArgs()); }
<?php class C { static final function s() { print "Called class: " . get_called_class() . "\n"; } } class D extends C { public function m() { $this->s(); } } $d = new D(); $d->m(); C::s(); $c = new C(); $c->s(); get_called_class(); D::m();
<?php C::s('HTMLCONTROLLER_DEFAULT_META', array('Content-type' => array('charset' => 'utf-8'), 'robots' => array('name' => 'robots', 'content' => 'index,follow'), 'google' => array('name' => 'google', 'content' => 'notranslate'), 'googlebot' => array('name' => 'googlebot', 'content' => 'index'), 'og:title' => array('name' => 'og:locale', 'content' => 'Korona'), 'og:locale' => array('name' => 'og:locale', 'content' => 'fr_FR'), 'og:type' => array('name' => 'og:type', 'content' => 'article'), 'og:url' => array('name' => 'og:locale', 'content' => 'https://github.com/monkeytie/korona'), 'og:url' => array('name' => 'og:image', 'content' => 'https://github.com/monkeytie/korona/blob/master/static/img/logo.png?raw=true'), 'og:site_name' => array('name' => 'og:site_name', 'content' => 'Korona'), 'twitter:card' => array('name' => 'twitter:card', 'content' => 'summary'), 'twitter:site' => array('name' => 'twitter:site', 'content' => '@MtKorona'), 'twitter:domain' => array('name' => 'twitter:domain', 'content' => 'Korona'), 'twitter:creator' => array('name' => 'twitter:creator', 'content' => '@MtKorona')));
<?php C::s('HTMLCONTROLLER_DEFAULT_CSS', array('static/test.css')); C::s('HTMLCONTROLLER_DEFAULT_JS', array('static/test.js')); C::s('HTMLCONTROLLER_DEFAULT_META', array('Content-type' => array('charset' => 'utf-8'), 'robots' => array('name' => 'robots', 'content' => 'index,follow'), 'google' => array('name' => 'google', 'content' => 'notranslate'), 'googlebot' => array('name' => 'googlebot', 'content' => 'index'), 'og:locale' => array('property' => 'og:locale', 'content' => 'fr_FR'), 'og:type' => array('property' => 'og:type', 'content' => 'article'), 'og:site_name' => array('property' => 'og:site_name', 'content' => 'Monkey tie recrutement affinitaire'), 'article:publisher' => array('property' => 'article:publisher', 'content' => 'https://www.facebook.com/MonkeyTie'), 'twitter:card' => array('name' => 'twitter:card', 'content' => 'summary'), 'twitter:site' => array('name' => 'twitter:site', 'content' => '@Monkey_Tie'), 'twitter:domain' => array('name' => 'twitter:domain', 'content' => 'Monkey tie recrutement affinitaire'), 'twitter:creator' => array('name' => 'twitter:creator', 'content' => '@Monkey_Tie')));
<?php require_once __DIR__ . '/error.ctrl.php'; require_once __DIR__ . '/default.ctrl.php'; require_once __DIR__ . '/page.ctrl.php'; require_once __DIR__ . '/kadmin.ctrl.php'; require_once __DIR__ . '/list.ctrl.php'; require_once __DIR__ . '/menu.ctrl.php'; require_once __DIR__ . '/config.ctrl.php'; require_once __DIR__ . '/seo.ctrl.php'; require_once __DIR__ . '/block.ctrl.php'; require_once __DIR__ . '/translate.ctrl.php'; C::s('CRTL_ROUTES', array('default' => 'DefaultController', 'error' => 'ErrorController', 'page' => 'PageController', 'list' => 'ListController', 'kadmin' => 'KadminController', 'menu' => 'MenuController', 'config' => 'ConfigController', 'seo' => 'SeoController', 'block' => 'BlockController', 'translate' => 'TranslateController'), true);
<?php define('APPNAME', 'kadmin'); !defined('SMARTY_COMPILE_DIR') ? define('SMARTY_COMPILE_DIR', '../../cache/Smarty/kadmin/templates_c/') : true; !defined('SMARTY_CACHE_DIR') ? define('SMARTY_CACHE_DIR', '../../cache/Smarty/kadmin/cache/') : true; !defined('SMARTY_TEMPLATE_DIR') ? define('SMARTY_TEMPLATE_DIR', './views/') : true; require_once __DIR__ . '/../../gom-core/global.inc.php'; require_once __DIR__ . '/../konfig.inc.php'; require_once __DIR__ . '/../kore/lib/lib.inc.php'; require_once __DIR__ . '/../kore/list.inc.php'; require_once __DIR__ . '/static/static.inc.php'; require_once __DIR__ . '/kontroller/ctrl.inc.php'; require_once __DIR__ . '/router.inc.php'; C::s('MAIN_VIEW_MODELE', __DIR__ . '/../views/tpl/modele/'); /** * Autoloader Klasses * * @param string $str * * @return null */ function autoLoadKlasses($str) { if (is_file(__DIR__ . '/../kore/klasses/' . strtolower($str) . '.class.php')) { require_once __DIR__ . '/../kore/klasses/' . strtolower($str) . '.class.php'; } } spl_autoload_register('autoLoadKlasses'); /** * Autoloader KAdmin Klasses *