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");
@include ("searchwidget.php");
wp_enqueue_style('thickbox');
wp_enqueue_script('jquery');
wp_enqueue_script('thickbox');
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;
}
// old System
if ($id=="") {
$id = $atts[0];
}
if ($content<>null){
return appstore_getCustom($id, $content);
}
if ($id<>"") {
return AppStoreLinks_getContent($id,$showScreenshots);
}
}
function appstore_process_ext($atts, $content=null, $code="" ) {
$showScreenshots = 1;
$id = $atts[0];
if ($id<>"") {
return AppStoreLinks_getContent($id,$showScreenshots);
}
}
function appstore_process_img($atts, $content=null, $code="" ) {
$showScreenshots = 2;
$id = $atts[0];
if ($id<>"") {
return AppStoreLinks_getContent($id,$showScreenshots);
}
}
function appstore_getCustom($searchid, $content) {
list( $obj , $spanOverlay ) = getContent($searchid);
if ($obj==false) {
return "Product not found";
}
// Variablen
$AppStore_country = get_option("AppStore_country");
$trackName = $obj->results[0]->trackName;
$formattedPrice = $obj->results[0]->formattedPrice;
$sellerName = $obj->results[0]->sellerName;
$sellerUrl = $obj->results[0]->sellerUrl;
$contentAdvisoryRating = $obj->results[0]->contentAdvisoryRating;
$description = str_replace("\n", "
", $obj->results[0]->description);
$AffLink = WP_PLUGIN_URL."/".PLUGIN_BASE_DIRECTORY."/AppStore.php?appid=".$searchid;
$DLLink = ''.APPSTORE_DL_LINKNAME.'';
$ratingHTML = ''.getRatingStars($obj).'';
$artwork100 = $obj->results[0]->artworkUrl100;
$artwork60 = $obj->results[0]->artworkUrl60;
$artwork512 = $obj->results[0]->artworkUrl512;
$averageUserRating = $obj->results[0]->averageUserRating;
$averageUserRatingForCurrentVersion = $obj->results[0]->averageUserRatingForCurrentVersion;
$releaseNotes = $obj->results[0]->releaseNotes;
// {trackname}, {sellername}, {dllink}, {price}, {stars}, {description}, {artwork100}, {artwork60}
$content = str_replace("{id}",$id,$content);
$content = str_replace("{trackname}",$trackName,$content);
$content = str_replace("{sellername}",$sellerName,$content);
$content = str_replace("{dllink}",$DLLink,$content);
$content = str_replace("{affurl}",$AffLink,$content);
$content = str_replace("{price}",$formattedPrice,$content);
$content = str_replace("{stars}",$ratingHTML,$content);
$content = str_replace("{description}",$description,$content);
$content = str_replace("{artwork100}",$artwork100,$content);
$content = str_replace("{artwork60}",$artwork60,$content);
$content = str_replace("{artwork512}",$artwork512,$content);
$content = str_replace("{averageuserrating}",$averageUserRating,$content);
$content = str_replace("{averageuserratingforcurrentversion}",$averageUserRatingForCurrentVersion,$content);
$content = str_replace("{releasenotes}",$releaseNotes,$content);
return $content;
}
function getRatingStars($obj,$class="") {
// Get Rating
$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";
}
//'#container li {background: url(stars.png) no-repeat top left;}'
if ($averageUserRatingForCurrentVersion>0){
if ($class<>"") {
$class = 'class="'.$class.'"';
}
$ratingHTML = '
';
/*$ratingClass = 'sprite-stars'.str_replace('.','',$averageUserRatingForCurrentVersion ) ;
$ratingHTML = '
| ';
$searchresult .= '';
$searchresult .= ' | ';
//$searchresult .= "".$trackName."'.$trackName.' '; $searchresult .= 'Hersteller: '.$sellerName.' '; $searchresult .= 'Freigabe: '.$contentAdvisoryRating.' '; $searchresult .= 'Preis: '.$formattedPrice.' '; $searchresult .= 'Download via iTunes | ';
$searchresult .= 'Beschreibung: '.$description.' | ';
$searchresult .= '
If you like the Appstore Plugin, you can support its development by a donation: