@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | */ |
| 334 | 334 | function _sqlite_func_preg_replace($quoi, $cherche, $remplace) { |
| 335 | 335 | #spip_log("preg_replace : $quoi, $cherche, $remplace, $return",'sqlite.'._LOG_DEBUG); |
| 336 | - return preg_replace('%' . $cherche . '%', $remplace, $quoi); |
|
| 336 | + return preg_replace('%'.$cherche.'%', $remplace, $quoi); |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | /** |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | $u = $GLOBALS['meta']['pcre_u'] ?? 'u'; |
| 396 | 396 | |
| 397 | 397 | #spip_log("regexp_replace : $quoi, $cherche, $remplace, $return",'sqlite.'._LOG_DEBUG); |
| 398 | - return preg_match('%' . $cherche . '%imsS' . $u, $quoi); |
|
| 398 | + return preg_match('%'.$cherche.'%imsS'.$u, $quoi); |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | $count = 0; |
| 445 | 445 | str_replace($mysql_to_strftime_not_ok, '', $conv, $count); |
| 446 | 446 | if ($count > 0) { |
| 447 | - spip_log("DATE_FORMAT : At least one parameter can't be parsed by strftime with format '$conv'", 'sqlite.' . _LOG_ERREUR); |
|
| 447 | + spip_log("DATE_FORMAT : At least one parameter can't be parsed by strftime with format '$conv'", 'sqlite.'._LOG_ERREUR); |
|
| 448 | 448 | } |
| 449 | 449 | $to_strftime[$conv] = str_replace(array_keys($mysql_to_strftime), $mysql_to_strftime, $conv); |
| 450 | 450 | } |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | */ |
| 464 | 464 | function _sqlite_func_to_days($d) { |
| 465 | 465 | static $offset = 719528; // nb de jour entre 0000-00-00 et timestamp 0=1970-01-01 |
| 466 | - $result = $offset + (int)ceil(_sqlite_func_unix_timestamp($d) / (24 * 3600)); |
|
| 466 | + $result = $offset + (int) ceil(_sqlite_func_unix_timestamp($d) / (24 * 3600)); |
|
| 467 | 467 | |
| 468 | 468 | #spip_log("Passage avec TO_DAYS : $d, $result",'sqlite.'._LOG_DEBUG); |
| 469 | 469 | return $result; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | if (!$link) { |
| 60 | 60 | $erreurs[] = pg_last_error(); |
| 61 | 61 | foreach ($erreurs as $e) { |
| 62 | - spip_log('Echec pg_connect. Erreur : ' . $e, 'pg.' . _LOG_HS); |
|
| 62 | + spip_log('Echec pg_connect. Erreur : '.$e, 'pg.'._LOG_HS); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | return false; |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | spip_log( |
| 80 | - "Connexion vers $host, base $db, prefixe $prefixe " . ($link ? 'operationnelle' : 'impossible'), |
|
| 81 | - 'pg.' . _LOG_DEBUG |
|
| 80 | + "Connexion vers $host, base $db, prefixe $prefixe ".($link ? 'operationnelle' : 'impossible'), |
|
| 81 | + 'pg.'._LOG_DEBUG |
|
| 82 | 82 | ); |
| 83 | 83 | |
| 84 | 84 | return $link ? [ |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | } else { |
| 167 | 167 | $suite = ''; |
| 168 | 168 | } |
| 169 | - $query = preg_replace('/([,\s])spip_/', '\1' . $prefixe . '_', $query) . $suite; |
|
| 169 | + $query = preg_replace('/([,\s])spip_/', '\1'.$prefixe.'_', $query).$suite; |
|
| 170 | 170 | |
| 171 | 171 | // renvoyer la requete inerte si demandee |
| 172 | 172 | if (!$requeter) { |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | // ou revoir l'api de sql_alter en creant un |
| 235 | 235 | // sql_alter_table($table,array($actions)); |
| 236 | 236 | if (!preg_match('/\s*((\s*IGNORE)?\s*TABLE\s*([^\s]*))\s*(.*)?/is', $query, $regs)) { |
| 237 | - spip_log("$query mal comprise", 'pg.' . _LOG_ERREUR); |
|
| 237 | + spip_log("$query mal comprise", 'pg.'._LOG_ERREUR); |
|
| 238 | 238 | |
| 239 | 239 | return false; |
| 240 | 240 | } |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $i = 0; |
| 248 | 248 | $ouverte = false; |
| 249 | 249 | while ($do = array_shift($todo)) { |
| 250 | - $todo2[$i] = isset($todo2[$i]) ? $todo2[$i] . ',' . $do : $do; |
|
| 250 | + $todo2[$i] = isset($todo2[$i]) ? $todo2[$i].','.$do : $do; |
|
| 251 | 251 | $o = (str_contains($do, '(')); |
| 252 | 252 | $f = (str_contains($do, ')')); |
| 253 | 253 | if ($o && !$f) { |
@@ -260,33 +260,33 @@ discard block |
||
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | $todo = $todo2; |
| 263 | - $query = $debut . ' ' . array_shift($todo); |
|
| 263 | + $query = $debut.' '.array_shift($todo); |
|
| 264 | 264 | |
| 265 | 265 | if (!preg_match('/^\s*(IGNORE\s*)?TABLE\s+(\w+)\s+(ADD|DROP|CHANGE|MODIFY|RENAME)\s*(.*)$/is', $query, $r)) { |
| 266 | - spip_log("$query incompris", 'pg.' . _LOG_ERREUR); |
|
| 266 | + spip_log("$query incompris", 'pg.'._LOG_ERREUR); |
|
| 267 | 267 | } else { |
| 268 | 268 | if ($r[1]) { |
| 269 | - spip_log("j'ignore IGNORE dans $query", 'pg.' . _LOG_AVERTISSEMENT); |
|
| 269 | + spip_log("j'ignore IGNORE dans $query", 'pg.'._LOG_AVERTISSEMENT); |
|
| 270 | 270 | } |
| 271 | - $f = 'spip_pg_alter_' . strtolower($r[3]); |
|
| 271 | + $f = 'spip_pg_alter_'.strtolower($r[3]); |
|
| 272 | 272 | if (function_exists($f)) { |
| 273 | 273 | $f($r[2], $r[4], $serveur, $requeter); |
| 274 | 274 | } else { |
| 275 | - spip_log("$query non prevu", 'pg.' . _LOG_ERREUR); |
|
| 275 | + spip_log("$query non prevu", 'pg.'._LOG_ERREUR); |
|
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | // Alter a plusieurs args. Faudrait optimiser. |
| 279 | 279 | if ($todo) { |
| 280 | - spip_pg_alter("TABLE $table " . implode(',', $todo)); |
|
| 280 | + spip_pg_alter("TABLE $table ".implode(',', $todo)); |
|
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | function spip_pg_alter_change($table, $arg, $serveur = '', $requeter = true) { |
| 285 | 285 | if (!preg_match('/^`?(\w+)`?\s+`?(\w+)`?\s+(.*?)\s*(DEFAULT .*?)?(NOT\s+NULL)?\s*(DEFAULT .*?)?$/i', $arg, $r)) { |
| 286 | - spip_log("alter change: $arg incompris", 'pg.' . _LOG_ERREUR); |
|
| 286 | + spip_log("alter change: $arg incompris", 'pg.'._LOG_ERREUR); |
|
| 287 | 287 | } else { |
| 288 | 288 | [, $old, $new, $type, $default, $null, $def2] = $r; |
| 289 | - $actions = ["ALTER $old TYPE " . mysql2pg_type($type)]; |
|
| 289 | + $actions = ["ALTER $old TYPE ".mysql2pg_type($type)]; |
|
| 290 | 290 | $actions[] = $null ? "ALTER $old SET NOT NULL" : "ALTER $old DROP NOT NULL"; |
| 291 | 291 | |
| 292 | 292 | if ($d = ($default ?: $def2)) { |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | $actions[] = "ALTER $old DROP DEFAULT"; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | - spip_pg_query("ALTER TABLE $table " . implode(', ', $actions)); |
|
| 298 | + spip_pg_query("ALTER TABLE $table ".implode(', ', $actions)); |
|
| 299 | 299 | |
| 300 | 300 | if ($old !== $new) { |
| 301 | 301 | spip_pg_query("ALTER TABLE $table RENAME $old TO $new", $serveur); |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | function spip_pg_alter_add($table, $arg, $serveur = '', $requeter = true) { |
| 307 | 307 | $nom_index = null; |
| 308 | 308 | if (!preg_match('/^(COLUMN|INDEX|KEY|PRIMARY\s+KEY|)\s*(.*)$/', $arg, $r)) { |
| 309 | - spip_log("alter add $arg incompris", 'pg.' . _LOG_ERREUR); |
|
| 309 | + spip_log("alter add $arg incompris", 'pg.'._LOG_ERREUR); |
|
| 310 | 310 | |
| 311 | 311 | return null; |
| 312 | 312 | } |
@@ -316,14 +316,14 @@ discard block |
||
| 316 | 316 | $m[2] = $n[1]; |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - return spip_pg_query("ALTER TABLE $table ADD " . $m[1] . ' ' . mysql2pg_type($m[2]), $serveur, $requeter); |
|
| 319 | + return spip_pg_query("ALTER TABLE $table ADD ".$m[1].' '.mysql2pg_type($m[2]), $serveur, $requeter); |
|
| 320 | 320 | } elseif ($r[1][0] == 'P') { |
| 321 | 321 | // la primary peut etre sur plusieurs champs |
| 322 | 322 | $r[2] = trim(str_replace('`', '', $r[2])); |
| 323 | 323 | $m = ($r[2][0] == '(') ? substr($r[2], 1, -1) : $r[2]; |
| 324 | 324 | |
| 325 | 325 | return spip_pg_query( |
| 326 | - "ALTER TABLE $table ADD CONSTRAINT $table" . '_pkey PRIMARY KEY (' . $m . ')', |
|
| 326 | + "ALTER TABLE $table ADD CONSTRAINT $table".'_pkey PRIMARY KEY ('.$m.')', |
|
| 327 | 327 | $serveur, |
| 328 | 328 | $requeter |
| 329 | 329 | ); |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | $colonnes = substr($m[1], 1, -1); |
| 343 | 343 | if (str_contains(',', $colonnes)) { |
| 344 | 344 | spip_log('PG : Erreur, impossible de creer un index sur plusieurs colonnes' |
| 345 | - . " sans qu'il ait de nom ($table, ($colonnes))", 'pg.' . _LOG_ERREUR); |
|
| 345 | + . " sans qu'il ait de nom ($table, ($colonnes))", 'pg.'._LOG_ERREUR); |
|
| 346 | 346 | } else { |
| 347 | 347 | $nom_index = $colonnes; |
| 348 | 348 | } |
@@ -358,23 +358,23 @@ discard block |
||
| 358 | 358 | |
| 359 | 359 | function spip_pg_alter_drop($table, $arg, $serveur = '', $requeter = true) { |
| 360 | 360 | if (!preg_match('/^(COLUMN|INDEX|KEY|PRIMARY\s+KEY|)\s*`?(\w*)`?/', $arg, $r)) { |
| 361 | - spip_log("alter drop: $arg incompris", 'pg.' . _LOG_ERREUR); |
|
| 361 | + spip_log("alter drop: $arg incompris", 'pg.'._LOG_ERREUR); |
|
| 362 | 362 | } else { |
| 363 | 363 | if (!$r[1] || $r[1] == 'COLUMN') { |
| 364 | - return spip_pg_query("ALTER TABLE $table DROP " . $r[2], $serveur); |
|
| 364 | + return spip_pg_query("ALTER TABLE $table DROP ".$r[2], $serveur); |
|
| 365 | 365 | } elseif ($r[1][0] == 'P') { |
| 366 | - return spip_pg_query("ALTER TABLE $table DROP CONSTRAINT $table" . '_pkey', $serveur); |
|
| 366 | + return spip_pg_query("ALTER TABLE $table DROP CONSTRAINT $table".'_pkey', $serveur); |
|
| 367 | 367 | } else { |
| 368 | - return spip_pg_query('DROP INDEX ' . $table . '_' . $r[2], $serveur); |
|
| 368 | + return spip_pg_query('DROP INDEX '.$table.'_'.$r[2], $serveur); |
|
| 369 | 369 | } |
| 370 | 370 | } |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | function spip_pg_alter_modify($table, $arg, $serveur = '', $requeter = true) { |
| 374 | 374 | if (!preg_match('/^`?(\w+)`?\s+(.*)$/', $arg, $r)) { |
| 375 | - spip_log("alter modify: $arg incompris", 'pg.' . _LOG_ERREUR); |
|
| 375 | + spip_log("alter modify: $arg incompris", 'pg.'._LOG_ERREUR); |
|
| 376 | 376 | } else { |
| 377 | - return spip_pg_alter_change($table, $r[1] . ' ' . $arg, $serveur = '', $requeter = true); |
|
| 377 | + return spip_pg_alter_change($table, $r[1].' '.$arg, $serveur = '', $requeter = true); |
|
| 378 | 378 | } |
| 379 | 379 | } |
| 380 | 380 | |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | } elseif (preg_match('/^(TO)\s*`?(\w*)`?/', $arg, $r)) { |
| 391 | 391 | $rename = $r[2]; |
| 392 | 392 | } else { |
| 393 | - spip_log("alter rename: $arg incompris", 'pg.' . _LOG_ERREUR); |
|
| 393 | + spip_log("alter rename: $arg incompris", 'pg.'._LOG_ERREUR); |
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | return $rename ? spip_pg_query("ALTER TABLE $table RENAME TO $rename") : false; |
@@ -411,8 +411,8 @@ discard block |
||
| 411 | 411 | function spip_pg_create_index($nom, $table, $champs, $serveur = '', $requeter = true) { |
| 412 | 412 | if (!($nom || $table || $champs)) { |
| 413 | 413 | spip_log( |
| 414 | - "Champ manquant pour creer un index pg ($nom, $table, (" . @implode(',', $champs) . '))', |
|
| 415 | - 'pg.' . _LOG_ERREUR |
|
| 414 | + "Champ manquant pour creer un index pg ($nom, $table, (".@implode(',', $champs).'))', |
|
| 415 | + 'pg.'._LOG_ERREUR |
|
| 416 | 416 | ); |
| 417 | 417 | |
| 418 | 418 | return false; |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | |
| 424 | 424 | // PG ne differentie pas noms des index en fonction des tables |
| 425 | 425 | // il faut donc creer des noms uniques d'index pour une base pg |
| 426 | - $nom = $table . '_' . $nom; |
|
| 426 | + $nom = $table.'_'.$nom; |
|
| 427 | 427 | // enlever d'eventuelles parentheses deja presentes sur champs |
| 428 | 428 | if (!is_array($champs)) { |
| 429 | 429 | if ($champs[0] == '(') { |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | } |
| 432 | 432 | $champs = [$champs]; |
| 433 | 433 | } |
| 434 | - $query = "CREATE INDEX $nom ON $table (" . implode(',', $champs) . ')'; |
|
| 434 | + $query = "CREATE INDEX $nom ON $table (".implode(',', $champs).')'; |
|
| 435 | 435 | if (!$requeter) { |
| 436 | 436 | return $query; |
| 437 | 437 | } |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | } else { |
| 454 | 454 | $suite = ''; |
| 455 | 455 | } |
| 456 | - $query = 'EXPLAIN ' . preg_replace('/([,\s])spip_/', '\1' . $prefixe . '_', $query) . $suite; |
|
| 456 | + $query = 'EXPLAIN '.preg_replace('/([,\s])spip_/', '\1'.$prefixe.'_', $query).$suite; |
|
| 457 | 457 | |
| 458 | 458 | if (!$requeter) { |
| 459 | 459 | return $query; |
@@ -542,16 +542,16 @@ discard block |
||
| 542 | 542 | $having = implode("\n\tAND ", array_map('calculer_pg_where', $having)); |
| 543 | 543 | } |
| 544 | 544 | $from = spip_pg_from($from, $prefixe); |
| 545 | - $query = 'SELECT ' . $select |
|
| 545 | + $query = 'SELECT '.$select |
|
| 546 | 546 | . ($from ? "\nFROM $from" : '') |
| 547 | - . ($where ? "\nWHERE " . (is_array($where) ? implode( |
|
| 547 | + . ($where ? "\nWHERE ".(is_array($where) ? implode( |
|
| 548 | 548 | "\n\tAND ", |
| 549 | 549 | array_map('calculer_pg_where', $where) |
| 550 | 550 | ) : (calculer_pg_where($where))) : ('')) |
| 551 | 551 | . spip_pg_groupby($groupby, $from, $select) |
| 552 | 552 | . ($having ? "\nHAVING $having" : '') |
| 553 | 553 | . ($orderby ? ("\nORDER BY $orderby") : '') |
| 554 | - . ($limit ? " LIMIT $count" . ($offset ? " OFFSET $offset" : '') : ('')); |
|
| 554 | + . ($limit ? " LIMIT $count".($offset ? " OFFSET $offset" : '') : ('')); |
|
| 555 | 555 | |
| 556 | 556 | // renvoyer la requete inerte si demandee |
| 557 | 557 | if ($requeter === false) { |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | $from = spip_pg_select_as($from); |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | - return $prefixe ? preg_replace('/(\b)spip_/', '\1' . $prefixe . '_', $from) : $from; |
|
| 575 | + return $prefixe ? preg_replace('/(\b)spip_/', '\1'.$prefixe.'_', $from) : $from; |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | function spip_pg_orderby($order, $select) { |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | $arg = (is_array($order) ? $order : preg_split('/\s*,\s*/', $order)); |
| 581 | 581 | |
| 582 | 582 | foreach ($arg as $v) { |
| 583 | - $res[] = preg_match('/(case\s+.*?else\s+0\s+end)\s*AS\s+' . $v . '/', $select, $m) ? $m[1] : $v; |
|
| 583 | + $res[] = preg_match('/(case\s+.*?else\s+0\s+end)\s*AS\s+'.$v.'/', $select, $m) ? $m[1] : $v; |
|
| 584 | 584 | } |
| 585 | 585 | |
| 586 | 586 | return spip_pg_frommysql(implode(',', $res)); |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | $n++; |
| 755 | 755 | $res .= "\nwhen $index=$v then $n"; |
| 756 | 756 | } |
| 757 | - $arg = $m[1] . "case $res else 0 end " |
|
| 757 | + $arg = $m[1]."case $res else 0 end " |
|
| 758 | 758 | . substr($arg, strlen($m[0])); |
| 759 | 759 | } |
| 760 | 760 | |
@@ -797,9 +797,9 @@ discard block |
||
| 797 | 797 | } |
| 798 | 798 | |
| 799 | 799 | if (strtoupper($join) === 'AND') { |
| 800 | - return $exp . implode("\n\t$join ", array_map('calculer_pg_where', $v)); |
|
| 800 | + return $exp.implode("\n\t$join ", array_map('calculer_pg_where', $v)); |
|
| 801 | 801 | } else { |
| 802 | - return $exp . implode($join, $v); |
|
| 802 | + return $exp.implode($join, $v); |
|
| 803 | 803 | } |
| 804 | 804 | } |
| 805 | 805 | |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | if (str_ends_with($k, '@')) { |
| 810 | 810 | // c'est une jointure qui se refere au from precedent |
| 811 | 811 | // pas de virgule |
| 812 | - $argsas .= ' ' . $v; |
|
| 812 | + $argsas .= ' '.$v; |
|
| 813 | 813 | } else { |
| 814 | 814 | $as = ''; |
| 815 | 815 | // spip_log("$k : $v", _LOG_DEBUG); |
@@ -819,7 +819,7 @@ discard block |
||
| 819 | 819 | } elseif ($v != $k) { |
| 820 | 820 | $p = strpos($v, ' '); |
| 821 | 821 | if ($p) { |
| 822 | - $v = substr($v, 0, $p) . " AS $k" . substr($v, $p); |
|
| 822 | + $v = substr($v, 0, $p)." AS $k".substr($v, $p); |
|
| 823 | 823 | } else { |
| 824 | 824 | $as = " AS $k"; |
| 825 | 825 | } |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | } |
| 828 | 828 | // spip_log("subs $k : $v avec $as", _LOG_DEBUG); |
| 829 | 829 | // if (strpos($v, 'JOIN') === false) $argsas .= ', '; |
| 830 | - $argsas .= ', ' . $v . $as; |
|
| 830 | + $argsas .= ', '.$v.$as; |
|
| 831 | 831 | } |
| 832 | 832 | } |
| 833 | 833 | |
@@ -858,7 +858,7 @@ discard block |
||
| 858 | 858 | $serveur = '', |
| 859 | 859 | $requeter = true |
| 860 | 860 | ) { |
| 861 | - $c = $groupby ? 'DISTINCT ' . (is_string($groupby) ? $groupby : implode(',', $groupby)) : ('*'); |
|
| 861 | + $c = $groupby ? 'DISTINCT '.(is_string($groupby) ? $groupby : implode(',', $groupby)) : ('*'); |
|
| 862 | 862 | $r = spip_pg_select("COUNT($c)", $from, $where, '', '', '', $having, $serveur, $requeter); |
| 863 | 863 | if (!$requeter) { |
| 864 | 864 | return $r; |
@@ -959,8 +959,8 @@ discard block |
||
| 959 | 959 | |
| 960 | 960 | return spip_pg_insert( |
| 961 | 961 | $table, |
| 962 | - '(' . implode(',', array_keys($couples)) . ')', |
|
| 963 | - '(' . implode(',', $couples) . ')', |
|
| 962 | + '('.implode(',', array_keys($couples)).')', |
|
| 963 | + '('.implode(',', $couples).')', |
|
| 964 | 964 | $desc, |
| 965 | 965 | $serveur, |
| 966 | 966 | $requeter |
@@ -983,7 +983,7 @@ discard block |
||
| 983 | 983 | $c = $tab_couples[0] ?? []; |
| 984 | 984 | $les_cles = spip_pg_ajouter_champs_timestamp($table, $c, $desc, $serveur); |
| 985 | 985 | |
| 986 | - $cles = '(' . implode(',', array_keys($les_cles)) . ')'; |
|
| 986 | + $cles = '('.implode(',', array_keys($les_cles)).')'; |
|
| 987 | 987 | $valeurs = []; |
| 988 | 988 | foreach ($tab_couples as $couples) { |
| 989 | 989 | foreach ($couples as $champ => $val) { |
@@ -992,7 +992,7 @@ discard block |
||
| 992 | 992 | // recherche de champs 'timestamp' pour mise a jour auto de ceux-ci |
| 993 | 993 | $couples = spip_pg_ajouter_champs_timestamp($table, $couples, $desc, $serveur); |
| 994 | 994 | |
| 995 | - $valeurs[] = '(' . implode(',', $couples) . ')'; |
|
| 995 | + $valeurs[] = '('.implode(',', $couples).')'; |
|
| 996 | 996 | } |
| 997 | 997 | $valeurs = implode(', ', $valeurs); |
| 998 | 998 | |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | |
| 1014 | 1014 | $set = []; |
| 1015 | 1015 | foreach ($couples as $champ => $val) { |
| 1016 | - $set[] = $champ . '=' . $val; |
|
| 1016 | + $set[] = $champ.'='.$val; |
|
| 1017 | 1017 | } |
| 1018 | 1018 | |
| 1019 | 1019 | $query = calculer_pg_expression('UPDATE', $table, ',') |
@@ -1048,7 +1048,7 @@ discard block |
||
| 1048 | 1048 | |
| 1049 | 1049 | function spip_pg_replace($table, $values, $desc, $serveur = '', $requeter = true) { |
| 1050 | 1050 | if (!$values) { |
| 1051 | - spip_log("replace vide $table", 'pg.' . _LOG_AVERTISSEMENT); |
|
| 1051 | + spip_log("replace vide $table", 'pg.'._LOG_AVERTISSEMENT); |
|
| 1052 | 1052 | |
| 1053 | 1053 | return 0; |
| 1054 | 1054 | } |
@@ -1082,8 +1082,8 @@ discard block |
||
| 1082 | 1082 | if (!$where) { |
| 1083 | 1083 | return spip_pg_insert( |
| 1084 | 1084 | $table, |
| 1085 | - '(' . implode(',', array_keys($values)) . ')', |
|
| 1086 | - '(' . implode(',', $values) . ')', |
|
| 1085 | + '('.implode(',', array_keys($values)).')', |
|
| 1086 | + '('.implode(',', $values).')', |
|
| 1087 | 1087 | $desc, |
| 1088 | 1088 | $serveur |
| 1089 | 1089 | ); |
@@ -1104,12 +1104,11 @@ discard block |
||
| 1104 | 1104 | $couples = pg_affected_rows($couples); |
| 1105 | 1105 | } |
| 1106 | 1106 | if (!$couples) { |
| 1107 | - $ret = $seq ? " RETURNING nextval('$seq') < $prim" : |
|
| 1108 | - (''); |
|
| 1109 | - $connexion['last'] = $q = "INSERT INTO $table (" . implode(',', array_keys($values)) . ') VALUES (' . implode( |
|
| 1107 | + $ret = $seq ? " RETURNING nextval('$seq') < $prim" : (''); |
|
| 1108 | + $connexion['last'] = $q = "INSERT INTO $table (".implode(',', array_keys($values)).') VALUES ('.implode( |
|
| 1110 | 1109 | ',', |
| 1111 | 1110 | $values |
| 1112 | - ) . ")$ret"; |
|
| 1111 | + ).")$ret"; |
|
| 1113 | 1112 | $couples = spip_pg_query_simple($link, $q); |
| 1114 | 1113 | if (!$couples) { |
| 1115 | 1114 | return false; |
@@ -1156,7 +1155,7 @@ discard block |
||
| 1156 | 1155 | ) { |
| 1157 | 1156 | return ''; |
| 1158 | 1157 | } else { |
| 1159 | - return $raw ? $prim : $table . '_' . $prim . '_seq'; |
|
| 1158 | + return $raw ? $prim : $table.'_'.$prim.'_seq'; |
|
| 1160 | 1159 | } |
| 1161 | 1160 | } |
| 1162 | 1161 | |
@@ -1173,29 +1172,29 @@ discard block |
||
| 1173 | 1172 | return spip_pg_frommysql($v); |
| 1174 | 1173 | } else { |
| 1175 | 1174 | if (str_starts_with($v, '0000')) { |
| 1176 | - $v = '0001' . substr($v, 4); |
|
| 1175 | + $v = '0001'.substr($v, 4); |
|
| 1177 | 1176 | } |
| 1178 | 1177 | if (strpos($v, '-00-00') === 4) { |
| 1179 | - $v = substr($v, 0, 4) . '-01-01' . substr($v, 10); |
|
| 1178 | + $v = substr($v, 0, 4).'-01-01'.substr($v, 10); |
|
| 1180 | 1179 | } |
| 1181 | 1180 | |
| 1182 | 1181 | return "timestamp '$v'"; |
| 1183 | 1182 | } |
| 1184 | 1183 | } elseif (!sql_test_int($t)) { |
| 1185 | - return ("'" . pg_escape_string($v) . "'"); |
|
| 1184 | + return ("'".pg_escape_string($v)."'"); |
|
| 1186 | 1185 | } elseif (is_numeric($v) || str_starts_with($v, 'CAST(')) { |
| 1187 | 1186 | return $v; |
| 1188 | 1187 | } elseif ($v[0] == '0' && $v[1] !== 'x' && ctype_xdigit(substr($v, 1))) { |
| 1189 | 1188 | return substr($v, 1); |
| 1190 | 1189 | } else { |
| 1191 | - spip_log("Warning: '$v' n'est pas de type $t", 'pg.' . _LOG_AVERTISSEMENT); |
|
| 1190 | + spip_log("Warning: '$v' n'est pas de type $t", 'pg.'._LOG_AVERTISSEMENT); |
|
| 1192 | 1191 | |
| 1193 | 1192 | return (int) $v; |
| 1194 | 1193 | } |
| 1195 | 1194 | } |
| 1196 | 1195 | |
| 1197 | 1196 | function spip_pg_hex($v) { |
| 1198 | - return "CAST(x'" . $v . "' as bigint)"; |
|
| 1197 | + return "CAST(x'".$v."' as bigint)"; |
|
| 1199 | 1198 | } |
| 1200 | 1199 | |
| 1201 | 1200 | function spip_pg_quote($v, $type = '') { |
@@ -1233,15 +1232,15 @@ discard block |
||
| 1233 | 1232 | return $not ? '0=0' : '0=1'; |
| 1234 | 1233 | } |
| 1235 | 1234 | if (str_contains($valeurs, "CAST(x'")) { |
| 1236 | - return "($val=" . implode("OR $val=", explode(',', $valeurs)) . ')'; |
|
| 1235 | + return "($val=".implode("OR $val=", explode(',', $valeurs)).')'; |
|
| 1237 | 1236 | } |
| 1238 | 1237 | $n = $i = 0; |
| 1239 | 1238 | $in_sql = ''; |
| 1240 | 1239 | while ($n = strpos($valeurs, ',', $n + 1)) { |
| 1241 | 1240 | if ((++$i) >= 255) { |
| 1242 | - $in_sql .= "($val $not IN (" . |
|
| 1243 | - substr($valeurs, 0, $n) . |
|
| 1244 | - "))\n" . |
|
| 1241 | + $in_sql .= "($val $not IN (". |
|
| 1242 | + substr($valeurs, 0, $n). |
|
| 1243 | + "))\n". |
|
| 1245 | 1244 | ($not ? "AND\t" : "OR\t"); |
| 1246 | 1245 | $valeurs = substr($valeurs, $n + 1); |
| 1247 | 1246 | $i = $n = 0; |
@@ -1257,7 +1256,7 @@ discard block |
||
| 1257 | 1256 | $s = $link ? pg_last_error($link) : pg_last_error(); |
| 1258 | 1257 | if ($s) { |
| 1259 | 1258 | $s = str_replace('ERROR', 'errcode: 1000 ', $s); |
| 1260 | - spip_log("$s - $query", 'pg.' . _LOG_ERREUR); |
|
| 1259 | + spip_log("$s - $query", 'pg.'._LOG_ERREUR); |
|
| 1261 | 1260 | } |
| 1262 | 1261 | |
| 1263 | 1262 | return $s; |
@@ -1305,7 +1304,7 @@ discard block |
||
| 1305 | 1304 | function spip_pg_showbase($match, $serveur = '', $requeter = true) { |
| 1306 | 1305 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 1307 | 1306 | $link = $connexion['link']; |
| 1308 | - $connexion['last'] = $q = 'SELECT tablename FROM pg_tables WHERE tablename ILIKE ' . _q($match); |
|
| 1307 | + $connexion['last'] = $q = 'SELECT tablename FROM pg_tables WHERE tablename ILIKE '._q($match); |
|
| 1309 | 1308 | |
| 1310 | 1309 | return spip_pg_query_simple($link, $q); |
| 1311 | 1310 | } |
@@ -1313,7 +1312,7 @@ discard block |
||
| 1313 | 1312 | function spip_pg_showtable($nom_table, $serveur = '', $requeter = true) { |
| 1314 | 1313 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 1315 | 1314 | $link = $connexion['link']; |
| 1316 | - $connexion['last'] = $q = 'SELECT column_name, column_default, data_type FROM information_schema.columns WHERE table_name ILIKE ' . _q($nom_table); |
|
| 1315 | + $connexion['last'] = $q = 'SELECT column_name, column_default, data_type FROM information_schema.columns WHERE table_name ILIKE '._q($nom_table); |
|
| 1317 | 1316 | |
| 1318 | 1317 | $res = spip_pg_query_simple($link, $q); |
| 1319 | 1318 | if (!$res) { |
@@ -1324,15 +1323,15 @@ discard block |
||
| 1324 | 1323 | // il faut en tenir compte dans le return |
| 1325 | 1324 | $fields = []; |
| 1326 | 1325 | while ($field = pg_fetch_array($res, null, PGSQL_NUM)) { |
| 1327 | - $fields[$field[0]] = $field[2] . ($field[1] ? ' DEFAULT ' . $field[1] : ('')); |
|
| 1326 | + $fields[$field[0]] = $field[2].($field[1] ? ' DEFAULT '.$field[1] : ('')); |
|
| 1328 | 1327 | } |
| 1329 | - $connexion['last'] = $q = 'SELECT indexdef FROM pg_indexes WHERE tablename ILIKE ' . _q($nom_table); |
|
| 1328 | + $connexion['last'] = $q = 'SELECT indexdef FROM pg_indexes WHERE tablename ILIKE '._q($nom_table); |
|
| 1330 | 1329 | $res = spip_pg_query_simple($link, $q); |
| 1331 | 1330 | $keys = []; |
| 1332 | 1331 | while ($index = pg_fetch_array($res, null, PGSQL_NUM)) { |
| 1333 | 1332 | if (preg_match('/CREATE\s+(UNIQUE\s+)?INDEX\s([^\s]+).*\((.*)\)$/', $index[0], $r)) { |
| 1334 | - $nom = str_replace($nom_table . '_', '', $r[2]); |
|
| 1335 | - $keys[($r[1] ? 'PRIMARY KEY' : ('KEY ' . $nom))] = $r[3]; |
|
| 1333 | + $nom = str_replace($nom_table.'_', '', $r[2]); |
|
| 1334 | + $keys[($r[1] ? 'PRIMARY KEY' : ('KEY '.$nom))] = $r[3]; |
|
| 1336 | 1335 | } |
| 1337 | 1336 | } |
| 1338 | 1337 | |
@@ -1364,16 +1363,16 @@ discard block |
||
| 1364 | 1363 | if (str_starts_with($k, 'KEY ')) { |
| 1365 | 1364 | $n = str_replace('`', '', $k); |
| 1366 | 1365 | $v = str_replace('`', '"', $v); |
| 1367 | - $i = $nom . preg_replace('/KEY +/', '_', $n); |
|
| 1366 | + $i = $nom.preg_replace('/KEY +/', '_', $n); |
|
| 1368 | 1367 | if ($k != $n) { |
| 1369 | 1368 | $i = "\"$i\""; |
| 1370 | 1369 | } |
| 1371 | 1370 | $keys[] = "CREATE INDEX $i ON $nom ($v);"; |
| 1372 | 1371 | } elseif (str_starts_with($k, 'UNIQUE ')) { |
| 1373 | 1372 | $k = preg_replace('/^UNIQUE +/', '', $k); |
| 1374 | - $prim .= "$s\n\t\tCONSTRAINT " . str_replace('`', '"', $k) . " UNIQUE ($v)"; |
|
| 1373 | + $prim .= "$s\n\t\tCONSTRAINT ".str_replace('`', '"', $k)." UNIQUE ($v)"; |
|
| 1375 | 1374 | } else { |
| 1376 | - $prim .= "$s\n\t\t" . str_replace('`', '"', $k) . " ($v)"; |
|
| 1375 | + $prim .= "$s\n\t\t".str_replace('`', '"', $k)." ($v)"; |
|
| 1377 | 1376 | } |
| 1378 | 1377 | if ($k == 'PRIMARY KEY') { |
| 1379 | 1378 | $prim_name = $v; |
@@ -1384,16 +1383,16 @@ discard block |
||
| 1384 | 1383 | |
| 1385 | 1384 | $character_set = ''; |
| 1386 | 1385 | if (@$GLOBALS['meta']['charset_sql_base']) { |
| 1387 | - $character_set .= ' CHARACTER SET ' . $GLOBALS['meta']['charset_sql_base']; |
|
| 1386 | + $character_set .= ' CHARACTER SET '.$GLOBALS['meta']['charset_sql_base']; |
|
| 1388 | 1387 | } |
| 1389 | 1388 | if (@$GLOBALS['meta']['charset_collation_sql_base']) { |
| 1390 | - $character_set .= ' COLLATE ' . $GLOBALS['meta']['charset_collation_sql_base']; |
|
| 1389 | + $character_set .= ' COLLATE '.$GLOBALS['meta']['charset_collation_sql_base']; |
|
| 1391 | 1390 | } |
| 1392 | 1391 | |
| 1393 | 1392 | foreach ($champs as $k => $v) { |
| 1394 | 1393 | $k = str_replace('`', '"', $k); |
| 1395 | 1394 | if (preg_match(',([a-z]*\s*(\(\s*\d*\s*\))?(\s*binary)?),i', $v, $defs) && (preg_match(',(char|text),i', $defs[1]) && !preg_match(',binary,i', $defs[1]))) { |
| 1396 | - $v = $defs[1] . $character_set . ' ' . substr($v, strlen($defs[1])); |
|
| 1395 | + $v = $defs[1].$character_set.' '.substr($v, strlen($defs[1])); |
|
| 1397 | 1396 | } |
| 1398 | 1397 | |
| 1399 | 1398 | $query .= "$s\n\t\t$k " |
@@ -1407,7 +1406,7 @@ discard block |
||
| 1407 | 1406 | |
| 1408 | 1407 | // En l'absence de "if not exists" en PG, on neutralise les erreurs |
| 1409 | 1408 | |
| 1410 | - $q = "CREATE $temporary TABLE $nom ($query" . ($prim ? ",$prim" : '') . ')' . |
|
| 1409 | + $q = "CREATE $temporary TABLE $nom ($query".($prim ? ",$prim" : '').')'. |
|
| 1411 | 1410 | ($character_set ? " DEFAULT $character_set" : '') |
| 1412 | 1411 | . "\n"; |
| 1413 | 1412 | |
@@ -1418,7 +1417,7 @@ discard block |
||
| 1418 | 1417 | $r = @pg_query($link, $q); |
| 1419 | 1418 | |
| 1420 | 1419 | if (!$r) { |
| 1421 | - spip_log("Impossible de creer cette table: $q", 'pg.' . _LOG_ERREUR); |
|
| 1420 | + spip_log("Impossible de creer cette table: $q", 'pg.'._LOG_ERREUR); |
|
| 1422 | 1421 | } else { |
| 1423 | 1422 | foreach ($keys as $index) { |
| 1424 | 1423 | pg_query($link, $index); |
@@ -1441,20 +1440,20 @@ discard block |
||
| 1441 | 1440 | // vue deja presente |
| 1442 | 1441 | if (sql_showtable($nom, false, $serveur)) { |
| 1443 | 1442 | if ($requeter) { |
| 1444 | - spip_log("Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)", 'pg.' . _LOG_ERREUR); |
|
| 1443 | + spip_log("Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)", 'pg.'._LOG_ERREUR); |
|
| 1445 | 1444 | } |
| 1446 | 1445 | |
| 1447 | 1446 | return false; |
| 1448 | 1447 | } |
| 1449 | 1448 | |
| 1450 | - $query = "CREATE VIEW $nom AS " . $query_select; |
|
| 1449 | + $query = "CREATE VIEW $nom AS ".$query_select; |
|
| 1451 | 1450 | |
| 1452 | 1451 | return spip_pg_query($query, $serveur, $requeter); |
| 1453 | 1452 | } |
| 1454 | 1453 | |
| 1455 | 1454 | |
| 1456 | 1455 | function spip_pg_set_connect_charset($charset, $serveur = '', $requeter = true) { |
| 1457 | - spip_log('changement de charset sql a ecrire en PG', 'pg.' . _LOG_ERREUR); |
|
| 1456 | + spip_log('changement de charset sql a ecrire en PG', 'pg.'._LOG_ERREUR); |
|
| 1458 | 1457 | } |
| 1459 | 1458 | |
| 1460 | 1459 | |
@@ -1467,7 +1466,7 @@ discard block |
||
| 1467 | 1466 | * @return bool|string true / false / requete |
| 1468 | 1467 | **/ |
| 1469 | 1468 | function spip_pg_optimize($table, $serveur = '', $requeter = true) { |
| 1470 | - return spip_pg_query('VACUUM ' . $table, $serveur, $requeter); |
|
| 1469 | + return spip_pg_query('VACUUM '.$table, $serveur, $requeter); |
|
| 1471 | 1470 | } |
| 1472 | 1471 | |
| 1473 | 1472 | // Selectionner la sous-chaine dans $objet |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | function inc_sql_to_array_dist($data) { |
| 121 | 121 | # sortir le connecteur de $data |
| 122 | 122 | preg_match(',^(?:(\w+):)?(.*)$,Sm', $data, $v); |
| 123 | - $serveur = (string)$v[1]; |
|
| 123 | + $serveur = (string) $v[1]; |
|
| 124 | 124 | $req = trim($v[2]); |
| 125 | 125 | if ($s = sql_query($req, $serveur)) { |
| 126 | 126 | $r = []; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $json = json_decode($data, true, 512, JSON_THROW_ON_ERROR); |
| 146 | 146 | } catch (JsonException $e) { |
| 147 | 147 | $json = null; |
| 148 | - spip_log('Failed to parse Json data : ' . $e->getMessage(), _LOG_INFO); |
|
| 148 | + spip_log('Failed to parse Json data : '.$e->getMessage(), _LOG_INFO); |
|
| 149 | 149 | } |
| 150 | 150 | return is_array($json) ? (array) $json : []; |
| 151 | 151 | } |
@@ -165,13 +165,13 @@ discard block |
||
| 165 | 165 | $i = 1; |
| 166 | 166 | foreach ($entete as $k => $v) { |
| 167 | 167 | if (trim($v) == '') { |
| 168 | - $v = 'col' . $i; |
|
| 168 | + $v = 'col'.$i; |
|
| 169 | 169 | } // reperer des eventuelles cases vides |
| 170 | 170 | if (is_numeric($v) && $v < 0) { |
| 171 | - $v = '__' . $v; |
|
| 171 | + $v = '__'.$v; |
|
| 172 | 172 | } // ne pas risquer d'ecraser une cle numerique |
| 173 | 173 | if (is_numeric($v)) { |
| 174 | - $v = '_' . $v; |
|
| 174 | + $v = '_'.$v; |
|
| 175 | 175 | } // ne pas risquer d'ecraser une cle numerique |
| 176 | 176 | $v = strtolower(preg_replace(',\W+,', '_', translitteration($v))); |
| 177 | 177 | foreach ($csv as &$item) { |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | * @return array|bool |
| 258 | 258 | */ |
| 259 | 259 | function inc_pregfiles_to_array_dist($dir, $regexp = -1, $limit = 10000) { |
| 260 | - return (array)preg_files($dir, $regexp, $limit); |
|
| 260 | + return (array) preg_files($dir, $regexp, $limit); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | /** |
@@ -272,13 +272,13 @@ discard block |
||
| 272 | 272 | $glob_to_array = charger_fonction('glob_to_array', 'inc'); |
| 273 | 273 | $a = $glob_to_array($data); |
| 274 | 274 | foreach ($a as &$v) { |
| 275 | - $b = (array)@stat($v); |
|
| 275 | + $b = (array) @stat($v); |
|
| 276 | 276 | foreach (array_keys($b) as $k) { |
| 277 | 277 | if (is_numeric($k)) { |
| 278 | 278 | unset($b[$k]); |
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | - $b['file'] = preg_replace('`/$`', '', $v) ; |
|
| 281 | + $b['file'] = preg_replace('`/$`', '', $v); |
|
| 282 | 282 | $v = array_merge( |
| 283 | 283 | pathinfo($v), |
| 284 | 284 | $b |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | $xml_array = []; |
| 299 | 299 | for ($object->rewind(); $object->valid(); $object->next()) { |
| 300 | 300 | if (array_key_exists($key = $object->key(), $xml_array)) { |
| 301 | - $key .= '-' . uniqid(); |
|
| 301 | + $key .= '-'.uniqid(); |
|
| 302 | 302 | } |
| 303 | 303 | $vars = get_object_vars($object->current()); |
| 304 | 304 | if (isset($vars['@attributes'])) { |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | include_fichiers_fonctions(); |
| 98 | - foreach (['filtre_' . $fonc, 'filtre_' . $fonc . '_dist', $fonc] as $f) { |
|
| 98 | + foreach (['filtre_'.$fonc, 'filtre_'.$fonc.'_dist', $fonc] as $f) { |
|
| 99 | 99 | trouver_filtre_matrice($f); // charge des fichiers spécifiques éventuels |
| 100 | 100 | if (is_callable($f)) { |
| 101 | 101 | return $f; |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | // affichage "GIT [master: abcdef]" |
| 231 | 231 | $commit = $desc['commit_short'] ?? $desc['commit']; |
| 232 | 232 | if ($desc['branch']) { |
| 233 | - $commit = $desc['branch'] . ': ' . $commit; |
|
| 233 | + $commit = $desc['branch'].': '.$commit; |
|
| 234 | 234 | } |
| 235 | 235 | return "{$desc['vcs']} [$commit]"; |
| 236 | 236 | } |
@@ -251,9 +251,9 @@ discard block |
||
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | // version installee par GIT |
| 254 | - if (lire_fichier($dir . '/.git/HEAD', $c)) { |
|
| 254 | + if (lire_fichier($dir.'/.git/HEAD', $c)) { |
|
| 255 | 255 | $currentHead = trim(substr($c, 4)); |
| 256 | - if (lire_fichier($dir . '/.git/' . $currentHead, $hash)) { |
|
| 256 | + if (lire_fichier($dir.'/.git/'.$currentHead, $hash)) { |
|
| 257 | 257 | return [ |
| 258 | 258 | 'vcs' => 'GIT', |
| 259 | 259 | 'branch' => basename($currentHead), |
@@ -268,12 +268,12 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | // La matrice est necessaire pour ne filtrer _que_ des fonctions definies dans filtres_images |
| 270 | 270 | // et laisser passer les fonctions personnelles baptisees image_... |
| 271 | -$GLOBALS['spip_matrice']['image_graver'] = true;//'inc/filtres_images_mini.php'; |
|
| 272 | -$GLOBALS['spip_matrice']['image_select'] = true;//'inc/filtres_images_mini.php'; |
|
| 273 | -$GLOBALS['spip_matrice']['image_reduire'] = true;//'inc/filtres_images_mini.php'; |
|
| 274 | -$GLOBALS['spip_matrice']['image_reduire_par'] = true;//'inc/filtres_images_mini.php'; |
|
| 275 | -$GLOBALS['spip_matrice']['image_passe_partout'] = true;//'inc/filtres_images_mini.php'; |
|
| 276 | -$GLOBALS['spip_matrice']['image_recadre_avec_fallback'] = true;//'inc/filtres_images_mini.php'; |
|
| 271 | +$GLOBALS['spip_matrice']['image_graver'] = true; //'inc/filtres_images_mini.php'; |
|
| 272 | +$GLOBALS['spip_matrice']['image_select'] = true; //'inc/filtres_images_mini.php'; |
|
| 273 | +$GLOBALS['spip_matrice']['image_reduire'] = true; //'inc/filtres_images_mini.php'; |
|
| 274 | +$GLOBALS['spip_matrice']['image_reduire_par'] = true; //'inc/filtres_images_mini.php'; |
|
| 275 | +$GLOBALS['spip_matrice']['image_passe_partout'] = true; //'inc/filtres_images_mini.php'; |
|
| 276 | +$GLOBALS['spip_matrice']['image_recadre_avec_fallback'] = true; //'inc/filtres_images_mini.php'; |
|
| 277 | 277 | |
| 278 | 278 | $GLOBALS['spip_matrice']['couleur_html_to_hex'] = 'inc/filtres_images_mini.php'; |
| 279 | 279 | $GLOBALS['spip_matrice']['couleur_hex_to_hsl'] = 'inc/filtres_images_mini.php'; |
@@ -432,8 +432,8 @@ discard block |
||
| 432 | 432 | */ |
| 433 | 433 | function filtre_debug($val, $key = null) { |
| 434 | 434 | $debug = ( |
| 435 | - is_null($key) ? '' : (var_export($key, true) . ' = ') |
|
| 436 | - ) . var_export($val, true); |
|
| 435 | + is_null($key) ? '' : (var_export($key, true).' = ') |
|
| 436 | + ).var_export($val, true); |
|
| 437 | 437 | |
| 438 | 438 | include_spip('inc/autoriser'); |
| 439 | 439 | if (autoriser('webmestre')) { |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | $is_file = false; |
| 490 | 490 | } |
| 491 | 491 | if ($is_file) { |
| 492 | - $is_local_file = function ($path) { |
|
| 492 | + $is_local_file = function($path) { |
|
| 493 | 493 | if (str_contains($path, '?')) { |
| 494 | 494 | $path = supprimer_timestamp($path); |
| 495 | 495 | // remove ?24px added by find_in_theme on .svg files |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | && preg_match(",this[.]src=['\"]([^'\"]+)['\"],ims", $mouseover, $match) |
| 538 | 538 | ) { |
| 539 | 539 | $srcover = $match[1]; |
| 540 | - $srcover_filter = $filtre("<img src='" . $match[1] . "' />", ...$args); |
|
| 540 | + $srcover_filter = $filtre("<img src='".$match[1]."' />", ...$args); |
|
| 541 | 541 | $srcover_filter = extraire_attribut($srcover_filter, 'src'); |
| 542 | 542 | $reduit = str_replace($srcover, $srcover_filter, $reduit); |
| 543 | 543 | } |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | // " -> " et tout ce genre de choses |
| 937 | 937 | $u = $GLOBALS['meta']['pcre_u']; |
| 938 | 938 | $texte = str_replace(' ', ' ', $texte); |
| 939 | - $texte = preg_replace('/\s{2,}/S' . $u, ' ', $texte); |
|
| 939 | + $texte = preg_replace('/\s{2,}/S'.$u, ' ', $texte); |
|
| 940 | 940 | // ne pas echapper les sinqle quotes car certains outils de syndication gerent mal |
| 941 | 941 | $texte = entites_html($texte, false, false); |
| 942 | 942 | // mais bien echapper les double quotes ! |
@@ -998,7 +998,7 @@ discard block |
||
| 998 | 998 | return ''; |
| 999 | 999 | } |
| 1000 | 1000 | return preg_replace( |
| 1001 | - ',^[[:space:]]*([0-9]+)([.)]|' . chr(194) . '?' . chr(176) . ')[[:space:]]+,S', |
|
| 1001 | + ',^[[:space:]]*([0-9]+)([.)]|'.chr(194).'?'.chr(176).')[[:space:]]+,S', |
|
| 1002 | 1002 | '', |
| 1003 | 1003 | $texte |
| 1004 | 1004 | ); |
@@ -1027,7 +1027,7 @@ discard block |
||
| 1027 | 1027 | if ( |
| 1028 | 1028 | $texte |
| 1029 | 1029 | && preg_match( |
| 1030 | - ',^[[:space:]]*([0-9]+)([.)]|' . chr(194) . '?' . chr(176) . ')[[:space:]]+,S', |
|
| 1030 | + ',^[[:space:]]*([0-9]+)([.)]|'.chr(194).'?'.chr(176).')[[:space:]]+,S', |
|
| 1031 | 1031 | $texte, |
| 1032 | 1032 | $regs |
| 1033 | 1033 | ) |
@@ -1116,7 +1116,7 @@ discard block |
||
| 1116 | 1116 | **/ |
| 1117 | 1117 | function textebrut($texte) { |
| 1118 | 1118 | $u = $GLOBALS['meta']['pcre_u']; |
| 1119 | - $texte = preg_replace('/\s+/S' . $u, ' ', $texte); |
|
| 1119 | + $texte = preg_replace('/\s+/S'.$u, ' ', $texte); |
|
| 1120 | 1120 | $texte = preg_replace('/<(p|br)( [^>]*)?>/iS', "\n\n", $texte); |
| 1121 | 1121 | $texte = preg_replace("/^\n+/", '', $texte); |
| 1122 | 1122 | $texte = preg_replace("/\n+$/", '', $texte); |
@@ -1151,7 +1151,7 @@ discard block |
||
| 1151 | 1151 | ) |
| 1152 | 1152 | ) { |
| 1153 | 1153 | foreach ($liens[0] as $a) { |
| 1154 | - $rel = 'noopener noreferrer ' . extraire_attribut($a, 'rel'); |
|
| 1154 | + $rel = 'noopener noreferrer '.extraire_attribut($a, 'rel'); |
|
| 1155 | 1155 | $ablank = inserer_attribut($a, 'rel', $rel); |
| 1156 | 1156 | $ablank = inserer_attribut($ablank, 'target', '_blank'); |
| 1157 | 1157 | $texte = str_replace($a, $ablank, $texte); |
@@ -1176,7 +1176,7 @@ discard block |
||
| 1176 | 1176 | foreach ($regs[0] as $a) { |
| 1177 | 1177 | $rel = extraire_attribut($a, 'rel') ?? ''; |
| 1178 | 1178 | if (!str_contains($rel, 'nofollow')) { |
| 1179 | - $rel = 'nofollow' . ($rel ? " $rel" : ''); |
|
| 1179 | + $rel = 'nofollow'.($rel ? " $rel" : ''); |
|
| 1180 | 1180 | $anofollow = inserer_attribut($a, 'rel', $rel); |
| 1181 | 1181 | $texte = str_replace($a, $anofollow, $texte); |
| 1182 | 1182 | } |
@@ -1206,7 +1206,7 @@ discard block |
||
| 1206 | 1206 | $texte = preg_replace('@</p>@iS', "\n", $texte); |
| 1207 | 1207 | $texte = preg_replace("@<p\b.*>@UiS", '<br />', $texte); |
| 1208 | 1208 | |
| 1209 | - return preg_replace('@^\s*<br />@S' . $u, '', $texte); |
|
| 1209 | + return preg_replace('@^\s*<br />@S'.$u, '', $texte); |
|
| 1210 | 1210 | } |
| 1211 | 1211 | |
| 1212 | 1212 | |
@@ -1240,7 +1240,7 @@ discard block |
||
| 1240 | 1240 | return $texte; |
| 1241 | 1241 | } |
| 1242 | 1242 | include_spip('inc/texte'); |
| 1243 | - $tag = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $texte) ? |
|
| 1243 | + $tag = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $texte) ? |
|
| 1244 | 1244 | 'div' : 'span'; |
| 1245 | 1245 | |
| 1246 | 1246 | return "<$tag style='word-wrap:break-word;'>$texte</$tag>"; |
@@ -1331,7 +1331,7 @@ discard block |
||
| 1331 | 1331 | |
| 1332 | 1332 | // Calcul de la taille et choix de l'unité |
| 1333 | 1333 | $affichage = _T( |
| 1334 | - 'spip:taille_' . $unites[$puissance] . $suffixe_item, |
|
| 1334 | + 'spip:taille_'.$unites[$puissance].$suffixe_item, |
|
| 1335 | 1335 | [ |
| 1336 | 1336 | 'taille' => round($octets / $kilo ** $puissance, $precisions[$puissance]) |
| 1337 | 1337 | ] |
@@ -1365,7 +1365,7 @@ discard block |
||
| 1365 | 1365 | } |
| 1366 | 1366 | $u = $GLOBALS['meta']['pcre_u']; |
| 1367 | 1367 | if ($textebrut) { |
| 1368 | - $texte = preg_replace([",\n,", ',\s(?=\s),msS' . $u], [' ', ''], textebrut($texte)); |
|
| 1368 | + $texte = preg_replace([",\n,", ',\s(?=\s),msS'.$u], [' ', ''], textebrut($texte)); |
|
| 1369 | 1369 | } |
| 1370 | 1370 | $texte = texte_backend($texte); |
| 1371 | 1371 | $texte = str_replace(["'", '"'], [''', '"'], $texte); |
@@ -1400,7 +1400,7 @@ discard block |
||
| 1400 | 1400 | # un message pour abs_url |
| 1401 | 1401 | $GLOBALS['mode_abs_url'] = 'url'; |
| 1402 | 1402 | $url = trim($url); |
| 1403 | - $r = ',^(?:' . _PROTOCOLES_STD . '):?/?/?$,iS'; |
|
| 1403 | + $r = ',^(?:'._PROTOCOLES_STD.'):?/?/?$,iS'; |
|
| 1404 | 1404 | |
| 1405 | 1405 | return preg_match($r, $url) ? '' : ($entites ? entites_html($url) : $url); |
| 1406 | 1406 | } |
@@ -1605,7 +1605,7 @@ discard block |
||
| 1605 | 1605 | |
| 1606 | 1606 | $debut = ''; |
| 1607 | 1607 | $suite = $texte; |
| 1608 | - while ($t = strpos('-' . $suite, "\n", 1)) { |
|
| 1608 | + while ($t = strpos('-'.$suite, "\n", 1)) { |
|
| 1609 | 1609 | $debut .= substr($suite, 0, $t - 1); |
| 1610 | 1610 | $suite = substr($suite, $t); |
| 1611 | 1611 | $car = substr($suite, 0, 1); |
@@ -1623,7 +1623,7 @@ discard block |
||
| 1623 | 1623 | $suite = substr($suite, strlen($regs[0])); |
| 1624 | 1624 | } |
| 1625 | 1625 | } |
| 1626 | - $texte = $debut . $suite; |
|
| 1626 | + $texte = $debut.$suite; |
|
| 1627 | 1627 | |
| 1628 | 1628 | if ($collecteurModeles) { |
| 1629 | 1629 | $texte = $collecteurModeles->retablir($texte); |
@@ -1631,7 +1631,7 @@ discard block |
||
| 1631 | 1631 | |
| 1632 | 1632 | $texte = echappe_retour($texte); |
| 1633 | 1633 | |
| 1634 | - return $texte . $fin; |
|
| 1634 | + return $texte.$fin; |
|
| 1635 | 1635 | } |
| 1636 | 1636 | |
| 1637 | 1637 | |
@@ -1900,7 +1900,7 @@ discard block |
||
| 1900 | 1900 | if (is_array($balise)) { |
| 1901 | 1901 | array_walk( |
| 1902 | 1902 | $balise, |
| 1903 | - function (&$a, $key, $t) { |
|
| 1903 | + function(&$a, $key, $t) { |
|
| 1904 | 1904 | $a = extraire_attribut($a, $t); |
| 1905 | 1905 | }, |
| 1906 | 1906 | $attribut |
@@ -1994,14 +1994,14 @@ discard block |
||
| 1994 | 1994 | |
| 1995 | 1995 | if ($old !== null) { |
| 1996 | 1996 | // Remplacer l'ancien attribut du meme nom |
| 1997 | - $balise = $r[1] . $insert . $r[5]; |
|
| 1997 | + $balise = $r[1].$insert.$r[5]; |
|
| 1998 | 1998 | } else { |
| 1999 | 1999 | // preferer une balise " />" (comme <img />) |
| 2000 | 2000 | if (preg_match(',/>,', $balise)) { |
| 2001 | - $balise = preg_replace(',\s?/>,S', $insert . ' />', $balise, 1); |
|
| 2001 | + $balise = preg_replace(',\s?/>,S', $insert.' />', $balise, 1); |
|
| 2002 | 2002 | } // sinon une balise <a ...> ... </a> |
| 2003 | 2003 | else { |
| 2004 | - $balise = preg_replace(',\s?>,S', $insert . '>', $balise, 1); |
|
| 2004 | + $balise = preg_replace(',\s?>,S', $insert.'>', $balise, 1); |
|
| 2005 | 2005 | } |
| 2006 | 2006 | } |
| 2007 | 2007 | |
@@ -2059,7 +2059,7 @@ discard block |
||
| 2059 | 2059 | in_array($operation, ['ajouter', 'commuter']) |
| 2060 | 2060 | && !$is_class_presente |
| 2061 | 2061 | ) { |
| 2062 | - $class_new = ltrim(rtrim($class_new ?? '') . ' ' . $c); |
|
| 2062 | + $class_new = ltrim(rtrim($class_new ?? '').' '.$c); |
|
| 2063 | 2063 | } elseif ( |
| 2064 | 2064 | in_array($operation, ['supprimer', 'commuter']) |
| 2065 | 2065 | && $is_class_presente |
@@ -2129,7 +2129,7 @@ discard block |
||
| 2129 | 2129 | // Quelques fonctions de calcul arithmetique |
| 2130 | 2130 | // |
| 2131 | 2131 | function floatstr($a) { |
| 2132 | - return str_replace(',', '.', (string)(float) $a); |
|
| 2132 | + return str_replace(',', '.', (string) (float) $a); |
|
| 2133 | 2133 | } |
| 2134 | 2134 | function strize($f, $a, $b) { |
| 2135 | 2135 | return floatstr($f(floatstr($a), floatstr($b))); |
@@ -2270,13 +2270,13 @@ discard block |
||
| 2270 | 2270 | if (!defined('_TAGS_NOM_AUTEUR')) { |
| 2271 | 2271 | define('_TAGS_NOM_AUTEUR', ''); |
| 2272 | 2272 | } |
| 2273 | - $tags_acceptes = array_unique(explode(',', 'multi,' . _TAGS_NOM_AUTEUR)); |
|
| 2273 | + $tags_acceptes = array_unique(explode(',', 'multi,'._TAGS_NOM_AUTEUR)); |
|
| 2274 | 2274 | foreach ($tags_acceptes as $tag) { |
| 2275 | 2275 | if (strlen($tag)) { |
| 2276 | - $remp1[] = '<' . trim($tag) . '>'; |
|
| 2277 | - $remp1[] = '</' . trim($tag) . '>'; |
|
| 2278 | - $remp2[] = '\x60' . trim($tag) . '\x61'; |
|
| 2279 | - $remp2[] = '\x60/' . trim($tag) . '\x61'; |
|
| 2276 | + $remp1[] = '<'.trim($tag).'>'; |
|
| 2277 | + $remp1[] = '</'.trim($tag).'>'; |
|
| 2278 | + $remp2[] = '\x60'.trim($tag).'\x61'; |
|
| 2279 | + $remp2[] = '\x60/'.trim($tag).'\x61'; |
|
| 2280 | 2280 | } |
| 2281 | 2281 | } |
| 2282 | 2282 | $v_nom = str_replace($remp2, $remp1, supprimer_tags(str_replace($remp1, $remp2, $nom))); |
@@ -2395,10 +2395,10 @@ discard block |
||
| 2395 | 2395 | $fichier = basename($url); |
| 2396 | 2396 | |
| 2397 | 2397 | return '<a rel="enclosure"' |
| 2398 | - . ($url ? ' href="' . spip_htmlspecialchars($url) . '"' : '') |
|
| 2399 | - . ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '') |
|
| 2400 | - . ($length ? ' title="' . spip_htmlspecialchars($length) . '"' : '') |
|
| 2401 | - . '>' . $fichier . '</a>'; |
|
| 2398 | + . ($url ? ' href="'.spip_htmlspecialchars($url).'"' : '') |
|
| 2399 | + . ($type ? ' type="'.spip_htmlspecialchars($type).'"' : '') |
|
| 2400 | + . ($length ? ' title="'.spip_htmlspecialchars($length).'"' : '') |
|
| 2401 | + . '>'.$fichier.'</a>'; |
|
| 2402 | 2402 | } |
| 2403 | 2403 | |
| 2404 | 2404 | /** |
@@ -2426,9 +2426,9 @@ discard block |
||
| 2426 | 2426 | } # vieux data |
| 2427 | 2427 | $fichier = basename($url); |
| 2428 | 2428 | $enclosures[] = '<enclosure' |
| 2429 | - . ($url ? ' url="' . spip_htmlspecialchars($url) . '"' : '') |
|
| 2430 | - . ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '') |
|
| 2431 | - . ($length ? ' length="' . $length . '"' : '') |
|
| 2429 | + . ($url ? ' url="'.spip_htmlspecialchars($url).'"' : '') |
|
| 2430 | + . ($type ? ' type="'.spip_htmlspecialchars($type).'"' : '') |
|
| 2431 | + . ($length ? ' length="'.$length.'"' : '') |
|
| 2432 | 2432 | . ' />'; |
| 2433 | 2433 | } |
| 2434 | 2434 | } |
@@ -2454,7 +2454,7 @@ discard block |
||
| 2454 | 2454 | if (extraire_attribut($e, 'rel') == 'tag') { |
| 2455 | 2455 | $subjects .= '<dc:subject>' |
| 2456 | 2456 | . texte_backend(textebrut($e)) |
| 2457 | - . '</dc:subject>' . "\n"; |
|
| 2457 | + . '</dc:subject>'."\n"; |
|
| 2458 | 2458 | } |
| 2459 | 2459 | } |
| 2460 | 2460 | |
@@ -2490,7 +2490,7 @@ discard block |
||
| 2490 | 2490 | if (is_array($texte)) { |
| 2491 | 2491 | array_walk( |
| 2492 | 2492 | $texte, |
| 2493 | - function (&$a, $key, $t) { |
|
| 2493 | + function(&$a, $key, $t) { |
|
| 2494 | 2494 | $a = extraire_balise($a, $t); |
| 2495 | 2495 | }, |
| 2496 | 2496 | $tag |
@@ -2538,7 +2538,7 @@ discard block |
||
| 2538 | 2538 | if (is_array($texte)) { |
| 2539 | 2539 | array_walk( |
| 2540 | 2540 | $texte, |
| 2541 | - function (&$a, $key, $t) { |
|
| 2541 | + function(&$a, $key, $t) { |
|
| 2542 | 2542 | $a = extraire_balises($a, $t); |
| 2543 | 2543 | }, |
| 2544 | 2544 | $tag |
@@ -2671,7 +2671,7 @@ discard block |
||
| 2671 | 2671 | if ($fond != '404') { |
| 2672 | 2672 | $contexte = array_shift($p); |
| 2673 | 2673 | $contexte['page'] = $fond; |
| 2674 | - $action = preg_replace('/([?]' . preg_quote($fond, '/') . '[^&=]*[0-9]+)(&|$)/', '?&', $action); |
|
| 2674 | + $action = preg_replace('/([?]'.preg_quote($fond, '/').'[^&=]*[0-9]+)(&|$)/', '?&', $action); |
|
| 2675 | 2675 | } |
| 2676 | 2676 | } |
| 2677 | 2677 | // defaire ce qu'a injecte urls_decoder_url : a revoir en modifiant la signature de urls_decoder_url |
@@ -2726,9 +2726,9 @@ discard block |
||
| 2726 | 2726 | . '"' |
| 2727 | 2727 | . (is_null($val) |
| 2728 | 2728 | ? '' |
| 2729 | - : ' value="' . entites_html($val) . '"' |
|
| 2729 | + : ' value="'.entites_html($val).'"' |
|
| 2730 | 2730 | ) |
| 2731 | - . ' type="hidden"' . "\n/>"; |
|
| 2731 | + . ' type="hidden"'."\n/>"; |
|
| 2732 | 2732 | } |
| 2733 | 2733 | |
| 2734 | 2734 | return implode('', $hidden); |
@@ -2838,7 +2838,7 @@ discard block |
||
| 2838 | 2838 | |
| 2839 | 2839 | return preg_replace_callback( |
| 2840 | 2840 | ",url\s*\(\s*['\"]?([^'\"/#\s][^:]*)['\"]?\s*\),Uims", |
| 2841 | - fn($x) => "url('" . suivre_lien($path, $x[1]) . "')", |
|
| 2841 | + fn($x) => "url('".suivre_lien($path, $x[1])."')", |
|
| 2842 | 2842 | $contenu |
| 2843 | 2843 | ); |
| 2844 | 2844 | } |
@@ -2899,14 +2899,14 @@ discard block |
||
| 2899 | 2899 | ) { |
| 2900 | 2900 | $distant = true; |
| 2901 | 2901 | $cssf = parse_url($css); |
| 2902 | - $cssf = $cssf['path'] . ($cssf['query'] ? '?' . $cssf['query'] : ''); |
|
| 2902 | + $cssf = $cssf['path'].($cssf['query'] ? '?'.$cssf['query'] : ''); |
|
| 2903 | 2903 | $cssf = preg_replace(',[?:&=],', '_', $cssf); |
| 2904 | 2904 | } else { |
| 2905 | 2905 | $distant = false; |
| 2906 | 2906 | $cssf = $css; |
| 2907 | 2907 | // 1. regarder d'abord si un fichier avec la bonne direction n'est pas aussi |
| 2908 | 2908 | //propose (rien a faire dans ce cas) |
| 2909 | - $f = preg_replace(',(_rtl)?\.css$,i', '_' . $ndir . '.css', $css); |
|
| 2909 | + $f = preg_replace(',(_rtl)?\.css$,i', '_'.$ndir.'.css', $css); |
|
| 2910 | 2910 | if (@file_exists($f)) { |
| 2911 | 2911 | return $f; |
| 2912 | 2912 | } |
@@ -2916,7 +2916,7 @@ discard block |
||
| 2916 | 2916 | $dir_var = sous_repertoire(_DIR_VAR, 'cache-css'); |
| 2917 | 2917 | $f = $dir_var |
| 2918 | 2918 | . preg_replace(',.*/(.*?)(_rtl)?\.css,', '\1', $cssf) |
| 2919 | - . '.' . substr(md5($cssf), 0, 4) . '_' . $ndir . '.css'; |
|
| 2919 | + . '.'.substr(md5($cssf), 0, 4).'_'.$ndir.'.css'; |
|
| 2920 | 2920 | |
| 2921 | 2921 | // la css peut etre distante (url absolue !) |
| 2922 | 2922 | $contenu = null; |
@@ -2963,8 +2963,8 @@ discard block |
||
| 2963 | 2963 | } // si la css_direction commence par $dir_var on la fait passer pour une absolue |
| 2964 | 2964 | elseif (str_starts_with($css_direction, $dir_var)) { |
| 2965 | 2965 | $css_direction = substr($css_direction, strlen($dir_var)); |
| 2966 | - $src_faux_abs['/@@@@@@/' . $css_direction] = $css_direction; |
|
| 2967 | - $css_direction = '/@@@@@@/' . $css_direction; |
|
| 2966 | + $src_faux_abs['/@@@@@@/'.$css_direction] = $css_direction; |
|
| 2967 | + $css_direction = '/@@@@@@/'.$css_direction; |
|
| 2968 | 2968 | } |
| 2969 | 2969 | $src[] = $regs[0][$k]; |
| 2970 | 2970 | $src_direction_css[] = str_replace($import_css, $css_direction, $regs[0][$k]); |
@@ -3013,7 +3013,7 @@ discard block |
||
| 3013 | 3013 | |
| 3014 | 3014 | $f = basename($css, '.css'); |
| 3015 | 3015 | $f = sous_repertoire(_DIR_VAR, 'cache-css') |
| 3016 | - . preg_replace(',(.*?)(_rtl|_ltr)?$,', "\\1-urlabs-" . substr(md5("$css-urlabs"), 0, 4) . "\\2", $f) |
|
| 3016 | + . preg_replace(',(.*?)(_rtl|_ltr)?$,', "\\1-urlabs-".substr(md5("$css-urlabs"), 0, 4)."\\2", $f) |
|
| 3017 | 3017 | . '.css'; |
| 3018 | 3018 | |
| 3019 | 3019 | if (@filemtime($f) > @filemtime($css) && _VAR_MODE != 'recalcul') { |
@@ -3024,7 +3024,7 @@ discard block |
||
| 3024 | 3024 | if ($url_absolue_css == $css) { |
| 3025 | 3025 | if ( |
| 3026 | 3026 | strncmp($GLOBALS['meta']['adresse_site'], $css, $l = strlen($GLOBALS['meta']['adresse_site'])) != 0 |
| 3027 | - || !lire_fichier(_DIR_RACINE . substr($css, $l), $contenu) |
|
| 3027 | + || !lire_fichier(_DIR_RACINE.substr($css, $l), $contenu) |
|
| 3028 | 3028 | ) { |
| 3029 | 3029 | include_spip('inc/distant'); |
| 3030 | 3030 | $contenu = recuperer_url($css); |
@@ -3136,7 +3136,7 @@ discard block |
||
| 3136 | 3136 | $expression = str_replace('\/', '/', $expression); |
| 3137 | 3137 | $expression = str_replace('/', '\/', $expression); |
| 3138 | 3138 | |
| 3139 | - if (preg_match('/' . $expression . '/' . $modif, $texte ?? '', $r)) { |
|
| 3139 | + if (preg_match('/'.$expression.'/'.$modif, $texte ?? '', $r)) { |
|
| 3140 | 3140 | if (isset($r[$capte])) { |
| 3141 | 3141 | return $r[$capte]; |
| 3142 | 3142 | } else { |
@@ -3178,7 +3178,7 @@ discard block |
||
| 3178 | 3178 | $expression = str_replace('\/', '/', $expression); |
| 3179 | 3179 | $expression = str_replace('/', '\/', $expression); |
| 3180 | 3180 | |
| 3181 | - return (string) preg_replace('/' . $expression . '/' . $modif, $replace, $texte); |
|
| 3181 | + return (string) preg_replace('/'.$expression.'/'.$modif, $replace, $texte); |
|
| 3182 | 3182 | } |
| 3183 | 3183 | |
| 3184 | 3184 | |
@@ -3197,7 +3197,7 @@ discard block |
||
| 3197 | 3197 | function traiter_doublons_documents(&$doublons, $letexte) { |
| 3198 | 3198 | |
| 3199 | 3199 | // Verifier dans le texte & les notes (pas beau, helas) |
| 3200 | - $t = $letexte . $GLOBALS['les_notes']; |
|
| 3200 | + $t = $letexte.$GLOBALS['les_notes']; |
|
| 3201 | 3201 | |
| 3202 | 3202 | if ( |
| 3203 | 3203 | strstr($t, 'spip_document_') |
@@ -3211,7 +3211,7 @@ discard block |
||
| 3211 | 3211 | if (!isset($doublons['documents'])) { |
| 3212 | 3212 | $doublons['documents'] = ''; |
| 3213 | 3213 | } |
| 3214 | - $doublons['documents'] .= ',' . implode(',', $matches[1]); |
|
| 3214 | + $doublons['documents'] .= ','.implode(',', $matches[1]); |
|
| 3215 | 3215 | } |
| 3216 | 3216 | |
| 3217 | 3217 | return $letexte; |
@@ -3268,7 +3268,7 @@ discard block |
||
| 3268 | 3268 | if ($env) { |
| 3269 | 3269 | foreach ($env as $i => $j) { |
| 3270 | 3270 | if (is_string($j) && !in_array($i, $ignore_params)) { |
| 3271 | - $texte .= "<param name='" . attribut_html($i) . "'\n\tvalue='" . attribut_html($j) . "' />"; |
|
| 3271 | + $texte .= "<param name='".attribut_html($i)."'\n\tvalue='".attribut_html($j)."' />"; |
|
| 3272 | 3272 | } |
| 3273 | 3273 | } |
| 3274 | 3274 | } |
@@ -3307,7 +3307,7 @@ discard block |
||
| 3307 | 3307 | if ($env) { |
| 3308 | 3308 | foreach ($env as $i => $j) { |
| 3309 | 3309 | if (is_string($j) && !in_array($i, $ignore_params)) { |
| 3310 | - $texte .= attribut_html($i) . "='" . attribut_html($j) . "' "; |
|
| 3310 | + $texte .= attribut_html($i)."='".attribut_html($j)."' "; |
|
| 3311 | 3311 | } |
| 3312 | 3312 | } |
| 3313 | 3313 | } |
@@ -3381,11 +3381,11 @@ discard block |
||
| 3381 | 3381 | // si il y a un .svg a la bonne taille (-16.svg) a cote, on l'utilise en remplacement du -16.png |
| 3382 | 3382 | if ( |
| 3383 | 3383 | preg_match(',-(\d+)[.](png|gif|svg)$,', $img_file, $m) |
| 3384 | - && ($variante_svg_generique = substr($img_file, 0, -strlen($m[0])) . '-xx.svg') |
|
| 3384 | + && ($variante_svg_generique = substr($img_file, 0, -strlen($m[0])).'-xx.svg') |
|
| 3385 | 3385 | && file_exists($variante_svg_generique) |
| 3386 | 3386 | ) { |
| 3387 | 3387 | if ( |
| 3388 | - ($variante_svg_size = substr($variante_svg_generique, 0, -6) . $m[1] . '.svg') |
|
| 3388 | + ($variante_svg_size = substr($variante_svg_generique, 0, -6).$m[1].'.svg') |
|
| 3389 | 3389 | && file_exists($variante_svg_size)) { |
| 3390 | 3390 | $img_file = $variante_svg_size; |
| 3391 | 3391 | } else { |
@@ -3440,7 +3440,7 @@ discard block |
||
| 3440 | 3440 | return ''; |
| 3441 | 3441 | } |
| 3442 | 3442 | } |
| 3443 | - $atts .= " width='" . $largeur . "' height='" . $hauteur . "'"; |
|
| 3443 | + $atts .= " width='".$largeur."' height='".$hauteur."'"; |
|
| 3444 | 3444 | } |
| 3445 | 3445 | |
| 3446 | 3446 | if (file_exists($img_file)) { |
@@ -3450,14 +3450,14 @@ discard block |
||
| 3450 | 3450 | $alt = ''; |
| 3451 | 3451 | } |
| 3452 | 3452 | elseif ($alt || $alt === '') { |
| 3453 | - $alt = " alt='" . attribut_html($alt) . "'"; |
|
| 3453 | + $alt = " alt='".attribut_html($alt)."'"; |
|
| 3454 | 3454 | } |
| 3455 | 3455 | else { |
| 3456 | - $alt = " alt='" . attribut_html($title) . "'"; |
|
| 3456 | + $alt = " alt='".attribut_html($title)."'"; |
|
| 3457 | 3457 | } |
| 3458 | - return "<img src='" . attribut_html($img_file) . "'$alt" |
|
| 3459 | - . ($title ? ' title="' . attribut_html($title) . '"' : '') |
|
| 3460 | - . ' ' . ltrim($atts) |
|
| 3458 | + return "<img src='".attribut_html($img_file)."'$alt" |
|
| 3459 | + . ($title ? ' title="'.attribut_html($title).'"' : '') |
|
| 3460 | + . ' '.ltrim($atts) |
|
| 3461 | 3461 | . ' />'; |
| 3462 | 3462 | } |
| 3463 | 3463 | |
@@ -3471,10 +3471,10 @@ discard block |
||
| 3471 | 3471 | */ |
| 3472 | 3472 | function http_style_background($img, $att = '', $size = null) { |
| 3473 | 3473 | if ($size && is_numeric($size)) { |
| 3474 | - $size = trim($size) . 'px'; |
|
| 3474 | + $size = trim($size).'px'; |
|
| 3475 | 3475 | } |
| 3476 | - return " style='background" . |
|
| 3477 | - ($att ? '' : '-image') . ': url("' . chemin_image($img) . '")' . ($att ? (' ' . $att) : '') . ';' |
|
| 3476 | + return " style='background". |
|
| 3477 | + ($att ? '' : '-image').': url("'.chemin_image($img).'")'.($att ? (' '.$att) : '').';' |
|
| 3478 | 3478 | . ($size ? "background-size:{$size};" : '') |
| 3479 | 3479 | . "'"; |
| 3480 | 3480 | } |
@@ -3584,7 +3584,7 @@ discard block |
||
| 3584 | 3584 | $img = http_img_pack( |
| 3585 | 3585 | $img, |
| 3586 | 3586 | $alt, |
| 3587 | - $class ? " class='" . attribut_html($class) . "'" : '', |
|
| 3587 | + $class ? " class='".attribut_html($class)."'" : '', |
|
| 3588 | 3588 | '', |
| 3589 | 3589 | ['chemin_image' => false, 'utiliser_suffixe_size' => false] |
| 3590 | 3590 | ); |
@@ -3684,9 +3684,9 @@ discard block |
||
| 3684 | 3684 | // regler le alt |
| 3685 | 3685 | if ($alt) { |
| 3686 | 3686 | $balise_svg = inserer_attribut($balise_svg, 'role', 'img'); |
| 3687 | - $id = 'img-svg-title-' . substr(md5("$img_file:$svg:$alt"), 0, 4); |
|
| 3687 | + $id = 'img-svg-title-'.substr(md5("$img_file:$svg:$alt"), 0, 4); |
|
| 3688 | 3688 | $balise_svg = inserer_attribut($balise_svg, 'aria-labelledby', $id); |
| 3689 | - $title = "<title id=\"$id\">" . entites_html($alt) . "</title>\n"; |
|
| 3689 | + $title = "<title id=\"$id\">".entites_html($alt)."</title>\n"; |
|
| 3690 | 3690 | $balise_svg .= $title; |
| 3691 | 3691 | } |
| 3692 | 3692 | else { |
@@ -3734,7 +3734,7 @@ discard block |
||
| 3734 | 3734 | if (is_array($tableau)) { |
| 3735 | 3735 | foreach ($tableau as $k => $v) { |
| 3736 | 3736 | $res = recuperer_fond( |
| 3737 | - 'modeles/' . $modele, |
|
| 3737 | + 'modeles/'.$modele, |
|
| 3738 | 3738 | array_merge(['cle' => $k], (is_array($v) ? $v : ['valeur' => $v])) |
| 3739 | 3739 | ); |
| 3740 | 3740 | $texte .= $res; |
@@ -3916,7 +3916,7 @@ discard block |
||
| 3916 | 3916 | } |
| 3917 | 3917 | |
| 3918 | 3918 | $c = serialize($c); |
| 3919 | - $cle = calculer_cle_action($form . $c); |
|
| 3919 | + $cle = calculer_cle_action($form.$c); |
|
| 3920 | 3920 | $c = "$cle:$c"; |
| 3921 | 3921 | |
| 3922 | 3922 | // on ne stocke pas les contextes dans des fichiers en cache |
@@ -3974,15 +3974,15 @@ discard block |
||
| 3974 | 3974 | } |
| 3975 | 3975 | // toujours encoder l'url source dans le bloc ajax |
| 3976 | 3976 | $r = self(); |
| 3977 | - $r = ' data-origin="' . $r . '"'; |
|
| 3977 | + $r = ' data-origin="'.$r.'"'; |
|
| 3978 | 3978 | $class = 'ajaxbloc'; |
| 3979 | 3979 | if ($ajaxid && is_string($ajaxid)) { |
| 3980 | 3980 | // ajaxid est normalement conforme a un nom de classe css |
| 3981 | 3981 | // on ne verifie pas la conformite, mais on passe entites_html par dessus par precaution |
| 3982 | - $class .= ' ajax-id-' . entites_html($ajaxid); |
|
| 3982 | + $class .= ' ajax-id-'.entites_html($ajaxid); |
|
| 3983 | 3983 | } |
| 3984 | 3984 | |
| 3985 | - return "<div class='$class' " . "data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n"; |
|
| 3985 | + return "<div class='$class' "."data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n"; |
|
| 3986 | 3986 | } |
| 3987 | 3987 | |
| 3988 | 3988 | /** |
@@ -4027,7 +4027,7 @@ discard block |
||
| 4027 | 4027 | $cle = substr($c, 0, $p); |
| 4028 | 4028 | $c = substr($c, $p + 1); |
| 4029 | 4029 | |
| 4030 | - if ($cle == calculer_cle_action($form . $c)) { |
|
| 4030 | + if ($cle == calculer_cle_action($form.$c)) { |
|
| 4031 | 4031 | return @unserialize($c); |
| 4032 | 4032 | } |
| 4033 | 4033 | } |
@@ -4147,13 +4147,13 @@ discard block |
||
| 4147 | 4147 | } |
| 4148 | 4148 | } |
| 4149 | 4149 | } |
| 4150 | - $att .= 'class="' . ($class ? attribut_html($class) . ' ' : '') . (defined('_LIEN_OU_EXPOSE_CLASS_ON') ? _LIEN_OU_EXPOSE_CLASS_ON : 'on') . '"'; |
|
| 4150 | + $att .= 'class="'.($class ? attribut_html($class).' ' : '').(defined('_LIEN_OU_EXPOSE_CLASS_ON') ? _LIEN_OU_EXPOSE_CLASS_ON : 'on').'"'; |
|
| 4151 | 4151 | } else { |
| 4152 | 4152 | $bal = 'a'; |
| 4153 | 4153 | $att = "href='$url'" |
| 4154 | - . ($title ? " title='" . attribut_html($title) . "'" : '') |
|
| 4155 | - . ($class ? " class='" . attribut_html($class) . "'" : '') |
|
| 4156 | - . ($rel ? " rel='" . attribut_html($rel) . "'" : '') |
|
| 4154 | + . ($title ? " title='".attribut_html($title)."'" : '') |
|
| 4155 | + . ($class ? " class='".attribut_html($class)."'" : '') |
|
| 4156 | + . ($rel ? " rel='".attribut_html($rel)."'" : '') |
|
| 4157 | 4157 | . $evt; |
| 4158 | 4158 | } |
| 4159 | 4159 | if ($libelle === null) { |
@@ -4290,7 +4290,7 @@ discard block |
||
| 4290 | 4290 | |
| 4291 | 4291 | // Icône |
| 4292 | 4292 | $icone = http_img_pack($fond, $alt, "width='$size' height='$size'"); |
| 4293 | - $icone = '<span class="icone-image' . ($fonction ? " icone-fonction icone-fonction-$fonction" : '') . "\">$icone</span>"; |
|
| 4293 | + $icone = '<span class="icone-image'.($fonction ? " icone-fonction icone-fonction-$fonction" : '')."\">$icone</span>"; |
|
| 4294 | 4294 | |
| 4295 | 4295 | // Markup final |
| 4296 | 4296 | if ($type == 'lien') { |
@@ -4565,16 +4565,16 @@ discard block |
||
| 4565 | 4565 | $class_form = 'ajax'; |
| 4566 | 4566 | $class = str_replace('ajax', '', $class); |
| 4567 | 4567 | } |
| 4568 | - $class_btn = 'submit ' . trim($class); |
|
| 4568 | + $class_btn = 'submit '.trim($class); |
|
| 4569 | 4569 | |
| 4570 | 4570 | if ($confirm) { |
| 4571 | - $confirm = 'confirm("' . attribut_html($confirm) . '")'; |
|
| 4571 | + $confirm = 'confirm("'.attribut_html($confirm).'")'; |
|
| 4572 | 4572 | $callback = $callback ? "$confirm?($callback):false" : $confirm; |
| 4573 | 4573 | } |
| 4574 | - $onclick = $callback ? " onclick='return " . addcslashes($callback, "'") . "'" : ''; |
|
| 4574 | + $onclick = $callback ? " onclick='return ".addcslashes($callback, "'")."'" : ''; |
|
| 4575 | 4575 | $title = $title ? " title='$title'" : ''; |
| 4576 | 4576 | |
| 4577 | - return "<form class='bouton_action_post $class_form' method='post' action='$url'><div>" . form_hidden($url) |
|
| 4577 | + return "<form class='bouton_action_post $class_form' method='post' action='$url'><div>".form_hidden($url) |
|
| 4578 | 4578 | . "<button type='submit' class='$class_btn'$title$onclick>$libelle</button></div></form>"; |
| 4579 | 4579 | } |
| 4580 | 4580 | |
@@ -4638,14 +4638,14 @@ discard block |
||
| 4638 | 4638 | $champ_titre = ''; |
| 4639 | 4639 | if ($demande_titre) { |
| 4640 | 4640 | // si pas de titre declare mais champ titre, il sera peuple par le select * |
| 4641 | - $champ_titre = (empty($desc['titre'])) ? '' : ', ' . $desc['titre']; |
|
| 4641 | + $champ_titre = (empty($desc['titre'])) ? '' : ', '.$desc['titre']; |
|
| 4642 | 4642 | } |
| 4643 | 4643 | include_spip('base/abstract_sql'); |
| 4644 | 4644 | include_spip('base/connect_sql'); |
| 4645 | 4645 | $objets[$type_objet][$id_objet] = sql_fetsel( |
| 4646 | - '*' . $champ_titre, |
|
| 4646 | + '*'.$champ_titre, |
|
| 4647 | 4647 | $desc['table_sql'], |
| 4648 | - id_table_objet($type_objet) . ' = ' . (int) $id_objet |
|
| 4648 | + id_table_objet($type_objet).' = '.(int) $id_objet |
|
| 4649 | 4649 | ); |
| 4650 | 4650 | |
| 4651 | 4651 | // Toujours noter la longueur d'introduction, même si pas demandé cette fois-ci |
@@ -4736,8 +4736,7 @@ discard block |
||
| 4736 | 4736 | if (isset($ligne_sql['chapo'])) { |
| 4737 | 4737 | $chapo = $ligne_sql['chapo']; |
| 4738 | 4738 | $texte = strlen($descriptif) ? |
| 4739 | - '' : |
|
| 4740 | - "$chapo \n\n $texte"; |
|
| 4739 | + '' : "$chapo \n\n $texte"; |
|
| 4741 | 4740 | } |
| 4742 | 4741 | |
| 4743 | 4742 | // Longueur en paramètre, sinon celle renseignée dans la description de l'objet, sinon valeur en dur |
@@ -4809,7 +4808,7 @@ discard block |
||
| 4809 | 4808 | return $texte; |
| 4810 | 4809 | } |
| 4811 | 4810 | |
| 4812 | - $traitement = str_replace('%s', "'" . texte_script($texte) . "'", $traitement); |
|
| 4811 | + $traitement = str_replace('%s', "'".texte_script($texte)."'", $traitement); |
|
| 4813 | 4812 | |
| 4814 | 4813 | // signaler qu'on est dans l'espace prive pour les filtres qui se servent de ce flag |
| 4815 | 4814 | if (test_espace_prive()) { |
@@ -4845,7 +4844,7 @@ discard block |
||
| 4845 | 4844 | } |
| 4846 | 4845 | $url = generer_objet_url($id_objet, $objet, '', '', null, '', $connect); |
| 4847 | 4846 | |
| 4848 | - return "<a href='$url' class='$objet'>" . couper($titre, $longueur) . '</a>'; |
|
| 4847 | + return "<a href='$url' class='$objet'>".couper($titre, $longueur).'</a>'; |
|
| 4849 | 4848 | } |
| 4850 | 4849 | |
| 4851 | 4850 | /** |
@@ -4871,9 +4870,9 @@ discard block |
||
| 4871 | 4870 | function wrap($texte, $wrap) { |
| 4872 | 4871 | $balises = extraire_balises($wrap); |
| 4873 | 4872 | if (preg_match_all(",<([a-z]\w*)\b[^>]*>,UimsS", $wrap, $regs, PREG_PATTERN_ORDER)) { |
| 4874 | - $texte = $wrap . $texte; |
|
| 4873 | + $texte = $wrap.$texte; |
|
| 4875 | 4874 | $regs = array_reverse($regs[1]); |
| 4876 | - $wrap = '</' . implode('></', $regs) . '>'; |
|
| 4875 | + $wrap = '</'.implode('></', $regs).'>'; |
|
| 4877 | 4876 | $texte .= $wrap; |
| 4878 | 4877 | } |
| 4879 | 4878 | |
@@ -4903,7 +4902,7 @@ discard block |
||
| 4903 | 4902 | |
| 4904 | 4903 | // caster $u en array si besoin |
| 4905 | 4904 | if (is_object($u)) { |
| 4906 | - $u = (array)$u; |
|
| 4905 | + $u = (array) $u; |
|
| 4907 | 4906 | } |
| 4908 | 4907 | |
| 4909 | 4908 | if (is_array($u)) { |
@@ -4925,7 +4924,7 @@ discard block |
||
| 4925 | 4924 | // sinon on passe a la ligne et on indente |
| 4926 | 4925 | $i_str = str_pad('', $indent, ' '); |
| 4927 | 4926 | foreach ($u as $k => $v) { |
| 4928 | - $out .= $join . $i_str . "$k: " . filtre_print_dist($v, $join, $indent + 2); |
|
| 4927 | + $out .= $join.$i_str."$k: ".filtre_print_dist($v, $join, $indent + 2); |
|
| 4929 | 4928 | } |
| 4930 | 4929 | |
| 4931 | 4930 | return $out; |
@@ -4979,7 +4978,7 @@ discard block |
||
| 4979 | 4978 | * @return string |
| 4980 | 4979 | */ |
| 4981 | 4980 | function objet_icone($objet, $taille = 24, $class = '') { |
| 4982 | - $icone = objet_info($objet, 'icone_objet') . '-' . $taille . '.png'; |
|
| 4981 | + $icone = objet_info($objet, 'icone_objet').'-'.$taille.'.png'; |
|
| 4983 | 4982 | $icone = chemin_image($icone); |
| 4984 | 4983 | $balise_img = charger_filtre('balise_img'); |
| 4985 | 4984 | |
@@ -5005,7 +5004,7 @@ discard block |
||
| 5005 | 5004 | */ |
| 5006 | 5005 | function objet_T($objet, $chaine, $args = [], $options = []) { |
| 5007 | 5006 | $chaine = explode(':', $chaine); |
| 5008 | - if ($t = _T($objet . ':' . end($chaine), $args, array_merge($options, ['force' => false]))) { |
|
| 5007 | + if ($t = _T($objet.':'.end($chaine), $args, array_merge($options, ['force' => false]))) { |
|
| 5009 | 5008 | return $t; |
| 5010 | 5009 | } |
| 5011 | 5010 | $chaine = implode(':', $chaine); |
@@ -5071,7 +5070,7 @@ discard block |
||
| 5071 | 5070 | $cache = recuperer_fond($fond, $contexte, $options, $connect); |
| 5072 | 5071 | |
| 5073 | 5072 | // calculer le nom de la css |
| 5074 | - $dir_var = sous_repertoire(_DIR_VAR, 'cache-' . $extension); |
|
| 5073 | + $dir_var = sous_repertoire(_DIR_VAR, 'cache-'.$extension); |
|
| 5075 | 5074 | $nom_safe = preg_replace(',\W,', '_', str_replace('.', '_', $fond)); |
| 5076 | 5075 | $contexte_implicite = calculer_contexte_implicite(); |
| 5077 | 5076 | |
@@ -5079,14 +5078,14 @@ discard block |
||
| 5079 | 5078 | // mais on peut hasher selon le contenu a la demande, si plusieurs contextes produisent un meme contenu |
| 5080 | 5079 | // reduit la variabilite du nom et donc le nombre de css concatenees possibles in fine |
| 5081 | 5080 | if (isset($options['hash_on_content']) && $options['hash_on_content']) { |
| 5082 | - $hash = md5($contexte_implicite['host'] . '::' . $cache); |
|
| 5081 | + $hash = md5($contexte_implicite['host'].'::'.$cache); |
|
| 5083 | 5082 | } |
| 5084 | 5083 | else { |
| 5085 | 5084 | unset($contexte_implicite['notes']); // pas pertinent pour signaler un changeemnt de contenu pour des css/js |
| 5086 | 5085 | ksort($contexte); |
| 5087 | - $hash = md5($fond . json_encode($contexte_implicite, JSON_THROW_ON_ERROR) . json_encode($contexte, JSON_THROW_ON_ERROR) . $connect); |
|
| 5086 | + $hash = md5($fond.json_encode($contexte_implicite, JSON_THROW_ON_ERROR).json_encode($contexte, JSON_THROW_ON_ERROR).$connect); |
|
| 5088 | 5087 | } |
| 5089 | - $filename = $dir_var . $extension . "dyn-$nom_safe-" . substr($hash, 0, 8) . ".$extension"; |
|
| 5088 | + $filename = $dir_var.$extension."dyn-$nom_safe-".substr($hash, 0, 8).".$extension"; |
|
| 5090 | 5089 | |
| 5091 | 5090 | // mettre a jour le fichier si il n'existe pas |
| 5092 | 5091 | // ou trop ancien |
@@ -5094,8 +5093,8 @@ discard block |
||
| 5094 | 5093 | // et recopie sur le fichier cible uniquement si il change |
| 5095 | 5094 | if ( |
| 5096 | 5095 | !file_exists($filename) |
| 5097 | - || !file_exists($filename . '.last') |
|
| 5098 | - || isset($cache['lastmodified']) && $cache['lastmodified'] && filemtime($filename . '.last') < $cache['lastmodified'] |
|
| 5096 | + || !file_exists($filename.'.last') |
|
| 5097 | + || isset($cache['lastmodified']) && $cache['lastmodified'] && filemtime($filename.'.last') < $cache['lastmodified'] |
|
| 5099 | 5098 | || defined('_VAR_MODE') && _VAR_MODE == 'recalcul' |
| 5100 | 5099 | ) { |
| 5101 | 5100 | $contenu = $cache['texte']; |
@@ -5119,10 +5118,10 @@ discard block |
||
| 5119 | 5118 | } |
| 5120 | 5119 | // pas de date dans le commentaire car sinon ca invalide le md5 et force la maj |
| 5121 | 5120 | // mais on peut mettre un md5 du contenu, ce qui donne un aperu rapide si la feuille a change ou non |
| 5122 | - $comment .= "}\n md5:" . md5($contenu) . " */\n"; |
|
| 5121 | + $comment .= "}\n md5:".md5($contenu)." */\n"; |
|
| 5123 | 5122 | } |
| 5124 | 5123 | // et ecrire le fichier si il change |
| 5125 | - ecrire_fichier_calcule_si_modifie($filename, $comment . $contenu, false, true); |
|
| 5124 | + ecrire_fichier_calcule_si_modifie($filename, $comment.$contenu, false, true); |
|
| 5126 | 5125 | } |
| 5127 | 5126 | |
| 5128 | 5127 | return timestamp($filename); |
@@ -5349,7 +5348,7 @@ discard block |
||
| 5349 | 5348 | if ($e > 0 && strlen($mid) > 8) { |
| 5350 | 5349 | $mid = '***...***'; |
| 5351 | 5350 | } |
| 5352 | - return substr($passe, 0, $e) . $mid . ($e > 0 ? substr($passe, -$e) : ''); |
|
| 5351 | + return substr($passe, 0, $e).$mid.($e > 0 ? substr($passe, -$e) : ''); |
|
| 5353 | 5352 | } |
| 5354 | 5353 | |
| 5355 | 5354 | |
@@ -5411,7 +5410,7 @@ discard block |
||
| 5411 | 5410 | case 'id': |
| 5412 | 5411 | case 'anchor': |
| 5413 | 5412 | if (preg_match(',^\d,', $texte)) { |
| 5414 | - $texte = substr($type, 0, 1) . $texte; |
|
| 5413 | + $texte = substr($type, 0, 1).$texte; |
|
| 5415 | 5414 | } |
| 5416 | 5415 | } |
| 5417 | 5416 | |
@@ -5421,9 +5420,9 @@ discard block |
||
| 5421 | 5420 | |
| 5422 | 5421 | if (strlen($texte) < $longueur_mini && $longueur_mini < $longueur_maxi) { |
| 5423 | 5422 | if (preg_match(',^\d,', $texte)) { |
| 5424 | - $texte = ($type ? substr($type, 0, 1) : 's') . $texte; |
|
| 5423 | + $texte = ($type ? substr($type, 0, 1) : 's').$texte; |
|
| 5425 | 5424 | } |
| 5426 | - $texte .= $separateur . md5($original); |
|
| 5425 | + $texte .= $separateur.md5($original); |
|
| 5427 | 5426 | $texte = substr($texte, 0, $longueur_mini); |
| 5428 | 5427 | } |
| 5429 | 5428 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $type = reset($objets); |
| 160 | 160 | $type = objet_type($type); |
| 161 | 161 | $id = (int) $ref; |
| 162 | - $ref = $type . $ref; |
|
| 162 | + $ref = $type.$ref; |
|
| 163 | 163 | } |
| 164 | 164 | else { |
| 165 | 165 | // Si la référence ne correspond à rien, c'est fini |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | return json_export(false); |
| 168 | 168 | } |
| 169 | 169 | // Sinon on récupère les infos utiles |
| 170 | - [$type, , $id, , , , ] = array_pad($match, 7, null); |
|
| 170 | + [$type,, $id,,,,] = array_pad($match, 7, null); |
|
| 171 | 171 | |
| 172 | 172 | // On regarde si le type trouvé fait partie des objets sélectionnables |
| 173 | 173 | if (!in_array(table_objet($type), $objets)) { |
@@ -213,8 +213,8 @@ discard block |
||
| 213 | 213 | $types = (is_array($types) ? array_filter($types) : []); |
| 214 | 214 | |
| 215 | 215 | // recuperer tous les freres et soeurs de la rubrique visee |
| 216 | - $id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . (int) $id_rubrique); |
|
| 217 | - $fratrie = sql_allfetsel('id_rubrique', 'spip_rubriques', 'id_parent=' . (int) $id_parent); |
|
| 216 | + $id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique='.(int) $id_rubrique); |
|
| 217 | + $fratrie = sql_allfetsel('id_rubrique', 'spip_rubriques', 'id_parent='.(int) $id_parent); |
|
| 218 | 218 | $fratrie = array_column($fratrie, 'id_rubrique'); |
| 219 | 219 | $has = sql_allfetsel('DISTINCT id_parent', 'spip_rubriques', sql_in('id_parent', $fratrie)); |
| 220 | 220 | $has = array_column($has, 'id_parent'); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | // confirmation du deplacement |
| 117 | 117 | if ( |
| 118 | 118 | sql_table_exists('spip_breves') |
| 119 | - && ($contient_breves = sql_countsel('spip_breves', 'id_rubrique=' . (int) $id_objet)) |
|
| 119 | + && ($contient_breves = sql_countsel('spip_breves', 'id_rubrique='.(int) $id_objet)) |
|
| 120 | 120 | && $contient_breves > 0 |
| 121 | 121 | ) { |
| 122 | 122 | // FIXME: utiliser singulier_ou_pluriel, migrer dans plugin Brèves |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | ); |
| 131 | 131 | $confirm .= "\n<div class='confirmer_deplacement verdana2'>" |
| 132 | 132 | . "<div class='choix'><input type='checkbox' name='confirme_deplace' value='oui' id='confirme-deplace' /><label for='confirme-deplace'>" |
| 133 | - . $scb . |
|
| 133 | + . $scb. |
|
| 134 | 134 | "</label></div></div>\n"; |
| 135 | 135 | } else { |
| 136 | 136 | $confirm .= "<input type='hidden' name='confirme_deplace' value='oui' />\n"; |
@@ -139,11 +139,11 @@ discard block |
||
| 139 | 139 | $form .= $confirm; |
| 140 | 140 | if ($actionable) { |
| 141 | 141 | if (str_contains($form, '<select')) { |
| 142 | - $form .= "<div style='text-align: " . $GLOBALS['spip_lang_right'] . ";'>" |
|
| 143 | - . '<input class="fondo submit btn" type="submit" value="' . _T('bouton_choisir') . '"/>' |
|
| 142 | + $form .= "<div style='text-align: ".$GLOBALS['spip_lang_right'].";'>" |
|
| 143 | + . '<input class="fondo submit btn" type="submit" value="'._T('bouton_choisir').'"/>' |
|
| 144 | 144 | . '</div>'; |
| 145 | 145 | } |
| 146 | - $form = "<input type='hidden' name='editer_$objet' value='oui' />\n" . $form; |
|
| 146 | + $form = "<input type='hidden' name='editer_$objet' value='oui' />\n".$form; |
|
| 147 | 147 | if ($action = charger_fonction("editer_$objet", 'action', true)) { |
| 148 | 148 | $form = generer_action_auteur( |
| 149 | 149 | "editer_$objet", |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | include_spip('inc/presentation'); |
| 171 | 171 | |
| 172 | - return debut_cadre_couleur($logo, true, '', $titre) . $form . fin_cadre_couleur(); |
|
| 172 | + return debut_cadre_couleur($logo, true, '', $titre).$form.fin_cadre_couleur(); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | if ($statut == 'nouveau') { |
| 246 | 246 | if ($attente) { |
| 247 | 247 | $statut = $attente; |
| 248 | - $plus = ' (' . _T('info_statut_auteur_a_confirmer') . ')'; |
|
| 248 | + $plus = ' ('._T('info_statut_auteur_a_confirmer').')'; |
|
| 249 | 249 | } else { |
| 250 | 250 | return _T('info_statut_auteur_a_confirmer'); |
| 251 | 251 | } |
@@ -258,16 +258,16 @@ discard block |
||
| 258 | 258 | '5poubelle' => _T('texte_statut_poubelle'), // bouh |
| 259 | 259 | ]; |
| 260 | 260 | if (isset($recom[$statut])) { |
| 261 | - return $recom[$statut] . $plus; |
|
| 261 | + return $recom[$statut].$plus; |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | // retrouver directement par le statut sinon |
| 265 | 265 | if ($t = array_search($statut, $GLOBALS['liste_des_statuts'])) { |
| 266 | 266 | if (isset($recom[$t])) { |
| 267 | - return $recom[$t] . $plus; |
|
| 267 | + return $recom[$t].$plus; |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - return _T($t) . $plus; |
|
| 270 | + return _T($t).$plus; |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | // si on a pas reussi a le traduire, retournons la chaine telle quelle |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | |
| 388 | 388 | if (!$id_rubrique && defined('_CHOIX_RUBRIQUE_PAR_DEFAUT') && _CHOIX_RUBRIQUE_PAR_DEFAUT) { |
| 389 | 389 | $in = (is_countable($GLOBALS['connect_id_rubrique']) ? count($GLOBALS['connect_id_rubrique']) : 0) |
| 390 | - ? ' AND ' . sql_in('id_rubrique', $GLOBALS['connect_id_rubrique']) |
|
| 390 | + ? ' AND '.sql_in('id_rubrique', $GLOBALS['connect_id_rubrique']) |
|
| 391 | 391 | : ''; |
| 392 | 392 | |
| 393 | 393 | // on tente d'abord l'ecriture a la racine dans le cas des rubriques uniquement |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | return ''; |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | - return propre('[->' . $virtuel . ']'); |
|
| 425 | + return propre('[->'.$virtuel.']'); |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | $clic = http_img_pack('rss-16.png', 'RSS', '', $title); |
| 450 | 450 | |
| 451 | 451 | $url = generer_url_api_low_sec('transmettre', 'rss', $op, '', http_build_query($args), false, true); |
| 452 | - return "<a style='float: " . $GLOBALS['spip_lang_right'] . ";' href='$url'>$clic</a>"; |
|
| 452 | + return "<a style='float: ".$GLOBALS['spip_lang_right'].";' href='$url'>$clic</a>"; |
|
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | ); |
| 522 | 522 | |
| 523 | 523 | if ($alertes = array_filter($alertes)) { |
| 524 | - return "<div class='wrap-messages-alertes'><div class='messages-alertes'>" . |
|
| 524 | + return "<div class='wrap-messages-alertes'><div class='messages-alertes'>". |
|
| 525 | 525 | implode(' | ', $alertes) |
| 526 | 526 | . '</div></div>'; |
| 527 | 527 | } |
@@ -557,13 +557,13 @@ discard block |
||
| 557 | 557 | */ |
| 558 | 558 | function afficher_plus_info($lien, $titre = '+', $titre_lien = '') { |
| 559 | 559 | $titre = attribut_html($titre); |
| 560 | - $icone = "\n<a href='$lien' title='$titre' class='plus_info'>" . |
|
| 561 | - http_img_pack('information-16.png', $titre) . '</a>'; |
|
| 560 | + $icone = "\n<a href='$lien' title='$titre' class='plus_info'>". |
|
| 561 | + http_img_pack('information-16.png', $titre).'</a>'; |
|
| 562 | 562 | |
| 563 | 563 | if (!$titre_lien) { |
| 564 | 564 | return $icone; |
| 565 | 565 | } else { |
| 566 | - return $icone . "\n<a href='$lien'>$titre_lien</a>"; |
|
| 566 | + return $icone."\n<a href='$lien'>$titre_lien</a>"; |
|
| 567 | 567 | } |
| 568 | 568 | } |
| 569 | 569 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $role = $roles['roles']['defaut']; |
| 147 | 147 | } |
| 148 | 148 | // where |
| 149 | - $cond = ["$colonne_role=" . sql_quote($role)]; |
|
| 149 | + $cond = ["$colonne_role=".sql_quote($role)]; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | return [$role, $colonne_role, $cond]; |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | unset($cond['role']); // cette condition est particuliere... |
| 180 | 180 | // on ajoute la condition du role aux autres conditions. |
| 181 | 181 | if ($colonne_role && $role != '*') { |
| 182 | - $cond[] = "$colonne_role=" . sql_quote($role); |
|
| 182 | + $cond[] = "$colonne_role=".sql_quote($role); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | return [$cond, $colonne_role, $role]; |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | $all = sql_allfetsel( |
| 363 | 363 | "DISTINCT $colone_role", |
| 364 | 364 | $l, |
| 365 | - 'objet=' . sql_quote(($objet_source == $objet_lien) ? $objet : $objet_source) |
|
| 365 | + 'objet='.sql_quote(($objet_source == $objet_lien) ? $objet : $objet_source) |
|
| 366 | 366 | ); |
| 367 | 367 | $done[$hash] = array_map('reset', $all); |
| 368 | 368 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | static $t1 = ['&', '<', '>']; |
| 120 | 120 | static $t2 = ['&', '<', '>']; |
| 121 | 121 | |
| 122 | - return '<pre>' . str_replace($t1, $t2, (string) $t) . '</pre>'; |
|
| 122 | + return '<pre>'.str_replace($t1, $t2, (string) $t).'</pre>'; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
@@ -139,12 +139,12 @@ discard block |
||
| 139 | 139 | foreach ($lignes as &$l) { |
| 140 | 140 | $l = implode('|', $l); |
| 141 | 141 | } |
| 142 | - $corps = implode("\n", $lignes) . "\n"; |
|
| 143 | - $corps = $caption . |
|
| 144 | - "\n|{{" . |
|
| 145 | - implode('}}|{{', $entete) . |
|
| 146 | - '}}|' . |
|
| 147 | - "\n|" . |
|
| 142 | + $corps = implode("\n", $lignes)."\n"; |
|
| 143 | + $corps = $caption. |
|
| 144 | + "\n|{{". |
|
| 145 | + implode('}}|{{', $entete). |
|
| 146 | + '}}|'. |
|
| 147 | + "\n|". |
|
| 148 | 148 | str_replace("\n", "|\n|", $corps); |
| 149 | 149 | include_spip('inc/texte'); |
| 150 | 150 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | // Pourquoi SafeHtml transforme-t-il en texte les scripts dans Body ? |
| 189 | 189 | $t = safehtml(preg_replace(',<script.*?</script>,is', '', $t)); |
| 190 | 190 | |
| 191 | - return ($style ? "\n<style>" . $style . '</style>' : '') . $t; |
|
| 191 | + return ($style ? "\n<style>".$style.'</style>' : '').$t; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** |
@@ -43,13 +43,13 @@ discard block |
||
| 43 | 43 | // celle du texte) et public (spip_lang est la langue du texte) |
| 44 | 44 | $dir = _DIR_RESTREINT ? lang_dir() : lang_dir($GLOBALS['spip_lang']); |
| 45 | 45 | |
| 46 | - $p = 'puce' . (test_espace_prive() ? '_prive' : ''); |
|
| 46 | + $p = 'puce'.(test_espace_prive() ? '_prive' : ''); |
|
| 47 | 47 | if ($dir == 'rtl') { |
| 48 | 48 | $p .= '_rtl'; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | if (!isset($GLOBALS[$p])) { |
| 52 | - $GLOBALS[$p] = '<span class="spip-puce ' . $dir . '"><b>–</b></span>'; |
|
| 52 | + $GLOBALS[$p] = '<span class="spip-puce '.$dir.'"><b>–</b></span>'; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | return $GLOBALS[$p]; |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | function spip_balisage_code(string $corps, bool $bloc = false, string $attributs = '', string $langage = '') { |
| 68 | 68 | |
| 69 | 69 | $echap = spip_htmlspecialchars($corps); // il ne faut pas passer dans entites_html, ne pas transformer les &#xxx; du code ! |
| 70 | - $class = 'spip_code ' . ($bloc ? 'spip_code_block' : 'spip_code_inline'); |
|
| 70 | + $class = 'spip_code '.($bloc ? 'spip_code_block' : 'spip_code_inline'); |
|
| 71 | 71 | if ($attributs) { |
| 72 | - $attributs = ' ' . trim($attributs); |
|
| 72 | + $attributs = ' '.trim($attributs); |
|
| 73 | 73 | } |
| 74 | 74 | if ($langage) { |
| 75 | 75 | $class .= " language-$langage"; |
| 76 | - $attributs .= ' data-language="' . $langage . '"'; |
|
| 76 | + $attributs .= ' data-language="'.$langage.'"'; |
|
| 77 | 77 | } |
| 78 | 78 | if ($bloc) { |
| 79 | 79 | $html = '<div class="precode">' |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | else { |
| 88 | 88 | $echap = str_replace("\t", ' ', $echap); |
| 89 | 89 | $echap = str_replace(' ', ' ', $echap); |
| 90 | - $html = "<code class=\"$class\" dir=\"ltr\"$attributs>" . $echap . '</code>'; |
|
| 90 | + $html = "<code class=\"$class\" dir=\"ltr\"$attributs>".$echap.'</code>'; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | return $html; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | if (!defined('_BALISES_BLOCS_REGEXP')) { |
| 108 | - define('_BALISES_BLOCS_REGEXP', ',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS'); |
|
| 108 | + define('_BALISES_BLOCS_REGEXP', ',</?('._BALISES_BLOCS.')[>[:space:]],iS'); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | // |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | // Tester si on echappe en span ou en div |
| 124 | 124 | if (is_null($mode) or !in_array($mode, ['div', 'span'])) { |
| 125 | - $mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $rempl) ? 'div' : 'span'; |
|
| 125 | + $mode = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $rempl) ? 'div' : 'span'; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | // Decouper en morceaux, base64 a des probleme selon la taille de la pile |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | ) { |
| 158 | 158 | foreach ($matches as $m) { |
| 159 | 159 | if ($m[1] === 'code') { |
| 160 | - $code = '<code' . $m[2] . '>' . spip_htmlspecialchars($m[3]) . '</code>'; |
|
| 160 | + $code = '<code'.$m[2].'>'.spip_htmlspecialchars($m[3]).'</code>'; |
|
| 161 | 161 | $pre = str_replace($m[0], $code, $pre); |
| 162 | 162 | } |
| 163 | 163 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | // Echapper les <code>...</ code> |
| 169 | 169 | function traiter_echap_code_dist($regs, $options = []) { |
| 170 | - [, , $att, $corps] = $regs; |
|
| 170 | + [,, $att, $corps] = $regs; |
|
| 171 | 171 | |
| 172 | 172 | // ne pas mettre le <div...> s'il n'y a qu'une ligne |
| 173 | 173 | if (strpos($corps, "\n") !== false) { |
@@ -252,11 +252,11 @@ discard block |
||
| 252 | 252 | // sinon les traiter selon le cas |
| 253 | 253 | $callback_secure_prefix = ($callback_options['secure_prefix'] ?? ''); |
| 254 | 254 | if ( |
| 255 | - function_exists($f = $callback_prefix . $callback_secure_prefix . 'traiter_echap_' . strtolower($regs[1])) |
|
| 256 | - or function_exists($f = $f . '_dist') |
|
| 255 | + function_exists($f = $callback_prefix.$callback_secure_prefix.'traiter_echap_'.strtolower($regs[1])) |
|
| 256 | + or function_exists($f = $f.'_dist') |
|
| 257 | 257 | or ($callback_secure_prefix and ( |
| 258 | - function_exists($f = $callback_prefix . 'traiter_echap_' . strtolower($regs[1])) |
|
| 259 | - or function_exists($f = $f . '_dist') |
|
| 258 | + function_exists($f = $callback_prefix.'traiter_echap_'.strtolower($regs[1])) |
|
| 259 | + or function_exists($f = $f.'_dist') |
|
| 260 | 260 | )) |
| 261 | 261 | ) { |
| 262 | 262 | $echap = $f($regs, $callback_options); |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | // dans une callback autonommee |
| 279 | 279 | if (strpos($preg ?: _PROTEGE_BLOCS, 'script') !== false) { |
| 280 | 280 | if ( |
| 281 | - strpos($letexte, '<' . '?') !== false and preg_match_all( |
|
| 281 | + strpos($letexte, '<'.'?') !== false and preg_match_all( |
|
| 282 | 282 | ',<[?].*($|[?]>),UisS', |
| 283 | 283 | $letexte, |
| 284 | 284 | $matches, |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | strpos($letexte, '<') !== false |
| 311 | 311 | and |
| 312 | 312 | preg_match_all( |
| 313 | - ',<(span|div)\sclass=[\'"]base64' . $source . '[\'"]\s(.*)>\s*</\1>,UmsS', |
|
| 313 | + ',<(span|div)\sclass=[\'"]base64'.$source.'[\'"]\s(.*)>\s*</\1>,UmsS', |
|
| 314 | 314 | $letexte, |
| 315 | 315 | $regs, |
| 316 | 316 | PREG_SET_ORDER |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | if ($at) { |
| 330 | - $rempl = '<' . $reg[1] . '>' . $rempl . '</' . $reg[1] . '>'; |
|
| 330 | + $rempl = '<'.$reg[1].'>'.$rempl.'</'.$reg[1].'>'; |
|
| 331 | 331 | foreach ($at as $attr => $a) { |
| 332 | 332 | $rempl = inserer_attribut($rempl, $attr, $a); |
| 333 | 333 | } |
@@ -408,8 +408,8 @@ discard block |
||
| 408 | 408 | $texte = nettoyer_raccourcis_typo($texte); |
| 409 | 409 | |
| 410 | 410 | // balises de sauts de ligne et paragraphe |
| 411 | - $texte = preg_replace('/<p( [^>]*)?' . '>/', "\r\r", $texte); |
|
| 412 | - $texte = preg_replace('/<br( [^>]*)?' . '>/', "\n", $texte); |
|
| 411 | + $texte = preg_replace('/<p( [^>]*)?'.'>/', "\r\r", $texte); |
|
| 412 | + $texte = preg_replace('/<br( [^>]*)?'.'>/', "\n", $texte); |
|
| 413 | 413 | |
| 414 | 414 | // on repasse les doubles \n en \r que nettoyer_raccourcis_typo() a pu modifier |
| 415 | 415 | $texte = str_replace("\n\n", "\r\r", $texte); |
@@ -434,15 +434,15 @@ discard block |
||
| 434 | 434 | // excédentaire est ensuite supprimé par l'appel à preg_replace() |
| 435 | 435 | $long = spip_substr($texte, 0, max($taille + 1 - $taille_suite, 1)); |
| 436 | 436 | $u = $GLOBALS['meta']['pcre_u']; |
| 437 | - $court = preg_replace('/(^|([^\s ])[\s ]+)([\s ]|[^\s ]+)?$/D' . $u, "\\2", $long); |
|
| 437 | + $court = preg_replace('/(^|([^\s ])[\s ]+)([\s ]|[^\s ]+)?$/D'.$u, "\\2", $long); |
|
| 438 | 438 | $points = $suite; |
| 439 | 439 | |
| 440 | 440 | // trop court ? ne pas faire de (...) |
| 441 | 441 | if (spip_strlen($court) < max(0.75 * $taille, 2)) { |
| 442 | 442 | $points = ''; |
| 443 | 443 | $long = spip_substr($texte, 0, $taille + 1); |
| 444 | - preg_match('/(^|([^\s ])[\s ]+)([\s ]|[^\s ]+)?$/D' . $u, $long, $m); |
|
| 445 | - $texte = preg_replace('/(^|([^\s ])[\s ]+)([\s ]|[^\s ]+)?$/D' . $u, "\\2", $long); |
|
| 444 | + preg_match('/(^|([^\s ])[\s ]+)([\s ]|[^\s ]+)?$/D'.$u, $long, $m); |
|
| 445 | + $texte = preg_replace('/(^|([^\s ])[\s ]+)([\s ]|[^\s ]+)?$/D'.$u, "\\2", $long); |
|
| 446 | 446 | // encore trop court ? couper au caractere |
| 447 | 447 | if (spip_strlen($texte) < 0.75 * $taille) { |
| 448 | 448 | $texte = spip_substr($long, 0, $taille); |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | // supprimer l'eventuelle entite finale mal coupee |
| 459 | 459 | $texte = preg_replace('/&#?[a-z0-9]*$/S', '', $texte); |
| 460 | 460 | |
| 461 | - return quote_amp(trim($texte)) . $points; |
|
| 461 | + return quote_amp(trim($texte)).$points; |
|
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | |
@@ -470,16 +470,16 @@ discard block |
||
| 470 | 470 | define('_PROTEGE_JS_MODELES', creer_uniqid()); |
| 471 | 471 | } |
| 472 | 472 | foreach ($r as $regs) { |
| 473 | - $t = str_replace($regs[0], code_echappement($regs[0], 'javascript' . _PROTEGE_JS_MODELES), $t); |
|
| 473 | + $t = str_replace($regs[0], code_echappement($regs[0], 'javascript'._PROTEGE_JS_MODELES), $t); |
|
| 474 | 474 | } |
| 475 | 475 | } |
| 476 | - if (preg_match_all(',<\?php.*?($|\?' . '>),isS', $t, $r, PREG_SET_ORDER)) { |
|
| 476 | + if (preg_match_all(',<\?php.*?($|\?'.'>),isS', $t, $r, PREG_SET_ORDER)) { |
|
| 477 | 477 | if (!defined('_PROTEGE_PHP_MODELES')) { |
| 478 | 478 | include_spip('inc/acces'); |
| 479 | 479 | define('_PROTEGE_PHP_MODELES', creer_uniqid()); |
| 480 | 480 | } |
| 481 | 481 | foreach ($r as $regs) { |
| 482 | - $t = str_replace($regs[0], code_echappement($regs[0], 'php' . _PROTEGE_PHP_MODELES), $t); |
|
| 482 | + $t = str_replace($regs[0], code_echappement($regs[0], 'php'._PROTEGE_PHP_MODELES), $t); |
|
| 483 | 483 | } |
| 484 | 484 | } |
| 485 | 485 | } |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | if (!empty($options['wrap_suspect'])) { |
| 597 | 597 | $texte = wrap($texte, $options['wrap_suspect']); |
| 598 | 598 | } |
| 599 | - $texte = "<mark class='danger-js' title='" . attribut_html(_T('erreur_contenu_suspect')) . "'>⚠️</mark> " . $texte; |
|
| 599 | + $texte = "<mark class='danger-js' title='".attribut_html(_T('erreur_contenu_suspect'))."'>⚠️</mark> ".$texte; |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | $texte = $collecteurModeles->retablir($texte); |
@@ -743,11 +743,11 @@ discard block |
||
| 743 | 743 | **/ |
| 744 | 744 | function supprime_img($letexte, $message = null) { |
| 745 | 745 | if ($message === null) { |
| 746 | - $message = '(' . _T('img_indisponible') . ')'; |
|
| 746 | + $message = '('._T('img_indisponible').')'; |
|
| 747 | 747 | } |
| 748 | 748 | |
| 749 | 749 | return preg_replace( |
| 750 | - ',<(img|doc|emb)([0-9]+)(\|([^>]*))?' . '\s*/?' . '>,i', |
|
| 750 | + ',<(img|doc|emb)([0-9]+)(\|([^>]*))?'.'\s*/?'.'>,i', |
|
| 751 | 751 | $message, |
| 752 | 752 | $letexte |
| 753 | 753 | ); |