lightspeeddevelopment /
lsx-customizer
| 1 | <?php |
||
| 2 | if ( ! class_exists( 'LSX_Customizer_Admin' ) ) { |
||
| 3 | |||
| 4 | /** |
||
| 5 | * LSX Customizer Admin Class |
||
| 6 | * |
||
| 7 | * @package LSX Customizer |
||
| 8 | * @author LightSpeed |
||
| 9 | * @license GPL3 |
||
| 10 | * @link |
||
| 11 | * @copyright 2016 LightSpeed |
||
| 12 | */ |
||
| 13 | class LSX_Customizer_Admin extends LSX_Customizer { |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Constructor. |
||
| 17 | * |
||
| 18 | * @since 1.0.0 |
||
| 19 | */ |
||
| 20 | public function __construct() { |
||
| 21 | add_action( 'customize_preview_init', array( $this, 'assets' ), 9999 ); |
||
| 22 | add_action( 'customize_controls_enqueue_scripts', array( $this, 'assets_wysiwyg_editor' ), 9999 ); |
||
| 23 | |||
| 24 | if ( is_admin() ) { |
||
| 25 | add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 ); |
||
| 26 | } |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Enques the assets. |
||
| 31 | * |
||
| 32 | * @since 1.0.0 |
||
| 33 | */ |
||
| 34 | public function assets() { |
||
| 35 | wp_enqueue_script( 'lsx_customizer_admin', LSX_CUSTOMIZER_URL . 'assets/js/lsx-customizer-admin.min.js', array( 'jquery' ), LSX_CUSTOMIZER_VER, true ); |
||
| 36 | |||
| 37 | $params = apply_filters( 'lsx_customizer_admin_js_params', array( |
||
| 38 | 'ajax_url' => admin_url( 'admin-ajax.php' ), |
||
| 39 | )); |
||
| 40 | |||
| 41 | wp_localize_script( 'lsx_customizer_admin', 'lsx_customizer_params', $params ); |
||
| 42 | |||
| 43 | wp_enqueue_style( 'lsx_customizer_admin', LSX_CUSTOMIZER_URL . 'assets/css/lsx-customizer-admin.css', array(), LSX_CUSTOMIZER_VER ); |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Enques the assets for editor. |
||
| 48 | * |
||
| 49 | * @since 1.1.1 |
||
| 50 | */ |
||
| 51 | public function assets_wysiwyg_editor() { |
||
| 52 | wp_enqueue_script( 'lsx_customizer_editor', LSX_CUSTOMIZER_URL . 'assets/js/lsx-customizer-editor.min.js', array( 'jquery' ), LSX_CUSTOMIZER_VER, true ); |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
|
0 ignored issues
–
show
Coding Style
Documentation
introduced
by
Loading history...
|
|||
| 56 | * Handle body colours that might be change by LSX Customizer. |
||
| 57 | */ |
||
| 58 | public function customizer_body_colours_handler( $css, $colors ) { |
||
| 59 | $css .= ' |
||
| 60 | @import "' . LSX_CUSTOMIZER_PATH . '/assets/css/scss/customizer-customizer-body-colours"; |
||
| 61 | |||
| 62 | /** |
||
| 63 | * LSX Customizer - Body (LSX Customizer) |
||
| 64 | */ |
||
| 65 | @include customizer-customizer-body-colours ( |
||
| 66 | $bg: ' . $colors['background_color'] . ', |
||
| 67 | $breaker: ' . $colors['body_line_color'] . ', |
||
| 68 | $color: ' . $colors['body_text_color'] . ', |
||
| 69 | $link: ' . $colors['body_link_color'] . ', |
||
| 70 | $hover: ' . $colors['body_link_hover_color'] . ', |
||
| 71 | $small: ' . $colors['body_text_small_color'] . ', |
||
| 72 | ); |
||
| 73 | '; |
||
| 74 | |||
| 75 | return $css; |
||
| 76 | } |
||
| 77 | |||
| 78 | } |
||
| 79 | |||
| 80 | new LSX_Customizer_Admin(); |
||
| 81 | |||
| 82 | } |
||
| 83 |