function GetPageData($pac, $info_mode) { $query = GetFeedwebUrl() . "FBanner.aspx?action=gpd&icon=edit&pac=" . $pac; if ($info_mode == true) { $query .= "&mode=info"; } $bac = GetBac(true); if ($bac != null) { $query = $query . "&bac=" . $bac; } $response = wp_remote_get($query, array('timeout' => 30)); if (is_wp_error($response)) { return null; } $dom = new DOMDocument(); if ($dom->loadXML($response['body']) == true) { if ($dom->documentElement->tagName == "BANNER") { $data['id'] = $dom->documentElement->getAttribute("id"); $data['error'] = $dom->documentElement->getAttribute("error"); if ($info_mode == true) { $data['url'] = $dom->documentElement->getAttribute("url"); $data['lang'] = $dom->documentElement->getAttribute("lang"); $data['title'] = $dom->documentElement->getAttribute("title"); $data['author'] = $dom->documentElement->getAttribute("author"); $data['author_id'] = $dom->documentElement->getAttribute("aid"); $data['visible'] = Str2Bool($dom->documentElement->getAttribute("visible")); if ($data['visible'] == "true") { $data['img'] = $dom->documentElement->getAttribute("img"); $data['tags'] = $dom->documentElement->getAttribute("tags"); $data['brief'] = $dom->documentElement->getAttribute("brief"); $data['cnl_id'] = $dom->documentElement->getAttribute("cnl_id"); $data['categories'] = $dom->documentElement->getAttribute("categories"); $data['censorship'] = $dom->documentElement->getAttribute("censorship"); $data['ad_content'] = Str2Bool($dom->documentElement->getAttribute("ad_content")); } $data['questions'] = ReadQuestionList($dom->documentElement); } else { $data['image'] = $dom->documentElement->getAttribute("image"); $data['votes'] = $dom->documentElement->getAttribute("votes"); $data['score'] = $dom->documentElement->getAttribute("score"); $data['answers'] = ReadAnswerList($dom->documentElement); } return $data; } } return null; }
function GetQuestionList($pac) { // Get BAC instead of site URL (from 2.1.6) $bac = GetBac(true); if ($bac == null) { return null; } $data = GetFeedwebOptions(); $query = GetFeedwebUrl() . "FBanner.aspx?action=gql&lang=" . $data["language"] . "&bac=" . $bac; if ($pac != null) { $query = $query . "&pac=" . $pac; } $response = wp_remote_get($query, array('timeout' => 60)); if (is_wp_error($response)) { return null; } $dom = new DOMDocument(); if ($dom->loadXML($response['body']) == true) { if ($dom->documentElement->tagName == "BANNER") { return ReadQuestionList($dom->documentElement); } } return null; }