| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* The public-facing functionality of the plugin. |
| 5 |
* |
| 6 |
* @link https://ays-pro.com/ |
| 7 |
* @since 1.0.0 |
| 8 |
* |
| 9 |
* @package Survey_Maker |
| 10 |
* @subpackage Survey_Maker/public |
| 11 |
*/ |
| 12 |
|
| 13 |
/** |
| 14 |
* The public-facing functionality of the plugin. |
| 15 |
* |
| 16 |
* Defines the plugin name, version, and two examples hooks for how to |
| 17 |
* enqueue the public-facing stylesheet and JavaScript. |
| 18 |
* |
| 19 |
* @package Survey_Maker |
| 20 |
* @subpackage Survey_Maker/public |
| 21 |
* @author Survey Maker team <[email protected]> |
| 22 |
*/ |
| 23 |
class Survey_Maker_Public { |
| 24 |
|
| 25 |
/** |
| 26 |
* The ID of this plugin. |
| 27 |
* |
| 28 |
* @since 1.0.0 |
| 29 |
* @access private |
| 30 |
* @var string $plugin_name The ID of this plugin. |
| 31 |
*/ |
| 32 |
private $plugin_name; |
| 33 |
|
| 34 |
/** |
| 35 |
* The version of this plugin. |
| 36 |
* |
| 37 |
* @since 1.0.0 |
| 38 |
* @access private |
| 39 |
* @var string $version The current version of this plugin. |
| 40 |
*/ |
| 41 |
private $version; |
| 42 |
|
| 43 |
private $html_class_prefix = 'ays-survey-'; |
| 44 |
private $html_name_prefix = 'ays-survey-'; |
| 45 |
private $name_prefix = 'survey_'; |
| 46 |
private $unique_id; |
| 47 |
private $unique_id_in_class; |
| 48 |
private $options; |
| 49 |
private $settings; |
| 50 |
protected $default_texts; |
| 51 |
private $buttons_texts; |
| 52 |
private $lazy_loading; |
| 53 |
private $message_variable_data; |
| 54 |
|
| 55 |
/** |
| 56 |
* Initialize the class and set its properties. |
| 57 |
* |
| 58 |
* @since 1.0.0 |
| 59 |
* @param string $plugin_name The name of the plugin. |
| 60 |
* @param string $version The version of this plugin. |
| 61 |
*/ |
| 62 |
public function __construct( $plugin_name, $version ) { |
| 63 |
|
| 64 |
$this->plugin_name = $plugin_name; |
| 65 |
$this->version = $version; |
| 66 |
$this->settings = new Survey_Maker_Settings_Actions($this->plugin_name); |
| 67 |
|
| 68 |
add_shortcode('ays_survey', array($this, 'ays_generate_survey_method')); |
| 69 |
add_shortcode('ays_survey_popup', array($this, 'ays_generate_survey_popup_method')); |
| 70 |
} |
| 71 |
|
| 72 |
/** |
| 73 |
* Register the stylesheets for the public-facing side of the site. |
| 74 |
* |
| 75 |
* @since 1.0.0 |
| 76 |
*/ |
| 77 |
public function enqueue_styles() { |
| 78 |
|
| 79 |
/** |
| 80 |
* This function is provided for demonstration purposes only. |
| 81 |
* |
| 82 |
* An instance of this class should be passed to the run() function |
| 83 |
* defined in Survey_Maker_Loader as all of the hooks are defined |
| 84 |
* in that particular class. |
| 85 |
* |
| 86 |
* The Survey_Maker_Loader will then create the relationship |
| 87 |
* between the defined hooks and the functions defined in this |
| 88 |
* class. |
| 89 |
*/ |
| 90 |
|
| 91 |
wp_enqueue_style( $this->plugin_name . "-font-awesome", plugin_dir_url( __FILE__ ) . 'css/survey-maker-font-awesome.min.css', array(), $this->version, 'all' ); |
| 92 |
wp_enqueue_style( $this->plugin_name . "-transition", plugin_dir_url( __FILE__ ) . 'css/transition.min.css', array(), $this->version, 'all' ); |
| 93 |
wp_enqueue_style( $this->plugin_name . "-dropdown", plugin_dir_url( __FILE__ ) . 'css/dropdown.min.css', array(), $this->version, 'all' ); |
| 94 |
wp_enqueue_style( $this->plugin_name . '-select2', plugin_dir_url(__FILE__) . 'css/survey-maker-select2.min.css', array(), $this->version, 'all'); |
| 95 |
wp_enqueue_style( $this->plugin_name . "-loaders", plugin_dir_url( __FILE__ ) . 'css/loaders.css', array(), $this->version, 'all' ); |
| 96 |
wp_enqueue_style( $this->plugin_name . '-timepicker', plugin_dir_url( __FILE__ ) . '/css/survey-maker-timepicker.css', array(), $this->version, 'all'); |
| 97 |
|
| 98 |
} |
| 99 |
|
| 100 |
public function enqueue_styles_early(){ |
| 101 |
wp_enqueue_style( $this->plugin_name . '-min', plugin_dir_url( __FILE__ ) . 'css/survey-maker-public-min.css', array(), $this->version, 'all' ); |
| 102 |
} |
| 103 |
|
| 104 |
/** |
| 105 |
* Register the JavaScript for the public-facing side of the site. |
| 106 |
* |
| 107 |
* @since 1.0.0 |
| 108 |
*/ |
| 109 |
public function enqueue_scripts() { |
| 110 |
|
| 111 |
/** |
| 112 |
* This function is provided for demonstration purposes only. |
| 113 |
* |
| 114 |
* An instance of this class should be passed to the run() function |
| 115 |
* defined in Survey_Maker_Loader as all of the hooks are defined |
| 116 |
* in that particular class. |
| 117 |
* |
| 118 |
* The Survey_Maker_Loader will then create the relationship |
| 119 |
* between the defined hooks and the functions defined in this |
| 120 |
* class. |
| 121 |
*/ |
| 122 |
$is_elementor_exists = Survey_Maker_Data::ays_survey_is_elementor(); |
| 123 |
if( !$is_elementor_exists ){ |
| 124 |
wp_enqueue_script( $this->plugin_name . '-autosize', plugin_dir_url( __FILE__ ) . 'js/survey-maker-autosize.js', array( 'jquery' ), $this->version, false ); |
| 125 |
wp_enqueue_script( $this->plugin_name . '-transition', plugin_dir_url( __FILE__ ) . 'js/transition.min.js', array( 'jquery' ), $this->version, false ); |
| 126 |
wp_enqueue_script( $this->plugin_name . '-dropdown', plugin_dir_url( __FILE__ ) . 'js/dropdown.min.js', array( 'jquery' ), $this->version, false ); |
| 127 |
wp_enqueue_script( $this->plugin_name . '-select2js', plugin_dir_url(__FILE__) . 'js/survey-maker-select2.min.js', array('jquery'), $this->version, false); |
| 128 |
wp_enqueue_script( $this->plugin_name . '-plugin', plugin_dir_url( __FILE__ ) . 'js/survey-maker-public-plugin.js', array( 'jquery' ), $this->version, false ); |
| 129 |
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/survey-maker-public.js', array( 'jquery' ), $this->version, false ); |
| 130 |
wp_enqueue_script( $this->plugin_name . '-sweetalert-js', SURVEY_MAKER_PUBLIC_URL . '/js/survey-maker-sweetalert2.all.min.js', array('jquery'), $this->version, true ); |
| 131 |
wp_enqueue_script( $this->plugin_name . '-ajax', plugin_dir_url( __FILE__ ) . 'js/survey-maker-public-ajax.js', array( 'jquery' ), $this->version, false ); |
| 132 |
wp_enqueue_script( $this->plugin_name . "-timepicker", plugin_dir_url(__FILE__) . '/js/survey-maker-timepicker.js', array( 'jquery' ), $this->version, false ); |
| 133 |
|
| 134 |
wp_localize_script( $this->plugin_name . '-plugin', 'aysSurveyMakerAjaxPublic', array( |
| 135 |
'ajaxUrl' => admin_url('admin-ajax.php'), |
| 136 |
'warningIcon' => SURVEY_MAKER_PUBLIC_URL . "/images/warning.svg", |
| 137 |
'ajaxNonce' => wp_create_nonce( 'ays_survey_ajax_nonce' ), |
| 138 |
'autofill_nonce' => wp_create_nonce('survey_maker_autofill_nonce') |
| 139 |
) ); |
| 140 |
wp_localize_script( $this->plugin_name, 'aysSurveyLangObj', array( |
| 141 |
'notAnsweredText' => __( 'You have not answered this question', "survey-maker" ), |
| 142 |
'areYouSure' => __( 'Do you want to finish the quiz? Are you sure?', "survey-maker" ), |
| 143 |
'sorry' => __( 'Sorry', "survey-maker" ), |
| 144 |
'unableStoreData' => __( 'We are unable to store your data', "survey-maker" ), |
| 145 |
'connectionLost' => __( 'Connection is lost', "survey-maker" ), |
| 146 |
'checkConnection' => __( 'Please check your connection and try again', "survey-maker" ), |
| 147 |
'selectPlaceholder' => __( 'Select an answer', "survey-maker" ), |
| 148 |
'shareDialog' => __( 'Share Dialog', "survey-maker" ), |
| 149 |
'passwordIsWrong' => __( 'Password is wrong!', "survey-maker" ), |
| 150 |
'choose' => __( 'Choose', "survey-maker" ), |
| 151 |
'redirectAfter' => $this->default_texts['redirectingAfter'], |
| 152 |
'emailValidationError' => $this->default_texts['emailValidationError'], |
| 153 |
'requiredError' => __( 'This is a required question', "survey-maker" ), |
| 154 |
'minimumVotes' => __( 'Min votes count should be', "survey-maker" ), |
| 155 |
'maximumVotes' => __( 'Max votes count should be', "survey-maker" ), |
| 156 |
) ); |
| 157 |
} |
| 158 |
} |
| 159 |
|
| 160 |
public function enqueue_scripts_popups() { |
| 161 |
wp_enqueue_script( $this->plugin_name . '-popups', plugin_dir_url( __FILE__ ) . 'js/survey-maker-public-popups.js', array( 'jquery' ), $this->version, false ); |
| 162 |
wp_localize_script( $this->plugin_name . '-popups', 'aysSurveyMakerPopupsAjaxPublic', array( |
| 163 |
'ajaxUrl' => admin_url('admin-ajax.php'), |
| 164 |
'ajaxNonce' => wp_create_nonce( 'ays_survey_ajax_nonce' ), |
| 165 |
) ); |
| 166 |
} |
| 167 |
|
| 168 |
public function ays_survey_ajax(){ |
| 169 |
global $wpdb; |
| 170 |
|
| 171 |
if ( 'POST' !== strtoupper( isset( $_SERVER['REQUEST_METHOD'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_METHOD'] ) ) : '' ) ) { |
| 172 |
wp_send_json_error( array( 'message' => __( 'Invalid request method.', 'survey-maker' ) ), 405 ); |
| 173 |
} |
| 174 |
|
| 175 |
check_ajax_referer( 'ays_survey_ajax_nonce', '_ajax_nonce' ); |
| 176 |
|
| 177 |
$results = array( |
| 178 |
"status" => false |
| 179 |
); |
| 180 |
$function = isset($_REQUEST['function']) ? $_REQUEST['function'] : null; |
| 181 |
if($function !== null){ |
| 182 |
$data = $_REQUEST; |
| 183 |
$results = array(); |
| 184 |
unset($data['action']); |
| 185 |
unset($data['function']); |
| 186 |
switch ($function) { |
| 187 |
case 'ays_finish_survey': |
| 188 |
$results = $this->ays_finish_survey( $data ); |
| 189 |
break; |
| 190 |
case 'ays_survey_get_user_information': |
| 191 |
$results = $this->ays_survey_get_user_information( $data ); |
| 192 |
break; |
| 193 |
case 'ays_survey_popup_set_cookie': |
| 194 |
$results = $this->ays_survey_popup_set_cookie( $data ); |
| 195 |
break; |
| 196 |
} |
| 197 |
|
| 198 |
ob_end_clean(); |
| 199 |
$ob_get_clean = ob_get_clean(); |
| 200 |
wp_send_json( $results ); |
| 201 |
} |
| 202 |
|
| 203 |
ob_end_clean(); |
| 204 |
$ob_get_clean = ob_get_clean(); |
| 205 |
wp_send_json( $results ); |
| 206 |
} |
| 207 |
|
| 208 |
public function ays_finish_survey( $data ){ |
| 209 |
$unique_id = isset($data['unique_id']) ? $data['unique_id'] : null; |
| 210 |
if($unique_id === null){ |
| 211 |
return array("status" => false, "message" => "No no no" ); |
| 212 |
} else { |
| 213 |
global $wpdb; |
| 214 |
$name_prefix = 'ays-survey-'; |
| 215 |
$valid_name_prefix = 'survey_'; |
| 216 |
$survey_id = isset( $data[ $name_prefix . 'id-' . $unique_id ] ) ? absint( intval( $data[ $name_prefix . 'id-' . $unique_id ] ) ) : null; |
| 217 |
|
| 218 |
if($survey_id === null){ |
| 219 |
return array("status" => false, "message" => "No no no" ); |
| 220 |
}else{ |
| 221 |
$survey = Survey_Maker_Data::get_survey_by_id( $survey_id ); |
| 222 |
|
| 223 |
$user_id = get_current_user_id(); |
| 224 |
|
| 225 |
$attr = array( |
| 226 |
'id' => $survey_id |
| 227 |
); |
| 228 |
$options = Survey_Maker_Data::get_survey_validated_data_from_array( $survey, $attr ); |
| 229 |
|
| 230 |
$answered_questions = isset( $data[ $name_prefix . 'answers-' . $unique_id ] ) && !empty( $data[ $name_prefix . 'answers-' . $unique_id ] ) ? $data[ $name_prefix . 'answers-' . $unique_id ] : array(); |
| 231 |
$questions_data = isset( $data[ $name_prefix . 'questions-' . $unique_id ] ) && !empty( $data[ $name_prefix . 'questions-' . $unique_id ] ) ? $data[ $name_prefix . 'questions-' . $unique_id ] : array(); |
| 232 |
|
| 233 |
$survey_additional_wp_data = array(); |
| 234 |
if ( isset( $data[ $valid_name_prefix . 'additional_wp_data' ] ) && is_string( $data[ $valid_name_prefix . 'additional_wp_data' ] ) && '' !== $data[ $valid_name_prefix . 'additional_wp_data' ] ) { |
| 235 |
$decoded_additional_wp_data = base64_decode( wp_unslash( $data[ $valid_name_prefix . 'additional_wp_data' ] ), true ); |
| 236 |
if ( false !== $decoded_additional_wp_data ) { |
| 237 |
$decoded_additional_wp_data = json_decode( $decoded_additional_wp_data, true ); |
| 238 |
if ( is_array( $decoded_additional_wp_data ) ) { |
| 239 |
$survey_additional_wp_data = $decoded_additional_wp_data; |
| 240 |
} |
| 241 |
} |
| 242 |
} |
| 243 |
|
| 244 |
$survey_current_page_link = isset( $data['ays_'.$valid_name_prefix.'_current_page_link'] ) && $data['ays_'.$valid_name_prefix.'_current_page_link'] != '' ? sanitize_url( $data['ays_'.$valid_name_prefix.'_current_page_link'] ) : ""; |
| 245 |
|
| 246 |
$survey_current_page_link_html = "<a href='". esc_sql( $survey_current_page_link ) ."' target='_blank' class='ays-survey-current-page-link-a-tag'>". __( "Survey link", "survey-maker" ) ."</a>"; |
| 247 |
|
| 248 |
// Survey modified date |
| 249 |
$survey_modified_date = (isset($survey->date_modified) && $survey->date_modified != '') ? esc_attr( $survey->date_modified ) : ""; |
| 250 |
if( $survey_modified_date != "" ){ |
| 251 |
$survey_modified_date = date_i18n( get_option( 'date_format' ), strtotime( $survey_modified_date ) ); |
| 252 |
} |
| 253 |
|
| 254 |
$user_email = ''; |
| 255 |
if( isset( $data[ $name_prefix . 'user-email-' . $unique_id ] ) && !empty( $data[ $name_prefix . 'user-email-' . $unique_id ] ) ){ |
| 256 |
if( is_array( $data[ $name_prefix . 'user-email-' . $unique_id ] ) ){ |
| 257 |
$user_emails_arr = $data[ $name_prefix . 'user-email-' . $unique_id ]; |
| 258 |
$user_email = $answered_questions[ $user_emails_arr[ count( $user_emails_arr ) - 1 ] ]; |
| 259 |
}else{ |
| 260 |
$user_email = $answered_questions[ $data[ $name_prefix . 'user-email-' . $unique_id ] ]; |
| 261 |
} |
| 262 |
} |
| 263 |
if( is_array( $user_email ) ){ |
| 264 |
if( isset( $user_email['answer'] ) && !empty( $user_email['answer'] ) ){ |
| 265 |
$user_email = $user_email['answer']; |
| 266 |
}else{ |
| 267 |
$user_email = ''; |
| 268 |
} |
| 269 |
} |
| 270 |
$user_email = is_scalar( $user_email ) ? sanitize_email( $user_email ) : ''; |
| 271 |
|
| 272 |
$user_name = ''; |
| 273 |
if( isset( $data[ $name_prefix . 'user-name-' . $unique_id ] ) && !empty( $data[ $name_prefix . 'user-name-' . $unique_id ] ) ){ |
| 274 |
if( is_array( $data[ $name_prefix . 'user-name-' . $unique_id ] ) ){ |
| 275 |
$user_names_arr = $data[ $name_prefix . 'user-name-' . $unique_id ]; |
| 276 |
$user_name = $answered_questions[ $user_names_arr[ count( $user_names_arr ) - 1 ] ]; |
| 277 |
}else{ |
| 278 |
$user_name = $answered_questions[ $data[ $name_prefix . 'user-name-' . $unique_id ] ]; |
| 279 |
} |
| 280 |
} |
| 281 |
if( is_array( $user_name ) ){ |
| 282 |
if( isset( $user_name['answer'] ) && !empty( $user_name['answer'] ) ){ |
| 283 |
$user_name = $user_name['answer']; |
| 284 |
}else{ |
| 285 |
$user_name = ''; |
| 286 |
} |
| 287 |
} |
| 288 |
$user_name = is_scalar( $user_name ) ? sanitize_text_field( $user_name ) : ''; |
| 289 |
|
| 290 |
$result_unique_code = strtoupper( uniqid() ); |
| 291 |
|
| 292 |
$setting_options = Survey_Maker_Data::get_setting_data( 'options' ); |
| 293 |
|
| 294 |
// Do not store IP adressess |
| 295 |
$settings_options[ $valid_name_prefix . 'disable_user_ip' ] = (isset($setting_options[ $valid_name_prefix . 'disable_user_ip' ]) && $setting_options[ $valid_name_prefix . 'disable_user_ip' ] == 'on') ? stripslashes( $setting_options[ $valid_name_prefix . 'disable_user_ip' ] ): 'off'; |
| 296 |
$survey_disable_user_ip = (isset($setting_options[ $valid_name_prefix . 'disable_user_ip' ]) && $setting_options[ $valid_name_prefix . 'disable_user_ip' ] == 'on') ? true : false; |
| 297 |
|
| 298 |
// Do not store User Names |
| 299 |
$settings_options[ $valid_name_prefix . 'disable_user_name' ] = (isset($setting_options[ $valid_name_prefix . 'disable_user_name' ]) && $setting_options[ $valid_name_prefix . 'disable_user_name' ] == 'on') ? stripslashes( $setting_options[ $valid_name_prefix . 'disable_user_name' ] ): 'off'; |
| 300 |
$survey_disable_user_name = (isset($setting_options[ $valid_name_prefix . 'disable_user_name' ]) && $setting_options[ $valid_name_prefix . 'disable_user_name' ] == 'on') ? true : false; |
| 301 |
|
| 302 |
// Do not store User Emails |
| 303 |
$settings_options[ $valid_name_prefix . 'disable_user_email' ] = (isset($setting_options[ $valid_name_prefix . 'disable_user_email' ]) && $setting_options[ $valid_name_prefix . 'disable_user_email' ] == 'on') ? stripslashes( $setting_options[ $valid_name_prefix . 'disable_user_email' ] ): 'off'; |
| 304 |
$survey_disable_user_email = (isset($setting_options[ $valid_name_prefix . 'disable_user_email' ]) && $setting_options[ $valid_name_prefix . 'disable_user_email' ] == 'on') ? true : false; |
| 305 |
|
| 306 |
$survey_question_count = Survey_Maker_Data::get_survey_questions_count($survey_id); |
| 307 |
$survey_sections_count = Survey_Maker_Data::get_survey_sections_count($survey_id); |
| 308 |
$survey_passed_users_count = Survey_Maker_Data::ays_survey_get_passed_users_count($survey_id); |
| 309 |
|
| 310 |
$user_ip = ''; |
| 311 |
if($survey_disable_user_ip){ |
| 312 |
$user_ip = ''; |
| 313 |
}else{ |
| 314 |
$user_ip = Survey_Maker_Data::get_user_ip_validated(); |
| 315 |
$user_ip = ($user_ip != 'UNKNOWN') ? $user_ip : ''; |
| 316 |
} |
| 317 |
|
| 318 |
if ( $survey_disable_user_name ) { |
| 319 |
$user_name = ''; |
| 320 |
$user_id = ''; |
| 321 |
} |
| 322 |
|
| 323 |
if ( $survey_disable_user_email ) { |
| 324 |
$user_email = ''; |
| 325 |
$user_id = ''; |
| 326 |
} |
| 327 |
|
| 328 |
$survey_user_information = Survey_Maker_Data::get_user_profile_data(); |
| 329 |
// Get user first name |
| 330 |
$user_first_name = (isset( $survey_user_information['user_first_name'] ) && $survey_user_information['user_first_name'] != "") ? $survey_user_information['user_first_name'] : ''; |
| 331 |
|
| 332 |
// Get user last name |
| 333 |
$user_last_name = (isset( $survey_user_information['user_last_name'] ) && $survey_user_information['user_last_name'] != "") ? $survey_user_information['user_last_name'] : ''; |
| 334 |
|
| 335 |
// Get user nick name |
| 336 |
$user_nick_name = (isset( $survey_user_information['user_nickname'] ) && $survey_user_information['user_nickname'] != "") ? $survey_user_information['user_nickname'] : ''; |
| 337 |
|
| 338 |
// Get display name |
| 339 |
$user_display_name = (isset( $survey_user_information['user_display_name'] ) && $survey_user_information['user_display_name'] != "") ? $survey_user_information['user_display_name'] : ''; |
| 340 |
|
| 341 |
// User Wordpress role |
| 342 |
$user_wordpress_roles = (isset( $survey_user_information['user_wordpress_roles'] ) && $survey_user_information['user_wordpress_roles'] != "") ? $survey_user_information['user_wordpress_roles'] : ''; |
| 343 |
|
| 344 |
// User Website URL |
| 345 |
$user_website_url = (isset( $survey_user_information['user_website_url'] ) && $survey_user_information['user_website_url'] != "") ? $survey_user_information['user_website_url'] : ''; |
| 346 |
|
| 347 |
if ( ! empty( $user_website_url ) ) { |
| 348 |
$user_website_url = '<a href="'. $user_website_url .'" target="_blank">'. $user_website_url .'</a>'; |
| 349 |
} |
| 350 |
|
| 351 |
// User Registered |
| 352 |
$user_data = wp_get_current_user(); |
| 353 |
$user_registered = ''; |
| 354 |
if ( is_user_logged_in() ) { |
| 355 |
$user_registered = $user_data->user_registered; |
| 356 |
} |
| 357 |
|
| 358 |
// User ip address |
| 359 |
$user_ip_address = (isset( $survey_user_information['user_ip_address'] ) && $survey_user_information['user_ip_address'] != "") ? $survey_user_information['user_ip_address'] : ''; |
| 360 |
|
| 361 |
// User wordpress email |
| 362 |
$user_wordpress_email = (isset( $survey_user_information['user_wordpress_email'] ) && $survey_user_information['user_wordpress_email'] != "") ? esc_attr($survey_user_information['user_wordpress_email']) : ''; |
| 363 |
|
| 364 |
// Current date |
| 365 |
$survey_current_date = date_i18n( 'M d, Y', strtotime( sanitize_text_field( $_REQUEST['end_date'] ) ) ); |
| 366 |
|
| 367 |
// WP home page url |
| 368 |
$home_main_url = home_url(); |
| 369 |
$wp_home_page_url = '<a href="'.$home_main_url.'" target="_blank">'.$home_main_url.'</a>'; |
| 370 |
|
| 371 |
// Current time |
| 372 |
$survey_current_time = explode( ' ', current_time( 'mysql' ) ); |
| 373 |
$survey_current_time_only = ($survey_current_time[1]) ? $survey_current_time[1] : ''; |
| 374 |
|
| 375 |
// Current day |
| 376 |
$survey_current_day = date_i18n( 'l', strtotime( sanitize_text_field( $_REQUEST['end_date'] ) ) ); |
| 377 |
|
| 378 |
// Current month |
| 379 |
$survey_current_month = date_i18n( 'F', strtotime( sanitize_text_field( $_REQUEST['end_date'] ) ) ); |
| 380 |
|
| 381 |
// Get survey author |
| 382 |
$current_survey_user_data = get_userdata( $survey->author_id ); |
| 383 |
$current_survey_author = ''; |
| 384 |
$current_survey_author_email = ''; |
| 385 |
$current_survey_author_nickname = ''; |
| 386 |
$current_survey_author_display_name = ''; |
| 387 |
$current_survey_author_website_url = ''; |
| 388 |
$current_survey_author_registered = ''; |
| 389 |
if ( isset( $current_survey_user_data ) && $current_survey_user_data ) { |
| 390 |
// Get survey author name |
| 391 |
$current_survey_author = ( isset( $current_survey_user_data->data->display_name ) && $current_survey_user_data->data->display_name != '' ) ? sanitize_text_field( $current_survey_user_data->data->display_name ) : ""; |
| 392 |
// Get survey author email |
| 393 |
$current_survey_author_email = ( isset( $current_survey_user_data->data->user_email ) && $current_survey_user_data->data->user_email != '' ) ? sanitize_text_field( $current_survey_user_data->data->user_email ) : ""; |
| 394 |
// Get survey author nickname |
| 395 |
$current_survey_author_nickname = ( isset( $current_survey_user_data->data->user_nicename ) && $current_survey_user_data->data->user_nicename != '' ) ? sanitize_text_field( $current_survey_user_data->data->user_nicename ) : ""; |
| 396 |
// Get survey author display name |
| 397 |
$current_survey_author_display_name = ( isset( $current_survey_user_data->data->display_name ) && $current_survey_user_data->data->display_name != '' ) ? sanitize_text_field( $current_survey_user_data->data->display_name ) : ""; |
| 398 |
// Get survey author Website URL |
| 399 |
$current_survey_author_website_url = ( isset( $current_survey_user_data->data->user_url ) && $current_survey_user_data->data->user_url != '' ) ? sanitize_text_field( $current_survey_user_data->data->user_url ) : ""; |
| 400 |
// Get survey author Website URL |
| 401 |
$current_survey_author_registered = ( isset( $current_survey_user_data->data->user_registered ) && $current_survey_user_data->data->user_registered != '' ) ? sanitize_text_field( $current_survey_user_data->data->user_registered ) : ""; |
| 402 |
} |
| 403 |
|
| 404 |
if ( ! empty( $current_survey_author_website_url ) ) { |
| 405 |
$current_survey_author_website_url = '<a href="'. $current_survey_author_website_url .'" target="_blank">'. $current_survey_author_website_url .'</a>'; |
| 406 |
} |
| 407 |
|
| 408 |
$super_admin_email = ""; |
| 409 |
$wp_all_admins = get_users('role=Administrator'); |
| 410 |
if(!empty($wp_all_admins)){ |
| 411 |
$super_admin_email = isset($wp_all_admins[0]) ? $wp_all_admins[0]->data->user_email : ''; |
| 412 |
} |
| 413 |
|
| 414 |
$survey_current_post_id = ''; |
| 415 |
$survey_current_post_author_email = ''; |
| 416 |
$survey_current_post_author_nickname = ''; |
| 417 |
$survey_current_post_author_display_name = ''; |
| 418 |
$survey_current_post_author_first_name = ''; |
| 419 |
$survey_current_post_author_last_name = ''; |
| 420 |
$survey_current_post_author_website_url = ''; |
| 421 |
$survey_current_post_author_roles = ''; |
| 422 |
$survey_current_post_title = ''; |
| 423 |
if ( ! empty( $survey_additional_wp_data ) ) { |
| 424 |
$sanitize_additional_text = static function( $value ) { |
| 425 |
return is_scalar( $value ) ? esc_html( sanitize_text_field( wp_unslash( (string) $value ) ) ) : ''; |
| 426 |
}; |
| 427 |
|
| 428 |
$survey_post_type = isset( $survey_additional_wp_data['survey_post_type'] ) && is_scalar( $survey_additional_wp_data['survey_post_type'] ) ? sanitize_key( wp_unslash( (string) $survey_additional_wp_data['survey_post_type'] ) ) : ''; |
| 429 |
if ( 'post' === $survey_post_type ) { |
| 430 |
$survey_current_post_id = isset( $survey_additional_wp_data['survey_post_id'] ) && is_scalar( $survey_additional_wp_data['survey_post_id'] ) ? absint( $survey_additional_wp_data['survey_post_id'] ) : ''; |
| 431 |
} |
| 432 |
|
| 433 |
$survey_current_post_author_email = isset( $survey_additional_wp_data['survey_post_author_email'] ) && is_scalar( $survey_additional_wp_data['survey_post_author_email'] ) ? esc_html( sanitize_email( wp_unslash( (string) $survey_additional_wp_data['survey_post_author_email'] ) ) ) : ''; |
| 434 |
$survey_current_post_author_nickname = isset( $survey_additional_wp_data['survey_current_post_author_nickname'] ) ? $sanitize_additional_text( $survey_additional_wp_data['survey_current_post_author_nickname'] ) : ''; |
| 435 |
$survey_current_post_author_display_name = isset( $survey_additional_wp_data['survey_current_post_author_display_name'] ) ? $sanitize_additional_text( $survey_additional_wp_data['survey_current_post_author_display_name'] ) : ''; |
| 436 |
$survey_current_post_author_first_name = isset( $survey_additional_wp_data['survey_current_post_author_first_name'] ) ? $sanitize_additional_text( $survey_additional_wp_data['survey_current_post_author_first_name'] ) : ''; |
| 437 |
$survey_current_post_author_last_name = isset( $survey_additional_wp_data['survey_current_post_author_last_name'] ) ? $sanitize_additional_text( $survey_additional_wp_data['survey_current_post_author_last_name'] ) : ''; |
| 438 |
$survey_current_post_author_website_url = isset( $survey_additional_wp_data['survey_current_post_author_website_url'] ) && is_scalar( $survey_additional_wp_data['survey_current_post_author_website_url'] ) ? esc_url_raw( wp_unslash( (string) $survey_additional_wp_data['survey_current_post_author_website_url'] ) ) : ''; |
| 439 |
$survey_current_post_author_roles = isset( $survey_additional_wp_data['survey_current_post_author_roles'] ) ? $survey_additional_wp_data['survey_current_post_author_roles'] : ''; |
| 440 |
$survey_current_post_title = isset( $survey_additional_wp_data['survey_current_post_title'] ) ? $sanitize_additional_text( $survey_additional_wp_data['survey_current_post_title'] ) : ''; |
| 441 |
} |
| 442 |
|
| 443 |
if ( ! empty( $survey_current_post_author_website_url ) ) { |
| 444 |
$survey_current_post_author_website_url = '<a href="' . esc_url( $survey_current_post_author_website_url ) . '" target="_blank" rel="noopener noreferrer">' . esc_html( $survey_current_post_author_website_url ) . '</a>'; |
| 445 |
} |
| 446 |
|
| 447 |
if ( is_array( $survey_current_post_author_roles ) ) { |
| 448 |
$survey_current_post_author_roles = array_filter( $survey_current_post_author_roles, 'is_scalar' ); |
| 449 |
$survey_current_post_author_roles = array_map( static function( $role ) { |
| 450 |
return sanitize_text_field( wp_unslash( (string) $role ) ); |
| 451 |
}, $survey_current_post_author_roles ); |
| 452 |
$survey_current_post_author_roles = implode( ', ', $survey_current_post_author_roles ); |
| 453 |
} |
| 454 |
$survey_current_post_author_roles = is_scalar( $survey_current_post_author_roles ) ? esc_html( sanitize_text_field( wp_unslash( (string) $survey_current_post_author_roles ) ) ) : ''; |
| 455 |
|
| 456 |
$get_site_title = get_bloginfo('name'); |
| 457 |
$get_site_description = get_bloginfo('description'); |
| 458 |
|
| 459 |
$detectedDevice = Survey_Maker_Data::ays_survey_detected_device_chart(); |
| 460 |
|
| 461 |
$message_data = array( |
| 462 |
'survey_title' => stripslashes($survey->title), |
| 463 |
'survey_id' => stripslashes($survey->id), |
| 464 |
'post_id' => $survey_current_post_id, |
| 465 |
'user_name' => $user_name, |
| 466 |
'user_email' => $user_email, |
| 467 |
'user_wordpress_email' => $user_wordpress_email, |
| 468 |
'user_id' => $user_id, |
| 469 |
'user_registered' => $user_registered, |
| 470 |
'questions_count' => $survey_question_count, |
| 471 |
'current_date' => $survey_current_date, |
| 472 |
'current_time' => $survey_current_time_only, |
| 473 |
'current_day' => $survey_current_day, |
| 474 |
'current_month' => $survey_current_month, |
| 475 |
'unique_code' => $result_unique_code, |
| 476 |
'sections_count' => $survey_sections_count, |
| 477 |
'users_count' => $survey_passed_users_count, |
| 478 |
'users_first_name' => $user_first_name, |
| 479 |
'users_last_name' => $user_last_name, |
| 480 |
'users_nick_name' => $user_nick_name, |
| 481 |
'users_display_name' => $user_display_name, |
| 482 |
'users_ip_address' => $user_ip_address, |
| 483 |
'user_wordpress_roles' => $user_wordpress_roles, |
| 484 |
'user_website_url' => $user_website_url, |
| 485 |
'creation_date' => date_i18n( get_option( 'date_format' ), strtotime( sanitize_text_field( $survey->date_created ) ) ), |
| 486 |
'modified_date' => $survey_modified_date, |
| 487 |
'current_survey_author' => $current_survey_author, |
| 488 |
'current_survey_author_email' => $current_survey_author_email, |
| 489 |
'current_survey_author_nickname' => $current_survey_author_nickname, |
| 490 |
'current_survey_author_display_name' => $current_survey_author_display_name, |
| 491 |
'current_survey_author_website_url' => $current_survey_author_website_url, |
| 492 |
'current_survey_author_registered' => $current_survey_author_registered, |
| 493 |
'current_survey_page_link' => $survey_current_page_link_html, |
| 494 |
'admin_email' => $super_admin_email, |
| 495 |
'home_page_url' => $wp_home_page_url, |
| 496 |
'post_author_email' => $survey_current_post_author_email, |
| 497 |
'post_author_nickname' => $survey_current_post_author_nickname, |
| 498 |
'post_author_display_name' => $survey_current_post_author_display_name, |
| 499 |
'post_author_first_name' => $survey_current_post_author_first_name, |
| 500 |
'post_author_last_name' => $survey_current_post_author_last_name, |
| 501 |
'post_author_website_url' => $survey_current_post_author_website_url, |
| 502 |
'post_author_roles' => $survey_current_post_author_roles, |
| 503 |
'post_title' => $survey_current_post_title, |
| 504 |
'site_title' => $get_site_title, |
| 505 |
'site_description' => $get_site_description, |
| 506 |
); |
| 507 |
|
| 508 |
$send_data = array( |
| 509 |
'questions_data' => $questions_data, |
| 510 |
'answered_questions' => $answered_questions, |
| 511 |
'survey' => $survey, |
| 512 |
'questions_ids' => $survey->question_ids, |
| 513 |
'user_id' => $user_id, |
| 514 |
'user_ip' => $user_ip, |
| 515 |
'user_name' => $user_name, |
| 516 |
'user_email' => $user_email, |
| 517 |
'start_date' => current_time( 'mysql' ), |
| 518 |
'end_date' => current_time( 'mysql' ), |
| 519 |
'unique_code' => $result_unique_code, |
| 520 |
'detectedDevice' => $detectedDevice, |
| 521 |
); |
| 522 |
$check_limitations = false; |
| 523 |
if(isset($options['survey_limit_users']) && $options['survey_limit_users']){ |
| 524 |
$limit_users_by = isset($options['survey_limit_users_by']) && $options['survey_limit_users_by'] != "" ? $options['survey_limit_users_by'] : ""; |
| 525 |
$limit_users_attr = array( |
| 526 |
'id' => $survey_id, |
| 527 |
'name' => 'ays_survey_cookie_', |
| 528 |
'title' => $survey->title, |
| 529 |
); |
| 530 |
$check_limitations = $this->ays_survey_check_limitations($limit_users_by, $limit_users_attr); |
| 531 |
} |
| 532 |
$result = $this->add_results_to_db( $send_data ); |
| 533 |
|
| 534 |
// Get submission count |
| 535 |
$survey_submission_count_and_ids = Survey_Maker_Data::get_submission_count_and_ids_for_summary($survey_id); |
| 536 |
$survey_submission_count = isset($survey_submission_count_and_ids['submission_count']) && $survey_submission_count_and_ids['submission_count'] != '' ? esc_attr($survey_submission_count_and_ids['submission_count']) : ''; |
| 537 |
$message_data['submission_count'] = $survey_submission_count; |
| 538 |
|
| 539 |
|
| 540 |
$thank_you_message = trim( $options[ $valid_name_prefix . 'final_result_text' ] ); |
| 541 |
if( $thank_you_message == '' ){ |
| 542 |
$thank_you_message = __( "Thank you for completing this survey.", "survey-maker" ); |
| 543 |
} |
| 544 |
|
| 545 |
$thank_you_message = Survey_Maker_Data::replace_message_variables($thank_you_message, $message_data); |
| 546 |
|
| 547 |
$thank_you_message = Survey_Maker_Data::ays_autoembed( $thank_you_message ); |
| 548 |
|
| 549 |
$heading_for_share_buttons = ''; |
| 550 |
if( isset($options['survey_social_buttons']) && $options['survey_social_buttons'] ){ |
| 551 |
$heading_for_share_buttons = $options[ $this->name_prefix . 'social_buttons_heading' ]; |
| 552 |
$heading_for_share_buttons = Survey_Maker_Data::replace_message_variables($heading_for_share_buttons, $message_data); |
| 553 |
$heading_for_share_buttons = Survey_Maker_Data::ays_autoembed( $heading_for_share_buttons ); |
| 554 |
} |
| 555 |
|
| 556 |
return array( |
| 557 |
'status' => $result, |
| 558 |
"message" => $thank_you_message, |
| 559 |
"limited" => $check_limitations, |
| 560 |
"socialHeading" => $heading_for_share_buttons |
| 561 |
); |
| 562 |
} |
| 563 |
} |
| 564 |
|
| 565 |
return array("status" => false, "message" => "No no no" ); |
| 566 |
} |
| 567 |
|
| 568 |
protected function add_results_to_db( $data ){ |
| 569 |
global $wpdb; |
| 570 |
|
| 571 |
$questions_table = ( $wpdb->prefix . SURVEY_MAKER_DB_PREFIX ) . "questions"; |
| 572 |
$answers_table = ( $wpdb->prefix . SURVEY_MAKER_DB_PREFIX ) . "answers"; |
| 573 |
$submissions_table = ( $wpdb->prefix . SURVEY_MAKER_DB_PREFIX ) . "submissions"; |
| 574 |
$submissions_questions_table = ( $wpdb->prefix . SURVEY_MAKER_DB_PREFIX ) . "submissions_questions"; |
| 575 |
|
| 576 |
$survey = $data['survey']; |
| 577 |
$questions_ids = $data['questions_ids']; |
| 578 |
$user_id = $data['user_id']; |
| 579 |
$user_ip = $data['user_ip']; |
| 580 |
$user_name = $data['user_name']; |
| 581 |
$user_email = $data['user_email']; |
| 582 |
$start_date = $data['start_date']; |
| 583 |
$end_date = $data['end_date']; |
| 584 |
$answered_questions = $data['answered_questions']; |
| 585 |
$questions_data = $data['questions_data']; |
| 586 |
$duration = strtotime($end_date) - strtotime($start_date); |
| 587 |
$unique_code = $data['unique_code']; |
| 588 |
$detectedDevice = $data['detectedDevice']; |
| 589 |
|
| 590 |
$question_ids_array = $questions_ids != '' ? explode(',', $questions_ids) : array(); |
| 591 |
$questions_count = count( $question_ids_array ); |
| 592 |
|
| 593 |
$options = array( |
| 594 |
'device' => $detectedDevice, |
| 595 |
); |
| 596 |
|
| 597 |
$results_submissions = $wpdb->insert( |
| 598 |
$submissions_table, |
| 599 |
array( |
| 600 |
'survey_id' => absint( intval( $survey->id ) ), |
| 601 |
'questions_ids' => $questions_ids, |
| 602 |
'user_id' => $user_id, |
| 603 |
'user_ip' => $user_ip, |
| 604 |
'user_name' => $user_name, |
| 605 |
'user_email' => $user_email, |
| 606 |
'start_date' => $start_date, |
| 607 |
'end_date' => $end_date, |
| 608 |
'submission_date' => $end_date, |
| 609 |
'duration' => $duration, |
| 610 |
'questions_count' => $questions_count, |
| 611 |
'unique_code' => $unique_code, |
| 612 |
'options' => json_encode($options) |
| 613 |
), |
| 614 |
array( |
| 615 |
'%d', // survey_id |
| 616 |
'%s', // questions_ids |
| 617 |
'%d', // user_id |
| 618 |
'%s', // user_ip |
| 619 |
'%s', // user_name |
| 620 |
'%s', // user_email |
| 621 |
'%s', // start_date |
| 622 |
'%s', // end_date |
| 623 |
'%s', // submission_date |
| 624 |
'%s', // duration |
| 625 |
'%s', // questions_count |
| 626 |
'%s', // unique_code |
| 627 |
'%s' // options |
| 628 |
) |
| 629 |
); |
| 630 |
|
| 631 |
$submission_id = $wpdb->insert_id; |
| 632 |
|
| 633 |
$results_submissions_questions = 0; |
| 634 |
foreach ($question_ids_array as $key => $qid) { |
| 635 |
$questions_options = array( |
| 636 |
|
| 637 |
); |
| 638 |
|
| 639 |
$user_answer = ''; |
| 640 |
$user_variant = ''; |
| 641 |
$section_id = $questions_data[$qid]['section']; |
| 642 |
|
| 643 |
$question_answer = ''; |
| 644 |
if( isset( $answered_questions[$qid] ) ){ |
| 645 |
if( isset( $answered_questions[$qid]['other'] ) ){ |
| 646 |
$user_variant = sanitize_text_field( $answered_questions[$qid]['other'] ); |
| 647 |
unset( $answered_questions[$qid]['other'] ); |
| 648 |
} |
| 649 |
|
| 650 |
if( is_array( $answered_questions[$qid] ) ){ |
| 651 |
if( isset( $answered_questions[$qid]['answer'] ) && !empty( $answered_questions[$qid]['answer'] ) ){ |
| 652 |
$question_answer = $answered_questions[$qid]['answer']; |
| 653 |
}else{ |
| 654 |
$question_answer = ''; |
| 655 |
} |
| 656 |
}else{ |
| 657 |
$question_answer = $answered_questions[$qid]; |
| 658 |
} |
| 659 |
} |
| 660 |
$answer_id = $question_answer; |
| 661 |
|
| 662 |
$question_type = (isset($questions_data[$qid]['questionType']) && $questions_data[$qid]['questionType'] != '') ? stripslashes ( sanitize_text_field( $questions_data[$qid]['questionType'] ) ) : 'radio'; |
| 663 |
switch ( $question_type ) { |
| 664 |
case "radio": |
| 665 |
$user_answer = ''; |
| 666 |
if($question_answer != ""){ |
| 667 |
$user_variant = ''; |
| 668 |
} |
| 669 |
break; |
| 670 |
case "checkbox": |
| 671 |
if( is_array( $question_answer ) ){ |
| 672 |
if( !in_array( '0', $question_answer ) ){ |
| 673 |
$user_variant = ''; |
| 674 |
} |
| 675 |
$user_answer = implode(',', array_map( 'absint', $question_answer )); |
| 676 |
}else{ |
| 677 |
$user_answer = absint( $question_answer ); |
| 678 |
if( '0' != $question_answer ){ |
| 679 |
$user_variant = ''; |
| 680 |
} |
| 681 |
} |
| 682 |
$answer_id = 0; |
| 683 |
break; |
| 684 |
case "select": |
| 685 |
$user_answer = ''; |
| 686 |
break; |
| 687 |
case "text": |
| 688 |
$user_answer = is_scalar( $question_answer ) ? sanitize_textarea_field( $question_answer ) : ''; |
| 689 |
$answer_id = 0; |
| 690 |
break; |
| 691 |
case "star": |
| 692 |
$user_answer = is_scalar( $question_answer ) ? sanitize_text_field( $question_answer ) : ''; |
| 693 |
$answer_id = 0; |
| 694 |
break; |
| 695 |
case "short_text": |
| 696 |
$user_answer = is_scalar( $question_answer ) ? sanitize_text_field( $question_answer ) : ''; |
| 697 |
$answer_id = 0; |
| 698 |
break; |
| 699 |
case "number": |
| 700 |
case "phone": |
| 701 |
case "date": |
| 702 |
$user_answer = is_scalar( $question_answer ) ? sanitize_text_field( $question_answer ) : ''; |
| 703 |
$answer_id = 0; |
| 704 |
break; |
| 705 |
case "time": |
| 706 |
$user_answer = is_scalar( $question_answer ) ? sanitize_text_field( $question_answer ) : ''; |
| 707 |
$answer_id = 0; |
| 708 |
break; |
| 709 |
case "date_time": |
| 710 |
if( is_array( $question_answer ) ){ |
| 711 |
$question_answer_date = isset( $question_answer['date'] ) && is_scalar( $question_answer['date'] ) && $question_answer['date'] != '' ? stripslashes( sanitize_text_field( $question_answer['date'] ) ) : '-'; |
| 712 |
$question_answer_time = isset( $question_answer['time'] ) && is_scalar( $question_answer['time'] ) && $question_answer['time'] != '' ? stripslashes( sanitize_text_field( $question_answer['time'] ) ) : '-'; |
| 713 |
$user_answer = $question_answer_date != '-' || $question_answer_time != '-' ? $question_answer_date . ' ' . $question_answer_time : ''; |
| 714 |
} |
| 715 |
else{ |
| 716 |
$user_answer = is_scalar( $question_answer ) ? sanitize_text_field( $question_answer ) : ''; |
| 717 |
} |
| 718 |
$answer_id = 0; |
| 719 |
break; |
| 720 |
case "name": |
| 721 |
$user_answer = is_scalar( $question_answer ) ? sanitize_text_field( $question_answer ) : ''; |
| 722 |
$answer_id = 0; |
| 723 |
break; |
| 724 |
case "email": |
| 725 |
$user_answer = is_scalar( $question_answer ) ? sanitize_email( $question_answer ) : ''; |
| 726 |
$answer_id = 0; |
| 727 |
break; |
| 728 |
default: |
| 729 |
$user_answer = ''; |
| 730 |
break; |
| 731 |
} |
| 732 |
|
| 733 |
$results_submissions_quests = $wpdb->insert( |
| 734 |
$submissions_questions_table, |
| 735 |
array( |
| 736 |
'submission_id' => intval( $submission_id ), |
| 737 |
'question_id' => intval( $qid ), |
| 738 |
'section_id' => intval( $section_id ), |
| 739 |
'survey_id' => intval( $survey->id ), |
| 740 |
'user_id' => $user_id, |
| 741 |
'answer_id' => intval( $answer_id ), |
| 742 |
'user_answer' => $user_answer, |
| 743 |
'user_variant' => $user_variant, |
| 744 |
'user_explanation' => '', |
| 745 |
'type' => $question_type, |
| 746 |
'options' => json_encode( $questions_options ) |
| 747 |
), |
| 748 |
array( |
| 749 |
'%d', // submission_id |
| 750 |
'%d', // question_id |
| 751 |
'%d', // section_id |
| 752 |
'%d', // survey_id |
| 753 |
'%d', // user_id |
| 754 |
'%d', // answer_id |
| 755 |
'%s', // user_answer |
| 756 |
'%s', // user_variant |
| 757 |
'%s', // user_explanation |
| 758 |
'%s', // type |
| 759 |
'%s', // options |
| 760 |
) |
| 761 |
); |
| 762 |
} |
| 763 |
|
| 764 |
if ($results_submissions >= 0) { |
| 765 |
return true; |
| 766 |
} |
| 767 |
|
| 768 |
return false; |
| 769 |
} |
| 770 |
|
| 771 |
public function ays_generate_survey_method( $attr ){ |
| 772 |
$id = (isset($attr['id'])) ? absint(intval($attr['id'])) : null; |
| 773 |
$this->default_texts = Survey_Maker_Data::ays_set_default_texts( $this->plugin_name, array() ); |
| 774 |
|
| 775 |
if (is_null($id)) { |
| 776 |
$content = "<p class='wrong_shortcode_text' style='color:red;'>" . $this->default_texts['wrongShortcode'] . "</p>"; |
| 777 |
return $content; |
| 778 |
} |
| 779 |
|
| 780 |
$this->enqueue_styles(); |
| 781 |
$this->enqueue_scripts(); |
| 782 |
|
| 783 |
$content = $this->show_survey($id, $attr); |
| 784 |
return str_replace( array( "\r\n", "\n", "\r" ), '', $content ); |
| 785 |
} |
| 786 |
|
| 787 |
public function show_survey( $id, $attr ){ |
| 788 |
|
| 789 |
$survey = Survey_Maker_Data::get_survey_by_id( $id ); |
| 790 |
|
| 791 |
if ( is_null( $survey ) ) { |
| 792 |
return "<p class='wrong_shortcode_text' style='color:red;'>" . $this->default_texts['wrongShortcode'] . "</p>"; |
| 793 |
} |
| 794 |
|
| 795 |
$status = isset( $survey->status ) && $survey->status != '' ? sanitize_text_field($survey->status) : ''; |
| 796 |
|
| 797 |
if ( $status == 'trashed' ) { |
| 798 |
return "<p class='wrong_shortcode_text' style='color:red;'>" . $this->default_texts['wrongShortcode'] . "</p>"; |
| 799 |
} |
| 800 |
elseif( $status == 'draft' ){ |
| 801 |
return ''; |
| 802 |
} |
| 803 |
|
| 804 |
$unique_id = uniqid(); |
| 805 |
$this->unique_id = $unique_id; |
| 806 |
$this->unique_id_in_class = $id . "-" . $unique_id;; |
| 807 |
|
| 808 |
/*******************************************************************************************************/ |
| 809 |
|
| 810 |
$settings_options = $this->settings->ays_get_setting('options'); |
| 811 |
if($settings_options){ |
| 812 |
$settings_options = json_decode( $settings_options, true ); |
| 813 |
}else{ |
| 814 |
$settings_options = array(); |
| 815 |
} |
| 816 |
|
| 817 |
// $this->buttons_texts = Survey_Maker_Data::ays_set_survey_texts( $this->plugin_name, $this->options ); |
| 818 |
|
| 819 |
$this->message_variable_data = Survey_Maker_Data::ays_set_survey_message_variables_data( $id, $survey, $settings_options ); |
| 820 |
|
| 821 |
$this->options = Survey_Maker_Data::get_survey_validated_data_from_array( $survey, $attr ); |
| 822 |
|
| 823 |
$this->buttons_texts = Survey_Maker_Data::ays_set_survey_texts( $this->plugin_name, $this->options ); |
| 824 |
|
| 825 |
|
| 826 |
$user_id = get_current_user_id(); |
| 827 |
|
| 828 |
/*******************************************************************************************************/ |
| 829 |
|
| 830 |
/* |
| 831 |
========================================== |
| 832 |
General settings |
| 833 |
========================================== |
| 834 |
*/ |
| 835 |
|
| 836 |
// Textarea height (public) |
| 837 |
$this->options[ $this->name_prefix . 'textarea_height' ] = (isset($settings_options['survey_textarea_height']) && $settings_options['survey_textarea_height'] != '' && $settings_options['survey_textarea_height'] != 0) ? absint( sanitize_text_field($settings_options['survey_textarea_height']) ) : 100; |
| 838 |
|
| 839 |
// Lazy loading for images |
| 840 |
$this->options[ $this->name_prefix . 'lazy_loading_for_images' ] = (isset($settings_options['survey_lazy_loading_for_images']) && $settings_options['survey_lazy_loading_for_images'] == 'on') ? true : false; |
| 841 |
$this->lazy_loading = ''; |
| 842 |
if($this->options[ $this->name_prefix . 'lazy_loading_for_images' ]){ |
| 843 |
$this->lazy_loading = Survey_Maker_Data::survey_lazy_loading_for_images($this->options[ $this->name_prefix . 'lazy_loading_for_images' ]); |
| 844 |
} |
| 845 |
/*******************************************************************************************************/ |
| 846 |
|
| 847 |
|
| 848 |
$options = isset( $survey->options ) && $survey->options != '' ? json_decode( $survey->options, true ) : array(); |
| 849 |
|
| 850 |
$sections_ids = isset( $survey->section_ids ) && $survey->section_ids != '' ? $survey->section_ids : ''; |
| 851 |
$question_ids = isset( $survey->question_ids ) && $survey->question_ids != '' ? $survey->question_ids : ''; |
| 852 |
|
| 853 |
if( $sections_ids != '' ){ |
| 854 |
$section_ids_array = explode( ',', $sections_ids ); |
| 855 |
}else{ |
| 856 |
$section_ids_array = array(); |
| 857 |
} |
| 858 |
|
| 859 |
/*******************************************************************************************************/ |
| 860 |
/* Limit users */ |
| 861 |
/*******************************************************************************************************/ |
| 862 |
$limit = false; |
| 863 |
$limit_message = false; |
| 864 |
$limit_users_attr = array( |
| 865 |
'id' => $id, |
| 866 |
'name' => 'ays_survey_cookie_', |
| 867 |
'title' => $survey->title, |
| 868 |
); |
| 869 |
if( $this->options[ $this->name_prefix . 'limit_users' ] ){ |
| 870 |
switch( $this->options[ $this->name_prefix . 'limit_users_by' ] ){ |
| 871 |
case 'ip': |
| 872 |
$limit_by = Survey_Maker_Data::get_limit_user_by_ip( $id ); |
| 873 |
$remove_cookie = Survey_Maker_Data::ays_survey_remove_cookie( $limit_users_attr ); |
| 874 |
break; |
| 875 |
case 'user_id': |
| 876 |
$limit_by = Survey_Maker_Data::get_limit_user_by_id( $id, $user_id ); |
| 877 |
$remove_cookie = Survey_Maker_Data::ays_survey_remove_cookie( $limit_users_attr ); |
| 878 |
if( ! is_user_logged_in() ){ |
| 879 |
$limit_by = 0; |
| 880 |
} |
| 881 |
break; |
| 882 |
case 'cookie': |
| 883 |
$check_cookie = Survey_Maker_Data::ays_survey_check_cookie( $limit_users_attr ); |
| 884 |
if ( !$check_cookie ) { |
| 885 |
$limit_by = 0; |
| 886 |
}else{ |
| 887 |
$limit_by = Survey_Maker_Data::get_limit_cookie_count( $limit_users_attr ); |
| 888 |
} |
| 889 |
break; |
| 890 |
case 'ip_cookie': |
| 891 |
$check_cookie = Survey_Maker_Data::ays_survey_check_cookie( $limit_users_attr ); |
| 892 |
$check_user_by_ip = Survey_Maker_Data::get_user_by_ip( $id ); |
| 893 |
if($check_cookie || $check_user_by_ip > 0){ |
| 894 |
$limit_by = $check_user_by_ip; |
| 895 |
}elseif(! $check_cookie || $check_user_by_ip <= 0){ |
| 896 |
$limit_by = 0; |
| 897 |
} |
| 898 |
break; |
| 899 |
|
| 900 |
} |
| 901 |
|
| 902 |
if( $limit_by > 0 ){ |
| 903 |
$limit = true; |
| 904 |
$limit_message = $this->options[ $this->name_prefix . 'limitation_message' ]; |
| 905 |
$limit_message = Survey_Maker_Data::replace_message_variables($this->options[ $this->name_prefix . 'limitation_message' ], $this->message_variable_data); |
| 906 |
|
| 907 |
if( $limit_message == '' ){ |
| 908 |
$limit_message = __( "You've already responded", "survey-maker" ); |
| 909 |
} |
| 910 |
} |
| 911 |
} |
| 912 |
|
| 913 |
$logged_in_limit = false; |
| 914 |
$logged_in_limit_message = false; |
| 915 |
if( $this->options[ $this->name_prefix . 'enable_logged_users' ] ){ |
| 916 |
if( ! is_user_logged_in() ){ |
| 917 |
// $limit = true; |
| 918 |
// $limit_message = $this->options[ $this->name_prefix . 'logged_in_message' ]; |
| 919 |
|
| 920 |
// if( $limit_message == '' ){ |
| 921 |
// $limit_message = "<h4 style='margin-top:0;'>" . __( "Sign in to continue", "survey-maker" ) . "</h4>"; |
| 922 |
// $limit_message .= "<p>" . __( "To fill out this form, you must be signed in. Your identity will remain anonymous.", "survey-maker" ) . "</p>"; |
| 923 |
// } |
| 924 |
|
| 925 |
$logged_in_limit = true; |
| 926 |
$logged_in_limit_message = $this->options[ $this->name_prefix . 'logged_in_message' ]; |
| 927 |
$logged_in_limit_message = Survey_Maker_Data::replace_message_variables($logged_in_limit_message, $this->message_variable_data); |
| 928 |
|
| 929 |
if( $logged_in_limit_message == '' ){ |
| 930 |
$logged_in_limit_message = "<h4 style='margin-top:0;text-align:center;'>" . __( "Sign in to continue", "survey-maker" ) . "</h4>"; |
| 931 |
$logged_in_limit_message .= "<p style='margin-top:0;text-align:center;'>" . __( "To fill out this form, you must be signed in. Your identity will remain anonymous.", "survey-maker" ) . "</p>"; |
| 932 |
} |
| 933 |
} |
| 934 |
|
| 935 |
// Show login form for not logged in users |
| 936 |
$survey_login_form = ""; |
| 937 |
if($this->options[ $this->name_prefix . 'show_login_form' ]){ |
| 938 |
$ays_survey_login_button_text = $this->buttons_texts[ 'loginButton' ]; |
| 939 |
$args = array( |
| 940 |
'echo' => false, |
| 941 |
'id_username' => 'user_login', |
| 942 |
'id_password' => 'user_pass', |
| 943 |
'id_remember' => 'rememberme', |
| 944 |
'id_submit' => 'wp-submit', |
| 945 |
'label_log_in' => $ays_survey_login_button_text, |
| 946 |
); |
| 947 |
$survey_login_form = "<div class='ays_survey_login_form'>" . wp_login_form( $args ) . "</div>"; |
| 948 |
} |
| 949 |
|
| 950 |
if($logged_in_limit){ |
| 951 |
if(!is_user_logged_in()){ |
| 952 |
$logged_in_limit_message .= $survey_login_form; |
| 953 |
} |
| 954 |
} |
| 955 |
} |
| 956 |
|
| 957 |
// Limitation tackers of quiz |
| 958 |
$tackers_message = "<div><p class='".$this->name_prefix."expired-survey-message'>" . __( "This survey has expired!", "survey-maker" ) . "</p></div>"; |
| 959 |
$takers_count = Survey_Maker_Data::get_survey_takers_count($id); |
| 960 |
|
| 961 |
if($this->options[ $this->name_prefix . 'enable_takers_count' ]){ |
| 962 |
if($this->options[ $this->name_prefix . 'takers_count' ] <= $takers_count ){ |
| 963 |
$limit = true; |
| 964 |
$limit_message = $tackers_message; |
| 965 |
} |
| 966 |
} |
| 967 |
|
| 968 |
|
| 969 |
$survey_loader = $this->options[ $this->name_prefix . 'loader' ]; |
| 970 |
$survey_loader_text = ''; |
| 971 |
if(isset($this->options['options'])){ |
| 972 |
$survey_loader_text = isset($this->options['options'][ $this->name_prefix . 'loader_text' ]) && $this->options['options'][ $this->name_prefix . 'loader_text' ] != "" ? stripslashes(esc_attr($this->options['options'][ $this->name_prefix . 'loader_text' ])) : ''; |
| 973 |
} |
| 974 |
|
| 975 |
// Loader Gif |
| 976 |
$survey_loader_gif = (isset($this->options[ $this->name_prefix . 'loader_gif' ]) && $this->options[ $this->name_prefix . 'loader_gif' ] != '') ? $this->options[ $this->name_prefix . 'loader_gif' ] : ''; |
| 977 |
$survey_loader_gif_width = (isset($this->options[ $this->name_prefix . 'loader_gif_width' ]) && $this->options[ $this->name_prefix . 'loader_gif_width' ] != '') ? stripslashes( $this->options[ $this->name_prefix . 'loader_gif_width' ] ) : ''; |
| 978 |
|
| 979 |
switch( $survey_loader ){ |
| 980 |
case 'default': |
| 981 |
$survey_loader_html = "<div data-class='lds-ellipsis' data-role='loader' class='ays-loader'><div></div><div></div><div></div><div></div></div>"; |
| 982 |
break; |
| 983 |
case 'circle': |
| 984 |
$survey_loader_html = "<div data-class='lds-circle' data-role='loader' class='ays-loader'></div>"; |
| 985 |
break; |
| 986 |
case 'dual_ring': |
| 987 |
$survey_loader_html = "<div data-class='lds-dual-ring' data-role='loader' class='ays-loader'></div>"; |
| 988 |
break; |
| 989 |
case 'facebook': |
| 990 |
$survey_loader_html = "<div data-class='lds-facebook' data-role='loader' class='ays-loader'><div></div><div></div><div></div></div>"; |
| 991 |
break; |
| 992 |
case 'hourglass': |
| 993 |
$survey_loader_html = "<div data-class='lds-hourglass' data-role='loader' class='ays-loader'></div>"; |
| 994 |
break; |
| 995 |
case 'ripple': |
| 996 |
$survey_loader_html = "<div data-class='lds-ripple' data-role='loader' class='ays-loader'><div></div><div></div></div>"; |
| 997 |
break; |
| 998 |
case 'snake': |
| 999 |
$survey_loader_html = '<div class="ays-survey-loader ays-survey-loader-snake" data-class="ays-survey-loader-snake" data-role="loader"><div></div><div></div><div></div><div></div><div></div><div></div></div>'; |
| 1000 |
break; |
| 1001 |
case 'text': |
| 1002 |
$survey_loader_html = '<div class="ays-survey-loader ays-survey-loader-with-text" data-class="ays-survey-loader-text" data-role="loader">'.$survey_loader_text.'</div>'; |
| 1003 |
break; |
| 1004 |
case 'custom_gif': |
| 1005 |
$survey_loader_html = '<div class="ays-survey-loader ays-survey-loader-with-custom-gif" data-class="ays-survey-loader-cistom-gif" data-role="loader"><img src="'.$survey_loader_gif.'" '.$this->lazy_loading.' style="width: '.$survey_loader_gif_width.'px;object-fit:cover;"></div>'; |
| 1006 |
break; |
| 1007 |
default: |
| 1008 |
$survey_loader_html = "<div data-class='lds-ellipsis' data-role='loader' class='ays-loader'><div></div><div></div><div></div><div></div></div>"; |
| 1009 |
break; |
| 1010 |
} |
| 1011 |
|
| 1012 |
$this->options[ $this->name_prefix . 'loader_html' ] = $survey_loader_html; |
| 1013 |
|
| 1014 |
/* |
| 1015 |
* Schedule quiz |
| 1016 |
* Check is quiz expired |
| 1017 |
*/ |
| 1018 |
|
| 1019 |
$is_expired = false; |
| 1020 |
$active_date_check = false; |
| 1021 |
$startDate_atr = ''; |
| 1022 |
$endDate_atr = ''; |
| 1023 |
$current_time = strtotime( current_time( "Y:m:d H:i:s" ) ); |
| 1024 |
$startDate = strtotime( $this->options[ $this->name_prefix . 'schedule_active' ] ); |
| 1025 |
$endDate = strtotime( $this->options[ $this->name_prefix . 'schedule_deactive' ] ); |
| 1026 |
|
| 1027 |
$expired_survey_message = __('The survey has expired.', "survey-maker"); |
| 1028 |
|
| 1029 |
if ( $this->options[ $this->name_prefix . 'enable_schedule' ] ) { |
| 1030 |
$active_date_check = true; |
| 1031 |
|
| 1032 |
if ( $this->options[ $this->name_prefix . 'schedule_active' ] ) { |
| 1033 |
$startDate_atr = $startDate - $current_time; |
| 1034 |
}elseif ( $this->options[ $this->name_prefix . 'schedule_deactive' ] ) { |
| 1035 |
$endDate_atr = $endDate - $current_time; |
| 1036 |
} |
| 1037 |
|
| 1038 |
if ($startDate > $current_time) { |
| 1039 |
if($this->options[ $this->name_prefix . 'dont_show_survey_container' ]){ |
| 1040 |
$hide_survey_and_popup = ' |
| 1041 |
<style> |
| 1042 |
.' . $this->html_class_prefix . 'popup-survey-window[data-survey-id="' . $id . '"]{ |
| 1043 |
display:none !important; |
| 1044 |
} |
| 1045 |
</style>'; |
| 1046 |
return $hide_survey_and_popup; |
| 1047 |
} |
| 1048 |
$is_expired = true; |
| 1049 |
$expired_survey_message = $this->options[ $this->name_prefix . 'schedule_pre_start_message' ]; |
| 1050 |
}elseif ($endDate < $current_time) { |
| 1051 |
if($this->options[ $this->name_prefix . 'dont_show_survey_container' ]){ |
| 1052 |
$hide_survey_and_popup = ' |
| 1053 |
<style> |
| 1054 |
.' . $this->html_class_prefix . 'popup-survey-window[data-survey-id="' . $id . '"]{ |
| 1055 |
display:none !important; |
| 1056 |
} |
| 1057 |
</style>'; |
| 1058 |
return $hide_survey_and_popup; |
| 1059 |
} |
| 1060 |
$is_expired = true; |
| 1061 |
$expired_survey_message = $this->options[ $this->name_prefix . 'schedule_expiration_message' ]; |
| 1062 |
} |
| 1063 |
} |
| 1064 |
|
| 1065 |
if( !$limit ){ |
| 1066 |
$sections = Survey_Maker_Data::get_sections_by_survey_id( $sections_ids ); |
| 1067 |
$sections_count = count( $sections ); |
| 1068 |
|
| 1069 |
|
| 1070 |
$question_types_placeholders = array( |
| 1071 |
"radio" => '', |
| 1072 |
"checkbox" => '', |
| 1073 |
"select" => '', |
| 1074 |
"yesorno" => '', |
| 1075 |
"text" => __("Your answer", "survey-maker"), |
| 1076 |
"short_text" => __("Your answer", "survey-maker"), |
| 1077 |
"number" => __("Your answer", "survey-maker"), |
| 1078 |
"email" => __("Your email", "survey-maker"), |
| 1079 |
"name" => __("Your name", "survey-maker"), |
| 1080 |
); |
| 1081 |
|
| 1082 |
$multiple_sections = $sections_count > 1 ? true : false; |
| 1083 |
|
| 1084 |
foreach ($sections as $section_key => $section) { |
| 1085 |
$sections[$section_key]['title'] = (isset($section['title']) && $section['title'] != '') ? stripslashes( esc_html( $section['title'] ) ) : ''; |
| 1086 |
|
| 1087 |
if ( $this->options[ $this->name_prefix . 'allow_html_in_section_description' ] ) { |
| 1088 |
|
| 1089 |
$survey_allowed_html = Survey_Maker_Data::ays_survey_custom_allowed_html(); |
| 1090 |
|
| 1091 |
$sections[$section_key]['description'] = (isset($section['description']) && $section['description'] != '') ? nl2br( wp_kses( $section['description'], $survey_allowed_html ) ) : ''; |
| 1092 |
} else { |
| 1093 |
$sections[$section_key]['description'] = (isset($section['description']) && $section['description'] != '') ? nl2br( esc_html( $section['description'] ) ) : ''; |
| 1094 |
} |
| 1095 |
|
| 1096 |
$section_questions = Survey_Maker_Data::get_questions_by_section_id( intval( $section['id'] ), $question_ids ); |
| 1097 |
|
| 1098 |
foreach ($section_questions as $question_key => $question) { |
| 1099 |
$section_questions[$question_key]['question'] = (isset($question['question']) && $question['question'] != '') ? nl2br( $question['question'] ) : ''; |
| 1100 |
$section_questions[$question_key]['image'] = (isset($question['image']) && $question['image'] != '') ? $question['image'] : ''; |
| 1101 |
$section_questions[$question_key]['type'] = (isset($question['type']) && $question['type'] != '') ? $question['type'] : 'radio'; |
| 1102 |
$section_questions[$question_key]['user_variant'] = (isset($question['user_variant']) && $question['user_variant'] == 'on') ? true : false; |
| 1103 |
|
| 1104 |
$opts = json_decode( $question['options'], true ); |
| 1105 |
$opts['required'] = (isset($opts['required']) && $opts['required'] == 'on') ? true : false; |
| 1106 |
$opts['enable_max_selection_count'] = (isset($opts['enable_max_selection_count']) && $opts['enable_max_selection_count'] == 'on') ? true : false; |
| 1107 |
$opts['max_selection_count'] = (isset($opts['max_selection_count']) && $opts['max_selection_count'] != '') ? intval( $opts['max_selection_count'] ) : null; |
| 1108 |
$opts['min_selection_count'] = (isset($opts['min_selection_count']) && $opts['min_selection_count'] != '') ? intval( $opts['min_selection_count'] ) : null; |
| 1109 |
// Text Limitations |
| 1110 |
$opts['enable_word_limitation'] = (isset($opts['enable_word_limitation']) && $opts['enable_word_limitation'] == 'on') ? true : false; |
| 1111 |
$opts['limit_by'] = (isset($opts['limit_by']) && $opts['limit_by'] != '') ? sanitize_text_field($opts['limit_by']) : ''; |
| 1112 |
$opts['limit_length'] = (isset($opts['limit_length']) && $opts['limit_length'] != '') ? intval( $opts['limit_length'] ) : ''; |
| 1113 |
$opts['limit_counter'] = (isset($opts['limit_counter']) && $opts['limit_counter'] == 'on') ? true : false; |
| 1114 |
|
| 1115 |
// Number Limitations |
| 1116 |
$opts['enable_number_limitation'] = (isset($opts['enable_number_limitation']) && $opts['enable_number_limitation'] == 'on') ? true : false; |
| 1117 |
$opts['number_min_selection'] = (isset($opts['number_min_selection']) && $opts['number_min_selection'] != '') ? sanitize_text_field($opts['number_min_selection']) : ''; |
| 1118 |
$opts['number_max_selection'] = (isset($opts['number_max_selection']) && $opts['number_max_selection'] != '') ? sanitize_text_field($opts['number_max_selection']) : ''; |
| 1119 |
$opts['number_error_message'] = (isset($opts['number_error_message']) && $opts['number_error_message'] != '') ? sanitize_text_field($opts['number_error_message']) : ''; |
| 1120 |
$opts['enable_number_error_message'] = (isset($opts['enable_number_error_message']) && $opts['enable_number_error_message'] == 'on') ? true : false; |
| 1121 |
$opts['number_limit_length'] = (isset($opts['number_limit_length']) && $opts['number_limit_length'] != '') ? intval( $opts['number_limit_length'] ) : ''; |
| 1122 |
$opts['enable_number_limit_counter'] = (isset($opts['enable_number_limit_counter']) && $opts['enable_number_limit_counter'] == 'on') ? true : false; |
| 1123 |
// Input types placeholders |
| 1124 |
$opts['placeholder'] = (isset($opts['survey_input_type_placeholder'])) ? stripslashes(esc_attr($opts['survey_input_type_placeholder'])) : $question_types_placeholders[$section_questions[$question_key]['type']]; |
| 1125 |
$opts['image_caption'] = (isset($opts['image_caption'])) ? stripslashes(esc_attr($opts['image_caption'])) : ''; |
| 1126 |
$opts['image_caption_enable'] = (isset($opts['image_caption_enable']) && $opts['image_caption_enable'] == 'on') ? true : false; |
| 1127 |
|
| 1128 |
//Admin note |
| 1129 |
$opts['enable_admin_note'] = ( isset( $opts['enable_admin_note'] ) && $opts['enable_admin_note'] == 'on' ) ? true : false; |
| 1130 |
$opts['admin_note'] = isset( $opts['admin_note'] ) && $opts['admin_note'] != '' ? stripslashes( esc_attr( $opts['admin_note'] ) ) : ''; |
| 1131 |
|
| 1132 |
$opts['enable_value_prefix'] = (isset($opts['enable_value_prefix']) && $opts['enable_value_prefix'] == 'on') ? true : false; |
| 1133 |
$opts['value_prefix'] = isset( $opts['value_prefix'] ) && $opts['value_prefix'] != '' ? stripslashes( esc_attr( $opts['value_prefix'] ) ) : ''; |
| 1134 |
$opts['enable_value_suffix'] = (isset($opts['enable_value_suffix']) && $opts['enable_value_suffix'] == 'on') ? true : false; |
| 1135 |
$opts['value_suffix'] = isset( $opts['value_suffix'] ) && $opts['value_suffix'] != '' ? stripslashes( esc_attr( $opts['value_suffix'] ) ) : ''; |
| 1136 |
|
| 1137 |
if( $section_questions[$question_key]['type'] == 'checkbox' ){ |
| 1138 |
$this->options[ 'survey_checkbox_options' ][$question['id']]['enable_max_selection_count'] = $opts['enable_max_selection_count']; |
| 1139 |
$this->options[ 'survey_checkbox_options' ][$question['id']]['max_selection_count'] = $opts['max_selection_count']; |
| 1140 |
$this->options[ 'survey_checkbox_options' ][$question['id']]['min_selection_count'] = $opts['min_selection_count']; |
| 1141 |
} |
| 1142 |
|
| 1143 |
if( $section_questions[$question_key]['type'] == 'text' || $section_questions[$question_key]['type'] == 'short_text'){ |
| 1144 |
$this->options[ 'survey_text_limit_options' ][$question['id']]['enable_word_limitation'] = $opts['enable_word_limitation']; |
| 1145 |
$this->options[ 'survey_text_limit_options' ][$question['id']]['limit_by'] = $opts['limit_by']; |
| 1146 |
$this->options[ 'survey_text_limit_options' ][$question['id']]['limit_length'] = $opts['limit_length']; |
| 1147 |
$this->options[ 'survey_text_limit_options' ][$question['id']]['limit_counter'] = $opts['limit_counter']; |
| 1148 |
} |
| 1149 |
|
| 1150 |
if( $section_questions[$question_key]['type'] == 'number' || $section_questions[$question_key]['type'] == 'phone'){ |
| 1151 |
$this->options[ 'survey_number_limit_options' ][$question['id']]['enable_number_limitation'] = $opts['enable_number_limitation']; |
| 1152 |
$this->options[ 'survey_number_limit_options' ][$question['id']]['number_min_selection'] = $opts['number_min_selection']; |
| 1153 |
$this->options[ 'survey_number_limit_options' ][$question['id']]['number_max_selection'] = $opts['number_max_selection']; |
| 1154 |
$this->options[ 'survey_number_limit_options' ][$question['id']]['number_error_message'] = $opts['number_error_message']; |
| 1155 |
$this->options[ 'survey_number_limit_options' ][$question['id']]['enable_number_error_message'] = $opts['enable_number_error_message']; |
| 1156 |
$this->options[ 'survey_number_limit_options' ][$question['id']]['number_limit_length'] = $opts['number_limit_length']; |
| 1157 |
$this->options[ 'survey_number_limit_options' ][$question['id']]['enable_number_limit_counter'] = $opts['enable_number_limit_counter']; |
| 1158 |
} |
| 1159 |
|
| 1160 |
$q_answers = Survey_Maker_Data::get_answers_by_question_id( intval( $question['id'] ) ); |
| 1161 |
|
| 1162 |
foreach ($q_answers as $answer_key => $answer) { |
| 1163 |
$answer_content = (isset($answer['answer']) && $answer['answer'] != '') ? $answer['answer'] : ''; |
| 1164 |
|
| 1165 |
if( $this->options[ $this->name_prefix . 'allow_html_in_answers' ] === false ){ |
| 1166 |
$answer_content = htmlentities( $answer_content ); |
| 1167 |
} |
| 1168 |
|
| 1169 |
$q_answers[$answer_key]['answer'] = stripslashes( $answer_content ); |
| 1170 |
$q_answers[$answer_key]['image'] = (isset($answer['image']) && $answer['image'] != '') ? $answer['image'] : ''; |
| 1171 |
$q_answers[$answer_key]['placeholder'] = (isset($answer['placeholder']) && $answer['placeholder'] != '') ? $answer['placeholder'] : ''; |
| 1172 |
} |
| 1173 |
|
| 1174 |
$section_questions[$question_key]['answers'] = $q_answers; |
| 1175 |
|
| 1176 |
$section_questions[$question_key]['options'] = $opts; |
| 1177 |
} |
| 1178 |
|
| 1179 |
$sections[$section_key]['questions'] = $section_questions; |
| 1180 |
} |
| 1181 |
} |
| 1182 |
|
| 1183 |
if( $logged_in_limit ){ |
| 1184 |
$limit = true; |
| 1185 |
$limit_message = $logged_in_limit_message; |
| 1186 |
} |
| 1187 |
|
| 1188 |
$blocked_content_class = ''; |
| 1189 |
if( ( $limit || $is_expired ) && !$logged_in_limit ){ |
| 1190 |
$blocked_content_class = " " . $this->html_class_prefix . "blocked-content "; |
| 1191 |
} |
| 1192 |
|
| 1193 |
$content = array(); |
| 1194 |
$content[] = '<div class="' . $this->html_class_prefix . 'container ' . $blocked_content_class . $this->options[ $this->name_prefix . 'custom_class' ] . '" id="' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . '" data-id="' . $unique_id . '" data-theme="'.$this->options[ $this->name_prefix . 'theme' ].'">'; |
| 1195 |
|
| 1196 |
if(Survey_Maker_Data::ays_survey_is_elementor() || Survey_Maker_Data::ays_survey_is_editor()){ |
| 1197 |
|
| 1198 |
$content[] = '<div style="display: flex; justify-content: center;font-size: 15px; text-align: center;gap: 4px">'; |
| 1199 |
$content[] = '<div><i class="ays_fa ays_fa_info_circle"></i></div>'; |
| 1200 |
$content[] = '<div>'. esc_attr( __( "You're in the preview mode. Note: All elements work correctly on the front end." , "survey-maker") ).'</div>'; |
| 1201 |
$content[] = '</div>'; |
| 1202 |
} |
| 1203 |
|
| 1204 |
if($this->options[ $this->name_prefix . 'enable_survey_start_loader' ] && !Survey_Maker_Data::ays_survey_is_elementor()){ |
| 1205 |
$content[] = Survey_Maker_Data::survey_get_loader($this->options[ $this->name_prefix . 'before_start_loader' ]); |
| 1206 |
} |
| 1207 |
$survey_full_screen_button_pos = $this->options[ $this->name_prefix . 'show_title' ] ? "" : $this->html_class_prefix . "full-screen-and-no-title"; |
| 1208 |
$survey_no_cover_photo_class = ""; |
| 1209 |
if( $this->options[ $this->name_prefix . 'full_screen_mode' ] ){ |
| 1210 |
$survey_cover_photo_class = ""; |
| 1211 |
if( $this->options[ $this->name_prefix . 'cover_photo' ] != "" ){ |
| 1212 |
$survey_cover_photo_class = $this->html_class_prefix . "cover-photo-title-wrap"; |
| 1213 |
$survey_no_cover_photo_class = $this->html_class_prefix . "no-cover-photo"; |
| 1214 |
} |
| 1215 |
$content[] = '<div class="' . $this->html_class_prefix . 'full-screen-and-title ' . $survey_full_screen_button_pos . ' ' . $survey_cover_photo_class . '">'; |
| 1216 |
} |
| 1217 |
|
| 1218 |
if( $this->options[ $this->name_prefix . 'show_title' ] && $this->options[ $this->name_prefix . 'cover_photo' ] != "" ){ |
| 1219 |
$content[] = '<div class="' . $this->html_class_prefix . 'title-wrap">'; |
| 1220 |
if( $this->options[ $this->name_prefix . 'full_screen_mode' ] ){ |
| 1221 |
$content[] = '<div class="' . $this->html_class_prefix . 'cover-photo-title-wrap ' . $survey_no_cover_photo_class . '">'; |
| 1222 |
}else{ |
| 1223 |
$content[] = '<div class="' . $this->html_class_prefix . 'cover-photo-title-wrap">'; |
| 1224 |
} |
| 1225 |
$content[] = '<span class="' . $this->html_class_prefix . 'title">' . $survey->title . '</span>'; |
| 1226 |
$content[] = '</div>'; |
| 1227 |
$content[] = '</div>'; |
| 1228 |
}else if( $this->options[ $this->name_prefix . 'cover_photo' ] != "" ){ |
| 1229 |
$content[] = '<div class="' . $this->html_class_prefix . 'title-wrap">'; |
| 1230 |
if( $this->options[ $this->name_prefix . 'full_screen_mode' ] ){ |
| 1231 |
$content[] = '<div class="' . $this->html_class_prefix . 'cover-photo-title-wrap ' . $survey_no_cover_photo_class . '"></div>'; |
| 1232 |
}else{ |
| 1233 |
$content[] = '<div class="' . $this->html_class_prefix . 'cover-photo-title-wrap"></div>'; |
| 1234 |
} |
| 1235 |
$content[] = '</div>'; |
| 1236 |
}else if($this->options[ $this->name_prefix . 'show_title' ]){ |
| 1237 |
$content[] = '<div class="' . $this->html_class_prefix . 'title-wrap">'; |
| 1238 |
$content[] = '<span class="' . $this->html_class_prefix . 'title">' . $survey->title . '</span>'; |
| 1239 |
$content[] = '</div>'; |
| 1240 |
} |
| 1241 |
|
| 1242 |
if( $this->options[ $this->name_prefix . 'full_screen_mode' ] && !$limit){ |
| 1243 |
$content[] = '<div class="ays-survey-full-screen-mode"> |
| 1244 |
<a class="ays-survey-full-screen-container" title="'.__("Full screen" , "survey-maker").'" > |
| 1245 |
<svg xmlns="http://www.w3.org/2000/svg" height="24" fill="#fff" viewBox="0 0 24 24" tabindex="0" width="24" class="ays-survey-close-full-screen"> |
| 1246 |
<path d="M0 0h24v24H0z" fill="none"/> |
| 1247 |
<path d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"/> |
| 1248 |
</svg> |
| 1249 |
<svg xmlns="http://www.w3.org/2000/svg" height="24" fill="#fff" viewBox="0 0 24 24" tabindex="0" width="24" class="ays-survey-open-full-screen"> |
| 1250 |
<path d="M0 0h24v24H0z" fill="none"/> |
| 1251 |
<path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/> |
| 1252 |
</svg> |
| 1253 |
</a> |
| 1254 |
</div>'; |
| 1255 |
} |
| 1256 |
if( $this->options[ $this->name_prefix . 'full_screen_mode' ] ){ |
| 1257 |
$content[] = '</div>'; |
| 1258 |
} |
| 1259 |
|
| 1260 |
|
| 1261 |
if( $this->options[ $this->name_prefix . 'enable_logged_users' ] ){ |
| 1262 |
if( ! is_user_logged_in() && $this->options[ $this->name_prefix . 'show_login_form'] ){ |
| 1263 |
$content[] = $this->create_restricted_content( $limit_message ); |
| 1264 |
$content[] = $this->get_styles(); |
| 1265 |
$content[] = $this->get_custom_css(); |
| 1266 |
|
| 1267 |
$content[] = $this->get_encoded_options( $limit ); |
| 1268 |
|
| 1269 |
$content[] = '</div>'; |
| 1270 |
|
| 1271 |
$content = implode( '', $content ); |
| 1272 |
return $content; |
| 1273 |
} |
| 1274 |
} |
| 1275 |
|
| 1276 |
$content[] = '<form class="' . $this->html_class_prefix . 'form" method="post">'; |
| 1277 |
$content[] = '<input type="hidden" name="'. $this->html_name_prefix .'id-' . $unique_id . '" value="'. $id .'">'; |
| 1278 |
// Get survey current page |
| 1279 |
$ays_survey_protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; |
| 1280 |
$current_survey_page_link = esc_url( $ays_survey_protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); |
| 1281 |
$content[] = '<input type="hidden" name="'. $this->html_name_prefix .'current_page_link" value="'. $current_survey_page_link .'">'; |
| 1282 |
|
| 1283 |
if( !$limit && !$is_expired ){ |
| 1284 |
$content[] = $this->create_sections( $sections ); |
| 1285 |
}else{ |
| 1286 |
if( $is_expired && !$limit ){ |
| 1287 |
$limit_message = $expired_survey_message; |
| 1288 |
} |
| 1289 |
else if($is_expired && $limit){ |
| 1290 |
$limit_message = $expired_survey_message; |
| 1291 |
} |
| 1292 |
|
| 1293 |
$content[] = $this->create_restricted_content( $limit_message ); |
| 1294 |
} |
| 1295 |
|
| 1296 |
$content[] = '</form>'; |
| 1297 |
|
| 1298 |
$content[] = $this->get_styles(); |
| 1299 |
$content[] = $this->get_custom_css(); |
| 1300 |
|
| 1301 |
$content[] = $this->get_encoded_options( $limit ); |
| 1302 |
|
| 1303 |
$content[] = '</div>'; |
| 1304 |
|
| 1305 |
$content = implode( '', $content ); |
| 1306 |
return $content; |
| 1307 |
} |
| 1308 |
|
| 1309 |
public function create_sections( $sections ){ |
| 1310 |
|
| 1311 |
$content = array(); |
| 1312 |
$content[] = '<div class="' . $this->html_class_prefix . 'sections">'; |
| 1313 |
|
| 1314 |
if(isset($this->options[ $this->name_prefix .'enable_password']) && $this->options[ $this->name_prefix .'enable_password'] ){ |
| 1315 |
$ays_survey_show_password_flag = true; |
| 1316 |
|
| 1317 |
$password_type = 'general'; |
| 1318 |
$general_psw_input = $this->options[$this->name_prefix .'password_survey']; |
| 1319 |
// $active_psw = $this->options['options'][ $this->name_prefix .'generated_passwords'][ $this->name_prefix .'active_passwords']; |
| 1320 |
|
| 1321 |
if( $password_type == 'general' && $general_psw_input == '' ){ |
| 1322 |
$ays_survey_show_password_flag = false; |
| 1323 |
}else{ |
| 1324 |
$ays_survey_show_password_flag = true; |
| 1325 |
} |
| 1326 |
|
| 1327 |
if($ays_survey_show_password_flag){ |
| 1328 |
$if_generated = isset($this->options[ $this->name_prefix .'password_type']) && $this->options[ $this->name_prefix .'password_type'] == 'generated_password' ? 'name="' . $this->html_class_prefix . 'password"' : ''; |
| 1329 |
$content[] = '<div class="' . $this->html_class_prefix . 'section">'; |
| 1330 |
|
| 1331 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-content">'; |
| 1332 |
|
| 1333 |
$content[] = '<div style="margin-bottom:10px;">'; |
| 1334 |
$content[] = '<div>'; |
| 1335 |
$content[] = $this->options[ $this->name_prefix .'password_message']; |
| 1336 |
$content[] = '</div>'; |
| 1337 |
$content[] = '</div>'; |
| 1338 |
$content[] = '<div style="margin-bottom:10px;">'; |
| 1339 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-input-box">'; |
| 1340 |
$content[] = '<input class="' . $this->html_class_prefix . 'remove-default-border ' . $this->html_class_prefix . 'password ' . $this->html_class_prefix . 'question-input ' . |
| 1341 |
$this->html_class_prefix . 'input" type="password" autocomplete="off" tabindex="0" placeholder="Please enter password" '.$if_generated.'/>'; |
| 1342 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline" style="margin:0;"></div>'; |
| 1343 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation" style="margin:0;"></div>'; |
| 1344 |
$content[] = '</div>'; |
| 1345 |
$content[] = '</div>'; |
| 1346 |
|
| 1347 |
$content[] = '<div class="' . $this->html_class_prefix . 'check-password-block">'; |
| 1348 |
|
| 1349 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-buttons">'; |
| 1350 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-button-container" tabindex="0">'; |
| 1351 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-button-content">'; |
| 1352 |
|
| 1353 |
$content[] = '<input type="button" class="' . $this->html_class_prefix . 'section-button ays-check-survey-password" value="Check" />'; |
| 1354 |
|
| 1355 |
$content[] = '</div>'; |
| 1356 |
$content[] = '</div>'; |
| 1357 |
$content[] = '</div>'; |
| 1358 |
|
| 1359 |
$content[] = '</div>'; |
| 1360 |
$content[] = '</div>'; |
| 1361 |
|
| 1362 |
$content[] = '</div>'; |
| 1363 |
} |
| 1364 |
} |
| 1365 |
|
| 1366 |
if( $this->options[ $this->name_prefix . 'enable_start_page'] === true ){ |
| 1367 |
$content[] = '<div class="' . $this->html_class_prefix . 'section ' . $this->html_class_prefix . 'section-start-page">'; |
| 1368 |
|
| 1369 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-content ' . $this->options[ $this->name_prefix .'start_page_custom_class'] . '">'; |
| 1370 |
|
| 1371 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-header">'; |
| 1372 |
|
| 1373 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-title-row">'; |
| 1374 |
$content[] = '<span class="' . $this->html_class_prefix . 'section-title">' . stripslashes( $this->options[ $this->name_prefix .'start_page_title'] ) . '</span>'; |
| 1375 |
$content[] = '</div>'; |
| 1376 |
$survey_start_page_description_content = stripslashes( $this->options[ $this->name_prefix .'start_page_description']); |
| 1377 |
$survey_start_page_description_content = $survey_start_page_description_content; |
| 1378 |
|
| 1379 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-desc">' . $survey_start_page_description_content . '</div>'; |
| 1380 |
|
| 1381 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-buttons">'; |
| 1382 |
|
| 1383 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-button-container" tabindex="0">'; |
| 1384 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-button-content">'; |
| 1385 |
$content[] = '<input type="button" class="' . $this->html_class_prefix . 'section-button ' . $this->html_class_prefix . 'start-button" value="'. $this->buttons_texts[ 'startButton' ] .'" />'; |
| 1386 |
$content[] = '</div>'; |
| 1387 |
$content[] = '</div>'; |
| 1388 |
|
| 1389 |
$content[] = '</div>'; |
| 1390 |
|
| 1391 |
$content[] = '</div>'; |
| 1392 |
|
| 1393 |
$content[] = '</div>'; |
| 1394 |
|
| 1395 |
$content[] = '</div>'; |
| 1396 |
} |
| 1397 |
|
| 1398 |
$survey_current_post_id = get_the_ID(); |
| 1399 |
$author_id = get_the_author_meta('ID'); |
| 1400 |
$survey_current_post_author_email = get_the_author_meta('email'); |
| 1401 |
$survey_current_post_author_nickname = get_the_author_meta('user_nicename'); |
| 1402 |
$survey_current_post_author_display_name = get_the_author_meta( 'display_name', $author_id ); |
| 1403 |
$survey_current_post_author_first_name = get_the_author_meta( 'first_name', $author_id ); |
| 1404 |
$survey_current_post_author_last_name = get_the_author_meta( 'last_name', $author_id ); |
| 1405 |
$survey_current_post_author_website_url = get_the_author_meta( 'url', $author_id ); |
| 1406 |
$survey_current_post_author_roles = get_the_author_meta( 'roles', $author_id ); |
| 1407 |
|
| 1408 |
$survey_current_post_title = get_the_title(); |
| 1409 |
|
| 1410 |
$survey_additional_wp_data = array( |
| 1411 |
'survey_post_type' => get_post_type(), |
| 1412 |
'survey_post_id' => $survey_current_post_id, |
| 1413 |
'survey_post_author_email' => $survey_current_post_author_email, |
| 1414 |
'survey_current_post_author_nickname' => $survey_current_post_author_nickname, |
| 1415 |
'survey_current_post_author_display_name' => $survey_current_post_author_display_name, |
| 1416 |
'survey_current_post_author_first_name' => $survey_current_post_author_first_name, |
| 1417 |
'survey_current_post_author_last_name' => $survey_current_post_author_last_name, |
| 1418 |
'survey_current_post_author_website_url' => $survey_current_post_author_website_url, |
| 1419 |
'survey_current_post_author_roles' => $survey_current_post_author_roles, |
| 1420 |
'survey_current_post_title' => $survey_current_post_title, |
| 1421 |
); |
| 1422 |
|
| 1423 |
$additional_data = base64_encode(json_encode($survey_additional_wp_data)); |
| 1424 |
|
| 1425 |
$sections_count = count( $sections ); |
| 1426 |
foreach ( $sections as $key => $section ) { |
| 1427 |
$first = $key == 0 ? true : false; |
| 1428 |
$last = $key + 1 == $sections_count ? true : false; |
| 1429 |
$section_numbering = $key+1; |
| 1430 |
$content[] = $this->create_section( $section, $last, $first , $sections_count , $section_numbering); |
| 1431 |
} |
| 1432 |
|
| 1433 |
$minimal_theme_header = $this->options[ $this->name_prefix . 'is_minimal' ] ? 'ays-survey-minimal-theme-header' : ""; |
| 1434 |
$modern_theme_header = $this->options[ $this->name_prefix . 'is_modern' ] ? 'ays-survey-modern-theme-header' : ""; |
| 1435 |
|
| 1436 |
$content[] = '<div class="' . $this->html_class_prefix . 'section ' . $this->html_class_prefix . 'results-content">'; |
| 1437 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-header ' . $minimal_theme_header . ' ' . $modern_theme_header . '">'; |
| 1438 |
|
| 1439 |
$content[] = '<div class="' . $this->html_class_prefix . 'results">'; |
| 1440 |
$content[] = '<input type="hidden" value="'.esc_attr($additional_data).'" name="' . $this->name_prefix . 'additional_wp_data' . '">'; |
| 1441 |
$content[] = '<div class="' . $this->html_class_prefix . 'loader">' . $this->options[ $this->name_prefix . 'loader_html' ] . '</div>'; |
| 1442 |
$content[] = '<div class="' . $this->html_class_prefix . 'thank-you-page">'; |
| 1443 |
|
| 1444 |
if( $this->options[ $this->name_prefix . 'enable_restart_button' ] ){ |
| 1445 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-buttons">'; |
| 1446 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-button-container" tabindex="0">'; |
| 1447 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-button-content">'; |
| 1448 |
$content[] = '<button type="button" class="' . $this->html_class_prefix . 'section-button ' . $this->html_class_prefix . 'restart-button">'. $this->buttons_texts[ 'restartButton' ] .'</button>'; |
| 1449 |
$content[] = '</div>'; |
| 1450 |
$content[] = '</div>'; |
| 1451 |
$content[] = '</div>'; |
| 1452 |
} |
| 1453 |
|
| 1454 |
if( $this->options[ $this->name_prefix . 'enable_exit_button' ] ){ |
| 1455 |
if( $this->options[ $this->name_prefix . 'exit_redirect_url' ] != '' && filter_var( $this->options[ $this->name_prefix . 'exit_redirect_url' ], FILTER_VALIDATE_URL) !== false ){ |
| 1456 |
|
| 1457 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-buttons">'; |
| 1458 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-button-container" tabindex="0">'; |
| 1459 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-button-content">'; |
| 1460 |
$content[] = '<a href="' . $this->options[ $this->name_prefix . 'exit_redirect_url' ] . '" class="' . $this->html_class_prefix . 'section-button">'. $this->buttons_texts[ 'exitButton' ] .'</a>'; |
| 1461 |
$content[] = '</div>'; |
| 1462 |
$content[] = '</div>'; |
| 1463 |
$content[] = '</div>'; |
| 1464 |
} |
| 1465 |
} |
| 1466 |
|
| 1467 |
if( $this->options[ $this->name_prefix . 'social_buttons' ] ){ |
| 1468 |
$actual_link = "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; |
| 1469 |
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === "on"){ |
| 1470 |
$actual_link = "https" . $actual_link; |
| 1471 |
}else{ |
| 1472 |
$actual_link = "http" . $actual_link; |
| 1473 |
} |
| 1474 |
$content[] = "<div class='ays-survey-social-shares'>"; |
| 1475 |
$content[] .= "<div class='ays-survey-social-shares-heading'>"; |
| 1476 |
// $content[] .= $this->options[ $this->name_prefix . 'social_buttons_heading' ]; |
| 1477 |
$content[] .= "</div>"; |
| 1478 |
|
| 1479 |
|
| 1480 |
if ( $this->options[ $this->name_prefix . 'social_button_ln' ] ) { |
| 1481 |
$content[] = "<a class='ays-survey-share-btn ays-survey-share-btn-linkedin ays-survey-share-btn-all' |
| 1482 |
href='https://www.linkedin.com/shareArticle?mini=true&url=" . $actual_link . "' |
| 1483 |
title='Share on LinkedIn'> |
| 1484 |
<span class='ays-survey-share-btn-icon'></span> |
| 1485 |
<span class='ays-share-btn-text'>LinkedIn</span> |
| 1486 |
</a>"; |
| 1487 |
} |
| 1488 |
if ( $this->options[ $this->name_prefix . 'social_button_fb' ] ) { |
| 1489 |
$content[] = "<a class='ays-survey-share-btn ays-survey-share-btn-facebook ays-survey-share-btn-all' |
| 1490 |
href='https://www.facebook.com/sharer/sharer.php?u=" . $actual_link . "' |
| 1491 |
title='Share on Facebook'> |
| 1492 |
<span class='ays-survey-share-btn-icon'></span> |
| 1493 |
<span class='ays-share-btn-text'>Facebook</span> |
| 1494 |
</a>"; |
| 1495 |
} |
| 1496 |
if ( $this->options[ $this->name_prefix . 'social_button_tr' ] ) { |
| 1497 |
$content[] = "<a class='ays-survey-share-btn ays-survey-share-btn-twitter ays-survey-share-btn-all' |
| 1498 |
href='https://twitter.com/share?url=" . $actual_link . "' |
| 1499 |
title='Share on X'> |
| 1500 |
<span class='ays-survey-share-btn-icon'></span> |
| 1501 |
<span class='ays-share-btn-text'>X</span> |
| 1502 |
</a>"; |
| 1503 |
} |
| 1504 |
if ( $this->options[ $this->name_prefix . 'social_button_vk' ] ) { |
| 1505 |
$content[] = "<a class='ays-survey-share-btn ays-survey-share-btn-vkontakte ays-survey-share-btn-all' |
| 1506 |
href='https://vk.com/share.php?url=" . $actual_link . "' |
| 1507 |
title='Share on VKontakte'> |
| 1508 |
<span class='ays-survey-share-btn-icon'></span> |
| 1509 |
<span class='ays-share-btn-text'>VKontakte</span> |
| 1510 |
</a>"; |
| 1511 |
} |
| 1512 |
$content[] = "</div>"; |
| 1513 |
} |
| 1514 |
|
| 1515 |
|
| 1516 |
$content[] = '</div>'; |
| 1517 |
$content[] = '</div>'; |
| 1518 |
|
| 1519 |
$content[] = '</div>'; |
| 1520 |
$content[] = '</div>'; |
| 1521 |
|
| 1522 |
$content[] = '</div>'; |
| 1523 |
|
| 1524 |
$content = implode( '', $content ); |
| 1525 |
|
| 1526 |
return $content; |
| 1527 |
} |
| 1528 |
|
| 1529 |
public function create_section( $section, $last, $first, $section_count, $section_numbering ){ |
| 1530 |
|
| 1531 |
$content = array(); |
| 1532 |
$show_question_numbering = $this->options[ $this->name_prefix . 'auto_numbering_questions' ]; |
| 1533 |
$this->options[ $this->name_prefix . 'question_numbering_array' ] = Survey_Maker_Data::ays_survey_numbering_all( $show_question_numbering ); |
| 1534 |
$content[] = '<div class="' . $this->html_class_prefix . 'section" data-page-number="'.$section_numbering.'">'; |
| 1535 |
$minimal_theme_header = $this->options[ $this->name_prefix . 'is_minimal' ] ? 'ays-survey-minimal-theme-header' : ""; |
| 1536 |
$modern_theme_header = $this->options[ $this->name_prefix . 'is_modern' ] ? 'ays-survey-modern-theme-header' : ""; |
| 1537 |
|
| 1538 |
if( $this->options[ $this->name_prefix . 'show_section_header' ] ){ |
| 1539 |
$show_section_header = true; |
| 1540 |
if( $section['title'] == '' && $section['description'] == '' ){ |
| 1541 |
$show_section_header = false; |
| 1542 |
} |
| 1543 |
if( $this->options[ $this->name_prefix . 'show_sections_questions_count' ] ){ |
| 1544 |
$show_section_header = true; |
| 1545 |
} |
| 1546 |
if( $show_section_header ){ |
| 1547 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-header ' . $minimal_theme_header . ' '.$modern_theme_header.'">'; |
| 1548 |
|
| 1549 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-title-row">'; |
| 1550 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-title-row-main">'; |
| 1551 |
$content[] = '<span class="' . $this->html_class_prefix . 'section-title">' . stripslashes( $section['title'] ) . '</span>'; |
| 1552 |
$content[] = '</div>'; |
| 1553 |
$content[] = '</div>'; |
| 1554 |
|
| 1555 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-desc">' . stripslashes( $section['description'] ) . '</div>'; |
| 1556 |
if( $this->options[ $this->name_prefix . 'show_sections_questions_count' ] ){ |
| 1557 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-questions-count" title="'. esc_attr__('Questions Count', 'survey-maker') .'">' . count( $section['questions'] ) . '</div>'; |
| 1558 |
} |
| 1559 |
|
| 1560 |
$content[] = '</div>'; |
| 1561 |
} |
| 1562 |
} |
| 1563 |
|
| 1564 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-content">'; |
| 1565 |
|
| 1566 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-questions">'; |
| 1567 |
|
| 1568 |
if( $this->options[ $this->name_prefix . 'enable_randomize_questions' ] ){ |
| 1569 |
shuffle( $section['questions'] ); |
| 1570 |
} |
| 1571 |
|
| 1572 |
$loop_count = 1; |
| 1573 |
|
| 1574 |
$other_answer_count = 0; |
| 1575 |
$check_question_type_for_next_button = 0; |
| 1576 |
$allowed_question_to_disable_next_button = array( |
| 1577 |
'radio', |
| 1578 |
'select', |
| 1579 |
'yesorno' |
| 1580 |
); |
| 1581 |
|
| 1582 |
foreach ( $section['questions'] as $key => $question ) { |
| 1583 |
$numbering = ""; |
| 1584 |
if(isset($this->options[ $this->name_prefix . 'question_numbering_array' ]) && !empty($this->options[ $this->name_prefix . 'question_numbering_array' ])){ |
| 1585 |
$numbering = $this->options[ $this->name_prefix . 'question_numbering_array' ][$key]." "; |
| 1586 |
} |
| 1587 |
$content[] = $this->create_question( $question , $numbering, $loop_count ); |
| 1588 |
$loop_count++; |
| 1589 |
|
| 1590 |
if( isset($question['user_variant']) && $question['user_variant'] ){ |
| 1591 |
$other_answer_count++; |
| 1592 |
} |
| 1593 |
|
| 1594 |
if( isset($question['type']) && !in_array($question['type'], $allowed_question_to_disable_next_button) ){ |
| 1595 |
$check_question_type_for_next_button++; |
| 1596 |
} |
| 1597 |
} |
| 1598 |
$content[] = '</div>'; |
| 1599 |
|
| 1600 |
$content[] = '</div>'; |
| 1601 |
|
| 1602 |
$footer_class_with_bar = ""; |
| 1603 |
$footer_class_with_terms = ""; |
| 1604 |
$enable_terms_and_conditions = $this->options[ $this->name_prefix . 'enable_terms_and_conditions' ]; |
| 1605 |
$terms_and_conditions_data = $this->options[ $this->name_prefix . 'terms_and_conditions_data' ]; |
| 1606 |
if($this->options[ $this->name_prefix . 'enable_progress_bar' ] == "on"){ |
| 1607 |
$footer_class_with_bar = "ays-survey-footer-with-live-bar"; |
| 1608 |
} |
| 1609 |
|
| 1610 |
$enable_terms_and_conditions_required_message = $this->options['enable_terms_and_conditions_required_message']; |
| 1611 |
if($enable_terms_and_conditions){ |
| 1612 |
|
| 1613 |
$footer_class_with_terms = "ays-survey-footer-with-terms-and-conds"; |
| 1614 |
} |
| 1615 |
|
| 1616 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-footer '.$footer_class_with_bar.' '.$footer_class_with_terms.'">'; |
| 1617 |
|
| 1618 |
if( $last ){ |
| 1619 |
if( $enable_terms_and_conditions ) { |
| 1620 |
$content[] = '<div data-required="true" data-all-terms-check="true" data-type="checkbox" class="' . $this->html_class_prefix . 'section-terms-and-conditions-container">'; |
| 1621 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-terms-and-conditions-content">'; |
| 1622 |
$padding_for_bussines = $this->options[ $this->name_prefix . 'is_business' ] ? 'style="padding:0 10px 3px;"' : ''; |
| 1623 |
foreach ($terms_and_conditions_data as $tc_text => $tc_text_value) { |
| 1624 |
if( $tc_text_value['messages'] != '' ){ |
| 1625 |
$content[] = '<div class="' . $this->html_class_prefix . 'terms-and-conditions-content-box" '.$padding_for_bussines.'>'; |
| 1626 |
$content[] = '<label class="' . $this->html_class_prefix . 'answer-label ' . $this->html_class_prefix . 'answer-label-terms-conditions">'; |
| 1627 |
if($this->options[ $this->name_prefix . 'is_business' ]){ |
| 1628 |
$content[] = '<input type="checkbox" class="' . $this->html_class_prefix . 'is-checked-terms-and-conditions ' . $this->html_class_prefix . 'business-theme-answers">'; |
| 1629 |
$content[] = '<span class="' . $this->html_name_prefix . 'maker-checkmark ' . $this->html_name_prefix . 'maker-checkmark-checkbox" style="top:18px"></span>'; |
| 1630 |
}else{ |
| 1631 |
$content[] = '<input type="checkbox" class="' . $this->html_class_prefix . 'is-checked-terms-and-conditions">'; |
| 1632 |
} |
| 1633 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-label-content">'; |
| 1634 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content">'; |
| 1635 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-ink"></div>'; |
| 1636 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content-1">'; |
| 1637 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content-2">'; |
| 1638 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content-3"></div>'; |
| 1639 |
$content[] = '</div>'; |
| 1640 |
$content[] = '</div>'; |
| 1641 |
$content[] = '</div>'; |
| 1642 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-terms-and-conditions">'; |
| 1643 |
$content[] = '<span class="">' . stripslashes(($tc_text_value['messages'])) . '</span>'; |
| 1644 |
$content[] = '</div>'; |
| 1645 |
$content[] = '</div>'; |
| 1646 |
$content[] = '</label>'; |
| 1647 |
|
| 1648 |
$content[] = '</div>'; |
| 1649 |
} |
| 1650 |
} |
| 1651 |
$content[] = '</div>'; |
| 1652 |
if($enable_terms_and_conditions_required_message){ |
| 1653 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-terms-and-conditions-required-message-content" style="display:none;">'; |
| 1654 |
$content[] = '<p class="' . $this->html_class_prefix . 'section-terms-and-conditions-required-message">'; |
| 1655 |
$content[] = '<span class="">' . __('By clicking on the checkbox, you agree to our Terms and Conditions', "survey-maker") . '</span>'; |
| 1656 |
$content[] = '</p>'; |
| 1657 |
$content[] = '</div>'; |
| 1658 |
} |
| 1659 |
$content[] = '</div>'; |
| 1660 |
} |
| 1661 |
} |
| 1662 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-buttons">'; |
| 1663 |
|
| 1664 |
if( ! $first ){ |
| 1665 |
if( $this->options[ $this->name_prefix . 'enable_previous_button' ] ){ |
| 1666 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-button-container" tabindex="0">'; |
| 1667 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-button-content">'; |
| 1668 |
$content[] = '<input type="button" class="' . $this->html_class_prefix . 'section-button ' . $this->html_class_prefix . 'prev-button" value="'. $this->buttons_texts[ 'previousButton' ] .'" />'; |
| 1669 |
$content[] = '</div>'; |
| 1670 |
$content[] = '</div>'; |
| 1671 |
} |
| 1672 |
} |
| 1673 |
|
| 1674 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-button-container" tabindex="0">'; |
| 1675 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-button-content">'; |
| 1676 |
if( $last ){ |
| 1677 |
$content[] = '<input type="button" class="' . $this->html_class_prefix . 'section-button ' . $this->html_class_prefix . 'finish-button" value="'. $this->buttons_texts[ 'finishButton' ] .'" />'; |
| 1678 |
}else{ |
| 1679 |
$disalble_next_button_class = $this->checkNextButtonVisibility($other_answer_count, $check_question_type_for_next_button) ? 'display_none_important' : ''; |
| 1680 |
$content[] = '<input type="button" class="' . $this->html_class_prefix . 'section-button ' . $this->html_class_prefix . 'next-button '.$disalble_next_button_class.'" value="'. $this->buttons_texts[ 'nextButton' ] .'" />'; |
| 1681 |
} |
| 1682 |
$content[] = '</div>'; |
| 1683 |
$content[] = '</div>'; |
| 1684 |
$content[] = '</div>'; |
| 1685 |
|
| 1686 |
if($this->options[ $this->name_prefix . 'enable_progress_bar' ] == "on"){ |
| 1687 |
$page_fill_percent = (1*100)/$section_count; |
| 1688 |
$content[] = "<div class='" . $this->html_class_prefix . "live-bar-main'>"; |
| 1689 |
if(!($this->options[ $this->name_prefix . 'hide_section_bar' ])){ |
| 1690 |
$content[] = "<div class='" . $this->html_class_prefix . "live-bar-wrap'> |
| 1691 |
<div class='" . $this->html_class_prefix . "live-bar-fill' style='width: ".$page_fill_percent."%;'></div> |
| 1692 |
</div>"; |
| 1693 |
} |
| 1694 |
if(!($this->options[ $this->name_prefix . 'hide_section_pagination_text' ])){ |
| 1695 |
$content[] = "<div class='" . $this->html_class_prefix . "live-bar-status'> |
| 1696 |
<span class='" . $this->html_class_prefix . "live-bar-status-text'>".sprintf(__("%s %s of %s" , "survey-maker") , $this->options[ $this->name_prefix . 'progress_bar_text' ] , "<span class='" . $this->html_class_prefix . "live-bar-changeable-text'>1</span>" , $section_count)."</span> |
| 1697 |
</div>"; |
| 1698 |
} |
| 1699 |
$content[] = "</div>"; |
| 1700 |
} |
| 1701 |
|
| 1702 |
$content[] = '</div>'; |
| 1703 |
|
| 1704 |
$content[] = '</div>'; |
| 1705 |
|
| 1706 |
$content = implode( '', $content ); |
| 1707 |
|
| 1708 |
return $content; |
| 1709 |
} |
| 1710 |
|
| 1711 |
public function create_question( $question , $numbering, $loop_count ){ |
| 1712 |
|
| 1713 |
$question_type = $question['type']; |
| 1714 |
$answers = $question['answers']; |
| 1715 |
$answers_html = array(); |
| 1716 |
$is_required = isset( $question['options']['required'] ) && $question['options']['required'] == 'on' ? true : false; |
| 1717 |
$image_caption = isset($question['options']['image_caption']) ? $question['options']['image_caption'] : ''; |
| 1718 |
$image_caption_enable = $question['options']['image_caption_enable']; |
| 1719 |
$is_minimum = "false"; |
| 1720 |
if($question_type == 'checkbox'){ |
| 1721 |
if(isset($question['options']['enable_max_selection_count']) && $question['options']['enable_max_selection_count']) |
| 1722 |
$is_minimum = isset($question['options']['min_selection_count']) && $question['options']['min_selection_count'] != "" ? "true" : "false"; |
| 1723 |
} |
| 1724 |
|
| 1725 |
// Admin note |
| 1726 |
$enable_admin_note = $question['options']['enable_admin_note']; |
| 1727 |
$admin_note = $question['options']['admin_note']; |
| 1728 |
|
| 1729 |
// Logo Image URL |
| 1730 |
$survey_logo_url_validate = "javascript:void(0)"; |
| 1731 |
$survey_logo_url = isset($this->options['options'][ $this->name_prefix . 'logo_url' ]) && $this->options['options'][ $this->name_prefix . 'logo_url' ] != "" ? $this->options['options'][ $this->name_prefix . 'logo_url' ] : ""; |
| 1732 |
$survey_logo_url_check = isset($this->options['options'][ $this->name_prefix . 'enable_logo_url' ]) && $this->options['options'][ $this->name_prefix . 'enable_logo_url' ] == "on" ? true : false; |
| 1733 |
$survey_logo_url_check_new_tab = isset($this->options['options'][ $this->name_prefix . 'logo_url_new_tab' ]) && $this->options['options'][ $this->name_prefix . 'logo_url_new_tab' ] == "on" ? true : false; |
| 1734 |
$survey_logo_target = ""; |
| 1735 |
if($survey_logo_url_check){ |
| 1736 |
$survey_logo_url_validate = filter_var($survey_logo_url, FILTER_VALIDATE_URL) ? $survey_logo_url : $survey_logo_url_validate; |
| 1737 |
if(filter_var($survey_logo_url, FILTER_VALIDATE_URL) && $survey_logo_url_check_new_tab){ |
| 1738 |
$survey_logo_target = "target='_blank'"; |
| 1739 |
} |
| 1740 |
} |
| 1741 |
// |
| 1742 |
if( $this->options[ $this->name_prefix . 'enable_randomize_answers' ] ){ |
| 1743 |
shuffle( $question['answers'] ); |
| 1744 |
shuffle( $answers ); |
| 1745 |
} |
| 1746 |
|
| 1747 |
$other_answer = $question['user_variant']; |
| 1748 |
if( $other_answer ){ |
| 1749 |
$answers[] = array( |
| 1750 |
'id' => '0', |
| 1751 |
'question_id' => $question['id'], |
| 1752 |
'answer' => '', |
| 1753 |
'image' => '', |
| 1754 |
'ordering' => count( $answers ) + 1, |
| 1755 |
'placeholder' => '', |
| 1756 |
'is_other' => true, |
| 1757 |
); |
| 1758 |
} |
| 1759 |
|
| 1760 |
$answers['is_first_question'] = $loop_count; |
| 1761 |
$question['answers']['is_first_question'] = $loop_count; |
| 1762 |
$is_lazy_loading = ($loop_count > 1) ? $this->lazy_loading : ""; |
| 1763 |
$show_answers_numbering = $this->options[ $this->name_prefix . 'auto_numbering' ]; |
| 1764 |
$this->options[ $this->name_prefix . 'numbering_array' ] = Survey_Maker_Data::ays_survey_numbering_all( $show_answers_numbering ); |
| 1765 |
|
| 1766 |
$minimal_theme_question = $this->options[ $this->name_prefix . 'is_minimal' ] ? 'ays-survey-minimal-theme-question' : ""; |
| 1767 |
$modern_theme_question = $this->options[ $this->name_prefix . 'is_modern' ] ? 'ays-survey-modern-theme-question' : ""; |
| 1768 |
|
| 1769 |
$has_answer_image = false; |
| 1770 |
foreach ($answers as $key => $answer) { |
| 1771 |
if(isset( $answer['image'] ) && $answer['image'] != ""){ |
| 1772 |
$has_answer_image = true; |
| 1773 |
} |
| 1774 |
} |
| 1775 |
|
| 1776 |
$question_types = array( |
| 1777 |
"radio", |
| 1778 |
"checkbox", |
| 1779 |
"select", |
| 1780 |
"star", |
| 1781 |
"date", |
| 1782 |
"time", |
| 1783 |
"date_time", |
| 1784 |
"text", |
| 1785 |
"short_text", |
| 1786 |
"number", |
| 1787 |
"phone", |
| 1788 |
"email", |
| 1789 |
"name", |
| 1790 |
); |
| 1791 |
|
| 1792 |
$question_types_getting_answers_array = array( |
| 1793 |
"radio", |
| 1794 |
"checkbox", |
| 1795 |
); |
| 1796 |
|
| 1797 |
if( !in_array( $question_type, $question_types ) ){ |
| 1798 |
$question_type = "radio"; |
| 1799 |
} |
| 1800 |
|
| 1801 |
|
| 1802 |
$question_type_function = 'ays_survey_question_type_' . strtoupper( $question_type ) . '_html'; |
| 1803 |
|
| 1804 |
$transmitting_array = in_array( $question_type, $question_types_getting_answers_array ) ? $answers : $question; |
| 1805 |
|
| 1806 |
$answers_html[] = $this->$question_type_function( $transmitting_array ); |
| 1807 |
|
| 1808 |
$answers_html = implode( '', $answers_html ); |
| 1809 |
|
| 1810 |
$answer_grid = ''; |
| 1811 |
if( $has_answer_image || $this->options[ $this->name_prefix . 'answers_view' ] == 'grid' ){ |
| 1812 |
$answer_grid = $this->html_class_prefix . 'question-answers-grid'; |
| 1813 |
} |
| 1814 |
$data_required = $is_required ? "true" : "false"; |
| 1815 |
|
| 1816 |
$is_required_field = $is_required ? '<sup class="' . $this->html_class_prefix . 'question-required-icon">*</sup>' : ""; |
| 1817 |
|
| 1818 |
|
| 1819 |
$question_title = Survey_Maker_Data::survey_sanitize_specific_content($question['question']); |
| 1820 |
if($numbering){ |
| 1821 |
preg_match('/<([a-z]+[1-9]*)\b[^>]*>(.*?)<\/\1>/', $question_title, $matches ); |
| 1822 |
if(empty($matches)){ |
| 1823 |
$question_title = $numbering . $question_title; |
| 1824 |
}else{ |
| 1825 |
$question_title_numbering_1 = $numbering . $matches[2]; |
| 1826 |
$question_title_numbering_2 = str_replace( $matches[2], $question_title_numbering_1, $matches[0] ); |
| 1827 |
$question_title = str_replace( $matches[0], $question_title_numbering_2, $question_title ); |
| 1828 |
} |
| 1829 |
} |
| 1830 |
|
| 1831 |
if ( $is_required_field != "" ) { |
| 1832 |
preg_match('/<([a-z]+[1-9]*)\b[^>]*>(.*?)<\/\1>/', $question_title, $matches ); |
| 1833 |
if(empty($matches)){ |
| 1834 |
$question_title = $question_title . $is_required_field; |
| 1835 |
}else{ |
| 1836 |
$question_title_numbering_1 = $matches[2] . $is_required_field; |
| 1837 |
$question_title_numbering_2 = str_replace( $matches[2], $question_title_numbering_1, $matches[0] ); |
| 1838 |
$question_title = str_replace( $matches[0], $question_title_numbering_2, $question_title ); |
| 1839 |
} |
| 1840 |
} |
| 1841 |
|
| 1842 |
$content = array(); |
| 1843 |
$content[] = '<div class="' . $this->html_class_prefix . 'question ' . $minimal_theme_question . ' '.$modern_theme_question . '" data-required="' . $data_required . '" data-type="' . $question_type . '" data-is-min="'.$is_minimum.'">'; |
| 1844 |
|
| 1845 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-header">'; |
| 1846 |
|
| 1847 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-header-content">'; |
| 1848 |
|
| 1849 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-title">' . Survey_Maker_Data::ays_autoembed( $question_title ); |
| 1850 |
|
| 1851 |
$content[] = '</div>'; |
| 1852 |
|
| 1853 |
$content[] = '</div>'; |
| 1854 |
|
| 1855 |
if( isset( $question['image'] ) && $question['image'] != "" ){ |
| 1856 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-image-container">'; |
| 1857 |
$surve_question_image_alt_text = Survey_Maker_Data::ays_survey_get_image_id_by_url($question['image']); |
| 1858 |
$content[] = '<img class="' . $this->html_class_prefix . 'question-image" src="' . $question['image'] . '" alt="' . $surve_question_image_alt_text . '" '.$is_lazy_loading.' />'; |
| 1859 |
if($image_caption_enable){ |
| 1860 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-image-caption">'; |
| 1861 |
$content[] = '<span>'.$image_caption.'</span>'; |
| 1862 |
$content[] = '</div>'; |
| 1863 |
} |
| 1864 |
$content[] = '</div>'; |
| 1865 |
} |
| 1866 |
|
| 1867 |
$content[] = '</div>'; |
| 1868 |
|
| 1869 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-content">'; |
| 1870 |
|
| 1871 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-answers ' . $answer_grid . '">'; |
| 1872 |
|
| 1873 |
$content[] = $answers_html; |
| 1874 |
|
| 1875 |
$content[] = '<input type="hidden" name="' . $this->html_name_prefix . 'questions-' . $this->unique_id . '[' . $question['id'] . '][section]" value="' . $question['section_id'] . '">'; |
| 1876 |
$content[] = '<input type="hidden" name="' . $this->html_name_prefix . 'questions-' . $this->unique_id . '[' . $question['id'] . '][questionType]" value="' . $question_type . '">'; |
| 1877 |
$content[] = '<input type="hidden" class="' . $this->html_class_prefix . 'question-id" name="' . $this->html_name_prefix . 'questions-' . $this->unique_id . '[' . $question['id'] . '][questionId]" value="' . $question['id'] . '">'; |
| 1878 |
|
| 1879 |
if( $this->options[ $this->name_prefix . 'enable_clear_answer' ] ){ |
| 1880 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-clear-selection-container ' . $this->html_class_prefix . 'visibility-none transition fade">'; |
| 1881 |
$content[] = '<div class="' . $this->html_class_prefix . 'simple-button-container">'; |
| 1882 |
$content[] = '<div class="' . $this->html_class_prefix . 'button-content">'; |
| 1883 |
$content[] = '<span class="' . $this->html_class_prefix . 'answer-clear-selection-text ' . $this->html_class_prefix . 'button" tabindex="0">' . $this->buttons_texts[ 'clearButton' ] . '</span>'; |
| 1884 |
$content[] = '</div>'; |
| 1885 |
$content[] = '</div>'; |
| 1886 |
$content[] = '</div>'; |
| 1887 |
} |
| 1888 |
|
| 1889 |
$content[] = '</div>'; |
| 1890 |
|
| 1891 |
$content[] = '</div>'; |
| 1892 |
|
| 1893 |
if( $enable_admin_note && $admin_note != "" ){ |
| 1894 |
$content[] = "<div class='" . $this->html_class_prefix . "admin-note-main'> |
| 1895 |
<div class='" . $this->html_class_prefix . "admin-note-inner'><span class='" . $this->html_class_prefix . "admin-note-text'>" . $admin_note . "</span></div> |
| 1896 |
</div>"; |
| 1897 |
} |
| 1898 |
|
| 1899 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-footer">'; |
| 1900 |
if($is_minimum == 'true'){ |
| 1901 |
$content[] = '<div class="' . $this->html_class_prefix . 'votes-count-validation-error" role="alert"></div>'; |
| 1902 |
} |
| 1903 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-validation-error" role="alert"></div>'; |
| 1904 |
if(isset($this->options[ $this->name_prefix . 'logo' ]) && $this->options[ $this->name_prefix . 'logo' ] != ""){ |
| 1905 |
$content[] = '<div class="' . $this->html_class_prefix . 'image-logo-url"> |
| 1906 |
<a href="'.$survey_logo_url_validate.'" '.$survey_logo_target.' style="display: inline-block;"> |
| 1907 |
<img title="'.$this->options[ $this->name_prefix . 'logo_title' ].'" src="'.$this->options[ $this->name_prefix . 'logo' ].'" class="' . $this->html_class_prefix . 'image-logo-url-img"> |
| 1908 |
</a> |
| 1909 |
</div>'; |
| 1910 |
} |
| 1911 |
$content[] = '</div>'; |
| 1912 |
|
| 1913 |
$content[] = '</div>'; |
| 1914 |
|
| 1915 |
$content = implode( '', $content ); |
| 1916 |
|
| 1917 |
return $content; |
| 1918 |
} |
| 1919 |
|
| 1920 |
public function ays_survey_question_type_RADIO_html( $answers ){ |
| 1921 |
|
| 1922 |
$content = array(); |
| 1923 |
|
| 1924 |
$has_answer_image = false; |
| 1925 |
foreach ($answers as $key => $answer) { |
| 1926 |
if(isset( $answer['image'] ) && $answer['image'] != ""){ |
| 1927 |
$has_answer_image = true; |
| 1928 |
} |
| 1929 |
} |
| 1930 |
|
| 1931 |
$answer_grid = ''; |
| 1932 |
$answer_label_grid = ''; |
| 1933 |
if( $has_answer_image || $this->options[ $this->name_prefix . 'answers_view' ] == 'grid' ){ |
| 1934 |
$answer_grid = $this->html_class_prefix . 'answer-grid'; |
| 1935 |
$answer_label_grid = $this->html_class_prefix . 'answer-label-grid'; |
| 1936 |
} |
| 1937 |
|
| 1938 |
$is_first_question = $answers['is_first_question']; |
| 1939 |
$is_lazy_loading = ($is_first_question > 1) ? $this->lazy_loading : ""; |
| 1940 |
unset($answers['is_first_question']); |
| 1941 |
|
| 1942 |
foreach ($answers as $key => $answer) { |
| 1943 |
|
| 1944 |
$is_other = false; |
| 1945 |
if( isset( $answer['is_other'] ) && $answer['is_other'] == true ){ |
| 1946 |
$is_other = true; |
| 1947 |
} |
| 1948 |
|
| 1949 |
$answer_label_other = ''; |
| 1950 |
$other_answer_box_width = ''; |
| 1951 |
if( $is_other ){ |
| 1952 |
$answer_label_other = $this->html_class_prefix . 'answer-label-other'; |
| 1953 |
$other_answer_box_width = $this->html_class_prefix . 'other-answer-container'; |
| 1954 |
} |
| 1955 |
|
| 1956 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer ' . $answer_grid . ' '.$other_answer_box_width.'">'; |
| 1957 |
|
| 1958 |
$content[] = '<label class="' . $this->html_class_prefix . 'answer-label ' . $answer_label_grid . ' ' . $answer_label_other . '" tabindex="0">'; |
| 1959 |
|
| 1960 |
if( $this->options[$this->name_prefix . 'is_minimal'] ){ |
| 1961 |
if( isset( $answer['image'] ) && $answer['image'] != "" ){ |
| 1962 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-image-container">'; |
| 1963 |
$content[] = '<img class="' . $this->html_class_prefix . 'answer-image" '. $is_lazy_loading .' src="' . $answer['image'] . '" alt="' . stripslashes( $answer['answer'] ) . '" />'; |
| 1964 |
$content[] = '</div>'; |
| 1965 |
} |
| 1966 |
if (!$is_other) { |
| 1967 |
$content[] = '<input class="" type="radio" name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $answer['question_id'] . '][answer]" value="' . $answer['id'] . '">'; |
| 1968 |
} else { |
| 1969 |
$content[] = '<input class="" type="radio" name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $answer['question_id'] . '][answer]" data-logicjump="' . $answer['question_id'] . '" value="' . $answer['id'] . '">'; |
| 1970 |
} |
| 1971 |
} |
| 1972 |
else{ |
| 1973 |
|
| 1974 |
$content[] = '<input class="" type="radio" name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $answer['question_id'] . '][answer]" value="' . $answer['id'] . '" autocomplete="off">'; |
| 1975 |
|
| 1976 |
if( isset( $answer['image'] ) && $answer['image'] != "" ){ |
| 1977 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-image-container">'; |
| 1978 |
$content[] = '<img class="' . $this->html_class_prefix . 'answer-image" src="' . $answer['image'] . '" alt="' . stripslashes( $answer['answer'] ) . '" '. $is_lazy_loading .' />'; |
| 1979 |
$content[] = '</div>'; |
| 1980 |
} |
| 1981 |
} |
| 1982 |
|
| 1983 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-label-content">'; |
| 1984 |
|
| 1985 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content">'; |
| 1986 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-ink"></div>'; |
| 1987 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content-1">'; |
| 1988 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content-2">'; |
| 1989 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content-3"></div>'; |
| 1990 |
$content[] = '</div>'; |
| 1991 |
$content[] = '</div>'; |
| 1992 |
$content[] = '</div>'; |
| 1993 |
|
| 1994 |
if( $is_other ){ |
| 1995 |
$content[] = '<span class="">' . __( 'Other', "survey-maker" ) . ':</span>'; |
| 1996 |
}else{ |
| 1997 |
if( ! empty( $this->options[ $this->name_prefix . 'numbering_array' ] ) ){ |
| 1998 |
$numebering_answer = $this->options[ $this->name_prefix . 'numbering_array' ][$key] . ' '; |
| 1999 |
}else{ |
| 2000 |
$numebering_answer = ''; |
| 2001 |
} |
| 2002 |
$content[] = '<span class="">' .$numebering_answer . $answer['answer'] . '</span>'; |
| 2003 |
} |
| 2004 |
|
| 2005 |
$content[] = '</div>'; |
| 2006 |
$content[] = '</label>'; |
| 2007 |
|
| 2008 |
if( $is_other ){ |
| 2009 |
|
| 2010 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-other-text">'; |
| 2011 |
$content[] = '<input id="' . $this->html_class_prefix . 'answer-other-input-' . $answer['question_id'] . '" class="' . $this->html_class_prefix . 'answer-other-input ' . |
| 2012 |
$this->html_class_prefix . 'remove-default-border ' . |
| 2013 |
$this->html_class_prefix . 'question-input ' . |
| 2014 |
$this->html_class_prefix . 'input |
| 2015 |
' . $this->html_class_prefix . 'answer-text-inputs" |
| 2016 |
name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $answer['question_id'] . '][other]" |
| 2017 |
type="text" autocomplete="off" tabindex="0" />'; |
| 2018 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline" style="margin:0;"></div>'; |
| 2019 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation" style="margin:0;"></div>'; |
| 2020 |
$content[] = '</div>'; |
| 2021 |
|
| 2022 |
} |
| 2023 |
|
| 2024 |
$content[] = '</div>'; |
| 2025 |
} |
| 2026 |
|
| 2027 |
$content = implode( '', $content ); |
| 2028 |
|
| 2029 |
return $content; |
| 2030 |
} |
| 2031 |
|
| 2032 |
public function ays_survey_question_type_CHECKBOX_html( $answers ){ |
| 2033 |
$content = array(); |
| 2034 |
$has_answer_image = false; |
| 2035 |
foreach ($answers as $key => $answer) { |
| 2036 |
if(isset( $answer['image'] ) && $answer['image'] != ""){ |
| 2037 |
$has_answer_image = true; |
| 2038 |
} |
| 2039 |
} |
| 2040 |
|
| 2041 |
$answer_grid = ''; |
| 2042 |
$answer_label_grid = ''; |
| 2043 |
if( $has_answer_image || $this->options[ $this->name_prefix . 'answers_view' ] == 'grid' ){ |
| 2044 |
$answer_grid = $this->html_class_prefix . 'answer-grid'; |
| 2045 |
$answer_label_grid = $this->html_class_prefix . 'answer-label-grid'; |
| 2046 |
} |
| 2047 |
|
| 2048 |
$is_first_question = $answers['is_first_question']; |
| 2049 |
$is_lazy_loading = ($is_first_question > 1) ? $this->lazy_loading : ""; |
| 2050 |
unset($answers['is_first_question']); |
| 2051 |
foreach ($answers as $key => $answer) { |
| 2052 |
|
| 2053 |
$is_other = false; |
| 2054 |
if( isset( $answer['is_other'] ) && $answer['is_other'] == true ){ |
| 2055 |
$is_other = true; |
| 2056 |
} |
| 2057 |
|
| 2058 |
$answer_label_other = ''; |
| 2059 |
$other_answer_box_width = ''; |
| 2060 |
if( $is_other ){ |
| 2061 |
$answer_label_other = $this->html_class_prefix . 'answer-label-other'; |
| 2062 |
$other_answer_box_width = $this->html_class_prefix . 'other-answer-container'; |
| 2063 |
} |
| 2064 |
|
| 2065 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer ' . $answer_grid . ' '.$other_answer_box_width.'">'; |
| 2066 |
|
| 2067 |
$content[] = '<label class="' . $this->html_class_prefix . 'answer-label ' . $answer_label_grid . ' ' . $answer_label_other . '" tabindex="0">'; |
| 2068 |
|
| 2069 |
if( $this->options[$this->name_prefix . 'is_minimal'] ){ |
| 2070 |
if( isset( $answer['image'] ) && $answer['image'] != "" ){ |
| 2071 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-image-container">'; |
| 2072 |
$content[] = '<img class="' . $this->html_class_prefix . 'answer-image" '. $is_lazy_loading .' src="' . $answer['image'] . '" alt="' . stripslashes( $answer['answer'] ) . '" />'; |
| 2073 |
$content[] = '</div>'; |
| 2074 |
} |
| 2075 |
|
| 2076 |
$content[] = '<input class="" type="checkbox" name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $answer['question_id'] . '][answer][]" value="' . $answer['id'] . '">'; |
| 2077 |
} |
| 2078 |
else{ |
| 2079 |
$content[] = '<input class="" type="checkbox" name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $answer['question_id'] . '][answer][]" value="' . $answer['id'] . '" autocomplete="off">'; |
| 2080 |
|
| 2081 |
if( isset( $answer['image'] ) && $answer['image'] != "" ){ |
| 2082 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-image-container">'; |
| 2083 |
$content[] = '<img class="' . $this->html_class_prefix . 'answer-image" src="' . $answer['image'] . '" '. $is_lazy_loading .' alt="' . stripslashes( $answer['answer'] ) . '" />'; |
| 2084 |
$content[] = '</div>'; |
| 2085 |
} |
| 2086 |
} |
| 2087 |
|
| 2088 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-label-content">'; |
| 2089 |
|
| 2090 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content">'; |
| 2091 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-ink"></div>'; |
| 2092 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content-1">'; |
| 2093 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content-2">'; |
| 2094 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content-3"></div>'; |
| 2095 |
$content[] = '</div>'; |
| 2096 |
$content[] = '</div>'; |
| 2097 |
$content[] = '</div>'; |
| 2098 |
|
| 2099 |
if( $is_other ){ |
| 2100 |
$content[] = '<span class="">' . __( 'Other', "survey-maker" ) . ':</span>'; |
| 2101 |
}else{ |
| 2102 |
if( ! empty( $this->options[ $this->name_prefix . 'numbering_array' ] ) ){ |
| 2103 |
$numebering_answer = $this->options[ $this->name_prefix . 'numbering_array' ][$key] . ' '; |
| 2104 |
}else{ |
| 2105 |
$numebering_answer = ''; |
| 2106 |
} |
| 2107 |
$content[] = '<span class="">' . $numebering_answer . $answer['answer'] . '</span>'; |
| 2108 |
} |
| 2109 |
|
| 2110 |
$content[] = '</div>'; |
| 2111 |
$content[] = '</label>'; |
| 2112 |
|
| 2113 |
if( $is_other ){ |
| 2114 |
|
| 2115 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-other-text">'; |
| 2116 |
$content[] = '<input id="' . $this->html_class_prefix . 'answer-other-input-' . $answer['question_id'] . '" class="' . $this->html_class_prefix . 'answer-other-input ' . |
| 2117 |
$this->html_class_prefix . 'remove-default-border ' . |
| 2118 |
$this->html_class_prefix . 'question-input ' . |
| 2119 |
$this->html_class_prefix . 'input |
| 2120 |
' . $this->html_class_prefix . 'answer-text-inputs" |
| 2121 |
name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $answer['question_id'] . '][other]" |
| 2122 |
type="text" autocomplete="off" tabindex="0" />'; |
| 2123 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline" style="margin:0;"></div>'; |
| 2124 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation" style="margin:0;"></div>'; |
| 2125 |
$content[] = '</div>'; |
| 2126 |
|
| 2127 |
} |
| 2128 |
|
| 2129 |
$content[] = '</div>'; |
| 2130 |
} |
| 2131 |
|
| 2132 |
$content = implode( '', $content ); |
| 2133 |
|
| 2134 |
return $content; |
| 2135 |
} |
| 2136 |
|
| 2137 |
public function ays_survey_question_type_SELECT_html( $question ){ |
| 2138 |
$content = array(); |
| 2139 |
|
| 2140 |
$is_first_question = $question['answers']['is_first_question']; |
| 2141 |
$is_lazy_loading = ($is_first_question > 1) ? $this->lazy_loading : ""; |
| 2142 |
unset($question['answers']['is_first_question']); |
| 2143 |
$select_class = $this->html_class_prefix . 'question-select-conteiner-minimal'; |
| 2144 |
if( $this->options[$this->name_prefix . 'is_minimal']){ |
| 2145 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer">'; |
| 2146 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-type-select-box">'; |
| 2147 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-select-conteiner">'; |
| 2148 |
$content[] = '<select class="' . $select_class . '" |
| 2149 |
name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . ']">'; |
| 2150 |
foreach ( $question['answers'] as $key => $answer ) { |
| 2151 |
|
| 2152 |
$content[] = "<option value='" . $answer['id'] . "' >"; |
| 2153 |
if( ! empty( $this->options[ $this->name_prefix . 'numbering_array' ] ) ){ |
| 2154 |
$numebering_answer = $this->options[ $this->name_prefix . 'numbering_array' ][$key] . ' '; |
| 2155 |
}else{ |
| 2156 |
$numebering_answer = ''; |
| 2157 |
} |
| 2158 |
$content[] = $numebering_answer . stripslashes( $answer['answer'] ); |
| 2159 |
$content[] = '</option>'; |
| 2160 |
} |
| 2161 |
$content[] = '</select>'; |
| 2162 |
$content[] = '</div>'; |
| 2163 |
$content[] = '</div>'; |
| 2164 |
$content[] = '</div>'; |
| 2165 |
} |
| 2166 |
else{ |
| 2167 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer">'; |
| 2168 |
|
| 2169 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-type-select-box">'; |
| 2170 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-select-conteiner">'; |
| 2171 |
|
| 2172 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-select ui selection icon dropdown">'; |
| 2173 |
|
| 2174 |
$content[] = '<input type="hidden" class="' . $this->html_name_prefix . 'detect-selected-question-dropdown" name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . ']">'; |
| 2175 |
|
| 2176 |
$content[] = '<i class="dropdown icon"></i>'; |
| 2177 |
$content[] = '<div class="default text">'.__('Choose', "survey-maker").'</div>'; |
| 2178 |
|
| 2179 |
$content[] = '<div class="menu">'; |
| 2180 |
|
| 2181 |
foreach ( $question['answers'] as $key => $answer ) { |
| 2182 |
$content[] = '<div class="item" data-value="'. $answer['id'] .'">'; |
| 2183 |
|
| 2184 |
if( isset( $answer['image'] ) && $answer['image'] != "" ){ |
| 2185 |
$content[] = '<img class="' . $this->html_class_prefix . 'answer-image" src="' . $answer['image'] . '" alt="' . stripslashes( $answer['answer'] ) . '" '. $is_lazy_loading .' />'; |
| 2186 |
} |
| 2187 |
|
| 2188 |
if( ! empty( $this->options[ $this->name_prefix . 'numbering_array' ] ) ){ |
| 2189 |
$numebering_answer = $this->options[ $this->name_prefix . 'numbering_array' ][$key] . ' '; |
| 2190 |
}else{ |
| 2191 |
$numebering_answer = ''; |
| 2192 |
} |
| 2193 |
|
| 2194 |
$content[] = $numebering_answer . stripslashes( $answer['answer'] ); |
| 2195 |
|
| 2196 |
$content[] = '</div>'; |
| 2197 |
} |
| 2198 |
|
| 2199 |
$content[] = '</div>'; |
| 2200 |
$content[] = '</div>'; |
| 2201 |
|
| 2202 |
$content[] = '</div>'; |
| 2203 |
$content[] = '</div>'; |
| 2204 |
|
| 2205 |
$content[] = '</div>'; |
| 2206 |
} |
| 2207 |
|
| 2208 |
$content = implode( '', $content ); |
| 2209 |
|
| 2210 |
return $content; |
| 2211 |
} |
| 2212 |
|
| 2213 |
|
| 2214 |
public function ays_survey_question_type_STAR_html( $question ){ |
| 2215 |
$content = array(); |
| 2216 |
|
| 2217 |
//checked Input |
| 2218 |
$enable_url_parameter = isset($question['options']['enable_url_parameter']) && $question['options']['enable_url_parameter'] == true ? true : false; |
| 2219 |
$url_parameter = $enable_url_parameter && isset($question['options']['url_parameter']) && $question['options']['url_parameter'] != "" ? $question['options']['url_parameter'] : ''; |
| 2220 |
$selected_input = isset($_GET[$url_parameter]) && $_GET[$url_parameter] ? $_GET[$url_parameter] : ''; |
| 2221 |
|
| 2222 |
$star_label_1 = (isset($question['options']['star_1']) && $question['options']['star_1'] != '') ? $question['options']['star_1'] : ''; |
| 2223 |
$star_label_2 = (isset($question['options']['star_2']) && $question['options']['star_2'] != '') ? $question['options']['star_2'] : ''; |
| 2224 |
$star_scale_length = (isset($question['options']['star_scale_length']) && $question['options']['star_scale_length'] != '') ? absint( $question['options']['star_scale_length'] ) : 5; |
| 2225 |
|
| 2226 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-star">'; |
| 2227 |
|
| 2228 |
$content[] = '<label class="' . $this->html_class_prefix . 'answer-star-label">'; |
| 2229 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-star-radio-label" dir="auto"></div>'; |
| 2230 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-star-radio">'; |
| 2231 |
$content[] = $star_label_1; |
| 2232 |
$content[] = '</div>'; |
| 2233 |
$content[] = '</label>'; |
| 2234 |
|
| 2235 |
for ($i=1; $i <= $star_scale_length; $i++) { |
| 2236 |
$is_selected = $i == $selected_input ? "checked" : ""; |
| 2237 |
$active_answer = $i == $selected_input ? "active-answer" : ""; |
| 2238 |
$selected_stars = ($i <= $selected_input) && ($selected_input <= $star_scale_length) ? "fa-star" : "fa-star-o"; |
| 2239 |
|
| 2240 |
$content[] = '<label class="' . $this->html_class_prefix . 'answer-label ' . $active_answer . '">'; |
| 2241 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-star-radio-label" dir="auto"></div>'; |
| 2242 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-star-radio" tabindex="0">'; |
| 2243 |
|
| 2244 |
$content[] = '<input type="radio" value="'.$i.'" name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . '][answer]"' . $is_selected . '>'; |
| 2245 |
|
| 2246 |
$content[] = '<i class="fa ' . $selected_stars . ' ' . $this->html_class_prefix . 'star-icon"></i>'; |
| 2247 |
|
| 2248 |
$content[] = '</div>'; |
| 2249 |
$content[] = '</label>'; |
| 2250 |
} |
| 2251 |
|
| 2252 |
$content[] = '<label class="' . $this->html_class_prefix . 'answer-star-label">'; |
| 2253 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-star-radio-label" dir="auto"></div>'; |
| 2254 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer-star-radio">'; |
| 2255 |
$content[] = $star_label_2; |
| 2256 |
$content[] = '</div>'; |
| 2257 |
$content[] = '</label>'; |
| 2258 |
|
| 2259 |
$content[] = '</div>'; |
| 2260 |
|
| 2261 |
$content = implode( '', $content ); |
| 2262 |
|
| 2263 |
return $content; |
| 2264 |
} |
| 2265 |
|
| 2266 |
public function ays_survey_question_type_TEXT_html( $question ){ |
| 2267 |
$content = array(); |
| 2268 |
// Input types placeholders |
| 2269 |
$survey_input_type_placeholder = isset($question['options']['placeholder']) && $question['options']['placeholder'] != "" ? $question['options']['placeholder'] : ''; |
| 2270 |
|
| 2271 |
$enable_word_limit = isset($question['options']['enable_word_limitation']) && $question['options']['enable_word_limitation'] == "on" ? true : false; |
| 2272 |
$show_limit = isset($question['options']['limit_counter']) && $question['options']['limit_counter'] == "on" ? true : false; |
| 2273 |
$limit_length = isset($question['options']['limit_length']) && $question['options']['limit_length'] != "" ? $question['options']['limit_length'] : ""; |
| 2274 |
$limit_by = "Character"; |
| 2275 |
$limit_checker = false; |
| 2276 |
$survey_question_limit_length_class = ''; |
| 2277 |
if($enable_word_limit ){ |
| 2278 |
if($show_limit){ |
| 2279 |
$limit_checker = true; |
| 2280 |
} |
| 2281 |
$survey_question_limit_length_class = $this->html_class_prefix . 'check-word-limit '; |
| 2282 |
} |
| 2283 |
if($question['options']['limit_by'] && $question['options']['limit_by'] == "word"){ |
| 2284 |
$limit_by = "Word"; |
| 2285 |
} |
| 2286 |
if(intval($limit_length) > 0){ |
| 2287 |
$limit_by .= "s "; |
| 2288 |
} |
| 2289 |
$limit_by .= __("left", "survey-maker"); |
| 2290 |
if(intval($limit_length) <= 0){ |
| 2291 |
$limit_by = ''; |
| 2292 |
} |
| 2293 |
|
| 2294 |
$minimal_theme = $this->options[ $this->name_prefix . 'is_minimal' ] ? true : false; |
| 2295 |
$minimal_class = $this->html_class_prefix . 'remove-default-border ' . $this->html_class_prefix . 'question-input-textarea ' . $this->html_class_prefix . 'question-input'; |
| 2296 |
if( $minimal_theme ){ |
| 2297 |
$minimal_class = $this->html_class_prefix . "minimal-theme-textarea-input"; |
| 2298 |
} |
| 2299 |
|
| 2300 |
|
| 2301 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer">'; |
| 2302 |
|
| 2303 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-box ' . $this->html_class_prefix . 'question-type-text-box">'; |
| 2304 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-input-box">'; |
| 2305 |
|
| 2306 |
$content[] = '<textarea class=" |
| 2307 |
' . $minimal_class . ' |
| 2308 |
' . |
| 2309 |
$this->html_class_prefix . 'remove-default-border ' . |
| 2310 |
$this->html_class_prefix . 'question-input-textarea ' . |
| 2311 |
$survey_question_limit_length_class . |
| 2312 |
$this->html_class_prefix . 'question-input ' . |
| 2313 |
$this->html_class_prefix . 'input |
| 2314 |
' . $this->html_class_prefix . 'answer-text-inputs" type="text" style="min-height: 24px;" |
| 2315 |
placeholder="'. __( $survey_input_type_placeholder, "survey-maker" ) .'" |
| 2316 |
name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . '][answer]" autocomplete="off">'; |
| 2317 |
$content[] = '</textarea>'; |
| 2318 |
|
| 2319 |
if( ! $minimal_theme ){ |
| 2320 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline"></div>'; |
| 2321 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation"></div>'; |
| 2322 |
} |
| 2323 |
|
| 2324 |
$content[] = '</div>'; |
| 2325 |
if($limit_checker){ |
| 2326 |
$content[] .= '<div class="'.$this->html_class_prefix.'question-text-conteiner">'; |
| 2327 |
$content[] .= '<div class="'.$this->html_class_prefix.'question-text-message">'; |
| 2328 |
$content[] .= '<span class="'.$this->html_class_prefix.'question-text-message-span">'. $limit_length . '</span> ' . $limit_by; |
| 2329 |
$content[] .= '</div>'; |
| 2330 |
$content[] .= '</div>'; |
| 2331 |
} |
| 2332 |
$content[] = '</div>'; |
| 2333 |
|
| 2334 |
$content[] = '</div>'; |
| 2335 |
|
| 2336 |
$content = implode( '', $content ); |
| 2337 |
|
| 2338 |
return $content; |
| 2339 |
} |
| 2340 |
|
| 2341 |
public function ays_survey_question_type_SHORT_TEXT_html( $question ){ |
| 2342 |
$content = array(); |
| 2343 |
// Input types placeholders |
| 2344 |
$survey_input_type_placeholder = isset($question['options']['placeholder']) && $question['options']['placeholder'] != "" ? $question['options']['placeholder'] : ''; |
| 2345 |
|
| 2346 |
$enable_value_prefix = $question['options']['enable_value_prefix']; |
| 2347 |
$value_prefix = $enable_value_prefix ? stripslashes(sanitize_text_field($question['options']['value_prefix'])) : ''; |
| 2348 |
|
| 2349 |
$enable_value_suffix = $question['options']['enable_value_suffix']; |
| 2350 |
$value_suffix = $enable_value_suffix ? stripslashes(sanitize_text_field($question['options']['value_suffix'])) : ''; |
| 2351 |
|
| 2352 |
$answer_box_prefix_suffix_css_class = ""; |
| 2353 |
$answer_container_prefix_suffix_css_class = ""; |
| 2354 |
if( $value_prefix != "" || $value_suffix != "" ){ |
| 2355 |
$answer_box_prefix_suffix_css_class = $this->html_class_prefix . 'question-box-text-types-prefix-suffix'; |
| 2356 |
} |
| 2357 |
$answer_container_prefix_suffix_css_class = $this->html_class_prefix . 'answer-box-text-types-prefix-suffix'; |
| 2358 |
|
| 2359 |
$enable_word_limit = isset($question['options']['enable_word_limitation']) && $question['options']['enable_word_limitation'] ? true : false; |
| 2360 |
$show_limit = isset($question['options']['limit_counter']) && $question['options']['limit_counter'] == "on" ? true : false; |
| 2361 |
$limit_length = isset($question['options']['limit_length']) && $question['options']['limit_length'] != "" ? $question['options']['limit_length'] : ""; |
| 2362 |
$limit_by = "Character"; |
| 2363 |
$limit_checker = false; |
| 2364 |
$survey_question_limit_length_class = ''; |
| 2365 |
if($enable_word_limit ){ |
| 2366 |
if($show_limit){ |
| 2367 |
$limit_checker = true; |
| 2368 |
} |
| 2369 |
$survey_question_limit_length_class = $this->html_class_prefix . 'check-word-limit '; |
| 2370 |
} |
| 2371 |
if($question['options']['limit_by'] && $question['options']['limit_by'] == "word"){ |
| 2372 |
$limit_by = "Word"; |
| 2373 |
} |
| 2374 |
if(intval($limit_length) > 0){ |
| 2375 |
$limit_by .= "s "; |
| 2376 |
} |
| 2377 |
$limit_by .= __("left", "survey-maker"); |
| 2378 |
if(intval($limit_length) <= 0){ |
| 2379 |
$limit_by = ''; |
| 2380 |
} |
| 2381 |
|
| 2382 |
$minimal_theme = $this->options[ $this->name_prefix . 'is_minimal' ] ? true : false; |
| 2383 |
$minimal_class = $this->html_class_prefix . 'remove-default-border ' .$this->html_class_prefix . 'question-input'; |
| 2384 |
if( $minimal_theme ){ |
| 2385 |
$minimal_class = $this->html_class_prefix . "minimal-theme-textarea-input"; |
| 2386 |
} |
| 2387 |
|
| 2388 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer '. $answer_container_prefix_suffix_css_class .'">'; |
| 2389 |
|
| 2390 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-box '. $answer_box_prefix_suffix_css_class .'">'; |
| 2391 |
if( $value_prefix != "" ){ |
| 2392 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-answer-prefix">' . $value_prefix . '</div>'; |
| 2393 |
} |
| 2394 |
|
| 2395 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-input-box">'; |
| 2396 |
|
| 2397 |
$content[] = '<input class=" |
| 2398 |
' . $minimal_class . ' |
| 2399 |
' . |
| 2400 |
$this->html_class_prefix . 'remove-default-border ' . |
| 2401 |
$this->html_class_prefix . 'question-input ' . |
| 2402 |
$survey_question_limit_length_class . |
| 2403 |
$this->html_class_prefix . 'input |
| 2404 |
' . $this->html_class_prefix . 'answer-text-inputs" type="text" style="min-height: 24px;" |
| 2405 |
placeholder="'. __( $survey_input_type_placeholder, "survey-maker" ) .'" |
| 2406 |
name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . '][answer]" autocomplete="off">'; |
| 2407 |
|
| 2408 |
if( ! $minimal_theme ){ |
| 2409 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline"></div>'; |
| 2410 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation"></div>'; |
| 2411 |
} |
| 2412 |
|
| 2413 |
$content[] = '</div>'; |
| 2414 |
if( $value_suffix != "" ){ |
| 2415 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-answer-suffix">' . $value_suffix . '</div>'; |
| 2416 |
} |
| 2417 |
|
| 2418 |
$content[] = '</div>'; |
| 2419 |
|
| 2420 |
if($limit_checker){ |
| 2421 |
$content[] .= '<div class="'.$this->html_class_prefix.'question-text-conteiner">'; |
| 2422 |
$content[] .= '<div class="'.$this->html_class_prefix.'question-text-message">'; |
| 2423 |
$content[] .= '<span class="'.$this->html_class_prefix.'question-text-message-span">'. $limit_length . '</span> ' . $limit_by; |
| 2424 |
$content[] .= '</div>'; |
| 2425 |
$content[] .= '</div>'; |
| 2426 |
} |
| 2427 |
|
| 2428 |
$content[] = '</div>'; |
| 2429 |
|
| 2430 |
$content = implode( '', $content ); |
| 2431 |
|
| 2432 |
return $content; |
| 2433 |
} |
| 2434 |
|
| 2435 |
public function ays_survey_question_type_NUMBER_html( $question ){ |
| 2436 |
$content = array(); |
| 2437 |
// Input types placeholders |
| 2438 |
$survey_input_type_placeholder = isset($question['options']['placeholder']) && $question['options']['placeholder'] != "" ? $question['options']['placeholder'] : ''; |
| 2439 |
|
| 2440 |
$enable_value_prefix = $question['options']['enable_value_prefix']; |
| 2441 |
$value_prefix = $enable_value_prefix ? stripslashes(sanitize_text_field($question['options']['value_prefix'])) : ''; |
| 2442 |
|
| 2443 |
$enable_value_suffix = $question['options']['enable_value_suffix']; |
| 2444 |
$value_suffix = $enable_value_suffix ? stripslashes(sanitize_text_field($question['options']['value_suffix'])) : ''; |
| 2445 |
|
| 2446 |
$answer_box_prefix_suffix_css_class = ""; |
| 2447 |
$answer_container_prefix_suffix_css_class = ""; |
| 2448 |
if( $value_prefix != "" || $value_suffix != "" ){ |
| 2449 |
$answer_box_prefix_suffix_css_class = $this->html_class_prefix . 'question-box-text-types-prefix-suffix'; |
| 2450 |
} |
| 2451 |
$answer_container_prefix_suffix_css_class = $this->html_class_prefix . 'answer-box-text-types-prefix-suffix'; |
| 2452 |
|
| 2453 |
$enable_number_limit = isset($question['options']['enable_number_limitation']) && $question['options']['enable_number_limitation'] == "on" ? true : false; |
| 2454 |
$enable_number_limit_message = isset($question['options']['enable_number_error_message']) && $question['options']['enable_number_error_message'] == "on" ? true : false; |
| 2455 |
$number_limit_message = isset($question['options']['number_error_message']) && $question['options']['number_error_message'] != "" ? stripslashes(esc_attr($question['options']['number_error_message'])) : ""; |
| 2456 |
|
| 2457 |
$show_limit = isset($question['options']['enable_number_limit_counter']) && $question['options']['enable_number_limit_counter'] == "on" ? true : false; |
| 2458 |
$limit_length = isset($question['options']['number_limit_length']) && $question['options']['number_limit_length'] != "" ? $question['options']['number_limit_length'] : ""; |
| 2459 |
$limit_by = "Character"; |
| 2460 |
$limit_checker = false; |
| 2461 |
// $survey_question_limit_length_class = ''; |
| 2462 |
|
| 2463 |
$number_limit_class = ""; |
| 2464 |
if($enable_number_limit){ |
| 2465 |
if($show_limit){ |
| 2466 |
$limit_checker = true; |
| 2467 |
} |
| 2468 |
$number_limit_class = $this->html_class_prefix . 'check-number-limit '; |
| 2469 |
} |
| 2470 |
|
| 2471 |
if(intval($limit_length) > 0){ |
| 2472 |
$limit_by .= "s "; |
| 2473 |
} |
| 2474 |
|
| 2475 |
$limit_by .= __("left", "survey-maker"); |
| 2476 |
if(intval($limit_length) <= 0){ |
| 2477 |
$limit_by = ''; |
| 2478 |
} |
| 2479 |
|
| 2480 |
$minimal_theme = $this->options[ $this->name_prefix . 'is_minimal' ] ? true : false; |
| 2481 |
$minimal_class = $this->html_class_prefix . 'remove-default-border ' . $this->html_class_prefix . 'question-input'; |
| 2482 |
if( $minimal_theme ){ |
| 2483 |
$minimal_class = $this->html_class_prefix . "minimal-theme-textarea-input"; |
| 2484 |
} |
| 2485 |
|
| 2486 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer '. $answer_container_prefix_suffix_css_class .'">'; |
| 2487 |
|
| 2488 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-box '. $answer_box_prefix_suffix_css_class .'">'; |
| 2489 |
if( $value_prefix != "" ){ |
| 2490 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-answer-prefix">' . $value_prefix . '</div>'; |
| 2491 |
} |
| 2492 |
|
| 2493 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-input-box">'; |
| 2494 |
|
| 2495 |
$content[] = '<input class=" |
| 2496 |
' . $minimal_class . ' |
| 2497 |
' . |
| 2498 |
$this->html_class_prefix . 'remove-default-border ' . |
| 2499 |
$this->html_class_prefix . 'question-input ' . |
| 2500 |
$number_limit_class . |
| 2501 |
$this->html_class_prefix . 'input" type="number" step="any" style="min-height: 24px;" |
| 2502 |
placeholder="'. __( $survey_input_type_placeholder, "survey-maker" ) .'" |
| 2503 |
name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . '][answer]" autocomplete="off">'; |
| 2504 |
if( ! $minimal_theme ){ |
| 2505 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline"></div>'; |
| 2506 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation"></div>'; |
| 2507 |
} |
| 2508 |
|
| 2509 |
$content[] = '</div>'; |
| 2510 |
|
| 2511 |
if( $value_suffix != "" ){ |
| 2512 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-answer-suffix">' . $value_suffix . '</div>'; |
| 2513 |
} |
| 2514 |
|
| 2515 |
$content[] = '</div>'; |
| 2516 |
|
| 2517 |
if($enable_number_limit_message){ |
| 2518 |
$content[] = '<div class="' . $this->html_class_prefix . 'number-limit-message-box ' . $this->html_class_prefix . 'question-text-error-message" style="display: none;">'; |
| 2519 |
$content[] = '<span class="' . $this->html_class_prefix . 'number-limit-message-text">'; |
| 2520 |
$content[] = $number_limit_message; |
| 2521 |
$content[] = '</span>'; |
| 2522 |
$content[] = '</div>'; |
| 2523 |
} |
| 2524 |
if($limit_checker){ |
| 2525 |
$content[] .= '<div class="'.$this->html_class_prefix.'question-text-conteiner">'; |
| 2526 |
$content[] .= '<div class="'.$this->html_class_prefix.'question-text-message">'; |
| 2527 |
$content[] .= '<span class="'.$this->html_class_prefix.'question-text-message-span">'. $limit_length . '</span> ' . $limit_by; |
| 2528 |
$content[] .= '</div>'; |
| 2529 |
$content[] .= '</div>'; |
| 2530 |
} |
| 2531 |
|
| 2532 |
$content[] = '</div>'; |
| 2533 |
|
| 2534 |
$content = implode( '', $content ); |
| 2535 |
|
| 2536 |
return $content; |
| 2537 |
} |
| 2538 |
|
| 2539 |
|
| 2540 |
public function ays_survey_question_type_PHONE_html( $question ){ |
| 2541 |
$content = array(); |
| 2542 |
// Input types placeholders |
| 2543 |
$survey_input_type_placeholder = isset($question['options']['placeholder']) && $question['options']['placeholder'] != "" ? $question['options']['placeholder'] : ''; |
| 2544 |
|
| 2545 |
$enable_value_prefix = $question['options']['enable_value_prefix']; |
| 2546 |
$value_prefix = $enable_value_prefix ? stripslashes(sanitize_text_field($question['options']['value_prefix'])) : ''; |
| 2547 |
|
| 2548 |
$enable_value_suffix = $question['options']['enable_value_suffix']; |
| 2549 |
$value_suffix = $enable_value_suffix ? stripslashes(sanitize_text_field($question['options']['value_suffix'])) : ''; |
| 2550 |
|
| 2551 |
$answer_box_prefix_suffix_css_class = ""; |
| 2552 |
$answer_container_prefix_suffix_css_class = ""; |
| 2553 |
if( $value_prefix != "" || $value_suffix != "" ){ |
| 2554 |
$answer_box_prefix_suffix_css_class = $this->html_class_prefix . 'question-box-text-types-prefix-suffix'; |
| 2555 |
} |
| 2556 |
$answer_container_prefix_suffix_css_class = $this->html_class_prefix . 'answer-box-text-types-prefix-suffix'; |
| 2557 |
|
| 2558 |
//Input types value |
| 2559 |
$enable_url_parameter = isset($question['options']['enable_url_parameter']) && $question['options']['enable_url_parameter'] == true ? true : false; |
| 2560 |
$url_parameter = $enable_url_parameter && isset($question['options']['url_parameter']) && $question['options']['url_parameter'] != "" ? $question['options']['url_parameter'] : ''; |
| 2561 |
$survey_input_type_value = isset($_GET[$url_parameter]) && $_GET[$url_parameter] ? $_GET[$url_parameter] : ''; |
| 2562 |
|
| 2563 |
$enable_number_limit = isset($question['options']['enable_number_limitation']) && $question['options']['enable_number_limitation'] == "on" ? true : false; |
| 2564 |
$enable_number_limit_message = isset($question['options']['enable_number_error_message']) && $question['options']['enable_number_error_message'] == "on" ? true : false; |
| 2565 |
$number_limit_message = isset($question['options']['number_error_message']) && $question['options']['number_error_message'] != "" ? stripslashes(esc_attr($question['options']['number_error_message'])) : ""; |
| 2566 |
$show_limit = isset($question['options']['enable_number_limit_counter']) && $question['options']['enable_number_limit_counter'] == "on" ? true : false; |
| 2567 |
$limit_length = isset($question['options']['number_limit_length']) && $question['options']['number_limit_length'] != "" ? $question['options']['number_limit_length'] : ""; |
| 2568 |
$limit_by = "Character"; |
| 2569 |
$limit_checker = false; |
| 2570 |
|
| 2571 |
$number_limit_class = $this->html_class_prefix . 'is-phone-type '; |
| 2572 |
if($enable_number_limit){ |
| 2573 |
if($show_limit){ |
| 2574 |
$limit_checker = true; |
| 2575 |
} |
| 2576 |
|
| 2577 |
$number_limit_class .= $this->html_class_prefix . 'check-number-limit '; |
| 2578 |
} |
| 2579 |
|
| 2580 |
if(intval($limit_length) > 0){ |
| 2581 |
$limit_by .= "s "; |
| 2582 |
} |
| 2583 |
|
| 2584 |
$limit_by .= __("left", "survey-maker"); |
| 2585 |
if(intval($limit_length) <= 0){ |
| 2586 |
$limit_by = ''; |
| 2587 |
} |
| 2588 |
|
| 2589 |
$minimal_theme = $this->options[ $this->name_prefix . 'is_minimal' ] ? true : false; |
| 2590 |
$minimal_class = $this->html_class_prefix . 'remove-default-border ' . $this->html_class_prefix . 'question-input'; |
| 2591 |
if( $minimal_theme ){ |
| 2592 |
$minimal_class = $this->html_class_prefix . "minimal-theme-textarea-input"; |
| 2593 |
} |
| 2594 |
|
| 2595 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer '. $answer_container_prefix_suffix_css_class .'">'; |
| 2596 |
|
| 2597 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-box ' . $this->html_class_prefix . 'question-box-text-types-short '. $answer_box_prefix_suffix_css_class .'">'; |
| 2598 |
if( $value_prefix != "" ){ |
| 2599 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-answer-prefix">' . $value_prefix . '</div>'; |
| 2600 |
} |
| 2601 |
|
| 2602 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-input-box">'; |
| 2603 |
|
| 2604 |
$content[] = '<input class="' . $minimal_class . ' '.$number_limit_class.' ' . $this->html_class_prefix . 'answer-text-inputs ' . $this->html_class_prefix . 'answer-text-inputs-default" type="text" tabindex="0" step="any" style="min-height: 24px;" |
| 2605 |
placeholder="'. __( $survey_input_type_placeholder, "survey-maker" ) .'" |
| 2606 |
name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . '][answer]" |
| 2607 |
value="' . __( $survey_input_type_value, "survey-maker" ) . '">'; |
| 2608 |
|
| 2609 |
if( ! $minimal_theme ){ |
| 2610 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline"></div>'; |
| 2611 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation"></div>'; |
| 2612 |
} |
| 2613 |
|
| 2614 |
$content[] = '</div>'; |
| 2615 |
|
| 2616 |
if( $value_suffix != "" ){ |
| 2617 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-answer-suffix">' . $value_suffix . '</div>'; |
| 2618 |
} |
| 2619 |
|
| 2620 |
$content[] = '</div>'; |
| 2621 |
|
| 2622 |
if($enable_number_limit_message){ |
| 2623 |
$content[] = '<div class="' . $this->html_class_prefix . 'number-limit-message-box ' . $this->html_class_prefix . 'question-text-error-message" style="display: none;">'; |
| 2624 |
$content[] = '<span class="' . $this->html_class_prefix . 'number-limit-message-text">'; |
| 2625 |
$content[] = $number_limit_message; |
| 2626 |
$content[] = '</span>'; |
| 2627 |
$content[] = '</div>'; |
| 2628 |
} |
| 2629 |
|
| 2630 |
if($limit_checker){ |
| 2631 |
$content[] .= '<div class="'.$this->html_class_prefix.'question-text-conteiner">'; |
| 2632 |
$content[] .= '<div class="'.$this->html_class_prefix.'question-text-message">'; |
| 2633 |
$content[] .= '<span class="'.$this->html_class_prefix.'question-text-message-span">'. $limit_length . '</span> ' . $limit_by; |
| 2634 |
$content[] .= '</div>'; |
| 2635 |
$content[] .= '</div>'; |
| 2636 |
} |
| 2637 |
|
| 2638 |
$content[] = '</div>'; |
| 2639 |
|
| 2640 |
$content = implode( '', $content ); |
| 2641 |
|
| 2642 |
return $content; |
| 2643 |
} |
| 2644 |
|
| 2645 |
public function ays_survey_question_type_DATE_html( $question ){ |
| 2646 |
$content = array(); |
| 2647 |
|
| 2648 |
$minimal_theme = $this->options[ $this->name_prefix . 'is_minimal' ] ? true : false; |
| 2649 |
$minimal_class = $this->html_class_prefix . 'remove-default-border ' . $this->html_class_prefix . 'question-date-input ' . $this->html_class_prefix . 'question-input'; |
| 2650 |
if( $minimal_theme ){ |
| 2651 |
$minimal_class = $this->html_class_prefix . "minimal-theme-textarea-input " . $this->html_class_prefix."minimal-theme-input-date"; |
| 2652 |
} |
| 2653 |
|
| 2654 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer">'; |
| 2655 |
|
| 2656 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-box ' . $this->html_class_prefix . 'question-date-box">'; |
| 2657 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-input-box ' . $this->html_class_prefix . 'question-date-input-box">'; |
| 2658 |
|
| 2659 |
$content[] = '<input type="date" class="' . $minimal_class . ' ' . $this->html_class_prefix . 'input" type="text" name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . '][answer]" tabindex="0">'; |
| 2660 |
|
| 2661 |
$content[] = '</div>'; |
| 2662 |
$content[] = '</div>'; |
| 2663 |
|
| 2664 |
$content[] = '</div>'; |
| 2665 |
|
| 2666 |
$content = implode( '', $content ); |
| 2667 |
|
| 2668 |
return $content; |
| 2669 |
} |
| 2670 |
|
| 2671 |
public function ays_survey_question_type_TIME_html( $question ){ |
| 2672 |
$content = array(); |
| 2673 |
|
| 2674 |
// $minimal_theme = $this->options[ $this->name_prefix . 'is_minimal' ] ? true : false; |
| 2675 |
$minimal_class = $this->html_class_prefix . 'remove-default-border ' . $this->html_class_prefix . 'question-date-input ' . $this->html_class_prefix . 'question-input'; |
| 2676 |
// if( $minimal_theme ){ |
| 2677 |
// $minimal_class = $this->html_class_prefix . "minimal-theme-textarea-input " . $this->html_class_prefix."minimal-theme-input-date"; |
| 2678 |
// } |
| 2679 |
|
| 2680 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer">'; |
| 2681 |
|
| 2682 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-box ' . $this->html_class_prefix . 'question-time-box">'; |
| 2683 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-input-box ' . $this->html_class_prefix . 'question-time-input-box">'; |
| 2684 |
|
| 2685 |
$content[] = '<input class="' . $minimal_class . ' ' . $this->html_class_prefix . 'input ays-survey-timepicker" name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . '][answer]" placeholder="00:00" tabindex="0">'; |
| 2686 |
|
| 2687 |
// if( ! $minimal_theme ){ |
| 2688 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline"></div>'; |
| 2689 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation"></div>'; |
| 2690 |
// } |
| 2691 |
|
| 2692 |
$content[] = '</div>'; |
| 2693 |
$content[] = '</div>'; |
| 2694 |
|
| 2695 |
$content[] = '</div>'; |
| 2696 |
|
| 2697 |
$content = implode( '', $content ); |
| 2698 |
|
| 2699 |
return $content; |
| 2700 |
} |
| 2701 |
|
| 2702 |
public function ays_survey_question_type_DATE_TIME_html( $question ){ |
| 2703 |
$content = array(); |
| 2704 |
|
| 2705 |
$minimal_class = $this->html_class_prefix . 'remove-default-border ' . $this->html_class_prefix . 'question-date-input ' . $this->html_class_prefix . 'question-input'; |
| 2706 |
|
| 2707 |
$minimal_theme = $this->options[ $this->name_prefix . 'is_minimal' ] ? true : false; |
| 2708 |
$minimal_date_class = $this->html_class_prefix . 'remove-default-border ' . $this->html_class_prefix . 'question-date-input ' . $this->html_class_prefix . 'question-input'; |
| 2709 |
if( $minimal_theme ){ |
| 2710 |
$minimal_date_class = $this->html_class_prefix . "minimal-theme-textarea-input " . $this->html_class_prefix."minimal-theme-input-date"; |
| 2711 |
} |
| 2712 |
|
| 2713 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer ' . $this->html_class_prefix . 'date-and-time-answer">'; |
| 2714 |
|
| 2715 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-box ' . $this->html_class_prefix . 'question-date-time-box">'; |
| 2716 |
$content[] = '<div class="' . $this->html_class_prefix . 'date-time-inner-box">'; |
| 2717 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-input-box ' . $this->html_class_prefix . 'question-date-input-box">'; |
| 2718 |
|
| 2719 |
$content[] = '<input type="date" class="' . $minimal_date_class . ' ' . $this->html_class_prefix . 'input" type="text" |
| 2720 |
name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . '][answer][date]">'; |
| 2721 |
|
| 2722 |
if( ! $minimal_theme ){ |
| 2723 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline"></div>'; |
| 2724 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation"></div>'; |
| 2725 |
} |
| 2726 |
|
| 2727 |
$content[] = '</div>'; |
| 2728 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-input-box ' . $this->html_class_prefix . 'question-time-input-box">'; |
| 2729 |
|
| 2730 |
$content[] = '<input class="' . $minimal_class . ' ' . $this->html_class_prefix . 'input ays-survey-timepicker" name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . '][answer][time]" placeholder="00:00" tabindex="0">'; |
| 2731 |
|
| 2732 |
// if( ! $minimal_theme ){ |
| 2733 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline"></div>'; |
| 2734 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation"></div>'; |
| 2735 |
// } |
| 2736 |
|
| 2737 |
$content[] = '</div>'; |
| 2738 |
$content[] = '</div>'; |
| 2739 |
$content[] = '</div>'; |
| 2740 |
|
| 2741 |
$content[] = '</div>'; |
| 2742 |
|
| 2743 |
$content = implode( '', $content ); |
| 2744 |
|
| 2745 |
return $content; |
| 2746 |
} |
| 2747 |
|
| 2748 |
|
| 2749 |
public function ays_survey_question_type_EMAIL_html( $question ){ |
| 2750 |
$content = array(); |
| 2751 |
// Input types placeholders |
| 2752 |
$survey_input_type_placeholder = isset($question['options']['placeholder']) && $question['options']['placeholder'] != "" ? $question['options']['placeholder'] : ''; |
| 2753 |
|
| 2754 |
$minimal_theme = $this->options[ $this->name_prefix . 'is_minimal' ] ? true : false; |
| 2755 |
$minimal_class = $this->html_class_prefix . 'remove-default-border ' . $this->html_class_prefix . 'question-email-input ' . $this->html_class_prefix . 'question-input'; |
| 2756 |
if( $minimal_theme ){ |
| 2757 |
$minimal_class = $this->html_class_prefix . "minimal-theme-textarea-input " . $this->html_class_prefix . "question-email-input"; |
| 2758 |
} |
| 2759 |
|
| 2760 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer">'; |
| 2761 |
|
| 2762 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-box">'; |
| 2763 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-input-box">'; |
| 2764 |
|
| 2765 |
$content[] = '<input class=" |
| 2766 |
' . $minimal_class . ' |
| 2767 |
' . |
| 2768 |
$this->html_class_prefix . 'remove-default-border ' . |
| 2769 |
$this->html_class_prefix . 'question-email-input ' . |
| 2770 |
$this->html_class_prefix . 'question-input ' . |
| 2771 |
$this->html_class_prefix . 'input" type="text" style="min-height: 24px;" |
| 2772 |
placeholder="'. __( $survey_input_type_placeholder, "survey-maker" ) .'" |
| 2773 |
name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . '][answer]" autocomplete="off">'; |
| 2774 |
if( true ){ |
| 2775 |
$content[] = '<input type="hidden" name="' . $this->html_name_prefix . 'user-email-' . $this->unique_id . '" value="' . $question['id'] . '" >'; |
| 2776 |
} |
| 2777 |
|
| 2778 |
if( ! $minimal_theme ){ |
| 2779 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline"></div>'; |
| 2780 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation"></div>'; |
| 2781 |
} |
| 2782 |
|
| 2783 |
$content[] = '</div>'; |
| 2784 |
$content[] = '</div>'; |
| 2785 |
|
| 2786 |
$content[] = '</div>'; |
| 2787 |
|
| 2788 |
$content = implode( '', $content ); |
| 2789 |
|
| 2790 |
return $content; |
| 2791 |
} |
| 2792 |
|
| 2793 |
public function ays_survey_question_type_NAME_html( $question ){ |
| 2794 |
$content = array(); |
| 2795 |
// Input types placeholders |
| 2796 |
$survey_input_type_placeholder = isset($question['options']['placeholder']) && $question['options']['placeholder'] != "" ? $question['options']['placeholder'] : ''; |
| 2797 |
|
| 2798 |
$minimal_theme = $this->options[ $this->name_prefix . 'is_minimal' ] ? true : false; |
| 2799 |
$minimal_class = $this->html_class_prefix . 'remove-default-border ' . $this->html_class_prefix . 'question-input'; |
| 2800 |
if( $minimal_theme ){ |
| 2801 |
$minimal_class = $this->html_class_prefix . "minimal-theme-textarea-input"; |
| 2802 |
} |
| 2803 |
|
| 2804 |
$content[] = '<div class="' . $this->html_class_prefix . 'answer">'; |
| 2805 |
|
| 2806 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-box">'; |
| 2807 |
$content[] = '<div class="' . $this->html_class_prefix . 'question-input-box">'; |
| 2808 |
|
| 2809 |
$content[] = '<input class=" |
| 2810 |
' . $minimal_class . ' |
| 2811 |
' . |
| 2812 |
$this->html_class_prefix . 'remove-default-border ' . |
| 2813 |
$this->html_class_prefix . 'question-input ' . |
| 2814 |
$this->html_class_prefix . 'input |
| 2815 |
' . $this->html_class_prefix . 'answer-text-inputs" type="text" style="min-height: 24px;" |
| 2816 |
placeholder="'. __( $survey_input_type_placeholder, "survey-maker" ) .'" |
| 2817 |
name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . '][answer]" autocomplete="off">'; |
| 2818 |
|
| 2819 |
if( true ){ |
| 2820 |
$content[] = '<input type="hidden" name="' . $this->html_name_prefix . 'user-name-' . $this->unique_id . '" value="' . $question['id'] . '" >'; |
| 2821 |
} |
| 2822 |
|
| 2823 |
if( ! $minimal_theme ){ |
| 2824 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline"></div>'; |
| 2825 |
$content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation"></div>'; |
| 2826 |
} |
| 2827 |
|
| 2828 |
$content[] = '</div>'; |
| 2829 |
$content[] = '</div>'; |
| 2830 |
|
| 2831 |
$content[] = '</div>'; |
| 2832 |
|
| 2833 |
$content = implode( '', $content ); |
| 2834 |
|
| 2835 |
return $content; |
| 2836 |
} |
| 2837 |
|
| 2838 |
public function create_restricted_content( $limit_message ){ |
| 2839 |
|
| 2840 |
$content = array(); |
| 2841 |
$content[] = '<div class="' . $this->html_class_prefix . 'section ' . $this->html_class_prefix . 'restricted-content active-section">'; |
| 2842 |
|
| 2843 |
$content[] = '<div class="' . $this->html_class_prefix . 'section-header">'; |
| 2844 |
|
| 2845 |
$content[] = $limit_message; |
| 2846 |
|
| 2847 |
$content[] = '</div>'; |
| 2848 |
|
| 2849 |
$content[] = '</div>'; |
| 2850 |
|
| 2851 |
$content = implode( '', $content ); |
| 2852 |
|
| 2853 |
return $content; |
| 2854 |
} |
| 2855 |
|
| 2856 |
public function get_styles(){ |
| 2857 |
|
| 2858 |
$content = array(); |
| 2859 |
$content[] = '<style type="text/css">'; |
| 2860 |
|
| 2861 |
|
| 2862 |
$question_image_width = '100%'; |
| 2863 |
if( $this->options[ $this->name_prefix . 'question_image_width' ] != '' ){ |
| 2864 |
$question_image_width = $this->options[ $this->name_prefix . 'question_image_width' ] . 'px'; |
| 2865 |
} |
| 2866 |
|
| 2867 |
$question_image_height = 'auto'; |
| 2868 |
if( $this->options[ $this->name_prefix . 'question_image_height' ] != '' ){ |
| 2869 |
$question_image_height = $this->options[ $this->name_prefix . 'question_image_height' ] . 'px'; |
| 2870 |
} |
| 2871 |
|
| 2872 |
$survey_title_box_shadow_class = ''; |
| 2873 |
if( isset($this->options[ $this->name_prefix . 'title_box_shadow_enable' ]) && $this->options[ $this->name_prefix . 'title_box_shadow_enable' ] ){ |
| 2874 |
$survey_title_text_shadow_params = $this->options[ $this->name_prefix . 'title_text_shadow_x_offset' ].'px '.$this->options[ $this->name_prefix . 'title_text_shadow_y_offset' ].'px '.$this->options[ $this->name_prefix . 'title_text_shadow_z_offset' ].'px'; |
| 2875 |
$survey_title_box_shadow_class = 'text-shadow : '.$survey_title_text_shadow_params.' '.$this->options[ $this->name_prefix . 'title_box_shadow_color' ].';'; |
| 2876 |
} |
| 2877 |
|
| 2878 |
$survey_pagination_positioning = isset($this->options[ $this->name_prefix . 'pagination_positioning' ]) ? $this->options[ $this->name_prefix . 'pagination_positioning' ] : 'none'; |
| 2879 |
$pagination_positioning = "row"; |
| 2880 |
$pagination_number_height = ""; |
| 2881 |
switch ($survey_pagination_positioning) { |
| 2882 |
case 'none': |
| 2883 |
$pagination_positioning = "row"; |
| 2884 |
break; |
| 2885 |
case 'reverse': |
| 2886 |
$pagination_positioning = "row-reverse"; |
| 2887 |
break; |
| 2888 |
case 'column': |
| 2889 |
$pagination_positioning = "column"; |
| 2890 |
$pagination_number_height = "line-height: 1;"; |
| 2891 |
break; |
| 2892 |
case 'column_reverse': |
| 2893 |
$pagination_positioning = "column-reverse"; |
| 2894 |
$pagination_number_height = "line-height: 1;"; |
| 2895 |
break; |
| 2896 |
default: |
| 2897 |
$pagination_positioning = "row"; |
| 2898 |
$pagination_number_height = ""; |
| 2899 |
break; |
| 2900 |
} |
| 2901 |
|
| 2902 |
$filtered_survey_color = Survey_Maker_Data::rgb2hex( $this->options[ $this->name_prefix . 'color' ] ); |
| 2903 |
|
| 2904 |
$width = $this->options[ $this->name_prefix . 'width' ]; |
| 2905 |
$width_by = $this->options[ $this->name_prefix . 'width_by_percentage_px' ]; |
| 2906 |
|
| 2907 |
$mobile_width = $this->options[ $this->name_prefix . 'mobile_width' ]; |
| 2908 |
$mobile_width_by = $this->options[ $this->name_prefix . 'mobile_width_by_percent_px' ]; |
| 2909 |
$mobile_max_width = $this->options[ $this->name_prefix . 'mobile_max_width' ]; |
| 2910 |
|
| 2911 |
if( absint( $width ) == 0 ){ |
| 2912 |
$width = '100'; |
| 2913 |
$width_by = 'percentage'; |
| 2914 |
} |
| 2915 |
|
| 2916 |
if( absint( $mobile_width ) == 0 ){ |
| 2917 |
$mobile_width = '100'; |
| 2918 |
$mobile_width_by = 'percentage'; |
| 2919 |
} |
| 2920 |
|
| 2921 |
if( absint( $mobile_max_width ) > 0 ){ |
| 2922 |
$mobile_max_width .= '%'; |
| 2923 |
}else{ |
| 2924 |
$mobile_max_width = '95%'; |
| 2925 |
} |
| 2926 |
|
| 2927 |
switch( $width_by ){ |
| 2928 |
case 'percentage': |
| 2929 |
$width .= '%'; |
| 2930 |
break; |
| 2931 |
case 'pixels': |
| 2932 |
$width .= 'px'; |
| 2933 |
break; |
| 2934 |
default: |
| 2935 |
$width .= '%'; |
| 2936 |
break; |
| 2937 |
} |
| 2938 |
|
| 2939 |
switch( $mobile_width_by ){ |
| 2940 |
case 'percentage': |
| 2941 |
$mobile_width .= '%'; |
| 2942 |
break; |
| 2943 |
case 'pixels': |
| 2944 |
$mobile_width .= 'px'; |
| 2945 |
break; |
| 2946 |
default: |
| 2947 |
$mobile_width .= '%'; |
| 2948 |
break; |
| 2949 |
} |
| 2950 |
|
| 2951 |
switch($this->options[ $this->name_prefix . 'logo_image_position' ]){ |
| 2952 |
case "right": |
| 2953 |
$survey_logo_image_position = "right: 5px;"; |
| 2954 |
break; |
| 2955 |
case "left": |
| 2956 |
$survey_logo_image_position = "left: 5px;"; |
| 2957 |
break; |
| 2958 |
case "center": |
| 2959 |
$survey_logo_image_position = "left: 50%;"; |
| 2960 |
break; |
| 2961 |
default: |
| 2962 |
$survey_logo_image_position = "right: 5px;"; |
| 2963 |
break; |
| 2964 |
} |
| 2965 |
|
| 2966 |
switch($this->options[ $this->name_prefix . 'start_page_button_pos' ]){ |
| 2967 |
case "left": |
| 2968 |
$survey_start_page_button_pos = 'justify-content: flex-start;'; |
| 2969 |
break; |
| 2970 |
case "center": |
| 2971 |
$survey_start_page_button_pos = 'justify-content: center;'; |
| 2972 |
break; |
| 2973 |
case "right": |
| 2974 |
$survey_start_page_button_pos = 'justify-content: flex-end;'; |
| 2975 |
break; |
| 2976 |
} |
| 2977 |
|
| 2978 |
$answers_list_width = "width:initial;"; |
| 2979 |
$answers_list_direction = ""; |
| 2980 |
if($this->options[ $this->name_prefix . 'answers_view_alignment' ] == 'center' && $this->options[ $this->name_prefix . 'answers_view' ] == 'list'){ |
| 2981 |
$answers_list_width = "width:50%;"; |
| 2982 |
$answers_list_direction = "flex-direction: column;"; |
| 2983 |
} |
| 2984 |
|
| 2985 |
$other_answer_box_width = ""; |
| 2986 |
if($this->options[ $this->name_prefix . 'answers_view_alignment' ] == 'flex-start' && $this->options[ $this->name_prefix . 'answers_view' ] == 'list'){ |
| 2987 |
$other_answer_box_width = "width: 100%;"; |
| 2988 |
} |
| 2989 |
|
| 2990 |
$answers_grid_min_width = ''; |
| 2991 |
if($this->options[ $this->name_prefix . 'answers_view_alignment' ] == 'flex-start' && $this->options[ $this->name_prefix . 'answers_view' ] == 'grid'){ |
| 2992 |
$answers_grid_min_width = "min-width: 50%;"; |
| 2993 |
} |
| 2994 |
|
| 2995 |
// Question padding |
| 2996 |
$question_padding = $this->options[ $this->name_prefix . 'question_padding' ]; |
| 2997 |
$question_border_radius = $this->options[ $this->name_prefix . 'question_border_radius' ]; |
| 2998 |
|
| 2999 |
$content[] = ' |
| 3000 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' { |
| 3001 |
width: ' . $width . '; |
| 3002 |
} |
| 3003 |
|
| 3004 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-header { |
| 3005 |
border-top-color: ' . $this->options[ $this->name_prefix . 'color' ] . ' !important; |
| 3006 |
} |
| 3007 |
|
| 3008 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question { |
| 3009 |
border-left-color: ' . $this->options[ $this->name_prefix . 'color' ] . ' !important; |
| 3010 |
} |
| 3011 |
|
| 3012 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-header, |
| 3013 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-terms-and-conditions-container, |
| 3014 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question { |
| 3015 |
background-color: ' . $this->options[ $this->name_prefix . 'background_color' ] . '; |
| 3016 |
} |
| 3017 |
|
| 3018 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section.' . $this->html_class_prefix . 'section-start-page .' . $this->html_class_prefix . 'section-header { |
| 3019 |
background-color: ' . $this->options[ $this->name_prefix . 'start_page_background_color' ] . '; |
| 3020 |
color: ' . $this->options[ $this->name_prefix . 'start_page_text_color' ] . '; |
| 3021 |
} |
| 3022 |
|
| 3023 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section.' . $this->html_class_prefix . 'section-start-page .' . $this->html_class_prefix . 'section-header *, |
| 3024 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section.' . $this->html_class_prefix . 'section-start-page .' . $this->html_class_prefix . 'section-header .' . $this->html_class_prefix . 'section-title-row { |
| 3025 |
color: ' . $this->options[ $this->name_prefix . 'start_page_text_color' ] . '; |
| 3026 |
} |
| 3027 |
|
| 3028 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section.' . $this->html_class_prefix . 'section-start-page .' . $this->html_class_prefix . 'section-header .' . $this->html_class_prefix . 'section-title-row { |
| 3029 |
justify-content: ' . $this->options[ $this->name_prefix . 'start_page_title_pos' ] . '; |
| 3030 |
} |
| 3031 |
|
| 3032 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-start-page .' . $this->html_class_prefix . 'section-buttons { |
| 3033 |
display: flex; |
| 3034 |
'.$survey_start_page_button_pos.' |
| 3035 |
} |
| 3036 |
|
| 3037 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question { |
| 3038 |
' . ( $this->options[ $this->name_prefix . 'logo' ] != '' ? 'padding: '.$question_padding.'px '.$question_padding.'px 0 '.$question_padding.'px;' : 'padding: '.$question_padding.'px;' ) . ' |
| 3039 |
' . ( $this->options[ $this->name_prefix . 'logo' ] != '' ? 'padding-bottom: 50px;' : '' ) . ' |
| 3040 |
border-radius: ' . $question_border_radius . 'px; |
| 3041 |
} |
| 3042 |
|
| 3043 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' input.' . $this->html_class_prefix . 'question-input { |
| 3044 |
font-size: ' . $this->options[ $this->name_prefix . 'answer_font_size' ] . 'px; |
| 3045 |
letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing' ] . 'px; |
| 3046 |
font-weight: normal; |
| 3047 |
} |
| 3048 |
|
| 3049 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' textarea.' . $this->html_class_prefix . 'question-input { |
| 3050 |
letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing' ] . 'px; |
| 3051 |
} |
| 3052 |
|
| 3053 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' input.' . $this->html_class_prefix . 'question-input ~ .' . $this->html_class_prefix . 'input-underline, |
| 3054 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' input.' . $this->html_class_prefix . 'question-input ~ .' . $this->html_class_prefix . 'input-underline-animation, |
| 3055 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'simple-button-container, |
| 3056 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container, |
| 3057 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label-content > span, |
| 3058 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-select.dropdown div.item, |
| 3059 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'thank-you-page, |
| 3060 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'loader-with-text, |
| 3061 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'restricted-message, |
| 3062 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-desc, |
| 3063 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-questions-count, |
| 3064 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-terms-and-conditions-container, |
| 3065 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-title, |
| 3066 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-title-row, |
| 3067 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'thank-you-page > div p { |
| 3068 |
color: ' . $this->options[ $this->name_prefix . 'text_color' ] . '; |
| 3069 |
font-weight: normal; |
| 3070 |
}'; |
| 3071 |
$content[] = ' |
| 3072 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label input[type="checkbox"] ~ .' . $this->html_class_prefix . 'answer-label-content .' . $this->html_class_prefix . 'answer-icon-content .' . $this->html_class_prefix . 'answer-icon-content-3, |
| 3073 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label input[type="radio"] ~ .' . $this->html_class_prefix . 'answer-label-content .' . $this->html_class_prefix . 'answer-icon-content .' . $this->html_class_prefix . 'answer-icon-content-3, |
| 3074 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label input[type="checkbox"]:checked ~ .' . $this->html_class_prefix . 'answer-label-content .' . $this->html_class_prefix . 'answer-icon-content .' . $this->html_class_prefix . 'answer-icon-content-2, |
| 3075 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label input[type="radio"]:checked ~ .' . $this->html_class_prefix . 'answer-label-content .' . $this->html_class_prefix . 'answer-icon-content .' . $this->html_class_prefix . 'answer-icon-content-2, |
| 3076 |
#'.$this->html_class_prefix.'container-'.$this->unique_id_in_class.' .'.$this->html_class_prefix.'answer-label .'.$this->html_class_prefix.'answer-image-container{ |
| 3077 |
border-color:' . ( $this->options[ $this->name_prefix . 'is_modern' ] ? $this->options[ $this->name_prefix . 'buttons_bg_color' ] : $this->options[ $this->name_prefix . 'color' ] ) . '; |
| 3078 |
} |
| 3079 |
|
| 3080 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label input[type="checkbox"] ~ .' . $this->html_class_prefix . 'answer-label-content .' . $this->html_class_prefix . 'answer-icon-content .' . $this->html_class_prefix . 'answer-icon-content-2, |
| 3081 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label input[type="radio"] ~ .' . $this->html_class_prefix . 'answer-label-content .' . $this->html_class_prefix . 'answer-icon-content .' . $this->html_class_prefix . 'answer-icon-content-2 { |
| 3082 |
border-color: ' . ( $this->options[ $this->name_prefix . 'is_modern' ] ? $this->options[ $this->name_prefix . 'buttons_bg_color' ] : $this->options[ $this->name_prefix . 'text_color' ] ) . '; |
| 3083 |
} |
| 3084 |
|
| 3085 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' textarea.' . $this->html_class_prefix . 'question-input:focus ~ .' . $this->html_class_prefix . 'input-underline-animation, |
| 3086 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' input.' . $this->html_class_prefix . 'input:focus ~ .' . $this->html_class_prefix . 'input-underline-animation { |
| 3087 |
background-color: ' . ( $this->options[ $this->name_prefix . 'is_modern' ] ? $this->options[ $this->name_prefix . 'text_color' ] : $this->options[ $this->name_prefix . 'color' ] ) . '; |
| 3088 |
} |
| 3089 |
|
| 3090 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container .' . $this->html_class_prefix . 'section-button-content button.' . $this->html_class_prefix . 'section-button, |
| 3091 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container .' . $this->html_class_prefix . 'section-button-content a.' . $this->html_class_prefix . 'section-button, |
| 3092 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container .' . $this->html_class_prefix . 'section-button-content input.' . $this->html_class_prefix . 'section-button { |
| 3093 |
color: ' . $this->options[ $this->name_prefix . 'buttons_text_color' ] . '; |
| 3094 |
} |
| 3095 |
|
| 3096 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label:hover .' . $this->html_class_prefix . 'answer-icon-ink{ |
| 3097 |
background-color: ' . Survey_Maker_Data::hex2rgba( $filtered_survey_color, 0.04 ) . '; |
| 3098 |
} |
| 3099 |
|
| 3100 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container:hover .' . $this->html_class_prefix . 'section-button-content button.' . $this->html_class_prefix . 'section-button, |
| 3101 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container:hover .' . $this->html_class_prefix . 'section-button-content input.' . $this->html_class_prefix . 'section-button, |
| 3102 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container:focus .' . $this->html_class_prefix . 'section-button-content button.' . $this->html_class_prefix . 'section-button, |
| 3103 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container:focus .' . $this->html_class_prefix . 'section-button-content input.' . $this->html_class_prefix . 'section-button { |
| 3104 |
color: ' . Survey_Maker_Data::hex2rgba( $this->options[ $this->name_prefix . 'buttons_text_color' ], 0.7) . '; |
| 3105 |
background-color: ' . Survey_Maker_Data::hex2rgba( $this->options[ $this->name_prefix . 'buttons_bg_color' ] ) . '; |
| 3106 |
} |
| 3107 |
|
| 3108 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-required-icon, |
| 3109 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-title { |
| 3110 |
font-size: ' . $this->options[ $this->name_prefix . 'question_font_size' ] . 'px; |
| 3111 |
line-height: 1.5; |
| 3112 |
} |
| 3113 |
|
| 3114 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' |
| 3115 |
.' . $this->html_class_prefix . 'sections |
| 3116 |
.' . $this->html_class_prefix . 'question |
| 3117 |
.' . $this->html_class_prefix . 'question-header |
| 3118 |
.' . $this->html_class_prefix . 'question-header-content |
| 3119 |
.' . $this->html_class_prefix . 'question-title p{ |
| 3120 |
margin: 0; |
| 3121 |
color: ' . $this->options[ $this->name_prefix . 'text_color' ] . '; |
| 3122 |
}'; |
| 3123 |
$content[] = ' |
| 3124 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-title{ |
| 3125 |
padding-top: 10px; |
| 3126 |
text-align: ' . $this->options[ $this->name_prefix . 'question_title_alignment' ] . '; |
| 3127 |
} |
| 3128 |
|
| 3129 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-image { |
| 3130 |
width: ' . $question_image_width . '; |
| 3131 |
height: ' . $question_image_height . '; |
| 3132 |
object-fit: ' . $this->options[ $this->name_prefix . 'question_image_sizing' ] . '; |
| 3133 |
} |
| 3134 |
|
| 3135 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-image-caption { |
| 3136 |
text-align: ' . $this->options[ $this->name_prefix . 'question_caption_text_alignment' ] . '; |
| 3137 |
} |
| 3138 |
|
| 3139 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label-content > span { |
| 3140 |
font-size: ' . $this->options[ $this->name_prefix . 'answer_font_size' ] . 'px; |
| 3141 |
letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing' ] . 'px; |
| 3142 |
word-break: break-word; |
| 3143 |
} |
| 3144 |
|
| 3145 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer { |
| 3146 |
padding: ' . $this->options[ $this->name_prefix . 'answers_padding' ] . 'px ' . $this->options[ $this->name_prefix . 'answers_padding' ] . 'px ' . $this->options[ $this->name_prefix . 'answers_padding' ] . 'px 0; |
| 3147 |
margin: ' . $this->options[ $this->name_prefix . 'answers_gap' ] . 'px ' . $this->options[ $this->name_prefix . 'answers_gap' ] . 'px ' . $this->options[ $this->name_prefix . 'answers_gap' ] . 'px 0; |
| 3148 |
} |
| 3149 |
|
| 3150 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-image { |
| 3151 |
object-fit: ' . $this->options[ $this->name_prefix . 'answers_object_fit' ] . '; |
| 3152 |
} |
| 3153 |
|
| 3154 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container .' . $this->html_class_prefix . 'section-button-content .' . $this->html_class_prefix . 'section-button { |
| 3155 |
font-size: ' . $this->options[ $this->name_prefix . 'buttons_font_size' ] . 'px; |
| 3156 |
padding-left: ' . $this->options[ $this->name_prefix . 'buttons_left_right_padding' ] . 'px; |
| 3157 |
padding-right: ' . $this->options[ $this->name_prefix . 'buttons_left_right_padding' ] . 'px; |
| 3158 |
padding-top: ' . $this->options[ $this->name_prefix . 'buttons_top_bottom_padding' ] . 'px; |
| 3159 |
padding-bottom: ' . $this->options[ $this->name_prefix . 'buttons_top_bottom_padding' ] . 'px; |
| 3160 |
background-color: ' . $this->options[ $this->name_prefix . 'buttons_bg_color' ] . '; |
| 3161 |
letter-spacing: ' . $this->options[ $this->name_prefix . 'buttons_text_letter_spacing' ] . 'px; |
| 3162 |
height: initial; |
| 3163 |
color: #333 !important; |
| 3164 |
} |
| 3165 |
|
| 3166 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container .' . $this->html_class_prefix . 'section-button-content .' . $this->html_class_prefix . 'section-button:hover { |
| 3167 |
color: rgba(51,51,51,0.7) !important; |
| 3168 |
} |
| 3169 |
|
| 3170 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container { |
| 3171 |
border-radius: ' . $this->options[ $this->name_prefix . 'buttons_border_radius' ] . 'px; |
| 3172 |
background-color: ' . $this->options[ $this->name_prefix . 'background_color' ] . '; |
| 3173 |
} |
| 3174 |
|
| 3175 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-select.dropdown div.text, |
| 3176 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-select.dropdown div.item { |
| 3177 |
font-size: ' . $this->options[ $this->name_prefix . 'answer_font_size' ] . 'px !important; |
| 3178 |
letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing' ] . 'px; |
| 3179 |
font-weight: normal; |
| 3180 |
} |
| 3181 |
|
| 3182 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-star .' . $this->html_class_prefix . 'answer-star-radio, |
| 3183 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-star .' . $this->html_class_prefix . 'answer-star-radio-label, |
| 3184 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-select.dropdown div.item { |
| 3185 |
font-size: ' . $this->options[ $this->name_prefix . 'answer_font_size' ] . 'px !important; |
| 3186 |
letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing' ] . 'px; |
| 3187 |
color: ' . $this->options[ $this->name_prefix . 'text_color' ] . '; |
| 3188 |
} |
| 3189 |
|
| 3190 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' label.' . $this->html_class_prefix . 'individual-submission-conatiner-star-label-stars div:nth-child(2) > i.fa.fa_star_o::before{ |
| 3191 |
content: "\f006"; |
| 3192 |
} |
| 3193 |
|
| 3194 |
|
| 3195 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label .' . $this->html_class_prefix . 'answer-star-radio input { |
| 3196 |
display: none ; |
| 3197 |
} |
| 3198 |
|
| 3199 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .lds-ripple[data-role="loader"] div{ |
| 3200 |
border-color: ' . $this->options[ $this->name_prefix . 'loader_color' ] . '; |
| 3201 |
} |
| 3202 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .lds-dual-ring[data-role="loader"]::after, |
| 3203 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .lds-hourglass[data-role="loader"]::after{ |
| 3204 |
border-color: ' . $this->options[ $this->name_prefix . 'loader_color' ] . ' transparent ' . $this->options[ $this->name_prefix . 'loader_color' ] . ' transparent; |
| 3205 |
} |
| 3206 |
|
| 3207 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .lds-default[data-role="loader"] div, |
| 3208 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .lds-ellipsis[data-role="loader"] div, |
| 3209 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .lds-facebook[data-role="loader"] div, |
| 3210 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .lds-circle[data-role="loader"] { |
| 3211 |
background-color: ' . $this->options[ $this->name_prefix . 'loader_color' ] . '; |
| 3212 |
} |
| 3213 |
|
| 3214 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .ays-survey-loader-snake[data-role="loader"]{ |
| 3215 |
color:' . $this->options[ $this->name_prefix . 'loader_color' ] . '; |
| 3216 |
} |
| 3217 |
|
| 3218 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' textarea.' . $this->html_class_prefix . 'question-input { |
| 3219 |
min-height: ' . $this->options[ $this->name_prefix . 'textarea_height' ] . 'px !important; |
| 3220 |
} |
| 3221 |
|
| 3222 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .'.$this->name_prefix.'expired-survey-message { |
| 3223 |
color: ' . $this->options[ $this->name_prefix . 'text_color' ] . '; |
| 3224 |
}'; |
| 3225 |
$content[] = ' |
| 3226 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'simple-button-container .' . $this->html_class_prefix . 'button-content .' . $this->html_class_prefix . 'button{ |
| 3227 |
color: ' . $this->options[ $this->name_prefix . 'buttons_text_color' ] . '; |
| 3228 |
background-color: ' . $this->options[ $this->name_prefix . 'buttons_bg_color' ] . '; |
| 3229 |
} |
| 3230 |
|
| 3231 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'full-screen-mode .' . $this->html_class_prefix . 'close-full-screen, |
| 3232 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'full-screen-mode .' . $this->html_class_prefix . 'open-full-screen{ |
| 3233 |
fill: ' . $this->options[ $this->name_prefix . 'full_screen_button_color' ] . '; |
| 3234 |
} |
| 3235 |
|
| 3236 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'live-bar-wrap{ |
| 3237 |
background-color: ' . $this->options[ $this->name_prefix . 'color' ] . '; |
| 3238 |
border-color: ' . $this->options[ $this->name_prefix . 'color' ] . '; |
| 3239 |
} |
| 3240 |
|
| 3241 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'live-bar-fill{ |
| 3242 |
background-color: ' . $this->options[ $this->name_prefix . 'background_color' ] . '; |
| 3243 |
} |
| 3244 |
|
| 3245 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'live-bar-status .' . $this->html_class_prefix . 'live-bar-status-text{ |
| 3246 |
font-size: ' . $this->options[ $this->name_prefix . 'progress_bar_text_font_size' ] . 'px; |
| 3247 |
color: ' . $this->options[ $this->name_prefix . 'pagination_text_color' ] . '; |
| 3248 |
padding: 0 10px; |
| 3249 |
letter-spacing: ' . $this->options[ $this->name_prefix . 'progress_bar_text_letter_spacing' ] . 'px; |
| 3250 |
line-height: 30px; |
| 3251 |
font-weight: normal; |
| 3252 |
text-transform: '.$this->options[ $this->name_prefix . 'progress_bar_text_transform' ].'; |
| 3253 |
} |
| 3254 |
|
| 3255 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'title{ |
| 3256 |
text-align: ' . $this->options[ $this->name_prefix . 'title_alignment' ] . '; |
| 3257 |
font-size: ' . $this->options[ $this->name_prefix . 'title_font_size' ] . 'px; |
| 3258 |
letter-spacing: ' . $this->options[ $this->name_prefix . 'title_letter_spacing' ] . 'px; |
| 3259 |
'. $survey_title_box_shadow_class .' |
| 3260 |
} |
| 3261 |
|
| 3262 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'section-title-row-main{ |
| 3263 |
text-align: ' . $this->options[ $this->name_prefix . 'section_title_alignment' ] . '; |
| 3264 |
font-size: ' . $this->options[ $this->name_prefix . 'section_title_font_size' ] . 'px; |
| 3265 |
letter-spacing: ' . $this->options[ $this->name_prefix . 'section_title_letter_spacing' ] . 'px; |
| 3266 |
width: 100%; |
| 3267 |
line-height: 1.5; |
| 3268 |
} |
| 3269 |
|
| 3270 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'answer-label .' . $this->html_class_prefix . 'answer-image-container{ |
| 3271 |
height: ' . $this->options[ $this->name_prefix . 'answers_image_size' ] . 'px; |
| 3272 |
} |
| 3273 |
|
| 3274 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'section-desc{ |
| 3275 |
text-align: ' . $this->options[ $this->name_prefix . 'section_description_alignment' ] . '; |
| 3276 |
font-size: ' . $this->options[ $this->name_prefix . 'section_description_font_size' ] . 'px; |
| 3277 |
letter-spacing: ' . $this->options[ $this->name_prefix . 'section_description_letter_spacing' ] . 'px; |
| 3278 |
line-height: 1; |
| 3279 |
}'; |
| 3280 |
$content[] = ' |
| 3281 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'cover-photo-title-wrap{ |
| 3282 |
height: ' . $this->options[ $this->name_prefix . 'cover_photo_height' ] . 'px; |
| 3283 |
background-position: ' . implode(" ", explode("_" , $this->options[ $this->name_prefix . 'cover_photo_position' ])) .'; |
| 3284 |
background-size: ' . $this->options[ $this->name_prefix . 'cover_photo_object_fit' ] .'; |
| 3285 |
} |
| 3286 |
|
| 3287 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section .' . $this->html_class_prefix . 'question .' . $this->html_class_prefix . 'image-logo-url{ |
| 3288 |
'.$survey_logo_image_position.' |
| 3289 |
} |
| 3290 |
|
| 3291 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section .' . $this->html_class_prefix . 'question .' . $this->html_class_prefix . 'question-text-message, |
| 3292 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section .' . $this->html_class_prefix . 'question .' . $this->html_class_prefix . 'number-limit-message-box{ |
| 3293 |
color: ' . $this->options[ $this->name_prefix . 'text_color' ] . '; |
| 3294 |
text-align: left; |
| 3295 |
font-size: 12px; |
| 3296 |
padding-top: 10px; |
| 3297 |
} |
| 3298 |
|
| 3299 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section .' . $this->html_class_prefix . 'question .' . $this->html_class_prefix . 'question-text-error-message { |
| 3300 |
color: #ff0000; |
| 3301 |
} |
| 3302 |
|
| 3303 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section .' . $this->html_class_prefix . 'question .' . $this->html_class_prefix . 'admin-note-inner span{ |
| 3304 |
color: #000; |
| 3305 |
text-transform: none; |
| 3306 |
font-size: 11px; |
| 3307 |
} |
| 3308 |
|
| 3309 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'live-bar-main{ |
| 3310 |
flex-direction: '.$pagination_positioning.'; |
| 3311 |
} |
| 3312 |
|
| 3313 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons{ |
| 3314 |
margin-top: ' . $this->options[ $this->name_prefix . 'buttons_top_distance' ] . 'px; |
| 3315 |
text-align: ' . $this->options[ $this->name_prefix . 'buttons_alignment' ] . '; |
| 3316 |
} |
| 3317 |
|
| 3318 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'results .' . $this->html_class_prefix . 'section-buttons{ |
| 3319 |
margin-top: 0; |
| 3320 |
} |
| 3321 |
|
| 3322 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'question-content .' . $this->html_class_prefix . 'question-answers:not(.' . $this->html_class_prefix . 'question-answers-grid){ |
| 3323 |
align-items: ' . $this->options[ $this->name_prefix . 'answers_view_alignment' ] . '; |
| 3324 |
} |
| 3325 |
|
| 3326 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'question-content .' . $this->html_class_prefix . 'question-answers-grid{ |
| 3327 |
justify-content: ' . $this->options[ $this->name_prefix . 'answers_view_alignment' ] . '; |
| 3328 |
} |
| 3329 |
|
| 3330 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'question .' . $this->html_class_prefix . 'answer{ |
| 3331 |
'.$answers_list_width.' |
| 3332 |
'.$answers_list_direction.' |
| 3333 |
'.$answers_grid_min_width.' |
| 3334 |
} |
| 3335 |
|
| 3336 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'question[data-type="date"] .' . $this->html_class_prefix . 'answer{ |
| 3337 |
width: 100%; |
| 3338 |
} |
| 3339 |
|
| 3340 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'question .' . $this->html_class_prefix . 'answer.' . $this->html_class_prefix . 'other-answer-container{ |
| 3341 |
'.$other_answer_box_width.' |
| 3342 |
} |
| 3343 |
|
| 3344 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'question[data-type="short_text"] .' . $this->html_class_prefix . 'answer, |
| 3345 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'question[data-type="text"] .' . $this->html_class_prefix . 'answer, |
| 3346 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'question[data-type="email"] .' . $this->html_class_prefix . 'answer, |
| 3347 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'question[data-type="name"] .' . $this->html_class_prefix . 'answer, |
| 3348 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'question[data-type="number"] .' . $this->html_class_prefix . 'answer, |
| 3349 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'question[data-type="phone"] .' . $this->html_class_prefix . 'answer{ |
| 3350 |
width: 100%; |
| 3351 |
} |
| 3352 |
|
| 3353 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'question-image-caption span{ |
| 3354 |
color: '.$this->options[ $this->name_prefix . 'question_caption_text_color' ].'; |
| 3355 |
font-size: '.$this->options[ $this->name_prefix . 'question_caption_font_size' ].'px; |
| 3356 |
text-transform: '.$this->options[ $this->name_prefix . 'question_caption_text_transform' ].'; |
| 3357 |
letter-spacing: '.$this->options[ $this->name_prefix . 'question_caption_letter_spacing' ].'px; |
| 3358 |
} |
| 3359 |
|
| 3360 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . '.' . $this->html_class_prefix . 'container .' . $this->html_class_prefix . 'restricted-content.' . $this->html_class_prefix . 'section .' . $this->html_class_prefix . 'section-header p, |
| 3361 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . '.' . $this->html_class_prefix . 'container .' . $this->html_class_prefix . 'restricted-content .' . $this->html_class_prefix . 'section-header *{ |
| 3362 |
color: ' . $this->options[ $this->name_prefix . 'text_color' ] . '; |
| 3363 |
} |
| 3364 |
|
| 3365 |
'; |
| 3366 |
|
| 3367 |
if($this->options[ $this->name_prefix . 'enable_survey_start_loader' ]){ |
| 3368 |
$content[] = '#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . '.' . $this->html_class_prefix . 'container { |
| 3369 |
min-height: 250px; |
| 3370 |
}'; |
| 3371 |
} |
| 3372 |
|
| 3373 |
if( $this->options[ $this->name_prefix . 'is_minimal' ] ){ |
| 3374 |
$content[] = |
| 3375 |
'#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'minimal-theme-header { |
| 3376 |
box-shadow: unset; |
| 3377 |
border: 0; |
| 3378 |
} |
| 3379 |
|
| 3380 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question.' . $this->html_class_prefix . 'minimal-theme-question { |
| 3381 |
border: 0; |
| 3382 |
} |
| 3383 |
|
| 3384 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label-content .' . $this->html_class_prefix . 'answer-icon-content { |
| 3385 |
display: none; |
| 3386 |
} |
| 3387 |
|
| 3388 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label input { |
| 3389 |
display: block ; |
| 3390 |
cursor: pointer; |
| 3391 |
outline: none; |
| 3392 |
} |
| 3393 |
|
| 3394 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label { |
| 3395 |
justify-content: initial; |
| 3396 |
} |
| 3397 |
|
| 3398 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label .' . $this->html_class_prefix . 'answer-star-radio input { |
| 3399 |
display: none ; |
| 3400 |
} |
| 3401 |
|
| 3402 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-matrix-scale-main .' . $this->html_class_prefix . 'answer-matrix-scale-container .' . $this->html_class_prefix . 'answer-matrix-scale-row .' . $this->html_class_prefix . 'answer-matrix-scale-column-content, |
| 3403 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-slider-list-main .' . $this->html_class_prefix . 'answer-slider-list-container .' . $this->html_class_prefix . 'answer-slider-list-row .' . $this->html_class_prefix . 'answer-slider-list-column-content, |
| 3404 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-star-list-main .' . $this->html_class_prefix . 'answer-star-list-container .' . $this->html_class_prefix . 'answer-star-list-row .' . $this->html_class_prefix . 'answer-matrix-scale-column-content { |
| 3405 |
width: initial; |
| 3406 |
} |
| 3407 |
|
| 3408 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' input[type=range].' . $this->html_class_prefix . 'range-type-input { |
| 3409 |
-webkit-appearance: auto; |
| 3410 |
appearance: auto; |
| 3411 |
} |
| 3412 |
|
| 3413 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' input[type=range].' . $this->html_class_prefix . 'range-type-input { |
| 3414 |
-moz-appearance: auto; |
| 3415 |
appearance: auto; |
| 3416 |
} |
| 3417 |
|
| 3418 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .'.$this->html_class_prefix.'minimal-theme-textarea-input { |
| 3419 |
border: 1px solid !important; |
| 3420 |
transition: 0; |
| 3421 |
width: 100%; |
| 3422 |
} |
| 3423 |
|
| 3424 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-select-conteiner-minimal { |
| 3425 |
width: 230px; |
| 3426 |
padding: 5px !important; |
| 3427 |
outline: none; |
| 3428 |
} |
| 3429 |
|
| 3430 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .'.$this->html_class_prefix.'question-date-input-box { |
| 3431 |
width: 230px; |
| 3432 |
height: 40px; |
| 3433 |
} |
| 3434 |
|
| 3435 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .'.$this->html_class_prefix.'question-date-input-box input { |
| 3436 |
width: 100%; |
| 3437 |
height: 100%; |
| 3438 |
box-sizing: border-box; |
| 3439 |
font-size: 15px; |
| 3440 |
padding: 10px; |
| 3441 |
}'; |
| 3442 |
} |
| 3443 |
|
| 3444 |
if( $this->options[ $this->name_prefix . 'is_modern' ] ){ |
| 3445 |
$content[] = |
| 3446 |
'#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-questions > .' . $this->html_class_prefix . 'question.' . $this->html_class_prefix . 'modern-theme-question{ |
| 3447 |
border: none; |
| 3448 |
margin: 15px 0 0; |
| 3449 |
padding: '. ((isset($this->options[ $this->name_prefix . 'logo' ]) && $this->options[ $this->name_prefix . 'logo' ] != "") ? '0 0 50px 0': '1px 12px').'; |
| 3450 |
} |
| 3451 |
|
| 3452 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-questions > .' . $this->html_class_prefix . 'question.' . $this->html_class_prefix . 'modern-theme-question:not(:last-child){ |
| 3453 |
border-radius: unset; |
| 3454 |
} |
| 3455 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-footer{ |
| 3456 |
margin-top:11px 12pxpx; |
| 3457 |
} |
| 3458 |
|
| 3459 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-questions > div.' . $this->html_class_prefix . 'question.' . $this->html_class_prefix . 'modern-theme-question:last-child{ |
| 3460 |
border-bottom-left-radius: 5px; |
| 3461 |
border-bottom-right-radius: 5px; |
| 3462 |
border-top-left-radius: 0; |
| 3463 |
border-top-right-radius: 0; |
| 3464 |
} |
| 3465 |
|
| 3466 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'modern-theme-header{ |
| 3467 |
border-bottom-left-radius: 0; |
| 3468 |
border-bottom-right-radius: 0; |
| 3469 |
border-top-left-radius: 5px; |
| 3470 |
border-top-right-radius: 5px; |
| 3471 |
border: none; |
| 3472 |
box-shadow: none; |
| 3473 |
margin: 0; |
| 3474 |
} |
| 3475 |
|
| 3476 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-questions > .' . $this->html_class_prefix . 'question.' . $this->html_class_prefix . 'modern-theme-question .' . $this->html_class_prefix . 'question-header{ |
| 3477 |
margin: 7px 0; |
| 3478 |
} |
| 3479 |
|
| 3480 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-questions > .' . $this->html_class_prefix . 'question.' . $this->html_class_prefix . 'modern-theme-question .' . $this->html_class_prefix .'question-content > .' . $this->html_class_prefix . 'question-answers > .' . $this->html_class_prefix . 'answer { |
| 3481 |
padding: 5px 0; |
| 3482 |
margin: 0px; |
| 3483 |
} |
| 3484 |
|
| 3485 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'modern-theme-header > .' . $this->html_class_prefix . 'results .' . $this->html_class_prefix . 'thank-you-page .' . $this->html_class_prefix . 'submission-summary-question-container, |
| 3486 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'modern-theme-header > .' . $this->html_class_prefix . 'results .' . $this->html_class_prefix . 'thank-you-page .' . $this->html_class_prefix . 'submission-summary-section-header{ |
| 3487 |
border: none; |
| 3488 |
} |
| 3489 |
|
| 3490 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-title { |
| 3491 |
font-weight: bold; |
| 3492 |
margin: 0 !important; |
| 3493 |
text-align: ' . $this->options[ $this->name_prefix . 'question_title_alignment' ] . '; |
| 3494 |
} |
| 3495 |
|
| 3496 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container:hover .' . $this->html_class_prefix . 'section-button-content button.' . $this->html_class_prefix . 'section-button, |
| 3497 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container:hover .' . $this->html_class_prefix . 'section-button-content a.' . $this->html_class_prefix . 'section-button, |
| 3498 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container:hover .' . $this->html_class_prefix . 'section-button-content input.' . $this->html_class_prefix . 'section-button, |
| 3499 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'results-content .' . $this->html_class_prefix . 'thank-you-summary-submission-main-container button.' . $this->html_class_prefix . 'single-submission-results-export, |
| 3500 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'submission-questions-answers > .' . $this->html_class_prefix . 'each-question-answer.' . $this->html_class_prefix . 'answer .ays_text_answer{ |
| 3501 |
color: ' . $this->options[ $this->name_prefix . 'color' ] . '; |
| 3502 |
} |
| 3503 |
|
| 3504 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container:hover .' . $this->html_class_prefix . 'section-button-content button.' . $this->html_class_prefix . 'section-button, |
| 3505 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container:hover .' . $this->html_class_prefix . 'section-button-content input.' . $this->html_class_prefix . 'section-button, |
| 3506 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container .' . $this->html_class_prefix . 'section-button-content button.' . $this->html_class_prefix . 'section-button, |
| 3507 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container .' . $this->html_class_prefix . 'section-button-content a.' . $this->html_class_prefix . 'section-button, |
| 3508 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'results-content .' . $this->html_class_prefix . 'thank-you-summary-submission-main-container button.' . $this->html_class_prefix . 'single-submission-results-export{ |
| 3509 |
background-color: ' . Survey_Maker_Data::hex2rgba( $this->options[ $this->name_prefix . 'buttons_bg_color' ], 0.8 ) . '; |
| 3510 |
color: '.$this->options[ $this->name_prefix . 'buttons_text_color' ].'; |
| 3511 |
} |
| 3512 |
|
| 3513 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'live-bar-wrap { |
| 3514 |
background-color: ' . ( $this->options[ $this->name_prefix . 'is_minimal' ] ? $this->options[ $this->name_prefix . 'text_color' ] : $this->options[ $this->name_prefix . 'buttons_bg_color' ] ) . '; |
| 3515 |
border-color: ' . ( $this->options[ $this->name_prefix . 'is_minimal' ] ? $this->options[ $this->name_prefix . 'text_color' ] : $this->options[ $this->name_prefix . 'buttons_bg_color' ] ) . '; |
| 3516 |
} |
| 3517 |
|
| 3518 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'live-bar-fill { |
| 3519 |
background-color: ' . ( $this->options[ $this->name_prefix . 'is_minimal' ] ? $this->options[ $this->name_prefix . 'text_color' ] : $this->options[ $this->name_prefix . 'buttons_text_color' ] ) . '; |
| 3520 |
} |
| 3521 |
|
| 3522 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-questions > .' . $this->html_class_prefix . 'question.' . $this->html_class_prefix . 'modern-theme-question .' . $this->html_class_prefix .'question-input{ |
| 3523 |
background-color: unset; |
| 3524 |
} |
| 3525 |
|
| 3526 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container:hover .' . $this->html_class_prefix . 'section-button-content button.' . $this->html_class_prefix . 'section-button, |
| 3527 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container:hover .' . $this->html_class_prefix . 'section-button-content input.' . $this->html_class_prefix . 'section-button, |
| 3528 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container:focus .' . $this->html_class_prefix . 'section-button-content button.' . $this->html_class_prefix . 'section-button, |
| 3529 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container:focus .' . $this->html_class_prefix . 'section-button-content input.' . $this->html_class_prefix . 'section-button { |
| 3530 |
color: ' . Survey_Maker_Data::hex2rgba( $this->options[ $this->name_prefix . 'buttons_text_color' ], 0.7) . '; |
| 3531 |
background-color: ' . Survey_Maker_Data::hex2rgba( $this->options[ $this->name_prefix . 'buttons_bg_color' ], 0.8 ) . '; |
| 3532 |
} |
| 3533 |
|
| 3534 |
'; |
| 3535 |
} |
| 3536 |
|
| 3537 |
$content[] = $this->get_css_mobile_part($mobile_max_width, $mobile_width, $pagination_number_height); |
| 3538 |
|
| 3539 |
if( isset($this->options[ $this->name_prefix . 'cover_photo' ]) && $this->options[ $this->name_prefix . 'cover_photo' ] != "" ){ |
| 3540 |
$content[] = |
| 3541 |
'#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .'.$this->html_class_prefix.'cover-photo-title-wrap { |
| 3542 |
background-image: url('.$this->options[ $this->name_prefix . 'cover_photo' ].'); |
| 3543 |
background-repeat: no-repeat; |
| 3544 |
} |
| 3545 |
|
| 3546 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .'.$this->html_class_prefix.'cover-photo-title-wrap .'.$this->html_class_prefix.'title { |
| 3547 |
display: flex; |
| 3548 |
align-items: flex-end; |
| 3549 |
height: 100%; |
| 3550 |
} |
| 3551 |
'; |
| 3552 |
|
| 3553 |
$title_alignment_with_cover_photo_css = 'flex-start'; |
| 3554 |
switch( $this->options[ $this->name_prefix . 'title_alignment' ] ){ |
| 3555 |
case "left": |
| 3556 |
$title_alignment_with_cover_photo_css = 'flex-start'; |
| 3557 |
break; |
| 3558 |
case "right": |
| 3559 |
$title_alignment_with_cover_photo_css = 'flex-end'; |
| 3560 |
break; |
| 3561 |
case "center": |
| 3562 |
$title_alignment_with_cover_photo_css = 'center'; |
| 3563 |
break; |
| 3564 |
default: |
| 3565 |
$title_alignment_with_cover_photo_css = 'flex-start'; |
| 3566 |
break; |
| 3567 |
} |
| 3568 |
|
| 3569 |
$content[] = |
| 3570 |
'#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .'.$this->html_class_prefix.'cover-photo-title-wrap .'.$this->html_class_prefix.'title { |
| 3571 |
justify-content: ' . $title_alignment_with_cover_photo_css . '; |
| 3572 |
}'; |
| 3573 |
|
| 3574 |
} |
| 3575 |
|
| 3576 |
$content[] = '</style>'; |
| 3577 |
|
| 3578 |
$content = implode( '', $content ); |
| 3579 |
|
| 3580 |
return $content; |
| 3581 |
} |
| 3582 |
|
| 3583 |
public function get_custom_css(){ |
| 3584 |
|
| 3585 |
$content = array(); |
| 3586 |
|
| 3587 |
if( $this->options[ $this->name_prefix . 'custom_css' ] != '' ){ |
| 3588 |
|
| 3589 |
$content[] = '<style type="text/css">'; |
| 3590 |
|
| 3591 |
$content[] = $this->options[ $this->name_prefix . 'custom_css' ]; |
| 3592 |
|
| 3593 |
$content[] = '</style>'; |
| 3594 |
|
| 3595 |
} |
| 3596 |
|
| 3597 |
$content = implode( '', $content ); |
| 3598 |
|
| 3599 |
return $content; |
| 3600 |
} |
| 3601 |
|
| 3602 |
public function get_encoded_options( $limit ){ |
| 3603 |
|
| 3604 |
$content = array(); |
| 3605 |
|
| 3606 |
if( isset( $this->options[ $this->name_prefix . 'submit_redirect_delay' ] ) ){ |
| 3607 |
$this->options[ $this->name_prefix . 'submit_redirect_seconds'] = Survey_Maker_Data::secondsToWords( intval( $this->options[ $this->name_prefix . 'submit_redirect_delay' ] ) ); |
| 3608 |
} |
| 3609 |
|
| 3610 |
// Animation Top (px) |
| 3611 |
$setting_options = Survey_Maker_Data::get_setting_data( 'options' ); |
| 3612 |
$survey_animation_top = ( isset($setting_options[ 'survey_animation_top' ]) && $setting_options[ 'survey_animation_top' ] != '' ) ? intval( $setting_options[ 'survey_animation_top' ] ) : ''; |
| 3613 |
$setting_options['survey_enable_animation_top'] = isset($setting_options['survey_enable_animation_top']) ? $setting_options['survey_enable_animation_top'] : 'on'; |
| 3614 |
$survey_enable_animation_top = ( isset($setting_options[ 'survey_enable_animation_top' ]) && $setting_options[ 'survey_enable_animation_top' ] == 'on' ) ? true : false; |
| 3615 |
|
| 3616 |
$this->options['is_user_logged_in'] = is_user_logged_in(); |
| 3617 |
|
| 3618 |
$this->options[ $this->name_prefix . 'animation_top'] = $survey_animation_top; |
| 3619 |
$this->options[ $this->name_prefix . 'enable_animation_top'] = $survey_enable_animation_top; |
| 3620 |
|
| 3621 |
$options = array(); |
| 3622 |
if( ! $limit ){ |
| 3623 |
foreach( $this->options as $k => $q ){ |
| 3624 |
if( strpos( $k, 'email' ) !== false ){ |
| 3625 |
unset( $this->options[ $k ] ); |
| 3626 |
} |
| 3627 |
} |
| 3628 |
$options = $this->options; |
| 3629 |
}else{ |
| 3630 |
if($this->options[ $this->name_prefix . 'redirect_delay' ] && $this->options[ $this->name_prefix . 'redirect_delay' ] != ''){ |
| 3631 |
if($this->options[ $this->name_prefix . 'redirect_url' ] && $this->options[ $this->name_prefix . 'redirect_url' ] != ''){ |
| 3632 |
if($this->options[ $this->name_prefix . 'limit_users' ]){ |
| 3633 |
$options = array( |
| 3634 |
$this->name_prefix . 'submit_redirect_seconds' => Survey_Maker_Data::secondsToWords( intval( $this->options[ $this->name_prefix . 'submit_redirect_delay' ] ) ), |
| 3635 |
$this->name_prefix . 'submit_redirect_delay' => intval( $this->options[ $this->name_prefix . 'submit_redirect_delay' ] ), |
| 3636 |
$this->name_prefix . 'submit_redirect_url' => $this->options[ $this->name_prefix . 'submit_redirect_url' ], |
| 3637 |
$this->name_prefix . 'limit_users' => $this->options[ $this->name_prefix . 'limit_users' ], |
| 3638 |
$this->name_prefix . 'redirect_url' => $this->options[ $this->name_prefix . 'redirect_url' ], |
| 3639 |
$this->name_prefix . 'redirect_delay' => intval( $this->options[ $this->name_prefix . 'redirect_delay' ] ), |
| 3640 |
$this->name_prefix . 'redirect_delay_seconds' => Survey_Maker_Data::secondsToWords( intval( $this->options[ $this->name_prefix . 'redirect_delay' ] ) ), |
| 3641 |
); |
| 3642 |
} |
| 3643 |
} |
| 3644 |
} |
| 3645 |
|
| 3646 |
$options[ $this->name_prefix . 'enable_survey_start_loader' ] = $this->options[ $this->name_prefix . 'enable_survey_start_loader' ]; |
| 3647 |
} |
| 3648 |
|
| 3649 |
$content[] = '<script type="text/javascript">'; |
| 3650 |
|
| 3651 |
$content[] = " |
| 3652 |
if(typeof aysSurveyOptions === 'undefined'){ |
| 3653 |
var aysSurveyOptions = []; |
| 3654 |
} |
| 3655 |
aysSurveyOptions['" . $this->unique_id . "'] = '" . base64_encode( json_encode( $options ) ) . "';"; |
| 3656 |
|
| 3657 |
$content[] = '</script>'; |
| 3658 |
|
| 3659 |
$content = implode( '', $content ); |
| 3660 |
|
| 3661 |
return $content; |
| 3662 |
} |
| 3663 |
|
| 3664 |
protected function ays_survey_check_limitations($limit_by, $limit_users_data){ |
| 3665 |
$is_limited = false; |
| 3666 |
switch($limit_by){ |
| 3667 |
case 'cookie': |
| 3668 |
|
| 3669 |
// PRO FEATURE |
| 3670 |
// $started_user_count = Survey_Maker_Data::get_limit_cookie_count( $limit_users_attr ); |
| 3671 |
// if( $quiz_max_pass_count > $started_user_count){ |
| 3672 |
// $limit_users_attr['increase_count'] = true; |
| 3673 |
// } |
| 3674 |
$check_cookie = Survey_Maker_Data::ays_survey_check_cookie( $limit_users_data ); |
| 3675 |
$return_false_status_arr = array( |
| 3676 |
"status" => false, |
| 3677 |
"message" => __( 'You already passed this survey.', "survey-maker" ), |
| 3678 |
"limited" => true |
| 3679 |
); |
| 3680 |
|
| 3681 |
// PRO FEATURE |
| 3682 |
// if( $quiz_max_pass_count <= $started_user_count){ |
| 3683 |
// echo json_encode( $return_false_status_arr ); |
| 3684 |
// wp_die(); |
| 3685 |
// } |
| 3686 |
|
| 3687 |
if( ! $check_cookie ){ |
| 3688 |
$set_cookie = Survey_Maker_Data::ays_survey_set_cookie( $limit_users_data ); |
| 3689 |
$is_limited = true; |
| 3690 |
} |
| 3691 |
else{ |
| 3692 |
echo json_encode( $return_false_status_arr ); |
| 3693 |
wp_die(); |
| 3694 |
} |
| 3695 |
break; |
| 3696 |
case 'ip_cookie': |
| 3697 |
$check_user_by_ip = Survey_Maker_Data::get_user_by_ip( $limit_users_data['id'] ); |
| 3698 |
|
| 3699 |
$started_user_count = Survey_Maker_Data::get_limit_cookie_count( $limit_users_data ); |
| 3700 |
$check_cookie = Survey_Maker_Data::ays_survey_check_cookie( $limit_users_data ); |
| 3701 |
|
| 3702 |
if ( ! $check_cookie || $check_user_by_ip <= 0 ) { |
| 3703 |
if ( ! $check_cookie ) { |
| 3704 |
$set_cookie = Survey_Maker_Data::ays_survey_set_cookie( $limit_users_data ); |
| 3705 |
} |
| 3706 |
} |
| 3707 |
$is_limited = true; |
| 3708 |
break; |
| 3709 |
|
| 3710 |
} |
| 3711 |
return $is_limited; |
| 3712 |
} |
| 3713 |
|
| 3714 |
public function ays_survey_get_user_information() { |
| 3715 |
$output = array(); |
| 3716 |
if(isset($_POST['nonce']) && wp_verify_nonce($_POST['nonce'], 'survey_maker_autofill_nonce')){ |
| 3717 |
if(is_user_logged_in()) { |
| 3718 |
$user = wp_get_current_user(); |
| 3719 |
|
| 3720 |
$output = array( |
| 3721 |
'data' => array( |
| 3722 |
'display_name' => $user->display_name, |
| 3723 |
'user_email' => $user->user_email, |
| 3724 |
) |
| 3725 |
); |
| 3726 |
} else { |
| 3727 |
$output = array(); |
| 3728 |
} |
| 3729 |
} |
| 3730 |
return $output; |
| 3731 |
} |
| 3732 |
|
| 3733 |
public function ays_survey_popup_set_cookie(){ |
| 3734 |
if( isset( $_REQUEST['id'] ) && $_REQUEST['id'] != '' ){ |
| 3735 |
$id = sanitize_text_field( $_REQUEST['id'] ); |
| 3736 |
}else{ |
| 3737 |
$id = null; |
| 3738 |
} |
| 3739 |
if( $id === null ){ |
| 3740 |
return array( |
| 3741 |
'status' => false |
| 3742 |
); |
| 3743 |
} |
| 3744 |
|
| 3745 |
$cookie_name = 'ays_survey_popup_cookie_name_'.$id; |
| 3746 |
$cookie_value = 'ays_survey_popup_cookie_value_'.$id; |
| 3747 |
$cookie_expiration = time() + (12 * 30 * 24 * 60 * 60); |
| 3748 |
setcookie($cookie_name, $cookie_value, $cookie_expiration, '/'); |
| 3749 |
return array( |
| 3750 |
'status' => true |
| 3751 |
); |
| 3752 |
} |
| 3753 |
|
| 3754 |
public function get_css_mobile_part($mobile_max_width, $mobile_width, $pagination_number_height) { |
| 3755 |
$content = ''; |
| 3756 |
|
| 3757 |
$question_image_width_mobile = '100%'; |
| 3758 |
if( $this->options[ $this->name_prefix . 'question_image_width_mobile' ] != '' ){ |
| 3759 |
$question_image_width_mobile = $this->options[ $this->name_prefix . 'question_image_width_mobile' ] . 'px'; |
| 3760 |
} |
| 3761 |
|
| 3762 |
$question_image_height_mobile = 'auto'; |
| 3763 |
if( $this->options[ $this->name_prefix . 'question_image_height_mobile' ] != '' ){ |
| 3764 |
$question_image_height_mobile = $this->options[ $this->name_prefix . 'question_image_height_mobile' ] . 'px'; |
| 3765 |
} |
| 3766 |
else{ |
| 3767 |
if($this->options[ $this->name_prefix . 'question_image_height' ] != ''){ |
| 3768 |
$question_image_height_mobile = $this->options[ $this->name_prefix . 'question_image_height' ] . 'px'; |
| 3769 |
} |
| 3770 |
} |
| 3771 |
|
| 3772 |
switch($this->options[ $this->name_prefix . 'logo_image_position_mobile' ]){ |
| 3773 |
case "right": |
| 3774 |
$survey_logo_image_position_mobile = "right: 5px;"; |
| 3775 |
break; |
| 3776 |
case "left": |
| 3777 |
$survey_logo_image_position_mobile = "left: 5px;"; |
| 3778 |
break; |
| 3779 |
case "center": |
| 3780 |
$survey_logo_image_position_mobile = "left: 50%;"; |
| 3781 |
break; |
| 3782 |
default: |
| 3783 |
$survey_logo_image_position_mobile = "right: 5px;"; |
| 3784 |
break; |
| 3785 |
} |
| 3786 |
|
| 3787 |
|
| 3788 |
switch($this->options[ $this->name_prefix . 'start_page_button_pos_mobile' ]){ |
| 3789 |
case "left": |
| 3790 |
$survey_start_page_button_pos_mobile = 'justify-content: flex-start;'; |
| 3791 |
break; |
| 3792 |
case "center": |
| 3793 |
$survey_start_page_button_pos_mobile = 'justify-content: center;'; |
| 3794 |
break; |
| 3795 |
case "right": |
| 3796 |
$survey_start_page_button_pos_mobile = 'justify-content: flex-end;'; |
| 3797 |
break; |
| 3798 |
} |
| 3799 |
|
| 3800 |
$survey_pagination_positioning_mobile = isset($this->options[ $this->name_prefix . 'pagination_positioning_mobile' ]) ? $this->options[ $this->name_prefix . 'pagination_positioning_mobile' ] : 'none'; |
| 3801 |
$pagination_positioning_mobile = "row"; |
| 3802 |
// $pagination_number_height = ""; |
| 3803 |
switch ($survey_pagination_positioning_mobile) { |
| 3804 |
case 'none': |
| 3805 |
$pagination_positioning_mobile = "row"; |
| 3806 |
break; |
| 3807 |
case 'reverse': |
| 3808 |
$pagination_positioning_mobile = "row-reverse"; |
| 3809 |
break; |
| 3810 |
case 'column': |
| 3811 |
$pagination_positioning_mobile = "column"; |
| 3812 |
// $pagination_number_height = "line-height: 1;"; |
| 3813 |
break; |
| 3814 |
case 'column_reverse': |
| 3815 |
$pagination_positioning_mobile = "column-reverse"; |
| 3816 |
// $pagination_number_height = "line-height: 1;"; |
| 3817 |
break; |
| 3818 |
default: |
| 3819 |
$pagination_positioning_mobile = "row"; |
| 3820 |
// $pagination_number_height = ""; |
| 3821 |
break; |
| 3822 |
} |
| 3823 |
|
| 3824 |
// Question padding mobile |
| 3825 |
$question_padding = $this->options[ $this->name_prefix . 'question_padding_mobile' ]; |
| 3826 |
$question_caption_text_display = !$this->options[ $this->name_prefix . 'question_caption_hide_on_mobile' ] ? 'block' : 'none'; |
| 3827 |
$question_border_radius = $this->options[ $this->name_prefix . 'question_border_radius_mobile' ]; |
| 3828 |
$content .= ' |
| 3829 |
@media screen and (max-width: 640px){ |
| 3830 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' { |
| 3831 |
max-width: '. $mobile_max_width .'; |
| 3832 |
} |
| 3833 |
|
| 3834 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' { |
| 3835 |
width: ' . $mobile_width . '; |
| 3836 |
} |
| 3837 |
|
| 3838 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-box{ |
| 3839 |
width: 100%; |
| 3840 |
} |
| 3841 |
|
| 3842 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'live-bar-main{ |
| 3843 |
flex-wrap: wrap; |
| 3844 |
flex-direction: '.$pagination_positioning_mobile.'; |
| 3845 |
} |
| 3846 |
|
| 3847 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'footer-with-live-bar{ |
| 3848 |
flex-direction: column-reverse; |
| 3849 |
} |
| 3850 |
|
| 3851 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'live-bar-main{ |
| 3852 |
margin-bottom: 10px; |
| 3853 |
} |
| 3854 |
|
| 3855 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-required-icon, |
| 3856 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-title { |
| 3857 |
font-size: ' . $this->options[ $this->name_prefix . 'question_font_size_mobile' ] . 'px; |
| 3858 |
} |
| 3859 |
|
| 3860 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question { |
| 3861 |
' . ( $this->options[ $this->name_prefix . 'logo' ] != '' ? 'padding: '.$question_padding.'px '.$question_padding.'px 0 '.$question_padding.'px;' : 'padding: '.$question_padding.'px;' ) . ' |
| 3862 |
border-radius: ' . $question_border_radius . 'px; |
| 3863 |
} |
| 3864 |
|
| 3865 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons { |
| 3866 |
margin-top: ' . $this->options[ $this->name_prefix . 'buttons_top_distance_mobile' ] . 'px; |
| 3867 |
text-align: ' . $this->options[ $this->name_prefix . 'buttons_alignment_mobile' ] . '; |
| 3868 |
} |
| 3869 |
|
| 3870 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container{ |
| 3871 |
border-radius: ' . $this->options[ $this->name_prefix . 'buttons_border_radius_mobile' ] . 'px; |
| 3872 |
} |
| 3873 |
|
| 3874 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container .' . $this->html_class_prefix . 'section-button-content .' . $this->html_class_prefix . 'section-button{ |
| 3875 |
font-size: ' . $this->options[ $this->name_prefix . 'buttons_mobile_font_size' ] . 'px; |
| 3876 |
letter-spacing: ' . $this->options[ $this->name_prefix . 'buttons_text_letter_spacing_mobile' ] . 'px; |
| 3877 |
line-height: 2.5; |
| 3878 |
white-space: normal; |
| 3879 |
word-break: break-word; |
| 3880 |
} |
| 3881 |
|
| 3882 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'title{ |
| 3883 |
text-align: ' . $this->options[ $this->name_prefix . 'title_alignment_mobile' ] . '; |
| 3884 |
font-size: ' . $this->options[ $this->name_prefix . 'title_font_size_for_mobile' ] . 'px; |
| 3885 |
letter-spacing: ' . $this->options[ $this->name_prefix . 'title_letter_spacing_mobile' ] . 'px; |
| 3886 |
} |
| 3887 |
|
| 3888 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'section-title-row-main{ |
| 3889 |
text-align: ' . $this->options[ $this->name_prefix . 'section_title_alignment_mobile' ] . '; |
| 3890 |
font-size: ' . $this->options[ $this->name_prefix . 'section_title_font_size_mobile' ] . 'px; |
| 3891 |
letter-spacing: ' . $this->options[ $this->name_prefix . 'section_title_letter_spacing_mobile' ] . 'px; |
| 3892 |
} |
| 3893 |
|
| 3894 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'section-desc{ |
| 3895 |
text-align: ' . $this->options[ $this->name_prefix . 'section_description_alignment_mobile' ] . '; |
| 3896 |
font-size: ' . $this->options[ $this->name_prefix . 'section_description_font_size_mobile' ] . 'px; |
| 3897 |
letter-spacing: ' . $this->options[ $this->name_prefix . 'section_description_letter_spacing_mobile' ] . 'px; |
| 3898 |
} |
| 3899 |
|
| 3900 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' input.' . $this->html_class_prefix . 'question-input { |
| 3901 |
font-size: ' . $this->options[ $this->name_prefix . 'answer_font_size_on_mobile' ] . 'px; |
| 3902 |
letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing_mobile' ] . 'px; |
| 3903 |
height: auto; |
| 3904 |
} |
| 3905 |
|
| 3906 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' textarea.' . $this->html_class_prefix . 'question-input { |
| 3907 |
letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing_mobile' ] . 'px; |
| 3908 |
} |
| 3909 |
|
| 3910 |
|
| 3911 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer { |
| 3912 |
padding: ' . $this->options[ $this->name_prefix . 'answers_padding_mobile' ] . 'px ' . $this->options[ $this->name_prefix . 'answers_padding_mobile' ] . 'px ' . $this->options[ $this->name_prefix . 'answers_padding_mobile' ] . 'px 0; |
| 3913 |
margin: ' . $this->options[ $this->name_prefix . 'answers_gap_mobile' ] . 'px ' . $this->options[ $this->name_prefix . 'answers_gap_mobile' ] . 'px ' . $this->options[ $this->name_prefix . 'answers_gap_mobile' ] . 'px 0; |
| 3914 |
} |
| 3915 |
|
| 3916 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label-content > span { |
| 3917 |
font-size: ' . $this->options[ $this->name_prefix . 'answer_font_size_on_mobile' ] . 'px; |
| 3918 |
letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing_mobile' ] . 'px; |
| 3919 |
line-height: 1; |
| 3920 |
} |
| 3921 |
|
| 3922 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-select.dropdown div.text, |
| 3923 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-select.dropdown div.item { |
| 3924 |
font-size: ' . $this->options[ $this->name_prefix . 'answer_font_size_on_mobile' ] . 'px !important; |
| 3925 |
letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing_mobile' ] . 'px; |
| 3926 |
line-height: 1 !important; |
| 3927 |
} |
| 3928 |
|
| 3929 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section.' . $this->html_class_prefix . 'section-start-page .' . $this->html_class_prefix . 'section-header .' . $this->html_class_prefix . 'section-title-row { |
| 3930 |
justify-content: ' . $this->options[ $this->name_prefix . 'start_page_title_pos_mobile' ] . '; |
| 3931 |
} |
| 3932 |
|
| 3933 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-select.dropdown div.item { |
| 3934 |
font-size: ' . $this->options[ $this->name_prefix . 'answer_font_size_on_mobile' ] . 'px !important; |
| 3935 |
letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing_mobile' ] . 'px; |
| 3936 |
line-height: 1 !important; |
| 3937 |
} |
| 3938 |
|
| 3939 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section .' . $this->html_class_prefix . 'question .' . $this->html_class_prefix . 'image-logo-url{ |
| 3940 |
'.$survey_logo_image_position_mobile.' |
| 3941 |
} |
| 3942 |
|
| 3943 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'live-bar-status .' . $this->html_class_prefix . 'live-bar-status-text{ |
| 3944 |
font-size: ' . $this->options[ $this->name_prefix . 'answer_font_size_on_mobile' ] . 'px; |
| 3945 |
letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing_mobile' ] . 'px; |
| 3946 |
'.$pagination_number_height.' |
| 3947 |
} |
| 3948 |
|
| 3949 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'cover-photo-title-wrap{ |
| 3950 |
height: ' . $this->options[ $this->name_prefix . 'cover_photo_mobile_height' ] . 'px; |
| 3951 |
} |
| 3952 |
|
| 3953 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-image-caption span{ |
| 3954 |
color: '.$this->options[ $this->name_prefix . 'question_caption_text_color_mobile' ].' !important; |
| 3955 |
font-size: '.$this->options[ $this->name_prefix . 'question_caption_font_size_on_mobile' ].'px; |
| 3956 |
text-transform: '.$this->options[ $this->name_prefix . 'question_caption_text_transform_mobile' ].' !important; |
| 3957 |
letter-spacing: '.$this->options[ $this->name_prefix . 'question_caption_letter_spacing_mobile' ].'px !important; |
| 3958 |
display: '.$question_caption_text_display .'; |
| 3959 |
text-align: ' . $this->options[ $this->name_prefix . 'question_caption_text_alignment_on_mobile' ] . '; |
| 3960 |
} |
| 3961 |
|
| 3962 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'live-bar-status .' . $this->html_class_prefix . 'live-bar-status-text{ |
| 3963 |
font-size: ' . $this->options[ $this->name_prefix . 'progress_bar_text_font_size_on_mobile' ] . 'px; |
| 3964 |
color: ' . $this->options[ $this->name_prefix . 'pagination_text_color_mobile' ] . '; |
| 3965 |
letter-spacing: ' . $this->options[ $this->name_prefix . 'progress_bar_text_letter_spacing_mobile' ] . 'px; |
| 3966 |
text-transform: '.$this->options[ $this->name_prefix . 'progress_bar_text_transform_mobile' ].'; |
| 3967 |
line-height: 1; |
| 3968 |
} |
| 3969 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-image { |
| 3970 |
width: ' . $question_image_width_mobile . '; |
| 3971 |
height: ' . $question_image_height_mobile . '; |
| 3972 |
object-fit: ' . $this->options[ $this->name_prefix . 'question_image_sizing_mobile' ] . '; |
| 3973 |
} |
| 3974 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-image { |
| 3975 |
object-fit: ' . $this->options[ $this->name_prefix . 'answers_object_fit_mobile' ] . '; |
| 3976 |
} |
| 3977 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-start-page .' . $this->html_class_prefix . 'section-buttons { |
| 3978 |
display: flex; |
| 3979 |
'.$survey_start_page_button_pos_mobile.' |
| 3980 |
} |
| 3981 |
}'; |
| 3982 |
$content .= ' |
| 3983 |
@media screen and (max-width: 580px) { |
| 3984 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . '.' . $this->html_class_prefix . 'container .' . $this->html_class_prefix . 'section .' . $this->html_class_prefix . 'answer-label .' . $this->html_class_prefix . 'answer-image-container{ |
| 3985 |
height: ' . $this->options[ $this->name_prefix . 'answers_image_size_mobile' ] . 'px; |
| 3986 |
} |
| 3987 |
|
| 3988 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'live-bar-main{ |
| 3989 |
justify-content: center; |
| 3990 |
} |
| 3991 |
}'; |
| 3992 |
$content .= ' |
| 3993 |
@media screen and (min-width: 580px) and (max-width: 1024px) { |
| 3994 |
#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . '.' . $this->html_class_prefix . 'container .' . $this->html_class_prefix . 'section .' . $this->html_class_prefix . 'answer-label .' . $this->html_class_prefix . 'answer-image-container{ |
| 3995 |
height: 150px; |
| 3996 |
} |
| 3997 |
}'; |
| 3998 |
|
| 3999 |
return $content; |
| 4000 |
} |
| 4001 |
|
| 4002 |
|
| 4003 |
public function ays_generate_survey_popup_method( $attr ){ |
| 4004 |
|
| 4005 |
$id = (isset($attr['id'])) ? absint(intval($attr['id'])) : null; |
| 4006 |
if (is_null($id)) { |
| 4007 |
return ''; |
| 4008 |
} |
| 4009 |
|
| 4010 |
$this->enqueue_scripts_popups(); |
| 4011 |
|
| 4012 |
$content = $this->ays_popup_shortcode_content($id, $attr); |
| 4013 |
return $content ? str_replace( array( "\r\n", "\n", "\r" ), "\n", $content ) : ''; |
| 4014 |
} |
| 4015 |
|
| 4016 |
|
| 4017 |
public function ays_popup_shortcode_content( $id, $attr ){ |
| 4018 |
global $wpdb; |
| 4019 |
$post_id = get_the_ID(); |
| 4020 |
$popup_surveys_table = $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "popup_surveys"; |
| 4021 |
$surveys_table = $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "surveys"; |
| 4022 |
$sql = "SELECT p_s.*, s.options as s_options, s.status as survey_status |
| 4023 |
FROM {$popup_surveys_table} as p_s |
| 4024 |
LEFT JOIN {$surveys_table} AS s |
| 4025 |
ON p_s.survey_id = s.id |
| 4026 |
WHERE p_s.id = {$id}"; |
| 4027 |
$popup = $wpdb->get_row( $sql, "ARRAY_A" ); |
| 4028 |
|
| 4029 |
if( empty( $popup ) ){ |
| 4030 |
return ''; |
| 4031 |
} |
| 4032 |
|
| 4033 |
$survey_status = (isset($popup['survey_status'] ) && $popup['survey_status'] != '') ? $popup['survey_status'] : 'published'; |
| 4034 |
$is_elementor_exists = Survey_Maker_Data::ays_survey_is_elementor(); |
| 4035 |
if($survey_status == 'published' && !$is_elementor_exists){ |
| 4036 |
|
| 4037 |
$show_all = $popup['show_all']; |
| 4038 |
switch($show_all){ |
| 4039 |
case 'all': |
| 4040 |
$show_popup = true; |
| 4041 |
break; |
| 4042 |
case 'selected': |
| 4043 |
$show_popup = false; |
| 4044 |
break; |
| 4045 |
case 'except': |
| 4046 |
$show_popup = true; |
| 4047 |
break; |
| 4048 |
default: |
| 4049 |
$show_popup = true; |
| 4050 |
$show_all = 'all'; |
| 4051 |
break; |
| 4052 |
} |
| 4053 |
|
| 4054 |
$show = array('selected'); |
| 4055 |
|
| 4056 |
$options = array(); |
| 4057 |
$survey_options = array(); |
| 4058 |
if ($popup['options'] != '' || $popup['options'] != null) { |
| 4059 |
$options = json_decode( $popup['options'], true ); |
| 4060 |
} |
| 4061 |
|
| 4062 |
if ($popup['s_options'] != '' || $popup['s_options'] != null) { |
| 4063 |
$survey_options = json_decode( $popup['s_options'], true ); |
| 4064 |
} |
| 4065 |
// Title |
| 4066 |
$popup_title = isset( $popup["title"] ) && $popup["title"] != "" ? stripslashes( esc_attr( $popup["title"] ) ) : ""; |
| 4067 |
|
| 4068 |
// Show popup title |
| 4069 |
$survey_popup_enable_show_title = (isset($options["popup_enable_show_title"]) && $options["popup_enable_show_title"] == "on") ? true : false; |
| 4070 |
|
| 4071 |
// Popup title font size |
| 4072 |
$survey_popup_title_font_size = (isset($options['popup_title_font_size']) && $options['popup_title_font_size'] != '') ? absint ( intval( $options['popup_title_font_size'] ) ) : 25; |
| 4073 |
|
| 4074 |
// Popup title font size on mobile |
| 4075 |
$survey_popup_title_mobile_font_size = (isset($options['popup_title_mobile_font_size']) && $options['popup_title_mobile_font_size'] != '') ? absint ( intval( $options['popup_title_mobile_font_size'] ) ) : $survey_popup_title_font_size; |
| 4076 |
|
| 4077 |
// Popup title bg color |
| 4078 |
$survey_popup_title_bg_color = (isset($options["popup_title_bg_color"]) && $options["popup_title_bg_color"] != "") ? esc_attr ( $options["popup_title_bg_color"] ) : "#000000"; |
| 4079 |
// Popup title bg color mobile |
| 4080 |
$options["popup_title_bg_color_mobile"] = isset($options["popup_title_bg_color_mobile"]) ? $options["popup_title_bg_color_mobile"] : $survey_popup_title_bg_color; |
| 4081 |
$survey_popup_title_bg_color_mobile = (isset($options["popup_title_bg_color_mobile"]) && $options["popup_title_bg_color_mobile"] != "") ? esc_attr ( $options["popup_title_bg_color_mobile"] ) : "#000000"; |
| 4082 |
|
| 4083 |
// Popup title text color |
| 4084 |
$survey_popup_title_text_color = (isset($options["popup_title_text_color"]) && $options["popup_title_text_color"] != "") ? esc_attr ( $options["popup_title_text_color"] ) : "#000000"; |
| 4085 |
// Popup title text color mobile |
| 4086 |
$options["popup_title_text_color_mobile"] = isset($options["popup_title_text_color_mobile"]) ? $options["popup_title_text_color_mobile"] : $survey_popup_title_text_color; |
| 4087 |
$survey_popup_title_text_color_mobile = (isset($options["popup_title_text_color_mobile"]) && $options["popup_title_text_color_mobile"] != "") ? esc_attr ( $options["popup_title_text_color_mobile"] ) : "#000000"; |
| 4088 |
|
| 4089 |
// Popup title alignment |
| 4090 |
$survey_popup_title_alignment = (isset($options["popup_title_alignment"]) && $options["popup_title_alignment"] != "") ? esc_attr ( $options["popup_title_alignment"] ) : "left"; |
| 4091 |
|
| 4092 |
// Popup title alignment on mobile |
| 4093 |
$options["popup_title_alignment_on_mobile"] = isset($options["popup_title_alignment_on_mobile"]) ? $options["popup_title_alignment_on_mobile"] : $survey_popup_title_alignment; |
| 4094 |
$survey_popup_title_alignment_on_mobile = (isset($options["popup_title_alignment_on_mobile"]) && $options["popup_title_alignment_on_mobile"] != "") ? esc_attr ( $options["popup_title_alignment_on_mobile"] ) : "left"; |
| 4095 |
|
| 4096 |
// Popup title transform |
| 4097 |
$survey_popup_title_transform = (isset($options["popup_title_transform"]) && $options["popup_title_transform"] != "") ? esc_attr ( $options["popup_title_transform"] ) : "none"; |
| 4098 |
// Popup title transform mobile |
| 4099 |
$options["popup_title_transform_mobile"] = isset($options["popup_title_transform_mobile"]) ? $options["popup_title_transform_mobile"] : $survey_popup_title_transform; |
| 4100 |
$survey_popup_title_transform_mobile = (isset($options["popup_title_transform_mobile"]) && $options["popup_title_transform_mobile"] != "") ? esc_attr ( $options["popup_title_transform_mobile"] ) : "none"; |
| 4101 |
|
| 4102 |
// Popup title letter spacing |
| 4103 |
$survey_popup_title_letter_spacing = (isset( $options[ "popup_title_letter_spacing" ] ) && $options["popup_title_letter_spacing"] != '' && $options["popup_title_letter_spacing"] != '0') ? esc_attr( $options["popup_title_letter_spacing"] ) : 0; |
| 4104 |
|
| 4105 |
// Popup title letter spacing mobile |
| 4106 |
$options['popup_title_letter_spacing_on_mobile' ] = isset($options['popup_title_letter_spacing_on_mobile' ]) ? $options['popup_title_letter_spacing_on_mobile' ] : $survey_popup_title_letter_spacing; |
| 4107 |
$survey_popup_title_letter_spacing_on_mobile = (isset( $options['popup_title_letter_spacing_on_mobile' ] ) && $options['popup_title_letter_spacing_on_mobile'] != '' && $options['popup_title_letter_spacing_on_mobile'] != '0') ? esc_attr( $options['popup_title_letter_spacing_on_mobile'] ) : 0; |
| 4108 |
|
| 4109 |
// Hide popup title on mobile |
| 4110 |
$survey_popup_hide_title_on_mobile = (isset($options["popup_hide_title_on_mobile"]) && $options["popup_hide_title_on_mobile"] == "on") ? true : false; |
| 4111 |
|
| 4112 |
// Title border radius |
| 4113 |
$survey_popup_title_border_radius = (isset($options["popup_title_border_radius"]) && $options["popup_title_border_radius"] != "") ? absint ( intval( $options["popup_title_border_radius"] ) ) : 0; |
| 4114 |
// Title border radius mobile |
| 4115 |
$survey_popup_title_border_radius_mobile = (isset($options["popup_title_border_radius_mobile"]) && $options["popup_title_border_radius_mobile"] != "") ? absint ( intval( $options["popup_title_border_radius_mobile"] ) ) : 0; |
| 4116 |
|
| 4117 |
// Width |
| 4118 |
$popup_survey_width = (isset($options['width']) && $options['width'] != '') ? absint ( intval( $options['width'] ) ) : 800; |
| 4119 |
// Width by percentage or pixels |
| 4120 |
$popup_survey_width_by = (isset($options['width_by_percentage_px']) && $options['width_by_percentage_px'] != '') ? stripslashes ( esc_attr( $options['width_by_percentage_px'] ) ) : 'pixels'; |
| 4121 |
|
| 4122 |
if( $popup_survey_width == '' || absint( $popup_survey_width ) == 0 ){ |
| 4123 |
$popup_survey_width = '100'; |
| 4124 |
$popup_survey_width_by = 'percentage'; |
| 4125 |
} |
| 4126 |
|
| 4127 |
// Mobile width |
| 4128 |
$options['width_mobile'] = isset($options['width_mobile']) ? $options['width_mobile'] : $popup_survey_width; |
| 4129 |
$popup_survey_width_mobile = (isset($options['width_mobile']) && $options['width_mobile'] != '') ? absint ( intval( $options['width_mobile'] ) ) : 800; |
| 4130 |
// Mobile width by percentage or pixels |
| 4131 |
$popup_survey_width_mobile_by = (isset($options['width_mobile_by_percentage_px']) && $options['width_mobile_by_percentage_px'] != '') ? stripslashes ( esc_attr( $options['width_mobile_by_percentage_px'] ) ) : 'pixels'; |
| 4132 |
|
| 4133 |
if( $popup_survey_width_mobile == '' || absint( $popup_survey_width_mobile ) == 0 ){ |
| 4134 |
$popup_survey_width_mobile = '100'; |
| 4135 |
$popup_survey_width_mobile_by = 'percentage'; |
| 4136 |
} |
| 4137 |
|
| 4138 |
// Height |
| 4139 |
$popup_survey_height = (isset($options['height']) && $options['height'] != '') ? absint ( intval( $options['height'] ) ) : 450; |
| 4140 |
// Height mobile |
| 4141 |
$options['height_mobile'] = isset($options['height_mobile']) ? $options['height_mobile'] : $popup_survey_height; |
| 4142 |
$popup_survey_height_mobile = (isset($options['height_mobile']) && $options['height_mobile'] != '') ? absint ( intval( $options['height_mobile'] ) ) : 450; |
| 4143 |
|
| 4144 |
// Popup Position |
| 4145 |
$popup_position = (isset($options['popup_position']) && $options['popup_position'] != 'center-center') ? $options['popup_position'] : 'center-center'; |
| 4146 |
|
| 4147 |
// Popup Margin |
| 4148 |
$popup_margin = (isset($options['popup_margin']) && $options['popup_margin'] != '') ? $options['popup_margin'] : '0'; |
| 4149 |
|
| 4150 |
$hide_popup = (isset($options['hide_popup']) && $options['hide_popup'] == 'on') ? $options['hide_popup'] : 'off'; |
| 4151 |
|
| 4152 |
// Hide popup after close |
| 4153 |
$hide_popup_after_close = (isset($options['hide_popup_after_close']) && $options['hide_popup_after_close'] == 'on') ? esc_attr($options['hide_popup_after_close']) : 'off'; |
| 4154 |
|
| 4155 |
// Hide popup on mobile |
| 4156 |
$options['hide_popup_on_mobile'] = isset( $options['hide_popup_on_mobile'] ) ? esc_attr($options['hide_popup_on_mobile']) : "off"; |
| 4157 |
$hide_popup_on_mobile = (isset($options['hide_popup_on_mobile']) && $options['hide_popup_on_mobile'] == 'on') ? true : false; |
| 4158 |
|
| 4159 |
// Hide popup on PC |
| 4160 |
$options['hide_popup_on_pc'] = isset( $options['hide_popup_on_pc'] ) ? esc_attr($options['hide_popup_on_pc']) : "off"; |
| 4161 |
$hide_popup_on_pc = (isset($options['hide_popup_on_pc']) && $options['hide_popup_on_pc'] == 'on') ? true : false; |
| 4162 |
|
| 4163 |
// Hide popup on tablet |
| 4164 |
$options['hide_popup_on_tablet'] = isset( $options['hide_popup_on_tablet'] ) ? esc_attr($options['hide_popup_on_tablet']) : "off"; |
| 4165 |
$hide_popup_on_tablet = (isset($options['hide_popup_on_tablet']) && $options['hide_popup_on_tablet'] == 'on') ? true : false; |
| 4166 |
|
| 4167 |
// Close by clicking outside the box |
| 4168 |
$close_popup_overlay_outside_click = (isset($options['close_popup_overlay_outside_click']) && $options['close_popup_overlay_outside_click'] == 'on') ? esc_attr($options['close_popup_overlay_outside_click']) : 'off'; |
| 4169 |
|
| 4170 |
// $survey_bg = (isset($survey_options['survey_background_color']) && $survey_options['survey_background_color'] != '') ? $survey_options['survey_background_color'] : '#ffffff'; |
| 4171 |
// $survey_theme = (isset($survey_options['survey_theme']) && $survey_options['survey_theme'] != '') ? $survey_options['survey_theme'] : 'classic_light'; |
| 4172 |
// $is_minimal = $survey_theme == 'minimal' ? true : false; |
| 4173 |
// $is_modern = $survey_theme == 'modern' ? true : false; |
| 4174 |
|
| 4175 |
// if( $is_minimal || $is_modern){ |
| 4176 |
// $survey_bg = '#ffffff'; |
| 4177 |
// } |
| 4178 |
|
| 4179 |
// $survey_text_color = (isset($survey_options['survey_text_color']) && $survey_options['survey_text_color'] != '') ? $survey_options['survey_text_color'] : '#ffffff'; |
| 4180 |
|
| 4181 |
// // Popup full screen mode |
| 4182 |
$survey_popup_full_screen = (isset($options["full_screen_mode"]) && $options["full_screen_mode"] == "on") ? true : false; |
| 4183 |
// // Popup background color |
| 4184 |
$popup_bg_color = (isset($options['popup_bg_color']) && $options['popup_bg_color'] != '') ? $options['popup_bg_color'] : '#ffffff'; |
| 4185 |
|
| 4186 |
// Popup background color | Mobile |
| 4187 |
$popup_bg_color_mobile = (isset($options['popup_bg_color_mobile']) && $options['popup_bg_color_mobile'] != '') ? esc_attr($options['popup_bg_color_mobile']) : $popup_bg_color; |
| 4188 |
|
| 4189 |
// // Popup trigger type |
| 4190 |
$popup_trigger_type = (isset($options["popup_trigger"]) && $options["popup_trigger"] != "") ? esc_attr($options["popup_trigger"]) : "on_load"; |
| 4191 |
|
| 4192 |
// Popup close after finish |
| 4193 |
$survey_enable_popup_close_after_finish = (isset($options["enable_popup_close_after_finish"]) && $options["enable_popup_close_after_finish"] == "on") ? true : false; |
| 4194 |
$survey_popup_close_after_finish_delay = (isset($options[ 'popup_close_after_finish_delay' ]) && $options[ 'popup_close_after_finish_delay' ] != '') ? absint ( intval( $options[ 'popup_close_after_finish_delay' ] ) ) : ''; |
| 4195 |
|
| 4196 |
// Popup selector |
| 4197 |
$popup_selector = (isset($options["popup_selector"]) && $options["popup_selector"] != "") ? stripslashes( esc_attr($options["popup_selector"])) : ""; |
| 4198 |
|
| 4199 |
// Close by pressing the ESC |
| 4200 |
$survey_popup_enable_close_by_esc = (isset($options["popup_enable_close_by_esc"]) && $options["popup_enable_close_by_esc"] != '') ? $options["popup_enable_close_by_esc"] : 'off'; |
| 4201 |
|
| 4202 |
|
| 4203 |
// if($show_all != 'all'){ |
| 4204 |
// if($post_id != false){ |
| 4205 |
// $post = get_post( $post_id ); |
| 4206 |
// $this_post_title = strval( $post->ID ); |
| 4207 |
// $except_posts = array(); |
| 4208 |
// $except_post_types = array(); |
| 4209 |
// $postType = $post->post_type; |
| 4210 |
|
| 4211 |
// if (isset($options['except_posts']) && !empty($options['except_posts'])) { |
| 4212 |
// $except_posts = $options['except_posts']; |
| 4213 |
// } |
| 4214 |
|
| 4215 |
// if (isset($options['except_post_types']) && !empty($options['except_post_types'])) { |
| 4216 |
// $except_post_types = $options['except_post_types']; |
| 4217 |
// } |
| 4218 |
|
| 4219 |
// $except_all_post_types = ( isset( $options['all_posts'] ) && ! empty( $options['all_posts'] ) ) ? $options['all_posts'] : array(); |
| 4220 |
|
| 4221 |
// if ( is_front_page() ) { |
| 4222 |
// if( isset($options['show_on_home_page']) && $options['show_on_home_page'] == 'on' ){ |
| 4223 |
// $show_popup = true; |
| 4224 |
// }else{ |
| 4225 |
// $show_popup = false; |
| 4226 |
// } |
| 4227 |
// } |
| 4228 |
|
| 4229 |
// if( in_array( $post_id . "", $except_posts ) ){ |
| 4230 |
// if( in_array( $show_all, $show ) ){ |
| 4231 |
// $show_popup = true; |
| 4232 |
// }else{ |
| 4233 |
// $show_popup = false; |
| 4234 |
// } |
| 4235 |
// }elseif( !in_array( $this_post_title, $except_posts ) && in_array( $postType, $except_all_post_types ) ) { |
| 4236 |
// if( in_array( $show_all, $show ) ){ |
| 4237 |
// $show_popup = true; |
| 4238 |
// }else{ |
| 4239 |
// $show_popup = false; |
| 4240 |
// } |
| 4241 |
// } |
| 4242 |
// } |
| 4243 |
// } |
| 4244 |
|
| 4245 |
if($hide_popup_on_mobile){ |
| 4246 |
if(Survey_Maker_Data::ays_survey_pb_detect_mobile_device() === true){ |
| 4247 |
$show_popup = false; |
| 4248 |
} |
| 4249 |
} |
| 4250 |
if($hide_popup_on_pc){ |
| 4251 |
if(Survey_Maker_Data::ays_survey_pb_detect_mobile_device() === false && Survey_Maker_Data::ays_survey_pb_detect_tablet_device() === false){ |
| 4252 |
$show_popup = false; |
| 4253 |
} |
| 4254 |
} |
| 4255 |
|
| 4256 |
if($hide_popup_on_tablet){ |
| 4257 |
if(Survey_Maker_Data::ays_survey_pb_detect_tablet_device() === true){ |
| 4258 |
$show_popup = false; |
| 4259 |
} |
| 4260 |
} |
| 4261 |
|
| 4262 |
switch($popup_trigger_type){ |
| 4263 |
case 'on_click': |
| 4264 |
$display_popup_on_load = 'display_none_not_important'; |
| 4265 |
break; |
| 4266 |
case 'on_load': |
| 4267 |
default: |
| 4268 |
$display_popup_on_load = ''; |
| 4269 |
break; |
| 4270 |
} |
| 4271 |
|
| 4272 |
if( ! isset( $_COOKIE[ 'ays_survey_popup_cookie_name_' . $popup['id'] ] ) && ! isset( $_COOKIE[ 'ays_survey_popup_hide_after_click_close_' . $popup['id'] ] ) ){ |
| 4273 |
if ($show_popup) { |
| 4274 |
$shortcode2 = '[ays_survey id="'. $popup['survey_id'] .'"]'; |
| 4275 |
// $popup_survey_view = "<div class='ays-survey-popup-survey-window ays-survey-popup-modal-".$popup['id']."' data-id='".$popup['id']."'> |
| 4276 |
$popup_survey_view = "<div class='ays-survey-popup-survey-window ays-survey-popup-modal-".$popup['id']." ".$display_popup_on_load."' data-id='".$popup['id']."' data-close-popup='".$survey_enable_popup_close_after_finish."'> |
| 4277 |
<div class='ays-survey-popup-btn-close'> |
| 4278 |
<img class='ays-survey-popup-btn-close-icon' src='". SURVEY_MAKER_PUBLIC_URL ."/images/cross.svg'> |
| 4279 |
</div>"; |
| 4280 |
$popup_survey_view .= "<div class='ays-survey-popup-content'>"; |
| 4281 |
if($survey_popup_enable_show_title){ |
| 4282 |
$popup_survey_view .= "<div class='ays-survey-popup-title-content'>".$popup_title."</div>"; |
| 4283 |
|
| 4284 |
} |
| 4285 |
if($survey_popup_full_screen){ |
| 4286 |
$popup_survey_view .= '<div class="ays-survey-popup-full-screen-mode"> |
| 4287 |
<a class="ays-survey-popup-full-screen-container"> |
| 4288 |
<svg xmlns="http://www.w3.org/2000/svg" height="24" fill="#000" viewBox="0 0 24 24" width="24" tabindex="0" class="ays-survey-popup-close-full-screen"> |
| 4289 |
<path d="M0 0h24v24H0z" fill="none"/> |
| 4290 |
<path d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"/> |
| 4291 |
</svg> |
| 4292 |
<svg xmlns="http://www.w3.org/2000/svg" height="24" fill="#000" viewBox="0 0 24 24" width="24" class="ays-survey-popup-open-full-screen"> |
| 4293 |
<path d="M0 0h24v24H0z" fill="none"/> |
| 4294 |
<path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/> |
| 4295 |
</svg> |
| 4296 |
</a> |
| 4297 |
</div>'; |
| 4298 |
} |
| 4299 |
$popup_survey_view .= "<div class='ays-survey-popup-main'>".do_shortcode($shortcode2)."</div> |
| 4300 |
</div>"; |
| 4301 |
|
| 4302 |
$margin_right = ''; |
| 4303 |
$additional_css = ''; |
| 4304 |
switch ( $popup_position ){ |
| 4305 |
case "center-center": |
| 4306 |
$ays_survey_popup_conteiner_pos_top = '12px'; |
| 4307 |
$ays_survey_popup_conteiner_pos_left = '0'; |
| 4308 |
$ays_survey_popup_conteiner_pos_right = '0'; |
| 4309 |
$ays_survey_popup_conteiner_pos_bottom = '0'; |
| 4310 |
$popup_margin = 'auto'; |
| 4311 |
$additional_css = 'max-height: calc( 100vh - 12px )'; |
| 4312 |
break; |
| 4313 |
case "left-top": |
| 4314 |
|
| 4315 |
$ays_survey_popup_conteiner_pos_top = '0'; |
| 4316 |
$ays_survey_popup_conteiner_pos_left = '0'; |
| 4317 |
$ays_survey_popup_conteiner_pos_right = 'unset'; |
| 4318 |
$ays_survey_popup_conteiner_pos_bottom = 'unset'; |
| 4319 |
$popup_margin = 'px'; |
| 4320 |
|
| 4321 |
if( absint( $popup_margin ) < 12 ){ |
| 4322 |
$margin_right = 'margin-top: 12px;'; |
| 4323 |
} |
| 4324 |
break; |
| 4325 |
case "top-center": |
| 4326 |
|
| 4327 |
$ays_survey_popup_conteiner_pos_top = '0'; |
| 4328 |
$ays_survey_popup_conteiner_pos_left = '50%'; |
| 4329 |
$ays_survey_popup_conteiner_pos_right = 'unset'; |
| 4330 |
$ays_survey_popup_conteiner_pos_bottom = 'unset'; |
| 4331 |
$popup_margin = 'px auto'; |
| 4332 |
$additional_css = 'transform: translateX(-50%);'; |
| 4333 |
|
| 4334 |
if( absint( $popup_margin ) < 12 ){ |
| 4335 |
$margin_right = 'margin-top: 12px;'; |
| 4336 |
} |
| 4337 |
break; |
| 4338 |
case "right-top": |
| 4339 |
|
| 4340 |
$ays_survey_popup_conteiner_pos_top = '0'; |
| 4341 |
$ays_survey_popup_conteiner_pos_left = 'unset'; |
| 4342 |
$ays_survey_popup_conteiner_pos_right = '0'; |
| 4343 |
$ays_survey_popup_conteiner_pos_bottom = 'unset'; |
| 4344 |
$popup_margin .= 'px'; |
| 4345 |
if( absint( $popup_margin ) < 12 ){ |
| 4346 |
$margin_right = 'margin-right: 12px;margin-top: 12px;'; |
| 4347 |
} |
| 4348 |
|
| 4349 |
break; |
| 4350 |
case "left-center": |
| 4351 |
|
| 4352 |
$ays_survey_popup_conteiner_pos_top = '0'; |
| 4353 |
$ays_survey_popup_conteiner_pos_left = '0'; |
| 4354 |
$ays_survey_popup_conteiner_pos_right = 'unset'; |
| 4355 |
$ays_survey_popup_conteiner_pos_bottom = '0'; |
| 4356 |
$popup_margin = 'auto ' . $popup_margin . 'px'; |
| 4357 |
|
| 4358 |
break; |
| 4359 |
case "right-center": |
| 4360 |
|
| 4361 |
$ays_survey_popup_conteiner_pos_top = '0'; |
| 4362 |
$ays_survey_popup_conteiner_pos_left = 'unset'; |
| 4363 |
$ays_survey_popup_conteiner_pos_right = '0'; |
| 4364 |
$ays_survey_popup_conteiner_pos_bottom = '0'; |
| 4365 |
$popup_margin = 'auto ' . $popup_margin . 'px'; |
| 4366 |
|
| 4367 |
if( absint( $popup_margin ) < 12 ){ |
| 4368 |
$margin_right = 'margin-right: 12px;'; |
| 4369 |
} |
| 4370 |
break; |
| 4371 |
case "right-bottom": |
| 4372 |
|
| 4373 |
$ays_survey_popup_conteiner_pos_top = 'unset'; |
| 4374 |
$ays_survey_popup_conteiner_pos_left = 'unset'; |
| 4375 |
$ays_survey_popup_conteiner_pos_right = '0'; |
| 4376 |
$ays_survey_popup_conteiner_pos_bottom = '0'; |
| 4377 |
$popup_margin = 'px'; |
| 4378 |
|
| 4379 |
if( absint( $popup_margin ) < 12 ){ |
| 4380 |
$margin_right = 'margin-right: 12px;'; |
| 4381 |
} |
| 4382 |
break; |
| 4383 |
case "center-bottom": |
| 4384 |
|
| 4385 |
$ays_survey_popup_conteiner_pos_top = 'unset'; |
| 4386 |
$ays_survey_popup_conteiner_pos_left = '50%'; |
| 4387 |
$ays_survey_popup_conteiner_pos_right = 'unset'; |
| 4388 |
$ays_survey_popup_conteiner_pos_bottom = '0'; |
| 4389 |
$popup_margin = 'px auto'; |
| 4390 |
$additional_css = 'transform: translateX(-50%);'; |
| 4391 |
|
| 4392 |
break; |
| 4393 |
case "left-bottom": |
| 4394 |
|
| 4395 |
$ays_survey_popup_conteiner_pos_top = 'unset'; |
| 4396 |
$ays_survey_popup_conteiner_pos_left = '0'; |
| 4397 |
$ays_survey_popup_conteiner_pos_right = 'unset'; |
| 4398 |
$ays_survey_popup_conteiner_pos_bottom = '0'; |
| 4399 |
$popup_margin = 'px'; |
| 4400 |
|
| 4401 |
break; |
| 4402 |
} |
| 4403 |
|
| 4404 |
$hide_popup_on_mobile_class = $survey_popup_hide_title_on_mobile ? 'display: none;' : ''; |
| 4405 |
|
| 4406 |
$popup_survey_view .= ' |
| 4407 |
<style> |
| 4408 |
.ays-survey-popup-modal-' . $popup['id'] . ' { |
| 4409 |
width: ' . $popup_survey_width . ($popup_survey_width_by == 'percentage' ? '%' : 'px') . '; |
| 4410 |
height: ' . $popup_survey_height . 'px; |
| 4411 |
background-color: ' . $popup_bg_color . '; |
| 4412 |
top: ' . $ays_survey_popup_conteiner_pos_top . '; |
| 4413 |
left: ' . $ays_survey_popup_conteiner_pos_left . '; |
| 4414 |
right: ' . $ays_survey_popup_conteiner_pos_right . '; |
| 4415 |
bottom: ' . $ays_survey_popup_conteiner_pos_bottom . '; |
| 4416 |
margin: ' . $popup_margin . '; |
| 4417 |
' . $margin_right . ' |
| 4418 |
' . $additional_css . ' |
| 4419 |
} |
| 4420 |
|
| 4421 |
.ays-survey-popup-modal-' . $popup['id'] . ' .ays-survey-popup-title-content{ |
| 4422 |
background-color: '.$survey_popup_title_bg_color.'; |
| 4423 |
color: '.$survey_popup_title_text_color.'; |
| 4424 |
font-size: '.$survey_popup_title_font_size.'px; |
| 4425 |
text-align: '.$survey_popup_title_alignment.'; |
| 4426 |
text-transform: '.$survey_popup_title_transform.'; |
| 4427 |
letter-spacing: '.$survey_popup_title_letter_spacing.'px; |
| 4428 |
line-height: 2; |
| 4429 |
border-radius: '.$survey_popup_title_border_radius.'px; |
| 4430 |
padding: 0 10px; |
| 4431 |
} |
| 4432 |
|
| 4433 |
@media screen and (max-width: 640px){ |
| 4434 |
div.ays-survey-popup-modal-' . $popup['id'] . ' { |
| 4435 |
width: ' . $popup_survey_width_mobile . ($popup_survey_width_mobile_by == 'percentage' ? '%' : 'px') . '; |
| 4436 |
height: ' . $popup_survey_height_mobile . 'px; |
| 4437 |
background-color: ' . $popup_bg_color_mobile . '; |
| 4438 |
} |
| 4439 |
.ays-survey-popup-modal-' . $popup['id'] . ' .ays-survey-popup-title-content{ |
| 4440 |
font-size: '.$survey_popup_title_mobile_font_size.'px; |
| 4441 |
color: '.$survey_popup_title_text_color_mobile.'; |
| 4442 |
background-color: '.$survey_popup_title_bg_color_mobile.'; |
| 4443 |
'.$hide_popup_on_mobile_class.'; |
| 4444 |
letter-spacing: '.$survey_popup_title_letter_spacing_on_mobile.'px; |
| 4445 |
text-align: '.$survey_popup_title_alignment_on_mobile.'; |
| 4446 |
text-transform: '.$survey_popup_title_transform_mobile.'; |
| 4447 |
border-radius: '.$survey_popup_title_border_radius_mobile.'px; |
| 4448 |
} |
| 4449 |
} |
| 4450 |
|
| 4451 |
</style> |
| 4452 |
'; |
| 4453 |
|
| 4454 |
$popup_survey_view .= '<script type="text/javascript">'; |
| 4455 |
|
| 4456 |
$popup_survey_view .= " |
| 4457 |
if(typeof aysSurveyPopupsOptions === 'undefined'){ |
| 4458 |
var aysSurveyPopupsOptions = []; |
| 4459 |
} |
| 4460 |
aysSurveyPopupsOptions['" . $popup['id'] . "'] = '" . base64_encode( json_encode( array( |
| 4461 |
'hidePopup' => $hide_popup, |
| 4462 |
'hidePopupAfterClose' => $hide_popup_after_close, |
| 4463 |
'popup_trigger' => $popup_trigger_type, |
| 4464 |
'enable_popup_close_after_finish' => $survey_enable_popup_close_after_finish, |
| 4465 |
'popup_close_after_finish_delay' => $survey_popup_close_after_finish_delay, |
| 4466 |
'popup_selector' => $popup_selector, |
| 4467 |
'popupEnableCloseByEsc' => $survey_popup_enable_close_by_esc, |
| 4468 |
'closePopupOverlayOutsideClick' => $close_popup_overlay_outside_click, |
| 4469 |
|
| 4470 |
) ) ) . "';"; |
| 4471 |
$popup_survey_view .= '</script>'; |
| 4472 |
$popup_survey_view .= '</div>'; |
| 4473 |
|
| 4474 |
return $popup_survey_view; |
| 4475 |
} |
| 4476 |
} |
| 4477 |
} |
| 4478 |
} |
| 4479 |
|
| 4480 |
|
| 4481 |
public function ays_shortcodes_show_all(){ |
| 4482 |
global $wpdb; |
| 4483 |
$post_id = get_the_ID(); |
| 4484 |
$popup_surveys_table = $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "popup_surveys"; |
| 4485 |
$surveys_table = $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "surveys"; |
| 4486 |
$sql = "SELECT p_s.*, s.options as s_options, s.status as survey_status |
| 4487 |
FROM {$popup_surveys_table} as p_s |
| 4488 |
LEFT JOIN {$surveys_table} AS s |
| 4489 |
ON p_s.survey_id = s.id |
| 4490 |
WHERE p_s.status = 'published'"; |
| 4491 |
$result = $wpdb->get_results( $sql, "ARRAY_A" ); |
| 4492 |
|
| 4493 |
foreach($result as $key => $value){ |
| 4494 |
echo do_shortcode('[ays_survey_popup id="'. $value['id'] .'"]'); |
| 4495 |
} |
| 4496 |
} |
| 4497 |
|
| 4498 |
public function checkNextButtonVisibility($other_answers_count, $question_type){ |
| 4499 |
return ($other_answers_count === 0 && $question_type === 0 && $this->options[ $this->name_prefix . 'disable_next_button' ]); |
| 4500 |
} |
| 4501 |
} |
| 4502 |
|