Skip to content

Commit

Permalink
lib: MDL-20876 third-party libs - fix deprecated split() calls.
Browse files Browse the repository at this point in the history
Author: Jonathan Harker <[email protected]>
  • Loading branch information
doctorlard committed Jul 20, 2010
1 parent fcbf4b6 commit bed733c
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion lib/alfresco/Service/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function getStore($address, $scheme="workspace")
*/
public function getStoreFromString($value)
{
list($scheme, $address) = split("://", $value);
list($scheme, $address) = explode("://", $value);
return new Store($this, $address, $scheme);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/base32.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function base32_encode ($inString)
}

/* Create an array by chunking it every 5 chars */
$fiveBitsArray = split("\n",rtrim(chunk_split($compBits, 5, "\n")));
$fiveBitsArray = explode("\n",rtrim(chunk_split($compBits, 5, "\n")));

/* Look-up each chunk and add it to $outstring */
foreach($fiveBitsArray as $fiveBitsString) {
Expand Down
6 changes: 3 additions & 3 deletions lib/excel/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -538,10 +538,10 @@ function _convert_range2d($range)

// Split the range into 2 cell refs
if(preg_match("/^([A-I]?[A-Z])(\d+)\:([A-I]?[A-Z])(\d+)$/",$range)) {
list($cell1, $cell2) = split(':', $range);
list($cell1, $cell2) = explode(':', $range);
}
elseif(preg_match("/^([A-I]?[A-Z])(\d+)\.\.([A-I]?[A-Z])(\d+)$/",$range)) {
list($cell1, $cell2) = split('\.\.', $range);
list($cell1, $cell2) = explode('..', $range);
}
else {
die("Unknown range separator");
Expand Down Expand Up @@ -993,4 +993,4 @@ function to_reverse_polish($tree = array())
return $polish;
}
}
?>
?>
14 changes: 7 additions & 7 deletions lib/excel/Worksheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ function _cell_to_rowcol($cell)
$row = $match[2];

// Convert base26 column string to number
$chars = split('', $col);
$chars = str_split($col);
$expn = 0;
$col = 0;

