MINOR ajshort: Replaced usage of the deprecated split() function with preg_split().

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@79568 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2009-06-18 09:34:17 +00:00
parent 301989d203
commit c52f67aae5
12 changed files with 13 additions and 13 deletions

View File

@ -146,7 +146,7 @@ class HTTP {
$mimeTypes = file('/etc/mime.types');
foreach($mimeTypes as $typeSpec) {
if(($typeSpec = trim($typeSpec)) && substr($typeSpec,0,1) != "#") {
$parts = split("[ \t\r\n]+", $typeSpec);
$parts = preg_split("/[ \t\r\n]+/", $typeSpec);
if(sizeof($parts) > 1) {
$mimeType = array_shift($parts);
foreach($parts as $ext) {

View File

@ -96,7 +96,7 @@ class HTTPRequest extends Object implements ArrayAccess {
$this->url = $matches[1];
$this->extension = $matches[2];
}
if($this->url) $this->dirParts = split('/+', $this->url);
if($this->url) $this->dirParts = preg_split('|/+|', $this->url);
else $this->dirParts = array();
$this->getVars = (array)$getVars;

View File

@ -183,9 +183,9 @@ class DataObjectSet extends ViewableData implements IteratorAggregate, Countable
$length = $query->limit['limit'];
$start = $query->limit['start'];
} else if(stripos($query->limit, 'OFFSET')) {
list($length, $start) = split(" +OFFSET +", trim($query->limit));
list($length, $start) = preg_split("/ +OFFSET +/", trim($query->limit));
} else {
$result = split(" *, *", trim($query->limit));
$result = preg_split("/ *, */", trim($query->limit));
$start = $result[0];
$length = isset($result[1]) ? $result[1] : null;
}

View File

@ -172,7 +172,7 @@ class YamlFixture extends Object {
foreach($fields as $fieldName => $fieldVal) {
if($obj->many_many($fieldName) || $obj->has_many($fieldName)) {
$parsedItems = array();
$items = split(' *, *',trim($fieldVal));
$items = preg_split('/ *, */',trim($fieldVal));
foreach($items as $item) {
$parsedItems[] = $this->parseFixtureVal($item);
}

View File

@ -20,7 +20,7 @@ class Enum extends DBField {
function __construct($name, $enum = NULL, $default = NULL) {
if($enum) {
if(!is_array($enum)){
$enum = split(" *, *", trim($enum));
$enum = preg_split("/ *, */", trim($enum));
}
$this->enum = $enum;

View File

@ -90,7 +90,7 @@ class CsvBulkLoader extends BulkLoader {
} elseif(strpos($fieldName, '.') !== false) {
// we have a relation column with dot notation
list($relationName,$columnName) = split('\.', $fieldName);
list($relationName,$columnName) = explode('.', $fieldName);
$relationObj = $obj->getComponent($relationName); // always gives us an component (either empty or existing)
$obj->setComponent($relationName, $relationObj);
$relationObj->write();

View File

@ -460,7 +460,7 @@ function loadMimeTypes() {
$mimeTypes = file_exists($mimetypePathGeneric) ? file($mimetypePathGeneric) : file($mimetypePathCustom);
foreach($mimeTypes as $typeSpec) {
if(($typeSpec = trim($typeSpec)) && substr($typeSpec,0,1) != "#") {
$parts = split("[ \t\r\n]+", $typeSpec);
$parts = preg_split("/[ \t\r\n]+/", $typeSpec);
if(sizeof($parts) > 1) {
$mimeType = array_shift($parts);
foreach($parts as $ext) {

View File

@ -209,7 +209,7 @@ class CheckboxSetField extends OptionsetField {
// Items is an array or single piece of string (including comma seperated string)
} else {
if(!is_array($items)) {
$items = split(' *, *', trim($items));
$items = preg_split('/ *, */', trim($items));
}
foreach($items as $item) {

View File

@ -72,7 +72,7 @@ HTML;
// If we've already got values selected, make sure that we've got them in our tree
if($_REQUEST['forceValues']) {
$forceValues = split(" *, *", trim($_REQUEST['forceValues']));
$forceValues = preg_split("/ *, */", trim($_REQUEST['forceValues']));
foreach($forceValues as $value) {
$obj->markToExpose($this->getByKey($value));
}

View File

@ -66,7 +66,7 @@ HTML;
if(!$saveDest) user_error("TreeMultiselectField::saveInto() Field '$fieldName' not found on $record->class.$record->ID", E_USER_ERROR);
if($this->value) {
$items = split(" *, *", trim($this->value));
$items = preg_split("/ *, */", trim($this->value));
}
// Allows you to modify the items on your object before save

View File

@ -51,7 +51,7 @@ HTML;
$saveDest = $record->$fieldName();
if($this->value) {
$items = split(" *, *", trim($this->value));
$items = preg_split("/ *, */", trim($this->value));
}
$saveDest->setByIDList($items);

View File

@ -138,7 +138,7 @@ class SearchForm extends Form {
protected function addStarsToKeywords($keywords) {
if(!trim($keywords)) return "";
// Add * to each keyword
$splitWords = split(" +" , trim($keywords));
$splitWords = preg_split("/ +/" , trim($keywords));
while(list($i,$word) = each($splitWords)) {
if($word[0] == '"') {
while(list($i,$subword) = each($splitWords)) {