function GetPlayerSummaries() { global $STEAM_APIKEY, $STEAM_PROFILEID; global $STEAM_BASEURL, $STEAM_FORMAT, $STEAM_INTERFACES; $url = 'http://' . $STEAM_BASEURL . '/' . $STEAM_INTERFACES['user'] . '/GetPlayerSummaries/v0002/?key=' . $STEAM_APIKEY . '&steamids=' . $STEAM_PROFILEID . '&format=' . $STEAM_FORMAT; $response = ''; $referer = get_request_url(); $headers = "GET {$url} HTTP/1.1\r\n"; $headers .= "Host: {$STEAM_BASEURL}\r\n"; $headers .= "Referer: {$referer}\r\n"; $headers .= "Connection: close\r\n"; $headers .= "\r\n"; $fp = fsockopen($STEAM_BASEURL, 80, $errno, $errstr, 60); if ($fp) { fwrite($fp, $headers); while (!feof($fp)) { $response .= fgets($fp, 128); } fclose($fp); $response = explode("\r\n\r\n", $response, 2); $response = $response[1]; } else { $error = "ERROR: could not retrieve info"; } if (!empty($response)) { return json_decode($response, true); } else { return null; echo $gameextrainfo; } }
public static function load() { if (self::$instance !== NULL) { delete(self::$instance); self::$instance = NULL; } $request_url = get_request_url(); $parts = parse_url($request_url); $request_uri = strtolower($parts['path']); /* Normalize Path */ $path = remove_ext($request_uri); if (empty($path) || $path == "/" || $path == "/index" || $path == "/home") { $path = "/start"; //later: do landing Page } else { //remove index from right $rm = "/index"; $len = strlen($rm); if (substr($path, $len * -1) == $rm) { $path = substr($path, 0, strlen($path) - $len); } } $request_cmd = $path; //create the commando $dir = 'pages' . $path; $cmd = array(); //default to read index.html $error = !(path2cmd($dir . '.php', $cmd) || path2cmd($dir . '.html', $cmd) || path2cmd($dir . '/index.php', $cmd) || path2cmd($dir . '/index.html', $cmd)); $data = array("request_url" => $request_url, "request_uri" => $request_uri, "request_cmd" => $request_cmd, "cmd" => $cmd); $classname = "StaticPage"; $classfile = "php/static.php"; /*check if a *.php page is requested and exists*/ if (!$error) { $path = $cmd["path"]; if (!$error && preg_match("/^(.*)\\.(php)\$/i", $path)) { $classname = ucfirst($cmd["filename"]) . "Page"; $classfile = $path; $data["modified"] = filemtime($classfile); } } require_once $classfile; $page = new $classname($data, $error); self::$instance = $page; return self::$instance; }
private function test_utility_helper() { $this->unit->use_strict(true); $this->unit->run(get_github_url(), 'is_string', 'get_github_url()'); $this->unit->run(get_facebook_url(), 'is_string', 'get_facebook_url()'); $this->unit->run(get_twitter_url(), 'is_string', 'get_twitter_url()'); $this->unit->run(get_google_map_key(), 'is_string', 'get_google_map_key()'); $this->unit->run(get_ga_code(), 'is_string', 'get_ga_code()'); $this->unit->run(is_null_or_empty_string(''), 'is_true', 'is_null_or_empty_string()'); $this->unit->run(is_null_or_empty_string('test'), 'is_false', 'is_null_or_empty_string()'); $this->unit->run(is_null_or_empty_string(1), 'is_false', 'is_null_or_empty_string()'); $this->unit->run(start_with('abcdef', 'ab'), 'is_true', 'start_with()'); $this->unit->run(start_with('abcdef', 'cd'), 'is_false', 'start_with()'); $this->unit->run(start_with('abcdef', 'ef'), 'is_false', 'start_with()'); $this->unit->run(start_with('abcdef', ''), 'is_true', 'start_with()'); $this->unit->run(start_with('', 'abcdef'), 'is_false', 'start_with()'); $this->unit->run(end_with("abcdef", "ab"), 'is_false', 'end_with()'); $this->unit->run(end_with("abcdef", "cd"), 'is_false', 'end_with()'); $this->unit->run(end_with("abcdef", "ef"), 'is_true', 'end_with()'); $this->unit->run(end_with("abcdef", ""), 'is_true', 'end_with()'); $this->unit->run(end_with("", "abcdef"), 'is_false', 'end_with()'); $this->unit->run(get_domain_name('http://somedomain.co.uk'), 'somedomain.co.uk', 'get_domain_name()'); $this->unit->run(get_domain_name('http://www2.manager.co.th'), 'manager.co.th', 'get_domain_name()'); $this->unit->run(get_domain_name('http://test.manager.co.th'), 'manager.co.th', 'get_domain_name()'); $this->unit->run(get_domain_name('http://manager.co.th'), 'manager.co.th', 'get_domain_name()'); $this->unit->run(get_domain_name('http://thaiware.com'), 'thaiware.com', 'get_domain_name()'); $this->unit->run(get_domain_name('http://www.thaiware.com'), 'thaiware.com', 'get_domain_name()'); $this->unit->run(get_domain_name('http://test.thaiware.com'), 'thaiware.com', 'get_domain_name()'); $this->unit->run(get_domain_name('http://www.studentloan.ktb.co.th/'), 'ktb.co.th', 'get_domain_name()'); $this->unit->run(get_domain_name('http://www.studentloan.ktb.co.th/dasdasdasd.html'), 'ktb.co.th', 'get_domain_name()'); $this->unit->run(get_domain_name('http://www.studentloan.ktb.co.th?quewadsas=2faddasdas'), 'ktb.co.th', 'get_domain_name()'); $this->unit->run(get_domain_name('http://www.studentloan.ktb.co.th/2011/20/01?=asdasdasdasd'), 'ktb.co.th', 'get_domain_name()'); $this->unit->run(get_domain_name('http://pantip.com/forum/siam'), 'pantip.com', 'get_domain_name()'); $this->unit->run(get_domain_name('http://www.wegointer.com/category/variety/'), 'wegointer.com', 'get_domain_name()'); $this->unit->run(get_domain_name(), 'lab.jojoee.com', 'get_domain_name()'); $this->unit->run(get_full_domain_name('http://www.wegointer.com/category/variety/'), 'www.wegointer.com', 'get_domain_name()'); $this->unit->run(get_full_domain_name('http://somedomain.co.uk'), 'somedomain.co.uk', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://www2.manager.co.th'), 'www2.manager.co.th', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://test.manager.co.th'), 'test.manager.co.th', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://manager.co.th'), 'manager.co.th', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://thaiware.com'), 'thaiware.com', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://www.thaiware.com'), 'www.thaiware.com', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://test.thaiware.com'), 'test.thaiware.com', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://www.studentloan.ktb.co.th/'), 'www.studentloan.ktb.co.th', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://www.studentloan.ktb.co.th/dasdasdasd.html'), 'www.studentloan.ktb.co.th', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://www.studentloan.ktb.co.th?quewadsas=2faddasdas'), 'www.studentloan.ktb.co.th', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://www.studentloan.ktb.co.th/2011/20/01?=asdasdasdasd'), 'www.studentloan.ktb.co.th', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://pantip.com/forum/siam'), 'pantip.com', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://www.wegointer.com/category/variety/'), 'www.wegointer.com', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name(), 'lab.jojoee.com', 'get_full_domain_name()'); $url = 'http://sub.wegointer.com/category/variety/'; $this->unit->run(get_request_url($url, get_full_domain_name($url)), '/category/variety', 'get_request_url()'); $url = 'http://www.wegointer.com/category/variety/'; $this->unit->run(get_request_url($url, get_full_domain_name($url)), '/category/variety', 'get_request_url()'); $this->unit->run(get_full_url(), 'http://lab.jojoee.com/nn/test', 'get_full_url()'); // 404, 301 // $this->unit->run(is_url_exists('http://jojoee.com/404'), 'is_true', 'is_url_exists()'); // $this->unit->run(is_url_exists('http://fashion.spokedark.tv/2015/04/24/dichan-magazine/'), 'is_true', 'is_url_exists()'); // $this->unit->run(is_url_exists('http://www.jojoee.com/'), 'is_true', 'is_url_exists()'); // $this->unit->run(is_url_exists('http://test4041.com/'), 'is_false', 'is_url_exists()'); // $this->unit->run(is_url_exists('http://test4041.com/'), 'is_false', 'is_url_exists()'); // $this->unit->run(is_url_redirects('http://www.jojoee.com/'), 'is_true', 'is_url_exists()'); // $this->unit->run(is_404('http://jojoee.com/404'), 'is_true', 'is_404()'); // $url = 'http://fashion.spokedark.tv/?p=6600'; // $this->unit->run(is_url_exists($url), 'is_true', 'is_url_exists()'); // $this->unit->run(is_url_redirects($url), 'is_true', 'is_url_redirects()'); // don't know why it doesn't work // $url = 'http://movies.spokedark.tv?p=10054/'; // $this->unit->run(is_url_exists($url), 'is_true', 'is_url_exists()'); // $this->unit->run(is_url_redirects($url), 'is_true', 'is_url_redirects()'); $this->unit->run(get_extension('file.jpeg'), 'jpeg', 'get_extension()'); $this->unit->run(get_extension('file.bk.zip'), 'zip', 'get_extension()'); $this->unit->run(remove_trailing_slash('/category/product/'), '/category/product', 'remove_trailing_slash()'); $this->unit->run(remove_trailing_slash('/category/product'), '/category/product', 'remove_trailing_slash()'); $this->unit->run(remove_trailing_slash('category/product/'), 'category/product', 'remove_trailing_slash()'); for ($i = 0; $i < 20; $i++) { $urls = $this->get_posts(); foreach ($urls as $url) { $this->unit->run($url['is_publish'], '0', 'get_posts()'); } } }
function set_breadscrum() { $CI =& get_instance(); if ($CI->input->is_cli_request()) { // Skip the breadscrum for cli request return; } if (isset($CI->action_model) && !$CI->action_model->getCurrentAction()) { return; } $CI->load->library('session'); $scrums = get_breadscrums(); if (count($scrums) && get_request_url() == $scrums[count($scrums) - 1]) { return; } $scrums[] = get_request_url(); if (count($scrums) > get_ci_config('breadscrum_depth', 5)) { array_shift($scrums); } $CI->session->set_userdata('bread_scrums', $scrums); }
function get_request_uri($uri, $full_domain_name) { return get_request_url($uri, $full_domain_name); }