call_user_func example

$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;
                }

                // Avoid the array_slice() if possible.                 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, (int) $the_['accepted_args'] ) );
                }
            }
        } while ( false !== next( $this->iterations[ $nesting_level ] ) );

        unset( $this->iterations[ $nesting_level ] );
        unset( $this->current_priority[ $nesting_level ] );

        

    public function getListener()
    {
        return $this->listener;
    }

    /** * Executes the listener with the given Enlight_Event_EventArgs. */
    public function execute(Enlight_Event_EventArgs $args)
    {
        return \call_user_func($this->listener, $args);
    }

    /** * Returns the handler properties as array. * * @return array */
    public function toArray()
    {
        return [
            'name' => $this->name,
            
 else {
            // It's a function - does it exist?             if (is_array($method)) {
                if (!is_callable(array($method[0]$method[1]))) {
                    return new IXR_Error(-32601, 'server error. requested object method "'.$method[1].'" does not exist.');
                }
            } else if (!function_exists($method)) {
                return new IXR_Error(-32601, 'server error. requested function "'.$method.'" does not exist.');
            }

            // Call the function             $result = call_user_func($method$args);
        }
        return $result;
    }

    function error($error$message = false)
    {
        // Accepts either an error object or an error code and message         if ($message && !is_object($error)) {
            $error = new IXR_Error($error$message);
        }

        
if (substr($msg, -1) != "\n") {
                    $msg .= "\n";
                }
            } else {
                $format = $options;
            }
            printf($format$msg);
            exit($code);
        }

        if ($this->mode & PEAR_ERROR_CALLBACK && is_callable($this->callback)) {
            call_user_func($this->callback, $this);
        }

        if ($this->mode & PEAR_ERROR_EXCEPTION) {
            trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception for exceptions", E_USER_WARNING);
            eval('$e = new Exception($this->message, $this->code);throw($e);');
        }
    }

    /** * Only here for backwards compatibility. * * Class "Cache_Error" still uses it, among others. * * @param string $message Message * @param int $code Error code * @param int $mode Error mode * @param mixed $options See __construct() * @param string $userinfo Additional user/debug info */

  public function __construct(DiscoveryInterface $decorated$registerDefinitions = NULL) {
    $this->decorated = $decorated;
    $this->registerDefinitions = $registerDefinitions;
  }

  /** * {@inheritdoc} */
  public function getDefinition($base_plugin_id$exception_on_invalid = TRUE) {
    if (isset($this->registerDefinitions)) {
      call_user_func($this->registerDefinitions);
    }
    $this->definitions += $this->decorated->getDefinitions();
    return parent::getDefinition($base_plugin_id$exception_on_invalid);
  }

  /** * {@inheritdoc} */
  public function getDefinitions() {
    if (isset($this->registerDefinitions)) {
      call_user_func($this->registerDefinitions);
    }
if (!$key) {
            return $this->metadata;
        }

        return $this->metadata[$key] ?? null;
    }

    private function pump(int $length): void
    {
        if ($this->source) {
            do {
                $data = call_user_func($this->source, $length);
                if ($data === false || $data === null) {
                    $this->source = null;

                    return;
                }
                $this->buffer->write($data);
                $length -= strlen($data);
            } while ($length > 0);
        }
    }
}

    final public function render( $container_context = array() ) {
        $partial  = $this;
        $rendered = false;

        if ( ! empty( $this->render_callback ) ) {
            ob_start();
            $return_render = call_user_func( $this->render_callback, $this$container_context );
            $ob_render     = ob_get_clean();

            if ( null !== $return_render && '' !== $ob_render ) {
                _doing_it_wrong( __FUNCTION__, __( 'Partial render must echo the content or return the content string (or array), but not both.' ), '4.5.0' );
            }

            /* * Note that the string return takes precedence because the $ob_render may just\ * include PHP warnings or notices. */
            $rendered = null !== $return_render ? $return_render : $ob_render;
        }

        $request_order = apply_filters( 'http_api_transports', $transports$args$url );

        // Loop over each transport on each HTTP request looking for one which will serve this request's needs.         foreach ( $request_order as $transport ) {
            if ( in_array( $transport$transports, true ) ) {
                $transport = ucfirst( $transport );
            }
            $class = 'WP_Http_' . $transport;

            // Check to see if this transport is a possibility, calls the transport statically.             if ( ! call_user_func( array( $class, 'test' )$args$url ) ) {
                continue;
            }

            return $class;
        }

        return false;
    }

    /** * Dispatches a HTTP request to a supporting transport. * * Tests each transport in order to find a transport which matches the request arguments. * Also caches the transport instance to be used later. * * The order for requests is cURL, and then PHP Streams. * * @since 3.2.0 * @deprecated 5.1.0 Use WP_Http::request() * @see WP_Http::request() * * @param string $url URL to request. * @param array $args Request arguments. * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. * A WP_Error instance upon error. */
