本文整理汇总了PHP中PBHelper::formatCode方法的典型用法代码示例。如果您正苦于以下问题:PHP PBHelper::formatCode方法的具体用法?PHP PBHelper::formatCode怎么用?PHP PBHelper::formatCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PBHelper
的用法示例。
在下文中一共展示了PBHelper::formatCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: output
function output($format = false)
{
ob_start();
include $this->path;
$value = ob_get_clean();
if ($format) {
$value = PBHelper::formatCode($value);
}
return $value;
}
示例3: 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);
}