Plugin Directory

Changeset 2856139


Ignore:
Timestamp:
01/27/2023 11:11:39 PM (3 years ago)
Author:
notifyevents
Message:

Bugfix (php 8+ support)

Location:
notify-events/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • notify-events/trunk/models/Core.php

    r2482606 r2856139  
    105105    }
    106106
     107    protected static function get_route_param($name, $default)
     108    {
     109        if (!array_key_exists($name, $_GET)) {
     110            return $default;
     111        }
     112
     113        if (!is_string($_GET[$name])) {
     114            return $default;
     115        }
     116
     117        return sanitize_key($_GET[$name]);
     118    }
     119
    107120    /**
    108121     *
     
    110123    public function route()
    111124    {
    112         $module_name     = sanitize_key($_GET['module']);
    113         $controller_name = sanitize_key($_GET['controller']);
    114         $action_name     = sanitize_key($_GET['action']);
    115 
    116         if (empty($module_name)) {
    117             $module_name = 'notify_events';
    118         }
    119 
    120         if (empty($controller_name)) {
    121             $controller_name = 'about';
    122         }
    123 
    124         if (empty($action_name)) {
    125             $action_name = 'index';
    126         }
     125        $module_name     = static::get_route_param('module', 'notify_events');
     126        $controller_name = static::get_route_param('controller', 'about');
     127        $action_name     = static::get_route_param('action', 'index');
    127128
    128129        $controller_name = Inflector::class_from_id($controller_name);
  • notify-events/trunk/models/Event.php

    r2482606 r2856139  
    295295        if (preg_match_all('#\[([a-z0-9-]*)\]#i', $value, $matches) !== false) {
    296296            $tags = static::tag_labels();
    297             $tags = call_user_func_array('array_merge', $tags);
     297            $tags = call_user_func_array('array_merge', array_values($tags));
    298298            $tags = array_keys($tags);
    299299
  • notify-events/trunk/models/Model.php

    r2432603 r2856139  
    193193    protected function rule_required($attribute, $value, $params)
    194194    {
    195         if (($value === null) || (trim((string)$value) === '')) {
     195        if (empty($value) || (is_string($value) && trim($value) === '')) {
    196196            $message = array_key_exists('message', $params) ? $params['message'] : __('Field required', WPNE);
    197197
  • notify-events/trunk/notify-events.php

    r2770094 r2856139  
    66Author: Notify.Events
    77Author URI: https://notify.events/
    8 Version: 1.3.1
     8Version: 1.3.2
    99License: GPL-2.0
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • notify-events/trunk/readme.txt

    r2770094 r2856139  
    44Requires at least: 5.3
    55Requires PHP: 5.6
    6 Tested up to: 6.0
    7 Stable tag: 1.3.1
     6Tested up to: 6.1.1
     7Stable tag: 1.3.2
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.