Plugin Directory

Changeset 2831421


Ignore:
Timestamp:
12/10/2022 03:05:58 AM (3 years ago)
Author:
falcon13
Message:

Ver 2.1.2 Helper updates

Location:
business-listing/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • business-listing/trunk/admin.php

    r2674650 r2831421  
    115115
    116116        if (!empty($listing['name'])) {
    117             // *** Add http:// to link if missing ***
    118             if (!empty($listing['link']) && (0 != strncasecmp($listing['link'], 'http://', 7) &&  0 != strncasecmp($listing['link'], "https://", 8))) {
    119                 $listing['link'] = 'http://' . $listing['link'];
    120             }
    121117            if (empty($listing['listing_id'])) {
    122118                $listing['listing_id'] = $otgblist_Listings_Model->create_listing($listing['name'], $listing['city'], $listing['state'], $listing['region_id'],
  • business-listing/trunk/business-listing.php

    r2829728 r2831421  
    55  Description: List businesses in tiles with a photo and link in a random order
    66  Author: Chris Hood, On The Grid Web Design LLC
    7   Version: 2.1.1
     7  Version: 2.1.2
    88  Author URI: https://chrishood.me
    9   Updated: 12/6/2022; Created: 4/23/2015
     9  Updated: 12/9/2022; Created: 4/23/2015
    1010 */
    1111
  • business-listing/trunk/helpers/validation_helper.php

    r2674650 r2831421  
    1212 * @param string $field
    1313 * @param string $default
    14  * @param string $key
     14 * @param boolean $allow_html
    1515 * @return string|null
    1616 */
    17 function otgblist_get_request_string ($field, $default=null) {
     17function otgblist_get_request_string ($field, $default=null, $allow_html=false) {
    1818    if (empty($_REQUEST[$field])) {
    1919        return $default;
    2020    } else {
    21         return sanitize_text_field(wp_unslash(trim($_REQUEST[$field])));
     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));
    2225    }
    2326}
     
    6265        return $default;
    6366    } else {
    64         $link = trim($_REQUEST[$field]);
    65         if (0 != strncasecmp($link, "http://", 7) && 0 != strncasecmp($link, "https://", 8))
     67        $link = trim(stripslashes_deep($_REQUEST[$field]));
     68        if (0 != strncasecmp($link, 'http://', 7) && 0 != strncasecmp($link, 'https://', 8))
    6669            $link = 'http://' . $link;
    6770        return filter_var($link, FILTER_SANITIZE_URL);
     
    7881        return $default;
    7982    } else {
    80         return trim(filter_var(wp_unslash($_REQUEST[$field]), FILTER_SANITIZE_STRING));
     83        return trim(filter_var(stripslashes_deep($_REQUEST[$field]), FILTER_SANITIZE_SPECIAL_CHARS));
    8184    }
    8285}
     
    8790function otgblist_get_bulk_action_list () {
    8891    $bulk_action_list = array();
    89     if (!empty($_POST['bulk_action_list'])) foreach ($_POST['bulk_action_list'] as $record_id) {
    90         if (is_int($record_id) || ctype_digit($record_id)) {
    91             $bulk_action_list[] = (int)$record_id;
     92    if (!empty($_POST['bulk_action_list'])) foreach ($_POST['bulk_action_list'] as $id) {
     93        if (is_int($id) || ctype_digit($id)) {
     94            $bulk_action_list[] = (int)$id;
    9295        }
    9396    }
     
    109112
    110113/** Get the Bulk Action List and Only Allows Integers in the List
    111  * @param string $name
     114 * @param string $field
    112115 * @return array
    113116 */
     
    115118    $field_array = array();
    116119    if (!empty($_POST[$field])) foreach ($_POST[$field] as $key => $value) {
    117         $field_array[sanitize_text_field(wp_unslash(trim($key)))] = sanitize_text_field(wp_unslash(trim($value)));
     120        $field_array[trim(filter_var(stripslashes_deep($key), FILTER_SANITIZE_SPECIAL_CHARS))] = trim(filter_var(stripslashes_deep($value), FILTER_SANITIZE_SPECIAL_CHARS));
    118121    }
    119122    return $field_array;
    120123}
     124
     125/** Replace Quotes with HTML Entity Names
     126 * @param string $in
     127 * @return string
     128 */
     129function otgblist_filter_quotes ($in) {
     130    return trim(str_replace(['"', "'"], ['"', '''], $in));
     131}
  • business-listing/trunk/helpers/view_helper.php

    r2829728 r2831421  
    1919    $selected_text = ' selected="selected"';
    2020    echo "<select name='$name'>";
    21     echo "<option value='1'";
     21    echo '<option value="1"';
    2222    if (1 == $default) echo $selected_text;
    23     echo ">On</option>\n";
    24     echo "<option value='0'";
     23    echo ">On</option>";
     24    echo '<option value="0"';
    2525    if (0 == $default) echo $selected_text;
    26     echo ">Off</option>\n";
     26    echo ">Off</option>";
    2727    echo "</select>";
    2828}
     
    3535    $selected_text = ' selected="selected"';
    3636    echo "<select name='$name'>";
    37     echo "<option value='1'";
     37    echo '<option value="1"';
    3838    if (1 == $default) echo $selected_text;
    39     echo ">Yes</option>\n";
    40     echo "<option value='0'";
     39    echo ">Yes</option>";
     40    echo '<option value="0"';
    4141    if (0 == $default) echo $selected_text;
    42     echo ">No</option>\n";
    43     echo "</select>";
     42    echo '>No</option>';
     43    echo '</select>';
    4444}
    4545
     
    9090    // ***** End if Empty *****
    9191    if (empty($message_list)) return false;
    92    
     92
    9393    // ***** Order by Third Field *****
    9494    usort($message_list, function($a, $b) {
    9595         return $a[2] - $b[2];
    96     }); 
     96    });
    9797    foreach ($message_list as $message) {
    9898        // ***** Set Class Second Field *****
     
    111111        }
    112112        // ***** Print It *****
    113         echo "<p class='$class'>" . htmlentities($message[0]) . '</p>';
     113        echo "<p class='$class'>" . $message[0] . '</p>';
    114114    }
    115115}
  • business-listing/trunk/readme.txt

    r2829728 r2831421  
    66Tested up to: 6.1
    77Requires PHP: 5.6
    8 Stable tag: 2.1.0
     8Stable tag: 2.1.2
    99License: GPLv3
    1010
     
    4646
    4747== Changelog ==
     482.1.2 (12/69/2022)
     49- Validation, Filter and View helpers improvements and updates for PHP 8.2.
     50
    48512.1.1 (12/6/2022)
    4952- Updated Datatables Javascript library
    5053- Tweaks and code improvements.
    51 2.1
     54
     552.1 (2/7/2022)
    5256- Switched lists to use Datatables Javascript library
    5357- Added ability to rename categories and region from list
    5458
    55 2.0
     592.0 (5/11/2021)
    5660- First openly released version
    5761- Brought the plugin up to current standards
     
    6468- Improved responsiveness
    6569
    66 1.0
     701.0 (5/5/2015)
    6771- Plugin created in April 2015 as custom plugin for specific site.
    6872- Originally called Store Listings
Note: See TracChangeset for help on using the changeset viewer.