@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $grammaire = find_in_path($grammaire); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - $file = _DIR_CACHE_XML . preg_replace('/[^\w.]/', '_', $rotlvl) . '.gz'; |
|
| 32 | + $file = _DIR_CACHE_XML.preg_replace('/[^\w.]/', '_', $rotlvl).'.gz'; |
|
| 33 | 33 | |
| 34 | 34 | if (lire_fichier($file, $r)) { |
| 35 | 35 | if (!$grammaire) { |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $dtc->peres[$k] = $v; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - spip_log("Analyser DTD $avail $grammaire (" . spip_timer('dtd') . ') ' . (is_countable($dtc->macros) ? count($dtc->macros) : 0) . ' macros, ' . (is_countable($dtc->elements) ? count($dtc->elements) : 0) . ' elements, ' . (is_countable($dtc->attributs) ? count($dtc->attributs) : 0) . " listes d'attributs, " . (is_countable($dtc->entites) ? count($dtc->entites) : 0) . ' entites'); |
|
| 59 | + spip_log("Analyser DTD $avail $grammaire (".spip_timer('dtd').') '.(is_countable($dtc->macros) ? count($dtc->macros) : 0).' macros, '.(is_countable($dtc->elements) ? count($dtc->elements) : 0).' elements, '.(is_countable($dtc->attributs) ? count($dtc->attributs) : 0)." listes d'attributs, ".(is_countable($dtc->entites) ? count($dtc->entites) : 0).' entites'); |
|
| 60 | 60 | # $r = $dtc->regles; ksort($r);foreach($r as $l => $v) {$t=array_keys($dtc->attributs[$l]);echo "<b>$l</b> '$v' ", count($t), " attributs: ", join (', ',$t);$t=$dtc->peres[$l];echo "<br />",count($t), " peres: ", @join (', ',$t), "<br />\n";}exit; |
| 61 | 61 | ecrire_fichier($file, serialize($dtc), true); |
| 62 | 62 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | if (!is_string($r)) { |
| 176 | - spip_log("erreur $r dans la DTD " . substr($dtd, 0, 80) . '.....'); |
|
| 176 | + spip_log("erreur $r dans la DTD ".substr($dtd, 0, 80).'.....'); |
|
| 177 | 177 | |
| 178 | 178 | return false; |
| 179 | 179 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | ($n[0] == 'PUBLIC') |
| 222 | 222 | and !tester_url_absolue($n[1]) |
| 223 | 223 | ) { |
| 224 | - $n[1] = substr($grammaire, 0, strrpos($grammaire, '/') + 1) . $n[1]; |
|
| 224 | + $n[1] = substr($grammaire, 0, strrpos($grammaire, '/') + 1).$n[1]; |
|
| 225 | 225 | } |
| 226 | 226 | analyser_dtd($n[1], $n[0], $dtc); |
| 227 | 227 | } |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | if ($dtc->macros[$m[1]] == 'INCLUDE') { |
| 252 | - $retour = $r[1] . substr($m[2], strlen($r[0])); |
|
| 252 | + $retour = $r[1].substr($m[2], strlen($r[0])); |
|
| 253 | 253 | } else { |
| 254 | 254 | $retour = substr($m[2], strlen($r[0])); |
| 255 | 255 | } |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | spip_log("redefinition de l'entite $nom"); |
| 283 | 283 | } |
| 284 | 284 | if ($k6) { |
| 285 | - return $k6 . $dtd; |
|
| 285 | + return $k6.$dtd; |
|
| 286 | 286 | } // cas du synonyme complet |
| 287 | 287 | $val = expanserEntite(($k2 ? $k3 : ($k4 ? $k5 : $k6)), $dtc->macros); |
| 288 | 288 | |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | if (preg_match_all("/\s*(\S+)\s+(([(][^)]*[)])|(\S+))\s+([^\s']*)(\s*'[^']*')?/", $val, $r2, PREG_SET_ORDER)) { |
| 391 | 391 | foreach ($r2 as $m2) { |
| 392 | 392 | $v = preg_match('/^\w+$/', $m2[2]) ? $m2[2] |
| 393 | - : ('/^' . preg_replace('/\s+/', '', $m2[2]) . '$/'); |
|
| 393 | + : ('/^'.preg_replace('/\s+/', '', $m2[2]).'$/'); |
|
| 394 | 394 | $m21 = expanserEntite($m2[1], $dtc->macros); |
| 395 | 395 | $m25 = expanserEntite($m2[5], $dtc->macros); |
| 396 | 396 | $dtc->attributs[$nom][$m21] = [$v, $m25]; |
@@ -107,7 +107,7 @@ |
||
| 107 | 107 | '_publiable' => $publiable, |
| 108 | 108 | '_label' => $desc['texte_changer_statut'] ?? 'texte_article_statut', |
| 109 | 109 | '_aide' => $desc['aide_changer_statut'] ?? '', |
| 110 | - '_hidden' => "<input type='hidden' name='statut_old' value='" . $v['statut'] . "' />", |
|
| 110 | + '_hidden' => "<input type='hidden' name='statut_old' value='".$v['statut']."' />", |
|
| 111 | 111 | ]; |
| 112 | 112 | |
| 113 | 113 | #if (!count($valeurs['statuts'])) |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
| 99 | - $row = sql_fetsel($select, $desc['table'], "$_id_objet=" . intval($id_objet)); |
|
| 99 | + $row = sql_fetsel($select, $desc['table'], "$_id_objet=".intval($id_objet)); |
|
| 100 | 100 | $statut = $row['statut'] ?? 'publie'; // pas de statut => publie |
| 101 | 101 | |
| 102 | 102 | $valeurs['editable'] = autoriser('dater', $objet, $id_objet, null, ['statut' => $statut]); |
@@ -253,9 +253,9 @@ discard block |
||
| 253 | 253 | |
| 254 | 254 | if (_request('changer')) { |
| 255 | 255 | foreach (['date', 'date_redac'] as $k) { |
| 256 | - if ($v = _request($k . '_jour') and !dater_recuperer_date_saisie($v, $k)) { |
|
| 256 | + if ($v = _request($k.'_jour') and !dater_recuperer_date_saisie($v, $k)) { |
|
| 257 | 257 | $erreurs[$k] = _T('format_date_incorrecte'); |
| 258 | - } elseif ($v = _request($k . '_heure') and !dater_recuperer_heure_saisie($v)) { |
|
| 258 | + } elseif ($v = _request($k.'_heure') and !dater_recuperer_heure_saisie($v)) { |
|
| 259 | 259 | $erreurs[$k] = _T('format_heure_incorrecte'); |
| 260 | 260 | } |
| 261 | 261 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | if (!$link) { |
| 65 | 65 | $erreurs[] = pg_last_error(); |
| 66 | 66 | foreach ($erreurs as $e) { |
| 67 | - spip_log('Echec pg_connect. Erreur : ' . $e, 'pg.' . _LOG_HS); |
|
| 67 | + spip_log('Echec pg_connect. Erreur : '.$e, 'pg.'._LOG_HS); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | return false; |
@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | spip_log( |
| 85 | - "Connexion vers $host, base $db, prefixe $prefixe " . ($link ? 'operationnelle' : 'impossible'), |
|
| 86 | - 'pg.' . _LOG_DEBUG |
|
| 85 | + "Connexion vers $host, base $db, prefixe $prefixe ".($link ? 'operationnelle' : 'impossible'), |
|
| 86 | + 'pg.'._LOG_DEBUG |
|
| 87 | 87 | ); |
| 88 | 88 | |
| 89 | 89 | return !$link ? false : [ |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | } else { |
| 172 | 172 | $suite = ''; |
| 173 | 173 | } |
| 174 | - $query = preg_replace('/([,\s])spip_/', '\1' . $prefixe . '_', $query) . $suite; |
|
| 174 | + $query = preg_replace('/([,\s])spip_/', '\1'.$prefixe.'_', $query).$suite; |
|
| 175 | 175 | |
| 176 | 176 | // renvoyer la requete inerte si demandee |
| 177 | 177 | if (!$requeter) { |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | // ou revoir l'api de sql_alter en creant un |
| 240 | 240 | // sql_alter_table($table,array($actions)); |
| 241 | 241 | if (!preg_match('/\s*((\s*IGNORE)?\s*TABLE\s*([^\s]*))\s*(.*)?/is', $query, $regs)) { |
| 242 | - spip_log("$query mal comprise", 'pg.' . _LOG_ERREUR); |
|
| 242 | + spip_log("$query mal comprise", 'pg.'._LOG_ERREUR); |
|
| 243 | 243 | |
| 244 | 244 | return false; |
| 245 | 245 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | $i = 0; |
| 253 | 253 | $ouverte = false; |
| 254 | 254 | while ($do = array_shift($todo)) { |
| 255 | - $todo2[$i] = isset($todo2[$i]) ? $todo2[$i] . ',' . $do : $do; |
|
| 255 | + $todo2[$i] = isset($todo2[$i]) ? $todo2[$i].','.$do : $do; |
|
| 256 | 256 | $o = (false !== strpos($do, '(')); |
| 257 | 257 | $f = (false !== strpos($do, ')')); |
| 258 | 258 | if ($o and !$f) { |
@@ -265,33 +265,33 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | $todo = $todo2; |
| 268 | - $query = $debut . ' ' . array_shift($todo); |
|
| 268 | + $query = $debut.' '.array_shift($todo); |
|
| 269 | 269 | |
| 270 | 270 | if (!preg_match('/^\s*(IGNORE\s*)?TABLE\s+(\w+)\s+(ADD|DROP|CHANGE|MODIFY|RENAME)\s*(.*)$/is', $query, $r)) { |
| 271 | - spip_log("$query incompris", 'pg.' . _LOG_ERREUR); |
|
| 271 | + spip_log("$query incompris", 'pg.'._LOG_ERREUR); |
|
| 272 | 272 | } else { |
| 273 | 273 | if ($r[1]) { |
| 274 | - spip_log("j'ignore IGNORE dans $query", 'pg.' . _LOG_AVERTISSEMENT); |
|
| 274 | + spip_log("j'ignore IGNORE dans $query", 'pg.'._LOG_AVERTISSEMENT); |
|
| 275 | 275 | } |
| 276 | - $f = 'spip_pg_alter_' . strtolower($r[3]); |
|
| 276 | + $f = 'spip_pg_alter_'.strtolower($r[3]); |
|
| 277 | 277 | if (function_exists($f)) { |
| 278 | 278 | $f($r[2], $r[4], $serveur, $requeter); |
| 279 | 279 | } else { |
| 280 | - spip_log("$query non prevu", 'pg.' . _LOG_ERREUR); |
|
| 280 | + spip_log("$query non prevu", 'pg.'._LOG_ERREUR); |
|
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | 283 | // Alter a plusieurs args. Faudrait optimiser. |
| 284 | 284 | if ($todo) { |
| 285 | - spip_pg_alter("TABLE $table " . join(',', $todo)); |
|
| 285 | + spip_pg_alter("TABLE $table ".join(',', $todo)); |
|
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | function spip_pg_alter_change($table, $arg, $serveur = '', $requeter = true) { |
| 290 | 290 | if (!preg_match('/^`?(\w+)`?\s+`?(\w+)`?\s+(.*?)\s*(DEFAULT .*?)?(NOT\s+NULL)?\s*(DEFAULT .*?)?$/i', $arg, $r)) { |
| 291 | - spip_log("alter change: $arg incompris", 'pg.' . _LOG_ERREUR); |
|
| 291 | + spip_log("alter change: $arg incompris", 'pg.'._LOG_ERREUR); |
|
| 292 | 292 | } else { |
| 293 | 293 | [, $old, $new, $type, $default, $null, $def2] = $r; |
| 294 | - $actions = ["ALTER $old TYPE " . mysql2pg_type($type)]; |
|
| 294 | + $actions = ["ALTER $old TYPE ".mysql2pg_type($type)]; |
|
| 295 | 295 | if ($null) { |
| 296 | 296 | $actions[] = "ALTER $old SET NOT NULL"; |
| 297 | 297 | } else { |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | $actions[] = "ALTER $old DROP DEFAULT"; |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - spip_pg_query("ALTER TABLE $table " . join(', ', $actions)); |
|
| 307 | + spip_pg_query("ALTER TABLE $table ".join(', ', $actions)); |
|
| 308 | 308 | |
| 309 | 309 | if ($old != $new) { |
| 310 | 310 | spip_pg_query("ALTER TABLE $table RENAME $old TO $new", $serveur); |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | function spip_pg_alter_add($table, $arg, $serveur = '', $requeter = true) { |
| 316 | 316 | $nom_index = null; |
| 317 | 317 | if (!preg_match('/^(COLUMN|INDEX|KEY|PRIMARY\s+KEY|)\s*(.*)$/', $arg, $r)) { |
| 318 | - spip_log("alter add $arg incompris", 'pg.' . _LOG_ERREUR); |
|
| 318 | + spip_log("alter add $arg incompris", 'pg.'._LOG_ERREUR); |
|
| 319 | 319 | |
| 320 | 320 | return null; |
| 321 | 321 | } |
@@ -325,14 +325,14 @@ discard block |
||
| 325 | 325 | $m[2] = $n[1]; |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - return spip_pg_query("ALTER TABLE $table ADD " . $m[1] . ' ' . mysql2pg_type($m[2]), $serveur, $requeter); |
|
| 328 | + return spip_pg_query("ALTER TABLE $table ADD ".$m[1].' '.mysql2pg_type($m[2]), $serveur, $requeter); |
|
| 329 | 329 | } elseif ($r[1][0] == 'P') { |
| 330 | 330 | // la primary peut etre sur plusieurs champs |
| 331 | 331 | $r[2] = trim(str_replace('`', '', $r[2])); |
| 332 | 332 | $m = ($r[2][0] == '(') ? substr($r[2], 1, -1) : $r[2]; |
| 333 | 333 | |
| 334 | 334 | return spip_pg_query( |
| 335 | - "ALTER TABLE $table ADD CONSTRAINT $table" . '_pkey PRIMARY KEY (' . $m . ')', |
|
| 335 | + "ALTER TABLE $table ADD CONSTRAINT $table".'_pkey PRIMARY KEY ('.$m.')', |
|
| 336 | 336 | $serveur, |
| 337 | 337 | $requeter |
| 338 | 338 | ); |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | $colonnes = substr($m[1], 1, -1); |
| 352 | 352 | if (false !== strpos(',', $colonnes)) { |
| 353 | 353 | spip_log('PG : Erreur, impossible de creer un index sur plusieurs colonnes' |
| 354 | - . " sans qu'il ait de nom ($table, ($colonnes))", 'pg.' . _LOG_ERREUR); |
|
| 354 | + . " sans qu'il ait de nom ($table, ($colonnes))", 'pg.'._LOG_ERREUR); |
|
| 355 | 355 | } else { |
| 356 | 356 | $nom_index = $colonnes; |
| 357 | 357 | } |
@@ -367,23 +367,23 @@ discard block |
||
| 367 | 367 | |
| 368 | 368 | function spip_pg_alter_drop($table, $arg, $serveur = '', $requeter = true) { |
| 369 | 369 | if (!preg_match('/^(COLUMN|INDEX|KEY|PRIMARY\s+KEY|)\s*`?(\w*)`?/', $arg, $r)) { |
| 370 | - spip_log("alter drop: $arg incompris", 'pg.' . _LOG_ERREUR); |
|
| 370 | + spip_log("alter drop: $arg incompris", 'pg.'._LOG_ERREUR); |
|
| 371 | 371 | } else { |
| 372 | 372 | if (!$r[1] or $r[1] == 'COLUMN') { |
| 373 | - return spip_pg_query("ALTER TABLE $table DROP " . $r[2], $serveur); |
|
| 373 | + return spip_pg_query("ALTER TABLE $table DROP ".$r[2], $serveur); |
|
| 374 | 374 | } elseif ($r[1][0] == 'P') { |
| 375 | - return spip_pg_query("ALTER TABLE $table DROP CONSTRAINT $table" . '_pkey', $serveur); |
|
| 375 | + return spip_pg_query("ALTER TABLE $table DROP CONSTRAINT $table".'_pkey', $serveur); |
|
| 376 | 376 | } else { |
| 377 | - return spip_pg_query('DROP INDEX ' . $table . '_' . $r[2], $serveur); |
|
| 377 | + return spip_pg_query('DROP INDEX '.$table.'_'.$r[2], $serveur); |
|
| 378 | 378 | } |
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | function spip_pg_alter_modify($table, $arg, $serveur = '', $requeter = true) { |
| 383 | 383 | if (!preg_match('/^`?(\w+)`?\s+(.*)$/', $arg, $r)) { |
| 384 | - spip_log("alter modify: $arg incompris", 'pg.' . _LOG_ERREUR); |
|
| 384 | + spip_log("alter modify: $arg incompris", 'pg.'._LOG_ERREUR); |
|
| 385 | 385 | } else { |
| 386 | - return spip_pg_alter_change($table, $r[1] . ' ' . $arg, $serveur = '', $requeter = true); |
|
| 386 | + return spip_pg_alter_change($table, $r[1].' '.$arg, $serveur = '', $requeter = true); |
|
| 387 | 387 | } |
| 388 | 388 | } |
| 389 | 389 | |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | } elseif (preg_match('/^(TO)\s*`?(\w*)`?/', $arg, $r)) { |
| 400 | 400 | $rename = $r[2]; |
| 401 | 401 | } else { |
| 402 | - spip_log("alter rename: $arg incompris", 'pg.' . _LOG_ERREUR); |
|
| 402 | + spip_log("alter rename: $arg incompris", 'pg.'._LOG_ERREUR); |
|
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | return $rename ? spip_pg_query("ALTER TABLE $table RENAME TO $rename") : false; |
@@ -420,8 +420,8 @@ discard block |
||
| 420 | 420 | function spip_pg_create_index($nom, $table, $champs, $serveur = '', $requeter = true) { |
| 421 | 421 | if (!($nom or $table or $champs)) { |
| 422 | 422 | spip_log( |
| 423 | - "Champ manquant pour creer un index pg ($nom, $table, (" . @join(',', $champs) . '))', |
|
| 424 | - 'pg.' . _LOG_ERREUR |
|
| 423 | + "Champ manquant pour creer un index pg ($nom, $table, (".@join(',', $champs).'))', |
|
| 424 | + 'pg.'._LOG_ERREUR |
|
| 425 | 425 | ); |
| 426 | 426 | |
| 427 | 427 | return false; |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | |
| 433 | 433 | // PG ne differentie pas noms des index en fonction des tables |
| 434 | 434 | // il faut donc creer des noms uniques d'index pour une base pg |
| 435 | - $nom = $table . '_' . $nom; |
|
| 435 | + $nom = $table.'_'.$nom; |
|
| 436 | 436 | // enlever d'eventuelles parentheses deja presentes sur champs |
| 437 | 437 | if (!is_array($champs)) { |
| 438 | 438 | if ($champs[0] == '(') { |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | } |
| 441 | 441 | $champs = [$champs]; |
| 442 | 442 | } |
| 443 | - $query = "CREATE INDEX $nom ON $table (" . join(',', $champs) . ')'; |
|
| 443 | + $query = "CREATE INDEX $nom ON $table (".join(',', $champs).')'; |
|
| 444 | 444 | if (!$requeter) { |
| 445 | 445 | return $query; |
| 446 | 446 | } |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | } else { |
| 464 | 464 | $suite = ''; |
| 465 | 465 | } |
| 466 | - $query = 'EXPLAIN ' . preg_replace('/([,\s])spip_/', '\1' . $prefixe . '_', $query) . $suite; |
|
| 466 | + $query = 'EXPLAIN '.preg_replace('/([,\s])spip_/', '\1'.$prefixe.'_', $query).$suite; |
|
| 467 | 467 | |
| 468 | 468 | if (!$requeter) { |
| 469 | 469 | return $query; |
@@ -556,16 +556,16 @@ discard block |
||
| 556 | 556 | } |
| 557 | 557 | } |
| 558 | 558 | $from = spip_pg_from($from, $prefixe); |
| 559 | - $query = 'SELECT ' . $select |
|
| 559 | + $query = 'SELECT '.$select |
|
| 560 | 560 | . (!$from ? '' : "\nFROM $from") |
| 561 | - . (!$where ? '' : ("\nWHERE " . (!is_array($where) ? calculer_pg_where($where) : (join( |
|
| 561 | + . (!$where ? '' : ("\nWHERE ".(!is_array($where) ? calculer_pg_where($where) : (join( |
|
| 562 | 562 | "\n\tAND ", |
| 563 | 563 | array_map('calculer_pg_where', $where) |
| 564 | 564 | ))))) |
| 565 | 565 | . spip_pg_groupby($groupby, $from, $select) |
| 566 | 566 | . (!$having ? '' : "\nHAVING $having") |
| 567 | 567 | . ($orderby ? ("\nORDER BY $orderby") : '') |
| 568 | - . (!$limit ? '' : (" LIMIT $count" . (!$offset ? '' : " OFFSET $offset"))); |
|
| 568 | + . (!$limit ? '' : (" LIMIT $count".(!$offset ? '' : " OFFSET $offset"))); |
|
| 569 | 569 | |
| 570 | 570 | // renvoyer la requete inerte si demandee |
| 571 | 571 | if ($requeter === false) { |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | $from = spip_pg_select_as($from); |
| 587 | 587 | } |
| 588 | 588 | |
| 589 | - return !$prefixe ? $from : preg_replace('/(\b)spip_/', '\1' . $prefixe . '_', $from); |
|
| 589 | + return !$prefixe ? $from : preg_replace('/(\b)spip_/', '\1'.$prefixe.'_', $from); |
|
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | function spip_pg_orderby($order, $select) { |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | $arg = (is_array($order) ? $order : preg_split('/\s*,\s*/', $order)); |
| 595 | 595 | |
| 596 | 596 | foreach ($arg as $v) { |
| 597 | - if (preg_match('/(case\s+.*?else\s+0\s+end)\s*AS\s+' . $v . '/', $select, $m)) { |
|
| 597 | + if (preg_match('/(case\s+.*?else\s+0\s+end)\s*AS\s+'.$v.'/', $select, $m)) { |
|
| 598 | 598 | $res[] = $m[1]; |
| 599 | 599 | } else { |
| 600 | 600 | $res[] = $v; |
@@ -772,7 +772,7 @@ discard block |
||
| 772 | 772 | $n++; |
| 773 | 773 | $res .= "\nwhen $index=$v then $n"; |
| 774 | 774 | } |
| 775 | - $arg = $m[1] . "case $res else 0 end " |
|
| 775 | + $arg = $m[1]."case $res else 0 end " |
|
| 776 | 776 | . substr($arg, strlen($m[0])); |
| 777 | 777 | } |
| 778 | 778 | |
@@ -815,9 +815,9 @@ discard block |
||
| 815 | 815 | } |
| 816 | 816 | |
| 817 | 817 | if (strtoupper($join) === 'AND') { |
| 818 | - return $exp . join("\n\t$join ", array_map('calculer_pg_where', $v)); |
|
| 818 | + return $exp.join("\n\t$join ", array_map('calculer_pg_where', $v)); |
|
| 819 | 819 | } else { |
| 820 | - return $exp . join($join, $v); |
|
| 820 | + return $exp.join($join, $v); |
|
| 821 | 821 | } |
| 822 | 822 | } |
| 823 | 823 | |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | if (substr($k, -1) == '@') { |
| 828 | 828 | // c'est une jointure qui se refere au from precedent |
| 829 | 829 | // pas de virgule |
| 830 | - $argsas .= ' ' . $v; |
|
| 830 | + $argsas .= ' '.$v; |
|
| 831 | 831 | } else { |
| 832 | 832 | $as = ''; |
| 833 | 833 | // spip_log("$k : $v", _LOG_DEBUG); |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | } elseif ($v != $k) { |
| 838 | 838 | $p = strpos($v, ' '); |
| 839 | 839 | if ($p) { |
| 840 | - $v = substr($v, 0, $p) . " AS $k" . substr($v, $p); |
|
| 840 | + $v = substr($v, 0, $p)." AS $k".substr($v, $p); |
|
| 841 | 841 | } else { |
| 842 | 842 | $as = " AS $k"; |
| 843 | 843 | } |
@@ -845,7 +845,7 @@ discard block |
||
| 845 | 845 | } |
| 846 | 846 | // spip_log("subs $k : $v avec $as", _LOG_DEBUG); |
| 847 | 847 | // if (strpos($v, 'JOIN') === false) $argsas .= ', '; |
| 848 | - $argsas .= ', ' . $v . $as; |
|
| 848 | + $argsas .= ', '.$v.$as; |
|
| 849 | 849 | } |
| 850 | 850 | } |
| 851 | 851 | |
@@ -876,7 +876,7 @@ discard block |
||
| 876 | 876 | $serveur = '', |
| 877 | 877 | $requeter = true |
| 878 | 878 | ) { |
| 879 | - $c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 879 | + $c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 880 | 880 | $r = spip_pg_select("COUNT($c)", $from, $where, '', '', '', $having, $serveur, $requeter); |
| 881 | 881 | if (!$requeter) { |
| 882 | 882 | return $r; |
@@ -977,8 +977,8 @@ discard block |
||
| 977 | 977 | |
| 978 | 978 | return spip_pg_insert( |
| 979 | 979 | $table, |
| 980 | - '(' . join(',', array_keys($couples)) . ')', |
|
| 981 | - '(' . join(',', $couples) . ')', |
|
| 980 | + '('.join(',', array_keys($couples)).')', |
|
| 981 | + '('.join(',', $couples).')', |
|
| 982 | 982 | $desc, |
| 983 | 983 | $serveur, |
| 984 | 984 | $requeter |
@@ -1001,7 +1001,7 @@ discard block |
||
| 1001 | 1001 | $c = $tab_couples[0] ?? []; |
| 1002 | 1002 | $les_cles = spip_pg_ajouter_champs_timestamp($table, $c, $desc, $serveur); |
| 1003 | 1003 | |
| 1004 | - $cles = '(' . join(',', array_keys($les_cles)) . ')'; |
|
| 1004 | + $cles = '('.join(',', array_keys($les_cles)).')'; |
|
| 1005 | 1005 | $valeurs = []; |
| 1006 | 1006 | foreach ($tab_couples as $couples) { |
| 1007 | 1007 | foreach ($couples as $champ => $val) { |
@@ -1010,7 +1010,7 @@ discard block |
||
| 1010 | 1010 | // recherche de champs 'timestamp' pour mise a jour auto de ceux-ci |
| 1011 | 1011 | $couples = spip_pg_ajouter_champs_timestamp($table, $couples, $desc, $serveur); |
| 1012 | 1012 | |
| 1013 | - $valeurs[] = '(' . join(',', $couples) . ')'; |
|
| 1013 | + $valeurs[] = '('.join(',', $couples).')'; |
|
| 1014 | 1014 | } |
| 1015 | 1015 | $valeurs = implode(', ', $valeurs); |
| 1016 | 1016 | |
@@ -1031,7 +1031,7 @@ discard block |
||
| 1031 | 1031 | |
| 1032 | 1032 | $set = []; |
| 1033 | 1033 | foreach ($couples as $champ => $val) { |
| 1034 | - $set[] = $champ . '=' . $val; |
|
| 1034 | + $set[] = $champ.'='.$val; |
|
| 1035 | 1035 | } |
| 1036 | 1036 | |
| 1037 | 1037 | $query = calculer_pg_expression('UPDATE', $table, ',') |
@@ -1066,7 +1066,7 @@ discard block |
||
| 1066 | 1066 | |
| 1067 | 1067 | function spip_pg_replace($table, $values, $desc, $serveur = '', $requeter = true) { |
| 1068 | 1068 | if (!$values) { |
| 1069 | - spip_log("replace vide $table", 'pg.' . _LOG_AVERTISSEMENT); |
|
| 1069 | + spip_log("replace vide $table", 'pg.'._LOG_AVERTISSEMENT); |
|
| 1070 | 1070 | |
| 1071 | 1071 | return 0; |
| 1072 | 1072 | } |
@@ -1100,8 +1100,8 @@ discard block |
||
| 1100 | 1100 | if (!$where) { |
| 1101 | 1101 | return spip_pg_insert( |
| 1102 | 1102 | $table, |
| 1103 | - '(' . join(',', array_keys($values)) . ')', |
|
| 1104 | - '(' . join(',', $values) . ')', |
|
| 1103 | + '('.join(',', array_keys($values)).')', |
|
| 1104 | + '('.join(',', $values).')', |
|
| 1105 | 1105 | $desc, |
| 1106 | 1106 | $serveur |
| 1107 | 1107 | ); |
@@ -1122,12 +1122,11 @@ discard block |
||
| 1122 | 1122 | $couples = pg_affected_rows($couples); |
| 1123 | 1123 | } |
| 1124 | 1124 | if (!$couples) { |
| 1125 | - $ret = !$seq ? '' : |
|
| 1126 | - (" RETURNING nextval('$seq') < $prim"); |
|
| 1127 | - $connexion['last'] = $q = "INSERT INTO $table (" . join(',', array_keys($values)) . ') VALUES (' . join( |
|
| 1125 | + $ret = !$seq ? '' : (" RETURNING nextval('$seq') < $prim"); |
|
| 1126 | + $connexion['last'] = $q = "INSERT INTO $table (".join(',', array_keys($values)).') VALUES ('.join( |
|
| 1128 | 1127 | ',', |
| 1129 | 1128 | $values |
| 1130 | - ) . ")$ret"; |
|
| 1129 | + ).")$ret"; |
|
| 1131 | 1130 | $couples = spip_pg_query_simple($link, $q); |
| 1132 | 1131 | if (!$couples) { |
| 1133 | 1132 | return false; |
@@ -1175,7 +1174,7 @@ discard block |
||
| 1175 | 1174 | ) { |
| 1176 | 1175 | return ''; |
| 1177 | 1176 | } else { |
| 1178 | - return $raw ? $prim : $table . '_' . $prim . '_seq'; |
|
| 1177 | + return $raw ? $prim : $table.'_'.$prim.'_seq'; |
|
| 1179 | 1178 | } |
| 1180 | 1179 | } |
| 1181 | 1180 | |
@@ -1192,29 +1191,29 @@ discard block |
||
| 1192 | 1191 | return spip_pg_frommysql($v); |
| 1193 | 1192 | } else { |
| 1194 | 1193 | if (strncmp($v, '0000', 4) == 0) { |
| 1195 | - $v = '0001' . substr($v, 4); |
|
| 1194 | + $v = '0001'.substr($v, 4); |
|
| 1196 | 1195 | } |
| 1197 | 1196 | if (strpos($v, '-00-00') === 4) { |
| 1198 | - $v = substr($v, 0, 4) . '-01-01' . substr($v, 10); |
|
| 1197 | + $v = substr($v, 0, 4).'-01-01'.substr($v, 10); |
|
| 1199 | 1198 | } |
| 1200 | 1199 | |
| 1201 | 1200 | return "timestamp '$v'"; |
| 1202 | 1201 | } |
| 1203 | 1202 | } elseif (!sql_test_int($t)) { |
| 1204 | - return ("'" . pg_escape_string($v) . "'"); |
|
| 1203 | + return ("'".pg_escape_string($v)."'"); |
|
| 1205 | 1204 | } elseif (is_numeric($v) or (strpos($v, 'CAST(') === 0)) { |
| 1206 | 1205 | return $v; |
| 1207 | 1206 | } elseif ($v[0] == '0' and $v[1] !== 'x' and ctype_xdigit(substr($v, 1))) { |
| 1208 | 1207 | return substr($v, 1); |
| 1209 | 1208 | } else { |
| 1210 | - spip_log("Warning: '$v' n'est pas de type $t", 'pg.' . _LOG_AVERTISSEMENT); |
|
| 1209 | + spip_log("Warning: '$v' n'est pas de type $t", 'pg.'._LOG_AVERTISSEMENT); |
|
| 1211 | 1210 | |
| 1212 | 1211 | return intval($v); |
| 1213 | 1212 | } |
| 1214 | 1213 | } |
| 1215 | 1214 | |
| 1216 | 1215 | function spip_pg_hex($v) { |
| 1217 | - return "CAST(x'" . $v . "' as bigint)"; |
|
| 1216 | + return "CAST(x'".$v."' as bigint)"; |
|
| 1218 | 1217 | } |
| 1219 | 1218 | |
| 1220 | 1219 | function spip_pg_quote($v, $type = '') { |
@@ -1252,15 +1251,15 @@ discard block |
||
| 1252 | 1251 | return $not ? '0=0' : '0=1'; |
| 1253 | 1252 | } |
| 1254 | 1253 | if (strpos($valeurs, "CAST(x'") !== false) { |
| 1255 | - return "($val=" . join("OR $val=", explode(',', $valeurs)) . ')'; |
|
| 1254 | + return "($val=".join("OR $val=", explode(',', $valeurs)).')'; |
|
| 1256 | 1255 | } |
| 1257 | 1256 | $n = $i = 0; |
| 1258 | 1257 | $in_sql = ''; |
| 1259 | 1258 | while ($n = strpos($valeurs, ',', $n + 1)) { |
| 1260 | 1259 | if ((++$i) >= 255) { |
| 1261 | - $in_sql .= "($val $not IN (" . |
|
| 1262 | - substr($valeurs, 0, $n) . |
|
| 1263 | - "))\n" . |
|
| 1260 | + $in_sql .= "($val $not IN (". |
|
| 1261 | + substr($valeurs, 0, $n). |
|
| 1262 | + "))\n". |
|
| 1264 | 1263 | ($not ? "AND\t" : "OR\t"); |
| 1265 | 1264 | $valeurs = substr($valeurs, $n + 1); |
| 1266 | 1265 | $i = $n = 0; |
@@ -1276,7 +1275,7 @@ discard block |
||
| 1276 | 1275 | $s = $link ? pg_last_error($link) : pg_last_error(); |
| 1277 | 1276 | if ($s) { |
| 1278 | 1277 | $s = str_replace('ERROR', 'errcode: 1000 ', $s); |
| 1279 | - spip_log("$s - $query", 'pg.' . _LOG_ERREUR); |
|
| 1278 | + spip_log("$s - $query", 'pg.'._LOG_ERREUR); |
|
| 1280 | 1279 | } |
| 1281 | 1280 | |
| 1282 | 1281 | return $s; |
@@ -1324,7 +1323,7 @@ discard block |
||
| 1324 | 1323 | function spip_pg_showbase($match, $serveur = '', $requeter = true) { |
| 1325 | 1324 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 1326 | 1325 | $link = $connexion['link']; |
| 1327 | - $connexion['last'] = $q = 'SELECT tablename FROM pg_tables WHERE tablename ILIKE ' . _q($match); |
|
| 1326 | + $connexion['last'] = $q = 'SELECT tablename FROM pg_tables WHERE tablename ILIKE '._q($match); |
|
| 1328 | 1327 | |
| 1329 | 1328 | return spip_pg_query_simple($link, $q); |
| 1330 | 1329 | } |
@@ -1332,7 +1331,7 @@ discard block |
||
| 1332 | 1331 | function spip_pg_showtable($nom_table, $serveur = '', $requeter = true) { |
| 1333 | 1332 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 1334 | 1333 | $link = $connexion['link']; |
| 1335 | - $connexion['last'] = $q = 'SELECT column_name, column_default, data_type FROM information_schema.columns WHERE table_name ILIKE ' . _q($nom_table); |
|
| 1334 | + $connexion['last'] = $q = 'SELECT column_name, column_default, data_type FROM information_schema.columns WHERE table_name ILIKE '._q($nom_table); |
|
| 1336 | 1335 | |
| 1337 | 1336 | $res = spip_pg_query_simple($link, $q); |
| 1338 | 1337 | if (!$res) { |
@@ -1343,15 +1342,15 @@ discard block |
||
| 1343 | 1342 | // il faut en tenir compte dans le return |
| 1344 | 1343 | $fields = []; |
| 1345 | 1344 | while ($field = pg_fetch_array($res, null, PGSQL_NUM)) { |
| 1346 | - $fields[$field[0]] = $field[2] . (!$field[1] ? '' : (' DEFAULT ' . $field[1])); |
|
| 1345 | + $fields[$field[0]] = $field[2].(!$field[1] ? '' : (' DEFAULT '.$field[1])); |
|
| 1347 | 1346 | } |
| 1348 | - $connexion['last'] = $q = 'SELECT indexdef FROM pg_indexes WHERE tablename ILIKE ' . _q($nom_table); |
|
| 1347 | + $connexion['last'] = $q = 'SELECT indexdef FROM pg_indexes WHERE tablename ILIKE '._q($nom_table); |
|
| 1349 | 1348 | $res = spip_pg_query_simple($link, $q); |
| 1350 | 1349 | $keys = []; |
| 1351 | 1350 | while ($index = pg_fetch_array($res, null, PGSQL_NUM)) { |
| 1352 | 1351 | if (preg_match('/CREATE\s+(UNIQUE\s+)?INDEX\s([^\s]+).*\((.*)\)$/', $index[0], $r)) { |
| 1353 | - $nom = str_replace($nom_table . '_', '', $r[2]); |
|
| 1354 | - $keys[($r[1] ? 'PRIMARY KEY' : ('KEY ' . $nom))] = $r[3]; |
|
| 1352 | + $nom = str_replace($nom_table.'_', '', $r[2]); |
|
| 1353 | + $keys[($r[1] ? 'PRIMARY KEY' : ('KEY '.$nom))] = $r[3]; |
|
| 1355 | 1354 | } |
| 1356 | 1355 | } |
| 1357 | 1356 | |
@@ -1383,16 +1382,16 @@ discard block |
||
| 1383 | 1382 | if (strpos($k, 'KEY ') === 0) { |
| 1384 | 1383 | $n = str_replace('`', '', $k); |
| 1385 | 1384 | $v = str_replace('`', '"', $v); |
| 1386 | - $i = $nom . preg_replace('/KEY +/', '_', $n); |
|
| 1385 | + $i = $nom.preg_replace('/KEY +/', '_', $n); |
|
| 1387 | 1386 | if ($k != $n) { |
| 1388 | 1387 | $i = "\"$i\""; |
| 1389 | 1388 | } |
| 1390 | 1389 | $keys[] = "CREATE INDEX $i ON $nom ($v);"; |
| 1391 | 1390 | } elseif (strpos($k, 'UNIQUE ') === 0) { |
| 1392 | 1391 | $k = preg_replace('/^UNIQUE +/', '', $k); |
| 1393 | - $prim .= "$s\n\t\tCONSTRAINT " . str_replace('`', '"', $k) . " UNIQUE ($v)"; |
|
| 1392 | + $prim .= "$s\n\t\tCONSTRAINT ".str_replace('`', '"', $k)." UNIQUE ($v)"; |
|
| 1394 | 1393 | } else { |
| 1395 | - $prim .= "$s\n\t\t" . str_replace('`', '"', $k) . " ($v)"; |
|
| 1394 | + $prim .= "$s\n\t\t".str_replace('`', '"', $k)." ($v)"; |
|
| 1396 | 1395 | } |
| 1397 | 1396 | if ($k == 'PRIMARY KEY') { |
| 1398 | 1397 | $prim_name = $v; |
@@ -1403,17 +1402,17 @@ discard block |
||
| 1403 | 1402 | |
| 1404 | 1403 | $character_set = ''; |
| 1405 | 1404 | if (@$GLOBALS['meta']['charset_sql_base']) { |
| 1406 | - $character_set .= ' CHARACTER SET ' . $GLOBALS['meta']['charset_sql_base']; |
|
| 1405 | + $character_set .= ' CHARACTER SET '.$GLOBALS['meta']['charset_sql_base']; |
|
| 1407 | 1406 | } |
| 1408 | 1407 | if (@$GLOBALS['meta']['charset_collation_sql_base']) { |
| 1409 | - $character_set .= ' COLLATE ' . $GLOBALS['meta']['charset_collation_sql_base']; |
|
| 1408 | + $character_set .= ' COLLATE '.$GLOBALS['meta']['charset_collation_sql_base']; |
|
| 1410 | 1409 | } |
| 1411 | 1410 | |
| 1412 | 1411 | foreach ($champs as $k => $v) { |
| 1413 | 1412 | $k = str_replace('`', '"', $k); |
| 1414 | 1413 | if (preg_match(',([a-z]*\s*(\(\s*[0-9]*\s*\))?(\s*binary)?),i', $v, $defs)) { |
| 1415 | 1414 | if (preg_match(',(char|text),i', $defs[1]) and !preg_match(',binary,i', $defs[1])) { |
| 1416 | - $v = $defs[1] . $character_set . ' ' . substr($v, strlen($defs[1])); |
|
| 1415 | + $v = $defs[1].$character_set.' '.substr($v, strlen($defs[1])); |
|
| 1417 | 1416 | } |
| 1418 | 1417 | } |
| 1419 | 1418 | |
@@ -1428,7 +1427,7 @@ discard block |
||
| 1428 | 1427 | |
| 1429 | 1428 | // En l'absence de "if not exists" en PG, on neutralise les erreurs |
| 1430 | 1429 | |
| 1431 | - $q = "CREATE $temporary TABLE $nom ($query" . ($prim ? ",$prim" : '') . ')' . |
|
| 1430 | + $q = "CREATE $temporary TABLE $nom ($query".($prim ? ",$prim" : '').')'. |
|
| 1432 | 1431 | ($character_set ? " DEFAULT $character_set" : '') |
| 1433 | 1432 | . "\n"; |
| 1434 | 1433 | |
@@ -1439,7 +1438,7 @@ discard block |
||
| 1439 | 1438 | $r = @pg_query($link, $q); |
| 1440 | 1439 | |
| 1441 | 1440 | if (!$r) { |
| 1442 | - spip_log("Impossible de creer cette table: $q", 'pg.' . _LOG_ERREUR); |
|
| 1441 | + spip_log("Impossible de creer cette table: $q", 'pg.'._LOG_ERREUR); |
|
| 1443 | 1442 | } else { |
| 1444 | 1443 | foreach ($keys as $index) { |
| 1445 | 1444 | pg_query($link, $index); |
@@ -1462,20 +1461,20 @@ discard block |
||
| 1462 | 1461 | // vue deja presente |
| 1463 | 1462 | if (sql_showtable($nom, false, $serveur)) { |
| 1464 | 1463 | if ($requeter) { |
| 1465 | - spip_log("Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)", 'pg.' . _LOG_ERREUR); |
|
| 1464 | + spip_log("Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)", 'pg.'._LOG_ERREUR); |
|
| 1466 | 1465 | } |
| 1467 | 1466 | |
| 1468 | 1467 | return false; |
| 1469 | 1468 | } |
| 1470 | 1469 | |
| 1471 | - $query = "CREATE VIEW $nom AS " . $query_select; |
|
| 1470 | + $query = "CREATE VIEW $nom AS ".$query_select; |
|
| 1472 | 1471 | |
| 1473 | 1472 | return spip_pg_query($query, $serveur, $requeter); |
| 1474 | 1473 | } |
| 1475 | 1474 | |
| 1476 | 1475 | |
| 1477 | 1476 | function spip_pg_set_connect_charset($charset, $serveur = '', $requeter = true) { |
| 1478 | - spip_log('changement de charset sql a ecrire en PG', 'pg.' . _LOG_ERREUR); |
|
| 1477 | + spip_log('changement de charset sql a ecrire en PG', 'pg.'._LOG_ERREUR); |
|
| 1479 | 1478 | } |
| 1480 | 1479 | |
| 1481 | 1480 | |
@@ -1488,7 +1487,7 @@ discard block |
||
| 1488 | 1487 | * @return bool|string true / false / requete |
| 1489 | 1488 | **/ |
| 1490 | 1489 | function spip_pg_optimize($table, $serveur = '', $requeter = true) { |
| 1491 | - return spip_pg_query('VACUUM ' . $table, $serveur, $requeter); |
|
| 1490 | + return spip_pg_query('VACUUM '.$table, $serveur, $requeter); |
|
| 1492 | 1491 | } |
| 1493 | 1492 | |
| 1494 | 1493 | // Selectionner la sous-chaine dans $objet |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | " class='picto_err'", |
| 64 | 64 | _T('plugin_info_erreur_xml') |
| 65 | 65 | ) |
| 66 | - . "<div class='erreur'>" . join('<br >', $info['erreur']) . '</div>'; |
|
| 66 | + . "<div class='erreur'>".join('<br >', $info['erreur']).'</div>'; |
|
| 67 | 67 | $checkable = false; |
| 68 | - } elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file])) { |
|
| 68 | + } elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins.$plug_file])) { |
|
| 69 | 69 | $class_li .= ' error'; |
| 70 | 70 | $erreur = http_img_pack( |
| 71 | 71 | 'plugin-err-32.png', |
@@ -73,10 +73,10 @@ discard block |
||
| 73 | 73 | " class='picto_err'", |
| 74 | 74 | _T('plugin_impossible_activer', ['plugin' => $nom]) |
| 75 | 75 | ) |
| 76 | - . "<div class='erreur'>" . implode( |
|
| 76 | + . "<div class='erreur'>".implode( |
|
| 77 | 77 | '<br />', |
| 78 | - $GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file] |
|
| 79 | - ) . '</div>'; |
|
| 78 | + $GLOBALS['erreurs_activation_raw'][$dir_plugins.$plug_file] |
|
| 79 | + ).'</div>'; |
|
| 80 | 80 | } else { |
| 81 | 81 | $cfg = $actif ? plugin_bouton_config($plug_file, $info, $dir_plugins) : ''; |
| 82 | 82 | if (defined('_DEV_VERSION_SPIP_COMPAT') and !plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'])) { |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | // numerotons les occurrences d'un meme prefix |
| 94 | 94 | $versions[$prefix] = $id = isset($versions[$prefix]) ? intval($versions[$prefix]) + 1 : ''; |
| 95 | 95 | |
| 96 | - $class_li .= ($actif ? ' actif' : '') . ($expose ? ' on' : ''); |
|
| 96 | + $class_li .= ($actif ? ' actif' : '').($expose ? ' on' : ''); |
|
| 97 | 97 | |
| 98 | 98 | return "<li id='$prefix$id' class='$class_li'>" |
| 99 | 99 | . ((!$checkable and !$checked) |
| 100 | - ? '' : plugin_checkbox(++$id_input, $dir_plugins . $plug_file, $checked)) |
|
| 100 | + ? '' : plugin_checkbox(++$id_input, $dir_plugins.$plug_file, $checked)) |
|
| 101 | 101 | . plugin_resume($info, $dir_plugins, $plug_file, $url_page) |
| 102 | 102 | . $cfg |
| 103 | 103 | . $erreur |
@@ -116,9 +116,9 @@ discard block |
||
| 116 | 116 | // si paquet.xml fournit un squelette, le prendre |
| 117 | 117 | if (isset($infos['config']) and $infos['config']) { |
| 118 | 118 | return recuperer_fond( |
| 119 | - "$dir$nom/" . $infos['config'], |
|
| 119 | + "$dir$nom/".$infos['config'], |
|
| 120 | 120 | [ |
| 121 | - 'script' => 'configurer_' . $prefix, |
|
| 121 | + 'script' => 'configurer_'.$prefix, |
|
| 122 | 122 | 'nom' => $nom |
| 123 | 123 | ] |
| 124 | 124 | ); |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | return recuperer_fond( |
| 138 | 138 | 'prive/squelettes/inclure/cfg', |
| 139 | 139 | [ |
| 140 | - 'script' => 'configurer_' . $prefix, |
|
| 140 | + 'script' => 'configurer_'.$prefix, |
|
| 141 | 141 | 'nom' => $nom |
| 142 | 142 | ] |
| 143 | 143 | ); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | . "<input type='checkbox' name='s$name' id='label_$id_input'" |
| 154 | 154 | . ($actif ? " checked='checked'" : '') |
| 155 | 155 | . " class='checkbox' value='O' />" |
| 156 | - . "\n<label for='label_$id_input'>" . _T('activer_plugin') . '</label>' |
|
| 156 | + . "\n<label for='label_$id_input'>"._T('activer_plugin').'</label>' |
|
| 157 | 157 | . '</div>'; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -208,11 +208,11 @@ discard block |
||
| 208 | 208 | . "<h3><a href='$url' rel='info'>" |
| 209 | 209 | . $nom |
| 210 | 210 | . '</a></h3>' |
| 211 | - . " <span class='version'>" . $info['version'] . '</span>' |
|
| 211 | + . " <span class='version'>".$info['version'].'</span>' |
|
| 212 | 212 | . " <span class='etat'> - " |
| 213 | 213 | . plugin_etat_en_clair($info['etat']) |
| 214 | 214 | . '</span>' |
| 215 | - . "<div class='short'>" . $slogan . '</div>' |
|
| 215 | + . "<div class='short'>".$slogan.'</div>' |
|
| 216 | 216 | . $i |
| 217 | 217 | . '</div>'; |
| 218 | 218 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $text2 = _T('info_desinstaller_plugin'); |
| 228 | 228 | $file = basename($plug_file); |
| 229 | 229 | |
| 230 | - return "<div class='actions'>[" . |
|
| 230 | + return "<div class='actions'>[". |
|
| 231 | 231 | "<a href='$action' |
| 232 | 232 | onclick='return confirm(\"$text $nom ?\\n$text2\")'>" |
| 233 | 233 | . $text |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | $etat = 'developpement'; |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - return _T('plugin_etat_' . $etat); |
|
| 252 | + return _T('plugin_etat_'.$etat); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | function plugin_propre($texte, $module = '', $propre = 'propre') { |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | $module = substr($module, strlen(_DIR_RACINE)); |
| 259 | 259 | } |
| 260 | 260 | if (preg_match('|^\w+_[\w_]+$|', $texte)) { |
| 261 | - $texte = _T(($module ? "$module:" : '') . $texte, [], ['force' => false]); |
|
| 261 | + $texte = _T(($module ? "$module:" : '').$texte, [], ['force' => false]); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | return $propre($texte); |
@@ -291,9 +291,9 @@ discard block |
||
| 291 | 291 | isset($info['documentation']) |
| 292 | 292 | and $lien = $info['documentation'] |
| 293 | 293 | ) { |
| 294 | - $description .= "<p><em class='site'><a href='$lien' class='spip_out'>" . _T('en_savoir_plus') . '</a></em></p>'; |
|
| 294 | + $description .= "<p><em class='site'><a href='$lien' class='spip_out'>"._T('en_savoir_plus').'</a></em></p>'; |
|
| 295 | 295 | } |
| 296 | - $s .= "<dd class='desc'>" . $description . "</dd>\n"; |
|
| 296 | + $s .= "<dd class='desc'>".$description."</dd>\n"; |
|
| 297 | 297 | |
| 298 | 298 | if (isset($info['auteur'])) { |
| 299 | 299 | if (is_array($info['auteur'])) { |
@@ -303,19 +303,19 @@ discard block |
||
| 303 | 303 | $a = trim($info['auteur']); |
| 304 | 304 | } |
| 305 | 305 | if ($a) { |
| 306 | - $s .= "<dt class='auteurs'>" . _T('public:par_auteur') . "</dt><dd class='auteurs'>" . PtoBR(propre( |
|
| 306 | + $s .= "<dt class='auteurs'>"._T('public:par_auteur')."</dt><dd class='auteurs'>".PtoBR(propre( |
|
| 307 | 307 | $a, |
| 308 | 308 | $dir |
| 309 | - )) . "</dd>\n"; |
|
| 309 | + ))."</dd>\n"; |
|
| 310 | 310 | } |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | if (isset($info['credit'])) { |
| 314 | 314 | if ($a = formater_credits($info['credit'], ', ')) { |
| 315 | - $s .= "<dt class='credits'>" . _T('plugin_info_credit') . "</dt><dd class='credits'>" . PtoBR(propre( |
|
| 315 | + $s .= "<dt class='credits'>"._T('plugin_info_credit')."</dt><dd class='credits'>".PtoBR(propre( |
|
| 316 | 316 | $a, |
| 317 | 317 | $dir |
| 318 | - )) . "</dd>\n"; |
|
| 318 | + ))."</dd>\n"; |
|
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | |
@@ -327,10 +327,10 @@ discard block |
||
| 327 | 327 | $a = trim($info['licence']); |
| 328 | 328 | } |
| 329 | 329 | if ($a) { |
| 330 | - $s .= "<dt class='licence'>" . _T('intitule_licence') . "</dt><dd class='licence'>" . PtoBR(propre( |
|
| 330 | + $s .= "<dt class='licence'>"._T('intitule_licence')."</dt><dd class='licence'>".PtoBR(propre( |
|
| 331 | 331 | $a, |
| 332 | 332 | $dir |
| 333 | - )) . "</dd>\n"; |
|
| 333 | + ))."</dd>\n"; |
|
| 334 | 334 | } |
| 335 | 335 | } |
| 336 | 336 | |
@@ -341,25 +341,24 @@ discard block |
||
| 341 | 341 | // |
| 342 | 342 | $infotech = []; |
| 343 | 343 | |
| 344 | - $version = '<dt>' . _T('version') . '</dt><dd>' . $info['version']; |
|
| 344 | + $version = '<dt>'._T('version').'</dt><dd>'.$info['version']; |
|
| 345 | 345 | // Version VCS |
| 346 | - if ($vcs = version_vcs_courante($dir_plugins . $plug_file)) { |
|
| 347 | - $version .= ' ' . $vcs; |
|
| 346 | + if ($vcs = version_vcs_courante($dir_plugins.$plug_file)) { |
|
| 347 | + $version .= ' '.$vcs; |
|
| 348 | 348 | } |
| 349 | 349 | $version .= '</dd>'; |
| 350 | 350 | $infotech[] = $version; |
| 351 | - $infotech[] = '<dt>' . _T('repertoire_plugins') . '</dt><dd>' . joli_repertoire("$dir_plugins$plug_file") . '</dd>'; |
|
| 351 | + $infotech[] = '<dt>'._T('repertoire_plugins').'</dt><dd>'.joli_repertoire("$dir_plugins$plug_file").'</dd>'; |
|
| 352 | 352 | // source zip le cas echeant |
| 353 | - $infotech[] = (lire_fichier($dir_plugins . $plug_file . '/install.log', $log) |
|
| 353 | + $infotech[] = (lire_fichier($dir_plugins.$plug_file.'/install.log', $log) |
|
| 354 | 354 | and preg_match(',^source:(.*)$,m', $log, $r)) |
| 355 | - ? '<dt>' . _T('plugin_source') . '</dt><dd>' . trim($r[1]) . '</dd>' |
|
| 355 | + ? '<dt>'._T('plugin_source').'</dt><dd>'.trim($r[1]).'</dd>' |
|
| 356 | 356 | : ''; |
| 357 | 357 | |
| 358 | - $infotech[] = !$info['necessite'] ? '' : |
|
| 359 | - ('<dt>' . _T('plugin_info_necessite') . '</dt><dd>' . join( |
|
| 358 | + $infotech[] = !$info['necessite'] ? '' : ('<dt>'._T('plugin_info_necessite').'</dt><dd>'.join( |
|
| 360 | 359 | ' ', |
| 361 | 360 | array_map('array_shift', $info['necessite']) |
| 362 | - ) . '</dd>'); |
|
| 361 | + ).'</dd>'); |
|
| 363 | 362 | |
| 364 | 363 | $s .= "<dl class='tech'>" |
| 365 | 364 | . join('', $infotech) |
@@ -380,8 +379,8 @@ discard block |
||
| 380 | 379 | $texte .= |
| 381 | 380 | (!is_array($_credit)) |
| 382 | 381 | ? PtoBR(propre($_credit)) |
| 383 | - : ($_credit['url'] ? '<a href="' . $_credit['url'] . '">' : '') . |
|
| 384 | - $_credit['nom'] . |
|
| 382 | + : ($_credit['url'] ? '<a href="'.$_credit['url'].'">' : ''). |
|
| 383 | + $_credit['nom']. |
|
| 385 | 384 | ($_credit['url'] ? '</a>' : ''); |
| 386 | 385 | } |
| 387 | 386 | |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | ]; |
| 45 | 45 | $style_titre_mapping = ['couleur' => 'topper', 'trait-couleur' => 'section']; |
| 46 | 46 | $c = $style_mapping[$style] ?? 'simple'; |
| 47 | - $class = $c . ($class ? " $class" : ''); |
|
| 47 | + $class = $c.($class ? " $class" : ''); |
|
| 48 | 48 | if (!$padding) { |
| 49 | - $class .= ($class ? ' ' : '') . 'no-padding'; |
|
| 49 | + $class .= ($class ? ' ' : '').'no-padding'; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | //($id?"id='$id' ":"") |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | if ($fonction) { |
| 62 | 62 | // 2 images pour composer l'icone : le fond (article) en background, |
| 63 | 63 | // la fonction (new) en image |
| 64 | - $icone = http_img_pack($fonction, '', "class='cadre-icone' width='$size' height='$size'\n" . |
|
| 64 | + $icone = http_img_pack($fonction, '', "class='cadre-icone' width='$size' height='$size'\n". |
|
| 65 | 65 | http_style_background($fond, 'no-repeat center center', $size)); |
| 66 | 66 | } else { |
| 67 | 67 | $icone = http_img_pack($fond, '', "class='cadre-icone' width='$size' height='$size'"); |
| 68 | 68 | } |
| 69 | - $titre = $icone . $titre; |
|
| 69 | + $titre = $icone.$titre; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | return boite_ouvrir($titre, $class, $style_titre_mapping[$style] ?? '', $id); |
@@ -179,14 +179,14 @@ discard block |
||
| 179 | 179 | $titre, |
| 180 | 180 | $ze_logo = '' |
| 181 | 181 | ) { |
| 182 | - return "<h1 class = 'grostitre'>" . $ze_logo . ' ' . typo($titre) . "</h1>\n"; |
|
| 182 | + return "<h1 class = 'grostitre'>".$ze_logo.' '.typo($titre)."</h1>\n"; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | // La boite des raccourcis |
| 186 | 186 | // Se place a droite si l'ecran est en mode panoramique. |
| 187 | 187 | function bloc_des_raccourcis($bloc) { |
| 188 | 188 | return creer_colonne_droite() |
| 189 | - . boite_ouvrir(_T('titre_cadre_raccourcis'), 'raccourcis') . $bloc . boite_fermer(); |
|
| 189 | + . boite_ouvrir(_T('titre_cadre_raccourcis'), 'raccourcis').$bloc.boite_fermer(); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | // |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $class = ' blocreplie'; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - return '<div ' . ($id ? "id='$id' " : '') . "class='bloc_depliable$class'>"; |
|
| 56 | + return '<div '.($id ? "id='$id' " : '')."class='bloc_depliable$class'>"; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | function fin_block() { |
@@ -64,12 +64,12 @@ discard block |
||
| 64 | 64 | // $deplie : true (deplie) ou false (plie) ou -1 (inactif) ou 'incertain' pour que le bouton s'auto init au chargement de la page |
| 65 | 65 | // $ids : id des div lies au bouton (facultatif, par defaut c'est le div.bloc_depliable qui suit) |
| 66 | 66 | function bouton_block_depliable($texte, $deplie, $ids = '') { |
| 67 | - $bouton_id = 'b' . substr(md5($texte . microtime()), 0, 8); |
|
| 67 | + $bouton_id = 'b'.substr(md5($texte.microtime()), 0, 8); |
|
| 68 | 68 | |
| 69 | 69 | $class = ($deplie === true) ? ' deplie' : (($deplie == -1) ? ' impliable' : ' replie'); |
| 70 | 70 | if (strlen($ids)) { |
| 71 | 71 | $cible = explode(',', $ids); |
| 72 | - $cible = '#' . implode(',#', $cible); |
|
| 72 | + $cible = '#'.implode(',#', $cible); |
|
| 73 | 73 | } else { |
| 74 | 74 | $cible = "#$bouton_id + div.bloc_depliable"; |
| 75 | 75 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | . $pere |
| 62 | 62 | . '</b>' |
| 63 | 63 | . (!$bons_peres ? '' |
| 64 | - : ('<p style="font-size: 80%"> ' . _T('zxml_mais_de') . ' <b>' . $bons_peres . '</b></p>'))); |
|
| 64 | + : ('<p style="font-size: 80%"> '._T('zxml_mais_de').' <b>'.$bons_peres.'</b></p>'))); |
|
| 65 | 65 | } elseif ($this->dtc->regles[$pere][0] == '/') { |
| 66 | 66 | $frat = substr($depth, 2); |
| 67 | 67 | if (!isset($this->fratrie[$frat])) { |
@@ -98,15 +98,15 @@ discard block |
||
| 98 | 98 | if (!isset($a[$name])) { |
| 99 | 99 | $bons = join(', ', array_keys($a)); |
| 100 | 100 | if ($bons) { |
| 101 | - $bons = " title=' " . |
|
| 102 | - _T('zxml_connus_attributs') . |
|
| 103 | - ' : ' . |
|
| 104 | - $bons . |
|
| 101 | + $bons = " title=' ". |
|
| 102 | + _T('zxml_connus_attributs'). |
|
| 103 | + ' : '. |
|
| 104 | + $bons. |
|
| 105 | 105 | "'"; |
| 106 | 106 | } |
| 107 | 107 | $bons .= " style='font-weight: bold'"; |
| 108 | 108 | coordonnees_erreur($this, " <b>$name</b> " |
| 109 | - . _T('zxml_inconnu_attribut') . ' ' . _T('zxml_de') |
|
| 109 | + . _T('zxml_inconnu_attribut').' '._T('zxml_de') |
|
| 110 | 110 | . " <a$bons>$bal</a> (" |
| 111 | 111 | . _T('zxml_survoler') |
| 112 | 112 | . ')'); |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | if (!preg_match('/^\w+$/', $type)) { |
| 116 | 116 | $this->valider_motif($phraseur, $name, $val, $bal, $type); |
| 117 | 117 | } else { |
| 118 | - if (method_exists($this, $f = 'validerAttribut_' . $type)) { |
|
| 118 | + if (method_exists($this, $f = 'validerAttribut_'.$type)) { |
|
| 119 | 119 | $this->$f($phraseur, $name, $val, $bal); |
| 120 | 120 | } |
| 121 | 121 | } |
@@ -164,13 +164,13 @@ discard block |
||
| 164 | 164 | . " <b>$bal</b> " |
| 165 | 165 | . _T('zxml_non_conforme') |
| 166 | 166 | . '</p><p>' |
| 167 | - . '<b>' . $motif . '</b>'); |
|
| 167 | + . '<b>'.$motif.'</b>'); |
|
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | public function valider_idref($nom, $ligne, $col) { |
| 172 | 172 | if (!isset($this->ids[$nom])) { |
| 173 | - $this->err[] = [" <p><b>$nom</b> " . _T('zxml_inconnu_id'), $ligne, $col]; |
|
| 173 | + $this->err[] = [" <p><b>$nom</b> "._T('zxml_inconnu_id'), $ligne, $col]; |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | // controler que les balises devant etre vides le sont |
| 218 | 218 | if ($vide) { |
| 219 | 219 | if ($n <> ($k + $c)) { |
| 220 | - coordonnees_erreur($this, " <p><b>$name</b> " . _T('zxml_nonvide_balise')); |
|
| 220 | + coordonnees_erreur($this, " <p><b>$name</b> "._T('zxml_nonvide_balise')); |
|
| 221 | 221 | } |
| 222 | 222 | // pour les regles PCDATA ou iteration de disjonction, tout est fait |
| 223 | 223 | } elseif ($regle and ($regle != '*')) { |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | $d = $this->ouvrant[$d]; |
| 253 | 253 | preg_match('/^\s*(\S+)/', $d, $m); |
| 254 | 254 | if (isset($this->dtc->pcdata[$m[1]]) and ($this->dtc->pcdata[$m[1]])) { |
| 255 | - coordonnees_erreur($this, ' <p><b>' . $m[1] . '</b> ' |
|
| 255 | + coordonnees_erreur($this, ' <p><b>'.$m[1].'</b> ' |
|
| 256 | 256 | . _T('zxml_nonvide_balise')); // message a affiner |
| 257 | 257 | } |
| 258 | 258 | } |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | public function phraserTout($phraseur, $data) { |
| 297 | 297 | xml_parsestring($this, $data); |
| 298 | 298 | |
| 299 | - if (!$this->dtc or preg_match(',^' . _MESSAGE_DOCTYPE . ',', $data)) { |
|
| 299 | + if (!$this->dtc or preg_match(',^'._MESSAGE_DOCTYPE.',', $data)) { |
|
| 300 | 300 | $this->err[] = ['DOCTYPE ?', 0, 0]; |
| 301 | 301 | } else { |
| 302 | 302 | $this->valider_passe2(); |
@@ -48,19 +48,19 @@ discard block |
||
| 48 | 48 | * Nom d'une balise #TOTO |
| 49 | 49 | * |
| 50 | 50 | * Écriture alambiquée pour rester compatible avec les hexadecimaux des vieux squelettes */ |
| 51 | -define('NOM_DE_CHAMP', '#((' . NOM_DE_BOUCLE . "):)?(([A-F]*[G-Z_][A-Z_0-9]*)|[A-Z_]+)\b(\*{0,2})"); |
|
| 51 | +define('NOM_DE_CHAMP', '#(('.NOM_DE_BOUCLE."):)?(([A-F]*[G-Z_][A-Z_0-9]*)|[A-Z_]+)\b(\*{0,2})"); |
|
| 52 | 52 | /** Balise complète [...(#TOTO) ... ] */ |
| 53 | -define('CHAMP_ETENDU', '/\[([^]\[]*)\(' . NOM_DE_CHAMP . '([^[)]*\)[^]\[]*)\]/S'); |
|
| 53 | +define('CHAMP_ETENDU', '/\[([^]\[]*)\('.NOM_DE_CHAMP.'([^[)]*\)[^]\[]*)\]/S'); |
|
| 54 | 54 | |
| 55 | 55 | define('BALISE_INCLURE', '/<INCLU[DR]E[[:space:]]*(\(([^)]*)\))?/S'); |
| 56 | 56 | define('BALISE_POLYGLOTTE', ',<multi>(.*)</multi>,Uims'); |
| 57 | 57 | define('BALISE_IDIOMES', ',<:(([a-z0-9_]+):)?([a-z0-9_]*)({([^\|=>]*=[^\|>]*)})?((\|[^>]*)?:/?>),iS'); |
| 58 | -define('BALISE_IDIOMES_ARGS', '@^\s*([^= ]*)\s*=\s*((' . NOM_DE_CHAMP . '[{][^}]*})?[^,]*)\s*,?\s*@s'); |
|
| 58 | +define('BALISE_IDIOMES_ARGS', '@^\s*([^= ]*)\s*=\s*(('.NOM_DE_CHAMP.'[{][^}]*})?[^,]*)\s*,?\s*@s'); |
|
| 59 | 59 | |
| 60 | 60 | /** Champ sql dans parenthèse ex: (id_article) */ |
| 61 | 61 | define('SQL_ARGS', '(\([^)]*\))'); |
| 62 | 62 | /** Fonction SQL sur un champ ex: SUM(visites) */ |
| 63 | -define('CHAMP_SQL_PLUS_FONC', '`?([A-Z_\/][A-Z_\/0-9.]*)' . SQL_ARGS . '?`?'); |
|
| 63 | +define('CHAMP_SQL_PLUS_FONC', '`?([A-Z_\/][A-Z_\/0-9.]*)'.SQL_ARGS.'?`?'); |
|
| 64 | 64 | |
| 65 | 65 | function phraser_inclure($texte, $ligne, $result) { |
| 66 | 66 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | * @return array |
| 216 | 216 | **/ |
| 217 | 217 | function phraser_champs($texte, $ligne, $result) { |
| 218 | - while (preg_match('/' . NOM_DE_CHAMP . '/S', $texte, $match)) { |
|
| 218 | + while (preg_match('/'.NOM_DE_CHAMP.'/S', $texte, $match)) { |
|
| 219 | 219 | $p = strpos($texte, (string) $match[0]); |
| 220 | 220 | // texte après la balise |
| 221 | 221 | $suite = substr($texte, $p + strlen($match[0])); |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | $collecte[] = $champ; |
| 364 | 364 | $args = ltrim($regs[count($regs) - 1]); |
| 365 | 365 | } else { |
| 366 | - if (!preg_match('/' . NOM_DE_CHAMP . '([{|])/', $arg, $r)) { |
|
| 366 | + if (!preg_match('/'.NOM_DE_CHAMP.'([{|])/', $arg, $r)) { |
|
| 367 | 367 | // 0 est un aveu d'impuissance. A completer |
| 368 | 368 | $arg = phraser_champs_exterieurs($arg, 0, $sep, $result); |
| 369 | 369 | |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | function phraser_champs_exterieurs($texte, $ligne, $sep, $nested) { |
| 448 | 448 | $res = []; |
| 449 | 449 | while (($p = strpos($texte, (string) "%$sep")) !== false) { |
| 450 | - if (!preg_match(',^%' . preg_quote($sep) . '([0-9]+)@,', substr($texte, $p), $m)) { |
|
| 450 | + if (!preg_match(',^%'.preg_quote($sep).'([0-9]+)@,', substr($texte, $p), $m)) { |
|
| 451 | 451 | break; |
| 452 | 452 | } |
| 453 | 453 | $debut = substr($texte, 0, $p); |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | $pos_apres = 0; |
| 488 | 488 | $result = phraser_args($match[7], ')', $sep, $result, $champ, $pos_apres); |
| 489 | 489 | phraser_vieux($champ); |
| 490 | - $champ->avant = phraser_champs_exterieurs($match[1], $n, $sep, $result); |
|
| 490 | + $champ->avant = phraser_champs_exterieurs($match[1], $n, $sep, $result); |
|
| 491 | 491 | $debut = substr($match[7], $pos_apres + 1); |
| 492 | 492 | if (!empty($debut)) { |
| 493 | 493 | $n += substr_count(substr($texte, 0, strpos($texte, $debut)), "\n"); |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | // une maniere tres sale de supprimer les "' autour de {critere "xxx","yyy"} |
| 619 | 619 | if (preg_match(',^(["\'])(.*)\1$,', $m[4])) { |
| 620 | 620 | $c = null; |
| 621 | - eval('$c = ' . $m[4] . ';'); |
|
| 621 | + eval('$c = '.$m[4].';'); |
|
| 622 | 622 | if (isset($c)) { |
| 623 | 623 | $m[4] = $c; |
| 624 | 624 | } |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | if (preg_match(',^ *([0-9-]+) *(/) *(.+) *$,', $param, $m)) { |
| 699 | 699 | $crit = phraser_critere_infixe($m[1], $m[3], $v, '/', '', ''); |
| 700 | 700 | } elseif ( |
| 701 | - preg_match(',^([!]?)(' . CHAMP_SQL_PLUS_FONC . |
|
| 701 | + preg_match(',^([!]?)('.CHAMP_SQL_PLUS_FONC. |
|
| 702 | 702 | ')[[:space:]]*(\??)(!?)(<=?|>=?|==?|\b(?:IN|LIKE)\b)(.*)$,is', $param, $m) |
| 703 | 703 | ) { |
| 704 | 704 | $a2 = trim($m[8]); |
@@ -715,8 +715,8 @@ discard block |
||
| 715 | 715 | ); |
| 716 | 716 | $crit->exclus = $m[1]; |
| 717 | 717 | } elseif ( |
| 718 | - preg_match('/^([!]?)\s*(' . |
|
| 719 | - CHAMP_SQL_PLUS_FONC . |
|
| 718 | + preg_match('/^([!]?)\s*('. |
|
| 719 | + CHAMP_SQL_PLUS_FONC. |
|
| 720 | 720 | ')\s*(\??)(.*)$/is', $param, $m) |
| 721 | 721 | ) { |
| 722 | 722 | // contient aussi les comparaisons implicites ! |
@@ -861,7 +861,7 @@ discard block |
||
| 861 | 861 | } |
| 862 | 862 | |
| 863 | 863 | // trouver sa position de depart reelle : au <Bxx> ou au <BBxx> |
| 864 | - $precond_boucle = BALISE_PRECOND_BOUCLE . $id_boucle . '>'; |
|
| 864 | + $precond_boucle = BALISE_PRECOND_BOUCLE.$id_boucle.'>'; |
|
| 865 | 865 | $pos_precond = strpos($texte, $precond_boucle, $id_boucle ? $pos_debut_texte : $pos_derniere_boucle_anonyme); |
| 866 | 866 | if ( |
| 867 | 867 | $pos_precond !== false |
@@ -872,7 +872,7 @@ discard block |
||
| 872 | 872 | $boucle['pos_precond_inside'] = $pos_precond + strlen($precond_boucle); |
| 873 | 873 | } |
| 874 | 874 | |
| 875 | - $preaff_boucle = BALISE_PREAFF_BOUCLE . $id_boucle . '>'; |
|
| 875 | + $preaff_boucle = BALISE_PREAFF_BOUCLE.$id_boucle.'>'; |
|
| 876 | 876 | $pos_preaff = strpos($texte, $preaff_boucle, $id_boucle ? $pos_debut_texte : $pos_derniere_boucle_anonyme); |
| 877 | 877 | if ( |
| 878 | 878 | $pos_preaff !== false |
@@ -920,13 +920,13 @@ discard block |
||
| 920 | 920 | $pos_anonyme_next = null; |
| 921 | 921 | // si c'est une boucle anonyme, chercher la position de la prochaine boucle anonyme |
| 922 | 922 | if (!strlen($id_boucle)) { |
| 923 | - $pos_anonyme_next = strpos($texte, BALISE_BOUCLE . '(', $pos_courante); |
|
| 923 | + $pos_anonyme_next = strpos($texte, BALISE_BOUCLE.'(', $pos_courante); |
|
| 924 | 924 | } |
| 925 | 925 | |
| 926 | 926 | // |
| 927 | 927 | // 1. Recuperer la partie conditionnelle apres |
| 928 | 928 | // |
| 929 | - $apres_boucle = BALISE_POSTCOND_BOUCLE . $id_boucle . '>'; |
|
| 929 | + $apres_boucle = BALISE_POSTCOND_BOUCLE.$id_boucle.'>'; |
|
| 930 | 930 | $pos_apres = strpos($texte, $apres_boucle, $pos_courante); |
| 931 | 931 | if ( |
| 932 | 932 | $pos_apres !== false |
@@ -935,13 +935,13 @@ discard block |
||
| 935 | 935 | $boucle['pos_postcond'] = $pos_apres; |
| 936 | 936 | $pos_apres += strlen($apres_boucle); |
| 937 | 937 | $boucle['pos_postcond_inside'] = $pos_apres; |
| 938 | - $pos_courante = $pos_apres ; |
|
| 938 | + $pos_courante = $pos_apres; |
|
| 939 | 939 | } |
| 940 | 940 | |
| 941 | 941 | // |
| 942 | 942 | // 2. Récuperer la partie alternative apres |
| 943 | 943 | // |
| 944 | - $altern_boucle = BALISE_ALT_BOUCLE . $id_boucle . '>'; |
|
| 944 | + $altern_boucle = BALISE_ALT_BOUCLE.$id_boucle.'>'; |
|
| 945 | 945 | $pos_altern = strpos($texte, $altern_boucle, $pos_courante); |
| 946 | 946 | if ( |
| 947 | 947 | $pos_altern !== false |
@@ -956,7 +956,7 @@ discard block |
||
| 956 | 956 | // |
| 957 | 957 | // 3. Recuperer la partie footer non alternative |
| 958 | 958 | // |
| 959 | - $postaff_boucle = BALISE_POSTAFF_BOUCLE . $id_boucle . '>'; |
|
| 959 | + $postaff_boucle = BALISE_POSTAFF_BOUCLE.$id_boucle.'>'; |
|
| 960 | 960 | $pos_postaff = strpos($texte, $postaff_boucle, $pos_courante); |
| 961 | 961 | if ( |
| 962 | 962 | $pos_postaff !== false |
@@ -965,7 +965,7 @@ discard block |
||
| 965 | 965 | $boucle['pos_postaff'] = $pos_postaff; |
| 966 | 966 | $pos_postaff += strlen($postaff_boucle); |
| 967 | 967 | $boucle['pos_postaff_inside'] = $pos_postaff; |
| 968 | - $pos_courante = $pos_postaff ; |
|
| 968 | + $pos_courante = $pos_postaff; |
|
| 969 | 969 | } |
| 970 | 970 | |
| 971 | 971 | return $boucle; |
@@ -1005,7 +1005,7 @@ discard block |
||
| 1005 | 1005 | * @return string |
| 1006 | 1006 | */ |
| 1007 | 1007 | function public_generer_boucle_placeholder($id_boucle, &$boucle, $boucle_placeholder, $nb_lignes) { |
| 1008 | - $placeholder = "[(#{$boucle_placeholder}{" . $id_boucle . '})' . str_pad('', $nb_lignes, "\n") . ']'; |
|
| 1008 | + $placeholder = "[(#{$boucle_placeholder}{".$id_boucle.'})'.str_pad('', $nb_lignes, "\n").']'; |
|
| 1009 | 1009 | //memoriser la boucle a reinjecter |
| 1010 | 1010 | $id_boucle = "$id_boucle"; |
| 1011 | 1011 | phraser_boucle_placeholder($id_boucle, $boucle_placeholder, $boucle); |
@@ -1018,7 +1018,7 @@ discard block |
||
| 1018 | 1018 | // definir un placholder pour les boucles dont on est sur d'avoir aucune occurence dans le squelette |
| 1019 | 1019 | if (is_null($boucle_placeholder)) { |
| 1020 | 1020 | do { |
| 1021 | - $boucle_placeholder = 'BOUCLE_PLACEHOLDER_' . strtoupper(md5(uniqid())); |
|
| 1021 | + $boucle_placeholder = 'BOUCLE_PLACEHOLDER_'.strtoupper(md5(uniqid())); |
|
| 1022 | 1022 | } while (strpos($texte, $boucle_placeholder) !== false); |
| 1023 | 1023 | } |
| 1024 | 1024 | |
@@ -1038,7 +1038,7 @@ discard block |
||
| 1038 | 1038 | |
| 1039 | 1039 | // boucle anonyme ? |
| 1040 | 1040 | if (!strlen($id_boucle)) { |
| 1041 | - $id_boucle = '_anon_L' . $ligne_milieu . '_' . substr(md5('anonyme:' . $id_parent . ':' . json_encode($boucle, JSON_THROW_ON_ERROR)), 0, 8); |
|
| 1041 | + $id_boucle = '_anon_L'.$ligne_milieu.'_'.substr(md5('anonyme:'.$id_parent.':'.json_encode($boucle, JSON_THROW_ON_ERROR)), 0, 8); |
|
| 1042 | 1042 | } |
| 1043 | 1043 | |
| 1044 | 1044 | $pos_debut_boucle = $pos_courante; |
@@ -1051,7 +1051,7 @@ discard block |
||
| 1051 | 1051 | |
| 1052 | 1052 | $pos_avant = $boucle['pos_precond_inside']; |
| 1053 | 1053 | $result->avant = substr($texte, $pos_avant, $pos_courante - $pos_avant); |
| 1054 | - $ligne_avant = $ligne_debut_texte + public_compte_ligne($texte, $pos_debut_texte, $pos_avant); |
|
| 1054 | + $ligne_avant = $ligne_debut_texte + public_compte_ligne($texte, $pos_debut_texte, $pos_avant); |
|
| 1055 | 1055 | } |
| 1056 | 1056 | |
| 1057 | 1057 | // Regarder si on a une partie inconditionnelle avant <BB_xxx> |
@@ -1060,7 +1060,7 @@ discard block |
||
| 1060 | 1060 | |
| 1061 | 1061 | $pos_preaff = $boucle['pos_preaff_inside']; |
| 1062 | 1062 | $result->preaff = substr($texte, $pos_preaff, $end_preaff - $pos_preaff); |
| 1063 | - $ligne_preaff = $ligne_debut_texte + public_compte_ligne($texte, $pos_debut_texte, $pos_preaff); |
|
| 1063 | + $ligne_preaff = $ligne_debut_texte + public_compte_ligne($texte, $pos_debut_texte, $pos_preaff); |
|
| 1064 | 1064 | } |
| 1065 | 1065 | |
| 1066 | 1066 | $result->id_boucle = $id_boucle; |
@@ -1117,7 +1117,7 @@ discard block |
||
| 1117 | 1117 | } else { |
| 1118 | 1118 | $pos_milieu += 1; |
| 1119 | 1119 | |
| 1120 | - $fin_boucle = BALISE_FIN_BOUCLE . $id_boucle_search . '>'; |
|
| 1120 | + $fin_boucle = BALISE_FIN_BOUCLE.$id_boucle_search.'>'; |
|
| 1121 | 1121 | $pos_fin = strpos($texte, $fin_boucle, $pos_milieu); |
| 1122 | 1122 | if ($pos_fin === false) { |
| 1123 | 1123 | $err_b = [ |
@@ -1130,7 +1130,7 @@ discard block |
||
| 1130 | 1130 | else { |
| 1131 | 1131 | // verifier une eventuelle imbrication d'une boucle homonyme |
| 1132 | 1132 | // (interdite, generera une erreur plus loin, mais permet de signaler la bonne erreur) |
| 1133 | - $search_debut_boucle = BALISE_BOUCLE . $id_boucle_search . '('; |
|
| 1133 | + $search_debut_boucle = BALISE_BOUCLE.$id_boucle_search.'('; |
|
| 1134 | 1134 | $search_from = $pos_milieu; |
| 1135 | 1135 | $nb_open = 1; |
| 1136 | 1136 | $nb_close = 1; |
@@ -1170,7 +1170,7 @@ discard block |
||
| 1170 | 1170 | if ($boucle['pos_postcond']) { |
| 1171 | 1171 | $result->apres = substr($texte, $pos_courante, $boucle['pos_postcond'] - $pos_courante); |
| 1172 | 1172 | $ligne_suite += public_compte_ligne($texte, $pos_courante, $boucle['pos_postcond_inside']); |
| 1173 | - $pos_courante = $boucle['pos_postcond_inside'] ; |
|
| 1173 | + $pos_courante = $boucle['pos_postcond_inside']; |
|
| 1174 | 1174 | } |
| 1175 | 1175 | |
| 1176 | 1176 | |