Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php final class WP_Hook implements Iterator, ArrayAccess { public $callbacks = array();..
Decoded Output download
<?php
final class WP_Hook implements Iterator, ArrayAccess { public $callbacks = array(); protected $priorities = array(); private $iterations = array(); private $current_priority = array(); private $nesting_level = 0; private $doing_action = false; public function add_filter($hook_name, $callback, $priority, $accepted_args) { $idx = _wp_filter_build_unique_id($hook_name, $callback, $priority); $priority_existed = isset($this->callbacks[$priority]); $this->callbacks[$priority][$idx] = array("function" => $callback, "accepted_args" => (int) $accepted_args); if (!$priority_existed && count($this->callbacks) > 1) { ksort($this->callbacks, SORT_NUMERIC); } $this->priorities = array_keys($this->callbacks); if ($this->nesting_level > 0) { $this->resort_active_iterations($priority, $priority_existed); } } private function resort_active_iterations($new_priority = false, $priority_existed = false) { $new_priorities = $this->priorities; if (!$new_priorities) { foreach ($this->iterations as $index => $iteration) { $this->iterations[$index] = $new_priorities; } return; } $min = min($new_priorities); foreach ($this->iterations as $index => &$iteration) { $current = current($iteration); if (false === $current) { continue; } $iteration = $new_priorities; if ($current < $min) { array_unshift($iteration, $current); continue; } while (current($iteration) < $current) { if (false === next($iteration)) { break; } } if ($new_priority === $this->current_priority[$index] && !$priority_existed) { if (false === current($iteration)) { $prev = end($iteration); } else { $prev = prev($iteration); } if (false === $prev) { reset($iteration); } elseif ($new_priority !== $prev) { next($iteration); } } } unset($iteration); } public function remove_filter($hook_name, $callback, $priority) { $function_key = _wp_filter_build_unique_id($hook_name, $callback, $priority); $exists = isset($this->callbacks[$priority][$function_key]); if ($exists) { unset($this->callbacks[$priority][$function_key]); if (!$this->callbacks[$priority]) { unset($this->callbacks[$priority]); $this->priorities = array_keys($this->callbacks); if ($this->nesting_level > 0) { $this->resort_active_iterations(); } } } return $exists; } public function has_filter($hook_name = '', $callback = false) { if (false === $callback) { return $this->has_filters(); } $function_key = _wp_filter_build_unique_id($hook_name, $callback, false); if (!$function_key) { return false; } foreach ($this->callbacks as $priority => $callbacks) { if (isset($callbacks[$function_key])) { return $priority; } } return false; } public function has_filters() { foreach ($this->callbacks as $callbacks) { if ($callbacks) { return true; } } return false; } public function remove_all_filters($priority = false) { if (!$this->callbacks) { return; } if (false === $priority) { $this->callbacks = array(); $this->priorities = array(); } elseif (isset($this->callbacks[$priority])) { unset($this->callbacks[$priority]); $this->priorities = array_keys($this->callbacks); } if ($this->nesting_level > 0) { $this->resort_active_iterations(); } } public function apply_filters($value, $args) { if (!$this->callbacks) { return $value; } $nesting_level = $this->nesting_level++; $this->iterations[$nesting_level] = $this->priorities; $num_args = count($args); do { $this->current_priority[$nesting_level] = current($this->iterations[$nesting_level]); $priority = $this->current_priority[$nesting_level]; foreach ($this->callbacks[$priority] as $the_) { if (!$this->doing_action) { $args[0] = $value; } if (0 === $the_["accepted_args"]) { $value = call_user_func($the_["function"]); } elseif ($the_["accepted_args"] >= $num_args) { $value = call_user_func_array($the_["function"], $args); } else { $value = call_user_func_array($the_["function"], array_slice($args, 0, $the_["accepted_args"])); } } } while (false !== next($this->iterations[$nesting_level])); unset($this->iterations[$nesting_level]); unset($this->current_priority[$nesting_level]); --$this->nesting_level; return $value; } public function do_action($args) { $this->doing_action = true; $this->apply_filters('', $args); if (!$this->nesting_level) { $this->doing_action = false; } } public function do_all_hook(&$args) { $nesting_level = $this->nesting_level++; $this->iterations[$nesting_level] = $this->priorities; do { $priority = current($this->iterations[$nesting_level]); foreach ($this->callbacks[$priority] as $the_) { call_user_func_array($the_["function"], $args); } } while (false !== next($this->iterations[$nesting_level])); unset($this->iterations[$nesting_level]); --$this->nesting_level; } public function current_priority() { if (false === current($this->iterations)) { return false; } return current(current($this->iterations)); } public static function build_preinitialized_hooks($filters) { $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(); foreach ($callback_groups as $priority => $callbacks) { foreach ($callbacks as $cb) { $hook->add_filter($hook_name, $cb["function"], $priority, $cb["accepted_args"]); } } $normalized[$hook_name] = $hook; } return $normalized; } public function offsetExists($offset) { return isset($this->callbacks[$offset]); } public function offsetGet($offset) { return isset($this->callbacks[$offset]) ? $this->callbacks[$offset] : null; } public function offsetSet($offset, $value) { if (is_null($offset)) { $this->callbacks[] = $value; } else { $this->callbacks[$offset] = $value; } $this->priorities = array_keys($this->callbacks); } public function offsetUnset($offset) { unset($this->callbacks[$offset]); $this->priorities = array_keys($this->callbacks); } public function current() { return current($this->callbacks); } public function next() { return next($this->callbacks); } public function key() { return key($this->callbacks); } public function valid() { return key($this->callbacks) !== null; } public function rewind() { reset($this->callbacks); } } ?>
Did this file decode correctly?
Original Code
<?php
final class WP_Hook implements Iterator, ArrayAccess { public $callbacks = array(); protected $priorities = array(); private $iterations = array(); private $current_priority = array(); private $nesting_level = 0; private $doing_action = false; public function add_filter($hook_name, $callback, $priority, $accepted_args) { $idx = _wp_filter_build_unique_id($hook_name, $callback, $priority); $priority_existed = isset($this->callbacks[$priority]); $this->callbacks[$priority][$idx] = array("\x66\165\156\143\164\151\157\x6e" => $callback, "\141\143\143\145\x70\x74\x65\x64\x5f\141\x72\147\x73" => (int) $accepted_args); if (!$priority_existed && count($this->callbacks) > 1) { ksort($this->callbacks, SORT_NUMERIC); } $this->priorities = array_keys($this->callbacks); if ($this->nesting_level > 0) { $this->resort_active_iterations($priority, $priority_existed); } } private function resort_active_iterations($new_priority = false, $priority_existed = false) { $new_priorities = $this->priorities; if (!$new_priorities) { foreach ($this->iterations as $index => $iteration) { $this->iterations[$index] = $new_priorities; } return; } $min = min($new_priorities); foreach ($this->iterations as $index => &$iteration) { $current = current($iteration); if (false === $current) { continue; } $iteration = $new_priorities; if ($current < $min) { array_unshift($iteration, $current); continue; } while (current($iteration) < $current) { if (false === next($iteration)) { break; } } if ($new_priority === $this->current_priority[$index] && !$priority_existed) { if (false === current($iteration)) { $prev = end($iteration); } else { $prev = prev($iteration); } if (false === $prev) { reset($iteration); } elseif ($new_priority !== $prev) { next($iteration); } } } unset($iteration); } public function remove_filter($hook_name, $callback, $priority) { $function_key = _wp_filter_build_unique_id($hook_name, $callback, $priority); $exists = isset($this->callbacks[$priority][$function_key]); if ($exists) { unset($this->callbacks[$priority][$function_key]); if (!$this->callbacks[$priority]) { unset($this->callbacks[$priority]); $this->priorities = array_keys($this->callbacks); if ($this->nesting_level > 0) { $this->resort_active_iterations(); } } } return $exists; } public function has_filter($hook_name = '', $callback = false) { if (false === $callback) { return $this->has_filters(); } $function_key = _wp_filter_build_unique_id($hook_name, $callback, false); if (!$function_key) { return false; } foreach ($this->callbacks as $priority => $callbacks) { if (isset($callbacks[$function_key])) { return $priority; } } return false; } public function has_filters() { foreach ($this->callbacks as $callbacks) { if ($callbacks) { return true; } } return false; } public function remove_all_filters($priority = false) { if (!$this->callbacks) { return; } if (false === $priority) { $this->callbacks = array(); $this->priorities = array(); } elseif (isset($this->callbacks[$priority])) { unset($this->callbacks[$priority]); $this->priorities = array_keys($this->callbacks); } if ($this->nesting_level > 0) { $this->resort_active_iterations(); } } public function apply_filters($value, $args) { if (!$this->callbacks) { return $value; } $nesting_level = $this->nesting_level++; $this->iterations[$nesting_level] = $this->priorities; $num_args = count($args); do { $this->current_priority[$nesting_level] = current($this->iterations[$nesting_level]); $priority = $this->current_priority[$nesting_level]; foreach ($this->callbacks[$priority] as $the_) { if (!$this->doing_action) { $args[0] = $value; } if (0 === $the_["\x61\x63\143\145\160\164\x65\144\137\141\162\147\163"]) { $value = call_user_func($the_["\146\x75\x6e\x63\x74\151\x6f\156"]); } elseif ($the_["\141\x63\x63\145\160\x74\145\x64\x5f\x61\162\x67\163"] >= $num_args) { $value = call_user_func_array($the_["\146\x75\156\143\x74\x69\157\x6e"], $args); } else { $value = call_user_func_array($the_["\146\165\x6e\x63\x74\x69\157\x6e"], array_slice($args, 0, $the_["\141\143\x63\x65\x70\x74\145\x64\137\x61\162\x67\163"])); } } } while (false !== next($this->iterations[$nesting_level])); unset($this->iterations[$nesting_level]); unset($this->current_priority[$nesting_level]); --$this->nesting_level; return $value; } public function do_action($args) { $this->doing_action = true; $this->apply_filters('', $args); if (!$this->nesting_level) { $this->doing_action = false; } } public function do_all_hook(&$args) { $nesting_level = $this->nesting_level++; $this->iterations[$nesting_level] = $this->priorities; do { $priority = current($this->iterations[$nesting_level]); foreach ($this->callbacks[$priority] as $the_) { call_user_func_array($the_["\x66\165\x6e\143\164\x69\x6f\156"], $args); } } while (false !== next($this->iterations[$nesting_level])); unset($this->iterations[$nesting_level]); --$this->nesting_level; } public function current_priority() { if (false === current($this->iterations)) { return false; } return current(current($this->iterations)); } public static function build_preinitialized_hooks($filters) { $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(); foreach ($callback_groups as $priority => $callbacks) { foreach ($callbacks as $cb) { $hook->add_filter($hook_name, $cb["\146\x75\156\x63\164\151\x6f\156"], $priority, $cb["\x61\x63\143\x65\x70\164\145\x64\137\x61\162\x67\163"]); } } $normalized[$hook_name] = $hook; } return $normalized; } public function offsetExists($offset) { return isset($this->callbacks[$offset]); } public function offsetGet($offset) { return isset($this->callbacks[$offset]) ? $this->callbacks[$offset] : null; } public function offsetSet($offset, $value) { if (is_null($offset)) { $this->callbacks[] = $value; } else { $this->callbacks[$offset] = $value; } $this->priorities = array_keys($this->callbacks); } public function offsetUnset($offset) { unset($this->callbacks[$offset]); $this->priorities = array_keys($this->callbacks); } public function current() { return current($this->callbacks); } public function next() { return next($this->callbacks); } public function key() { return key($this->callbacks); } public function valid() { return key($this->callbacks) !== null; } public function rewind() { reset($this->callbacks); } }
Function Calls
None |
Stats
MD5 | f8673296e167c9ee88cfe1f8c9732a54 |
Eval Count | 0 |
Decode Time | 121 ms |