Changeset 93657 in spip-zone
- Timestamp:
- Dec 13, 2015, 2:58:00 PM (5 years ago)
- Location:
- _core_/plugins/textwheel
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
_core_/plugins/textwheel/engine/textwheel.php
r93628 r93657 47 47 public function setRuleSet($ruleset) { 48 48 if (!is_object($ruleset)) { 49 $ruleset = new TextWheelRuleSet 49 $ruleset = new TextWheelRuleSet($ruleset); 50 50 } 51 51 $this->ruleset = $ruleset; … … 85 85 $this->initRule($rule); 86 86 if (is_string($rule->replace) 87 ANDisset($this->compiled[$rule->replace])88 AND$fun = $this->compiled[$rule->replace]87 and isset($this->compiled[$rule->replace]) 88 and $fun = $this->compiled[$rule->replace] 89 89 ) { 90 90 $pre[] = "\n###\n## $name\n###\n" . $fun; … … 193 193 TextWheel::$subwheel[] = $this->createSubWheel($rule->replace); 194 194 $var = '$m[' . intval($rule->pick_match) . ']'; 195 if ($rule->type == 'all' OR $rule->type == 'str' OR $rule->type == 'split' OR!isset($rule->match)) {195 if ($rule->type == 'all' or $rule->type == 'str' or $rule->type == 'split' or !isset($rule->match)) { 196 196 $var = '$m'; 197 197 } … … 216 216 // test if quicker strtr usable 217 217 if (!$rule->is_callback 218 AND is_array($rule->match) ANDis_array($rule->replace)219 AND$c = array_map('strlen', $rule->match)220 AND$c = array_unique($c)221 ANDcount($c) == 1222 ANDreset($c) == 1223 AND$c = array_map('strlen', $rule->replace)224 AND$c = array_unique($c)225 ANDcount($c) == 1226 ANDreset($c) == 1218 and is_array($rule->match) and is_array($rule->replace) 219 and $c = array_map('strlen', $rule->match) 220 and $c = array_unique($c) 221 and count($c) == 1 222 and reset($c) == 1 223 and $c = array_map('strlen', $rule->replace) 224 and $c = array_unique($c) 225 and count($c) == 1 226 and reset($c) == 1 227 227 ) { 228 228 $rule->match = implode('', $rule->match); … … 264 264 } 265 265 266 if (isset($rule->if_chars) AND(strpbrk($t, $rule->if_chars) === false)) {266 if (isset($rule->if_chars) and (strpbrk($t, $rule->if_chars) === false)) { 267 267 return; 268 268 } 269 269 270 if (isset($rule->if_match) AND!preg_match($rule->if_match, $t)) {270 if (isset($rule->if_match) and !preg_match($rule->if_match, $t)) { 271 271 return; 272 272 } … … 277 277 } 278 278 279 if (isset($rule->if_str) ANDstrpos($t, $rule->if_str) === false) {279 if (isset($rule->if_str) and strpos($t, $rule->if_str) === false) { 280 280 return; 281 281 } 282 282 283 if (isset($rule->if_stri) ANDstripos($t, $rule->if_stri) === false) {283 if (isset($rule->if_stri) and stripos($t, $rule->if_stri) === false) { 284 284 return; 285 285 } … … 342 342 */ 343 343 protected static function replace_str(&$match, &$replace, &$t, &$count) { 344 if (!is_string($match) ORstrpos($t, $match) !== false) {344 if (!is_string($match) or strpos($t, $match) !== false) { 345 345 $t = str_replace($match, $replace, $t, $count); 346 346 } … … 435 435 436 436 class TextWheelDebug extends TextWheel { 437 static protected$t; #tableaux des temps438 static protected$tu; #tableaux des temps (rules utilises)439 static protected$tnu; #tableaux des temps (rules non utilises)440 static protected$u; #compteur des rules utiles441 static protected$w; #compteur des rules appliques442 static $total;437 protected static $t; #tableaux des temps 438 protected static $tu; #tableaux des temps (rules utilises) 439 protected static $tnu; #tableaux des temps (rules non utilises) 440 protected static $u; #compteur des rules utiles 441 protected static $w; #compteur des rules appliques 442 public static $total; 443 443 444 444 /** … … 461 461 $b = reset($b); 462 462 if (!isset($time[$t])) { 463 $time[$t] = $a +$b;463 $time[$t] = $a + $b; 464 464 } else { 465 $p = ($a +$b-$time[$t])*1000;465 $p = ($a + $b - $time[$t]) * 1000; 466 466 unset($time[$t]); 467 467 if ($raw) { … … 471 471 $s = ''; 472 472 } else { 473 $s = sprintf("%d ", $x = floor($p /1000));474 $p -= ($x *1000);473 $s = sprintf("%d ", $x = floor($p / 1000)); 474 $p -= ($x * 1000); 475 475 } 476 476 … … 539 539 $applications = intval(TextWheelDebug::$u[$r]); 540 540 $total += $t; 541 if (intval($t *10)) {541 if (intval($t * 10)) { 542 542 echo "<tr> 543 <td class='number strong'>" . number_format(round($t *10)/10, 1) . "</td><td> " . spip_htmlspecialchars($r) . "</td>543 <td class='number strong'>" . number_format(round($t * 10) / 10, 1) . "</td><td> " . spip_htmlspecialchars($r) . "</td> 544 544 <td" 545 545 . (!$applications ? " class='zero'" : "") 546 546 . ">" . $applications . "/" . intval(TextWheelDebug::$w[$r]) . "</td> 547 <td class='number'>" . ($applications ? number_format(round(TextWheelDebug::$tu[$r] /$applications*100)/100,547 <td class='number'>" . ($applications ? number_format(round(TextWheelDebug::$tu[$r] / $applications * 100) / 100, 548 548 2) : "") . "</td> 549 <td class='number'>" . (($nu = intval(TextWheelDebug::$w[$r]) -$applications) ? number_format(round(TextWheelDebug::$tnu[$r]/$nu*100)/100,549 <td class='number'>" . (($nu = intval(TextWheelDebug::$w[$r]) - $applications) ? number_format(round(TextWheelDebug::$tnu[$r] / $nu * 100) / 100, 550 550 2) : "") . "</td> 551 551 </tr>"; … … 571 571 foreach ($liste as $cause => $duree) { 572 572 if (is_array($duree)) { 573 TextWheelDebug::outputTotal($duree, $profondeur +1);573 TextWheelDebug::outputTotal($duree, $profondeur + 1); 574 574 } else { 575 575 echo "<tr class='prof-$profondeur'> -
_core_/plugins/textwheel/engine/textwheelrule.php
r93628 r93657 27 27 ## rule description 28 28 # optional 29 var$priority = 0; # rule priority (rules are applied in ascending order)29 public $priority = 0; # rule priority (rules are applied in ascending order) 30 30 # -100 = application escape, +100 = application unescape 31 var$name; # rule's name32 var$author; # rule's author33 var$url; # rule's homepage34 var$package; # rule belongs to package35 var$version; # rule version36 var$test; # rule test function37 var$disabled = false; # true if rule is disabled31 public $name; # rule's name 32 public $author; # rule's author 33 public $url; # rule's homepage 34 public $package; # rule belongs to package 35 public $version; # rule version 36 public $test; # rule test function 37 public $disabled = false; # true if rule is disabled 38 38 39 39 ## rule init checks 40 40 ## the rule will be applied if the text... 41 41 # optional 42 var$if_chars; # ...contains one of these chars43 var$if_str; # ...contains this string (case sensitive)44 var$if_stri; # ...contains this string (case insensitive)45 var$if_match; # ...matches this simple expr42 public $if_chars; # ...contains one of these chars 43 public $if_str; # ...contains this string (case sensitive) 44 public $if_stri; # ...contains this string (case insensitive) 45 public $if_match; # ...matches this simple expr 46 46 47 47 48 48 ## rule effectors, matching 49 49 # mandatory 50 var$type; # 'preg' (default), 'str', 'all', 'split'...51 var$match; # matching string or expression50 public $type; # 'preg' (default), 'str', 'all', 'split'... 51 public $match; # matching string or expression 52 52 # optional 53 53 # var $limit; # limit number of applications (unused) … … 55 55 ## rule effectors, replacing 56 56 # mandatory 57 var$replace; # replace match with this expression57 public $replace; # replace match with this expression 58 58 59 59 # optional 60 var$is_callback = false; # $replace is a callback function61 var$is_wheel; # flag to create a sub-wheel from rules given as replace62 var$pick_match = 0; # item to pick for sub-wheel replace63 var$glue = null; # glue for implode ending split rule60 public $is_callback = false; # $replace is a callback function 61 public $is_wheel; # flag to create a sub-wheel from rules given as replace 62 public $pick_match = 0; # item to pick for sub-wheel replace 63 public $glue = null; # glue for implode ending split rule 64 64 65 65 # optional 66 66 # language specific 67 var$require; # file to require_once68 var$create_replace; # do create_function('$m', %) on $this->replace, $m is the matched array67 public $require; # file to require_once 68 public $create_replace; # do create_function('$m', %) on $this->replace, $m is the matched array 69 69 70 70 # optimizations 71 var$func_replace;71 public $func_replace; 72 72 73 73 /** … … 97 97 throw new InvalidArgumentException('match argument for split rule can\'t be an array'); 98 98 } 99 if (isset($this->glue) ANDis_array($this->glue)) {99 if (isset($this->glue) and is_array($this->glue)) { 100 100 throw new InvalidArgumentException('glue argument for split rule can\'t be an array'); 101 101 } -
_core_/plugins/textwheel/engine/textwheelruleset.php
r93628 r93657 46 46 47 47 // file embed with texwheels, relative to calling ruleset 48 if ($path ANDfile_exists($f = $path . $file)) {48 if ($path and file_exists($f = $path . $file)) { 49 49 return $f; 50 50 } … … 71 71 if (!preg_match(',[.]yaml$,i', $file) 72 72 // external rules 73 OR!$file = $this->findFile($file, $default_path)73 or !$file = $this->findFile($file, $default_path) 74 74 ) { 75 75 return array(); … … 94 94 // include it as it contains callback functions 95 95 if ($f = preg_replace(',[.]yaml$,i', '.php', $file) 96 ANDfile_exists($f)96 and file_exists($f) 97 97 ) { 98 98 $dataset[] = array('require' => $f, 'priority' => -1000); … … 191 191 public function addRules($rules, $filepath = '') { 192 192 // rules can be an array of filename 193 if (is_array($rules) ANDis_string(reset($rules))) {193 if (is_array($rules) and is_string(reset($rules))) { 194 194 foreach ($rules as $i => $filename) { 195 195 $this->addRules($filename); … … 207 207 208 208 // rules can be an array of rules 209 if (is_array($rules) ANDcount($rules)) {209 if (is_array($rules) and count($rules)) { 210 210 # cast array-rules to objects 211 211 foreach ($rules as $i => $rule) { -
_core_/plugins/textwheel/inc/autoliens.php
r93628 r93657 55 55 return ($m ? $r : str_replace('>http://', '>', $r)); 56 56 } 57 58 59 ?> -
_core_/plugins/textwheel/inc/lien.php
r93628 r93657 150 150 151 151 $lang_objet_prev = ''; 152 if ($hlang AND$hlang !== $GLOBALS['spip_lang']) {152 if ($hlang and $hlang !== $GLOBALS['spip_lang']) { 153 153 $lang_objet_prev = isset($GLOBALS['lang_objet']) ? $GLOBALS['lang_objet'] : null; 154 154 $GLOBALS['lang_objet'] = $hlang; … … 350 350 include_spip('inc/texte'); 351 351 foreach ($regs as $reg) { 352 list ($titre, ,) = traiter_raccourci_lien_atts($reg[1]);352 list($titre, , ) = traiter_raccourci_lien_atts($reg[1]); 353 353 if (!$titre) { 354 $match = typer_raccourci($reg[count($reg) -1]);354 $match = typer_raccourci($reg[count($reg) - 1]); 355 355 if (!isset($match[0])) { 356 356 $match[0] = ''; 357 357 } 358 @list($type, , $id, , , , ) = $match;358 @list($type, , $id, , , , ) = $match; 359 359 360 360 if ($type) { … … 670 670 $f = 'auteur'; 671 671 } else { 672 if ($f == 'doc' OR $f == 'im' OR $f == 'img' OR $f == 'image' OR$f == 'emb') {672 if ($f == 'doc' or $f == 'im' or $f == 'img' or $f == 'image' or $f == 'emb') { 673 673 $f = 'document'; 674 674 } else { … … 703 703 $desc = $trouver_table(table_objet($type)); 704 704 705 if (!($desc AND$s = $desc['titre'])) {705 if (!($desc and $s = $desc['titre'])) { 706 706 return array(); 707 707 } … … 788 788 $n = strlen($r[0]); 789 789 $a -= $n; 790 $cherche = $n +strlen($regs[0]);790 $cherche = $n + strlen($regs[0]); 791 791 } else { 792 792 $lien = false; … … 840 840 $texte = substr($texte, 0, $a) 841 841 . $rempl 842 . substr($texte, $a +$cherche);842 . substr($texte, $a + $cherche); 843 843 } 844 844 } … … 944 944 return str_replace("%s", $terme, $glosateur); 945 945 } 946 -
_core_/plugins/textwheel/inc/notes.php
r93628 r93657 99 99 } 100 100 // si le marqueur n'a pas servi, le liberer 101 if (!strlen($les_notes) AND$marqueur == $next_marqueur) {101 if (!strlen($les_notes) and $marqueur == $next_marqueur) { 102 102 $next_marqueur--; 103 103 } … … 112 112 break; 113 113 case 'sauver_etat': 114 if ($compt_note OR $marqueur > 1 OR$next_marqueur > 1) {114 if ($compt_note or $marqueur > 1 or $next_marqueur > 1) { 115 115 return array($les_notes, $compt_note, $notes_vues, $marqueur, $next_marqueur); 116 116 } else { … … 119 119 break; 120 120 case 'restaurer_etat': 121 if ($arg ANDis_array($arg)) // si qqchose a restaurer121 if ($arg and is_array($arg)) // si qqchose a restaurer 122 122 { 123 123 list($les_notes, $compt_note, $notes_vues, $marqueur, $next_marqueur) = $arg; … … 125 125 break; 126 126 case 'contexter_cache': 127 if ($compt_note OR $marqueur > 1 OR$next_marqueur > 1) {127 if ($compt_note or $marqueur > 1 or $next_marqueur > 1) { 128 128 return array("$compt_note:$marqueur:$next_marqueur"); 129 129 } else { … … 150 150 151 151 if (strpos($letexte, '[[') === false 152 OR!preg_match_all(_NOTES_RACCOURCI, $letexte, $m, PREG_SET_ORDER)152 or !preg_match_all(_NOTES_RACCOURCI, $letexte, $m, PREG_SET_ORDER) 153 153 ) { 154 154 return array($letexte, array()); … … 166 166 // Cas pathologique: [[ <a> <a href="x">x</a>]] 167 167 168 if (!(isset($nom) AND$ref169 AND((strpos($note_texte, '</' . $nom . '>') === false)170 ORpreg_match(",<$nom\W.*</$nom>,", $note_texte)))168 if (!(isset($nom) and $ref 169 and ((strpos($note_texte, '</' . $nom . '>') === false) 170 or preg_match(",<$nom\W.*</$nom>,", $note_texte))) 171 171 ) { 172 172 $nom = ++$compt_note; … … 202 202 $letexte = rtrim(substr($letexte, 0, $pos), ' ') 203 203 . code_echappement($nom) 204 . substr($letexte, $pos +strlen($note_source));204 . substr($letexte, $pos + strlen($note_source)); 205 205 206 206 } … … 234 234 return ($GLOBALS['les_notes'] .= $mes_notes); 235 235 } 236 237 ?> -
_core_/plugins/textwheel/inc/ressource-mini.php
r93628 r93657 6 6 7 7 include_spip('inc/ressource'); 8 -
_core_/plugins/textwheel/inc/ressource.php
r93628 r93657 59 59 return '<html>' . $html . '</html>'; 60 60 } 61 62 ?> -
_core_/plugins/textwheel/inc/texte.php
r93628 r93657 99 99 $ruleset = SPIPTextWheelRuleset::loader($GLOBALS['spip_wheels']['paragrapher']); 100 100 if (!$toujours_paragrapher 101 AND$rule = $ruleset->getRule('toujours-paragrapher')101 and $rule = $ruleset->getRule('toujours-paragrapher') 102 102 ) { 103 103 $rule->disabled = true; … … 143 143 144 144 // Attention, si ce n'est pas une chaine, laisser intact 145 if (!$arg OR !is_string($arg) OR!strstr($arg, '<')) {145 if (!$arg or !is_string($arg) or !strstr($arg, '<')) { 146 146 return $arg; 147 147 } … … 157 157 // desactiver la regle echappe-js si besoin 158 158 if ($GLOBALS['filtrer_javascript'] == 1 159 OR ($GLOBALS['filtrer_javascript'] == 0 AND!test_espace_prive())159 or ($GLOBALS['filtrer_javascript'] == 0 and !test_espace_prive()) 160 160 ) { 161 161 $ruleset->addRules(array('securite-js' => array('disabled' => true))); … … 240 240 241 241 $letexte = traiter_modeles($mem = $letexte, false, $echapper ? $echapper : '', $connect, null, $env); 242 if (!$echapper AND$letexte != $mem) {242 if (!$echapper and $letexte != $mem) { 243 243 $echapper = ''; 244 244 } … … 260 260 // Dans l'espace prive on se mefie de tout contenu dangereux 261 261 // https://core.spip.net/issues/3371 262 if (isset($env['espace_prive']) AND$env['espace_prive']) {262 if (isset($env['espace_prive']) and $env['espace_prive']) { 263 263 $letexte = echapper_html_suspect($letexte); 264 264 } … … 390 390 $cols = $cols[1]; 391 391 $colspan = 1; 392 for ($c = count($cols) -1; $c >= 0; $c--) {392 for ($c = count($cols) - 1; $c >= 0; $c--) { 393 393 $attr = ''; 394 394 if ($cols[$c] == '<') { … … 458 458 for ($j = 0; $j < $k; $j++) { 459 459 $rowspans[$j][$i] = 1; 460 if ($align ANDpreg_match('/^[{+-]*(?:\s|\d)*([.,]?)\d*[}]*$/', trim($lignes[$j][$i]), $r)) {460 if ($align and preg_match('/^[{+-]*(?:\s|\d)*([.,]?)\d*[}]*$/', trim($lignes[$j][$i]), $r)) { 461 461 if ($r[1]) { 462 462 $align = $r[1]; … … 483 483 $html = ''; 484 484 485 for ($l = count($lignes) -1; $l >= 0; $l--) {485 for ($l = count($lignes) - 1; $l >= 0; $l--) { 486 486 $cols = $lignes[$l]; 487 487 $colspan = 1; 488 488 $ligne = ''; 489 489 490 for ($c = count($cols) -1; $c >= 0; $c--) {490 for ($c = count($cols) - 1; $c >= 0; $c--) { 491 491 $attr = $numeric[$c]; 492 492 $cell = trim($cols[$c]); … … 495 495 496 496 } elseif ($cell == '^') { 497 $rowspans[$l -1][$c] += $rowspans[$l][$c];497 $rowspans[$l - 1][$c] += $rowspans[$l][$c]; 498 498 499 499 } else { … … 505 505 $attr .= " rowspan='$x'"; 506 506 } 507 $b = ($c == 0 ANDisset($hl[$l])) ? 'th' : 'td';508 $h = (isset($hc[$c]) ? $hc[$c] : '') . ' ' . (($b == 'td' ANDisset($hl[$l])) ? $hl[$l] : '');507 $b = ($c == 0 and isset($hl[$l])) ? 'th' : 'td'; 508 $h = (isset($hc[$c]) ? $hc[$c] : '') . ' ' . (($b == 'td' and isset($hl[$l])) ? $hl[$l] : ''); 509 509 if ($h = trim($h)) { 510 510 $attr .= " headers='$h'"; … … 520 520 521 521 // ligne complete 522 $class = alterner($l +1, 'odd', 'even');522 $class = alterner($l + 1, 'odd', 'even'); 523 523 $html = "<tr class='row_$class $class'>$ligne</tr>\n$html"; 524 524 } … … 578 578 function personnaliser_raccourcis(&$ruleset) { 579 579 if ($ruleset) { 580 if (isset($GLOBALS['debut_intertitre']) AND$rule = $ruleset->getRule('intertitres')) {580 if (isset($GLOBALS['debut_intertitre']) and $rule = $ruleset->getRule('intertitres')) { 581 581 $rule->replace[0] = preg_replace(',<[^>]*>,Uims', $GLOBALS['debut_intertitre'], $rule->replace[0]); 582 582 $rule->replace[1] = preg_replace(',<[^>]*>,Uims', $GLOBALS['fin_intertitre'], $rule->replace[1]); 583 583 $ruleset->addRules(array('intertitres' => $rule)); 584 584 } 585 if (isset($GLOBALS['debut_gras']) AND$rule = $ruleset->getRule('gras')) {585 if (isset($GLOBALS['debut_gras']) and $rule = $ruleset->getRule('gras')) { 586 586 $rule->replace[0] = preg_replace(',<[^>]*>,Uims', $GLOBALS['debut_gras'], $rule->replace[0]); 587 587 $rule->replace[1] = preg_replace(',<[^>]*>,Uims', $GLOBALS['fin_gras'], $rule->replace[1]); 588 588 $ruleset->addRules(array('gras' => $rule)); 589 589 } 590 if (isset($GLOBALS['debut_italique']) AND$rule = $ruleset->getRule('italiques')) {590 if (isset($GLOBALS['debut_italique']) and $rule = $ruleset->getRule('italiques')) { 591 591 $rule->replace[0] = preg_replace(',<[^>]*>,Uims', $GLOBALS['debut_italique'], $rule->replace[0]); 592 592 $rule->replace[1] = preg_replace(',<[^>]*>,Uims', $GLOBALS['fin_italique'], $rule->replace[1]); 593 593 $ruleset->addRules(array('italiques' => $rule)); 594 594 } 595 if (isset($GLOBALS['ligne_horizontale']) AND$rule = $ruleset->getRule('ligne-horizontale')) {595 if (isset($GLOBALS['ligne_horizontale']) and $rule = $ruleset->getRule('ligne-horizontale')) { 596 596 $rule->replace = preg_replace(',<[^>]*>,Uims', $GLOBALS['ligne_horizontale'], $rule->replace); 597 597 $ruleset->addRules(array('ligne-horizontale' => $rule)); 598 598 } 599 if (isset($GLOBALS['toujours_paragrapher']) AND!$GLOBALS['toujours_paragrapher']600 AND$rule = $ruleset->getRule('toujours-paragrapher')599 if (isset($GLOBALS['toujours_paragrapher']) and !$GLOBALS['toujours_paragrapher'] 600 and $rule = $ruleset->getRule('toujours-paragrapher') 601 601 ) { 602 602 $rule->disabled = true; … … 634 634 // hack1: respecter le tag ignore br 635 635 if (_AUTOBR_IGNORER 636 ANDstrncmp($t, _AUTOBR_IGNORER, strlen(_AUTOBR_IGNORER)) == 0636 and strncmp($t, _AUTOBR_IGNORER, strlen(_AUTOBR_IGNORER)) == 0 637 637 ) { 638 638 $ignorer_autobr = true; … … 654 654 655 655 if (_request('var_mode') == 'wheel' 656 ANDautoriser('debug')656 and autoriser('debug') 657 657 ) { 658 658 $f = $wheel->compile(); … … 685 685 // hack2: wrap des autobr dans l'espace prive, pour affichage css 686 686 // car en css on ne sait pas styler l'element BR 687 if ($ignorer_autobr AND_AUTOBR) {687 if ($ignorer_autobr and _AUTOBR) { 688 688 if (is_null($img_br_no)) { 689 689 $img_br_no = ($show_autobr ? http_img_pack("br-no" . aide_lang_dir($spip_lang, $spip_lang_rtl) . "-10.png", … … 692 692 $t = str_replace(_AUTOBR, $img_br_no, $t); 693 693 } 694 if ($show_autobr AND_AUTOBR) {694 if ($show_autobr and _AUTOBR) { 695 695 if (is_null($img_br_manuel)) { 696 696 $img_br_manuel = http_img_pack("br-manuel" . aide_lang_dir($spip_lang, $spip_lang_rtl) . "-10.png", … … 740 740 // ne seront pas perturbes 741 741 $interdire_script = false; 742 if (is_null($connect) ANDtest_espace_prive()) {742 if (is_null($connect) and test_espace_prive()) { 743 743 $connect = ''; 744 744 $interdire_script = true; … … 754 754 $t = expanser_liens($t, $connect, $env); 755 755 756 $t = traiter_raccourcis($t, (isset($env['wysiwyg']) AND$env['wysiwyg']) ? true : false);756 $t = traiter_raccourcis($t, (isset($env['wysiwyg']) and $env['wysiwyg']) ? true : false); 757 757 $t = echappe_retour_modeles($t, $interdire_script); 758 758 … … 761 761 return $t; 762 762 } 763 764 ?> -
_core_/plugins/textwheel/inc/textwheel.php
r93628 r93657 31 31 32 32 // Si le tableau des raccourcis existe déjà 33 if (!isset($GLOBALS['spip_wheels']['raccourcis']) OR!is_array($GLOBALS['spip_wheels']['raccourcis'])) {33 if (!isset($GLOBALS['spip_wheels']['raccourcis']) or !is_array($GLOBALS['spip_wheels']['raccourcis'])) { 34 34 $GLOBALS['spip_wheels']['raccourcis'] = array( 35 35 'spip/spip.yaml', … … 80 80 81 81 // file include with texwheels, relative to calling ruleset 82 if ($path ANDfile_exists($f = $path . $file)) {82 if ($path and file_exists($f = $path . $file)) { 83 83 return $f; 84 84 } … … 99 99 100 100 # lecture du cache 101 if ((!defined('_VAR_MODE') OR_VAR_MODE != 'recalcul')102 AND$cacheruleset = tw_cache_get($key)101 if ((!defined('_VAR_MODE') or _VAR_MODE != 'recalcul') 102 and $cacheruleset = tw_cache_get($key) 103 103 ) { 104 104 return $cacheruleset; -
_core_/plugins/textwheel/inc/yaml-mini.php
r93628 r93657 19 19 } 20 20 } 21 22 ?> -
_core_/plugins/textwheel/wheels/spip/echappe-js.php
r93628 r93657 14 14 static $safehtml; 15 15 16 if (!is_array($match) OR!strlen($match[0])) {16 if (!is_array($match) or !strlen($match[0])) { 17 17 return ""; 18 18 } … … 21 21 // on echappe les urls data: javascript: et tout ce qui ressemble 22 22 if (strpos($texte, ":") !== false 23 ANDpreg_match(",(data|script)\s*:,iS", $texte)23 and preg_match(",(data|script)\s*:,iS", $texte) 24 24 ) { 25 25 $texte = nl2br(htmlspecialchars($texte)); 26 26 } // on echappe si on a possiblement un attribut onxxx et que ca passe pas dans safehtml 27 27 elseif (stripos($texte, "on") !== false 28 ANDpreg_match(",\bon\w+\s*=,i", $texte)28 and preg_match(",\bon\w+\s*=,i", $texte) 29 29 ) { 30 30 if (!isset($safehtml)) { 31 31 $safehtml = charger_fonction('safehtml', 'inc', true); 32 32 } 33 if (!$safehtml ORstrlen($safehtml($texte)) !== strlen($texte)) {33 if (!$safehtml or strlen($safehtml($texte)) !== strlen($texte)) { 34 34 $texte = nl2br(htmlspecialchars($texte)); 35 35 } -
_core_/plugins/textwheel/wheels/spip/spip-listes.php
r93628 r93657 63 63 // descendre un niveau plus bas, fermer ce niveau, et 64 64 // remonter 65 $change_type = ($type AND ($type <> $nouv_type) AND($profond == $niveau)) ? 1 : 0;65 $change_type = ($type and ($type <> $nouv_type) and ($profond == $niveau)) ? 1 : 0; 66 66 $type = $nouv_type; 67 67 68 68 // d'abord traiter les descentes 69 while ($niveau > $profond -$change_type) {69 while ($niveau > $profond - $change_type) { 70 70 $ajout .= $pile_li[$niveau]; 71 71 $ajout .= $pile_type[$niveau]; 72 72 if (!$change_type) { 73 unset 73 unset($pile_li[$niveau]); 74 74 } 75 75 $niveau--;
Note: See TracChangeset
for help on using the changeset viewer.