| 1 |
<?php |
| 2 |
/** |
| 3 |
* Load loftloader lite loader related functions |
| 4 |
* |
| 5 |
* @since version 2.0.0 |
| 6 |
*/ |
| 7 |
add_action('customize_register', 'loftloader_customize_loader', 40); |
| 8 |
function loftloader_customize_loader($wp_customize){ |
| 9 |
global $loftloader_default_settings; |
| 10 |
|
| 11 |
$wp_customize->add_setting(new WP_Customize_Setting($wp_customize, 'loftloader_loader_type', array( |
| 12 |
'default' => $loftloader_default_settings['loftloader_loader_type'], |
| 13 |
'transport' => 'refresh', |
| 14 |
'type' => 'option', |
| 15 |
'sanitize_callback' => 'loftloader_sanitize_choice' |
| 16 |
))); |
| 17 |
$wp_customize->add_setting(new WP_Customize_Setting($wp_customize, 'loftloader_loader_color', array( |
| 18 |
'default' => $loftloader_default_settings['loftloader_loader_color'], |
| 19 |
'transport' => 'refresh', |
| 20 |
'type' => 'option', |
| 21 |
'sanitize_callback' => 'sanitize_hex_color' |
| 22 |
))); |
| 23 |
$wp_customize->add_setting(new WP_Customize_Setting($wp_customize, 'loftloader_custom_img', array( |
| 24 |
'default' => $loftloader_default_settings['loftloader_custom_img'], |
| 25 |
'transport' => 'refresh', |
| 26 |
'type' => 'option', |
| 27 |
'sanitize_callback' => 'esc_url_raw' |
| 28 |
))); |
| 29 |
$wp_customize->add_setting(new WP_Customize_Setting($wp_customize, 'loftloader_img_width', array( |
| 30 |
'default' => $loftloader_default_settings['loftloader_img_width'], |
| 31 |
'transport' => 'refresh', |
| 32 |
'type' => 'option', |
| 33 |
'sanitize_callback' => 'absint' |
| 34 |
))); |
| 35 |
|
| 36 |
$wp_customize->add_section(new LoftLoader_Customize_Section($wp_customize, 'loftloader_loader', array( |
| 37 |
'title' => esc_html__('Loader', 'loftloader'), |
| 38 |
'description' => '', |
| 39 |
'priority' => 50 |
| 40 |
))); |
| 41 |
|
| 42 |
// Controls for section loader |
| 43 |
$wp_customize->add_control(new LoftLoader_Customize_Animation_Types_Control($wp_customize, 'loftloader_loader_type', array( |
| 44 |
'type' => 'radio', |
| 45 |
'label' => esc_html__('Loader Animation', 'loftloader'), |
| 46 |
'description' => sprintf(esc_html__('Some support custom image.', 'loftloader'), '<strong>', '</strong>'), |
| 47 |
'choices' => array( |
| 48 |
'sun' => array('label' => esc_html__('Spinning Sun', 'loftloader')), |
| 49 |
'circles' => array('label' => esc_html__('Luminous Circles', 'loftloader')), |
| 50 |
'wave' => array('label' => esc_html__('Wave', 'loftloader')), |
| 51 |
'square' => array('label' => esc_html__('Spinning Square', 'loftloader')), |
| 52 |
'frame' => array('label' => esc_html__('Drawing Frame', 'loftloader')), |
| 53 |
'imgloading' => array('label' => esc_html__('Custom Image Loading', 'loftloader')), |
| 54 |
'beating' => array('label' => esc_html__('Beating', 'loftloader')) |
| 55 |
), |
| 56 |
'section' => 'loftloader_loader', |
| 57 |
'settings' => 'loftloader_loader_type' |
| 58 |
))); |
| 59 |
$wp_customize->add_control(new LoftLoader_Customize_Color_Control($wp_customize, 'loftloader_loader_color', array( |
| 60 |
'label' => esc_html__('Pick Color', 'loftloader'), |
| 61 |
'section' => 'loftloader_loader', |
| 62 |
'settings' => 'loftloader_loader_color', |
| 63 |
'filter' => true, |
| 64 |
'parent_setting_id' => 'loftloader_loader_type', |
| 65 |
'show_filter' => array('sun', 'circles', 'wave', 'square', 'frame', 'beating') |
| 66 |
))); |
| 67 |
$wp_customize->add_control(new LoftLoader_Customize_Image_Control($wp_customize, 'loftloader_custom_img', array( |
| 68 |
'type' => 'image', |
| 69 |
'label' => esc_html__('Upload Image', 'loftloader'), |
| 70 |
'description' => '', |
| 71 |
'section' => 'loftloader_loader', |
| 72 |
'settings' => 'loftloader_custom_img', |
| 73 |
'filter' => true, |
| 74 |
'parent_setting_id' => 'loftloader_loader_type', |
| 75 |
'show_filter' => array('frame', 'imgloading') |
| 76 |
))); |
| 77 |
$wp_customize->add_control(new LoftLoader_Customize_Number_Text_Control($wp_customize, 'loftloader_img_width', array( |
| 78 |
'type' => 'number', |
| 79 |
'label' => esc_html__('Image Width', 'loftloader'), |
| 80 |
'section' => 'loftloader_loader', |
| 81 |
'settings' => 'loftloader_img_width', |
| 82 |
'after_text' => 'px', |
| 83 |
'input_class' => 'loaderimgwidth', |
| 84 |
'input_wrap_class' => 'imgwidth', |
| 85 |
'filter' => true, |
| 86 |
'parent_setting_id' => 'loftloader_loader_type', |
| 87 |
'show_filter' => array('imgloading') |
| 88 |
))); |
| 89 |
} |