http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89048

Revision: 89048
Author:   jeroendedauw
Date:     2011-05-28 17:32:17 +0000 (Sat, 28 May 2011)
Log Message:
-----------
work on adding spark tag

Modified Paths:
--------------
    trunk/extensions/Spark/Spark.php

Added Paths:
-----------
    trunk/extensions/Spark/Spark.class.php
    trunk/extensions/Spark/Spark.hooks.php

Added: trunk/extensions/Spark/Spark.class.php
===================================================================
--- trunk/extensions/Spark/Spark.class.php                              (rev 0)
+++ trunk/extensions/Spark/Spark.class.php      2011-05-28 17:32:17 UTC (rev 
89048)
@@ -0,0 +1,24 @@
+<?php
+
+/**
+ * Static class for hooks handled by the Spark extension.
+ * 
+ * @since 0.1
+ * 
+ * @file Spark.hooks.php
+ * @ingroup Spark
+ * 
+ * @licence GNU GPL v3+
+ * @author Jeroen De Dauw < [email protected] >
+ */
+final class SparkTag {
+       
+       public function __construct( array $args, $input ) {
+               // TODO
+       }
+       
+       public function render() {
+               return ''; // TODO
+       }
+       
+}
\ No newline at end of file


Property changes on: trunk/extensions/Spark/Spark.class.php
___________________________________________________________________
Added: svn:eol-style
   + native

Added: trunk/extensions/Spark/Spark.hooks.php
===================================================================
--- trunk/extensions/Spark/Spark.hooks.php                              (rev 0)
+++ trunk/extensions/Spark/Spark.hooks.php      2011-05-28 17:32:17 UTC (rev 
89048)
@@ -0,0 +1,43 @@
+<?php
+
+/**
+ * Static class for hooks handled by the Spark extension.
+ * 
+ * @since 0.1
+ * 
+ * @file Spark.hooks.php
+ * @ingroup Spark
+ * 
+ * @licence GNU GPL v3+
+ * @author Jeroen De Dauw < [email protected] >
+ */
+final class SparkHooks {
+       
+       /**
+        * Register the spark tag extension when the parser initializes.
+        * 
+        * @since 0.1
+        * 
+        * @param Parser $parser
+        * 
+        * @return true
+        */
+       public static function onParserFirstCallInit( Parser &$parser ) {
+               $parser->setHook( 'spark', __CLASS__ . '::onSparkRender' );
+               return true;
+       }
+       
+       /**
+        * @since 0.1
+        * 
+        * @param mixed $input
+        * @param array $args
+        * @param Parser $parser
+        * @param PPFrame $frame
+        */
+       public static function onSparkRender( $input, array $args, Parser 
$parser, PPFrame $frame ) {
+               $tag = new SparkTag( $args, $input );
+               return $tag->render();
+       }
+       
+}
\ No newline at end of file


Property changes on: trunk/extensions/Spark/Spark.hooks.php
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: trunk/extensions/Spark/Spark.php
===================================================================
--- trunk/extensions/Spark/Spark.php    2011-05-28 17:18:50 UTC (rev 89047)
+++ trunk/extensions/Spark/Spark.php    2011-05-28 17:32:17 UTC (rev 89048)
@@ -45,4 +45,18 @@
 
 $wgExtensionMessagesFiles['Spark'] = dirname( __FILE__ ) . '/Spark.i18n.php';
 
+$wgAutoloadClasses['SparkHooks'] = dirname( __FILE__ ) . '/Spark.hooks.php';
+$wgAutoloadClasses['SparkTag'] = dirname( __FILE__ ) . '/Spark.class.php';
+
+$wgResourceModules['ext.spark'] = array(
+       'localBasePath' => dirname( __FILE__ ),
+       'remoteBasePath' => $egSparkScriptPath,
+       'styles' => array(),
+       'scripts' => array( 'rdf-spark/jquery.spark.js' ),
+       'dependencies' => array(),
+       'messages' => array()
+);
+
+$wgHooks['ParserFirstCallInit'][] = 'SparkHooks::onParserFirstCallInit';
+
 require_once 'Spark.settings.php';
\ No newline at end of file


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to