NOISSUE code rearrange

This commit is contained in:
ngleader 2013-11-22 06:46:26 +09:00
parent b146e48ff5
commit bc47f19615
22 changed files with 130 additions and 159 deletions

View file

@ -45,10 +45,7 @@ class CacheFile extends CacheBase
function CacheFile()
{
$this->cache_dir = _XE_PATH_ . $this->cache_dir;
if(!is_dir($this->cache_dir))
{
FileHandler::makeDir($this->cache_dir);
}
FileHandler::makeDir($this->cache_dir);
}
/**

View file

@ -254,7 +254,7 @@ class DB
{
if($value->enable)
{
array_push($enableList, $value);
$enableList[] = $value;
}
}
}
@ -281,7 +281,7 @@ class DB
{
if(!$value->enable)
{
array_push($disableList, $value);
$disableList[] = $value;
}
}
}
@ -712,10 +712,7 @@ class DB
}
$cache_path = sprintf('%s/%s%s', $this->count_cache_path, $this->prefix, $tables_str);
if(!is_dir($cache_path))
{
FileHandler::makeDir($cache_path);
}
FileHandler::makeDir($cache_path);
$cache_filename = sprintf('%s/%s.%s', $cache_path, $tables_str, $condition);
if(!file_exists($cache_filename))
@ -773,10 +770,7 @@ class DB
}
$cache_path = sprintf('%s/%s%s', $this->count_cache_path, $this->prefix, $tables_str);
if(!is_dir($cache_path))
{
FileHandler::makeDir($cache_path);
}
FileHandler::makeDir($cache_path);
$cache_filename = sprintf('%s/%s.%s', $cache_path, $tables_str, $condition);
@ -795,10 +789,7 @@ class DB
{
return FALSE;
}
if(!is_dir($this->count_cache_path))
{
return FileHandler::makeDir($this->count_cache_path);
}
return FileHandler::makeDir($this->count_cache_path);
if(!is_array($tables))
{

View file

@ -200,7 +200,7 @@ class DisplayHandler extends Handler
$queries_output = array(array('Query', 'Elapsed time', 'Result'));
foreach($GLOBALS['__db_queries__'] as $query)
{
array_push($queries_output, array($query['query'], sprintf('%0.5f', $query['elapsed_time']), $query['result']));
$queries_output[] = array($query['query'], sprintf('%0.5f', $query['elapsed_time']), $query['result']);
}
$firephp->fb(
array(
@ -214,6 +214,8 @@ class DisplayHandler extends Handler
}
else
{
$buff = "";
// display total execution time and Request/Response info
if(__DEBUG__ & 2)
{

View file

@ -84,17 +84,16 @@ class Purifier
$attributeList = array();
if(is_array($m[2]))
{
foreach($m[2] AS $key => $value)
foreach($m[2] as $key => $value)
{
unset($script, $m2);
$script = " {$m[2][$key]} editor_component={$m[3][$key]}";
preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $script, $m2);
if(is_array($m2[1]))
if(preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $script, $m2))
{
foreach($m2[1] AS $key2 => $value2)
foreach($m2[1] as $value2)
{
array_push($attributeList, $value2);
$attributeList[] = $value2;
}
}
}
@ -116,14 +115,13 @@ class Purifier
{
$content = str_replace('<img class="zbxe_widget_output"', '<img src="" class="zbxe_widget_output"', $content);
foreach($m[3] AS $key => $value)
foreach($m[3] as $key => $value)
{
preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $m[3][$key], $m2);
if(is_array($m2[1]))
if (preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $m[3][$key], $m2))
{
foreach($m2[1] AS $key2 => $value2)
foreach($m2[1] as $value2)
{
array_push($attributeList, $value2);
$attributeList[] = $value2;
}
}
}
@ -143,7 +141,7 @@ class Purifier
$i=1;
if(is_array($whiteIframeUrlList))
{
foreach($whiteIframeUrlList AS $key => $value)
foreach($whiteIframeUrlList as $value)
{
$whiteDomainRegex .= $value;
@ -163,10 +161,7 @@ class Purifier
{
// check htmlpurifier cache directory
$this->_cacheDir = _XE_PATH_ . 'files/cache/htmlpurifier';
if(!file_exists($this->_cacheDir))
{
FileHandler::makeDir($this->_cacheDir);
}
FileHandler::makeDir($this->_cacheDir);
}
public function purify(&$content)

View file

@ -32,7 +32,7 @@ class GeneralXmlParser
xml_parse($oParser, $input);
xml_parser_free($oParser);
if(!count($this->output))
if(count($this->output) < 1)
{
return;
}
@ -50,11 +50,12 @@ class GeneralXmlParser
*/
function _tagOpen($parser, $node_name, $attrs)
{
$obj = new stdClass();
$obj->node_name = strtolower($node_name);
$obj->attrs = $attrs;
$obj->childNodes = array();
array_push($this->output, $obj);
$this->output[] = $obj;
}
/**
@ -81,24 +82,22 @@ class GeneralXmlParser
$node_name = strtolower($node_name);
$cur_obj = array_pop($this->output);
$parent_obj = &$this->output[count($this->output) - 1];
$tmp_obj = &$parent_obj->childNodes[$node_name];
if($parent_obj->childNodes[$node_name])
if($tmp_obj)
{
$tmp_obj = $parent_obj->childNodes[$node_name];
if(is_array($tmp_obj))
{
array_push($parent_obj->childNodes[$node_name], $cur_obj);
$tmp_obj[] = $cur_obj;
}
else
{
$parent_obj->childNodes[$node_name] = array();
array_push($parent_obj->childNodes[$node_name], $tmp_obj);
array_push($parent_obj->childNodes[$node_name], $cur_obj);
$tmp_obj = array($tmp_obj, $cur_obj);
}
}
else
{
$parent_obj->childNodes[$node_name] = $cur_obj;
$tmp_obj = $cur_obj;
}
}

View file

@ -162,7 +162,7 @@ class XmlParser
$obj->node_name = strtolower($node_name);
$obj->attrs = $this->_arrToAttrsObj($attrs);
array_push($this->output, $obj);
$this->output[] = $obj;
}
/**
@ -203,13 +203,11 @@ class XmlParser
$tmp_obj = $parent_obj->{$node_name};
if(is_array($tmp_obj))
{
array_push($parent_obj->{$node_name}, $cur_obj);
$parent_obj->{$node_name}[] = $cur_obj;
}
else
{
$parent_obj->{$node_name} = array();
array_push($parent_obj->{$node_name}, $tmp_obj);
array_push($parent_obj->{$node_name}, $cur_obj);
$parent_obj->{$node_name} = array($tmp_obj, $cur_obj);
}
}
else