Move PageQueryPage class into own file
authorRob Church <robchurch@users.mediawiki.org>
Sat, 31 Mar 2007 23:36:58 +0000 (23:36 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Sat, 31 Mar 2007 23:36:58 +0000 (23:36 +0000)
includes/AutoLoader.php
includes/PageQueryPage.php [new file with mode: 0644]
includes/QueryPage.php

index b4b8ef8..ca9d92e 100644 (file)
@@ -134,7 +134,7 @@ function __autoload($className) {
                'ProxyTools' => 'includes/ProxyTools.php',
                'ProtectionForm' => 'includes/ProtectionForm.php',
                'QueryPage' => 'includes/QueryPage.php',
-               'PageQueryPage' => 'includes/QueryPage.php',
+               'PageQueryPage' => 'includes/PageQueryPage.php',
                'ImageQueryPage' => 'includes/ImageQueryPage.php',
                'RawPage' => 'includes/RawPage.php',
                'RecentChange' => 'includes/RecentChange.php',
diff --git a/includes/PageQueryPage.php b/includes/PageQueryPage.php
new file mode 100644 (file)
index 0000000..17ed57f
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+/**
+ * Variant of QueryPage which formats the result as a simple link to the page
+ *
+ * @package MediaWiki
+ */
+class PageQueryPage extends QueryPage {
+
+       /**
+        * Format the result as a simple link to the page
+        *
+        * @param Skin $skin
+        * @param object $row Result row
+        * @return string
+        */
+       public function formatResult( $skin, $row ) {
+               global $wgContLang;
+               $title = Title::makeTitleSafe( $row->namespace, $row->title );
+               return $skin->makeKnownLinkObj( $title,
+                       htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) );
+       }
+}
+
+?>
\ No newline at end of file
index 9571827..409a9c4 100644 (file)
@@ -524,19 +524,4 @@ class QueryPage {
        }
 }
 
-/**
- * This is a subclass for very simple queries that are just looking for page
- * titles that match some criteria. It formats each result item as a link to
- * that page.
- *
- */
-class PageQueryPage extends QueryPage {
-
-       function formatResult( $skin, $result ) {
-               global $wgContLang;
-               $nt = Title::makeTitle( $result->namespace, $result->title );
-               return $skin->makeKnownLinkObj( $nt, htmlspecialchars( $wgContLang->convert( $nt->getPrefixedText() ) ) );
-       }
-}
-
-?>
+?>
\ No newline at end of file