From 7497367341b4d16e7ea16ea9323896cd8d978287 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Fri, 3 Sep 2004 16:51:45 +0000 Subject: [PATCH] phpdocumentor comments placeholders --- includes/DateFormatter.php | 69 +++++++++++++++++------- includes/EditPage.php | 81 +++++++++++++++++----------- includes/Feed.php | 105 +++++++++++++++++++++++++++++-------- 3 files changed, 183 insertions(+), 72 deletions(-) diff --git a/includes/DateFormatter.php b/includes/DateFormatter.php index 6a8abf977e..bf38aa7d56 100755 --- a/includes/DateFormatter.php +++ b/includes/DateFormatter.php @@ -4,21 +4,30 @@ * @todo document */ -/** - * - */ +/** */ define('DF_ALL', -1); +/** */ define('DF_NONE', 0); +/** */ define('DF_MDY', 1); +/** */ define('DF_DMY', 2); +/** */ define('DF_YMD', 3); +/** */ define('DF_ISO1', 4); +/** */ define('DF_LASTPREF', 4); +/** */ define('DF_ISO2', 5); +/** */ define('DF_YDM', 6); +/** */ define('DF_DM', 7); +/** */ define('DF_MD', 8); +/** */ define('DF_LAST', 8); /** @@ -32,8 +41,10 @@ class DateFormatter var $regexes, $pDays, $pMonths, $pYears; var $rules, $xMonths; - function DateFormatter() - { + /** + * @todo document + */ + function DateFormatter() { global $wgMonthNamesEn, $wgInputEncoding; $this->monthNames = $this->getMonthRegex(); @@ -95,8 +106,11 @@ class DateFormatter $this->rules[DF_NONE][DF_ISO2] = DF_ISO1; } - function reformat( $preference, $text ) - { + /** + * @param $preference + * @param $text + */ + function reformat( $preference, $text ) { for ( $i=1; $i<=DF_LAST; $i++ ) { $this->mSource = $i; if ( @$this->rules[$preference][$i] ) { @@ -117,8 +131,10 @@ class DateFormatter return $text; } - function replace( $matches ) - { + /** + * @param $matches + */ + function replace( $matches ) { global $wgMonthNamesEn; # Extract information from $matches $bits = array(); @@ -200,21 +216,30 @@ class DateFormatter return $text; } - function getMonthRegex() - { + /** + * @todo document + */ + function getMonthRegex() { global $wgMonthNamesEn; return implode( '|', $wgMonthNamesEn ); } - # Makes an ISO month, e.g. 02, from a month name - function makeIsoMonth( $monthName ) - { + /** + * Makes an ISO month, e.g. 02, from a month name + * @param string $monthName Month name + * @return string ISO month name + */ + function makeIsoMonth( $monthName ) { $n = $this->xMonths[strtolower( $monthName )]; return sprintf( '%02d', $n ); } - function makeIsoYear( $year ) - { + /** + * @todo document + * @param string $year Year name + * @return string ISO year name + */ + function makeIsoYear( $year ) { # Assumes the year is in a nice format, as enforced by the regex if ( substr( $year, -2 ) == 'BC' ) { $num = IntVal(substr( $year, 0, -3 )) - 1; @@ -227,8 +252,10 @@ class DateFormatter return $text; } - function makeNormalYear( $iso ) - { + /** + * @todo document + */ + function makeNormalYear( $iso ) { if ( $iso{0} == '-' ) { $text = (IntVal( substr( $iso, 1 ) ) - 1) . ' BC'; } else { @@ -238,8 +265,10 @@ class DateFormatter } } -function wfMainDateReplace( $matches ) -{ +/** + * @todo document + */ +function wfMainDateReplace( $matches ) { global $wgDateFormatter; return $wgDateFormatter->replace( $matches ); } diff --git a/includes/EditPage.php b/includes/EditPage.php index 02cba8786a..f1083b4bd3 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -21,16 +21,20 @@ class EditPage { var $edittime = '', $section = ''; var $oldid = 0; + /** + * @todo document + * @param $article + */ function EditPage( $article ) { $this->mArticle =& $article; global $wgTitle; $this->mTitle =& $wgTitle; } - # This is the function that gets called for "action=edit". - - function edit() - { + /** + * This is the function that gets called for "action=edit". + */ + function edit() { global $wgOut, $wgUser, $wgWhitelistEdit, $wgRequest; // this is not an article $wgOut->setArticleFlag(false); @@ -66,6 +70,9 @@ class EditPage { } } + /** + * @todo document + */ function importFormData( &$request ) { # These fields need to be checked for encoding. # Also remove trailing whitespace, but don't remove _initial_ @@ -88,27 +95,29 @@ class EditPage { $this->section = $request->getVal( 'wpSection', $request->getVal( 'section' ) ); } - # Since there is only one text field on the edit form, - # pressing will cause the form to be submitted, but - # the submit button value won't appear in the query, so we - # Fake it here before going back to edit(). This is kind of - # ugly, but it helps some old URLs to still work. - - function submit() - { + /** + * Since there is only one text field on the edit form, + * pressing will cause the form to be submitted, but + * the submit button value won't appear in the query, so we + * Fake it here before going back to edit(). This is kind of + * ugly, but it helps some old URLs to still work. + */ + function submit() { if( !$this->preview ) $this->save = true; $this->edit(); } - # The edit form is self-submitting, so that when things like - # preview and edit conflicts occur, we get the same form back - # with the extra stuff added. Only when the final submission - # is made and all is well do we actually save and redirect to - # the newly-edited page. - - function editForm( $formtype ) - { + /** + * The edit form is self-submitting, so that when things like + * preview and edit conflicts occur, we get the same form back + * with the extra stuff added. Only when the final submission + * is made and all is well do we actually save and redirect to + * the newly-edited page. + * + * @param string $formtype Type of form either : save, initial or preview + */ + function editForm( $formtype ) { global $wgOut, $wgUser; global $wgLang, $wgParser, $wgTitle; global $wgAllowAnonymousMinor; @@ -480,8 +489,10 @@ htmlspecialchars( $wgLang->recodeForEdit( $this->textbox1 ) ) . } } - function blockedIPpage() - { + /** + * @todo document + */ + function blockedIPpage() { global $wgOut, $wgUser, $wgLang, $wgIP; $wgOut->setPageTitle( wfMsg( 'blockedtitle' ) ); @@ -504,10 +515,10 @@ htmlspecialchars( $wgLang->recodeForEdit( $this->textbox1 ) ) . $wgOut->returnToMain( false ); } - - - function userNotLoggedInPage() - { + /** + * @todo document + */ + function userNotLoggedInPage() { global $wgOut, $wgUser, $wgLang; $wgOut->setPageTitle( wfMsg( 'whitelistedittitle' ) ); @@ -518,6 +529,9 @@ htmlspecialchars( $wgLang->recodeForEdit( $this->textbox1 ) ) . $wgOut->returnToMain( false ); } + /** + * @todo document + */ function spamPage ( $matches = array() ) { global $wgOut; @@ -532,10 +546,11 @@ htmlspecialchars( $wgLang->recodeForEdit( $this->textbox1 ) ) . $wgOut->returnToMain( false ); } - # Forks processes to scan the originating IP for an open proxy server - # MemCached can be used to skip IPs that have already been scanned - function proxyCheck() - { + /** + * Forks processes to scan the originating IP for an open proxy server + * MemCached can be used to skip IPs that have already been scanned + */ + function proxyCheck() { global $wgBlockOpenProxies, $wgProxyPorts, $wgProxyScriptPath; global $wgIP, $wgUseMemCached, $wgMemc, $wgDBname, $wgProxyMemcExpiry; @@ -575,7 +590,11 @@ htmlspecialchars( $wgLang->recodeForEdit( $this->textbox1 ) ) . } } - /* private */ function mergeChangesInto( &$text ){ + /** + * @access private + * @todo document + */ + function mergeChangesInto( &$text ){ $fname = 'EditPage::mergeChangesInto'; $oldDate = $this->edittime; $dbw =& wfGetDB( DB_MASTER ); diff --git a/includes/Feed.php b/includes/Feed.php index a34dae4e0f..fcb077ac6a 100644 --- a/includes/Feed.php +++ b/includes/Feed.php @@ -20,7 +20,7 @@ # http://www.gnu.org/copyleft/gpl.html /** - * Contain class to build rss / atom ... feeds + * Contain a feed class as well as classes to build rss / atom ... feeds */ /** @@ -35,12 +35,20 @@ $wgFeedClasses = array( * @todo document */ class FeedItem { + /**@#+ + * @var string + * @access private + */ var $Title = 'Wiki'; var $Description = ''; var $Url = ''; var $Date = ''; var $Author = ''; + /**@#-*/ + /** + * @todo document + */ function FeedItem( $Title, $Description, $Url, $Date = '', $Author = '', $Comments = '' ) { $this->Title = $Title; $this->Description = $Description; @@ -50,7 +58,10 @@ class FeedItem { $this->Comments = $Comments; } - /* Static... */ + /** + * @static + * @todo document + */ function xmlEncode( $string ) { global $wgInputEncoding, $wgLang; $string = str_replace( "\r\n", "\n", $string ); @@ -59,45 +70,72 @@ class FeedItem { } return htmlspecialchars( $string ); } - function getTitle() { - return $this->xmlEncode( $this->Title ); - } - function getUrl() { - return $this->xmlEncode( $this->Url ); - } - function getDescription() { - return $this->xmlEncode( $this->Description ); - } + + /** + * @todo document + */ + function getTitle() { return $this->xmlEncode( $this->Title ); } + /** + * @todo document + */ + function getUrl() { return $this->xmlEncode( $this->Url ); } + /** + * @todo document + */ + function getDescription() { return $this->xmlEncode( $this->Description ); } + /** + * @todo document + */ function getLanguage() { global $wgLanguageCode; return $wgLanguageCode; } - function getDate() { - return $this->Date; - } - function getAuthor() { - return $this->xmlEncode( $this->Author ); - } - function getComments() { - return $this->xmlEncode( $this->Comments ); - } + /** + * @todo document + */ + function getDate() { return $this->Date; } + /** + * @todo document + */ + function getAuthor() { return $this->xmlEncode( $this->Author ); } + /** + * @todo document + */ + function getComments() { return $this->xmlEncode( $this->Comments ); } } /** * @todo document */ class ChannelFeed extends FeedItem { - /* Abstract functions, override! */ + /**@#+ + * Abstract function, override! + */ + + /** + * @todo document + */ function outHeader() { # print ""; } + + /** + * @todo document + */ function outItem( $item ) { # print "..."; } + + /** + * @todo document + */ function outFooter() { # print ""; } + /** + * @todo document + */ function outXmlHeader( $mimetype='application/xml' ) { global $wgServer, $wgStylePath, $wgOut; @@ -110,6 +148,7 @@ class ChannelFeed extends FeedItem { print '<' . '?xml-stylesheet type="text/css" href="' . htmlspecialchars( "$wgServer$wgStylePath/feed.css" ) . '"?' . ">\n"; } + /**@#-*/ } /** @@ -118,10 +157,16 @@ class ChannelFeed extends FeedItem { */ class RSSFeed extends ChannelFeed { + /** + * @todo document + */ function formatTime( $ts ) { return gmdate( 'D, d M Y H:i:s \G\M\T', wfTimestamp2Unix( $ts ) ); } + /** + * @todo document + */ function outHeader() { global $wgVersion; @@ -137,6 +182,9 @@ class RSSFeed extends ChannelFeed { @@ -150,6 +198,9 @@ class RSSFeed extends ChannelFeed { @@ -162,11 +213,17 @@ class RSSFeed extends ChannelFeed { * @todo document */ class AtomFeed extends ChannelFeed { + /** + * @todo document + */ function formatTime( $ts ) { // need to use RFC 822 time format at least for rss2.0 return gmdate( 'Y-m-d\TH:i:s', wfTimestamp2Unix( $ts ) ); } + /** + * @todo document + */ function outHeader() { global $wgVersion, $wgOut; @@ -181,6 +238,9 @@ class AtomFeed extends ChannelFeed { @@ -202,6 +262,9 @@ class AtomFeed extends ChannelFeed { */ } + /** + * @todo document + */ function outFooter() {?>