/**
     * How to display the widget on the screen.
     */
    function widget($args, $instance)
    {
        extract($args);
        global $wp_query, $post;
        global $THEMEREX_CURRENT_SIDEBAR;
        /* Our variables from the widget settings. */
        $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : '');
        $number = isset($instance['number']) ? (int) $instance['number'] : '';
        $show_date = isset($instance['show_date']) ? (int) $instance['show_date'] : 0;
        $show_image = isset($instance['show_image']) ? (int) $instance['show_image'] : 0;
        $show_author = isset($instance['show_author']) ? (int) $instance['show_author'] : 0;
        $show_counters = isset($instance['show_counters']) ? (int) $instance['show_counters'] : 0;
        $category = isset($instance['category']) ? (int) $instance['category'] : 0;
        $show_counters = $show_counters ? get_theme_option("blog_counters") : '';
        $output = '';
        if ($THEMEREX_CURRENT_SIDEBAR == 'top') {
            $output .= '<div class="columnsWrap"><div class="columns1_2">';
        }
        $args = array('numberposts' => $number, 'offset' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'post', 'post_status' => current_user_can('read_private_pages') && current_user_can('read_private_posts') ? array('publish', 'private') : 'publish', 'ignore_sticky_posts' => 1, 'suppress_filters' => true);
        if ($category > 0) {
            $args['category'] = $category;
        }
        $ex = get_theme_option('exclude_cats');
        if (!empty($ex)) {
            $args['category__not_in'] = explode(',', $ex);
        }
        $recent_posts = wp_get_recent_posts($args, OBJECT);
        $post_number = 0;
        foreach ($recent_posts as $post) {
            $post_number++;
            require themerex_get_file_dir('/templates/page-part-widgets-posts.php');
            if ($THEMEREX_CURRENT_SIDEBAR == 'top' && $post_number == round($number / 2)) {
                $output .= '
					</div><div class="columns1_2">
				';
            }
            if ($post_number >= $number) {
                break;
            }
        }
        if ($THEMEREX_CURRENT_SIDEBAR == 'top') {
            $output .= '</div></div>';
        }
        if (!empty($output)) {
            /* Before widget (defined by themes). */
            echo balanceTags($before_widget);
            /* Display the widget title if one was input (before and after defined by themes). */
            echo balanceTags($before_title) . esc_html($title) . balanceTags($after_title);
            echo balanceTags($output);
            /* After widget (defined by themes). */
            echo balanceTags($after_widget);
        }
    }
