dev82 Posted May 24, 2010 Share Posted May 24, 2010 Hey Guys, i have this plugin for wordpress link: http://wordpress.org/extend/plugins/appstore/ i modified for me under this link: http://iphone-progz.com/new/wordpress/wp-content/plugins/appstore/AppStore.php here is the complete php: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" <head profile="http://gmpg.org/xfn/11"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <head> <link rel="stylesheet" href="http://iphone-progz.com/new/wordpress/wp-content/plugins/appstore/app.css" type="text/css" media="screen" /> <title>App Search</title> </head> <body> <h1 align="center">App Search</h1> <center> <form method="get" action="http://iphone-progz.com/new/wordpress/wp-content/plugins/appstore/AppStore.php"> <table allign="center" valign="middle"> <tbody> <tr> <td><input name="search" style="width: 100%; font-weight: bold; font-size: 9pt; height: 20px; padding: 1px; border: 1px solid rgb(221, 221, 221);" type="text"></td> </tr> <tr> <td colspan="2"><input name="" value="Suchen" style="width: 100%; font-weight: bold; font-size: 9pt; height: 20px; padding: 1px; border: 1px solid rgb(221, 221, 221);" type="submit"></td> </tr> </tbody></table> </form> </center> <div style="padding: 10px;"> <div id="apps"> <?php /* Plugin Name: AppStore Links Plugin URI: http://tirolercast.ste-bi.net/wordpress-plugins/appstore-plugin/ Description: A filter for WordPress that displays AppstoreDetails Version:2.0.0 Author: Stephan Author URI: http://www.ste-bi.net Instructions Copy the folder that contains this file unzipped into the wp-content/plugins folder of WordPress, then go to Administration > 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'); 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; //$trackViewUrl = $obj->results[0]->trackViewUrl; $contentAdvisoryRating = $obj->results[0]->contentAdvisoryRating; $description = str_replace("\n", "<br />", $obj->results[0]->description); $cacheimageurl = getImage($searchid, $artworkUrl60); $AffLink = WP_PLUGIN_URL."/".PLUGIN_BASE_DIRECTORY."/AppStore.php?id=".$searchid; // 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 = '<span style="display: block; width: 54px; height: 54px; position: absolute; margin-top: 27px; margin-left: 27px; z-index: 999; background: transparent url('.WP_PLUGIN_URL.'/AppStore/images/update.png) center center no-repeat;"></span>'; } // Create Output /* $output = '<span>'.$spanOverlay; $output .= '<a href="'.$AffLink.'" target="_blank">'; $output .= '<img align="left" style="margin-right: 5px; margin-left: 5px; margin-top: 5px; margin-bottom: 5px;" '; $output .= 'src="'.$cacheimageurl.'" alt="'.$trackName.' (AppStore Link) " width="57" height="57" /></a> '; $output .= '<span style="font-size: 100%; font-weight:bold; ">'.$trackName.' </span><br /> '; $output .= '<span style="font-size: 80%; ">Hersteller: </span><a href="'.$sellerUrl.'" target="_blank">'.$sellerName.'</a><br /> '; $output .= '<span style="font-size: 80%; ">Freigabe: </span>'.$contentAdvisoryRating.'<br /> '; $output .= '<span style="font-size: 80%; ">Preis: </span>'.$price.' '; $output .= '<span style="font-size: 100%; font-weight:bold; "><a href="'.$AffLink.'" target="_blank">'.APPSTORE_DL_LINKNAME.'</a></span>'; $output .= '</span><br /><br />' ; */ $output = '<span class="apps">'.$spanOverlay; $output .= '<a id="Bild" href="'.$AffLink.'" target="_blank">'; $output .= '<img id="Image" align="left" src="'.$cacheimageurl.'" alt="'.$trackName.' (AppStore Link) " /></a> '; $output .= '<span id="Titel">'.$trackName.'</span><br /> '; $output .= '<span id="Hersteller">Hersteller: </span> <a href="'.$sellerUrl.'" target="_blank">'.$sellerName.'</a><br /> '; $output .= '<span id="Freigabe">Freigabe: </span>'.$contentAdvisoryRating.'<br /> '; $output .= '<span id="Preis">Preis: </span>'.$price.' '; $output .= '<span id="Download"></span><a href="'.$AffLink.'" target="_blank" >'.APPSTORE_DL_LINKNAME.'</a>'; $output .= '<span style="font-size: 80%; font-weight:bold;">Beschreibung:</span><br />'.$description.' </td> '; $output .= '</span><br />'; return ($output); } if ( $_REQUEST['id'] != "" ) { header("Location: ".AppStore_getAff($_REQUEST['id'])); } if ( $_REQUEST['search'] != "" ) { $result = file_get_contents(APPSTORESEARCHLINKNAME.urlencode($_REQUEST['search'])); // 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; $description = left($obj->results[$i]->description,3000) ; $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; // Lange Titel kürzen if (strlen($trackName)>=40) { $trackName = left($obj->results[$i]->trackName,37)."..." ; } //$searchresult .= '<div>'; $searchresult .= '<a href="'.$afflink.'" target="_blank">'; $searchresult .= '<img align="left" style="margin-right: 5px; margin-left: 10px; margin-top: 0px; margin-bottom: 10px;" '; $searchresult .= 'src="'.$imageUrl.'" alt="'.$trackName.' (AppStore Link) " width="57" height="57" /></a> '; $searchresult .= '<div id="Titel">'.$trackName.'</div> '; $searchresult .= '<div id="Anbieter">Anbieter: </div> <a href="'.$sellerUrl.'" target="_blank">'.$sellerName.'</a><br /> '; $searchresult .= '<div id="Freigabe">Freigabe: </span>'.$contentAdvisoryRating.'<div /> '; $searchresult .='<div id="Preis">Preis: </div>'.$price.' €'; $searchresult .= '<div id="Download"></div ><a href=" target="_blank" >'.APPSTORE_DL_LINKNAME.'</a>'; $searchresult .= '<div id="Beschreibung">Beschreibung: '.$description.' </div > '; $searchresult .= '</div >'; //$searchresult .= } //$searchresult .= "</ ol>"; echo $searchresult; } } if ( $_REQUEST['searchDetail'] != "" ) { $result = file_get_contents(APPSTORESEARCHLINKNAME.urlencode($_REQUEST['searchDetail'])); // Decode Content $obj = json_decode($result); $count = $obj->resultCount; $searchresult = '<center><span style="font-weight:bold;">Deine Suche hat '.$count.' Resultate erzielt</span></center><br />' ; 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; if ($price == 0.00000) { $price = "Kostenlos"; } else { if( $AppStore_country == "US") { $price .= " USD"; }elseif ($AppStore_country == "CH") { $price .= " CHF"; } else { $price .= " EUR"; } } $searchresult .= '<table valign="top"><tr><td width=60px>'; $searchresult .= '<a href="'.$afflink.'" target="_blank">'; $searchresult .= '<img align="right" style="margin-right: 5px; margin-left: 10px; margin-top: 5px; margin-bottom: 10px; -webkit-border-radius: 10px;" '; $searchresult .= 'src="'.$imageUrl.'" alt="'.$trackName.' (AppStore Link) " width="57px" height="57px" border="0px" /></a> </td>'; //$searchresult .= "<a href='".$afflink."'>".$trackName."</a><br />"; $searchresult .= '<td width=30%><span style="font-size: 100%; font-weight:bold; ">'.$trackName.' </span><br /> '; $searchresult .= '<span style="font-size: 80%; font-weight:bold; ">Hersteller: </span><a href="'.$sellerUrl.'" target="_blank">'.$sellerName.'</a><br /> '; $searchresult .= '<span style="font-size: 80%; font-weight:bold;">Freigabe: </span>'.$contentAdvisoryRating.'<br /> '; $searchresult .= '<span style="font-size: 80%; font-weight:bold;">Preis: </span>'.$price.'<span /> '; $searchresult .= '<span style="font-size: 100%; font-weight:bold; "><a href="'.$afflink.'" target="_blank">Download via iTunes</a></span><br /> </td>'; $searchresult .= '</tr></table><br /><br /> '; } } echo $searchresult; } function AppStoreLinks_plugin($content) { return (preg_replace_callback(APPSTORELINKS_REGEXP, 'AppStoreLinks_plugin_callback', $content)); } function AppStoreLinks_activate() { // ToDo: Testen ob Jason installiert ist! // http://codex.wordpress.org/Function_Reference/register_activation_hook 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","1678350"); add_option("AppStore_Loop",0); // 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 } function WPWall_ScriptsAction() { // $wp_wall_plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) ); 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_options_page('AppStore', 'AppStore', 8, basename(__FILE__), 'AppStore_options_page'); } 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'])); } $Countries = array( "DE" => "Deutschland", "AT" => "Österreich", "CH" => "Schweiz" ); asort($Countries); // "US" => "USA" $language = array( "de_de" => "Deutsch", "en_us" => "Englisch" ); asort($language); $AdminPage .= " <form method=\"post\" action=\"".get_settings("siteurl")."/wp-admin/options-general.php?page=AppStore.php\"> <div class=\"wrap\"> <div class=\"icon32\" id=\"icon-options-general\"><br/></div><h2>Einstellungen für das AppStore-Plugin</h2> <p>Dieses Plugin lässt sich ganz einfach mit <code>[app 123456]</code> integrieren. </p> <table> <tr> <td>iTunes-Store Land:</td> <td> <select name=\"AppStore_country\" style=\"width:200px;font-weight:bold;\">"; foreach($Countries as $Key => $Country) { $AdminPage .= "<option value=\"".$Key."\""; if(get_option("AppStore_country") == $Key) $AdminPage .= " selected=\"selected\""; $AdminPage .= ">".$Country."</option>"; } $AdminPage .= "</select> </td> </tr> <tr> <td>Sprache:</td> <td> <select name=\"AppStore_language\" style=\"width:200px;font-weight:bold;\">"; foreach($language as $Key => $language) { $AdminPage .= "<option value=\"".$Key."\""; if(get_option("AppStore_language") == $Key) $AdminPage .= " selected=\"selected\""; $AdminPage .= ">".$language."</option>"; } $AdminPage .= "</select> </td> <td> </tr> <td>Cachingzeit Bilder (in h):</td> <td><input type=\"text\" name=\"AppStore_picCache\" value=\"".get_option("AppStore_picCache")."\" style=\"width:200px;font-weight:bold;font-size:9pt;height:20px;padding:1px;border:1px solid #DDDDDD;\"/></td> <tr> </td> <td> </tr> <td>Cachingzeit Daten (in h):</td> <td><input type=\"text\" name=\"AppStore_dataCache\" value=\"".get_option("AppStore_dataCache")."\" style=\"width:200px;font-weight:bold;font-size:9pt;height:20px;padding:1px;border:1px solid #DDDDDD;\"/></td> <tr> </td> <td> </tr> <td>Downl.Link Bezeichung:</td> <td><input type=\"text\" name=\"AppStore_dlLinkname\" value=\"".get_option("AppStore_dlLinkname")."\" style=\"width:200px;font-weight:bold;font-size:9pt;height:20px;padding:1px;border:1px solid #DDDDDD;\"/></td> <tr> </td> <td>Tradedoubler ID:</td> <td><input type=\"text\" name=\"AppStore_tdlink\" value=\"".get_option("AppStore_tdlink")."\" style=\"width:200px;font-weight:bold;font-size:9pt;height:20px;padding:1px;border:1px solid #DDDDDD;\"/></td> <td>Noch kein <a href=\"http://clkde.tradedoubler.com/click?p(745)a(1678350)g(11703467)\" title=\"register to tradedoubler\" target=\"_blank\">Tradedoubler Partner</a>?</td> </tr> <tr> <td colspan=\"2\"><input type=\"submit\" name=\"AppStore_save_options\" value=\"Speichern\" style=\"width:370px;font-weight:bold;font-size:9pt;height:20px;padding:1px;border:1px solid #DDDDDD;\"/></td> </tr> </table> </form> <h2>Verwendung und Beispiel</h2> Die ID der App bekommst du aus dem iTunes-Store. Eimfach den Link der gewünschten App kopieren und die Nummer (fast) am Ende suchen: <br /><br /> http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=284417350&mt=8 <br /><br /> [app 284417350] sollte bei richtiger Konfiguration die Apple Remote App anzeigen. (einfach in einer Seite oder in einem Post einbauen). <h2>Info</h2> <h3>Land</h3> Das Land gibt an auf welchen Store die Suche durchgeführt wird. So können zB keine Apps angezeigt werden, welche sich nur im US Store befinden aber ein anderer Store eingestellt ist. <h3>Cachingzeiten</h3> Die Cachingzeiten geben an, wie oft die Daten aktualisiert vom Server geladen werden - dies erhöht die Performance und sollte eigentlich nicht geändert werden. <h3>Tradedoubler ID</h3> Damit Ihr auch ein wenig Geld damit verdienen könnt ;-) <h3>Sprache</h3> Die Sprache ist derzeit noch eher irrelevant - es wird aber in einer der nächsten Aktualisierungen benötigt. Wenn die Sprache oder das iTunes Land umgestellt wird, sollte ggf. auch der Cache gelöscht werden, da sonst die Preise nicht korrekt sind. <h2>Unterstützung</h2> Du weißt ja, ein Entwickler ist prinzipiell arm. Ja, ja... traurig aber wahr. Aus diesem Grund steht in jedem 10. Tradedoubler-Link unsere ID um die Entwicklung dieses Plugins und weiterer spannender Projekte zu unterstützen. Deshalb bitten wir dich, den betreffenden Code nicht manuell zu entfernen. <form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\"> <input type=\"hidden\" name=\"cmd\" value=\"_s-xclick\"> <input type=\"hidden\" name=\"hosted_button_id\" value=\"9401356\"> <input type=\"image\" src=\"https://www.paypal.com/de_DE/AT/i/btn/btn_donateCC_LG.gif\" border=\"0\" name=\"submit\" alt=\"Jetzt einfach, schnell und sicher online bezahlen – mit PayPal.\"> <img alt=\"\" border=\"0\" src=\"https://www.paypal.com/de_DE/i/scr/pixel.gif\" width=\"1\" height=\"1\"> </form> </form> "; echo $AdminPage; } function AppStoreLinks_SetSyle() { echo '<link href="'.WP_PLUGIN_URL."/".PLUGIN_BASE_DIRECTORY.'/css/AppStore.css" rel="stylesheet" type="text/css" />'; } add_filter('the_content', 'AppStoreLinks_plugin'); add_filter('comment_text', 'AppStoreLinks_plugin'); add_action('wp_print_scripts', 'WPWall_ScriptsAction'); add_action( 'wp_head', 'AppStoreLinks_SetSyle' ); register_activation_hook(__FILE__, 'AppStoreLinks_activate' ); ?> <td width="50%"><br></td> </div> </body> </html> my question is, how can i import it into my blog under a full width site and i want to use the screenshots for each app. thanks Carsten Link to comment https://forums.phpfreaks.com/topic/202762-who-can-help-me-with-this-code/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.