本文整理汇总了PHP中OCP\AppFramework\App::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP App::__construct方法的具体用法?PHP App::__construct怎么用?PHP App::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\AppFramework\App
的用法示例。
在下文中一共展示了App::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct (array $urlParams=array()) {
parent::__construct('ownnote', $urlParams);
$container = $this->getContainer();
/**
* Controllers
*/
$container->registerService('PageController', function(IContainer $c) {
return new PageController(
$c->query('AppName'),
$c->query('Request'),
$c->query('UserId')
);
});
$container->registerService('OwnnoteApiController', function($c){
return new OwnnoteApiController(
$c->query('AppName'),
$c->query('Request')
);
});
/**
* Core
*/
$container->registerService('UserId', function(IContainer $c) {
return \OCP\User::getUser();
});
}
示例2: __construct
public function __construct(array $urlParams = array())
{
parent::__construct('documents', $urlParams);
$container = $this->getContainer();
/**
* Controllers
*/
$container->registerService('UserController', function ($c) {
return new UserController($c->query('AppName'), $c->query('Request'));
});
$container->registerService('SessionController', function ($c) {
return new SessionController($c->query('AppName'), $c->query('Request'), $c->query('Logger'), $c->query('UserId'));
});
$container->registerService('DocumentController', function ($c) {
return new DocumentController($c->query('AppName'), $c->query('Request'), $c->query('CoreConfig'), $c->query('L10N'), $c->query('UserId'));
});
$container->registerService('SettingsController', function ($c) {
return new SettingsController($c->query('AppName'), $c->query('Request'), $c->query('CoreConfig'), $c->query('Logger'), $c->query('L10N'), $c->query('UserId'));
});
/**
* Core
*/
$container->registerService('Logger', function ($c) {
return $c->query('ServerContainer')->getLogger();
});
$container->registerService('CoreConfig', function ($c) {
return $c->query('ServerContainer')->getConfig();
});
$container->registerService('L10N', function ($c) {
return $c->query('ServerContainer')->getL10N($c->query('AppName'));
});
$container->registerService('UserId', function () {
return \OCP\User::getUser();
});
}
示例3: __construct
public function __construct(array $urlParams = array())
{
parent::__construct('weather', $urlParams);
$container = $this->getContainer();
/**
* Core
*/
$container->registerService('UserId', function (IContainer $c) {
return \OCP\User::getUser();
});
/**
* Database Layer
*/
$container->registerService('CityMapper', function (IContainer $c) {
return new CityMapper($c->query('ServerContainer')->getDb());
});
$container->registerService('SettingsMapper', function (IContainer $c) {
return new SettingsMapper($c->query('ServerContainer')->getDb());
});
/**
* Controllers
*/
$container->registerService('CityController', function (IContainer $c) {
return new CityController($c->query('AppName'), $c->query('Request'), $c->query('UserId'), $c->query('CityMapper'), $c->query('SettingsMapper'));
});
$container->registerService('SettingsController', function (IContainer $c) {
return new SettingsController($c->query('AppName'), $c->query('Request'), $c->query('UserId'), $c->query('SettingsMapper'), $c->query('CityMapper'));
});
$container->registerService('WeatherController', function (IContainer $c) {
return new WeatherController($c->query('AppName'), $c->query('Request'), $c->query('UserId'), $c->query('CityMapper'), $c->query('SettingsMapper'));
});
}
示例4: __construct
public function __construct(array $urlParams = array())
{
parent::__construct('bookmarks', $urlParams);
$container = $this->getContainer();
/**
* Controllers
* @param OC\AppFramework\Utility\SimpleContainer $c The Container instance
* that handles the request
*/
$container->registerService('WebViewController', function ($c) {
return new WebViewController($c->query('AppName'), $c->query('Request'), $c->query('UserId'), $c->query('ServerContainer')->getURLGenerator(), $c->query('ServerContainer')->getDb());
});
$container->registerService('BookmarkController', function ($c) {
return new BookmarkController($c->query('AppName'), $c->query('Request'), $c->query('UserId'), $c->query('ServerContainer')->getDb());
});
$container->registerService('TagsController', function ($c) {
return new TagsController($c->query('AppName'), $c->query('Request'), $c->query('UserId'), $c->query('ServerContainer')->getDb());
});
$container->registerService('PublicController', function ($c) {
return new PublicController($c->query('AppName'), $c->query('Request'), $c->query('ServerContainer')->getDb(), $c->query('ServerContainer')->getUserManager());
});
/**
* Core
*/
$container->registerService('UserId', function () {
return \OCP\User::getUser();
});
}
示例5: __construct
public function __construct(array $urlParams = array())
{
parent::__construct('tasks', $urlParams);
$container = $this->getContainer();
/**
* Controllers
*/
$container->registerService('PageController', function ($c) {
return new PageController($c->query('AppName'), $c->query('Request'), $c->query('UserId'));
});
$container->registerService('CollectionsController', function ($c) {
return new CollectionsController($c->query('AppName'), $c->query('Request'), $c->query('UserId'), $c->query('L10N'), $c->query('Settings'));
});
$container->registerService('ListsController', function ($c) {
return new ListsController($c->query('AppName'), $c->query('Request'), $c->query('UserId'));
});
$container->registerService('SettingsController', function ($c) {
return new SettingsController($c->query('AppName'), $c->query('Request'), $c->query('UserId'), $c->query('Settings'));
});
$container->registerService('TasksController', function ($c) {
return new TasksController($c->query('AppName'), $c->query('Request'), $c->query('UserId'));
});
/**
* Core
*/
$container->registerService('UserId', function ($c) {
return \OCP\User::getUser();
});
$container->registerService('L10N', function ($c) {
return $c->query('ServerContainer')->getL10N($c->query('AppName'));
});
$container->registerService('Settings', function ($c) {
return $c->query('ServerContainer')->getConfig();
});
}
示例6: __construct
public function __construct(array $urlParams = array())
{
parent::__construct('user_deletion_request', $urlParams);
$container = $this->getContainer();
/**
* Controllers
*/
$container->registerService('UserHooks', function ($c) {
return new UserHooks($c->query('UserManager'), $c->query('GroupManager'), $c->query('Config'));
});
/**
* Service
*/
$container->registerService('MailService', function ($c) {
return new MailService($c->query('AppName'), $c->query('L10N'), $c->query('Config'), $c->query('UserManager'), $c->query('GroupManager'));
});
/**
* Core
*/
$container->registerService('Config', function ($c) {
return $c->query('ServerContainer')->getConfig();
});
$container->registerService('L10N', function ($c) {
return $c->query('ServerContainer')->getL10N($c->query('AppName'));
});
$container->registerService('Logger', function ($c) {
return $c->query('ServerContainer')->getLogger();
});
$container->registerService('UserManager', function ($c) {
return $c->query('ServerContainer')->getUserManager();
});
$container->registerService('GroupManager', function ($c) {
return $c->query('ServerContainer')->getGroupManager();
});
}
示例7: __construct
public function __construct(array $urlParams = array())
{
parent::__construct('files_mv', $urlParams);
$container = $this->getContainer();
$container->registerService('UserFolder', function (IContainer $c) {
return $c->query('ServerContainer')->getUserFolder();
});
$container->registerService('ActivityApplication', function ($c) {
return new \OCA\Activity\AppInfo\Application();
});
$container->registerService('Hooks', function (IContainer $c) {
/** @var \OC\Server $server */
$server = $c->query('ServerContainer');
return new Hook($server->getActivityManager(), $c->query('ActivityApplication')->getContainer()->query('ActivityData'), $c->query('ActivityApplication')->getContainer()->query('UserSettings'), $server->getGroupManager(), new View(''), $server->getDatabaseConnection(), $c->query('CurrentUID'));
});
$container->registerService('FilesHook', function ($c) {
return new FilesHook($c->query('ServerContainer')->getRootFolder(), $c->query('Hooks'));
});
$container->registerService('CurrentUID', function (IContainer $c) {
/** @var \OC\Server $server */
$server = $c->query('ServerContainer');
$user = $server->getUserSession()->getUser();
return $user ? $user->getUID() : '';
});
}
示例8: __construct
public function __construct($urlParams = [])
{
parent::__construct('fuel', $urlParams);
$container = $this->getContainer();
/**
* Inject 'UserFolder' parameter
*/
$userFolder = $container->query('ServerContainer')->getUserFolder();
$container->registerParameter('UserFolder', $userFolder);
/**
* Inject L10n
*/
$L10n = $container->getServer()->getL10N('fuel');
$container->registerParameter('L10n', $L10n);
/**
* Register which validator to inject
*/
$container->registerService(IValidator::class, function ($c) {
return $c->query(Validator::class);
}, false);
/**
* Middleware
*/
$container->registerAlias('VehicleValidationMiddleware', VehicleValidationMiddleware::class);
$container->registerAlias("RecordValidatonMiddleware", RecordValidationMiddleware::class);
$container->registerMiddleWare('VehicleValidationMiddleware');
$container->registerMiddleWare("RecordValidatonMiddleware");
}
示例9: __construct
public function __construct(array $urlParams = array())
{
parent::__construct('maps', $urlParams);
$container = $this->getContainer();
/**
* Controllers
*/
$container->registerService('PageController', function ($c) {
return new PageController($c->query('AppName'), $c->query('Request'), $c->query('UserId'), $c->query('CacheManager'), $c->query('LocationManager'));
});
$container->registerService('LocationController', function ($c) {
return new LocationController($c->query('AppName'), $c->query('Request'), $c->query('LocationManager'), $c->query('UserId'));
});
$container->registerService('CacheManager', function ($c) {
return new CacheManager($c->query('ServerContainer')->getDb());
});
$container->registerService('LocationManager', function ($c) {
return new LocationManager($c->query('ServerContainer')->getDb());
});
/**
* Core
*/
$container->registerService('UserId', function ($c) {
return \OCP\User::getUser();
});
$container->registerService('Db', function () {
return new Db();
});
}
示例10: __construct
public function __construct(array $urlParams = [])
{
parent::__construct('updater', $urlParams);
$container = $this->getContainer();
/**
* Controllers
*/
$container->registerService('UpdateController', function ($c) {
return new UpdateController($c->query('AppName'), $c->query('Request'), $c->query('L10N'));
});
$container->registerService('BackupController', function ($c) {
return new BackupController($c->query('AppName'), $c->query('Request'), $c->query('Config'), $c->query('L10N'));
});
$container->registerService('AdminController', function ($c) {
return new AdminController($c->query('AppName'), $c->query('Request'), $c->query('Config'), $c->query('L10N'));
});
$container->registerService('L10N', function ($c) {
return $c->query('ServerContainer')->getL10N($c->query('AppName'));
});
$container->registerService('Config', function ($c) {
return new Config($c->query('ServerContainer')->getConfig());
});
$container->registerService('Channel', function ($c) {
return new Channel($c->query('L10N'));
});
//Startup
if (\OC_Util::getEditionString() === '') {
\OCP\App::registerAdmin('updater', 'admin');
$appPath = $container->query('Config')->getBackupBase();
if (!@file_exists($appPath)) {
Helper::mkdir($appPath);
}
}
}
示例11: __construct
public function __construct(array $urlParams = array())
{
parent::__construct('exifview', $urlParams);
$container = $this->getContainer();
// $container->registerService('RootView', function ($c) {
// return \OC\files::getView();
// });
$container->registerService('PageController', function ($c) {
return new PageController($c->query('AppName'), $c->query('UserId'), $c->query('Request'), $c->query('ServerContainer')->getUserFolder());
});
$container->registerService('GpsXML', function ($c) {
return new GpsXML($c->query('AppName'), $c->query('UserId'), $c->query('ServerContainer')->getDbConnection());
});
$container->registerService('UserStorage', function ($c) {
return $c->query('ServerContainer')->getUserFolder();
});
$container->registerService('JsonController', function ($c) {
return new JsonController($c->query('AppName'), $c->query('UserId'), $c->query('Request'), $c->query('GpsXML'));
});
// $container->registerService('TestService', function($c) {
// return new TestService(
// $c->query('ServerContainer')->getDbConnection()
// );
// });
// $container->registerService('TestController', function($c){
// return new TestController(
// $c->query('AppName'),
// $c->query('UserId'),
// $c->query('Request'),
// $c->query('TestService')
// );
// });
}
示例12: __construct
public function __construct(array $urlParams = array())
{
parent::__construct('files_sharing', $urlParams);
$container = $this->getContainer();
$server = $container->getServer();
/**
* Controllers
*/
$container->registerService('ShareController', function (SimpleContainer $c) use($server) {
return new ShareController($c->query('AppName'), $c->query('Request'), $c->query('UserSession'), $server->getAppConfig(), $server->getConfig(), $c->query('URLGenerator'), $c->query('UserManager'), $server->getLogger(), $server->getActivityManager());
});
$container->registerService('ExternalSharesController', function (SimpleContainer $c) {
return new ExternalSharesController($c->query('AppName'), $c->query('Request'), $c->query('IsIncomingShareEnabled'), $c->query('ExternalManager'), $c->query('HttpClientService'));
});
/**
* Core class wrappers
*/
$container->registerService('UserSession', function (SimpleContainer $c) use($server) {
return $server->getUserSession();
});
$container->registerService('URLGenerator', function (SimpleContainer $c) use($server) {
return $server->getUrlGenerator();
});
$container->registerService('UserManager', function (SimpleContainer $c) use($server) {
return $server->getUserManager();
});
$container->registerService('HttpClientService', function (SimpleContainer $c) use($server) {
return $server->getHTTPClientService();
});
$container->registerService('IsIncomingShareEnabled', function (SimpleContainer $c) {
return Helper::isIncomingServer2serverShareEnabled();
});
$container->registerService('ExternalManager', function (SimpleContainer $c) use($server) {
$user = $server->getUserSession()->getUser();
$uid = $user ? $user->getUID() : null;
return new \OCA\Files_Sharing\External\Manager($server->getDatabaseConnection(), \OC\Files\Filesystem::getMountManager(), \OC\Files\Filesystem::getLoader(), $server->getHTTPHelper(), $server->getNotificationManager(), $uid);
});
/**
* Middleware
*/
$container->registerService('SharingCheckMiddleware', function (SimpleContainer $c) use($server) {
return new SharingCheckMiddleware($c->query('AppName'), $server->getConfig(), $server->getAppManager());
});
// Execute middlewares
$container->registerMiddleware('SharingCheckMiddleware');
$container->registerService('MountProvider', function (IContainer $c) {
/** @var \OCP\IServerContainer $server */
$server = $c->query('ServerContainer');
return new MountProvider($server->getConfig(), $c->query('PropagationManager'));
});
$container->registerService('PropagationManager', function (IContainer $c) {
/** @var \OCP\IServerContainer $server */
$server = $c->query('ServerContainer');
return new PropagationManager($server->getUserSession(), $server->getConfig());
});
/*
* Register capabilities
*/
$container->registerCapability('OCA\\Files_Sharing\\Capabilities');
}
示例13: __construct
/**
* Define your dependencies in here
*/
public function __construct(array $urlParams = array())
{
parent::__construct('user_account_actions', $urlParams);
$container = $this->getContainer();
/**
* Controllers
*/
$container->registerService('UserHooks', function ($c) {
return new UserHooks($c->query('ServerContainer')->getUserManager(), $c->query('MailAction'), $c->query('FileAction'));
});
/**
* Lib
*/
$container->registerService('MailAction', function ($c) {
return new MailAction($c->query('AppName'), $c->query('L10N'), $c->query('Config'));
});
$container->registerService('FileAction', function ($c) {
return new FileAction($c->query('AppName'), $c->query('L10N'), $c->query('Config'), $c->query('Logger'));
});
/**
* Core
*/
$container->registerService('Config', function ($c) {
return $c->query('ServerContainer')->getConfig();
});
$container->registerService('L10N', function ($c) {
return $c->query('ServerContainer')->getL10N($c->query('AppName'));
});
$container->registerService('Logger', function ($c) {
return $c->query('ServerContainer')->getLogger();
});
}
示例14: __construct
public function __construct(array $urlParams = array())
{
parent::__construct('files', $urlParams);
$container = $this->getContainer();
$server = $container->getServer();
/**
* Controllers
*/
$container->registerService('APIController', function (IContainer $c) use($server) {
return new ApiController($c->query('AppName'), $c->query('Request'), $server->getUserSession(), $c->query('TagService'), $server->getPreviewManager(), $server->getShareManager(), $server->getConfig());
});
$container->registerService('ViewController', function (IContainer $c) use($server) {
return new ViewController($c->query('AppName'), $c->query('Request'), $server->getURLGenerator(), $server->getNavigationManager(), $c->query('L10N'), $server->getConfig(), $server->getEventDispatcher(), $server->getUserSession(), $server->getAppManager(), $server->getRootFolder());
});
/**
* Core
*/
$container->registerService('L10N', function (IContainer $c) {
return $c->query('ServerContainer')->getL10N($c->query('AppName'));
});
/**
* Services
*/
$container->registerService('Tagger', function (IContainer $c) {
return $c->query('ServerContainer')->getTagManager()->load('files');
});
$container->registerService('TagService', function (IContainer $c) {
$homeFolder = $c->query('ServerContainer')->getUserFolder();
return new TagService($c->query('ServerContainer')->getUserSession(), $c->query('Tagger'), $homeFolder);
});
/*
* Register capabilities
*/
$container->registerCapability('OCA\\Files\\Capabilities');
}
示例15: __construct
/**
* @param array $urlParams
*/
public function __construct(array $urlParams = array())
{
parent::__construct('settings', $urlParams);
$container = $this->getContainer();
/**
* Controllers
*/
$container->registerService('MailSettingsController', function (SimpleContainer $c) {
return new MailSettingsController($c->query('AppName'), $c->query('Request'), $c->query('L10N'), $c->query('Config'), $c->query('UserSession'), $c->query('Defaults'), $c->query('Mail'), $c->query('DefaultMailAddress'));
});
/**
* Core class wrappers
*/
$container->registerService('Config', function (SimpleContainer $c) {
return $c->query('ServerContainer')->getConfig();
});
$container->registerService('L10N', function (SimpleContainer $c) {
return $c->query('ServerContainer')->getL10N('settings');
});
$container->registerService('UserSession', function (SimpleContainer $c) {
return $c->query('ServerContainer')->getUserSession();
});
$container->registerService('Mail', function (SimpleContainer $c) {
return new \OC_Mail();
});
$container->registerService('Defaults', function (SimpleContainer $c) {
return new \OC_Defaults();
});
$container->registerService('DefaultMailAddress', function (SimpleContainer $c) {
return Util::getDefaultEmailAddress('no-reply');
});
}