| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Class for Presets. |
| 5 |
* |
| 6 |
* @since 1.0.9 |
| 7 |
* @version 1.5.12 |
| 8 |
* @access public |
| 9 |
*/ |
| 10 |
class LoginPress_Presets extends WP_Customize_Control { |
| 11 |
|
| 12 |
/** |
| 13 |
* The type of customize control being rendered. |
| 14 |
* |
| 15 |
* @since 1.0.9 |
| 16 |
* @access public |
| 17 |
* @var string |
| 18 |
*/ |
| 19 |
public $type = 'checkbox-multiple'; |
| 20 |
|
| 21 |
/** |
| 22 |
* Enqueue scripts/styles. |
| 23 |
* |
| 24 |
* @since 1.0.9 |
| 25 |
* @access public |
| 26 |
* @return void |
| 27 |
*/ |
| 28 |
public function enqueue() { |
| 29 |
// wp_enqueue_script( 'jt-customize-controls', plugins_url( '/customize-controls.js' , __FILE__ ), array( 'jquery' ) ); |
| 30 |
// wp_enqueue_script( 'jquery-ui-button' ); |
| 31 |
|
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Displays the control content. |
| 36 |
* |
| 37 |
* @since 1.0.9 |
| 38 |
* @access public |
| 39 |
* @return void |
| 40 |
*/ |
| 41 |
public function render_content() { |
| 42 |
|
| 43 |
|
| 44 |
if ( empty( $this->choices ) ) |
| 45 |
return; |
| 46 |
$name = 'loginpress_preset-' . $this->id; ?> |
| 47 |
|
| 48 |
<span class="customize-control-title"> |
| 49 |
<?php echo esc_attr( $this->label ); ?> |
| 50 |
<?php if ( ! empty( $this->description ) ) : ?> |
| 51 |
<span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span> |
| 52 |
<?php endif; ?> |
| 53 |
</span> |
| 54 |
|
| 55 |
<?php // $multi_values = !is_array( $this->value() ) ? explode( ',', $this->value() ) : $this->value(); ?> |
| 56 |
|
| 57 |
|
| 58 |
<div id="input_<?php echo $this->id; ?>" class="image"> |
| 59 |
|
| 60 |
<?php foreach ( $this->choices as $val ) : ?> |
| 61 |
|
| 62 |
<?php $_disbaled = isset( $val['pro'] ) ? 'disabled' : ''; ?> |
| 63 |
<?php $_disbaled_link = isset( $val['link'] ) ? 'disabled' : ''; ?> |
| 64 |
<?php $disable_for_pro = $_disbaled == 'disabled' ? $_disbaled : $_disbaled_link; ?> |
| 65 |
<div class="loginpress_thumbnail"> |
| 66 |
<input <?php echo $disable_for_pro; ?> class="image-select" type="radio" value="<?php echo esc_attr( $val['id'] ); ?>" id="<?php echo $this->id . $val['id']; ?>" name="<?php echo esc_attr( $name ); ?>" <?php checked( $this->value(), $val['id'] ); ?> /> |
| 67 |
<label for="<?php echo $this->id . $val['id']; ?>"> |
| 68 |
<div class="loginpress_thumbnail_img"> |
| 69 |
<img src="<?php echo $val['thumbnail']; ?>" alt="<?php echo esc_attr( $val['id'] ); ?>" title="<?php echo esc_attr( $val['id'] ); ?>"> |
| 70 |
</div> <!-- .img --> |
| 71 |
<h3><?php echo $val['name'] ?></h3> |
| 72 |
</label> |
| 73 |
<?php if ( isset( $val['pro'] ) ) : ?> |
| 74 |
<a href="https://wpbrigade.com/wordpress/plugins/loginpress-pro/?utm_source=loginpress-lite&utm_medium=themes&utm_campaign=pro-upgrade" target="_blank" class="no-available"> |
| 75 |
<span><?php _e( 'Unlock Premium Feature', 'loginpress' ); ?></span> |
| 76 |
</a> |
| 77 |
<?php elseif ( isset( $val['link'] ) ) : ?> |
| 78 |
<a href="mailto:support@wpbrigade.com?subject=I want Custom Design for my login page." class="no-available"> |
| 79 |
<span><?php _e( 'Contact us for Custom Design', 'loginpress' ); ?></span> |
| 80 |
</a> |
| 81 |
<?php endif; ?> |
| 82 |
|
| 83 |
|
| 84 |
<!-- </input> --> |
| 85 |
</div> <!-- .loginpress_thumbnail --> |
| 86 |
|
| 87 |
<?php endforeach; ?> |
| 88 |
</div> |
| 89 |
|
| 90 |
<input name='presets_hidden' type="hidden" <?php $this->link(); ?> value="<?php echo $this->value(); ?>" /> |
| 91 |
<?php } |
| 92 |
|
| 93 |
|
| 94 |
} |
| 95 |
if ( ! function_exists( 'loginpress_presets_control_css' ) ) { |
| 96 |
function loginpress_presets_control_css() { |
| 97 |
?> |
| 98 |
<style> |
| 99 |
#customize-theme-controls #accordion-section-customize_presets .accordion-section-title{ |
| 100 |
background-color: #FFD700; |
| 101 |
} |
| 102 |
#customize-controls #accordion-section-customize_presets:hover>.accordion-section-title{ |
| 103 |
background-color: #FFD700; |
| 104 |
} |
| 105 |
.customize-control-checkbox-multiple .image.ui-buttonset input[type=radio] { |
| 106 |
height: auto; |
| 107 |
} |
| 108 |
.customize-control-checkbox-multiple .image.ui-buttonset label { |
| 109 |
display: inline-block; |
| 110 |
margin-right: 5px; |
| 111 |
margin-bottom: 5px; |
| 112 |
} |
| 113 |
.customize-control-checkbox-multiple .image.ui-buttonset label.ui-state-active { |
| 114 |
background: none; |
| 115 |
} |
| 116 |
.customize-control-checkbox-multiple .customize-control-radio-buttonset label { |
| 117 |
padding: 5px 10px; |
| 118 |
background: #f7f7f7; |
| 119 |
border-left: 1px solid #dedede; |
| 120 |
line-height: 35px; |
| 121 |
} |
| 122 |
.customize-control-checkbox-multiple label img { |
| 123 |
border: 1px solid #bbb; |
| 124 |
opacity: 0.5; |
| 125 |
} |
| 126 |
#customize-controls .customize-control-checkbox-multiple label img { |
| 127 |
max-width: 250px; |
| 128 |
height: auto; |
| 129 |
width: 100%; |
| 130 |
margin-bottom: 0; |
| 131 |
border: 0; |
| 132 |
display: block; |
| 133 |
} |
| 134 |
.customize-control-checkbox-multiple label.ui-state-active img { |
| 135 |
background: #dedede; |
| 136 |
border-color: #000; |
| 137 |
opacity: 1; |
| 138 |
margin-bottom: 0; |
| 139 |
} |
| 140 |
.customize-control-checkbox-multiple label.ui-state-hover img { |
| 141 |
opacity: 0.9; |
| 142 |
border-color: #999; |
| 143 |
} |
| 144 |
.customize-control-radio-buttonset label.ui-corner-left { |
| 145 |
border-radius: 3px 0 0 3px; |
| 146 |
border-left: 0; |
| 147 |
} |
| 148 |
.customize-control-radio-buttonset label.ui-corner-right { |
| 149 |
border-radius: 0 3px 3px 0; |
| 150 |
} |
| 151 |
#customize-control-customize_presets_settings input[type=radio]{ |
| 152 |
display: none; |
| 153 |
} |
| 154 |
#customize-control-customize_presets_settings label{ |
| 155 |
display: block; |
| 156 |
position: relative; |
| 157 |
width: 100%; |
| 158 |
} |
| 159 |
#customize-control-customize_presets_settings .loginpress_thumbnail{ |
| 160 |
width: calc(50% - 10px); |
| 161 |
margin-bottom: 10px; |
| 162 |
position: relative; |
| 163 |
border: 5px solid transparent; |
| 164 |
-webkit-transition:all 0.2s ease-in-out; |
| 165 |
-moz-transition:all 0.2s ease-in-out; |
| 166 |
-ms-transition:all 0.2s ease-in-out; |
| 167 |
transition:all 0.2s ease-in-out; |
| 168 |
} |
| 169 |
#customize-control-customize_presets_settings .loginpress_thumbnail:nth-child(odd){ |
| 170 |
float: left; |
| 171 |
} |
| 172 |
#customize-control-customize_presets_settings .loginpress_thumbnail:nth-child(even){ |
| 173 |
float: right; |
| 174 |
} |
| 175 |
#customize-control-customize_presets_settings .image:after{ |
| 176 |
content: ''; |
| 177 |
display: table; |
| 178 |
clear: both; |
| 179 |
} |
| 180 |
#customize-control-customize_presets_settings h3{ |
| 181 |
margin: 0; |
| 182 |
font: 400 14px 'Open Sans', Arial, Helvetica, sans-serif; |
| 183 |
line-height: 1.1; |
| 184 |
padding: 3px; |
| 185 |
text-align: center; |
| 186 |
background: #eee; |
| 187 |
color: #777777; |
| 188 |
} |
| 189 |
#customize-control-customize_presets_settings label .loginpress_thumbnail_img:after { |
| 190 |
content: ''; |
| 191 |
width: 20px; |
| 192 |
height: 20px; |
| 193 |
border-radius: 50%; |
| 194 |
background: #2EB150; |
| 195 |
position: absolute; |
| 196 |
top: -5px; |
| 197 |
left: -5px; |
| 198 |
border-radius: 50%; |
| 199 |
visibility: hidden; |
| 200 |
} |
| 201 |
#customize-control-customize_presets_settings label .loginpress_thumbnail_img:before { |
| 202 |
height: 6px; |
| 203 |
width: 3px; |
| 204 |
-webkit-transform-origin: left top; |
| 205 |
-moz-transform-origin: left top; |
| 206 |
-ms-transform-origin: left top; |
| 207 |
-o-transform-origin: left top; |
| 208 |
transform-origin: left top; |
| 209 |
border-right: 3px solid white; |
| 210 |
border-top: 3px solid white; |
| 211 |
border-radius: 2.5px !important; |
| 212 |
content: ''; |
| 213 |
position: absolute; |
| 214 |
z-index: 2; |
| 215 |
opacity: 0; |
| 216 |
margin-top: 0px; |
| 217 |
margin-left: -7px; |
| 218 |
top: 5px; |
| 219 |
left: 4px; |
| 220 |
} |
| 221 |
#customize-control-customize_presets_settings .loginpress_thumbnail_img{ |
| 222 |
display: block; |
| 223 |
position: relative; |
| 224 |
} |
| 225 |
#customize-control-customize_presets_settings input[type="radio"]:checked + label .loginpress_thumbnail_img:before { |
| 226 |
-webkit-animation-delay: 100ms; |
| 227 |
-moz-animation-delay: 100ms; |
| 228 |
animation-delay: 100ms; |
| 229 |
-webkit-animation-duration: 1s; |
| 230 |
-moz-animation-duration: 1s; |
| 231 |
animation-duration: 1s; |
| 232 |
-webkit-animation-timing-function: ease; |
| 233 |
-moz-animation-timing-function: ease; |
| 234 |
animation-timing-function: ease; |
| 235 |
-webkit-animation-name: checkmark; |
| 236 |
-moz-animation-name: checkmark; |
| 237 |
animation-name: checkmark; |
| 238 |
-webkit-transform: scaleX(-1) rotate(135deg); |
| 239 |
-moz-transform: scaleX(-1) rotate(135deg); |
| 240 |
-ms-transform: scaleX(-1) rotate(135deg); |
| 241 |
-o-transform: scaleX(-1) rotate(135deg); |
| 242 |
transform: scaleX(-1) rotate(135deg); |
| 243 |
-webkit-animation-fill-mode: forwards; |
| 244 |
-moz-animation-fill-mode: forwards; |
| 245 |
animation-fill-mode: forwards; |
| 246 |
z-index: 2; |
| 247 |
} |
| 248 |
#customize-control-customize_presets_settings input[type="radio"]:checked + label .loginpress_thumbnail_img:after{ |
| 249 |
visibility: visible; |
| 250 |
} |
| 251 |
/*#customize-control-customize_presets_settings input[type="radio"]:disabled + label .loginpress_thumbnail_img:before{ |
| 252 |
visibility: hidden; |
| 253 |
} |
| 254 |
#customize-control-customize_presets_settings input[type="radio"]:disabled + label .loginpress_thumbnail_img:after{ |
| 255 |
visibility: hidden; |
| 256 |
}*/ |
| 257 |
#customize-control-customize_presets_settings img{ |
| 258 |
margin-bottom: 0; |
| 259 |
} |
| 260 |
#customize-control-customize_presets_settings input[type="radio"]:checked + label img{ |
| 261 |
opacity: 1; |
| 262 |
} |
| 263 |
.no-available{ |
| 264 |
top: 0; |
| 265 |
left: 0; |
| 266 |
background: rgba(204, 204, 204, 0.8); |
| 267 |
content: ''; |
| 268 |
position: absolute; |
| 269 |
bottom: 0; |
| 270 |
right: 0; |
| 271 |
z-index: 100; |
| 272 |
/* padding-top: 20px; */ |
| 273 |
text-align: center; |
| 274 |
font-weight: bold; |
| 275 |
color: #000; |
| 276 |
-webkit-transition: all 0.2s ease-in-out; |
| 277 |
-moz-transition: all 0.2s ease-in-out; |
| 278 |
-ms-transition: all 0.2s ease-in-out; |
| 279 |
transition: all 0.2s ease-in-out; |
| 280 |
opacity: 0; |
| 281 |
visibility: hidden; |
| 282 |
-webkit-transform: scale(.5); |
| 283 |
-moz-transform: scale(.5); |
| 284 |
-ms-transform: scale(.5); |
| 285 |
transform: scale(.5); |
| 286 |
text-decoration: none !important; |
| 287 |
display: flex; |
| 288 |
align-items: center; |
| 289 |
} |
| 290 |
#customize-control-customize_presets_settings .loginpress_thumbnail:hover input[type="radio"]:disabled ~ .no-available{ |
| 291 |
opacity: 1; |
| 292 |
visibility: visible; |
| 293 |
color: #000; |
| 294 |
-webkit-transform: scale(1); |
| 295 |
-moz-transform: scale(1); |
| 296 |
-ms-transform: scale(1); |
| 297 |
transform: scale(1); |
| 298 |
} |
| 299 |
#customize-control-customize_presets_settings .loginpress_thumbnail:hover{ |
| 300 |
border-color: #ccc; |
| 301 |
} |
| 302 |
|
| 303 |
@-webkit-keyframes checkmark { |
| 304 |
0% { |
| 305 |
height: 0; |
| 306 |
width: 0; |
| 307 |
opacity: 1; |
| 308 |
} |
| 309 |
20% { |
| 310 |
height: 0; |
| 311 |
width: 5px; |
| 312 |
opacity: 1; |
| 313 |
} |
| 314 |
40% { |
| 315 |
height: 10px; |
| 316 |
width: 5px; |
| 317 |
opacity: 1; |
| 318 |
} |
| 319 |
100% { |
| 320 |
height: 10px; |
| 321 |
width: 5px; |
| 322 |
opacity: 1; |
| 323 |
} |
| 324 |
} |
| 325 |
@-moz-keyframes checkmark { |
| 326 |
0% { |
| 327 |
height: 0; |
| 328 |
width: 0; |
| 329 |
opacity: 1; |
| 330 |
} |
| 331 |
20% { |
| 332 |
height: 0; |
| 333 |
width: 5px; |
| 334 |
opacity: 1; |
| 335 |
} |
| 336 |
40% { |
| 337 |
height: 10px; |
| 338 |
width: 5px; |
| 339 |
opacity: 1; |
| 340 |
} |
| 341 |
100% { |
| 342 |
height: 10px; |
| 343 |
width: 5px; |
| 344 |
opacity: 1; |
| 345 |
} |
| 346 |
} |
| 347 |
@keyframes checkmark { |
| 348 |
0% { |
| 349 |
height: 0; |
| 350 |
width: 0; |
| 351 |
opacity: 1; |
| 352 |
} |
| 353 |
20% { |
| 354 |
height: 0; |
| 355 |
width: 5px; |
| 356 |
opacity: 1; |
| 357 |
} |
| 358 |
40% { |
| 359 |
height: 10px; |
| 360 |
width: 5px; |
| 361 |
opacity: 1; |
| 362 |
} |
| 363 |
100% { |
| 364 |
height: 10px; |
| 365 |
width: 5px; |
| 366 |
opacity: 1; |
| 367 |
} |
| 368 |
} |
| 369 |
|
| 370 |
</style> |
| 371 |
<?php |
| 372 |
} |
| 373 |
} |
| 374 |
add_action( 'customize_controls_print_styles', 'loginpress_presets_control_css' ); |
| 375 |
?> |
| 376 |
|