Plugin Directory

Changeset 1654828


Ignore:
Timestamp:
05/11/2017 07:24:02 AM (9 years ago)
Author:
roomshare
Message:

version 1.5.1

Location:
embed-iphoneipad-app/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • embed-iphoneipad-app/trunk/embed-iphoneipad-app.php

    r779503 r1654828  
    66  Description: Convert iTunes App Store Link To App Info HTML
    77  Author: Roomshare Japan
    8   Version: 1.5.0
     8  Version: 1.5.1
    99  Author URI: http://roomshare.jp/
    1010  License: GPL2
  • embed-iphoneipad-app/trunk/includes/Rsj/EmbedIphoneIpadApp.php

    r779503 r1654828  
    1111    const BUG_TRACKER_URL = 'http://plugins.trac.wordpress.org/report';
    1212
    13     /**
     13    /**
    1414     * @return true if switching to PHG Network affiliate happened
    1515     */
    1616    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    }
    2121
    2222    private static function dummyForI18nResource()
     
    158158        $cleanUrl = Rsj_iTunes::getCleanUrl( $id, $country );
    159159
    160         $affiliateUrl = '';
     160        $affiliateUrl = '';
    161161        $errorMessage = null;
    162         if (self::isPhgEffective()) {
    163             $phg = new Rsj_Phg();
     162        if (self::isPhgEffective()) {
     163            $phg = new Rsj_Phg();
    164164            $affiliateUrl = $phg->getAffiliateUrl( $cleanUrl );
    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         }
     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        }
    186186        $formattedPurchaseButton = $this->formatPurchaseButton( $affiliateUrl, $errorMessage );
    187187
     
    424424            return;
    425425        }
    426         return;
    427     }
     426        return;
     427    }
    428428
    429429    public function validatePhgToken( &$input )
     
    635635    protected function getArtworkVariationBy($url, $size = '150x150-75.png')
    636636    {
    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;
    639639    }
    640640
     
    688688        $html .= '</div>';
    689689
     690/* remove device list as it tends to be too long
    690691        // suppress device when RSS, because new versions makes the post
    691         // updated on feed too much.
     692        // updated on feed too much.
    692693        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*/
    703705        $html .= '<div>' . __( 'Price', self::PLUGIN_KEY ) . ': ';
    704706        $price = $appInfo['price'];
     
    800802    }
    801803
    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    }
    806808
    807809    protected function formatStar( $rate )
  • embed-iphoneipad-app/trunk/readme.txt

    r779503 r1654828  
    11=== Embed iPhone/iPad App ===
    22Contributors: roomshare
    3 Version 1.5.0
     3Version 1.5.1
    44Donate link: http://blog.roomshare.jp/blog/embed-iphoneipad-app
    55Tags: PHG, PHG Network, Linkshare, iPhone, iPad, iOS, iPod, iTunes, app, smartphone, affiliate, marketing
     
    139139* suppress devices in feed, to avoid too frequent updates on rss reader
    140140
     141= 1.5.1 =
     142* remove devices list as it tends to be too long
     143* confirmed compatibility with WordPress 4.7.4
     144
    141145== Upgrade Notice ==
    142146
Note: See TracChangeset for help on using the changeset viewer.