r55744 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55743‎ | r55744 | r55745 >
Date:02:58, 2 September 2009
Author:yaron
Status:deferred
Tags:
Comment:
Tag for version 0.9
Modified paths:
  • /tags/extensions/ExternalData/REL_0_9 (added) (history)

Diff [purge]

Index: tags/extensions/ExternalData/REL_0_9/ExternalData.i18n.magic.php
@@ -0,0 +1,32 @@
 2+<?php
 3+
 4+$magicWords = array();
 5+
 6+$magicWords['en'] = array(
 7+ 'get_external_data' => array ( 0, 'get_external_data' ),
 8+ 'get_ldap_data' => array ( 0, 'get_ldap_data' ),
 9+ 'get_db_data' => array ( 0, 'get_db_data' ),
 10+ 'external_value' => array ( 0, 'external_value' ),
 11+ 'for_external_table' => array ( 0, 'for_external_table' ),
 12+);
 13+
 14+$magicWords['ar'] = array(
 15+ 'external_value' => array( '0', 'قيمة_خارجية', 'external_value' ),
 16+ 'for_external_table' => array( '0', 'لجدول_خارجي', 'for_external_table' ),
 17+);
 18+
 19+$magicWords['nl'] = array(
 20+ 'get_external_data' => array( '0', 'externe_gegevens_ophalen', 'get_external_data' ),
 21+ 'get_ldap_data' => array( '0', 'ldap_gegevens_ophalen', 'get_ldap_data' ),
 22+ 'get_db_data' => array( '0', 'db_gegevens_ophalen', 'get_db_data' ),
 23+ 'external_value' => array( '0', 'externe_waarde', 'external_value' ),
 24+ 'for_external_table' => array( '0', 'voor_externe_tabel', 'for_external_table' ),
 25+);
 26+
 27+$magicWords['ru'] = array(
 28+ 'get_external_data' => array( '0', 'получить_внешние_данные', 'get_external_data' ),
 29+ 'get_ldap_data' => array( '0', 'получить_данные_ldap', 'get_ldap_data' ),
 30+ 'get_db_data' => array( '0', 'получить_данные_db', 'get_db_data' ),
 31+ 'external_value' => array( '0', 'внешнее_значение', 'external_value' ),
 32+ 'for_external_table' => array( '0', 'для_внешней_таблицы', 'for_external_table' ),
 33+);
\ No newline at end of file
Property changes on: tags/extensions/ExternalData/REL_0_9/ExternalData.i18n.magic.php
___________________________________________________________________
Name: svn:keywords
134 + Id
Name: svn:eol-style
235 + native
Index: tags/extensions/ExternalData/REL_0_9/ExternalData.i18n.php
@@ -0,0 +1,577 @@
 2+<?php
 3+/**
 4+ * Internationalization file for the External Data extension
 5+ *
 6+ * @addtogroup Extensions
 7+ */
 8+
 9+$messages = array();
 10+
 11+/** English
 12+ * @author Yaron Koren
 13+ */
 14+$messages['en'] = array(
 15+ // user messages
 16+ 'getdata' => 'Get data',
 17+ 'externaldata-desc' => 'Allows for retrieving data in CSV, JSON and XML formats from both external URLs and local wiki pages',
 18+ 'externaldata-ldap-unable-to-connect' => 'Unable to connect to $1',
 19+ 'externaldata-json-decode-not-supported' => 'Error: json_decode() is not supported in this version of PHP',
 20+ 'externaldata-xml-error' => 'XML error: $1 at line $2',
 21+ 'externaldata-db-incomplete-information' => 'Error: Incomplete information for this server ID.',
 22+ 'externaldata-db-could-not-get-url' => 'Could not get URL after $1 {{PLURAL:$1|try|tries}}.',
 23+ 'externaldata-db-unknown-type' => 'Error: Unknown database type.',
 24+ 'externaldata-db-could-not-connect' => 'Error: Could not connect to database.',
 25+ 'externaldata-db-no-return-values' => 'Error: No return values specified.',
 26+ 'externaldata-db-invalid-query' => 'Invalid query.',
 27+);
 28+
 29+/** Message documentation (Message documentation)
 30+ * @author Dead3y3
 31+ * @author Fryed-peach
 32+ */
 33+$messages['qqq'] = array(
 34+ 'externaldata-desc' => '{{desc}}',
 35+);
 36+
 37+/** Arabic (العربية)
 38+ * @author Meno25
 39+ * @author OsamaK
 40+ */
 41+$messages['ar'] = array(
 42+ 'getdata' => 'الحصول على البيانات',
 43+ 'externaldata-desc' => 'يسمح باسترجاع البيانات بصيغة CSV، JSON و XML من مسارات خارجية وصفحات الويكي المحلية',
 44+ 'externaldata-ldap-unable-to-connect' => 'تعذّر الاتصال ب$1',
 45+ 'externaldata-json-decode-not-supported' => 'خطأ: json_decode() غير مدعوم في نسخة PHP هذه',
 46+ 'externaldata-xml-error' => 'خطأ XML: $1 عند السطر $2',
 47+ 'externaldata-db-incomplete-information' => 'خطأ: معلومات غير كاملة عن هوية هذا الخادوم.',
 48+ 'externaldata-db-could-not-get-url' => 'تعذّر الحصول على المسار بعد {{PLURAL:$1||محاولة واحدة|محاوتين|$1 محاولات|$1 محاولة }}.',
 49+ 'externaldata-db-unknown-type' => 'خطأ: نوع قاعدة بيانات غير معروف.',
 50+ 'externaldata-db-could-not-connect' => 'خطأ: تعذّر الاتصال بقاعدة البيانات.',
 51+ 'externaldata-db-no-return-values' => 'خطأ: لم تحدد أي قيم عائدة.',
 52+ 'externaldata-db-invalid-query' => 'استعلام غير صالح.',
 53+);
 54+
 55+/** Egyptian Spoken Arabic (مصرى)
 56+ * @author Meno25
 57+ */
 58+$messages['arz'] = array(
 59+ 'getdata' => 'الحصول على البيانات',
 60+ 'externaldata-desc' => 'يسمح باسترجاع البيانات بصيغة CSV، JSON و XML من مسارات خارجية وصفحات الويكى المحلية',
 61+);
 62+
 63+/** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца))
 64+ * @author EugeneZelenko
 65+ * @author Jim-by
 66+ */
 67+$messages['be-tarask'] = array(
 68+ 'getdata' => 'Атрымаць зьвесткі',
 69+ 'externaldata-desc' => 'Дазваляе атрымліваць зьвесткі ў фарматах CSV, JSON і XML з вонкавых крыніц і лякальных старонак вікі',
 70+ 'externaldata-ldap-unable-to-connect' => 'Немагчыма далучыцца да $1',
 71+ 'externaldata-json-decode-not-supported' => 'Памылка: json_decode() не падтрымліваецца ў гэтай вэрсіі PHP',
 72+ 'externaldata-xml-error' => 'Памылка XML: $1 у радку $2',
 73+ 'externaldata-db-incomplete-information' => 'Памылка: Няпоўная інфармацыя для гэтага ідэнтыфікатара сэрвэра.',
 74+ 'externaldata-db-could-not-get-url' => 'Немагчыма атрымаць URL-адрас пасьля $1 {{PLURAL:$1|спробы|спробаў|спробаў}}.',
 75+ 'externaldata-db-unknown-type' => 'Памылка: Невядомы тып базы зьвестак.',
 76+ 'externaldata-db-could-not-connect' => 'Памылка: Немагчыма далучыцца да базы зьвестак.',
 77+ 'externaldata-db-no-return-values' => 'Памылка: Не пазначаныя выніковыя значэньні.',
 78+ 'externaldata-db-invalid-query' => 'Няслушны запыт.',
 79+);
 80+
 81+/** Bosnian (Bosanski)
 82+ * @author CERminator
 83+ */
 84+$messages['bs'] = array(
 85+ 'getdata' => 'Uzmi podatke',
 86+ 'externaldata-desc' => 'Omogućuje za preuzimanje podataka u formatima CSV, JSON i XML za vanjske URLove i lokalnu wiki',
 87+ 'externaldata-ldap-unable-to-connect' => 'Ne može se spojiti na $1',
 88+ 'externaldata-json-decode-not-supported' => 'Greška: json_decode() nije podržan u ovoj PHP verziji',
 89+ 'externaldata-xml-error' => 'XML greška: $1 na liniji $2',
 90+ 'externaldata-db-incomplete-information' => 'Greška: Nepotpune informacije za ovaj ID servera.',
 91+ 'externaldata-db-could-not-get-url' => 'Nije pronađen URL nakon $1 {{PLURAL:$1|pokušaja|pokušaja}}.',
 92+ 'externaldata-db-unknown-type' => 'Greška: Nepoznat tip baze podataka.',
 93+ 'externaldata-db-could-not-connect' => 'Greška: Ne može se spojiti na bazu podataka.',
 94+ 'externaldata-db-no-return-values' => 'Greška: Nije navedena povratna vrijednost.',
 95+ 'externaldata-db-invalid-query' => 'Nevaljan upit.',
 96+);
 97+
 98+/** Catalan (Català)
 99+ * @author Paucabot
 100+ * @author Solde
 101+ */
 102+$messages['ca'] = array(
 103+ 'getdata' => 'Obtenir dades',
 104+ 'externaldata-xml-error' => 'Error XML: $1 a la línia $2',
 105+ 'externaldata-db-unknown-type' => 'Error: Tipus de base de dades desconegut.',
 106+ 'externaldata-db-could-not-connect' => "Error: No s'ha pogut connectar a la base de dades.",
 107+ 'externaldata-db-invalid-query' => 'Consulta no vàlida.',
 108+);
 109+
 110+/** German (Deutsch)
 111+ * @author Imre
 112+ * @author MF-Warburg
 113+ * @author Purodha
 114+ * @author Umherirrender
 115+ */
 116+$messages['de'] = array(
 117+ 'getdata' => 'Daten holen',
 118+ 'externaldata-desc' => 'Erlaubt das Einfügen von Daten der Formate CSV, JSON und XML sowohl von externer URL als auch von lokalen Wikiseite',
 119+ 'externaldata-ldap-unable-to-connect' => 'Keine Verbindung zu $1',
 120+ 'externaldata-json-decode-not-supported' => 'Fehler: json_decode() wird nicht von dieser PHP-Version unterstützt',
 121+ 'externaldata-xml-error' => 'XML-Fehler: $1 in Zeile $2',
 122+ 'externaldata-db-incomplete-information' => 'Fehler: Unvollständige Informationen für diese Server-ID.',
 123+ 'externaldata-db-could-not-get-url' => 'URL konnte nach $1 {{PLURAL:$1|Versuch|Versuchen}} nicht abgerufen werden.',
 124+ 'externaldata-db-unknown-type' => 'Fehler: Unbekannter Datenbanktyp.',
 125+ 'externaldata-db-could-not-connect' => 'Fehler: Keine Verbindung zur Datenbank.',
 126+ 'externaldata-db-no-return-values' => 'Fehler: Keine Rückgabewerte festgelegt.',
 127+ 'externaldata-db-invalid-query' => 'Ungültige Abfrage.',
 128+);
 129+
 130+/** Lower Sorbian (Dolnoserbski)
 131+ * @author Michawiki
 132+ */
 133+$messages['dsb'] = array(
 134+ 'getdata' => 'Daty wobstaraś',
 135+ 'externaldata-desc' => 'Zmóžnja wótwołanje datow w formatach CSV, JSON a XML ako z eksternych URL tak teke lokalnych wikijowych bokow',
 136+ 'externaldata-ldap-unable-to-connect' => 'Njemóžno z $1 zwězaś',
 137+ 'externaldata-json-decode-not-supported' => 'Zmólka: json_decode() njepódpěra se w toś tej wersiji PHP',
 138+ 'externaldata-xml-error' => 'Zmólka XML: $1 na smužce $2',
 139+ 'externaldata-db-incomplete-information' => "'''Zmólka: Njedopołne informacije za toś ten serwerowy ID.'''",
 140+ 'externaldata-db-could-not-get-url' => 'Njemóžno URL pó $1 {{PLURAL:$1|wopyśe|wopytoma|wopytach|wopytach}} dostaś.',
 141+ 'externaldata-db-unknown-type' => "'''Zmólka: Njeznata datowa banka.'''",
 142+ 'externaldata-db-could-not-connect' => "'''Zmólka: Njemóžno z datoweju banku zwězaś.'''",
 143+ 'externaldata-db-no-return-values' => "'''Zmólka: Žedne gódnoty slědkdaśa pódane.'''",
 144+ 'externaldata-db-invalid-query' => 'Njepłaśiwe napšašowanje.',
 145+);
 146+
 147+/** Greek (Ελληνικά)
 148+ * @author Dead3y3
 149+ * @author Omnipaedista
 150+ */
 151+$messages['el'] = array(
 152+ 'getdata' => 'Πάρε δεδομένα',
 153+ 'externaldata-desc' => 'Επιτρέπει την ανάκτηση δεδομένων σε μορφές CSV, JSON και XML και για εξωτερικά URLs και για σελίδες του τοπικού wiki',
 154+ 'externaldata-db-invalid-query' => 'Άκυρο αίτημα.',
 155+);
 156+
 157+/** Spanish (Español)
 158+ * @author Crazymadlover
 159+ * @author Sanbec
 160+ */
 161+$messages['es'] = array(
 162+ 'getdata' => 'Obtener datos',
 163+ 'externaldata-desc' => 'Permite la recuperación de datos en formatos CSV, JSON y XML a partir de URL externos y de páginas wiki locales',
 164+);
 165+
 166+/** Basque (Euskara)
 167+ * @author Kobazulo
 168+ */
 169+$messages['eu'] = array(
 170+ 'getdata' => 'Datuak eskuratu',
 171+);
 172+
 173+/** Finnish (Suomi)
 174+ * @author Silvonen
 175+ * @author Str4nd
 176+ */
 177+$messages['fi'] = array(
 178+ 'externaldata-ldap-unable-to-connect' => 'Ei voitu yhdistää palvelimelle $1',
 179+ 'externaldata-json-decode-not-supported' => 'Virhe: json_decode() ei ole tuettu tässä PHP:n versiossa',
 180+ 'externaldata-xml-error' => 'XML-virhe: $1 rivillä $2',
 181+ 'externaldata-db-unknown-type' => 'Virhe: Tuntematon tietokantatyyppi.',
 182+);
 183+
 184+/** French (Français)
 185+ * @author Crochet.david
 186+ * @author IAlex
 187+ */
 188+$messages['fr'] = array(
 189+ 'getdata' => 'Obtenir des données',
 190+ 'externaldata-desc' => 'Permet de récupérer des données en CSV, JSON et XML depuis des URL externes et des pages du wiki',
 191+ 'externaldata-ldap-unable-to-connect' => 'Impossible de se connecter à $1',
 192+ 'externaldata-json-decode-not-supported' => "Erreur : json_decode() n'est pas supportée dans cette version de PHP",
 193+ 'externaldata-xml-error' => 'Erreur XML : $1 à la ligne $2',
 194+ 'externaldata-db-incomplete-information' => 'Erreur : Informations incomplètes pour cet identifiant de serveur.',
 195+ 'externaldata-db-could-not-get-url' => "Impossible d'obtenir l'URL après $1 essai{{PLURAL:$1|s|s}}.",
 196+ 'externaldata-db-unknown-type' => 'ERREUR: Type de base de données inconnu.',
 197+ 'externaldata-db-could-not-connect' => 'Erreur : Impossible de se connecteur à la base de données.',
 198+ 'externaldata-db-no-return-values' => "Erreur : Aucune valeur de retour n'a été spécifiée.",
 199+ 'externaldata-db-invalid-query' => 'Requête invalide.',
 200+);
 201+
 202+/** Galician (Galego)
 203+ * @author Toliño
 204+ */
 205+$messages['gl'] = array(
 206+ 'getdata' => 'Obter os datos',
 207+ 'externaldata-desc' => 'Permite a recuperación de datos en formatos CSV, JSON e XML a partir dos enderezos URL externos e mais das páxinas wiki locais',
 208+ 'externaldata-ldap-unable-to-connect' => 'Non se pode conectar a $1',
 209+ 'externaldata-json-decode-not-supported' => 'Erro: json_decode() non está soportado nesta versión de PHP',
 210+ 'externaldata-xml-error' => 'Erro XML: $1 na liña $2',
 211+ 'externaldata-db-incomplete-information' => 'Erro: información incompleta para este ID de servidor.',
 212+ 'externaldata-db-could-not-get-url' => 'Non se puido obter o enderezo URL despois de $1 {{PLURAL:$1|intento|intentos}}.',
 213+ 'externaldata-db-unknown-type' => 'Erro: tipo de base de datos descoñecido.',
 214+ 'externaldata-db-could-not-connect' => 'Erro: non se puido conectar á base de datos.',
 215+ 'externaldata-db-no-return-values' => 'Erro: non se especificou ningún valor de retorno.',
 216+ 'externaldata-db-invalid-query' => 'Consulta non válida.',
 217+);
 218+
 219+/** Swiss German (Alemannisch)
 220+ * @author Als-Holder
 221+ */
 222+$messages['gsw'] = array(
 223+ 'getdata' => 'Date hole',
 224+ 'externaldata-desc' => 'Erlaubt Daten abzruefe im CSV, JSON un XML Format vu extärne URL un lokale Wikisyte',
 225+ 'externaldata-ldap-unable-to-connect' => 'Cha kei Verbindig härstellen zue $1',
 226+ 'externaldata-json-decode-not-supported' => 'Fähler: json_decode() wird nit unterstitzt in däre Version vu PHP',
 227+ 'externaldata-xml-error' => 'XML-Fähler: $1 in dr Zyyle $2',
 228+ 'externaldata-db-incomplete-information' => 'Fähler: Nit vollständigi Information fir die Server-ID.',
 229+ 'externaldata-db-could-not-get-url' => 'Cha d URL nit finde no $1 {{PLURAL:$1|Versuech|Versuech}}.',
 230+ 'externaldata-db-unknown-type' => 'Fähler: Nit bekannte Datebanktyp.',
 231+ 'externaldata-db-could-not-connect' => 'Fähler: Cha kei Verbindig härstelle zue dr Datebank.',
 232+ 'externaldata-db-no-return-values' => 'Fähler: Kei Ruckgabewärt spezifiziert.',
 233+ 'externaldata-db-invalid-query' => 'Nit giltigi Umfrog.',
 234+);
 235+
 236+/** Gujarati (ગુજરાતી)
 237+ * @author Ashok modhvadia
 238+ */
 239+$messages['gu'] = array(
 240+ 'getdata' => 'માહિતી પ્રાપ્ત કરો',
 241+ 'externaldata-desc' => 'બાહ્ય કડીઓ અને સ્થાનિક વિકિ પાનાઓ પરથી CSV, JSON અને XML શૈલીમાં માહિતીની પુન:પ્રાપ્તિની છુટ',
 242+);
 243+
 244+/** Hebrew (עברית)
 245+ * @author Rotemliss
 246+ * @author YaronSh
 247+ */
 248+$messages['he'] = array(
 249+ 'getdata' => 'קבלת נתונים',
 250+ 'externaldata-desc' => 'אפשרות לקבלת נתונים בפורמטים: CSV, JSON ו־XML, גם מכתובות חיצוניות וגם מדפי ויקי מקומיים',
 251+ 'externaldata-ldap-unable-to-connect' => 'לא ניתן להתחבר ל־$1',
 252+ 'externaldata-json-decode-not-supported' => 'שגיאה: הפקודה json_decode() אינה נתמכת בגרסה זו של PHP',
 253+ 'externaldata-xml-error' => 'שגיאת XML: $1 בשורה $2',
 254+ 'externaldata-db-incomplete-information' => 'שגיאה: יש רק מידע חלקי על מספר השרת הזה.',
 255+ 'externaldata-db-could-not-get-url' => 'לא ניתן לקבל את כתובת ה־URL לאחר {{PLURAL:$1|נסיון אחד|$1 נסיונות}}.',
 256+ 'externaldata-db-unknown-type' => 'שגיאה: סוג בסיס הנתונים אינו מוכר.',
 257+ 'externaldata-db-could-not-connect' => 'שגיאה: לא ניתן להתחבר אל בסיס הנתונים.',
 258+ 'externaldata-db-no-return-values' => 'שגיאה: לא הוגדרו ערכים להחזרה.',
 259+ 'externaldata-db-invalid-query' => 'שאילתה בלתי תקינה.',
 260+);
 261+
 262+/** Upper Sorbian (Hornjoserbsce)
 263+ * @author Michawiki
 264+ */
 265+$messages['hsb'] = array(
 266+ 'getdata' => 'Daty wobstarać',
 267+ 'externaldata-desc' => 'Zmóžnja wotwołanje datow we formatach CSV, JSON a XML z eksternych URL kaž tež lokalnych wikijowych stronow',
 268+ 'externaldata-ldap-unable-to-connect' => 'Njemóžno z $1 zwjazać',
 269+ 'externaldata-json-decode-not-supported' => 'Zmylk: json_decode() so w tutej wersiji PHP njepodpěruje',
 270+ 'externaldata-xml-error' => 'Zmylk XML: $1 na lince $2',
 271+ 'externaldata-db-incomplete-information' => "'''Zmylk: Njedospołne informacije za ID tutoho serwera.'''",
 272+ 'externaldata-db-could-not-get-url' => 'Njebě móžno URL po $1 {{PLURAL:$1|pospyće|pospytomaj|pospytach|pospytach}} dóstać.',
 273+ 'externaldata-db-unknown-type' => "'''Zmylk: Njeznaty typ datoweje banki.'''",
 274+ 'externaldata-db-could-not-connect' => "'''Zmylk: Njemóžno z datowej banku zwjazać.'''",
 275+ 'externaldata-db-no-return-values' => "'''Zmylk: Žane hódnoty wróćenja podate.'''",
 276+ 'externaldata-db-invalid-query' => 'Njepłaćiwe naprašowanje.',
 277+);
 278+
 279+/** Interlingua (Interlingua)
 280+ * @author McDutchie
 281+ */
 282+$messages['ia'] = array(
 283+ 'getdata' => 'Obtener datos',
 284+ 'externaldata-desc' => 'Permitte recuperar datos in le formatos CSV, JSON e XML, e ab adresses URL externe e ab paginas wiki local',
 285+);
 286+
 287+/** Indonesian (Bahasa Indonesia)
 288+ * @author Bennylin
 289+ */
 290+$messages['id'] = array(
 291+ 'getdata' => 'Ambil data',
 292+ 'externaldata-desc' => 'Mengijinkan data untuk diunduh dalam format CSV, JSON, dan XML dari pranala luar maupun dari halaman wiki',
 293+ 'externaldata-ldap-unable-to-connect' => 'Tidak dapat terhubung ke $1',
 294+ 'externaldata-json-decode-not-supported' => 'Galat: json_decode() tidak didukung oleh versi PHP ini',
 295+ 'externaldata-xml-error' => 'Galat XML: $1 pada baris $2',
 296+ 'externaldata-db-incomplete-information' => 'Galat: Informasi tak lengkap untuk ID peladen ini.',
 297+ 'externaldata-db-could-not-get-url' => 'Tidak dapat mengambil URL setelah dicoba {{PLURAL:$1||}}$1 kali.',
 298+ 'externaldata-db-unknown-type' => 'Galat: Jenis basis data tidak diketahui.',
 299+ 'externaldata-db-could-not-connect' => 'Galat: Tidak dapat terhubung ke basis data.',
 300+ 'externaldata-db-no-return-values' => 'Galat: Nilai pengembalian tidak dispesifikasi.',
 301+ 'externaldata-db-invalid-query' => 'Kueri tidak sah.',
 302+);
 303+
 304+/** Italian (Italiano)
 305+ * @author Pietrodn
 306+ */
 307+$messages['it'] = array(
 308+ 'getdata' => 'Ottieni dati',
 309+ 'externaldata-desc' => 'Consente di recuperare dati nei formati CSV, XML e JSON sia da URL esterni sia da pagine wiki locali',
 310+);
 311+
 312+/** Japanese (日本語)
 313+ * @author Fryed-peach
 314+ */
 315+$messages['ja'] = array(
 316+ 'getdata' => 'データ取得',
 317+ 'externaldata-desc' => '外部URLやローカルのウィキページから、CSV・JSON・XML形式のデータを取得できるようにする',
 318+ 'externaldata-ldap-unable-to-connect' => '$1 に接続できません',
 319+ 'externaldata-json-decode-not-supported' => 'エラー: json_decode() はこのバージョンの PHP ではサポートされていません',
 320+ 'externaldata-xml-error' => 'XMLエラー: 行$2で$1',
 321+ 'externaldata-db-incomplete-information' => 'エラー: このサーバーIDに対する情報が不十分です。',
 322+ 'externaldata-db-could-not-get-url' => '$1回の試行を行いましたが URL を取得できませんでした。',
 323+ 'externaldata-db-unknown-type' => 'エラー: データベースの種類が不明です。',
 324+ 'externaldata-db-could-not-connect' => 'エラー: データベースに接続できませんでした。',
 325+ 'externaldata-db-no-return-values' => 'エラー: 戻り値が指定されていません。',
 326+ 'externaldata-db-invalid-query' => '不正なクエリー',
 327+);
 328+
 329+/** Khmer (ភាសាខ្មែរ)
 330+ * @author វ័ណថារិទ្ធ
 331+ */
 332+$messages['km'] = array(
 333+ 'getdata' => 'យក​ទិន្នន័យ',
 334+);
 335+
 336+/** Ripoarisch (Ripoarisch)
 337+ * @author Purodha
 338+ */
 339+$messages['ksh'] = array(
 340+ 'getdata' => 'Date holle!',
 341+ 'externaldata-desc' => 'Äloup, Date em <i lang="en">CSV</i> Fomaat, em <i lang="en">JSON</i> Fomaat, un em <i lang="en">XML</i> Fomaat fun <i lang="en">URLs</i> un vun Wiki-Sigge ze holle.',
 342+ 'externaldata-ldap-unable-to-connect' => 'Kann nit noh $1 verbenge',
 343+ 'externaldata-json-decode-not-supported' => '<span style="text-transform: uppercase">Fähler:</span> De Fungxuhn <code lang="en">json_decode()</code> weedt vun heh dä Version vun <i lang="en">PHP</i> nit ongerschtöz.',
 344+ 'externaldata-xml-error' => 'Fähler em XML, op Reih $2: $1',
 345+ 'externaldata-db-incomplete-information' => '<span style="text-transform: uppercase">Fähler:</span> De Enfomazjuhne vör di ßööver Kännong sin nit kumplätt.',
 346+ 'externaldata-db-could-not-get-url' => 'Kunnt {{PLURAL:$1|noh eimohl Versöhke|och noh $1 Mohl Versöhke|ohne enne Versöhk}} nix vun däm <i lang="en">URL</i> krijje.',
 347+ 'externaldata-db-unknown-type' => '<span style="text-transform: uppercase">Fähler:</span> Di Zoot Datebangk es unbikannt.',
 348+ 'externaldata-db-could-not-connect' => '<span style="text-transform: uppercase">Fähler:</span> Kunnt kein Verbendung noh dä Datebangk krijje.',
 349+ 'externaldata-db-no-return-values' => '<span style="text-transform: uppercase">Fähler:</span> Kein Wääte för Zerökzeävve aanjejovve.',
 350+ 'externaldata-db-invalid-query' => 'Onjöltesch Frooch aan de Datebangk.',
 351+);
 352+
 353+/** Luxembourgish (Lëtzebuergesch)
 354+ * @author Robby
 355+ */
 356+$messages['lb'] = array(
 357+ 'getdata' => 'Donnéeë kréien',
 358+ 'externaldata-desc' => 'Erlaabt et Donnéeën an de Formater CSV, JSON an XML vun externen URLen a lokale Wiki-Säiten ze verschaffen',
 359+ 'externaldata-ldap-unable-to-connect' => 'Onméiglech sech op $1 ze connectéieren',
 360+ 'externaldata-xml-error' => 'XML Feeler: $1 an der Linn $2',
 361+ 'externaldata-db-unknown-type' => 'Feeler: Onbekannten Datebank-Typ.',
 362+ 'externaldata-db-could-not-connect' => "Feeler: D'Verbindung mat der Datebank konnt net opgebaut ginn.",
 363+);
 364+
 365+/** Dutch (Nederlands)
 366+ * @author Siebrand
 367+ */
 368+$messages['nl'] = array(
 369+ 'getdata' => 'Gegevens ophalen',
 370+ 'externaldata-desc' => "Maakt het mogelijk gegevens in CSV, JSON en XML op te halen van zowel externe URL's als lokale wikipagina's",
 371+ 'externaldata-ldap-unable-to-connect' => 'Het was niet mogelijk te verbinden met $1',
 372+ 'externaldata-json-decode-not-supported' => 'Fout: json_decode() wordt niet ondersteund in deze versie van PHP',
 373+ 'externaldata-xml-error' => 'XML-fout: $1 op regel $2',
 374+ 'externaldata-db-incomplete-information' => 'Fout: Onvolledige informatie voor dit servernummer.',
 375+ 'externaldata-db-could-not-get-url' => 'Na $1 {{PLURAL:$1|poging|pogingen}} gaf de URL geen resultaat.',
 376+ 'externaldata-db-unknown-type' => 'Fout: onbekend databasetype.',
 377+ 'externaldata-db-could-not-connect' => 'Fout: het was niet mogelijk met de database te verbinden.',
 378+ 'externaldata-db-no-return-values' => 'Fout: er zijn geen return-waarden ingesteld.',
 379+ 'externaldata-db-invalid-query' => 'Ongeldige zoekopdracht.',
 380+);
 381+
 382+/** Norwegian Nynorsk (‪Norsk (nynorsk)‬)
 383+ * @author Gunnernett
 384+ */
 385+$messages['nn'] = array(
 386+ 'getdata' => 'Hent data',
 387+ 'externaldata-desc' => 'Gjev høve til å lasta inn data i formata CSV, JSON og XML frå både eksterne nettadresser og lokale wikisider',
 388+);
 389+
 390+/** Norwegian (bokmål)‬ (‪Norsk (bokmål)‬)
 391+ * @author Nghtwlkr
 392+ */
 393+$messages['no'] = array(
 394+ 'getdata' => 'Hent data',
 395+ 'externaldata-desc' => 'Gir mulighet til å hente data i formatene CSV, JSON og XML fra både eksterne nettadresser og lokale wikisider',
 396+);
 397+
 398+/** Occitan (Occitan)
 399+ * @author Cedric31
 400+ */
 401+$messages['oc'] = array(
 402+ 'getdata' => 'Obténer de donadas',
 403+ 'externaldata-desc' => "Permet de recuperar de donadas en CSV, JSON e XML dempuèi d'URL extèrnas e de paginas del wiki",
 404+ 'externaldata-ldap-unable-to-connect' => 'Impossible de se connectar a $1',
 405+ 'externaldata-json-decode-not-supported' => 'Error : json_decode() es pas suportada dins aquesta version de PHP',
 406+ 'externaldata-xml-error' => 'Error XML : $1 a la linha $2',
 407+ 'externaldata-db-incomplete-information' => 'Error : Informacions incompletas per aqueste identificant de servidor.',
 408+ 'externaldata-db-could-not-get-url' => "Impossible d'obténer l'URL aprèp $1 {{PLURAL:$1|ensag|ensages}}.",
 409+ 'externaldata-db-unknown-type' => 'ERROR: Tipe de banca de donadas desconegut.',
 410+ 'externaldata-db-could-not-connect' => 'Error : Impossible de se connectar a la banca de donadas.',
 411+ 'externaldata-db-no-return-values' => 'Error : Cap de valor de retorn es pas estada especificada.',
 412+ 'externaldata-db-invalid-query' => 'Requèsta invalida.',
 413+);
 414+
 415+/** Polish (Polski)
 416+ * @author Leinad
 417+ * @author Sp5uhe
 418+ */
 419+$messages['pl'] = array(
 420+ 'getdata' => 'Pobierz dane',
 421+ 'externaldata-desc' => 'Umożliwia pobieranie danych w formatach CSV, JSON lub XML zarówno z zewnętrznych adresów URL jak i lokalnych stron wiki',
 422+ 'externaldata-ldap-unable-to-connect' => 'Nie można połączyć się z $1',
 423+ 'externaldata-json-decode-not-supported' => 'Błąd – json_decode() nie jest obsługiwana w tej wersji PHP',
 424+ 'externaldata-xml-error' => 'Błąd XML – $1 w wierszu $2',
 425+ 'externaldata-db-incomplete-information' => 'Błąd – niepełne informacje o tym identyfikatorze serwera.',
 426+ 'externaldata-db-could-not-get-url' => 'Nie można uzyskać adresu URL po $1 {{PLURAL:$1|próbie|próbach}}.',
 427+ 'externaldata-db-unknown-type' => 'Błąd: Nieznany typ bazy danych.',
 428+ 'externaldata-db-could-not-connect' => 'Błąd: Nie można połączyć się z bazą danych.',
 429+ 'externaldata-db-no-return-values' => 'Błąd – nie określono zwracanej wartości.',
 430+ 'externaldata-db-invalid-query' => 'Nieprawidłowe zapytanie.',
 431+);
 432+
 433+/** Portuguese (Português)
 434+ * @author Giro720
 435+ * @author Waldir
 436+ */
 437+$messages['pt'] = array(
 438+ 'getdata' => 'Obter dados',
 439+ 'externaldata-desc' => 'Permite a obtenção de dados em CSV, JSON e XML tanto a partir de URLs externos como de páginas wiki locais',
 440+ 'externaldata-ldap-unable-to-connect' => 'Não foi possível conectar-se a $1',
 441+ 'externaldata-xml-error' => 'erro no XML: $1 na linha $2',
 442+ 'externaldata-db-could-not-get-url' => 'Não foi possível obter o URL após $1 {{PLURAL:$1|tentativa|tentativas}}.',
 443+ 'externaldata-db-could-not-connect' => 'Erro: Não foi possível conectar-se ao banco de dados.',
 444+);
 445+
 446+/** Brazilian Portuguese (Português do Brasil)
 447+ * @author Eduardo.mps
 448+ */
 449+$messages['pt-br'] = array(
 450+ 'getdata' => 'Obter dados',
 451+ 'externaldata-desc' => 'Permite a obtenção de dados em CSV, JSON e XML tanto a partir de URLs externos como de páginas wiki locais',
 452+ 'externaldata-ldap-unable-to-connect' => 'Não foi possível conectar-se a $1',
 453+ 'externaldata-json-decode-not-supported' => 'Erro: json_decode() não é suportado nesta versão do PHP',
 454+ 'externaldata-xml-error' => 'Erro no XML: $1 na linha $2',
 455+ 'externaldata-db-incomplete-information' => 'Erro: Informação incompleta para o ID deste servidor</P>',
 456+ 'externaldata-db-could-not-get-url' => 'Não foi possível obter o URL após $1 {{PLURAL:$1|tentativa|tentativas}}.',
 457+ 'externaldata-db-unknown-type' => 'Erro: Tipo de base de dados desconhecido.',
 458+ 'externaldata-db-could-not-connect' => 'Erro: Não foi possível conectar-se a base de dados.',
 459+ 'externaldata-db-no-return-values' => 'Erro: Nenhum valor de retorno especificado.',
 460+ 'externaldata-db-invalid-query' => 'Consulta inválida.',
 461+);
 462+
 463+/** Romanian (Română)
 464+ * @author Firilacroco
 465+ * @author KlaudiuMihaila
 466+ */
 467+$messages['ro'] = array(
 468+ 'getdata' => 'Obţine date',
 469+ 'externaldata-desc' => 'Permite obţinerea datelor în format CSV, JSON şi XML din atât adrese URL externe, cât şi pagini wiki locale',
 470+ 'externaldata-xml-error' => 'Eroare XML: $1 la linia $2',
 471+ 'externaldata-db-unknown-type' => 'Eroare: Tipul bazei de date necunoscut.',
 472+ 'externaldata-db-invalid-query' => 'Interogare invalidă.',
 473+);
 474+
 475+/** Tarandíne (Tarandíne)
 476+ * @author Joetaras
 477+ */
 478+$messages['roa-tara'] = array(
 479+ 'getdata' => 'Pigghie le date',
 480+ 'externaldata-desc' => "Permette de repigghià le data jndr'à le formate CSV, JSON e XML da URL fore a Uicchipèdie e da pàggene locale de Uicchipèdie",
 481+);
 482+
 483+/** Russian (Русский)
 484+ * @author Ferrer
 485+ * @author Александр Сигачёв
 486+ */
 487+$messages['ru'] = array(
 488+ 'getdata' => 'Получить данные',
 489+ 'externaldata-desc' => 'Позволяет получение данных в форматах CSV, JSON и XML, как с внешних адресов, так и с локальных вики-страниц.',
 490+ 'externaldata-ldap-unable-to-connect' => 'Не удаётся подключиться к $1',
 491+ 'externaldata-json-decode-not-supported' => 'Ошибка. json_decode() не поддерживается в данной версии PHP',
 492+ 'externaldata-xml-error' => 'Ошибка XML. $1 в строке $2',
 493+ 'externaldata-db-incomplete-information' => 'ОШИБКА. Неполная информация для этого ID сервера.',
 494+ 'externaldata-db-could-not-get-url' => 'Не удалось получить URL после $1 {{PLURAL:$1|попытки|попыток|попыток}}.',
 495+ 'externaldata-db-unknown-type' => 'ОШИБКА. Неизвестный тип базы данных.',
 496+ 'externaldata-db-could-not-connect' => 'ОШИБКА. Не удаётся подключиться к базе данных.',
 497+ 'externaldata-db-no-return-values' => 'ОШИБКА. Не указаны возвращаемые значение.',
 498+ 'externaldata-db-invalid-query' => 'Ошибочный запрос.',
 499+);
 500+
 501+/** Slovak (Slovenčina)
 502+ * @author Helix84
 503+ */
 504+$messages['sk'] = array(
 505+ 'getdata' => 'Získať dáta',
 506+ 'externaldata-desc' => 'Umožňuje získavanie údajov vo formátoch CSV, JSON a XML z externých URL aj z lokálnych wiki stránok',
 507+ 'externaldata-ldap-unable-to-connect' => 'Nepodarilo sa pripojiť k $1',
 508+ 'externaldata-json-decode-not-supported' => 'Chyba: táto verzia PHP nepodporuje json_decode()',
 509+ 'externaldata-xml-error' => 'Chyba XML: $1 na riadku $2',
 510+ 'externaldata-db-incomplete-information' => 'Chyba: Nekompletné informácie s týmto ID servera.',
 511+ 'externaldata-db-could-not-get-url' => 'Nepodarilo sa získať URL po $1 {{PLURAL:$1|pokuse|pokusoch}}.',
 512+ 'externaldata-db-unknown-type' => 'Chyba: Neznámy typ databázy.',
 513+ 'externaldata-db-could-not-connect' => 'Chyba: Nepodarilo sa pripojiť k databáze.',
 514+ 'externaldata-db-no-return-values' => 'Chyba: Neboli zadané žiadne návratové hodnoty.',
 515+ 'externaldata-db-invalid-query' => 'Neplatná požiadavka.',
 516+);
 517+
 518+/** Serbian Cyrillic ekavian (Српски (ћирилица))
 519+ * @author Михајло Анђелковић
 520+ */
 521+$messages['sr-ec'] = array(
 522+ 'getdata' => 'Преузми податке',
 523+ 'externaldata-desc' => 'Омогућава преузимање података у CSV, JSON и XML форматима, како преко спољашњих веза, тако и са локалних вики-страна',
 524+);
 525+
 526+/** Serbian Latin ekavian (Srpski (latinica))
 527+ * @author Michaello
 528+ */
 529+$messages['sr-el'] = array(
 530+ 'getdata' => 'Preuzmi podatke',
 531+ 'externaldata-desc' => 'Omogućava preuzimanje podataka u CSV, JSON i XML formatima, kako preko spoljašnjih veza, tako i sa lokalnih viki-strana',
 532+);
 533+
 534+/** Swedish (Svenska)
 535+ * @author Najami
 536+ */
 537+$messages['sv'] = array(
 538+ 'getdata' => 'Hämta data',
 539+ 'externaldata-desc' => 'Tillåter att hämta data i formaten CSV, JSON och XML från både externa URL:er och lokala wikisidor',
 540+);
 541+
 542+/** Telugu (తెలుగు)
 543+ * @author Kiranmayee
 544+ */
 545+$messages['te'] = array(
 546+ 'getdata' => 'విషయములు తీసుకునిరా',
 547+);
 548+
 549+/** Tagalog (Tagalog)
 550+ * @author AnakngAraw
 551+ */
 552+$messages['tl'] = array(
 553+ 'getdata' => 'Kunin ang dato',
 554+ 'externaldata-desc' => 'Nagpapahintulot sa muling pagkuha ng datong nasa mga anyong CSV, JSON at XML na kapwa mula sa panlabas na mga URL at pampook na mga pahina ng wiki',
 555+);
 556+
 557+/** Turkish (Türkçe)
 558+ * @author Karduelis
 559+ */
 560+$messages['tr'] = array(
 561+ 'getdata' => 'Veri al',
 562+);
 563+
 564+/** Veps (Vepsan kel')
 565+ * @author Игорь Бродский
 566+ */
 567+$messages['vep'] = array(
 568+ 'getdata' => 'Sada andmused',
 569+);
 570+
 571+/** Vietnamese (Tiếng Việt)
 572+ * @author Vinhtantran
 573+ */
 574+$messages['vi'] = array(
 575+ 'getdata' => 'Lấy dữ liệu',
 576+ 'externaldata-desc' => 'Cho phép truy xuất dữ liệu theo định dạng CSV, JSON và XML từ cả URL bên ngoài lẫn các trang wiki bên trong',
 577+);
 578+
