Exemple #1
0
 /**
  * Get the URL for the cached file
  * 
  * This automatically registers the view with Elgg's simplecache.
  * 
  * @example
  * 		$blog_js = elgg_get_simplecache_url('js', 'blog/save_draft');
  *		elgg_register_js('elgg.blog', $blog_js);
  *		elgg_load_js('elgg.blog');
  *
  * @param string $type The file type: css or js
  * @param string $view The view name after css/ or js/
  * @return string
  */
 function getUrl($type, $view)
 {
     // handle file type passed with view name
     if (($type === 'js' || $type === 'css') && 0 === strpos($view, $type . '/')) {
         $view = substr($view, strlen($type) + 1);
     }
     elgg_register_simplecache_view("{$type}/{$view}");
     return _elgg_get_simplecache_root() . "{$type}/{$view}";
 }
Exemple #2
0
 /**
  * AMD Config factory
  * 
  * @param \Elgg\Di\ServiceProvider $c Dependency injection container
  * @return \Elgg\Amd\Config
  */
 protected function getAmdConfig(\Elgg\Di\ServiceProvider $c)
 {
     $obj = new \Elgg\Amd\Config();
     $obj->setBaseUrl(_elgg_get_simplecache_root() . "js/");
     return $obj;
 }
 /**
  * AMD Config factory
  *
  * @param Elgg_Di_ServiceProvider $c Dependency injection container
  * @return Elgg_Amd_Config
  */
 protected function getAmdConfig(Elgg_Di_ServiceProvider $c)
 {
     $obj = new Elgg_Amd_Config();
     $obj->setBaseUrl(_elgg_get_simplecache_root() . "js/");
     return $obj;
 }