/** * Setup and configure the benchmark library class. */ public function __construct() { // Run the first benchmark self::mark('init'); // Register shortcut aliases using io::method(); \io::alias(__CLASS__, get_class_methods(__CLASS__)); }
/** * Initialize str helper class. * * @return object */ public function __construct() { // Private methods to exclude from shortcuts $excluded = array('casespace'); // Register shortcut aliases using h::method(); \io::alias(__CLASS__, array_diff(get_class_methods(__CLASS__), $excluded)); }
/** * Initialize file helper class. * * @return object */ public function __construct() { // By default exclude annoying files self::exclusive(); // Register shortcut aliases using h::method(); \io::alias(__CLASS__, get_class_methods(__CLASS__)); }
/** * Initialize the page. * * @return void */ public function __construct() { // Encapsulates output ob_start(); // Shortcut reference $r = \io::route(); // Set defaults for a page self::$data = array('title' => ucwords($r['controller'] . ' - ' . $r['action'] . ' | ' . \io::h('web')->domain()), 'description' => false, 'optimize' => false); // Register shortcut aliases using io::method(); \io::alias(__CLASS__, get_class_methods(__CLASS__)); }
/** * Initialize the crawler class. * * @return void */ public function __construct() { // Create a new web agent self::$data['crawler'] = \io::libraries('agent'); // Crawler should be faster self::$data['timeout'] = 2500; // Set timeout within the user agent self::$data['crawler']->timeout(self::$data['timeout']); // Crawler disregards SSL verification self::$data['crawler']->secure(false); // Register shortcut aliases using io::method(); \io::alias(__CLASS__, ['crawler', 'crawl', 'wait']); }
/** * Initialize cron helper class. * * @return object */ public function __construct() { // Initialize defaults self::$data['jobs'] = array(); self::$data['crontab'] = '/usr/bin/crontab'; // Reads the crontab file into a string $crontab = stream_get_contents(popen(self::$data['crontab'] . ' -l', 'r')); // Iterates through all non-empty lines from crontab file foreach (array_filter(explode(PHP_EOL, $crontab)) as $line) { // Ignore comment lines if (trim($line)[0] != '#') { // Parse jobs into a developer friendly format self::$data['jobs'][md5($line)] = self::parse($line); } } // Register shortcut aliases using h::method(); \io::alias(__CLASS__, ['tasks', 'flush', 'schedule', 'unschedule']); }
/** * Setup the session environment, check session exists, runs security. */ public function __construct() { // This sets the cookie name session_name('app_id'); // Check for a valid session cookie if (!isset($_COOKIE['app_id']) or !isset($_COOKIE['app_id'][63])) { // Generate a new session id session_id(self::session_id(true)); } else { // Use the user provided session self::$session = $_COOKIE['app_id']; } // Starts the session session_start(); // Security measures self::security(); // Flashdata cleanup self::clean_flashdata(); // User tracking self::tracking(); // Register shortcut aliases using io::method(); \io::alias(__CLASS__, get_class_methods(__CLASS__)); }
/** * Initialize inflector helper class. * * @return object */ public function __construct() { // Setup internal data arrays self::internals(); // Register shortcut aliases using h::method(); \io::alias(__CLASS__, ['singular', 'plural', 'inflector']); }
/** * Initialize security helper class. * * @return object */ public function __construct() { // Register shortcut aliases using h::method(); \io::alias(__CLASS__, get_class_methods(__CLASS__)); }
/** * Initialize markdown helper class. * * @return object */ public function __construct() { // Register shortcut aliases using h::method(); \io::alias(__CLASS__, ['markdown', 'parsedown']); }
/** * Initialize html helper class. * * @return object */ public function __construct() { // Register shortcut aliases using h::method(); \io::alias(__CLASS__, ['html', 'tag', 'mailto']); }
/** * Initialize time helper class. * * @return object */ public function __construct() { // Default settings self::$settings = array('context' => ['units' => 1, 'relative' => 0], 'calc' => ['round' => 1, 'floor' => 0, 'ceil' => 0], 'display' => ['normal' => 1, 'short' => 0, 'tiny' => 0], 'past' => ['from ', ' ago', 0, 1], 'future' => ['in ', ' remaining', 0, 1], 'format' => ['normal' => 1, 'ucfirst' => 0, 'ucwords' => 0, 'strtoupper' => 0]); // Register shortcut aliases using h::method(); \io::alias(__CLASS__, get_class_methods(__CLASS__)); }