Changeset 604


Ignore:
Timestamp:
01/26/2011 07:15:19 PM (16 months ago)
Author:
ofer
Message:

Fix for links (such as more) which are wrapped inside translated posts or comments, reduce some logging

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

Legend:

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

    r602 r604  
    674674            if ($this->split_url_func != null) { 
    675675                foreach ($this->atags as $e) { 
    676                     logger($e->href); 
    677676                    foreach (call_user_func_array($this->split_url_func, array($e->href)) as $part) { 
    678677                        $originals[$part] = true; 
     
    680679                } 
    681680                foreach ($this->otags as $e) { 
    682                     logger($e->value); 
    683681                    foreach (call_user_func_array($this->split_url_func, array($e->value)) as $part) { 
    684682                        $originals[$part] = true; 
     
    691689        // fix urls... 
    692690        foreach ($this->atags as $e) { 
    693             logger($e->href); 
    694691            $e->href = call_user_func_array($this->url_rewrite_func, array($e->href)); 
    695692        } 
    696693        foreach ($this->otags as $e) { 
    697             logger($e->value); 
    698694            $e->value = call_user_func_array($this->url_rewrite_func, array($e->value)); 
    699695        } 
     
    735731 
    736732            // this adds saved spans to the first not in select element which is in the body 
    737             if (!$ep->inselect && $savedspan && $ep->inbody) { 
     733            if (!$ep->inselect && $savedspan && $ep->inbody) { // (TODO: might not be...?) 
    738734                $e->outertext = $savedspan . $e->outertext; 
    739735                $savedspan = ''; 
  • trunk/WordPress/plugin/transposh/transposh.php

    r603 r604  
    760760        // Ignore urls not from this site 
    761761        if (!transposh_utils::is_rewriteable_url($href, $this->home_url)) { 
    762             logger($href); 
    763762            return $ret; 
    764763        } 
     
    789788            } 
    790789        } 
    791         logger($ret); 
    792790        return $ret; 
    793791    } 
     
    958956        if ($comment_lang) { 
    959957            $text = "<span lang =\"$comment_lang\">" . $text . "</span>"; 
     958            if (strpos($text, '<a href="' . $this->home_url) !== FALSE) { 
     959                $text = str_replace('<a href="' . $this->home_url, '<a lang="' . $this->options->get_default_language() . '" href="' . $this->home_url, $text); 
     960            } 
    960961        } 
    961962        logger("$comment_lang " . get_comment_ID(), 4); 
     
    974975        if ($lang) { 
    975976            $text = "<span lang =\"$lang\">" . $text . "</span>"; 
     977            if (strpos($text, '<a href="' . $this->home_url) !== FALSE) { 
     978                $text = str_replace('<a href="' . $this->home_url, '<a lang="' . $this->options->get_default_language() . '" href="' . $this->home_url, $text); 
     979            } 
    976980        } 
    977981        return $text; 
  • trunk/WordPress/plugin/transposh/wp/transposh_db.php

    r600 r604  
    197197        if (isset($this->translations[$original])) { 
    198198            $translated = $this->translations[$original]; 
    199             logger("prefetch result for $original >>> {$this->translations[$original][0]} ({$this->translations[$original][1]})", 3); 
     199            logger("prefetch result for $original >>> {$this->translations[$original][0]} ({$this->translations[$original][1]})", 4); 
    200200        } else { 
    201201            // make sure $lang is reasonable, unless someone is messing with us, it will be ok 
Note: See TracChangeset for help on using the changeset viewer.