From 42e81b51b978838c3c59daa6eca24a8f0b1737fc Mon Sep 17 00:00:00 2001 From: toniher Date: Thu, 20 Oct 2016 13:42:14 +0200 Subject: [PATCH] handling types and version --- SMWParent.i18n.magic.php | 7 +++---- SMWParent.php | 2 +- extension.json | 3 ++- includes/SMWParent.hooks.php | 2 +- includes/api/SMWParent.api.php | 12 ++++++++++-- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/SMWParent.i18n.magic.php b/SMWParent.i18n.magic.php index 6b4934f..e4805a1 100644 --- a/SMWParent.i18n.magic.php +++ b/SMWParent.i18n.magic.php @@ -4,9 +4,8 @@ /** English (English) */ $magicWords['en'] = array( - 'SMWParent' => array( 0, 'SMWParent' ), - 'SMWChildren' => array( 0, 'SMWChildren' ), - 'SMWTree' => array( 0, 'SMWTree' ), - 'SMWEntityIterate' => array( 0, 'SMWEntityIterate' ) + 'SMWParent' => array( 0, 'SMWParent' ), + 'SMWChildren' => array( 0, 'SMWChildren' ), + 'SMWTree' => array( 0, 'SMWTree' ) ); diff --git a/SMWParent.php b/SMWParent.php index 4218800..6dddd0b 100644 --- a/SMWParent.php +++ b/SMWParent.php @@ -20,7 +20,7 @@ 'author' => array( '[https://www.mediawiki.org/wiki/User:Toniher Toni Hermoso]' ), - 'version' => '0.1', + 'version' => '0.2.0', 'url' => 'https://www.mediawiki.org/wiki/Extension:SMWParent', 'descriptionmsg' => 'smwparent-desc', ); diff --git a/extension.json b/extension.json index 3cc995a..c550b99 100644 --- a/extension.json +++ b/extension.json @@ -16,7 +16,8 @@ "wgSMWParentdefault": "Request", "wgSMWChildrendefault": "File", "wgSMWParentTypeProperty": ["Is_Type"], - "wgSMWParentProps": ["Comes_from_Process", "Comes_from_Sample", "Has_Request"] + "wgSMWParentProps": ["Comes_from_Process", "Comes_from_Sample", "Has_Request"], + "wgSMWParentPrintProps": [] }, "ExtensionMessagesFiles": { "SMWParentMagic": "SMWParent.i18n.magic.php" diff --git a/includes/SMWParent.hooks.php b/includes/SMWParent.hooks.php index 6c9db81..26481c1 100644 --- a/includes/SMWParent.hooks.php +++ b/includes/SMWParent.hooks.php @@ -6,7 +6,7 @@ public static function onParserFirstCallInit( $parser ) { $parser->setFunctionHook( 'SMWParent', 'SMWParentParser::parseParent', Parser::SFH_OBJECT_ARGS ); $parser->setFunctionHook( 'SMWChildren', 'SMWParentParser::parseChildren', Parser::SFH_OBJECT_ARGS ); - $parser->setFunctionHook( 'SMWTree', 'SMWParentParser::parseTree', Parser::SFH_OBJECT_ARGS ); + // $parser->setFunctionHook( 'SMWTree', 'SMWParentParser::parseTree', Parser::SFH_OBJECT_ARGS ); Disabled for now // Always return true from this function. The return value does not denote // success or otherwise have meaning - it just must always be true. diff --git a/includes/api/SMWParent.api.php b/includes/api/SMWParent.api.php index beaf5f3..0ed8d74 100644 --- a/includes/api/SMWParent.api.php +++ b/includes/api/SMWParent.api.php @@ -14,8 +14,16 @@ public function execute() { $input = array(); $input['child_text'] = $params['title']; $input['parent_text'] = $params['title']; - $input['parent_type'] = $params['type']; - $input['children_type'] = $params['type']; + + // If type has ',' + $types = explode( ",", $params['type'] ); + if ( count( $types ) > 1 ) { + $input['parent_type'] = $types[0]; + $input['children_type'] = $types[1]; + } else { + $input['parent_type'] = $types[0]; + $input['children_type'] = $types[0]; + } $input['link_properties'] = $wgSMWParentProps; $input['type_properties'] = $wgSMWParentTypeProperty;