| 1 |
<?php |
| 2 |
|
| 3 |
// Exit if accessed directly. |
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; |
| 6 |
} |
| 7 |
|
| 8 |
/** |
| 9 |
* Admin builder preview CSS for the Beacon Single (1 Column) campaign template. |
| 10 |
* |
| 11 |
* @package Charitable |
| 12 |
* @author WP Charitable LLC |
| 13 |
* @since 1.8.12 |
| 14 |
*/ |
| 15 |
|
| 16 |
header( 'Content-type: text/css; charset: UTF-8' ); |
| 17 |
|
| 18 |
if ( ! function_exists( 'charitable_sanitize_hex_color' ) ) { |
| 19 |
function charitable_sanitize_hex_color( $color ) { |
| 20 |
$color = trim( $color ); |
| 21 |
if ( preg_match( '/^#[a-fA-F0-9]{6}$/', $color ) ) { |
| 22 |
return $color; |
| 23 |
} |
| 24 |
return null; |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
if ( ! function_exists( 'charitable_esc_attr_php' ) ) { |
| 29 |
function charitable_esc_attr_php( $text ) { |
| 30 |
return htmlspecialchars( $text, ENT_QUOTES, 'UTF-8' ); |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
$primary = isset( $_GET['p'] ) ? '#' . substr( preg_replace( '/[^A-Fa-f0-9]/', '', $_GET['p'] ), 0, 6 ) : '#1d3a8a'; // phpcs:ignore |
| 35 |
$secondary = isset( $_GET['s'] ) ? '#' . substr( preg_replace( '/[^A-Fa-f0-9]/', '', $_GET['s'] ), 0, 6 ) : '#0D0D0D'; // phpcs:ignore |
| 36 |
$tertiary = isset( $_GET['t'] ) ? '#' . substr( preg_replace( '/[^A-Fa-f0-9]/', '', $_GET['t'] ), 0, 6 ) : '#5F5F5F'; // phpcs:ignore |
| 37 |
$button = isset( $_GET['b'] ) ? '#' . substr( preg_replace( '/[^A-Fa-f0-9]/', '', $_GET['b'] ), 0, 6 ) : '#1d3a8a'; // phpcs:ignore |
| 38 |
$mobile_width = isset( $_GET['mw'] ) ? intval( $_GET['mw'] ) : 800; // phpcs:ignore |
| 39 |
|
| 40 |
$slug = 'beacon-single'; |
| 41 |
$wrapper = '.charitable-preview.charitable-builder-template-' . $slug . ' #charitable-design-wrap .charitable-campaign-preview'; |
| 42 |
|
| 43 |
?> |
| 44 |
|
| 45 |
.charitable-preview.charitable-builder-template-<?php echo $slug; // phpcs:ignore ?> { |
| 46 |
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; |
| 47 |
} |
| 48 |
|
| 49 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> { |
| 50 |
--charitable-hero-accent: <?php echo $primary; // phpcs:ignore ?>; |
| 51 |
} |
| 52 |
|
| 53 |
/* Hero row in admin preview — keep tight, hide default field padding/borders. */ |
| 54 |
|
| 55 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-preview-header.beacon-hero-row, |
| 56 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-preview-row.beacon-hero-row { |
| 57 |
padding: 0; |
| 58 |
margin: 0; |
| 59 |
border: 0; |
| 60 |
background: transparent; |
| 61 |
overflow: visible; |
| 62 |
} |
| 63 |
|
| 64 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .beacon-hero-row .row, |
| 65 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .beacon-hero-row .column, |
| 66 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .beacon-hero-row .charitable-field-wrap, |
| 67 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .beacon-hero-row .charitable-field { |
| 68 |
padding: 0; |
| 69 |
margin: 0; |
| 70 |
border: 0; |
| 71 |
background: transparent; |
| 72 |
} |
| 73 |
|
| 74 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .beacon-hero-row .charitable-field-campaign-hero { |
| 75 |
width: 100%; |
| 76 |
} |
| 77 |
|
| 78 |
/* Hide the field title on the hero block in preview — the hero IS the visual. */ |
| 79 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .beacon-hero-row .charitable-field-campaign-hero > h4.label-title { |
| 80 |
display: none; |
| 81 |
} |
| 82 |
|
| 83 |
/* Match frontend hero proportions so authors can preview accurate layout. */ |
| 84 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .beacon-hero-row .charitable-campaign-hero { |
| 85 |
min-height: 420px; |
| 86 |
} |
| 87 |
|
| 88 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .beacon-hero-row .charitable-campaign-hero__overlay { |
| 89 |
min-height: 420px; |
| 90 |
} |
| 91 |
|
| 92 |
/* Body row — single-column stack in the admin preview. */ |
| 93 |
|
| 94 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-preview-row.beacon-body-row { |
| 95 |
padding: 32px 24px; |
| 96 |
} |
| 97 |
|
| 98 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .beacon-body-row > .row { |
| 99 |
display: block; |
| 100 |
} |
| 101 |
|
| 102 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .beacon-body-row .column { |
| 103 |
padding: 0; |
| 104 |
border: 0; |
| 105 |
width: 100%; |
| 106 |
max-width: none; |
| 107 |
} |
| 108 |
|
| 109 |
/* Campaign description block — frame the description body (non-headline) with the theme secondary color. */ |
| 110 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .beacon-body-row .charitable-field-campaign-description .charitable-campaign-builder-placeholder-preview-text { |
| 111 |
border: 1px solid <?php echo charitable_esc_attr_php( $secondary ); ?>; |
| 112 |
border-radius: 4px; |
| 113 |
padding: 12px 16px; |
| 114 |
} |
| 115 |
|
| 116 |
/* Donor wall — align the headline + empty-state text with the other body field headlines. */ |
| 117 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .beacon-body-row .charitable-field-donation-wall .charitable-field-donation-wall-placeholder { |
| 118 |
display: block; |
| 119 |
padding-left: 5px; |
| 120 |
} |
| 121 |
|
| 122 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .beacon-body-row h5.charitable-field-template-headline { |
| 123 |
font-size: 22px; |
| 124 |
font-weight: 700; |
| 125 |
margin-bottom: 12px; |
| 126 |
line-height: 1.3; |
| 127 |
} |
| 128 |
|
| 129 |
@media ( max-width: <?php echo intval( $mobile_width ); // phpcs:ignore ?>px ) { |
| 130 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .beacon-body-row > .row { |
| 131 |
display: block; |
| 132 |
} |
| 133 |
} |
| 134 |
|
| 135 |
/* Social sharing — make the placeholder icons visible in the admin preview. */ |
| 136 |
|
| 137 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing { |
| 138 |
display: flex !important; |
| 139 |
align-items: center; |
| 140 |
flex-wrap: wrap; |
| 141 |
gap: 12px; |
| 142 |
} |
| 143 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing .charitable-field-preview-social-sharing-headline-container { |
| 144 |
display: flex; |
| 145 |
align-items: center; |
| 146 |
float: none; |
| 147 |
padding: 0; |
| 148 |
margin: 0; |
| 149 |
} |
| 150 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing .charitable-field-row { |
| 151 |
display: flex; |
| 152 |
align-items: center; |
| 153 |
flex-wrap: wrap; |
| 154 |
gap: 8px; |
| 155 |
float: none; |
| 156 |
width: auto; |
| 157 |
margin: 0; |
| 158 |
padding: 0; |
| 159 |
} |
| 160 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing h5.charitable-field-preview-headline { |
| 161 |
font-size: 14px !important; |
| 162 |
line-height: 1 !important; |
| 163 |
font-weight: 600 !important; |
| 164 |
text-transform: uppercase !important; |
| 165 |
letter-spacing: 0.02em !important; |
| 166 |
margin: 0 8px 0 0 !important; |
| 167 |
padding: 0 !important; |
| 168 |
color: <?php echo $primary; // phpcs:ignore ?>; |
| 169 |
} |
| 170 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing .charitable-social-field-column { |
| 171 |
display: flex; |
| 172 |
align-items: center; |
| 173 |
margin: 0; |
| 174 |
padding: 0; |
| 175 |
} |
| 176 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing .charitable-placeholder { |
| 177 |
width: 24px; |
| 178 |
height: 24px; |
| 179 |
padding: 0; |
| 180 |
display: inline-block; |
| 181 |
line-height: 0; |
| 182 |
box-sizing: border-box; |
| 183 |
} |
| 184 |
|