예제 #1
0
 /**
  * Fields settings
  */
 static function field_settings()
 {
     $prefix = 'field-';
     $prefix2 = 'show-' . $prefix;
     $result = array(array('label' => array('text' => ''), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_Html::html_group_class(), 'width' => 12)), 'params' => array(array('type' => 'group', 'params' => PT_CV_Settings::field_display_settings()))), !get_option('pt_cv_version_pro') ? array('label' => array('text' => ''), 'extra_setting' => array('params' => array('width' => 12)), 'params' => array(array('type' => 'html', 'content' => sprintf('<p class="text-muted" style="margin-top: -10px; margin-bottom: 15px;">&rarr; %s</p>', __('Customize display order of above fields by a simple drag-and-drop ?', PT_CV_DOMAIN) . sprintf(' <a href="%s" target="_blank">%s</a>', esc_url('http://www.contentviewspro.com/pricing/?utm_source=client&utm_medium=view'), __('Please upgrade to Pro', PT_CV_DOMAIN)))))) : '', apply_filters(PT_CV_PREFIX_ . 'settings_title_display', array(), $prefix, $prefix2), array('label' => array('text' => __('Thumbnail settings', PT_CV_DOMAIN)), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_Html::html_group_class() . ' ' . PT_CV_PREFIX . 'thumbnail-setting' . ' ' . PT_CV_PREFIX . 'w50')), 'params' => array(array('type' => 'group', 'params' => PT_CV_Settings::field_thumbnail_settings($prefix))), 'dependence' => array($prefix2 . 'thumbnail', 'yes')), array('label' => array('text' => __('Content settings', PT_CV_DOMAIN)), 'params' => array(array('type' => 'radio', 'name' => $prefix . 'content-show', 'options' => array('full' => __('Show Full Content', PT_CV_DOMAIN), 'excerpt' => __('Show Excerpt', PT_CV_DOMAIN)), 'std' => 'excerpt')), 'dependence' => array($prefix2 . 'content', 'yes')), array('label' => array('text' => ''), 'extra_setting' => array('params' => array('wrap-id' => PT_CV_Html::html_group_id('excerpt-settings'))), 'params' => array(array('type' => 'group', 'params' => apply_filters(PT_CV_PREFIX_ . 'excerpt_settings', array(array('label' => array('text' => __('Excerpt settings', PT_CV_DOMAIN)), 'extra_setting' => array('params' => array('width' => 9)), 'params' => array(array('type' => 'number', 'name' => $prefix . 'excerpt-length', 'std' => '20', 'placeholder' => 'e.g. 20', 'append_text' => 'words', 'desc' => __('Generating excerpt by selecting the first X words of the content', PT_CV_DOMAIN)))), array('label' => array('text' => ''), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_PREFIX . 'full-fields', 'width' => 9)), 'params' => array(array('type' => 'checkbox', 'name' => $prefix . 'excerpt-allow_html', 'options' => PT_CV_Values::yes_no('yes', __('Allow HTML tags (a, br, strong, em, strike, i, ul, ol, li) in excerpt', PT_CV_DOMAIN)), 'std' => '', 'desc' => __('This option can cause broken HTML output. Please be careful when check it', PT_CV_DOMAIN))))), $prefix . 'excerpt-'))), 'dependence' => array(array($prefix . 'content-show', 'excerpt'))), array('label' => array('text' => __('Meta fields settings', PT_CV_DOMAIN)), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_Html::html_group_class() . ' ' . PT_CV_PREFIX . 'meta-fields-settings')), 'params' => array(array('type' => 'group', 'params' => PT_CV_Settings::field_meta_fields('meta-fields-'), 'desc' => apply_filters(PT_CV_PREFIX_ . 'settings_sort_text', ''))), 'dependence' => array($prefix2 . 'meta-fields', 'yes')), apply_filters(PT_CV_PREFIX_ . 'settings_taxonomies_display', array(), 'meta-fields-'));
     $result = apply_filters(PT_CV_PREFIX_ . 'field_settings', $result, $prefix2);
     return $result;
 }
예제 #2
0
 /**
  * Fields settings
  */
 static function field_settings()
 {
     $prefix = 'field-';
     $prefix2 = 'show-' . $prefix;
     $result = array(array('label' => array('text' => ''), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_Html::html_group_class(), 'width' => 12)), 'params' => array(array('type' => 'group', 'params' => PT_CV_Settings::field_display_settings()))), !get_option('pt_cv_version_pro') ? PT_CV_Settings::get_cvpro(__('Display Title above Thumbnail ?', PT_CV_TEXTDOMAIN), 12, 'margin-top: -15px; margin-bottom: 5px;') : '', apply_filters(PT_CV_PREFIX_ . 'settings_title_display', array(), $prefix, $prefix2), array('label' => array('text' => __('Thumbnail settings', PT_CV_TEXTDOMAIN)), 'extra_setting' => array('params' => array('group-class' => PT_CV_PREFIX . 'field-setting', 'wrap-class' => PT_CV_Html::html_group_class() . ' ' . PT_CV_PREFIX . 'thumbnail-setting' . ' ' . PT_CV_PREFIX . 'w50')), 'params' => array(array('type' => 'group', 'params' => PT_CV_Settings::field_thumbnail_settings($prefix))), 'dependence' => array($prefix2 . 'thumbnail', 'yes')), array('label' => array('text' => __('Content settings', PT_CV_TEXTDOMAIN)), 'extra_setting' => array('params' => array('group-class' => PT_CV_PREFIX . 'field-setting' . ' ' . PT_CV_PREFIX . 'content-setting')), 'params' => array(array('type' => 'radio', 'name' => $prefix . 'content-show', 'options' => array('full' => __('Show Full Content', PT_CV_TEXTDOMAIN), 'excerpt' => __('Show Excerpt', PT_CV_TEXTDOMAIN)), 'std' => 'excerpt')), 'dependence' => array($prefix2 . 'content', 'yes')), array('label' => array('text' => ''), 'extra_setting' => array('params' => array('group-class' => PT_CV_PREFIX . 'field-setting' . ' ' . PT_CV_PREFIX . 'excerpt-setting', 'wrap-id' => PT_CV_Html::html_group_id('excerpt-settings'))), 'params' => array(array('type' => 'group', 'params' => apply_filters(PT_CV_PREFIX_ . 'excerpt_settings', array(array('label' => array('text' => __('Excerpt settings', PT_CV_TEXTDOMAIN)), 'params' => array(array('type' => 'number', 'name' => $prefix . 'excerpt-length', 'std' => '20', 'placeholder' => 'e.g. 20', 'append_text' => 'words', 'desc' => __('Generating excerpt by selecting the first X words of the content', PT_CV_TEXTDOMAIN)))), !get_option('pt_cv_version_pro') ? PT_CV_Settings::get_cvpro(__('Use manual excerpt, change "Read More" text ?', PT_CV_TEXTDOMAIN), 9) : '', array('label' => array('text' => ''), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_PREFIX . 'full-fields')), 'params' => array(array('type' => 'checkbox', 'name' => $prefix . 'excerpt-allow_html', 'options' => PT_CV_Values::yes_no('yes', __('Allow HTML tags (a, br, strong, em, strike, i, ul, ol, li) in excerpt', PT_CV_TEXTDOMAIN)), 'std' => '')))), $prefix . 'excerpt-'))), 'dependence' => array(array($prefix . 'content-show', 'excerpt'))), array('label' => array('text' => __('Meta fields settings', PT_CV_TEXTDOMAIN)), 'extra_setting' => array('params' => array('group-class' => PT_CV_PREFIX . 'field-setting' . ' ' . PT_CV_PREFIX . 'metafield-setting', 'wrap-class' => PT_CV_Html::html_group_class() . ' ' . PT_CV_PREFIX . 'meta-fields-settings')), 'params' => array(array('type' => 'group', 'params' => PT_CV_Settings::field_meta_fields('meta-fields-'), 'desc' => apply_filters(PT_CV_PREFIX_ . 'settings_sort_text', ''))), 'dependence' => array($prefix2 . 'meta-fields', 'yes')), apply_filters(PT_CV_PREFIX_ . 'settings_taxonomies_display', array(), 'meta-fields-'));
     $result = apply_filters(PT_CV_PREFIX_ . 'field_settings', $result, $prefix2);
     return $result;
 }
