Plugins, it should be in the list. Activtate it
and avery occurence of the expression [app itemId] (case sensitive) will
embed an Appstore AppLogo, Name, Price, aso.
Thanks to Manuel, Alexander and Dave who helped me developing this Plugin
*/
if ( !defined('ABSPATH') ) {
require_once ( '../../../wp-blog-header.php');
}
include ("AppFunctions.php");
include ("definitions.php");
include ("widget.php");
//include ("rewrite.php");
//wp_enqueue_script('jquery');
wp_enqueue_style('thickbox');
wp_enqueue_script('jquery');
wp_enqueue_script('thickbox');
function AppStoreLinks_plugin_callback($match) {
$searchid = $match[1];
return AppStoreLinks_getContent($searchid);
}
function AppStoreLinks_getContent($searchid) {
list( $obj , $spanOverlay ) = getContent($searchid);
if ($obj==false) {
return "Artikel wurde nicht gefunden";
}
// Read Content
$artworkUrl60 = $obj->results[0]->artworkUrl60;
$trackName = $obj->results[0]->trackName;
$price = $obj->results[0]->price;
$AppStore_country = get_option("AppStore_country");
if ($price == 0.00000) {
$price = "Kostenlos";
} else {
if( $AppStore_country == "US") {
$price .= " USD";
} elseif ($AppStore_country == "CH") {
$price .= " CHF";
} else {
$price .= " EUR";
}
}
$sellerName = $obj->results[0]->sellerName;
$sellerUrl = $obj->results[0]->sellerUrl;
$contentAdvisoryRating = $obj->results[0]->contentAdvisoryRating;
$description = str_replace("\n", "
", $obj->results[0]->description);
$cacheimageurl = getImage($searchid, $artworkUrl60);
$AffLink = WP_PLUGIN_URL."/".PLUGIN_BASE_DIRECTORY."/AppStore.php?appid=".$searchid;
// ToDo: Checken ob Thickbox installiert ist
if (1==2) {
$ThickURL = esc_url($AffLink.''.$searchid.';TB_iframe=true'.$searchid.';width=800'.$searchid.';height=800');
//$ThickURL = esc_url($AffLink.'&'.$searchid.';TB_iframe=true&'.$searchid.';width=800&'.$searchid.';height=800&inlineId=myOnPageContent');
$ThickBoxLink = '';
} else {
$ThickBoxLink = '';
}
// Update Benachrichtigung, aber nur wenn nicht aus Appstore entfernt
$UpdateTimeSpan = time() - (3*24*60*60); // 3Tage
$releaseDate = strtotime($obj->results[0]->releaseDate);
if (($releaseDate >= $UpdateTimeSpan) && ($spanOverlay == "")) {
$spanOverlay = '';
}
//$output .= '';
//$output .= '
';
// Create Output
$output = ''.$spanOverlay;
$output .= '';
$output .= ' ';
$output .= ''.$trackName.'
';
$output .= 'Hersteller: '.$sellerName.'
';
$output .= 'Freigabe: '.$contentAdvisoryRating.'
';
$output .= 'Preis: '.$price.' ';
//$output .= ''.APPSTORE_DL_LINKNAME.'';
$output .= ''.$ThickBoxLink.APPSTORE_DL_LINKNAME.'';
$output .= '
| ';
$searchresult .= '';
$searchresult .= ' | ';
//$searchresult .= "".$trackName."'.$trackName.' '; $searchresult .= 'Hersteller: '.$sellerName.' '; $searchresult .= 'Freigabe: '.$contentAdvisoryRating.' '; $searchresult .= 'Preis: '.$price.' '; $searchresult .= 'Download via iTunes | ';
$searchresult .= 'Beschreibung: '.$description.' | ';
$searchresult .= '