From: <var...@us...> - 2012-11-30 15:16:19
|
Revision: 8578 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8578&view=rev Author: vargenau Date: 2012-11-30 15:16:08 +0000 (Fri, 30 Nov 2012) Log Message: ----------- Better use method Modified Paths: -------------- trunk/lib/plugin/NewPagesPerUser.php trunk/lib/plugin/PopularTags.php Modified: trunk/lib/plugin/NewPagesPerUser.php =================================================================== --- trunk/lib/plugin/NewPagesPerUser.php 2012-11-30 14:49:10 UTC (rev 8577) +++ trunk/lib/plugin/NewPagesPerUser.php 2012-11-30 15:16:08 UTC (rev 8578) @@ -31,6 +31,12 @@ class WikiPlugin_NewPagesPerUser extends WikiPlugin { + private function cmp_by_count($a, $b) + { + if ($a['count'] == $b['count']) return 0; + return $a['count'] < $b['count'] ? 1 : -1; + } + function getName() { return _("NewPagesPerUser"); @@ -101,7 +107,7 @@ foreach ($pages as $monthname => $parr) { $html->pushContent(HTML::tr(HTML::td(array('colspan' => 2), HTML::strong($parr['month'])))); - uasort($parr['author'], 'cmp_by_count'); + uasort($parr['author'], array($this, 'cmp_by_count')); foreach ($parr['author'] as $user => $authorarr) { $count = $authorarr['count']; $id = preg_replace("/ /", "_", 'pages-' . $monthname . '-' . $user); @@ -136,12 +142,6 @@ } } -function cmp_by_count($a, $b) -{ - if ($a['count'] == $b['count']) return 0; - return $a['count'] < $b['count'] ? 1 : -1; -} - // Local Variables: // mode: php // tab-width: 8 Modified: trunk/lib/plugin/PopularTags.php =================================================================== --- trunk/lib/plugin/PopularTags.php 2012-11-30 14:49:10 UTC (rev 8577) +++ trunk/lib/plugin/PopularTags.php 2012-11-30 15:16:08 UTC (rev 8578) @@ -21,7 +21,7 @@ */ /* Usage: - * <<PopularTags >> + * <<PopularTags>> */ require_once 'lib/PageList.php'; @@ -29,6 +29,13 @@ class WikiPlugin_PopularTags extends WikiPlugin { + // get list of categories sorted by number of backlinks + private function cmp_by_count($a, $b) + { + if ($a['count'] == $b['count']) return 0; + return $a['count'] < $b['count'] ? 1 : -1; + } + function getName() { return _("PopularTags"); @@ -64,7 +71,7 @@ 'count' => $pages->count()); } - usort($bl, 'cmp_by_count'); + usort($bl, array($this, 'cmp_by_count')); $html = HTML::ul(); $i = 0; foreach ($bl as $b) { @@ -83,13 +90,6 @@ } } -// get list of categories sorted by number of backlinks -function cmp_by_count($a, $b) -{ - if ($a['count'] == $b['count']) return 0; - return $a['count'] < $b['count'] ? 1 : -1; -} - // Local Variables: // mode: php // tab-width: 8 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |