コード例 #1
0
    function createPagination($query)
    {
        global $wp_rewrite;
        $total = $query->max_num_pages;
        $current = max(1, ThemeHelper::getPageNumber());
        $Validation = new ThemeValidation();
        $pagination = array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'current' => $current, 'total' => $total, 'next_text' => __(' >', THEME_CONTEXT), 'prev_text' => __('< ', THEME_CONTEXT));
        if ($wp_rewrite->using_permalinks()) {
            $pagination['base'] = user_trailingslashit(trailingslashit(remove_query_arg('s', get_pagenum_link(1))) . 'page/%#%/', 'paged');
        }
        if (is_search()) {
            $pagination['add_args'] = array('s' => urlencode(get_query_var('s')));
        }
        $html = paginate_links($pagination);
        if ($Validation->isNotEmpty($html)) {
            $html = '
				<div class="theme-blog-pagination-box">
					<div class="theme-blog-pagination">
						' . $html . '
					</div>
				</div>
			';
        }
        return $html;
    }
コード例 #2
0
 function setToStyle(&$style)
 {
     $Validation = new ThemeValidation();
     $download = array();
     $selector = array('base', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6');
     $dictionary = $this->unpack();
     foreach ($selector as $value) {
         $name = ThemeOption::getOption('font_' . $value . '_family_google');
         if ($Validation->isNotEmpty($name) && !in_array($name, $download)) {
             if (!isset($dictionary[$name])) {
                 continue;
             }
             $subset = join(',', (array) $dictionary[$name]['subset']);
             $variant = join(',', (array) $dictionary[$name]['variant']);
             $download[] = $name;
             $style['google-font-' . preg_replace('/ /', '-', strtolower($name))] = array('use' => 2, 'inc' => true, 'path' => null, 'file' => '//fonts.googleapis.com/css?family=' . urlencode($name) . ':' . $variant . '&subset=' . $subset, 'dependencies' => array());
         }
     }
 }
コード例 #3
0
 function widget($argument, $instance)
 {
     $data = array();
     $Validation = new ThemeValidation();
     if (is_array($argument['_data'])) {
         foreach ($argument['_data'] as $index => $value) {
             $data[$index] = $value;
         }
     }
     $title = apply_filters('widget_title', $instance['title']);
     $data['html']['start'] = $argument['before_widget'];
     if ($Validation->isNotEmpty($title)) {
         $data['html']['start'] .= $argument['before_title'] . $title . $argument['after_title'];
     }
     $data['html']['stop'] = $argument['after_widget'];
     $data['instance'] = $instance;
     $Template = new ThemeTemplate($data, THEME_PATH_TEMPLATE . $argument['_data']['file']);
     echo apply_filters('widget_text', $Template->output(true));
 }
コード例 #4
0
ファイル: footer.php プロジェクト: phanhoanglong2610/anc_gvn
$template = $Page->getCurrentTemplate();
$widgetAreaFooterEnable = false;
if (ThemeOption::getOption('footer_top_enable') == 1) {
    $widgetAreaData = $WidgetArea->getWidgetAreaByPost($fable_parentPost->post, false, true);
    $layout = $WidgetArea->setWidgetAreaLayout($widgetAreaData['id']);
    if ($widgetAreaData['id'] && $widgetAreaData['location']) {
        $widgetAreaFooterEnable = true;
    }
}
if (ThemeOption::getOption('footer_enable') == 1 && ($widgetAreaFooterEnable || ThemeOption::getGlobalOption($post, 'footer_bottom_enable') == 1)) {
    ?>
				<div class="theme-footer theme-clear-fix">
<?php 
    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);
        ?>
>
コード例 #5
0
ファイル: blog-content.php プロジェクト: slavai/sadick
>
						<div class="theme-post-date"><?php 
        echo $month . ' ' . $day . ', ' . $year;
        ?>
</div>
					</div>
<?php 
        switch ($option['post_type']) {
            case 'audio':
            case 'video':
            case 'image_slider':
                if ($option['post_type'] == 'image_slider') {
                    $option['post_type_preambule'] = preg_replace('/\\[pb_nivo_slider/', '[pb_nivo_slider url="' . get_permalink() . '" ', $option['post_type_preambule']);
                }
                $preambule = do_shortcode($option['post_type_preambule']);
                if ($Validation->isNotEmpty($preambule)) {
                    ?>
					<div class="theme-post-section-icon">
						<div class="theme-post-icon"></div>
					</div>
					
					<div class="theme-post-section-preambule">
						<?php 
                    echo $preambule;
                    ?>
					</div>
<?php 
                }
                break;
            default:
                if (has_post_thumbnail()) {
コード例 #6
0
        echo sprintf(__('All comments (%s)', THEME_DOMAIN), $count);
        ?>
</span>
		</h5>

		<div id="comments_list" class="theme-clear-fix">

			<ul class="theme-reset-list theme-clear-fix">
<?php 
        $Comment = new ThemeComment();
        $Validation = new ThemeValidation();
        wp_list_comments(array('avatar_size' => 70, 'page' => $Comment->page, 'per_page' => $Comment->comments_per_page, 'callback' => array($Comment, 'createComment')));
        $pagination = paginate_comments_links(array('base' => '#cpage-%#%', 'format' => '', 'add_fragment' => '', 'current' => $Comment->page, 'next_text' => __('Next', THEME_DOMAIN), 'prev_text' => __('Previous', THEME_DOMAIN), 'echo' => false));
        ?>
			</ul>
<?php 
        if ($Validation->isNotEmpty($pagination)) {
            ?>
			<div class="theme-comment-pagination-box"> 
				<div class="theme-comment-pagination theme-clear-fix"><?php 
            echo $pagination;
            ?>
</div>
			</div>
<?php 
        }
        ?>
		</div>
<?php 
    }
}
コード例 #7
0
    function createPostNavigation()
    {
        $html = null;
        $Validation = new ThemeValidation();
        $prevPost = get_previous_post();
        if (!empty($prevPost)) {
            $html .= '<a class="theme-post-navigation-prev" href="' . get_permalink($prevPost->ID) . '" title="' . sprintf(esc_attr('View post "%s"', THEME_DOMAIN), get_the_title($prevPost->ID)) . '">' . get_the_post_thumbnail($prevPost->ID) . '<span class="theme-post-navigation-arrow"></span><span class="theme-post-navigation-content">' . get_the_title($prevPost->ID) . '</span></a>';
        }
        // $prevPost2=get_previous_post(false, '', true, 'category', $prevPost);
        // if(!empty($prevPost2)) $html.='<a class="theme-post-navigation-prev" href="'.get_permalink($prevPost2->ID).'" title="'.sprintf(esc_attr('View post "%s"',THEME_DOMAIN),get_the_title($prevPost2->ID)).'">'.get_the_post_thumbnail($prevPost2->ID).'<span class="theme-post-navigation-arrow"></span><span class="theme-post-navigation-content">'.get_the_title($prevPost2->ID).'</span></a>';
        $nextPost = get_next_post();
        if (!empty($nextPost)) {
            $html .= '<a class="theme-post-navigation-next" href="' . get_permalink($nextPost->ID) . '" title="' . sprintf(esc_attr('View post "%s"', THEME_DOMAIN), get_the_title($nextPost->ID)) . '">' . get_the_post_thumbnail($nextPost->ID) . '<span class="theme-post-navigation-content">' . get_the_title($nextPost->ID) . '</span><span class="theme-post-navigation-arrow"></span></a>';
        }
        // $nextPost2=get_next_post(false, '', false, 'category', $nextPost);
        // if(!empty($nextPost2)) $html.='<a class="theme-post-navigation-next" href="'.get_permalink($nextPost2->ID).'" title="'.sprintf(esc_attr('View post "%s"',THEME_DOMAIN),get_the_title($nextPost2->ID)).'">'.get_the_post_thumbnail($nextPost2->ID).'<span class="theme-post-navigation-content">'.get_the_title($nextPost2->ID).'</span><span class="theme-post-navigation-arrow"></span></a>';
        if ($Validation->isNotEmpty($html)) {
            $html = '
				<div class="theme-post-navigation theme-clear-fix">
					' . $html . '
				</div>				
			';
        }
        return $html;
    }
コード例 #8
0
    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;
    }
