summaryrefslogtreecommitdiff
path: root/includes/Feed.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
committerPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
commitb9b85843572bf283f48285001e276ba7e61b63f6 (patch)
tree4c6f4571552ada9ccfb4030481dcf77308f8b254 /includes/Feed.php
parentd9a20acc4e789cca747ad360d87ee3f3e7aa58c1 (diff)
updated to MediaWiki 1.14.0
Diffstat (limited to 'includes/Feed.php')
-rw-r--r--includes/Feed.php44
1 files changed, 32 insertions, 12 deletions
diff --git a/includes/Feed.php b/includes/Feed.php
index 512057d9..fe6d8feb 100644
--- a/includes/Feed.php
+++ b/includes/Feed.php
@@ -52,25 +52,45 @@ class FeedItem {
$this->Comments = $Comments;
}
- /**
- * @static
- */
- function xmlEncode( $string ) {
+ public function xmlEncode( $string ) {
$string = str_replace( "\r\n", "\n", $string );
$string = preg_replace( '/[\x00-\x08\x0b\x0c\x0e-\x1f]/', '', $string );
return htmlspecialchars( $string );
}
- function getTitle() { return $this->xmlEncode( $this->Title ); }
- function getUrl() { return $this->xmlEncode( $this->Url ); }
- function getDescription() { return $this->xmlEncode( $this->Description ); }
- function getLanguage() {
+ public function getTitle() {
+ return $this->xmlEncode( $this->Title );
+ }
+
+ public function getUrl() {
+ return $this->xmlEncode( $this->Url );
+ }
+
+ public function getDescription() {
+ return $this->xmlEncode( $this->Description );
+ }
+
+ public function getLanguage() {
global $wgContLanguageCode;
return $wgContLanguageCode;
}
- function getDate() { return $this->Date; }
- function getAuthor() { return $this->xmlEncode( $this->Author ); }
- function getComments() { return $this->xmlEncode( $this->Comments ); }
+
+ public function getDate() {
+ return $this->Date;
+ }
+ public function getAuthor() {
+ return $this->xmlEncode( $this->Author );
+ }
+ public function getComments() {
+ return $this->xmlEncode( $this->Comments );
+ }
+
+ /**
+ * Quickie hack... strip out wikilinks to more legible form from the comment.
+ */
+ public static function stripComment( $text ) {
+ return preg_replace( '/\[\[([^]]*\|)?([^]]+)\]\]/', '\2', $text );
+ }
/**#@-*/
}
@@ -149,7 +169,7 @@ class ChannelFeed extends FeedItem {
global $wgStylePath, $wgStyleVersion;
$this->httpHeaders();
- echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
+ echo '<?xml version="1.0"?>' . "\n";
echo '<?xml-stylesheet type="text/css" href="' .
htmlspecialchars( wfExpandUrl( "$wgStylePath/common/feed.css?$wgStyleVersion" ) ) .
'"?' . ">\n";