/**
  * 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');
     }
 }
Example #2
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 -->
?>
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 -->
Example #4
0
 /**
  * Show settings of other fields
  */
 static function field_meta_fields($prefix)
 {
     $result = array(array('label' => array('text' => ''), 'extra_setting' => array('params' => array('width' => 12)), 'params' => array(array('type' => 'checkbox', 'name' => $prefix . 'date', 'options' => PT_CV_Values::yes_no('yes', __('Show Date', PT_CV_TEXTDOMAIN)), 'std' => 'yes'))), array('label' => array('text' => ''), 'extra_setting' => array('params' => array('width' => 12)), 'params' => array(array('type' => 'checkbox', 'name' => $prefix . 'author', 'options' => PT_CV_Values::yes_no('yes', __('Show Author', PT_CV_TEXTDOMAIN)), 'std' => 'yes'))), array('label' => array('text' => ''), 'extra_setting' => array('params' => array('width' => 12)), 'params' => array(array('type' => 'checkbox', 'name' => $prefix . 'taxonomy', 'options' => PT_CV_Values::yes_no('yes', __('Show Taxonomies (categories, tags...)', PT_CV_TEXTDOMAIN)), 'std' => 'yes')), 'dependence' => array('content-type', 'page', '!=')), array('label' => array('text' => ''), 'extra_setting' => array('params' => array('width' => 12)), 'params' => array(array('type' => 'checkbox', 'name' => $prefix . 'comment', 'options' => PT_CV_Values::yes_no('yes', __('Show Comment Count', PT_CV_TEXTDOMAIN)), 'std' => 'yes'))));
     // Sort array of params by saved order
     $result = apply_filters(PT_CV_PREFIX_ . 'settings_sort', $result, PT_CV_PREFIX . $prefix);
     return $result;
 }
Example #5
0
 /**
  * Settings of View Type = Collapsible
  *
  * @return array
  */
 static function view_type_settings_collapsible()
 {
     $prefix = 'collapsible-';
     $result = array(array('label' => array('text' => ''), 'extra_setting' => array('params' => array('width' => 12)), 'params' => array(array('type' => 'checkbox', 'name' => $prefix . 'open-first-item', 'options' => PT_CV_Values::yes_no('yes', __('Open first item by default', 'content-views-query-and-display-post-page')), 'std' => 'yes'))));
     $result = apply_filters(PT_CV_PREFIX_ . 'view_type_settings_collapsible_184', $result);
     return $result;
 }