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 = ''.$averageUserRatingForCurrentVersion.
						''; /*$ratingClass = 'sprite-stars'.str_replace('.','',$averageUserRatingForCurrentVersion ) ; $ratingHTML = '
';*/ } else { $ratingHTML = '';//nicht genügend Bewertungen'; } return $ratingHTML; } 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"); $currency = $obj->results[0]->currency; $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); $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:","appstore"); $langPrice = __("Price:","appstore"); $langAgeRating = __("Rated:","appstore"); $langRating = __("Rating:","appstore"); } if (get_option("AppStore_showRatings")=='checked'){ $ratingHTML = getRatingStars($obj,'ratingStarsImg'); } else { $ratingHTML = ""; } // Create Output $output .= ''.$spanOverlay; $output .= ''; $output .= ''.$trackName.' (AppStore Link) '; $output .= ''.$trackName.'
'; $output .= ''.$langDeveloper.' '.$sellerName.'
'; $output .= '
'.$langAgeRating.' '.$contentAdvisoryRating.$ratingHTML.'
'; $output .= ''.$langPrice.' '.$formattedPrice.' '; if (APPSTORE_DL_LINKNAME != '') { $output .= ''.$ThickBoxLink.APPSTORE_DL_LINKNAME.''; } else { if ($isMacSoftware == 1) { $badgeURL = WP_PLUGIN_URL."/".PLUGIN_BASE_DIRECTORY."/images/Mac_App_Store_small.gif"; } else { $badgeURL = WP_PLUGIN_URL."/".PLUGIN_BASE_DIRECTORY."/images/App_Store_small.gif"; } $output .= $ThickBoxLink.''; } $output .= '
'; } $screenshots = ""; if ($type >= 1 /* && $obj->results[0]->screenshotUrls[0] <> '' */ ) { $screenshots .= "
'; } if ($type == 1 && $isMacSoftware == 0 ) { return ('
'.$output.$screenshots."
"); } else { return ($output.$screenshots); } } if ( $_REQUEST['appid'] != "" ) { header("Location: ".AppStore_getAff($_REQUEST['appid'])); } if ( $_REQUEST['appsearch'] != "" ) { $result = file_get_contents(APPSTORESEARCHLINKNAME.urlencode($_REQUEST['appsearch'])); // Decode Content $obj = json_decode($result); $count = $obj->resultCount; $searchresult = "" ; if ($count > 0){ for ( $i = 0; $i < $count; $i++) { $afflink = AppStore_CreateLink($obj->results[$i]->trackViewUrl); $imageUrl = $obj->results[$i]->artworkUrl60; $trackName = $obj->results[$i]->trackName; // Lange Titel kürzen if (strlen($trackName)>=40) { $trackName = left($obj->results[$i]->trackName,37)."..." ; } //$searchresult .= '
  • '; $searchresult .= ''; $searchresult .= ''.$trackName.' (AppStore Link) '; $searchresult .= "".$trackName."

    "; //$searchresult .= } //$searchresult .= ""; echo $searchresult; } } if ( $_REQUEST['searchDetail'] != "" ) { $result = file_get_contents(APPSTORESEARCHLINKNAME.urlencode($_REQUEST['searchDetail'])); // Decode Content $obj = json_decode($result); $count = $obj->resultCount; $searchresult = '
    Deine Suche hat '.$count.' Resultate erzielt

    ' ; if ($count > 0){ for ( $i = 0; $i < $count; $i++) { $afflink = AppStore_CreateLink($obj->results[$i]->trackViewUrl); $imageUrl = $obj->results[$i]->artworkUrl60; $trackName = $obj->results[$i]->trackName; $description = left($obj->results[$i]->description,400)."..."; $trackName = $obj->results[$i]->trackName; $contentAdvisoryRating = $obj->results[$i]->contentAdvisoryRating; $sellerName = $obj->results[$i]->sellerName; $sellerUrl = $obj->results[$i]->sellerUrl; $price = $obj->results[$i]->price; $AppStore_country = get_option("AppStore_country"); $currency = $obj->results[0]->currency; $formattedPrice = $obj->results[0]->formattedPrice; $searchresult .= ''; //$searchresult .= "".$trackName."
    "; $searchresult .= ''; $searchresult .= ' '; $searchresult .= '
    '; $searchresult .= ''; $searchresult .= ''.$trackName.' (AppStore Link) '.$trackName.'
    '; $searchresult .= 'Hersteller: '.$sellerName.'
    '; $searchresult .= 'Freigabe: '.$contentAdvisoryRating.'
    '; $searchresult .= 'Preis: '.$formattedPrice.' '; $searchresult .= 'Download via iTunes
    Beschreibung:
    '.$description.'


    '; } } echo $searchresult; } function AppStoreLinks_activate() { // ToDo: Testen ob Jason installiert ist! add_option("AppStore_country","at"); add_option("AppStore_language","de_de"); add_option("AppStore_picCache","12"); add_option("AppStore_dataCache","6"); add_option("AppStore_dlLinkname","Download (Aff.Link)"); add_option("AppStore_tdlink","2157876"); add_option("AppStore_Loop",0); add_option("AppStore_SimpleClickCounter",0); add_option("appStore_db_version", "0"); add_option("AppStore_style",".appImageContainer {width: auto;margin: 0px;}"); add_option("AppStore_showRatings", "0"); add_option("AppStore_enableStats", "checked"); add_option("AppStore_customAffURL",""); // Datenbank installieren global $appStore_db_version; $appStore_db_version = "0.6"; global $wpdb; $tablename = $wpdb->prefix.APPSTORE_TABLENAME; if(($wpdb->get_var("show tables like '$tablename'") != $tablename) || ($appStore_db_version <> get_option("appStore_db_version"))) { //price NUMERIC(5,2), //currency char(3) DEFAULT '' NOT NULL, $sql = "CREATE TABLE " . $tablename . " ( id mediumint(9) NOT NULL AUTO_INCREMENT, appid bigint(11) DEFAULT '0' NOT NULL, country char(5) DEFAULT '' NOT NULL, user_agent char(150) DEFAULT '' NOT NULL, ip char(15) DEFAULT '' NOT NULL, createdWhen TIMESTAMP NOT NULL, UNIQUE KEY id (id) );"; require_once(ABSPATH.'wp-admin/includes/upgrade.php'); dbDelta($sql); update_option("appStore_db_version", $appStore_db_version ); } // check cache Directory if (!file_exists(APPSTORE_CONTENT_DIR)){ mkdir(APPSTORE_CONTENT_DIR) or error_message('Das Cache Verzeichnis konnte nicht angelegt werden'); // Legt das Cache Verzeichnis an. Sollte dies nicht möglich sein, so wird ein Fehler ausgegeben } chmod(APPSTORE_CONTENT_DIR, 0777); // Gibt dem Cache Verzeichniss die nötigen Schreib- und Lese Rechte // Check allow_url_fopen if(allow_url_fopen=='off') { echo'"allow_url_fopen" ist auf diesem Server deaktiviert, wird aber benötigt.
    '; echo'Bitte aktivieren sie diese Funktion (setzten sie sich ggf. mit ihrem Hoster in verbindung. '; } } function WPWall_ScriptsAction() { wp_enqueue_script('thickbox'); } // Nur wenn der User Adminrechte hat ist if(is_admin()){ add_action('admin_menu', 'AppStore_options'); } ///////////////////// // Optionen einbinden ///////////////////// function AppStore_options() { add_menu_page('Settings', 'AppStore', 3, basename(__FILE__), 'AppStore_options_page', WP_PLUGIN_URL."/".PLUGIN_BASE_DIRECTORY.'/button/mcebutton.png'); if (get_option("AppStore_enableStats")=="checked") { add_submenu_page( basename(__FILE__), 'Statistik', 'Statistik', 3, 'AppStoreStatistik', 'AppStoreshowStatistik'); } } function AppStore_options_page() { $AdminPage = null; if(isset($_POST['AppStore_save_options'])) { update_option("AppStore_country",attribute_escape($_POST['AppStore_country'])); update_option("AppStore_language",attribute_escape($_POST['AppStore_language'])); update_option("AppStore_picCache",attribute_escape($_POST['AppStore_picCache'])); update_option("AppStore_dataCache",attribute_escape($_POST['AppStore_dataCache'])); update_option("AppStore_dlLinkname",attribute_escape($_POST['AppStore_dlLinkname'])); update_option("AppStore_tdlink",attribute_escape($_POST['AppStore_tdlink'])); update_option("AppStore_style",attribute_escape($_POST['AppStore_style'])); update_option("AppStore_showRatings",attribute_escape($_POST['AppStore_showRatings'])); update_option("AppStore_enableStats",attribute_escape($_POST['AppStore_enableStats'])); update_option("AppStore_customAffURL",attribute_escape($_POST['AppStore_customAffURL'])); update_option("AppStore_PHGToken",attribute_escape($_POST['AppStore_PHGToken'])); } $Countries = getCountries(); asort($Countries); $language = array( "de_de" => __("Deutsch", 'appstore'), "es_es" => __("Spanisch", 'appstore'), "it_it" => __("Italienisch", 'appstore'), "pl_pl" => __("Polnisch", 'appstore'), "zh_cn" => __("Chinesisch", 'appstore'), "de_de" => __("Deutsch", 'appstore'), "en_us" => __("Englisch", 'appstore') ); asort($language); $AdminPage .= "
    Donate

    If you like the Appstore Plugin, you can support its development by a donation:



    \"\"

    My Amazon.de wishlist

    News

    ".__("AppStore-Plugin Settings", 'appstore')."

    ".__("This Plugin is easyly to use with [app 123456].", 'appstore')."

    ".__("iTunes-Store Country:", 'appstore')."(?)
    ".__("Language:", 'appstore')."(?)
    ".__("Cachingtime pictures (in h):", 'appstore')."(?)
    ".__("Cachingtime data (in h):", 'appstore')."(?)
    ".__("Downloadlink name:", 'appstore').'
    '.__(" (set empty to display logo)",'appstore')."
    ".__("PHG affiliate token :", 'appstore')."(?)
    ".__("Custom affiliate URL:", 'appstore')."(?)
    ".__("Activate ratings:", 'appstore')."
    ".__("Activat statistics:", 'appstore')."
    ".__("Style (CSS):", 'appstore')."

    ".__("Usage and example", 'appstore')."

    ".__("You will get the app-id from the iTunes-Store. Simply copy the link and look for the Number near the end of the link. Otherwise you can use http://appsuche.touchtalk.at to get an embedcode.", 'appstore')."

    http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=284417350&mt=8

    [app 284417350] ".__("This should insert the Apple remote app in your post.", 'appstore')."
    [appimg 284417350] ".__("only shows the screenshot.", 'appstore')."
    [appext 284417350] ".__("more extendet view.", 'appstore')."

    ".__("Info", 'appstore')."

    ".__("Country", 'appstore')."

    ".__("The country where the app is loaded (because not every app is in every store)", 'appstore')."

    ".__("Language", 'appstore')."

    ".__("If you change the language or the country, maybe deleting the cache is a good choice", 'appstore')."

    ".__("Cachingtime", 'appstore')."

    ".__("How often the data is loadet from the server", 'appstore')."

    ".__("PHG-Token", 'appstore')."

    ".__("To earn money ;-)", 'appstore')."

    ".__("Custom Affiliate URL:", 'appstore')."

    ".__("To use alternate affiliate programs.
    zB: http://click.linksynergy.com/fs-bin/stat?id=AAAAAAAA&offerid=100000&type=3&subid=0&tmpid=0006&RD_PARM1={URL}&partnerId=99 ", 'appstore')."

    ".__("Unterstützung", 'appstore')."

    ".__("As you know, developer do not really earn a lot of money. Sad, but true. Thats the reason every Du weißt ja, ein Entwickler ist prinzipiell arm. Ja,. click (not sale) goes to our PGH-ID. So please do not remove this code. Thanks!", 'appstore'); echo $AdminPage; } function AppStoreLinks_SetSyle() { echo ''; $individualStyle = get_option("AppStore_style"); if ($individualStyle <> "") { echo ""; } } function admin_register_head() { $siteurl = get_option('siteurl'); $url = $siteurl . '/wp-content/plugins/' . basename(dirname(__FILE__)) . '/css/AppStore.css'; echo "\n"; } function appstore_add_button($buttons) { array_push($buttons, "separator", "appstoreButton"); return $buttons; } function appstore_register($plugin_array) { $siteurl = get_option('siteurl'); $url = $siteurl . '/wp-content/plugins/' . basename(dirname(__FILE__)) . '/button/editor_plugin.js'; $plugin_array['appstoreButton'] = $url; return $plugin_array; } add_filter('mce_external_plugins', "appstore_register"); add_filter('mce_buttons', 'appstore_add_button', 0); add_action('wp_print_scripts', 'WPWall_ScriptsAction'); add_action('wp_head', 'AppStoreLinks_SetSyle'); add_action('admin_head', 'admin_register_head'); add_shortcode('app', 'appstore_process'); add_shortcode('appext', 'appstore_process_ext'); add_shortcode('appimg', 'appstore_process_img'); add_filter('comment_text', 'do_shortcode'); add_filter('the_content_rss', 'do_shortcode'); load_plugin_textdomain('appstore',null, dirname(plugin_basename(__FILE__))."/languages/"); register_activation_hook(__FILE__, 'AppStoreLinks_activate'); ?>