diff --git a/.gitignore b/.gitignore
index 2d7f2df978d953bc4481f1c87bdb8378b21bf0c3..4fb846732a7cd79f03ddd1650d21c87ea1488b37 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,8 @@
 /conf/user*.css
 /conf/user*.js
 /conf/words.aspell
+/conf/lang/*
+/conf/plugin_lang/*
 .htaccess
 *.swp
 *.bak
diff --git a/_test/cases/inc/IXR_Library_IXR_Message.test.php b/_test/cases/inc/IXR_Library_IXR_Message.test.php
index 2a81332301d31c8eaa91f59d2bc67b58bc2b68fb..bc9be572d79d23cf7d157d325c79141b35f1af11 100644
--- a/_test/cases/inc/IXR_Library_IXR_Message.test.php
+++ b/_test/cases/inc/IXR_Library_IXR_Message.test.php
@@ -136,4 +136,4 @@ class ixr_library_ixr_message_test extends UnitTestCase {
     }
 
 }
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/IXR_Library_date.test.php b/_test/cases/inc/IXR_Library_date.test.php
index a2b6154d8f00ee516259148b3edca8397bd1179c..28fa86486d27ea229d3b3e03d5fddba0c97cec03 100644
--- a/_test/cases/inc/IXR_Library_date.test.php
+++ b/_test/cases/inc/IXR_Library_date.test.php
@@ -31,4 +31,4 @@ class ixr_library_date_test extends UnitTestCase {
     }
 
 }
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/auth_aclcheck.test.php b/_test/cases/inc/auth_aclcheck.test.php
index d8a8f285aaaa1e8d2e36a9983cfd9651bc0cf3f2..ff092c2de4658ad8e954b2de5723aa7a59eafb64 100644
--- a/_test/cases/inc/auth_aclcheck.test.php
+++ b/_test/cases/inc/auth_aclcheck.test.php
@@ -228,4 +228,4 @@ class auth_acl_test extends UnitTestCase {
 
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/auth_admincheck.test.php b/_test/cases/inc/auth_admincheck.test.php
index f14d6369e3f98429a217c13f4f7006ef29ff5904..a71c8801ad73d1cc9f9496b96f0373b4cfb88b45 100644
--- a/_test/cases/inc/auth_admincheck.test.php
+++ b/_test/cases/inc/auth_admincheck.test.php
@@ -3,20 +3,47 @@
 require_once DOKU_INC.'inc/init.php';
 require_once DOKU_INC.'inc/auth.php';
 
+class auth_admin_test_AuthInSensitive extends auth_basic {
+    function isCaseSensitive(){
+        return false;
+    }
+}
+
 class auth_admin_test extends UnitTestCase {
 
+    private $oldauth;
+
+    function setup() {
+        global $auth;
+        $this->oldauth = $auth;
+        parent::setup();
+    }
+
+    function setSensitive() {
+        global $auth;
+        $auth = new auth_basic;
+    }
+
+    function setInSensitive() {
+        global $auth;
+        $auth = new auth_admin_test_AuthInSensitive;
+    }
+
     function teardown() {
+        global $auth;
         global $conf;
         global $AUTH_ACL;
         unset($conf);
         unset($AUTH_ACL);
-
+        $auth = $this->oldauth;
+        parent::teardown();
     }
 
-    function test_ismanager(){
+    function test_ismanager_insensitive(){
+        $this->setInSensitive();
         global $conf;
-        $conf['superuser'] = 'john,@admin';
-        $conf['manager'] = 'john,@managers,doe';
+        $conf['superuser'] = 'john,@admin,@Mötly Görls, Dörte';
+        $conf['manager'] = 'john,@managers,doe, @Mötly Böys, Dänny';
 
         // anonymous user
         $this->assertEqual(auth_ismanager('jill', null,false), false);
@@ -25,12 +52,19 @@ class auth_admin_test extends UnitTestCase {
         $this->assertEqual(auth_ismanager('john', null,false), true);
         $this->assertEqual(auth_ismanager('doe',  null,false), true);
 
+        $this->assertEqual(auth_ismanager('dörte', null,false), true);
+        $this->assertEqual(auth_ismanager('dänny', null,false), true);
+
         // admin or manager groups
         $this->assertEqual(auth_ismanager('jill', array('admin'),false), true);
         $this->assertEqual(auth_ismanager('jill', array('managers'),false), true);
+
+        $this->assertEqual(auth_ismanager('jill', array('mötly görls'),false), true);
+        $this->assertEqual(auth_ismanager('jill', array('mötly böys'),false), true);
     }
 
-    function test_isadmin(){
+    function test_isadmin_insensitive(){
+        $this->setInSensitive();
         global $conf;
         $conf['superuser'] = 'john,@admin,doe,@roots';
 
@@ -48,6 +82,50 @@ class auth_admin_test extends UnitTestCase {
         $this->assertEqual(auth_ismanager('doe',  array('admin'),true), true);
     }
 
+    function test_ismanager_sensitive(){
+        $this->setSensitive();
+        global $conf;
+        $conf['superuser'] = 'john,@admin,@Mötly Görls, Dörte';
+        $conf['manager'] = 'john,@managers,doe, @Mötly Böys, Dänny';
+
+        // anonymous user
+        $this->assertEqual(auth_ismanager('jill', null,false), false);
+
+        // admin or manager users
+        $this->assertEqual(auth_ismanager('john', null,false), true);
+        $this->assertEqual(auth_ismanager('doe',  null,false), true);
+
+        $this->assertEqual(auth_ismanager('dörte', null,false), false);
+        $this->assertEqual(auth_ismanager('dänny', null,false), false);
+
+        // admin or manager groups
+        $this->assertEqual(auth_ismanager('jill', array('admin'),false), true);
+        $this->assertEqual(auth_ismanager('jill', array('managers'),false), true);
+
+        $this->assertEqual(auth_ismanager('jill', array('mötly görls'),false), false);
+        $this->assertEqual(auth_ismanager('jill', array('mötly böys'),false), false);
+    }
+
+    function test_isadmin_sensitive(){
+        $this->setSensitive();
+        global $conf;
+        $conf['superuser'] = 'john,@admin,doe,@roots';
+
+        // anonymous user
+        $this->assertEqual(auth_ismanager('jill', null,true), false);
+
+        // admin user
+        $this->assertEqual(auth_ismanager('john', null,true), true);
+        $this->assertEqual(auth_ismanager('Doe',  null,true), false);
+
+        // admin groups
+        $this->assertEqual(auth_ismanager('jill', array('admin'),true), true);
+        $this->assertEqual(auth_ismanager('jill', array('roots'),true), true);
+        $this->assertEqual(auth_ismanager('john', array('admin'),true), true);
+        $this->assertEqual(auth_ismanager('doe',  array('admin'),true), true);
+        $this->assertEqual(auth_ismanager('Doe',  array('admin'),true), true);
+    }
+
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/auth_nameencode.test.php b/_test/cases/inc/auth_nameencode.test.php
index 28ab6dc4a5a06f5ee02e878be359b7b8a1a1c125..56806a862a73208edea7c7b6abfec65a46ce5ef8 100644
--- a/_test/cases/inc/auth_nameencode.test.php
+++ b/_test/cases/inc/auth_nameencode.test.php
@@ -47,4 +47,4 @@ class auth_nameencode_test extends UnitTestCase {
     }
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/auth_password.test.php b/_test/cases/inc/auth_password.test.php
index 1ba731c7e16752a5e22408802cb9aa3d8638b43d..140c7c23e75f2614c7a95b60543f35534a93f45d 100644
--- a/_test/cases/inc/auth_password.test.php
+++ b/_test/cases/inc/auth_password.test.php
@@ -15,6 +15,9 @@ class auth_password_test extends UnitTestCase {
         'crypt' => 'ablvoGr1hvZ5k',
         'mysql' => '4a1fa3780bd6fd55',
         'my411' => '*e5929347e25f82e19e4ebe92f1dc6b6e7c2dbd29',
+        'kmd5'  => 'a579299436d7969791189acadd86fcb716',
+        'pmd5'  => '$P$abcdefgh1RC6Fd32heUzl7EYCG9uGw.',
+        'hmd5'  => '$H$abcdefgh1ZbJodHxmeXVAhEzTG7IAp.',
     );
 
 
@@ -22,7 +25,7 @@ class auth_password_test extends UnitTestCase {
         foreach($this->passes as $method => $hash){
             $info = "testing method $method";
             $this->signal('failinfo',$info);
-            $this->assertEqual(auth_cryptPassword('foo'.$method,$method,'abcdefgh'),$hash);
+            $this->assertEqual(auth_cryptPassword('foo'.$method,$method,'abcdefgh12345678912345678912345678'),$hash);
         }
     }
 
@@ -38,6 +41,11 @@ class auth_password_test extends UnitTestCase {
         $this->assertTrue(auth_verifyPassword('foo','$1$$n1rTiFE0nRifwV/43bVon/'));
     }
 
+    function test_verifyPassword_fixedpmd5(){
+        $this->assertTrue(auth_verifyPassword('test12345','$P$9IQRaTwmfeRo7ud9Fh4E2PdI0S3r.L0'));
+        $this->assertTrue(auth_verifyPassword('test12345','$H$9IQRaTwmfeRo7ud9Fh4E2PdI0S3r.L0'));
+    }
+
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/common_clientip.test.php b/_test/cases/inc/common_clientip.test.php
index 4df463539860c97c7bb4b7a8ccdd7094f45d4bc1..68c1081657600d5ab08b0a19022cd36e5d34a120 100644
--- a/_test/cases/inc/common_clientip.test.php
+++ b/_test/cases/inc/common_clientip.test.php
@@ -152,4 +152,4 @@ class common_clientIP_test extends UnitTestCase {
 
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/common_obfuscate.test.php b/_test/cases/inc/common_obfuscate.test.php
index 3e1e1a72f49841cbc3e4ce8f44323e9fd82933f2..31321bea12bd5c658e6beeab387714c58d9414c9 100644
--- a/_test/cases/inc/common_obfuscate.test.php
+++ b/_test/cases/inc/common_obfuscate.test.php
@@ -25,4 +25,4 @@ class common_obfuscate_test extends UnitTestCase {
 
 
 }
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/common_pagetemplate.test.php b/_test/cases/inc/common_pagetemplate.test.php
index ecba0f9663fdba6f18c070729451070a77830ffb..2db8b64aeb03502d779a472c6a66c9b540b8b90d 100644
--- a/_test/cases/inc/common_pagetemplate.test.php
+++ b/_test/cases/inc/common_pagetemplate.test.php
@@ -16,4 +16,4 @@ class common_pagetemplate_test extends UnitTestCase {
         error_reporting($old);
     }
 }
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/indexer_idx_indexlengths.test.php b/_test/cases/inc/indexer_idx_indexlengths.test.php
index 8565639be7c71490bc6566441c2f592177e52996..a0f7c9224f6299f882c7ccb731e96174467c4546 100644
--- a/_test/cases/inc/indexer_idx_indexlengths.test.php
+++ b/_test/cases/inc/indexer_idx_indexlengths.test.php
@@ -57,4 +57,4 @@ class indexer_idx_indexlengths_test extends UnitTestCase {
 }
 
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/init_fullpath.test.php b/_test/cases/inc/init_fullpath.test.php
index 63394b09d5e0f41b9fc6a05c7320f4c2bef241e0..aa63b0ce97fb1985611836bcc3b5874bc75fbda1 100644
--- a/_test/cases/inc/init_fullpath.test.php
+++ b/_test/cases/inc/init_fullpath.test.php
@@ -86,4 +86,4 @@ class init_fullpath_test extends UnitTestCase {
     }
 
 }
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/init_getbaseurl.test.php b/_test/cases/inc/init_getbaseurl.test.php
index edd370d61504248000d805dca6db0f0a9159c942..a22172febe627b75535b8e8bbf8451d4a09277c6 100644
--- a/_test/cases/inc/init_getbaseurl.test.php
+++ b/_test/cases/inc/init_getbaseurl.test.php
@@ -275,6 +275,31 @@ class init_getBaseURL_test extends UnitTestCase {
           $this->assertEqual(getBaseURL(true),$correct_result);
         }
     }
+
+    /**
+     * Absolute URL with IPv6 domain name.
+     * lighttpd, fastcgi
+     *
+     * data provided by Michael Hamann <michael@content-space.de>
+     */
+    function test12() {
+        global $conf;
+        $conf['basedir'] = '';
+        $conf['baseurl'] = '';
+        $conf['canonical'] = 0;
+
+        $_SERVER['DOCUMENT_ROOT'] = '/srv/http/';
+        $_SERVER['HTTP_HOST'] = '[fd00::6592:39ed:a2ed:2c78]';
+        $_SERVER['SCRIPT_FILENAME'] = '/srv/http/~michitux/dokuwiki/doku.php';
+        $_SERVER['REQUEST_URI'] = '/~michitux/dokuwiki/doku.php?do=debug';
+        $_SERVER['SCRIPT_NAME'] = '/~michitux/dokuwiki/doku.php';
+        $_SERVER['PATH_INFO'] = null;
+        $_SERVER['PATH_TRANSLATED'] = null;
+        $_SERVER['PHP_SELF'] = '/~michitux/dokuwiki/doku.php';
+        $_SERVER['SERVER_PORT'] = '80';
+        $_SERVER['SERVER_NAME'] = '[fd00';
+        $this->assertEqual(getBaseURL(true), 'http://[fd00::6592:39ed:a2ed:2c78]/~michitux/dokuwiki/');
+    }
 }
 
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/_test/cases/inc/mail_isvalid.test.php b/_test/cases/inc/mail_isvalid.test.php
index 3742046792fdf76593f184d018302ab8362e469a..4e047499faef22ab4a008a8f4b0aabdab272655a 100644
--- a/_test/cases/inc/mail_isvalid.test.php
+++ b/_test/cases/inc/mail_isvalid.test.php
@@ -80,4 +80,4 @@ class mail_isvalid extends UnitTestCase {
     }
 
 }
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/mail_quoted_printable_encode.php b/_test/cases/inc/mail_quoted_printable_encode.php
index c9cb040f1b855fd77a303c1c591543894aa6b881..a5a36e35b4e197bbd4181f4b9f6169a3058ad54b 100644
--- a/_test/cases/inc/mail_quoted_printable_encode.php
+++ b/_test/cases/inc/mail_quoted_printable_encode.php
@@ -41,4 +41,4 @@ class mail_quotedprintable_encode extends UnitTestCase {
     }
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/mail_send.php b/_test/cases/inc/mail_send.php
index 5c2b0e8967a04dd26b13c4d1ec3ccdbad211520b..e41c501fe0d0505a229c37d8386df768f26b3c47 100644
--- a/_test/cases/inc/mail_send.php
+++ b/_test/cases/inc/mail_send.php
@@ -46,4 +46,4 @@ class mail_send extends UnitTestCase {
     }
 
 }
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/pageutils_clean_id.test.php b/_test/cases/inc/pageutils_clean_id.test.php
index 9c03ce3344d48c365c778bf6be3c9b669c1fc010..01fa7dc1c843dd28e06370663290f9ec38b9a771 100644
--- a/_test/cases/inc/pageutils_clean_id.test.php
+++ b/_test/cases/inc/pageutils_clean_id.test.php
@@ -144,4 +144,4 @@ class init_clean_id_test extends UnitTestCase {
     }
 
 }
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/pageutils_getid.test.php b/_test/cases/inc/pageutils_getid.test.php
index e3932a579864bebb84afc874b981cc92c7ba4916..7fccc3a6089ef6896647d68eaa9323c375de1b3a 100644
--- a/_test/cases/inc/pageutils_getid.test.php
+++ b/_test/cases/inc/pageutils_getid.test.php
@@ -103,4 +103,4 @@ class init_getID_test extends UnitTestCase {
     }
 
 }
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/pageutils_resolve_id.test.php b/_test/cases/inc/pageutils_resolve_id.test.php
index 64b4033cd5a5146fbd97b3d7dfd29a326ea69186..9aa4ee8b7c9ef05501e6501ba9a9dc225fc00fa5 100644
--- a/_test/cases/inc/pageutils_resolve_id.test.php
+++ b/_test/cases/inc/pageutils_resolve_id.test.php
@@ -42,4 +42,4 @@ class init_resolve_id_test extends UnitTestCase {
     }
 
 }
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/pageutils_resolve_pageid.test.php b/_test/cases/inc/pageutils_resolve_pageid.test.php
index ab282b57addc8ece56c5100d260c754cb779c666..d9ea89869c9fa47132768e6dc86398755905b8bd 100644
--- a/_test/cases/inc/pageutils_resolve_pageid.test.php
+++ b/_test/cases/inc/pageutils_resolve_pageid.test.php
@@ -60,4 +60,4 @@ class init_resolve_pageid_test extends UnitTestCase {
     }
 
 }
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/parser/xhtml_links.test.php b/_test/cases/inc/parser/xhtml_links.test.php
index 6a74445b08e329dec33b9443a5873a51c8c164fd..0ad96c793fe41f5a809a497f176d3fc29b633d2b 100644
--- a/_test/cases/inc/parser/xhtml_links.test.php
+++ b/_test/cases/inc/parser/xhtml_links.test.php
@@ -12,7 +12,7 @@ class xhtml_links_test extends UnitTestCase {
         $p = new Doku_Renderer_xhtml();
         $p->emaillink('foo@example.com','<script>alert(\'"alert"\');</script>');
 
-        $expect = '<a href="mailto:foo%20%5Bat%5D%20example%20%5Bdot%5D%20com" class="mail JSnocheck" title="foo [at] example [dot] com">&lt;script&gt;alert(&#039;&quot;alert&quot;&#039;);&lt;/script&gt;</a>';
+        $expect = '<a href="mailto:foo%20%5Bat%5D%20example%20%5Bdot%5D%20com" class="mail" title="foo [at] example [dot] com">&lt;script&gt;alert(&#039;&quot;alert&quot;&#039;);&lt;/script&gt;</a>';
 
         $this->assertEqual($p->doc,$expect);
     }
@@ -36,7 +36,7 @@ class xhtml_links_test extends UnitTestCase {
         $p = new Doku_Renderer_xhtml();
         $p->emaillink('foo@example.com',$image);
 
-        $expect = '<a href="mailto:foo%20%5Bat%5D%20example%20%5Bdot%5D%20com" class="media JSnocheck" title="foo [at] example [dot] com"><img src="'.DOKU_BASE.'lib/exe/fetch.php/img.gif?w=10&amp;h=20&amp;cache=nocache" class="media" title="Some Image" alt="Some Image" width="10" height="20" /></a>';
+        $expect = '<a href="mailto:foo%20%5Bat%5D%20example%20%5Bdot%5D%20com" class="media" title="foo [at] example [dot] com"><img src="'.DOKU_BASE.'lib/exe/fetch.php/img.gif?w=10&amp;h=20&amp;cache=nocache" class="media" title="Some Image" alt="Some Image" width="10" height="20" /></a>';
 
         $this->assertEqual($p->doc,$expect);
     }
diff --git a/_test/cases/inc/safefn.test.php b/_test/cases/inc/safefn.test.php
index b93914bf8e6884177a5b699894f85d7898721d52..c789875bab78727ccc768fbcb9f52a592d5a7a78 100644
--- a/_test/cases/inc/safefn.test.php
+++ b/_test/cases/inc/safefn.test.php
@@ -32,4 +32,4 @@ class safeFN_test extends UnitTestCase {
     }
 
 }
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/utf8_correctidx.test.php b/_test/cases/inc/utf8_correctidx.test.php
index d95ce9ae08c324925d3bf22b74bfbb8daa1640e1..20f6ba3a38252ab97710757c06dd6ed647a7705c 100644
--- a/_test/cases/inc/utf8_correctidx.test.php
+++ b/_test/cases/inc/utf8_correctidx.test.php
@@ -75,4 +75,4 @@ class utf8_correctidx_test extends UnitTestCase {
     }
 
 }
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/utf8_html.test.php b/_test/cases/inc/utf8_html.test.php
index 57c9df259c7692698d3ea76cee20f493dd4bc71e..3e6d35bc728a8a30b4545b0703eaae8fa19bbb72 100644
--- a/_test/cases/inc/utf8_html.test.php
+++ b/_test/cases/inc/utf8_html.test.php
@@ -69,4 +69,4 @@ class utf8_html_test extends UnitTestCase {
 
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/utf8_romanize.test.php b/_test/cases/inc/utf8_romanize.test.php
index 9aade570ba94ee6ae73f433b66644866ec495337..950c8842a40f96f0880a515b26dbcc42aea341af 100644
--- a/_test/cases/inc/utf8_romanize.test.php
+++ b/_test/cases/inc/utf8_romanize.test.php
@@ -33,4 +33,4 @@ class utf8_romanize_test extends UnitTestCase {
         $this->assertEqual("a A a A a o O",utf8_romanize("å Å ä Ä ä ö Ö"));
     }
 }
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/utf8_stripspecials.test.php b/_test/cases/inc/utf8_stripspecials.test.php
index a42507a3c203b708285444e03de5b6ced04d2a06..85df75fa1630b99685a1b6716d394ca05d0de12d 100644
--- a/_test/cases/inc/utf8_stripspecials.test.php
+++ b/_test/cases/inc/utf8_stripspecials.test.php
@@ -24,4 +24,4 @@ class utf8_stripspecials extends UnitTestCase {
     }
 
 }
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/utf8_substr.test.php b/_test/cases/inc/utf8_substr.test.php
index f3bf1b1546e9fe7dd712ee45a368c5f528c29170..2806d34f10008276563eb7c03048184335b3f19c 100644
--- a/_test/cases/inc/utf8_substr.test.php
+++ b/_test/cases/inc/utf8_substr.test.php
@@ -40,4 +40,4 @@ class utf8_substr_test extends UnitTestCase {
     }
 
 }
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/utf8_unicode.test.php b/_test/cases/inc/utf8_unicode.test.php
index 453aad216e0087eb3a3ac2d93ce0cd3c8f062536..424f47d11e25513d96b12a1d2e1e4eb745d536b4 100644
--- a/_test/cases/inc/utf8_unicode.test.php
+++ b/_test/cases/inc/utf8_unicode.test.php
@@ -57,4 +57,4 @@ class utf8_unicode_test extends UnitTestCase {
 
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/inc/utf8_utf16be.test.php b/_test/cases/inc/utf8_utf16be.test.php
index 3a346da51e31e9c975d32aebd73b535c2c7f44bb..d8b8746f2bc11a96901cbd0979dd9f2bc7964482 100644
--- a/_test/cases/inc/utf8_utf16be.test.php
+++ b/_test/cases/inc/utf8_utf16be.test.php
@@ -25,4 +25,4 @@ class utf8_utf16be_test extends UnitTestCase {
     }
 }
 
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/_test/cases/lib/exe/css_css_compress.test.php b/_test/cases/lib/exe/css_css_compress.test.php
index 026caad3c495c00b87d3b42be19b2e7811d360a9..527071bbe8d301ffc5985c383c9d6948cfa5ff0d 100644
--- a/_test/cases/lib/exe/css_css_compress.test.php
+++ b/_test/cases/lib/exe/css_css_compress.test.php
@@ -65,4 +65,4 @@ class css_css_compress_test extends UnitTestCase {
 
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/_test/cases/lib/exe/css_css_loadfile.test.php b/_test/cases/lib/exe/css_css_loadfile.test.php
new file mode 100644
index 0000000000000000000000000000000000000000..a444d008661fb40846d7e2fbf99963eeea2c788d
--- /dev/null
+++ b/_test/cases/lib/exe/css_css_loadfile.test.php
@@ -0,0 +1,57 @@
+<?php
+
+require_once DOKU_INC.'lib/exe/css.php';
+
+class css_css_loadfile_test extends UnitTestCase {
+    public function setUp() {
+        $this->file = tempnam('/tmp', 'css');
+        parent::setUp();
+    }
+
+    private function csstest($input, $output = null, $location = 'http://www.example.com/') {
+        io_saveFile($this->file, $input);
+        $this->assertEqual(css_loadfile($this->file, $location), (is_null($output) ? $input : $output));
+    }
+
+    public function test_url_relative() {
+        $this->csstest('#test { background: url("test/test.png"); }', '#test { background: url("http://www.example.com/test/test.png"); }');
+        $this->csstest('#test { background: url(\'test/test.png\'); }', '#test { background: url(\'http://www.example.com/test/test.png\'); }');
+    }
+
+    public function test_url_absolute() {
+        $this->csstest('#test { background: url("/test/test.png"); }');
+        $this->csstest('#test { background: url(\'/test/test.png\'); }');
+    }
+
+    public function test_url_with_protocol() {
+        $this->csstest('#test { background: url("http://www.test.com/test/test.png"); }');
+        $this->csstest('#test { background: url("https://www.test.com/test/test.png"); }');
+        $this->csstest('#test { background: url(\'http://www.test.com/test/test.png\'); }');
+        $this->csstest('#test { background: url(\'https://www.test.com/test/test.png\'); }');
+    }
+
+    public function test_import_relative() {
+        $this->csstest('@import "test/test.png";', '@import "http://www.example.com/test/test.png";');
+        $this->csstest('@import \'test/test.png\';', '@import \'http://www.example.com/test/test.png\';');
+    }
+
+    public function test_import_absolute() {
+        $this->csstest('@import "/test/test.png";');
+        $this->csstest('@import \'/test/test.png\';');
+    }
+
+    public function test_import_with_protocol() {
+        $this->csstest('@import "http://www.test.com/test/test.png";');
+        $this->csstest('@import "https://www.test.com/test/test.png";');
+        $this->csstest('@import \'http://www.test.com/test/test.png\';');
+        $this->csstest('@import \'https://www.test.com/test/test.png\';');
+    }
+
+    public function tearDown() {
+        unlink($this->file);
+        unset($this->file);
+        parent::tearDown();
+    }
+}
+
+//Setup VIM: ex: et ts=4 sw=4 :
diff --git a/_test/cases/lib/exe/js_js_compress.test.php b/_test/cases/lib/exe/js_js_compress.test.php
index 9051dfb014fd6361101ef30bc5a62983e5b304e8..76b51e5ab8f37609efe8e6222687a6e0fbe18158 100644
--- a/_test/cases/lib/exe/js_js_compress.test.php
+++ b/_test/cases/lib/exe/js_js_compress.test.php
@@ -120,4 +120,4 @@ class js_js_compress_test extends UnitTestCase {
     }
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/bin/indexer.php b/bin/indexer.php
index 0d523df6e67c5f3e3d7cc88ef6bd66ba375c9b7f..85e990bbe0fcd63fd0da86ba45828bdc1c1b8973 100755
--- a/bin/indexer.php
+++ b/bin/indexer.php
@@ -186,4 +186,4 @@ function _quietecho($msg) {
     if(!$QUIET) echo $msg;
 }
 
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/bin/striplangs.php b/bin/striplangs.php
new file mode 100644
index 0000000000000000000000000000000000000000..288859c6a2608403a1ead9ef4b0729fbcc95e8aa
--- /dev/null
+++ b/bin/striplangs.php
@@ -0,0 +1,148 @@
+#!/usr/bin/php
+<?php
+/**
+ * Strip unwanted languages from the DokuWiki install
+ *
+ * @author Martin 'E.T.' Misuth <et.github@ethome.sk>
+ */
+if ('cli' != php_sapi_name()) die();
+
+#------------------------------------------------------------------------------
+if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+require_once DOKU_INC.'inc/cliopts.php';
+
+#------------------------------------------------------------------------------
+function usage($show_examples = false) {
+    print "Usage: striplangs.php [-h [-x]] [-e] [-k lang1[,lang2]..[,langN]]
+
+    Removes all languages from the instalation, besides the ones
+    after the -k option. English language is never removed!
+
+    OPTIONS
+        -h, --help     get this help
+        -x, --examples get also usage examples
+        -k, --keep     comma separated list of languages, -e is always implied
+        -e, --english  keeps english, dummy to use without -k";
+    if ( $show_examples ) {
+        print "\n
+    EXAMPLES
+        Strips all languages, but keeps 'en' and 'de':
+         striplangs -k de
+
+        Strips all but 'en','ca-valencia','cs','de','is','sk':
+         striplangs --keep ca-valencia,cs,de,is,sk
+
+        Strips all but 'en':
+         striplangs -e
+
+        No option specified, prints usage and throws error:
+         striplangs\n";
+    }
+}
+
+function getSuppliedArgument($OPTS, $short, $long) {
+    $arg = $OPTS->get($short);
+    if ( is_null($arg) ) {
+        $arg = $OPTS->get($long);
+    }
+    return $arg;
+}
+
+function processPlugins($path, $keep_langs) {
+    if (is_dir($path)) {
+        $entries = scandir($path);
+
+        foreach ($entries as $entry) {
+            if ($entry != "." && $entry != "..") {
+                if ( is_dir($path.'/'.$entry) ) {
+
+                    $plugin_langs = $path.'/'.$entry.'/lang';
+
+                    if ( is_dir( $plugin_langs ) ) {
+                        stripDirLangs($plugin_langs, $keep_langs);
+                    }
+                }
+            }
+        }
+    }
+}
+
+function stripDirLangs($path, $keep_langs) {
+    $dir = dir($path);
+
+    while(($cur_dir = $dir->read()) !== false) {
+        if( $cur_dir != '.' and $cur_dir != '..' and is_dir($path.'/'.$cur_dir)) {
+
+            if ( !in_array($cur_dir, $keep_langs, true ) ) {
+                killDir($path.'/'.$cur_dir);
+            }
+        }
+    }
+    $dir->close();
+}
+
+function killDir($dir) {
+    if (is_dir($dir)) {
+        $entries = scandir($dir);
+
+        foreach ($entries as $entry) {
+            if ($entry != "." && $entry != "..") {
+                if ( is_dir($dir.'/'.$entry) ) {
+                    killDir($dir.'/'.$entry);
+                } else {
+                    unlink($dir.'/'.$entry);
+                }
+            }
+        }
+        reset($entries);
+        rmdir($dir);
+    }
+}
+#------------------------------------------------------------------------------
+
+// handle options
+$short_opts = 'hxk:e';
+$long_opts  = array('help', 'examples', 'keep=','english');
+
+$OPTS = Doku_Cli_Opts::getOptions(__FILE__, $short_opts, $long_opts);
+
+if ( $OPTS->isError() ) {
+    fwrite( STDERR, $OPTS->getMessage() . "\n");
+    exit(1);
+}
+
+// handle '--examples' option
+$show_examples = ( $OPTS->has('x') or $OPTS->has('examples') ) ? true : false;
+
+// handle '--help' option
+if ( $OPTS->has('h') or $OPTS->has('help') ) {
+    usage($show_examples);
+    exit(0);
+}
+
+// handle both '--keep' and '--english' options
+if ( $OPTS->has('k') or $OPTS->has('keep') ) {
+    $preserved_langs = getSuppliedArgument($OPTS,'k','keep');
+    $langs = explode(',', $preserved_langs);
+
+    // ! always enforce 'en' lang when using '--keep' (DW relies on it)
+    if ( !isset($langs['en']) ) {
+      $langs[]='en';
+    }
+} elseif ( $OPTS->has('e') or $OPTS->has('english') ) {
+    // '--english' was specified strip everything besides 'en'
+    $langs = array ('en');
+} else {
+    // no option was specified, print usage but don't do anything as
+    // this run might not be intented
+    usage();
+    print "\n
+    ERROR
+        No option specified, use either -h -x to get more info,
+        or -e to strip every language besides english.\n";
+    exit(1);
+}
+
+// Kill all language directories in /inc/lang and /lib/plugins besides those in $langs array
+stripDirLangs(realpath(dirname(__FILE__).'/../inc/lang'), $langs);
+processPlugins(realpath(dirname(__FILE__).'/../lib/plugins'), $langs);
diff --git a/conf/acronyms.conf b/conf/acronyms.conf
index 13708d2df226a526b6ffeb31b452f411d60c088c..172b9974d2956477edf1e34ede60e6a08d326063 100644
--- a/conf/acronyms.conf
+++ b/conf/acronyms.conf
@@ -71,8 +71,8 @@ MHz          Megahertz
 MIME         Multipurpose Internet Mail Extension
 MIT          Massachusetts Institute of Technology
 MML          Mathematical Markup Language
-MP3          Motion Picture Experts Group Layer 3
-MPEG         Motion Picture Experts Group
+MP3          Moving Picture Experts Group Layer 3
+MPEG         Moving Picture Experts Group
 MSDN         Microsoft Developer Network
 MS           Microsoft
 MSIE         Microsoft Internet Explorer
@@ -101,6 +101,7 @@ POP          Post Office Protocol
 QoS          Quality of Service
 RAID         Redundant Array of Inexpensive Disks
 RDF          Resource Description Framework
+RFC          Request for Comments
 ROTFL        Rolling on the floor laughing
 RPC          Remote Procedure Call
 RSS          Rich Site Summary
diff --git a/conf/dokuwiki.php b/conf/dokuwiki.php
index f10c70e5851e233d3dc45777120b67e2b4f65623..629e7c0c693d90bdfb9d799ae883ff05b62ae41a 100644
--- a/conf/dokuwiki.php
+++ b/conf/dokuwiki.php
@@ -99,6 +99,7 @@ $conf['fetchsize']   = 0;                //maximum size (bytes) fetch.php may do
 $conf['notify']      = '';               //send change info to this email (leave blank for nobody)
 $conf['registernotify'] = '';            //send info about newly registered users to this email (leave blank for nobody)
 $conf['mailfrom']    = '';               //use this email when sending mails
+$conf['mailprefix']  = '';               //use this as prefix of outgoing mails
 $conf['gzip_output'] = 0;                //use gzip content encodeing for the output xhtml (if allowed by browser)
 $conf['gdlib']       = 2;                //the GDlib version (0, 1 or 2) 2 tries to autodetect
 $conf['im_convert']  = '';               //path to ImageMagicks convert (will be used instead of GD)
@@ -121,7 +122,7 @@ $conf['rss_linkto'] = 'diff';            //what page RSS entries link to:
                                          //  'page'    - the revised page itself
                                          //  'rev'     - page showing all revisions
                                          //  'current' - most recent revision of page
-$conf['rss_content'] = 'abstract';       // what to put in the items by deafult?
+$conf['rss_content'] = 'abstract';       // what to put in the items by default?
                                          //  'abstract' - plain text, first paragraph or so
                                          //  'diff'     - plain text unified diff wrapped in <pre> tags
                                          //  'htmldiff' - diff as HTML table
diff --git a/conf/interwiki.conf b/conf/interwiki.conf
index 0e855f62635637988a2a6b94050448a982038b59..7026967923cdfeabf66291d649ec2688b586a9b0 100644
--- a/conf/interwiki.conf
+++ b/conf/interwiki.conf
@@ -21,6 +21,7 @@ man       http://man.cx/
 amazon    http://www.amazon.com/exec/obidos/ASIN/{URL}/splitbrain-20/
 amazon.de http://www.amazon.de/exec/obidos/ASIN/{URL}/splitbrain-21/
 amazon.uk http://www.amazon.co.uk/exec/obidos/ASIN/
+paypal    https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=
 phpfn     http://www.php.net/{NAME}
 coral     http://{HOST}.{PORT}.nyud.net:8090/{PATH}?{QUERY}
 freecache http://freecache.org/{NAME}
diff --git a/doku.php b/doku.php
index 1303f1ade47ef9f5465c3cb47b1c772e867eaa37..6cd0c0e0cf0d5388e43925267d6180d1f21b2946 100644
--- a/doku.php
+++ b/doku.php
@@ -7,7 +7,7 @@
  */
 
 // update message version
-$updateVersion = 29;
+$updateVersion = 30;
 
 //  xdebug_start_profiling();
 
@@ -29,7 +29,10 @@ require_once(DOKU_INC.'inc/init.php');
 //import variables
 $QUERY = trim($_REQUEST['id']);
 $ID    = getID();
+
+// deprecated 2011-01-14
 $NS    = getNS($ID);
+
 $REV   = $_REQUEST['rev'];
 $IDX   = $_REQUEST['idx'];
 $DATE  = $_REQUEST['date'];
diff --git a/feed.php b/feed.php
index 0980dfaa8ff32fb418fa15983a6c52dc51d2657e..615d1597dd03ca34e9727bda0f2a39cc222fc496 100644
--- a/feed.php
+++ b/feed.php
@@ -24,7 +24,7 @@ $cache = new cache($key, '.feed');
 // prepare cache depends
 $depends['files'] = getConfigFiles('main');
 $depends['age']   = $conf['rss_update'];
-$depends['purge'] = ($_REQUEST['purge']) ? true : false;
+$depends['purge'] = isset($_REQUEST['purge']);
 
 // check cacheage and deliver if nothing has changed since last
 // time or the update interval has not passed, also handles conditional requests
@@ -55,18 +55,20 @@ $image->link = DOKU_URL;
 $rss->image = $image;
 
 $data = null;
-if($opt['feed_mode'] == 'list'){
-    $data = rssListNamespace($opt);
-}elseif($opt['feed_mode'] == 'search'){
-    $data = rssSearch($opt);
-}else{
+$modes = array('list'   => 'rssListNamespace',
+               'search' => 'rssSearch',
+               'recent' => 'rssRecentChanges');
+if (isset($modes[$opt['feed_mode']])) {
+    $data = $modes[$opt['feed_mode']]($opt);
+} else {
     $eventData = array(
         'opt'  => &$opt,
         'data' => &$data,
     );
     $event = new Doku_Event('FEED_MODE_UNKNOWN', $eventData);
     if ($event->advise_before(true)) {
-        $data = rssRecentChanges($opt);
+        echo sprintf('<error>Unknown feed mode %s</error>', hsc($opt['feed_mode']));
+        exit;
     }
     $event->advise_after();
 }
@@ -83,29 +85,53 @@ print $feed;
 // ---------------------------------------------------------------- //
 
 /**
- * Get URL parameters and config options and return a initialized option array
+ * Get URL parameters and config options and return an initialized option array
  *
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 function rss_parseOptions(){
     global $conf;
 
-    $opt['items']        = (int) $_REQUEST['num'];
-    $opt['feed_type']    = $_REQUEST['type'];
-    $opt['feed_mode']    = $_REQUEST['mode'];
-    $opt['show_minor']   = $_REQUEST['minor'];
-    $opt['namespace']    = $_REQUEST['ns'];
-    $opt['link_to']      = $_REQUEST['linkto'];
-    $opt['item_content'] = $_REQUEST['content'];
-    $opt['search_query'] = $_REQUEST['q'];
-
-    if(!$opt['feed_type'])    $opt['feed_type']    = $conf['rss_type'];
-    if(!$opt['item_content']) $opt['item_content'] = $conf['rss_content'];
-    if(!$opt['link_to'])      $opt['link_to']      = $conf['rss_linkto'];
-    if(!$opt['items'])        $opt['items']        = $conf['recent'];
+    $opt = array();
+
+    foreach(array(
+                  // Basic feed properties
+                  // Plugins may probably want to add new values to these
+                  // properties for implementing own feeds
+
+                  // One of: list, search, recent
+                  'feed_mode'    => array('mode', 'recent'),
+                  // One of: diff, page, rev, current
+                  'link_to'      => array('linkto', $conf['rss_linkto']),
+                  // One of: abstract, diff, htmldiff, html
+                  'item_content' => array('content', $conf['rss_content']),
+
+                  // Special feed properties
+                  // These are only used by certain feed_modes
+
+                  // String, used for feed title, in list and rc mode
+                  'namespace'    => array('ns', null),
+                  // Positive integer, only used in rc mode
+                  'items'        => array('num', $conf['recent']),
+                  // Boolean, only used in rc mode
+                  'show_minor'   => array('minor', false),
+                  // String, only used in search mode
+                  'search_query' => array('q', null),
+
+                 ) as $name => $val) {
+        $opt[$name] = (isset($_REQUEST[$val[0]]) && !empty($_REQUEST[$val[0]]))
+                      ? $_REQUEST[$val[0]] : $val[1];
+    }
+
+    $opt['items']        = max(0, (int)  $opt['items']);
+    $opt['show_minor']   = (bool) $opt['show_minor'];
+
     $opt['guardmail']  = ($conf['mailguard'] != '' && $conf['mailguard'] != 'none');
 
-    switch ($opt['feed_type']){
+    $type = valid_input_set('type', array('rss','rss2','atom','atom1','rss1',
+                                          'default' => $conf['rss_type']),
+                            $_REQUEST);
+    switch ($type){
         case 'rss':
             $opt['feed_type'] = 'RSS0.91';
             $opt['mime_type'] = 'text/xml';
@@ -279,7 +305,7 @@ function rss_buildItems(&$rss,&$data,$opt){
             }
 
             // add category
-            if($meta['subject']){
+            if(isset($meta['subject'])) {
                 $item->category = $meta['subject'];
             }else{
                 $cat = getNS($id);
@@ -349,4 +375,4 @@ function rssSearch($opt){
     return $data;
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/inc/DifferenceEngine.php b/inc/DifferenceEngine.php
index 7b14e446306b156583576f265c6899ac2e9dd736..dd096a55a9de6883b3bb473a001500f49d2218e5 100644
--- a/inc/DifferenceEngine.php
+++ b/inc/DifferenceEngine.php
@@ -30,7 +30,7 @@ class _DiffOp {
 class _DiffOp_Copy extends _DiffOp {
     var $type = 'copy';
 
-    function _DiffOp_Copy ($orig, $closing = false) {
+    function _DiffOp_Copy($orig, $closing = false) {
         if (!is_array($closing))
             $closing = $orig;
         $this->orig = $orig;
@@ -45,7 +45,7 @@ class _DiffOp_Copy extends _DiffOp {
 class _DiffOp_Delete extends _DiffOp {
     var $type = 'delete';
 
-    function _DiffOp_Delete ($lines) {
+    function _DiffOp_Delete($lines) {
         $this->orig = $lines;
         $this->closing = false;
     }
@@ -58,7 +58,7 @@ class _DiffOp_Delete extends _DiffOp {
 class _DiffOp_Add extends _DiffOp {
     var $type = 'add';
 
-    function _DiffOp_Add ($lines) {
+    function _DiffOp_Add($lines) {
         $this->closing = $lines;
         $this->orig = false;
     }
@@ -71,7 +71,7 @@ class _DiffOp_Add extends _DiffOp {
 class _DiffOp_Change extends _DiffOp {
     var $type = 'change';
 
-    function _DiffOp_Change ($orig, $closing) {
+    function _DiffOp_Change($orig, $closing) {
         $this->orig = $orig;
         $this->closing = $closing;
     }
@@ -104,7 +104,7 @@ class _DiffOp_Change extends _DiffOp {
  */
 class _DiffEngine {
 
-    function diff ($from_lines, $to_lines) {
+    function diff($from_lines, $to_lines) {
         $n_from = count($from_lines);
         $n_to = count($to_lines);
 
@@ -135,7 +135,7 @@ class _DiffEngine {
             $xhash[$from_lines[$xi]] = 1;
         for ($yi = $skip; $yi < $n_to - $endskip; $yi++) {
             $line = $to_lines[$yi];
-            if ( ($this->ychanged[$yi] = empty($xhash[$line])) )
+            if (($this->ychanged[$yi] = empty($xhash[$line])))
                 continue;
             $yhash[$line] = 1;
             $this->yv[] = $line;
@@ -143,7 +143,7 @@ class _DiffEngine {
         }
         for ($xi = $skip; $xi < $n_from - $endskip; $xi++) {
             $line = $from_lines[$xi];
-            if ( ($this->xchanged[$xi] = empty($yhash[$line])) )
+            if (($this->xchanged[$xi] = empty($yhash[$line])))
                 continue;
             $this->xv[] = $line;
             $this->xind[] = $xi;
@@ -165,8 +165,7 @@ class _DiffEngine {
 
             // Skip matching "snake".
             $copy = array();
-            while ( $xi < $n_from && $yi < $n_to
-                    && !$this->xchanged[$xi] && !$this->ychanged[$yi]) {
+            while ($xi < $n_from && $yi < $n_to && !$this->xchanged[$xi] && !$this->ychanged[$yi]) {
                 $copy[] = $from_lines[$xi++];
                 ++$yi;
             }
@@ -210,15 +209,14 @@ class _DiffEngine {
      * match.  The caller must trim matching lines from the beginning and end
      * of the portions it is going to specify.
      */
-    function _diag ($xoff, $xlim, $yoff, $ylim, $nchunks) {
+    function _diag($xoff, $xlim, $yoff, $ylim, $nchunks) {
         $flip = false;
 
         if ($xlim - $xoff > $ylim - $yoff) {
             // Things seems faster (I'm not sure I understand why)
             // when the shortest sequence in X.
             $flip = true;
-            list ($xoff, $xlim, $yoff, $ylim)
-                = array( $yoff, $ylim, $xoff, $xlim);
+            list ($xoff, $xlim, $yoff, $ylim) = array($yoff, $ylim, $xoff, $xlim);
         }
 
         if ($flip)
@@ -284,7 +282,7 @@ class _DiffEngine {
         return array($this->lcs, $seps);
     }
 
-    function _lcs_pos ($ypos) {
+    function _lcs_pos($ypos) {
         $end = $this->lcs;
         if ($end == 0 || $ypos > $this->seq[$end]) {
             $this->seq[++$this->lcs] = $ypos;
@@ -295,7 +293,7 @@ class _DiffEngine {
         $beg = 1;
         while ($beg < $end) {
             $mid = (int)(($beg + $end) / 2);
-            if ( $ypos > $this->seq[$mid] )
+            if ($ypos > $this->seq[$mid])
                 $beg = $mid + 1;
             else
                 $end = $mid;
@@ -321,17 +319,15 @@ class _DiffEngine {
      * Note that XLIM, YLIM are exclusive bounds.
      * All line numbers are origin-0 and discarded lines are not counted.
      */
-    function _compareseq ($xoff, $xlim, $yoff, $ylim) {
+    function _compareseq($xoff, $xlim, $yoff, $ylim) {
         // Slide down the bottom initial diagonal.
-        while ($xoff < $xlim && $yoff < $ylim
-                && $this->xv[$xoff] == $this->yv[$yoff]) {
+        while ($xoff < $xlim && $yoff < $ylim && $this->xv[$xoff] == $this->yv[$yoff]) {
             ++$xoff;
             ++$yoff;
         }
 
         // Slide up the top initial diagonal.
-        while ($xlim > $xoff && $ylim > $yoff
-                && $this->xv[$xlim - 1] == $this->yv[$ylim - 1]) {
+        while ($xlim > $xoff && $ylim > $yoff && $this->xv[$xlim - 1] == $this->yv[$ylim - 1]) {
             --$xlim;
             --$ylim;
         }
@@ -379,7 +375,7 @@ class _DiffEngine {
      *
      * This is extracted verbatim from analyze.c (GNU diffutils-2.7).
      */
-    function _shift_boundaries ($lines, &$changed, $other_changed) {
+    function _shift_boundaries($lines, &$changed, $other_changed) {
         $i = 0;
         $j = 0;
 
@@ -519,7 +515,7 @@ class Diff {
      * @return object A Diff object representing the inverse of the
      *          original diff.
      */
-    function reverse () {
+    function reverse() {
         $rev = $this;
         $rev->edits = array();
         foreach ($this->edits as $edit) {
@@ -533,7 +529,7 @@ class Diff {
      *
      * @return bool True iff two sequences were identical.
      */
-    function isEmpty () {
+    function isEmpty() {
         foreach ($this->edits as $edit) {
             if ($edit->type != 'copy')
                 return false;
@@ -548,7 +544,7 @@ class Diff {
      *
      * @return int The length of the LCS.
      */
-    function lcs () {
+    function lcs() {
         $lcs = 0;
         foreach ($this->edits as $edit) {
             if ($edit->type == 'copy')
@@ -598,7 +594,7 @@ class Diff {
      *
      * This is here only for debugging purposes.
      */
-    function _check ($from_lines, $to_lines) {
+    function _check($from_lines, $to_lines) {
         if (serialize($from_lines) != serialize($this->orig()))
             trigger_error("Reconstructed original doesn't match", E_USER_ERROR);
         if (serialize($to_lines) != serialize($this->closing()))
@@ -612,7 +608,7 @@ class Diff {
 
         $prevtype = 'none';
         foreach ($this->edits as $edit) {
-            if ( $prevtype == $edit->type )
+            if ($prevtype == $edit->type)
                 trigger_error("Edit sequence is non-optimal", E_USER_ERROR);
             $prevtype = $edit->type;
         }
@@ -649,8 +645,7 @@ class MappedDiff extends Diff {
      * @param $mapped_to_lines array This array should
      *  have the same number of elements as $to_lines.
      */
-    function MappedDiff($from_lines, $to_lines,
-            $mapped_from_lines, $mapped_to_lines) {
+    function MappedDiff($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines) {
 
         assert(count($from_lines) == count($mapped_from_lines));
         assert(count($to_lines) == count($mapped_to_lines));
@@ -727,9 +722,7 @@ class DiffFormatter {
                             $context = array_slice($edit->orig, 0, $ntrail);
                             $block[] = new _DiffOp_Copy($context);
                         }
-                        $this->_block($x0, $ntrail + $xi - $x0,
-                                $y0, $ntrail + $yi - $y0,
-                                $block);
+                        $this->_block($x0, $ntrail + $xi - $x0, $y0, $ntrail + $yi - $y0, $block);
                         $block = false;
                     }
                 }
@@ -754,9 +747,7 @@ class DiffFormatter {
         }
 
         if (is_array($block))
-            $this->_block($x0, $xi - $x0,
-                    $y0, $yi - $y0,
-                    $block);
+            $this->_block($x0, $xi - $x0, $y0, $yi - $y0, $block);
 
         return $this->_end_diff();
     }
@@ -836,17 +827,21 @@ class DiffFormatter {
 define('NBSP', "\xC2\xA0");     // utf-8 non-breaking space.
 
 class _HWLDF_WordAccumulator {
-    function _HWLDF_WordAccumulator () {
+    function _HWLDF_WordAccumulator() {
         $this->_lines = array();
         $this->_line = '';
         $this->_group = '';
         $this->_tag = '';
     }
 
-    function _flushGroup ($new_tag) {
+    function _flushGroup($new_tag) {
         if ($this->_group !== '') {
             if ($this->_tag == 'mark')
                 $this->_line .= '<strong>'.$this->_group.'</strong>';
+            elseif ($this->_tag == 'add')
+                $this->_line .= '<span class="diff-addedline">'.$this->_group.'</span>';
+            elseif ($this->_tag == 'del')
+                $this->_line .= '<span class="diff-deletedline"><del>'.$this->_group.'</del></span>';
             else
                 $this->_line .= $this->_group;
         }
@@ -854,14 +849,14 @@ class _HWLDF_WordAccumulator {
         $this->_tag = $new_tag;
     }
 
-    function _flushLine ($new_tag) {
+    function _flushLine($new_tag) {
         $this->_flushGroup($new_tag);
         if ($this->_line != '')
             $this->_lines[] = $this->_line;
         $this->_line = '';
     }
 
-    function addWords ($words, $tag = '') {
+    function addWords($words, $tag = '') {
         if ($tag != $this->_tag)
             $this->_flushGroup($tag);
 
@@ -887,46 +882,80 @@ class _HWLDF_WordAccumulator {
 
 class WordLevelDiff extends MappedDiff {
 
-    function WordLevelDiff ($orig_lines, $closing_lines) {
+    function WordLevelDiff($orig_lines, $closing_lines) {
         list ($orig_words, $orig_stripped) = $this->_split($orig_lines);
         list ($closing_words, $closing_stripped) = $this->_split($closing_lines);
 
-        $this->MappedDiff($orig_words, $closing_words,
-                $orig_stripped, $closing_stripped);
+        $this->MappedDiff($orig_words, $closing_words, $orig_stripped, $closing_stripped);
     }
 
     function _split($lines) {
-            if (!preg_match_all('/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xs',
-                    implode("\n", $lines),
-                    $m)) {
+        if (!preg_match_all('/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xsu',
+             implode("\n", $lines), $m)) {
             return array(array(''), array(''));
-            }
-            return array($m[0], $m[1]);
-            }
+        }
+        return array($m[0], $m[1]);
+    }
 
-            function orig () {
-            $orig = new _HWLDF_WordAccumulator;
+    function orig() {
+        $orig = new _HWLDF_WordAccumulator;
 
-            foreach ($this->edits as $edit) {
+        foreach ($this->edits as $edit) {
             if ($edit->type == 'copy')
-            $orig->addWords($edit->orig);
+                $orig->addWords($edit->orig);
             elseif ($edit->orig)
-            $orig->addWords($edit->orig, 'mark');
-            }
-            return $orig->getLines();
-            }
+                $orig->addWords($edit->orig, 'mark');
+        }
+        return $orig->getLines();
+    }
 
-            function closing () {
-                $closing = new _HWLDF_WordAccumulator;
+    function closing() {
+        $closing = new _HWLDF_WordAccumulator;
 
-                foreach ($this->edits as $edit) {
-                    if ($edit->type == 'copy')
-                        $closing->addWords($edit->closing);
-                    elseif ($edit->closing)
-                        $closing->addWords($edit->closing, 'mark');
-                }
-                return $closing->getLines();
-            }
+        foreach ($this->edits as $edit) {
+            if ($edit->type == 'copy')
+                $closing->addWords($edit->closing);
+            elseif ($edit->closing)
+                $closing->addWords($edit->closing, 'mark');
+        }
+        return $closing->getLines();
+    }
+}
+
+class InlineWordLevelDiff extends MappedDiff {
+
+    function InlineWordLevelDiff($orig_lines, $closing_lines) {
+        list ($orig_words, $orig_stripped) = $this->_split($orig_lines);
+        list ($closing_words, $closing_stripped) = $this->_split($closing_lines);
+
+        $this->MappedDiff($orig_words, $closing_words, $orig_stripped, $closing_stripped);
+    }
+
+    function _split($lines) {
+        if (!preg_match_all('/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xs',
+             implode("\n", $lines), $m)) {
+            return array(array(''), array(''));
+        }
+        return array($m[0], $m[1]);
+    }
+
+    function inline() {
+        $orig = new _HWLDF_WordAccumulator;
+        foreach ($this->edits as $edit) {
+            if ($edit->type == 'copy')
+                $orig->addWords($edit->orig);
+            elseif ($edit->type == 'change'){
+                $orig->addWords($edit->orig, 'del');
+                $orig->addWords($edit->closing, 'add');
+            } elseif ($edit->type == 'delete')
+                $orig->addWords($edit->orig, 'del');
+            elseif ($edit->type == 'add')
+                $orig->addWords($edit->closing, 'add');
+            elseif ($edit->orig)
+                $orig->addWords($edit->orig, 'del');
+        }
+        return $orig->getLines();
+    }
 }
 
 /**
@@ -986,78 +1015,147 @@ class TableDiffFormatter extends DiffFormatter {
         return $text;
     }
 
-    function _block_header( $xbeg, $xlen, $ybeg, $ylen ) {
+    function _block_header($xbeg, $xlen, $ybeg, $ylen) {
         global $lang;
         $l1 = $lang['line'].' '.$xbeg;
         $l2 = $lang['line'].' '.$ybeg;
-        $r = '<tr><td class="diff-blockheader" colspan="2">'.$l1.":</td>\n" .
-            '<td class="diff-blockheader" colspan="2">'.$l2.":</td></tr>\n";
+        $r = '<tr><td class="diff-blockheader" colspan="2">'.$l1.":</td>\n".
+             '    <td class="diff-blockheader" colspan="2">'.$l2.":</td>\n".
+             "</tr>\n";
         return $r;
     }
 
-    function _start_block( $header ) {
-        print( $header );
+    function _start_block($header) {
+        print($header);
     }
 
     function _end_block() {
     }
 
-    function _lines( $lines, $prefix=' ', $color="white" ) {
+    function _lines($lines, $prefix=' ', $color="white") {
     }
 
-    function addedLine( $line ) {
-        return '<td>+</td><td class="diff-addedline">' .
-            $line.'</td>';
-
+    function addedLine($line) {
+        return '<td>+</td><td class="diff-addedline">' .  $line.'</td>';
     }
 
-    function deletedLine( $line ) {
-        return '<td>-</td><td class="diff-deletedline">' .
-            $line.'</td>';
+    function deletedLine($line) {
+        return '<td>-</td><td class="diff-deletedline">' .  $line.'</td>';
     }
 
     function emptyLine() {
         return '<td colspan="2">&nbsp;</td>';
     }
 
-    function contextLine( $line ) {
+    function contextLine($line) {
         return '<td> </td><td class="diff-context">'.$line.'</td>';
     }
 
     function _added($lines) {
         foreach ($lines as $line) {
-            print( '<tr>' . $this->emptyLine() .
-                    $this->addedLine( $line ) . "</tr>\n" );
+            print('<tr>' . $this->emptyLine() . $this->addedLine($line) . "</tr>\n");
         }
     }
 
     function _deleted($lines) {
         foreach ($lines as $line) {
-            print( '<tr>' . $this->deletedLine( $line ) .
-                    $this->emptyLine() . "</tr>\n" );
+            print('<tr>' . $this->deletedLine($line) . $this->emptyLine() . "</tr>\n");
         }
     }
 
-    function _context( $lines ) {
+    function _context($lines) {
         foreach ($lines as $line) {
-            print( '<tr>' . $this->contextLine( $line ) .
-                    $this->contextLine( $line ) . "</tr>\n" );
+            print('<tr>' . $this->contextLine($line) .  $this->contextLine($line) . "</tr>\n");
         }
     }
 
-    function _changed( $orig, $closing ) {
-        $diff = new WordLevelDiff( $orig, $closing );
+    function _changed($orig, $closing) {
+        $diff = new WordLevelDiff($orig, $closing);
         $del = $diff->orig();
         $add = $diff->closing();
 
-        while ( $line = array_shift( $del ) ) {
-            $aline = array_shift( $add );
-            print( '<tr>' . $this->deletedLine( $line ) .
-                    $this->addedLine( $aline ) . "</tr>\n" );
+        while ($line = array_shift($del)) {
+            $aline = array_shift($add);
+            print('<tr>' . $this->deletedLine($line) . $this->addedLine($aline) . "</tr>\n");
         }
-        $this->_added( $add ); # If any leftovers
+        $this->_added($add); # If any leftovers
+    }
+}
+
+/**
+ *  Inline style diff formatter.
+ *
+ */
+class InlineDiffFormatter extends DiffFormatter {
+
+    function InlineDiffFormatter() {
+        $this->leading_context_lines = 2;
+        $this->trailing_context_lines = 2;
+    }
+
+    function format($diff) {
+        // Preserve whitespaces by converting some to non-breaking spaces.
+        // Do not convert all of them to allow word-wrap.
+        $val = parent::format($diff);
+        $val = str_replace('  ','&nbsp; ', $val);
+        $val = preg_replace('/ (?=<)|(?<=[ >]) /', '&nbsp;', $val);
+        return $val;
+    }
+
+    function _pre($text){
+        $text = htmlspecialchars($text);
+        return $text;
+    }
+
+    function _block_header($xbeg, $xlen, $ybeg, $ylen) {
+        global $lang;
+        if ($xlen != 1)
+            $xbeg .= "," . $xlen;
+        if ($ylen != 1)
+            $ybeg .= "," . $ylen;
+        $r = '<tr><td class="diff-blockheader">@@ '.$lang['line']." -$xbeg +$ybeg @@";
+        $r .= ' <span class="diff-deletedline"><del>'.$lang['deleted'].'</del></span>';
+        $r .= ' <span class="diff-addedline">'.$lang['created'].'</span>';
+        $r .= "</td></tr>\n";
+        return $r;
+    }
+
+    function _start_block($header) {
+        print($header."\n");
+    }
+
+    function _end_block() {
+    }
+
+    function _lines($lines, $prefix=' ', $color="white") {
+    }
+
+    function _added($lines) {
+        foreach ($lines as $line) {
+            print('<tr><td class="diff-addedline">'. $line . "</td></tr>\n");
+        }
+    }
+
+    function _deleted($lines) {
+        foreach ($lines as $line) {
+            print('<tr><td class="diff-deletedline"><del>' . $line . "</del></td></tr>\n");
+        }
+    }
+
+    function _context($lines) {
+        foreach ($lines as $line) {
+            print('<tr><td class="diff-context">'.$line."</td></tr>\n");
+        }
+    }
+
+    function _changed($orig, $closing) {
+        $diff = new InlineWordLevelDiff($orig, $closing);
+        $add = $diff->inline();
+
+        foreach ($add as $line)
+            print('<tr><td>'.$line."</td></tr>\n");
     }
 }
 
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/inc/EmailAddressValidator.php b/inc/EmailAddressValidator.php
index 2ce2093e2a97bf00ab28140ea6c38aff5ec68af0..31b34cc58adff5df8629949f9a243421d3a29f42 100644
--- a/inc/EmailAddressValidator.php
+++ b/inc/EmailAddressValidator.php
@@ -5,21 +5,38 @@
  * @author  Dave Child <dave@addedbytes.com>
  * @link    http://code.google.com/p/php-email-address-validation/
  * @license http://www.opensource.org/licenses/bsd-license.php
+ * @version SVN r10 + Issue 15 fix
  */
 class EmailAddressValidator {
+    /**
+     * Set true to allow addresses like me@localhost
+     */
+    public $allowLocalAddresses = false;
 
     /**
      * Check email address validity
      * @param   strEmailAddress     Email address to be checked
      * @return  True if email is valid, false if not
      */
-    function check_email_address($strEmailAddress) {
+    public function check_email_address($strEmailAddress) {
+
+        // If magic quotes is "on", email addresses with quote marks will
+        // fail validation because of added escape characters. Uncommenting
+        // the next three lines will allow for this issue.
+        //if (get_magic_quotes_gpc()) {
+        //    $strEmailAddress = stripslashes($strEmailAddress);
+        //}
 
         // Control characters are not allowed
         if (preg_match('/[\x00-\x1F\x7F-\xFF]/', $strEmailAddress)) {
             return false;
         }
 
+        // Check email length - min 3 (a@a), max 256
+        if (!$this->check_text_length($strEmailAddress, 3, 256)) {
+            return false;
+        }
+
         // Split it into sections using last instance of "@"
         $intAtSymbol = strrpos($strEmailAddress, '@');
         if ($intAtSymbol === false) {
@@ -31,10 +48,15 @@ class EmailAddressValidator {
 
         // Count the "@" symbols. Only one is allowed, except where
         // contained in quote marks in the local part. Quickest way to
-        // check this is to remove anything in quotes.
-        $arrTempAddress[0] = preg_replace('/"[^"]+"/'
+        // check this is to remove anything in quotes. We also remove
+        // characters escaped with backslash, and the backslash
+        // character.
+        $arrTempAddress[0] = preg_replace('/\./'
                                          ,''
                                          ,$arrEmailAddress[0]);
+        $arrTempAddress[0] = preg_replace('/"[^"]+"/'
+                                         ,''
+                                         ,$arrTempAddress[0]);
         $arrTempAddress[1] = $arrEmailAddress[1];
         $strTempAddress = $arrTempAddress[0] . $arrTempAddress[1];
         // Then check - should be no "@" symbols.
@@ -63,7 +85,7 @@ class EmailAddressValidator {
      * @param   strLocalPortion     Text to be checked
      * @return  True if local portion is valid, false if not
      */
-    function check_local_portion($strLocalPortion) {
+    protected function check_local_portion($strLocalPortion) {
         // Local portion can only be from 1 to 64 characters, inclusive.
         // Please note that servers are encouraged to accept longer local
         // parts than 64 characters.
@@ -94,7 +116,7 @@ class EmailAddressValidator {
      * @param   strDomainPortion     Text to be checked
      * @return  True if domain portion is valid, false if not
      */
-    function check_domain_portion($strDomainPortion) {
+    protected function check_domain_portion($strDomainPortion) {
         // Total domain can only be from 1 to 255 characters, inclusive
         if (!$this->check_text_length($strDomainPortion, 1, 255)) {
             return false;
@@ -109,7 +131,7 @@ class EmailAddressValidator {
             return true;
         } else {
             $arrDomainPortion = explode('.', $strDomainPortion);
-            if (sizeof($arrDomainPortion) < 2) {
+            if (!$this->allowLocalAddresses && sizeof($arrDomainPortion) < 2) {
                 return false; // Not enough parts to domain
             }
             for ($i = 0, $max = sizeof($arrDomainPortion); $i < $max; $i++) {
@@ -121,6 +143,11 @@ class EmailAddressValidator {
                    .'([A-Za-z0-9]+))$/', $arrDomainPortion[$i])) {
                     return false;
                 }
+                if ($i == $max - 1) { // TLD cannot be only numbers
+                    if (strlen(preg_replace('/[0-9]/', '', $arrDomainPortion[$i])) <= 0) {
+                        return false;
+                    }
+                }
             }
         }
         return true;
@@ -133,7 +160,7 @@ class EmailAddressValidator {
      * @param   intMaximum  Maximum acceptable length
      * @return  True if string is within bounds (inclusive), false if not
      */
-    function check_text_length($strText, $intMinimum, $intMaximum) {
+    protected function check_text_length($strText, $intMinimum, $intMaximum) {
         // Minimum and maximum are both inclusive
         $intTextLength = strlen($strText);
         if (($intTextLength < $intMinimum) || ($intTextLength > $intMaximum)) {
@@ -142,5 +169,6 @@ class EmailAddressValidator {
             return true;
         }
     }
+
 }
 
diff --git a/inc/FeedParser.php b/inc/FeedParser.php
index 9d00e7abf88ec9dacbfd2fc6de86e718bd0faf46..b98350da7bee27b6c7b20656ff69e8c16448d15b 100644
--- a/inc/FeedParser.php
+++ b/inc/FeedParser.php
@@ -49,6 +49,7 @@ class FeedParser_File extends SimplePie_File {
      */
     function FeedParser_File($url, $timeout=10, $redirects=5,
                              $headers=null, $useragent=null, $force_fsockopen=false) {
+        parent::__construct();
         $this->http    = new DokuHTTPClient();
         $this->success = $this->http->sendRequest($url);
 
diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php
index e68679bdef8a7af9f347349f0bfc57accd6be4fa..1cb16714d6ede03bac090534aa00037b00803330 100644
--- a/inc/HTTPClient.php
+++ b/inc/HTTPClient.php
@@ -71,6 +71,7 @@ class DokuHTTPClient extends HTTPClient {
  * @link   http://www.splitbrain.org/go/videodb
  * @author Andreas Goetz <cpuidle@gmx.de>
  * @author Andreas Gohr <andi@splitbrain.org>
+ * @author Tobias Sarnowski <sarnowski@new-thoughts.org>
  */
 class HTTPClient {
     //set these if you like
@@ -86,13 +87,14 @@ class HTTPClient {
     var $headers;
     var $debug;
     var $start = 0; // for timings
+    var $keep_alive = true; // keep alive rocks
 
     // don't set these, read on error
     var $error;
     var $redirect_count;
 
     // read these after a successful request
-    var $resp_status;
+    var $status;
     var $resp_body;
     var $resp_headers;
 
@@ -108,6 +110,9 @@ class HTTPClient {
     var $proxy_ssl; //boolean set to true if your proxy needs SSL
     var $proxy_except; // regexp of URLs to exclude from proxy
 
+    // list of kept alive connections
+    static $connections = array();
+
     // what we use as boundary on multipart/form-data posts
     var $boundary = '---DokuWikiHTTPClient--4523452351';
 
@@ -222,7 +227,7 @@ class HTTPClient {
         $path   = $uri['path'];
         if(empty($path)) $path = '/';
         if(!empty($uri['query'])) $path .= '?'.$uri['query'];
-        $port = $uri['port'];
+        if(isset($uri['port']) && !empty($uri['port'])) $port = $uri['port'];
         if(isset($uri['user'])) $this->user = $uri['user'];
         if(isset($uri['pass'])) $this->pass = $uri['pass'];
 
@@ -235,7 +240,7 @@ class HTTPClient {
         }else{
             $request_url = $path;
             $server      = $server;
-            if (empty($port)) $port = ($uri['scheme'] == 'https') ? 443 : 80;
+            if (!isset($port)) $port = ($uri['scheme'] == 'https') ? 443 : 80;
         }
 
         // add SSL stream prefix if needed - needs SSL support in PHP
@@ -247,7 +252,11 @@ class HTTPClient {
         if($uri['port']) $headers['Host'].= ':'.$uri['port'];
         $headers['User-Agent'] = $this->agent;
         $headers['Referer']    = $this->referer;
-        $headers['Connection'] = 'Close';
+        if ($this->keep_alive) {
+            $headers['Connection'] = 'Keep-Alive';
+        } else {
+            $headers['Connection'] = 'Close';
+        }
         if($method == 'POST'){
             if(is_array($data)){
                 if($headers['Content-Type'] == 'multipart/form-data'){
@@ -273,15 +282,33 @@ class HTTPClient {
         // stop time
         $start = time();
 
-        // open socket
-        $socket = @fsockopen($server,$port,$errno, $errstr, $this->timeout);
-        if (!$socket){
-            $this->status = -100;
-            $this->error = "Could not connect to $server:$port\n$errstr ($errno)";
-            return false;
+        // already connected?
+        $connectionId = $this->_uniqueConnectionId($server,$port);
+        $this->_debug('connection pool', $this->connections);
+        $socket = null;
+        if (isset($this->connections[$connectionId])) {
+            $this->_debug('reusing connection', $connectionId);
+            $socket = $this->connections[$connectionId];
+        }
+        if (is_null($socket) || feof($socket)) {
+            $this->_debug('opening connection', $connectionId);
+            // open socket
+            $socket = @fsockopen($server,$port,$errno, $errstr, $this->timeout);
+            if (!$socket){
+                $this->status = -100;
+                $this->error = "Could not connect to $server:$port\n$errstr ($errno)";
+                return false;
+            }
+            //set non blocking
+            stream_set_blocking($socket,0);
+
+            // keep alive?
+            if ($this->keep_alive) {
+                $this->connections[$connectionId] = $socket;
+            } else {
+                unset($this->connections[$connectionId]);
+            }
         }
-        //set non blocking
-        stream_set_blocking($socket,0);
 
         // build request
         $request  = "$method $request_url HTTP/".$this->http.HTTP_NL;
@@ -300,6 +327,7 @@ class HTTPClient {
             if($ret === false){
                 $this->status = -100;
                 $this->error = 'Failed writing to socket';
+                unset($this->connections[$connectionId]);
                 return false;
             }
             $written += $ret;
@@ -311,10 +339,12 @@ class HTTPClient {
             if(time()-$start > $this->timeout){
                 $this->status = -100;
                 $this->error = sprintf('Timeout while reading headers (%.3fs)',$this->_time() - $this->start);
+                unset($this->connections[$connectionId]);
                 return false;
             }
             if(feof($socket)){
                 $this->error = 'Premature End of File (socket)';
+                unset($this->connections[$connectionId]);
                 return false;
             }
             $r_headers .= fgets($socket,1024);
@@ -327,6 +357,7 @@ class HTTPClient {
             if($match[1] > $this->max_bodysize){
                 $this->error = 'Reported content length exceeds allowed response size';
                 if ($this->max_bodysize_abort)
+                    unset($this->connections[$connectionId]);
                     return false;
             }
         }
@@ -334,6 +365,7 @@ class HTTPClient {
         // get Status
         if (!preg_match('/^HTTP\/(\d\.\d)\s*(\d+).*?\n/', $r_headers, $m)) {
             $this->error = 'Server returned bad answer';
+            unset($this->connections[$connectionId]);
             return false;
         }
         $this->status = $m[2];
@@ -359,6 +391,11 @@ class HTTPClient {
 
         // check server status code to follow redirect
         if($this->status == 301 || $this->status == 302 ){
+            // close the connection because we don't handle content retrieval here
+            // that's the easiest way to clean up the connection
+            fclose($socket);
+            unset($this->connections[$connectionId]);
+
             if (empty($this->resp_headers['location'])){
                 $this->error = 'Redirect but no Location Header found';
                 return false;
@@ -386,6 +423,7 @@ class HTTPClient {
         // check if headers are as expected
         if($this->header_regexp && !preg_match($this->header_regexp,$r_headers)){
             $this->error = 'The received headers did not match the given regexp';
+            unset($this->connections[$connectionId]);
             return false;
         }
 
@@ -397,11 +435,13 @@ class HTTPClient {
                 do {
                     if(feof($socket)){
                         $this->error = 'Premature End of File (socket)';
+                        unset($this->connections[$connectionId]);
                         return false;
                     }
                     if(time()-$start > $this->timeout){
                         $this->status = -100;
                         $this->error = sprintf('Timeout while reading chunk (%.3fs)',$this->_time() - $this->start);
+                        unset($this->connections[$connectionId]);
                         return false;
                     }
                     $byte = fread($socket,1);
@@ -418,10 +458,12 @@ class HTTPClient {
 
                 if($this->max_bodysize && strlen($r_body) > $this->max_bodysize){
                     $this->error = 'Allowed response size exceeded';
-                    if ($this->max_bodysize_abort)
+                    if ($this->max_bodysize_abort){
+                        unset($this->connections[$connectionId]);
                         return false;
-                    else
+                    } else {
                         break;
+                    }
                 }
             } while ($chunk_size);
         }else{
@@ -430,16 +472,19 @@ class HTTPClient {
                 if(time()-$start > $this->timeout){
                     $this->status = -100;
                     $this->error = sprintf('Timeout while reading response (%.3fs)',$this->_time() - $this->start);
+                    unset($this->connections[$connectionId]);
                     return false;
                 }
                 $r_body .= fread($socket,4096);
                 $r_size = strlen($r_body);
                 if($this->max_bodysize && $r_size > $this->max_bodysize){
                     $this->error = 'Allowed response size exceeded';
-                    if ($this->max_bodysize_abort)
+                    if ($this->max_bodysize_abort) {
+                        unset($this->connections[$connectionId]);
                         return false;
-                    else
+                    } else {
                         break;
+                    }
                 }
                 if(isset($this->resp_headers['content-length']) &&
                    !isset($this->resp_headers['transfer-encoding']) &&
@@ -450,9 +495,13 @@ class HTTPClient {
             }
         }
 
-        // close socket
-        $status = socket_get_status($socket);
-        fclose($socket);
+        if (!$this->keep_alive ||
+                (isset($this->resp_headers['connection']) && $this->resp_headers['connection'] == 'Close')) {
+            // close socket
+            $status = socket_get_status($socket);
+            fclose($socket);
+            unset($this->connections[$connectionId]);
+        }
 
         // decode gzip if needed
         if(isset($this->resp_headers['content-encoding']) &&
@@ -506,12 +555,13 @@ class HTTPClient {
      */
     function _parseHeaders($string){
         $headers = array();
-        $lines = explode("\n",$string);
-        foreach($lines as $line){
-            list($key,$val) = explode(':',$line,2);
-            $key = strtolower(trim($key));
-            $val = trim($val);
-            if(empty($val)) continue;
+        if (!preg_match_all('/^\s*([\w-]+)\s*:\s*([\S \t]+)\s*$/m', $string,
+                            $matches, PREG_SET_ORDER)) {
+            return $headers;
+        }
+        foreach($matches as $match){
+            list(, $key, $val) = $match;
+            $key = strtolower($key);
             if(isset($headers[$key])){
                 if(is_array($headers[$key])){
                     $headers[$key][] = $val;
@@ -598,6 +648,14 @@ class HTTPClient {
         return $out;
     }
 
+    /**
+     * Generates a unique identifier for a connection.
+     *
+     * @return string unique identifier
+     */
+    function _uniqueConnectionId($server, $port) {
+        return "$server:$port";
+    }
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/inc/IXR_Library.php b/inc/IXR_Library.php
index c7f83a6d63ad3d58f4d50ceadc1de8a760224969..c8255e6d90782c9260a447703ca4188c4c45b0da 100644
--- a/inc/IXR_Library.php
+++ b/inc/IXR_Library.php
@@ -395,13 +395,8 @@ EOD;
         $this->output($error->getXml());
     }
     function output($xml) {
-        $xml = '<?xml version="1.0"?>'."\n".$xml;
-        $length = strlen($xml);
-        header('Connection: close');
-        header('Content-Length: '.$length);
-        header('Content-Type: text/xml');
-        header('Date: '.date('r'));
-        echo $xml;
+        header('Content-Type: text/xml; charset=utf-8');
+        echo '<?xml version="1.0"?>', "\n", $xml;
         exit;
     }
     function hasMethod($method) {
diff --git a/inc/JSON.php b/inc/JSON.php
index d1fbd404a1b1acab175d3e7fa806045f38f2eb2a..2dea44003fc24c7dfe84df7fdc96592a908c4f2b 100644
--- a/inc/JSON.php
+++ b/inc/JSON.php
@@ -112,6 +112,16 @@ define('JSON_STRICT_TYPE', 11);
  * @deprecated
  */
 class JSON {
+
+    /**
+     * Disables the use of PHP5's native json_decode()
+     *
+     * You shouldn't change this usually because the native function is much
+     * faster. However, this non-native will also parse slightly broken JSON
+     * which might be handy when talking to a non-conform endpoint
+     */
+    public $skipnative = false;
+
     /**
      * constructs a new JSON instance
      *
@@ -366,7 +376,10 @@ class JSON {
      * @access   public
      */
     function decode($str) {
-        if (function_exists('json_decode')) return json_decode($str);
+        if (!$this->skipnative && function_exists('json_decode')){
+            return json_decode($str,($this->use == JSON_LOOSE_TYPE));
+        }
+
         $str = $this->reduce_string($str);
 
         switch (strtolower($str)) {
diff --git a/inc/SimplePie.php b/inc/SimplePie.php
index 99c9f32264d1fe20fa5134f68975705336da93ef..d35443165bff8010ec1f5c1e9560480a8a11b813 100644
--- a/inc/SimplePie.php
+++ b/inc/SimplePie.php
@@ -5,7 +5,7 @@
  * A PHP-Based RSS and Atom Feed Framework.
  * Takes the hard work out of managing a complete RSS/Atom solution.
  *
- * Copyright (c) 2004-2007, Ryan Parman and Geoffrey Sneddon
+ * Copyright (c) 2004-2009, Ryan Parman and Geoffrey Sneddon
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without modification, are
@@ -33,8 +33,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  *
  * @package SimplePie
- * @version "Razzleberry"
- * @copyright 2004-2007 Ryan Parman, Geoffrey Sneddon
+ * @version 1.2.1-dev
+ * @copyright 2004-2009 Ryan Parman, Geoffrey Sneddon
  * @author Ryan Parman
  * @author Geoffrey Sneddon
  * @link http://simplepie.org/ SimplePie
@@ -51,18 +51,18 @@ define('SIMPLEPIE_NAME', 'SimplePie');
 /**
  * SimplePie Version
  */
-define('SIMPLEPIE_VERSION', '1.0.1');
+define('SIMPLEPIE_VERSION', '1.2.1-dev');
 
 /**
  * SimplePie Build
  * @todo Hardcode for release (there's no need to have to call SimplePie_Misc::parse_date() only every load of simplepie.inc)
  */
-define('SIMPLEPIE_BUILD', 20070719221955);
+define('SIMPLEPIE_BUILD', gmdate('YmdHis', SimplePie_Misc::parse_date(substr('$Date$', 7, 25)) ? SimplePie_Misc::parse_date(substr('$Date$', 7, 25)) : filemtime(__FILE__)));
 
 /**
  * SimplePie Website URL
  */
-define('SIMPLEPIE_URL', 'http://simplepie.org/');
+define('SIMPLEPIE_URL', 'http://simplepie.org');
 
 /**
  * SimplePie Useragent
@@ -242,10 +242,25 @@ define('SIMPLEPIE_CONSTRUCT_MAYBE_HTML', 32);
  */
 define('SIMPLEPIE_CONSTRUCT_ALL', 63);
 
+/**
+ * Don't change case
+ */
+define('SIMPLEPIE_SAME_CASE', 1);
+
+/**
+ * Change to lowercase
+ */
+define('SIMPLEPIE_LOWERCASE', 2);
+
+/**
+ * Change to uppercase
+ */
+define('SIMPLEPIE_UPPERCASE', 4);
+
 /**
  * PCRE for HTML attributes
  */
-define('SIMPLEPIE_PCRE_HTML_ATTRIBUTE', '((?:\s+(?:(?:[^\s:]+:)?[^\s:]+)(?:\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[a-z0-9\-._:]*)))?)*)\s*');
+define('SIMPLEPIE_PCRE_HTML_ATTRIBUTE', '((?:[\x09\x0A\x0B\x0C\x0D\x20]+[^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?)*)[\x09\x0A\x0B\x0C\x0D\x20]*');
 
 /**
  * PCRE for XML attributes
@@ -287,6 +302,12 @@ define('SIMPLEPIE_NAMESPACE_RSS_10', 'http://purl.org/rss/1.0/');
  */
 define('SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT', 'http://purl.org/rss/1.0/modules/content/');
 
+/**
+ * RSS 2.0 Namespace
+ * (Stupid, I know, but I'm certain it will confuse people less with support.)
+ */
+define('SIMPLEPIE_NAMESPACE_RSS_20', '');
+
 /**
  * DC 1.0 Namespace
  */
@@ -312,6 +333,11 @@ define('SIMPLEPIE_NAMESPACE_GEORSS', 'http://www.georss.org/georss');
  */
 define('SIMPLEPIE_NAMESPACE_MEDIARSS', 'http://search.yahoo.com/mrss/');
 
+/**
+ * Wrong Media RSS Namespace
+ */
+define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG', 'http://search.yahoo.com/mrss');
+
 /**
  * iTunes RSS Namespace
  */
@@ -332,15 +358,40 @@ define('SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY', 'http://www.iana.org/assignment
  */
 define('SIMPLEPIE_PHP5', version_compare(PHP_VERSION, '5.0.0', '>='));
 
+/**
+ * No file source
+ */
+define('SIMPLEPIE_FILE_SOURCE_NONE', 0);
+
+/**
+ * Remote file source
+ */
+define('SIMPLEPIE_FILE_SOURCE_REMOTE', 1);
+
+/**
+ * Local file source
+ */
+define('SIMPLEPIE_FILE_SOURCE_LOCAL', 2);
+
+/**
+ * fsockopen() file source
+ */
+define('SIMPLEPIE_FILE_SOURCE_FSOCKOPEN', 4);
+
+/**
+ * cURL file source
+ */
+define('SIMPLEPIE_FILE_SOURCE_CURL', 8);
+
+/**
+ * file_get_contents() file source
+ */
+define('SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS', 16);
+
 /**
  * SimplePie
  *
  * @package SimplePie
- * @version "Razzleberry"
- * @copyright 2004-2007 Ryan Parman, Geoffrey Sneddon
- * @author Ryan Parman
- * @author Geoffrey Sneddon
- * @todo Option for type of fetching (cache, not modified header, fetch, etc.)
  */
 class SimplePie
 {
@@ -406,6 +457,14 @@ class SimplePie
 	 */
 	var $force_fsockopen = false;
 
+	/**
+	 * @var bool Force the given data/URL to be treated as a feed no matter what
+	 * it appears like
+	 * @see SimplePie::force_feed()
+	 * @access private
+	 */
+	var $force_feed = false;
+
 	/**
 	 * @var bool Enable/Disable XML dump
 	 * @see SimplePie::enable_xml_dump()
@@ -561,6 +620,20 @@ class SimplePie
 	 */
 	var $restriction_class = 'SimplePie_Restriction';
 
+	/**
+	 * @var string Class used for content-type sniffing
+	 * @see SimplePie::set_content_type_sniffer_class()
+	 * @access private
+	 */
+	var $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer';
+
+	/**
+	 * @var string Class used for item sources.
+	 * @see SimplePie::set_source_class()
+	 * @access private
+	 */
+	var $source_class = 'SimplePie_Source';
+
 	/**
 	 * @var mixed Set javascript query string parameter (false, or
 	 * anything type-cast to false, disables this feature)
@@ -576,6 +649,13 @@ class SimplePie
 	 */
 	var $max_checked_feeds = 10;
 
+	/**
+	 * @var array All the feeds found during the autodiscovery process
+	 * @see SimplePie::get_all_discovered_feeds()
+	 * @access private
+	 */
+	var $all_discovered_feeds = array();
+
 	/**
 	 * @var string Web-accessible path to the handler_favicon.php file.
 	 * @see SimplePie::set_favicon_handler()
@@ -610,6 +690,13 @@ class SimplePie
 	 */
 	var $config_settings = null;
 
+	/**
+	 * @var integer Stores the number of items to return per-feed with multifeeds.
+	 * @see SimplePie::set_item_limit()
+	 * @access private
+	 */
+	var $item_limit = 0;
+
 	/**
 	 * @var array Stores the default attributes to be stripped by strip_attributes().
 	 * @see SimplePie::strip_attributes()
@@ -677,6 +764,45 @@ class SimplePie
 		return md5(serialize($this->data));
 	}
 
+	/**
+	 * Remove items that link back to this before destroying this object
+	 */
+	function __destruct()
+	{
+		if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode'))
+		{
+			if (!empty($this->data['items']))
+			{
+				foreach ($this->data['items'] as $item)
+				{
+					$item->__destruct();
+				}
+				unset($item, $this->data['items']);
+			}
+			if (!empty($this->data['ordered_items']))
+			{
+				foreach ($this->data['ordered_items'] as $item)
+				{
+					$item->__destruct();
+				}
+				unset($item, $this->data['ordered_items']);
+			}
+		}
+	}
+
+	/**
+	 * Force the given data/URL to be treated as a feed no matter what it
+	 * appears like
+	 *
+	 * @access public
+	 * @since 1.1
+	 * @param bool $enable Force the given data/URL to be treated as a feed
+	 */
+	function force_feed($enable = false)
+	{
+		$this->force_feed = (bool) $enable;
+	}
+
 	/**
 	 * This is the URL of the feed you want to parse.
 	 *
@@ -718,7 +844,7 @@ class SimplePie
 	 */
 	function set_file(&$file)
 	{
-		if (SimplePie_Misc::is_a($file, 'SimplePie_File'))
+		if (is_a($file, 'SimplePie_File'))
 		{
 			$this->feed_url = $file->url;
 			$this->file =& $file;
@@ -741,7 +867,7 @@ class SimplePie
 	 */
 	function set_raw_data($data)
 	{
-		$this->raw_data = trim($data);
+		$this->raw_data = $data;
 	}
 
 	/**
@@ -1156,6 +1282,44 @@ class SimplePie
 		return false;
 	}
 
+	/**
+	 * Allows you to change which class SimplePie uses for content-type sniffing.
+	 * Useful when you are overloading or extending SimplePie's default classes.
+	 *
+	 * @access public
+	 * @param string $class Name of custom class.
+	 * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
+	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
+	 */
+	function set_content_type_sniffer_class($class = 'SimplePie_Content_Type_Sniffer')
+	{
+		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Content_Type_Sniffer'))
+		{
+			$this->content_type_sniffer_class = $class;
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * Allows you to change which class SimplePie uses item sources.
+	 * Useful when you are overloading or extending SimplePie's default classes.
+	 *
+	 * @access public
+	 * @param string $class Name of custom class.
+	 * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
+	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
+	 */
+	function set_source_class($class = 'SimplePie_Source')
+	{
+		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Source'))
+		{
+			$this->source_class = $class;
+			return true;
+		}
+		return false;
+	}
+
 	/**
 	 * Allows you to override the default user agent string.
 	 *
@@ -1294,7 +1458,7 @@ class SimplePie
 	 */
 	function set_favicon_handler($page = false, $qs = 'i')
 	{
-		if ($page != false)
+		if ($page !== false)
 		{
 			$this->favicon_handler = $page . '?' . $qs . '=';
 		}
@@ -1313,7 +1477,7 @@ class SimplePie
 	 */
 	function set_image_handler($page = false, $qs = 'i')
 	{
-		if ($page != false)
+		if ($page !== false)
 		{
 			$this->sanitize->set_image_handler($page . '?' . $qs . '=');
 		}
@@ -1323,47 +1487,44 @@ class SimplePie
 		}
 	}
 
+	/**
+	 * Set the limit for items returned per-feed with multifeeds.
+	 *
+	 * @access public
+	 * @param integer $limit The maximum number of items to return.
+	 */
+	function set_item_limit($limit = 0)
+	{
+		$this->item_limit = (int) $limit;
+	}
+
 	function init()
 	{
-		if ((function_exists('version_compare') && version_compare(PHP_VERSION, '4.1.0', '<')) || !extension_loaded('xml') || !extension_loaded('pcre'))
+		// Check absolute bare minimum requirements.
+		if ((function_exists('version_compare') && version_compare(PHP_VERSION, '4.3.0', '<')) || !extension_loaded('xml') || !extension_loaded('pcre'))
 		{
 			return false;
 		}
-		if (isset($_GET[$this->javascript]))
+		// Then check the xml extension is sane (i.e., libxml 2.7.x issue on PHP < 5.2.9 and libxml 2.7.0 to 2.7.2 on any version) if we don't have xmlreader.
+		elseif (!extension_loaded('xmlreader'))
 		{
-			if (function_exists('ob_gzhandler'))
+			static $xml_is_sane = null;
+			if ($xml_is_sane === null)
 			{
-				ob_start('ob_gzhandler');
+				$parser_check = xml_parser_create();
+				xml_parse_into_struct($parser_check, '<foo>&amp;</foo>', $values);
+				xml_parser_free($parser_check);
+				$xml_is_sane = isset($values[0]['value']);
 			}
-			header('Content-type: text/javascript; charset: UTF-8');
-			header('Cache-Control: must-revalidate');
-			header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days
-			?>
-function embed_odeo(link) {
-	document.writeln('<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url='+link+'"></embed>');
-}
-
-function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) {
-	if (placeholder != '') {
-		document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" href="'+link+'" src="'+placeholder+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="false" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
-	}
-	else {
-		document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" src="'+link+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="true" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
-	}
-}
-
-function embed_flash(bgcolor, width, height, link, loop, type) {
-	document.writeln('<embed src="'+link+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="'+type+'" quality="high" width="'+width+'" height="'+height+'" bgcolor="'+bgcolor+'" loop="'+loop+'"></embed>');
-}
-
-function embed_flv(width, height, link, placeholder, loop, player) {
-	document.writeln('<embed src="'+player+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="'+width+'" height="'+height+'" wmode="transparent" flashvars="file='+link+'&autostart=false&repeat='+loop+'&showdigits=true&showfsbutton=false"></embed>');
-}
+			if (!$xml_is_sane)
+			{
+				return false;
+			}
+		}
 
-function embed_wmedia(width, height, link) {
-	document.writeln('<embed type="application/x-mplayer2" src="'+link+'" autosize="1" width="'+width+'" height="'+height+'" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>');
-}
-			<?php
+		if (isset($_GET[$this->javascript]))
+		{
+			SimplePie_Misc::output_javascript();
 			exit;
 		}
 
@@ -1383,7 +1544,7 @@ function embed_wmedia(width, height, link) {
 				// Decide whether to enable caching
 				if ($this->cache && $parsed_feed_url['scheme'] !== '')
 				{
-					$cache = new $this->cache_class($this->cache_location, call_user_func($this->cache_name_function, $this->feed_url), 'spc');
+					$cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $this->feed_url), 'spc');
 				}
 				// If it's enabled and we don't want an XML dump, use the cache
 				if ($cache && !$this->xml_dump)
@@ -1393,13 +1554,13 @@ function embed_wmedia(width, height, link) {
 					if (!empty($this->data))
 					{
 						// If the cache is for an outdated build of SimplePie
-						if (!isset($this->data['build']) || $this->data['build'] != SIMPLEPIE_BUILD)
+						if (!isset($this->data['build']) || $this->data['build'] !== SIMPLEPIE_BUILD)
 						{
 							$cache->unlink();
 							$this->data = array();
 						}
 						// If we've hit a collision just rerun it with caching disabled
-						elseif (isset($this->data['url']) && $this->data['url'] != $this->feed_url)
+						elseif (isset($this->data['url']) && $this->data['url'] !== $this->feed_url)
 						{
 							$cache = false;
 							$this->data = array();
@@ -1411,7 +1572,7 @@ function embed_wmedia(width, height, link) {
 							if ($cache->mtime() + $this->autodiscovery_cache_duration > time())
 							{
 								// Do not need to do feed autodiscovery yet.
-								if ($this->data['feed_url'] == $this->data['url'])
+								if ($this->data['feed_url'] === $this->data['url'])
 								{
 									$cache->unlink();
 									$this->data = array();
@@ -1436,12 +1597,12 @@ function embed_wmedia(width, height, link) {
 								}
 								if (isset($this->data['headers']['etag']))
 								{
-									$headers['if-none-match'] = $this->data['headers']['etag'];
+									$headers['if-none-match'] = '"' . $this->data['headers']['etag'] . '"';
 								}
 								$file = new $this->file_class($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen);
 								if ($file->success)
 								{
-									if ($file->status_code == 304)
+									if ($file->status_code === 304)
 									{
 										$cache->touch();
 										return true;
@@ -1473,7 +1634,7 @@ function embed_wmedia(width, height, link) {
 				// If we don't already have the file (it'll only exist if we've opened it to check if the cache has been modified), open it.
 				if (!isset($file))
 				{
-					if (SimplePie_Misc::is_a($this->file, 'SimplePie_File') && $this->file->url == $this->feed_url)
+					if (is_a($this->file, 'SimplePie_File') && $this->file->url === $this->feed_url)
 					{
 						$file =& $this->file;
 					}
@@ -1483,7 +1644,7 @@ function embed_wmedia(width, height, link) {
 					}
 				}
 				// If the file connection has an error, set SimplePie::error to that and quit
-				if (!$file->success)
+				if (!$file->success && !($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)))
 				{
 					$this->error = $file->error;
 					if (!empty($this->data))
@@ -1496,148 +1657,150 @@ function embed_wmedia(width, height, link) {
 					}
 				}
 
-				// Check if the supplied URL is a feed, if it isn't, look for it.
-				$locate = new $this->locator_class($file, $this->timeout, $this->useragent, $this->file_class, $this->max_checked_feeds);
-				if (!$locate->is_feed($file))
+				if (!$this->force_feed)
 				{
-					// We need to unset this so that if SimplePie::set_file() has been called that object is untouched
-					unset($file);
-					if ($file = $locate->find($this->autodiscovery))
+					// Check if the supplied URL is a feed, if it isn't, look for it.
+					$locate = new $this->locator_class($file, $this->timeout, $this->useragent, $this->file_class, $this->max_checked_feeds, $this->content_type_sniffer_class);
+					if (!$locate->is_feed($file))
 					{
-						if ($cache)
+						// We need to unset this so that if SimplePie::set_file() has been called that object is untouched
+						unset($file);
+						if ($file = $locate->find($this->autodiscovery, $this->all_discovered_feeds))
 						{
-							if (!$cache->save(array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD)))
+							if ($cache)
 							{
-								trigger_error("$cache->name is not writeable", E_USER_WARNING);
+								$this->data = array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD);
+								if (!$cache->save($this))
+								{
+									trigger_error("$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING);
+								}
+								$cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc');
 							}
-							$cache = new $this->cache_class($this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc');
+							$this->feed_url = $file->url;
+						}
+						else
+						{
+							$this->error = "A feed could not be found at $this->feed_url. A feed with an invalid mime type may fall victim to this error, or " . SIMPLEPIE_NAME . " was unable to auto-discover it.. Use force_feed() if you are certain this URL is a real feed.";
+							SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
+							return false;
 						}
-						$this->feed_url = $file->url;
-					}
-					else
-					{
-						$this->error = "A feed could not be found at $this->feed_url";
-						SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
-						return false;
 					}
+					$locate = null;
 				}
-				$locate = null;
 
 				$headers = $file->headers;
-				$data = trim($file->body);
-				unset($file);
+				$data = $file->body;
+				$sniffer = new $this->content_type_sniffer_class($file);
+				$sniffed = $sniffer->get_type();
 			}
 			else
 			{
 				$data = $this->raw_data;
 			}
 
+			// Set up array of possible encodings
+			$encodings = array();
+
 			// First check to see if input has been overridden.
 			if ($this->input_encoding !== false)
 			{
-				$encoding = $this->input_encoding;
-			}
-			// Second try HTTP headers
-			elseif (isset($headers['content-type']) && preg_match('/;[\x09\x20]*charset=([^;]*)/i', $headers['content-type'], $charset))
-			{
-				$encoding = $charset[1];
-			}
-			// Then prolog, if at the very start of the document
-			elseif (preg_match("/^<\?xml[\x20\x9\xD\xA]+version([\x20\x9\xD\xA]+)?=([\x20\x9\xD\xA]+)?(\"1.0\"|'1.0'|\"1.1\"|'1.1')[\x20\x9\xD\xA]+encoding([\x20\x9\xD\xA]+)?=([\x20\x9\xD\xA]+)?(\"[A-Za-z][A-Za-z0-9._\-]*\"|'[A-Za-z][A-Za-z0-9._\-]*')([\x20\x9\xD\xA]+standalone([\x20\x9\xD\xA]+)?=([\x20\x9\xD\xA]+)?(\"(yes|no)\"|'(yes|no)'))?([\x20\x9\xD\xA]+)?\?>/", $data, $prolog))
-			{
-				$encoding = substr($prolog[6], 1, -1);
-			}
-			// UTF-32 Big Endian BOM
-			elseif (strpos($data, "\x0\x0\xFE\xFF") === 0)
-			{
-				$encoding = 'UTF-32be';
-			}
-			// UTF-32 Little Endian BOM
-			elseif (strpos($data, "\xFF\xFE\x0\x0") === 0)
-			{
-				$encoding = 'UTF-32';
-			}
-			// UTF-16 Big Endian BOM
-			elseif (strpos($data, "\xFE\xFF") === 0)
-			{
-				$encoding = 'UTF-16be';
-			}
-			// UTF-16 Little Endian BOM
-			elseif (strpos($data, "\xFF\xFE") === 0)
-			{
-				$encoding = 'UTF-16le';
-			}
-			// UTF-8 BOM
-			elseif (strpos($data, "\xEF\xBB\xBF") === 0)
-			{
-				$encoding = 'UTF-8';
-			}
-			// Fallback to the default (US-ASCII for text/xml, ISO-8859-1 for text/* MIME types, UTF-8 otherwise)
-			elseif (isset($headers['content-type']) && strtolower(SimplePie_Misc::parse_mime($headers['content-type'])) == 'text/xml')
-			{
-				$encoding = 'US-ASCII';
-			}
-			elseif (isset($headers['content-type']) && SimplePie_Misc::stripos(SimplePie_Misc::parse_mime($headers['content-type']), 'text/') === 0)
-			{
-				$encoding = 'ISO-8859-1';
-			}
-			else
-			{
-				$encoding = 'UTF-8';
+				$encodings[] = $this->input_encoding;
 			}
 
-			// Change the encoding to UTF-8 (as we always use UTF-8 internally)
-			if ($encoding != 'UTF-8')
+			$application_types = array('application/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity');
+			$text_types = array('text/xml', 'text/xml-external-parsed-entity');
+
+			// RFC 3023 (only applies to sniffed content)
+			if (isset($sniffed))
 			{
-				$data = SimplePie_Misc::change_encoding($data, $encoding, 'UTF-8');
+				if (in_array($sniffed, $application_types) || substr($sniffed, 0, 12) === 'application/' && substr($sniffed, -4) === '+xml')
+				{
+					if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset))
+					{
+						$encodings[] = strtoupper($charset[1]);
+					}
+					$encodings = array_merge($encodings, SimplePie_Misc::xml_encoding($data));
+					$encodings[] = 'UTF-8';
+				}
+				elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml')
+				{
+					if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset))
+					{
+						$encodings[] = $charset[1];
+					}
+					$encodings[] = 'US-ASCII';
+				}
+				// Text MIME-type default
+				elseif (substr($sniffed, 0, 5) === 'text/')
+				{
+					$encodings[] = 'US-ASCII';
+				}
 			}
 
-			// Strip illegal characters
-			$data = SimplePie_Misc::utf8_bad_replace($data);
+			// Fallback to XML 1.0 Appendix F.1/UTF-8/ISO-8859-1
+			$encodings = array_merge($encodings, SimplePie_Misc::xml_encoding($data));
+			$encodings[] = 'UTF-8';
+			$encodings[] = 'ISO-8859-1';
+
+			// There's no point in trying an encoding twice
+			$encodings = array_unique($encodings);
 
-			$parser = new $this->parser_class();
-			$parser->pre_process($data, 'UTF-8');
-			// If we want the XML, just output that and quit
+			// If we want the XML, just output that with the most likely encoding and quit
 			if ($this->xml_dump)
 			{
-				header('Content-type: text/xml; charset=UTF-8');
+				header('Content-type: text/xml; charset=' . $encodings[0]);
 				echo $data;
 				exit;
 			}
-			// If it's parsed fine
-			elseif ($parser->parse($data))
+
+			// Loop through each possible encoding, till we return something, or run out of possibilities
+			foreach ($encodings as $encoding)
 			{
-				unset($data);
-				$this->data = $parser->get_data();
-				if (isset($this->data['child']))
+				// Change the encoding to UTF-8 (as we always use UTF-8 internally)
+				if ($utf8_data = SimplePie_Misc::change_encoding($data, $encoding, 'UTF-8'))
 				{
-					if (isset($headers))
-					{
-						$this->data['headers'] = $headers;
-					}
-					$this->data['build'] = SIMPLEPIE_BUILD;
+					// Create new parser
+					$parser = new $this->parser_class();
 
-					// Cache the file if caching is enabled
-					if ($cache && !$cache->save($this->data))
+					// If it's parsed fine
+					if ($parser->parse($utf8_data, 'UTF-8'))
 					{
-						trigger_error("$cache->name is not writeable", E_USER_WARNING);
+						$this->data = $parser->get_data();
+						if ($this->get_type() & ~SIMPLEPIE_TYPE_NONE)
+						{
+							if (isset($headers))
+							{
+								$this->data['headers'] = $headers;
+							}
+							$this->data['build'] = SIMPLEPIE_BUILD;
+
+							// Cache the file if caching is enabled
+							if ($cache && !$cache->save($this))
+							{
+								trigger_error("$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING);
+							}
+							return true;
+						}
+						else
+						{
+							$this->error = "A feed could not be found at $this->feed_url. This does not appear to be a valid RSS or Atom feed.";
+							SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
+							return false;
+						}
 					}
-					return true;
-				}
-				else
-				{
-					$this->error = "A feed could not be found at $this->feed_url";
-					SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
-					return false;
 				}
 			}
-			// If we have an error, just set SimplePie::error to it and quit
+			if (isset($parser))
+			{
+				// We have an error, just set SimplePie_Misc::error to it and quit
+				$this->error = sprintf('This XML document is invalid, likely due to invalid characters. XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column());
+			}
 			else
 			{
-				$this->error = sprintf('XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column());
-				SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
-				return false;
+				$this->error = 'The data could not be converted to UTF-8. You MUST have either the iconv or mbstring extension installed. Upgrading to PHP 5.x (which includes iconv) is highly recommended.';
 			}
+			SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
+			return false;
 		}
 		elseif (!empty($this->multifeed_url))
 		{
@@ -1730,18 +1893,18 @@ function embed_wmedia(width, height, link) {
 					$this->data['type'] &= SIMPLEPIE_TYPE_RSS_090;
 				}
 			}
-			elseif (isset($this->data['child']['']['rss']))
+			elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss']))
 			{
 				$this->data['type'] &= SIMPLEPIE_TYPE_RSS_ALL;
-				if (isset($this->data['child']['']['rss'][0]['attribs']['']['version']))
+				if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version']))
 				{
-					switch (trim($this->data['child']['']['rss'][0]['attribs']['']['version']))
+					switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version']))
 					{
 						case '0.91':
 							$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091;
-							if (isset($this->data['child']['']['rss'][0]['child']['']['skiphours']['hour'][0]['data']))
+							if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data']))
 							{
-								switch (trim($this->data['child']['']['rss'][0]['child']['']['skiphours']['hour'][0]['data']))
+								switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data']))
 								{
 									case '0':
 										$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_NETSCAPE;
@@ -1783,6 +1946,7 @@ function embed_wmedia(width, height, link) {
 	/**
 	 * Returns the URL for the favicon of the feed's website.
 	 *
+	 * @todo Cache atom:icon
 	 * @access public
 	 * @since 1.0
 	 */
@@ -1798,26 +1962,36 @@ function embed_wmedia(width, height, link) {
 
 			if ($this->cache && $this->favicon_handler)
 			{
-				$cache = new $this->cache_class($this->cache_location, call_user_func($this->cache_name_function, $favicon), 'spi');
+				$favicon_filename = call_user_func($this->cache_name_function, $favicon);
+				$cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, $favicon_filename, 'spi');
 
 				if ($cache->load())
 				{
-					return $this->sanitize($this->favicon_handler . rawurlencode($favicon), SIMPLEPIE_CONSTRUCT_IRI);
+					return $this->sanitize($this->favicon_handler . $favicon_filename, SIMPLEPIE_CONSTRUCT_IRI);
 				}
 				else
 				{
 					$file = new $this->file_class($favicon, $this->timeout / 10, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen);
 
-					if ($file->success && ($file->status_code == 200 || ($file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0)
+					if ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0)
 					{
-						if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
+						$sniffer = new $this->content_type_sniffer_class($file);
+						if (substr($sniffer->get_type(), 0, 6) === 'image/')
 						{
-							return $this->sanitize($this->favicon_handler . rawurlencode($favicon), SIMPLEPIE_CONSTRUCT_IRI);
+							if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
+							{
+								return $this->sanitize($this->favicon_handler . $favicon_filename, SIMPLEPIE_CONSTRUCT_IRI);
+							}
+							else
+							{
+								trigger_error("$cache->name is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING);
+								return $this->sanitize($favicon, SIMPLEPIE_CONSTRUCT_IRI);
+							}
 						}
+						// not an image
 						else
 						{
-							trigger_error("$cache->name is not writeable", E_USER_WARNING);
-							return $this->sanitize($favicon, SIMPLEPIE_CONSTRUCT_IRI);
+							return false;
 						}
 					}
 				}
@@ -1863,7 +2037,7 @@ function embed_wmedia(width, height, link) {
 	{
 		if ($this->feed_url !== null)
 		{
-			return 'outlook' . $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI);
+			return $this->sanitize('outlook' . SimplePie_Misc::fix_protocol($this->feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI);
 		}
 		else
 		{
@@ -1908,12 +2082,12 @@ function embed_wmedia(width, height, link) {
 	{
 		if ($this->subscribe_url())
 		{
-			$return = $this->sanitize($feed_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->subscribe_url());
+			$return = $feed_url . rawurlencode($this->feed_url);
 			if ($site_url !== null && $this->get_link() !== null)
 			{
-				$return .= $this->sanitize($site_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_link());
+				$return .= $site_url . rawurlencode($this->get_link());
 			}
-			return $return;
+			return $this->sanitize($return, SIMPLEPIE_CONSTRUCT_IRI);
 		}
 		else
 		{
@@ -1928,7 +2102,7 @@ function embed_wmedia(width, height, link) {
 
 	function subscribe_bloglines()
 	{
-		return urldecode($this->subscribe_service('http://www.bloglines.com/sub/'));
+		return $this->subscribe_service('http://www.bloglines.com/sub/');
 	}
 
 	function subscribe_eskobo()
@@ -2022,9 +2196,9 @@ function embed_wmedia(width, height, link) {
 		}
 		if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
 		{
-			if (isset($this->data['child']['']['rss'][0]['child'][$namespace][$tag]))
+			if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag]))
 			{
-				return $this->data['child']['']['rss'][0]['child'][$namespace][$tag];
+				return $this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag];
 			}
 		}
 		return null;
@@ -2062,7 +2236,7 @@ function embed_wmedia(width, height, link) {
 		}
 		if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
 		{
-			if ($channel = $this->get_feed_tags('', 'channel'))
+			if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'channel'))
 			{
 				if (isset($channel[0]['child'][$namespace][$tag]))
 				{
@@ -2098,7 +2272,7 @@ function embed_wmedia(width, height, link) {
 		}
 		if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
 		{
-			if ($image = $this->get_channel_tags('', 'image'))
+			if ($image = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'image'))
 			{
 				if (isset($image[0]['child'][$namespace][$tag]))
 				{
@@ -2119,10 +2293,6 @@ function embed_wmedia(width, height, link) {
 		{
 			return $this->get_link();
 		}
-		elseif (isset($this->data['headers']['content-location']))
-		{
-			return SimplePie_Misc::absolutize_url($this->data['headers']['content-location'], $this->subscribe_url());
-		}
 		else
 		{
 			return $this->subscribe_url();
@@ -2152,7 +2322,7 @@ function embed_wmedia(width, height, link) {
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 		}
-		elseif ($return = $this->get_channel_tags('', 'title'))
+		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 		}
@@ -2170,12 +2340,12 @@ function embed_wmedia(width, height, link) {
 		}
 	}
 
-	function get_link($key = 0, $rel = 'alternate')
+	function get_category($key = 0)
 	{
-		$links = $this->get_links($rel);
-		if (isset($links[$key]))
+		$categories = $this->get_categories();
+		if (isset($categories[$key]))
 		{
-			return $links[$key];
+			return $categories[$key];
 		}
 		else
 		{
@@ -2183,33 +2353,257 @@ function embed_wmedia(width, height, link) {
 		}
 	}
 
-	/**
-	 * Added for parity between the parent-level and the item/entry-level.
-	 */
-	function get_permalink()
+	function get_categories()
 	{
-		return $this->get_link(0);
-	}
+		$categories = array();
 
-	function get_links($rel = 'alternate')
-	{
-		if (!isset($this->data['links']))
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
 		{
-			$this->data['links'] = array();
-			if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link'))
+			$term = null;
+			$scheme = null;
+			$label = null;
+			if (isset($category['attribs']['']['term']))
 			{
-				foreach ($links as $link)
-				{
-					if (isset($link['attribs']['']['href']))
-					{
-						$link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
-						$this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
-					}
-				}
+				$term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
 			}
-			if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link'))
+			if (isset($category['attribs']['']['scheme']))
 			{
-				foreach ($links as $link)
+				$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($category['attribs']['']['label']))
+			{
+				$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			$categories[] = new $this->category_class($term, $scheme, $label);
+		}
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
+		{
+			// This is really the label, but keep this as the term also for BC.
+			// Label will also work on retrieving because that falls back to term.
+			$term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			if (isset($category['attribs']['']['domain']))
+			{
+				$scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			else
+			{
+				$scheme = null;
+			}
+			$categories[] = new $this->category_class($term, $scheme, null);
+		}
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
+		{
+			$categories[] = new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+		}
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
+		{
+			$categories[] = new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+		}
+
+		if (!empty($categories))
+		{
+			return SimplePie_Misc::array_unique($categories);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_author($key = 0)
+	{
+		$authors = $this->get_authors();
+		if (isset($authors[$key]))
+		{
+			return $authors[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_authors()
+	{
+		$authors = array();
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
+		{
+			$name = null;
+			$uri = null;
+			$email = null;
+			if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
+			{
+				$name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
+			{
+				$uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
+			}
+			if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
+			{
+				$email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if ($name !== null || $email !== null || $uri !== null)
+			{
+				$authors[] = new $this->author_class($name, $uri, $email);
+			}
+		}
+		if ($author = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
+		{
+			$name = null;
+			$url = null;
+			$email = null;
+			if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
+			{
+				$name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
+			{
+				$url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
+			}
+			if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
+			{
+				$email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if ($name !== null || $email !== null || $url !== null)
+			{
+				$authors[] = new $this->author_class($name, $url, $email);
+			}
+		}
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
+		{
+			$authors[] = new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+		}
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
+		{
+			$authors[] = new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+		}
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
+		{
+			$authors[] = new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+		}
+
+		if (!empty($authors))
+		{
+			return SimplePie_Misc::array_unique($authors);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_contributor($key = 0)
+	{
+		$contributors = $this->get_contributors();
+		if (isset($contributors[$key]))
+		{
+			return $contributors[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_contributors()
+	{
+		$contributors = array();
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
+		{
+			$name = null;
+			$uri = null;
+			$email = null;
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
+			{
+				$name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
+			{
+				$uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
+			{
+				$email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if ($name !== null || $email !== null || $uri !== null)
+			{
+				$contributors[] = new $this->author_class($name, $uri, $email);
+			}
+		}
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
+		{
+			$name = null;
+			$url = null;
+			$email = null;
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
+			{
+				$name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
+			{
+				$url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
+			{
+				$email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if ($name !== null || $email !== null || $url !== null)
+			{
+				$contributors[] = new $this->author_class($name, $url, $email);
+			}
+		}
+
+		if (!empty($contributors))
+		{
+			return SimplePie_Misc::array_unique($contributors);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_link($key = 0, $rel = 'alternate')
+	{
+		$links = $this->get_links($rel);
+		if (isset($links[$key]))
+		{
+			return $links[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Added for parity between the parent-level and the item/entry-level.
+	 */
+	function get_permalink()
+	{
+		return $this->get_link(0);
+	}
+
+	function get_links($rel = 'alternate')
+	{
+		if (!isset($this->data['links']))
+		{
+			$this->data['links'] = array();
+			if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link'))
+			{
+				foreach ($links as $link)
+				{
+					if (isset($link['attribs']['']['href']))
+					{
+						$link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
+						$this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
+					}
+				}
+			}
+			if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link'))
+			{
+				foreach ($links as $link)
 				{
 					if (isset($link['attribs']['']['href']))
 					{
@@ -2227,7 +2621,7 @@ function embed_wmedia(width, height, link) {
 			{
 				$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
 			}
-			if ($links = $this->get_channel_tags('', 'link'))
+			if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
 			{
 				$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
 			}
@@ -2247,7 +2641,7 @@ function embed_wmedia(width, height, link) {
 						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
 					}
 				}
-				elseif (substr($key, 0, 41) == SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
+				elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
 				{
 					$this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
 				}
@@ -2265,6 +2659,11 @@ function embed_wmedia(width, height, link) {
 		}
 	}
 
+	function get_all_discovered_feeds()
+	{
+		return $this->all_discovered_feeds;
+	}
+
 	function get_description()
 	{
 		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
@@ -2283,9 +2682,9 @@ function embed_wmedia(width, height, link) {
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 		}
-		elseif ($return = $this->get_channel_tags('', 'description'))
+		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
 		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
 		}
 		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
 		{
@@ -2315,7 +2714,11 @@ function embed_wmedia(width, height, link) {
 		{
 			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
 		}
-		elseif ($return = $this->get_channel_tags('', 'copyright'))
+		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
+		{
+			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+		}
+		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright'))
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
@@ -2335,7 +2738,7 @@ function embed_wmedia(width, height, link) {
 
 	function get_language()
 	{
-		if ($return = $this->get_channel_tags('', 'language'))
+		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language'))
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
@@ -2371,11 +2774,12 @@ function embed_wmedia(width, height, link) {
 
 	function get_latitude()
 	{
+		
 		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
 		{
 			return (float) $return[0]['data'];
 		}
-		elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
+		elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
 		{
 			return (float) $match[1];
 		}
@@ -2395,7 +2799,7 @@ function embed_wmedia(width, height, link) {
 		{
 			return (float) $return[0]['data'];
 		}
-		elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
+		elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
 		{
 			return (float) $match[2];
 		}
@@ -2415,7 +2819,7 @@ function embed_wmedia(width, height, link) {
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
-		elseif ($return = $this->get_image_tags('', 'title'))
+		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
@@ -2455,7 +2859,7 @@ function embed_wmedia(width, height, link) {
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
 		}
-		elseif ($return = $this->get_image_tags('', 'url'))
+		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
 		}
@@ -2475,7 +2879,7 @@ function embed_wmedia(width, height, link) {
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
 		}
-		elseif ($return = $this->get_image_tags('', 'link'))
+		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
 		}
@@ -2487,11 +2891,11 @@ function embed_wmedia(width, height, link) {
 
 	function get_image_width()
 	{
-		if ($return = $this->get_image_tags('', 'width'))
+		if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'width'))
 		{
 			return round($return[0]['data']);
 		}
-		elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags('', 'url'))
+		elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
 		{
 			return 88.0;
 		}
@@ -2503,11 +2907,11 @@ function embed_wmedia(width, height, link) {
 
 	function get_image_height()
 	{
-		if ($return = $this->get_image_tags('', 'height'))
+		if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'height'))
 		{
 			return round($return[0]['data']);
 		}
-		elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags('', 'url'))
+		elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
 		{
 			return 31.0;
 		}
@@ -2519,8 +2923,9 @@ function embed_wmedia(width, height, link) {
 
 	function get_item_quantity($max = 0)
 	{
+		$max = (int) $max;
 		$qty = count($this->get_items());
-		if ($max == 0)
+		if ($max === 0)
 		{
 			return $qty;
 		}
@@ -2545,50 +2950,54 @@ function embed_wmedia(width, height, link) {
 
 	function get_items($start = 0, $end = 0)
 	{
-		if (!empty($this->multifeed_objects))
-		{
-			return SimplePie::merge_items($this->multifeed_objects, $start, $end);
-		}
-		elseif (!isset($this->data['items']))
+		if (!isset($this->data['items']))
 		{
-			if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry'))
+			if (!empty($this->multifeed_objects))
 			{
-				$keys = array_keys($items);
-				foreach ($keys as $key)
-				{
-					$this->data['items'][] = new $this->item_class($this, $items[$key]);
-				}
+				$this->data['items'] = SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit);
 			}
-			if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry'))
+			else
 			{
-				$keys = array_keys($items);
-				foreach ($keys as $key)
+				$this->data['items'] = array();
+				if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry'))
 				{
-					$this->data['items'][] = new $this->item_class($this, $items[$key]);
+					$keys = array_keys($items);
+					foreach ($keys as $key)
+					{
+						$this->data['items'][] = new $this->item_class($this, $items[$key]);
+					}
 				}
-			}
-			if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item'))
-			{
-				$keys = array_keys($items);
-				foreach ($keys as $key)
+				if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry'))
 				{
-					$this->data['items'][] = new $this->item_class($this, $items[$key]);
+					$keys = array_keys($items);
+					foreach ($keys as $key)
+					{
+						$this->data['items'][] = new $this->item_class($this, $items[$key]);
+					}
 				}
-			}
-			if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item'))
-			{
-				$keys = array_keys($items);
-				foreach ($keys as $key)
+				if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item'))
 				{
-					$this->data['items'][] = new $this->item_class($this, $items[$key]);
+					$keys = array_keys($items);
+					foreach ($keys as $key)
+					{
+						$this->data['items'][] = new $this->item_class($this, $items[$key]);
+					}
 				}
-			}
-			if ($items = $this->get_channel_tags('', 'item'))
-			{
-				$keys = array_keys($items);
-				foreach ($keys as $key)
+				if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item'))
+				{
+					$keys = array_keys($items);
+					foreach ($keys as $key)
+					{
+						$this->data['items'][] = new $this->item_class($this, $items[$key]);
+					}
+				}
+				if ($items = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'item'))
 				{
-					$this->data['items'][] = new $this->item_class($this, $items[$key]);
+					$keys = array_keys($items);
+					foreach ($keys as $key)
+					{
+						$this->data['items'][] = new $this->item_class($this, $items[$key]);
+					}
 				}
 			}
 		}
@@ -2596,7 +3005,7 @@ function embed_wmedia(width, height, link) {
 		if (!empty($this->data['items']))
 		{
 			// If we want to order it by date, check if all items have a date, and then sort it
-			if ($this->order_by_date)
+			if ($this->order_by_date && empty($this->multifeed_objects))
 			{
 				if (!isset($this->data['ordered_items']))
 				{
@@ -2624,7 +3033,7 @@ function embed_wmedia(width, height, link) {
 			}
 
 			// Slice the data as desired
-			if ($end == 0)
+			if ($end === 0)
 			{
 				return array_slice($items, $start);
 			}
@@ -2639,21 +3048,27 @@ function embed_wmedia(width, height, link) {
 		}
 	}
 
+	/**
+	 * @static
+	 */
 	function sort_items($a, $b)
 	{
 		return $a->get_date('U') <= $b->get_date('U');
 	}
 
-	function merge_items($urls, $start = 0, $end = 0)
+	/**
+	 * @static
+	 */
+	function merge_items($urls, $start = 0, $end = 0, $limit = 0)
 	{
 		if (is_array($urls) && sizeof($urls) > 0)
 		{
 			$items = array();
 			foreach ($urls as $arg)
 			{
-				if (SimplePie_Misc::is_a($arg, 'SimplePie'))
+				if (is_a($arg, 'SimplePie'))
 				{
-					$items = array_merge($items, $arg->get_items());
+					$items = array_merge($items, $arg->get_items(0, $limit));
 				}
 				else
 				{
@@ -2676,7 +3091,7 @@ function embed_wmedia(width, height, link) {
 				usort($items, array('SimplePie', 'sort_items'));
 			}
 
-			if ($end == 0)
+			if ($end === 0)
 			{
 				return array_slice($items, $start);
 			}
@@ -2709,6 +3124,17 @@ class SimplePie_Item
 		return md5(serialize($this->data));
 	}
 
+	/**
+	 * Remove items that link back to this before destroying this object
+	 */
+	function __destruct()
+	{
+		if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode'))
+		{
+			unset($this->feed);
+		}
+	}
+
 	function get_item_tags($namespace, $tag)
 	{
 		if (isset($this->data['child'][$namespace][$tag]))
@@ -2738,78 +3164,85 @@ class SimplePie_Item
 
 	function get_id($hash = false)
 	{
-		if ($hash)
+		if (!$hash)
 		{
-			return $this->__toString();
+			if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'id'))
+			{
+				return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'id'))
+			{
+				return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid'))
+			{
+				return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'identifier'))
+			{
+				return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'identifier'))
+			{
+				return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			elseif (($return = $this->get_permalink()) !== null)
+			{
+				return $return;
+			}
+			elseif (($return = $this->get_title()) !== null)
+			{
+				return $return;
+			}
 		}
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'id'))
+		if ($this->get_permalink() !== null || $this->get_title() !== null)
 		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			return md5($this->get_permalink() . $this->get_title());
 		}
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'id'))
+		else
 		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			return md5(serialize($this->data));
 		}
-		elseif ($return = $this->get_item_tags('', 'guid'))
+	}
+
+	function get_title()
+	{
+		if (!isset($this->data['title']))
 		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
-		}
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'identifier'))
-		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
-		}
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'identifier'))
-		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
-		}
-		elseif (($return = $this->get_permalink()) !== null)
-		{
-			return $return;
-		}
-		elseif (($return = $this->get_title()) !== null)
-		{
-			return $return;
-		}
-		else
-		{
-			return $this->__toString();
-		}
-	}
-
-	function get_title()
-	{
-		if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
-		{
-			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
-		}
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
-		{
-			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
-		}
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
-		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
-		}
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
-		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
-		}
-		elseif ($return = $this->get_item_tags('', 'title'))
-		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
-		}
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
-		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
-		}
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
-		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
-		}
-		else
-		{
-			return null;
+			if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
+			{
+				$this->data['title'] = $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+			}
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
+			{
+				$this->data['title'] = $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+			}
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
+			{
+				$this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+			}
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
+			{
+				$this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+			}
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
+			{
+				$this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+			}
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
+			{
+				$this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
+			{
+				$this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			else
+			{
+				$this->data['title'] = null;
+			}
 		}
+		return $this->data['title'];
 	}
 
 	function get_description($description_only = false)
@@ -2826,7 +3259,7 @@ class SimplePie_Item
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 		}
-		elseif ($return = $this->get_item_tags('', 'description'))
+		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
 		}
@@ -2916,9 +3349,20 @@ class SimplePie_Item
 			}
 			$categories[] = new $this->feed->category_class($term, $scheme, $label);
 		}
-		foreach ((array) $this->get_item_tags('', 'category') as $category)
+		foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
 		{
-			$categories[] = new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+			// This is really the label, but keep this as the term also for BC.
+			// Label will also work on retrieving because that falls back to term.
+			$term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			if (isset($category['attribs']['']['domain']))
+			{
+				$scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			else
+			{
+				$scheme = null;
+			}
+			$categories[] = new $this->feed->category_class($term, $scheme, null);
 		}
 		foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
 		{
@@ -2952,9 +3396,77 @@ class SimplePie_Item
 		}
 	}
 
-	/**
-	 * @todo Atom inheritance (item author, source author, feed author)
-	 */
+	function get_contributor($key = 0)
+	{
+		$contributors = $this->get_contributors();
+		if (isset($contributors[$key]))
+		{
+			return $contributors[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_contributors()
+	{
+		$contributors = array();
+		foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
+		{
+			$name = null;
+			$uri = null;
+			$email = null;
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
+			{
+				$name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
+			{
+				$uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
+			{
+				$email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if ($name !== null || $email !== null || $uri !== null)
+			{
+				$contributors[] = new $this->feed->author_class($name, $uri, $email);
+			}
+		}
+		foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
+		{
+			$name = null;
+			$url = null;
+			$email = null;
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
+			{
+				$name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
+			{
+				$url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
+			{
+				$email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if ($name !== null || $email !== null || $url !== null)
+			{
+				$contributors[] = new $this->feed->author_class($name, $url, $email);
+			}
+		}
+
+		if (!empty($contributors))
+		{
+			return SimplePie_Misc::array_unique($contributors);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
 	function get_authors()
 	{
 		$authors = array();
@@ -2991,18 +3503,18 @@ class SimplePie_Item
 			}
 			if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
 			{
-				$uri = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
+				$url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
 			}
 			if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
 			{
 				$email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 			}
-			if ($name !== null || $email !== null || $uri !== null)
+			if ($name !== null || $email !== null || $url !== null)
 			{
 				$authors[] = new $this->feed->author_class($name, $url, $email);
 			}
 		}
-		if ($author = $this->get_item_tags('', 'author'))
+		if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'author'))
 		{
 			$authors[] = new $this->feed->author_class(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
 		}
@@ -3023,6 +3535,34 @@ class SimplePie_Item
 		{
 			return SimplePie_Misc::array_unique($authors);
 		}
+		elseif (($source = $this->get_source()) && ($authors = $source->get_authors()))
+		{
+			return $authors;
+		}
+		elseif ($authors = $this->feed->get_authors())
+		{
+			return $authors;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_copyright()
+	{
+		if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
+		{
+			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+		}
+		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
+		{
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+		}
+		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
+		{
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+		}
 		else
 		{
 			return null;
@@ -3053,7 +3593,7 @@ class SimplePie_Item
 			{
 				$this->data['date']['raw'] = $return[0]['data'];
 			}
-			elseif ($return = $this->get_item_tags('', 'pubDate'))
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate'))
 			{
 				$this->data['date']['raw'] = $return[0]['data'];
 			}
@@ -3068,7 +3608,8 @@ class SimplePie_Item
 
 			if (!empty($this->data['date']['raw']))
 			{
-				$this->data['date']['parsed'] = SimplePie_Misc::parse_date($this->data['date']['raw']);
+				$parser = SimplePie_Parse_Date::get();
+				$this->data['date']['parsed'] = $parser->parse($this->data['date']['raw']);
 			}
 			else
 			{
@@ -3173,13 +3714,13 @@ class SimplePie_Item
 			{
 				$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
 			}
-			if ($links = $this->get_item_tags('', 'link'))
+			if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
 			{
 				$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
 			}
-			if ($links = $this->get_item_tags('', 'guid'))
+			if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid'))
 			{
-				if (!isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) == 'true')
+				if (!isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) === 'true')
 				{
 					$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
 				}
@@ -3200,7 +3741,7 @@ class SimplePie_Item
 						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
 					}
 				}
-				elseif (substr($key, 0, 41) == SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
+				elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
 				{
 					$this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
 				}
@@ -3241,7 +3782,6 @@ class SimplePie_Item
 	 * At this point, we're pretty much assuming that all enclosures for an item are the same content.  Anything else is too complicated to properly support.
 	 *
 	 * @todo Add support for end-user defined sorting of enclosures by type/handler (so we can prefer the faster-loading FLV over MP4).
-	 * @todo Add support for itunes: tags.  These should be relatively simple compared to media:.
 	 * @todo If an element exists at a level, but it's value is empty, we should fall back to the value from the parent (if it exists).
 	 */
 	function get_enclosures()
@@ -3767,7 +4307,7 @@ class SimplePie_Item
 					$restriction_relationship = 'allow';
 					$restriction_type = null;
 					$restriction_value = 'itunes';
-					if (isset($restriction['data']) && strtolower($restriction['data']) == 'yes')
+					if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes')
 					{
 						$restriction_relationship = 'deny';
 					}
@@ -3803,7 +4343,7 @@ class SimplePie_Item
 					$restriction_relationship = 'allow';
 					$restriction_type = null;
 					$restriction_value = 'itunes';
-					if (isset($restriction['data']) && strtolower($restriction['data']) == 'yes')
+					if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes')
 					{
 						$restriction_relationship = 'deny';
 					}
@@ -3856,624 +4396,657 @@ class SimplePie_Item
 			// Clear the memory
 			unset($parent);
 
+			// Attributes
+			$bitrate = null;
+			$channels = null;
+			$duration = null;
+			$expression = null;
+			$framerate = null;
+			$height = null;
+			$javascript = null;
+			$lang = null;
+			$length = null;
+			$medium = null;
+			$samplingrate = null;
+			$type = null;
+			$url = null;
+			$width = null;
+
+			// Elements
+			$captions = null;
+			$categories = null;
+			$copyrights = null;
+			$credits = null;
+			$description = null;
+			$hashes = null;
+			$keywords = null;
+			$player = null;
+			$ratings = null;
+			$restrictions = null;
+			$thumbnails = null;
+			$title = null;
+
 			// If we have media:group tags, loop through them.
 			foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'group') as $group)
 			{
-				// If we have media:content tags, loop through them.
-				foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content)
+				if(isset($group['child']) && isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content']))
 				{
-					if (isset($content['attribs']['']['url']))
+					// If we have media:content tags, loop through them.
+					foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content)
 					{
-						// Attributes
-						$bitrate = null;
-						$channels = null;
-						$duration = null;
-						$expression = null;
-						$framerate = null;
-						$height = null;
-						$javascript = null;
-						$lang = null;
-						$length = null;
-						$medium = null;
-						$samplingrate = null;
-						$type = null;
-						$url = null;
-						$width = null;
-
-						// Elements
-						$captions = null;
-						$categories = null;
-						$copyrights = null;
-						$credits = null;
-						$description = null;
-						$hashes = null;
-						$keywords = null;
-						$player = null;
-						$ratings = null;
-						$restrictions = null;
-						$thumbnails = null;
-						$title = null;
-
-						// Start checking the attributes of media:content
-						if (isset($content['attribs']['']['bitrate']))
-						{
-							$bitrate = $this->sanitize($content['attribs']['']['bitrate'], SIMPLEPIE_CONSTRUCT_TEXT);
-						}
-						if (isset($content['attribs']['']['channels']))
-						{
-							$channels = $this->sanitize($content['attribs']['']['channels'], SIMPLEPIE_CONSTRUCT_TEXT);
-						}
-						if (isset($content['attribs']['']['duration']))
-						{
-							$duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT);
-						}
-						else
-						{
-							$duration = $duration_parent;
-						}
-						if (isset($content['attribs']['']['expression']))
-						{
-							$expression = $this->sanitize($content['attribs']['']['expression'], SIMPLEPIE_CONSTRUCT_TEXT);
-						}
-						if (isset($content['attribs']['']['framerate']))
-						{
-							$framerate = $this->sanitize($content['attribs']['']['framerate'], SIMPLEPIE_CONSTRUCT_TEXT);
-						}
-						if (isset($content['attribs']['']['height']))
-						{
-							$height = $this->sanitize($content['attribs']['']['height'], SIMPLEPIE_CONSTRUCT_TEXT);
-						}
-						if (isset($content['attribs']['']['lang']))
-						{
-							$lang = $this->sanitize($content['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
-						}
-						if (isset($content['attribs']['']['fileSize']))
-						{
-							$length = ceil($content['attribs']['']['fileSize']);
-						}
-						if (isset($content['attribs']['']['medium']))
-						{
-							$medium = $this->sanitize($content['attribs']['']['medium'], SIMPLEPIE_CONSTRUCT_TEXT);
-						}
-						if (isset($content['attribs']['']['samplingrate']))
-						{
-							$samplingrate = $this->sanitize($content['attribs']['']['samplingrate'], SIMPLEPIE_CONSTRUCT_TEXT);
-						}
-						if (isset($content['attribs']['']['type']))
-						{
-							$type = $this->sanitize($content['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
-						}
-						if (isset($content['attribs']['']['width']))
+						if (isset($content['attribs']['']['url']))
 						{
-							$width = $this->sanitize($content['attribs']['']['width'], SIMPLEPIE_CONSTRUCT_TEXT);
-						}
-						$url = $this->sanitize($content['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
+							// Attributes
+							$bitrate = null;
+							$channels = null;
+							$duration = null;
+							$expression = null;
+							$framerate = null;
+							$height = null;
+							$javascript = null;
+							$lang = null;
+							$length = null;
+							$medium = null;
+							$samplingrate = null;
+							$type = null;
+							$url = null;
+							$width = null;
+
+							// Elements
+							$captions = null;
+							$categories = null;
+							$copyrights = null;
+							$credits = null;
+							$description = null;
+							$hashes = null;
+							$keywords = null;
+							$player = null;
+							$ratings = null;
+							$restrictions = null;
+							$thumbnails = null;
+							$title = null;
+
+							// Start checking the attributes of media:content
+							if (isset($content['attribs']['']['bitrate']))
+							{
+								$bitrate = $this->sanitize($content['attribs']['']['bitrate'], SIMPLEPIE_CONSTRUCT_TEXT);
+							}
+							if (isset($content['attribs']['']['channels']))
+							{
+								$channels = $this->sanitize($content['attribs']['']['channels'], SIMPLEPIE_CONSTRUCT_TEXT);
+							}
+							if (isset($content['attribs']['']['duration']))
+							{
+								$duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT);
+							}
+							else
+							{
+								$duration = $duration_parent;
+							}
+							if (isset($content['attribs']['']['expression']))
+							{
+								$expression = $this->sanitize($content['attribs']['']['expression'], SIMPLEPIE_CONSTRUCT_TEXT);
+							}
+							if (isset($content['attribs']['']['framerate']))
+							{
+								$framerate = $this->sanitize($content['attribs']['']['framerate'], SIMPLEPIE_CONSTRUCT_TEXT);
+							}
+							if (isset($content['attribs']['']['height']))
+							{
+								$height = $this->sanitize($content['attribs']['']['height'], SIMPLEPIE_CONSTRUCT_TEXT);
+							}
+							if (isset($content['attribs']['']['lang']))
+							{
+								$lang = $this->sanitize($content['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
+							}
+							if (isset($content['attribs']['']['fileSize']))
+							{
+								$length = ceil($content['attribs']['']['fileSize']);
+							}
+							if (isset($content['attribs']['']['medium']))
+							{
+								$medium = $this->sanitize($content['attribs']['']['medium'], SIMPLEPIE_CONSTRUCT_TEXT);
+							}
+							if (isset($content['attribs']['']['samplingrate']))
+							{
+								$samplingrate = $this->sanitize($content['attribs']['']['samplingrate'], SIMPLEPIE_CONSTRUCT_TEXT);
+							}
+							if (isset($content['attribs']['']['type']))
+							{
+								$type = $this->sanitize($content['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+							}
+							if (isset($content['attribs']['']['width']))
+							{
+								$width = $this->sanitize($content['attribs']['']['width'], SIMPLEPIE_CONSTRUCT_TEXT);
+							}
+							$url = $this->sanitize($content['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
 
-						// Checking the other optional media: elements. Priority: media:content, media:group, item, channel
+							// Checking the other optional media: elements. Priority: media:content, media:group, item, channel
 
-						// CAPTIONS
-						if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text']))
-						{
-							foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption)
+							// CAPTIONS
+							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text']))
 							{
-								$caption_type = null;
-								$caption_lang = null;
-								$caption_startTime = null;
-								$caption_endTime = null;
-								$caption_text = null;
-								if (isset($caption['attribs']['']['type']))
-								{
-									$caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
-								}
-								if (isset($caption['attribs']['']['lang']))
+								foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption)
 								{
-									$caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$caption_type = null;
+									$caption_lang = null;
+									$caption_startTime = null;
+									$caption_endTime = null;
+									$caption_text = null;
+									if (isset($caption['attribs']['']['type']))
+									{
+										$caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									if (isset($caption['attribs']['']['lang']))
+									{
+										$caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									if (isset($caption['attribs']['']['start']))
+									{
+										$caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									if (isset($caption['attribs']['']['end']))
+									{
+										$caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									if (isset($caption['data']))
+									{
+										$caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									$captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
 								}
-								if (isset($caption['attribs']['']['start']))
+								if (is_array($captions))
 								{
-									$caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$captions = array_values(SimplePie_Misc::array_unique($captions));
 								}
-								if (isset($caption['attribs']['']['end']))
+							}
+							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text']))
+							{
+								foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption)
 								{
-									$caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$caption_type = null;
+									$caption_lang = null;
+									$caption_startTime = null;
+									$caption_endTime = null;
+									$caption_text = null;
+									if (isset($caption['attribs']['']['type']))
+									{
+										$caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									if (isset($caption['attribs']['']['lang']))
+									{
+										$caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									if (isset($caption['attribs']['']['start']))
+									{
+										$caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									if (isset($caption['attribs']['']['end']))
+									{
+										$caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									if (isset($caption['data']))
+									{
+										$caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									$captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
 								}
-								if (isset($caption['data']))
+								if (is_array($captions))
 								{
-									$caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$captions = array_values(SimplePie_Misc::array_unique($captions));
 								}
-								$captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
 							}
-							if (is_array($captions))
+							else
 							{
-								$captions = array_values(SimplePie_Misc::array_unique($captions));
+								$captions = $captions_parent;
 							}
-						}
-						elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text']))
-						{
-							foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption)
+
+							// CATEGORIES
+							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category']))
 							{
-								$caption_type = null;
-								$caption_lang = null;
-								$caption_startTime = null;
-								$caption_endTime = null;
-								$caption_text = null;
-								if (isset($caption['attribs']['']['type']))
-								{
-									$caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
-								}
-								if (isset($caption['attribs']['']['lang']))
-								{
-									$caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
-								}
-								if (isset($caption['attribs']['']['start']))
-								{
-									$caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
-								}
-								if (isset($caption['attribs']['']['end']))
+								foreach ((array) $content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category)
 								{
-									$caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$term = null;
+									$scheme = null;
+									$label = null;
+									if (isset($category['data']))
+									{
+										$term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									if (isset($category['attribs']['']['scheme']))
+									{
+										$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									else
+									{
+										$scheme = 'http://search.yahoo.com/mrss/category_schema';
+									}
+									if (isset($category['attribs']['']['label']))
+									{
+										$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									$categories[] = new $this->feed->category_class($term, $scheme, $label);
 								}
-								if (isset($caption['data']))
+							}
+							if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category']))
+							{
+								foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category)
 								{
-									$caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$term = null;
+									$scheme = null;
+									$label = null;
+									if (isset($category['data']))
+									{
+										$term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									if (isset($category['attribs']['']['scheme']))
+									{
+										$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									else
+									{
+										$scheme = 'http://search.yahoo.com/mrss/category_schema';
+									}
+									if (isset($category['attribs']['']['label']))
+									{
+										$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									$categories[] = new $this->feed->category_class($term, $scheme, $label);
 								}
-								$captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
 							}
-							if (is_array($captions))
+							if (is_array($categories) && is_array($categories_parent))
 							{
-								$captions = array_values(SimplePie_Misc::array_unique($captions));
+								$categories = array_values(SimplePie_Misc::array_unique(array_merge($categories, $categories_parent)));
+							}
+							elseif (is_array($categories))
+							{
+								$categories = array_values(SimplePie_Misc::array_unique($categories));
+							}
+							elseif (is_array($categories_parent))
+							{
+								$categories = array_values(SimplePie_Misc::array_unique($categories_parent));
 							}
-						}
-						else
-						{
-							$captions = $captions_parent;
-						}
 
-						// CATEGORIES
-						if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category']))
-						{
-							foreach ((array) $content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category)
+							// COPYRIGHTS
+							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright']))
 							{
-								$term = null;
-								$scheme = null;
-								$label = null;
-								if (isset($category['data']))
+								$copyright_url = null;
+								$copyright_label = null;
+								if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url']))
 								{
-									$term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$copyright_url = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
 								}
-								if (isset($category['attribs']['']['scheme']))
+								if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data']))
 								{
-									$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 								}
-								else
+								$copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label);
+							}
+							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright']))
+							{
+								$copyright_url = null;
+								$copyright_label = null;
+								if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url']))
 								{
-									$scheme = 'http://search.yahoo.com/mrss/category_schema';
+									$copyright_url = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
 								}
-								if (isset($category['attribs']['']['label']))
+								if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data']))
 								{
-									$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$copyright_label = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 								}
-								$categories[] = new $this->feed->category_class($term, $scheme, $label);
+								$copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label);
 							}
-						}
-						if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category']))
-						{
-							foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category)
+							else
 							{
-								$term = null;
-								$scheme = null;
-								$label = null;
-								if (isset($category['data']))
+								$copyrights = $copyrights_parent;
+							}
+
+							// CREDITS
+							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
+							{
+								foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit)
 								{
-									$term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$credit_role = null;
+									$credit_scheme = null;
+									$credit_name = null;
+									if (isset($credit['attribs']['']['role']))
+									{
+										$credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									if (isset($credit['attribs']['']['scheme']))
+									{
+										$credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									else
+									{
+										$credit_scheme = 'urn:ebu';
+									}
+									if (isset($credit['data']))
+									{
+										$credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									$credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
 								}
-								if (isset($category['attribs']['']['scheme']))
+								if (is_array($credits))
 								{
-									$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$credits = array_values(SimplePie_Misc::array_unique($credits));
 								}
-								else
+							}
+							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
+							{
+								foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit)
 								{
-									$scheme = 'http://search.yahoo.com/mrss/category_schema';
+									$credit_role = null;
+									$credit_scheme = null;
+									$credit_name = null;
+									if (isset($credit['attribs']['']['role']))
+									{
+										$credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									if (isset($credit['attribs']['']['scheme']))
+									{
+										$credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									else
+									{
+										$credit_scheme = 'urn:ebu';
+									}
+									if (isset($credit['data']))
+									{
+										$credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									$credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
 								}
-								if (isset($category['attribs']['']['label']))
+								if (is_array($credits))
 								{
-									$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$credits = array_values(SimplePie_Misc::array_unique($credits));
 								}
-								$categories[] = new $this->feed->category_class($term, $scheme, $label);
 							}
-						}
-						if (is_array($categories) && is_array($categories_parent))
-						{
-							$categories = array_values(SimplePie_Misc::array_unique(array_merge($categories, $categories_parent)));
-						}
-						elseif (is_array($categories))
-						{
-							$categories = array_values(SimplePie_Misc::array_unique($categories));
-						}
-						elseif (is_array($categories_parent))
-						{
-							$categories = array_values(SimplePie_Misc::array_unique($categories_parent));
-						}
-
-						// COPYRIGHTS
-						if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright']))
-						{
-							$copyright_url = null;
-							$copyright_label = null;
-							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url']))
+							else
 							{
-								$copyright_url = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
+								$credits = $credits_parent;
 							}
-							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data']))
+
+							// DESCRIPTION
+							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
 							{
-								$copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+								$description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 							}
-							$copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label);
-						}
-						elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright']))
-						{
-							$copyright_url = null;
-							$copyright_label = null;
-							if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url']))
+							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
 							{
-								$copyright_url = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
+								$description = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 							}
-							if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data']))
+							else
 							{
-								$copyright_label = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+								$description = $description_parent;
 							}
-							$copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label);
-						}
-						else
-						{
-							$copyrights = $copyrights_parent;
-						}
 
-						// CREDITS
-						if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
-						{
-							foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit)
+							// HASHES
+							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
 							{
-								$credit_role = null;
-								$credit_scheme = null;
-								$credit_name = null;
-								if (isset($credit['attribs']['']['role']))
+								foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash)
 								{
-									$credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$value = null;
+									$algo = null;
+									if (isset($hash['data']))
+									{
+										$value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									if (isset($hash['attribs']['']['algo']))
+									{
+										$algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									else
+									{
+										$algo = 'md5';
+									}
+									$hashes[] = $algo.':'.$value;
 								}
-								if (isset($credit['attribs']['']['scheme']))
+								if (is_array($hashes))
 								{
-									$credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$hashes = array_values(SimplePie_Misc::array_unique($hashes));
 								}
-								else
+							}
+							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
+							{
+								foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash)
 								{
-									$credit_scheme = 'urn:ebu';
+									$value = null;
+									$algo = null;
+									if (isset($hash['data']))
+									{
+										$value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									if (isset($hash['attribs']['']['algo']))
+									{
+										$algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									else
+									{
+										$algo = 'md5';
+									}
+									$hashes[] = $algo.':'.$value;
 								}
-								if (isset($credit['data']))
+								if (is_array($hashes))
 								{
-									$credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$hashes = array_values(SimplePie_Misc::array_unique($hashes));
 								}
-								$credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
 							}
-							if (is_array($credits))
+							else
 							{
-								$credits = array_values(SimplePie_Misc::array_unique($credits));
+								$hashes = $hashes_parent;
 							}
-						}
-						elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
-						{
-							foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit)
+
+							// KEYWORDS
+							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
 							{
-								$credit_role = null;
-								$credit_scheme = null;
-								$credit_name = null;
-								if (isset($credit['attribs']['']['role']))
+								if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data']))
 								{
-									$credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$temp = explode(',', $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
+									foreach ($temp as $word)
+									{
+										$keywords[] = trim($word);
+									}
+									unset($temp);
 								}
-								if (isset($credit['attribs']['']['scheme']))
+								if (is_array($keywords))
 								{
-									$credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$keywords = array_values(SimplePie_Misc::array_unique($keywords));
 								}
-								else
+							}
+							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
+							{
+								if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data']))
 								{
-									$credit_scheme = 'urn:ebu';
+									$temp = explode(',', $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
+									foreach ($temp as $word)
+									{
+										$keywords[] = trim($word);
+									}
+									unset($temp);
 								}
-								if (isset($credit['data']))
+								if (is_array($keywords))
 								{
-									$credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$keywords = array_values(SimplePie_Misc::array_unique($keywords));
 								}
-								$credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
 							}
-							if (is_array($credits))
+							else
 							{
-								$credits = array_values(SimplePie_Misc::array_unique($credits));
+								$keywords = $keywords_parent;
 							}
-						}
-						else
-						{
-							$credits = $credits_parent;
-						}
-
-						// DESCRIPTION
-						if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
-						{
-							$description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
-						}
-						elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
-						{
-							$description = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
-						}
-						else
-						{
-							$description = $description_parent;
-						}
 
-						// HASHES
-						if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
-						{
-							foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash)
+							// PLAYER
+							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
 							{
-								$value = null;
-								$algo = null;
-								if (isset($hash['data']))
-								{
-									$value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT);
-								}
-								if (isset($hash['attribs']['']['algo']))
-								{
-									$algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
-								}
-								else
-								{
-									$algo = 'md5';
-								}
-								$hashes[] = $algo.':'.$value;
+								$player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
 							}
-							if (is_array($hashes))
+							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
 							{
-								$hashes = array_values(SimplePie_Misc::array_unique($hashes));
+								$player = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
 							}
-						}
-						elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
-						{
-							foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash)
+							else
 							{
-								$value = null;
-								$algo = null;
-								if (isset($hash['data']))
-								{
-									$value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT);
-								}
-								if (isset($hash['attribs']['']['algo']))
+								$player = $player_parent;
+							}
+
+							// RATINGS
+							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
+							{
+								foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating)
 								{
-									$algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$rating_scheme = null;
+									$rating_value = null;
+									if (isset($rating['attribs']['']['scheme']))
+									{
+										$rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									else
+									{
+										$rating_scheme = 'urn:simple';
+									}
+									if (isset($rating['data']))
+									{
+										$rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									$ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value);
 								}
-								else
+								if (is_array($ratings))
 								{
-									$algo = 'md5';
+									$ratings = array_values(SimplePie_Misc::array_unique($ratings));
 								}
-								$hashes[] = $algo.':'.$value;
-							}
-							if (is_array($hashes))
-							{
-								$hashes = array_values(SimplePie_Misc::array_unique($hashes));
 							}
-						}
-						else
-						{
-							$hashes = $hashes_parent;
-						}
-
-						// KEYWORDS
-						if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
-						{
-							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data']))
+							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
 							{
-								$temp = explode(',', $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
-								foreach ($temp as $word)
+								foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating)
 								{
-									$keywords[] = trim($word);
+									$rating_scheme = null;
+									$rating_value = null;
+									if (isset($rating['attribs']['']['scheme']))
+									{
+										$rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									else
+									{
+										$rating_scheme = 'urn:simple';
+									}
+									if (isset($rating['data']))
+									{
+										$rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									$ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value);
 								}
-								unset($temp);
-							}
-							if (is_array($keywords))
-							{
-								$keywords = array_values(SimplePie_Misc::array_unique($keywords));
-							}
-						}
-						elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
-						{
-							if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data']))
-							{
-								$temp = explode(',', $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
-								foreach ($temp as $word)
+								if (is_array($ratings))
 								{
-									$keywords[] = trim($word);
+									$ratings = array_values(SimplePie_Misc::array_unique($ratings));
 								}
-								unset($temp);
 							}
-							if (is_array($keywords))
+							else
 							{
-								$keywords = array_values(SimplePie_Misc::array_unique($keywords));
+								$ratings = $ratings_parent;
 							}
-						}
-						else
-						{
-							$keywords = $keywords_parent;
-						}
-
-						// PLAYER
-						if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
-						{
-							$player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
-						}
-						elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
-						{
-							$player = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
-						}
-						else
-						{
-							$player = $player_parent;
-						}
 
-						// RATINGS
-						if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
-						{
-							foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating)
+							// RESTRICTIONS
+							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
 							{
-								$rating_scheme = null;
-								$rating_value = null;
-								if (isset($rating['attribs']['']['scheme']))
-								{
-									$rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
-								}
-								else
+								foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction)
 								{
-									$rating_scheme = 'urn:simple';
+									$restriction_relationship = null;
+									$restriction_type = null;
+									$restriction_value = null;
+									if (isset($restriction['attribs']['']['relationship']))
+									{
+										$restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									if (isset($restriction['attribs']['']['type']))
+									{
+										$restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									if (isset($restriction['data']))
+									{
+										$restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									$restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
 								}
-								if (isset($rating['data']))
+								if (is_array($restrictions))
 								{
-									$rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$restrictions = array_values(SimplePie_Misc::array_unique($restrictions));
 								}
-								$ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value);
-							}
-							if (is_array($ratings))
-							{
-								$ratings = array_values(SimplePie_Misc::array_unique($ratings));
 							}
-						}
-						elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
-						{
-							foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating)
+							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
 							{
-								$rating_scheme = null;
-								$rating_value = null;
-								if (isset($rating['attribs']['']['scheme']))
-								{
-									$rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
-								}
-								else
+								foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction)
 								{
-									$rating_scheme = 'urn:simple';
+									$restriction_relationship = null;
+									$restriction_type = null;
+									$restriction_value = null;
+									if (isset($restriction['attribs']['']['relationship']))
+									{
+										$restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									if (isset($restriction['attribs']['']['type']))
+									{
+										$restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									if (isset($restriction['data']))
+									{
+										$restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									}
+									$restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
 								}
-								if (isset($rating['data']))
+								if (is_array($restrictions))
 								{
-									$rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$restrictions = array_values(SimplePie_Misc::array_unique($restrictions));
 								}
-								$ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value);
 							}
-							if (is_array($ratings))
+							else
 							{
-								$ratings = array_values(SimplePie_Misc::array_unique($ratings));
+								$restrictions = $restrictions_parent;
 							}
-						}
-						else
-						{
-							$ratings = $ratings_parent;
-						}
 
-						// RESTRICTIONS
-						if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
-						{
-							foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction)
+							// THUMBNAILS
+							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail']))
 							{
-								$restriction_relationship = null;
-								$restriction_type = null;
-								$restriction_value = null;
-								if (isset($restriction['attribs']['']['relationship']))
+								foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail)
 								{
-									$restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT);
-								}
-								if (isset($restriction['attribs']['']['type']))
-								{
-									$restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
 								}
-								if (isset($restriction['data']))
+								if (is_array($thumbnails))
 								{
-									$restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails));
 								}
-								$restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
 							}
-							if (is_array($restrictions))
-							{
-								$restrictions = array_values(SimplePie_Misc::array_unique($restrictions));
-							}
-						}
-						elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
-						{
-							foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction)
+							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail']))
 							{
-								$restriction_relationship = null;
-								$restriction_type = null;
-								$restriction_value = null;
-								if (isset($restriction['attribs']['']['relationship']))
-								{
-									$restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT);
-								}
-								if (isset($restriction['attribs']['']['type']))
+								foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail)
 								{
-									$restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
 								}
-								if (isset($restriction['data']))
+								if (is_array($thumbnails))
 								{
-									$restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+									$thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails));
 								}
-								$restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
 							}
-							if (is_array($restrictions))
+							else
 							{
-								$restrictions = array_values(SimplePie_Misc::array_unique($restrictions));
+								$thumbnails = $thumbnails_parent;
 							}
-						}
-						else
-						{
-							$restrictions = $restrictions_parent;
-						}
 
-						// THUMBNAILS
-						if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail']))
-						{
-							foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail)
-							{
-								$thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
-							}
-							if (is_array($thumbnails))
+							// TITLES
+							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title']))
 							{
-								$thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails));
+								$title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 							}
-						}
-						elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail']))
-						{
-							foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail)
+							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title']))
 							{
-								$thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
+								$title = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 							}
-							if (is_array($thumbnails))
+							else
 							{
-								$thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails));
+								$title = $title_parent;
 							}
-						}
-						else
-						{
-							$thumbnails = $thumbnails_parent;
-						}
 
-						// TITLES
-						if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title']))
-						{
-							$title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
-						}
-						elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title']))
-						{
-							$title = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
-						}
-						else
-						{
-							$title = $title_parent;
+							$this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width);
 						}
-
-						$this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width);
 					}
 				}
 			}
@@ -4884,7 +5457,7 @@ class SimplePie_Item
 
 			foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link)
 			{
-				if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] == 'enclosure')
+				if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure')
 				{
 					// Attributes
 					$bitrate = null;
@@ -4919,7 +5492,7 @@ class SimplePie_Item
 
 			foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link)
 			{
-				if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] == 'enclosure')
+				if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure')
 				{
 					// Attributes
 					$bitrate = null;
@@ -4952,7 +5525,7 @@ class SimplePie_Item
 				}
 			}
 
-			if ($enclosure = $this->get_item_tags('', 'enclosure'))
+			if ($enclosure = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'enclosure'))
 			{
 				if (isset($enclosure[0]['attribs']['']['url']))
 				{
@@ -4986,6 +5559,13 @@ class SimplePie_Item
 					$this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
 				}
 			}
+
+			if (sizeof($this->data['enclosures']) === 0 && ($url || $type || $length || $bitrate || $captions_parent || $categories_parent || $channels || $copyrights_parent || $credits_parent || $description_parent || $duration_parent || $expression || $framerate || $hashes_parent || $height || $keywords_parent || $lang || $medium || $player_parent || $ratings_parent || $restrictions_parent || $samplingrate || $thumbnails_parent || $title_parent || $width))
+			{
+				// Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
+				$this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
+			}
+
 			$this->data['enclosures'] = array_values(SimplePie_Misc::array_unique($this->data['enclosures']));
 		}
 		if (!empty($this->data['enclosures']))
@@ -5004,7 +5584,7 @@ class SimplePie_Item
 		{
 			return (float) $return[0]['data'];
 		}
-		elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
+		elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
 		{
 			return (float) $match[1];
 		}
@@ -5024,7 +5604,7 @@ class SimplePie_Item
 		{
 			return (float) $return[0]['data'];
 		}
-		elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
+		elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
 		{
 			return (float) $match[2];
 		}
@@ -5034,6 +5614,18 @@ class SimplePie_Item
 		}
 	}
 
+	function get_source()
+	{
+		if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'source'))
+		{
+			return new $this->feed->source_class($this, $return[0]);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
 	/**
 	 * Creates the add_to_* methods' return data
 	 *
@@ -5043,16 +5635,20 @@ class SimplePie_Item
 	 * (and suffix to the item permalink)
 	 * @return mixed URL if feed exists, false otherwise
 	 */
-	function add_to_service($item_url, $title_url = null)
+	function add_to_service($item_url, $title_url = null, $summary_url = null)
 	{
 		if ($this->get_permalink() !== null)
 		{
-			$return = $this->sanitize($item_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_permalink());
+			$return = $item_url . rawurlencode($this->get_permalink());
 			if ($title_url !== null && $this->get_title() !== null)
 			{
-				$return .= $this->sanitize($title_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_title());
+				$return .= $title_url . rawurlencode($this->get_title());
 			}
-			return $return;
+			if ($summary_url !== null && $this->get_description() !== null)
+			{
+				$return .= $summary_url . rawurlencode($this->get_description());
+			}
+			return $this->sanitize($return, SIMPLEPIE_CONSTRUCT_IRI);
 		}
 		else
 		{
@@ -5072,12 +5668,12 @@ class SimplePie_Item
 
 	function add_to_delicious()
 	{
-		return $this->add_to_service('http://del.icio.us/post/?v=3&url=', '&title=');
+		return $this->add_to_service('http://del.icio.us/post/?v=4&url=', '&title=');
 	}
 
 	function add_to_digg()
 	{
-		return $this->add_to_service('http://digg.com/submit?phase=2&URL=');
+		return $this->add_to_service('http://digg.com/submit?url=', '&title=', '&bodytext=');
 	}
 
 	function add_to_furl()
@@ -5131,224 +5727,78 @@ class SimplePie_Item
 	}
 }
 
-class SimplePie_Author
+class SimplePie_Source
 {
-	var $name;
-	var $link;
-	var $email;
+	var $item;
+	var $data = array();
 
-	// Constructor, used to input the data
-	function SimplePie_Author($name = null, $link = null, $email = null)
+	function SimplePie_Source($item, $data)
 	{
-		$this->name = $name;
-		$this->link = $link;
-		$this->email = $email;
+		$this->item = $item;
+		$this->data = $data;
 	}
 
 	function __toString()
 	{
-		// There is no $this->data here
-		return md5(serialize($this));
-	}
-
-	function get_name()
-	{
-		if ($this->name !== null)
-		{
-			return $this->name;
-		}
-		else
-		{
-			return null;
-		}
-	}
-
-	function get_link()
-	{
-		if ($this->link !== null)
-		{
-			return $this->link;
-		}
-		else
-		{
-			return null;
-		}
+		return md5(serialize($this->data));
 	}
 
-	function get_email()
+	function get_source_tags($namespace, $tag)
 	{
-		if ($this->email !== null)
+		if (isset($this->data['child'][$namespace][$tag]))
 		{
-			return $this->email;
+			return $this->data['child'][$namespace][$tag];
 		}
 		else
 		{
 			return null;
 		}
 	}
-}
-
-class SimplePie_Category
-{
-	var $term;
-	var $scheme;
-	var $label;
-
-	// Constructor, used to input the data
-	function SimplePie_Category($term = null, $scheme = null, $label = null)
-	{
-		$this->term = $term;
-		$this->scheme = $scheme;
-		$this->label = $label;
-	}
 
-	function __toString()
+	function get_base($element = array())
 	{
-		// There is no $this->data here
-		return md5(serialize($this));
+		return $this->item->get_base($element);
 	}
 
-	function get_term()
+	function sanitize($data, $type, $base = '')
 	{
-		if ($this->term !== null)
-		{
-			return $this->term;
-		}
-		else
-		{
-			return null;
-		}
+		return $this->item->sanitize($data, $type, $base);
 	}
 
-	function get_scheme()
+	function get_item()
 	{
-		if ($this->scheme !== null)
-		{
-			return $this->scheme;
-		}
-		else
-		{
-			return null;
-		}
+		return $this->item;
 	}
 
-	function get_label()
+	function get_title()
 	{
-		if ($this->label !== null)
-		{
-			return $this->label;
-		}
-		else
+		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
 		{
-			return $this->get_term();
+			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
 		}
-	}
-}
-
-class SimplePie_Enclosure
-{
-	var $bitrate;
-	var $captions;
-	var $categories;
-	var $channels;
-	var $copyright;
-	var $credits;
-	var $description;
-	var $duration;
-	var $expression;
-	var $framerate;
-	var $handler;
-	var $hashes;
-	var $height;
-	var $javascript;
-	var $keywords;
-	var $lang;
-	var $length;
-	var $link;
-	var $medium;
-	var $player;
-	var $ratings;
-	var $restrictions;
-	var $samplingrate;
-	var $thumbnails;
-	var $title;
-	var $type;
-	var $width;
-
-	// Constructor, used to input the data
-	function SimplePie_Enclosure($link = null, $type = null, $length = null, $javascript = null, $bitrate = null, $captions = null, $categories = null, $channels = null, $copyright = null, $credits = null, $description = null, $duration = null, $expression = null, $framerate = null, $hashes = null, $height = null, $keywords = null, $lang = null, $medium = null, $player = null, $ratings = null, $restrictions = null, $samplingrate = null, $thumbnails = null, $title = null, $width = null)
-	{
-		$this->bitrate = $bitrate;
-		$this->captions = $captions;
-		$this->categories = $categories;
-		$this->channels = $channels;
-		$this->copyright = $copyright;
-		$this->credits = $credits;
-		$this->description = $description;
-		$this->duration = $duration;
-		$this->expression = $expression;
-		$this->framerate = $framerate;
-		$this->hashes = $hashes;
-		$this->height = $height;
-		$this->javascript = $javascript;
-		$this->keywords = $keywords;
-		$this->lang = $lang;
-		$this->length = $length;
-		$this->link = $link;
-		$this->medium = $medium;
-		$this->player = $player;
-		$this->ratings = $ratings;
-		$this->restrictions = $restrictions;
-		$this->samplingrate = $samplingrate;
-		$this->thumbnails = $thumbnails;
-		$this->title = $title;
-		$this->type = $type;
-		$this->width = $width;
-		if (class_exists('idna_convert'))
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
 		{
-			$idn = new idna_convert;
-			$parsed = SimplePie_Misc::parse_url($link);
-			$this->link = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
+			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
 		}
-		$this->handler = $this->get_handler(); // Needs to load last
-	}
-
-	function __toString()
-	{
-		// There is no $this->data here
-		return md5(serialize($this));
-	}
-
-	function get_bitrate()
-	{
-		if ($this->bitrate !== null)
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
 		{
-			return $this->bitrate;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 		}
-		else
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
 		{
-			return null;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 		}
-	}
-
-	function get_caption($key = 0)
-	{
-		$captions = $this->get_captions();
-		if (isset($captions[$key]))
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
 		{
-			return $captions[$key];
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 		}
-		else
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
 		{
-			return null;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
-	}
-
-	function get_captions()
-	{
-		if ($this->captions !== null)
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
 		{
-			return $this->captions;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
 		else
 		{
@@ -5371,46 +5821,54 @@ class SimplePie_Enclosure
 
 	function get_categories()
 	{
-		if ($this->categories !== null)
-		{
-			return $this->categories;
-		}
-		else
-		{
-			return null;
-		}
-	}
+		$categories = array();
 
-	function get_channels()
-	{
-		if ($this->channels !== null)
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
 		{
-			return $this->channels;
+			$term = null;
+			$scheme = null;
+			$label = null;
+			if (isset($category['attribs']['']['term']))
+			{
+				$term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($category['attribs']['']['scheme']))
+			{
+				$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($category['attribs']['']['label']))
+			{
+				$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			$categories[] = new $this->item->feed->category_class($term, $scheme, $label);
 		}
-		else
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
 		{
-			return null;
+			// This is really the label, but keep this as the term also for BC.
+			// Label will also work on retrieving because that falls back to term.
+			$term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			if (isset($category['attribs']['']['domain']))
+			{
+				$scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			else
+			{
+				$scheme = null;
+			}
+			$categories[] = new $this->item->feed->category_class($term, $scheme, null);
 		}
-	}
-
-	function get_copyright()
-	{
-		if ($this->copyright !== null)
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
 		{
-			return $this->copyright;
+			$categories[] = new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
 		}
-		else
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
 		{
-			return null;
+			$categories[] = new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
 		}
-	}
 
-	function get_credit($key = 0)
-	{
-		$credits = $this->get_credits();
-		if (isset($credits[$key]))
+		if (!empty($categories))
 		{
-			return $credits[$key];
+			return SimplePie_Misc::array_unique($categories);
 		}
 		else
 		{
@@ -5418,11 +5876,12 @@ class SimplePie_Enclosure
 		}
 	}
 
-	function get_credits()
+	function get_author($key = 0)
 	{
-		if ($this->credits !== null)
+		$authors = $this->get_authors();
+		if (isset($authors[$key]))
 		{
-			return $this->credits;
+			return $authors[$key];
 		}
 		else
 		{
@@ -5430,68 +5889,140 @@ class SimplePie_Enclosure
 		}
 	}
 
-	function get_description()
+	function get_authors()
 	{
-		if ($this->description !== null)
-		{
-			return $this->description;
-		}
-		else
+		$authors = array();
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
 		{
-			return null;
+			$name = null;
+			$uri = null;
+			$email = null;
+			if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
+			{
+				$name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
+			{
+				$uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
+			}
+			if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
+			{
+				$email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if ($name !== null || $email !== null || $uri !== null)
+			{
+				$authors[] = new $this->item->feed->author_class($name, $uri, $email);
+			}
 		}
-	}
-
-	function get_duration($convert = false)
-	{
-		if ($this->duration !== null)
+		if ($author = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
 		{
-			if ($convert)
+			$name = null;
+			$url = null;
+			$email = null;
+			if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
 			{
-				$time = SimplePie_Misc::time_hms($this->duration);
-				return $time;
+				$name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 			}
-			else
+			if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
 			{
-				return $this->duration;
+				$url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
+			}
+			if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
+			{
+				$email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if ($name !== null || $email !== null || $url !== null)
+			{
+				$authors[] = new $this->item->feed->author_class($name, $url, $email);
 			}
 		}
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
+		{
+			$authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+		}
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
+		{
+			$authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+		}
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
+		{
+			$authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+		}
+
+		if (!empty($authors))
+		{
+			return SimplePie_Misc::array_unique($authors);
+		}
 		else
 		{
 			return null;
 		}
 	}
 
-	function get_expression()
+	function get_contributor($key = 0)
 	{
-		if ($this->expression !== null)
+		$contributors = $this->get_contributors();
+		if (isset($contributors[$key]))
 		{
-			return $this->expression;
+			return $contributors[$key];
 		}
 		else
 		{
-			return 'full';
+			return null;
 		}
 	}
 
-	function get_extension()
+	function get_contributors()
 	{
-		if ($this->link !== null)
+		$contributors = array();
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
 		{
-			$url = SimplePie_Misc::parse_url($this->link);
-			if ($url['path'] !== '')
+			$name = null;
+			$uri = null;
+			$email = null;
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
 			{
-				return pathinfo($url['path'], PATHINFO_EXTENSION);
+				$name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
+			{
+				$uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
+			{
+				$email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if ($name !== null || $email !== null || $uri !== null)
+			{
+				$contributors[] = new $this->item->feed->author_class($name, $uri, $email);
+			}
+		}
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
+		{
+			$name = null;
+			$url = null;
+			$email = null;
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
+			{
+				$name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
+			{
+				$url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
+			{
+				$email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if ($name !== null || $email !== null || $url !== null)
+			{
+				$contributors[] = new $this->item->feed->author_class($name, $url, $email);
 			}
 		}
-		return null;
-	}
 
-	function get_framerate()
-	{
-		if ($this->framerate !== null)
+		if (!empty($contributors))
 		{
-			return $this->framerate;
+			return SimplePie_Misc::array_unique($contributors);
 		}
 		else
 		{
@@ -5499,17 +6030,12 @@ class SimplePie_Enclosure
 		}
 	}
 
-	function get_handler()
-	{
-		return $this->get_real_type(true);
-	}
-
-	function get_hash($key = 0)
+	function get_link($key = 0, $rel = 'alternate')
 	{
-		$hashes = $this->get_hashes();
-		if (isset($hashes[$key]))
+		$links = $this->get_links($rel);
+		if (isset($links[$key]))
 		{
-			return $hashes[$key];
+			return $links[$key];
 		}
 		else
 		{
@@ -5517,11 +6043,81 @@ class SimplePie_Enclosure
 		}
 	}
 
-	function get_hashes()
+	/**
+	 * Added for parity between the parent-level and the item/entry-level.
+	 */
+	function get_permalink()
 	{
-		if ($this->hashes !== null)
+		return $this->get_link(0);
+	}
+
+	function get_links($rel = 'alternate')
+	{
+		if (!isset($this->data['links']))
 		{
-			return $this->hashes;
+			$this->data['links'] = array();
+			if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link'))
+			{
+				foreach ($links as $link)
+				{
+					if (isset($link['attribs']['']['href']))
+					{
+						$link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
+						$this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
+					}
+				}
+			}
+			if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link'))
+			{
+				foreach ($links as $link)
+				{
+					if (isset($link['attribs']['']['href']))
+					{
+						$link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
+						$this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
+
+					}
+				}
+			}
+			if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))
+			{
+				$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
+			}
+			if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
+			{
+				$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
+			}
+			if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
+			{
+				$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
+			}
+
+			$keys = array_keys($this->data['links']);
+			foreach ($keys as $key)
+			{
+				if (SimplePie_Misc::is_isegment_nz_nc($key))
+				{
+					if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
+					{
+						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
+						$this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
+					}
+					else
+					{
+						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
+					}
+				}
+				elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
+				{
+					$this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
+				}
+				$this->data['links'][$key] = array_unique($this->data['links'][$key]);
+			}
+		}
+
+		if (isset($this->data['links'][$rel]))
+		{
+			return $this->data['links'][$rel];
 		}
 		else
 		{
@@ -5529,60 +6125,43 @@ class SimplePie_Enclosure
 		}
 	}
 
-	function get_height()
+	function get_description()
 	{
-		if ($this->height !== null)
+		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
 		{
-			return $this->height;
+			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
 		}
-		else
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline'))
 		{
-			return null;
+			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
 		}
-	}
-
-	function get_language()
-	{
-		if ($this->lang !== null)
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
 		{
-			return $this->lang;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 		}
-		else
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
 		{
-			return null;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 		}
-	}
-
-	function get_keyword($key = 0)
-	{
-		$keywords = $this->get_keywords();
-		if (isset($keywords[$key]))
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
 		{
-			return $keywords[$key];
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 		}
-		else
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
 		{
-			return null;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
-	}
-
-	function get_keywords()
-	{
-		if ($this->keywords !== null)
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
 		{
-			return $this->keywords;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
-		else
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
 		{
-			return null;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
 		}
-	}
-
-	function get_length()
-	{
-		if ($this->length !== null)
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
 		{
-			return $this->length;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
 		}
 		else
 		{
@@ -5590,35 +6169,27 @@ class SimplePie_Enclosure
 		}
 	}
 
-	function get_link()
+	function get_copyright()
 	{
-		if ($this->link !== null)
+		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
 		{
-			return urldecode($this->link);
+			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
 		}
-		else
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
 		{
-			return null;
+			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
 		}
-	}
-
-	function get_medium()
-	{
-		if ($this->medium !== null)
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright'))
 		{
-			return $this->medium;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
-		else
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
 		{
-			return null;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
-	}
-
-	function get_player()
-	{
-		if ($this->player !== null)
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
 		{
-			return $this->player;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
 		else
 		{
@@ -5626,12 +6197,23 @@ class SimplePie_Enclosure
 		}
 	}
 
-	function get_rating($key = 0)
+	function get_language()
 	{
-		$ratings = $this->get_ratings();
-		if (isset($ratings[$key]))
+		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language'))
 		{
-			return $ratings[$key];
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+		}
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language'))
+		{
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+		}
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language'))
+		{
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+		}
+		elseif (isset($this->data['xml_lang']))
+		{
+			return $this->sanitize($this->data['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
 		else
 		{
@@ -5639,11 +6221,15 @@ class SimplePie_Enclosure
 		}
 	}
 
-	function get_ratings()
+	function get_latitude()
 	{
-		if ($this->ratings !== null)
+		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
 		{
-			return $this->ratings;
+			return (float) $return[0]['data'];
+		}
+		elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
+		{
+			return (float) $match[1];
 		}
 		else
 		{
@@ -5651,12 +6237,19 @@ class SimplePie_Enclosure
 		}
 	}
 
-	function get_restriction($key = 0)
+	function get_longitude()
 	{
-		$restrictions = $this->get_restrictions();
-		if (isset($restrictions[$key]))
+		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
 		{
-			return $restrictions[$key];
+			return (float) $return[0]['data'];
+		}
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
+		{
+			return (float) $return[0]['data'];
+		}
+		elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
+		{
+			return (float) $match[2];
 		}
 		else
 		{
@@ -5664,23 +6257,52 @@ class SimplePie_Enclosure
 		}
 	}
 
-	function get_restrictions()
+	function get_image_url()
 	{
-		if ($this->restrictions !== null)
+		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image'))
 		{
-			return $this->restrictions;
+			return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI);
+		}
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo'))
+		{
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
+		}
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon'))
+		{
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
 		}
 		else
 		{
 			return null;
 		}
 	}
+}
 
-	function get_sampling_rate()
+class SimplePie_Author
+{
+	var $name;
+	var $link;
+	var $email;
+
+	// Constructor, used to input the data
+	function SimplePie_Author($name = null, $link = null, $email = null)
 	{
-		if ($this->samplingrate !== null)
+		$this->name = $name;
+		$this->link = $link;
+		$this->email = $email;
+	}
+
+	function __toString()
+	{
+		// There is no $this->data here
+		return md5(serialize($this));
+	}
+
+	function get_name()
+	{
+		if ($this->name !== null)
 		{
-			return $this->samplingrate;
+			return $this->name;
 		}
 		else
 		{
@@ -5688,12 +6310,11 @@ class SimplePie_Enclosure
 		}
 	}
 
-	function get_size()
+	function get_link()
 	{
-		$length = $this->get_length();
-		if ($length !== null)
+		if ($this->link !== null)
 		{
-			return round($length/1048576, 2);
+			return $this->link;
 		}
 		else
 		{
@@ -5701,24 +6322,44 @@ class SimplePie_Enclosure
 		}
 	}
 
-	function get_thumbnail($key = 0)
+	function get_email()
 	{
-		$thumbnails = $this->get_thumbnails();
-		if (isset($thumbnails[$key]))
+		if ($this->email !== null)
 		{
-			return $thumbnails[$key];
+			return $this->email;
 		}
 		else
 		{
 			return null;
 		}
 	}
+}
 
-	function get_thumbnails()
+class SimplePie_Category
+{
+	var $term;
+	var $scheme;
+	var $label;
+
+	// Constructor, used to input the data
+	function SimplePie_Category($term = null, $scheme = null, $label = null)
 	{
-		if ($this->thumbnails !== null)
+		$this->term = $term;
+		$this->scheme = $scheme;
+		$this->label = $label;
+	}
+
+	function __toString()
+	{
+		// There is no $this->data here
+		return md5(serialize($this));
+	}
+
+	function get_term()
+	{
+		if ($this->term !== null)
 		{
-			return $this->thumbnails;
+			return $this->term;
 		}
 		else
 		{
@@ -5726,11 +6367,11 @@ class SimplePie_Enclosure
 		}
 	}
 
-	function get_title()
+	function get_scheme()
 	{
-		if ($this->title !== null)
+		if ($this->scheme !== null)
 		{
-			return $this->title;
+			return $this->scheme;
 		}
 		else
 		{
@@ -5738,23 +6379,98 @@ class SimplePie_Enclosure
 		}
 	}
 
-	function get_type()
+	function get_label()
 	{
-		if ($this->type !== null)
+		if ($this->label !== null)
 		{
-			return $this->type;
+			return $this->label;
 		}
 		else
 		{
-			return null;
+			return $this->get_term();
 		}
 	}
+}
 
-	function get_width()
+class SimplePie_Enclosure
+{
+	var $bitrate;
+	var $captions;
+	var $categories;
+	var $channels;
+	var $copyright;
+	var $credits;
+	var $description;
+	var $duration;
+	var $expression;
+	var $framerate;
+	var $handler;
+	var $hashes;
+	var $height;
+	var $javascript;
+	var $keywords;
+	var $lang;
+	var $length;
+	var $link;
+	var $medium;
+	var $player;
+	var $ratings;
+	var $restrictions;
+	var $samplingrate;
+	var $thumbnails;
+	var $title;
+	var $type;
+	var $width;
+
+	// Constructor, used to input the data
+	function SimplePie_Enclosure($link = null, $type = null, $length = null, $javascript = null, $bitrate = null, $captions = null, $categories = null, $channels = null, $copyright = null, $credits = null, $description = null, $duration = null, $expression = null, $framerate = null, $hashes = null, $height = null, $keywords = null, $lang = null, $medium = null, $player = null, $ratings = null, $restrictions = null, $samplingrate = null, $thumbnails = null, $title = null, $width = null)
 	{
-		if ($this->width !== null)
+		$this->bitrate = $bitrate;
+		$this->captions = $captions;
+		$this->categories = $categories;
+		$this->channels = $channels;
+		$this->copyright = $copyright;
+		$this->credits = $credits;
+		$this->description = $description;
+		$this->duration = $duration;
+		$this->expression = $expression;
+		$this->framerate = $framerate;
+		$this->hashes = $hashes;
+		$this->height = $height;
+		$this->javascript = $javascript;
+		$this->keywords = $keywords;
+		$this->lang = $lang;
+		$this->length = $length;
+		$this->link = $link;
+		$this->medium = $medium;
+		$this->player = $player;
+		$this->ratings = $ratings;
+		$this->restrictions = $restrictions;
+		$this->samplingrate = $samplingrate;
+		$this->thumbnails = $thumbnails;
+		$this->title = $title;
+		$this->type = $type;
+		$this->width = $width;
+		if (class_exists('idna_convert'))
 		{
-			return $this->width;
+			$idn = new idna_convert;
+			$parsed = SimplePie_Misc::parse_url($link);
+			$this->link = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
+		}
+		$this->handler = $this->get_handler(); // Needs to load last
+	}
+
+	function __toString()
+	{
+		// There is no $this->data here
+		return md5(serialize($this));
+	}
+
+	function get_bitrate()
+	{
+		if ($this->bitrate !== null)
+		{
+			return $this->bitrate;
 		}
 		else
 		{
@@ -5762,471 +6478,185 @@ class SimplePie_Enclosure
 		}
 	}
 
-	function native_embed($options='')
+	function get_caption($key = 0)
 	{
-		return $this->embed($options, true);
+		$captions = $this->get_captions();
+		if (isset($captions[$key]))
+		{
+			return $captions[$key];
+		}
+		else
+		{
+			return null;
+		}
 	}
 
-	/**
-	 * @todo If the dimensions for media:content are defined, use them when width/height are set to 'auto'.
-	 */
-	function embed($options = '', $native = false)
+	function get_captions()
 	{
-		// Set up defaults
-		$audio = '';
-		$video = '';
-		$alt = '';
-		$altclass = '';
-		$loop = 'false';
-		$width = 'auto';
-		$height = 'auto';
-		$bgcolor = '#ffffff';
-		$mediaplayer = '';
-		$widescreen = false;
-		$handler = $this->get_handler();
-		$type = $this->get_real_type();
-
-		// Process options and reassign values as necessary
-		if (is_array($options))
+		if ($this->captions !== null)
 		{
-			extract($options);
+			return $this->captions;
 		}
 		else
 		{
-			$options = explode(',', $options);
-			foreach($options as $option)
-			{
-				$opt = explode(':', $option, 2);
-				if (isset($opt[0], $opt[1]))
-				{
-					$opt[0] = trim($opt[0]);
-					$opt[1] = trim($opt[1]);
-					switch ($opt[0])
-					{
-						case 'audio':
-							$audio = $opt[1];
-							break;
+			return null;
+		}
+	}
 
-						case 'video':
-							$video = $opt[1];
-							break;
-
-						case 'alt':
-							$alt = $opt[1];
-							break;
-
-						case 'altclass':
-							$altclass = $opt[1];
-							break;
-
-						case 'loop':
-							$loop = $opt[1];
-							break;
-
-						case 'width':
-							$width = $opt[1];
-							break;
-
-						case 'height':
-							$height = $opt[1];
-							break;
-
-						case 'bgcolor':
-							$bgcolor = $opt[1];
-							break;
-
-						case 'mediaplayer':
-							$mediaplayer = $opt[1];
-							break;
-
-						case 'widescreen':
-							$widescreen = $opt[1];
-							break;
-					}
-				}
-			}
+	function get_category($key = 0)
+	{
+		$categories = $this->get_categories();
+		if (isset($categories[$key]))
+		{
+			return $categories[$key];
 		}
-
-		$mime = explode('/', $type, 2);
-		$mime = $mime[0];
-
-		// Process values for 'auto'
-		if ($width == 'auto')
+		else
 		{
-			if ($mime == 'video')
-			{
-				if ($height == 'auto')
-				{
-					$width = 480;
-				}
-				elseif ($widescreen)
-				{
-					$width = round((intval($height)/9)*16);
-				}
-				else
-				{
-					$width = round((intval($height)/3)*4);
-				}
-			}
-			else
-			{
-				$width = '100%';
-			}
+			return null;
 		}
+	}
 
-		if ($height == 'auto')
+	function get_categories()
+	{
+		if ($this->categories !== null)
 		{
-			if ($mime == 'audio')
-			{
-				$height = 0;
-			}
-			elseif ($mime == 'video')
-			{
-				if ($width == 'auto')
-				{
-					if ($widescreen)
-					{
-						$height = 270;
-					}
-					else
-					{
-						$height = 360;
-					}
-				}
-				elseif ($widescreen)
-				{
-					$height = round((intval($width)/16)*9);
-				}
-				else
-				{
-					$height = round((intval($width)/4)*3);
-				}
-			}
-			else
-			{
-				$height = 376;
-			}
+			return $this->categories;
 		}
-		elseif ($mime == 'audio')
+		else
 		{
-			$height = 0;
+			return null;
 		}
+	}
 
-		// Set proper placeholder value
-		if ($mime == 'audio')
+	function get_channels()
+	{
+		if ($this->channels !== null)
 		{
-			$placeholder = $audio;
+			return $this->channels;
 		}
-		elseif ($mime == 'video')
+		else
 		{
-			$placeholder = $video;
+			return null;
 		}
+	}
 
-		$embed = '';
-
-		// Make sure the JS library is included
-		if (!$native)
+	function get_copyright()
+	{
+		if ($this->copyright !== null)
 		{
-			static $javascript_outputted = null;
-			if (!$javascript_outputted && $this->javascript)
-			{
-				$embed .= '<script type="text/javascript" src="?' . htmlspecialchars($this->javascript) . '"></script>';
-				$javascript_outputted = true;
-			}
+			return $this->copyright;
 		}
-
-		// Odeo Feed MP3's
-		if ($handler == 'odeo')
+		else
 		{
-			if ($native)
-			{
-				$embed .= '<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://adobe.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url=' . $this->get_link() . '"></embed>';
-			}
-			else
-			{
-				$embed .= '<script type="text/javascript">embed_odeo("' . $this->get_link() . '");</script>';
-			}
+			return null;
 		}
+	}
 
-		// Flash
-		elseif ($handler == 'flash')
+	function get_credit($key = 0)
+	{
+		$credits = $this->get_credits();
+		if (isset($credits[$key]))
 		{
-			if ($native)
-			{
-				$embed .= "<embed src=\"" . $this->get_link() . "\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"$type\" quality=\"high\" width=\"$width\" height=\"$height\" bgcolor=\"$bgcolor\" loop=\"$loop\"></embed>";
-			}
-			else
-			{
-				$embed .= "<script type='text/javascript'>embed_flash('$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$loop', '$type');</script>";
-			}
+			return $credits[$key];
+		}
+		else
+		{
+			return null;
 		}
+	}
 
-		// Flash Media Player file types.
-		// Preferred handler for MP3 file types.
-		elseif ($handler == 'fmedia' || ($handler == 'mp3' && $mediaplayer != ''))
+	function get_credits()
+	{
+		if ($this->credits !== null)
 		{
-			$height += 20;
-			if ($native)
-			{
-				$embed .= "<embed src=\"$mediaplayer\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" width=\"$width\" height=\"$height\" wmode=\"transparent\" flashvars=\"file=" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\"></embed>";
-			}
-			else
-			{
-				$embed .= "<script type='text/javascript'>embed_flv('$width', '$height', '" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "', '$placeholder', '$loop', '$mediaplayer');</script>";
-			}
+			return $this->credits;
+		}
+		else
+		{
+			return null;
 		}
+	}
 
-		// QuickTime 7 file types.  Need to test with QuickTime 6.
-		// Only handle MP3's if the Flash Media Player is not present.
-		elseif ($handler == 'quicktime' || ($handler == 'mp3' && $mediaplayer == ''))
+	function get_description()
+	{
+		if ($this->description !== null)
 		{
-			$height += 16;
-			if ($native)
-			{
-				if ($placeholder != ""){
-					$embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" href=\"" . $this->get_link() . "\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
-				}
-				else {
-					$embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" src=\"" . $this->get_link() . "\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
-				}
-			}
-			else
-			{
-				$embed .= "<script type='text/javascript'>embed_quicktime('$type', '$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$placeholder', '$loop');</script>";
-			}
+			return $this->description;
+		}
+		else
+		{
+			return null;
 		}
+	}
 
-		// Windows Media
-		elseif ($handler == 'wmedia')
+	function get_duration($convert = false)
+	{
+		if ($this->duration !== null)
 		{
-			$height += 45;
-			if ($native)
+			if ($convert)
 			{
-				$embed .= "<embed type=\"application/x-mplayer2\" src=\"" . $this->get_link() . "\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\"></embed>";
+				$time = SimplePie_Misc::time_hms($this->duration);
+				return $time;
 			}
 			else
 			{
-				$embed .= "<script type='text/javascript'>embed_wmedia('$width', '$height', '" . $this->get_link() . "');</script>";
+				return $this->duration;
 			}
 		}
-
-		// Everything else
-		else $embed .= '<a href="' . $this->get_link() . '" class="' . $altclass . '">' . $alt . '</a>';
-
-		return $embed;
-	}
-
-	function get_real_type($find_handler = false)
-	{
-		// If it's Odeo, let's get it out of the way.
-		if (substr(strtolower($this->get_link()), 0, 15) == 'http://odeo.com')
+		else
 		{
-			return 'odeo';
+			return null;
 		}
+	}
 
-		// Mime-types by handler.
-		$types_flash = array('application/x-shockwave-flash', 'application/futuresplash'); // Flash
-		$types_fmedia = array('video/flv', 'video/x-flv'); // Flash Media Player
-		$types_quicktime = array('audio/3gpp', 'audio/3gpp2', 'audio/aac', 'audio/x-aac', 'audio/aiff', 'audio/x-aiff', 'audio/mid', 'audio/midi', 'audio/x-midi', 'audio/mp4', 'audio/m4a', 'audio/x-m4a', 'audio/wav', 'audio/x-wav', 'video/3gpp', 'video/3gpp2', 'video/m4v', 'video/x-m4v', 'video/mp4', 'video/mpeg', 'video/x-mpeg', 'video/quicktime', 'video/sd-video'); // QuickTime
-		$types_wmedia = array('application/asx', 'application/x-mplayer2', 'audio/x-ms-wma', 'audio/x-ms-wax', 'video/x-ms-asf-plugin', 'video/x-ms-asf', 'video/x-ms-wm', 'video/x-ms-wmv', 'video/x-ms-wvx'); // Windows Media
-		$types_mp3 = array('audio/mp3', 'audio/x-mp3', 'audio/mpeg', 'audio/x-mpeg'); // MP3
-
-		if ($this->get_type() !== null)
+	function get_expression()
+	{
+		if ($this->expression !== null)
 		{
-			$type = strtolower($this->type);
+			return $this->expression;
 		}
 		else
 		{
-			$type = null;
+			return 'full';
 		}
+	}
 
-		// If we encounter an unsupported mime-type, check the file extension and guess intelligently.
-		if (!in_array($type, array_merge($types_flash, $types_fmedia, $types_quicktime, $types_wmedia, $types_mp3)))
+	function get_extension()
+	{
+		if ($this->link !== null)
 		{
-			switch (strtolower($this->get_extension()))
+			$url = SimplePie_Misc::parse_url($this->link);
+			if ($url['path'] !== '')
 			{
-				// Audio mime-types
-				case 'aac':
-				case 'adts':
-					$type = 'audio/acc';
-					break;
-
-				case 'aif':
-				case 'aifc':
-				case 'aiff':
-				case 'cdda':
-					$type = 'audio/aiff';
-					break;
-
-				case 'bwf':
-					$type = 'audio/wav';
-					break;
-
-				case 'kar':
-				case 'mid':
-				case 'midi':
-				case 'smf':
-					$type = 'audio/midi';
-					break;
-
-				case 'm4a':
-					$type = 'audio/x-m4a';
-					break;
-
-				case 'mp3':
-				case 'swa':
-					$type = 'audio/mp3';
-					break;
-
-				case 'wav':
-					$type = 'audio/wav';
-					break;
-
-				case 'wax':
-					$type = 'audio/x-ms-wax';
-					break;
-
-				case 'wma':
-					$type = 'audio/x-ms-wma';
-					break;
-
-				// Video mime-types
-				case '3gp':
-				case '3gpp':
-					$type = 'video/3gpp';
-					break;
-
-				case '3g2':
-				case '3gp2':
-					$type = 'video/3gpp2';
-					break;
-
-				case 'asf':
-					$type = 'video/x-ms-asf';
-					break;
-
-				case 'flv':
-					$type = 'video/x-flv';
-					break;
-
-				case 'm1a':
-				case 'm1s':
-				case 'm1v':
-				case 'm15':
-				case 'm75':
-				case 'mp2':
-				case 'mpa':
-				case 'mpeg':
-				case 'mpg':
-				case 'mpm':
-				case 'mpv':
-					$type = 'video/mpeg';
-					break;
-
-				case 'm4v':
-					$type = 'video/x-m4v';
-					break;
-
-				case 'mov':
-				case 'qt':
-					$type = 'video/quicktime';
-					break;
-
-				case 'mp4':
-				case 'mpg4':
-					$type = 'video/mp4';
-					break;
-
-				case 'sdv':
-					$type = 'video/sd-video';
-					break;
-
-				case 'wm':
-					$type = 'video/x-ms-wm';
-					break;
-
-				case 'wmv':
-					$type = 'video/x-ms-wmv';
-					break;
-
-				case 'wvx':
-					$type = 'video/x-ms-wvx';
-					break;
-
-				// Flash mime-types
-				case 'spl':
-					$type = 'application/futuresplash';
-					break;
-
-				case 'swf':
-					$type = 'application/x-shockwave-flash';
-					break;
+				return pathinfo($url['path'], PATHINFO_EXTENSION);
 			}
 		}
+		return null;
+	}
 
-		if ($find_handler)
+	function get_framerate()
+	{
+		if ($this->framerate !== null)
 		{
-			if (in_array($type, $types_flash))
-			{
-				return 'flash';
-			}
-			elseif (in_array($type, $types_fmedia))
-			{
-				return 'fmedia';
-			}
-			elseif (in_array($type, $types_quicktime))
-			{
-				return 'quicktime';
-			}
-			elseif (in_array($type, $types_wmedia))
-			{
-				return 'wmedia';
-			}
-			elseif (in_array($type, $types_mp3))
-			{
-				return 'mp3';
-			}
-			else
-			{
-				return null;
-			}
+			return $this->framerate;
 		}
 		else
 		{
-			return $type;
+			return null;
 		}
 	}
-}
-
-class SimplePie_Caption
-{
-	var $type;
-	var $lang;
-	var $startTime;
-	var $endTime;
-	var $text;
-
-	// Constructor, used to input the data
-	function SimplePie_Caption($type = null, $lang = null, $startTime = null, $endTime = null, $text = null)
-	{
-		$this->type = $type;
-		$this->lang = $lang;
-		$this->startTime = $startTime;
-		$this->endTime = $endTime;
-		$this->text = $text;
-	}
 
-	function __toString()
+	function get_handler()
 	{
-		// There is no $this->data here
-		return md5(serialize($this));
+		return $this->get_real_type(true);
 	}
 
-	function get_endtime()
+	function get_hash($key = 0)
 	{
-		if ($this->endTime !== null)
+		$hashes = $this->get_hashes();
+		if (isset($hashes[$key]))
 		{
-			return $this->endTime;
+			return $hashes[$key];
 		}
 		else
 		{
@@ -6234,11 +6664,11 @@ class SimplePie_Caption
 		}
 	}
 
-	function get_language()
+	function get_hashes()
 	{
-		if ($this->language !== null)
+		if ($this->hashes !== null)
 		{
-			return $this->language;
+			return $this->hashes;
 		}
 		else
 		{
@@ -6246,11 +6676,11 @@ class SimplePie_Caption
 		}
 	}
 
-	function get_starttime()
+	function get_height()
 	{
-		if ($this->startTime !== null)
+		if ($this->height !== null)
 		{
-			return $this->startTime;
+			return $this->height;
 		}
 		else
 		{
@@ -6258,11 +6688,11 @@ class SimplePie_Caption
 		}
 	}
 
-	function get_text()
+	function get_language()
 	{
-		if ($this->text !== null)
+		if ($this->lang !== null)
 		{
-			return $this->text;
+			return $this->lang;
 		}
 		else
 		{
@@ -6270,44 +6700,48 @@ class SimplePie_Caption
 		}
 	}
 
-	function get_type()
+	function get_keyword($key = 0)
 	{
-		if ($this->type !== null)
+		$keywords = $this->get_keywords();
+		if (isset($keywords[$key]))
 		{
-			return $this->type;
+			return $keywords[$key];
 		}
 		else
 		{
 			return null;
 		}
 	}
-}
 
-class SimplePie_Credit
-{
-	var $role;
-	var $scheme;
-	var $name;
-
-	// Constructor, used to input the data
-	function SimplePie_Credit($role = null, $scheme = null, $name = null)
+	function get_keywords()
 	{
-		$this->role = $role;
-		$this->scheme = $scheme;
-		$this->name = $name;
+		if ($this->keywords !== null)
+		{
+			return $this->keywords;
+		}
+		else
+		{
+			return null;
+		}
 	}
 
-	function __toString()
+	function get_length()
 	{
-		// There is no $this->data here
-		return md5(serialize($this));
+		if ($this->length !== null)
+		{
+			return $this->length;
+		}
+		else
+		{
+			return null;
+		}
 	}
 
-	function get_role()
+	function get_link()
 	{
-		if ($this->role !== null)
+		if ($this->link !== null)
 		{
-			return $this->role;
+			return urldecode($this->link);
 		}
 		else
 		{
@@ -6315,11 +6749,11 @@ class SimplePie_Credit
 		}
 	}
 
-	function get_scheme()
+	function get_medium()
 	{
-		if ($this->scheme !== null)
+		if ($this->medium !== null)
 		{
-			return $this->scheme;
+			return $this->medium;
 		}
 		else
 		{
@@ -6327,42 +6761,24 @@ class SimplePie_Credit
 		}
 	}
 
-	function get_name()
+	function get_player()
 	{
-		if ($this->name !== null)
+		if ($this->player !== null)
 		{
-			return $this->name;
+			return $this->player;
 		}
 		else
 		{
 			return null;
 		}
 	}
-}
-
-class SimplePie_Copyright
-{
-	var $url;
-	var $label;
 
-	// Constructor, used to input the data
-	function SimplePie_Copyright($url = null, $label = null)
-	{
-		$this->url = $url;
-		$this->label = $label;
-	}
-
-	function __toString()
-	{
-		// There is no $this->data here
-		return md5(serialize($this));
-	}
-
-	function get_url()
+	function get_rating($key = 0)
 	{
-		if ($this->url !== null)
+		$ratings = $this->get_ratings();
+		if (isset($ratings[$key]))
 		{
-			return $this->url;
+			return $ratings[$key];
 		}
 		else
 		{
@@ -6370,42 +6786,48 @@ class SimplePie_Copyright
 		}
 	}
 
-	function get_attribution()
+	function get_ratings()
 	{
-		if ($this->label !== null)
+		if ($this->ratings !== null)
 		{
-			return $this->label;
+			return $this->ratings;
 		}
 		else
 		{
 			return null;
 		}
 	}
-}
-
-class SimplePie_Rating
-{
-	var $scheme;
-	var $value;
 
-	// Constructor, used to input the data
-	function SimplePie_Rating($scheme = null, $value = null)
+	function get_restriction($key = 0)
 	{
-		$this->scheme = $scheme;
-		$this->value = $value;
+		$restrictions = $this->get_restrictions();
+		if (isset($restrictions[$key]))
+		{
+			return $restrictions[$key];
+		}
+		else
+		{
+			return null;
+		}
 	}
 
-	function __toString()
+	function get_restrictions()
 	{
-		// There is no $this->data here
-		return md5(serialize($this));
+		if ($this->restrictions !== null)
+		{
+			return $this->restrictions;
+		}
+		else
+		{
+			return null;
+		}
 	}
 
-	function get_scheme()
+	function get_sampling_rate()
 	{
-		if ($this->scheme !== null)
+		if ($this->samplingrate !== null)
 		{
-			return $this->scheme;
+			return $this->samplingrate;
 		}
 		else
 		{
@@ -6413,44 +6835,49 @@ class SimplePie_Rating
 		}
 	}
 
-	function get_value()
+	function get_size()
 	{
-		if ($this->value !== null)
+		$length = $this->get_length();
+		if ($length !== null)
 		{
-			return $this->value;
+			return round($length/1048576, 2);
 		}
 		else
 		{
 			return null;
 		}
 	}
-}
 
-class SimplePie_Restriction
-{
-	var $relationship;
-	var $type;
-	var $value;
-
-	// Constructor, used to input the data
-	function SimplePie_Restriction($relationship = null, $type = null, $value = null)
+	function get_thumbnail($key = 0)
 	{
-		$this->relationship = $relationship;
-		$this->type = $type;
-		$this->value = $value;
+		$thumbnails = $this->get_thumbnails();
+		if (isset($thumbnails[$key]))
+		{
+			return $thumbnails[$key];
+		}
+		else
+		{
+			return null;
+		}
 	}
 
-	function __toString()
+	function get_thumbnails()
 	{
-		// There is no $this->data here
-		return md5(serialize($this));
+		if ($this->thumbnails !== null)
+		{
+			return $this->thumbnails;
+		}
+		else
+		{
+			return null;
+		}
 	}
 
-	function get_relationship()
+	function get_title()
 	{
-		if ($this->relationship !== null)
+		if ($this->title !== null)
 		{
-			return $this->relationship;
+			return $this->title;
 		}
 		else
 		{
@@ -6470,3352 +6897,6923 @@ class SimplePie_Restriction
 		}
 	}
 
-	function get_value()
+	function get_width()
 	{
-		if ($this->value !== null)
+		if ($this->width !== null)
 		{
-			return $this->value;
+			return $this->width;
 		}
 		else
 		{
 			return null;
 		}
 	}
-}
 
-/**
- * @todo Move to properly supporting RFC2616 (HTTP/1.1)
- */
-class SimplePie_File
-{
-	var $url;
-	var $useragent;
-	var $success = true;
-	var $headers = array();
-	var $body;
-	var $status_code;
-	var $redirects = 0;
-	var $error;
-	var $method;
+	function native_embed($options='')
+	{
+		return $this->embed($options, true);
+	}
 
-	function SimplePie_File($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false)
+	/**
+	 * @todo If the dimensions for media:content are defined, use them when width/height are set to 'auto'.
+	 */
+	function embed($options = '', $native = false)
 	{
-		if (class_exists('idna_convert'))
+		// Set up defaults
+		$audio = '';
+		$video = '';
+		$alt = '';
+		$altclass = '';
+		$loop = 'false';
+		$width = 'auto';
+		$height = 'auto';
+		$bgcolor = '#ffffff';
+		$mediaplayer = '';
+		$widescreen = false;
+		$handler = $this->get_handler();
+		$type = $this->get_real_type();
+
+		// Process options and reassign values as necessary
+		if (is_array($options))
 		{
-			$idn = new idna_convert;
-			$parsed = SimplePie_Misc::parse_url($url);
-			$url = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
+			extract($options);
 		}
-		$this->url = $url;
-		$this->useragent = $useragent;
-		if (preg_match('/^http(s)?:\/\//i', $url))
+		else
 		{
-			if ($useragent === null)
-			{
-				$useragent = ini_get('user_agent');
-				$this->useragent = $useragent;
-			}
-			if (!is_array($headers))
+			$options = explode(',', $options);
+			foreach($options as $option)
 			{
-				$headers = array();
+				$opt = explode(':', $option, 2);
+				if (isset($opt[0], $opt[1]))
+				{
+					$opt[0] = trim($opt[0]);
+					$opt[1] = trim($opt[1]);
+					switch ($opt[0])
+					{
+						case 'audio':
+							$audio = $opt[1];
+							break;
+
+						case 'video':
+							$video = $opt[1];
+							break;
+
+						case 'alt':
+							$alt = $opt[1];
+							break;
+
+						case 'altclass':
+							$altclass = $opt[1];
+							break;
+
+						case 'loop':
+							$loop = $opt[1];
+							break;
+
+						case 'width':
+							$width = $opt[1];
+							break;
+
+						case 'height':
+							$height = $opt[1];
+							break;
+
+						case 'bgcolor':
+							$bgcolor = $opt[1];
+							break;
+
+						case 'mediaplayer':
+							$mediaplayer = $opt[1];
+							break;
+
+						case 'widescreen':
+							$widescreen = $opt[1];
+							break;
+					}
+				}
 			}
-			if (!$force_fsockopen && extension_loaded('curl'))
+		}
+
+		$mime = explode('/', $type, 2);
+		$mime = $mime[0];
+
+		// Process values for 'auto'
+		if ($width === 'auto')
+		{
+			if ($mime === 'video')
 			{
-				$this->method = 'curl';
-				$fp = curl_init();
-				$headers2 = array();
-				foreach ($headers as $key => $value)
+				if ($height === 'auto')
 				{
-					$headers2[] = "$key: $value";
+					$width = 480;
 				}
-				if (version_compare(SimplePie_Misc::get_curl_version(), '7.10.5', '>='))
+				elseif ($widescreen)
 				{
-					curl_setopt($fp, CURLOPT_ENCODING, '');
+					$width = round((intval($height)/9)*16);
 				}
-				curl_setopt($fp, CURLOPT_URL, $url);
-				curl_setopt($fp, CURLOPT_HEADER, 1);
-				curl_setopt($fp, CURLOPT_RETURNTRANSFER, 1);
-				curl_setopt($fp, CURLOPT_TIMEOUT, $timeout);
-				curl_setopt($fp, CURLOPT_CONNECTTIMEOUT, $timeout);
-				curl_setopt($fp, CURLOPT_REFERER, $url);
-				curl_setopt($fp, CURLOPT_USERAGENT, $useragent);
-				curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2);
-				if (!ini_get('open_basedir') && !ini_get('safe_mode') && version_compare(SimplePie_Misc::get_curl_version(), '7.15.2', '>='))
+				else
 				{
-					curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1);
-					curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects);
-				}
-
-				$this->headers = curl_exec($fp);
-				if (curl_errno($fp) == 23 || curl_errno($fp) == 61)
-				{
-					curl_setopt($fp, CURLOPT_ENCODING, 'none');
-					$this->headers = curl_exec($fp);
-				}
-				if (curl_errno($fp))
-				{
-					$this->error = 'cURL error ' . curl_errno($fp) . ': ' . curl_error($fp);
-					$this->success = false;
-				}
-				else
-				{
-					$info = curl_getinfo($fp);
-					curl_close($fp);
-					$this->headers = explode("\r\n\r\n", $this->headers, $info['redirect_count'] + 1);
-					$this->headers = array_pop($this->headers);
-					$parser = new SimplePie_HTTP_Parser($this->headers);
-					if ($parser->parse())
-					{
-						$this->headers = $parser->headers;
-						$this->body = $parser->body;
-						$this->status_code = $parser->status_code;
-						if (($this->status_code == 300 || $this->status_code == 301 || $this->status_code == 302 || $this->status_code == 303 || $this->status_code == 307 || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects)
-						{
-							$this->redirects++;
-							if (isset($this->headers['content-location']))
-							{
-								$location = SimplePie_Misc::absolutize_url($this->headers['location'], SimplePie_Misc::absolutize_url($this->headers['content-location'], $url));
-							}
-							else
-							{
-								$location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
-							}
-							return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
-						}
-					}
+					$width = round((intval($height)/3)*4);
 				}
 			}
 			else
 			{
-				$this->method = 'fsockopen';
-				$url_parts = parse_url($url);
-				if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) == 'https')
-				{
-					$url_parts['host'] = "ssl://$url_parts[host]";
-					$url_parts['port'] = 443;
-				}
-				if (!isset($url_parts['port']))
-				{
-					$url_parts['port'] = 80;
-				}
-				$fp = fsockopen($url_parts['host'], $url_parts['port'], $errno, $errstr, $timeout);
-				if (!$fp)
-				{
-					$this->error = 'fsockopen error: ' . $errstr;
-					$this->success = false;
-				}
-				else
+				$width = '100%';
+			}
+		}
+
+		if ($height === 'auto')
+		{
+			if ($mime === 'audio')
+			{
+				$height = 0;
+			}
+			elseif ($mime === 'video')
+			{
+				if ($width === 'auto')
 				{
-					if (function_exists('stream_set_timeout'))
-					{
-						stream_set_timeout($fp, $timeout);
-					}
-					else
-					{
-						socket_set_timeout($fp, $timeout);
-					}
-					if (isset($url_parts['path']))
+					if ($widescreen)
 					{
-						if (isset($url_parts['query']))
-						{
-							$get = "$url_parts[path]?$url_parts[query]";
-						}
-						else
-						{
-							$get = $url_parts['path'];
-						}
+						$height = 270;
 					}
 					else
 					{
-						$get = '/';
-					}
-					$out = "GET $get HTTP/1.0\r\n";
-					$out .= "Host: $url_parts[host]\r\n";
-					$out .= "User-Agent: $useragent\r\n";
-					if (function_exists('gzinflate'))
-					{
-						$out .= "Accept-Encoding: gzip,deflate\r\n";
+						$height = 360;
 					}
+				}
+				elseif ($widescreen)
+				{
+					$height = round((intval($width)/16)*9);
+				}
+				else
+				{
+					$height = round((intval($width)/4)*3);
+				}
+			}
+			else
+			{
+				$height = 376;
+			}
+		}
+		elseif ($mime === 'audio')
+		{
+			$height = 0;
+		}
 
-					if (isset($url_parts['user']) && isset($url_parts['pass']))
-					{
-						$out .= "Authorization: Basic " . base64_encode("$url_parts[user]:$url_parts[pass]") . "\r\n";
-					}
-					foreach ($headers as $key => $value)
-					{
-						$out .= "$key: $value\r\n";
-					}
-					$out .= "Connection: Close\r\n\r\n";
-					fwrite($fp, $out);
+		// Set proper placeholder value
+		if ($mime === 'audio')
+		{
+			$placeholder = $audio;
+		}
+		elseif ($mime === 'video')
+		{
+			$placeholder = $video;
+		}
 
-					if (function_exists('stream_get_meta_data'))
-					{
-						$info = stream_get_meta_data($fp);
-					}
-					else
-					{
-						$info = socket_get_status($fp);
-					}
+		$embed = '';
 
-					$this->headers = '';
-					while (!$info['eof'] && !$info['timed_out'])
-					{
-						$this->headers .= fread($fp, 1160);
-						if (function_exists('stream_get_meta_data'))
-						{
-							$info = stream_get_meta_data($fp);
-						}
-						else
-						{
-							$info = socket_get_status($fp);
-						}
-					}
-					if (!$info['timed_out'])
-					{
-						$parser = new SimplePie_HTTP_Parser($this->headers);
-						if ($parser->parse())
-						{
-							$this->headers = $parser->headers;
-							$this->body = $parser->body;
-							$this->status_code = $parser->status_code;
-							if (($this->status_code == 300 || $this->status_code == 301 || $this->status_code == 302 || $this->status_code == 303 || $this->status_code == 307 || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects)
-							{
-								$this->redirects++;
-								if (isset($this->headers['content-location']))
-								{
-									$location = SimplePie_Misc::absolutize_url($this->headers['location'], SimplePie_Misc::absolutize_url($this->headers['content-location'], $url));
-								}
-								else
-								{
-									$location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
-								}
-								return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
-							}
-							if (isset($this->headers['content-encoding']) && ($this->headers['content-encoding'] == 'gzip' || $this->headers['content-encoding'] == 'deflate'))
-							{
-								if (substr($this->body, 0, 8) == "\x1f\x8b\x08\x00\x00\x00\x00\x00")
-								{
-									$this->body = substr($this->body, 10);
-								}
-								$this->body = gzinflate($this->body);
-							}
-						}
-					}
-					else
-					{
-						$this->error = 'fsocket timed out';
-						$this->success = false;
-					}
-					fclose($fp);
-				}
+		// Make sure the JS library is included
+		if (!$native)
+		{
+			static $javascript_outputted = null;
+			if (!$javascript_outputted && $this->javascript)
+			{
+				$embed .= '<script type="text/javascript" src="?' . htmlspecialchars($this->javascript) . '"></script>';
+				$javascript_outputted = true;
 			}
 		}
-		elseif (function_exists('file_get_contents'))
+
+		// Odeo Feed MP3's
+		if ($handler === 'odeo')
 		{
-			$this->method = 'file_get_contents';
-			if (!$this->body = file_get_contents($url))
+			if ($native)
 			{
-				$this->error = 'file_get_contents could not read the file';
-				$this->success = false;
+				$embed .= '<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://adobe.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url=' . $this->get_link() . '"></embed>';
+			}
+			else
+			{
+				$embed .= '<script type="text/javascript">embed_odeo("' . $this->get_link() . '");</script>';
 			}
 		}
-		else
+
+		// Flash
+		elseif ($handler === 'flash')
 		{
-			$this->method = 'fopen';
-			if (($fp = fopen($url, 'rb')) === false)
+			if ($native)
 			{
-				$this->error = 'failed to open stream: No such file or directory';
-				$this->success = false;
+				$embed .= "<embed src=\"" . $this->get_link() . "\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"$type\" quality=\"high\" width=\"$width\" height=\"$height\" bgcolor=\"$bgcolor\" loop=\"$loop\"></embed>";
+			}
+			else
+			{
+				$embed .= "<script type='text/javascript'>embed_flash('$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$loop', '$type');</script>";
+			}
+		}
+
+		// Flash Media Player file types.
+		// Preferred handler for MP3 file types.
+		elseif ($handler === 'fmedia' || ($handler === 'mp3' && $mediaplayer !== ''))
+		{
+			$height += 20;
+			if ($native)
+			{
+				$embed .= "<embed src=\"$mediaplayer\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" width=\"$width\" height=\"$height\" wmode=\"transparent\" flashvars=\"file=" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\"></embed>";
 			}
 			else
 			{
-				$this->body = '';
-				while (!feof($fp))
+				$embed .= "<script type='text/javascript'>embed_flv('$width', '$height', '" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "', '$placeholder', '$loop', '$mediaplayer');</script>";
+			}
+		}
+
+		// QuickTime 7 file types.  Need to test with QuickTime 6.
+		// Only handle MP3's if the Flash Media Player is not present.
+		elseif ($handler === 'quicktime' || ($handler === 'mp3' && $mediaplayer === ''))
+		{
+			$height += 16;
+			if ($native)
+			{
+				if ($placeholder !== '')
 				{
-					$this->body .= fread($fp, 8192);
+					$embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" href=\"" . $this->get_link() . "\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
+				}
+				else
+				{
+					$embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" src=\"" . $this->get_link() . "\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
 				}
-				fclose($fp);
+			}
+			else
+			{
+				$embed .= "<script type='text/javascript'>embed_quicktime('$type', '$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$placeholder', '$loop');</script>";
 			}
 		}
-	}
-}
 
-/**
- * HTTP Response Parser
- *
- * @package SimplePie
- * @todo Support HTTP Requests
- */
-class SimplePie_HTTP_Parser
-{
-	/**
-	 * HTTP Version
-	 *
-	 * @access public
-	 * @var string
-	 */
-	var $http_version = '';
+		// Windows Media
+		elseif ($handler === 'wmedia')
+		{
+			$height += 45;
+			if ($native)
+			{
+				$embed .= "<embed type=\"application/x-mplayer2\" src=\"" . $this->get_link() . "\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\"></embed>";
+			}
+			else
+			{
+				$embed .= "<script type='text/javascript'>embed_wmedia('$width', '$height', '" . $this->get_link() . "');</script>";
+			}
+		}
 
-	/**
-	 * Status code
-	 *
-	 * @access public
-	 * @var string
-	 */
-	var $status_code = '';
+		// Everything else
+		else $embed .= '<a href="' . $this->get_link() . '" class="' . $altclass . '">' . $alt . '</a>';
 
-	/**
-	 * Reason phrase
-	 *
-	 * @access public
-	 * @var string
-	 */
-	var $reason = '';
-
-	/**
-	 * Key/value pairs of the headers
-	 *
-	 * @access public
-	 * @var array
-	 */
-	var $headers = array();
-
-	/**
-	 * Body of the response
-	 *
-	 * @access public
-	 * @var string
-	 */
-	var $body = '';
-
-	/**
-	 * Current state of the state machine
-	 *
-	 * @access private
-	 * @var string
-	 */
-	var $state = 'start';
-
-	/**
-	 * Input data
-	 *
-	 * @access private
-	 * @var string
-	 */
-	var $data = '';
-
-	/**
-	 * Input data length (to avoid calling strlen() everytime this is needed)
-	 *
-	 * @access private
-	 * @var int
-	 */
-	var $data_length = 0;
-
-	/**
-	 * Current position of the pointer
-	 *
-	 * @access private
-	 * @var int
-	 */
-	var $position = 0;
-
-	/**
-	 * Name of the hedaer currently being parsed
-	 *
-	 * @access private
-	 * @var string
-	 */
-	var $name = '';
-
-	/**
-	 * Value of the hedaer currently being parsed
-	 *
-	 * @access private
-	 * @var string
-	 */
-	var $value = '';
-
-	/**
-	 * Create an instance of the class with the input data
-	 *
-	 * @access public
-	 * @param string $data Input data
-	 */
-	function SimplePie_HTTP_Parser($data)
-	{
-		$this->data = $data;
-		$this->data_length = strlen($this->data);
+		return $embed;
 	}
 
-	/**
-	 * Parse the input data
-	 *
-	 * @access public
-	 * @return bool true on success, false on failure
-	 */
-	function parse()
+	function get_real_type($find_handler = false)
 	{
-		while ($this->state && $this->state != 'emit' && $this->has_data())
-		{
-			$state = $this->state;
-			$this->$state();
-		}
-		$this->data = '';
-		if ($this->state == 'emit')
-		{
-			return true;
-		}
-		else
+		// If it's Odeo, let's get it out of the way.
+		if (substr(strtolower($this->get_link()), 0, 15) === 'http://odeo.com')
 		{
-			$this->http_version = '';
-			$this->status_code = '';
-			$this->headers = array();
-			$this->body = '';
-			return false;
+			return 'odeo';
 		}
-	}
-
-	/**
-	 * Check whether there is data beyond the pointer
-	 *
-	 * @access private
-	 * @return bool true if there is further data, false if not
-	 */
-	function has_data()
-	{
-		return (bool) ($this->position < $this->data_length);
-	}
-
-	/**
-	 * See if the next character is LWS
-	 *
-	 * @access private
-	 * @return bool true if the next character is LWS, false if not
-	 */
-	function is_linear_whitespace()
-	{
-		return (bool) (strspn($this->data, "\x09\x20", $this->position, 1)
-			|| (substr($this->data, $this->position, 2) == "\r\n" && strspn($this->data, "\x09\x20", $this->position + 2, 1))
-			|| (strspn($this->data, "\r\n", $this->position, 1) && strspn($this->data, "\x09\x20", $this->position + 1, 1)));
-	}
 
-	/**
-	 * The starting state of the state machine, see if the data is a response or request
-	 *
-	 * @access private
-	 */
-	function start()
-	{
-		$this->state = 'http_version_response';
-	}
+		// Mime-types by handler.
+		$types_flash = array('application/x-shockwave-flash', 'application/futuresplash'); // Flash
+		$types_fmedia = array('video/flv', 'video/x-flv','flv-application/octet-stream'); // Flash Media Player
+		$types_quicktime = array('audio/3gpp', 'audio/3gpp2', 'audio/aac', 'audio/x-aac', 'audio/aiff', 'audio/x-aiff', 'audio/mid', 'audio/midi', 'audio/x-midi', 'audio/mp4', 'audio/m4a', 'audio/x-m4a', 'audio/wav', 'audio/x-wav', 'video/3gpp', 'video/3gpp2', 'video/m4v', 'video/x-m4v', 'video/mp4', 'video/mpeg', 'video/x-mpeg', 'video/quicktime', 'video/sd-video'); // QuickTime
+		$types_wmedia = array('application/asx', 'application/x-mplayer2', 'audio/x-ms-wma', 'audio/x-ms-wax', 'video/x-ms-asf-plugin', 'video/x-ms-asf', 'video/x-ms-wm', 'video/x-ms-wmv', 'video/x-ms-wvx'); // Windows Media
+		$types_mp3 = array('audio/mp3', 'audio/x-mp3', 'audio/mpeg', 'audio/x-mpeg'); // MP3
 
-	/**
-	 * Parse an HTTP-version string
-	 *
-	 * @access private
-	 */
-	function http_version()
-	{
-		if (preg_match('/^HTTP\/([0-9]+\.[0-9]+)/i', substr($this->data, $this->position, strcspn($this->data, "\r\n", $this->position)), $match))
+		if ($this->get_type() !== null)
 		{
-			$this->position += strlen($match[0]);
-			$this->http_version = $match[1];
-			return true;
+			$type = strtolower($this->type);
 		}
 		else
 		{
-			return false;
+			$type = null;
 		}
-	}
 
-	/**
-	 * Parse LWS, replacing consecutive characters with a single space
-	 *
-	 * @access private
-	 */
-	function linear_whitespace()
-	{
-		do
+		// If we encounter an unsupported mime-type, check the file extension and guess intelligently.
+		if (!in_array($type, array_merge($types_flash, $types_fmedia, $types_quicktime, $types_wmedia, $types_mp3)))
 		{
-			if (substr($this->data, $this->position, 2) == "\r\n")
-			{
-				$this->position += 2;
-			}
-			elseif (strspn($this->data, "\r\n", $this->position, 1))
+			switch (strtolower($this->get_extension()))
 			{
-				$this->position++;
-			}
-			$this->position += strspn($this->data, "\x09\x20", $this->position);
-		} while ($this->is_linear_whitespace());
-		$this->value .= "\x20";
-	}
+				// Audio mime-types
+				case 'aac':
+				case 'adts':
+					$type = 'audio/acc';
+					break;
 
-	/**
-	 * Parse an HTTP-version string within a response
-	 *
-	 * @access private
-	 */
-	function http_version_response()
-	{
-		if ($this->http_version() && $this->data[$this->position] == "\x20")
-		{
-			$this->state = 'status_code';
-			$this->position++;
-		}
-		else
-		{
-			$this->state = false;
-		}
-	}
+				case 'aif':
+				case 'aifc':
+				case 'aiff':
+				case 'cdda':
+					$type = 'audio/aiff';
+					break;
 
-	/**
-	 * Parse a status code
-	 *
-	 * @access private
-	 */
-	function status_code()
-	{
-		if (strspn($this->data, '1234567890', $this->position, 3) == 3)
-		{
-			$this->status_code = substr($this->data, $this->position, 3);
-			$this->state = 'reason_phrase';
-			$this->position += 3;
-		}
-		else
-		{
-			$this->state = false;
-		}
-	}
+				case 'bwf':
+					$type = 'audio/wav';
+					break;
 
-	/**
-	 * Skip over the reason phrase (it has no normative value, and you can send absolutely anything here)
-	 *
-	 * @access private
-	 */
-	function reason_phrase()
-	{
-		$len = strcspn($this->data, "\r\n", $this->position);
-		$this->reason = substr($this->data, $this->position, $len);
-		$this->position += $len;
-		if ($this->has_data())
-		{
-			if (substr($this->data, $this->position, 2) == "\r\n")
-			{
-				$this->position += 2;
-			}
-			elseif (strspn($this->data, "\r\n", $this->position, 1))
-			{
-				$this->position++;
-			}
-			$this->state = 'name';
-		}
-	}
+				case 'kar':
+				case 'mid':
+				case 'midi':
+				case 'smf':
+					$type = 'audio/midi';
+					break;
 
-	/**
-	 * Parse a header name
-	 *
-	 * @access private
-	 */
-	function name()
-	{
-		$len = strcspn($this->data, ':', $this->position);
-		$this->name = substr($this->data, $this->position, $len);
-		$this->position += $len;
+				case 'm4a':
+					$type = 'audio/x-m4a';
+					break;
 
-		if ($this->has_data() && $this->data[$this->position] == ':')
-		{
-			$this->state = 'value_next';
-			$this->position++;
-		}
-		else
-		{
-			$this->state = false;
-		}
-	}
+				case 'mp3':
+				case 'swa':
+					$type = 'audio/mp3';
+					break;
 
-	/**
-	 * See what state to move the state machine to while within non-quoted header values
-	 *
-	 * @access private
-	 */
-	function value_next()
-	{
-		if ($this->is_linear_whitespace())
-		{
-			$this->state = 'value_linear_whitespace';
-		}
-		elseif ($this->data[$this->position] == '"')
-		{
-			$this->state = 'value_quote_next';
-			$this->position++;
-		}
-		elseif (substr($this->data, $this->position, 2) == "\r\n")
-		{
-			$this->state = 'end_crlf';
-			$this->position += 2;
+				case 'wav':
+					$type = 'audio/wav';
+					break;
+
+				case 'wax':
+					$type = 'audio/x-ms-wax';
+					break;
+
+				case 'wma':
+					$type = 'audio/x-ms-wma';
+					break;
+
+				// Video mime-types
+				case '3gp':
+				case '3gpp':
+					$type = 'video/3gpp';
+					break;
+
+				case '3g2':
+				case '3gp2':
+					$type = 'video/3gpp2';
+					break;
+
+				case 'asf':
+					$type = 'video/x-ms-asf';
+					break;
+
+				case 'flv':
+					$type = 'video/x-flv';
+					break;
+
+				case 'm1a':
+				case 'm1s':
+				case 'm1v':
+				case 'm15':
+				case 'm75':
+				case 'mp2':
+				case 'mpa':
+				case 'mpeg':
+				case 'mpg':
+				case 'mpm':
+				case 'mpv':
+					$type = 'video/mpeg';
+					break;
+
+				case 'm4v':
+					$type = 'video/x-m4v';
+					break;
+
+				case 'mov':
+				case 'qt':
+					$type = 'video/quicktime';
+					break;
+
+				case 'mp4':
+				case 'mpg4':
+					$type = 'video/mp4';
+					break;
+
+				case 'sdv':
+					$type = 'video/sd-video';
+					break;
+
+				case 'wm':
+					$type = 'video/x-ms-wm';
+					break;
+
+				case 'wmv':
+					$type = 'video/x-ms-wmv';
+					break;
+
+				case 'wvx':
+					$type = 'video/x-ms-wvx';
+					break;
+
+				// Flash mime-types
+				case 'spl':
+					$type = 'application/futuresplash';
+					break;
+
+				case 'swf':
+					$type = 'application/x-shockwave-flash';
+					break;
+			}
 		}
-		elseif (strspn($this->data, "\r\n", $this->position, 1))
+
+		if ($find_handler)
 		{
-			$this->state = 'end_crlf';
-			$this->position++;
+			if (in_array($type, $types_flash))
+			{
+				return 'flash';
+			}
+			elseif (in_array($type, $types_fmedia))
+			{
+				return 'fmedia';
+			}
+			elseif (in_array($type, $types_quicktime))
+			{
+				return 'quicktime';
+			}
+			elseif (in_array($type, $types_wmedia))
+			{
+				return 'wmedia';
+			}
+			elseif (in_array($type, $types_mp3))
+			{
+				return 'mp3';
+			}
+			else
+			{
+				return null;
+			}
 		}
 		else
 		{
-			$this->state = 'value_no_quote';
+			return $type;
 		}
 	}
+}
 
-	/**
-	 * Parse a header value while outside quotes
-	 *
-	 * @access private
-	 */
-	function value_no_quote()
+class SimplePie_Caption
+{
+	var $type;
+	var $lang;
+	var $startTime;
+	var $endTime;
+	var $text;
+
+	// Constructor, used to input the data
+	function SimplePie_Caption($type = null, $lang = null, $startTime = null, $endTime = null, $text = null)
 	{
-		$len = strcspn($this->data, "\x09\x20\r\n\"", $this->position);
-		$this->value .= substr($this->data, $this->position, $len);
-		$this->state = 'value_next';
-		$this->position += $len;
+		$this->type = $type;
+		$this->lang = $lang;
+		$this->startTime = $startTime;
+		$this->endTime = $endTime;
+		$this->text = $text;
 	}
 
-	/**
-	 * Parse LWS outside quotes
-	 *
-	 * @access private
-	 */
-	function value_linear_whitespace()
+	function __toString()
 	{
-		$this->linear_whitespace();
-		$this->state = 'value_next';
+		// There is no $this->data here
+		return md5(serialize($this));
 	}
 
-	/**
-	 * See what state to move the state machine to while within quoted header values
-	 *
-	 * @access private
-	 */
-	function value_quote_next()
+	function get_endtime()
 	{
-		if ($this->is_linear_whitespace())
+		if ($this->endTime !== null)
 		{
-			$this->state = 'value_linear_whitespace_quote';
+			return $this->endTime;
 		}
 		else
 		{
-			switch ($this->data[$this->position])
-			{
-				case '"':
-					$this->state = 'value_next';
-					$this->position++;
-					break;
-
-				case '\\':
-					$this->state = 'value_quote_char';
-					$this->position++;
-					break;
-
-				default:
-					$this->state = 'value_quote';
-					break;
-			}
+			return null;
 		}
 	}
 
-	/**
-	 * Parse a header value while within quotes
-	 *
-	 * @access private
-	 */
-	function value_quote()
-	{
-		$len = strcspn($this->data, "\x09\x20\r\n\"\\", $this->position);
-		$this->value .= substr($this->data, $this->position, $len);
-		$this->position += $len;
-		$this->state = 'value_quote_next';
-	}
-
-	/**
-	 * Parse an escaped character within quotes
-	 *
-	 * @access private
-	 */
-	function value_quote_char()
+	function get_language()
 	{
-		$this->value .= $this->data[$this->position];
-		$this->state = 'value_quote_next';
-		$this->position++;
+		if ($this->lang !== null)
+		{
+			return $this->lang;
+		}
+		else
+		{
+			return null;
+		}
 	}
 
-	/**
-	 * Parse LWS within quotes
-	 *
-	 * @access private
-	 */
-	function value_linear_whitespace_quote()
+	function get_starttime()
 	{
-		$this->linear_whitespace();
-		$this->state = 'value_quote_next';
+		if ($this->startTime !== null)
+		{
+			return $this->startTime;
+		}
+		else
+		{
+			return null;
+		}
 	}
 
-	/**
-	 * Parse a CRLF, and see whether we have a further header, or whether we are followed by the body
-	 *
-	 * @access private
-	 */
-	function end_crlf()
+	function get_text()
 	{
-		$this->name = strtolower($this->name);
-		$this->value = trim($this->value, "\x20");
-		if (isset($this->headers[$this->name]))
+		if ($this->text !== null)
 		{
-			$this->headers[$this->name] .= ', ' . $this->value;
+			return $this->text;
 		}
 		else
 		{
-			$this->headers[$this->name] = $this->value;
+			return null;
 		}
+	}
 
-		if (substr($this->data, $this->position, 2) == "\r\n")
-		{
-			$this->body = substr($this->data, $this->position + 2);
-			$this->state = 'emit';
-		}
-		elseif (strspn($this->data, "\r\n", $this->position, 1))
+	function get_type()
+	{
+		if ($this->type !== null)
 		{
-			$this->body = substr($this->data, $this->position + 1);
-			$this->state = 'emit';
+			return $this->type;
 		}
 		else
 		{
-			$this->name = '';
-			$this->value = '';
-			$this->state = 'name';
+			return null;
 		}
 	}
 }
 
-class SimplePie_Cache
+class SimplePie_Credit
 {
-	var $location;
-	var $filename;
-	var $extension;
+	var $role;
+	var $scheme;
 	var $name;
 
-	function SimplePie_Cache($location, $filename, $extension)
+	// Constructor, used to input the data
+	function SimplePie_Credit($role = null, $scheme = null, $name = null)
 	{
-		$this->location = $location;
-		$this->filename = rawurlencode($filename);
-		$this->extension = rawurlencode($extension);
-		$this->name = "$location/$this->filename.$this->extension";
+		$this->role = $role;
+		$this->scheme = $scheme;
+		$this->name = $name;
 	}
 
-	function save($data)
+	function __toString()
 	{
-		if (file_exists($this->name) && is_writeable($this->name) || file_exists($this->location) && is_writeable($this->location))
+		// There is no $this->data here
+		return md5(serialize($this));
+	}
+
+	function get_role()
+	{
+		if ($this->role !== null)
 		{
-			if (function_exists('file_put_contents'))
-			{
-				return (bool) file_put_contents($this->name, serialize($data));
-			}
-			else
-			{
-				$fp = fopen($this->name, 'wb');
-				if ($fp)
-				{
-					fwrite($fp, serialize($data));
-					fclose($fp);
-					return true;
-				}
-			}
+			return $this->role;
 		}
-		return false;
-	}
-
-	function load()
-	{
-		if (file_exists($this->name) && is_readable($this->name))
+		else
 		{
-			if (function_exists('file_get_contents'))
-			{
-				return unserialize(file_get_contents($this->name));
-			}
-			elseif (($fp = fopen($this->name, 'rb')) !== false)
-			{
-				$data = '';
-				while (!feof($fp))
-				{
-					$data .= fread($fp, 8192);
-				}
-				fclose($fp);
-				return unserialize($data);
-			}
+			return null;
 		}
-		return false;
 	}
 
-	function mtime()
+	function get_scheme()
 	{
-		if (file_exists($this->name))
+		if ($this->scheme !== null)
 		{
-			return filemtime($this->name);
+			return $this->scheme;
 		}
-		return false;
-	}
-
-	function touch()
-	{
-		if (file_exists($this->name))
+		else
 		{
-			return touch($this->name);
+			return null;
 		}
-		return false;
 	}
 
-	function unlink()
+	function get_name()
 	{
-		if (file_exists($this->name))
+		if ($this->name !== null)
 		{
-			return unlink($this->name);
+			return $this->name;
+		}
+		else
+		{
+			return null;
 		}
-		return false;
 	}
 }
 
-class SimplePie_Misc
+class SimplePie_Copyright
 {
-	function time_hms($seconds)
+	var $url;
+	var $label;
+
+	// Constructor, used to input the data
+	function SimplePie_Copyright($url = null, $label = null)
 	{
-		$time = '';
+		$this->url = $url;
+		$this->label = $label;
+	}
 
-		$hours = floor($seconds / 3600);
-		$remainder = $seconds % 3600;
-		if ($hours > 0)
-		{
-			$time .= $hours.':';
-		}
+	function __toString()
+	{
+		// There is no $this->data here
+		return md5(serialize($this));
+	}
 
-		$minutes = floor($remainder / 60);
-		$seconds = $remainder % 60;
-		if ($minutes < 10 && $hours > 0)
+	function get_url()
+	{
+		if ($this->url !== null)
 		{
-			$minutes = '0' . $minutes;
+			return $this->url;
 		}
-		if ($seconds < 10)
+		else
 		{
-			$seconds = '0' . $seconds;
+			return null;
 		}
-
-		$time .= $minutes.':';
-		$time .= $seconds;
-
-		return $time;
 	}
 
-	function absolutize_url($relative, $base)
+	function get_attribution()
 	{
-		if ($relative !== '')
+		if ($this->label !== null)
 		{
-			$relative = SimplePie_Misc::parse_url($relative);
-			if ($relative['scheme'] !== '')
-			{
-				$target = $relative;
-			}
-			elseif ($base !== '')
-			{
-				$base = SimplePie_Misc::parse_url($base);
-				$target = SimplePie_Misc::parse_url('');
-				if ($relative['authority'] !== '')
-				{
-					$target = $relative;
-					$target['scheme'] = $base['scheme'];
-				}
-				else
-				{
-					$target['scheme'] = $base['scheme'];
-					$target['authority'] = $base['authority'];
-					if ($relative['path'] !== '')
-					{
-						if (strpos($relative['path'], '/') === 0)
-						{
-							$target['path'] = $relative['path'];
-						}
-						elseif (($target['path'] = dirname("$base[path].")) == '/')
-						{
-							$target['path'] .= $relative['path'];
-						}
-						else
-						{
-							$target['path'] .= '/' . $relative['path'];
-						}
-						if ($relative['query'] !== '')
-						{
-							$target['query'] = $relative['query'];
-						}
-					}
-					else
-					{
-						if ($base['path'] !== '')
-						{
-							$target['path'] = $base['path'];
-						}
-						else
-						{
-							$target['path'] = '/';
-						}
-						if ($relative['query'] !== '')
-						{
-							$target['query'] = $relative['query'];
-						}
-						elseif ($base['query'] !== '')
-						{
-							$target['query'] = $base['query'];
-						}
-					}
-				}
-				if ($relative['fragment'] !== '')
-				{
-					$target['fragment'] = $relative['fragment'];
-				}
-			}
-			else
-			{
-				// No base URL, just return the relative URL
-				$target = $relative;
-			}
-			$return = SimplePie_Misc::compress_parse_url($target['scheme'], $target['authority'], $target['path'], $target['query'], $target['fragment']);
+			return $this->label;
 		}
 		else
 		{
-			$return = $base;
+			return null;
 		}
-		$return = SimplePie_Misc::normalize_url($return);
-		return $return;
 	}
+}
 
-	function remove_dot_segments($input)
+class SimplePie_Rating
+{
+	var $scheme;
+	var $value;
+
+	// Constructor, used to input the data
+	function SimplePie_Rating($scheme = null, $value = null)
 	{
-		$output = '';
-		while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input == '.' || $input == '..')
-		{
-			// A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise,
-			if (strpos($input, '../') === 0)
-			{
-				$input = substr($input, 3);
-			}
-			elseif (strpos($input, './') === 0)
-			{
-				$input = substr($input, 2);
-			}
-			// B: if the input buffer begins with a prefix of "/./" or "/.", where "." is a complete path segment, then replace that prefix with "/" in the input buffer; otherwise,
-			elseif (strpos($input, '/./') === 0)
-			{
-				$input = substr_replace($input, '/', 0, 3);
-			}
-			elseif ($input == '/.')
-			{
-				$input = '/';
-			}
-			// C: if the input buffer begins with a prefix of "/../" or "/..", where ".." is a complete path segment, then replace that prefix with "/" in the input buffer and remove the last segment and its preceding "/" (if any) from the output buffer; otherwise,
-			elseif (strpos($input, '/../') === 0)
-			{
-				$input = substr_replace($input, '/', 0, 4);
-				$output = substr_replace($output, '', strrpos($output, '/'));
-			}
-			elseif ($input == '/..')
-			{
-				$input = '/';
-				$output = substr_replace($output, '', strrpos($output, '/'));
-			}
-			// D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise,
-			elseif ($input == '.' || $input == '..')
-			{
-				$input = '';
-			}
-			// E: move the first path segment in the input buffer to the end of the output buffer, including the initial "/" character (if any) and any subsequent characters up to, but not including, the next "/" character or the end of the input buffer
-			elseif (($pos = strpos($input, '/', 1)) !== false)
-			{
-				$output .= substr($input, 0, $pos);
-				$input = substr_replace($input, '', 0, $pos);
-			}
-			else
-			{
-				$output .= $input;
-				$input = '';
-			}
-		}
-		return $output . $input;
+		$this->scheme = $scheme;
+		$this->value = $value;
 	}
 
-	function get_element($realname, $string)
+	function __toString()
 	{
-		$return = array();
-		$name = preg_quote($realname, '/');
-		if (preg_match_all("/<($name)" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . "(>(.*)<\/$name>|(\/)?>)/siU", $string, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE))
-		{
-			for ($i = 0, $total_matches = count($matches); $i < $total_matches; $i++)
-			{
-				$return[$i]['tag'] = $realname;
-				$return[$i]['full'] = $matches[$i][0][0];
-				$return[$i]['offset'] = $matches[$i][0][1];
-				if (strlen($matches[$i][3][0]) <= 2)
-				{
-					$return[$i]['self_closing'] = true;
-				}
-				else
-				{
-					$return[$i]['self_closing'] = false;
-					$return[$i]['content'] = $matches[$i][4][0];
-				}
-				$return[$i]['attribs'] = array();
-				if (isset($matches[$i][2][0]) && preg_match_all('/((?:[^\s:]+:)?[^\s:]+)(?:\s*=\s*(?:"([^"]*)"|\'([^\']*)\'|([a-z0-9\-._:]*)))?\s/U', ' ' . $matches[$i][2][0] . ' ', $attribs, PREG_SET_ORDER))
-				{
-					for ($j = 0, $total_attribs = count($attribs); $j < $total_attribs; $j++)
-					{
-						if (count($attribs[$j]) == 2)
-						{
-							$attribs[$j][2] = $attribs[$j][1];
-						}
-						$return[$i]['attribs'][strtolower($attribs[$j][1])]['data'] = SimplePie_Misc::entities_decode(end($attribs[$j]), 'UTF-8');
-					}
-				}
-			}
-		}
-		return $return;
+		// There is no $this->data here
+		return md5(serialize($this));
 	}
 
-	function element_implode($element)
+	function get_scheme()
 	{
-		$full = "<$element[tag]";
-		foreach ($element['attribs'] as $key => $value)
-		{
-			$key = strtolower($key);
-			$full .= " $key=\"" . htmlspecialchars($value['data']) . '"';
-		}
-		if ($element['self_closing'])
+		if ($this->scheme !== null)
 		{
-			$full .= ' />';
+			return $this->scheme;
 		}
 		else
 		{
-			$full .= ">$element[content]</$element[tag]>";
+			return null;
 		}
-		return $full;
 	}
 
-	function error($message, $level, $file, $line)
+	function get_value()
 	{
-		switch ($level)
+		if ($this->value !== null)
 		{
-			case E_USER_ERROR:
-				$note = 'PHP Error';
-				break;
-			case E_USER_WARNING:
-				$note = 'PHP Warning';
-				break;
-			case E_USER_NOTICE:
-				$note = 'PHP Notice';
-				break;
-			default:
-				$note = 'Unknown Error';
-				break;
-		}
-		error_log("$note: $message in $file on line $line", 0);
-		return $message;
-	}
-
-	/**
-	 * If a file has been cached, retrieve and display it.
-	 *
-	 * This is most useful for caching images (get_favicon(), etc.),
-	 * however it works for all cached files.  This WILL NOT display ANY
-	 * file/image/page/whatever, but rather only display what has already
-	 * been cached by SimplePie.
-	 *
-	 * @access public
-	 * @see SimplePie::get_favicon()
-	 * @param str $identifier_url URL that is used to identify the content.
-	 * This may or may not be the actual URL of the live content.
-	 * @param str $cache_location Location of SimplePie's cache.  Defaults
-	 * to './cache'.
-	 * @param str $cache_extension The file extension that the file was
-	 * cached with.  Defaults to 'spc'.
-	 * @param str $cache_class Name of the cache-handling class being used
-	 * in SimplePie.  Defaults to 'SimplePie_Cache', and should be left
-	 * as-is unless you've overloaded the class.
-	 * @param str $cache_name_function Function that converts the filename
-	 * for saving.  Defaults to 'md5'.
-	 */
-	function display_cached_file($identifier_url, $cache_location = './cache', $cache_extension = 'spc', $cache_class = 'SimplePie_Cache', $cache_name_function = 'md5')
-	{
-		$cache = new $cache_class($cache_location, call_user_func($cache_name_function, $identifier_url), $cache_extension);
-
-		if ($file = $cache->load())
-		{
-			header('Content-type:' . $file['headers']['content-type']);
-			header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days
-			echo $file['body'];
-			exit;
-		}
-
-		die('Cached file for ' . $identifier_url . ' cannot be found.');
-	}
-
-	function fix_protocol($url, $http = 1)
-	{
-		$url = SimplePie_Misc::normalize_url($url);
-		$parsed = SimplePie_Misc::parse_url($url);
-		if ($parsed['scheme'] !== '' && $parsed['scheme'] != 'http' && $parsed['scheme'] != 'https')
-		{
-			return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['authority'], $parsed['path'], $parsed['query'], $parsed['fragment']), $http);
-		}
-
-		if ($parsed['scheme'] === '' && $parsed['authority'] === '' && !file_exists($url))
-		{
-			return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['path'], '', $parsed['query'], $parsed['fragment']), $http);
-		}
-
-		if ($http == 2 && $parsed['scheme'] !== '')
-		{
-			return "feed:$url";
-		}
-		elseif ($http == 3 && strtolower($parsed['scheme']) == 'http')
-		{
-			return substr_replace($url, 'podcast', 0, 4);
-		}
-		elseif ($http == 4 && strtolower($parsed['scheme']) == 'http')
-		{
-			return substr_replace($url, 'itpc', 0, 4);
+			return $this->value;
 		}
 		else
 		{
-			return $url;
+			return null;
 		}
 	}
+}
 
-	function parse_url($url)
-	{
-		static $cache = array();
-		if (isset($cache[$url]))
-		{
-			return $cache[$url];
-		}
-		elseif (preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $url, $match))
-		{
-			for ($i = count($match); $i <= 9; $i++)
-			{
-				$match[$i] = '';
-			}
-			return $cache[$url] = array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]);
-		}
-		else
-		{
-			return $cache[$url] = array('scheme' => '', 'authority' => '', 'path' => '', 'query' => '', 'fragment' => '');
-		}
-	}
+class SimplePie_Restriction
+{
+	var $relationship;
+	var $type;
+	var $value;
 
-	function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '')
+	// Constructor, used to input the data
+	function SimplePie_Restriction($relationship = null, $type = null, $value = null)
 	{
-		$return = '';
-		if ($scheme !== '')
-		{
-			$return .= "$scheme:";
-		}
-		if ($authority !== '')
-		{
-			$return .= "//$authority";
-		}
-		if ($path !== '')
-		{
-			$return .= $path;
-		}
-		if ($query !== '')
-		{
-			$return .= "?$query";
-		}
-		if ($fragment !== '')
-		{
-			$return .= "#$fragment";
-		}
-		return $return;
+		$this->relationship = $relationship;
+		$this->type = $type;
+		$this->value = $value;
 	}
 
-	function normalize_url($url)
+	function __toString()
 	{
-		$url = preg_replace_callback('/%([0-9A-Fa-f]{2})/', array('SimplePie_Misc', 'percent_encoding_normalization'), $url);
-		$url = SimplePie_Misc::parse_url($url);
-		$url['scheme'] = strtolower($url['scheme']);
-		if ($url['authority'] !== '')
-		{
-			$url['authority'] = strtolower($url['authority']);
-			$url['path'] = SimplePie_Misc::remove_dot_segments($url['path']);
-		}
-		return SimplePie_Misc::compress_parse_url($url['scheme'], $url['authority'], $url['path'], $url['query'], $url['fragment']);
+		// There is no $this->data here
+		return md5(serialize($this));
 	}
 
-	function percent_encoding_normalization($match)
+	function get_relationship()
 	{
-		$integer = hexdec($match[1]);
-		if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer == 0x2D || $integer == 0x2E || $integer == 0x5F || $integer == 0x7E)
+		if ($this->relationship !== null)
 		{
-			return chr($integer);
+			return $this->relationship;
 		}
 		else
 		{
-			return strtoupper($match[0]);
+			return null;
 		}
 	}
 
-	/**
-	 * Remove bad UTF-8 bytes
-	 *
-	 * PCRE Pattern to locate bad bytes in a UTF-8 string comes from W3C
-	 * FAQ: Multilingual Forms (modified to include full ASCII range)
-	 *
-	 * @author Geoffrey Sneddon
-	 * @see http://www.w3.org/International/questions/qa-forms-utf-8
-	 * @param string $str String to remove bad UTF-8 bytes from
-	 * @return string UTF-8 string
-	 */
-	function utf8_bad_replace($str)
+	function get_type()
 	{
-		if (function_exists('iconv'))
-		{
-			$out = iconv('UTF-8', 'UTF-8//IGNORE', $str);
-			if($out !== false) return $out;
-		}
-		if (function_exists('mb_convert_encoding'))
-		{
-			return mb_convert_encoding($str, 'UTF-8', 'UTF-8');
-		}
-		elseif (preg_match_all('/([\x00-\x7F]|[\xC2-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|\xED[\x80-\x9F][\x80-\xBF]|\xF0[\x90-\xBF][\x80-\xBF]{2}|[\xF1-\xF3][\x80-\xBF]{3}|\xF4[\x80-\x8F][\x80-\xBF]{2})/', $str, $matches))
-		{
-			return implode("\xEF\xBF\xBD", $matches[0]);
-		}
-		elseif ($str !== '')
+		if ($this->type !== null)
 		{
-			return "\xEF\xBF\xBD";
+			return $this->type;
 		}
 		else
 		{
-			return '';
+			return null;
 		}
 	}
 
-	function change_encoding($data, $input, $output)
+	function get_value()
 	{
-		$input = SimplePie_Misc::encoding($input);
-		$output = SimplePie_Misc::encoding($output);
-
-		if (function_exists('iconv') && ($return = @iconv($input, "$output//IGNORE", $data)))
-		{
-			return $return;
-		}
-		elseif (function_exists('iconv') && ($return = @iconv($input, $output, $data)))
-		{
-			return $return;
-		}
-		elseif (function_exists('mb_convert_encoding') && ($return = @mb_convert_encoding($data, $output, $input)))
-		{
-			return $return;
-		}
-		elseif ($input == 'ISO-8859-1' && $output == 'UTF-8')
+		if ($this->value !== null)
 		{
-			return utf8_encode($data);
+			return $this->value;
 		}
-		elseif ($input == 'UTF-8' && $output == 'ISO-8859-1')
+		else
 		{
-			return utf8_decode($data);
+			return null;
 		}
-		return $data;
 	}
+}
+
+/**
+ * @todo Move to properly supporting RFC2616 (HTTP/1.1)
+ */
+class SimplePie_File
+{
+	var $url;
+	var $useragent;
+	var $success = true;
+	var $headers = array();
+	var $body;
+	var $status_code;
+	var $redirects = 0;
+	var $error;
+	var $method = SIMPLEPIE_FILE_SOURCE_NONE;
 
-	function encoding($encoding)
+	function SimplePie_File($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false)
 	{
-		// Character sets are case-insensitive (though we'll return them in the form given in their registration)
-		switch (strtoupper($encoding))
+		if (class_exists('idna_convert'))
 		{
-			case 'ANSI_X3.4-1968':
-			case 'ISO-IR-6':
-			case 'ANSI_X3.4-1986':
-			case 'ISO_646.IRV:1991':
-			case 'ASCII':
-			case 'ISO646-US':
-			case 'US-ASCII':
-			case 'US':
-			case 'IBM367':
-			case 'CP367':
-			case 'CSASCII':
-				return 'US-ASCII';
-
-			case 'ISO_8859-1:1987':
-			case 'ISO-IR-100':
-			case 'ISO_8859-1':
-			case 'ISO-8859-1':
-			case 'LATIN1':
-			case 'L1':
-			case 'IBM819':
-			case 'CP819':
-			case 'CSISOLATIN1':
-				return 'ISO-8859-1';
-
-			case 'ISO_8859-2:1987':
-			case 'ISO-IR-101':
-			case 'ISO_8859-2':
-			case 'ISO-8859-2':
-			case 'LATIN2':
-			case 'L2':
-			case 'CSISOLATIN2':
-				return 'ISO-8859-2';
-
-			case 'ISO_8859-3:1988':
-			case 'ISO-IR-109':
-			case 'ISO_8859-3':
-			case 'ISO-8859-3':
-			case 'LATIN3':
-			case 'L3':
-			case 'CSISOLATIN3':
-				return 'ISO-8859-3';
-
-			case 'ISO_8859-4:1988':
-			case 'ISO-IR-110':
-			case 'ISO_8859-4':
-			case 'ISO-8859-4':
-			case 'LATIN4':
-			case 'L4':
-			case 'CSISOLATIN4':
-				return 'ISO-8859-4';
-
-			case 'ISO_8859-5:1988':
-			case 'ISO-IR-144':
-			case 'ISO_8859-5':
-			case 'ISO-8859-5':
-			case 'CYRILLIC':
-			case 'CSISOLATINCYRILLIC':
-				return 'ISO-8859-5';
-
-			case 'ISO_8859-6:1987':
-			case 'ISO-IR-127':
-			case 'ISO_8859-6':
-			case 'ISO-8859-6':
-			case 'ECMA-114':
-			case 'ASMO-708':
-			case 'ARABIC':
-			case 'CSISOLATINARABIC':
-				return 'ISO-8859-6';
-
-			case 'ISO_8859-7:1987':
-			case 'ISO-IR-126':
-			case 'ISO_8859-7':
-			case 'ISO-8859-7':
-			case 'ELOT_928':
-			case 'ECMA-118':
-			case 'GREEK':
-			case 'GREEK8':
-			case 'CSISOLATINGREEK':
-				return 'ISO-8859-7';
-
-			case 'ISO_8859-8:1988':
-			case 'ISO-IR-138':
-			case 'ISO_8859-8':
-			case 'ISO-8859-8':
-			case 'HEBREW':
-			case 'CSISOLATINHEBREW':
-				return 'ISO-8859-8';
-
-			case 'ISO_8859-9:1989':
-			case 'ISO-IR-148':
-			case 'ISO_8859-9':
-			case 'ISO-8859-9':
-			case 'LATIN5':
-			case 'L5':
-			case 'CSISOLATIN5':
-				return 'ISO-8859-9';
-
-			case 'ISO-8859-10':
-			case 'ISO-IR-157':
-			case 'L6':
-			case 'ISO_8859-10:1992':
-			case 'CSISOLATIN6':
-			case 'LATIN6':
-				return 'ISO-8859-10';
-
-			case 'ISO_6937-2-ADD':
-			case 'ISO-IR-142':
-			case 'CSISOTEXTCOMM':
-				return 'ISO_6937-2-add';
-
-			case 'JIS_X0201':
-			case 'X0201':
-			case 'CSHALFWIDTHKATAKANA':
-				return 'JIS_X0201';
-
-			case 'JIS_ENCODING':
-			case 'CSJISENCODING':
-				return 'JIS_Encoding';
-
-			case 'SHIFT_JIS':
-			case 'MS_KANJI':
-			case 'CSSHIFTJIS':
-				return 'Shift_JIS';
-
-			case 'EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE':
-			case 'CSEUCPKDFMTJAPANESE':
-			case 'EUC-JP':
-				return 'EUC-JP';
-
-			case 'EXTENDED_UNIX_CODE_FIXED_WIDTH_FOR_JAPANESE':
-			case 'CSEUCFIXWIDJAPANESE':
-				return 'Extended_UNIX_Code_Fixed_Width_for_Japanese';
-
-			case 'BS_4730':
-			case 'ISO-IR-4':
-			case 'ISO646-GB':
-			case 'GB':
-			case 'UK':
-			case 'CSISO4UNITEDKINGDOM':
-				return 'BS_4730';
-
-			case 'SEN_850200_C':
-			case 'ISO-IR-11':
-			case 'ISO646-SE2':
-			case 'SE2':
-			case 'CSISO11SWEDISHFORNAMES':
-				return 'SEN_850200_C';
-
-			case 'IT':
-			case 'ISO-IR-15':
-			case 'ISO646-IT':
-			case 'CSISO15ITALIAN':
-				return 'IT';
-
-			case 'ES':
-			case 'ISO-IR-17':
-			case 'ISO646-ES':
-			case 'CSISO17SPANISH':
-				return 'ES';
-
-			case 'DIN_66003':
-			case 'ISO-IR-21':
-			case 'DE':
-			case 'ISO646-DE':
-			case 'CSISO21GERMAN':
-				return 'DIN_66003';
-
-			case 'NS_4551-1':
-			case 'ISO-IR-60':
-			case 'ISO646-NO':
-			case 'NO':
-			case 'CSISO60DANISHNORWEGIAN':
-			case 'CSISO60NORWEGIAN1':
-				return 'NS_4551-1';
-
-			case 'NF_Z_62-010':
-			case 'ISO-IR-69':
-			case 'ISO646-FR':
-			case 'FR':
-			case 'CSISO69FRENCH':
-				return 'NF_Z_62-010';
-
-			case 'ISO-10646-UTF-1':
-			case 'CSISO10646UTF1':
-				return 'ISO-10646-UTF-1';
+			$idn = new idna_convert;
+			$parsed = SimplePie_Misc::parse_url($url);
+			$url = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
+		}
+		$this->url = $url;
+		$this->useragent = $useragent;
+		if (preg_match('/^http(s)?:\/\//i', $url))
+		{
+			if ($useragent === null)
+			{
+				$useragent = ini_get('user_agent');
+				$this->useragent = $useragent;
+			}
+			if (!is_array($headers))
+			{
+				$headers = array();
+			}
+			if (!$force_fsockopen && function_exists('curl_exec'))
+			{
+				$this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_CURL;
+				$fp = curl_init();
+				$headers2 = array();
+				foreach ($headers as $key => $value)
+				{
+					$headers2[] = "$key: $value";
+				}
+				if (version_compare(SimplePie_Misc::get_curl_version(), '7.10.5', '>='))
+				{
+					curl_setopt($fp, CURLOPT_ENCODING, '');
+				}
+				curl_setopt($fp, CURLOPT_URL, $url);
+				curl_setopt($fp, CURLOPT_HEADER, 1);
+				curl_setopt($fp, CURLOPT_RETURNTRANSFER, 1);
+				curl_setopt($fp, CURLOPT_TIMEOUT, $timeout);
+				curl_setopt($fp, CURLOPT_CONNECTTIMEOUT, $timeout);
+				curl_setopt($fp, CURLOPT_REFERER, $url);
+				curl_setopt($fp, CURLOPT_USERAGENT, $useragent);
+				curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2);
+				if (!ini_get('open_basedir') && !ini_get('safe_mode') && version_compare(SimplePie_Misc::get_curl_version(), '7.15.2', '>='))
+				{
+					curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1);
+					curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects);
+				}
 
-			case 'ISO_646.BASIC:1983':
-			case 'REF':
-			case 'CSISO646BASIC1983':
-				return 'ISO_646.basic:1983';
+				$this->headers = curl_exec($fp);
+				if (curl_errno($fp) === 23 || curl_errno($fp) === 61)
+				{
+					curl_setopt($fp, CURLOPT_ENCODING, 'none');
+					$this->headers = curl_exec($fp);
+				}
+				if (curl_errno($fp))
+				{
+					$this->error = 'cURL error ' . curl_errno($fp) . ': ' . curl_error($fp);
+					$this->success = false;
+				}
+				else
+				{
+					$info = curl_getinfo($fp);
+					curl_close($fp);
+					$this->headers = explode("\r\n\r\n", $this->headers, $info['redirect_count'] + 1);
+					$this->headers = array_pop($this->headers);
+					$parser = new SimplePie_HTTP_Parser($this->headers);
+					if ($parser->parse())
+					{
+						$this->headers = $parser->headers;
+						$this->body = $parser->body;
+						$this->status_code = $parser->status_code;
+						if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects)
+						{
+							$this->redirects++;
+							$location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
+							return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
+						}
+					}
+				}
+			}
+			else
+			{
+				$this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN;
+				$url_parts = parse_url($url);
+				if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) === 'https')
+				{
+					$url_parts['host'] = "ssl://$url_parts[host]";
+					$url_parts['port'] = 443;
+				}
+				if (!isset($url_parts['port']))
+				{
+					$url_parts['port'] = 80;
+				}
+				$fp = @fsockopen($url_parts['host'], $url_parts['port'], $errno, $errstr, $timeout);
+				if (!$fp)
+				{
+					$this->error = 'fsockopen error: ' . $errstr;
+					$this->success = false;
+				}
+				else
+				{
+					stream_set_timeout($fp, $timeout);
+					if (isset($url_parts['path']))
+					{
+						if (isset($url_parts['query']))
+						{
+							$get = "$url_parts[path]?$url_parts[query]";
+						}
+						else
+						{
+							$get = $url_parts['path'];
+						}
+					}
+					else
+					{
+						$get = '/';
+					}
+					$out = "GET $get HTTP/1.0\r\n";
+					$out .= "Host: $url_parts[host]\r\n";
+					$out .= "User-Agent: $useragent\r\n";
+					if (extension_loaded('zlib'))
+					{
+						$out .= "Accept-Encoding: x-gzip,gzip,deflate\r\n";
+					}
+
+					if (isset($url_parts['user']) && isset($url_parts['pass']))
+					{
+						$out .= "Authorization: Basic " . base64_encode("$url_parts[user]:$url_parts[pass]") . "\r\n";
+					}
+					foreach ($headers as $key => $value)
+					{
+						$out .= "$key: $value\r\n";
+					}
+					$out .= "Connection: Close\r\n\r\n";
+					fwrite($fp, $out);
+
+					$info = stream_get_meta_data($fp);
+
+					$this->headers = '';
+					while (!$info['eof'] && !$info['timed_out'])
+					{
+						$this->headers .= fread($fp, 1160);
+						$info = stream_get_meta_data($fp);
+					}
+					if (!$info['timed_out'])
+					{
+						$parser = new SimplePie_HTTP_Parser($this->headers);
+						if ($parser->parse())
+						{
+							$this->headers = $parser->headers;
+							$this->body = $parser->body;
+							$this->status_code = $parser->status_code;
+							if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects)
+							{
+								$this->redirects++;
+								$location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
+								return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
+							}
+							if (isset($this->headers['content-encoding']))
+							{
+								// Hey, we act dumb elsewhere, so let's do that here too
+								switch (strtolower(trim($this->headers['content-encoding'], "\x09\x0A\x0D\x20")))
+								{
+									case 'gzip':
+									case 'x-gzip':
+										$decoder = new SimplePie_gzdecode($this->body);
+										if (!$decoder->parse())
+										{
+											$this->error = 'Unable to decode HTTP "gzip" stream';
+											$this->success = false;
+										}
+										else
+										{
+											$this->body = $decoder->data;
+										}
+										break;
+
+									case 'deflate':
+										if (($body = gzuncompress($this->body)) === false)
+										{
+											if (($body = gzinflate($this->body)) === false)
+											{
+												$this->error = 'Unable to decode HTTP "deflate" stream';
+												$this->success = false;
+											}
+										}
+										$this->body = $body;
+										break;
+
+									default:
+										$this->error = 'Unknown content coding';
+										$this->success = false;
+								}
+							}
+						}
+					}
+					else
+					{
+						$this->error = 'fsocket timed out';
+						$this->success = false;
+					}
+					fclose($fp);
+				}
+			}
+		}
+		else
+		{
+			$this->method = SIMPLEPIE_FILE_SOURCE_LOCAL | SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS;
+			if (!$this->body = file_get_contents($url))
+			{
+				$this->error = 'file_get_contents could not read the file';
+				$this->success = false;
+			}
+		}
+	}
+}
+
+/**
+ * HTTP Response Parser
+ *
+ * @package SimplePie
+ */
+class SimplePie_HTTP_Parser
+{
+	/**
+	 * HTTP Version
+	 *
+	 * @access public
+	 * @var float
+	 */
+	var $http_version = 0.0;
+
+	/**
+	 * Status code
+	 *
+	 * @access public
+	 * @var int
+	 */
+	var $status_code = 0;
+
+	/**
+	 * Reason phrase
+	 *
+	 * @access public
+	 * @var string
+	 */
+	var $reason = '';
+
+	/**
+	 * Key/value pairs of the headers
+	 *
+	 * @access public
+	 * @var array
+	 */
+	var $headers = array();
+
+	/**
+	 * Body of the response
+	 *
+	 * @access public
+	 * @var string
+	 */
+	var $body = '';
+
+	/**
+	 * Current state of the state machine
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $state = 'http_version';
+
+	/**
+	 * Input data
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $data = '';
+
+	/**
+	 * Input data length (to avoid calling strlen() everytime this is needed)
+	 *
+	 * @access private
+	 * @var int
+	 */
+	var $data_length = 0;
+
+	/**
+	 * Current position of the pointer
+	 *
+	 * @var int
+	 * @access private
+	 */
+	var $position = 0;
+
+	/**
+	 * Name of the hedaer currently being parsed
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $name = '';
+
+	/**
+	 * Value of the hedaer currently being parsed
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $value = '';
+
+	/**
+	 * Create an instance of the class with the input data
+	 *
+	 * @access public
+	 * @param string $data Input data
+	 */
+	function SimplePie_HTTP_Parser($data)
+	{
+		$this->data = $data;
+		$this->data_length = strlen($this->data);
+	}
+
+	/**
+	 * Parse the input data
+	 *
+	 * @access public
+	 * @return bool true on success, false on failure
+	 */
+	function parse()
+	{
+		while ($this->state && $this->state !== 'emit' && $this->has_data())
+		{
+			$state = $this->state;
+			$this->$state();
+		}
+		$this->data = '';
+		if ($this->state === 'emit' || $this->state === 'body')
+		{
+			return true;
+		}
+		else
+		{
+			$this->http_version = '';
+			$this->status_code = '';
+			$this->reason = '';
+			$this->headers = array();
+			$this->body = '';
+			return false;
+		}
+	}
+
+	/**
+	 * Check whether there is data beyond the pointer
+	 *
+	 * @access private
+	 * @return bool true if there is further data, false if not
+	 */
+	function has_data()
+	{
+		return (bool) ($this->position < $this->data_length);
+	}
+
+	/**
+	 * See if the next character is LWS
+	 *
+	 * @access private
+	 * @return bool true if the next character is LWS, false if not
+	 */
+	function is_linear_whitespace()
+	{
+		return (bool) ($this->data[$this->position] === "\x09"
+			|| $this->data[$this->position] === "\x20"
+			|| ($this->data[$this->position] === "\x0A"
+				&& isset($this->data[$this->position + 1])
+				&& ($this->data[$this->position + 1] === "\x09" || $this->data[$this->position + 1] === "\x20")));
+	}
+
+	/**
+	 * Parse the HTTP version
+	 *
+	 * @access private
+	 */
+	function http_version()
+	{
+		if (strpos($this->data, "\x0A") !== false && strtoupper(substr($this->data, 0, 5)) === 'HTTP/')
+		{
+			$len = strspn($this->data, '0123456789.', 5);
+			$this->http_version = substr($this->data, 5, $len);
+			$this->position += 5 + $len;
+			if (substr_count($this->http_version, '.') <= 1)
+			{
+				$this->http_version = (float) $this->http_version;
+				$this->position += strspn($this->data, "\x09\x20", $this->position);
+				$this->state = 'status';
+			}
+			else
+			{
+				$this->state = false;
+			}
+		}
+		else
+		{
+			$this->state = false;
+		}
+	}
+
+	/**
+	 * Parse the status code
+	 *
+	 * @access private
+	 */
+	function status()
+	{
+		if ($len = strspn($this->data, '0123456789', $this->position))
+		{
+			$this->status_code = (int) substr($this->data, $this->position, $len);
+			$this->position += $len;
+			$this->state = 'reason';
+		}
+		else
+		{
+			$this->state = false;
+		}
+	}
+
+	/**
+	 * Parse the reason phrase
+	 *
+	 * @access private
+	 */
+	function reason()
+	{
+		$len = strcspn($this->data, "\x0A", $this->position);
+		$this->reason = trim(substr($this->data, $this->position, $len), "\x09\x0D\x20");
+		$this->position += $len + 1;
+		$this->state = 'new_line';
+	}
+
+	/**
+	 * Deal with a new line, shifting data around as needed
+	 *
+	 * @access private
+	 */
+	function new_line()
+	{
+		$this->value = trim($this->value, "\x0D\x20");
+		if ($this->name !== '' && $this->value !== '')
+		{
+			$this->name = strtolower($this->name);
+			if (isset($this->headers[$this->name]))
+			{
+				$this->headers[$this->name] .= ', ' . $this->value;
+			}
+			else
+			{
+				$this->headers[$this->name] = $this->value;
+			}
+		}
+		$this->name = '';
+		$this->value = '';
+		if (substr($this->data[$this->position], 0, 2) === "\x0D\x0A")
+		{
+			$this->position += 2;
+			$this->state = 'body';
+		}
+		elseif ($this->data[$this->position] === "\x0A")
+		{
+			$this->position++;
+			$this->state = 'body';
+		}
+		else
+		{
+			$this->state = 'name';
+		}
+	}
+
+	/**
+	 * Parse a header name
+	 *
+	 * @access private
+	 */
+	function name()
+	{
+		$len = strcspn($this->data, "\x0A:", $this->position);
+		if (isset($this->data[$this->position + $len]))
+		{
+			if ($this->data[$this->position + $len] === "\x0A")
+			{
+				$this->position += $len;
+				$this->state = 'new_line';
+			}
+			else
+			{
+				$this->name = substr($this->data, $this->position, $len);
+				$this->position += $len + 1;
+				$this->state = 'value';
+			}
+		}
+		else
+		{
+			$this->state = false;
+		}
+	}
+
+	/**
+	 * Parse LWS, replacing consecutive LWS characters with a single space
+	 *
+	 * @access private
+	 */
+	function linear_whitespace()
+	{
+		do
+		{
+			if (substr($this->data, $this->position, 2) === "\x0D\x0A")
+			{
+				$this->position += 2;
+			}
+			elseif ($this->data[$this->position] === "\x0A")
+			{
+				$this->position++;
+			}
+			$this->position += strspn($this->data, "\x09\x20", $this->position);
+		} while ($this->has_data() && $this->is_linear_whitespace());
+		$this->value .= "\x20";
+	}
+
+	/**
+	 * See what state to move to while within non-quoted header values
+	 *
+	 * @access private
+	 */
+	function value()
+	{
+		if ($this->is_linear_whitespace())
+		{
+			$this->linear_whitespace();
+		}
+		else
+		{
+			switch ($this->data[$this->position])
+			{
+				case '"':
+					$this->position++;
+					$this->state = 'quote';
+					break;
+
+				case "\x0A":
+					$this->position++;
+					$this->state = 'new_line';
+					break;
+
+				default:
+					$this->state = 'value_char';
+					break;
+			}
+		}
+	}
+
+	/**
+	 * Parse a header value while outside quotes
+	 *
+	 * @access private
+	 */
+	function value_char()
+	{
+		$len = strcspn($this->data, "\x09\x20\x0A\"", $this->position);
+		$this->value .= substr($this->data, $this->position, $len);
+		$this->position += $len;
+		$this->state = 'value';
+	}
+
+	/**
+	 * See what state to move to while within quoted header values
+	 *
+	 * @access private
+	 */
+	function quote()
+	{
+		if ($this->is_linear_whitespace())
+		{
+			$this->linear_whitespace();
+		}
+		else
+		{
+			switch ($this->data[$this->position])
+			{
+				case '"':
+					$this->position++;
+					$this->state = 'value';
+					break;
+
+				case "\x0A":
+					$this->position++;
+					$this->state = 'new_line';
+					break;
+
+				case '\\':
+					$this->position++;
+					$this->state = 'quote_escaped';
+					break;
+
+				default:
+					$this->state = 'quote_char';
+					break;
+			}
+		}
+	}
+
+	/**
+	 * Parse a header value while within quotes
+	 *
+	 * @access private
+	 */
+	function quote_char()
+	{
+		$len = strcspn($this->data, "\x09\x20\x0A\"\\", $this->position);
+		$this->value .= substr($this->data, $this->position, $len);
+		$this->position += $len;
+		$this->state = 'value';
+	}
+
+	/**
+	 * Parse an escaped character within quotes
+	 *
+	 * @access private
+	 */
+	function quote_escaped()
+	{
+		$this->value .= $this->data[$this->position];
+		$this->position++;
+		$this->state = 'quote';
+	}
+
+	/**
+	 * Parse the body
+	 *
+	 * @access private
+	 */
+	function body()
+	{
+		$this->body = substr($this->data, $this->position);
+		$this->state = 'emit';
+	}
+}
+
+/**
+ * gzdecode
+ *
+ * @package SimplePie
+ */
+class SimplePie_gzdecode
+{
+	/**
+	 * Compressed data
+	 *
+	 * @access private
+	 * @see gzdecode::$data
+	 */
+	var $compressed_data;
+
+	/**
+	 * Size of compressed data
+	 *
+	 * @access private
+	 */
+	var $compressed_size;
+
+	/**
+	 * Minimum size of a valid gzip string
+	 *
+	 * @access private
+	 */
+	var $min_compressed_size = 18;
+
+	/**
+	 * Current position of pointer
+	 *
+	 * @access private
+	 */
+	var $position = 0;
+
+	/**
+	 * Flags (FLG)
+	 *
+	 * @access private
+	 */
+	var $flags;
+
+	/**
+	 * Uncompressed data
+	 *
+	 * @access public
+	 * @see gzdecode::$compressed_data
+	 */
+	var $data;
+
+	/**
+	 * Modified time
+	 *
+	 * @access public
+	 */
+	var $MTIME;
+
+	/**
+	 * Extra Flags
+	 *
+	 * @access public
+	 */
+	var $XFL;
+
+	/**
+	 * Operating System
+	 *
+	 * @access public
+	 */
+	var $OS;
+
+	/**
+	 * Subfield ID 1
+	 *
+	 * @access public
+	 * @see gzdecode::$extra_field
+	 * @see gzdecode::$SI2
+	 */
+	var $SI1;
+
+	/**
+	 * Subfield ID 2
+	 *
+	 * @access public
+	 * @see gzdecode::$extra_field
+	 * @see gzdecode::$SI1
+	 */
+	var $SI2;
+
+	/**
+	 * Extra field content
+	 *
+	 * @access public
+	 * @see gzdecode::$SI1
+	 * @see gzdecode::$SI2
+	 */
+	var $extra_field;
+
+	/**
+	 * Original filename
+	 *
+	 * @access public
+	 */
+	var $filename;
+
+	/**
+	 * Human readable comment
+	 *
+	 * @access public
+	 */
+	var $comment;
+
+	/**
+	 * Don't allow anything to be set
+	 *
+	 * @access public
+	 */
+	function __set($name, $value)
+	{
+		trigger_error("Cannot write property $name", E_USER_ERROR);
+	}
+
+	/**
+	 * Set the compressed string and related properties
+	 *
+	 * @access public
+	 */
+	function SimplePie_gzdecode($data)
+	{
+		$this->compressed_data = $data;
+		$this->compressed_size = strlen($data);
+	}
+
+	/**
+	 * Decode the GZIP stream
+	 *
+	 * @access public
+	 */
+	function parse()
+	{
+		if ($this->compressed_size >= $this->min_compressed_size)
+		{
+			// Check ID1, ID2, and CM
+			if (substr($this->compressed_data, 0, 3) !== "\x1F\x8B\x08")
+			{
+				return false;
+			}
+
+			// Get the FLG (FLaGs)
+			$this->flags = ord($this->compressed_data[3]);
+
+			// FLG bits above (1 << 4) are reserved
+			if ($this->flags > 0x1F)
+			{
+				return false;
+			}
+
+			// Advance the pointer after the above
+			$this->position += 4;
+
+			// MTIME
+			$mtime = substr($this->compressed_data, $this->position, 4);
+			// Reverse the string if we're on a big-endian arch because l is the only signed long and is machine endianness
+			if (current(unpack('S', "\x00\x01")) === 1)
+			{
+				$mtime = strrev($mtime);
+			}
+			$this->MTIME = current(unpack('l', $mtime));
+			$this->position += 4;
+
+			// Get the XFL (eXtra FLags)
+			$this->XFL = ord($this->compressed_data[$this->position++]);
+
+			// Get the OS (Operating System)
+			$this->OS = ord($this->compressed_data[$this->position++]);
+
+			// Parse the FEXTRA
+			if ($this->flags & 4)
+			{
+				// Read subfield IDs
+				$this->SI1 = $this->compressed_data[$this->position++];
+				$this->SI2 = $this->compressed_data[$this->position++];
+
+				// SI2 set to zero is reserved for future use
+				if ($this->SI2 === "\x00")
+				{
+					return false;
+				}
+
+				// Get the length of the extra field
+				$len = current(unpack('v', substr($this->compressed_data, $this->position, 2)));
+				$position += 2;
+
+				// Check the length of the string is still valid
+				$this->min_compressed_size += $len + 4;
+				if ($this->compressed_size >= $this->min_compressed_size)
+				{
+					// Set the extra field to the given data
+					$this->extra_field = substr($this->compressed_data, $this->position, $len);
+					$this->position += $len;
+				}
+				else
+				{
+					return false;
+				}
+			}
+
+			// Parse the FNAME
+			if ($this->flags & 8)
+			{
+				// Get the length of the filename
+				$len = strcspn($this->compressed_data, "\x00", $this->position);
+
+				// Check the length of the string is still valid
+				$this->min_compressed_size += $len + 1;
+				if ($this->compressed_size >= $this->min_compressed_size)
+				{
+					// Set the original filename to the given string
+					$this->filename = substr($this->compressed_data, $this->position, $len);
+					$this->position += $len + 1;
+				}
+				else
+				{
+					return false;
+				}
+			}
+
+			// Parse the FCOMMENT
+			if ($this->flags & 16)
+			{
+				// Get the length of the comment
+				$len = strcspn($this->compressed_data, "\x00", $this->position);
+
+				// Check the length of the string is still valid
+				$this->min_compressed_size += $len + 1;
+				if ($this->compressed_size >= $this->min_compressed_size)
+				{
+					// Set the original comment to the given string
+					$this->comment = substr($this->compressed_data, $this->position, $len);
+					$this->position += $len + 1;
+				}
+				else
+				{
+					return false;
+				}
+			}
+
+			// Parse the FHCRC
+			if ($this->flags & 2)
+			{
+				// Check the length of the string is still valid
+				$this->min_compressed_size += $len + 2;
+				if ($this->compressed_size >= $this->min_compressed_size)
+				{
+					// Read the CRC
+					$crc = current(unpack('v', substr($this->compressed_data, $this->position, 2)));
+
+					// Check the CRC matches
+					if ((crc32(substr($this->compressed_data, 0, $this->position)) & 0xFFFF) === $crc)
+					{
+						$this->position += 2;
+					}
+					else
+					{
+						return false;
+					}
+				}
+				else
+				{
+					return false;
+				}
+			}
+
+			// Decompress the actual data
+			if (($this->data = gzinflate(substr($this->compressed_data, $this->position, -8))) === false)
+			{
+				return false;
+			}
+			else
+			{
+				$this->position = $this->compressed_size - 8;
+			}
+
+			// Check CRC of data
+			$crc = current(unpack('V', substr($this->compressed_data, $this->position, 4)));
+			$this->position += 4;
+			/*if (extension_loaded('hash') && sprintf('%u', current(unpack('V', hash('crc32b', $this->data)))) !== sprintf('%u', $crc))
+			{
+				return false;
+			}*/
+
+			// Check ISIZE of data
+			$isize = current(unpack('V', substr($this->compressed_data, $this->position, 4)));
+			$this->position += 4;
+			if (sprintf('%u', strlen($this->data) & 0xFFFFFFFF) !== sprintf('%u', $isize))
+			{
+				return false;
+			}
+
+			// Wow, against all odds, we've actually got a valid gzip string
+			return true;
+		}
+		else
+		{
+			return false;
+		}
+	}
+}
+
+class SimplePie_Cache
+{
+	/**
+	 * Don't call the constructor. Please.
+	 *
+	 * @access private
+	 */
+	function SimplePie_Cache()
+	{
+		trigger_error('Please call SimplePie_Cache::create() instead of the constructor', E_USER_ERROR);
+	}
+
+	/**
+	 * Create a new SimplePie_Cache object
+	 *
+	 * @static
+	 * @access public
+	 */
+	function create($location, $filename, $extension)
+	{
+		$location_iri = new SimplePie_IRI($location);
+		switch ($location_iri->get_scheme())
+		{
+			case 'mysql':
+				if (extension_loaded('mysql'))
+				{
+					return new SimplePie_Cache_MySQL($location_iri, $filename, $extension);
+				}
+				break;
+
+			default:
+				return new SimplePie_Cache_File($location, $filename, $extension);
+		}
+	}
+}
+
+class SimplePie_Cache_File
+{
+	var $location;
+	var $filename;
+	var $extension;
+	var $name;
+
+	function SimplePie_Cache_File($location, $filename, $extension)
+	{
+		$this->location = $location;
+		$this->filename = $filename;
+		$this->extension = $extension;
+		$this->name = "$this->location/$this->filename.$this->extension";
+	}
+
+	function save($data)
+	{
+		if (file_exists($this->name) && is_writeable($this->name) || file_exists($this->location) && is_writeable($this->location))
+		{
+			if (is_a($data, 'SimplePie'))
+			{
+				$data = $data->data;
+			}
+
+			$data = serialize($data);
+
+			if (function_exists('file_put_contents'))
+			{
+				return (bool) file_put_contents($this->name, $data);
+			}
+			else
+			{
+				$fp = fopen($this->name, 'wb');
+				if ($fp)
+				{
+					fwrite($fp, $data);
+					fclose($fp);
+					return true;
+				}
+			}
+		}
+		return false;
+	}
+
+	function load()
+	{
+		if (file_exists($this->name) && is_readable($this->name))
+		{
+			return unserialize(file_get_contents($this->name));
+		}
+		return false;
+	}
+
+	function mtime()
+	{
+		if (file_exists($this->name))
+		{
+			return filemtime($this->name);
+		}
+		return false;
+	}
+
+	function touch()
+	{
+		if (file_exists($this->name))
+		{
+			return touch($this->name);
+		}
+		return false;
+	}
+
+	function unlink()
+	{
+		if (file_exists($this->name))
+		{
+			return unlink($this->name);
+		}
+		return false;
+	}
+}
+
+class SimplePie_Cache_DB
+{
+	function prepare_simplepie_object_for_cache($data)
+	{
+		$items = $data->get_items();
+		$items_by_id = array();
+
+		if (!empty($items))
+		{
+			foreach ($items as $item)
+			{
+				$items_by_id[$item->get_id()] = $item;
+			}
+
+			if (count($items_by_id) !== count($items))
+			{
+				$items_by_id = array();
+				foreach ($items as $item)
+				{
+					$items_by_id[$item->get_id(true)] = $item;
+				}
+			}
+
+			if (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]))
+			{
+				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0];
+			}
+			elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]))
+			{
+				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0];
+			}
+			elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]))
+			{
+				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0];
+			}
+			elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0]))
+			{
+				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0];
+			}
+			else
+			{
+				$channel = null;
+			}
+
+			if ($channel !== null)
+			{
+				if (isset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry']))
+				{
+					unset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry']);
+				}
+				if (isset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['entry']))
+				{
+					unset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['entry']);
+				}
+				if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item']))
+				{
+					unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item']);
+				}
+				if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item']))
+				{
+					unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item']);
+				}
+				if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_20]['item']))
+				{
+					unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_20]['item']);
+				}
+			}
+			if (isset($data->data['items']))
+			{
+				unset($data->data['items']);
+			}
+			if (isset($data->data['ordered_items']))
+			{
+				unset($data->data['ordered_items']);
+			}
+		}
+		return array(serialize($data->data), $items_by_id);
+	}
+}
+
+class SimplePie_Cache_MySQL extends SimplePie_Cache_DB
+{
+	var $mysql;
+	var $options;
+	var $id;
+
+	function SimplePie_Cache_MySQL($mysql_location, $name, $extension)
+	{
+		$host = $mysql_location->get_host();
+		if (SimplePie_Misc::stripos($host, 'unix(') === 0 && substr($host, -1) === ')')
+		{
+			$server = ':' . substr($host, 5, -1);
+		}
+		else
+		{
+			$server = $host;
+			if ($mysql_location->get_port() !== null)
+			{
+				$server .= ':' . $mysql_location->get_port();
+			}
+		}
+
+		if (strpos($mysql_location->get_userinfo(), ':') !== false)
+		{
+			list($username, $password) = explode(':', $mysql_location->get_userinfo(), 2);
+		}
+		else
+		{
+			$username = $mysql_location->get_userinfo();
+			$password = null;
+		}
+
+		if ($this->mysql = mysql_connect($server, $username, $password))
+		{
+			$this->id = $name . $extension;
+			$this->options = SimplePie_Misc::parse_str($mysql_location->get_query());
+			if (!isset($this->options['prefix'][0]))
+			{
+				$this->options['prefix'][0] = '';
+			}
+
+			if (mysql_select_db(ltrim($mysql_location->get_path(), '/'))
+				&& mysql_query('SET NAMES utf8')
+				&& ($query = mysql_unbuffered_query('SHOW TABLES')))
+			{
+				$db = array();
+				while ($row = mysql_fetch_row($query))
+				{
+					$db[] = $row[0];
+				}
+
+				if (!in_array($this->options['prefix'][0] . 'cache_data', $db))
+				{
+					if (!mysql_query('CREATE TABLE `' . $this->options['prefix'][0] . 'cache_data` (`id` TEXT CHARACTER SET utf8 NOT NULL, `items` SMALLINT NOT NULL DEFAULT 0, `data` BLOB NOT NULL, `mtime` INT UNSIGNED NOT NULL, UNIQUE (`id`(125)))'))
+					{
+						$this->mysql = null;
+					}
+				}
+
+				if (!in_array($this->options['prefix'][0] . 'items', $db))
+				{
+					if (!mysql_query('CREATE TABLE `' . $this->options['prefix'][0] . 'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` TEXT CHARACTER SET utf8 NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))'))
+					{
+						$this->mysql = null;
+					}
+				}
+			}
+			else
+			{
+				$this->mysql = null;
+			}
+		}
+	}
+
+	function save($data)
+	{
+		if ($this->mysql)
+		{
+			$feed_id = "'" . mysql_real_escape_string($this->id) . "'";
+
+			if (is_a($data, 'SimplePie'))
+			{
+				if (SIMPLEPIE_PHP5)
+				{
+					// This keyword needs to defy coding standards for PHP4 compatibility
+					$data = clone($data);
+				}
+
+				$prepared = $this->prepare_simplepie_object_for_cache($data);
+
+				if ($query = mysql_query('SELECT `id` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = ' . $feed_id, $this->mysql))
+				{
+					if (mysql_num_rows($query))
+					{
+						$items = count($prepared[1]);
+						if ($items)
+						{
+							$sql = 'UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `items` = ' . $items . ', `data` = \'' . mysql_real_escape_string($prepared[0]) . '\', `mtime` = ' . time() . ' WHERE `id` = ' . $feed_id;
+						}
+						else
+						{
+							$sql = 'UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `data` = \'' . mysql_real_escape_string($prepared[0]) . '\', `mtime` = ' . time() . ' WHERE `id` = ' . $feed_id;
+						}
+
+						if (!mysql_query($sql, $this->mysql))
+						{
+							return false;
+						}
+					}
+					elseif (!mysql_query('INSERT INTO `' . $this->options['prefix'][0] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(' . $feed_id . ', ' . count($prepared[1]) . ', \'' . mysql_real_escape_string($prepared[0]) . '\', ' . time() . ')', $this->mysql))
+					{
+						return false;
+					}
+
+					$ids = array_keys($prepared[1]);
+					if (!empty($ids))
+					{
+						foreach ($ids as $id)
+						{
+							$database_ids[] = mysql_real_escape_string($id);
+						}
+
+						if ($query = mysql_unbuffered_query('SELECT `id` FROM `' . $this->options['prefix'][0] . 'items` WHERE `id` = \'' . implode('\' OR `id` = \'', $database_ids) . '\' AND `feed_id` = ' . $feed_id, $this->mysql))
+						{
+							$existing_ids = array();
+							while ($row = mysql_fetch_row($query))
+							{
+								$existing_ids[] = $row[0];
+							}
+
+							$new_ids = array_diff($ids, $existing_ids);
+
+							foreach ($new_ids as $new_id)
+							{
+								if (!($date = $prepared[1][$new_id]->get_date('U')))
+								{
+									$date = time();
+								}
+
+								if (!mysql_query('INSERT INTO `' . $this->options['prefix'][0] . 'items` (`feed_id`, `id`, `data`, `posted`) VALUES(' . $feed_id . ', \'' . mysql_real_escape_string($new_id) . '\', \'' . mysql_real_escape_string(serialize($prepared[1][$new_id]->data)) . '\', ' . $date . ')', $this->mysql))
+								{
+									return false;
+								}
+							}
+							return true;
+						}
+					}
+					else
+					{
+						return true;
+					}
+				}
+			}
+			elseif ($query = mysql_query('SELECT `id` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = ' . $feed_id, $this->mysql))
+			{
+				if (mysql_num_rows($query))
+				{
+					if (mysql_query('UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `items` = 0, `data` = \'' . mysql_real_escape_string(serialize($data)) . '\', `mtime` = ' . time() . ' WHERE `id` = ' . $feed_id, $this->mysql))
+					{
+						return true;
+					}
+				}
+				elseif (mysql_query('INSERT INTO `' . $this->options['prefix'][0] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(\'' . mysql_real_escape_string($this->id) . '\', 0, \'' . mysql_real_escape_string(serialize($data)) . '\', ' . time() . ')', $this->mysql))
+				{
+					return true;
+				}
+			}
+		}
+		return false;
+	}
+
+	function load()
+	{
+		if ($this->mysql && ($query = mysql_query('SELECT `items`, `data` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && ($row = mysql_fetch_row($query)))
+		{
+			$data = unserialize($row[1]);
+
+			if (isset($this->options['items'][0]))
+			{
+				$items = (int) $this->options['items'][0];
+			}
+			else
+			{
+				$items = (int) $row[0];
+			}
+
+			if ($items !== 0)
+			{
+				if (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]))
+				{
+					$feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0];
+				}
+				elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]))
+				{
+					$feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0];
+				}
+				elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]))
+				{
+					$feed =& $data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0];
+				}
+				elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]))
+				{
+					$feed =& $data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0];
+				}
+				else
+				{
+					$feed = null;
+				}
+
+				if ($feed !== null)
+				{
+					$sql = 'SELECT `data` FROM `' . $this->options['prefix'][0] . 'items` WHERE `feed_id` = \'' . mysql_real_escape_string($this->id) . '\' ORDER BY `posted` DESC';
+					if ($items > 0)
+					{
+						$sql .= ' LIMIT ' . $items;
+					}
+
+					if ($query = mysql_unbuffered_query($sql, $this->mysql))
+					{
+						while ($row = mysql_fetch_row($query))
+						{
+							$feed['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry'][] = unserialize($row[0]);
+						}
+					}
+					else
+					{
+						return false;
+					}
+				}
+			}
+			return $data;
+		}
+		return false;
+	}
+
+	function mtime()
+	{
+		if ($this->mysql && ($query = mysql_query('SELECT `mtime` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && ($row = mysql_fetch_row($query)))
+		{
+			return $row[0];
+		}
+		else
+		{
+			return false;
+		}
+	}
+
+	function touch()
+	{
+		if ($this->mysql && ($query = mysql_query('UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `mtime` = ' . time() . ' WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && mysql_affected_rows($this->mysql))
+		{
+			return true;
+		}
+		else
+		{
+			return false;
+		}
+	}
+
+	function unlink()
+	{
+		if ($this->mysql && ($query = mysql_query('DELETE FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && ($query2 = mysql_query('DELETE FROM `' . $this->options['prefix'][0] . 'items` WHERE `feed_id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)))
+		{
+			return true;
+		}
+		else
+		{
+			return false;
+		}
+	}
+}
+
+class SimplePie_Misc
+{
+	function time_hms($seconds)
+	{
+		$time = '';
+
+		$hours = floor($seconds / 3600);
+		$remainder = $seconds % 3600;
+		if ($hours > 0)
+		{
+			$time .= $hours.':';
+		}
+
+		$minutes = floor($remainder / 60);
+		$seconds = $remainder % 60;
+		if ($minutes < 10 && $hours > 0)
+		{
+			$minutes = '0' . $minutes;
+		}
+		if ($seconds < 10)
+		{
+			$seconds = '0' . $seconds;
+		}
+
+		$time .= $minutes.':';
+		$time .= $seconds;
+
+		return $time;
+	}
+
+	function absolutize_url($relative, $base)
+	{
+		$iri = SimplePie_IRI::absolutize(new SimplePie_IRI($base), $relative);
+		return $iri->get_iri();
+	}
+
+	function remove_dot_segments($input)
+	{
+		$output = '';
+		while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..')
+		{
+			// A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise,
+			if (strpos($input, '../') === 0)
+			{
+				$input = substr($input, 3);
+			}
+			elseif (strpos($input, './') === 0)
+			{
+				$input = substr($input, 2);
+			}
+			// B: if the input buffer begins with a prefix of "/./" or "/.", where "." is a complete path segment, then replace that prefix with "/" in the input buffer; otherwise,
+			elseif (strpos($input, '/./') === 0)
+			{
+				$input = substr_replace($input, '/', 0, 3);
+			}
+			elseif ($input === '/.')
+			{
+				$input = '/';
+			}
+			// C: if the input buffer begins with a prefix of "/../" or "/..", where ".." is a complete path segment, then replace that prefix with "/" in the input buffer and remove the last segment and its preceding "/" (if any) from the output buffer; otherwise,
+			elseif (strpos($input, '/../') === 0)
+			{
+				$input = substr_replace($input, '/', 0, 4);
+				$output = substr_replace($output, '', strrpos($output, '/'));
+			}
+			elseif ($input === '/..')
+			{
+				$input = '/';
+				$output = substr_replace($output, '', strrpos($output, '/'));
+			}
+			// D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise,
+			elseif ($input === '.' || $input === '..')
+			{
+				$input = '';
+			}
+			// E: move the first path segment in the input buffer to the end of the output buffer, including the initial "/" character (if any) and any subsequent characters up to, but not including, the next "/" character or the end of the input buffer
+			elseif (($pos = strpos($input, '/', 1)) !== false)
+			{
+				$output .= substr($input, 0, $pos);
+				$input = substr_replace($input, '', 0, $pos);
+			}
+			else
+			{
+				$output .= $input;
+				$input = '';
+			}
+		}
+		return $output . $input;
+	}
+
+	function get_element($realname, $string)
+	{
+		$return = array();
+		$name = preg_quote($realname, '/');
+		if (preg_match_all("/<($name)" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . "(>(.*)<\/$name>|(\/)?>)/siU", $string, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE))
+		{
+			for ($i = 0, $total_matches = count($matches); $i < $total_matches; $i++)
+			{
+				$return[$i]['tag'] = $realname;
+				$return[$i]['full'] = $matches[$i][0][0];
+				$return[$i]['offset'] = $matches[$i][0][1];
+				if (strlen($matches[$i][3][0]) <= 2)
+				{
+					$return[$i]['self_closing'] = true;
+				}
+				else
+				{
+					$return[$i]['self_closing'] = false;
+					$return[$i]['content'] = $matches[$i][4][0];
+				}
+				$return[$i]['attribs'] = array();
+				if (isset($matches[$i][2][0]) && preg_match_all('/[\x09\x0A\x0B\x0C\x0D\x20]+([^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*)(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"([^"]*)"|\'([^\']*)\'|([^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?/', ' ' . $matches[$i][2][0] . ' ', $attribs, PREG_SET_ORDER))
+				{
+					for ($j = 0, $total_attribs = count($attribs); $j < $total_attribs; $j++)
+					{
+						if (count($attribs[$j]) === 2)
+						{
+							$attribs[$j][2] = $attribs[$j][1];
+						}
+						$return[$i]['attribs'][strtolower($attribs[$j][1])]['data'] = SimplePie_Misc::entities_decode(end($attribs[$j]), 'UTF-8');
+					}
+				}
+			}
+		}
+		return $return;
+	}
+
+	function element_implode($element)
+	{
+		$full = "<$element[tag]";
+		foreach ($element['attribs'] as $key => $value)
+		{
+			$key = strtolower($key);
+			$full .= " $key=\"" . htmlspecialchars($value['data']) . '"';
+		}
+		if ($element['self_closing'])
+		{
+			$full .= ' />';
+		}
+		else
+		{
+			$full .= ">$element[content]</$element[tag]>";
+		}
+		return $full;
+	}
+
+	function error($message, $level, $file, $line)
+	{
+		if ((ini_get('error_reporting') & $level) > 0)
+		{
+			switch ($level)
+			{
+				case E_USER_ERROR:
+					$note = 'PHP Error';
+					break;
+				case E_USER_WARNING:
+					$note = 'PHP Warning';
+					break;
+				case E_USER_NOTICE:
+					$note = 'PHP Notice';
+					break;
+				default:
+					$note = 'Unknown Error';
+					break;
+			}
+
+			$log_error = true;
+			if (!function_exists('error_log'))
+			{
+				$log_error = false;
+			}
+
+			$log_file = @ini_get('error_log');
+			if (!empty($log_file) && ('syslog' != $log_file) && !@is_writable($log_file))
+			{
+				$log_error = false;
+			}
+
+			if ($log_error)
+			{
+				@error_log("$note: $message in $file on line $line", 0);
+			}
+		}
+
+		return $message;
+	}
+
+	/**
+	 * If a file has been cached, retrieve and display it.
+	 *
+	 * This is most useful for caching images (get_favicon(), etc.),
+	 * however it works for all cached files.  This WILL NOT display ANY
+	 * file/image/page/whatever, but rather only display what has already
+	 * been cached by SimplePie.
+	 *
+	 * @access public
+	 * @see SimplePie::get_favicon()
+	 * @param str $identifier_url URL that is used to identify the content.
+	 * This may or may not be the actual URL of the live content.
+	 * @param str $cache_location Location of SimplePie's cache.  Defaults
+	 * to './cache'.
+	 * @param str $cache_extension The file extension that the file was
+	 * cached with.  Defaults to 'spc'.
+	 * @param str $cache_class Name of the cache-handling class being used
+	 * in SimplePie.  Defaults to 'SimplePie_Cache', and should be left
+	 * as-is unless you've overloaded the class.
+	 * @param str $cache_name_function Obsolete. Exists for backwards
+	 * compatibility reasons only.
+	 */
+	function display_cached_file($identifier_url, $cache_location = './cache', $cache_extension = 'spc', $cache_class = 'SimplePie_Cache', $cache_name_function = 'md5')
+	{
+		$cache = call_user_func(array($cache_class, 'create'), $cache_location, $identifier_url, $cache_extension);
+
+		if ($file = $cache->load())
+		{
+			if (isset($file['headers']['content-type']))
+			{
+				header('Content-type:' . $file['headers']['content-type']);
+			}
+			else
+			{
+				header('Content-type: application/octet-stream');
+			}
+			header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days
+			echo $file['body'];
+			exit;
+		}
+
+		die('Cached file for ' . $identifier_url . ' cannot be found.');
+	}
+
+	function fix_protocol($url, $http = 1)
+	{
+		$url = SimplePie_Misc::normalize_url($url);
+		$parsed = SimplePie_Misc::parse_url($url);
+		if ($parsed['scheme'] !== '' && $parsed['scheme'] !== 'http' && $parsed['scheme'] !== 'https')
+		{
+			return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['authority'], $parsed['path'], $parsed['query'], $parsed['fragment']), $http);
+		}
+
+		if ($parsed['scheme'] === '' && $parsed['authority'] === '' && !file_exists($url))
+		{
+			return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['path'], '', $parsed['query'], $parsed['fragment']), $http);
+		}
+
+		if ($http === 2 && $parsed['scheme'] !== '')
+		{
+			return "feed:$url";
+		}
+		elseif ($http === 3 && strtolower($parsed['scheme']) === 'http')
+		{
+			return substr_replace($url, 'podcast', 0, 4);
+		}
+		elseif ($http === 4 && strtolower($parsed['scheme']) === 'http')
+		{
+			return substr_replace($url, 'itpc', 0, 4);
+		}
+		else
+		{
+			return $url;
+		}
+	}
+
+	function parse_url($url)
+	{
+		$iri = new SimplePie_IRI($url);
+		return array(
+			'scheme' => (string) $iri->get_scheme(),
+			'authority' => (string) $iri->get_authority(),
+			'path' => (string) $iri->get_path(),
+			'query' => (string) $iri->get_query(),
+			'fragment' => (string) $iri->get_fragment()
+		);
+	}
+
+	function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '')
+	{
+		$iri = new SimplePie_IRI('');
+		$iri->set_scheme($scheme);
+		$iri->set_authority($authority);
+		$iri->set_path($path);
+		$iri->set_query($query);
+		$iri->set_fragment($fragment);
+		return $iri->get_iri();
+	}
+
+	function normalize_url($url)
+	{
+		$iri = new SimplePie_IRI($url);
+		return $iri->get_iri();
+	}
+
+	function percent_encoding_normalization($match)
+	{
+		$integer = hexdec($match[1]);
+		if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer === 0x2D || $integer === 0x2E || $integer === 0x5F || $integer === 0x7E)
+		{
+			return chr($integer);
+		}
+		else
+		{
+			return strtoupper($match[0]);
+		}
+	}
+
+	/**
+	 * Remove bad UTF-8 bytes
+	 *
+	 * PCRE Pattern to locate bad bytes in a UTF-8 string comes from W3C
+	 * FAQ: Multilingual Forms (modified to include full ASCII range)
+	 *
+	 * @author Geoffrey Sneddon
+	 * @see http://www.w3.org/International/questions/qa-forms-utf-8
+	 * @param string $str String to remove bad UTF-8 bytes from
+	 * @return string UTF-8 string
+	 */
+	function utf8_bad_replace($str)
+	{
+		if (function_exists('iconv') && ($return = @iconv('UTF-8', 'UTF-8//IGNORE', $str)))
+		{
+			return $return;
+		}
+		elseif (function_exists('mb_convert_encoding') && ($return = @mb_convert_encoding($str, 'UTF-8', 'UTF-8')))
+		{
+			return $return;
+		}
+		elseif (preg_match_all('/(?:[\x00-\x7F]|[\xC2-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|\xED[\x80-\x9F][\x80-\xBF]|\xF0[\x90-\xBF][\x80-\xBF]{2}|[\xF1-\xF3][\x80-\xBF]{3}|\xF4[\x80-\x8F][\x80-\xBF]{2})+/', $str, $matches))
+		{
+			return implode("\xEF\xBF\xBD", $matches[0]);
+		}
+		elseif ($str !== '')
+		{
+			return "\xEF\xBF\xBD";
+		}
+		else
+		{
+			return '';
+		}
+	}
+
+	/**
+	 * Converts a Windows-1252 encoded string to a UTF-8 encoded string
+	 *
+	 * @static
+	 * @access public
+	 * @param string $string Windows-1252 encoded string
+	 * @return string UTF-8 encoded string
+	 */
+	function windows_1252_to_utf8($string)
+	{
+		static $convert_table = array("\x80" => "\xE2\x82\xAC", "\x81" => "\xEF\xBF\xBD", "\x82" => "\xE2\x80\x9A", "\x83" => "\xC6\x92", "\x84" => "\xE2\x80\x9E", "\x85" => "\xE2\x80\xA6", "\x86" => "\xE2\x80\xA0", "\x87" => "\xE2\x80\xA1", "\x88" => "\xCB\x86", "\x89" => "\xE2\x80\xB0", "\x8A" => "\xC5\xA0", "\x8B" => "\xE2\x80\xB9", "\x8C" => "\xC5\x92", "\x8D" => "\xEF\xBF\xBD", "\x8E" => "\xC5\xBD", "\x8F" => "\xEF\xBF\xBD", "\x90" => "\xEF\xBF\xBD", "\x91" => "\xE2\x80\x98", "\x92" => "\xE2\x80\x99", "\x93" => "\xE2\x80\x9C", "\x94" => "\xE2\x80\x9D", "\x95" => "\xE2\x80\xA2", "\x96" => "\xE2\x80\x93", "\x97" => "\xE2\x80\x94", "\x98" => "\xCB\x9C", "\x99" => "\xE2\x84\xA2", "\x9A" => "\xC5\xA1", "\x9B" => "\xE2\x80\xBA", "\x9C" => "\xC5\x93", "\x9D" => "\xEF\xBF\xBD", "\x9E" => "\xC5\xBE", "\x9F" => "\xC5\xB8", "\xA0" => "\xC2\xA0", "\xA1" => "\xC2\xA1", "\xA2" => "\xC2\xA2", "\xA3" => "\xC2\xA3", "\xA4" => "\xC2\xA4", "\xA5" => "\xC2\xA5", "\xA6" => "\xC2\xA6", "\xA7" => "\xC2\xA7", "\xA8" => "\xC2\xA8", "\xA9" => "\xC2\xA9", "\xAA" => "\xC2\xAA", "\xAB" => "\xC2\xAB", "\xAC" => "\xC2\xAC", "\xAD" => "\xC2\xAD", "\xAE" => "\xC2\xAE", "\xAF" => "\xC2\xAF", "\xB0" => "\xC2\xB0", "\xB1" => "\xC2\xB1", "\xB2" => "\xC2\xB2", "\xB3" => "\xC2\xB3", "\xB4" => "\xC2\xB4", "\xB5" => "\xC2\xB5", "\xB6" => "\xC2\xB6", "\xB7" => "\xC2\xB7", "\xB8" => "\xC2\xB8", "\xB9" => "\xC2\xB9", "\xBA" => "\xC2\xBA", "\xBB" => "\xC2\xBB", "\xBC" => "\xC2\xBC", "\xBD" => "\xC2\xBD", "\xBE" => "\xC2\xBE", "\xBF" => "\xC2\xBF", "\xC0" => "\xC3\x80", "\xC1" => "\xC3\x81", "\xC2" => "\xC3\x82", "\xC3" => "\xC3\x83", "\xC4" => "\xC3\x84", "\xC5" => "\xC3\x85", "\xC6" => "\xC3\x86", "\xC7" => "\xC3\x87", "\xC8" => "\xC3\x88", "\xC9" => "\xC3\x89", "\xCA" => "\xC3\x8A", "\xCB" => "\xC3\x8B", "\xCC" => "\xC3\x8C", "\xCD" => "\xC3\x8D", "\xCE" => "\xC3\x8E", "\xCF" => "\xC3\x8F", "\xD0" => "\xC3\x90", "\xD1" => "\xC3\x91", "\xD2" => "\xC3\x92", "\xD3" => "\xC3\x93", "\xD4" => "\xC3\x94", "\xD5" => "\xC3\x95", "\xD6" => "\xC3\x96", "\xD7" => "\xC3\x97", "\xD8" => "\xC3\x98", "\xD9" => "\xC3\x99", "\xDA" => "\xC3\x9A", "\xDB" => "\xC3\x9B", "\xDC" => "\xC3\x9C", "\xDD" => "\xC3\x9D", "\xDE" => "\xC3\x9E", "\xDF" => "\xC3\x9F", "\xE0" => "\xC3\xA0", "\xE1" => "\xC3\xA1", "\xE2" => "\xC3\xA2", "\xE3" => "\xC3\xA3", "\xE4" => "\xC3\xA4", "\xE5" => "\xC3\xA5", "\xE6" => "\xC3\xA6", "\xE7" => "\xC3\xA7", "\xE8" => "\xC3\xA8", "\xE9" => "\xC3\xA9", "\xEA" => "\xC3\xAA", "\xEB" => "\xC3\xAB", "\xEC" => "\xC3\xAC", "\xED" => "\xC3\xAD", "\xEE" => "\xC3\xAE", "\xEF" => "\xC3\xAF", "\xF0" => "\xC3\xB0", "\xF1" => "\xC3\xB1", "\xF2" => "\xC3\xB2", "\xF3" => "\xC3\xB3", "\xF4" => "\xC3\xB4", "\xF5" => "\xC3\xB5", "\xF6" => "\xC3\xB6", "\xF7" => "\xC3\xB7", "\xF8" => "\xC3\xB8", "\xF9" => "\xC3\xB9", "\xFA" => "\xC3\xBA", "\xFB" => "\xC3\xBB", "\xFC" => "\xC3\xBC", "\xFD" => "\xC3\xBD", "\xFE" => "\xC3\xBE", "\xFF" => "\xC3\xBF");
+
+		return strtr($string, $convert_table);
+	}
+
+	function change_encoding($data, $input, $output)
+	{
+		$input = SimplePie_Misc::encoding($input);
+		$output = SimplePie_Misc::encoding($output);
+
+		// We fail to fail on non US-ASCII bytes
+		if ($input === 'US-ASCII')
+		{
+			static $non_ascii_octects = '';
+			if (!$non_ascii_octects)
+			{
+				for ($i = 0x80; $i <= 0xFF; $i++)
+				{
+					$non_ascii_octects .= chr($i);
+				}
+			}
+			$data = substr($data, 0, strcspn($data, $non_ascii_octects));
+		}
+
+		// This is first, as behaviour of this is completely predictable
+		if ($input === 'Windows-1252' && $output === 'UTF-8')
+		{
+			return SimplePie_Misc::windows_1252_to_utf8($data);
+		}
+		// This is second, as behaviour of this varies only with PHP version (the middle part of this expression checks the encoding is supported).
+		elseif (function_exists('mb_convert_encoding') && @mb_convert_encoding("\x80", 'UTF-16BE', $input) !== "\x00\x80" && ($return = @mb_convert_encoding($data, $output, $input)))
+		{
+			return $return;
+		}
+		// This is last, as behaviour of this varies with OS userland and PHP version
+		elseif (function_exists('iconv') && ($return = @iconv($input, $output, $data)))
+		{
+			return $return;
+		}
+		// If we can't do anything, just fail
+		else
+		{
+			return false;
+		}
+	}
+
+	function encoding($charset)
+	{
+		// Normalization from UTS #22
+		switch (strtolower(preg_replace('/(?:[^a-zA-Z0-9]+|([^0-9])0+)/', '\1', $charset)))
+		{
+			case 'adobestandardencoding':
+			case 'csadobestandardencoding':
+				return 'Adobe-Standard-Encoding';
+
+			case 'adobesymbolencoding':
+			case 'cshppsmath':
+				return 'Adobe-Symbol-Encoding';
+
+			case 'ami1251':
+			case 'amiga1251':
+				return 'Amiga-1251';
+
+			case 'ansix31101983':
+			case 'csat5001983':
+			case 'csiso99naplps':
+			case 'isoir99':
+			case 'naplps':
+				return 'ANSI_X3.110-1983';
+
+			case 'arabic7':
+			case 'asmo449':
+			case 'csiso89asmo449':
+			case 'iso9036':
+			case 'isoir89':
+				return 'ASMO_449';
+
+			case 'big5':
+			case 'csbig5':
+			case 'xxbig5':
+				return 'Big5';
+
+			case 'big5hkscs':
+				return 'Big5-HKSCS';
+
+			case 'bocu1':
+			case 'csbocu1':
+				return 'BOCU-1';
+
+			case 'brf':
+			case 'csbrf':
+				return 'BRF';
+
+			case 'bs4730':
+			case 'csiso4unitedkingdom':
+			case 'gb':
+			case 'iso646gb':
+			case 'isoir4':
+			case 'uk':
+				return 'BS_4730';
+
+			case 'bsviewdata':
+			case 'csiso47bsviewdata':
+			case 'isoir47':
+				return 'BS_viewdata';
+
+			case 'cesu8':
+			case 'cscesu8':
+				return 'CESU-8';
+
+			case 'ca':
+			case 'csa71':
+			case 'csaz243419851':
+			case 'csiso121canadian1':
+			case 'iso646ca':
+			case 'isoir121':
+				return 'CSA_Z243.4-1985-1';
+
+			case 'csa72':
+			case 'csaz243419852':
+			case 'csiso122canadian2':
+			case 'iso646ca2':
+			case 'isoir122':
+				return 'CSA_Z243.4-1985-2';
+
+			case 'csaz24341985gr':
+			case 'csiso123csaz24341985gr':
+			case 'isoir123':
+				return 'CSA_Z243.4-1985-gr';
+
+			case 'csiso139csn369103':
+			case 'csn369103':
+			case 'isoir139':
+				return 'CSN_369103';
+
+			case 'csdecmcs':
+			case 'dec':
+			case 'decmcs':
+				return 'DEC-MCS';
+
+			case 'csiso21german':
+			case 'de':
+			case 'din66003':
+			case 'iso646de':
+			case 'isoir21':
+				return 'DIN_66003';
+
+			case 'csdkus':
+			case 'dkus':
+				return 'dk-us';
+
+			case 'csiso646danish':
+			case 'dk':
+			case 'ds2089':
+			case 'iso646dk':
+				return 'DS_2089';
+
+			case 'csibmebcdicatde':
+			case 'ebcdicatde':
+				return 'EBCDIC-AT-DE';
+
+			case 'csebcdicatdea':
+			case 'ebcdicatdea':
+				return 'EBCDIC-AT-DE-A';
+
+			case 'csebcdiccafr':
+			case 'ebcdiccafr':
+				return 'EBCDIC-CA-FR';
+
+			case 'csebcdicdkno':
+			case 'ebcdicdkno':
+				return 'EBCDIC-DK-NO';
+
+			case 'csebcdicdknoa':
+			case 'ebcdicdknoa':
+				return 'EBCDIC-DK-NO-A';
+
+			case 'csebcdices':
+			case 'ebcdices':
+				return 'EBCDIC-ES';
+
+			case 'csebcdicesa':
+			case 'ebcdicesa':
+				return 'EBCDIC-ES-A';
+
+			case 'csebcdicess':
+			case 'ebcdicess':
+				return 'EBCDIC-ES-S';
+
+			case 'csebcdicfise':
+			case 'ebcdicfise':
+				return 'EBCDIC-FI-SE';
+
+			case 'csebcdicfisea':
+			case 'ebcdicfisea':
+				return 'EBCDIC-FI-SE-A';
+
+			case 'csebcdicfr':
+			case 'ebcdicfr':
+				return 'EBCDIC-FR';
+
+			case 'csebcdicit':
+			case 'ebcdicit':
+				return 'EBCDIC-IT';
+
+			case 'csebcdicpt':
+			case 'ebcdicpt':
+				return 'EBCDIC-PT';
+
+			case 'csebcdicuk':
+			case 'ebcdicuk':
+				return 'EBCDIC-UK';
+
+			case 'csebcdicus':
+			case 'ebcdicus':
+				return 'EBCDIC-US';
+
+			case 'csiso111ecmacyrillic':
+			case 'ecmacyrillic':
+			case 'isoir111':
+			case 'koi8e':
+				return 'ECMA-cyrillic';
+
+			case 'csiso17spanish':
+			case 'es':
+			case 'iso646es':
+			case 'isoir17':
+				return 'ES';
+
+			case 'csiso85spanish2':
+			case 'es2':
+			case 'iso646es2':
+			case 'isoir85':
+				return 'ES2';
+
+			case 'cseucfixwidjapanese':
+			case 'extendedunixcodefixedwidthforjapanese':
+				return 'Extended_UNIX_Code_Fixed_Width_for_Japanese';
+
+			case 'cseucpkdfmtjapanese':
+			case 'eucjp':
+			case 'extendedunixcodepackedformatforjapanese':
+				return 'Extended_UNIX_Code_Packed_Format_for_Japanese';
+
+			case 'gb18030':
+				return 'GB18030';
+
+			case 'chinese':
+			case 'cp936':
+			case 'csgb2312':
+			case 'csiso58gb231280':
+			case 'gb2312':
+			case 'gb231280':
+			case 'gbk':
+			case 'isoir58':
+			case 'ms936':
+			case 'windows936':
+				return 'GBK';
+
+			case 'cn':
+			case 'csiso57gb1988':
+			case 'gb198880':
+			case 'iso646cn':
+			case 'isoir57':
+				return 'GB_1988-80';
+
+			case 'csiso153gost1976874':
+			case 'gost1976874':
+			case 'isoir153':
+			case 'stsev35888':
+				return 'GOST_19768-74';
+
+			case 'csiso150':
+			case 'csiso150greekccitt':
+			case 'greekccitt':
+			case 'isoir150':
+				return 'greek-ccitt';
+
+			case 'csiso88greek7':
+			case 'greek7':
+			case 'isoir88':
+				return 'greek7';
+
+			case 'csiso18greek7old':
+			case 'greek7old':
+			case 'isoir18':
+				return 'greek7-old';
+
+			case 'cshpdesktop':
+			case 'hpdesktop':
+				return 'HP-DeskTop';
+
+			case 'cshplegal':
+			case 'hplegal':
+				return 'HP-Legal';
+
+			case 'cshpmath8':
+			case 'hpmath8':
+				return 'HP-Math8';
+
+			case 'cshppifont':
+			case 'hppifont':
+				return 'HP-Pi-font';
+
+			case 'cshproman8':
+			case 'hproman8':
+			case 'r8':
+			case 'roman8':
+				return 'hp-roman8';
+
+			case 'hzgb2312':
+				return 'HZ-GB-2312';
+
+			case 'csibmsymbols':
+			case 'ibmsymbols':
+				return 'IBM-Symbols';
+
+			case 'csibmthai':
+			case 'ibmthai':
+				return 'IBM-Thai';
+
+			case 'ccsid858':
+			case 'cp858':
+			case 'ibm858':
+			case 'pcmultilingual850euro':
+				return 'IBM00858';
+
+			case 'ccsid924':
+			case 'cp924':
+			case 'ebcdiclatin9euro':
+			case 'ibm924':
+				return 'IBM00924';
+
+			case 'ccsid1140':
+			case 'cp1140':
+			case 'ebcdicus37euro':
+			case 'ibm1140':
+				return 'IBM01140';
+
+			case 'ccsid1141':
+			case 'cp1141':
+			case 'ebcdicde273euro':
+			case 'ibm1141':
+				return 'IBM01141';
+
+			case 'ccsid1142':
+			case 'cp1142':
+			case 'ebcdicdk277euro':
+			case 'ebcdicno277euro':
+			case 'ibm1142':
+				return 'IBM01142';
+
+			case 'ccsid1143':
+			case 'cp1143':
+			case 'ebcdicfi278euro':
+			case 'ebcdicse278euro':
+			case 'ibm1143':
+				return 'IBM01143';
+
+			case 'ccsid1144':
+			case 'cp1144':
+			case 'ebcdicit280euro':
+			case 'ibm1144':
+				return 'IBM01144';
+
+			case 'ccsid1145':
+			case 'cp1145':
+			case 'ebcdices284euro':
+			case 'ibm1145':
+				return 'IBM01145';
+
+			case 'ccsid1146':
+			case 'cp1146':
+			case 'ebcdicgb285euro':
+			case 'ibm1146':
+				return 'IBM01146';
+
+			case 'ccsid1147':
+			case 'cp1147':
+			case 'ebcdicfr297euro':
+			case 'ibm1147':
+				return 'IBM01147';
+
+			case 'ccsid1148':
+			case 'cp1148':
+			case 'ebcdicinternational500euro':
+			case 'ibm1148':
+				return 'IBM01148';
 
-			case 'INVARIANT':
-			case 'CSINVARIANT':
-				return 'INVARIANT';
+			case 'ccsid1149':
+			case 'cp1149':
+			case 'ebcdicis871euro':
+			case 'ibm1149':
+				return 'IBM01149';
 
-			case 'ISO_646.IRV:1983':
-			case 'ISO-IR-2':
-			case 'IRV':
-			case 'CSISO2INTLREFVERSION':
-				return 'ISO_646.irv:1983';
+			case 'cp37':
+			case 'csibm37':
+			case 'ebcdiccpca':
+			case 'ebcdiccpnl':
+			case 'ebcdiccpus':
+			case 'ebcdiccpwt':
+			case 'ibm37':
+				return 'IBM037';
 
-			case 'NATS-SEFI':
-			case 'ISO-IR-8-1':
-			case 'CSNATSSEFI':
-				return 'NATS-SEFI';
+			case 'cp38':
+			case 'csibm38':
+			case 'ebcdicint':
+			case 'ibm38':
+				return 'IBM038';
 
-			case 'NATS-SEFI-ADD':
-			case 'ISO-IR-8-2':
-			case 'CSNATSSEFIADD':
-				return 'NATS-SEFI-ADD';
+			case 'cp273':
+			case 'csibm273':
+			case 'ibm273':
+				return 'IBM273';
 
-			case 'NATS-DANO':
-			case 'ISO-IR-9-1':
-			case 'CSNATSDANO':
-				return 'NATS-DANO';
+			case 'cp274':
+			case 'csibm274':
+			case 'ebcdicbe':
+			case 'ibm274':
+				return 'IBM274';
 
-			case 'NATS-DANO-ADD':
-			case 'ISO-IR-9-2':
-			case 'CSNATSDANOADD':
-				return 'NATS-DANO-ADD';
+			case 'cp275':
+			case 'csibm275':
+			case 'ebcdicbr':
+			case 'ibm275':
+				return 'IBM275';
 
-			case 'SEN_850200_B':
-			case 'ISO-IR-10':
-			case 'FI':
-			case 'ISO646-FI':
-			case 'ISO646-SE':
-			case 'SE':
-			case 'CSISO10SWEDISH':
-				return 'SEN_850200_B';
+			case 'csibm277':
+			case 'ebcdiccpdk':
+			case 'ebcdiccpno':
+			case 'ibm277':
+				return 'IBM277';
 
-			case 'KS_C_5601-1987':
-			case 'ISO-IR-149':
-			case 'KS_C_5601-1989':
-			case 'KSC_5601':
-			case 'KOREAN':
-			case 'CSKSC56011987':
-				return 'KS_C_5601-1987';
+			case 'cp278':
+			case 'csibm278':
+			case 'ebcdiccpfi':
+			case 'ebcdiccpse':
+			case 'ibm278':
+				return 'IBM278';
 
-			case 'ISO-2022-KR':
-			case 'CSISO2022KR':
-				return 'ISO-2022-KR';
+			case 'cp280':
+			case 'csibm280':
+			case 'ebcdiccpit':
+			case 'ibm280':
+				return 'IBM280';
 
-			case 'EUC-KR':
-			case 'CSEUCKR':
-				return 'EUC-KR';
+			case 'cp281':
+			case 'csibm281':
+			case 'ebcdicjpe':
+			case 'ibm281':
+				return 'IBM281';
 
-			case 'ISO-2022-JP':
-			case 'CSISO2022JP':
-				return 'ISO-2022-JP';
+			case 'cp284':
+			case 'csibm284':
+			case 'ebcdiccpes':
+			case 'ibm284':
+				return 'IBM284';
 
-			case 'ISO-2022-JP-2':
-			case 'CSISO2022JP2':
-				return 'ISO-2022-JP-2';
+			case 'cp285':
+			case 'csibm285':
+			case 'ebcdiccpgb':
+			case 'ibm285':
+				return 'IBM285';
 
-			case 'JIS_C6220-1969-JP':
-			case 'JIS_C6220-1969':
-			case 'ISO-IR-13':
-			case 'KATAKANA':
-			case 'X0201-7':
-			case 'CSISO13JISC6220JP':
-				return 'JIS_C6220-1969-jp';
+			case 'cp290':
+			case 'csibm290':
+			case 'ebcdicjpkana':
+			case 'ibm290':
+				return 'IBM290';
 
-			case 'JIS_C6220-1969-RO':
-			case 'ISO-IR-14':
-			case 'JP':
-			case 'ISO646-JP':
-			case 'CSISO14JISC6220RO':
-				return 'JIS_C6220-1969-ro';
+			case 'cp297':
+			case 'csibm297':
+			case 'ebcdiccpfr':
+			case 'ibm297':
+				return 'IBM297';
 
-			case 'PT':
-			case 'ISO-IR-16':
-			case 'ISO646-PT':
-			case 'CSISO16PORTUGUESE':
-				return 'PT';
+			case 'cp420':
+			case 'csibm420':
+			case 'ebcdiccpar1':
+			case 'ibm420':
+				return 'IBM420';
 
-			case 'GREEK7-OLD':
-			case 'ISO-IR-18':
-			case 'CSISO18GREEK7OLD':
-				return 'greek7-old';
+			case 'cp423':
+			case 'csibm423':
+			case 'ebcdiccpgr':
+			case 'ibm423':
+				return 'IBM423';
 
-			case 'LATIN-GREEK':
-			case 'ISO-IR-19':
-			case 'CSISO19LATINGREEK':
-				return 'latin-greek';
+			case 'cp424':
+			case 'csibm424':
+			case 'ebcdiccphe':
+			case 'ibm424':
+				return 'IBM424';
 
-			case 'NF_Z_62-010_(1973)':
-			case 'ISO-IR-25':
-			case 'ISO646-FR1':
-			case 'CSISO25FRENCH':
-				return 'NF_Z_62-010_(1973)';
+			case '437':
+			case 'cp437':
+			case 'cspc8codepage437':
+			case 'ibm437':
+				return 'IBM437';
 
-			case 'LATIN-GREEK-1':
-			case 'ISO-IR-27':
-			case 'CSISO27LATINGREEK1':
-				return 'Latin-greek-1';
+			case 'cp500':
+			case 'csibm500':
+			case 'ebcdiccpbe':
+			case 'ebcdiccpch':
+			case 'ibm500':
+				return 'IBM500';
 
-			case 'ISO_5427':
-			case 'ISO-IR-37':
-			case 'CSISO5427CYRILLIC':
-				return 'ISO_5427';
+			case 'cp775':
+			case 'cspc775baltic':
+			case 'ibm775':
+				return 'IBM775';
 
-			case 'JIS_C6226-1978':
-			case 'ISO-IR-42':
-			case 'CSISO42JISC62261978':
-				return 'JIS_C6226-1978';
+			case '850':
+			case 'cp850':
+			case 'cspc850multilingual':
+			case 'ibm850':
+				return 'IBM850';
 
-			case 'BS_VIEWDATA':
-			case 'ISO-IR-47':
-			case 'CSISO47BSVIEWDATA':
-				return 'BS_viewdata';
+			case '851':
+			case 'cp851':
+			case 'csibm851':
+			case 'ibm851':
+				return 'IBM851';
 
-			case 'INIS':
-			case 'ISO-IR-49':
-			case 'CSISO49INIS':
-				return 'INIS';
+			case '852':
+			case 'cp852':
+			case 'cspcp852':
+			case 'ibm852':
+				return 'IBM852';
 
-			case 'INIS-8':
-			case 'ISO-IR-50':
-			case 'CSISO50INIS8':
-				return 'INIS-8';
+			case '855':
+			case 'cp855':
+			case 'csibm855':
+			case 'ibm855':
+				return 'IBM855';
 
-			case 'INIS-CYRILLIC':
-			case 'ISO-IR-51':
-			case 'CSISO51INISCYRILLIC':
-				return 'INIS-cyrillic';
+			case '857':
+			case 'cp857':
+			case 'csibm857':
+			case 'ibm857':
+				return 'IBM857';
 
-			case 'ISO_5427:1981':
-			case 'ISO-IR-54':
-			case 'ISO5427CYRILLIC1981':
-				return 'ISO_5427:1981';
+			case '860':
+			case 'cp860':
+			case 'csibm860':
+			case 'ibm860':
+				return 'IBM860';
 
-			case 'ISO_5428:1980':
-			case 'ISO-IR-55':
-			case 'CSISO5428GREEK':
-				return 'ISO_5428:1980';
+			case '861':
+			case 'cp861':
+			case 'cpis':
+			case 'csibm861':
+			case 'ibm861':
+				return 'IBM861';
 
-			case 'GB_1988-80':
-			case 'ISO-IR-57':
-			case 'CN':
-			case 'ISO646-CN':
-			case 'CSISO57GB1988':
-				return 'GB_1988-80';
+			case '862':
+			case 'cp862':
+			case 'cspc862latinhebrew':
+			case 'ibm862':
+				return 'IBM862';
 
-			case 'GB_2312-80':
-			case 'ISO-IR-58':
-			case 'CHINESE':
-			case 'CSISO58GB231280':
-				return 'GB_2312-80';
-
-			case 'NS_4551-2':
-			case 'ISO646-NO2':
-			case 'ISO-IR-61':
-			case 'NO2':
-			case 'CSISO61NORWEGIAN2':
-				return 'NS_4551-2';
+			case '863':
+			case 'cp863':
+			case 'csibm863':
+			case 'ibm863':
+				return 'IBM863';
 
-			case 'VIDEOTEX-SUPPL':
-			case 'ISO-IR-70':
-			case 'CSISO70VIDEOTEXSUPP1':
-				return 'videotex-suppl';
+			case 'cp864':
+			case 'csibm864':
+			case 'ibm864':
+				return 'IBM864';
 
-			case 'PT2':
-			case 'ISO-IR-84':
-			case 'ISO646-PT2':
-			case 'CSISO84PORTUGUESE2':
-				return 'PT2';
+			case '865':
+			case 'cp865':
+			case 'csibm865':
+			case 'ibm865':
+				return 'IBM865';
 
-			case 'ES2':
-			case 'ISO-IR-85':
-			case 'ISO646-ES2':
-			case 'CSISO85SPANISH2':
-				return 'ES2';
+			case '866':
+			case 'cp866':
+			case 'csibm866':
+			case 'ibm866':
+				return 'IBM866';
 
-			case 'MSZ_7795.3':
-			case 'ISO-IR-86':
-			case 'ISO646-HU':
-			case 'HU':
-			case 'CSISO86HUNGARIAN':
-				return 'MSZ_7795.3';
+			case 'cp868':
+			case 'cpar':
+			case 'csibm868':
+			case 'ibm868':
+				return 'IBM868';
 
-			case 'JIS_C6226-1983':
-			case 'ISO-IR-87':
-			case 'X0208':
-			case 'JIS_X0208-1983':
-			case 'CSISO87JISX0208':
-				return 'JIS_C6226-1983';
+			case '869':
+			case 'cp869':
+			case 'cpgr':
+			case 'csibm869':
+			case 'ibm869':
+				return 'IBM869';
 
-			case 'GREEK7':
-			case 'ISO-IR-88':
-			case 'CSISO88GREEK7':
-				return 'greek7';
+			case 'cp870':
+			case 'csibm870':
+			case 'ebcdiccproece':
+			case 'ebcdiccpyu':
+			case 'ibm870':
+				return 'IBM870';
 
-			case 'ASMO_449':
-			case 'ISO_9036':
-			case 'ARABIC7':
-			case 'ISO-IR-89':
-			case 'CSISO89ASMO449':
-				return 'ASMO_449';
+			case 'cp871':
+			case 'csibm871':
+			case 'ebcdiccpis':
+			case 'ibm871':
+				return 'IBM871';
 
-			case 'ISO-IR-90':
-			case 'CSISO90':
-				return 'iso-ir-90';
+			case 'cp880':
+			case 'csibm880':
+			case 'ebcdiccyrillic':
+			case 'ibm880':
+				return 'IBM880';
 
-			case 'JIS_C6229-1984-A':
-			case 'ISO-IR-91':
-			case 'JP-OCR-A':
-			case 'CSISO91JISC62291984A':
-				return 'JIS_C6229-1984-a';
+			case 'cp891':
+			case 'csibm891':
+			case 'ibm891':
+				return 'IBM891';
 
-			case 'JIS_C6229-1984-B':
-			case 'ISO-IR-92':
-			case 'ISO646-JP-OCR-B':
-			case 'JP-OCR-B':
-			case 'CSISO92JISC62991984B':
-				return 'JIS_C6229-1984-b';
+			case 'cp903':
+			case 'csibm903':
+			case 'ibm903':
+				return 'IBM903';
 
-			case 'JIS_C6229-1984-B-ADD':
-			case 'ISO-IR-93':
-			case 'JP-OCR-B-ADD':
-			case 'CSISO93JIS62291984BADD':
-				return 'JIS_C6229-1984-b-add';
+			case '904':
+			case 'cp904':
+			case 'csibbm904':
+			case 'ibm904':
+				return 'IBM904';
 
-			case 'JIS_C6229-1984-HAND':
-			case 'ISO-IR-94':
-			case 'JP-OCR-HAND':
-			case 'CSISO94JIS62291984HAND':
-				return 'JIS_C6229-1984-hand';
+			case 'cp905':
+			case 'csibm905':
+			case 'ebcdiccptr':
+			case 'ibm905':
+				return 'IBM905';
 
-			case 'JIS_C6229-1984-HAND-ADD':
-			case 'ISO-IR-95':
-			case 'JP-OCR-HAND-ADD':
-			case 'CSISO95JIS62291984HANDADD':
-				return 'JIS_C6229-1984-hand-add';
+			case 'cp918':
+			case 'csibm918':
+			case 'ebcdiccpar2':
+			case 'ibm918':
+				return 'IBM918';
 
-			case 'JIS_C6229-1984-KANA':
-			case 'ISO-IR-96':
-			case 'CSISO96JISC62291984KANA':
-				return 'JIS_C6229-1984-kana';
+			case 'cp1026':
+			case 'csibm1026':
+			case 'ibm1026':
+				return 'IBM1026';
 
-			case 'ISO_2033-1983':
-			case 'ISO-IR-98':
-			case 'E13B':
-			case 'CSISO2033':
-				return 'ISO_2033-1983';
+			case 'ibm1047':
+				return 'IBM1047';
 
-			case 'ANSI_X3.110-1983':
-			case 'ISO-IR-99':
-			case 'CSA_T500-1983':
-			case 'NAPLPS':
-			case 'CSISO99NAPLPS':
-				return 'ANSI_X3.110-1983';
+			case 'csiso143iecp271':
+			case 'iecp271':
+			case 'isoir143':
+				return 'IEC_P27-1';
 
-			case 'T.61-7BIT':
-			case 'ISO-IR-102':
-			case 'CSISO102T617BIT':
-				return 'T.61-7bit';
+			case 'csiso49inis':
+			case 'inis':
+			case 'isoir49':
+				return 'INIS';
 
-			case 'T.61-8BIT':
-			case 'T.61':
-			case 'ISO-IR-103':
-			case 'CSISO103T618BIT':
-				return 'T.61-8bit';
+			case 'csiso50inis8':
+			case 'inis8':
+			case 'isoir50':
+				return 'INIS-8';
 
-			case 'ECMA-CYRILLIC':
-			case 'ISO-IR-111':
-			case 'KOI8-E':
-			case 'CSISO111ECMACYRILLIC':
-				return 'ECMA-cyrillic';
+			case 'csiso51iniscyrillic':
+			case 'iniscyrillic':
+			case 'isoir51':
+				return 'INIS-cyrillic';
 
-			case 'CSA_Z243.4-1985-1':
-			case 'ISO-IR-121':
-			case 'ISO646-CA':
-			case 'CSA7-1':
-			case 'CA':
-			case 'CSISO121CANADIAN1':
-				return 'CSA_Z243.4-1985-1';
+			case 'csinvariant':
+			case 'invariant':
+				return 'INVARIANT';
 
-			case 'CSA_Z243.4-1985-2':
-			case 'ISO-IR-122':
-			case 'ISO646-CA2':
-			case 'CSA7-2':
-			case 'CSISO122CANADIAN2':
-				return 'CSA_Z243.4-1985-2';
+			case 'iso2022cn':
+				return 'ISO-2022-CN';
 
-			case 'CSA_Z243.4-1985-GR':
-			case 'ISO-IR-123':
-			case 'CSISO123CSAZ24341985GR':
-				return 'CSA_Z243.4-1985-gr';
+			case 'iso2022cnext':
+				return 'ISO-2022-CN-EXT';
+
+			case 'csiso2022jp':
+			case 'iso2022jp':
+				return 'ISO-2022-JP';
+
+			case 'csiso2022jp2':
+			case 'iso2022jp2':
+				return 'ISO-2022-JP-2';
+
+			case 'csiso2022kr':
+			case 'iso2022kr':
+				return 'ISO-2022-KR';
+
+			case 'cswindows30latin1':
+			case 'iso88591windows30latin1':
+				return 'ISO-8859-1-Windows-3.0-Latin-1';
+
+			case 'cswindows31latin1':
+			case 'iso88591windows31latin1':
+				return 'ISO-8859-1-Windows-3.1-Latin-1';
+
+			case 'csisolatin2':
+			case 'iso88592':
+			case 'iso885921987':
+			case 'isoir101':
+			case 'l2':
+			case 'latin2':
+				return 'ISO-8859-2';
+
+			case 'cswindows31latin2':
+			case 'iso88592windowslatin2':
+				return 'ISO-8859-2-Windows-Latin-2';
+
+			case 'csisolatin3':
+			case 'iso88593':
+			case 'iso885931988':
+			case 'isoir109':
+			case 'l3':
+			case 'latin3':
+				return 'ISO-8859-3';
+
+			case 'csisolatin4':
+			case 'iso88594':
+			case 'iso885941988':
+			case 'isoir110':
+			case 'l4':
+			case 'latin4':
+				return 'ISO-8859-4';
+
+			case 'csisolatincyrillic':
+			case 'cyrillic':
+			case 'iso88595':
+			case 'iso885951988':
+			case 'isoir144':
+				return 'ISO-8859-5';
+
+			case 'arabic':
+			case 'asmo708':
+			case 'csisolatinarabic':
+			case 'ecma114':
+			case 'iso88596':
+			case 'iso885961987':
+			case 'isoir127':
+				return 'ISO-8859-6';
 
-			case 'ISO_8859-6-E':
-			case 'CSISO88596E':
-			case 'ISO-8859-6-E':
+			case 'csiso88596e':
+			case 'iso88596e':
 				return 'ISO-8859-6-E';
 
-			case 'ISO_8859-6-I':
-			case 'CSISO88596I':
-			case 'ISO-8859-6-I':
+			case 'csiso88596i':
+			case 'iso88596i':
 				return 'ISO-8859-6-I';
 
-			case 'T.101-G2':
-			case 'ISO-IR-128':
-			case 'CSISO128T101G2':
-				return 'T.101-G2';
+			case 'csisolatingreek':
+			case 'ecma118':
+			case 'elot928':
+			case 'greek':
+			case 'greek8':
+			case 'iso88597':
+			case 'iso885971987':
+			case 'isoir126':
+				return 'ISO-8859-7';
+
+			case 'csisolatinhebrew':
+			case 'hebrew':
+			case 'iso88598':
+			case 'iso885981988':
+			case 'isoir138':
+				return 'ISO-8859-8';
 
-			case 'ISO_8859-8-E':
-			case 'CSISO88598E':
-			case 'ISO-8859-8-E':
+			case 'csiso88598e':
+			case 'iso88598e':
 				return 'ISO-8859-8-E';
 
-			case 'ISO_8859-8-I':
-			case 'CSISO88598I':
-			case 'ISO-8859-8-I':
+			case 'csiso88598i':
+			case 'iso88598i':
 				return 'ISO-8859-8-I';
 
-			case 'CSN_369103':
-			case 'ISO-IR-139':
-			case 'CSISO139CSN369103':
-				return 'CSN_369103';
+			case 'cswindows31latin5':
+			case 'iso88599windowslatin5':
+				return 'ISO-8859-9-Windows-Latin-5';
 
-			case 'JUS_I.B1.002':
-			case 'ISO-IR-141':
-			case 'ISO646-YU':
-			case 'JS':
-			case 'YU':
-			case 'CSISO141JUSIB1002':
-				return 'JUS_I.B1.002';
+			case 'csisolatin6':
+			case 'iso885910':
+			case 'iso8859101992':
+			case 'isoir157':
+			case 'l6':
+			case 'latin6':
+				return 'ISO-8859-10';
 
-			case 'IEC_P27-1':
-			case 'ISO-IR-143':
-			case 'CSISO143IECP271':
-				return 'IEC_P27-1';
+			case 'iso885913':
+				return 'ISO-8859-13';
 
-			case 'JUS_I.B1.003-SERB':
-			case 'ISO-IR-146':
-			case 'SERBIAN':
-			case 'CSISO146SERBIAN':
-				return 'JUS_I.B1.003-serb';
+			case 'iso885914':
+			case 'iso8859141998':
+			case 'isoceltic':
+			case 'isoir199':
+			case 'l8':
+			case 'latin8':
+				return 'ISO-8859-14';
 
-			case 'JUS_I.B1.003-MAC':
-			case 'MACEDONIAN':
-			case 'ISO-IR-147':
-			case 'CSISO147MACEDONIAN':
-				return 'JUS_I.B1.003-mac';
+			case 'iso885915':
+			case 'latin9':
+				return 'ISO-8859-15';
 
-			case 'GREEK-CCITT':
-			case 'ISO-IR-150':
-			case 'CSISO150':
-			case 'CSISO150GREEKCCITT':
-				return 'greek-ccitt';
+			case 'iso885916':
+			case 'iso8859162001':
+			case 'isoir226':
+			case 'l10':
+			case 'latin10':
+				return 'ISO-8859-16';
 
-			case 'NC_NC00-10:81':
-			case 'CUBA':
-			case 'ISO-IR-151':
-			case 'ISO646-CU':
-			case 'CSISO151CUBA':
-				return 'NC_NC00-10:81';
+			case 'iso10646j1':
+				return 'ISO-10646-J-1';
+
+			case 'csunicode':
+			case 'iso10646ucs2':
+				return 'ISO-10646-UCS-2';
+
+			case 'csucs4':
+			case 'iso10646ucs4':
+				return 'ISO-10646-UCS-4';
+
+			case 'csunicodeascii':
+			case 'iso10646ucsbasic':
+				return 'ISO-10646-UCS-Basic';
+
+			case 'csunicodelatin1':
+			case 'iso10646':
+			case 'iso10646unicodelatin1':
+				return 'ISO-10646-Unicode-Latin1';
+
+			case 'csiso10646utf1':
+			case 'iso10646utf1':
+				return 'ISO-10646-UTF-1';
+
+			case 'csiso115481':
+			case 'iso115481':
+			case 'isotr115481':
+				return 'ISO-11548-1';
+
+			case 'csiso90':
+			case 'isoir90':
+				return 'iso-ir-90';
+
+			case 'csunicodeibm1261':
+			case 'isounicodeibm1261':
+				return 'ISO-Unicode-IBM-1261';
+
+			case 'csunicodeibm1264':
+			case 'isounicodeibm1264':
+				return 'ISO-Unicode-IBM-1264';
+
+			case 'csunicodeibm1265':
+			case 'isounicodeibm1265':
+				return 'ISO-Unicode-IBM-1265';
+
+			case 'csunicodeibm1268':
+			case 'isounicodeibm1268':
+				return 'ISO-Unicode-IBM-1268';
+
+			case 'csunicodeibm1276':
+			case 'isounicodeibm1276':
+				return 'ISO-Unicode-IBM-1276';
+
+			case 'csiso646basic1983':
+			case 'iso646basic1983':
+			case 'ref':
+				return 'ISO_646.basic:1983';
+
+			case 'csiso2intlrefversion':
+			case 'irv':
+			case 'iso646irv1983':
+			case 'isoir2':
+				return 'ISO_646.irv:1983';
+
+			case 'csiso2033':
+			case 'e13b':
+			case 'iso20331983':
+			case 'isoir98':
+				return 'ISO_2033-1983';
+
+			case 'csiso5427cyrillic':
+			case 'iso5427':
+			case 'isoir37':
+				return 'ISO_5427';
+
+			case 'iso5427cyrillic1981':
+			case 'iso54271981':
+			case 'isoir54':
+				return 'ISO_5427:1981';
+
+			case 'csiso5428greek':
+			case 'iso54281980':
+			case 'isoir55':
+				return 'ISO_5428:1980';
 
-			case 'ISO_6937-2-25':
-			case 'ISO-IR-152':
-			case 'CSISO6937ADD':
+			case 'csiso6937add':
+			case 'iso6937225':
+			case 'isoir152':
 				return 'ISO_6937-2-25';
 
-			case 'GOST_19768-74':
-			case 'ST_SEV_358-88':
-			case 'ISO-IR-153':
-			case 'CSISO153GOST1976874':
-				return 'GOST_19768-74';
+			case 'csisotextcomm':
+			case 'iso69372add':
+			case 'isoir142':
+				return 'ISO_6937-2-add';
 
-			case 'ISO_8859-SUPP':
-			case 'ISO-IR-154':
-			case 'LATIN1-2-5':
-			case 'CSISO8859SUPP':
+			case 'csiso8859supp':
+			case 'iso8859supp':
+			case 'isoir154':
+			case 'latin125':
 				return 'ISO_8859-supp';
 
-			case 'ISO_10367-BOX':
-			case 'ISO-IR-155':
-			case 'CSISO10367BOX':
+			case 'csiso10367box':
+			case 'iso10367box':
+			case 'isoir155':
 				return 'ISO_10367-box';
 
-			case 'LATIN-LAP':
-			case 'LAP':
-			case 'ISO-IR-158':
-			case 'CSISO158LAP':
-				return 'latin-lap';
+			case 'csiso15italian':
+			case 'iso646it':
+			case 'isoir15':
+			case 'it':
+				return 'IT';
+
+			case 'csiso13jisc6220jp':
+			case 'isoir13':
+			case 'jisc62201969':
+			case 'jisc62201969jp':
+			case 'katakana':
+			case 'x2017':
+				return 'JIS_C6220-1969-jp';
+
+			case 'csiso14jisc6220ro':
+			case 'iso646jp':
+			case 'isoir14':
+			case 'jisc62201969ro':
+			case 'jp':
+				return 'JIS_C6220-1969-ro';
+
+			case 'csiso42jisc62261978':
+			case 'isoir42':
+			case 'jisc62261978':
+				return 'JIS_C6226-1978';
+
+			case 'csiso87jisx208':
+			case 'isoir87':
+			case 'jisc62261983':
+			case 'jisx2081983':
+			case 'x208':
+				return 'JIS_C6226-1983';
+
+			case 'csiso91jisc62291984a':
+			case 'isoir91':
+			case 'jisc62291984a':
+			case 'jpocra':
+				return 'JIS_C6229-1984-a';
+
+			case 'csiso92jisc62991984b':
+			case 'iso646jpocrb':
+			case 'isoir92':
+			case 'jisc62291984b':
+			case 'jpocrb':
+				return 'JIS_C6229-1984-b';
+
+			case 'csiso93jis62291984badd':
+			case 'isoir93':
+			case 'jisc62291984badd':
+			case 'jpocrbadd':
+				return 'JIS_C6229-1984-b-add';
+
+			case 'csiso94jis62291984hand':
+			case 'isoir94':
+			case 'jisc62291984hand':
+			case 'jpocrhand':
+				return 'JIS_C6229-1984-hand';
+
+			case 'csiso95jis62291984handadd':
+			case 'isoir95':
+			case 'jisc62291984handadd':
+			case 'jpocrhandadd':
+				return 'JIS_C6229-1984-hand-add';
+
+			case 'csiso96jisc62291984kana':
+			case 'isoir96':
+			case 'jisc62291984kana':
+				return 'JIS_C6229-1984-kana';
+
+			case 'csjisencoding':
+			case 'jisencoding':
+				return 'JIS_Encoding';
+
+			case 'cshalfwidthkatakana':
+			case 'jisx201':
+			case 'x201':
+				return 'JIS_X0201';
 
-			case 'JIS_X0212-1990':
-			case 'X0212':
-			case 'ISO-IR-159':
-			case 'CSISO159JISX02121990':
+			case 'csiso159jisx2121990':
+			case 'isoir159':
+			case 'jisx2121990':
+			case 'x212':
 				return 'JIS_X0212-1990';
 
-			case 'DS_2089':
-			case 'DS2089':
-			case 'ISO646-DK':
-			case 'DK':
-			case 'CSISO646DANISH':
-				return 'DS_2089';
+			case 'csiso141jusib1002':
+			case 'iso646yu':
+			case 'isoir141':
+			case 'js':
+			case 'jusib1002':
+			case 'yu':
+				return 'JUS_I.B1.002';
 
-			case 'US-DK':
-			case 'CSUSDK':
-				return 'us-dk';
+			case 'csiso147macedonian':
+			case 'isoir147':
+			case 'jusib1003mac':
+			case 'macedonian':
+				return 'JUS_I.B1.003-mac';
 
-			case 'DK-US':
-			case 'CSDKUS':
-				return 'dk-us';
+			case 'csiso146serbian':
+			case 'isoir146':
+			case 'jusib1003serb':
+			case 'serbian':
+				return 'JUS_I.B1.003-serb';
+
+			case 'koi7switched':
+				return 'KOI7-switched';
+
+			case 'cskoi8r':
+			case 'koi8r':
+				return 'KOI8-R';
+
+			case 'koi8u':
+				return 'KOI8-U';
 
-			case 'KSC5636':
-			case 'ISO646-KR':
-			case 'CSKSC5636':
+			case 'csksc5636':
+			case 'iso646kr':
+			case 'ksc5636':
 				return 'KSC5636';
 
-			case 'UNICODE-1-1-UTF-7':
-			case 'CSUNICODE11UTF7':
-				return 'UNICODE-1-1-UTF-7';
+			case 'cskz1048':
+			case 'kz1048':
+			case 'rk1048':
+			case 'strk10482002':
+				return 'KZ-1048';
 
-			case 'ISO-2022-CN':
-				return 'ISO-2022-CN';
+			case 'csiso19latingreek':
+			case 'isoir19':
+			case 'latingreek':
+				return 'latin-greek';
 
-			case 'ISO-2022-CN-EXT':
-				return 'ISO-2022-CN-EXT';
+			case 'csiso27latingreek1':
+			case 'isoir27':
+			case 'latingreek1':
+				return 'Latin-greek-1';
 
-			case 'UTF-8':
-				return 'UTF-8';
+			case 'csiso158lap':
+			case 'isoir158':
+			case 'lap':
+			case 'latinlap':
+				return 'latin-lap';
 
-			case 'ISO-8859-13':
-				return 'ISO-8859-13';
+			case 'csmacintosh':
+			case 'mac':
+			case 'macintosh':
+				return 'macintosh';
 
-			case 'ISO-8859-14':
-			case 'ISO-IR-199':
-			case 'ISO_8859-14:1998':
-			case 'ISO_8859-14':
-			case 'LATIN8':
-			case 'ISO-CELTIC':
-			case 'L8':
-				return 'ISO-8859-14';
+			case 'csmicrosoftpublishing':
+			case 'microsoftpublishing':
+				return 'Microsoft-Publishing';
+
+			case 'csmnem':
+			case 'mnem':
+				return 'MNEM';
+
+			case 'csmnemonic':
+			case 'mnemonic':
+				return 'MNEMONIC';
+
+			case 'csiso86hungarian':
+			case 'hu':
+			case 'iso646hu':
+			case 'isoir86':
+			case 'msz77953':
+				return 'MSZ_7795.3';
+
+			case 'csnatsdano':
+			case 'isoir91':
+			case 'natsdano':
+				return 'NATS-DANO';
+
+			case 'csnatsdanoadd':
+			case 'isoir92':
+			case 'natsdanoadd':
+				return 'NATS-DANO-ADD';
+
+			case 'csnatssefi':
+			case 'isoir81':
+			case 'natssefi':
+				return 'NATS-SEFI';
+
+			case 'csnatssefiadd':
+			case 'isoir82':
+			case 'natssefiadd':
+				return 'NATS-SEFI-ADD';
 
-			case 'ISO-8859-15':
-			case 'ISO_8859-15':
-			case 'LATIN-9':
-				return 'ISO-8859-15';
+			case 'csiso151cuba':
+			case 'cuba':
+			case 'iso646cu':
+			case 'isoir151':
+			case 'ncnc1081':
+				return 'NC_NC00-10:81';
 
-			case 'ISO-8859-16':
-			case 'ISO-IR-226':
-			case 'ISO_8859-16:2001':
-			case 'ISO_8859-16':
-			case 'LATIN10':
-			case 'L10':
-				return 'ISO-8859-16';
+			case 'csiso69french':
+			case 'fr':
+			case 'iso646fr':
+			case 'isoir69':
+			case 'nfz62010':
+				return 'NF_Z_62-010';
 
-			case 'GBK':
-			case 'CP936':
-			case 'MS936':
-			case 'WINDOWS-936':
-				return 'GBK';
+			case 'csiso25french':
+			case 'iso646fr1':
+			case 'isoir25':
+			case 'nfz620101973':
+				return 'NF_Z_62-010_(1973)';
 
-			case 'GB18030':
-				return 'GB18030';
+			case 'csiso60danishnorwegian':
+			case 'csiso60norwegian1':
+			case 'iso646no':
+			case 'isoir60':
+			case 'no':
+			case 'ns45511':
+				return 'NS_4551-1';
 
-			case 'OSD_EBCDIC_DF04_15':
-				return 'OSD_EBCDIC_DF04_15';
+			case 'csiso61norwegian2':
+			case 'iso646no2':
+			case 'isoir61':
+			case 'no2':
+			case 'ns45512':
+				return 'NS_4551-2';
 
-			case 'OSD_EBCDIC_DF03_IRV':
+			case 'osdebcdicdf3irv':
 				return 'OSD_EBCDIC_DF03_IRV';
 
-			case 'OSD_EBCDIC_DF04_1':
+			case 'osdebcdicdf41':
 				return 'OSD_EBCDIC_DF04_1';
 
-			case 'ISO-11548-1':
-			case 'ISO_11548-1':
-			case 'ISO_TR_11548-1':
-			case 'CSISO115481':
-				return 'ISO-11548-1';
-
-			case 'KZ-1048':
-			case 'STRK1048-2002':
-			case 'RK1048':
-			case 'CSKZ1048':
-				return 'KZ-1048';
-
-			case 'ISO-10646-UCS-2':
-			case 'CSUNICODE':
-				return 'ISO-10646-UCS-2';
-
-			case 'ISO-10646-UCS-4':
-			case 'CSUCS4':
-				return 'ISO-10646-UCS-4';
+			case 'osdebcdicdf415':
+				return 'OSD_EBCDIC_DF04_15';
 
-			case 'ISO-10646-UCS-BASIC':
-			case 'CSUNICODEASCII':
-				return 'ISO-10646-UCS-Basic';
+			case 'cspc8danishnorwegian':
+			case 'pc8danishnorwegian':
+				return 'PC8-Danish-Norwegian';
 
-			case 'ISO-10646-UNICODE-LATIN1':
-			case 'CSUNICODELATIN1':
-			case 'ISO-10646':
-				return 'ISO-10646-Unicode-Latin1';
+			case 'cspc8turkish':
+			case 'pc8turkish':
+				return 'PC8-Turkish';
 
-			case 'ISO-10646-J-1':
-				return 'ISO-10646-J-1';
+			case 'csiso16portuguese':
+			case 'iso646pt':
+			case 'isoir16':
+			case 'pt':
+				return 'PT';
 
-			case 'ISO-UNICODE-IBM-1261':
-			case 'CSUNICODEIBM1261':
-				return 'ISO-Unicode-IBM-1261';
+			case 'csiso84portuguese2':
+			case 'iso646pt2':
+			case 'isoir84':
+			case 'pt2':
+				return 'PT2';
 
-			case 'ISO-UNICODE-IBM-1268':
-			case 'CSUNICODEIBM1268':
-				return 'ISO-Unicode-IBM-1268';
+			case 'cp154':
+			case 'csptcp154':
+			case 'cyrillicasian':
+			case 'pt154':
+			case 'ptcp154':
+				return 'PTCP154';
 
-			case 'ISO-UNICODE-IBM-1276':
-			case 'CSUNICODEIBM1276':
-				return 'ISO-Unicode-IBM-1276';
+			case 'scsu':
+				return 'SCSU';
 
-			case 'ISO-UNICODE-IBM-1264':
-			case 'CSUNICODEIBM1264':
-				return 'ISO-Unicode-IBM-1264';
+			case 'csiso10swedish':
+			case 'fi':
+			case 'iso646fi':
+			case 'iso646se':
+			case 'isoir10':
+			case 'se':
+			case 'sen850200b':
+				return 'SEN_850200_B';
 
-			case 'ISO-UNICODE-IBM-1265':
-			case 'CSUNICODEIBM1265':
-				return 'ISO-Unicode-IBM-1265';
+			case 'csiso11swedishfornames':
+			case 'iso646se2':
+			case 'isoir11':
+			case 'se2':
+			case 'sen850200c':
+				return 'SEN_850200_C';
 
-			case 'UNICODE-1-1':
-			case 'CSUNICODE11':
-				return 'UNICODE-1-1';
+			case 'csshiftjis':
+			case 'mskanji':
+			case 'shiftjis':
+				return 'Shift_JIS';
 
-			case 'SCSU':
-				return 'SCSU';
+			case 'csiso102t617bit':
+			case 'isoir102':
+			case 't617bit':
+				return 'T.61-7bit';
 
-			case 'UTF-7':
-				return 'UTF-7';
+			case 'csiso103t618bit':
+			case 'isoir103':
+			case 't61':
+			case 't618bit':
+				return 'T.61-8bit';
 
-			case 'UTF-16BE':
-				return 'UTF-16BE';
+			case 'csiso128t101g2':
+			case 'isoir128':
+			case 't101g2':
+				return 'T.101-G2';
 
-			case 'UTF-16LE':
-				return 'UTF-16LE';
+			case 'cstscii':
+			case 'tscii':
+				return 'TSCII';
 
-			case 'UTF-16':
-				return 'UTF-16';
+			case 'csunicode11':
+			case 'unicode11':
+				return 'UNICODE-1-1';
 
-			case 'CESU-8':
-			case 'CSCESU-8':
-				return 'CESU-8';
+			case 'csunicode11utf7':
+			case 'unicode11utf7':
+				return 'UNICODE-1-1-UTF-7';
 
-			case 'UTF-32':
-				return 'UTF-32';
+			case 'csunknown8bit':
+			case 'unknown8bit':
+				return 'UNKNOWN-8BIT';
 
-			case 'UTF-32BE':
-				return 'UTF-32BE';
+			case 'ansix341968':
+			case 'ansix341986':
+			case 'ascii':
+			case 'cp367':
+			case 'csascii':
+			case 'ibm367':
+			case 'iso646irv1991':
+			case 'iso646us':
+			case 'isoir6':
+			case 'us':
+			case 'usascii':
+				return 'US-ASCII';
 
-			case 'UTF-32LE':
-				return 'UTF-32LE';
+			case 'csusdk':
+			case 'usdk':
+				return 'us-dk';
 
-			case 'BOCU-1':
-			case 'CSBOCU-1':
-				return 'BOCU-1';
+			case 'utf7':
+				return 'UTF-7';
 
-			case 'ISO-8859-1-WINDOWS-3.0-LATIN-1':
-			case 'CSWINDOWS30LATIN1':
-				return 'ISO-8859-1-Windows-3.0-Latin-1';
+			case 'utf8':
+				return 'UTF-8';
 
-			case 'ISO-8859-1-WINDOWS-3.1-LATIN-1':
-			case 'CSWINDOWS31LATIN1':
-				return 'ISO-8859-1-Windows-3.1-Latin-1';
+			case 'utf16':
+				return 'UTF-16';
 
-			case 'ISO-8859-2-WINDOWS-LATIN-2':
-			case 'CSWINDOWS31LATIN2':
-				return 'ISO-8859-2-Windows-Latin-2';
+			case 'utf16be':
+				return 'UTF-16BE';
 
-			case 'ISO-8859-9-WINDOWS-LATIN-5':
-			case 'CSWINDOWS31LATIN5':
-				return 'ISO-8859-9-Windows-Latin-5';
+			case 'utf16le':
+				return 'UTF-16LE';
 
-			case 'HP-ROMAN8':
-			case 'ROMAN8':
-			case 'R8':
-			case 'CSHPROMAN8':
-				return 'hp-roman8';
+			case 'utf32':
+				return 'UTF-32';
 
-			case 'ADOBE-STANDARD-ENCODING':
-			case 'CSADOBESTANDARDENCODING':
-				return 'Adobe-Standard-Encoding';
+			case 'utf32be':
+				return 'UTF-32BE';
 
-			case 'VENTURA-US':
-			case 'CSVENTURAUS':
-				return 'Ventura-US';
+			case 'utf32le':
+				return 'UTF-32LE';
 
-			case 'VENTURA-INTERNATIONAL':
-			case 'CSVENTURAINTERNATIONAL':
+			case 'csventurainternational':
+			case 'venturainternational':
 				return 'Ventura-International';
 
-			case 'DEC-MCS':
-			case 'DEC':
-			case 'CSDECMCS':
-				return 'DEC-MCS';
-
-			case 'IBM850':
-			case 'CP850':
-			case '850':
-			case 'CSPC850MULTILINGUAL':
-				return 'IBM850';
-
-			case 'PC8-DANISH-NORWEGIAN':
-			case 'CSPC8DANISHNORWEGIAN':
-				return 'PC8-Danish-Norwegian';
+			case 'csventuramath':
+			case 'venturamath':
+				return 'Ventura-Math';
 
-			case 'IBM862':
-			case 'CP862':
-			case '862':
-			case 'CSPC862LATINHEBREW':
-				return 'IBM862';
+			case 'csventuraus':
+			case 'venturaus':
+				return 'Ventura-US';
 
-			case 'PC8-TURKISH':
-			case 'CSPC8TURKISH':
-				return 'PC8-Turkish';
+			case 'csiso70videotexsupp1':
+			case 'isoir70':
+			case 'videotexsuppl':
+				return 'videotex-suppl';
 
-			case 'IBM-SYMBOLS':
-			case 'CSIBMSYMBOLS':
-				return 'IBM-Symbols';
+			case 'csviqr':
+			case 'viqr':
+				return 'VIQR';
 
-			case 'IBM-THAI':
-			case 'CSIBMTHAI':
-				return 'IBM-Thai';
+			case 'csviscii':
+			case 'viscii':
+				return 'VISCII';
 
-			case 'HP-LEGAL':
-			case 'CSHPLEGAL':
-				return 'HP-Legal';
+			case 'cswindows31j':
+			case 'windows31j':
+				return 'Windows-31J';
 
-			case 'HP-PI-FONT':
-			case 'CSHPPIFONT':
-				return 'HP-Pi-font';
+			case 'iso885911':
+			case 'tis620':
+				return 'windows-874';
+
+			case 'cseuckr':
+			case 'csksc56011987':
+			case 'euckr':
+			case 'isoir149':
+			case 'korean':
+			case 'ksc5601':
+			case 'ksc56011987':
+			case 'ksc56011989':
+			case 'windows949':
+				return 'windows-949';
+
+			case 'windows1250':
+				return 'windows-1250';
 
-			case 'HP-MATH8':
-			case 'CSHPMATH8':
-				return 'HP-Math8';
+			case 'windows1251':
+				return 'windows-1251';
 
-			case 'ADOBE-SYMBOL-ENCODING':
-			case 'CSHPPSMATH':
-				return 'Adobe-Symbol-Encoding';
+			case 'cp819':
+			case 'csisolatin1':
+			case 'ibm819':
+			case 'iso88591':
+			case 'iso885911987':
+			case 'isoir100':
+			case 'l1':
+			case 'latin1':
+			case 'windows1252':
+				return 'windows-1252';
 
-			case 'HP-DESKTOP':
-			case 'CSHPDESKTOP':
-				return 'HP-DeskTop';
+			case 'windows1253':
+				return 'windows-1253';
 
-			case 'VENTURA-MATH':
-			case 'CSVENTURAMATH':
-				return 'Ventura-Math';
+			case 'csisolatin5':
+			case 'iso88599':
+			case 'iso885991989':
+			case 'isoir148':
+			case 'l5':
+			case 'latin5':
+			case 'windows1254':
+				return 'windows-1254';
 
-			case 'MICROSOFT-PUBLISHING':
-			case 'CSMICROSOFTPUBLISHING':
-				return 'Microsoft-Publishing';
+			case 'windows1255':
+				return 'windows-1255';
 
-			case 'WINDOWS-31J':
-			case 'CSWINDOWS31J':
-				return 'Windows-31J';
+			case 'windows1256':
+				return 'windows-1256';
 
-			case 'GB2312':
-			case 'CSGB2312':
-				return 'GB2312';
+			case 'windows1257':
+				return 'windows-1257';
 
-			case 'BIG5':
-			case 'CSBIG5':
-				return 'Big5';
+			case 'windows1258':
+				return 'windows-1258';
 
-			case 'MACINTOSH':
-			case 'MAC':
-			case 'CSMACINTOSH':
-				return 'macintosh';
+			default:
+				return $charset;
+		}
+	}
 
-			case 'IBM037':
-			case 'CP037':
-			case 'EBCDIC-CP-US':
-			case 'EBCDIC-CP-CA':
-			case 'EBCDIC-CP-WT':
-			case 'EBCDIC-CP-NL':
-			case 'CSIBM037':
-				return 'IBM037';
+	function get_curl_version()
+	{
+		if (is_array($curl = curl_version()))
+		{
+			$curl = $curl['version'];
+		}
+		elseif (substr($curl, 0, 5) === 'curl/')
+		{
+			$curl = substr($curl, 5, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 5));
+		}
+		elseif (substr($curl, 0, 8) === 'libcurl/')
+		{
+			$curl = substr($curl, 8, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 8));
+		}
+		else
+		{
+			$curl = 0;
+		}
+		return $curl;
+	}
 
-			case 'IBM038':
-			case 'EBCDIC-INT':
-			case 'CP038':
-			case 'CSIBM038':
-				return 'IBM038';
+	function is_subclass_of($class1, $class2)
+	{
+		if (func_num_args() !== 2)
+		{
+			trigger_error('Wrong parameter count for SimplePie_Misc::is_subclass_of()', E_USER_WARNING);
+		}
+		elseif (version_compare(PHP_VERSION, '5.0.3', '>=') || is_object($class1))
+		{
+			return is_subclass_of($class1, $class2);
+		}
+		elseif (is_string($class1) && is_string($class2))
+		{
+			if (class_exists($class1))
+			{
+				if (class_exists($class2))
+				{
+					$class2 = strtolower($class2);
+					while ($class1 = strtolower(get_parent_class($class1)))
+					{
+						if ($class1 === $class2)
+						{
+							return true;
+						}
+					}
+				}
+			}
+			else
+			{
+				trigger_error('Unknown class passed as parameter', E_USER_WARNNG);
+			}
+		}
+		return false;
+	}
 
-			case 'IBM273':
-			case 'CP273':
-			case 'CSIBM273':
-				return 'IBM273';
+	/**
+	 * Strip HTML comments
+	 *
+	 * @access public
+	 * @param string $data Data to strip comments from
+	 * @return string Comment stripped string
+	 */
+	function strip_comments($data)
+	{
+		$output = '';
+		while (($start = strpos($data, '<!--')) !== false)
+		{
+			$output .= substr($data, 0, $start);
+			if (($end = strpos($data, '-->', $start)) !== false)
+			{
+				$data = substr_replace($data, '', 0, $end + 3);
+			}
+			else
+			{
+				$data = '';
+			}
+		}
+		return $output . $data;
+	}
 
-			case 'IBM274':
-			case 'EBCDIC-BE':
-			case 'CP274':
-			case 'CSIBM274':
-				return 'IBM274';
+	function parse_date($dt)
+	{
+		$parser = SimplePie_Parse_Date::get();
+		return $parser->parse($dt);
+	}
 
-			case 'IBM275':
-			case 'EBCDIC-BR':
-			case 'CP275':
-			case 'CSIBM275':
-				return 'IBM275';
+	/**
+	 * Decode HTML entities
+	 *
+	 * @static
+	 * @access public
+	 * @param string $data Input data
+	 * @return string Output data
+	 */
+	function entities_decode($data)
+	{
+		$decoder = new SimplePie_Decode_HTML_Entities($data);
+		return $decoder->parse();
+	}
 
-			case 'IBM277':
-			case 'EBCDIC-CP-DK':
-			case 'EBCDIC-CP-NO':
-			case 'CSIBM277':
-				return 'IBM277';
+	/**
+	 * Remove RFC822 comments
+	 *
+	 * @access public
+	 * @param string $data Data to strip comments from
+	 * @return string Comment stripped string
+	 */
+	function uncomment_rfc822($string)
+	{
+		$string = (string) $string;
+		$position = 0;
+		$length = strlen($string);
+		$depth = 0;
 
-			case 'IBM278':
-			case 'CP278':
-			case 'EBCDIC-CP-FI':
-			case 'EBCDIC-CP-SE':
-			case 'CSIBM278':
-				return 'IBM278';
+		$output = '';
 
-			case 'IBM280':
-			case 'CP280':
-			case 'EBCDIC-CP-IT':
-			case 'CSIBM280':
-				return 'IBM280';
+		while ($position < $length && ($pos = strpos($string, '(', $position)) !== false)
+		{
+			$output .= substr($string, $position, $pos - $position);
+			$position = $pos + 1;
+			if ($string[$pos - 1] !== '\\')
+			{
+				$depth++;
+				while ($depth && $position < $length)
+				{
+					$position += strcspn($string, '()', $position);
+					if ($string[$position - 1] === '\\')
+					{
+						$position++;
+						continue;
+					}
+					elseif (isset($string[$position]))
+					{
+						switch ($string[$position])
+						{
+							case '(':
+								$depth++;
+								break;
 
-			case 'IBM281':
-			case 'EBCDIC-JP-E':
-			case 'CP281':
-			case 'CSIBM281':
-				return 'IBM281';
+							case ')':
+								$depth--;
+								break;
+						}
+						$position++;
+					}
+					else
+					{
+						break;
+					}
+				}
+			}
+			else
+			{
+				$output .= '(';
+			}
+		}
+		$output .= substr($string, $position);
 
-			case 'IBM284':
-			case 'CP284':
-			case 'EBCDIC-CP-ES':
-			case 'CSIBM284':
-				return 'IBM284';
+		return $output;
+	}
 
-			case 'IBM285':
-			case 'CP285':
-			case 'EBCDIC-CP-GB':
-			case 'CSIBM285':
-				return 'IBM285';
+	function parse_mime($mime)
+	{
+		if (($pos = strpos($mime, ';')) === false)
+		{
+			return trim($mime);
+		}
+		else
+		{
+			return trim(substr($mime, 0, $pos));
+		}
+	}
 
-			case 'IBM290':
-			case 'CP290':
-			case 'EBCDIC-JP-KANA':
-			case 'CSIBM290':
-				return 'IBM290';
+	function htmlspecialchars_decode($string, $quote_style)
+	{
+		if (function_exists('htmlspecialchars_decode'))
+		{
+			return htmlspecialchars_decode($string, $quote_style);
+		}
+		else
+		{
+			return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style)));
+		}
+	}
 
-			case 'IBM297':
-			case 'CP297':
-			case 'EBCDIC-CP-FR':
-			case 'CSIBM297':
-				return 'IBM297';
+	function atom_03_construct_type($attribs)
+	{
+		if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode']) === 'base64'))
+		{
+			$mode = SIMPLEPIE_CONSTRUCT_BASE64;
+		}
+		else
+		{
+			$mode = SIMPLEPIE_CONSTRUCT_NONE;
+		}
+		if (isset($attribs['']['type']))
+		{
+			switch (strtolower(trim($attribs['']['type'])))
+			{
+				case 'text':
+				case 'text/plain':
+					return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
 
-			case 'IBM420':
-			case 'CP420':
-			case 'EBCDIC-CP-AR1':
-			case 'CSIBM420':
-				return 'IBM420';
+				case 'html':
+				case 'text/html':
+					return SIMPLEPIE_CONSTRUCT_HTML | $mode;
 
-			case 'IBM423':
-			case 'CP423':
-			case 'EBCDIC-CP-GR':
-			case 'CSIBM423':
-				return 'IBM423';
+				case 'xhtml':
+				case 'application/xhtml+xml':
+					return SIMPLEPIE_CONSTRUCT_XHTML | $mode;
 
-			case 'IBM424':
-			case 'CP424':
-			case 'EBCDIC-CP-HE':
-			case 'CSIBM424':
-				return 'IBM424';
+				default:
+					return SIMPLEPIE_CONSTRUCT_NONE | $mode;
+			}
+		}
+		else
+		{
+			return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
+		}
+	}
 
-			case 'IBM437':
-			case 'CP437':
-			case '437':
-			case 'CSPC8CODEPAGE437':
-				return 'IBM437';
+	function atom_10_construct_type($attribs)
+	{
+		if (isset($attribs['']['type']))
+		{
+			switch (strtolower(trim($attribs['']['type'])))
+			{
+				case 'text':
+					return SIMPLEPIE_CONSTRUCT_TEXT;
 
-			case 'IBM500':
-			case 'CP500':
-			case 'EBCDIC-CP-BE':
-			case 'EBCDIC-CP-CH':
-			case 'CSIBM500':
-				return 'IBM500';
+				case 'html':
+					return SIMPLEPIE_CONSTRUCT_HTML;
 
-			case 'IBM851':
-			case 'CP851':
-			case '851':
-			case 'CSIBM851':
-				return 'IBM851';
+				case 'xhtml':
+					return SIMPLEPIE_CONSTRUCT_XHTML;
 
-			case 'IBM852':
-			case 'CP852':
-			case '852':
-			case 'CSPCP852':
-				return 'IBM852';
+				default:
+					return SIMPLEPIE_CONSTRUCT_NONE;
+			}
+		}
+		return SIMPLEPIE_CONSTRUCT_TEXT;
+	}
 
-			case 'IBM855':
-			case 'CP855':
-			case '855':
-			case 'CSIBM855':
-				return 'IBM855';
+	function atom_10_content_construct_type($attribs)
+	{
+		if (isset($attribs['']['type']))
+		{
+			$type = strtolower(trim($attribs['']['type']));
+			switch ($type)
+			{
+				case 'text':
+					return SIMPLEPIE_CONSTRUCT_TEXT;
 
-			case 'IBM857':
-			case 'CP857':
-			case '857':
-			case 'CSIBM857':
-				return 'IBM857';
+				case 'html':
+					return SIMPLEPIE_CONSTRUCT_HTML;
 
-			case 'IBM860':
-			case 'CP860':
-			case '860':
-			case 'CSIBM860':
-				return 'IBM860';
+				case 'xhtml':
+					return SIMPLEPIE_CONSTRUCT_XHTML;
+			}
+			if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) === 'text/')
+			{
+				return SIMPLEPIE_CONSTRUCT_NONE;
+			}
+			else
+			{
+				return SIMPLEPIE_CONSTRUCT_BASE64;
+			}
+		}
+		else
+		{
+			return SIMPLEPIE_CONSTRUCT_TEXT;
+		}
+	}
 
-			case 'IBM861':
-			case 'CP861':
-			case '861':
-			case 'CP-IS':
-			case 'CSIBM861':
-				return 'IBM861';
+	function is_isegment_nz_nc($string)
+	{
+		return (bool) preg_match('/^([A-Za-z0-9\-._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!$&\'()*+,;=@]|(%[0-9ABCDEF]{2}))+$/u', $string);
+	}
 
-			case 'IBM863':
-			case 'CP863':
-			case '863':
-			case 'CSIBM863':
-				return 'IBM863';
+	function space_seperated_tokens($string)
+	{
+		$space_characters = "\x20\x09\x0A\x0B\x0C\x0D";
+		$string_length = strlen($string);
 
-			case 'IBM864':
-			case 'CP864':
-			case 'CSIBM864':
-				return 'IBM864';
+		$position = strspn($string, $space_characters);
+		$tokens = array();
 
-			case 'IBM865':
-			case 'CP865':
-			case '865':
-			case 'CSIBM865':
-				return 'IBM865';
+		while ($position < $string_length)
+		{
+			$len = strcspn($string, $space_characters, $position);
+			$tokens[] = substr($string, $position, $len);
+			$position += $len;
+			$position += strspn($string, $space_characters, $position);
+		}
 
-			case 'IBM868':
-			case 'CP868':
-			case 'CP-AR':
-			case 'CSIBM868':
-				return 'IBM868';
+		return $tokens;
+	}
 
-			case 'IBM869':
-			case 'CP869':
-			case '869':
-			case 'CP-GR':
-			case 'CSIBM869':
-				return 'IBM869';
+	function array_unique($array)
+	{
+		if (version_compare(PHP_VERSION, '5.2', '>='))
+		{
+			return array_unique($array);
+		}
+		else
+		{
+			$array = (array) $array;
+			$new_array = array();
+			$new_array_strings = array();
+			foreach ($array as $key => $value)
+			{
+				if (is_object($value))
+				{
+					if (method_exists($value, '__toString'))
+					{
+						$cmp = $value->__toString();
+					}
+					else
+					{
+						trigger_error('Object of class ' . get_class($value) . ' could not be converted to string', E_USER_ERROR);
+					}
+				}
+				elseif (is_array($value))
+				{
+					$cmp = (string) reset($value);
+				}
+				else
+				{
+					$cmp = (string) $value;
+				}
+				if (!in_array($cmp, $new_array_strings))
+				{
+					$new_array[$key] = $value;
+					$new_array_strings[] = $cmp;
+				}
+			}
+			return $new_array;
+		}
+	}
 
-			case 'IBM870':
-			case 'CP870':
-			case 'EBCDIC-CP-ROECE':
-			case 'EBCDIC-CP-YU':
-			case 'CSIBM870':
-				return 'IBM870';
+	/**
+	 * Converts a unicode codepoint to a UTF-8 character
+	 *
+	 * @static
+	 * @access public
+	 * @param int $codepoint Unicode codepoint
+	 * @return string UTF-8 character
+	 */
+	function codepoint_to_utf8($codepoint)
+	{
+		$codepoint = (int) $codepoint;
+		if ($codepoint < 0)
+		{
+			return false;
+		}
+		else if ($codepoint <= 0x7f)
+		{
+			return chr($codepoint);
+		}
+		else if ($codepoint <= 0x7ff)
+		{
+			return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
+		}
+		else if ($codepoint <= 0xffff)
+		{
+			return chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
+		}
+		else if ($codepoint <= 0x10ffff)
+		{
+			return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
+		}
+		else
+		{
+			// U+FFFD REPLACEMENT CHARACTER
+			return "\xEF\xBF\xBD";
+		}
+	}
 
-			case 'IBM871':
-			case 'CP871':
-			case 'EBCDIC-CP-IS':
-			case 'CSIBM871':
-				return 'IBM871';
+	/**
+	 * Re-implementation of PHP 5's stripos()
+	 *
+	 * Returns the numeric position of the first occurrence of needle in the
+	 * haystack string.
+	 *
+	 * @static
+	 * @access string
+	 * @param object $haystack
+	 * @param string $needle Note that the needle may be a string of one or more
+	 *     characters. If needle is not a string, it is converted to an integer
+	 *     and applied as the ordinal value of a character.
+	 * @param int $offset The optional offset parameter allows you to specify which
+	 *     character in haystack to start searching. The position returned is still
+	 *     relative to the beginning of haystack.
+	 * @return bool If needle is not found, stripos() will return boolean false.
+	 */
+	function stripos($haystack, $needle, $offset = 0)
+	{
+		if (function_exists('stripos'))
+		{
+			return stripos($haystack, $needle, $offset);
+		}
+		else
+		{
+			if (is_string($needle))
+			{
+				$needle = strtolower($needle);
+			}
+			elseif (is_int($needle) || is_bool($needle) || is_double($needle))
+			{
+				$needle = strtolower(chr($needle));
+			}
+			else
+			{
+				trigger_error('needle is not a string or an integer', E_USER_WARNING);
+				return false;
+			}
 
-			case 'IBM880':
-			case 'CP880':
-			case 'EBCDIC-CYRILLIC':
-			case 'CSIBM880':
-				return 'IBM880';
+			return strpos(strtolower($haystack), $needle, $offset);
+		}
+	}
 
-			case 'IBM891':
-			case 'CP891':
-			case 'CSIBM891':
-				return 'IBM891';
+	/**
+	 * Similar to parse_str()
+	 *
+	 * Returns an associative array of name/value pairs, where the value is an
+	 * array of values that have used the same name
+	 *
+	 * @static
+	 * @access string
+	 * @param string $str The input string.
+	 * @return array
+	 */
+	function parse_str($str)
+	{
+		$return = array();
+		$str = explode('&', $str);
 
-			case 'IBM903':
-			case 'CP903':
-			case 'CSIBM903':
-				return 'IBM903';
+		foreach ($str as $section)
+		{
+			if (strpos($section, '=') !== false)
+			{
+				list($name, $value) = explode('=', $section, 2);
+				$return[urldecode($name)][] = urldecode($value);
+			}
+			else
+			{
+				$return[urldecode($section)][] = null;
+			}
+		}
 
-			case 'IBM904':
-			case 'CP904':
-			case '904':
-			case 'CSIBBM904':
-				return 'IBM904';
+		return $return;
+	}
 
-			case 'IBM905':
-			case 'CP905':
-			case 'EBCDIC-CP-TR':
-			case 'CSIBM905':
-				return 'IBM905';
+	/**
+	 * Detect XML encoding, as per XML 1.0 Appendix F.1
+	 *
+	 * @todo Add support for EBCDIC
+	 * @param string $data XML data
+	 * @return array Possible encodings
+	 */
+	function xml_encoding($data)
+	{
+		// UTF-32 Big Endian BOM
+		if (substr($data, 0, 4) === "\x00\x00\xFE\xFF")
+		{
+			$encoding[] = 'UTF-32BE';
+		}
+		// UTF-32 Little Endian BOM
+		elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00")
+		{
+			$encoding[] = 'UTF-32LE';
+		}
+		// UTF-16 Big Endian BOM
+		elseif (substr($data, 0, 2) === "\xFE\xFF")
+		{
+			$encoding[] = 'UTF-16BE';
+		}
+		// UTF-16 Little Endian BOM
+		elseif (substr($data, 0, 2) === "\xFF\xFE")
+		{
+			$encoding[] = 'UTF-16LE';
+		}
+		// UTF-8 BOM
+		elseif (substr($data, 0, 3) === "\xEF\xBB\xBF")
+		{
+			$encoding[] = 'UTF-8';
+		}
+		// UTF-32 Big Endian Without BOM
+		elseif (substr($data, 0, 20) === "\x00\x00\x00\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C")
+		{
+			if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E"))
+			{
+				$parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8'));
+				if ($parser->parse())
+				{
+					$encoding[] = $parser->encoding;
+				}
+			}
+			$encoding[] = 'UTF-32BE';
+		}
+		// UTF-32 Little Endian Without BOM
+		elseif (substr($data, 0, 20) === "\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C\x00\x00\x00")
+		{
+			if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00"))
+			{
+				$parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8'));
+				if ($parser->parse())
+				{
+					$encoding[] = $parser->encoding;
+				}
+			}
+			$encoding[] = 'UTF-32LE';
+		}
+		// UTF-16 Big Endian Without BOM
+		elseif (substr($data, 0, 10) === "\x00\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C")
+		{
+			if ($pos = strpos($data, "\x00\x3F\x00\x3E"))
+			{
+				$parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8'));
+				if ($parser->parse())
+				{
+					$encoding[] = $parser->encoding;
+				}
+			}
+			$encoding[] = 'UTF-16BE';
+		}
+		// UTF-16 Little Endian Without BOM
+		elseif (substr($data, 0, 10) === "\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C\x00")
+		{
+			if ($pos = strpos($data, "\x3F\x00\x3E\x00"))
+			{
+				$parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8'));
+				if ($parser->parse())
+				{
+					$encoding[] = $parser->encoding;
+				}
+			}
+			$encoding[] = 'UTF-16LE';
+		}
+		// US-ASCII (or superset)
+		elseif (substr($data, 0, 5) === "\x3C\x3F\x78\x6D\x6C")
+		{
+			if ($pos = strpos($data, "\x3F\x3E"))
+			{
+				$parser = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
+				if ($parser->parse())
+				{
+					$encoding[] = $parser->encoding;
+				}
+			}
+			$encoding[] = 'UTF-8';
+		}
+		// Fallback to UTF-8
+		else
+		{
+			$encoding[] = 'UTF-8';
+		}
+		return $encoding;
+	}
 
-			case 'IBM918':
-			case 'CP918':
-			case 'EBCDIC-CP-AR2':
-			case 'CSIBM918':
-				return 'IBM918';
+	function output_javascript()
+	{
+		if (function_exists('ob_gzhandler'))
+		{
+			ob_start('ob_gzhandler');
+		}
+		header('Content-type: text/javascript; charset: UTF-8');
+		header('Cache-Control: must-revalidate');
+		header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days
+		?>
+function embed_odeo(link) {
+	document.writeln('<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url='+link+'"></embed>');
+}
 
-			case 'IBM1026':
-			case 'CP1026':
-			case 'CSIBM1026':
-				return 'IBM1026';
+function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) {
+	if (placeholder != '') {
+		document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" href="'+link+'" src="'+placeholder+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="false" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
+	}
+	else {
+		document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" src="'+link+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="true" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
+	}
+}
 
-			case 'EBCDIC-AT-DE':
-			case 'CSIBMEBCDICATDE':
-				return 'EBCDIC-AT-DE';
+function embed_flash(bgcolor, width, height, link, loop, type) {
+	document.writeln('<embed src="'+link+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="'+type+'" quality="high" width="'+width+'" height="'+height+'" bgcolor="'+bgcolor+'" loop="'+loop+'"></embed>');
+}
 
-			case 'EBCDIC-AT-DE-A':
-			case 'CSEBCDICATDEA':
-				return 'EBCDIC-AT-DE-A';
+function embed_flv(width, height, link, placeholder, loop, player) {
+	document.writeln('<embed src="'+player+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="'+width+'" height="'+height+'" wmode="transparent" flashvars="file='+link+'&autostart=false&repeat='+loop+'&showdigits=true&showfsbutton=false"></embed>');
+}
 
-			case 'EBCDIC-CA-FR':
-			case 'CSEBCDICCAFR':
-				return 'EBCDIC-CA-FR';
+function embed_wmedia(width, height, link) {
+	document.writeln('<embed type="application/x-mplayer2" src="'+link+'" autosize="1" width="'+width+'" height="'+height+'" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>');
+}
+		<?php
+	}
+}
 
-			case 'EBCDIC-DK-NO':
-			case 'CSEBCDICDKNO':
-				return 'EBCDIC-DK-NO';
+/**
+ * Decode HTML Entities
+ *
+ * This implements HTML5 as of revision 967 (2007-06-28)
+ *
+ * @package SimplePie
+ */
+class SimplePie_Decode_HTML_Entities
+{
+	/**
+	 * Data to be parsed
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $data = '';
 
-			case 'EBCDIC-DK-NO-A':
-			case 'CSEBCDICDKNOA':
-				return 'EBCDIC-DK-NO-A';
+	/**
+	 * Currently consumed bytes
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $consumed = '';
 
-			case 'EBCDIC-FI-SE':
-			case 'CSEBCDICFISE':
-				return 'EBCDIC-FI-SE';
+	/**
+	 * Position of the current byte being parsed
+	 *
+	 * @access private
+	 * @var int
+	 */
+	var $position = 0;
 
-			case 'EBCDIC-FI-SE-A':
-			case 'CSEBCDICFISEA':
-				return 'EBCDIC-FI-SE-A';
+	/**
+	 * Create an instance of the class with the input data
+	 *
+	 * @access public
+	 * @param string $data Input data
+	 */
+	function SimplePie_Decode_HTML_Entities($data)
+	{
+		$this->data = $data;
+	}
 
-			case 'EBCDIC-FR':
-			case 'CSEBCDICFR':
-				return 'EBCDIC-FR';
+	/**
+	 * Parse the input data
+	 *
+	 * @access public
+	 * @return string Output data
+	 */
+	function parse()
+	{
+		while (($this->position = strpos($this->data, '&', $this->position)) !== false)
+		{
+			$this->consume();
+			$this->entity();
+			$this->consumed = '';
+		}
+		return $this->data;
+	}
 
-			case 'EBCDIC-IT':
-			case 'CSEBCDICIT':
-				return 'EBCDIC-IT';
+	/**
+	 * Consume the next byte
+	 *
+	 * @access private
+	 * @return mixed The next byte, or false, if there is no more data
+	 */
+	function consume()
+	{
+		if (isset($this->data[$this->position]))
+		{
+			$this->consumed .= $this->data[$this->position];
+			return $this->data[$this->position++];
+		}
+		else
+		{
+			return false;
+		}
+	}
 
-			case 'EBCDIC-PT':
-			case 'CSEBCDICPT':
-				return 'EBCDIC-PT';
+	/**
+	 * Consume a range of characters
+	 *
+	 * @access private
+	 * @param string $chars Characters to consume
+	 * @return mixed A series of characters that match the range, or false
+	 */
+	function consume_range($chars)
+	{
+		if ($len = strspn($this->data, $chars, $this->position))
+		{
+			$data = substr($this->data, $this->position, $len);
+			$this->consumed .= $data;
+			$this->position += $len;
+			return $data;
+		}
+		else
+		{
+			return false;
+		}
+	}
 
-			case 'EBCDIC-ES':
-			case 'CSEBCDICES':
-				return 'EBCDIC-ES';
+	/**
+	 * Unconsume one byte
+	 *
+	 * @access private
+	 */
+	function unconsume()
+	{
+		$this->consumed = substr($this->consumed, 0, -1);
+		$this->position--;
+	}
 
-			case 'EBCDIC-ES-A':
-			case 'CSEBCDICESA':
-				return 'EBCDIC-ES-A';
+	/**
+	 * Decode an entity
+	 *
+	 * @access private
+	 */
+	function entity()
+	{
+		switch ($this->consume())
+		{
+			case "\x09":
+			case "\x0A":
+			case "\x0B":
+			case "\x0B":
+			case "\x0C":
+			case "\x20":
+			case "\x3C":
+			case "\x26":
+			case false:
+				break;
 
-			case 'EBCDIC-ES-S':
-			case 'CSEBCDICESS':
-				return 'EBCDIC-ES-S';
+			case "\x23":
+				switch ($this->consume())
+				{
+					case "\x78":
+					case "\x58":
+						$range = '0123456789ABCDEFabcdef';
+						$hex = true;
+						break;
 
-			case 'EBCDIC-UK':
-			case 'CSEBCDICUK':
-				return 'EBCDIC-UK';
+					default:
+						$range = '0123456789';
+						$hex = false;
+						$this->unconsume();
+						break;
+				}
 
-			case 'EBCDIC-US':
-			case 'CSEBCDICUS':
-				return 'EBCDIC-US';
+				if ($codepoint = $this->consume_range($range))
+				{
+					static $windows_1252_specials = array(0x0D => "\x0A", 0x80 => "\xE2\x82\xAC", 0x81 => "\xEF\xBF\xBD", 0x82 => "\xE2\x80\x9A", 0x83 => "\xC6\x92", 0x84 => "\xE2\x80\x9E", 0x85 => "\xE2\x80\xA6", 0x86 => "\xE2\x80\xA0", 0x87 => "\xE2\x80\xA1", 0x88 => "\xCB\x86", 0x89 => "\xE2\x80\xB0", 0x8A => "\xC5\xA0", 0x8B => "\xE2\x80\xB9", 0x8C => "\xC5\x92", 0x8D => "\xEF\xBF\xBD", 0x8E => "\xC5\xBD", 0x8F => "\xEF\xBF\xBD", 0x90 => "\xEF\xBF\xBD", 0x91 => "\xE2\x80\x98", 0x92 => "\xE2\x80\x99", 0x93 => "\xE2\x80\x9C", 0x94 => "\xE2\x80\x9D", 0x95 => "\xE2\x80\xA2", 0x96 => "\xE2\x80\x93", 0x97 => "\xE2\x80\x94", 0x98 => "\xCB\x9C", 0x99 => "\xE2\x84\xA2", 0x9A => "\xC5\xA1", 0x9B => "\xE2\x80\xBA", 0x9C => "\xC5\x93", 0x9D => "\xEF\xBF\xBD", 0x9E => "\xC5\xBE", 0x9F => "\xC5\xB8");
 
-			case 'UNKNOWN-8BIT':
-			case 'CSUNKNOWN8BIT':
-				return 'UNKNOWN-8BIT';
+					if ($hex)
+					{
+						$codepoint = hexdec($codepoint);
+					}
+					else
+					{
+						$codepoint = intval($codepoint);
+					}
 
-			case 'MNEMONIC':
-			case 'CSMNEMONIC':
-				return 'MNEMONIC';
+					if (isset($windows_1252_specials[$codepoint]))
+					{
+						$replacement = $windows_1252_specials[$codepoint];
+					}
+					else
+					{
+						$replacement = SimplePie_Misc::codepoint_to_utf8($codepoint);
+					}
 
-			case 'MNEM':
-			case 'CSMNEM':
-				return 'MNEM';
+					if (!in_array($this->consume(), array(';', false), true))
+					{
+						$this->unconsume();
+					}
 
-			case 'VISCII':
-			case 'CSVISCII':
-				return 'VISCII';
+					$consumed_length = strlen($this->consumed);
+					$this->data = substr_replace($this->data, $replacement, $this->position - $consumed_length, $consumed_length);
+					$this->position += strlen($replacement) - $consumed_length;
+				}
+				break;
 
-			case 'VIQR':
-			case 'CSVIQR':
-				return 'VIQR';
+			default:
+				static $entities = array('Aacute' => "\xC3\x81", 'aacute' => "\xC3\xA1", 'Aacute;' => "\xC3\x81", 'aacute;' => "\xC3\xA1", 'Acirc' => "\xC3\x82", 'acirc' => "\xC3\xA2", 'Acirc;' => "\xC3\x82", 'acirc;' => "\xC3\xA2", 'acute' => "\xC2\xB4", 'acute;' => "\xC2\xB4", 'AElig' => "\xC3\x86", 'aelig' => "\xC3\xA6", 'AElig;' => "\xC3\x86", 'aelig;' => "\xC3\xA6", 'Agrave' => "\xC3\x80", 'agrave' => "\xC3\xA0", 'Agrave;' => "\xC3\x80", 'agrave;' => "\xC3\xA0", 'alefsym;' => "\xE2\x84\xB5", 'Alpha;' => "\xCE\x91", 'alpha;' => "\xCE\xB1", 'AMP' => "\x26", 'amp' => "\x26", 'AMP;' => "\x26", 'amp;' => "\x26", 'and;' => "\xE2\x88\xA7", 'ang;' => "\xE2\x88\xA0", 'apos;' => "\x27", 'Aring' => "\xC3\x85", 'aring' => "\xC3\xA5", 'Aring;' => "\xC3\x85", 'aring;' => "\xC3\xA5", 'asymp;' => "\xE2\x89\x88", 'Atilde' => "\xC3\x83", 'atilde' => "\xC3\xA3", 'Atilde;' => "\xC3\x83", 'atilde;' => "\xC3\xA3", 'Auml' => "\xC3\x84", 'auml' => "\xC3\xA4", 'Auml;' => "\xC3\x84", 'auml;' => "\xC3\xA4", 'bdquo;' => "\xE2\x80\x9E", 'Beta;' => "\xCE\x92", 'beta;' => "\xCE\xB2", 'brvbar' => "\xC2\xA6", 'brvbar;' => "\xC2\xA6", 'bull;' => "\xE2\x80\xA2", 'cap;' => "\xE2\x88\xA9", 'Ccedil' => "\xC3\x87", 'ccedil' => "\xC3\xA7", 'Ccedil;' => "\xC3\x87", 'ccedil;' => "\xC3\xA7", 'cedil' => "\xC2\xB8", 'cedil;' => "\xC2\xB8", 'cent' => "\xC2\xA2", 'cent;' => "\xC2\xA2", 'Chi;' => "\xCE\xA7", 'chi;' => "\xCF\x87", 'circ;' => "\xCB\x86", 'clubs;' => "\xE2\x99\xA3", 'cong;' => "\xE2\x89\x85", 'COPY' => "\xC2\xA9", 'copy' => "\xC2\xA9", 'COPY;' => "\xC2\xA9", 'copy;' => "\xC2\xA9", 'crarr;' => "\xE2\x86\xB5", 'cup;' => "\xE2\x88\xAA", 'curren' => "\xC2\xA4", 'curren;' => "\xC2\xA4", 'Dagger;' => "\xE2\x80\xA1", 'dagger;' => "\xE2\x80\xA0", 'dArr;' => "\xE2\x87\x93", 'darr;' => "\xE2\x86\x93", 'deg' => "\xC2\xB0", 'deg;' => "\xC2\xB0", 'Delta;' => "\xCE\x94", 'delta;' => "\xCE\xB4", 'diams;' => "\xE2\x99\xA6", 'divide' => "\xC3\xB7", 'divide;' => "\xC3\xB7", 'Eacute' => "\xC3\x89", 'eacute' => "\xC3\xA9", 'Eacute;' => "\xC3\x89", 'eacute;' => "\xC3\xA9", 'Ecirc' => "\xC3\x8A", 'ecirc' => "\xC3\xAA", 'Ecirc;' => "\xC3\x8A", 'ecirc;' => "\xC3\xAA", 'Egrave' => "\xC3\x88", 'egrave' => "\xC3\xA8", 'Egrave;' => "\xC3\x88", 'egrave;' => "\xC3\xA8", 'empty;' => "\xE2\x88\x85", 'emsp;' => "\xE2\x80\x83", 'ensp;' => "\xE2\x80\x82", 'Epsilon;' => "\xCE\x95", 'epsilon;' => "\xCE\xB5", 'equiv;' => "\xE2\x89\xA1", 'Eta;' => "\xCE\x97", 'eta;' => "\xCE\xB7", 'ETH' => "\xC3\x90", 'eth' => "\xC3\xB0", 'ETH;' => "\xC3\x90", 'eth;' => "\xC3\xB0", 'Euml' => "\xC3\x8B", 'euml' => "\xC3\xAB", 'Euml;' => "\xC3\x8B", 'euml;' => "\xC3\xAB", 'euro;' => "\xE2\x82\xAC", 'exist;' => "\xE2\x88\x83", 'fnof;' => "\xC6\x92", 'forall;' => "\xE2\x88\x80", 'frac12' => "\xC2\xBD", 'frac12;' => "\xC2\xBD", 'frac14' => "\xC2\xBC", 'frac14;' => "\xC2\xBC", 'frac34' => "\xC2\xBE", 'frac34;' => "\xC2\xBE", 'frasl;' => "\xE2\x81\x84", 'Gamma;' => "\xCE\x93", 'gamma;' => "\xCE\xB3", 'ge;' => "\xE2\x89\xA5", 'GT' => "\x3E", 'gt' => "\x3E", 'GT;' => "\x3E", 'gt;' => "\x3E", 'hArr;' => "\xE2\x87\x94", 'harr;' => "\xE2\x86\x94", 'hearts;' => "\xE2\x99\xA5", 'hellip;' => "\xE2\x80\xA6", 'Iacute' => "\xC3\x8D", 'iacute' => "\xC3\xAD", 'Iacute;' => "\xC3\x8D", 'iacute;' => "\xC3\xAD", 'Icirc' => "\xC3\x8E", 'icirc' => "\xC3\xAE", 'Icirc;' => "\xC3\x8E", 'icirc;' => "\xC3\xAE", 'iexcl' => "\xC2\xA1", 'iexcl;' => "\xC2\xA1", 'Igrave' => "\xC3\x8C", 'igrave' => "\xC3\xAC", 'Igrave;' => "\xC3\x8C", 'igrave;' => "\xC3\xAC", 'image;' => "\xE2\x84\x91", 'infin;' => "\xE2\x88\x9E", 'int;' => "\xE2\x88\xAB", 'Iota;' => "\xCE\x99", 'iota;' => "\xCE\xB9", 'iquest' => "\xC2\xBF", 'iquest;' => "\xC2\xBF", 'isin;' => "\xE2\x88\x88", 'Iuml' => "\xC3\x8F", 'iuml' => "\xC3\xAF", 'Iuml;' => "\xC3\x8F", 'iuml;' => "\xC3\xAF", 'Kappa;' => "\xCE\x9A", 'kappa;' => "\xCE\xBA", 'Lambda;' => "\xCE\x9B", 'lambda;' => "\xCE\xBB", 'lang;' => "\xE3\x80\x88", 'laquo' => "\xC2\xAB", 'laquo;' => "\xC2\xAB", 'lArr;' => "\xE2\x87\x90", 'larr;' => "\xE2\x86\x90", 'lceil;' => "\xE2\x8C\x88", 'ldquo;' => "\xE2\x80\x9C", 'le;' => "\xE2\x89\xA4", 'lfloor;' => "\xE2\x8C\x8A", 'lowast;' => "\xE2\x88\x97", 'loz;' => "\xE2\x97\x8A", 'lrm;' => "\xE2\x80\x8E", 'lsaquo;' => "\xE2\x80\xB9", 'lsquo;' => "\xE2\x80\x98", 'LT' => "\x3C", 'lt' => "\x3C", 'LT;' => "\x3C", 'lt;' => "\x3C", 'macr' => "\xC2\xAF", 'macr;' => "\xC2\xAF", 'mdash;' => "\xE2\x80\x94", 'micro' => "\xC2\xB5", 'micro;' => "\xC2\xB5", 'middot' => "\xC2\xB7", 'middot;' => "\xC2\xB7", 'minus;' => "\xE2\x88\x92", 'Mu;' => "\xCE\x9C", 'mu;' => "\xCE\xBC", 'nabla;' => "\xE2\x88\x87", 'nbsp' => "\xC2\xA0", 'nbsp;' => "\xC2\xA0", 'ndash;' => "\xE2\x80\x93", 'ne;' => "\xE2\x89\xA0", 'ni;' => "\xE2\x88\x8B", 'not' => "\xC2\xAC", 'not;' => "\xC2\xAC", 'notin;' => "\xE2\x88\x89", 'nsub;' => "\xE2\x8A\x84", 'Ntilde' => "\xC3\x91", 'ntilde' => "\xC3\xB1", 'Ntilde;' => "\xC3\x91", 'ntilde;' => "\xC3\xB1", 'Nu;' => "\xCE\x9D", 'nu;' => "\xCE\xBD", 'Oacute' => "\xC3\x93", 'oacute' => "\xC3\xB3", 'Oacute;' => "\xC3\x93", 'oacute;' => "\xC3\xB3", 'Ocirc' => "\xC3\x94", 'ocirc' => "\xC3\xB4", 'Ocirc;' => "\xC3\x94", 'ocirc;' => "\xC3\xB4", 'OElig;' => "\xC5\x92", 'oelig;' => "\xC5\x93", 'Ograve' => "\xC3\x92", 'ograve' => "\xC3\xB2", 'Ograve;' => "\xC3\x92", 'ograve;' => "\xC3\xB2", 'oline;' => "\xE2\x80\xBE", 'Omega;' => "\xCE\xA9", 'omega;' => "\xCF\x89", 'Omicron;' => "\xCE\x9F", 'omicron;' => "\xCE\xBF", 'oplus;' => "\xE2\x8A\x95", 'or;' => "\xE2\x88\xA8", 'ordf' => "\xC2\xAA", 'ordf;' => "\xC2\xAA", 'ordm' => "\xC2\xBA", 'ordm;' => "\xC2\xBA", 'Oslash' => "\xC3\x98", 'oslash' => "\xC3\xB8", 'Oslash;' => "\xC3\x98", 'oslash;' => "\xC3\xB8", 'Otilde' => "\xC3\x95", 'otilde' => "\xC3\xB5", 'Otilde;' => "\xC3\x95", 'otilde;' => "\xC3\xB5", 'otimes;' => "\xE2\x8A\x97", 'Ouml' => "\xC3\x96", 'ouml' => "\xC3\xB6", 'Ouml;' => "\xC3\x96", 'ouml;' => "\xC3\xB6", 'para' => "\xC2\xB6", 'para;' => "\xC2\xB6", 'part;' => "\xE2\x88\x82", 'permil;' => "\xE2\x80\xB0", 'perp;' => "\xE2\x8A\xA5", 'Phi;' => "\xCE\xA6", 'phi;' => "\xCF\x86", 'Pi;' => "\xCE\xA0", 'pi;' => "\xCF\x80", 'piv;' => "\xCF\x96", 'plusmn' => "\xC2\xB1", 'plusmn;' => "\xC2\xB1", 'pound' => "\xC2\xA3", 'pound;' => "\xC2\xA3", 'Prime;' => "\xE2\x80\xB3", 'prime;' => "\xE2\x80\xB2", 'prod;' => "\xE2\x88\x8F", 'prop;' => "\xE2\x88\x9D", 'Psi;' => "\xCE\xA8", 'psi;' => "\xCF\x88", 'QUOT' => "\x22", 'quot' => "\x22", 'QUOT;' => "\x22", 'quot;' => "\x22", 'radic;' => "\xE2\x88\x9A", 'rang;' => "\xE3\x80\x89", 'raquo' => "\xC2\xBB", 'raquo;' => "\xC2\xBB", 'rArr;' => "\xE2\x87\x92", 'rarr;' => "\xE2\x86\x92", 'rceil;' => "\xE2\x8C\x89", 'rdquo;' => "\xE2\x80\x9D", 'real;' => "\xE2\x84\x9C", 'REG' => "\xC2\xAE", 'reg' => "\xC2\xAE", 'REG;' => "\xC2\xAE", 'reg;' => "\xC2\xAE", 'rfloor;' => "\xE2\x8C\x8B", 'Rho;' => "\xCE\xA1", 'rho;' => "\xCF\x81", 'rlm;' => "\xE2\x80\x8F", 'rsaquo;' => "\xE2\x80\xBA", 'rsquo;' => "\xE2\x80\x99", 'sbquo;' => "\xE2\x80\x9A", 'Scaron;' => "\xC5\xA0", 'scaron;' => "\xC5\xA1", 'sdot;' => "\xE2\x8B\x85", 'sect' => "\xC2\xA7", 'sect;' => "\xC2\xA7", 'shy' => "\xC2\xAD", 'shy;' => "\xC2\xAD", 'Sigma;' => "\xCE\xA3", 'sigma;' => "\xCF\x83", 'sigmaf;' => "\xCF\x82", 'sim;' => "\xE2\x88\xBC", 'spades;' => "\xE2\x99\xA0", 'sub;' => "\xE2\x8A\x82", 'sube;' => "\xE2\x8A\x86", 'sum;' => "\xE2\x88\x91", 'sup;' => "\xE2\x8A\x83", 'sup1' => "\xC2\xB9", 'sup1;' => "\xC2\xB9", 'sup2' => "\xC2\xB2", 'sup2;' => "\xC2\xB2", 'sup3' => "\xC2\xB3", 'sup3;' => "\xC2\xB3", 'supe;' => "\xE2\x8A\x87", 'szlig' => "\xC3\x9F", 'szlig;' => "\xC3\x9F", 'Tau;' => "\xCE\xA4", 'tau;' => "\xCF\x84", 'there4;' => "\xE2\x88\xB4", 'Theta;' => "\xCE\x98", 'theta;' => "\xCE\xB8", 'thetasym;' => "\xCF\x91", 'thinsp;' => "\xE2\x80\x89", 'THORN' => "\xC3\x9E", 'thorn' => "\xC3\xBE", 'THORN;' => "\xC3\x9E", 'thorn;' => "\xC3\xBE", 'tilde;' => "\xCB\x9C", 'times' => "\xC3\x97", 'times;' => "\xC3\x97", 'TRADE;' => "\xE2\x84\xA2", 'trade;' => "\xE2\x84\xA2", 'Uacute' => "\xC3\x9A", 'uacute' => "\xC3\xBA", 'Uacute;' => "\xC3\x9A", 'uacute;' => "\xC3\xBA", 'uArr;' => "\xE2\x87\x91", 'uarr;' => "\xE2\x86\x91", 'Ucirc' => "\xC3\x9B", 'ucirc' => "\xC3\xBB", 'Ucirc;' => "\xC3\x9B", 'ucirc;' => "\xC3\xBB", 'Ugrave' => "\xC3\x99", 'ugrave' => "\xC3\xB9", 'Ugrave;' => "\xC3\x99", 'ugrave;' => "\xC3\xB9", 'uml' => "\xC2\xA8", 'uml;' => "\xC2\xA8", 'upsih;' => "\xCF\x92", 'Upsilon;' => "\xCE\xA5", 'upsilon;' => "\xCF\x85", 'Uuml' => "\xC3\x9C", 'uuml' => "\xC3\xBC", 'Uuml;' => "\xC3\x9C", 'uuml;' => "\xC3\xBC", 'weierp;' => "\xE2\x84\x98", 'Xi;' => "\xCE\x9E", 'xi;' => "\xCE\xBE", 'Yacute' => "\xC3\x9D", 'yacute' => "\xC3\xBD", 'Yacute;' => "\xC3\x9D", 'yacute;' => "\xC3\xBD", 'yen' => "\xC2\xA5", 'yen;' => "\xC2\xA5", 'yuml' => "\xC3\xBF", 'Yuml;' => "\xC5\xB8", 'yuml;' => "\xC3\xBF", 'Zeta;' => "\xCE\x96", 'zeta;' => "\xCE\xB6", 'zwj;' => "\xE2\x80\x8D", 'zwnj;' => "\xE2\x80\x8C");
 
-			case 'KOI8-R':
-			case 'CSKOI8R':
-				return 'KOI8-R';
+				for ($i = 0, $match = null; $i < 9 && $this->consume() !== false; $i++)
+				{
+					$consumed = substr($this->consumed, 1);
+					if (isset($entities[$consumed]))
+					{
+						$match = $consumed;
+					}
+				}
 
-			case 'HZ-GB-2312':
-				return 'HZ-GB-2312';
+				if ($match !== null)
+				{
+ 					$this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1);
+					$this->position += strlen($entities[$match]) - strlen($consumed) - 1;
+				}
+				break;
+		}
+	}
+}
 
-			case 'IBM866':
-			case 'CP866':
-			case '866':
-			case 'CSIBM866':
-				return 'IBM866';
+/**
+ * IRI parser/serialiser
+ *
+ * @package SimplePie
+ */
+class SimplePie_IRI
+{
+	/**
+	 * Scheme
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $scheme;
 
-			case 'IBM775':
-			case 'CP775':
-			case 'CSPC775BALTIC':
-				return 'IBM775';
+	/**
+	 * User Information
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $userinfo;
 
-			case 'KOI8-U':
-				return 'KOI8-U';
+	/**
+	 * Host
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $host;
 
-			case 'IBM00858':
-			case 'CCSID00858':
-			case 'CP00858':
-			case 'PC-MULTILINGUAL-850+EURO':
-				return 'IBM00858';
+	/**
+	 * Port
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $port;
 
-			case 'IBM00924':
-			case 'CCSID00924':
-			case 'CP00924':
-			case 'EBCDIC-LATIN9--EURO':
-				return 'IBM00924';
+	/**
+	 * Path
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $path;
 
-			case 'IBM01140':
-			case 'CCSID01140':
-			case 'CP01140':
-			case 'EBCDIC-US-37+EURO':
-				return 'IBM01140';
+	/**
+	 * Query
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $query;
 
-			case 'IBM01141':
-			case 'CCSID01141':
-			case 'CP01141':
-			case 'EBCDIC-DE-273+EURO':
-				return 'IBM01141';
+	/**
+	 * Fragment
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $fragment;
 
-			case 'IBM01142':
-			case 'CCSID01142':
-			case 'CP01142':
-			case 'EBCDIC-DK-277+EURO':
-			case 'EBCDIC-NO-277+EURO':
-				return 'IBM01142';
+	/**
+	 * Whether the object represents a valid IRI
+	 *
+	 * @access private
+	 * @var array
+	 */
+	var $valid = array();
 
-			case 'IBM01143':
-			case 'CCSID01143':
-			case 'CP01143':
-			case 'EBCDIC-FI-278+EURO':
-			case 'EBCDIC-SE-278+EURO':
-				return 'IBM01143';
+	/**
+	 * Return the entire IRI when you try and read the object as a string
+	 *
+	 * @access public
+	 * @return string
+	 */
+	function __toString()
+	{
+		return $this->get_iri();
+	}
 
-			case 'IBM01144':
-			case 'CCSID01144':
-			case 'CP01144':
-			case 'EBCDIC-IT-280+EURO':
-				return 'IBM01144';
+	/**
+	 * Create a new IRI object, from a specified string
+	 *
+	 * @access public
+	 * @param string $iri
+	 * @return SimplePie_IRI
+	 */
+	function SimplePie_IRI($iri)
+	{
+		$iri = (string) $iri;
+		if ($iri !== '')
+		{
+			$parsed = $this->parse_iri($iri);
+			$this->set_scheme($parsed['scheme']);
+			$this->set_authority($parsed['authority']);
+			$this->set_path($parsed['path']);
+			$this->set_query($parsed['query']);
+			$this->set_fragment($parsed['fragment']);
+		}
+	}
 
-			case 'IBM01145':
-			case 'CCSID01145':
-			case 'CP01145':
-			case 'EBCDIC-ES-284+EURO':
-				return 'IBM01145';
+	/**
+	 * Create a new IRI object by resolving a relative IRI
+	 *
+	 * @static
+	 * @access public
+	 * @param SimplePie_IRI $base Base IRI
+	 * @param string $relative Relative IRI
+	 * @return SimplePie_IRI
+	 */
+	function absolutize($base, $relative)
+	{
+		$relative = (string) $relative;
+		if ($relative !== '')
+		{
+			$relative = new SimplePie_IRI($relative);
+			if ($relative->get_scheme() !== null)
+			{
+				$target = $relative;
+			}
+			elseif ($base->get_iri() !== null)
+			{
+				if ($relative->get_authority() !== null)
+				{
+					$target = $relative;
+					$target->set_scheme($base->get_scheme());
+				}
+				else
+				{
+					$target = new SimplePie_IRI('');
+					$target->set_scheme($base->get_scheme());
+					$target->set_userinfo($base->get_userinfo());
+					$target->set_host($base->get_host());
+					$target->set_port($base->get_port());
+					if ($relative->get_path() !== null)
+					{
+						if (strpos($relative->get_path(), '/') === 0)
+						{
+							$target->set_path($relative->get_path());
+						}
+						elseif (($base->get_userinfo() !== null || $base->get_host() !== null || $base->get_port() !== null) && $base->get_path() === null)
+						{
+							$target->set_path('/' . $relative->get_path());
+						}
+						elseif (($last_segment = strrpos($base->get_path(), '/')) !== false)
+						{
+							$target->set_path(substr($base->get_path(), 0, $last_segment + 1) . $relative->get_path());
+						}
+						else
+						{
+							$target->set_path($relative->get_path());
+						}
+						$target->set_query($relative->get_query());
+					}
+					else
+					{
+						$target->set_path($base->get_path());
+						if ($relative->get_query() !== null)
+						{
+							$target->set_query($relative->get_query());
+						}
+						elseif ($base->get_query() !== null)
+						{
+							$target->set_query($base->get_query());
+						}
+					}
+				}
+				$target->set_fragment($relative->get_fragment());
+			}
+			else
+			{
+				// No base URL, just return the relative URL
+				$target = $relative;
+			}
+		}
+		else
+		{
+			$target = $base;
+		}
+		return $target;
+	}
 
-			case 'IBM01146':
-			case 'CCSID01146':
-			case 'CP01146':
-			case 'EBCDIC-GB-285+EURO':
-				return 'IBM01146';
+	/**
+	 * Parse an IRI into scheme/authority/path/query/fragment segments
+	 *
+	 * @access private
+	 * @param string $iri
+	 * @return array
+	 */
+	function parse_iri($iri)
+	{
+		preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $iri, $match);
+		for ($i = count($match); $i <= 9; $i++)
+		{
+			$match[$i] = '';
+		}
+		return array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]);
+	}
 
-			case 'IBM01147':
-			case 'CCSID01147':
-			case 'CP01147':
-			case 'EBCDIC-FR-297+EURO':
-				return 'IBM01147';
+	/**
+	 * Remove dot segments from a path
+	 *
+	 * @access private
+	 * @param string $input
+	 * @return string
+	 */
+	function remove_dot_segments($input)
+	{
+		$output = '';
+		while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..')
+		{
+			// A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise,
+			if (strpos($input, '../') === 0)
+			{
+				$input = substr($input, 3);
+			}
+			elseif (strpos($input, './') === 0)
+			{
+				$input = substr($input, 2);
+			}
+			// B: if the input buffer begins with a prefix of "/./" or "/.", where "." is a complete path segment, then replace that prefix with "/" in the input buffer; otherwise,
+			elseif (strpos($input, '/./') === 0)
+			{
+				$input = substr_replace($input, '/', 0, 3);
+			}
+			elseif ($input === '/.')
+			{
+				$input = '/';
+			}
+			// C: if the input buffer begins with a prefix of "/../" or "/..", where ".." is a complete path segment, then replace that prefix with "/" in the input buffer and remove the last segment and its preceding "/" (if any) from the output buffer; otherwise,
+			elseif (strpos($input, '/../') === 0)
+			{
+				$input = substr_replace($input, '/', 0, 4);
+				$output = substr_replace($output, '', strrpos($output, '/'));
+			}
+			elseif ($input === '/..')
+			{
+				$input = '/';
+				$output = substr_replace($output, '', strrpos($output, '/'));
+			}
+			// D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise,
+			elseif ($input === '.' || $input === '..')
+			{
+				$input = '';
+			}
+			// E: move the first path segment in the input buffer to the end of the output buffer, including the initial "/" character (if any) and any subsequent characters up to, but not including, the next "/" character or the end of the input buffer
+			elseif (($pos = strpos($input, '/', 1)) !== false)
+			{
+				$output .= substr($input, 0, $pos);
+				$input = substr_replace($input, '', 0, $pos);
+			}
+			else
+			{
+				$output .= $input;
+				$input = '';
+			}
+		}
+		return $output . $input;
+	}
 
-			case 'IBM01148':
-			case 'CCSID01148':
-			case 'CP01148':
-			case 'EBCDIC-INTERNATIONAL-500+EURO':
-				return 'IBM01148';
+	/**
+	 * Replace invalid character with percent encoding
+	 *
+	 * @access private
+	 * @param string $string Input string
+	 * @param string $valid_chars Valid characters
+	 * @param int $case Normalise case
+	 * @return string
+	 */
+	function replace_invalid_with_pct_encoding($string, $valid_chars, $case = SIMPLEPIE_SAME_CASE)
+	{
+		// Normalise case
+		if ($case & SIMPLEPIE_LOWERCASE)
+		{
+			$string = strtolower($string);
+		}
+		elseif ($case & SIMPLEPIE_UPPERCASE)
+		{
+			$string = strtoupper($string);
+		}
 
-			case 'IBM01149':
-			case 'CCSID01149':
-			case 'CP01149':
-			case 'EBCDIC-IS-871+EURO':
-				return 'IBM01149';
+		// Store position and string length (to avoid constantly recalculating this)
+		$position = 0;
+		$strlen = strlen($string);
 
-			case 'BIG5-HKSCS':
-				return 'Big5-HKSCS';
+		// Loop as long as we have invalid characters, advancing the position to the next invalid character
+		while (($position += strspn($string, $valid_chars, $position)) < $strlen)
+		{
+			// If we have a % character
+			if ($string[$position] === '%')
+			{
+				// If we have a pct-encoded section
+				if ($position + 2 < $strlen && strspn($string, '0123456789ABCDEFabcdef', $position + 1, 2) === 2)
+				{
+					// Get the the represented character
+					$chr = chr(hexdec(substr($string, $position + 1, 2)));
 
-			case 'IBM1047':
-			case 'IBM-1047':
-				return 'IBM1047';
+					// If the character is valid, replace the pct-encoded with the actual character while normalising case
+					if (strpos($valid_chars, $chr) !== false)
+					{
+						if ($case & SIMPLEPIE_LOWERCASE)
+						{
+							$chr = strtolower($chr);
+						}
+						elseif ($case & SIMPLEPIE_UPPERCASE)
+						{
+							$chr = strtoupper($chr);
+						}
+						$string = substr_replace($string, $chr, $position, 3);
+						$strlen -= 2;
+						$position++;
+					}
 
-			case 'PTCP154':
-			case 'CSPTCP154':
-			case 'PT154':
-			case 'CP154':
-			case 'CYRILLIC-ASIAN':
-				return 'PTCP154';
+					// Otherwise just normalise the pct-encoded to uppercase
+					else
+					{
+						$string = substr_replace($string, strtoupper(substr($string, $position + 1, 2)), $position + 1, 2);
+						$position += 3;
+					}
+				}
+				// If we don't have a pct-encoded section, just replace the % with its own esccaped form
+				else
+				{
+					$string = substr_replace($string, '%25', $position, 1);
+					$strlen += 2;
+					$position += 3;
+				}
+			}
+			// If we have an invalid character, change into its pct-encoded form
+			else
+			{
+				$replacement = sprintf("%%%02X", ord($string[$position]));
+				$string = str_replace($string[$position], $replacement, $string);
+				$strlen = strlen($string);
+			}
+		}
+		return $string;
+	}
 
-			case 'AMIGA-1251':
-			case 'AMI1251':
-			case 'AMIGA1251':
-			case 'AMI-1251':
-				return 'Amiga-1251';
+	/**
+	 * Check if the object represents a valid IRI
+	 *
+	 * @access public
+	 * @return bool
+	 */
+	function is_valid()
+	{
+		return array_sum($this->valid) === count($this->valid);
+	}
 
-			case 'KOI7-SWITCHED':
-				return 'KOI7-switched';
+	/**
+	 * Set the scheme. Returns true on success, false on failure (if there are
+	 * any invalid characters).
+	 *
+	 * @access public
+	 * @param string $scheme
+	 * @return bool
+	 */
+	function set_scheme($scheme)
+	{
+		if ($scheme === null || $scheme === '')
+		{
+			$this->scheme = null;
+		}
+		else
+		{
+			$len = strlen($scheme);
+			switch (true)
+			{
+				case $len > 1:
+					if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-.', 1))
+					{
+						$this->scheme = null;
+						$this->valid[__FUNCTION__] = false;
+						return false;
+					}
 
-			case 'BRF':
-			case 'CSBRF':
-				return 'BRF';
+				case $len > 0:
+					if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 0, 1))
+					{
+						$this->scheme = null;
+						$this->valid[__FUNCTION__] = false;
+						return false;
+					}
+			}
+			$this->scheme = strtolower($scheme);
+		}
+		$this->valid[__FUNCTION__] = true;
+		return true;
+	}
 
-			case 'TSCII':
-			case 'CSTSCII':
-				return 'TSCII';
+	/**
+	 * Set the authority. Returns true on success, false on failure (if there are
+	 * any invalid characters).
+	 *
+	 * @access public
+	 * @param string $authority
+	 * @return bool
+	 */
+	function set_authority($authority)
+	{
+		if (($userinfo_end = strrpos($authority, '@')) !== false)
+		{
+			$userinfo = substr($authority, 0, $userinfo_end);
+			$authority = substr($authority, $userinfo_end + 1);
+		}
+		else
+		{
+			$userinfo = null;
+		}
 
-			case 'WINDOWS-1250':
-				return 'windows-1250';
+		if (($port_start = strpos($authority, ':')) !== false)
+		{
+			$port = substr($authority, $port_start + 1);
+			$authority = substr($authority, 0, $port_start);
+		}
+		else
+		{
+			$port = null;
+		}
 
-			case 'WINDOWS-1251':
-				return 'windows-1251';
+		return $this->set_userinfo($userinfo) && $this->set_host($authority) && $this->set_port($port);
+	}
 
-			case 'WINDOWS-1252':
-				return 'windows-1252';
+	/**
+	 * Set the userinfo.
+	 *
+	 * @access public
+	 * @param string $userinfo
+	 * @return bool
+	 */
+	function set_userinfo($userinfo)
+	{
+		if ($userinfo === null || $userinfo === '')
+		{
+			$this->userinfo = null;
+		}
+		else
+		{
+			$this->userinfo = $this->replace_invalid_with_pct_encoding($userinfo, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:');
+		}
+		$this->valid[__FUNCTION__] = true;
+		return true;
+	}
 
-			case 'WINDOWS-1253':
-				return 'windows-1253';
+	/**
+	 * Set the host. Returns true on success, false on failure (if there are
+	 * any invalid characters).
+	 *
+	 * @access public
+	 * @param string $host
+	 * @return bool
+	 */
+	function set_host($host)
+	{
+		if ($host === null || $host === '')
+		{
+			$this->host = null;
+			$this->valid[__FUNCTION__] = true;
+			return true;
+		}
+		elseif ($host[0] === '[' && substr($host, -1) === ']')
+		{
+			if (Net_IPv6::checkIPv6(substr($host, 1, -1)))
+			{
+				$this->host = $host;
+				$this->valid[__FUNCTION__] = true;
+				return true;
+			}
+			else
+			{
+				$this->host = null;
+				$this->valid[__FUNCTION__] = false;
+				return false;
+			}
+		}
+		else
+		{
+			$this->host = $this->replace_invalid_with_pct_encoding($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=', SIMPLEPIE_LOWERCASE);
+			$this->valid[__FUNCTION__] = true;
+			return true;
+		}
+	}
 
-			case 'WINDOWS-1254':
-				return 'windows-1254';
+	/**
+	 * Set the port. Returns true on success, false on failure (if there are
+	 * any invalid characters).
+	 *
+	 * @access public
+	 * @param string $port
+	 * @return bool
+	 */
+	function set_port($port)
+	{
+		if ($port === null || $port === '')
+		{
+			$this->port = null;
+			$this->valid[__FUNCTION__] = true;
+			return true;
+		}
+		elseif (strspn($port, '0123456789') === strlen($port))
+		{
+			$this->port = (int) $port;
+			$this->valid[__FUNCTION__] = true;
+			return true;
+		}
+		else
+		{
+			$this->port = null;
+			$this->valid[__FUNCTION__] = false;
+			return false;
+		}
+	}
 
-			case 'WINDOWS-1255':
-				return 'windows-1255';
+	/**
+	 * Set the path.
+	 *
+	 * @access public
+	 * @param string $path
+	 * @return bool
+	 */
+	function set_path($path)
+	{
+		if ($path === null || $path === '')
+		{
+			$this->path = null;
+			$this->valid[__FUNCTION__] = true;
+			return true;
+		}
+		elseif (substr($path, 0, 2) === '//' && $this->userinfo === null && $this->host === null && $this->port === null)
+		{
+			$this->path = null;
+			$this->valid[__FUNCTION__] = false;
+			return false;
+		}
+		else
+		{
+			$this->path = $this->replace_invalid_with_pct_encoding($path, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=@/');
+			if ($this->scheme !== null)
+			{
+				$this->path = $this->remove_dot_segments($this->path);
+			}
+			$this->valid[__FUNCTION__] = true;
+			return true;
+		}
+	}
 
-			case 'WINDOWS-1256':
-				return 'windows-1256';
+	/**
+	 * Set the query.
+	 *
+	 * @access public
+	 * @param string $query
+	 * @return bool
+	 */
+	function set_query($query)
+	{
+		if ($query === null || $query === '')
+		{
+			$this->query = null;
+		}
+		else
+		{
+			$this->query = $this->replace_invalid_with_pct_encoding($query, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$\'()*+,;:@/?&=');
+		}
+		$this->valid[__FUNCTION__] = true;
+		return true;
+	}
 
-			case 'WINDOWS-1257':
-				return 'windows-1257';
+	/**
+	 * Set the fragment.
+	 *
+	 * @access public
+	 * @param string $fragment
+	 * @return bool
+	 */
+	function set_fragment($fragment)
+	{
+		if ($fragment === null || $fragment === '')
+		{
+			$this->fragment = null;
+		}
+		else
+		{
+			$this->fragment = $this->replace_invalid_with_pct_encoding($fragment, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:@/?');
+		}
+		$this->valid[__FUNCTION__] = true;
+		return true;
+	}
 
-			case 'WINDOWS-1258':
-				return 'windows-1258';
+	/**
+	 * Get the complete IRI
+	 *
+	 * @access public
+	 * @return string
+	 */
+	function get_iri()
+	{
+		$iri = '';
+		if ($this->scheme !== null)
+		{
+			$iri .= $this->scheme . ':';
+		}
+		if (($authority = $this->get_authority()) !== null)
+		{
+			$iri .= '//' . $authority;
+		}
+		if ($this->path !== null)
+		{
+			$iri .= $this->path;
+		}
+		if ($this->query !== null)
+		{
+			$iri .= '?' . $this->query;
+		}
+		if ($this->fragment !== null)
+		{
+			$iri .= '#' . $this->fragment;
+		}
 
-			default:
-				return (string) $encoding;
+		if ($iri !== '')
+		{
+			return $iri;
+		}
+		else
+		{
+			return null;
 		}
 	}
 
-	function get_curl_version()
+	/**
+	 * Get the scheme
+	 *
+	 * @access public
+	 * @return string
+	 */
+	function get_scheme()
 	{
-		if (is_array($curl = curl_version()))
+		return $this->scheme;
+	}
+
+	/**
+	 * Get the complete authority
+	 *
+	 * @access public
+	 * @return string
+	 */
+	function get_authority()
+	{
+		$authority = '';
+		if ($this->userinfo !== null)
 		{
-			$curl = $curl['version'];
+			$authority .= $this->userinfo . '@';
 		}
-		elseif (substr($curl, 0, 5) == 'curl/')
+		if ($this->host !== null)
 		{
-			$curl = substr($curl, 5, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 5));
+			$authority .= $this->host;
 		}
-		elseif (substr($curl, 0, 8) == 'libcurl/')
+		if ($this->port !== null)
 		{
-			$curl = substr($curl, 8, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 8));
+			$authority .= ':' . $this->port;
+		}
+
+		if ($authority !== '')
+		{
+			return $authority;
 		}
 		else
 		{
-			$curl = 0;
+			return null;
 		}
-		return $curl;
 	}
 
-	function is_subclass_of($class1, $class2)
+	/**
+	 * Get the user information
+	 *
+	 * @access public
+	 * @return string
+	 */
+	function get_userinfo()
+	{
+		return $this->userinfo;
+	}
+
+	/**
+	 * Get the host
+	 *
+	 * @access public
+	 * @return string
+	 */
+	function get_host()
 	{
-		if (func_num_args() != 2)
+		return $this->host;
+	}
+
+	/**
+	 * Get the port
+	 *
+	 * @access public
+	 * @return string
+	 */
+	function get_port()
+	{
+		return $this->port;
+	}
+
+	/**
+	 * Get the path
+	 *
+	 * @access public
+	 * @return string
+	 */
+	function get_path()
+	{
+		return $this->path;
+	}
+
+	/**
+	 * Get the query
+	 *
+	 * @access public
+	 * @return string
+	 */
+	function get_query()
+	{
+		return $this->query;
+	}
+
+	/**
+	 * Get the fragment
+	 *
+	 * @access public
+	 * @return string
+	 */
+	function get_fragment()
+	{
+		return $this->fragment;
+	}
+}
+
+/**
+ * Class to validate and to work with IPv6 addresses.
+ *
+ * @package SimplePie
+ * @copyright 2003-2005 The PHP Group
+ * @license http://www.opensource.org/licenses/bsd-license.php
+ * @link http://pear.php.net/package/Net_IPv6
+ * @author Alexander Merz <alexander.merz@web.de>
+ * @author elfrink at introweb dot nl
+ * @author Josh Peck <jmp at joshpeck dot org>
+ * @author Geoffrey Sneddon <geoffers@gmail.com>
+ */
+class SimplePie_Net_IPv6
+{
+	/**
+	 * Removes a possible existing netmask specification of an IP address.
+	 *
+	 * @param string $ip the (compressed) IP as Hex representation
+	 * @return string the IP the without netmask
+	 * @since 1.1.0
+	 * @access public
+	 * @static
+	 */
+	function removeNetmaskSpec($ip)
+	{
+		if (strpos($ip, '/') !== false)
 		{
-			trigger_error('Wrong parameter count for SimplePie_Misc::is_subclass_of()', E_USER_WARNING);
+			list($addr, $nm) = explode('/', $ip);
 		}
-		elseif (version_compare(PHP_VERSION, '5.0.3', '>=') || is_object($class1))
+		else
 		{
-			return is_subclass_of($class1, $class2);
+			$addr = $ip;
 		}
-		elseif (is_string($class1) && is_string($class2))
+		return $addr;
+	}
+
+	/**
+	 * Uncompresses an IPv6 address
+	 *
+	 * RFC 2373 allows you to compress zeros in an address to '::'. This
+	 * function expects an valid IPv6 address and expands the '::' to
+	 * the required zeros.
+	 *
+	 * Example:	 FF01::101	->	FF01:0:0:0:0:0:0:101
+	 *			 ::1		->	0:0:0:0:0:0:0:1
+	 *
+	 * @access public
+	 * @static
+	 * @param string $ip a valid IPv6-address (hex format)
+	 * @return string the uncompressed IPv6-address (hex format)
+	 */
+	function Uncompress($ip)
+	{
+		$uip = SimplePie_Net_IPv6::removeNetmaskSpec($ip);
+		$c1 = -1;
+		$c2 = -1;
+		if (strpos($ip, '::') !== false)
 		{
-			if (class_exists($class1))
+			list($ip1, $ip2) = explode('::', $ip);
+			if ($ip1 === '')
+			{
+				$c1 = -1;
+			}
+			else
+			{
+				$pos = 0;
+				if (($pos = substr_count($ip1, ':')) > 0)
+				{
+					$c1 = $pos;
+				}
+				else
+				{
+					$c1 = 0;
+				}
+			}
+			if ($ip2 === '')
 			{
-				if (class_exists($class2))
+				$c2 = -1;
+			}
+			else
+			{
+				$pos = 0;
+				if (($pos = substr_count($ip2, ':')) > 0)
 				{
-					$class2 = strtolower($class2);
-					while ($class1 = strtolower(get_parent_class($class1)))
-					{
-						if ($class1 == $class2)
-						{
-							return true;
-						}
-					}
+					$c2 = $pos;
+				}
+				else
+				{
+					$c2 = 0;
 				}
 			}
+			if (strstr($ip2, '.'))
+			{
+				$c2++;
+			}
+			// ::
+			if ($c1 === -1 && $c2 === -1)
+			{
+				$uip = '0:0:0:0:0:0:0:0';
+			}
+			// ::xxx
+			else if ($c1 === -1)
+			{
+				$fill = str_repeat('0:', 7 - $c2);
+				$uip =	str_replace('::', $fill, $uip);
+			}
+			// xxx::
+			else if ($c2 === -1)
+			{
+				$fill = str_repeat(':0', 7 - $c1);
+				$uip =	str_replace('::', $fill, $uip);
+			}
+			// xxx::xxx
 			else
 			{
-				trigger_error('Unknown class passed as parameter', E_USER_WARNING);
+				$fill = str_repeat(':0:', 6 - $c2 - $c1);
+				$uip =	str_replace('::', $fill, $uip);
+				$uip =	str_replace('::', ':', $uip);
 			}
 		}
-		return false;
+		return $uip;
 	}
 
 	/**
-	 * Strip HTML comments
+	 * Splits an IPv6 address into the IPv6 and a possible IPv4 part
+	 *
+	 * RFC 2373 allows you to note the last two parts of an IPv6 address as
+	 * an IPv4 compatible address
+	 *
+	 * Example:	 0:0:0:0:0:0:13.1.68.3
+	 *			 0:0:0:0:0:FFFF:129.144.52.38
 	 *
 	 * @access public
-	 * @param string $data Data to strip comments from
-	 * @return string Comment stripped string
+	 * @static
+	 * @param string $ip a valid IPv6-address (hex format)
+	 * @return array [0] contains the IPv6 part, [1] the IPv4 part (hex format)
 	 */
-	function strip_comments($data)
+	function SplitV64($ip)
 	{
-		$output = '';
-		while (($start = strpos($data, '<!--')) !== false)
+		$ip = SimplePie_Net_IPv6::Uncompress($ip);
+		if (strstr($ip, '.'))
 		{
-			$output .= substr($data, 0, $start);
-			if (($end = strpos($data, '-->', $start)) !== false)
-			{
-				$data = substr_replace($data, '', 0, $end + 3);
-			}
-			else
-			{
-				$data = '';
-			}
+			$pos = strrpos($ip, ':');
+			$ip[$pos] = '_';
+			$ipPart = explode('_', $ip);
+			return $ipPart;
+		}
+		else
+		{
+			return array($ip, '');
 		}
-		return $output . $data;
 	}
 
-	function parse_date($dt, $rfc822_tz = true)
+	/**
+	 * Checks an IPv6 address
+	 *
+	 * Checks if the given IP is IPv6-compatible
+	 *
+	 * @access public
+	 * @static
+	 * @param string $ip a valid IPv6-address
+	 * @return bool true if $ip is an IPv6 address
+	 */
+	function checkIPv6($ip)
 	{
-		static $cache = array();
-		if (!isset($cache[$dt][$rfc822_tz]))
+		$ipPart = SimplePie_Net_IPv6::SplitV64($ip);
+		$count = 0;
+		if (!empty($ipPart[0]))
 		{
-			$dt = SimplePie_Misc::uncomment_rfc822($dt);
-			/*
-			Capturing subpatterns:
-			1: RFC 822 date
-			2: RFC 822 day
-			3: RFC 822 month
-			4: RFC 822 year
-			5: ISO 8601 date
-			6: ISO 8601 century
-			7: ISO 8601 year
-			8: ISO 8601 month
-			9: ISO 8601 day
-			10: ISO 8601 ordinal day
-			11: ISO 8601 month
-			12: ISO 8601 day
-			13: ISO 8601 week
-			14: ISO 8601 day of week
-			15: Time
-			16: Hour
-			17: Hour Decimal
-			18: Minute
-			19: Minute Decimal
-			20: Second
-			21: Second Decimal
-			22: Timezone
-			23: Diff ±
-			24: Hour
-			25: Hour Decimal
-			26: Minute
-			27: Minute Decimal
-			28: Alphabetic Timezone
-			*/
-			if (preg_match('/^(?:(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)[,\s]+)?(([0-9]{1,2})\s*(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s*([0-9]{4}|[0-9]{2}))|(([0-9]{2})(?:([0-9]{2})(?:(?:-|\s)*(?:([0-9]{2})([0-9]{2})|([0-9]{3})|([0-9]{2})(?:(?:-|\s)*([0-9]{2}))?|W([0-9]{2})(?:(?:-|\s)*([0-9]))?))?)?))((?:T|\s)+([0-9]{2})(?:(?:,|\.)([0-9]*)|(?:\:|\s)*([0-9]{2})(?:(?:,|\.)([0-9]*)|(?:\:|\s)*([0-9]{2})(?:(?:,|\.)([0-9]*))?)?)?(?:\s)*((?:(\+|-)([0-9]{2})(?:(?:,|\.)([0-9]*)|(?:\:|\s)*(?:([0-9]{2})(?:(?:,|\.)([0-9]*))?))?)|(UTC|GMT|EST|CST|MST|PST|EDT|CDT|MDT|PDT|UT|[A-IK-Z]))?)?$/i', $dt, $match))
+			$ipv6 = explode(':', $ipPart[0]);
+			for ($i = 0; $i < count($ipv6); $i++)
 			{
-				// Fill all matches
-				for ($i = count($match); $i <= 28; $i++)
+				$dec = hexdec($ipv6[$i]);
+				$hex = strtoupper(preg_replace('/^[0]{1,3}(.*[0-9a-fA-F])$/', '\\1', $ipv6[$i]));
+				if ($ipv6[$i] >= 0 && $dec <= 65535 && $hex === strtoupper(dechex($dec)))
 				{
-					$match[$i] = '';
+					$count++;
 				}
-				
-				// Set blank vars
-				$year = 1970;
-				$month = 1;
-				$day = 1;
-				$hour = 0;
-				$minute = 0;
-				$second = 0;
-				$timezone = false;
-
-				// RFC 822
-				if ($match[1] !== '')
+			}
+			if ($count === 8)
+			{
+				return true;
+			}
+			elseif ($count === 6 && !empty($ipPart[1]))
+			{
+				$ipv4 = explode('.', $ipPart[1]);
+				$count = 0;
+				foreach ($ipv4 as $ipv4_part)
 				{
-					if (strlen($match[4]) == 2)
-					{
-						$year = ($match[4] < 70) ? "20$match[4]" : "19$match[4]";
-					}
-					else
+					if ($ipv4_part >= 0 && $ipv4_part <= 255 && preg_match('/^\d{1,3}$/', $ipv4_part))
 					{
-						$year = $match[4];
-					}
-					switch (strtolower($match[3]))
-					{
-						case 'jan':
-							$month = 1;
-							break;
-
-						case 'feb':
-							$month = 2;
-							break;
-
-						case 'mar':
-							$month = 3;
-							break;
-
-						case 'apr':
-							$month = 4;
-							break;
-
-						case 'may':
-							$month = 5;
-							break;
-
-						case 'jun':
-							$month = 6;
-							break;
-
-						case 'jul':
-							$month = 7;
-							break;
-
-						case 'aug':
-							$month = 8;
-							break;
-
-						case 'sep':
-							$month = 9;
-							break;
-
-						case 'oct':
-							$month = 10;
-							break;
-
-						case 'nov':
-							$month = 11;
-							break;
-
-						case 'dec':
-							$month = 12;
-							break;
+						$count++;
 					}
-					$day = $match[2];
 				}
-				// ISO 8601
-				else
+				if ($count === 4)
 				{
-					// Year
-					if ($match[7] !== '')
-					{
-						$year = "$match[6]$match[7]";
-
-						// Two Digit Month/Day
-						if ($match[11] !== '')
-						{
-							$month = $match[11];
-							if ($match[12] !== '')
-							{
-								$day = $match[12];
-							}
-						}
-
-						// Four Digit Month/Day
-						elseif ($match[8] !== '')
-						{
-							$month = $match[8];
-							$day = $match[9];
-						}
-
-						// Ordinal Day
-						elseif ($match[10] !== '')
-						{
-							$day = $match[10];
-						}
-
-						// Week Date
-						elseif ($match[13] !== '')
-						{
-							// Week Day
-							if ($match[14] !== '')
-							{
-								$day = $match[14];
-							}
-
-							$first_day_of_year = date('w', mktime(0, 0, 0, 1, 1, $year));
-							if ($first_day_of_year == 0)
-							{
-								$first_day_of_year = 7;
-							}
-
-							$day = 7 * ($match[13] - 1) + $day - ($first_day_of_year - 1);
-						}
-					}
-					else
-					{
-						$year = "$match[6]00";
-					}
+					return true;
 				}
-				// Time
-				if ($match[15] !== '')
-				{
-					$time = 0;
-					$time += ($match[16] + ('.' . $match[17])) * 3600;
-					$time += ($match[18] + ('.' . $match[19])) * 60;
-					$time += $match[20] + ('.' . $match[21]);
-					$hour = floor($time / 3600);
-					$time -= $hour * 3600;
-					$minute = floor($time / 60);
-					$time -= $minute * 60;
-					$second = round($time);
-
-					// Timezone
-					if ($match[22] !== '')
-					{
-						// Alphabetic Timezone
-						if ($match[28] !== '')
-						{
-							// Military
-							if (strlen($match[28]) == 1)
-							{
-								if ($match[28] == 'Z' || $match[28] == 'z' || !$rfc822_tz)
-								{
-									$timezone = 0;
-								}
-								else
-								{
-									$timezone = ord(strtoupper($match[28]));
+			}
+			else
+			{
+				return false;
+			}
 
-									if ($timezone > 74)
-									{
-										$timezone--;
-									}
+		}
+		else
+		{
+			return false;
+		}
+	}
+}
 
-									if ($timezone <= 76)
-									{
-										$timezone = -($timezone - 64);
-									}
-									else
-									{
-										$timezone -= 76;
-									}
+/**
+ * Date Parser
+ *
+ * @package SimplePie
+ */
+class SimplePie_Parse_Date
+{
+	/**
+	 * Input data
+	 *
+	 * @access protected
+	 * @var string
+	 */
+	var $date;
 
-									$timezone *= 3600;
-								}
-							}
-							// Code
-							else
-							{
-								switch (strtoupper($match[28]))
-								{
-									case 'UT':
-									case 'UTC':
-									case 'GMT':
-										$timezone = 0;
-										break;
+	/**
+	 * List of days, calendar day name => ordinal day number in the week
+	 *
+	 * @access protected
+	 * @var array
+	 */
+	var $day = array(
+		// English
+		'mon' => 1,
+		'monday' => 1,
+		'tue' => 2,
+		'tuesday' => 2,
+		'wed' => 3,
+		'wednesday' => 3,
+		'thu' => 4,
+		'thursday' => 4,
+		'fri' => 5,
+		'friday' => 5,
+		'sat' => 6,
+		'saturday' => 6,
+		'sun' => 7,
+		'sunday' => 7,
+		// Dutch
+		'maandag' => 1,
+		'dinsdag' => 2,
+		'woensdag' => 3,
+		'donderdag' => 4,
+		'vrijdag' => 5,
+		'zaterdag' => 6,
+		'zondag' => 7,
+		// French
+		'lundi' => 1,
+		'mardi' => 2,
+		'mercredi' => 3,
+		'jeudi' => 4,
+		'vendredi' => 5,
+		'samedi' => 6,
+		'dimanche' => 7,
+		// German
+		'montag' => 1,
+		'dienstag' => 2,
+		'mittwoch' => 3,
+		'donnerstag' => 4,
+		'freitag' => 5,
+		'samstag' => 6,
+		'sonnabend' => 6,
+		'sonntag' => 7,
+		// Italian
+		'lunedì' => 1,
+		'martedì' => 2,
+		'mercoledì' => 3,
+		'giovedì' => 4,
+		'venerdì' => 5,
+		'sabato' => 6,
+		'domenica' => 7,
+		// Spanish
+		'lunes' => 1,
+		'martes' => 2,
+		'miércoles' => 3,
+		'jueves' => 4,
+		'viernes' => 5,
+		'sábado' => 6,
+		'domingo' => 7,
+		// Finnish
+		'maanantai' => 1,
+		'tiistai' => 2,
+		'keskiviikko' => 3,
+		'torstai' => 4,
+		'perjantai' => 5,
+		'lauantai' => 6,
+		'sunnuntai' => 7,
+		// Hungarian
+		'hétfő' => 1,
+		'kedd' => 2,
+		'szerda' => 3,
+		'csütörtok' => 4,
+		'péntek' => 5,
+		'szombat' => 6,
+		'vasárnap' => 7,
+		// Greek
+		'Δευ' => 1,
+		'Τρι' => 2,
+		'Τετ' => 3,
+		'Πεμ' => 4,
+		'Παρ' => 5,
+		'Σαβ' => 6,
+		'Κυρ' => 7,
+	);
 
-									case 'EST':
-										$timezone = -18000;
-										break;
+	/**
+	 * List of months, calendar month name => calendar month number
+	 *
+	 * @access protected
+	 * @var array
+	 */
+	var $month = array(
+		// English
+		'jan' => 1,
+		'january' => 1,
+		'feb' => 2,
+		'february' => 2,
+		'mar' => 3,
+		'march' => 3,
+		'apr' => 4,
+		'april' => 4,
+		'may' => 5,
+		// No long form of May
+		'jun' => 6,
+		'june' => 6,
+		'jul' => 7,
+		'july' => 7,
+		'aug' => 8,
+		'august' => 8,
+		'sep' => 9,
+		'september' => 8,
+		'oct' => 10,
+		'october' => 10,
+		'nov' => 11,
+		'november' => 11,
+		'dec' => 12,
+		'december' => 12,
+		// Dutch
+		'januari' => 1,
+		'februari' => 2,
+		'maart' => 3,
+		'april' => 4,
+		'mei' => 5,
+		'juni' => 6,
+		'juli' => 7,
+		'augustus' => 8,
+		'september' => 9,
+		'oktober' => 10,
+		'november' => 11,
+		'december' => 12,
+		// French
+		'janvier' => 1,
+		'février' => 2,
+		'mars' => 3,
+		'avril' => 4,
+		'mai' => 5,
+		'juin' => 6,
+		'juillet' => 7,
+		'août' => 8,
+		'septembre' => 9,
+		'octobre' => 10,
+		'novembre' => 11,
+		'décembre' => 12,
+		// German
+		'januar' => 1,
+		'februar' => 2,
+		'märz' => 3,
+		'april' => 4,
+		'mai' => 5,
+		'juni' => 6,
+		'juli' => 7,
+		'august' => 8,
+		'september' => 9,
+		'oktober' => 10,
+		'november' => 11,
+		'dezember' => 12,
+		// Italian
+		'gennaio' => 1,
+		'febbraio' => 2,
+		'marzo' => 3,
+		'aprile' => 4,
+		'maggio' => 5,
+		'giugno' => 6,
+		'luglio' => 7,
+		'agosto' => 8,
+		'settembre' => 9,
+		'ottobre' => 10,
+		'novembre' => 11,
+		'dicembre' => 12,
+		// Spanish
+		'enero' => 1,
+		'febrero' => 2,
+		'marzo' => 3,
+		'abril' => 4,
+		'mayo' => 5,
+		'junio' => 6,
+		'julio' => 7,
+		'agosto' => 8,
+		'septiembre' => 9,
+		'setiembre' => 9,
+		'octubre' => 10,
+		'noviembre' => 11,
+		'diciembre' => 12,
+		// Finnish
+		'tammikuu' => 1,
+		'helmikuu' => 2,
+		'maaliskuu' => 3,
+		'huhtikuu' => 4,
+		'toukokuu' => 5,
+		'kesäkuu' => 6,
+		'heinäkuu' => 7,
+		'elokuu' => 8,
+		'suuskuu' => 9,
+		'lokakuu' => 10,
+		'marras' => 11,
+		'joulukuu' => 12,
+		// Hungarian
+		'január' => 1,
+		'február' => 2,
+		'március' => 3,
+		'április' => 4,
+		'május' => 5,
+		'június' => 6,
+		'július' => 7,
+		'augusztus' => 8,
+		'szeptember' => 9,
+		'október' => 10,
+		'november' => 11,
+		'december' => 12,
+		// Greek
+		'Ιαν' => 1,
+		'Φεβ' => 2,
+		'Μάώ' => 3,
+		'Μαώ' => 3,
+		'Απρ' => 4,
+		'Μάι' => 5,
+		'Μαϊ' => 5,
+		'Μαι' => 5,
+		'Ιούν' => 6,
+		'Ιον' => 6,
+		'Ιούλ' => 7,
+		'Ιολ' => 7,
+		'Αύγ' => 8,
+		'Αυγ' => 8,
+		'Σεπ' => 9,
+		'Οκτ' => 10,
+		'Νοέ' => 11,
+		'Δεκ' => 12,
+	);
 
-									case 'CST':
-										$timezone = -21600;
-										break;
+	/**
+	 * List of timezones, abbreviation => offset from UTC
+	 *
+	 * @access protected
+	 * @var array
+	 */
+	var $timezone = array(
+		'ACDT' => 37800,
+		'ACIT' => 28800,
+		'ACST' => 34200,
+		'ACT' => -18000,
+		'ACWDT' => 35100,
+		'ACWST' => 31500,
+		'AEDT' => 39600,
+		'AEST' => 36000,
+		'AFT' => 16200,
+		'AKDT' => -28800,
+		'AKST' => -32400,
+		'AMDT' => 18000,
+		'AMT' => -14400,
+		'ANAST' => 46800,
+		'ANAT' => 43200,
+		'ART' => -10800,
+		'AZOST' => -3600,
+		'AZST' => 18000,
+		'AZT' => 14400,
+		'BIOT' => 21600,
+		'BIT' => -43200,
+		'BOT' => -14400,
+		'BRST' => -7200,
+		'BRT' => -10800,
+		'BST' => 3600,
+		'BTT' => 21600,
+		'CAST' => 18000,
+		'CAT' => 7200,
+		'CCT' => 23400,
+		'CDT' => -18000,
+		'CEDT' => 7200,
+		'CET' => 3600,
+		'CGST' => -7200,
+		'CGT' => -10800,
+		'CHADT' => 49500,
+		'CHAST' => 45900,
+		'CIST' => -28800,
+		'CKT' => -36000,
+		'CLDT' => -10800,
+		'CLST' => -14400,
+		'COT' => -18000,
+		'CST' => -21600,
+		'CVT' => -3600,
+		'CXT' => 25200,
+		'DAVT' => 25200,
+		'DTAT' => 36000,
+		'EADT' => -18000,
+		'EAST' => -21600,
+		'EAT' => 10800,
+		'ECT' => -18000,
+		'EDT' => -14400,
+		'EEST' => 10800,
+		'EET' => 7200,
+		'EGT' => -3600,
+		'EKST' => 21600,
+		'EST' => -18000,
+		'FJT' => 43200,
+		'FKDT' => -10800,
+		'FKST' => -14400,
+		'FNT' => -7200,
+		'GALT' => -21600,
+		'GEDT' => 14400,
+		'GEST' => 10800,
+		'GFT' => -10800,
+		'GILT' => 43200,
+		'GIT' => -32400,
+		'GST' => 14400,
+		'GST' => -7200,
+		'GYT' => -14400,
+		'HAA' => -10800,
+		'HAC' => -18000,
+		'HADT' => -32400,
+		'HAE' => -14400,
+		'HAP' => -25200,
+		'HAR' => -21600,
+		'HAST' => -36000,
+		'HAT' => -9000,
+		'HAY' => -28800,
+		'HKST' => 28800,
+		'HMT' => 18000,
+		'HNA' => -14400,
+		'HNC' => -21600,
+		'HNE' => -18000,
+		'HNP' => -28800,
+		'HNR' => -25200,
+		'HNT' => -12600,
+		'HNY' => -32400,
+		'IRDT' => 16200,
+		'IRKST' => 32400,
+		'IRKT' => 28800,
+		'IRST' => 12600,
+		'JFDT' => -10800,
+		'JFST' => -14400,
+		'JST' => 32400,
+		'KGST' => 21600,
+		'KGT' => 18000,
+		'KOST' => 39600,
+		'KOVST' => 28800,
+		'KOVT' => 25200,
+		'KRAST' => 28800,
+		'KRAT' => 25200,
+		'KST' => 32400,
+		'LHDT' => 39600,
+		'LHST' => 37800,
+		'LINT' => 50400,
+		'LKT' => 21600,
+		'MAGST' => 43200,
+		'MAGT' => 39600,
+		'MAWT' => 21600,
+		'MDT' => -21600,
+		'MESZ' => 7200,
+		'MEZ' => 3600,
+		'MHT' => 43200,
+		'MIT' => -34200,
+		'MNST' => 32400,
+		'MSDT' => 14400,
+		'MSST' => 10800,
+		'MST' => -25200,
+		'MUT' => 14400,
+		'MVT' => 18000,
+		'MYT' => 28800,
+		'NCT' => 39600,
+		'NDT' => -9000,
+		'NFT' => 41400,
+		'NMIT' => 36000,
+		'NOVST' => 25200,
+		'NOVT' => 21600,
+		'NPT' => 20700,
+		'NRT' => 43200,
+		'NST' => -12600,
+		'NUT' => -39600,
+		'NZDT' => 46800,
+		'NZST' => 43200,
+		'OMSST' => 25200,
+		'OMST' => 21600,
+		'PDT' => -25200,
+		'PET' => -18000,
+		'PETST' => 46800,
+		'PETT' => 43200,
+		'PGT' => 36000,
+		'PHOT' => 46800,
+		'PHT' => 28800,
+		'PKT' => 18000,
+		'PMDT' => -7200,
+		'PMST' => -10800,
+		'PONT' => 39600,
+		'PST' => -28800,
+		'PWT' => 32400,
+		'PYST' => -10800,
+		'PYT' => -14400,
+		'RET' => 14400,
+		'ROTT' => -10800,
+		'SAMST' => 18000,
+		'SAMT' => 14400,
+		'SAST' => 7200,
+		'SBT' => 39600,
+		'SCDT' => 46800,
+		'SCST' => 43200,
+		'SCT' => 14400,
+		'SEST' => 3600,
+		'SGT' => 28800,
+		'SIT' => 28800,
+		'SRT' => -10800,
+		'SST' => -39600,
+		'SYST' => 10800,
+		'SYT' => 7200,
+		'TFT' => 18000,
+		'THAT' => -36000,
+		'TJT' => 18000,
+		'TKT' => -36000,
+		'TMT' => 18000,
+		'TOT' => 46800,
+		'TPT' => 32400,
+		'TRUT' => 36000,
+		'TVT' => 43200,
+		'TWT' => 28800,
+		'UYST' => -7200,
+		'UYT' => -10800,
+		'UZT' => 18000,
+		'VET' => -14400,
+		'VLAST' => 39600,
+		'VLAT' => 36000,
+		'VOST' => 21600,
+		'VUT' => 39600,
+		'WAST' => 7200,
+		'WAT' => 3600,
+		'WDT' => 32400,
+		'WEST' => 3600,
+		'WFT' => 43200,
+		'WIB' => 25200,
+		'WIT' => 32400,
+		'WITA' => 28800,
+		'WKST' => 18000,
+		'WST' => 28800,
+		'YAKST' => 36000,
+		'YAKT' => 32400,
+		'YAPT' => 36000,
+		'YEKST' => 21600,
+		'YEKT' => 18000,
+	);
 
-									case 'MST':
-										$timezone = -25200;
-										break;
+	/**
+	 * Cached PCRE for SimplePie_Parse_Date::$day
+	 *
+	 * @access protected
+	 * @var string
+	 */
+	var $day_pcre;
 
-									case 'PST':
-										$timezone = -28800;
-										break;
+	/**
+	 * Cached PCRE for SimplePie_Parse_Date::$month
+	 *
+	 * @access protected
+	 * @var string
+	 */
+	var $month_pcre;
 
-									case 'EDT':
-										$timezone = -14400;
-										break;
+	/**
+	 * Array of user-added callback methods
+	 *
+	 * @access private
+	 * @var array
+	 */
+	var $built_in = array();
 
-									case 'CDT':
-										$timezone = -18000;
-										break;
+	/**
+	 * Array of user-added callback methods
+	 *
+	 * @access private
+	 * @var array
+	 */
+	var $user = array();
 
-									case 'MDT':
-										$timezone = -21600;
-										break;
+	/**
+	 * Create new SimplePie_Parse_Date object, and set self::day_pcre,
+	 * self::month_pcre, and self::built_in
+	 *
+	 * @access private
+	 */
+	function SimplePie_Parse_Date()
+	{
+		$this->day_pcre = '(' . implode(array_keys($this->day), '|') . ')';
+		$this->month_pcre = '(' . implode(array_keys($this->month), '|') . ')';
 
-									case 'PDT':
-										$timezone = -25200;
-										break;
-								}
-							}
-						}
-						// Timezone difference from UTC
-						else
-						{
-							$timezone = 0;
-							$timezone += ($match[24] + ('.' . $match[25])) * 3600;
-							$timezone += ($match[26] + ('.' . $match[27])) * 60;
-							$timezone = (int) round($timezone);
+		static $cache;
+		if (!isset($cache[get_class($this)]))
+		{
+			$all_methods = get_class_methods($this);
 
-							if ($match[23] == '-')
-							{
-								$timezone = -$timezone;
-							}
-						}
-					}
-				}
-				if ($timezone === false)
-				{
-					$cache[$dt][$rfc822_tz] = mktime($hour, $minute, $second, $month, $day, $year);
-				}
-				else
+			foreach ($all_methods as $method)
+			{
+				if (strtolower(substr($method, 0, 5)) === 'date_')
 				{
-					$cache[$dt][$rfc822_tz] = gmmktime($hour, $minute, $second, $month, $day, $year) - $timezone;
+					$cache[get_class($this)][] = $method;
 				}
 			}
-			elseif (($time = strtotime($dt)) > 0)
-			{
-				$cache[$dt][$rfc822_tz] = $time;
-			}
-			else
-			{
-				$cache[$dt][$rfc822_tz] = false;
-			}
 		}
-		return $cache[$dt][$rfc822_tz];
+
+		foreach ($cache[get_class($this)] as $method)
+		{
+			$this->built_in[] = $method;
+		}
 	}
 
 	/**
-	 * Decode HTML entities
+	 * Get the object
 	 *
-	 * @static
 	 * @access public
-	 * @param string $data Input data
-	 * @return string Output data
 	 */
-	function entities_decode($data)
+	function get()
 	{
-		$decoder = new SimplePie_Decode_HTML_Entities($data);
-		return $decoder->parse();
+		static $object;
+		if (!$object)
+		{
+			$object = new SimplePie_Parse_Date;
+		}
+		return $object;
 	}
 
 	/**
-	 * Remove RFC822 comments
+	 * Parse a date
 	 *
-	 * @author Tomas V.V.Cox <cox@idecnet.com>
-	 * @author Pierre-Alain Joye <pajoye@php.net>
-	 * @author Amir Mohammad Saied <amir@php.net>
-	 * @copyright 1997-2006 Pierre-Alain Joye,Tomas V.V.Cox,Amir Mohammad Saied
-	 * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
-	 * @version CVS: $Id: Validate.php,v 1.104 2006/11/17 16:32:06 amir Exp $
-	 * @link http://pear.php.net/package/Validate
+	 * @final
 	 * @access public
-	 * @param string $data Data to strip comments from
-	 * @return string Comment stripped string
+	 * @param string $date Date to parse
+	 * @return int Timestamp corresponding to date string, or false on failure
 	 */
-	function uncomment_rfc822($data)
-	{
-		if ((version_compare(PHP_VERSION, '4.4.6', '>=') && version_compare(PHP_VERSION, '5', '<')) || version_compare(PHP_VERSION, '5.2.2', '>='))
-		{
-			return $data;
-		}
-		else
-		{
-			return preg_replace('/((?:(?:\\\\"|[^("])*(?:"(?:[^"\\\\\r]|\\\\.)*"\s*)?)*)((?<!\\\\)\((?:(?2)|.)*?(?<!\\\\)\))/', '$1', $data);
-		}
-	}
-
-	function parse_mime($mime)
+	function parse($date)
 	{
-		if (($pos = strpos($mime, ';')) === false)
+		foreach ($this->user as $method)
 		{
-			return trim($mime);
+			if (($returned = call_user_func($method, $date)) !== false)
+			{
+				return $returned;
+			}
 		}
-		else
+
+		foreach ($this->built_in as $method)
 		{
-			return trim(substr($mime, 0, $pos));
+			if (($returned = call_user_func(array(&$this, $method), $date)) !== false)
+			{
+				return $returned;
+			}
 		}
+
+		return false;
 	}
 
-	function htmlspecialchars_decode($string, $quote_style)
+	/**
+	 * Add a callback method to parse a date
+	 *
+	 * @final
+	 * @access public
+	 * @param callback $callback
+	 */
+	function add_callback($callback)
 	{
-		if (function_exists('htmlspecialchars_decode'))
+		if (is_callable($callback))
 		{
-			return htmlspecialchars_decode($string, $quote_style);
+			$this->user[] = $callback;
 		}
 		else
 		{
-			return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style)));
+			trigger_error('User-supplied function must be a valid callback', E_USER_WARNING);
 		}
 	}
 
-	function atom_03_construct_type($attribs)
+	/**
+	 * Parse a superset of W3C-DTF (allows hyphens and colons to be omitted, as
+	 * well as allowing any of upper or lower case "T", horizontal tabs, or
+	 * spaces to be used as the time seperator (including more than one))
+	 *
+	 * @access protected
+	 * @return int Timestamp
+	 */
+	function date_w3cdtf($date)
 	{
-		if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode']) == 'base64'))
-		{
-			$mode = SIMPLEPIE_CONSTRUCT_BASE64;
-		}
-		else
+		static $pcre;
+		if (!$pcre)
 		{
-			$mode = SIMPLEPIE_CONSTRUCT_NONE;
+			$year = '([0-9]{4})';
+			$month = $day = $hour = $minute = $second = '([0-9]{2})';
+			$decimal = '([0-9]*)';
+			$zone = '(?:(Z)|([+\-])([0-9]{1,2}):?([0-9]{1,2}))';
+			$pcre = '/^' . $year . '(?:-?' . $month . '(?:-?' . $day . '(?:[Tt\x09\x20]+' . $hour . '(?::?' . $minute . '(?::?' . $second . '(?:.' . $decimal . ')?)?)?' . $zone . ')?)?)?$/';
 		}
-		if (isset($attribs['']['type']))
+		if (preg_match($pcre, $date, $match))
 		{
-			switch (strtolower(trim($attribs['']['type'])))
-			{
-				case 'text':
-				case 'text/plain':
-					return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
+			/*
+			Capturing subpatterns:
+			1: Year
+			2: Month
+			3: Day
+			4: Hour
+			5: Minute
+			6: Second
+			7: Decimal fraction of a second
+			8: Zulu
+			9: Timezone ±
+			10: Timezone hours
+			11: Timezone minutes
+			*/
 
-				case 'html':
-				case 'text/html':
-					return SIMPLEPIE_CONSTRUCT_HTML | $mode;
+			// Fill in empty matches
+			for ($i = count($match); $i <= 3; $i++)
+			{
+				$match[$i] = '1';
+			}
 
-				case 'xhtml':
-				case 'application/xhtml+xml':
-					return SIMPLEPIE_CONSTRUCT_XHTML | $mode;
+			for ($i = count($match); $i <= 7; $i++)
+			{
+				$match[$i] = '0';
+			}
 
-				default:
-					return SIMPLEPIE_CONSTRUCT_NONE | $mode;
+			// Numeric timezone
+			if (isset($match[9]) && $match[9] !== '')
+			{
+				$timezone = $match[10] * 3600;
+				$timezone += $match[11] * 60;
+				if ($match[9] === '-')
+				{
+					$timezone = 0 - $timezone;
+				}
+			}
+			else
+			{
+				$timezone = 0;
 			}
+
+			// Convert the number of seconds to an integer, taking decimals into account
+			$second = round($match[6] + $match[7] / pow(10, strlen($match[7])));
+
+			return gmmktime($match[4], $match[5], $second, $match[2], $match[3], $match[1]) - $timezone;
 		}
 		else
 		{
-			return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
+			return false;
 		}
 	}
 
-	function atom_10_construct_type($attribs)
+	/**
+	 * Remove RFC822 comments
+	 *
+	 * @access protected
+	 * @param string $data Data to strip comments from
+	 * @return string Comment stripped string
+	 */
+	function remove_rfc2822_comments($string)
 	{
-		if (isset($attribs['']['type']))
-		{
-			switch (strtolower(trim($attribs['']['type'])))
-			{
-				case 'text':
-					return SIMPLEPIE_CONSTRUCT_TEXT;
+		$string = (string) $string;
+		$position = 0;
+		$length = strlen($string);
+		$depth = 0;
 
-				case 'html':
-					return SIMPLEPIE_CONSTRUCT_HTML;
+		$output = '';
 
-				case 'xhtml':
-					return SIMPLEPIE_CONSTRUCT_XHTML;
+		while ($position < $length && ($pos = strpos($string, '(', $position)) !== false)
+		{
+			$output .= substr($string, $position, $pos - $position);
+			$position = $pos + 1;
+			if ($string[$pos - 1] !== '\\')
+			{
+				$depth++;
+				while ($depth && $position < $length)
+				{
+					$position += strcspn($string, '()', $position);
+					if ($string[$position - 1] === '\\')
+					{
+						$position++;
+						continue;
+					}
+					elseif (isset($string[$position]))
+					{
+						switch ($string[$position])
+						{
+							case '(':
+								$depth++;
+								break;
 
-				default:
-					return SIMPLEPIE_CONSTRUCT_NONE;
+							case ')':
+								$depth--;
+								break;
+						}
+						$position++;
+					}
+					else
+					{
+						break;
+					}
+				}
+			}
+			else
+			{
+				$output .= '(';
 			}
 		}
-		return SIMPLEPIE_CONSTRUCT_TEXT;
+		$output .= substr($string, $position);
+
+		return $output;
 	}
 
-	function atom_10_content_construct_type($attribs)
+	/**
+	 * Parse RFC2822's date format
+	 *
+	 * @access protected
+	 * @return int Timestamp
+	 */
+	function date_rfc2822($date)
 	{
-		if (isset($attribs['']['type']))
+		static $pcre;
+		if (!$pcre)
 		{
-			$type = strtolower(trim($attribs['']['type']));
-			switch ($type)
-			{
-				case 'text':
-					return SIMPLEPIE_CONSTRUCT_TEXT;
+			$wsp = '[\x09\x20]';
+			$fws = '(?:' . $wsp . '+|' . $wsp . '*(?:\x0D\x0A' . $wsp . '+)+)';
+			$optional_fws = $fws . '?';
+			$day_name = $this->day_pcre;
+			$month = $this->month_pcre;
+			$day = '([0-9]{1,2})';
+			$hour = $minute = $second = '([0-9]{2})';
+			$year = '([0-9]{2,4})';
+			$num_zone = '([+\-])([0-9]{2})([0-9]{2})';
+			$character_zone = '([A-Z]{1,5})';
+			$zone = '(?:' . $num_zone . '|' . $character_zone . ')';
+			$pcre = '/(?:' . $optional_fws . $day_name . $optional_fws . ',)?' . $optional_fws . $day . $fws . $month . $fws . $year . $fws . $hour . $optional_fws . ':' . $optional_fws . $minute . '(?:' . $optional_fws . ':' . $optional_fws . $second . ')?' . $fws . $zone . '/i';
+		}
+		if (preg_match($pcre, $this->remove_rfc2822_comments($date), $match))
+		{
+			/*
+			Capturing subpatterns:
+			1: Day name
+			2: Day
+			3: Month
+			4: Year
+			5: Hour
+			6: Minute
+			7: Second
+			8: Timezone ±
+			9: Timezone hours
+			10: Timezone minutes
+			11: Alphabetic timezone
+			*/
 
-				case 'html':
-					return SIMPLEPIE_CONSTRUCT_HTML;
+			// Find the month number
+			$month = $this->month[strtolower($match[3])];
 
-				case 'xhtml':
-					return SIMPLEPIE_CONSTRUCT_XHTML;
+			// Numeric timezone
+			if ($match[8] !== '')
+			{
+				$timezone = $match[9] * 3600;
+				$timezone += $match[10] * 60;
+				if ($match[8] === '-')
+				{
+					$timezone = 0 - $timezone;
+				}
 			}
-			if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) == 'text/')
+			// Character timezone
+			elseif (isset($this->timezone[strtoupper($match[11])]))
 			{
-				return SIMPLEPIE_CONSTRUCT_NONE;
+				$timezone = $this->timezone[strtoupper($match[11])];
 			}
+			// Assume everything else to be -0000
 			else
 			{
-				return SIMPLEPIE_CONSTRUCT_BASE64;
+				$timezone = 0;
+			}
+
+			// Deal with 2/3 digit years
+			if ($match[4] < 50)
+			{
+				$match[4] += 2000;
+			}
+			elseif ($match[4] < 1000)
+			{
+				$match[4] += 1900;
+			}
+
+			// Second is optional, if it is empty set it to zero
+			if ($match[7] !== '')
+			{
+				$second = $match[7];
+			}
+			else
+			{
+				$second = 0;
 			}
+
+			return gmmktime($match[5], $match[6], $second, $month, $match[2], $match[4]) - $timezone;
 		}
 		else
 		{
-			return SIMPLEPIE_CONSTRUCT_TEXT;
+			return false;
 		}
 	}
 
-	function is_isegment_nz_nc($string)
+	/**
+	 * Parse RFC850's date format
+	 *
+	 * @access protected
+	 * @return int Timestamp
+	 */
+	function date_rfc850($date)
 	{
-		return (bool) preg_match('/^([A-Za-z0-9\-._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!$&\'()*+,;=@]|(%[0-9ABCDEF]{2}))+$/u', $string);
-	}
+		static $pcre;
+		if (!$pcre)
+		{
+			$space = '[\x09\x20]+';
+			$day_name = $this->day_pcre;
+			$month = $this->month_pcre;
+			$day = '([0-9]{1,2})';
+			$year = $hour = $minute = $second = '([0-9]{2})';
+			$zone = '([A-Z]{1,5})';
+			$pcre = '/^' . $day_name . ',' . $space . $day . '-' . $month . '-' . $year . $space . $hour . ':' . $minute . ':' . $second . $space . $zone . '$/i';
+		}
+		if (preg_match($pcre, $date, $match))
+		{
+			/*
+			Capturing subpatterns:
+			1: Day name
+			2: Day
+			3: Month
+			4: Year
+			5: Hour
+			6: Minute
+			7: Second
+			8: Timezone
+			*/
 
-	function space_seperated_tokens($string)
-	{
-		$space_characters = "\x20\x09\x0A\x0B\x0C\x0D";
-		$string_length = strlen($string);
+			// Month
+			$month = $this->month[strtolower($match[3])];
 
-		$position = strspn($string, $space_characters);
-		$tokens = array();
+			// Character timezone
+			if (isset($this->timezone[strtoupper($match[8])]))
+			{
+				$timezone = $this->timezone[strtoupper($match[8])];
+			}
+			// Assume everything else to be -0000
+			else
+			{
+				$timezone = 0;
+			}
 
-		while ($position < $string_length)
+			// Deal with 2 digit year
+			if ($match[4] < 50)
+			{
+				$match[4] += 2000;
+			}
+			else
+			{
+				$match[4] += 1900;
+			}
+
+			return gmmktime($match[5], $match[6], $match[7], $month, $match[2], $match[4]) - $timezone;
+		}
+		else
 		{
-			$len = strcspn($string, $space_characters, $position);
-			$tokens[] = substr($string, $position, $len);
-			$position += $len;
-			$position += strspn($string, $space_characters, $position);
+			return false;
 		}
+	}
 
-		return $tokens;
+	/**
+	 * Parse C99's asctime()'s date format
+	 *
+	 * @access protected
+	 * @return int Timestamp
+	 */
+	function date_asctime($date)
+	{
+		static $pcre;
+		if (!$pcre)
+		{
+			$space = '[\x09\x20]+';
+			$wday_name = $this->day_pcre;
+			$mon_name = $this->month_pcre;
+			$day = '([0-9]{1,2})';
+			$hour = $sec = $min = '([0-9]{2})';
+			$year = '([0-9]{4})';
+			$terminator = '\x0A?\x00?';
+			$pcre = '/^' . $wday_name . $space . $mon_name . $space . $day . $space . $hour . ':' . $min . ':' . $sec . $space . $year . $terminator . '$/i';
+		}
+		if (preg_match($pcre, $date, $match))
+		{
+			/*
+			Capturing subpatterns:
+			1: Day name
+			2: Month
+			3: Day
+			4: Hour
+			5: Minute
+			6: Second
+			7: Year
+			*/
+
+			$month = $this->month[strtolower($match[2])];
+			return gmmktime($match[4], $match[5], $match[6], $month, $match[3], $match[7]);
+		}
+		else
+		{
+			return false;
+		}
 	}
 
-	function array_unique($array)
+	/**
+	 * Parse dates using strtotime()
+	 *
+	 * @access protected
+	 * @return int Timestamp
+	 */
+	function date_strtotime($date)
 	{
-		if (version_compare(PHP_VERSION, '5.2', '>='))
+		$strtotime = strtotime($date);
+		if ($strtotime === -1 || $strtotime === false)
 		{
-			return array_unique($array);
+			return false;
 		}
 		else
 		{
-			$array = (array) $array;
-			$new_array = array();
-			$new_array_strings = array();
-			foreach ($array as $key => $value)
+			return $strtotime;
+		}
+	}
+}
+
+/**
+ * Content-type sniffing
+ *
+ * @package SimplePie
+ */
+class SimplePie_Content_Type_Sniffer
+{
+	/**
+	 * File object
+	 *
+	 * @var SimplePie_File
+	 * @access private
+	 */
+	var $file;
+
+	/**
+	 * Create an instance of the class with the input file
+	 *
+	 * @access public
+	 * @param SimplePie_Content_Type_Sniffer $file Input file
+	 */
+	function SimplePie_Content_Type_Sniffer($file)
+	{
+		$this->file = $file;
+	}
+
+	/**
+	 * Get the Content-Type of the specified file
+	 *
+	 * @access public
+	 * @return string Actual Content-Type
+	 */
+	function get_type()
+	{
+		if (isset($this->file->headers['content-type']))
+		{
+			if (!isset($this->file->headers['content-encoding'])
+				&& ($this->file->headers['content-type'] === 'text/plain'
+					|| $this->file->headers['content-type'] === 'text/plain; charset=ISO-8859-1'
+					|| $this->file->headers['content-type'] === 'text/plain; charset=iso-8859-1'))
 			{
-				if (is_object($value))
-				{
-					if (method_exists($value, '__toString'))
-					{
-						$cmp = $value->__toString();
-					}
-					else
-					{
-						trigger_error('Object of class ' . get_class($value) . ' could not be converted to string', E_USER_ERROR);
-					}
-				}
-				elseif (is_array($value))
+				return $this->text_or_binary();
+			}
+
+			if (($pos = strpos($this->file->headers['content-type'], ';')) !== false)
+			{
+				$official = substr($this->file->headers['content-type'], 0, $pos);
+			}
+			else
+			{
+				$official = $this->file->headers['content-type'];
+			}
+			$official = strtolower($official);
+
+			if ($official === 'unknown/unknown'
+				|| $official === 'application/unknown')
+			{
+				return $this->unknown();
+			}
+			elseif (substr($official, -4) === '+xml'
+				|| $official === 'text/xml'
+				|| $official === 'application/xml')
+			{
+				return $official;
+			}
+			elseif (substr($official, 0, 6) === 'image/')
+			{
+				if ($return = $this->image())
 				{
-					$cmp = (string) reset($value);
+					return $return;
 				}
 				else
 				{
-					$cmp = (string) $value;
-				}
-				if (!in_array($cmp, $new_array_strings))
-				{
-					$new_array[$key] = $value;
-					$new_array_strings[] = $cmp;
+					return $official;
 				}
 			}
-			return $new_array;
+			elseif ($official === 'text/html')
+			{
+				return $this->feed_or_html();
+			}
+			else
+			{
+				return $official;
+			}
+		}
+		else
+		{
+			return $this->unknown();
 		}
 	}
 
 	/**
-	 * Converts a unicode codepoint to a UTF-8 character
+	 * Sniff text or binary
 	 *
-	 * @static
-	 * @access public
-	 * @param int $codepoint Unicode codepoint
-	 * @return string UTF-8 character
+	 * @access private
+	 * @return string Actual Content-Type
 	 */
-	function codepoint_to_utf8($codepoint)
+	function text_or_binary()
 	{
-		static $cache = array();
-		$codepoint = (int) $codepoint;
-		if (isset($cache[$codepoint]))
+		if (substr($this->file->body, 0, 2) === "\xFE\xFF"
+			|| substr($this->file->body, 0, 2) === "\xFF\xFE"
+			|| substr($this->file->body, 0, 4) === "\x00\x00\xFE\xFF"
+			|| substr($this->file->body, 0, 3) === "\xEF\xBB\xBF")
 		{
-			return $cache[$codepoint];
+			return 'text/plain';
 		}
-		elseif ($codepoint < 0)
+		elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body))
 		{
-			return $cache[$codepoint] = false;
+			return 'application/octect-stream';
 		}
-		else if ($codepoint <= 0x7f)
+		else
 		{
-			return $cache[$codepoint] = chr($codepoint);
+			return 'text/plain';
 		}
-		else if ($codepoint <= 0x7ff)
+	}
+
+	/**
+	 * Sniff unknown
+	 *
+	 * @access private
+	 * @return string Actual Content-Type
+	 */
+	function unknown()
+	{
+		$ws = strspn($this->file->body, "\x09\x0A\x0B\x0C\x0D\x20");
+		if (strtolower(substr($this->file->body, $ws, 14)) === '<!doctype html'
+			|| strtolower(substr($this->file->body, $ws, 5)) === '<html'
+			|| strtolower(substr($this->file->body, $ws, 7)) === '<script')
 		{
-			return $cache[$codepoint] = chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
+			return 'text/html';
 		}
-		else if ($codepoint <= 0xffff)
+		elseif (substr($this->file->body, 0, 5) === '%PDF-')
 		{
-			return $cache[$codepoint] = chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
+			return 'application/pdf';
 		}
-		else if ($codepoint <= 0x10ffff)
+		elseif (substr($this->file->body, 0, 11) === '%!PS-Adobe-')
+		{
+			return 'application/postscript';
+		}
+		elseif (substr($this->file->body, 0, 6) === 'GIF87a'
+			|| substr($this->file->body, 0, 6) === 'GIF89a')
+		{
+			return 'image/gif';
+		}
+		elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
+		{
+			return 'image/png';
+		}
+		elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF")
+		{
+			return 'image/jpeg';
+		}
+		elseif (substr($this->file->body, 0, 2) === "\x42\x4D")
 		{
-			return $cache[$codepoint] = chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
+			return 'image/bmp';
 		}
 		else
 		{
-			// U+FFFD REPLACEMENT CHARACTER
-			return $cache[$codepoint] = "\xEF\xBF\xBD";
+			return $this->text_or_binary();
 		}
 	}
 
 	/**
-	 * Re-implementation of PHP 4.2.0's is_a()
+	 * Sniff images
 	 *
-	 * @static
-	 * @access public
-	 * @param object $object The tested object
-	 * @param string $class_name The class name
-	 * @return bool Returns true if the object is of this class or has this class as one of its parents, false otherwise
-	 */
-	 function is_a($object, $class_name)
-	 {
-	 	if (function_exists('is_a'))
-	 	{
-	 		return is_a($object, $class_name);
-	 	}
-	 	elseif (!is_object($object))
-	 	{
-	 		return false;
-	 	}
-	 	elseif (get_class($object) == strtolower($class_name))
-	 	{
-	 		return true;
-	 	}
-	 	else
-	 	{
-	 		return is_subclass_of($object, $class_name);
-	 	}
-	 }
+	 * @access private
+	 * @return string Actual Content-Type
+	 */
+	function image()
+	{
+		if (substr($this->file->body, 0, 6) === 'GIF87a'
+			|| substr($this->file->body, 0, 6) === 'GIF89a')
+		{
+			return 'image/gif';
+		}
+		elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
+		{
+			return 'image/png';
+		}
+		elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF")
+		{
+			return 'image/jpeg';
+		}
+		elseif (substr($this->file->body, 0, 2) === "\x42\x4D")
+		{
+			return 'image/bmp';
+		}
+		else
+		{
+			return false;
+		}
+	}
 
 	/**
-	 * Re-implementation of PHP 5's stripos()
-	 *
-	 * Returns the numeric position of the first occurrence of needle in the
-	 * haystack string.
+	 * Sniff HTML
 	 *
-	 * @static
-	 * @access string
-	 * @param object $haystack
-	 * @param string $needle Note that the needle may be a string of one or more
-	 *     characters. If needle is not a string, it is converted to an integer
-	 *     and applied as the ordinal value of a character.
-	 * @param int $offset The optional offset parameter allows you to specify which
-	 *     character in haystack to start searching. The position returned is still
-	 *     relative to the beginning of haystack.
-	 * @return bool If needle is not found, stripos() will return boolean false.
+	 * @access private
+	 * @return string Actual Content-Type
 	 */
-	 function stripos($haystack, $needle, $offset = 0)
-	 {
-	 	if (function_exists('stripos'))
-	 	{
-	 		return stripos($haystack, $needle, $offset);
-	 	}
-	 	else
-	 	{
-	 		if (is_string($needle))
-	 		{
-	 			$needle = strtolower($needle);
-	 		}
-	 		elseif (is_int($needle) || is_bool($needle) || is_double($needle))
-	 		{
-	 			$needle = strtolower(chr($needle));
-	 		}
-	 		else
-	 		{
-	 			trigger_error('needle is not a string or an integer', E_USER_WARNING);
-	 			return false;
-	 		}
-
-	 		return strpos(strtolower($haystack), $needle, $offset);
-	 	}
-	 }
+	function feed_or_html()
+	{
+		$len = strlen($this->file->body);
+		$pos = strspn($this->file->body, "\x09\x0A\x0D\x20");
+
+		while ($pos < $len)
+		{
+			switch ($this->file->body[$pos])
+			{
+				case "\x09":
+				case "\x0A":
+				case "\x0D":
+				case "\x20":
+					$pos += strspn($this->file->body, "\x09\x0A\x0D\x20", $pos);
+					continue 2;
+
+				case '<':
+					$pos++;
+					break;
+
+				default:
+					return 'text/html';
+			}
+
+			if (substr($this->file->body, $pos, 3) === '!--')
+			{
+				$pos += 3;
+				if ($pos < $len && ($pos = strpos($this->file->body, '-->', $pos)) !== false)
+				{
+					$pos += 3;
+				}
+				else
+				{
+					return 'text/html';
+				}
+			}
+			elseif (substr($this->file->body, $pos, 1) === '!')
+			{
+				if ($pos < $len && ($pos = strpos($this->file->body, '>', $pos)) !== false)
+				{
+					$pos++;
+				}
+				else
+				{
+					return 'text/html';
+				}
+			}
+			elseif (substr($this->file->body, $pos, 1) === '?')
+			{
+				if ($pos < $len && ($pos = strpos($this->file->body, '?>', $pos)) !== false)
+				{
+					$pos += 2;
+				}
+				else
+				{
+					return 'text/html';
+				}
+			}
+			elseif (substr($this->file->body, $pos, 3) === 'rss'
+				|| substr($this->file->body, $pos, 7) === 'rdf:RDF')
+			{
+				return 'application/rss+xml';
+			}
+			elseif (substr($this->file->body, $pos, 4) === 'feed')
+			{
+				return 'application/atom+xml';
+			}
+			else
+			{
+				return 'text/html';
+			}
+		}
+
+		return 'text/html';
+	}
 }
 
 /**
- * Decode HTML Entities
- *
- * This implements HTML5 as of revision 967 (2007-06-28)
+ * Parses the XML Declaration
  *
  * @package SimplePie
  */
-class SimplePie_Decode_HTML_Entities
+class SimplePie_XML_Declaration_Parser
 {
 	/**
-	 * Data to be parsed
+	 * XML Version
+	 *
+	 * @access public
+	 * @var string
+	 */
+	var $version = '1.0';
+
+	/**
+	 * Encoding
+	 *
+	 * @access public
+	 * @var string
+	 */
+	var $encoding = 'UTF-8';
+
+	/**
+	 * Standalone
+	 *
+	 * @access public
+	 * @var bool
+	 */
+	var $standalone = false;
+
+	/**
+	 * Current state of the state machine
 	 *
 	 * @access private
 	 * @var string
 	 */
-	var $data = '';
+	var $state = 'before_version_name';
 
 	/**
-	 * Currently consumed bytes
+	 * Input data
 	 *
 	 * @access private
 	 * @var string
 	 */
-	var $consumed = '';
+	var $data = '';
 
 	/**
-	 * Position of the current byte being parsed
+	 * Input data length (to avoid calling strlen() everytime this is needed)
 	 *
 	 * @access private
 	 * @var int
 	 */
+	var $data_length = 0;
+
+	/**
+	 * Current position of the pointer
+	 *
+	 * @var int
+	 * @access private
+	 */
 	var $position = 0;
 
 	/**
@@ -9824,169 +13822,250 @@ class SimplePie_Decode_HTML_Entities
 	 * @access public
 	 * @param string $data Input data
 	 */
-	function SimplePie_Decode_HTML_Entities($data)
+	function SimplePie_XML_Declaration_Parser($data)
 	{
 		$this->data = $data;
+		$this->data_length = strlen($this->data);
 	}
 
 	/**
 	 * Parse the input data
 	 *
 	 * @access public
-	 * @return string Output data
+	 * @return bool true on success, false on failure
 	 */
 	function parse()
 	{
-		while (($this->position = strpos($this->data, '&', $this->position)) !== false)
+		while ($this->state && $this->state !== 'emit' && $this->has_data())
+		{
+			$state = $this->state;
+			$this->$state();
+		}
+		$this->data = '';
+		if ($this->state === 'emit')
+		{
+			return true;
+		}
+		else
+		{
+			$this->version = '';
+			$this->encoding = '';
+			$this->standalone = '';
+			return false;
+		}
+	}
+
+	/**
+	 * Check whether there is data beyond the pointer
+	 *
+	 * @access private
+	 * @return bool true if there is further data, false if not
+	 */
+	function has_data()
+	{
+		return (bool) ($this->position < $this->data_length);
+	}
+
+	/**
+	 * Advance past any whitespace
+	 *
+	 * @return int Number of whitespace characters passed
+	 */
+	function skip_whitespace()
+	{
+		$whitespace = strspn($this->data, "\x09\x0A\x0D\x20", $this->position);
+		$this->position += $whitespace;
+		return $whitespace;
+	}
+
+	/**
+	 * Read value
+	 */
+	function get_value()
+	{
+		$quote = substr($this->data, $this->position, 1);
+		if ($quote === '"' || $quote === "'")
+		{
+			$this->position++;
+			$len = strcspn($this->data, $quote, $this->position);
+			if ($this->has_data())
+			{
+				$value = substr($this->data, $this->position, $len);
+				$this->position += $len + 1;
+				return $value;
+			}
+		}
+		return false;
+	}
+
+	function before_version_name()
+	{
+		if ($this->skip_whitespace())
+		{
+			$this->state = 'version_name';
+		}
+		else
+		{
+			$this->state = false;
+		}
+	}
+
+	function version_name()
+	{
+		if (substr($this->data, $this->position, 7) === 'version')
+		{
+			$this->position += 7;
+			$this->skip_whitespace();
+			$this->state = 'version_equals';
+		}
+		else
+		{
+			$this->state = false;
+		}
+	}
+
+	function version_equals()
+	{
+		if (substr($this->data, $this->position, 1) === '=')
+		{
+			$this->position++;
+			$this->skip_whitespace();
+			$this->state = 'version_value';
+		}
+		else
+		{
+			$this->state = false;
+		}
+	}
+
+	function version_value()
+	{
+		if ($this->version = $this->get_value())
+		{
+			$this->skip_whitespace();
+			if ($this->has_data())
+			{
+				$this->state = 'encoding_name';
+			}
+			else
+			{
+				$this->state = 'emit';
+			}
+		}
+		else
+		{
+			$this->state = false;
+		}
+	}
+
+	function encoding_name()
+	{
+		if (substr($this->data, $this->position, 8) === 'encoding')
+		{
+			$this->position += 8;
+			$this->skip_whitespace();
+			$this->state = 'encoding_equals';
+		}
+		else
+		{
+			$this->state = 'standalone_name';
+		}
+	}
+
+	function encoding_equals()
+	{
+		if (substr($this->data, $this->position, 1) === '=')
 		{
-			$this->consume();
-			$this->entity();
-			$this->consumed = '';
+			$this->position++;
+			$this->skip_whitespace();
+			$this->state = 'encoding_value';
+		}
+		else
+		{
+			$this->state = false;
 		}
-		return $this->data;
 	}
 
-	/**
-	 * Consume the next byte
-	 *
-	 * @access private
-	 * @return mixed The next byte, or false, if there is no more data
-	 */
-	function consume()
+	function encoding_value()
 	{
-		if (isset($this->data[$this->position]))
+		if ($this->encoding = $this->get_value())
 		{
-			$this->consumed .= $this->data[$this->position];
-			return $this->data[$this->position++];
+			$this->skip_whitespace();
+			if ($this->has_data())
+			{
+				$this->state = 'standalone_name';
+			}
+			else
+			{
+				$this->state = 'emit';
+			}
 		}
 		else
 		{
-			$this->consumed = false;
-			return false;
+			$this->state = false;
 		}
 	}
 
-	/**
-	 * Consume a range of characters
-	 *
-	 * @access private
-	 * @param string $chars Characters to consume
-	 * @return mixed A series of characters that match the range, or false
-	 */
-	function consume_range($chars)
+	function standalone_name()
 	{
-		if ($len = strspn($this->data, $chars, $this->position))
+		if (substr($this->data, $this->position, 10) === 'standalone')
 		{
-			$data = substr($this->data, $this->position, $len);
-			$this->consumed .= $data;
-			$this->position += $len;
-			return $data;
+			$this->position += 10;
+			$this->skip_whitespace();
+			$this->state = 'standalone_equals';
 		}
 		else
 		{
-			$this->consumed = false;
-			return false;
+			$this->state = false;
 		}
 	}
 
-	/**
-	 * Unconsume one byte
-	 *
-	 * @access private
-	 */
-	function unconsume()
+	function standalone_equals()
 	{
-		$this->consumed = substr($this->consumed, 0, -1);
-		$this->position--;
+		if (substr($this->data, $this->position, 1) === '=')
+		{
+			$this->position++;
+			$this->skip_whitespace();
+			$this->state = 'standalone_value';
+		}
+		else
+		{
+			$this->state = false;
+		}
 	}
 
-	/**
-	 * Decode an entity
-	 *
-	 * @access private
-	 */
-	function entity()
+	function standalone_value()
 	{
-		switch ($this->consume())
+		if ($standalone = $this->get_value())
 		{
-			case "\x09":
-			case "\x0A":
-			case "\x0B":
-			case "\x0B":
-			case "\x0C":
-			case "\x20":
-			case "\x3C":
-			case "\x26":
-			case false:
-				break;
-
-			case "\x23":
-				switch ($this->consume())
-				{
-					case "\x78":
-					case "\x58":
-						$range = '0123456789ABCDEFabcdef';
-						$hex = true;
-						break;
-
-					default:
-						$range = '0123456789';
-						$hex = false;
-						$this->unconsume();
-						break;
-				}
-
-				if ($codepoint = $this->consume_range($range))
-				{
-					static $windows_1252_specials = array(0x0D => "\x0A", 0x80 => "\xE2\x82\xAC", 0x81 => "\xEF\xBF\xBD", 0x82 => "\xE2\x80\x9A", 0x83 => "\xC6\x92", 0x84 => "\xE2\x80\x9E", 0x85 => "\xE2\x80\xA6", 0x86 => "\xE2\x80\xA0", 0x87 => "\xE2\x80\xA1", 0x88 => "\xCB\x86", 0x89 => "\xE2\x80\xB0", 0x8A => "\xC5\xA0", 0x8B => "\xE2\x80\xB9", 0x8C => "\xC5\x92", 0x8D => "\xEF\xBF\xBD", 0x8E => "\xC5\xBD", 0x8F => "\xEF\xBF\xBD", 0x90 => "\xEF\xBF\xBD", 0x91 => "\xE2\x80\x98", 0x92 => "\xE2\x80\x99", 0x93 => "\xE2\x80\x9C", 0x94 => "\xE2\x80\x9D", 0x95 => "\xE2\x80\xA2", 0x96 => "\xE2\x80\x93", 0x97 => "\xE2\x80\x94", 0x98 => "\xCB\x9C", 0x99 => "\xE2\x84\xA2", 0x9A => "\xC5\xA1", 0x9B => "\xE2\x80\xBA", 0x9C => "\xC5\x93", 0x9D => "\xEF\xBF\xBD", 0x9E => "\xC5\xBE", 0x9F => "\xC5\xB8");
-
-					if ($hex)
-					{
-						$codepoint = hexdec($codepoint);
-					}
-					else
-					{
-						$codepoint = intval($codepoint);
-					}
-
-					if (isset($windows_1252_specials[$codepoint]))
-					{
-						$replacement = $windows_1252_specials[$codepoint];
-					}
-					else
-					{
-						$replacement = SimplePie_Misc::codepoint_to_utf8($codepoint);
-					}
-
-					if ($this->consume() != ';')
-					{
-						$this->unconsume();
-					}
-
-					$consumed_length = strlen($this->consumed);
-					$this->data = substr_replace($this->data, $replacement, $this->position - $consumed_length, $consumed_length);
-					$this->position += strlen($replacement) - $consumed_length;
-				}
-				break;
+			switch ($standalone)
+			{
+				case 'yes':
+					$this->standalone = true;
+					break;
 
-			default:
-				static $entities = array('Aacute' => "\xC3\x81", 'aacute' => "\xC3\xA1", 'Aacute;' => "\xC3\x81", 'aacute;' => "\xC3\xA1", 'Acirc' => "\xC3\x82", 'acirc' => "\xC3\xA2", 'Acirc;' => "\xC3\x82", 'acirc;' => "\xC3\xA2", 'acute' => "\xC2\xB4", 'acute;' => "\xC2\xB4", 'AElig' => "\xC3\x86", 'aelig' => "\xC3\xA6", 'AElig;' => "\xC3\x86", 'aelig;' => "\xC3\xA6", 'Agrave' => "\xC3\x80", 'agrave' => "\xC3\xA0", 'Agrave;' => "\xC3\x80", 'agrave;' => "\xC3\xA0", 'alefsym;' => "\xE2\x84\xB5", 'Alpha;' => "\xCE\x91", 'alpha;' => "\xCE\xB1", 'AMP' => "\x26", 'amp' => "\x26", 'AMP;' => "\x26", 'amp;' => "\x26", 'and;' => "\xE2\x88\xA7", 'ang;' => "\xE2\x88\xA0", 'apos;' => "\x27", 'Aring' => "\xC3\x85", 'aring' => "\xC3\xA5", 'Aring;' => "\xC3\x85", 'aring;' => "\xC3\xA5", 'asymp;' => "\xE2\x89\x88", 'Atilde' => "\xC3\x83", 'atilde' => "\xC3\xA3", 'Atilde;' => "\xC3\x83", 'atilde;' => "\xC3\xA3", 'Auml' => "\xC3\x84", 'auml' => "\xC3\xA4", 'Auml;' => "\xC3\x84", 'auml;' => "\xC3\xA4", 'bdquo;' => "\xE2\x80\x9E", 'Beta;' => "\xCE\x92", 'beta;' => "\xCE\xB2", 'brvbar' => "\xC2\xA6", 'brvbar;' => "\xC2\xA6", 'bull;' => "\xE2\x80\xA2", 'cap;' => "\xE2\x88\xA9", 'Ccedil' => "\xC3\x87", 'ccedil' => "\xC3\xA7", 'Ccedil;' => "\xC3\x87", 'ccedil;' => "\xC3\xA7", 'cedil' => "\xC2\xB8", 'cedil;' => "\xC2\xB8", 'cent' => "\xC2\xA2", 'cent;' => "\xC2\xA2", 'Chi;' => "\xCE\xA7", 'chi;' => "\xCF\x87", 'circ;' => "\xCB\x86", 'clubs;' => "\xE2\x99\xA3", 'cong;' => "\xE2\x89\x85", 'COPY' => "\xC2\xA9", 'copy' => "\xC2\xA9", 'COPY;' => "\xC2\xA9", 'copy;' => "\xC2\xA9", 'crarr;' => "\xE2\x86\xB5", 'cup;' => "\xE2\x88\xAA", 'curren' => "\xC2\xA4", 'curren;' => "\xC2\xA4", 'Dagger;' => "\xE2\x80\xA1", 'dagger;' => "\xE2\x80\xA0", 'dArr;' => "\xE2\x87\x93", 'darr;' => "\xE2\x86\x93", 'deg' => "\xC2\xB0", 'deg;' => "\xC2\xB0", 'Delta;' => "\xCE\x94", 'delta;' => "\xCE\xB4", 'diams;' => "\xE2\x99\xA6", 'divide' => "\xC3\xB7", 'divide;' => "\xC3\xB7", 'Eacute' => "\xC3\x89", 'eacute' => "\xC3\xA9", 'Eacute;' => "\xC3\x89", 'eacute;' => "\xC3\xA9", 'Ecirc' => "\xC3\x8A", 'ecirc' => "\xC3\xAA", 'Ecirc;' => "\xC3\x8A", 'ecirc;' => "\xC3\xAA", 'Egrave' => "\xC3\x88", 'egrave' => "\xC3\xA8", 'Egrave;' => "\xC3\x88", 'egrave;' => "\xC3\xA8", 'empty;' => "\xE2\x88\x85", 'emsp;' => "\xE2\x80\x83", 'ensp;' => "\xE2\x80\x82", 'Epsilon;' => "\xCE\x95", 'epsilon;' => "\xCE\xB5", 'equiv;' => "\xE2\x89\xA1", 'Eta;' => "\xCE\x97", 'eta;' => "\xCE\xB7", 'ETH' => "\xC3\x90", 'eth' => "\xC3\xB0", 'ETH;' => "\xC3\x90", 'eth;' => "\xC3\xB0", 'Euml' => "\xC3\x8B", 'euml' => "\xC3\xAB", 'Euml;' => "\xC3\x8B", 'euml;' => "\xC3\xAB", 'euro;' => "\xE2\x82\xAC", 'exist;' => "\xE2\x88\x83", 'fnof;' => "\xC6\x92", 'forall;' => "\xE2\x88\x80", 'frac12' => "\xC2\xBD", 'frac12;' => "\xC2\xBD", 'frac14' => "\xC2\xBC", 'frac14;' => "\xC2\xBC", 'frac34' => "\xC2\xBE", 'frac34;' => "\xC2\xBE", 'frasl;' => "\xE2\x81\x84", 'Gamma;' => "\xCE\x93", 'gamma;' => "\xCE\xB3", 'ge;' => "\xE2\x89\xA5", 'GT' => "\x3E", 'gt' => "\x3E", 'GT;' => "\x3E", 'gt;' => "\x3E", 'hArr;' => "\xE2\x87\x94", 'harr;' => "\xE2\x86\x94", 'hearts;' => "\xE2\x99\xA5", 'hellip;' => "\xE2\x80\xA6", 'Iacute' => "\xC3\x8D", 'iacute' => "\xC3\xAD", 'Iacute;' => "\xC3\x8D", 'iacute;' => "\xC3\xAD", 'Icirc' => "\xC3\x8E", 'icirc' => "\xC3\xAE", 'Icirc;' => "\xC3\x8E", 'icirc;' => "\xC3\xAE", 'iexcl' => "\xC2\xA1", 'iexcl;' => "\xC2\xA1", 'Igrave' => "\xC3\x8C", 'igrave' => "\xC3\xAC", 'Igrave;' => "\xC3\x8C", 'igrave;' => "\xC3\xAC", 'image;' => "\xE2\x84\x91", 'infin;' => "\xE2\x88\x9E", 'int;' => "\xE2\x88\xAB", 'Iota;' => "\xCE\x99", 'iota;' => "\xCE\xB9", 'iquest' => "\xC2\xBF", 'iquest;' => "\xC2\xBF", 'isin;' => "\xE2\x88\x88", 'Iuml' => "\xC3\x8F", 'iuml' => "\xC3\xAF", 'Iuml;' => "\xC3\x8F", 'iuml;' => "\xC3\xAF", 'Kappa;' => "\xCE\x9A", 'kappa;' => "\xCE\xBA", 'Lambda;' => "\xCE\x9B", 'lambda;' => "\xCE\xBB", 'lang;' => "\xE3\x80\x88", 'laquo' => "\xC2\xAB", 'laquo;' => "\xC2\xAB", 'lArr;' => "\xE2\x87\x90", 'larr;' => "\xE2\x86\x90", 'lceil;' => "\xE2\x8C\x88", 'ldquo;' => "\xE2\x80\x9C", 'le;' => "\xE2\x89\xA4", 'lfloor;' => "\xE2\x8C\x8A", 'lowast;' => "\xE2\x88\x97", 'loz;' => "\xE2\x97\x8A", 'lrm;' => "\xE2\x80\x8E", 'lsaquo;' => "\xE2\x80\xB9", 'lsquo;' => "\xE2\x80\x98", 'LT' => "\x3C", 'lt' => "\x3C", 'LT;' => "\x3C", 'lt;' => "\x3C", 'macr' => "\xC2\xAF", 'macr;' => "\xC2\xAF", 'mdash;' => "\xE2\x80\x94", 'micro' => "\xC2\xB5", 'micro;' => "\xC2\xB5", 'middot' => "\xC2\xB7", 'middot;' => "\xC2\xB7", 'minus;' => "\xE2\x88\x92", 'Mu;' => "\xCE\x9C", 'mu;' => "\xCE\xBC", 'nabla;' => "\xE2\x88\x87", 'nbsp' => "\xC2\xA0", 'nbsp;' => "\xC2\xA0", 'ndash;' => "\xE2\x80\x93", 'ne;' => "\xE2\x89\xA0", 'ni;' => "\xE2\x88\x8B", 'not' => "\xC2\xAC", 'not;' => "\xC2\xAC", 'notin;' => "\xE2\x88\x89", 'nsub;' => "\xE2\x8A\x84", 'Ntilde' => "\xC3\x91", 'ntilde' => "\xC3\xB1", 'Ntilde;' => "\xC3\x91", 'ntilde;' => "\xC3\xB1", 'Nu;' => "\xCE\x9D", 'nu;' => "\xCE\xBD", 'Oacute' => "\xC3\x93", 'oacute' => "\xC3\xB3", 'Oacute;' => "\xC3\x93", 'oacute;' => "\xC3\xB3", 'Ocirc' => "\xC3\x94", 'ocirc' => "\xC3\xB4", 'Ocirc;' => "\xC3\x94", 'ocirc;' => "\xC3\xB4", 'OElig;' => "\xC5\x92", 'oelig;' => "\xC5\x93", 'Ograve' => "\xC3\x92", 'ograve' => "\xC3\xB2", 'Ograve;' => "\xC3\x92", 'ograve;' => "\xC3\xB2", 'oline;' => "\xE2\x80\xBE", 'Omega;' => "\xCE\xA9", 'omega;' => "\xCF\x89", 'Omicron;' => "\xCE\x9F", 'omicron;' => "\xCE\xBF", 'oplus;' => "\xE2\x8A\x95", 'or;' => "\xE2\x88\xA8", 'ordf' => "\xC2\xAA", 'ordf;' => "\xC2\xAA", 'ordm' => "\xC2\xBA", 'ordm;' => "\xC2\xBA", 'Oslash' => "\xC3\x98", 'oslash' => "\xC3\xB8", 'Oslash;' => "\xC3\x98", 'oslash;' => "\xC3\xB8", 'Otilde' => "\xC3\x95", 'otilde' => "\xC3\xB5", 'Otilde;' => "\xC3\x95", 'otilde;' => "\xC3\xB5", 'otimes;' => "\xE2\x8A\x97", 'Ouml' => "\xC3\x96", 'ouml' => "\xC3\xB6", 'Ouml;' => "\xC3\x96", 'ouml;' => "\xC3\xB6", 'para' => "\xC2\xB6", 'para;' => "\xC2\xB6", 'part;' => "\xE2\x88\x82", 'permil;' => "\xE2\x80\xB0", 'perp;' => "\xE2\x8A\xA5", 'Phi;' => "\xCE\xA6", 'phi;' => "\xCF\x86", 'Pi;' => "\xCE\xA0", 'pi;' => "\xCF\x80", 'piv;' => "\xCF\x96", 'plusmn' => "\xC2\xB1", 'plusmn;' => "\xC2\xB1", 'pound' => "\xC2\xA3", 'pound;' => "\xC2\xA3", 'Prime;' => "\xE2\x80\xB3", 'prime;' => "\xE2\x80\xB2", 'prod;' => "\xE2\x88\x8F", 'prop;' => "\xE2\x88\x9D", 'Psi;' => "\xCE\xA8", 'psi;' => "\xCF\x88", 'QUOT' => "\x22", 'quot' => "\x22", 'QUOT;' => "\x22", 'quot;' => "\x22", 'radic;' => "\xE2\x88\x9A", 'rang;' => "\xE3\x80\x89", 'raquo' => "\xC2\xBB", 'raquo;' => "\xC2\xBB", 'rArr;' => "\xE2\x87\x92", 'rarr;' => "\xE2\x86\x92", 'rceil;' => "\xE2\x8C\x89", 'rdquo;' => "\xE2\x80\x9D", 'real;' => "\xE2\x84\x9C", 'REG' => "\xC2\xAE", 'reg' => "\xC2\xAE", 'REG;' => "\xC2\xAE", 'reg;' => "\xC2\xAE", 'rfloor;' => "\xE2\x8C\x8B", 'Rho;' => "\xCE\xA1", 'rho;' => "\xCF\x81", 'rlm;' => "\xE2\x80\x8F", 'rsaquo;' => "\xE2\x80\xBA", 'rsquo;' => "\xE2\x80\x99", 'sbquo;' => "\xE2\x80\x9A", 'Scaron;' => "\xC5\xA0", 'scaron;' => "\xC5\xA1", 'sdot;' => "\xE2\x8B\x85", 'sect' => "\xC2\xA7", 'sect;' => "\xC2\xA7", 'shy' => "\xC2\xAD", 'shy;' => "\xC2\xAD", 'Sigma;' => "\xCE\xA3", 'sigma;' => "\xCF\x83", 'sigmaf;' => "\xCF\x82", 'sim;' => "\xE2\x88\xBC", 'spades;' => "\xE2\x99\xA0", 'sub;' => "\xE2\x8A\x82", 'sube;' => "\xE2\x8A\x86", 'sum;' => "\xE2\x88\x91", 'sup;' => "\xE2\x8A\x83", 'sup1' => "\xC2\xB9", 'sup1;' => "\xC2\xB9", 'sup2' => "\xC2\xB2", 'sup2;' => "\xC2\xB2", 'sup3' => "\xC2\xB3", 'sup3;' => "\xC2\xB3", 'supe;' => "\xE2\x8A\x87", 'szlig' => "\xC3\x9F", 'szlig;' => "\xC3\x9F", 'Tau;' => "\xCE\xA4", 'tau;' => "\xCF\x84", 'there4;' => "\xE2\x88\xB4", 'Theta;' => "\xCE\x98", 'theta;' => "\xCE\xB8", 'thetasym;' => "\xCF\x91", 'thinsp;' => "\xE2\x80\x89", 'THORN' => "\xC3\x9E", 'thorn' => "\xC3\xBE", 'THORN;' => "\xC3\x9E", 'thorn;' => "\xC3\xBE", 'tilde;' => "\xCB\x9C", 'times' => "\xC3\x97", 'times;' => "\xC3\x97", 'TRADE;' => "\xE2\x84\xA2", 'trade;' => "\xE2\x84\xA2", 'Uacute' => "\xC3\x9A", 'uacute' => "\xC3\xBA", 'Uacute;' => "\xC3\x9A", 'uacute;' => "\xC3\xBA", 'uArr;' => "\xE2\x87\x91", 'uarr;' => "\xE2\x86\x91", 'Ucirc' => "\xC3\x9B", 'ucirc' => "\xC3\xBB", 'Ucirc;' => "\xC3\x9B", 'ucirc;' => "\xC3\xBB", 'Ugrave' => "\xC3\x99", 'ugrave' => "\xC3\xB9", 'Ugrave;' => "\xC3\x99", 'ugrave;' => "\xC3\xB9", 'uml' => "\xC2\xA8", 'uml;' => "\xC2\xA8", 'upsih;' => "\xCF\x92", 'Upsilon;' => "\xCE\xA5", 'upsilon;' => "\xCF\x85", 'Uuml' => "\xC3\x9C", 'uuml' => "\xC3\xBC", 'Uuml;' => "\xC3\x9C", 'uuml;' => "\xC3\xBC", 'weierp;' => "\xE2\x84\x98", 'Xi;' => "\xCE\x9E", 'xi;' => "\xCE\xBE", 'Yacute' => "\xC3\x9D", 'yacute' => "\xC3\xBD", 'Yacute;' => "\xC3\x9D", 'yacute;' => "\xC3\xBD", 'yen' => "\xC2\xA5", 'yen;' => "\xC2\xA5", 'yuml' => "\xC3\xBF", 'Yuml;' => "\xC5\xB8", 'yuml;' => "\xC3\xBF", 'Zeta;' => "\xCE\x96", 'zeta;' => "\xCE\xB6", 'zwj;' => "\xE2\x80\x8D", 'zwnj;' => "\xE2\x80\x8C");
+				case 'no':
+					$this->standalone = false;
+					break;
 
-				for ($i = 0, $match = null; $i < 9 && $this->consume(); $i++)
-				{
-					$consumed = substr($this->consumed, 1);
-					if (isset($entities[$consumed]))
-					{
-						$match = $consumed;
-					}
-				}
+				default:
+					$this->state = false;
+					return;
+			}
 
-				if ($match !== null)
-				{
- 					$this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1);
-					$this->position += strlen($entities[$match]) - strlen($consumed) - 1;
-				}
-				break;
+			$this->skip_whitespace();
+			if ($this->has_data())
+			{
+				$this->state = false;
+			}
+			else
+			{
+				$this->state = 'emit';
+			}
+		}
+		else
+		{
+			$this->state = false;
 		}
 	}
 }
@@ -10005,23 +14084,34 @@ class SimplePie_Locator
 	var $base_location = 0;
 	var $checked_feeds = 0;
 	var $max_checked_feeds = 10;
+	var $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer';
 
-	function SimplePie_Locator(&$file, $timeout = 10, $useragent = null, $file_class = 'SimplePie_File', $max_checked_feeds = 10)
+	function SimplePie_Locator(&$file, $timeout = 10, $useragent = null, $file_class = 'SimplePie_File', $max_checked_feeds = 10, $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer')
 	{
 		$this->file =& $file;
 		$this->file_class = $file_class;
 		$this->useragent = $useragent;
 		$this->timeout = $timeout;
 		$this->max_checked_feeds = $max_checked_feeds;
+		$this->content_type_sniffer_class = $content_type_sniffer_class;
 	}
 
-	function find($type = SIMPLEPIE_LOCATOR_ALL)
+	function find($type = SIMPLEPIE_LOCATOR_ALL, &$working)
 	{
 		if ($this->is_feed($this->file))
 		{
 			return $this->file;
 		}
 
+		if ($this->file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
+		{
+			$sniffer = new $this->content_type_sniffer_class($this->file);
+			if ($sniffer->get_type() !== 'text/html')
+			{
+				return null;
+			}
+		}
+
 		if ($type & ~SIMPLEPIE_LOCATOR_NONE)
 		{
 			$this->get_base();
@@ -10029,7 +14119,7 @@ class SimplePie_Locator
 
 		if ($type & SIMPLEPIE_LOCATOR_AUTODISCOVERY && $working = $this->autodiscovery())
 		{
-			return $working;
+			return $working[0];
 		}
 
 		if ($type & (SIMPLEPIE_LOCATOR_LOCAL_EXTENSION | SIMPLEPIE_LOCATOR_LOCAL_BODY | SIMPLEPIE_LOCATOR_REMOTE_EXTENSION | SIMPLEPIE_LOCATOR_REMOTE_BODY) && $this->get_links())
@@ -10059,24 +14149,32 @@ class SimplePie_Locator
 
 	function is_feed(&$file)
 	{
-		$body = SimplePie_Misc::strip_comments($file->body);
-		if (preg_match('/<([^\s:]+:)?(rss|RDF|feed)' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/i', $body))
+		if ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
 		{
-			return true;
+			$sniffer = new $this->content_type_sniffer_class($file);
+			$sniffed = $sniffer->get_type();
+			if (in_array($sniffed, array('application/rss+xml', 'application/rdf+xml', 'text/rdf', 'application/atom+xml', 'text/xml', 'application/xml')))
+			{
+				return true;
+			}
+			else
+			{
+				return false;
+			}
 		}
-		return false;
-	}
-
-	function get_base()
-	{
-		if (isset($this->file->headers['content-location']))
+		elseif ($file->method & SIMPLEPIE_FILE_SOURCE_LOCAL)
 		{
-			$this->http_base = SimplePie_Misc::absolutize_url(trim($this->file->headers['content-location']), $this->file->url);
+			return true;
 		}
 		else
 		{
-			$this->http_base = $this->file->url;
+			return false;
 		}
+	}
+
+	function get_base()
+	{
+		$this->http_base = $this->file->url;
 		$this->base = $this->http_base;
 		$elements = SimplePie_Misc::get_element('base', $this->file->body);
 		foreach ($elements as $element)
@@ -10094,9 +14192,10 @@ class SimplePie_Locator
 	{
 		$links = array_merge(SimplePie_Misc::get_element('link', $this->file->body), SimplePie_Misc::get_element('a', $this->file->body), SimplePie_Misc::get_element('area', $this->file->body));
 		$done = array();
+		$feeds = array();
 		foreach ($links as $link)
 		{
-			if ($this->checked_feeds == $this->max_checked_feeds)
+			if ($this->checked_feeds === $this->max_checked_feeds)
 			{
 				break;
 			}
@@ -10113,19 +14212,26 @@ class SimplePie_Locator
 					$href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base);
 				}
 
-				if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !empty($link['attribs']['type']['data']) && in_array(strtolower(SimplePie_Misc::parse_mime($link['attribs']['type']['data'])), array('application/rss+xml', 'application/atom+xml'))))
+				if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !empty($link['attribs']['type']['data']) && in_array(strtolower(SimplePie_Misc::parse_mime($link['attribs']['type']['data'])), array('application/rss+xml', 'application/atom+xml'))) && !isset($feeds[$href]))
 				{
 					$this->checked_feeds++;
 					$feed = new $this->file_class($href, $this->timeout, 5, null, $this->useragent);
-					if ($this->is_feed($feed))
+					if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
 					{
-						return $feed;
+						$feeds[$href] = $feed;
 					}
 				}
 				$done[] = $href;
 			}
 		}
-		return null;
+
+		if (!empty($feeds))
+		{
+			return array_values($feeds);
+		}
+		else {
+			return null;
+		}
 	}
 
 	function get_links()
@@ -10150,7 +14256,7 @@ class SimplePie_Locator
 
 					$current = SimplePie_Misc::parse_url($this->file->url);
 
-					if ($parsed['authority'] === '' || $parsed['authority'] == $current['authority'])
+					if ($parsed['authority'] === '' || $parsed['authority'] === $current['authority'])
 					{
 						$this->local[] = $href;
 					}
@@ -10174,7 +14280,7 @@ class SimplePie_Locator
 	{
 		foreach ($array as $key => $value)
 		{
-			if ($this->checked_feeds == $this->max_checked_feeds)
+			if ($this->checked_feeds === $this->max_checked_feeds)
 			{
 				break;
 			}
@@ -10182,7 +14288,7 @@ class SimplePie_Locator
 			{
 				$this->checked_feeds++;
 				$feed = new $this->file_class($value, $this->timeout, 5, null, $this->useragent);
-				if ($this->is_feed($feed))
+				if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
 				{
 					return $feed;
 				}
@@ -10199,7 +14305,7 @@ class SimplePie_Locator
 	{
 		foreach ($array as $key => $value)
 		{
-			if ($this->checked_feeds == $this->max_checked_feeds)
+			if ($this->checked_feeds === $this->max_checked_feeds)
 			{
 				break;
 			}
@@ -10207,7 +14313,7 @@ class SimplePie_Locator
 			{
 				$this->checked_feeds++;
 				$feed = new $this->file_class($value, $this->timeout, 5, null, $this->useragent);
-				if ($this->is_feed($feed))
+				if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
 				{
 					return $feed;
 				}
@@ -10223,14 +14329,12 @@ class SimplePie_Locator
 
 class SimplePie_Parser
 {
-	var $xml;
 	var $error_code;
 	var $error_string;
 	var $current_line;
 	var $current_column;
 	var $current_byte;
 	var $separator = ' ';
-	var $feed = false;
 	var $namespace = array('');
 	var $element = array('');
 	var $xml_base = array('');
@@ -10241,10 +14345,10 @@ class SimplePie_Parser
 	var $current_xhtml_construct = -1;
 	var $encoding;
 
-	function pre_process(&$data, $encoding)
+	function parse(&$data, $encoding)
 	{
 		// Use UTF-8 if we get passed US-ASCII, as every US-ASCII character is a UTF-8 character
-		if (strtoupper($encoding) == 'US-ASCII')
+		if (strtoupper($encoding) === 'US-ASCII')
 		{
 			$this->encoding = 'UTF-8';
 		}
@@ -10255,68 +14359,150 @@ class SimplePie_Parser
 
 		// Strip BOM:
 		// UTF-32 Big Endian BOM
-		if (strpos($data, "\x0\x0\xFE\xFF") === 0)
+		if (substr($data, 0, 4) === "\x00\x00\xFE\xFF")
 		{
 			$data = substr($data, 4);
 		}
 		// UTF-32 Little Endian BOM
-		elseif (strpos($data, "\xFF\xFE\x0\x0") === 0)
+		elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00")
 		{
 			$data = substr($data, 4);
 		}
 		// UTF-16 Big Endian BOM
-		elseif (strpos($data, "\xFE\xFF") === 0)
+		elseif (substr($data, 0, 2) === "\xFE\xFF")
 		{
 			$data = substr($data, 2);
 		}
 		// UTF-16 Little Endian BOM
-		elseif (strpos($data, "\xFF\xFE") === 0)
+		elseif (substr($data, 0, 2) === "\xFF\xFE")
 		{
 			$data = substr($data, 2);
 		}
 		// UTF-8 BOM
-		elseif (strpos($data, "\xEF\xBB\xBF") === 0)
+		elseif (substr($data, 0, 3) === "\xEF\xBB\xBF")
 		{
 			$data = substr($data, 3);
 		}
 
-		// Make sure the XML prolog is sane and has the correct encoding
-		$data = preg_replace("/^<\?xml[\x20\x9\xD\xA]+version([\x20\x9\xD\xA]+)?=([\x20\x9\xD\xA]+)?(\"1.0\"|'1.0'|\"1.1\"|'1.1')([\x20\x9\xD\xA]+encoding([\x20\x9\xD\xA]+)?=([\x20\x9\xD\xA]+)?(\"[A-Za-z][A-Za-z0-9._\-]*\"|'[A-Za-z][A-Za-z0-9._\-]*'))?([\x20\x9\xD\xA]+standalone([\x20\x9\xD\xA]+)?=([\x20\x9\xD\xA]+)?(\"(yes|no)\"|'(yes|no)'))?([\x20\x9\xD\xA]+)?\?>/", '', $data);
-		$data = "<?xml version='1.0' encoding='$encoding'?>\n" . $data;
-	}
+		if (substr($data, 0, 5) === '<?xml' && strspn(substr($data, 5, 1), "\x09\x0A\x0D\x20") && ($pos = strpos($data, '?>')) !== false)
+		{
+			$declaration = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
+			if ($declaration->parse())
+			{
+				$data = substr($data, $pos + 2);
+				$data = '<?xml version="' . $declaration->version . '" encoding="' . $encoding . '" standalone="' . (($declaration->standalone) ? 'yes' : 'no') . '"?>' . $data;
+			}
+			else
+			{
+				$this->error_string = 'SimplePie bug! Please report this!';
+				return false;
+			}
+		}
 
-	function parse(&$data)
-	{
 		$return = true;
 
+		static $xml_is_sane = null;
+		if ($xml_is_sane === null)
+		{
+			$parser_check = xml_parser_create();
+			xml_parse_into_struct($parser_check, '<foo>&amp;</foo>', $values);
+			xml_parser_free($parser_check);
+			$xml_is_sane = isset($values[0]['value']);
+		}
+
 		// Create the parser
-		$this->xml = xml_parser_create_ns($this->encoding, $this->separator);
-		xml_parser_set_option($this->xml, XML_OPTION_SKIP_WHITE, 1);
-		xml_parser_set_option($this->xml, XML_OPTION_CASE_FOLDING, 0);
-		xml_set_object($this->xml, $this);
-		xml_set_character_data_handler($this->xml, 'cdata');
-		xml_set_element_handler($this->xml, 'tag_open', 'tag_close');
-
-    // workound for a bug in PHP/libxml2 as described on http://bugs.simplepie.org/issues/show/101
-    $data = str_replace('&lt;', '&#60;', $data);
-    $data = str_replace('&gt;', '&#62;', $data);
-    $data = str_replace('&amp;', '&#38;', $data);
-    $data = str_replace('&apos;', '&#39;', $data);
-    $data = str_replace('&quot;', '&#34;', $data);
-
-		// Parse!
-		if (!xml_parse($this->xml, $data, true))
-		{
-			$this->data = null;
-			$this->error_code = xml_get_error_code($this->xml);
-			$this->error_string = xml_error_string($this->error_code);
-			$return = false;
-		}
-		$this->current_line = xml_get_current_line_number($this->xml);
-		$this->current_column = xml_get_current_column_number($this->xml);
-		$this->current_byte = xml_get_current_byte_index($this->xml);
-		xml_parser_free($this->xml);
-		return $return;
+		if ($xml_is_sane)
+		{
+			$xml = xml_parser_create_ns($this->encoding, $this->separator);
+			xml_parser_set_option($xml, XML_OPTION_SKIP_WHITE, 1);
+			xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, 0);
+			xml_set_object($xml, $this);
+			xml_set_character_data_handler($xml, 'cdata');
+			xml_set_element_handler($xml, 'tag_open', 'tag_close');
+
+			// Parse!
+			if (!xml_parse($xml, $data, true))
+			{
+				$this->error_code = xml_get_error_code($xml);
+				$this->error_string = xml_error_string($this->error_code);
+				$return = false;
+			}
+			$this->current_line = xml_get_current_line_number($xml);
+			$this->current_column = xml_get_current_column_number($xml);
+			$this->current_byte = xml_get_current_byte_index($xml);
+			xml_parser_free($xml);
+			return $return;
+		}
+		else
+		{
+			libxml_clear_errors();
+			$xml = new XMLReader();
+			$xml->xml($data);
+			while (@$xml->read())
+			{
+				switch ($xml->nodeType)
+				{
+
+					case constant('XMLReader::END_ELEMENT'):
+						if ($xml->namespaceURI !== '')
+						{
+							$tagName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}";
+						}
+						else
+						{
+							$tagName = $xml->localName;
+						}
+						$this->tag_close(null, $tagName);
+						break;
+					case constant('XMLReader::ELEMENT'):
+						$empty = $xml->isEmptyElement;
+						if ($xml->namespaceURI !== '')
+						{
+							$tagName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}";
+						}
+						else
+						{
+							$tagName = $xml->localName;
+						}
+						$attributes = array();
+						while ($xml->moveToNextAttribute())
+						{
+							if ($xml->namespaceURI !== '')
+							{
+								$attrName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}";
+							}
+							else
+							{
+								$attrName = $xml->localName;
+							}
+							$attributes[$attrName] = $xml->value;
+						}
+						$this->tag_open(null, $tagName, $attributes);
+						if ($empty)
+						{
+							$this->tag_close(null, $tagName);
+						}
+						break;
+					case constant('XMLReader::TEXT'):
+
+					case constant('XMLReader::CDATA'):
+						$this->cdata(null, $xml->value);
+						break;
+				}
+			}
+			if ($error = libxml_get_last_error())
+			{
+				$this->error_code = $error->code;
+				$this->error_string = $error->message;
+				$this->current_line = $error->line;
+				$this->current_column = $error->column;
+				return false;
+			}
+			else
+			{
+				return true;
+			}
+		}
 	}
 
 	function get_error_code()
@@ -10351,27 +14537,6 @@ class SimplePie_Parser
 
 	function tag_open($parser, $tag, $attributes)
 	{
-		if ($this->feed === 0)
-		{
-			return;
-		}
-		elseif ($this->feed == false)
-		{
-			if (in_array($tag, array(
-				SIMPLEPIE_NAMESPACE_ATOM_10 . $this->separator . 'feed',
-				SIMPLEPIE_NAMESPACE_ATOM_03 . $this->separator . 'feed',
-				'rss',
-				SIMPLEPIE_NAMESPACE_RDF . $this->separator . 'RDF'
-			)))
-			{
-					$this->feed = 1;
-			}
-		}
-		else
-		{
-			$this->feed++;
-		}
-
 		list($this->namespace[], $this->element[]) = $this->split_ns($tag);
 
 		$attribs = array();
@@ -10404,7 +14569,7 @@ class SimplePie_Parser
 		if ($this->current_xhtml_construct >= 0)
 		{
 			$this->current_xhtml_construct++;
-			if (end($this->namespace) == SIMPLEPIE_NAMESPACE_XHTML)
+			if (end($this->namespace) === SIMPLEPIE_NAMESPACE_XHTML)
 			{
 				$this->data['data'] .= '<' . end($this->element);
 				if (isset($attribs['']))
@@ -10422,8 +14587,8 @@ class SimplePie_Parser
 			$this->datas[] =& $this->data;
 			$this->data =& $this->data['child'][end($this->namespace)][end($this->element)][];
 			$this->data = array('data' => '', 'attribs' => $attribs, 'xml_base' => end($this->xml_base), 'xml_base_explicit' => end($this->xml_base_explicit), 'xml_lang' => end($this->xml_lang));
-			if ((end($this->namespace) == SIMPLEPIE_NAMESPACE_ATOM_03 && in_array(end($this->element), array('title', 'tagline', 'copyright', 'info', 'summary', 'content')) && isset($attribs['']['mode']) && $attribs['']['mode'] == 'xml')
-			|| (end($this->namespace) == SIMPLEPIE_NAMESPACE_ATOM_10 && in_array(end($this->element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) && isset($attribs['']['type']) && $attribs['']['type'] == 'xhtml'))
+			if ((end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_03 && in_array(end($this->element), array('title', 'tagline', 'copyright', 'info', 'summary', 'content')) && isset($attribs['']['mode']) && $attribs['']['mode'] === 'xml')
+			|| (end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_10 && in_array(end($this->element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) && isset($attribs['']['type']) && $attribs['']['type'] === 'xhtml'))
 			{
 				$this->current_xhtml_construct = 0;
 			}
@@ -10436,7 +14601,7 @@ class SimplePie_Parser
 		{
 			$this->data['data'] .= htmlspecialchars($cdata, ENT_QUOTES, $this->encoding);
 		}
-		elseif ($this->feed > 1)
+		else
 		{
 			$this->data['data'] .= $cdata;
 		}
@@ -10444,22 +14609,17 @@ class SimplePie_Parser
 
 	function tag_close($parser, $tag)
 	{
-		if (!$this->feed)
-		{
-			return;
-		}
-
 		if ($this->current_xhtml_construct >= 0)
 		{
 			$this->current_xhtml_construct--;
-			if (end($this->namespace) == SIMPLEPIE_NAMESPACE_XHTML && !in_array(end($this->element), array('area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param')))
+			if (end($this->namespace) === SIMPLEPIE_NAMESPACE_XHTML && !in_array(end($this->element), array('area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param')))
 			{
 				$this->data['data'] .= '</' . end($this->element) . '>';
 			}
 		}
-		if ($this->current_xhtml_construct == -1)
+		if ($this->current_xhtml_construct === -1)
 		{
-			$this->data =& $this->datas[$this->feed];
+			$this->data =& $this->datas[count($this->datas) - 1];
 			array_pop($this->datas);
 		}
 
@@ -10468,7 +14628,6 @@ class SimplePie_Parser
 		array_pop($this->xml_base);
 		array_pop($this->xml_base_explicit);
 		array_pop($this->xml_lang);
-		$this->feed--;
 	}
 
 	function split_ns($string)
@@ -10483,7 +14642,19 @@ class SimplePie_Parser
 				{
 					$separator_length = strlen($this->separator);
 				}
-				$cache[$string] = array(substr($string, 0, $pos), substr($string, $pos + $separator_length));
+				$namespace = substr($string, 0, $pos);
+				$local_name = substr($string, $pos + $separator_length);
+				if (strtolower($namespace) === SIMPLEPIE_NAMESPACE_ITUNES)
+				{
+					$namespace = SIMPLEPIE_NAMESPACE_ITUNES;
+				}
+
+				// Normalize the Media RSS namespaces
+				if ($namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG)
+				{
+					$namespace = SIMPLEPIE_NAMESPACE_MEDIARSS;
+				}
+				$cache[$string] = array($namespace, $local_name);
 			}
 			else
 			{
@@ -10495,7 +14666,7 @@ class SimplePie_Parser
 }
 
 /**
- * @todo Move to using an actual HTML parser (this will allow tags to be properly stripped, and to switch between HTML and XHTML), this will also make it easier to shortern a string while preserving HTML tags
+ * @todo Move to using an actual HTML parser (this will allow tags to be properly stripped, and to switch between HTML and XHTML), this will also make it easier to shorten a string while preserving HTML tags
  */
 class SimplePie_Sanitize
 {
@@ -10667,7 +14838,7 @@ class SimplePie_Sanitize
 		{
 			if ($type & SIMPLEPIE_CONSTRUCT_MAYBE_HTML)
 			{
-				if (preg_match('/(&(#(x[0-9a-fA-F]+|[0-9]+)|[a-zA-Z0-9]+)|<\/(\w+)' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>)/', $data))
+				if (preg_match('/(&(#(x[0-9a-fA-F]+|[0-9]+)|[a-zA-Z0-9]+)|<\/[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>)/', $data))
 				{
 					$type |= SIMPLEPIE_CONSTRUCT_HTML;
 				}
@@ -10722,9 +14893,7 @@ class SimplePie_Sanitize
 				{
 					foreach ($this->strip_attributes as $attrib)
 					{
-						$data = preg_replace('/ '. trim($attrib) .'=("|&quot;)(\w|\s|=|-|:|;|\/|\.|\?|&|,|#|!|\(|\)|\'|&apos;|<|>|\+|{|})*("|&quot;)/i', '', $data);
-						$data = preg_replace('/ '. trim($attrib) .'=(\'|&apos;)(\w|\s|=|-|:|;|\/|\.|\?|&|,|#|!|\(|\)|"|&quot;|<|>|\+|{|})*(\'|&apos;)/i', '', $data);
-						$data = preg_replace('/ '. trim($attrib) .'=(\w|\s|=|-|:|;|\/|\.|\?|&|,|#|!|\(|\)|\+|{|})*/i', '', $data);
+						$data = preg_replace('/(<[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*)' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . trim($attrib) . '(?:\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>/', '\1\2\3>', $data);
 					}
 				}
 
@@ -10743,27 +14912,30 @@ class SimplePie_Sanitize
 					{
 						if (isset($img['attribs']['src']['data']))
 						{
-							$image_url = $img['attribs']['src']['data'];
-							$cache = new $this->cache_class($this->cache_location, call_user_func($this->cache_name_function, $image_url), 'spi');
+							$image_url = call_user_func($this->cache_name_function, $img['attribs']['src']['data']);
+							$cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, $image_url, 'spi');
 
 							if ($cache->load())
 							{
-								$img['attribs']['src']['data'] = $this->image_handler . rawurlencode($img['attribs']['src']['data']);
+								$img['attribs']['src']['data'] = $this->image_handler . $image_url;
 								$data = str_replace($img['full'], SimplePie_Misc::element_implode($img), $data);
 							}
 							else
 							{
-								$file = new $this->file_class($image_url, $this->timeout, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen);
+								$file = new $this->file_class($img['attribs']['src']['data'], $this->timeout, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen);
 								$headers = $file->headers;
 
-								if ($file->success && ($file->status_code == 200 || ($file->status_code > 206 && $file->status_code < 300)))
+								if ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)))
 								{
-									if (!$cache->save(array('headers' => $file->headers, 'body' => $file->body)))
+									if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
+									{
+										$img['attribs']['src']['data'] = $this->image_handler . $image_url;
+										$data = str_replace($img['full'], SimplePie_Misc::element_implode($img), $data);
+									}
+									else
 									{
-										trigger_error("$cache->name is not writeable", E_USER_WARNING);
+										trigger_error("$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING);
 									}
-									$img['attribs']['src']['data'] = $this->image_handler . rawurlencode($img['attribs']['src']['data']);
-									$data = str_replace($img['full'], SimplePie_Misc::element_implode($img), $data);
 								}
 							}
 						}
@@ -10784,7 +14956,7 @@ class SimplePie_Sanitize
 				$data = htmlspecialchars($data, ENT_COMPAT, 'UTF-8');
 			}
 
-			if ($this->output_encoding != 'UTF-8')
+			if ($this->output_encoding !== 'UTF-8')
 			{
 				$data = SimplePie_Misc::change_encoding($data, 'UTF-8', $this->output_encoding);
 			}
@@ -10806,7 +14978,9 @@ class SimplePie_Sanitize
 						if (isset($element['attribs'][$attribute]['data']))
 						{
 							$element['attribs'][$attribute]['data'] = SimplePie_Misc::absolutize_url($element['attribs'][$attribute]['data'], $this->base);
-							$data = str_replace($element['full'], SimplePie_Misc::element_implode($element), $data);
+							$new_element = SimplePie_Misc::element_implode($element);
+							$data = str_replace($element['full'], $new_element, $data);
+							$element['full'] = $new_element;
 						}
 					}
 				}
diff --git a/inc/TarLib.class.php b/inc/TarLib.class.php
index 7a7acdbdb341154621314a725a2c311f0ccbedf2..12418c48d2e11faab2e2cabf15ed2a1a103fd042 100644
--- a/inc/TarLib.class.php
+++ b/inc/TarLib.class.php
@@ -7,7 +7,7 @@
  *
  * Modified for Dokuwiki
  *
- * @license GPL
+ * @license LGPL-2.1
  * @link    http://docs.maxg.info
  * @author  Bouchon <tarlib@bouchon.org> (Maxg)
  * @author  Christopher Smith <chris@jalakai.co.uk>
diff --git a/inc/actions.php b/inc/actions.php
index 9db7d5f24e18883b4c4dea893fe8a03411477455..016af4aea589d3bc37c6200dcd23ded1223cbdd1 100644
--- a/inc/actions.php
+++ b/inc/actions.php
@@ -20,6 +20,7 @@ function act_dispatch(){
     global $ID;
     global $QUERY;
     global $lang;
+    global $conf;
 
     $preact = $ACT;
 
@@ -50,6 +51,12 @@ function act_dispatch(){
             }
         }
 
+        //display some infos
+        if($ACT == 'check'){
+            check();
+            $ACT = 'show';
+        }
+
         //check permissions
         $ACT = act_permcheck($ACT);
 
@@ -120,12 +127,6 @@ function act_dispatch(){
         if(substr($ACT,0,7) == 'export_')
             $ACT = act_export($ACT);
 
-        //display some infos
-        if($ACT == 'check'){
-            check();
-            $ACT = 'show';
-        }
-
         //handle admin tasks
         if($ACT == 'admin'){
             // retrieve admin plugin name from $_REQUEST['page']
@@ -143,6 +144,10 @@ function act_dispatch(){
         $ACT = act_permcheck($ACT);
     }  // end event ACTION_ACT_PREPROCESS default action
     $evt->advise_after();
+    // Make sure plugs can handle 'denied'
+    if($conf['send404'] && $ACT == 'denied') {
+        header('HTTP/1.0 403 Forbidden');
+    }
     unset($evt);
 
     // when action 'show', the intial not 'show' and POST, do a redirect
@@ -287,10 +292,10 @@ function act_draftsave($act){
     global $conf;
     if($conf['usedraft'] && $_POST['wikitext']){
         $draft = array('id'     => $ID,
-                'prefix' => $_POST['prefix'],
+                'prefix' => substr($_POST['prefix'], 0, -1),
                 'text'   => $_POST['wikitext'],
                 'suffix' => $_POST['suffix'],
-                'date'   => $_POST['date'],
+                'date'   => (int) $_POST['date'],
                 'client' => $INFO['client'],
                 );
         $cname = getCacheName($draft['client'].$ID,'.draft');
@@ -621,6 +626,7 @@ function act_sitemap($act) {
     if (is_readable($sitemap)) {
         // Send headers
         header('Content-Type: '.$mime);
+        header('Content-Disposition: attachment; filename='.basename($sitemap));
 
         http_conditionalRequest(filemtime($sitemap));
 
@@ -738,4 +744,4 @@ function subscription_handle_post(&$params) {
     $params = compact('target', 'style', 'data', 'action');
 }
 
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/inc/adLDAP.php b/inc/adLDAP.php
index 94cd8a50d2b30b32bb4e6e207ac3062dfb9d2684..4c8ee5db3e27e481a37eda5002ee840050b0fda3 100644
--- a/inc/adLDAP.php
+++ b/inc/adLDAP.php
@@ -1,7 +1,7 @@
 <?php
 /**
  * PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
- * Version 3.3.1
+ * Version 3.3.2
  *
  * PHP Version 5 with SSL and LDAP support
  *
@@ -9,7 +9,7 @@
  *   email: scott@wiggumworld.com, adldap@richardhyland.com
  *   http://adldap.sourceforge.net/
  *
- * Copyright (c) 2006-2009 Scott Barnett, Richard Hyland
+ * Copyright (c) 2006-2010 Scott Barnett, Richard Hyland
  *
  * We'd appreciate any improvements or additions to be submitted back
  * to benefit the entire community :)
@@ -27,10 +27,10 @@
  * @category ToolsAndUtilities
  * @package adLDAP
  * @author Scott Barnett, Richard Hyland
- * @copyright (c) 2006-2009 Scott Barnett, Richard Hyland
+ * @copyright (c) 2006-2010 Scott Barnett, Richard Hyland
  * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
- * @revision $Revision: 67 $
- * @version 3.3.1
+ * @revision $Revision: 91 $
+ * @version 3.3.2
  * @link http://adldap.sourceforge.net/
  */
 
@@ -409,25 +409,26 @@ class adLDAP {
     * @param bool optional $prevent_rebind
     * @return bool
     */
-    public function authenticate($username,$password,$prevent_rebind=false){
+    public function authenticate($username, $password, $prevent_rebind = false) {
         // Prevent null binding
-        if ($username===NULL || $password===NULL){ return (false); }
-        if (empty($username) || empty($password)){ return (false); }
+        if ($username === NULL || $password === NULL) { return false; }
+        if (empty($username) || empty($password)) { return false; }
 
         // Bind as the user
-        $this->_bind = @ldap_bind($this->_conn,$username.$this->_account_suffix,$password);
-        if (!$this->_bind){ return (false); }
+        $ret = true;
+        $this->_bind = @ldap_bind($this->_conn, $username . $this->_account_suffix, $password);
+        if (!$this->_bind){ $ret = false; }
 
         // Cnce we've checked their details, kick back into admin mode if we have it
-        if ($this->_ad_username!=NULL && !$prevent_rebind){
-            $this->_bind = @ldap_bind($this->_conn,$this->_ad_username.$this->_account_suffix,$this->_ad_password);
+        if ($this->_ad_username !== NULL && !$prevent_rebind) {
+            $this->_bind = @ldap_bind($this->_conn, $this->_ad_username . $this->_account_suffix , $this->_ad_password);
             if (!$this->_bind){
                 // This should never happen in theory
                 throw new adLDAPException('Rebind to Active Directory failed. AD said: ' . $this->get_last_error());
             }
         }
 
-        return (true);
+        return $ret;
     }
 
     //*****************************************************************************************************************
@@ -758,7 +759,7 @@ class adLDAP {
         $ret_groups=array();
 
         $groups=$this->group_info($group,array("memberof"));
-        if (is_array($groups[0]["memberof"])) {
+        if (isset($groups[0]["memberof"]) && is_array($groups[0]["memberof"])) {
             $groups=$groups[0]["memberof"];
 
             if ($groups){
@@ -861,7 +862,7 @@ class adLDAP {
     * @param array $attributes The attributes to set to the user account
     * @return bool
     */
-    public function user_create($attributes){
+        public function user_create($attributes){
         // Check for compulsory fields
         if (!array_key_exists("username",$attributes)){ return ("Missing compulsory field [username]"); }
         if (!array_key_exists("firstname",$attributes)){ return ("Missing compulsory field [firstname]"); }
@@ -963,25 +964,36 @@ class adLDAP {
             $username = $this->strguid2hex($username);
             $filter="objectguid=".$username;
         }
+        else if (strstr($username, "@")) {
+             $filter="userPrincipalName=".$username;
+        }
         else {
-            $filter="samaccountname=".$username;
+             $filter="samaccountname=".$username;
         }
+        $filter = "(&(objectCategory=person)({$filter}))";
         if ($fields===NULL){ $fields=array("samaccountname","mail","memberof","department","displayname","telephonenumber","primarygroupid","objectsid"); }
+        if (!in_array("objectsid",$fields)){
+            $fields[] = "objectsid";
+        }
         $sr=ldap_search($this->_conn,$this->_base_dn,$filter,$fields);
         $entries = ldap_get_entries($this->_conn, $sr);
 
-        if ($entries[0]['count'] >= 1) {
-            // AD does not return the primary group in the ldap query, we may need to fudge it
-            if ($this->_real_primarygroup && isset($entries[0]["primarygroupid"][0]) && isset($entries[0]["objectsid"][0])){
-                //$entries[0]["memberof"][]=$this->group_cn($entries[0]["primarygroupid"][0]);
-                $entries[0]["memberof"][]=$this->get_primary_group($entries[0]["primarygroupid"][0], $entries[0]["objectsid"][0]);
-            } else {
-                $entries[0]["memberof"][]="CN=Domain Users,CN=Users,".$this->_base_dn;
+        if (isset($entries[0])) {
+            if ($entries[0]['count'] >= 1) {
+                if (in_array("memberof", $fields)) {
+                    // AD does not return the primary group in the ldap query, we may need to fudge it
+                    if ($this->_real_primarygroup && isset($entries[0]["primarygroupid"][0]) && isset($entries[0]["objectsid"][0])){
+                        //$entries[0]["memberof"][]=$this->group_cn($entries[0]["primarygroupid"][0]);
+                        $entries[0]["memberof"][]=$this->get_primary_group($entries[0]["primarygroupid"][0], $entries[0]["objectsid"][0]);
+                    } else {
+                        $entries[0]["memberof"][]="CN=Domain Users,CN=Users,".$this->_base_dn;
+                    }
+                    $entries[0]["memberof"]["count"]++;
+                }
             }
+            return $entries;
         }
-
-        $entries[0]["memberof"]["count"]++;
-        return ($entries);
+        return false;
     }
 
     /**
@@ -1232,6 +1244,33 @@ class adLDAP {
         }
     }
 
+    /**
+    * Move a user account to a different OU
+    *
+    * @param string $username The username to move (please be careful here!)
+    * @param array $container The container or containers to move the user to (please be careful here!).
+    * accepts containers in 1. parent 2. child order
+    * @return array
+    */
+    public function user_move($username, $container) {
+        if (!$this->_bind){ return (false); }
+        if ($username === null){ return ("Missing compulsory field [username]"); }
+        if ($container === null){ return ("Missing compulsory field [container]"); }
+        if (!is_array($container)){ return ("Container must be an array"); }
+
+        $userinfo = $this->user_info($username, array("*"));
+        $dn = $userinfo[0]['distinguishedname'][0];
+        $newrdn = "cn=" . $username;
+        $container = array_reverse($container);
+        $newcontainer = "ou=" . implode(",ou=",$container);
+        $newbasedn = strtolower($newcontainer) . "," . $this->_base_dn;
+        $result=@ldap_rename($this->_conn,$dn,$newrdn,$newbasedn,true);
+        if ($result !== true) {
+            return (false);
+        }
+        return (true);
+    }
+
     //*****************************************************************************************************************
     // CONTACT FUNCTIONS
     // * Still work to do in this area, and new functions to write
@@ -1567,6 +1606,32 @@ class adLDAP {
         return ($groups);
     }
 
+    //************************************************************************************************************
+    //  ORGANIZATIONAL UNIT FUNCTIONS
+
+     /**
+    * Create an organizational unit
+    *
+    * @param array $attributes Default attributes of the ou
+    * @return bool
+    */
+    public function ou_create($attributes){
+        if (!is_array($attributes)){ return ("Attributes must be an array"); }
+        if (!array_key_exists("ou_name",$attributes)){ return ("Missing compulsory field [ou_name]"); }
+        if (!array_key_exists("container",$attributes)){ return ("Missing compulsory field [container]"); }
+        if (!is_array($attributes["container"])){ return ("Container attribute must be an array."); }
+        $attributes["container"]=array_reverse($attributes["container"]);
+
+        $add=array();
+        $add["objectClass"] = "organizationalUnit";
+
+        $container="OU=".implode(",OU=",$attributes["container"]);
+        $result=ldap_add($this->_conn,"CN=".$add["cn"].", ".$container.",".$this->_base_dn,$add);
+        if ($result!=true){ return (false); }
+
+        return (true);
+    }
+
     //************************************************************************************************************
     // EXCHANGE FUNCTIONS
 
@@ -1998,6 +2063,7 @@ class adLDAP {
         if ($attributes["exchange_usedefaults"]){ $mod["mDBUseDefaults"][0]=$attributes["exchange_usedefaults"]; }
         if ($attributes["exchange_policyexclude"]){ $mod["msExchPoliciesExcluded"][0]=$attributes["exchange_policyexclude"]; }
         if ($attributes["exchange_policyinclude"]){ $mod["msExchPoliciesIncluded"][0]=$attributes["exchange_policyinclude"]; }
+        if ($attributes["exchange_addressbook"]){ $mod["showInAddressBook"][0]=$attributes["exchange_addressbook"]; }
 
         // This schema is designed for contacts
         if ($attributes["exchange_hidefromlists"]){ $mod["msExchHideFromAddressLists"][0]=$attributes["exchange_hidefromlists"]; }
diff --git a/inc/auth.php b/inc/auth.php
index a2844a732810b714c93f879a9cb0c58654a988e3..38d1c925d74e4b1763222295df53e71fa8f1845f 100644
--- a/inc/auth.php
+++ b/inc/auth.php
@@ -70,6 +70,12 @@ function auth_setup(){
     $_REQUEST['http_credentials'] = false;
     if (!$conf['rememberme']) $_REQUEST['r'] = false;
 
+    // handle renamed HTTP_AUTHORIZATION variable (can happen when a fix like
+    // the one presented at
+    // http://www.besthostratings.com/articles/http-auth-php-cgi.html is used
+    // for enabling HTTP authentication with CGI/SuExec)
+    if(isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']))
+        $_SERVER['HTTP_AUTHORIZATION'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
     // streamline HTTP auth credentials (IIS/rewrite -> mod_php)
     if(isset($_SERVER['HTTP_AUTHORIZATION'])){
         list($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']) =
@@ -194,10 +200,11 @@ function auth_login($user,$pass,$sticky=false,$silent=false){
     }else{
         // read cookie information
         list($user,$sticky,$pass) = auth_getCookie();
-        // get session info
-        $session = $_SESSION[DOKU_COOKIE]['auth'];
         if($user && $pass){
             // we got a cookie - see if we can trust it
+
+            // get session info
+            $session = $_SESSION[DOKU_COOKIE]['auth'];
             if(isset($session) &&
                     $auth->useSessionCache($user) &&
                     ($session['time'] >= time()-$conf['auth_security_timeout']) &&
@@ -371,63 +378,15 @@ function auth_ismanager($user=null,$groups=null,$adminonly=false){
             $user = $_SERVER['REMOTE_USER'];
         }
     }
-    $user = trim($auth->cleanUser($user));
-    if($user === '') return false;
-    if(is_null($groups)) $groups = (array) $USERINFO['grps'];
-    $groups = array_map(array($auth,'cleanGroup'),$groups);
-    $user   = auth_nameencode($user);
-
-    // check username against superuser and manager
-    $superusers = explode(',', $conf['superuser']);
-    $superusers = array_unique($superusers);
-    $superusers = array_map('trim', $superusers);
-    $superusers = array_filter($superusers);
-    // prepare an array containing only true values for array_map call
-    $alltrue = array_fill(0, count($superusers), true);
-    $superusers = array_map('auth_nameencode', $superusers, $alltrue);
-
-    // case insensitive?
-    if(!$auth->isCaseSensitive()){
-        $superusers = array_map('utf8_strtolower',$superusers);
-        $user       = utf8_strtolower($user);
+    if(is_null($groups)){
+        $groups = (array) $USERINFO['grps'];
     }
 
-    // check user match
-    if(in_array($user, $superusers)) return true;
-
+    // check superuser match
+    if(auth_isMember($conf['superuser'],$user, $groups)) return true;
+    if($adminonly) return false;
     // check managers
-    if(!$adminonly){
-        $managers = explode(',', $conf['manager']);
-        $managers = array_unique($managers);
-        $managers = array_map('trim', $managers);
-        $managers = array_filter($managers);
-        // prepare an array containing only true values for array_map call
-        $alltrue = array_fill(0, count($managers), true);
-        $managers = array_map('auth_nameencode', $managers, $alltrue);
-        if(!$auth->isCaseSensitive()) $managers = array_map('utf8_strtolower',$managers);
-        if(in_array($user, $managers)) return true;
-    }
-
-    // check user's groups against superuser and manager
-    if (!empty($groups)) {
-
-        //prepend groups with @ and nameencode
-        $cnt = count($groups);
-        for($i=0; $i<$cnt; $i++){
-            $groups[$i] = '@'.auth_nameencode($groups[$i]);
-            if(!$auth->isCaseSensitive()){
-                $groups[$i] = utf8_strtolower($groups[$i]);
-            }
-        }
-
-        // check groups against superuser and manager
-        foreach($superusers as $supu)
-            if(in_array($supu, $groups)) return true;
-        if(!$adminonly){
-            foreach($managers as $mana)
-                if(in_array($mana, $groups)) return true;
-        }
-    }
+    if(auth_isMember($conf['manager'],$user, $groups)) return true;
 
     return false;
 }
@@ -446,6 +405,52 @@ function auth_isadmin($user=null,$groups=null){
     return auth_ismanager($user,$groups,true);
 }
 
+
+/**
+ * Match a user and his groups against a comma separated list of
+ * users and groups to determine membership status
+ *
+ * Note: all input should NOT be nameencoded.
+ *
+ * @param $memberlist string commaseparated list of allowed users and groups
+ * @param $user       string user to match against
+ * @param $groups     array  groups the user is member of
+ * @returns bool      true for membership acknowledged
+ */
+function auth_isMember($memberlist,$user,array $groups){
+    global $auth;
+    if (!$auth) return false;
+
+    // clean user and groups
+    if(!$auth->isCaseSensitive()){
+        $user = utf8_strtolower($user);
+        $groups = array_map('utf8_strtolower',$groups);
+    }
+    $user = $auth->cleanUser($user);
+    $groups = array_map(array($auth,'cleanGroup'),$groups);
+
+    // extract the memberlist
+    $members = explode(',',$memberlist);
+    $members = array_map('trim',$members);
+    $members = array_unique($members);
+    $members = array_filter($members);
+
+    // compare cleaned values
+    foreach($members as $member){
+        if(!$auth->isCaseSensitive()) $member = utf8_strtolower($member);
+        if($member[0] == '@'){
+            $member = $auth->cleanGroup(substr($member,1));
+            if(in_array($member, $groups)) return true;
+        }else{
+            $member = $auth->cleanUser($member);
+            if($member == $user) return true;
+        }
+    }
+
+    // still here? not a member!
+    return false;
+}
+
 /**
  * Convinience function for auth_aclcheck()
  *
@@ -536,13 +541,13 @@ function auth_aclcheck($id,$user,$groups){
 
     //still here? do the namespace checks
     if($ns){
-        $path = $ns.':\*';
+        $path = $ns.':*';
     }else{
-        $path = '\*'; //root document
+        $path = '*'; //root document
     }
 
     do{
-        $matches = preg_grep('/^'.$path.'\s+('.$regexp.')\s+/'.$ci,$AUTH_ACL);
+        $matches = preg_grep('/^'.preg_quote($path,'/').'\s+('.$regexp.')\s+/'.$ci,$AUTH_ACL);
         if(count($matches)){
             foreach($matches as $match){
                 $match = preg_replace('/#.*$/','',$match); //ignore comments
@@ -559,9 +564,9 @@ function auth_aclcheck($id,$user,$groups){
         //get next higher namespace
         $ns   = getNS($ns);
 
-        if($path != '\*'){
-            $path = $ns.':\*';
-            if($path == ':\*') $path = '\*';
+        if($path != '*'){
+            $path = $ns.':*';
+            if($path == ':*') $path = '*';
         }else{
             //we did this already
             //looks like there is something wrong with the ACL
@@ -938,6 +943,8 @@ function act_resendpwd(){
  *   mysql - MySQL password (old method)
  *   my411 - MySQL 4.1.1 password
  *   kmd5  - Salted MD5 hashing as used by UNB
+ *   pmd5  - Salted multi iteration MD5 as used by Wordpress
+ *   hmd5  - Same as pmd5 but PhpBB3 flavour
  *
  * @author  Andreas Gohr <andi@splitbrain.org>
  * @return  string  The crypted password
@@ -1017,6 +1024,45 @@ function auth_cryptPassword($clear,$method='',$salt=null){
             $hash1 = strtolower(md5($key . md5($clear)));
             $hash2 = substr($hash1, 0, 16) . $key . substr($hash1, 16);
             return $hash2;
+        case 'hmd5':
+            $key = 'H';
+            // hmd5 is exactly the same as pmd5, but uses an H as identifier
+            // PhpBB3 uses it that way, so we just fall through here
+        case 'pmd5':
+            if(!$key) $key = 'P';
+            $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
+            $iterc = $salt[0]; // pos 0 of salt is iteration count
+            $iter = strpos($itoa64,$iterc);
+            $iter = 1 << $iter;
+            $salt = substr($salt,1,8);
+
+            // iterate
+            $hash = md5($salt . $clear, true);
+            do {
+                $hash = md5($hash . $clear, true);
+            } while (--$iter);
+
+            // encode
+            $output = '';
+            $count = 16;
+            $i = 0;
+            do {
+                $value = ord($hash[$i++]);
+                $output .= $itoa64[$value & 0x3f];
+                if ($i < $count)
+                    $value |= ord($hash[$i]) << 8;
+                $output .= $itoa64[($value >> 6) & 0x3f];
+                if ($i++ >= $count)
+                    break;
+                if ($i < $count)
+                    $value |= ord($hash[$i]) << 16;
+                $output .= $itoa64[($value >> 12) & 0x3f];
+                if ($i++ >= $count)
+                    break;
+                $output .= $itoa64[($value >> 18) & 0x3f];
+            } while ($i < $count);
+
+            return '$'.$key.'$'.$iterc.$salt.$output;
         default:
             msg("Unsupported crypt method $method",-1);
     }
@@ -1044,6 +1090,12 @@ function auth_verifyPassword($clear,$crypt){
     }elseif(preg_match('/^\$apr1\$([^\$]{0,8})\$/',$crypt,$m)){
         $method = 'apr1';
         $salt   = $m[1];
+    }elseif(preg_match('/^\$P\$(.{31})$/',$crypt,$m)){
+        $method = 'pmd5';
+        $salt   = $m[1];
+    }elseif(preg_match('/^\$H\$(.{31})$/',$crypt,$m)){
+        $method = 'hmd5';
+        $salt   = $m[1];
     }elseif(substr($crypt,0,6) == '{SSHA}'){
         $method = 'ssha';
         $salt   = substr(base64_decode(substr($crypt, 6)),20);
@@ -1117,4 +1169,4 @@ function auth_getCookie(){
     return array($user,$sticky,$pass);
 }
 
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/inc/auth/ad.class.php b/inc/auth/ad.class.php
index 90fe0266bc8da9c356470071a7a376023f942501..5478d64b968db3ad3561623fed338906f3444c6d 100644
--- a/inc/auth/ad.class.php
+++ b/inc/auth/ad.class.php
@@ -126,7 +126,7 @@ class auth_ad extends auth_basic {
      * at least these fields:
      *
      * name string  full name of the user
-     * mail string  email addres of the user
+     * mail string  email address of the user
      * grps array   list of groups the user is in
      *
      * This LDAP specific function returns the following
@@ -296,4 +296,4 @@ class auth_ad extends auth_basic {
     }
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/inc/auth/basic.class.php b/inc/auth/basic.class.php
index fa38970ae34bc2ea4234c64eb21d82ad2c296485..c7e7031bfe80ea7f61b28163313c80ad95776f33 100644
--- a/inc/auth/basic.class.php
+++ b/inc/auth/basic.class.php
@@ -400,4 +400,4 @@ class auth_basic {
   }
 
 }
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/inc/auth/ldap.class.php b/inc/auth/ldap.class.php
index 7f1eec18709e640b0301fe84bf3269f63048e5f9..420043238247a65cc38d98ec9fea3b9cf2747d3e 100644
--- a/inc/auth/ldap.class.php
+++ b/inc/auth/ldap.class.php
@@ -457,4 +457,4 @@ class auth_ldap extends auth_basic {
     }
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/inc/auth/mysql.class.php b/inc/auth/mysql.class.php
index ca607ced5bc1bd127070c992bb8d5a3efd63f64b..dbdfe5fdaf04eee211076bb96dbfb17e1d75b5f7 100644
--- a/inc/auth/mysql.class.php
+++ b/inc/auth/mysql.class.php
@@ -936,4 +936,4 @@ class auth_mysql extends auth_basic {
     }
 }
 
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/inc/auth/pgsql.class.php b/inc/auth/pgsql.class.php
index 8e68e865ed0da6d00b6d8840bd181f6b7bfbf01f..cf8bf76000282cfab9b71d08d36e9e584229cf4e 100644
--- a/inc/auth/pgsql.class.php
+++ b/inc/auth/pgsql.class.php
@@ -407,4 +407,4 @@ class auth_pgsql extends auth_mysql {
 
 }
 
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/inc/auth/plain.class.php b/inc/auth/plain.class.php
index ec9e52beb191aa91d988148cbb0a0e4658b334f8..3941190e999e4cebb8fd05e3715a9821b8fc1490 100644
--- a/inc/auth/plain.class.php
+++ b/inc/auth/plain.class.php
@@ -325,4 +325,4 @@ class auth_plain extends auth_basic {
     }
 }
 
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/inc/cache.php b/inc/cache.php
index 571b314cde1842f5d16bc363e54911ed96c387dc..ff78e37ae4697052ed722ad0dace27ed49f72f34 100644
--- a/inc/cache.php
+++ b/inc/cache.php
@@ -197,18 +197,6 @@ class cache_parser extends cache {
 }
 
 class cache_renderer extends cache_parser {
-
-    function useCache($depends=array()) {
-        $use = parent::useCache($depends);
-
-        // meta data needs to be kept in step with the cache
-        if (!$use && isset($this->page)) {
-            p_set_metadata($this->page,array(),true);
-        }
-
-        return $use;
-    }
-
     function _useCache() {
         global $conf;
 
@@ -251,19 +239,12 @@ class cache_renderer extends cache_parser {
         if (isset($this->page)) {
 
             $metafile = metaFN($this->page,'.meta');
-            if (@file_exists($metafile)) {
-                $files[] = $metafile;                                       // ... the page's own metadata
-                $files[] = DOKU_INC.'inc/parser/metadata.php';              // ... the metadata renderer
-
-                $valid = p_get_metadata($this->page, 'date valid');
-                if (!empty($valid['age'])) {
-                    $this->depends['age'] = isset($this->depends['age']) ?
-                        min($this->depends['age'],$valid['age']) : $valid['age'];
-                }
-
-            } else {
-                $this->depends['purge'] = true;                             // ... purging cache will generate metadata
-                return;
+            $files[] = $metafile;                                       // ... the page's own metadata
+
+            $valid = p_get_metadata($this->page, 'date valid');         // for xhtml this will render the metadata if needed
+            if (!empty($valid['age'])) {
+                $this->depends['age'] = isset($this->depends['age']) ?
+                    min($this->depends['age'],$valid['age']) : $valid['age'];
             }
         }
 
diff --git a/inc/changelog.php b/inc/changelog.php
index cc7612bfd147d59866bedaf5e0c2a7030d84e434..15cd46d778c9108af53176bdbc6d0aeb216fa350 100644
--- a/inc/changelog.php
+++ b/inc/changelog.php
@@ -84,7 +84,10 @@ function addLogEntry($date, $id, $type=DOKU_CHANGE_TYPE_EDIT, $summary='', $extr
         $meta    = array();
         if (!$INFO['exists'] && empty($oldmeta['persistent']['date']['created'])){ // newly created
             $meta['date']['created'] = $created;
-            if ($user) $meta['creator'] = $INFO['userinfo']['name'];
+            if ($user){
+                $meta['creator'] = $INFO['userinfo']['name'];
+                $meta['user']    = $user;
+            }
         } elseif (!$INFO['exists'] && !empty($oldmeta['persistent']['date']['created'])) { // re-created / restored
             $meta['date']['created']  = $oldmeta['persistent']['date']['created'];
             $meta['date']['modified'] = $created; // use the files ctime here
diff --git a/inc/common.php b/inc/common.php
index 18f782788f7f4fc9ec07a6724d1f8f77d6a96204..b4866bccf7338e29995523e913cf64623476505b 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -242,13 +242,16 @@ function buildURLparams($params, $sep='&amp;'){
  */
 function buildAttributes($params,$skipempty=false){
     $url = '';
+    $white = false;
     foreach($params as $key => $val){
         if($key{0} == '_') continue;
         if($val === '' && $skipempty) continue;
+        if($white) $url .= ' ';
 
         $url .= $key.'="';
         $url .= htmlspecialchars ($val);
-        $url .= '" ';
+        $url .= '"';
+        $white = true;
     }
     return $url;
 }
@@ -1128,12 +1131,15 @@ function notify($id,$who,$rev='',$summary='',$minor=false,$replace=array()){
         $diff = rawWiki($id);
     }
     $text = str_replace('@DIFF@',$diff,$text);
-    if(utf8_strlen($conf['title']) < 20) {
-        $subject = '['.$conf['title'].'] '.$subject;
+    if(empty($conf['mailprefix'])) {
+        if(utf8_strlen($conf['title']) < 20) {
+            $subject = '['.$conf['title'].'] '.$subject;
+        }else{
+            $subject = '['.utf8_substr($conf['title'], 0, 20).'...] '.$subject;
+        }
     }else{
-        $subject = '['.utf8_substr($conf['title'], 0, 20).'...] '.$subject;
+        $subject = '['.$conf['mailprefix'].'] '.$subject;
     }
-
     mail_send($to,$subject,$text,$conf['mailfrom'],'',$bcc);
 }
 
@@ -1538,4 +1544,4 @@ function valid_input_set($param, $valid_values, $array, $exc = '') {
     }
 }
 
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/inc/confutils.php b/inc/confutils.php
index 4306dab8f50a5ee7a91aeb8cd58e23a14691880a..26ed4f08712dfbe5ae12321891e15760aeae220d 100644
--- a/inc/confutils.php
+++ b/inc/confutils.php
@@ -324,4 +324,4 @@ function conf_decodeString($str) {
                      return $str;
     }
 }
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/inc/feedcreator.class.php b/inc/feedcreator.class.php
index 8141d867cc180a542c36f56f4023f89059c064c1..435add6acd6a850056012790a487ae2a5608a80e 100644
--- a/inc/feedcreator.class.php
+++ b/inc/feedcreator.class.php
@@ -1577,4 +1577,4 @@ class DokuWikiFeedCreator extends UniversalFeedCreator{
 
 
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/inc/form.php b/inc/form.php
index 70190d2b49b0dc2dceeab3cc18db93281260ab01..30e16b626cf7954f715385ca1e6217dceb5dab1f 100644
--- a/inc/form.php
+++ b/inc/form.php
@@ -252,7 +252,7 @@ class Doku_Form {
         global $lang;
         $form = '';
         $this->params['accept-charset'] = $lang['encoding'];
-        $form .= '<form ' . html_attbuild($this->params) . '><div class="no">' . DOKU_LF;
+        $form .= '<form ' . buildAttributes($this->params,true) . '><div class="no">' . DOKU_LF;
         if (!empty($this->_hidden)) {
             foreach ($this->_hidden as $name=>$value)
                 $form .= form_hidden(array('name'=>$name, 'value'=>$value));
@@ -597,7 +597,7 @@ function form_makeListboxField($name, $values, $selected='', $label=null, $id=''
  * @author  Tom N Harris <tnharris@whoopdedo.org>
  */
 function form_tag($attrs) {
-    return '<'.$attrs['_tag'].' '.buildAttributes($attrs).'/>';
+    return '<'.$attrs['_tag'].' '.buildAttributes($attrs,true).'/>';
 }
 
 /**
@@ -696,7 +696,7 @@ function form_wikitext($attrs) {
  */
 function form_button($attrs) {
     $p = (!empty($attrs['_action'])) ? 'name="do['.$attrs['_action'].']" ' : '';
-    return '<input '.$p.buildAttributes($attrs,true).'/>';
+    return '<input '.$p.buildAttributes($attrs,true).' />';
 }
 
 /**
@@ -714,7 +714,7 @@ function form_field($attrs) {
     if ($attrs['_class']) $s .= ' class="'.$attrs['_class'].'"';
     if (!empty($attrs['id'])) $s .= ' for="'.$attrs['id'].'"';
     $s .= '><span>'.$attrs['_text'].'</span>';
-    $s .= ' <input '.buildAttributes($attrs,true).'/></label>';
+    $s .= ' <input '.buildAttributes($attrs,true).' /></label>';
     if (preg_match('/(^| )block($| )/', $attrs['_class']))
         $s .= '<br />';
     return $s;
@@ -734,7 +734,7 @@ function form_fieldright($attrs) {
     $s = '<label';
     if ($attrs['_class']) $s .= ' class="'.$attrs['_class'].'"';
     if (!empty($attrs['id'])) $s .= ' for="'.$attrs['id'].'"';
-    $s .= '><input '.buildAttributes($attrs,true).'/>';
+    $s .= '><input '.buildAttributes($attrs,true).' />';
     $s .= ' <span>'.$attrs['_text'].'</span></label>';
     if (preg_match('/(^| )block($| )/', $attrs['_class']))
         $s .= '<br />';
@@ -758,7 +758,7 @@ function form_textfield($attrs) {
     if ($attrs['_class']) $s .= ' class="'.$attrs['_class'].'"';
     if (!empty($attrs['id'])) $s .= ' for="'.$attrs['id'].'"';
     $s .= '><span>'.$attrs['_text'].'</span> ';
-    $s .= '<input type="text" '.buildAttributes($attrs,true).'/></label>';
+    $s .= '<input type="text" '.buildAttributes($attrs,true).' /></label>';
     if (preg_match('/(^| )block($| )/', $attrs['_class']))
         $s .= '<br />';
     return $s;
@@ -781,7 +781,7 @@ function form_passwordfield($attrs) {
     if ($attrs['_class']) $s .= ' class="'.$attrs['_class'].'"';
     if (!empty($attrs['id'])) $s .= ' for="'.$attrs['id'].'"';
     $s .= '><span>'.$attrs['_text'].'</span> ';
-    $s .= '<input type="password" '.buildAttributes($attrs,true).'/></label>';
+    $s .= '<input type="password" '.buildAttributes($attrs,true).' /></label>';
     if (preg_match('/(^| )block($| )/', $attrs['_class']))
         $s .= '<br />';
     return $s;
@@ -807,7 +807,7 @@ function form_filefield($attrs) {
     $s .= '<input type="file" '.buildAttributes($attrs,true);
     if (!empty($attrs['_maxlength'])) $s .= ' maxlength="'.$attrs['_maxlength'].'"';
     if (!empty($attrs['_accept'])) $s .= ' accept="'.$attrs['_accept'].'"';
-    $s .= '/></label>';
+    $s .= ' /></label>';
     if (preg_match('/(^| )block($| )/', $attrs['_class']))
         $s .= '<br />';
     return $s;
@@ -837,7 +837,7 @@ function form_checkboxfield($attrs) {
                  . ' value="' . hsc($attrs['value'][1]) . '" />';
         $attrs['value'] = $attrs['value'][0];
     }
-    $s .= '<input type="checkbox" '.buildAttributes($attrs,true).'/>';
+    $s .= '<input type="checkbox" '.buildAttributes($attrs,true).' />';
     $s .= ' <span>'.$attrs['_text'].'</span></label>';
     if (preg_match('/(^| )block($| )/', $attrs['_class']))
         $s .= '<br />';
@@ -860,7 +860,7 @@ function form_radiofield($attrs) {
     $s = '<label';
     if ($attrs['_class']) $s .= ' class="'.$attrs['_class'].'"';
     if (!empty($attrs['id'])) $s .= ' for="'.$attrs['id'].'"';
-    $s .= '><input type="radio" '.buildAttributes($attrs,true).'/>';
+    $s .= '><input type="radio" '.buildAttributes($attrs,true).' />';
     $s .= ' <span>'.$attrs['_text'].'</span></label>';
     if (preg_match('/(^| )block($| )/', $attrs['_class']))
         $s .= '<br />';
diff --git a/inc/fulltext.php b/inc/fulltext.php
index 35ee4ba3467a57cd952b0dbe7c47b9ae04ccad46..805da2e37d2dfaadfe1044a569fa65205664884b 100644
--- a/inc/fulltext.php
+++ b/inc/fulltext.php
@@ -376,6 +376,11 @@ function ft_snippet($id,$highlight){
  * Wraps a search term in regex boundary checks.
  */
 function ft_snippet_re_preprocess($term) {
+    // do not process asian terms where word boundaries are not explicit
+    if(preg_match('/'.IDX_ASIAN.'/u',$term)){
+        return $term;
+    }
+
     if(substr($term,0,2) == '\\*'){
         $term = substr($term,2);
     }else{
@@ -710,7 +715,7 @@ function ft_termParser($Indexer, $term, $consider_asian = true, $phrase_mode = f
         // successive asian characters need to be searched as a phrase
         $words = preg_split('/('.IDX_ASIAN.'+)/u', $term, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
         foreach ($words as $word) {
-            if (preg_match('/'.IDX_ASIAN.'/u', $word)) $phrase_mode = true;
+            $phrase_mode = $phrase_mode ? true : preg_match('/'.IDX_ASIAN.'/u', $word);
             $parsed .= ft_termParser($Indexer, $word, false, $phrase_mode);
         }
     } else {
@@ -732,4 +737,4 @@ function ft_termParser($Indexer, $term, $consider_asian = true, $phrase_mode = f
     return $parsed;
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/inc/html.php b/inc/html.php
index 7f502afa528949553c5c40d9dc22a01ebea3d555..bd87ee7a19944ca84af768151fb865db6b0df84e 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -26,6 +26,7 @@ function html_wikilink($id,$name=null,$search=''){
 /**
  * Helps building long attribute lists
  *
+ * @deprecated Use buildAttributes instead
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 function html_attbuild($attributes){
@@ -887,6 +888,9 @@ function html_diff($text='',$intro=true){
         $rev2 = (int) $_REQUEST['rev2'];
     }
 
+    $r_minor = '';
+    $l_minor = '';
+
     if($text){                      // compare text to the most current revision
         $l_rev   = '';
         $l_text  = rawWiki($ID,'');
@@ -1033,7 +1037,10 @@ function html_conflict($text,$summary){
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 function html_msgarea(){
-    global $MSG;
+    global $MSG, $MSG_shown;
+    // store if the global $MSG has already been shown and thus HTML output has been started
+    $MSG_shown = true;
+
     if(!isset($MSG)) return;
 
     $shown = array();
@@ -1045,6 +1052,8 @@ function html_msgarea(){
         print '</div>';
         $shown[$hash] = 1;
     }
+
+    unset($GLOBALS['MSG']);
 }
 
 /**
@@ -1213,9 +1222,9 @@ function html_edit(){
     if($wr && $conf['license']){
         $form->addElement(form_makeOpenTag('div', array('class'=>'license')));
         $out  = $lang['licenseok'];
-        $out .= '<a href="'.$license[$conf['license']]['url'].'" rel="license" class="urlextern"';
+        $out .= ' <a href="'.$license[$conf['license']]['url'].'" rel="license" class="urlextern"';
         if(isset($conf['target']['extern'])) $out .= ' target="'.$conf['target']['extern'].'"';
-        $out .= '> '.$license[$conf['license']]['name'].'</a>';
+        $out .= '>'.$license[$conf['license']]['name'].'</a>';
         $form->addElement($out);
         $form->addElement(form_makeCloseTag('div'));
     }
diff --git a/inc/infoutils.php b/inc/infoutils.php
index d3c6f2918514ec2119e5fa01db679219a09d1383..5f406aa3e9990c0594883d941c196e2faee84b3b 100644
--- a/inc/infoutils.php
+++ b/inc/infoutils.php
@@ -258,7 +258,7 @@ function check(){
  * @see    html_msgarea
  */
 function msg($message,$lvl=0,$line='',$file=''){
-    global $MSG;
+    global $MSG, $MSG_shown;
     $errors[-1] = 'error';
     $errors[0]  = 'info';
     $errors[1]  = 'success';
@@ -268,7 +268,7 @@ function msg($message,$lvl=0,$line='',$file=''){
 
     if(!isset($MSG)) $MSG = array();
     $MSG[]=array('lvl' => $errors[$lvl], 'msg' => $message);
-    if(headers_sent()){
+    if(isset($MSG_shown) || headers_sent()){
         if(function_exists('html_msgarea')){
             html_msgarea();
         }else{
diff --git a/inc/init.php b/inc/init.php
index 1dc31a31f18b9cc05a644022ea09b65980a8b297..f4c8679350106f16848d8aa8ca62723cfd3244ab 100644
--- a/inc/init.php
+++ b/inc/init.php
@@ -421,14 +421,27 @@ function getBaseURL($abs=null){
     if($conf['baseurl']) return rtrim($conf['baseurl'],'/').$dir;
 
     //split hostheader into host and port
-    $addr = explode(':',$_SERVER['HTTP_HOST']);
-    $host = $addr[0];
-    $port = '';
-    if (isset($addr[1])) {
-        $port = $addr[1];
-    } elseif (isset($_SERVER['SERVER_PORT'])) {
+    if(isset($_SERVER['HTTP_HOST'])){
+        $parsed_host = parse_url('http://'.$_SERVER['HTTP_HOST']);
+        $host = $parsed_host['host'];
+        $port = $parsed_host['port'];
+    }elseif(isset($_SERVER['SERVER_NAME'])){
+        $parsed_host = parse_url('http://'.$_SERVER['SERVER_NAME']);
+        $host = $parsed_host['host'];
+        $port = $parsed_host['port'];
+    }else{
+        $host = php_uname('n');
+        $port = '';
+    }
+
+    if(!$port && isset($_SERVER['SERVER_PORT'])) {
         $port = $_SERVER['SERVER_PORT'];
     }
+
+    if(is_null($port)){
+        $port = '';
+    }
+
     if(!is_ssl()){
         $proto = 'http://';
         if ($port == '80') {
diff --git a/inc/io.php b/inc/io.php
index a0be00da3c62536b3ad6f4120d57789cea2c2699..034ac650e7b63e70fa94a7ff1fc172aede39cfc2 100644
--- a/inc/io.php
+++ b/inc/io.php
@@ -486,7 +486,7 @@ function io_download($url,$file,$useAttachment=false,$defaultName='',$maxSize=20
                     preg_match('/attachment;\s*filename\s*=\s*"([^"]*)"/i', $content_disposition, $match)) {
 
                 $name = basename($match[1]);
-        }
+            }
 
         }
 
diff --git a/inc/lang/ar/lang.php b/inc/lang/ar/lang.php
index 30095347e1f5acf52b4d1f2f05bee8c0c223a072..0a2341b97f494ae258889f5a909cb3a18cbf5a8d 100644
--- a/inc/lang/ar/lang.php
+++ b/inc/lang/ar/lang.php
@@ -28,7 +28,7 @@ $lang['btn_revs']              = 'نسخ قديمة';
 $lang['btn_recent']            = 'أحدث التغييرات';
 $lang['btn_upload']            = 'ارفع';
 $lang['btn_cancel']            = 'ألغ';
-$lang['btn_index']             = 'فهرس';
+$lang['btn_index']             = 'خريطة موقع';
 $lang['btn_secedit']           = 'حرر';
 $lang['btn_login']             = 'لج';
 $lang['btn_logout']            = 'اخرج';
@@ -54,21 +54,21 @@ $lang['newpass']               = 'كلمة سر جديدة';
 $lang['oldpass']               = 'أكد كلمة السر الحالية';
 $lang['passchk']               = 'مرة أخرى';
 $lang['remember']              = 'تذكرني';
-$lang['fullname']              = 'الاسم الكامل';
+$lang['fullname']              = 'الاسم الحقيقي';
 $lang['email']                 = 'البريد الإلكتروني';
 $lang['register']              = 'سجّل';
 $lang['profile']               = 'الملف الشخصي';
 $lang['badlogin']              = 'عذرا، اسم المشترك أو كلمة السر غير صحيحة';
 $lang['minoredit']             = 'تعديلات طفيفة';
-$lang['draftdate']             = 'حفظ المسودات تلقائيا مشغل';
-$lang['nosecedit']             = 'غُيرت الصفحة في هذه الأثناء، معلومات الفقرة اصبحت قديمة. حُمُلت كل الصفحة بدلا.';
-$lang['regmissing']            = 'عذرا، يجب ملء جميع الحقول';
+$lang['draftdate']             = 'حفظ المسودات آليا مفعّل';
+$lang['nosecedit']             = 'غُيرت الصفحة في هذه الأثناء، معلومات الجزء اصبحت قديمة. حُمُلت كل الصفحة بدلا.';
+$lang['regmissing']            = 'عذرا، عليك ملء جميع الحقول.';
 $lang['reguexists']            = 'عذرا، يوجد مشترك بنفس الاسم.';
 $lang['regsuccess']            = 'أنشئ المستخدم و ارسلت كلمة السر بالبريد.';
 $lang['regsuccess2']           = 'أنشئ المستخدم.';
-$lang['regmailfail']           = 'حدث خطأ فى إرسال رسالة كلمة اسرر. يرجى مراسلة المدير';
-$lang['regbadmail']            = 'يبدو البريد الإلكتروني المعطى غير صحيح، إن كنت تظن أن هذا خطأ، راسل المدير';
-$lang['regbadpass']            = 'كلمتى المرور غير متطابقتين، حاول مرة أخرى.';
+$lang['regmailfail']           = 'حدث خطأ فى إرسال رسالة كلمة السر. يرجى مراسلة المدير!';
+$lang['regbadmail']            = 'يبدو البريد الإلكتروني المعطى غيرَ صحيح، إن كنت تظن أن هذا خطأ، راسل المدير';
+$lang['regbadpass']            = 'كلمتا المرور غير متطابقتين، حاول مرة أخرى.';
 $lang['regpwmail']             = 'كلمة مرورك إلى دوكو ويكي';
 $lang['reghere']               = 'ليس لديك حساب بعد؟ احصل على واحد';
 $lang['profna']                = 'هذه الويكي لا تدعم تعديل الملف الشخصي';
@@ -81,35 +81,35 @@ $lang['resendpwd']             = 'إرسال كلمة مرور';
 $lang['resendpwdmissing']      = 'عذراّ، يجب أن تملأ كل الحقول.';
 $lang['resendpwdnouser']       = 'عذراً، لم نجد المستخدم هذا في قاعدة بياناتنا.';
 $lang['resendpwdbadauth']      = 'عذراً، رمز التفعيل هذا غير صحيح. نأكد من استخدامك كامل وصلة التأكيد.';
-$lang['resendpwdconfirm']      = 'أرسل رابط التأكيد بواسطة البريد.';
-$lang['resendpwdsuccess']      = 'كلمة السرالجديدة إرسلت عبر البريد.';
-$lang['license']               = 'مالم يشر لخلاف ذلك، فإن المحتوى على هذه الويكي مرخص وفق الرخصة التالية:';
+$lang['resendpwdconfirm']      = 'اُرسل رابط التأكيد بواسطة البريد.';
+$lang['resendpwdsuccess']      = 'كلمة السرالجديدة اُرسلت عبر البريد.';
+$lang['license']               = 'مالم يشر لخلاف ذلك، فإن المحتوى في هذه الويكي مرخص وفق الرخصة التالية:';
 $lang['licenseok']             = 'لاحظ: بتحرير هذه الصفحة أنت توافق على ترخيص محتواها تحت الرخصة التالية:';
-$lang['searchmedia']           = 'ابحث في اسماء الملفات:';
+$lang['searchmedia']           = 'ابحث في أسماء الملفات:';
 $lang['searchmedia_in']        = 'ابحث في %s';
 $lang['txt_upload']            = 'اختر ملفاً للرفع';
 $lang['txt_filename']          = 'رفع كـ (اختياري)';
 $lang['txt_overwrt']           = 'اكتب على ملف موجود';
-$lang['lockedby']              = 'حالياً مقفل بواسطة';
+$lang['lockedby']              = 'مقفلة حاليا لـ';
 $lang['lockexpire']            = 'ينتهي القفل في';
 $lang['willexpire']            = 'سينتهي قفل تحرير هذه الصفحه خلال دقيقة.\nلتجنب التعارض استخدم زر المعاينة لتصفير مؤقت القفل.';
-$lang['js']['notsavedyet']     = 'التعديلات غير المحفوظة ستفقد. اكمل فعلا؟';
+$lang['js']['notsavedyet']     = 'التعديلات غير المحفوظة ستفقد.';
 $lang['js']['searchmedia']     = 'ابحث عن ملفات';
 $lang['js']['keepopen']        = 'أبقي النافذة مفتوحة أثناء الاختيار';
 $lang['js']['hidedetails']     = 'أخف التفاصيل';
-$lang['js']['mediatitle']      = 'اعدادات الرابط';
+$lang['js']['mediatitle']      = 'إعدادات الرابط';
 $lang['js']['mediadisplay']    = 'نوع الرابط';
 $lang['js']['mediaalign']      = 'المحاذاة';
 $lang['js']['mediasize']       = 'حجم الصورة';
 $lang['js']['mediatarget']     = 'هدف الرابط';
-$lang['js']['mediaclose']      = 'اغلق';
+$lang['js']['mediaclose']      = 'أغلق';
 $lang['js']['mediainsert']     = 'أدرج';
-$lang['js']['mediadisplayimg'] = 'اظهر الصورة.';
+$lang['js']['mediadisplayimg'] = 'أظهر الصورة.';
 $lang['js']['mediadisplaylnk'] = 'اظهر الرابط فقط.';
 $lang['js']['mediasmall']      = 'نسخة مصغرة';
 $lang['js']['mediamedium']     = 'نسخة متوسطة';
 $lang['js']['medialarge']      = 'نسخة كبيرة';
-$lang['js']['mediaoriginal']   = 'نسخة أصلية';
+$lang['js']['mediaoriginal']   = 'النسخة الأصلية';
 $lang['js']['medialnk']        = 'الرابط لصفحة التفاصيل';
 $lang['js']['mediadirect']     = 'رابط مباشر للأصل';
 $lang['js']['medianolnk']      = 'لا رابط';
@@ -118,70 +118,73 @@ $lang['js']['medialeft']       = 'حاذي الصورة إلى اليسار.';
 $lang['js']['mediaright']      = 'حاذي الصورة إلى اليمين.';
 $lang['js']['mediacenter']     = 'حاذي الصورة إلى الوسط.';
 $lang['js']['medianoalign']    = 'لا تستعمل المحاذاة.';
-$lang['js']['nosmblinks']      = 'الروابط لمجلدات ويندوز المشاركة تعمل فقط مع متصفح مايكروسفت Internet Explorer.  ما زال بإمكانك قص و لصق الرابط.';
+$lang['js']['nosmblinks']      = 'الروابط لمجلدات مشاركة وندز تعمل فقط مع متصفح مايكروسفت Internet Explorer.
+ما زال بإمكانك قص و لصق الرابط.';
 $lang['js']['linkwiz']         = 'مرشد الروابط';
 $lang['js']['linkto']          = 'الرابط إلى :';
 $lang['js']['del_confirm']     = 'هل حقاً تريد حذف البنود المختارة؟';
 $lang['js']['mu_btn']          = 'رفع عدة ملفات في وقت واحد';
 $lang['rssfailed']             = 'خطأ ما حدث أثناء جلب ملف التغذية:';
 $lang['nothingfound']          = 'لا يوجد شيء';
-$lang['mediaselect']           = 'ملفات الوسائط المتعددة';
-$lang['fileupload']            = 'تحميل ملف وسائط متعددة';
-$lang['uploadsucc']            = 'تم التحميل بنجاح';
-$lang['uploadfail']            = 'فشل التحميل، قد يكون الخطأ فى التراخيص؟';
-$lang['uploadwrong']           = 'التحميل ممنوع، نوع الملف مرفوض!';
-$lang['uploadexist']           = 'الملف موجود أصلاً. لم يحدث شيء';
-$lang['uploadbadcontent']      = 'المحتوى المحمّل لم يتطابق مع نوع الملف %s';
-$lang['uploadspam']            = 'التحميل محجوب بواسطة القائمة السوداء لبرنامج تقفي التطفل';
-$lang['uploadxss']             = 'التحميل محجوب لمنع المحتويات الخبيثة';
-$lang['uploadsize']            = 'الملف الذي تم رفعه كبير جدا . ( الحد الأقصى %s )';
-$lang['deletesucc']            = 'تم حذف الملف "%s"';
-$lang['deletefail']            = 'لا يمكن حذف "%s"، تأكد من تراخيصك';
-$lang['mediainuse']            = 'لم يحذف الملف "%s"، مازال موجوداً';
+$lang['mediaselect']           = 'ملفات الوسائط';
+$lang['fileupload']            = 'تحميل ملف وسائط';
+$lang['uploadsucc']            = 'تم الرفع بنجاح';
+$lang['uploadfail']            = 'فشل الرفع، ربما خطأ تراخيص؟';
+$lang['uploadwrong']           = 'الرفع ممنوع، نوع الملف مرفوض!';
+$lang['uploadexist']           = 'الملف موجود أصلاً. لم يُعمل شيئ.';
+$lang['uploadbadcontent']      = 'المحتوى المرفوع لم يطابق لاحقة ملفات %s.';
+$lang['uploadspam']            = 'الرفع محجوب بواسطة القائمة السوداء لبرنامج تقفي التطفل.';
+$lang['uploadxss']             = 'رُفض الرفع للإشتباه بمحتوى ضار.';
+$lang['uploadsize']            = 'الملف المرفوع كان كبيرا جدا . ( الحد %s )';
+$lang['deletesucc']            = 'حُذف الملف "%s".';
+$lang['deletefail']            = 'تعذر حذف "%s" - تأكد من الصلاحيات.';
+$lang['mediainuse']            = 'لم يحذف الملف "%s" - مازال مستخدما.';
 $lang['namespaces']            = 'فضاء التسمية';
 $lang['mediafiles']            = 'ملفات موجودة في';
+$lang['accessdenied']          = 'لا يسمح لك برؤية هذه الصفحة.';
 $lang['mediausage']            = 'استخدم هذه الصياغة للدلالة على هذا الملف:';
-$lang['mediaview']             = 'عرض الملف الأصلي';
+$lang['mediaview']             = 'اعرض الملف الأصلي';
 $lang['mediaroot']             = 'الجذر';
-$lang['mediaupload']           = 'تحميل ملف إلى فضاء التسمية هنا. لإنشاء فضاءات تسمية فرعية، أضفها إلى بداية خانة تحميل باسم وافصل بينها باستخدام الفواصل';
-$lang['mediaextchange']        = 'تم تغيير نوع الملف من .%s إلى .%s!';
+$lang['mediaupload']           = 'تحميل ملف إلى فضاء التسمية هنا. لإنشاء فضاءات تسمية فرعية، أضفها إلى بداية خانة تحميل باسم وافصل بينها باستخدام الفاصلتان الرأسيتان.';
+$lang['mediaextchange']        = 'غُيرت لاحقة الملف من .%s إلى .%s!';
 $lang['reference']             = 'مراجع لـ';
 $lang['ref_inuse']             = 'لا يمكن حذف الملف، لأنه مستخدم من قبل الصفحات التالية:';
-$lang['ref_hidden']            = 'بعض المراجع لصفاحات لا تملك ترخيص برؤيتها';
-$lang['hits']                  = 'زوار';
-$lang['quickhits']             = 'صفحات بهذا الاسم';
+$lang['ref_hidden']            = 'بعض المراجع على صفحات لا تملك صلاحيات قراءتها';
+$lang['hits']                  = 'مرة';
+$lang['quickhits']             = 'صفحات مطابقة';
 $lang['toc']                   = 'جدول المحتويات';
 $lang['current']               = 'حالي';
 $lang['yours']                 = 'نسختك';
-$lang['diff']                  = 'مقارنة بالنسخة الحالية';
-$lang['diff2']                 = 'مقارنة بين النسخ المختارة';
+$lang['diff']                  = 'أظهر الاختلافات مع النسخة الحالية';
+$lang['diff2']                 = 'أظهر الاختلافات بين النسخ المحددة';
+$lang['difflink']              = 'رابط إلى هذه المقارنة';
 $lang['line']                  = 'سطر';
 $lang['breadcrumb']            = 'أثر';
 $lang['youarehere']            = 'أنت هنا';
 $lang['lastmod']               = 'آخر تعديل';
 $lang['by']                    = 'بواسطة';
-$lang['deleted']               = 'تم حذف';
-$lang['created']               = 'تم إنشاء';
-$lang['restored']              = 'عودة لنسخة قديمة';
+$lang['deleted']               = 'حذفت';
+$lang['created']               = 'اُنشئت';
+$lang['restored']              = 'استعيدت نسخة قديمة';
 $lang['external_edit']         = 'تحرير خارجي';
 $lang['summary']               = 'ملخص التحرير';
 $lang['noflash']               = 'تحتاج إلى<a href="http://www.adobe.com/products/flashplayer/">ملحق فلاش أدوبي</a> لعرض هذا المحتوى.';
 $lang['download']              = 'نزل Snippet';
 $lang['mail_newpage']          = 'إضافة صفحة:';
 $lang['mail_changed']          = 'تعديل صفحة:';
-$lang['mail_subscribe_list']   = 'صفحات غيرت في النظاق:';
-$lang['mail_new_user']         = 'مشترك جديد';
-$lang['mail_upload']           = 'تحميل ملف:';
+$lang['mail_subscribe_list']   = 'صفحات غيرت في النطاق:';
+$lang['mail_new_user']         = 'مشترك جديد:';
+$lang['mail_upload']           = 'رفع ملف:';
 $lang['qb_bold']               = 'نص عريض';
 $lang['qb_italic']             = 'نص مائل';
 $lang['qb_underl']             = 'نص مسطر';
 $lang['qb_code']               = 'نص برمجي';
 $lang['qb_strike']             = 'نص مشطوب';
-$lang['qb_h1']                 = 'عنوان مستوى أول';
-$lang['qb_h2']                 = 'عنوان مستوى ثاني';
-$lang['qb_h3']                 = 'عنوان مستوى ثالث';
-$lang['qb_h4']                 = 'عنوان مستوى رابع';
-$lang['qb_h5']                 = 'عنوان مستوى خامس';
+$lang['qb_h1']                 = 'عنوان مستوى ١';
+$lang['qb_h2']                 = 'عنوان مستوى ٢';
+$lang['qb_h3']                 = 'عنوان مستوى ٣';
+$lang['qb_h4']                 = 'عنوان مستوى ٤';
+$lang['qb_h5']                 = 'عنوان مستوى ٥';
 $lang['qb_h']                  = 'الترويسة';
 $lang['qb_hs']                 = 'حدد الترويسة';
 $lang['qb_hplus']              = 'ترويسة أعلى';
@@ -192,29 +195,29 @@ $lang['qb_extlink']            = 'رابط خارجي';
 $lang['qb_hr']                 = 'سطر أفقي';
 $lang['qb_ol']                 = 'بند فى قائمة مرتبة';
 $lang['qb_ul']                 = 'بند فى قائمة غير مرتبة';
-$lang['qb_media']              = 'إضافة صور و ملفات أخرى';
-$lang['qb_sig']                = 'أضف توقيعك';
-$lang['qb_smileys']            = 'الابتسامات';
+$lang['qb_media']              = 'أضف صورا و ملفات أخرى';
+$lang['qb_sig']                = 'أدرج التوقيع';
+$lang['qb_smileys']            = 'الإبتسامات';
 $lang['qb_chars']              = 'محارف خاصة';
 $lang['upperns']               = 'انتقل للنطاق الأب';
-$lang['admin_register']        = 'إضافة مشترك جديد';
+$lang['admin_register']        = 'أضف مستخدما جديدا';
 $lang['metaedit']              = 'تحرير البيانات الشمولية ';
-$lang['metasaveerr']           = 'فشلت عملية كتابة البيانات الشمولية';
-$lang['metasaveok']            = 'تم حفظ البيانت الشمولية';
-$lang['img_backto']            = 'العودة إلى';
+$lang['metasaveerr']           = 'فشلت كتابة البيانات الشمولية';
+$lang['metasaveok']            = 'حُفظت البيانات الشمولية';
+$lang['img_backto']            = 'عودة إلى';
 $lang['img_title']             = 'العنوان';
-$lang['img_caption']           = 'تنويه الصورة';
+$lang['img_caption']           = 'وصف';
 $lang['img_date']              = 'التاريخ';
 $lang['img_fname']             = 'اسم الملف';
 $lang['img_fsize']             = 'الحجم';
 $lang['img_artist']            = 'المصور';
 $lang['img_copyr']             = 'حقوق النسخ';
-$lang['img_format']            = 'صيغ رسومية';
-$lang['img_camera']            = 'آلة التصوير';
+$lang['img_format']            = 'الهيئة';
+$lang['img_camera']            = 'الكمرا';
 $lang['img_keywords']          = 'كلمات مفتاحية';
 $lang['subscr_subscribe_success'] = 'اضيف %s لقائمة اشتراك %s';
 $lang['subscr_subscribe_error'] = 'خطأ في إضافة %s لقائمة اشتراك %s';
-$lang['subscr_subscribe_noaddress'] = 'ليس هناك عنوان مرتبط بدخولك، لا يمكن اضافتك لقائمة الاشتراك';
+$lang['subscr_subscribe_noaddress'] = 'ليس هناك عنوان مرتبط بولوجك، لا يمكن اضافتك لقائمة الاشتراك';
 $lang['subscr_unsubscribe_success'] = 'أزيل %s من قائمة اشتراك %s';
 $lang['subscr_unsubscribe_error'] = 'خطأ في إزالة %s من قائمة اشتراك %s';
 $lang['subscr_already_subscribed'] = '%s مشترك مسبقا في %s';
@@ -224,7 +227,7 @@ $lang['subscr_m_new_header']   = 'أضف اشتراكا';
 $lang['subscr_m_current_header'] = 'الاشتراكات الحالية';
 $lang['subscr_m_unsubscribe']  = 'ألغ الاشتراك';
 $lang['subscr_m_subscribe']    = 'اشترك';
-$lang['subscr_m_receive']      = 'استقبل';
+$lang['subscr_m_receive']      = 'استقبال';
 $lang['subscr_style_every']    = 'بريدا على كل تغيير';
 $lang['subscr_style_digest']   = 'بريد ملخص عن تغييرات كل صفحة';
 $lang['subscr_style_list']     = 'قائمة بالصفحات المتغيرة منذ آخر بريد';
diff --git a/inc/lang/cs/lang.php b/inc/lang/cs/lang.php
index 33c6db01a3cca8c63863abf8f78ba5b4511e2054..749a41a5bbc9910fbf07e7a6743b6e22411fcffc 100644
--- a/inc/lang/cs/lang.php
+++ b/inc/lang/cs/lang.php
@@ -242,7 +242,7 @@ $lang['i_wikiname']            = 'Název wiki';
 $lang['i_enableacl']           = 'Zapnout ACL (doporučeno)';
 $lang['i_superuser']           = 'Správce';
 $lang['i_problems']            = 'Instalátor narazil na níže popsané problémy. Nelze pokračovat v instalaci, dokud je neopravíte.';
-$lang['i_modified']            = 'Instalátor bude z bezpečnostních důvodů pracovat pouze s čistou a ještě neupravenou instalací DokuWiki. Buď znovu rozbalte souboru z instalačního balíčku nebo se zkuste poradit s <a href="http://dokuwiki.org/install">instrukcemi pro instalci DokuWiki</a>.';
+$lang['i_modified']            = 'Instalátor bude z bezpečnostních důvodů pracovat pouze s čistou a ještě neupravenou instalací DokuWiki. Buď znovu rozbalte souboru z instalačního balíčku nebo se zkuste poradit s <a href="http://dokuwiki.org/install">instrukcemi pro instalaci DokuWiki</a>.';
 $lang['i_funcna']              = 'PHP funkce <code>%s</code> není dostupná. Váš webhosting ji možná z nějakého důvodu vypnul.';
 $lang['i_phpver']              = 'Verze vaší instalace PHP <code>%s</code> je nižší než požadovaná <code>%s</code>. Budete muset aktualizovat svou instalaci PHP.';
 $lang['i_permfail']            = 'DokuWiki nemůže zapisovat do <code>%s</code>. Budete muset opravit práva k tomuto adresáři.';
@@ -268,7 +268,7 @@ $lang['mu_toobig']             = 'příliš velké';
 $lang['mu_ready']              = 'připraveno k načtení';
 $lang['mu_done']               = 'hotovo';
 $lang['mu_fail']               = 'selhalo';
-$lang['mu_authfail']           = 'vypršla session';
+$lang['mu_authfail']           = 'vypršela session';
 $lang['mu_progress']           = '@PCT@% načten';
 $lang['mu_filetypes']          = 'Povolené typy souborů';
 $lang['mu_info']               = 'soubory načteny.';
diff --git a/inc/lang/cs/subscr_form.txt b/inc/lang/cs/subscr_form.txt
index b786ac13792ad6d6fb8c933f35c6176d6cf1d42a..d051b646fcd96b1b32a396016a77eb6887f16f04 100644
--- a/inc/lang/cs/subscr_form.txt
+++ b/inc/lang/cs/subscr_form.txt
@@ -1,3 +1,3 @@
 ====== Správa odběratelů změn ======
 
-Tato stránka Vám umožnuje spravovat uživatele přihlášené k odběru změn aktuální stránky nebo jmenného prostoru.
\ No newline at end of file
+Tato stránka Vám umožňuje spravovat uživatele přihlášené k odběru změn aktuální stránky nebo jmenného prostoru.
\ No newline at end of file
diff --git a/inc/lang/de-informal/lang.php b/inc/lang/de-informal/lang.php
index 948a1ee51fb43b135873e9abe7ad3011981dfd2e..b7c4466564c7327652e734f39ad74cce85174733 100644
--- a/inc/lang/de-informal/lang.php
+++ b/inc/lang/de-informal/lang.php
@@ -17,6 +17,7 @@
  * @author Juergen Schwarzer <jschwarzer@freenet.de>
  * @author Marcel Metz <marcel_metz@gmx.de>
  * @author Matthias Schulte <post@lupo49.de>
+ * @author Christian Wichmann <nospam@zone0.de>
  */
 $lang['encoding']              = 'utf-8';
 $lang['direction']             = 'ltr';
@@ -49,7 +50,7 @@ $lang['btn_delete']            = 'Löschen';
 $lang['btn_back']              = 'Zurück';
 $lang['btn_backlink']          = 'Links hierher';
 $lang['btn_backtomedia']       = 'Zurück zur Dateiauswahl';
-$lang['btn_subscribe']         = 'Änderungen abonnieren';
+$lang['btn_subscribe']         = 'Aboverwaltung';
 $lang['btn_profile']           = 'Benutzerprofil';
 $lang['btn_reset']             = 'Zurücksetzen';
 $lang['btn_resendpwd']         = 'Sende neues Passwort';
@@ -107,27 +108,27 @@ $lang['js']['notsavedyet']     = 'Nicht gespeicherte Änderungen gehen verloren!
 $lang['js']['searchmedia']     = 'Suche nach Dateien';
 $lang['js']['keepopen']        = 'Fenster nach Auswahl nicht schließen';
 $lang['js']['hidedetails']     = 'Details ausblenden';
-$lang['js']['mediatitle']       = 'Link-Eigenschaften';
-$lang['js']['mediadisplay']     = 'Linktyp';
-$lang['js']['mediaalign']       = 'Ausrichtung';
-$lang['js']['mediasize']        = 'Bildgröße';
-$lang['js']['mediatarget']      = 'Linkziel';
-$lang['js']['mediaclose']       = 'Schließen';
-$lang['js']['mediainsert']      = 'Einfügen';
-$lang['js']['mediadisplayimg']  = 'Bild anzeigen.';
-$lang['js']['mediadisplaylnk']  = 'Nur den Link anzeigen.';
-$lang['js']['mediasmall']       = 'Kleine Version';
-$lang['js']['mediamedium']      = 'Mittelgroße Version';
-$lang['js']['medialarge']       = 'Große Version';
-$lang['js']['mediaoriginal']    = 'Original Version';
-$lang['js']['medialnk']         = 'Link zu der Detailseite';
-$lang['js']['mediadirect']      = 'Direkter Link zum Original';
-$lang['js']['medianolnk']       = 'Kein link';
-$lang['js']['medianolink']      = 'Keine Verlinkung des Bildes';
-$lang['js']['medialeft']        = 'Bild nach links ausrichten.';
-$lang['js']['mediaright']       = 'Bild nach rechts ausrichten.';
-$lang['js']['mediacenter']      = 'Bild in der Mitte ausrichten';
-$lang['js']['medianoalign']     = 'Keine Ausrichtung des Bildes.';
+$lang['js']['mediatitle']      = 'Link-Eigenschaften';
+$lang['js']['mediadisplay']    = 'Linktyp';
+$lang['js']['mediaalign']      = 'Ausrichtung';
+$lang['js']['mediasize']       = 'Bildgröße';
+$lang['js']['mediatarget']     = 'Linkziel';
+$lang['js']['mediaclose']      = 'Schließen';
+$lang['js']['mediainsert']     = 'Einfügen';
+$lang['js']['mediadisplayimg'] = 'Bild anzeigen.';
+$lang['js']['mediadisplaylnk'] = 'Nur den Link anzeigen.';
+$lang['js']['mediasmall']      = 'Kleine Version';
+$lang['js']['mediamedium']     = 'Mittelgroße Version';
+$lang['js']['medialarge']      = 'Große Version';
+$lang['js']['mediaoriginal']   = 'Original Version';
+$lang['js']['medialnk']        = 'Link zu der Detailseite';
+$lang['js']['mediadirect']     = 'Direkter Link zum Original';
+$lang['js']['medianolnk']      = 'Kein link';
+$lang['js']['medianolink']     = 'Keine Verlinkung des Bildes';
+$lang['js']['medialeft']       = 'Bild nach links ausrichten.';
+$lang['js']['mediaright']      = 'Bild nach rechts ausrichten.';
+$lang['js']['mediacenter']     = 'Bild in der Mitte ausrichten';
+$lang['js']['medianoalign']    = 'Keine Ausrichtung des Bildes.';
 $lang['js']['nosmblinks']      = 'Das Verlinken von Windows-Freigaben funktioniert nur im Microsoft Internet-Explorer.\nDer Link kann jedoch durch Kopieren und Einfügen verwendet werden.';
 $lang['js']['linkwiz']         = 'Link-Assistent';
 $lang['js']['linkto']          = 'Link zu:';
@@ -148,7 +149,6 @@ $lang['uploadsize']            = 'Die hochgeladene Datei war zu groß. (max. %s)
 $lang['deletesucc']            = 'Die Datei "%s" wurde gelöscht.';
 $lang['deletefail']            = '"%s" konnte nicht gelöscht werden. Keine  Berechtigung?.';
 $lang['mediainuse']            = 'Die Datei "%s" wurde nicht gelöscht. Sie wird noch verwendet.';
-$lang['mediainuse']            = 'Die Datei "%s" wurde nicht gelöscht. Sie wird noch verwendet.';
 $lang['namespaces']            = 'Namensräume';
 $lang['mediafiles']            = 'Vorhandene Dateien in';
 $lang['accessdenied']          = 'Du hast keinen Zugriff auf diese Seite';
@@ -225,22 +225,22 @@ $lang['img_copyr']             = 'Copyright';
 $lang['img_format']            = 'Format';
 $lang['img_camera']            = 'Kamera';
 $lang['img_keywords']          = 'Schlagwörter';
-$lang['subscr_subscribe_success']   = 'Die Seite %s wurde zur Abonnementenliste von %s hinzugefügt';
-$lang['subscr_subscribe_error']     = 'Fehler beim Hinzufügen von %s zur Abonnementenliste von %s';
+$lang['subscr_subscribe_success'] = 'Die Seite %s wurde zur Abonnementenliste von %s hinzugefügt';
+$lang['subscr_subscribe_error'] = 'Fehler beim Hinzufügen von %s zur Abonnementenliste von %s';
 $lang['subscr_subscribe_noaddress'] = 'In deinem Account ist keine E-Mail-Adresse hinterlegt. Dadurch kann die Seite nicht abonniert werden';
 $lang['subscr_unsubscribe_success'] = 'Die Seite %s wurde von der Abonnementenliste von %s entfernt';
-$lang['subscr_unsubscribe_error']   = 'Fehler beim Entfernen von %s von der Abonnementenliste von %s';
-$lang['subscr_already_subscribed']  = '%s ist bereits auf der Abonnementenliste von %s';
-$lang['subscr_not_subscribed']      = '%s ist nicht auf der Abonnementenliste von %s';
-$lang['subscr_m_not_subscribed']    = 'Du hast kein Abonnement von dieser Seite oder dem Namensraum.';
-$lang['subscr_m_new_header']        = 'Abonnementen hinzufügen';
-$lang['subscr_m_current_header']    = 'Aktive Abonnements';
-$lang['subscr_m_unsubscribe']       = 'Abbestellen';
-$lang['subscr_m_subscribe']         = 'Abonnieren';
-$lang['subscr_m_receive']           = 'Erhalten';
-$lang['subscr_style_every']         = 'E-Mail bei jeder Änderung';
-$lang['subscr_style_digest']        = 'E-Mail mit zusammengefasster Übersicht der Seitenänderungen (alle %.2f Tage)';
-$lang['subscr_style_list']          = 'Auflistung aller geänderten Seiten seit der letzten E-Mail (alle %.2f Tage)';
+$lang['subscr_unsubscribe_error'] = 'Fehler beim Entfernen von %s von der Abonnementenliste von %s';
+$lang['subscr_already_subscribed'] = '%s ist bereits auf der Abonnementenliste von %s';
+$lang['subscr_not_subscribed'] = '%s ist nicht auf der Abonnementenliste von %s';
+$lang['subscr_m_not_subscribed'] = 'Du hast kein Abonnement von dieser Seite oder dem Namensraum.';
+$lang['subscr_m_new_header']   = 'Abonnementen hinzufügen';
+$lang['subscr_m_current_header'] = 'Aktive Abonnements';
+$lang['subscr_m_unsubscribe']  = 'Abbestellen';
+$lang['subscr_m_subscribe']    = 'Abonnieren';
+$lang['subscr_m_receive']      = 'Erhalten';
+$lang['subscr_style_every']    = 'E-Mail bei jeder Änderung';
+$lang['subscr_style_digest']   = 'E-Mail mit zusammengefasster Übersicht der Seitenänderungen (alle %.2f Tage)';
+$lang['subscr_style_list']     = 'Auflistung aller geänderten Seiten seit der letzten E-Mail (alle %.2f Tage)';
 $lang['authmodfailed']         = 'Benutzerüberprüfung nicht möglich. Bitte wende dich an den Admin.';
 $lang['authtempfail']          = 'Benutzerüberprüfung momentan nicht möglich. Falls das Problem andauert, wende dich an den Admin.';
 $lang['i_chooselang']          = 'Wähle deine Sprache';
diff --git a/inc/lang/de-informal/subscr_digest.txt b/inc/lang/de-informal/subscr_digest.txt
index 9e943626c70dd3783d4850fc3b706e9c8931d144..f8cab210f7aa7d9baa4f6cc9a9c006528da0e383 100644
--- a/inc/lang/de-informal/subscr_digest.txt
+++ b/inc/lang/de-informal/subscr_digest.txt
@@ -1,7 +1,7 @@
 Hallo!
 
 Die Seite @PAGE@ im @TITLE@ Wiki wurde bearbeitet.
-Das sind die Änderungen:
+Üersicht der Änderungen:
 
 --------------------------------------------------------
 @DIFF@
@@ -10,10 +10,10 @@ Das sind die 
 Alte Revision: @OLDPAGE@
 Neue Revision: @NEWPAGE@
 
-Um das Abonnement für diese Seite aufzulösen, melde dich im Wiki an
+Um das Abonnement für diese Seite aufzulösen, melde dich im Wiki an
 @DOKUWIKIURL@, besuchen dann
 @SUBSCRIBE@
-und klicke auf den Link 'Änderungen abbestellen'.
+und klicke auf den Link 'Aboverwaltung'.
 
 --
 Diese Mail kommt vom DokuWiki auf
diff --git a/inc/lang/de-informal/subscr_single.txt b/inc/lang/de-informal/subscr_single.txt
index 3a295be7659f65c76ca4fc42f0bcd5e6fd2a2536..3c557bc17f616466ed18aa0ead9f0a04b3f6e5f9 100644
--- a/inc/lang/de-informal/subscr_single.txt
+++ b/inc/lang/de-informal/subscr_single.txt
@@ -1,22 +1,22 @@
 Hallo!
 
 Die Seite @PAGE@ im @TITLE@ Wiki wurde bearbeitet.
-Das sind die Änderungen:
+Übersicht der Änderungen:
 
 --------------------------------------------------------
 @DIFF@
 --------------------------------------------------------
 
-Datum : @DATE@
-Benutzer : @USER@
-Übersicht: @SUMMARY@
+Datum: @DATE@
+Benutzer: @USER@
+Zusammenfassung: @SUMMARY@
 Alte Revision: @OLDPAGE@
 Neue Revision: @NEWPAGE@
 
 Um das Abonnement für diese Seite aufzulösen, melde dich im Wiki an
-@DOKUWIKIURL@, besuchen dann
+@DOKUWIKIURL@, besuche dann
 @NEWPAGE@
-und klicke auf den Link 'Änderungen abbestellen'.
+und klicke auf den Link 'Aboverwaltung'.
 
 --
 Diese Mail kommt vom DokuWiki auf
diff --git a/inc/lang/de/lang.php b/inc/lang/de/lang.php
index dfd9a8eabc36680e3e02490b0c2713104c09b54e..a353b98ed22e9e99bfb637d5df87cf2472e51790 100644
--- a/inc/lang/de/lang.php
+++ b/inc/lang/de/lang.php
@@ -17,6 +17,8 @@
  * @author Blitzi94@gmx.de
  * @author Robert Bogenschneider <robog@GMX.de>
  * @author Robert Bogenschneider <robog@gmx.de>
+ * @author Niels Lange <niels@boldencursief.nl>
+ * @author Christian Wichmann <nospam@zone0.de>
  */
 $lang['encoding']              = 'utf-8';
 $lang['direction']             = 'ltr';
@@ -49,12 +51,12 @@ $lang['btn_delete']            = 'Löschen';
 $lang['btn_back']              = 'Zurück';
 $lang['btn_backlink']          = 'Links hierher';
 $lang['btn_backtomedia']       = 'Zurück zur Dateiauswahl';
-$lang['btn_subscribe']         = 'Änderungen abonnieren';
+$lang['btn_subscribe']         = 'Aboverwaltung';
 $lang['btn_profile']           = 'Benutzerprofil';
 $lang['btn_reset']             = 'Zurücksetzen';
 $lang['btn_resendpwd']         = 'Sende neues Passwort';
 $lang['btn_draft']             = 'Entwurf bearbeiten';
-$lang['btn_recover']           = 'Entwurf wieder herstellen';
+$lang['btn_recover']           = 'Entwurf wiederherstellen';
 $lang['btn_draftdel']          = 'Entwurf löschen';
 $lang['btn_revert']            = 'Wiederherstellen';
 $lang['loggedinas']            = 'Angemeldet als';
diff --git a/inc/lang/de/subscr_digest.txt b/inc/lang/de/subscr_digest.txt
index c8bf770eea04db27d95117bff9dccac0c1015ea1..7cc79bba20af7ab2574ca587151ee27aa0e8e9ac 100644
--- a/inc/lang/de/subscr_digest.txt
+++ b/inc/lang/de/subscr_digest.txt
@@ -1,7 +1,7 @@
 Hallo!
 
 Die Seite @PAGE@ im @TITLE@ Wiki wurde bearbeitet.
-Das sind die Änderungen:
+Übersicht der Änderungen:
 
 --------------------------------------------------------
 @DIFF@
@@ -13,7 +13,7 @@ Neue Revision: @NEWPAGE@
 Um das Abonnement für diese Seite aufzulösen, melden Sie sich im Wiki an
 @DOKUWIKIURL@, besuchen dann
 @SUBSCRIBE@
-und klicken auf den Link 'Änderungen abbestellen'.
+und klicken auf den Link 'Aboverwaltung'.
 
 --
 Diese Mail kommt vom DokuWiki auf
diff --git a/inc/lang/de/subscr_single.txt b/inc/lang/de/subscr_single.txt
index fb149e92762769ad8dd0850fe0cf41e91939452b..f3e1cd39358bf39bbe56de07ac60fcf816740998 100644
--- a/inc/lang/de/subscr_single.txt
+++ b/inc/lang/de/subscr_single.txt
@@ -1,22 +1,22 @@
 Hallo!
 
 Die Seite @PAGE@ im @TITLE@ Wiki wurde bearbeitet.
-Das sind die Änderungen:
+Übersicht der Änderungen:
 
 --------------------------------------------------------
 @DIFF@
 --------------------------------------------------------
 
-Datum : @DATE@
-Benutzer : @USER@
-Übersicht: @SUMMARY@
+Datum: @DATE@
+Benutzer: @USER@
+Zusammenfassung: @SUMMARY@
 Alte Revision: @OLDPAGE@
 Neue Revision: @NEWPAGE@
 
-Um das Abonnement für diese Seite aufzulösen, melde Sie sich im Wiki an
+Um das Abonnement für diese Seite aufzulösen, melden Sie sich im Wiki an
 @DOKUWIKIURL@, besuchen dann
 @NEWPAGE@
-und klicken auf die Taste 'Änderungen abbestellen'.
+und klicken auf die Taste 'Aboverwaltung'.
 
 --
 Diese Mail kommt vom DokuWiki auf
diff --git a/inc/lang/en/lang.php b/inc/lang/en/lang.php
index 5c890246c400268c8e8ac8df0e827e8709f4b142..9ccbe14e0d553e172acb8b64448ae6e45803f478 100644
--- a/inc/lang/en/lang.php
+++ b/inc/lang/en/lang.php
@@ -316,4 +316,4 @@ $lang['seconds'] = '%d seconds ago';
 $lang['wordblock'] = 'Your change was not saved because it contains blocked text (spam).';
 
 
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/inc/lang/et/lang.php b/inc/lang/et/lang.php
index ef540bb3db8fffb8728e5147f1494ec72fcd3b7b..ee765b5b54ee84513c1f69d7353703f306cfb6a4 100644
--- a/inc/lang/et/lang.php
+++ b/inc/lang/et/lang.php
@@ -211,4 +211,4 @@ $lang['js']['del_confirm']= 'Kas kustutame selle kirje?';
 #$lang['unsubscribe_success'] = '';
 #$lang['unsubscribe_error'] = '';
 
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/inc/lang/he/conflict.txt b/inc/lang/he/conflict.txt
index d27a78559f73151acd62190799025f580045d6c7..c1cccdfcf1aeee51cc19892e389f93a8da3f47aa 100644
--- a/inc/lang/he/conflict.txt
+++ b/inc/lang/he/conflict.txt
@@ -1,6 +1,6 @@
-====== גירסה עדכנית יותר של הקובץ קיימת ======
+====== קיימת גרסה עדכנית יותר של הקובץ ======
 
-גירסה עדכנית יותר של המסמך קיימת. דבר זה קורה כאשר משתמש אחר שינה את המסמך בזמן שערכת אותו.
+ישנה גרסה עדכנית יותר של המסמך. מצב כזה קורה כאשר משתמש אחר שינה את המסמך בזמן שערכת אותו.
 
-מומלץ לעיין בהבדלים תחת הודעה ולאחר מכן להחליט איזו גירסה כדאי לשמור. לחיצה על הכפתור "שמור" תשמור את הגרסה שערכת. לחיצה על הכפתור "בטל" תשמור את הגרסה הקיימת.
+מומלץ לעיין בהבדלים המופיעים להלן ולאחר מכן להחליט איזו גרסה כדאי לשמור. לחיצה על הכפתור "שמירה" תשמור את הגרסה שערכת. לחיצה על הכפתור "ביטול" תשמור את הגרסה הקיימת.
 
diff --git a/inc/lang/he/denied.txt b/inc/lang/he/denied.txt
index 34c8417b44f25369dba185ca4e3bb87713edd3b6..a366fc198f49f79a968f2f4a2a67036ed096d6d6 100644
--- a/inc/lang/he/denied.txt
+++ b/inc/lang/he/denied.txt
@@ -1,3 +1,3 @@
 ====== הרשאה נדחתה ======
 
-אנו מצטערים אך אין לך הרשאות מתאימות כדי להמשיך. אולי שכחת להכנס למערכת?
\ No newline at end of file
+אנו מצטערים אך אין לך הרשאות מתאימות כדי להמשיך. אולי שכחת להיכנס למערכת?
\ No newline at end of file
diff --git a/inc/lang/he/draft.txt b/inc/lang/he/draft.txt
index 22fc88d9f903382215a23f3fad89ae1ff6f19e37..b999cc18722eb612d5d001815b362f83c4989a37 100644
--- a/inc/lang/he/draft.txt
+++ b/inc/lang/he/draft.txt
@@ -1,5 +1,5 @@
-====== נמצא קובץ טיוטא ======
+====== נמצא קובץ טיוטה ======
 
-העריכה האחרונה שבוצעה לדף זה לא הסתימה כהלכה. DokuWiki שמר באופן אוטומטי טיוטה של העבודה ובאפשרותך להשתמש בה  כדי להמשיך את העריכה. ניתן לראות מטה את המידע שנשמר מהפעם הקודמת.
+העריכה האחרונה שבוצעה לדף זה לא הושלמה כראוי. DokuWiki שמר באופן אוטומטי טיוטה של העבודה ובאפשרותך להשתמש בה  כדי להמשיך את העריכה. ניתן לראות להלן את הנתונים שנשמרו מהפעם הקודמת.
 
 באפשרותך לבחור ב//שחזור הטיוטה// של אותה עריכה //מחיקת הטיוטה// או //ביטול// העריכה כליל.
\ No newline at end of file
diff --git a/inc/lang/he/edit.txt b/inc/lang/he/edit.txt
index 4d8151e9defd70b49eb828056d36a8a929cfc979..74b3cefeb52c91c8f755d3a8fae2aa897e92fce0 100644
--- a/inc/lang/he/edit.txt
+++ b/inc/lang/he/edit.txt
@@ -1 +1 @@
-עריכת הדף ולחיצה על הכפתור "שמור" תעדכן את תוכנו. מומלץ לעיין בדף ה[[wiki:syntax|תחביר]] כדי להכיר את כללי תחביר הויקי. נא לערוך את הדף רק אם הדבר נעשה כדי **לשפר** אותו. אם העריכה היא לצורך התנסות מומלץ לבקר ב[[playground:playground|ארגז החול]].
+עריכת הדף ולחיצה על הלחצן "שמירה" תעדכן את תוכנו. מומלץ לעיין בדף ה[[wiki:syntax|תחביר]] כדי להכיר את כללי תחביר הוויקי. נא לערוך את הדף רק אם הדבר נעשה כדי **לשפר** אותו. אם העריכה היא לצורך התנסות מומלץ לבקר ב[[playground:playground|ארגז החול]].
diff --git a/inc/lang/he/editrev.txt b/inc/lang/he/editrev.txt
index a6c755cba5f1d56e017dd34a28f4efa6153b52dd..e33001fa34177a4cf309eed56eed31307b22db41 100644
--- a/inc/lang/he/editrev.txt
+++ b/inc/lang/he/editrev.txt
@@ -1,2 +1,2 @@
-**הדף שנפתח הוא גרסה ישנה של המסמך!** לחיצה על הכפתור "שמור" תשחזר את המסמך לגרסה המוצגת כעת.
+**הדף שנפתח הוא גרסה ישנה של המסמך!** לחיצה על הלחצן "שמירה" תשחזר את המסמך לגרסה המוצגת כעת.
 ----
\ No newline at end of file
diff --git a/inc/lang/he/index.txt b/inc/lang/he/index.txt
index 12b7a960ebf3619ce088d6fb524b502a0d1a07b8..4b0623f84815cfd117a3ac446a84f0f29c42d4b9 100644
--- a/inc/lang/he/index.txt
+++ b/inc/lang/he/index.txt
@@ -1,4 +1,4 @@
-====== אינדקס ======
+====== מפת אתר ======
 
-זהו קובץ אינדקס הנמצא מעל לכל הדפים המאורגנים ב[[ויקי:דוקיוויקי]].
+זהו קובץ מפת אתר הנמצא מעל לכל הדפים המאורגנים ב[[ויקי:דוקיוויקי]].
 
diff --git a/inc/lang/he/install.html b/inc/lang/he/install.html
index 7831623c9388b0cd8b8724e32b043c4a990c56fa..3832fb5fba97beff2a188fa19416ba8ac6a75856 100644
--- a/inc/lang/he/install.html
+++ b/inc/lang/he/install.html
@@ -1,13 +1,13 @@
-<p>דף זה מסייע להתקנה וההגדרה הראשוניות של
-<a href="http://dokuwiki.org">Dokuwiki</a>. מידע נוסף על מתקין זה זמין בדף 
+<p>דף זה מסייע בהליכי ההתקנה וההגדרה הראשוניים של
+<a href="http://dokuwiki.org">Dokuwiki</a>. מידע נוסף על תכנית התקנה זו זמין בדף 
 <a href="http://dokuwiki.org/installer">התיעוד שלו</a>.</p>
 
-<p>DokuWiki עושה שימוש בקבצים רגילים לשמירת דפי ויקי ומידע נוסף הקשור לדפים אלו (לדוגמה תמונות, רשימות חיפוש, גרסאות קודמות וכו').
-לתפקוד תקין DokuWiki <strong>חייב</strong> גישה לכתיבה לתיקיות המכילות קבצים אלו. מתקין זה אינו יכול לקבוע הרשאות לתיקיות. 
-פעולה זו צריכה בד"כ להתבצע ישירות משורת הפקודה או במקרה שנעשה שימוש בשרת מארח דרך FTP או מנשק הניהול של המארח (cPanell לדוגמה).</p>
+<p>DokuWiki עושה שימוש בקבצים רגילים לשמירת דפי ויקי ומידע נוסף הקשור לדפים אלו (לדוגמה: תמונות, רשימות חיפוש, גרסאות קודמות וכו׳).
+לצורך תפקוד תקין DokuWiki <strong>חייב</strong> גישה לכתיבה לתיקיות המכילות קבצים אלו. תכנית התקנה זו אינה יכולה להגדיר הרשאות לתיקיות. 
+פעולה זו צריכה בד״כ להתבצע ישירות משורת הפקודה או במקרה שנעשה שימוש בשרת מארח דרך FTP או מנשק הניהול של המארח (cPanell לדוגמה).</p>
 
-<p>מתקין זה יגדיר את תצורת ה-<acronym title="access control list">ACL</acronym> ב-DokuWiki שלך
+<p>מתקין זה יגדיר את תצורת ה־<acronym title="access control list">ACL</acronym> ב-DokuWiki שלך
 , זה בתורו מאפשר גישת מנהל לתפריט הניהול של DokuWiki כדי להתקין הרחבות, לנהל משתמשים, לנהל גישות לדפי ויקי ושינויים בהגדרות התצורה.
-אין הוא הכרחי לתפקוד DokuWiki אך הוא יהפוך את Dokuwiki קל יותר לניהול.</p>
+אין הוא הכרחי לתפקוד DokuWiki אך הוא יהפוך את Dokuwiki לפשוט יותר לניהול.</p>
 
-<p>על משתמשים מנוסים או כאלו עם דרישות מיוחדות להתקנה להשתמש בקישורים אלו לפרטים בנוגע ל<a href="http://dokuwiki.org/install">הוראות התקנה</a> ו<a href="http://dokuwiki.org/config">הגדרות תצורה</a>.</p>
+<p>על משתמשים מנוסים או כאלו עם דרישות מיוחדות להתקנה להשתמש בקישורים אלו לפרטים בנוגע ל<a href="http://dokuwiki.org/install">הוראות התקנה</a> ול<a href="http://dokuwiki.org/config">הגדרות תצורה</a>.</p>
diff --git a/inc/lang/he/lang.php b/inc/lang/he/lang.php
index a411764d28278fcfa53ee7c5bf6a06179f761b76..47310d4d19d7e337d0e0dfb7bc42520ebedb6b49 100644
--- a/inc/lang/he/lang.php
+++ b/inc/lang/he/lang.php
@@ -10,6 +10,7 @@
  * @author Dotan Kamber <kamberd@yahoo.com>
  * @author Moshe Kaplan <mokplan@gmail.com>
  * @author Yaron Yogev <yaronyogev@gmail.com>
+ * @author Yaron Shahrabani <sh.yaron@gmail.com>
  */
 $lang['encoding']              = 'utf-8';
 $lang['direction']             = 'rtl';
@@ -18,132 +19,153 @@ $lang['doublequoteclosing']    = '”';
 $lang['singlequoteopening']    = '‘';
 $lang['singlequoteclosing']    = '’';
 $lang['apostrophe']            = '\'';
-$lang['btn_edit']              = 'עריכה';
-$lang['btn_source']            = 'הצג את מקור הדף';
-$lang['btn_show']              = 'הצג דף';
+$lang['btn_edit']              = 'עריכת דף זה';
+$lang['btn_source']            = 'הצגת מקור הדף';
+$lang['btn_show']              = 'הצגת דף';
 $lang['btn_create']            = 'יצירת דף';
-$lang['btn_search']            = 'חפש';
-$lang['btn_save']              = 'שמור';
+$lang['btn_search']            = 'חיפוש';
+$lang['btn_save']              = 'שמירה';
 $lang['btn_preview']           = 'תצוגה מקדימה';
-$lang['btn_top']               = 'חזור למעלה';
-$lang['btn_newer']             = '<< יותר חדש';
-$lang['btn_older']             = 'פחות חדש >>';
+$lang['btn_top']               = 'חזרה למעלה';
+$lang['btn_newer']             = '<<  חדש יותר';
+$lang['btn_older']             = 'פחות חדש  >>';
 $lang['btn_revs']              = 'גרסאות קודמות';
 $lang['btn_recent']            = 'שינויים אחרונים';
-$lang['btn_upload']            = 'העלה';
-$lang['btn_cancel']            = 'בטל';
-$lang['btn_index']             = 'אינדקס';
+$lang['btn_upload']            = 'העלאה';
+$lang['btn_cancel']            = 'ביטול';
+$lang['btn_index']             = 'מפת האתר';
 $lang['btn_secedit']           = 'עריכה';
 $lang['btn_login']             = 'כניסה';
 $lang['btn_logout']            = 'יציאה';
-$lang['btn_admin']             = 'מנהל';
-$lang['btn_update']            = 'עדכן';
-$lang['btn_delete']            = 'מחק';
-$lang['btn_back']              = 'חזור';
+$lang['btn_admin']             = 'ניהול';
+$lang['btn_update']            = 'עדכון';
+$lang['btn_delete']            = 'מחיקה';
+$lang['btn_back']              = 'חזרה';
 $lang['btn_backlink']          = 'קישורים לכאן';
-$lang['btn_backtomedia']       = 'לחזור לבחירת קובץ מדיה';
-$lang['btn_subscribe']         = 'עקוב אחרי שינוים';
-$lang['btn_unsubscribe']       = 'הפסק לעקוב';
-$lang['btn_subscribens']       = 'הרשמה לשינויים במרחב השם';
-$lang['btn_unsubscribens']     = 'הסרת הרשמה לשינויים במחב השם';
-$lang['btn_profile']           = 'עדכן פרופיל';
+$lang['btn_backtomedia']       = 'חזרה לבחירת קובץ מדיה';
+$lang['btn_subscribe']         = 'מעקב אחרי שינוים';
+$lang['btn_profile']           = 'עדכון הפרופיל';
 $lang['btn_reset']             = 'איפוס';
-$lang['btn_resendpwd']         = 'שלח סיסמה חדשה';
+$lang['btn_resendpwd']         = 'שליחת ססמה חדשה';
 $lang['btn_draft']             = 'עריכת טיוטה';
 $lang['btn_recover']           = 'שחזור טיוטה';
 $lang['btn_draftdel']          = 'מחיקת טיוטה';
-$lang['btn_revert']            = 'שחזר';
-$lang['loggedinas']            = 'רשום כ-';
+$lang['btn_revert']            = 'שחזור';
+$lang['loggedinas']            = 'נכנסת בשם';
 $lang['user']                  = 'שם משתמש';
-$lang['pass']                  = 'סיסמה';
-$lang['newpass']               = 'סיסמה חדשה';
-$lang['oldpass']               = 'אשר את הסיסמה הנוכחית';
-$lang['passchk']               = 'שוב';
-$lang['remember']              = 'זכור אותי';
+$lang['pass']                  = 'ססמה';
+$lang['newpass']               = 'ססמה חדשה';
+$lang['oldpass']               = 'אישור הססמה הנוכחית';
+$lang['passchk']               = 'פעם נוספת';
+$lang['remember']              = 'שמירת הפרטים שלי';
 $lang['fullname']              = 'שם מלא';
-$lang['email']                 = 'דוא"ל';
+$lang['email']                 = 'דוא״ל';
 $lang['register']              = 'הרשמה';
-$lang['profile']               = 'פרופיל';
-$lang['badlogin']              = 'סליחה, שם המשתמש או הסיסמה שגויים';
-$lang['minoredit']             = 'שינוים מינוריים';
-$lang['draftdate']             = 'טיוטה נשמרה ב-';
+$lang['profile']               = 'פרופיל המשתמש';
+$lang['badlogin']              = 'שם המשתמש או הססמה שגויים, עמך הסליחה';
+$lang['minoredit']             = 'שינוים מזעריים';
+$lang['draftdate']             = 'הטיוטה נשמרה אוטומטית ב־';
 $lang['nosecedit']             = 'הדף השתנה בינתיים, הקטע שערכת אינו מעודכן - העמוד כולו נטען במקום זאת.';
-$lang['regmissing']            = 'סליחה, עליך למלא את כל השדות';
-$lang['reguexists']            = 'סליחה, משתמש בשם זה כבר נרשם';
-$lang['regsuccess']            = 'הרשמה הצליחה, המשתמש נרשם והודעה נשלחה בדואר';
-$lang['regsuccess2']           = 'הרשמה הצליחה, המשתמש נרשם.';
-$lang['regmailfail']           = 'שליחת הודעת הדואר כשלה, נא ליצור קשר עם מנהל האתר';
-$lang['regbadmail']            = 'כתובת דואר כנראה לא תקפה, אם לא כך היא יש ליצור קשר עם מנהל האתר';
-$lang['regbadpass']            = 'שתי הסיסמות הן לא זהות, נא לנסות שוב';
-$lang['regpwmail']             = 'סיסמת הדוקוויקי שלך';
-$lang['reghere']               = 'עדיין ללא שם-משתמש? ההרשמה כאן';
+$lang['regmissing']            = 'עליך למלא את כל השדות, עמך הסליחה.';
+$lang['reguexists']            = 'משתמש בשם זה כבר נרשם, עמך הסליחה.';
+$lang['regsuccess']            = 'ההרשמה הצליחה, המשתמש נרשם והודעה נשלחה בדוא״ל.';
+$lang['regsuccess2']           = 'ההרשמה הצליחה, המשתמש נוצר.';
+$lang['regmailfail']           = 'שליחת הודעת הדוא״ל כשלה, נא ליצור קשר עם מנהל האתר!';
+$lang['regbadmail']            = 'יתכן כי כתובת הדוא״ל אינה תקפה, אם לא כך הדבר ליצור קשר עם מנהל האתר';
+$lang['regbadpass']            = 'שתי הססמאות אינן זהות זו לזו, נא לנסות שוב.';
+$lang['regpwmail']             = 'ססמת הדוקוויקי שלך';
+$lang['reghere']               = 'עדיין אין לך חשבון? ההרשמה כאן';
 $lang['profna']                = 'בוויקי הזה לא ניתן לשנות פרופיל';
-$lang['profnochange']          = 'אין שינוים, פרופיל לא עודכן';
-$lang['profnoempty']           = 'שם וכתובת דוא"ל לא יכולים להיות ריקים';
-$lang['profchanged']           = 'פרופיל עודכן בהצלחה';
-$lang['pwdforget']             = 'שכחת סיסמה? קבל חדשה';
-$lang['resendna']              = 'הוויקי הזה לא תומך בחידוש סיסמה';
-$lang['resendpwd']             = 'שלח סיסמה חדשה עבור';
-$lang['resendpwdmissing']      = 'סליחה, עליך למלא את כל השדות';
-$lang['resendpwdnouser']       = 'סליחה, משתמש בשם זה לא נמצא';
-$lang['resendpwdbadauth']      = 'סליחה, קוד אימות זה אינו תקף. יש לודא כי נעשה שימוש במלוא קישור האימות.';
-$lang['resendpwdconfirm']      = 'קישור אימות נשלח בדוא"ל.';
-$lang['resendpwdsuccess']      = 'סיסמה חדשה נשלחה בדואר';
-$lang['license']               = 'למעט מקרים בהם צוין אחרת, התוכן בוויקי זה זמין לפי הרשיון הבא:';
-$lang['licenseok']             = 'שים לב: עריכת דף זה מהווה הסכמה מצידך להצגת התוכן שהוספת לפי הרשיון הבא:';
-$lang['searchmedia']           = 'חפש שם קובץ:';
-$lang['txt_upload']            = 'בחר קובץ להעלות';
-$lang['txt_filename']          = 'הכנס שם לוויקי (בחירה)';
-$lang['txt_overwrt']           = 'לכתוב במקום קובץ קיים';
+$lang['profnochange']          = 'אין שינויים, הפרופיל לא עודכן';
+$lang['profnoempty']           = 'השם וכתובת הדוא״ל לא יכולים להיות ריקים';
+$lang['profchanged']           = 'הפרופיל עודכן בהצלחה';
+$lang['pwdforget']             = 'שכחת את הססמה שלך? ניתן לקבל חדשה';
+$lang['resendna']              = 'הוויקי הזה אינו תומך בחידוש ססמה';
+$lang['resendpwd']             = 'שליחת ססמה חדשה עבור';
+$lang['resendpwdmissing']      = 'עליך למלא את כל השדות, עמך הסליחה.';
+$lang['resendpwdnouser']       = 'משתמש בשם זה לא נמצא במסד הנתונים, עמך הסליחה.';
+$lang['resendpwdbadauth']      = 'קוד אימות זה אינו תקף. יש לוודא כי נעשה שימוש בקישור האימות המלא, עמך הסליחה.';
+$lang['resendpwdconfirm']      = 'נשלח קישור לאימות נשלח בדוא״ל.';
+$lang['resendpwdsuccess']      = 'נשלחה ססמה חדשה בדוא״ל';
+$lang['license']               = 'למעט מקרים בהם צוין אחרת, התוכן בוויקי זה זמין לפי הרישיון הבא:';
+$lang['licenseok']             = 'נא לשים לב: עריכת דף זה מהווה הסכמה מצדך להצגת התוכן שהוספת בהתאם הרישיון הבא:';
+$lang['searchmedia']           = 'חיפוש שם קובץ:';
+$lang['searchmedia_in']        = 'חיפוש תחת %s';
+$lang['txt_upload']            = 'בחירת קובץ להעלות';
+$lang['txt_filename']          = 'העלאה בשם (נתון לבחירה)';
+$lang['txt_overwrt']           = 'שכתוב על קובץ קיים';
 $lang['lockedby']              = 'נעול על ידי';
-$lang['lockexpire']            = 'נעילה פגה';
-$lang['willexpire']            = 'נעילה תחלוף עוד זמן קצר. \nלמניעת התנגשויות יש להשתמש בכפתור הרענון מטה כדי לאתחל את הנעילה שנית';
-$lang['js']['notsavedyet']     = "קיימים שינויים שטרם נשמרו ואשר יאבדו \n האם להמשיך?";
-$lang['rssfailed']             = 'כשל ב-RSS';
-$lang['nothingfound']          = 'לא נמצאו תוצאות';
-$lang['mediaselect']           = 'בחירת קובץ מדיה';
-$lang['fileupload']            = 'העלאת קובץ מדיה';
-$lang['uploadsucc']            = 'העלאת הקובץ בוצעה בהצלחה';
-$lang['uploadfail']            = 'קרתה שגיאה בעת העלאת הקובץ. תיתכן ובעייה זו נוצרה עקב הרשאות שגיות.';
-$lang['uploadwrong']           = 'העלאה לא אושרה. קבצים בסיומת זו אסורים';
-$lang['uploadexist']           = 'הקובץ כבר קיים. פעולה בוטלה';
+$lang['lockexpire']            = 'הנעילה פגה';
+$lang['willexpire']            = 'הנעילה תחלוף עוד זמן קצר. \nלמניעת התנגשויות יש להשתמש בכפתור הרענון מטה כדי לאפס את מד משך הנעילה.';
+$lang['js']['notsavedyet']     = 'שינויים שלא נשמרו ילכו לאיבוד.';
+$lang['js']['searchmedia']     = 'חיפוש אחר קבצים';
+$lang['js']['keepopen']        = 'השארת חלון פתוח על הבחירה';
+$lang['js']['hidedetails']     = 'הסתרת פרטים';
+$lang['js']['mediatitle']      = 'הגדרות הקישור';
+$lang['js']['mediadisplay']    = 'סוג הקישור';
+$lang['js']['mediaalign']      = 'יישור';
+$lang['js']['mediasize']       = 'גודל התמונה';
+$lang['js']['mediatarget']     = 'יעד הקישור';
+$lang['js']['mediaclose']      = 'סגירה';
+$lang['js']['mediainsert']     = 'הוספה';
+$lang['js']['mediadisplayimg'] = 'הצגת התמונה.';
+$lang['js']['mediadisplaylnk'] = 'הצגת הקישור בלבד.';
+$lang['js']['mediasmall']      = 'גרסה קטנה';
+$lang['js']['mediamedium']     = 'גרסה בינונית';
+$lang['js']['medialarge']      = 'גרסה גדולה';
+$lang['js']['mediaoriginal']   = 'הגרסה המקורית';
+$lang['js']['medialnk']        = 'קישור לעמוד הפרטים';
+$lang['js']['mediadirect']     = 'הקישור הישיר למקור';
+$lang['js']['medianolnk']      = 'אין קישור';
+$lang['js']['medianolink']     = 'אין לקשר לתמונה';
+$lang['js']['medialeft']       = 'יישור התמונה לשמאל.';
+$lang['js']['mediaright']      = 'יישור התמונה לימין.';
+$lang['js']['mediacenter']     = 'מרכוז התמונה.';
+$lang['js']['medianoalign']    = 'לא להשתמש ביישור.';
+$lang['js']['nosmblinks']      = 'קישור לכונני שיתוף של Windows עובד רק באמצעות Microsoft Internet Explorer.
+עדיין ניתן להעתיק ולהדביק את הקישור.';
+$lang['js']['linkwiz']         = 'אשף הקישורים';
+$lang['js']['linkto']          = 'קישור אל:';
+$lang['js']['del_confirm']     = 'באמת למחוק?';
+$lang['js']['mu_btn']          = 'העלאת מספר קבצים יחד';
+$lang['rssfailed']             = 'אירע כשל בעת קבלת הזנה זו:';
+$lang['nothingfound']          = 'לא נמצאו תוצאות.';
+$lang['mediaselect']           = 'קובצי מדיה';
+$lang['fileupload']            = 'העלאת קובצי מדיה';
+$lang['uploadsucc']            = 'ההעלאה הושלמה בהצלחה';
+$lang['uploadfail']            = 'אירעה שגיאה בעת העלאת הקובץ. היתכן שתקלה זו נוצרה עקב הרשאות שגיות?';
+$lang['uploadwrong']           = 'ההעלאה לא אושרה. קבצים בסיומת זו אסורים!';
+$lang['uploadexist']           = 'הקובץ כבר קיים. הפעולה בוטלה.';
 $lang['uploadbadcontent']      = 'התוכן שהועלה לא תאם את הסיומת %s של הקובץ.';
-$lang['uploadspam']            = 'ההעלאה נחסמה על ידי הרשימה השחורה של הספאם.';
+$lang['uploadspam']            = 'ההעלאה נחסמה על ידי רשימת חסימת הספאם.';
 $lang['uploadxss']             = 'ההעלאה נחסמה בשל חשד לתוכן זדוני.';
-$lang['uploadsize']            = 'הקובץ שהועלה היה גדול מדי. (מקסימום %s)';
-$lang['deletesucc']            = 'קובץ %s נמחק';
-$lang['deletefail']            = 'לא יכולתי למחוק "%s" -- בדקו הרשאות';
-$lang['mediainuse']            = 'קובץ "%s" לא נמחק - הוא עדיין בשימוש';
+$lang['uploadsize']            = 'הקובץ שהועלה היה גדול מדי. (%s לכל היותר)';
+$lang['deletesucc']            = 'הקובץ %s נמחק.';
+$lang['deletefail']            = 'לא ניתן למחוק את "%s" -- נא לבדוק את ההרשאות.';
+$lang['mediainuse']            = 'הקובץ "%s" לא נמחק - הוא עדיין בשימוש.';
 $lang['namespaces']            = 'שמות מתחם';
-$lang['mediafiles']            = 'קבצים זמינים ב-';
-$lang['js']['searchmedia']     = 'חיפוש קבצים';
-$lang['js']['keepopen']        = 'השאר חלון פתוח בבחירה';
-$lang['js']['hidedetails']     = 'הסתר פרטים';
-$lang['js']['nosmblinks']      = ':( קישור למערכת קבצים של חלונות פועל רק בדפדפן אינטרנט אקספלורר.
- זה בסדר, אין צורך לעבור. אפשר להעתיק ולהדביק את הקישור';
-$lang['js']['linkwiz']         = 'אשף הקישורים';
-$lang['js']['linkto']          = 'קשר אל:';
-$lang['js']['del_confirm']     = 'באמת למחוק?';
-$lang['js']['mu_btn']          = 'העלאת קבצים מרובים';
-$lang['mediausage']            = 'השתמש בתחביר הבא להתיחסות אל קובץ זה:';
-$lang['mediaview']             = 'הצג את הקובץ המקורי';
+$lang['mediafiles']            = 'קבצים זמינים תחת';
+$lang['accessdenied']          = 'אין לך הרשאה לצפות בדף זה.';
+$lang['mediausage']            = 'יש להשתמש בתחביר הבא כדי להפנות לקובץ זה:';
+$lang['mediaview']             = 'הצגת  הקובץ המקורי';
 $lang['mediaroot']             = 'root';
-$lang['mediaupload']           = 'כאן ניתן להעלות קובץ למרחב השמות הנוכחי. ליצירת תתי-מרחבי שמות צרפם ב-"העלה" לתחילת שם הקובץ מופרדים בפסיקים';
-$lang['mediaextchange']        = 'סיומת הקובץ השתנתה מ-.%s ל-.%s!';
-$lang['reference']             = 'קישורים ל';
+$lang['mediaupload']           = 'כאן ניתן להעלות קובץ למרחב השם הנוכחי. ליצירת תת־מרחבי שם יש לצרף אותם לתחילת שם הקובץ, מופרדים בפסיקים, בשם הקובץ תחת "העלאה בתור".';
+$lang['mediaextchange']        = 'סיומת הקובץ השתנתה מ־‎.%s ל־‎.%s!';
+$lang['reference']             = 'הפניות אל';
 $lang['ref_inuse']             = 'לא ניתן למחוק קובץ זה, כיוון שהדפים הבאים עדיין משתמשים בו:';
-$lang['ref_hidden']            = 'יש קישורים לדפים ללא הרשאת קריאה';
-$lang['hits']                  = 'פגיעות';
-$lang['quickhits']             = 'דפים שנמצאו';
+$lang['ref_hidden']            = 'חלק מההפניות נמצאות בדפים שאין לך הרשאות לקרוא אותם';
+$lang['hits']                  = 'ביקורים';
+$lang['quickhits']             = 'שמות דפים שנמצאו';
 $lang['toc']                   = 'תוכן עניינים';
-$lang['current']               = 'גירסה נוכחית';
+$lang['current']               = 'הגרסה הנוכחית';
 $lang['yours']                 = 'הגרסה שלך';
-$lang['diff']                  = 'הצג שינוים מגרסה זו ועד הנוכחית';
+$lang['diff']                  = 'הצגת שינוים מגרסה זו ועד הנוכחית';
 $lang['diff2']                 = 'הצגת הבדלים בין הגרסאות שנבחרו';
+$lang['difflink']              = 'קישור לתצוגה השוואה זו';
 $lang['line']                  = 'שורה';
 $lang['breadcrumb']            = 'ביקורים אחרונים';
-$lang['youarehere']            = 'אתה נמצא כאן';
-$lang['lastmod']               = 'שונה לאחרונה ב';
+$lang['youarehere']            = 'זהו מיקומך';
+$lang['lastmod']               = 'מועד השינוי האחרון';
 $lang['by']                    = 'על ידי';
 $lang['deleted']               = 'נמחק';
 $lang['created']               = 'נוצר';
@@ -151,9 +173,10 @@ $lang['restored']              = 'שוחזר';
 $lang['external_edit']         = 'עריכה חיצונית';
 $lang['summary']               = 'תקציר העריכה';
 $lang['noflash']               = '<a href="http://www.adobe.com/products/flashplayer/">תוסף פלאש לדפדפן</a> נדרש כדי להציג תוכן זה.';
-$lang['download']              = 'הורד מקטע';
+$lang['download']              = 'הורדת מקטע';
 $lang['mail_newpage']          = 'דף נוסף:';
 $lang['mail_changed']          = 'דף שונה:';
+$lang['mail_subscribe_list']   = 'דפים שהשתנו במרחב השם:';
 $lang['mail_new_user']         = 'משתמש חדש:';
 $lang['mail_upload']           = 'קובץ הועלה:';
 $lang['qb_bold']               = 'טקסט מודגש';
@@ -167,7 +190,7 @@ $lang['qb_h3']                 = 'כותרת רמה 3';
 $lang['qb_h4']                 = 'כותרת רמה 4';
 $lang['qb_h5']                 = 'כותרת רמה 5';
 $lang['qb_h']                  = 'כותרת';
-$lang['qb_hs']                 = 'בחירת כותרת';
+$lang['qb_hs']                 = 'כותרת נבחרת';
 $lang['qb_hplus']              = 'כותרת ברמה גבוהה יותר';
 $lang['qb_hminus']             = 'כותרת ברמה נמוכה יותר';
 $lang['qb_hequal']             = 'כותרת באותה רמה';
@@ -175,73 +198,85 @@ $lang['qb_link']               = 'קישור פנימי';
 $lang['qb_extlink']            = 'קישור חיצוני';
 $lang['qb_hr']                 = 'קו אופקי';
 $lang['qb_ol']                 = 'איבר ברשימה ממוספרת';
-$lang['qb_ul']                 = 'אבר ברשימה לא ממוספרת';
-$lang['qb_media']              = 'תמונות או קובץ אחר';
-$lang['qb_sig']                = 'הזנת חתימה';
-$lang['qb_smileys']            = 'פרצופונים';
-$lang['qb_chars']              = 'סימנים מיוחדים';
-$lang['upperns']               = 'עבור למרחב השם שברמה שמעל הנוכחית';
-$lang['admin_register']        = 'להוסיף משתמש חדש';
-$lang['metaedit']              = 'ערוך נתונים';
-$lang['metasaveerr']           = 'כשל בשמירת נתונים';
-$lang['metasaveok']            = 'נתונים נשמרו';
-$lang['img_backto']            = 'הזור ל';
-$lang['img_title']             = 'כותרת';
-$lang['img_caption']           = 'תיאור';
+$lang['qb_ul']                 = 'איבר ברשימה לא ממוספרת';
+$lang['qb_media']              = 'תמונות וקבצים אחרים';
+$lang['qb_sig']                = 'הוספת חתימה';
+$lang['qb_smileys']            = 'חייכנים';
+$lang['qb_chars']              = 'תווים מיוחדים';
+$lang['upperns']               = 'מעבר למרחב השם שברמה שמעל הנוכחית';
+$lang['admin_register']        = 'הוספת משתמש חדש';
+$lang['metaedit']              = 'עריכת נתוני העל';
+$lang['metasaveerr']           = 'אירע כשל בשמירת נתוני העל';
+$lang['metasaveok']            = 'נתוני העל נשמרו';
+$lang['img_backto']            = 'חזרה אל';
+$lang['img_title']             = 'שם';
+$lang['img_caption']           = 'כותרת';
 $lang['img_date']              = 'תאריך';
 $lang['img_fname']             = 'שם הקובץ';
 $lang['img_fsize']             = 'גודל';
 $lang['img_artist']            = 'צלם';
-$lang['img_copyr']             = 'זכויות';
-$lang['img_format']            = 'פורמט';
+$lang['img_copyr']             = 'זכויות יוצרים';
+$lang['img_format']            = 'מבנה';
 $lang['img_camera']            = 'מצלמה';
 $lang['img_keywords']          = 'מילות מפתח';
-$lang['subscribe_success']     = '%s נוסף לרשימת המכותבים עבור %s';
-$lang['subscribe_error']       = 'שגיאה בהוספת %s לרשימת המכותבים עבור %s';
-$lang['subscribe_noaddress']   = 'אין כתובת המשויכת לרישום שלך ולכן אין באפשרותך להצטרף לרשימת המכותבים';
-$lang['unsubscribe_success']   = '%s הוסר מרשימת המכותבים עבור %s';
-$lang['unsubscribe_error']     = 'שגיאה בהסרת %s מרשימת המכותבים עבור %s';
-$lang['authmodfailed']         = 'תצורת אימות משתמשים גרועה. נא לדווח למנהל הויקי.';
-$lang['authtempfail']          = 'אימות משתמשים אינו זמין כרגע. אם מצב זה נמשך נא להודיע למנהל הויקי.';
+$lang['subscr_subscribe_success'] = '%s נוסף לרשימת המינויים לדף %s';
+$lang['subscr_subscribe_error'] = 'אירעה שגיאה בהוספת %s לרשימת המינויים לדף %s';
+$lang['subscr_subscribe_noaddress'] = 'אין כתובת המשויכת עם הכניסה שלך, נא ניתן להוסיף אותך לרשימת המינויים';
+$lang['subscr_unsubscribe_success'] = 'המשתמש %s הוסר מרשימת המינויים לדף %s';
+$lang['subscr_unsubscribe_error'] = 'אירעה שגיאה בהסרת %s מרשימת המינויים לדף %s';
+$lang['subscr_already_subscribed'] = 'המשתמש %s כבר מנוי לדף %s';
+$lang['subscr_not_subscribed'] = 'המשתמש %s איננו רשום לדף %s';
+$lang['subscr_m_not_subscribed'] = 'המשתמש שלך אינו רשום, נכון לעכשיו, לדף הנוכחי או למרחב השם.';
+$lang['subscr_m_new_header']   = 'הוספת מינוי';
+$lang['subscr_m_current_header'] = 'המינויים הנוכחיים';
+$lang['subscr_m_unsubscribe']  = 'ביטול המינוי';
+$lang['subscr_m_subscribe']    = 'מינוי';
+$lang['subscr_m_receive']      = 'קבלת';
+$lang['subscr_style_every']    = 'דוא״ל עם כל שינוי';
+$lang['subscr_style_digest']   = 'הודעת דוא״ל המציגה את כל השינויים בכל עמוד (בכל %.2f ימים)';
+$lang['subscr_style_list']     = 'רשימת השינויים בדפים מאז הודעת הדוא״ל האחרונה (בכל %.2f ימים)';
+$lang['authmodfailed']         = 'תצורת אימות המשתמשים אינה תקינה. נא ליידע את מנהל הוויקי.';
+$lang['authtempfail']          = 'אימות משתמשים אינו זמין כרגע. אם מצב זה נמשך נא ליידע את מנהל הוויקי.';
 $lang['i_chooselang']          = 'נא לבחור שפה';
-$lang['i_installer']           = 'DokuWiki Installer';
-$lang['i_wikiname']            = 'שם הויקי';
-$lang['i_enableacl']           = 'אפשר ACL (מומלץ)';
-$lang['i_superuser']           = 'משתמש-על';
-$lang['i_problems']            = 'המתקין זיהה מספר בעיות המצוינות מטה. אין באפשרותך להמשיך לפני תיקונן.';
-$lang['i_modified']            = 'משיקולי אבטחה תסריט זה יעבוד אך ורק עם התקנת DokuWiki חדשה שלא עברה כל שינוי.
-                         עליך לחלץ שנית את הקבצים מהחבילה שהורדה או להעזר בדף
+$lang['i_installer']           = 'תכנית ההתקנה של DokuWiki';
+$lang['i_wikiname']            = 'שם הוויקי';
+$lang['i_enableacl']           = 'הפעלת ACL (מומלץ)';
+$lang['i_superuser']           = 'משתמש־על';
+$lang['i_problems']            = 'תכנית ההתקנה זיהתה מספר בעיות המפורטות להלן. אין באפשרותך להמשיך לפני תיקונן.';
+$lang['i_modified']            = 'משיקולי אבטחה סקריפט זה יעבוד אך ורק עם התקנת DokuWiki חדשה שלא עברה כל שינוי.
+                         עליך לחלץ שנית את הקבצים מהחבילה שהורדה או להיעזר בדף
                          <a href="http://dokuwiki.org/install">Dokuwiki installation instructions</a>';
-$lang['i_funcna']              = 'פונקצית ה-PHP <code>%s</code> אינה זמינה. יתכן כי מארח האתר חסם אותה מסיבה כלשהי?';
-$lang['i_phpver']              = 'גרסת ה-PHP שלך <code>%s</code> נמוכה מהדרוש. עליך לשדרג את התקנת ה-PHP';
-$lang['i_permfail']            = '<code>%s</code> אינה ברת כתיבה על ידי DokuWiki. עליך לשנות הרשאות ספריה זו!';
+$lang['i_funcna']              = 'פונקציית ה-PHP&rlm; <code>%s</code> אינה זמינה. יתכן כי מארח האתר חסם אותה מסיבה כלשהי?';
+$lang['i_phpver']              = 'גרסת ה־PHP שלך <code>%s</code> נמוכה מהדרוש. עליך לשדרג את התקנת ה־PHP שלך.';
+$lang['i_permfail']            = '<code>%s</code> אינה ניתנת לכתיבה על ידי DokuWiki. עליך לשנות הרשאות תיקייה זו!';
 $lang['i_confexists']          = '<code>%s</code> כבר קיים';
-$lang['i_writeerr']            = 'אין אפשרות ליצור את <code>%s</code>. נא לבדוק את הרשאות הקובץ/ספריה וליצור את הקובץ ידנית.';
-$lang['i_badhash']             = 'קובץ Dokuwiki.php לא מזוהה או שעבר שינויים (hash=<code>%s</code>)';
-$lang['i_badval']              = '<code>%s</code> - ערך לא חוקי או ריק';
-$lang['i_success']             = 'ההגדרה הסתימה בהצלחה. באפשרותך למחוק עתה את הקובץ install.php ולהמשיך אל <a href="doku.php">DokuWiki החדש שלך</a>.';
-$lang['i_failure']             = 'מספר שגיאות ארעו בעת כתיבת קבצי התצורה. ייתכן כי יהיה צורך לתקנם ידנית לפני שניתן יהיה להשתמש ב<a href="doku.php">DokuWiki החדש שלך</a>.';
-$lang['i_policy']              = 'מדיניות ACL תחילית';
+$lang['i_writeerr']            = 'אין אפשרות ליצור את <code>%s</code>. נא לבדוק את הרשאות הקובץ/תיקייה וליצור את הקובץ ידנית.';
+$lang['i_badhash']             = 'הקובץ Dokuwiki.php אינו מזוהה או שעבר שינויים (hash=<code>%s</code>)';
+$lang['i_badval']              = '<code>%s</code> - הערך אינו חוקי או ריק';
+$lang['i_success']             = 'תהליך ההגדרה הסתיים בהצלחה. כעת ניתן למחוק את הקובץ install.php ולהמשיך אל ה־<a href="doku.php">DokuWiki החדש שלך</a>.';
+$lang['i_failure']             = 'מספר שגיאות אירעו בעת כתיבת קובצי התצורה. יתכן כי יהיה צורך לתקנם ידנית לפני שניתן יהיה להשתמש ב־<a href="doku.php">DokuWiki החדש שלך</a>.';
+$lang['i_policy']              = 'מדיניות ACL התחלתית';
 $lang['i_pol0']                = 'ויקי פתוח (קריאה, כתיבה והעלאה לכולם)';
 $lang['i_pol1']                = ' ויקי ציבורי (קריאה לכולם, כתיבה והעלאה למשתמשים רשומים)';
 $lang['i_pol2']                = 'ויקי סגור (קריאה, כתיבה והעלאה למשתמשים רשומים בלבד)';
-$lang['i_retry']               = 'נסיון נוסף';
-$lang['mu_intro']              = 'כאן תוכל להעלות קבצים מרובים. לחץ על כפתור החיפוש להוסיף אותם למחסנית. לחץ על העלאה לסיום.';
-$lang['mu_gridname']           = 'שם קובץ';
+$lang['i_retry']               = 'ניסיון נוסף';
+$lang['i_license']             = 'נא לבחור את הרישיון שיחול על התוכן שבוויקי שלך:';
+$lang['mu_intro']              = 'דרך כאן ניתן להעלות מספר קבצים בבת אחת. יש ללחוץ על לחצן החיפוש להוסיף אותם למחסנית. ניתן ללחוץ על העלאה לסיום.';
+$lang['mu_gridname']           = 'שם הקובץ';
 $lang['mu_gridsize']           = 'גודל';
-$lang['mu_gridstat']           = 'סטאטןס';
+$lang['mu_gridstat']           = 'מצב';
 $lang['mu_namespace']          = 'מרחב שם';
 $lang['mu_browse']             = 'חיפוש';
 $lang['mu_toobig']             = 'גדול מדי';
-$lang['mu_ready']              = 'מוכן להעלאה';
-$lang['mu_done']               = 'סיים';
+$lang['mu_ready']              = 'בהמתנה להעלאה';
+$lang['mu_done']               = 'הסתיים';
 $lang['mu_fail']               = 'נכשל';
-$lang['mu_authfail']           = 'תקוף נעילת עריכה פג';
+$lang['mu_authfail']           = 'תוקף ההפעלה פג';
 $lang['mu_progress']           = '@PCT@% הועלה';
 $lang['mu_filetypes']          = 'סוגי קבצים מורשים';
 $lang['mu_info']               = 'הקבצים הועלו';
 $lang['mu_lasterr']            = 'שגיאה אחרונה:';
-$lang['recent_global']         = 'אתה צופה כעת בשינויים בתוך מרחב השם <b>%s</b>. אתה יכול גם <a href="%s">לצפות בשינויים האחרונים של כל הוויקי </a>.';
+$lang['recent_global']         = 'נכון לעכשיו מתנהל על ידיך מעקב אחר מרחב השם <b>%s</b>. כמו כן, באפשרותך <a href="%s">לצפות בשינויים האחרונים בוויקי כולו</a>.';
 $lang['years']                 = 'לפני %d שנים';
 $lang['months']                = 'לפני %d חודשים';
 $lang['weeks']                 = 'לפני %d שבועות';
@@ -249,3 +284,4 @@ $lang['days']                  = 'לפני %d ימים';
 $lang['hours']                 = 'לפני %d שעות';
 $lang['minutes']               = 'לפני %d דקות';
 $lang['seconds']               = 'לפני %d שניות';
+$lang['wordblock']             = 'השינויים שלך לא נשמרו כיוון שהם מכילים טקסט חסום (ספאם).';
diff --git a/inc/lang/he/mailtext.txt b/inc/lang/he/mailtext.txt
index d7990b2b36da745e5063e49aab0e3c110782424d..222ee1b6d06e1463d22d2bd61aaaa5ef3ca881f9 100644
--- a/inc/lang/he/mailtext.txt
+++ b/inc/lang/he/mailtext.txt
@@ -1,17 +1,17 @@
-דף בDokuWiki נוסף או שונה. הנה הפרטים:
+דף בDokuWiki נוסף או שונה. להלן הפרטים:
 
-Date        : @DATE@
-Browser     : @BROWSER@
-IP-Address  : @IPADDRESS@
-Hostname    : @HOSTNAME@
-Old Revision: @OLDPAGE@
-New Revision: @NEWPAGE@
-Edit Summary: @SUMMARY@
-User        : @USER@
+תאריך        : @DATE@
+דפדפן     : @BROWSER@
+כתובת ה־IP&rlm;  : @IPADDRESS@
+שם המארח    : @HOSTNAME@
+המהדורה הישנה: @OLDPAGE@
+המהדורה החדשה: @NEWPAGE@
+תקציר העריכה: @SUMMARY@
+משתמש        : @USER@
 
 @DIFF@
 
 -- 
 
-דף זה נוצר ע"י DokuWiki ב-
+דף זה נוצר ע״י ה־DokuWiki הזמין בכתובת
 @DOKUWIKIURL@
diff --git a/inc/lang/he/password.txt b/inc/lang/he/password.txt
index 29742ebda7539f7d970c6c768407b3933b54bff2..745c5cb5ccf246ce2666c6d69bfb3adc3919ed0f 100644
--- a/inc/lang/he/password.txt
+++ b/inc/lang/he/password.txt
@@ -1,10 +1,10 @@
 שלום @FULLNAME@!
 
-הנה נתוני המשתמש שלך עבור @TITLE@ ב- @DOKUWIKIURL@
+הנה נתוני המשתמש שלך עבור @TITLE@ ב־@DOKUWIKIURL@
 
-כניסה     : @LOGIN@
-סיסמה     : @PASSWORD@
+שם כניסה     : @LOGIN@
+ססמה     : @PASSWORD@
 
 -- 
-מכתב זה נוצר על ידי דוקוויקי ב-
+מכתב זה נוצר על ידי ה־DokuWiki הזמין בכתובת
 @DOKUWIKIURL@
\ No newline at end of file
diff --git a/inc/lang/he/pwconfirm.txt b/inc/lang/he/pwconfirm.txt
index 255195c7f34904a05634fb0bcf7e68021911407b..7dc46c340a208371f9ced213403ffb198d7f3433 100644
--- a/inc/lang/he/pwconfirm.txt
+++ b/inc/lang/he/pwconfirm.txt
@@ -1,13 +1,13 @@
 שלום @FULLNAME@!
 
-מישהו ביקש סיסמה חדשה עבור הכניסה שלך ל-@TITLE@ ב-@DOKUWIKIURL@
+מישהו ביקש ססמה חדשה עבור שם הכניסה שלך לוויקי @TITLE@ בכתובת @DOKUWIKIURL@
 
-אם לא ביקשת סיסמה חדשה פשוט התעלם מדוא"ל זה.
+אם לא ביקשת ססמה חדשה באפשרותך פשוט להתעלם מהודעת דוא״ל זו.
 
-כדי לאשר שהבקשה באמת נשלחה על ידך נא השתמש בקישור הבא.
+כדי לאשר שהבקשה באמת נשלחה על ידך עליך השתמש בקישור הבא.
 
 @CONFIRM@
 
 -- 
-דואר זה נוצר על ידי DokuWiki ב-
+הודעת דוא״ל זו נוצרה על ידי ה־DokuWiki הזמין בכתובת
 @DOKUWIKIURL@
diff --git a/inc/lang/he/read.txt b/inc/lang/he/read.txt
index 8e4c177ee6d98e81bab1429c98cb85a6aac24d5c..18efc5e03b7bc5efc289ba8790ee93df47573dd0 100644
--- a/inc/lang/he/read.txt
+++ b/inc/lang/he/read.txt
@@ -1,2 +1,2 @@
-דף זה הוא דף לקריאה בלבד. ניתן לצפות בקוד המקור שלו, אבל לא ניתן לערוך אותו. ניתן לפנות אל מנהל הויקי אם לדעתך נפלה טעות.
+דף זה הוא דף לקריאה בלבד. ניתן לצפות בקוד המקור שלו, אך לא ניתן לערוך אותו. ניתן לפנות למנהל הוויקי אם לדעתך נפלה טעות.
 
diff --git a/inc/lang/he/register.txt b/inc/lang/he/register.txt
index 7225b02fd1db8a9c157111f66f0fcdb68439a04d..c4dfad7524a4a1768586c66a1c5e8fd72d48b0d8 100644
--- a/inc/lang/he/register.txt
+++ b/inc/lang/he/register.txt
@@ -1,3 +1,3 @@
 ====== הרשמה כמשתמש חדש ======
 
-יש למלא את כל המידע מטה כדי ליצור חשבון חדש בויקי זה. יש לודא כי מוזנת **כתובת דוא"ל תקפה**- סיסמתך החדשה תשלח לכתובת זו\\ על שם המשתמש להיות [[hdoku>ויקי:שם דף|שם דף]] תקף.
+יש למלא את כל המידע להלן כדי ליצור חשבון חדש בוויקי זה. עליך לוודא כי הזנת **כתובת דוא״ל תקפה**- ססמתך החדשה תשלח לכתובת זו. על שם המשתמש להיות [[hdoku>ויקי:שם דף|שם דף]] תקף.
diff --git a/inc/lang/he/registermail.txt b/inc/lang/he/registermail.txt
index bb64a815823da1876fe1ac4833821590344b55fb..3edca3fa0326c41ceb8bb0931f8da6934991e469 100644
--- a/inc/lang/he/registermail.txt
+++ b/inc/lang/he/registermail.txt
@@ -1,14 +1,14 @@
-משתמש חדש נרשם. הנה הפרטים:
+משתמש חדש נרשם. להלן הפרטים:
 
 שם משתמש   : @NEWUSER@
 שם מלא     : @NEWNAME@
-דוא"ל      : @NEWEMAIL@
+דוא״ל      : @NEWEMAIL@
 
 תאריך      : @DATE@
 דפדפן      : @BROWSER@
-כתובת רשת  : @IPADDRESS@
-שם המחשב   : @HOSTNAME@
+כתובת IP&rlm;  : @IPADDRESS@
+שם המארח   : @HOSTNAME@
 
 -- 
-דוא"ל זה נוצר על ידי DokuWiki ב-
+הודעת דוא״ל זו נוצרה על ידי ה־DokuWiki הזמין בכתובת
 @DOKUWIKIURL@
diff --git a/inc/lang/he/resendpwd.txt b/inc/lang/he/resendpwd.txt
index 47e7749c2e1ed75bf7963ca18f6e498ab9bde5ff..8ca27207bd6ba898694922b86cf6cce1ff48d364 100644
--- a/inc/lang/he/resendpwd.txt
+++ b/inc/lang/he/resendpwd.txt
@@ -1,4 +1,4 @@
-====== שליחת סיסמה חדשה ======
+====== שליחת ססמה חדשה ======
 
-יש להזין את שם המשתמש בטופס מטה ולבקש סיסמה חדשה לחשבון שלך בויקי זה. קישור לאימות ישלח לכתובת הדו"ל איתה נרשמת.
+יש להזין את שם המשתמש בטופס מטה ולבקש ססמה חדשה לחשבון שלך בוויקי זה. הקישור לאימות יישלח לכתובת הדוא״ל באמצעותה נרשמת.
 
diff --git a/inc/lang/he/subscr_digest.txt b/inc/lang/he/subscr_digest.txt
new file mode 100644
index 0000000000000000000000000000000000000000..af5220229b9e8774d93f4957c7f72ede5f557f90
--- /dev/null
+++ b/inc/lang/he/subscr_digest.txt
@@ -0,0 +1,20 @@
+שלום!
+
+הדף @PAGE@ שבאתר הוויקי @TITLE@ השתנה.
+להלן השינויים:
+
+--------------------------------------------------------
+@DIFF@
+--------------------------------------------------------
+
+המהדורה הישנה: @OLDPAGE@
+המהדורה החדשה: @NEWPAGE@
+
+כדי לבטל את ההתרעות לשינויי העמוד, יש להיכנס לאתר הוויקי בכתובת
+@DOKUWIKIURL@ ואז לבקר באגף
+@SUBSCRIBE@
+ולבטל את המינוי לשינויים בדף ו/או במרחב השם.
+
+--
+הודעת דוא״ל זו נוצרה על ידי ה־DokuWiki שבכתובת
+@DOKUWIKIURL@
\ No newline at end of file
diff --git a/inc/lang/he/subscr_single.txt b/inc/lang/he/subscr_single.txt
new file mode 100644
index 0000000000000000000000000000000000000000..123b186c83de19f03686efb53b7cd5950f829fd7
--- /dev/null
+++ b/inc/lang/he/subscr_single.txt
@@ -0,0 +1,22 @@
+שלום!
+
+הדף @PAGE@ באתר הוויקי @TITLE@ השתנה.
+
+--------------------------------------------------------
+@DIFF@
+--------------------------------------------------------
+
+תאריך : @DATE@
+משתמש : @USER@
+תקציר העריכה: @SUMMARY@
+המהדורה הישנה: @OLDPAGE@
+המהדורה החדשה: @NEWPAGE@
+
+לביטול התרעות בנוגע לעמוד, יש להיכנס לאתר הוויקי בכתובת
+@DOKUWIKIURL@ ואז לבקר בדף
+@NEWPAGE@
+ולבטל את המינוי לקבלת שינויים בדף ו/או במרחב השם.
+
+--
+הודעת דוא״ל זו נוצרה על ידי ה־DokuWiki הזמין בכתובת
+@DOKUWIKIURL@
\ No newline at end of file
diff --git a/inc/lang/km/lang.php b/inc/lang/km/lang.php
index 19847674d98d3cfa998033815e21a18d5b31c25c..3519a484ef7ad8f943ec05e0187194f01ec8c213 100644
--- a/inc/lang/km/lang.php
+++ b/inc/lang/km/lang.php
@@ -227,4 +227,4 @@ $lang['i_pol2']       = 'វីគីបិទជិត';
 
 $lang['i_retry']      = 'ម្តងទៀត';
 
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/inc/lang/ko/adminplugins.txt b/inc/lang/ko/adminplugins.txt
new file mode 100644
index 0000000000000000000000000000000000000000..5312cf357eccc4e3e0a505268d2b4103b191a53f
--- /dev/null
+++ b/inc/lang/ko/adminplugins.txt
@@ -0,0 +1 @@
+===== 부가적인 플러그인 =====
\ No newline at end of file
diff --git a/inc/lang/ko/edit.txt b/inc/lang/ko/edit.txt
index d73f935fee0dda831afae481042e87ffe2aa34d4..9b59524f72c5719fea85e91a97211cdc33ef8e30 100644
--- a/inc/lang/ko/edit.txt
+++ b/inc/lang/ko/edit.txt
@@ -1,2 +1,2 @@
-페이지를 편집하고 **저장**을 누르십시오.  위키 구문은 [[wiki:syntax]] 혹은 [[syntax|(한글) 구문]]을 참고하십시오. 이 페이지를 **더 낫게 만들 자신이 있을** 때에만 편집하십시오. 실험을 하고 싶을 때에는, 먼저 [[playground:playground|연습장]] 에 가서 연습해 보십시오.
+페이지를 편집하고 **저장**을 누르십시오.  위키 구문은 [[wiki:syntax]] 혹은 [[wiki:ko_syntax|(한글) 구문]]을 참고하십시오. 이 페이지를 **더 낫게 만들 자신이 있을** 때에만 편집하십시오. 실험을 하고 싶을 때에는, 먼저 [[playground:playground|연습장]] 에 가서 연습해 보십시오.
 
diff --git a/inc/lang/ko/lang.php b/inc/lang/ko/lang.php
index 83014c151b60357a453d144eff52771d342c64a9..3765dd0114b912faa9e010d61c428e9f068c3992 100644
--- a/inc/lang/ko/lang.php
+++ b/inc/lang/ko/lang.php
@@ -8,6 +8,7 @@
  * @author dongnak@gmail.com
  * @author Song Younghwan <purluno@gmail.com>
  * @author SONG Younghwan <purluno@gmail.com>
+ * @author Seung-Chul Yoo  <dryoo@live.com>
  */
 $lang['encoding']              = 'utf-8';
 $lang['direction']             = 'ltr';
@@ -41,15 +42,13 @@ $lang['btn_back']              = '뒤로';
 $lang['btn_backlink']          = '이전 링크';
 $lang['btn_backtomedia']       = '미디어 파일 선택으로 돌아가기';
 $lang['btn_subscribe']         = '구독 신청';
-$lang['btn_unsubscribe']       = '구독 신청 해지';
-$lang['btn_subscribens']       = '네임스페이스 구독 신청';
-$lang['btn_unsubscribens']     = '네임스페이스 구독 신청 해지';
 $lang['btn_profile']           = '개인정보 변경';
 $lang['btn_reset']             = '초기화';
 $lang['btn_resendpwd']         = '새 패스워드 보내기';
 $lang['btn_draft']             = '문서초안 편집';
 $lang['btn_recover']           = '문서초안 복구';
 $lang['btn_draftdel']          = '문서초안 삭제';
+$lang['btn_revert']            = '복원';
 $lang['loggedinas']            = '다음 사용자로 로그인';
 $lang['user']                  = '사용자';
 $lang['pass']                  = '패스워드';
@@ -88,13 +87,45 @@ $lang['resendpwdconfirm']      = '확인 링크를 이메일로 보냈습니다.
 $lang['resendpwdsuccess']      = '새로운 패스워드는 이메일로 보내드립니다.';
 $lang['license']               = '이 위키의 내용은 다음의 라이센스에 따릅니다 :';
 $lang['licenseok']             = '주의 : 이 페이지를 수정한다는 다음의 라이센스에 동의함을 의미합니다 :';
+$lang['searchmedia']           = '파일이름 찾기:';
+$lang['searchmedia_in']        = ' %에서 검색';
 $lang['txt_upload']            = '업로드 파일을 선택합니다.';
 $lang['txt_filename']          = '업로드 파일 이름을 입력합니다.(선택 사항)';
 $lang['txt_overwrt']           = '새로운 파일로 이전 파일을 교체합니다.';
 $lang['lockedby']              = '현재 잠금 사용자';
 $lang['lockexpire']            = '잠금 해제 시간';
 $lang['willexpire']            = '잠시 후 편집 잠금이 해제됩니다.\n편집 충돌을 피하려면 미리보기를 눌러 잠금 시간을 다시 설정하기 바랍니다.';
-$lang['js']['notsavedyet']     = "저장하지 않은 변경은 지워집니다.\n계속하시겠습니까?";
+$lang['js']['notsavedyet']     = '저장하지 않은 변경은 지워집니다.
+계속하시겠습니까?';
+$lang['js']['searchmedia']     = '파일 찾기';
+$lang['js']['keepopen']        = '선택할 때 윈도우를 열어놓으시기 바랍니다.';
+$lang['js']['hidedetails']     = '자세한 정보 감추기';
+$lang['js']['mediatitle']      = '링크 설정';
+$lang['js']['mediadisplay']    = '링크 형태';
+$lang['js']['mediaalign']      = '배치';
+$lang['js']['mediasize']       = '그림 크기';
+$lang['js']['mediatarget']     = '링크 목표';
+$lang['js']['mediaclose']      = '닫기';
+$lang['js']['mediainsert']     = '삽입';
+$lang['js']['mediadisplayimg'] = '그림보기';
+$lang['js']['mediasmall']      = '작게';
+$lang['js']['mediamedium']     = '중간';
+$lang['js']['medialarge']      = '크게';
+$lang['js']['mediaoriginal']   = '원본';
+$lang['js']['medialnk']        = '세부정보페이지로 링크';
+$lang['js']['mediadirect']     = '원본으로 직접 링크';
+$lang['js']['medianolnk']      = '링크 없슴';
+$lang['js']['medianolink']     = '그림을 링크하지 않음';
+$lang['js']['medialeft']       = '왼쪽 배치';
+$lang['js']['mediaright']      = '오른쪽 배치';
+$lang['js']['mediacenter']     = '중앙 배치';
+$lang['js']['medianoalign']    = '배치 없슴';
+$lang['js']['nosmblinks']      = '윈도우 공유 파일과의 연결은 MS 인터넷 익스플로러에서만 동작합니다.
+그러나 링크를 복사하거나 붙여넣기를 할 수 있습니다.';
+$lang['js']['linkwiz']         = '링크 마법사';
+$lang['js']['linkto']          = '다음으로 연결:';
+$lang['js']['del_confirm']     = '정말로 선택된 항목(들)을 삭제하시겠습니까?';
+$lang['js']['mu_btn']          = '여러 파일들을 한번에 업로드합니다.';
 $lang['rssfailed']             = 'feed 가져오기 실패: ';
 $lang['nothingfound']          = '아무 것도 없습니다.';
 $lang['mediaselect']           = '미디어 파일 선택';
@@ -112,11 +143,7 @@ $lang['deletefail']            = '"%s" 파일을 삭제할 수 없습니다. - 
 $lang['mediainuse']            = '"%s" 파일을 삭제할 수 없습니다. - 아직 사용 중입니다.';
 $lang['namespaces']            = '네임스페이스';
 $lang['mediafiles']            = '사용 가능한 파일 목록';
-$lang['js']['keepopen']        = '선택할 때 윈도우를 열어놓으시기 바랍니다.';
-$lang['js']['hidedetails']     = '자세한 정보 감추기';
-$lang['js']['nosmblinks']      = '윈도우 공유 파일과의 연결은 MS 인터넷 익스플로러에서만 동작합니다.
-그러나 링크를 복사하거나 붙여넣기를 할 수 있습니다.';
-$lang['js']['mu_btn']          = '여러 파일들을 한번에 업로드합니다.';
+$lang['accessdenied']          = '이 페이지를 볼 권한이 없습니다.';
 $lang['mediausage']            = '이 파일을 참조하려면 다음 문법을 사용하기 바랍니다:';
 $lang['mediaview']             = '원본 파일 보기';
 $lang['mediaroot']             = '루트(root)';
@@ -143,8 +170,10 @@ $lang['restored']              = '옛 버전 복구';
 $lang['external_edit']         = '외부 편집기';
 $lang['summary']               = '편집 요약';
 $lang['noflash']               = '이 컨텐츠를 표시하기 위해서 <a href="http://www.adobe.com/products/flashplayer/">Adobe Flash Plugin</a>이 필요합니다.';
+$lang['download']              = '조각 다운로드';
 $lang['mail_newpage']          = '페이지 추가:';
 $lang['mail_changed']          = '페이지 변경:';
+$lang['mail_subscribe_list']   = '네임스페이스에서 변경된 페이지:';
 $lang['mail_new_user']         = '새로운 사용자:';
 $lang['mail_upload']           = '파일 첨부:';
 $lang['qb_bold']               = '굵은 글';
@@ -157,6 +186,11 @@ $lang['qb_h2']                 = '2단계 헤드라인';
 $lang['qb_h3']                 = '3단계 헤드라인';
 $lang['qb_h4']                 = '4단계 헤드라인';
 $lang['qb_h5']                 = '5단계 헤드라인';
+$lang['qb_h']                  = '표제';
+$lang['qb_hs']                 = '표제 선택';
+$lang['qb_hplus']              = '상위 표제';
+$lang['qb_hminus']             = '하위 표제';
+$lang['qb_hequal']             = '동급 표제';
 $lang['qb_link']               = '내부 링크';
 $lang['qb_extlink']            = '외부 링크';
 $lang['qb_hr']                 = '수평선';
@@ -166,7 +200,7 @@ $lang['qb_media']              = '이미지와 기타 파일 추가';
 $lang['qb_sig']                = '서명 추가';
 $lang['qb_smileys']            = '이모티콘';
 $lang['qb_chars']              = '특수문자';
-$lang['js']['del_confirm']           = '정말로 선택된 항목(들)을 삭제하시겠습니까?';
+$lang['upperns']               = '상위 네임스페이스로 이동';
 $lang['admin_register']        = '새로운 사용자 추가';
 $lang['metaedit']              = '메타 데이타를 편집합니다.';
 $lang['metasaveerr']           = '메타 데이타 쓰기가 실패했습니다.';
@@ -182,11 +216,16 @@ $lang['img_copyr']             = '저작권';
 $lang['img_format']            = '포맷';
 $lang['img_camera']            = '카메라';
 $lang['img_keywords']          = '키워드';
-$lang['subscribe_success']     = '%s를 추가했습니다. (%s의 구독 목록)';
-$lang['subscribe_error']       = '%s를 추가하는데 실패했습니다.(%s의 구독 목록)';
-$lang['subscribe_noaddress']   = '로그인 정보에 이메일 주소가 없습니다, 구독 목록에 추가할 수 없습니다.';
-$lang['unsubscribe_success']   = '%s를 제외시켰습니다. (%s의 구독 목록)';
-$lang['unsubscribe_error']     = '%s를 제외시키는데 실패했습니다.(%s의 구독 목록)';
+$lang['subscr_subscribe_noaddress'] = '등록된 주소가 없기 때문에 구독목록에 등록되지 않았습니다.';
+$lang['subscr_m_not_subscribed'] = '현재의 페이지나 네임스페이스에 구독등록이 되어있지 않습니다.';
+$lang['subscr_m_new_header']   = '구독 추가';
+$lang['subscr_m_current_header'] = '현재 구독중인 것들';
+$lang['subscr_m_unsubscribe']  = '구독 취소';
+$lang['subscr_m_subscribe']    = '구독';
+$lang['subscr_m_receive']      = '받기';
+$lang['subscr_style_every']    = '모든 변화를 이메일로 받기';
+$lang['subscr_style_digest']   = '각 페이지의 변화를 요약 (매 %.2f 일 마다)';
+$lang['subscr_style_list']     = '마지막 이메일 이후 변화된 페이지의 목록 (매 %.2f 일 마다)';
 $lang['authmodfailed']         = '잘못된 사용자 인증 설정입니다. 관리자에게 문의하기 바랍니다.';
 $lang['authtempfail']          = '사용자 인증이 일시적으로 불가능합니다. 만일 계속해서 문제가 발생하면 관리자에게 문의하기 바랍니다.';
 $lang['i_chooselang']          = '사용하는 언어를 선택합니다.';
@@ -213,6 +252,7 @@ $lang['i_pol0']                = '개방형 위키 (누구나 읽기/쓰기/업
 $lang['i_pol1']                = '공개형 위키 (누구나 읽을 수 있지만, 등록된 사용자만 쓰기/업로드가 가능합니다.)';
 $lang['i_pol2']                = '폐쇄형 위키 (등록된 사용자만 읽기/쓰기/업로드가 가능합니다.)';
 $lang['i_retry']               = '다시 시도';
+$lang['i_license']             = '내용의 배포를 위한 라이센스를 선택하세요.';
 $lang['mu_intro']              = '여러 파일을 한번에 업로드할 수 있습니다. 파일 목록에 추가하려면 "찾기" 버튼을 클릭합니다. 파일 목록 추가 작업이 끝나면 "업로드" 버튼을 클릭하기 바랍니다. ';
 $lang['mu_gridname']           = '파일명';
 $lang['mu_gridsize']           = '크기';
@@ -226,4 +266,14 @@ $lang['mu_fail']               = '업로드가 실패했습니다.';
 $lang['mu_authfail']           = '세션 기간이 종료되었습니다.';
 $lang['mu_progress']           = '@PCT@% 업로드되었습니다.';
 $lang['mu_filetypes']          = '허용된 파일타입';
+$lang['mu_info']               = '업로드 되었습니다.';
+$lang['mu_lasterr']            = '마지막 에러:';
 $lang['recent_global']         = '<b>%s</b> 네임스페이스를 구독중입니다. <a href="%s">전체위키 변경사항 </a>도 보실수 있습니다.';
+$lang['years']                 = '%d ë…„ ì „';
+$lang['months']                = '%d 개월 전';
+$lang['weeks']                 = '%d 주 전';
+$lang['days']                  = '%d 일 전';
+$lang['hours']                 = '%d 시간 전';
+$lang['minutes']               = '%d ë¶„ ì „';
+$lang['seconds']               = '%d ì´ˆ ì „';
+$lang['wordblock']             = '스팸 문구를 포함하고 있어서 저장되지 않았습니다.';
diff --git a/inc/lang/ko/register.txt b/inc/lang/ko/register.txt
index 999073a1d2de1cb97bfcefd914849e300dbe796d..24105efebc36cfe6967d7b9ba709060acb32063c 100644
--- a/inc/lang/ko/register.txt
+++ b/inc/lang/ko/register.txt
@@ -1,4 +1,4 @@
 ====== 새 사용자 등록 ======
 
-이 위키에 새 계정을 만들려면 아래의 모든 내용을 입력하십시오. **제대로 된 이메일 주소**를 사용하십시오. 그러나, 아래 내용을 입력했다고 해서 계정을 만들 수 있으리라고는 믿지 마십시오.  이곳은 내가 개인적으로 사용하는 곳이며, 계정을 만들어 주고 안주고는 내 마음입니다. 차라리, 내게 이메일을 보내서 신청하는 편이 더 나을 것입니다. 패스워드는 이 이메일로 보내집니다. 사용자명은 올바른 [[doku>pagename|pagename]] 이어야 합니다.
+이 위키에 새 계정을 만들려면 아래의 모든 내용을 입력하세요. **제대로 된 이메일 주소**를 사용하세요. 암호를 입력하는 곳이 없다면 암호는 이 이메일로 보내집니다. 사용자명은 올바른 [[doku>pagename|pagename]] 이어야 합니다.
 
diff --git a/inc/lang/ko/subscr_digest.txt b/inc/lang/ko/subscr_digest.txt
new file mode 100644
index 0000000000000000000000000000000000000000..2e9c87848de7c38770bca65358c8d046ad64ccc0
--- /dev/null
+++ b/inc/lang/ko/subscr_digest.txt
@@ -0,0 +1,18 @@
+안녕하세요!
+
+@TITLE@ 라는 제목의 페이지 @PAGE@ 가 변경되었습니다.
+
+변경사항은 다음과 같습니다:
+
+--------------------------------------------------------
+@DIFF@
+--------------------------------------------------------
+
+옛날 것: @OLDPAGE@
+새 것: @NEWPAGE@
+
+이 페이지 변경알림의 설정을 바구려면, @DOKUWIKIURL@에 로그인한 뒤 
+@SUBSCRIBE@ 를 방문하여 페이지나 이름공간의 구독을 취소하세요.
+
+--
+@DOKUWIKIURL@의 DokuWiki가 자동으로 만들어낸 메일입니다.
\ No newline at end of file
diff --git a/inc/lang/ko/subscr_form.txt b/inc/lang/ko/subscr_form.txt
new file mode 100644
index 0000000000000000000000000000000000000000..31470f3723f1192809b2cd809f8a68811b465606
--- /dev/null
+++ b/inc/lang/ko/subscr_form.txt
@@ -0,0 +1,3 @@
+====== 구독 관리 ======
+
+이 페이지는 현재의 페이지와 네임스페이스의 구독을 관리할 수있도록 해줍니다.
\ No newline at end of file
diff --git a/inc/lang/ko/subscr_list.txt b/inc/lang/ko/subscr_list.txt
new file mode 100644
index 0000000000000000000000000000000000000000..2661a6a15ca8730cd3bd527f04b58562db9c7810
--- /dev/null
+++ b/inc/lang/ko/subscr_list.txt
@@ -0,0 +1,15 @@
+안녕하세요!
+
+@TITLE@ 라는 제목의 페이지 @PAGE@ 가 변경되었습니다.
+
+변경사항은 다음과 같습니다:
+
+--------------------------------------------------------
+@DIFF@
+--------------------------------------------------------
+
+이 페이지 변경알림의 설정을 바구려면, @DOKUWIKIURL@에 로그인한 뒤 
+@SUBSCRIBE@ 를 방문하여 페이지나 이름공간의 구독을 취소하세요.
+
+--
+@DOKUWIKIURL@의 DokuWiki가 자동으로 만들어낸 메일입니다.
\ No newline at end of file
diff --git a/inc/lang/ko/subscr_single.txt b/inc/lang/ko/subscr_single.txt
new file mode 100644
index 0000000000000000000000000000000000000000..1aa4d7efa6d80e704feae445953bb41faf1c4d34
--- /dev/null
+++ b/inc/lang/ko/subscr_single.txt
@@ -0,0 +1,21 @@
+안녕하세요!
+
+@TITLE@ 라는 제목의 페이지 @PAGE@ 가 변경되었습니다.
+
+변경사항은 다음과 같습니다:
+
+--------------------------------------------------------
+@DIFF@
+--------------------------------------------------------
+
+날짜 : @DATE@
+사용자 : @USER@
+편집 요약 : @SUMMARY@
+구 버전 : @OLDPAGE@
+새 버전 : @NEWPAGE@
+
+이 페이지 변경알림의 설정을 바구려면, @DOKUWIKIURL@에 로그인한 뒤 t
+@NEWPAGE@ 를 방문하여 페이지나 이름공간의 구독을 취소하세요.
+
+--
+@DOKUWIKIURL@의 DokuWiki가 자동으로 만들어낸 메일입니다.
\ No newline at end of file
diff --git a/inc/lang/ku/lang.php b/inc/lang/ku/lang.php
index cb8dd0865460502095673176b2378f2d5e1eb564..0ff2ca4ca675f14f2e2cb65a84d2dd9132caac18 100644
--- a/inc/lang/ku/lang.php
+++ b/inc/lang/ku/lang.php
@@ -160,4 +160,4 @@ $lang['subscribe_noaddress']= 'There is no address associated with your login, y
 $lang['unsubscribe_success']= 'Removed %s from subscription list for %s';
 $lang['unsubscribe_error']  = 'Error removing %s from subscription list for %s';
 
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/inc/lang/la/conflict.txt b/inc/lang/la/conflict.txt
index 3d1f66ab630e5b47584475d242d30519ad9b1049..aebc38b25a3bce91bc841b2562bd0164142dd685 100644
--- a/inc/lang/la/conflict.txt
+++ b/inc/lang/la/conflict.txt
@@ -1,5 +1,5 @@
-====== Recentior uersio est ======
+====== Recentior forma est ======
 
-Recentior uersio est: nam dum hanc paginam recensibas, aliquis paginam mutauit.
+Recentior forma est: nam dum hanc paginam recensibas, aliquis paginam mutauit.
 
-Discrimina uides et uersionem seruandam eligis. Alia uersio delebitur.
\ No newline at end of file
+Discrimina uides et formam seruandam eligis. Alia forma delebitur.
\ No newline at end of file
diff --git a/inc/lang/la/editrev.txt b/inc/lang/la/editrev.txt
index bac047d3131a35414295e4108f346770cc7c4fc0..6a4d082cc8d646461e5b1aee084a2a9682426585 100644
--- a/inc/lang/la/editrev.txt
+++ b/inc/lang/la/editrev.txt
@@ -1,2 +1,2 @@
-**Vetus uersio a te restituta est** Si hanc uersionem seruabis, nouam creabis.
+**Vetus forma a te restituta est** Si hanc formam seruabis, nouam creabis.
 ----
\ No newline at end of file
diff --git a/inc/lang/la/index.txt b/inc/lang/la/index.txt
index eb6f06f79943cebb34ce630f63d4151be262bedd..cd65dbb59f20cfb760d6aabaf9cced98629d4d1f 100644
--- a/inc/lang/la/index.txt
+++ b/inc/lang/la/index.txt
@@ -1,3 +1,3 @@
 ====== Forma Situs ======
 
-Haec forma situs ordinata a(b) [[doku>namespaces|namespaces]].
\ No newline at end of file
+Haec forma situs ordinata [[doku>namespaces|generatim]].
\ No newline at end of file
diff --git a/inc/lang/la/install.html b/inc/lang/la/install.html
new file mode 100644
index 0000000000000000000000000000000000000000..c06f3ac2c2c420c480520271641d34f7363ab455
--- /dev/null
+++ b/inc/lang/la/install.html
@@ -0,0 +1,8 @@
+<p>Haec pagina te adiuuat in <a href="http://dokuwiki.org">Dokuuiki</a> conformando. Maiores res in 
+<a href="http://dokuwiki.org/installer">hac pagina</a> sunt.</p>
+
+<p>DokuWiki documenta ut omnes paginas uicis et omnia (ut imagines, indices, ueteres formas) quae ad easdem pertinent colligat. Vt bene operet DokuWiki omnes facultates scrini habere <strong>debes</strong>. Hoc instrumentum facultates eligere  non potest, his facultatibus locatori spati interretis quaeras uel FTP intrumento uel aliis rebus (ut cPanel) uteraris.</p>
+
+<p>Hoc intrumentum optiones primae DokuWiki <acronym title="index custodiae ,aditus">ICA</acronym>, quos rectori situs inire et indicem, ut addenda optiones uicis et alia administrare possit uidere licet. Hoc instrumentum non necessarium DokuWiki ut feliciter operet, sed melius administrare adiuuat.</p>
+
+<p>Periti uel qui certa quaesita habet paginas <a href="http://dokuwiki.org/install">rationis conformandum uicem</a> et <a href="http://dokuwiki.org/config">optionum conformationis</a> uidere possunt.</p>
\ No newline at end of file
diff --git a/inc/lang/la/lang.php b/inc/lang/la/lang.php
index 49ae67c31afab029e29832e452d65a88002a0552..ec80ac4d1ef0aed8eaf73f08363cf9eeab5e0cf8 100644
--- a/inc/lang/la/lang.php
+++ b/inc/lang/la/lang.php
@@ -8,6 +8,7 @@
  * lines starting with @author
  *
  * @url http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/languages/messages/MessagesLa.php?view=co
+ * @author Massimiliano Vassalli <vassalli.max@gmail.com>
  */
 $lang['encoding']              = 'utf-8';
 $lang['direction']             = 'ltr';
@@ -19,9 +20,9 @@ $lang['apostrophe']            = '´';
 $lang['btn_edit']              = 'Recensere hanc paginam';
 $lang['btn_source']            = 'Fontem uidere';
 $lang['btn_show']              = 'Ostendere paginam';
-$lang['btn_create']            = 'Facere paginam';
+$lang['btn_create']            = 'Creare paginam';
 $lang['btn_search']            = 'Quaerere';
-$lang['btn_save']              = 'Seruare paginam';
+$lang['btn_save']              = 'Seruare';
 $lang['btn_preview']           = 'Praeuidere';
 $lang['btn_top']               = 'I ad summa';
 $lang['btn_newer']             = '<< recentiores';
@@ -39,7 +40,7 @@ $lang['btn_update']            = 'Nouare';
 $lang['btn_delete']            = 'Delere';
 $lang['btn_back']              = 'Redire';
 $lang['btn_backlink']          = 'Nexus ad paginam';
-$lang['btn_backtomedia']       = 'Ad medias redire';
+$lang['btn_backtomedia']       = 'Ad media redire';
 $lang['btn_subscribe']         = 'Custodire';
 $lang['btn_profile']           = 'Tabellam nouare';
 $lang['btn_reset']             = 'Abrogare';
@@ -55,14 +56,14 @@ $lang['newpass']               = 'Tessera noua';
 $lang['oldpass']               = 'Tessera uetus:';
 $lang['passchk']               = 'Tesseram tuam adfirmare';
 $lang['remember']              = 'Tesseram meam sodalitatis memento';
-$lang['fullname']              = 'Nomen tuum uerum:';
+$lang['fullname']              = 'Nomen tuom uerum:';
 $lang['email']                 = 'Cursus interretialis:';
 $lang['register']              = 'Te adscribere';
 $lang['profile']               = 'Tabella Sodalis';
-$lang['badlogin']              = 'Error in ineundo est.';
-$lang['minoredit']             = 'Haec est recensio minor';
+$lang['badlogin']              = 'Error in ineundo est, rectum nomen uel tessera cedo.';
+$lang['minoredit']             = 'Recensio minor';
 $lang['draftdate']             = 'Propositum seruatur die:';
-$lang['nosecedit']             = 'Pagina interea mutatur, pars rerum exiit.';
+$lang['nosecedit']             = 'Pagina interea mutatur, pars rerum exiit, in loco eius tota pagina reclamata est.';
 $lang['regmissing']            = 'Omnes campi complendi sunt.';
 $lang['reguexists']            = 'Nomen Sodalis ab aliquo iam elegitur.';
 $lang['regsuccess']            = 'Adscriptio feliciter perficitur et tessera cursu interretiali mittitur';
@@ -92,17 +93,17 @@ $lang['txt_upload']            = 'Eligere documenta oneranda:';
 $lang['txt_filename']          = 'Onerare (optio):';
 $lang['txt_overwrt']           = 'Documento ueteri imponere:';
 $lang['lockedby']              = 'Nunc hoc intercludit';
-$lang['lockexpire']            = 'Hoc aperiuit';
+$lang['lockexpire']            = 'Hoc apertum';
 $lang['willexpire']            = 'Interclusio paginae recensendae uno minuto finita est.\nUt errores uites, \'praeuisio\' preme ut interclusionem ripristines.';
 $lang['js']['notsavedyet']     = 'Res non seruatae amissurae sunt.';
 $lang['js']['searchmedia']     = 'Quaere inter documenta';
 $lang['js']['keepopen']        = 'Fenestram apertam tene';
 $lang['js']['hidedetails']     = 'Singulas res abscondere';
-$lang['js']['mediatitle']      = 'Optiones connectendi';
-$lang['js']['mediadisplay']    = 'Exemplar connectendi';
+$lang['js']['mediatitle']      = 'Optiones nexorum';
+$lang['js']['mediadisplay']    = 'Genus nexi';
 $lang['js']['mediaalign']      = 'Collocatio';
 $lang['js']['mediasize']       = 'Amplitudo imaginis';
-$lang['js']['mediatarget']     = 'Signum connectere';
+$lang['js']['mediatarget']     = 'Cui nexum est';
 $lang['js']['mediaclose']      = 'Claudere';
 $lang['js']['mediainsert']     = 'Insere';
 $lang['js']['mediadisplayimg'] = 'Imaginem ostendere';
@@ -122,7 +123,7 @@ $lang['js']['medianoalign']    = 'Collocationem remouere';
 $lang['js']['nosmblinks']      = 'Windows nexa solum cum Microsoft Internet Explorer ostendi possunt.
 Adhuc transcribere nexum potes.';
 $lang['js']['linkwiz']         = 'Connectendi ductor';
-$lang['js']['linkto']          = 'Nexum:';
+$lang['js']['linkto']          = 'Nexum ad:';
 $lang['js']['del_confirm']     = 'Delere electas res uin?';
 $lang['js']['mu_btn']          = 'Plura documenta uno tempore onerare';
 $lang['rssfailed']             = 'Error in restituendo ';
@@ -140,13 +141,13 @@ $lang['uploadsize']            = 'Documentum onerandum ponderosius est. (Maxime
 $lang['deletesucc']            = 'Documentum "%s" deletum est.';
 $lang['deletefail']            = '"%s" non deletur: uide facultates.';
 $lang['mediainuse']            = 'documentum "%s" non deletur, nam aliquis hoc utitur.';
-$lang['namespaces']            = 'Spatium nominis';
+$lang['namespaces']            = 'Genus';
 $lang['mediafiles']            = 'Documentum liberum in:';
 $lang['accessdenied']          = 'Non uidere documentum potes.';
 $lang['mediausage']            = 'Hac forma uteris ut documentum referas:';
 $lang['mediaview']             = 'Vide documentum primigenium';
 $lang['mediaroot']             = 'scrinium';
-$lang['mediaupload']           = 'Spatium nominis hic oneras. Si nouom spatium nominis creare uis, ante "Onerare ut" nomen documenti diuisum a duabus punctis ponas.';
+$lang['mediaupload']           = 'Hic genus oneras. Si nouom genus creare uis, ante "Onerare ut" nomen documenti diuisum a duabus punctis ponas.';
 $lang['mediaextchange']        = 'Genus documenti mutatum a(b) ".%s" ad ".%s"!';
 $lang['reference']             = 'Referre:';
 $lang['ref_inuse']             = 'Documentum non deleri potest, nam in his paginis apertum est:';
@@ -170,10 +171,10 @@ $lang['restored']              = 'Recensio uetus restituta';
 $lang['external_edit']         = 'Externe recensere';
 $lang['summary']               = 'Indicem recensere';
 $lang['noflash']               = '<a href="http://www.adobe.com/products/flashplayer/">Adobe Flash Plugin</a> necessarium est.';
-$lang['download']              = 'Snippet cape';
+$lang['download']              = 'Snippet capere';
 $lang['mail_newpage']          = 'Pagina addita:';
 $lang['mail_changed']          = 'Pagina mutata:';
-$lang['mail_subscribe_list']   = 'Pagina in spatio nominis mutata:';
+$lang['mail_subscribe_list']   = 'Paginae in genere mutatae:';
 $lang['mail_new_user']         = 'Nouos Sodalis:';
 $lang['mail_upload']           = 'Documentum oneratum:';
 $lang['qb_bold']               = 'Litterae pingues';
@@ -198,9 +199,9 @@ $lang['qb_ol']                 = 'Index ordinatus rerum';
 $lang['qb_ul']                 = 'Index non ordinatus rerum';
 $lang['qb_media']              = 'Imagines et documenta addere';
 $lang['qb_sig']                = 'Subscriptio tua cum indicatione temporis';
-$lang['qb_smileys']            = 'Facies';
+$lang['qb_smileys']            = 'Pupuli';
 $lang['qb_chars']              = 'Signa singularia';
-$lang['upperns']               = 'I ad anterius spatium nominis';
+$lang['upperns']               = 'I ad anterius genus';
 $lang['admin_register']        = 'Nouom Sodalem creare';
 $lang['metaedit']              = 'Res codicis mutare';
 $lang['metasaveerr']           = 'Res codicis non scribitur.';
@@ -223,7 +224,7 @@ $lang['subscr_unsubscribe_success'] = 'A subscriptione %s deletur quod %s';
 $lang['subscr_unsubscribe_error'] = 'Error delendi %s a subscriptione quod %s';
 $lang['subscr_already_subscribed'] = '%s iam subscriptus\a est in %s';
 $lang['subscr_not_subscribed'] = '%s non subscriptus\a est in %n';
-$lang['subscr_m_not_subscribed'] = 'Non hanc paginam uel spatium nominis subscribere potes.';
+$lang['subscr_m_not_subscribed'] = 'Non hanc paginam uel genus subscribere potes.';
 $lang['subscr_m_new_header']   = 'Subscriptionem addere';
 $lang['subscr_m_current_header'] = 'haec subscriptio:';
 $lang['subscr_m_unsubscribe']  = 'Delere';
@@ -237,12 +238,12 @@ $lang['authtempfail']          = 'Confirmare non potes. Rectorem conuenis.';
 $lang['i_chooselang']          = 'Linguam eligere';
 $lang['i_installer']           = 'Docuuicis creator';
 $lang['i_wikiname']            = 'Nomen Vicis';
-$lang['i_enableacl']           = 'AAA aptum facias (consulatum est)';
+$lang['i_enableacl']           = 'ICA aptum facias (consulatum est)';
 $lang['i_superuser']           = 'Magister\stra';
 $lang['i_problems']            = 'Creator hos errores habes. Continuare potes postquam omnia soluentur.';
-$lang['i_modified']            = 'Hoc scriptum solum cum noua uersione Dokuuicis est. Hoc rursum capere in pagina, in qua haec machina capta est, potes aut i ad <a href="http://dokuwiki.org/install">Dokuuicis installation instructions</a>';
+$lang['i_modified']            = 'Hoc scriptum solum cum noua forma Dokuuicis est. Hoc rursum capere in pagina, in qua haec machina capta est, potes aut i ad <a href="http://dokuwiki.org/install">Dokuuicis installation instructions</a>';
 $lang['i_funcna']              = 'PHP functio <code>%s</code> inepta est.';
-$lang['i_phpver']              = 'Versio tua PHP <code>%s</code> minor quam illa necessaria <code>%s</code>.';
+$lang['i_phpver']              = 'Forma tua PHP <code>%s</code> minor quam illa necessaria <code>%s</code>.';
 $lang['i_permfail']            = '<code>%s</code> non a uice scribitur. Facultates inspicere.';
 $lang['i_confexists']          = '<code>%s</code> iam est.';
 $lang['i_writeerr']            = '<code>%s</code> non creari potest. Manu illum creas.';
@@ -250,7 +251,7 @@ $lang['i_badhash']             = 'Ignotum uel mutatum dokuwiki.php (<code>%s</co
 $lang['i_badval']              = '<code>%s</code> non legitimum uel uacuom';
 $lang['i_success']             = 'Administratio feliciter perficitur. Delere install.php documentum potes. I ad <a href="doku.php">hanc paginam</a> ut continues.';
 $lang['i_failure']             = 'Aliqui errores dum documenta administrantur sunt. Manu onerare omnes potes priusquam <a href="doku.php">tuo nouo uice</a> uteris.';
-$lang['i_policy']              = 'AAA ratio prima';
+$lang['i_policy']              = 'ICA ratio prima';
 $lang['i_pol0']                = 'Vicem aperire (omnes legere, scribere, onerare possunt)';
 $lang['i_pol1']                = 'Publicus uicis (omnes legere, Sodales scribere et onerare possunt)';
 $lang['i_pol2']                = 'Clausus uicis (Soli Sodales legere scribere et onerare poccunt)';
@@ -260,7 +261,7 @@ $lang['mu_intro']              = 'Plura documenta uno tempore onerare potes.';
 $lang['mu_gridname']           = 'Documenti nomen';
 $lang['mu_gridsize']           = 'Pondus';
 $lang['mu_gridstat']           = 'Status';
-$lang['mu_namespace']          = 'Spatium nominis';
+$lang['mu_namespace']          = 'Genus';
 $lang['mu_browse']             = 'Euoluere';
 $lang['mu_toobig']             = 'Ponderosius';
 $lang['mu_ready']              = 'Aptus ad onerandum';
@@ -271,7 +272,7 @@ $lang['mu_progress']           = '@PCT@% oneratum';
 $lang['mu_filetypes']          = 'Genera documenti apta facere';
 $lang['mu_info']               = 'Documenta onerare';
 $lang['mu_lasterr']            = 'Extremus error:';
-$lang['recent_global']         = 'Mutatione in hoc spatio nominis uides. Recentiores mutationes quoque uidere <a href="%s">potes</a>';
+$lang['recent_global']         = 'Mutatione in hoc genere uides. Recentiores mutationes quoque uidere <a href="%s">potes</a>';
 $lang['years']                 = 'ab annis %d';
 $lang['months']                = 'a mensibus %d';
 $lang['weeks']                 = 'a septimanis %d';
diff --git a/inc/lang/la/norev.txt b/inc/lang/la/norev.txt
index 872eb8070647de4e808ac9c6a907b0cb0945ee96..19b60fe1591c39f2502a5a549d7df2507739ebf0 100644
--- a/inc/lang/la/norev.txt
+++ b/inc/lang/la/norev.txt
@@ -1,3 +1,3 @@
-====== Versio non reperta ======
+====== Forma non reperta ======
 
-Haec uersio non reperta est. Aliam uersionem quaeris.
\ No newline at end of file
+Haec forma non reperta est. Aliam formam quaeris.
\ No newline at end of file
diff --git a/inc/lang/la/showrev.txt b/inc/lang/la/showrev.txt
index c5019d7982529efbb62c5d90c21df0033876e187..b95e68265c7420d8160a421d59e2ff24d93bb1b0 100644
--- a/inc/lang/la/showrev.txt
+++ b/inc/lang/la/showrev.txt
@@ -1,2 +1,2 @@
-**Haec uetus uersio documenti est!**
+**Haec uetus forma documenti est!**
 ----
\ No newline at end of file
diff --git a/inc/lang/la/subscr_digest.txt b/inc/lang/la/subscr_digest.txt
index a64a2c61bab67a74c3957225a582b888870af902..6292133595efabe10898e8a42e4f40f12c1a0a49 100644
--- a/inc/lang/la/subscr_digest.txt
+++ b/inc/lang/la/subscr_digest.txt
@@ -13,7 +13,7 @@ Noua recensio: @NEWPAGE@
 Ut paginae adnotationes deleas, in uicem ineas in
 @DOKUWIKIURL@, deinde uideas
 @NEWPAGE@
-et paginarum spatiorum nominis optiones mutasa.
+et paginarum generum optiones mutes.
 
 --
 Hic cursus a uicis generatus
diff --git a/inc/lang/la/subscr_form.txt b/inc/lang/la/subscr_form.txt
index 82b0a692e069297b79d6c7dae2fbf9f7d950b474..23000b31ef4e9b919c9cc9250e3ca58939a667cf 100644
--- a/inc/lang/la/subscr_form.txt
+++ b/inc/lang/la/subscr_form.txt
@@ -1,3 +1,3 @@
 ====== Inscriptionis Administratio ======
 
-In hac pagina inscriptiones paginae et spatio nominis sunt.
\ No newline at end of file
+In hac pagina inscriptiones huius paginae et generis sunt.
\ No newline at end of file
diff --git a/inc/lang/la/subscr_list.txt b/inc/lang/la/subscr_list.txt
index 87ce9721594d0b4ba0630980facaa38ac69c2204..e6ff8d89d341748885e1dce3a16824b56536393f 100644
--- a/inc/lang/la/subscr_list.txt
+++ b/inc/lang/la/subscr_list.txt
@@ -10,7 +10,7 @@ Hae mutationes sunt:
 Ut adnotationes deleas, preme hic
 @DOKUWIKIURL@ then visit
 @SUBSCRIBE@
-et paginarum spatiorum nominis mutationes tollis.
+et paginarum et\aut generum mutationes tollis.
 
 --
 Hic cursus generatus a(b)
diff --git a/inc/lang/la/subscr_single.txt b/inc/lang/la/subscr_single.txt
index e21af04bbbbf0fa47bfff190dc2795b4155e12c3..7839791eaea6823517ae408f2a135cabcc796ba7 100644
--- a/inc/lang/la/subscr_single.txt
+++ b/inc/lang/la/subscr_single.txt
@@ -16,7 +16,7 @@ Noua recensio: @NEWPAGE@
 Ut paginae adnotationes deleas, in uicem ineas in
 @DOKUWIKIURL@, deinde uideas
 @NEWPAGE@
-et paginarum spatiorum nominis optiones mutasa.
+et paginarum et\aut generum optiones mutasa.
 
 --
 Hic cursus a uicis generatus
diff --git a/inc/lang/mg/lang.php b/inc/lang/mg/lang.php
index 2ecbcdcff4960bc4364c447cd68d9b93221c05eb..3727cfe9af9f7edee39fb59c7f96e1b7197272f3 100644
--- a/inc/lang/mg/lang.php
+++ b/inc/lang/mg/lang.php
@@ -132,4 +132,4 @@ $lang['acl_perm8']  = 'Mandefa rakitra';
 $lang['acl_perm16'] = 'Mamafa';
 $lang['acl_new']    = 'Ampio andalana vaovao';
 
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/inc/lang/ru/conflict.txt b/inc/lang/ru/conflict.txt
index f1ac60bd4cfdb823c5057fb021713176a787ce39..6c5e33dced7b3e2cac5bbbe82512bd7673fd817d 100644
--- a/inc/lang/ru/conflict.txt
+++ b/inc/lang/ru/conflict.txt
@@ -2,4 +2,4 @@
 
 Существует более новая версия документа, который вы редактировали. Такое случается, когда другой пользователь изменил документ, пока вы делали то же самое.
 
-Внимательно изучите различия, приведенные ниже и решите, какую версию оставить. Если вы выберете ''Сохранить'', то ваша версия будет сохранена. Нажав ''Отменить',' вы оставите текущую версию.
+Внимательно изучите различия, приведенные ниже, и решите, какую версию оставить. Если вы выберете «Сохранить», то ваша версия будет сохранена. Нажав «Отменить», вы оставите текущую версию.
diff --git a/inc/lang/ru/draft.txt b/inc/lang/ru/draft.txt
index bbd2e5913e250a1594e4adae00f6d838f91f2573..cb35f72b6a8cf2d66cb4862b2b312e7e5c2dceb2 100644
--- a/inc/lang/ru/draft.txt
+++ b/inc/lang/ru/draft.txt
@@ -1,6 +1,6 @@
 ====== Найден черновик ======
 
-Последний раз редактирование этой страницы не было корректно завершено. Во время вашей работы был автоматически сохранён черновик, который вы теперь можете восстановить и продолжить прерванную правку. Ниже вы видите автоматически сохраненную версию.
+Последний раз редактирование этой страницы не было корректно завершено. Во время вашей работы был автоматически сохранён черновик, который вы теперь можете восстановить и продолжить прерванную правку. Ниже вы видите автоматически сохранённую версию.
 
 Пожалуйста, решите, хотите ли вы //восстановить// потерянную версию, //удалить// черновик, или //отменить// редактирование.
 
diff --git a/inc/lang/ru/edit.txt b/inc/lang/ru/edit.txt
index 6398e8e830451b742f6a7677f1f6837e4685a752..aac399d7c2915fc9c143f622b238b83f5a3bd76b 100644
--- a/inc/lang/ru/edit.txt
+++ b/inc/lang/ru/edit.txt
@@ -1,2 +1,2 @@
-Отредактируйте страницу и нажмите ''Сохранить''. Прочтите [[wiki:syntax]] для ознакомления с синтаксисом вики. Пожалуйста, редактируйте только в том случае, если планируете **улучшить** содержимое. Если вы просто хотите потестировать что-либо, воспользуйтесь специальной страницей: [[playground:playground]].
+Отредактируйте страницу и нажмите «Сохранить». Прочтите [[wiki:syntax|справочную страницу]] для ознакомления с синтаксисом вики. Пожалуйста, редактируйте только в том случае, если планируете **улучшить** содержимое. Если вы просто хотите потестировать что-либо, воспользуйтесь специальной страницей: [[playground:playground]].
 
diff --git a/inc/lang/ru/editrev.txt b/inc/lang/ru/editrev.txt
index db843ec1ce0b940db5491cf817821095eb742e85..97b799a70805e603303dfdbfa5bb76cb13460d6b 100644
--- a/inc/lang/ru/editrev.txt
+++ b/inc/lang/ru/editrev.txt
@@ -1,2 +1,2 @@
-**Вы загрузили старую ревизию документа!** Сохранив её, вы создадите новую текущую версию с этим содержимым.
+**Вы загрузили старую ревизию документа.** Сохранив её, вы создадите новую текущую версию с этим содержимым.
 ----
diff --git a/inc/lang/ru/install.html b/inc/lang/ru/install.html
index da0c5e239bf748d24a4208cf234347c4375f27c6..b830b06c0ac8ac92841a9b970a98916455917868 100644
--- a/inc/lang/ru/install.html
+++ b/inc/lang/ru/install.html
@@ -1,6 +1,6 @@
-<p>Эта страница предназначена помочь в первоначальной установке и конфигурации «<a href="http://www.dokuwiki.org">ДокуВики</a>». Дополнительная информация о программе установки доступна на её <a href="http://www.dokuwiki.org/installer">странице документации</a>.</p>
+<p>Эта страница предназначена помочь в первоначальной установке и конфигурации «<a href="http://www.dokuwiki.org/">ДокуВики</a>». Дополнительная информация о программе установки доступна на её <a href="http://www.dokuwiki.org/installer">странице документации</a>.</p>
 
-<p>«ДокуВики» использует обычные файлы для хранения страниц и дополнительной информации (например, изображений, поискового индекса, предыдущих версий страницы, и т. д.). Для успешной работы «ДокуВики» <strong>необходим</strong> доступ на запись к директориям с этими файлами. Данная программа установки не может самостоятельно изменять системные права доступа к директориям. Обычно это делается напрямую из командной строки (shell), или, если вы используете удалённый хостинг, через FTP или панель управления вашего хостинга (например, cPanel).</p>
+<p>«ДокуВики» использует обычные файлы для хранения страниц и дополнительной информации (например, изображений, поискового индекса, предыдущих версий страницы, и т. д.). Для успешной работы «ДокуВики» <strong>необходим</strong> доступ на запись к директориям с этими файлами. Данная программа установки не может самостоятельно изменять системные права доступа к директориям. Обычно это делается напрямую из командной строки (shell), или, если вы используете удалённый хостинг, через FTP или панель управления своего хостинга (например, cPanel).</p>
 
 <p>Программа установки включит использование списков контроля доступа (<acronym title="access control list">ACL</acronym>) в вашей «ДокуВики». Это позволит администратору, после авторизации в «ДокуВики», использовать специальное меню для установки плагинов, управления пользователями и доступом к страницам вики, а также для настройки конфигурационных параметров. Списки контроля доступа не обязательны для работы «ДокуВики», однако они позволяют упростить управление вашей «ДокуВики».</p>
 
diff --git a/inc/lang/ru/lang.php b/inc/lang/ru/lang.php
index 88692ae931ac4dbca02fb2032c607dcbc449bde4..2968d72bd4a18213ffa3ab621ab6b230b193026f 100644
--- a/inc/lang/ru/lang.php
+++ b/inc/lang/ru/lang.php
@@ -76,7 +76,7 @@ $lang['regmissing']            = 'Извините, вам следует зап
 $lang['reguexists']            = 'Извините, пользователь с таким логином уже существует.';
 $lang['regsuccess']            = 'Пользователь создан, пароль выслан на адрес электронной почты.';
 $lang['regsuccess2']           = 'Пользователь создан.';
-$lang['regmailfail']           = 'Похоже, проблема с отправкой пароля по почте. Пожалуйста, сообщите администратору.';
+$lang['regmailfail']           = 'Похоже есть проблема с отправкой пароля по почте. Пожалуйста, сообщите об этом администратору.';
 $lang['regbadmail']            = 'Данный вами адрес электронной почты выглядит неправильным. Если вы считаете это ошибкой, сообщите администратору.';
 $lang['regbadpass']            = 'Два введённых пароля не идентичны. Пожалуйста, попробуйте ещё раз.';
 $lang['regpwmail']             = 'Ваш пароль для системы «ДокуВики»';
@@ -94,7 +94,7 @@ $lang['resendpwdbadauth']      = 'Извините, неверный код ав
 $lang['resendpwdconfirm']      = 'Ссылка для подтверждения пароля была выслана по электронной почте. ';
 $lang['resendpwdsuccess']      = 'Ваш новый пароль был выслан по электронной почте.';
 $lang['license']               = 'За исключением случаев, когда указано иное, содержимое этой вики предоставляется на условиях следующей лицензии:';
-$lang['licenseok']             = 'Примечание: редактируя эту страницу, вы соглашаетесь на использование вашего вклада на условиях следующей лицензии:';
+$lang['licenseok']             = 'Примечание: редактируя эту страницу, вы соглашаетесь на использование своего вклада на условиях следующей лицензии:';
 $lang['searchmedia']           = 'Поиск по имени файла:';
 $lang['searchmedia_in']        = 'Поиск в %s';
 $lang['txt_upload']            = 'Выберите файл для загрузки';
@@ -103,8 +103,7 @@ $lang['txt_overwrt']           = 'Перезаписать существующ
 $lang['lockedby']              = 'В данный момент заблокирован';
 $lang['lockexpire']            = 'Блокировка истекает в';
 $lang['willexpire']            = 'Ваша блокировка редактирования этой страницы истекает в течение минуты.\nЧтобы избежать конфликтов и сбросить таймер блокировки, нажмите кнопку просмотра.';
-$lang['js']['notsavedyet']     = 'Несохранённые изменения будут потеряны.
-Вы действительно хотите продолжить?';
+$lang['js']['notsavedyet']     = 'Несохранённые изменения будут потеряны. Вы действительно хотите продолжить?';
 $lang['js']['searchmedia']     = 'Поиск файлов';
 $lang['js']['keepopen']        = 'Не закрывать окно после выбора';
 $lang['js']['hidedetails']     = 'Скрыть детали';
@@ -112,7 +111,7 @@ $lang['js']['mediatitle']      = 'Настройки ссылок';
 $lang['js']['mediadisplay']    = 'Тип ссылки';
 $lang['js']['mediaalign']      = 'Выравнивание';
 $lang['js']['mediasize']       = 'Размер изображения';
-$lang['js']['mediatarget']     = 'target ссылки';
+$lang['js']['mediatarget']     = 'Значение target ссылки';
 $lang['js']['mediaclose']      = 'Закрыть';
 $lang['js']['mediainsert']     = 'Вставить';
 $lang['js']['mediadisplayimg'] = 'Показывать изображение.';
@@ -129,8 +128,7 @@ $lang['js']['medialeft']       = 'Выровнять изображение по
 $lang['js']['mediaright']      = 'Выровнять изображение по правому краю.';
 $lang['js']['mediacenter']     = 'Выровнять изображение по центру.';
 $lang['js']['medianoalign']    = 'Не выравнивать.';
-$lang['js']['nosmblinks']      = 'Ссылка на сетевые каталоги Windows работает только из Интернет Эксплорера
-Но вы можете скопировать ссылку.';
+$lang['js']['nosmblinks']      = 'Ссылка на сетевые каталоги Windows работает только из Интернет Эксплорера. Но вы можете скопировать ссылку.';
 $lang['js']['linkwiz']         = 'Мастер ссылок';
 $lang['js']['linkto']          = 'Ссылка на:';
 $lang['js']['del_confirm']     = 'Вы на самом деле желаете удалить выбранное?';
@@ -149,18 +147,18 @@ $lang['uploadxss']             = 'Загрузка заблокирована п
 $lang['uploadsize']            = 'Загруженный файл был слишком большой. (макс. %s)';
 $lang['deletesucc']            = 'Файл "%s" был удалён.';
 $lang['deletefail']            = 'Невозможно удалить файл "%s". Проверьте права доступа к файлу.';
-$lang['mediainuse']            = 'Файл "%s" не был удалён - файл всё ещё используется.';
+$lang['mediainuse']            = 'Файл "%s" не был удалён — файл всё ещё используется.';
 $lang['namespaces']            = 'Пространства имён';
 $lang['mediafiles']            = 'Доступные файлы';
 $lang['accessdenied']          = 'Вы не можете просмотреть эту страницу.';
 $lang['mediausage']            = 'Для ссылки на этот файл используйте следующий синтаксис:';
 $lang['mediaview']             = 'Посмотреть исходный файл';
 $lang['mediaroot']             = 'корень';
-$lang['mediaupload']           = 'Здесь можно загрузить файл в текущий каталог («пространство имен»). Чтобы создать подкаталоги, добавьте их к началу имени файла («Загрузить как»). Имена подкаталогов разделяются двоеточиями. ';
+$lang['mediaupload']           = 'Здесь можно загрузить файл в текущий каталог («пространство имён»). Чтобы создать подкаталоги, добавьте их к началу имени файла («Загрузить как»). Имена подкаталогов разделяются двоеточиями. ';
 $lang['mediaextchange']        = 'Расширение изменилось: с .%s на .%s!';
 $lang['reference']             = 'Ссылки для';
-$lang['ref_inuse']             = 'Этот файл не может быть удалён, так как он используется следующими страницами:';
-$lang['ref_hidden']            = 'Некоторые ссылки находятся на страницах, на чтение которых у вас нет прав';
+$lang['ref_inuse']             = 'Этот файл не может быть удалён, так как он используется на следующих страницах:';
+$lang['ref_hidden']            = 'Некоторые ссылки находятся на страницах, на чтение которых у вас нет прав доступа';
 $lang['hits']                  = 'соответствий';
 $lang['quickhits']             = 'Соответствия в названиях страниц';
 $lang['toc']                   = 'Содержание';
@@ -183,7 +181,7 @@ $lang['noflash']               = 'Для просмотра этого соде
 $lang['download']              = 'Скачать код';
 $lang['mail_newpage']          = 'страница добавлена:';
 $lang['mail_changed']          = 'страница изменена:';
-$lang['mail_subscribe_list']   = 'изменились страницы в пространстве имен:';
+$lang['mail_subscribe_list']   = 'изменились страницы в пространстве имён:';
 $lang['mail_new_user']         = 'новый пользователь:';
 $lang['mail_upload']           = 'файл закачан:';
 $lang['qb_bold']               = 'Полужирный';
@@ -210,7 +208,7 @@ $lang['qb_media']              = 'Добавить изображения или
 $lang['qb_sig']                = 'Вставить подпись';
 $lang['qb_smileys']            = 'Смайлики';
 $lang['qb_chars']              = 'Специальные символы';
-$lang['upperns']               = 'Перейти в родительское пространство имен';
+$lang['upperns']               = 'Перейти в родительское пространство имён';
 $lang['admin_register']        = 'Добавить пользователя';
 $lang['metaedit']              = 'Править метаданные';
 $lang['metasaveerr']           = 'Ошибка записи метаданных';
@@ -233,7 +231,7 @@ $lang['subscr_unsubscribe_success'] = 'Удалён %s из подписки н
 $lang['subscr_unsubscribe_error'] = 'Ошибка удаления %s из подписки на %s';
 $lang['subscr_already_subscribed'] = '%s уже подписан на %s';
 $lang['subscr_not_subscribed'] = '%s не подписан на %s';
-$lang['subscr_m_not_subscribed'] = 'Вы не подписаны на текущую страницу или пространство имен.';
+$lang['subscr_m_not_subscribed'] = 'Вы не подписаны на текущую страницу или пространство имён.';
 $lang['subscr_m_new_header']   = 'Добавить подписку';
 $lang['subscr_m_current_header'] = 'Текущие подписки';
 $lang['subscr_m_unsubscribe']  = 'Отменить подписку';
@@ -242,8 +240,8 @@ $lang['subscr_m_receive']      = 'Получить';
 $lang['subscr_style_every']    = 'уведомлять о каждом изменении';
 $lang['subscr_style_digest']   = 'сводка изменений по каждой странице';
 $lang['subscr_style_list']     = 'перечислять изменившиеся страницы с прошлого уведомления';
-$lang['authmodfailed']         = 'Неправильная конфигурация аутентификации пользователя. Пожалуйста, сообщите об этом вашему администратору вики.';
-$lang['authtempfail']          = 'Аутентификация пользователей временно недоступна. Если проблема продолжается какое-то время, пожалуйста, сообщите об этом вашему администратору вики.';
+$lang['authmodfailed']         = 'Неправильная конфигурация аутентификации пользователя. Пожалуйста, сообщите об этом своему администратору вики.';
+$lang['authtempfail']          = 'Аутентификация пользователей временно недоступна. Если проблема продолжается какое-то время, пожалуйста, сообщите об этом своему администратору вики.';
 $lang['i_chooselang']          = 'Выберите свой язык/Choose your language';
 $lang['i_installer']           = 'Установка «ДокуВики»';
 $lang['i_wikiname']            = 'Название вики';
@@ -258,18 +256,18 @@ $lang['i_phpver']              = 'Ваша версия PHP (<code>%s</code>) н
 $lang['i_permfail']            = '<code>%s</code> недоступна для записи «ДокуВики». Вам необходимо исправить системные права доступа для этой директории!';
 $lang['i_confexists']          = '<code>%s</code> уже существует';
 $lang['i_writeerr']            = 'Не удалось создать <code>%s</code>. Вам необходимо проверить системные права доступа к файлу/директориям и создать файл вручную. ';
-$lang['i_badhash']             = 'dokuwiki.php не распознана или изменена (хэш=<code>%s</code>)';
+$lang['i_badhash']             = 'dokuwiki.php не распознан или изменён (хэш=<code>%s</code>)';
 $lang['i_badval']              = '<code>%s</code> — недопустимое или пустое значение';
 $lang['i_success']             = 'Конфигурация прошла успешно. Теперь вы можете удалить файл install.php. Переходите к
-                        <a href="doku.php">вашей новой «ДокуВики»</a>.';
-$lang['i_failure']             = 'При записи в файлы конфигурации были обнаружены ошибки. Возможно, вам придется исправить их вручную, прежде чем вы сможете использовать <a href="doku.php">вашу новую «ДокуВики»</a>.';
+                        <a href="doku.php">своей новой «ДокуВики»</a>.';
+$lang['i_failure']             = 'При записи в файлы конфигурации были обнаружены ошибки. Возможно, вам придётся исправить их вручную, прежде чем вы сможете использовать <a href="doku.php">свою новую «ДокуВики»</a>.';
 $lang['i_policy']              = 'Исходная политика прав доступа';
 $lang['i_pol0']                = 'Открытая вики (чтение, запись, закачка файлов для всех)';
 $lang['i_pol1']                = 'Общедоступная вики (чтение для всех, запись и загрузка файлов для зарегистрированных пользователей)';
 $lang['i_pol2']                = 'Закрытая вики (чтение, запись и загрузка файлов только для зарегистрированных пользователей)';
 $lang['i_retry']               = 'Повторить попытку';
-$lang['i_license']             = 'Пожалуйста, выберите тип лицензии для вашей вики:';
-$lang['mu_intro']              = 'Здесь вы можете загрузить несколько файлов сразу. Кликните на «обзор», чтобы добавить их в список. Нажмите «загрузить» когда будете готовы.';
+$lang['i_license']             = 'Пожалуйста, выберите тип лицензии для своей вики:';
+$lang['mu_intro']              = 'Здесь вы можете загрузить несколько файлов сразу. Кликните на «обзор», чтобы добавить их в список. Нажмите «загрузить», когда будете готовы.';
 $lang['mu_gridname']           = 'Имя файла';
 $lang['mu_gridsize']           = 'Размер';
 $lang['mu_gridstat']           = 'Статус';
@@ -284,7 +282,7 @@ $lang['mu_progress']           = '@PCT@% загружено';
 $lang['mu_filetypes']          = 'Допустимые типы файлов';
 $lang['mu_info']               = 'файлов загружено.';
 $lang['mu_lasterr']            = 'Последняя ошибка:';
-$lang['recent_global']         = 'Вы просматриваете изменения в пространстве имён <b>%s</b>. Вы можете также <a href="%s">просмотреть недавние изменения на всей вики</a>.';
+$lang['recent_global']         = 'Вы просматриваете изменения в пространстве имён <b>%s</b>. Вы можете также <a href="%s">просмотреть недавние изменения во всей вики</a>.';
 $lang['years']                 = '%d лет назад';
 $lang['months']                = '%d месяц(ев) назад';
 $lang['weeks']                 = '%d недель назад';
diff --git a/inc/lang/ru/norev.txt b/inc/lang/ru/norev.txt
index db36a0dddafefecc60f940aa621d950d68ef551c..388d6149d785c101773959b6edf8413f69878734 100644
--- a/inc/lang/ru/norev.txt
+++ b/inc/lang/ru/norev.txt
@@ -1,4 +1,4 @@
 ====== Такой версии не существует ======
 
-Указанная версия страницы не существует. Нажмите на кнопку ''История страницы'', чтобы получить список доступных предыдущих версий этого документа.
+Указанная версия страницы не существует. Нажмите на кнопку «История страницы», чтобы получить список доступных предыдущих версий этого документа.
 
diff --git a/inc/lang/ru/password.txt b/inc/lang/ru/password.txt
index af6a7d14d46581809ead0789729298adb9e2e9ca..91117ca56732aeda738496e414090166bdad9ff3 100644
--- a/inc/lang/ru/password.txt
+++ b/inc/lang/ru/password.txt
@@ -1,9 +1,10 @@
-Здравствуйте, @FULLNAME@!
+Здравствуйте, @FULLNAME@.
 
 Ваши данные для @TITLE@ (@DOKUWIKIURL@)
 
-Имя пользователя  : @LOGIN@
-Пароль : @PASSWORD@
+Имя пользователя: @LOGIN@
+
+Пароль: @PASSWORD@
 
 -- 
 Это письмо было сгенерировано «ДокуВики» по адресу
diff --git a/inc/lang/ru/preview.txt b/inc/lang/ru/preview.txt
index 2bc383eb2eeb62d9709c9d270e80bca648d264af..401827607aff2c2e05b0a82c38021b904c224073 100644
--- a/inc/lang/ru/preview.txt
+++ b/inc/lang/ru/preview.txt
@@ -1,4 +1,4 @@
 ====== Просмотр ======
 
-Здесь показано, как ваш текст будет выглядеть. Внимание: текст ещё **не сохранён!**
+Здесь показано, как ваш текст будет выглядеть. Внимание: текст ещё **не сохранён.**
 
diff --git a/inc/lang/ru/pwconfirm.txt b/inc/lang/ru/pwconfirm.txt
index 3e2331269e54231abbe7cb081cd7c38c70185b40..9c27af75229549190c6476013b91707325ebd255 100644
--- a/inc/lang/ru/pwconfirm.txt
+++ b/inc/lang/ru/pwconfirm.txt
@@ -1,4 +1,4 @@
-Здравствуйте, @FULLNAME@!
+Здравствуйте, @FULLNAME@.
 
 Кто-то запросил новый пароль для входа в @TITLE@ по адресу @DOKUWIKIURL@
 
diff --git a/inc/lang/ru/revisions.txt b/inc/lang/ru/revisions.txt
index 06022323fc2fc22b1e41800394feec8631832234..55072cd8ac6bab1f41f198649cc15e2c405d826a 100644
--- a/inc/lang/ru/revisions.txt
+++ b/inc/lang/ru/revisions.txt
@@ -1,3 +1,3 @@
 ====== История страницы ======
 
-Перед вами — история правок текущего документа. Чтобы вернуться к одной из предыдущих версий, выберите нужную, нажмите ''Править страницу'' и сохраните.
+Перед вами — история правок текущего документа. Чтобы вернуться к одной из предыдущих версий, выберите нужную, нажмите «Править страницу» и сохраните.
diff --git a/inc/lang/ru/searchpage.txt b/inc/lang/ru/searchpage.txt
index 60822049570933982b5d62dffcd9fbeb42013151..04feb21cdb68ff281a4e47e93d39e0c5d1a4de7e 100644
--- a/inc/lang/ru/searchpage.txt
+++ b/inc/lang/ru/searchpage.txt
@@ -1,5 +1,5 @@
 ====== Поиск ======
 
-Перед вами результаты поиска. Если вы не нашли то, что искали, вы можете создать новую страницу с именем, совпадающим с запросом. Чтобы сделать это, просто нажмите на кнопку ''Создать страницу''.
+Перед вами результаты поиска. Если вы не нашли то, что искали, вы можете создать новую страницу с именем, совпадающим с запросом. Чтобы сделать это, просто нажмите на кнопку «Создать страницу».
 
 ===== Результаты =====
\ No newline at end of file
diff --git a/inc/lang/ru/showrev.txt b/inc/lang/ru/showrev.txt
index b3f3852ebc914e18d4ecc75589e1091762ac9c3c..596815870c3d820b44e9a4d1fb8a64d9dcff957f 100644
--- a/inc/lang/ru/showrev.txt
+++ b/inc/lang/ru/showrev.txt
@@ -1,2 +1,2 @@
-**Это старая версия документа!**
+**Это старая версия документа.**
 ----
diff --git a/inc/lang/ru/subscr_digest.txt b/inc/lang/ru/subscr_digest.txt
index 3d1d35d30eb4bb9db49098a4d7b2be8234de5c9a..41774a4e9d2f5ad9683932c823241e2046650731 100644
--- a/inc/lang/ru/subscr_digest.txt
+++ b/inc/lang/ru/subscr_digest.txt
@@ -1,4 +1,4 @@
-Привет!
+Привет.
 
 Страница @PAGE@ в вики @TITLE@ изменилась.
 Список изменений:
diff --git a/inc/lang/ru/subscr_list.txt b/inc/lang/ru/subscr_list.txt
index 9d0eb10e03d735391255f776060ff8897779bd1b..df5c2aa54b7b1dfc90067253fdc69e4958501e82 100644
--- a/inc/lang/ru/subscr_list.txt
+++ b/inc/lang/ru/subscr_list.txt
@@ -1,6 +1,7 @@
-Привет!
 
-Страницы в пространстве имен @PAGE@ в вики @TITLE@ были изменены.
+Привет.
+
+Страницы в пространстве имён @PAGE@ в вики @TITLE@ были изменены.
 Список изменившихся страниц:
 
 --------------------------------------------------------
@@ -10,7 +11,7 @@
 Чтобы отписаться от уведомлений об изменениях, войдите в вики
 @DOKUWIKIURL@ в раздел
 @SUBSCRIBE@
-и отмените подписку на страницу и/или пространство имен.
+и отмените подписку на страницу и/или пространство имён.
 
 --
 Это письмо создано «ДокуВики» с сайта
diff --git a/inc/lang/ru/subscr_single.txt b/inc/lang/ru/subscr_single.txt
index ed8ead4cdabafd85c8fa05cb638b38d82fda98b7..0e67d8f5926361c7f53c629c02a8fb78c4284a68 100644
--- a/inc/lang/ru/subscr_single.txt
+++ b/inc/lang/ru/subscr_single.txt
@@ -1,4 +1,5 @@
-Привет!
+Привет.
+
 
 Страница @PAGE@ в вики @TITLE@ изменилась.
 Список изменений:
@@ -7,8 +8,9 @@
 @DIFF@
 --------------------------------------------------------
 
-Дата : @DATE@
-Автор : @USER@
+Дата: @DATE@
+Автор: @USER@
+
 Примечание: @SUMMARY@
 Старая версия: @OLDPAGE@
 Новая версия: @NEWPAGE@
@@ -16,7 +18,7 @@
 Чтобы отписаться от уведомлений об изменениях, войдите в вики
 @DOKUWIKIURL@ в раздел
 @SUBSCRIBE@
-и отмените подписку на страницу и/или пространство имен.
+и отмените подписку на страницу и/или пространство имён.
 
 --
 Это письмо создано «ДокуВики» с сайта
diff --git a/inc/lang/sl/admin.txt b/inc/lang/sl/admin.txt
new file mode 100644
index 0000000000000000000000000000000000000000..fc78273ac33562f4fe940aa449dab356febff403
--- /dev/null
+++ b/inc/lang/sl/admin.txt
@@ -0,0 +1,3 @@
+===== Administracija =====
+
+Spodaj lahko vidite seznam administrativnih opravil v DokuWikiju.
\ No newline at end of file
diff --git a/inc/lang/sl/adminplugins.txt b/inc/lang/sl/adminplugins.txt
new file mode 100644
index 0000000000000000000000000000000000000000..9438b47592653ff85ad58f6427ab125d03c1cb67
--- /dev/null
+++ b/inc/lang/sl/adminplugins.txt
@@ -0,0 +1 @@
+===== Dodatni vtičniki =====
\ No newline at end of file
diff --git a/inc/lang/sl/draft.txt b/inc/lang/sl/draft.txt
new file mode 100644
index 0000000000000000000000000000000000000000..9fea86fd1408b9817a774ec96f6737caaaefe950
--- /dev/null
+++ b/inc/lang/sl/draft.txt
@@ -0,0 +1,5 @@
+=====Najden je bil osnutek strani=====
+
+Vaša zadnja seja na tej strani ni bila pravilno zaključena. DokuWiki je samodejno shranil osnutek med vašim delom, katerega sedaj lahko nadaljujete. Spodaj lahko vidite podatke, ki so bili samodejno shranjeni v vaši zadnji seji.
+
+Prosimo, odločite se ali boste //obnovili// vašo sejo, //izbrisali// samodejno shranjen osnutek alo //prekinili// proces urejanja.
\ No newline at end of file
diff --git a/inc/lang/sl/lang.php b/inc/lang/sl/lang.php
index 9d94bab49e69df78d45999fe0b086d6ed8046e91..8014d8a70c1795e1e357aa66876913830332e56d 100644
--- a/inc/lang/sl/lang.php
+++ b/inc/lang/sl/lang.php
@@ -6,8 +6,10 @@
  * @author Jaka Kranjc <lynxlupodian@hotmail.com>
  * @author Boštjan Seničar <senicar@gmail.com>
  * @author Dejan Levec <webphp@gmail.com>
+ * @author Gregor Skumavc (grega.skumavc@gmail.com)
  */
 $lang['encoding']              = 'utf-8';
+$lang['direction']             = 'ltr';
 $lang['doublequoteopening']    = '„';
 $lang['doublequoteclosing']    = '“';
 $lang['singlequoteopening']    = '‚';
@@ -35,12 +37,16 @@ $lang['btn_admin']             = 'Administrator';
 $lang['btn_update']            = 'Posodobi';
 $lang['btn_delete']            = 'Izbriši';
 $lang['btn_back']              = 'Nazaj';
+$lang['btn_backlink']          = 'Navzkrižne povezave';
+$lang['btn_backtomedia']       = 'Nazaj na izbiro medijskih datotek';
+$lang['btn_subscribe']         = 'Uredi naročnine';
 $lang['btn_profile']           = 'Posodobi profil';
 $lang['btn_reset']             = 'Ponastavi';
 $lang['btn_resendpwd']         = 'Pošlji novo geslo';
 $lang['btn_draft']             = 'Uredi osnutek';
 $lang['btn_recover']           = 'Obnovi osnutek';
 $lang['btn_draftdel']          = 'Izbriši osnutek';
+$lang['btn_revert']            = 'Povrni';
 $lang['loggedinas']            = 'Prijavljen kot';
 $lang['user']                  = 'Uporabniško ime';
 $lang['pass']                  = 'Geslo';
@@ -55,6 +61,7 @@ $lang['profile']               = 'Profil uporabnika';
 $lang['badlogin']              = 'Oprostite, uporabniško ime ali geslo ni pravo.';
 $lang['minoredit']             = 'Manjše spremembe';
 $lang['draftdate']             = 'Samodejno shranjevanje osnutka vključeno';
+$lang['nosecedit']             = 'Stran se je medtem spremenila, informacije odseka so bile stare, naložila se je celotna stran.';
 $lang['regmissing']            = 'Oprostite, zapolniti morate vsa polja.';
 $lang['reguexists']            = 'Oprostite, uporabnik s tem imenom že obstaja.';
 $lang['regsuccess']            = 'Uporabnik je bil ustvarjen. Geslo je bilo poslano na vaš elektronski naslov.';
@@ -64,21 +71,60 @@ $lang['regbadmail']            = 'Podan elektronski naslov izgleda neveljaven -
 $lang['regbadpass']            = 'Gesli nista enaki.';
 $lang['regpwmail']             = 'Vaše geslo za DokuWiki';
 $lang['reghere']               = 'Nimate še računa? Priskrbite si ga';
+$lang['profna']                = 'Ta wiki ne podpira sprememb profila';
 $lang['profnochange']          = 'Brez sprememb, ničesar za storiti.';
+$lang['profnoempty']           = 'Prazno polje "e-pošta" ali "ime" ni dovoljeno.';
 $lang['profchanged']           = 'Uporabniški profil uspešno posodobljen';
 $lang['pwdforget']             = 'Pozabili geslo? Pridobite novega';
+$lang['resendna']              = 'Ta wiki ne podpira ponovnega pošiljanja gesel.';
 $lang['resendpwd']             = 'Pošlji novo geslo za';
 $lang['resendpwdmissing']      = 'Se opravičujemo, vendar morate izpolniti vsa polja.';
 $lang['resendpwdnouser']       = 'Se opravičujemo, vendar tega uporabniškega imena ni v bazi.';
+$lang['resendpwdbadauth']      = 'Oprostite, ta avtorizacijska koda ni prava. Prepričajte se, da ste uporabili celotno povezavo za potrditev.';
 $lang['resendpwdconfirm']      = 'Potrditvena povezava je bila poslana na vaš elektronski naslov';
 $lang['resendpwdsuccess']      = 'Vaše novo geslo je bilo poslano na vaš elektronski naslov';
+$lang['license']               = 'Če ni drugače navedeno, je vsebina tega wikija licencirana z naslednjo licenco:';
+$lang['licenseok']             = 'Pomembno: Z urejanjem te strani se strinjate s tem, da se vsebina zaščiti z naslednjo licenco:';
+$lang['searchmedia']           = 'Išči datoteko:';
+$lang['searchmedia_in']        = 'Išči v %s';
 $lang['txt_upload']            = 'Izberite datoteko za pošiljanje';
 $lang['txt_filename']          = 'Vnesite wikiname (neobvezno)';
 $lang['txt_overwrt']           = 'Prepiši obstoječo datoteko';
 $lang['lockedby']              = 'Trenutno zaklenjeno od';
 $lang['lockexpire']            = 'Zaklep preteče';
 $lang['willexpire']            = 'Vaš zaklep za urejevanje bo pretekel čez eno minuto.\nDa se izognete konfliktom, uporabite predogled, da se merilnik časa za zaklep ponastavi.';
-$lang['js']['notsavedyet']     = "Obstajajo neshranjene spremembe, ki bodo izgubljene.\nRes želite nadaljevati?";
+$lang['js']['notsavedyet']     = 'Obstajajo neshranjene spremembe, ki bodo izgubljene.
+Res želite nadaljevati?';
+$lang['js']['searchmedia']     = 'Išči datoteke';
+$lang['js']['keepopen']        = 'Od izbiri obdrži okno odprto';
+$lang['js']['hidedetails']     = 'Skrij podrobnosti';
+$lang['js']['mediatitle']      = 'Nastavitve povezave';
+$lang['js']['mediadisplay']    = 'Vrsta povezave';
+$lang['js']['mediaalign']      = 'Poravnava';
+$lang['js']['mediasize']       = 'Velikost slike';
+$lang['js']['mediatarget']     = 'Mesto povezave';
+$lang['js']['mediaclose']      = 'Zapri';
+$lang['js']['mediainsert']     = 'Vstavi';
+$lang['js']['mediadisplayimg'] = 'Pokaži sliko.';
+$lang['js']['mediadisplaylnk'] = 'Pokaži le povezavo.';
+$lang['js']['mediasmall']      = 'Manjša različica';
+$lang['js']['mediamedium']     = 'Srednja različica';
+$lang['js']['medialarge']      = 'Velika različica';
+$lang['js']['mediaoriginal']   = 'Originalna različica';
+$lang['js']['medialnk']        = 'Povezava na detajle strani';
+$lang['js']['mediadirect']     = 'Direktna povezava na original';
+$lang['js']['medianolnk']      = 'Brez povezave';
+$lang['js']['medianolink']     = 'Ne poveži na sliko';
+$lang['js']['medialeft']       = 'Poravnaj sliko na levi';
+$lang['js']['mediaright']      = 'Poravnaj sliko na desni';
+$lang['js']['mediacenter']     = 'Poravnaj sliko na sredino';
+$lang['js']['medianoalign']    = 'Ne uporabi poravnave';
+$lang['js']['nosmblinks']      = 'Povezovanje do Windows deljenih datotek deluje samo v Microsoft Internet Explorer-ju.
+Še vedno pa lahko ročno kopirate povezavo.';
+$lang['js']['linkwiz']         = 'ÄŒarovnik za povezave';
+$lang['js']['linkto']          = 'Poveži na:';
+$lang['js']['del_confirm']     = 'Resnično brišem izbrano(e) sliko(e)?';
+$lang['js']['mu_btn']          = 'Prenesite več dokumentov naenkrat.';
 $lang['rssfailed']             = 'Prišlo je do napake pri prenašanju tega dovoda: ';
 $lang['nothingfound']          = 'Nič ni bilo najdeno.';
 $lang['mediaselect']           = 'Mediafile Izbira';
@@ -87,23 +133,32 @@ $lang['uploadsucc']            = 'Pošiljanje uspelo';
 $lang['uploadfail']            = 'Pošiljanje je spodletelo. Mogoče nimate dovoljenj?';
 $lang['uploadwrong']           = 'Pošiljanje zavrnjeno. Ta datotečna končnica je prepovedana';
 $lang['uploadexist']           = 'Dokument že obstaja. Brez sprememb.';
+$lang['uploadbadcontent']      = 'Naložena datoteka se ne ujema z/s %s končnico datoteke.';
+$lang['uploadspam']            = 'Nalaganje je bilo ustavljeno zaradi "črne liste" neželenih datotek.';
 $lang['uploadxss']             = 'Prenos je bil zaustavljen zaradi možne zlonamerne vsebine.';
 $lang['uploadsize']            = 'Prenesen dokument je prevelik. (max. %s)';
 $lang['deletesucc']            = 'Datoteka "%s" je bila izbrisana.';
+$lang['deletefail']            = '"%s" ni bilo možno izbrisati - preverite nastavitve CHMOD';
 $lang['mediainuse']            = 'Dokument "%s" ni bil izbrisan - je še vedno v uporabi.';
 $lang['namespaces']            = 'Imenski prostori';
 $lang['mediafiles']            = 'Datoteke ki so na voljo v';
-$lang['js']['hidedetails']     = 'Skrij podrobnosti';
-$lang['js']['nosmblinks']      = 'Povezovanje do Windows deljenih datotek deluje samo v Microsoft Internet Explorer-ju.
-Še vedno pa lahko ročno kopirate povezavo.';
-$lang['js']['mu_btn']          = 'Prenesite več dokumentov naenkrat.';
+$lang['accessdenied']          = 'Nimate dovoljenja za ogled te strani.';
+$lang['mediausage']            = 'Uporabite naslednjo kodo za navajanje te datoteke:';
 $lang['mediaview']             = 'Poglej originalno datoteko';
+$lang['mediaroot']             = 'korenska mapa';
+$lang['mediaupload']           = 'Naložite datoteko v trenutno mapo. Za ustvarjanje novih podmap, jih pripnite pred "Naloži kot" ime in jih ločite z navpičnico.';
+$lang['mediaextchange']        = 'Končnica datoteke se je spremenila iz .%s v .%s!';
+$lang['reference']             = 'Reference za';
+$lang['ref_inuse']             = 'Te datoteke ni možno izbrisati, ker jo še vedno uporablja(jo) stran(i):';
+$lang['ref_hidden']            = 'Nekaj referenc je na straneh, do katerih nimate dostopa.';
 $lang['hits']                  = 'Zadetkov';
 $lang['quickhits']             = 'Ujemanja v imenih strani';
 $lang['toc']                   = 'Kazalo';
 $lang['current']               = 'trenutna';
 $lang['yours']                 = 'Vaša različica';
 $lang['diff']                  = 'prikaži razlike s trenutno različico';
+$lang['diff2']                 = 'Pokaži razlike med izbranimi revizijami';
+$lang['difflink']              = 'Naredi povezavo na to primerjavo';
 $lang['line']                  = 'Vrstica';
 $lang['breadcrumb']            = 'Sled';
 $lang['youarehere']            = 'Tukaj ste';
@@ -112,10 +167,13 @@ $lang['by']                    = 'od';
 $lang['deleted']               = 'odstranjena';
 $lang['created']               = 'ustvarjena';
 $lang['restored']              = 'stara različica povrnjena';
+$lang['external_edit']         = 'urejanje v zunanjem urejevalniku';
 $lang['summary']               = 'Povzetek urejanja';
 $lang['noflash']               = 'Za prikaz vsebine potrebujete <a href="http://www.adobe.com/products/flashplayer/">Adobe Flash Plugin</a>';
+$lang['download']              = 'Naloži izrezek';
 $lang['mail_newpage']          = '[DokuWiki] stran dodana:';
 $lang['mail_changed']          = '[DokuWiki] stran spremenjena:';
+$lang['mail_subscribe_list']   = 'strani s spremenjenim imenom:';
 $lang['mail_new_user']         = 'nov uporabnik.';
 $lang['mail_upload']           = 'naložena datoteka:';
 $lang['qb_bold']               = 'Krepki tisk';
@@ -128,6 +186,11 @@ $lang['qb_h2']                 = 'Naslov drugee stopnje';
 $lang['qb_h3']                 = 'Naslov tretje stopnje';
 $lang['qb_h4']                 = 'Naslov četrte stopnje';
 $lang['qb_h5']                 = 'Naslov pete stopnje';
+$lang['qb_h']                  = 'Naslov';
+$lang['qb_hs']                 = 'Izberi naslov';
+$lang['qb_hplus']              = 'Naslov na višjem nivoju';
+$lang['qb_hminus']             = 'Naslov na nižjem nivoju';
+$lang['qb_hequal']             = 'Naslov na istem nivoju';
 $lang['qb_link']               = 'Notranja povezava';
 $lang['qb_extlink']            = 'Zunanja povezava';
 $lang['qb_hr']                 = 'Vodoravna črta';
@@ -137,6 +200,7 @@ $lang['qb_media']              = 'Dodaj slike in druge datoteke';
 $lang['qb_sig']                = 'Vstavi podpis';
 $lang['qb_smileys']            = 'Smeški';
 $lang['qb_chars']              = 'Posebni znaki';
+$lang['upperns']               = 'skoči na starševski članek';
 $lang['admin_register']        = 'Dodaj novega uporabnika';
 $lang['metaedit']              = 'Popravi metapodatke';
 $lang['metasaveerr']           = 'Zapisovanje metapodatkov ni uspelo';
@@ -148,15 +212,71 @@ $lang['img_date']              = 'Datum';
 $lang['img_fname']             = 'Ime datoteke';
 $lang['img_fsize']             = 'Velikost';
 $lang['img_artist']            = 'Fotograf';
+$lang['img_copyr']             = 'Avtorska zaščita';
 $lang['img_format']            = 'Velikost';
 $lang['img_camera']            = 'Fotoaparat';
 $lang['img_keywords']          = 'Ključne besede';
+$lang['subscr_subscribe_success'] = 'Dodan %s na seznam naročnin za %s';
+$lang['subscr_subscribe_error'] = 'Napaka pri dodajanju %s na seznam naročnin za %s';
+$lang['subscr_subscribe_noaddress'] = 'Z vašo prijavo ni povezan noben e-naslov, zato vas ne moremo dodati na seznam naročnikov';
+$lang['subscr_unsubscribe_success'] = 'Odstranjeno %s s seznama naročnin za %s';
+$lang['subscr_unsubscribe_error'] = 'Napaka pri odstranjevanju %s s seznama naročnin za %s';
+$lang['subscr_already_subscribed'] = '%s je že naročen na %s';
+$lang['subscr_not_subscribed'] = '%s ni naročen na %s';
+$lang['subscr_m_not_subscribed'] = 'Niste naročeni na trenutno stran ali članek.';
+$lang['subscr_m_new_header']   = 'Naroči se na spremembe';
+$lang['subscr_m_current_header'] = 'Trenutne naročnine';
+$lang['subscr_m_unsubscribe']  = 'Odjavi se';
+$lang['subscr_m_subscribe']    = 'Naroči se';
+$lang['subscr_m_receive']      = 'Prejmi';
+$lang['subscr_style_every']    = 'e-pošto ob vsaki spremembi';
+$lang['subscr_style_digest']   = 'strnjeno e-pošti sprememb za vsako stran (vsake %.2f dni)';
+$lang['subscr_style_list']     = 'seznam spremenjenih strani od zadnje pošte (vsake %.2f dni)';
+$lang['authmodfailed']         = 'Slaba nastavitev potrditve. Prosimo obvestite administratorja wikija.';
+$lang['authtempfail']          = 'Potrditev uporabnika je trenutno nedostopna. ÄŒe se ta napaka ponavlja, prosimo obvestite administratorja wikija.';
 $lang['i_chooselang']          = 'Izberite jezik';
 $lang['i_installer']           = 'DokuWiki namestitev';
 $lang['i_wikiname']            = 'Wiki ime';
 $lang['i_enableacl']           = 'Omogoči ACL (priporočeno)';
 $lang['i_superuser']           = 'Naduporabnik';
+$lang['i_problems']            = 'Installer je naletel na težave, ki so opisane spodaj. Ne morete nadaljevati, dokler jih ne odpravite.';
+$lang['i_modified']            = 'Iz varnostnih razlogov bo ta skrip deloval le v novi in nespremenjeneni namestitvi DokuWikija. Potrebno je ali ponovno razširiti datoteke iz naloženega paketa, ali preberete popolna <a href="http://dokuwiki.org/install">Dokuwiki navodila za namestitev</a>.';
+$lang['i_funcna']              = 'PHP funkcija <code>%s</code> ni na voljo. Morda jo je vaš ponudnik onemogočil?';
+$lang['i_phpver']              = 'Verzija vašega PHP-ja <code>%s</code> je nižja od potrebne <code>%s</code>. Potrebno je posodobiti PHP inštalacijo.';
+$lang['i_permfail']            = '<code>%s</code> ni zapisljiva. Potrebno je nastaviti CHMOD nastavitve dostopa do direktorija.';
 $lang['i_confexists']          = '<code>%s</code> že obstaja';
+$lang['i_writeerr']            = 'Ni mogoče ustvariti <code>%s</code>. Preveriti morate CHMOD nastavitve dostopa direktorija ali datoteke in ustvariti datoteko ročno.';
+$lang['i_badhash']             = 'nepoznana ali spremenjena dokuwiki.php (hash=<code>%s</code>)';
+$lang['i_badval']              = '<code>%s</code> - neveljavna ali prazna vrednost';
+$lang['i_success']             = 'Konfiguracija se je zaključila uspešno. Datoteko install.php lahko sedaj izbrišete. Nadaljujte v vaš <a href="doku.php">novi DokuWiki</a>.';
+$lang['i_failure']             = 'Med zapisovanjem nastavitvenih datotek je prišlo do nekaj napak. Preden lahko uporabite vaš <a href="doku.php">novi DokuWiki</a>, jih boste morali ročno popraviti.';
+$lang['i_policy']              = 'Namesti ACL';
+$lang['i_pol0']                = 'Odprt Wiki (branje, zapis, nalaganje datotek je javno za vse)';
+$lang['i_pol1']                = 'Javni Wiki (branje za vse, zapis in nalaganje datotek za prijavljene uporabnike)';
+$lang['i_pol2']                = 'Zaprt Wiki (berejo in urejajo lahko le prijavljeni uporabniki)';
+$lang['i_retry']               = 'Ponovni poskus';
+$lang['i_license']             = 'Prosimo, izberite licenco, pod katero bo objsavljena vsebina:';
+$lang['mu_intro']              = 'Tukaj lahko naložite več datotek hkrati. Kliknite gumb "Brskaj", da jih dodate v vrsto. Kliknite "Naloži", ko ste končali';
+$lang['mu_gridname']           = 'Ime datoteke';
 $lang['mu_gridsize']           = 'Velikost';
+$lang['mu_gridstat']           = 'Status';
+$lang['mu_namespace']          = 'Ime';
+$lang['mu_browse']             = 'Brskaj';
+$lang['mu_toobig']             = 'prevelika datoteka';
+$lang['mu_ready']              = 'pripravljena na nalaganje';
 $lang['mu_done']               = 'končano';
+$lang['mu_fail']               = 'ni uspelo';
+$lang['mu_authfail']           = 'seja je potekla';
+$lang['mu_progress']           = '@PCT@% naloženo';
 $lang['mu_filetypes']          = 'Dovoljeni tipi datotek';
+$lang['mu_info']               = 'datoteke naložene';
+$lang['mu_lasterr']            = 'Zadnja napaka:';
+$lang['recent_global']         = 'Trenutno gledate spremembe znotraj imenskega prostora <b>%s</b>. Lahko si <a href="%s">ogledate tudi spremembe, narejene v celotnem wikiju</a>.';
+$lang['years']                 = '%d let nazaj';
+$lang['months']                = '%d mesecev nazaj';
+$lang['weeks']                 = '%d tednov nazaj';
+$lang['days']                  = '%d dni nazaj';
+$lang['hours']                 = '%d ur nazaj';
+$lang['minutes']               = '%d minut nazaj';
+$lang['seconds']               = '%d sekund nazaj';
+$lang['wordblock']             = 'Vaša sprememba ni bila shranjena, ker vsebuje neželeno besedilo (spam).';
diff --git a/inc/lang/sl/subscr_digest.txt b/inc/lang/sl/subscr_digest.txt
new file mode 100644
index 0000000000000000000000000000000000000000..983cab233c4ca8951a592fd92d990abfda8e945b
--- /dev/null
+++ b/inc/lang/sl/subscr_digest.txt
@@ -0,0 +1,20 @@
+Pozdravljeni!
+
+Stran @PAGE@ v wikiju @TITLE@ je bila spremenjena.
+Tu so spremembe:
+
+------------------------------------------------
+@DIFF@
+------------------------------------------------
+
+Stara revizija: @OLDPAGE@
+Nova revizija: @NEWPAGE@
+
+Za odjavo pošiljanja sprememb se prijavite v wiki na naslovu
+@DOKUWIKIURL@, nato obiščite
+@SUBSCRIBE@
+in se odjavite od sprememb strani in/ali imenskega prostora.
+
+--
+To sporočilo je generiral DokuWiki na naslovu
+@DUKOWIKIURL@
\ No newline at end of file
diff --git a/inc/lang/sl/subscr_form.txt b/inc/lang/sl/subscr_form.txt
new file mode 100644
index 0000000000000000000000000000000000000000..46be8c954ae65ea03bfa5924388562b7caa7631d
--- /dev/null
+++ b/inc/lang/sl/subscr_form.txt
@@ -0,0 +1,3 @@
+===== Urejanje naročnin ====
+
+Ta stran vam omogoča urejanje vaših naročnin za trenutno stran in imenski prostor.
\ No newline at end of file
diff --git a/inc/lang/sl/subscr_list.txt b/inc/lang/sl/subscr_list.txt
new file mode 100644
index 0000000000000000000000000000000000000000..f4cfbc26846d2ff8047abed1a3fcdf7b3a929af5
--- /dev/null
+++ b/inc/lang/sl/subscr_list.txt
@@ -0,0 +1,17 @@
+Pozdravljeni!
+
+Strani v imenskem prostoru @PAGE@ wikija @TITLE@ so se spremenile.
+Tu so spremenjene strani:
+
+------------------------------------------------
+@DIFF@
+------------------------------------------------
+
+Za odjavo pošiljanja sprememb se prijavite v wiki na naslovu
+@DOKUWIKIURL@, nato obiščite
+@SUBSCRIBE@
+in se odjavite od sprememb strani in/ali imenskega prostora.
+
+--
+To sporočilo je generiral DokuWiki na naslovu
+@DUKOWIKIURL@
\ No newline at end of file
diff --git a/inc/lang/sl/updateprofile.txt b/inc/lang/sl/updateprofile.txt
new file mode 100644
index 0000000000000000000000000000000000000000..45aa7d92f45eba62843a7fe7dec9342ca85c7051
--- /dev/null
+++ b/inc/lang/sl/updateprofile.txt
@@ -0,0 +1,3 @@
+===== Posodobite svoj profil računa =====
+
+Posodobite le tista polja, ki jih želite spremeniti. Svojega uporabiškega imena ne morete spreminjati.
\ No newline at end of file
diff --git a/inc/lang/sl/uploadmail.txt b/inc/lang/sl/uploadmail.txt
new file mode 100644
index 0000000000000000000000000000000000000000..6006bd3795cd63d6a6d2c197e6035fa889850c88
--- /dev/null
+++ b/inc/lang/sl/uploadmail.txt
@@ -0,0 +1,13 @@
+Datoteka je bila naložena v vaš DokuWiki. Tu so podatki:
+
+Datoteka: @MEDIA@
+Datum: @DATE@
+Brskalnik: @BROWSER@
+IP naslov: @IPADDRESS@
+Ponudnik: @HOSTNAME@
+Velikost: @SIZE@
+MIME tip: @MIME@
+Uporabnik: @USER@
+
+--
+Sporočilo je generiral DokuWiki na naslovu @DOKUWIKIURL@
\ No newline at end of file
diff --git a/inc/lang/tr/lang.php b/inc/lang/tr/lang.php
index c6d20c80594617aeef5e8bc6470648b71d785e91..0c8c1ff3fe64fb565fed132ed0391c34838b4584 100644
--- a/inc/lang/tr/lang.php
+++ b/inc/lang/tr/lang.php
@@ -4,11 +4,10 @@
  *
  * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
  * @author Selim FarsakoÄŸlu <farsakogluselim@yahoo.de>
- * @author Aydın Coşkuner aydinweb@gmail.com
  * @author Aydın Coşkuner <aydinweb@gmail.com>
- * @author yavuzselim@gmail.com
- * @author Cihan Kahveci kahvecicihan@gmail.com
+ * @author Cihan Kahveci <kahvecicihan@gmail.com>
  * @author Yavuz Selim <yavuzselim@gmail.com>
+ * @author Caleb Maclennan <caleb@alerque.com>
  */
 $lang['encoding']              = 'utf-8';
 $lang['direction']             = 'ltr';
@@ -186,6 +185,9 @@ $lang['qb_h2']                 = '2. Seviye Başlık';
 $lang['qb_h3']                 = '3. Seviye Başlık';
 $lang['qb_h4']                 = '4. Seviye Başlık';
 $lang['qb_h5']                 = '5. Seviye Başlık';
+$lang['qb_h']                  = 'Başlık';
+$lang['qb_hs']                 = 'Başlığı seç';
+$lang['qb_hplus']              = 'Daha yüksek başlık';
 $lang['qb_link']               = 'İç Bağlantı';
 $lang['qb_extlink']            = 'Dış Bağlantı';
 $lang['qb_hr']                 = 'Yatay Çizgi';
diff --git a/inc/lang/vi/lang.php b/inc/lang/vi/lang.php
index 168fe3595fad08fa6de447a772d09f034f66c252..750433910208625dd3e872d7da46711d5da88a7d 100644
--- a/inc/lang/vi/lang.php
+++ b/inc/lang/vi/lang.php
@@ -103,4 +103,4 @@ $lang['qb_sig']     = 'Đặt chữ ký';
 $lang['js']['del_confirm']= 'Xoá mục này?';
 
 
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/inc/mail.php b/inc/mail.php
index fb163585a926482f8ab7d327209c33e16d62d0fe..aa9d195d13f233cab3e5f15392ed6a7f9b4ecbc0 100644
--- a/inc/mail.php
+++ b/inc/mail.php
@@ -37,14 +37,16 @@ if (!defined('PREG_PATTERN_VALID_EMAIL')) define('PREG_PATTERN_VALID_EMAIL', '['
  */
 function mail_setup(){
     global $conf;
-    global $INFO;
+    global $USERINFO;
 
     $replace = array();
 
-    if(!empty($INFO['userinfo']['mail'])){
-        $replace['@MAIL@'] = $INFO['userinfo']['mail'];
+    if(!empty($USERINFO['mail'])){
+        $replace['@MAIL@'] = $USERINFO['mail'];
     }else{
-        $replace['@MAIL@'] = 'noreply@'.parse_url(DOKU_URL,PHP_URL_HOST);
+        $host = @parse_url(DOKU_URL,PHP_URL_HOST);
+        if(!$host) $host = 'example.com';
+        $replace['@MAIL@'] = 'noreply@'.$host;
     }
 
     if(!empty($_SERVER['REMOTE_USER'])){
@@ -53,8 +55,8 @@ function mail_setup(){
         $replace['@USER@'] = 'noreply';
     }
 
-    if(!empty($INFO['userinfo']['name'])){
-        $replace['@NAME@'] = $INFO['userinfo']['name'];
+    if(!empty($USERINFO['name'])){
+        $replace['@NAME@'] = $USERINFO['name'];
     }else{
         $replace['@NAME@'] = '';
     }
@@ -225,6 +227,7 @@ function mail_encode_address($string,$header='',$names=true){
  */
 function mail_isvalid($email){
     $validator = new EmailAddressValidator;
+    $validator->allowLocalAddresses = true;
     return $validator->check_email_address($email);
 }
 
diff --git a/inc/pageutils.php b/inc/pageutils.php
index 42a485bdfd809ae35867a7c28a9947d5903504f6..cd01dcae75df09aeed779a04e5b0251507d9299f 100644
--- a/inc/pageutils.php
+++ b/inc/pageutils.php
@@ -311,14 +311,13 @@ function metaFN($id,$ext){
  * returns an array of full paths to all metafiles of a given ID
  *
  * @author Esther Brunner <esther@kaffeehaus.ch>
+ * @author Michael Hamann <michael@content-space.de>
  */
 function metaFiles($id){
-    $name   = noNS($id);
-    $ns     = getNS($id);
-    $dir    = ($ns) ? metaFN($ns,'').'/' : metaFN($ns,'');
-    $files  = array();
-    $files  = glob($dir.$name.'.*');
-    return $files;
+    $basename = metaFN($id, '');
+    $files    = glob($basename.'.*', GLOB_MARK);
+    // filter files like foo.bar.meta when $id == 'foo'
+    return    $files ? preg_grep('/^'.preg_quote($basename, '/').'\.[^.\/]*$/u', $files) : array();
 }
 
 /**
@@ -344,10 +343,13 @@ function mediaFN($id){
  */
 function localeFN($id){
     global $conf;
-    $file = DOKU_INC.'inc/lang/'.$conf['lang'].'/'.$id.'.txt';
+    $file = DOKU_CONF.'/lang/'.$conf['lang'].'/'.$id.'.txt';
     if(!@file_exists($file)){
-        //fall back to english
-        $file = DOKU_INC.'inc/lang/en/'.$id.'.txt';
+        $file = DOKU_INC.'inc/lang/'.$conf['lang'].'/'.$id.'.txt';
+        if(!@file_exists($file)){
+            //fall back to english
+            $file = DOKU_INC.'inc/lang/en/'.$id.'.txt';
+        }
     }
     return $file;
 }
diff --git a/inc/parser/handler.php b/inc/parser/handler.php
index a96e6b9dba1ff5406d94be39560d2a2103b81e4c..4d0b56b4452c161355bb454e05f2142aa3cdeee8 100644
--- a/inc/parser/handler.php
+++ b/inc/parser/handler.php
@@ -1707,4 +1707,4 @@ class Doku_Handler_Block {
     }
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/inc/parser/lexer.php b/inc/parser/lexer.php
index 211945d8f32a4f9bdc5802fbd47d8f4ceb2d3804..b5bcb9612e07417540bccb34e1284c87d760853f 100644
--- a/inc/parser/lexer.php
+++ b/inc/parser/lexer.php
@@ -597,4 +597,4 @@ function Doku_Lexer_Escape($str) {
     return preg_replace($chars, $escaped, $str);
 }
 
-//Setup VIM: ex: et ts=4 sw=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 sw=4 :
diff --git a/inc/parser/metadata.php b/inc/parser/metadata.php
index f635ea1d567496b0b271d2502cfb86cd13c1a2a3..fc2c8cbc5e9fd34633a4ce5d25359be31b03204c 100644
--- a/inc/parser/metadata.php
+++ b/inc/parser/metadata.php
@@ -45,6 +45,9 @@ class Doku_Renderer_metadata extends Doku_Renderer {
     if(!$this->persistent['date']['created']){
         $this->persistent['date']['created'] = filectime(wikiFN($ID));
     }
+    if(!isset($this->persistent['user'])){
+        $this->persistent['user'] = '';
+    }
     if(!isset($this->persistent['creator'])){
         $this->persistent['creator'] = '';
     }
@@ -461,7 +464,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
     } else if (is_string($title)){
       return $title;
     } else if (is_array($title)){
-      return '['.$title['title'].']';
+      if($title['title']) return '['.$title['title'].']';
     }
   }
 
@@ -479,4 +482,4 @@ class Doku_Renderer_metadata extends Doku_Renderer {
   }
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/inc/parser/parser.php b/inc/parser/parser.php
index 20f0e6ca3b1057e3743f2cba290b0c3bd5643ca0..b93760f3a74d9588613d56f615d9cb67e0884597 100644
--- a/inc/parser/parser.php
+++ b/inc/parser/parser.php
@@ -90,7 +90,6 @@ class Doku_Parser {
             if ( $mode == 'base' ) {
                 continue;
             }
-
             $this->modes[$mode]->preConnect();
 
             foreach ( array_keys($this->modes) as $cm ) {
@@ -218,11 +217,11 @@ class Doku_Parser_Mode_footnote extends Doku_Parser_Mode {
 //-------------------------------------------------------------------
 class Doku_Parser_Mode_header extends Doku_Parser_Mode {
 
-    function preConnect() {
+    function connectTo($mode) {
         //we're not picky about the closing ones, two are enough
         $this->Lexer->addSpecialPattern(
                             '[ \t]*={2,}[^\n]+={2,}[ \t]*(?=\n)',
-                            'base',
+                            $mode,
                             'header'
                         );
     }
@@ -957,4 +956,4 @@ class Doku_Parser_Mode_emaillink extends Doku_Parser_Mode {
 }
 
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/inc/parser/renderer.php b/inc/parser/renderer.php
index a178b2457cb4d3e79d763ab8a8122307c1e0c852..7002fd0cb938418f35a5a249b6f86287a957d449 100644
--- a/inc/parser/renderer.php
+++ b/inc/parser/renderer.php
@@ -319,4 +319,4 @@ class Doku_Renderer extends DokuWiki_Plugin {
 }
 
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
index 37900b2c3aa189def65d00f1d76ceb13b6766c97..9405d94208967f35b4bdcdbb97eefc70e22b9870 100644
--- a/inc/parser/xhtml.php
+++ b/inc/parser/xhtml.php
@@ -734,9 +734,9 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
 
         $name = $this->_getLinkTitle($name, '', $isImage);
         if ( !$isImage ) {
-            $link['class']='mail JSnocheck';
+            $link['class']='mail';
         } else {
-            $link['class']='media JSnocheck';
+            $link['class']='media';
         }
 
         $address = $this->_xmlEntities($address);
@@ -1205,4 +1205,4 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
 
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/inc/parser/xhtmlsummary.php b/inc/parser/xhtmlsummary.php
index b187fef019d7968cdb18ae9f8473b69e2f453606..95f86cbef6c1d30aab40ce0457aac160ad597562 100644
--- a/inc/parser/xhtmlsummary.php
+++ b/inc/parser/xhtmlsummary.php
@@ -87,4 +87,4 @@ class Doku_Renderer_xhtmlsummary extends Doku_Renderer_xhtml {
 }
 
 
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/inc/parserutils.php b/inc/parserutils.php
index a50e3f4f348ddf5664a4c98b33188e9cef3f42ed..6e349e9841e425905d0b61e54039ec02f875c18f 100644
--- a/inc/parserutils.php
+++ b/inc/parserutils.php
@@ -9,6 +9,13 @@
 
 if(!defined('DOKU_INC')) die('meh.');
 
+/**
+ * For how many different pages shall the first heading be loaded from the
+ * metadata? When this limit is reached the title index is loaded and used for
+ * all following requests.
+ */
+if (!defined('P_GET_FIRST_HEADING_METADATA_LIMIT')) define('P_GET_FIRST_HEADING_METADATA_LIMIT', 10);
+
 /**
  * Returns the parsed Wikitext in XHTML for the given id and revision.
  *
@@ -220,9 +227,15 @@ function p_get_instructions($text){
 /**
  * returns the metadata of a page
  *
+ * @param string $id The id of the page the metadata should be returned from
+ * @param string $key The key of the metdata value that shall be read (by default everything) - separate hierarchies by " " like "date created"
+ * @param boolean $render If the page should be rendererd when the cache can't be used - default true
+ * @return mixed The requested metadata fields
+ *
  * @author Esther Brunner <esther@kaffeehaus.ch>
+ * @author Michael Hamann <michael@content-space.de>
  */
-function p_get_metadata($id, $key='', $render=false){
+function p_get_metadata($id, $key='', $render=true){
     global $ID;
 
     // cache the current page
@@ -231,10 +244,26 @@ function p_get_metadata($id, $key='', $render=false){
     $cache = ($ID == $id);
     $meta = p_read_metadata($id, $cache);
 
-    // metadata has never been rendered before - do it! (but not for non-existent pages)
-    if ($render && !isset($meta['current']['description']['abstract']) && page_exists($id)){
-        $meta = p_render_metadata($id, $meta);
-        p_save_metadata($id, $meta);
+    // prevent recursive calls in the cache
+    static $recursion = false;
+    if (!$recursion && $render){
+        $recursion = true;
+
+        $cachefile = new cache_renderer($id, wikiFN($id), 'metadata');
+
+        if (page_exists($id) && !$cachefile->useCache()){
+            $old_meta = $meta;
+            $meta = p_render_metadata($id, $meta);
+            // only update the file when the metadata has been changed
+            if ($meta == $old_meta || p_save_metadata($id, $meta)) {
+                // store a timestamp in order to make sure that the cachefile is touched
+                $cachefile->storeCache(time());
+            } else {
+                msg('Unable to save metadata file. Hint: disk full; file permissions; safe_mode setting.',-1);
+            }
+        }
+
+        $recursion = false;
     }
 
     $val = $meta['current'];
@@ -603,9 +632,41 @@ function & p_get_renderer($mode) {
  *                                               headings ... and so on.
  *
  * @author Andreas Gohr <andi@splitbrain.org>
+ * @author Michael Hamann <michael@content-space.de>
  */
 function p_get_first_heading($id, $render=true){
-    return p_get_metadata($id,'title',$render);
+    // counter how many titles have been requested using p_get_metadata
+    static $count = 1;
+    // the index of all titles, only loaded when many titles are requested
+    static $title_index = null;
+    // cache for titles requested using p_get_metadata
+    static $title_cache = array();
+
+    $id = cleanID($id);
+
+    // check if this title has already been requested
+    if (isset($title_cache[$id]))
+      return $title_cache[$id];
+
+    // check if already too many titles have been requested and probably
+    // using the title index is better
+    if ($count > P_GET_FIRST_HEADING_METADATA_LIMIT) {
+        if (is_null($title_index)) {
+            $pages  = array_map('rtrim', idx_getIndex('page', ''));
+            $titles = array_map('rtrim', idx_getIndex('title', ''));
+            // check for corrupt title index #FS2076
+            if(count($pages) != count($titles)){
+                $titles = array_fill(0,count($pages),'');
+                @unlink($conf['indexdir'].'/title.idx'); // will be rebuilt in inc/init.php
+            }
+            $title_index = array_combine($pages, $titles);
+        }
+        return $title_index[$id];
+    }
+
+    ++$count;
+    $title_cache[$id] = p_get_metadata($id,'title',$render);
+    return $title_cache[$id];
 }
 
 /**
diff --git a/inc/plugin.php b/inc/plugin.php
index aff07c1e562c4aa877eac35c92367142616d62fe..628ae39b03a9b88a4eed369f0be545882a810971 100644
--- a/inc/plugin.php
+++ b/inc/plugin.php
@@ -88,10 +88,13 @@ class DokuWiki_Plugin {
     function localFN($id) {
         global $conf;
         $plugin = $this->getPluginName();
-        $file = DOKU_PLUGIN.$plugin.'/lang/'.$conf['lang'].'/'.$id.'.txt';
-        if(!@file_exists($file)){
-            //fall back to english
-            $file = DOKU_PLUGIN.$plugin.'/lang/en/'.$id.'.txt';
+        $file = DOKU_CONF.'/plugin_lang/'.$plugin.'/'.$conf['lang'].'/'.$id.'.txt';
+        if (!@file_exists($file)){
+            $file = DOKU_PLUGIN.$plugin.'/lang/'.$conf['lang'].'/'.$id.'.txt';
+            if(!@file_exists($file)){
+                //fall back to english
+                $file = DOKU_PLUGIN.$plugin.'/lang/en/'.$id.'.txt';
+            }
         }
         return $file;
     }
diff --git a/inc/search.php b/inc/search.php
index a6787c5d220bdce518866f0488cd4a8906fb0d65..db0b008f07b38bc1a9b5ac59b22ce8a5e7436b05 100644
--- a/inc/search.php
+++ b/inc/search.php
@@ -624,4 +624,4 @@ function search_universal(&$data,$base,$file,$type,$lvl,$opts){
     return $return;
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/inc/subscription.php b/inc/subscription.php
index 08d4cb241703167d94eb895fc78eaf534efe1cb2..1b547655321b6ff48649f18d87e2dcda7e478c15 100644
--- a/inc/subscription.php
+++ b/inc/subscription.php
@@ -46,7 +46,7 @@ function subscription_filename($id) {
  */
 function subscription_lock_filename ($id){
     global $conf;
-    return $conf['lockdir'].'/_subscr_' . $id . '.lock';
+    return $conf['lockdir'].'/_subscr_' . md5($id) . '.lock';
 }
 
 function subscription_lock($id) {
diff --git a/inc/template.php b/inc/template.php
index e2ea6e386a9a79ca89bfa796ae14519cfdfd9acd..6d25a7171fca1547a85530a06d9901bc0bd5ccbd 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -685,7 +685,7 @@ function tpl_searchform($ajax=true,$autocomplete=true){
  *
  * @author Andreas Gohr <andi@splitbrain.org>
  */
-function tpl_breadcrumbs($sep='&raquo;'){
+function tpl_breadcrumbs($sep='&diams;'){
     global $lang;
     global $conf;
 
@@ -748,39 +748,27 @@ function tpl_youarehere($sep=' &raquo; '){
     echo '<span class="bchead">'.$lang['youarehere'].': </span>';
 
     // always print the startpage
-    $title = useHeading('navigation') ? p_get_first_heading($conf['start']) : $conf['start'];
-    if(!$title) $title = $conf['start'];
-    tpl_link(wl($conf['start']),hsc($title),'title="'.$conf['start'].'"');
+    tpl_pagelink(':'.$conf['start']);
 
     // print intermediate namespace links
     $part = '';
     for($i=0; $i<$count - 1; $i++){
         $part .= $parts[$i].':';
         $page = $part;
-        resolve_pageid('',$page,$exists);
         if ($page == $conf['start']) continue; // Skip startpage
 
         // output
         echo $sep;
-        if($exists){
-            $title = useHeading('navigation') ? p_get_first_heading($page) : $parts[$i];
-            tpl_link(wl($page),hsc($title),'title="'.$page.'"');
-        }else{
-            tpl_link(wl($page),$parts[$i],'title="'.$page.'" class="wikilink2" rel="nofollow"');
-        }
+        tpl_pagelink($page);
     }
 
     // print current page, skipping start page, skipping for namespace index
+    resolve_pageid('',$page,$exists);
     if(isset($page) && $page==$part.$parts[$i]) return;
     $page = $part.$parts[$i];
     if($page == $conf['start']) return;
     echo $sep;
-    if(page_exists($page)){
-        $title = useHeading('navigation') ? p_get_first_heading($page) : $parts[$i];
-        tpl_link(wl($page),hsc($title),'title="'.$page.'"');
-    }else{
-        tpl_link(wl($page),$parts[$i],'title="'.$page.'" class="wikilink2" rel="nofollow"');
-    }
+    tpl_pagelink($page);
     return true;
 }
 
@@ -1000,8 +988,6 @@ function tpl_indexerWebBug(){
     global $INFO;
     if(!$INFO['exists']) return false;
 
-    if(isHiddenPage($ID)) return false; //no need to index hidden pages
-
     $p = array();
     $p['src']    = DOKU_BASE.'lib/exe/indexer.php?id='.rawurlencode($ID).
         '&'.time();
@@ -1248,7 +1234,7 @@ function tpl_license($img='badge',$imgonly=false,$return=false){
     }
     if(!$imgonly) {
         $out .= $lang['license'];
-        $out .= '<a href="'.$lic['url'].'" rel="license" class="urlextern"';
+        $out .= ' <a href="'.$lic['url'].'" rel="license" class="urlextern"';
         if($conf['target']['extern']) $out .= ' target="'.$conf['target']['extern'].'"';
         $out .= '>'.$lic['name'].'</a>';
     }
@@ -1372,5 +1358,5 @@ function tpl_getFavicon() {
 }
 
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
 
diff --git a/inc/toolbar.php b/inc/toolbar.php
index 8bcf6f030f17767325b1a3fe3530665c22355494..58d80043c1e08162130b55fee7e2b396ccdece3f 100644
--- a/inc/toolbar.php
+++ b/inc/toolbar.php
@@ -252,4 +252,4 @@ function toolbar_signature(){
     return $sig;
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/install.php b/install.php
index ef3c848a958d3dc6d5e5ab8e774fceb94b89858f..9b852977fd18c5430eb4dce34b0cde06b01fb67f 100644
--- a/install.php
+++ b/install.php
@@ -460,7 +460,8 @@ function check_functions(){
                          'glob header ignore_user_abort ini_get mail mkdir '.
                          'ob_start opendir parse_ini_file readfile realpath '.
                          'rename rmdir serialize session_start unlink usleep '.
-                         'preg_replace file_get_contents htmlspecialchars_decode');
+                         'preg_replace file_get_contents htmlspecialchars_decode '.
+                         'spl_autoload_register');
 
     if (!function_exists('mb_substr')) {
         $funcs[] = 'utf8_encode';
diff --git a/lib/exe/ajax.php b/lib/exe/ajax.php
index e9c59ca5d2b5c7796177d50bd32a6593d9bba0b8..1939a7bcb166577fe9c1b6c5192e7a55eb472315 100644
--- a/lib/exe/ajax.php
+++ b/lib/exe/ajax.php
@@ -8,7 +8,7 @@
 
 //fix for Opera XMLHttpRequests
 if(!count($_POST) && !empty($HTTP_RAW_POST_DATA)){
-  parse_str($HTTP_RAW_POST_DATA, $_POST);
+    parse_str($HTTP_RAW_POST_DATA, $_POST);
 }
 
 if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../');
@@ -20,25 +20,25 @@ header('Content-Type: text/html; charset=utf-8');
 
 
 //call the requested function
-if(isset($_POST['call']))
-  $call = $_POST['call'];
-else if(isset($_GET['call']))
-  $call = $_GET['call'];
-else
-  exit;
-
+if(isset($_POST['call'])){
+    $call = $_POST['call'];
+}else if(isset($_GET['call'])){
+    $call = $_GET['call'];
+}else{
+    exit;
+}
 $callfn = 'ajax_'.$call;
 
 if(function_exists($callfn)){
-  $callfn();
+    $callfn();
 }else{
-  $evt = new Doku_Event('AJAX_CALL_UNKNOWN', $call);
-  if ($evt->advise_before()) {
-    print "AJAX call '".htmlspecialchars($call)."' unknown!\n";
-    exit;
-  }
-  $evt->advise_after();
-  unset($evt);
+    $evt = new Doku_Event('AJAX_CALL_UNKNOWN', $call);
+    if ($evt->advise_before()) {
+        print "AJAX call '".htmlspecialchars($call)."' unknown!\n";
+        exit;
+    }
+    $evt->advise_after();
+    unset($evt);
 }
 
 /**
@@ -47,33 +47,33 @@ if(function_exists($callfn)){
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 function ajax_qsearch(){
-  global $conf;
-  global $lang;
-
-  $query = $_POST['q'];
-  if(empty($query)) $query = $_GET['q'];
-  if(empty($query)) return;
-
-  $data = ft_pageLookup($query, true, useHeading('navigation'));
-
-  if(!count($data)) return;
-
-  print '<strong>'.$lang['quickhits'].'</strong>';
-  print '<ul>';
-  foreach($data as $id => $title){
-    if (useHeading('navigation')) {
-        $name = $title;
-    } else {
-        $ns = getNS($id);
-        if($ns){
-          $name = shorten(noNS($id), ' ('.$ns.')',30);
-        }else{
-          $name = $id;
+    global $conf;
+    global $lang;
+
+    $query = $_POST['q'];
+    if(empty($query)) $query = $_GET['q'];
+    if(empty($query)) return;
+
+    $data = ft_pageLookup($query, true, useHeading('navigation'));
+
+    if(!count($data)) return;
+
+    print '<strong>'.$lang['quickhits'].'</strong>';
+    print '<ul>';
+    foreach($data as $id => $title){
+        if (useHeading('navigation')) {
+            $name = $title;
+        } else {
+            $ns = getNS($id);
+            if($ns){
+                $name = noNS($id).' ('.$ns.')';
+            }else{
+                $name = $id;
+            }
         }
+        echo '<li>' . html_wikilink(':'.$id,$name) . '</li>';
     }
-    echo '<li>' . html_wikilink(':'.$id,$name) . '</li>';
-  }
-  print '</ul>';
+    print '</ul>';
 }
 
 /**
@@ -83,36 +83,36 @@ function ajax_qsearch(){
  * @author Mike Frysinger <vapier@gentoo.org>
  */
 function ajax_suggestions() {
-  global $conf;
-  global $lang;
-
-  $query = cleanID($_POST['q']);
-  if(empty($query)) $query = cleanID($_GET['q']);
-  if(empty($query)) return;
-
-  $data = array();
-  $data = ft_pageLookup($query);
-  if(!count($data)) return;
-  $data = array_keys($data);
-
-  // limit results to 15 hits
-  $data = array_slice($data, 0, 15);
-  $data = array_map('trim',$data);
-  $data = array_map('noNS',$data);
-  $data = array_unique($data);
-  sort($data);
-
-  /* now construct a json */
-  $suggestions = array(
-    $query,  // the original query
-    $data,   // some suggestions
-    array(), // no description
-    array()  // no urls
-  );
-  $json = new JSON();
-
-  header('Content-Type: application/x-suggestions+json');
-  print $json->encode($suggestions);
+    global $conf;
+    global $lang;
+
+    $query = cleanID($_POST['q']);
+    if(empty($query)) $query = cleanID($_GET['q']);
+    if(empty($query)) return;
+
+    $data = array();
+    $data = ft_pageLookup($query);
+    if(!count($data)) return;
+    $data = array_keys($data);
+
+    // limit results to 15 hits
+    $data = array_slice($data, 0, 15);
+    $data = array_map('trim',$data);
+    $data = array_map('noNS',$data);
+    $data = array_unique($data);
+    sort($data);
+
+    /* now construct a json */
+    $suggestions = array(
+                        $query,  // the original query
+                        $data,   // some suggestions
+                        array(), // no description
+                        array()  // no urls
+                   );
+    $json = new JSON();
+
+    header('Content-Type: application/x-suggestions+json');
+    print $json->encode($suggestions);
 }
 
 /**
@@ -121,32 +121,32 @@ function ajax_suggestions() {
  * Andreas Gohr <andi@splitbrain.org>
  */
 function ajax_lock(){
-  global $conf;
-  global $lang;
-  $id = cleanID($_POST['id']);
-  if(empty($id)) return;
-
-  if(!checklock($id)){
-    lock($id);
-    echo 1;
-  }
-
-  if($conf['usedraft'] && $_POST['wikitext']){
-    $client = $_SERVER['REMOTE_USER'];
-    if(!$client) $client = clientIP(true);
+    global $conf;
+    global $lang;
+    $id = cleanID($_POST['id']);
+    if(empty($id)) return;
+
+    if(!checklock($id)){
+        lock($id);
+        echo 1;
+    }
 
-    $draft = array('id'     => $id,
-                   'prefix' => substr($_POST['prefix'], 0, -1),
-                   'text'   => $_POST['wikitext'],
-                   'suffix' => $_POST['suffix'],
-                   'date'   => (int) $_POST['date'],
-                   'client' => $client,
-                  );
-    $cname = getCacheName($draft['client'].$id,'.draft');
-    if(io_saveFile($cname,serialize($draft))){
-      echo $lang['draftdate'].' '.dformat();
+    if($conf['usedraft'] && $_POST['wikitext']){
+        $client = $_SERVER['REMOTE_USER'];
+        if(!$client) $client = clientIP(true);
+
+        $draft = array('id'     => $id,
+                'prefix' => substr($_POST['prefix'], 0, -1),
+                'text'   => $_POST['wikitext'],
+                'suffix' => $_POST['suffix'],
+                'date'   => (int) $_POST['date'],
+                'client' => $client,
+                );
+        $cname = getCacheName($draft['client'].$id,'.draft');
+        if(io_saveFile($cname,serialize($draft))){
+            echo $lang['draftdate'].' '.dformat();
+        }
     }
-  }
 
 }
 
@@ -156,14 +156,14 @@ function ajax_lock(){
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 function ajax_draftdel(){
-  $id = cleanID($_REQUEST['id']);
-  if(empty($id)) return;
+    $id = cleanID($_REQUEST['id']);
+    if(empty($id)) return;
 
-  $client = $_SERVER['REMOTE_USER'];
-  if(!$client) $client = clientIP(true);
+    $client = $_SERVER['REMOTE_USER'];
+    if(!$client) $client = clientIP(true);
 
-  $cname = getCacheName($client.$id,'.draft');
-  @unlink($cname);
+    $cname = getCacheName($client.$id,'.draft');
+    @unlink($cname);
 }
 
 /**
@@ -172,22 +172,22 @@ function ajax_draftdel(){
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 function ajax_medians(){
-  global $conf;
-
-  // wanted namespace
-  $ns  = cleanID($_POST['ns']);
-  $dir  = utf8_encodeFN(str_replace(':','/',$ns));
-
-  $lvl = count(explode(':',$ns));
-
-  $data = array();
-  search($data,$conf['mediadir'],'search_index',array('nofiles' => true),$dir);
-  foreach($data as $item){
-    $item['level'] = $lvl+1;
-    echo media_nstree_li($item);
-    echo media_nstree_item($item);
-    echo '</li>';
-  }
+    global $conf;
+
+    // wanted namespace
+    $ns  = cleanID($_POST['ns']);
+    $dir  = utf8_encodeFN(str_replace(':','/',$ns));
+
+    $lvl = count(explode(':',$ns));
+
+    $data = array();
+    search($data,$conf['mediadir'],'search_index',array('nofiles' => true),$dir);
+    foreach($data as $item){
+        $item['level'] = $lvl+1;
+        echo media_nstree_li($item);
+        echo media_nstree_item($item);
+        echo '</li>';
+    }
 }
 
 /**
@@ -196,11 +196,11 @@ function ajax_medians(){
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 function ajax_medialist(){
-  global $conf;
-  global $NS;
+    global $conf;
+    global $NS;
 
-  $NS = $_POST['ns'];
-  tpl_mediaContent(true);
+    $NS = $_POST['ns'];
+    tpl_mediaContent(true);
 }
 
 /**
@@ -209,24 +209,24 @@ function ajax_medialist(){
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 function ajax_index(){
-  global $conf;
-
-  // wanted namespace
-  $ns  = cleanID($_POST['idx']);
-  $dir  = utf8_encodeFN(str_replace(':','/',$ns));
-
-  $lvl = count(explode(':',$ns));
-
-  $data = array();
-  search($data,$conf['datadir'],'search_index',array('ns' => $ns),$dir);
-  foreach($data as $item){
-    $item['level'] = $lvl+1;
-    echo html_li_index($item);
-    echo '<div class="li">';
-    echo html_list_index($item);
-    echo '</div>';
-    echo '</li>';
-  }
+    global $conf;
+
+    // wanted namespace
+    $ns  = cleanID($_POST['idx']);
+    $dir  = utf8_encodeFN(str_replace(':','/',$ns));
+
+    $lvl = count(explode(':',$ns));
+
+    $data = array();
+    search($data,$conf['datadir'],'search_index',array('ns' => $ns),$dir);
+    foreach($data as $item){
+        $item['level'] = $lvl+1;
+        echo html_li_index($item);
+        echo '<div class="li">';
+        echo html_list_index($item);
+        echo '</div>';
+        echo '</li>';
+    }
 }
 
 /**
@@ -235,108 +235,106 @@ function ajax_index(){
  * @author Andreas Gohr <gohr@cosmocode.de>
  */
 function ajax_linkwiz(){
-  global $conf;
-  global $lang;
-
-  $q  = ltrim($_POST['q'],':');
-  $id = noNS($q);
-  $ns = getNS($q);
-
-  $ns = cleanID($ns);
-  $id = cleanID($id);
-
-  $nsd  = utf8_encodeFN(str_replace(':','/',$ns));
-  $idd  = utf8_encodeFN(str_replace(':','/',$id));
-
-  $data = array();
-  if($q && !$ns){
-
-    // use index to lookup matching pages
-    $pages = array();
-    $pages = ft_pageLookup($id,true);
-
-    // result contains matches in pages and namespaces
-    // we now extract the matching namespaces to show
-    // them seperately
-    $dirs  = array();
-
-
-    foreach($pages as $pid => $title){
-      if(strpos(noNS($pid),$id) === false){
-        // match was in the namespace
-        $dirs[getNS($pid)] = 1; // assoc array avoids dupes
-      }else{
-        // it is a matching page, add it to the result
-        $data[] = array(
-          'id'    => $pid,
-          'title' => $title,
-          'type'  => 'f',
-        );
-      }
-      unset($pages[$pid]);
-    }
-    foreach($dirs as $dir => $junk){
-      $data[] = array(
-        'id'   => $dir,
-        'type' => 'd',
-      );
-    }
+    global $conf;
+    global $lang;
+
+    $q  = ltrim($_POST['q'],':');
+    $id = noNS($q);
+    $ns = getNS($q);
+
+    $ns = cleanID($ns);
+    $id = cleanID($id);
+
+    $nsd  = utf8_encodeFN(str_replace(':','/',$ns));
+    $idd  = utf8_encodeFN(str_replace(':','/',$id));
+
+    $data = array();
+    if($q && !$ns){
+
+        // use index to lookup matching pages
+        $pages = array();
+        $pages = ft_pageLookup($id,true);
+
+        // result contains matches in pages and namespaces
+        // we now extract the matching namespaces to show
+        // them seperately
+        $dirs  = array();
+
+        foreach($pages as $pid => $title){
+            if(strpos(noNS($pid),$id) === false){
+                // match was in the namespace
+                $dirs[getNS($pid)] = 1; // assoc array avoids dupes
+            }else{
+                // it is a matching page, add it to the result
+                $data[] = array(
+                        'id'    => $pid,
+                        'title' => $title,
+                        'type'  => 'f',
+                        );
+            }
+            unset($pages[$pid]);
+        }
+        foreach($dirs as $dir => $junk){
+            $data[] = array(
+                    'id'   => $dir,
+                    'type' => 'd',
+                    );
+        }
 
-  }else{
-
-    $opts = array(
-      'depth' => 1,
-      'listfiles' => true,
-      'listdirs'  => true,
-      'pagesonly' => true,
-      'firsthead' => true,
-      'sneakyacl' => $conf['sneaky_index'],
-    );
-    if($id) $opts['filematch'] = '^.*\/'.$id;
-    if($id) $opts['dirmatch']  = '^.*\/'.$id;
-    search($data,$conf['datadir'],'search_universal',$opts,$nsd);
-
-    // add back to upper
-    if($ns){
-        array_unshift($data,array(
-            'id'   => getNS($ns),
-            'type' => 'u',
-        ));
-    }
-  }
+    }else{
 
-  // fixme sort results in a useful way ?
+        $opts = array(
+                'depth' => 1,
+                'listfiles' => true,
+                'listdirs'  => true,
+                'pagesonly' => true,
+                'firsthead' => true,
+                'sneakyacl' => $conf['sneaky_index'],
+                );
+        if($id) $opts['filematch'] = '^.*\/'.$id;
+        if($id) $opts['dirmatch']  = '^.*\/'.$id;
+        search($data,$conf['datadir'],'search_universal',$opts,$nsd);
+
+        // add back to upper
+        if($ns){
+            array_unshift($data,array(
+                        'id'   => getNS($ns),
+                        'type' => 'u',
+                        ));
+        }
+    }
 
-  if(!count($data)){
-    echo $lang['nothingfound'];
-    exit;
-  }
+    // fixme sort results in a useful way ?
 
-  // output the found data
-  $even = 1;
-  foreach($data as $item){
-    $even *= -1; //zebra
+    if(!count($data)){
+        echo $lang['nothingfound'];
+        exit;
+    }
 
-    if(($item['type'] == 'd' || $item['type'] == 'u') && $item['id']) $item['id'] .= ':';
-    $link = wl($item['id']);
+    // output the found data
+    $even = 1;
+    foreach($data as $item){
+        $even *= -1; //zebra
 
-    echo '<div class="'.(($even > 0)?'even':'odd').' type_'.$item['type'].'">';
+        if(($item['type'] == 'd' || $item['type'] == 'u') && $item['id']) $item['id'] .= ':';
+        $link = wl($item['id']);
 
+        echo '<div class="'.(($even > 0)?'even':'odd').' type_'.$item['type'].'">';
 
-    if($item['type'] == 'u'){
-        $name = $lang['upperns'];
-    }else{
-        $name = htmlspecialchars($item['id']);
-    }
+        if($item['type'] == 'u'){
+            $name = $lang['upperns'];
+        }else{
+            $name = htmlspecialchars($item['id']);
+        }
 
-    echo '<a href="'.$link.'" title="'.htmlspecialchars($item['id']).'" class="wikilink1">'.$name.'</a>';
+        echo '<a href="'.$link.'" title="'.htmlspecialchars($item['id']).'" class="wikilink1">'.$name.'</a>';
 
-    if($item['title']){
-      echo '<span>'.htmlspecialchars($item['title']).'</span>';
+        if($item['title']){
+            echo '<span>'.htmlspecialchars($item['title']).'</span>';
+        }
+        echo '</div>';
     }
-    echo '</div>';
-  }
 
 }
 
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/lib/exe/css.php b/lib/exe/css.php
index 76f40c7bb77426c1536ee2ba9a7b3a586133c1a5..4db81de0b4835cddc60c2f8b03c56d4ff96b48eb 100644
--- a/lib/exe/css.php
+++ b/lib/exe/css.php
@@ -122,6 +122,9 @@ function css_out(){
 
     // apply style replacements
     $css = css_applystyle($css,$tplinc);
+    
+    // place all @import statements at the top of the file
+    $css = css_moveimports($css);
 
     // compress whitespace and comments
     if($conf['compress']){
@@ -264,7 +267,8 @@ function css_loadfile($file,$location=''){
     $css = io_readFile($file);
     if(!$location) return $css;
 
-    $css = preg_replace('#(url\([ \'"]*)((?!/|http://|https://| |\'|"))#','\\1'.$location.'\\3',$css);
+    $css = preg_replace('#(url\([ \'"]*)(?!/|http://|https://| |\'|")#','\\1'.$location,$css);
+    $css = preg_replace('#(@import\s+[\'"])(?!/|http://|https://)#', '\\1'.$location, $css);
     return $css;
 }
 
@@ -296,6 +300,29 @@ function css_pluginstyles($mode='screen'){
     return $list;
 }
 
+/**
+ * Move all @import statements in a combined stylesheet to the top so they
+ * aren't ignored by the browser. 
+ *
+ * @author Gabriel Birke <birke@d-scribe.de>
+ */
+function css_moveimports($css)
+{
+    if(!preg_match_all('/@import\s+(?:url\([^)]+\)|"[^"]+")\s*[^;]*;\s*/', $css, $matches, PREG_OFFSET_CAPTURE)) {
+        return $css;
+    }
+    $newCss  = "";
+    $imports = "";
+    $offset  = 0;
+    foreach($matches[0] as $match) {
+        $newCss  .= substr($css, $offset, $match[1] - $offset);
+        $imports .= $match[0];
+        $offset   = $match[1] + strlen($match[0]);
+    }
+    $newCss .= substr($css, $offset);
+    return $imports.$newCss;
+}
+
 /**
  * Very simple CSS optimizer
  *
@@ -330,4 +357,4 @@ function css_comment_cb($matches){
     return $matches[0];
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/lib/exe/fetch.php b/lib/exe/fetch.php
index 680fd9ae41473a3165cad562bc153838e1507377..3ad4f19371dcadddf5a8a854b59b33958c49f0fb 100644
--- a/lib/exe/fetch.php
+++ b/lib/exe/fetch.php
@@ -198,4 +198,4 @@ function calc_cache($cache){
   return -1; //cache endless
 }
 
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php
index a5a7d6b2a501ad92e9b32177053645e4c66a6065..95e2af05ba10e10d164b4e603595411be5eeb78f 100644
--- a/lib/exe/indexer.php
+++ b/lib/exe/indexer.php
@@ -31,7 +31,6 @@ $tmp = array(); // No event data
 $evt = new Doku_Event('INDEXER_TASKS_RUN', $tmp);
 if ($evt->advise_before()) {
   runIndexer() or
-  metaUpdate() or
   runSitemapper() or
   sendDigest() or
   runTrimRecentChanges() or
@@ -138,51 +137,6 @@ function runIndexer(){
     return idx_addPage($ID, true);
 }
 
-/**
- * Will render the metadata for the page if not exists yet
- *
- * This makes sure pages which are created from outside DokuWiki will
- * gain their data when viewed for the first time.
- */
-function metaUpdate(){
-    global $ID;
-    print "metaUpdate(): started".NL;
-
-    if(!$ID) return false;
-    $file = metaFN($ID, '.meta');
-    echo "meta file: $file".NL;
-
-    // rendering needed?
-    if (@file_exists($file)) return false;
-    if (!page_exists($ID)) return false;
-
-    global $conf;
-
-    // gather some additional info from changelog
-    $info = io_grep($conf['changelog'],
-                    '/^(\d+)\t(\d+\.\d+\.\d+\.\d+)\t'.preg_quote($ID,'/').'\t([^\t]+)\t([^\t\n]+)/',
-                    0,true);
-
-    $meta = array();
-    if(!empty($info)){
-        $meta['date']['created'] = $info[0][1];
-        foreach($info as $item){
-            if($item[4] != '*'){
-                $meta['date']['modified'] = $item[1];
-                if($item[3]){
-                    $meta['contributor'][$item[3]] = $item[3];
-                }
-            }
-        }
-    }
-
-    $meta = p_render_metadata($ID, $meta);
-    p_save_metadata($ID, $meta);
-
-    echo "metaUpdate(): finished".NL;
-    return true;
-}
-
 /**
  * Builds a Google Sitemap of all public pages known to the indexer
  *
@@ -312,6 +266,6 @@ function sendGIF(){
     // Thinks it's got the whole image
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
 // No trailing PHP closing tag - no output please!
 // See Note at http://www.php.net/manual/en/language.basic-syntax.instruction-separation.php
diff --git a/lib/exe/js.php b/lib/exe/js.php
index f9682e1e9c0ce06de2c3796c9d0b093f94109e08..117021308da6b0e3673c7a5a79a7b3251d0d0115 100644
--- a/lib/exe/js.php
+++ b/lib/exe/js.php
@@ -396,4 +396,4 @@ function js_compress($s){
     return trim($result);
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/lib/exe/opensearch.php b/lib/exe/opensearch.php
index f16b4f6812037c1979bb8de63811d650221010f9..03a1632c4e0703253e6343f828ae045c82e125ae 100644
--- a/lib/exe/opensearch.php
+++ b/lib/exe/opensearch.php
@@ -35,4 +35,4 @@ echo '  <Url type="application/x-suggestions+json" template="'.
         DOKU_URL.'lib/exe/ajax.php?call=suggestions&amp;q={searchTerms}" />'.NL;
 echo '</OpenSearchDescription>'.NL;
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php
index 84068f96e59a6f9b7ac1f196f5a3ee668fe91e13..3d275cb2b7f29af89539116847132712ff69e1e4 100644
--- a/lib/exe/xmlrpc.php
+++ b/lib/exe/xmlrpc.php
@@ -7,7 +7,7 @@ if(isset($HTTP_RAW_POST_DATA)) $HTTP_RAW_POST_DATA = trim($HTTP_RAW_POST_DATA);
 /**
  * Increased whenever the API is changed
  */
-define('DOKU_XMLRPC_API_VERSION',4);
+define('DOKU_XMLRPC_API_VERSION',5);
 
 require_once(DOKU_INC.'inc/init.php');
 session_write_close();  //close session
@@ -143,6 +143,13 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
             true
         );
 
+        $this->addCallback(
+            'dokuwiki.appendPage',
+            'this:appendPage',
+            array('int', 'string', 'string', 'struct'),
+            'Append text to a wiki page.'
+        );
+
         /* Wiki API v2 http://www.jspwiki.org/wiki/WikiRPCInterface2 */
         $this->addCallback(
             'wiki.getRPCVersionSupported',
@@ -289,6 +296,7 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
      * Return a raw wiki page
      */
     function rawPage($id,$rev=''){
+        $id = cleanID($id);
         if(auth_quickaclcheck($id) < AUTH_READ){
             return new IXR_Error(1, 'You are not allowed to read this page');
         }
@@ -344,6 +352,7 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
      * Return a wiki page rendered to html
      */
     function htmlPage($id,$rev=''){
+        $id = cleanID($id);
         if(auth_quickaclcheck($id) < AUTH_READ){
             return new IXR_Error(1, 'You are not allowed to read this page');
         }
@@ -480,6 +489,7 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
      * Return some basic data about a page
      */
     function pageInfo($id,$rev=''){
+        $id = cleanID($id);
         if(auth_quickaclcheck($id) < AUTH_READ){
             return new IXR_Error(1, 'You are not allowed to read this page');
         }
@@ -556,12 +566,24 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
         return 0;
     }
 
+    /**
+     * Appends text to a wiki page.
+     */
+    function appendPage($id, $text, $params) {
+        $currentpage = $this->rawPage($id);
+        if (!is_string($currentpage)) {
+            return $currentpage;
+        }
+        return $this->putPage($id, $currentpage.$text, $params);
+    }
+
     /**
      * Uploads a file to the wiki.
      *
      * Michael Klier <chi@chimeric.de>
      */
     function putAttachment($id, $file, $params) {
+        $id = cleanID($id);
         global $conf;
         global $lang;
 
@@ -629,6 +651,7 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
      * @author Gina Haeussge <osd@foosel.net>
      */
     function deleteAttachment($id){
+        $id = cleanID($id);
         $auth = auth_quickaclcheck(getNS($id).':*');
         if($auth < AUTH_DELETE) return new IXR_ERROR(1, "You don't have permissions to delete files.");
         global $conf;
@@ -686,6 +709,7 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
     * Returns the permissions of a given wiki page
     */
     function aclCheck($id) {
+        $id = cleanID($id);
         return auth_quickaclcheck($id);
     }
 
@@ -695,13 +719,14 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
      * @author Michael Klier <chi@chimeric.de>
      */
     function listLinks($id) {
+        $id = cleanID($id);
         if(auth_quickaclcheck($id) < AUTH_READ){
             return new IXR_Error(1, 'You are not allowed to read this page');
         }
         $links = array();
 
         // resolve page instructions
-        $ins   = p_cached_instructions(wikiFN(cleanID($id)));
+        $ins   = p_cached_instructions(wikiFN($id));
 
         // instantiate new Renderer - needed for interwiki links
         include(DOKU_INC.'inc/parser/xhtml.php');
@@ -809,6 +834,10 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
      * @author Michael Klier <chi@chimeric.de>
      */
     function pageVersions($id, $first) {
+        $id = cleanID($id);
+        if(auth_quickaclcheck($id) < AUTH_READ){
+            return new IXR_Error(1, 'You are not allowed to read this page');
+        }
         global $conf;
 
         $versions = array();
@@ -884,7 +913,8 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
         $unlockfail = array();
 
         foreach((array) $set['lock'] as $id){
-            if(checklock($id)){
+            $id = cleanID($id);
+            if(auth_quickaclcheck($id) < AUTH_EDIT || checklock($id)){
                 $lockfail[] = $id;
             }else{
                 lock($id);
@@ -893,10 +923,11 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
         }
 
         foreach((array) $set['unlock'] as $id){
-            if(unlock($id)){
-                $unlocked[] = $id;
-            }else{
+            $id = cleanID($id);
+            if(auth_quickaclcheck($id) < AUTH_EDIT || !unlock($id)){
                 $unlockfail[] = $id;
+            }else{
+                $unlocked[] = $id;
             }
         }
 
@@ -929,4 +960,4 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
 
 $server = new dokuwiki_xmlrpc_server();
 
-// vim:ts=4:sw=4:et:enc=utf-8:
+// vim:ts=4:sw=4:et:
diff --git a/lib/images/interwiki/paypal.gif b/lib/images/interwiki/paypal.gif
new file mode 100644
index 0000000000000000000000000000000000000000..4a063b4a50a358b06f2c9687fa3f0153de44f2b4
Binary files /dev/null and b/lib/images/interwiki/paypal.gif differ
diff --git a/lib/images/interwiki/sb.gif b/lib/images/interwiki/sb.gif
index e272a29b7badb804a7ee25acfd6c0f1c8b010dc6..8771b346dfcb8b4f02fb3e3bf83b393b910d175b 100644
Binary files a/lib/images/interwiki/sb.gif and b/lib/images/interwiki/sb.gif differ
diff --git a/lib/plugins/acl/admin.php b/lib/plugins/acl/admin.php
index 84932f7ac1e28a8bed5f27ebc27f085f1b483575..3e7bd8121ffc1a4322087679141074815f0cd3fa 100644
--- a/lib/plugins/acl/admin.php
+++ b/lib/plugins/acl/admin.php
@@ -765,7 +765,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
 
             //build code
             $ret .= '<label for="pbox'.$label.'" title="'.$this->getLang('acl_perm'.$perm).'"'.$class.'>';
-            $ret .= '<input '.html_attbuild($atts).' />&nbsp;';
+            $ret .= '<input '.buildAttributes($atts).' />&nbsp;';
             $ret .= $this->getLang('acl_perm'.$perm);
             $ret .= '</label>'.NL;
         }
diff --git a/lib/plugins/acl/lang/de-informal/lang.php b/lib/plugins/acl/lang/de-informal/lang.php
index fdb6f5a897f7a767fcba7e9d7b3c49218df892c3..e24584a55f5340b9789e93bd72b636c66dc2ae72 100644
--- a/lib/plugins/acl/lang/de-informal/lang.php
+++ b/lib/plugins/acl/lang/de-informal/lang.php
@@ -6,6 +6,7 @@
  * @author Juergen Schwarzer <jschwarzer@freenet.de>
  * @author Marcel Metz <marcel_metz@gmx.de>
  * @author Matthias Schulte <post@lupo49.de>
+ * @author Christian Wichmann <nospam@zone0.de>
  */
 $lang['admin_acl']             = 'Zugriffskontrollsystem Management';
 $lang['acl_group']             = 'Gruppe';
diff --git a/lib/plugins/acl/lang/de/lang.php b/lib/plugins/acl/lang/de/lang.php
index 0d30fe7a1253db7519d5994fd95725c02a14ef44..3c6bf8cf0624114bec952e20194a0ba0ebb9210e 100644
--- a/lib/plugins/acl/lang/de/lang.php
+++ b/lib/plugins/acl/lang/de/lang.php
@@ -17,6 +17,8 @@
  * @author Blitzi94@gmx.de
  * @author Robert Bogenschneider <robog@GMX.de>
  * @author Robert Bogenschneider <robog@gmx.de>
+ * @author Niels Lange <niels@boldencursief.nl>
+ * @author Christian Wichmann <nospam@zone0.de>
  */
 $lang['admin_acl']             = 'Zugangsverwaltung';
 $lang['acl_group']             = 'Gruppe';
diff --git a/lib/plugins/acl/lang/en/lang.php b/lib/plugins/acl/lang/en/lang.php
index 38ff20c88889b4da0087234933307f53b12bcaf5..779614d3289819158d2b916f4058a5b20dd764c0 100644
--- a/lib/plugins/acl/lang/en/lang.php
+++ b/lib/plugins/acl/lang/en/lang.php
@@ -43,4 +43,4 @@ $lang['acl_perm8']  = 'Upload';
 $lang['acl_perm16'] = 'Delete';
 $lang['acl_new']    = 'Add new Entry';
 $lang['acl_mod']    = 'Modify Entry';
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/lib/plugins/acl/lang/et/lang.php b/lib/plugins/acl/lang/et/lang.php
index e90d5eaa92f9db0e5380d8c13fb01ee3a82308cf..2f7208b7c3da958ba250f161b6a4304199bc63b2 100644
--- a/lib/plugins/acl/lang/et/lang.php
+++ b/lib/plugins/acl/lang/et/lang.php
@@ -20,4 +20,4 @@ $lang['acl_perm2']  = 'Toimetamine';
 $lang['acl_perm4']  = 'Tekitamine';
 $lang['acl_perm8']  = 'Üles laadimine';
 $lang['acl_new']    = 'Uue kirje lisamine';
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/lib/plugins/acl/lang/he/lang.php b/lib/plugins/acl/lang/he/lang.php
index ac00730dd07938115d33b4a9d236f356d48b0e3f..91025f4b8ede48b063657d3078d01ca226a40323 100644
--- a/lib/plugins/acl/lang/he/lang.php
+++ b/lib/plugins/acl/lang/he/lang.php
@@ -7,6 +7,7 @@
  * @author Dotan Kamber <kamberd@yahoo.com>
  * @author Moshe Kaplan <mokplan@gmail.com>
  * @author Yaron Yogev <yaronyogev@gmail.com>
+ * @author Yaron Shahrabani <sh.yaron@gmail.com>
  */
 $lang['admin_acl']             = 'ניהול רשימת בקרת גישות';
 $lang['acl_group']             = 'קבוצה';
diff --git a/lib/plugins/acl/lang/ko/lang.php b/lib/plugins/acl/lang/ko/lang.php
index 43a5ceeeb0269b6474f2c9df1090fcc9f6cb1b97..6f4e991cbb505a7417c10ce15cc708c168e14064 100644
--- a/lib/plugins/acl/lang/ko/lang.php
+++ b/lib/plugins/acl/lang/ko/lang.php
@@ -10,6 +10,7 @@
  * @author dongnak@gmail.com
  * @author Song Younghwan <purluno@gmail.com>
  * @author SONG Younghwan <purluno@gmail.com>
+ * @author Seung-Chul Yoo  <dryoo@live.com>
  */
 $lang['admin_acl']             = '접근 제어 목록 관리';
 $lang['acl_group']             = '그룹';
diff --git a/lib/plugins/acl/lang/la/help.txt b/lib/plugins/acl/lang/la/help.txt
index ba974f48c1417825b5dd95e0aa3bf0de358f02a8..553884c3029d68ff7b3f76c0720b8fa0a3369570 100644
--- a/lib/plugins/acl/lang/la/help.txt
+++ b/lib/plugins/acl/lang/la/help.txt
@@ -1,8 +1,8 @@
 === Auxilium: ===
 
-Hic facultates spatiorum nominis paginarumque addere delereue potes.
+Hic facultates generum paginarumque addere delereue potes.
 
-Tabella sinistra omnes paginas spatia nominisque ostendit.
+Tabella sinistra omnes paginas generaque ostendit.
 
 His campis mutare facultates electorum Sodalium Gregumque potes.
 
diff --git a/lib/plugins/acl/lang/la/lang.php b/lib/plugins/acl/lang/la/lang.php
index dd6043602909b708ed33ce490842df7eb3c5ca77..941de1f796e9f7f224bb747761f01a3a8d1b0e00 100644
--- a/lib/plugins/acl/lang/la/lang.php
+++ b/lib/plugins/acl/lang/la/lang.php
@@ -2,25 +2,26 @@
 /**
  * Latin language file
  *
+ * @author Massimiliano Vassalli <vassalli.max@gmail.com>
  */
-$lang['admin_acl']             = 'Aditus Administrationis Aditus';
+$lang['admin_acl']             = 'Administratio Indicis Custodiae Aditus';
 $lang['acl_group']             = 'Grex';
 $lang['acl_user']              = 'Sodalis';
 $lang['acl_perms']             = 'Facultas:';
 $lang['page']                  = 'Pagina';
-$lang['namespace']             = 'Spatium nominis';
+$lang['namespace']             = 'Genus';
 $lang['btn_select']            = 'eligere';
 $lang['p_user_id']             = 'Sodalis <b class="acluser">%s</b> nunc has facultates paginae "<b class="aclpage">%s</b> habes: <i>%s</i>.';
-$lang['p_user_ns']             = 'Sodalis <b class="acluser">%s</b> nunc has facultates spatio nominis "<b class="aclns">%s</b> habes: <i>%s</i>.';
+$lang['p_user_ns']             = 'Sodalis <b class="acluser">%s</b> nunc has facultates generis "<b class="aclns">%s</b> habes: <i>%s</i>.';
 $lang['p_group_id']            = 'Socius\a gregis <b class="aclgroup">%s</b> nunc has facultates paginae "<b class="aclpage">%s</b> habes: <i>%s</i>.';
-$lang['p_group_ns']            = 'Socius\a gregis <b class="aclgroup">%s</b> nunc has facultates paginae "<b class="aclns">%s</b> habes: <i>%s</i>.';
+$lang['p_group_ns']            = 'Socius\a gregis <b class="aclgroup">%s</b> nunc has facultates generis "<b class="aclns">%s</b> habes: <i>%s</i>.';
 $lang['p_choose_id']           = '<b>Sodalis grexue</b> in campo insere ut facultates paginae <b class="aclpage">%s</b> uideas.';
-$lang['p_choose_ns']           = '<b>Sodalis grexue</b> in campo insere ut facultates paginae <b class="aclns">%s</b> uideas.';
-$lang['p_inherited']           = 'Caue: hae facultates et huic rei et aliis gregibus uel spatiis nominis legitimae sunt.';
+$lang['p_choose_ns']           = '<b>Sodalis grexue</b> in campo insere ut facultates generis <b class="aclns">%s</b> uideas.';
+$lang['p_inherited']           = 'Caue: hae facultates et huic rei et aliis gregibus uel generibus legitimae sunt.';
 $lang['p_isadmin']             = 'Caue: electi greges semper plenum ius habent, eo quod ut magister\stra elegitur.';
-$lang['p_include']             = 'Maiores facultates minores includunt. Creare, onerare uel delere facultates solum spatis nominis, non paginis potes';
-$lang['current']               = 'Communes AAA leges';
-$lang['where']                 = 'Pagina/Spatium nominis';
+$lang['p_include']             = 'Maiores facultates minores includunt. Creandi, onerandi uel delendi facultates solum generibus, non paginis sunt.';
+$lang['current']               = 'Communes ICA leges';
+$lang['where']                 = 'Pagina/Genus';
 $lang['who']                   = 'Sodalis/Grex';
 $lang['perm']                  = 'Facultates';
 $lang['acl_perm0']             = 'Nihil';
diff --git a/lib/plugins/acl/lang/ru/help.txt b/lib/plugins/acl/lang/ru/help.txt
index a3c1b4f6424f66999fcf567ae0716cfd8189cc66..7807105a83785c3fc1c6a26f6eb90bba3e52f762 100644
--- a/lib/plugins/acl/lang/ru/help.txt
+++ b/lib/plugins/acl/lang/ru/help.txt
@@ -1,11 +1,7 @@
-=== Краткая справка: ===
+=== Краткая справка ===
 
-На этой странице вы можете добавить или удалить права доступа к пространствам имён и страницам вашей вики.
-
-На панели слева отображены доступные пространства имён и страницы.
-
-Форма выше позволяет вам просмотреть и изменить права доступа для выбранного пользователя или группы.
-
-Текущие права доступа отображены в таблице ниже. Вы можете использовать её для быстрого удаления или изменения правил.
-
-Прочтение  [[doku>acl|официальной документации по ACL]]  может помочь вам в полном понимании работы управления правами доступа в «ДокуВики».
+На этой странице вы можете добавить или удалить права доступа к пространствам имён и страницам своей вики.\\ 
+На панели слева отображены доступные пространства имён и страницы.\\ 
+Форма выше позволяет вам просмотреть и изменить права доступа для выбранного пользователя или группы.\\ 
+Текущие права доступа отображены в таблице ниже. Вы можете использовать её для быстрого удаления или изменения правил.\\ 
+Прочтение  [[doku>acl|официальной документации по ACL]] может помочь вам в полном понимании работы управления правами доступа в «ДокуВики».
diff --git a/lib/plugins/acl/lang/ru/lang.php b/lib/plugins/acl/lang/ru/lang.php
index 0c02dfbb15093353f7df0ad9c4976811accdb5b8..f49e4b55a9720eb4b01edd1406970b2d6ffcab2f 100644
--- a/lib/plugins/acl/lang/ru/lang.php
+++ b/lib/plugins/acl/lang/ru/lang.php
@@ -19,7 +19,7 @@ $lang['acl_group']             = 'Группа';
 $lang['acl_user']              = 'Пользователь';
 $lang['acl_perms']             = 'Права доступа для';
 $lang['page']                  = 'Страница';
-$lang['namespace']             = 'Пространство имен';
+$lang['namespace']             = 'Пространство имён';
 $lang['btn_select']            = 'Выбрать';
 $lang['p_user_id']             = 'Сейчас пользователь <b class="acluser">%s</b> имеет следующие права на доступ к странице <b class="aclpage">%s</b>: <i>%s</i>.';
 $lang['p_user_ns']             = 'Сейчас пользователь <b class="acluser">%s</b> имеет следующие права на доступ к пространству имён <b class="aclns">%s</b>: <i>%s</i>.';
diff --git a/lib/plugins/acl/lang/sl/lang.php b/lib/plugins/acl/lang/sl/lang.php
index 32141fbcee9cc66f54d7cf5f52e9d4614e88a10a..f6dec25efbc8f480e69e9fae1fe55f8e8087dee1 100644
--- a/lib/plugins/acl/lang/sl/lang.php
+++ b/lib/plugins/acl/lang/sl/lang.php
@@ -4,14 +4,29 @@
  *
  * @author Dejan Levec <webphp@gmail.com>
  * @author Boštjan Seničar <senicar@gmail.com>
+ * @author Gregor Skumavc (grega.skumavc@gmail.com)
  */
+$lang['admin_acl']             = 'ACL administracija';
 $lang['acl_group']             = 'Skupina';
 $lang['acl_user']              = 'Uporabnik';
 $lang['acl_perms']             = 'Dovoljenja za';
 $lang['page']                  = 'Stran';
+$lang['namespace']             = 'Imenski prostor';
 $lang['btn_select']            = 'Izberi';
+$lang['p_user_id']             = 'Uporabnik %s ima trenutno naslednje pravice na strani %s: %s.';
+$lang['p_user_ns']             = 'Uporabnik %s ima trenutno naslednje pravice v imenskem prostoru %s: %s.';
+$lang['p_group_id']            = 'Uporabnikka skupina %s ima trenutno naslednje pravice na strani %s: %s.';
+$lang['p_group_ns']            = 'Uporabniška skupina %s ima trenutno naslednje pravice v imenskem prostoru %s: %s.';
+$lang['p_choose_id']           = 'Prosimo vnesite <b>uporabnika ali skupino</b> v zgornji obrazec za ogled ali urejanje pravic za stran %s.';
+$lang['p_choose_ns']           = 'Prosimo vnesite <b>uporabnika ali skupino</b> v zgornji obrazec za ogled ali urejanje pravic za imenski prostor %s.';
+$lang['p_inherited']           = 'Opomba: Te pravice niso bile posebej nastavljene, temveč prevzete iz drugih skupin ali višjih imenskih prostorov.';
+$lang['p_isadmin']             = 'Opomba: Izbrana skupina ali uporabnik imajo vedno vse pravice, ker so določeni kot superuporabniki.';
+$lang['p_include']             = 'Višje pravice vključujejo tudi nižje. ';
+$lang['current']               = 'Trenutna ACL pravila';
+$lang['where']                 = 'Stran / Imenski prostor';
 $lang['who']                   = 'Uporabnik/Skupina';
 $lang['perm']                  = 'Dovoljenja';
+$lang['acl_perm0']             = 'Nič';
 $lang['acl_perm1']             = 'Preberi';
 $lang['acl_perm2']             = 'Uredi';
 $lang['acl_perm4']             = 'Ustvari';
diff --git a/lib/plugins/acl/lang/tr/lang.php b/lib/plugins/acl/lang/tr/lang.php
index 45fbe74891b02d448dff9e97286b7355ce292202..de96d2906706cea07e1e2eaefe86326fb647ba22 100644
--- a/lib/plugins/acl/lang/tr/lang.php
+++ b/lib/plugins/acl/lang/tr/lang.php
@@ -4,11 +4,10 @@
  *
  * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
  * @author Selim FarsakoÄŸlu <farsakogluselim@yahoo.de>
- * @author Aydın Coşkuner aydinweb@gmail.com
  * @author Aydın Coşkuner <aydinweb@gmail.com>
- * @author yavuzselim@gmail.com
- * @author Cihan Kahveci kahvecicihan@gmail.com
+ * @author Cihan Kahveci <kahvecicihan@gmail.com>
  * @author Yavuz Selim <yavuzselim@gmail.com>
+ * @author Caleb Maclennan <caleb@alerque.com>
  */
 $lang['admin_acl']             = 'Erişim Kontrol Listesi (ACL) Yönetimi';
 $lang['acl_group']             = 'Grup';
diff --git a/lib/plugins/acl/lang/vi/lang.php b/lib/plugins/acl/lang/vi/lang.php
index 4458d806b2935b1acf1c1810644dd5bde4f4d163..6237f79ba6221e8cd7a7c03769bd0557c1827a5e 100644
--- a/lib/plugins/acl/lang/vi/lang.php
+++ b/lib/plugins/acl/lang/vi/lang.php
@@ -18,4 +18,4 @@ $lang['acl_perm2']  = 'Biên soạn';
 $lang['acl_perm4']  = 'Tạo';
 $lang['acl_perm8']  = 'Tải lên';
 $lang['acl_new']    = 'Thêm mục mới';
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+//Setup VIM: ex: et ts=2 :
diff --git a/lib/plugins/admin.php b/lib/plugins/admin.php
index 25f01b65791192bd49d68579c68be3435d97b5b8..9a1fb9fdc351f3ccbcf958c122d2a6789a25a3be 100644
--- a/lib/plugins/admin.php
+++ b/lib/plugins/admin.php
@@ -43,4 +43,4 @@ class DokuWiki_Admin_Plugin extends DokuWiki_Plugin {
         return array();
     }
 }
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/lib/plugins/config/lang/ar/lang.php b/lib/plugins/config/lang/ar/lang.php
index 5d0ff76b95fdcd653401ae553bce83d09ae680b8..26cc16e5cc7c699576497cbc23b88d3a1a82ad27 100644
--- a/lib/plugins/config/lang/ar/lang.php
+++ b/lib/plugins/config/lang/ar/lang.php
@@ -116,6 +116,7 @@ $lang['rss_update']            = 'تحديث تلقيم XML (ثوان)';
 $lang['recent_days']           = 'مدة إبقاء أحدث التغييرات (ايام)';
 $lang['rss_show_summary']      = 'تلقيم XML يظهر ملخصا في العنوان';
 $lang['target____wiki']        = 'النافذة الهدف للروابط الداخلية';
+$lang['target____interwiki']   = 'النافذة الهدف للروابط الممرة interwiki';
 $lang['target____extern']      = 'النافذة الهدف للروابط الخارجية';
 $lang['target____media']       = 'النافذة الهدف لروابط الوسائط';
 $lang['target____windows']     = 'النافذة الهدف لروابط النوافذ';
@@ -124,6 +125,7 @@ $lang['proxy____port']         = 'منفذ الوكيل';
 $lang['proxy____user']         = 'اسم مستخدم الوكيل';
 $lang['proxy____pass']         = 'كلمة سر الوكيل';
 $lang['proxy____ssl']          = 'استخدم ssl للاتصال بالوكيل';
+$lang['proxy____except']       = 'تعبير شرطي لمقابلة العناوين التي ستتجاوز البروكسي.';
 $lang['safemodehack']          = 'مكّن hack الوضع الآمن';
 $lang['ftp____host']           = 'خادوم FTP ل hack الوضع الآمن';
 $lang['ftp____port']           = 'منفذ FTP ل hack الوضع الآمن';
@@ -136,6 +138,7 @@ $lang['typography_o_1']        = 'استبعاد الاقتباس المفرد';
 $lang['typography_o_2']        = 'تضمين علامات اقتباس مفردة (قد لا يعمل دائما)';
 $lang['userewrite_o_0']        = 'لاشيء';
 $lang['userewrite_o_1']        = '.htaccess';
+$lang['userewrite_o_2']        = 'دو';
 $lang['deaccent_o_0']          = 'معطل';
 $lang['gdlib_o_0']             = 'مكتبة GD غير متوفرة';
 $lang['gdlib_o_1']             = 'الاصدار 1.x';
@@ -156,11 +159,15 @@ $lang['compression_o_0']       = 'لا شيء';
 $lang['compression_o_gz']      = 'gzip';
 $lang['compression_o_bz2']     = 'bz2';
 $lang['xsendfile_o_0']         = 'لا تستخدم';
+$lang['xsendfile_o_1']         = 'ترويسة lighttpd مملوكة (قبل الاصدار 1.5)';
+$lang['xsendfile_o_2']         = 'ترويسة X-Sendfile قياسية';
+$lang['xsendfile_o_3']         = 'ترويسة Nginx X-Accel-Redirect مملوكة';
 $lang['showuseras_o_loginname'] = 'اسم الدخول';
 $lang['showuseras_o_username'] = 'اسم المستخدم الكامل';
 $lang['showuseras_o_email']    = 'عنوان بريد المستخدم (مبهم تبعا لاعدادات حارس_البريد)';
 $lang['showuseras_o_email_link'] = 'عنوان بريد المستخدم كـ مالتيو: رابط';
 $lang['useheading_o_0']        = 'أبدا';
-$lang['useheading_o_navigation'] = 'ال';
+$lang['useheading_o_navigation'] = 'التنقل فقط';
 $lang['useheading_o_content']  = 'محتوى الويكي فقط';
 $lang['useheading_o_1']        = 'دائما';
+$lang['readdircache']          = 'المدة القصوى لتخزين ';
diff --git a/lib/plugins/config/lang/cs/intro.txt b/lib/plugins/config/lang/cs/intro.txt
index bad92ac8e3887cd9faf8d8a83f04003b5d552786..63381b84e66fb258b56f4b2beb3e356d2a0882fd 100644
--- a/lib/plugins/config/lang/cs/intro.txt
+++ b/lib/plugins/config/lang/cs/intro.txt
@@ -2,7 +2,7 @@
 
 Tuto stránku můžete používat ke správě nastavení vaší instalace DokuWiki. Nápovědu pro konkrétní položky nastavení naleznete na [[doku>config]]. Pro další detaily o tomto pluginu viz [[doku>plugin:config]].
 
-Položky se světle červeným pozadím jsou chráněné a nelze je upravovat tímto pluginem.  Položky s modrým pozadím jsou výchozí hodnoty a položky s bílým pozadím byly nastaveny lokálně v této konktétní instalaci. Modré i bílé položky je možné upravovat.
+Položky se světle červeným pozadím jsou chráněné a nelze je upravovat tímto pluginem.  Položky s modrým pozadím jsou výchozí hodnoty a položky s bílým pozadím byly nastaveny lokálně v této konkrétní instalaci. Modré i bílé položky je možné upravovat.
 
 Než opustíte tuto stránku, nezapomeňte stisknout tlačítko **Uložit**, jinak budou změny ztraceny.
 
diff --git a/lib/plugins/config/lang/cs/lang.php b/lib/plugins/config/lang/cs/lang.php
index 3f8c05f262c5fb1db7c17ce250a5c8f80475ed60..06839c1d088e356cedfdd854e44e23f35a4be7c0 100644
--- a/lib/plugins/config/lang/cs/lang.php
+++ b/lib/plugins/config/lang/cs/lang.php
@@ -11,7 +11,7 @@
  */
 $lang['menu']                  = 'Správa nastavení';
 $lang['error']                 = 'Nastavení nebyla změněna kvůli alespoň jedné neplatné položce,
-zkotrolujte prosím své úpravy a odešlete je znovu.<br />
+zkontrolujte prosím své úpravy a odešlete je znovu.<br />
 Neplatné hodnoty se zobrazí v červeném rámečku.';
 $lang['updated']               = 'Nastavení byla úspěšně upravena.';
 $lang['nochoice']              = '(nejsou k dispozici žádné další volby)';
@@ -69,10 +69,10 @@ $lang['useheading']            = 'Používat první nadpis jako název stránky'
 $lang['refcheck']              = 'Kontrolovat odkazy na média (před vymazáním)';
 $lang['refshow']               = 'Počet zobrazených odkazů na média';
 $lang['allowdebug']            = 'Povolit debugování. <b>Vypněte, pokud to nepotřebujete!</b>';
-$lang['usewordblock']          = 'Blokovat spam za použítí seznamu známých spamových slov';
+$lang['usewordblock']          = 'Blokovat spam za použití seznamu známých spamových slov';
 $lang['indexdelay']            = 'Časová prodleva před indexací (v sekundách)';
 $lang['relnofollow']           = 'Používat rel="nofollow" na externí odkazy';
-$lang['mailguard']             = 'Metoda "zamaskování" emailových addres';
+$lang['mailguard']             = 'Metoda "zamaskování" emailových adres';
 $lang['iexssprotect']          = 'Zkontrolovat nahrané soubory vůči možnému škodlivému JavaScriptu či HTML';
 $lang['showuseras']            = 'Co se má přesně zobrazit, když se ukazuje uživatel, který naposledy editoval stránku';
 $lang['useacl']                = 'Používat přístupová práva (ACL)';
@@ -95,7 +95,7 @@ vnořené jmenné prostory, k nimž právo má, budou přesto skryty.
 To může mít za následek, že index bude při některých
 nastaveních ACL nepoužitelný.';
 $lang['auth_security_timeout'] = 'Časový limit pro autentikaci (v sekundách)';
-$lang['securecookie']          = 'Má prohlížeč posílat cookies nastavené přes HTTPS opět jen přes HTTPS? Vypňete tuto volbu, pokud chcete, aby bylo pomocí SSL zabezpečeno pouze přihlašování do wiki, ale obsah budete prohlížet nezabezpečeně.';
+$lang['securecookie']          = 'Má prohlížeč posílat cookies nastavené přes HTTPS opět jen přes HTTPS? Vypněte tuto volbu, pokud chcete, aby bylo pomocí SSL zabezpečeno pouze přihlašování do wiki, ale obsah budete prohlížet nezabezpečeně.';
 $lang['xmlrpc']                = 'Povolit/Zakázat rozhraní XML-RPC.';
 $lang['xmlrpcuser']            = 'Omezit přístup pomocí XML-RPC pouze na zde zadané skupiny či uživatele (oddělené čárkami). Necháte-li pole prázdné, dáte přístup komukoliv.';
 $lang['updatecheck']           = 'Kontrolovat aktualizace a bezpečnostní varování? DokuWiki potřebuje pro tuto funkci přístup k splitbrain.org';
@@ -112,7 +112,7 @@ $lang['locktime']              = 'Maximální životnost zámkových souborů (v
 $lang['fetchsize']             = 'Maximální velikost souboru (v bajtech), co ještě fetch.php bude stahovat z externích zdrojů';
 $lang['notify']                = 'Posílat oznámení o změnách na následující emailovou adresu';
 $lang['registernotify']        = 'Posílat informace o nově registrovaných uživatelích na tuto mailovou adresu';
-$lang['mailfrom']              = 'Emailová addresa, která se bude používat pro automatické maily';
+$lang['mailfrom']              = 'Emailová adresa, která se bude používat pro automatické maily';
 $lang['gzip_output']           = 'Používat pro xhtml Content-Encoding gzip';
 $lang['gdlib']                 = 'Verze GD knihovny';
 $lang['im_convert']            = 'Cesta k nástroji convert z balíku ImageMagick';
diff --git a/lib/plugins/config/lang/de-informal/lang.php b/lib/plugins/config/lang/de-informal/lang.php
index 01beeeeb9a44670352a6d0dc7d2a115d213ff08e..f6ddaa8e9d38a727cd54d49c926686d1c77a597a 100644
--- a/lib/plugins/config/lang/de-informal/lang.php
+++ b/lib/plugins/config/lang/de-informal/lang.php
@@ -6,6 +6,7 @@
  * @author Juergen Schwarzer <jschwarzer@freenet.de>
  * @author Marcel Metz <marcel_metz@gmx.de>
  * @author Matthias Schulte <post@lupo49.de>
+ * @author Christian Wichmann <nospam@zone0.de>
  */
 $lang['menu']                  = 'Einstellungen';
 $lang['error']                 = 'Einstellungen wurden nicht aktualisiert auf Grund eines ungültigen Wertes. Bitte überprüfe deine Änderungen und versuche es erneut.<br />Die/der ungültige(n) Wert(e) werden durch eine rote Umrandung hervorgehoben.';
@@ -102,6 +103,7 @@ $lang['fetchsize']             = 'Maximale Größe (in Bytes), die fetch.php von
 $lang['notify']                = 'Sende Änderungsbenachrichtigungen an diese E-Mail-Adresse.';
 $lang['registernotify']        = 'Sende Information bei neu registrierten Benutzern an diese E-Mail-Adresse.';
 $lang['mailfrom']              = 'Absenderadresse für automatisch erzeugte E-Mails';
+$lang['mailprefix']            = 'Präfix für E-Mail-Betreff beim automatischen Versand von Benachrichtigungen';
 $lang['gzip_output']           = 'Seiten mit gzip komprimiert ausliefern';
 $lang['gdlib']                 = 'GD Lib Version';
 $lang['im_convert']            = 'Pfad zu ImageMagicks Konvertierwerkzeug';
diff --git a/lib/plugins/config/lang/de/lang.php b/lib/plugins/config/lang/de/lang.php
index aa763da0355da316557797a35ca70aeb2aa6af85..b26df49934649e3ceb538486da6aca006b1376ed 100644
--- a/lib/plugins/config/lang/de/lang.php
+++ b/lib/plugins/config/lang/de/lang.php
@@ -13,6 +13,8 @@
  * @author Blitzi94@gmx.de
  * @author Robert Bogenschneider <robog@GMX.de>
  * @author Robert Bogenschneider <robog@gmx.de>
+ * @author Niels Lange <niels@boldencursief.nl>
+ * @author Christian Wichmann <nospam@zone0.de>
  */
 $lang['menu']                  = 'Konfiguration';
 $lang['error']                 = 'Die Einstellungen wurden wegen einer fehlerhaften Eingabe nicht gespeichert.
@@ -111,6 +113,7 @@ $lang['fetchsize']             = 'Maximale Größe (in Bytes), die fetch.php von
 $lang['notify']                = 'Änderungsmitteilungen an diese E-Mail-Adresse versenden';
 $lang['registernotify']        = 'Information über neu registrierte Nutzer an diese E-Mail-Adresse senden';
 $lang['mailfrom']              = 'Absender-E-Mail-Adresse für automatische Mails';
+$lang['mailprefix']            = 'Präfix für E-Mail-Betreff beim automatischen Versand von Benachrichtigungen';
 $lang['gzip_output']           = 'Seiten mit gzip komprimiert ausliefern';
 $lang['gdlib']                 = 'GD Lib Version';
 $lang['im_convert']            = 'Pfad zu ImageMagicks Konvertierwerkzeug';
diff --git a/lib/plugins/config/lang/en/lang.php b/lib/plugins/config/lang/en/lang.php
index 85214bf9881f871fafaf11e586002e01820a112f..d7a5448502ea3b881ab47e50fd8e50947ef0247b 100644
--- a/lib/plugins/config/lang/en/lang.php
+++ b/lib/plugins/config/lang/en/lang.php
@@ -125,6 +125,7 @@ $lang['fetchsize']   = 'Maximum size (bytes) fetch.php may download from extern'
 $lang['notify']      = 'Send change notifications to this email address';
 $lang['registernotify'] = 'Send info on newly registered users to this email address';
 $lang['mailfrom']    = 'Email address to use for automatic mails';
+$lang['mailprefix']  = 'Email subject prefix to use for automatic mails';
 $lang['gzip_output'] = 'Use gzip Content-Encoding for xhtml';
 $lang['gdlib']       = 'GD Lib version';
 $lang['im_convert']  = 'Path to ImageMagick\'s convert tool';
diff --git a/lib/plugins/config/lang/he/lang.php b/lib/plugins/config/lang/he/lang.php
index a39d0ab5cda533d25f08d86c446c74dc7cc977fa..ab4a8928eddfb0470ffa4f776a33b8ea53c2c391 100644
--- a/lib/plugins/config/lang/he/lang.php
+++ b/lib/plugins/config/lang/he/lang.php
@@ -7,6 +7,7 @@
  * @author Dotan Kamber <kamberd@yahoo.com>
  * @author Moshe Kaplan <mokplan@gmail.com>
  * @author Yaron Yogev <yaronyogev@gmail.com>
+ * @author Yaron Shahrabani <sh.yaron@gmail.com>
  */
 $lang['menu']                  = 'הגדרות תצורה';
 $lang['error']                 = 'ההגדרות לא עודכנו בגלל ערך לא תקף, נא לעיין בשינויים ולשלוח שנית.
diff --git a/lib/plugins/config/lang/ko/lang.php b/lib/plugins/config/lang/ko/lang.php
index efac643abbe17087575e7cef61fbcfbe7809f2c6..13f5efefec91cb3fb2fe3ab3873f856319d7bd49 100644
--- a/lib/plugins/config/lang/ko/lang.php
+++ b/lib/plugins/config/lang/ko/lang.php
@@ -7,6 +7,7 @@
  * @author dongnak@gmail.com
  * @author Song Younghwan <purluno@gmail.com>
  * @author SONG Younghwan <purluno@gmail.com>
+ * @author Seung-Chul Yoo  <dryoo@live.com>
  */
 $lang['menu']                  = '환경 설정';
 $lang['error']                 = '잘못된 값때문에 설정들을 변경할 수 없습니다. 수정한 값들을 검사하고 확인을 누르기 바랍니다.
@@ -89,12 +90,15 @@ $lang['sneaky_index']          = '기본적으로, DokuWiki는 색인 목록에
 특정 ACL 설정은 색인 사용이 불가능하게 할 수도 있습니다.';
 $lang['auth_security_timeout'] = '인증 보안 초과 시간(초)';
 $lang['securecookie']          = 'HTTPS로 보내진 쿠키는 HTTPS에만 적용 할까요? 위키의 로그인 페이지만 SSL로 암호화 하고 위키 페이지는 그렇지 않은경우 꺼야 합니다.';
+$lang['xmlrpc']                = 'XML-RPC 인터페이스 지원/무시';
+$lang['xmlrpcuser']            = '주어진 그룹이나 유저들에게만 XML-RPC접근을 허락하려면 컴마로 구분하여 적으세요. 비어두면 모두에게 허용됩니다.';
 $lang['updatecheck']           = '업데이트와 보안 문제를 검사(DokuWiki를 splitbrain.org에 연결해야 합니다.)';
 $lang['userewrite']            = 'URL rewriting기능 사용';
 $lang['useslash']              = 'URL에서 네임스페이스 구분자로 슬래쉬 문자 사용';
 $lang['usedraft']              = '편집하는 동안 자동으로 문서 초안 저장';
 $lang['sepchar']               = '페이지 이름 단어 구분자';
 $lang['canonical']             = '완전한 canonical URL 사용';
+$lang['fnencode']              = '아스키가 아닌 파일이르믈 인코딩 하는 방법.';
 $lang['autoplural']            = '링크 연결시 plural폼 검사';
 $lang['compression']           = 'attic파일 압축 방법 선택';
 $lang['cachetime']             = '최대 캐쉬 생존 시간(초)';
@@ -108,6 +112,7 @@ $lang['gdlib']                 = 'GD 라이브러리 버전';
 $lang['im_convert']            = 'ImageMagick 위치';
 $lang['jpg_quality']           = 'JPG 압축 품질 (0-100)';
 $lang['subscribers']           = '페이지 갱신 알람 기능';
+$lang['subscribe_time']        = ' 구독 목록과 요약이 보내질 경과 시간 (초); 이 것은 recent_days에서 설정된 시간보다 작아야 합니다.';
 $lang['compress']              = '최적화된 CSS, javascript 출력';
 $lang['hidepages']             = '매칭된 페이지 숨기기(정규표현식)';
 $lang['send404']               = '존재하지 않는 페이지에 대해 "HTTP 404/Page Not Found" 응답';
@@ -115,7 +120,6 @@ $lang['sitemap']               = '구글 사이트맵 생성(날짜)';
 $lang['broken_iua']            = '설치된 시스템에서 ignore_user_abort 기능에 문제가 있으면 색인이 정상적으로 동작하지 않습니다. 이 기능이 IIS+PHP/CGI에서 문제가 있는 것으로 알려졌습니다. 자세한 정보는 <a href="http://bugs.splitbrain.org/?do=details&amp;task_id=852">Bug 852</a>를 참고하기 바랍니다.';
 $lang['xsendfile']             = '웹 서버 static 파일 전송 지원을 위해 X-Sendfile 헤더를 사용한다면 이 옵션을 사용합니다.
 웹 서버가 이 기능을 지원해야 합니다.';
-$lang['xmlrpc']                = 'XML-RPC 인터페이스 지원/무시';
 $lang['renderer_xhtml']        = '주 (xhtml) 위키 출력 처리기';
 $lang['renderer__core']        = '%s (DokuWiki 내부 기능)';
 $lang['renderer__plugin']      = '%s (DokuWiki 플러그인)';
@@ -136,6 +140,7 @@ $lang['proxy____port']         = '프록시 서버 포트';
 $lang['proxy____user']         = '프록시 사용자 이름';
 $lang['proxy____pass']         = '프록시 패스워드';
 $lang['proxy____ssl']          = '프록시 연결시 ssl사용';
+$lang['proxy____except']       = '프록시설정이 무시될 URL주소들의 RegEx형식표현';
 $lang['safemodehack']          = 'safemode hack기능 사용';
 $lang['ftp____host']           = 'safemode hack의 FTP 서버';
 $lang['ftp____port']           = 'safemode hack의 FTP port';
@@ -183,3 +188,4 @@ $lang['useheading_o_0']        = '아니요';
 $lang['useheading_o_navigation'] = '네비게이션에만';
 $lang['useheading_o_content']  = '위키 내용에만';
 $lang['useheading_o_1']        = '항상';
+$lang['readdircache']          = 'readdir 캐쉬를 위한 최대 시간 (초)';
diff --git a/lib/plugins/config/lang/la/intro.txt b/lib/plugins/config/lang/la/intro.txt
index d23029ab16bea92f129a06a5a26b96f84eec125a..573d34ac1e42943f3c06ca3ed8b0e4da6dd2914f 100644
--- a/lib/plugins/config/lang/la/intro.txt
+++ b/lib/plugins/config/lang/la/intro.txt
@@ -1,6 +1,6 @@
-====== Administrationis Administrator ======
+====== Optionum Administratio ======
 
-In hac pagina administratoris optiones mutare et inspicere potes. Auxilia in pagina [[doku>config]] sunt, si singulas res uidere uis, i ad paginam [[doku>plugin:config]].
+In hac pagina administratoris optiones mutare et inspicere potes. Auxilia in pagina [[doku>config|conformationis]] sunt, si singulas res uidere uis, i ad paginam [[doku>plugin:config|conformationis]].
 
 Optiones ostensae rubro colore tutae et non nunc mutabiles sunt. Optiones ostensae caeruleo colore praecipuae sunt et optiones ostensae in area alba singulares huic uici sunt. Et caerulae et albae optiones mutabiles sunt.
 
diff --git a/lib/plugins/config/lang/la/lang.php b/lib/plugins/config/lang/la/lang.php
index ca0eb1c3125b50a4c3999139fddeae7caf19c1c6..689ea004df339f2efa03acd94aca5277ae527dea 100644
--- a/lib/plugins/config/lang/la/lang.php
+++ b/lib/plugins/config/lang/la/lang.php
@@ -2,6 +2,7 @@
 /**
  * Latin language file
  *
+ * @author Massimiliano Vassalli <vassalli.max@gmail.com>
  */
 $lang['menu']                  = 'Optiones Administrationis';
 $lang['error']                 = 'Optiones non nouatae ob errores: rursum temptat. Errores rubro colore signati sunt.';
@@ -9,17 +10,17 @@ $lang['updated']               = 'Optiones feliciter nouatae.';
 $lang['nochoice']              = '(nulla optio est)';
 $lang['locked']                = 'Optio documenti non nouata est, <br/> optiones et facultates documenti inspicis.';
 $lang['danger']                = 'CAVE: si has optiones mutabis, in administrationis indicem non inire potes.';
-$lang['warning']               = 'CAVE: si hae optiones mutantur, graues errores erunt.';
-$lang['security']              = 'CAVE: si hae optiones mutantur, graues errores erunt.';
-$lang['_configuration_manager'] = 'Administrationis Administrator';
+$lang['warning']               = 'CAVE: si hae optiones mutabis, graues errores erunt.';
+$lang['security']              = 'CAVE: si hae optiones mutabis, graues errores erunt.';
+$lang['_configuration_manager'] = 'Optionum administratio';
 $lang['_header_dokuwiki']      = 'Vicis Optiones';
 $lang['_header_plugin']        = 'Addendorum Optiones';
 $lang['_header_template']      = 'Vicis Formae Optiones';
 $lang['_header_undefined']     = 'Variae Optiones';
-$lang['_basic']                = 'Fundamenti Optiones';
-$lang['_display']              = 'Visiuae Optiones';
+$lang['_basic']                = 'Praecipuae Optiones';
+$lang['_display']              = 'Speciei Optiones';
 $lang['_authentication']       = 'Confirmationis Optiones';
-$lang['_anti_spam']            = 'Malorum Optiones';
+$lang['_anti_spam']            = 'In Mala Optiones';
 $lang['_editing']              = 'Recensendi Optiones';
 $lang['_links']                = 'Nexi Optiones';
 $lang['_media']                = 'Visiuorum Optiones';
@@ -70,7 +71,7 @@ $lang['autopasswd']            = 'Tessera machinatione generata';
 $lang['authtype']              = 'Confirmationis finis';
 $lang['passcrypt']             = 'Ratio tesserae tuendae';
 $lang['defaultgroup']          = 'Grex communis';
-$lang['superuser']             = 'Magister\stra - grex, Sodalis uel index diuisus a uigulis sodalis1,@grex,sodalis2 cum plenis facultatibus sine AAA optionum termino';
+$lang['superuser']             = 'Magister\stra - grex, Sodalis uel index diuisus a uigulis sodalis1,@grex,sodalis2 cum plenis facultatibus sine ICA optionum termino';
 $lang['manager']               = 'Administrator - grex, Sodalis uel index diuisus a uigulis sodalis1,@grex,sodalis2 cum certis facultatibus';
 $lang['profileconfirm']        = 'Mutationes tessera confirmanda sunt';
 $lang['disableactions']        = 'Vicis actiones ineptas facere';
@@ -78,14 +79,14 @@ $lang['disableactions_check']  = 'Inspicere';
 $lang['disableactions_subscription'] = 'Inscribe/Delere';
 $lang['disableactions_wikicode'] = 'Fontem uidere/Rudem transcribere';
 $lang['disableactions_other']  = 'Aliae actiones (uirgulis diuisae)';
-$lang['sneaky_index']          = 'Hic uicis omnes spatia nomini in indice inserit. Si ineptam hanc optionem facias, solum ea spatia, quae Sodales uidere possunt, in indice erunt. Hoc suggreges et subspatia abscondere potest.';
+$lang['sneaky_index']          = 'Hic uicis omnia genera in indice inserit. Si ineptam hanc optionem facias, solum ea, quae Sodales uidere possunt, in indice erunt. Hoc suggreges et suggenera abscondere potest.';
 $lang['auth_security_timeout'] = 'Confirmationis Tempus (secundis)';
 $lang['securecookie']          = 'Formulae HTTPS mittine solum per HTTPS possunt? Ineptam hanc optio facias, si accessus uicis tutus est, sed interretis non.';
 $lang['xmlrpc']                = 'Aptam\Ineptam XML-RPC administrationem facere';
 $lang['xmlrpcuser']            = 'Accessus XML-RPC gregibus uel Sodalibus in hoc indice astringere. Nihil scribere ut omnes accessum habeant';
 $lang['updatecheck']           = 'Nouationes et fiducias inspicerene? Hic uicis connectere splitbrain.org debes.';
 $lang['userewrite']            = 'VRL formosis uti';
-$lang['useslash']              = 'Repagula ut spatium nominis diuidas uti';
+$lang['useslash']              = 'Repagula in URL, ut genera diuidas, uti';
 $lang['usedraft']              = 'Propositum in recensione machinatione seruatur';
 $lang['sepchar']               = 'Signum, quod paginas diuidit';
 $lang['canonical']             = 'VRL perfecto uti';
@@ -99,7 +100,7 @@ $lang['notify']                = 'Adnotationis mutationes ad hunc cursum mittere
 $lang['registernotify']        = 'De nouis Sodalibus ad hunc cursum notas mittere';
 $lang['mailfrom']              = 'Cursus interretialis, quo in cursibus uti';
 $lang['gzip_output']           = 'gzip Argumentum-Codificans xhtml uti';
-$lang['gdlib']                 = 'GD Lib uersio';
+$lang['gdlib']                 = 'GD Lib forma';
 $lang['im_convert']            = 'Domicilium machinae ImageMagick\'s';
 $lang['jpg_quality']           = 'JPG compressio colorum (0-100)';
 $lang['subscribers']           = 'Inscriptionis paginarum auxilium aptus facere';
@@ -148,7 +149,7 @@ $lang['deaccent_o_0']          = 'ex';
 $lang['deaccent_o_1']          = 'accentum tollere';
 $lang['deaccent_o_2']          = 'Latinis litteris';
 $lang['gdlib_o_0']             = 'GD Lib inepta';
-$lang['gdlib_o_1']             = 'Versio 1.x';
+$lang['gdlib_o_1']             = 'Forma 1.x';
 $lang['gdlib_o_2']             = 'Machinatione inspicere';
 $lang['rss_type_o_rss']        = 'RSS 0.91';
 $lang['rss_type_o_rss1']       = 'RSS 1.0';
diff --git a/lib/plugins/config/lang/ru/intro.txt b/lib/plugins/config/lang/ru/intro.txt
index c66a69e646090c3a541ebb7e9cdd62b20948ab1c..a629d9332ce071b17b802b14aa6fb94311488adf 100644
--- a/lib/plugins/config/lang/ru/intro.txt
+++ b/lib/plugins/config/lang/ru/intro.txt
@@ -1,9 +1,9 @@
 ====== Настройки вики ======
 
-Здесь вы можете изменить настройки вашей «ДокуВики». Для справки по поводу конкретных опций смотрите [[doku>config]]. Дополнительные детали об этом плагине доступны здесь: [[doku>plugin:config]].
+Здесь вы можете изменить настройки своей «ДокуВики». Для справки по поводу конкретных опций смотрите [[doku>config]]. Дополнительные детали об этом плагине доступны здесь: [[doku>plugin:config]].
 
 Настройки, отображаемые на светло-красном фоне, защищены от изменений и не могут быть отредактированы с помощью этого плагина.  Голубым фоном отмечены настройки со значениями по умолчанию, а белым фоном — настройки, которые были локально изменены для этой конкретной «ДокуВики». Как голубые, так и белые настройки доступны для изменения.
 
-Не забудьте нажать кнопку **Сохранить** перед тем, как покинуть эту страницу, иначе все ваши изменения будут потеряны.
+Не забудьте нажать кнопку «**Сохранить**» перед тем, как покинуть эту страницу, иначе все ваши изменения будут потеряны.
 
 
diff --git a/lib/plugins/config/lang/ru/lang.php b/lib/plugins/config/lang/ru/lang.php
index 167c54eea8f662f604772c2578f025ebbf0c771c..5e624eda04a45a1f938be55655bf5e84b19f2436 100644
--- a/lib/plugins/config/lang/ru/lang.php
+++ b/lib/plugins/config/lang/ru/lang.php
@@ -16,11 +16,10 @@
  * @author Aleksandr Selivanov <alexgearbox@gmail.com>
  */
 $lang['menu']                  = 'Настройки вики';
-$lang['error']                 = 'Настройки не были сохранены из-за ошибки в одном из значений. Пожалуйста, проверьте ваши изменения и попробуйте еще раз.<br />Неправильные значения будут обведены красной рамкой.';
+$lang['error']                 = 'Настройки не были сохранены из-за ошибки в одном из значений. Пожалуйста, проверьте свои изменения и попробуйте ещё раз.<br />Неправильные значения будут обведены красной рамкой.';
 $lang['updated']               = 'Настройки успешно сохранены.';
 $lang['nochoice']              = '(нет других вариантов)';
-$lang['locked']                = 'Файл настройки недоступен для изменения. Если это не специально, <br />
-убедитесь, что файл локальной настройки имеет правильное имя и права доступа.';
+$lang['locked']                = 'Файл настройки недоступен для изменения. Если это не специально, <br />убедитесь, что файл локальной настройки имеет правильное имя и права доступа.';
 $lang['danger']                = 'Внимание: изменение этой опции может сделать вашу вики и меню конфигурации недоступными.';
 $lang['warning']               = 'Предостережение: изменение этой опции может вызвать непредсказуемое поведение.';
 $lang['security']              = 'Предостережение по безопасности: изменение этой опции может вызвать риск, связанный с безопасностью.';
@@ -63,7 +62,7 @@ $lang['phpok']                 = 'Разрешить PHP';
 $lang['dformat']               = 'Формат даты и времени';
 $lang['signature']             = 'Шаблон подписи';
 $lang['toptoclevel']           = 'Мин. уровень в содержании';
-$lang['tocminheads']           = 'Минимальное количество заголовков, при котором будет составлено содержание';
+$lang['tocminheads']           = 'Мин. количество заголовков, при котором будет составлено содержание';
 $lang['maxtoclevel']           = 'Макс. уровень в содержании';
 $lang['maxseclevel']           = 'Макс. уровень для правки';
 $lang['camelcase']             = 'Использовать ВикиРегистр для ссылок';
@@ -84,22 +83,22 @@ $lang['authtype']              = 'Механизм аутентификации'
 $lang['passcrypt']             = 'Метод шифрования пароля';
 $lang['defaultgroup']          = 'Группа по умолчанию';
 $lang['superuser']             = 'Суперпользователь — группа или пользователь с полным доступом ко всем страницам и функциям администрирования, независимо от установок ACL. Перечень разделяйте запятыми: user1,@group1,user2';
-$lang['manager']               = 'Менеджер — группа или пользователь с доступом к определенным функциям управления. Перечень разделяйте запятыми: user1,@group1,user2';
+$lang['manager']               = 'Менеджер — группа или пользователь с доступом к определённым функциям управления. Перечень разделяйте запятыми: user1,@group1,user2';
 $lang['profileconfirm']        = 'Пароль для изменения профиля';
 $lang['disableactions']        = 'Заблокировать операции «ДокуВики»';
 $lang['disableactions_check']  = 'Проверка';
 $lang['disableactions_subscription'] = 'Подписка/Отмена подписки';
 $lang['disableactions_wikicode'] = 'Показ/экспорт исходного текста';
 $lang['disableactions_other']  = 'Другие операции (через запятую)';
-$lang['sneaky_index']          = 'По умолчанию, «ДокуВики» показывает в индексе страниц все пространства имен. Включение этой опции скроет пространства имен, для которых пользователь не имеет прав чтения. Это может привести к скрытию доступных вложенных пространств имен и потере функциональности индекса страниц при некоторых конфигурациях прав доступа.';
+$lang['sneaky_index']          = 'По умолчанию, «ДокуВики» показывает в индексе страниц все пространства имён. Включение этой опции скроет пространства имён, для которых пользователь не имеет прав чтения. Это может привести к скрытию доступных вложенных пространств имён и потере функциональности индекса страниц при некоторых конфигурациях прав доступа.';
 $lang['auth_security_timeout'] = 'Интервал для безопасности авторизации (сек.)';
 $lang['securecookie']          = 'Должны ли куки (cookies), выставленные через HTTPS, отправляться браузером только через HTTPS. Отключите эту опцию в случае, когда только логин вашей вики передаётся через SSL, а обычный просмотр осуществляется в небезопасном режиме.';
 $lang['xmlrpc']                = 'Включить/выключить XML-RPC интерфейс.';
-$lang['xmlrpcuser']            = 'Запретить XML-RPC доступ для списка групп и пользователей, перечисленных через запятую. Оставьте пустым, если хотите оставить доступ всем.';
-$lang['updatecheck']           = 'Проверять наличие обновлений и предупреждений о безопасности? Для этого «ДокуВики» потребуется связываться со <a href="http://www.splitbrain.org/">splitbrain.org</a>.';
+$lang['xmlrpcuser']            = 'Запретить XML-RPC-доступ для списка групп и пользователей, перечисленных через запятую. Оставьте пустым, если хотите оставить доступ всем.';
+$lang['updatecheck']           = 'Проверять наличие обновлений и предупреждений о безопасности? Для этого «ДокуВики» потребуется связываться с сайтом <a href="http://www.splitbrain.org/">splitbrain.org</a>.';
 $lang['userewrite']            = 'Удобочитаемые адреса (URL)';
 $lang['useslash']              = 'Использовать слэш';
-$lang['usedraft']              = 'Автоматически сохранять черновик в время правки';
+$lang['usedraft']              = 'Автоматически сохранять черновик во время правки';
 $lang['sepchar']               = 'Разделитель слов в имени страницы';
 $lang['canonical']             = 'Полные канонические адреса (URL)';
 $lang['fnencode']              = 'Метод кодирования имён файлов, записанных не ASCII-символами.';
@@ -114,15 +113,15 @@ $lang['mailfrom']              = 'Электронный адрес вики (О
 $lang['gzip_output']           = 'Использовать gzip-сжатие для xhtml';
 $lang['gdlib']                 = 'Версия LibGD';
 $lang['im_convert']            = 'Путь к ImageMagick';
-$lang['jpg_quality']           = 'Качество сжатия JPG (0–100). Значение о умолчнию — 70.';
+$lang['jpg_quality']           = 'Качество сжатия JPG (0–100). Значение по умолчанию — 70.';
 $lang['subscribers']           = 'Разрешить подписку на изменения';
-$lang['subscribe_time']        = 'Интервал рассылки подписок и сводок (сек.); Должен быть меньше, чем значение, указанное в recent_days.';
+$lang['subscribe_time']        = 'Интервал рассылки подписок и сводок (сек.). Должен быть меньше, чем значение, указанное в recent_days.';
 $lang['compress']              = 'Сжимать файлы CSS и javascript';
 $lang['hidepages']             = 'Скрыть страницы (рег. выражение)';
 $lang['send404']               = 'Посылать «HTTP404/Page Not Found»';
 $lang['sitemap']               = 'Число дней, через которое нужно создавать (обновлять) карту сайта для поисковиков (Гугл, Яндекс и др.)';
 $lang['broken_iua']            = 'Возможно, функция ignore_user_abort не работает в вашей системе? Это может привести к потере функциональности индексирования поиска. Эта проблема присутствует, например, в IIS+PHP/CGI. Для дополнительной информации смотрите <a href="http://bugs.splitbrain.org/?do=details&amp;task_id=852">баг 852</a>.';
-$lang['xsendfile']             = 'Используете заголовок X-Sendfile для загрузки файлов на вебсервер? Ваш вебсервер должен поддерживать это.';
+$lang['xsendfile']             = 'Используете заголовок X-Sendfile для загрузки файлов на веб-сервер? Ваш веб-сервер должен поддерживать это.';
 $lang['renderer_xhtml']        = 'Обработчик основного (xhtml) вывода вики';
 $lang['renderer__core']        = '%s (ядро dokuwiki)';
 $lang['renderer__plugin']      = '%s (плагин)';
@@ -138,18 +137,18 @@ $lang['target____interwiki']   = 'target для ссылок между вики
 $lang['target____extern']      = 'target для внешних ссылок';
 $lang['target____media']       = 'target для ссылок на медиафайлы';
 $lang['target____windows']     = 'target для ссылок на сетевые каталоги';
-$lang['proxy____host']         = 'proxy - адрес';
-$lang['proxy____port']         = 'proxy - порт';
-$lang['proxy____user']         = 'proxy - имя пользователя';
-$lang['proxy____pass']         = 'proxy - пароль';
-$lang['proxy____ssl']          = 'proxy - ssl';
+$lang['proxy____host']         = 'proxy-адрес';
+$lang['proxy____port']         = 'proxy-порт';
+$lang['proxy____user']         = 'proxy-имя пользователя';
+$lang['proxy____pass']         = 'proxy-пароль';
+$lang['proxy____ssl']          = 'proxy-ssl';
 $lang['proxy____except']       = 'Регулярное выражение для адресов (URL), для которых прокси должен быть пропущен.';
 $lang['safemodehack']          = 'Включить обход safemode (хак)';
-$lang['ftp____host']           = 'ftp - адрес';
-$lang['ftp____port']           = 'ftp - порт';
-$lang['ftp____user']           = 'ftp - имя пользователя';
-$lang['ftp____pass']           = 'ftp - пароль';
-$lang['ftp____root']           = 'ftp - корневая директория';
+$lang['ftp____host']           = 'ftp-адрес';
+$lang['ftp____port']           = 'ftp-порт';
+$lang['ftp____user']           = 'ftp-имя пользователя';
+$lang['ftp____pass']           = 'ftp-пароль';
+$lang['ftp____root']           = 'ftp-корневая директория';
 $lang['license_o_']            = 'Не выбрано';
 $lang['typography_o_0']        = 'нет';
 $lang['typography_o_1']        = 'Только двойные кавычки';
@@ -185,10 +184,10 @@ $lang['xsendfile_o_2']         = 'Стандартный заголовок X-Se
 $lang['xsendfile_o_3']         = 'Проприетарный заголовок Nginx X-Accel-Redirect';
 $lang['showuseras_o_loginname'] = 'Логин';
 $lang['showuseras_o_username'] = 'Полное имя пользователя';
-$lang['showuseras_o_email']    = 'Адрес электронной почты пользователя (зашифрован согласно настройкам mailguard)';
-$lang['showuseras_o_email_link'] = 'Адрес электронной почты пользователя в виде ссылки mailto:';
+$lang['showuseras_o_email']    = 'Адрес электропочты в шифрованном виде (см. mailguard)';
+$lang['showuseras_o_email_link'] = 'Адрес электропочты в виде ссылки mailto:';
 $lang['useheading_o_0']        = 'Никогда';
 $lang['useheading_o_navigation'] = 'Только навигация';
 $lang['useheading_o_content']  = 'Только содержимое вики';
 $lang['useheading_o_1']        = 'Всегда';
-$lang['readdircache']          = 'Максимальное время жизни кэша readdir (сек)';
+$lang['readdircache']          = 'Максимальное время жизни кэша readdir (сек.)';
diff --git a/lib/plugins/config/lang/sl/lang.php b/lib/plugins/config/lang/sl/lang.php
index 52b88a053489ed3b9e7054017803909ea444d341..5b5b3d3d83eeae7c7f8dd74dd95b044280c6a98d 100644
--- a/lib/plugins/config/lang/sl/lang.php
+++ b/lib/plugins/config/lang/sl/lang.php
@@ -4,6 +4,7 @@
  *
  * @author Dejan Levec <webphp@gmail.com>
  * @author Boštjan Seničar <senicar@gmail.com>
+ * @author Gregor Skumavc (grega.skumavc@gmail.com)
  */
 $lang['lang']                  = 'Jezik';
 $lang['template']              = 'Predloga';
diff --git a/lib/plugins/config/lang/tr/lang.php b/lib/plugins/config/lang/tr/lang.php
index 9929c663e1146c7ec9f9992cb025e26c7d1d4223..6d7d7cc2e04cb795466a157a928893873e0d3f33 100644
--- a/lib/plugins/config/lang/tr/lang.php
+++ b/lib/plugins/config/lang/tr/lang.php
@@ -2,11 +2,10 @@
 /**
  * Turkish language file
  *
- * @author Aydın Coşkuner aydinweb@gmail.com
  * @author Aydın Coşkuner <aydinweb@gmail.com>
- * @author yavuzselim@gmail.com
- * @author Cihan Kahveci kahvecicihan@gmail.com
+ * @author Cihan Kahveci <kahvecicihan@gmail.com>
  * @author Yavuz Selim <yavuzselim@gmail.com>
+ * @author Caleb Maclennan <caleb@alerque.com>
  */
 $lang['menu']                  = 'Site Ayarları';
 $lang['error']                 = 'Ayarlar yanlış bir değer girildiği için güncellenemedi. Lütfen değişikliklerinizi gözden geçirin ve tekrar gönderin.
diff --git a/lib/plugins/config/settings/config.class.php b/lib/plugins/config/settings/config.class.php
index 4f2129c70ac834deca08eac4d482913b9d7b0e79..01f15a54e60a2d42f17d1a12d7f8adbd6bd3df96 100644
--- a/lib/plugins/config/settings/config.class.php
+++ b/lib/plugins/config/settings/config.class.php
@@ -342,8 +342,8 @@ if (!class_exists('setting')) {
 
     var $_cautionList = array(
         'basedir' => 'danger', 'baseurl' => 'danger', 'savedir' => 'danger', 'useacl' => 'danger', 'authtype' => 'danger', 'superuser' => 'danger', 'userewrite' => 'danger',
-        'start' => 'warning', 'camelcase' => 'warning', 'deaccent' => 'warning', 'sepchar' => 'warning', 'compression' => 'warning', 'xsendfile' => 'warning', 'renderer_xhtml' => 'warning',
-        'allowdebug' => 'security', 'htmlok' => 'security', 'phpok' => 'security', 'iexssprotect' => 'security', 'xmlrpc' => 'security', 'fnencode' => 'warning'
+        'start' => 'warning', 'camelcase' => 'warning', 'deaccent' => 'warning', 'sepchar' => 'warning', 'compression' => 'warning', 'xsendfile' => 'warning', 'renderer_xhtml' => 'warning', 'fnencode' => 'warning',
+        'allowdebug' => 'security', 'htmlok' => 'security', 'phpok' => 'security', 'iexssprotect' => 'security', 'xmlrpc' => 'security', 'fullpath' => 'security'
     );
 
     function setting($key, $params=NULL) {
@@ -616,8 +616,25 @@ if (!class_exists('setting_numeric')) {
     // This allows for many PHP syntax errors...
     // var $_pattern = '/^[-+\/*0-9 ]*$/';
     // much more restrictive, but should eliminate syntax errors.
-    var $_pattern = '/^[-]?[0-9]+(?:[-+*][0-9]+)*$/';
-    //FIXME - make the numeric error checking better.
+    var $_pattern = '/^[-+]? *[0-9]+ *(?:[-+*] *[0-9]+ *)*$/';
+    var $_min = null;
+    var $_max = null;
+
+    function update($input) {
+        $local = $this->_local;
+        $valid = parent::update($input);
+        if ($valid && !(is_null($this->_min) && is_null($this->_max))) {
+            $numeric_local = (int) eval('return '.$this->_local.';');
+            if ((!is_null($this->_min) && $numeric_local < $this->_min) ||
+                (!is_null($this->_max) && $numeric_local > $this->_max)) {
+                $this->_error = true;
+                $this->_input = $input;
+                $this->_local = $local;
+                $valid = false;
+            }
+        }
+        return $valid;
+    }
 
     function out($var, $fmt='php') {
 
diff --git a/lib/plugins/config/settings/config.metadata.php b/lib/plugins/config/settings/config.metadata.php
index 331da5ab8d975ba32aedb59982f03822b12b6ddd..ca2cd0c12e412e6165a76262509dc1fced714d69 100644
--- a/lib/plugins/config/settings/config.metadata.php
+++ b/lib/plugins/config/settings/config.metadata.php
@@ -16,6 +16,7 @@
  *   ''             - default class ('setting'), textarea, minimal input validation, setting output in quotes
  *   'string'       - single line text input, minimal input validation, setting output in quotes
  *   'numeric'      - text input, accepts numbers and arithmetic operators, setting output without quotes
+ *                    if given the '_min' and '_max' parameters are used for validation
  *   'numericopt'   - like above, but accepts empty values
  *   'onoff'        - checkbox input, setting output  0|1
  *   'multichoice'  - select input (single choice), setting output with quotes, required _choices parameter
@@ -54,6 +55,8 @@
  *   '_combine'    - complimentary output setting values which can be combined into a single display checkbox
  *                   optional for 'multicheckbox', ignored by other classes
  *   '_code'       - encoding method to use, accepted values: 'base64','uuencode','plain'.  defaults to plain.
+ *   '_min'        - minimum numeric value, optional for 'numeric' and 'numericopt', ignored by others
+ *   '_max'        - maximum numeric value, optional for 'numeric' and 'numericopt', ignored by others
  *
  * @author    Chris Smith <chris@jalakai.co.uk>
  */
@@ -98,7 +101,7 @@ $meta['allowdebug']  = array('onoff');
 
 $meta['_display']    = array('fieldset');
 $meta['recent']      = array('numeric');
-$meta['breadcrumbs'] = array('numeric');
+$meta['breadcrumbs'] = array('numeric','_min' => 0);
 $meta['youarehere']  = array('onoff');
 $meta['fullpath']    = array('onoff');
 $meta['typography']  = array('multichoice','_choices' => array(0,1,2));
@@ -119,7 +122,7 @@ $meta['_authentication'] = array('fieldset');
 $meta['useacl']      = array('onoff');
 $meta['autopasswd']  = array('onoff');
 $meta['authtype']    = array('authtype');
-$meta['passcrypt']   = array('multichoice','_choices' => array('smd5','md5','apr1','sha1','ssha','crypt','mysql','my411','kmd5'));
+$meta['passcrypt']   = array('multichoice','_choices' => array('smd5','md5','apr1','sha1','ssha','crypt','mysql','my411','kmd5','pmd5','hmd5'));
 $meta['defaultgroup']= array('string');
 $meta['superuser']   = array('string');
 $meta['manager']     = array('string');
@@ -174,6 +177,7 @@ $meta['canonical']   = array('onoff');
 $meta['fnencode']    = array('multichoice','_choices' => array('url','safe','utf-8'));
 $meta['autoplural']  = array('onoff');
 $meta['mailfrom']    = array('richemail');
+$meta['mailprefix']  = array('string');
 $meta['compress']    = array('onoff');
 $meta['gzip_output'] = array('onoff');
 $meta['hidepages']   = array('string');
diff --git a/lib/plugins/info/syntax.php b/lib/plugins/info/syntax.php
index ba2831a901f6da32d0716805c8a86e995a28b9b7..026a438bb20a82c351784a9d846a111b73aef344 100644
--- a/lib/plugins/info/syntax.php
+++ b/lib/plugins/info/syntax.php
@@ -253,4 +253,4 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin {
     }
 }
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/lib/plugins/plugin/lang/cs/lang.php b/lib/plugins/plugin/lang/cs/lang.php
index c15a5ca213a25a991cb1ffa8fadcaf78726e5c5d..54de0ff1898cdff807b9785d4de3546d6a2bfa43 100644
--- a/lib/plugins/plugin/lang/cs/lang.php
+++ b/lib/plugins/plugin/lang/cs/lang.php
@@ -26,7 +26,7 @@ $lang['source']                = 'Zdroj:';
 $lang['unknown']               = 'neznámý';
 $lang['updating']              = 'Aktualizuji ...';
 $lang['updated']               = 'Modul %s úspěšně aktualizován';
-$lang['updates']               = 'Následjící pluginy byly úspěšně aktualizovány';
+$lang['updates']               = 'Následující pluginy byly úspěšně aktualizovány';
 $lang['update_none']           = 'Žádné aktualizace nenalezeny.';
 $lang['deleting']              = 'Probíhá mazání ...';
 $lang['deleted']               = 'Plugin %s smazán.';
@@ -49,7 +49,7 @@ $lang['error_download']        = 'Nelze stáhnout soubor s pluginem: %s';
 $lang['error_badurl']          = 'URL je zřejmě chybná - nelze z ní určit název souboru';
 $lang['error_dircreate']       = 'Nelze vytvořit dočasný adresář ke stažení dat';
 $lang['error_decompress']      = 'Správce pluginů nemůže rozbalit stažený soubor. Toto může být způsobeno chybou při stahování. Můžete se pokusit stahování opakovat. Chyba může být také v kompresním formátu souboru. V tom případě bude nutné stáhnout a nainstalovat plugin ručně.';
-$lang['error_copy']            = 'Došlo k chybě při instalaci pluginu <em>%s</em>. Je možné, že na disku není volné místo, nebo mohou být špatně nastavena přístupová práva. Pozor, mohlo dojít k častečné a tudíž chybné instalaci pluginu a tím může být ohrožena stabilita wiki.';
+$lang['error_copy']            = 'Došlo k chybě při instalaci pluginu <em>%s</em>. Je možné, že na disku není volné místo, nebo mohou být špatně nastavena přístupová práva. Pozor, mohlo dojít k částečné a tudíž chybné instalaci pluginu a tím může být ohrožena stabilita wiki.';
 $lang['error_delete']          = 'Došlo k chybě při pokusu o smazání pluginu <em>%s</em>. Nejspíše je chyba v nastavení přístupových práv k některým souborům či adresářům.';
 $lang['enabled']               = 'Plugin %s aktivován.';
 $lang['notenabled']            = 'Plugin %s nelze aktivovat, zkontrolujte práva k souborům.';
diff --git a/lib/plugins/plugin/lang/de-informal/lang.php b/lib/plugins/plugin/lang/de-informal/lang.php
index 65050b896abe50588d4260673bd9f4d2209fb09b..3ba729fd6116a837f21b97343c4654d1ffecdc9e 100644
--- a/lib/plugins/plugin/lang/de-informal/lang.php
+++ b/lib/plugins/plugin/lang/de-informal/lang.php
@@ -6,6 +6,7 @@
  * @author Juergen Schwarzer <jschwarzer@freenet.de>
  * @author Marcel Metz <marcel_metz@gmx.de>
  * @author Matthias Schulte <post@lupo49.de>
+ * @author Christian Wichmann <nospam@zone0.de>
  */
 $lang['menu']                  = 'Plugins verwalten';
 $lang['download']              = 'Herunterladen und installieren einer neuen Erweiterung';
diff --git a/lib/plugins/plugin/lang/de/lang.php b/lib/plugins/plugin/lang/de/lang.php
index e981f4a600edf077e1b2e3807b2e11398a24028b..6f785168bcc989b5f1cf417219db85888be2a6a7 100644
--- a/lib/plugins/plugin/lang/de/lang.php
+++ b/lib/plugins/plugin/lang/de/lang.php
@@ -14,6 +14,8 @@
  * @author Blitzi94@gmx.de
  * @author Robert Bogenschneider <robog@GMX.de>
  * @author Robert Bogenschneider <robog@gmx.de>
+ * @author Niels Lange <niels@boldencursief.nl>
+ * @author Christian Wichmann <nospam@zone0.de>
  */
 $lang['menu']                  = 'Plugins verwalten';
 $lang['download']              = 'Neues Plugin herunterladen und installieren';
diff --git a/lib/plugins/plugin/lang/en/lang.php b/lib/plugins/plugin/lang/en/lang.php
index e575d3d67a447fcd0f5ae3dd1c32f04a310dc05b..ccbd207e9fbda3a63301bd109a46a62b2f26d501 100644
--- a/lib/plugins/plugin/lang/en/lang.php
+++ b/lib/plugins/plugin/lang/en/lang.php
@@ -74,4 +74,4 @@ $lang['notenabled']       = 'Plugin %s could not be enabled, check file permissi
 $lang['disabled']         = 'Plugin %s disabled.';
 $lang['notdisabled']      = 'Plugin %s could not be disabled, check file permissions.';
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/lib/plugins/plugin/lang/he/lang.php b/lib/plugins/plugin/lang/he/lang.php
index c6e462193633812241e4660d1ca574a8f402c491..47253e335f4588c1c19b68d2195c4f0c2a398a63 100644
--- a/lib/plugins/plugin/lang/he/lang.php
+++ b/lib/plugins/plugin/lang/he/lang.php
@@ -7,6 +7,7 @@
  * @author Dotan Kamber <kamberd@yahoo.com>
  * @author Moshe Kaplan <mokplan@gmail.com>
  * @author Yaron Yogev <yaronyogev@gmail.com>
+ * @author Yaron Shahrabani <sh.yaron@gmail.com>
  */
 $lang['menu']                  = 'ניהול הרחבות';
 $lang['download']              = 'הורדת והתקנת הרחבה חדשה';
diff --git a/lib/plugins/plugin/lang/ko/lang.php b/lib/plugins/plugin/lang/ko/lang.php
index af14a0cd2c291c04530cf867483c1be6326e8884..72c04ddab25c36f39fc287ef44ac6f7b513882f6 100644
--- a/lib/plugins/plugin/lang/ko/lang.php
+++ b/lib/plugins/plugin/lang/ko/lang.php
@@ -7,6 +7,7 @@
  * @author dongnak@gmail.com
  * @author Song Younghwan <purluno@gmail.com>
  * @author SONG Younghwan <purluno@gmail.com>
+ * @author Seung-Chul Yoo  <dryoo@live.com>
  */
 $lang['menu']                  = '플러그인 관리자';
 $lang['download']              = '새로운 플러그인 다운로드 및 설치';
diff --git a/lib/plugins/plugin/lang/la/admin_plugin.txt b/lib/plugins/plugin/lang/la/admin_plugin.txt
index 1a361140c834f5a73e9cfe65320e0286c8d6dbe5..2a41977fcf8ae1e9ad9b2457607638273105b4ca 100644
--- a/lib/plugins/plugin/lang/la/admin_plugin.txt
+++ b/lib/plugins/plugin/lang/la/admin_plugin.txt
@@ -1,3 +1,3 @@
 ====== Addendorum Administratio ======
 
-In hac pagina omnia uicis [[doku>plugins|plugins]] mutare et administrare potes. Ut addenda capere et his uti, in scrinio addendorum scribere et legere potest.
\ No newline at end of file
+In hac pagina omnia uicis [[doku>plugins|plugins]] mutare et administrare potes. Vt addenda capere et his uti, in scrinio addendorum scribere et legere potest.
\ No newline at end of file
diff --git a/lib/plugins/plugin/lang/la/lang.php b/lib/plugins/plugin/lang/la/lang.php
index 021dc84d5095f3f3be018286ae2cbd70f7637fc4..cd2d81cbd9e2da4c0c8f9aaf232fad2d35ccd455 100644
--- a/lib/plugins/plugin/lang/la/lang.php
+++ b/lib/plugins/plugin/lang/la/lang.php
@@ -2,8 +2,9 @@
 /**
  * Latin language file
  *
+ * @author Massimiliano Vassalli <vassalli.max@gmail.com>
  */
-$lang['menu']                  = 'Administrationis addenda';
+$lang['menu']                  = 'Addendorum administratio';
 $lang['download']              = 'Noua addenda cape';
 $lang['manage']                = 'Addenta in usu';
 $lang['btn_info']              = 'Notae';
diff --git a/lib/plugins/plugin/lang/pt-br/admin_plugin.txt b/lib/plugins/plugin/lang/pt-br/admin_plugin.txt
index 1809bb5853150396eba0959f2b1634457bec0da5..9e49f51367707a41b5465ecf792bd4a07b17d1e0 100644
--- a/lib/plugins/plugin/lang/pt-br/admin_plugin.txt
+++ b/lib/plugins/plugin/lang/pt-br/admin_plugin.txt
@@ -1,3 +1,3 @@
 ====== Gerenciamento de Plug-ins ======
 
-Nesta página você pode gerenciar tudo relacionado aos [[doku>plug-ins|plug-ins]] do DokuWiki. Para você baixar e instalar um plug-in o servidor web deve ter permissão de escrita na pasta onde ficam os plug-ins.
+Nesta página você pode gerenciar tudo relacionado aos [[doku>plugins|plug-ins]] do DokuWiki. Para você baixar e instalar um plug-in o servidor web deve ter permissão de escrita na pasta onde ficam os plug-ins.
diff --git a/lib/plugins/plugin/lang/ru/lang.php b/lib/plugins/plugin/lang/ru/lang.php
index a33f9541868a41b95f64891ea86c139540e1d211..ed1fc22b385c8536361df5cd8e112d44b7709d38 100644
--- a/lib/plugins/plugin/lang/ru/lang.php
+++ b/lib/plugins/plugin/lang/ru/lang.php
@@ -30,11 +30,11 @@ $lang['lastupdate']            = 'Последнее обновление:';
 $lang['source']                = 'Источник:';
 $lang['unknown']               = 'неизвестно';
 $lang['updating']              = 'Обновление...';
-$lang['updated']               = 'Плагин %s успешно обновлен';
+$lang['updated']               = 'Плагин %s успешно обновлён';
 $lang['updates']               = 'Следующие плагины были успешно обновлены';
 $lang['update_none']           = 'Обновления не найдены.';
 $lang['deleting']              = 'Удаление...';
-$lang['deleted']               = 'Плагин %s удален.';
+$lang['deleted']               = 'Плагин %s удалён.';
 $lang['downloading']           = 'Скачивание...';
 $lang['downloaded']            = 'Плагин %s успешно установлен';
 $lang['downloads']             = 'Следующие плагины были успешно установлены:';
@@ -50,9 +50,9 @@ $lang['author']                = 'Автор:';
 $lang['www']                   = 'Странца:';
 $lang['error']                 = 'Произошла неизвестная ошибка.';
 $lang['error_download']        = 'Не могу скачать файл плагина: %s';
-$lang['error_badurl']          = 'Возможно, неправильный адрес — не могу определить имя файла из адреса';
+$lang['error_badurl']          = 'Возможно неправильный адрес — не могу определить имя файла из адреса';
 $lang['error_dircreate']       = 'Не могу создать временную директорию для скачивания';
-$lang['error_decompress']      = 'Менеджеру плагинов не удалось распаковать скачанный файл. Это может быть результатом ошибки при скачивании, в этом случае вы можете попробовать снова; или же плагин упакован неизвестным архиватором, тогда вам необходимо скачать и установить плагин вручную.';
+$lang['error_decompress']      = 'Менеджеру плагинов не удалось распаковать скачанный файл. Это может быть результатом ошибки при скачивании, в этом случае вы можете попробовать снова, или же плагин упакован неизвестным архиватором, тогда вам необходимо скачать и установить плагин вручную.';
 $lang['error_copy']            = 'Произошла ошибка копирования при попытке установки файлов для плагина <em>%s</em>: переполнение диска или неправильные права доступа. Это могло привести к частичной установке плагина и неустойчивости вашей вики.';
 $lang['error_delete']          = 'Произошла ошибка при попытке удалить плагин <em>%s</em>.  Наиболее вероятно, что нет необходимых прав доступа к файлам или директориям';
 $lang['enabled']               = 'Плагин %s включён.';
diff --git a/lib/plugins/plugin/lang/sl/lang.php b/lib/plugins/plugin/lang/sl/lang.php
index 9423e4e757a2c4a698291c267ea40f06e974c723..41d8579798ce5a8a96497d8ecebf5b1319f62aad 100644
--- a/lib/plugins/plugin/lang/sl/lang.php
+++ b/lib/plugins/plugin/lang/sl/lang.php
@@ -4,6 +4,7 @@
  *
  * @author Dejan Levec <webphp@gmail.com>
  * @author Boštjan Seničar <senicar@gmail.com>
+ * @author Gregor Skumavc (grega.skumavc@gmail.com)
  */
 $lang['btn_delete']            = 'Izbriši';
 $lang['btn_settings']          = 'Nastavitve';
diff --git a/lib/plugins/plugin/lang/tr/lang.php b/lib/plugins/plugin/lang/tr/lang.php
index 28db9109dce5b775b28df44f51b40b26836ada17..9a655e400b83f14069bf837d4a84af9a4b266fca 100644
--- a/lib/plugins/plugin/lang/tr/lang.php
+++ b/lib/plugins/plugin/lang/tr/lang.php
@@ -2,11 +2,10 @@
 /**
  * Turkish language file
  *
- * @author Aydın Coşkuner aydinweb@gmail.com
  * @author Aydın Coşkuner <aydinweb@gmail.com>
- * @author yavuzselim@gmail.com
- * @author Cihan Kahveci kahvecicihan@gmail.com
+ * @author Cihan Kahveci <kahvecicihan@gmail.com>
  * @author Yavuz Selim <yavuzselim@gmail.com>
+ * @author Caleb Maclennan <caleb@alerque.com>
  */
 $lang['menu']                  = 'Eklenti Yönetimi';
 $lang['download']              = 'Yeni bir eklenti indirip kur';
diff --git a/lib/plugins/popularity/action.php b/lib/plugins/popularity/action.php
new file mode 100644
index 0000000000000000000000000000000000000000..bf11efba67a66b1523fcb98a1e2aac8932637b55
--- /dev/null
+++ b/lib/plugins/popularity/action.php
@@ -0,0 +1,57 @@
+<?php
+/**
+ * Popularity Feedback Plugin
+ *
+ * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ */
+
+require_once(DOKU_PLUGIN.'action.php');
+require_once(DOKU_PLUGIN.'popularity/admin.php');
+
+class action_plugin_popularity extends Dokuwiki_Action_Plugin {
+    var $helper;
+
+    function action_plugin_popularity(){
+        $this->helper = $this->loadHelper('popularity', false);
+    }
+
+    /**
+     * Register its handlers with the dokuwiki's event controller
+     */
+    function register(&$controller) {
+        $controller->register_hook('INDEXER_TASKS_RUN', 'AFTER',  $this, '_autosubmit', array());
+    }
+
+    function _autosubmit(&$event, $param){
+        //Do we have to send the data now
+        if ( !$this->helper->isAutosubmitEnabled() || $this->_isTooEarlyToSubmit() ){
+            return;
+        }
+
+        //Actually send it
+        $status = $this->helper->sendData( $this->helper->gatherAsString() );
+
+
+        if ( $status !== '' ){
+            //If an error occured, log it
+            io_saveFile( $this->helper->autosubmitErrorFile, $status );
+        } else {
+            //If the data has been sent successfully, previous log of errors are useless
+            @unlink($this->helper->autosubmitErrorFile);
+            //Update the last time we sent data
+            touch ( $this->helper->autosubmitFile );
+        }
+
+        $event->stopPropagation();
+        $event->preventDefault();
+    }
+
+    /**
+     * Check if it's time to send autosubmit data
+     * (we should have check if autosubmit is enabled first)
+     */
+    function _isTooEarlyToSubmit(){
+        $lastSubmit = $this->helper->lastSentTime();
+        return $lastSubmit + 24*60*60*30 > time();
+    }
+}
diff --git a/lib/plugins/popularity/admin.php b/lib/plugins/popularity/admin.php
index 71ea4079900d653607f0bf62f12f86b14c375ff6..40c3f545284a63b8880d007c2d6f62fc35c5a0ce 100644
--- a/lib/plugins/popularity/admin.php
+++ b/lib/plugins/popularity/admin.php
@@ -13,21 +13,15 @@ if(!defined('DOKU_INC')) die();
  * need to inherit from this class
  */
 class admin_plugin_popularity extends DokuWiki_Admin_Plugin {
-    var $version = '2010-09-17';
+    var $version;
+    var $helper;
+    var $sentStatus = null;
 
+    function admin_plugin_popularity(){
+        $this->helper = $this->loadHelper('popularity', false);
 
-    /**
-     * return some info
-     */
-    function getInfo(){
-        return array(
-            'author' => 'Andreas Gohr',
-            'email'  => 'andi@splitbrain.org',
-            'date'   => $this->version,
-            'name'   => 'Popularity Feedback Plugin',
-            'desc'   => 'Send anonymous data about your wiki to the developers.',
-            'url'    => 'http://www.dokuwiki.org/plugin:popularity',
-        );
+        $pluginInfo = $this->getInfo();
+        $this->version = $pluginInfo['date'];
     }
 
     /**
@@ -56,204 +50,99 @@ class admin_plugin_popularity extends DokuWiki_Admin_Plugin {
      * handle user request
      */
     function handle() {
+        //Send the data
+        if ( isset($_REQUEST['data']) ){
+            $this->sentStatus = $this->helper->sendData( $_REQUEST['data'] );
+            if ( $this->sentStatus === '' ){
+                //Update the last time we sent the data
+                touch ( $this->helper->popularityLastSubmitFile );
+            }
+            //Deal with the autosubmit option
+            $this->_enableAutosubmit( isset($_REQUEST['autosubmit']) );
+        }
     }
 
     /**
-     * Output HTML form
+     * Enable or disable autosubmit
+     * @param bool $enable If TRUE, it will enable autosubmit. Else, it will disable it.
      */
-    function html() {
-        echo $this->locale_xhtml('intro');
-
-        flush();
-        $data = $this->_gather();
-        echo '<form method="post" action="http://update.dokuwiki.org/popularity.php" accept-charset="utf-8">';
-        echo '<fieldset style="width: 60%;">';
-        echo '<textarea class="edit" rows="10" cols="80" readonly="readonly" name="data">';
-        foreach($data as $key => $val){
-            if(is_array($val)) foreach($val as $v){
-                echo hsc($key)."\t".hsc($v)."\n";
-            }else{
-                echo hsc($key)."\t".hsc($val)."\n";
-            }
+    function _enableAutosubmit( $enable ){
+        if ( $enable ){
+            io_saveFile( $this->helper->autosubmitFile, ' ');
+        } else {
+            @unlink($this->helper->autosubmitFile);
         }
-        echo '</textarea><br />';
-        echo '<input type="submit" class="button" value="'.$this->getLang('submit').'"/>';
-        echo '</fieldset>';
-        echo '</form>';
-
-//        dbg($data);
     }
 
-
     /**
-     * Gather all information
+     * Output HTML form
      */
-    function _gather(){
-        global $conf;
-        global $auth;
-        $data = array();
-        $phptime = ini_get('max_execution_time');
-        @set_time_limit(0);
-
-        // version
-        $data['anon_id'] = md5(auth_cookiesalt());
-        $data['version'] = getVersion();
-        $data['popversion'] = $this->version;
-        $data['language'] = $conf['lang'];
-        $data['now']      = time();
-
-        // some config values
-        $data['conf_useacl']   = $conf['useacl'];
-        $data['conf_authtype'] = $conf['authtype'];
-        $data['conf_template'] = $conf['template'];
-
-        // number and size of pages
-        $list = array();
-        search($list,$conf['datadir'],array($this,'_search_count'),'','');
-        $data['page_count']    = $list['file_count'];
-        $data['page_size']     = $list['file_size'];
-        $data['page_biggest']  = $list['file_max'];
-        $data['page_smallest'] = $list['file_min'];
-        $data['page_nscount']  = $list['dir_count'];
-        $data['page_nsnest']   = $list['dir_nest'];
-        if($list['file_count']) $data['page_avg'] = $list['file_size'] / $list['file_count'];
-        $data['page_oldest']   = $list['file_oldest'];
-        unset($list);
-
-        // number and size of media
-        $list = array();
-        search($list,$conf['mediadir'],array($this,'_search_count'),array('all'=>true));
-        $data['media_count']    = $list['file_count'];
-        $data['media_size']     = $list['file_size'];
-        $data['media_biggest']  = $list['file_max'];
-        $data['media_smallest'] = $list['file_min'];
-        $data['media_nscount']  = $list['dir_count'];
-        $data['media_nsnest']   = $list['dir_nest'];
-        if($list['file_count']) $data['media_avg'] = $list['file_size'] / $list['file_count'];
-        unset($list);
-
-        // number and size of cache
-        $list = array();
-        search($list,$conf['cachedir'],array($this,'_search_count'),array('all'=>true));
-        $data['cache_count']    = $list['file_count'];
-        $data['cache_size']     = $list['file_size'];
-        $data['cache_biggest']  = $list['file_max'];
-        $data['cache_smallest'] = $list['file_min'];
-        if($list['file_count']) $data['cache_avg'] = $list['file_size'] / $list['file_count'];
-        unset($list);
-
-        // number and size of index
-        $list = array();
-        search($list,$conf['indexdir'],array($this,'_search_count'),array('all'=>true));
-        $data['index_count']    = $list['file_count'];
-        $data['index_size']     = $list['file_size'];
-        $data['index_biggest']  = $list['file_max'];
-        $data['index_smallest'] = $list['file_min'];
-        if($list['file_count']) $data['index_avg'] = $list['file_size'] / $list['file_count'];
-        unset($list);
-
-        // number and size of meta
-        $list = array();
-        search($list,$conf['metadir'],array($this,'_search_count'),array('all'=>true));
-        $data['meta_count']    = $list['file_count'];
-        $data['meta_size']     = $list['file_size'];
-        $data['meta_biggest']  = $list['file_max'];
-        $data['meta_smallest'] = $list['file_min'];
-        if($list['file_count']) $data['meta_avg'] = $list['file_size'] / $list['file_count'];
-        unset($list);
-
-        // number and size of attic
-        $list = array();
-        search($list,$conf['olddir'],array($this,'_search_count'),array('all'=>true));
-        $data['attic_count']    = $list['file_count'];
-        $data['attic_size']     = $list['file_size'];
-        $data['attic_biggest']  = $list['file_max'];
-        $data['attic_smallest'] = $list['file_min'];
-        if($list['file_count']) $data['attic_avg'] = $list['file_size'] / $list['file_count'];
-        $data['attic_oldest']   = $list['file_oldest'];
-        unset($list);
+    function html() {
+        if ( ! isset($_REQUEST['data']) ){
+            echo $this->locale_xhtml('intro');
+
+            //If there was an error the last time we tried to autosubmit, warn the user
+            if ( $this->helper->isAutoSubmitEnabled() ){
+                if ( @file_exists($this->helper->autosubmitErrorFile) ){
+                    echo $this->getLang('autosubmitError');
+                    echo io_readFile( $this->helper->autosubmitErrorFile );
+                }
+            }
 
-        // user count
-        if($auth && $auth->canDo('getUserCount')){
-            $data['user_count'] = $auth->getUserCount();
-        }
+            flush();
+            echo $this->buildForm('server');
 
-        // calculate edits per day
-        $list = @file($conf['metadir'].'/_dokuwiki.changes');
-        $count = count($list);
-        if($count > 2){
-            $first = (int) substr(array_shift($list),0,10);
-            $last  = (int) substr(array_pop($list),0,10);
-            $dur = ($last - $first)/(60*60*24); // number of days in the changelog
-            $data['edits_per_day'] = $count/$dur;
+            //Print the last time the data was sent
+            $lastSent = $this->helper->lastSentTime();
+            if ( $lastSent !== 0 ){
+                echo $this->getLang('lastSent') . datetime_h($lastSent);
+            }
+        } else {
+            //If we just submitted the form
+            if ( $this->sentStatus === '' ){
+                //If we successfully sent the data
+                echo $this->locale_xhtml('submitted');
+            } else {
+                //If we failed to submit the data, try directly with the browser
+                echo $this->getLang('submissionFailed') . $this->sentStatus . '<br />';
+                echo $this->getLang('submitDirectly');
+                echo $this->buildForm('browser', $_REQUEST['data']);
+            }
         }
-        unset($list);
-
-        // plugins
-        $data['plugin'] = plugin_list();
-
-        // pcre info
-        if(defined('PCRE_VERSION')) $data['pcre_version'] = PCRE_VERSION;
-        $data['pcre_backtrack'] = ini_get('pcre.backtrack_limit');
-        $data['pcre_recursion'] = ini_get('pcre.recursion_limit');
-
-        // php info
-        $data['os'] = PHP_OS;
-        $data['webserver'] = $_SERVER['SERVER_SOFTWARE'];
-        $data['php_version'] = phpversion();
-        $data['php_sapi'] = php_sapi_name();
-        $data['php_memory'] = $this->_to_byte(ini_get('memory_limit'));
-        $data['php_exectime'] = $phptime;
-        $data['php_extension'] = get_loaded_extensions();
-
-        return $data;
     }
 
 
-    function _search_count(&$data,$base,$file,$type,$lvl,$opts){
-        // traverse
-        if($type == 'd'){
-            if($data['dir_nest'] < $lvl) $data['dir_nest'] = $lvl;
-            $data['dir_count']++;
-            return true;
-        }
-
-        //only search txt files if 'all' option not set
-        if($opts['all'] || substr($file,-4) == '.txt'){
-            $size = filesize($base.'/'.$file);
-            $date = filemtime($base.'/'.$file);
-            $data['file_count']++;
-            $data['file_size'] += $size;
-            if(!isset($data['file_min']) || $data['file_min'] > $size) $data['file_min'] = $size;
-            if($data['file_max'] < $size) $data['file_max'] = $size;
-            if(!isset($data['file_oldest']) || $data['file_oldest'] > $date) $data['file_oldest'] = $date;
-        }
-
-        return false;
-    }
-
     /**
-     * Convert php.ini shorthands to byte
-     *
-     * @author <gilthans dot NO dot SPAM at gmail dot com>
-     * @link   http://de3.php.net/manual/en/ini.core.php#79564
+     * Build the form which presents the data to be sent
+     * @param string $submit How is the data supposed to be sent? (may be: 'browser' or 'server')
+     * @param string $data   The popularity data, if it has already been computed. NULL otherwise.
+     * @return The form, as an html string
      */
-    function _to_byte($v){
-        $l = substr($v, -1);
-        $ret = substr($v, 0, -1);
-        switch(strtoupper($l)){
-            case 'P':
-                $ret *= 1024;
-            case 'T':
-                $ret *= 1024;
-            case 'G':
-                $ret *= 1024;
-            case 'M':
-                $ret *= 1024;
-            case 'K':
-                $ret *= 1024;
-            break;
+    function buildForm($submissionMode, $data = null){
+        $url = ($submissionMode === 'browser' ? $this->helper->submitUrl : script());
+        if ( is_null($data) ){
+            $data = $this->helper->gatherAsString();
+        }
+
+        $form = '<form method="post" action="'. $url  .'" accept-charset="utf-8">'
+            .'<fieldset style="width: 60%;">'
+            .'<textarea class="edit" rows="10" cols="80" readonly="readonly" name="data">'
+            .$data
+            .'</textarea><br />';
+
+        //If we submit via the server, we give the opportunity to suscribe to the autosubmission option
+        if ( $submissionMode !== 'browser' ){
+            $form .= '<label for="autosubmit">'
+                .'<input type="checkbox" name="autosubmit" id="autosubmit" '
+                .($this->helper->isAutosubmitEnabled() ? 'checked' : '' )
+                .'/>' . $this->getLang('autosubmit') .'<br />'
+                .'</label>'
+                .'<input type="hidden" name="do" value="admin">'
+                .'<input type="hidden" name="page" value="popularity">';
         }
-        return $ret;
+        $form .= '<input type="submit" class="button" value="'.$this->getLang('submit').'"/>'
+            .'</fieldset>'
+            .'</form>';
+        return $form;
     }
 }
diff --git a/lib/plugins/popularity/helper.php b/lib/plugins/popularity/helper.php
new file mode 100644
index 0000000000000000000000000000000000000000..629d0bd676099fc348632dc75be5cf1e55c4c68e
--- /dev/null
+++ b/lib/plugins/popularity/helper.php
@@ -0,0 +1,291 @@
+<?php
+/**
+ * Popularity Feedback Plugin
+ *
+ * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ */
+
+class helper_plugin_popularity extends Dokuwiki_Plugin {
+    /**
+     * The url where the data should be sent
+     */
+    var $submitUrl = 'http://update.dokuwiki.org/popularity.php';
+
+    /**
+     * Name of the file which determine if the the autosubmit is enabled,
+     * and when it was submited for the last time
+     */
+    var $autosubmitFile;
+
+    /**
+     * File where the last error which happened when we tried to autosubmit, will be log
+     */
+    var $autosubmitErrorFile;
+
+    /**
+     * Name of the file which determine when the popularity data was manually
+     * submitted for the last time
+     * (If this file doesn't exist, the data has never been sent)
+     */
+    var $popularityLastSubmitFile;
+
+
+    function helper_plugin_popularity(){
+        global $conf;
+        $this->autosubmitFile = $conf['cachedir'].'/autosubmit.txt';
+        $this->autosubmitErrorFile = $conf['cachedir'].'/autosubmitError.txt';
+        $this->popularityLastSubmitFile = $conf['cachedir'].'/lastSubmitTime.txt';
+    }
+
+    function getMethods(){
+        $result = array();
+        $result[] = array(
+                'name'   => 'isAutoSubmitEnabled',
+                'desc'   => 'Check if autosubmit is enabled',
+                'params' => array(),
+                'return' => array('result' => 'bool')
+                );
+        $result[] = array(
+                'name'   => 'sendData',
+                'desc'   => 'Send the popularity data',
+                'params' => array('data' => 'string'),
+                'return' => array()
+                );
+        $result[] = array(
+                'name' => 'gatherAsString',
+                'desc' => 'Gather the popularity data',
+                'params' => array(),
+                'return' => array('data' => 'string')
+                );
+        $result[] = array(
+                'name'   => 'lastSentTime',
+                'desc'   => 'Compute the last time popularity data was sent',
+                'params' => 'array()',
+                'return' => array('data' => 'int')
+                );
+        return $result;
+
+    }
+
+    /**
+     * Check if autosubmit is enabled
+     * @return TRUE if we should send data once a month, FALSE otherwise
+     */
+    function isAutoSubmitEnabled(){
+        return @file_exists($this->autosubmitFile);
+    }
+
+    /**
+     * Send the data, to the submit url
+     * @param string $data The popularity data
+     * @return An empty string if everything worked fine, a string describing the error otherwise
+     */
+    function sendData($data){
+        $error = '';
+        $httpClient = new DokuHTTPClient();
+        $status = $httpClient->sendRequest($this->submitUrl, $data, 'POST');
+        if ( ! $status ){
+            $error = $httpClient->error;
+        }
+        return $error;
+    }
+
+    /**
+     * Compute the last time the data was sent. If it has never been sent, we return 0.
+     */
+    function lastSentTime(){
+        $manualSubmission = @filemtime($this->popularityLastSubmitFile);
+        $autoSubmission   = @filemtime($this->autosubmitFile);
+
+        return max((int) $manualSubmission, (int) $autoSubmission);
+    }
+
+    /**
+     * Gather all information
+     * @return The popularity data as a string
+     */
+    function gatherAsString(){
+        $data = $this->_gather();
+        $string = '';
+        foreach($data as $key => $val){
+            if(is_array($val)) foreach($val as $v){
+                $string .=  hsc($key)."\t".hsc($v)."\n";
+            }else{
+                $string .= hsc($key)."\t".hsc($val)."\n";
+            }
+        }
+        return $string;
+    }
+
+    /**
+     * Gather all information
+     * @return The popularity data as an array
+     */
+    function _gather(){
+        global $conf;
+        global $auth;
+        $data = array();
+        $phptime = ini_get('max_execution_time');
+        @set_time_limit(0);
+
+        // version
+        $data['anon_id'] = md5(auth_cookiesalt());
+        $data['version'] = getVersion();
+        $data['popversion'] = $this->version;
+        $data['language'] = $conf['lang'];
+        $data['now']      = time();
+
+        // some config values
+        $data['conf_useacl']   = $conf['useacl'];
+        $data['conf_authtype'] = $conf['authtype'];
+        $data['conf_template'] = $conf['template'];
+
+        // number and size of pages
+        $list = array();
+        search($list,$conf['datadir'],array($this,'_search_count'),'','');
+        $data['page_count']    = $list['file_count'];
+        $data['page_size']     = $list['file_size'];
+        $data['page_biggest']  = $list['file_max'];
+        $data['page_smallest'] = $list['file_min'];
+        $data['page_nscount']  = $list['dir_count'];
+        $data['page_nsnest']   = $list['dir_nest'];
+        if($list['file_count']) $data['page_avg'] = $list['file_size'] / $list['file_count'];
+        $data['page_oldest']   = $list['file_oldest'];
+        unset($list);
+
+        // number and size of media
+        $list = array();
+        search($list,$conf['mediadir'],array($this,'_search_count'),array('all'=>true));
+        $data['media_count']    = $list['file_count'];
+        $data['media_size']     = $list['file_size'];
+        $data['media_biggest']  = $list['file_max'];
+        $data['media_smallest'] = $list['file_min'];
+        $data['media_nscount']  = $list['dir_count'];
+        $data['media_nsnest']   = $list['dir_nest'];
+        if($list['file_count']) $data['media_avg'] = $list['file_size'] / $list['file_count'];
+        unset($list);
+
+        // number and size of cache
+        $list = array();
+        search($list,$conf['cachedir'],array($this,'_search_count'),array('all'=>true));
+        $data['cache_count']    = $list['file_count'];
+        $data['cache_size']     = $list['file_size'];
+        $data['cache_biggest']  = $list['file_max'];
+        $data['cache_smallest'] = $list['file_min'];
+        if($list['file_count']) $data['cache_avg'] = $list['file_size'] / $list['file_count'];
+        unset($list);
+
+        // number and size of index
+        $list = array();
+        search($list,$conf['indexdir'],array($this,'_search_count'),array('all'=>true));
+        $data['index_count']    = $list['file_count'];
+        $data['index_size']     = $list['file_size'];
+        $data['index_biggest']  = $list['file_max'];
+        $data['index_smallest'] = $list['file_min'];
+        if($list['file_count']) $data['index_avg'] = $list['file_size'] / $list['file_count'];
+        unset($list);
+
+        // number and size of meta
+        $list = array();
+        search($list,$conf['metadir'],array($this,'_search_count'),array('all'=>true));
+        $data['meta_count']    = $list['file_count'];
+        $data['meta_size']     = $list['file_size'];
+        $data['meta_biggest']  = $list['file_max'];
+        $data['meta_smallest'] = $list['file_min'];
+        if($list['file_count']) $data['meta_avg'] = $list['file_size'] / $list['file_count'];
+        unset($list);
+
+        // number and size of attic
+        $list = array();
+        search($list,$conf['olddir'],array($this,'_search_count'),array('all'=>true));
+        $data['attic_count']    = $list['file_count'];
+        $data['attic_size']     = $list['file_size'];
+        $data['attic_biggest']  = $list['file_max'];
+        $data['attic_smallest'] = $list['file_min'];
+        if($list['file_count']) $data['attic_avg'] = $list['file_size'] / $list['file_count'];
+        $data['attic_oldest']   = $list['file_oldest'];
+        unset($list);
+
+        // user count
+        if($auth && $auth->canDo('getUserCount')){
+            $data['user_count'] = $auth->getUserCount();
+        }
+
+        // calculate edits per day
+        $list = @file($conf['metadir'].'/_dokuwiki.changes');
+        $count = count($list);
+        if($count > 2){
+            $first = (int) substr(array_shift($list),0,10);
+            $last  = (int) substr(array_pop($list),0,10);
+            $dur = ($last - $first)/(60*60*24); // number of days in the changelog
+            $data['edits_per_day'] = $count/$dur;
+        }
+        unset($list);
+
+        // plugins
+        $data['plugin'] = plugin_list();
+
+        // pcre info
+        if(defined('PCRE_VERSION')) $data['pcre_version'] = PCRE_VERSION;
+        $data['pcre_backtrack'] = ini_get('pcre.backtrack_limit');
+        $data['pcre_recursion'] = ini_get('pcre.recursion_limit');
+
+        // php info
+        $data['os'] = PHP_OS;
+        $data['webserver'] = $_SERVER['SERVER_SOFTWARE'];
+        $data['php_version'] = phpversion();
+        $data['php_sapi'] = php_sapi_name();
+        $data['php_memory'] = $this->_to_byte(ini_get('memory_limit'));
+        $data['php_exectime'] = $phptime;
+        $data['php_extension'] = get_loaded_extensions();
+
+        return $data;
+    }
+
+    function _search_count(&$data,$base,$file,$type,$lvl,$opts){
+        // traverse
+        if($type == 'd'){
+            if($data['dir_nest'] < $lvl) $data['dir_nest'] = $lvl;
+            $data['dir_count']++;
+            return true;
+        }
+
+        //only search txt files if 'all' option not set
+        if($opts['all'] || substr($file,-4) == '.txt'){
+            $size = filesize($base.'/'.$file);
+            $date = filemtime($base.'/'.$file);
+            $data['file_count']++;
+            $data['file_size'] += $size;
+            if(!isset($data['file_min']) || $data['file_min'] > $size) $data['file_min'] = $size;
+            if($data['file_max'] < $size) $data['file_max'] = $size;
+            if(!isset($data['file_oldest']) || $data['file_oldest'] > $date) $data['file_oldest'] = $date;
+        }
+
+        return false;
+    }
+
+    /**
+     * Convert php.ini shorthands to byte
+     *
+     * @author <gilthans dot NO dot SPAM at gmail dot com>
+     * @link   http://de3.php.net/manual/en/ini.core.php#79564
+     */
+    function _to_byte($v){
+        $l = substr($v, -1);
+        $ret = substr($v, 0, -1);
+        switch(strtoupper($l)){
+            case 'P':
+                $ret *= 1024;
+            case 'T':
+                $ret *= 1024;
+            case 'G':
+                $ret *= 1024;
+            case 'M':
+                $ret *= 1024;
+            case 'K':
+                $ret *= 1024;
+            break;
+        }
+        return $ret;
+    }
+}
diff --git a/lib/plugins/popularity/lang/ar/lang.php b/lib/plugins/popularity/lang/ar/lang.php
index c0e7dc6afc694ecbe6d41fd60629e1e2a2150627..b2581294ae42525806f80865623af1debd4c2cd7 100644
--- a/lib/plugins/popularity/lang/ar/lang.php
+++ b/lib/plugins/popularity/lang/ar/lang.php
@@ -7,3 +7,8 @@
  */
 $lang['name']                  = 'رد الشعبية (قد يأخذ بعض الوقت ليحمل)';
 $lang['submit']                = 'أرسل البيانات';
+$lang['autosubmit']            = 'ارسل البيانات آليا كل شهر';
+$lang['submissionFailed']      = 'تعذر إرسال البيانات بسبب الخطأ التالي:';
+$lang['submitDirectly']        = 'يمكنك إرسال البيانات يدويا بارسال النموذج التالي.';
+$lang['autosubmitError']       = 'فشلت آخر محاولة للإرسال، بسبب الخطأ التالي:';
+$lang['lastSent']              = 'أرسلت البيانات';
diff --git a/lib/plugins/popularity/lang/ar/submitted.txt b/lib/plugins/popularity/lang/ar/submitted.txt
new file mode 100644
index 0000000000000000000000000000000000000000..085e3bd98a22af7b1bd096d763bf55824f013118
--- /dev/null
+++ b/lib/plugins/popularity/lang/ar/submitted.txt
@@ -0,0 +1,3 @@
+====== رد الشعبية ======
+
+أرسلت البيانات بنجاح.
\ No newline at end of file
diff --git a/lib/plugins/popularity/lang/cs/intro.txt b/lib/plugins/popularity/lang/cs/intro.txt
index 70cf1a42c82348e048c4979f3e89f74ced9a277f..4b386568ab2d36061215bcd3c61d88258a7ad90b 100644
--- a/lib/plugins/popularity/lang/cs/intro.txt
+++ b/lib/plugins/popularity/lang/cs/intro.txt
@@ -1,6 +1,6 @@
 ===== Průzkum používání =====
 
-Tento nástroj jednorázově shromáží anonymní data o vaší wiki a umožní vám odeslat je vývojářům DokuWiki. To jim pomůže lépe porozumět, jak uživatelé DokuWiki používají, a jejich rozhodnutí při dalším vývoji budou založena na statistikách z reálného používání DokuWiki.
+Tento nástroj jednorázově shromáždí anonymní data o vaší wiki a umožní vám odeslat je vývojářům DokuWiki. To jim pomůže lépe porozumět, jak uživatelé DokuWiki používají, a jejich rozhodnutí při dalším vývoji budou založena na statistikách z reálného používání DokuWiki.
 
 Chcete-li pomoci vývojářům, čas od času, jak vaše wiki poroste, použijte tento nástroj. Vaše data budou pokaždé označena stejným anonymním identifikátorem.
 
diff --git a/lib/plugins/popularity/lang/de-informal/lang.php b/lib/plugins/popularity/lang/de-informal/lang.php
index 076b371150a00fd68116fba20b0905a39a74f90d..f884ed69033d5919df5d8b0696c6404c8eb15d6a 100644
--- a/lib/plugins/popularity/lang/de-informal/lang.php
+++ b/lib/plugins/popularity/lang/de-informal/lang.php
@@ -6,6 +6,12 @@
  * @author Juergen Schwarzer <jschwarzer@freenet.de>
  * @author Marcel Metz <marcel_metz@gmx.de>
  * @author Matthias Schulte <post@lupo49.de>
+ * @author Christian Wichmann <nospam@zone0.de>
  */
 $lang['name']                  = 'Popularitätsrückmeldung (kann eine Weile dauern, bis es fertig geladen wurde)';
 $lang['submit']                = 'Sende Daten';
+$lang['autosubmit']            = 'Daten einmal im Monat automatisch senden';
+$lang['submissionFailed']      = 'Die Daten konnten aufgrund des folgenden Fehlers nicht gesendet werden: ';
+$lang['submitDirectly']        = 'Du kannst die Daten durch Betätigung des Buttons manuell versenden.';
+$lang['autosubmitError']       = 'Beim letzten automatischen Versuch die Daten zu senden, ist folgender Fehler aufgetreten: ';
+$lang['lastSent']              = 'Die Daten wurden gesendet';
diff --git a/lib/plugins/popularity/lang/de-informal/submitted.txt b/lib/plugins/popularity/lang/de-informal/submitted.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e7b45b5b7200b2c52d90197e99edcf79797cab9c
--- /dev/null
+++ b/lib/plugins/popularity/lang/de-informal/submitted.txt
@@ -0,0 +1,3 @@
+====== Popularitäts-Feedback ======
+
+Die Daten wurden erfolgreich versandt.
\ No newline at end of file
diff --git a/lib/plugins/popularity/lang/de/lang.php b/lib/plugins/popularity/lang/de/lang.php
index 1372e9d8a7355014f180af1993775afe19961288..4649062f783a8903b6dff7d8c9cb672aa763b14b 100644
--- a/lib/plugins/popularity/lang/de/lang.php
+++ b/lib/plugins/popularity/lang/de/lang.php
@@ -11,6 +11,13 @@
  * @author Blitzi94@gmx.de
  * @author Robert Bogenschneider <robog@GMX.de>
  * @author Robert Bogenschneider <robog@gmx.de>
+ * @author Niels Lange <niels@boldencursief.nl>
+ * @author Christian Wichmann <nospam@zone0.de>
  */
 $lang['name']                  = 'Popularitäts-Feedback (Eventuell längere Ladezeit)';
 $lang['submit']                = 'Daten senden';
+$lang['autosubmit']            = 'Daten einmal im Monat automatisch senden';
+$lang['submissionFailed']      = 'Die Daten konnten aufgrund des folgenden Fehlers nicht gesendet werden: ';
+$lang['submitDirectly']        = 'Sie können die Daten durch Betätigung des Buttons manuell versenden.';
+$lang['autosubmitError']       = 'Beim letzten automatischen Versuch die Daten zu senden, ist folgender Fehler aufgetreten: ';
+$lang['lastSent']              = 'Die Daten wurden gesendet';
diff --git a/lib/plugins/popularity/lang/de/submitted.txt b/lib/plugins/popularity/lang/de/submitted.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e7b45b5b7200b2c52d90197e99edcf79797cab9c
--- /dev/null
+++ b/lib/plugins/popularity/lang/de/submitted.txt
@@ -0,0 +1,3 @@
+====== Popularitäts-Feedback ======
+
+Die Daten wurden erfolgreich versandt.
\ No newline at end of file
diff --git a/lib/plugins/popularity/lang/en/lang.php b/lib/plugins/popularity/lang/en/lang.php
index c9912b7ad022f0335c916efef9c6f50b613e9d09..78a5e862cdd6fc92fcf8b7b8261c2b653a89e33a 100644
--- a/lib/plugins/popularity/lang/en/lang.php
+++ b/lib/plugins/popularity/lang/en/lang.php
@@ -1,4 +1,9 @@
 <?php
 
-$lang['name'] = 'Popularity Feedback (may take some time to load)';
-$lang['submit'] = 'Send Data';
+$lang['name']             = 'Popularity Feedback (may take some time to load)';
+$lang['submit']           = 'Send Data';
+$lang['autosubmit']       = 'Automatically send data once a month';
+$lang['submissionFailed'] = 'The data couldn\'t be sent due to the following error:';
+$lang['submitDirectly']   = 'You can send the data manually by submitting the following form.';
+$lang['autosubmitError']  = 'The last autosubmit failed, because of the following error: ';
+$lang['lastSent']         = 'The data has been sent ';
diff --git a/lib/plugins/popularity/lang/en/submitted.txt b/lib/plugins/popularity/lang/en/submitted.txt
new file mode 100644
index 0000000000000000000000000000000000000000..30f2784aa148788d9076ed7ecc3241fc6b1e255b
--- /dev/null
+++ b/lib/plugins/popularity/lang/en/submitted.txt
@@ -0,0 +1,3 @@
+====== Popularity Feedback ======
+
+The data has been sent succesfully.
diff --git a/lib/plugins/popularity/lang/es/lang.php b/lib/plugins/popularity/lang/es/lang.php
index c76190c2c1a0436704aa071fc35d29ac588f03df..6aa9a823d74cd72fb4423ace1583df8bd692aeb1 100644
--- a/lib/plugins/popularity/lang/es/lang.php
+++ b/lib/plugins/popularity/lang/es/lang.php
@@ -19,3 +19,8 @@
  */
 $lang['name']                  = 'Retroinformación (Feedback) plugin Popularity';
 $lang['submit']                = 'Enviar datos';
+$lang['autosubmit']            = 'Enviar automáticamente datos una vez al mes';
+$lang['submissionFailed']      = 'Los datos no se pudo enviar debido al error siguiente:';
+$lang['submitDirectly']        = 'Puede enviar los datos de forma manual mediante la presentación de la siguiente forma.';
+$lang['autosubmitError']       = 'El último auto no pudo presentar, debido al error siguiente:';
+$lang['lastSent']              = 'Los datos se han enviado';
diff --git a/lib/plugins/popularity/lang/es/submitted.txt b/lib/plugins/popularity/lang/es/submitted.txt
new file mode 100644
index 0000000000000000000000000000000000000000..bb1754cddc21562b69e4d36865cdc99961556acd
--- /dev/null
+++ b/lib/plugins/popularity/lang/es/submitted.txt
@@ -0,0 +1,3 @@
+====== Retroinformación Popularity ======
+
+Los datos se han enviado con éxito.
\ No newline at end of file
diff --git a/lib/plugins/popularity/lang/he/lang.php b/lib/plugins/popularity/lang/he/lang.php
index 024f94ae849b37f0b066b5afdc1e97e650412e37..f619127cd6fa68e14db6eed401d70488a24e73f9 100644
--- a/lib/plugins/popularity/lang/he/lang.php
+++ b/lib/plugins/popularity/lang/he/lang.php
@@ -5,6 +5,7 @@
  * @author Dotan Kamber <kamberd@yahoo.com>
  * @author Moshe Kaplan <mokplan@gmail.com>
  * @author Yaron Yogev <yaronyogev@gmail.com>
+ * @author Yaron Shahrabani <sh.yaron@gmail.com>
  */
 $lang['name']                  = 'משוב פופולריות (יתכן זמן טעינה ארוך)';
 $lang['submit']                = 'שלח מידע';
diff --git a/lib/plugins/popularity/lang/ko/lang.php b/lib/plugins/popularity/lang/ko/lang.php
index 3a28b1b0e6d36f22f3d965d8531b26b40b7cb4d2..91d798a5fcc833389171fad11df7527fd8298b36 100644
--- a/lib/plugins/popularity/lang/ko/lang.php
+++ b/lib/plugins/popularity/lang/ko/lang.php
@@ -6,6 +6,7 @@
  * @author dongnak@gmail.com
  * @author Song Younghwan <purluno@gmail.com>
  * @author SONG Younghwan <purluno@gmail.com>
+ * @author Seung-Chul Yoo  <dryoo@live.com>
  */
 $lang['name']                  = '인기도 조사 (불러오는데 시간이 걸릴 수 있습니다.)';
 $lang['submit']                = '자료 보내기';
diff --git a/lib/plugins/popularity/lang/la/intro.txt b/lib/plugins/popularity/lang/la/intro.txt
index 6f4ce8488cc974c5179a672e7bda52757d2851eb..c3029caf49ef9dedc54764e66f590b3e40a1e1df 100644
--- a/lib/plugins/popularity/lang/la/intro.txt
+++ b/lib/plugins/popularity/lang/la/intro.txt
@@ -1,5 +1,10 @@
 ====== Index Fauoris Popularis ======
 
-Haec machina fauorem popularem mittis sic ut creatores uicis meliorem illum facere possint.
+Haoc instrumentum fauorem popularem mittis sic ut creatores uicis meliorem illum facere possint.
+
+Rursum te fauorem mittere experamus sic ut si mutationes meliores uel peiores esse uidere possimus.
+
+Res mittendae tua forma in usu, numerus et pondus paginarum et aliarum rerum, addenda in usu et de PHP.
+
+Res rudes mittendae subter ostenduntur. "Res mittere" premas ut eas transferas.
 
-Rursum te fauorem mittere experamus sic ut si mutationes meliores uel peiores esse uidere possimus.
\ No newline at end of file
diff --git a/lib/plugins/popularity/lang/la/lang.php b/lib/plugins/popularity/lang/la/lang.php
index e634f9d41546ef817dddbf9efa9b034527ec7b9e..c7f307c2952e79051c0d55a1c3889154d705730f 100644
--- a/lib/plugins/popularity/lang/la/lang.php
+++ b/lib/plugins/popularity/lang/la/lang.php
@@ -2,6 +2,12 @@
 /**
  * Latin language file
  *
+ * @author Massimiliano Vassalli <vassalli.max@gmail.com>
  */
 $lang['name']                  = 'Index fauoris popularis (multum tempus quaerere potest)';
 $lang['submit']                = 'Missum die';
+$lang['autosubmit']            = 'Constanter res omni mense mittuntur';
+$lang['submissionFailed']      = 'Res non mittuntur ea causa:';
+$lang['submitDirectly']        = 'Res tu mittere potes cum hoc exemplar compleas.';
+$lang['autosubmitError']       = 'Extrema missio lapsa est ea causa:';
+$lang['lastSent']              = 'Res missae sunt';
diff --git a/lib/plugins/popularity/lang/la/submitted.txt b/lib/plugins/popularity/lang/la/submitted.txt
new file mode 100644
index 0000000000000000000000000000000000000000..2b2faf4392ed115827e96d3632393194b881b02c
--- /dev/null
+++ b/lib/plugins/popularity/lang/la/submitted.txt
@@ -0,0 +1,3 @@
+====== Index fauoris popularis ======
+
+Res feliciter missae sunt.
\ No newline at end of file
diff --git a/lib/plugins/popularity/lang/ru/intro.txt b/lib/plugins/popularity/lang/ru/intro.txt
index 587a7ae859e97548a345966ef2dbd11c98a59fef..e8118e4eb54aed1f5683ac8e8f0a08bf28f11d20 100644
--- a/lib/plugins/popularity/lang/ru/intro.txt
+++ b/lib/plugins/popularity/lang/ru/intro.txt
@@ -1,10 +1,10 @@
 ====== Сбор информации о популярности ======
 
-Этот инструмент собирает анонимные данные о вашей вики и позволяет вам отправить их разработчикам «ДокуВики». Эти данные помогут им понять то, как именно используется «ДокуВики», и удостовериться, что принимаемые проектные решения соответствуют жизненным реалиям.
+Этот инструмент собирает анонимные данные о вашей вики и позволяет вам отправить их разработчикам «ДокуВики». Эти данные помогут им понять, как именно используется «ДокуВики», и удостовериться, что принимаемые проектные решения соответствуют жизненным реалиям.
 
-Отправляйте данные время от времени для того, чтобы сообщить разработчикам о том, что ваша вики «подросла». Отправленные вами данные будут идентифицированы по анонимному ID.
+Отправляйте данные время от времени для того, чтобы сообщать разработчикам о том, что ваша вики «подросла». Отправленные вами данные будут идентифицированы по анонимному ID.
 
 Собранные данные содержат такую информацию, как: версия «ДокуВики», количество и размер ваших страниц и файлов, установленные плагины, информацию об установленном PHP.
 
-Данные, которые будут посланы, представлены ниже. Пожалуйста, используйте кнопку «Отправить данные», чтобы передать информацию.
+Данные, которые будут отосланы, представлены ниже. Пожалуйста, используйте кнопку «Отправить данные», чтобы передать информацию.
 
diff --git a/lib/plugins/popularity/lang/ru/lang.php b/lib/plugins/popularity/lang/ru/lang.php
index df89c7022d2b890cf377936779b2f06ce023ea2f..b63558134cffa84c1955b8ea8b66dde51ba8c62d 100644
--- a/lib/plugins/popularity/lang/ru/lang.php
+++ b/lib/plugins/popularity/lang/ru/lang.php
@@ -14,3 +14,8 @@
  */
 $lang['name']                  = 'Сбор информации о популярности (для загрузки может потребоваться некоторое время)';
 $lang['submit']                = 'Отправить данные';
+$lang['autosubmit']            = 'Автоматически отправлять данные один раз в месяц';
+$lang['submissionFailed']      = 'Данные не могут быть отправлены из-за ошибки:';
+$lang['submitDirectly']        = 'Вы можете отправлять данные вручную, заполнив форму:';
+$lang['autosubmitError']       = 'Последнее автоотправление данных не удалось из-за ошибки:';
+$lang['lastSent']              = 'Данные отправлены';
diff --git a/lib/plugins/popularity/lang/sl/lang.php b/lib/plugins/popularity/lang/sl/lang.php
index befb1eec00e6a1895bd42b8c49946025ca6ec95e..dc81ec060697c97800a9fad594566fc34f7e8385 100644
--- a/lib/plugins/popularity/lang/sl/lang.php
+++ b/lib/plugins/popularity/lang/sl/lang.php
@@ -4,5 +4,6 @@
  *
  * @author Dejan Levec <webphp@gmail.com>
  * @author Boštjan Seničar <senicar@gmail.com>
+ * @author Gregor Skumavc (grega.skumavc@gmail.com)
  */
 $lang['submit']                = 'Pošlji';
diff --git a/lib/plugins/popularity/lang/tr/lang.php b/lib/plugins/popularity/lang/tr/lang.php
index 682b512180102c098f44b1990e9904614a978bd8..fe87d15489459fc98c6d856c1fc6e462873a1782 100644
--- a/lib/plugins/popularity/lang/tr/lang.php
+++ b/lib/plugins/popularity/lang/tr/lang.php
@@ -2,11 +2,10 @@
 /**
  * Turkish language file
  *
- * @author Aydın Coşkuner aydinweb@gmail.com
  * @author Aydın Coşkuner <aydinweb@gmail.com>
- * @author yavuzselim@gmail.com
- * @author Cihan Kahveci kahvecicihan@gmail.com
+ * @author Cihan Kahveci <kahvecicihan@gmail.com>
  * @author Yavuz Selim <yavuzselim@gmail.com>
+ * @author Caleb Maclennan <caleb@alerque.com>
  */
 $lang['name']                  = 'Popülerlik Geribeslemesi (yüklemesi uzun sürebilir)';
 $lang['submit']                = 'Verileri Gönder';
diff --git a/lib/plugins/popularity/plugin.info.txt b/lib/plugins/popularity/plugin.info.txt
new file mode 100644
index 0000000000000000000000000000000000000000..2652bd66980685d97c6605902ba6876deed303d4
--- /dev/null
+++ b/lib/plugins/popularity/plugin.info.txt
@@ -0,0 +1,7 @@
+base    popularity
+author  Andreas Gohr
+email   andi@splitbrain.org
+date    2010-12-09
+name    Popularity Feedback Plugin
+desc    Send anonymous data about your wiki to the developers.
+url     http://www.dokuwiki.org/plugin:popularity
diff --git a/lib/plugins/revert/admin.php b/lib/plugins/revert/admin.php
index 8a2cd55530acfaef7fd67674b289e087407a4af5..e188e2488d363f636289daf3273bd2756d860366 100644
--- a/lib/plugins/revert/admin.php
+++ b/lib/plugins/revert/admin.php
@@ -196,4 +196,4 @@ class admin_plugin_revert extends DokuWiki_Admin_Plugin {
     }
 
 }
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/lib/plugins/revert/lang/cs/intro.txt b/lib/plugins/revert/lang/cs/intro.txt
index bbc0df25a413e5bc2c2b490688e0e3ecaa089336..1e1cd0fd86868ca6b42904023b8564feff270bc7 100644
--- a/lib/plugins/revert/lang/cs/intro.txt
+++ b/lib/plugins/revert/lang/cs/intro.txt
@@ -1,3 +1,3 @@
 ====== Obnova zaspamovaných stránek ======
 
-Tato stránka pomůže při automatické obnově po spamovém útoku.  Pro nalezení seznamu zaspamovaných stránek nedřív zadejte hledaný výraz (např. spamové URL) a pak potvrďte, že nalezené stránky opravdu obsahují spam a mohou být obnoveny.
+Tato stránka pomůže při automatické obnově po spamovém útoku.  Pro nalezení seznamu zaspamovaných stránek nejdříve zadejte hledaný výraz (např. spamové URL) a pak potvrďte, že nalezené stránky opravdu obsahují spam a mohou být obnoveny.
diff --git a/lib/plugins/revert/lang/de-informal/lang.php b/lib/plugins/revert/lang/de-informal/lang.php
index ac2f35e85a02d3683afbef6b16d3162690ffa499..b6709d2fa593f6287d103d44c28d7fe26199758e 100644
--- a/lib/plugins/revert/lang/de-informal/lang.php
+++ b/lib/plugins/revert/lang/de-informal/lang.php
@@ -6,6 +6,7 @@
  * @author Juergen Schwarzer <jschwarzer@freenet.de>
  * @author Marcel Metz <marcel_metz@gmx.de>
  * @author Matthias Schulte <post@lupo49.de>
+ * @author Christian Wichmann <nospam@zone0.de>
  */
 $lang['menu']                  = 'Zurückstellungsmanager';
 $lang['filter']                = 'Durchsuche als Spam markierte Seiten';
diff --git a/lib/plugins/revert/lang/de/lang.php b/lib/plugins/revert/lang/de/lang.php
index 5dee8007b4e8e5d87f8f17eef7ecc9a33aa41600..0bc8e2ce0fd5504063ad507657cc2bb62d1db761 100644
--- a/lib/plugins/revert/lang/de/lang.php
+++ b/lib/plugins/revert/lang/de/lang.php
@@ -12,6 +12,8 @@
  * @author Blitzi94@gmx.de
  * @author Robert Bogenschneider <robog@GMX.de>
  * @author Robert Bogenschneider <robog@gmx.de>
+ * @author Niels Lange <niels@boldencursief.nl>
+ * @author Christian Wichmann <nospam@zone0.de>
  */
 $lang['menu']                  = 'Seiten wieder herstellen';
 $lang['filter']                = 'Nach betroffenen Seiten suchen';
diff --git a/lib/plugins/revert/lang/en/lang.php b/lib/plugins/revert/lang/en/lang.php
index a2002f1a7a0fd4174f83cc00c8fc95a3de5b6fcb..6bf867ded87af6e728490430d644e715dd10375d 100644
--- a/lib/plugins/revert/lang/en/lang.php
+++ b/lib/plugins/revert/lang/en/lang.php
@@ -20,4 +20,4 @@ $lang['revstop']  = 'Reversion process finished successfully.';
 $lang['note1']    = 'Note: this search is case sensitive';
 $lang['note2']    = 'Note: the page will be reverted to the last version not containing the given spam term <i>%s</i>.';
 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/lib/plugins/revert/lang/he/lang.php b/lib/plugins/revert/lang/he/lang.php
index 5854878167b37f56ca77f327bf33dc6104b34d63..ac3c3412e7f66c2e84e119b99ec01b5cbdeb87a2 100644
--- a/lib/plugins/revert/lang/he/lang.php
+++ b/lib/plugins/revert/lang/he/lang.php
@@ -5,6 +5,7 @@
  * @author Dotan Kamber <kamberd@yahoo.com>
  * @author Moshe Kaplan <mokplan@gmail.com>
  * @author Yaron Yogev <yaronyogev@gmail.com>
+ * @author Yaron Shahrabani <sh.yaron@gmail.com>
  */
 $lang['menu']                  = 'מנהל שחזור';
 $lang['filter']                = 'חפש דפים עם ספאם';
diff --git a/lib/plugins/revert/lang/ko/lang.php b/lib/plugins/revert/lang/ko/lang.php
index 5e070de92157a2d0369fbf9ab3fe4e6760cbd845..0163d27545156c280f2b1e41573c73e529efb26a 100644
--- a/lib/plugins/revert/lang/ko/lang.php
+++ b/lib/plugins/revert/lang/ko/lang.php
@@ -6,6 +6,7 @@
  * @author dongnak@gmail.com
  * @author Song Younghwan <purluno@gmail.com>
  * @author SONG Younghwan <purluno@gmail.com>
+ * @author Seung-Chul Yoo  <dryoo@live.com>
  */
 $lang['menu']                  = '복구 관리자';
 $lang['filter']                = '스팸 페이지 검색 ';
diff --git a/lib/plugins/revert/lang/la/intro.txt b/lib/plugins/revert/lang/la/intro.txt
index 35916f68394afcf5decd0fc71b25ddef3d11d7ae..99a206f63e5193f77ef5a117976bad76296bb50d 100644
--- a/lib/plugins/revert/lang/la/intro.txt
+++ b/lib/plugins/revert/lang/la/intro.txt
@@ -1,3 +1,3 @@
 ====== Restituendi Administrator ======
 
-Haec pagina contra mala interretialia paginas restituta. Ut paginas aegras quaeras, malum VRL scribe, deinde paginas malas eligas.
\ No newline at end of file
+Haec pagina contra mala interretialia paginas restituta. Vt paginas aegras quaeras, malum VRL scribe, deinde paginas malas eligas.
\ No newline at end of file
diff --git a/lib/plugins/revert/lang/la/lang.php b/lib/plugins/revert/lang/la/lang.php
index f742e63f2cdb4aa7108f62fc723f53d5e102f812..af42034375a256aeea11067a3c420e6a092060ce 100644
--- a/lib/plugins/revert/lang/la/lang.php
+++ b/lib/plugins/revert/lang/la/lang.php
@@ -2,6 +2,7 @@
 /**
  * Latin language file
  *
+ * @author Massimiliano Vassalli <vassalli.max@gmail.com>
  */
 $lang['menu']                  = 'Restituendi administrator';
 $lang['filter']                = 'Malas paginas quaerere';
diff --git a/lib/plugins/revert/lang/ru/intro.txt b/lib/plugins/revert/lang/ru/intro.txt
index 66c5af00576f9e3ab139483401b0ef14f57f5f75..52d1f8d3dda63f80dbbb1121b4f678ed78dc78e6 100644
--- a/lib/plugins/revert/lang/ru/intro.txt
+++ b/lib/plugins/revert/lang/ru/intro.txt
@@ -1,3 +1,3 @@
 ====== Менеджер откаток ======
 
-Эта страница поможет вам в автоматической откатке изменений после спам-атаки. Для того, чтобы найти спам-страницы, введите ключевые слова и произведите поиск (например, по URL спамера). Затем убедитесь, что найденные страницы действительно содержат спам, и сделайте откатку изменений.
+Эта страница поможет вам в автоматической откатке изменений после спам-атаки. Для того, чтобы найти спам-страницы, введите ключевые слова и произведите поиск (например, по URL спамера). Затем убедитесь, что найденные страницы действительно содержат спам и сделайте откатку изменений.
diff --git a/lib/plugins/revert/lang/sl/lang.php b/lib/plugins/revert/lang/sl/lang.php
index 1fcf4ca36d5719103798dfef7cbe5e257aefb4cd..57ae9d0927692e04c6d81cd9d29a9ee9958d0712 100644
--- a/lib/plugins/revert/lang/sl/lang.php
+++ b/lib/plugins/revert/lang/sl/lang.php
@@ -4,4 +4,5 @@
  *
  * @author Dejan Levec <webphp@gmail.com>
  * @author Boštjan Seničar <senicar@gmail.com>
+ * @author Gregor Skumavc (grega.skumavc@gmail.com)
  */
diff --git a/lib/plugins/revert/lang/tr/lang.php b/lib/plugins/revert/lang/tr/lang.php
index 164a8ec4f44e3fd27335b22dd6d2e4eaf044d7b9..aa1458a9561d8b7e0e7006931812454b738d3fd0 100644
--- a/lib/plugins/revert/lang/tr/lang.php
+++ b/lib/plugins/revert/lang/tr/lang.php
@@ -2,11 +2,10 @@
 /**
  * Turkish language file
  *
- * @author Aydın Coşkuner aydinweb@gmail.com
  * @author Aydın Coşkuner <aydinweb@gmail.com>
- * @author yavuzselim@gmail.com
- * @author Cihan Kahveci kahvecicihan@gmail.com
+ * @author Cihan Kahveci <kahvecicihan@gmail.com>
  * @author Yavuz Selim <yavuzselim@gmail.com>
+ * @author Caleb Maclennan <caleb@alerque.com>
  */
 $lang['menu']                  = 'Eskiye Döndürme';
 $lang['filter']                = 'Spam bulunan sayfaları ara';
diff --git a/lib/plugins/syntax.php b/lib/plugins/syntax.php
index 127b92ce55ff5ee2256b7d04fafad89b90e62dd2..12451f6364a3e7b0bdad86c0ba49f2ef1a69fe78 100644
--- a/lib/plugins/syntax.php
+++ b/lib/plugins/syntax.php
@@ -188,10 +188,13 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode {
     function localFN($id) {
       global $conf;
       $plugin = $this->getPluginName();
-      $file = DOKU_PLUGIN.$plugin.'/lang/'.$conf['lang'].'/'.$id.'.txt';
-      if(!@file_exists($file)){
-        //fall back to english
-        $file = DOKU_PLUGIN.$plugin.'/lang/en/'.$id.'.txt';
+      $file = DOKU_CONF.'/plugin_lang/'.$plugin.'/'.$conf['lang'].'/'.$id.'.txt';
+      if (!@file_exists($file)){
+        $file = DOKU_PLUGIN.$plugin.'/lang/'.$conf['lang'].'/'.$id.'.txt';
+        if(!@file_exists($file)){
+          //fall back to english
+          $file = DOKU_PLUGIN.$plugin.'/lang/en/'.$id.'.txt';
+        }
       }
       return $file;
     }
@@ -276,4 +279,4 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode {
     }
 
 }
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/lib/plugins/usermanager/lang/cs/lang.php b/lib/plugins/usermanager/lang/cs/lang.php
index 9c5a2abc9b7ce612c5b6117793c61a2e5c135877..7d8e4599d6f202eeee0ae952f9c4c46733981ec9 100644
--- a/lib/plugins/usermanager/lang/cs/lang.php
+++ b/lib/plugins/usermanager/lang/cs/lang.php
@@ -45,7 +45,7 @@ $lang['edit_usermissing']      = 'Vybraný uživatel nebyl nalezen, zadané uži
 $lang['user_notify']           = 'Upozornit uživatele';
 $lang['note_notify']           = 'Maily s upozorněním se budou posílat pouze, když uživatel dostává nové heslo.';
 $lang['note_group']            = 'Noví uživatelé budou přidáváni do této výchozí skupiny (%s), pokud pro ně není uvedena žádná skupina.';
-$lang['note_pass']             = 'Heslo bude automaticky vygenerováno pokud je pole ponacháno prázdné a je zapnutá notifikace uživatele.';
+$lang['note_pass']             = 'Heslo bude automaticky vygenerováno pokud je pole ponecháno prázdné a je zapnutá notifikace uživatele.';
 $lang['add_ok']                = 'Uživatel úspěšně vytvořen';
 $lang['add_fail']              = 'Vytvoření uživatele selhalo';
 $lang['notify_ok']             = 'Odeslán mail s upozorněním';
diff --git a/lib/plugins/usermanager/lang/de-informal/lang.php b/lib/plugins/usermanager/lang/de-informal/lang.php
index e906c0cf83d522d637872c3cdb880063065df013..95b36c60f43d0fdfe899fff5ad83bd45956636a0 100644
--- a/lib/plugins/usermanager/lang/de-informal/lang.php
+++ b/lib/plugins/usermanager/lang/de-informal/lang.php
@@ -6,6 +6,7 @@
  * @author Juergen Schwarzer <jschwarzer@freenet.de>
  * @author Marcel Metz <marcel_metz@gmx.de>
  * @author Matthias Schulte <post@lupo49.de>
+ * @author Christian Wichmann <nospam@zone0.de>
  */
 $lang['menu']                  = 'Benutzerverwalter';
 $lang['noauth']                = '(Benutzeranmeldung ist nicht verfügbar)';
diff --git a/lib/plugins/usermanager/lang/de/lang.php b/lib/plugins/usermanager/lang/de/lang.php
index 816aaebd78db1fa696b4316350e7bb32b1d39a4d..090d1d1d9b940504dfcf02bde35d1d29844e5ad4 100644
--- a/lib/plugins/usermanager/lang/de/lang.php
+++ b/lib/plugins/usermanager/lang/de/lang.php
@@ -13,6 +13,8 @@
  * @author Blitzi94@gmx.de
  * @author Robert Bogenschneider <robog@GMX.de>
  * @author Robert Bogenschneider <robog@gmx.de>
+ * @author Niels Lange <niels@boldencursief.nl>
+ * @author Christian Wichmann <nospam@zone0.de>
  */
 $lang['menu']                  = 'Benutzerverwaltung';
 $lang['noauth']                = '(Authentifizierungssystem nicht verfügbar)';
diff --git a/lib/plugins/usermanager/lang/he/lang.php b/lib/plugins/usermanager/lang/he/lang.php
index b2b55c3b4ba2d64eb82482fc301e560849f93fbb..601163013d6dcf6760ee5cd5c7d0213d719d80a2 100644
--- a/lib/plugins/usermanager/lang/he/lang.php
+++ b/lib/plugins/usermanager/lang/he/lang.php
@@ -6,6 +6,7 @@
  * @author Dotan Kamber <kamberd@yahoo.com>
  * @author Moshe Kaplan <mokplan@gmail.com>
  * @author Yaron Yogev <yaronyogev@gmail.com>
+ * @author Yaron Shahrabani <sh.yaron@gmail.com>
  */
 $lang['menu']                  = 'מנהל משתמשים';
 $lang['noauth']                = '(אימות משתמשים אינו זמין)';
diff --git a/lib/plugins/usermanager/lang/ko/lang.php b/lib/plugins/usermanager/lang/ko/lang.php
index eeb8eb791701a26e65d09de0f7d588149e6a9223..f2322414a9a27a131cd310b970a88592f6ee7ee5 100644
--- a/lib/plugins/usermanager/lang/ko/lang.php
+++ b/lib/plugins/usermanager/lang/ko/lang.php
@@ -6,6 +6,7 @@
  * @author dongnak@gmail.com
  * @author Song Younghwan <purluno@gmail.com>
  * @author SONG Younghwan <purluno@gmail.com>
+ * @author Seung-Chul Yoo  <dryoo@live.com>
  */
 $lang['menu']                  = '사용자 관리자';
 $lang['noauth']                = '(사용자 인증이 불가능합니다.)';
diff --git a/lib/plugins/usermanager/lang/la/lang.php b/lib/plugins/usermanager/lang/la/lang.php
index 2646979bdae412233a9cbbd303dcfca28b6dedb1..52c8487544464bf570a7ffcbe26ee8228c6867e9 100644
--- a/lib/plugins/usermanager/lang/la/lang.php
+++ b/lib/plugins/usermanager/lang/la/lang.php
@@ -2,6 +2,7 @@
 /**
  * Latin language file
  *
+ * @author Massimiliano Vassalli <vassalli.max@gmail.com>
  */
 $lang['menu']                  = 'Sodalis Tabella';
 $lang['noauth']                = '(Sodalis confirmatio deest)';
diff --git a/lib/plugins/usermanager/lang/ru/lang.php b/lib/plugins/usermanager/lang/ru/lang.php
index 81d9a72a6bbca4f83e6d75919834d05a0b1e6d55..d7a0591abcf840fd9b430430520fdda07a68e664 100644
--- a/lib/plugins/usermanager/lang/ru/lang.php
+++ b/lib/plugins/usermanager/lang/ru/lang.php
@@ -47,12 +47,12 @@ $lang['start']                 = 'в начало';
 $lang['prev']                  = 'назад';
 $lang['next']                  = 'вперёд';
 $lang['last']                  = 'в конец';
-$lang['edit_usermissing']      = 'Выбранный пользователь не найден. Возможно, указанный логин был удалён или изменен извне.';
+$lang['edit_usermissing']      = 'Выбранный пользователь не найден. Возможно, указанный логин был удалён или изменён извне.';
 $lang['user_notify']           = 'Сообщить пользователю';
 $lang['note_notify']           = 'Письма с уведомлением высылаются только в случае получения нового пароля.';
 $lang['note_group']            = 'Если группа не указана, новые пользователи будут добавлены в группу по умолчанию (%s).';
 $lang['note_pass']             = 'Пароль будет сгенерирован автоматически, если поле оставлено пустым и включено уведомление пользователя.';
 $lang['add_ok']                = 'Пользователь успешно добавлен';
 $lang['add_fail']              = 'Не удалось добавить пользователя';
-$lang['notify_ok']             = 'Пиьмо с уведомлением отправлено';
+$lang['notify_ok']             = 'Письмо с уведомлением отправлено';
 $lang['notify_fail']           = 'Не удалось отправить письмо с уведомлением';
diff --git a/lib/plugins/usermanager/lang/sl/lang.php b/lib/plugins/usermanager/lang/sl/lang.php
index e31f8ff1abed2b34a3de93761c7658b89ad2367f..b671d65dc0f3f97cc2e1a678e93ecd93c6a3e8f7 100644
--- a/lib/plugins/usermanager/lang/sl/lang.php
+++ b/lib/plugins/usermanager/lang/sl/lang.php
@@ -4,17 +4,35 @@
  *
  * @author Dejan Levec <webphp@gmail.com>
  * @author Boštjan Seničar <senicar@gmail.com>
+ * @author Gregor Skumavc (grega.skumavc@gmail.com)
  */
+$lang['menu']                  = 'Urejanje uporabnikov';
+$lang['noauth']                = '(preverjanje uporabnikov ni na voljo)';
+$lang['nosupport']             = '(urejanje uporabnikov ni podprto)';
+$lang['badauth']               = 'neeljaven mehanizem za preverjanje';
 $lang['user_id']               = 'Uporabnik';
 $lang['user_pass']             = 'Geslo';
+$lang['user_name']             = 'Pravo ime';
 $lang['user_mail']             = 'Email';
 $lang['user_groups']           = 'Skupine';
+$lang['field']                 = 'Polje';
+$lang['value']                 = 'Vrednost';
 $lang['add']                   = 'Dodaj';
 $lang['delete']                = 'Izbriši';
 $lang['delete_selected']       = 'Izbriši izbrano';
 $lang['edit']                  = 'Uredi';
+$lang['edit_prompt']           = 'Uredi tega uporabnika';
 $lang['modify']                = 'Shrani spremembe';
 $lang['search']                = 'Iskanje';
+$lang['search_prompt']         = 'Išči';
+$lang['clear']                 = 'Ponastavi filter iskanja';
+$lang['filter']                = 'Filter';
+$lang['summary']               = 'Prikazujem uporabnike %1$d-%2$d od najdenih %3$d. Vseh je %4$d.';
+$lang['nonefound']             = 'Ni najdenih uporabnikov. Vseh uporabnikov je %d.';
+$lang['delete_ok']             = '%d uporabnikov izbrisanih';
+$lang['delete_fail']           = '%d ni bilo možno izbrisati';
+$lang['update_ok']             = 'Uporabnik uspešno posodobljen';
+$lang['update_fail']           = 'Posodobitev uporabnika ni uspela';
 $lang['prev']                  = 'Prejšnji';
 $lang['next']                  = 'Naslednji';
 $lang['last']                  = 'Zadnji';
diff --git a/lib/plugins/usermanager/lang/tr/lang.php b/lib/plugins/usermanager/lang/tr/lang.php
index 28127d9d0910efccd6b6ebcd585c85354116d8f2..b9c9cfc5259f6cabab5ec351b6f5fcf44293a038 100644
--- a/lib/plugins/usermanager/lang/tr/lang.php
+++ b/lib/plugins/usermanager/lang/tr/lang.php
@@ -2,11 +2,10 @@
 /**
  * Turkish language file
  *
- * @author Aydın Coşkuner aydinweb@gmail.com
  * @author Aydın Coşkuner <aydinweb@gmail.com>
- * @author yavuzselim@gmail.com
- * @author Cihan Kahveci kahvecicihan@gmail.com
+ * @author Cihan Kahveci <kahvecicihan@gmail.com>
  * @author Yavuz Selim <yavuzselim@gmail.com>
+ * @author Caleb Maclennan <caleb@alerque.com>
  */
 $lang['menu']                  = 'Kullanıcı Yönetimi';
 $lang['noauth']                = '(kullanıcı onaylaması yoktur)';
diff --git a/lib/scripts/ajax.js b/lib/scripts/ajax.js
index de009d4487d686e903537f4d840d0b6dcb718880..44dcee999113202f2dffcf2dc47fe086bbc7ac98 100644
--- a/lib/scripts/ajax.js
+++ b/lib/scripts/ajax.js
@@ -5,44 +5,114 @@
  * @author   Andreas Gohr <andi@splitbrain.org>
  * @author   Adrian Lang <lang@cosmocode.de>
  */
-addInitEvent(function () {
+var ajax_quicksearch = {
 
-    var inID  = 'qsearch__in';
-    var outID = 'qsearch__out';
+    inObj:   null,
+    outObj:  null,
+    sackObj: null,
+    delay:   null,
 
-    var inObj  = document.getElementById(inID);
-    var outObj = document.getElementById(outID);
+    init: function(inID, outID) {
 
-    // objects found?
-    if (inObj === null){ return; }
-    if (outObj === null){ return; }
+        this.inObj  = $(inID);
+        this.outObj = $(outID);
 
-    function clear_results(){
-        outObj.style.display = 'none';
-        outObj.innerHTML = '';
-    }
+        // objects found?
+        if (this.inObj  === null) return;
+        if (this.outObj === null) return;
+
+        // prepare AJAX
+        this.sackObj = new sack(DOKU_BASE + 'lib/exe/ajax.php');
+        this.sackObj.AjaxFailedAlert = '';
+        this.sackObj.encodeURIString = false;
+        this.sackObj.onCompletion = ajax_quicksearch.onCompletion;
+
+        // attach eventhandler to search field
+        this.delay = new Delay(function () {
+            ajax_quicksearch.clear_results();
+            var value = ajax_quicksearch.inObj.value;
+            if(value === ''){ return; }
+            ajax_quicksearch.sackObj.runAJAX('call=qsearch&q=' + encodeURI(value));
+        });
+
+        addEvent(this.inObj, 'keyup', function () {
+            ajax_quicksearch.clear_results();
+            ajax_quicksearch.delay.start();
+        });
 
-    var sack_obj = new sack(DOKU_BASE + 'lib/exe/ajax.php');
-    sack_obj.AjaxFailedAlert = '';
-    sack_obj.encodeURIString = false;
-    sack_obj.onCompletion = function () {
-        var data = sack_obj.response;
+        // attach eventhandler to output field
+        addEvent(this.outObj, 'click', function () {
+            ajax_quicksearch.outObj.style.display = 'none';
+        });
+    },
+
+    clear_results: function(){
+        ajax_quicksearch.outObj.style.display = 'none';
+        ajax_quicksearch.outObj.innerHTML = '';
+    },
+
+    onCompletion: function() {
+        var data = this.response; // 'this' is sack context
         if (data === '') { return; }
 
+        var outObj = ajax_quicksearch.outObj;
+
         outObj.innerHTML = data;
         outObj.style.display = 'block';
-    };
+        outObj.style['white-space'] = 'nowrap';
 
-    // attach eventhandler to search field
-    var delay = new Delay(function () {
-        clear_results();
-        var value = inObj.value;
-        if(value === ''){ return; }
-        sack_obj.runAJAX('call=qsearch&q=' + encodeURI(value));
-    });
+        // shorten namespaces if too long
+        var width = outObj.clientWidth;
+        var links = outObj.getElementsByTagName('a');
+        for(var i=0; i<links.length; i++){
+            // maximum allowed width:
+            var max = width - links[i].offsetLeft;
+            var isRTL = (document.documentElement.dir == 'rtl');
 
-    addEvent(inObj, 'keyup', function () {clear_results(); delay.start(); });
+            if(!isRTL && links[i].offsetWidth < max) continue;
+            if(isRTL && links[i].offsetLeft > 0) continue;
 
-    // attach eventhandler to output field
-    addEvent(outObj, 'click', function () {outObj.style.display = 'none'; });
+            var nsL = links[i].innerText.indexOf('(');
+            var nsR = links[i].innerText.indexOf(')');
+            var eli = 0;
+            var runaway = 0;
+
+            while( (nsR - nsL > 3) &&
+                    (
+                       (!isRTL && links[i].offsetWidth > max) ||
+                       (isRTL && links[i].offsetLeft < 0)
+                    )
+                 ){
+                if(runaway++ > 500) return; // just in case something went wrong
+
+                if(eli){
+                    // elipsis already inserted
+                    if( (eli - nsL) > (nsR - eli) ){
+                        // cut left
+                        links[i].innerText = links[i].innerText.substring(0,eli-2)+
+                                             links[i].innerText.substring(eli);
+                    }else{
+                        // cut right
+                        links[i].innerText = links[i].innerText.substring(0,eli+1)+
+                                             links[i].innerText.substring(eli+2);
+                    }
+                }else{
+                    // replace middle with ellipsis
+                    var mid = Math.floor( nsL + ((nsR-nsL)/2) );
+                    links[i].innerText = links[i].innerText.substring(0,mid)+'…'+
+                                         links[i].innerText.substring(mid+1);
+                }
+                eli = links[i].innerText.indexOf('…');
+                nsL = links[i].innerText.indexOf('(');
+                nsR = links[i].innerText.indexOf(')');
+            }
+        }
+    }
+
+};
+
+
+addInitEvent(function(){
+    ajax_quicksearch.init('qsearch__in','qsearch__out');
 });
+
diff --git a/lib/tpl/default/rtl.css b/lib/tpl/default/rtl.css
index e40dd966d51a9a6c1284286945d378b294877966..82c85839b28758920824f491ba0a332468f50828 100644
--- a/lib/tpl/default/rtl.css
+++ b/lib/tpl/default/rtl.css
@@ -55,8 +55,7 @@ div.dokuwiki li ol {
 div.dokuwiki a.urlextern,
 div.dokuwiki a.interwiki,
 div.dokuwiki a.windows,
-div.dokuwiki a.mail,
-div.dokuwiki a.mail.JSnocheck {
+div.dokuwiki a.mail {
   /* should work but doesn't - so we just disable icons here*/
   /*
   background-position: right 1px;