/** * Content Views Settings page : section 2 */ public static function settings_page_section_two() { $file_path = plugin_dir_path(PT_CV_FILE) . 'admin/includes/templates/settings-section-two.php'; $text = PT_CV_Functions::file_include_content($file_path); $text = apply_filters(PT_CV_PREFIX_ . 'settings_page_section_two', $text); echo $text; }
/** * Validate settings filter * * @param string $errors The error message * @param array $args The Query parameters array */ public static function filter_validate_settings($errors, $args) { $dargs = PT_CV_Functions::get_global_variable('dargs'); // echo "<pre>"; // var_dump( 'query args', $args ); // echo "</pre>"; // echo "<pre>"; // var_dump( 'display args', $dargs ); // echo "</pre>"; $messages = array('field' => array('select' => __('Please select an option in : ', PT_CV_TEXTDOMAIN), 'text' => __('Please set value in : ', PT_CV_TEXTDOMAIN)), 'tab' => array('filter' => __('Filter Settings', PT_CV_TEXTDOMAIN), 'display' => __('Display Settings', PT_CV_TEXTDOMAIN))); /** * Validate Query parameters */ // Post type if (empty($args['post_type'])) { $errors[] = $messages['field']['select'] . $messages['tab']['filter'] . ' > ' . __('Content type', PT_CV_TEXTDOMAIN); } /** * Validate common Display parameters */ // View type if (empty($dargs['view-type'])) { $errors[] = $messages['field']['select'] . $messages['tab']['display'] . ' > ' . __('View type', PT_CV_TEXTDOMAIN); } // Layout format if (empty($dargs['layout-format'])) { $errors[] = $messages['field']['select'] . $messages['tab']['display'] . ' > ' . __('Layout format', PT_CV_TEXTDOMAIN); } // Field settings if (!isset($dargs['fields'])) { $errors[] = $messages['field']['select'] . $messages['tab']['display'] . ' > ' . __('Fields settings', PT_CV_TEXTDOMAIN) . ' > ' . __('Fields display', PT_CV_TEXTDOMAIN); } // Item per page if (isset($dargs['pagination-settings'])) { if (empty($dargs['pagination-settings']['items-per-page'])) { $errors[] = $messages['field']['text'] . $messages['tab']['display'] . ' > ' . __('Pagination settings', PT_CV_TEXTDOMAIN) . ' > ' . __('Items per page', PT_CV_TEXTDOMAIN); } } /** * Validate Display parameters of view types */ if (!empty($dargs['view-type'])) { switch ($dargs['view-type']) { case 'grid': if (empty($dargs['number-columns'])) { $errors[] = $messages['field']['text'] . $messages['tab']['display'] . ' > ' . __('View type settings', PT_CV_TEXTDOMAIN) . ' > ' . __('Items per row', PT_CV_TEXTDOMAIN); } break; } } return array_filter($errors); }
/** * Get version of handle * * @param string $name Asset slug name * @param array $data Asset data (url, depends, version...) * * @return string */ static function get_version($name, $data) { if (isset($data['ver'])) { return $data['ver']; } if (array_key_exists($name, self::$version)) { return self::$version[$name]; } return PT_CV_Functions::plugin_info(PT_CV_FILE, 'Version'); }
/** * Setting options for Field = Thumbnail */ static function field_thumbnail_settings($prefix) { $result = array(array('label' => array('text' => __('Thumbnail size', PT_CV_TEXTDOMAIN)), 'params' => array(array('type' => 'select', 'name' => $prefix . 'thumbnail-size', 'options' => PT_CV_Values::field_thumbnail_sizes(), 'std' => 'medium'))), !PT_CV_Functions::wp_version_compare('4.4') ? '' : array('label' => array('text' => ''), 'extra_setting' => array('params' => array('wrap-class' => 'checkbox-inline')), 'params' => array(array('type' => 'checkbox', 'name' => $prefix . 'thumbnail-nowprpi', 'options' => PT_CV_Values::yes_no('yes', __('Disable responsive image of WordPress 4.4', PT_CV_TEXTDOMAIN)), 'std' => '', 'desc' => __('Check this option if thumbnail looks blurry', PT_CV_TEXTDOMAIN))))); $result = apply_filters(PT_CV_PREFIX_ . 'field_thumbnail_settings', $result, $prefix); return $result; }
<p><br>Thank you for using Content Views!</p> <p>You are using <strong>Free</strong> version: <?php echo esc_html(PT_CV_Functions::plugin_info(PT_CV_FILE, 'Version')); ?> </p> <p> By default, any user who has <strong>edit_posts</strong> capability (Administrator, Editor, Author, Contributor) can manage all Views (add, edit, delete).<br> To restrict which user role can manage Views, <?php echo sprintf(' <a href="%s" target="_blank">%s</a>', esc_url('http://www.contentviewspro.com/pricing/?utm_source=settings_page&utm_medium=role'), __('Get CVPro now!', PT_CV_TEXTDOMAIN)); ?> </p>
/** * Check duplicated View * @return bool */ static function duplicate_process($view_id, $settings) { if (!defined('PT_CV_DOING_PAGINATION') && apply_filters(PT_CV_PREFIX_ . 'check_duplicate', 0, $view_id, $settings)) { global $pt_cv_glb, $pt_cv_views; // Generate unnique ID for current shortcode $sc_params = isset($pt_cv_glb[$view_id]['shortcode_params']) ? $pt_cv_glb[$view_id]['shortcode_params'] : PT_CV_Functions::string_random(); $vid = $view_id . '-' . md5(serialize($sc_params)); if (!empty($pt_cv_views[$vid])) { return true; } else { $pt_cv_views[$vid] = 1; } } return false; }
static function is_responsive_image_disabled() { return apply_filters(PT_CV_PREFIX_ . 'disable_responsive_image', PT_CV_Functions::setting_value(PT_CV_PREFIX . 'field-thumbnail-nowprpi')); }
/** * Callback function for ajax Pagination action 'pagination_request' */ static function ajax_callback_pagination_request() { // Validate request check_ajax_referer(PT_CV_PREFIX_ . 'ajax_nonce', 'ajax_nonce'); // Session id $session_id = empty($_POST['sid']) ? '' : esc_sql($_POST['sid']); // Get saved $settings $settings = get_transient(PT_CV_PREFIX . 'view-settings-' . $session_id); // If empty, get settings by ID if (!$settings) { $settings = PT_CV_Functions::view_get_settings($session_id); } // Pagination settings $pargs = array('session_id' => $session_id, 'page' => (int) esc_sql($_POST['page'])); // Switch language $language = empty($_POST['lang']) ? '' : esc_sql($_POST['lang']); self::switch_language($language); // Show View output echo balanceTags(PT_CV_Functions::view_process_settings($session_id, $settings, $pargs)); // Must exit die; }
/** * 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)); }
/** * Options to check/uncheck to display fields * * @return array */ static function field_display() { $prefix = 'show-field-'; $result = array(array('label' => array('text' => __('Thumbnail position', PT_CV_DOMAIN)), 'extra_setting' => array('params' => array('wrap-class' => PT_CV_PREFIX . 'bg-none' . ' ' . PT_CV_PREFIX . 'w200')), 'params' => array(array('type' => 'select', 'name' => 'field-' . 'thumbnail-position', 'options' => PT_CV_Values::thumbnail_position(), 'std' => PT_CV_Functions::array_get_first_key(PT_CV_Values::thumbnail_position()))), 'dependence' => array('layout-format', '2-col')), array('label' => array('text' => ''), 'extra_setting' => array('params' => array('width' => 12)), 'params' => array(array('type' => 'checkbox', 'name' => $prefix . 'thumbnail', 'options' => PT_CV_Values::yes_no('yes', __('Show Thumbnail', PT_CV_DOMAIN)), 'std' => 'yes')), 'dependence' => array('layout-format', '1-col')), array('label' => array('text' => ''), 'extra_setting' => array('params' => array('width' => 12)), 'params' => array(array('type' => 'checkbox', 'name' => $prefix . 'title', 'options' => PT_CV_Values::yes_no('yes', __('Show Title', PT_CV_DOMAIN)), 'std' => 'yes'))), array('label' => array('text' => ''), 'extra_setting' => array('params' => array('width' => 12)), 'params' => array(array('type' => 'checkbox', 'name' => $prefix . 'content', 'options' => PT_CV_Values::yes_no('yes', __('Show Content', PT_CV_DOMAIN)), 'std' => 'yes'))), array('label' => array('text' => ''), 'extra_setting' => array('params' => array('width' => 12)), 'params' => array(array('type' => 'checkbox', 'name' => $prefix . 'meta-fields', 'options' => PT_CV_Values::yes_no('yes', __('Show Meta Fields (Author, Date, Comment...)', PT_CV_DOMAIN)), 'std' => '')))); // Add/remove params $result = apply_filters(PT_CV_PREFIX_ . 'field_display', $result, $prefix); // Sort array of params by saved order $result = apply_filters(PT_CV_PREFIX_ . 'settings_sort', $result, PT_CV_PREFIX . $prefix); return $result; }
public static function action_init() { $user_can = current_user_can('administrator') || current_user_can(PT_CV_Functions::get_option_value('access_role')); if (!$user_can) { return; } if (!empty($_GET[PT_CV_SOLVE_SCRIPT_ERROR])) { update_option(PT_CV_SOLVE_SCRIPT_ERROR, true, false); } if (!empty($_GET['cv_undo_solve_error'])) { delete_option(PT_CV_SOLVE_SCRIPT_ERROR); } }
case '1-col': foreach ($fields_html as $field_html) { $html[] = $field_html; } break; case '2-col': // Thumbnail html $thumbnail_html = $fields_html['thumbnail']; // Other fields html unset($fields_html['thumbnail']); $others_html = implode("\n", $fields_html); $html[] = $thumbnail_html; $html[] = $others_html; break; } $random_id = PT_CV_Functions::string_random(); ?> <div class="panel panel-default pt-cv-content-item"> <?php echo apply_filters(PT_CV_PREFIX_ . 'collapsible_before_heading', ''); ?> <div class="panel-heading"> <a class="panel-title" data-toggle="collapse" data-parent="#<?php echo esc_attr(PT_CV_PREFIX_UPPER . 'ID'); ?> " href="#<?php echo esc_attr($random_id); ?> "> <?php echo strip_tags($heading);
/** * Update view count * * @global type $post * @return void */ public static function _update_view_count() { global $post; if (!isset($post) || !is_object($post)) { return; } if (is_single($post->ID)) { PT_CV_Functions::post_update_view_count($post->ID); } }
/** * Setting options for Field = Thumbnail */ static function field_thumbnail_settings($prefix) { $result = array(array('label' => array('text' => __('Size')), 'params' => array(array('type' => 'select', 'name' => $prefix . 'thumbnail-size', 'options' => PT_CV_Values::field_thumbnail_sizes(), 'std' => 'medium'))), !PT_CV_Functions::wp_version_compare('4.4') ? '' : 'disable-wp44-resimg' => array('label' => array('text' => ''), 'extra_setting' => array('params' => array('wrap-class' => 'checkbox-inline')), 'params' => array(array('type' => 'checkbox', 'name' => $prefix . 'thumbnail-nowprpi', 'options' => PT_CV_Values::yes_no('yes', __('Disable responsive image of WordPress 4.4', 'content-views-query-and-display-post-page')), 'std' => '', 'desc' => __('Check this option if thumbnail looks blurry', 'content-views-query-and-display-post-page')))), !get_option('pt_cv_version_pro') ? PT_CV_Settings::get_cvpro(sprintf(__('In this lite version, thumbnail is only shown if post has %s', 'content-views-query-and-display-post-page'), sprintf('<a target="_blank" href="https://codex.wordpress.org/Post_Thumbnails">%s</a>', __('Featured Image'))), 10, null, true) : ''); $result = apply_filters(PT_CV_PREFIX_ . 'field_thumbnail_settings', $result, $prefix); return $result; }
?> 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 -->
/** * Print inline css code * * @param string $css The css code * * @return string */ static function inline_style($css, $prefix = 'inline') { // Generate random id for style tag $random_id = PT_CV_Functions::string_random(); ob_start(); ?> <style type="text/css" id="<?php echo esc_attr(PT_CV_PREFIX . $prefix . '-style-' . $random_id); ?> "><?php echo '' . $css; ?> </style> <?php return ob_get_clean(); }
?> 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">→ %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 → 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 -->
/** * Filter link of Title in All Views page */ public function filter_get_edit_post_link($edit_link, $post_id, $context) { // Get current post type $post_type = PT_CV_Functions::admin_current_post_type(); if ($post_type != PT_CV_POST_TYPE) { return $edit_link; } // Get View id $view_id = get_post_meta($post_id, PT_CV_META_ID, true); $edit_link = PT_CV_Functions::view_link($view_id); return $edit_link; }
/** * Get terms of one/many taxonomies * * @param string $taxonomy The name of the taxonomy * @param string $terms_of_taxonomies Array of terms of taxonomies * @param array $args Array of query parameters */ static function term_of_taxonomy($taxonomy, &$terms_of_taxonomies, $args = array()) { $args = array_merge(array('hide_empty' => false), $args); $terms = get_terms(array($taxonomy), $args); $term_slug_name = array(); foreach ($terms as $term) { $term_slug_name[PT_CV_Functions::term_slug_sanitize($term->slug)] = $term->name; } // Sort values of param by saved order $term_slug_name = apply_filters(PT_CV_PREFIX_ . 'settings_sort_single', $term_slug_name, $taxonomy . '-' . 'terms'); $terms_of_taxonomies[$taxonomy] = $term_slug_name; }
/** * 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' : ''; $class .= isset($settings['no_animation']) ? ' ' . PT_CV_PREFIX . 'no-animation' : ''; // Id for wrapper $id = PT_CV_Html::html_group_id($key); if (!isset($settings['no_panel'])) { // Heading text $heading = isset($settings['nice_name']) && isset($settings['nice_name'][$key]) ? $settings['nice_name'][$key] : PT_CV_Functions::string_slug_to_text($key); $heading = __($heading, PT_CV_DOMAIN) . ' ' . __('Settings', PT_CV_DOMAIN); $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>"; }
public static function filter_disable_wp_responsive_image($args) { if (PT_CV_Functions::setting_value(PT_CV_PREFIX . 'field-thumbnail-nowprpi')) { if (isset($args['sizes'])) { unset($args['sizes']); } if (isset($args['srcset'])) { unset($args['srcset']); } } return $args; }