Expand Down Expand Up @@ -1530,13 +1530,13 @@ function _write_url_external($row1, $col1, $row2, $col2, $url, $str, $format = 0
// Determine if the link contains a sheet reference and change some of the
// parameters accordingly.
// Split the dir name and sheet name (if it exists)
list($dir_long , $sheet) = split('/\#/', $url);
list($dir_long , $sheet) = explode('/#/', $url);
$link_type = 0x01 | $absolute;

if (isset($sheet)) {
$link_type |= 0x08;
$sheet_len = pack("V", strlen($sheet) + 0x01);
$sheet = join("\0", split('', $sheet));
$sheet = join("\0", str_split($sheet));
$sheet .= "\0\0\0";
}
else {
Expand All @@ -1555,7 +1555,7 @@ function _write_url_external($row1, $col1, $row2, $col2, $url, $str, $format = 0
$dir_short = preg_replace('/\.\.\\/', '', $dir_long) . "\0";

// Store the long dir name as a wchar string (non-null terminated)
$dir_long = join("\0", split('', $dir_long));
$dir_long = join("\0", str_split($dir_long));
$dir_long = $dir_long . "\0";

// Pack the lengths of the dir strings
Expand Down Expand Up @@ -1644,7 +1644,7 @@ function _write_url_external($row1, $col1, $row2, $col2, $url, $str, $format = 0
if (defined $sheet) {
$link_type |= 0x08;
$sheet_len = pack("V", length($sheet) + 0x01);
$sheet = join("\0", split('', $sheet));
$sheet = join("\0", str_split($sheet));
$sheet .= "\0\0\0";
}
else {
Expand All @@ -1665,7 +1665,7 @@ function _write_url_external($row1, $col1, $row2, $col2, $url, $str, $format = 0
# Store the long dir name as a wchar string (non-null terminated)
$dir_long = join("\0", split('', $dir_long));
$dir_long = join("\0", str_split($dir_long));
$dir_long = $dir_long . "\0";
Expand Down Expand Up @@ -2832,4 +2832,4 @@ function _store_zoom()
$this->_append($header.$data);
}
}
?>
?>
6 changes: 3 additions & 3 deletions lib/geoip/geoipcity.inc
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ class geoipdnsrecord {

function getrecordwithdnsservice($str){
$record = new geoipdnsrecord;
$keyvalue = split(";",$str);
$keyvalue = explode(";",$str);
foreach ($keyvalue as $keyvalue2){
list($key,$value) = split("=",$keyvalue2);
list($key,$value) = explode("=",$keyvalue2);
if ($key == "co"){
$record->country_code = $value;
}
Expand Down Expand Up @@ -214,4 +214,4 @@ function GeoIP_record_by_addr ($gi,$addr){
return _get_record($gi, $ipnum);
}

?>
?>
4 changes: 2 additions & 2 deletions lib/jabber/XMPP/Roster.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function isContact($jid) {
* @param string $status
*/
public function setPresence($presence, $priority, $show, $status) {
list($jid, $resource) = split("/", $presence);
list($jid, $resource) = explode("/", $presence);
if ($show != 'unavailable') {
if (!$this->isContact($jid)) {
$this->addContact($jid, 'not-in-roster');
Expand All @@ -137,7 +137,7 @@ public function setPresence($presence, $priority, $show, $status) {
* @param string $jid
*/
public function getPresence($jid) {
$split = split("/", $jid);
$split = explode("/", $jid);
$jid = $split[0];
if($this->isContact($jid)) {
$current = array('resource' => '', 'active' => '', 'priority' => -129, 'show' => '', 'status' => ''); //Priorities can only be -128 = 127
Expand Down
2 changes: 1 addition & 1 deletion lib/jabber/XMPP/XMLStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public function addXPathHandler($xpath, $pointer, $obj = null) {
$ns_tags = array($xpath);
}
foreach($ns_tags as $ns_tag) {
list($l, $r) = split("}", $ns_tag);
list($l, $r) = explode("}", $ns_tag);
if ($r != null) {
$xpart = array(substr($l, 1), $r);
} else {
Expand Down
8 changes: 4 additions & 4 deletions lib/simpletestlib/http.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ function SimpleHttpHeaders($headers) {
$this->_cookies = array();
$this->_authentication = false;
$this->_realm = false;
foreach (split("\r\n", $headers) as $header_line) {
foreach (explode("\r\n", $headers) as $header_line) {
$this->_parseHeaderLine($header_line);
}
}
Expand Down Expand Up @@ -457,7 +457,7 @@ function _parseHeaderLine($header_line) {
* @access private
*/
function _parseCookie($cookie_line) {
$parts = split(";", $cookie_line);
$parts = explode(";", $cookie_line);
$cookie = array();
preg_match('/\s*(.*?)\s*=(.*)/', array_shift($parts), $cookie);
foreach ($parts as $part) {
Expand Down Expand Up @@ -521,7 +521,7 @@ function _parse($raw) {
$this->_setError('Could not split headers from content');
$this->_headers = new SimpleHttpHeaders($raw);
} else {
list($headers, $this->_content) = split("\r\n\r\n", $raw, 2);
list($headers, $this->_content) = explode("\r\n\r\n", $raw, 2);
$this->_headers = new SimpleHttpHeaders($headers);
}
}
Expand Down Expand Up @@ -621,4 +621,4 @@ function _isLastPacket($packet) {
return ! $packet;
}
}
?>
?>
6 changes: 3 additions & 3 deletions lib/simpletestlib/url.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function _chompLogin(&$url) {
}
if (preg_match('/^([^\/]*)@(.*)/', $url, $matches)) {
$url = $prefix . $matches[2];
$parts = split(":", $matches[1]);
$parts = explode(":", $matches[1]);
return array(
urldecode($parts[0]),
isset($parts[1]) ? urldecode($parts[1]) : false);
Expand Down Expand Up @@ -184,7 +184,7 @@ function _chompRequest(&$url) {
function _parseRequest($raw) {
$this->_raw = $raw;
$request = new SimpleGetEncoding();
foreach (split("&", $raw) as $pair) {
foreach (explode("&", $raw) as $pair) {
if (preg_match('/(.*?)=(.*)/', $pair, $matches)) {
$request->add($matches[1], urldecode($matches[2]));
} elseif ($pair) {
Expand Down Expand Up @@ -525,4 +525,4 @@ function getAllTopLevelDomains() {
return 'com|edu|net|org|gov|mil|int|biz|info|name|pro|aero|coop|museum';
}
}
?>
?>
6 changes: 3 additions & 3 deletions lib/simpletestlib/web_tester.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function test($compare) {
* @access protected
*/
function _findHeader($compare) {
$lines = split("\r\n", $compare);
$lines = explode("\r\n", $compare);
foreach ($lines as $line) {
if ($this->_testHeaderLine($line)) {
return $line;
Expand All @@ -206,7 +206,7 @@ function _findHeader($compare) {
* @access private
*/
function _testHeaderLine($line) {
if (count($parsed = split(':', $line, 2)) < 2) {
if (count($parsed = explode(':', $line, 2)) < 2) {
return false;
}
list($header, $value) = $parsed;
Expand Down Expand Up @@ -1538,4 +1538,4 @@ function getAssertionLine() {
return $trace->traceMethod();
}
}
?>
?>
2 changes: 1 addition & 1 deletion lib/smarty/plugins/function.fetch.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ function smarty_function_fetch($params, &$smarty)
$content .= fgets($fp,4096);
}
fclose($fp);
$csplit = split("\r\n\r\n",$content,2);
$csplit = explode("\r\n\r\n",$content,2);

$content = $csplit[1];

Expand Down

0 comments on commit bed733c

Please sign in to comment.