/** * Constructor. */ public function __construct() { $this->id = 'general'; $this->label = __('General', 'woocommerce'); add_filter('woocommerce_settings_tabs_array', array($this, 'add_settings_page'), 20); add_action('woocommerce_settings_' . $this->id, array($this, 'output')); add_action('woocommerce_settings_save_' . $this->id, array($this, 'save')); if (($styles = WC_Frontend_Scripts::get_styles()) && array_key_exists('woocommerce-general', $styles)) { add_action('woocommerce_admin_field_frontend_styles', array($this, 'frontend_styles_setting')); } }
/** * Constructor. */ public function __construct() { $this->id = 'frontend'; $this->label = __('Frontend', 'opentickets-community-edition'); add_filter('qsot_settings_tabs_array', array($this, 'add_settings_page'), 20); add_action('qsot_settings_' . $this->id, array($this, 'output')); add_action('qsot_settings_save_' . $this->id, array($this, 'save')); if (($styles = WC_Frontend_Scripts::get_styles()) && array_key_exists('woocommerce-general', $styles)) { add_action('woocommerce_admin_field_qsot_frontend_styles', array($this, 'frontend_styles_setting')); } add_action('woocommerce_admin_field_qsot-image-ids', array($this, 'image_ids_setting'), 1000, 1); }
/** * Checks if there is any change in woocommerce_frontend_css_colors * * @return bool */ public function has_frontend_colors() { $styles = (array) WC_Frontend_Scripts::get_styles(); if (!array_key_exists('woocommerce-general', $styles)) { return false; } $colors = get_option('woocommerce_frontend_css_colors'); $default = array('primary' => '#ad74a2', 'secondary' => '#f7f6f7', 'highlight' => '#85ad74', 'content_bg' => '#ffffff', 'subtext' => '#777777'); if (!$colors || $colors === $default) { return false; } return true; }
/** * Enqueue scripts on administration comment page * * @param $hook */ function enqueue_admin_styles_scripts($hook) { /** Add Woocommerce.css file */ $styles = (array) WC_Frontend_Scripts::get_styles(); if (array_key_exists('woocommerce-general', $styles)) { wp_enqueue_style('woocommerce-general', $styles['woocommerce-general']['src']); } wp_enqueue_style('yith-google-fonts', '//fonts.googleapis.com/css?family=Raleway:500,700,800,400'); wp_enqueue_style('yit-style', YITH_YWAR_ASSETS_URL . '/css/yit-advanced-reviews.css'); wp_register_script("ajax-back-end-script", YITH_YWAR_URL . 'assets/js/ywar-back-end.js', array('jquery', 'jquery-blockui')); $loader = apply_filters('yith_advanced_reviews_loader_gif', YITH_YWAR_ASSETS_URL . '/images/loading.gif'); wp_localize_script('ajax-back-end-script', 'ywar', array('loader' => $loader, 'ajax_url' => admin_url('admin-ajax.php'))); wp_enqueue_script("ajax-back-end-script"); }
/** * Enqueue scripts on administration comment page * * @param $hook */ function enqueue_admin_styles_scripts($hook) { if ('toplevel_page_Reviews' != get_current_screen()->id) { return; } /** Add Woocommerce.css file */ $styles = (array) WC_Frontend_Scripts::get_styles(); if (array_key_exists('woocommerce-general', $styles)) { wp_enqueue_style('woocommerce-general', $styles['woocommerce-general']['src']); } wp_enqueue_style('yit-style', YITH_YWAR_ASSETS_URL . '/css/yit-advanced-reviews.css'); wp_register_script("ajax-back-end-script", YITH_YWAR_URL . 'assets/js/ywar-back-end.js', array('jquery', 'jquery-blockui')); $loader = apply_filters('yith_advanced_reviews_loader_gif', YITH_YWAR_ASSETS_URL . '/images/loading.gif'); wp_localize_script('ajax-back-end-script', 'ywar', array('loader' => $loader, 'ajax_url' => admin_url('admin-ajax.php'))); wp_enqueue_script("ajax-back-end-script"); }