Index: tags/extensions/Widgets/REL_0_8_7/smarty_plugins/modifier.validate.php |
— | — | @@ -0,0 +1,31 @@ |
| 2 | +<?php |
| 3 | +/* |
| 4 | + * Smarty plugin |
| 5 | + * ------------------------------------------------------------- |
| 6 | + * File: modifier.validate.php |
| 7 | + * Type: modifier |
| 8 | + * Name: validate |
| 9 | + * Purpose: Validates parameter format ('url' by default). |
| 10 | + * Useful when you need to validate but not escape. |
| 11 | + * ------------------------------------------------------------- |
| 12 | + */ |
| 13 | +function smarty_modifier_validate($string, $type='url') |
| 14 | +{ |
| 15 | + // mapping for PHP filters (http://us2.php.net/manual/en/filter.constants.php) |
| 16 | + $filters = array( |
| 17 | + 'url' => FILTER_VALIDATE_URL, |
| 18 | + 'int' => FILTER_VALIDATE_INT, |
| 19 | + 'boolean' => FILTER_VALIDATE_BOOLEAN, |
| 20 | + 'float' => FILTER_VALIDATE_FLOAT, |
| 21 | + 'email' => FILTER_VALIDATE_EMAIL, |
| 22 | + 'ip' => FILTER_VALIDATE_IP |
| 23 | + ); |
| 24 | + |
| 25 | + if (array_key_exists($type, $filters) && filter_var($string, $filters[$type])) |
| 26 | + { |
| 27 | + return $string; |
| 28 | + } |
| 29 | + |
| 30 | + // unless it matched some validation rule, it's not valid |
| 31 | + return ''; |
| 32 | +} |
Property changes on: tags/extensions/Widgets/REL_0_8_7/smarty_plugins/modifier.validate.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 33 | + native |
Index: tags/extensions/Widgets/REL_0_8_7/Widgets.i18n.php |
— | — | @@ -0,0 +1,180 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Internationalisation file for Widgets extension. |
| 5 | + * |
| 6 | + */ |
| 7 | + |
| 8 | +$messages = array(); |
| 9 | + |
| 10 | +$messages['en'] = array( |
| 11 | + 'widgets-desc' => 'Allows wiki administrators to add free-form widgets to the wiki by editing pages within the {{ns:widget}} namespace. |
| 12 | +Originally developed for [http://www.ardorado.com Ardorado.com]', |
| 13 | + 'widgets-error' => 'Error in [[{{ns:widget}}:$1|widget $1]]', |
| 14 | + 'group-widgeteditor' => 'Widget editors', |
| 15 | + 'group-widgeteditor-member' => 'Widget editor', |
| 16 | + 'grouppage-widgeteditor' => 'Project:Widget editors', |
| 17 | + 'right-editwidgets' => 'Edit pages in the "{{ns:widget}}" namespace', |
| 18 | +); |
| 19 | + |
| 20 | +/** Message documentation (Message documentation) |
| 21 | + * @author Fryed-peach |
| 22 | + * @author Purodha |
| 23 | + * @author Siebrand |
| 24 | + */ |
| 25 | +$messages['qqq'] = array( |
| 26 | + 'widgets-desc' => 'Dat es en koot Verklierung för hee dat Zohsatzprojramm. Donn dä Lengk un dä Name dren nit övversäze.', |
| 27 | + 'grouppage-widgeteditor' => '{{doc-important|Leave "Project:" untranslated}}', |
| 28 | + 'right-editwidgets' => '{{doc-right}}', |
| 29 | +); |
| 30 | + |
| 31 | +/** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца)) |
| 32 | + * @author EugeneZelenko |
| 33 | + * @author Jim-by |
| 34 | + */ |
| 35 | +$messages['be-tarask'] = array( |
| 36 | + 'widgets-desc' => 'Дазваляе адміністратарам {{GRAMMAR:родны|{{SITENAME}}}} дадаваць вольныя формы ў вікі праз рэдагаваньне старонак у прасторы назваў {{ns:widget}}. Арыгінальная распрацоўка для [http://www.ardorado.com Ardorado.com]', |
| 37 | + 'widgets-error' => 'Памылка ў [[{{ns:widget}}:$1|віджэце $1]]', |
| 38 | + 'group-widgeteditor' => 'Рэдактар віджэтаў', |
| 39 | + 'group-widgeteditor-member' => 'Рэдактар віджэта', |
| 40 | + 'grouppage-widgeteditor' => 'Project:Рэдактары віджэтаў', |
| 41 | + 'right-editwidgets' => 'рэдагаваньне старонкі ў прасторы назваў «{{ns:widget}}»', |
| 42 | +); |
| 43 | + |
| 44 | +/** Lower Sorbian (Dolnoserbski) |
| 45 | + * @author Michawiki |
| 46 | + */ |
| 47 | +$messages['dsb'] = array( |
| 48 | + 'widgets-desc' => 'Dowólujo wikijowym administratoram wikijeju pśez wobźěłowanje w mjenjowem rumje {{ns:widget}} swójske miniprogramy pśidaś. |
| 49 | +Spócetnje wuwity za [http://www.ardorado.com Ardorado.com]', |
| 50 | + 'widgets-error' => 'Zmólka w [[{{ns:widget}}:$1|miniprogramje $1]]', |
| 51 | + 'group-widgeteditor' => 'Wobźěłowarje miniprogramow', |
| 52 | + 'group-widgeteditor-member' => 'Wobźěłowaŕ miniprogramow', |
| 53 | + 'grouppage-widgeteditor' => 'Project: Wobźěłowarje miniprogramow', |
| 54 | + 'right-editwidgets' => 'Boki w mjenjowem rumje "{{ns:widget}}" wobźěłaś', |
| 55 | +); |
| 56 | + |
| 57 | +/** French (Français) |
| 58 | + * @author IAlex |
| 59 | + */ |
| 60 | +$messages['fr'] = array( |
| 61 | + 'widgets-desc' => "Permet aux administrateurs du wiki d'ajouter des widgets au wiki en modifiant des pages dans l'espace de noms {{ns:widget}}. Développé à la base pour [http://www.ardorado.com Ardorado.com]", |
| 62 | + 'widgets-error' => 'Erreur dans le [[{{ns:widget}}:$1|widget $1]]', |
| 63 | + 'group-widgeteditor' => 'Modificateurs de widgets', |
| 64 | + 'group-widgeteditor-member' => 'modificateur de widgets', |
| 65 | + 'grouppage-widgeteditor' => 'Project:Modificateurs de widgets', |
| 66 | + 'right-editwidgets' => "Modifier les pages dans l'espace de noms « {{ns:widget}} »", |
| 67 | +); |
| 68 | + |
| 69 | +/** Galician (Galego) |
| 70 | + * @author Toliño |
| 71 | + */ |
| 72 | +$messages['gl'] = array( |
| 73 | + 'widgets-desc' => 'Permite aos administradores do wiki engadir widgets cando se editan as páxinas do espazo de nomes "{{ns:widget}}". |
| 74 | +Desenvolvido orixinalmente para [http://www.ardorado.com Ardorado.com]', |
| 75 | + 'widgets-error' => 'Erro no [[{{ns:widget}}:$1|widget "$1"]]', |
| 76 | + 'group-widgeteditor' => 'Editores de widgets', |
| 77 | + 'group-widgeteditor-member' => 'Editor de widgets', |
| 78 | + 'grouppage-widgeteditor' => 'Project:Editores de widgets', |
| 79 | + 'right-editwidgets' => 'Editar as páxinas do espazo de nomes "{{ns:widget}}"', |
| 80 | +); |
| 81 | + |
| 82 | +/** Swiss German (Alemannisch) |
| 83 | + * @author Als-Holder |
| 84 | + */ |
| 85 | +$messages['gsw'] = array( |
| 86 | + 'widgets-desc' => 'Erlaubt Wikiadministratore Frej-Form-Widgets zum Wiki zuezfiege dur d Bearbeitig vu Syte im {{ns:widget}}-Namensruum. |
| 87 | +Urspringlig entwicklet fir [http://www.ardorado.com Ardorado.com]', |
| 88 | + 'widgets-error' => 'Fähler im [[{{ns:widget}}:$1|Widget $1]]', |
| 89 | + 'group-widgeteditor' => 'Widget-Editore', |
| 90 | + 'group-widgeteditor-member' => 'Widget-Editor', |
| 91 | + 'grouppage-widgeteditor' => 'Project:Widget-Editore', |
| 92 | + 'right-editwidgets' => 'Syte im „{{ns:widget}}“-Namensruum bearbeite', |
| 93 | +); |
| 94 | + |
| 95 | +/** Upper Sorbian (Hornjoserbsce) |
| 96 | + * @author Michawiki |
| 97 | + */ |
| 98 | +$messages['hsb'] = array( |
| 99 | + 'widgets-desc' => 'Dowola wikijowym administratoram wikijej přez wobdźěłowanje stronow znutřka mjenjoweho ruma {{ns:widget}} swójske miniprogramy přidać. |
| 100 | +Prěnjotnje za [http://www.ardorado.com Ardorado.com] wuwity.', |
| 101 | + 'widgets-error' => 'Zmylk w [[{{ns:widget}}:$1|miniprogramje $1]]', |
| 102 | + 'group-widgeteditor' => 'Wobdźěłowarjo miniprogramow', |
| 103 | + 'group-widgeteditor-member' => 'Wobdźěłowar miniprogramow', |
| 104 | + 'grouppage-widgeteditor' => 'Project:Wobdźěłowarjo miniprogramow', |
| 105 | + 'right-editwidgets' => 'Strony w mjenowym rumje "{{ns:widget}}" wobdźěłać', |
| 106 | +); |
| 107 | + |
| 108 | +/** Japanese (日本語) |
| 109 | + * @author Fryed-peach |
| 110 | + */ |
| 111 | +$messages['ja'] = array( |
| 112 | + 'widgets-desc' => '管理者が「{{ns:widget}}」名前空間内のページを編集し、ウィキに自由な形式のウィジェットを追加できるようにする。元々は [http://www.ardorado.com Ardorado.com] のために開発されました', |
| 113 | + 'widgets-error' => '[[{{ns:widget}}:$1|ウィジェット $1]]にエラー', |
| 114 | + 'group-widgeteditor' => 'ウィジェット編集者', |
| 115 | + 'group-widgeteditor-member' => 'ウィジェット編集者', |
| 116 | + 'grouppage-widgeteditor' => 'Project:ウィジェット編集者', |
| 117 | + 'right-editwidgets' => '「{{ns:widget}}」名前空間のページを編集する', |
| 118 | +); |
| 119 | + |
| 120 | +/** Ripoarisch (Ripoarisch) |
| 121 | + * @author Purodha |
| 122 | + */ |
| 123 | +$messages['ksh'] = array( |
| 124 | + 'widgets-desc' => 'Määt et müjjelesch, dat Wiki-Köbeße <i lang="en">Widgets</i> en ene freie Forrem en däm Appachtemang „{{ns:widget}}“ enndraare. |
| 125 | +Dat wood aanfänglesch projrammeert för <span lang="en">[http://www.ardorado.com Ardorado.com]</span>', |
| 126 | + 'widgets-error' => 'Doh es ene Fähler em [[{{ns:widget}}:$1|<i lang="en">Widget</i> $1]]', |
| 127 | + 'group-widgeteditor' => 'Schriiver för <i lang="en">Widgets</i>', |
| 128 | + 'group-widgeteditor-member' => '<i lang="en">Widget</i>-Schriiver', |
| 129 | + 'grouppage-widgeteditor' => 'Project:Widget-Schriiver', |
| 130 | + 'right-editwidgets' => 'Sigge em Appachemang „{{ns:widget}}“ ändere', |
| 131 | +); |
| 132 | + |
| 133 | +/** Dutch (Nederlands) |
| 134 | + * @author Siebrand |
| 135 | + */ |
| 136 | +$messages['nl'] = array( |
| 137 | + 'widgets-desc' => "Stelt wikibeheerders in staat naar eigen inzicht widgets aan de wiki toe te voegen door het bewerken van pagina's in de naamruimte {{ns:widget}}. Oorspronkelijk ontwikkeld voor [http://www.ardorado.com Ardorado.com]", |
| 138 | + 'widgets-error' => 'Fout in [[{{ns:widget}}:$1|widget $1]]', |
| 139 | + 'group-widgeteditor' => 'Widgetbewerkers', |
| 140 | + 'group-widgeteditor-member' => 'Widgetbewerker', |
| 141 | + 'grouppage-widgeteditor' => 'Project:Widgetbewerkers', |
| 142 | + 'right-editwidgets' => 'Pagina\'s bewerken in de naamruimte "{{ns:widget}}"', |
| 143 | +); |
| 144 | + |
| 145 | +/** Occitan (Occitan) |
| 146 | + * @author Cedric31 |
| 147 | + */ |
| 148 | +$messages['oc'] = array( |
| 149 | + 'widgets-desc' => "Permet als administrators del wiki d'apondre de widgets al wiki en modificant de paginas dins l'espac de noms {{ns:widget}}. Desvolopat a la basa per [http://www.ardorado.com Ardorado.com]", |
| 150 | + 'widgets-error' => 'Error dins lo [[{{ns:widget}}:$1|widget $1]]', |
| 151 | + 'group-widgeteditor' => 'Modificators de widgets', |
| 152 | + 'group-widgeteditor-member' => 'modificator de widgets', |
| 153 | + 'grouppage-widgeteditor' => 'Project:Modificators de widgets', |
| 154 | + 'right-editwidgets' => "Modificar las paginas dins l'espaci de noms « {{ns:widget}} »", |
| 155 | +); |
| 156 | + |
| 157 | +/** Russian (Русский) |
| 158 | + * @author Александр Сигачёв |
| 159 | + */ |
| 160 | +$messages['ru'] = array( |
| 161 | + 'widgets-desc' => 'Позволяет администраторам вики добавлять различные виджеты, посредством редактирования страниц пространства имён {{ns:widget}}. Изначально разработано для [http://www.ardorado.com Ardorado.com]', |
| 162 | + 'widgets-error' => 'Ошибка в [[{{ns:widget}}:$1|виджете $1]]', |
| 163 | + 'group-widgeteditor' => 'Редакторы виджетов', |
| 164 | + 'group-widgeteditor-member' => 'Редактор виджетов', |
| 165 | + 'grouppage-widgeteditor' => 'Project:Редакторы виджетов', |
| 166 | + 'right-editwidgets' => 'редактировать страницы в пространстве имён {{ns:widget}}', |
| 167 | +); |
| 168 | + |
| 169 | +/** Slovak (Slovenčina) |
| 170 | + * @author Helix84 |
| 171 | + */ |
| 172 | +$messages['sk'] = array( |
| 173 | + 'widgets-desc' => 'Umožňuje správcom wiki pridávať ovládacie prvky na wiki úpravou stránky v mennom priestore {{ns:widget}}. |
| 174 | +Pôvodne vyvinuté pre [http://www.ardorado.com Ardorado.com]', |
| 175 | + 'widgets-error' => 'Chyba v [[{{ns:widget}}:$1|ovládacom prvku $1]]', |
| 176 | + 'group-widgeteditor' => 'Editori ovládacích prvkov', |
| 177 | + 'group-widgeteditor-member' => 'Editor ovládacích prvkov', |
| 178 | + 'grouppage-widgeteditor' => 'Project:Editori ovládacích prvkov', |
| 179 | + 'right-editwidgets' => 'upravovať stránky v mennom priestore „{{ns:widget}}“', |
| 180 | +); |
| 181 | + |
Property changes on: tags/extensions/Widgets/REL_0_8_7/Widgets.i18n.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 182 | + native |
Index: tags/extensions/Widgets/REL_0_8_7/compiled_templates/.htaccess |
— | — | @@ -0,0 +1,3 @@ |
| 2 | +<Files *.php> |
| 3 | + deny from all |
| 4 | +</Files> |
Property changes on: tags/extensions/Widgets/REL_0_8_7/compiled_templates/.htaccess |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 5 | + native |
Property changes on: tags/extensions/Widgets/REL_0_8_7/compiled_templates |
___________________________________________________________________ |
Name: svn:ignore |
2 | 6 | + * |
Index: tags/extensions/Widgets/REL_0_8_7/Widgets.php |
— | — | @@ -0,0 +1,231 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * |
| 5 | + * {{#widget:<WidgetName>|<name1>=<value1>|<name2>=<value2>}} |
| 6 | + * |
| 7 | + * @author Sergey Chernyshev |
| 8 | + * @version $Id: Widgets.php 15 2008-06-25 21:22:40Z sergey.chernyshev $ |
| 9 | + */ |
| 10 | + |
| 11 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 12 | + echo "This file is not a valid entry point."; |
| 13 | + exit( 1 ); |
| 14 | +} |
| 15 | + |
| 16 | +$wgExtensionCredits['parserhook'][] = array( |
| 17 | + 'path' => __FILE__, |
| 18 | + 'name' => 'Widgets', |
| 19 | + 'description' => 'Allows wiki administrators to add free-form widgets to wiki by just editing pages within Widget namespace. Originally developed for [http://www.ardorado.com Ardorado.com]', |
| 20 | + 'descriptionmsg' => 'widgets-desc', |
| 21 | + 'version' => '0.8.7', |
| 22 | + 'author' => '[http://www.sergeychernyshev.com Sergey Chernyshev] (for [http://www.semanticcommunities.com Semantic Communities LLC.])', |
| 23 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:Widgets' |
| 24 | +); |
| 25 | + |
| 26 | +/** |
| 27 | + * Set this to the index of the Widget namespace |
| 28 | + */ |
| 29 | +if ( !defined( 'NS_WIDGET' ) ) { |
| 30 | + define( 'NS_WIDGET', 274 ); |
| 31 | +} |
| 32 | +if ( !defined( 'NS_WIDGET_TALK' ) ) { |
| 33 | + define( 'NS_WIDGET_TALK', NS_WIDGET + 1 ); |
| 34 | +} elseif ( NS_WIDGET_TALK != NS_WIDGET + 1 ) { |
| 35 | + throw new MWException( 'Configuration error. Do not define NS_WIDGET_TALK, it is automatically set based on NS_WIDGET.' ); |
| 36 | +} |
| 37 | + |
| 38 | +// Define new namespaces |
| 39 | +$wgExtraNamespaces[NS_WIDGET] = 'Widget'; |
| 40 | +$wgExtraNamespaces[NS_WIDGET_TALK] = 'Widget_talk'; |
| 41 | + |
| 42 | +// Support subpages only for talk pages by default |
| 43 | +$wgNamespacesWithSubpages[NS_WIDGET_TALK] = true; |
| 44 | + |
| 45 | +// Define new right |
| 46 | +$wgAvailableRights[] = 'editwidgets'; |
| 47 | + |
| 48 | +$dir = dirname( __FILE__ ) . '/'; |
| 49 | + |
| 50 | +// Initialize Smarty |
| 51 | +require_once( $dir . 'smarty/Smarty.class.php' ); |
| 52 | +$wgExtensionMessagesFiles['Widgets'] = $dir . 'Widgets.i18n.php'; |
| 53 | + |
| 54 | +// Parser function registration |
| 55 | +$wgExtensionFunctions[] = 'widgetNamespacesInit'; |
| 56 | +$wgHooks['LanguageGetMagic'][] = 'widgetLanguageGetMagic'; |
| 57 | +$wgHooks['ParserFirstCallInit'][] = 'widgetParserFunctions'; |
| 58 | + |
| 59 | +function widgetParserFunctions( &$parser ) { |
| 60 | + $parser->setFunctionHook( 'widget', 'renderWidget' ); |
| 61 | + |
| 62 | + return true; |
| 63 | +} |
| 64 | + |
| 65 | +function widgetLanguageGetMagic( &$magicWords, $langCode = 'en' ) { |
| 66 | + switch ( $langCode ) { |
| 67 | + default: |
| 68 | + $magicWords['widget'] = array ( 0, 'widget' ); |
| 69 | + } |
| 70 | + return true; |
| 71 | +} |
| 72 | + |
| 73 | +function renderWidget ( &$parser, $widgetName ) { |
| 74 | + global $IP; |
| 75 | + |
| 76 | + $smarty = new Smarty; |
| 77 | + $smarty->left_delimiter = '<!--{'; |
| 78 | + $smarty->right_delimiter = '}-->'; |
| 79 | + $smarty->compile_dir = "$IP/extensions/Widgets/compiled_templates/"; |
| 80 | + |
| 81 | + // registering custom Smarty plugins |
| 82 | + $smarty->plugins_dir[] = "$IP/extensions/Widgets/smarty_plugins/"; |
| 83 | + |
| 84 | + $smarty->security = true; |
| 85 | + $smarty->security_settings = array( |
| 86 | + 'IF_FUNCS' => array( |
| 87 | + 'is_array', |
| 88 | + 'isset', |
| 89 | + 'array', |
| 90 | + 'list', |
| 91 | + 'count', |
| 92 | + 'sizeof', |
| 93 | + 'in_array', |
| 94 | + 'true', |
| 95 | + 'false', |
| 96 | + 'null' |
| 97 | + ), |
| 98 | + 'MODIFIER_FUNCS' => array( 'validate' ) |
| 99 | + ); |
| 100 | + |
| 101 | + // register the resource name "db" |
| 102 | + $smarty->register_resource( |
| 103 | + 'wiki', |
| 104 | + array( |
| 105 | + 'wiki_get_template', |
| 106 | + 'wiki_get_timestamp', |
| 107 | + 'wiki_get_secure', |
| 108 | + 'wiki_get_trusted' |
| 109 | + ) |
| 110 | + ); |
| 111 | + |
| 112 | + $params = func_get_args(); |
| 113 | + array_shift( $params ); # first one is parser - we don't need it |
| 114 | + array_shift( $params ); # second one is widget name |
| 115 | + |
| 116 | + $params_tree = array(); |
| 117 | + |
| 118 | + foreach ( $params as $param ) { |
| 119 | + $pair = explode('=', $param, 2); |
| 120 | + |
| 121 | + if ( count( $pair ) == 2 ) { |
| 122 | + $key = trim($pair[0]); |
| 123 | + $val = trim($pair[1]); |
| 124 | + } else { |
| 125 | + $key = $param; |
| 126 | + $val = true; |
| 127 | + } |
| 128 | + |
| 129 | + if ( $val == 'false' ) { |
| 130 | + $val = false; |
| 131 | + } |
| 132 | + |
| 133 | + /* If the name of the parameter has object notation |
| 134 | + |
| 135 | + a.b.c.d |
| 136 | + |
| 137 | + then we assign stuff to hash of hashes, not scalar |
| 138 | + |
| 139 | + */ |
| 140 | + $keys = explode( '.', $key ); |
| 141 | + |
| 142 | + // $subtree will be moved from top to the bottom and at the end will point to the last level |
| 143 | + $subtree =& $params_tree; |
| 144 | + |
| 145 | + // go throught all the keys but last one |
| 146 | + $last_key = array_pop( $keys ); |
| 147 | + |
| 148 | + foreach ( $keys as $subkey ) { |
| 149 | + // if next level of subtree doesn't exist yet, create an empty one |
| 150 | + if ( !array_key_exists( $subkey, $subtree ) ) { |
| 151 | + $subtree[$subkey] = array(); |
| 152 | + } |
| 153 | + |
| 154 | + // move to the lower level |
| 155 | + $subtree =& $subtree[$subkey]; |
| 156 | + } |
| 157 | + |
| 158 | + // last portion of the key points to itself |
| 159 | + if ( isset( $subtree[$last_key] ) ) { |
| 160 | + // if already an array, push into it, otherwise, convert into array first |
| 161 | + if ( !is_array( $subtree[$last_key] ) ) { |
| 162 | + $subtree[$last_key] = array( $subtree[$last_key] ); |
| 163 | + } |
| 164 | + |
| 165 | + $subtree[$last_key][] = $val; |
| 166 | + } else { |
| 167 | + // doesn't exist yet, just setting a value |
| 168 | + $subtree[$last_key] = $val; |
| 169 | + } |
| 170 | + } |
| 171 | + |
| 172 | + $smarty->assign( $params_tree ); |
| 173 | + |
| 174 | + try { |
| 175 | + $output = $smarty->fetch( "wiki:$widgetName" ); |
| 176 | + } catch ( Exception $e ) { |
| 177 | + wfLoadExtensionMessages( 'Widgets' ); |
| 178 | + return '<div class=\"error\">' . wfMsgExt( 'widgets-desc', array( 'parsemag' ), $widgetName ) . '</div>'; |
| 179 | + } |
| 180 | + |
| 181 | + return $parser->insertStripItem( $output, $parser->mStripState ); |
| 182 | +} |
| 183 | + |
| 184 | +function widgetNamespacesInit() { |
| 185 | + global $wgGroupPermissions, $wgNamespaceProtection; |
| 186 | + |
| 187 | + // Assign editing to widgeteditor group only (widgets can be dangerous so we do it here, not in LocalSettings) |
| 188 | + $wgGroupPermissions['*']['editwidgets'] = false; |
| 189 | + $wgGroupPermissions['widgeteditor']['editwidgets'] = true; |
| 190 | + |
| 191 | + // Setting required namespace permission rights |
| 192 | + $wgNamespaceProtection[NS_WIDGET] = array( 'editwidgets' ); |
| 193 | +} |
| 194 | + |
| 195 | +// put these function somewhere in your application |
| 196 | +function wiki_get_template( $widgetName, &$widgetCode, &$smarty_obj ) { |
| 197 | + $widgetTitle = Title::newFromText($widgetName, NS_WIDGET); |
| 198 | + if ( $widgetTitle && $widgetTitle->exists() ) { |
| 199 | + $widgetArticle = new Article( $widgetTitle, 0 ); |
| 200 | + $widgetCode = $widgetArticle->getContent(); |
| 201 | + |
| 202 | + // Remove <noinclude> sections and <includeonly> tags from form definition |
| 203 | + $widgetCode = StringUtils::delimiterReplace( '<noinclude>', '</noinclude>', '', $widgetCode ); |
| 204 | + $widgetCode = strtr( $widgetCode, array( '<includeonly>' => '', '</includeonly>' => '' ) ); |
| 205 | + |
| 206 | + return true; |
| 207 | + } else { |
| 208 | + return false; |
| 209 | + } |
| 210 | +} |
| 211 | + |
| 212 | +function wiki_get_timestamp( $widgetName, &$widgetTimestamp, &$smarty_obj ) { |
| 213 | + $widgetTitle = Title::newFromText( $widgetName, NS_WIDGET ); |
| 214 | + if ($widgetTitle && $widgetTitle->exists()) { |
| 215 | + $widgetArticle = new Article( $widgetTitle, 0 ); |
| 216 | + $widgetTimestamp = $widgetArticle->getTouched(); |
| 217 | + |
| 218 | + return true; |
| 219 | + } else { |
| 220 | + return false; |
| 221 | + } |
| 222 | +} |
| 223 | + |
| 224 | +function wiki_get_secure( $tpl_name, &$smarty_obj ) { |
| 225 | + // assume all templates are secure |
| 226 | + return true; |
| 227 | +} |
| 228 | + |
| 229 | +function wiki_get_trusted( $tpl_name, &$smarty_obj ) { |
| 230 | + // not used for templates |
| 231 | +} |
| 232 | + |
Property changes on: tags/extensions/Widgets/REL_0_8_7/Widgets.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 233 | + native |
Index: tags/extensions/Widgets/REL_0_8_7/Makefile |
— | — | @@ -0,0 +1,25 @@ |
| 2 | +all: |
| 3 | + |
| 4 | +rel: release |
| 5 | +release: |
| 6 | +ifndef v |
| 7 | + # Must specify version as 'v' param |
| 8 | + # |
| 9 | + # make rel v=1.1.1 |
| 10 | + # |
| 11 | +else |
| 12 | + # |
| 13 | + # Tagging it with release tag |
| 14 | + # |
| 15 | + svn copy . svn+ssh://sergeychernyshev@svn.wikimedia.org/svnroot/mediawiki/tags/extensions/Widgets/REL_${subst .,_,${v}}/ |
| 16 | + # |
| 17 | + # Creating release tarball and zip |
| 18 | + # |
| 19 | + svn export . Widgets |
| 20 | + svn export smarty Widgets/smarty |
| 21 | + # Not including Makefile into the package since it's not doing anything but release packaging |
| 22 | + rm Widgets/Makefile |
| 23 | + tar -c Widgets |gzip > Widgets_${v}.tgz |
| 24 | + zip -r Widgets_${v}.zip Widgets |
| 25 | + rm -rf Widgets |
| 26 | +endif |
Property changes on: tags/extensions/Widgets/REL_0_8_7/Makefile |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 27 | + native |
Property changes on: tags/extensions/Widgets/REL_0_8_7 |
___________________________________________________________________ |
Name: svn:externals |
2 | 28 | + smarty http://smarty-php.googlecode.com/svn/tags/Smarty_2_6_18/libs/ |