/** * remove an existing search provider * @param string $provider class name of a OC_Search_Provider */ public static function removeProvider($provider) { self::$registeredProviders = array_filter(self::$registeredProviders, function ($element) use($provider) { return $element['class'] != $provider; }); // force regeneration of providers on next search self::$providers = array(); }
// FIXME: this is temporarily static because core emitters are not future // proof, therefore legacy code in here \OCP\Util::connectHook(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_post_write, 'OCA\\Music\\Hooks\\File', 'updated'); \OCP\Util::connectHook(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_delete, 'OCA\\Music\\Hooks\\File', 'deleted'); \OCP\Util::connectHook('OCP\\Share', 'post_unshare', 'OCA\\Music\\Hooks\\Share', 'itemUnshared'); // TODO: disabled because it can delay the share a lot /* \OCP\Util::connectHook( 'OCP\Share', 'post_shared', 'OCA\Music\Hooks\Share', 'itemShared' ); */ /** * register search provider */ \OC_Search::registerProvider('OCA\\Music\\Utility\\Search'); /** * register settings */ \OCP\App::registerPersonal($c->query('AppName'), 'settings/user'); /** * load styles and scripts */ $appName = $c->query('AppName'); if (version_compare(implode('.', \OCP\Util::getVersion()), '7.8', '<=')) { // fileactions $c->query('API')->addScript('public/fileactions', $appName); // file player for public sharing page $c->query('API')->addScript('public/musicFilePlayer', $appName); } else { // fileactions
public function __construct() { OC_Search::registerProvider($this); }
<?php require_once __DIR__ . '/bootstrap.php'; OCP\App::addNavigationEntry(array('id' => 'contacts_index', 'order' => 10, 'href' => OCP\Util::linkTo('contacts', 'index.php'), 'icon' => OCP\Util::imagePath('contacts', 'contacts.svg'), 'name' => OC_L10N::get('contacts')->t('Contacts'))); OCP\Util::addscript('contacts', 'loader'); OC_Search::registerProvider('OCA\\Contacts\\SearchProvider'); if (OCP\User::isLoggedIn()) { foreach (OCA\Contacts\Addressbook::all(OCP\USER::getUser()) as $addressbook) { OCP\Contacts::registerAddressBook(new OCA\Contacts\AddressbookProvider($addressbook['id'])); } }
<?php /** * ownCloud - News app * * @author Alessandro Cosentino * Copyright (c) 2012 - Alessandro Cosentino <*****@*****.**> * * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file * */ OC::$CLASSPATH['OCA\\News\\StatusFlag'] = 'apps/news/lib/item.php'; OC::$CLASSPATH['OCA\\News\\Item'] = 'apps/news/lib/item.php'; OC::$CLASSPATH['OCA\\News\\Collection'] = 'apps/news/lib/collection.php'; OC::$CLASSPATH['OCA\\News\\Feed'] = 'apps/news/lib/feed.php'; OC::$CLASSPATH['OCA\\News\\Folder'] = 'apps/news/lib/folder.php'; OC::$CLASSPATH['OCA\\News\\FeedType'] = 'apps/news/lib/feedtypes.php'; OC::$CLASSPATH['OCA\\News\\FeedMapper'] = 'apps/news/lib/feedmapper.php'; OC::$CLASSPATH['OCA\\News\\ItemMapper'] = 'apps/news/lib/itemmapper.php'; OC::$CLASSPATH['OCA\\News\\FolderMapper'] = 'apps/news/lib/foldermapper.php'; OC::$CLASSPATH['OCA\\News\\Utils'] = 'apps/news/lib/utils.php'; OC::$CLASSPATH['OC_Search_Provider_News'] = 'apps/news/lib/search.php'; OC::$CLASSPATH['OCA\\News\\Backgroundjob'] = 'apps/news/lib/backgroundjob.php'; OCP\Backgroundjob::addRegularTask('OCA\\News\\Backgroundjob', 'run'); OC::$CLASSPATH['OCA\\News\\Share_Backend_News_Item'] = 'apps/news/lib/share/item.php'; OCP\App::addNavigationEntry(array('id' => 'news', 'order' => 74, 'href' => OC_Helper::linkTo('news', 'index.php'), 'icon' => OC_Helper::imagePath('news', 'icon.svg'), 'name' => OC_L10N::get('news')->t('News'))); OC_Search::registerProvider('OC_Search_Provider_News'); OCP\Share::registerBackend('news_item', 'OCA\\News\\Share_Backend_News_Item');
/** * remove all registered search providers */ public static function clearProviders() { self::$providers = array(); self::$registeredProviders = array(); }
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see <http://www.gnu.org/ * */ $l = OC_L10N::get('media'); OC::$CLASSPATH['OCA\\Media\\Media'] = 'media/lib/media.php'; OC::$CLASSPATH['OCA\\Media\\Ampache'] = 'media/lib/ampache.php'; OC::$CLASSPATH['OCA\\Media\\SearchProvider'] = 'media/lib/media.php'; OC::$CLASSPATH['OCA\\Media\\Collection'] = 'media/lib/collection.php'; OC::$CLASSPATH['OCA\\Media\\Scanner'] = 'media/lib/scanner.php'; OC::$CLASSPATH['OCA\\Media\\Extractor'] = 'media/lib/extractor.php'; OC::$CLASSPATH['OCA\\Media\\Extractor_GetID3'] = 'media/lib/extractor.php'; OC::$CLASSPATH['OCA\\Media\\Extractable'] = 'media/lib/track.php'; OC::$CLASSPATH['OCA\\Media\\Track'] = 'media/lib/track.php'; //we need to have the sha256 hash of passwords for ampache OCP\Util::connectHook('OC_User', 'post_login', 'OCA\\Media\\Media', 'loginListener'); OCP\Util::connectHook('OC_User', 'post_setPassword', 'OCA\\Media\\Media', 'passwordChangeListener'); //connect to the filesystem for auto updating OCP\Util::connectHook('OC_Filesystem', 'post_write', 'OCA\\Media\\Media', 'updateFile'); //listen for file deletions to clean the database if a song is deleted OCP\Util::connectHook('OC_Filesystem', 'post_delete', 'OCA\\Media\\Media', 'deleteFile'); //list for file moves to update the database OCP\Util::connectHook('OC_Filesystem', 'post_rename', 'OCA\\Media\\Media', 'moveFile'); OCP\App::registerPersonal('media', 'settings'); OCP\App::addNavigationEntry(array('id' => 'media_index', 'order' => 2, 'href' => OCP\Util::linkTo('media', 'index.php'), 'icon' => OCP\Util::imagePath('core', 'places/music.svg'), 'name' => $l->t('Music'))); OC_Search::registerProvider('OCA\\Media\\SearchProvider');
//add 3rdparty folder to include path $dir = dirname(dirname(__FILE__)) . '/3rdparty'; set_include_path(get_include_path() . PATH_SEPARATOR . $dir); OC::$CLASSPATH['OCA\\Search_Lucene\\Lucene'] = 'search_lucene/lib/lucene.php'; OC::$CLASSPATH['OCA\\Search_Lucene\\Indexer'] = 'search_lucene/lib/indexer.php'; OC::$CLASSPATH['OCA\\Search_Lucene\\Hooks'] = 'search_lucene/lib/hooks.php'; OC::$CLASSPATH['Zend_Search_Lucene'] = 'apps/search_lucene/3rdparty/Zend/Search/Lucene.php'; OC::$CLASSPATH['Zend_Search_Lucene_Index_Term'] = 'apps/search_lucene/3rdparty/Zend/Search/Lucene/Index/Term.php'; OC::$CLASSPATH['Zend_Search_Lucene_Search_Query_Term'] = 'apps/search_lucene/3rdparty/Zend/Search/Lucene/Search/Query/Term.php'; OC::$CLASSPATH['Zend_Search_Lucene_Field'] = 'apps/search_lucene/3rdparty/Zend/Search/Lucene/Field.php'; OC::$CLASSPATH['Zend_Search_Lucene_Document'] = 'apps/search_lucene/3rdparty/Zend/Search/Lucene/Document.php'; OC::$CLASSPATH['Zend_Search_Lucene_Document_Html'] = 'apps/search_lucene/3rdparty/Zend/Search/Lucene/Document/Html.php'; OC::$CLASSPATH['Zend_Search_Lucene_Analysis_Analyzer'] = 'apps/search_lucene/3rdparty/Zend/Search/Lucene/Analysis/Analyzer.php'; OC::$CLASSPATH['getID3'] = 'getid3/getid3.php'; OC::$CLASSPATH['App_Search_Helper_PdfParser'] = 'apps/search_lucene/3rdparty/pdf2text.php'; OC::$CLASSPATH['Zend_Pdf'] = 'apps/search_lucene/3rdparty/Zend/Pdf.php'; // --- always add js & css ----------------------------------------------- OCP\Util::addScript('search_lucene', 'checker'); OCP\Util::addStyle('search_lucene', 'lucene'); // --- replace default file search provider ----------------------------------------------- //remove other providers OC_Search::removeProvider('OC_Search_Provider_File'); OC_Search::registerProvider('OCA\\Search_Lucene\\Lucene'); // --- add hooks ----------------------------------------------- //post_create is ignored, as write will be triggered afterwards anyway //connect to the filesystem for auto updating OCP\Util::connectHook(OC\Files\Filesystem::CLASSNAME, OC\Files\Filesystem::signal_post_write, 'OCA\\Search_Lucene\\Hooks', OCA\Search_Lucene\Hooks::handle_post_write); //connect to the filesystem for renaming OCP\Util::connectHook(OC\Files\Filesystem::CLASSNAME, OC\Files\Filesystem::signal_post_rename, 'OCA\\Search_Lucene\\Hooks', OCA\Search_Lucene\Hooks::handle_post_rename); //listen for file deletions to clean the database OCP\Util::connectHook(OC\Files\Filesystem::CLASSNAME, OC\Files\Filesystem::signal_delete, 'OCA\\Search_Lucene\\Hooks', OCA\Search_Lucene\Hooks::handle_delete);
<?php $l = OC_L10N::get('files'); OCP\App::registerAdmin('files', 'admin'); OCP\App::addNavigationEntry(array("id" => "files_index", "order" => 0, "href" => OCP\Util::linkTo("files", "index.php"), "icon" => OCP\Util::imagePath("core", "places/files.png"), "name" => $l->t("Files"))); OC_Search::registerProvider('OC_Search_Provider_File'); // cache hooks must be connected before all other apps. // since 'files' is always loaded first the hooks need to be connected here \OC_Hook::connect('OC_Filesystem', 'post_write', '\\OC\\Files\\Cache\\Updater', 'writeHook'); \OC_Hook::connect('OC_Filesystem', 'post_touch', '\\OC\\Files\\Cache\\Updater', 'touchHook'); \OC_Hook::connect('OC_Filesystem', 'post_delete', '\\OC\\Files\\Cache\\Updater', 'deleteHook'); \OC_Hook::connect('OC_Filesystem', 'post_rename', '\\OC\\Files\\Cache\\Updater', 'renameHook'); \OCP\BackgroundJob::addRegularTask('\\OC\\Files\\Cache\\BackgroundWatcher', 'checkNext'); $templateManager = OC_Helper::getFileTemplateManager(); $templateManager->registerTemplate('text/html', 'core/templates/filetemplates/template.html'); $templateManager->registerTemplate('application/vnd.oasis.opendocument.presentation', 'core/templates/filetemplates/template.odp'); $templateManager->registerTemplate('application/vnd.oasis.opendocument.text', 'core/templates/filetemplates/template.odt'); $templateManager->registerTemplate('application/vnd.oasis.opendocument.spreadsheet', 'core/templates/filetemplates/template.ods');
<?php $l = OC_L10N::get('calendar'); OC::$CLASSPATH['OC_Calendar_App'] = 'apps/calendar/lib/app.php'; OC::$CLASSPATH['OC_Calendar_Calendar'] = 'apps/calendar/lib/calendar.php'; OC::$CLASSPATH['OC_Calendar_Object'] = 'apps/calendar/lib/object.php'; OC::$CLASSPATH['OC_Calendar_Hooks'] = 'apps/calendar/lib/hooks.php'; OC::$CLASSPATH['OC_Connector_Sabre_CalDAV'] = 'apps/calendar/lib/connector_sabre.php'; OC::$CLASSPATH['OC_Calendar_Share'] = 'apps/calendar/lib/share.php'; OC::$CLASSPATH['OC_Search_Provider_Calendar'] = 'apps/calendar/lib/search.php'; OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Calendar_Hooks', 'deleteUser'); OCP\Util::addscript('calendar', 'loader'); OCP\Util::addscript("3rdparty", "chosen/chosen.jquery.min"); OCP\Util::addStyle("3rdparty", "chosen/chosen"); OCP\App::register(array('order' => 10, 'id' => 'calendar', 'name' => 'Calendar')); OCP\App::addNavigationEntry(array('id' => 'calendar_index', 'order' => 10, 'href' => OCP\Util::linkTo('calendar', 'index.php'), 'icon' => OCP\Util::imagePath('calendar', 'icon.svg'), 'name' => $l->t('Calendar'))); OCP\App::registerPersonal('calendar', 'settings'); OC_Search::registerProvider('OC_Search_Provider_Calendar');
<?php /** * ownCloud - Activity App * * @author Frank Karlitschek * @copyright 2013 Frank Karlitschek frank@owncloud.org * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * License as published by the Free Software Foundation; either * version 3 of the License, or any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. * */ // add an navigation entry $l = OC_L10N::get('activity'); OCP\App::addNavigationEntry(array('id' => 'activity', 'order' => 1, 'href' => OCP\Util::linkTo('activity', 'index.php'), 'icon' => OCP\Util::imagePath('activity', 'activity.svg'), 'name' => $l->t('Activity'))); // register the hooks for filesystem operations. All other events from other apps has to be send via the public api OCA\Activity\Hooks::register(); OC_Search::registerProvider('\\OCA\\Activity\\Search');
/** * ownCloud * * @author Robin Appelman * @copyright 2010 Robin Appelman icewind1991@gmail.com * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * License as published by the Free Software Foundation; either * version 3 of the License, or any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. * * You should have received a copy of the GNU Affero General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. * */ // Check if we are a user OC_JSON::checkLoggedIn(); OC_App::loadApps(); $query = isset($_GET['query']) ? $_GET['query'] : ''; if ($query) { $result = OC_Search::search($query); OC_JSON::encodedPrint($result); } else { echo 'false'; }
<?php /** * Copyright (c) 2011 Marvin Thomas Rabe <*****@*****.**> * Copyright (c) 2011 Arthur Schiwon <*****@*****.**> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ OC::$CLASSPATH['OC_Bookmarks_Bookmarks'] = 'apps/bookmarks/lib/bookmarks.php'; OC::$CLASSPATH['OC_Search_Provider_Bookmarks'] = 'apps/bookmarks/lib/search.php'; OCP\App::register(array('order' => 70, 'id' => 'bookmark', 'name' => 'Bookmarks')); $l = new OC_l10n('bookmarks'); OCP\App::addNavigationEntry(array('id' => 'bookmarks_index', 'order' => 70, 'href' => OCP\Util::linkTo('bookmarks', 'index.php'), 'icon' => OCP\Util::imagePath('bookmarks', 'bookmarks.png'), 'name' => $l->t('Bookmarks'))); OCP\App::registerPersonal('bookmarks', 'settings'); OCP\Util::addscript('bookmarks', 'bookmarksearch'); OC_Search::registerProvider('OC_Search_Provider_Bookmarks');
<?php OC::$CLASSPATH['OC_ReaderSearchProvider'] = 'apps/reader/lib/search.php'; OCP\App::register(array('order' => 20, 'id' => 'reader', 'name' => 'reader')); OCP\App::addNavigationEntry(array('id' => 'reader_index', 'order' => 20, 'href' => OCP\Util::linkTo('reader', 'index.php'), 'icon' => OCP\Util::imagePath('reader', 'reader.png'), 'name' => 'Reader')); OC_Search::registerProvider('OC_ReaderSearchProvider');
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * License as published by the Free Software Foundation; either * version 3 of the License, or any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see <http://www.gnu.org/ * */ $l = OC_L10N::get('media'); OC::$CLASSPATH['OC_MEDIA'] = 'media/lib_media.php'; OC::$CLASSPATH['OC_MediaSearchProvider'] = 'media/lib_media.php'; OC::$CLASSPATH['OC_MEDIA_COLLECTION'] = 'media/lib_collection.php'; OC::$CLASSPATH['OC_MEDIA_SCANNER'] = 'media/lib_scanner.php'; //we need to have the sha256 hash of passwords for ampache OCP\Util::connectHook('OC_User', 'post_login', 'OC_MEDIA', 'loginListener'); //connect to the filesystem for auto updating OCP\Util::connectHook('OC_Filesystem', 'post_write', 'OC_MEDIA', 'updateFile'); //listen for file deletions to clean the database if a song is deleted OCP\Util::connectHook('OC_Filesystem', 'post_delete', 'OC_MEDIA', 'deleteFile'); //list for file moves to update the database OCP\Util::connectHook('OC_Filesystem', 'post_rename', 'OC_MEDIA', 'moveFile'); OCP\Util::addscript('media', 'loader'); OCP\App::registerPersonal('media', 'settings'); OCP\App::addNavigationEntry(array('id' => 'media_index', 'order' => 2, 'href' => OCP\Util::linkTo('media', 'index.php'), 'icon' => OCP\Util::imagePath('core', 'places/music.svg'), 'name' => $l->t('Music'))); OC_Search::registerProvider('OC_MediaSearchProvider');
<?php OC::$CLASSPATH['OC_Contacts_App'] = 'apps/contacts/lib/app.php'; OC::$CLASSPATH['OC_Contacts_Addressbook'] = 'apps/contacts/lib/addressbook.php'; OC::$CLASSPATH['OC_Contacts_VCard'] = 'apps/contacts/lib/vcard.php'; OC::$CLASSPATH['OC_Contacts_Hooks'] = 'apps/contacts/lib/hooks.php'; OC::$CLASSPATH['OC_Connector_Sabre_CardDAV'] = 'apps/contacts/lib/connector_sabre.php'; OC::$CLASSPATH['OC_Search_Provider_Contacts'] = 'apps/contacts/lib/search.php'; OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Contacts_Hooks', 'deleteUser'); OCP\Util::connectHook('OC_Calendar', 'getEvents', 'OC_Contacts_Hooks', 'getBirthdayEvents'); OCP\Util::connectHook('OC_Calendar', 'getSources', 'OC_Contacts_Hooks', 'getCalenderSources'); OCP\App::register(array('order' => 10, 'id' => 'contacts', 'name' => 'Contacts')); OCP\App::addNavigationEntry(array('id' => 'contacts_index', 'order' => 10, 'href' => OCP\Util::linkTo('contacts', 'index.php'), 'icon' => OCP\Util::imagePath('settings', 'users.svg'), 'name' => OC_L10N::get('contacts')->t('Contacts'))); OCP\App::registerPersonal('contacts', 'settings'); OCP\Util::addscript('contacts', 'loader'); OC_Search::registerProvider('OC_Search_Provider_Contacts');