当前位置: 首页>>代码示例>>PHP>>正文


PHP Share::registerBackend方法代码示例

本文整理汇总了PHP中OCP\Share::registerBackend方法的典型用法代码示例。如果您正苦于以下问题:PHP Share::registerBackend方法的具体用法?PHP Share::registerBackend怎么用?PHP Share::registerBackend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OCP\Share的用法示例。


在下文中一共展示了Share::registerBackend方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
     \OCP\Share::registerBackend('test', 'Test_Share_Backend');
     $config = $this->getMockBuilder('\\OCP\\IConfig')->disableOriginalConstructor()->getMock();
     $certificateManager = $this->getMock('\\OCP\\ICertificateManager');
     $httpHelperMock = $this->getMockBuilder('\\OC\\HTTPHelper')->setConstructorArgs(array($config, $certificateManager))->getMock();
     $httpHelperMock->expects($this->any())->method('post')->with($this->anything())->will($this->returnValue(true));
     $this->registerHttpHelper($httpHelperMock);
     $this->s2s = new \OCA\Files_Sharing\API\Server2Server();
 }
开发者ID:riso,项目名称:owncloud-core,代码行数:12,代码来源:server2server.php

示例2: setUp

 protected function setUp()
 {
     parent::setUp();
     self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
     \OCP\Share::registerBackend('test', 'Test_Share_Backend');
     $config = $this->getMockBuilder('\\OCP\\IConfig')->disableOriginalConstructor()->getMock();
     $clientService = $this->getMock('\\OCP\\Http\\Client\\IClientService');
     $httpHelperMock = $this->getMockBuilder('\\OC\\HTTPHelper')->setConstructorArgs([$config, $clientService])->getMock();
     $httpHelperMock->expects($this->any())->method('post')->with($this->anything())->will($this->returnValue(true));
     $this->registerHttpHelper($httpHelperMock);
     $this->s2s = new \OCA\Files_Sharing\API\Server2Server();
     $this->connection = \OC::$server->getDatabaseConnection();
 }
开发者ID:hyb148,项目名称:core,代码行数:13,代码来源:server2server.php