예제 #3
0
        /**
         * Print inline js
         */
        public static function print_js()
        {
            $toggle_data_js = json_encode(self::$dependence_info);
            ?>
			<script>
				( function ( $ ) {
					"use strict";

					$( function () {
						var _prefix = '<?php 
            echo esc_js(PT_CV_PREFIX);
            ?>
';
						var $pt_cv_admin_js = new $.PT_CV_Admin( { _prefix: _prefix } );
						var group_prefix = '<?php 
            echo esc_js(PT_CV_Html::html_group_class());
            ?>
' + '-';

						// Preview actions
						$pt_cv_admin_js.preview( '<?php 
            echo balanceTags(wp_create_nonce(PT_CV_PREFIX_ . 'ajax_nonce'));
            ?>
' );

						// Custom js
						$pt_cv_admin_js.custom();

						// Toggle Panel group of 'Advance Settings'
						$pt_cv_admin_js.toggle_group( '.' + _prefix + 'advanced-settings-item', group_prefix );
						// Toggle Panel group of 'Terms' (in "Taxonomy Settings")
						$pt_cv_admin_js.toggle_group( '.' + _prefix + 'taxonomy-item', group_prefix );
						// Toggle Panel group of 'Advanced Order by'
						$pt_cv_admin_js.toggle_group( '[name="' + _prefix + 'content-type' + '"]', group_prefix );
						// Toggle Panel group of 'View type settings'
						$pt_cv_admin_js.toggle_group( '[name="' + _prefix + 'view-type' + '"]', group_prefix );

						// Toggle dependence
						$pt_cv_admin_js.dependence_do_all( '<?php 
            echo balanceTags($toggle_data_js);
            ?>
' );

						$pt_cv_admin_js.multi_level_toggle();
					} );
				}( jQuery ) );
			</script>
			<?php 
        }
 /**
  * Final output of View: HTML & Assets
  *
  * @param string $html
  */
 static function view_final_output($html)
 {
     global $pt_cv_id, $pt_cv_sub_id;
     //DEBUG_STYLE
     $view_assets = '';
     if ($pt_cv_id == $pt_cv_sub_id) {
         // Print View assets
         ob_start();
         PT_CV_Html::assets_of_view_types();
         $view_assets = ob_get_clean();
     }
     return $html . $view_assets;
 }
 /**
  * Register and enqueue admin-specific JavaScript.
  *
  * @since     1.0.0
  *
  * @return    null    Return early if no settings page is registered.
  */
 public function enqueue_admin_scripts()
 {
     if (!isset($this->plugin_screen_hook_suffix)) {
         return;
     }
     $screen = get_current_screen();
     if ($this->plugin_screen_hook_suffix == $screen->id || in_array($screen->id, $this->plugin_sub_screen_hook_suffix)) {
         // WP assets
         wp_enqueue_script('wp-color-picker');
         wp_enqueue_script('jquery-ui-sortable');
         // Main admin script
         PT_CV_Asset::enqueue('admin', 'script', array('src' => plugins_url('assets/js/admin.js', __FILE__), 'deps' => array('jquery')));
         // Localize strings
         PT_CV_Asset::localize_script('admin', PT_CV_PREFIX_UPPER . 'ADMIN', array('_prefix' => PT_CV_PREFIX, '_group_prefix' => PT_CV_Html::html_group_class() . '-', '_nonce' => wp_create_nonce(PT_CV_PREFIX_ . 'ajax_nonce'), 'supported_version' => PT_CV_Functions::wp_version_compare('3.5'), 'text' => array('no_taxonomy' => __('There is no taxonomy for selected content type', 'content-views-query-and-display-post-page'), 'pagination_disable' => __('Pagination is disabled when Limit = -1', 'content-views-query-and-display-post-page'), 'prevent_click' => __('Opening a link is prevented in preview box', 'content-views-query-and-display-post-page')), 'btn' => array('preview' => array('show' => __('Show Preview', 'content-views-query-and-display-post-page'), 'hide' => __('Hide Preview', 'content-views-query-and-display-post-page'), 'update' => __('Update Preview', 'content-views-query-and-display-post-page'))), 'data' => array('post_types_vs_taxonomies' => PT_CV_Values::post_types_vs_taxonomies())));
         // Bootstrap for Admin
         PT_CV_Asset::enqueue('bootstrap-admin', 'script', array('src' => plugins_url('assets/bootstrap/js/bootstrap.full.js', PT_CV_FILE)));
         // For Preview
         PT_CV_Html::frontend_scripts();
         PT_CV_Asset::enqueue('select2');
     }
 }
예제 #6
0
 /**
  * HTML output of meta fields group
  *
  * @param object $post  The post object
  * @param array  $fargs The settings of this field
  *
  * @return string
  */
 static function _field_meta($post, $fargs)
 {
     $html = array();
     // Sets up global post data
     setup_postdata($post);
     foreach ($fargs as $meta => $val) {
         if (!$val) {
             continue;
         }
         switch ($meta) {
             case 'date':
                 // Get date wrapper class
                 $date_class = apply_filters(PT_CV_PREFIX_ . 'field_meta_class', 'entry-date', 'date');
                 $prefix_text = apply_filters(PT_CV_PREFIX_ . 'field_meta_prefix_text', '', 'date');
                 $date = apply_filters(PT_CV_PREFIX_ . 'field_meta_date_final', get_the_date('', $post), get_the_time('U'));
                 $html['date'] = sprintf('<span class="%s">%s <time datetime="%s">%s</time></span>', esc_html($date_class), balanceTags($prefix_text), esc_attr(get_the_date('c')), esc_html($date));
                 break;
             case 'taxonomy':
                 // Get terms wrapper class
                 $term_class = apply_filters(PT_CV_PREFIX_ . 'field_meta_class', 'terms', 'terms');
                 $prefix_text = apply_filters(PT_CV_PREFIX_ . 'field_meta_prefix_text', __('in', PT_CV_DOMAIN), 'terms');
                 $terms = PT_CV_Functions::post_terms($post);
                 if (!empty($terms)) {
                     $term_html = sprintf('<span class="%s">%s %s</span>', esc_attr($term_class), balanceTags($prefix_text), balanceTags($terms));
                     $html['taxonomy'] = apply_filters(PT_CV_PREFIX_ . 'field_term_html', $term_html, $terms);
                 }
                 break;
             case 'comment':
                 if (!post_password_required() && (comments_open() || get_comments_number())) {
                     // Get comment wrapper class
                     $comment_class = apply_filters(PT_CV_PREFIX_ . 'field_meta_class', 'comments-link', 'comment');
                     $prefix_text = apply_filters(PT_CV_PREFIX_ . 'field_meta_prefix_text', '', 'comment');
                     ob_start();
                     comments_popup_link(__('Leave a comment', PT_CV_DOMAIN), __('1 Comment', PT_CV_DOMAIN), __('% Comments', PT_CV_DOMAIN));
                     $comment_content = ob_get_clean();
                     $html['comment'] = sprintf('<span class="%s">%s %s</span>', esc_attr($comment_class), balanceTags($prefix_text), $comment_content);
                 }
                 break;
             case 'author':
                 // Get author wrapper class
                 $author_class = apply_filters(PT_CV_PREFIX_ . 'field_meta_class', 'author', 'author');
                 $prefix_text = apply_filters(PT_CV_PREFIX_ . 'field_meta_prefix_text', __('by', PT_CV_DOMAIN), 'author');
                 $author_html = sprintf('<span class="%s">%s <a href="%s" rel="author">%s</a></span>', esc_attr($author_class), balanceTags($prefix_text), esc_url(get_author_posts_url(get_the_author_meta('ID'))), get_the_author());
                 $html['author'] = apply_filters(PT_CV_PREFIX_ . 'field_meta_author_html', $author_html, $post);
                 break;
             default:
                 break;
         }
     }
     // Merge fields, or let them as seperate items in array
     $merge_fields = apply_filters(PT_CV_PREFIX_ . 'field_meta_merge_fields', true);
     if ($merge_fields) {
         $result = PT_CV_Html::_field_meta_wrap($html);
     } else {
         $result = $html;
     }
     return $result;
 }
예제 #7
0
?>
filter-settings">
				<?php 
$options = array(array('label' => array('text' => __('Content type', PT_CV_TEXTDOMAIN)), 'params' => array(array('type' => 'radio', 'name' => 'content-type', 'options' => PT_CV_Values::post_types(), 'std' => 'post'))), !get_option('pt_cv_version_pro') ? PT_CV_Settings::get_cvpro(__('Filter custom post type (product, event...) ?', PT_CV_TEXTDOMAIN), 10) : '', apply_filters(PT_CV_PREFIX_ . 'custom_filters', array()), array('label' => array('text' => __('Common filters', PT_CV_TEXTDOMAIN)), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_Html::html_group_class())), 'params' => array(array('type' => 'group', 'params' => array(apply_filters(PT_CV_PREFIX_ . 'sticky_posts_setting', array()), array('label' => array('text' => __('Include only', PT_CV_TEXTDOMAIN)), 'params' => array(array('type' => 'text', 'name' => 'post__in', 'std' => '', 'desc' => apply_filters(PT_CV_PREFIX_ . 'setting_post_in', __('List of post IDs to display (comma-separated values, e.g. 1,2,3)', PT_CV_TEXTDOMAIN))))), apply_filters(PT_CV_PREFIX_ . 'include_extra_settings', array()), array('label' => array('text' => __('Exclude', PT_CV_TEXTDOMAIN)), 'params' => array(array('type' => 'text', 'name' => 'post__not_in', 'std' => '', 'desc' => apply_filters(PT_CV_PREFIX_ . 'setting_post_not_in', __('List of post IDs to exclude (comma-separated values, e.g. 1,2,3)', PT_CV_TEXTDOMAIN))))), apply_filters(PT_CV_PREFIX_ . 'exclude_extra_settings', array()), array('label' => array('text' => __('Parent page', PT_CV_TEXTDOMAIN)), 'params' => array(array('type' => 'number', 'name' => 'post_parent', 'std' => '', 'desc' => __('Enter ID of parent page to query child pages', PT_CV_TEXTDOMAIN))), 'dependence' => array('content-type', 'page')), apply_filters(PT_CV_PREFIX_ . 'post_parent_settings', array()), array('label' => array('text' => __('Limit', PT_CV_TEXTDOMAIN)), 'params' => array(array('type' => 'number', 'name' => 'limit', 'std' => '10', 'min' => '1', 'desc' => __('The number of posts to show. Set empty to show all found posts (which match all filter settings)', PT_CV_TEXTDOMAIN)))), apply_filters(PT_CV_PREFIX_ . 'after_limit_option', PT_CV_Settings::get_cvpro(__('Skip some posts ?', PT_CV_TEXTDOMAIN), 12)))))), array('label' => array('text' => __('Advanced filters', PT_CV_TEXTDOMAIN)), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_Html::html_group_class(), 'wrap-id' => PT_CV_Html::html_group_id('advanced-params'))), 'params' => array(array('type' => 'group', 'params' => array(array('label' => array('text' => ''), 'extra_setting' => array('params' => array('width' => 12)), 'params' => array(array('type' => 'checkbox', 'name' => 'advanced-settings[]', 'options' => PT_CV_Values::advanced_settings(), 'std' => '', 'class' => 'advanced-settings-item'))))))), array('label' => array('text' => ''), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_Html::html_panel_group_class(), 'wrap-id' => PT_CV_Html::html_panel_group_id(PT_CV_Functions::string_random()))), 'params' => array(array('type' => 'panel_group', 'params' => apply_filters(PT_CV_PREFIX_ . 'advanced_settings_panel', array('taxonomy' => array(array('label' => array('text' => __('Taxonomies', PT_CV_TEXTDOMAIN)), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_PREFIX . 'taxonomies')), 'params' => array(array('type' => 'checkbox', 'name' => 'taxonomy[]', 'options' => PT_CV_Values::taxonomy_list(), 'std' => '', 'class' => 'taxonomy-item', 'desc' => __('Tick checkbox of taxonomies to filter posts by their terms', PT_CV_TEXTDOMAIN)))), !get_option('pt_cv_version_pro') ? PT_CV_Settings::get_cvpro(__('Filter by custom taxonomies ?', PT_CV_TEXTDOMAIN), 10) : '', array('label' => array('text' => __('Terms', PT_CV_TEXTDOMAIN)), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_Html::html_panel_group_class() . ' terms', 'wrap-id' => PT_CV_Html::html_panel_group_id(PT_CV_Functions::string_random()))), 'params' => array(array('type' => 'panel_group', 'settings' => array('nice_name' => PT_CV_Values::taxonomy_list()), 'params' => PT_CV_Settings::terms_of_taxonomies()))), array('label' => array('text' => __('Relation', PT_CV_TEXTDOMAIN)), 'params' => array(array('type' => 'select', 'name' => 'taxonomy-relation', 'options' => PT_CV_Values::taxonomy_relation(), 'std' => PT_CV_Functions::array_get_first_key(PT_CV_Values::taxonomy_relation()), 'class' => 'taxonomy-relation', 'desc' => __('Select AND to show posts which match ALL settings of selected taxonomies.<br>Select OR to show posts which match settings of at least one selected taxonomy', PT_CV_TEXTDOMAIN)))), apply_filters(PT_CV_PREFIX_ . 'taxonomies_custom_settings', array())), 'order' => array(array('label' => array('text' => __('Order by', PT_CV_TEXTDOMAIN)), 'extra_setting' => array('params' => array('width' => 12)), 'params' => array(array('type' => 'panel_group', 'settings' => array('show_all' => 1), 'params' => PT_CV_Settings::orderby())))), 'author' => apply_filters(PT_CV_PREFIX_ . 'author_settings', array(array('label' => array('text' => __('Written by', PT_CV_TEXTDOMAIN)), 'params' => array(array('type' => 'select', 'name' => 'author__in[]', 'options' => PT_CV_Values::user_list(), 'std' => '', 'class' => 'select2', 'multiple' => $version_gt_37 ? '1' : '0'))), $version_gt_37 ? array('label' => array('text' => __('Not written by', PT_CV_TEXTDOMAIN)), 'params' => array(array('type' => 'select', 'name' => 'author__not_in[]', 'options' => PT_CV_Values::user_list(), 'std' => '', 'class' => 'select2', 'multiple' => $version_gt_37 ? '1' : '0'))) : array())), 'status' => array(array('label' => array('text' => __('Status', PT_CV_TEXTDOMAIN)), 'params' => array(array('type' => 'select', 'name' => 'post_status', 'options' => PT_CV_Values::post_statuses(), 'std' => 'publish', 'class' => 'select2', 'multiple' => '1', 'desc' => __('Select status of posts', PT_CV_TEXTDOMAIN))))), 'search' => array(array('label' => array('text' => __('Keyword', PT_CV_TEXTDOMAIN)), 'params' => array(array('type' => 'text', 'name' => 's', 'std' => '', 'desc' => __('Enter the keyword to searching for posts.', PT_CV_TEXTDOMAIN) . apply_filters(PT_CV_PREFIX_ . 'searchby_keyword_desc', '')))))))))));
echo PT_Options_Framework::do_settings($options, $settings);
?>
			</div>
			<!-- end Filter Settings -->

			<!-- Display Settings -->
			<div class="tab-pane" id="<?php 
