Changeset 487


Ignore:
Timestamp:
08/07/2010 01:52:57 AM (18 months ago)
Author:
ofer
Message:

Improve language tagging of posts to show language flag on edit lists

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/WordPress/plugin/transposh/transposh.php

    r483 r487  
    139139        add_action('comment_post', array(&$this, 'add_comment_meta_settings'), 1); 
    140140 
    141         // full post wrapping 
    142         add_filter('the_content', array(&$this, 'post_wrap')); 
    143         add_filter('the_title', array(&$this, 'post_wrap')); 
     141        // full post wrapping (should happen late) 
     142        add_filter('the_content', array(&$this, 'post_wrap'), 9999); 
     143        add_filter('the_title', array(&$this, 'post_wrap'), 9999); 
     144        // allow to mark the language? 
     145//        add_action('admin_menu', array(&$this, 'transposh_post_language')); 
     146//        add_action('save_post', array(&$this, 'transposh_save_post_language')); 
    144147 
    145148        //TODO add_action('manage_comments_nav', array(&$this,'manage_comments_nav')); 
     
    738741        return $url; 
    739742    } 
     743 
    740744    /** 
    741745     * Modify comments to include the relevant language span 
     
    760764    function post_wrap($text) { 
    761765        global $id; 
    762         $lang = get_post_meta($id, 'tp_language',true); 
    763             if ($lang) { 
     766        $lang = get_post_meta($id, 'tp_language', true); 
     767        if ($lang) { 
     768            logger($_SERVER['REQUEST_URI']); 
     769            if (strpos($_SERVER['REQUEST_URI'], 'wp-admin/edit') !== false) { 
     770                logger('iamhere?' . strpos($_SERVER['REQUEST_URI'], 'wp-admin/edit')); 
     771                $plugpath = parse_url($this->transposh_plugin_url, PHP_URL_PATH); 
     772                list($langeng, $langorig, $langflag) = explode(',', $GLOBALS['languages'][$lang]); 
     773                $text = display_flag("$plugpath/img/flags", $langflag, $langorig, false) . ' ' . $text; 
     774            } else { 
    764775                $text = "<span lang =\"$lang\">" . $text . "</span>"; 
    765776            } 
     777        } 
    766778        return $text; 
    767779    } 
Note: See TracChangeset for help on using the changeset viewer.