コード例 #9
0
ファイル: header.php プロジェクト: phanhoanglong2610/anc_gvn
if (ThemeOption::getOption('responsive_mode_enable') == 1) {
    ?>
				<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<?php 
}
?>
				<link rel="pingback" href="<?php 
bloginfo('pingback_url');
?>
" />
				<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php 
bloginfo('rss2_url');
?>
" />
<?php 
if ($Validation->isNotEmpty(ThemeOption::getOption('favicon_url'))) {
    ?>
				<link rel="shortcut icon" href="<?php 
    echo ThemeHelper::esc_attr(ThemeOption::getOption('favicon_url'));
    ?>
" />
<?php 
}
wp_head();
?>
			</head>

			<body <?php 
body_class($Theme->getFooterStickyClass());
?>
>
コード例 #10
0
post_class('theme-clear-fix theme-post theme-post-type-' . (is_sticky() ? 'sticky' : $option['post_type']));
?>
 id="post-<?php 
the_ID();
?>
">
<?php 
switch ($option['post_type']) {
    case 'audio':
    case 'video':
    case 'image_slider':
        if ($option['post_type'] == 'image_slider') {
            $option['post_type_preambule'] = preg_replace('/\\[pb_nivo_slider/', '[pb_nivo_slider url="' . get_permalink() . '" ', $option['post_type_preambule']);
        }
        $preambule = do_shortcode($option['post_type_preambule']);
        if ($Validation->isNotEmpty($preambule)) {
            ?>
			<div class="theme-post-section-icon">
				<div class="theme-post-icon"></div>
			</div>
					
			<div class="theme-post-section-preambule">
				<?php 
            echo $preambule;
            ?>
			</div>
<?php 
        }
        break;
    default:
        if (has_post_thumbnail()) {
コード例 #11
0
 function validateProperty($property)
 {
     $data = array();
     $Validation = new ThemeValidation();
     foreach ($property as $name => $value) {
         $unit = 'px';
         if (is_array($value)) {
             if (isset($value['unit'])) {
                 $unit = $value['unit'];
             }
             if (isset($value['value'])) {
                 $value = $value['value'];
             }
         }
         switch ($name) {
             case 'left':
             case 'width':
             case 'height':
             case 'font-size':
             case 'padding-top':
             case 'padding-left':
             case 'padding-right':
             case 'padding-bottom':
             case 'border-width':
                 if ($Validation->isNumber($value, 0, 9999)) {
                     $data[$name] = $value . $unit;
                 }
                 break;
             case 'top':
             case 'margin-top':
             case 'margin-left':
             case 'margin-right':
             case 'margin-bottom':
                 if ($Validation->isNumber($value, -9999, 9999)) {
                     $data[$name] = $value . $unit;
                 }
                 break;
             case 'color':
             case 'border-color':
             case 'border-top-color':
             case 'border-right-color':
             case 'border-bottom-color':
             case 'border-left-color':
             case 'outline-color':
             case 'background-color':
                 $value = ThemeColor::getColor($value);
                 if ($Validation->isNotEmpty($value)) {
                     $data[$name] = $value;
                 }
                 break;
             case 'font-family':
                 foreach ((array) $value as $family) {
                     if ($Validation->isNotEmpty($family)) {
                         ThemeHelper::removeUIndex($data, $name);
                         if ($Validation->isNotEmpty($data[$name])) {
                             $data[$name] .= ',';
                         }
                         $data[$name] .= '\'' . $family . '\'';
                     }
                 }
                 break;
             case 'font-style':
                 if (isset($this->fontStyle[$value])) {
                     $data[$name] = $value;
                 }
                 break;
             case 'font-weight':
                 if (isset($this->fontWeight[$value])) {
                     $data[$name] = $value;
                 }
                 break;
             case 'display':
             case 'border-style':
             case 'line-height':
             case 'background':
             case 'background-repeat':
             case 'background-position':
                 if ($Validation->isNotEmpty($value)) {
                     $data[$name] = $value;
                 }
                 break;
             case 'background-image':
                 if ($Validation->isNotEmpty($value)) {
                     $data[$name] = 'url(\'' . $value . '\',THEME_CONTEXT)';
                 }
                 break;
         }
     }
     return $data;
 }
コード例 #12
0
ファイル: Theme.class.php プロジェクト: slavai/sadick
    function createCSSFile()
    {
        if ($this->createMultisitePath() === false) {
            return;
        }
        $content = null;
        $CSS = new ThemeCSS();
        $Validation = new ThemeValidation();
        $ResponsiveMode = new ThemeResponsiveMode($this->responsiveMode);
        ThemeOption::refreshOption();
        $media = $ResponsiveMode->getMedia();
        if (ThemeOption::getOption('responsive_mode_enable') != 1) {
            $media = $media[1];
        }
        $selector = array('base' => array('a', 'body', 'input', 'select', 'textarea', '.theme-page .gform_wrapper select', '.theme-page .gform_wrapper textarea', '.theme-page .gform_wrapper input[type="tel"]', '.theme-page .gform_wrapper input[type="url"]', '.theme-page .gform_wrapper input[type="text"]', '.theme-page .gform_wrapper input[type="email"]', '.theme-page .gform_wrapper input[type="number"]', '.theme-page .gform_wrapper input[type="password"]'), 'h1' => array('h1', 'h1 a'), 'h2' => array('h2', 'h2 a', '.pb-counter-box ul>li>div>div.pb-counter-box-text-counter', '.pb-pricing-plan>ul>li>div .pb-pricing-plan-item-price-box .pb-pricing-plan-item-price-box-value'), 'h3' => array('h3', 'h3 a', '.pb-testimonial ul.pb-layout-100>li>div>p', '.pb-twitter-user-timeline .pb-twitter-user-timeline-text', '.pb-twitter-user-timeline .pb-twitter-user-timeline-text a'), 'h4' => array('h4', 'h4 a'), 'h5' => array('h5', 'h5 a', 'h3.comment-reply-title', '.pb-zaccordion .pb-zaccordion-caption-box .pb-zaccordion-caption-box-title'), 'h6' => array('h6', 'h6 a', '.pb-testimonial ul.pb-layout-50x50>li>div>p', '.pb-testimonial ul.pb-layout-33x33x33>li>div>p', '.pb-testimonial ul.pb-layout-25x25x25x25>li>div>p', 'div.pb-counter-list>ul>li>span.pb-counter-list-label', 'div.pb-counter-list>ul>li>span.pb-counter-list-value', '.pb-blockquote blockquote', '.pb-blockquote blockquote p'));
        foreach ($selector as $index => $value) {
            $content .= $CSS->create(array('selector' => $value, 'property' => array('font-family' => array(ThemeOption::getOption('font_' . $index . '_family_google'), ThemeOption::getOption('font_' . $index . '_family_system')), 'font-size' => ThemeOption::getOption('font_' . $index . '_size'), 'font-style' => ThemeOption::getOption('font_' . $index . '_style'), 'font-weight' => ThemeOption::getOption('font_' . $index . '_weight'), 'line-height' => ThemeOption::getOption('font_' . $index . '_line_height'))));
        }
        $content .= $CSS->create(array('selector' => array('.pb-header-subheader .pb-subheader span'), 'property' => array('font-family' => array(ThemeOption::getOption('font_base_family_google'), ThemeOption::getOption('font_base_family_system')))));
        if (count($media)) {
            foreach ($media as $mediaIndex => $mediaValue) {
                foreach ($selector as $selectorIndex => $selectorValue) {
                    $content .= $CSS->create(array('media' => $mediaValue, 'selector' => $selectorValue, 'property' => array('font-size' => ThemeOption::getOption('font_' . $selectorIndex . '_size_' . $mediaIndex))));
                }
            }
        } else {
            foreach ($selector as $selectorIndex => $selectorValue) {
                $content .= $CSS->create(array('selector' => $selectorValue, 'property' => array('font-size' => ThemeOption::getOption('font_' . $selectorIndex . '_size_1'))));
            }
        }
        if (ThemeOption::getOption('responsive_mode_enable') == 1) {
            $maxWidth = ThemeOption::getOption('menu_responsive_level') - 1;
            $content .= $CSS->create(array('media' => array('min-width' => 0, 'max-width' => $maxWidth), 'selector' => array('ul.sf-menu'), 'property' => array('display' => 'none')));
            $content .= $CSS->create(array('media' => array('min-width' => 0, 'max-width' => $maxWidth), 'selector' => array('select.dp-menu'), 'property' => array('display' => 'block')));
        }
        foreach ($media as $index => $value) {
            if ($Validation->isNotEmpty(ThemeOption::getOption('custom_css_responsive_' . $index))) {
                if (array_key_exists('min-width', $value) && array_key_exists('max-width', $value)) {
                    $content .= '
					@media only screen  and (min-width:' . $value['min-width'] . 'px) and (max-width:' . $value['max-width'] . 'px)
					{
					' . ThemeOption::getOption('custom_css_responsive_' . $index) . '
					}
					';
                } else {
                    $content .= ThemeOption::getOption('custom_css_responsive_' . $index);
                }
            }
        }
        $file = THEME_PATH_MULTISITE_SITE_STYLE . 'style.css';
        @chmod($file, 0755);
        if (file_put_contents($file, $content) === false) {
            return false;
        }
        return true;
    }
コード例 #13
0
    function createPostNavigation()
    {
        $html = null;
        $Validation = new ThemeValidation();
        $prevPost = get_previous_post();
        if (!empty($prevPost)) {
            $html .= '<a class="theme-post-navigation-prev" href="' . get_permalink($prevPost->ID) . '"><span class="theme-post-navigation-arrow"></span><span class="theme-post-navigation-content">' . get_the_title($prevPost->ID) . '</span></a>';
        }
        $nextPost = get_next_post();
        if (!empty($nextPost)) {
            $html .= '<a class="theme-post-navigation-next" href="' . get_permalink($nextPost->ID) . '"><span class="theme-post-navigation-content">' . get_the_title($nextPost->ID) . '</span><span class="theme-post-navigation-arrow"></span></a>';
        }
        if ($Validation->isNotEmpty($html)) {
            $html = '
				<div class="theme-post-navigation theme-clear-fix">
					' . $html . '
				</div>				
			';
        }
        return $html;
    }