echo esc_attr(PT_CV_PREFIX);
?>
display-settings">
				<?php 
$options = array(array('label' => array('text' => __('View type (Layout)', PT_CV_TEXTDOMAIN)), 'params' => array(array('type' => 'radio', 'name' => 'view-type', 'options' => PT_CV_Values::view_type(), 'std' => PT_CV_Functions::array_get_first_key(PT_CV_Values::view_type())))), array('label' => array('text' => __('View type settings', PT_CV_TEXTDOMAIN)), 'params' => array(array('type' => 'panel_group', 'settings' => array('no_panel' => 1, 'show_only_one' => 1), 'params' => PT_CV_Values::view_type_settings()))), apply_filters(PT_CV_PREFIX_ . 'responsive_settings', array()), array('label' => array('text' => __('Layout format', PT_CV_TEXTDOMAIN)), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_Html::html_group_class())), 'params' => array(array('type' => 'group', 'params' => array(array('label' => array('text' => ''), 'extra_setting' => array('params' => array('width' => 12)), 'params' => array(array('type' => 'radio', 'name' => 'layout-format', 'options' => PT_CV_Values::layout_format(), 'std' => PT_CV_Functions::array_get_first_key(PT_CV_Values::layout_format()), 'desc' => __('This is layout format of output for each post', PT_CV_TEXTDOMAIN)))), array('label' => array('text' => ''), 'extra_setting' => array('params' => array('width' => 12)), 'params' => array(array('type' => 'checkbox', 'name' => 'lf-mobile-disable', 'options' => PT_CV_Values::yes_no('yes', __('Disable 2 columns format on mobile devices & extra small screens', PT_CV_TEXTDOMAIN)), 'std' => '')), 'dependence' => array('layout-format', '2-col')))))), array('label' => array('text' => __('Fields settings', PT_CV_TEXTDOMAIN)), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_Html::html_group_class(), 'wrap-id' => PT_CV_Html::html_group_id('field-settings'))), 'params' => array(array('type' => 'group', 'params' => PT_CV_Settings::field_settings()))), array('label' => array('text' => __('Pagination settings', PT_CV_TEXTDOMAIN)), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_Html::html_group_class())), 'params' => array(array('type' => 'group', 'params' => PT_CV_Settings::settings_pagination()))), array('label' => array('text' => __('Other settings', PT_CV_TEXTDOMAIN)), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_Html::html_group_class())), 'params' => array(array('type' => 'group', 'params' => PT_CV_Settings::settings_other()))));
$options = apply_filters(PT_CV_PREFIX_ . 'display_settings', $options);
echo PT_Options_Framework::do_settings($options, $settings);
?>
			</div>
			<!-- end Display Settings -->

			<?php 
