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; }
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; }
/** * Get the active instance of ThemeOption */ public static function getInstance() { if (!isset(self::$_instance)) { $class = __CLASS__; $helper = new $class(); self::$_instance = $helper->getOneBy(self::KEY_IS_ACTIVE, true); // If the default theme-option post is deleted from WordPress // then just create an instance on the fly which will use the default values in getFields if (!is_object(self::$_instance)) { self::$_instance = new $class(); } } return self::$_instance; }
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()); } } }
function pluginActivation() { $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) { $data = $this->getData($value->ID); if ($data['data']['enable'] != 1) { continue; } $content = $value->post_content; $content = preg_replace('/\\[' . PLUGIN_PAGE_BUILDER_SHORTCODE_PREFIX . 'builder\\]/', null, $content); $content = preg_replace('/\\[' . PLUGIN_PAGE_BUILDER_SHORTCODE_PREFIX . 'builder id="[0-9]{1,}"\\]/', null, $content); $content = $content . $this->createMainShortcode(); wp_update_post(array('ID' => $value->ID, 'post_content' => $content)); } $option = $this->optionDefault; $optionSave = array(); $optionCurrent = ThemeOption::getOptionObject(); 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]); } } PBOption::resetOption(); PBOption::updateOption($optionSave); $this->createCSSFile(); }
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); }
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 $Post->formatPostDate($post->post_date, $day, $month, $year); $headerImportance = $widgetAreaData['location'] == 0 ? 2 : 4; ?> <div class="theme-post-section-header"> <h<?php echo $headerImportance;
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) . ' […] </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) . ' </span><a class="theme-comment-content-read-less-link" href="#">' . esc_html__('Read Less', THEME_DOMAIN) . '</a> '; } else { $content = '<span>' . $content . '</span>'; } return $content; }
<!doctype html> <?php $theme = ThemeOption::getInstance(); ?> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" <?php language_attributes(); ?> > <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" <?php language_attributes(); ?> > <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9" <?php language_attributes(); ?> > <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" <?php language_attributes(); ?> > <!--<![endif]--> <head> <title><?php echo app_get_page_title(); ?> </title> <!-- meta --> <?php include dirname(__FILE__) . '/incl-open-graph-meta.php'; ?>
function getFooterStickyClass() { $mobileDetect = new Mobile_Detect(); if ($mobileDetect->isMobile()) { return null; } if (ThemeOption::getOption('footer_sticky_enable') == 1) { return 'theme-footer-sticky'; } return null; }
function installSampleData() { error_reporting(E_ALL); ob_start(); ob_clean(); $this->code = 0; $this->buffer = null; $dataImport = array(); if (array_key_exists('code', $_POST)) { $this->code = (int) $_POST['code']; } if (array_key_exists('buffer', $_POST)) { $this->buffer = stripslashes($_POST['buffer']); } if (array_key_exists('data_import', $_POST)) { $dataImport = (array) $_POST['data_import']; } if (count($dataImport) == 0) { $this->createResponse(__('Please select at least one option of data which need to be imported.', PLUGIN_THEME_INSTALLER_DOMAIN), true); } global $ti_data; if (!ini_get('safe_mode')) { set_time_limit(0); ini_set('memory_limit', '512M'); } if (in_array(1, $dataImport)) { /***/ if (array_key_exists('plugin_timetable', $ti_data)) { if ($this->checkCode(10000)) { global $wpdb; $wpdb->query($ti_data['plugin_timetable']['sql']); $this->createResponse(null, false, 10001); } } /***/ if (array_key_exists('plugin_revslider', $ti_data)) { if (class_exists('ThemePunch_Fonts')) { if (array_key_exists('font', $ti_data['plugin_revslider'])) { if ($this->checkCode(10001)) { $Font = new ThemePunch_Fonts(); foreach ($ti_data['plugin_revslider']['font'] as $fontValue) { $Font->add_new_font($fontValue); } $this->createResponse(null, false, 10002); } } } if (class_exists('RevSlider')) { if (array_key_exists('path', $ti_data['plugin_revslider'])) { if ($this->checkCode(10002)) { $Slider = new RevSlider(); $Slider->importSliderFromPost(true, true, $ti_data['plugin_revslider']['path']); $this->createResponse(null, false, 10003); } } } } /***/ if (!defined('WP_LOAD_IMPORTERS')) { define('WP_LOAD_IMPORTERS', true); } TIInclude::includeFile(ABSPATH . 'wp-admin/includes/import.php'); $includeClass = array(array('class' => 'WP_Importer', 'path' => ABSPATH . 'wp-admin/includes/class-wp-importer.php'), array('class' => 'WP_Import', 'path' => PLUGIN_THEME_INSTALLER_LIBRARY_PATH . 'wordpress-importer.php')); foreach ($includeClass as $value) { $r = TIInclude::includeClass($value['path'], array($value['class'])); if ($r !== true) { break; } } if ($r === false) { $this->createResponse(__('Auto import feature couldn\'t be loaded. Please make import manually. You can find import dummy files in folder dummy_content.', PLUGIN_THEME_INSTALLER_DOMAIN)); } foreach ($ti_data['value']['dummy_content_file'] as $index => $value) { if ($this->checkCode(20000 + $index)) { $Import = new WP_Import(); $Import->fetch_attachments = true; $Import->import($value['path']); $this->createResponse(null, false, 20000 + $index + 1); } } /***/ if ($this->checkCode(30000)) { if (array_key_exists('meta', $ti_data)) { foreach ($ti_data['meta'] as $aIndex => $aValue) { switch ($aIndex) { case 'post_menu': $post = get_page_by_title($aValue['post_title'], 'OBJECT', $aValue['post_type']); if (is_null($post)) { break; } $menu = get_term_by('name', $aValue['menu_title'], 'nav_menu'); if ($menu === false) { break; } $meta = get_post_meta($post->ID, THEME_OPTION_PREFIX, true); if ($meta === false) { $meta = array(); } $meta[$aValue['meta_name']] = $menu->term_id; update_post_meta($post->ID, THEME_OPTION_PREFIX, $meta); break; } } } $this->createResponse(null, false, 40000); } } /**********************************************************************/ if ($this->checkCode(40000)) { if (in_array(2, $dataImport)) { if (array_key_exists('widget_settings_file', $ti_data['value'])) { foreach ($ti_data['value']['widget_settings_file'] as $file) { $json_data = json_decode(file_get_contents($file['path']), true); $widget_data = $json_data[1]; $sidebars_data = $json_data[0]; $current_sidebars = get_option('sidebars_widgets'); $current_sidebars['wp_inactive_widgets'] = array(); update_option('sidebars_widgets', $current_sidebars); $new_widgets = array(); foreach ($sidebars_data as $import_sidebar => $import_widgets) { foreach ($import_widgets as $import_widget) { $title = trim(substr($import_widget, 0, strrpos($import_widget, '-'))); $index = trim(substr($import_widget, strrpos($import_widget, '-') + 1)); $current_widget_data = get_option('widget_' . $title); $new_widget_name = $this->getNewWidgetName($title, $index); $new_index = trim(substr($new_widget_name, strrpos($new_widget_name, '-') + 1)); if (!empty($new_widgets[$title]) && is_array($new_widgets[$title])) { while (array_key_exists($new_index, $new_widgets[$title])) { $new_index++; } } $current_sidebars[$import_sidebar][] = $title . '-' . $new_index; if (array_key_exists($title, $new_widgets)) { $new_widgets[$title][$new_index] = $widget_data[$title][$index]; $multiwidget = $new_widgets[$title]['_multiwidget']; unset($new_widgets[$title]['_multiwidget']); $new_widgets[$title]['_multiwidget'] = $multiwidget; } else { $current_widget_data[$new_index] = $widget_data[$title][$index]; $current_multiwidget = null; if (array_key_exists('_multiwidget', $current_widget_data)) { $current_multiwidget = $current_widget_data['_multiwidget']; } $new_multiwidget = $widget_data[$title]['_multiwidget']; $multiwidget = $current_multiwidget != $new_multiwidget ? $current_multiwidget : 1; unset($current_widget_data['_multiwidget']); $current_widget_data['_multiwidget'] = $multiwidget; $new_widgets[$title] = $current_widget_data; } } } if (isset($new_widgets) && isset($current_sidebars)) { update_option('sidebars_widgets', $current_sidebars); foreach ($new_widgets as $title => $content) { update_option('widget_' . $title, $content); } } } $menu = get_terms('nav_menu'); foreach ($menu as $menuValue) { $option = get_option('widget_nav_menu'); if (is_array($option)) { foreach ($option as $optionIndex => $optionValue) { if ($optionValue['title'] == $menuValue->name) { $option[$optionIndex]['nav_menu'] = $menuValue->term_id; update_option('widget_nav_menu', $option); break; } } } } } } $this->createResponse(null, false, 50000); } /**********************************************************************/ if ($this->checkCode(50000)) { if (in_array(3, $dataImport)) { $option = array(); foreach ($ti_data as $aIndex => $aValue) { foreach ($aValue as $bIndex => $bValue) { $result = null; switch ($aIndex) { case 'path': if (array_key_exists('title', $bValue)) { $result = get_page_by_title($bValue['title'], 'OBJECT', $bValue['postType']); } if (is_null($result)) { break; } list($result) = wp_get_attachment_image_src($result->ID, 'full'); break; case 'post_id': if (array_key_exists('title', $bValue)) { $result = get_page_by_title($bValue['title'], 'OBJECT', $bValue['postType']); } if (is_null($result)) { break; } $result = $result->ID; break; case 'term_id': if (array_key_exists('title', $bValue)) { $result = get_term_by('name', $bValue['title'], $bValue['taxonomy']); } if ($result === false) { $result = null; break; } $result = $result->term_id; break; case 'value': if (array_key_exists('value', $bValue)) { $result = $bValue['value']; } break; case 'option': if ($bIndex == 'permalink_structure') { global $wp_rewrite; $wp_rewrite->set_permalink_structure($bValue); $result = null; } else { $result = $bValue; } break; } if (!is_null($result)) { if (preg_match('/^' . THEME_OPTION_PREFIX . '_/', $bIndex)) { $key = mb_substr($bIndex, mb_strlen(THEME_OPTION_PREFIX) + 1); $option[THEME_OPTION_PREFIX][$key] = $result; } else { $option['option'][$bIndex] = $result; } } } } foreach ($option as $aIndex => $aValue) { switch ($aIndex) { case 'option': foreach ($aValue as $bIndex => $bValue) { update_option($bIndex, $bValue); } break; case THEME_OPTION_PREFIX: if (class_exists('ThemeOption')) { ThemeOption::updateOption($option[THEME_OPTION_PREFIX]); } break; } } } } /**********************************************************************/ $page = get_page_by_title('Sample page', 'OBJECT', 'page'); if (!is_null($page)) { wp_delete_post($page->ID); } $post = get_page_by_title('Hello world!', 'OBJECT', 'post'); if (!is_null($post)) { wp_delete_post($post->ID); } /**********************************************************************/ flush_rewrite_rules(); /**********************************************************************/ $this->createResponse(__('Seems, that demo data has been imported. To make sure if this process has been sucessfully completed, please check below content of buffer returned by external applications.', PLUGIN_THEME_INSTALLER_DOMAIN), false); }
<?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();
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; }
<?php $analytics_tag_manager_key = ThemeOption::getInstance()->get('analytics_tag_manager_key'); if ($analytics_tag_manager_key) { ?> <!-- Google Tag Manager --> <noscript><iframe src="//www.googletagmanager.com/ns.html?id=<?php echo $analytics_tag_manager_key; ?> " height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','<?php echo $analytics_tag_manager_key; ?> ');</script> <!-- End Google Tag Manager --> <?php }
function pluginActivation() { if (version_compare(PHP_VERSION, '5.3', '<')) { exit(sprintf('This plugin requires PHP 5.3 or higher. You’re still on %s.', PHP_VERSION)); } if (PBData::get('visual_mode') == 1) { $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) { $data = $this->getData($value->ID); if ($data['data']['enable'] != 1) { continue; } $content = $value->post_content; $content = preg_replace('/\\[' . PLUGIN_PAGE_BUILDER_SHORTCODE_PREFIX . 'builder\\]/', null, $content); $content = preg_replace('/\\[' . PLUGIN_PAGE_BUILDER_SHORTCODE_PREFIX . 'builder id="[0-9]{1,}"\\]/', null, $content); $content = $content . $this->createMainShortcode(); wp_update_post(array('ID' => $value->ID, 'post_content' => $content)); } } $option = $this->pluginOptionDeafult; $optionSave = array(); $optionCurrent = ThemeOption::getOptionObject(); 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]); } } PBOption::resetOption(); PBOption::updateOption($optionSave); $this->createCSSFile(); }
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); }
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); } }
<?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); } }
</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) {
global $post, $fable_parentPost; the_post(); $Page = new ThemePage(); $Post = new ThemePost(); $Validation = new ThemeValidation(); $WidgetArea = new ThemeWidgetArea(); $widgetAreaData = $WidgetArea->getWidgetAreaByPost($fable_parentPost->post, true, true); $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()); $visibleOption['post_navigation_visible'] = ThemeOption::getGlobalOption($post, 'post_navigation_visible'); ?> <div <?php 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']);