/**
  * Get view data
  *
  * @param string $meta_id ID of custom field
  *
  * @return array
  */
 static function view_get_settings($meta_id)
 {
     if (!$meta_id) {
         return;
     }
     $post_id = apply_filters(PT_CV_PREFIX_ . 'view_get_post_id', PT_CV_Functions::post_id_from_meta_id($meta_id), $meta_id);
     // Get view settings
     if ($post_id) {
         $view_settings = get_post_meta($post_id, PT_CV_META_SETTINGS, true);
         /* Backward compatibility
          * since 1.3.2
          */
         self::view_backward_comp($view_settings);
         return is_array($view_settings) ? $view_settings : array();
     }
     return array();
 }
Example #2
0
 /**
  * Get view data
  *
  * @param string $meta_id ID of custom field
  *
  * @return array
  */
 static function view_get_settings($meta_id)
 {
     if (!$meta_id) {
         return;
     }
     $view_settings = array();
     $post_id = apply_filters(PT_CV_PREFIX_ . 'view_get_post_id', PT_CV_Functions::post_id_from_meta_id($meta_id), $meta_id);
     if ($post_id) {
         $view_settings = get_post_meta($post_id, PT_CV_META_SETTINGS, true);
     }
     return apply_filters(PT_CV_PREFIX_ . 'view_settings', $view_settings);
 }
Example #3
0
?>
</a>

	<br>

	<!-- Settings form -->
	<form action="" method="POST" id="<?php 
echo esc_attr(PT_CV_PREFIX . 'form-view');
?>
">

		<?php 
// Add nonce field
wp_nonce_field(PT_CV_PREFIX_ . 'view_submit', PT_CV_PREFIX_ . 'form_nonce');
// Get post ID of this View
$post_id = PT_CV_Functions::post_id_from_meta_id($id);
$view_object = $post_id ? get_post($post_id) : null;
?>
		<!-- add hidden field -->
		<input type="hidden" name="<?php 
echo esc_attr(PT_CV_PREFIX . 'post-id');
?>
" value="<?php 
echo esc_attr($post_id);
?>
" />
		<input type="hidden" name="<?php 
echo esc_attr(PT_CV_PREFIX . 'view-id');
?>
" value="<?php 
echo esc_attr($id);
Example #4
0
 /**
  * Get view data
  *
  * @param string $meta_id ID of custom field
  *
  * @return array
  */
 static function view_get_settings($meta_id)
 {
     if (!$meta_id) {
         return;
     }
     $post_id = apply_filters(PT_CV_PREFIX_ . 'view_get_post_id', PT_CV_Functions::post_id_from_meta_id($meta_id), $meta_id);
     // Get view settings
     if ($post_id) {
         $view_settings = get_post_meta($post_id, PT_CV_META_SETTINGS, true);
         /* Backward compatibility
          * since 1.3.2
          */
         $trans_name = PT_CV_PREFIX . 'compatible-' . $post_id;
         $trans = get_transient($trans_name);
         if (empty($trans)) {
             self::view_backward_comp($view_settings);
             set_transient($trans_name, 1, 10 * YEAR_IN_SECONDS);
         }
         return is_array($view_settings) ? $view_settings : array();
     }
     return array();
 }