private function _compileScript() { // Register models Ajde_Model::register('browser'); // Get browsers $browsers = new BrowserCollection(); $browsers->orderBy("sort"); $browsers->load(); $json = $browsers->getJSON(); // Compile browsers.js $browsersJsSrc = file_get_contents(MODULE_DIR . 'umb/res/js/browsers.src.js'); $browsersJs = str_replace("'###JSONSTRINGHERE###'", $json, $browsersJsSrc); file_put_contents(MODULE_DIR . 'umb/res/js/browsers.js', $browsersJs); // Init compressed resource /* @var $compressor Ajde_Resource_Local_Compressor_Js */ $compressor = Ajde_Resource_Local_Compressor::fromType(Ajde_Resource::TYPE_JAVASCRIPT); // Sources for script $sources = array(new Ajde_Resource_Local(Ajde_Resource::TYPE_JAVASCRIPT, MODULE_DIR . 'umb/', 'umb'), new Ajde_Resource_Local(Ajde_Resource::TYPE_JAVASCRIPT, MODULE_DIR . 'umb/', 'browsers'), new Ajde_Resource_Local(Ajde_Resource::TYPE_JAVASCRIPT, MODULE_DIR . 'umb/', 'detect'), new Ajde_Resource_Local(Ajde_Resource::TYPE_JAVASCRIPT, MODULE_DIR . 'umb/', 'status'), new Ajde_Resource_Local(Ajde_Resource::TYPE_JAVASCRIPT, MODULE_DIR . 'umb/', 'widget')); // Add to compressor foreach ($sources as $source) { /* @var $source Ajde_Resource */ $compressor->addResource($source); } // Process and get compressed script $resource = $compressor->process(); $js = $resource->getContents(); // Write file_put_contents('umb.js', $js); }
function check() { // Register models Ajde_Model::register($this); // Ensure right view when coming from other action $this->setView(Ajde_View::fromRoute('browser/check')); // Get browsers $browsers = new BrowserCollection(); $browsers->orderBy("sort"); $browsers->load(); // Set vars and return $this->getView()->assign("browsers", $browsers); return $this->render(); }
function view() { // Register models Ajde_Model::register('browser'); // Menu colors $colors = array('html5' => 'f58220', 'wordpress' => '096aa5', 'drupal' => '009edc', 'typo3' => '3ab54a', 'joomla' => 'e52525'); // Fast cycling browsers $fastCycle = array('chrome', 'firefox', 'opera'); // Get browsers $browsers = new BrowserCollection(); $browsers->orderBy("sort"); $browsers->load(); // Set vars and return $this->getView()->assign("browsers", $browsers); $this->getView()->assign("colors", $colors); $this->getView()->assign("fastCycle", $fastCycle); return $this->render(); }