Changeset 3149586
- Timestamp:
- 09/10/2024 07:19:07 PM (17 months ago)
- Location:
- business-listing/trunk
- Files:
-
- 1 added
- 5 deleted
- 6 edited
-
admin.php (modified) (12 diffs)
-
business-listing.css (modified) (2 diffs)
-
business-listing.php (modified) (1 diff)
-
helpers/filter_helper.php (added)
-
helpers/validation_helper.php (modified) (1 diff)
-
images/sort_asc.png (deleted)
-
images/sort_asc_disabled.png (deleted)
-
images/sort_both.png (deleted)
-
images/sort_desc.png (deleted)
-
images/sort_desc_disabled.png (deleted)
-
readme.txt (modified) (3 diffs)
-
shortcodes.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
business-listing/trunk/admin.php
r2831458 r3149586 5 5 * @Author Chris Hood (http://chrishood.me) 6 6 * @Link https://onthegridwebdesign.com 7 * @copyright (c) 2015-202 2, On the Grid Web Design LLC7 * @copyright (c) 2015-2024, On the Grid Web Design LLC 8 8 * @created 4/23/15 9 9 */ … … 21 21 $otgblist_Listings_Model = new otgblist_Listings_Model(); 22 22 include_once(OTGBLIST_ROOT_PATH . 'helpers/view_helper.php'); 23 include_once(OTGBLIST_ROOT_PATH . 'helpers/ validation_helper.php');23 include_once(OTGBLIST_ROOT_PATH . 'helpers/filter_helper.php'); 24 24 25 25 $message_list = array(); … … 29 29 check_admin_referer('list'); 30 30 $action = otgblist_get_request_string('action'); 31 $bulk_action_list = otgblist_get_ bulk_action_list();31 $bulk_action_list = otgblist_get_request_int_array(); 32 32 33 33 if (empty($bulk_action_list)) { … … 93 93 $otgblist_Cats_Model = new otgblist_Cats_Model(); 94 94 include_once(OTGBLIST_ROOT_PATH . 'helpers/view_helper.php'); 95 include_once(OTGBLIST_ROOT_PATH . 'helpers/ validation_helper.php');95 include_once(OTGBLIST_ROOT_PATH . 'helpers/filter_helper.php'); 96 96 97 97 $message_list = array(); … … 154 154 $otgblist_Cats_Model = new otgblist_Cats_Model(); 155 155 include_once(OTGBLIST_ROOT_PATH . 'helpers/view_helper.php'); 156 include_once(OTGBLIST_ROOT_PATH . 'helpers/ validation_helper.php');156 include_once(OTGBLIST_ROOT_PATH . 'helpers/filter_helper.php'); 157 157 158 158 $message_list = array(); … … 162 162 check_admin_referer('regions'); 163 163 $action = otgblist_get_request_string('action'); 164 $bulk_action_list = otgblist_get_ bulk_action_list();164 $bulk_action_list = otgblist_get_request_int_array(); 165 165 if (empty($bulk_action_list)) { 166 166 $message_list[] = ['Nothing to do that to.', 3, 2]; … … 233 233 $otgblist_Cats_Model = new otgblist_Cats_Model(); 234 234 include_once(OTGBLIST_ROOT_PATH . 'helpers/view_helper.php'); 235 include_once(OTGBLIST_ROOT_PATH . 'helpers/ validation_helper.php');235 include_once(OTGBLIST_ROOT_PATH . 'helpers/filter_helper.php'); 236 236 237 237 $message_list = array(); … … 266 266 $otgblist_Cats_Model = new otgblist_Cats_Model(); 267 267 include_once(OTGBLIST_ROOT_PATH . 'helpers/view_helper.php'); 268 include_once(OTGBLIST_ROOT_PATH . 'helpers/ validation_helper.php');268 include_once(OTGBLIST_ROOT_PATH . 'helpers/filter_helper.php'); 269 269 270 270 $message_list = array(); … … 274 274 check_admin_referer('categories'); 275 275 $action = otgblist_get_request_string('action'); 276 $bulk_action_list = otgblist_get_ bulk_action_list();276 $bulk_action_list = otgblist_get_request_int_array(); 277 277 278 278 if (empty($bulk_action_list)) { … … 346 346 $otgblist_Cats_Model = new otgblist_Cats_Model(); 347 347 include_once(OTGBLIST_ROOT_PATH . 'helpers/view_helper.php'); 348 include_once(OTGBLIST_ROOT_PATH . 'helpers/ validation_helper.php');348 include_once(OTGBLIST_ROOT_PATH . 'helpers/filter_helper.php'); 349 349 350 350 $message_list = array(); … … 377 377 // ***** Load Models, Helpers and Libraries ***** 378 378 include_once(OTGBLIST_ROOT_PATH . 'helpers/view_helper.php'); 379 include_once(OTGBLIST_ROOT_PATH . 'helpers/ validation_helper.php');379 include_once(OTGBLIST_ROOT_PATH . 'helpers/filter_helper.php'); 380 380 381 381 $message_list = array(); … … 417 417 wp_enqueue_style('otgcalgs_datatables_css'); 418 418 wp_enqueue_script('otgcalgs_datatables', plugins_url('datatables.min.js', __FILE__)); 419 include_once(OTGBLIST_ROOT_PATH . 'helpers/ validation_helper.php');419 include_once(OTGBLIST_ROOT_PATH . 'helpers/filter_helper.php'); 420 420 421 421 // ***** wp_enqueue_media Long Form to Go Around Bugs ***** -
business-listing/trunk/business-listing.css
r2674650 r3149586 4 4 * @Author Chris Hood (http://chrishood.me) 5 5 * @Link https://onthegridwebdesign.com 6 * @copyright (c) 2015-202 2, On the Grid Web Design LLC6 * @copyright (c) 2015-2024, On the Grid Web Design LLC 7 7 * @created 4/23/15 8 8 */ … … 170 170 .otgblist_table1 th { 171 171 padding: 6px 12px; 172 text-align: center !important; 172 173 } 173 174 .otgblist_table1 th a { -
business-listing/trunk/business-listing.php
r2831421 r3149586 5 5 Description: List businesses in tiles with a photo and link in a random order 6 6 Author: Chris Hood, On The Grid Web Design LLC 7 Version: 2.1.2 7 Copyright: (c) 2015-2024, On the Grid Web Design LLC 8 Version: 2.2 8 9 Author URI: https://chrishood.me 9 Updated: 12/9/2022; Created: 4/23/201510 Updated: 9/10/2024; Created: 4/23/2015 10 11 */ 11 12 -
business-listing/trunk/helpers/validation_helper.php
r2831458 r3149586 1 1 <?php 2 /** FormValidation Helper, OTG WP Plugins Common File2 /** Submitted Data Validation Helper, OTG WP Plugins Common File 3 3 * @Package com.onthegridwebdesign.wpp-business-listings 4 4 * @File helpers/validation_helper.php 5 5 * @Author Chris Hood (https://onthegridwebdesign.com) 6 6 * @Link https://onthegridwebdesign.com/software 7 * @copyright (c) 2018-202 2, On the Grid Web Design LLC8 * @created 2/24/20187 * @copyright (c) 2018-2024, On the Grid Web Design LLC 8 * @created 9/10/2024 9 9 */ 10 10 11 /** Gets and Cleans a Post Value 12 * @param string $field 13 * @param string $default 14 * @param boolean $allow_html 15 * @return string|null 11 /** Cleans and Checks an Email Address 12 * @param string $in 13 * @return array 16 14 */ 17 function otgblist_get_request_string ($field, $default=null, $allow_html=false) { 18 if (empty($_REQUEST[$field])) { 19 return $default; 15 function otgblist_validate_email ($in) { 16 if (empty($in)) 17 return ['email' => '', 'valid' => false, 'message' => 'Email address needs to be submitted.']; 18 19 $valid = true; 20 $message = ''; 21 22 if (!$email_domain = stristr($in, '@')) { 23 $message = 'Email address needs a "@"!'; 24 $valid = false; 25 } elseif (!preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-]).*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/", $in)) { 26 $message = 'Email address is missing something!'; 27 $valid = false; 28 } elseif (!stristr($email_domain, '.')) { 29 $message = 'Email address domain needs to be valid!'; 30 $valid = false; 31 } elseif (!filter_var($in, FILTER_VALIDATE_EMAIL)) { 32 $message = 'Email address needs to be valid!'; 33 $valid = false; 34 } 35 36 return ['valid' => $valid, 'message' => $message]; 37 } 38 39 40 /** Verifies a hCaptcha 41 * @return boolean 42 */ 43 function otgblist_verify_hcaptcha () { 44 $post_data['secret'] = get_option('otgblist_hcaptcha_secret_key'); 45 if (empty($post_data['secret'])) return true; // hcaptcha is disabled 46 $post_data['response'] = otgblist_get_request_string('h-captcha-response'); 47 48 $curl = curl_init('https://hcaptcha.com/siteverify'); 49 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 50 curl_setopt($curl, CURLOPT_POST, 1); 51 curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data); 52 $response = curl_exec($curl); 53 $response_data = json_decode($response, true); 54 55 /* ***** For Debugging ***** 56 $curl_error = curl_error($curl); 57 if (!empty($curl_error)) { 58 error_log('otgblist_verify_hcaptcha Curl Error: ' . print_r($curl_error, true)); 59 } 60 $curl_info = curl_getinfo($curl); 61 error_log('otgblist_verify_hcaptcha Curl Info: ' . print_r($curl_info, true)); 62 error_log('otgblist_verify_hcaptcha Response: ' . $response); 63 error_log('otgblist_verify_hcaptcha Response Array: ' . print_r($response_data, true)); 64 /**/ 65 66 if ('true' == $response_data['success']) { 67 return true; 20 68 } else { 21 if ($allow_html) 22 return trim(filter_var(stripslashes_deep($_REQUEST[$field]), FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_LOW)); 23 else 24 return trim(filter_var(stripslashes_deep($_REQUEST[$field]), FILTER_SANITIZE_SPECIAL_CHARS)); 69 return false; 25 70 } 26 71 } 27 28 /** Checks the Variable and Returns It as an Integer or Null29 * @param string $field30 * @param int $default31 * @return int|null32 */33 function otgblist_get_request_int ($field, $default=null) {34 $value = trim($_REQUEST[$field]);35 if (!is_numeric($value) && !is_int($value)) {36 if (is_int($default) || is_numeric($default))37 $out = $default;38 else39 $out = null;40 } else {41 $out = (int)$value;42 }43 return $out;44 }45 46 /** Gets and Cleans a Email Post Value47 * @param string $field48 * @param string $default49 * @return string|null50 */51 function otgblist_get_request_email ($field, $default=null) {52 if (empty($_REQUEST[$field])) {53 return $default;54 } else {55 return filter_var(trim($_REQUEST[$field]), FILTER_SANITIZE_EMAIL);56 }57 }58 59 /** Gets and Cleans a URL Value60 * @param string $field61 * @param string $default62 * @return string|null63 */64 function otgblist_get_request_link ($field, $default = null) {65 if (empty($_REQUEST[$field])) {66 return $default;67 } else {68 $link = trim(stripslashes_deep($_REQUEST[$field]));69 if (0 != strncasecmp($link, 'http://', 7) && 0 != strncasecmp($link, 'https://', 8))70 $link = 'http://' . $link;71 return filter_var($link, FILTER_SANITIZE_URL);72 }73 }74 75 /** Gets and Cleans a Textarea Post76 * @param string $field77 * @param string $default78 * @return string|null79 */80 function otgblist_get_request_texarea ($field, $default = null) {81 if (empty($_REQUEST[$field])) {82 return $default;83 } else {84 return trim(filter_var(stripslashes_deep($_REQUEST[$field]), FILTER_SANITIZE_SPECIAL_CHARS));85 }86 }87 88 /** Get the Bulk Action List and Only Allows Integers in the List89 * @return array90 */91 function otgblist_get_bulk_action_list () {92 $bulk_action_list = array();93 if (!empty($_POST['bulk_action_list'])) foreach ($_POST['bulk_action_list'] as $id) {94 if (is_int($id) || ctype_digit($id)) {95 $bulk_action_list[] = (int)$id;96 }97 }98 return $bulk_action_list;99 }100 101 /** Get the Bulk Action List and Only Allows Integers in the List102 * @return array103 */104 function otgblist_get_request_int_array ($field = 'bulk_action_list') {105 $bulk_action_list = array();106 if (!empty($_POST[$field])) foreach ($_POST[$field] as $key => $value) {107 if (is_int($value) || ctype_digit($value)) {108 $bulk_action_list[$key] = (int)$value;109 }110 }111 return $bulk_action_list;112 }113 114 /** Get the Bulk Action List and Only Allows Integers in the List115 * @param string $field116 * @return array117 */118 function otgblist_get_request_str_array ($field) {119 $field_array = array();120 if (!empty($_POST[$field])) foreach ($_POST[$field] as $key => $value) {121 $field_array[trim(filter_var(stripslashes_deep($key), FILTER_SANITIZE_SPECIAL_CHARS))] = trim(filter_var(stripslashes_deep($value), FILTER_SANITIZE_SPECIAL_CHARS));122 }123 return $field_array;124 }125 126 /** Replace Quotes with HTML Entity Names127 * @param string $in128 * @return string129 */130 function otgblist_filter_quotes ($in) {131 return trim(str_replace(['"', "'"], ['"', '''], $in));132 } -
business-listing/trunk/readme.txt
r2831422 r3149586 4 4 Tags: business, listings, shortcode, thumbnail, business directory 5 5 Requires at least: 4.0 6 Tested up to: 6. 16 Tested up to: 6.6 7 7 Requires PHP: 5.6 8 Stable tag: 2. 1.28 Stable tag: 2.2.0 9 9 License: GPLv3 10 10 … … 46 46 47 47 == Changelog == 48 2.2.0 (9/10/2024) 49 - Updated validation and filter helper functions, including splitting validation and filter functions into separate helper files. 50 48 51 2.1.2 (12/9/2022) 49 52 - Validation, Filter and View helpers improvements and updates for PHP 8.2. … … 73 76 74 77 == Frequently Asked Questions == 75 76 78 = Can I change the button color? = 77 79 * Right now you have to override the colors by CSS. In a future version it'll be in the options. -
business-listing/trunk/shortcodes.php
r2531520 r3149586 76 76 if (empty($listing['link'])) $listing['link'] = '#'; 77 77 $output .= '<a href="' . $listing['link'] . '" target="_blank" rel="noopener" class="otgblist_box_img_outer">'; 78 $output .= '<img src="' . esc_url($image_url[0]). '" alt="' . esc_attr($image_alt) . '">';78 if (!empty($image_url[0])) $output .= '<img src="' . esc_url($image_url[0]). '" alt="' . esc_attr($image_alt) . '">'; 79 79 $output .= '</a>'; 80 80 }
Note: See TracChangeset
for help on using the changeset viewer.