diff --git a/Snippet.body.php b/Snippet.body.php index 26c8478..be39fea 100644 --- a/Snippet.body.php +++ b/Snippet.body.php @@ -1,61 +1,62 @@ /', '', $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 = substr( $text, 0, $wgSnippetMaxLength ); // limit to $wgSnippetMaxLength chars $parts = explode( '.', $text ); array_pop( $parts ); // remove anything after the last full stop $text = implode( '.', $parts ) . '.'; $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(); + $engine->setLimitOffset( 1, 0 ); $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.php b/Snippet.php index 78b437c..e24211d 100644 --- a/Snippet.php +++ b/Snippet.php @@ -1,19 +1,19 @@ __FILE__, 'name' => 'Snippet', 'descriptionmsg' => 'snippet-desc', - 'version' => '1.0', + 'version' => '1.1', 'author' => 'UltrasonicNXT/Adam Carter', 'url' => 'https://github.com/Brickimedia/Snippet', ); $wgAutoloadClasses['SnippetAPI'] = __DIR__ . '/Snippet.api.php'; $wgAutoloadClasses['Snippet'] = __DIR__ . '/Snippet.body.php'; $wgAPIModules['snippet'] = 'SnippetAPI'; $wgExtensionMessagesFiles['Snippet'] = __DIR__ . '/Snippet.i18n.php'; $wgSnippetMaxLength = 600; \ No newline at end of file