• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP OC_App类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中OC_App的典型用法代码示例。如果您正苦于以下问题:PHP OC_App类的具体用法?PHP OC_App怎么用?PHP OC_App使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: getApps

 /**
  * @param array $parameters
  * @return OC_OCS_Result
  */
 public function getApps($parameters)
 {
     $apps = OC_App::listAllApps();
     $list = [];
     foreach ($apps as $app) {
         $list[] = $app['id'];
     }
     $filter = isset($_GET['filter']) ? $_GET['filter'] : false;
     if ($filter) {
         switch ($filter) {
             case 'enabled':
                 return new OC_OCS_Result(array('apps' => \OC_App::getEnabledApps()));
                 break;
             case 'disabled':
                 $enabled = OC_App::getEnabledApps();
                 return new OC_OCS_Result(array('apps' => array_diff($list, $enabled)));
                 break;
             default:
                 // Invalid filter variable
                 return new OC_OCS_Result(null, 101);
                 break;
         }
     } else {
         return new OC_OCS_Result(array('apps' => $list));
     }
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:30,代码来源:apps.php


示例2: setUp

 public function setUp()
 {
     if (!getenv('RUN_OBJECTSTORE_TESTS')) {
         $this->markTestSkipped('objectstore tests are unreliable on travis');
     }
     \OC_App::disable('files_sharing');
     \OC_App::disable('files_versions');
     // reset backend
     \OC_User::clearBackends();
     \OC_User::useBackend('database');
     // create users
     $users = array('test');
     foreach ($users as $userName) {
         \OC_User::deleteUser($userName);
         \OC_User::createUser($userName, $userName);
     }
     // main test user
     $userName = 'test';
     \OC_Util::tearDownFS();
     \OC_User::setUserId('');
     \OC\Files\Filesystem::tearDown();
     \OC_User::setUserId('test');
     $testContainer = 'oc-test-container-' . substr(md5(rand()), 0, 7);
     $params = array('username' => 'facebook100000330192569', 'password' => 'Dbdj1sXnRSHxIGc4', 'container' => $testContainer, 'autocreate' => true, 'region' => 'RegionOne', 'url' => 'http://8.21.28.222:5000/v2.0', 'tenantName' => 'facebook100000330192569', 'serviceName' => 'swift', 'user' => \OC_User::getManager()->get($userName));
     $this->objectStorage = new ObjectStoreToTest($params);
     $params['objectstore'] = $this->objectStorage;
     $this->instance = new ObjectStoreStorage($params);
 }
开发者ID:Combustible,项目名称:core,代码行数:28,代码来源:swift.php


示例3: enableApp

function enableApp($app) {
	try {
		OC_App::enable($app);
	} catch (Exception $e) {
		echo $e;
	}
}
开发者ID:ninjasilicon,项目名称:core,代码行数:7,代码来源:enable_all.php


示例4: unlink

 /**
  * Deletes the given file by moving it into the trashbin.
  *
  * @param string $path
  */
 public function unlink($path)
 {
     if (self::$disableTrash || !\OC_App::isEnabled('files_trashbin')) {
         return $this->storage->unlink($path);
     }
     $normalized = Filesystem::normalizePath($this->mountPoint . '/' . $path);
     $result = true;
     if (!isset($this->deletedFiles[$normalized])) {
         $view = Filesystem::getView();
         $this->deletedFiles[$normalized] = $normalized;
         if ($filesPath = $view->getRelativePath($normalized)) {
             $filesPath = trim($filesPath, '/');
             $result = \OCA\Files_Trashbin\Trashbin::move2trash($filesPath);
             // in cross-storage cases the file will be copied
             // but not deleted, so we delete it here
             if ($result) {
                 $this->storage->unlink($path);
             }
         } else {
             $result = $this->storage->unlink($path);
         }
         unset($this->deletedFiles[$normalized]);
     } else {
         if ($this->storage->file_exists($path)) {
             $result = $this->storage->unlink($path);
         }
     }
     return $result;
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:34,代码来源:storage.php


示例5: doFind

 /**
  * @param string $script
  */
 public function doFind($script)
 {
     $theme_dir = 'themes/' . $this->theme . '/';
     if (strpos($script, '3rdparty') === 0 && $this->appendIfExist($this->thirdpartyroot, $script . '.js')) {
         return;
     }
     if (strpos($script, '/l10n/') !== false) {
         // For language files we try to load them all, so themes can overwrite
         // single l10n strings without having to translate all of them.
         $found = 0;
         $found += $this->appendIfExist($this->serverroot, 'core/' . $script . '.js');
         $found += $this->appendIfExist($this->serverroot, $theme_dir . 'core/' . $script . '.js');
         $found += $this->appendIfExist($this->serverroot, $script . '.js');
         $found += $this->appendIfExist($this->serverroot, $theme_dir . $script . '.js');
         $found += $this->appendIfExist($this->serverroot, $theme_dir . 'apps/' . $script . '.js');
         if ($found) {
             return;
         }
     } else {
         if ($this->appendIfExist($this->serverroot, $theme_dir . 'apps/' . $script . '.js') || $this->appendIfExist($this->serverroot, $theme_dir . $script . '.js') || $this->appendIfExist($this->serverroot, $script . '.js') || $this->appendIfExist($this->serverroot, $theme_dir . 'core/' . $script . '.js') || $this->appendIfExist($this->serverroot, 'core/' . $script . '.js')) {
             return;
         }
     }
     $app = substr($script, 0, strpos($script, '/'));
     $script = substr($script, strpos($script, '/') + 1);
     $app_path = \OC_App::getAppPath($app);
     $app_url = \OC_App::getAppWebPath($app);
     // missing translations files fill be ignored
     if (strpos($script, 'l10n/') === 0) {
         $this->appendIfExist($app_path, $script . '.js', $app_url);
         return;
     }
     $this->append($app_path, $script . '.js', $app_url);
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:37,代码来源:JSResourceLocator.php


示例6: update

	public function update($tmpDir = '') {
		Helper::mkdir($tmpDir, true);
		$this->collect();
		try {
			foreach ($this->appsToUpdate as $appId) {
				if (!@file_exists($this->newBase . '/' . $appId)){
					continue;
				}
				$path = \OC_App::getAppPath($appId);
				if ($path) {
					Helper::move($path, $tmpDir . '/' . $appId);
					
					// ! reverted intentionally
					$this->done [] = array(
						'dst' => $path,
						'src' => $tmpDir . '/' . $appId
					);
					
					Helper::move($this->newBase . '/' . $appId, $path);
				} else { 
					// The app is new and doesn't exist in the current instance
					$pathData = first(\OC::$APPSROOTS);
					Helper::move($this->newBase . '/' . $appId, $pathData['path'] . '/' . $appId);
				}
			}
			$this->finalize();
		} catch (\Exception $e) {
			$this->rollback(true);
			throw $e;
		}
	}
开发者ID:BacLuc,项目名称:newGryfiPage,代码行数:31,代码来源:apps.php


示例7: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false') {
         $shouldFilterShipped = true;
         $shippedFilter = $input->getOption('shipped') === 'true';
     } else {
         $shouldFilterShipped = false;
     }
     $apps = \OC_App::getAllApps();
     $enabledApps = $disabledApps = [];
     $versions = \OC_App::getAppVersions();
     //sort enabled apps above disabled apps
     foreach ($apps as $app) {
         if ($shouldFilterShipped && \OC_App::isShipped($app) !== $shippedFilter) {
             continue;
         }
         if (\OC_App::isEnabled($app)) {
             $enabledApps[] = $app;
         } else {
             $disabledApps[] = $app;
         }
     }
     $apps = ['enabled' => [], 'disabled' => []];
     sort($enabledApps);
     foreach ($enabledApps as $app) {
         $apps['enabled'][$app] = isset($versions[$app]) ? $versions[$app] : true;
     }
     sort($disabledApps);
     foreach ($disabledApps as $app) {
         $apps['disabled'][$app] = null;
     }
     $this->writeAppList($input, $output, $apps);
 }
开发者ID:evanjt,项目名称:core,代码行数:33,代码来源:listapps.php


示例8: call

 /**
  * handles an api call
  * @param array $parameters
  */
 public static function call($parameters)
 {
     $request = \OC::$server->getRequest();
     $method = $request->getMethod();
     // Prepare the request variables
     if ($method === 'PUT') {
         $parameters['_put'] = $request->getParams();
     } else {
         if ($method === 'DELETE') {
             $parameters['_delete'] = $request->getParams();
         }
     }
     $name = $parameters['_route'];
     // Foreach registered action
     $responses = array();
     foreach (self::$actions[$name] as $action) {
         // Check authentication and availability
         if (!self::isAuthorised($action)) {
             $responses[] = array('app' => $action['app'], 'response' => new OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED, 'Unauthorised'), 'shipped' => OC_App::isShipped($action['app']));
             continue;
         }
         if (!is_callable($action['action'])) {
             $responses[] = array('app' => $action['app'], 'response' => new OC_OCS_Result(null, \OCP\API::RESPOND_NOT_FOUND, 'Api method not found'), 'shipped' => OC_App::isShipped($action['app']));
             continue;
         }
         // Run the action
         $responses[] = array('app' => $action['app'], 'response' => call_user_func($action['action'], $parameters), 'shipped' => OC_App::isShipped($action['app']));
     }
     $response = self::mergeResponses($responses);
     $format = self::requestedFormat();
     if (self::$logoutRequired) {
         OC_User::logout();
     }
     self::respond($response, $format);
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:39,代码来源:api.php


示例9: finalize

 protected function finalize()
 {
     foreach ($this->appsToDisable as $appId) {
         \OC_App::disable($appId);
     }
     parent::finalize();
 }
开发者ID:droiter,项目名称:openwrt-on-android,代码行数:7,代码来源:apps.php


示例10: loadCommands

 /**
  * @param OutputInterface $output
  */
 public function loadCommands(OutputInterface $output)
 {
     // $application is required to be defined in the register_command scripts
     $application = $this->application;
     require_once \OC::$SERVERROOT . '/core/register_command.php';
     if ($this->config->getSystemValue('installed', false)) {
         if (!\OCP\Util::needUpgrade()) {
             OC_App::loadApps();
             foreach (\OC::$server->getAppManager()->getInstalledApps() as $app) {
                 $appPath = \OC_App::getAppPath($app);
                 \OC::$loader->addValidRoot($appPath);
                 $file = $appPath . '/appinfo/register_command.php';
                 if (file_exists($file)) {
                     require $file;
                 }
             }
         } else {
             $output->writeln("ownCloud or one of the apps require upgrade - only a limited number of commands are available");
         }
     } else {
         $output->writeln("ownCloud is not installed - only a limited number of commands are available");
     }
     $input = new ArgvInput();
     if ($input->getFirstArgument() !== 'check') {
         $errors = \OC_Util::checkServer(\OC::$server->getConfig());
         if (!empty($errors)) {
             foreach ($errors as $error) {
                 $output->writeln((string) $error['error']);
                 $output->writeln((string) $error['hint']);
                 $output->writeln('');
             }
             throw new \Exception("Environment not properly prepared.");
         }
     }
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:38,代码来源:application.php


示例11: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $appManager = \OC::$server->getAppManager();
     self::$trashBinStatus = $appManager->isEnabledForUser('files_trashbin');
     // reset backend
     \OC_User::clearBackends();
     \OC_User::useBackend('database');
     // clear share hooks
     \OC_Hook::clear('OCP\\Share');
     \OC::registerShareHooks();
     $application = new \OCA\Files_Sharing\AppInfo\Application();
     $application->registerMountProviders();
     //disable encryption
     \OC_App::disable('encryption');
     $config = \OC::$server->getConfig();
     //configure trashbin
     self::$rememberRetentionObligation = $config->getSystemValue('trashbin_retention_obligation', Files_Trashbin\Expiration::DEFAULT_RETENTION_OBLIGATION);
     $config->setSystemValue('trashbin_retention_obligation', 'auto, 2');
     // register hooks
     Files_Trashbin\Trashbin::registerHooks();
     // create test user
     self::loginHelper(self::TEST_TRASHBIN_USER2, true);
     self::loginHelper(self::TEST_TRASHBIN_USER1, true);
 }
开发者ID:loulancn,项目名称:core,代码行数:25,代码来源:trashbin.php


示例12: sendEmail

 public static function sendEmail($args)
 {
     $isEncrypted = OC_App::isEnabled('files_encryption');
     if (!$isEncrypted || isset($_POST['continue'])) {
         $continue = true;
     } else {
         $continue = false;
     }
     if (OC_User::userExists($_POST['user']) && $continue) {
         $token = hash('sha256', OC_Util::generate_random_bytes(30) . OC_Config::getValue('passwordsalt', ''));
         OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', hash('sha256', $token));
         // Hash the token again to prevent timing attacks
         $email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', '');
         if (!empty($email)) {
             $link = OC_Helper::linkToRoute('core_lostpassword_reset', array('user' => $_POST['user'], 'token' => $token));
             $link = OC_Helper::makeURLAbsolute($link);
             $tmpl = new OC_Template('core/lostpassword', 'email');
             $tmpl->assign('link', $link, false);
             $msg = $tmpl->fetchPage();
             $l = OC_L10N::get('core');
             $from = OCP\Util::getDefaultEmailAddress('lostpassword-noreply');
             try {
                 OC_Mail::send($email, $_POST['user'], $l->t('ownCloud password reset'), $msg, $from, 'ownCloud');
             } catch (Exception $e) {
                 OC_Template::printErrorPage('A problem occurs during sending the e-mail please contact your administrator.');
             }
             self::displayLostPasswordPage(false, true);
         } else {
             self::displayLostPasswordPage(true, false);
         }
     } else {
         self::displayLostPasswordPage(true, false);
     }
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:34,代码来源:controller.php


示例13: checkAppEnabled

	/**
	* Check if the app is enabled, send json error msg if not
	*/
	public static function checkAppEnabled($app) {
		if( !OC_App::isEnabled($app)) {
			$l = OC_L10N::get('lib');
			self::error(array( 'data' => array( 'message' => $l->t('Application is not enabled') )));
			exit();
		}
	}
开发者ID:ryanshoover,项目名称:core,代码行数:10,代码来源:json.php


示例14: showShare

 public static function showShare($args)
 {
     \OC_Util::checkAppEnabled('files_sharing');
     $token = $args['token'];
     \OC_App::loadApp('files_sharing');
     \OC_User::setIncognitoMode(true);
     require_once \OC_App::getAppPath('files_sharing') . '/public.php';
 }
开发者ID:Combustible,项目名称:core,代码行数:8,代码来源:controller.php


示例15: analyse

 /**
  * @param string $appId
  * @return array
  */
 public function analyse($appId)
 {
     $appPath = \OC_App::getAppPath($appId);
     if ($appPath === false) {
         throw new \RuntimeException("No app with given id <{$appId}> known.");
     }
     return $this->analyseFolder($appPath);
 }
开发者ID:kenwi,项目名称:core,代码行数:12,代码来源:codechecker.php


示例16: checkAppEnabled

 /**
  * Check if the app is enabled, send json error msg if not
  * @param string $app
  * @deprecated Use the AppFramework instead. It will automatically check if the app is enabled.
  */
 public static function checkAppEnabled($app)
 {
     if (!OC_App::isEnabled($app)) {
         $l = \OC::$server->getL10N('lib');
         self::error(array('data' => array('message' => $l->t('Application is not enabled'), 'error' => 'application_not_enabled')));
         exit;
     }
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:13,代码来源:json.php


示例17: httpGet

 protected function httpGet($uri)
 {
     $range = $this->getHTTPRange();
     if (OC_App::isEnabled('files_encryption') && $range) {
         // encryption does not support range requests
         $this->ignoreRangeHeader = true;
     }
     return parent::httpGet($uri);
 }
开发者ID:pinoniq,项目名称:core,代码行数:9,代码来源:server.php


示例18: tearDown

 function tearDown()
 {
     // reset app files_trashbin
     if ($this->stateFilesTrashbin) {
         OC_App::enable('files_trashbin');
     } else {
         OC_App::disable('files_trashbin');
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:9,代码来源:stream.php


示例19: analyse

 /**
  * @param string $appId
  * @return array
  */
 public function analyse($appId)
 {
     $appPath = \OC_App::getAppPath($appId);
     if ($appPath === false) {
         throw new \RuntimeException("No app with given id <{$appId}> known.");
     }
     $errors = [];
     $info = $this->infoParser->parse($appPath . '/appinfo/info.xml');
     foreach ($info as $key => $value) {
         if (is_array($value)) {
             $value = json_encode($value);
         }
         if (in_array($key, $this->mandatoryFields)) {
             $this->emit('InfoChecker', 'mandatoryFieldFound', [$key, $value]);
             continue;
         }
         if (in_array($key, $this->optionalFields)) {
             $this->emit('InfoChecker', 'optionalFieldFound', [$key, $value]);
             continue;
         }
         if (in_array($key, $this->deprecatedFields)) {
             // skip empty arrays - empty arrays for remote and public are always added
             if ($value === '[]' && in_array($key, ['public', 'remote', 'info'])) {
                 continue;
             }
             $this->emit('InfoChecker', 'deprecatedFieldFound', [$key, $value]);
             continue;
         }
         $this->emit('InfoChecker', 'unusedFieldFound', [$key, $value]);
     }
     foreach ($this->mandatoryFields as $key) {
         if (!isset($info[$key])) {
             $this->emit('InfoChecker', 'mandatoryFieldMissing', [$key]);
             $errors[] = ['type' => 'mandatoryFieldMissing', 'field' => $key];
         }
     }
     $versionFile = $appPath . '/appinfo/version';
     if (is_file($versionFile)) {
         $version = trim(file_get_contents($versionFile));
         if (isset($info['version'])) {
             if ($info['version'] !== $version) {
                 $this->emit('InfoChecker', 'differentVersions', [$version, $info['version']]);
                 $errors[] = ['type' => 'differentVersions', 'message' => 'appinfo/version: ' . $version . ' - appinfo/info.xml: ' . $info['version']];
             } else {
                 $this->emit('InfoChecker', 'sameVersions', [$versionFile]);
             }
         } else {
             $this->emit('InfoChecker', 'migrateVersion', [$version]);
         }
     } else {
         if (!isset($info['version'])) {
             $this->emit('InfoChecker', 'mandatoryFieldMissing', ['version']);
             $errors[] = ['type' => 'mandatoryFieldMissing', 'field' => 'version'];
         }
     }
     return $errors;
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:61,代码来源:infochecker.php


示例20: tearDown

 function tearDown()
 {
     // reset app files_encryption
     if ($this->stateFilesEncryption) {
         \OC_App::enable('files_encryption');
     } else {
         \OC_App::disable('files_encryption');
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:9,代码来源:base.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP OC_Appconfig类代码示例发布时间:2022-05-23
下一篇:
PHP OC_APP类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap