Replaced some more class-named constructors (and calls to them).

Removed unused and/or commented code.
Replaced calls to deprecated each() with array_shift() (not completely done yet, still some more to fix!).
Replaced call to deprecated create_function() with real callback function.
This commit is contained in:
azett 2018-10-03 13:53:40 +02:00
parent b3f613a5d2
commit d8de4bfb02
13 changed files with 19 additions and 45 deletions

View File

@ -21,7 +21,7 @@
//$this->smarty = $GLOBALS['_FP_SMARTY']; //$this->smarty = $GLOBALS['_FP_SMARTY'];
$this->_directory = CACHE_DIR; $this->_directory = CACHE_DIR;
parent::fs_filelister(); parent::__construct();
} }
function _checkFile($directory, $file) { function _checkFile($directory, $file) {
@ -42,7 +42,7 @@
function __construct() { function __construct() {
$this->index = entry_init(); $this->index = entry_init();
parent::fs_filelister(); parent::__construct();
} }
function _checkFile($directory, $file) { function _checkFile($directory, $file) {

View File

@ -10,7 +10,7 @@
if ($theme['version'] > 0.703) if ($theme['version'] > 0.703)
$this->actions['style'] = true; $this->actions['style'] = true;
parent::AdminPanel($smarty); parent::__construct($smarty);
} }

View File

@ -4,7 +4,7 @@
function __construct() { function __construct() {
$this->_directory = THEMES_DIR . THE_THEME; $this->_directory = THEMES_DIR . THE_THEME;
parent::fs_filelister(); parent::__construct();
} }
function _checkFile($d, $f) { function _checkFile($d, $f) {

View File

@ -26,7 +26,7 @@
$this->thumburl = $this->thumburl =
BLOG_BASEURL . BLOG_BASEURL .
'admin.php?p=uploader&action=thumb&f='; 'admin.php?p=uploader&action=thumb&f=';
return parent::fs_filelister($d); return parent::__construct($d);
} }
function _checkFile($d, $f) { function _checkFile($d, $f) {

View File

@ -721,26 +721,6 @@ class BPlusTree_Node {
} }
/*
* mimics python's map(None, a, b)
* returns the list of (a,b) pairs
* where a is in list $a and b is in list $b
*
*
function _oldpairs($a, $b) {
$c = array();
reset($a);
reset($b);
while((list(,$v1) = each($a)) &&
(list(,$v2) = each($b))) {
$c[] = array($v1, $v2);
}
return $c;
}
*/
/** /**
* mimic's python's map(None, a, b); * mimic's python's map(None, a, b);
* a, b must be of the same size * a, b must be of the same size
@ -1383,7 +1363,7 @@ class BPlusTree_Node {
echo $indent, "seeks {", implode(", ", $this->indices),"}\n"; echo $indent, "seeks {", implode(", ", $this->indices),"}\n";
if (($flag & BPT_FLAG_INTERIOR) == BPT_FLAG_INTERIOR) { if (($flag & BPT_FLAG_INTERIOR) == BPT_FLAG_INTERIOR) {
reset($this->indices); reset($this->indices);
while(list(,$i) = each($this->indices)) { while($i = array_shift($this->indices)) {
if ($i!=BPT_NULLSEEK) { if ($i!=BPT_NULLSEEK) {
// interior // interior
$n =& $this->getclone($i); $n =& $this->getclone($i);

View File

@ -624,7 +624,7 @@
if (!$this->hasMore()) if (!$this->hasMore())
return false; return false;
list($k,$id) = each($this->list); $id = array_shift($this->list);
$comment = comment_parse($this->entryid, $id); $comment = comment_parse($this->entryid, $id);
$couplet = array(&$id, &$comment); $couplet = array(&$id, &$comment);

View File

@ -8,7 +8,7 @@
function bdb_entrylister() { function bdb_entrylister() {
$this->_cachefile = CACHE_DIR . 'userlist.php'; $this->_cachefile = CACHE_DIR . 'userlist.php';
parent::cache_filelister(); parent::__construct();
} }
function _checkFile($directory, $file) { function _checkFile($directory, $file) {

View File

@ -175,7 +175,7 @@ if (!function_exists('fnmatch')) {
$string .= $outerldelim; $string .= $outerldelim;
while (list(,$val) = each($array)) { while ($val = array_shift($array)) {
$string .= $rdelim; $string .= $rdelim;
if (is_array($val)) { if (is_array($val)) {

View File

@ -45,7 +45,7 @@
do { do {
$content = array(); $content = array();
list(,$id) = each($this->_list[$hor]); $id = array_shift($this->_list[$hor]);
$newid=$id;# @list($newid, $params) = explode(":", $id); $newid=$id;# @list($newid, $params) = explode(":", $id);
if (@$params) $params = explode(',', $params); else $params = array(); if (@$params) $params = explode(',', $params); else $params = array();

View File

@ -20,7 +20,6 @@ function smarty_function_list_categories($params) //, &$smarty)
'selected' => array() 'selected' => array()
); );
//list($catId) = each($categories);
$cat_params = array_merge($cat_params, $params); $cat_params = array_merge($cat_params, $params);
// makese 'selected' an arr // makese 'selected' an arr
@ -106,8 +105,6 @@ function do_print_categories_list(&$lines, &$indentstack, &$result, $params) {
$cat_entry = $params['selected']; $cat_entry = $params['selected'];
//list($catId) = each($categories);
if (isset($params['type']) && ($params['type']=='form' || $params['type']=='check')) { if (isset($params['type']) && ($params['type']=='form' || $params['type']=='check')) {
$string = '<label><input name="'.$catname.'cats['.$vid.']" '; $string = '<label><input name="'.$catname.'cats['.$vid.']" ';

View File

@ -259,14 +259,9 @@ class Smarty_Compiler extends Smarty {
preg_match_all($search, $source_content, $match, PREG_SET_ORDER); preg_match_all($search, $source_content, $match, PREG_SET_ORDER);
$this->_folded_blocks = $match; $this->_folded_blocks = $match;
reset($this->_folded_blocks);
/* replace special blocks by "{php}" */ /* replace special blocks by "{php}" */
$source_content = preg_replace_callback($search, create_function ('$matches', "return '" $source_content = preg_replace_callback($search, array($this,'_preg_callback')
. $this->_quote_replace($this->left_delimiter) . 'php'
. "' . str_repeat(\"\n\", substr_count('\$matches[1]', \"\n\")) .'"
. $this->_quote_replace($this->right_delimiter)
. "';")
, $source_content); , $source_content);
/* Gather all template tags. */ /* Gather all template tags. */
@ -556,7 +551,7 @@ class Smarty_Compiler extends Smarty {
case 'php': case 'php':
/* handle folded tags replaced by {php} */ /* handle folded tags replaced by {php} */
list(, $block) = each($this->_folded_blocks); $block = array_shift($this->_folded_blocks);
$this->_current_line_no += substr_count($block[0], "\n"); $this->_current_line_no += substr_count($block[0], "\n");
/* the number of matched elements in the regexp in _compile_file() /* the number of matched elements in the regexp in _compile_file()
determins the type of folded tag that was found */ determins the type of folded tag that was found */
@ -754,7 +749,12 @@ class Smarty_Compiler extends Smarty {
return true; return true;
} }
function _preg_callback ($matches) {
return $this->_quote_replace($this->left_delimiter)
. 'php'
. str_repeat("\n", substr_count($matches[1], "\n"))
. $this->_quote_replace($this->right_delimiter);
}
/** /**
* compile custom function tag * compile custom function tag
* *

View File

@ -20,7 +20,6 @@ function smarty_function_list_categories($params) //, &$smarty)
'selected' => array() 'selected' => array()
); );
//list($catId) = each($categories);
$cat_params = array_merge($cat_params, $params); $cat_params = array_merge($cat_params, $params);
// makese 'selected' an arr // makese 'selected' an arr
@ -106,8 +105,6 @@ function do_print_categories_list(&$lines, &$indentstack, &$result, $params) {
$cat_entry = $params['selected']; $cat_entry = $params['selected'];
//list($catId) = each($categories);
if (isset($params['type']) && ($params['type']=='form' || $params['type']=='check')) { if (isset($params['type']) && ($params['type']=='form' || $params['type']=='check')) {
$string = '<label><input name="'.$catname.'cats['.$vid.']" '; $string = '<label><input name="'.$catname.'cats['.$vid.']" ';

View File

@ -194,7 +194,7 @@ if (!defined('MOD_INDEX')) {
if ($searchjusthese) { if ($searchjusthese) {
$this->_constrained_list = $searchjusthese; $this->_constrained_list = $searchjusthese;
} }
return parent::fs_filelister(); return parent::__construct();
} }