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
- function run($dbi, $argstr, &$request, $basepage) {
+ function run($dbi, $argstr, &$request, $basepage)
+ {
$this->_args = $this->getArgs($argstr, $request);
extract($this->_args);
//trigger_error("1 p= $page a= $author");
@@ -98,20 +103,20 @@
global $WikiTheme; // date & time formatting
- $table = HTML::table(array('class'=> 'pagelist'));
+ $table = HTML::table(array('class' => 'pagelist'));
$thead = HTML::thead();
$tbody = HTML::tbody();
- if (! ($page == 'all')) {
+ if (!($page == 'all')) {
$p = $dbi->getPage($page);
- $thead->pushContent(HTML::tr(HTML::th(array('align'=> 'right'),
- _("Version")),
- $includeminor ? HTML::th(_("Minor")) : "",
- HTML::th(_("Author")),
- HTML::th(_("Summary")),
- HTML::th(_("Modified"))
- ));
+ $thead->pushContent(HTML::tr(HTML::th(array('align' => 'right'),
+ _("Version")),
+ $includeminor ? HTML::th(_("Minor")) : "",
+ HTML::th(_("Author")),
+ HTML::th(_("Summary")),
+ HTML::th(_("Modified"))
+ ));
$allrevisions_iter = $p->getAllRevisions();
while ($rev = $allrevisions_iter->next()) {
@@ -121,17 +126,17 @@
if ($authordoesmatch && (!$isminor || ($includeminor && $isminor))) {
$difflink = Button(array('action' => 'diff',
- 'previous' => 'minor'),
- $rev->getversion(), $rev);
- $tr = HTML::tr(HTML::td(array('align'=> 'right'),
- $difflink, $nbsp),
- $includeminor ? (HTML::td($nbsp, ($isminor ? "minor" : "major"), $nbsp)) : "",
- HTML::td($nbsp, WikiLink($rev->get('author'),
- 'if_known'), $nbsp),
- HTML::td($nbsp, $rev->get('summary')),
- HTML::td(array('align'=> 'right'),
- $WikiTheme->formatdatetime($rev->get('mtime')))
- );
+ 'previous' => 'minor'),
+ $rev->getversion(), $rev);
+ $tr = HTML::tr(HTML::td(array('align' => 'right'),
+ $difflink, $nbsp),
+ $includeminor ? (HTML::td($nbsp, ($isminor ? "minor" : "major"), $nbsp)) : "",
+ HTML::td($nbsp, WikiLink($rev->get('author'),
+ 'if_known'), $nbsp),
+ HTML::td($nbsp, $rev->get('summary')),
+ HTML::td(array('align' => 'right'),
+ $WikiTheme->formatdatetime($rev->get('mtime')))
+ );
$class = $isminor ? 'evenrow' : 'oddrow';
$tr->setAttr('class', $class);
@@ -139,21 +144,20 @@
//$pagelist->addPage($rev->getPage());
}
}
- $captext = fmt($includeminor ? "History of all major and minor edits by %s to page %s." : "History of all major edits by %s to page %s." ,
- WikiLink($author, 'auto'),
- WikiLink($page, 'auto'));
- }
- else {
+ $captext = fmt($includeminor ? "History of all major and minor edits by %s to page %s." : "History of all major edits by %s to page %s.",
+ WikiLink($author, 'auto'),
+ WikiLink($page, 'auto'));
+ } else {
//search all pages for all edits by this author
$thead->pushContent(HTML::tr(HTML::th(_("Page Name")),
- HTML::th(array('align'=> 'right'),
- _("Version")),
- $includeminor ? HTML::th(_("Minor")) : "",
- HTML::th(_("Summary")),
- HTML::th(_("Modified"))
- ));
+ HTML::th(array('align' => 'right'),
+ _("Version")),
+ $includeminor ? HTML::th(_("Minor")) : "",
+ HTML::th(_("Summary")),
+ HTML::th(_("Modified"))
+ ));
$allpages_iter = $dbi->getAllPages($includedeleted);
while ($p = $allpages_iter->next()) {
@@ -164,19 +168,19 @@
$authordoesmatch = $author == $rev->get('author');
if ($authordoesmatch && (!$isminor || ($includeminor && $isminor))) {
$difflink = Button(array('action' => 'diff',
- 'previous' => 'minor'),
- $rev->getversion(), $rev);
+ 'previous' => 'minor'),
+ $rev->getversion(), $rev);
$tr = HTML::tr(
- HTML::td($nbsp,
- ($isminor ? $rev->_pagename : WikiLink($rev->_pagename, 'auto'))
- ),
- HTML::td(array('align'=> 'right'),
- $difflink, $nbsp),
- $includeminor ? (HTML::td($nbsp, ($isminor ? "minor" : "major"), $nbsp)) : "",
- HTML::td($nbsp, $rev->get('summary')),
- HTML::td(array('align'=> 'right'),
- $WikiTheme->formatdatetime($rev->get('mtime')), $nbsp)
- );
+ HTML::td($nbsp,
+ ($isminor ? $rev->_pagename : WikiLink($rev->_pagename, 'auto'))
+ ),
+ HTML::td(array('align' => 'right'),
+ $difflink, $nbsp),
+ $includeminor ? (HTML::td($nbsp, ($isminor ? "minor" : "major"), $nbsp)) : "",
+ HTML::td($nbsp, $rev->get('summary')),
+ HTML::td(array('align' => 'right'),
+ $WikiTheme->formatdatetime($rev->get('mtime')), $nbsp)
+ );
$class = $isminor ? 'evenrow' : 'oddrow';
$tr->setAttr('class', $class);
@@ -186,8 +190,8 @@
}
}
- $captext = fmt($includeminor ? "History of all major and minor modifications for any page edited by %s." : "History of major modifications for any page edited by %s." ,
- WikiLink($author, 'auto'));
+ $captext = fmt($includeminor ? "History of all major and minor modifications for any page edited by %s." : "History of major modifications for any page edited by %s.",
+ WikiLink($author, 'auto'));
}
$table->pushContent(HTML::caption($captext));
@@ -215,8 +219,10 @@
// return $pagelist;
}
-};
+}
+;
+
// Local Variables:
// mode: php
// tab-width: 8
Modified: trunk/lib/plugin/BackLinks.php
===================================================================
--- trunk/lib/plugin/BackLinks.php 2012-10-05 14:17:00 UTC (rev 8396)
+++ trunk/lib/plugin/BackLinks.php 2012-10-05 16:47:39 UTC (rev 8397)
@@ -23,26 +23,29 @@
require_once 'lib/PageList.php';
class WikiPlugin_BackLinks
-extends WikiPlugin
+ extends WikiPlugin
{
- function getName() {
+ function getName()
+ {
return _("BackLinks");
}
- function getDescription() {
+ function getDescription()
+ {
return sprintf(_("List all pages which link to %s."), '[pagename]');
}
- function getDefaultArguments() {
+ function getDefaultArguments()
+ {
return array_merge
- (
- PageList::supportedArgs(),
- array('include_self' => false,
- 'noheader' => false,
- 'page' => '[pagename]',
- 'linkmore' => '', // If count>0 and limit>0 display a link with
- // the number of all results, linked to the given pagename.
- ));
+ (
+ PageList::supportedArgs(),
+ array('include_self' => false,
+ 'noheader' => false,
+ 'page' => '[pagename]',
+ 'linkmore' => '', // If count>0 and limit>0 display a link with
+ // the number of all results, linked to the given pagename.
+ ));
}
// info arg allows multiple columns
@@ -50,7 +53,8 @@
// exclude arg allows multiple pagenames exclude=HomePage,RecentChanges
// NEW: info=count : number of links
// page=foo,bar : backlinks to both pages
- function run($dbi, $argstr, &$request, $basepage) {
+ function run($dbi, $argstr, &$request, $basepage)
+ {
$args = $this->getArgs($argstr, $request);
extract($args);
@@ -62,7 +66,7 @@
$exclude[] = $page;
if ($info) {
$info = explode(",", $info);
- if (in_array('count',$info))
+ if (in_array('count', $info))
$args['types']['count'] =
new _PageList_Column_BackLinks_count('count', _("#"), 'center');
}
@@ -105,42 +109,41 @@
// distinction as it does with English in this case. :)
if (!$noheader) {
if ($page == $request->getArg('pagename')
- and !$dbi->isWikiPage($page))
- {
- // BackLinks plugin is more than likely being called
- // upon for an empty page on said page, while either
- // 'browse'ing, 'create'ing or 'edit'ing.
- //
- // Don't bother displaying a WikiLink 'unknown', just
- // the Un~WikiLink~ified (plain) name of the uncreated
- // page currently being viewed.
- $pagelink = $page;
+ and !$dbi->isWikiPage($page)
+ ) {
+ // BackLinks plugin is more than likely being called
+ // upon for an empty page on said page, while either
+ // 'browse'ing, 'create'ing or 'edit'ing.
+ //
+ // Don't bother displaying a WikiLink 'unknown', just
+ // the Un~WikiLink~ified (plain) name of the uncreated
+ // page currently being viewed.
+ $pagelink = $page;
- if ($pagelist->isEmpty())
- return HTML::p(fmt("No other page links to %s yet.", $pagelink));
+ if ($pagelist->isEmpty())
+ return HTML::p(fmt("No other page links to %s yet.", $pagelink));
- if ($total == 1)
- $pagelist->setCaption(fmt("One page would link to %s:",
- $pagelink));
- // Some future localizations will actually require
- // this... (BelieveItOrNot, English-only-speakers!(:)
- //
- // else if ($pagelist->getTotal() == 2)
- // $pagelist->setCaption(fmt("Two pages would link to %s:",
- // $pagelink));
- else
- $pagelist->setCaption(fmt("%s pages would link to %s:",
- $total, $pagelink));
- }
- else {
+ if ($total == 1)
+ $pagelist->setCaption(fmt("One page would link to %s:",
+ $pagelink));
+ // Some future localizations will actually require
+ // this... (BelieveItOrNot, English-only-speakers!(:)
+ //
+ // else if ($pagelist->getTotal() == 2)
+ // $pagelist->setCaption(fmt("Two pages would link to %s:",
+ // $pagelink));
+ else
+ $pagelist->setCaption(fmt("%s pages would link to %s:",
+ $total, $pagelink));
+ } else {
if ($count) {
$tmp_pages = $pages;
$p = array_shift($tmp_pages);
$pagelink = HTML(WikiLink($p, 'auto'));
foreach ($tmp_pages as $p)
- $pagelink->pushContent(" ",_("AND")," ",WikiLink($p, 'auto'));
+ $pagelink->pushContent(" ", _("AND"), " ", WikiLink($p, 'auto'));
} else
- // BackLinks plugin is being displayed on a normal page.
+ // BackLinks plugin is being displayed on a normal page.
$pagelink = WikiLink($page, 'auto');
if ($pagelist->isEmpty())
@@ -150,7 +153,7 @@
if ($total == 1)
$pagelist->setCaption(fmt("One page links to %s:",
- $pagelink));
+ $pagelink));
// Some future localizations will actually require
// this... (BelieveItOrNot, English-only-speakers!(:)
//
@@ -159,23 +162,27 @@
// $pagelink));
else
$pagelist->setCaption(fmt("%s pages link to %s:",
- $limit > 0 ? $total : _("Those"),
- $pagelink));
+ $limit > 0 ? $total : _("Those"),
+ $pagelink));
}
}
if (!empty($args['linkmore'])
and $dbi->isWikiPage($args['linkmore'])
- and $limit > 0 and $total > $limit
- )
+ and $limit > 0 and $total > $limit
+ )
$pagelist->addCaption(WikiLink($args['linkmore'], "auto", _("More...")));
return $pagelist;
}
-};
+}
+;
+
// how many links from this backLink to other pages
-class _PageList_Column_BackLinks_count extends _PageList_Column {
- function _getValue($page, &$revision_handle) {
+class _PageList_Column_BackLinks_count extends _PageList_Column
+{
+ function _getValue($page, &$revision_handle)
+ {
$iter = $page->getPageLinks();
$count = $iter->count();
return $count;
Modified: trunk/lib/plugin/BlogArchives.php
===================================================================
--- trunk/lib/plugin/BlogArchives.php 2012-10-05 14:17:00 UTC (rev 8396)
+++ trunk/lib/plugin/BlogArchives.php 2012-10-05 16:47:39 UTC (rev 8397)
@@ -33,29 +33,33 @@
* @author: Reini Urban
*/
class WikiPlugin_BlogArchives
-extends WikiPlugin_WikiBlog
+ extends WikiPlugin_WikiBlog
{
- function getName() {
+ function getName()
+ {
return _("Archives");
}
- function getDescription() {
+ function getDescription()
+ {
return _("List blog months links for the current or ADMIN user");
}
- function getDefaultArguments() {
+ function getDefaultArguments()
+ {
return //array_merge
- //(
- //PageList::supportedArgs(),
- array('user' => '',
- 'order' => 'reverse', // latest first
- 'info' => 'month,numpages', // ignored
- 'month' => false,
- 'noheader' => 0
- );
+ //(
+ //PageList::supportedArgs(),
+ array('user' => '',
+ 'order' => 'reverse', // latest first
+ 'info' => 'month,numpages', // ignored
+ 'month' => false,
+ 'noheader' => 0
+ );
}
- function run($dbi, $argstr, &$request, $basepage) {
+ function run($dbi, $argstr, &$request, $basepage)
+ {
if (is_array($argstr)) { // can do with array also.
$args =& $argstr;
if (!isset($args['order'])) $args['order'] = 'reverse';
@@ -72,7 +76,7 @@
}
if (!$args['user'] or $args['user'] == ADMIN_USER) {
if (BLOG_DEFAULT_EMPTY_PREFIX)
- $args['user'] = ''; // "Blogs/day" pages
+ $args['user'] = ''; // "Blogs/day" pages
else
$args['user'] = ADMIN_USER; // "Admin/Blogs/day" pages
}
@@ -86,22 +90,22 @@
$sp = HTML::Raw('· ');
if (!empty($args['month'])) {
$prefix = $parent . $this->_blogPrefix('wikiblog') . SUBPAGE_SEPARATOR . $args['month'];
- $pages = $dbi->titleSearch(new TextSearchQuery("^".$prefix, true, 'posix'));
+ $pages = $dbi->titleSearch(new TextSearchQuery("^" . $prefix, true, 'posix'));
$html = HTML::ul();
while ($page = $pages->next()) {
- $rev = $page->getCurrentRevision(false);
- if ($rev->get('pagetype') != 'wikiblog') continue;
+ $rev = $page->getCurrentRevision(false);
+ if ($rev->get('pagetype') != 'wikiblog') continue;
$blog = $this->_blog($rev);
$html->pushContent(HTML::li(WikiLink($page, 'known', $rev->get('summary'))));
}
if (!$args['noheader'])
return HTML(HTML::h3(sprintf(_("Blog Entries for %s:"), $this->_monthTitle($args['month']))),
- $html);
+ $html);
else
return $html;
}
- $blogs = $this->findBlogs ($dbi, $args['user'], 'wikiblog');
+ $blogs = $this->findBlogs($dbi, $args['user'], 'wikiblog');
if ($blogs) {
if (!$basepage) $basepage = _("BlogArchives");
$html = HTML::ul();
@@ -112,21 +116,21 @@
$months = array();
foreach ($blogs as $rev) {
$blog = $this->_blog($rev);
- $mon = $blog['month'];
+ $mon = $blog['month'];
if (empty($months[$mon]))
$months[$mon] =
array('title' => $this->_monthTitle($mon),
- 'num' => 1,
- 'month' => $mon,
- 'link' => WikiURL($basepage,
- $this->_nonDefaultArgs(array('month' => $mon))));
+ 'num' => 1,
+ 'month' => $mon,
+ 'link' => WikiURL($basepage,
+ $this->_nonDefaultArgs(array('month' => $mon))));
else
$months[$mon]['num']++;
}
foreach ($months as $m) {
- $html->pushContent(HTML::li(HTML::a(array('href'=>$m['link'],
- 'class' => 'named-wiki'),
- $m['title'] . " (".$m['num'].")")));
+ $html->pushContent(HTML::li(HTML::a(array('href' => $m['link'],
+ 'class' => 'named-wiki'),
+ $m['title'] . " (" . $m['num'] . ")")));
}
if (!$args['noheader'])
return HTML(HTML::h3(_("Blog Archives:")), $html);
@@ -137,14 +141,17 @@
}
// box is used to display a fixed-width, narrow version with common header
- function box($args=false, $request=false, $basepage=false) {
+ function box($args = false, $request = false, $basepage = false)
+ {
if (!$request) $request =& $GLOBALS['request'];
if (!$args or empty($args['limit'])) $args['limit'] = 10;
$args['noheader'] = 1;
return $this->makeBox(_("Archives"), $this->run($request->_dbi, $args, $request, $basepage));
}
-};
+}
+;
+
// Local Variables:
// mode: php
// tab-width: 8
Modified: trunk/lib/plugin/BlogJournal.php
===================================================================
--- trunk/lib/plugin/BlogJournal.php 2012-10-05 14:17:00 UTC (rev 8396)
+++ trunk/lib/plugin/BlogJournal.php 2012-10-05 16:47:39 UTC (rev 8397)
@@ -32,26 +32,30 @@
* @author: Reini Urban
*/
class WikiPlugin_BlogJournal
-extends WikiPlugin_WikiBlog
+ extends WikiPlugin_WikiBlog
{
- function getName() {
+ function getName()
+ {
return _("BlogJournal");
}
- function getDescription() {
+ function getDescription()
+ {
return _("Include latest blog entries for the current or ADMIN user");
}
- function getDefaultArguments() {
- return array('count' => 7,
- 'user' => '',
- 'order' => 'reverse', // latest first
- 'month' => false,
- 'noheader' => 0
- );
+ function getDefaultArguments()
+ {
+ return array('count' => 7,
+ 'user' => '',
+ 'order' => 'reverse', // latest first
+ 'month' => false,
+ 'noheader' => 0
+ );
}
- function run($dbi, $argstr, &$request, $basepage) {
+ function run($dbi, $argstr, &$request, $basepage)
+ {
if (is_array($argstr)) { // can do with array also.
$args =& $argstr;
if (!isset($args['order'])) $args['order'] = 'reverse';
@@ -68,7 +72,7 @@
}
if (!$args['user'] or $args['user'] == ADMIN_USER) {
if (BLOG_DEFAULT_EMPTY_PREFIX) {
- $args['user'] = ''; // "Blogs/day" pages
+ $args['user'] = ''; // "Blogs/day" pages
} else {
$args['user'] = ADMIN_USER; // "Admin/Blogs/day" pages
}
@@ -79,8 +83,9 @@
$prefix = $base = $parent . $this->_blogPrefix('wikiblog');
if ($args['month'])
$prefix .= (SUBPAGE_SEPARATOR . $args['month']);
- $pages = $dbi->titleSearch(new TextSearchQuery("^".$prefix.SUBPAGE_SEPARATOR, true, 'posix'));
- $html = HTML(); $i = 0;
+ $pages = $dbi->titleSearch(new TextSearchQuery("^" . $prefix . SUBPAGE_SEPARATOR, true, 'posix'));
+ $html = HTML();
+ $i = 0;
while (($page = $pages->next()) and $i < $args['count']) {
$rev = $page->getCurrentRevision(false);
if ($rev->get('pagetype') != 'wikiblog') continue;
@@ -90,19 +95,21 @@
$html->pushContent($rev->getTransformedContent('wikiblog'));
}
if ($args['user'] == $user->UserName() or $args['user'] == '')
- $html->pushContent(Button(array('action'=>'WikiBlog',
- 'mode'=>'add'),
- _("New entry"), $base));
+ $html->pushContent(Button(array('action' => 'WikiBlog',
+ 'mode' => 'add'),
+ _("New entry"), $base));
if (!$i)
return HTML(HTML::h3(_("No Blog Entries")), $html);
if (!$args['noheader'])
return HTML(HTML::h3(sprintf(_("Blog Entries for %s:"), $this->_monthTitle($args['month']))),
- $html);
+ $html);
else
return $html;
}
-};
+}
+;
+
// Local Variables:
// mode: php
// tab-width: 8
Modified: trunk/lib/plugin/BoxRight.php
===================================================================
--- trunk/lib/plugin/BoxRight.php 2012-10-05 14:17:00 UTC (rev 8396)
+++ trunk/lib/plugin/BoxRight.php 2012-10-05 16:47:39 UTC (rev 8397)
@@ -24,34 +24,39 @@
* A simple plugin for <div class="boxright"> with wikimarkup
*/
class WikiPlugin_BoxRight
-extends WikiPlugin
+ extends WikiPlugin
{
- function getName () {
+ function getName()
+ {
return "BoxRight";
}
- function getDescription () {
+ function getDescription()
+ {
return _("A simple plugin for <div class=boxright> with wikimarkup");
}
- function getDefaultArguments() {
+ function getDefaultArguments()
+ {
return array();
}
- function managesValidators() {
+ function managesValidators()
+ {
// The plugin output will only change if the plugin
// invocation (page text) changes --- so the necessary
// validators have already been handled by displayPage.
return true;
}
- function run($dbi, $argstr, &$request, $basepage) {
+ function run($dbi, $argstr, &$request, $basepage)
+ {
if (!$basepage) {
return $this->error("$basepage unset?");
}
include_once 'lib/BlockParser.php';
$page = $request->getPage($basepage);
- return HTML::div(array('class'=>'boxright'), TransformText($argstr));
+ return HTML::div(array('class' => 'boxright'), TransformText($argstr));
}
}
Modified: trunk/lib/plugin/CacheTest.php
===================================================================
--- trunk/lib/plugin/CacheTest.php 2012-10-05 14:17:00 UTC (rev 8396)
+++ trunk/lib/plugin/CacheTest.php 2012-10-05 16:47:39 UTC (rev 8397)
@@ -52,26 +52,30 @@
require_once 'lib/WikiPluginCached.php';
class WikiPlugin_CacheTest
-extends WikiPluginCached
+ extends WikiPluginCached
{
/* --------- overwrite virtual or abstract methods ---------------- */
- function getPluginType() {
+ function getPluginType()
+ {
return PLUGIN_CACHED_IMG_ONDEMAND;
}
- function getName() {
+ function getName()
+ {
return "CacheTest";
}
- function getDescription() {
+ function getDescription()
+ {
return 'This is a simple example using WikiPluginCached.';
}
- function getDefaultArguments() {
+ function getDefaultArguments()
+ {
return array('text' => $this->getDescription(),
- 'font' => '3',
- 'type' => 'png' );
+ 'font' => '3',
+ 'type' => 'png');
}
// should return image handle
@@ -81,15 +85,17 @@
// image handle to an error image if you do not,
// WikiPluginImageCache will do so.
- function getImage($dbi, $argarray, $request) {
+ function getImage($dbi, $argarray, $request)
+ {
extract($argarray);
- return $this->produceGraphics($text,$font);
+ return $this->produceGraphics($text, $font);
// This should also work
// return $this->lazy_produceGraphics($text,$font);
} // getImage
- function getImageType($dbi, $argarray, $request) {
+ function getImageType($dbi, $argarray, $request)
+ {
extract($argarray);
if (in_array($type, array('png', 'gif', 'jpg'))) {
return $type;
@@ -97,31 +103,34 @@
return 'png';
}
- function getAlt($dbi, $argarray, $request) {
+ function getAlt($dbi, $argarray, $request)
+ {
// ALT-text for <img> tag
extract($argarray);
return $text;
}
- function getExpire($dbi, $argarray, $request) {
+ function getExpire($dbi, $argarray, $request)
+ {
return '+600'; // 600 seconds life time
}
/* -------------------- extremely simple converter -------------------- */
- function produceGraphics($text, $font ) {
+ function produceGraphics($text, $font)
+ {
// The idea (and some code) is stolen from the text2png plugin
// but I did not want to use TTF. ImageString is quite ugly
// and quite compatible. It's only a usage example.
- if ($font<1 || $font>5) {
+ if ($font < 1 || $font > 5) {
$text = "Fontnr. (font=\"$font\") should be in range 1-5";
$this->complain($text);
$font = 3;
}
$ok = ($im = @ImageCreate(400, 40));
- $bg_color = ImageColorAllocate($im, 240, 240, 240);
+ $bg_color = ImageColorAllocate($im, 240, 240, 240);
$text_color1 = ImageColorAllocate($im, 120, 120, 120);
$text_color2 = ImageColorAllocate($im, 0, 0, 0);
@@ -147,8 +156,9 @@
// we could have used the simple built-in text2img function
// instead of writing our own:
- function lazy_produceGraphics( $text, $font ) {
- if ($font<1 || $font>5) {
+ function lazy_produceGraphics($text, $font)
+ {
+ if ($font < 1 || $font > 5) {
$text = "Fontnr. (font=\"$font\") should be in range 1-5";
$this->complain($text);
$font = 3;
@@ -156,7 +166,7 @@
}
return $this->text2img($text, $font, array(0, 0, 0),
- array(255, 255, 255));
+ array(255, 255, 255));
} // lazy_produceGraphics
}
Modified: trunk/lib/plugin/Calendar.php
===================================================================
--- trunk/lib/plugin/Calendar.php 2012-10-05 14:17:00 UTC (rev 8396)
+++ trunk/lib/plugin/Calendar.php 2012-10-05 16:47:39 UTC (rev 8397)
@@ -33,26 +33,29 @@
// easier.)
class WikiPlugin_Calendar
-extends WikiPlugin
+ extends WikiPlugin
{
- function getName () {
+ function getName()
+ {
return _("Calendar");
}
- function getDescription () {
+ function getDescription()
+ {
return _("Calendar");
}
- function getDefaultArguments() {
- return array('prefix' => '[pagename]' . SUBPAGE_SEPARATOR,
- 'date_format' => '%Y-%m-%d',
- 'year' => '',
- 'month' => '',
- 'month_offset' => 0,
- 'month_format' => '%B %Y',
- 'wday_format' => '%a',
- 'start_wday' => '1', // start now with Monday
- 'display_weeknum' => 0);
+ function getDefaultArguments()
+ {
+ return array('prefix' => '[pagename]' . SUBPAGE_SEPARATOR,
+ 'date_format' => '%Y-%m-%d',
+ 'year' => '',
+ 'month' => '',
+ 'month_offset' => 0,
+ 'month_format' => '%B %Y',
+ 'wday_format' => '%a',
+ 'start_wday' => '1', // start now with Monday
+ 'display_weeknum' => 0);
}
/**
@@ -62,7 +65,8 @@
* @param string $basepage The pagename the plugin is invoked from.
* @return array List of pagenames linked to (or false).
*/
- function getWikiPageLinks ($argstr, $basepage) {
+ function getWikiPageLinks($argstr, $basepage)
+ {
if (isset($this->_links))
return $this->_links;
else {
@@ -72,43 +76,45 @@
}
}
- function __header($pagename, $time) {
+ function __header($pagename, $time)
+ {
$args = &$this->args;
$t = localtime($time - SECONDS_PER_DAY, 1);
$prev_url = WikiURL($pagename, array('month' => $t['tm_mon'] + 1,
- 'year' => $t['tm_year'] + 1900));
+ 'year' => $t['tm_year'] + 1900));
$t = localtime($time + 32 * SECONDS_PER_DAY, 1);
$next_url = WikiURL($pagename, array('month' => $t['tm_mon'] + 1,
- 'year' => $t['tm_year'] + 1900));
+ 'year' => $t['tm_year'] + 1900));
- $prev = HTML::a(array('href' => $prev_url,
- 'class' => 'cal-arrow',
- 'title' => _("Previous Month")),
- '<');
- $next = HTML::a(array('href' => $next_url,
- 'class' => 'cal-arrow',
- 'title' => _("Next Month")),
- '>');
+ $prev = HTML::a(array('href' => $prev_url,
+ 'class' => 'cal-arrow',
+ 'title' => _("Previous Month")),
+ '<');
+ $next = HTML::a(array('href' => $next_url,
+ 'class' => 'cal-arrow',
+ 'title' => _("Next Month")),
+ '>');
$row = HTML::tr(HTML::td(array('align' => 'left'), $prev),
- HTML::td(array('align' => 'center'),
- HTML::strong(array('class' => 'cal-header'),
- strftime($args['month_format'],
- $time))),
- HTML::td(array('align' => 'right'), $next));
+ HTML::td(array('align' => 'center'),
+ HTML::strong(array('class' => 'cal-header'),
+ strftime($args['month_format'],
+ $time))),
+ HTML::td(array('align' => 'right'), $next));
return HTML::tr(HTML::td(array('colspan' => $args['display_weeknum'] ? 8 : 7,
- 'align' => 'center'),
- HTML::table(array('width' => '100%',
- 'class' => 'cal-header'),
- $row)));
+ 'align' => 'center'),
+ HTML::table(array('width' => '100%',
+ 'class' => 'cal-header'),
+ $row)));
}
- function __daynames($start_wday) {
- $time = mktime(12, 0, 0, 1, 1, 2001);
- $t = localtime($time, 1);
+ function __daynames($start_wday)
+ {
+ $time = mktime(12, 0, 0, 1, 1, 2001);
+ $t = localtime($time, 1);
$time += (7 + $start_wday - $t['tm_wday']) * SECONDS_PER_DAY;
$t = localtime($time, 1);
@@ -119,22 +125,23 @@
$row->setattr('class', 'cal-dayname');
if ($this->args['display_weeknum'])
$row->pushContent(HTML::td(array('class' => 'cal-dayname',
- 'align' => 'center'),
- _("Wk")));
+ 'align' => 'center'),
+ _("Wk")));
for ($i = 0; $i < 7; $i++) {
$row->pushContent(HTML::td(array('class' => 'cal-dayname',
- 'align' => 'center'),
- strftime($fs, $time)));
+ 'align' => 'center'),
+ strftime($fs, $time)));
$time += SECONDS_PER_DAY;
}
return $row;
}
- function __date($dbi, $time) {
+ function __date($dbi, $time)
+ {
$args = &$this->args;
$page_for_date = $args['prefix'] . strftime($args['date_format'],
- $time);
+ $time);
$t = localtime($time, 1);
$td = HTML::td(array('align' => 'center'));
@@ -143,8 +150,7 @@
if ($mday == $this->_today) {
$mday = HTML::strong($mday);
$td->setAttr('class', 'cal-today');
- }
- else if ($dbi->isWikiPage($page_for_date)) {
+ } else if ($dbi->isWikiPage($page_for_date)) {
$this->_links[] = $page_for_date;
$td->setAttr('class', 'cal-day');
}
@@ -152,50 +158,50 @@
if ($dbi->isWikiPage($page_for_date)) {
$this->_links[] = $page_for_date;
$date = HTML::a(array('class' => 'cal-day',
- 'href' => WikiURL($page_for_date),
- 'title' => $page_for_date),
- HTML::em($mday));
- }
- else {
+ 'href' => WikiURL($page_for_date),
+ 'title' => $page_for_date),
+ HTML::em($mday));
+ } else {
$date = HTML::a(array('class' => 'cal-hide',
- 'rel' => 'nofollow',
- 'href' => WikiURL($page_for_date,
- array('action' => 'edit')),
- 'title' => sprintf(_("Edit %s"),
- $page_for_date)),
- $mday);
+ 'rel' => 'nofollow',
+ 'href' => WikiURL($page_for_date,
+ array('action' => 'edit')),
+ 'title' => sprintf(_("Edit %s"),
+ $page_for_date)),
+ $mday);
}
$td->pushContent(HTML::raw(' '), $date, HTML::raw(' '));
return $td;
}
- function run($dbi, $argstr, &$request, $basepage) {
+ function run($dbi, $argstr, &$request, $basepage)
+ {
$this->args = $this->getArgs($argstr, $request);
- $args = &$this->args;
+ $args = &$this->args;
$this->_links = array();
$now = localtime(time() + 3600 * $request->getPref('timeOffset'), 1);
- foreach ( array('month' => $now['tm_mon'] + 1,
- 'year' => $now['tm_year'] + 1900)
- as $param => $dflt ) {
+ foreach (array('month' => $now['tm_mon'] + 1,
+ 'year' => $now['tm_year'] + 1900)
+ as $param => $dflt) {
if (!($args[$param] = intval($args[$param])))
- $args[$param] = $dflt;
+ $args[$param] = $dflt;
}
- $time = mktime(12, 0, 0, // hh, mm, ss,
- $args['month'] + $args['month_offset'], // month (1-12)
- 1, // mday (1-31)
- $args['year']);
+ $time = mktime(12, 0, 0, // hh, mm, ss,
+ $args['month'] + $args['month_offset'], // month (1-12)
+ 1, // mday (1-31)
+ $args['year']);
$colnum = $args['display_weeknum'] ? 8 : 7;
$cal = HTML::table(array('cellspacing' => 0,
- 'cellpadding' => 2,
- 'class' => 'cal'),
- HTML::thead(
- $this->__header($request->getArg('pagename'),
- $time),
- $this->__daynames($args['start_wday'])));
+ 'cellpadding' => 2,
+ 'class' => 'cal'),
+ HTML::thead(
+ $this->__header($request->getArg('pagename'),
+ $time),
+ $this->__daynames($args['start_wday'])));
$t = localtime($time, 1);
@@ -209,7 +215,7 @@
if ($args['display_weeknum'])
$row->pushContent(HTML::td(array('class' => 'cal-weeknum'),
- ((int)strftime("%U", $time))+1)); // %U problem. starts with 0
+ ((int)strftime("%U", $time)) + 1)); // %U problem. starts with 0
$col = (7 + $t['tm_wday'] - $args['start_wday']) % 7;
if ($col > 0)
$row->pushContent(HTML::td(array('colspan' => $col)));
@@ -224,11 +230,11 @@
}
$time += SECONDS_PER_DAY;
- $t = localtime($time, 1);
- $done = $t['tm_mday'] == 1;
+ $t = localtime($time, 1);
+ $done = $t['tm_mday'] == 1;
if (!$col and !$done and $args['display_weeknum'])
$row->pushContent(HTML::td(array('class' => 'cal-weeknum'),
- ((int)strftime("%U", $time))+1)); // starts with 0
+ ((int)strftime("%U", $time)) + 1)); // starts with 0
}
if ($row->getContent()) {
@@ -238,8 +244,10 @@
$cal->pushContent($tbody);
return $cal;
}
-};
+}
+;
+
// Local Variables:
// mode: php
// tab-width: 8
Modified: trunk/lib/plugin/CalendarList.php
===================================================================
--- trunk/lib/plugin/CalendarList.php 2012-10-05 14:17:00 UTC (rev 8396)
+++ trunk/lib/plugin/CalendarList.php 2012-10-05 16:47:39 UTC (rev 8397)
@@ -22,15 +22,15 @@
// if not defined in config.ini
if (!defined('PLUGIN_CALENDARLIST_ORDER'))
- define('PLUGIN_CALENDARLIST_ORDER', 'normal');
+ define('PLUGIN_CALENDARLIST_ORDER', 'normal');
if (!defined('PLUGIN_CALENDARLIST_NEXT_N_DAYS'))
- define('PLUGIN_CALENDARLIST_NEXT_N_DAYS','');
+ define('PLUGIN_CALENDARLIST_NEXT_N_DAYS', '');
if (!defined('PLUGIN_CALENDARLIST_NEXT_N'))
- define('PLUGIN_CALENDARLIST_NEXT_N', '');
+ define('PLUGIN_CALENDARLIST_NEXT_N', '');
if (!defined('PLUGIN_CALENDARLIST_LAST_N_DAYS'))
- define('PLUGIN_CALENDARLIST_LAST_N_DAYS','');
+ define('PLUGIN_CALENDARLIST_LAST_N_DAYS', '');
if (!defined('PLUGIN_CALENDARLIST_LAST_N'))
- define('PLUGIN_CALENDARLIST_LAST_N', '');
+ define('PLUGIN_CALENDARLIST_LAST_N', '');
/**
* This is a list of calendar appointments.
@@ -47,33 +47,36 @@
*
*/
class WikiPlugin_CalendarList
-extends WikiPlugin
+ extends WikiPlugin
{
- function getName () {
+ function getName()
+ {
return _("CalendarList");
}
- function getDescription () {
+ function getDescription()
+ {
return _("CalendarList");
}
- function getDefaultArguments() {
- return array('prefix' => '[pagename]',
- 'date_format' => '%Y-%m-%d',
- 'order' => PLUGIN_CALENDARLIST_ORDER, // normal or reverse (report sequence)
- 'year' => '',
- 'month' => '',
- 'month_offset' => 0,
- //support ranges: next n days/events
- 'next_n_days' => PLUGIN_CALENDARLIST_NEXT_N_DAYS, // one or the other, not both
- 'next_n' => PLUGIN_CALENDARLIST_NEXT_N,
- // last n days/entries:
- 'last_n_days' => PLUGIN_CALENDARLIST_LAST_N_DAYS, // one or the other, not both
- 'last_n' => PLUGIN_CALENDARLIST_LAST_N,
+ function getDefaultArguments()
+ {
+ return array('prefix' => '[pagename]',
+ 'date_format' => '%Y-%m-%d',
+ 'order' => PLUGIN_CALENDARLIST_ORDER, // normal or reverse (report sequence)
+ 'year' => '',
+ 'month' => '',
+ 'month_offset' => 0,
+ //support ranges: next n days/events
+ 'next_n_days' => PLUGIN_CALENDARLIST_NEXT_N_DAYS, // one or the other, not both
+ 'next_n' => PLUGIN_CALENDARLIST_NEXT_N,
+ // last n days/entries:
+ 'last_n_days' => PLUGIN_CALENDARLIST_LAST_N_DAYS, // one or the other, not both
+ 'last_n' => PLUGIN_CALENDARLIST_LAST_N,
- 'month_format' => '%B %Y',
- 'wday_format' => '%a',
- 'start_wday' => '1');
+ 'month_format' => '%B %Y',
+ 'wday_format' => '%a',
+ 'start_wday' => '1');
}
/**
@@ -83,7 +86,8 @@
* @param string $basepage The pagename the plugin is invoked from.
* @return array List of pagenames linked to (or false).
*/
- function getWikiPageLinks ($argstr, $basepage) {
+ function getWikiPageLinks($argstr, $basepage)
+ {
if (isset($this->_links))
return $this->_links;
else {
@@ -93,29 +97,31 @@
}
}
- function _count_events($dbi, $n = 7, $direction = 1) {
+ function _count_events($dbi, $n = 7, $direction = 1)
+ {
// This is used by the last_n/next_n options to determine the date that
// accounts for the number of N events in the past/future.
// RETURNS: date of N-th event or the last item found
- $args = &$this->args; // gather the args array
- $timeTMP = time(); // start with today's date
- $t = $timeTMP; // init the control date variable to now
+ $args = &$this->args; // gather the args array
+ $timeTMP = time(); // start with today's date
+ $t = $timeTMP; // init the control date variable to now
- for ($i=0; $i<=180; $i++) { // loop thru 180 days, past or future
+ for ($i = 0; $i <= 180; $i++) { // loop thru 180 days, past or future
$date_string = strftime($args['date_format'], $t);
$page_for_date = $args['prefix'] . SUBPAGE_SEPARATOR . $date_string;
if ($dbi->isWikiPage($page_for_date)) { // if this date has any comments/events
- $timeTMP = $t; // capture the date of this event for return
- if ($n-- <= 0) break; // if we reached the limit, return the date
+ $timeTMP = $t; // capture the date of this event for return
+ if ($n-- <= 0) break; // if we reached the limit, return the date
}
- $t += 24 * 3600 * $direction; // advance one day back or forward
+ $t += 24 * 3600 * $direction; // advance one day back or forward
}
// return the date of the N-th or last, most past/future event in the range
return $timeTMP;
}
- function _date($dbi, $time) {
+ function _date($dbi, $time)
+ {
$args = &$this->args;
$date_string = strftime($args['date_format'], $time);
@@ -132,10 +138,10 @@
include_once 'lib/BlockParser.php';
$content = TransformText(implode("\n", $c), $r->get('markup'));
$link = HTML::a(array('class' => 'cal-hide',
- 'href' => WikiURL($page_for_date,
- array('action' => 'edit')),
- 'title' => sprintf(_("Edit %s"), $page_for_date)),
- $date_string);
+ 'href' => WikiURL($page_for_date,
+ array('action' => 'edit')),
+ 'title' => sprintf(_("Edit %s"), $page_for_date)),
+ $date_string);
$this->_links[] = $page_for_date;
$a = array(HTML::dt($link), HTML::dd($content));
} else {
@@ -144,26 +150,26 @@
return $a;
}
- function run($dbi, $argstr, &$request, $basepage) {
+ function run($dbi, $argstr, &$request, $basepage)
+ {
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|