PluginProbe
Survey Maker by AYS / 5.2.2.7
Survey Maker by AYS v5.2.2.7
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.7, at public/class-survey-maker-public.php

4,332 lines 263.8 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 $footer_class_with_terms = "";
1517 $enable_terms_and_conditions = $this->options[ $this->name_prefix . 'enable_terms_and_conditions' ];
1518 $terms_and_conditions_data = $this->options[ $this->name_prefix . 'terms_and_conditions_data' ];
1519 if($this->options[ $this->name_prefix . 'enable_progress_bar' ] == "on"){
1520 $footer_class_with_bar = "ays-survey-footer-with-live-bar";
1521 }
1522
1523 $enable_terms_and_conditions_required_message = $this->options['enable_terms_and_conditions_required_message'];
1524 if($enable_terms_and_conditions){
1525
1526 $footer_class_with_terms = "ays-survey-footer-with-terms-and-conds";
1527 }
1528
1529 $content[] = '<div class="' . $this->html_class_prefix . 'section-footer '.$footer_class_with_bar.' '.$footer_class_with_terms.'">';
1530
1531 if( $last ){
1532 if( $enable_terms_and_conditions ) {
1533 $content[] = '<div data-required="true" data-all-terms-check="true" data-type="checkbox" class="' . $this->html_class_prefix . 'section-terms-and-conditions-container">';
1534 $content[] = '<div class="' . $this->html_class_prefix . 'section-terms-and-conditions-content">';
1535 $padding_for_bussines = $this->options[ $this->name_prefix . 'is_business' ] ? 'style="padding:0 10px 3px;"' : '';
1536 foreach ($terms_and_conditions_data as $tc_text => $tc_text_value) {
1537 if( $tc_text_value['messages'] != '' ){
1538 $content[] = '<div class="' . $this->html_class_prefix . 'terms-and-conditions-content-box" '.$padding_for_bussines.'>';
1539 $content[] = '<label class="' . $this->html_class_prefix . 'answer-label ' . $this->html_class_prefix . 'answer-label-terms-conditions">';
1540 if($this->options[ $this->name_prefix . 'is_business' ]){
1541 $content[] = '<input type="checkbox" class="' . $this->html_class_prefix . 'is-checked-terms-and-conditions ' . $this->html_class_prefix . 'business-theme-answers">';
1542 $content[] = '<span class="' . $this->html_name_prefix . 'maker-checkmark ' . $this->html_name_prefix . 'maker-checkmark-checkbox" style="top:18px"></span>';
1543 }else{
1544 $content[] = '<input type="checkbox" class="' . $this->html_class_prefix . 'is-checked-terms-and-conditions">';
1545 }
1546 $content[] = '<div class="' . $this->html_class_prefix . 'answer-label-content">';
1547 $content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content">';
1548 $content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-ink"></div>';
1549 $content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content-1">';
1550 $content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content-2">';
1551 $content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content-3"></div>';
1552 $content[] = '</div>';
1553 $content[] = '</div>';
1554 $content[] = '</div>';
1555 $content[] = '<div class="' . $this->html_class_prefix . 'section-terms-and-conditions">';
1556 $content[] = '<span class="">' . stripslashes(($tc_text_value['messages'])) . '</span>';
1557 $content[] = '</div>';
1558 $content[] = '</div>';
1559 $content[] = '</label>';
1560
1561 $content[] = '</div>';
1562 }
1563 }
1564 $content[] = '</div>';
1565 if($enable_terms_and_conditions_required_message){
1566 $content[] = '<div class="' . $this->html_class_prefix . 'section-terms-and-conditions-required-message-content" style="display:none;">';
1567 $content[] = '<p class="' . $this->html_class_prefix . 'section-terms-and-conditions-required-message">';
1568 $content[] = '<span class="">' . __('By clicking on the checkbox, you agree to our Terms and Conditions', "survey-maker") . '</span>';
1569 $content[] = '</p>';
1570 $content[] = '</div>';
1571 }
1572 $content[] = '</div>';
1573 }
1574 }
1575 $content[] = '<div class="' . $this->html_class_prefix . 'section-buttons">';
1576
1577 if( ! $first ){
1578 if( $this->options[ $this->name_prefix . 'enable_previous_button' ] ){
1579 $content[] = '<div class="' . $this->html_class_prefix . 'section-button-container" tabindex="0">';
1580 $content[] = '<div class="' . $this->html_class_prefix . 'section-button-content">';
1581 $content[] = '<input type="button" class="' . $this->html_class_prefix . 'section-button ' . $this->html_class_prefix . 'prev-button" value="'. $this->buttons_texts[ 'previousButton' ] .'" />';
1582 $content[] = '</div>';
1583 $content[] = '</div>';
1584 }
1585 }
1586
1587 $content[] = '<div class="' . $this->html_class_prefix . 'section-button-container" tabindex="0">';
1588 $content[] = '<div class="' . $this->html_class_prefix . 'section-button-content">';
1589 if( $last ){
1590 $content[] = '<input type="button" class="' . $this->html_class_prefix . 'section-button ' . $this->html_class_prefix . 'finish-button" value="'. $this->buttons_texts[ 'finishButton' ] .'" />';
1591 }else{
1592 $disalble_next_button_class = $this->checkNextButtonVisibility($other_answer_count, $check_question_type_for_next_button) ? 'display_none_important' : '';
1593 $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' ] .'" />';
1594 }
1595 $content[] = '</div>';
1596 $content[] = '</div>';
1597 $content[] = '</div>';
1598
1599 if($this->options[ $this->name_prefix . 'enable_progress_bar' ] == "on"){
1600 $page_fill_percent = (1*100)/$section_count;
1601 $content[] = "<div class='" . $this->html_class_prefix . "live-bar-main'>";
1602 if(!($this->options[ $this->name_prefix . 'hide_section_bar' ])){
1603 $content[] = "<div class='" . $this->html_class_prefix . "live-bar-wrap'>
1604 <div class='" . $this->html_class_prefix . "live-bar-fill' style='width: ".$page_fill_percent."%;'></div>
1605 </div>";
1606 }
1607 if(!($this->options[ $this->name_prefix . 'hide_section_pagination_text' ])){
1608 $content[] = "<div class='" . $this->html_class_prefix . "live-bar-status'>
1609 <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>
1610 </div>";
1611 }
1612 $content[] = "</div>";
1613 }
1614
1615 $content[] = '</div>';
1616
1617 $content[] = '</div>';
1618
1619 $content = implode( '', $content );
1620
1621 return $content;
1622 }
1623
1624 public function create_question( $question , $numbering, $loop_count ){
1625
1626 $question_type = $question['type'];
1627 $answers = $question['answers'];
1628 $answers_html = array();
1629 $is_required = isset( $question['options']['required'] ) && $question['options']['required'] == 'on' ? true : false;
1630 $image_caption = isset($question['options']['image_caption']) ? $question['options']['image_caption'] : '';
1631 $image_caption_enable = $question['options']['image_caption_enable'];
1632 $is_minimum = "false";
1633 if($question_type == 'checkbox'){
1634 if(isset($question['options']['enable_max_selection_count']) && $question['options']['enable_max_selection_count'])
1635 $is_minimum = isset($question['options']['min_selection_count']) && $question['options']['min_selection_count'] != "" ? "true" : "false";
1636 }
1637
1638 // Admin note
1639 $enable_admin_note = $question['options']['enable_admin_note'];
1640 $admin_note = $question['options']['admin_note'];
1641
1642 // Logo Image URL
1643 $survey_logo_url_validate = "javascript:void(0)";
1644 $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' ] : "";
1645 $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;
1646 $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;
1647 $survey_logo_target = "";
1648 if($survey_logo_url_check){
1649 $survey_logo_url_validate = filter_var($survey_logo_url, FILTER_VALIDATE_URL) ? $survey_logo_url : $survey_logo_url_validate;
1650 if(filter_var($survey_logo_url, FILTER_VALIDATE_URL) && $survey_logo_url_check_new_tab){
1651 $survey_logo_target = "target='_blank'";
1652 }
1653 }
1654 //
1655 if( $this->options[ $this->name_prefix . 'enable_randomize_answers' ] ){
1656 shuffle( $question['answers'] );
1657 shuffle( $answers );
1658 }
1659
1660 $other_answer = $question['user_variant'];
1661 if( $other_answer ){
1662 $answers[] = array(
1663 'id' => '0',
1664 'question_id' => $question['id'],
1665 'answer' => '',
1666 'image' => '',
1667 'ordering' => count( $answers ) + 1,
1668 'placeholder' => '',
1669 'is_other' => true,
1670 );
1671 }
1672
1673 $answers['is_first_question'] = $loop_count;
1674 $question['answers']['is_first_question'] = $loop_count;
1675 $is_lazy_loading = ($loop_count > 1) ? $this->lazy_loading : "";
1676 $show_answers_numbering = $this->options[ $this->name_prefix . 'auto_numbering' ];
1677 $this->options[ $this->name_prefix . 'numbering_array' ] = Survey_Maker_Data::ays_survey_numbering_all( $show_answers_numbering );
1678
1679 $minimal_theme_question = $this->options[ $this->name_prefix . 'is_minimal' ] ? 'ays-survey-minimal-theme-question' : "";
1680 $modern_theme_question = $this->options[ $this->name_prefix . 'is_modern' ] ? 'ays-survey-modern-theme-question' : "";
1681
1682 $has_answer_image = false;
1683 foreach ($answers as $key => $answer) {
1684 if(isset( $answer['image'] ) && $answer['image'] != ""){
1685 $has_answer_image = true;
1686 }
1687 }
1688
1689 $question_types = array(
1690 "radio",
1691 "checkbox",
1692 "select",
1693 "star",
1694 "date",
1695 "time",
1696 "date_time",
1697 "text",
1698 "short_text",
1699 "number",
1700 "phone",
1701 "email",
1702 "name",
1703 );
1704
1705 $question_types_getting_answers_array = array(
1706 "radio",
1707 "checkbox",
1708 );
1709
1710 if( !in_array( $question_type, $question_types ) ){
1711 $question_type = "radio";
1712 }
1713
1714
1715 $question_type_function = 'ays_survey_question_type_' . strtoupper( $question_type ) . '_html';
1716
1717 $transmitting_array = in_array( $question_type, $question_types_getting_answers_array ) ? $answers : $question;
1718
1719 $answers_html[] = $this->$question_type_function( $transmitting_array );
1720
1721 $answers_html = implode( '', $answers_html );
1722
1723 $answer_grid = '';
1724 if( $has_answer_image || $this->options[ $this->name_prefix . 'answers_view' ] == 'grid' ){
1725 $answer_grid = $this->html_class_prefix . 'question-answers-grid';
1726 }
1727 $data_required = $is_required ? "true" : "false";
1728
1729 $is_required_field = $is_required ? '<sup class="' . $this->html_class_prefix . 'question-required-icon">*</sup>' : "";
1730
1731
1732 $question_title = Survey_Maker_Data::survey_sanitize_specific_content($question['question']);
1733 if($numbering){
1734 preg_match('/<([a-z]+[1-9]*)\b[^>]*>(.*?)<\/\1>/', $question_title, $matches );
1735 if(empty($matches)){
1736 $question_title = $numbering . $question_title;
1737 }else{
1738 $question_title_numbering_1 = $numbering . $matches[2];
1739 $question_title_numbering_2 = str_replace( $matches[2], $question_title_numbering_1, $matches[0] );
1740 $question_title = str_replace( $matches[0], $question_title_numbering_2, $question_title );
1741 }
1742 }
1743
1744 if ( $is_required_field != "" ) {
1745 preg_match('/<([a-z]+[1-9]*)\b[^>]*>(.*?)<\/\1>/', $question_title, $matches );
1746 if(empty($matches)){
1747 $question_title = $question_title . $is_required_field;
1748 }else{
1749 $question_title_numbering_1 = $matches[2] . $is_required_field;
1750 $question_title_numbering_2 = str_replace( $matches[2], $question_title_numbering_1, $matches[0] );
1751 $question_title = str_replace( $matches[0], $question_title_numbering_2, $question_title );
1752 }
1753 }
1754
1755 $content = array();
1756 $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.'">';
1757
1758 $content[] = '<div class="' . $this->html_class_prefix . 'question-header">';
1759
1760 $content[] = '<div class="' . $this->html_class_prefix . 'question-header-content">';
1761
1762 $content[] = '<div class="' . $this->html_class_prefix . 'question-title">' . Survey_Maker_Data::ays_autoembed( $question_title );
1763
1764 $content[] = '</div>';
1765
1766 $content[] = '</div>';
1767
1768 if( isset( $question['image'] ) && $question['image'] != "" ){
1769 $content[] = '<div class="' . $this->html_class_prefix . 'question-image-container">';
1770 $surve_question_image_alt_text = Survey_Maker_Data::ays_survey_get_image_id_by_url($question['image']);
1771 $content[] = '<img class="' . $this->html_class_prefix . 'question-image" src="' . $question['image'] . '" alt="' . $surve_question_image_alt_text . '" '.$is_lazy_loading.' />';
1772 if($image_caption_enable){
1773 $content[] = '<div class="' . $this->html_class_prefix . 'question-image-caption">';
1774 $content[] = '<span>'.$image_caption.'</span>';
1775 $content[] = '</div>';
1776 }
1777 $content[] = '</div>';
1778 }
1779
1780 $content[] = '</div>';
1781
1782 $content[] = '<div class="' . $this->html_class_prefix . 'question-content">';
1783
1784 $content[] = '<div class="' . $this->html_class_prefix . 'question-answers ' . $answer_grid . '">';
1785
1786 $content[] = $answers_html;
1787
1788 $content[] = '<input type="hidden" name="' . $this->html_name_prefix . 'questions-' . $this->unique_id . '[' . $question['id'] . '][section]" value="' . $question['section_id'] . '">';
1789 $content[] = '<input type="hidden" name="' . $this->html_name_prefix . 'questions-' . $this->unique_id . '[' . $question['id'] . '][questionType]" value="' . $question_type . '">';
1790 $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'] . '">';
1791
1792 if( $this->options[ $this->name_prefix . 'enable_clear_answer' ] ){
1793 $content[] = '<div class="' . $this->html_class_prefix . 'answer-clear-selection-container ' . $this->html_class_prefix . 'visibility-none transition fade">';
1794 $content[] = '<div class="' . $this->html_class_prefix . 'simple-button-container">';
1795 $content[] = '<div class="' . $this->html_class_prefix . 'button-content">';
1796 $content[] = '<span class="' . $this->html_class_prefix . 'answer-clear-selection-text ' . $this->html_class_prefix . 'button" tabindex="0">' . $this->buttons_texts[ 'clearButton' ] . '</span>';
1797 $content[] = '</div>';
1798 $content[] = '</div>';
1799 $content[] = '</div>';
1800 }
1801
1802 $content[] = '</div>';
1803
1804 $content[] = '</div>';
1805
1806 if( $enable_admin_note && $admin_note != "" ){
1807 $content[] = "<div class='" . $this->html_class_prefix . "admin-note-main'>
1808 <div class='" . $this->html_class_prefix . "admin-note-inner'><span class='" . $this->html_class_prefix . "admin-note-text'>" . $admin_note . "</span></div>
1809 </div>";
1810 }
1811
1812 $content[] = '<div class="' . $this->html_class_prefix . 'question-footer">';
1813 if($is_minimum == 'true'){
1814 $content[] = '<div class="' . $this->html_class_prefix . 'votes-count-validation-error" role="alert"></div>';
1815 }
1816 $content[] = '<div class="' . $this->html_class_prefix . 'question-validation-error" role="alert"></div>';
1817 if(isset($this->options[ $this->name_prefix . 'logo' ]) && $this->options[ $this->name_prefix . 'logo' ] != ""){
1818 $content[] = '<div class="' . $this->html_class_prefix . 'image-logo-url">
1819 <a href="'.$survey_logo_url_validate.'" '.$survey_logo_target.' style="display: inline-block;">
1820 <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">
1821 </a>
1822 </div>';
1823 }
1824 $content[] = '</div>';
1825
1826 $content[] = '</div>';
1827
1828 $content = implode( '', $content );
1829
1830 return $content;
1831 }
1832
1833 public function ays_survey_question_type_RADIO_html( $answers ){
1834
1835 $content = array();
1836
1837 $has_answer_image = false;
1838 foreach ($answers as $key => $answer) {
1839 if(isset( $answer['image'] ) && $answer['image'] != ""){
1840 $has_answer_image = true;
1841 }
1842 }
1843
1844 $answer_grid = '';
1845 $answer_label_grid = '';
1846 if( $has_answer_image || $this->options[ $this->name_prefix . 'answers_view' ] == 'grid' ){
1847 $answer_grid = $this->html_class_prefix . 'answer-grid';
1848 $answer_label_grid = $this->html_class_prefix . 'answer-label-grid';
1849 }
1850
1851 $is_first_question = $answers['is_first_question'];
1852 $is_lazy_loading = ($is_first_question > 1) ? $this->lazy_loading : "";
1853 unset($answers['is_first_question']);
1854
1855 foreach ($answers as $key => $answer) {
1856
1857 $is_other = false;
1858 if( isset( $answer['is_other'] ) && $answer['is_other'] == true ){
1859 $is_other = true;
1860 }
1861
1862 $answer_label_other = '';
1863 $other_answer_box_width = '';
1864 if( $is_other ){
1865 $answer_label_other = $this->html_class_prefix . 'answer-label-other';
1866 $other_answer_box_width = $this->html_class_prefix . 'other-answer-container';
1867 }
1868
1869 $content[] = '<div class="' . $this->html_class_prefix . 'answer ' . $answer_grid . ' '.$other_answer_box_width.'">';
1870
1871 $content[] = '<label class="' . $this->html_class_prefix . 'answer-label ' . $answer_label_grid . ' ' . $answer_label_other . '" tabindex="0">';
1872
1873 if( $this->options[$this->name_prefix . 'is_minimal'] ){
1874 if( isset( $answer['image'] ) && $answer['image'] != "" ){
1875 $content[] = '<div class="' . $this->html_class_prefix . 'answer-image-container">';
1876 $content[] = '<img class="' . $this->html_class_prefix . 'answer-image" '. $is_lazy_loading .' src="' . $answer['image'] . '" alt="' . stripslashes( $answer['answer'] ) . '" />';
1877 $content[] = '</div>';
1878 }
1879 if (!$is_other) {
1880 $content[] = '<input class="" type="radio" name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $answer['question_id'] . '][answer]" value="' . $answer['id'] . '">';
1881 } else {
1882 $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'] . '">';
1883 }
1884 }
1885 else{
1886
1887 $content[] = '<input class="" type="radio" name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $answer['question_id'] . '][answer]" value="' . $answer['id'] . '" autocomplete="off">';
1888
1889 if( isset( $answer['image'] ) && $answer['image'] != "" ){
1890 $content[] = '<div class="' . $this->html_class_prefix . 'answer-image-container">';
1891 $content[] = '<img class="' . $this->html_class_prefix . 'answer-image" src="' . $answer['image'] . '" alt="' . stripslashes( $answer['answer'] ) . '" '. $is_lazy_loading .' />';
1892 $content[] = '</div>';
1893 }
1894 }
1895
1896 $content[] = '<div class="' . $this->html_class_prefix . 'answer-label-content">';
1897
1898 $content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content">';
1899 $content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-ink"></div>';
1900 $content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content-1">';
1901 $content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content-2">';
1902 $content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content-3"></div>';
1903 $content[] = '</div>';
1904 $content[] = '</div>';
1905 $content[] = '</div>';
1906
1907 if( $is_other ){
1908 $content[] = '<span class="">' . __( 'Other', "survey-maker" ) . ':</span>';
1909 }else{
1910 if( ! empty( $this->options[ $this->name_prefix . 'numbering_array' ] ) ){
1911 $numebering_answer = $this->options[ $this->name_prefix . 'numbering_array' ][$key] . ' ';
1912 }else{
1913 $numebering_answer = '';
1914 }
1915 $content[] = '<span class="">' .$numebering_answer . $answer['answer'] . '</span>';
1916 }
1917
1918 $content[] = '</div>';
1919 $content[] = '</label>';
1920
1921 if( $is_other ){
1922
1923 $content[] = '<div class="' . $this->html_class_prefix . 'answer-other-text">';
1924 $content[] = '<input id="' . $this->html_class_prefix . 'answer-other-input-' . $answer['question_id'] . '" class="' . $this->html_class_prefix . 'answer-other-input ' .
1925 $this->html_class_prefix . 'remove-default-border ' .
1926 $this->html_class_prefix . 'question-input ' .
1927 $this->html_class_prefix . 'input
1928 ' . $this->html_class_prefix . 'answer-text-inputs"
1929 name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $answer['question_id'] . '][other]"
1930 type="text" autocomplete="off" tabindex="0" />';
1931 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline" style="margin:0;"></div>';
1932 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation" style="margin:0;"></div>';
1933 $content[] = '</div>';
1934
1935 }
1936
1937 $content[] = '</div>';
1938 }
1939
1940 $content = implode( '', $content );
1941
1942 return $content;
1943 }
1944
1945 public function ays_survey_question_type_CHECKBOX_html( $answers ){
1946 $content = array();
1947 $has_answer_image = false;
1948 foreach ($answers as $key => $answer) {
1949 if(isset( $answer['image'] ) && $answer['image'] != ""){
1950 $has_answer_image = true;
1951 }
1952 }
1953
1954 $answer_grid = '';
1955 $answer_label_grid = '';
1956 if( $has_answer_image || $this->options[ $this->name_prefix . 'answers_view' ] == 'grid' ){
1957 $answer_grid = $this->html_class_prefix . 'answer-grid';
1958 $answer_label_grid = $this->html_class_prefix . 'answer-label-grid';
1959 }
1960
1961 $is_first_question = $answers['is_first_question'];
1962 $is_lazy_loading = ($is_first_question > 1) ? $this->lazy_loading : "";
1963 unset($answers['is_first_question']);
1964 foreach ($answers as $key => $answer) {
1965
1966 $is_other = false;
1967 if( isset( $answer['is_other'] ) && $answer['is_other'] == true ){
1968 $is_other = true;
1969 }
1970
1971 $answer_label_other = '';
1972 $other_answer_box_width = '';
1973 if( $is_other ){
1974 $answer_label_other = $this->html_class_prefix . 'answer-label-other';
1975 $other_answer_box_width = $this->html_class_prefix . 'other-answer-container';
1976 }
1977
1978 $content[] = '<div class="' . $this->html_class_prefix . 'answer ' . $answer_grid . ' '.$other_answer_box_width.'">';
1979
1980 $content[] = '<label class="' . $this->html_class_prefix . 'answer-label ' . $answer_label_grid . ' ' . $answer_label_other . '" tabindex="0">';
1981
1982 if( $this->options[$this->name_prefix . 'is_minimal'] ){
1983 if( isset( $answer['image'] ) && $answer['image'] != "" ){
1984 $content[] = '<div class="' . $this->html_class_prefix . 'answer-image-container">';
1985 $content[] = '<img class="' . $this->html_class_prefix . 'answer-image" '. $is_lazy_loading .' src="' . $answer['image'] . '" alt="' . stripslashes( $answer['answer'] ) . '" />';
1986 $content[] = '</div>';
1987 }
1988
1989 $content[] = '<input class="" type="checkbox" name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $answer['question_id'] . '][answer][]" value="' . $answer['id'] . '">';
1990 }
1991 else{
1992 $content[] = '<input class="" type="checkbox" name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $answer['question_id'] . '][answer][]" value="' . $answer['id'] . '" autocomplete="off">';
1993
1994 if( isset( $answer['image'] ) && $answer['image'] != "" ){
1995 $content[] = '<div class="' . $this->html_class_prefix . 'answer-image-container">';
1996 $content[] = '<img class="' . $this->html_class_prefix . 'answer-image" src="' . $answer['image'] . '" '. $is_lazy_loading .' alt="' . stripslashes( $answer['answer'] ) . '" />';
1997 $content[] = '</div>';
1998 }
1999 }
2000
2001 $content[] = '<div class="' . $this->html_class_prefix . 'answer-label-content">';
2002
2003 $content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content">';
2004 $content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-ink"></div>';
2005 $content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content-1">';
2006 $content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content-2">';
2007 $content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content-3"></div>';
2008 $content[] = '</div>';
2009 $content[] = '</div>';
2010 $content[] = '</div>';
2011
2012 if( $is_other ){
2013 $content[] = '<span class="">' . __( 'Other', "survey-maker" ) . ':</span>';
2014 }else{
2015 if( ! empty( $this->options[ $this->name_prefix . 'numbering_array' ] ) ){
2016 $numebering_answer = $this->options[ $this->name_prefix . 'numbering_array' ][$key] . ' ';
2017 }else{
2018 $numebering_answer = '';
2019 }
2020 $content[] = '<span class="">' . $numebering_answer . $answer['answer'] . '</span>';
2021 }
2022
2023 $content[] = '</div>';
2024 $content[] = '</label>';
2025
2026 if( $is_other ){
2027
2028 $content[] = '<div class="' . $this->html_class_prefix . 'answer-other-text">';
2029 $content[] = '<input id="' . $this->html_class_prefix . 'answer-other-input-' . $answer['question_id'] . '" class="' . $this->html_class_prefix . 'answer-other-input ' .
2030 $this->html_class_prefix . 'remove-default-border ' .
2031 $this->html_class_prefix . 'question-input ' .
2032 $this->html_class_prefix . 'input
2033 ' . $this->html_class_prefix . 'answer-text-inputs"
2034 name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $answer['question_id'] . '][other]"
2035 type="text" autocomplete="off" tabindex="0" />';
2036 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline" style="margin:0;"></div>';
2037 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation" style="margin:0;"></div>';
2038 $content[] = '</div>';
2039
2040 }
2041
2042 $content[] = '</div>';
2043 }
2044
2045 $content = implode( '', $content );
2046
2047 return $content;
2048 }
2049
2050 public function ays_survey_question_type_SELECT_html( $question ){
2051 $content = array();
2052
2053 $is_first_question = $question['answers']['is_first_question'];
2054 $is_lazy_loading = ($is_first_question > 1) ? $this->lazy_loading : "";
2055 unset($question['answers']['is_first_question']);
2056 $select_class = $this->html_class_prefix . 'question-select-conteiner-minimal';
2057 if( $this->options[$this->name_prefix . 'is_minimal']){
2058 $content[] = '<div class="' . $this->html_class_prefix . 'answer">';
2059 $content[] = '<div class="' . $this->html_class_prefix . 'question-type-select-box">';
2060 $content[] = '<div class="' . $this->html_class_prefix . 'question-select-conteiner">';
2061 $content[] = '<select class="' . $select_class . '"
2062 name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . ']">';
2063 foreach ( $question['answers'] as $key => $answer ) {
2064
2065 $content[] = "<option value='" . $answer['id'] . "' >";
2066 if( ! empty( $this->options[ $this->name_prefix . 'numbering_array' ] ) ){
2067 $numebering_answer = $this->options[ $this->name_prefix . 'numbering_array' ][$key] . ' ';
2068 }else{
2069 $numebering_answer = '';
2070 }
2071 $content[] = $numebering_answer . stripslashes( $answer['answer'] );
2072 $content[] = '</option>';
2073 }
2074 $content[] = '</select>';
2075 $content[] = '</div>';
2076 $content[] = '</div>';
2077 $content[] = '</div>';
2078 }
2079 else{
2080 $content[] = '<div class="' . $this->html_class_prefix . 'answer">';
2081
2082 $content[] = '<div class="' . $this->html_class_prefix . 'question-type-select-box">';
2083 $content[] = '<div class="' . $this->html_class_prefix . 'question-select-conteiner">';
2084
2085 $content[] = '<div class="' . $this->html_class_prefix . 'question-select ui selection icon dropdown">';
2086
2087 $content[] = '<input type="hidden" class="' . $this->html_name_prefix . 'detect-selected-question-dropdown" name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . ']">';
2088
2089 $content[] = '<i class="dropdown icon"></i>';
2090 $content[] = '<div class="default text">'.__('Choose', "survey-maker").'</div>';
2091
2092 $content[] = '<div class="menu">';
2093
2094 foreach ( $question['answers'] as $key => $answer ) {
2095 $content[] = '<div class="item" data-value="'. $answer['id'] .'">';
2096
2097 if( isset( $answer['image'] ) && $answer['image'] != "" ){
2098 $content[] = '<img class="' . $this->html_class_prefix . 'answer-image" src="' . $answer['image'] . '" alt="' . stripslashes( $answer['answer'] ) . '" '. $is_lazy_loading .' />';
2099 }
2100
2101 if( ! empty( $this->options[ $this->name_prefix . 'numbering_array' ] ) ){
2102 $numebering_answer = $this->options[ $this->name_prefix . 'numbering_array' ][$key] . ' ';
2103 }else{
2104 $numebering_answer = '';
2105 }
2106
2107 $content[] = $numebering_answer . stripslashes( $answer['answer'] );
2108
2109 $content[] = '</div>';
2110 }
2111
2112 $content[] = '</div>';
2113 $content[] = '</div>';
2114
2115 $content[] = '</div>';
2116 $content[] = '</div>';
2117
2118 $content[] = '</div>';
2119 }
2120
2121 $content = implode( '', $content );
2122
2123 return $content;
2124 }
2125
2126
2127 public function ays_survey_question_type_STAR_html( $question ){
2128 $content = array();
2129
2130 //checked Input
2131 $enable_url_parameter = isset($question['options']['enable_url_parameter']) && $question['options']['enable_url_parameter'] == true ? true : false;
2132 $url_parameter = $enable_url_parameter && isset($question['options']['url_parameter']) && $question['options']['url_parameter'] != "" ? $question['options']['url_parameter'] : '';
2133 $selected_input = isset($_GET[$url_parameter]) && $_GET[$url_parameter] ? $_GET[$url_parameter] : '';
2134
2135 $star_label_1 = (isset($question['options']['star_1']) && $question['options']['star_1'] != '') ? $question['options']['star_1'] : '';
2136 $star_label_2 = (isset($question['options']['star_2']) && $question['options']['star_2'] != '') ? $question['options']['star_2'] : '';
2137 $star_scale_length = (isset($question['options']['star_scale_length']) && $question['options']['star_scale_length'] != '') ? absint( $question['options']['star_scale_length'] ) : 5;
2138
2139 $content[] = '<div class="' . $this->html_class_prefix . 'answer-star">';
2140
2141 $content[] = '<label class="' . $this->html_class_prefix . 'answer-star-label">';
2142 $content[] = '<div class="' . $this->html_class_prefix . 'answer-star-radio-label" dir="auto"></div>';
2143 $content[] = '<div class="' . $this->html_class_prefix . 'answer-star-radio">';
2144 $content[] = $star_label_1;
2145 $content[] = '</div>';
2146 $content[] = '</label>';
2147
2148 for ($i=1; $i <= $star_scale_length; $i++) {
2149 $is_selected = $i == $selected_input ? "checked" : "";
2150 $active_answer = $i == $selected_input ? "active-answer" : "";
2151 $selected_stars = ($i <= $selected_input) && ($selected_input <= $star_scale_length) ? "fa-star" : "fa-star-o";
2152
2153 $content[] = '<label class="' . $this->html_class_prefix . 'answer-label ' . $active_answer . '">';
2154 $content[] = '<div class="' . $this->html_class_prefix . 'answer-star-radio-label" dir="auto"></div>';
2155 $content[] = '<div class="' . $this->html_class_prefix . 'answer-star-radio" tabindex="0">';
2156
2157 $content[] = '<input type="radio" value="'.$i.'" name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . '][answer]"' . $is_selected . '>';
2158
2159 $content[] = '<i class="fa ' . $selected_stars . ' ' . $this->html_class_prefix . 'star-icon"></i>';
2160
2161 $content[] = '</div>';
2162 $content[] = '</label>';
2163 }
2164
2165 $content[] = '<label class="' . $this->html_class_prefix . 'answer-star-label">';
2166 $content[] = '<div class="' . $this->html_class_prefix . 'answer-star-radio-label" dir="auto"></div>';
2167 $content[] = '<div class="' . $this->html_class_prefix . 'answer-star-radio">';
2168 $content[] = $star_label_2;
2169 $content[] = '</div>';
2170 $content[] = '</label>';
2171
2172 $content[] = '</div>';
2173
2174 $content = implode( '', $content );
2175
2176 return $content;
2177 }
2178
2179 public function ays_survey_question_type_TEXT_html( $question ){
2180 $content = array();
2181 // Input types placeholders
2182 $survey_input_type_placeholder = isset($question['options']['placeholder']) && $question['options']['placeholder'] != "" ? $question['options']['placeholder'] : '';
2183
2184 $enable_word_limit = isset($question['options']['enable_word_limitation']) && $question['options']['enable_word_limitation'] == "on" ? true : false;
2185 $show_limit = isset($question['options']['limit_counter']) && $question['options']['limit_counter'] == "on" ? true : false;
2186 $limit_length = isset($question['options']['limit_length']) && $question['options']['limit_length'] != "" ? $question['options']['limit_length'] : "";
2187 $limit_by = "Character";
2188 $limit_checker = false;
2189 $survey_question_limit_length_class = '';
2190 if($enable_word_limit ){
2191 if($show_limit){
2192 $limit_checker = true;
2193 }
2194 $survey_question_limit_length_class = $this->html_class_prefix . 'check-word-limit ';
2195 }
2196 if($question['options']['limit_by'] && $question['options']['limit_by'] == "word"){
2197 $limit_by = "Word";
2198 }
2199 if(intval($limit_length) > 0){
2200 $limit_by .= "s ";
2201 }
2202 $limit_by .= __("left", "survey-maker");
2203 if(intval($limit_length) <= 0){
2204 $limit_by = '';
2205 }
2206
2207 $minimal_theme = $this->options[ $this->name_prefix . 'is_minimal' ] ? true : false;
2208 $minimal_class = $this->html_class_prefix . 'remove-default-border ' . $this->html_class_prefix . 'question-input-textarea ' . $this->html_class_prefix . 'question-input';
2209 if( $minimal_theme ){
2210 $minimal_class = $this->html_class_prefix . "minimal-theme-textarea-input";
2211 }
2212
2213
2214 $content[] = '<div class="' . $this->html_class_prefix . 'answer">';
2215
2216 $content[] = '<div class="' . $this->html_class_prefix . 'question-box ' . $this->html_class_prefix . 'question-type-text-box">';
2217 $content[] = '<div class="' . $this->html_class_prefix . 'question-input-box">';
2218
2219 $content[] = '<textarea class="
2220 ' . $minimal_class . '
2221 ' .
2222 $this->html_class_prefix . 'remove-default-border ' .
2223 $this->html_class_prefix . 'question-input-textarea ' .
2224 $survey_question_limit_length_class .
2225 $this->html_class_prefix . 'question-input ' .
2226 $this->html_class_prefix . 'input
2227 ' . $this->html_class_prefix . 'answer-text-inputs" type="text" style="min-height: 24px;"
2228 placeholder="'. __( $survey_input_type_placeholder, "survey-maker" ) .'"
2229 name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . '][answer]" autocomplete="off">';
2230 $content[] = '</textarea>';
2231
2232 if( ! $minimal_theme ){
2233 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline"></div>';
2234 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation"></div>';
2235 }
2236
2237 $content[] = '</div>';
2238 if($limit_checker){
2239 $content[] .= '<div class="'.$this->html_class_prefix.'question-text-conteiner">';
2240 $content[] .= '<div class="'.$this->html_class_prefix.'question-text-message">';
2241 $content[] .= '<span class="'.$this->html_class_prefix.'question-text-message-span">'. $limit_length . '</span> ' . $limit_by;
2242 $content[] .= '</div>';
2243 $content[] .= '</div>';
2244 }
2245 $content[] = '</div>';
2246
2247 $content[] = '</div>';
2248
2249 $content = implode( '', $content );
2250
2251 return $content;
2252 }
2253
2254 public function ays_survey_question_type_SHORT_TEXT_html( $question ){
2255 $content = array();
2256 // Input types placeholders
2257 $survey_input_type_placeholder = isset($question['options']['placeholder']) && $question['options']['placeholder'] != "" ? $question['options']['placeholder'] : '';
2258
2259 $enable_word_limit = isset($question['options']['enable_word_limitation']) && $question['options']['enable_word_limitation'] ? true : false;
2260 $show_limit = isset($question['options']['limit_counter']) && $question['options']['limit_counter'] == "on" ? true : false;
2261 $limit_length = isset($question['options']['limit_length']) && $question['options']['limit_length'] != "" ? $question['options']['limit_length'] : "";
2262 $limit_by = "Character";
2263 $limit_checker = false;
2264 $survey_question_limit_length_class = '';
2265 if($enable_word_limit ){
2266 if($show_limit){
2267 $limit_checker = true;
2268 }
2269 $survey_question_limit_length_class = $this->html_class_prefix . 'check-word-limit ';
2270 }
2271 if($question['options']['limit_by'] && $question['options']['limit_by'] == "word"){
2272 $limit_by = "Word";
2273 }
2274 if(intval($limit_length) > 0){
2275 $limit_by .= "s ";
2276 }
2277 $limit_by .= __("left", "survey-maker");
2278 if(intval($limit_length) <= 0){
2279 $limit_by = '';
2280 }
2281
2282 $minimal_theme = $this->options[ $this->name_prefix . 'is_minimal' ] ? true : false;
2283 $minimal_class = $this->html_class_prefix . 'remove-default-border ' .$this->html_class_prefix . 'question-input';
2284 if( $minimal_theme ){
2285 $minimal_class = $this->html_class_prefix . "minimal-theme-textarea-input";
2286 }
2287
2288 $content[] = '<div class="' . $this->html_class_prefix . 'answer">';
2289
2290 $content[] = '<div class="' . $this->html_class_prefix . 'question-box">';
2291 $content[] = '<div class="' . $this->html_class_prefix . 'question-input-box">';
2292
2293 $content[] = '<input class="
2294 ' . $minimal_class . '
2295 ' .
2296 $this->html_class_prefix . 'remove-default-border ' .
2297 $this->html_class_prefix . 'question-input ' .
2298 $survey_question_limit_length_class .
2299 $this->html_class_prefix . 'input
2300 ' . $this->html_class_prefix . 'answer-text-inputs" type="text" style="min-height: 24px;"
2301 placeholder="'. __( $survey_input_type_placeholder, "survey-maker" ) .'"
2302 name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . '][answer]" autocomplete="off">';
2303
2304 if( ! $minimal_theme ){
2305 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline"></div>';
2306 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation"></div>';
2307 }
2308
2309 $content[] = '</div>';
2310 if($limit_checker){
2311 $content[] .= '<div class="'.$this->html_class_prefix.'question-text-conteiner">';
2312 $content[] .= '<div class="'.$this->html_class_prefix.'question-text-message">';
2313 $content[] .= '<span class="'.$this->html_class_prefix.'question-text-message-span">'. $limit_length . '</span> ' . $limit_by;
2314 $content[] .= '</div>';
2315 $content[] .= '</div>';
2316 }
2317 $content[] = '</div>';
2318
2319 $content[] = '</div>';
2320
2321 $content = implode( '', $content );
2322
2323 return $content;
2324 }
2325
2326 public function ays_survey_question_type_NUMBER_html( $question ){
2327 $content = array();
2328 // Input types placeholders
2329 $survey_input_type_placeholder = isset($question['options']['placeholder']) && $question['options']['placeholder'] != "" ? $question['options']['placeholder'] : '';
2330
2331 $enable_number_limit = isset($question['options']['enable_number_limitation']) && $question['options']['enable_number_limitation'] == "on" ? true : false;
2332 $enable_number_limit_message = isset($question['options']['enable_number_error_message']) && $question['options']['enable_number_error_message'] == "on" ? true : false;
2333 $number_limit_message = isset($question['options']['number_error_message']) && $question['options']['number_error_message'] != "" ? stripslashes(esc_attr($question['options']['number_error_message'])) : "";
2334
2335 $show_limit = isset($question['options']['enable_number_limit_counter']) && $question['options']['enable_number_limit_counter'] == "on" ? true : false;
2336 $limit_length = isset($question['options']['number_limit_length']) && $question['options']['number_limit_length'] != "" ? $question['options']['number_limit_length'] : "";
2337 $limit_by = "Character";
2338 $limit_checker = false;
2339 // $survey_question_limit_length_class = '';
2340
2341 $number_limit_class = "";
2342 if($enable_number_limit){
2343 if($show_limit){
2344 $limit_checker = true;
2345 }
2346 $number_limit_class = $this->html_class_prefix . 'check-number-limit ';
2347 }
2348
2349 if(intval($limit_length) > 0){
2350 $limit_by .= "s ";
2351 }
2352
2353 $limit_by .= __("left", "survey-maker");
2354 if(intval($limit_length) <= 0){
2355 $limit_by = '';
2356 }
2357
2358 $minimal_theme = $this->options[ $this->name_prefix . 'is_minimal' ] ? true : false;
2359 $minimal_class = $this->html_class_prefix . 'remove-default-border ' . $this->html_class_prefix . 'question-input';
2360 if( $minimal_theme ){
2361 $minimal_class = $this->html_class_prefix . "minimal-theme-textarea-input";
2362 }
2363
2364 $content[] = '<div class="' . $this->html_class_prefix . 'answer">';
2365
2366 $content[] = '<div class="' . $this->html_class_prefix . 'question-box">';
2367 $content[] = '<div class="' . $this->html_class_prefix . 'question-input-box">';
2368
2369 $content[] = '<input class="
2370 ' . $minimal_class . '
2371 ' .
2372 $this->html_class_prefix . 'remove-default-border ' .
2373 $this->html_class_prefix . 'question-input ' .
2374 $number_limit_class .
2375 $this->html_class_prefix . 'input" type="number" step="any" style="min-height: 24px;"
2376 placeholder="'. __( $survey_input_type_placeholder, "survey-maker" ) .'"
2377 name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . '][answer]" autocomplete="off">';
2378 if( ! $minimal_theme ){
2379 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline"></div>';
2380 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation"></div>';
2381 }
2382
2383 $content[] = '</div>';
2384 if($enable_number_limit_message){
2385 $content[] = '<div class="' . $this->html_class_prefix . 'number-limit-message-box ' . $this->html_class_prefix . 'question-text-error-message" style="display: none;">';
2386 $content[] = '<span class="' . $this->html_class_prefix . 'number-limit-message-text">';
2387 $content[] = $number_limit_message;
2388 $content[] = '</span>';
2389 $content[] = '</div>';
2390 }
2391 if($limit_checker){
2392 $content[] .= '<div class="'.$this->html_class_prefix.'question-text-conteiner">';
2393 $content[] .= '<div class="'.$this->html_class_prefix.'question-text-message">';
2394 $content[] .= '<span class="'.$this->html_class_prefix.'question-text-message-span">'. $limit_length . '</span> ' . $limit_by;
2395 $content[] .= '</div>';
2396 $content[] .= '</div>';
2397 }
2398 $content[] = '</div>';
2399 $content[] = '</div>';
2400
2401 $content = implode( '', $content );
2402
2403 return $content;
2404 }
2405
2406
2407 public function ays_survey_question_type_PHONE_html( $question ){
2408 $content = array();
2409 // Input types placeholders
2410 $survey_input_type_placeholder = isset($question['options']['placeholder']) && $question['options']['placeholder'] != "" ? $question['options']['placeholder'] : '';
2411
2412 //Input types value
2413 $enable_url_parameter = isset($question['options']['enable_url_parameter']) && $question['options']['enable_url_parameter'] == true ? true : false;
2414 $url_parameter = $enable_url_parameter && isset($question['options']['url_parameter']) && $question['options']['url_parameter'] != "" ? $question['options']['url_parameter'] : '';
2415 $survey_input_type_value = isset($_GET[$url_parameter]) && $_GET[$url_parameter] ? $_GET[$url_parameter] : '';
2416
2417 $enable_number_limit = isset($question['options']['enable_number_limitation']) && $question['options']['enable_number_limitation'] == "on" ? true : false;
2418 $enable_number_limit_message = isset($question['options']['enable_number_error_message']) && $question['options']['enable_number_error_message'] == "on" ? true : false;
2419 $number_limit_message = isset($question['options']['number_error_message']) && $question['options']['number_error_message'] != "" ? stripslashes(esc_attr($question['options']['number_error_message'])) : "";
2420 $show_limit = isset($question['options']['enable_number_limit_counter']) && $question['options']['enable_number_limit_counter'] == "on" ? true : false;
2421 $limit_length = isset($question['options']['number_limit_length']) && $question['options']['number_limit_length'] != "" ? $question['options']['number_limit_length'] : "";
2422 $limit_by = "Character";
2423 $limit_checker = false;
2424
2425 $number_limit_class = $this->html_class_prefix . 'is-phone-type ';
2426 if($enable_number_limit){
2427 if($show_limit){
2428 $limit_checker = true;
2429 }
2430
2431 $number_limit_class .= $this->html_class_prefix . 'check-number-limit ';
2432 }
2433
2434 if(intval($limit_length) > 0){
2435 $limit_by .= "s ";
2436 }
2437
2438 $limit_by .= __("left", "survey-maker");
2439 if(intval($limit_length) <= 0){
2440 $limit_by = '';
2441 }
2442
2443 $minimal_theme = $this->options[ $this->name_prefix . 'is_minimal' ] ? true : false;
2444 $minimal_class = $this->html_class_prefix . 'remove-default-border ' . $this->html_class_prefix . 'question-input';
2445 if( $minimal_theme ){
2446 $minimal_class = $this->html_class_prefix . "minimal-theme-textarea-input";
2447 }
2448
2449 $content[] = '<div class="' . $this->html_class_prefix . 'answer">';
2450
2451 $content[] = '<div class="' . $this->html_class_prefix . 'question-box ' . $this->html_class_prefix . 'question-box-text-types-short">';
2452 $content[] = '<div class="' . $this->html_class_prefix . 'question-input-box">';
2453
2454 $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;"
2455 placeholder="'. __( $survey_input_type_placeholder, "survey-maker" ) .'"
2456 name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . '][answer]"
2457 value="' . __( $survey_input_type_value, "survey-maker" ) . '">';
2458
2459 if( ! $minimal_theme ){
2460 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline"></div>';
2461 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation"></div>';
2462 }
2463
2464 if($enable_number_limit_message){
2465 $content[] = '<div class="' . $this->html_class_prefix . 'number-limit-message-box ' . $this->html_class_prefix . 'question-text-error-message" style="display: none;">';
2466 $content[] = '<span class="' . $this->html_class_prefix . 'number-limit-message-text">';
2467 $content[] = $number_limit_message;
2468 $content[] = '</span>';
2469 $content[] = '</div>';
2470 }
2471
2472 if($limit_checker){
2473 $content[] .= '<div class="'.$this->html_class_prefix.'question-text-conteiner">';
2474 $content[] .= '<div class="'.$this->html_class_prefix.'question-text-message">';
2475 $content[] .= '<span class="'.$this->html_class_prefix.'question-text-message-span">'. $limit_length . '</span> ' . $limit_by;
2476 $content[] .= '</div>';
2477 $content[] .= '</div>';
2478 }
2479
2480 $content[] = '</div>';
2481 $content[] = '</div>';
2482
2483 $content[] = '</div>';
2484
2485 $content = implode( '', $content );
2486
2487 return $content;
2488 }
2489
2490 public function ays_survey_question_type_DATE_html( $question ){
2491 $content = array();
2492
2493 $minimal_theme = $this->options[ $this->name_prefix . 'is_minimal' ] ? true : false;
2494 $minimal_class = $this->html_class_prefix . 'remove-default-border ' . $this->html_class_prefix . 'question-date-input ' . $this->html_class_prefix . 'question-input';
2495 if( $minimal_theme ){
2496 $minimal_class = $this->html_class_prefix . "minimal-theme-textarea-input " . $this->html_class_prefix."minimal-theme-input-date";
2497 }
2498
2499 $content[] = '<div class="' . $this->html_class_prefix . 'answer">';
2500
2501 $content[] = '<div class="' . $this->html_class_prefix . 'question-box ' . $this->html_class_prefix . 'question-date-box">';
2502 $content[] = '<div class="' . $this->html_class_prefix . 'question-input-box ' . $this->html_class_prefix . 'question-date-input-box">';
2503
2504 $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">';
2505
2506 $content[] = '</div>';
2507 $content[] = '</div>';
2508
2509 $content[] = '</div>';
2510
2511 $content = implode( '', $content );
2512
2513 return $content;
2514 }
2515
2516 public function ays_survey_question_type_TIME_html( $question ){
2517 $content = array();
2518
2519 // $minimal_theme = $this->options[ $this->name_prefix . 'is_minimal' ] ? true : false;
2520 $minimal_class = $this->html_class_prefix . 'remove-default-border ' . $this->html_class_prefix . 'question-date-input ' . $this->html_class_prefix . 'question-input';
2521 // if( $minimal_theme ){
2522 // $minimal_class = $this->html_class_prefix . "minimal-theme-textarea-input " . $this->html_class_prefix."minimal-theme-input-date";
2523 // }
2524
2525 $content[] = '<div class="' . $this->html_class_prefix . 'answer">';
2526
2527 $content[] = '<div class="' . $this->html_class_prefix . 'question-box ' . $this->html_class_prefix . 'question-time-box">';
2528 $content[] = '<div class="' . $this->html_class_prefix . 'question-input-box ' . $this->html_class_prefix . 'question-time-input-box">';
2529
2530 $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">';
2531
2532 // if( ! $minimal_theme ){
2533 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline"></div>';
2534 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation"></div>';
2535 // }
2536
2537 $content[] = '</div>';
2538 $content[] = '</div>';
2539
2540 $content[] = '</div>';
2541
2542 $content = implode( '', $content );
2543
2544 return $content;
2545 }
2546
2547 public function ays_survey_question_type_DATE_TIME_html( $question ){
2548 $content = array();
2549
2550 $minimal_class = $this->html_class_prefix . 'remove-default-border ' . $this->html_class_prefix . 'question-date-input ' . $this->html_class_prefix . 'question-input';
2551
2552 $minimal_theme = $this->options[ $this->name_prefix . 'is_minimal' ] ? true : false;
2553 $minimal_date_class = $this->html_class_prefix . 'remove-default-border ' . $this->html_class_prefix . 'question-date-input ' . $this->html_class_prefix . 'question-input';
2554 if( $minimal_theme ){
2555 $minimal_date_class = $this->html_class_prefix . "minimal-theme-textarea-input " . $this->html_class_prefix."minimal-theme-input-date";
2556 }
2557
2558 $content[] = '<div class="' . $this->html_class_prefix . 'answer ' . $this->html_class_prefix . 'date-and-time-answer">';
2559
2560 $content[] = '<div class="' . $this->html_class_prefix . 'question-box ' . $this->html_class_prefix . 'question-date-time-box">';
2561 $content[] = '<div class="' . $this->html_class_prefix . 'date-time-inner-box">';
2562 $content[] = '<div class="' . $this->html_class_prefix . 'question-input-box ' . $this->html_class_prefix . 'question-date-input-box">';
2563
2564 $content[] = '<input type="date" class="' . $minimal_date_class . ' ' . $this->html_class_prefix . 'input" type="text"
2565 name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . '][answer][date]">';
2566
2567 if( ! $minimal_theme ){
2568 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline"></div>';
2569 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation"></div>';
2570 }
2571
2572 $content[] = '</div>';
2573 $content[] = '<div class="' . $this->html_class_prefix . 'question-input-box ' . $this->html_class_prefix . 'question-time-input-box">';
2574
2575 $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">';
2576
2577 // if( ! $minimal_theme ){
2578 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline"></div>';
2579 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation"></div>';
2580 // }
2581
2582 $content[] = '</div>';
2583 $content[] = '</div>';
2584 $content[] = '</div>';
2585
2586 $content[] = '</div>';
2587
2588 $content = implode( '', $content );
2589
2590 return $content;
2591 }
2592
2593
2594 public function ays_survey_question_type_EMAIL_html( $question ){
2595 $content = array();
2596 // Input types placeholders
2597 $survey_input_type_placeholder = isset($question['options']['placeholder']) && $question['options']['placeholder'] != "" ? $question['options']['placeholder'] : '';
2598
2599 $minimal_theme = $this->options[ $this->name_prefix . 'is_minimal' ] ? true : false;
2600 $minimal_class = $this->html_class_prefix . 'remove-default-border ' . $this->html_class_prefix . 'question-email-input ' . $this->html_class_prefix . 'question-input';
2601 if( $minimal_theme ){
2602 $minimal_class = $this->html_class_prefix . "minimal-theme-textarea-input " . $this->html_class_prefix . "question-email-input";
2603 }
2604
2605 $content[] = '<div class="' . $this->html_class_prefix . 'answer">';
2606
2607 $content[] = '<div class="' . $this->html_class_prefix . 'question-box">';
2608 $content[] = '<div class="' . $this->html_class_prefix . 'question-input-box">';
2609
2610 $content[] = '<input class="
2611 ' . $minimal_class . '
2612 ' .
2613 $this->html_class_prefix . 'remove-default-border ' .
2614 $this->html_class_prefix . 'question-email-input ' .
2615 $this->html_class_prefix . 'question-input ' .
2616 $this->html_class_prefix . 'input" type="text" style="min-height: 24px;"
2617 placeholder="'. __( $survey_input_type_placeholder, "survey-maker" ) .'"
2618 name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . '][answer]" autocomplete="off">';
2619 if( true ){
2620 $content[] = '<input type="hidden" name="' . $this->html_name_prefix . 'user-email-' . $this->unique_id . '" value="' . $question['id'] . '" >';
2621 }
2622
2623 if( ! $minimal_theme ){
2624 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline"></div>';
2625 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation"></div>';
2626 }
2627
2628 $content[] = '</div>';
2629 $content[] = '</div>';
2630
2631 $content[] = '</div>';
2632
2633 $content = implode( '', $content );
2634
2635 return $content;
2636 }
2637
2638 public function ays_survey_question_type_NAME_html( $question ){
2639 $content = array();
2640 // Input types placeholders
2641 $survey_input_type_placeholder = isset($question['options']['placeholder']) && $question['options']['placeholder'] != "" ? $question['options']['placeholder'] : '';
2642
2643 $minimal_theme = $this->options[ $this->name_prefix . 'is_minimal' ] ? true : false;
2644 $minimal_class = $this->html_class_prefix . 'remove-default-border ' . $this->html_class_prefix . 'question-input';
2645 if( $minimal_theme ){
2646 $minimal_class = $this->html_class_prefix . "minimal-theme-textarea-input";
2647 }
2648
2649 $content[] = '<div class="' . $this->html_class_prefix . 'answer">';
2650
2651 $content[] = '<div class="' . $this->html_class_prefix . 'question-box">';
2652 $content[] = '<div class="' . $this->html_class_prefix . 'question-input-box">';
2653
2654 $content[] = '<input class="
2655 ' . $minimal_class . '
2656 ' .
2657 $this->html_class_prefix . 'remove-default-border ' .
2658 $this->html_class_prefix . 'question-input ' .
2659 $this->html_class_prefix . 'input
2660 ' . $this->html_class_prefix . 'answer-text-inputs" type="text" style="min-height: 24px;"
2661 placeholder="'. __( $survey_input_type_placeholder, "survey-maker" ) .'"
2662 name="' . $this->html_name_prefix . 'answers-' . $this->unique_id . '[' . $question['id'] . '][answer]" autocomplete="off">';
2663
2664 if( true ){
2665 $content[] = '<input type="hidden" name="' . $this->html_name_prefix . 'user-name-' . $this->unique_id . '" value="' . $question['id'] . '" >';
2666 }
2667
2668 if( ! $minimal_theme ){
2669 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline"></div>';
2670 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation"></div>';
2671 }
2672
2673 $content[] = '</div>';
2674 $content[] = '</div>';
2675
2676 $content[] = '</div>';
2677
2678 $content = implode( '', $content );
2679
2680 return $content;
2681 }
2682
2683 public function create_restricted_content( $limit_message ){
2684
2685 $content = array();
2686 $content[] = '<div class="' . $this->html_class_prefix . 'section ' . $this->html_class_prefix . 'restricted-content active-section">';
2687
2688 $content[] = '<div class="' . $this->html_class_prefix . 'section-header">';
2689
2690 $content[] = $limit_message;
2691
2692 $content[] = '</div>';
2693
2694 $content[] = '</div>';
2695
2696 $content = implode( '', $content );
2697
2698 return $content;
2699 }
2700
2701 public function get_styles(){
2702
2703 $content = array();
2704 $content[] = '<style type="text/css">';
2705
2706
2707 $question_image_width = '100%';
2708 if( $this->options[ $this->name_prefix . 'question_image_width' ] != '' ){
2709 $question_image_width = $this->options[ $this->name_prefix . 'question_image_width' ] . 'px';
2710 }
2711
2712 $question_image_height = 'auto';
2713 if( $this->options[ $this->name_prefix . 'question_image_height' ] != '' ){
2714 $question_image_height = $this->options[ $this->name_prefix . 'question_image_height' ] . 'px';
2715 }
2716
2717 $survey_title_box_shadow_class = '';
2718 if( isset($this->options[ $this->name_prefix . 'title_box_shadow_enable' ]) && $this->options[ $this->name_prefix . 'title_box_shadow_enable' ] ){
2719 $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';
2720 $survey_title_box_shadow_class = 'text-shadow : '.$survey_title_text_shadow_params.' '.$this->options[ $this->name_prefix . 'title_box_shadow_color' ].';';
2721 }
2722
2723 $survey_pagination_positioning = isset($this->options[ $this->name_prefix . 'pagination_positioning' ]) ? $this->options[ $this->name_prefix . 'pagination_positioning' ] : 'none';
2724 $pagination_positioning = "row";
2725 $pagination_number_height = "";
2726 switch ($survey_pagination_positioning) {
2727 case 'none':
2728 $pagination_positioning = "row";
2729 break;
2730 case 'reverse':
2731 $pagination_positioning = "row-reverse";
2732 break;
2733 case 'column':
2734 $pagination_positioning = "column";
2735 $pagination_number_height = "line-height: 1;";
2736 break;
2737 case 'column_reverse':
2738 $pagination_positioning = "column-reverse";
2739 $pagination_number_height = "line-height: 1;";
2740 break;
2741 default:
2742 $pagination_positioning = "row";
2743 $pagination_number_height = "";
2744 break;
2745 }
2746
2747 $filtered_survey_color = Survey_Maker_Data::rgb2hex( $this->options[ $this->name_prefix . 'color' ] );
2748
2749 $width = $this->options[ $this->name_prefix . 'width' ];
2750 $width_by = $this->options[ $this->name_prefix . 'width_by_percentage_px' ];
2751
2752 $mobile_width = $this->options[ $this->name_prefix . 'mobile_width' ];
2753 $mobile_width_by = $this->options[ $this->name_prefix . 'mobile_width_by_percent_px' ];
2754 $mobile_max_width = $this->options[ $this->name_prefix . 'mobile_max_width' ];
2755
2756 if( absint( $width ) == 0 ){
2757 $width = '100';
2758 $width_by = 'percentage';
2759 }
2760
2761 if( absint( $mobile_width ) == 0 ){
2762 $mobile_width = '100';
2763 $mobile_width_by = 'percentage';
2764 }
2765
2766 if( absint( $mobile_max_width ) > 0 ){
2767 $mobile_max_width .= '%';
2768 }else{
2769 $mobile_max_width = '95%';
2770 }
2771
2772 switch( $width_by ){
2773 case 'percentage':
2774 $width .= '%';
2775 break;
2776 case 'pixels':
2777 $width .= 'px';
2778 break;
2779 default:
2780 $width .= '%';
2781 break;
2782 }
2783
2784 switch( $mobile_width_by ){
2785 case 'percentage':
2786 $mobile_width .= '%';
2787 break;
2788 case 'pixels':
2789 $mobile_width .= 'px';
2790 break;
2791 default:
2792 $mobile_width .= '%';
2793 break;
2794 }
2795
2796 switch($this->options[ $this->name_prefix . 'logo_image_position' ]){
2797 case "right":
2798 $survey_logo_image_position = "right: 5px;";
2799 break;
2800 case "left":
2801 $survey_logo_image_position = "left: 5px;";
2802 break;
2803 case "center":
2804 $survey_logo_image_position = "left: 50%;";
2805 break;
2806 default:
2807 $survey_logo_image_position = "right: 5px;";
2808 break;
2809 }
2810
2811 switch($this->options[ $this->name_prefix . 'start_page_button_pos' ]){
2812 case "left":
2813 $survey_start_page_button_pos = 'justify-content: flex-start;';
2814 break;
2815 case "center":
2816 $survey_start_page_button_pos = 'justify-content: center;';
2817 break;
2818 case "right":
2819 $survey_start_page_button_pos = 'justify-content: flex-end;';
2820 break;
2821 }
2822
2823 $answers_list_width = "width:initial;";
2824 $answers_list_direction = "";
2825 if($this->options[ $this->name_prefix . 'answers_view_alignment' ] == 'center' && $this->options[ $this->name_prefix . 'answers_view' ] == 'list'){
2826 $answers_list_width = "width:50%;";
2827 $answers_list_direction = "flex-direction: column;";
2828 }
2829
2830 $other_answer_box_width = "";
2831 if($this->options[ $this->name_prefix . 'answers_view_alignment' ] == 'flex-start' && $this->options[ $this->name_prefix . 'answers_view' ] == 'list'){
2832 $other_answer_box_width = "width: 100%;";
2833 }
2834
2835 $answers_grid_min_width = '';
2836 if($this->options[ $this->name_prefix . 'answers_view_alignment' ] == 'flex-start' && $this->options[ $this->name_prefix . 'answers_view' ] == 'grid'){
2837 $answers_grid_min_width = "min-width: 50%;";
2838 }
2839
2840 // Question padding
2841 $question_padding = $this->options[ $this->name_prefix . 'question_padding' ];
2842 $question_border_radius = $this->options[ $this->name_prefix . 'question_border_radius' ];
2843
2844 $content[] = '
2845 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' {
2846 width: ' . $width . ';
2847 }
2848
2849 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-header {
2850 border-top-color: ' . $this->options[ $this->name_prefix . 'color' ] . ' !important;
2851 }
2852
2853 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question {
2854 border-left-color: ' . $this->options[ $this->name_prefix . 'color' ] . ' !important;
2855 }
2856
2857 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-header,
2858 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-terms-and-conditions-container,
2859 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question {
2860 background-color: ' . $this->options[ $this->name_prefix . 'background_color' ] . ';
2861 }
2862
2863 #' . $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 {
2864 background-color: ' . $this->options[ $this->name_prefix . 'start_page_background_color' ] . ';
2865 color: ' . $this->options[ $this->name_prefix . 'start_page_text_color' ] . ';
2866 }
2867
2868 #' . $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 *,
2869 #' . $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 {
2870 color: ' . $this->options[ $this->name_prefix . 'start_page_text_color' ] . ';
2871 }
2872
2873 #' . $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 {
2874 justify-content: ' . $this->options[ $this->name_prefix . 'start_page_title_pos' ] . ';
2875 }
2876
2877 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-start-page .' . $this->html_class_prefix . 'section-buttons {
2878 display: flex;
2879 '.$survey_start_page_button_pos.'
2880 }
2881
2882 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question {
2883 ' . ( $this->options[ $this->name_prefix . 'logo' ] != '' ? 'padding: '.$question_padding.'px '.$question_padding.'px 0 '.$question_padding.'px;' : 'padding: '.$question_padding.'px;' ) . '
2884 ' . ( $this->options[ $this->name_prefix . 'logo' ] != '' ? 'padding-bottom: 50px;' : '' ) . '
2885 border-radius: ' . $question_border_radius . 'px;
2886 }
2887
2888 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' input.' . $this->html_class_prefix . 'question-input {
2889 font-size: ' . $this->options[ $this->name_prefix . 'answer_font_size' ] . 'px;
2890 letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing' ] . 'px;
2891 font-weight: normal;
2892 }
2893
2894 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' textarea.' . $this->html_class_prefix . 'question-input {
2895 letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing' ] . 'px;
2896 }
2897
2898 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' input.' . $this->html_class_prefix . 'question-input ~ .' . $this->html_class_prefix . 'input-underline,
2899 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' input.' . $this->html_class_prefix . 'question-input ~ .' . $this->html_class_prefix . 'input-underline-animation,
2900 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'simple-button-container,
2901 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container,
2902 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label-content > span,
2903 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-select.dropdown div.item,
2904 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'thank-you-page,
2905 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'loader-with-text,
2906 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'restricted-message,
2907 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-desc,
2908 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-questions-count,
2909 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-terms-and-conditions-container,
2910 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-title,
2911 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-title-row,
2912 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'thank-you-page > div p {
2913 color: ' . $this->options[ $this->name_prefix . 'text_color' ] . ';
2914 font-weight: normal;
2915 }';
2916 $content[] = '
2917 #' . $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,
2918 #' . $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,
2919 #' . $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,
2920 #' . $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,
2921 #'.$this->html_class_prefix.'container-'.$this->unique_id_in_class.' .'.$this->html_class_prefix.'answer-label .'.$this->html_class_prefix.'answer-image-container{
2922 border-color:' . ( $this->options[ $this->name_prefix . 'is_modern' ] ? $this->options[ $this->name_prefix . 'buttons_bg_color' ] : $this->options[ $this->name_prefix . 'color' ] ) . ';
2923 }
2924
2925 #' . $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,
2926 #' . $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 {
2927 border-color: ' . ( $this->options[ $this->name_prefix . 'is_modern' ] ? $this->options[ $this->name_prefix . 'buttons_bg_color' ] : $this->options[ $this->name_prefix . 'text_color' ] ) . ';
2928 }
2929
2930 #' . $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,
2931 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' input.' . $this->html_class_prefix . 'input:focus ~ .' . $this->html_class_prefix . 'input-underline-animation {
2932 background-color: ' . ( $this->options[ $this->name_prefix . 'is_modern' ] ? $this->options[ $this->name_prefix . 'text_color' ] : $this->options[ $this->name_prefix . 'color' ] ) . ';
2933 }
2934
2935 #' . $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,
2936 #' . $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,
2937 #' . $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 {
2938 color: ' . $this->options[ $this->name_prefix . 'buttons_text_color' ] . ';
2939 }
2940
2941 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label:hover .' . $this->html_class_prefix . 'answer-icon-ink{
2942 background-color: ' . Survey_Maker_Data::hex2rgba( $filtered_survey_color, 0.04 ) . ';
2943 }
2944
2945 #' . $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,
2946 #' . $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,
2947 #' . $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,
2948 #' . $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 {
2949 color: ' . Survey_Maker_Data::hex2rgba( $this->options[ $this->name_prefix . 'buttons_text_color' ], 0.7) . ';
2950 background-color: ' . Survey_Maker_Data::hex2rgba( $this->options[ $this->name_prefix . 'buttons_bg_color' ] ) . ';
2951 }
2952
2953 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-required-icon,
2954 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-title {
2955 font-size: ' . $this->options[ $this->name_prefix . 'question_font_size' ] . 'px;
2956 line-height: 1.5;
2957 }
2958
2959 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . '
2960 .' . $this->html_class_prefix . 'sections
2961 .' . $this->html_class_prefix . 'question
2962 .' . $this->html_class_prefix . 'question-header
2963 .' . $this->html_class_prefix . 'question-header-content
2964 .' . $this->html_class_prefix . 'question-title p{
2965 margin: 0;
2966 color: ' . $this->options[ $this->name_prefix . 'text_color' ] . ';
2967 }';
2968 $content[] = '
2969 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-title{
2970 padding-top: 10px;
2971 text-align: ' . $this->options[ $this->name_prefix . 'question_title_alignment' ] . ';
2972 }
2973
2974 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-image {
2975 width: ' . $question_image_width . ';
2976 height: ' . $question_image_height . ';
2977 object-fit: ' . $this->options[ $this->name_prefix . 'question_image_sizing' ] . ';
2978 }
2979
2980 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-image-caption {
2981 text-align: ' . $this->options[ $this->name_prefix . 'question_caption_text_alignment' ] . ';
2982 }
2983
2984 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label-content > span {
2985 font-size: ' . $this->options[ $this->name_prefix . 'answer_font_size' ] . 'px;
2986 letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing' ] . 'px;
2987 word-break: break-word;
2988 }
2989
2990 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer {
2991 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;
2992 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;
2993 }
2994
2995 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-image {
2996 object-fit: ' . $this->options[ $this->name_prefix . 'answers_object_fit' ] . ';
2997 }
2998
2999 #' . $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 {
3000 font-size: ' . $this->options[ $this->name_prefix . 'buttons_font_size' ] . 'px;
3001 padding-left: ' . $this->options[ $this->name_prefix . 'buttons_left_right_padding' ] . 'px;
3002 padding-right: ' . $this->options[ $this->name_prefix . 'buttons_left_right_padding' ] . 'px;
3003 padding-top: ' . $this->options[ $this->name_prefix . 'buttons_top_bottom_padding' ] . 'px;
3004 padding-bottom: ' . $this->options[ $this->name_prefix . 'buttons_top_bottom_padding' ] . 'px;
3005 background-color: ' . $this->options[ $this->name_prefix . 'buttons_bg_color' ] . ';
3006 letter-spacing: ' . $this->options[ $this->name_prefix . 'buttons_text_letter_spacing' ] . 'px;
3007 height: initial;
3008 color: #333 !important;
3009 }
3010
3011 #' . $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 {
3012 color: rgba(51,51,51,0.7) !important;
3013 }
3014
3015 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container {
3016 border-radius: ' . $this->options[ $this->name_prefix . 'buttons_border_radius' ] . 'px;
3017 background-color: ' . $this->options[ $this->name_prefix . 'background_color' ] . ';
3018 }
3019
3020 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-select.dropdown div.text,
3021 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-select.dropdown div.item {
3022 font-size: ' . $this->options[ $this->name_prefix . 'answer_font_size' ] . 'px !important;
3023 letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing' ] . 'px;
3024 font-weight: normal;
3025 }
3026
3027 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-star .' . $this->html_class_prefix . 'answer-star-radio,
3028 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-star .' . $this->html_class_prefix . 'answer-star-radio-label,
3029 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-select.dropdown div.item {
3030 font-size: ' . $this->options[ $this->name_prefix . 'answer_font_size' ] . 'px !important;
3031 letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing' ] . 'px;
3032 color: ' . $this->options[ $this->name_prefix . 'text_color' ] . ';
3033 }
3034
3035 #' . $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{
3036 content: "\f006";
3037 }
3038
3039
3040 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label .' . $this->html_class_prefix . 'answer-star-radio input {
3041 display: none ;
3042 }
3043
3044 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .lds-ripple[data-role="loader"] div{
3045 border-color: ' . $this->options[ $this->name_prefix . 'loader_color' ] . ';
3046 }
3047 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .lds-dual-ring[data-role="loader"]::after,
3048 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .lds-hourglass[data-role="loader"]::after{
3049 border-color: ' . $this->options[ $this->name_prefix . 'loader_color' ] . ' transparent ' . $this->options[ $this->name_prefix . 'loader_color' ] . ' transparent;
3050 }
3051
3052 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .lds-default[data-role="loader"] div,
3053 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .lds-ellipsis[data-role="loader"] div,
3054 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .lds-facebook[data-role="loader"] div,
3055 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .lds-circle[data-role="loader"] {
3056 background-color: ' . $this->options[ $this->name_prefix . 'loader_color' ] . ';
3057 }
3058
3059 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .ays-survey-loader-snake[data-role="loader"]{
3060 color:' . $this->options[ $this->name_prefix . 'loader_color' ] . ';
3061 }
3062
3063 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' textarea.' . $this->html_class_prefix . 'question-input {
3064 min-height: ' . $this->options[ $this->name_prefix . 'textarea_height' ] . 'px !important;
3065 }
3066
3067 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .'.$this->name_prefix.'expired-survey-message {
3068 color: ' . $this->options[ $this->name_prefix . 'text_color' ] . ';
3069 }';
3070 $content[] = '
3071 #' . $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{
3072 color: ' . $this->options[ $this->name_prefix . 'buttons_text_color' ] . ';
3073 background-color: ' . $this->options[ $this->name_prefix . 'buttons_bg_color' ] . ';
3074 }
3075
3076 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'full-screen-mode .' . $this->html_class_prefix . 'close-full-screen,
3077 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'full-screen-mode .' . $this->html_class_prefix . 'open-full-screen{
3078 fill: ' . $this->options[ $this->name_prefix . 'full_screen_button_color' ] . ';
3079 }
3080
3081 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'live-bar-wrap{
3082 background-color: ' . $this->options[ $this->name_prefix . 'color' ] . ';
3083 border-color: ' . $this->options[ $this->name_prefix . 'color' ] . ';
3084 }
3085
3086 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'live-bar-fill{
3087 background-color: ' . $this->options[ $this->name_prefix . 'background_color' ] . ';
3088 }
3089
3090 #' . $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{
3091 font-size: ' . $this->options[ $this->name_prefix . 'progress_bar_text_font_size' ] . 'px;
3092 color: ' . $this->options[ $this->name_prefix . 'pagination_text_color' ] . ';
3093 padding: 0 10px;
3094 letter-spacing: ' . $this->options[ $this->name_prefix . 'progress_bar_text_letter_spacing' ] . 'px;
3095 line-height: 30px;
3096 font-weight: normal;
3097 text-transform: '.$this->options[ $this->name_prefix . 'progress_bar_text_transform' ].';
3098 }
3099
3100 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'title{
3101 text-align: ' . $this->options[ $this->name_prefix . 'title_alignment' ] . ';
3102 font-size: ' . $this->options[ $this->name_prefix . 'title_font_size' ] . 'px;
3103 letter-spacing: ' . $this->options[ $this->name_prefix . 'title_letter_spacing' ] . 'px;
3104 '. $survey_title_box_shadow_class .'
3105 }
3106
3107 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'section-title-row-main{
3108 text-align: ' . $this->options[ $this->name_prefix . 'section_title_alignment' ] . ';
3109 font-size: ' . $this->options[ $this->name_prefix . 'section_title_font_size' ] . 'px;
3110 letter-spacing: ' . $this->options[ $this->name_prefix . 'section_title_letter_spacing' ] . 'px;
3111 width: 100%;
3112 line-height: 1.5;
3113 }
3114
3115 #' . $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{
3116 height: ' . $this->options[ $this->name_prefix . 'answers_image_size' ] . 'px;
3117 }
3118
3119 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'section-desc{
3120 text-align: ' . $this->options[ $this->name_prefix . 'section_description_alignment' ] . ';
3121 font-size: ' . $this->options[ $this->name_prefix . 'section_description_font_size' ] . 'px;
3122 letter-spacing: ' . $this->options[ $this->name_prefix . 'section_description_letter_spacing' ] . 'px;
3123 line-height: 1;
3124 }';
3125 $content[] = '
3126 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'cover-photo-title-wrap{
3127 height: ' . $this->options[ $this->name_prefix . 'cover_photo_height' ] . 'px;
3128 background-position: ' . implode(" ", explode("_" , $this->options[ $this->name_prefix . 'cover_photo_position' ])) .';
3129 background-size: ' . $this->options[ $this->name_prefix . 'cover_photo_object_fit' ] .';
3130 }
3131
3132 #' . $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{
3133 '.$survey_logo_image_position.'
3134 }
3135
3136 #' . $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,
3137 #' . $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{
3138 color: ' . $this->options[ $this->name_prefix . 'text_color' ] . ';
3139 text-align: left;
3140 font-size: 12px;
3141 padding-top: 10px;
3142 }
3143
3144 #' . $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 {
3145 color: #ff0000;
3146 }
3147
3148 #' . $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{
3149 color: #000;
3150 text-transform: none;
3151 font-size: 11px;
3152 }
3153
3154 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'live-bar-main{
3155 flex-direction: '.$pagination_positioning.';
3156 }
3157
3158 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons{
3159 margin-top: ' . $this->options[ $this->name_prefix . 'buttons_top_distance' ] . 'px;
3160 text-align: ' . $this->options[ $this->name_prefix . 'buttons_alignment' ] . ';
3161 }
3162
3163 #' . $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{
3164 margin-top: 0;
3165 }
3166
3167 #' . $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){
3168 align-items: ' . $this->options[ $this->name_prefix . 'answers_view_alignment' ] . ';
3169 }
3170
3171 #' . $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{
3172 justify-content: ' . $this->options[ $this->name_prefix . 'answers_view_alignment' ] . ';
3173 }
3174
3175 #' . $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{
3176 '.$answers_list_width.'
3177 '.$answers_list_direction.'
3178 '.$answers_grid_min_width.'
3179 }
3180
3181 #' . $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{
3182 width: 100%;
3183 }
3184
3185 #' . $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{
3186 '.$other_answer_box_width.'
3187 }
3188
3189 #' . $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,
3190 #' . $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,
3191 #' . $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,
3192 #' . $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,
3193 #' . $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,
3194 #' . $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{
3195 width: 100%;
3196 }
3197
3198 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'question-image-caption span{
3199 color: '.$this->options[ $this->name_prefix . 'question_caption_text_color' ].';
3200 font-size: '.$this->options[ $this->name_prefix . 'question_caption_font_size' ].'px;
3201 text-transform: '.$this->options[ $this->name_prefix . 'question_caption_text_transform' ].';
3202 letter-spacing: '.$this->options[ $this->name_prefix . 'question_caption_letter_spacing' ].'px;
3203 }
3204
3205 #' . $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,
3206 #' . $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 *{
3207 color: ' . $this->options[ $this->name_prefix . 'text_color' ] . ';
3208 }
3209
3210 ';
3211
3212 if($this->options[ $this->name_prefix . 'enable_survey_start_loader' ]){
3213 $content[] = '#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . '.' . $this->html_class_prefix . 'container {
3214 min-height: 250px;
3215 }';
3216 }
3217
3218 if( $this->options[ $this->name_prefix . 'is_minimal' ] ){
3219 $content[] =
3220 '#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'minimal-theme-header {
3221 box-shadow: unset;
3222 border: 0;
3223 }
3224
3225 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question.' . $this->html_class_prefix . 'minimal-theme-question {
3226 border: 0;
3227 }
3228
3229 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label-content .' . $this->html_class_prefix . 'answer-icon-content {
3230 display: none;
3231 }
3232
3233 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label input {
3234 display: block ;
3235 cursor: pointer;
3236 outline: none;
3237 }
3238
3239 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label {
3240 justify-content: initial;
3241 }
3242
3243 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label .' . $this->html_class_prefix . 'answer-star-radio input {
3244 display: none ;
3245 }
3246
3247 #' . $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,
3248 #' . $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,
3249 #' . $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 {
3250 width: initial;
3251 }
3252
3253 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' input[type=range].' . $this->html_class_prefix . 'range-type-input {
3254 -webkit-appearance: auto;
3255 appearance: auto;
3256 }
3257
3258 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' input[type=range].' . $this->html_class_prefix . 'range-type-input {
3259 -moz-appearance: auto;
3260 appearance: auto;
3261 }
3262
3263 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .'.$this->html_class_prefix.'minimal-theme-textarea-input {
3264 border: 1px solid !important;
3265 transition: 0;
3266 width: 100%;
3267 }
3268
3269 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-select-conteiner-minimal {
3270 width: 230px;
3271 padding: 5px !important;
3272 outline: none;
3273 }
3274
3275 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .'.$this->html_class_prefix.'question-date-input-box {
3276 width: 230px;
3277 height: 40px;
3278 }
3279
3280 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .'.$this->html_class_prefix.'question-date-input-box input {
3281 width: 100%;
3282 height: 100%;
3283 box-sizing: border-box;
3284 font-size: 15px;
3285 padding: 10px;
3286 }';
3287 }
3288
3289 if( $this->options[ $this->name_prefix . 'is_modern' ] ){
3290 $content[] =
3291 '#' . $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{
3292 border: none;
3293 margin: 15px 0 0;
3294 padding: '. ((isset($this->options[ $this->name_prefix . 'logo' ]) && $this->options[ $this->name_prefix . 'logo' ] != "") ? '0 0 50px 0': '1px 12px').';
3295 }
3296
3297 #' . $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){
3298 border-radius: unset;
3299 }
3300 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-footer{
3301 margin-top:11px 12pxpx;
3302 }
3303
3304 #' . $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{
3305 border-bottom-left-radius: 5px;
3306 border-bottom-right-radius: 5px;
3307 border-top-left-radius: 0;
3308 border-top-right-radius: 0;
3309 }
3310
3311 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'modern-theme-header{
3312 border-bottom-left-radius: 0;
3313 border-bottom-right-radius: 0;
3314 border-top-left-radius: 5px;
3315 border-top-right-radius: 5px;
3316 border: none;
3317 box-shadow: none;
3318 margin: 0;
3319 }
3320
3321 #' . $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{
3322 margin: 7px 0;
3323 }
3324
3325 #' . $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 {
3326 padding: 5px 0;
3327 margin: 0px;
3328 }
3329
3330 #' . $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,
3331 #' . $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{
3332 border: none;
3333 }
3334
3335 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-title {
3336 font-weight: bold;
3337 margin: 0 !important;
3338 text-align: ' . $this->options[ $this->name_prefix . 'question_title_alignment' ] . ';
3339 }
3340
3341 #' . $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,
3342 #' . $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,
3343 #' . $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,
3344 #' . $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,
3345 #' . $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{
3346 color: ' . $this->options[ $this->name_prefix . 'color' ] . ';
3347 }
3348
3349 #' . $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,
3350 #' . $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,
3351 #' . $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,
3352 #' . $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,
3353 #' . $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{
3354 background-color: ' . Survey_Maker_Data::hex2rgba( $this->options[ $this->name_prefix . 'buttons_bg_color' ], 0.8 ) . ';
3355 color: '.$this->options[ $this->name_prefix . 'buttons_text_color' ].';
3356 }
3357
3358 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'live-bar-wrap {
3359 background-color: ' . ( $this->options[ $this->name_prefix . 'is_minimal' ] ? $this->options[ $this->name_prefix . 'text_color' ] : $this->options[ $this->name_prefix . 'buttons_bg_color' ] ) . ';
3360 border-color: ' . ( $this->options[ $this->name_prefix . 'is_minimal' ] ? $this->options[ $this->name_prefix . 'text_color' ] : $this->options[ $this->name_prefix . 'buttons_bg_color' ] ) . ';
3361 }
3362
3363 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'live-bar-fill {
3364 background-color: ' . ( $this->options[ $this->name_prefix . 'is_minimal' ] ? $this->options[ $this->name_prefix . 'text_color' ] : $this->options[ $this->name_prefix . 'buttons_text_color' ] ) . ';
3365 }
3366
3367 #' . $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{
3368 background-color: unset;
3369 }
3370
3371 #' . $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,
3372 #' . $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,
3373 #' . $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,
3374 #' . $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 {
3375 color: ' . Survey_Maker_Data::hex2rgba( $this->options[ $this->name_prefix . 'buttons_text_color' ], 0.7) . ';
3376 background-color: ' . Survey_Maker_Data::hex2rgba( $this->options[ $this->name_prefix . 'buttons_bg_color' ], 0.8 ) . ';
3377 }
3378
3379 ';
3380 }
3381
3382 $content[] = $this->get_css_mobile_part($mobile_max_width, $mobile_width, $pagination_number_height);
3383
3384 if( isset($this->options[ $this->name_prefix . 'cover_photo' ]) && $this->options[ $this->name_prefix . 'cover_photo' ] != "" ){
3385 $content[] =
3386 '#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .'.$this->html_class_prefix.'cover-photo-title-wrap {
3387 background-image: url('.$this->options[ $this->name_prefix . 'cover_photo' ].');
3388 background-repeat: no-repeat;
3389 }
3390
3391 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .'.$this->html_class_prefix.'cover-photo-title-wrap .'.$this->html_class_prefix.'title {
3392 display: flex;
3393 align-items: flex-end;
3394 height: 100%;
3395 }
3396 ';
3397
3398 $title_alignment_with_cover_photo_css = 'flex-start';
3399 switch( $this->options[ $this->name_prefix . 'title_alignment' ] ){
3400 case "left":
3401 $title_alignment_with_cover_photo_css = 'flex-start';
3402 break;
3403 case "right":
3404 $title_alignment_with_cover_photo_css = 'flex-end';
3405 break;
3406 case "center":
3407 $title_alignment_with_cover_photo_css = 'center';
3408 break;
3409 default:
3410 $title_alignment_with_cover_photo_css = 'flex-start';
3411 break;
3412 }
3413
3414 $content[] =
3415 '#' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .'.$this->html_class_prefix.'cover-photo-title-wrap .'.$this->html_class_prefix.'title {
3416 justify-content: ' . $title_alignment_with_cover_photo_css . ';
3417 }';
3418
3419 }
3420
3421 $content[] = '</style>';
3422
3423 $content = implode( '', $content );
3424
3425 return $content;
3426 }
3427
3428 public function get_custom_css(){
3429
3430 $content = array();
3431
3432 if( $this->options[ $this->name_prefix . 'custom_css' ] != '' ){
3433
3434 $content[] = '<style type="text/css">';
3435
3436 $content[] = $this->options[ $this->name_prefix . 'custom_css' ];
3437
3438 $content[] = '</style>';
3439
3440 }
3441
3442 $content = implode( '', $content );
3443
3444 return $content;
3445 }
3446
3447 public function get_encoded_options( $limit ){
3448
3449 $content = array();
3450
3451 if( isset( $this->options[ $this->name_prefix . 'submit_redirect_delay' ] ) ){
3452 $this->options[ $this->name_prefix . 'submit_redirect_seconds'] = Survey_Maker_Data::secondsToWords( intval( $this->options[ $this->name_prefix . 'submit_redirect_delay' ] ) );
3453 }
3454
3455 // Animation Top (px)
3456 $setting_options = Survey_Maker_Data::get_setting_data( 'options' );
3457 $survey_animation_top = ( isset($setting_options[ 'survey_animation_top' ]) && $setting_options[ 'survey_animation_top' ] != '' ) ? intval( $setting_options[ 'survey_animation_top' ] ) : '';
3458 $setting_options['survey_enable_animation_top'] = isset($setting_options['survey_enable_animation_top']) ? $setting_options['survey_enable_animation_top'] : 'on';
3459 $survey_enable_animation_top = ( isset($setting_options[ 'survey_enable_animation_top' ]) && $setting_options[ 'survey_enable_animation_top' ] == 'on' ) ? true : false;
3460
3461 $this->options['is_user_logged_in'] = is_user_logged_in();
3462
3463 $this->options[ $this->name_prefix . 'animation_top'] = $survey_animation_top;
3464 $this->options[ $this->name_prefix . 'enable_animation_top'] = $survey_enable_animation_top;
3465
3466 $options = array();
3467 if( ! $limit ){
3468 foreach( $this->options as $k => $q ){
3469 if( strpos( $k, 'email' ) !== false ){
3470 unset( $this->options[ $k ] );
3471 }
3472 }
3473 $options = $this->options;
3474 }else{
3475 if($this->options[ $this->name_prefix . 'redirect_delay' ] && $this->options[ $this->name_prefix . 'redirect_delay' ] != ''){
3476 if($this->options[ $this->name_prefix . 'redirect_url' ] && $this->options[ $this->name_prefix . 'redirect_url' ] != ''){
3477 if($this->options[ $this->name_prefix . 'limit_users' ]){
3478 $options = array(
3479 $this->name_prefix . 'submit_redirect_seconds' => Survey_Maker_Data::secondsToWords( intval( $this->options[ $this->name_prefix . 'submit_redirect_delay' ] ) ),
3480 $this->name_prefix . 'submit_redirect_delay' => intval( $this->options[ $this->name_prefix . 'submit_redirect_delay' ] ),
3481 $this->name_prefix . 'submit_redirect_url' => $this->options[ $this->name_prefix . 'submit_redirect_url' ],
3482 $this->name_prefix . 'limit_users' => $this->options[ $this->name_prefix . 'limit_users' ],
3483 $this->name_prefix . 'redirect_url' => $this->options[ $this->name_prefix . 'redirect_url' ],
3484 $this->name_prefix . 'redirect_delay' => intval( $this->options[ $this->name_prefix . 'redirect_delay' ] ),
3485 $this->name_prefix . 'redirect_delay_seconds' => Survey_Maker_Data::secondsToWords( intval( $this->options[ $this->name_prefix . 'redirect_delay' ] ) ),
3486 );
3487 }
3488 }
3489 }
3490
3491 $options[ $this->name_prefix . 'enable_survey_start_loader' ] = $this->options[ $this->name_prefix . 'enable_survey_start_loader' ];
3492 }
3493
3494 $content[] = '<script type="text/javascript">';
3495
3496 $content[] = "
3497 if(typeof aysSurveyOptions === 'undefined'){
3498 var aysSurveyOptions = [];
3499 }
3500 aysSurveyOptions['" . $this->unique_id . "'] = '" . base64_encode( json_encode( $options ) ) . "';";
3501
3502 $content[] = '</script>';
3503
3504 $content = implode( '', $content );
3505
3506 return $content;
3507 }
3508
3509 protected function ays_survey_check_limitations($limit_by, $limit_users_data){
3510 $is_limited = false;
3511 switch($limit_by){
3512 case 'cookie':
3513
3514 // PRO FEATURE
3515 // $started_user_count = Survey_Maker_Data::get_limit_cookie_count( $limit_users_attr );
3516 // if( $quiz_max_pass_count > $started_user_count){
3517 // $limit_users_attr['increase_count'] = true;
3518 // }
3519 $check_cookie = Survey_Maker_Data::ays_survey_check_cookie( $limit_users_data );
3520 $return_false_status_arr = array(
3521 "status" => false,
3522 "message" => __( 'You already passed this survey.', "survey-maker" ),
3523 "limited" => true
3524 );
3525
3526 // PRO FEATURE
3527 // if( $quiz_max_pass_count <= $started_user_count){
3528 // echo json_encode( $return_false_status_arr );
3529 // wp_die();
3530 // }
3531
3532 if( ! $check_cookie ){
3533 $set_cookie = Survey_Maker_Data::ays_survey_set_cookie( $limit_users_data );
3534 $is_limited = true;
3535 }
3536 else{
3537 echo json_encode( $return_false_status_arr );
3538 wp_die();
3539 }
3540 break;
3541 case 'ip_cookie':
3542 $check_user_by_ip = Survey_Maker_Data::get_user_by_ip( $limit_users_data['id'] );
3543
3544 $started_user_count = Survey_Maker_Data::get_limit_cookie_count( $limit_users_data );
3545 $check_cookie = Survey_Maker_Data::ays_survey_check_cookie( $limit_users_data );
3546
3547 if ( ! $check_cookie || $check_user_by_ip <= 0 ) {
3548 if ( ! $check_cookie ) {
3549 $set_cookie = Survey_Maker_Data::ays_survey_set_cookie( $limit_users_data );
3550 }
3551 }
3552 $is_limited = true;
3553 break;
3554
3555 }
3556 return $is_limited;
3557 }
3558
3559 public function ays_survey_get_user_information() {
3560 $output = array();
3561 if(isset($_POST['nonce']) && wp_verify_nonce($_POST['nonce'], 'survey_maker_autofill_nonce')){
3562 if(is_user_logged_in()) {
3563 $user = wp_get_current_user();
3564
3565 $output = array(
3566 'data' => array(
3567 'display_name' => $user->display_name,
3568 'user_email' => $user->user_email,
3569 )
3570 );
3571 } else {
3572 $output = array();
3573 }
3574 }
3575 return $output;
3576 }
3577
3578 public function ays_survey_popup_set_cookie(){
3579 if( isset( $_REQUEST['id'] ) && $_REQUEST['id'] != '' ){
3580 $id = sanitize_text_field( $_REQUEST['id'] );
3581 }else{
3582 $id = null;
3583 }
3584 if( $id === null ){
3585 return array(
3586 'status' => false
3587 );
3588 }
3589
3590 $cookie_name = 'ays_survey_popup_cookie_name_'.$id;
3591 $cookie_value = 'ays_survey_popup_cookie_value_'.$id;
3592 $cookie_expiration = time() + (12 * 30 * 24 * 60 * 60);
3593 setcookie($cookie_name, $cookie_value, $cookie_expiration, '/');
3594 return array(
3595 'status' => true
3596 );
3597 }
3598
3599 public function get_css_mobile_part($mobile_max_width, $mobile_width, $pagination_number_height) {
3600 $content = '';
3601
3602 $question_image_width_mobile = '100%';
3603 if( $this->options[ $this->name_prefix . 'question_image_width_mobile' ] != '' ){
3604 $question_image_width_mobile = $this->options[ $this->name_prefix . 'question_image_width_mobile' ] . 'px';
3605 }
3606
3607 $question_image_height_mobile = 'auto';
3608 if( $this->options[ $this->name_prefix . 'question_image_height_mobile' ] != '' ){
3609 $question_image_height_mobile = $this->options[ $this->name_prefix . 'question_image_height_mobile' ] . 'px';
3610 }
3611 else{
3612 if($this->options[ $this->name_prefix . 'question_image_height' ] != ''){
3613 $question_image_height_mobile = $this->options[ $this->name_prefix . 'question_image_height' ] . 'px';
3614 }
3615 }
3616
3617 switch($this->options[ $this->name_prefix . 'logo_image_position_mobile' ]){
3618 case "right":
3619 $survey_logo_image_position_mobile = "right: 5px;";
3620 break;
3621 case "left":
3622 $survey_logo_image_position_mobile = "left: 5px;";
3623 break;
3624 case "center":
3625 $survey_logo_image_position_mobile = "left: 50%;";
3626 break;
3627 default:
3628 $survey_logo_image_position_mobile = "right: 5px;";
3629 break;
3630 }
3631
3632
3633 switch($this->options[ $this->name_prefix . 'start_page_button_pos_mobile' ]){
3634 case "left":
3635 $survey_start_page_button_pos_mobile = 'justify-content: flex-start;';
3636 break;
3637 case "center":
3638 $survey_start_page_button_pos_mobile = 'justify-content: center;';
3639 break;
3640 case "right":
3641 $survey_start_page_button_pos_mobile = 'justify-content: flex-end;';
3642 break;
3643 }
3644
3645 $survey_pagination_positioning_mobile = isset($this->options[ $this->name_prefix . 'pagination_positioning_mobile' ]) ? $this->options[ $this->name_prefix . 'pagination_positioning_mobile' ] : 'none';
3646 $pagination_positioning_mobile = "row";
3647 // $pagination_number_height = "";
3648 switch ($survey_pagination_positioning_mobile) {
3649 case 'none':
3650 $pagination_positioning_mobile = "row";
3651 break;
3652 case 'reverse':
3653 $pagination_positioning_mobile = "row-reverse";
3654 break;
3655 case 'column':
3656 $pagination_positioning_mobile = "column";
3657 // $pagination_number_height = "line-height: 1;";
3658 break;
3659 case 'column_reverse':
3660 $pagination_positioning_mobile = "column-reverse";
3661 // $pagination_number_height = "line-height: 1;";
3662 break;
3663 default:
3664 $pagination_positioning_mobile = "row";
3665 // $pagination_number_height = "";
3666 break;
3667 }
3668
3669 // Question padding mobile
3670 $question_padding = $this->options[ $this->name_prefix . 'question_padding_mobile' ];
3671 $question_caption_text_display = !$this->options[ $this->name_prefix . 'question_caption_hide_on_mobile' ] ? 'block' : 'none';
3672 $question_border_radius = $this->options[ $this->name_prefix . 'question_border_radius_mobile' ];
3673 $content .= '
3674 @media screen and (max-width: 640px){
3675 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' {
3676 max-width: '. $mobile_max_width .';
3677 }
3678
3679 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' {
3680 width: ' . $mobile_width . ';
3681 }
3682
3683 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-box{
3684 width: 100%;
3685 }
3686
3687 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'live-bar-main{
3688 flex-wrap: wrap;
3689 flex-direction: '.$pagination_positioning_mobile.';
3690 }
3691
3692 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'footer-with-live-bar{
3693 flex-direction: column-reverse;
3694 }
3695
3696 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'live-bar-main{
3697 margin-bottom: 10px;
3698 }
3699
3700 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-required-icon,
3701 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-title {
3702 font-size: ' . $this->options[ $this->name_prefix . 'question_font_size_mobile' ] . 'px;
3703 }
3704
3705 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question {
3706 ' . ( $this->options[ $this->name_prefix . 'logo' ] != '' ? 'padding: '.$question_padding.'px '.$question_padding.'px 0 '.$question_padding.'px;' : 'padding: '.$question_padding.'px;' ) . '
3707 border-radius: ' . $question_border_radius . 'px;
3708 }
3709
3710 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons {
3711 margin-top: ' . $this->options[ $this->name_prefix . 'buttons_top_distance_mobile' ] . 'px;
3712 text-align: ' . $this->options[ $this->name_prefix . 'buttons_alignment_mobile' ] . ';
3713 }
3714
3715 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container{
3716 border-radius: ' . $this->options[ $this->name_prefix . 'buttons_border_radius_mobile' ] . 'px;
3717 }
3718
3719 #' . $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{
3720 font-size: ' . $this->options[ $this->name_prefix . 'buttons_mobile_font_size' ] . 'px;
3721 letter-spacing: ' . $this->options[ $this->name_prefix . 'buttons_text_letter_spacing_mobile' ] . 'px;
3722 line-height: 2.5;
3723 white-space: normal;
3724 word-break: break-word;
3725 }
3726
3727 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'title{
3728 text-align: ' . $this->options[ $this->name_prefix . 'title_alignment_mobile' ] . ';
3729 font-size: ' . $this->options[ $this->name_prefix . 'title_font_size_for_mobile' ] . 'px;
3730 letter-spacing: ' . $this->options[ $this->name_prefix . 'title_letter_spacing_mobile' ] . 'px;
3731 }
3732
3733 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'section-title-row-main{
3734 text-align: ' . $this->options[ $this->name_prefix . 'section_title_alignment_mobile' ] . ';
3735 font-size: ' . $this->options[ $this->name_prefix . 'section_title_font_size_mobile' ] . 'px;
3736 letter-spacing: ' . $this->options[ $this->name_prefix . 'section_title_letter_spacing_mobile' ] . 'px;
3737 }
3738
3739 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'section-desc{
3740 text-align: ' . $this->options[ $this->name_prefix . 'section_description_alignment_mobile' ] . ';
3741 font-size: ' . $this->options[ $this->name_prefix . 'section_description_font_size_mobile' ] . 'px;
3742 letter-spacing: ' . $this->options[ $this->name_prefix . 'section_description_letter_spacing_mobile' ] . 'px;
3743 }
3744
3745 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' input.' . $this->html_class_prefix . 'question-input {
3746 font-size: ' . $this->options[ $this->name_prefix . 'answer_font_size_on_mobile' ] . 'px;
3747 letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing_mobile' ] . 'px;
3748 height: auto;
3749 }
3750
3751 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' textarea.' . $this->html_class_prefix . 'question-input {
3752 letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing_mobile' ] . 'px;
3753 }
3754
3755
3756 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer {
3757 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;
3758 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;
3759 }
3760
3761 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-label-content > span {
3762 font-size: ' . $this->options[ $this->name_prefix . 'answer_font_size_on_mobile' ] . 'px;
3763 letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing_mobile' ] . 'px;
3764 line-height: 1;
3765 }
3766
3767 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-select.dropdown div.text,
3768 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-select.dropdown div.item {
3769 font-size: ' . $this->options[ $this->name_prefix . 'answer_font_size_on_mobile' ] . 'px !important;
3770 letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing_mobile' ] . 'px;
3771 line-height: 1 !important;
3772 }
3773
3774 #' . $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 {
3775 justify-content: ' . $this->options[ $this->name_prefix . 'start_page_title_pos_mobile' ] . ';
3776 }
3777
3778 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-select.dropdown div.item {
3779 font-size: ' . $this->options[ $this->name_prefix . 'answer_font_size_on_mobile' ] . 'px !important;
3780 letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing_mobile' ] . 'px;
3781 line-height: 1 !important;
3782 }
3783
3784 #' . $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{
3785 '.$survey_logo_image_position_mobile.'
3786 }
3787
3788 #' . $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{
3789 font-size: ' . $this->options[ $this->name_prefix . 'answer_font_size_on_mobile' ] . 'px;
3790 letter-spacing: ' . $this->options[ $this->name_prefix . 'answer_letter_spacing_mobile' ] . 'px;
3791 '.$pagination_number_height.'
3792 }
3793
3794 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'cover-photo-title-wrap{
3795 height: ' . $this->options[ $this->name_prefix . 'cover_photo_mobile_height' ] . 'px;
3796 }
3797
3798 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-image-caption span{
3799 color: '.$this->options[ $this->name_prefix . 'question_caption_text_color_mobile' ].' !important;
3800 font-size: '.$this->options[ $this->name_prefix . 'question_caption_font_size_on_mobile' ].'px;
3801 text-transform: '.$this->options[ $this->name_prefix . 'question_caption_text_transform_mobile' ].' !important;
3802 letter-spacing: '.$this->options[ $this->name_prefix . 'question_caption_letter_spacing_mobile' ].'px !important;
3803 display: '.$question_caption_text_display .';
3804 text-align: ' . $this->options[ $this->name_prefix . 'question_caption_text_alignment_on_mobile' ] . ';
3805 }
3806
3807 #' . $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{
3808 font-size: ' . $this->options[ $this->name_prefix . 'progress_bar_text_font_size_on_mobile' ] . 'px;
3809 color: ' . $this->options[ $this->name_prefix . 'pagination_text_color_mobile' ] . ';
3810 letter-spacing: ' . $this->options[ $this->name_prefix . 'progress_bar_text_letter_spacing_mobile' ] . 'px;
3811 text-transform: '.$this->options[ $this->name_prefix . 'progress_bar_text_transform_mobile' ].';
3812 line-height: 1;
3813 }
3814 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-image {
3815 width: ' . $question_image_width_mobile . ';
3816 height: ' . $question_image_height_mobile . ';
3817 object-fit: ' . $this->options[ $this->name_prefix . 'question_image_sizing_mobile' ] . ';
3818 }
3819 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'answer-image {
3820 object-fit: ' . $this->options[ $this->name_prefix . 'answers_object_fit_mobile' ] . ';
3821 }
3822 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-start-page .' . $this->html_class_prefix . 'section-buttons {
3823 display: flex;
3824 '.$survey_start_page_button_pos_mobile.'
3825 }
3826 }';
3827 $content .= '
3828 @media screen and (max-width: 580px) {
3829 #' . $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{
3830 height: ' . $this->options[ $this->name_prefix . 'answers_image_size_mobile' ] . 'px;
3831 }
3832
3833 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'live-bar-main{
3834 justify-content: center;
3835 }
3836 }';
3837 $content .= '
3838 @media screen and (min-width: 580px) and (max-width: 1024px) {
3839 #' . $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{
3840 height: 150px;
3841 }
3842 }';
3843
3844 return $content;
3845 }
3846
3847
3848 public function ays_generate_survey_popup_method( $attr ){
3849
3850 $id = (isset($attr['id'])) ? absint(intval($attr['id'])) : null;
3851 if (is_null($id)) {
3852 return '';
3853 }
3854
3855 $this->enqueue_scripts_popups();
3856
3857 $content = $this->ays_popup_shortcode_content($id, $attr);
3858 return $content ? str_replace( array( "\r\n", "\n", "\r" ), "\n", $content ) : '';
3859 }
3860
3861
3862 public function ays_popup_shortcode_content( $id, $attr ){
3863 global $wpdb;
3864 $post_id = get_the_ID();
3865 $popup_surveys_table = $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "popup_surveys";
3866 $surveys_table = $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "surveys";
3867 $sql = "SELECT p_s.*, s.options as s_options, s.status as survey_status
3868 FROM {$popup_surveys_table} as p_s
3869 LEFT JOIN {$surveys_table} AS s
3870 ON p_s.survey_id = s.id
3871 WHERE p_s.id = {$id}";
3872 $popup = $wpdb->get_row( $sql, "ARRAY_A" );
3873
3874 if( empty( $popup ) ){
3875 return '';
3876 }
3877
3878 $survey_status = (isset($popup['survey_status'] ) && $popup['survey_status'] != '') ? $popup['survey_status'] : 'published';
3879 $is_elementor_exists = Survey_Maker_Data::ays_survey_is_elementor();
3880 if($survey_status == 'published' && !$is_elementor_exists){
3881
3882 $show_all = $popup['show_all'];
3883 switch($show_all){
3884 case 'all':
3885 $show_popup = true;
3886 break;
3887 case 'selected':
3888 $show_popup = false;
3889 break;
3890 case 'except':
3891 $show_popup = true;
3892 break;
3893 default:
3894 $show_popup = true;
3895 $show_all = 'all';
3896 break;
3897 }
3898
3899 $show = array('selected');
3900
3901 $options = array();
3902 $survey_options = array();
3903 if ($popup['options'] != '' || $popup['options'] != null) {
3904 $options = json_decode( $popup['options'], true );
3905 }
3906
3907 if ($popup['s_options'] != '' || $popup['s_options'] != null) {
3908 $survey_options = json_decode( $popup['s_options'], true );
3909 }
3910 // Title
3911 $popup_title = isset( $popup["title"] ) && $popup["title"] != "" ? stripslashes( esc_attr( $popup["title"] ) ) : "";
3912
3913 // Show popup title
3914 $survey_popup_enable_show_title = (isset($options["popup_enable_show_title"]) && $options["popup_enable_show_title"] == "on") ? true : false;
3915
3916 // Popup title font size
3917 $survey_popup_title_font_size = (isset($options['popup_title_font_size']) && $options['popup_title_font_size'] != '') ? absint ( intval( $options['popup_title_font_size'] ) ) : 25;
3918
3919 // Popup title font size on mobile
3920 $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;
3921
3922 // Popup title bg color
3923 $survey_popup_title_bg_color = (isset($options["popup_title_bg_color"]) && $options["popup_title_bg_color"] != "") ? esc_attr ( $options["popup_title_bg_color"] ) : "#000000";
3924 // Popup title bg color mobile
3925 $options["popup_title_bg_color_mobile"] = isset($options["popup_title_bg_color_mobile"]) ? $options["popup_title_bg_color_mobile"] : $survey_popup_title_bg_color;
3926 $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";
3927
3928 // Popup title text color
3929 $survey_popup_title_text_color = (isset($options["popup_title_text_color"]) && $options["popup_title_text_color"] != "") ? esc_attr ( $options["popup_title_text_color"] ) : "#000000";
3930 // Popup title text color mobile
3931 $options["popup_title_text_color_mobile"] = isset($options["popup_title_text_color_mobile"]) ? $options["popup_title_text_color_mobile"] : $survey_popup_title_text_color;
3932 $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";
3933
3934 // Popup title alignment
3935 $survey_popup_title_alignment = (isset($options["popup_title_alignment"]) && $options["popup_title_alignment"] != "") ? esc_attr ( $options["popup_title_alignment"] ) : "left";
3936
3937 // Popup title alignment on mobile
3938 $options["popup_title_alignment_on_mobile"] = isset($options["popup_title_alignment_on_mobile"]) ? $options["popup_title_alignment_on_mobile"] : $survey_popup_title_alignment;
3939 $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";
3940
3941 // Popup title transform
3942 $survey_popup_title_transform = (isset($options["popup_title_transform"]) && $options["popup_title_transform"] != "") ? esc_attr ( $options["popup_title_transform"] ) : "none";
3943 // Popup title transform mobile
3944 $options["popup_title_transform_mobile"] = isset($options["popup_title_transform_mobile"]) ? $options["popup_title_transform_mobile"] : $survey_popup_title_transform;
3945 $survey_popup_title_transform_mobile = (isset($options["popup_title_transform_mobile"]) && $options["popup_title_transform_mobile"] != "") ? esc_attr ( $options["popup_title_transform_mobile"] ) : "none";
3946
3947 // Popup title letter spacing
3948 $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;
3949
3950 // Popup title letter spacing mobile
3951 $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;
3952 $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;
3953
3954 // Hide popup title on mobile
3955 $survey_popup_hide_title_on_mobile = (isset($options["popup_hide_title_on_mobile"]) && $options["popup_hide_title_on_mobile"] == "on") ? true : false;
3956
3957 // Title border radius
3958 $survey_popup_title_border_radius = (isset($options["popup_title_border_radius"]) && $options["popup_title_border_radius"] != "") ? absint ( intval( $options["popup_title_border_radius"] ) ) : 0;
3959 // Title border radius mobile
3960 $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;
3961
3962 // Width
3963 $popup_survey_width = (isset($options['width']) && $options['width'] != '') ? absint ( intval( $options['width'] ) ) : 800;
3964 // Mobile width
3965 $options['width_mobile'] = isset($options['width_mobile']) ? $options['width_mobile'] : $popup_survey_width;
3966 $popup_survey_width_mobile = (isset($options['width_mobile']) && $options['width_mobile'] != '') ? absint ( intval( $options['width_mobile'] ) ) : 800;
3967
3968 // Height
3969 $popup_survey_height = (isset($options['height']) && $options['height'] != '') ? absint ( intval( $options['height'] ) ) : 450;
3970 // Height mobile
3971 $options['height_mobile'] = isset($options['height_mobile']) ? $options['height_mobile'] : $popup_survey_height;
3972 $popup_survey_height_mobile = (isset($options['height_mobile']) && $options['height_mobile'] != '') ? absint ( intval( $options['height_mobile'] ) ) : 450;
3973
3974 // Popup Position
3975 $popup_position = (isset($options['popup_position']) && $options['popup_position'] != 'center-center') ? $options['popup_position'] : 'center-center';
3976
3977 // Popup Margin
3978 $popup_margin = (isset($options['popup_margin']) && $options['popup_margin'] != '') ? $options['popup_margin'] : '0';
3979
3980 $hide_popup = (isset($options['hide_popup']) && $options['hide_popup'] == 'on') ? $options['hide_popup'] : 'off';
3981
3982 // Hide popup after close
3983 $hide_popup_after_close = (isset($options['hide_popup_after_close']) && $options['hide_popup_after_close'] == 'on') ? esc_attr($options['hide_popup_after_close']) : 'off';
3984
3985 // Hide popup on mobile
3986 $options['hide_popup_on_mobile'] = isset( $options['hide_popup_on_mobile'] ) ? esc_attr($options['hide_popup_on_mobile']) : "off";
3987 $hide_popup_on_mobile = (isset($options['hide_popup_on_mobile']) && $options['hide_popup_on_mobile'] == 'on') ? true : false;
3988
3989 // Hide popup on PC
3990 $options['hide_popup_on_pc'] = isset( $options['hide_popup_on_pc'] ) ? esc_attr($options['hide_popup_on_pc']) : "off";
3991 $hide_popup_on_pc = (isset($options['hide_popup_on_pc']) && $options['hide_popup_on_pc'] == 'on') ? true : false;
3992
3993 // Hide popup on tablet
3994 $options['hide_popup_on_tablet'] = isset( $options['hide_popup_on_tablet'] ) ? esc_attr($options['hide_popup_on_tablet']) : "off";
3995 $hide_popup_on_tablet = (isset($options['hide_popup_on_tablet']) && $options['hide_popup_on_tablet'] == 'on') ? true : false;
3996
3997 // Close by clicking outside the box
3998 $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';
3999
4000 // $survey_bg = (isset($survey_options['survey_background_color']) && $survey_options['survey_background_color'] != '') ? $survey_options['survey_background_color'] : '#ffffff';
4001 // $survey_theme = (isset($survey_options['survey_theme']) && $survey_options['survey_theme'] != '') ? $survey_options['survey_theme'] : 'classic_light';
4002 // $is_minimal = $survey_theme == 'minimal' ? true : false;
4003 // $is_modern = $survey_theme == 'modern' ? true : false;
4004
4005 // if( $is_minimal || $is_modern){
4006 // $survey_bg = '#ffffff';
4007 // }
4008
4009 // $survey_text_color = (isset($survey_options['survey_text_color']) && $survey_options['survey_text_color'] != '') ? $survey_options['survey_text_color'] : '#ffffff';
4010
4011 // // Popup full screen mode
4012 $survey_popup_full_screen = (isset($options["full_screen_mode"]) && $options["full_screen_mode"] == "on") ? true : false;
4013 // // Popup background color
4014 $popup_bg_color = (isset($options['popup_bg_color']) && $options['popup_bg_color'] != '') ? $options['popup_bg_color'] : '#ffffff';
4015
4016 // Popup background color | Mobile
4017 $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;
4018
4019 // // Popup trigger type
4020 $popup_trigger_type = (isset($options["popup_trigger"]) && $options["popup_trigger"] != "") ? esc_attr($options["popup_trigger"]) : "on_load";
4021
4022 // Popup close after finish
4023 $survey_enable_popup_close_after_finish = (isset($options["enable_popup_close_after_finish"]) && $options["enable_popup_close_after_finish"] == "on") ? true : false;
4024 $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' ] ) ) : '';
4025
4026 // Popup selector
4027 $popup_selector = (isset($options["popup_selector"]) && $options["popup_selector"] != "") ? stripslashes( esc_attr($options["popup_selector"])) : "";
4028
4029 // Close by pressing the ESC
4030 $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';
4031
4032
4033 // if($show_all != 'all'){
4034 // if($post_id != false){
4035 // $post = get_post( $post_id );
4036 // $this_post_title = strval( $post->ID );
4037 // $except_posts = array();
4038 // $except_post_types = array();
4039 // $postType = $post->post_type;
4040
4041 // if (isset($options['except_posts']) && !empty($options['except_posts'])) {
4042 // $except_posts = $options['except_posts'];
4043 // }
4044
4045 // if (isset($options['except_post_types']) && !empty($options['except_post_types'])) {
4046 // $except_post_types = $options['except_post_types'];
4047 // }
4048
4049 // $except_all_post_types = ( isset( $options['all_posts'] ) && ! empty( $options['all_posts'] ) ) ? $options['all_posts'] : array();
4050
4051 // if ( is_front_page() ) {
4052 // if( isset($options['show_on_home_page']) && $options['show_on_home_page'] == 'on' ){
4053 // $show_popup = true;
4054 // }else{
4055 // $show_popup = false;
4056 // }
4057 // }
4058
4059 // if( in_array( $post_id . "", $except_posts ) ){
4060 // if( in_array( $show_all, $show ) ){
4061 // $show_popup = true;
4062 // }else{
4063 // $show_popup = false;
4064 // }
4065 // }elseif( !in_array( $this_post_title, $except_posts ) && in_array( $postType, $except_all_post_types ) ) {
4066 // if( in_array( $show_all, $show ) ){
4067 // $show_popup = true;
4068 // }else{
4069 // $show_popup = false;
4070 // }
4071 // }
4072 // }
4073 // }
4074
4075 if($hide_popup_on_mobile){
4076 if(Survey_Maker_Data::ays_survey_pb_detect_mobile_device() === true){
4077 $show_popup = false;
4078 }
4079 }
4080 if($hide_popup_on_pc){
4081 if(Survey_Maker_Data::ays_survey_pb_detect_mobile_device() === false && Survey_Maker_Data::ays_survey_pb_detect_tablet_device() === false){
4082 $show_popup = false;
4083 }
4084 }
4085
4086 if($hide_popup_on_tablet){
4087 if(Survey_Maker_Data::ays_survey_pb_detect_tablet_device() === true){
4088 $show_popup = false;
4089 }
4090 }
4091
4092 switch($popup_trigger_type){
4093 case 'on_click':
4094 $display_popup_on_load = 'display_none_not_important';
4095 break;
4096 case 'on_load':
4097 default:
4098 $display_popup_on_load = '';
4099 break;
4100 }
4101
4102 if( ! isset( $_COOKIE[ 'ays_survey_popup_cookie_name_' . $popup['id'] ] ) && ! isset( $_COOKIE[ 'ays_survey_popup_hide_after_click_close_' . $popup['id'] ] ) ){
4103 if ($show_popup) {
4104 $shortcode2 = '[ays_survey id="'. $popup['survey_id'] .'"]';
4105 // $popup_survey_view = "<div class='ays-survey-popup-survey-window ays-survey-popup-modal-".$popup['id']."' data-id='".$popup['id']."'>
4106 $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."'>
4107 <div class='ays-survey-popup-btn-close'>
4108 <img class='ays-survey-popup-btn-close-icon' src='". SURVEY_MAKER_PUBLIC_URL ."/images/cross.svg'>
4109 </div>";
4110 $popup_survey_view .= "<div class='ays-survey-popup-content'>";
4111 if($survey_popup_enable_show_title){
4112 $popup_survey_view .= "<div class='ays-survey-popup-title-content'>".$popup_title."</div>";
4113
4114 }
4115 if($survey_popup_full_screen){
4116 $popup_survey_view .= '<div class="ays-survey-popup-full-screen-mode">
4117 <a class="ays-survey-popup-full-screen-container">
4118 <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">
4119 <path d="M0 0h24v24H0z" fill="none"/>
4120 <path d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"/>
4121 </svg>
4122 <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">
4123 <path d="M0 0h24v24H0z" fill="none"/>
4124 <path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/>
4125 </svg>
4126 </a>
4127 </div>';
4128 }
4129 $popup_survey_view .= "<div class='ays-survey-popup-main'>".do_shortcode($shortcode2)."</div>
4130 </div>";
4131
4132 $margin_right = '';
4133 $additional_css = '';
4134 switch ( $popup_position ){
4135 case "center-center":
4136 $ays_survey_popup_conteiner_pos_top = '12px';
4137 $ays_survey_popup_conteiner_pos_left = '0';
4138 $ays_survey_popup_conteiner_pos_right = '0';
4139 $ays_survey_popup_conteiner_pos_bottom = '0';
4140 $popup_margin = 'auto';
4141 $additional_css = 'max-height: calc( 100vh - 12px )';
4142 break;
4143 case "left-top":
4144
4145 $ays_survey_popup_conteiner_pos_top = '0';
4146 $ays_survey_popup_conteiner_pos_left = '0';
4147 $ays_survey_popup_conteiner_pos_right = 'unset';
4148 $ays_survey_popup_conteiner_pos_bottom = 'unset';
4149 $popup_margin = 'px';
4150
4151 if( absint( $popup_margin ) < 12 ){
4152 $margin_right = 'margin-top: 12px;';
4153 }
4154 break;
4155 case "top-center":
4156
4157 $ays_survey_popup_conteiner_pos_top = '0';
4158 $ays_survey_popup_conteiner_pos_left = '50%';
4159 $ays_survey_popup_conteiner_pos_right = 'unset';
4160 $ays_survey_popup_conteiner_pos_bottom = 'unset';
4161 $popup_margin = 'px auto';
4162 $additional_css = 'transform: translateX(-50%);';
4163
4164 if( absint( $popup_margin ) < 12 ){
4165 $margin_right = 'margin-top: 12px;';
4166 }
4167 break;
4168 case "right-top":
4169
4170 $ays_survey_popup_conteiner_pos_top = '0';
4171 $ays_survey_popup_conteiner_pos_left = 'unset';
4172 $ays_survey_popup_conteiner_pos_right = '0';
4173 $ays_survey_popup_conteiner_pos_bottom = 'unset';
4174 $popup_margin .= 'px';
4175 if( absint( $popup_margin ) < 12 ){
4176 $margin_right = 'margin-right: 12px;margin-top: 12px;';
4177 }
4178
4179 break;
4180 case "left-center":
4181
4182 $ays_survey_popup_conteiner_pos_top = '0';
4183 $ays_survey_popup_conteiner_pos_left = '0';
4184 $ays_survey_popup_conteiner_pos_right = 'unset';
4185 $ays_survey_popup_conteiner_pos_bottom = '0';
4186 $popup_margin = 'auto ' . $popup_margin . 'px';
4187
4188 break;
4189 case "right-center":
4190
4191 $ays_survey_popup_conteiner_pos_top = '0';
4192 $ays_survey_popup_conteiner_pos_left = 'unset';
4193 $ays_survey_popup_conteiner_pos_right = '0';
4194 $ays_survey_popup_conteiner_pos_bottom = '0';
4195 $popup_margin = 'auto ' . $popup_margin . 'px';
4196
4197 if( absint( $popup_margin ) < 12 ){
4198 $margin_right = 'margin-right: 12px;';
4199 }
4200 break;
4201 case "right-bottom":
4202
4203 $ays_survey_popup_conteiner_pos_top = 'unset';
4204 $ays_survey_popup_conteiner_pos_left = 'unset';
4205 $ays_survey_popup_conteiner_pos_right = '0';
4206 $ays_survey_popup_conteiner_pos_bottom = '0';
4207 $popup_margin = 'px';
4208
4209 if( absint( $popup_margin ) < 12 ){
4210 $margin_right = 'margin-right: 12px;';
4211 }
4212 break;
4213 case "center-bottom":
4214
4215 $ays_survey_popup_conteiner_pos_top = 'unset';
4216 $ays_survey_popup_conteiner_pos_left = '50%';
4217 $ays_survey_popup_conteiner_pos_right = 'unset';
4218 $ays_survey_popup_conteiner_pos_bottom = '0';
4219 $popup_margin = 'px auto';
4220 $additional_css = 'transform: translateX(-50%);';
4221
4222 break;
4223 case "left-bottom":
4224
4225 $ays_survey_popup_conteiner_pos_top = 'unset';
4226 $ays_survey_popup_conteiner_pos_left = '0';
4227 $ays_survey_popup_conteiner_pos_right = 'unset';
4228 $ays_survey_popup_conteiner_pos_bottom = '0';
4229 $popup_margin = 'px';
4230
4231 break;
4232 }
4233
4234 $hide_popup_on_mobile_class = $survey_popup_hide_title_on_mobile ? 'display: none;' : '';
4235
4236 $popup_survey_view .= '
4237 <style>
4238 .ays-survey-popup-modal-' . $popup['id'] . ' {
4239 width: ' . $popup_survey_width . 'px;
4240 height: ' . $popup_survey_height . 'px;
4241 background-color: ' . $popup_bg_color . ';
4242 top: ' . $ays_survey_popup_conteiner_pos_top . ';
4243 left: ' . $ays_survey_popup_conteiner_pos_left . ';
4244 right: ' . $ays_survey_popup_conteiner_pos_right . ';
4245 bottom: ' . $ays_survey_popup_conteiner_pos_bottom . ';
4246 margin: ' . $popup_margin . ';
4247 ' . $margin_right . '
4248 ' . $additional_css . '
4249 }
4250
4251 .ays-survey-popup-modal-' . $popup['id'] . ' .ays-survey-popup-title-content{
4252 background-color: '.$survey_popup_title_bg_color.';
4253 color: '.$survey_popup_title_text_color.';
4254 font-size: '.$survey_popup_title_font_size.'px;
4255 text-align: '.$survey_popup_title_alignment.';
4256 text-transform: '.$survey_popup_title_transform.';
4257 letter-spacing: '.$survey_popup_title_letter_spacing.'px;
4258 line-height: 2;
4259 border-radius: '.$survey_popup_title_border_radius.'px;
4260 padding: 0 10px;
4261 }
4262
4263 @media screen and (max-width: 640px){
4264 div.ays-survey-popup-modal-' . $popup['id'] . ' {
4265 width: ' . $popup_survey_width_mobile . 'px;
4266 height: ' . $popup_survey_height_mobile . 'px;
4267 background-color: ' . $popup_bg_color_mobile . ';
4268 }
4269 .ays-survey-popup-modal-' . $popup['id'] . ' .ays-survey-popup-title-content{
4270 font-size: '.$survey_popup_title_mobile_font_size.'px;
4271 color: '.$survey_popup_title_text_color_mobile.';
4272 background-color: '.$survey_popup_title_bg_color_mobile.';
4273 '.$hide_popup_on_mobile_class.';
4274 letter-spacing: '.$survey_popup_title_letter_spacing_on_mobile.'px;
4275 text-align: '.$survey_popup_title_alignment_on_mobile.';
4276 text-transform: '.$survey_popup_title_transform_mobile.';
4277 border-radius: '.$survey_popup_title_border_radius_mobile.'px;
4278 }
4279 }
4280
4281 </style>
4282 ';
4283
4284 $popup_survey_view .= '<script type="text/javascript">';
4285
4286 $popup_survey_view .= "
4287 if(typeof aysSurveyPopupsOptions === 'undefined'){
4288 var aysSurveyPopupsOptions = [];
4289 }
4290 aysSurveyPopupsOptions['" . $popup['id'] . "'] = '" . base64_encode( json_encode( array(
4291 'hidePopup' => $hide_popup,
4292 'hidePopupAfterClose' => $hide_popup_after_close,
4293 'popup_trigger' => $popup_trigger_type,
4294 'enable_popup_close_after_finish' => $survey_enable_popup_close_after_finish,
4295 'popup_close_after_finish_delay' => $survey_popup_close_after_finish_delay,
4296 'popup_selector' => $popup_selector,
4297 'popupEnableCloseByEsc' => $survey_popup_enable_close_by_esc,
4298 'closePopupOverlayOutsideClick' => $close_popup_overlay_outside_click,
4299
4300 ) ) ) . "';";
4301 $popup_survey_view .= '</script>';
4302 $popup_survey_view .= '</div>';
4303
4304 return $popup_survey_view;
4305 }
4306 }
4307 }
4308 }
4309
4310
4311 public function ays_shortcodes_show_all(){
4312 global $wpdb;
4313 $post_id = get_the_ID();
4314 $popup_surveys_table = $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "popup_surveys";
4315 $surveys_table = $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "surveys";
4316 $sql = "SELECT p_s.*, s.options as s_options, s.status as survey_status
4317 FROM {$popup_surveys_table} as p_s
4318 LEFT JOIN {$surveys_table} AS s
4319 ON p_s.survey_id = s.id
4320 WHERE p_s.status = 'published'";
4321 $result = $wpdb->get_results( $sql, "ARRAY_A" );
4322
4323 foreach($result as $key => $value){
4324 echo do_shortcode('[ays_survey_popup id="'. $value['id'] .'"]');
4325 }
4326 }
4327
4328 public function checkNextButtonVisibility($other_answers_count, $question_type){
4329 return ($other_answers_count === 0 && $question_type === 0 && $this->options[ $this->name_prefix . 'disable_next_button' ]);
4330 }
4331 }
4332