.
*/
public static function build_preinitialized_hooks( $filters ) {
/** @var WP_Hook[] $normalized */
$normalized = array();
foreach ( $filters as $hook_name => $callback_groups ) {
if ( $callback_groups instanceof WP_Hook ) {
$normalized[ $hook_name ] = $callback_groups;
continue;
}
$hook = new WP_Hook();
// Loop through callback groups.
foreach ( $callback_groups as $priority => $callbacks ) {
// Loop through callbacks.
foreach ( $callbacks as $cb ) {
$hook->add_filter( $hook_name, $cb['function'], $priority, $cb['accepted_args'] );
}
}
$normalized[ $hook_name ] = $hook;
}
return $normalized;
}
/**
* Determines whether an offset value exists.
*
* @since 4.7.0
*
* @link https://www.php.net/manual/en/arrayaccess.offsetexists.php
*
* @param mixed $offset An offset to check for.
* @return bool True if the offset exists, false otherwise.
*/
#[ReturnTypeWillChange]
public function offsetExists( $offset ) {
return isset( $this->callbacks[ $offset ] );
}
/**
* Retrieves a value at a specified offset.
*
* @since 4.7.0
*
* @link https://www.php.net/manual/en/arrayaccess.offsetget.php
*
* @param mixed $offset The offset to retrieve.
* @return mixed If set, the value at the specified offset, null otherwise.
*/
#[ReturnTypeWillChange]
public function offsetGet( $offset ) {
return isset( $this->callbacks[ $offset ] ) ? $this->callbacks[ $offset ] : null;
}
/**
* Sets a value at a specified offset.
*
* @since 4.7.0
*
* @link https://www.php.net/manual/en/arrayaccess.offsetset.php
*
* @param mixed $offset The offset to assign the value to.
* @param mixed $value The value to set.
*/
#[ReturnTypeWillChange]
public function offsetSet( $offset, $value ) {
if ( is_null( $offset ) ) {
$this->callbacks[] = $value;
} else {
$this->callbacks[ $offset ] = $value;
}
$this->priorities = array_keys( $this->callbacks );
}
/**
* Unsets a specified offset.
*
* @since 4.7.0
*
* @link https://www.php.net/manual/en/arrayaccess.offsetunset.php
*
* @param mixed $offset The offset to unset.
*/
#[ReturnTypeWillChange]
public function offsetUnset( $offset ) {
unset( $this->callbacks[ $offset ] );
$this->priorities = array_keys( $this->callbacks );
}
/**
* Returns the current element.
*
* @since 4.7.0
*
* @link https://www.php.net/manual/en/iterator.current.php
*
* @return array Of callbacks at current priority.
*/
#[ReturnTypeWillChange]
public function current() {
return current( $this->callbacks );
}
/**
* Moves forward to the next element.
*
* @since 4.7.0
*
* @link https://www.php.net/manual/en/iterator.next.php
*
* @return array Of callbacks at next priority.
*/
#[ReturnTypeWillChange]
public function next() {
return next( $this->callbacks );
}
/**
* Returns the key of the current element.
*
* @since 4.7.0
*
* @link https://www.php.net/manual/en/iterator.key.php
*
* @return mixed Returns current priority on success, or NULL on failure
*/
#[ReturnTypeWillChange]
public function key() {
return key( $this->callbacks );
}
/**
* Checks if current position is valid.
*
* @since 4.7.0
*
* @link https://www.php.net/manual/en/iterator.valid.php
*
* @return bool Whether the current position is valid.
*/
#[ReturnTypeWillChange]
public function valid() {
return key( $this->callbacks ) !== null;
}
/**
* Rewinds the Iterator to the first element.
*
* @since 4.7.0
*
* @link https://www.php.net/manual/en/iterator.rewind.php
*/
#[ReturnTypeWillChange]
public function rewind() {
reset( $this->callbacks );
}
}
Fatal error: Uncaught Error: Class 'WP_Hook' not found in /home/ocb/public_html/wp-includes/plugin.php:125
Stack trace:
#0 /home/ocb/public_html/wp-includes/class-wpdb.php(2421): add_filter('query', Array, 0)
#1 /home/ocb/public_html/wp-includes/class-wpdb.php(2440): wpdb->placeholder_escape()
#2 /home/ocb/public_html/wp-includes/class-wpdb.php(1289): wpdb->add_placeholder_escape('utf8mb4')
#3 /home/ocb/public_html/wp-includes/class-wpdb.php(1747): wpdb->_real_escape('utf8mb4')
#4 /home/ocb/public_html/wp-includes/class-wpdb.php(926): wpdb->prepare('SET NAMES '%s'', 'utf8mb4')
#5 /home/ocb/public_html/wp-includes/class-wpdb.php(2032): wpdb->set_charset(Object(mysqli))
#6 /home/ocb/public_html/wp-includes/class-wpdb.php(767): wpdb->db_connect()
#7 /home/ocb/public_html/wp-includes/load.php(697): wpdb->__construct('ocb_user526', 'uM4HTg]._QP]', 'ocb_wordpress52...', 'localhost')
#8 /home/ocb/public_html/wp-settings.php(132): require_wp_db()
#9 /home/ocb/public_html/wp-config.php(77): require_once('/home/ocb/publi...')
#10 / in /home/ocb/public_html/wp-includes/plugin.php on line 125