1
0
mirror of https://github.com/owncloud/bookmarks.git synced 2025-01-19 15:52:10 +01:00

Search: Change provider registration to class name, for lazy loading of search providers

This commit is contained in:
Bart Visscher 2012-03-01 22:58:44 +01:00
parent e931a70d3f
commit 1efdb4fc95
2 changed files with 4 additions and 6 deletions

View File

@ -8,6 +8,7 @@
*/ */
OC::$CLASSPATH['OC_Bookmarks_Bookmarks'] = 'apps/bookmarks/lib/bookmarks.php'; OC::$CLASSPATH['OC_Bookmarks_Bookmarks'] = 'apps/bookmarks/lib/bookmarks.php';
OC::$CLASSPATH['OC_Search_Provider_Bookmarks'] = 'apps/bookmarks/lib/search.php';
OC_App::register( array( 'order' => 70, 'id' => 'bookmark', 'name' => 'Bookmarks' )); OC_App::register( array( 'order' => 70, 'id' => 'bookmark', 'name' => 'Bookmarks' ));
@ -15,5 +16,5 @@ $l = new OC_l10n('bookmarks');
OC_App::addNavigationEntry( array( 'id' => 'bookmarks_index', 'order' => 70, 'href' => OC_Helper::linkTo( 'bookmarks', 'index.php' ), 'icon' => OC_Helper::imagePath( 'bookmarks', 'bookmarks.png' ), 'name' => $l->t('Bookmarks'))); OC_App::addNavigationEntry( array( 'id' => 'bookmarks_index', 'order' => 70, 'href' => OC_Helper::linkTo( 'bookmarks', 'index.php' ), 'icon' => OC_Helper::imagePath( 'bookmarks', 'bookmarks.png' ), 'name' => $l->t('Bookmarks')));
OC_App::registerPersonal('bookmarks', 'settings'); OC_App::registerPersonal('bookmarks', 'settings');
require_once('apps/bookmarks/lib/search.php');
OC_Util::addScript('bookmarks','bookmarksearch'); OC_Util::addScript('bookmarks','bookmarksearch');
OC_Search::registerProvider('OC_Search_Provider_Bookmarks');

View File

@ -20,8 +20,8 @@
* *
*/ */
class OC_Search_Provider_Bookmarks extends OC_Search_Provider{ class OC_Search_Provider_Bookmarks implements OC_Search_Provider{
function search($query){ static function search($query){
$results=array(); $results=array();
$offset = 0; $offset = 0;
@ -45,6 +45,3 @@ class OC_Search_Provider_Bookmarks extends OC_Search_Provider{
return $results; return $results;
} }
} }
new OC_Search_Provider_Bookmarks();
?>