/** * Sets the initial variables, checks if we need to process the css * and then sends whichever file to the browser. * * @return void */ public static function setup($config) { /** * Choose whether to show or hide errors */ if (SCAFFOLD_PRODUCTION === false) { ini_set('display_errors', true); error_reporting(E_ALL & ~E_STRICT); } else { ini_set('display_errors', false); error_reporting(0); } /** * Define contstants for system paths for easier access. */ if (!defined('SCAFFOLD_SYSPATH') && !defined('SCAFFOLD_DOCROOT')) { define('SCAFFOLD_SYSPATH', self::fix_path($config['system'])); define('SCAFFOLD_DOCROOT', $config['document_root']); define('SCAFFOLD_URLPATH', str_replace(SCAFFOLD_DOCROOT, '', SCAFFOLD_SYSPATH)); } /** * Add include paths for finding files */ Scaffold::add_include_path(SCAFFOLD_SYSPATH, SCAFFOLD_DOCROOT); /** * Tell the cache where to save files and for how long to keep them for */ Scaffold_Cache::setup(Scaffold::fix_path($config['cache']), $config['cache_lifetime']); /** * The level at which logged messages will halt processing and be thrown as errors */ self::$error_threshold = $config['error_threshold']; /** * Disabling flags allows for quicker processing */ if ($config['disable_flags'] === true) { self::$flags = false; } /** * Tell the log where to save it's files. Set it to automatically save the log on exit */ if ($config['enable_log'] === true) { // START - Modified by Webligo Developments if ($config['log_path']) { Scaffold_Log::log_directory($config['log_path']); } else { Scaffold_Log::log_directory(SCAFFOLD_SYSPATH . 'logs'); } // END - Modified by Webligo Developments //Scaffold_Log::log_directory(SCAFFOLD_SYSPATH.'logs'); Scaffold_Event::add('system.shutdown', array('Scaffold_Log', 'save')); } /** * Load each of the modules */ foreach (Scaffold::list_files(SCAFFOLD_SYSPATH . 'modules') as $module) { $name = basename($module); $module_config = SCAFFOLD_SYSPATH . 'config/' . $name . '.php'; if (file_exists($module_config)) { unset($config); include $module_config; self::$config[$name] = $config; } self::add_include_path($module); if ($controller = Scaffold::find_file($name . '.php', false, true)) { require_once $controller; self::$modules[$name] = new $name(); } } /** * Module Initialization Hook * This hook allows modules to load libraries and create events * before any processing is done at all. */ self::hook('initialize'); /** * Create the shutdown event */ Scaffold_Event::add('system.shutdown', array('Scaffold', 'shutdown')); }
/** * During the output phase, gather all the logs and send them to FireBug * * @author Anthony Short * @param $css * @return void */ public static function display() { # Log the benchmarks self::benchmark(); # Log about the completed file if (Scaffold::$config['Firelog']['file_information'] === true) { self::_file(Scaffold::$css->file, 'File Information'); } # Constants if (Scaffold::$config['Firelog']['constants'] === true && class_exists('Constants') && Constants::$constants) { $table = array(); $table[] = array('Constants Name', 'Value'); foreach (Constants::$constants as $key => $value) { $table[] = array($key, $value); } FB::table('Constants', $table); } # Mixins if (Scaffold::$config['Firelog']['mixins'] === true && class_exists('Mixins') && Mixins::$mixins) { $table = array(); $table[] = array('Mixin Name', 'Parameters', 'Properties'); foreach (Mixins::$mixins as $key => $value) { $table[] = array($key, implode(',', $value['params']), $value['properties']); } FB::table('Mixins', $table); } # Included files if (Scaffold::$config['Firelog']['included_files'] === true && class_exists('Import') && Import::$loaded) { self::_group('Included Files', Import::$loaded, 3); } # Flags if (Scaffold::$config['Firelog']['flags'] === true) { self::_group('Flags', Scaffold::flags() ? Scaffold::flags() : 'No flags are set'); } # Include Paths if (Scaffold::$config['Firelog']['include_paths'] === true) { self::_group('Include Paths', Scaffold::include_paths()); } # Error Log if (Scaffold::$config['Firelog']['error_log'] === true) { foreach (Scaffold_Log::$log as $type => $value) { FB::group(self::$log_levels[$type]); foreach ($value as $date => $message) { self::_log($message, $type); } FB::groupEnd(); } } # Custom Functions /* if(Scaffold::$config['Firelog']['custom_functions'] === true && class_exists('Extensions') && Extensions::$functions) { self::_group('Custom Functions', Extensions::$functions); } # Custom Properties if(Scaffold::$config['Firelog']['custom_properties'] === true && class_exists('Extensions') && Extensions::$properties) { self::_group('Custom Properties', Extensions::$properties); } */ # Gradients if (Scaffold::$config['Firelog']['gradients'] === true && class_exists('Gradient') && Gradient::$gradients) { $table = array(); $table[] = array('Direction', 'Size', 'From', 'To', 'Location'); foreach (Gradient::$gradients as $key => $value) { $table[] = array($value[0], $value[1], $value[2], $value[3], str_replace($_SERVER['DOCUMENT_ROOT'], '', $value[4])); } FB::table('Gradients', $table); } /* # Layout module if(Scaffold::$config['Firelog']['layout'] === true && isset(Layout::$columns)) { FB::group('Layout'); $table = array(); $table[] = array ( 'Column Count', 'Column Width', 'Total Gutter', 'Left Gutter', 'Right Gutter', 'Total Width', 'Baseline', 'Unit' ); $table[] = array ( Layout::$column_count, Layout::$column_width, Layout::$gutter_width, Layout::$left_gutter_width, Layout::$right_gutter_width, Layout::$grid_width, Layout::$baseline, Layout::$unit ); FB::table('Grid Structure', $table); # Columns $table = array(); $table[] = array ( 'Column #', 'Width' ); foreach(Layout::$columns as $key => $width) { $table[] = array($key,$width); } FB::table('Columns', $table); # Grid Classes FB::groupEnd(); } */ # Validation Errors if (Scaffold::$config['Firelog']['validation_errors'] === true && Validate::$errors) { FB::group('Validation Errors'); foreach (Validate::$errors as $error) { self::_log("line {$error['line']} near {$error['near']} => {$error['message']}", 1); } FB::groupEnd(); } }