| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* @package Logtivity |
| 5 |
* @contact logtivity.io, hello@logtivity.io |
| 6 |
* @copyright 2024-2026 Logtivity. All rights reserved |
| 7 |
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL |
| 8 |
* |
| 9 |
* This file is part of Logtivity. |
| 10 |
* |
| 11 |
* Logtivity is free software: you can redistribute it and/or modify |
| 12 |
* it under the terms of the GNU General Public License as published by |
| 13 |
* the Free Software Foundation, either version 2 of the License, or |
| 14 |
* (at your option) any later version. |
| 15 |
* |
| 16 |
* Logtivity is distributed in the hope that it will be useful, |
| 17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 |
* GNU General Public License for more details. |
| 20 |
* |
| 21 |
* You should have received a copy of the GNU General Public License |
| 22 |
* along with Logtivity. If not, see <https://www.gnu.org/licenses/>. |
| 23 |
*/ |
| 24 |
|
| 25 |
if (function_exists('array_is_list') == false) { |
| 26 |
/** |
| 27 |
* php 8.1 function added to WordPress 6.5.0, |
| 28 |
* but we claim compatibility with earlier WordPress |
| 29 |
*/ |
| 30 |
function array_is_list(array $arr) |
| 31 |
{ |
| 32 |
if ($arr === []) { |
| 33 |
return true; |
| 34 |
} |
| 35 |
|
| 36 |
return array_keys($arr) === range(0, count($arr) - 1); |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
if (function_exists('get_user') == false) { |
| 41 |
/** |
| 42 |
* Compatibility with WP 6.6 |
| 43 |
* See v6.7 of wp-includes/user.php |
| 44 |
* |
| 45 |
* @param int $user_id User ID. |
| 46 |
* |
| 47 |
* @return WP_User|false WP_User object on success, false on failure. |
| 48 |
*/ |
| 49 |
function get_user( $user_id ) { |
| 50 |
return get_user_by( 'id', $user_id ); |
| 51 |
} |
| 52 |
} |
| 53 |
|