Plugin Directory

Changeset 412973


Ignore:
Timestamp:
07/21/2011 06:07:32 AM (15 years ago)
Author:
stevevls
Message:

1.1.8 :

  • Comments rendered LTR unless WPLANG is Arabic or Hebrew.
  • Fewer terms translated immediately upon signup.
  • Be more proactive about checking validity of downloaded .mo files and remove invalid files during cron job.
Location:
gts-translation/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • gts-translation/trunk/Gts.php

    r385352 r412973  
    3737Plugin URI: http://gts-translation.com/
    3838Description: This plugin is guaranteed to drive more international traffic to your site by providing high quality translation, and SEO of your translated content.
    39 Version: 1.1.7
     39Version: 1.1.8
    4040Author: Steve van Loben Sels
    4141Author URI: http://gts-translation.com/
  • gts-translation/trunk/callbacks/gts-get-terms.php

    r363827 r412973  
    3434require_once('../GtsPlugin.php');
    3535
    36 $taxonomies = array();
    37 foreach( get_taxonomies( array(), 'objects' ) as $taxonomy ) {
    38     if ( in_array( 'post', $taxonomy->object_type ) ) {
    39         array_push( $taxonomies, $taxonomy->name );
     36$terms = array();
     37$posts = get_posts( array( 'numberposts', get_option('posts_per_page') ) );
     38
     39foreach( $posts as $post ) {
     40    foreach( $gts_plugin->get_blog_post_terms( $post->ID ) as $term ) {
     41        $terms[] = $term;
    4042    }
    4143}
    42 
    43 $terms = get_terms( $taxonomies, array( 'hide_empty' => true ) );
    4444
    4545$output_xml = new com_gts_Terms();
  • gts-translation/trunk/readme.txt

    r385373 r412973  
    44Donate Link: http://www.gts-translation.com/
    55Requires at least: 2.9
    6 Tested up to: 3.1.2
    7 Stable tag: 1.1.7
     6Tested up to: 3.2.1
     7Stable tag: 1.1.8
    88
    99This plugin is guaranteed to drive more international traffic to your site by providing high quality translation, and SEO of your translated content.
     
    164164Unforunately, yes.  Here is a list of plugins that cause problems with the GTS Plugin:
    165165
     166* Uniquefier (incompatible with multi-byte character sets.  Posts come out as ? marks)
    166167* ICanLocalize  (inserts invalid HTML into the post body)
    167168* Recently Popular  (directly selects posts from the DB, so plugin hooks are bypassed)
    168169
     170
    169171This list is a work in progress and may grow as we roll out to more users.
    170172
     
    175177
    176178== Changelog ==
     179
     180= 1.1.8 =
     181* Comments rendered LTR unless WPLANG is Arabic or Hebrew.
     182* Fewer terms translated immediately upon signup.
     183* Be more proactive about checking validity of downloaded .mo files and remove invalid files during cron job.
    177184
    178185= 1.1.7 =
  • gts-translation/trunk/wordpress/GtsPluginWordpress.php

    r385352 r412973  
    228228        }
    229229
    230         $save_config |= $this->send_notifications( $this->config->info_messages, 'info' );
     230        $save_config = $this->send_notifications( $this->config->info_messages, 'info' );
    231231        $save_config |= $this->send_notifications( $this->config->error_messages, 'error' );
    232232
     
    378378        add_filter( 'posts_join', array( $this, 'add_posts_join_criteria' ), 1 );
    379379        add_filter( 'posts_search', array( $this, 'add_posts_search_criteria' ), 1);
     380
     381        add_filter( 'comment_excerpt', array( $this, 'set_comment_text_direction') );
     382        add_filter( 'comment_text',  array( $this, 'set_comment_text_direction') );
    380383    }
    381384
     
    470473    }
    471474
     475
     476    function set_comment_text_direction( $text ) {
     477
     478        global $text_direction;
     479        if( !strcasecmp( $text_direction, 'rtl' ) && !preg_match( '/^(ar)|(he)/', WPLANG ) ) {
     480            $text = "<span dir=\"ltr\">$text</span>";
     481        }
     482
     483        return $text;
     484    }
     485
    472486   
    473487    function rewrite_mofile_path( $mofile, $domain ) {
     
    544558        $svn_messages_dir = "messages" . ( $domain != "default" ? "/$domain" : "");
    545559
    546         if( file_exists( GTS_I18N_DIR . "/$wp_version/$domain/$locale_name.mo")) {
    547             return TRUE;
     560        $mofile = GTS_I18N_DIR . "/$wp_version/$domain/$locale_name.mo";
     561        if( file_exists( $mofile ) ) {
     562            if( $this->is_valid_mofile( $mofile ) ) {
     563                return TRUE;
     564            }
     565
     566            @unlink( $mofile );
    548567        }
    549568
     
    614633        fclose( $fh );
    615634
    616         return TRUE;
     635        // check the headers to make sure that we have a .mofile
     636        return $this->is_valid_mofile( $filename );
     637    }
     638
     639
     640    function is_valid_mofile( $filename ) {
     641
     642        $valid = FALSE;
     643        $fh = @fopen( $filename, 'r' );
     644
     645        if ( $fh ) {
     646
     647            $bytes = fread( $fh, 4 );
     648            if( $bytes !== FALSE ) {
     649
     650                $unpacked = unpack( "Lmagic", $bytes );
     651                $magic = $unpacked["magic"];
     652
     653                // this is borrowed from WP code...checks the magic header of the
     654                // .mo file to make sure that it at least has the right prefix.
     655
     656                // The magic is 0x950412de
     657                // bug in PHP 5.0.2, see https://savannah.nongnu.org/bugs/?func=detailitem&item_id=10565
     658                $magic_little = (int) - 1794895138;
     659                $magic_little_64 = (int) 2500072158;
     660                // 0xde120495
     661                $magic_big = ((int) - 569244523) & 0xFFFFFFFF;
     662                $valid = ( $magic_little == $magic || $magic_little_64 == $magic || $magic_big == $magic );
     663            }
     664        }
     665
     666        fclose( $fh );
     667
     668        return $valid;
    617669    }
    618670
     
    630682
    631683            // in our ghetto wire impl, we'll ignore headers.  when we come across
    632             // the first blank \r\n, we'll return the result.
     684            // the first blank \r\n, we'll return the result.  we'll also check
     685            // the very first line for the HTTP status and return false if not 200.
     686            $first = true;
    633687            while ( $str = @fgets( $fp, 4096) ) {
     688
     689                if( $first ) {
     690                    if( !preg_match( '/^HTTP\/\d+\.\d+ 200/', $str, $matches ) ) {
     691                        return false;
     692                    }
     693                    $first = false;
     694                }
     695
    634696                if ( $str == "\r\n" ) {
    635697                    return $fp;
     
    13541416        if(@file_exists($gtsenv_filename)) {
    13551417            require_once $gtsenv_filename;
    1356             break;
    13571418        }
    13581419    }
Note: See TracChangeset for help on using the changeset viewer.