65 $this->
setValue(
'autoloadManager', $autoload_manager);
70 return new \ElggStaticVariableCache(
'access');
74 return new \Elgg\Database\AccessCollections($c->config->get(
'site_guid'));
79 $this->
setClassName(
'adminNotices',
'\Elgg\Database\AdminNotices');
82 $obj = new \Elgg\Amd\Config();
83 $obj->setBaseUrl($c->simpleCache->getRoot() .
"js/");
87 $this->
setClassName(
'annotations',
'\Elgg\Database\Annotations');
93 $this->
setClassName(
'configTable',
'\Elgg\Database\ConfigTable');
103 $pool = new \Elgg\Cache\MemoryPool();
104 return new \Elgg\Database\Datalist($pool, $db, $c->logger,
"{$dbprefix}datalists");
109 $db_config = new \Elgg\Database\Config($CONFIG);
110 return new \Elgg\Database($db_config, $c->logger);
113 $this->
setClassName(
'entityTable',
'\Elgg\Database\EntityTable');
121 return new \Elgg\Assets\ExternalFiles($CONFIG);
134 $this->
setClassName(
'metadataCache',
'\ElggVolatileMetadataCache');
138 return new \Elgg\Database\MetadataTable(
139 $c->metadataCache, $c->db, $c->entityTable, $c->events, $c->metastringsTable, $c->session);
144 $pool = new \Elgg\Cache\MemoryPool();
145 return new \Elgg\Database\MetastringsTable($pool, $c->db);
151 $queue = new \Elgg\Queue\DatabaseQueue($queue_name, $c->db);
152 $sub = new \Elgg\Notifications\SubscriptionsService($c->db);
153 return new \Elgg\Notifications\NotificationsService($sub, $queue, $c->hooks, $c->access);
157 return new \Elgg\EntityPreloader(array(
'owner_guid'));
161 $global_cookies_config =
_elgg_services()->config->get(
'cookies');
162 $cookie_config = $global_cookies_config[
'remember_me'];
163 $cookie_name = $cookie_config[
'name'];
164 $cookie_token = $c->request->cookies->get($cookie_name,
'');
165 return new \Elgg\PersistentLoginService(
166 $c->db, $c->session, $c->crypto, $cookie_config, $cookie_token);
170 if (!function_exists(
'password_hash')) {
171 $root = $c->config->getRootPath();
172 require "{$root}vendor/ircmaxell/password-compat/lib/password.php";
174 return new \Elgg\PasswordService();
177 $this->
setClassName(
'plugins',
'\Elgg\Database\Plugins');
180 return new \Elgg\Database\QueryCounter($c->db);
183 $this->
setClassName(
'relationshipsTable',
'\Elgg\Database\RelationshipsTable');
185 $this->
setFactory(
'request',
'\Elgg\Http\Request::createFromGlobals');
189 return new \Elgg\Router($c->hooks);
194 $params = $c->config->get(
'cookies')[
'session'];
196 if (in_array(
$key, array(
'path',
'domain',
'secure',
'httponly'))) {
202 $handler = new \Elgg\Http\DatabaseSessionHandler($c->db);
204 return new \ElggSession($storage);
207 $this->
setClassName(
'simpleCache',
'\Elgg\Cache\SimpleCache');
209 $this->
setClassName(
'siteSecret',
'\Elgg\Database\SiteSecret');
211 $this->
setClassName(
'stickyForms',
'Elgg\Forms\StickyForms');
213 $this->
setClassName(
'subtypeTable',
'\Elgg\Database\SubtypeTable');
215 $this->
setClassName(
'systemCache',
'\Elgg\Cache\SystemCache');
217 $this->
setClassName(
'translator',
'\Elgg\I18n\Translator');
219 $this->
setClassName(
'usersTable',
'\Elgg\Database\UsersTable');
222 return new \Elgg\ViewsService($c->hooks, $c->logger);
237 $svcs[
'hooks'] = new \Elgg\PluginHooksService();
238 $svcs[
'logger'] = new \Elgg\Logger($svcs[
'hooks']);
239 $svcs[
'hooks']->setLogger($svcs[
'logger']);
240 $svcs[
'events'] = new \Elgg\EventsService();
241 $svcs[
'events']->setLogger($svcs[
'logger']);
243 foreach ($svcs as
$key => $service) {
246 return $svcs[$service_needed];
if(!$autoload_available) _elgg_services()
__construct(\Elgg\AutoloadManager $autoload_manager)
Constructor.
resolveLoggerDependencies($service_needed)
Returns the first requested service of the logger, events, and hooks.
setClassName($name, $class_name, $shared=true)
Set a factory based on instantiating a class with no arguments.
setValue($name, $value)
Set a value to be returned without modification.
elgg require
Throw an error if the required package isn't present.
elgg global
Pointer to the global context.
setFactory($name, $callable, $shared=true)
Set a factory to generate a value when the container is read.