Property changes on: tags/extensions/ExternalData/REL_0_9/ExternalData.i18n.php
___________________________________________________________________
Name: svn:eol-style
1579 + native
Index: tags/extensions/ExternalData/REL_0_9/ExternalData.php
@@ -0,0 +1,80 @@
 2+<?php
 3+/**
 4+ * Initialization file for the External Data extension
 5+ *
 6+ * @file
 7+ * @ingroup ExternalData
 8+ * @author Yaron Koren
 9+ */
 10+
 11+if (!defined('MEDIAWIKI')) die();
 12+
 13+$wgExtensionCredits['parserhook'][]= array(
 14+ 'path' => __FILE__,
 15+ 'name' => 'External Data',
 16+ 'version' => '0.9',
 17+ 'author' => array( 'Yaron Koren', 'Michael Dale', 'David Macdonald' ),
 18+ 'url' => 'http://www.mediawiki.org/wiki/Extension:External_Data',
 19+ 'description' => 'Allows for retrieving data in CSV, JSON and XML formats from both external URLs and local wiki pages',
 20+ 'descriptionmsg' => 'externaldata-desc',
 21+);
 22+$edgIP = $IP . '/extensions/ExternalData';
 23+
 24+$wgExtensionFunctions[] = 'edgParserFunctions';
 25+$wgExtensionMessagesFiles['ExternalData'] = $edgIP . '/ExternalData.i18n.php';
 26+
 27+if( version_compare( $wgVersion, '1.16alpha', '>=' ) ) {
 28+ $wgExtensionMessagesFiles['ExternalDataMagic'] = $edgIP . '/ExternalData.i18n.magic.php';
 29+} else {
 30+ // Pre 1.16alpha backward compatibility for magic words
 31+ $wgHooks['LanguageGetMagic'][] = 'edgLanguageGetMagic';
 32+}
 33+
 34+// register all special pages and other classes
 35+$wgAutoloadClasses['EDUtils'] = $edgIP . '/ED_Utils.php';
 36+$wgAutoloadClasses['EDParserFunctions'] = $edgIP . '/ED_ParserFunctions.php';
 37+$wgSpecialPages['GetData'] = 'EDGetData';
 38+$wgAutoloadClasses['EDGetData'] = $edgIP . '/ED_GetData.php';
 39+$wgSpecialPageGroups['GetData'] = 'pagetools';
 40+
 41+$edgValues = array();
 42+$edgStringReplacements = array();
 43+$edgCacheTable = null;
 44+
 45+//(in seconds) set to one week:
 46+$edgCacheExpireTime = 60*60*24 * 7;
 47+
 48+function edgParserFunctions() {
 49+ global $wgHooks, $wgParser;
 50+ if( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
 51+ $wgHooks['ParserFirstCallInit'][] = 'edgRegisterParser';
 52+ } else {
 53+ if ( class_exists( 'StubObject' ) && !StubObject::isRealObject( $wgParser ) ) {
 54+ $wgParser->_unstub();
 55+ }
 56+ edgRegisterParser( $wgParser );
 57+ }
 58+}
 59+
 60+function edgRegisterParser(&$parser) {
 61+ $parser->setFunctionHook( 'get_external_data', array('EDParserFunctions','doGetExternalData') );
 62+ $parser->setFunctionHook( 'get_ldap_data', array('EDParserFunctions','doGetLDAPData') );
 63+ $parser->setFunctionHook( 'get_db_data', array('EDParserFunctions','doGetDBData') );
 64+ $parser->setFunctionHook( 'external_value', array('EDParserFunctions','doExternalValue') );
 65+ $parser->setFunctionHook( 'for_external_table', array('EDParserFunctions','doForExternalTable') );
 66+
 67+ return true; // always return true, in order not to stop MW's hook processing!
 68+}
 69+
 70+// Pre 1.16alpha backward compatibility for magic words
 71+function edgLanguageGetMagic( &$magicWords, $langCode = "en" ) {
 72+ switch ( $langCode ) {
 73+ default:
 74+ $magicWords['get_external_data'] = array ( 0, 'get_external_data' );
 75+ $magicWords['get_ldap_data'] = array ( 0, 'get_ldap_data' );
 76+ $magicWords['get_db_data'] = array ( 0, 'get_db_data' );
 77+ $magicWords['external_value'] = array ( 0, 'external_value' );
 78+ $magicWords['for_external_table'] = array ( 0, 'for_external_table' );
 79+ }
 80+ return true;
 81+}
