Changeset 515


Ignore:
Timestamp:
08/24/2010 02:02:16 AM (18 months ago)
Author:
ofer
Message:

Use less and do a bit more, (only use the keys for prefetching)

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

Legend:

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

    r513 r515  
    600600            foreach ($this->html->find('text') as $e) { 
    601601                foreach ($e->nodes as $ep) { 
    602                     if ($ep->phrase) $originals[$ep->phrase] = $ep->phrase; 
     602                    if ($ep->phrase) $originals[$ep->phrase] = true; 
    603603                } 
    604604            } 
     
    606606                foreach ($this->html->find('[' . $title . ']') as $e) { 
    607607                    foreach ($e->nodes as $ep) { 
    608                         if ($ep->phrase) $originals[$ep->phrase] = $ep->phrase; 
     608                        if ($ep->phrase) $originals[$ep->phrase] = true; 
    609609                    } 
    610610                } 
     
    612612            foreach ($this->html->find('[content]') as $e) { 
    613613                foreach ($e->nodes as $ep) { 
    614                     if ($ep->phrase) $originals[$ep->phrase] = $ep->phrase; 
     614                    if ($ep->phrase) $originals[$ep->phrase] = true; 
    615615                } 
    616616            } 
  • trunk/WordPress/plugin/transposh/wp/transposh_db.php

    r513 r515  
    9191        if (!TP_ENABLE_CACHE) return false; 
    9292        $key = $lang . '_' . $original; 
    93         if ($translated !== null) { 
    94             $translated = implode('_', $translated); 
    95         } 
    96         //If we don't have translation still we want to have it in cache 
    97         //update cache FIXME, do we really need this null to ""? 
     93        if ($translated !== null) $translated = implode('_', $translated); 
    9894        if (function_exists('apc_store')) { 
    9995            $rc = apc_store($key, $translated, $ttl); 
     
    144140    /** 
    145141     * Allow fetching of multiple translation requests from the database with a single query 
    146      * @param array $originals 
     142     * @param array $originals keys hold the strings... 
    147143     * @param string $lang 
    148144     */ 
     
    150146        if (!$originals) return; 
    151147        logger($originals, 4); 
    152         foreach ($originals as $original) { 
     148        foreach ($originals as $original => $truth) { 
    153149            $original = $GLOBALS['wpdb']->escape(html_entity_decode($original, ENT_NOQUOTES, 'UTF-8')); 
    154150            $cached = $this->cache_fetch($original, $lang); 
     
    168164            $this->translations[$row['original']] = array($row['source'], stripslashes($row['translated'])); 
    169165        } 
    170         logger($this->translations, 5); 
     166        logger('prefetched: '.count($this->translations), 5); 
    171167    } 
    172168 
Note: See TracChangeset for help on using the changeset viewer.