src/Library/Reporter/Reporter.php
public function renderMulti($content, $tag_type = 'default', array $multi = array(), $args = null, $placeholder_mask = '@%s@')
    {
        if (is_null($args)) $args = array();
        if (!is_array($args)) $args = array( $args );

        // rendering all placeholders
        $placeholders_table = array();
        foreach($multi as $item=>$item_args) {
            $placeholders_table[$item] = call_user_func_array(
                array($this->getAdapter(), 'renderTag'),
                $item_args
            );
        }

        // replacing placeholders
        $full_content = $content;
        foreach ($placeholders_table as $name => $value) {
            $full_content = strtr($full_content, array(sprintf($placeholder_mask, $name) => $value));
        }

        // rendering final output
        $output = $this->getAdapter()->renderTag($full_content, $tag_type, $args);

        $this->setOutput($output);
        if ($this->getFlag() & self::OUTPUT_APPEND) {
            return $this;
        } elseif ($this->getFlag() & self::OUTPUT_BY_LINE) {
            return $output;
        }
    }
public function renderMulti($content, $tag_type = 'default', array $multi = array(), $args = null, $placeholder_mask = '@%s@')
    {
        if (is_null($args)) $args = array();
        if (!is_array($args)) $args = array( $args );

        // rendering all placeholders
        $placeholders_table = array();
        foreach($multi as $item=>$item_args) {
            $placeholders_table[$item] = call_user_func_array(
                array($this->getAdapter(), 'renderTag'),
                $item_args
            );
        }

        // replacing placeholders
        $full_content = $content;
        foreach ($placeholders_table as $name => $value) {
            $full_content = strtr($full_content, array(sprintf($placeholder_mask, $name) => $value));
        }

        // rendering final output
        $output = $this->getAdapter()->renderTag($full_content, $tag_type, $args);

        $this->setOutput($output);
        if ($this->getFlag() & self::OUTPUT_APPEND) {
            return $this;
        } elseif ($this->getFlag() & self::OUTPUT_BY_LINE) {
            return $output;
        }
    }
public function renderMulti ( $ content , $ tag_type = 'default' , array $ multi = array ( ) , $ args = null , $ placeholder_mask = '@%s@' ) { if ( is_null ( $ args ) ) $ args = array ( ) ; if ( ! is_array ( $ args ) ) $ args = array ( $ args ) ; // rendering all placeholders $ placeholders_table = array ( ) ; foreach ( $ multi as $ item => $ item_args ) { $ placeholders_table [ $ item ] = call_user_func_array ( array ( $ this -> getAdapter ( ) , 'renderTag' ) , $ item_args ) ; } // replacing placeholders $ full_content = $ content ; foreach ( $ placeholders_table as $ name => $ value ) { $ full_content = strtr ( $ full_content , array ( sprintf ( $ placeholder_mask , $ name ) => $ value ) ) ; } // rendering final output $ output = $ this -> getAdapter ( ) -> renderTag ( $ full_content , $ tag_type , $ args ) ; $ this -> setOutput ( $ output ) ; if ( $ this -> getFlag ( ) & self :: OUTPUT_APPEND ) { return $ this ; } elseif ( $ this -> getFlag ( ) & self :: OUTPUT_BY_LINE ) { return $ output ; } }
Render a content with a specific tag mask and some placeholders

This is quite the same as the `render()` method but in this case, the `$content` string
may contains some placeholders like `@name@` that will be replaced in the result by
the `name` item of the `$multi` array argument after rendering it by the `render()` method.

For instance:

$str = $obj->renderMulti( 'my string with @name@ placeholder', 'default', array(
'name' => array( 'a specific string as' , 'strong' )
));

will return:

"<p>my string with <strong>a specific string as</strong> placeholder</p>"

@param string $content The content string to use
@param string $tag_type The type of tag mask to use
@param array $multi The array of imbricated elements for content replacements
@param string|array $args An array of arguments to pass to the mask (or a single string that
will be taken as the first array item)
@param string $placeholder_mask The mask used to build placeholders names in `$content`
@return string|self Returns the line of output if the object flag is set on `OUTPUT_BY_LINE`,
or `$this` if the flag is set on `OUTPUT_APPEND`
Render a content with a specific tag mask and some placeholders