array( 'label' => __( 'Settings', 'visitors-online' ) ), 'misc' => array( 'label' => __( 'Misc', 'visitors-online' ) ), 'custom_code' => array( 'label' => __( 'Custom Code', 'visitors-online' ) ), 'license' => array( 'label' => __( 'License Key', 'visitors-online' ) ), ); parent::__construct( array( 'plugin_basename' => $plugin_basename, 'plugins_info' => $vstrsnln_plugin_info, 'prefix' => 'vstrsnln', 'default_options' => vstrsnln_get_options_default(), 'options' => $vstrsnln_options, 'is_network_options' => is_network_admin(), 'tabs' => $tabs, 'wp_slug' => 'visitors-online', 'link_key' => '1b01d30e84bb97b2afecb5f34c43931d', 'link_pn' => '216', 'doc_link' => 'https://docs.google.com/document/d/1FaTnRsYs64adPiRz_REGH9u0pOPz2flCL4gi49qdfaw', ) ); add_action( get_parent_class( $this ) . '_display_metabox', array( $this, 'display_metabox' ) ); $this->all_plugins = get_plugins(); } /** * Save plugin options to the database * * @access public * @return array The action results */ public function save_options() { global $wpdb; $message = ''; $notice = ''; $error = ''; if ( isset( $_POST['vstrsnln_save_options'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['vstrsnln_save_options'] ) ), 'vstrsnln_save_options' ) ) { if ( isset( $_POST['vstrsnln_button_clean'] ) ) { $wpdb->query( 'TRUNCATE `' . $wpdb->base_prefix . 'vstrsnln_general`;' ); $wpdb->query( 'TRUNCATE `' . $wpdb->base_prefix . 'vstrsnln_detailing`;' ); $vstrsnln_number_general = $wpdb->get_var( ' SELECT count( * ) FROM `' . $wpdb->base_prefix . 'vstrsnln_general` LIMIT 1' ); if ( empty( $vstrsnln_number_general ) ) { $message = __( 'Statistics was successfully cleared', 'visitors-online' ); } } else { /* Save data for settings page */ if ( isset( $_REQUEST['vstrsnln_check_user_interval'] ) ) { if ( absint( $_REQUEST['vstrsnln_check_user_interval'] ) !== $this->options['check_user_interval'] ) { /* Add the planned hook - check users online */ wp_clear_scheduled_hook( 'vstrsnln_check_users' ); if ( ! wp_next_scheduled( 'vstrsnln_check_users' ) ) { wp_schedule_event( time(), 'vstrsnln_interval', 'vstrsnln_check_users' ); } } if ( empty( $_REQUEST['vstrsnln_check_user_interval'] ) ) { $error = __( 'Please fill The time period. The settings are not saved', 'visitors-online' ); } elseif ( empty( $_REQUEST['vstrsnln_structure_pattern'] ) ) { $error = __( 'Please fill The data structure. The settings are not saved', 'visitors-online' ); } else { $this->options['check_user_interval'] = isset( $_REQUEST['vstrsnln_check_user_interval'] ) ? absint( $_REQUEST['vstrsnln_check_user_interval'] ) : 1; $this->options['structure_pattern'] = wp_kses_post( wp_unslash( $_REQUEST['vstrsnln_structure_pattern'] ) ); update_option( 'vstrsnln_options', $this->options ); $message = __( 'Settings saved', 'visitors-online' ); } } } } return compact( 'message', 'notice', 'error' ); } /** * Display tab "Settings" * * @access public */ public function tab_settings() { ?>
help_phrase(); ?>', '' ); ?>
', '' ); ?>