示例3: setUp

 protected function setUp()
 {
     parent::setUp();
     \OC_Hook::clear('OC_Filesystem', 'setup');
     \OCP\Util::connectHook('OC_Filesystem', 'setup', '\\OC\\Files\\Storage\\Shared', 'setup');
     \OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
     \OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');
     $this->datadir = \OC_Config::getValue('datadirectory');
     $this->tmpDir = \OC_Helper::tmpFolder();
     \OC_Config::setValue('datadirectory', $this->tmpDir);
     $this->userBackend = new \OC_User_Dummy();
     \OC_User::useBackend($this->userBackend);
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:13,代码来源:etagtest.php

示例4: setUp

 protected function setUp()
 {
     parent::setUp();
     \OC_Hook::clear('OC_Filesystem', 'setup');
     $application = new \OCA\Files_Sharing\AppInfo\Application();
     $application->registerMountProviders();
     \OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
     \OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');
     $this->datadir = \OC_Config::getValue('datadirectory');
     $this->tmpDir = \OC_Helper::tmpFolder();
     \OC_Config::setValue('datadirectory', $this->tmpDir);
     $this->userBackend = new \Test\Util\User\Dummy();
     \OC_User::useBackend($this->userBackend);
 }
开发者ID:DaubaKao,项目名称:owncloud-core,代码行数:14,代码来源:etagtest.php

示例5: setUp

 protected function setUp()
 {
     parent::setUp();
     \OC_Hook::clear('OC_Filesystem', 'setup');
     $application = new \OCA\Files_Sharing\AppInfo\Application();
     $application->registerMountProviders();
     \OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
     \OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');
     $config = \OC::$server->getConfig();
     $this->datadir = $config->getSystemValue('datadirectory');
     $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder();
     $config->setSystemValue('datadirectory', $this->tmpDir);
     $this->userBackend = new \Test\Util\User\Dummy();
     \OC_User::useBackend($this->userBackend);
 }
开发者ID:TechArea,项目名称:core,代码行数:15,代码来源:etagtest.php

示例6: setUp

 protected function setUp()
 {
     parent::setUp();
     \OC_User::clearBackends();
     \OC_User::useBackend('dummy');
     $this->user1 = $this->getUniqueID('user1_');
     $this->user2 = $this->getUniqueID('user2_');
     $this->user3 = $this->getUniqueID('user3_');
     $this->user4 = $this->getUniqueID('user4_');
     $this->user5 = $this->getUniqueID('user5_');
     $this->user6 = $this->getUniqueID('user6_');
     $this->groupAndUser = $this->getUniqueID('groupAndUser_');
     \OC::$server->getUserManager()->createUser($this->user1, 'pass');
     \OC::$server->getUserManager()->createUser($this->user2, 'pass');
     \OC::$server->getUserManager()->createUser($this->user3, 'pass');
     \OC::$server->getUserManager()->createUser($this->user4, 'pass');
     \OC::$server->getUserManager()->createUser($this->user5, 'pass');
     \OC::$server->getUserManager()->createUser($this->user6, 'pass');
     // no group
     \OC::$server->getUserManager()->createUser($this->groupAndUser, 'pass');
     \OC_User::setUserId($this->user1);
     \OC_Group::clearBackends();
     \OC_Group::useBackend(new \Test\Util\Group\Dummy());
     $this->group1 = $this->getUniqueID('group1_');
     $this->group2 = $this->getUniqueID('group2_');
     \OC_Group::createGroup($this->group1);
     \OC_Group::createGroup($this->group2);
     \OC_Group::createGroup($this->groupAndUser);
     \OC_Group::addToGroup($this->user1, $this->group1);
     \OC_Group::addToGroup($this->user2, $this->group1);
     \OC_Group::addToGroup($this->user3, $this->group1);
     \OC_Group::addToGroup($this->user2, $this->group2);
     \OC_Group::addToGroup($this->user4, $this->group2);
     \OC_Group::addToGroup($this->user2, $this->groupAndUser);
     \OC_Group::addToGroup($this->user3, $this->groupAndUser);
     \OCP\Share::registerBackend('test', 'Test\\Share\\Backend');
     \OC_Hook::clear('OCP\\Share');
     \OC::registerShareHooks();
     $this->resharing = \OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_resharing', 'yes');
     \OC::$server->getAppConfig()->setValue('core', 'shareapi_allow_resharing', 'yes');
     // 20 Minutes in the past, 20 minutes in the future.
     $now = time();
     $dateFormat = 'Y-m-d H:i:s';
     $this->dateInPast = date($dateFormat, $now - 20 * 60);
     $this->dateInFuture = date($dateFormat, $now + 20 * 60);
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:46,代码来源:ShareTest.php

示例7: register

 public static function register()
 {
     \OCP\Share::registerBackend(App::SHARECALENDAR, '\\OCA\\CalendarPlus\\Share\\Backend\\Calendar');
     \OCP\Share::registerBackend(App::SHAREEVENT, '\\OCA\\CalendarPlus\\Share\\Backend\\Event');
     \OCP\Util::connectHook('OC_User', 'post_createUser', '\\OCA\\CalendarPlus\\Hooks', 'createUser');
     \OCP\Util::connectHook('OC_User', 'post_deleteUser', '\\OCA\\CalendarPlus\\Hooks', 'deleteUser');
     if (\OC::$server->getAppManager()->isEnabledForUser('activity')) {
         \OCP\Util::connectHook('OCP\\Share', 'post_shared', '\\OCA\\CalendarPlus\\Hooks', 'share');
         \OCP\Util::connectHook('OCP\\Share', 'post_unshare', '\\OCA\\CalendarPlus\\Hooks', 'unshare');
     }
     //		\OCP\Util::connectHook('OCP\Share', 'share_internal_mail', 'OCA\Calendar\Hooks', 'shareInternalMail');
     //\OCP\Util::connectHook('\OCA\CalendarPlus', 'addEvent', '\OCA\CalendarPlus\Repeat', 'generate');
     //\OCP\Util::connectHook('\OCA\CalendarPlus', 'editEvent', '\OCA\CalendarPlus\Repeat', 'update');
     //	\OCP\Util::connectHook('\OCA\CalendarPlus', 'deleteEvent', '\OCA\CalendarPlus\Repeat', 'clean');
     //	\OCP\Util::connectHook('\OCA\CalendarPlus', 'moveEvent', '\OCA\CalendarPlus\Repeat', 'update');
     //\OCP\Util::connectHook('\OCA\CalendarPlus', 'deleteCalendar', '\OCA\CalendarPlus\Repeat', 'cleanCalendar');
 }
开发者ID:Rotzbua,项目名称:calendarplus,代码行数:17,代码来源:hooks.php

示例8: setUp

 protected function setUp()
 {
     parent::setUp();
     self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
     \OCP\Share::registerBackend('test', 'Test\\Share\\Backend');
     $config = $this->getMockBuilder('\\OCP\\IConfig')->disableOriginalConstructor()->getMock();
     $clientService = $this->getMock('\\OCP\\Http\\Client\\IClientService');
     $httpHelperMock = $this->getMockBuilder('\\OC\\HTTPHelper')->setConstructorArgs([$config, $clientService])->getMock();
     $httpHelperMock->expects($this->any())->method('post')->with($this->anything())->will($this->returnValue(true));
     $this->share = $this->getMock('\\OCP\\Share\\IShare');
     $this->federatedShareProvider = $this->getMockBuilder('OCA\\FederatedFileSharing\\FederatedShareProvider')->disableOriginalConstructor()->getMock();
     $this->federatedShareProvider->expects($this->any())->method('isOutgoingServer2serverShareEnabled')->willReturn(true);
     $this->federatedShareProvider->expects($this->any())->method('isIncomingServer2serverShareEnabled')->willReturn(true);
     $this->federatedShareProvider->expects($this->any())->method('getShareById')->willReturn($this->share);
     $this->notifications = $this->getMockBuilder('OCA\\FederatedFileSharing\\Notifications')->disableOriginalConstructor()->getMock();
     $this->addressHandler = $this->getMockBuilder('OCA\\FederatedFileSharing\\AddressHandler')->disableOriginalConstructor()->getMock();
     $this->userManager = $this->getMock('OCP\\IUserManager');
     $this->registerHttpHelper($httpHelperMock);
     $this->s2s = new RequestHandler($this->federatedShareProvider, \OC::$server->getDatabaseConnection(), \OC::$server->getShareManager(), \OC::$server->getRequest(), $this->notifications, $this->addressHandler, $this->userManager);
     $this->connection = \OC::$server->getDatabaseConnection();
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:21,代码来源:RequestHandlerTest.php

示例9: getCalendarsForUser

 /**
  * Returns a list of calendars for a principal.
  *
  * Every project is an array with the following keys:
  *  * id, a unique id that will be used by other functions to modify the
  *	calendar. This can be the same as the uri or a database key.
  *  * uri, which the basename of the uri with which the calendar is
  *	accessed.
  *  * principalUri. The owner of the calendar. Almost always the same as
  *	principalUri passed to this method.
  *
  * Furthermore it can contain webdav properties in clark notation. A very
  * common one is '{DAV:}displayname'.
  *
  * @param string $principalUri
  * @return array
  */
 public function getCalendarsForUser($principalUri)
 {
     $raw = OC_Calendar_Calendar::allCalendarsWherePrincipalURIIs($principalUri);
     $calendars = array();
     foreach ($raw as $row) {
         $components = explode(',', $row['components']);
         if ($row['userid'] != OCP\USER::getUser()) {
             $row['uri'] = $row['uri'] . '_shared_by_' . $row['userid'];
         }
         $calendar = array('id' => $row['id'], 'uri' => $row['uri'], 'principaluri' => 'principals/' . $row['userid'], '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}getctag' => $row['ctag'] ? $row['ctag'] : '0', '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet($components));
         foreach ($this->propertyMap as $xmlName => $dbName) {
             $calendar[$xmlName] = $row[$dbName];
         }
         $calendars[] = $calendar;
     }
     if (\OCP\App::isEnabled('contacts')) {
         \OCP\Share::registerBackend('addressbook', 'OCA\\Contacts\\Share\\Addressbook', 'contact');
         $app = new \OCA\Contacts\App(\OCP\User::getUser());
         $calendars[] = array('id' => 'contact_birthdays', 'uri' => 'contact_birthdays', '{DAV:}displayname' => (string) OC_Calendar_App::$l10n->t('Contact birthdays'), 'principaluri' => 'principals/contact_birthdays', '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}getctag' => '0', '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet(array('VEVENT')));
     }
     return $calendars;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:39,代码来源:backend.php

示例10: function

 * 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, version 3,
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 *
 */
$l = \OC::$server->getL10N('files_sharing');
\OC::$CLASSPATH['OC_Share_Backend_File'] = 'files_sharing/lib/share/file.php';
\OC::$CLASSPATH['OC_Share_Backend_Folder'] = 'files_sharing/lib/share/folder.php';
\OC::$CLASSPATH['OC\\Files\\Storage\\Shared'] = 'files_sharing/lib/sharedstorage.php';
$application = new \OCA\Files_Sharing\AppInfo\Application();
$application->registerMountProviders();
\OCA\Files_Sharing\Helper::registerHooks();
\OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
\OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');
$eventDispatcher = \OC::$server->getEventDispatcher();
$eventDispatcher->addListener('OCA\\Files::loadAdditionalScripts', function () {
    \OCP\Util::addScript('files_sharing', 'share');
    \OCP\Util::addScript('files_sharing', 'sharetabview');
    if (\OC::$server->getConfig()->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes') {
        \OCP\Util::addScript('files_sharing', 'external');
    }
    \OCP\Util::addStyle('files_sharing', 'sharetabview');
});
// \OCP\Util::addStyle('files_sharing', 'sharetabview');
\OC::$server->getActivityManager()->registerExtension(function () {
    return new \OCA\Files_Sharing\Activity(\OC::$server->query('L10NFactory'), \OC::$server->getURLGenerator(), \OC::$server->getActivityManager());
});
$config = \OC::$server->getConfig();
if ($config->getAppValue('core', 'shareapi_enabled', 'yes') === 'yes') {
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:31,代码来源:app.php

示例11: API

\Sabre\VObject\Property::$classMap['ADR'] = '\\OC\\VObject\\CompoundProperty';
\Sabre\VObject\Property::$classMap['GEO'] = '\\OC\\VObject\\CompoundProperty';
\Sabre\VObject\Property::$classMap['ORG'] = '\\OC\\VObject\\CompoundProperty';
\OC::$server->getNavigationManager()->add(array('id' => 'contacts', 'order' => 10, 'href' => \OCP\Util::linkToRoute('contacts_index'), 'icon' => \OCP\Util::imagePath('contacts', 'contacts.svg'), 'name' => \OCP\Util::getL10N('contacts')->t('Contacts')));
$api = new API('contacts');
$api->connectHook('OC_User', 'post_createUser', '\\OCA\\Contacts\\Hooks', 'userCreated');
$api->connectHook('OC_User', 'post_deleteUser', '\\OCA\\Contacts\\Hooks', 'userDeleted');
$api->connectHook('OCA\\Contacts', 'pre_deleteAddressBook', '\\OCA\\Contacts\\Hooks', 'addressBookDeletion');
$api->connectHook('OCA\\Contacts', 'pre_deleteContact', '\\OCA\\Contacts\\Hooks', 'contactDeletion');
$api->connectHook('OCA\\Contacts', 'post_createContact', 'OCA\\Contacts\\Hooks', 'contactAdded');
$api->connectHook('OCA\\Contacts', 'post_updateContact', '\\OCA\\Contacts\\Hooks', 'contactUpdated');
$api->connectHook('OCA\\Contacts', 'scanCategories', '\\OCA\\Contacts\\Hooks', 'scanCategories');
$api->connectHook('OCA\\Contacts', 'indexProperties', '\\OCA\\Contacts\\Hooks', 'indexProperties');
$api->connectHook('OC_Calendar', 'getEvents', 'OCA\\Contacts\\Hooks', 'getBirthdayEvents');
$api->connectHook('OC_Calendar', 'getSources', 'OCA\\Contacts\\Hooks', 'getCalenderSources');
\OCP\Util::addscript('contacts', 'loader');
\OCP\Util::addscript('contacts', 'admin');
\OC_Search::registerProvider('OCA\\Contacts\\Search\\Provider');
//\OCP\Share::registerBackend('contact', 'OCA\Contacts\Share_Backend_Contact');
\OCP\Share::registerBackend('addressbook', 'OCA\\Contacts\\Share\\Addressbook', 'contact');
//\OCP\App::registerPersonal('contacts','personalsettings');
\OCP\App::registerAdmin('contacts', 'admin');
if (\OCP\User::isLoggedIn()) {
    $app = new App($api->getUserId());
    $addressBooks = $app->getAddressBooksForUser();
    foreach ($addressBooks as $addressBook) {
        if ($addressBook->isActive()) {
            \OCP\Contacts::registerAddressBook($addressBook->getSearchProvider());
        }
    }
}
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:31,代码来源:app.php

示例12: Application

use OCA\ContactsPlus\App as ContactsApp;
use OCA\ContactsPlus\AddressbookProvider;
$app = new Application();
$c = $app->getContainer();
$contactsAppName = 'contactsplus';
// add an navigation entr
$navigationEntry = function () use($c) {
    return ['id' => $c->getAppName(), 'order' => 1, 'name' => $c->query('L10N')->t('Contacts+'), 'href' => $c->query('URLGenerator')->linkToRoute($c->getAppName() . '.page.index'), 'icon' => $c->query('URLGenerator')->imagePath($c->getAppName(), 'contacts.svg')];
};
$c->getServer()->getNavigationManager()->add($navigationEntry);
if (\OCP\User::isLoggedIn()) {
    \OCP\Util::addScript('contactsplus', 'search');
}
\OC::$server->getSearch()->registerProvider('OCA\\ContactsPlus\\Search\\Provider', array('app' => $contactsAppName));
\OCP\Share::registerBackend(ContactsApp::SHAREADDRESSBOOK, 'OCA\\ContactsPlus\\Share\\Backend\\Addressbook');
\OCP\Share::registerBackend(ContactsApp::SHARECONTACT, 'OCA\\ContactsPlus\\Share\\Backend\\Contact');
\OCP\Util::connectHook('OC_User', 'post_deleteUser', '\\OCA\\ContactsPlus\\Hooks', 'deleteUser');
if (\OCP\User::isLoggedIn() && !\OCP\App::isEnabled('contacts')) {
    $request = $c->query('Request');
    if (isset($request->server['REQUEST_URI'])) {
        $url = $request->server['REQUEST_URI'];
        if (preg_match('%index.php/apps/files(/.*)?%', $url) || preg_match('%index.php/s/(/.*)?%', $url)) {
            \OCP\Util::addscript($contactsAppName, 'loader');
        }
    }
}
if (\OCP\User::isLoggedIn()) {
    $cm = \OC::$server->getContactsManager();
    $cm->register(function () use($cm) {
        $myApp = new Application();
        $addressBooks = $myApp->getContainer()->query('AddressbookController')->getAddressBooksForCM();
开发者ID:ViToni,项目名称:contactsplus,代码行数:31,代码来源:app.php

示例13: testKeepNonFileShares

 public function testKeepNonFileShares()
 {
     $this->loginAsUser($this->user1);
     \OCP\Share::registerBackend('test', 'Test\\Share\\Backend');
     $this->assertTrue(\OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ), 'Failed asserting that user 1 successfully shared something with user 2.');
     $this->assertCount(1, $this->getShares());
     $this->job->run([]);
     $this->assertCount(1, $this->getShares(), 'Non-file shares kept');
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:9,代码来源:DeleteOrphanedSharesJobTest.php

示例14: testShareTags

 public function testShareTags()
 {
     $testTag = 'TestTag';
     \OCP\Share::registerBackend('test', 'Test\\Share\\Backend');
     $tagger = $this->tagMgr->load('test');
     $tagger->tagAs(1, $testTag);
     $otherUserId = $this->getUniqueID('user2_');
     \OC::$server->getUserManager()->createUser($otherUserId, 'pass');
     \OC_User::setUserId($otherUserId);
     $otherUserSession = $this->getMock('\\OCP\\IUserSession');
     $otherUserSession->expects($this->any())->method('getUser')->will($this->returnValue(new \OC\User\User($otherUserId, null)));
     $otherTagMgr = new \OC\TagManager($this->tagMapper, $otherUserSession);
     $otherTagger = $otherTagMgr->load('test');
     $this->assertFalse($otherTagger->hasTag($testTag));
     \OC_User::setUserId($this->user->getUID());
     \OCP\Share::shareItem('test', 1, \OCP\Share::SHARE_TYPE_USER, $otherUserId, \OCP\Constants::PERMISSION_READ);
     \OC_User::setUserId($otherUserId);
     $otherTagger = $otherTagMgr->load('test', array(), true);
     // Update tags, load shared ones.
     $this->assertTrue($otherTagger->hasTag($testTag));
     $this->assertContains(1, $otherTagger->getIdsForTag($testTag));
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:22,代码来源:TagsTest.php

示例15: registerProviders

 /**
  * register search and share provider
  */
 public function registerProviders()
 {
     /* \OC_Search::registerProvider('\OCA\Calendar\SearchProvider'); */
     Share::registerBackend('calendar', '\\OCA\\Calendar\\Share\\Calendar');
     Share::registerBackend('event', '\\OCA\\Calendar\\Share\\Event');
 }
开发者ID:amin-hedayati,项目名称:calendar-rework,代码行数:9,代码来源:application.php


注:本文中的OCP\Share::registerBackend方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。