Пример #1
0
 public function render()
 {
     $this->set_param('id', 'footer');
     if ($this->_copyright || $this->_full_title || $this->_help_title) {
         $p = HTML_Decorator::tag('p');
         if ($this->_copyright) {
             $p->add_inner($this->_copyright);
         }
         if ($this->_copyright && ($this->_full_title || $this->_help_title)) {
             $p->add_inner_tag('br');
         }
         if ($this->_full_title) {
             $p->add_inner_tag('a', $this->_full_title, array('href' => $this->_full_url));
         }
         if ($this->_full_title && $this->_help_title) {
             $p->add_inner(' | ');
         }
         if ($this->_help_title) {
             $p->add_inner_tag('a', $this->_help_title, array('href' => $this->_help_url));
         }
         $this->add_inner($p);
     }
     if ($this->_powered_by) {
         $this->add_inner_tag('p', 'Powered by the <br><a href="http://mwf.ucla.edu" target="_blank">UCLA Mobile Web Framework</a>', array('style' => 'font-weight:bold;font-style:italic'));
     }
     return parent::render();
 }
Пример #2
0
 public function &set_option($num, $name = false, $url = false, $params = array())
 {
     if ($this->_options_count < $num) {
         $num = $this->_options_count;
     }
     $this->_options[$num++] = HTML_Decorator::tag('a', $name ? $name : '', array_merge($params, array('href' => $url ? $url : '#')));
     $this->_options_count = $num;
     return $this;
 }
Пример #3
0
 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();
 }
Пример #4
0
}
function text2text($text)
{
    return $text ? $text : 'false';
}
function js2bool2text($function)
{
    return '<script type="text/javascript">
document.write(' . $function . '() ? "true" : "false");
</script>';
}
function js2text($function)
{
    return '<script type="text/javascript">
var t;
if(t = ' . $function . '())
    document.write(t);
else
    document.write("false");
</script>';
}
echo HTML_Decorator::html_start()->render();
echo Site_Decorator::head()->set_title('MWF About')->render();
echo HTML_Decorator::body_start()->render();
echo Site_Decorator::header()->set_title('MWF Device')->render();
echo Site_Decorator::content_full()->set_padded()->add_header('The Framework')->add_subheader('Server Info')->add_section(label('User Agent') . $_SERVER['HTTP_USER_AGENT'])->add_section(label('IP Address') . $_SERVER['REMOTE_ADDR'])->add_subheader('JS Classification')->add_section(label('mwf.classification.isMobile()') . js2bool2text('mwf.classification.isMobile'))->add_section(label('mwf.classification.isBasic()') . js2bool2text('mwf.classification.isBasic'))->add_section(label('mwf.classification.isStandard()') . js2bool2text('mwf.classification.isStandard'))->add_section(label('mwf.classification.isFull()') . js2bool2text('mwf.classification.isFull'))->add_section(label('mwf.classification.isOverride()') . js2bool2text('mwf.classification.isOverride'))->add_section(label('mwf.classification.isPreview()') . js2bool2text('mwf.classification.isPreview'))->add_subheader('PHP Classification')->add_section(label('Classification::is_mobile()') . bool2text(Classification::is_mobile()))->add_section(label('Classification::is_basic()') . bool2text(Classification::is_basic()))->add_section(label('Classification::is_standard()') . bool2text(Classification::is_standard()))->add_section(label('Classification::is_full()') . bool2text(Classification::is_full()))->add_section(label('Classification::is_override()') . bool2text(Classification::is_override()))->add_section(label('Classification::is_preview()') . bool2text(Classification::is_preview()))->add_subheader('JS User Agent')->add_section(label('mwf.userAgent.getOS()') . js2text('mwf.userAgent.getOS'))->add_section(label('mwf.userAgent.getOSVersion()') . js2text('mwf.userAgent.getOSVersion'))->add_section(label('mwf.userAgent.getBrowser()') . js2text('mwf.userAgent.getBrowser'))->add_section(label('mwf.userAgent.getBrowserEngine()') . js2text('mwf.userAgent.getBrowserEngine'))->add_section(label('mwf.userAgent.getBrowserEngineVersion()') . js2text('mwf.userAgent.getBrowserEngineVersion'))->add_subheader('PHP User Agent')->add_section(label('User_Agent::get_os()') . text2text(User_Agent::get_os()))->add_section(label('User_Agent::get_os_version()') . text2text(User_Agent::get_os_version()))->add_section(label('User_Agent::get_browser()') . text2text(User_Agent::get_browser()))->add_section(label('User_Agent::get_browser_engine()') . text2text(User_Agent::get_browser_engine()))->add_section(label('User_Agent::get_browser_engine_version()') . text2text(User_Agent::get_browser_engine_version()))->add_subheader('JS Screen')->add_section(label('mwf.screen.getHeight()') . js2text('mwf.screen.getHeight'))->add_section(label('mwf.screen.getWidth()') . js2text('mwf.screen.getWidth'))->add_section(label('mwf.screen.getPixelRatio()') . js2text('mwf.screen.getPixelRatio'))->add_subheader('PHP Screen')->add_section(label('Screen::get_height()') . text2text(Screen::get_height()))->add_section(label('Screen::get_width()') . text2text(Screen::get_width()))->add_section(label('Screen::get_pixel_ratio()') . text2text(Screen::get_pixel_ratio()))->render();
echo Site_Decorator::button_full()->set_padded()->add_option(Config::get('global', 'back_to_home_text'), Config::get('global', 'site_url'))->render();
echo Site_Decorator::default_footer()->render();
echo HTML_Decorator::body_end()->render();
echo HTML_Decorator::html_end()->render();
Пример #5
0
 public function __construct($tag, $inner = '', $params = array())
 {
     $this->_tag_open = HTML_Decorator::tag_open($tag, $params);
     $this->_tag_close = HTML_Decorator::tag_close($tag);
     $this->add_inner($inner);
 }
Пример #6
0
 public function render()
 {
     $count = count($this->_list);
     if ($this->_title) {
         $this->_title->add_class('menu-first');
     } elseif ($count > 0) {
         $this->_list[0]->add_class('menu-first');
     }
     if ($count > 0) {
         $this->_list[$count - 1]->add_class('menu-last');
     } else {
         if ($this->_title) {
             $this->_title->add_class('menu-last');
         }
     }
     if ($this->_detailed) {
         $this->add_class('menu-detailed');
     } elseif ($this->_detailed === false) {
         $this->remove_class('menu-detailed');
     }
     if ($this->_padded) {
         $this->add_class('menu-padded');
     } elseif ($this->_padded === false) {
         $this->remove_class('menu-padded');
     }
     $list = '';
     if ($count > 0) {
         $inner = '';
         foreach ($this->_list as $list_item) {
             $inner .= $list_item->render();
         }
         $list = HTML_Decorator::tag('ol', $inner)->render();
     }
     $title = is_a($this->_title, 'Decorator') ? $this->_title->render() : ($this->_title ? $this->_title : '');
     $this->add_inner_front($title . $list);
     return parent::render();
 }