$routes = $server->get_routes();

    $allowed_methods = array();

    // Get the allowed methods across the routes.     foreach ( $routes[ $matched_route ] as $_handler ) {
        foreach ( $_handler['methods'] as $handler_method => $value ) {

            if ( ! empty( $_handler['permission_callback'] ) ) {

                $permission = call_user_func( $_handler['permission_callback']$request );

                $allowed_methods[ $handler_method ] = true === $permission;
            } else {
                $allowed_methods[ $handler_method ] = true;
            }
        }
    }

    // Strip out all the methods that are not allowed (false values).     $allowed_methods = array_filter( $allowed_methods );

    
return $output.'</dd>';
    }

    public function preRender(): string
    {
        $output = '';

        if ($this->shouldPreRender()) {
            foreach (self::$pre_render_sources as $type => $values) {
                $contents = '';
                foreach ($values as $v) {
                    $contents .= \call_user_func($v$this);
                }

                if (!\strlen($contents)) {
                    continue;
                }

                switch ($type) {
                    case 'script':
                        $output .= '<script class="kint-rich-script"';
                        if (null !== self::$js_nonce) {
                            $output .= ' nonce="'.\htmlspecialchars(self::$js_nonce).'"';
                        }

            foreach ($this->curl_options as $k => $v)
            {
                $options[$k] = $v;
            }
        }
        if (!empty($options))
        {
            ksort($options);
            $url .= '#' . urlencode(var_export($options, true));
        }
        return call_user_func($this->cache_name_function, $url);
    }

    /** * Set whether feed items should be sorted into reverse chronological order * * @param bool $enable Sort as reverse chronological order. */
    public function enable_order_by_date($enable = true)
    {
        $this->order_by_date = (bool) $enable;
    }

    

            $data = 'data-colname="' . esc_attr( wp_strip_all_tags( $column_display_name ) ) . '"';

            $attributes = "class='$classes' $data";

            if ( 'cb' === $column_name ) {
                echo '<th scope="row" class="check-column">';
                echo $this->column_cb( $item );
                echo '</th>';
            } elseif ( method_exists( $this, '_column_' . $column_name ) ) {
                echo call_user_func(
                    array( $this, '_column_' . $column_name ),
                    $item,
                    $classes,
                    $data,
                    $primary
                );
            } elseif ( method_exists( $this, 'column_' . $column_name ) ) {
                echo "<td $attributes>";
                echo call_user_func( array( $this, 'column_' . $column_name )$item );
                echo $this->handle_row_actions( $item$column_name$primary );
                echo '</td>';
            }
$options['precision'] = 0;
            }
        }

        // get fraction and format lengths         if (strpos($value, '.') !== false) {
            $number = substr((string) $value, 0, strpos($value, '.'));
        } else {
            $number = $value;
        }

        $prec = call_user_func(Zend_Locale_Math::$sub$value$number$options['precision']);
        $prec = Zend_Locale_Math::floatalize($prec);
        $prec = Zend_Locale_Math::normalize($prec);
        if (iconv_strpos($prec, '-') !== false) {
            $prec = iconv_substr($prec, 1);
        }

        if (($prec == 0) and ($options['precision'] > 0)) {
            $prec = "0.0";
        }

        if (($options['precision'] + 2) > iconv_strlen($prec)) {
            


    /** * @return bool */
    public function shouldHalt()
    {
        if (!$this->haltCallback) {
            return false;
        }

        return (bool) \call_user_func($this->haltCallback);
    }

    /** * @param string $sourceUri * @param string $destinationUri * @param int $totalSize * @param string $hash * * @throws Exception * * @return int */
'is_singular'          => 'get_singular_template',
        'is_category'          => 'get_category_template',
        'is_tag'               => 'get_tag_template',
        'is_author'            => 'get_author_template',
        'is_date'              => 'get_date_template',
        'is_archive'           => 'get_archive_template',
    );
    $template      = false;

    // Loop through each of the template conditionals, and find the appropriate template file.     foreach ( $tag_templates as $tag => $template_getter ) {
        if ( call_user_func( $tag ) ) {
            $template = call_user_func( $template_getter );
        }

        if ( $template ) {
            if ( 'is_attachment' === $tag ) {
                remove_filter( 'the_content', 'prepend_attachment' );
            }

            break;
        }
    }

    
Home | Imprint | This part of the site doesn't use cookies.