do_action(PT_CV_PREFIX_ . 'setting_tabs_content', $settings);
?>

		</div>

		<div class="clearfix"></div>
		<hr>
		<!-- Save -->
예제 #8
0
 /**
  * Final output of View: HTML & Assets
  *
  * @param string $html
  */
 static function view_final_output($html)
 {
     ob_start();
     PT_CV_Html::assets_of_view_types();
     $view_assets = ob_get_clean();
     return sprintf('<div class="%s">%s</div>', PT_CV_PREFIX . 'wrapper', $html) . $view_assets;
 }
예제 #9
0
?>
filter-settings">
				<?php 
$options = array(array('label' => array('text' => __('Content type', PT_CV_DOMAIN)), 'params' => array(array('type' => 'radio', 'name' => 'content-type', 'options' => PT_CV_Values::post_types(), 'std' => 'post'))), !get_option('pt_cv_version_pro') ? array('label' => array('text' => ''), 'extra_setting' => array('params' => array('width' => 10)), 'params' => array(array('type' => 'html', 'content' => sprintf('<p class="text-muted">&rarr; %s</p>', __('Filter custom content type (or post type) ?', PT_CV_DOMAIN) . sprintf(' <a href="%s" target="_blank">%s</a>', esc_url('http://www.contentviewspro.com/pricing/?utm_source=client&utm_medium=view'), __('Please upgrade to Pro', PT_CV_DOMAIN)))))) : '', apply_filters(PT_CV_PREFIX_ . 'custom_filters', array()), array('label' => array('text' => __('Common filters', PT_CV_DOMAIN)), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_Html::html_group_class())), 'params' => array(array('type' => 'group', 'params' => array(apply_filters(PT_CV_PREFIX_ . 'sticky_posts_setting', array()), array('label' => array('text' => __('In list', PT_CV_DOMAIN)), 'params' => array(array('type' => 'text', 'name' => 'post__in', 'std' => '', 'desc' => __('List of post ids to retrieve (comma-separated values, e.g. 1,2,3)<br>A post is displayed only if its ID is equal to any of the values IN this list', PT_CV_DOMAIN)))), apply_filters(PT_CV_PREFIX_ . 'include_extra_settings', array()), array('label' => array('text' => __('Excludes', PT_CV_DOMAIN)), 'params' => array(array('type' => 'text', 'name' => 'post__not_in', 'std' => '', 'desc' => __('List of post ids to exclude (comma-separated values, e.g. 1,2,3)', PT_CV_DOMAIN)))), apply_filters(PT_CV_PREFIX_ . 'exclude_extra_settings', array()), array('label' => array('text' => __('Parent page', PT_CV_DOMAIN)), 'params' => array(array('type' => 'number', 'name' => 'post_parent', 'std' => '', 'desc' => __('Enter ID of parent page to query child pages', PT_CV_DOMAIN))), 'dependence' => array('content-type', 'page')), apply_filters(PT_CV_PREFIX_ . 'post_parent_settings', array()), array('label' => array('text' => __('Limit', PT_CV_DOMAIN)), 'params' => array(array('type' => 'number', 'name' => 'limit', 'std' => '10', 'min' => '1', 'append_text' => '1 &rarr; 999', 'desc' => __('The number of posts to show. Set empty to show all found posts (which match all filter settings)', PT_CV_DOMAIN)))), apply_filters(PT_CV_PREFIX_ . 'after_limit_option', array()))))), array('label' => array('text' => __('Advanced filters', PT_CV_DOMAIN)), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_Html::html_group_class(), 'wrap-id' => PT_CV_Html::html_group_id('advanced-params'))), 'params' => array(array('type' => 'group', 'params' => array(array('label' => array('text' => ''), 'extra_setting' => array('params' => array('width' => 12)), 'params' => array(array('type' => 'checkbox', 'name' => 'advanced-settings[]', 'options' => PT_CV_Values::advanced_settings(), 'std' => '', 'class' => 'advanced-settings-item'))))))), array('label' => array('text' => ''), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_Html::html_panel_group_class(), 'wrap-id' => PT_CV_Html::html_panel_group_id(PT_CV_Functions::string_random()))), 'params' => array(array('type' => 'panel_group', 'params' => apply_filters(PT_CV_PREFIX_ . 'advanced_settings_panel', array('taxonomy' => array(array('label' => array('text' => __('Taxonomies', PT_CV_DOMAIN)), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_PREFIX . 'taxonomies')), 'params' => array(array('type' => 'checkbox', 'name' => 'taxonomy[]', 'options' => PT_CV_Values::taxonomy_list(), 'std' => '', 'class' => 'taxonomy-item', 'desc' => __('Check checkbox of taxonomies to filter posts by their terms', PT_CV_DOMAIN)))), array('label' => array('text' => __('Terms', PT_CV_DOMAIN)), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_Html::html_panel_group_class() . ' terms', 'wrap-id' => PT_CV_Html::html_panel_group_id(PT_CV_Functions::string_random()))), 'params' => array(array('type' => 'panel_group', 'settings' => array('nice_name' => PT_CV_Values::taxonomy_list()), 'params' => PT_CV_Settings::terms_of_taxonomies()))), array('label' => array('text' => __('Relation', PT_CV_DOMAIN)), 'params' => array(array('type' => 'select', 'name' => 'taxonomy-relation', 'options' => PT_CV_Values::taxonomy_relation(), 'std' => PT_CV_Functions::array_get_first_key(PT_CV_Values::taxonomy_relation()), 'class' => 'taxonomy-relation', 'desc' => __('Select AND to show posts which match ALL settings of selected taxonomies<br>Select OR to show posts which match settings of at least one selected taxonomy', PT_CV_DOMAIN)))), apply_filters(PT_CV_PREFIX_ . 'taxonomies_custom_settings', array())), 'order' => array(array('label' => array('text' => __('Order by', PT_CV_DOMAIN)), 'extra_setting' => array('params' => array('width' => 12)), 'params' => array(array('type' => 'panel_group', 'settings' => array('show_all' => 1), 'params' => PT_CV_Settings::orderby())))), 'author' => apply_filters(PT_CV_PREFIX_ . 'author_settings', array(array('label' => array('text' => __('Written by', PT_CV_DOMAIN)), 'params' => array(array('type' => 'select', 'name' => 'author__in[]', 'options' => PT_CV_Values::user_list(), 'std' => '', 'class' => 'select2', 'multiple' => $version_gt_37 ? '1' : '0'))), $version_gt_37 ? array('label' => array('text' => __('Not written by', PT_CV_DOMAIN)), 'params' => array(array('type' => 'select', 'name' => 'author__not_in[]', 'options' => PT_CV_Values::user_list(), 'std' => '', 'class' => 'select2', 'multiple' => $version_gt_37 ? '1' : '0'))) : array())), 'status' => array(array('label' => array('text' => __('Status', PT_CV_DOMAIN)), 'params' => array(array('type' => 'select', 'name' => 'post_status', 'options' => PT_CV_Values::post_statuses(), 'std' => 'publish', 'class' => 'select2', 'multiple' => '1', 'desc' => __('Select status of posts', PT_CV_DOMAIN))))), 'search' => array(array('label' => array('text' => __('Keyword', PT_CV_DOMAIN)), 'params' => array(array('type' => 'text', 'name' => 's', 'std' => '', 'desc' => __('Enter the keyword to searching for posts', PT_CV_DOMAIN) . apply_filters(PT_CV_PREFIX_ . 'searchby_keyword_desc', '')))))))))));
echo balanceTags(PT_Options_Framework::do_settings($options, $settings));
?>
			</div>
			<!-- end Filter Settings -->

			<!-- Display Settings -->
			<div class="tab-pane" id="<?php 
echo esc_attr(PT_CV_PREFIX);
?>
display-settings">
				<?php 
$options = array(array('label' => array('text' => __('View type', PT_CV_DOMAIN)), 'params' => array(array('type' => 'radio', 'name' => 'view-type', 'options' => PT_CV_Values::view_type(), 'std' => PT_CV_Functions::array_get_first_key(PT_CV_Values::view_type())))), array('label' => array('text' => __('View type settings', PT_CV_DOMAIN)), 'params' => array(array('type' => 'panel_group', 'settings' => array('no_panel' => 1, 'no_animation' => 1, 'show_only_one' => 1), 'params' => PT_CV_Values::view_type_settings()))), apply_filters(PT_CV_PREFIX_ . 'responsive_settings', array()), array('label' => array('text' => __('Layout format', PT_CV_DOMAIN)), 'params' => array(array('type' => 'radio', 'name' => 'layout-format', 'options' => PT_CV_Values::layout_format(), 'std' => PT_CV_Functions::array_get_first_key(PT_CV_Values::layout_format()), 'desc' => __('This is layout format of output for each post', PT_CV_DOMAIN)))), array('label' => array('text' => __('Fields settings', PT_CV_DOMAIN)), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_Html::html_group_class(), 'wrap-id' => PT_CV_Html::html_group_id('field-settings'))), 'params' => array(array('type' => 'group', 'params' => PT_CV_Settings::field_settings()))), array('label' => array('text' => __('Pagination settings', PT_CV_DOMAIN)), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_Html::html_group_class())), 'params' => array(array('type' => 'group', 'params' => PT_CV_Settings::settings_pagination()))), array('label' => array('text' => __('Other settings', PT_CV_DOMAIN)), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_Html::html_group_class())), 'params' => array(array('type' => 'group', 'params' => PT_CV_Settings::settings_other()))));
$options = apply_filters(PT_CV_PREFIX_ . 'display_settings', $options);
echo balanceTags(PT_Options_Framework::do_settings($options, $settings));
?>
			</div>
			<!-- end Display Settings -->

			<?php 
