Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/popup-ma.../classes/Abstract
File: Registry.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Abstract class for Registry
[2] Fix | Delete
*
[3] Fix | Delete
* @package PUM
[4] Fix | Delete
* @copyright Copyright (c) 2023, Code Atlantic LLC
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[8] Fix | Delete
exit;
[9] Fix | Delete
}
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* Defines the construct for building an item registry or collection.
[13] Fix | Delete
*
[14] Fix | Delete
* @since 1.7.0
[15] Fix | Delete
*/
[16] Fix | Delete
abstract class PUM_Abstract_Registry {
[17] Fix | Delete
[18] Fix | Delete
/**
[19] Fix | Delete
* Array of registry items.
[20] Fix | Delete
*
[21] Fix | Delete
* @var array
[22] Fix | Delete
*/
[23] Fix | Delete
protected $items = [];
[24] Fix | Delete
[25] Fix | Delete
/**
[26] Fix | Delete
* Adds an item to the registry.
[27] Fix | Delete
*
[28] Fix | Delete
* @param int $item_id Item ID.
[29] Fix | Delete
* @param array|object|mixed $attributes {
[30] Fix | Delete
* Item attributes.
[31] Fix | Delete
*
[32] Fix | Delete
* @type string $class Item handler class.
[33] Fix | Delete
* @type string $file Item handler class file.
[34] Fix | Delete
* }
[35] Fix | Delete
*
[36] Fix | Delete
* @return true Always true.
[37] Fix | Delete
*/
[38] Fix | Delete
public function add_item( $item_id, $attributes ) {
[39] Fix | Delete
foreach ( $attributes as $attribute => $value ) {
[40] Fix | Delete
$this->items[ $item_id ][ $attribute ] = $value;
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
return true;
[44] Fix | Delete
}
[45] Fix | Delete
[46] Fix | Delete
/**
[47] Fix | Delete
* Removes an item from the registry by ID.
[48] Fix | Delete
*
[49] Fix | Delete
* @param string $item_id Item ID.
[50] Fix | Delete
*/
[51] Fix | Delete
public function remove_item( $item_id ) {
[52] Fix | Delete
unset( $this->items[ $item_id ] );
[53] Fix | Delete
}
[54] Fix | Delete
[55] Fix | Delete
/**
[56] Fix | Delete
* Retrieves an item and its associated attributes.
[57] Fix | Delete
*
[58] Fix | Delete
* @param string $item_id Item ID.
[59] Fix | Delete
*
[60] Fix | Delete
* @return array|false Array of attributes for the item if registered, otherwise false.
[61] Fix | Delete
*/
[62] Fix | Delete
public function get( $item_id ) {
[63] Fix | Delete
if ( array_key_exists( $item_id, $this->items ) ) {
[64] Fix | Delete
return $this->items[ $item_id ];
[65] Fix | Delete
}
[66] Fix | Delete
[67] Fix | Delete
return false;
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
/**
[71] Fix | Delete
* Retrieves registered items.
[72] Fix | Delete
*
[73] Fix | Delete
* @return array The list of registered items.
[74] Fix | Delete
*/
[75] Fix | Delete
public function get_items() {
[76] Fix | Delete
return $this->items;
[77] Fix | Delete
}
[78] Fix | Delete
[79] Fix | Delete
/**
[80] Fix | Delete
* Only intended for use by tests.
[81] Fix | Delete
*/
[82] Fix | Delete
public function _reset_items() {
[83] Fix | Delete
if ( ! defined( 'WP_TESTS_DOMAIN' ) ) {
[84] Fix | Delete
_doing_it_wrong( 'PUM_Abstract_Registry::_reset_items', 'This method is only intended for use in phpunit tests', '1.7.0' );
[85] Fix | Delete
} else {
[86] Fix | Delete
$this->items = [];
[87] Fix | Delete
}
[88] Fix | Delete
}
[89] Fix | Delete
}
[90] Fix | Delete
[91] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function