예제 #1
0
    function processShortcodeDivider($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $Align = new PBAlign();
        $Border = new PBBorder();
        $Validation = new PBValidation();
        $style = array();
        $class = array('pb-divider', 'pb-clear-fix');
        if ($Validation->isNumber($attribute['line_width'], 0, 9999)) {
            $style['width'] = $attribute['line_width'] . 'px';
        }
        if ($Validation->isNumber($attribute['line_height'], 0, 9999)) {
            $style['border-bottom-width'] = $attribute['line_height'] . 'px';
        }
        if (array_key_exists($attribute['line_style'], $Border->style)) {
            $style['border-style'] = $attribute['line_style'];
        }
        if ($Validation->isColor($attribute['line_color'])) {
            $style['border-color'] = PBColor::getColor($attribute['line_color']);
        }
        if (array_key_exists($attribute['align'], $Align->align)) {
            array_push($class, $Align->getCSSClass($attribute['align']));
        }
        if ($Validation->isNumber($attribute['margin_top'], 0, 9999)) {
            $style['margin-top'] = $attribute['margin_top'] . 'px';
        }
        if ($Validation->isNumber($attribute['margin_bottom'], 0, 9999)) {
            $style['margin-bottom'] = $attribute['margin_bottom'] . 'px';
        }
        array_push($class, $attribute['css_class']);
        $html = '
			<div' . PBHelper::createClassAttribute($class) . PBHelper::createStyleAttribute($style) . '></div>
		';
        return PBHelper::formatHTML($html);
    }
    function processShortcodeBoxHeader($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $html = null;
        $style = array();
        $Align = new PBAlign();
        $Header = new PBHeader();
        $Validation = new PBValidation();
        if ($Validation->isEmpty($content)) {
            return $html;
        }
        if (!array_key_exists($attribute['align'], $Align->align)) {
            return $html;
        }
        if (!array_key_exists($attribute['important'], $Header->important)) {
            return $html;
        }
        if ($Validation->isColor($attribute['text_color'])) {
            $style['color'] = PBColor::getColor($attribute['text_color']);
        }
        $class = array('pb-box-header', 'pb-clear-fix', $Align->getCSSClass($attribute['align']));
        $html = '
			<h' . $attribute['important'] . PBHelper::createClassAttribute($class) . PBHelper::createStyleAttribute($style) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</h' . $attribute['important'] . '>
		';
        return PBHelper::formatHTML($html, $content);
    }