Changeset 685
- Timestamp:
- 11/28/2011 09:02:00 AM (6 months ago)
- File:
-
- 1 edited
-
trunk/WordPress/plugin/transposh/core/parser.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WordPress/plugin/transposh/core/parser.php
r667 r685 28 28 /** @var int Holds the total phrases the parser encountered */ 29 29 public $total_phrases; 30 30 31 /** @var int Holds the number of phrases that had translation */ 31 32 public $translated_phrases; 33 32 34 /** @var int Holds the number of phrases that had human translation */ 33 35 public $human_translated_phrases; 36 34 37 /** @var int Holds the number of phrases that are hidden - yet still somewhat viewable (such as the title attribure) */ 35 38 public $hidden_phrases; 39 36 40 /** @var int Holds the number of phrases that are hidden and translated */ 37 41 public $hidden_translated_phrases; 42 38 43 /** @var int Holds the amounts of hidden spans created for translation */ 39 44 public $hidden_translateable_phrases; 45 40 46 /** @var int Holds the number of phrases that are hidden and probably won't be viewed - such as meta keys */ 41 47 public $meta_phrases; 48 42 49 /** @var int Holds the number of translated phrases that are hidden and probably won't be viewed - such as meta keys */ 43 50 public $meta_translated_phrases; 51 44 52 /** @var float Holds the time translation took */ 45 53 public $time; 54 46 55 /** @var int Holds the time translation started */ 47 56 private $start_time; … … 96 105 public $prefetch_translate_func = null; 97 106 public $split_url_func = null; 107 98 108 /** @var int stores the number of the last used span_id */ 99 109 private $span_id = 0; 110 100 111 /** @var simple_html_dom_node Contains the current node */ 101 112 private $currentnode; 113 102 114 /** @var simple_html_dom Contains the document dom model */ 103 115 private $html; 104 116 // the document 105 117 public $dir_rtl; 118 106 119 /** @var string Contains the iso of the target language */ 107 120 public $lang; 121 108 122 /** @var boolean Contains the fact that this language is the default one (only parse other lanaguage spans) */ 109 123 public $default_lang = false; 124 110 125 /** @var string Contains the iso of the source language - if a lang attribute is found, assumed to be en by default */ 111 126 public $srclang; 112 127 private $inbody = false; 128 113 129 /** @var hold fact that we are in select or other similar elements */ 114 130 private $inselect = false; … … 116 132 public $is_auto_translate; 117 133 public $feed_fix; 134 118 135 /** @var boolean should we attempt to handle page as json */ 119 136 public $might_json = false; … … 121 138 //first three are html, later 3 come from feeds xml (link is problematic...) 122 139 protected $ignore_tags = array('script' => 1, 'style' => 1, 'code' => 1, 'wfw:commentrss' => 1, 'comments' => 1, 'guid' => 1); 140 123 141 /** @var parserstats Contains parsing statistics */ 124 142 private $stats; 143 125 144 /** @var boolean Are we inside a translated gettext */ 126 145 private $in_get_text = false; 146 127 147 /** @var boolean Are we inside an inner text %s in gettext */ 128 148 private $in_get_text_inner = false; 149 129 150 /** @var string Additional header information */ 130 151 public $added_header; 152 131 153 /** @var array Contains reference to changable a tags */ 132 154 private $atags = array(); 155 133 156 /** @var array Contains reference to changable option values */ 134 157 private $otags = array(); … … 513 536 // for iframes we will rewrite urls if we can 514 537 elseif ($node->tag == 'iframe') { 515 $node->src = call_user_func_array($this->url_rewrite_func, array($node->src)); 516 logger($node->src); 538 if ($this->url_rewrite_func) { 539 $node->src = call_user_func_array($this->url_rewrite_func, array($node->src)); 540 logger($node->src); 541 } 517 542 } 518 543 … … 521 546 522 547 // Meta content (keywords, description) are also good places to translate (but not in robots... or http-equiv) 523 if ($node->tag == 'meta' && $node->content && ($node->name != 'robots') && ($node->name != 'viewport') && ($node->{'http-equiv'} != 'Content-Type'))548 if ($node->tag == 'meta' && $node->content && ($node->name != 'robots') && ($node->name != 'viewport') && ($node->{'http-equiv'} != 'Content-Type')) 524 549 $this->parsetext($node->content); 525 550 … … 867 892 // we might show an ad for transposh in some cases 868 893 if (($this->allow_ad && !$this->default_lang && mt_rand(1, 100) > 95) || // 5 of 100 for translated non default language pages 869 ($this->allow_ad && $this->default_lang && mt_rand(1, 100) > 99) || // 1 of 100 for translated default languages pages870 (!$this->allow_ad && mt_rand(1, 1000) > 999)) { // 1 of 1000 otherwise894 ($this->allow_ad && $this->default_lang && mt_rand(1, 100) > 99) || // 1 of 100 for translated default languages pages 895 (!$this->allow_ad && mt_rand(1, 1000) > 999)) { // 1 of 1000 otherwise 871 896 $this->do_ad_switch(); 872 897 }
Note: See TracChangeset
for help on using the changeset viewer.
