wfRunHooks( 'SearchGetNearMatchComplete', array( $searchterm, &$title ) );
return $title;
}
-
+
/**
- * Do a near match (see SearchEngine::getNearMatch) and wrap it into a
+ * Do a near match (see SearchEngine::getNearMatch) and wrap it into a
* SearchResultSet.
- *
+ *
* @param $searchterm string
* @return SearchResultSet
*/
# See if it still otherwise has content is some sane sense
$context->setTitle( $title );
- $article = MediaWiki::articleFromTitle( $title, $context );
+ $article = Article::newFromTitle( $title, $context );
if ( $article->hasViewableContent() ) {
return $title;
}
if ( strncmp( $query, $allkeyword, strlen( $allkeyword ) ) == 0 ) {
$this->namespaces = null;
$parsed = substr( $query, strlen( $allkeyword ) );
- } else if ( strpos( $query, ':' ) !== false ) {
+ } elseif ( strpos( $query, ':' ) !== false ) {
$prefix = substr( $query, 0, strpos( $query, ':' ) );
$index = $wgContLang->getNsIndex( $prefix );
if ( $index !== false ) {
*/
public static function getOpenSearchTemplate() {
global $wgOpenSearchTemplate, $wgServer;
- if ( $wgOpenSearchTemplate ) {
+ if ( $wgOpenSearchTemplate ) {
return $wgOpenSearchTemplate;
} else {
$ns = implode( '|', SearchEngine::defaultNamespaces() );
- if ( !$ns ) $ns = "0";
+ if ( !$ns ) {
+ $ns = "0";
+ }
return $wgServer . wfScript( 'api' ) . '?action=opensearch&search={searchTerms}&namespace=' . $ns;
}
}
$row = $this->mResultSet->fetchObject();
if ( $row === false )
return false;
-
+
return SearchResult::newFromRow( $row );
}
/**
- * @todo Fixme: This class is horribly factored. It would probably be better to
+ * @todo FIXME: This class is horribly factored. It would probably be better to
* have a useful base class to which you pass some standard information, then
* let the fancy self-highlighters extend that.
* @ingroup Search
/**
* Return a new SearchResult and initializes it with a title.
- *
- * @param $title Title
+ *
+ * @param $title Title
* @return SearchResult
*/
public static function newFromTitle( $title ) {
}
/**
* Return a new SearchResult and initializes it with a row.
- *
+ *
* @param $row object
* @return SearchResult
*/
$result->initFromRow( $row );
return $result;
}
-
+
public function __construct( $row = null ) {
if ( !is_null( $row ) ) {
// Backwards compatibility with pre-1.17 callers
$this->initFromRow( $row );
}
}
-
+
/**
* Initialize from a database row. Makes a Title and passes that to
* initFromTitle.
- *
+ *
* @param $row object
*/
protected function initFromRow( $row ) {
$this->initFromTitle( Title::makeTitle( $row->page_namespace, $row->page_title ) );
}
-
+
/**
* Initialize from a Title and if possible initializes a corresponding
* Revision and File.
- *
+ *
* @param $title Title
*/
protected function initFromTitle( $title ) {
function getTimestamp() {
if ( $this->mRevision )
return $this->mRevision->getTimestamp();
- else if ( $this->mImage )
+ elseif ( $this->mImage )
return $this->mImage->getTimestamp();
return '';
}
2 => '/(\[\[)|(\]\])/', // image
3 => "/(\n\\{\\|)|(\n\\|\\})/" ); // table
- // FIXME: this should prolly be a hook or something
+ // @todo FIXME: This should prolly be a hook or something
if ( function_exists( 'wfCite' ) ) {
$spat .= '|(<ref>)'; // references via cite extension
$endPatterns[4] = '/(<ref>)|(<\/ref>)/';
$anyterm = implode( '|', $terms );
$phrase = implode( "$wgSearchHighlightBoundaries+", $terms );
- // FIXME: a hack to scale contextchars, a correct solution
+ // @todo FIXME: A hack to scale contextchars, a correct solution
// would be to have contextchars actually be char and not byte
// length, and do proper utf-8 substrings and lengths everywhere,
// but PHP is making that very hard and unclean to implement :(
/**
* Dummy class to be used when non-supported Database engine is present.
- * @todo Fixme: dummy class should probably try something at least mildly useful,
+ * @todo FIXME: Dummy class should probably try something at least mildly useful,
* such as a LIKE search through titles.
* @ingroup Search
*/