本文整理汇总了PHP中PBHelper::createStyleAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP PBHelper::createStyleAttribute方法的具体用法?PHP PBHelper::createStyleAttribute怎么用?PHP PBHelper::createStyleAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PBHelper
的用法示例。
在下文中一共展示了PBHelper::createStyleAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: processShortcodeIframe
function processShortcodeIframe($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$Validation = new PBValidation();
if ($Validation->isEmpty($attribute['src'])) {
return null;
}
$style = array(array(), array());
if ((int) $attribute['width'] > 0) {
$style[0]['width'] = (int) $attribute['width'] . 'px';
}
if ((int) $attribute['height'] > 0) {
$style[1]['height'] = (int) $attribute['height'] . 'px';
$style[1]['padding-bottom'] = '0px';
}
$class = array(array('pb-iframe', $attribute['css_class']), array('pb-iframe-content'));
$html = '
<div' . PBHelper::createClassAttribute($class[0]) . PBHelper::createStyleAttribute($style[0]) . '>
<div' . PBHelper::createClassAttribute($class[1]) . PBHelper::createStyleAttribute($style[1]) . '>
<iframe src="' . esc_attr($attribute['src']) . '"></iframe>
</div>
</div>
';
return PBHelper::formatCode($html);
}
示例4: processShortcodeVerticalGrid
function processShortcodeVerticalGrid($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$Validation = new PBValidation();
$this->lineNumber = 0;
$this->lineStyle = array('even' => array('name' => null, 'value' => null), 'odd' => array('name' => null, 'value' => null));
if ($Validation->isEmpty($content)) {
return $html;
}
$style = array();
if ($Validation->isNumber($attribute['column_name_width'], 1, 100)) {
$style['odd']['name']['width'] = $attribute['column_name_width'] . '%';
$style['even']['name']['width'] = $attribute['column_name_width'] . '%';
}
if ($Validation->isNumber($attribute['column_value_width'], 1, 100)) {
$style['odd']['value']['width'] = $attribute['column_value_width'] . '%';
$style['even']['value']['width'] = $attribute['column_value_width'] . '%';
}
if ($Validation->isColor($attribute['line_even_column_name_text_color'])) {
$style['even']['name']['color'] = PBColor::getColor($attribute['line_even_column_name_text_color']);
}
if ($Validation->isColor($attribute['line_even_column_value_text_color'])) {
$style['even']['value']['color'] = PBColor::getColor($attribute['line_even_column_value_text_color']);
}
if ($Validation->isColor($attribute['line_even_column_name_bg_color'])) {
$style['even']['name']['background-color'] = PBColor::getColor($attribute['line_even_column_name_bg_color']);
}
if ($Validation->isColor($attribute['line_even_column_value_bg_color'])) {
$style['even']['value']['background-color'] = PBColor::getColor($attribute['line_even_column_value_bg_color']);
}
if ($Validation->isColor($attribute['line_odd_column_name_text_color'])) {
$style['odd']['name']['color'] = PBColor::getColor($attribute['line_odd_column_name_text_color']);
}
if ($Validation->isColor($attribute['line_odd_column_value_text_color'])) {
$style['odd']['value']['color'] = PBColor::getColor($attribute['line_odd_column_value_text_color']);
}
if ($Validation->isColor($attribute['line_odd_column_name_bg_color'])) {
$style['odd']['name']['background-color'] = PBColor::getColor($attribute['line_odd_column_name_bg_color']);
}
if ($Validation->isColor($attribute['line_odd_column_value_bg_color'])) {
$style['odd']['value']['background-color'] = PBColor::getColor($attribute['line_odd_column_value_bg_color']);
}
$this->lineStyle['even']['name'] = PBHelper::createStyleAttribute($style['even']['name']);
$this->lineStyle['even']['value'] = PBHelper::createStyleAttribute($style['even']['value']);
$this->lineStyle['odd']['name'] = PBHelper::createStyleAttribute($style['odd']['name']);
$this->lineStyle['odd']['value'] = PBHelper::createStyleAttribute($style['odd']['value']);
$class = array('pb-vertical-grid', 'pb-clear-fix', $attribute['css_class']);
$html = '
<div' . PBHelper::createClassAttribute($class) . '>
<ul' . PBHelper::createClassAttribute(array('pb-reset-list')) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</ul>
</div>
';
return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false));
}
示例5: 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);
}
示例6: 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);
}
示例7: 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);
}
示例8: 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));
}
示例9: processShortcodeClassItem
function processShortcodeClassItem($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$Layout = new PBLayout();
$Background = new PBBackground();
$Validation = new PBValidation();
if ($Validation->isEmpty($content)) {
return $html;
}
$class = array('pb-layout-' . $Layout->getLayoutColumnCSSClass($this->currentLayout, $this->currentIndex));
$style = array();
if ($Validation->isNotEmpty($attribute['image_url'])) {
$style['background-image'] = 'url(\'' . $attribute['image_url'] . '\')';
}
if ($Validation->isNotEmpty($attribute['image_position'])) {
$style['background-position'] = $attribute['image_position'];
}
if (array_key_exists($attribute['image_repeat'], $Background->backgroundRepeat)) {
$style['background-repeat'] = $attribute['image_repeat'];
}
if (array_key_exists($attribute['image_size_a'], $Background->backgroundSize)) {
if (in_array($attribute['image_size_a'], array('length', 'percentage'))) {
if ($Validation->isNotEmpty($attribute['image_size_b'])) {
$style['background-size'] = $attribute['image_size_b'];
}
} else {
$style['background-size'] = $attribute['image_size_a'];
}
}
$html = '
<li' . PBHelper::createClassAttribute($class) . PBHelper::createStyleAttribute($style) . '>
<div>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</div>
</li>
';
$this->currentIndex++;
return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false));
}
示例10: 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);
}
示例11: processShortcodeFeatureItem
function processShortcodeFeatureItem($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$Layout = new PBLayout();
$this->attrItemURL = $attribute['item_url'];
$this->attrItemURLTarget = $attribute['item_url_target'];
if (PBComponentData::get($this->getComponentId(), 'icon_type') === 'gr') {
if (!array_key_exists($attribute['item_icon'], $this->icon[$this->attrIconSize]['file'])) {
return $html;
}
}
$position = $this->attrLayoutColumnIndex % 2 == 0 ? 'even' : 'odd';
$class = array(array('pb-layout-' . $Layout->getLayoutColumnCSSClass($this->attrLayout, $this->attrLayoutColumnIndex), 'pb-feature-element-' . $position), array('pb-feature-icon'));
if (PBComponentData::get($this->getComponentId(), 'icon_type') === 'gr') {
array_push($class[1], 'pb-feature-icon-' . PBHelper::createHash($attribute['item_icon']));
}
$style = $this->style[$position];
$element = array(null, null, null);
$element[0] = '<div' . PBHelper::createClassAttribute($class[1]) . PBHelper::createStyleAttribute($style) . '>';
if (PBComponentData::get($this->getComponentId(), 'icon_type') === 'fa') {
$styleFontIcon = array();
if (array_key_exists('color', $style)) {
$styleFontIcon['color'] = $style['color'];
}
$element[1] = '<i class="fa fa-' . esc_attr($attribute['item_icon']) . '"' . PBHelper::createStyleAttribute($styleFontIcon) . '></i>';
}
$element[2] = '</div>';
$html = '
<li' . PBHelper::createClassAttribute($class[0]) . '>
<div>
' . ($this->attrIconPosition != 'bottom' ? join('', $element) : '') . '
' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '
' . ($this->attrIconPosition == 'bottom' ? join('', $element) : '') . '
</div>
</li>
';
$this->attrLayoutColumnIndex++;
return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false));
}
示例12: processShortcodeLayout
//.........这里部分代码省略.........
if ($Validation->isNumber($attribute['border_left_width'], 0, 999)) {
$style['border-left-width'] = $attribute['border_left_width'] . 'px';
}
if ($Validation->isColor($attribute['border_left_color'])) {
$style['border-left-color'] = PBColor::getColor($attribute['border_left_color']);
}
/***/
$MobileDetect = new Mobile_Detect();
$mobile = (int) $MobileDetect->isMobile();
/***/
$videoHTML = null;
$video = $Validation->isNotEmpty($attribute['video_format_webm']) || $Validation->isNotEmpty($attribute['video_format_ogg']) || $Validation->isNotEmpty($attribute['video_format_mp4']);
if ($video && $attribute['video_mobile_enable'] != 1) {
PBInclude::includeClass(PLUGIN_PAGE_BUILDER_LIBRARY_PATH . 'mobileDetect/Mobile_Detect.php', array('Mobile_Detect'));
if ($mobile) {
$video = false;
}
}
if ($video) {
$sourceHTML = null;
$videoControlHTML = null;
$videoAttributeHTML = null;
if ($Validation->isNotEmpty($attribute['video_format_mp4'])) {
$sourceHTML .= '<source type="video/mp4" src="' . esc_attr($attribute['video_format_mp4']) . '" />';
}
if ($Validation->isNotEmpty($attribute['video_format_webm'])) {
$sourceHTML .= '<source type="video/webm" src="' . esc_attr($attribute['video_format_webm']) . '" />';
}
if ($Validation->isNotEmpty($attribute['video_format_ogg'])) {
$sourceHTML .= '<source type="video/ogg" src="' . esc_attr($attribute['video_format_ogg']) . '" />';
}
if ($attribute['video_loop']) {
$videoAttributeHTML .= ' loop';
}
if ($attribute['video_muted']) {
$videoAttributeHTML .= ' muted';
}
if ($attribute['video_autoplay']) {
$videoAttributeHTML .= ' autoplay';
}
if ($attribute['video_control'] == 1) {
$videoControlHTML = '
<div class="pb-line-video-control">
<a href="#" class="pb-line-video-control-toggle-play pb-line-video-control-toggle-play-' . ($attribute['video_autoplay'] == 1 ? 'on' : 'off') . '"></a>
<a href="#" class="pb-line-video-control-toggle-sound pb-line-video-control-toggle-sound-' . ($attribute['video_muted'] == 1 ? 'off' : 'on') . '"></a>
</div>
';
}
$videoHTML = '
<div class="pb-line-video">
<video preload="auto"' . $videoAttributeHTML . '>
' . $sourceHTML . '
</video>
</div>
' . $videoControlHTML . '
';
}
/***/
$overlay = false;
$overlayHTML = null;
if ($Validation->isColor($attribute['overlay_color'])) {
$overlay = true;
$overlayHTML = '<div class="pb-line-overlay" style="background-color:' . PBColor::getColor($attribute['overlay_color']) . '"></div>';
}
/***/
$class = array(array('pb-line', 'pb-clear-fix', $attribute['css_class'], $video || $overlay ? 'pb-line-include-video' : null), array('pb-layout', $Layout->getLayoutCSSClass($attribute['layout']), 'pb-reset-list', 'pb-clear-fix'));
if (in_array($attribute['layout_line'], array('boxed'))) {
$class[0][] = 'pb-main';
}
if (in_array($attribute['layout_line'], array('boxed', 'wide', ''))) {
$class[1][] = 'pb-main';
}
$key = array('bg_parallax_speed', 'bg_parallax_enable', 'bg_parallax_mobile_enable');
foreach ($key as $index) {
$option[$index] = $attribute[$index];
}
$id = PBHelper::createId('pb_line');
$css = esc_attr($attribute['css_group']);
if ($Validation->isNotEmpty($css)) {
array_push($class[0], 'pb-line-css-group-' . $css);
}
PBComponentData::set('layout', 'index', 0);
PBComponentData::set('layout', 'layout', $attribute['layout']);
$html = '
<div id="' . $id . '" ' . PBHelper::createClassAttribute($class[0]) . PBHelper::createStyleAttribute($style) . '>
' . $videoHTML . '
' . $overlayHTML . '
<ul' . PBHelper::createClassAttribute($class[1]) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</ul>
</div>
<div class="pb-script-tag">
<script type="text/javascript">
jQuery(document).ready(function($)
{
$("#' . $id . '").PBLayout(' . json_encode($option) . ',' . $mobile . ');
});
</script>
</div>
';
return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false));
}
示例13: processShortcodeSocialIcon
function processShortcodeSocialIcon($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$style = array();
$social = array();
$Window = new PBWindow();
$Validation = new PBValidation();
if (!array_key_exists($attribute['target'], $Window->linkTarget)) {
return $html;
}
if (!$Validation->isBool($attribute['native_color_enable'])) {
return $html;
}
foreach ($this->social as $index => $value) {
$url = 'profile_' . $index . '_url';
$order = 'profile_' . $index . '_order';
PBHelper::removeUIndex($attribute, $url, $order);
if (!$Validation->isURL($attribute[$url])) {
continue;
}
$orderValue = (int) $attribute[$order];
$socialData = array('id' => $index, 'url' => $attribute[$url]);
if ($Validation->isNumber($attribute[$order], 0, 99)) {
if (isset($social[$orderValue])) {
array_push($social, $socialData);
} else {
$social[$orderValue] = $socialData;
}
} else {
array_push($social, $socialData);
}
}
ksort($social);
if (!count($social)) {
return;
}
$option = array('in' => array(), 'out' => array());
if ($Validation->isNumber($attribute['width'], 0, 999)) {
$style['width'] = $attribute['width'] . 'px';
}
if ($Validation->isNumber($attribute['height'], 0, 999)) {
$style['height'] = $attribute['height'] . 'px';
}
$borderRadius = null;
if ($Validation->isNumber($attribute['border_radius_top_left'], 0, 999)) {
$borderRadius .= ' ' . $attribute['border_radius_top_left'] . 'px';
} else {
$borderRadius .= ' 0px';
}
if ($Validation->isNumber($attribute['border_radius_top_right'], 0, 999)) {
$borderRadius .= ' ' . $attribute['border_radius_top_right'] . 'px';
} else {
$borderRadius .= ' 0px';
}
if ($Validation->isNumber($attribute['border_radius_bottom_right'], 0, 999)) {
$borderRadius .= ' ' . $attribute['border_radius_bottom_right'] . 'px';
} else {
$borderRadius .= ' 0px';
}
if ($Validation->isNumber($attribute['border_radius_bottom_left'], 0, 999)) {
$borderRadius .= ' ' . $attribute['border_radius_bottom_left'] . 'px';
} else {
$borderRadius .= ' 0px';
}
$borderRadius = trim($borderRadius);
$style['-webkit-border-radius'] = $borderRadius;
$style['-moz-border-radius'] = $borderRadius;
$style['border-radius'] = $borderRadius;
if ($Validation->isNumber($attribute['border_width'], 0, 999)) {
$style['border-width'] = $attribute['border_width'] . 'px';
$option['out']['border-width'] = $style['border-width'];
}
if ($Validation->isColor($attribute['bg_color'])) {
$style['background-color'] = PBColor::getColor($attribute['bg_color']);
$option['out']['background-color'] = $style['background-color'];
}
if ($Validation->isColor($attribute['border_color'])) {
$style['border-color'] = PBColor::getColor($attribute['border_color']);
$option['out']['border-color'] = $style['border-color'];
}
if ($Validation->isNumber($attribute['border_width_hover'], 0, 999)) {
$option['in']['border-width'] = $attribute['border_width_hover'] . 'px';
}
if ($Validation->isColor($attribute['bg_color_hover'])) {
$option['in']['background-color'] = PBColor::getColor($attribute['bg_color_hover']);
}
if ($Validation->isColor($attribute['border_color_hover'])) {
$option['in']['border-color'] = PBColor::getColor($attribute['border_color_hover']);
}
foreach ($social as $index => $value) {
$class = array('pb-social-icon-' . $value['id'], $Window->getTargetCSSClass($attribute['target']));
$html .= '
<li><a href="' . esc_attr($value['url']) . '"' . PBHelper::createClassAttribute($class) . PBHelper::createStyleAttribute($style) . '></a></li>
';
}
$id = PBHelper::createId('pb_social_icon');
$class = array('pb-social-icon');
if ($attribute['native_color_enable'] == 1) {
array_push($class, 'pb-social-icon-color-native');
//.........这里部分代码省略.........
示例14: processShortcodeNoticeSecondLine
function processShortcodeNoticeSecondLine($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$style = array();
$Validation = new PBValidation();
if ($Validation->isColor($attribute['text_color'])) {
$style['color'] = PBColor::getColor($attribute['text_color']);
}
$class = array('pb-notice-second-line');
$html = '
<p' . PBHelper::createClassAttribute($class) . PBHelper::createStyleAttribute($style) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</p>
';
return PBHelper::formatHTML($html, $content);
}
示例15: processShortcodeFeatureItem
function processShortcodeFeatureItem($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$Layout = new PBLayout();
$this->attrItemURL = $attribute['item_url'];
$this->attrItemURLTarget = $attribute['item_url_target'];
if (!array_key_exists($attribute['item_icon'], $this->icon[$this->attrIconSize]['file'])) {
return $html;
}
$position = $this->layoutAttrColumnIndex % 2 == 0 ? 'even' : 'odd';
$class = array(array('pb-layout-' . $Layout->getLayoutColumnCSSClass($this->layoutAttr, $this->layoutAttrColumnIndex), 'pb-feature-element-' . $position), array('pb-feature-icon', 'pb-feature-icon-' . PBHelper::createHash($attribute['item_icon'])));
$style = $this->style[$position];
$html = '
<li' . PBHelper::createClassAttribute($class[0]) . '>
<div>
' . ($this->attrIconPosition != 'bottom' ? '<div' . PBHelper::createClassAttribute($class[1]) . PBHelper::createStyleAttribute($style) . '></div>' : '') . '
' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '
' . ($this->attrIconPosition == 'bottom' ? '<div' . PBHelper::createClassAttribute($class[1]) . PBHelper::createStyleAttribute($style) . '></div>' : '') . '
</div>
</li>
';
$this->layoutAttrColumnIndex++;
return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false));
}