← All changes
|
includes/css-templates/frontend/simple-2-col-header.php
+26
-5
1.8.12.1
→
1.8.13
View file →
| @@ -17,12 +17,12 @@ | ||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | header( 'Content-type: text/css; charset: UTF-8' ); |
| 20 | 20 | |
| 21 | -$primary = isset( $_GET['p'] ) ? '#' . preg_replace( '/[^A-Za-z0-9 ]/', '', $_GET['p'] ) : '#F58A07'; // phpcs:ignore | |
| 22 | -$secondary = isset( $_GET['s'] ) ? '#' . preg_replace( '/[^A-Za-z0-9 ]/', '', $_GET['s'] ) : '#1D3444'; // phpcs:ignore | |
| 23 | -$tertiary = isset( $_GET['t'] ) ? '#' . preg_replace( '/[^A-Za-z0-9 ]/', '', $_GET['t'] ) : '#5B5B5B'; // phpcs:ignore | |
| 24 | -$button = isset( $_GET['b'] ) ? '#' . preg_replace( '/[^A-Za-z0-9 ]/', '', $_GET['b'] ) : '#F58A07'; // phpcs:ignore | |
| 21 | +$primary = isset( $_GET['p'] ) ? '#' . substr( preg_replace( '/[^A-Fa-f0-9]/', '', $_GET['p'] ), 0, 6 ) : '#F58A07'; // phpcs:ignore | |
| 22 | +$secondary = isset( $_GET['s'] ) ? '#' . substr( preg_replace( '/[^A-Fa-f0-9]/', '', $_GET['s'] ), 0, 6 ) : '#1D3444'; // phpcs:ignore | |
| 23 | +$tertiary = isset( $_GET['t'] ) ? '#' . substr( preg_replace( '/[^A-Fa-f0-9]/', '', $_GET['t'] ), 0, 6 ) : '#5B5B5B'; // phpcs:ignore | |
| 24 | +$button = isset( $_GET['b'] ) ? '#' . substr( preg_replace( '/[^A-Fa-f0-9]/', '', $_GET['b'] ), 0, 6 ) : '#F58A07'; // phpcs:ignore | |
| 25 | 25 | $mobile_width = isset( $_GET['mw'] ) ? intval( $_GET['mw'] ) : 800; // phpcs:ignore |
| 26 | 26 | |
| 27 | 27 | $charitable_slug = 'simple-2-col-header'; |
| 28 | 28 | $charitable_wrapper = '.charitable-campaign-wrap.template-' . $charitable_slug; |
| @@ -32,10 +32,31 @@ | ||
| 32 | 32 | |
| 33 | 33 | // .charitable-field ----------> .charitable-campaign-field |
| 34 | 34 | // .charitable-preview-* ----------> .charitable-campaign-* |
| 35 | 35 | |
| 36 | -require_once ('../../admin/campaign-builder/templates/functions-campaign-templates.php'); | |
| 36 | +require_once dirname( __DIR__, 2 ) . '/admin/campaign-builder/templates/functions-campaign-templates.php'; | |
| 37 | 37 | |
| 38 | +?> | |
| 39 | + | |
| 40 | +<?php | |
| 41 | +/* | |
| 42 | + * Headline colour. Emitted ONLY when the campaign actually configured a primary | |
| 43 | + * colour (the endpoint omits 'p' otherwise), so a campaign that customised nothing | |
| 44 | + * falls back to the historic #000 in base.css and renders byte-identical. The hex | |
| 45 | + * guard stops a malformed 'p' from emitting an invalid token, which would make the | |
| 46 | + * headline inherit the theme's colour instead of falling back. | |
| 47 | + * | |
| 48 | + * Emitted at the top of the stylesheet rather than appended at the end, because | |
| 49 | + * save-the-museum.php has an unclosed rule near its end that would otherwise nest | |
| 50 | + * this declaration inside it. | |
| 51 | + */ | |
| 52 | +if ( isset( $_GET['p'] ) && preg_match( '/^#[A-Fa-f0-9]{3,6}$/', $primary ) ) : // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 53 | + ?> | |
| 54 | +<?php echo $charitable_wrapper; // phpcs:ignore ?> { | |
| 55 | + --charitable_campaign_theme_headline: <?php echo $primary; // phpcs:ignore ?>; | |
| 56 | +} | |
| 57 | + <?php | |
| 58 | +endif; | |
| 38 | 59 | ?> |
| 39 | 60 | |
| 40 | 61 | .charitable-preview.charitable-builder-template-<?php echo $charitable_slug; // phpcs:ignore ?> { /* everything wraps in this */ |
| 41 | 62 | |