/** * * @throws Exception * @return Varien_Object */ public function process() { $cacheId = $this->_getCacheKey(); $response = $cacheId ? Mage::app()->loadCache($cacheId) : false; if ($response) { $response = unserialize($response); } if (!$response instanceof Varien_Object) { $client = new Zend_Http_Client(self::API_URI, $this->_clientConfig); $client->setMethod(Zend_Http_Client::POST); $client->setParameterPost($this->getParams()); $result = $client->request(); $data = Zend_Json::decode($result->getBody()); if ($data['status'] != 201) { throw new Exception("Premailer failed to run: {$data['message']} #{$data['status']}"); } $htmlClient = new Zend_Http_Client($data['documents']['html'], $this->_clientConfig); $textClient = new Zend_Http_Client($data['documents']['txt'], $this->_clientConfig); $response = new Varien_Object(); $response->setVersion($data['version']); $response->setHtml($htmlClient->request()->getBody()); $response->setText($textClient->request()->getBody()); if ($cacheId) { $data = Mage::app()->saveCache(serialize($response), $cacheId, array(self::CACHE_KEY), 60 * 60); } } return $response; }
} if (!is_dir(MagentoDebugger::getProjectDir())) { header('Location: /?magento_debug=configure'); return; } MagentoDebugger::prepareLibraries(); // XDebug if (isset($_GET['XDEBUG_SESSION_START']) || isset($_GET['XDEBUG_SESSION_STOP_NO_EXEC'])) { require_once MagentoDebugger::getDebuggerDir() . '/libs/Debugger/xdebug.php'; return; } // Debugger info if (isset($_GET['magento_debug_info']) && isset($_GET['current_version'])) { $currentVersion = MAGENTO_DEBUGGER_VERSION; $debuggedInfo = new Varien_Object(); $debuggedInfo->setVersion(MAGENTO_DEBUGGER_VERSION); if ($_GET['current_version'] != MAGENTO_DEBUGGER_VERSION) { require_once MagentoDebugger::getDebuggerDir() . '/libs/Debugger/update.php'; try { MagentoDebugger_Update::run($_GET['current_version']); $debuggedInfo->setUpdated(true); $debuggedInfo->setVersion($_GET['current_version']); } catch (Exception $e) { if (is_file(MagentoDebugger::getDebuggerVarDir() . '/required.version')) { unlink(MagentoDebugger::getDebuggerVarDir() . '/required.version'); } file_put_contents(MagentoDebugger::getDebuggerVarDir() . '/required.version', trim($_GET['current_version'])); if (is_dir(MagentoDebugger::getDebuggerVarDir() . '/required.dir')) { rmdir(MagentoDebugger::getDebuggerVarDir() . '/required.dir'); } mkdir(MagentoDebugger::getDebuggerVarDir() . '/required.dir');
public function load($printQuery = false, $logQuery = false) { // Skip if already loaded if ($this->isLoaded()) { return $this; } if (empty($this->_items)) { // Get the config $config = Mage::getConfig(); // Loop through the modules foreach ($config->getNode('modules')->children() as $module) { // Create an object $item = new Varien_Object(); // Module name $item->setName($module->getName()); // Module Active $item->setFileEnable((string) $module->active); // Module Code Pool $item->setCodePool((string) $module->codePool); // Module Version $version = Mage::getConfig()->getModuleConfig($module->getName())->version ? Mage::getConfig()->getModuleConfig($module->getName())->version : "undefined"; $item->setVersion($version); // Folder Path $dir = $config->getOptions()->getCodeDir() . DS . $module->codePool . DS . uc_words($module->getName(), DS); $item->setFolderPath($dir); // Folder Exists $pathExists = file_exists($dir) ? "true" : "false"; $item->setFolderPathExists($pathExists); // Config File Exists $file = $config->getModuleDir('etc', $module->getName()) . DS . "config.xml"; $item->setConfigFilePath($file); $exists = file_exists($file); if ($exists) { // Get the config.xml file $configXml = simplexml_load_string(file_get_contents($file), 'Varien_Simplexml_Element'); // Get the resources tag if ($nodes = $configXml->global->resources) { // Reset the pointer to the beginning of the array reset($nodes); // Get the resource name (first key in the array) $resourceName = key($nodes); } else { $resourceName = ''; } $item->setDataEntry($resourceName); if (!$resourceName) { $dataVersion = ''; } else { // Get the data version based on the resource name $dataVersion = Mage::getResourceSingleton('core/resource')->getDataVersion($resourceName); } $item->setDataVersion($dataVersion); // Please note that the 0 value means Enabled and 1 means Disabled $disableOutput = Mage::getStoreConfig('advanced/modules_disable_output/' . $module->getName()) ? 'false' : 'true'; $item->setOutputEnable($disableOutput); } else { $item->setDataEntry(''); $item->setDataVersion(''); $item->setOutputEnable(''); } $exists = $exists ? 'true' : 'false'; $item->setConfigFileExists($exists); $this->addItem($item); } } $this->_setIsLoaded(); $this->_renderFilters()->_renderOrders()->_renderLimit(); return $this; }