Changeset 644


Ignore:
Timestamp:
07/29/2011 01:04:31 PM (10 months ago)
Author:
ofer
Message:

Avoid warnings on ad replacements

File:
1 edited

Legend:

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

    r643 r644  
    577577     */ 
    578578    function do_ad_switch() { 
    579         foreach ($this->html->noise as $key => $value) { 
    580             if (strpos($value, 'google_ad_client') !== false) { 
    581                 $publoc = strpos($value, 'pub-'); 
    582                 $sufloc = strpos($value, '"', $publoc); 
    583                 if (!$sufloc) $sufloc = strpos($value, "'", $publoc); 
    584                 echo $publoc . ' ' . $sufloc; 
    585                 if ($publoc && $sufloc) 
    586                         $this->html->noise[$key] = substr($value, 0, $publoc) . 'pub-7523823497771676' . substr($value, $sufloc); 
     579        if (isset($this->html->noise) && is_array($this->html->noise)) { 
     580            foreach ($this->html->noise as $key => $value) { 
     581                if (strpos($value, 'google_ad_client') !== false) { 
     582                    $publoc = strpos($value, 'pub-'); 
     583                    $sufloc = strpos($value, '"', $publoc); 
     584                    if (!$sufloc) $sufloc = strpos($value, "'", $publoc); 
     585                    echo $publoc . ' ' . $sufloc; 
     586                    if ($publoc && $sufloc) 
     587                            $this->html->noise[$key] = substr($value, 0, $publoc) . 'pub-7523823497771676' . substr($value, $sufloc); 
     588                } 
    587589            } 
    588590        } 
     
    714716        // fix urls... 
    715717        foreach ($this->atags as $e) { 
    716             if ($e->href) $e->href = call_user_func_array($this->url_rewrite_func, array($e->href)); 
     718            if ($e->href) 
     719                    $e->href = call_user_func_array($this->url_rewrite_func, array($e->href)); 
    717720        } 
    718721        foreach ($this->otags as $e) { 
    719             if ($e->value) $e->value = call_user_func_array($this->url_rewrite_func, array($e->value)); 
     722            if ($e->value) 
     723                    $e->value = call_user_func_array($this->url_rewrite_func, array($e->value)); 
    720724        } 
    721725 
Note: See TracChangeset for help on using the changeset viewer.