Example #1
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 adminCreateMetaBoxPost()
 {
     global $post;
     $data = array();
     $data['option'] = ThemeOption::getPostMeta($post);
     $data['dictionary']['postType'] = $this->postType;
     $this->setPostMetaDefault($data['option']);
     $Template = new ThemeTemplate($data, THEME_PATH_TEMPLATE . 'admin/meta_box_post.php');
     echo $Template->output();
 }
 function adminCreateMetaBoxPost()
 {
     global $post;
     $data = array();
     $data['option'] = ThemeOption::getPostMeta($post);
     $data['dictionary']['postType'] = $this->postType;
     ThemeHelper::setDefaultOption($data['option'], 'post_type', 'image');
     ThemeHelper::setDefaultOption($data['option'], 'post_type_preambule', '');
     ThemeHelper::setDefaultOption($data['option'], 'post_tag_visible', -1);
     ThemeHelper::setDefaultOption($data['option'], 'post_author_visible', -1);
     ThemeHelper::setDefaultOption($data['option'], 'post_category_visible', -1);
     ThemeHelper::setDefaultOption($data['option'], 'post_comment_count_visible', -1);
     ThemeHelper::setDefaultOption($data['option'], 'post_navigation_visible', -1);
     $Template = new ThemeTemplate($data, THEME_PATH_TEMPLATE . 'admin/meta_box_post.php');
     echo $Template->output();
 }
Example #4
0
$Post = new ThemePost();
$Validation = new ThemeValidation();
$WidgetArea = new ThemeWidgetArea();
$widgetAreaData = $WidgetArea->getWidgetAreaByPost($fable_parentPost->post, true, true);
$query = $Blog->getPost();
$postCount = count($query->posts);
if ($postCount) {
    ?>
		<div class="theme-clear-fix">
			
			<ul class="theme-reset-list theme-clear-fix theme-blog">
<?php 
    while ($query->have_posts()) {
        $query->the_post();
        $excerpt = apply_filters('the_content', get_the_excerpt());
        $option = ThemeOption::getPostMeta($post);
        ThemeHelper::removeUIndex($option, 'post_type');
        $visibleOption = array();
        $visibleOption['post_tag_visible'] = ThemeOption::getGlobalOption($post, 'post_tag_visible');
        $visibleOption['post_author_visible'] = ThemeOption::getGlobalOption($post, 'post_author_visible');
        $visibleOption['post_category_visible'] = ThemeOption::getGlobalOption($post, 'post_category_visible');
        $visibleOption['post_comment_count_visible'] = ThemeOption::getGlobalOption($post, 'post_comment_count_visible') && comments_open(get_the_id());
        ?>
				<li id="post-<?php 
        the_ID();
        ?>
" <?php 
        post_class('theme-clear-fix theme-post theme-post-type-' . (is_sticky() ? 'sticky' : $option['post_type']));
        ?>
>
<?php 
 function setWidgetAreaLayout($postId)
 {
     $Layout = new ThemeLayout();
     $option = ThemeOption::getPostMeta($postId);
     ThemeHelper::removeUIndex($option, 'widget_area_footer_layout');
     $this->widgetAreaLayout = $option['widget_area_footer_layout'];
     return $Layout->getLayoutCSSClass($this->widgetAreaLayout);
 }
    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;
    }
Example #7
0
ob_start();
?>
<!DOCTYPE html>
<?php 
global $post, $fable_parentPost;
$Theme = new Theme();
$Post = new ThemePost();
$Page = new ThemePage();
$Menu = new ThemeMenu();
$Validation = new ThemeValidation();
if (($fable_parentPost = $Post->getPost()) === false) {
    $fable_parentPost = new stdClass();
    $fable_parentPost->post = $post;
}
$meta = ThemeOption::getPostMeta($post);
ThemeHelper::removeUIndex($meta, 'page_background_color');
?>
		<html xmlns="http://www.w3.org/1999/xhtml" <?php 
language_attributes();
?>
>

			<head>
				<title><?php 
wp_title('|');
?>
</title> 
				<meta http-equiv="Content-Type" content="<?php 
bloginfo('html_type');
?>
Example #8
0
 function setWidgetAreaLayout($postId)
 {
     $Layout = new ThemeLayout();
     $option = ThemeOption::getPostMeta($postId);
     $this->widgetNumber = 0;
     $this->widgetAreaLayout = $option['widget_area_footer_layout'];
     add_filter('dynamic_sidebar_params', array($this, 'setWidgetLayout'), 10);
     return $Layout->getLayoutCSSClass($this->widgetAreaLayout);
 }
Example #9
0
 function setupTheme()
 {
     global $content_width;
     if (!isset($content_width)) {
         $content_width = 1050;
     }
     /***/
     $Menu = new ThemeMenu();
     $Post = new ThemePost();
     $Page = new ThemePage();
     $Image = new ThemeImage();
     $Comment = new ThemeComment();
     $WidgetArea = new ThemeWidgetArea();
     $MaintenanceMode = new ThemeMaintenanceMode();
     $WidgetPostRecent = new ThemeWidgetPostRecent();
     $WidgetPostMostComment = new ThemeWidgetPostMostComment();
     /***/
     $Image->register();
     $WidgetArea->register();
     /***/
     add_theme_support('menus');
     add_theme_support('post-thumbnails');
     add_theme_support('automatic-feed-links');
     /***/
     if (function_exists('register_nav_menu')) {
         register_nav_menu('menu_top', 'Menu Top');
     }
     /***/
     add_filter('widget_text', 'do_shortcode');
     add_filter('wp_title', array($Page, 'displayTitle'));
     add_filter('image_size_names_choose', array($Image, 'addImageSupport'));
     add_filter('excerpt_more', array($this, 'filterExcerptMore'));
     add_filter('excerpt_length', array($this, 'automaticExcerptLength'), 999);
     /***/
     add_editor_style('editor-style.css');
     /***/
     if (!class_exists('PBComponentMenu')) {
         add_filter('wp_setup_nav_menu_item', array($Menu, 'setupNavigationMenuItemField'));
         add_action('wp_update_nav_menu_item', array($Menu, 'updateNavigationMenuItemField'), 10, 3);
         add_filter('wp_edit_nav_menu_walker', array($Menu, 'editNavigationMenuWalker'), 10, 2);
     }
     /***/
     add_action('save_post', array($this, 'adminSaveMetaBox'));
     add_action('add_meta_boxes', array($Page, 'adminInitMetaBox'));
     add_action('add_meta_boxes', array($Post, 'adminInitMetaBox'));
     add_action('add_meta_boxes', array($this, 'adminInitMetaBox'));
     add_action('init', array($WidgetArea, 'adminInit'));
     add_action('save_post', array($WidgetArea, 'adminSaveMetaBox'));
     add_action('add_meta_boxes', array($WidgetArea, 'adminInitMetaBox'));
     add_filter('manage_edit-' . THEME_CONTEXT . '_widget_area_columns', array($WidgetArea, 'adminManageEditColumn'));
     add_action('manage_' . THEME_CONTEXT . '_widget_area_posts_custom_column', array($WidgetArea, 'adminManageColumn'));
     add_filter('manage_edit-' . THEME_CONTEXT . '_widget_area_sortable_columns', array($WidgetArea, 'adminManageEditSortableColumn'));
     add_action('wp_ajax_comment_add', array($Comment, 'addComment'));
     add_action('wp_ajax_nopriv_comment_add', array($Comment, 'addComment'));
     add_action('wp_ajax_comment_get', array($Comment, 'getComment'));
     add_action('wp_ajax_nopriv_comment_get', array($Comment, 'getComment'));
     add_action('tgmpa_register', array($this, 'addPlugin'));
     add_action('admin_notices', array($this, 'adminNotice'));
     add_action('init', array($MaintenanceMode, 'init'));
     /***/
     $WidgetPostRecent->register();
     $WidgetPostMostComment->register();
     /***/
     load_theme_textdomain(THEME_DOMAIN, THEME_PATH . 'languages/');
     /***/
     $install = (int) Themeoption::getOption('install');
     if ($install == 1) {
         return;
     }
     $data = array();
     $option = $this->themeDefaultOption;
     $Template = new ThemeTemplate($data, THEME_PATH_TEMPLATE . 'footer_bottom_content.php');
     $option['footer_bottom_content'] = $Template->output();
     $ResponsiveMode = new ThemeResponsiveMode($this->responsiveMode);
     $media = $ResponsiveMode->getMedia();
     foreach ($media as $index => $value) {
         $option['custom_css_responsive_' . $index] = '';
     }
     $optionCurrent = ThemeOption::getOptionObject();
     $optionSave = array();
     foreach ($option as $index => $value) {
         if (!array_key_exists($index, $optionCurrent)) {
             $optionSave[$index] = $value;
         }
     }
     $optionSave = array_merge($optionSave, $optionCurrent);
     foreach ($optionSave as $index => $value) {
         if (!array_key_exists($index, $option)) {
             unset($optionSave[$index]);
         }
     }
     $optionSave['install'] = 1;
     ThemeOption::resetOption();
     ThemeOption::updateOption($optionSave);
     $GoogleFont = new ThemeGoogleFont();
     $GoogleFont->download();
     $this->createCSSFile();
     /***/
     $argument = array('post_type' => array('post', 'page'), 'post_status' => 'any', 'posts_per_page' => -1);
     $query = new WP_Query($argument);
     if ($query === false) {
         return;
     }
     foreach ($query->posts as $value) {
         $meta = ThemeOption::getPostMeta($value);
         if (is_array($meta)) {
             continue;
         }
         $meta = array('menu_top' => -1, 'widget_area_sidebar' => -1, 'widget_area_sidebar_location' => -1, 'widget_area_footer' => -1, 'footer_bottom_enable' => -1, 'header_enable' => -1, 'header_background_image_repeat' => -1, 'header_background_image_size_1' => -1);
         if ($value->post_type == 'post') {
             $meta['post_type'] = 'image';
             $meta['post_tag_visible'] = -1;
             $meta['post_author_visible'] = -1;
             $meta['post_category_visible'] = -1;
             $meta['post_comment_count_visible'] = -1;
             $meta['post_navigation_visible'] = -1;
         }
         update_post_meta($value->ID, THEME_OPTION_PREFIX, $meta);
     }
 }