settings_obj;
if( isset( $_REQUEST['ays_submit'] ) ){
$actions->store_data();
}
if(isset($_GET['ays_survey_tab'])){
$ays_survey_tab = sanitize_text_field( $_GET['ays_survey_tab'] );
}else{
$ays_survey_tab = 'tab1';
}
$loader_iamge = '
';
$db_data = $actions->get_db_data();
$options = ($actions->ays_get_setting('options') === false) ? array() : json_decode($actions->ays_get_setting('options'), true);
global $wp_roles;
$ays_users_roles = $wp_roles->role_names;
$user_roles = $actions->ays_get_setting('user_roles');
if( $user_roles === null || $user_roles === false ){
$user_roles = array();
}else{
$user_roles = json_decode( $user_roles );
}
$survey_types = array(
// Free types
"radio" => array(
"type_name" => __("Radio", "survey-maker") ,
"type_version" => "free"
),
"checkbox" => array(
"type_name" => __("Checkbox (Multi)", "survey-maker") ,
"type_version" => "free"
),
"select" => array(
"type_name" => __("Dropdown", "survey-maker") ,
"type_version" => "free"
),
"star" => array(
"type_name" => __("Star Rating", "survey-maker") ,
"type_version" => "free"
),
"text" => array(
"type_name" => __("Paragraph", "survey-maker") ,
"type_version" => "free"
),
"short_text" => array(
"type_name" => __("Short Text", "survey-maker") ,
"type_version" => "free"
),
"number" => array(
"type_name" => __("Number", "survey-maker") ,
"type_version" => "free"
),
"phone" => array(
"type_name" => __("Phone", "survey-maker") ,
"type_version" => "free"
),
"date" => array(
"type_name" => __("Date", "survey-maker") ,
"type_version" => "free"
),
"time" => array(
"type_name" => __("Time", "survey-maker") ,
"type_version" => "free"
),
"date_time" => array(
"type_name" => __("Date and Time", "survey-maker") ,
"type_version" => "free"
),
"yesorno" => array(
"type_name" => __("Yes or No", "survey-maker") ,
"type_version" => "free"
),
"email" => array(
"type_name" => __("Email", "survey-maker") ,
"type_version" => "free"
),
"name" => array(
"type_name" => __("Name", "survey-maker") ,
"type_version" => "free"
),
// Pro types
"matrix_scale" => array(
"type_name" => __("Matrix Scale (Pro)", "survey-maker") ,
"type_version" => "pro"
),
"matrix_scale_checkbox" => array(
"type_name" => __("Matrix Scale Checkbox (Pro)", "survey-maker") ,
"type_version" => "pro"
),
"nps" => array(
"type_name" => __("Net Promoter Score (Pro)", "survey-maker") ,
"type_version" => "pro"
),
"ranking" => array(
"type_name" => __("Ranking (Pro)", "survey-maker") ,
"type_version" => "pro"
),
"calculation" => array(
"type_name" => __("Calculation (Pro)", "survey-maker") ,
"type_version" => "pro"
),
"star_list" => array(
"type_name" => __("Star List (Pro)", "survey-maker") ,
"type_version" => "pro"
),
"slider_list" => array(
"type_name" => __("Slider List (Pro)", "survey-maker") ,
"type_version" => "pro"
),
"linear_scale" => array(
"type_name" => __("Linear Scale (Pro)", "survey-maker") ,
"type_version" => "pro"
),
"slider" => array(
"type_name" => __("Slider (Pro)", "survey-maker") ,
"type_version" => "pro"
),
"uplaod" => array(
"type_name" => __("Upload (Pro)", "survey-maker") ,
"type_version" => "pro"
),
"hidden" => array(
"type_name" => __("Hidden (Pro)", "survey-maker") ,
"type_version" => "pro"
),
"html" => array(
"type_name" => __("HTML (Pro)", "survey-maker") ,
"type_version" => "pro"
),
);
// Survey question default type
$options['survey_default_type'] = !isset($options['survey_default_type']) ? 'radio' : $options['survey_default_type'];
$survey_default_type = (isset($options['survey_default_type']) && $options['survey_default_type'] != '') ? esc_attr($options['survey_default_type']) : 'radio';
$survey_answer_default_count = (isset($options['survey_answer_default_count']) && $options['survey_answer_default_count'] != '')? $options['survey_answer_default_count'] : 3;
// Do not store IP addresses
$options['survey_disable_user_ip'] = (isset($options['survey_disable_user_ip']) && $options['survey_disable_user_ip'] == 'on') ? $options['survey_disable_user_ip'] : 'off' ;
$survey_disable_user_ip = (isset($options['survey_disable_user_ip']) && $options['survey_disable_user_ip'] == 'on') ? true : false;
// Do not store user names
$options['survey_disable_user_name'] = (isset($options['survey_disable_user_name']) && $options['survey_disable_user_name'] != '') ? $options['survey_disable_user_name'] : 'off' ;
$survey_disable_user_name = (isset($options['survey_disable_user_name']) && $options['survey_disable_user_name'] == 'on') ? true : false;
// Do not store user emails
$options['survey_disable_user_email'] = (isset($options['survey_disable_user_email']) && $options['survey_disable_user_email'] != '') ? $options['survey_disable_user_email'] : 'off' ;
$survey_disable_user_email = (isset($options['survey_disable_user_email']) && $options['survey_disable_user_email'] == 'on') ? true : false;
$survey_submmission_title_length = (isset($options['survey_submissions_title_length']) && $options['survey_submissions_title_length'] != '') ? intval($options['survey_submissions_title_length']) : 5;
$survey_title_length = (isset($options['survey_title_length']) && $options['survey_title_length'] != '') ? intval($options['survey_title_length']) : 5;
$survey_categories_title_length = (isset($options['survey_categories_title_length']) && $options['survey_categories_title_length'] != '') ? intval($options['survey_categories_title_length']) : 5;
$survey_popups_title_length = (isset($options['survey_popups_title_length']) && $options['survey_popups_title_length'] != '') ? intval($options['survey_popups_title_length']) : 5;
// Animation Top
$survey_animation_top = (isset($options['survey_animation_top']) && $options['survey_animation_top'] != '') ? absint(intval($options['survey_animation_top'])) : 200;
$options['survey_enable_animation_top'] = isset($options['survey_enable_animation_top']) ? $options['survey_enable_animation_top'] : 'on';
$survey_enable_animation_top = (isset($options['survey_enable_animation_top']) && $options['survey_enable_animation_top'] == "on") ? true : false;
// Disable Survey Maker menu item notification
$options['survey_disable_survey_menu_notification'] = isset($options['survey_disable_survey_menu_notification']) ? esc_attr( $options['survey_disable_survey_menu_notification'] ) : 'off';
$survey_disable_survey_menu_notification = (isset($options['survey_disable_survey_menu_notification']) && esc_attr( $options['survey_disable_survey_menu_notification'] ) == "on") ? true : false;
// Disable Submissions menu item notification
$options['survey_disable_submission_menu_notification'] = isset($options['survey_disable_submission_menu_notification']) ? esc_attr( $options['survey_disable_submission_menu_notification'] ) : 'off';
$survey_disable_submission_menu_notification = (isset($options['survey_disable_submission_menu_notification']) && esc_attr( $options['survey_disable_submission_menu_notification'] ) == "on") ? true : false;
$survey_menu_badge_style_options = array(
'classic' => array(
'background' => '#ca4a1f',
'label' => __( 'Default', 'survey-maker' ),
),
'wp_default' => array(
'background' => '#3858e9',
'label' => __( 'WordPress default', 'survey-maker' ),
),
);
$options['survey_menu_badge_style'] = isset($options['survey_menu_badge_style']) ? sanitize_key( $options['survey_menu_badge_style'] ) : 'classic';
$survey_menu_badge_style = array_key_exists( $options['survey_menu_badge_style'], $survey_menu_badge_style_options ) ? $options['survey_menu_badge_style'] : 'classic';
// Textarea height (public)
$survey_textarea_height = (isset($options['survey_textarea_height']) && $options['survey_textarea_height'] != '' && $options['survey_textarea_height'] != 0) ? absint( sanitize_text_field($options['survey_textarea_height']) ) : 100;
// WP Editor height
$survey_wp_editor_height = (isset($options['survey_wp_editor_height']) && $options['survey_wp_editor_height'] != '' && $options['survey_wp_editor_height'] != 0) ? absint( esc_attr($options['survey_wp_editor_height']) ) : 100;
// Make question required
$options['survey_make_questions_required'] = (isset($options['survey_make_questions_required']) && $options['survey_make_questions_required'] != '') ? $options['survey_make_questions_required'] : 'off' ;
$survey_make_questions_required = (isset($options['survey_make_questions_required']) && $options['survey_make_questions_required'] == 'on') ? true : false;
// Lazy loading for images
$options['survey_lazy_loading_for_images'] = (isset($options['survey_lazy_loading_for_images']) && $options['survey_lazy_loading_for_images'] != '') ? $options['survey_lazy_loading_for_images'] : 'off' ;
$survey_lazy_loading_for_images = (isset($options['survey_lazy_loading_for_images']) && $options['survey_lazy_loading_for_images'] == 'on') ? true : false;
//Summary Email
$ays_survey_admin_email_sessions = array(
'hourly' => __('Hourly', "survey-maker"),
'daily' => __('Daily', "survey-maker"),
'twicedaily' => __('Twicedaily', "survey-maker"),
'weekly' => __('Weekly', "survey-maker"),
);
// Default texts | Start
$default_texts_res = ($actions->ays_get_setting('default_texts') === false) ? json_encode(array()) : $actions->ays_get_setting('default_texts');
$default_texts = json_decode($default_texts_res, true);
$wrong_shortcode_text = (isset($default_texts['wrong_shortcode_text']) && $default_texts['wrong_shortcode_text'] != '') ? stripslashes( esc_attr( $default_texts['wrong_shortcode_text'] ) ) : 'Wrong shortcode initialized';
$email_validation_error_text = (isset($default_texts['email_validation_error_text']) && $default_texts['email_validation_error_text'] != '') ? stripslashes( esc_attr( $default_texts['email_validation_error_text'] ) ) : 'Must be a valid email address';
$redirecting_after_text = (isset($default_texts['redirecting_after_text']) && $default_texts['redirecting_after_text'] != '') ? stripslashes( esc_attr( $default_texts['redirecting_after_text'] ) ) : 'Redirecting after';
// Default texts | End
$buttons_texts_res = ($actions->ays_get_setting('buttons_texts') === false) ? json_encode(array()) : $actions->ays_get_setting('buttons_texts');
$buttons_texts = json_decode($buttons_texts_res, true);
$survey_next_button = (isset($buttons_texts['next_button']) && $buttons_texts['next_button'] != '') ? stripslashes( esc_attr($buttons_texts['next_button']) ) : 'Next';
$survey_previous_button = (isset($buttons_texts['prev_button']) && $buttons_texts['prev_button'] != '') ? stripslashes( esc_attr($buttons_texts['prev_button']) ) : 'Prev';
$survey_restart_button = (isset($buttons_texts['restart_button']) && $buttons_texts['restart_button'] != '') ? stripslashes( esc_attr($buttons_texts['restart_button']) ) : 'Restart';
$survey_clear_button = (isset($buttons_texts['clear_button']) && $buttons_texts['clear_button'] != '') ? stripslashes( esc_attr($buttons_texts['clear_button']) ) : 'Clear selection';
$survey_finish_button = (isset($buttons_texts['finish_button']) && $buttons_texts['finish_button'] != '') ? stripslashes( esc_attr($buttons_texts['finish_button']) ) : 'Finish';
$survey_exit_button = (isset($buttons_texts['exit_button']) && $buttons_texts['exit_button'] != '') ? stripslashes( esc_attr($buttons_texts['exit_button']) ) : 'Exit';
$survey_login_button = (isset($buttons_texts['login_button']) && $buttons_texts['login_button'] != '') ? stripslashes( esc_attr($buttons_texts['login_button']) ) : 'Log In';
$survey_start_button = (isset($buttons_texts['start_button']) && $buttons_texts['start_button'] != '') ? stripslashes( esc_attr( $buttons_texts['start_button'] ) ) : 'Start';
$default_all_submissions_columns = array(
'User Name',
'Survey Name',
'Submission Date',
);
$ays_survey_user_history_columns_order = array(
'Survey Name',
'Submission Date',
);
// Add message varibales here
$message_variables = array(
'general_message_variables' => array(
'current_date' => __('The date of the submission survey.' , "survey-maker"),
'current_time' => __('The time of the submission survey.' , "survey-maker"),
'current_day' => __('The day of the submission survey.' , "survey-maker"),
'current_month' => __('The month of the submission survey.' , "survey-maker"),
'unique_code' => __('Use to identify the uniqueness of each attempt.' , "survey-maker"),
'post_id' => __('The ID of the current post.' , "survey-maker"),
'home_page_url' => __('The URL of the home page.' , "survey-maker"),
'post_author_email' => __('The Email of the author of the post.' , "survey-maker"),
'post_title' => __('The Post title of the current post.' , "survey-maker"),
'post_author_nickname' => __('The Nickname of the author of the post.' , "survey-maker"),
'post_author_display_name' => __('The Display name of the author of the post.' , "survey-maker"),
'post_author_first_name' => __('The First Name of the author of the post.' , "survey-maker"),
'post_author_last_name' => __('The Last Name of the author of the post.' , "survey-maker"),
'post_author_website_url' => __('The website url of the author of the post.' , "survey-maker"),
'post_author_roles' => __('The role(s) of the author of the post when logged-in. In case the user is not logged-in, the field will be empty.' , "survey-maker"),
'site_title' => __('The title of the website.' , "survey-maker"),
'site_description' => __('The description of the website.' , "survey-maker"),
),
'user_message_variables' => array(
'user_name' => __('The name the user entered into the survey form. It will work only if the name field exists in the form.' , "survey-maker"),
'user_email' => __('The E-mail the user entered into the survey form. It will work only if the email field exists in the form.' , "survey-maker"),
'user_wordpress_email' => __('The E-mail that was filled in their WordPress site during registration.' , "survey-maker"),
'user_id' => __('The ID of the current user.' , "survey-maker"),
'user_registered' => __('The user\'s registration date when logged-in. In case the user is not logged-in, the field will be empty.' , "survey-maker"),
'users_count' => __('The number of the passed users count of the given survey.' , "survey-maker"),
'users_first_name' => __('The user\'s first name that was filled in their WordPress site during registration.' , "survey-maker"),
'users_last_name' => __('The user\'s last name that was filled in their WordPress site during registration.' , "survey-maker"),
'users_nick_name' => __('The user\'s nick name that was filled in their WordPress site during registration.' , "survey-maker"),
'user_wordpress_roles' => __('The user\'s role(s) when logged-in. In case the user is not logged-in, the field will be empty.' , "survey-maker"),
'user_website_url' => __('The user\'s website url that was filled in their WordPress profile.' , "survey-maker"),
'users_display_name' => __('The user\'s display name that was filled in their WordPress site during registration.' , "survey-maker"),
'users_ip_address' => __('The user\'s ip address.' , "survey-maker"),
'admin_email' => __('Shows the admin\'s email that was filled in their WordPress profile.' , "survey-maker"),
),
'survey_message_variables' => array(
'survey_title' => __('The title of the survey.' , "survey-maker"),
'survey_category_title' => __('The title of the survey category.' , "survey-maker"),
'survey_id' => __('The ID of the survey.' , "survey-maker"),
'current_survey_author' => __('It will show the author of the current survey.' , "survey-maker"),
'current_survey_author_email' => __('It will show the author email of the current survey.' , "survey-maker"),
'current_survey_author_nickname' => __('It will show the author nickname of the current survey.' , "survey-maker"),
'current_survey_author_display_name' => __('It will show the author display name of the current survey.' , "survey-maker"),
'current_survey_author_website_url' => __('It will show the author Website URL of the current survey.' , "survey-maker"),
'current_survey_author_registered' => __('It will show the author registration date of the current survey.' , "survey-maker"),
'current_survey_page_link' => __('Prints the webpage link where the current survey is posted.' , "survey-maker"),
'questions_count' => __('The number of the questions of the given survey.' , "survey-maker"),
'sections_count' => __('The number of the sections of the given survey.' , "survey-maker"),
'submission_count' => __('Shows the submission count of a particular survey.' , "survey-maker"),
'creation_date' => __('The creation date of the survey.' , "survey-maker"),
'modified_date' => __('The last modified date of the survey.' , "survey-maker"),
)
);
?>