From 838645463d83ea82f74bddbe1af780b3c875ed06 Mon Sep 17 00:00:00 2001 From: Loic d'Anterroches Date: Thu, 24 Sep 2009 20:40:22 +0200 Subject: [PATCH] Remove the PHP 5.3 deprecated split function. --- src/IDF/Diff.php | 4 ++-- src/IDF/Form/PasswordInputKey.php | 2 +- src/IDF/Form/RegisterInputKey.php | 2 +- src/IDF/Form/UserChangeEmail.php | 2 +- src/IDF/Precondition.php | 2 +- src/IDF/Project.php | 4 ++-- src/IDF/Scm/Cache/Git.php | 2 +- src/IDF/Scm/Git.php | 6 +++--- src/IDF/Scm/Mercurial.php | 2 +- src/IDF/Scm/Svn.php | 4 ++-- src/IDF/Views/Admin.php | 4 ++-- src/IDF/Views/Download.php | 2 +- src/IDF/Views/Issue.php | 2 +- src/IDF/Views/Source.php | 6 +++--- src/IDF/Views/Wiki.php | 2 +- 15 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/IDF/Diff.php b/src/IDF/Diff.php index 508e048..817885d 100644 --- a/src/IDF/Diff.php +++ b/src/IDF/Diff.php @@ -187,10 +187,10 @@ class IDF_Diff */ public static function getChunk($line) { - $elts = split(' ', $line); + $elts = explode(' ', $line); $res = array(); for ($i=1;$i<3;$i++) { - $res[] = split(',', trim(substr($elts[$i], 1))); + $res[] = explode(',', trim(substr($elts[$i], 1))); } return $res; } diff --git a/src/IDF/Form/PasswordInputKey.php b/src/IDF/Form/PasswordInputKey.php index 23f7c02..1dfc430 100644 --- a/src/IDF/Form/PasswordInputKey.php +++ b/src/IDF/Form/PasswordInputKey.php @@ -95,7 +95,7 @@ class IDF_Form_PasswordInputKey extends Pluf_Form return false; } $cr = new Pluf_Crypt(md5(Pluf::f('secret_key'))); - $f = split(':', $cr->decrypt($encrypted), 3); + $f = explode(':', $cr->decrypt($encrypted), 3); if (count($f) != 3) { return false; } diff --git a/src/IDF/Form/RegisterInputKey.php b/src/IDF/Form/RegisterInputKey.php index 658291b..a7440e3 100644 --- a/src/IDF/Form/RegisterInputKey.php +++ b/src/IDF/Form/RegisterInputKey.php @@ -91,6 +91,6 @@ class IDF_Form_RegisterInputKey extends Pluf_Form return false; } $cr = new Pluf_Crypt(md5(Pluf::f('secret_key'))); - return split(':', $cr->decrypt($encrypted), 2); + return explode(':', $cr->decrypt($encrypted), 2); } } diff --git a/src/IDF/Form/UserChangeEmail.php b/src/IDF/Form/UserChangeEmail.php index ddb7ac9..c9175bd 100644 --- a/src/IDF/Form/UserChangeEmail.php +++ b/src/IDF/Form/UserChangeEmail.php @@ -63,7 +63,7 @@ class IDF_Form_UserChangeEmail extends Pluf_Form throw new Pluf_Form_Invalid(__('The validation key is not valid. Please copy/paste it from your confirmation email.')); } $cr = new Pluf_Crypt(md5(Pluf::f('secret_key'))); - return split(':', $cr->decrypt($encrypted), 3); + return explode(':', $cr->decrypt($encrypted), 3); } diff --git a/src/IDF/Precondition.php b/src/IDF/Precondition.php index a52b670..fe290b7 100644 --- a/src/IDF/Precondition.php +++ b/src/IDF/Precondition.php @@ -230,7 +230,7 @@ class IDF_Precondition return true; // no match in the hash, anonymous } $cr = new Pluf_Crypt(md5(Pluf::f('secret_key'))); - list($userid, $projectid) = split(':', $cr->decrypt($encrypted), 2); + list($userid, $projectid) = explode(':', $cr->decrypt($encrypted), 2); if ($projectid != $request->project->id) { return true; // anonymous } diff --git a/src/IDF/Project.php b/src/IDF/Project.php index cdef2e6..f30814b 100644 --- a/src/IDF/Project.php +++ b/src/IDF/Project.php @@ -210,9 +210,9 @@ class IDF_Project extends Pluf_Model $conf = $this->getConf(); $tags = array(); foreach (preg_split("/\015\012|\015|\012/", $conf->getVal($cfg_key, $default), -1, PREG_SPLIT_NO_EMPTY) as $s) { - $_s = split('=', $s, 2); + $_s = explode('=', $s, 2); $v = trim($_s[0]); - $_v = split(':', $v, 2); + $_v = explode(':', $v, 2); if (count($_v) > 1) { $class = trim($_v[0]); $name = trim($_v[1]); diff --git a/src/IDF/Scm/Cache/Git.php b/src/IDF/Scm/Cache/Git.php index 2eebc2a..4e9fe7e 100644 --- a/src/IDF/Scm/Cache/Git.php +++ b/src/IDF/Scm/Cache/Git.php @@ -84,7 +84,7 @@ class IDF_Scm_Cache_Git extends Pluf_Model $sql = new Pluf_SQL('project=%s AND githash IN ('.implode(', ', $hashes).')', array($this->_project->id)); foreach (Pluf::factory(__CLASS__)->getList(array('filter' => $sql->gen())) as $blob) { - $tmp = split(chr(31), $blob->content, 3); + $tmp = explode(chr(31), $blob->content, 3); $res[$blob->githash] = (object) array( 'hash' => $blob->githash, diff --git a/src/IDF/Scm/Git.php b/src/IDF/Scm/Git.php index 89c7dfb..42570f5 100644 --- a/src/IDF/Scm/Git.php +++ b/src/IDF/Scm/Git.php @@ -45,7 +45,7 @@ class IDF_Scm_Git extends IDF_Scm { $cmd = Pluf::f('idf_exec_cmd_prefix', '').'du -skD ' .escapeshellarg($this->repo); - $out = split(' ', shell_exec($cmd), 2); + $out = explode(' ', shell_exec($cmd), 2); return (int) $out[0]*1024; } @@ -671,10 +671,10 @@ class IDF_Scm_Git extends IDF_Scm if (false === $data) { return $res; } - $data = split(chr(30), $data); + $data = explode(chr(30), $data); foreach ($data as $rec) { if (isset($hashes[substr($rec, 0, 40)])) { - $tmp = split(chr(31), substr($rec, 40), 3); + $tmp = explode(chr(31), substr($rec, 40), 3); $res[substr($rec, 0, 40)] = (object) array('hash' => substr($rec, 0, 40), 'date' => $tmp[0], diff --git a/src/IDF/Scm/Mercurial.php b/src/IDF/Scm/Mercurial.php index e20e73c..5b83150 100644 --- a/src/IDF/Scm/Mercurial.php +++ b/src/IDF/Scm/Mercurial.php @@ -37,7 +37,7 @@ class IDF_Scm_Mercurial extends IDF_Scm { $cmd = Pluf::f('idf_exec_cmd_prefix', '').'du -skD ' .escapeshellarg($this->repo); - $out = split(' ', shell_exec($cmd), 2); + $out = explode(' ', shell_exec($cmd), 2); return (int) $out[0]*1024; } diff --git a/src/IDF/Scm/Svn.php b/src/IDF/Scm/Svn.php index 2100d98..e7879fc 100644 --- a/src/IDF/Scm/Svn.php +++ b/src/IDF/Scm/Svn.php @@ -58,7 +58,7 @@ class IDF_Scm_Svn extends IDF_Scm } $cmd = Pluf::f('idf_exec_cmd_prefix', '').'du -skD ' .escapeshellarg(substr($this->repo, 7)); - $out = split(' ', shell_exec($cmd), 2); + $out = explode(' ', shell_exec($cmd), 2); return (int) $out[0]*1024; } @@ -435,7 +435,7 @@ class IDF_Scm_Svn extends IDF_Scm $log = array(); $log['author'] = (string) $entry->author; $log['date'] = gmdate('Y-m-d H:i:s', strtotime((string) $entry->date)); - $split = split("[\n\r]", (string) $entry->msg, 2); + $split = explode("[\n\r]", (string) $entry->msg, 2); $log['title'] = $split[0]; $log['commit'] = (string) $entry['revision']; $log['full_message'] = (isset($split[1])) ? trim($split[1]) : ''; diff --git a/src/IDF/Views/Admin.php b/src/IDF/Views/Admin.php index ec742cb..8ab3ddc 100644 --- a/src/IDF/Views/Admin.php +++ b/src/IDF/Views/Admin.php @@ -321,11 +321,11 @@ function IDF_Views_Admin_getForgeSize() } $cmd = Pluf::f('idf_exec_cmd_prefix', '').'du -sk ' .escapeshellarg(Pluf::f('upload_path')); - $out = split(' ', shell_exec($cmd), 2); + $out = explode(' ', shell_exec($cmd), 2); $res['downloads'] = $out[0]*1024; $cmd = Pluf::f('idf_exec_cmd_prefix', '').'du -sk ' .escapeshellarg(Pluf::f('upload_issue_path')); - $out = split(' ', shell_exec($cmd), 2); + $out = explode(' ', shell_exec($cmd), 2); $res['attachments'] = $out[0]*1024; $res['database'] = IDF_Views_Admin_getForgeDbSize(); $res['total'] = $res['repositories'] + $res['downloads'] + $res['attachments'] + $res['database']; diff --git a/src/IDF/Views/Download.php b/src/IDF/Views/Download.php index 072188a..8af4249 100644 --- a/src/IDF/Views/Download.php +++ b/src/IDF/Views/Download.php @@ -231,7 +231,7 @@ class IDF_Views_Download foreach ($st as $s) { $v = ''; $d = ''; - $_s = split('=', $s, 2); + $_s = explode('=', $s, 2); if (count($_s) > 1) { $v = trim($_s[0]); $d = trim($_s[1]); diff --git a/src/IDF/Views/Issue.php b/src/IDF/Views/Issue.php index 79789b2..596792a 100644 --- a/src/IDF/Views/Issue.php +++ b/src/IDF/Views/Issue.php @@ -563,7 +563,7 @@ class IDF_Views_Issue foreach ($st as $s) { $v = ''; $d = ''; - $_s = split('=', $s, 2); + $_s = explode('=', $s, 2); if (count($_s) > 1) { $v = trim($_s[0]); $d = trim($_s[1]); diff --git a/src/IDF/Views/Source.php b/src/IDF/Views/Source.php index 3b00927..2b1a979 100644 --- a/src/IDF/Views/Source.php +++ b/src/IDF/Views/Source.php @@ -226,7 +226,7 @@ class IDF_Views_Source $cache->set($key, $res); } // try to find the previous level if it exists. - $prev = split('/', $request_file); + $prev = explode('/', $request_file); $l = array_pop($prev); $previous = substr($request_file, 0, -strlen($l.' ')); $scmConf = $request->conf->getVal('scm', 'git'); @@ -250,7 +250,7 @@ class IDF_Views_Source public static function makeBreadCrumb($project, $commit, $file, $sep='/') { - $elts = split('/', $file); + $elts = explode('/', $file); $out = array(); $stack = ''; $i = 0; @@ -346,7 +346,7 @@ class IDF_Views_Source $cobject = $scm->getCommit($commit); $in_branches = $scm->inBranches($commit, $request_file); // try to find the previous level if it exists. - $prev = split('/', $request_file); + $prev = explode('/', $request_file); $l = array_pop($prev); $previous = substr($request_file, 0, -strlen($l.' ')); $scmConf = $request->conf->getVal('scm', 'git'); diff --git a/src/IDF/Views/Wiki.php b/src/IDF/Views/Wiki.php index 22a9ff1..97f13b1 100644 --- a/src/IDF/Views/Wiki.php +++ b/src/IDF/Views/Wiki.php @@ -397,7 +397,7 @@ class IDF_Views_Wiki foreach ($st as $s) { $v = ''; $d = ''; - $_s = split('=', $s, 2); + $_s = explode('=', $s, 2); if (count($_s) > 1) { $v = trim($_s[0]); $d = trim($_s[1]);