public function do_action_ref_array($tag, $args)
    {
        if ( ! isset($this->actions[ $tag ])) {
            $this->actions[ $tag ] = 1;
        } else {
            ++$this->actions[ $tag ];
        }

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

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

            return;
        }

        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 ]);

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

        array_pop($this->current_filter);
    }