| @@ -56,8 +56,10 @@ | ||
| 56 | 56 | // Survey Theme |
| 57 | 57 | $settings[ $name_prefix . 'theme' ] = (isset($options[ $name_prefix . 'theme' ]) && $options[ $name_prefix . 'theme' ] != '') ? stripslashes ( sanitize_text_field( $options[ $name_prefix . 'theme' ] ) ) : 'classic_light'; |
| 58 | 58 | $settings[ $name_prefix . 'is_minimal' ] = $settings[ $name_prefix . 'theme' ] == 'minimal' ? true : false; |
| 59 | 59 | $settings[ $name_prefix . 'is_modern' ] = $settings[ $name_prefix . 'theme' ] == 'modern' ? true : false; |
| 60 | + $settings[ $name_prefix . 'is_business' ] = false; | |
| 61 | + $settings[ $name_prefix . 'is_elegant' ] = false; | |
| 60 | 62 | |
| 61 | 63 | // Survey Color |
| 62 | 64 | $settings[ $name_prefix . 'color' ] = (isset($options[ $name_prefix . 'color' ]) && $options[ $name_prefix . 'color' ] != '') ? stripslashes ( esc_attr( $options[ $name_prefix . 'color' ] ) ) : '#ff5722'; // '#673ab7' |
| 63 | 65 | |
| @@ -572,8 +574,17 @@ | ||
| 572 | 574 | |
| 573 | 575 | // Auto numbering questions |
| 574 | 576 | $settings[ $name_prefix . 'auto_numbering_questions' ] = (isset($options[ $name_prefix . 'auto_numbering_questions' ]) && $options[ $name_prefix . 'auto_numbering_questions' ] != '') ? stripslashes( $options[ $name_prefix . 'auto_numbering_questions' ] ) : 'none'; |
| 575 | 577 | |
| 578 | + // Enable terms and conditions | |
| 579 | + $options[ $name_prefix . 'enable_terms_and_conditions' ] = isset($options[ $name_prefix . 'enable_terms_and_conditions' ]) ? esc_attr($options[ $name_prefix . 'enable_terms_and_conditions' ]) : 'off'; | |
| 580 | + $settings[ $name_prefix . 'enable_terms_and_conditions' ] = (isset($options[ $name_prefix . 'enable_terms_and_conditions' ]) && $options[ $name_prefix . 'enable_terms_and_conditions' ] == 'on') ? true : false; | |
| 581 | + $settings[ $name_prefix . 'terms_and_conditions_data' ] = (isset($options[ $name_prefix . 'terms_and_conditions_data' ]) && !empty($options[ $name_prefix . 'terms_and_conditions_data' ])) ? $options[ $name_prefix . 'terms_and_conditions_data' ] : array(); | |
| 582 | + | |
| 583 | + //Terms and conditions required message | |
| 584 | + $options[ $name_prefix . 'enable_terms_and_conditions_required_message' ] = (isset($options[ 'enable_terms_and_conditions_required_message' ]) && $options['enable_terms_and_conditions_required_message' ] != '') ? $options['enable_terms_and_conditions_required_message' ] : 'off'; | |
| 585 | + $settings['enable_terms_and_conditions_required_message' ] = (isset($options['enable_terms_and_conditions_required_message' ]) && $options['enable_terms_and_conditions_required_message' ] == 'on') ? true : false; | |
| 586 | + | |
| 576 | 587 | // ============================================================= |
| 577 | 588 | // =================== Results Settings Tab =================== |
| 578 | 589 | // ======================== START ========================= |
| 579 | 590 | |
| @@ -736,8 +747,17 @@ | ||
| 736 | 747 | |
| 737 | 748 | //Takers Count |
| 738 | 749 | $settings[ $name_prefix . 'takers_count' ] = (isset($options[ $name_prefix . 'takers_count' ]) && $options[ $name_prefix . 'takers_count' ] != '') ? absint ( intval( $options[ $name_prefix . 'takers_count' ] ) ) : 1; |
| 739 | 750 | |
| 751 | + // Password survey | |
| 752 | + $options[ $name_prefix . 'enable_password' ] = ! isset( $options[ $name_prefix . 'enable_password' ] ) ? 'off' : $options[ $name_prefix .'enable_password' ]; | |
| 753 | + $settings[ $name_prefix . 'enable_password' ] = (isset( $options[ $name_prefix . 'enable_password' ] ) && $options[ $name_prefix . 'enable_password' ] == 'on') ? true : false; | |
| 754 | + $settings[ $name_prefix . 'password_survey' ] = (isset( $options[ $name_prefix . 'password_survey' ] ) && $options[ $name_prefix . 'password_survey' ] != '') ? $options[ $name_prefix .'password_survey' ] : ''; | |
| 755 | + $settings[ $name_prefix . 'password_type' ] = (isset( $options[ $name_prefix . 'password_type' ] ) && $options[ $name_prefix . 'password_type' ] != '') ? $options[ $name_prefix .'password_type' ] : 'general'; | |
| 756 | + | |
| 757 | + // Message - Password | |
| 758 | + $settings[ $name_prefix . 'password_message' ] = (isset($options[ $name_prefix . 'password_message' ]) && $options[ $name_prefix . 'password_message' ] != '') ? stripslashes( wpautop( $options[ $name_prefix . 'password_message' ] ) ) : ''; | |
| 759 | + | |
| 740 | 760 | // Auto numbering |
| 741 | 761 | $settings[ $name_prefix . 'auto_numbering' ] = (isset($options[ $name_prefix . 'auto_numbering' ]) && $options[ $name_prefix . 'auto_numbering' ] != '') ? stripslashes( $options[ $name_prefix . 'auto_numbering' ] ) : 'none'; |
| 742 | 762 | |
| 743 | 763 | // Loader custom gif |
| @@ -1129,62 +1149,34 @@ | ||
| 1129 | 1149 | return $result; |
| 1130 | 1150 | } |
| 1131 | 1151 | |
| 1132 | 1152 | public static function get_user_ip(){ |
| 1133 | - $ipaddress = ''; | |
| 1134 | - if( !empty($_SERVER) && !empty($_SERVER['REMOTE_ADDR']) ){ | |
| 1135 | - $ipaddress = isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] ? sanitize_text_field($_SERVER['REMOTE_ADDR']) : 'UNKNOWN'; | |
| 1136 | - } else { | |
| 1137 | - if (getenv('REMOTE_ADDR')) | |
| 1138 | - $ipaddress = getenv('REMOTE_ADDR'); | |
| 1139 | - elseif (getenv('HTTP_CLIENT_IP')) | |
| 1140 | - $ipaddress = getenv('HTTP_CLIENT_IP'); | |
| 1141 | - else if (getenv('HTTP_X_FORWARDED_FOR')) | |
| 1142 | - $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); | |
| 1143 | - else if (getenv('HTTP_X_FORWARDED')) | |
| 1144 | - $ipaddress = getenv('HTTP_X_FORWARDED'); | |
| 1145 | - else if (getenv('HTTP_FORWARDED_FOR')) | |
| 1146 | - $ipaddress = getenv('HTTP_FORWARDED_FOR'); | |
| 1147 | - else if (getenv('HTTP_FORWARDED')) | |
| 1148 | - $ipaddress = getenv('HTTP_FORWARDED'); | |
| 1149 | - else | |
| 1150 | - $ipaddress = 'UNKNOWN'; | |
| 1153 | + $ipaddress = false; | |
| 1154 | + | |
| 1155 | + if (getenv('HTTP_CLIENT_IP')) { | |
| 1156 | + $ipaddress = getenv('HTTP_CLIENT_IP'); | |
| 1157 | + } else if (getenv('HTTP_X_FORWARDED_FOR')) { | |
| 1158 | + $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); | |
| 1159 | + } else if (getenv('HTTP_X_FORWARDED')) { | |
| 1160 | + $ipaddress = getenv('HTTP_X_FORWARDED'); | |
| 1161 | + } else if (getenv('HTTP_FORWARDED_FOR')) { | |
| 1162 | + $ipaddress = getenv('HTTP_FORWARDED_FOR'); | |
| 1163 | + } else if (getenv('HTTP_FORWARDED')) { | |
| 1164 | + $ipaddress = getenv('HTTP_FORWARDED'); | |
| 1151 | 1165 | } |
| 1152 | - return $ipaddress; | |
| 1153 | - } | |
| 1154 | 1166 | |
| 1155 | - // OLD | |
| 1156 | - // public static function get_user_ip_validated(){ | |
| 1157 | - // $ipaddress = ''; | |
| 1158 | - // if (getenv('REMOTE_ADDR')){ | |
| 1159 | - // $ipaddress = getenv('REMOTE_ADDR'); | |
| 1160 | - // } | |
| 1161 | - // elseif (getenv('HTTP_CLIENT_IP')){ | |
| 1162 | - // $ipaddress = getenv('HTTP_CLIENT_IP'); | |
| 1163 | - // } | |
| 1164 | - // else if (getenv('HTTP_X_FORWARDED_FOR')){ | |
| 1165 | - // $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); | |
| 1166 | - // } | |
| 1167 | - // else if (getenv('HTTP_X_FORWARDED')){ | |
| 1168 | - // $ipaddress = getenv('HTTP_X_FORWARDED'); | |
| 1169 | - // } | |
| 1170 | - // else if (getenv('HTTP_FORWARDED_FOR')){ | |
| 1171 | - // $ipaddress = getenv('HTTP_FORWARDED_FOR'); | |
| 1172 | - // } | |
| 1173 | - // else if (getenv('HTTP_FORWARDED')){ | |
| 1174 | - // $ipaddress = getenv('HTTP_FORWARDED'); | |
| 1175 | - // } | |
| 1176 | - // else{ | |
| 1177 | - // $ipaddress = 'UNKNOWN'; | |
| 1178 | - // } | |
| 1179 | - // // Validate the IP address | |
| 1180 | - // if (filter_var($ipaddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6) && $ipaddress !== '0.0.0.0') { | |
| 1181 | - // return $ipaddress; | |
| 1182 | - // } | |
| 1183 | - // return 'UNKNOWN'; | |
| 1184 | - | |
| 1185 | - // } | |
| 1167 | + if ( $ipaddress !== false && filter_var( $ipaddress, FILTER_VALIDATE_IP ) !== false ) { | |
| 1168 | + return $ipaddress; | |
| 1169 | + } | |
| 1186 | 1170 | |
| 1171 | + $remote_address = getenv('REMOTE_ADDR'); | |
| 1172 | + if ( $remote_address !== false && filter_var( $remote_address, FILTER_VALIDATE_IP ) !== false ) { | |
| 1173 | + return $remote_address; | |
| 1174 | + } | |
| 1175 | + | |
| 1176 | + return 'UNKNOWN'; | |
| 1177 | + } | |
| 1178 | + | |
| 1187 | 1179 | // FOR REVIEW |
| 1188 | 1180 | public static function get_user_ip_validated(){ |
| 1189 | 1181 | |
| 1190 | 1182 | if( !empty($_SERVER) && !empty($_SERVER['REMOTE_ADDR']) ){ |
| @@ -2454,12 +2446,27 @@ | ||
| 2454 | 2446 | return stripslashes($data); |
| 2455 | 2447 | |
| 2456 | 2448 | } |
| 2457 | 2449 | return wp_kses_post($data); |
| 2450 | + } | |
| 2458 | 2451 | |
| 2459 | - | |
| 2452 | + public static function ays_survey_pb_detect_mobile_device(){ | |
| 2453 | + $useragent = $_SERVER['HTTP_USER_AGENT']; | |
| 2454 | + $flag = false; | |
| 2455 | + if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($useragent,0,4))){ | |
| 2456 | + $flag = true; | |
| 2457 | + } | |
| 2458 | + return $flag; | |
| 2460 | 2459 | } |
| 2461 | 2460 | |
| 2461 | + public static function ays_survey_pb_detect_tablet_device(){ | |
| 2462 | + $flag = false; | |
| 2463 | + if (preg_match('/(tablet|ipad|playbook)|(android(?!.*(mobi|opera mini)))/i', strtolower($_SERVER['HTTP_USER_AGENT']))) { | |
| 2464 | + $flag = true; | |
| 2465 | + } | |
| 2466 | + return $flag; | |
| 2467 | + } | |
| 2468 | + | |
| 2462 | 2469 | public static function get_allowed_tags_for_loader() { |
| 2463 | 2470 | return array( |
| 2464 | 2471 | 'span' => array('class' => array()), |
| 2465 | 2472 | 'img' => array('src' => array(), 'alt' => array()), |
| @@ -2478,15 +2485,20 @@ | ||
| 2478 | 2485 | 'data-*' => true, |
| 2479 | 2486 | 'aria-selected' => true, |
| 2480 | 2487 | ), |
| 2481 | 2488 | 'svg' => array( |
| 2482 | - 'class' => true, | |
| 2483 | - 'width' => true, | |
| 2484 | - 'height' => true, | |
| 2485 | - 'viewBox' => true, | |
| 2486 | - 'viewbox' => true, | |
| 2487 | - 'xmlns' => true, | |
| 2488 | - 'fill' => true, | |
| 2489 | + 'class' => true, | |
| 2490 | + 'style' => true, | |
| 2491 | + 'width' => true, | |
| 2492 | + 'height' => true, | |
| 2493 | + 'viewBox' => true, | |
| 2494 | + 'viewbox' => true, | |
| 2495 | + 'xmlns' => true, | |
| 2496 | + 'fill' => true, | |
| 2497 | + 'stroke' => true, | |
| 2498 | + 'stroke-width' => true, | |
| 2499 | + 'stroke-linecap' => true, | |
| 2500 | + 'stroke-linejoin' => true, | |
| 2489 | 2501 | ), |
| 2490 | 2502 | 'path' => array( |
| 2491 | 2503 | 'class' => true, |
| 2492 | 2504 | 'd' => true, |