Plugin Directory

Changeset 2497318


Ignore:
Timestamp:
03/16/2021 07:59:46 PM (5 years ago)
Author:
frankpw
Message:

Removed code for translations (1.9.1)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fpw-category-thumbnails/trunk/classes/fpw-category-thumbnails-class.php

    r2496446 r2497318  
    1414    var $fctVersion;
    1515    var $fctPage, $fptPage;
    16     var $fctLocale;
    17     var $translationURL;
    18     var $languagepackPath;
    19     var $translationStatus;
    20     var $translationResponse;
    2116    var $wpVersion;
    2217    var $mapArray;
     
    4035        //  set WP version
    4136        $this->wpVersion = $wp_version;
    42         $this->fctLocale = get_locale();
    43 
    44         //  set translation URL
    45         $this->translationURL = 'http://svn.wp-plugins.org/fpw-category-thumbnails/translations/' .
    46                                 $this->fctVersion . '/fpw-category-thumbnails-' . $this->fctLocale;
    47 
    48         //  set translation path (language pack)
    49         $this->languagepackPath = WP_CONTENT_DIR . '/languages/plugins/fpw-category-thumbnails-' . $this->fctLocale;
    5037
    5138        //  initialize $showRestore
     
    134121    }
    135122
    136     //  check translation file availability
    137     function translationAvailable() {
    138 
    139         //  if language file exist, do not load it again
    140         if ( is_readable( $this->languagepackPath . '.mo' ) )
    141             return 'installed';
    142 
    143         if ( version_compare( $this->wpVersion, '3.6.0', '<' ) ) {
    144             $this->translationResponse = wp_remote_get( $this->translationURL . '.mo', array( 'timeout' => 300 ) );
    145         } else {
    146             $this->translationResponse = wp_safe_remote_get( $this->translationURL . '.mo', array( 'timeout' => 300 ) );
    147         }
    148 
    149         //  if no translation file exists exit the check
    150         if ( is_wp_error( $this->translationResponse ) || $this->translationResponse[ 'response' ][ 'code' ] != '200' )
    151             return 'not_exist';
    152 
    153         return 'available';     
    154     }
    155 
    156123    //  register plugin's textdomain
    157124    function init() {
    158125        load_plugin_textdomain( 'fpw-category-thumbnails' );
    159         if ( !( 'en_US' == $this->fctLocale ) )
    160             $this->translationStatus = $this->translationAvailable();
    161126    }
    162127
     
    403368    }
    404369
    405     private function doGetLanguage() {
    406         if ( 'not_exist' == $this->translationStatus ) {
    407             $m = __( 'Language pack for this version is not yet available.', 'fpw-category-thumbnails' );
    408         } elseif ( 'installed' == $this->translationStatus ) {
    409             $m = __( 'Language pack is already installed.', 'fpw-category-thumbnails' );
    410         } else {
    411             $handle = @fopen( $this->languagepackPath . '.mo', 'wb' );
    412             fwrite( $handle, $this->translationResponse[ 'body' ] );
    413             fclose($handle);
    414             if ( version_compare( $this->wpVersion, '3.6.0', '<' ) ) {
    415                 $this->translationResponse = wp_remote_get( $this->translationURL . '.po', array( 'timeout' => 300 ) );
    416             } else {
    417                 $this->translationResponse = wp_safe_remote_get( $this->translationURL . '.po', array( 'timeout' => 300 ) );
    418             }
    419             if ( !is_wp_error( $this->translationResponse ) ) {
    420                 $handle = @fopen( $this->languagepackPath . '.po', 'wb' );
    421                 fwrite( $handle, $this->translationResponse[ 'body' ] );
    422                 fclose($handle);
    423             }
    424             $this->translationStatus = 'installed';
    425             $m = __( 'Language pack downloaded successfully. It will be applied as soon as this page is reloaded.', 'fpw-category-thumbnails' );
    426         }
    427         return $m;         
    428     }
    429 
    430370    //  plugin's Settings page
    431371    function fctSettings() {
Note: See TracChangeset for help on using the changeset viewer.