Ejemplo n.º 2
0
 function themerex_callback_ajax_search()
 {
     global $_REQUEST, $post, $wp_query;
     if (!wp_verify_nonce($_REQUEST['nonce'], 'ajax_nonce')) {
         die;
     }
     $response = array('error' => '', 'data' => '');
     $s = $_REQUEST['text'];
     if (!empty($s)) {
         $show_types = get_theme_option('ajax_search_types');
         $show_date = get_theme_option('ajax_search_posts_date') == 'yes' ? 1 : 0;
         $show_image = get_theme_option('ajax_search_posts_image') == 'yes' ? 1 : 0;
         $show_author = get_theme_option('ajax_search_posts_author') == 'yes' ? 1 : 0;
         $show_counters = get_theme_option('ajax_search_posts_counters') == 'yes' ? get_theme_option('blog_counters') : '';
         $args = array('post_status' => 'publish', 'orderby' => 'date', 'order' => 'desc', 'posts_per_page' => max(1, min(10, get_theme_option('ajax_search_posts_count'))), 's' => esc_html($s));
         // Filter post types
         if (!empty($show_types)) {
             $args['post_type'] = explode(',', $show_types);
         }
         // Exclude categories
         $ex = get_theme_option('exclude_cats');
         if (!empty($ex)) {
             $args['category__not_in'] = explode(',', $ex);
         }
         $args = apply_filters('ajax_search_query', $args);
         $post_number = 0;
         $output = '';
         if (!isset($wp_query)) {
             $wp_query = new WP_Query($args);
         } else {
             query_posts($args);
         }
         while (have_posts()) {
             the_post();
             $post_number++;
             require themerex_get_file_dir('/templates/page-part-widgets-posts.php');
         }
         if (empty($output)) {
             $output .= '<article class="post_item">' . __('Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'themerex') . '</article>';
         } else {
             $output .= '<article class="post_item"><a href="#" class="post_more">' . __('More results &hellip;', 'themerex') . '</a></article>';
         }
         $response['data'] = $output;
     } else {
         $response['error'] = __('The query string is empty!', 'themerex');
     }
     echo json_encode($response);
     die;
 }
Ejemplo n.º 3
0
 function import_widgets()
 {
     if (empty($this->options['file_with_widgets'])) {
         return;
     }
     echo '<br><b>' . __('Import Widgets ...', 'themerex') . '</b><br>';
     flush();
     // Register custom widgets
     $widgets = array();
     $sidebars = get_theme_option('custom_sidebars');
     if (is_array($sidebars) && count($sidebars) > 0) {
         foreach ($sidebars as $i => $sb) {
             if (trim(chop($sb)) == '') {
                 continue;
             }
             $widgets['custom-sidebar-' . $i] = $sb;
         }
     }
     themerex_widgets_init($widgets);
     // Import widgets
     $widgets_txt = themerex_fgc(themerex_get_file_dir('/admin/tools/importer/data/' . $this->options['file_with_widgets']));
     $data = unserialize(base64_decode($widgets_txt));
     // Replace upload url in options
     foreach ($data as $k => $v) {
         foreach ($v as $k1 => $v1) {
             if (is_array($v1)) {
                 foreach ($v1 as $k2 => $v2) {
                     if (is_array($v2)) {
                         foreach ($v2 as $k3 => $v3) {
                             $v2[$k3] = $this->replace_uploads($v3);
                         }
                         $v1[$k2] = $v2;
                     } else {
                         $v1[$k2] = $this->replace_uploads($v2);
                     }
                 }
                 $v[$k1] = $v1;
             } else {
                 $v[$k1] = $this->replace_uploads($v1);
             }
         }
         update_option($k, $v);
     }
 }
Ejemplo n.º 4
0
 function import_sliders()
 {
     // Royal Sliders
     if (!empty($this->options['file_with_royal_sliders'])) {
         echo '<br><b>' . __('Import Royal sliders ...', 'themerex') . '</b><br>';
         flush();
         global $wpdb;
         $sliders_txt = themerex_fgc(themerex_get_file_dir('/admin/tools/importer/data/' . $this->options['file_with_royal_sliders']));
         $data = unserialize(base64_decode($sliders_txt));
         if (is_array($data) && count($data) > 0) {
             foreach ($data as $slider => $slides) {
                 if ($slider == 'royal') {
                     $values = '';
                     $fields = '';
                     foreach ($slides as $slide) {
                         $f = '';
                         $v = '';
                         foreach ($slide as $field => $value) {
                             $f .= ($f ? ',' : '') . "'" . $field . "'";
                             $v .= ($v ? ',' : '') . "'" . addslashes($value) . "'";
                         }
                         if ($fields == '') {
                             $fields = '(' . $f . ')';
                         }
                         $values .= ($values ? ',' : '') . '(' . $v . ')';
                     }
                     $q = "REPLACE INTO {$wpdb->prefix}new_royalsliders VALUES {$values}";
                     $wpdb->query($q);
                 }
             }
         }
     }
     // Revolution Sliders
     if (file_exists(WP_PLUGIN_DIR . '/revslider/revslider.php')) {
         require_once WP_PLUGIN_DIR . '/revslider/revslider.php';
         $dir = get_template_directory() . '/admin/tools/importer/data/revslider';
         if (is_dir($dir)) {
             $hdir = @opendir($dir);
             if ($hdir) {
                 echo '<br><b>' . __('Import Revolution sliders ...', 'themerex') . '</b><br>';
                 flush();
                 $slider = new RevSlider();
                 while (($file = readdir($hdir)) !== false) {
                     $pi = pathinfo($dir . '/' . $file);
                     if (substr($file, 0, 1) == '.' || is_dir($dir . '/' . $file) || $pi['extension'] != 'zip') {
                         continue;
                     }
                     if ($this->debug) {
                         printf(__('Slider "%s":', 'themerex'), $file);
                     }
                     if (!is_array($_FILES)) {
                         $_FILES = array();
                     }
                     $_FILES["import_file"] = array("tmp_name" => $dir . '/' . $file);
                     $response = $slider->importSliderFromPost();
                     if ($response["success"] == false) {
                         if ($this->debug) {
                             echo ' ' . __('imported', 'themerex') . '<br>';
                         }
                     } else {
                         if ($this->debug) {
                             echo ' ' . __('import error', 'themerex') . '<br>';
                         }
                     }
                     flush();
                 }
                 @closedir($hdir);
             }
         }
     } else {
         if ($this->debug) {
             printf(__('Can not locate Revo plugin: %s', 'themerex'), WP_PLUGIN_DIR . '/revslider/revslider.php<br>');
             flush();
         }
     }
 }
Ejemplo n.º 5
0
<?php

$post_title_tag = $opt['style'] == 'list' ? 'li' : 'h4';
require themerex_get_file_dir('/templates/page-part-reviews-summary.php');
$title = '<' . $post_title_tag . ' class="sc_blogger_title sc_title' . (in_array($opt['style'], array('accordion_1', 'accordion_2')) ? ' sc_accordion_title' : '') . '">' . ((!isset($opt['links']) || $opt['links']) && !in_array($opt['style'], array('accordion_1', 'accordion_2')) ? '<a href="' . $post_data['post_link'] . '">' : '') . (themerex_substr($opt['style'], 0, 6) == 'bubble' ? '<span class="sc_title_bubble_icon ' . ($post_data['post_icon'] != '' ? ' ' . $post_data['post_icon'] : '') . '"' . ($post_data['bubble_color'] != '' ? ' style="background-color:' . $post_data['bubble_color'] . '"' : '') . '></span>' : '') . (in_array($opt['style'], array('accordion_1', 'accordion_2')) ? '<span class="sc_accordion_icon"></span>' : '') . $post_data['post_title'] . ((!isset($opt['links']) || $opt['links']) && !in_array($opt['style'], array('accordion_1', 'accordion_2')) ? '</a>' : '') . '</' . $post_title_tag . '>' . (in_array($opt['style'], array('accordion_1', 'accordion_2', 'list')) ? '' : $reviewsBlock);
if ($opt['style'] == 'list') {
    echo $title;
} else {
    $thumb = $post_data['post_thumb'] && themerex_strpos($opt['style'], 'image') !== false ? '<div class="thumb">' . ($post_data['post_link'] != '' ? '<a href="' . $post_data['post_link'] . '">' . $post_data['post_thumb'] . '</a>' : $post_data['post_thumb']) . '</div>' : '';
    $info = sc_param_is_on($opt['info']) ? '<div class="sc_blogger_info">' . (themerex_strpos($opt['style'], 'image') !== false || themerex_strpos($opt['style'], 'accordion') !== false ? '<div class="squareButton light ico sc_blogger_more"><a class="icon-link" title="" href="' . $post_data['post_link'] . '">' . ($opt['readmore'] ? $opt['readmore'] : __('More', 'themerex')) . '</a></div><div class="sc_blogger_author">' . __('Posted by', 'themerex') : __('by', 'themerex')) . ' <a href="' . $post_data['post_author_url'] . '" class="post_author">' . $post_data['post_author'] . '</a>' . ($opt['counters'] != 'none' ? ' <span class="separator">|</span> ' . ($opt['orderby'] == 'comments' || $opt['counters'] == 'comments' ? __('Comments', 'themerex') : __('Views', 'themerex')) . ' <span class="comments_number">' . ($opt['orderby'] == 'comments' || $opt['counters'] == 'comments' ? $post_data['post_comments'] : $post_data['post_views']) . '</span>' : '') . (themerex_strpos($opt['style'], 'image') !== false || themerex_strpos($opt['style'], 'accordion') !== false ? '</div>' : '') . '</div>' : '';
    if ($opt['dir'] == 'horizontal' && $opt['style'] != 'date') {
        ?>
		<div class="columns1_<?php 
        echo $opt['posts_visible'];
        ?>
 column_item_<?php 
        echo $opt['number'];
        echo ($opt['number'] % 2 == 1 ? ' odd' : ' even') . ($opt['number'] == 1 ? ' first' : '') . ($opt['number'] == $opt['posts_on_page'] ? ' columns_last' : '');
        //. (sc_param_is_on($opt['scroll']) ? ' sc_scroll_slide swiper-slide' : '');
        ?>
">

		<?php 
    }
    ?>
<article class="sc_blogger_item<?php 
    echo (in_array($opt['style'], array('accordion_1', 'accordion_2')) ? ' sc_accordion_item' : '') . ($opt['number'] == $opt['posts_on_page'] && !sc_param_is_on($opt['loadmore']) ? ' sc_blogger_item_last' : '');
    //. (sc_param_is_on($opt['scroll']) && ($opt['dir'] == 'vertical' || $opt['style'] == 'date') ? ' sc_scroll_slide swiper-slide' : '');
    ?>
"<?php 
    echo $opt['dir'] == 'horizontal' && $opt['style'] == 'date' ? ' style="width:' . 100 / $opt['posts_on_page'] . '%"' : '';
    /**
     * How to display the widget on the screen.
     */
    function widget($args, $instance)
    {
        extract($args);
        global $wp_query, $post;
        global $THEMEREX_CURRENT_SIDEBAR;
        /* Our variables from the widget settings. */
        $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : '');
        $title_tabs = array(isset($instance['title_popular']) ? $instance['title_popular'] : '', isset($instance['title_commented']) ? $instance['title_commented'] : '', isset($instance['title_liked']) ? $instance['title_liked'] : '');
        $number = isset($instance['number']) ? (int) $instance['number'] : '';
        $show_date = isset($instance['show_date']) ? (int) $instance['show_date'] : 0;
        $show_image = isset($instance['show_image']) ? (int) $instance['show_image'] : 0;
        $show_author = isset($instance['show_author']) ? (int) $instance['show_author'] : 0;
        $show_counters = isset($instance['show_counters']) ? (int) $instance['show_counters'] : 0;
        $category = isset($instance['category']) ? (int) $instance['category'] : 0;
        $output = $tabs = '';
        if ($THEMEREX_CURRENT_SIDEBAR == 'top') {
            $output .= '<div class="columnsWrap">';
        }
        $rnd = str_replace('.', '', mt_rand());
        for ($i = 0; $i < 3; $i++) {
            $args = array('post_type' => 'post', 'post_status' => current_user_can('read_private_pages') && current_user_can('read_private_posts') ? array('publish', 'private') : 'publish', 'post_password' => '', 'posts_per_page' => $number, 'ignore_sticky_posts' => 1, 'order' => 'DESC');
            if ($i == 0) {
                // Most popular
                $args['meta_key'] = 'post_views_count';
                $args['orderby'] = 'meta_value_num';
                $show_counters = $show_counters ? 'views' : '';
            } else {
                if ($i == 2) {
                    // Most liked
                    $args['meta_key'] = 'post_likes_count';
                    $args['orderby'] = 'meta_value_num';
                    $show_counters = $show_counters ? 'likes' : '';
                } else {
                    // Most commented
                    $args['orderby'] = 'comment_count';
                    $show_counters = $show_counters ? 'comments' : '';
                }
            }
            if ($category > 0) {
                $args['cat'] = $category;
            }
            $ex = get_theme_option('exclude_cats');
            if (!empty($ex)) {
                $args['category__not_in'] = explode(',', $ex);
            }
            query_posts($args);
            /* Loop posts */
            if (have_posts()) {
                if ($THEMEREX_CURRENT_SIDEBAR == 'top') {
                    $output .= '
						<div class="tab_content columns1_3" id="widget_popular_' . $i . '">
							<h2 class="widgetSubtitle">' . $title_tabs[$i] . '</h2>
					';
                } else {
                    $tabs .= '<li ><a href="#widget_popular_' . $rnd . '_' . $i . '">' . $title_tabs[$i] . '</a></li>';
                    $output .= '
						<div class="tab_content" id="widget_popular_' . $rnd . '_' . $i . '"' . ($i == 1 && !$output ? ' style="display: block;"' : '') . '>
					';
                }
                $post_number = 0;
                while (have_posts()) {
                    the_post();
                    $post_number++;
                    require themerex_get_file_dir('/templates/page-part-widgets-posts.php');
                    if ($post_number >= $number) {
                        break;
                    }
                }
                $output .= '
					</div>
				';
            }
        }
        if ($THEMEREX_CURRENT_SIDEBAR == 'top') {
            $output .= '</div>';
        }
        /* Restore main wp_query and current post data in the global var $post */
        wp_reset_query();
        wp_reset_postdata();
        if (!empty($output)) {
            themerex_enqueue_script('jquery-ui-tabs', false, array('jquery', 'jquery-ui-core'), null, true);
            /* Before widget (defined by themes). */
            echo balanceTags($before_widget);
            /* Display the widget title if one was input (before and after defined by themes). */
            if ($title) {
                echo balanceTags($before_title) . esc_html($title) . balanceTags($after_title);
            }
            echo '
				<div class="popular_and_commented_tabs' . ($THEMEREX_CURRENT_SIDEBAR == 'top' ? '' : ' tabs_area') . '">
					' . ($THEMEREX_CURRENT_SIDEBAR == 'top' ? '' : '
					<ul class="tabs">
						' . $tabs . '
					</ul>
					') . $output . '
				</div>
			';
            /* After widget (defined by themes). */
            echo balanceTags($after_widget);
        }
    }
Ejemplo n.º 7
0
 function themerex_get_file_url($file)
 {
     return themerex_get_file_dir($file, true);
 }
        _e('Tags:', 'themerex');
        ?>
							<?php 
        echo balanceTags($post_data['post_tags_links']);
        ?>
						</div>
					<?php 
    }
    ?>
				</div>

			<?php 
}
stopWrapper(3);
?>

	<?php 
