From: <var...@us...> - 2012-10-05 16:47:49
|
Revision: 8397 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8397&view=rev Author: vargenau Date: 2012-10-05 16:47:39 +0000 (Fri, 05 Oct 2012) Log Message: ----------- Reformat code Modified Paths: -------------- trunk/lib/plugin/AddComment.php trunk/lib/plugin/AllPages.php trunk/lib/plugin/AllUsers.php trunk/lib/plugin/AnalyseAccessLogSql.php trunk/lib/plugin/AppendText.php trunk/lib/plugin/AsciiMath.php trunk/lib/plugin/AsciiSVG.php trunk/lib/plugin/AtomFeed.php trunk/lib/plugin/AuthorHistory.php trunk/lib/plugin/BackLinks.php trunk/lib/plugin/BlogArchives.php trunk/lib/plugin/BlogJournal.php trunk/lib/plugin/BoxRight.php trunk/lib/plugin/CacheTest.php trunk/lib/plugin/Calendar.php trunk/lib/plugin/CalendarList.php trunk/lib/plugin/CategoryPage.php trunk/lib/plugin/Chart.php trunk/lib/plugin/Comment.php trunk/lib/plugin/CreateBib.php trunk/lib/plugin/CreatePage.php trunk/lib/plugin/CreateToc.php trunk/lib/plugin/CurrentTime.php trunk/lib/plugin/DeadEndPages.php trunk/lib/plugin/Diff.php trunk/lib/plugin/DynamicIncludePage.php trunk/lib/plugin/EditMetaData.php trunk/lib/plugin/ExternalSearch.php trunk/lib/plugin/FacebookLike.php trunk/lib/plugin/FileInfo.php trunk/lib/plugin/FoafViewer.php trunk/lib/plugin/FrameInclude.php trunk/lib/plugin/FullTextSearch.php trunk/lib/plugin/FuzzyPages.php trunk/lib/plugin/GoTo.php trunk/lib/plugin/GoogleMaps.php trunk/lib/plugin/GooglePlugin.php trunk/lib/plugin/GraphViz.php trunk/lib/plugin/HelloWorld.php trunk/lib/plugin/HtmlConverter.php trunk/lib/plugin/Imdb.php trunk/lib/plugin/IncludePage.php trunk/lib/plugin/IncludePages.php trunk/lib/plugin/IncludeSiteMap.php trunk/lib/plugin/IncludeTree.php trunk/lib/plugin/InterWikiSearch.php trunk/lib/plugin/JabberPresence.php trunk/lib/plugin/LdapSearch.php trunk/lib/plugin/LikePages.php trunk/lib/plugin/LinkDatabase.php trunk/lib/plugin/LinkSearch.php trunk/lib/plugin/ListPages.php trunk/lib/plugin/ListRelations.php trunk/lib/plugin/ListSubpages.php trunk/lib/plugin/MediawikiTable.php trunk/lib/plugin/ModeratedPage.php trunk/lib/plugin/MostPopular.php trunk/lib/plugin/NewPagesPerUser.php trunk/lib/plugin/NoCache.php trunk/lib/plugin/OldStyleTable.php trunk/lib/plugin/OrphanedPages.php trunk/lib/plugin/PageDump.php trunk/lib/plugin/PageGroup.php trunk/lib/plugin/PageHistory.php trunk/lib/plugin/PageInfo.php trunk/lib/plugin/PageTrail.php trunk/lib/plugin/PasswordReset.php trunk/lib/plugin/PhotoAlbum.php trunk/lib/plugin/PhpHighlight.php trunk/lib/plugin/PhpWeather.php trunk/lib/plugin/Ploticus.php trunk/lib/plugin/PluginManager.php trunk/lib/plugin/PopUp.php trunk/lib/plugin/PopularNearby.php trunk/lib/plugin/PopularTags.php trunk/lib/plugin/PreferenceApp.php trunk/lib/plugin/PrevNext.php trunk/lib/plugin/Processing.php trunk/lib/plugin/RandomPage.php trunk/lib/plugin/RateIt.php trunk/lib/plugin/RawHtml.php trunk/lib/plugin/RecentChanges.php trunk/lib/plugin/RecentChangesCached.php trunk/lib/plugin/RecentComments.php trunk/lib/plugin/RecentEdits.php trunk/lib/plugin/RecentReferrers.php trunk/lib/plugin/RedirectTo.php trunk/lib/plugin/RelatedChanges.php trunk/lib/plugin/RichTable.php trunk/lib/plugin/RssFeed.php trunk/lib/plugin/SearchHighlight.php trunk/lib/plugin/SemanticRelations.php trunk/lib/plugin/SemanticSearch.php trunk/lib/plugin/SemanticSearchAdvanced.php trunk/lib/plugin/SiteMap.php trunk/lib/plugin/SpellCheck.php trunk/lib/plugin/SqlResult.php trunk/lib/plugin/SyncWiki.php trunk/lib/plugin/SyntaxHighlighter.php trunk/lib/plugin/SystemInfo.php trunk/lib/plugin/TeX2png.php trunk/lib/plugin/Template.php trunk/lib/plugin/TexToPng.php trunk/lib/plugin/TitleSearch.php trunk/lib/plugin/Transclude.php trunk/lib/plugin/TranslateText.php trunk/lib/plugin/UnfoldSubpages.php trunk/lib/plugin/UpLoad.php trunk/lib/plugin/UriResolver.php trunk/lib/plugin/UserPreferences.php trunk/lib/plugin/UserRatings.php trunk/lib/plugin/Video.php trunk/lib/plugin/VisualWiki.php trunk/lib/plugin/WantedPages.php trunk/lib/plugin/WantedPagesOld.php trunk/lib/plugin/WatchPage.php trunk/lib/plugin/WhoIsOnline.php trunk/lib/plugin/WikiAdminChmod.php trunk/lib/plugin/WikiAdminChown.php trunk/lib/plugin/WikiAdminMarkup.php trunk/lib/plugin/WikiAdminPurge.php trunk/lib/plugin/WikiAdminRemove.php trunk/lib/plugin/WikiAdminRename.php trunk/lib/plugin/WikiAdminSearchReplace.php trunk/lib/plugin/WikiAdminSelect.php trunk/lib/plugin/WikiAdminSetAcl.php trunk/lib/plugin/WikiAdminSetAclSimple.php trunk/lib/plugin/WikiAdminSetExternal.php trunk/lib/plugin/WikiAdminUtils.php trunk/lib/plugin/WikiBlog.php trunk/lib/plugin/WikiForm.php trunk/lib/plugin/WikiFormRich.php trunk/lib/plugin/WikiForum.php trunk/lib/plugin/WikiPoll.php trunk/lib/plugin/WikicreoleTable.php trunk/lib/plugin/YouTube.php trunk/lib/plugin/_AuthInfo.php trunk/lib/plugin/_BackendInfo.php trunk/lib/plugin/_GroupInfo.php trunk/lib/plugin/_PreferencesInfo.php trunk/lib/plugin/_Retransform.php trunk/lib/plugin/_WikiTranslation.php trunk/lib/plugin/text2png.php Modified: trunk/lib/plugin/AddComment.php =================================================================== --- trunk/lib/plugin/AddComment.php 2012-10-05 14:17:00 UTC (rev 8396) +++ trunk/lib/plugin/AddComment.php 2012-10-05 16:47:39 UTC (rev 8397) @@ -33,14 +33,16 @@ include_once 'lib/plugin/WikiBlog.php'; class WikiPlugin_AddComment -extends WikiPlugin_WikiBlog + extends WikiPlugin_WikiBlog { - function getName () { + function getName() + { return _("AddComment"); } - function getDescription () { - return sprintf(_("Show and add comments for %s"),'[pagename]'); + function getDescription() + { + return sprintf(_("Show and add comments for %s"), '[pagename]'); } // Arguments: @@ -57,17 +59,19 @@ // jshide - boolean - quick javascript expansion of the comments // and addcomment box - function getDefaultArguments() { - return array('pagename' => '[pagename]', - 'order' => 'normal', - 'mode' => 'add,show', - 'jshide' => '0', - 'noheader' => false, - //'sortby' => '-pagename' // oldest first. reverse by order=reverse - ); + function getDefaultArguments() + { + return array('pagename' => '[pagename]', + 'order' => 'normal', + 'mode' => 'add,show', + 'jshide' => '0', + 'noheader' => false, + //'sortby' => '-pagename' // oldest first. reverse by order=reverse + ); } - function run($dbi, $argstr, &$request, $basepage) { + function run($dbi, $argstr, &$request, $basepage) + { $args = $this->getArgs($argstr, $request); if (!$args['pagename']) { return $this->error(sprintf(_("A required argument '%s' is missing."), 'pagename')); @@ -89,55 +93,57 @@ // for new comments $html = HTML(); if ($args['jshide']) { - $div = HTML::div(array('id'=>'comments','style'=>'display:none;')); + $div = HTML::div(array('id' => 'comments', 'style' => 'display:none;')); //$list->setAttr('style','display:none;'); $div->pushContent(Javascript(" function togglecomments(a) { comments=document.getElementById('comments'); if (comments.style.display=='none') { comments.style.display='block'; - a.title='"._("Click to hide the comments")."'; + a.title='" . _("Click to hide the comments") . "'; } else { comments.style.display='none'; - a.title='"._("Click to display all comments")."'; + a.title='" . _("Click to display all comments") . "'; } }")); - $html->pushContent(HTML::h4(HTML::a(array('name'=>'comment-header', - 'class'=>'wikiaction', - 'title'=>_("Click to display"), - 'onclick'=>"togglecomments(this)"), - _("Comments")))); + $html->pushContent(HTML::h4(HTML::a(array('name' => 'comment-header', + 'class' => 'wikiaction', + 'title' => _("Click to display"), + 'onclick' => "togglecomments(this)"), + _("Comments")))); } else { - $div = HTML::div(array('id'=>'comments')); + $div = HTML::div(array('id' => 'comments')); } foreach (explode(',', $args['mode']) as $show) { if (!empty($seen[$show])) continue; $seen[$show] = 1; switch ($show) { - case 'show': - $show = $this->showAll($request, $args, 'comment'); - //if ($args['jshide']) $show->setAttr('style','display:none;'); - $div->pushContent($show); - break; - case 'add': - global $WikiTheme; - if (!$WikiTheme->DUMP_MODE) { - $add = $this->showForm($request, $args, 'addcomment'); - //if ($args['jshide']) $add->setAttr('style','display:none;'); - $div->pushContent($add); - } - break; - default: - return $this->error(sprintf("Bad mode ('%s')", $show)); + case 'show': + $show = $this->showAll($request, $args, 'comment'); + //if ($args['jshide']) $show->setAttr('style','display:none;'); + $div->pushContent($show); + break; + case 'add': + global $WikiTheme; + if (!$WikiTheme->DUMP_MODE) { + $add = $this->showForm($request, $args, 'addcomment'); + //if ($args['jshide']) $add->setAttr('style','display:none;'); + $div->pushContent($add); + } + break; + default: + return $this->error(sprintf("Bad mode ('%s')", $show)); } } $html->pushContent($div); return $html; } -}; +} +; + // Local Variables: // mode: php // tab-width: 8 Modified: trunk/lib/plugin/AllPages.php =================================================================== --- trunk/lib/plugin/AllPages.php 2012-10-05 14:17:00 UTC (rev 8396) +++ trunk/lib/plugin/AllPages.php 2012-10-05 16:47:39 UTC (rev 8397) @@ -28,27 +28,30 @@ * AllPagesCreatedByMe, AllPagesOwnedByMe, AllPagesLastAuthoredByMe */ class WikiPlugin_AllPages -extends WikiPlugin + extends WikiPlugin { - function getName () { + function getName() + { return _("AllPages"); } - function getDescription () { + function getDescription() + { return _("List all pages in this wiki."); } - function getDefaultArguments() { + function getDefaultArguments() + { return array_merge - ( - PageList::supportedArgs(), - array( - 'noheader' => false, - 'include_empty' => false, - 'info' => '', - 'debug' => false, - 'userpages' => false - )); + ( + PageList::supportedArgs(), + array( + 'noheader' => false, + 'include_empty' => false, + 'info' => '', + 'debug' => false, + 'userpages' => false + )); } // info arg allows multiple columns @@ -57,7 +60,8 @@ // sortby: [+|-] pagename|mtime|hits // 2004-07-08 22:05:35 rurban: turned off &$request to prevent from strange bug below - function run($dbi, $argstr, $request, $basepage) { + function run($dbi, $argstr, $request, $basepage) + { $args = $this->getArgs($argstr, $request); $pages = false; @@ -67,55 +71,55 @@ } $caption = _("All pages in this wiki (%d total):"); - if ( !empty($args['userpages']) ) { + if (!empty($args['userpages'])) { $pages = PageList::allUserPages($args['include_empty'], - $args['sortby'], '' - ); + $args['sortby'], '' + ); $caption = _("List of user-created pages (%d total):"); $args['count'] = $request->getArg('count'); - } elseif ( !empty($args['owner']) ) { + } elseif (!empty($args['owner'])) { $pages = PageList::allPagesByOwner($args['owner'], $args['include_empty'], - $args['sortby'], '' - ); + $args['sortby'], '' + ); $args['count'] = $request->getArg('count'); if (!$args['count']) $args['count'] = $dbi->numPages($args['include_empty'], $args['exclude']); $caption = fmt("List of pages owned by [%s] (%d total):", - WikiLink($args['owner'] == '[]' - ? $request->_user->getAuthenticatedId() - : $args['owner'], - 'if_known'), $args['count']); + WikiLink($args['owner'] == '[]' + ? $request->_user->getAuthenticatedId() + : $args['owner'], + 'if_known'), $args['count']); $pages->_options['count'] = $args['count']; - } elseif ( !empty($args['author']) ) { + } elseif (!empty($args['author'])) { $pages = PageList::allPagesByAuthor($args['author'], $args['include_empty'], - $args['sortby'], '' - ); + $args['sortby'], '' + ); $args['count'] = $request->getArg('count'); if (!$args['count']) $args['count'] = $dbi->numPages($args['include_empty'], $args['exclude']); $caption = fmt("List of pages last edited by [%s] (%d total):", - WikiLink($args['author'] == '[]' - ? $request->_user->getAuthenticatedId() - : $args['author'], - 'if_known'), $args['count']); + WikiLink($args['author'] == '[]' + ? $request->_user->getAuthenticatedId() + : $args['author'], + 'if_known'), $args['count']); $pages->_options['count'] = $args['count']; - } elseif ( !empty($args['creator']) ) { + } elseif (!empty($args['creator'])) { $pages = PageList::allPagesByCreator($args['creator'], $args['include_empty'], - $args['sortby'], '' - ); + $args['sortby'], '' + ); $args['count'] = $request->getArg('count'); if (!$args['count']) $args['count'] = $dbi->numPages($args['include_empty'], $args['exclude']); $caption = fmt("List of pages created by [%s] (%d total):", - WikiLink($args['creator'] == '[]' - ? $request->_user->getAuthenticatedId() - : $args['creator'], - 'if_known'), $args['count']); + WikiLink($args['creator'] == '[]' + ? $request->_user->getAuthenticatedId() + : $args['creator'], + 'if_known'), $args['count']); $pages->_options['count'] = $args['count']; - //} elseif ($pages) { - // $args['count'] = count($pages); + //} elseif ($pages) { + // $args['count'] = count($pages); } else { - if (! $request->getArg('count')) + if (!$request->getArg('count')) $args['count'] = $dbi->numPages($args['include_empty'], $args['exclude']); else $args['count'] = $request->getArg('count'); @@ -132,17 +136,19 @@ if ($pages !== false) $pagelist->addPageList($pages); else - $pagelist->addPages( $dbi->getAllPages($args['include_empty'], $args['sortby'], - $args['limit']) ); + $pagelist->addPages($dbi->getAllPages($args['include_empty'], $args['sortby'], + $args['limit'])); if (DEBUG && $args['debug']) { return HTML($pagelist, - HTML::p(fmt("Elapsed time: %s s", $timer->getStats()))); + HTML::p(fmt("Elapsed time: %s s", $timer->getStats()))); } else { return $pagelist; } } -}; +} +; + // Local Variables: // mode: php // tab-width: 8 Modified: trunk/lib/plugin/AllUsers.php =================================================================== --- trunk/lib/plugin/AllUsers.php 2012-10-05 14:17:00 UTC (rev 8396) +++ trunk/lib/plugin/AllUsers.php 2012-10-05 16:47:39 UTC (rev 8397) @@ -31,25 +31,29 @@ * externally authenticated users with a db users table, if auth_user_exists is defined. */ class WikiPlugin_AllUsers -extends WikiPlugin + extends WikiPlugin { - function getName () { + function getName() + { return _("AllUsers"); } - function getDescription() { + function getDescription() + { return _("List all once authenticated users."); } - function getDefaultArguments() { + function getDefaultArguments() + { return array_merge - ( - PageList::supportedArgs(), - array('noheader' => false, - 'include_empty' => true, - 'debug' => false - )); + ( + PageList::supportedArgs(), + array('noheader' => false, + 'include_empty' => true, + 'debug' => false + )); } + // info arg allows multiple columns // info=mtime,hits,summary,version,author,locked,minor,markup or all // exclude arg allows multiple pagenames exclude=WikiAdmin,.SecretUser @@ -59,7 +63,8 @@ // // sortby: [+|-] pagename|mtime|hits - function run($dbi, $argstr, &$request, $basepage) { + function run($dbi, $argstr, &$request, $basepage) + { $args = $this->getArgs($argstr, $request); extract($args); @@ -68,7 +73,7 @@ } $group = $request->getGroup(); - if (method_exists($group,'_allUsers')) { + if (method_exists($group, '_allUsers')) { $allusers = $group->_allUsers(); } else { $allusers = array(); @@ -84,7 +89,7 @@ if (!$pagesize) { $pagelist->addPageList($allusers); } else { - for ($i=$offset; $i < $offset + $pagesize - 1; $i++) { + for ($i = $offset; $i < $offset + $pagesize - 1; $i++) { if ($i >= $args['count']) break; $pagelist->addPage(trim($allusers[$i])); } @@ -99,13 +104,15 @@ if (defined('DEBUG') && DEBUG and $debug) { return HTML($pagelist, - HTML::p(fmt("Elapsed time: %s s", $timer->getStats()))); + HTML::p(fmt("Elapsed time: %s s", $timer->getStats()))); } else { return $pagelist; } } -}; +} +; + // Local Variables: // mode: php // tab-width: 8 Modified: trunk/lib/plugin/AnalyseAccessLogSql.php =================================================================== --- trunk/lib/plugin/AnalyseAccessLogSql.php 2012-10-05 14:17:00 UTC (rev 8396) +++ trunk/lib/plugin/AnalyseAccessLogSql.php 2012-10-05 16:47:39 UTC (rev 8397) @@ -27,7 +27,7 @@ * To add a new query, see _getQueryString() */ class WikiPlugin_AnalyseAccessLogSql -extends WikiPlugin + extends WikiPlugin { /** * Build the query string @@ -53,7 +53,8 @@ * ."WHERE referer IS NOT NULL " * .$where_conditions */ - function _getQueryString(&$args) { + function _getQueryString(&$args) + { // extract any parametrised conditions from the arguments, // in particular, how much history to select $where_conditions = $this->_getWhereConditions($args); @@ -61,202 +62,214 @@ // get the correct name for the table //FIXME is there a more correct way to do this? global $DBParams, $request; - $accesslog = (!empty($DBParams['prefix']) ? $DBParams['prefix'] : '')."accesslog"; + $accesslog = (!empty($DBParams['prefix']) ? $DBParams['prefix'] : '') . "accesslog"; $query = ''; $backend_type = $request->_dbi->_backend->backendType(); switch ($backend_type) { - case 'mysql': - $Referring_URL = "left(referer,length(referer)-instr(reverse(referer),'?'))"; break; - case 'pgsql': - case 'postgres7': - $Referring_URL = "substr(referer,0,position('?' in referer))"; break; - default: - $Referring_URL = "referer"; - } - switch ($args['mode']) { - case 'referring_urls': - if ($where_conditions<>'') - $where_conditions = 'WHERE '.$where_conditions.' '; - $query = "SELECT " - . "$Referring_URL AS Referring_URL, " - . "count(*) AS Referral_Count " - . "FROM $accesslog " - . $where_conditions - . "GROUP BY Referring_URL"; - break; - case 'external_referers': - $args['local_referrers'] = 'false'; - $where_conditions = $this->_getWhereConditions($args); - if ($where_conditions<>'') - $where_conditions = 'WHERE '.$where_conditions.' '; - $query = "SELECT " - . "$Referring_URL AS Referring_URL, " - . "count(*) AS Referral_Count " - . "FROM $accesslog " - . $where_conditions - . "GROUP BY Referring_URL"; - break; - case 'referring_domains': - if ($where_conditions<>'') - $where_conditions = 'WHERE '.$where_conditions.' '; - switch ($backend_type) { case 'mysql': - $Referring_Domain = "left(referer, if(locate('/', referer, 8) > 0,locate('/', referer, 8) -1, length(referer)))"; break; + $Referring_URL = "left(referer,length(referer)-instr(reverse(referer),'?'))"; + break; case 'pgsql': case 'postgres7': - $Referring_Domain = "substr(referer,0,8) || regexp_replace(substr(referer,8), '/.*', '')"; break; - default: - $Referring_Domain = "referer"; break; - } - $query = "SELECT " - . "$Referring_Domain AS Referring_Domain, " - . "count(*) AS Referral_Count " - . "FROM $accesslog " - . $where_conditions - . "GROUP BY Referring_Domain"; - break; - case 'remote_hosts': - if ($where_conditions<>'') - $where_conditions = 'WHERE '.$where_conditions.' '; - $query = "SELECT " - ."remote_host AS Remote_Host, " - ."count(*) AS Access_Count " - ."FROM $accesslog " - .$where_conditions - ."GROUP BY Remote_Host"; - break; - case 'users': - if ($where_conditions<>'') - $where_conditions = 'WHERE '.$where_conditions.' '; - $query = "SELECT " - ."remote_user AS User, " - ."count(*) AS Access_Count " - ."FROM $accesslog " - .$where_conditions - ."GROUP BY remote_user"; - break; - case 'host_users': - if ($where_conditions<>'') - $where_conditions = 'WHERE '.$where_conditions.' '; - $query = "SELECT " - ."remote_host AS Remote_Host, " - ."remote_user AS User, " - ."count(*) AS Access_Count " - ."FROM $accesslog " - .$where_conditions - ."GROUP BY remote_host, remote_user"; - break; - case "search_bots": - // This queries for all entries in the SQL access log table that - // have a dns name that I know to be a web search engine crawler and - // categorises the results into time buckets as per the list below - // 0 - 1 minute - 60 - // 1 - 1 hour - 3600 = 60 * 60 - // 2 - 1 day - 86400 = 60 * 60 * 24 - // 3 - 1 week - 604800 = 60 * 60 * 24 * 7 - // 4 - 1 month - 2629800 = 60 * 60 * 24 * 365.25 / 12 - // 5 - 1 year - 31557600 = 60 * 60 * 24 * 365.25 - $now = time(); - $query = "SELECT " - ."CASE WHEN $now-time_stamp<60 THEN '"._("0 - last minute")."' ELSE " - ."CASE WHEN $now-time_stamp<3600 THEN '"._("1 - 1 minute to 1 hour")."' ELSE " - ."CASE WHEN $now-time_stamp<86400 THEN '"._("2 - 1 hour to 1 day")."' ELSE " - ."CASE WHEN $now-time_stamp<604800 THEN '"._("3 - 1 day to 1 week")."' ELSE " - ."CASE WHEN $now-time_stamp<2629800 THEN '"._("4 - 1 week to 1 month")."' ELSE " - ."CASE WHEN $now-time_stamp<31557600 THEN '"._("5 - 1 month to 1 year")."' ELSE " - ."'"._("6 - more than 1 year")."' END END END END END END AS Time_Scale, " - ."remote_host AS Remote_Host, " - ."count(*) AS Access_Count " - ."FROM $accesslog " - ."WHERE (remote_host LIKE '%googlebot.com' " - ."OR remote_host LIKE '%alexa.com' " - ."OR remote_host LIKE '%inktomisearch.com' " - ."OR remote_host LIKE '%msnbot.msn.com') " - .($where_conditions ? 'AND '.$where_conditions : '') - ."GROUP BY Time_Scale, remote_host"; - break; - case "search_bots_hits": - // This queries for all entries in the SQL access log table that - // have a dns name that I know to be a web search engine crawler and - // displays the URI that was hit. - // If PHPSESSID appears in the URI, just display the URI to the left of this - $sessname = session_name(); - switch ($backend_type) { - case 'mysql': - $Request_URI = "IF(instr(request_uri, '$sessname')=0, request_uri,left(request_uri, instr(request_uri, '$sessname')-2))"; + $Referring_URL = "substr(referer,0,position('?' in referer))"; break; - case 'pgsql': - case 'postgres7': - $Request_URI = "regexp_replace(request_uri, '$sessname.*', '')"; break; default: - $Request_URI = 'request_uri'; break; - } - $now = time(); - $query = "SELECT " - ."CASE WHEN $now-time_stamp<60 THEN '"._("0 - last minute")."' ELSE " - ."CASE WHEN $now-time_stamp<3600 THEN '"._("1 - 1 minute to 1 hour")."' ELSE " - ."CASE WHEN $now-time_stamp<86400 THEN '"._("2 - 1 hour to 1 day")."' ELSE " - ."CASE WHEN $now-time_stamp<604800 THEN '"._("3 - 1 day to 1 week")."' ELSE " - ."CASE WHEN $now-time_stamp<2629800 THEN '"._("4 - 1 week to 1 month")."' ELSE " - ."CASE WHEN $now-time_stamp<31557600 THEN '"._("5 - 1 month to 1 year")."' ELSE " - ."'"._("6 - more than 1 year")."' END END END END END END AS Time_Scale, " - ."remote_host AS Remote_Host, " - ."$Request_URI AS Request_URI " - ."FROM $accesslog " - ."WHERE (remote_host LIKE '%googlebot.com' " - ."OR remote_host LIKE '%alexa.com' " - ."OR remote_host LIKE '%inktomisearch.com' " - ."OR remote_host LIKE '%msnbot.msn.com') " - .($where_conditions ? 'AND '.$where_conditions : '') - ."ORDER BY time_stamp"; + $Referring_URL = "referer"; } + switch ($args['mode']) { + case 'referring_urls': + if ($where_conditions <> '') + $where_conditions = 'WHERE ' . $where_conditions . ' '; + $query = "SELECT " + . "$Referring_URL AS Referring_URL, " + . "count(*) AS Referral_Count " + . "FROM $accesslog " + . $where_conditions + . "GROUP BY Referring_URL"; + break; + case 'external_referers': + $args['local_referrers'] = 'false'; + $where_conditions = $this->_getWhereConditions($args); + if ($where_conditions <> '') + $where_conditions = 'WHERE ' . $where_conditions . ' '; + $query = "SELECT " + . "$Referring_URL AS Referring_URL, " + . "count(*) AS Referral_Count " + . "FROM $accesslog " + . $where_conditions + . "GROUP BY Referring_URL"; + break; + case 'referring_domains': + if ($where_conditions <> '') + $where_conditions = 'WHERE ' . $where_conditions . ' '; + switch ($backend_type) { + case 'mysql': + $Referring_Domain = "left(referer, if(locate('/', referer, 8) > 0,locate('/', referer, 8) -1, length(referer)))"; + break; + case 'pgsql': + case 'postgres7': + $Referring_Domain = "substr(referer,0,8) || regexp_replace(substr(referer,8), '/.*', '')"; + break; + default: + $Referring_Domain = "referer"; + break; + } + $query = "SELECT " + . "$Referring_Domain AS Referring_Domain, " + . "count(*) AS Referral_Count " + . "FROM $accesslog " + . $where_conditions + . "GROUP BY Referring_Domain"; + break; + case 'remote_hosts': + if ($where_conditions <> '') + $where_conditions = 'WHERE ' . $where_conditions . ' '; + $query = "SELECT " + . "remote_host AS Remote_Host, " + . "count(*) AS Access_Count " + . "FROM $accesslog " + . $where_conditions + . "GROUP BY Remote_Host"; + break; + case 'users': + if ($where_conditions <> '') + $where_conditions = 'WHERE ' . $where_conditions . ' '; + $query = "SELECT " + . "remote_user AS User, " + . "count(*) AS Access_Count " + . "FROM $accesslog " + . $where_conditions + . "GROUP BY remote_user"; + break; + case 'host_users': + if ($where_conditions <> '') + $where_conditions = 'WHERE ' . $where_conditions . ' '; + $query = "SELECT " + . "remote_host AS Remote_Host, " + . "remote_user AS User, " + . "count(*) AS Access_Count " + . "FROM $accesslog " + . $where_conditions + . "GROUP BY remote_host, remote_user"; + break; + case "search_bots": + // This queries for all entries in the SQL access log table that + // have a dns name that I know to be a web search engine crawler and + // categorises the results into time buckets as per the list below + // 0 - 1 minute - 60 + // 1 - 1 hour - 3600 = 60 * 60 + // 2 - 1 day - 86400 = 60 * 60 * 24 + // 3 - 1 week - 604800 = 60 * 60 * 24 * 7 + // 4 - 1 month - 2629800 = 60 * 60 * 24 * 365.25 / 12 + // 5 - 1 year - 31557600 = 60 * 60 * 24 * 365.25 + $now = time(); + $query = "SELECT " + . "CASE WHEN $now-time_stamp<60 THEN '" . _("0 - last minute") . "' ELSE " + . "CASE WHEN $now-time_stamp<3600 THEN '" . _("1 - 1 minute to 1 hour") . "' ELSE " + . "CASE WHEN $now-time_stamp<86400 THEN '" . _("2 - 1 hour to 1 day") . "' ELSE " + . "CASE WHEN $now-time_stamp<604800 THEN '" . _("3 - 1 day to 1 week") . "' ELSE " + . "CASE WHEN $now-time_stamp<2629800 THEN '" . _("4 - 1 week to 1 month") . "' ELSE " + . "CASE WHEN $now-time_stamp<31557600 THEN '" . _("5 - 1 month to 1 year") . "' ELSE " + . "'" . _("6 - more than 1 year") . "' END END END END END END AS Time_Scale, " + . "remote_host AS Remote_Host, " + . "count(*) AS Access_Count " + . "FROM $accesslog " + . "WHERE (remote_host LIKE '%googlebot.com' " + . "OR remote_host LIKE '%alexa.com' " + . "OR remote_host LIKE '%inktomisearch.com' " + . "OR remote_host LIKE '%msnbot.msn.com') " + . ($where_conditions ? 'AND ' . $where_conditions : '') + . "GROUP BY Time_Scale, remote_host"; + break; + case "search_bots_hits": + // This queries for all entries in the SQL access log table that + // have a dns name that I know to be a web search engine crawler and + // displays the URI that was hit. + // If PHPSESSID appears in the URI, just display the URI to the left of this + $sessname = session_name(); + switch ($backend_type) { + case 'mysql': + $Request_URI = "IF(instr(request_uri, '$sessname')=0, request_uri,left(request_uri, instr(request_uri, '$sessname')-2))"; + break; + case 'pgsql': + case 'postgres7': + $Request_URI = "regexp_replace(request_uri, '$sessname.*', '')"; + break; + default: + $Request_URI = 'request_uri'; + break; + } + $now = time(); + $query = "SELECT " + . "CASE WHEN $now-time_stamp<60 THEN '" . _("0 - last minute") . "' ELSE " + . "CASE WHEN $now-time_stamp<3600 THEN '" . _("1 - 1 minute to 1 hour") . "' ELSE " + . "CASE WHEN $now-time_stamp<86400 THEN '" . _("2 - 1 hour to 1 day") . "' ELSE " + . "CASE WHEN $now-time_stamp<604800 THEN '" . _("3 - 1 day to 1 week") . "' ELSE " + . "CASE WHEN $now-time_stamp<2629800 THEN '" . _("4 - 1 week to 1 month") . "' ELSE " + . "CASE WHEN $now-time_stamp<31557600 THEN '" . _("5 - 1 month to 1 year") . "' ELSE " + . "'" . _("6 - more than 1 year") . "' END END END END END END AS Time_Scale, " + . "remote_host AS Remote_Host, " + . "$Request_URI AS Request_URI " + . "FROM $accesslog " + . "WHERE (remote_host LIKE '%googlebot.com' " + . "OR remote_host LIKE '%alexa.com' " + . "OR remote_host LIKE '%inktomisearch.com' " + . "OR remote_host LIKE '%msnbot.msn.com') " + . ($where_conditions ? 'AND ' . $where_conditions : '') + . "ORDER BY time_stamp"; + } return $query; } /** Honeypot for xgettext. Those strings are translated dynamically. */ - function _locale_dummy() { + function _locale_dummy() + { $dummy = array( - // mode caption - _("referring_urls"), - _("external_referers"), - _("referring_domains"), - _("remote_hosts"), - _("users"), - _("host_users"), - _("search_bots"), - _("search_bots_hits"), - // period header - _("minutes"), - _("hours"), - _("days"), - _("weeks"), - ); + // mode caption + _("referring_urls"), + _("external_referers"), + _("referring_domains"), + _("remote_hosts"), + _("users"), + _("host_users"), + _("search_bots"), + _("search_bots_hits"), + // period header + _("minutes"), + _("hours"), + _("days"), + _("weeks"), + ); } - function getDefaultArguments() { + function getDefaultArguments() + { return array( - 'mode' => 'referring_domains', - // referring_domains, referring_urls, remote_hosts, users, host_users, search_bots, search_bots_hits - 'caption' => '', - // blank means use the mode as the caption/title for the output - 'local_referrers' => 'true', // only show external referring sites - 'period' => '', // the type of period to report: - // may be weeks, days, hours, minutes, or blank for all - 'count' => '0' // the number of periods to report - ); + 'mode' => 'referring_domains', + // referring_domains, referring_urls, remote_hosts, users, host_users, search_bots, search_bots_hits + 'caption' => '', + // blank means use the mode as the caption/title for the output + 'local_referrers' => 'true', // only show external referring sites + 'period' => '', // the type of period to report: + // may be weeks, days, hours, minutes, or blank for all + 'count' => '0' // the number of periods to report + ); } - function getName () { + function getName() + { return _("AnalyseAccessLogSql"); } - function getDescription () { + function getDescription() + { return _("Show summary information from the access log table."); } - function run($dbi, $argstr, &$request, $basepage) { + function run($dbi, $argstr, &$request, $basepage) + { // flag that the output may not be cached - i.e. it is dynamic $request->setArg('nocache', 1); @@ -274,24 +287,25 @@ $query = $this->_getQueryString($args); - if ($query=='') - return HTML::p(sprintf( _("Unrecognised parameter 'mode=%s'"), - $args['mode'])); + if ($query == '') + return HTML::p(sprintf(_("Unrecognised parameter 'mode=%s'"), + $args['mode'])); // get the data back. // Note that this must be done before the final generation ofthe table, // otherwise the headers will not be ready $tbody = $this->_getQueryResults($query, $dbi); - return HTML::table(array('border' => 1, - 'cellspacing' => 1, - 'cellpadding' => 1), - HTML::caption(HTML::h1(HTML::br(),$this->_getCaption($args))), - HTML::thead($this->_theadrow), - $tbody); + return HTML::table(array('border' => 1, + 'cellspacing' => 1, + 'cellpadding' => 1), + HTML::caption(HTML::h1(HTML::br(), $this->_getCaption($args))), + HTML::thead($this->_theadrow), + $tbody); } - function _getQueryResults($query, &$dbi) { + function _getQueryResults($query, &$dbi) + { $queryResult = $dbi->genericSqlIter($query); if (!$queryResult) { $tbody = HTML::tbody(HTML::tr(HTML::td(_("<empty>")))); @@ -302,7 +316,7 @@ $tr = HTML::tr(); foreach ($row as $value) { // output a '-' for empty values, otherwise the table looks strange - $tr->pushContent(HTML::td( empty($value) ? '-' : $value )); + $tr->pushContent(HTML::td(empty($value) ? '-' : $value)); } $tbody->pushContent($tr); } @@ -311,7 +325,8 @@ return $tbody; } - function _setHeaders($row) { + function _setHeaders($row) + { if (!$this->_headerSet) { foreach ($row as $key => $value) { $this->_theadrow->pushContent(HTML::th(_($key))); @@ -320,63 +335,67 @@ } } - function _getWhereConditions(&$args) { + function _getWhereConditions(&$args) + { $where_conditions = ''; - if ($args['period']<>'') { + if ($args['period'] <> '') { $since = 0; - if ($args['period']=='minutes') { + if ($args['period'] == 'minutes') { $since = 60; - } elseif ($args['period']=='hours') { + } elseif ($args['period'] == 'hours') { $since = 60 * 60; - } elseif ($args['period']=='days') { + } elseif ($args['period'] == 'days') { $since = 60 * 60 * 24; - } elseif ($args['period']=='weeks') { + } elseif ($args['period'] == 'weeks') { $since = 60 * 60 * 24 * 7; } $since = $since * $args['count']; - if ($since>0) { - if ($where_conditions<>'') - $where_conditions = $where_conditions.' AND '; + if ($since > 0) { + if ($where_conditions <> '') + $where_conditions = $where_conditions . ' AND '; $since = time() - $since; - $where_conditions = $where_conditions."time_stamp > $since"; + $where_conditions = $where_conditions . "time_stamp > $since"; } } - if ($args['local_referrers']<>'true') { + if ($args['local_referrers'] <> 'true') { global $request; - if ($where_conditions<>'') - $where_conditions = $where_conditions.' AND '; + if ($where_conditions <> '') + $where_conditions = $where_conditions . ' AND '; $localhost = SERVER_URL; $len = strlen($localhost); $backend_type = $request->_dbi->_backend->backendType(); switch ($backend_type) { - case 'mysql': - $ref_localhost = "left(referer,$len)<>'$localhost'"; break; - case 'pgsql': - case 'postgres7': - $ref_localhost = "substr(referer,0,$len)<>'$localhost'"; break; - default: - $ref_localhost = ""; + case 'mysql': + $ref_localhost = "left(referer,$len)<>'$localhost'"; + break; + case 'pgsql': + case 'postgres7': + $ref_localhost = "substr(referer,0,$len)<>'$localhost'"; + break; + default: + $ref_localhost = ""; } - $where_conditions = $where_conditions.$ref_localhost; + $where_conditions = $where_conditions . $ref_localhost; } // The assumed contract is that there is a space at the end of the // conditions string, so that following SQL clauses (such as GROUP BY) // will not cause a syntax error - if ($where_conditions<>'') - $where_conditions = $where_conditions.' '; + if ($where_conditions <> '') + $where_conditions = $where_conditions . ' '; return $where_conditions; } - function _getCaption(&$args) { + function _getCaption(&$args) + { $caption = $args['caption']; - if ($caption=='') + if ($caption == '') $caption = gettext($args['mode']); - if ($args['period']<>'' && $args['count']) - $caption = $caption." - ".$args['count']." ". gettext($args['period']); + if ($args['period'] <> '' && $args['count']) + $caption = $caption . " - " . $args['count'] . " " . gettext($args['period']); return $caption; } Modified: trunk/lib/plugin/AppendText.php =================================================================== --- trunk/lib/plugin/AppendText.php 2012-10-05 14:17:00 UTC (rev 8396) +++ trunk/lib/plugin/AppendText.php 2012-10-05 16:47:39 UTC (rev 8397) @@ -31,33 +31,38 @@ * Todo: multiple pages. e.g. AppendText s=~[CategoryINtime~] page=<!plugin TitleSearch intime !> */ class WikiPlugin_AppendText -extends WikiPlugin + extends WikiPlugin { - function getName() { + function getName() + { return _("AppendText"); } - function getDescription() { + function getDescription() + { return _("Append text to any page in this wiki."); } - function getDefaultArguments() { - return array('page' => '[pagename]', - 'pages' => false, - 's' => '', // Text to append. - 'before' => '', // Add before (ignores after if defined) - 'after' => '', // Add after line beginning with this - 'redirect' => false // Redirect to modified page - ); + function getDefaultArguments() + { + return array('page' => '[pagename]', + 'pages' => false, + 's' => '', // Text to append. + 'before' => '', // Add before (ignores after if defined) + 'after' => '', // Add after line beginning with this + 'redirect' => false // Redirect to modified page + ); } - function _fallback($addtext, $oldtext, $notfound, &$message) { - $message->pushContent(sprintf(_("%s not found"), $notfound).". ". - _("Appending at the end.")."\n"); + function _fallback($addtext, $oldtext, $notfound, &$message) + { + $message->pushContent(sprintf(_("%s not found"), $notfound) . ". " . + _("Appending at the end.") . "\n"); return $oldtext . "\n" . $addtext; } - function run($dbi, $argstr, &$request, $basepage) { + function run($dbi, $argstr, &$request, $basepage) + { $args = $this->getArgs($argstr, $request); if (!$args['pages'] or !$request->isPost()) { @@ -65,7 +70,7 @@ } else { $html = HTML(); if ($args['page'] != $basepage) - $html->pushContent("pages argument overrides page argument. ignored.",HTML::br()); + $html->pushContent("pages argument overrides page argument. ignored.", HTML::br()); foreach ($args['pages'] as $pagename) { $html->pushContent($this->_work($pagename, $args, $dbi, $request)); } @@ -73,7 +78,8 @@ } } - function _work($pagename, $args, $dbi, &$request) { + function _work($pagename, $args, $dbi, &$request) + { if (empty($args['s'])) { if ($request->isPost()) { if ($pagename != _("AppendText")) @@ -87,7 +93,7 @@ if (!$page->exists()) { // We might want to create it? $message->pushContent(sprintf(_("Page could not be updated. %s doesn't exist!"), - $pagename)); + $pagename)); return $message; } @@ -101,16 +107,16 @@ // Insert before $newtext = preg_match("/\n${before}/", $oldtext) ? preg_replace("/(\n${before})/", - "\n" . preg_quote($text, "/") . "\\1", - $oldtext) + "\n" . preg_quote($text, "/") . "\\1", + $oldtext) : $this->_fallback($text, $oldtext, $args['before'], $message); } elseif (!empty($args['after'])) { // Insert after $after = preg_quote($args['after'], "/"); $newtext = preg_match("/\n${after}/", $oldtext) ? preg_replace("/(\n${after})/", - "\\1\n" . preg_quote($text, "/"), - $oldtext) + "\\1\n" . preg_quote($text, "/"), + $oldtext) : $this->_fallback($text, $oldtext, $args['after'], $message); } else { // Append at the end @@ -123,18 +129,18 @@ $meta['summary'] = sprintf(_("AppendText to %s"), $pagename); if ($page->save($newtext, $current->getVersion() + 1, $meta)) { $message->pushContent(HTML::p(array('class' => 'feedback'), - _("Page successfully updated."))); + _("Page successfully updated."))); } // AppendText has been called from the same page that got modified // so we directly show the page. - if ( $request->getArg($pagename) == $pagename ) { + if ($request->getArg($pagename) == $pagename) { // TODO: Just invalidate the cache, if AppendText didn't // change anything before. // return $request->redirect(WikiURL($pagename, false, 'absurl'), false); - // The user asked to be redirected to the modified page + // The user asked to be redirected to the modified page } elseif ($args['redirect']) { return $request->redirect(WikiURL($pagename, false, 'absurl'), false); @@ -145,8 +151,10 @@ return $message; } -}; +} +; + // Local Variables: // mode: php // tab-width: 8 Modified: trunk/lib/plugin/AsciiMath.php =================================================================== --- trunk/lib/plugin/AsciiMath.php 2012-10-05 14:17:00 UTC (rev 8396) +++ trunk/lib/plugin/AsciiMath.php 2012-10-05 16:47:39 UTC (rev 8397) @@ -33,33 +33,39 @@ * Syntax: http://www1.chapman.edu/~jipsen/mathml/asciimathsyntax.xml * Example: "int_-1^1 sqrt(1-x^2)dx = pi/2" * => <math xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow><msubsup><mo>∫</mo><mn>-1</mn><mn>1</mn></msubsup></mrow> - <msqrt><mrow><mn>1</mn><mo>-</mo><msup><mi>x</mi><mn>2</mn></msup></mrow></msqrt> - <mi>d</mi> - <mi>x</mi> - <mo>=</mo> - <mfrac><mi>π</mi><mo>2</mo></mfrac> - </math> +<mrow><msubsup><mo>∫</mo><mn>-1</mn><mn>1</mn></msubsup></mrow> +<msqrt><mrow><mn>1</mn><mo>-</mo><msup><mi>x</mi><mn>2</mn></msup></mrow></msqrt> +<mi>d</mi> +<mi>x</mi> +<mo>=</mo> +<mfrac><mi>π</mi><mo>2</mo></mfrac> +</math> */ class WikiPlugin_AsciiMath -extends WikiPlugin + extends WikiPlugin { - function getName() { + function getName() + { return _("AsciiMath"); } - function getDescription() { + function getDescription() + { return _("Render ASCII Math as MathML"); } - function getDefaultArguments() { + function getDefaultArguments() + { return array(); } - function handle_plugin_args_cruft(&$argstr, &$args) { + + function handle_plugin_args_cruft(&$argstr, &$args) + { $this->source = $argstr; } - function run($dbi, $argstr, &$request, $basepage) { + function run($dbi, $argstr, &$request, $basepage) + { $args = $this->getArgs($argstr, $request); if (empty($this->source)) { return HTML::div(array('class' => "error"), "Please provide a formula to AsciiMath plugin"); @@ -74,8 +80,10 @@ $ascii_math->genMathML(); return HTML::raw($ascii_math->getMathML()); } -}; +} +; + // Local Variables: // mode: php // tab-width: 8 Modified: trunk/lib/plugin/AsciiSVG.php =================================================================== --- trunk/lib/plugin/AsciiSVG.php 2012-10-05 14:17:00 UTC (rev 8396) +++ trunk/lib/plugin/AsciiSVG.php 2012-10-05 16:47:39 UTC (rev 8397) @@ -26,28 +26,34 @@ * Syntax: http://www1.chapman.edu/~jipsen/svg/asciisvgcommands.html */ class WikiPlugin_AsciiSVG -extends WikiPlugin + extends WikiPlugin { - function getName() { + function getName() + { return _("AsciiSVG"); } - function getDescription() { + function getDescription() + { return _("Render inline ASCII SVG"); } - function getDefaultArguments() { - return array('width' => 200, - 'height' => 200, - 'script' => false, // one line script. not very likely - 'onmousemove' => false - ); + function getDefaultArguments() + { + return array('width' => 200, + 'height' => 200, + 'script' => false, // one line script. not very likely + 'onmousemove' => false + ); } - function handle_plugin_args_cruft(&$argstr, &$args) { + + function handle_plugin_args_cruft(&$argstr, &$args) + { $this->source = $argstr; } - function run($dbi, $argstr, &$request, $basepage) { + function run($dbi, $argstr, &$request, $basepage) + { global $WikiTheme; $args = $this->getArgs($argstr, $request); if (empty($this->source)) @@ -55,7 +61,7 @@ $html = HTML(); if (empty($WikiTheme->_asciiSVG)) { $js = JavaScript('', array - ('src' => $WikiTheme->_findData('ASCIIsvg.js'))); + ('src' => $WikiTheme->_findData('ASCIIsvg.js'))); if (empty($WikiTheme->_headers_printed)) $WikiTheme->addMoreHeaders($js); else @@ -67,10 +73,10 @@ $this->source = $m[1]; $args['script'] = $m[2]; } - $embedargs = array('width' => $args['width'], - 'height' => $args['height'], - //'src' => "d.svg", - 'script' => $this->source); + $embedargs = array('width' => $args['width'], + 'height' => $args['height'], + //'src' => "d.svg", + 'script' => $this->source); // additional onmousemove argument if ($args['onmousemove']) $embedargs['onmousemove'] = $args['onmousemove']; // we need script='data' and not script="data" @@ -79,10 +85,14 @@ if ($args['script']) $html->pushContent(JavaScript($args['script'])); return $html; } -}; +} -class AsciiSVG_HTML extends HtmlElement { - function startTag() { +; + +class AsciiSVG_HTML extends HtmlElement +{ + function startTag() + { $start = "<" . $this->_tag; $this->_setClasses(); foreach ($this->_attr as $attr => $val) { Modified: trunk/lib/plugin/AtomFeed.php =================================================================== --- trunk/lib/plugin/AtomFeed.php 2012-10-05 14:17:00 UTC (rev 8396) +++ trunk/lib/plugin/AtomFeed.php 2012-10-05 16:47:39 UTC (rev 8397) @@ -26,27 +26,31 @@ require_once 'lib/AtomParser.php'; class WikiPlugin_AtomFeed -extends WikiPlugin + extends WikiPlugin { - function getName() { + function getName() + { return _('AtomFeed'); } - function getDescription() { + function getDescription() + { return _('Atom Aggregator Plugin'); } - function getDefaultArguments() { + function getDefaultArguments() + { return array( - 'feed' => "", - 'description' => "", - 'url' => "", - 'maxitem' => 0, - 'titleonly' => false + 'feed' => "", + 'description' => "", + 'url' => "", + 'maxitem' => 0, + 'titleonly' => false ); } - function run($dbi, $argstr, &$request, $basepage) { + function run($dbi, $argstr, &$request, $basepage) + { extract($this->getArgs($argstr, $request)); $parser = new AtomParser(); @@ -59,7 +63,7 @@ foreach ($parser->feed as $feed) { $title = HTML::h3(HTML::a(array('href' => $feed["links"]["0"]["href"]), $feed["title"])); $counter = 1; - foreach($parser->entries as $entry) { + foreach ($parser->entries as $entry) { $item = HTML::dt(HTML::a(array('href' => $entry["links"]["0"]["href"]), $entry["title"])); $items->pushContent($item); @@ -75,7 +79,7 @@ } $counter++; } - $html = HTML::div(array('class'=> 'rss'), $title); + $html = HTML::div(array('class' => 'rss'), $title); $html->pushContent($items); } Modified: trunk/lib/plugin/AuthorHistory.php =================================================================== --- trunk/lib/plugin/AuthorHistory.php 2012-10-05 14:17:00 UTC (rev 8396) +++ trunk/lib/plugin/AuthorHistory.php 2012-10-05 16:47:39 UTC (rev 8397) @@ -57,32 +57,37 @@ require_once 'lib/PageList.php'; class WikiPlugin_AuthorHistory -extends WikiPlugin + extends WikiPlugin { - function getName() { + function getName() + { return _("AuthorHistory"); } - function getDescription() { + function getDescription() + { return sprintf(_("List all page revisions edited by one user with diff links, or show a PageHistory-like list of a single page for only one user.")); } - function getDefaultArguments() { + function getDefaultArguments() + { global $request; - return array('exclude' => '', - 'noheader' => false, - 'includeminor' => false, - 'includedeleted' => false, - 'author' => $request->_user->UserName(), - 'page' => '[pagename]', - 'info' => 'version,minor,author,summary,mtime' - ); + return array('exclude' => '', + 'noheader' => false, + 'includeminor' => false, + 'includedeleted' => false, + 'author' => $request->_user->UserName(), + 'page' => '[pagename]', + 'info' => 'version,minor,author,summary,mtime' + ); } + // info arg allows multiple columns // info=mtime,hits,summary,version,author,locked,minor // exclude arg allows multiple pagenames exclude=HomePage,RecentChanges - ... [truncated message content] |