do_action(PT_CV_PREFIX_ . 'setting_tabs_content', $settings);
?>

		</div>

		<div class="clearfix"></div>
		<hr>
		<!-- Save -->
 /**
  * HTML output of item in Scrollable List
  *
  * @param array $content_items The array of Raw HTML output (is not wrapped) of each item
  *
  * @return array
  */
 static function scrollable_content($content_items)
 {
     $dargs = PT_CV_Functions::get_global_variable('dargs');
     // Store content of a Scrollable list
     $scrollable_content = array();
     $rows = $dargs['number-rows'] ? (int) $dargs['number-rows'] : 1;
     list($columns, $span_width_last, $span_width, $span_class, $row_class) = self::process_column_width();
     // Get wrapper class of a scrollable slide
     $slide_class = apply_filters(PT_CV_PREFIX_ . 'scrollable_slide_class', 'item');
     // Split items to slide
     $slides_item = array_chunk($content_items, $columns * $rows);
     foreach ($slides_item as $s_idx => $slide) {
         // Store content of a slide
         $slide_html = array();
         // Split items to rows
         $columns_item = array_chunk($slide, $columns);
         // Get HTML of each row
         foreach ($columns_item as $items_per_row) {
             $row_html = array();
             foreach ($items_per_row as $idx => $content_item) {
                 $_span_width = $idx == count($items_per_row) - 1 ? $span_width_last : $span_width;
                 // Wrap content of item
                 $item_classes = apply_filters(PT_CV_PREFIX_ . 'item_col_class', array($span_class . $_span_width), $_span_width);
                 $item_class = implode(' ', array_filter($item_classes));
                 $row_html[] = PT_CV_Html::content_item_wrap($content_item, $item_class);
             }
             $slide_html[] = sprintf('<div class="%1$s">%2$s</div>', esc_attr($row_class), implode("\n", $row_html));
         }
         // Show first slide
         $this_class = $slide_class . ($s_idx == 0 ? ' active' : '');
         $scrollable_content[] = sprintf('<div class="%s">%s</div>', esc_attr($this_class), implode("\n", $slide_html));
     }
     // Get class of wrapper of content of scrollable list
     $content_class = apply_filters(PT_CV_PREFIX_ . 'scrollable_content_class', 'carousel-inner');
     $content = sprintf('<div class="%s">%s</div>', esc_attr($content_class), implode("\n", $scrollable_content));
     return array('scrollable_content' => $content, 'count_slides' => count($slides_item));
 }
예제 #11
0
 public static function filter_disable_wp_responsive_image($args)
 {
     if (PT_CV_Html::is_responsive_image_disabled()) {
         if (isset($args['sizes'])) {
             unset($args['sizes']);
         }
         if (isset($args['srcset'])) {
             unset($args['srcset']);
         }
     }
     return $args;
 }
