function test_stylesheet_path_should_not_touch_absolute_paths() { $url = Assets::stylesheet_path('/some/style.css'); $this->assertEquals(STATIC_ASSETS_URL . 'some/style.css', $url); }
$title = _("Kalender"); $resize = ''; if ($zeiten && !$kalender) { // popup Fenster verkleinern wenn kein Kalender $resize = 'window.resizeTo(' . (($auth->auth["xres"] > 650) ? 780 : 600) . ',160);' . "\n"; $resize .= 'window.moveBy(0,330);' . "\n"; } if (intval($submit) == 1) { $do_submit = 'opener.document.' . $form_name . '.submit();'; $submit = '1'; } else { $do_submit = ''; $submit = ''; } if ($preset_error != '') $zeiten = false; $stylesheet = Assets::stylesheet_path('style.css'); echo <<<EOT <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head> <title>$title</title> <link rel="stylesheet" type="text/css" href="{$stylesheet}"> <script type="text/javascript"> <!-- window.setTimeout("window.close()", 120000); // Fenster automatisch wieder schließen :-) $resize function insert_time_noform() { if (opener) { $jsarray var t; var c = 999; for (i=0; i < document.forms['TimeForm'].elements.timei.length; i++){
/** * Depending on \Studip\ENV, either includes individual script * elements for each JS file in every package, or a single script * element containing the squeezed source code for every package. */ private static function includeSqueezePackages() { global $STUDIP_BASE_PATH; $config_path = "{$STUDIP_BASE_PATH}/config/assets.yml"; $configuration = Configuration::load($config_path); $packager = new Packager($configuration); $javascripts = \Studip\Squeeze\includePackages($packager, self::getSqueezePackages()); $css = array(); foreach (self::getSqueezePackages() as $package) { if (isset($configuration['css'][$package])) { foreach ($configuration['css'][$package] as $filename => $media) { $attributes = array('rel' => 'stylesheet', 'href' => \Studip\Squeeze\shouldPackage() ? $configuration['package_url'] . '/' . $package . '-' . $filename : Assets::stylesheet_path($filename), 'media' => $media); $css[$package . '-' . $filename] = array('name' => 'link', 'attributes' => $attributes); } } } $files = array_merge($css, $javascripts); // When not in development mode, add the current version number to // the assets file, so browser caches will be informed about an // update if (Studip\ENV !== 'development') { $v = preg_replace('/^(\\d+(?:\\.\\d+)*).*$/', '$1', $GLOBALS['SOFTWARE_VERSION']); $files = array_map(function ($file) use($v) { if ($file['name'] === 'link') { $file['attributes']['href'] = URLHelper::getURL($file['attributes']['href'], compact('v'), true); } else { if ($file['name'] === 'script') { $file['attributes']['src'] = URLHelper::getURL($file['attributes']['src'], compact('v'), true); } } return $file; }, $files); } return $files; }
/** * Returns a css link tag per source given as argument. * * Examples: * * Assets::stylesheet('style') => * <link href="/stylesheets/style.css" media="screen" rel="stylesheet"> * * Assets::stylesheet('style', array('media' => 'all')) => * <link href="/stylesheets/style.css" media="all" rel="stylesheet"> * * Assets::stylesheet('random.styles', '/css/stylish') => * <link href="/stylesheets/random.styles" media="screen" rel="stylesheet"> * <link href="/css/stylish.css" media="screen" rel="stylesheet"> */ static function stylesheet($atLeastOneArgument) { $sources = func_get_args(); $sourceOptions = func_num_args() > 1 && is_array($sources[func_num_args() - 1]) ? array_pop($sources) : array(); $html = ''; foreach ($sources as $source) { $source = Assets::stylesheet_path($source); $opt = array_merge(array('rel' => 'stylesheet', 'media' => 'screen', 'href' => $source), $sourceOptions); $html .= Assets::tag('link', $opt) . "\n"; } return $html; }