Property changes on: tags/extensions/ExternalData/REL_0_9/ExternalData.php
___________________________________________________________________
Name: svn:eol-style
182 + native
Index: tags/extensions/ExternalData/REL_0_9/ED_ParserFunctions.php
@@ -0,0 +1,250 @@
 2+<?php
 3+/**
 4+ * Class for handling the parser functions for External Data
 5+ */
 6+
 7+if ( !defined( 'MEDIAWIKI' ) ) {
 8+ die( 'This file is a MediaWiki extension; it is not a valid entry point' );
 9+}
 10+
 11+class EDParserFunctions {
 12+
 13+ /**
 14+ * Render the #get_external_data parser function
 15+ */
 16+ static function doGetExternalData( &$parser ) {
 17+ global $wgTitle, $edgCurPageName, $edgValues;
 18+
 19+ // if we're handling multiple pages, reset $edgValues
 20+ // when we move from one page to another
 21+ $cur_page_name = $wgTitle->getText();
 22+ if (! isset($edgCurPageName) || $edgCurPageName != $cur_page_name) {
 23+ $edgValues = array();
 24+ $edgCurPageName = $cur_page_name;
 25+ }
 26+
 27+ $params = func_get_args();
 28+ array_shift( $params ); // we already know the $parser ...
 29+ $url = array_shift( $params );
 30+ $url = str_replace( ' ', '%20', $url ); // do some minor URL-encoding
 31+ // check whether this URL is allowed - code based on
 32+ // Parser::maybeMakeExternalImage()
 33+ global $edgAllowExternalDataFrom;
 34+ $data_from = $edgAllowExternalDataFrom;
 35+ $text = false;
 36+ if ( empty($data_from) ) {
 37+ $url_match = true;
 38+ } elseif ( is_array( $data_from ) ) {
 39+ $url_match = false;
 40+ foreach( $data_from as $match ) {
 41+ if( strpos( $url, $match ) === 0 ) {
 42+ $url_match = true;
 43+ break;
 44+ }
 45+ }
 46+ } else {
 47+ $url_match = (strpos( $url, $data_from ) === 0);
 48+ }
 49+ if ( ! $url_match )
 50+ return;
 51+
 52+ // now, get the contents of the URL - exit if there's nothing
 53+ // there
 54+ $url_contents = EDUtils::fetchURL( $url );
 55+ if ( empty( $url_contents ) )
 56+ return;
 57+
 58+ $format = strtolower( array_shift( $params ) ); // make case-insensitive
 59+ $external_values = array();
 60+ if ( $format == 'xml' ) {
 61+ $external_values = EDUtils::getXMLData( $url_contents );
 62+ } elseif ( $format == 'csv' ) {
 63+ $external_values = EDUtils::getCSVData( $url_contents, false );
 64+ } elseif ( $format == 'csv with header' ) {
 65+ $external_values = EDUtils::getCSVData( $url_contents, true );
 66+ } elseif ( $format == 'json' ) {
 67+ $external_values = EDUtils::getJSONData( $url_contents );
 68+ }
 69+ // get set of filters and set of mappings, determining each
 70+ // one by whether there's a double or single equals sign,
 71+ // respectively
 72+ $filters = array();
 73+ $mappings = array();
 74+ foreach ( $params as $param ) {
 75+ if ( strpos( $param, '==' ) ) {
 76+ list( $external_var, $value ) = explode( '==', $param );
 77+ // set to all lowercase to avoid casing issues
 78+ $external_var = strtolower( $external_var );
 79+ $filters[$external_var] = $value;
 80+ } elseif ( strpos( $param, '=' ) ) {
 81+ list( $local_var, $external_var ) = explode( '=', $param );
 82+ // set to all lowercase to avoid casing issues
 83+ $external_var = strtolower( $external_var );
 84+ $mappings[$local_var] = $external_var;
 85+ } else {
 86+ // if the parameter contains no equals signs,
 87+ // do nothing
 88+ }
 89+ }
 90+ foreach ( $filters as $filter_var => $filter_value ) {
 91+ // find the entry of $external_values that matches
 92+ // the filter variable; if none exists, just ignore
 93+ // the filter
 94+ if ( array_key_exists( $filter_var, $external_values ) ) {
 95+ if ( is_array( $external_values[$filter_var] ) ) {
 96+ $column_values = $external_values[$filter_var];
 97+ foreach ( $column_values as $i => $single_value ) {
 98+ // if a value doesn't match
 99+ // the filter value, remove
 100+ // the value from this row for
 101+ // all columns
 102+ if ( $single_value != $filter_value ) {
 103+ foreach ( $external_values as $external_var => $external_value ) {
 104+ unset( $external_values[$external_var][$i] );
 105+ }
 106+ }
 107+ }
 108+ } else {
 109+ // if we have only one row of values,
 110+ // and the filter doesn't match, just
 111+ // keep the results array blank and
 112+ // return
 113+ if ( $external_values[$filter_var] != $filter_value ) {
 114+ return;
 115+ }
 116+ }
 117+ }
 118+ }
 119+ // for each external variable name specified in the function
 120+ // call, get its value or values (if any exist), and attach it
 121+ // or them to the local variable name
 122+ foreach ( $mappings as $local_var => $external_var ) {
 123+ if ( array_key_exists( $external_var, $external_values ) ) {
 124+ if ( is_array( $external_values[$external_var] ) )
 125+ // array_values() restores regular
 126+ // 1, 2, 3 indexes to array, after unset()
 127+ // in filtering may have removed some
 128+ $edgValues[$local_var] = array_values( $external_values[$external_var] );
 129+ else
 130+ $edgValues[$local_var][] = $external_values[$external_var];
 131+ }
 132+ }
 133+ return;
 134+ }
 135+
 136+ /**
 137+ * Render the #get_ldap_data parser function
 138+ */
 139+ static function doGetLDAPData( &$parser ) {
 140+ global $wgTitle, $edgCurPageName, $edgValues;
 141+
 142+ // if we're handling multiple pages, reset $edgValues
 143+ // when we move from one page to another
 144+ $cur_page_name = $wgTitle->getText();
 145+ if (! isset($edgCurPageName) || $edgCurPageName != $cur_page_name) {
 146+ $edgValues = array();
 147+ $edgCurPageName = $cur_page_name;
 148+ }
 149+
 150+ $params = func_get_args();
 151+ array_shift( $params ); // we already know the $parser ...
 152+ $args = EDUtils::parseParams($params); // parse params into name-value pairs
 153+ $mappings = EDUtils::parseMappings($args['data']); // parse the data arg into mappings
 154+
 155+ $external_values = EDUtils::getLDAPData( $args['filter'], $args['domain'], array_values($mappings) );
 156+
 157+ // Build $edgValues
 158+ foreach ( $mappings as $local_var => $external_var ) {
 159+ $edgValues[$local_var][] = $external_values[0][$external_var][0];
 160+ }
 161+ return;
 162+ }
 163+
 164+ /**
 165+ * Render the #get_db_data parser function
 166+ */
 167+ static function doGetDBData( &$parser ) {
 168+ global $wgTitle, $edgCurPageName, $edgValues;
 169+
 170+ // if we're handling multiple pages, reset $edgValues
 171+ // when we move from one page to another
 172+ $cur_page_name = $wgTitle->getText();
 173+ if (! isset($edgCurPageName) || $edgCurPageName != $cur_page_name) {
 174+ $edgValues = array();
 175+ $edgCurPageName = $cur_page_name;
 176+ }
 177+
 178+ $params = func_get_args();
 179+ array_shift( $params ); // we already know the $parser ...
 180+ $args = EDUtils::parseParams($params); // parse params into name-value pairs
 181+ $mappings = EDUtils::parseMappings($args['data']); // parse the data arg into mappings
 182+
 183+ $external_values = EDUtils::getDBData( $args['server'], $args['from'], $args['where'], array_values($mappings) );
 184+ // handle error cases
 185+ if (is_null($external_values))
 186+ return;
 187+
 188+ // Build $edgValues
 189+ foreach ( $mappings as $local_var => $external_var ) {
 190+ if ( array_key_exists( $external_var, $external_values ) ) {
 191+ foreach ($external_values[$external_var] as $value) {
 192+ $edgValues[$local_var][] = $value;
 193+ }
 194+ }
 195+ }
 196+ return;
 197+ }
 198+
 199+ /**
 200+ * Get the specified index of the array for the specified local
 201+ * variable retrieved by #get_external_data
 202+ */
 203+ static function getIndexedValue( $var, $i ) {
 204+ global $edgValues;
 205+ if ( array_key_exists( $var, $edgValues ) && count( $edgValues[$var] > $i ) )
 206+ return $edgValues[$var][$i];
 207+ else
 208+ return '';
 209+ }
 210+
 211+ /**
 212+ * Render the #external_value parser function
 213+ */
 214+ static function doExternalValue( &$parser, $local_var = '' ) {
 215+ global $edgValues;
 216+ if ( ! array_key_exists( $local_var, $edgValues ) )
 217+ return '';
 218+ elseif ( is_array( $edgValues[$local_var] ) )
 219+ return $edgValues[$local_var][0];
 220+ else
 221+ return $edgValues[$local_var];
 222+ }
 223+
 224+ /**
 225+ * Render the #for_external_table parser function
 226+ */
 227+ static function doForExternalTable( &$parser, $expression = '' ) {
 228+ global $edgValues;
 229+
 230+ // get the variables used in this expression, get the number
 231+ // of values for each, and loop through
 232+ $matches = array();
 233+ preg_match_all( '/{{{([^}]*)}}}/', $expression, $matches );
 234+ $variables = $matches[1];
 235+ $num_loops = 0;
 236+ foreach ($variables as $variable) {
 237+ if ( array_key_exists( $variable, $edgValues ) ) {
 238+ $num_loops = max( $num_loops, count( $edgValues[$variable] ) );
 239+ }
 240+ }
 241+ $text = "";
 242+ for ($i = 0; $i < $num_loops; $i++) {
 243+ $cur_expression = $expression;
 244+ foreach ($variables as $variable) {
 245+ $cur_expression = str_replace( '{{{' . $variable . '}}}', self::getIndexedValue( $variable , $i ), $cur_expression );
 246+ }
 247+ $text .= $cur_expression;
 248+ }
 249+ return $text;
 250+ }
 251+}