예제 #12
0
 /**
  * Final output of View: HTML & Assets
  *
  * @param string $html
  */
 static function view_final_output($html)
 {
     global $pt_cv_id, $pt_cv_sub_id;
     //DEBUG_STYLE
     $view_assets = '';
     if ($pt_cv_id == $pt_cv_sub_id) {
         // Print View assets
         ob_start();
         PT_CV_Html::assets_of_view_types();
         $view_assets = ob_get_clean();
     }
     return sprintf('<div class="%s">%s</div>', PT_CV_PREFIX . 'wrapper', $html) . $view_assets;
 }
 /**
  * Register and enqueues public-facing JavaScript files.
  *
  * @since    1.0.0
  */
 public function enqueue_scripts()
 {
     PT_CV_Html::frontend_scripts();
 }
예제 #14
0
 /**
  * HTML for group of params inside Panel group
  *
  * @param string $key
  * @param array  $param_group Array of setting options in a group
  * @param array  $data        Stored data of settings
  * @param string $parent_id
  * @param bool   $settings    : array of custom settings
  *
  * @return string
  */
 static function sub_panel_group($key, $param_group, $data, $parent_id, $settings = array())
 {
     // Content for body
     $content = self::do_settings($param_group, $data);
     // Class for wrapper
     $class = PT_CV_Html::html_group_class();
     $class .= isset($settings['show_all']) ? '' : ' hidden';
     $class .= isset($settings['show_only_one']) ? ' ' . PT_CV_PREFIX . 'only-one' : '';
     $class .= isset($settings['no_panel']) ? ' ' . PT_CV_PREFIX . 'no-panel' : '';
     // Id for wrapper
     $id = PT_CV_Html::html_group_id($key);
     if (!isset($settings['no_panel'])) {
         if (!empty($param_group['parent_label'])) {
             $heading = $param_group['parent_label'];
         } else {
             $heading = isset($settings['nice_name'][$key]) ? $settings['nice_name'][$key] : PT_CV_Functions::string_slug_to_text($key);
         }
         $html = PT_CV_Html::html_collapse_one($parent_id, $id . '-child', $heading, $content, true);
     } else {
         $html = $content;
     }
     return "<div class='{$class}' id='{$id}'>{$html}</div>";
 }
예제 #15
0
 public function enqueue_assets()
 {
     // Execute if assets were not enqueued in default way
     if (!apply_filters(PT_CV_PREFIX_ . 'default_enqueue_assets', 1)) {
         global $pt_cv_id;
         if (!empty($pt_cv_id) || apply_filters(PT_CV_PREFIX_ . 'view_executed', 0)) {
             PT_CV_Html::frontend_styles();
             PT_CV_Html::frontend_scripts();
         }
     }
 }
예제 #16
0
 /**
  * Scripts for Preview & WP frontend
  */
 static function frontend_scripts()
 {
     PT_CV_Asset::enqueue('bootstrap');
     // Public script
     PT_CV_Asset::enqueue('public', 'script', array('src' => plugins_url('public/assets/js/public.js', PT_CV_FILE), 'deps' => array('jquery')));
     // Localize for Public script
     PT_CV_Asset::localize_script('public', PT_CV_PREFIX_UPPER . 'PUBLIC', array('_prefix' => PT_CV_PREFIX, 'page_to_show' => apply_filters(PT_CV_PREFIX_ . 'pages_to_show', 5), '_nonce' => wp_create_nonce(PT_CV_PREFIX_ . 'ajax_nonce'), 'is_admin' => is_admin(), 'is_mobile' => apply_filters(PT_CV_PREFIX_ . 'is_mobile', wp_is_mobile()), 'ajaxurl' => admin_url('admin-ajax.php'), 'lang' => PT_CV_Functions::get_language(), 'loading_image_src' => PT_CV_Html::loading_img_src()) + apply_filters(PT_CV_PREFIX_ . 'public_localize_script_extra', array()));
     // Localize for Pagination script
     PT_CV_Asset::localize_script(array('bootstrap', 'bootstrap-admin'), PT_CV_PREFIX_UPPER . 'PAGINATION', array('first' => apply_filters(PT_CV_PREFIX_ . 'pagination_first', '&laquo;'), 'prev' => apply_filters(PT_CV_PREFIX_ . 'pagination_prev', '&lsaquo;'), 'next' => apply_filters(PT_CV_PREFIX_ . 'pagination_next', '&rsaquo;'), 'last' => apply_filters(PT_CV_PREFIX_ . 'pagination_last', '&raquo;'), 'goto_first' => apply_filters(PT_CV_PREFIX_ . 'goto_first', __('Go to first page', 'content-views-query-and-display-post-page')), 'goto_prev' => apply_filters(PT_CV_PREFIX_ . 'goto_prev', __('Go to previous page', 'content-views-query-and-display-post-page')), 'goto_next' => apply_filters(PT_CV_PREFIX_ . 'goto_next', __('Go to next page', 'content-views-query-and-display-post-page')), 'goto_last' => apply_filters(PT_CV_PREFIX_ . 'goto_last', __('Go to last page', 'content-views-query-and-display-post-page')), 'current_page' => apply_filters(PT_CV_PREFIX_ . 'current_page', __('Current page is', 'content-views-query-and-display-post-page')), 'goto_page' => apply_filters(PT_CV_PREFIX_ . 'goto_page', __('Go to page', 'content-views-query-and-display-post-page'))));
     // Load Pro scripts
     do_action(PT_CV_PREFIX_ . 'frontend_scripts');
 }