From: <var...@us...> - 2014-11-25 16:19:19
|
Revision: 9375 http://sourceforge.net/p/phpwiki/code/9375 Author: vargenau Date: 2014-11-25 16:19:16 +0000 (Tue, 25 Nov 2014) Log Message: ----------- Move function obj2hash to plugin using it Modified Paths: -------------- trunk/lib/plugin/DebugAuthInfo.php trunk/lib/stdlib.php Modified: trunk/lib/plugin/DebugAuthInfo.php =================================================================== --- trunk/lib/plugin/DebugAuthInfo.php 2014-11-25 16:12:04 UTC (rev 9374) +++ trunk/lib/plugin/DebugAuthInfo.php 2014-11-25 16:19:16 UTC (rev 9375) @@ -102,7 +102,7 @@ } else { $table = HTML::table(array('class' => 'bordered')); //$table->pushContent(HTML::tr(HTML::td(array('colspan' => 2)))); - $userdata = obj2hash($user, array('_dbi', '_request', 'password', 'passwd')); + $userdata = $this->obj2hash($user, array('_dbi', '_request', 'password', 'passwd')); if (is_a($user, "_FilePassUser")) { foreach ($userdata['_file']->users as $u => $p) { $userdata['_file']->users[$u] = "<hidden>"; @@ -111,7 +111,7 @@ $table->pushContent($this->show_hash("User: Object of " . get_class($user), $userdata)); $group = &$request->getGroup(); $groups = $group->getAllGroupsIn(); - $groupdata = obj2hash($group, array('_dbi', '_request', 'password', 'passwd')); + $groupdata = $this->obj2hash($group, array('_dbi', '_request', 'password', 'passwd')); unset($groupdata['request']); $table->pushContent($this->show_hash("Group: Object of " . get_class($group), $groupdata)); $groups = $group->getAllGroupsIn(); @@ -126,6 +126,20 @@ return $html; } + // needed to store serialized objects-values only (perm, pref) + private function obj2hash($obj, $exclude = array()) + { + $a = array(); + $fields = get_object_vars($obj); + foreach ($fields as $key => $val) { + if (in_array($key, $exclude)) { + continue; + } + $a[$key] = $val; + } + return $a; + } + private function show_hash($heading, $hash, $depth = 0) { static $seen = array(); @@ -141,7 +155,7 @@ 'style' => 'color:black'), $heading)); if (is_object($hash)) - $hash = obj2hash($hash); + $hash = $this->obj2hash($hash); if (!empty($hash)) { ksort($hash); foreach ($hash as $key => $val) { @@ -151,7 +165,7 @@ elseif ($heading == "Object of wikidb_sql") $val = $heading; elseif (substr($heading, 0, 13) == "Object of db_") $val = $heading; elseif (!isset($seen[$heading])) { //if (empty($seen[$heading])) $seen[$heading] = 1; $val = HTML::table(array('class' => 'bordered'), - $this->show_hash($heading, obj2hash($val), $depth + 1)); + $this->show_hash($heading, $this->obj2hash($val), $depth + 1)); } else { $val = $heading; } Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2014-11-25 16:12:04 UTC (rev 9374) +++ trunk/lib/stdlib.php 2014-11-25 16:19:16 UTC (rev 9375) @@ -71,7 +71,6 @@ phpwiki_version () isWikiWord ($word) - obj2hash($obj, $exclude = array()) url_get_contents ($uri) GenerateId ($name) firstNWordsOfContent ($n, $content) @@ -1698,20 +1697,6 @@ return preg_match("/^$WikiNameRegexp\$/", $word); } -// needed to store serialized objects-values only (perm, pref) -function obj2hash($obj, $exclude = array()) -{ - $a = array(); - $fields = get_object_vars($obj); - foreach ($fields as $key => $val) { - if (in_array($key, $exclude)) { - continue; - } - $a[$key] = $val; - } - return $a; -} - /** * isAsciiString($string) */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |