View previous topic :: View next topic |
Author |
Message |
bestbuildpc Site Admin
Joined: Jun 30, 2012 Posts: 213 Location: NL
|
Posted: Tue Feb 19, 2013 2:36 Post subject: Deprecated ereg type functions |
|
|
OLD
Code: if($this->filebasepath == '') {
$this->basepath = str_replace("\\","/",$this->urlbasepath); //If on Windows
$urllevels=substr_count('/',ereg_replace('^.*?://',$this->urlbasepath));
};
}
function setBasePath($str) {
// legacy implementation
if(ereg('^(http|https|ftp|file):\\/\\/',$str) ) {
|
NEW
Code: if($this->filebasepath == '') {
$this->basepath = str_replace("\\","/",$this->urlbasepath); //If on Windows
$urllevels = substr_count( '/', preg_replace( '/^.*?:\/\//', $this->urlbasepath ) );
};
}
function setBasePath($str) {
// legacy implementation
if ( preg_match( '/^(http|https|ftp|file):\/\//', $str ) ) {
|
OLD
Code: if(ereg(REGEXP_NOENDTAG, $ltag)) {
|
NEW
Code: if(preg_match(REGEXP_NOENDTAG, $ltag)) {
|
OLD
Code:ereg_replace("^/([^/]*/){".$this->urllevels."}",'',$path);
|
NEW
Code:preg_replace("#^/([^/]*/){".$this->urllevels."}#",'',$path);
|
OLD
Code: if(!isset($attr['MEDIA']) or ereg('print',$attr['MEDIA'])) {
|
NEW
Code: if(!isset($attr['MEDIA']) or strstr($attr['MEDIA'], 'print')) {
|
OLD
Code: $poster_from = ereg_replace(".gif", "", $poster_from);
|
NEW
Code:
$poster_from = str_replace(".gif", "", $poster_from);
|
OLD
Code: if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) {
|
NEW
Code: if (!preg_match('#^\[?[0-9\.]+\]?$#', $email_array[1])) {
|
|
|
Back to top |
|
|
bestbuildpc Site Admin
Joined: Jun 30, 2012 Posts: 213 Location: NL
|
Posted: Tue Feb 19, 2013 2:56 Post subject: |
|
|
OLD
Code: ereg('([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})', $time, $getdate);
|
NEW
Code: preg_match('#([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $time, $getdate);
|
OLD
Code: $new_text = ereg_replace(' +', ' ', $new_text); // remove double spaces.
|
NEW
Code: $new_text = preg_replace('# +#', ' ', $new_text); // Remove anything greater than one space.
|
OLD
Code:
$server_port = (!ereg('^([0-9]{1,6})', $_SERVER['REMOTE_PORT'])) ? '' : $_SERVER['REMOTE_PORT'];
|
NEW
Code: $server_port = (!preg_match('#^([0-9]{1,6})#', $_SERVER['REMOTE_PORT'])) ? '' : $_SERVER['REMOTE_PORT'];
|
|
|
Back to top |
|
|
|