diff --git a/Snippet.api.php b/Snippet.api.php index 23d605b..208da71 100644 --- a/Snippet.api.php +++ b/Snippet.api.php @@ -1,52 +1,52 @@ getMain()->getVal('set'); - $title = BricksetSnippet::getTitle( $set ); + $title = Snippet::getTitle( $set ); if ( $title ) { $page = new WikiPage( $title ); $content = $page->getContent()->getNativeData(); - $snippet = BricksetSnippet::parseText( $content ); + $snippet = Snippet::parseText( $content ); $result = array( 'url' => $title->getFullURL(), 'snippet' => $snippet, ); $this->getResult()->addValue( null, $this->getModuleName(), $result ); } return true; } public function getDescription() { - return 'An API action returning a snippet of a page from a Brickset search.'; + return 'An API action returning a snippet of a page from a search.'; } public function getAllowedParams() { return array( 'set' => array ( ApiBase::PARAM_TYPE => 'string', ApiBase::PARAM_REQUIRED => true ), ); } public function getParamDescription() { return array( 'set' => 'The set to search for', ); } public function getExamples() { return array( - 'api.php?action=bricksetsnippet&set=7965-1:%20Millennium%20Falcon' => 'Get the description for 7965-1: Millennium Falcon' + 'api.php?action=snippet&set=7965-1:%20Millennium%20Falcon' => 'Get the description for 7965-1: Millennium Falcon' ); } } \ No newline at end of file diff --git a/Snippet.body.php b/Snippet.body.php index edf7edf..03fdb96 100644 --- a/Snippet.body.php +++ b/Snippet.body.php @@ -1,53 +1,53 @@ /', '', $text ); // remove html elements $text = preg_replace( '/{{[^{]+?}}/', '', $text ); // remove 3rd layer templates $text = preg_replace( '/{{[^{]+?}}/', '', $text ); // remove 2nd layer templates $text = preg_replace( '/{{[^{]+?}}/', '', $text ); // remove 1st layer templates $text = trim( $text ); return $text; } /** * Get the title object for the given search data, or false if none found * * @param String $search: article to search for * @return Title|boolean: title if found OR false if none found */ static function getTitle( $search ) { $engine = SearchEngine::create(); $results = $engine->searchTitle( $search ); if ( $results->numRows() ) { $result = $results->next(); return $result->getTitle(); } else { return false; } } } \ No newline at end of file diff --git a/Snippet.i18n.php b/Snippet.i18n.php index 7e96c32..0f2dac8 100644 --- a/Snippet.i18n.php +++ b/Snippet.i18n.php @@ -1,7 +1,7 @@ "An API extension returning a snippet of a page from a Brickset search" + 'snippet-desc' => "An API extension returning a snippet of a page from a search" ); \ No newline at end of file diff --git a/Snippet.php b/Snippet.php index 159a8f2..502fa39 100644 --- a/Snippet.php +++ b/Snippet.php @@ -1,17 +1,17 @@ __FILE__, - 'name' => 'BricksetSnippet', - 'descriptionmsg' => 'bricksetsnippet-desc', + 'name' => 'Snippet', + 'descriptionmsg' => 'snippet-desc', 'version' => '1.0', 'author' => 'UltrasonicNXT/Adam Carter', - 'url' => 'https://github.com/Brickimedia/BricksetSnippet', + 'url' => 'https://github.com/Brickimedia/Snippet', ); -$wgAutoloadClasses['BricksetSnippetAPI'] = __DIR__ . '/BricksetSnippet.api.php'; -$wgAutoloadClasses['BricksetSnippet'] = __DIR__ . '/BricksetSnippet.body.php'; +$wgAutoloadClasses['SnippetAPI'] = __DIR__ . '/Snippet.api.php'; +$wgAutoloadClasses['Snippet'] = __DIR__ . '/Snippet.body.php'; -$wgAPIModules['bricksetsnippet'] = 'BricksetSnippetAPI'; +$wgAPIModules['snippet'] = 'SnippetAPI'; -$wgExtensionMessagesFiles['BricksetSnippet'] = __DIR__ . '/BricksetSnippet.i18n.php'; \ No newline at end of file +$wgExtensionMessagesFiles['Snippet'] = __DIR__ . '/Snippet.i18n.php'; \ No newline at end of file