/** * CSS Processor * * @param string $css * @param theme_config $theme * @return string */ function theme_snap_process_css($css, theme_config $theme) { // Set the background image for the logo. $logo = $theme->setting_file_url('logo', 'logo'); $css = theme_snap_set_logo($css, $logo); // Set the background image for the poster. $css = \theme_snap\local::site_coverimage_css($css); // Set the custom css. if (!empty($theme->settings->customcss)) { $customcss = $theme->settings->customcss; } else { $customcss = null; } $css = theme_snap_set_customcss($css, $customcss); // Set bootswatch. $css = theme_snap_set_bootswatch($css, theme_snap_get_bootswatch_variables($theme)); return $css; }
public function test_poster_image_upload() { $this->resetAfterTest(); $beforeupload = local::site_coverimage_original(); $this->assertFalse($beforeupload); $fixtures = ['bpd_bikes_3888px.jpg' => true, 'bpd_bikes_1381px.jpg' => true, 'bpd_bikes_1380px.jpg' => false, 'bpd_bikes_1379px.jpg' => false, 'bpd_bikes_1280px.jpg' => false, 'testpng.png' => false, 'testpng_small.png' => false, 'testgif.gif' => false, 'testgif_small.gif' => false]; foreach ($fixtures as $filename => $shouldberesized) { $this->fake_site_image_setting_upload($filename); $css = '[[setting:poster]]'; $css = local::site_coverimage_css($css); $this->assertContains('/theme_snap/coverimage/', $css); $ext = pathinfo($filename, PATHINFO_EXTENSION); $this->assertContains("/site-image.{$ext}", $css); if ($shouldberesized) { $image = local::site_coverimage(); $finfo = $image->get_imageinfo(); $this->assertSame(1280, $finfo['width']); } } $this->fake_site_image_setting_cleared(); $css = '[[setting:poster]]'; $css = local::site_coverimage_css($css); $this->assertSame('', $css); $this->assertFalse(local::site_coverimage()); }
"/> <?php echo $OUTPUT->standard_head_html(); ?> <meta name="theme-color" content="<?php echo $PAGE->theme->settings->themecolor; ?> "> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href='//fonts.googleapis.com/css?family=Roboto:500,100,400,300' rel='stylesheet' type='text/css'> <?php // Output course cover image? if ($COURSE->id != SITEID) { $coverimagecss = \theme_snap\local::course_coverimage_css($COURSE->id); } else { $coverimagecss = \theme_snap\local::site_coverimage_css(); } if (!empty($coverimagecss)) { echo "<style>{$coverimagecss}</style>"; } ?> </head> <body <?php echo $OUTPUT->body_attributes(); ?> > <?php echo $OUTPUT->standard_top_of_body_html();