Plugins, it should be in the list. Activtate it
and avery occurence of the expression [app itemId] (case sensitive) will
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");
wp_enqueue_style('thickbox');
wp_enqueue_script('jquery');
wp_enqueue_script('thickbox');
// Just the default output
function AppStoreLinks_plugin_callback($match) {
$searchid = $match[1];
return AppStoreLinks_getContent($searchid,0);
}
// Extended (with Images)
function AppStoreLinks_plugin_callback_ext($match) {
$searchid = $match[1];
return AppStoreLinks_getContent($searchid,1);
}
// Extended (just Images)
function AppStoreLinks_plugin_callback_img($match) {
$searchid = $match[1];
return AppStoreLinks_getContent($searchid,2);
}
function appstore_defaults_array() {
$defaults = array(
'id'=> '',
'screenshots'=>false);
return $defaults;
}
function appstore_process($atts, $content=null, $code="" ) {
$a = shortcode_atts(appstore_defaults_array(), $atts );
extract($a);
$showScreenshots = 0;
if ($screenshots==true) {
$showScreenshots = 1;
}
if ($id<>"") {
return AppStoreLinks_getContent($id,$showScreenshots);
}
}
function AppStoreLinks_getContent($searchid,$type) {
list( $obj , $spanOverlay ) = getContent($searchid);
if ($obj==false) {
return "Artikel wurde nicht gefunden";
}
//Keine Maske bei App-Software
if ($obj->results[0]->kind=="mac-software") {
$isMacSoftware = 1;
} else {
$isMacSoftware = 0;
}
// Alternative
if ($obj->results[0]->genreIds[0]>=12000) {
$isMacSoftware = 1;
} else {
$isMacSoftware = 0;
}
$output = "";
if ($type < 2) {
// Read Content
if ($isMacSoftware == 1) {
$artworkUrl60 = $obj->results[0]->artworkUrl100;
} else {
$artworkUrl60 = $obj->results[0]->artworkUrl60;
}
$artworkUrl60 = $obj->results[0]->artworkUrl60;
$trackName = $obj->results[0]->trackName;
$price = $obj->results[0]->price;
$AppStore_country = get_option("AppStore_country");
$language = get_option("AppStore_language");
if ($price == 0.00000) {
$price = __("Kostenlos","appstore");
} else {
$price .= getCurrency($AppStore_country);
}
$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, $isMacSoftware);
$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');
$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 = '';
}
// Language Options
if ($language == "de_de") {
$langDeveloper = "Hersteller:";
$langPrice = "Preis:";
$langAgeRating = "Freigabe:";
$langRating = "Bewertung:";
} else {
$langDeveloper = "Developer:";
$langPrice = "Price:";
$langAgeRating = "Rated:";
$langRating = "Rating:";
}
// Get Rating
if (get_option("AppStore_showRatings")=='checked'){
$averageUserRatingForCurrentVersion = $obj->results[0]->averageUserRatingForCurrentVersion;
$userRatingCountForCurrentVersion = $obj->results[0]->userRatingCountForCurrentVersion;
$averageUserRating = $obj->results[0]->averageUserRating;
$userRatingCount = $obj->results[0]->userRatingCount;
// not enough ratings
if (is_null($averageUserRatingForCurrentVersion)==true){
$averageUserRatingForCurrentVersion = 0;
$userRatingCountForCurrentVersion = "not enough";
}
// not enough ratings
if (is_null($averageUserRating)==true){
$averageUserRating = 0;
$userRatingCount = "not enough";
}
if ($averageUserRatingForCurrentVersion>0){
$ratingHTML = '
';
} else {
$ratingHTML = '';//nicht genügend Bewertungen';
}
} else {
$ratingHTML = "";
}
// Create Output
$output .= ''.$spanOverlay;
$output .= '';
$output .= ' ';
$output .= ''.$trackName.'
';
$output .= ''.$langDeveloper.' '.$sellerName.'
';
$output .= ''.$langAgeRating.' '.$contentAdvisoryRating.$ratingHTML.'
';
$output .= ''.$langPrice.' '.$price.' ';
//$output .= ''.$langRating.' '.$ratingHTML;
$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 .= '
If you like the Appstore Plugin, you can support its development by a donation: