function getPost()
 {
     $data = new stdClass();
     $categoryId = (int) get_query_var('cat');
     if (is_tag()) {
         $data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
         $tagQuery = get_query_var('tag');
         $tagData = get_tags(array('slug' => $tagQuery));
         $data->post->post_title = esc_html($tagData[0]->name);
     } elseif (is_category($categoryId)) {
         $category = get_category($categoryId);
         $data->post = get_post(ThemeOption::getOption('blog_category_post_id'));
         $data->post->post_title = ThemeHelper::esc_html($category->name);
     } elseif (is_day()) {
         $data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
         $data->post->post_title = get_the_date();
     } elseif (is_archive()) {
         $data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
         $data->post->post_title = single_month_title(' ', false);
     } elseif (is_search()) {
         $data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
         $data->post->post_title = sprintf(__('Search result for phrase <i>%s</i>', THEME_DOMAIN), esc_html(get_query_var('s')));
     } elseif (is_404()) {
         $data->post = get_post(ThemeOption::getOption('page_404_page_id'));
         $data->post->post_title = $data->post->post_title;
     } else {
         return false;
     }
     return $data;
 }
Exemplo n.º 2
0
 function getPost()
 {
     global $fable_parentPost;
     $Validation = new ThemeValidation();
     $argument = array();
     $s = get_query_var('s');
     $tag = get_query_var('tag');
     $year = (int) get_query_var('year');
     $month = (int) get_query_var('monthnum');
     $categoryId = (int) get_query_var('cat');
     if ($Validation->isNotEmpty($s)) {
         $argument['s'] = $s;
     }
     if ($Validation->isNotEmpty($tag)) {
         $argument['tag'] = $tag;
     }
     if ($categoryId > 0) {
         $argument['cat'] = (int) $categoryId;
     } elseif ($year > 0 && $month > 0) {
         $argument['year'] = $year;
         $argument['monthnum'] = $month;
     }
     if (!($categoryId > 0)) {
         $option = ThemeOption::getPostMeta($fable_parentPost->post);
         ThemeHelper::removeUIndex($option, 'page_post_category');
         if (is_array($option['page_post_category'])) {
             if (count($option['page_post_category'])) {
                 $argument['cat'] = implode(',', array_map('intval', $option['page_post_category']));
             }
         }
     }
     $default = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => (int) get_option('posts_per_page'), 'paged' => (int) ThemeHelper::getPageNumber(), 'orderby' => ThemeOption::getOption('blog_sort_field'), 'order' => ThemeOption::getOption('blog_sort_direction'));
     $query = new WP_Query(array_merge($argument, $default));
     return $query;
 }
 function filterWPHead()
 {
     $page = get_post((int) ThemeOption::getOption('maintenance_mode_post_id'));
     if (is_null($page)) {
         return;
     }
     if ($page->ID == get_the_ID()) {
         add_filter('wp_headers', array($this, 'filterWPHeader'));
         add_filter('status_header', array($this, 'filterStatusHeader'), 10, 4);
     } else {
         ob_start();
         wp_redirect(get_permalink($page->ID));
         ob_end_flush();
         exit;
     }
 }
 function getPost()
 {
     $data = new stdClass();
     global $post, $wp_query;
     $categoryId = (int) get_query_var('cat');
     if (function_exists('is_woocommerce') && is_woocommerce()) {
         $data->post = get_post(get_option('woocommerce_shop_page_id'));
         if (is_product()) {
             $data->post = $post;
         } elseif (is_product_category() || is_product_tag()) {
             $data->post->post_title = ThemeHelper::esc_html($wp_query->queried_object->name);
         } elseif (is_search()) {
             $data->post->post_title = sprintf(__('Search products for phrase <i>%s</i>', THEME_DOMAIN), esc_html(get_query_var('s')));
         }
         setup_postdata($data->post);
     } else {
         if (is_tag()) {
             $data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
             $tagQuery = get_query_var('tag');
             $tagData = get_tags(array('slug' => $tagQuery));
             $data->post->post_title = esc_html($tagData[0]->name);
         } elseif (is_author()) {
             $author = get_userdata(get_query_var('author'));
             $data->post = get_post(ThemeOption::getOption('blog_author_post_id'));
             $data->post->post_title = sprintf(__('All posts from %s', THEME_DOMAIN), get_the_author_meta('display_name', $author->data->ID));
         } elseif (is_category($categoryId)) {
             $category = get_category($categoryId);
             $data->post = get_post(ThemeOption::getOption('blog_category_post_id'));
             $data->post->post_title = ThemeHelper::esc_html($category->name);
         } elseif (is_day()) {
             $data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
             $data->post->post_title = get_the_date();
         } elseif (is_archive()) {
             $data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
             $data->post->post_title = single_month_title(' ', false);
         } elseif (is_search()) {
             $data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
             $data->post->post_title = sprintf(__('Kết quả tìm kiếm: <i>%s</i>', THEME_DOMAIN), esc_html(get_query_var('s')));
         } elseif (is_404()) {
             $data->post = get_post(ThemeOption::getOption('page_404_page_id'));
             $data->post->post_title = $data->post->post_title;
         } else {
             return false;
         }
     }
     return $data;
 }
 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());
         }
     }
 }
