ption( 'woocommerce_attribute_lookup_regeneration_aborted', 'yes' ); } /** * Remove the flag indicating that the last lookup table regeneration process started was aborted. */ public function unset_regeneration_aborted_flag() { delete_option( 'woocommerce_attribute_lookup_regeneration_aborted' ); } /** * Tells if the last lookup table regeneration process started was aborted * (via deleting the 'woocommerce_attribute_lookup_regeneration_in_progress' option). * * @return bool True if the last lookup table regeneration process was aborted. */ public function regeneration_was_aborted(): bool { return get_option( 'woocommerce_attribute_lookup_regeneration_aborted' ) === 'yes'; } /** * Check if the lookup table contains any entry at all. * * @return bool True if the table contains entries, false if the table is empty. */ public function lookup_table_has_data(): bool { global $wpdb; // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared return ( (int) $wpdb->get_var( "SELECT EXISTS (SELECT 1 FROM {$this->lookup_table_name})" ) ) !== 0; } /** * Handler for 'woocommerce_get_sections_products', adds the "Advanced" section to the product settings. * * @param array $products Original array of settings sections. * @return array New array of settings sections. */ private function add_advanced_section_to_product_settings( array $products ): array { if ( $this->check_lookup_table_exists() ) { $products['advanced'] = __( 'Advanced', 'woocommerce' ); } return $products; } /** * Handler for 'woocommerce_get_settings_products', adds the settings related to the product attributes lookup table. * * @param array $settings Original settings configuration array. * @param string $section_id Settings section identifier. * @return array New settings configuration array. */ private function add_product_attributes_lookup_table_settings( array $settings, string $section_id ): array { if ( $section_id === 'advanced' && $this->check_lookup_table_exists() ) { $title_item = array( 'title' => __( 'Product attributes lookup table', 'woocommerce' ), 'type' => 'title', ); $regeneration_is_in_progress = $this->regeneration_is_in_progress(); if ( $regeneration_is_in_progress ) { $title_item['desc'] = __( 'These settings are not available while the lookup table regeneration is in progress.', 'woocommerce' ); } $settings[] = $title_item; if ( ! $regeneration_is_in_progress ) { $regeneration_aborted_warning = $this->regeneration_was_aborted() ? sprintf( "

%s

%s

", __( 'WARNING: The product attributes lookup table regeneration process was aborted.', 'woocommerce' ), __( 'This means that the table is probably in an inconsistent state. It\'s recommended to run a new regeneration process or to resume the aborted process (Status - Tools - Regenerate the product attributes lookup table/Resume the product attributes lookup table regeneration) before enabling the table usage.', 'woocommerce' ) ) : null; $settings[] = array( 'title' => __( 'Enable table usage', 'woocommerce' ), 'desc' => __( 'Use the product attributes lookup table for catalog filtering.', 'woocommerce' ), 'desc_tip' => $regeneration_aborted_warning, 'id' => 'woocommerce_attribute_lookup_enabled', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => 'start', ); $settings[] = array( 'title' => __( 'Direct updates', 'woocommerce' ), 'desc' => __( 'Update the table directly upon product changes, instead of scheduling a deferred update.', 'woocommerce' ), 'id' => 'woocommerce_attribute_lookup_direct_updates', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => 'start', ); } $settings[] = array( 'type' => 'sectionend' ); } return $settings; } } te a Google API key to use this feature. // Please visit: https://developers.google.com/fonts/docs/developer_api#Auth 'google_api_key' => '', // Set it you want google fonts to update weekly. A google_api_key value is required. 'google_update_weekly' => false, // Must be defined to add google fonts to the typography module 'async_typography' => true, // Use a asynchronous font on the front end or font string //'disable_google_fonts_link' => true, // Disable this in case you want to create your own google fonts loader 'admin_bar' => false, // Show the panel pages on the admin bar 'admin_bar_icon' => 'dashicons-portfolio', // Choose an icon for the admin bar menu 'admin_bar_priority' => 50, // Choose an priority for the admin bar menu 'global_variable' => '', // Set a different name for your global variable other than the opt_name 'dev_mode' => false, // Show the time the page took to load, etc 'update_notice' => true, // If dev_mode is enabled, will notify developer of updated versions available in the GitHub Repo 'customizer' => false, // Enable basic customizer support //'open_expanded' => true, // Allow you to start the panel in an expanded way initially. //'disable_save_warn' => true, // Disable the save warning when a user changes a field // OPTIONAL -> Give you extra features 'page_priority' => null, // Order where the menu appears in the admin area. If there is any conflict, something will not show. Warning. 'page_parent' => 'wpml_plugin_log', // For a full list of options, visit: http://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters 'page_permissions' => 'manage_options', // Permissions needed to access the options panel. 'menu_icon' => '', // Specify a custom URL to an icon 'last_tab' => '', // Force your panel to always open to a specific tab (by id) 'page_icon' => 'icon-themes', // Icon displayed in the admin panel next to your menu_title 'page_slug' => 'wpml_plugin_settings', // Page slug used to denote the panel 'save_defaults' => true, // On load save the defaults to DB before user clicks save or not 'default_show' => false, // If true, shows the default value next to each field that is not the default value. 'default_mark' => '*', // What to print by the field's title if the value shown is default. Suggested: * 'show_import_export' => true, // Shows the Import/Export panel when not used as a field. // CAREFUL -> These options are for advanced use only 'transient_time' => 60 * MINUTE_IN_SECONDS, 'output' => true, // Global shut-off for dynamic CSS output by the framework. Will also disable google fonts output 'output_tag' => true, // Allows dynamic CSS to be generated for customizer and google fonts, but stops the dynamic CSS from going to the head // 'footer_credit' => '', // Disable the footer credit of Redux. Please leave if you can help it. // FUTURE -> Not in use yet, but reserved or partially implemented. Use at your own risk. 'database' => '', // possible: options, theme_mods, theme_mods_expanded, transient. Not fully functional, warning! 'system_info' => false, // REMOVE // HINTS 'hints' => array( 'icon' => 'el el-question-sign', 'icon_position' => 'right', 'icon_color' => 'lightgray', 'icon_size' => 'normal', 'tip_style' => array( 'color' => 'light', 'shadow' => true, 'rounded' => false, 'style' => 'bootstrap', ), 'tip_position' => array( 'my' => 'top left', 'at' => 'bottom right', ), 'tip_effect' => array( 'show' => array( 'effect' => 'slide', 'duration' => '500', 'event' => 'mouseover', ), 'hide' => array( 'effect' => 'slide', 'duration' => '500', 'event' => 'click mouseleave', ), ), ) ); // SOCIAL ICONS -> Setup custom links in the footer for quick links in your panel footer icons. $this->args['share_icons'][] = array( 'url' => 'https://github.com/awesomemotive/wp-mail-logging/', 'title' => 'Visit us on GitHub', 'icon' => 'el-icon-github' //'img' => '', // You can use icon OR img. IMG needs to be a full URL. ); $this->args['share_icons'][] = array( 'url' => $this->plugin_meta['wp_uri'], 'title' => 'Visit us on WordPress', 'icon' => 'el-icon-wordpress' ); // Add content before the form. // $this->args['intro_text'] = __( '

This text is displayed above the options panel. It isn\'t required, but more info is always better! The intro_text field accepts all HTML.

', 'redux-framework-demo' ); // Add content after the form. // $this->args['footer_text'] = __( '

This text is displayed below the options panel. It isn\'t required, but more info is always better! The footer_text field accepts all HTML.

', 'redux-framework-demo' ); } } global $reduxConfig; } else { echo "The class named Redux_Framework_sample_config has already been called. Developers, you need to prefix this class with your company name or you'll run into problems!"; }