Elgg  Version 4.3
external_files.php
Go to the documentation of this file.
1 <?php
31  $src = elgg_extract('src', $config);
32 
33  if ($src) {
35  _elgg_services()->amdConfig->addPath($name, $url);
36  }
37 
38  // shimmed module
39  if (isset($config['deps']) || isset($config['exports'])) {
40  _elgg_services()->amdConfig->addShim($name, $config);
41  }
42 }
43 
52  _elgg_services()->amdConfig->addDependency($name);
53 }
54 
63  _elgg_services()->amdConfig->removeDependency($name);
64 }
65 
75 function elgg_require_css(string $view) {
76  $view_name = "{$view}.css";
77  if (!elgg_view_exists($view_name)) {
78  $view_name = $view;
79  }
80 
81  elgg_register_external_file('css', $view, elgg_get_simplecache_url($view_name));
82  elgg_load_external_file('css', $view);
83 }
84 
94 function elgg_unrequire_css(string $view) {
95  elgg_unregister_external_file('css', $view);
96 }
97 
109 function elgg_register_external_file(string $type, string $name, string $url, string $location = ''): bool {
110  if (empty($location)) {
111  $location = $type === 'js' ? 'footer' : 'head';
112  }
113 
114  return _elgg_services()->externalFiles->register($type, $name, $url, $location);
115 }
116 
126 function elgg_unregister_external_file(string $type, string $name): bool {
127  return _elgg_services()->externalFiles->unregister($type, $name);
128 }
129 
139 function elgg_load_external_file(string $type, string $name): void {
140  _elgg_services()->externalFiles->load($type, $name);
141 }
142 
152 function elgg_get_loaded_external_resources(string $type, string $location): array {
153  return _elgg_services()->externalFiles->getLoadedResources($type, $location);
154 }
elgg_view_exists($view, $viewtype= '', $recurse=true)
Returns whether the specified view exists.
Definition: views.php:152
elgg_require_css(string $view)
Register a CSS view name to be included in the HTML head.
elgg_normalize_url($url)
Definition: output.php:153
if(!$user||!$user->canDelete()) $name
Definition: delete.php:22
elgg_unregister_external_file(string $type, string $name)
Unregister an external file.
elgg_get_simplecache_url($view, $subview= '')
Get the URL for the cached view.
Definition: cache.php:139
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
Definition: LICENSE.txt:215
$src
Display a page in an embedded window.
Definition: iframe.php:8
$type
Definition: delete.php:21
elgg_register_external_file(string $type, string $name, string $url, string $location= '')
Core registration function for external files.
$config
Advanced site settings, debugging section.
Definition: debugging.php:6
if(!empty($avatar)&&!$avatar->isValid()) elseif(empty($avatar)) if(!$owner->saveIconFromUploadedFile('avatar')) if(!elgg_trigger_event('profileiconupdate', $owner->type, $owner)) $view
Definition: upload.php:39
elgg_unrequire_js($name)
Cancel a request to load an AMD module onto the page.
elgg_load_external_file(string $type, string $name)
Load an external resource for use on this page.
elgg_require_js($name)
Request that Elgg load an AMD module onto the page.
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:547
$location
Definition: member.php:29
elgg_unrequire_css(string $view)
Unregister a CSS view name to be included in the HTML head.
foreach($plugin_guids as $guid) if(empty($deactivated_plugins)) $url
Definition: deactivate.php:39
_elgg_services()
Get the global service provider.
Definition: elgglib.php:638
elgg_get_loaded_external_resources(string $type, string $location)
Get external resource descriptors.
elgg_define_js($name, $config)
Helper functions for external files like css/js.