Changeset 1654828
- Timestamp:
- 05/11/2017 07:24:02 AM (9 years ago)
- Location:
- embed-iphoneipad-app/trunk
- Files:
-
- 3 edited
-
embed-iphoneipad-app.php (modified) (1 diff)
-
includes/Rsj/EmbedIphoneIpadApp.php (modified) (6 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
embed-iphoneipad-app/trunk/embed-iphoneipad-app.php
r779503 r1654828 6 6 Description: Convert iTunes App Store Link To App Info HTML 7 7 Author: Roomshare Japan 8 Version: 1.5. 08 Version: 1.5.1 9 9 Author URI: http://roomshare.jp/ 10 10 License: GPL2 -
embed-iphoneipad-app/trunk/includes/Rsj/EmbedIphoneIpadApp.php
r779503 r1654828 11 11 const BUG_TRACKER_URL = 'http://plugins.trac.wordpress.org/report'; 12 12 13 /**13 /** 14 14 * @return true if switching to PHG Network affiliate happened 15 15 */ 16 16 public static function isPhgEffective() { 17 $now = new DateTime('now');18 $switchTime = new DateTime('2013-09-01 00:00:00');19 return ($now > $switchTime);20 }17 $now = new DateTime('now'); 18 $switchTime = new DateTime('2013-09-01 00:00:00'); 19 return ($now > $switchTime); 20 } 21 21 22 22 private static function dummyForI18nResource() … … 158 158 $cleanUrl = Rsj_iTunes::getCleanUrl( $id, $country ); 159 159 160 $affiliateUrl = '';160 $affiliateUrl = ''; 161 161 $errorMessage = null; 162 if (self::isPhgEffective()) {163 $phg = new Rsj_Phg();162 if (self::isPhgEffective()) { 163 $phg = new Rsj_Phg(); 164 164 $affiliateUrl = $phg->getAffiliateUrl( $cleanUrl ); 165 } else {166 // use Linkshare affiliate167 $linkshare = new Rsj_Linkshare();168 try {169 $affiliateUrl = $linkshare->getAffiliateUrl( $cleanUrl, $country );170 } catch ( Rsj_EmbedIphoneIpadAppException $ex ) {171 switch ( $ex->getCode() ) {172 case 403:173 $affiliateUrl = $cleanUrl;174 $errorMessage = 'No affiliate token set for current country';175 break;176 case 404:177 return $this->formatAppNotFound( $id, $ex );178 case 500:179 case 503:180 default:181 $affiliateUrl = $cleanUrl;182 $errorMessage = 'Failed to generate affiliate link [ ' . $ex->getMessage() . ']';183 }184 }185 }165 } else { 166 // use Linkshare affiliate 167 $linkshare = new Rsj_Linkshare(); 168 try { 169 $affiliateUrl = $linkshare->getAffiliateUrl( $cleanUrl, $country ); 170 } catch ( Rsj_EmbedIphoneIpadAppException $ex ) { 171 switch ( $ex->getCode() ) { 172 case 403: 173 $affiliateUrl = $cleanUrl; 174 $errorMessage = 'No affiliate token set for current country'; 175 break; 176 case 404: 177 return $this->formatAppNotFound( $id, $ex ); 178 case 500: 179 case 503: 180 default: 181 $affiliateUrl = $cleanUrl; 182 $errorMessage = 'Failed to generate affiliate link [ ' . $ex->getMessage() . ']'; 183 } 184 } 185 } 186 186 $formattedPurchaseButton = $this->formatPurchaseButton( $affiliateUrl, $errorMessage ); 187 187 … … 424 424 return; 425 425 } 426 return;427 }426 return; 427 } 428 428 429 429 public function validatePhgToken( &$input ) … … 635 635 protected function getArtworkVariationBy($url, $size = '150x150-75.png') 636 636 { 637 $result = preg_replace('/(png)$/', $size, $url);638 return !is_null($result)?$result:$url;637 $result = preg_replace('/(png)$/', $size, $url); 638 return !is_null($result)?$result:$url; 639 639 } 640 640 … … 688 688 $html .= '</div>'; 689 689 690 /* remove device list as it tends to be too long 690 691 // suppress device when RSS, because new versions makes the post 691 // updated on feed too much.692 // updated on feed too much. 692 693 if (!is_feed()) { 693 // devices 694 $supportedDevices = $appInfo['supportedDevices']; 695 $html .= '<div>' . __( 'Devices', self::PLUGIN_KEY ) . ': '; 696 if ( count( $supportedDevices ) === 1 && $supportedDevices[0] === 'all' ) { 697 $html .= __( 'all', self::PLUGIN_KEY ); 698 } else { 699 $html .= implode( ', ', $supportedDevices ); 700 } 701 $html .= '</div>'; 702 } 694 // devices 695 $supportedDevices = $appInfo['supportedDevices']; 696 $html .= '<div>' . __( 'Devices', self::PLUGIN_KEY ) . ': '; 697 if ( count( $supportedDevices ) === 1 && $supportedDevices[0] === 'all' ) { 698 $html .= __( 'all', self::PLUGIN_KEY ); 699 } else { 700 $html .= implode( ', ', $supportedDevices ); 701 } 702 $html .= '</div>'; 703 } 704 */ 703 705 $html .= '<div>' . __( 'Price', self::PLUGIN_KEY ) . ': '; 704 706 $price = $appInfo['price']; … … 800 802 } 801 803 802 protected function renderTemplate($template, $appInfo) {803 $text = str_replace( '%name%', $appInfo['name'], $template );804 return $text;805 }804 protected function renderTemplate($template, $appInfo) { 805 $text = str_replace( '%name%', $appInfo['name'], $template ); 806 return $text; 807 } 806 808 807 809 protected function formatStar( $rate ) -
embed-iphoneipad-app/trunk/readme.txt
r779503 r1654828 1 1 === Embed iPhone/iPad App === 2 2 Contributors: roomshare 3 Version 1.5. 03 Version 1.5.1 4 4 Donate link: http://blog.roomshare.jp/blog/embed-iphoneipad-app 5 5 Tags: PHG, PHG Network, Linkshare, iPhone, iPad, iOS, iPod, iTunes, app, smartphone, affiliate, marketing … … 139 139 * suppress devices in feed, to avoid too frequent updates on rss reader 140 140 141 = 1.5.1 = 142 * remove devices list as it tends to be too long 143 * confirmed compatibility with WordPress 4.7.4 144 141 145 == Upgrade Notice == 142 146
Note: See TracChangeset
for help on using the changeset viewer.