add_hooks(); } /** * Add Hooks * * Adds functions to relavent hooks and filters * * @since 4.1.0 * @return void */ private function add_hooks() { add_action( "admin_init", array( $this, 'init' ) ); } /** * Prepares Settings Fields And Sections * * @since 4.1.0 * @return void */ public function init() { register_setting( 'qmn-settings-group', 'qmn-settings' ); add_settings_section( 'qmn-global-section', __( 'Main Settings', 'quiz-master-next' ), array( $this, 'global_section' ), 'qmn_global_settings' ); add_settings_field( 'usage-tracker', __( 'Allow Usage Tracking?', 'quiz-master-next' ), array( $this, 'usage_tracker_field' ), 'qmn_global_settings', 'qmn-global-section' ); add_settings_field( 'ip-collection', __( 'Disable collecting and storing IP addresses?', 'quiz-master-next' ), array( $this, 'ip_collection_field' ), 'qmn_global_settings', 'qmn-global-section' ); add_settings_field( 'cpt-search', __( 'Disable Quiz Posts From Being Searched?', 'quiz-master-next' ), array( $this, 'cpt_search_field' ), 'qmn_global_settings', 'qmn-global-section' ); add_settings_field( 'cpt-archive', __( 'Disable Quiz Archive?', 'quiz-master-next' ), array( $this, 'cpt_archive_field' ), 'qmn_global_settings', 'qmn-global-section' ); add_settings_field( 'cpt-slug', __( 'Quiz Url Slug', 'quiz-master-next' ), array( $this, 'cpt_slug_field' ), 'qmn_global_settings', 'qmn-global-section' ); add_settings_field( 'plural-name', __( 'Post Type Plural Name (Shown in various places such as on archive pages)', 'quiz-master-next' ), array( $this, 'plural_name_field' ), 'qmn_global_settings', 'qmn-global-section' ); add_settings_field( 'facebook-app-id', __( 'Facebook App Id', 'quiz-master-next' ), array( $this, 'facebook_app_id' ), 'qmn_global_settings', 'qmn-global-section' ); add_settings_field( 'from-name', __( 'From Name (The name emails come from)', 'quiz-master-next' ), array( $this, 'from_name' ), 'qmn_global_settings', 'qmn-global-section' ); add_settings_field( 'from-email', __( 'From Email (The email address that emails come from)', 'quiz-master-next' ), array( $this, 'from_email' ), 'qmn_global_settings', 'qmn-global-section' ); add_settings_field( 'results-details', __( 'Template For Admin Results Details', 'quiz-master-next' ), array( $this, 'results_details_template' ), 'qmn_global_settings', 'qmn-global-section' ); } /** * Generates Section Text * * Generates the section text. If page has been saved, flush rewrite rules for updated post type slug * * @since 4.1.0 * @return void */ public function global_section() { _e( 'These settings are applied to the entire plugin and all quizzes.', 'quiz-master-next' ); if ( isset( $_GET["settings-updated"] ) && $_GET["settings-updated"] ) { flush_rewrite_rules( true ); echo '
%CONTACT_ALL%
Name Provided: %USER_NAME%
Business Provided: %USER_BUSINESS%
Phone Provided: %USER_PHONE%
Email Provided: %USER_EMAIL%
Score Received: %AMOUNT_CORRECT%/%TOTAL_QUESTIONS% or %CORRECT_SCORE%% or %POINT_SCORE% points
The user took %TIMER% to complete quiz.
Comments entered were: %COMMENT_SECTION%
The answers were as follows:
%QUESTIONS_ANSWERS%"; } wp_editor( $template, 'results_template', array('textarea_name' => 'qmn-settings[results_details_template]') ); } /** * Generates Setting Field For Usage Tracker Authorization * * @since 4.1.0 * @return void */ public function usage_tracker_field() { $settings = (array) get_option( 'qmn-settings' ); $tracking_allowed = '0'; if (isset($settings['tracking_allowed'])) { $tracking_allowed = esc_attr( $settings['tracking_allowed'] ); } $checked = ''; if ($tracking_allowed == '2') { $checked = " checked='checked'"; } echo ''; echo "" . __( "Allow Quiz And Survey Master to anonymously track this plugin's usage and help us make this plugin better.", 'quiz-master-next' ) . ""; } /** * Generates Setting Field For IP Collection * * @since 5.3.0 * @return void */ public function ip_collection_field() { $settings = (array) get_option( 'qmn-settings' ); $ip_collection = '0'; if ( isset( $settings['ip_collection'] ) ) { $ip_collection = esc_attr( $settings['ip_collection'] ); } $checked = ''; if ( '1' == $ip_collection ) { $checked = " checked='checked'"; } echo ''; } /** * Generates Settings Page * * @since 4.1.0 * @return void */ public static function display_page() { global $mlwQuizMasterNext; wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ), array(), $mlwQuizMasterNext->version ); ?>