Property changes on: tags/extensions/ExternalData/REL_0_9/ED_ParserFunctions.php
___________________________________________________________________
Name: svn:eol-style
1252 + native
Index: tags/extensions/ExternalData/REL_0_9/ED_GetData.php
@@ -0,0 +1,71 @@
 2+<?php
 3+/**
 4+ * A special page for retrieving selected rows of any wiki page that contains
 5+ * data in CSV format
 6+ */
 7+
 8+if (!defined('MEDIAWIKI')) die();
 9+
 10+class EDGetData extends SpecialPage {
 11+
 12+ /**
 13+ * Constructor
 14+ */
 15+ function EDGetData() {
 16+ SpecialPage::SpecialPage( 'GetData' );
 17+ wfLoadExtensionMessages( 'ExternalData' );
 18+ }
 19+
 20+ function execute($query) {
 21+ global $wgRequest, $wgOut;
 22+ $wgOut->disable();
 23+
 24+ $this->setHeaders();
 25+ $page_name = $query;
 26+ $title = Title::newFromText( $page_name );
 27+ if( is_null( $title ) )
 28+ return;
 29+ if( ! $title->userCanRead() )
 30+ return;
 31+ $article = new Article( $title );
 32+ $page_text = $article->fetchContent();
 33+ // Remove <noinclude> sections and <includeonly> tags from text
 34+ $page_text = StringUtils::delimiterReplace('<noinclude>', '</noinclude>', '', $page_text);
 35+ $page_text = strtr($page_text, array('<includeonly>' => '', '</includeonly>' => ''));
 36+ $orig_lines = split( "\n", $page_text );
 37+ // ignore lines that are either blank or start with a semicolon
 38+ $page_lines = array();
 39+ foreach ( $orig_lines as $i => $line )
 40+ if ( $line != '' && $line[0] != ';' )
 41+ $page_lines[] = $line;
 42+ $headers = EDUtils::getValuesFromCSVLine( $page_lines[0] );
 43+ $queried_headers = array();
 44+ foreach( $wgRequest->getValues() as $key => $value ) {
 45+ foreach( $headers as $header_index => $header_value ) {
 46+ $header_value = str_replace( ' ', '_', $header_value );
 47+ if( $key == $header_value ) {
 48+ $queried_headers[$header_index] = $value;
 49+ }
 50+ }
 51+ }
 52+ // include header in output
 53+ $text = $page_lines[0];
 54+ foreach( $page_lines as $i => $line) {
 55+ if ($i == 0) continue;
 56+ $row_values = EDUtils::getValuesFromCSVLine( $line );
 57+ $found_match = true;
 58+ foreach( $queried_headers as $i => $query_value ) {
 59+ $single_value = str_replace( ' ', '_', $row_values[$i] );
 60+ if ( $single_value != $query_value ) {
 61+ $found_match = false;
 62+ }
 63+ }
 64+ if( $found_match ) {
 65+ if ($text != '') $text .= "\n";
 66+ $text .= $line;
 67+ }
 68+ }
 69+ print $text;
 70+ }
 71+
 72+}