if (!$post_data['post_protected']) {
    require themerex_get_file_dir('/templates/page-part-author-info.php');
    require themerex_get_file_dir('/templates/page-part-related-posts.php');
    get_template_part('templates/page-part-comments');
}
?>

<?php 
stopWrapper();
?>

<?php 
require themerex_get_file_dir('/templates/page-part-views-counter.php');
    /**
     * How to display the widget on the screen.
     */
    function widget($args, $instance)
    {
        extract($args);
        global $wp_query, $post;
        global $THEMEREX_CURRENT_SIDEBAR;
        /* Our variables from the widget settings. */
        $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : '');
        $number = isset($instance['number']) ? (int) $instance['number'] : '';
        $show_date = isset($instance['show_date']) ? (int) $instance['show_date'] : 0;
        $show_image = isset($instance['show_image']) ? (int) $instance['show_image'] : 0;
        $show_author = isset($instance['show_author']) ? (int) $instance['show_author'] : 0;
        $show_counters = isset($instance['show_counters']) ? (int) $instance['show_counters'] : 0;
        $category = isset($instance['category']) ? (int) $instance['category'] : 0;
        $show_counters = $show_counters == 2 ? 'stars' : ($show_counters == 1 ? 'rating' : '');
        $output = '';
        if ($THEMEREX_CURRENT_SIDEBAR == 'top') {
            $output .= '<div class="columnsWrap"><div class="columns1_2">';
        }
        $post_rating = 'reviews_avg' . (get_theme_option('reviews_first') == 'author' ? '' : '2');
        $args = array('post_type' => 'post', 'post_status' => current_user_can('read_private_pages') && current_user_can('read_private_posts') ? array('publish', 'private') : 'publish', 'post_password' => '', 'posts_per_page' => $number, 'ignore_sticky_posts' => 1, 'order' => 'DESC', 'orderby' => 'date', 'meta_query' => array(array('key' => $post_rating, 'value' => 0, 'compare' => '>', 'type' => 'NUMERIC')));
        if ($category > 0) {
            $args['cat'] = $category;
        }
        $ex = get_theme_option('exclude_cats');
        if (!empty($ex)) {
            $args['category__not_in'] = explode(',', $ex);
        }
        query_posts($args);
        /* Loop posts */
        if (have_posts()) {
            $post_number = 0;
            while (have_posts()) {
                the_post();
                $post_number++;
                require themerex_get_file_dir('/templates/page-part-widgets-posts.php');
                if ($THEMEREX_CURRENT_SIDEBAR == 'top' && $post_number == round($number / 2)) {
                    $output .= '
						</div><div class="columns1_2">
					';
                }
                if ($post_number >= $number) {
                    break;
                }
            }
        }
        if ($THEMEREX_CURRENT_SIDEBAR == 'top') {
            $output .= '</div></div>';
        }
        /* Restore main wp_query and current post data in the global var $post */
        wp_reset_query();
        wp_reset_postdata();
        if (!empty($output)) {
            /* Before widget (defined by themes). */
            echo $before_widget;
            /* Display the widget title if one was input (before and after defined by themes). */
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            echo '
				<div class="recent_reviews">
					' . $output . '
				</div>
			';
            /* After widget (defined by themes). */
            echo $after_widget;
        }
    }
