Index: tags/extensions/Variables/REL_1_3_1_1/RELEASE-NOTES |
— | — | @@ -0,0 +1,74 @@ |
| 2 | + svn era Changelog:
|
| 3 | + ==================
|
| 4 | +
|
| 5 | + * November 14, 2011 -- Version 1.3.1.1 (re-pack of 1.3.1 tagged version for svn)
|
| 6 | + - Although 1.4 is released already and 2.0 in the trunk, ensure one last version
|
| 7 | + compatible with MW < 1.12 still is available
|
| 8 | + - Some comments cleaned, 'RELEASE-NOTES' and 'README' files added.
|
| 9 | +
|
| 10 | + * (trunk) -- Version 2.0rc by Daniel Werner
|
| 11 | + Version 2.0 almost is a complete rewrite of the extension, just the idea remains the
|
| 12 | + same. It's the attempt to get rid of several bugs caused by the fact that MediaWiki
|
| 13 | + is using several Parser objects. Therefore in v2 each Parser has its own Variables
|
| 14 | + store, so nothing will get mixed up anymore. Full compatbility is given, except perhaps
|
| 15 | + in cases where bugs were used intentionally.
|
| 16 | +
|
| 17 | + New features and bugfixes:
|
| 18 | + - Inclusion of special pages in the middle of the page won't reset all defined
|
| 19 | + variables anymore.
|
| 20 | + - Variables should now be compatible with all other extensions, except for those still
|
| 21 | + using Parser::parse() recursivelly in any way (which should never be done!).
|
| 22 | + - For MW 1.12 and later, '#var' default value no longer gets expanded when not needed.
|
| 23 | + - Experimental new function '#var_final' which allows to insert the variables final
|
| 24 | + (last) value.
|
| 25 | + - Global configuration variable '$egVariablesDisabledFunctions' added.
|
| 26 | +
|
| 27 | + Internal changes:
|
| 28 | + - Parser class member $mExtVariables now contains an instance of ExtVariables where
|
| 29 | + only variables for that parser are getting stored. They won't be deleted by other
|
| 30 | + Parser actions anymore (e.g. special page inclusion doesn't reset variables anymore)
|
| 31 | + - ExtVariables class now has public functions which should be used by other extensions
|
| 32 | + for getting and setting variables information.
|
| 33 | + - Removed global '$wgExtVariables' variable.
|
| 34 | + - 'Variables_Settings.php' file for configuration settings added.
|
| 35 | +
|
| 36 | + Others:
|
| 37 | + - Put under 'ISC License' (public domain before).
|
| 38 | + - In case you are using Extension:Loops, you should update it as well to remain compatbility.
|
| 39 | +
|
| 40 | + * November 13, 2011 -- Version 1.4 by Daniel Werner
|
| 41 | + - Cleanup for use with more current MW versions:
|
| 42 | + + 'ParserFirstCallInit' hook in use and no more global extension functions.
|
| 43 | + + State of the Art internationalization files added.
|
| 44 | + - Dropped support for MW before 1.12
|
| 45 | + - 'ExtVariables::VARIABLES' constant with version info added.
|
| 46 | + - Put into mediawiki.org svn, 'RELEASE-NOTES' and 'README' files added.
|
| 47 | +
|
| 48 | + Pre svn Changelog:
|
| 49 | + ==================
|
| 50 | +
|
| 51 | + The following pre-svn changelog was composed by Daniel Werner in the hope it might
|
| 52 | + give an almost complete overview of all major releases of 'Variables' extension.
|
| 53 | + All changes can still be retrace at
|
| 54 | +
|
| 55 | + http://www.mediawiki.org/w/index.php?title=Extension:VariablesExtension&action=history
|
| 56 | +
|
| 57 | + * July 20, 2010 -- Version 1.3 by Daniel Werner
|
| 58 | + - Removed critical bug. Some kind of "Superglobal" variables. In some cases values
|
| 59 | + were passed from one page to another page during page imports and job queue jobs.
|
| 60 | +
|
| 61 | + * March 28, 2009 -- Version 1.2 by Daniel Werner
|
| 62 | + - '#varexists' function introduced
|
| 63 | + - parameter for default value for '#var' function in case the variable doesn't exist
|
| 64 | + or its value is just an empty string.
|
| 65 | +
|
| 66 | + * December 5, 2008 -- Version 1.1 by user 'Xiloynaha'
|
| 67 | + - '#vardefineecho' function introduced
|
| 68 | +
|
| 69 | + * June 24, 2007 -- r3, Language file added by unknown contributor
|
| 70 | +
|
| 71 | + * October 11, 2006 -- r2, Fixes for MediaWiki 1.8 compatbility by Tom Hempel
|
| 72 | + - '$wgExtensionCredits' and '$wgHooks' being used.
|
| 73 | +
|
| 74 | + * October 11, 2006 -- r1, initial release by Rob Adams
|
| 75 | + - First version of 'Variables', introducing '#vardefine' and '#var'
|
Index: tags/extensions/Variables/REL_1_3_1_1/Variables.i18n.php |
— | — | @@ -0,0 +1,26 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Get translated magic words, if available |
| 5 | + * |
| 6 | + * @param $lang String: language code |
| 7 | + * @return array |
| 8 | + */ |
| 9 | +function efVariablesWords( $lang ) { |
| 10 | + $words = array(); |
| 11 | + |
| 12 | + /** |
| 13 | + * English |
| 14 | + */ |
| 15 | + $words['en'] = array( |
| 16 | + 'var' => array( 0, 'var' ), |
| 17 | + 'vardefine' => array( 0, 'vardefine' ), |
| 18 | + 'vardefineecho' => array( 0, 'vardefineecho' ), |
| 19 | + 'varexists' => array( 0, 'varexists' ), |
| 20 | + ); |
| 21 | + |
| 22 | + # English is used as a fallback, and the English synonyms are |
| 23 | + # used if a translation has not been provided for a given word |
| 24 | + return ( $lang == 'en' || !isset( $words[$lang] ) ) |
| 25 | + ? $words['en'] |
| 26 | + : array_merge( $words['en'], $words[$lang] ); |
| 27 | +} |
Property changes on: tags/extensions/Variables/REL_1_3_1_1/Variables.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 28 | + native |
Index: tags/extensions/Variables/REL_1_3_1_1/README |
— | — | @@ -0,0 +1,26 @@ |
| 2 | +== About ==
|
| 3 | +
|
| 4 | +The 'Variables' extension for MediaWiki introduces parser functions for defining page-scoped
|
| 5 | +variables within wiki pages.
|
| 6 | +
|
| 7 | +* Website: http://www.mediawiki.org/wiki/Extension:Variables
|
| 8 | +* Authors: Rob Adams, Tom Hempel, Xiloynaha and Daniel Werner
|
| 9 | +* License: Public domain
|
| 10 | +
|
| 11 | +
|
| 12 | +== Installation ==
|
| 13 | +
|
| 14 | +Once you have downloaded the code, place the 'Variables' directory within your
|
| 15 | +MediaWiki 'extensions' directory. Then add the following code to your
|
| 16 | +[[Manual:LocalSettings.php|LocalSettings.php]] file:
|
| 17 | +
|
| 18 | + # Variables
|
| 19 | + require_once( "$IP/extensions/Variables/Variables.php" );
|
| 20 | +
|
| 21 | +
|
| 22 | +== Contributing ==
|
| 23 | +
|
| 24 | +If you have bug reports or feature requests, please add them to the ''Variables''
|
| 25 | +Talk page [0]. You can also send them to Daniel Werner < danweetz@web.de >
|
| 26 | +
|
| 27 | +[0] http://www.mediawiki.org/w/index.php?title=Extension_talk:Variables
|
Index: tags/extensions/Variables/REL_1_3_1_1/Variables.php |
— | — | @@ -0,0 +1,94 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Variables extension -- define page-scoped variables |
| 5 | + * This is a re-pack of 1.3.1 with adjusted comments since Version 2.0 is out |
| 6 | + * already but this is just the last release for MediaWiki wikis below 1.12. |
| 7 | + * So if you use MW 1.12+ use Variables 1.4 for even better 2.0+ wich comes with |
| 8 | + * a major bugfix. |
| 9 | + * |
| 10 | + * @file |
| 11 | + * @ingroup Extensions |
| 12 | + * @version 1.3.1.1 |
| 13 | + * @author Rob Adams |
| 14 | + * @author Tom Hempel |
| 15 | + * @author Xiloynaha |
| 16 | + * @author Daniel Werner < danweetz@web.de > |
| 17 | + * @license Public domain |
| 18 | + * @link http://www.mediawiki.org/wiki/Extension:Variables |
| 19 | + */ |
| 20 | + |
| 21 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 22 | + die( 'This file is a MediaWiki extension, it is not a valid entry point' ); |
| 23 | +} |
| 24 | + |
| 25 | +// Extension credits that will show up on Special:Version |
| 26 | +$wgExtensionCredits['parserhook'][] = array( |
| 27 | + 'path' => __FILE__, |
| 28 | + 'name' => 'Variables', |
| 29 | + 'version' => '1.3.1.1', |
| 30 | + 'author' => array( 'Rob Adams', 'Tom Hempel', 'Xiloynaha', '[http://www.mediawiki.org/wiki/User:Danwe Daniel Werner]' ), |
| 31 | + 'description' => 'Parser functions allowing to work with dynamic variables in an article scoped context', |
| 32 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:VariablesExtension', |
| 33 | +); |
| 34 | + |
| 35 | +// instead of 'ParserFirstCallInit' for <1.12 compatbility. Use Variables 2.0 if you have MW 1.12+ |
| 36 | +$wgExtensionFunctions[] = 'wfSetupVariables'; |
| 37 | + |
| 38 | +$wgHooks['LanguageGetMagic'][] = 'wfVariablesLanguageGetMagic'; |
| 39 | + |
| 40 | + |
| 41 | +class ExtVariables { |
| 42 | + |
| 43 | + var $mVariables = array(); |
| 44 | + |
| 45 | + function __construct() { |
| 46 | + global $wgHooks; |
| 47 | + $wgHooks['ParserClearState'][] = &$this; |
| 48 | + } |
| 49 | + |
| 50 | + function onParserClearState( &$parser ) { |
| 51 | + $this->mVariables = array(); //remove all variables to avoid conflicts with job queue or Special:Import |
| 52 | + return true; |
| 53 | + } |
| 54 | + |
| 55 | + function vardefine( &$parser, $expr = '', $value = '' ) { |
| 56 | + $this->mVariables[$expr] = $value; |
| 57 | + return ''; |
| 58 | + } |
| 59 | + |
| 60 | + function vardefineecho( &$parser, $expr = '', $value = '' ) { |
| 61 | + $this->mVariables[$expr] = $value; |
| 62 | + return $value; |
| 63 | + } |
| 64 | + |
| 65 | + function varf( &$parser, $expr = '', $defaultVal = '' ) { |
| 66 | + if ( isset( $this->mVariables[$expr] ) && $this->mVariables[$expr] != '' ) { |
| 67 | + return $this->mVariables[$expr]; |
| 68 | + } else { |
| 69 | + return $defaultVal; |
| 70 | + } |
| 71 | + } |
| 72 | + |
| 73 | + function varexists( &$parser, $expr = '' ) { |
| 74 | + return array_key_exists( $expr, $this->mVariables ); |
| 75 | + } |
| 76 | +} |
| 77 | + |
| 78 | +function wfSetupVariables() { |
| 79 | + global $wgParser, $wgExtVariables; |
| 80 | + |
| 81 | + $wgExtVariables = new ExtVariables; |
| 82 | + |
| 83 | + $wgParser->setFunctionHook( 'vardefine', array( &$wgExtVariables, 'vardefine' ) ); |
| 84 | + $wgParser->setFunctionHook( 'vardefineecho', array( &$wgExtVariables, 'vardefineecho' ) ); |
| 85 | + $wgParser->setFunctionHook( 'var', array( &$wgExtVariables, 'varf' ) ); |
| 86 | + $wgParser->setFunctionHook( 'varexists', array( &$wgExtVariables, 'varexists' ) ); |
| 87 | +} |
| 88 | + |
| 89 | +function wfVariablesLanguageGetMagic( &$magicWords, $langCode = 0 ) { |
| 90 | + require_once( dirname( __FILE__ ) . '/Variables.i18n.php' ); |
| 91 | + foreach( efVariablesWords( $langCode ) as $word => $trans ) { |
| 92 | + $magicWords[$word] = $trans; |
| 93 | + } |
| 94 | + return true; |
| 95 | +} |
Property changes on: tags/extensions/Variables/REL_1_3_1_1/Variables.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 96 | + native |