SF.net SVN: phpwiki:[11008] trunk/lib/plugin
vargenau--- via phpwiki-checkins <[email protected]> Thu, 24 Mar 2022 13:28:34 +0000
| Newsgroups | gmane.comp.web.wiki.phpwiki.checkins |
|---|---|
| Message-ID | <[email protected]> |
Revision: 11008
http://sourceforge.net/p/phpwiki/code/11008
Author: vargenau
Date: 2022-03-24 13:28:33 +0000 (Thu, 24 Mar 2022)
Log Message:
-----------
run php-cs-fixer
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/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/DebugAuthInfo.php
trunk/lib/plugin/DebugBackendInfo.php
trunk/lib/plugin/DebugGroupInfo.php
trunk/lib/plugin/DebugRetransform.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/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/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/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/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/WatchPage.php
trunk/lib/plugin/WhoIsOnline.php
trunk/lib/plugin/WikiAdminChown.php
trunk/lib/plugin/WikiAdminDeleteAcl.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/WikiTranslation.php
trunk/lib/plugin/WikicreoleTable.php
trunk/lib/plugin/YouTube.php
trunk/lib/plugin/text2png.php
Modified: trunk/lib/plugin/AddComment.php
===================================================================
--- trunk/lib/plugin/AddComment.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/AddComment.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -34,10 +34,9 @@
include_once 'lib/plugin/WikiBlog.php';
-class WikiPlugin_AddComment
- extends WikiPlugin_WikiBlog
+class WikiPlugin_AddComment extends WikiPlugin_WikiBlog
{
- function getDescription()
+ public function getDescription()
{
return sprintf(_("Show and add comments for %s."), '[pagename]');
}
@@ -56,7 +55,7 @@
// jshide - boolean - quick javascript expansion of the comments
// and addcomment box
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array('pagename' => '[pagename]',
'order' => 'normal',
@@ -74,7 +73,7 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
if (!$args['pagename']) {
@@ -128,17 +127,20 @@
a.title='" . _("Click to display all comments") . "';
}
}"));
- $html->pushContent(HTML::h4(HTML::a(array('id' => 'comment-header',
+ $html->pushContent(HTML::h4(HTML::a(
+ array('id' => 'comment-header',
'class' => 'wikiaction',
'title' => _("Click to display"),
'onclick' => "togglecomments(this)"),
- _("Comments"))));
+ _("Comments")
+ )));
} else {
$div = HTML::div(array('id' => 'comments'));
}
foreach (explode(',', $args['mode']) as $show) {
- if (!empty($seen[$show]))
+ if (!empty($seen[$show])) {
continue;
+ }
$seen[$show] = 1;
switch ($show) {
case 'show':
@@ -161,5 +163,4 @@
$html->pushContent($div);
return $html;
}
-
}
Modified: trunk/lib/plugin/AllPages.php
===================================================================
--- trunk/lib/plugin/AllPages.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/AllPages.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -30,18 +30,16 @@
* AllPagesCreatedByMe, AllPagesOwnedByMe, AllPagesLastAuthoredByMe
*/
-class WikiPlugin_AllPages
- extends WikiPlugin
+class WikiPlugin_AllPages extends WikiPlugin
{
- function getDescription()
+ public function getDescription()
{
return _("List all pages in this wiki.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
- return array_merge
- (
+ return array_merge(
PageList::supportedArgs(),
array(
'noheader' => false,
@@ -48,7 +46,8 @@
'include_empty' => false,
'info' => '',
'userpages' => false
- ));
+ )
+ );
}
// info arg allows multiple columns
@@ -63,7 +62,7 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
@@ -101,8 +100,10 @@
}
if (isset($args['limit']) && !is_limit($args['limit'])) {
- return HTML::p(array('class' => "error"),
- _("Illegal “limit” argument: must be an integer or two integers separated by comma"));
+ return HTML::p(
+ array('class' => "error"),
+ _("Illegal “limit” argument: must be an integer or two integers separated by comma")
+ );
}
if (empty($args['sortby'])) {
@@ -120,27 +121,42 @@
} elseif (!empty($args['owner'])) {
$pages = PageList::allPagesByOwner($args['owner'], $include_empty, $args['sortby']);
$args['count'] = count($pages);
- $caption = fmt("List of pages owned by %s (%d total):",
- WikiLink($args['owner'] == '[]'
+ $caption = fmt(
+ "List of pages owned by %s (%d total):",
+ WikiLink(
+ $args['owner'] == '[]'
? $request->_user->getAuthenticatedId()
: $args['owner'],
- 'if_known'), $args['count']);
+ 'if_known'
+ ),
+ $args['count']
+ );
} elseif (!empty($args['author'])) {
$pages = PageList::allPagesByAuthor($args['author'], $include_empty, $args['sortby']);
$args['count'] = count($pages);
- $caption = fmt("List of pages last edited by %s (%d total):",
- WikiLink($args['author'] == '[]'
+ $caption = fmt(
+ "List of pages last edited by %s (%d total):",
+ WikiLink(
+ $args['author'] == '[]'
? $request->_user->getAuthenticatedId()
: $args['author'],
- 'if_known'), $args['count']);
+ 'if_known'
+ ),
+ $args['count']
+ );
} elseif (!empty($args['creator'])) {
$pages = PageList::allPagesByCreator($args['creator'], $include_empty, $args['sortby']);
$args['count'] = count($pages);
- $caption = fmt("List of pages created by %s (%d total):",
- WikiLink($args['creator'] == '[]'
+ $caption = fmt(
+ "List of pages created by %s (%d total):",
+ WikiLink(
+ $args['creator'] == '[]'
? $request->_user->getAuthenticatedId()
: $args['creator'],
- 'if_known'), $args['count']);
+ 'if_known'
+ ),
+ $args['count']
+ );
} elseif ($pages) {
$args['count'] = count($pages);
} else {
Modified: trunk/lib/plugin/AllUsers.php
===================================================================
--- trunk/lib/plugin/AllUsers.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/AllUsers.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -33,22 +33,21 @@
* externally authenticated users with a db users table, if auth_user_exists is defined.
*/
-class WikiPlugin_AllUsers
- extends WikiPlugin
+class WikiPlugin_AllUsers extends WikiPlugin
{
- function getDescription()
+ public function getDescription()
{
return _("List all once authenticated users.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
- return array_merge
- (
+ return array_merge(
PageList::supportedArgs(),
array('noheader' => false,
'include_empty' => true
- ));
+ )
+ );
}
// info arg allows multiple columns
@@ -67,13 +66,15 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
if (isset($args['limit']) && !is_limit($args['limit'])) {
- return HTML::p(array('class' => "error"),
- _("Illegal “limit” argument: must be an integer or two integers separated by comma"));
+ return HTML::p(
+ array('class' => "error"),
+ _("Illegal “limit” argument: must be an integer or two integers separated by comma")
+ );
}
extract($args);
@@ -97,16 +98,20 @@
$args['count'] = count($allusers);
// deleted pages show up as version 0.
$pagelist = new PageList($info, $exclude, $args);
- if (!$noheader)
+ if (!$noheader) {
$pagelist->setCaption(_("Authenticated users on this wiki (%d total):"));
- if ($include_empty and empty($info))
+ }
+ if ($include_empty and empty($info)) {
$pagelist->_addColumn('version');
+ }
list($offset, $pagesize) = $pagelist->limit($args['limit']);
if (!$pagesize) {
$pagelist->addPageList($allusers);
} else {
for ($i = $offset; $i < $offset + $pagesize - 1; $i++) {
- if ($i >= $args['count']) break;
+ if ($i >= $args['count']) {
+ break;
+ }
$pagelist->addPage(trim($allusers[$i]));
}
}
Modified: trunk/lib/plugin/AnalyseAccessLogSql.php
===================================================================
--- trunk/lib/plugin/AnalyseAccessLogSql.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/AnalyseAccessLogSql.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -30,8 +30,7 @@
* To add a new query, see getQueryString()
*/
-class WikiPlugin_AnalyseAccessLogSql
- extends WikiPlugin
+class WikiPlugin_AnalyseAccessLogSql extends WikiPlugin
{
public $_theadrow;
public $_headerSet;
@@ -88,8 +87,9 @@
}
switch ($args['mode']) {
case 'referring_urls':
- if ($where_conditions <> '')
+ if ($where_conditions <> '') {
$where_conditions = 'WHERE ' . $where_conditions . ' ';
+ }
$query = "SELECT "
. "$Referring_URL AS Referring_URL, "
. "count(*) AS Referral_Count "
@@ -100,8 +100,9 @@
case 'external_referers':
$args['local_referrers'] = 'false';
$where_conditions = $this->getWhereConditions($args);
- if ($where_conditions <> '')
+ if ($where_conditions <> '') {
$where_conditions = 'WHERE ' . $where_conditions . ' ';
+ }
$query = "SELECT "
. "$Referring_URL AS Referring_URL, "
. "count(*) AS Referral_Count "
@@ -110,8 +111,9 @@
. "GROUP BY Referring_URL";
break;
case 'referring_domains':
- if ($where_conditions <> '')
+ 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)))";
@@ -132,8 +134,9 @@
. "GROUP BY Referring_Domain";
break;
case 'remote_hosts':
- if ($where_conditions <> '')
+ if ($where_conditions <> '') {
$where_conditions = 'WHERE ' . $where_conditions . ' ';
+ }
$query = "SELECT "
. "remote_host AS Remote_Host, "
. "count(*) AS Access_Count "
@@ -142,8 +145,9 @@
. "GROUP BY Remote_Host";
break;
case 'users':
- if ($where_conditions <> '')
+ if ($where_conditions <> '') {
$where_conditions = 'WHERE ' . $where_conditions . ' ';
+ }
$query = "SELECT "
. "remote_user AS User, "
. "count(*) AS Access_Count "
@@ -152,8 +156,9 @@
. "GROUP BY remote_user";
break;
case 'host_users':
- if ($where_conditions <> '')
+ if ($where_conditions <> '') {
$where_conditions = 'WHERE ' . $where_conditions . ' ';
+ }
$query = "SELECT "
. "remote_host AS Remote_Host, "
. "remote_user AS User, "
@@ -253,7 +258,7 @@
);
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array(
'mode' => 'referring_domains',
@@ -267,7 +272,7 @@
);
}
- function getDescription()
+ public function getDescription()
{
return _("Show summary information from the access log table.");
}
@@ -279,19 +284,23 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
// flag that the output may not be cached - i.e. it is dynamic
$request->setArg('nocache', 1);
if (!$request->_user->isAdmin()) {
- return HTML::p(array('class' => 'error'),
- _("The requested information is available only to Administrators."));
+ return HTML::p(
+ array('class' => 'error'),
+ _("The requested information is available only to Administrators.")
+ );
}
if (!ACCESS_LOG_SQL) { // need read access
- return HTML::p(array('class' => 'error'),
- _("The ACCESS_LOG_SQL is not enabled."));
+ return HTML::p(
+ array('class' => 'error'),
+ _("The ACCESS_LOG_SQL is not enabled.")
+ );
}
// set aside a place for the table headers, see setHeaders()
@@ -303,8 +312,10 @@
$query = $this->getQueryString($args);
if ($query == '') {
- return HTML::p(array('class' => 'error'),
- sprintf(_("Unrecognised parameter 'mode=%s'"), $args['mode']));
+ return HTML::p(
+ array('class' => 'error'),
+ sprintf(_("Unrecognised parameter 'mode=%s'"), $args['mode'])
+ );
}
// get the data back.
@@ -312,10 +323,12 @@
// otherwise the headers will not be ready
$tbody = $this->getQueryResults($query, $dbi);
- return HTML::table(array('class' => 'bordered'),
+ return HTML::table(
+ array('class' => 'bordered'),
HTML::caption($this->getCaption($args)),
HTML::thead($this->_theadrow),
- $tbody);
+ $tbody
+ );
}
private function getQueryResults($query, &$dbi)
@@ -366,8 +379,9 @@
}
$since = $since * $args['count'];
if ($since > 0) {
- if ($where_conditions <> '')
+ if ($where_conditions <> '') {
$where_conditions = $where_conditions . ' AND ';
+ }
$since = time() - $since;
$where_conditions = $where_conditions . "time_stamp > $since";
}
@@ -375,8 +389,9 @@
if ($args['local_referrers'] <> 'true') {
global $request;
- if ($where_conditions <> '')
+ if ($where_conditions <> '') {
$where_conditions = $where_conditions . ' AND ';
+ }
$localhost = SERVER_URL;
$len = strlen($localhost);
$backend_type = $request->_dbi->_backend->backendType();
@@ -397,8 +412,9 @@
// 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 <> '')
+ if ($where_conditions <> '') {
$where_conditions = $where_conditions . ' ';
+ }
return $where_conditions;
}
@@ -406,11 +422,12 @@
private function getCaption(&$args)
{
$caption = $args['caption'];
- if ($caption == '')
+ if ($caption == '') {
$caption = gettext($args['mode']);
- if ($args['period'] <> '' && $args['count'])
+ }
+ 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 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/AppendText.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -33,15 +33,14 @@
* Todo: multiple pages. e.g. AppendText s=~[CategoryINtime~] page=<!plugin TitleSearch intime !>
*/
-class WikiPlugin_AppendText
- extends WikiPlugin
+class WikiPlugin_AppendText extends WikiPlugin
{
- function getDescription()
+ public function getDescription()
{
return _("Append text to any page in this wiki.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array('page' => '[pagename]',
'pages' => false,
@@ -66,7 +65,7 @@
* @param string $basepage
* @return HTML|XmlContent
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
@@ -85,8 +84,9 @@
return $this->work($args['page'], $args, $dbi, $request);
} else {
$html = HTML();
- if ($args['page'] != $basepage)
+ if ($args['page'] != $basepage) {
$html->pushContent(_("pages argument overrides page argument. ignored."), HTML::br());
+ }
foreach ($args['pages'] as $pagename) {
$html->pushContent($this->work($pagename, $args, $dbi, $request));
}
@@ -98,9 +98,10 @@
{
if (empty($args['s'])) {
if ($request->isPost()) {
- if ($pagename != _("AppendText"))
+ if ($pagename != _("AppendText")) {
$request->redirect(WikiURL($pagename, array(), 'absurl'), false);
- return HTML();
+ }
+ return HTML();
}
return HTML();
}
@@ -109,8 +110,10 @@
$message = HTML();
if (!$page->exists()) { // We might want to create it?
- $message->pushContent(sprintf(_("Page could not be updated. %s doesn't exist!"),
- $pagename));
+ $message->pushContent(sprintf(
+ _("Page could not be updated. %s doesn't exist!"),
+ $pagename
+ ));
return $message;
}
@@ -123,17 +126,21 @@
$before = preg_quote($args['before'], "/");
// Insert before
$newtext = preg_match("/\n${before}/", $oldtext)
- ? preg_replace("/(\n${before})/",
+ ? preg_replace(
+ "/(\n${before})/",
"\n" . preg_quote($text, "/") . "\\1",
- $oldtext)
+ $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})/",
+ ? preg_replace(
+ "/(\n${after})/",
"\\1\n" . preg_quote($text, "/"),
- $oldtext)
+ $oldtext
+ )
: $this->fallback($text, $oldtext, $args['after'], $message);
} else {
// Append at the end
@@ -145,8 +152,10 @@
$meta = $current->_data;
$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.")));
+ $message->pushContent(HTML::p(
+ array('class' => 'feedback'),
+ _("Page successfully updated.")
+ ));
}
// AppendText has been called from the same page that got modified
@@ -158,7 +167,7 @@
//
$request->redirect(WikiURL($pagename, array(), 'absurl'), false);
return HTML();
- // The user asked to be redirected to the modified page
+ // The user asked to be redirected to the modified page
} elseif ($redirect) {
$request->redirect(WikiURL($pagename, array(), 'absurl'), false);
return HTML();
Modified: trunk/lib/plugin/AsciiMath.php
===================================================================
--- trunk/lib/plugin/AsciiMath.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/AsciiMath.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -40,22 +40,21 @@
</math>
*/
-class WikiPlugin_AsciiMath
- extends WikiPlugin
+class WikiPlugin_AsciiMath extends WikiPlugin
{
public $source;
- function getDescription()
+ public function getDescription()
{
return _("Render ASCII Math as MathML.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array();
}
- function handle_plugin_args_cruft($argstr, $args)
+ public function handle_plugin_args_cruft($argstr, $args)
{
$this->source = $argstr;
}
@@ -67,7 +66,7 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
if (empty($this->source)) {
Modified: trunk/lib/plugin/AsciiSVG.php
===================================================================
--- trunk/lib/plugin/AsciiSVG.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/AsciiSVG.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -27,17 +27,16 @@
* Syntax: http://www1.chapman.edu/~jipsen/svg/asciisvgcommands.html
*/
-class WikiPlugin_AsciiSVG
- extends WikiPlugin
+class WikiPlugin_AsciiSVG extends WikiPlugin
{
public $source;
- function getDescription()
+ public function getDescription()
{
return _("Render inline ASCII SVG.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array('width' => 200,
'height' => 200,
@@ -46,7 +45,7 @@
);
}
- function handle_plugin_args_cruft($argstr, $args)
+ public function handle_plugin_args_cruft($argstr, $args)
{
$this->source = $argstr;
}
@@ -58,22 +57,24 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
global $WikiTheme;
$args = $this->getArgs($argstr, $request);
if (empty($this->source)) {
- return HTML::p(array('class' => "error"),
- _("Please provide SVG code to AsciiSVG plugin"));
+ return HTML::p(
+ array('class' => "error"),
+ _("Please provide SVG code to AsciiSVG plugin")
+ );
}
$html = HTML();
if (empty($WikiTheme->_asciiSVG)) {
- $js = JavaScript('', array
- ('src' => $WikiTheme->_findData('ASCIIsvg.js')));
- if (empty($WikiTheme->_headers_printed))
+ $js = JavaScript('', array('src' => $WikiTheme->_findData('ASCIIsvg.js')));
+ if (empty($WikiTheme->_headers_printed)) {
$WikiTheme->addMoreHeaders($js);
- else
+ } else {
$html->pushContent($js);
+ }
$WikiTheme->_asciiSVG = 1; // prevent duplicates
}
// extract <script>
@@ -86,11 +87,15 @@
//'src' => "d.svg",
'script' => $this->source);
// additional onmousemove argument
- if ($args['onmousemove']) $embedargs['onmousemove'] = $args['onmousemove'];
+ if ($args['onmousemove']) {
+ $embedargs['onmousemove'] = $args['onmousemove'];
+ }
// we need script='data' and not script="data"
$embed = new AsciiSVG_HTML("embed", $embedargs);
$html->pushContent($embed);
- if ($args['script']) $html->pushContent(JavaScript($args['script']));
+ if ($args['script']) {
+ $html->pushContent(JavaScript($args['script']));
+ }
return $html;
}
}
@@ -97,22 +102,24 @@
class AsciiSVG_HTML extends HtmlElement
{
- function startTag()
+ public function startTag()
{
$start = "<" . $this->_tag;
$this->_setClasses();
foreach ($this->_attr as $attr => $val) {
if (is_bool($val)) {
- if (!$val)
+ if (!$val) {
continue;
+ }
$val = $attr;
}
$qval = str_replace("\"", '"', $this->_quote((string)$val));
- if ($attr == 'script')
+ if ($attr == 'script') {
// note the ' not "
$start .= " $attr='$qval'";
- else
+ } else {
$start .= " $attr=\"$qval\"";
+ }
}
$start .= ">";
return $start;
Modified: trunk/lib/plugin/AtomFeed.php
===================================================================
--- trunk/lib/plugin/AtomFeed.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/AtomFeed.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -29,15 +29,14 @@
require_once 'lib/WikiPlugin.php';
require_once 'lib/AtomParser.php';
-class WikiPlugin_AtomFeed
- extends WikiPlugin
+class WikiPlugin_AtomFeed extends WikiPlugin
{
- function getDescription()
+ public function getDescription()
{
return _('Atom Aggregator Plugin.');
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array(
'feed' => "",
@@ -55,7 +54,7 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
extract($this->getArgs($argstr, $request));
Modified: trunk/lib/plugin/AuthorHistory.php
===================================================================
--- trunk/lib/plugin/AuthorHistory.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/AuthorHistory.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -51,17 +51,16 @@
require_once 'lib/PageList.php';
-class WikiPlugin_AuthorHistory
- extends WikiPlugin
+class WikiPlugin_AuthorHistory extends WikiPlugin
{
public $_args;
- function getDescription()
+ public function getDescription()
{
return _("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()
+ public function getDefaultArguments()
{
global $request;
return array('exclude' => '',
@@ -85,7 +84,7 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
$this->_args = $this->getArgs($argstr, $request);
extract($this->_args);
@@ -123,8 +122,9 @@
if (!$author) { // user not signed in and no author specified
return HTML::p(array('class' => 'error'), _("You are not signed in and no author is specified."));
}
- if ($page && $page == 'username') //FIXME: use [username]!!!!!
+ if ($page && $page == 'username') { //FIXME: use [username]!!!!!
$page = $author;
+ }
$nbsp = HTML::raw(' ');
@@ -137,8 +137,11 @@
if (!($page == 'all')) {
$p = $dbi->getPage($page);
- $thead->pushContent(HTML::tr(HTML::th(array('class' => 'align-right'),
- _("Version")),
+ $thead->pushContent(HTML::tr(
+ HTML::th(
+ array('class' => 'align-right'),
+ _("Version")
+ ),
$includeminor ? HTML::th(_("Minor")) : "",
HTML::th(_("Author")),
HTML::th(_("Summary")),
@@ -147,22 +150,32 @@
$allrevisions_iter = $p->getAllRevisions();
while ($rev = $allrevisions_iter->next()) {
-
$isminor = $rev->get('is_minor_edit');
$authordoesmatch = $author == $rev->get('author');
if ($authordoesmatch && (!$isminor || ($includeminor && $isminor))) {
- $difflink = Button(array('action' => 'diff',
+ $difflink = Button(
+ array('action' => 'diff',
'previous' => 'minor'),
- $rev->getVersion(), $rev);
- $tr = HTML::tr(HTML::td(array('class' => 'align-right'),
- $difflink, $nbsp),
+ $rev->getVersion(),
+ $rev
+ );
+ $tr = HTML::tr(
+ HTML::td(
+ array('class' => '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, WikiLink(
+ $rev->get('author'),
+ 'if_known'
+ ), $nbsp),
HTML::td($nbsp, $rev->get('summary')),
- HTML::td(array('class' => 'align-right'),
- $WikiTheme->formatDateTime($rev->get('mtime')))
+ HTML::td(
+ array('class' => 'align-right'),
+ $WikiTheme->formatDateTime($rev->get('mtime'))
+ )
);
$class = $isminor ? 'evenrow' : 'oddrow';
@@ -170,17 +183,22 @@
$tbody->pushContent($tr);
}
}
- $captext = fmt($includeminor
+ $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'));
+ 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('class' => 'align-right'),
- _("Version")),
+ $thead->pushContent(HTML::tr(
+ HTML::th(_("Page Name")),
+ HTML::th(
+ array('class' => 'align-right'),
+ _("Version")
+ ),
$includeminor ? HTML::th(_("Minor")) : "",
HTML::th(_("Summary")),
HTML::th(_("Modified"))
@@ -188,25 +206,34 @@
$allpages_iter = $dbi->getAllPages($includedeleted);
while ($p = $allpages_iter->next()) {
-
$allrevisions_iter = $p->getAllRevisions();
while ($rev = $allrevisions_iter->next()) {
$isminor = $rev->get('is_minor_edit');
$authordoesmatch = $author == $rev->get('author');
if ($authordoesmatch && (!$isminor || ($includeminor && $isminor))) {
- $difflink = Button(array('action' => 'diff',
+ $difflink = Button(
+ array('action' => 'diff',
'previous' => 'minor'),
- $rev->getVersion(), $rev);
+ $rev->getVersion(),
+ $rev
+ );
$tr = HTML::tr(
- HTML::td($nbsp,
+ HTML::td(
+ $nbsp,
($isminor ? $rev->_pagename : WikiLink($rev->_pagename, 'auto'))
),
- HTML::td(array('class' => 'align-right'),
- $difflink, $nbsp),
+ HTML::td(
+ array('class' => 'align-right'),
+ $difflink,
+ $nbsp
+ ),
$includeminor ? (HTML::td($nbsp, ($isminor ? "minor" : "major"), $nbsp)) : "",
HTML::td($nbsp, $rev->get('summary')),
- HTML::td(array('class' => 'align-right'),
- $WikiTheme->formatDateTime($rev->get('mtime')), $nbsp)
+ HTML::td(
+ array('class' => 'align-right'),
+ $WikiTheme->formatDateTime($rev->get('mtime')),
+ $nbsp
+ )
);
$class = $isminor ? 'evenrow' : 'oddrow';
@@ -216,10 +243,12 @@
}
}
- $captext = fmt($includeminor
+ $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'));
+ WikiLink($author, 'auto')
+ );
}
$table->pushContent(HTML::caption($captext));
Modified: trunk/lib/plugin/BackLinks.php
===================================================================
--- trunk/lib/plugin/BackLinks.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/BackLinks.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -24,18 +24,16 @@
require_once 'lib/PageList.php';
-class WikiPlugin_BackLinks
- extends WikiPlugin
+class WikiPlugin_BackLinks extends WikiPlugin
{
- function getDescription()
+ public function getDescription()
{
return sprintf(_("List all pages which link to %s."), '[pagename]');
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
- return array_merge
- (
+ return array_merge(
PageList::supportedArgs(),
array('include_self' => false,
'noheader' => false,
@@ -42,7 +40,8 @@
'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
@@ -57,13 +56,15 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
if (isset($args['limit']) && !is_limit($args['limit'])) {
- return HTML::p(array('class' => "error"),
- _("Illegal “limit” argument: must be an integer or two integers separated by comma"));
+ return HTML::p(
+ array('class' => "error"),
+ _("Illegal “limit” argument: must be an integer or two integers separated by comma")
+ );
}
extract($args);
@@ -122,15 +123,18 @@
$bi = $dp->getBackLinks(false, $sortby, 0, $exclude);
while ($b = $bi->next()) {
$name = $b->getName();
- if (isset($bl[$name]))
+ if (isset($bl[$name])) {
$bl[$name]++;
- else
+ } else {
$bl[$name] = 1;
+ }
}
}
- foreach ($bl as $b => $v)
- if ($v == $count)
+ foreach ($bl as $b => $v) {
+ if ($v == $count) {
$pagelist->addPage($b);
+ }
+ }
} else {
$p = $dbi->getPage($page);
$pagelist->addPages($p->getBackLinks(false, $sortby, 0, $exclude));
@@ -156,12 +160,16 @@
// page currently being viewed.
$pagelink = $page;
- if ($pagelist->isEmpty())
+ 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));
+ if ($total == 1) {
+ $pagelist->setCaption(fmt(
+ "One page would link to %s:",
+ $pagelink
+ ));
+ }
// Some future localizations will actually require
// this... (BelieveItOrNot, English-only-speakers!(:)
//
@@ -168,28 +176,38 @@
// 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 {
+ $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)
+ foreach ($tmp_pages as $p) {
$pagelink->pushContent(" ", _("AND"), " ", WikiLink($p, 'auto'));
- } else
+ }
+ } else {
// BackLinks plugin is being displayed on a normal page.
$pagelink = WikiLink($page, 'auto');
+ }
- if ($pagelist->isEmpty())
+ if ($pagelist->isEmpty()) {
return HTML::p(fmt("No page links to %s.", $pagelink));
+ }
//trigger_error("DEBUG: " . $pagelist->getTotal());
- if ($total == 1)
- $pagelist->setCaption(fmt("One page links to %s:",
- $pagelink));
+ if ($total == 1) {
+ $pagelist->setCaption(fmt(
+ "One page links to %s:",
+ $pagelink
+ ));
+ }
// Some future localizations will actually require
// this... (BelieveItOrNot, English-only-speakers!(:)
//
@@ -196,26 +214,29 @@
// else if ($pagelist->getTotal() == 2)
// $pagelist->setCaption(fmt("Two pages link to %s:",
// $pagelink));
- else
- $pagelist->setCaption(fmt("%s pages link to %s:",
+ else {
+ $pagelist->setCaption(fmt(
+ "%s pages link to %s:",
$limit > 0 ? $total : _("Those"),
- $pagelink));
+ $pagelink
+ ));
+ }
}
}
if (!empty($args['linkmore'])
and $dbi->isWikiPage($args['linkmore'])
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_handle, $revision_handle)
+ public function _getValue($page_handle, $revision_handle)
{
$iter = $page_handle->getPageLinks();
return $iter->count();
Modified: trunk/lib/plugin/BlogArchives.php
===================================================================
--- trunk/lib/plugin/BlogArchives.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/BlogArchives.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -35,15 +35,14 @@
* @author: Reini Urban
*/
-class WikiPlugin_BlogArchives
- extends WikiPlugin_WikiBlog
+class WikiPlugin_BlogArchives extends WikiPlugin_WikiBlog
{
- function getDescription()
+ public function getDescription()
{
return _("List blog months links for the current or ADMIN user.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return //array_merge
//(
@@ -63,11 +62,13 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
if (is_array($argstr)) { // can do with array also.
$args =& $argstr;
- if (!isset($args['order'])) $args['order'] = 'reverse';
+ if (!isset($args['order'])) {
+ $args['order'] = 'reverse';
+ }
} else {
$args = $this->getArgs($argstr, $request);
}
@@ -80,10 +81,12 @@
}
}
if (!$args['user'] or $args['user'] == ADMIN_USER) {
- if (BLOG_DEFAULT_EMPTY_PREFIX)
- $args['user'] = ''; // "Blogs/day" pages
- else
- $args['user'] = ADMIN_USER; // "Admin/Blogs/day" pages
+ if (BLOG_DEFAULT_EMPTY_PREFIX) {
+ $args['user'] = '';
+ } // "Blogs/day" pages
+ else {
+ $args['user'] = ADMIN_USER;
+ } // "Admin/Blogs/day" pages
}
$parent = (empty($args['user']) ? '' : $args['user'] . '/');
@@ -98,50 +101,65 @@
$html = HTML::ul();
while ($page = $pages->next()) {
$rev = $page->getCurrentRevision(false);
- if ($rev->get('pagetype') != 'wikiblog') continue;
+ 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);
- else
+ if (!$args['noheader']) {
+ return HTML(
+ HTML::h3(sprintf(_("Blog Entries for %s:"), $this->monthTitle($args['month']))),
+ $html
+ );
+ } else {
return $html;
+ }
}
$blogs = $this->findBlogs($dbi, $args['user']);
if ($blogs) {
- if (!$basepage) $basepage = _("BlogArchives");
+ if (!$basepage) {
+ $basepage = _("BlogArchives");
+ }
$html = HTML::ul();
usort($blogs, array("WikiPlugin_WikiBlog", "cmp"));
- if ($args['order'] == 'reverse')
+ if ($args['order'] == 'reverse') {
$blogs = array_reverse($blogs);
+ }
// collapse pagenames by month
$months = array();
foreach ($blogs as $rev) {
$blog = $this->_blog($rev);
$mon = $blog['month'];
- if (empty($months[$mon]))
+ if (empty($months[$mon])) {
$months[$mon] =
array('title' => $this->monthTitle($mon),
'num' => 1,
'month' => $mon,
- 'link' => WikiURL($basepage,
- $this->nonDefaultArgs(array('month' => $mon))));
- else
+ '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'],
+ $html->pushContent(HTML::li(HTML::a(
+ array('href' => $m['link'],
'class' => 'named-wiki'),
- $m['title'] . " (" . $m['num'] . ")")));
+ $m['title'] . " (" . $m['num'] . ")"
+ )));
}
- if (!$args['noheader'])
+ if (!$args['noheader']) {
return HTML(HTML::h3(_("Blog Archives:")), $html);
- else
+ } else {
return $html;
- } else
+ }
+ } else {
return '';
+ }
}
// box is used to display a fixed-width, narrow version with common header
@@ -151,10 +169,14 @@
* @param string $basepage
* @return $this|HtmlElement
*/
- function box($args = '', $request = null, $basepage = '')
+ public function box($args = '', $request = null, $basepage = '')
{
- if (!$request) $request =& $GLOBALS['request'];
- if (!$args or empty($args['limit'])) $args['limit'] = 10;
+ 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));
}
Modified: trunk/lib/plugin/BlogJournal.php
===================================================================
--- trunk/lib/plugin/BlogJournal.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/BlogJournal.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -34,15 +34,14 @@
* @author: Reini Urban
*/
-class WikiPlugin_BlogJournal
- extends WikiPlugin_WikiBlog
+class WikiPlugin_BlogJournal extends WikiPlugin_WikiBlog
{
- function getDescription()
+ public function getDescription()
{
return _("Include latest blog entries for the current or ADMIN user.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array('count' => 7,
'user' => '',
@@ -59,11 +58,13 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
if (is_array($argstr)) { // can do with array also.
$args =& $argstr;
- if (!isset($args['order'])) $args['order'] = 'reverse';
+ if (!isset($args['order'])) {
+ $args['order'] = 'reverse';
+ }
} else {
$args = $this->getArgs($argstr, $request);
}
@@ -85,29 +86,40 @@
$parent = (empty($args['user']) ? '' : $args['user'] . '/');
$prefix = $base = $parent . $this->blogPrefix();
- if ($args['month'])
+ if ($args['month']) {
$prefix .= ('/' . $args['month']);
+ }
$pages = $dbi->titleSearch(new TextSearchQuery("^" . $prefix . '/', true, 'posix'));
$html = HTML();
$i = 0;
while (($page = $pages->next()) and $i < $args['count']) {
$rev = $page->getCurrentRevision(false);
- if ($rev->get('pagetype') != 'wikiblog') continue;
+ if ($rev->get('pagetype') != 'wikiblog') {
+ continue;
+ }
$i++;
$blog = $this->_blog($rev);
//$html->pushContent(HTML::h3(WikiLink($page, 'known', $rev->get('summary'))));
$html->pushContent($rev->getTransformedContent('wikiblog'));
}
- if ($args['user'] == $user->UserName() or $args['user'] == '')
- $html->pushContent(Button(array('action' => 'WikiBlog',
+ if ($args['user'] == $user->UserName() or $args['user'] == '') {
+ $html->pushContent(Button(
+ array('action' => 'WikiBlog',
'mode' => 'add'),
- _("New entry"), $base));
- if (!$i)
+ _("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);
- else
+ }
+ if (!$args['noheader']) {
+ return HTML(
+ HTML::h3(sprintf(_("Blog Entries for %s:"), $this->monthTitle($args['month']))),
+ $html
+ );
+ } else {
return $html;
+ }
}
}
Modified: trunk/lib/plugin/BoxRight.php
===================================================================
--- trunk/lib/plugin/BoxRight.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/BoxRight.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -26,20 +26,19 @@
* A simple plugin for <div class="boxright"> with wikimarkup
*/
-class WikiPlugin_BoxRight
- extends WikiPlugin
+class WikiPlugin_BoxRight extends WikiPlugin
{
- function getDescription()
+ public function getDescription()
{
return _("A simple plugin for <div class=boxright> with wikimarkup.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array();
}
- function managesValidators()
+ public function managesValidators()
{
// The plugin output will only change if the plugin
// invocation (page text) changes --- so the necessary
@@ -54,7 +53,7 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
if (!$basepage) {
return $this->error("$basepage unset?");
@@ -63,5 +62,4 @@
$page = $request->getPage($basepage);
return HTML::div(array('class' => 'boxright'), TransformText($argstr));
}
-
}
Modified: trunk/lib/plugin/CacheTest.php
===================================================================
--- trunk/lib/plugin/CacheTest.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/CacheTest.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -38,22 +38,21 @@
require_once 'lib/WikiPluginCached.php';
-class WikiPlugin_CacheTest
- extends WikiPluginCached
+class WikiPlugin_CacheTest extends WikiPluginCached
{
/* --------- overwrite abstract methods ---------------- */
- function getPluginType()
+ public function getPluginType()
{
return PLUGIN_CACHED_IMG_ONDEMAND;
}
- function getDescription()
+ public function getDescription()
{
return _('This is a simple example using WikiPluginCached.');
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array('text' => $this->getDescription(),
'font' => '3',
@@ -86,7 +85,7 @@
trigger_error('pure virtual', E_USER_ERROR);
}
- function getImageType($dbi, $argarray, $request)
+ public function getImageType($dbi, $argarray, $request)
{
extract($argarray);
if (in_array($type, array('png', 'gif', 'jpg'))) {
@@ -95,7 +94,7 @@
return 'png';
}
- function getAlt($dbi, $argarray, $request)
+ public function getAlt($dbi, $argarray, $request)
{
// ALT-text for <img> tag
extract($argarray);
@@ -102,7 +101,7 @@
return $text;
}
- function getExpire($dbi, $argarray, $request)
+ public function getExpire($dbi, $argarray, $request)
{
return '+600'; // 600 seconds life time
}
@@ -109,7 +108,7 @@
/* -------------------- extremely simple converter -------------------- */
- function produceGraphics($text, $font)
+ public 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
@@ -148,17 +147,19 @@
// we could have used the simple built-in text2img function
// instead of writing our own:
- function lazy_produceGraphics($text, $font)
+ public 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;
-
}
- return $this->text2img($text, $font, array(0, 0, 0),
- array(255, 255, 255));
+ return $this->text2img(
+ $text,
+ $font,
+ array(0, 0, 0),
+ array(255, 255, 255)
+ );
} // lazy_produceGraphics
-
}
Modified: trunk/lib/plugin/Calendar.php
===================================================================
--- trunk/lib/plugin/Calendar.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/Calendar.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -22,8 +22,9 @@
*
*/
-if (!defined('SECONDS_PER_DAY'))
+if (!defined('SECONDS_PER_DAY')) {
define('SECONDS_PER_DAY', 24 * 3600);
+}
// FIXME: Still needs:
//
@@ -34,19 +35,18 @@
// pages back to the calendar page. (Subpage support might make this
// easier.)
-class WikiPlugin_Calendar
- extends WikiPlugin
+class WikiPlugin_Calendar extends WikiPlugin
{
public $args;
private $_today;
public $_links;
- function getDescription()
+ public function getDescription()
{
return _("Calendar");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array('prefix' => '[pagename]' . '/',
'date_format' => '%Y-%m-%d',
@@ -66,11 +66,11 @@
* @param string $basepage The pagename the plugin is invoked from.
* @return array List of pagenames linked to (or false).
*/
- function getWikiPageLinks($argstr, $basepage)
+ public function getWikiPageLinks($argstr, $basepage)
{
- if (isset($this->_links))
+ if (isset($this->_links)) {
return $this->_links;
- else {
+ } else {
global $request;
$this->run($request->_dbi, $argstr, $request, $basepage);
return $this->_links;
@@ -89,25 +89,39 @@
$next_url = WikiURL($pagename, array('month' => $t['tm_mon'] + 1,
'year' => $t['tm_year'] + 1900));
- $prev = HTML::a(array('href' => $prev_url,
+ $prev = HTML::a(
+ array('href' => $prev_url,
'class' => 'cal-arrow',
'title' => _("Previous Month")),
- '<');
- $next = HTML::a(array('href' => $next_url,
+ '<'
+ );
+ $next = HTML::a(
+ array('href' => $next_url,
'class' => 'cal-arrow',
'title' => _("Next Month")),
- '>');
+ '>'
+ );
- $row = HTML::tr(HTML::td(array('class' => 'align-left'), $prev),
- HTML::td(array('class' => 'align-center'),
- HTML::strong(array('class' => 'cal-header'),
- strftime($args['month_format'],
- $time))),
- HTML::td(array('class' => 'align-right'), $next));
+ $row = HTML::tr(
+ HTML::td(array('class' => 'align-left'), $prev),
+ HTML::td(
+ array('class' => 'align-center'),
+ HTML::strong(
+ array('class' => 'cal-header'),
+ strftime(
+ $args['month_format'],
+ $time
+ )
+ )
+ ),
+ HTML::td(array('class' => 'align-right'), $next)
+ );
- return HTML::tr(HTML::td(array('colspan' => $args['display_weeknum'] ? 8 : 7,
+ return HTML::tr(HTML::td(
+ array('colspan' => $args['display_weeknum'] ? 8 : 7,
'class' => 'align-center'),
- HTML::table(array('class' => 'cal-header fullwidth'), $row)));
+ HTML::table(array('class' => 'cal-header fullwidth'), $row)
+ ));
}
private function __daynames($start_wday)
@@ -122,12 +136,17 @@
$fs = $this->args['wday_format'];
$row = HTML::tr();
$row->setAttr('class', 'cal-dayname');
- if ($this->args['display_weeknum'])
- $row->pushContent(HTML::td(array('class' => 'cal-dayname align-center'),
- _("Wk")));
+ if ($this->args['display_weeknum']) {
+ $row->pushContent(HTML::td(
+ array('class' => 'cal-dayname align-center'),
+ _("Wk")
+ ));
+ }
for ($i = 0; $i < 7; $i++) {
- $row->pushContent(HTML::td(array('class' => 'cal-dayname align-center'),
- strftime($fs, $time)));
+ $row->pushContent(HTML::td(
+ array('class' => 'cal-dayname align-center'),
+ strftime($fs, $time)
+ ));
$time += SECONDS_PER_DAY;
}
return $row;
@@ -137,8 +156,10 @@
{
$args = &$this->args;
- $page_for_date = $args['prefix'] . strftime($args['date_format'],
- $time);
+ $page_for_date = $args['prefix'] . strftime(
+ $args['date_format'],
+ $time
+ );
$t = localtime($time, 1);
$td = HTML::td(array('class' => 'align-center'));
@@ -154,18 +175,26 @@
if ($dbi->isWikiPage($page_for_date)) {
$this->_links[] = array('linkto' => $page_for_date);
- $date = HTML::a(array('class' => 'cal-day',
+ $date = HTML::a(
+ array('class' => 'cal-day',
'href' => WikiURL($page_for_date),
'title' => $page_for_date),
- HTML::em($mday));
+ HTML::em($mday)
+ );
} else {
- $date = HTML::a(array('class' => 'cal-hide',
+ $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);
+ '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;
@@ -178,7 +207,7 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
$this->args = $this->getArgs($argstr, $request);
$args = &$this->args;
@@ -188,9 +217,9 @@
foreach (array('month' => $now['tm_mon'] + 1,
'year' => $now['tm_year'] + 1900)
as $param => $dflt) {
-
- if (!($args[$param] = intval($args[$param])))
+ if (!($args[$param] = intval($args[$param]))) {
$args[$param] = $dflt;
+ }
}
$time = mktime(12, 0, 0, // hh, mm, ss,
@@ -198,28 +227,38 @@
1, // mday (1-31)
$args['year']);
- $cal = HTML::table(array('class' => 'cal'),
+ $cal = HTML::table(
+ array('class' => 'cal'),
HTML::thead(
- $this->__header($request->getArg('pagename'),
- $time),
- $this->__daynames($args['start_wday'])));
+ $this->__header(
+ $request->getArg('pagename'),
+ $time
+ ),
+ $this->__daynames($args['start_wday'])
+ )
+ );
$t = localtime($time, 1);
- if ($now['tm_year'] == $t['tm_year'] && $now['tm_mon'] == $t['tm_mon'])
+ if ($now['tm_year'] == $t['tm_year'] && $now['tm_mon'] == $t['tm_mon']) {
$this->_today = $now['tm_mday'];
- else
+ } else {
$this->_today = false;
+ }
$tbody = HTML::tbody();
$row = HTML::tr();
- if ($args['display_weeknum'])
- $row->pushContent(HTML::td(array('class' => 'cal-weeknum'),
- ((int)strftime("%U", $time)) + 1)); // %U problem. starts with 0
+ if ($args['display_weeknum']) {
+ $row->pushContent(HTML::td(
+ array('class' => 'cal-weeknum'),
+ ((int)strftime("%U", $time)) + 1
+ ));
+ } // %U problem. starts with 0
$col = (7 + $t['tm_wday'] - $args['start_wday']) % 7;
- if ($col > 0)
+ if ($col > 0) {
$row->pushContent(HTML::td(array('colspan' => $col)));
+ }
$done = false;
while (!$done) {
$row->pushContent($this->__date($dbi, $time));
@@ -233,9 +272,12 @@
$time += SECONDS_PER_DAY;
$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
+ if (!$col and !$done and $args['display_weeknum']) {
+ $row->pushContent(HTML::td(
+ array('class' => 'cal-weeknum'),
+ ((int)strftime("%U", $time)) + 1
+ ));
+ } // starts with 0
}
if ($row->getContent()) {
Modified: trunk/lib/plugin/CalendarList.php
===================================================================
--- trunk/lib/plugin/CalendarList.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/CalendarList.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -23,16 +23,21 @@
*/
// if not defined in config.ini
-if (!defined('PLUGIN_CALENDARLIST_ORDER'))
+if (!defined('PLUGIN_CALENDARLIST_ORDER')) {
define('PLUGIN_CALENDARLIST_ORDER', 'normal');
-if (!defined('PLUGIN_CALENDARLIST_NEXT_N_DAYS'))
+}
+if (!defined('PLUGIN_CALENDARLIST_NEXT_N_DAYS')) {
define('PLUGIN_CALENDARLIST_NEXT_N_DAYS', '');
-if (!defined('PLUGIN_CALENDARLIST_NEXT_N'))
+}
+if (!defined('PLUGIN_CALENDARLIST_NEXT_N')) {
define('PLUGIN_CALENDARLIST_NEXT_N', '');
-if (!defined('PLUGIN_CALENDARLIST_LAST_N_DAYS'))
+}
+if (!defined('PLUGIN_CALENDARLIST_LAST_N_DAYS')) {
define('PLUGIN_CALENDARLIST_LAST_N_DAYS', '');
-if (!defined('PLUGIN_CALENDARLIST_LAST_N'))
+}
+if (!defined('PLUGIN_CALENDARLIST_LAST_N')) {
define('PLUGIN_CALENDARLIST_LAST_N', '');
+}
/**
* This is a list of calendar appointments.
@@ -49,18 +54,17 @@
*
*/
-class WikiPlugin_CalendarList
- extends WikiPlugin
+class WikiPlugin_CalendarList extends WikiPlugin
{
public $args;
public $_links;
- function getDescription()
+ public function getDescription()
{
return _("CalendarList");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array('prefix' => '[pagename]',
'date_format' => '%Y-%m-%d',
@@ -87,11 +91,11 @@
* @param string $basepage The pagename the plugin is invoked from.
* @return array List of pagenames linked to (or false).
*/
- function getWikiPageLinks($argstr, $basepage)
+ public function getWikiPageLinks($argstr, $basepage)
{
- if (isset($this->_links))
+ if (isset($this->_links)) {
return $this->_links;
- else {
+ } else {
global $request;
$this->run($request->_dbi, $argstr, $request, $basepage);
return $this->_links;
@@ -112,7 +116,9 @@
$page_for_date = $args['prefix'] . '/' . $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
+ if ($n-- <= 0) {
+ break;
+ } // if we reached the limit, return the date
}
$t += 24 * 3600 * $direction; // advance one day back or forward
}
@@ -135,11 +141,15 @@
$c = $r->getContent();
include_once 'lib/BlockParser.php';
$content = TransformText(implode("\n", $c));
- $link = HTML::a(array('class' => 'cal-hide',
- 'href' => WikiURL($page_for_date,
- array('action' => 'edit')),
+ $link = HTML::a(
+ array('class' => 'cal-hide',
+ 'href' => WikiURL(
+ $page_for_date,
+ array('action' => 'edit')
+ ),
'title' => sprintf(_("Edit %s"), $page_for_date)),
- $date_string);
+ $date_string
+ );
$this->_links[] = array('linkto' => $page_for_date);
$a = array(HTML::dt($link), HTML::dd($content));
} else {
@@ -155,7 +165,7 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
$this->args = $this->getArgs($argstr, $request);
$args = &$this->args;
@@ -168,13 +178,18 @@
'year' => $now['tm_year'] + 1900,
'mday' => $now['tm_mday'])
as $param => $dflt) {
- if (!($args[$param] = intval($args[$param])))
+ if (!($args[$param] = intval($args[$param]))) {
$args[$param] = $dflt;
+ }
}
- $base = mktime(0, 0, 0, // h, m, s
+ $base = mktime(
+ 0,
+ 0,
+ 0, // h, m, s
$args['month'], // month 1-12
$args['mday'],
- $args['year']); // must have base 1900
+ $args['year']
+ ); // must have base 1900
// ***************************************************
// start of Plugin CalendarList display logic
Modified: trunk/lib/plugin/Chart.php
===================================================================
--- trunk/lib/plugin/Chart.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/Chart.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -45,17 +45,16 @@
* ALONE BASIS."
*/
-class WikiPlugin_Chart
- extends WikiPlugin
+class WikiPlugin_Chart extends WikiPlugin
{
public $source;
- function getDescription()
+ public function getDescription()
{
return _("Render SVG charts.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array('width' => 200,
'height' => 200,
@@ -68,7 +67,7 @@
);
}
- function handle_plugin_args_cruft($argstr, $args)
+ public function handle_plugin_args_cruft($argstr, $args)
{
$this->source = $argstr;
}
@@ -80,9 +79,8 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
-
global $WikiTheme;
$args = $this->getArgs($argstr, $request);
if (!$args['data']) {
@@ -165,22 +163,24 @@
class SVG_HTML extends HtmlElement
{
- function startTag()
+ public function startTag()
{
$start = "<" . $this->_tag;
$this->_setClasses();
foreach ($this->_attr as $attr => $val) {
if (is_bool($val)) {
- if (!$val)
+ if (!$val) {
continue;
+ }
$val = $attr;
}
$qval = str_replace("\"", '"', $this->_quote((string)$val));
- if ($attr == 'script')
+ if ($attr == 'script') {
// note the ' not "
$start .= " $attr='$qval'";
- else
+ } else {
$start .= " $attr=\"$qval\"";
+ }
}
$start .= ">";
return $start;
Modified: trunk/lib/plugin/Comment.php
===================================================================
--- trunk/lib/plugin/Comment.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/Comment.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -37,16 +37,15 @@
* >>
*/
-class WikiPlugin_Comment
- extends WikiPlugin
+class WikiPlugin_Comment extends WikiPlugin
{
- function getDescription()
+ public function getDescription()
{
return _("Embed hidden comments in WikiPages.");
}
// No arguments here.
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array();
}
@@ -58,7 +57,7 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
return HTML::raw('');
}
Modified: trunk/lib/plugin/CreateBib.php
===================================================================
--- trunk/lib/plugin/CreateBib.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/CreateBib.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -32,15 +32,14 @@
* @author: Lea Viljanen
*/
-class WikiPlugin_CreateBib
- extends WikiPlugin
+class WikiPlugin_CreateBib extends WikiPlugin
{
- function getDescription()
+ public function getDescription()
{
return _("Automatically create a Bibtex file from linked pages.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array('pagename' => '[pagename]'); // The page from which the BibTex file is generated
}
@@ -58,13 +57,14 @@
for ($i = 0; $i < count($content); $i++) {
if (preg_match('/^@/', $content[$i], $match)) {
$start = true;
- }
- else if (preg_match('/^\}/', $content[$i], $match)) {
+ } elseif (preg_match('/^\}/', $content[$i], $match)) {
$stop = true;
}
if ($start) {
$bib[] = $content[$i];
- if ($stop) $start = false;
+ if ($stop) {
+ $start = false;
+ }
}
}
return $bib;
@@ -104,7 +104,7 @@
$zip = new ZipArchive();
$tmp_filename = "/tmp/" . $filename;
if (file_exists($tmp_filename)) {
- unlink ($tmp_filename);
+ unlink($tmp_filename);
}
if ($zip->open($tmp_filename, ZipArchive::CREATE) !== true) {
trigger_error(_("Cannot create ZIP archive"), E_USER_ERROR);
@@ -127,7 +127,7 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
extract($this->getArgs($argstr, $request));
if (!empty($pagename)) {
Modified: trunk/lib/plugin/CreatePage.php
===================================================================
--- trunk/lib/plugin/CreatePage.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/CreatePage.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -37,15 +37,14 @@
include_once 'lib/plugin/Template.php';
-class WikiPlugin_CreatePage
- extends WikiPlugin_Template
+class WikiPlugin_CreatePage extends WikiPlugin_Template
{
- function getDescription()
+ public function getDescription()
{
return _("Create a wiki page by the provided name.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array('s' => false,
'initial_content' => '',
@@ -62,7 +61,7 @@
* @param string $basepage
* @return HTML|XmlContent
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
extract($this->getArgs($argstr, $request));
@@ -102,8 +101,7 @@
if (strlen($url) > 255
or ($param['template'])
or preg_match('/%%\w+%%/', $initial_content)
- ) // need variable expansion
- {
+ ) { // need variable expansion
unset($param['initial_content']);
$url = WikiURL($s, $param, 'absurl');
$page = $dbi->getPage($s);
@@ -121,8 +119,11 @@
$initial_content = $currenttmpl->getPackedContent();
if (preg_match('/<noinclude>.+<\/noinclude>/s', $initial_content)) {
- $initial_content = preg_replace("/<noinclude>.+?<\/noinclude>/s", "",
- $initial_content);
+ $initial_content = preg_replace(
+ "/<noinclude>.+?<\/noinclude>/s",
+ "",
+ $initial_content
+ );
}
}
$meta['summary'] = _("Created by CreatePage");
Modified: trunk/lib/plugin/CreateToc.php
===================================================================
--- trunk/lib/plugin/CreateToc.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/CreateToc.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -36,18 +36,18 @@
* - bug #969495 "existing labels not honored" seems to be fixed.
*/
-if (!defined('TOC_FULL_SYNTAX'))
+if (!defined('TOC_FULL_SYNTAX')) {
define('TOC_FULL_SYNTAX', 1);
+}
-class WikiPlugin_CreateToc
- extends WikiPlugin
+class WikiPlugin_CreateToc extends WikiPlugin
{
- function getDescription()
+ public function getDescription()
{
return _("Create a Table of Contents and automatically link to headers.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array(
'extracollapse' => true, // provide an entry +/- link to collapse
@@ -79,7 +79,6 @@
private function roman_counter($number)
{
-
$n = intval($number);
$result = '';
@@ -114,8 +113,9 @@
$str = $counter[1];
}
for ($i = 2; $i <= 5; $i++) {
- if ($counter[$i] != 0)
+ if ($counter[$i] != 0) {
$str .= '.' . $counter[$i];
+ }
}
return $str;
}
@@ -123,7 +123,6 @@
// Get HTML header corresponding to current level (level is set of ! or =)
private function getHeader($level)
{
-
$count = substr_count($level, '!');
switch ($count) {
case 3:
@@ -167,8 +166,15 @@
* @param $hstart id (in $content) of heading start
* @param $hend id (in $content) of heading end
*/
- private function searchHeader($content, $start_index, $heading,
- $level, &$hstart, &$hend, $basepage = false)
+ private function searchHeader(
+ $content,
+ $start_index,
+ $heading,
+ $level,
+ &$hstart,
+ &$hend,
+ $basepage = false
+ )
{
$hstart = 0;
$hend = 0;
@@ -176,10 +182,13 @@
$qheading = $this->quote($heading);
for ($j = $start_index; $j < count($content); $j++) {
if (is_string($content[$j])) {
- if (preg_match("/<$h>$qheading<\/$h>/",
- $content[$j])
+ if (preg_match(
+ "/<$h>$qheading<\/$h>/",
+ $content[$j]
)
+ ) {
return $j;
+ }
} elseif (is_a($content[$j], 'cached_link')) {
if (method_exists($content[$j], 'asXML')) {
$content[$j]->_basepage = $basepage;
@@ -245,10 +254,19 @@
// We must omit lines starting with "!" if inside a Mediawiki table
// (they represent a table header)
// Feature request: proper nesting; multiple levels (e.g. 1,3)
- private function extractHeaders(&$content, &$markup, $backlink,
- $counter, $levels, $firstlevelstyle, $basepage)
+ private function extractHeaders(
+ &$content,
+ &$markup,
+ $backlink,
+ $counter,
+ $levels,
+ $firstlevelstyle,
+ $basepage
+ )
{
- if (!$levels) $levels = array(1, 2);
+ if (!$levels) {
+ $levels = array(1, 2);
+ }
$tocCounter = array(1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0);
reset($levels);
sort($levels);
@@ -280,7 +298,9 @@
continue;
}
foreach ($levels as $level) {
- if ($level < 1 or $level > 5) continue;
+ if ($level < 1 or $level > 5) {
+ continue;
+ }
$phpwikiclassiclevel = 4 - $level;
$wikicreolelevel = $level + 1;
$trim = trim($content[$i]);
@@ -314,14 +334,21 @@
/* Url for backlink */
$url = WikiURL(new WikiPageName($basepage, false, "TOC"));
- $j = $this->searchHeader($markup->_content, $j, $s,
- $match[1], $hstart, $hend,
- $markup->_basepage);
+ $j = $this->searchHeader(
+ $markup->_content,
+ $j,
+ $s,
+ $match[1],
+ $hstart,
+ $hend,
+ $markup->_basepage
+ );
if ($j and isset($markup->_content[$j])) {
$x = $markup->_content[$j];
$qheading = $this->quote($s);
- if ($counter)
+ if ($counter) {
$counterString = $this->getCounter($tocCounter, $firstlevelstyle);
+ }
if (($hstart === 0) && is_string($markup->_content[$j])) {
if ($backlink) {
if ($counter) {
@@ -335,13 +362,20 @@
$anchorString .= "$counterString - ";
}
}
- if ($x = preg_replace('/(<h\d>)(' . $qheading . ')(<\/h\d>)/',
- "\$1$anchorString\$2\$3", $x, 1)
+ if ($x = preg_replace(
+ '/(<h\d>)(' . $qheading . ')(<\/h\d>)/',
+ "\$1$anchorString\$2\$3",
+ $x,
+ 1
+ )
) {
if ($backlink) {
- $x = preg_replace('/(<h\d>)(' . $qheading . ')(<\/h\d>)/',
+ $x = preg_replace(
+ '/(<h\d>)(' . $qheading . ')(<\/h\d>)/',
"\$1$anchorString\$3",
- $markup->_content[$j], 1);
+ $markup->_content[$j],
+ 1
+ );
}
$markup->_content[$j] = $x;
}
@@ -359,15 +393,23 @@
}
} else {
$anchorString = "\$1<a id=\"$manchor\"></a>";
- if ($counter)
+ if ($counter) {
$anchorString .= "$counterString - ";
+ }
}
- $x = preg_replace("/(<$h>)(?!.*<\/$h>)/",
- $anchorString, $x, 1);
+ $x = preg_replace(
+ "/(<$h>)(?!.*<\/$h>)/",
+ $anchorString,
+ $x,
+ 1
+ );
if ($backlink) {
- $x = preg_replace("/(<$h>)(?!.*<\/$h>)/",
+ $x = preg_replace(
+ "/(<$h>)(?!.*<\/$h>)/",
$anchorString,
- $markup->_content[$hstart], 1);
+ $markup->_content[$hstart],
+ 1
+ );
}
$markup->_content[$hstart] = $x;
}
@@ -386,7 +428,7 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
global $WikiTheme;
extract($this->getArgs($argstr, $request));
@@ -477,8 +519,10 @@
// Check if user is allowed to get the page.
if (!mayAccessPage('view', $pagename)) {
- return $this->error(sprintf(_("Illegal access to page %s: no read access"),
- $pagename));
+ return $this->error(sprintf(
+ _("Illegal access to page %s: no read access"),
+ $pagename
+ ));
}
$page = $dbi->getPage($pagename);
@@ -489,8 +533,11 @@
}
$r = $page->getRevision($version);
if ((!$r) || ($r->hasDefaultContents())) {
- return $this->error(sprintf(_("%s: no such revision %d."),
- $pagename, $version));
+ return $this->error(sprintf(
+ _("%s: no such revision %d."),
+ $pagename,
+ $version
+ ));
}
} else {
$r = $page->getCurrentRevision();
@@ -524,11 +571,18 @@
$levels[] = $level;
}
}
- if (TOC_FULL_SYNTAX)
+ if (TOC_FULL_SYNTAX) {
require_once 'lib/InlineParser.php';
- if ($headers = $this->extractHeaders($content, $dbi->_markup,
- $with_toclink, $with_counter,
- $levels, $firstlevelstyle, $basepage)
+ }
+ if ($headers = $this->extractHeaders(
+ $content,
+ $dbi->_markup,
+ $with_toclink,
+ $with_counter,
+ $levels,
+ $firstlevelstyle,
+ $basepage
+ )
) {
foreach ($headers as $h) {
// proper heading indent
@@ -538,8 +592,7 @@
$li = WikiLink($link, 'known', $h['text']);
// Hack to suppress pagename before #
// $li->_attr["href"] = strstr($li->_attr["href"], '#');
- $list->pushContent(HTML::p(HTML::raw
- (str_repeat($indentstr, $indent)), $li));
+ $list->pushContent(HTML::p(HTML::raw(str_repeat($indentstr, $indent)), $li));
}
}
$list->setAttr('style', 'display:' . ($jshide ? 'none;' : 'block;'));
@@ -549,7 +602,8 @@
} else {
$toctoggleid = GenerateId("toctoggle");
if ($extracollapse) {
- $toclink = HTML(_("Table of Contents"),
+ $toclink = HTML(
+ _("Table of Contents"),
" ",
HTML::a(array('id' => 'TOC')),
HTML::img(array(
@@ -558,7 +612,8 @@
'title' => ($jshide ? _('Click to display the TOC') : _('Click to hide the TOC')),
'onclick' => "toggletoc(this, '" . $open . "', '" . $close . "', '" . $toclistid . "', '" . _('Click to display the TOC') . "', '" . _('Click to hide the TOC') . "')",
'alt' => 'toctoggle',
- 'src' => $jshide ? $close : $open)));
+ 'src' => $jshide ? $close : $open))
+ );
} else {
$toclink = HTML(_("Table of Contents"), HTML::a(array('id' => 'TOC')));
}
Modified: trunk/lib/plugin/CurrentTime.php
===================================================================
--- trunk/lib/plugin/CurrentTime.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/CurrentTime.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -52,21 +52,20 @@
* <<CurrentTime format=XXX >>
*/
-class WikiPlugin_CurrentTime
- extends WikiPlugin
+class WikiPlugin_CurrentTime extends WikiPlugin
{
- function getDescription()
+ public function getDescription()
{
return _("Display current time and date.");
}
// Establish default values for each of this plugin's arguments.
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array('format' => '%Y-%m-%d %T');
}
- function handle_plugin_args_cruft($argstr, $args)
+ public function handle_plugin_args_cruft($argstr, $args)
{
}
@@ -77,7 +76,7 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
$format = $args['format'];
Modified: trunk/lib/plugin/DeadEndPages.php
===================================================================
--- trunk/lib/plugin/DeadEndPages.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/DeadEndPages.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -26,7 +26,6 @@
require_once 'lib/plugin/OrphanedPages.php';
-class WikiPlugin_DeadEndPages
- extends WikiPlugin_OrphanedPages
+class WikiPlugin_DeadEndPages extends WikiPlugin_OrphanedPages
{
}
Modified: trunk/lib/plugin/DebugAuthInfo.php
===================================================================
--- trunk/lib/plugin/DebugAuthInfo.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/DebugAuthInfo.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -32,15 +32,14 @@
* Warning! This may display db and user passwords in cleartext.
*/
-class WikiPlugin_DebugAuthInfo
- extends WikiPlugin
+class WikiPlugin_DebugAuthInfo extends WikiPlugin
{
- function getDescription()
+ public function getDescription()
{
return _("Display general and user specific auth information.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array('userid' => '');
}
@@ -52,7 +51,7 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
extract($args);
@@ -69,24 +68,37 @@
$html = HTML(HTML::h2(fmt("General Auth Settings")));
$table = HTML::table(array('class' => 'bordered'));
- $table->pushContent($this->show_hash("AUTH DEFINES",
+ $table->pushContent($this->show_hash(
+ "AUTH DEFINES",
$this->buildConstHash(
array("ALLOW_ANON_USER",
"ALLOW_ANON_EDIT", "ALLOW_BOGO_LOGIN",
"REQUIRE_SIGNIN_BEFORE_EDIT", "ALLOW_USER_PASSWORDS",
- "PASSWORD_LENGTH_MINIMUM", "USE_DB_SESSION"))));
- if (in_array("LDAP", $GLOBALS['USER_AUTH_ORDER']))
- $table->pushContent($this->show_hash("LDAP DEFINES",
- $this->buildConstHash(array("LDAP_AUTH_HOST", "LDAP_BASE_DN"))));
- if (in_array("IMAP", $GLOBALS['USER_AUTH_ORDER']))
+ "PASSWORD_LENGTH_MINIMUM", "USE_DB_SESSION")
+ )
+ ));
+ if (in_array("LDAP", $GLOBALS['USER_AUTH_ORDER'])) {
+ $table->pushContent($this->show_hash(
+ "LDAP DEFINES",
+ $this->buildConstHash(array("LDAP_AUTH_HOST", "LDAP_BASE_DN"))
+ ));
+ }
+ if (in_array("IMAP", $GLOBALS['USER_AUTH_ORDER'])) {
$table->pushContent($this->show_hash("IMAP DEFINES", array("IMAP_AUTH_HOST" => IMAP_AUTH_HOST)));
- if (defined('AUTH_USER_FILE') or in_array("File", $GLOBALS['USER_AUTH_ORDER']))
- $table->pushContent($this->show_hash("AUTH_USER_FILE",
+ }
+ if (defined('AUTH_USER_FILE') or in_array("File", $GLOBALS['USER_AUTH_ORDER'])) {
+ $table->pushContent($this->show_hash(
+ "AUTH_USER_FILE",
$this->buildConstHash(array("AUTH_USER_FILE",
- "AUTH_USER_FILE_STORABLE"))));
- if (defined('GROUP_METHOD'))
- $table->pushContent($this->show_hash("GROUP_METHOD",
- $this->buildConstHash(array("GROUP_METHOD", "AUTH_GROUP_FILE", "GROUP_LDAP_QUERY"))));
+ "AUTH_USER_FILE_STORABLE"))
+ ));
+ }
+ if (defined('GROUP_METHOD')) {
+ $table->pushContent($this->show_hash(
+ "GROUP_METHOD",
+ $this->buildConstHash(array("GROUP_METHOD", "AUTH_GROUP_FILE", "GROUP_LDAP_QUERY"))
+ ));
+ }
$table->pushContent($this->show_hash("\$USER_AUTH_ORDER[]", $GLOBALS['USER_AUTH_ORDER']));
$table->pushContent($this->show_hash("USER_AUTH_POLICY", array("USER_AUTH_POLICY" => USER_AUTH_POLICY)));
$DBParams = $GLOBALS['DBParams'];
@@ -93,10 +105,11 @@
$DBParams['dsn'] = class_exists('WikiDB_SQL') ? WikiDB_SQL::view_dsn($DBParams['dsn']) : '';
$table->pushContent($this->show_hash("\$DBParams[]", $DBParams));
$DBAuthParams = $GLOBALS['DBAuthParams'];
- if (isset($DBAuthParams['auth_dsn']) and class_exists('WikiDB_SQL'))
+ if (isset($DBAuthParams['auth_dsn']) and class_exists('WikiDB_SQL')) {
$DBAuthParams['auth_dsn'] = WikiDB_SQL::view_dsn($DBAuthParams['auth_dsn']);
- else
+ } else {
$DBAuthParams['auth_dsn'] = '';
+ }
unset($DBAuthParams['dummy']);
$table->pushContent($this->show_hash("\$DBAuthParams[]", $DBAuthParams));
$html->pushContent($table);
@@ -153,51 +166,69 @@
return HTML();
}
- if ($heading)
- $rows[] = HTML::tr(array(
+ if ($heading) {
+ $rows[] = HTML::tr(
+ array(
'style' => 'color:black; background-color:#ffcccc'),
- HTML::td(array('colspan' => 2,
+ HTML::td(
+ array('colspan' => 2,
'style' => 'color:black'),
- $heading));
- if (is_object($hash))
+ $heading
+ )
+ );
+ }
+ if (is_object($hash)) {
$hash = $this->obj2hash($hash);
+ }
if (!empty($hash)) {
ksort($hash);
foreach ($hash as $key => $val) {
if (is_object($val)) {
$heading = "Object of " . get_class($val);
- if ($depth > 3)
+ if ($depth > 3) {
$val = $heading;
- elseif ($heading == "Object of wikidb_sql")
+ } elseif ($heading == "Object of wikidb_sql") {
$val = $heading;
- elseif (substr($heading, 0, 13) == "Object of db_")
+ } elseif (substr($heading, 0, 13) == "Object of db_") {
$val = $heading;
- elseif (!isset($seen[$heading])) {
+ } elseif (!isset($seen[$heading])) {
//if (empty($seen[$heading])) $seen[$heading] = 1;
- $val = HTML::table(array('class' => 'bordered'),
- $this->show_hash($heading, $this->obj2hash($val), $depth + 1));
+ $val = HTML::table(
+ array('class' => 'bordered'),
+ $this->show_hash($heading, $this->obj2hash($val), $depth + 1)
+ );
} else {
$val = $heading;
}
} elseif (is_array($val)) {
$heading = $key . "[]";
- if ($depth > 3)
+ if ($depth > 3) {
$val = $heading;
- elseif (!isset($seen[$heading])) {
+ } elseif (!isset($seen[$heading])) {
//if (empty($seen[$heading])) $seen[$heading] = 1;
- $val = HTML::table(array('class' => 'bordered'),
- $this->show_hash($heading, $val, $depth + 1));
+ $val = HTML::table(
+ array('class' => 'bordered'),
+ $this->show_hash($heading, $val, $depth + 1)
+ );
} else {
$val = $heading;
}
}
- $rows[] = HTML::tr(HTML::td(array('class' => 'align-right',
+ $rows[] = HTML::tr(
+ HTML::td(
+ array('class' => 'align-right',
'style' => 'color:black; background-color:#ccc'),
- HTML(HTML::raw(' '), $key,
- HTML::raw(' '))),
- HTML::td(array(
+ HTML(
+ HTML::raw(' '),
+ $key,
+ HTML::raw(' ')
+ )
+ ),
+ HTML::td(
+ array(
'style' => 'color:black; background-color:white'),
- $val ? $val : HTML::raw(' '))
+ $val ? $val : HTML::raw(' ')
+ )
);
//if (empty($seen[$key])) $seen[$key] = 1;
}
@@ -210,10 +241,11 @@
$hash = array();
foreach ($constants as $c) {
$hash[$c] = defined($c) ? constant($c) : '<empty>';
- if ($hash[$c] === false)
+ if ($hash[$c] === false) {
$hash[$c] = 'false';
- elseif ($hash[$c] === true)
+ } elseif ($hash[$c] === true) {
$hash[$c] = 'true';
+ }
}
return $hash;
}
Modified: trunk/lib/plugin/DebugBackendInfo.php
===================================================================
--- trunk/lib/plugin/DebugBackendInfo.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/DebugBackendInfo.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -24,19 +24,18 @@
require_once 'lib/Template.php';
-class WikiPlugin_DebugBackendInfo
- extends WikiPlugin
+class WikiPlugin_DebugBackendInfo extends WikiPlugin
{
public $chunk_split;
public $readonly_pagemeta;
public $hidden_pagemeta;
- function getDescription()
+ public function getDescription()
{
return sprintf(_("Get debugging information for %s."), '[pagename]');
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array('page' => '[pagename]',
'notallversions' => false);
@@ -49,7 +48,7 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
extract($args);
@@ -101,8 +100,10 @@
$vdata = $backend->get_versiondata($page, $version, true);
$this->_fixupData($vdata);
$table->pushContent(HTML::tr(HTML::td(array('colspan' => 2))));
- $table->pushContent($this->_showhash("get_versiondata('$page',$version)",
- $vdata));
+ $table->pushContent($this->_showhash(
+ "get_versiondata('$page',$version)",
+ $vdata
+ ));
} else {
for ($version = $backend->get_latest_version($page);
$version;
@@ -110,23 +111,28 @@
$vdata = $backend->get_versiondata($page, $version, true);
$this->_fixupData($vdata);
$table->pushContent(HTML::tr(HTML::td(array('colspan' => 2))));
- $table->pushContent($this->_showhash("get_versiondata('$page',$version)",
- $vdata));
+ $table->pushContent($this->_showhash(
+ "get_versiondata('$page',$version)",
+ $vdata
+ ));
}
}
$linkdata = $backend->get_links($page, false);
- if ($linkdata->count())
+ if ($linkdata->count()) {
$table->pushContent($this->_showhash("get_links('$page')", $linkdata->asArray()));
+ }
$relations = $backend->get_links($page, false, false, false, false, false);
if ($relations->count()) {
$table->pushContent($this->_showhash("get_relations('$page')", array()));
- while ($rel = $relations->next())
+ while ($rel = $relations->next()) {
$table->pushContent($this->_showhash(false, $rel));
+ }
}
$linkdata = $backend->get_links($page);
- if ($linkdata->count())
+ if ($linkdata->count()) {
$table->pushContent($this->_showhash("get_backlinks('$page')", $linkdata->asArray()));
+ }
$html->pushContent($table);
return $html;
@@ -138,7 +144,9 @@
*/
protected function _fixupData(&$data, $prefix = '')
{
- if (!is_array($data)) return;
+ if (!is_array($data)) {
+ return;
+ }
global $request;
$user = $request->getUser();
@@ -162,13 +170,17 @@
// how to indent this table?
$val = unserialize($val);
$this->_fixupData($val, $fullkey);
- $data[$key] = HTML::table(array('class' => 'bordered'),
- $this->_showhash(false, $val, $fullkey));
+ $data[$key] = HTML::table(
+ array('class' => 'bordered'),
+ $this->_showhash(false, $val, $fullkey)
+ );
} elseif (is_array($val)) {
// how to indent this table?
$this->_fixupData($val, $fullkey);
- $data[$key] = HTML::table(array('class' => 'bordered'),
- $this->_showhash(false, $val, $fullkey));
+ $data[$key] = HTML::table(
+ array('class' => 'bordered'),
+ $this->_showhash(false, $val, $fullkey)
+ );
} elseif (is_object($val)) {
// how to indent this table?
ob_start();
@@ -175,13 +187,16 @@
print_r($val);
$val = HTML::pre(ob_get_contents());
ob_end_clean();
- $data[$key] = HTML::table(array('class' => 'bordered'),
- $this->_showhash(false, $val, $fullkey));
+ $data[$key] = HTML::table(
+ array('class' => 'bordered'),
+ $this->_showhash(false, $val, $fullkey)
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
_______________________________________________
phpwiki-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/phpwiki-checkins