Features needed
-
Hi,
Your plugin is great, i got best results with yours than another one.
I need in fact two features more :
– Disable the appbrain link (i use only the google play store).
– Add a SCM link to the app repository (git,github,svn, etc).I wanted to do it myself but i don’t know you made the buttons (what fonts ?).
You can contact me if needed.
Best regards
Laurent
Viewing 1 replies (of 1 total)
-
My updated version :
<?php /* Plugin Name: Savrix Android Market Plugin URI: http://androidphoneitalia.it Description: Savrix Android Market Version: 2.2.3 Author: Saverio Petrangelo Author URI: http://androidphoneitalia.it */ // Shortcode per link al market wp_register_style('savrix-style.css', plugin_dir_url( __FILE__ ) . "savrix-style.css"); wp_enqueue_style('savrix-style.css'); function sav_get_file ($package_name) { $opts = array( 'http'=>array( 'method'=>"GET", 'header'=>"User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0\r\n" . "Accept-language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3\r\n" . "Connection: close\r\n" ) ); $sav_context = stream_context_create($opts); global $sav_file; $sav_file = false; // Apre il file usando l'header HTTP precedente if ($package_name != ""){ $sav_file = @file_get_contents('https://play.google.com/store/apps/details?id=' . $package_name, false, $sav_context); } } function market_code ($sav_atts, $sav_content = null) { extract( shortcode_atts( array( 'type' => 'market', ), $sav_atts ) ); $nome = "App Name"; $sviluppatore = "Developer"; $prezzo = "ND"; $icona = plugin_dir_url( __FILE__ ) . "images/icona-default.png"; $link_market = "https://play.google.com/store/apps/"; $link_appbrain = "http://www.appbrain.com/"; $valutazione = ""; global $sav_file; if ($sav_content != "") { sav_get_file($sav_content); if ($sav_file != false) { $regexp = "<dd\sitemprop=\"offers\"\s[^>]*><span\s[^>]*><\/span><span\sitemprop=\"price\"\s[^>]*><\/span>(.*)<span\sitemprop=\"seller\""; if(preg_match_all("/$regexp/siU", $sav_file, $matches)) { $prezzo = $matches[1][0];} if ($prezzo == "ND") { $prezzo = "Free"; } $regexp = "data-docTitle=\"(.*)\""; if(preg_match_all("/$regexp/siU", $sav_file, $matches)) { $nome = $matches[1][0]; } $regexp = "<a\s[^>]*class=\"doc-header-link\">(.*)<\/a>"; if(preg_match_all("/$regexp/siU", $sav_file, $matches)) { $sviluppatore = $matches[1][0]; } $regexp = "<div\sclass=\"doc-banner-icon\"><img\s[^>]*src=\"([^\"]*)\""; if(preg_match_all("/$regexp/siU", $sav_file, $matches)) { $icona = $matches[1][0]; } $regexp = "<div\sclass=\"goog-inline-block\sstar\s([^\"]*)\">[^<]*<\/div>"; if(preg_match_all("/$regexp/siU", $sav_file, $matches)) { for ($i = 0; $i <= 4; $i++){ if ($matches[1][$i] == "SPRITE_star_on_dark") $star_img[$i] = "star-on-dark-img"; else if ($matches[1][$i] == "SPRITE_star_half_dark") $star_img[$i] = "star-half-dark-img"; else $star_img[$i] = "star-off-dark-img"; } $valutazione = '<img src="' . plugin_dir_url( __FILE__ ) . 'images/' . $star_img[0] . '.png" alt="' . $star_img[0] . '" />'; $valutazione = $valutazione . '<img src="' . plugin_dir_url( __FILE__ ) . 'images/' . $star_img[1] . '.png" alt="' . $star_img[1] . '" />'; $valutazione = $valutazione . '<img src="' . plugin_dir_url( __FILE__ ) . 'images/' . $star_img[2] . '.png" alt="' . $star_img[2] . '" />'; $valutazione = $valutazione . '<img src="' . plugin_dir_url( __FILE__ ) . 'images/' . $star_img[3] . '.png" alt="' . $star_img[3] . '" />'; $valutazione = $valutazione . '<img src="' . plugin_dir_url( __FILE__ ) . 'images/' . $star_img[4] . '.png" alt="' . $star_img[4] . '" />'; } } $link_market = "https://play.google.com/store/apps/details?id=" . $sav_content; $link_appbrain = "http://www.appbrain.com/app/" . $sav_content; if (strcasecmp($type, "market") == 0) $link_qr_code = $link_market; else if (strcasecmp($type, "appbrain") == 0) $link_qr_code = $link_appbrain; } return '<br /><div class="market-container"> <table class="market-table"> <tbody> <tr> <td id="icona"><img src="' . $icona . '" alt="logo-app" /></td> <td id="testo"> <strong><span class="sav-name">' . $nome . '</span></strong><br /> <span class="sav-developer">' . $sviluppatore . '</span><br /> <span class="sav-price">' . $prezzo . '</span> <span class="sav-valutazione">' . $valutazione . '</span> </td> <td id="installa"> <a href="' . $link_market . '" target="_blank" rel="nofollow"><img class="pulsante" src="' . plugin_dir_url( __FILE__ ) . 'images/' . 'pulsante-gplay.jpg" alt="pulsante-google-play-store" /></a><br /> <a href="' . $link_appbrain . '" target="_blank" rel="nofollow"><img class="pulsante" src="' . plugin_dir_url( __FILE__ ) . 'images/' . 'pulsante-appbrain.jpg" alt="pulsante-appbrain" /></a> </td> <td id="qrcode"><img title="QR Code" src="http://qrcode.kaywa.com/img.php?s=5&d=' . $link_qr_code . '" alt="qrcode-app" /> </td> </tr> </tbody> </table></div><br />'; } function marketgithub_code ($sav_atts, $sav_content = null) { extract( shortcode_atts( array( 'type' => 'market', 'github' => '' ), $sav_atts ) ); $nome = "App Name"; $sviluppatore = "Developer"; $prezzo = "ND"; $icona = plugin_dir_url( __FILE__ ) . "images/icona-default.png"; $link_market = "https://play.google.com/store/apps/"; $link_github = "https://github.com/". $github ; $valutazione = ""; global $sav_file; if ($sav_content != "") { sav_get_file($sav_content); if ($sav_file != false) { $regexp = "<dd\sitemprop=\"offers\"\s[^>]*><span\s[^>]*><\/span><span\sitemprop=\"price\"\s[^>]*><\/span>(.*)<span\sitemprop=\"seller\""; if(preg_match_all("/$regexp/siU", $sav_file, $matches)) { $prezzo = $matches[1][0];} if ($prezzo == "ND") { $prezzo = "Free"; } $regexp = "data-docTitle=\"(.*)\""; if(preg_match_all("/$regexp/siU", $sav_file, $matches)) { $nome = $matches[1][0]; } $regexp = "<a\s[^>]*class=\"doc-header-link\">(.*)<\/a>"; if(preg_match_all("/$regexp/siU", $sav_file, $matches)) { $sviluppatore = $matches[1][0]; } $regexp = "<div\sclass=\"doc-banner-icon\"><img\s[^>]*src=\"([^\"]*)\""; if(preg_match_all("/$regexp/siU", $sav_file, $matches)) { $icona = $matches[1][0]; } $regexp = "<div\sclass=\"goog-inline-block\sstar\s([^\"]*)\">[^<]*<\/div>"; if(preg_match_all("/$regexp/siU", $sav_file, $matches)) { for ($i = 0; $i <= 4; $i++){ if ($matches[1][$i] == "SPRITE_star_on_dark") $star_img[$i] = "star-on-dark-img"; else if ($matches[1][$i] == "SPRITE_star_half_dark") $star_img[$i] = "star-half-dark-img"; else $star_img[$i] = "star-off-dark-img"; } $valutazione = '<img src="' . plugin_dir_url( __FILE__ ) . 'images/' . $star_img[0] . '.png" alt="' . $star_img[0] . '" />'; $valutazione = $valutazione . '<img src="' . plugin_dir_url( __FILE__ ) . 'images/' . $star_img[1] . '.png" alt="' . $star_img[1] . '" />'; $valutazione = $valutazione . '<img src="' . plugin_dir_url( __FILE__ ) . 'images/' . $star_img[2] . '.png" alt="' . $star_img[2] . '" />'; $valutazione = $valutazione . '<img src="' . plugin_dir_url( __FILE__ ) . 'images/' . $star_img[3] . '.png" alt="' . $star_img[3] . '" />'; $valutazione = $valutazione . '<img src="' . plugin_dir_url( __FILE__ ) . 'images/' . $star_img[4] . '.png" alt="' . $star_img[4] . '" />'; } } $link_market = "https://play.google.com/store/apps/details?id=" . $sav_content; if (strcasecmp($type, "market") == 0) $link_qr_code = $link_market; else if (strcasecmp($type, "github") == 0) $link_qr_code = $link_github; } return '<br /><div class="market-container"> <table class="market-table"> <tbody> <tr> <td id="icona"><img src="' . $icona . '" alt="logo-app" /></td> <td id="testo"> <strong><span class="sav-name">' . $nome . '</span></strong><br /> <span class="sav-developer">' . $sviluppatore . '</span><br /> <span class="sav-price">' . $prezzo . '</span> <span class="sav-valutazione">' . $valutazione . '</span> </td> <td id="installa"> <a href="' . $link_market . '" target="_blank" rel="nofollow"><img class="pulsante" src="http://www.michenux.net/download/googleplay.png" alt="pulsante-google-play-store" /></a><br /> <a href="' . $link_github . '" target="_blank" rel="nofollow"><img class="pulsante" src="http://www.michenux.net/download/github.png" alt="pulsante-github" /></a> </td> <td id="qrcode"><img title="QR Code" src="http://qrcode.kaywa.com/img.php?s=5&d=' . $link_qr_code . '" alt="qrcode-app" /> </td> </tr> </tbody> </table></div><br />'; } function sav_qr_code ($qr_atts, $qr_content = null) { extract( shortcode_atts( array( 'size' => '125', 'type' => 'market', 'class' => '', ), $qr_atts ) ); if (strcasecmp($type, "market") == 0) $qr_link_market = "https://play.google.com/store/apps/details?id=" . $qr_content; else if (strcasecmp($type, "appbrain") == 0) $qr_link_market = "http://www.appbrain.com/app/" . $qr_content; if ($class != "") return '<img class="' . $class . '" title="QR Code" src="http://qrcode.kaywa.com/img.php?s=5&d=' . $qr_link_market . '" alt="qrcode-app" />'; else return '<img width="'. $size. '" height="' . $size . '" title="QR Code" src="http://qrcode.kaywa.com/img.php?s=5&d=' . $qr_link_market . '" alt="qrcode-app" />'; } function sav_star_code ($star_atts, $star_content = null) { extract( shortcode_atts( array( 'class' => '', ), $star_atts ) ); $star_valutazione = ""; global $sav_file; if ($sav_file == false){ sav_get_file($star_content); } else { if (!stristr($sav_file, $star_content)){ sav_get_file($star_content); } } if ($sav_file != false) { $regexp = "<div\sclass=\"goog-inline-block\sstar\s([^\"]*)\">[^<]*<\/div>"; if(preg_match_all("/$regexp/siU", $sav_file, $matches)) { for ($i = 0; $i <= 4; $i++){ if ($matches[1][$i] == "SPRITE_star_on_dark") $star_img[$i] = "star-on-dark-img"; else if ($matches[1][$i] == "SPRITE_star_half_dark") $star_img[$i] = "star-half-dark-img"; else $star_img[$i] = "star-off-dark-img"; } if ($class == "") { $star_valutazione = '<img src="' . plugin_dir_url( __FILE__ ) . 'images/' . $star_img[0] . '.png" alt="' . $star_img[0] . '" />'; $star_valutazione = $star_valutazione . '<img src="' . plugin_dir_url( __FILE__ ) . 'images/' . $star_img[1] . '.png" alt="' . $star_img[1] . '" />'; $star_valutazione = $star_valutazione . '<img src="' . plugin_dir_url( __FILE__ ) . 'images/' . $star_img[2] . '.png" alt="' . $star_img[2] . '" />'; $star_valutazione = $star_valutazione . '<img src="' . plugin_dir_url( __FILE__ ) . 'images/' . $star_img[3] . '.png" alt="' . $star_img[3] . '" />'; $star_valutazione = $star_valutazione . '<img src="' . plugin_dir_url( __FILE__ ) . 'images/' . $star_img[4] . '.png" alt="' . $star_img[4] . '" />'; } else { $star_valutazione = '<img class="' . $class . '" src="' . plugin_dir_url( __FILE__ ) . 'images/' . $star_img[0] . '.png" alt="' . $star_img[0] . '" />'; $star_valutazione = $star_valutazione . '<img class="' . $class . '" src="' . plugin_dir_url( __FILE__ ) . 'images/' . $star_img[1] . '.png" alt="' . $star_img[1] . '" />'; $star_valutazione = $star_valutazione . '<img class="' . $class . '" src="' . plugin_dir_url( __FILE__ ) . 'images/' . $star_img[2] . '.png" alt="' . $star_img[2] . '" />'; $star_valutazione = $star_valutazione . '<img class="' . $class . '" src="' . plugin_dir_url( __FILE__ ) . 'images/' . $star_img[3] . '.png" alt="' . $star_img[3] . '" />'; $star_valutazione = $star_valutazione . '<img class="' . $class . '" src="' . plugin_dir_url( __FILE__ ) . 'images/' . $star_img[4] . '.png" alt="' . $star_img[4] . '" />'; } } } return $star_valutazione; } function sav_icon_code ($icon_atts, $icon_content = null) { extract( shortcode_atts( array( 'size' => '125', 'class' => '', ), $icon_atts ) ); $sav_icon = ""; global $sav_file; if ($sav_file == false){ sav_get_file($icon_content); } else { if (!stristr($sav_file, $icon_content)){ sav_get_file($icon_content); } } if ($sav_file != false) { $regexp = "<div\sclass=\"doc-banner-icon\"><img\s[^>]*src=\"([^\"]*)\""; if(preg_match_all("/$regexp/siU", $sav_file, $matches)) { $sav_icon = $matches[1][0]; } } if ($class != "") { return '<img src="' . $sav_icon . '" class="' . $class . '" alt="logo-app" />'; } else { return '<img src="' . $sav_icon . '" width="' . $size . '" height="' . $size .'" alt="logo-app" />'; } } add_shortcode( 'app', 'market_code' ); add_shortcode( 'qr', 'sav_qr_code' ); add_shortcode( 'stars', 'sav_star_code' ); add_shortcode( 'appicon', 'sav_icon_code' ); add_shortcode( 'appgithub', 'marketgithub_code' ); ?>My pictures :
http://www.michenux.net/download/googleplay.png
http://www.michenux.net/download/github.pngUse like this:
[appgithub github="Michenux/YourApplication"]org.michenux.yourappidea[/appgithub]
Viewing 1 replies (of 1 total)
The topic ‘Features needed’ is closed to new replies.