Changeset 412973
- Timestamp:
- 07/21/2011 06:07:32 AM (15 years ago)
- Location:
- gts-translation/trunk
- Files:
-
- 4 edited
-
Gts.php (modified) (1 diff)
-
callbacks/gts-get-terms.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
-
wordpress/GtsPluginWordpress.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
gts-translation/trunk/Gts.php
r385352 r412973 37 37 Plugin URI: http://gts-translation.com/ 38 38 Description: 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. 739 Version: 1.1.8 40 40 Author: Steve van Loben Sels 41 41 Author URI: http://gts-translation.com/ -
gts-translation/trunk/callbacks/gts-get-terms.php
r363827 r412973 34 34 require_once('../GtsPlugin.php'); 35 35 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 39 foreach( $posts as $post ) { 40 foreach( $gts_plugin->get_blog_post_terms( $post->ID ) as $term ) { 41 $terms[] = $term; 40 42 } 41 43 } 42 43 $terms = get_terms( $taxonomies, array( 'hide_empty' => true ) );44 44 45 45 $output_xml = new com_gts_Terms(); -
gts-translation/trunk/readme.txt
r385373 r412973 4 4 Donate Link: http://www.gts-translation.com/ 5 5 Requires at least: 2.9 6 Tested up to: 3. 1.27 Stable tag: 1.1. 76 Tested up to: 3.2.1 7 Stable tag: 1.1.8 8 8 9 9 This plugin is guaranteed to drive more international traffic to your site by providing high quality translation, and SEO of your translated content. … … 164 164 Unforunately, yes. Here is a list of plugins that cause problems with the GTS Plugin: 165 165 166 * Uniquefier (incompatible with multi-byte character sets. Posts come out as ? marks) 166 167 * ICanLocalize (inserts invalid HTML into the post body) 167 168 * Recently Popular (directly selects posts from the DB, so plugin hooks are bypassed) 168 169 170 169 171 This list is a work in progress and may grow as we roll out to more users. 170 172 … … 175 177 176 178 == 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. 177 184 178 185 = 1.1.7 = -
gts-translation/trunk/wordpress/GtsPluginWordpress.php
r385352 r412973 228 228 } 229 229 230 $save_config |= $this->send_notifications( $this->config->info_messages, 'info' );230 $save_config = $this->send_notifications( $this->config->info_messages, 'info' ); 231 231 $save_config |= $this->send_notifications( $this->config->error_messages, 'error' ); 232 232 … … 378 378 add_filter( 'posts_join', array( $this, 'add_posts_join_criteria' ), 1 ); 379 379 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') ); 380 383 } 381 384 … … 470 473 } 471 474 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 472 486 473 487 function rewrite_mofile_path( $mofile, $domain ) { … … 544 558 $svn_messages_dir = "messages" . ( $domain != "default" ? "/$domain" : ""); 545 559 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 ); 548 567 } 549 568 … … 614 633 fclose( $fh ); 615 634 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; 617 669 } 618 670 … … 630 682 631 683 // 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; 633 687 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 634 696 if ( $str == "\r\n" ) { 635 697 return $fp; … … 1354 1416 if(@file_exists($gtsenv_filename)) { 1355 1417 require_once $gtsenv_filename; 1356 break;1357 1418 } 1358 1419 }
Note: See TracChangeset
for help on using the changeset viewer.