PluginProbe
Survey Maker by AYS / 5.2.2.6
Survey Maker by AYS v5.2.2.6
5.2.4.1 5.2.4.0 5.2.3.9 5.2.3.8 5.2.3.7 5.2.3.6 5.2.3.5 5.2.3.4 5.2.3.3 5.2.3.2 5.2.3.1 5.2.3.0 5.2.2.9 5.2.2.8 5.2.2.7 5.2.2.6 5.2.2.5 5.2.2.4 5.2.2.3 5.2.2.2 5.2.2.1 5.2.2.0 5.2.1.9 5.2.1.8 5.2.0.8 All 154 releases
survey-maker / public / class-survey-maker-public.php

class-survey-maker-public.php in Survey Maker by AYS 5.2.2.6, at public/class-survey-maker-public.php

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