| 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'] ) ? '#' . preg_replace( '/[^A-Za-z0-9 ]/', '', $_GET['p'] ) : '#9F190E'; |
| 55 |
$secondary = isset( $_GET['s'] ) ? '#' . preg_replace( '/[^A-Za-z0-9 ]/', '', $_GET['s'] ) : '#202020'; |
| 56 |
$tertiary = isset( $_GET['t'] ) ? '#' . preg_replace( '/[^A-Za-z0-9 ]/', '', $_GET['t'] ) : '#FFFFFF'; |
| 57 |
$button = isset( $_GET['b'] ) ? '#' . preg_replace( '/[^A-Za-z0-9 ]/', '', $_GET['b'] ) : '#9F190E'; |
| 58 |
|
| 59 |
$slug = 'disaster-relief'; // 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 '../../admin/campaign-builder/templates/functions-campaign-templates.php'; |
| 63 |
?> |
| 64 |
|
| 65 |
.charitable-preview.charitable-builder-template-<?php echo $slug; ?> { /* everything wraps in this */ |
| 66 |
|
| 67 |
font-family: -apple-system, BlinkMacSystemFont, sans-serif; |
| 68 |
|
| 69 |
} |
| 70 |
|
| 71 |
/* this narrows things down a little to the preview area header/tabs */ |
| 72 |
|
| 73 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> { |
| 74 |
/* field items in preview area */ |
| 75 |
} |
| 76 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field { |
| 77 |
display: flex; |
| 78 |
} |
| 79 |
/* wide spread changes in header vs tabs */ |
| 80 |
|
| 81 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header { |
| 82 |
background-color: <?php echo $tertiary; ?>; |
| 83 |
color: #606060; |
| 84 |
} |
| 85 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header h1, |
| 86 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header h2, |
| 87 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header h3, |
| 88 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header h4, |
| 89 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header h5, |
| 90 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header h6 { |
| 91 |
color: <?php echo $secondary; ?> |
| 92 |
} |
| 93 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h1, |
| 94 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h2, |
| 95 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h3, |
| 96 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h4, |
| 97 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h5, |
| 98 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h6 { |
| 99 |
color: <?php echo $primary; ?>; |
| 100 |
} |
| 101 |
|
| 102 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content > * { |
| 103 |
color: black; |
| 104 |
} |
| 105 |
|
| 106 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header h5 { |
| 107 |
font-size: 24px; |
| 108 |
line-height: 28px; |
| 109 |
} |
| 110 |
|
| 111 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .placeholder { |
| 112 |
padding: 0; |
| 113 |
} |
| 114 |
|
| 115 |
/* aligns */ |
| 116 |
|
| 117 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-preview-align-left > div { |
| 118 |
margin-left: 0; |
| 119 |
margin-right: auto; |
| 120 |
} |
| 121 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-preview-align-center > div { |
| 122 |
margin-left: auto; |
| 123 |
margin-right: auto; |
| 124 |
} |
| 125 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-preview-align-right > div { |
| 126 |
margin-left: auto; |
| 127 |
margin-right: 0; |
| 128 |
} |
| 129 |
|
| 130 |
/* column specifics */ |
| 131 |
|
| 132 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .column[data-column-id="0"] { |
| 133 |
flex: 0 0 66%; |
| 134 |
} |
| 135 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .column[data-column-id="1"] { |
| 136 |
border: 1px solid #ECECEC; |
| 137 |
} |
| 138 |
|
| 139 |
/* headlines in general */ |
| 140 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> h5.charitable-field-preview-headline { |
| 141 |
color: <?php echo $primary; ?>; |
| 142 |
} |
| 143 |
|
| 144 |
/* field: campaign title */ |
| 145 |
|
| 146 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-campaign-title h1 { |
| 147 |
margin: 5px 0 5px 0; |
| 148 |
color: <?php echo $primary; ?>; |
| 149 |
font-size: 27px; |
| 150 |
line-height: 29px; |
| 151 |
font-weight: 600; |
| 152 |
} |
| 153 |
|
| 154 |
/* field: campaign description */ |
| 155 |
|
| 156 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-campaign-description .charitable-campaign-builder-placeholder-preview-text { |
| 157 |
padding: 0; |
| 158 |
color: #202020; |
| 159 |
} |
| 160 |
|
| 161 |
|
| 162 |
/* field: text */ |
| 163 |
|
| 164 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-text .charitable-campaign-builder-placeholder-preview-text { |
| 165 |
padding: 0; |
| 166 |
color: #202020; |
| 167 |
} |
| 168 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-text h5.charitable-field-preview-headline { |
| 169 |
color: <?php echo $primary; ?>; |
| 170 |
} |
| 171 |
|
| 172 |
|
| 173 |
/* field: button */ |
| 174 |
|
| 175 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-donate-button .charitable-field-preview-donate-button span.placeholder.button { |
| 176 |
background-color: <?php echo $button; ?> !important; |
| 177 |
border-color: <?php echo $button; ?> !important; |
| 178 |
color: <?php echo charitable_get_constracting_text_color( $button ); ?>; |
| 179 |
text-transform: uppercase; |
| 180 |
border-radius: 35px; |
| 181 |
margin-top: 0; |
| 182 |
margin-bottom: 0; |
| 183 |
width: 100%; |
| 184 |
font-weight: 400; |
| 185 |
min-height: 50px; |
| 186 |
height: 50px; |
| 187 |
font-size: 16px; |
| 188 |
line-height: 50px; |
| 189 |
} |
| 190 |
|
| 191 |
/* field: photo */ |
| 192 |
|
| 193 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-photo .primary-image { |
| 194 |
border: transparent; |
| 195 |
border-radius: 0px; |
| 196 |
} |
| 197 |
|
| 198 |
/* field: photo */ |
| 199 |
|
| 200 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> header .primary-image-container { |
| 201 |
margin: 0; |
| 202 |
padding: 0; |
| 203 |
} |
| 204 |
|
| 205 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content .primary-image-container { |
| 206 |
margin: 0; |
| 207 |
padding: 0; |
| 208 |
} |
| 209 |
|
| 210 |
/* field: progress bar */ |
| 211 |
|
| 212 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress-bar-info-row div.campaign-percent-raised { |
| 213 |
color: #202020; |
| 214 |
font-weight: 500; |
| 215 |
font-size: 18px; |
| 216 |
line-height: 21px; |
| 217 |
} |
| 218 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress-bar-info-row div.campaign-goal { |
| 219 |
color: <?php echo $primary; ?>; |
| 220 |
font-weight: 600; |
| 221 |
font-size: 24px; |
| 222 |
line-height: 28px; |
| 223 |
} |
| 224 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress { |
| 225 |
border: 0; |
| 226 |
padding: 0; |
| 227 |
background-color: #E0E0E0; |
| 228 |
border-radius: 5px; |
| 229 |
margin-top: 15px; |
| 230 |
} |
| 231 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress-bar { |
| 232 |
background-color: <?php echo $primary; ?>; |
| 233 |
height: 8px !important; |
| 234 |
border-radius: 5px; |
| 235 |
text-align: right; |
| 236 |
opacity: 1.0; |
| 237 |
} |
| 238 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress-bar span { |
| 239 |
display: inline-block; |
| 240 |
background-color: <?php echo $primary; ?>; |
| 241 |
border-radius: 25px; |
| 242 |
width: 25px; |
| 243 |
height: 25px; |
| 244 |
margin-right: -15px; |
| 245 |
margin-top: -10px; |
| 246 |
} |
| 247 |
|
| 248 |
/* field: social linking */ |
| 249 |
|
| 250 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-linking { |
| 251 |
display: table; |
| 252 |
} |
| 253 |
|
| 254 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-linking .charitable-field-preview-social-linking-headline-container { |
| 255 |
display: block; |
| 256 |
float: left; |
| 257 |
padding: 0; |
| 258 |
} |
| 259 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-linking .charitable-field-row { |
| 260 |
display: block; |
| 261 |
float: left; |
| 262 |
width: auto; |
| 263 |
margin: 0 0 0 0; |
| 264 |
} |
| 265 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-linking h5.charitable-field-preview-headline { |
| 266 |
font-size: 14px; |
| 267 |
line-height: 16px; |
| 268 |
color: #24231E; |
| 269 |
font-weight: 300; |
| 270 |
margin: 0 15px 0 0; |
| 271 |
padding: 5px; |
| 272 |
} |
| 273 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-linking .charitable-placeholder { |
| 274 |
padding: 10px; |
| 275 |
} |
| 276 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-linking .charitable-field-preview-social-linking-headline-container.charitable-placeholder { |
| 277 |
padding-left: 0; |
| 278 |
padding-top: 2px; |
| 279 |
padding-bottom: 0; |
| 280 |
padding-right: 0; |
| 281 |
} |
| 282 |
|
| 283 |
/* field: social sharing */ |
| 284 |
|
| 285 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing { |
| 286 |
display: table; |
| 287 |
} |
| 288 |
|
| 289 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing .charitable-field-preview-social-sharing-headline-container { |
| 290 |
display: block; |
| 291 |
float: left; |
| 292 |
padding: 0; |
| 293 |
} |
| 294 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing .charitable-field-row { |
| 295 |
display: block; |
| 296 |
float: left; |
| 297 |
width: auto; |
| 298 |
margin: 0 0 0 0; |
| 299 |
} |
| 300 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing h5.charitable-field-preview-headline { |
| 301 |
font-size: 14px; |
| 302 |
line-height: 16px; |
| 303 |
color: #24231E; |
| 304 |
font-weight: 300; |
| 305 |
margin: 0 15px 0 0; |
| 306 |
padding: 5px; |
| 307 |
} |
| 308 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing .charitable-placeholder { |
| 309 |
padding: 10px; |
| 310 |
} |
| 311 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing .charitable-field-preview-social-sharing-headline-container.charitable-placeholder { |
| 312 |
padding-left: 0; |
| 313 |
padding-top: 2px; |
| 314 |
padding-bottom: 0; |
| 315 |
padding-right: 0; |
| 316 |
} |
| 317 |
|
| 318 |
/* social icons */ |
| 319 |
|
| 320 |
<?php |
| 321 |
// Include shared social icons CSS with dark icon style. |
| 322 |
$icon_style = 'dark'; |
| 323 |
include dirname( __FILE__ ) . '/partials/social-icons.php'; |
| 324 |
?> |
| 325 |
|
| 326 |
/* field: campaign summary */ |
| 327 |
|
| 328 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary { |
| 329 |
padding-left: 0; |
| 330 |
padding-right: 0; |
| 331 |
} |
| 332 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary div { |
| 333 |
color: #92918E; |
| 334 |
font-weight: 400; |
| 335 |
font-size: 14px; |
| 336 |
line-height: 16px; |
| 337 |
} |
| 338 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary div span { |
| 339 |
color: <?php echo $secondary; ?>; |
| 340 |
font-weight: 600; |
| 341 |
font-size: 32px; |
| 342 |
line-height: 38px; |
| 343 |
} |
| 344 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary .campaign-summary-item { |
| 345 |
border: 0; |
| 346 |
margin-top: 5px; |
| 347 |
margin-bottom: 5px; |
| 348 |
} |
| 349 |
|
| 350 |
/* field: donate amount */ |
| 351 |
|
| 352 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-donate-amount label, |
| 353 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-donate-amount input.custom-donation-input[type="text"] { |
| 354 |
color: <?php echo $secondary; ?>; |
| 355 |
border: 1px solid <?php echo $secondary; ?> !important; |
| 356 |
} |
| 357 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-donate-amount ul li.suggested-donation-amount.selected { |
| 358 |
background-color: <?php echo $primary; ?>; |
| 359 |
} |
| 360 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-donate-amount ul li.suggested-donation-amount.selected span.amount { |
| 361 |
color: <?php echo $tertiary; ?>; |
| 362 |
} |
| 363 |
|
| 364 |
// @codingStandardsIgnoreEnd |