Make WordPress Core

Ticket #11421: ticket-11421-qtranslate.patch

File ticket-11421-qtranslate.patch, 2.3 KB (added by miqrogroove, 15 years ago)

Filter handling for qTranslate (for plugin)

  • tags/2.5/qtranslate_core.php

     
    475475        return qtrans_strftime(qtrans_convertDateFormat($format), mysql2date('U',$comment->comment_date), $old_date);
    476476}
    477477
    478 function qtrans_timeFromCommentForCurrentLanguage($old_date, $format = '', $gmt = false) {
     478function qtrans_timeFromCommentForCurrentLanguage($old_date, $format = '', $gmt = false, $translate = true) {
    479479        global $comment;
    480         $comment_date = $gmt? $comment->comment_date_gmt : $comment->comment_date;
    481         return qtrans_strftime(qtrans_convertTimeFormat($format), mysql2date('U',$comment_date), $old_date);
     480
     481    if ($translate) {
     482        $comment_date = $gmt? $comment->comment_date_gmt : $comment->comment_date;
     483        $comment_date = qtrans_strftime(qtrans_convertTimeFormat($format), mysql2date('U',$comment_date), $old_date);
     484    } else {
     485        $comment_date = $old_date;
     486    }
     487        return $comment_date;
    482488}
    483489
    484490/* END DATE TIME FUNCTIONS */
     
    810816        return "<p>".preg_replace('/%LANG:([^:]*):([^%]*)%/', $language_list, $q_config['not_available'][$lang])."</p>";
    811817}
    812818
    813 ?>
    814  No newline at end of file
     819?>
  • tags/2.5/qtranslate_hooks.php

     
    245245add_filter('comment_moderation_subject',        'qtrans_useDefaultLanguage',0);
    246246add_filter('comment_moderation_text',           'qtrans_useDefaultLanguage',0);
    247247add_filter('get_comment_date',                          'qtrans_dateFromCommentForCurrentLanguage',0,2);
    248 add_filter('get_comment_time',                          'qtrans_timeFromCommentForCurrentLanguage',0,3);
     248add_filter('get_comment_time',                          'qtrans_timeFromCommentForCurrentLanguage',0,4);
    249249add_filter('get_the_modified_date',                     'qtrans_dateModifiedFromPostForCurrentLanguage',0,2);
    250250add_filter('get_the_modified_time',                     'qtrans_timeModifiedFromPostForCurrentLanguage',0,3);
    251251add_filter('get_the_time',                                      'qtrans_timeFromPostForCurrentLanguage',0,3);
     
    330330        add_filter('posts_where_request',               'qtrans_excludeUntranslatedPosts');
    331331}
    332332
    333 ?>
    334  No newline at end of file
     333?>