Fixed @param tags to conform with Doxygen format.
[lhc/web/wiklou.git] / includes / UserMailer.php
index cb7afc0..d302e89 100644 (file)
@@ -24,7 +24,6 @@
  * @author Luke Welling lwelling@wikimedia.org
  */
 
-
 /**
  * Stores a single person's name and email address.
  * These are passed in via the constructor, and will be returned in SMTP
@@ -32,9 +31,9 @@
  */
 class MailAddress {
        /**
-        * @param $address string|User string with an email address, or a User object
-        * @param $name String: human-readable name if a string address is given
-        * @param $realName String: human-readable real name if a string address is given
+        * @param string|User $address string with an email address, or a User object
+        * @param string $name human-readable name if a string address is given
+        * @param string $realName human-readable real name if a string address is given
         */
        function __construct( $address, $name = null, $realName = null ) {
                if ( is_object( $address ) && $address instanceof User ) {
@@ -78,7 +77,6 @@ class MailAddress {
        }
 }
 
-
 /**
  * Collection of static functions for sending mail
  */
@@ -110,9 +108,9 @@ class UserMailer {
        /**
         * Creates a single string from an associative array
         *
-        * @param $headers array Associative Array: keys are header field names,
+        * @param array $headers Associative Array: keys are header field names,
         *                 values are ... values.
-        * @param $endl String: The end of line character.  Defaults to "\n"
+        * @param string $endl The end of line character.  Defaults to "\n"
         *
         * Note RFC2822 says newlines must be CRLF (\r\n)
         * but php mail naively "corrects" it and requires \n for the "correction" to work
@@ -136,10 +134,10 @@ class UserMailer {
                global $wgSMTP, $wgServer;
 
                $msgid = uniqid( wfWikiID() . ".", true ); /* true required for cygwin */
-               if ( is_array($wgSMTP) && isset($wgSMTP['IDHost']) && $wgSMTP['IDHost'] ) {
+               if ( is_array( $wgSMTP ) && isset( $wgSMTP['IDHost'] ) && $wgSMTP['IDHost'] ) {
                        $domain = $wgSMTP['IDHost'];
                } else {
-                       $url = wfParseUrl($wgServer);
+                       $url = wfParseUrl( $wgServer );
                        $domain = $url['host'];
                }
                return "<$msgid@$domain>";
@@ -153,10 +151,10 @@ class UserMailer {
         *
         * @param $to MailAddress: recipient's email (or an array of them)
         * @param $from MailAddress: sender's email
-        * @param $subject String: email's subject.
-        * @param $body String: email's text or Array of two strings to be the text and html bodies
+        * @param string $subject email's subject.
+        * @param string $body email's text or Array of two strings to be the text and html bodies
         * @param $replyto MailAddress: optional reply-to email (default: null).
-        * @param $contentType String: optional custom Content-Type (default: text/plain; charset=UTF-8)
+        * @param string $contentType optional custom Content-Type (default: text/plain; charset=UTF-8)
         * @throws MWException
         * @return Status object
         */
@@ -270,7 +268,7 @@ class UserMailer {
                                $mime = new Mail_mime( array( 'eol' => $endl ) );
                                $mime->setTXTBody( $body['text'] );
                                $mime->setHTMLBody( $body['html'] );
-                               $body = $mime->get();  // must call get() before headers()
+                               $body = $mime->get(); // must call get() before headers()
                                $headers = $mime->headers( $headers );
                        }
                }
@@ -340,7 +338,7 @@ class UserMailer {
                        #
                        # PHP mail()
                        #
-                       if( count($to) > 1 ) {
+                       if( count( $to ) > 1 ) {
                                $headers['To'] = 'undisclosed-recipients:;';
                        }
                        $headers = self::arrayToHeaderString( $headers, $endl );
@@ -382,7 +380,7 @@ class UserMailer {
         * Set the mail error message in self::$mErrorString
         *
         * @param $code Integer: error number
-        * @param $string String: error message
+        * @param string $string error message
         */
        static function errorHandler( $code, $string ) {
                self::$mErrorString = preg_replace( '/^mail\(\)(\s*\[.*?\])?: /', '', $string );
@@ -517,9 +515,9 @@ class EmailNotification {
                                                        array( /* SET */
                                                                'wl_notificationtimestamp' => $dbw->timestamp( $timestamp )
                                                        ), array( /* WHERE */
-                                                               'wl_user'      => $watchers,
+                                                               'wl_user' => $watchers,
                                                                'wl_namespace' => $title->getNamespace(),
-                                                               'wl_title'     => $title->getDBkey(),
+                                                               'wl_title' => $title->getDBkey(),
                                                        ), $fname
                                                );
                                                $dbw->commit( $fname );
@@ -572,11 +570,11 @@ class EmailNotification {
         *
         * @param $editor User object
         * @param $title Title object
-        * @param $timestamp string Edit timestamp
-        * @param $summary string Edit summary
+        * @param string $timestamp Edit timestamp
+        * @param string $summary Edit summary
         * @param $minorEdit bool
-        * @param $oldid int Revision ID
-        * @param $watchers array of user IDs
+        * @param int $oldid Revision ID
+        * @param array $watchers of user IDs
         * @param string $pageStatus
         * @throws MWException
         */
@@ -710,15 +708,19 @@ class EmailNotification {
                        if ( !$wgEnotifImpersonal ) {
                                // For personal mail, also show a link to the diff of all changes
                                // since last visited.
-                               $keys['$NEWPAGE'] .= "\n\n" .  wfMessage( 'enotif_lastvisited',
+                               $keys['$NEWPAGE'] .= "\n\n" . wfMessage( 'enotif_lastvisited',
                                        $this->title->getCanonicalUrl( 'diff=0&oldid=' . $this->oldid ) )
                                        ->inContentLanguage()->text();
                        }
-                       $keys['$OLDID']   = $this->oldid;
+                       $keys['$OLDID'] = $this->oldid;
+                       // @deprecated Remove in MediaWiki 1.23.
+                       $keys['$CHANGEDORCREATED'] = wfMessage( 'changed' )->inContentLanguage()->text();
                } else {
                        # clear $OLDID placeholder in the message template
-                       $keys['$OLDID']   = '';
+                       $keys['$OLDID'] = '';
                        $keys['$NEWPAGE'] = '';
+                       // @deprecated Remove in MediaWiki 1.23.
+                       $keys['$CHANGEDORCREATED'] = wfMessage( 'created' )->inContentLanguage()->text();
                }
 
                $keys['$PAGETITLE'] = $this->title->getPrefixedText();
@@ -746,11 +748,11 @@ class EmailNotification {
 
                # Now build message's subject and body
                $this->subject = wfMessage( 'enotif_subject_' . $this->pageStatus )->inContentLanguage()
-                       ->params( $pageTitle, $keys['$PAGEEDITOR'] )->escaped();
+                       ->params( $pageTitle, $keys['$PAGEEDITOR'] )->text();
 
                $keys['$PAGEINTRO'] = wfMessage( 'enotif_body_intro_' . $this->pageStatus )
                        ->inContentLanguage()->params( $pageTitle, $keys['$PAGEEDITOR'], $pageTitleUrl )
-                       ->escaped();
+                       ->text();
 
                $body = wfMessage( 'enotif_body' )->inContentLanguage()->plain();
                $body = strtr( $body, $keys );
@@ -767,13 +769,13 @@ class EmailNotification {
                {
                        $editorAddress = new MailAddress( $this->editor );
                        if ( $wgEnotifFromEditor ) {
-                               $this->from    = $editorAddress;
+                               $this->from = $editorAddress;
                        } else {
-                               $this->from    = $adminAddress;
+                               $this->from = $adminAddress;
                                $this->replyto = $editorAddress;
                        }
                } else {
-                       $this->from    = $adminAddress;
+                       $this->from = $adminAddress;
                        $this->replyto = new MailAddress( $wgNoReplyAddress );
                }
        }