public function render() { if (!$this->_image) { $this->_image = array('src' => HTTPS::is_https() ? HTTPS::convert_path(Config::get('global', 'header_home_button')) : Config::get('global', 'header_home_button'), 'alt' => Config::get('global', 'header_home_button_alt')); } $image = HTML_Decorator::tag('img', false, $this->_image)->render(); $home_button = HTML_Decorator::tag('a', $image, array('href' => HTTPS::is_https() ? HTTPS::convert_path(Config::get('global', 'site_url')) : Config::get('global', 'site_url')))->render(); if ($this->_title_path) { $title = $this->_title ? HTML_Decorator::tag('a', $this->_title, array('href' => $this->_title_path)) : false; } else { $title = $this->_title ? $this->_title : ''; } $title_span = $title ? HTML_Decorator::tag('span', $title)->render() : ''; $this->set_param('id', 'header'); $this->add_inner_front($home_button . $title_span); return parent::render(); }
} ?> var mwf=new function(){}; mwf.site=new function(){ this.root = '<?php echo HTTPS::is_https() ? HTTPS::convert_path(Config::get('global', 'site_url')) : Config::get('global', 'site_url'); ?> '; this.asset = new function(){ this.root = '<?php echo HTTPS::is_https() ? HTTPS::convert_path(Config::get('global', 'site_assets_url')) : Config::get('global', 'site_assets_url'); ?> '; }; this.cookie = new function(){ this.prefix = '<?php echo Config::get('global', 'cookie_prefix'); ?> '; this.domain = <?php echo '\'' . $domain_var . '\''; ?> ;
public function render() { $handler_css = $this->_handler_css ? $this->_handler_css : Config::get('global', 'site_assets_url') . '/css.php?'; foreach ($this->_handler_css_params as $key => $val) { $handler_css .= is_int($key) ? $val . '&' : $key . '=' . $val . '&'; } $handler_css = substr($handler_css, 0, strlen($handler_css) - 1); $handler_js = $this->_handler_js ? $this->_handler_js : Config::get('global', 'site_assets_url') . '/js.php?'; foreach ($this->_handler_js_params as $key => $val) { $handler_js .= is_int($key) ? $val . '&' : $key . '=' . $val . '&'; } $handler_js = substr($handler_js, 0, strlen($handler_js) - 1); $this->add_inner_tag_front('meta', false, array('name' => 'viewport', 'content' => 'height=device-height,width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no')); $this->add_inner_tag_front('script', null, array('type' => 'text/javascript', 'src' => HTTPS::is_https() ? HTTPS::convert_path($handler_js) : $handler_js)); $this->add_inner_tag_front('link', false, array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => HTTPS::is_https() ? HTTPS::convert_path($handler_css) : $handler_css, 'media' => 'screen')); $this->add_inner_tag_front('title', $this->_title); $charset = Config::get('global', 'charset'); if ($charset !== false) { $this->add_inner_tag_front('meta', false, array('charset' => $charset)); } return parent::render(); }
/** * Echo a call to mwf.util.importJS such that a new script tag is added to * the DOM for $url. Returns true if the import is successful, or false * if the file has already been loaded. The $allow_multiple boolean, if * set true, allows one to make the same call multiple times. * * @param string $url * @param bool $allow_multiple * @return bool */ public static function import_external($url, $allow_multiple = false) { /** * Return false if $url has already been loaded and $allow_multiple * is false, thus not allowing for multiple loads of the same file. */ if (in_array($url, self::$_external_loaded) && !$allow_multiple) { return false; } /** * Output a call to mwf.util.importJS and return true after storing * the $url under $_external_loaded to prevent multiple inclusion. */ echo 'mwf.util.importJS(\'' . (HTTPS::is_https() ? HTTPS::convert_path($url) : $url) . '\');'; self::$_external_loaded[] = $url; return true; }