Utils/Element.php
/**
     * Build element
     *
     * @param array $attributes - HTML attributes only
     * @param array $settings - other arguments
     * @return string $element
     */
Build element
@param array $attributes - HTML attributes only
@param array $settings - other arguments
@return string $element
Build element @param array $attributes - HTML attributes only @param array $settings - other arguments @return string $element
protected static function build($attributes, $settings)
    {
        if (empty($settings['element'])) {
            return false;
        }
        if (!empty($attributes['href']) && !self::allowsHref($settings['element'])) {
            $href = $attributes['href'];
            unset($attributes['href']);
            if (self::hasWrapLink($settings['element'])) {
                $content    = self::build($attributes, $settings);
                $attributes = array(
                    'href' => $href
                );
                $settings   = array(
                    'element' => 'a',
                    'content' => $content
                );
            } else {
                $settings['content'] = self::aElement(
                    array(
                        'href'    => $href,
                        'content' => $settings['content']
                    )
                );
            }
        }
        $content_position = self::getContentPosition($settings['element']);
        if (isset($settings['content'])
            && $settings['content'] !== ''
            && $content_position !== '><'
            && empty($attributes[$content_position])
        ) {
            $attributes[$content_position] = strip_tags($settings['content']);
            if ($settings['element'] !== 'a') {
                $settings['content'] = '';
            }
        } else if (!self::isAutoClose($settings['element'])) {
            $settings['content'] = StringUtils::avoidFrenchLinebreak($settings['content']);
        }
        $element = '<' . $settings['element']
            . self::attributes($attributes, $settings)
            . (self::isAutoClose($settings['element'])
                ? ' />' . "\n"
                : '>' . $settings['content']
                . '</' . $settings['element'] . '>' . "\n");
        return $element;
    }
protected static function build ( $ attributes , $ settings ) { if ( empty ( $ settings [ 'element' ] ) ) { return false ; } if ( ! empty ( $ attributes [ 'href' ] ) && ! self :: allowsHref ( $ settings [ 'element' ] ) ) { $ href = $ attributes [ 'href' ] ; unset ( $ attributes [ 'href' ] ) ; if ( self :: hasWrapLink ( $ settings [ 'element' ] ) ) { $ content = self :: build ( $ attributes , $ settings ) ; $ attributes = array ( 'href' => $ href ) ; $ settings = array ( 'element' => 'a' , 'content' => $ content ) ; } else { $ settings [ 'content' ] = self :: aElement ( array ( 'href' => $ href , 'content' => $ settings [ 'content' ] ) ) ; } } $ content_position = self :: getContentPosition ( $ settings [ 'element' ] ) ; if ( isset ( $ settings [ 'content' ] ) && $ settings [ 'content' ] !== '' && $ content_position !== '><' && empty ( $ attributes [ $ content_position ] ) ) { $ attributes [ $ content_position ] = strip_tags ( $ settings [ 'content' ] ) ; if ( $ settings [ 'element' ] !== 'a' ) { $ settings [ 'content' ] = '' ; } } else if ( ! self :: isAutoClose ( $ settings [ 'element' ] ) ) { $ settings [ 'content' ] = StringUtils :: avoidFrenchLinebreak ( $ settings [ 'content' ] ) ; } $ element = '<' . $ settings [ 'element' ] . self :: attributes ( $ attributes , $ settings ) . ( self :: isAutoClose ( $ settings [ 'element' ] ) ? ' />' . " \n " : '>' . $ settings [ 'content' ] . '</' . $ settings [ 'element' ] . '>' . " \n " ) ; return $ element ; }
Build element
 @param array $attributes - HTML attributes only
 @param array $settings - other arguments
 @return string $element
Build element @param array $attributes - HTML attributes only @param array $settings - other arguments @return string $element
// next line can not use !empty as this is only true for empty strings and not 0 for instance // in 'a', content and href can be identical // auto closed elements can not have content