/** * Retrieves the template used for displaying internal exceptions. * Internal exceptions will be displayed with source code causing the exception. * This occurs when the application is in debug mode. * @param Exception the exception to be displayed * @return string the template content */ protected function getExceptionTemplate($exception) { $lang = Prado::getPreferredLanguage(); $exceptionFile = Prado::getFrameworkPath() . '/Exceptions/templates/' . self::EXCEPTION_FILE_NAME . '-' . $lang . '.html'; if (!is_file($exceptionFile)) { $exceptionFile = Prado::getFrameworkPath() . '/Exceptions/templates/' . self::EXCEPTION_FILE_NAME . '.html'; } if (($content = @file_get_contents($exceptionFile)) === false) { die("Unable to open exception template file '{$exceptionFile}'."); } return $content; }
/** * Registers a Prado style library to be loaded. */ protected function registerPradoStyleInternal($name) { // $this->checkIfNotInRender(); if (!isset($this->_registeredStyles[$name])) { $base = $this->getPradoScriptAssetUrl(); if (self::$_styles === null) { $packageFile = Prado::getFrameworkPath() . DIRECTORY_SEPARATOR . self::CSS_PACKAGES_FILE; list($folders, $packages, $deps) = (include $packageFile); self::$_stylesFolders = $folders; self::$_styles = $deps; self::$_stylesPackages = $packages; } if (isset(self::$_styles[$name])) { $this->_registeredStyles[$name] = true; } else { throw new TInvalidOperationException('csmanager_pradostyle_invalid', $name); } if (($packages = array_keys($this->_registeredStyles)) !== array()) { $packagesUrl = array(); $isDebug = $this->getApplication()->getMode() === TApplicationMode::Debug; foreach ($packages as $p) { foreach (self::$_styles[$p] as $dep) { foreach (self::$_stylesPackages[$dep] as $style) { if (!isset($this->_expandedStyles[$style])) { list($base, $subPath) = $this->getStylePackageFolder($style); list($path, $baseUrl) = $this->getPackagePathUrl($base); $this->_expandedStyles[$style] = true; // TODO minify css? if (!in_array($url = $baseUrl . '/' . $subPath, $packagesUrl)) { $packagesUrl[] = $url; } } } } } foreach ($packagesUrl as $url) { $this->registerStyleSheetFile($url, $url); } } } }
/** * @return string path to the error message file */ protected function getErrorMessageFile() { $lang = Prado::getPreferredLanguage(); $msgFile = Prado::getFrameworkPath() . '/Exceptions/messages/messages-' . $lang . '.txt'; if (!is_file($msgFile)) { $msgFile = Prado::getFrameworkPath() . '/Exceptions/messages/messages.txt'; } return $msgFile; }