当前位置: 首页>>代码示例>>PHP>>正文


PHP ThemeHelper::createClassAttribute方法代码示例

本文整理汇总了PHP中ThemeHelper::createClassAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP ThemeHelper::createClassAttribute方法的具体用法?PHP ThemeHelper::createClassAttribute怎么用?PHP ThemeHelper::createClassAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ThemeHelper的用法示例。


在下文中一共展示了ThemeHelper::createClassAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: start_el

    function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
    {
        $this->iconClass = null;
        if ($depth == 0) {
            $this->icon = $object->icon;
            $this->mega_menu_layout_column_index = 0;
            $this->mega_menu_enable = $object->mega_menu_enable;
            $this->mega_menu_layout = $object->mega_menu_layout;
            if ($object->icon != '-1') {
                $this->iconClass = 'pb-menu-icon pb-menu-icon-' . ThemeHelper::createHash($object->icon);
            }
        }
        if ($this->mega_menu_enable == 1) {
            if ($depth == 0 || $depth == 2) {
                $output .= '<li class="' . join(' ', (array) $object->classes) . ($depth == 0 ? ' sf-mega-enable-1' : null) . ' ' . $this->iconClass . ' ' . '">';
            }
            if ($depth == 1) {
                $Layout = new ThemeLayout();
                $class = array('sf-mega-section', $Layout->getLayoutColumnCSSClass($this->mega_menu_layout, $this->mega_menu_layout_column_index, 'theme-layout-column-'));
                $output .= '
					<div' . ThemeHelper::createClassAttribute($class) . '>
				';
                $this->mega_menu_layout_column_index++;
            }
            if ($depth == 1) {
                $output .= '
					<span class="sf-mega-header">' . esc_html($object->title) . '</span>
				';
            } else {
                $output .= '
					<a href="' . esc_attr($object->url) . '"><span></span>' . $object->title . '</a>
				';
            }
        } else {
            $output .= '
				<li class="' . join(' ', (array) $object->classes) . ($depth == 0 ? ' sf-mega-enable-0' : null) . ' ' . $this->iconClass . ' ' . '">
					<a href="' . esc_attr($object->url) . '"><span></span>' . $object->title . '</a>
			';
        }
    }
开发者ID:phanhoanglong2610,项目名称:anc_gvn,代码行数:40,代码来源:Theme.MenuWalker.class.php

示例2: create

    function create()
    {
        global $fable_parentPost;
        $attribute = array();
        $attribute['menu_id'] = 0;
        $menu = wp_get_nav_menus();
        $menuLocation = get_nav_menu_locations();
        $locationId = 'menu_top';
        $Validation = new ThemeValidation();
        if (isset($menuLocation[$locationId])) {
            foreach ($menu as $m) {
                if ($m->term_id == $menuLocation[$locationId]) {
                    $attribute['menu_id'] = $m->term_id;
                }
            }
        }
        if ($attribute['menu_id'] == 0) {
            if (ThemeOption::getGlobalOption($fable_parentPost->post, 'menu_top') == 0) {
                return;
            }
        }
        if ($attribute['menu_id'] == 0) {
            $attribute['menu_id'] = ThemeOption::getGlobalOption($fable_parentPost->post, 'menu_top');
        }
        $attribute['logo_src'] = ThemeOption::getOption('menu_logo_src');
        $attribute['responsive_mode'] = ThemeOption::getOption('menu_responsive_mode');
        $attribute['sticky_enable'] = ThemeOption::getOption('menu_sticky_enable');
        $attribute['hide_scroll_enable'] = ThemeOption::getOption('menu_hide_scroll_enable');
        $attribute['menu_animation_enable'] = ThemeOption::getOption('menu_animation_enable');
        $attribute['menu_animation_speed_open'] = ThemeOption::getOption('menu_animation_speed_open');
        $attribute['menu_animation_speed_close'] = ThemeOption::getOption('menu_animation_speed_close');
        $attribute['menu_animation_delay'] = ThemeOption::getOption('menu_animation_delay');
        $attribute['scroll_animation_enable'] = ThemeOption::getOption('menu_scroll_animation_enable');
        $attribute['scroll_animation_speed'] = ThemeOption::getOption('menu_scroll_animation_speed');
        $attribute['scroll_animation_easing'] = ThemeOption::getOption('menu_scroll_animation_easing');
        $attribute['css_class'] = 'pb';
        if (!class_exists('PBComponentMenu')) {
            $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'] = ThemeHelper::createId('pb_menu_responsive');
            $option['responsive_menu_label'] = __('Menu');
            $id = ThemeHelper::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 ThemeMenuWalker(), '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 ThemeMenuResponsiveWalker(), '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' . ThemeHelper::createClassAttribute($class) . ' id="' . $id . '">
					<div class="pb-main pb-clear-fix">
						<div' . ThemeHelper::createClassAttribute($classLogo) . '>
							' . $logoHTML . '
						</div>
						<div' . ThemeHelper::createClassAttribute($classMenu) . '>
							' . wp_nav_menu($menuAttribute) . '
						</div>
						<div' . ThemeHelper::createClassAttribute($classMenuResponsive) . '>
							' . wp_nav_menu($menuResponsiveAttribute) . '
						</div>	
					</div>
				</div>
				<div class="pb-script-tag">
					<script type="text/javascript">
						jQuery(document).ready(function($)
						{
							$(\'#' . $id . '\').menu(' . json_encode($option) . ');
						});
					</script>
				</div>
			';
            return $html;
        } else {
            $attributeString = null;
            foreach ($attribute as $index => $value) {
                $attributeString .= ' ' . $index . '="' . $value . '"';
            }
            $shortcode = '[' . PLUGIN_PAGE_BUILDER_SHORTCODE_PREFIX . 'menu' . $attributeString . ']';
            echo do_shortcode($shortcode);
        }
    }
开发者ID:slavai,项目名称:sadick,代码行数:93,代码来源:Theme.Menu.class.php


注:本文中的ThemeHelper::createClassAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。