is_enabled) { if (!$this->is_ajax()) { $this->ajax_redirection(); get_header($name); } if (isset($callback)) { call_user_func($callback, $name); } } else { get_header($name); } } function ajax_footer($name = null, $callback = null) { if ($this->is_enabled) { if (!$this->is_ajax()) { get_footer($name); } if (isset($callback)) { call_user_func($callback, $name); } } else { get_footer($name); } } function is_post() { return ($_SERVER['REQUEST_METHOD'] == 'POST') ? true : false; } function ajax_redirection() { if ($this->is_robots() === false && $this->is_ajax() === false) { global $q_config; if (isset($_SERVER['REDIRECT_URL']) || ($_SERVER['QUERY_STRING'] != '')) { $redirect_url = isset($_SERVER['REDIRECT_URL']) ? $_SERVER['REDIRECT_URL'] : ''; if ($redirect_url != '' && $redirect_url[strlen($redirect_url) - 1] != '/') { header('location: ' . $redirect_url . '/'); die(); } else { $complete_url = get_option('siteurl'); if (isset($q_config)) { $lang = $q_config['language']; if (strpos($redirect_url, '/' . $lang . '/') !== false) { $complete_url .= '/' . $lang; } } $request_uri = substr($_SERVER['REQUEST_URI'], strlen(str_replace('index.php', '', $_SERVER['PHP_SELF']))); if ($request_uri != '') { header('location: ' . $complete_url . '/' . $this->anchor . '/' . $request_uri); die(); } } } } } function is_robots() { if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] != '') { return true; } else { $crawlers = array('aspseek', 'abachobot', 'accoona', 'acoirobot', 'adsbot', 'alexa', 'alta vista', 'altavista', 'ask jeeves', 'baidu', 'crawler', 'croccrawler', 'dumbot', 'estyle', 'exabot', 'facebook', 'fast-enterprise', 'fast-webcrawler', 'francis', 'geonabot', 'gigabot', 'google', 'heise', 'heritrix', 'ibm', 'iccrawler', 'idbot', 'ichiro', 'lycos', 'msn', 'msrbot', 'majestic-12', 'metager', 'ng-search', 'nutch', 'omniexplorer', 'psbot', 'rambler', 'seosearch', 'scooter', 'scrubby', 'seekport', 'sensis', 'seoma', 'snappy', 'steeler', 'synoo', 'telekom', 'turnitinbot', 'tagxedo', 'voyager', 'wisenut', 'yacy', 'yahoo'); foreach ($crawlers as $c) { if (stristr($_SERVER['HTTP_USER_AGENT'], $c)) { return true; } } return false; } } } global $ajax_theme; $ajax_theme = new ajax_theme(); function enable_ajax_theme($anchor = '#!') { global $ajax_theme; $ajax_theme->anchor = $anchor; $ajax_theme->is_enabled = true; } function is_ajax(){ global $ajax_theme; return $ajax_theme->is_ajax(); } function ajax_header($name = null) { global $ajax_theme; $ajax_theme->ajax_header($name); } function ajax_footer($name = null) { global $ajax_theme; $ajax_theme->ajax_footer($name); } function ajax_is_robots() { global $ajax_theme; return $ajax_theme->is_robots(); } function ajax_start_hook() { global $ajax_theme; if ($ajax_theme->is_ajax()) { echo '