| @@ -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,61 +1149,33 @@ | ||
| 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 | + } | |
| 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 | + } | |
| 1186 | 1178 | |
| 1187 | 1179 | // FOR REVIEW |
| 1188 | 1180 | public static function get_user_ip_validated(){ |
| 1189 | 1181 | |