本文整理汇总了PHP中PBHelper::createId方法的典型用法代码示例。如果您正苦于以下问题:PHP PBHelper::createId方法的具体用法?PHP PBHelper::createId怎么用?PHP PBHelper::createId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PBHelper
的用法示例。
在下文中一共展示了PBHelper::createId方法的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: processShortcodeClass
function processShortcodeClass($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$Layout = new PBLayout();
$Validation = new PBValidation();
if ($Validation->isEmpty($content)) {
return $html;
}
if (!array_key_exists($attribute['layout'], $this->layout)) {
return $html;
}
$option = array();
$this->currentIndex = 0;
$this->currentLayout = $attribute['layout'];
$id = PBHelper::createId('pb_class');
$class = array(array('pb-class', 'pb-clear-fix', $attribute['css_class']), array('pb-reset-list', $Layout->getLayoutCSSClass($attribute['layout'])));
$html = '
<div' . PBHelper::createClassAttribute($class[0]) . ' id="' . esc_attr($id) . '">
<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 . '").PBClass(' . json_encode($option) . ');
});
</script>
</div>
';
return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false));
}
示例3: processShortcodeAccordion
function processShortcodeAccordion($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$Easing = new PBEasing();
$Validation = new PBValidation();
if (!$Validation->isNumber($attribute['active'], 0, 999)) {
return $html;
}
if (!$Validation->isBool($attribute['disabled'])) {
return $html;
}
if (!$Validation->isBool($attribute['collapsible'])) {
return $html;
}
if (!$Validation->isBool($attribute['close_at_start'])) {
return $html;
}
if (!array_key_exists($attribute['height_style'], $this->heightStyle)) {
return $html;
}
if (!$Validation->isBool($attribute['animation_enable'])) {
return $html;
}
if (!$Validation->isNotEmpty($attribute['animation_duration'], 0, 99999)) {
return $html;
}
if (!array_key_exists($attribute['animation_easing'], $Easing->easingType)) {
return $html;
}
if (!$Validation->isNumber($attribute['header_font_size'], 0, 100)) {
return $html;
}
$key = array('active', 'disabled', 'collapsible', 'height_style', 'close_at_start', 'animation_enable', 'animation_duration', 'animation_easing');
foreach ($key as $index) {
$option[$index] = $attribute[$index];
}
$option['header_important_default'] = PBComponentData::get($this->getComponentId(), 'header_important_default');
$id = PBHelper::createId('pb_accordion');
$class = array('pb-accordion', 'pb-clear-fix', $attribute['css_class']);
PBComponentData::set('accordion', 'header_font_size', $attribute['header_font_size'], true);
$html = '
<div' . PBHelper::createClassAttribute($class) . ' id="' . esc_attr($id) . '">
' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '
</div>
<div class="pb-script-tag">
<script type="text/javascript">
jQuery(document).ready(function($)
{
$("#' . $id . '").PBAccordion(' . json_encode($option) . ');
});
</script>
</div>
';
return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false));
}
示例4: processShortcodeAudio
function processShortcodeAudio($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$option = array();
$this->track = array();
$this->trackIndex = 0;
$Validation = new PBValidation();
if ($Validation->isEmpty($content)) {
return $html;
}
if (!$Validation->isNumber($attribute['volume'], 0, 100)) {
return $html;
}
if (!$Validation->isBool($attribute['muted'])) {
return $html;
}
if (!$Validation->isBool($attribute['playlist_enable'])) {
return $html;
}
$attribute['volume'] /= 100;
$key = array('muted', 'volume', 'playlist_enable');
foreach ($key as $value) {
$option[$value] = $attribute[$value];
}
$id = PBHelper::createId('audio');
$idPlayer = PBHelper::createId('audio_player');
$idPlayerContainer = PBHelper::createId('audio_player_container');
do_shortcode($content);
if (!count($this->track)) {
return $html;
}
$html .= $this->createJPlayerTemplate($id, $idPlayer, $idPlayerContainer);
$html .= '
<div class="pb-script-tag">
<script type="text/javascript">
jQuery(document).ready(function($)
{
$(\'#' . $id . '\').PBAudio(' . json_encode(array('idPlayer' => $idPlayer, 'idPlayerContainer' => $idPlayerContainer)) . ',' . json_encode($option) . ',' . json_encode($this->track) . ');
});
</script>
</div>
';
return PBHelper::formatHTML($html);
}
示例5: processShortcodeCounterList
function processShortcodeCounterList($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$option = array();
$Easing = new PBEasing();
$Validation = new PBValidation();
$this->character = array('before' => $attribute['character_before'], 'after' => $attribute['character_after']);
$content = do_shortcode($content);
if ($Validation->isEmpty($content)) {
return $html;
}
if (!$Validation->isBool($attribute['waypoint_enable'])) {
return $html;
}
if (!$Validation->isNumber($attribute['waypoint_duration'], 0, 99999)) {
return $html;
}
if (!array_key_exists($attribute['waypoint_easing'], $Easing->easingType)) {
return $html;
}
$key = array('waypoint_enable', 'waypoint_duration', 'waypoint_easing', 'waypoint_offset_trigger', 'character_before', 'character_after');
foreach ($key as $index) {
$option[$index] = $attribute[$index];
}
$class = array(array('pb-clear-fix', 'pb-counter-list', $attribute['css_class']), array('pb-reset-list'));
$id = PBHelper::createId('pb_counter_list');
$html = '
<div' . PBHelper::createClassAttribute($class[0]) . ' id="' . $id . '">
<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 . '").PBCounterList(' . json_encode($option) . ');
});
</script>
</div>
';
return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false));
}
示例6: processShortcodeList
function processShortcodeList($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$Validation = new PBValidation();
if (PBComponentData::get($this->getComponentId(), 'icon_type') === 'gr') {
$classBullet = null;
if ($Validation->isNotEmpty($attribute['bullet'])) {
$classBullet = 'pb-list-icon-name-' . PBHelper::createHash($attribute['bullet']);
}
$class = array('pb-list', 'pb-list-icon-type-gr', $classBullet, $attribute['css_class']);
} else {
$class = array('pb-list', 'pb-list-icon-type-fa', $attribute['css_class']);
}
$id = PBHelper::createId('pb_list');
$html = '<div' . PBHelper::createClassAttribute($class) . ' id="' . esc_attr($id) . '">' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</div>';
if (PBComponentData::get($this->getComponentId(), 'icon_type') === 'fa' && $Validation->isNotEmpty($attribute['font_icon_name'])) {
$option = array();
$option['icon_type'] = 'fa';
if ($Validation->isNotEmpty($attribute['font_icon_name'])) {
$option['font_icon_name'] = $attribute['font_icon_name'];
}
if ($Validation->isColor($attribute['font_icon_color'])) {
$option['font_icon_color'] = $attribute['font_icon_color'];
}
if ($Validation->isNumber($attribute['font_icon_size'], 1, 200)) {
$option['font_icon_size'] = $attribute['font_icon_size'];
}
$html .= '
<div class="pb-script-tag">
<script type="text/javascript">
jQuery(document).ready(function($)
{
$(\'#' . $id . '\').PBList(' . json_encode($option) . ');
});
</script>
</div>
';
}
return PBHelper::formatHTML($html, $content);
}
示例7: 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);
}
示例8: processShortcodeBox
function processShortcodeBox($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$option = array();
$style = array(array(), array());
$Border = new PBBorder();
$Validation = new PBValidation();
/***/
if (!$Validation->isBool($attribute['icon_enable'])) {
return $html;
}
if (!array_key_exists($attribute['icon_size'], $this->icon)) {
return $html;
}
if (!array_key_exists($attribute['icon_position'], $this->iconPosition)) {
return $html;
}
/***/
if ($Validation->isColor($attribute['background_color'])) {
$style[0]['background-color'] = PBColor::getColor($attribute['background_color']);
}
if (array_key_exists($attribute['border_top_style'], $Border->style)) {
$style[0]['border-top-style'] = $attribute['border_top_style'];
}
if ($Validation->isNumber($attribute['border_top_width'], 0, 999)) {
$style[0]['border-top-width'] = $attribute['border_top_width'] . 'px';
}
if ($Validation->isColor($attribute['border_top_color'])) {
$style[0]['border-top-color'] = PBColor::getColor($attribute['border_top_color']);
}
if ($Validation->isNumber($attribute['border_top_radius'], 0, 999)) {
$style[0]['-webkit-border-top-left-radius'] = $attribute['border_top_radius'] . 'px';
$style[0]['-moz-border-radius-topleft'] = $attribute['border_top_radius'] . 'px';
$style[0]['border-top-left-radius'] = $attribute['border_top_radius'] . 'px';
}
if (array_key_exists($attribute['border_right_style'], $Border->style)) {
$style[0]['border-right-style'] = $attribute['border_right_style'];
}
if ($Validation->isNumber($attribute['border_right_width'], 0, 999)) {
$style[0]['border-right-width'] = $attribute['border_right_width'] . 'px';
}
if ($Validation->isColor($attribute['border_right_color'])) {
$style[0]['border-right-color'] = PBColor::getColor($attribute['border_right_color']);
}
if ($Validation->isNumber($attribute['border_right_radius'], 0, 999)) {
$style[0]['-webkit-border-top-right-radius'] = $attribute['border_right_radius'] . 'px';
$style[0]['-moz-border-radius-topright'] = $attribute['border_right_radius'] . 'px';
$style[0]['border-top-right-radius'] = $attribute['border_right_radius'] . 'px';
}
if (array_key_exists($attribute['border_bottom_style'], $Border->style)) {
$style[0]['border-bottom-style'] = $attribute['border_bottom_style'];
}
if ($Validation->isNumber($attribute['border_bottom_width'], 0, 999)) {
$style[0]['border-bottom-width'] = $attribute['border_bottom_width'] . 'px';
}
if ($Validation->isColor($attribute['border_bottom_color'])) {
$style[0]['border-bottom-color'] = PBColor::getColor($attribute['border_bottom_color']);
}
if ($Validation->isNumber($attribute['border_bottom_radius'], 0, 999)) {
$style[0]['-webkit-border-bottom-right-radius'] = $attribute['border_bottom_radius'] . 'px';
$style[0]['-moz-border-radius-bottomright'] = $attribute['border_bottom_radius'] . 'px';
$style[0]['border-bottom-right-radius'] = $attribute['border_bottom_radius'] . 'px';
}
if (array_key_exists($attribute['border_left_style'], $Border->style)) {
$style[0]['border-left-style'] = $attribute['border_left_style'];
}
if ($Validation->isNumber($attribute['border_left_width'], 0, 999)) {
$style[0]['border-left-width'] = $attribute['border_left_width'] . 'px';
}
if ($Validation->isColor($attribute['border_left_color'])) {
$style[0]['border-left-color'] = PBColor::getColor($attribute['border_left_color']);
}
if ($Validation->isNumber($attribute['border_left_radius'], 0, 999)) {
$style[0]['-webkit-border-bottom-left-radius'] = $attribute['border_left_radius'] . 'px';
$style[0]['-moz-border-radius-bottomleft'] = $attribute['border_left_radius'] . 'px';
$style[0]['border-bottom-left-radius'] = $attribute['border_left_radius'] . 'px';
}
if ($Validation->isNumber($attribute['padding_top'], 0, 999)) {
$style[0]['padding-top'] = $attribute['padding_top'] . 'px';
}
if ($Validation->isNumber($attribute['padding_right'], 0, 999)) {
$style[0]['padding-right'] = $attribute['padding_right'] . 'px';
}
if ($Validation->isNumber($attribute['padding_bottom'], 0, 999)) {
$style[0]['padding-bottom'] = $attribute['padding_bottom'] . 'px';
}
if ($Validation->isNumber($attribute['padding_left'], 0, 999)) {
$style[0]['padding-left'] = $attribute['padding_left'] . 'px';
}
if ($Validation->isColor($attribute['text_color_link'])) {
$option['out']['color'] = PBColor::getColor($attribute['text_color_link']);
}
if ($Validation->isColor($attribute['text_color_link_hover'])) {
$option['in']['color'] = PBColor::getColor($attribute['text_color_link_hover']);
}
$id = PBHelper::createId('pb_box');
$class[0] = array('pb-box', 'pb-clear-fix', $attribute['css_class']);
if ($attribute['icon_enable'] == 1) {
array_push($class[0], 'pb-box-icon');
//.........这里部分代码省略.........
示例9: 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));
}
示例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: processShortcodeMenu
function processShortcodeMenu($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$Easing = new PBEasing();
$Validation = new PBValidation();
if (!array_key_exists($attribute['responsive_mode'], $this->responiveMode)) {
return;
}
if (!$Validation->isBool($attribute['sticky_enable'])) {
return;
}
if (!$Validation->isBool($attribute['hide_scroll_enable'])) {
return;
}
if (!$Validation->isBool($attribute['menu_animation_enable'])) {
return;
}
if (!$Validation->isNumber($attribute['menu_animation_speed_open'], 0, 99999)) {
return;
}
if (!$Validation->isNumber($attribute['menu_animation_speed_close'], 0, 99999)) {
return;
}
if (!$Validation->isNumber($attribute['menu_animation_delay'], 0, 99999)) {
return;
}
if (!$Validation->isBool($attribute['scroll_animation_enable'])) {
return;
}
if (!$Validation->isNumber($attribute['scroll_animation_speed'], 0, 99999)) {
return;
}
if (!array_key_exists($attribute['scroll_animation_easing'], $Easing->easingType)) {
return;
}
$html = null;
$logoHTML = null;
$option = array();
$key = array('responsive_mode', 'sticky_enable', 'hide_scroll_enable', 'menu_animation_enable', 'menu_animation_speed_open', 'menu_animation_speed_close', 'menu_animation_delay', 'scroll_animation_enable', 'scroll_animation_speed', 'scroll_animation_easing');
foreach ($key as $value) {
$option[$value] = $attribute[$value];
}
$option['responsive_menu_id'] = PBHelper::createId('pb_menu_responsive');
$option['responsive_menu_label'] = __('Menu');
$id = PBHelper::createId('pb_menu');
$classLogo = array('pb-logo');
$classMenu = array('pb-menu-default');
$classMenuResponsive = array('pb-menu-responsive');
$class = array('pb-menu', $attribute['css_class']);
$menuAttribute = array('menu' => $attribute['menu_id'], 'walker' => new PBMenuWalker(), 'menu_class' => 'sf-menu pb-reset-list pb-clear-fix', 'container' => '', 'container_class' => '', 'echo' => 0);
$menuResponsiveAttribute = array('id' => $option['responsive_menu_id'], 'menu' => $attribute['menu_id'], 'walker' => new PBMenuResponsiveWalker(), 'menu_class' => 'pb-clear-fix', 'container' => '', 'container_class' => '', 'echo' => 0, 'items_wrap' => '<div id="%1$s" class="%2$s"><div id="' . $option['responsive_menu_id'] . '"><ul>%3$s</ul></div></div>');
if ($Validation->isURL($attribute['logo_src'])) {
$logoHTML = '
<a href="' . get_home_url() . '">
<img src="' . esc_attr($attribute['logo_src']) . '" alt=""/>
</a>
';
}
$html = '
<div' . PBHelper::createClassAttribute($class) . ' id="' . $id . '">
<div class="pb-main pb-clear-fix">
<div' . PBHelper::createClassAttribute($classLogo) . '>
' . $logoHTML . '
</div>
<div' . PBHelper::createClassAttribute($classMenu) . '>
' . wp_nav_menu($menuAttribute) . '
</div>
<div' . PBHelper::createClassAttribute($classMenuResponsive) . '>
' . wp_nav_menu($menuResponsiveAttribute) . '
</div>
</div>
</div>
<div class="pb-script-tag">
<script type="text/javascript">
jQuery(document).ready(function($)
{
$(\'#' . $id . '\').PBMenu(' . json_encode($option) . ');
});
</script>
</div>
';
return PBHelper::formatCode($html);
}
示例12: processShortcodeNivoSlider
function processShortcodeNivoSlider($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$option = array();
$html = null;
$imageHTML = null;
$imageBoxHTML = null;
$paginationHTML = null;
$Validation = new PBValidation();
$file = PBFile::getImage(explode(',', $attribute['image']));
if ($file === false) {
return $html;
}
if (!count($file->posts)) {
return $html;
}
if (!PBFile::isWPImage($attribute['image_size'])) {
return $html;
}
if (!array_key_exists($attribute['transition_effect'], $this->effect)) {
return $html;
}
if (!$Validation->isNumber($attribute['count_slice'], 0, 999)) {
return $html;
}
if (!$Validation->isNumber($attribute['count_column'], 0, 999)) {
return $html;
}
if (!$Validation->isNumber($attribute['count_row'], 0, 999)) {
return $html;
}
if (!$Validation->isNumber($attribute['transition_speed'], 0, 99999)) {
return $html;
}
if (!$Validation->isNumber($attribute['pause_time'], 0, 99999)) {
return $html;
}
if (!$Validation->isNumber($attribute['start_slide'], 0, 999)) {
return $html;
}
if (!$Validation->isBool($attribute['preloader_enable'])) {
return $html;
}
if (!$Validation->isBool($attribute['direction_navigation_enable'])) {
return $html;
}
if (!$Validation->isBool($attribute['control_navigation_enable'])) {
return $html;
}
if (!$Validation->isBool($attribute['control_navigation_thumbs_enable'])) {
return $html;
}
if (!$Validation->isBool($attribute['pause_on_hover'])) {
return $html;
}
if (!$Validation->isBool($attribute['manual_advance_enable'])) {
return $html;
}
if (!$Validation->isBool($attribute['random_start_enable'])) {
return $html;
}
$key = array('transition_effect', 'count_slice', 'count_column', 'count_row', 'transition_speed', 'pause_time', 'start_slide', 'preloader_enable', 'direction_navigation_enable', 'control_navigation_enable', 'control_navigation_thumbs_enable', 'pause_on_hover', 'manual_advance_enable', 'random_start_enable');
foreach ($key as $index) {
$option[$index] = $attribute[$index];
}
$class = array(array(), array());
if ($attribute['preloader_enable'] == 1) {
array_push($class[0], 'pb-image-box', 'pb-image-preloader');
}
array_push($class[1], 'pb-image');
global $post;
$bPost = $post;
while ($file->have_posts()) {
$file->the_post();
$src = wp_get_attachment_image_src(get_the_ID(), $attribute['image_size']);
$url = null;
$meta = PBMeta::get($post->ID);
PBHelper::removeUIndex($meta, 'media_library_url');
if ($Validation->isNotEmpty($attribute['url'])) {
$url = $attribute['url'];
} elseif ($Validation->isNotEmpty($meta['media_library_url'])) {
$url = $meta['media_library_url'];
}
if ($Validation->isNotEmpty($url)) {
$imageHTML = '<a href="' . esc_attr($url) . '"><img src="' . $src[0] . '" alt=""/></a>';
} else {
$imageHTML = '<img src="' . $src[0] . '" alt="" data-thumb="' . $src[0] . '"/>';
}
$imageBoxHTML .= '
<div' . PBHelper::createClassAttribute($class[0]) . '>
<div' . PBHelper::createClassAttribute($class[1]) . '>' . $imageHTML . '</div>
</div>
';
}
wp_reset_query();
$post = $bPost;
$id = PBHelper::createId('pb_nivo_slider');
$class = array(array(), array());
array_push($class[0], 'pb-nivo-slider', $attribute['css_class']);
if ($attribute['preloader_enable'] == 1) {
//.........这里部分代码省略.........
示例13: processShortcodeCallToAction
function processShortcodeCallToAction($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$style = array(array(), array());
$class = array(array('pb-call-to-action', 'pb-clear-fix', $attribute['css_class']), array('pb-call-to-action-box', 'pb-clear-fix'));
$Validation = new PBValidation();
if ($Validation->isColor($attribute['bg_color'])) {
$style[0]['background-color'] = PBColor::getColor($attribute['bg_color']);
}
if ($Validation->isNumber($attribute['border_top_width'], 0, 9999)) {
$style[0]['border-top-width'] = $attribute['border_top_width'] . 'px';
}
if ($Validation->isColor($attribute['border_top_color'])) {
$style[0]['border-top-color'] = PBColor::getColor($attribute['border_top_color']);
}
if ($Validation->isNumber($attribute['border_right_width'], 0, 9999)) {
$style[0]['border-right-width'] = $attribute['border_right_width'] . 'px';
}
if ($Validation->isColor($attribute['border_right_color'])) {
$style[0]['border-right-color'] = PBColor::getColor($attribute['border_right_color']);
}
if ($Validation->isNumber($attribute['border_bottom_width'], 0, 9999)) {
$style[0]['border-bottom-width'] = $attribute['border_bottom_width'] . 'px';
}
if ($Validation->isColor($attribute['border_bottom_color'])) {
$style[0]['border-bottom-color'] = PBColor::getColor($attribute['border_bottom_color']);
}
if ($Validation->isNumber($attribute['border_left_width'], 0, 9999)) {
$style[0]['border-left-width'] = $attribute['border_left_width'] . 'px';
}
if ($Validation->isColor($attribute['border_left_color'])) {
$style[0]['border-left-color'] = PBColor::getColor($attribute['border_left_color']);
}
if ($Validation->isNumber($attribute['padding_top'], 0, 9999)) {
$style[0]['padding-top'] = $attribute['padding_top'] . 'px';
}
if ($Validation->isNumber($attribute['padding_right'], 0, 9999)) {
$style[0]['padding-right'] = $attribute['padding_right'] . 'px';
}
if ($Validation->isNumber($attribute['padding_bottom'], 0, 9999)) {
$style[0]['padding-bottom'] = $attribute['padding_bottom'] . 'px';
}
if ($Validation->isNumber($attribute['padding_left'], 0, 9999)) {
$style[0]['padding-left'] = $attribute['padding_left'] . 'px';
}
$id = PBHelper::createId('pb_call_to_action');
$html = '
<div' . PBHelper::createClassAttribute($class[0]) . PBHelper::createStyleAttribute($style[0]) . ' id="' . esc_attr($id) . '">
<div' . PBHelper::createClassAttribute($class[1]) . PBHelper::createStyleAttribute($style[1]) . '>
' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '
</div>
</div>
<div class="pb-script-tag">
<script type="text/javascript">
jQuery(document).ready(function($)
{
$("#' . $id . '").PBCallToAction();
});
</script>
</div>
';
return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false));
}
示例14: processColumn
function processColumn($column, $layout)
{
$Layout = new PBLayout();
$html = null;
$columnCount = $Layout->getLayoutColumnCount($layout);
for ($i = 0; $i < $columnCount; $i++) {
$value = array();
$value['text'] = $this->processComponent($column[$i]['component']);
$data = array('data' => array('id' => PBHelper::createId('pb_column'), 'componentId' => 'layout_column'), 'value' => $value);
$html .= $this->buildShortcode($data);
}
return $html;
}
示例15: processShortcodeRecentPost
//.........这里部分代码省略.........
global $post;
$bPost = $post;
while ($data->have_posts()) {
$data->the_post();
$class = array('pb-layout-' . $Layout->getLayoutColumnCSSClass($attribute['layout'], $i));
$meta = array('date' => null, 'comment_count' => null, 'image' => null, 'header' => null, 'excerpt' => null, 'meta' => null);
if ($attribute['date_enable']) {
$meta['date'] = '<div class="pb-recent-post-date">' . get_the_date() . '</div>';
}
if ($attribute['image_enable']) {
if (has_post_thumbnail()) {
$commentCountHTML = null;
if ($attribute['template'] == 1) {
if ($attribute['comment_count_enable'] == 1 && comments_open(get_the_id())) {
$commentCount = wp_count_comments(get_the_id());
$commentCountHTML = '<div class="pb-recent-post-comment-count"><span class="pb-recent-post-comment-count-value">' . $commentCount->approved . '</span><span class="pb-recent-post-comment-count-arrow"></span></div>';
}
}
$classImage = array(array('pb-recent-post-image', 'pb-image-box'), array('pb-image'));
if ($attribute['preloader_enable'] == 1) {
array_push($classImage[0], 'pb-image-preloader', 'pb-image-preloader-animation-enable');
}
if ($attribute['hover_enable'] == 1) {
array_push($classImage[0], 'pb-image-hover', 'pb-image-hover-type-' . $attribute['hover_type']);
}
if ($attribute['hover_enable'] == 1) {
$meta['image'] = '<a href="' . get_permalink(get_the_ID()) . '"' . PBHelper::createClassAttribute($classImage[1]) . '>' . get_the_post_thumbnail(get_the_ID(), $attribute['image_size']) . '<span><span><span></span></span></span></a>';
} else {
$meta['image'] = '<div' . PBHelper::createClassAttribute($classImage[1]) . '>' . get_the_post_thumbnail(get_the_ID(), $attribute['image_size']) . '</div>';
}
$meta['image'] = '<div' . PBHelper::createClassAttribute($classImage[0]) . '>' . $meta['image'] . $commentCountHTML . '</div>';
}
}
if ($attribute['header_enable']) {
$meta['header'] = '<h' . PBComponentData::get($this->getComponentId(), 'header_important_default') . ' class="pb-recent-post-header"><a href="' . get_permalink(get_the_ID()) . '">' . get_the_title() . '</a></h' . PBComponentData::get($this->getComponentId(), 'header_important_default') . '>';
}
if ($attribute['excerpt_enable']) {
$meta['excerpt'] = '<div class="pb-recent-post-excerpt">' . get_the_excerpt() . '</div>';
}
if ($attribute['author_enable'] || $attribute['category_enable'] || $attribute['template'] == 2 && $attribute['comment_count_enable'] == 1 && comments_open(get_the_id())) {
$authorHTML = null;
$categoryHTML = null;
$commentCountHTML = null;
if ($attribute['author_enable']) {
$authorHTML = '<div class="pb-recent-post-meta-author">' . get_the_author() . '</div>';
}
$category = get_the_category(get_the_ID());
$count = count($category);
if ($count) {
foreach ($category as $index => $value) {
$separator = $index == $count - 1 ? '' : ', ';
$title = $Validation->isEmpty($value->description) ? sprintf(__('View all posts filed under %s', PLUGIN_PAGE_BUILDER_DOMAIN), $value->name) : strip_tags(apply_filters('category_description', $value->description, $value));
$categoryHTML .= '<li><a href="' . get_category_link($value->term_id) . '" title="' . esc_attr($title) . '">' . esc_html($value->name) . '</a>' . $separator . '</li>';
}
$categoryHTML = '<div class="pb-recent-post-meta-category"><ul class="pb-reset-list">' . $categoryHTML . '</ul></div>';
}
if ($attribute['template'] == 2) {
if ($attribute['comment_count_enable'] == 1 && comments_open(get_the_id())) {
$commentCount = wp_count_comments(get_the_id());
$commentCountHTML = '<div class="pb-recent-post-meta-comment-count">' . __(sprintf('%d Comments', $commentCount->approved), PLUGIN_PAGE_BUILDER_DOMAIN) . '</div>';
}
}
$meta['meta'] = '<div class="pb-recent-post-meta pb-clear-fix">' . $authorHTML . $categoryHTML . $commentCountHTML . '</div>';
}
$templateHTML = array();
$templateOrder = array('date', 'image', 'header', 'excerpt', 'meta');
if ($attribute['template'] == 2) {
$templateOrder = array('image', 'header', 'date', 'excerpt', 'meta');
}
foreach ($templateOrder as $value) {
if (isset($meta[$value])) {
$templateHTML[$value] = $meta[$value];
}
}
$html .= '<li' . PBHelper::createClassAttribute($class) . '><div>' . implode($templateHTML) . '</div></li>';
$i++;
}
wp_reset_query();
$post = $bPost;
$id = PBHelper::createId('pb_recent_post');
$class = array();
$class[0] = array('pb-recent-post', 'pb-recent-post-template-' . $attribute['template'], $attribute['css_class']);
$class[1] = array('pb-clear-fix', 'pb-reset-list', $Layout->getLayoutCSSClass($attribute['layout']));
$html = '
<div' . PBHelper::createClassAttribute($class[0]) . ' id="' . $id . '">
<ul' . PBHelper::createClassAttribute($class[1]) . '>
' . $html . '
</ul>
</div>
<div class="pb-script-tag">
<script type="text/javascript">
jQuery(document).ready(function($)
{
$("#' . $id . '").PBRecentPost(' . json_encode($option) . ');
});
</script>
</div>
';
return PBHelper::formatHTML($html);
}