Changeset 519


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

Fixes for fetch_original

Location:
trunk/WordPress/plugin/transposh
Files:
2 edited

Legend:

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

    r512 r519  
    110110 
    111111        // remove the language from the url permalink (if in start of path, and is a defined language) 
     112        $gluebackhome = false; 
    112113        $home_path = rtrim(parse_url($home_url, PHP_URL_PATH), "/"); 
    113114        logger("home: $home_path " . $parsedurl['path'], 5); 
     
    134135        //$params =""; 
    135136        if ($is_edit) { 
    136             $params[edit] = EDIT_PARAM . '=1'; 
     137            $params['edit'] = EDIT_PARAM . '=1'; 
    137138        } 
    138139 
     
    252253     */ 
    253254    public static function translate_url($href, $home_url, $target_language, $fetch_translation_func) { 
     255        $url=''; 
     256        $querypart=''; 
    254257        // todo - check query part... sanitize 
    255258        if (strpos($href, '?') !== false) { 
     
    261264        foreach ($parts as $part) { 
    262265            if (!$part) continue; 
    263             list($translated_text, $old_source) = call_user_func_array($fetch_translation_func, array($part, $target_language)); 
     266            list($source, $translated_text) = call_user_func_array($fetch_translation_func, array($part, $target_language)); 
    264267            if ($translated_text) 
    265268                    $url .= '/' . str_replace(' ', '-', $translated_text); 
    266269            else { 
    267270                // now the same attempt with '-' replaced to ' ' 
    268                 list($translated_text, $old_source) = call_user_func_array($fetch_translation_func, array(str_replace('-', ' ', $part), $target_language)); 
     271                list($source, $translated_text) = call_user_func_array($fetch_translation_func, array(str_replace('-', ' ', $part), $target_language)); 
    269272                //logger ($part. ' '.str_replace('-', ' ', $part).' '.$translated_text); 
    270273                if ($translated_text) 
     
    289292        $url = urldecode($href); 
    290293        $url = (($pos = strpos($url, '?')) ? substr($url, 0, $pos) : $url); 
     294        $url2 =''; 
    291295        $parts = explode('/', $url); 
    292296        foreach ($parts as $part) { 
  • trunk/WordPress/plugin/transposh/wp/transposh_db.php

    r516 r519  
    221221        $translation = $GLOBALS['wpdb']->escape(html_entity_decode($translation, ENT_NOQUOTES, 'UTF-8')); 
    222222        // The translation might be cached (notice the additional postfix) 
    223         $cached = $this->cache_fetch('R_' . $translation, $lang); 
    224         if ($cached !== false) { 
    225             logger("Exit from cache: $cached", 4); 
     223        list($rev,$cached) = $this->cache_fetch('R_' . $translation, $lang); 
     224        if ($rev == 'r') { 
     225            logger("Exit from cache: $translation $cached", 4); 
    226226            return $cached; 
    227227        } 
     
    241241 
    242242        // we can store the result in the cache (or the fact we don't have one) 
    243         $this->cache_store('R_' . $translation, $lang, $original, TP_CACHE_TTL); 
     243        $this->cache_store('R_' . $translation, $lang, array('r',$original), TP_CACHE_TTL); 
    244244 
    245245        logger("Exit: $translation/$original", 4); 
     
    400400 
    401401        // check params 
    402         logger("Enter " . __FILE__ . " Params: $original , $translation, $lang, $ref", 3); 
     402        logger("Enter " . __FILE__ . " Params: $original , $lang, $ref", 3); 
    403403        if (!isset($original) || !isset($lang)) { 
    404404            logger("Enter " . __FILE__ . " missing params: $original, $lang," . $ref, 0); 
Note: See TracChangeset for help on using the changeset viewer.