| 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 ) : '#3418d2'; |
| 55 |
$secondary = isset( $_GET['s'] ) ? '#' . substr( preg_replace( '/[^A-Fa-f0-9]/', '', $_GET['s'] ), 0, 6 ) : '#005eff'; |
| 56 |
$tertiary = isset( $_GET['t'] ) ? '#' . substr( preg_replace( '/[^A-Fa-f0-9]/', '', $_GET['t'] ), 0, 6 ) : '#00a1ff'; |
| 57 |
$button = isset( $_GET['b'] ) ? '#' . substr( preg_replace( '/[^A-Fa-f0-9]/', '', $_GET['b'] ), 0, 6 ) : '#ec5f25'; |
| 58 |
|
| 59 |
$slug = 'youth-sports'; // 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 |
/* row specifics */ |
| 66 |
|
| 67 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-preview-row { |
| 68 |
background-color: <?php echo $primary; ?>; |
| 69 |
color: white; |
| 70 |
} |
| 71 |
|
| 72 |
/* field: progress bar */ |
| 73 |
|
| 74 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress-bar-info-row div.campaign-percent-raised { |
| 75 |
|
| 76 |
} |
| 77 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress-bar-info-row div.campaign-goal { |
| 78 |
|
| 79 |
} |
| 80 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress { |
| 81 |
background-color: rgba(255,255,255,0.5); |
| 82 |
} |
| 83 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-progress-bar .progress-bar { |
| 84 |
background-color: #fff; |
| 85 |
} |
| 86 |
|
| 87 |
/* field: button */ |
| 88 |
|
| 89 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-donate-button .charitable-field-preview-donate-button span.placeholder { |
| 90 |
|
| 91 |
} |
| 92 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field.charitable-field-donate-button .charitable-field-preview-donate-button span.placeholder.button { |
| 93 |
background-color: <?php echo $button; ?>; |
| 94 |
border-color: <?php echo $button; ?>; |
| 95 |
color: <?php echo charitable_get_constracting_text_color( $button ); ?>; |
| 96 |
} |
| 97 |
|
| 98 |
/* field: donate amount */ |
| 99 |
|
| 100 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-donate-amount label, |
| 101 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-donate-amount input.custom-donation-input[type="text"] { |
| 102 |
|
| 103 |
} |
| 104 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-donate-amount ul li.suggested-donation-amount.selected label { |
| 105 |
border-color: <?php echo $button; ?> !important; |
| 106 |
} |
| 107 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-donate-amount ul li.suggested-donation-amount.selected span.amount { |
| 108 |
|
| 109 |
} |
| 110 |
|
| 111 |
/* field: campaign summary */ |
| 112 |
|
| 113 |
|
| 114 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary div span { |
| 115 |
color: white; |
| 116 |
} |
| 117 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-preview-campaign-summary .campaign-summary-item { |
| 118 |
color: white; |
| 119 |
} |
| 120 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content .charitable-field-preview-campaign-summary div span { |
| 121 |
color: black; |
| 122 |
} |
| 123 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .tab-content .charitable-field-preview-campaign-summary .campaign-summary-item { |
| 124 |
color: black; |
| 125 |
} |
| 126 |
|
| 127 |
|
| 128 |
/* tabs: tab nav */ |
| 129 |
|
| 130 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav { |
| 131 |
border: 1px solid transparent; |
| 132 |
background-color: transparent; |
| 133 |
} |
| 134 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav li { |
| 135 |
} |
| 136 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav li a { |
| 137 |
color: #DDD; |
| 138 |
} |
| 139 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav li.active { |
| 140 |
background-color: transparent; |
| 141 |
} |
| 142 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav li:hover { |
| 143 |
background-color: transparent; |
| 144 |
} |
| 145 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav li.active a { |
| 146 |
color: black; |
| 147 |
} |
| 148 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav li:hover a { |
| 149 |
color: <?php echo $tertiary; ?>; |
| 150 |
} |
| 151 |
|
| 152 |
/* tabs: style */ |
| 153 |
|
| 154 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.tab-style-boxed li { |
| 155 |
|
| 156 |
} |
| 157 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.tab-style-boxed li a { |
| 158 |
|
| 159 |
} |
| 160 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.tab-style-boxed li.active { |
| 161 |
background-color: <?php echo $primary; ?>; |
| 162 |
} |
| 163 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.tab-style-boxed li:hover { |
| 164 |
background-color: <?php echo $primary; ?>; |
| 165 |
} |
| 166 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.tab-style-boxed li.active a { |
| 167 |
color: white; |
| 168 |
} |
| 169 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.tab-style-boxed li:hover a { |
| 170 |
color: white; |
| 171 |
} |
| 172 |
|
| 173 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.tab-style-rounded li { |
| 174 |
|
| 175 |
} |
| 176 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.tab-style-rounded li a { |
| 177 |
|
| 178 |
} |
| 179 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.tab-style-rounded li.active { |
| 180 |
background-color: <?php echo $primary; ?>; |
| 181 |
} |
| 182 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.tab-style-rounded li:hover { |
| 183 |
background-color: <?php echo $primary; ?>; |
| 184 |
} |
| 185 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.tab-style-rounded li.active a { |
| 186 |
color: white; |
| 187 |
} |
| 188 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.tab-style-rounded li:hover a { |
| 189 |
color: white; |
| 190 |
} |
| 191 |
|
| 192 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.tab-style-minimum li { |
| 193 |
background-color: transparent; |
| 194 |
border-color: transparent; |
| 195 |
} |
| 196 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.tab-style-minimum li a { |
| 197 |
color: <?php echo $primary; ?>; |
| 198 |
} |
| 199 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.tab-style-minimum li.active { |
| 200 |
border-color: <?php echo $button; ?>; |
| 201 |
} |
| 202 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.tab-style-minimum li:hover { |
| 203 |
border-color: <?php echo $button; ?>; |
| 204 |
} |
| 205 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.tab-style-minimum li.active a { |
| 206 |
color: black; |
| 207 |
} |
| 208 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> article nav.tab-style-minimum li:hover a { |
| 209 |
color: <?php echo $tertiary; ?>; |
| 210 |
} |
| 211 |
|
| 212 |
|
| 213 |
/* missing addons? */ |
| 214 |
|
| 215 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-missing { |
| 216 |
background-color: rgba(0,0,0,.7); |
| 217 |
} |
| 218 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-missing .charitable-missing-addon-content { |
| 219 |
background-color: transparent; |
| 220 |
} |
| 221 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-missing .charitable-missing-addon-content, |
| 222 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-missing .charitable-missing-addon-content h2, |
| 223 |
<?php echo charitable_esc_attr_php( $wrapper ); ?> .charitable-field-missing .charitable-missing-addon-content p { |
| 224 |
color: white !important; |
| 225 |
} |
| 226 |
|
| 227 |
// @codingStandardsIgnoreEnd |