Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getGooglePlay($item_id) {
- if($this->is_cached($item_id)) return($this->get_cached_data($item_id));
- $page_url = $this->get_store_url('googleplay', $item_id);
- $this_content = $this->get_fcontent(urldecode($page_url));
- if($this->echo_parse_output()) print_r($this_content);
- if((isset($this_content[0])) && ($this_content[1]['http_code'] == '200')) {
- phpQuery::newDocumentHTML($this_content[0]);
- $error_found = pq("#error-section")->text();
- if($error_found != '') return 0;
- $banner_icon = pq('img.cover-image[itemprop="image"]')->attr('src');
- $banner_icon = str_replace('=w300', '=w128', $banner_icon);
- $app_video = str_replace('autoplay=1', 'autoplay=0', pq('span.play-action-container')->attr('data-video-url'));
- $app_title = pq('div[itemprop="name"]>div')->html();
- $app_author = pq('div[itemprop="author"]>a>span[itemprop="name"]')->html();
- $author_store_url = 'https://play.google.com'.pq('div[itemprop="author"]>meta[itemprop="url"]')->attr('content');
- $app_price = pq('meta[itemprop="price"]')->attr('content');
- $app_rating = pq('meta[itemprop="ratingValue"]')->attr('content');
- if((strpos($app_price, ",") == false) && (strpos($app_price, ".") == false)) $app_price = __('Kostenlos', 'wp-appbox');
- foreach(pq('img[itemprop="screenshot"]') as $appshots) {
- $app_screen_shots = pq($appshots)->attr('src');
- if(substr($app_screen_shots, -8, 8) == '=h310-rw') $app_screen_shots = str_replace('=h500', '', $app_screen_shots);
- $app_info['ScreenShots'][] = (object) array('screen_shot' => $app_screen_shots);
- }
- $app_store_url = $page_url;
- $app_info['General'][] = (object) array(
- 'app_id' => $item_id,
- 'app_store_url' => $app_store_url,
- 'banner_icon' => $banner_icon,
- 'app_video' => $app_video,
- 'app_title' => $app_title,
- 'app_author' => $app_author,
- 'author_store_url' => $author_store_url,
- 'app_price' => $app_price,
- 'app_rating' => $app_rating,
- 'storename' => 'Google Play',
- 'storename_css' => 'googleplay',
- 'fallback' => '0'
- );
- $this->save_data_to_cache($item_id, $app_info);
- return $app_info;
- }
- if(($this_content[1]['http_code'] == '503') || ($this_content[1]['http_code'] == '302')) {
- $app_info['General'][] = (object) array(
- 'app_id' => '0',
- 'app_store_url' => $page_url,
- 'banner_icon' => plugins_url('wp-appbox/img/fallback/googleplay.png'),
- 'app_title' => __('Download', 'wp-appbox').' @ Play Store',
- 'storename' => 'Google Play',
- 'storename_css' => 'googleplay',
- 'fallback' => '1'
- );
- //$this->save_data_to_cache($item_id, $app_info);
- return $app_info;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment