| 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 ) : '#5C8AF3'; |
| 55 |
$secondary = isset( $_GET['s'] ) ? '#' . substr( preg_replace( '/[^A-Fa-f0-9]/', '', $_GET['s'] ), 0, 6 ) : '#21458F'; |
| 56 |
$tertiary = isset( $_GET['t'] ) ? '#' . substr( preg_replace( '/[^A-Fa-f0-9]/', '', $_GET['t'] ), 0, 6 ) : '#F7F7F7'; |
| 57 |
$button = isset( $_GET['b'] ) ? '#' . substr( preg_replace( '/[^A-Fa-f0-9]/', '', $_GET['b'] ), 0, 6 ) : '#5C8AF3'; |
| 58 |
|
| 59 |
$slug = 'medical-bills'; // 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 |
/* background-color: <?php echo $primary; ?>; */ |
| 82 |
color: #606060; |
| 83 |
} |
| 84 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header h1, |
| 85 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header h2, |
| 86 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header h3, |
| 87 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header h4, |
| 88 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header h5, |
| 89 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header h6 { |
| 90 |
color: <?php echo $secondary; ?> |
| 91 |
} |
| 92 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h1, |
| 93 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h2, |
| 94 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h3, |
| 95 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h4, |
| 96 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h5, |
| 97 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h6 { |
| 98 |
color: <?php echo $secondary; ?>; |
| 99 |
} |
| 100 |
|
| 101 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content > * { |
| 102 |
color: black; |
| 103 |
} |
| 104 |
|
| 105 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header h5 { |
| 106 |
|
| 107 |
} |
| 108 |
|
| 109 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .placeholder { |
| 110 |
|
| 111 |
} |
| 112 |
|
| 113 |
/* aligns */ |
| 114 |
|
| 115 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-preview-align-left > div { |
| 116 |
|
| 117 |
} |
| 118 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-preview-align-center > div { |
| 119 |
|
| 120 |
} |
| 121 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-preview-align-right > div { |
| 122 |
|
| 123 |
} |
| 124 |
|
| 125 |
/* column specifics */ |
| 126 |
|
| 127 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .column[data-column-id="0"] { |
| 128 |
|
| 129 |
} |
| 130 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .column[data-column-id="0"] .charitable-field-photo { |
| 131 |
|
| 132 |
} |
| 133 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .column[data-column-id="1"] { |
| 134 |
|
| 135 |
} |
| 136 |
|
| 137 |
/* tab nav */ |
| 138 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article#charitable-preview-tab-container { |
| 139 |
|
| 140 |
} |
| 141 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.charitable-campaign-preview-nav { |
| 142 |
background-color: <?php echo $tertiary; ?>; |
| 143 |
} |
| 144 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.charitable-campaign-preview-nav ul li { |
| 145 |
border-right: 1px solid #EDECEC; |
| 146 |
} |
| 147 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.charitable-campaign-preview-nav ul li a { |
| 148 |
|
| 149 |
color: <?php echo $secondary; ?> |
| 150 |
} |
| 151 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav li.active { |
| 152 |
|
| 153 |
} |
| 154 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav li.active, |
| 155 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.charitable-campaign-preview-nav ul li.active { |
| 156 |
background-color: <?php echo $primary; ?>; |
| 157 |
|
| 158 |
} |
| 159 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.charitable-campaign-preview-nav ul li.active a, |
| 160 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.charitable-campaign-preview-nav ul li:hover a { |
| 161 |
color: white; |
| 162 |
|
| 163 |
} |
| 164 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article .tab-content { |
| 165 |
color: #76838B; |
| 166 |
|
| 167 |
} |
| 168 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article .tab-content ul { |
| 169 |
|
| 170 |
} |
| 171 |
|
| 172 |
/* tab sizes / styles */ |
| 173 |
|
| 174 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.tab-style-medium li { |
| 175 |
|
| 176 |
} |
| 177 |
|
| 178 |
|
| 179 |
/* headlines in general */ |
| 180 |
|
| 181 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> h5.charitable-field-preview-headline { |
| 182 |
color: <?php echo $secondary; ?>; |
| 183 |
} |
| 184 |
|
| 185 |
/* field: campaign title */ |
| 186 |
|
| 187 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-campaign-title h1 { |
| 188 |
|
| 189 |
color: <?php echo $secondary; ?>; |
| 190 |
|
| 191 |
} |
| 192 |
|
| 193 |
/* field: campaign description */ |
| 194 |
|
| 195 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-campaign-description h5.charitable-field-preview-headline { |
| 196 |
|
| 197 |
} |
| 198 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-campaign-description .charitable-campaign-builder-placeholder-preview-text { |
| 199 |
|
| 200 |
} |
| 201 |
|
| 202 |
|
| 203 |
/* field: text */ |
| 204 |
|
| 205 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-text .charitable-campaign-builder-placeholder-preview-text { |
| 206 |
color: #76838B; |
| 207 |
|
| 208 |
} |
| 209 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-text h5.charitable-field-preview-headline { |
| 210 |
color: <?php echo $primary; ?>; |
| 211 |
} |
| 212 |
|
| 213 |
|
| 214 |
/* field: button */ |
| 215 |
|
| 216 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-donate-button .charitable-field-preview-donate-button span.placeholder.button { |
| 217 |
background-color: <?php echo $button; ?> !important; |
| 218 |
border-color: <?php echo $button; ?> !important; |
| 219 |
color: <?php echo charitable_get_constracting_text_color($button); ?>; |
| 220 |
} |
| 221 |
|
| 222 |
/* field: photo */ |
| 223 |
|
| 224 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-photo .primary-image { |
| 225 |
|
| 226 |
|
| 227 |
} |
| 228 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-photo .primary-image img { |
| 229 |
|
| 230 |
} |
| 231 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content .charitable-field.charitable-field-photo .primary-image img { |
| 232 |
|
| 233 |
} |
| 234 |
|
| 235 |
|
| 236 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-photo .charitable-preview-align-center .primary-image-container { |
| 237 |
|
| 238 |
} |
| 239 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-photo .charitable-preview-align-left .primary-image-container { |
| 240 |
|
| 241 |
} |
| 242 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-photo .charitable-preview-align-right .primary-image-container { |
| 243 |
|
| 244 |
} |
| 245 |
|
| 246 |
/* field: photo */ |
| 247 |
|
| 248 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header .primary-image-container { |
| 249 |
|
| 250 |
} |
| 251 |
|
| 252 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content .primary-image-container { |
| 253 |
|
| 254 |
} |
| 255 |
|
| 256 |
/* field: progress bar */ |
| 257 |
|
| 258 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress-bar-info-row div.campaign-percent-raised { |
| 259 |
|
| 260 |
} |
| 261 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress-bar-info-row div.campaign-goal { |
| 262 |
color: <?php echo $primary; ?>; |
| 263 |
|
| 264 |
} |
| 265 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress { |
| 266 |
|
| 267 |
} |
| 268 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress-bar { |
| 269 |
background-color: <?php echo $primary; ?>; |
| 270 |
} |
| 271 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress-bar span { |
| 272 |
background-color: transparent; |
| 273 |
} |
| 274 |
|
| 275 |
/* field: social linking */ |
| 276 |
|
| 277 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-linking { |
| 278 |
|
| 279 |
} |
| 280 |
|
| 281 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-linking .charitable-field-preview-social-linking-headline-container { |
| 282 |
|
| 283 |
} |
| 284 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-linking .charitable-field-row { |
| 285 |
|
| 286 |
} |
| 287 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-linking h5.charitable-field-preview-headline { |
| 288 |
|
| 289 |
} |
| 290 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-linking .charitable-placeholder { |
| 291 |
|
| 292 |
} |
| 293 |
|
| 294 |
/* social icons */ |
| 295 |
|
| 296 |
<?php |
| 297 |
// Include shared social icons CSS with dark icon style. |
| 298 |
$icon_style = 'dark'; |
| 299 |
include dirname( __FILE__ ) . '/partials/social-icons.php'; |
| 300 |
?> |
| 301 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-linking .charitable-placeholder { |
| 302 |
padding: 10px; |
| 303 |
} |
| 304 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-linking .charitable-field-preview-social-linking-headline-container.charitable-placeholder { |
| 305 |
padding-left: 0; |
| 306 |
padding-top: 6px; |
| 307 |
padding-bottom: 0; |
| 308 |
padding-right: 0; |
| 309 |
} |
| 310 |
|
| 311 |
|
| 312 |
/* field: social sharing */ |
| 313 |
|
| 314 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing { |
| 315 |
|
| 316 |
} |
| 317 |
|
| 318 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing .charitable-field-preview-social-sharing-headline-container { |
| 319 |
|
| 320 |
} |
| 321 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing .charitable-field-row { |
| 322 |
|
| 323 |
} |
| 324 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing h5.charitable-field-preview-headline { |
| 325 |
|
| 326 |
} |
| 327 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing .charitable-placeholder { |
| 328 |
|
| 329 |
} |
| 330 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing .charitable-placeholder { |
| 331 |
padding: 10px; |
| 332 |
} |
| 333 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing h5.charitable-field-preview-headline { |
| 334 |
padding-left: 0px; |
| 335 |
padding-top: 6px; |
| 336 |
padding-bottom: 0; |
| 337 |
padding-right: 5px; |
| 338 |
} |
| 339 |
/* field: campaign summary */ |
| 340 |
|
| 341 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary { |
| 342 |
|
| 343 |
} |
| 344 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary div { |
| 345 |
|
| 346 |
} |
| 347 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary div span { |
| 348 |
color: <?php echo $secondary; ?>; |
| 349 |
|
| 350 |
} |
| 351 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary .campaign-summary-item { |
| 352 |
|
| 353 |
} |
| 354 |
|
| 355 |
/* field: donate amount */ |
| 356 |
|
| 357 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-donate-amount label, |
| 358 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-donate-amount input.custom-donation-input[type="text"] { |
| 359 |
color: <?php echo $secondary; ?>; |
| 360 |
border: 1px solid <?php echo $secondary; ?> !important; |
| 361 |
} |
| 362 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-donate-amount ul li.suggested-donation-amount.selected { |
| 363 |
background-color: <?php echo $primary; ?>; |
| 364 |
} |
| 365 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-donate-amount ul li.suggested-donation-amount.selected span.amount { |
| 366 |
color: <?php echo $tertiary; ?>; |
| 367 |
} |
| 368 |
|
| 369 |
// @codingStandardsIgnoreEnd |