PluginProbe
Survey Maker by AYS / 5.2.4.1
Survey Maker by AYS v5.2.4.1
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
← All changes | includes/class-survey-maker-data.php +152 -65 5.2.0.8 → 5.2.4.1 View file →
@@ -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']) ){
@@ -2129,8 +2121,9 @@
2129 2121
2130 2122 $current_user_data = get_userdata( $user_id );
2131 2123 $user_display_name = "";
2132 2124 $user_wordpress_roles = '';
2125 + $user_website_url = '';
2133 2126 $user_email = '';
2134 2127
2135 2128 if ( ! is_null( $current_user_data ) && $current_user_data ) {
2136 2129 $user_display_name = ( isset( $current_user_data->data->display_name ) && $current_user_data->data->display_name != '' ) ? sanitize_text_field( $current_user_data->data->display_name ) : "";
@@ -2140,14 +2133,16 @@
2140 2133 if ( is_array( $user_wordpress_roles ) ) {
2141 2134 $user_wordpress_roles = implode(",", $user_wordpress_roles);
2142 2135 }
2143 2136 }
2137 + $user_website_url = ( isset( $current_user_data->user_url ) && ! empty( $current_user_data->user_url ) ) ? $current_user_data->user_url : "";
2144 2138 }
2145 2139
2146 - $message_data['user_display_name'] = $user_display_name;
2147 - $message_data['user_wordpress_roles'] = $user_wordpress_roles;
2148 - $message_data['user_wordpress_email'] = $user_email;
2149 - $message_data['user_ip_address'] = self::get_user_ip();
2140 + $message_data['user_display_name'] = $user_display_name;
2141 + $message_data['user_wordpress_roles'] = $user_wordpress_roles;
2142 + $message_data['user_website_url'] = $user_website_url;
2143 + $message_data['user_wordpress_email'] = $user_email;
2144 + $message_data['user_ip_address'] = self::get_user_ip();
2150 2145
2151 2146 return $message_data;
2152 2147 }
2153 2148
@@ -2451,12 +2446,27 @@
2451 2446 return stripslashes($data);
2452 2447
2453 2448 }
2454 2449 return wp_kses_post($data);
2450 + }
2455 2451
2456 -
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;
2457 2459 }
2458 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 +
2459 2469 public static function get_allowed_tags_for_loader() {
2460 2470 return array(
2461 2471 'span' => array('class' => array()),
2462 2472 'img' => array('src' => array(), 'alt' => array()),
@@ -2475,15 +2485,20 @@
2475 2485 'data-*' => true,
2476 2486 'aria-selected' => true,
2477 2487 ),
2478 2488 'svg' => array(
2479 - 'class' => true,
2480 - 'width' => true,
2481 - 'height' => true,
2482 - 'viewBox' => true,
2483 - 'viewbox' => true,
2484 - 'xmlns' => true,
2485 - '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,
2486 2501 ),
2487 2502 'path' => array(
2488 2503 'class' => true,
2489 2504 'd' => true,
@@ -2576,10 +2591,8 @@
2576 2591 'required' => true,
2577 2592 'readonly' => true,
2578 2593 'data-*' => true,
2579 2594 'style' => true,
2580 - 'onClick' => true,
2581 - 'onclick' => true,
2582 2595 ),
2583 2596 'select' => array(
2584 2597 'id' => true,
2585 2598 'name' => true,
@@ -2626,8 +2639,82 @@
2626 2639 'aria-selected' => true,
2627 2640 'data-*' => true,
2628 2641 'style' => true,
2629 2642 'target' => true,
2643 + ),
2644 + ),
2645 + $additionalAllowedTags
2646 + );
2647 + }
2648 +
2649 + public static function ays_survey_custom_allowed_html() {
2650 + $additionalAllowedTags = self::ays_survey_allowed_html();
2651 + return array_merge(
2652 + $additionalAllowedTags,
2653 + array(
2654 + 'iframe' => array(
2655 + 'class' => true,
2656 + 'id' => true,
2657 + 'width' => true,
2658 + 'height' => true,
2659 + 'src' => true,
2660 + 'title' => true,
2661 + 'frameborder' => true,
2662 + 'allow' => true,
2663 + 'allowfullscreen' => true,
2664 + 'loading' => true,
2665 + 'referrerpolicy' => true,
2666 + 'style' => true,
2667 + ),
2668 + 'audio' => array(
2669 + 'class' => true,
2670 + 'id' => true,
2671 + 'controls' => true,
2672 + 'autoplay' => true,
2673 + 'loop' => true,
2674 + 'muted' => true,
2675 + 'preload' => true,
2676 + 'src' => true,
2677 + 'style' => true,
2678 + ),
2679 + 'source' => array(
2680 + 'src' => true,
2681 + 'type' => true,
2682 + ),
2683 + 'track' => array(
2684 + 'kind' => true,
2685 + 'src' => true,
2686 + 'srclang' => true,
2687 + 'label' => true,
2688 + 'default' => true,
2689 + ),
2690 + 'video' => array(
2691 + 'class' => true,
2692 + 'id' => true,
2693 + 'width' => true,
2694 + 'height' => true,
2695 + 'controls' => true,
2696 + 'autoplay' => true,
2697 + 'loop' => true,
2698 + 'muted' => true,
2699 + 'poster' => true,
2700 + 'preload' => true,
2701 + 'src' => true,
2702 + 'style' => true,
2703 + ),
2704 + 'picture' => array(
2705 + 'class' => true,
2706 + 'id' => true,
2707 + ),
2708 + 'figure' => array(
2709 + 'class' => true,
2710 + 'id' => true,
2711 + 'style' => true,
2712 + ),
2713 + 'figcaption' => array(
2714 + 'class' => true,
2715 + 'id' => true,
2716 + 'style' => true,
2630 2717 ),
2631 2718 ),
2632 2719 $additionalAllowedTags
2633 2720 );