<?php

//====================================== Editor area ========================================
if ($post_data['post_edit_enable']) {
    require_once themerex_get_file_dir('/admin/theme-options.php');
    wp_register_script('wp-color-picker', get_site_url() . '/wp-admin/js/color-picker.min.js', array('jquery'), '1.0', true);
    themerex_enqueue_style('fontello-admin', themerex_get_file_url('/admin/css/fontello/css/fontello-admin.css'), array(), null);
    themerex_enqueue_style('frontend-editor-style', themerex_get_file_url('/js/editor/_editor.css'), array('main-style'), null);
    themerex_enqueue_script('frontend-editor', themerex_get_file_url('/js/editor/_editor.js'), array(), null, true);
    themerex_options_load_scripts();
    themerex_options_prepare_js($post_data['post_type'] == 'page' ? 'page' : 'post');
    themerex_shortcodes_load_scripts();
    themerex_shortcodes_prepare_js();
    ?>
	<div id="frontend_editor">
		<div id="frontend_editor_inner">
			<form method="post">
				<label id="frontend_editor_post_title_label" for="frontend_editor_post_title"><?php 
    _e('Title', 'themerex');
    ?>
</label>
				<input type="text" name="frontend_editor_post_title" id="frontend_editor_post_title" value="<?php 
    echo esc_attr($post_data['post_title']);
    ?>
" />
				<?php 
    $ajax_nonce = wp_create_nonce('themerex_editor_nonce');
    $ajax_url = admin_url('admin-ajax.php');
    wp_editor($post_data['post_content_original'], 'frontend_editor_post_content', array('wpautop' => true, 'textarea_rows' => 16));
    ?>
				<label id="frontend_editor_post_excerpt_label" for="frontend_editor_post_excerpt"><?php 
Ejemplo n.º 11
0
<?php

global $themerex_options_delimiter, $themerex_options_data;
$themerex_options_data = null;
$themerex_options_delimiter = ',';
require_once themerex_get_file_dir('/admin/theme-custom.php');
//-----------------------------------------------------------------------------------
// Load required styles and scripts for Options Page
//-----------------------------------------------------------------------------------
add_action("admin_enqueue_scripts", 'themerex_options_load_scripts');
function themerex_options_load_scripts()
{
    // WP Color Picker
    themerex_enqueue_style('wp-color-picker', false, array(), null);
    // ThemeREX options styles
    themerex_enqueue_style('themerex-options-style', themerex_get_file_url('/admin/css/theme-options.css'), array(), null);
    themerex_enqueue_style('themerex-options-style-datepicker', themerex_get_file_url('/admin/css/theme-options-datepicker.css'), array(), null);
    // ThemeREX messages script
    themerex_enqueue_style('themerex-messages-style', themerex_get_file_url('/js/messages/_messages.css'), array(), null);
    // PrettyPhoto
    themerex_enqueue_style('prettyphoto-style', themerex_get_file_url('/js/prettyphoto/css/prettyPhoto.css'), array(), null);
    // WP core scripts
    wp_enqueue_media();
    themerex_enqueue_script('wp-color-picker', false, array('jquery'), null, true);
    // jQuery scripts
    themerex_enqueue_script('jquery-ui-core', false, array('jquery'), null, true);
    themerex_enqueue_script('jquery-ui-tabs', false, array('jquery', 'jquery-ui-core'), null, true);
    themerex_enqueue_script('jquery-ui-accordion', false, array('jquery', 'jquery-ui-core'), null, true);
    themerex_enqueue_script('jquery-ui-sortable', false, array('jquery', 'jquery-ui-core'), null, true);
    themerex_enqueue_script('jquery-ui-draggable', false, array('jquery', 'jquery-ui-core'), null, true);
    themerex_enqueue_script('jquery-ui-datepicker', false, array('jquery', 'jquery-ui-core'), null, true);
Ejemplo n.º 12
0
 function themerex_admin_register_plugins()
 {
     $plugins = array(array('name' => 'WooCommerce', 'slug' => 'woocommerce', 'required' => false), array('name' => 'Visual Composer', 'slug' => 'js_composer', 'source' => themerex_get_file_dir('/plugins/js_composer.zip'), 'required' => false), array('name' => 'Revolution Slider', 'slug' => 'revslider', 'source' => themerex_get_file_dir('/plugins/revslider.zip'), 'required' => false), array('name' => 'Royal Slider', 'slug' => 'royalslider', 'source' => themerex_get_file_dir('/plugins/royalslider.zip'), 'required' => false));
     $theme_text_domain = 'themerex';
     $config = array('domain' => $theme_text_domain, 'default_path' => '', 'parent_menu_slug' => 'themes.php', 'parent_url_slug' => 'themes.php', 'menu' => 'install-required-plugins', 'has_notices' => true, 'is_automatic' => true, 'message' => '', 'strings' => array('page_title' => __('Install Required Plugins', 'themerex'), 'menu_title' => __('Install Plugins', 'themerex'), 'installing' => __('Installing Plugin: %s', 'themerex'), 'oops' => __('Something went wrong with the plugin API.', 'themerex'), 'notice_can_install_required' => _n_noop('This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.'), 'notice_can_install_recommended' => _n_noop('This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.'), 'notice_cannot_install' => _n_noop('Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.'), 'notice_can_activate_required' => _n_noop('The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.'), 'notice_can_activate_recommended' => _n_noop('The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.'), 'notice_cannot_activate' => _n_noop('Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.'), 'notice_ask_to_update' => _n_noop('The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.'), 'notice_cannot_update' => _n_noop('Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.'), 'install_link' => _n_noop('Begin installing plugin', 'Begin installing plugins'), 'activate_link' => _n_noop('Activate installed plugin', 'Activate installed plugins'), 'return' => __('Return to Required Plugins Installer', 'themerex'), 'plugin_activated' => __('Plugin activated successfully.', 'themerex'), 'complete' => __('All plugins installed and activated successfully. %s', 'themerex'), 'nag_type' => 'updated'));
     tgmpa($plugins, $config);
 }
Ejemplo n.º 13
0
 function getIconsList($prepend_inherit = false)
 {
     $list = array();
     if ($prepend_inherit) {
         $list['inherit'] = __("Inherit", 'themerex');
     }
     return array_merge($list, parseIconsClasses(themerex_get_file_dir("/css/fontello/css/fontello-codes.css")));
 }
        ?>
 
			</div>
			<?php 
    }
}
//postshare
echo getPostShare(get_custom_option('set_post_info', null, $post_data['post_id']), $post_data);
//pass end
?>

		</article>

		<?php 
require get_template_directory() . '/templates/page-part-reviews-block.php';
//editor
if (!$post_data['post_protected'] && $post_data['post_edit_enable']) {
    require themerex_get_file_dir('/templates/page-part-editor-area.php');
}
?>
		
	</section>

	<?php 
if (!$post_data['post_protected']) {
    require get_template_directory() . '/templates/page-part-author-info.php';
    require get_template_directory() . '/templates/page-part-related-posts.php';
    require get_template_directory() . '/templates/page-part-comments.php';
}
require get_template_directory() . '/templates/page-part-views-counter.php';
echo $main_div ? '</div>' : '';
Ejemplo n.º 15
0
<?php 
}
?>
	<link rel="profile" href="http://gmpg.org/xfn/11" />
	<link rel="pingback" href="<?php 
bloginfo('pingback_url');
?>
" />
    <?php 
$favicon = get_custom_option('favicon');
if (!$favicon) {
    $skin = themerex_escape_shell_cmd(get_custom_option('theme_skin'));
    if (file_exists(themerex_get_file_dir('/skins/' . $skin . '/images/favicon.ico'))) {
        $favicon = themerex_get_file_url('/skins/' . $skin . '/images/favicon.ico');
    }
    if (!$favicon && file_exists(themerex_get_file_dir('favicon.ico'))) {
        $favicon = themerex_get_file_url('favicon.ico');
    }
}
if ($favicon) {
    ?>
		<link rel="icon" type="image/x-icon" href="<?php 
    echo esc_attr($favicon);
    ?>
" />
    <?php 
}
?>
	<!--[if lt IE 9]>
	<script src="<?php 
