is_pricing_page_visible() : false; if ( ! $need_to_upgrade || '1' === get_option( 'owp_dismiss_sticky_notice' ) || true == apply_filters( 'oceanwp_licence_tab_enable', false ) || ! current_user_can( 'manage_options' ) ) { return; } // Display on the plugins and Theme Panel pages if ( 'plugins.php' == $pagenow || ( 'admin.php' == $pagenow && 'oceanwp' == $_GET['page'] ) ) { wp_enqueue_style( 'oe-admin-notice', plugins_url( '/assets/css/notice.min.css', __FILE__ ) ); $dismiss = wp_nonce_url( add_query_arg( 'owp_sticky_notice', 'dismiss_btn' ), 'dismiss_btn' ); ?>
is_pricing_page_visible() : false; if ( ! $need_to_upgrade || '1' === get_option( 'owp_dismiss_sticky_notice' ) || true == apply_filters( 'oceanwp_licence_tab_enable', false ) || ! current_user_can( 'manage_options' ) ) { return; } if ( 'toplevel_page_oceanwp' != $hook && 'plugins.php' != $pagenow ) { return; } // CSS wp_enqueue_style( 'oe-rating-notice', plugins_url( '/assets/css/notice.min.css', __FILE__ ) ); } /** * Return customizer panels * * @since 1.0.8 */ private static function get_panels() { $panels = array( 'oe_general_panel' => array( 'label' => esc_html__( 'General Panel', 'ocean-extra' ), ), 'oe_typography_panel' => array( 'label' => esc_html__( 'Typography Panel', 'ocean-extra' ), ), 'oe_topbar_panel' => array( 'label' => esc_html__( 'Top Bar Panel', 'ocean-extra' ), ), 'oe_header_panel' => array( 'label' => esc_html__( 'Header Panel', 'ocean-extra' ), ), 'oe_blog_panel' => array( 'label' => esc_html__( 'Blog Panel', 'ocean-extra' ), ), 'oe_sidebar_panel' => array( 'label' => esc_html__( 'Sidebar Panel', 'ocean-extra' ), ), 'oe_footer_widgets_panel' => array( 'label' => esc_html__( 'Footer Widgets Panel', 'ocean-extra' ), ), 'oe_footer_bottom_panel' => array( 'label' => esc_html__( 'Footer Bottom Panel', 'ocean-extra' ), ), 'oe_custom_code_panel' => array( 'label' => esc_html__( 'Custom CSS/JS Panel', 'ocean-extra' ), ), ); // Apply filters and return return apply_filters( 'oe_theme_panels', $panels ); } /** * Return customizer options * * @since 1.0.8 */ private static function get_options() { $options = array( 'custom_logo' => array( 'label' => esc_html__( 'Upload your logo', 'ocean-extra' ), 'desc' => esc_html__( 'Add your own logo and retina logo used for retina screens.', 'ocean-extra' ), ), 'site_icon' => array( 'label' => esc_html__( 'Add your favicon', 'ocean-extra' ), 'desc' => esc_html__( 'The favicon is used as a browser and app icon for your website.', 'ocean-extra' ), ), 'ocean_primary_color' => array( 'label' => esc_html__( 'Choose your primary color', 'ocean-extra' ), 'desc' => esc_html__( 'Replace the default primary and hover color by your own colors.', 'ocean-extra' ), ), 'ocean_typography_panel' => array( 'label' => esc_html__( 'Choose your typography', 'ocean-extra' ), 'desc' => esc_html__( 'Choose your own typography for any parts of your website.', 'ocean-extra' ), 'panel' => true, ), 'ocean_top_bar' => array( 'label' => esc_html__( 'Top bar options', 'ocean-extra' ), 'desc' => esc_html__( 'Enable/Disable the top bar, add your own paddings and colors.', 'ocean-extra' ), ), 'ocean_header_style' => array( 'label' => esc_html__( 'Header options', 'ocean-extra' ), 'desc' => esc_html__( 'Choose the style, the height and the colors for your site header.', 'ocean-extra' ), ), 'ocean_footer_widgets' => array( 'label' => esc_html__( 'Footer widgets options', 'ocean-extra' ), 'desc' => esc_html__( 'Choose the columns number, paddings and colors for the footer widgets.', 'ocean-extra' ), ), 'ocean_footer_bottom' => array( 'label' => esc_html__( 'Footer bottom options', 'ocean-extra' ), 'desc' => esc_html__( 'Add your copyright, paddings and colors for the footer bottom.', 'ocean-extra' ), ), ); // Apply filters and return return apply_filters( 'oe_customizer_options', $options ); } /** * Registers a new menu page * * @since 1.0.0 */ public static function add_page() { add_menu_page( esc_html__( 'Theme Panel', 'ocean-extra' ), 'Theme Panel', // This menu cannot be translated because it's used for the $hook prefix apply_filters( 'ocean_theme_panel_capabilities', 'manage_options' ), 'oceanwp-panel', '', 'dashicons-admin-generic', null ); // here can be some condition remove_menu_page( 'oceanwp-panel' ); } /** * Registers a new submenu page * * @since 1.0.0 */ public static function add_menu_subpage() { add_submenu_page( 'oceanwp-general', esc_html__( 'General', 'ocean-extra' ), esc_html__( 'General', 'ocean-extra' ), apply_filters( 'ocean_theme_panel_capabilities', 'manage_options' ), 'oceanwp-panel', array( 'Ocean_Extra_Theme_Panel', 'create_admin_page' ) ); } /** * Register a setting and its sanitization callback. * * @since 1.0.0 */ public static function register_settings() { register_setting( 'oe_panels_settings', 'oe_panels_settings', array( 'Ocean_Extra_Theme_Panel', 'validate_panels' ) ); register_setting( 'oceanwp_options', 'oceanwp_options', array( 'Ocean_Extra_Theme_Panel', 'admin_sanitize_license_options' ) ); } /** * Validate Settings Options * * @since 1.0.0 */ public static function admin_sanitize_license_options( $input ) { if ( current_user_can( 'manage_options' ) ) { // filter to save all settings to database $oceanwp_options = get_option( 'oceanwp_options' ); if ( isset( $input['licenses'] ) && ! empty( $input['licenses'] ) ) { foreach ( $input['licenses'] as $key => $value ) { if ( $oceanwp_options['licenses'][ $key ] ) { if ( strpos( $value, 'XXX' ) !== false && isset( $oceanwp_options['licenses'][ $key ] ) ) { $input['licenses'][ $key ] = $oceanwp_options['licenses'][ $key ]; } } } } return $input; } } /** * Main Sanitization callback * * @since 1.2.2 */ public static function validate_panels( $settings ) { // Get panels array $panels = self::get_panels(); if ( current_user_can( 'manage_options' ) && isset( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'oe_panels_settings-options' ) ) { foreach ( $panels as $key => $val ) { $settings[ $key ] = ! empty( $settings[ $key ] ) ? true : false; } } // Return the validated/sanitized settings return $settings; } /** * Get settings. * * @since 1.2.2 */ public static function get_setting( $option = '' ) { $defaults = self::get_default_settings(); $settings = wp_parse_args( get_option( 'oe_panels_settings', $defaults ), $defaults ); return isset( $settings[ $option ] ) ? $settings[ $option ] : false; } /** * Get default settings value. * * @since 1.2.2 */ public static function get_default_settings() { // Get panels array $panels = self::get_panels(); // Add array $default = array(); foreach ( $panels as $key => $val ) { $default[ $key ] = 1; } // Return return apply_filters( 'oe_default_panels', $default ); } /** * Settings page sidebar * * @since 1.4.0 */ public static function admin_page_sidebar() { // Image url $facebook = OE_URL . 'includes/panel/assets/img/facebook.svg'; // Bundle link $bundle_link = 'https://oceanwp.org/core-extensions-bundle/?utm_source=dash&utm_medium=theme-panel&utm_campaign=bundle'; // If bundle box $class = ''; if ( true != apply_filters( 'oceanwp_licence_tab_enable', false ) ) { $class = ' has-bundle'; } // Setup Wizard button if ( ! get_option( 'owp_wizard' ) ) { ?> =' ) ) { require_once $dir . 'scripts.php'; } } /** * Since the SDK is initiated within the functions.php of the theme, make sure to check if the SDK is set only after the theme's setup. * * @author Vova Feldman */ public static function load_addons_after_theme_setup() { if ( function_exists( 'owp_fs' ) ) { // Don't add extensions and licenses when Freemius is in place. return; } // Addons directory location $dir = OE_PATH . '/includes/panel/'; // Extensions require_once $dir . 'extensions.php'; // Licenses require_once $dir . 'licenses.php'; } /** * Theme panel CSS * * @since 1.0.0 */ public static function css( $hook ) { // Only load scripts when needed if ( 'toplevel_page_oceanwp-panel' != $hook ) { return; } // CSS wp_enqueue_style( 'oceanwp-theme-panel', plugins_url( '/assets/css/panel.min.css', __FILE__ ) ); } } new Ocean_Extra_Theme_Panel();