Add $robotPolicy parameter to SpecialPage::setHeaders()
authortisane <nathanlarson3141@gmail.com>
Sat, 30 Nov 2013 02:34:10 +0000 (21:34 -0500)
committerBrian Wolff <bawolff+wn@gmail.com>
Mon, 2 Dec 2013 19:26:21 +0000 (19:26 +0000)
Also fix docs for OutputPage::setRobotPolicy()

Bug: 57764
Change-Id: I8b780ca349a2f5d18e857ed707f682d19be0054c

includes/OutputPage.php
includes/SpecialPage.php

index a0d7e30..eae5dfd 100644 (file)
@@ -774,9 +774,12 @@ class OutputPage extends ContextSource {
        /**
         * Set the robot policy for the page: <http://www.robotstxt.org/meta.html>
         *
-        * @param string $policy the literal string to output as the contents of
-        *   the meta tag.  Will be parsed according to the spec and output in
-        *   standardized form.
+        * @param string|array $policy string such as "noindex,nofollow" or an array in this
+        *   format:
+        *   array(
+        *      'index' => 'noindex' // or 'index'
+        *      'follow' => 'nofollow' // or 'follow'
+        *   )
         * @return null
         */
        public function setRobotPolicy( $policy ) {
index f70a6dc..2f0e5e9 100644 (file)
@@ -640,11 +640,17 @@ class SpecialPage {
 
        /**
         * Sets headers - this should be called from the execute() method of all derived classes!
-        */
-       function setHeaders() {
+        * @param string|array $robotPolicy string such as "noindex,nofollow" or an array in this
+        *   format:
+        *   array(
+        *      'index' => 'noindex' // or 'index'
+        *      'follow' => 'nofollow' // or 'follow'
+        *   )
+        */
+       function setHeaders( $robotPolicy = "noindex,nofollow" ) {
                $out = $this->getOutput();
                $out->setArticleRelated( false );
-               $out->setRobotPolicy( "noindex,nofollow" );
+               $out->setRobotPolicy( $robotPolicy );
                $out->setPageTitle( $this->getDescription() );
        }