public function apply_filters($tag, $value)
    {
        $args = array();

        // Do 'all' actions first.
        if (isset($this->filter[ 'all' ])) {
            $this->current_filter[] = $tag;
            $args = func_get_args();
            self::_call_all_hook($args);
        }

        if ( ! isset($this->filter[ $tag ])) {
            if (isset($this->filter[ 'all' ])) {
                array_pop($this->current_filter);
            }

            return $value;
        }

        if ( ! isset($this->filter[ 'all' ])) {
            $this->current_filter[] = $tag;
        }

        // Sort.
        if ( ! isset($this->merged_filters[ $tag ])) {
            ksort($this->filter[ $tag ]);
            $this->merged_filters[ $tag ] = true;
        }

        reset($this->filter[ $tag ]);

        if (empty($args)) {
            $args = func_get_args();
        }
        do {
            foreach ((array)current($this->filter[ $tag ]) as $the_) {
                if ( ! is_null($the_[ 'function' ])) {
                    $args[ 1 ] = $value;
                    $value = call_user_func_array($the_[ 'function' ],
                        array_slice($args, 1, (int)$the_[ 'accepted_args' ]));
                }
            }
        } while (next($this->filter[ $tag ]) !== false);

        array_pop($this->current_filter);

        return $value;
    }