echo themerex_get_file_url('/js/html5.js');
Ejemplo n.º 16
0
function theme_skin_add_scripts_classter()
{
    if (file_exists(themerex_get_file_dir('/skins/general/general.js'))) {
        themerex_enqueue_script('theme-skin-script', themerex_get_file_url('/skins/general/general.js'), array('main-style'), null);
    }
}
Ejemplo n.º 17
0
function spotlight_register_required_plugins()
{
    /**
     * Array of plugin arrays. Required keys are name and slug.
     * If the source is NOT from the .org repo, then source is also required.
     */
    $plugins = array(array('name' => 'Awesome weather widget', 'slug' => 'awesome-weather', 'required' => false, 'source' => themerex_get_file_dir('/plugins/awesome-weather.zip'), 'version' => '1.4.1', 'force_activation' => false, 'force_deactivation' => false, 'external_url' => ''), array('name' => 'Instagram Widget', 'slug' => 'wp-instagram-widget', 'required' => false, 'source' => themerex_get_file_dir('/plugins/wp-instagram-widget.zip'), 'version' => '1.3.1', 'force_activation' => false, 'force_deactivation' => false, 'external_url' => ''), array('name' => 'Themerex Banner Manager', 'slug' => 'trex-banner-manager', 'required' => false, 'source' => themerex_get_file_dir('/plugins/themerex-banner-manager.zip'), 'version' => '1.0', 'force_activation' => false, 'force_deactivation' => false, 'external_url' => ''), array('name' => 'Woocommerce', 'slug' => 'woocommerce', 'required' => false, 'force_activation' => false, 'force_deactivation' => false, 'external_url' => ''), array('name' => 'JScomposer', 'slug' => 'js_composer', 'source' => themerex_get_file_dir('/plugins/js_composer.zip'), 'required' => false), array('name' => 'Revolution Slider', 'slug' => 'revslider', 'source' => themerex_get_file_dir('/plugins/revslider.zip'), 'required' => false));
    // Change this to your theme text domain, used for internationalising strings
    $theme_text_domain = 'themerex';
    /**
     * Array of configuration settings. Amend each line as needed.
     * If you want the default strings to be available under your own theme domain,
     * leave the strings uncommented.
     * Some of the strings are added into a sprintf, so see the comments at the
     * end of each line for what each argument will be.
     */
    $config = array('default_path' => '', 'menu' => 'tgmpa-install-plugins', 'has_notices' => true, 'dismissable' => true, 'dismiss_msg' => '', 'is_automatic' => false, 'message' => '', 'strings' => array('page_title' => __('Install Required Plugins', 'tgmpa'), 'menu_title' => __('Install Plugins', 'tgmpa'), 'installing' => __('Installing Plugin: %s', 'tgmpa'), 'oops' => __('Something went wrong with the plugin API.', 'tgmpa'), 'notice_can_install_required' => _n_noop('This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.'), 'notice_can_install_recommended' => _n_noop('This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.'), 'notice_cannot_install' => _n_noop('Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.'), 'notice_can_activate_required' => _n_noop('The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.'), 'notice_can_activate_recommended' => _n_noop('The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.'), 'notice_cannot_activate' => _n_noop('Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.'), 'notice_ask_to_update' => _n_noop('The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.'), 'notice_cannot_update' => _n_noop('Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.'), 'install_link' => _n_noop('Begin installing plugin', 'Begin installing plugins'), 'activate_link' => _n_noop('Begin activating plugin', 'Begin activating plugins'), 'return' => __('Return to Required Plugins Installer', 'tgmpa'), 'plugin_activated' => __('Plugin activated successfully.', 'tgmpa'), 'complete' => __('All plugins installed and activated successfully. %s', 'tgmpa'), 'nag_type' => 'updated'));
    tgmpa($plugins, $config);
}
Ejemplo n.º 18
0
function sc_slider($atts, $content = null)
{
    if (in_shortcode_blogger()) {
        return '';
    }
    extract(shortcode_atts(array("id" => "", "class" => "", "engine" => get_custom_option('substitute_slider_engine'), "chop_effect" => "", "alias" => "", "ids" => "", "cat" => "", "count" => "0", "offset" => "", "orderby" => "date", "order" => 'desc', "border" => "none", "controls" => "no", "pagination" => "no", "titles" => "no", "descriptions" => get_custom_option('slider_descriptions'), "links" => "no", "align" => "", "interval" => "", "date_format" => "", "crop" => "on", "width" => "", "height" => "", "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts));
    global $THEMEREX_sc_slider_engine, $THEMEREX_sc_slider_width, $THEMEREX_sc_slider_height, $THEMEREX_sc_slider_links;
    if (empty($width)) {
        $width = "100%";
    }
    if (empty($interval)) {
        $interval = mt_rand(5000, 10000);
    }
    if ($engine == 'chop' && !file_exists(themerex_get_file_dir('/js/chopslider/jquery.id.chopslider-2.0.0.free.min.js'))) {
        $engine = 'swiper';
    }
    if ($engine == 'chop' && empty($chop_effect)) {
        $effects2D = array("vertical", "horizontal", "half", "multi");
        $effects3D = array("3DBlocks", "3DFlips");
        $chop_effect = $effects2D[min(3, mt_rand(0, 3))] . '|' . $effects3D[min(1, mt_rand(0, 1))];
    }
    $THEMEREX_sc_slider_engine = $engine;
    $THEMEREX_sc_slider_width = getStyleValue($width);
    $THEMEREX_sc_slider_height = getStyleValue($height);
    $THEMEREX_sc_slider_links = sc_param_is_on($links);
    if (empty($id)) {
        $id = "sc_slider_" . str_replace('.', '', mt_rand());
    }
    $ms = getStyleString($top, $right, $bottom, $left);
    $ws = getStyleString('', '', '', '', $width);
    $hs = getStyleString('', '', '', '', '', $height);
    $s = ($border == 'none' && !in_array($pagination, array('full', 'over')) ? $ms : '') . $hs . $ws;
    if ($border != 'none' && in_array($pagination, array('full', 'over'))) {
        $pagination = 'yes';
    }
    if ($engine != 'flex' && $engine != 'chop' && $engine != 'swiper' && in_array($pagination, array('full', 'over'))) {
        $pagination = 'yes';
    }
    $output = ($border != 'none' ? '<div class="sc_border sc_border_' . $border . ($align != '' && $align != 'none' ? ' sc_align' . $align : '') . '"' . ($ms . $hs ? ' style="' . $ms . $hs . '"' : '') . '>' : '') . (in_array($pagination, array('full', 'over')) ? '<div class="sc_slider_pagination_area sc_slider_pagination_' . $pagination . '"' . ($ms . $hs ? ' style="' . $ms . $hs . '"' : '') . '>' : '') . '<div' . ($id ? ' id="' . $id . '"' : '') . ' class="sc_slider' . (!empty($class) ? ' ' . $class : '') . ' sc_slider_' . $engine . (sc_param_is_on($controls) ? ' sc_slider_controls' : ' sc_slider_nocontrols') . (sc_param_is_on($pagination) ? ' sc_slider_pagination' : ' sc_slider_nopagination') . ($border == 'none' && $align != '' && $align != 'none' ? ' sc_align' . $align : '') . ($engine == 'swiper' ? ' swiper-slider-container' : '') . '"' . ((int) $interval > 0 ? ' data-interval="' . $interval . '"' : '') . ($engine == 'chop' ? ' data-effect="' . $chop_effect . '"' : '') . ($s != '' ? ' style="' . $s . '"' : '') . '>';
    $pagination_items = '';
    if ($engine == 'revo') {
        if (revslider_exists() && !empty($alias)) {
            $output .= do_shortcode('[rev_slider ' . $alias . ']');
        } else {
            $output = '';
        }
    } else {
        if ($engine == 'royal') {
            if (royalslider_exists() && !empty($alias)) {
                $output .= do_shortcode('[[new_royalslider id="' . $alias . '"]');
            } else {
                $output = '';
            }
        } else {
            if ($engine == 'flex' || $engine == 'chop' || $engine == 'swiper') {
                $imageAsBackground = $engine != 'chop';
                $caption = '';
                $output .= '<ul class="slides' . ($engine == 'swiper' ? ' swiper-wrapper' : '') . '">';
                $content = do_shortcode($content);
                if ($content) {
                    $output .= $content;
                } else {
                    global $post;
                    if (!empty($ids)) {
                        $posts = explode(',', $ids);
                        $count = count($posts);
                    }
                    $args = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $count, 'ignore_sticky_posts' => 1, 'order' => $order == 'asc' ? 'asc' : 'desc');
                    if ($offset > 0 && empty($ids)) {
                        $args['offset'] = $offset;
                    }
                    $args = addSortOrderInQuery($args, $orderby, $order);
                    $args = addFiltersInQuery($args, array('thumbs'));
                    $args = addPostsAndCatsInQuery($args, $ids, $cat);
                    $query = new WP_Query($args);
                    $numSlide = 0;
                    while ($query->have_posts()) {
                        $query->the_post();
                        $numSlide++;
                        $post_id = get_the_ID();
                        $post_title = get_the_title();
                        $post_link = get_permalink();
                        $post_date = get_the_date(!empty($date_format) ? $date_format : 'd.m.y');
                        $post_attachment = wp_get_attachment_url(get_post_thumbnail_id($post_id));
                        if (sc_param_is_on($crop)) {
                            $post_attachment = $imageAsBackground ? getResizedImageURL($post_attachment, !empty($width) && themerex_strpos($width, '%') === false ? $width : null, !empty($height) && themerex_strpos($height, '%') === false ? $height : null) : getResizedImageTag($post_attachment, !empty($width) && themerex_strpos($width, '%') === false ? $width : null, !empty($height) && themerex_strpos($height, '%') === false ? $height : null);
                        } else {
                            if (!$imageAsBackground) {
                                $post_attachment = '<img src="' . $post_attachment . '" alt="">';
                            }
                        }
                        $post_accent_color = '';
                        $post_category = '';
                        $post_category_link = '';
                        if (in_array($pagination, array('full', 'over'))) {
                            // Get all post's tags
                            $post_tags_links = '';
                            if (($post_tags_list = get_the_tags()) != 0) {
                                $tag_number = 0;
                                foreach ($post_tags_list as $tag) {
                                    $tag_number++;
                                    $post_tags_links .= '<span class="slide_tag">' . $tag->name . ($tag_number == count($post_tags_list) ? '' : ',') . '</span> ';
                                }
                            }
                            $pagination_items .= '<li' . (empty($pagination_items) ? ' class="' . ($engine == 'chop' ? 'cs-active-pagination' : 'active') . '"' : '') . '>' . '<div class="slide_pager">' . '<div class="slide_date">' . $post_date . '</div>' . '<div class="slide_info">' . '<h4 class="slide_title">' . $post_title . '</h4>' . '<div class="slide_tags">' . $post_tags_links . '</div>' . '</div>' . '</div>' . '</li>';
                        }
                        $output .= '<li' . ' class="' . $engine . '-slide' . ($engine == 'chop' && $numSlide == 1 ? ' cs-activeSlide' : '') . '"' . ' style="' . ($engine == 'chop' && $numSlide == 1 ? 'display:block;' : '') . ($imageAsBackground ? 'background-image:url(' . $post_attachment . ');' : '') . $ws . $hs . '"' . '>' . (sc_param_is_on($links) ? '<a href="' . $post_link . '" title="' . htmlspecialchars($post_title) . '">' : '') . (!$imageAsBackground ? $post_attachment : '');
                        $caption = $engine == 'swiper' || $engine == 'flex' ? '' : $caption;
                        if (!sc_param_is_off($titles)) {
                            $post_hover_bg = get_custom_option('theme_color', null, $post_id);
                            $post_bg = '';
                            if ($post_hover_bg != '' && !is_inherit_option($post_hover_bg)) {
                                $rgb = Hex2RGB($post_hover_bg);
                                $post_hover_ie = str_replace('#', '', $post_hover_bg);
                                $post_bg = "background-color: rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},0.8);";
                            }
                            $caption .= ($engine == 'chop' ? '<div class="sc_slider_info_item">' : '') . '<div class="sc_slider_info' . ($titles == 'fixed' ? ' sc_slider_info_fixed' : '') . ($engine == 'swiper' ? ' content-slide' : '') . '"' . ($post_bg != '' ? ' style="' . $post_bg . '"' : '') . '>';
                            $post_descr = getPostDescription();
                            if (get_custom_option("slider_info_category") == 'yes') {
                                // || empty($cat)) {
                                // Get all post's categories
                                $post_categories = getCategoriesByPostId($post_id);
                                $post_categories_str = '';
                                for ($i = 0; $i < count($post_categories); $i++) {
                                    if ($post_category == '') {
                                        if (get_theme_option('close_category') == 'parental') {
                                            $parent_cat_id = 0;
                                            //(int) get_custom_option('category_id');
                                            $parent_cat = getParentCategory($post_categories[$i]['term_id'], $parent_cat_id);
                                            if ($parent_cat) {
                                                $post_category = $parent_cat['name'];
                                                $post_category_link = $parent_cat['link'];
                                                if ($post_accent_color == '') {
                                                    $post_accent_color = get_category_inherited_property($parent_cat['term_id'], 'theme_color');
                                                }
                                            }
                                        } else {
                                            $post_category = $post_categories[$i]['name'];
                                            $post_category_link = $post_categories[$i]['link'];
                                            if ($post_accent_color == '') {
                                                $post_accent_color = get_category_inherited_property($post_categories[$i]['term_id'], 'theme_color');
                                            }
                                        }
                                    }
                                    if ($post_category != '' && $post_accent_color != '') {
                                        break;
                                    }
                                }
                                if ($post_category == '' && count($post_categories) > 0) {
                                    $post_category = $post_categories[0]['name'];
                                    $post_category_link = $post_categories[0]['link'];
                                    if ($post_accent_color == '') {
                                        $post_accent_color = get_category_inherited_property($post_categories[0]['term_id'], 'theme_color');
                                    }
                                }
                                if ($post_category != '') {
                                    $caption .= '<div class="sc_slider_category"' . (themerex_substr($post_accent_color, 0, 1) == '#' ? ' style="background-color: ' . $post_accent_color . '"' : '') . '><a href="' . $post_category_link . '">' . $post_category . '</a></div>';
                                }
                            }
                            $output_reviews = '';
                            if (get_custom_option('show_reviews') == 'yes' && get_custom_option('slider_reviews') == 'yes') {
                                $avg_author = marksToDisplay(get_post_meta($post_id, 'reviews_avg' . (get_theme_option('reviews_first') == 'author' && $orderby != 'users_rating' || $orderby == 'author_rating' ? '' : '2'), true));
                                if ($avg_author > 0) {
                                    $output_reviews .= '<div class="sc_slider_reviews reviews_summary blog_reviews' . (get_custom_option("slider_info_category") == 'yes' ? ' after_category' : '') . '">' . '<div class="criteria_summary criteria_row">' . getReviewsSummaryStars($avg_author) . '</div>' . '</div>';
                                }
                            }
                            if (get_custom_option("slider_info_category") == 'yes') {
                                $caption .= $output_reviews;
                            }
                            $caption .= '<h2 class="sc_slider_subtitle"><a href="' . $post_link . '">' . $post_title . '</a></h2>';
                            if (get_custom_option("slider_info_category") != 'yes') {
                                $caption .= $output_reviews;
                            }
                            if ($descriptions > 0) {
                                $caption .= '<div class="sc_slider_descr">' . getShortString($post_descr, $descriptions) . '</div>';
                            }
                            $caption .= '</div>' . ($engine == 'chop' ? '</div>' : '');
                        }
                        $output .= ($engine == 'swiper' || $engine == 'flex' ? $caption : '') . (sc_param_is_on($links) ? '</a>' : '') . '</li>';
                    }
                    wp_reset_postdata();
                }
                $output .= '</ul>';
                if ($engine == 'swiper' || $engine == 'chop') {
                    if (sc_param_is_on($controls)) {
                        $output .= '
					<ul class="flex-direction-nav">
					<li><a class="flex-prev" href="#"></a></li>
					<li><a class="flex-next" href="#"></a></li>
					</ul>';
                    }
                    if (sc_param_is_on($pagination)) {
                        $output .= '<div class="flex-control-nav"></div>';
                    }
                }
                if ($engine == 'chop') {
                    $output .= '
				<div class="sc_slider_info_slides">' . $caption . '</div>
				<div class="sc_slider_info_holder"></div>
				';
                }
            } else {
                $output = '';
            }
        }
    }
    if (!empty($output)) {
        $output .= '</div>' . ($border != 'none' ? '</div>' : '');
        if ($pagination_items) {
            $output .= '
				<div class="flex-control-nav manual"' . ($hs ? ' style="' . $hs . '"' : '') . '>
					<div id="' . $id . '_scroll" class="sc_scroll sc_scroll_vertical swiper-slider-container scroll-container"' . ($hs ? ' style="' . $hs . '"' : '') . '>
						<div class="sc_scroll_wrapper swiper-wrapper">
							<div class="sc_scroll_slide swiper-slide">
								<ul>' . $pagination_items . '</ul>
							</div>
						</div>
						<div id="' . $id . '_scroll_bar" class="sc_scroll_bar sc_scroll_bar_vertical"></div>
					</div>
				</div>';
            $output .= '</div>';
        }
    }
    return $output;
}
Ejemplo n.º 19
0
    }
    ?>
		</div>
	
		<?php 
    if (get_custom_option('blog_counters') != 'none') {
        ?>
			<div class="relatedMore">
				<?php 
        $postinfo_buttons = array('more', 'comments');
        if ($opt['posts_visible'] < 3) {
            $postinfo_buttons[] = 'views';
        }
        /*
        if ($opt['posts_visible'] < 3) {
        	$postinfo_buttons[] = 'likes';
        	$postinfo_buttons[] = 'share';
        }
        */
        require themerex_get_file_dir('/templates/page-part-postinfo.php');
        ?>
			</div>
		<?php 
    }
    ?>
	<?php 
}
?>

