Curly brace syntax for accessing array elements and string offsets will be deprecated as of PHP 7.4 - changed to square brackets. See also https://wiki.php.net/rfc/deprecate_curly_braces_array_access

This commit is contained in:
azett 2019-11-18 16:56:57 +01:00
parent 76dbaa342b
commit b6f32d1f4f
3 changed files with 99 additions and 101 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
function config_read($fullpath) { function config_read($fullpath) {
if ($fullpath{0}!='/') if ($fullpath [0] != '/')
trigger_error('config_read: syntax error. Path must begin with a /'); trigger_error('config_read: syntax error. Path must begin with a /');
$last_slash = strrpos($fullpath, '/'); $last_slash = strrpos($fullpath, '/');
$option = substr($fullpath, $last_slash + 1); $option = substr($fullpath, $last_slash + 1);
@ -9,44 +9,42 @@
$file = str_replace('/', '.', $path) . 'conf.php'; $file = str_replace('/', '.', $path) . 'conf.php';
$f = CONFIG_DIR . $file; $f = CONFIG_DIR . $file;
if (file_exists($f)) { if (file_exists($f)) {
include($f); include ($f);
} }
$arr = explode('/', $fullpath); $arr = explode('/', $fullpath);
/* todo finire */ /* todo finire */
}
} // a cosmetic wrapper around an include :D
// plus, loads the defaults if CONFIG_FILE is not found
// a cosmetic wrapper around an include :D function config_load($conffile = CONFIG_FILE) {
// plus, loads the defaults if CONFIG_FILE is not found if (!file_exists($conffile) && ($conffile == CONFIG_FILE))
function config_load($conffile=CONFIG_FILE) {
if ( !file_exists($conffile) && ($conffile==CONFIG_FILE) )
$conffile = CONFIG_DEFAULT; $conffile = CONFIG_DEFAULT;
include $conffile; include $conffile;
// todo CHANGE // todo CHANGE
//$fp_config['general'] = array_change_key_case($blog_confi); // $fp_config['general'] = array_change_key_case($blog_confi);
return $fp_config; return $fp_config;
}
} // $conf_arr can have a variable number of args
// they are the same of system_save(), as this is in fact
// a wrapper to that ;)
// $conf_arr can have a variable number of args // so:
// they are the same of system_save(), as this is in fact // $conf_arr[ 'myvariable' ] = $myvariable;
// a wrapper to that ;) function config_save($conf_arr = null, $conffile = CONFIG_FILE) {
// so: if ($conf_arr == null) {
// $conf_arr[ 'myvariable' ] = $myvariable;
function config_save($conf_arr=null, $conffile=CONFIG_FILE) {
if ($conf_arr==null) {
global $fp_config; global $fp_config;
$conf_arr=$fp_config; $conf_arr = $fp_config;
} }
$arr = array('fp_config' => $conf_arr); $arr = array(
'fp_config' => $conf_arr
);
return system_save($conffile, $arr); return system_save($conffile, $arr);
} }
?> ?>

View File

@ -276,7 +276,7 @@ function utils_microtime() {
function utils_countdashes($string, &$rest) { function utils_countdashes($string, &$rest) {
trim($string); trim($string);
$i = 0; $i = 0;
while ($string {$i} == '-') { while ($string [$i] == '-') {
$i++; $i++;
} }
if ($i) if ($i)

View File

@ -9,7 +9,7 @@ function wptexturize($text) {
for($i = 0; $i < $stop; $i++) { for($i = 0; $i < $stop; $i++) {
$curl = $textarr [$i]; $curl = $textarr [$i];
if (isset($curl {0}) && '<' != $curl {0} && $skip == 0) { // If it's not a tag if (isset($curl [0]) && '<' != $curl [0] && $skip == 0) { // If it's not a tag
$curl = str_replace('---', '&#8212;', $curl); $curl = str_replace('---', '&#8212;', $curl);
$curl = str_replace(' -- ', ' &#8212; ', $curl); $curl = str_replace(' -- ', ' &#8212; ', $curl);
$curl = str_replace('--', '&#8211;', $curl); $curl = str_replace('--', '&#8211;', $curl);
@ -70,7 +70,7 @@ function wptexturize($text) {
// strstr is fast // strstr is fast
$skip++; $skip++;
} else { } else {
if (isset($curl {0}) && $curl {0} == "<" && $skip > 0) if (isset($curl [0]) && $curl [0] == "<" && $skip > 0)
$skip++; $skip++;
} }
$curl = preg_replace('/&([^#])(?![a-z12]{1,8};)/', '&#038;$1', $curl); $curl = preg_replace('/&([^#])(?![a-z12]{1,8};)/', '&#038;$1', $curl);