{"id":88368,"date":"2020-08-06T09:17:00","date_gmt":"2020-08-06T07:17:00","guid":{"rendered":"https:\/\/de.wordpress.org\/support\/?post_type=topic&#038;p=88368"},"modified":"2020-08-06T12:21:33","modified_gmt":"2020-08-06T10:21:33","slug":"wordfence-meldet-unbekannte-datei-class-wp-hook-php__dftwp_backup__-bak","status":"publish","type":"topic","link":"https:\/\/de.wordpress.org\/support\/topic\/wordfence-meldet-unbekannte-datei-class-wp-hook-php__dftwp_backup__-bak\/","title":{"rendered":"Wordfence meldet unbekannte Datei class-wp-hook.php__DFTwp_BACKUP__.bak"},"content":{"rendered":"<p>Hallo,<\/p>\n<p>Wordfence meldet mir soeben, dass die Datei im Verzeichnis &#8222;wp-includes\/class-wp-hook.php&#8220; nicht die Originaldatei ist und die Originaldatei in &#8222;class-wp-hook.php__DFTwp_BACKUP__.bak&#8220; umgeschrieben wurde.<\/p>\n<p>Die neu Datei enth\u00e4lt folgenden Inhalt:<\/p>\n<pre><code>&lt;?php\n\/**\n * Plugin API: WP_Hook class\n *\n * @package WordPress\n * @subpackage Plugin\n * @since 4.7.0\n *\/\n\n\/**\n * Core class used to implement action and filter hook functionality.\n *\n * @since 4.7.0\n *\n * @see Iterator\n * @see ArrayAccess\n *\/\nfinal class WP_Hook implements Iterator, ArrayAccess {\n\n\t\/**\n\t * Hook callbacks.\n\t *\n\t * @since 4.7.0\n\t * @var array\n\t *\/\n\tpublic $callbacks = array();\n\n\t\/**\n\t * The priority keys of actively running iterations of a hook.\n\t *\n\t * @since 4.7.0\n\t * @var array\n\t *\/\n\tprivate $iterations = array();\n\n\t\/**\n\t * The current priority of actively running iterations of a hook.\n\t *\n\t * @since 4.7.0\n\t * @var array\n\t *\/\n\tprivate $current_priority = array();\n\n\t\/**\n\t * Number of levels this hook can be recursively called.\n\t *\n\t * @since 4.7.0\n\t * @var int\n\t *\/\n\tprivate $nesting_level = 0;\n\n\t\/**\n\t * Flag for if we&#039;re current doing an action, rather than a filter.\n\t *\n\t * @since 4.7.0\n\t * @var bool\n\t *\/\n\tprivate $doing_action = false;\n\n\t\/**\n\t * Hooks a function or method to a specific filter action.\n\t *\n\t * @since 4.7.0\n\t *\n\t * @param string   $tag             The name of the filter to hook the $function_to_add callback to.\n\t * @param callable $function_to_add The callback to be run when the filter is applied.\n\t * @param int      $priority        The order in which the functions associated with a particular action\n\t *                                  are executed. Lower numbers correspond with earlier execution,\n\t *                                  and functions with the same priority are executed in the order\n\t *                                  in which they were added to the action.\n\t * @param int      $accepted_args   The number of arguments the function accepts.\n\t *\/\n\tpublic function add_filter( $tag, $function_to_add, $priority, $accepted_args ) {\n\t\t$idx = _wp_filter_build_unique_id( $tag, $function_to_add, $priority );\n\n\t\t$priority_existed = isset( $this-&gt;callbacks[ $priority ] );\n\n\t\t$this-&gt;callbacks[ $priority ][ $idx ] = array(\n\t\t\t&#039;function&#039;      =&gt; $function_to_add,\n\t\t\t&#039;accepted_args&#039; =&gt; $accepted_args,\n\t\t);\n\n\t\t\/\/ If we&#039;re adding a new priority to the list, put them back in sorted order.\n\t\tif ( ! $priority_existed &amp;&amp; count( $this-&gt;callbacks ) &gt; 1 ) {\n\t\t\tksort( $this-&gt;callbacks, SORT_NUMERIC );\n\t\t}\n\n\t\tif ( $this-&gt;nesting_level &gt; 0 ) {\n\t\t\t$this-&gt;resort_active_iterations( $priority, $priority_existed );\n\t\t}\n\t}\n\n\t\/**\n\t * Handles resetting callback priority keys mid-iteration.\n\t *\n\t * @since 4.7.0\n\t *\n\t * @param bool|int $new_priority     Optional. The priority of the new filter being added. Default false,\n\t *                                   for no priority being added.\n\t * @param bool     $priority_existed Optional. Flag for whether the priority already existed before the new\n\t *                                   filter was added. Default false.\n\t *\/\n\tprivate function resort_active_iterations( $new_priority = false, $priority_existed = false ) {\n\t\t$new_priorities = array_keys( $this-&gt;callbacks );\n\n\t\t\/\/ If there are no remaining hooks, clear out all running iterations.\n\t\tif ( ! $new_priorities ) {\n\t\t\tforeach ( $this-&gt;iterations as $index =&gt; $iteration ) {\n\t\t\t\t$this-&gt;iterations[ $index ] = $new_priorities;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t$min = min( $new_priorities );\n\t\tforeach ( $this-&gt;iterations as $index =&gt; &amp;$iteration ) {\n\t\t\t$current = current( $iteration );\n\t\t\t\/\/ If we&#039;re already at the end of this iteration, just leave the array pointer where it is.\n\t\t\tif ( false === $current ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$iteration = $new_priorities;\n\n\t\t\tif ( $current &lt; $min ) {\n\t\t\t\tarray_unshift( $iteration, $current );\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\twhile ( current( $iteration ) &lt; $current ) {\n\t\t\t\tif ( false === next( $iteration ) ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t\/\/ If we have a new priority that didn&#039;t exist, but ::apply_filters() or ::do_action() thinks it&#039;s the current priority...\n\t\t\tif ( $new_priority === $this-&gt;current_priority[ $index ] &amp;&amp; ! $priority_existed ) {\n\t\t\t\t\/*\n\t\t\t\t * ...and the new priority is the same as what $this-&gt;iterations thinks is the previous\n\t\t\t\t * priority, we need to move back to it.\n\t\t\t\t *\/\n\n\t\t\t\tif ( false === current( $iteration ) ) {\n\t\t\t\t\t\/\/ If we&#039;ve already moved off the end of the array, go back to the last element.\n\t\t\t\t\t$prev = end( $iteration );\n\t\t\t\t} else {\n\t\t\t\t\t\/\/ Otherwise, just go back to the previous element.\n\t\t\t\t\t$prev = prev( $iteration );\n\t\t\t\t}\n\t\t\t\tif ( false === $prev ) {\n\t\t\t\t\t\/\/ Start of the array. Reset, and go about our day.\n\t\t\t\t\treset( $iteration );\n\t\t\t\t} elseif ( $new_priority !== $prev ) {\n\t\t\t\t\t\/\/ Previous wasn&#039;t the same. Move forward again.\n\t\t\t\t\tnext( $iteration );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tunset( $iteration );\n\t}\n\n\t\/**\n\t * Unhooks a function or method from a specific filter action.\n\t *\n\t * @since 4.7.0\n\t *\n\t * @param string   $tag                The filter hook to which the function to be removed is hooked.\n\t * @param callable $function_to_remove The callback to be removed from running when the filter is applied.\n\t * @param int      $priority           The exact priority used when adding the original filter callback.\n\t * @return bool Whether the callback existed before it was removed.\n\t *\/\n\tpublic function remove_filter( $tag, $function_to_remove, $priority ) {\n\t\t$function_key = _wp_filter_build_unique_id( $tag, $function_to_remove, $priority );\n\n\t\t$exists = isset( $this-&gt;callbacks[ $priority ][ $function_key ] );\n\t\tif ( $exists ) {\n\t\t\tunset( $this-&gt;callbacks[ $priority ][ $function_key ] );\n\t\t\tif ( ! $this-&gt;callbacks[ $priority ] ) {\n\t\t\t\tunset( $this-&gt;callbacks[ $priority ] );\n\t\t\t\tif ( $this-&gt;nesting_level &gt; 0 ) {\n\t\t\t\t\t$this-&gt;resort_active_iterations();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $exists;\n\t}\n\n\t\/**\n\t * Checks if a specific action has been registered for this hook.\n\t *\n\t * @since 4.7.0\n\t *\n\t * @param string        $tag               Optional. The name of the filter hook. Default empty.\n\t * @param callable|bool $function_to_check Optional. The callback to check for. Default false.\n\t * @return bool|int The priority of that hook is returned, or false if the function is not attached.\n\t *\/\n\tpublic function has_filter( $tag = &#039;&#039;, $function_to_check = false ) {\n\t\tif ( false === $function_to_check ) {\n\t\t\treturn $this-&gt;has_filters();\n\t\t}\n\n\t\t$function_key = _wp_filter_build_unique_id( $tag, $function_to_check, false );\n\t\tif ( ! $function_key ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tforeach ( $this-&gt;callbacks as $priority =&gt; $callbacks ) {\n\t\t\tif ( isset( $callbacks[ $function_key ] ) ) {\n\t\t\t\treturn $priority;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t\/**\n\t * Checks if any callbacks have been registered for this hook.\n\t *\n\t * @since 4.7.0\n\t *\n\t * @return bool True if callbacks have been registered for the current hook, otherwise false.\n\t *\/\n\tpublic function has_filters() {\n\t\tforeach ( $this-&gt;callbacks as $callbacks ) {\n\t\t\tif ( $callbacks ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\t\/**\n\t * Removes all callbacks from the current filter.\n\t *\n\t * @since 4.7.0\n\t *\n\t * @param int|bool $priority Optional. The priority number to remove. Default false.\n\t *\/\n\tpublic function remove_all_filters( $priority = false ) {\n\t\tif ( ! $this-&gt;callbacks ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( false === $priority ) {\n\t\t\t$this-&gt;callbacks = array();\n\t\t} elseif ( isset( $this-&gt;callbacks[ $priority ] ) ) {\n\t\t\tunset( $this-&gt;callbacks[ $priority ] );\n\t\t}\n\n\t\tif ( $this-&gt;nesting_level &gt; 0 ) {\n\t\t\t$this-&gt;resort_active_iterations();\n\t\t}\n\t}\n\n\t\/**\n\t * Calls the callback functions that have been added to a filter hook.\n\t *\n\t * @since 4.7.0\n\t *\n\t * @param mixed $value The value to filter.\n\t * @param array $args  Additional parameters to pass to the callback functions.\n\t *                     This array is expected to include $value at index 0.\n\t * @return mixed The filtered value after all hooked functions are applied to it.\n\t *\/\n\tpublic function apply_filters( $value, $args ) {\n$_debug= array_key_exists(&quot;DFTwp_ENABLE_TIMER&quot;, $GLOBALS) &amp;&amp; $GLOBALS[&quot;DFTwp_ENABLE_TIMER&quot;]; $GLOBALS[&quot;DFTwp_implemented_11&quot;]=1;\n\n\t\tif ( ! $this-&gt;callbacks ) {\n\t\t\treturn $value;\n\t\t}\n\n\t\t\nif($_debug) DFTwp_CALLBACK_ACTION_START( $value, $args, $this );\n$nesting_level = $this-&gt;nesting_level++;\n\n\t\t$this-&gt;iterations[ $nesting_level ] = array_keys( $this-&gt;callbacks );\n\t\t$num_args                           = count( $args );\n\n\t\tdo {\n\t\t\t$this-&gt;current_priority[ $nesting_level ] = current( $this-&gt;iterations[ $nesting_level ] );\n\t\t\t$priority                                 = $this-&gt;current_priority[ $nesting_level ];\n\n\t\t\tforeach ( $this-&gt;callbacks[ $priority ] as $the_ ) {\n\t\t\t\tif ( ! $this-&gt;doing_action ) {\n\t\t\t\t\t$args[0] = $value;\n\t\t\t\t}\n\n\t\t\t\t\nif($_debug) DFTwp_CALLBACK_FUNCTION_START( $the_, func_get_args(), $this );\n\/\/ Avoid the array_slice() if possible.\n\t\t\t\tif ( 0 == $the_[&#039;accepted_args&#039;] ) {\n\t\t\t\t\t$value = call_user_func( $the_[&#039;function&#039;] );\n\t\t\t\t} elseif ( $the_[&#039;accepted_args&#039;] &gt;= $num_args ) {\n\t\t\t\t\t$value = call_user_func_array( $the_[&#039;function&#039;], $args );\n\t\t\t\t} else {\n\t\t\t\t\t$value = call_user_func_array( $the_[&#039;function&#039;], array_slice( $args, 0, (int) $the_[&#039;accepted_args&#039;] ) );\n\t\t\t\t}\nif($_debug) DFTwp_CALLBACK_FUNCTION_END($the_, func_get_args(), $this);\n\n\t\t\t}\n\t\t} while ( false !== next( $this-&gt;iterations[ $nesting_level ] ) );\n\n\t\tunset( $this-&gt;iterations[ $nesting_level ] );\n\t\tunset( $this-&gt;current_priority[ $nesting_level ] );\nif($_debug) DFTwp_CALLBACK_ACTION_END( $value, $args, $this );\n\n\t\t$this-&gt;nesting_level--;\n\n\t\treturn $value;\n\t}\n\n\t\/**\n\t * Calls the callback functions that have been added to an action hook.\n\t *\n\t * @since 4.7.0\n\t *\n\t * @param array $args Parameters to pass to the callback functions.\n\t *\/\n\tpublic function do_action( $args ) {\n\t\t$this-&gt;doing_action = true;\n\t\t$this-&gt;apply_filters( &#039;&#039;, $args );\n\n\t\t\/\/ If there are recursive calls to the current action, we haven&#039;t finished it until we get to the last one.\n\t\tif ( ! $this-&gt;nesting_level ) {\n\t\t\t$this-&gt;doing_action = false;\n\t\t}\n\t}\n\n\t\/**\n\t * Processes the functions hooked into the &#039;all&#039; hook.\n\t *\n\t * @since 4.7.0\n\t *\n\t * @param array $args Arguments to pass to the hook callbacks. Passed by reference.\n\t *\/\n\tpublic function do_all_hook( &amp;$args ) {\n\t\t$nesting_level                      = $this-&gt;nesting_level++;\n\t\t$this-&gt;iterations[ $nesting_level ] = array_keys( $this-&gt;callbacks );\n\n\t\tdo {\n\t\t\t$priority = current( $this-&gt;iterations[ $nesting_level ] );\n\t\t\tforeach ( $this-&gt;callbacks[ $priority ] as $the_ ) {\n\t\t\t\tcall_user_func_array( $the_[&#039;function&#039;], $args );\n\t\t\t}\n\t\t} while ( false !== next( $this-&gt;iterations[ $nesting_level ] ) );\n\n\t\tunset( $this-&gt;iterations[ $nesting_level ] );\n\t\t$this-&gt;nesting_level--;\n\t}\n\n\t\/**\n\t * Return the current priority level of the currently running iteration of the hook.\n\t *\n\t * @since 4.7.0\n\t *\n\t * @return int|false If the hook is running, return the current priority level. If it isn&#039;t running, return false.\n\t *\/\n\tpublic function current_priority() {\n\t\tif ( false === current( $this-&gt;iterations ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn current( current( $this-&gt;iterations ) );\n\t}\n\n\t\/**\n\t * Normalizes filters set up before WordPress has initialized to WP_Hook objects.\n\t *\n\t * @since 4.7.0\n\t *\n\t * @param array $filters Filters to normalize.\n\t * @return WP_Hook[] Array of normalized filters.\n\t *\/\n\tpublic static function build_preinitialized_hooks( $filters ) {\n\t\t\/** @var WP_Hook[] $normalized *\/\n\t\t$normalized = array();\n\n\t\tforeach ( $filters as $tag =&gt; $callback_groups ) {\n\t\t\tif ( is_object( $callback_groups ) &amp;&amp; $callback_groups instanceof WP_Hook ) {\n\t\t\t\t$normalized[ $tag ] = $callback_groups;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$hook = new WP_Hook();\n\n\t\t\t\/\/ Loop through callback groups.\n\t\t\tforeach ( $callback_groups as $priority =&gt; $callbacks ) {\n\n\t\t\t\t\/\/ Loop through callbacks.\n\t\t\t\tforeach ( $callbacks as $cb ) {\n\t\t\t\t\t$hook-&gt;add_filter( $tag, $cb[&#039;function&#039;], $priority, $cb[&#039;accepted_args&#039;] );\n\t\t\t\t}\n\t\t\t}\n\t\t\t$normalized[ $tag ] = $hook;\n\t\t}\n\t\treturn $normalized;\n\t}\n\n\t\/**\n\t * Determines whether an offset value exists.\n\t *\n\t * @since 4.7.0\n\t *\n\t * @link https:\/\/www.php.net\/manual\/en\/arrayaccess.offsetexists.php\n\t *\n\t * @param mixed $offset An offset to check for.\n\t * @return bool True if the offset exists, false otherwise.\n\t *\/\n\tpublic function offsetExists( $offset ) {\n\t\treturn isset( $this-&gt;callbacks[ $offset ] );\n\t}\n\n\t\/**\n\t * Retrieves a value at a specified offset.\n\t *\n\t * @since 4.7.0\n\t *\n\t * @link https:\/\/www.php.net\/manual\/en\/arrayaccess.offsetget.php\n\t *\n\t * @param mixed $offset The offset to retrieve.\n\t * @return mixed If set, the value at the specified offset, null otherwise.\n\t *\/\n\tpublic function offsetGet( $offset ) {\n\t\treturn isset( $this-&gt;callbacks[ $offset ] ) ? $this-&gt;callbacks[ $offset ] : null;\n\t}\n\n\t\/**\n\t * Sets a value at a specified offset.\n\t *\n\t * @since 4.7.0\n\t *\n\t * @link https:\/\/www.php.net\/manual\/en\/arrayaccess.offsetset.php\n\t *\n\t * @param mixed $offset The offset to assign the value to.\n\t * @param mixed $value The value to set.\n\t *\/\n\tpublic function offsetSet( $offset, $value ) {\n\t\tif ( is_null( $offset ) ) {\n\t\t\t$this-&gt;callbacks[] = $value;\n\t\t} else {\n\t\t\t$this-&gt;callbacks[ $offset ] = $value;\n\t\t}\n\t}\n\n\t\/**\n\t * Unsets a specified offset.\n\t *\n\t * @since 4.7.0\n\t *\n\t * @link https:\/\/www.php.net\/manual\/en\/arrayaccess.offsetunset.php\n\t *\n\t * @param mixed $offset The offset to unset.\n\t *\/\n\tpublic function offsetUnset( $offset ) {\n\t\tunset( $this-&gt;callbacks[ $offset ] );\n\t}\n\n\t\/**\n\t * Returns the current element.\n\t *\n\t * @since 4.7.0\n\t *\n\t * @link https:\/\/www.php.net\/manual\/en\/iterator.current.php\n\t *\n\t * @return array Of callbacks at current priority.\n\t *\/\n\tpublic function current() {\n\t\treturn current( $this-&gt;callbacks );\n\t}\n\n\t\/**\n\t * Moves forward to the next element.\n\t *\n\t * @since 4.7.0\n\t *\n\t * @link https:\/\/www.php.net\/manual\/en\/iterator.next.php\n\t *\n\t * @return array Of callbacks at next priority.\n\t *\/\n\tpublic function next() {\n\t\treturn next( $this-&gt;callbacks );\n\t}\n\n\t\/**\n\t * Returns the key of the current element.\n\t *\n\t * @since 4.7.0\n\t *\n\t * @link https:\/\/www.php.net\/manual\/en\/iterator.key.php\n\t *\n\t * @return mixed Returns current priority on success, or NULL on failure\n\t *\/\n\tpublic function key() {\n\t\treturn key( $this-&gt;callbacks );\n\t}\n\n\t\/**\n\t * Checks if current position is valid.\n\t *\n\t * @since 4.7.0\n\t *\n\t * @link https:\/\/www.php.net\/manual\/en\/iterator.valid.php\n\t *\n\t * @return boolean\n\t *\/\n\tpublic function valid() {\n\t\treturn key( $this-&gt;callbacks ) !== null;\n\t}\n\n\t\/**\n\t * Rewinds the Iterator to the first element.\n\t *\n\t * @since 4.7.0\n\t *\n\t * @link https:\/\/www.php.net\/manual\/en\/iterator.rewind.php\n\t *\/\n\tpublic function rewind() {\n\t\treset( $this-&gt;callbacks );\n\t}\n\n}\n<\/code><\/pre>\n<p>Ist erkennbar, was an dieser Datei inhaltlich anders ist?<\/p>\n","protected":false},"template":"","class_list":["post-88368","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/de.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/88368","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/de.wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/de.wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/de.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/88368\/revisions"}],"predecessor-version":[{"id":88373,"href":"https:\/\/de.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/88368\/revisions\/88373"}],"wp:attachment":[{"href":"https:\/\/de.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=88368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}