</article>
Ejemplo n.º 20
0
    /**
     * How to display the widget on the screen.
     */
    function widget($args, $instance)
    {
        extract($args);
        global $wp_query, $post;
        global $THEMEREX_CURRENT_SIDEBAR;
        /* Our variables from the widget settings. */
        $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : '');
        $title_tabs = array(apply_filters('widget_title', isset($instance['title_author']) ? $instance['title_author'] : ''), apply_filters('widget_title', isset($instance['title_users']) ? $instance['title_users'] : ''));
        $number = isset($instance['number']) ? (int) $instance['number'] : '';
        $show_date = isset($instance['show_date']) ? (int) $instance['show_date'] : 0;
        $show_image = isset($instance['show_image']) ? (int) $instance['show_image'] : 0;
        $show_author = isset($instance['show_author']) ? (int) $instance['show_author'] : 0;
        $show_counters = isset($instance['show_counters']) ? (int) $instance['show_counters'] : 0;
        $category = isset($instance['category']) ? (int) $instance['category'] : 0;
        $show_counters = $show_counters == 2 ? 'stars' : ($show_counters == 1 ? 'rating' : '');
        $output = '';
        $tabs = array();
        if ($THEMEREX_CURRENT_SIDEBAR == 'top') {
            $output .= '<div class="columnsWrap">';
        }
        $reviews_first_author = get_theme_option('reviews_first') == 'author';
        $reviews_second_hide = get_theme_option('reviews_second') == 'hide';
        $rnd = str_replace('.', '', mt_rand());
        for ($i = 0; $i < 2; $i++) {
            if ($i == 0 && !$reviews_first_author && $reviews_second_hide) {
                continue;
            }
            if ($i == 1 && $reviews_first_author && $reviews_second_hide) {
                continue;
            }
            $post_rating = 'reviews_avg' . ($i == 0 ? '' : '2');
            $args = array('post_type' => 'post', 'post_status' => current_user_can('read_private_pages') && current_user_can('read_private_posts') ? array('publish', 'private') : 'publish', 'post_password' => '', 'posts_per_page' => $number, 'ignore_sticky_posts' => 1, 'order' => 'DESC', 'orderby' => 'meta_value_num', 'meta_key' => $post_rating);
            if ($category > 0) {
                $args['cat'] = $category;
            }
            $ex = get_theme_option('exclude_cats');
            if (!empty($ex)) {
                $args['category__not_in'] = explode(',', $ex);
            }
            query_posts($args);
            /* Loop posts */
            if (have_posts()) {
                if ($THEMEREX_CURRENT_SIDEBAR == 'top') {
                    $output .= '
						<div class="tab_content columns1_2" id="widget_top10_' . $i . '">
							<h2 class="widgetSubtitle">' . $title_tabs[$i] . '</h2>
					';
                } else {
                    $tabs[$i] = '<li class="squareButtonlite"><a href="#widget_top10_' . $rnd . '_' . $i . '">' . $title_tabs[$i] . '</a></li>';
                    $output .= '
						<div class="tab_content" id="widget_top10_' . $rnd . '_' . $i . '"' . ($i == 1 && !$output ? ' style="display: block;"' : '') . '>
					';
                }
                $post_number = 0;
                while (have_posts()) {
                    the_post();
                    $post_number++;
                    require themerex_get_file_dir('/templates/page-part-widgets-posts.php');
                    if ($post_number >= $number) {
                        break;
                    }
                }
                $output .= '
					</div>
				';
            }
        }
        if ($THEMEREX_CURRENT_SIDEBAR == 'top') {
            $output .= '</div>';
        }
        /* Restore main wp_query and current post data in the global var $post */
        wp_reset_query();
        wp_reset_postdata();
        if (!empty($output)) {
            if (!$reviews_second_hide) {
                themerex_enqueue_script('jquery-ui-tabs', false, array('jquery', 'jquery-ui-core'), null, true);
            }
            /* Before widget (defined by themes). */
            echo $before_widget;
            /* Display the widget title if one was input (before and after defined by themes). */
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            echo '
				<div class="top10_tabs' . ($THEMEREX_CURRENT_SIDEBAR == 'top' ? '' : ' tabs_area') . '">' . (!$reviews_second_hide && $THEMEREX_CURRENT_SIDEBAR != 'top' ? '<ul class="tabs">' . ($reviews_first_author ? $tabs[0] . $tabs[1] : $tabs[1] . $tabs[0]) . '</ul>' : '') . $output . '
				</div>
			';
            /* After widget (defined by themes). */
            echo $after_widget;
        }
    }