From 0cbc03c74f125967464a1364f7a35a99714646f6 Mon Sep 17 00:00:00 2001 From: "Committo,Ergo:sum" <esj@rezo.net> Date: Mon, 27 Jul 2009 06:02:03 +0000 Subject: [PATCH] =?UTF-8?q?Remplacement=20de=20[http://fr2.php.net/manual/?= =?UTF-8?q?fr/function.split.php=20split],=20d=C3=A9pr=C3=A9ci=C3=A9e,=20?= =?UTF-8?q?=20par=20[http://fr2.php.net/manual/fr/function.preg-split.php?= =?UTF-8?q?=20preg=5Fsplit]=20manuellement=20pour=20les=20cas=20avec=20Reg?= =?UTF-8?q?Exp,=20ou=20par=20[http://fr2.php.net/manual/fr/function.explod?= =?UTF-8?q?e.php=20explode]=20pour=20les=20autres=20cas=20par:=20{{{=20for?= =?UTF-8?q?=20i=20in=20$(grep=20-l=20"[^a-z=5F]split("=20*/*php)=20do=20se?= =?UTF-8?q?d=20's/\([^a-z=5F]\)split(/\1explode(/'=20$i=20>=20x=20mv=20x?= =?UTF-8?q?=20$i;=20done=20}}}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ecrire/action/export_all.php | 2 +- ecrire/configuration/langue.php | 2 +- ecrire/exec/rechercher.php | 2 +- ecrire/exec/rechercher_auteur.php | 2 +- ecrire/inc/auteur_infos.php | 2 +- ecrire/inc/distant.php | 2 +- ecrire/inc/editer_mots.php | 2 +- ecrire/inc/filtres.php | 8 ++++---- ecrire/inc/utils.php | 2 +- ecrire/public/criteres.php | 2 +- ecrire/public/jointures.php | 2 +- ecrire/req/pg.php | 2 +- 12 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ecrire/action/export_all.php b/ecrire/action/export_all.php index 7b59718746..a350f94cc9 100644 --- a/ecrire/action/export_all.php +++ b/ecrire/action/export_all.php @@ -21,7 +21,7 @@ function action_export_all_dist() $securiser_action = charger_fonction('securiser_action', 'inc'); $arg = $securiser_action(); - @list($quoi, $gz, $archive, $rub, $version) = split(',', $arg); + @list($quoi, $gz, $archive, $rub, $version) = explode(',', $arg); $meta = "status_dump_$rub_" . $GLOBALS['visiteur_session']['id_auteur']; $tables = _request('export'); // determine upload va aussi initialiser l'index "restreint" diff --git a/ecrire/configuration/langue.php b/ecrire/configuration/langue.php index cdcee076e4..355129f1a1 100644 --- a/ecrire/configuration/langue.php +++ b/ecrire/configuration/langue.php @@ -25,7 +25,7 @@ function configuration_langue_dist() $res = "<option value='$l_site' selected='selected'>$langue_site</option>\n"; - foreach (split(",",$GLOBALS['meta']['langues_proposees']) as $l) { + foreach (explode(",",$GLOBALS['meta']['langues_proposees']) as $l) { if ($l <> $l_site) $res .= "<option value='$l'>".traduire_nom_langue($l)."</option>\n"; } diff --git a/ecrire/exec/rechercher.php b/ecrire/exec/rechercher.php index dd8fef5eff..c1772defd2 100644 --- a/ecrire/exec/rechercher.php +++ b/ecrire/exec/rechercher.php @@ -34,7 +34,7 @@ function exec_rechercher_args($id, $type, $exclus, $rac, $do) { if (!$do) $do = 'aff'; - $where = split("[[:space:]]+", $type); + $where = preg_split("\s+", $type); if ($where) { foreach ($where as $k => $v) $where[$k] = "'%" . substr(str_replace("%","\%", sql_quote($v)),1,-1) . "%'"; diff --git a/ecrire/exec/rechercher_auteur.php b/ecrire/exec/rechercher_auteur.php index b5cbad44ec..a935839de7 100644 --- a/ecrire/exec/rechercher_auteur.php +++ b/ecrire/exec/rechercher_auteur.php @@ -29,7 +29,7 @@ function exec_rechercher_auteur_args($idom) echo minipres(); } else { include_spip('inc/actions'); - $where = split("[[:space:]]+", _request('nom')); + $where = preg_split("\s+", _request('nom')); if ($where) { foreach ($where as $k => $v) $where[$k] = "'%" . substr(str_replace("%","\%", sql_quote($v)),1,-1) . "%'"; diff --git a/ecrire/inc/auteur_infos.php b/ecrire/inc/auteur_infos.php index 957942f791..880bc522a1 100644 --- a/ecrire/inc/auteur_infos.php +++ b/ecrire/inc/auteur_infos.php @@ -88,7 +88,7 @@ function inc_auteur_infos_dist($auteur, $new, $echec, $edit, $id_article, $redir // http://doc.spip.org/@afficher_erreurs_auteur function afficher_erreurs_auteur($echec) { - foreach (split('@@@',$echec) as $e) + foreach (explode('@@@',$echec) as $e) $corps .= '<p>' . _T($e) . "</p>\n"; $corps = debut_cadre_relief('', true) diff --git a/ecrire/inc/distant.php b/ecrire/inc/distant.php index 5219f261b3..5ede9b5b07 100644 --- a/ecrire/inc/distant.php +++ b/ecrire/inc/distant.php @@ -441,7 +441,7 @@ function recuperer_infos_distantes($source, $max=0, $charger_si_petite_image = t // de maniere a attrapper le maximum d'infos (titre, taille, etc). Si // ca echoue l'utilisateur devra les entrer... if ($headers = recuperer_page($source, false, true, $max)) { - list($headers, $a['body']) = split("\n\n", $headers, 2); + list($headers, $a['body']) = explode("\n\n", $headers, 2); if (preg_match(",\nContent-Type: *([^[:space:];]*),i", "\n$headers", $regs)) $mime_type = (trim($regs[1])); diff --git a/ecrire/inc/editer_mots.php b/ecrire/inc/editer_mots.php index f06e2e1f66..7f41c7a514 100644 --- a/ecrire/inc/editer_mots.php +++ b/ecrire/inc/editer_mots.php @@ -121,7 +121,7 @@ function recherche_mot_cle($cherche_mots, $id_groupe, $objet, $id_objet, $table, $nouveaux_mots = array(); $res = ''; - foreach (split(" *[,;] *", $cherche_mots) as $cherche_mot) { + foreach (preg_split(" *[,;] *", $cherche_mots) as $cherche_mot) { if ($cherche_mot) { $resultat = mots_ressemblants($cherche_mot, $table_mots, $table_ids); $res .= "<br />" . debut_boite_info(true); diff --git a/ecrire/inc/filtres.php b/ecrire/inc/filtres.php index 673cf69086..57830a11fe 100644 --- a/ecrire/inc/filtres.php +++ b/ecrire/inc/filtres.php @@ -71,21 +71,21 @@ function filtre_text_csv_dist($t) str_replace("\n", "<br />", substr($cell,1,-1))), $t); - list($entete, $corps) = split("\n",$t,2); + list($entete, $corps) = explode("\n",$t,2); $caption = ''; // sauter la ligne de tete formee seulement de separateurs if (substr_count($entete, $sep) == strlen($entete)) { - list($entete, $corps) = split("\n",$corps,2); + list($entete, $corps) = explode("\n",$corps,2); } // si une seule colonne, en faire le titre if (preg_match("/^([^$sep]+)$sep+\$/", $entete, $l)) { $caption = "\n||" . $l[1] . "|"; - list($entete, $corps) = split("\n",$corps,2); + list($entete, $corps) = explode("\n",$corps,2); } // si premiere colonne vide, le raccourci doit quand meme produire <th... if ($entete[0] == $sep) $entete = ' ' . $entete; - $lignes = split("\n", $corps); + $lignes = explode("\n", $corps); // retrait des lignes vides finales while(preg_match("/^$sep*$/", $lignes[count($lignes)-1])) unset($lignes[count($lignes)-1]); diff --git a/ecrire/inc/utils.php b/ecrire/inc/utils.php index 62b361a035..b1bbfefa84 100644 --- a/ecrire/inc/utils.php +++ b/ecrire/inc/utils.php @@ -971,7 +971,7 @@ function generer_url_ecrire($script='', $args="", $no_entities=false, $rel=false $rel = _DIR_RESTREINT ? _DIR_RESTREINT : ('./' . _SPIP_ECRIRE_SCRIPT); - @list($script, $ancre) = split('#', $script); + @list($script, $ancre) = explode('#', $script); if ($script AND ($script<>'accueil' OR $rel)) $args = "?exec=$script" . (!$args ? '' : "&$args"); elseif ($args) diff --git a/ecrire/public/criteres.php b/ecrire/public/criteres.php index 91a5ab443e..0c4bde8a08 100644 --- a/ecrire/public/criteres.php +++ b/ecrire/public/criteres.php @@ -1101,7 +1101,7 @@ function calculer_vieux_in($params) if ($v[0]->type != 'texte') $newp[] = $v; else { - foreach(split(',', $v[0]->texte) as $x) { + foreach(explode(',', $v[0]->texte) as $x) { $t = new Texte; $t->texte = $x; $newp[] = array($t); diff --git a/ecrire/public/jointures.php b/ecrire/public/jointures.php index 919f7bf6d5..daf9809a53 100644 --- a/ecrire/public/jointures.php +++ b/ecrire/public/jointures.php @@ -280,7 +280,7 @@ function trouver_cles_table($keys) if (!strpos($v,",")) $res[$v]=1; else { - foreach (split(" *, *", $v) as $k) { + foreach (preg_split("\s*,\s*", $v) as $k) { $res[$k]=1; } } diff --git a/ecrire/req/pg.php b/ecrire/req/pg.php index d4499a3779..9b8fa0ff58 100644 --- a/ecrire/req/pg.php +++ b/ecrire/req/pg.php @@ -32,7 +32,7 @@ function req_pg_dist($addr, $port, $login, $pass, $db='', $prefixe='', $ldap='') $$a = $last_connect[$a]; } } - @list($host, $p) = split(';', $addr); + @list($host, $p) = explode(';', $addr); if ($p >0) $port = " port=$p" ; else $port = ''; if ($db) { @$link = pg_connect("host=$host$port dbname=$db user=$login password=$pass", PGSQL_CONNECT_FORCE_NEW); -- GitLab