本文整理汇总了PHP中ThemeHelper::createStyleAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP ThemeHelper::createStyleAttribute方法的具体用法?PHP ThemeHelper::createStyleAttribute怎么用?PHP ThemeHelper::createStyleAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThemeHelper
的用法示例。
在下文中一共展示了ThemeHelper::createStyleAttribute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayHeader
function displayHeader($post)
{
$html = null;
if (is_home()) {
return $html;
}
$option = ThemeOption::getPostMeta($post);
$Validation = new ThemeValidation();
if (ThemeOption::getGlobalOption($post, 'header_enable')) {
ThemeHelper::removeUIndex($option, 'header_background_color', 'header_background_image_src', 'header_background_image_position', 'header_background_image_size_1', 'header_background_image_size_2', 'header_text_color', 'header_subheader_text_color', 'header_subheader');
$subheaderHTML = null;
$style = array(array(), array(), array());
if ($Validation->isColor($option['header_background_color'])) {
$style[0]['background-color'] = ThemeColor::getColor($option['header_background_color']);
}
if (!in_array($option['header_background_image_src'], array('-1', 'none'))) {
if ($Validation->isNotEmpty($option['header_background_image_src'])) {
$style[0]['background-image'] = 'url(\'' . $option['header_background_image_src'] . '\')';
} elseif ($Validation->isNotEmpty(ThemeOption::getGlobalOption(null, 'header_background_image_src'))) {
$style[0]['background-image'] = 'url(\'' . ThemeOption::getGlobalOption(null, 'header_background_image_src') . '\')';
}
}
if (array_key_exists('background-image', $style[0])) {
$style[0]['background-repeat'] = ThemeOption::getGlobalOption($post, 'header_background_image_repeat');
if ($Validation->isNotEmpty($option['header_background_image_position'])) {
$style[0]['background-position'] = $option['header_background_image_position'];
} elseif ($Validation->isNotEmpty(ThemeOption::getGlobalOption(null, 'header_background_image_position'))) {
$style[0]['background-position'] = ThemeOption::getGlobalOption(null, 'header_background_image_position');
}
$style[0]['background-size'] = ThemeOption::getGlobalOption($post, 'header_background_image_size_1');
if (in_array($style[0]['background-size'], array('length', 'percentage'))) {
if ($Validation->isNotEmpty($option['header_background_image_size_2'])) {
$style[0]['background-size'] = $option['header_background_image_size_2'];
} elseif ($Validation->isNotEmpty(ThemeOption::getGlobalOption(null, 'header_background_image_size_2'))) {
$style[0]['background-size'] = ThemeOption::getGlobalOption(null, 'header_background_image_size_2');
}
}
}
if ($Validation->isColor($option['header_text_color'])) {
$style[1]['color'] = ThemeColor::getColor($option['header_text_color']);
}
if ($Validation->isColor($option['header_subheader_text_color'])) {
$style[2]['color'] = ThemeColor::getColor($option['header_subheader_text_color']);
}
if ($Validation->isNotEmpty($option['header_subheader'])) {
$subheaderHTML = '<h6' . ThemeHelper::createStyleAttribute($style[2]) . '>' . $option['header_subheader'] . '</h6>';
} elseif ($post->post_type == 'post') {
$Post = new ThemePost();
$Post->formatPostDate($post->post_date, $day, $month, $year);
$subheaderHTML = '<h6' . ThemeHelper::createStyleAttribute($style[2]) . '>' . $month . ' ' . $day . ', ' . $year . '</h6>';
}
$html = '
<div class="theme-page-header" ' . ThemeHelper::createStyleAttribute($style[0]) . '>
<div class="theme-main">
<h1 ' . ThemeHelper::createStyleAttribute($style[1]) . '>' . $post->post_title . '</h1>
' . $subheaderHTML . '
</div>
</div>
';
}
return $html;
}
示例2: array
if ($widgetAreaFooterEnable) {
$style = array();
if ($Validation->isNotEmpty(ThemeOption::getOption('footer_top_background_image_src'))) {
$style['background-image'] = 'url(\'' . ThemeOption::getOption('footer_top_background_image_src') . '\')';
$style['background-repeat'] = ThemeOption::getOption('footer_top_background_image_repeat');
if ($Validation->isNotEmpty(ThemeOption::getOption('footer_top_background_image_position'))) {
$style['background-position'] = ThemeOption::getOption('footer_top_background_image_position');
}
$style['background-size'] = ThemeOption::getOption('footer_top_background_image_size_1');
if (in_array($style['background-size'], array('length', 'percentage'))) {
$style['background-size'] = ThemeOption::getOption('footer_top_background_image_size_2');
}
}
?>
<div class="theme-footer-top theme-clear-fix"<?php
echo ThemeHelper::createStyleAttribute($style);
?>
>
<div class="theme-main <?php
echo $layout;
?>
">
<?php
$WidgetArea->create($widgetAreaData, true);
?>
</div>
</div>
<?php
}
示例3: wp_head
}
wp_head();
?>
</head>
<body <?php
body_class($Theme->getFooterStickyClass());
?>
>
<?php
echo $Menu->create();
?>
<div class="theme-page"<?php
echo ThemeHelper::createStyleAttribute(array('background-color' => ThemeColor::getColor($meta['page_background_color'])));
?>
>
<?php
echo $Page->displayHeader($fable_parentPost->post);
$template = $Page->getCurrentTemplate();
if ($template == 'main.php') {
?>
<div class="theme-page-content theme-clear-fix">
<?php
} else {
$WidgetArea = new ThemeWidgetArea();
$widgetAreaData = $WidgetArea->getWidgetAreaByPost($fable_parentPost->post, true, true);
$class = $WidgetArea->getWidgetAreaCSSClass($widgetAreaData);
?>
<div class="theme-page-content theme-clear-fix theme-main <?php