本文整理汇总了PHP中PBHelper::formatHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP PBHelper::formatHTML方法的具体用法?PHP PBHelper::formatHTML怎么用?PHP PBHelper::formatHTML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PBHelper
的用法示例。
在下文中一共展示了PBHelper::formatHTML方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processShortcodeScreenPreloader
function processShortcodeScreenPreloader($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$Validation = new PBValidation();
if (!$Validation->isColor($attribute['bg_color'])) {
return $html;
}
if (!$Validation->isNumber($attribute['z_index'], 0, 999999)) {
return $html;
}
$style = array();
$class = array('pb-screen-preloader', $attribute['css_class']);
$style['z-index'] = $attribute['z_index'];
$style['background-color'] = PBColor::getColor($attribute['bg_color']);
$id = PBHelper::createId('pb_screen_preloader');
$html = '
<div' . PBHelper::createStyleAttribute($style) . PBHelper::createClassAttribute($class) . ' id="' . esc_attr($id) . '"></div>
<div class="pb-script-tag">
<script type="text/javascript">
jQuery(document).ready(function($)
{
$(\'#' . $id . '\').PBScreenPreloader();
});
</script>
</div>
';
return PBHelper::formatHTML($html);
}
示例2: processShortcodeText
function processShortcodeText($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$class = array('pb-text', $attribute['css_class']);
$html = '<div' . PBHelper::createClassAttribute($class) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</div>';
return PBHelper::formatHTML($html, PBHelper::formatContent($content));
}
示例3: processShortcodeDivider
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);
}
示例4: processShortcodeList
function processShortcodeList($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$Validation = new PBValidation();
$classBullet = null;
if ($Validation->isNotEmpty($attribute['bullet'])) {
$classBullet = 'pb-list-' . PBHelper::createHash($attribute['bullet']);
}
$class = array('pb-list', $classBullet, $attribute['css_class']);
$html = '<div' . PBHelper::createClassAttribute($class) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</div>';
return PBHelper::formatHTML($html, $content);
}
示例5: processShortcodeLayoutColumn
function processShortcodeLayoutColumn($attribute, $content, $tag)
{
$Layout = new PBLayout();
$attribute = $this->processAttribute($tag, $attribute);
$index = PBComponentData::get('layout', 'index');
$layout = PBComponentData::get('layout', 'layout');
$class = array('pb-layout-' . $Layout->getLayoutColumnCSSClass($layout, $index));
$html = '
<li' . PBHelper::createClassAttribute($class) . '>
<div class="pb-space-line"></div>
<div>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</div>
</li>
';
PBComponentData::set('layout', 'index', $index + 1);
return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false));
}
示例6: processShortcodeSpace
function processShortcodeSpace($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$style = array();
$Validation = new PBValidation();
if ($Validation->isNumber($attribute['height'], -9999, 9999)) {
if ((int) $attribute['height'] >= 0) {
$style['height'] = (int) $attribute['height'] . 'px';
} else {
$style['margin-top'] = (int) $attribute['height'] . 'px';
}
}
$class = array('pb-space', 'pb-clear-fix', $attribute['css_class']);
$html = '<div' . PBHelper::createClassAttribute(array('pb-space-line')) . '></div><div' . PBHelper::createClassAttribute($class) . PBHelper::createStyleAttribute($style) . '></div>';
return PBHelper::formatHTML($html);
}
示例7: processShortcodeHeader
function processShortcodeHeader($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$style = array();
$Font = new PBFont();
$Header = new PBHeader();
$Validation = new PBValidation();
if ($Validation->isEmpty($content)) {
return $html;
}
if (!array_key_exists($attribute['important'], $Header->important)) {
return $html;
}
if (!$Validation->isBool($attribute['underline_enable'])) {
return $html;
}
if ($Validation->isNumber($attribute['font_size'], 1, 200, true)) {
$style['font-size'] = $attribute['font_size'] . 'px';
}
if (array_key_exists($attribute['font_weight'], $Font->weight)) {
$style['font-weight'] = $attribute['font_weight'];
}
if (array_key_exists($attribute['font_style'], $Font->style)) {
$style['font-style'] = $attribute['font_style'];
}
if ($Validation->isColor($attribute['font_color'])) {
$style['color'] = PBColor::getColor($attribute['font_color']);
}
if ($Validation->isColor($attribute['background_color'])) {
$style['background-color'] = PBColor::getColor($attribute['background_color']);
}
if ($Validation->isNotEmpty($attribute['line_height'])) {
$style['line-height'] = $attribute['line_height'];
}
if ($Validation->isNumber($attribute['text_indent'], 0, 999)) {
$style['text-indent'] = $attribute['text_indent'] . 'px';
}
$class = array(array('pb-header', $attribute['css_class']), array('pb-header-content'), array('pb-header-underline'));
$html = '<h' . (int) $attribute['important'] . PBHelper::createClassAttribute($class[0]) . PBHelper::createStyleAttribute($style) . '><span' . PBHelper::createClassAttribute($class[1]) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</span>' . ($attribute['underline_enable'] == 1 ? '<span' . PBHelper::createClassAttribute($class[2]) . '></span>' : null) . '</h' . (int) $attribute['important'] . '>';
return PBHelper::formatHTML($html, $content);
}
示例8: processShortcodeBlockquote
function processShortcodeBlockquote($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$Validation = new PBValidation();
if ($Validation->isEmpty($content)) {
return $html;
}
$class = array('pb-blockquote', $attribute['css_class']);
if ($Validation->isNotEmpty($attribute['author'])) {
$html = '<div class="pb-blockquote-author">— ' . $attribute['author'] . '</div>';
}
$html = '
<div' . PBHelper::createClassAttribute($class) . '>
<blockquote>
' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '
</blockquote>
' . $html . '
</div>
';
return PBHelper::formatHTML($html, PBHelper::formatContent($content));
}
示例9: processShortcodeVideo
function processShortcodeVideo($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$src = $this->parseVideoURL($attribute['src'], $attribute['type']);
if ($src === false) {
return $html;
}
$style = array();
if ((int) $attribute['player_width'] > 0) {
$style['width'] = (int) $attribute['player_width'] . 'px';
}
$class = array(array('pb-video', $attribute['css_class']), array('pb-video-content'));
$html = '
<div' . PBHelper::createClassAttribute($class[0]) . PBHelper::createStyleAttribute($style) . '>
<div' . PBHelper::createClassAttribute($class[1]) . '>
<iframe src="' . esc_attr($src) . '"></iframe>
</div>
</div>
';
return PBHelper::formatHTML($html);
}
示例10: processShortcodePreformattedText
function processShortcodePreformattedText($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$Validation = new PBValidation();
if ($Validation->isEmpty($content)) {
return $html;
}
if (!$Validation->isBool($attribute['open_default'])) {
return $html;
}
$class = array('pb-preformatted-text');
if ($attribute['open_default'] == 1) {
array_push($class, 'pb-preformatted-text-visible');
}
array_push($class, $attribute['css_class']);
$id = PBHelper::createId('pb_preformatted_text');
$content = nl2br(trim(preg_replace(array('/\\[/', '/\\]/'), array('[', ']'), htmlspecialchars($content))));
$html = '
<div id="' . $id . '"' . PBHelper::createClassAttribute($class) . '>
<a href="#">
<span class="pb-preformatted-text-label-open">' . esc_html($attribute['label_open']) . '</span>
<span class="pb-preformatted-text-label-close">' . esc_html($attribute['label_close']) . '</span>
</a>
<pre>' . $content . '</pre>
</div>
<div class="pb-script-tag">
<script type="text/javascript">
jQuery(document).ready(function($)
{
$("#' . $id . '").PBPreformattedText();
});
</script>
</div>
';
return PBHelper::formatHTML($html);
}
示例11: processShortcodeDropcap
function processShortcodeDropcap($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$Validation = new PBValidation();
$style = array();
$class = array('pb-dropcap', 'pb-clear-fix', $attribute['css_class']);
if ($Validation->isNumber($attribute['font_size'], 1, 100)) {
$style['font-size'] = $attribute['font_size'] . 'px';
}
if ($Validation->isColor($attribute['font_color'])) {
$style['color'] = PBColor::getColor($attribute['font_color']);
}
if ($Validation->isColor($attribute['bg_color'])) {
$style['background-color'] = PBColor::getColor($attribute['bg_color']);
}
$letter = mb_substr($content, 0, 1);
$content = mb_substr($content, 1);
$html = '
<p' . PBHelper::createClassAttribute($class) . '>
<span class="pb-dropcap-first-letter" ' . PBHelper::createStyleAttribute($style) . '>' . $letter . '</span>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '
</p>
';
return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false));
}
示例12: createField
function createField($name)
{
$html = null;
$Validation = new PBValidation();
$data = $this->getFieldData($name);
if ($data === false) {
return $html;
}
$argument = array();
$argumentString = null;
$argument['id'] = $data['id'];
$argument['name'] = $data['id'];
foreach ($argument as $index => $value) {
$argumentString .= ' ' . $index . '="' . esc_attr($value) . '"';
}
switch ($data['type']) {
case 'text':
$html = '<input type="text"' . $argumentString . '/>';
break;
case 'email':
$html = '<input type="text"' . $argumentString . '/>';
break;
case 'submit':
$html = '<input type="submit" value="' . esc_attr($data['label']) . '"' . $argumentString . '/>';
break;
case 'select':
$option = preg_split('/;/', $data['value']);
foreach ($option as $value) {
if ($Validation->isNotEmpty($value)) {
$html .= '<option value="' . esc_attr($value) . '">' . esc_html($value) . '</option>';
}
}
$html = '<select' . $argumentString . '>' . $html . '</select>';
break;
case 'textarea':
$html = '<textarea rows="1" cols="1"' . $argumentString . '></textarea>';
break;
}
if (in_array($data['type'], array('text', 'textarea', 'email'))) {
$html = '<label for="' . $argument['id'] . '" class="pb-infield-label">' . esc_html($data['label']) . '</label>' . $html;
}
return PBHelper::formatHTML($html);
}
示例13: processShortcodeBoxHeader
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);
}
示例14: processShortcodeClassItemButton
function processShortcodeClassItemButton($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$Validation = new PBValidation();
if ($Validation->isEmpty($content)) {
return $html;
}
if ($Validation->isEmpty($attribute['url'])) {
return $html;
}
$class = array('pb-class-item-button');
$html = '
<div' . PBHelper::createClassAttribute($class) . '>
<a href="' . esc_attr($attribute['url']) . '">' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '<i class="pb-button-arrow pb-button-arrow-right"></i></a>
</div>
';
return PBHelper::formatHTML($html, $content);
}
示例15: processShortcodeButton
//.........这里部分代码省略.........
if ($attribute['icon_enable'] == 1) {
if ($Validation->isEmpty($attribute['icon'])) {
return $html;
}
if (!in_array($attribute['icon_position'], array_keys($this->buttonIconPosition))) {
return $html;
}
}
/***/
if ($Validation->isColor($attribute['text_color'])) {
$style[1]['color'] = PBColor::getColor($attribute['text_color']);
$option['out']['color'] = $style[1]['color'];
}
if ($Validation->isColor($attribute['bg_color'])) {
$style[1]['background-color'] = PBColor::getColor($attribute['bg_color']);
$option['out']['background-color'] = $style[1]['background-color'];
}
if ($attribute['border_style'] != -1) {
if (array_key_exists($attribute['border_style'], $Border->style)) {
$style[1]['border-style'] = $attribute['border_style'];
$option['out']['border-style'] = $style[1]['border-style'];
}
}
if ($Validation->isColor($attribute['border_color'])) {
$style[1]['border-color'] = PBColor::getColor($attribute['border_color']);
$option['out']['border-color'] = $style[1]['border-color'];
}
if ($Validation->isNumber($attribute['border_width'], 0, 999)) {
$style[1]['border-width'] = $attribute['border_width'] . 'px';
$option['out']['border-width'] = $style[1]['border-width'];
}
if ($Validation->isNumber($attribute['border_radius'], 0, 999)) {
$style[1]['border-radius'] = $attribute['border_radius'] . 'px';
$option['out']['border-radius'] = $style[1]['border-radius'];
}
if ($attribute['font_weight'] != -1) {
if (array_key_exists($attribute['font_weight'], $Font->weight)) {
$style[1]['font-weight'] = $attribute['font_weight'];
$option['out']['font-weight'] = $style[1]['font-weight'];
}
}
/***/
if ($Validation->isColor($attribute['text_color_hover'])) {
$option['in']['color'] = PBColor::getColor($attribute['text_color_hover']);
}
if ($Validation->isColor($attribute['bg_color_hover'])) {
$option['in']['background-color'] = PBColor::getColor($attribute['bg_color_hover']);
}
if ($attribute['border_style_hover'] != -1) {
if (array_key_exists($attribute['border_style_hover'], $Border->style)) {
$option['in']['border-style'] = $attribute['border_style_hover'];
}
}
if ($Validation->isColor($attribute['border_color_hover'])) {
$option['in']['border-color'] = PBColor::getColor($attribute['border_color_hover']);
}
if ($Validation->isNumber($attribute['border_width_hover'], 0, 999)) {
$option['in']['border-width'] = $attribute['border_width_hover'] . 'px';
}
if ($Validation->isNumber($attribute['border_radius_hover'], 0, 999)) {
$option['in']['border-radius'] = $attribute['border_radius_hover'] . 'px';
}
if ($attribute['font_weight'] != -1) {
if (array_key_exists($attribute['font_weight_hover'], $Font->weight)) {
$option['in']['font-weight'] = $attribute['font_weight_hover'];
}
}
/***/
$class[0] = array('pb-button');
$class[1] = array($Window->getTargetCSSClass($attribute['src_target']));
$class[2] = array('pb-button-icon');
$class[3] = array('pb-button-content');
array_push($class[0], 'pb-button-size-' . $attribute['size']);
if ($attribute['icon_enable'] == 1) {
array_push($class[0], 'pb-button-icon');
array_push($class[0], 'pb-button-icon-position-' . $attribute['icon_position']);
array_push($class[2], 'pb-button-icon-' . PBHelper::createHash($attribute['icon']));
}
$class[0][] = $attribute['css_class'];
$id = PBHelper::createId('pb_button');
$html = '
<div' . PBHelper::createClassAttribute($class[0]) . ' id="' . $id . '">
<a href="' . esc_attr($attribute['src']) . '"' . PBHelper::createClassAttribute($class[1]) . PBHelper::createStyleAttribute($style[1]) . '>
<span class="pb-button-box">
<span' . PBHelper::createClassAttribute($class[2]) . PBHelper::createStyleAttribute($style[2]) . '></span>
<span' . PBHelper::createClassAttribute($class[3]) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . ($attribute['arrow_enable'] == 1 ? '<i class="pb-button-arrow pb-button-arrow-right"></i>' : null) . '</span>
</span>
</a>
<div class="pb-script-tag">
<script type="text/javascript">
jQuery(document).ready(function($)
{
$(\'#' . $id . '\').PBButton(' . json_encode($option) . ');
});
</script>
</div>
</div>
';
return PBHelper::formatHTML($html, $content);
}