28 if (!($config instanceof \stdClass)) {
29 $config = new \stdClass();
31 $this->CONFIG = $config;
48 if (empty($name) || empty($url)) {
57 $name = trim(strtolower($name));
60 if (!is_numeric($priority)) {
65 $priority = max((
int)$priority, 0);
73 $item->location = $location;
76 if ($this->CONFIG->externals[
$type]->contains(
$item)) {
77 $priority = $this->CONFIG->externals[
$type]->move(
$item, $priority);
79 $priority = $this->CONFIG->externals[
$type]->add(
$item, $priority);
82 $item = new \stdClass();
83 $item->loaded =
false;
85 $item->location = $location;
87 $priority = $this->CONFIG->externals[
$type]->add(
$item, $priority);
92 return $priority !==
false;
107 $name = trim(strtolower($name));
111 unset($this->CONFIG->externals_map[
$type][$name]);
112 return $this->CONFIG->externals[
$type]->remove(
$item);
131 $name = trim(strtolower($name));
137 $item->loaded =
true;
139 $item = new \stdClass();
140 $item->loaded =
true;
142 $item->location =
'';
161 isset($this->CONFIG->externals)
162 && isset($this->CONFIG->externals[
$type])
165 $items = $this->CONFIG->externals[
$type]->getElements();
167 $items = array_filter(
$items,
function($v) use ($location) {
168 return $v->loaded ==
true && $v->location == $location;
171 array_walk(
$items,
function(&$v, $k){
188 if (!isset($this->CONFIG->externals)) {
189 $this->CONFIG->externals = array();
196 if (!isset($this->CONFIG->externals_map)) {
197 $this->CONFIG->externals_map = array();
200 if (!isset($this->CONFIG->externals_map[
$type])) {
201 $this->CONFIG->externals_map[
$type] = array();
__construct(\stdClass $config=null)
Constructor.
if($guid==elgg_get_logged_in_user_guid()) $name
bootstrap($type)
Bootstraps the externals data structure in $CONFIG.
elgg_extract($key, array $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
elgg ElggPriorityList
Priority lists allow you to create an indexed list that can be iterated through in a specific order...
elgg_format_url($url)
Handles formatting of ampersands in urls.
getLoadedFiles($type, $location)
Get external resource descriptors.
load($type, $name)
Load an external resource for use on this page.
unregister($type, $name)
Unregister an external file.