/** * This constructor sets up session, pulls the current install wizard step and initializes the template * * @return void */ public function __construct() { if (!Kohana::config('config.installer_enabled')) { throw new Exception('The installer has been administratively disabled. (You can re-enable it in Bluebox/config/config.php)'); } Kohana::config_set('core.site_domain', Bluebox_Installer::guess_site_domain()); skins::setSkin($this->template); parent::__construct(); /** * TODO: Remove me when i18n is more stable */ $this->session->set('lang', 'en'); // Attempt to retrieve the current Step $this->currentStepKey = $this->session->get('installer.currentStepKey', 0); $this->currentStep = $this->steps[$this->currentStepKey]; // If this step is before the environment test the disable logging because we dont know if // kohana has write permissions on logs/ if ($this->currentStepKey > 1 && Kohana::config('core.log_threshold') == 0) { Kohana::config_set('core.log_threshold', $this->log_threshold); } // This is the default list of steps to run, modified to work with the wizard $this->pluginEvents = array('core' => Router::$controller, 'coreAction' => Router::$controller . '.' . $this->currentStep); if ($this->currentStep != 'finalize') { $this->_loadAllModules(); } else { Bluebox_Core::bootstrapPackages(TRUE); } }
public static function add($paths, $options = array(), $directory = 'assets/css') { // if they didnt give us anything to include move on if (empty($paths)) { return FALSE; } // if options is not an array assume it is a weight if (!is_array($options)) { $options = array('weight' => (int) $options); } // ensure our defualt options are populated $options += array('minify' => FALSE, 'inline' => FALSE, 'asCodeBlock' => FALSE, 'scan' => TRUE, 'docroot' => DOCROOT, 'weight' => 40, 'cond' => NULL); extract($options); // standardize the condition name as a lower case string $cond = strtolower($cond); // normalize the directory option if (!empty($directory)) { $directory = rtrim($directory, '/') . '/'; } // include each of the paths provided foreach ((array) $paths as $path) { // if scanning is not disabled then look for the css file if ($scan) { // the kohana find_file needs the extensio seperate from the path $extn = pathinfo($path, PATHINFO_EXTENSION); if (empty($extn)) { $extn = 'css'; } else { $path = substr($path, 0, -1 * (strlen($extn) + 1)); } // first check the modules for the assets $search = $directory . $path . '.' . $extn; if ($found = Kohana::find_file(rtrim($directory, '/'), $path, FALSE, $extn)) { $path = str_replace($docroot, '', $found); // no? how about in the skin } else { if (is_file($docroot . skins::getSkin() . $search)) { $path = skins::getSkin() . $search; // still? ok what about in the core } else { if (is_file($docroot . $search)) { $path = $search; // hmm, ok well did they give us an absolute path? } else { if (is_file($path . $extn)) { $path = $path . $extn; } else { // thats it, I looked everywhere kohana::log('error', 'Unable to locate CSS include ' . $path); continue; } } } } } // are we putting this file into a code block or inline? if ($inline || $asCodeBlock) { // get the file contents $style = @file_get_contents($path); if (empty($style)) { kohana::log('error', 'Unable to read css file ' . $path); continue; } // make the file contents into a code block echo self::codeBlock($style, $options); } else { // if this is a conditional code block store it seperate from // standard block if (array_key_exists($cond, self::$cssconditional)) { self::$stylePaths[$cond][$weight][] = $path; } else { self::$stylePaths['paths'][$weight][] = $path; } } } // is_file caches info about the files we looked for, clear that now clearstatcache(); return TRUE; }
/** * Set the currently used skin's name * @param string $skin Set the skin we're going to use. Useful if a particular plugin needs a special skin (like a storefront) */ public static function setSkin($skin) { self::initialize(FALSE); // Do not try to auto-detect - we are setting manually self::$skin = $skin; }
</div> <div id="feature_form"> <img src="<?php echo url::base() . skins::getSkin(); ?> assets/img/thinking.gif"> </div> <?php javascript::codeBlock(); ?> $('.FeatureNumber').click(function(){ getFeatureNumberOptionForm(); }); getFeatureNumberOptionForm(); <?php javascript::blockEnd(); ?> <script language="javascript"> function getFeatureNumberOptionForm() { $('#feature_form_status').html('<img src="<?php echo url::base() . skins::getSkin(); ?> assets/img/thinking.gif">'); $('#feature_form').html(""); $.post("<?php echo url::base(); ?> index.php/feature/getFeatureNumberOptionsForm", $('form').serialize(), function(data) {$('#feature_form').html(data); $('#feature_form_status').html("");}); } </script>
public function setup() { Event::$data->viewParams['folder'] = '../../' . skins::getSkin(); }
/** * This function will attempt to find a icon starting from the most specific location * and working down a skins defualt. You may specify the intended size as small, medium, * or large. If restrictToSkin is true then we will not consider icons in the modules, * or if it is an array then that is considered a list of icons to get from the skin only. * * For example the 32x32 sip interface icon for the 2600hz skin would render the following * search path (unless restricted to skin) * * sipinterface/assets/img/icons/32x32/2600hz/sipinterface.png * sipinterface/assets/img/icons/32x32/sipinterface.png * skins/2600hz/assets/img/icons/32x32/sipinterface.png * skins/2600hz/assets/img/icons/32x32/default.png * */ public static function getNavIcon($navStructure, $size = 'medium', $options = array()) { // init our options if (!is_array($options)) { $options = array('restrictToSkin' => FALSE); } $options += array('restrictToSkin' => FALSE, 'allowSkinSpecific' => TRUE); extract($options); // init our array, get the module name, and clean up the skin name $lookIn = array(); $name = $navStructure['module']; $skin = str_replace('skins/', '', skins::getSkin()); // make sure we are dealing with our defualt sizes switch ($size) { case 'small': $size = '16x16'; break; case 'medium': $size = '32x32'; break; case 'large': $size = '48x48'; break; default: $size = '32x32'; break; } // basepath for searching within a module $basePath = MODPATH . $name . '/assets/img/icons/' . $size . '/'; $baseURL = url::base() . $name . '/assets/img/icons/' . $size . '/'; // see if the module provides an icon for this skin if (empty($allowSkinSpecific) || is_array($allowSkinSpecific) && array_key_exists($name, $allowSkinSpecific)) { $lookIn[$baseURL . $skin . $name . '.png'] = $basePath . $skin . $name . '.png'; } // see if the module provides a default icon of the correct size if (empty($restrictToSkin) || is_array($restrictToSkin) && array_key_exists($name, $restrictToSkin)) { $lookIn[$baseURL . $name . '.png'] = $basePath . $name . '.png'; } // basepath for searching the skin $basePath = DOCROOT . 'skins/' . $skin . 'assets/img/icons/' . $size . '/'; $baseURL = url::base() . 'skins/' . $skin . 'assets/img/icons/' . $size . '/'; $lookIn[$baseURL . $name . '.png'] = $basePath . $name . '.png'; $lookIn[$baseURL . 'default.png'] = $basePath . 'default.png'; // look for this icon foreach ($lookIn as $url => $path) { if (file_exists($path)) { return $url; } } return FALSE; }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <?php echo $meta; ?> <title><?php echo $title; ?> </title> <?php $skin = url::base() . skins::getSkin(); ?> <link rel="stylesheet" type="text/css" href="<?php echo $skin; ?> assets/css/reset.css" media="screen" /> <link rel="stylesheet" type="text/css" href="<?php echo $skin; ?> assets/css/layout.css" media="screen" /> <link rel="stylesheet" type="text/css" href="<?php echo url::base(); ?> skins/bluebox/assets/css/navigation.css" media="screen" /> <link rel="stylesheet" type="text/css" href="<?php echo $skin;