From 7785dc2e9f717b471b4711648a180523b4eb0352 Mon Sep 17 00:00:00 2001 From: Jonathan Harker Date: Tue, 20 Jul 2010 01:38:54 +0000 Subject: [PATCH] lib, auth, webservice: MDL-20876 fix deprecated split() calls. --- auth/imap/auth.php | 2 +- auth/nntp/auth.php | 2 +- auth/pop3/auth.php | 2 +- auth/shibboleth/README.txt | 2 +- auth/shibboleth/auth.php | 8 ++++---- lib/componentlib.class.php | 2 +- lib/datalib.php | 2 +- lib/form/selectgroups.php | 2 +- lib/memcached.class.php | 2 +- lib/moodlelib.php | 2 +- webservice/amf/locallib.php | 2 +- webservice/lib.php | 2 +- 12 files changed, 15 insertions(+), 15 deletions(-) diff --git a/auth/imap/auth.php b/auth/imap/auth.php index ef4d38265f3..5bc22ead195 100644 --- a/auth/imap/auth.php +++ b/auth/imap/auth.php @@ -46,7 +46,7 @@ class auth_plugin_imap extends auth_plugin_base { } global $CFG; - $hosts = split(';', $this->config->host); // Could be multiple hosts + $hosts = explode(';', $this->config->host); // Could be multiple hosts foreach ($hosts as $host) { // Try each host in turn $host = trim($host); diff --git a/auth/nntp/auth.php b/auth/nntp/auth.php index de0aa4ee1a3..495b5055335 100644 --- a/auth/nntp/auth.php +++ b/auth/nntp/auth.php @@ -48,7 +48,7 @@ class auth_plugin_nntp extends auth_plugin_base { global $CFG; // try each multiple host - $hosts = split(';', $this->config->host); + $hosts = explode(';', $this->config->host); foreach ($hosts as $host) { $host = '{' . trim($host) . ':' . $this->config->port . '/nntp}'; diff --git a/auth/pop3/auth.php b/auth/pop3/auth.php index 1559d22466d..2becd4359ea 100644 --- a/auth/pop3/auth.php +++ b/auth/pop3/auth.php @@ -46,7 +46,7 @@ class auth_plugin_pop3 extends auth_plugin_base { } global $CFG; - $hosts = split(';', $this->config->host); // Could be multiple hosts + $hosts = explode(';', $this->config->host); // Could be multiple hosts foreach ($hosts as $host) { // Try each host in turn $host = trim($host); diff --git a/auth/shibboleth/README.txt b/auth/shibboleth/README.txt index 038401b20ae..bb8f9fc82c6 100644 --- a/auth/shibboleth/README.txt +++ b/auth/shibboleth/README.txt @@ -212,7 +212,7 @@ Example file: // We want to split this up to get: // institution, street, zipcode, city and country $address = $_SERVER[$this->config->field_map_address]; - list($institution, $street, $zip_city) = split('\$', $address); + list($institution, $street, $zip_city) = explode('$', $address); ereg(' (.+)',$zip_city, $regs); $city = $regs[1]; diff --git a/auth/shibboleth/auth.php b/auth/shibboleth/auth.php index 3e557ed3605..d5062bcecd8 100644 --- a/auth/shibboleth/auth.php +++ b/auth/shibboleth/auth.php @@ -319,7 +319,7 @@ class auth_plugin_shibboleth extends auth_plugin_base { * @param string $string Possibly multi-valued attribute from Shibboleth */ function get_first_string($string) { - $list = split( ';', $string); + $list = explode( ';', $string); $clean_string = rtrim($list[0]); return $clean_string; @@ -384,10 +384,10 @@ class auth_plugin_shibboleth extends auth_plugin_base { function get_idp_list($organization_selection) { $idp_list = array(); - $idp_raw_list = split("\n", $organization_selection); + $idp_raw_list = explode("\n", $organization_selection); foreach ($idp_raw_list as $idp_line){ - $idp_data = split(',', $idp_line); + $idp_data = explode(',', $idp_line); if (isset($idp_data[2])) { $idp_list[trim($idp_data[0])] = array(trim($idp_data[1]),trim($idp_data[2])); @@ -410,7 +410,7 @@ class auth_plugin_shibboleth extends auth_plugin_base { function generate_cookie_array($value) { // Decodes and splits cookie value - $CookieArray = split(' ', $value); + $CookieArray = explode(' ', $value); $CookieArray = array_map('base64_decode', $CookieArray); return $CookieArray; diff --git a/lib/componentlib.class.php b/lib/componentlib.class.php index 96dd841f70e..19ce9d1e2a9 100644 --- a/lib/componentlib.class.php +++ b/lib/componentlib.class.php @@ -486,7 +486,7 @@ class component_installer { $lines=preg_split('/\r?\n/',$contents); /// Each line will be one component foreach($lines as $line) { - $availablecomponents[] = split(',', $line); + $availablecomponents[] = explode(',', $line); } /// If no components have been found, return error if (empty($availablecomponents)) { diff --git a/lib/datalib.php b/lib/datalib.php index 4f5b9b75f6f..ecdfa1cc4d3 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -598,7 +598,7 @@ function get_courses_wmanagers($categoryid=0, $sort="c.sortorder ASC", $fields=a return $courses; } - $managerroles = split(',', $CFG->coursecontact); + $managerroles = explode(',', $CFG->coursecontact); $catctxids = ''; if (count($managerroles)) { if ($allcats === true) { diff --git a/lib/form/selectgroups.php b/lib/form/selectgroups.php index 583851006c6..01ee9ed3336 100644 --- a/lib/form/selectgroups.php +++ b/lib/form/selectgroups.php @@ -101,7 +101,7 @@ class MoodleQuickForm_selectgroups extends HTML_QuickForm_element { function setSelected($values) { if (is_string($values) && $this->getMultiple()) { - $values = split("[ ]?,[ ]?", $values); + $values = preg_split("/[ ]?,[ ]?/", $values); } if (is_array($values)) { $this->_values = array_values($values); diff --git a/lib/memcached.class.php b/lib/memcached.class.php index ea7bc7c8909..12770d2b33b 100644 --- a/lib/memcached.class.php +++ b/lib/memcached.class.php @@ -51,7 +51,7 @@ class memcached { } $this->_cache = new Memcache; - $hosts = split(',', $CFG->memcachedhosts); + $hosts = explode(',', $CFG->memcachedhosts); if (count($hosts) === 1 && !empty($CFG->memcachedpconn)) { // the faster pconnect is only available // for single-server setups diff --git a/lib/moodlelib.php b/lib/moodlelib.php index c54dfbbe0b9..daf9497ccce 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -6442,7 +6442,7 @@ function get_string($identifier, $component = '', $a = NULL) { if (strpos($component, '/') !== false) { debugging('The module name you passed to get_string is the deprecated format ' . 'like mod/mymod or block/myblock. The correct form looks like mymod, or block_myblock.' , DEBUG_DEVELOPER); - $componentpath = split('/', $component); + $componentpath = explode('/', $component); switch ($componentpath[0]) { case 'mod': diff --git a/webservice/amf/locallib.php b/webservice/amf/locallib.php index 7e4cbb15a50..2716027f1d1 100644 --- a/webservice/amf/locallib.php +++ b/webservice/amf/locallib.php @@ -64,7 +64,7 @@ class webservice_amf_server extends webservice_zend_server { //cast the param from object to array (validate_parameters except array only) $castingcode = ''; if ($params){ - $paramstocast = split(',', $params); + $paramstocast = explode(',', $params); foreach ($paramstocast as $paramtocast) { $paramtocast = trim($paramtocast); $castingcode .= $paramtocast . diff --git a/webservice/lib.php b/webservice/lib.php index 56d6bd0928a..7aea81c5880 100644 --- a/webservice/lib.php +++ b/webservice/lib.php @@ -730,7 +730,7 @@ class '.$classname.' { //cast the param from object to array (validate_parameters except array only) $castingcode = ''; if ($params){ - $paramstocast = split(',', $params); + $paramstocast = explode(',', $params); foreach ($paramstocast as $paramtocast) { //clean the parameter from any white space $paramtocast = trim($paramtocast);