/** * Use to begin a preformatted code block. * * By default creates <pre class="code">. * * @return * @param object $cssClass[optional] */ function pre_start($cssClass = 'code') { echo '<pre class="' . $cssClass . "\">\n"; coreConfig::set('pre_highlight_mode', $cssClass); ob_start(); ob_implicit_flush(0); }
/** * Configures the applicationconfiguration. * * Override this method if you want to customize your application configuration. */ public function configure() { // profile php execution time $this->profileStart(); // Application configuration settings coreConfig::set('app_zend_lib_dir', coreConfig::get('lib_dir')); // Integrate Zend from project level directory /lib/Zend/ if ($sf_zend_lib_dir = coreConfig::get('app_zend_lib_dir')) { set_include_path($sf_zend_lib_dir . PATH_SEPARATOR . get_include_path()); require_once $sf_zend_lib_dir . '/Zend/Loader.php'; spl_autoload_register(array('Zend_Loader', 'autoload')); } // set default timezone setting, fixes php error 'date(): It is not safe to rely on the system's timezone settings' date_default_timezone_set('UTC'); }
/** * Set some symfony settings for symfony classes that we use. * * Note! In the Symfony includes, the sfConfig calls are replaced by coreConfig calls. */ private function setSymfonyConfig($debug) { coreConfig::set('sf_root_dir', $this->rootDir); coreConfig::set('sf_symfony_lib_dir', coreConfig::get('core_dir') . DIRECTORY_SEPARATOR . 'sf'); // content encoding for html coreConfig::set('sf_charset', 'utf-8'); // testing or production environment (remote) coreConfig::set('sf_test', $debug); // debugging coreConfig::set('sf_debug', $debug); // output compression for html and also javascripts coreConfig::set('sf_compressed', true && coreToolkit::detectGzipEncodingSupport()); }
/** * Set secondary navigation highlight. * */ function set_secondary_nav($nav_id) { coreConfig::set('layout.secondarynav.current', $nav_id); }
/** * Sets an alternate layout for this action. * * To de-activate the layout, set the layout name to false. * * To revert the layout to the one configured in the view.yml, set the template name to null. * * @param mixed Layout name or false to de-activate the layout */ public function setLayout($name) { coreConfig::set('core.view.' . $this->getModuleName() . '_' . $this->getActionName() . '_layout', $name); }
/** * Apply the view configuration to the web response, * while keeping the values set by the action directly through coreWebResponse. * * Config keys and Response method used: * * title => setTitle() * metas [array] => addMeta() * http_metas [array] => addHttpMeta() * stylesheets [array] => addStylesheet() * javascripts [array] => addJavascript() * * * @param coreView $viewInstance View to apply configuration to * @return */ public function applyConfig() { $config = $this->configValues; $response = coreContext::getInstance()->getResponse(); // apply view config layout, or default layout, unless explicitly set in action $controller = coreContext::getInstance()->getController(); $layoutKey = 'core.view.' . $controller->getModuleName() . '_' . $controller->getActionName() . '_layout'; if (coreConfig::get($layoutKey) === null && isset($config['layout'])) { coreConfig::set($layoutKey, $config['layout']); } // http meta tags if (isset($config['http_metas'])) { foreach ($config['http_metas'] as $key => $value) { $response->addHttpMeta($key, $value, false); } } // apply meta tags if (isset($config['metas'])) { foreach ($config['metas'] as $key => $value) { // add http-equiv meta tags if ($key == 'content-type') { $response->addHttpMeta($key, $value, false); } else { $response->addMeta($key, $value, false); } } } // apply document title if (isset($config['title'])) { $response->setTitle($config['title'], false); } // apply stylesheets if (isset($config['stylesheets'])) { foreach ($config['stylesheets'] as $key => $value) { if (is_numeric($key)) { // stylesheet is just a path $path = $value; $options = array(); $position = ''; } else { $path = $key; $options = $value; $position = ''; if (isset($options['position'])) { $position = $options['position']; unset($options['position']); } } $response->addStylesheet($path, $position, $options); } } // apply javascripts if (isset($config['javascripts'])) { foreach ($config['javascripts'] as $key => $value) { if (is_numeric($key)) { // just a path $path = $value; $options = array(); $position = ''; } else { $path = $key; $options = $value; $position = ''; if (isset($options['position'])) { $position = $options['position']; unset($options['position']); } } $response->addJavascript($path, $position, $options); } } //echo '<pre><code>'.print_r($this->configValues, true).'</code></pre>'; //return; }
/** * Set some symfony settings for symfony classes that we use. * * Note! In the Symfony includes, the sfConfig calls are replaced by coreConfig calls. */ private function setSymfonyConfig($debug) { coreConfig::set('sf_root_dir', $this->rootDir); coreConfig::set('sf_symfony_lib_dir', coreConfig::get('core_dir') . DIRECTORY_SEPARATOR . 'sf'); // content encoding for html coreConfig::set('sf_charset', 'utf-8'); // testing or production environment (remote) coreConfig::set('sf_test', $debug); // debugging coreConfig::set('sf_debug', $debug); // output compression for html // disabled in debug mode because php notices can cause 'Content Encoding Error' making debugging difficult coreConfig::set('sf_compressed', !$debug && coreToolkit::detectGzipEncodingSupport()); }
/** * Start buffering contents of a rounded box. * * @param string $box_class uiBox class, style for the ui box. */ function ui_box_rounded($box_class = 'uiBoxRDefault') { coreConfig::set('helpers.ui.box', $box_class); ob_start(); ob_implicit_flush(0); }
/** * Stops the content capture and save the content in the slot. * * @see slot */ function end_slot() { $content = ob_get_clean(); $response = coreContext::getInstance()->getResponse(); $slot_names = coreConfig::get('core.view.slot_names', array()); if (!$slot_names) { throw new coreException('No slot started.'); } $name = array_pop($slot_names); $response->setSlot($name, $content); coreConfig::set('core.view.slot_names', $slot_names); }