" ."
";
return $strHtml;
}
function createLinkAppStore($idApp){
list($keyApp, $prezzoOrig) = explode('|', $idApp);
$obj = getContentApp($keyApp);
if($obj->{'resultCount'} > 0){
// prendo il primo risultato.. do per scontato che ce ne sia soltanto uno
//function createHTMLAppStore($linkImg, $nomeApp, $categoriaApp, $prezzoApp, $pesoApp, $linkAppStore, $votoApp)
$linkImg = $obj->results[0]->artworkUrl100;
if (empty($linkImg ))
$linkImg = $obj->results[0]->artworkUrl60;
$nomeApp = $obj->results[0]->trackName;
$categoriaApp = $obj->results[0]->primaryGenreName;
$prezzoApp = $obj->results[0]->price;
$pesoApp = $obj->results[0]->fileSizeBytes;
$linkAppStore = $obj->results[0]->trackViewUrl;
$votoApp = $obj->results[0]->averageUserRating;
if(!$prezzoApp >0)
$prezzoApp = "Gratis";
// trasformo il peso il kb
$pesoApp = (ceil($pesoApp / 1024)) . "Kb";
$linkAppStor2 = $linkAppStore;
$strHtml = createHTMLAppStore($linkImg, $nomeApp, $categoriaApp, $prezzoApp, $pesoApp, $linkAppStor2, $votoApp, $prezzoOrig);
return $strHtml;
}
}
function getContentApp($idApp){
$searchlink = APPSTORESEARCHLINK.$idApp;
$result = @file_get_contents($searchlink);
// Decode Content
$obj = json_decode($result);
return $obj;
}
function AppStoreLinks_plugin_BelloWeb($content)
{
return (preg_replace_callback(APPSTORELINKS_REGEXP, 'AppStoreLinks_plugin_BelloWeb_callback', $content));
}
add_filter('the_content', 'AppStoreLinks_plugin_BelloWeb');
?>