Plugin Directory

Changeset 3245912


Ignore:
Timestamp:
02/24/2025 05:40:41 PM (13 months ago)
Author:
era404
Message:

Fixed deprecation warnings that appeared in PHP8+, found by @thomasprice61 (thank you);

Location:
stafflist/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • stafflist/trunk/readme.txt

    r3245050 r3245912  
    103103
    104104== Changelog ==
     105= 3.2.6 =
     106* Fixed deprecation warnings that appeared in PHP8+, found by @thomasprice61 (thank you);
     107
    105108= 3.2.5 =
    106109* Fixed deprecation warnings that appeared in PHP8+, found by @thomasprice61 (thank you);
  • stafflist/trunk/stafflist.php

    r3245050 r3245912  
    44Plugin URI: http://wordpress.org/plugins/stafflist/
    55Description: A super simplified staff directory tool
    6 Version: 3.2.5
     6Version: 3.2.6
    77Author: era404
    88Author URI: http://www.era404.com
     
    729729                    case "email":
    730730                    //special case for email to use mailto hyperlink
    731                         if(""!=trim($s['email']) && strstr($s['email'],"@")){
    732                             $cleanemail = strip_tags($s['email']);
     731                        $colval = trim($s['email']??"");
     732                        if(""!=$colval && strstr($colval,"@")){
     733                            $cleanemail = strip_tags($colval);
    733734                            $cleantitle = "Email ".esc_html(strip_tags($s['firstname']." ".$s['lastname']));
    734                             $html .= "\t\t\t<td><a href='mailto:{$cleanemail}' title='{$cleantitle}'>{$s['email']}</a></td>\n";
     735                            $html .= "\t\t\t<td><a href='mailto:{$cleanemail}' title='{$cleantitle}'>{$colval}</a></td>\n";
    735736                        } else {
    736                             $html .= "\t\t\t<td>{$s['email']}</td>\n";
     737                            $html .= "\t\t\t<td>{$colval}</td>\n";
    737738                        }
    738739                        break;
     
    743744                    //special case for phone to use tel hyperlink
    744745                        $urlcol = $col['col'];
    745                         if(""!=trim($s[$urlcol]) && ""!=($cleannumber = preg_replace('/[^0-9]/', '', $s[$urlcol]))){
     746                        $colval = trim($s[$urlcol]??"");
     747                        if(""!=$colval && ""!=($cleannumber = preg_replace('/[^0-9]/', '', $colval))){
    746748                            $cleantitle = "Call ".esc_html(strip_tags($s['firstname']." ".$s['lastname']));
    747                             $html .= "\t\t\t<td><a href='tel:{$cleannumber}' title='{$cleantitle}'>{$s[$urlcol]}</a></td>\n";
     749                            $html .= "\t\t\t<td><a href='tel:{$cleannumber}' title='{$cleantitle}'>{$colval}</a></td>\n";
    748750                        } else {
    749                             $html .= "\t\t\t<td>{$s[$urlcol]}</td>\n";
     751                            $html .= "\t\t\t<td>{$colval}</td>\n";
    750752                        }
    751753                        break;
     
    757759                        $hasUrl = true;
    758760                        $urlcol = $col['col'];
    759                         $cleanurl = strip_tags(stripslashes(preg_replace('/\s+/','',trim($s[$urlcol]))));
     761                        $colval = trim($s[$urlcol]??"");
     762                        $cleanurl = strip_tags(stripslashes(preg_replace('/\s+/','',$colval)));
    760763                        $cleanurl = filter_var($cleanurl, FILTER_VALIDATE_URL);
    761764                        $cleanurl = esc_url($cleanurl);
     
    769772                    //all others (including img tags)
    770773                    default:
    771                         if(substr($s[ $col['col'] ],0,4)=="img:"){
    772                             $img = strip_tags(trim(substr($s[ $col['col'] ],4)));
     774                        $colval = trim($s[ $col['col'] ]??"");
     775                        if(substr($colval,0,4)=="img:"){
     776                            $img = strip_tags(trim(substr($colval,4)));
    773777                            if(filter_var($img,FILTER_VALIDATE_URL)){
    774778                                $html .= "\t\t\t<td><img src='{$img}' class='stafflist_image_small' /></td>\n";
     
    777781                            }
    778782                        } else {
    779                             $html .= "\t\t\t<td>{$s[$col['col']]}</td>\n";
     783                            $html .= "\t\t\t<td>{$colval}</td>\n";
    780784                        }
    781785                        break;
Note: See TracChangeset for help on using the changeset viewer.