Property changes on: tags/extensions/ExternalData/REL_0_9/ED_GetData.php
___________________________________________________________________
Name: svn:eol-style
173 + native
Index: tags/extensions/ExternalData/REL_0_9/ExternalData.sql
@@ -0,0 +1,9 @@
 2+CREATE TABLE IF NOT EXISTS `ed_url_cache` (
 3+ `id` int(10) unsigned NOT NULL auto_increment,
 4+ `url` varchar(255) NOT NULL,
 5+ `post_vars` text,
 6+ `req_time` int(11) NOT NULL,
 7+ `result` longtext character set utf8 collate utf8_unicode_ci,
 8+ UNIQUE KEY `id` (`id`),
 9+ KEY `url` (`url`)
 10+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
\ No newline at end of file
Property changes on: tags/extensions/ExternalData/REL_0_9/ExternalData.sql
___________________________________________________________________
Name: svn:eol-style
111 + native
Index: tags/extensions/ExternalData/REL_0_9/README
@@ -0,0 +1,84 @@
 2+External Data extension
 3+
 4+ Version 0.9
 5+ Yaron Koren, Michael Dale and David Macdonald
 6+
 7+This is free software licensed under the GNU General Public License. Please
 8+see http://www.gnu.org/copyleft/gpl.html for further details, including the
 9+full text and terms of the license.
 10+
 11+== Overview ==
 12+
 13+External Data is an extension to MediaWiki that allows for retrieving data
 14+from various sources: external URLs and local wiki pages (in CSV, JSON and
 15+XML formats), database tables, and LDAP servers
 16+
 17+The extension defines five parser functions - #get_external_data,
 18+#get_db_data, #get_ldap_data, #external_value and #for_external_table:
 19+
 20+#get_external_data retrieves the data from a URL that holds XML, CSV or
 21+JSON, and assigns it to local variables or arrays.
 22+
 23+#get_db_data retrieves data from a database, using a SQL query, and assigns
 24+it to local variables or arrays.
 25+
 26+#get_ldap_data retrieves data from an LDAP server and assigns it to
 27+local variables.
 28+
 29+#external_value displays the value of any retrieved variable, or the
 30+first value if it's an array.
 31+
 32+#for_external_table applies processing onto multiple rows retrieved by
 33+#get_external_data.
 34+
 35+In addition, the extension defines a new special page, 'GetData', that
 36+exports selected rows from a wiki page that holds CSV data, in a format that
 37+is readable by #get_external_data.
 38+
 39+For more information, see the extension homepage at:
 40+http://www.mediawiki.org/wiki/Extension:External_Data
 41+
 42+== Requirements ==
 43+
 44+This version of the External Data extension requires MediaWiki 1.8 or higher.
 45+
 46+== Installation ==
 47+
 48+To install the extension, place the entire 'ExternalData' directory
 49+within your MediaWiki 'extensions' directory, then add the following
 50+line to your 'LocalSettings.php' file:
 51+
 52+ require_once( "$IP/extensions/ExternalData/ExternalData.php" );
 53+
 54+To cache the data from the URLs being accessed, you can call the contents
 55+of ExternalData.sql in your database, then add the following to
 56+LocalSettings.php:
 57+
 58+ $edgCacheTable = 'ed_url_cache';
 59+
 60+You should also add a line like the following, to set the expiration time
 61+of the cache, in seconds; this line will cache data for a week:
 62+
 63+ $edgCacheExpireTime = 7 * 24 * 60 * 60;
 64+
 65+You can also set for string replacements to be done on the URLs you call,
 66+for instance to hide API keys:
 67+
 68+ $edgStringReplacements['MY_API_KEY'] = 'abcd1324';
 69+
 70+You can create a "whitelist" to allow retrieval of data only from trusted
 71+sites, in the manner of MediaWiki's $wgAllowExternalImagesFrom - if you
 72+are hiding API keys, it is very much recommended to create such a
 73+whitelist, to prevent users from being able to discover theire values:
 74+
 75+ $edgAllowExternalDataFrom = array('http://example.com/api');
 76+
 77+Finally, to use the database or LDAP retrieval capabilities, you need to
 78+set connection settings as well - see the online documentation for more
 79+information.
 80+
 81+== Contact ==
 82+
 83+Comments, questions, suggestions and bug reports are welcome, and can
 84+be placed on the Talk page for the extension, or sent to Yaron at
 85+yaron57@gmail.com.
Property changes on: tags/extensions/ExternalData/REL_0_9/README
___________________________________________________________________
Name: svn:eol-style
186 + native
Index: tags/extensions/ExternalData/REL_0_9/ED_Utils.php
@@ -0,0 +1,319 @@
 2+<?php
 3+/**
 4+ * Utility functions for External Data
 5+ */
 6+
 7+if ( !defined( 'MEDIAWIKI' ) ) {
 8+ die( 'This file is a MediaWiki extension; it is not a valid entry point' );
 9+}
 10+
 11+class EDUtils {
 12+ // how many times to try an HTTP request
 13+ private static $http_number_of_tries=3;
 14+
 15+ // XML-handling functions based on code found at
 16+ // http://us.php.net/xml_set_element_handler
 17+ static function startElement( $parser, $name, $attrs ) {
 18+ global $edgCurrentXMLTag, $edgXMLValues;
 19+ // set to all lowercase to avoid casing issues
 20+ $edgCurrentXMLTag = strtolower( $name );
 21+ foreach( $attrs as $attr => $value ) {
 22+ $attr = strtolower( $attr );
 23+ if ( array_key_exists( $attr, $edgXMLValues ) )
 24+ $edgXMLValues[$attr][] = $value;
 25+ else
 26+ $edgXMLValues[$attr] = array( $value );
 27+ }
 28+ }
 29+
 30+ static function endElement( $parser, $name ) {
 31+ global $edgCurrentXMLTag;
 32+ $edgCurrentXMLTag = "";
 33+ }
 34+
 35+ static function getContent ( $parser, $content ) {
 36+ global $edgCurrentXMLTag, $edgXMLValues;
 37+ if ( array_key_exists( $edgCurrentXMLTag, $edgXMLValues ) )
 38+ $edgXMLValues[$edgCurrentXMLTag][] = $content;
 39+ else
 40+ $edgXMLValues[$edgCurrentXMLTag] = array( $content );
 41+ }
 42+
 43+ static function parseParams( $params ) {
 44+ $args = Array();
 45+ foreach ($params as $param) {
 46+ $param = preg_replace ( "/\s\s+/" , " " , $param ); //whitespace
 47+ list($name, $value) = split("=", $param, 2);
 48+ $args[$name] = $value;
 49+ }
 50+ return $args;
 51+ }
 52+
 53+ // This function parses the data argument
 54+ static function parseMappings( $dataArg ) {
 55+ $dataArg = preg_replace ( "/\s\s+/" , " " , $dataArg ); //whitespace
 56+ $rawMappings = split(",", $dataArg);
 57+ $mappings = Array();
 58+ foreach ($rawMappings as $rawMapping) {
 59+ $vals = split("=", $rawMapping, 2);
 60+ if (count($vals) == 2) {
 61+ $intValue = trim($vals[0]);
 62+ $extValue = trim($vals[1]);
 63+ $mappings[$intValue] = $extValue;
 64+ }
 65+ }
 66+ return $mappings;
 67+ }
 68+
 69+ static function getLDAPData ($filter, $domain, $params) {
 70+ global $edgLDAPServer;
 71+ global $edgLDAPUser;
 72+ global $edgLDAPPass;
 73+
 74+ $ds = EDUtils::connectLDAP($edgLDAPServer[$domain], $edgLDAPUser[$domain], $edgLDAPPass[$domain]);
 75+ $results = EDUtils::searchLDAP($ds, $domain, $filter, $params);
 76+
 77+ return $results;
 78+ }
 79+
 80+ static function connectLDAP($server, $username, $password) {
 81+ $ds = ldap_connect($server);
 82+ if ($ds) {
 83+ // these options for Active Directory only?
 84+ ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION,3);
 85+ ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
 86+
 87+ if ($username) {
 88+ $r = ldap_bind($ds, $username, $password);
 89+ } else {
 90+ # no username, so do anonymous bind
 91+ $r = ldap_bind($ds);
 92+ }
 93+
 94+ # should check the result of the bind here
 95+ return $ds;
 96+ } else {
 97+ echo ( wfMsgExt( "externaldata-ldap-unable-to-connect", array( 'parse', 'escape' ), $server ) );
 98+ }
 99+ }
 100+
 101+ static function searchLDAP($ds, $domain, $filter, $attributes) {
 102+ global $edgLDAPBaseDN;
 103+
 104+ $sr = ldap_search($ds, $edgLDAPBaseDN[$domain], $filter, $attributes);
 105+ $results = ldap_get_entries($ds, $sr);
 106+ return $results;
 107+ }
 108+
 109+ static function getDBData ($server_id, $from, $where, $columns) {
 110+ global $edgDBServerType;
 111+ global $edgDBServer;
 112+ global $edgDBName;
 113+ global $edgDBUser;
 114+ global $edgDBPass;
 115+
 116+ if ((! array_key_exists($server_id, $edgDBServerType)) ||
 117+ (! array_key_exists($server_id, $edgDBServer)) ||
 118+ (! array_key_exists($server_id, $edgDBName)) ||
 119+ (! array_key_exists($server_id, $edgDBUser)) ||
 120+ (! array_key_exists($server_id, $edgDBPass))) {
 121+ echo ( wfMsgExt( "externaldata-db-incomplete-information", array( 'parse', 'escape' ) ) );
 122+ return;
 123+ }
 124+
 125+
 126+ $db_type = $edgDBServerType[$server_id];
 127+ $db_server = $edgDBServer[$server_id];
 128+ $db_name = $edgDBName[$server_id];
 129+ $db_username = $edgDBUser[$server_id];
 130+ $db_password = $edgDBPass[$server_id];
 131+
 132+ if ($db_type == "mysql") {
 133+ $db = new Database($db_server, $db_username, $db_password, $db_name);
 134+ } elseif ($db_type == "postgres") {
 135+ $db = new DatabasePostgres($db_server, $db_username, $db_password, $db_name);
 136+ } elseif ($db_type == "mssql") {
 137+ $db = new DatabaseMssql($db_server, $db_username, $db_password, $db_name);
 138+ } else {
 139+ echo ( wfMsgExt( "externaldata-db-unknown-type", array( 'parse', 'escape' ) ) );
 140+ return;
 141+ }
 142+ if (! $db->isOpen()) {
 143+ echo ( wfMsgExt( "externaldata-db-could-not-connect", array( 'parse', 'escape' ) ) );
 144+ return;
 145+ }
 146+
 147+ if (count($columns) == 0) {
 148+ echo ( wfMsgExt( "externaldata-db-no-return-values", array( 'parse', 'escape' ) ) );
 149+ return;
 150+ }
 151+
 152+ $rows = EDUtils::searchDB($db, $from, $where, $columns);
 153+ $db->close();
 154+
 155+ $values = Array();
 156+ foreach ($rows as $row) {
 157+ foreach ($columns as $column) {
 158+ $values[$column][] = $row[$column];
 159+ }
 160+ }
 161+
 162+ return $values;
 163+ }
 164+
 165+ static function searchDB ($db, $from, $where, $columns) {
 166+ $sql = "SELECT " . implode(",", $columns) . " ";
 167+ $sql .= "FROM " . $from . " ";
 168+ $sql .= "WHERE " . $where;
 169+
 170+ $result = $db->query($sql);
 171+ if (!$result) {
 172+ echo ( wfMsgExt( "externaldata-db-invalid-query", array( 'parse', 'escape' ) ) );
 173+ return false;
 174+ } else {
 175+ $rows = Array();
 176+ while ($row = $db->fetchRow($result)) {
 177+ $rows[] = $row;
 178+ }
 179+ return $rows;
 180+ }
 181+ }
 182+
 183+ static function getXMLData ( $xml ) {
 184+ global $edgXMLValues;
 185+ $edgXMLValues = array();
 186+
 187+ $xml_parser = xml_parser_create();
 188+ xml_set_element_handler( $xml_parser, array( 'EDUtils', 'startElement' ), array( 'EDUtils', 'endElement' ) );
 189+ xml_set_character_data_handler( $xml_parser, array( 'EDUtils', 'getContent' ) );
 190+ if (!xml_parse($xml_parser, $xml, true)) {
 191+ echo ( wfMsgExt( 'externaldata-xml-error',
 192+ xml_error_string(xml_get_error_code($xml_parser)),
 193+ xml_get_current_line_number($xml_parser), array( 'parse', 'escape' ) ) );
 194+ }
 195+ xml_parser_free( $xml_parser );
 196+ return $edgXMLValues;
 197+ }
 198+
 199+ static function getValuesFromCSVLine( $csv_line ) {
 200+ // regular expression copied from http://us.php.net/fgetcsv
 201+ $vals = preg_split( '/,(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))/', $csv_line );
 202+ $vals2 = array();
 203+ foreach( $vals as $val )
 204+ $vals2[] = trim( $val, '"' );
 205+ return $vals2;
 206+ }
 207+
 208+ static function getCSVData( $csv, $has_header ) {
 209+ // from http://us.php.net/manual/en/function.str-getcsv.php#88311
 210+ // str_getcsv() is a function that was only added in PHP 5.3.0,
 211+ // so use the much older fgetcsv() if it's not there
 212+ if (function_exists('str_getcsv')) {
 213+ $table = str_getcsv( $csv );
 214+ } else {
 215+ $fiveMBs = 5 * 1024 * 1024;
 216+ $fp = fopen("php://temp/maxmemory:$fiveMBs", 'r+');
 217+ fputs( $fp, $csv );
 218+ rewind( $fp );
 219+ $table = array();
 220+ while ($line = fgetcsv( $fp )) {
 221+ array_push( $table, $line );
 222+ }
 223+ fclose($fp);
 224+ }
 225+ // now "flip" the data, turning it into a column-by-column
 226+ // array, instead of row-by-row
 227+ if ( $has_header ) {
 228+ $header_vals = array_shift( $table );
 229+ }
 230+ $values = array();
 231+ foreach( $table as $line ) {
 232+ foreach( $line as $i => $row_val ) {
 233+ if ($has_header) {
 234+ $column = strtolower( $header_vals[$i] );
 235+ } else {
 236+ // start with an index of 1 instead of 0
 237+ $column = $i + 1;
 238+ }
 239+ if( array_key_exists( $column, $values ) )
 240+ $values[$column][] = $row_val;
 241+ else
 242+ $values[$column] = array( $row_val );
 243+ }
 244+ }
 245+ return $values;
 246+ }
 247+
 248+ /**
 249+ * Recursive function for use by getJSONData()
 250+ */
 251+ static function parseTree( $tree, &$retrieved_values ) {
 252+ foreach ($tree as $key => $val) {
 253+ if (is_array( $val )) {
 254+ self::parseTree( $val, $retrieved_values );
 255+ } else {
 256+ if( array_key_exists( $key, $retrieved_values ) )
 257+ $retrieved_values[$key][] = $val;
 258+ else
 259+ $retrieved_values[$key] = array( $val );
 260+ }
 261+ }
 262+ }
 263+
 264+ static function getJSONData( $json ) {
 265+ // escape if json_decode() isn't supported
 266+ if ( ! function_exists( 'json_decode' ) ) {
 267+ echo ( wfMsgExt( "externaldata-json-decode-not-supported", array( 'parse', 'escape' ) ) );
 268+ return array();
 269+ }
 270+ $json_tree = json_decode($json, true);
 271+ $values = array();
 272+ if ( is_array( $json_tree ) ) {
 273+ self::parseTree( $json_tree, $values );
 274+ }
 275+ return $values;
 276+ }
 277+
 278+ static function fetchURL( $url, $post_vars = array(), $get_fresh=false, $try_count=1 ) {
 279+ $dbr = wfGetDB( DB_SLAVE );
 280+ global $edgStringReplacements, $edgCacheTable, $edgCacheExpireTime;
 281+
 282+ // do any special variable replacements in the URLs, for
 283+ // secret API keys and the like
 284+ foreach ( $edgStringReplacements as $key => $value ) {
 285+ $url = str_replace( $key, $value, $url );
 286+ }
 287+
 288+ if( !isset( $edgCacheTable ) || is_null( $edgCacheTable ) )
 289+ return Http::get( $url );
 290+
 291+ // check the cache (only the first 254 chars of the url)
 292+ $row = $dbr->selectRow( $edgCacheTable, '*', array( 'url' => substr($url,0,254) ), 'EDUtils::fetchURL' );
 293+
 294+ if($row && ( (time() - $row->req_time) > $edgCacheExpireTime )){
 295+ $get_fresh = true;
 296+ }
 297+
 298+ if ( !$row || $get_fresh) {
 299+ $page = Http::get( $url );
 300+ if ( $page === false ) {
 301+ sleep( 1 );
 302+ if( $try_count >= self::$http_number_of_tries ){
 303+ echo ( wfMsgExt( 'externaldata-db-could-not-get-url', array('parsemag', 'escape'), self::$http_number_of_tries ) );
 304+ return '';
 305+ }
 306+ $try_count++;
 307+ return self::fetchURL( $url, $post_vars, $get_fresh, $try_count );
 308+ }
 309+ if ( $page != '' ) {
 310+ $dbw = wfGetDB( DB_MASTER );
 311+ // insert contents into the cache table
 312+ $dbw->insert( $edgCacheTable, array( 'url' => substr($url,0,254), 'result' => $page, 'req_time' => time() ) );
 313+ return $page;
 314+ }
 315+ } else {
 316+ $row = $dbr->fetchObject( $res );
 317+ return $row->result;
 318+ }
 319+ }
 320+}
Property changes on: tags/extensions/ExternalData/REL_0_9/ED_Utils.php
___________________________________________________________________
Name: svn:eol-style
1321 + native

Status & tagging log