| 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 ) : '#192E45'; |
| 55 |
$secondary = isset( $_GET['s'] ) ? '#' . substr( preg_replace( '/[^A-Fa-f0-9]/', '', $_GET['s'] ), 0, 6 ) : '#215DB7'; |
| 56 |
$tertiary = isset( $_GET['t'] ) ? '#' . substr( preg_replace( '/[^A-Fa-f0-9]/', '', $_GET['t'] ), 0, 6 ) : '#48A9F5'; |
| 57 |
$button = isset( $_GET['b'] ) ? '#' . substr( preg_replace( '/[^A-Fa-f0-9]/', '', $_GET['b'] ), 0, 6 ) : '#48A9F5'; |
| 58 |
|
| 59 |
$slug = 'medical-causes'; // 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 |
/* this narrows things down a little to the preview area div.charitable-preview-row/tabs */ |
| 66 |
|
| 67 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> { |
| 68 |
/* field items in preview area */ |
| 69 |
} |
| 70 |
|
| 71 |
/* wide spread changes in div.charitable-preview-row vs tabs */ |
| 72 |
|
| 73 |
|
| 74 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> div.charitable-preview-row { |
| 75 |
background-color: <?php echo $secondary; ?>; |
| 76 |
|
| 77 |
color: white; |
| 78 |
} |
| 79 |
|
| 80 |
|
| 81 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> div.charitable-preview-row h1, |
| 82 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> div.charitable-preview-row h2, |
| 83 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> div.charitable-preview-row h3, |
| 84 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> div.charitable-preview-row h4, |
| 85 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> div.charitable-preview-row h5, |
| 86 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> div.charitable-preview-row h6 { |
| 87 |
color: white; |
| 88 |
} |
| 89 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h1, |
| 90 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h2, |
| 91 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h3, |
| 92 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h4, |
| 93 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h5, |
| 94 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h6 { |
| 95 |
color: black; |
| 96 |
} |
| 97 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content { |
| 98 |
color: <?php echo $tertiary; ?>; |
| 99 |
} |
| 100 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content > * { |
| 101 |
color: #92908F; |
| 102 |
} |
| 103 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> div.charitable-preview-row > * { |
| 104 |
color: #D8DAD7; |
| 105 |
} |
| 106 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> div.charitable-preview-row h5 { |
| 107 |
|
| 108 |
} |
| 109 |
|
| 110 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .placeholder { |
| 111 |
padding: 0; |
| 112 |
} |
| 113 |
|
| 114 |
/* aligns */ |
| 115 |
|
| 116 |
|
| 117 |
/* column specifics */ |
| 118 |
|
| 119 |
/* headlines in general */ |
| 120 |
|
| 121 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> div.charitable-preview-row h5.charitable-field-preview-headline { |
| 122 |
color: white; |
| 123 |
|
| 124 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content h5.charitable-field-preview-headline { |
| 125 |
color: black !important; |
| 126 |
|
| 127 |
} |
| 128 |
|
| 129 |
/* field: campaign title */ |
| 130 |
|
| 131 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-campaign-title h1 { |
| 132 |
|
| 133 |
color: <?php echo $secondary; ?>; |
| 134 |
|
| 135 |
|
| 136 |
/* field: campaign description */ |
| 137 |
|
| 138 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-campaign-description .charitable-campaign-builder-placeholder-preview-text { |
| 139 |
|
| 140 |
color: #D8DAD7; |
| 141 |
} |
| 142 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-campaign-description .charitable-campaign-builder-placeholder-preview-text, |
| 143 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-campaign-description .charitable-campaign-builder-placeholder-preview-text p { |
| 144 |
|
| 145 |
} |
| 146 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content .charitable-field-campaign-description .charitable-campaign-builder-placeholder-preview-text { |
| 147 |
|
| 148 |
color: black; |
| 149 |
|
| 150 |
} |
| 151 |
|
| 152 |
/* field: text */ |
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
/* field: button */ |
| 157 |
|
| 158 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-donate-button .charitable-field-preview-donate-button span.placeholder.button { |
| 159 |
background-color: <?php echo $button; ?> !important; |
| 160 |
border-color: <?php echo $button; ?> !important; |
| 161 |
color: <?php echo charitable_get_constracting_text_color( $button ); ?>; |
| 162 |
} |
| 163 |
|
| 164 |
/* field: photo */ |
| 165 |
|
| 166 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-photo .primary-image { |
| 167 |
border: transparent; |
| 168 |
} |
| 169 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-photo img { |
| 170 |
border: 5px solid <?php echo $primary; ?>; |
| 171 |
} |
| 172 |
|
| 173 |
/* field: photo */ |
| 174 |
|
| 175 |
|
| 176 |
/* field: progress bar */ |
| 177 |
|
| 178 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress-bar-info-row div.campaign-percent-raised { |
| 179 |
color: #FFFFFF; |
| 180 |
|
| 181 |
} |
| 182 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress-bar-info-row div.campaign-goal { |
| 183 |
color: white; |
| 184 |
|
| 185 |
} |
| 186 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress { |
| 187 |
|
| 188 |
background-color: #E0E0E0; |
| 189 |
|
| 190 |
} |
| 191 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress-bar { |
| 192 |
background-color: <?php echo $tertiary; ?>; |
| 193 |
|
| 194 |
} |
| 195 |
|
| 196 |
|
| 197 |
/* field: social linking */ |
| 198 |
|
| 199 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-linking h5.charitable-field-preview-headline { |
| 200 |
|
| 201 |
color: <?php echo $secondary; ?>; |
| 202 |
|
| 203 |
} |
| 204 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-linking .charitable-placeholder { |
| 205 |
padding: 0px; |
| 206 |
} |
| 207 |
/* field: social sharing */ |
| 208 |
|
| 209 |
|
| 210 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing h5.charitable-field-preview-headline { |
| 211 |
font-size: 14px; |
| 212 |
line-height: 16px; |
| 213 |
color: <?php echo $secondary; ?>; |
| 214 |
font-weight: 300; |
| 215 |
margin: 0 15px 0 0; |
| 216 |
padding: 5px 5px 5px 0; |
| 217 |
} |
| 218 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-social-sharing .charitable-placeholder { |
| 219 |
padding: 0px; |
| 220 |
} |
| 221 |
|
| 222 |
/* social icons */ |
| 223 |
|
| 224 |
<?php |
| 225 |
// Include shared social icons CSS with dark icon style. |
| 226 |
$icon_style = 'dark'; |
| 227 |
include dirname( __FILE__ ) . '/partials/social-icons.php'; |
| 228 |
?> |
| 229 |
|
| 230 |
/* field: campaign summary */ |
| 231 |
|
| 232 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary { |
| 233 |
padding-left: 0; |
| 234 |
padding-right: 0; |
| 235 |
} |
| 236 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary div { |
| 237 |
|
| 238 |
font-weight: 400; |
| 239 |
font-size: 14px; |
| 240 |
line-height: 16px; |
| 241 |
} |
| 242 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary div span { |
| 243 |
color: white; |
| 244 |
font-weight: 100; |
| 245 |
font-size: 32px; |
| 246 |
line-height: 38px; |
| 247 |
} |
| 248 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary .campaign-summary-item { |
| 249 |
border: 0; |
| 250 |
margin-top: 5px; |
| 251 |
margin-bottom: 5px; |
| 252 |
text-transform: capitalize; |
| 253 |
} |
| 254 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary .campaign-summary-item.campaign_hide_percent_raised { |
| 255 |
width: 34%; |
| 256 |
} |
| 257 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary .campaign-summary-item.campaign_hide_amount_donated { |
| 258 |
width: 43%; |
| 259 |
} |
| 260 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary .campaign-summary-item.campaign_hide_number_of_donors { |
| 261 |
width: 23%; |
| 262 |
} |
| 263 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary .campaign-summary-item.campaign_hide_time_remaining { |
| 264 |
width: 100%; |
| 265 |
} |
| 266 |
|
| 267 |
|
| 268 |
/* field: donate amount */ |
| 269 |
|
| 270 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-donate-amount label, |
| 271 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-donate-amount input.custom-donation-input[type="text"] { |
| 272 |
color: <?php echo $secondary; ?>; |
| 273 |
border: 1px solid <?php echo $secondary; ?> !important; |
| 274 |
} |
| 275 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-donate-amount ul li.suggested-donation-amount.selected { |
| 276 |
background-color: <?php echo $primary; ?>; |
| 277 |
} |
| 278 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-donate-amount ul li.suggested-donation-amount.selected span.amount { |
| 279 |
color: <?php echo $tertiary; ?>; |
| 280 |
} |
| 281 |
|
| 282 |
/* tabs: container */ |
| 283 |
|
| 284 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-preview-tab-container { |
| 285 |
background-color: white; |
| 286 |
} |
| 287 |
|
| 288 |
/* tabs: tab nav */ |
| 289 |
|
| 290 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav { |
| 291 |
width: auto; |
| 292 |
} |
| 293 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav li { |
| 294 |
border: 1px solid <?php echo $secondary; ?>; |
| 295 |
background-color: transparent; |
| 296 |
margin: 0 15px 0 0; |
| 297 |
} |
| 298 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav li a { |
| 299 |
color: black; |
| 300 |
display: block; |
| 301 |
font-weight: 500; |
| 302 |
font-size: 14px; |
| 303 |
line-height: 15px; |
| 304 |
text-transform: none; |
| 305 |
} |
| 306 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav li.active { |
| 307 |
background-color: <?php echo $secondary; ?>; |
| 308 |
} |
| 309 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav li.active a { |
| 310 |
color: white; |
| 311 |
} |
| 312 |
|
| 313 |
/* missing addons? */ |
| 314 |
|
| 315 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-video, |
| 316 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-charitable-videos { |
| 317 |
|
| 318 |
} |
| 319 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-video .charitable-missing-addon-content, |
| 320 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-charitable-videos .charitable-missing-addon-content { |
| 321 |
background-color: transparent; |
| 322 |
} |
| 323 |
// @codingStandardsIgnoreEnd |