| 1 |
<?php |
| 2 |
|
| 3 |
// Exit if accessed directly. |
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; |
| 6 |
} |
| 7 |
|
| 8 |
/** |
| 9 |
* Display custom CSS. |
| 10 |
* |
| 11 |
* @package Charitable |
| 12 |
* @author WP Charitable LLC |
| 13 |
* @since 1.8.0 |
| 14 |
* @version 1.8.3.7 |
| 15 |
*/ |
| 16 |
|
| 17 |
header( 'Content-type: text/css; charset: UTF-8' ); |
| 18 |
|
| 19 |
if ( ! function_exists( 'charitable_sanitize_hex_color' ) ) { |
| 20 |
/** |
| 21 |
* Sanitize a hex color. |
| 22 |
* |
| 23 |
* @param string $color The color to sanitize. |
| 24 |
* @return string|null The sanitized color or null if the color is invalid. |
| 25 |
*/ |
| 26 |
function charitable_sanitize_hex_color( $color ) { |
| 27 |
// Ensure the value is a string. |
| 28 |
$color = trim( $color ); |
| 29 |
|
| 30 |
// Check if it's a valid 6-character hex color including the hash. |
| 31 |
if ( preg_match( '/^#[a-fA-F0-9]{6}$/', $color ) ) { |
| 32 |
return $color; |
| 33 |
} |
| 34 |
|
| 35 |
// Optionally return a default color or handle errors. |
| 36 |
return null; // Or return default color. |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
if ( ! function_exists( 'charitable_esc_attr_php' ) ) { |
| 41 |
/** |
| 42 |
* Escapes a string for use in PHP. |
| 43 |
* |
| 44 |
* @param string $text The text to escape. |
| 45 |
* @return string The escaped text. |
| 46 |
*/ |
| 47 |
function charitable_esc_attr_php( $text ) { |
| 48 |
return htmlspecialchars( $text, ENT_QUOTES, 'UTF-8' ); |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 52 |
// @codingStandardsIgnoreStart |
| 53 |
|
| 54 |
$primary = isset( $_GET['p'] ) ? '#' . substr( preg_replace( '/[^A-Fa-f0-9]/', '', $_GET['p'] ), 0, 6 ) : '#F9F6EE'; |
| 55 |
$secondary = isset( $_GET['s'] ) ? '#' . substr( preg_replace( '/[^A-Fa-f0-9]/', '', $_GET['s'] ), 0, 6 ) : '#24231E'; |
| 56 |
$tertiary = isset( $_GET['t'] ) ? '#' . substr( preg_replace( '/[^A-Fa-f0-9]/', '', $_GET['t'] ), 0, 6 ) : '#61AA4F'; |
| 57 |
$button = isset( $_GET['b'] ) ? '#' . substr( preg_replace( '/[^A-Fa-f0-9]/', '', $_GET['b'] ), 0, 6 ) : '#61AA4F'; |
| 58 |
|
| 59 |
$slug = 'environmental'; // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template variable used in CSS selectors. |
| 60 |
$wrapper = '.charitable-preview.charitable-builder-template-' . $slug . ' #charitable-design-wrap .charitable-campaign-preview'; // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template variable used in CSS selectors. |
| 61 |
|
| 62 |
require_once dirname( __DIR__, 2 ) . '/admin/campaign-builder/templates/functions-campaign-templates.php'; |
| 63 |
|
| 64 |
?> |
| 65 |
|
| 66 |
.charitable-preview.charitable-builder-template-<?php echo $slug; ?> { /* everything wraps in this */ |
| 67 |
|
| 68 |
font-family: -apple-system, BlinkMacSystemFont, sans-serif; |
| 69 |
|
| 70 |
} |
| 71 |
|
| 72 |
/* this narrows things down a little to the preview area header/tabs */ |
| 73 |
|
| 74 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> { |
| 75 |
/* field items in preview area */ |
| 76 |
} |
| 77 |
|
| 78 |
/* wide spread changes in header vs tabs */ |
| 79 |
|
| 80 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header { |
| 81 |
color: #606060; |
| 82 |
} |
| 83 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header h1, |
| 84 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header h2, |
| 85 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header h3, |
| 86 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header h4, |
| 87 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header h5, |
| 88 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header h6 { |
| 89 |
color: <?php echo $secondary; ?> |
| 90 |
} |
| 91 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h1, |
| 92 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h2, |
| 93 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h3, |
| 94 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h4, |
| 95 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h5, |
| 96 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h6 { |
| 97 |
color: <?php echo $secondary; ?>; |
| 98 |
} |
| 99 |
|
| 100 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content > * { |
| 101 |
color: black; |
| 102 |
} |
| 103 |
|
| 104 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header h5 { |
| 105 |
|
| 106 |
} |
| 107 |
|
| 108 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .placeholder { |
| 109 |
|
| 110 |
} |
| 111 |
|
| 112 |
/* aligns */ |
| 113 |
|
| 114 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-preview-align-left > div { |
| 115 |
|
| 116 |
} |
| 117 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-preview-align-center > div { |
| 118 |
|
| 119 |
} |
| 120 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-preview-align-right > div { |
| 121 |
|
| 122 |
} |
| 123 |
|
| 124 |
/* column specifics */ |
| 125 |
|
| 126 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .column[data-column-id="0"] { |
| 127 |
background-color: transparent; |
| 128 |
} |
| 129 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .column[data-column-id="0"] .charitable-field-photo { |
| 130 |
|
| 131 |
} |
| 132 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .column[data-column-id="1"] { |
| 133 |
background-color: <?php echo $primary; ?>; |
| 134 |
} |
| 135 |
|
| 136 |
/* headlines in general */ |
| 137 |
|
| 138 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> h5.charitable-field-preview-headline { |
| 139 |
color: <?php echo $secondary; ?>; |
| 140 |
} |
| 141 |
|
| 142 |
/* field: campaign title */ |
| 143 |
|
| 144 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-campaign-title h1 { |
| 145 |
|
| 146 |
color: <?php echo $secondary; ?>; |
| 147 |
|
| 148 |
} |
| 149 |
|
| 150 |
/* field: campaign description */ |
| 151 |
|
| 152 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-campaign-description h5.charitable-field-preview-headline { |
| 153 |
|
| 154 |
} |
| 155 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-campaign-description .charitable-campaign-builder-placeholder-preview-text { |
| 156 |
|
| 157 |
} |
| 158 |
|
| 159 |
|
| 160 |
/* field: text */ |
| 161 |
|
| 162 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-text .charitable-campaign-builder-placeholder-preview-text { |
| 163 |
|
| 164 |
} |
| 165 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-text h5.charitable-field-preview-headline { |
| 166 |
color: <?php echo $tertiary; ?>; |
| 167 |
} |
| 168 |
|
| 169 |
|
| 170 |
/* field: button */ |
| 171 |
|
| 172 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-donate-button .charitable-field-preview-donate-button span.placeholder.button { |
| 173 |
background-color: <?php echo $button; ?> !important; |
| 174 |
border-color: <?php echo $button; ?> !important; |
| 175 |
color: <?php echo charitable_get_constracting_text_color($button); ?>; |
| 176 |
} |
| 177 |
|
| 178 |
/* field: photo */ |
| 179 |
|
| 180 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-photo .primary-image { |
| 181 |
|
| 182 |
|
| 183 |
} |
| 184 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-photo .primary-image img { |
| 185 |
|
| 186 |
} |
| 187 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content .charitable-field.charitable-field-photo .primary-image img { |
| 188 |
|
| 189 |
} |
| 190 |
|
| 191 |
|
| 192 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-photo .charitable-preview-align-center .primary-image-container { |
| 193 |
|
| 194 |
} |
| 195 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-photo .charitable-preview-align-left .primary-image-container { |
| 196 |
|
| 197 |
} |
| 198 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-photo .charitable-preview-align-right .primary-image-container { |
| 199 |
|
| 200 |
} |
| 201 |
|
| 202 |
/* field: photo */ |
| 203 |
|
| 204 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header .primary-image-container { |
| 205 |
|
| 206 |
} |
| 207 |
|
| 208 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content .primary-image-container { |
| 209 |
|
| 210 |
} |
| 211 |
|
| 212 |
/* field: progress bar */ |
| 213 |
|
| 214 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress-bar-info-row div.campaign-percent-raised { |
| 215 |
|
| 216 |
} |
| 217 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress-bar-info-row div.campaign-goal { |
| 218 |
color: <?php echo $primary; ?>; |
| 219 |
|
| 220 |
} |
| 221 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress { |
| 222 |
|
| 223 |
} |
| 224 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress-bar { |
| 225 |
background-color: <?php echo $primary; ?>; |
| 226 |
} |
| 227 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress-bar span { |
| 228 |
background-color: <?php echo $primary; ?>; |
| 229 |
} |
| 230 |
|
| 231 |
/* field: social linking */ |
| 232 |
|
| 233 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-linking { |
| 234 |
|
| 235 |
} |
| 236 |
|
| 237 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-linking .charitable-field-preview-social-linking-headline-container { |
| 238 |
|
| 239 |
} |
| 240 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-linking .charitable-field-row { |
| 241 |
|
| 242 |
} |
| 243 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-linking h5.charitable-field-preview-headline { |
| 244 |
|
| 245 |
} |
| 246 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-linking .charitable-placeholder { |
| 247 |
|
| 248 |
} |
| 249 |
|
| 250 |
/* social icons */ |
| 251 |
|
| 252 |
<?php |
| 253 |
// Include shared social icons CSS with dark icon style. |
| 254 |
$icon_style = 'dark'; |
| 255 |
include dirname( __FILE__ ) . '/partials/social-icons.php'; |
| 256 |
?> |
| 257 |
|
| 258 |
/* field: social sharing */ |
| 259 |
|
| 260 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing { |
| 261 |
|
| 262 |
} |
| 263 |
|
| 264 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing .charitable-field-preview-social-sharing-headline-container { |
| 265 |
|
| 266 |
} |
| 267 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing .charitable-field-row { |
| 268 |
|
| 269 |
} |
| 270 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing h5.charitable-field-preview-headline { |
| 271 |
|
| 272 |
} |
| 273 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing .charitable-placeholder { |
| 274 |
|
| 275 |
} |
| 276 |
|
| 277 |
/* field: campaign summary */ |
| 278 |
|
| 279 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary { |
| 280 |
|
| 281 |
} |
| 282 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary div { |
| 283 |
|
| 284 |
} |
| 285 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary div span { |
| 286 |
color: <?php echo $secondary; ?>; |
| 287 |
|
| 288 |
} |
| 289 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary .campaign-summary-item { |
| 290 |
|
| 291 |
} |
| 292 |
|
| 293 |
/* field: donate amount */ |
| 294 |
|
| 295 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-donate-amount label, |
| 296 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-donate-amount input.custom-donation-input[type="text"] { |
| 297 |
color: <?php echo $secondary; ?>; |
| 298 |
border: 1px solid <?php echo $secondary; ?> !important; |
| 299 |
} |
| 300 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-donate-amount ul li.suggested-donation-amount.selected { |
| 301 |
background-color: <?php echo $primary; ?>; |
| 302 |
} |
| 303 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-donate-amount ul li.suggested-donation-amount.selected span.amount { |
| 304 |
color: <?php echo $tertiary; ?>; |
| 305 |
} |
| 306 |
|
| 307 |
// @codingStandardsIgnoreEnd |