dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8603d0a
)
ParserFunctions are now set using magic words; backwards compatibility is retained.
author
Rotem Liss
<rotem@users.mediawiki.org>
Sun, 25 Jun 2006 21:24:14 +0000
(21:24 +0000)
committer
Rotem Liss
<rotem@users.mediawiki.org>
Sun, 25 Jun 2006 21:24:14 +0000
(21:24 +0000)
includes/Parser.php
patch
|
blob
|
history
diff --git
a/includes/Parser.php
b/includes/Parser.php
index
e6ebb46
..
cf692c9
100644
(file)
--- a/
includes/Parser.php
+++ b/
includes/Parser.php
@@
-2845,6
+2845,17
@@
class Parser
$colonPos = strpos( $part1, ':' );
if ( $colonPos !== false ) {
$function = strtolower( substr( $part1, 1, $colonPos - 1 ) );
$colonPos = strpos( $part1, ':' );
if ( $colonPos !== false ) {
$function = strtolower( substr( $part1, 1, $colonPos - 1 ) );
+ if ( !isset( $this->mFunctionHooks[$function] ) ) {
+ foreach ($this->mFunctionHooks as $key => $value) {
+ if( is_int( $key ) ) {
+ $mwExtension =& MagicWord::get( $key );
+ if( $mwExtension->matchVariableStartToEnd( $function ) ) {
+ $function = $key;
+ break;
+ }
+ }
+ }
+ }
if ( isset( $this->mFunctionHooks[$function] ) ) {
$funcArgs = array_map( 'trim', $args );
$funcArgs = array_merge( array( &$this, trim( substr( $part1, $colonPos + 1 ) ) ), $funcArgs );
if ( isset( $this->mFunctionHooks[$function] ) ) {
$funcArgs = array_map( 'trim', $args );
$funcArgs = array_merge( array( &$this, trim( substr( $part1, $colonPos + 1 ) ) ), $funcArgs );
@@
-3883,15
+3894,17
@@
class Parser
*
* @public
*
*
* @public
*
- * @param
string $name T
he function name. Function names are case-insensitive.
+ * @param
mixed $id The magic word ID, or (deprecated) t
he function name. Function names are case-insensitive.
* @param mixed $callback The callback function (and object) to use
*
* @return The old callback function for this name, if any
*/
* @param mixed $callback The callback function (and object) to use
*
* @return The old callback function for this name, if any
*/
- function setFunctionHook( $name, $callback ) {
- $name = strtolower( $name );
- $oldVal = @$this->mFunctionHooks[$name];
- $this->mFunctionHooks[$name] = $callback;
+ function setFunctionHook( $id, $callback ) {
+ if( is_string( $id ) ) {
+ $id = strtolower( $id );
+ }
+ $oldVal = @$this->mFunctionHooks[$id];
+ $this->mFunctionHooks[$id] = $callback;
return $oldVal;
}
return $oldVal;
}