public static function enable() { Backend::addScript(SITE_LINK . '/js/jquery.js'); Backend::addScript(SITE_LINK . '/js/wmd.component.js'); Backend::addScript(SITE_LINK . '/js/wmd/wmd.js'); Backend::addStyle(SITE_LINK . '/css/wmd.css'); }
public function html_list($result) { Backend::add('Sub Title', $result->getMeta('name')); Backend::add('TabLinks', $this->getTabLinks(Controller::$action)); Backend::addScript(SITE_LINK . '/js/jquery.js'); Backend::addScript(SITE_LINK . '/js/image_list.js'); Backend::addStyle(SITE_LINK . '/css/image_list.css'); Backend::addContent(Render::renderFile('image.list.tpl.php', array('db_object' => $result))); }
/** * This function adds all styles and scripts to the HTML. It also retrieves primary and secondary links from the App * */ public static function hook_post_display($data, $controller) { Backend::addScript(SITE_LINK . '/js/backend.js'); //TODO Add site_link, and other vars, as JS vars Backend::addScriptContent('var site_link = \'' . SITE_LINK . '\';'); //TODO if someone can land a script file in the correct place, he can insert JS at will... $comp_script = '/js/' . Controller::$area . '.component.js'; $comp_style = '/css/' . Controller::$area . '.component.css'; if (file_exists(WEB_FOLDER . $comp_script)) { Backend::addScript(SITE_LINK . $comp_script); } if (file_exists(WEB_FOLDER . $comp_style)) { Backend::addStyle(SITE_LINK . $comp_style); } //Make sure that jquery and backend is right at the top $scripts = array_unique(array_filter(Backend::getScripts())); $against = array(); if (in_array(SITE_LINK . '/js/jquery.js', $scripts)) { $against[] = SITE_LINK . '/js/jquery.js'; } if (in_array(SITE_LINK . '/js/backend.js', $scripts)) { $against[] = SITE_LINK . '/js/backend.js'; } $scripts = array_unique(array_merge($against, $scripts)); Backend::add('Styles', array_unique(array_filter(Backend::getStyles()))); Backend::add('Scripts', $scripts); Backend::add('ScriptContent', array_unique(array_filter(Backend::getScriptContent()))); $primary = Links::get('primary'); $secondary = Links::get('secondary'); $tertiary = Links::get('tertiary'); $app_class = ConfigValue::get('settings.Class', 'Application'); if (class_exists($app_class, true) && method_exists($app_class, 'getLinks')) { $app_pri = call_user_func(array($app_class, 'getLinks'), 'primary'); $app_sec = call_user_func(array($app_class, 'getLinks'), 'secondary'); $app_tri = call_user_func(array($app_class, 'getLinks'), 'tertiary'); } else { $app_pri = false; $app_sec = false; $app_tri = false; } $primary = array_merge($primary, is_array($app_pri) ? $app_pri : array()); $secondary = array_merge($secondary, is_array($app_sec) ? $app_sec : array()); $tertiary = array_merge($tertiary, is_array($app_tri) ? $app_tri : array()); Backend::add('primary_links', $primary); Backend::add('secondary_links', $secondary); Backend::add('tertiary_links', $tertiary); return $data; }