settings_key ); $api_key = $general_options && array_key_exists( 'api_key', $general_options ) ? $general_options['api_key'] : null; $api_secret = $general_options && array_key_exists( 'api_secret', $general_options ) ? $general_options['api_secret'] : null; $debug = $general_options && array_key_exists( 'debug', $general_options ) ? $general_options['debug'] : null; $this->api = new ConvertKit_API( $api_key, $api_secret, $debug ); add_action( 'admin_menu', array( $this, 'add_settings_page' ) ); add_action( 'admin_init', array( $this, 'register_sections' ) ); } /** * Add the options page */ public function add_settings_page() { add_options_page( __( 'ConvertKit', 'convertkit' ), __( 'ConvertKit', 'convertkit' ), 'manage_options', $this->settings_key, array( $this, 'display_settings_page' ) ); add_action( 'admin_print_styles', array( $this, 'admin_styles' ) ); } /** * Options page callback */ public function display_settings_page() { if ( isset( $_GET['tab'] ) ) { // WPCS: CSRF ok. $active_section = sanitize_text_field( wp_unslash( $_GET['tab'] ) ); // WPCS: CSRF ok. } else { $active_section = $this->sections[0]->name; } ?>
sections ) > 1 ) { $this->display_section_nav( $active_section ); } else { ?>

sections as $section ) : if ( $active_section === $section->name ) : $section->render(); endif; endforeach; // Check for Multibyte string PHP extension. if ( ! extension_loaded( 'mbstring' ) ) { ?>

mbstring' ) . ''; ?>

', '' ); ?>

is_registerable ) { array_push( $this->sections, $section_instance ); } } /** * Register each section */ public function register_sections() { wp_register_style( 'wp-convertkit-admin', plugins_url( '../resources/backend/wp-convertkit.css', __FILE__ ) ); $this->register_section( 'ConvertKit_Settings_General' ); $this->register_section( 'ConvertKit_Settings_Wishlist' ); $this->register_section( 'ConvertKit_Settings_ContactForm7' ); } } if ( is_admin() ) { $convertkit_settings = new ConvertKit_Settings(); include plugin_dir_path( __FILE__ ) . '../lib/class-multi-value-field-table.php'; include 'section/class-convertkit-settings-base.php'; include 'section/class-convertkit-settings-general.php'; include 'section/class-convertkit-settings-wishlist.php'; include 'section/class-convertkit-settings-contactform7.php'; }