/** * add an asset * @param string $path * @param string $type * @param string $group * @param int $priority * @param string $slot * @param array $params */ public function add($path, $type, $group = 'head', $priority = 5, $slot = null, $params = null) { if (!isset($this->assets[$group])) { $this->assets[$group] = array(); } if (!isset($this->assets[$group][$type])) { $this->assets[$group][$type] = array(); } $asset = array('path' => $path, 'type' => $type, 'slot' => $slot, 'origin' => '') + ($params ?: array()); if (preg_match('/^(http(s)?:)?\\/\\/.*/i', $path)) { $asset['origin'] = 'external'; $this->assets[$group][$type][$priority][] = $asset; return; } foreach ($this->f3->split($this->f3->get('UI')) as $dir) { if (is_file($view = $this->f3->fixslashes($dir . $path))) { $asset['path'] = ltrim($view, './'); $asset['origin'] = 'internal'; $this->assets[$group][$type][$priority][] = $asset; return; } } // file not found if ($handler = $this->f3->get('ASSETS.onFileNotFound')) { $this->f3->call($handler, array($path, $this)); } $this->assets[$group][$type][$priority][] = $asset; }