/**
  * Function that is called at page initialization
  */
 function init_page()
 {
     $this->is_logged_in = qa_get_logged_in_userid();
     $this->mobile = qa_is_mobile_probably();
     $this->post_method = preg_match("/^(?:POST|PUT)\$/i", $_SERVER["REQUEST_METHOD"]);
     $this->timer = microtime(true);
     $this->cache_file = $this->get_filename();
     if ($this->should_clear_caching()) {
         $this->clear_cache();
     }
     if ($this->check_cache() && $this->do_caching()) {
         $this->get_cache();
     } else {
         if ($this->do_caching()) {
             ob_start();
         } else {
             return;
         }
     }
 }
 private function is_mobile()
 {
     if (qa_opt('site_theme') == qa_opt('site_theme_mobile') || !qa_is_mobile_probably()) {
         return false;
     } else {
         return true;
     }
 }
Exemple #3
0
function qa_get_site_theme()
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    return qa_opt(qa_is_mobile_probably() ? 'site_theme_mobile' : 'site_theme');
}
Exemple #4
0
 /**
  * Dynamic <code>CSS</code> based on options and other interaction with Q2A.
  *
  * @since Snow 1.4
  * @version 1.0
  * @return string The CSS code
  */
 private function head_inline_css()
 {
     $css = array('<style>');
     if (!qa_is_logged_in()) {
         $css[] = '.qa-nav-user { margin: 0 !important; }';
     }
     if (qa_request_part(1) !== qa_get_logged_in_handle()) {
         $css[] = '@media (max-width: 979px) {';
         $css[] = ' body.qa-template-user.fixed, body[class*="qa-template-user-"].fixed { padding-top: 118px !important; }';
         $css[] = ' body.qa-template-users.fixed { padding-top: 95px !important; }';
         $css[] = '}';
         $css[] = '@media (min-width: 980px) {';
         $css[] = ' body.qa-template-users.fixed { padding-top: 105px !important;}';
         $css[] = '}';
     }
     // sidebar styles for desktop (must use server-side UA detection, not media queries)
     if (!qa_is_mobile_probably()) {
         $css[] = '.qa-sidepanel { width: 25%; padding: 0px; float: right; overflow: hidden; *zoom: 1; }';
     }
     $css[] = '</style>';
     $this->output_array($css);
 }
    function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
    {
        /*$themeobject->output(
        			'<H3 STYLE="margin-top:0; padding-top:0;">',
        			qa_opt('prevnav_plugin_widget_title'),
        			'</H3>'
        		);*/
        if (qa_is_mobile_probably()) {
            return;
        }
        $url = qa_path($request, null, qa_opt('site_url'));
        $out1 = '

<ul class="nav" >
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">GATE CS & IT<span class="caret"></span></a>
          <ul class="dropdown-menu">';
        for ($i = 2009; $i <= 2013; $i++) {
            $out1 .= '<li><a href="/tag/gate' . $i . '">GATE ' . $i . '</a></li>';
        }
        for ($i = 2014; $i <= 2015; $i++) {
            $out1 .= '<li role="separator" class="divider"></li>';
            for ($j = 1; $j <= 3; $j++) {
                $out1 .= '<li><a href="/tag/gate' . $i . '-' . $j . '">GATE ' . $i . ' Session ' . $j . '</a></li>';
            }
        }
        $out1 .= '
          </ul>
        </li>
      ';
        $out1 .= '
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">GATE CS<span class="caret"></span></a>
          <ul class="dropdown-menu">';
        for ($i = 1991; $i <= 2008; $i++) {
            $out1 .= '<li><a href="/tag/gate' . $i . '">GATE ' . $i . '</a></li>';
        }
        $out1 .= '
          </ul>
        </li>
      ';
        $out1 .= '
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">GATE IT<span class="caret"></span></a>
          <ul class="dropdown-menu">';
        for ($i = 2004; $i <= 2008; $i++) {
            $out1 .= '<li><a href="/tag/gate' . $i . '"-it>GATE ' . $i . '-IT</a></li>';
        }
        $out1 .= '
          </ul>
        </li>
      ';
        /*		$out="<select>";
        			for($i=1991; $i <= 2015; $i++)
        			{
        				$out.='<option value="'.$i.'">GATE '.$i.'</option>';
        			}
        			$out.="</select>";*/
        $out1 .= '
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">TIFR<span class="caret"></span></a>
          <ul class="dropdown-menu">';
        for ($i = 2010; $i <= 2015; $i++) {
            $out1 .= '<li><a href="/tag/tifr' . $i . '">TIFR ' . $i . '</a></li>';
        }
        $output = '<div class="prevnav-widget-container">' . $out1 . '</div>';
        $out1 .= '
          </ul>
        </li>
      ';
        $out1 .= '
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">TIFR Maths<span class="caret"></span></a>
          <ul class="dropdown-menu">';
        for ($i = 2010; $i <= 2015; $i++) {
            $out1 .= '<li><a href="/tag/tifr-maths-' . $i . '">TIFR Maths ' . $i . '</a></li>';
        }
        $out1 .= '
  </ul>
</li>
</ul>';
        $out1 .= '<ul class="nav nav-pills">
<li role="presentation"><a href="/tags">Topics</a></li></ul>';
        $output = '<div class="prevnav-widget-container">' . $out1 . '</div>';
        $themeobject->output($output);
    }