Exemplo n.º 6
0
				</div>
<?php 
}
if ($Validation->isNotEmpty(ThemeOption::getOption('custom_js_code'))) {
    ?>
				<script type="text/javascript">
					<?php 
    echo ThemeOption::getOption('custom_js_code');
    ?>
				</script>
<?php 
}
if (ThemeOption::getOption('go_to_page_top_enable') == 1) {
    ?>
				<a href="#<?php 
    echo esc_attr(ThemeOption::getOption('go_to_page_top_hash'));
    ?>
" id="theme-go-to-top"></a>

<?php 
}
wp_footer();
?>

<?php 
if ($template != 'main.php') {
    if ($widgetAreaData['location'] == 1) {
        ?>
						</div>
<?php 
    } elseif ($widgetAreaData['location'] == 2) {
    function getCommentContent($commentId = 0)
    {
        $comment = get_comment($commentId);
        $content = strip_tags($comment->comment_content);
        $contentArray = explode(' ', $content);
        if (count($contentArray) > ThemeOption::getOption('comment_automatic_excerpt_length')) {
            $length = ThemeOption::getOption('comment_automatic_excerpt_length');
            $useReadMore = true;
        } else {
            $length = count($contentArray);
            $useReadMore = false;
        }
        $excerpt = '';
        for ($i = 0; $i < $length; $i++) {
            $excerpt .= $contentArray[$i] . ' ';
        }
        if ($useReadMore) {
            $content = '
				<span class="theme-comment-content-excerpt">' . trim($excerpt) . '&nbsp;[&hellip;]&nbsp;</span><a class="theme-comment-content-read-more-link" href="#">' . esc_html__('Read More', THEME_DOMAIN) . '</a><span class="theme-comment-content-content">' . trim($content) . '&nbsp;</span><a class="theme-comment-content-read-less-link" href="#">' . esc_html__('Read Less', THEME_DOMAIN) . '</a>
			';
        } else {
            $content = '<span>' . $content . '</span>';
        }
        return $content;
    }
Exemplo n.º 8
0
<?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());
?>
>
				
				<?php 
echo $Menu->create();
Exemplo n.º 9
0
    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);
        }
    }
Exemplo n.º 10
0
<?php

$id = (int) ThemeOption::getOption('page_404_page_id');
if ($id <= 0) {
    wp_redirect(get_home_url());
} else {
    $url = get_the_permalink($id);
    if ($url === false) {
        wp_redirect(get_home_url());
    } else {
        wp_redirect($url);
    }
}
Exemplo n.º 11
0
 function getFooterStickyClass()
 {
     $mobileDetect = new Mobile_Detect();
     if ($mobileDetect->isMobile()) {
         return null;
     }
     if (ThemeOption::getOption('footer_sticky_enable') == 1) {
         return 'theme-footer-sticky';
     }
     return null;
 }