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