customizer.php
135 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Customizer |
| 4 | * |
| 5 | * @package OceanWP WordPress theme |
| 6 | */ |
| 7 | |
| 8 | // Exit if accessed directly. |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; |
| 11 | } |
| 12 | |
| 13 | if ( ! class_exists( 'OE_Customizer_Init' ) ) : |
| 14 | |
| 15 | /** |
| 16 | * Custom CSS / JS Customizer Class |
| 17 | */ |
| 18 | class OE_Customizer_Init { |
| 19 | |
| 20 | /** |
| 21 | * Setup class. |
| 22 | * |
| 23 | * @since 1.0 |
| 24 | */ |
| 25 | public function __construct() { |
| 26 | add_filter( 'ocean_customize_options_data', array( $this, 'register_customize_options') ); |
| 27 | add_action( 'customize_controls_enqueue_scripts', array( $this, 'assets' ) ); |
| 28 | add_action( 'customize_preview_init', array( $this, 'assets_preloader' ) ); |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Register customizer options |
| 33 | */ |
| 34 | public function register_customize_options($options) { |
| 35 | |
| 36 | $options['ocean_info'] = [ |
| 37 | 'title' => esc_html__('OceanWP Info', 'ocean-extra'), |
| 38 | 'priority' => 19, |
| 39 | 'options' => [ |
| 40 | 'ocean_info_content' => [ |
| 41 | 'type' => 'ocean-content', |
| 42 | 'isContent' => $this->oe_render_info_content(), |
| 43 | 'section' => 'ocean_info', |
| 44 | 'class' => 'description', |
| 45 | 'transport' => 'postMessage', |
| 46 | 'priority' => 10, |
| 47 | ] |
| 48 | ] |
| 49 | ]; |
| 50 | |
| 51 | return $options; |
| 52 | } |
| 53 | |
| 54 | public function assets() { |
| 55 | |
| 56 | $uri = OE_URL . 'includes/customizer/assets/'; |
| 57 | |
| 58 | wp_enqueue_script( |
| 59 | 'oe-customize-script', |
| 60 | $uri . 'script.min.js', |
| 61 | [], |
| 62 | OE_VERSION, |
| 63 | false |
| 64 | ); |
| 65 | |
| 66 | wp_enqueue_style( |
| 67 | 'oe-customize-preloader', |
| 68 | $uri . 'style.min.css', |
| 69 | [], |
| 70 | OE_VERSION |
| 71 | ); |
| 72 | } |
| 73 | |
| 74 | public function assets_preloader() { |
| 75 | |
| 76 | $uri = OE_URL . 'includes/customizer/assets/'; |
| 77 | |
| 78 | wp_enqueue_style( |
| 79 | 'oe-customize-preloader', |
| 80 | $uri . 'style.min.css', |
| 81 | [], |
| 82 | OE_VERSION |
| 83 | ); |
| 84 | } |
| 85 | |
| 86 | public function oe_render_info_content() { |
| 87 | $check_icon = '<svg height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M400-304 240-464l56-56 104 104 264-264 56 56-320 320Z"/></svg>'; |
| 88 | ob_start(); |
| 89 | ?> |
| 90 | |
| 91 | <div class="ocean-info-container"> |
| 92 | <h3 class="info-heading"><?php echo esc_html__( 'Documentation', 'ocean-extra' ); ?></h3> |
| 93 | <p><?php echo sprintf( esc_html__( 'OceanWP has detailed documentation and comprehensive user guides available to help you get results fast. %1$s View documentation. %2$s', 'ocean-extra' ), '<a href="https://see.oceanwp.org/tcinfo-preview-demos" target="_blank">', '</a>' ); ?></p> |
| 94 | </div> |
| 95 | |
| 96 | <span class="info-divider"></span> |
| 97 | |
| 98 | <div class="ocean-info-container"> |
| 99 | <h3 class="info-heading"><?php echo esc_html__( 'Website Templates', 'ocean-extra' ); ?></h3> |
| 100 | <p><?php echo sprintf( esc_html__( 'OceanWP provides a collection of pre-designed website templates (demos) to help jumpstart your project. %1$s View all available website templates. %2$s', 'ocean-extra' ), '<a href="https://see.oceanwp.org/tcinfo-preview-demos" target="_blank">', '</a>' ); ?></p> |
| 101 | </div> |
| 102 | |
| 103 | <?php |
| 104 | if ( function_exists( 'oe_pro_license_check' ) |
| 105 | && true === oe_pro_license_check() ) { |
| 106 | |
| 107 | ?> |
| 108 | <span class="info-divider"></span> |
| 109 | |
| 110 | <div class="ocean-info-container"> |
| 111 | <h3 class="info-heading"><?php echo esc_html__( 'Dedicated Premium Support', 'ocean-extra' ); ?></h3> |
| 112 | <p><?php echo sprintf( esc_html__( 'Elevate your experience with faster, expert and personalized email support available exclusively to %1$s OceanWP Pro Bundle %2$s and %3$s Ocean eCommerce Pro %2$s users. Upgrade today and get the best for your website.', 'ocean-extra' ), '<a href="https://see.oceanwp.org/tcinfo-bundle-upgrade" target="_blank">', '</a>', '<a href="https://see.oceanwp.org/tcinfo-ecommerce-upgrade" target="_blank">' ); ?></p> |
| 113 | </div> |
| 114 | <?php |
| 115 | |
| 116 | } |
| 117 | ?> |
| 118 | |
| 119 | <span class="info-divider"></span> |
| 120 | |
| 121 | <div class="ocean-info-container"> |
| 122 | <h3 class="info-heading"><?php echo esc_html__( 'Free User Support', 'ocean-extra' ); ?></h3> |
| 123 | <p><?php echo sprintf( esc_html__( 'Receive free support for your website via %1$s WordPress community forum %2$s or %3$s OceanWP official community on Facebook. %2$s', 'ocean-extra' ), '<a href="https://wordpress.org/support/theme/oceanwp/" target="_blank">', '</a>', '<a href="https://www.facebook.com/groups/oceanwptheme" target="_blank">' ); ?></p> |
| 124 | </div> |
| 125 | |
| 126 | <?php |
| 127 | return ob_get_clean(); |
| 128 | } |
| 129 | |
| 130 | } |
| 131 | |
| 132 | return new OE_Customizer_Init(); |
| 133 | |
| 134 | endif; |
| 135 |