/** * CONSTRUCTOR - Initialize */ public function __construct($start = '') { // Managed directives ini_set('default_charset', $charset = 'UTF-8'); ini_set('display_errors', 1); // Abort on startup error // Intercept errors/exceptions; PHP5.3-compatible error_reporting(E_ALL | E_STRICT); if (!ini_get('date.timezone')) { date_default_timezone_set('GMT'); } // define shorthand paths if (!defined('BASE')) { $base = dirname(__FILE__) . '/'; define("BASE", $base); define("CACHE", $base . 'cache/'); define("ADMIN", $base . 'admin/'); define("INSTALL", $base . 'install/'); define("LIBS", $base . 'libs/'); define("EXTENSIONS", $base . 'libs/extensions/'); define("FRAMEWORKS", $base . 'libs/frameworks/'); define("FUNCTIONS", $base . 'functions/'); define("CONTENT", $base . 'content/'); define("THEMES", $base . 'content/themes/'); define("PLUGINS", $base . 'content/plugins/'); define("ADMIN_THEMES", $base . 'content/admin_themes/'); define("SITEURL", BASEURL); } if (!$start) { // initialize parent::__construct(); $this->currentUser = UserBase::instance(); // the current user $this->displayUser = DisplayUser::instance(); $this->plugin = Plugin::instance(); // instantiate Plugin object $this->post = Post::instance(); // instantiate Post object $this->comment = Comment::instance(); $this->includes = IncludeCssJs::instance(); // instantiate Includes object $this->pageHandling = PageHandling::instance(); // instantiate PageHandling object $this->debug = Debug::instance(); // instantiate Debug object $this->csrf('set'); // set a csrfToken $this->db->setHotaru($this); // pass $h object to EzSQL for error reporting //$this->mdb->setHotaru($this); // pass $h object to meekroDb for error reporting //print 'time: ' . timer_stop(4,'hotaru'); //roughly here at 0.0040 Nov 2, 2014 tests // time: 0.0047 Nov11, 2014 after moving a few more functions to init } }
/** * Generate either default or friendly urls * * @param array $parameters an array of pairs, e.g. 'page' => 'about' * @param string $head either 'index' or 'admin' * @return string */ public function url($parameters = array(), $head = 'index') { $pageHandling = new PageHandling(); return $pageHandling->url($this, $parameters, $head); }