From: <var...@us...> - 2011-12-16 13:26:24
|
Revision: 8212 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8212&view=rev Author: vargenau Date: 2011-12-16 13:26:15 +0000 (Fri, 16 Dec 2011) Log Message: ----------- Consistent messages for missing required arguments Modified Paths: -------------- trunk/lib/plugin/AddComment.php trunk/lib/plugin/Chart.php trunk/lib/plugin/CreateBib.php trunk/lib/plugin/CreateToc.php trunk/lib/plugin/FileInfo.php trunk/lib/plugin/GoogleMaps.php trunk/lib/plugin/IncludePage.php trunk/lib/plugin/ModeratedPage.php trunk/lib/plugin/PageGroup.php trunk/lib/plugin/SyntaxHighlighter.php trunk/lib/plugin/Template.php trunk/lib/plugin/WikiForum.php trunk/lib/plugin/WikiPoll.php Modified: trunk/lib/plugin/AddComment.php =================================================================== --- trunk/lib/plugin/AddComment.php 2011-12-16 11:54:21 UTC (rev 8211) +++ trunk/lib/plugin/AddComment.php 2011-12-16 13:26:15 UTC (rev 8212) @@ -69,8 +69,9 @@ function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); - if (!$args['pagename']) - return $this->error(_("No pagename specified")); + if (!$args['pagename']) { + return $this->error(sprintf(_("A required argument '%s' is missing."), 'pagename')); + } // Get our form args. $comment = $request->getArg("comment"); Modified: trunk/lib/plugin/Chart.php =================================================================== --- trunk/lib/plugin/Chart.php 2011-12-16 11:54:21 UTC (rev 8211) +++ trunk/lib/plugin/Chart.php 2011-12-16 13:26:15 UTC (rev 8212) @@ -62,7 +62,7 @@ // 'ylabel' => 'y', // TODO 'color' => 'green', // 'legend' => false, // TODO - 'data' => false // mandatory + 'data' => false // required ); } function handle_plugin_args_cruft(&$argstr, &$args) { @@ -74,7 +74,7 @@ global $WikiTheme; $args = $this->getArgs($argstr, $request); if (!$args['data']) { - return $this->error(sprintf(_("No mandatory '%s' argument provided."), 'data')); + return $this->error(sprintf(_("A required argument '%s' is missing."), 'data')); } extract($args); Modified: trunk/lib/plugin/CreateBib.php =================================================================== --- trunk/lib/plugin/CreateBib.php 2011-12-16 11:54:21 UTC (rev 8211) +++ trunk/lib/plugin/CreateBib.php 2011-12-16 13:26:15 UTC (rev 8212) @@ -108,7 +108,7 @@ $pagename = $page->name; } if (!$pagename) { - return $this->error(_("no page specified")); + return $this->error(sprintf(_("A required argument '%s' is missing."), 'pagename')); } // Get the links page contents Modified: trunk/lib/plugin/CreateToc.php =================================================================== --- trunk/lib/plugin/CreateToc.php 2011-12-16 11:54:21 UTC (rev 8211) +++ trunk/lib/plugin/CreateToc.php 2011-12-16 13:26:15 UTC (rev 8212) @@ -375,7 +375,7 @@ $pagename = $page->name; } if (!$pagename) { - return $this->error(_("No page specified.")); + return $this->error(sprintf(_("A required argument '%s' is missing."), 'pagename')); } if (isBrowserIE() and browserDetect("Mac")) { $jshide = 0; Modified: trunk/lib/plugin/FileInfo.php =================================================================== --- trunk/lib/plugin/FileInfo.php 2011-12-16 11:54:21 UTC (rev 8211) +++ trunk/lib/plugin/FileInfo.php 2011-12-16 13:26:15 UTC (rev 8212) @@ -50,17 +50,19 @@ 'display' => false, // version,phonysize,size,date,mtime,owner,name,path,dirname,link. (required) 'format' => false, // printf format string with %s only, all display modes 'quiet' => false // print no error if file not found - // from above vars return strings (optional) + // from above vars return strings (optional) ); } function run($dbi, $argstr, &$request, $basepage) { - $args = $this->getArgs($argstr, $request); + $args = $this->getArgs($argstr, $request); extract($args); - if (!$file) + if (!$file) { return $this->error(sprintf(_("A required argument '%s' is missing."), 'file')); - if (!$display) + } + if (!$display) { return $this->error(sprintf(_("A required argument '%s' is missing."), 'display')); + } if (string_starts_with($file, "Upload:")) { $file = preg_replace("/^Upload:(.*)$/", getUploadFilePath()."\\1", $file); $is_Upload = 1; Modified: trunk/lib/plugin/GoogleMaps.php =================================================================== --- trunk/lib/plugin/GoogleMaps.php 2011-12-16 11:54:21 UTC (rev 8211) +++ trunk/lib/plugin/GoogleMaps.php 2011-12-16 13:26:15 UTC (rev 8212) @@ -88,10 +88,10 @@ extract($args); if ($Longitude === '') { - return $this->error(fmt("%s parameter missing", "'Longitude'")); + return $this->error(sprintf(_("A required argument '%s' is missing."), 'Longitude')); } if ($Latitude === '') { - return $this->error(fmt("%s parameter missing", "'Latitude'")); + return $this->error(sprintf(_("A required argument '%s' is missing."), 'Latitude')); } $maps = JavaScript('',array('src'=>"http://maps.google.com/maps?file=api&v=1&key=" . GOOGLE_LICENSE_KEY)); Modified: trunk/lib/plugin/IncludePage.php =================================================================== --- trunk/lib/plugin/IncludePage.php 2011-12-16 11:54:21 UTC (rev 8211) +++ trunk/lib/plugin/IncludePage.php 2011-12-16 13:26:15 UTC (rev 8212) @@ -75,7 +75,7 @@ $page = $page->name; } if (!$page) { - return $this->error(_("no page specified")); + return $this->error(sprintf(_("A required argument '%s' is missing."), 'page')); } // A page can include itself once (this is needed, e.g., when editing Modified: trunk/lib/plugin/ModeratedPage.php =================================================================== --- trunk/lib/plugin/ModeratedPage.php 2011-12-16 11:54:21 UTC (rev 8211) +++ trunk/lib/plugin/ModeratedPage.php 2011-12-16 13:26:15 UTC (rev 8212) @@ -59,8 +59,9 @@ // Handle moderation request from urls sent by email if (!empty($args['id']) and !empty($args['pass'])) { - if (!$args['page']) - return $this->error("No page specified"); + if (!$args['page']) { + return $this->error(sprintf(_("A required argument '%s' is missing."), 'page')); + } $page = $dbi->getPage($args['page']); if ($moderated = $page->get("moderated")) { if (array_key_exists($args['id'], $moderated['data'])) { Modified: trunk/lib/plugin/PageGroup.php =================================================================== --- trunk/lib/plugin/PageGroup.php 2011-12-16 11:54:21 UTC (rev 8211) +++ trunk/lib/plugin/PageGroup.php 2011-12-16 13:26:15 UTC (rev 8212) @@ -92,11 +92,7 @@ $args = $this->getArgs($argstr, $request); extract($args); if (empty($parent)) { - // FIXME: WikiPlugin has no way to report when - // required args are missing? - $error_text = sprintf("%s: ", "WikiPlugin_" .$this->getName()); - $error_text .= sprintf(_("A required argument '%s' is missing."), 'parent'); - return HTML::div(array('class' => "error"), $error_text); + return $this->error(sprintf(_("A required argument '%s' is missing."), 'parent')); } $directions = array ('next' => _("Next"), 'previous' => _("Previous"), Modified: trunk/lib/plugin/SyntaxHighlighter.php =================================================================== --- trunk/lib/plugin/SyntaxHighlighter.php 2011-12-16 11:54:21 UTC (rev 8211) +++ trunk/lib/plugin/SyntaxHighlighter.php 2011-12-16 13:26:15 UTC (rev 8212) @@ -122,7 +122,9 @@ function run($dbi, $argstr, &$request, $basepage) { extract($this->getArgs($argstr, $request)); $source =& $this->source; - if (empty($syntax)) return $this->error(_("Syntax language not specified.")); + if (empty($syntax)) { + return $this->error(sprintf(_("A required argument '%s' is missing."), 'syntax')); + } if (!empty($source)) { $args = ""; if (defined('HIGHLIGHT_DATA_DIR')) Modified: trunk/lib/plugin/Template.php =================================================================== --- trunk/lib/plugin/Template.php 2011-12-16 11:54:21 UTC (rev 8211) +++ trunk/lib/plugin/Template.php 2011-12-16 13:26:15 UTC (rev 8212) @@ -105,7 +105,7 @@ $page = $page->name; } if (!$page) { - return $this->error(_("No page specified.")); + return $this->error(sprintf(_("A required argument '%s' is missing."), 'page')); } // If "Template:$page" exists, use it Modified: trunk/lib/plugin/WikiForum.php =================================================================== --- trunk/lib/plugin/WikiForum.php 2011-12-16 11:54:21 UTC (rev 8211) +++ trunk/lib/plugin/WikiForum.php 2011-12-16 13:26:15 UTC (rev 8212) @@ -67,8 +67,9 @@ function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); - if (!$args['pagename']) - return $this->error(_("No pagename specified")); + if (!$args['pagename']) { + return $this->error(sprintf(_("A required argument '%s' is missing."), 'pagename')); + } // Get our form args. $forum = $request->getArg('forum'); Modified: trunk/lib/plugin/WikiPoll.php =================================================================== --- trunk/lib/plugin/WikiPoll.php 2011-12-16 11:54:21 UTC (rev 8211) +++ trunk/lib/plugin/WikiPoll.php 2011-12-16 13:26:15 UTC (rev 8212) @@ -139,8 +139,9 @@ $_SERVER =& $GLOBALS['HTTP_SERVER_VARS']; $request->setArg('nocache','purge'); $args = $this->getArgs($argstr, $request); - if (!$args['page']) - return $this->error("No page specified"); + if (!$args['page']) { + return $this->error(sprintf(_("A required argument '%s' is missing."), 'page')); + } if (!empty($args['admin']) and $request->_user->isAdmin()) { // reset statistics return $this->doPollAdmin($dbi, $request, $page); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |