当前位置: 首页>>代码示例>>PHP>>正文


PHP pods_transient_get函数代码示例

本文整理汇总了PHP中pods_transient_get函数的典型用法代码示例。如果您正苦于以下问题:PHP pods_transient_get函数的具体用法?PHP pods_transient_get怎么用?PHP pods_transient_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pods_transient_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: export_pod

/**
 * Function, with caching, to export all items of a Pod as a serialized php array or JSON object
 *
 * @param string     $pod_name
 * @param bool 		$json
 *
 * @return bool|mixed|null|string|void
 */
function export_pod($pod_name, $json = true)
{
    //be sure to set your Pod's name here
    //name the transient we are caching in for the Pod.
    $transient_name = "all_{$pod_name}_export";
    //check if we already have this data cached, if not continue
    if (false === ($export = pods_transient_get($transient_name))) {
        //build Pods object, get all items
        $pods = pods($pod_name, array('limit' => -1), true);
        //if we have items, loop through them, adding each item's complete row to the array
        if ($pods && $pods->total() > 0) {
            while ($pods->fetch()) {
                $export[$pods->id()] = $pods->row();
            }
        }
        if ($json) {
            $export = json_encode($export);
        } else {
            $export = serialize($export);
        }
        //cache for next time
        pods_transient_set($transient_name, $export);
    }
    return $export;
}
开发者ID:logoscreative,项目名称:pods-code-library,代码行数:33,代码来源:all-items-to-serialized-array.php

示例2: array

$field_defaults = array('name' => 'new_field', 'label' => 'New Field', 'description' => '', 'type' => 'text', 'pick_object' => '', 'sister_id' => '', 'required' => 0, 'unique' => 0);
$pick_object = PodsForm::field_method('pick', 'related_objects', true);
$tableless_field_types = PodsForm::tableless_field_types();
$simple_tableless_objects = PodsForm::field_method('pick', 'simple_objects');
$bidirectional_objects = PodsForm::field_method('pick', 'bidirectional_objects');
foreach ($pod['options'] as $_option => $_value) {
    $pod[$_option] = $_value;
}
foreach ($pod['fields'] as $_field => $_data) {
    $_data['options'] = (array) $_data['options'];
    foreach ($_data['options'] as $_option => $_value) {
        $pod['fields'][$_field][$_option] = $_value;
    }
}
$field_defaults = apply_filters('pods_field_defaults', apply_filters('pods_field_defaults_' . $pod['name'], $field_defaults, $pod));
$pick_table = pods_transient_get('pods_tables');
if (empty($pick_table)) {
    $pick_table = array('' => __('-- Select Table --', 'pods'));
    global $wpdb;
    $tables = $wpdb->get_results("SHOW TABLES", ARRAY_N);
    if (!empty($tables)) {
        foreach ($tables as $table) {
            $pick_table[$table[0]] = $table[0];
        }
    }
    pods_transient_set('pods_tables', $pick_table);
}
$field_settings = array('field_types_select' => $field_types_select, 'field_defaults' => $field_defaults, 'pick_object' => $pick_object, 'pick_table' => $pick_table, 'sister_id' => array('' => __('No Related Fields Found', 'pods')));
$field_settings = apply_filters('pods_field_settings', apply_filters('pods_field_settings_' . $pod['name'], $field_settings, $pod));
$pod['fields'] = apply_filters('pods_fields_edit', apply_filters('pods_fields_edit_' . $pod['name'], $pod['fields'], $pod));
global $wpdb;
开发者ID:jeremybradbury,项目名称:wp-ninja-kit,代码行数:31,代码来源:setup-edit.php

示例3: get_table_info

 /**
  * Get information about an objects MySQL table
  *
  * @param string $object_type
  * @param string $object The object to look for
  * @param null $name (optional) Name of the pod to load
  * @param array $pod (optional) Array with pod information
  * @param array $field (optional) Array with field information
  *
  * @return array|bool
  *
  * @since 2.0
  */
 public function get_table_info($object_type, $object, $name = null, $pod = null, $field = null)
 {
     /**
      * @var $wpdb wpdb
      * @var $sitepress SitePress
      * @var $icl_adjust_id_url_filter_off boolean
      */
     global $wpdb, $sitepress, $icl_adjust_id_url_filter_off, $polylang;
     // @todo Handle $object arrays for Post Types, Taxonomies, Comments (table pulled from first object in array)
     $info = array('object_type' => $object_type, 'type' => null, 'object_name' => $object, 'object_hierarchical' => false, 'table' => $object, 'meta_table' => $object, 'pod_table' => $wpdb->prefix . 'pods_' . (empty($object) ? $name : $object), 'field_id' => 'id', 'field_index' => 'name', 'field_slug' => null, 'field_type' => null, 'field_parent' => null, 'field_parent_select' => null, 'meta_field_id' => 'id', 'meta_field_index' => 'name', 'meta_field_value' => 'name', 'pod_field_id' => 'id', 'pod_field_index' => 'name', 'pod_field_slug' => null, 'pod_field_parent' => null, 'join' => array(), 'where' => null, 'where_default' => null, 'orderby' => null, 'pod' => null, 'recurse' => false);
     if (empty($object_type)) {
         $object_type = 'post_type';
         $object = 'post';
     } elseif (empty($object) && in_array($object_type, array('user', 'media', 'comment'))) {
         $object = $object_type;
     }
     $pod_name = $pod;
     if (is_array($pod_name)) {
         $pod_name = pods_var_raw('name', $pod_name, version_compare(PHP_VERSION, '5.4.0', '>=') ? json_encode($pod_name, JSON_UNESCAPED_UNICODE) : json_encode($pod_name), null, true);
     } else {
         $pod_name = $object;
     }
     $field_name = $field;
     if (is_array($field_name)) {
         $field_name = pods_var_raw('name', $field_name, version_compare(PHP_VERSION, '5.4.0', '>=') ? json_encode($pod_name, JSON_UNESCAPED_UNICODE) : json_encode($field_name), null, true);
     }
     $transient = 'pods_' . $wpdb->prefix . '_get_table_info_' . md5($object_type . '_object_' . $object . '_name_' . $name . '_pod_' . $pod_name . '_field_' . $field_name);
     $current_language = false;
     $current_language_t_id = $current_language_tt_id = 0;
     // WPML support
     if (is_object($sitepress) && !$icl_adjust_id_url_filter_off) {
         $current_language = pods_sanitize(ICL_LANGUAGE_CODE);
     } elseif (is_object($polylang) && function_exists('pll_current_language')) {
         $current_language = pods_sanitize(pll_current_language('slug'));
         if (!empty($current_language)) {
             $current_language_t_id = (int) $polylang->get_language($current_language)->term_id;
             $current_language_tt_id = (int) $polylang->get_language($current_language)->term_taxonomy_id;
         }
     }
     if (!empty($current_language)) {
         $transient = 'pods_' . $wpdb->prefix . '_get_table_info_' . $current_language . '_' . md5($object_type . '_object_' . $object . '_name_' . $name . '_pod_' . $pod_name . '_field_' . $field_name);
     }
     $_info = false;
     if (isset(self::$table_info_cache[$transient])) {
         // Prefer info from the object internal cache
         $_info = self::$table_info_cache[$transient];
     } elseif (pods_api_cache()) {
         $_info = pods_transient_get($transient);
         if (false === $_info && !did_action('init')) {
             $_info = pods_transient_get($transient . '_pre_init');
         }
     }
     if (false !== $_info) {
         // Data was cached, use that
         $info = $_info;
     } else {
         // Data not cached, load it up
         $_info = $this->get_table_info_load($object_type, $object, $name, $pod);
         if (isset($_info['type'])) {
             // Allow function to override $object_type
             $object_type = $_info['type'];
         }
         $info = array_merge($info, $_info);
     }
     if (0 === strpos($object_type, 'post_type') || 'media' == $object_type || in_array(pods_var_raw('type', $info['pod']), array('post_type', 'media'))) {
         $info['table'] = $wpdb->posts;
         $info['meta_table'] = $wpdb->postmeta;
         $info['field_id'] = 'ID';
         $info['field_index'] = 'post_title';
         $info['field_slug'] = 'post_name';
         $info['field_type'] = 'post_type';
         $info['field_parent'] = 'post_parent';
         $info['field_parent_select'] = '`t`.`' . $info['field_parent'] . '`';
         $info['meta_field_id'] = 'post_id';
         $info['meta_field_index'] = 'meta_key';
         $info['meta_field_value'] = 'meta_value';
         if ('media' == $object_type) {
             $object = 'attachment';
         }
         if (empty($name)) {
             $prefix = 'post_type-';
             // Make sure we actually have the prefix before trying anything with the name
             if (0 === strpos($object_type, $prefix)) {
                 $name = substr($object_type, strlen($prefix), strlen($object_type));
             }
         }
         if ('media' != $object_type) {
//.........这里部分代码省略.........
开发者ID:satokora,项目名称:IT354Project,代码行数:101,代码来源:PodsAPI.php

示例4: setup_related_objects

 /**
  * Setup related objects
  *
  * @param boolean $force Whether to force refresh of related objects
  * @return bool True when data has been loaded
  * @since 2.3
  */
 public function setup_related_objects($force = false)
 {
     $new_data_loaded = false;
     if (!$force && empty(self::$related_objects)) {
         // Only load transient if we aren't forcing a refresh
         self::$related_objects = pods_transient_get('pods_related_objects');
         if (false !== self::$related_objects) {
             $new_data_loaded = true;
         }
     } elseif ($force) {
         // If we are rebuilding, make sure we start with a clean slate
         self::$related_objects = array();
     }
     if (empty(self::$related_objects)) {
         // Do a complete build of related_objects
         $new_data_loaded = true;
         // Custom
         self::$related_objects['custom-simple'] = array('label' => __('Simple (custom defined list)', 'pods'), 'group' => __('Custom', 'pods'), 'simple' => true);
         // Pods
         $pod_options = array();
         // Include PodsMeta if not already included
         pods_meta();
         // Advanced Content Types
         $_pods = PodsMeta::$advanced_content_types;
         foreach ($_pods as $pod) {
             $pod_options[$pod['name']] = $pod['label'] . ' (' . $pod['name'] . ')';
         }
         // Settings
         $_pods = PodsMeta::$settings;
         foreach ($_pods as $pod) {
             $pod_options[$pod['name']] = $pod['label'] . ' (' . $pod['name'] . ')';
         }
         asort($pod_options);
         foreach ($pod_options as $pod => $label) {
             self::$related_objects['pod-' . $pod] = array('label' => $label, 'group' => __('Pods', 'pods'), 'bidirectional' => true);
         }
         // Post Types
         $post_types = get_post_types();
         asort($post_types);
         $ignore = array('attachment', 'revision', 'nav_menu_item');
         foreach ($post_types as $post_type => $label) {
             if (in_array($post_type, $ignore) || empty($post_type)) {
                 unset($post_types[$post_type]);
                 continue;
             } elseif (0 === strpos($post_type, '_pods_') && apply_filters('pods_pick_ignore_internal', true)) {
                 unset($post_types[$post_type]);
                 continue;
             }
             $post_type = get_post_type_object($post_type);
             self::$related_objects['post_type-' . $post_type->name] = array('label' => $post_type->label . ' (' . $post_type->name . ')', 'group' => __('Post Types', 'pods'), 'bidirectional' => true);
         }
         // Taxonomies
         $taxonomies = get_taxonomies();
         asort($taxonomies);
         $ignore = array('nav_menu', 'post_format');
         foreach ($taxonomies as $taxonomy => $label) {
             if (in_array($taxonomy, $ignore) || empty($taxonomy)) {
                 unset($taxonomies[$taxonomy]);
                 continue;
             } elseif (0 === strpos($taxonomy, '_pods_') && apply_filters('pods_pick_ignore_internal', true)) {
                 unset($taxonomies[$taxonomy]);
                 continue;
             }
             $taxonomy = get_taxonomy($taxonomy);
             self::$related_objects['taxonomy-' . $taxonomy->name] = array('label' => $taxonomy->label . ' (' . $taxonomy->name . ')', 'group' => __('Taxonomies', 'pods'), 'bidirectional' => true);
         }
         // Other WP Objects
         self::$related_objects['user'] = array('label' => __('Users', 'pods'), 'group' => __('Other WP Objects', 'pods'), 'bidirectional' => true);
         self::$related_objects['role'] = array('label' => __('User Roles', 'pods'), 'group' => __('Other WP Objects', 'pods'), 'simple' => true, 'data_callback' => array($this, 'data_roles'));
         self::$related_objects['capability'] = array('label' => __('User Capabilities', 'pods'), 'group' => __('Other WP Objects', 'pods'), 'simple' => true, 'data_callback' => array($this, 'data_capabilities'));
         self::$related_objects['media'] = array('label' => __('Media', 'pods'), 'group' => __('Other WP Objects', 'pods'), 'bidirectional' => true);
         self::$related_objects['comment'] = array('label' => __('Comments', 'pods'), 'group' => __('Other WP Objects', 'pods'), 'bidirectional' => true);
         self::$related_objects['image-size'] = array('label' => __('Image Sizes', 'pods'), 'group' => __('Other WP Objects', 'pods'), 'simple' => true, 'data_callback' => array($this, 'data_image_sizes'));
         self::$related_objects['nav_menu'] = array('label' => __('Navigation Menus', 'pods'), 'group' => __('Other WP Objects', 'pods'));
         self::$related_objects['post_format'] = array('label' => __('Post Formats', 'pods'), 'group' => __('Other WP Objects', 'pods'));
         self::$related_objects['post-status'] = array('label' => __('Post Status', 'pods'), 'group' => __('Other WP Objects', 'pods'), 'simple' => true, 'data_callback' => array($this, 'data_post_stati'));
         do_action('pods_form_ui_field_pick_related_objects_other');
         self::$related_objects['country'] = array('label' => __('Countries', 'pods'), 'group' => __('Predefined Lists', 'pods'), 'simple' => true, 'data_callback' => array($this, 'data_countries'));
         self::$related_objects['us_state'] = array('label' => __('US States', 'pods'), 'group' => __('Predefined Lists', 'pods'), 'simple' => true, 'data_callback' => array($this, 'data_us_states'));
         self::$related_objects['days_of_week'] = array('label' => __('Calendar - Days of Week', 'pods'), 'group' => __('Predefined Lists', 'pods'), 'simple' => true, 'data_callback' => array($this, 'data_days_of_week'));
         self::$related_objects['months_of_year'] = array('label' => __('Calendar - Months of Year', 'pods'), 'group' => __('Predefined Lists', 'pods'), 'simple' => true, 'data_callback' => array($this, 'data_months_of_year'));
         do_action('pods_form_ui_field_pick_related_objects_predefined');
         if (did_action('init')) {
             pods_transient_set('pods_related_objects', self::$related_objects);
         }
     }
     foreach (self::$custom_related_objects as $object => $related_object) {
         if (!isset(self::$related_objects[$object])) {
             $new_data_loaded = true;
             self::$related_objects[$object] = $related_object;
         }
     }
     return $new_data_loaded;
//.........这里部分代码省略.........
开发者ID:dylansmithing,项目名称:leader-of-rock-wordpress,代码行数:101,代码来源:pick.php

示例5: exists

 /**
  * Check to see if Pod Page exists and return data
  *
  * $uri not required, if NULL then returns REQUEST_URI matching Pod Page
  *
  * @param string $uri The Pod Page URI to check if exists
  *
  * @return array|bool
  */
 public static function exists($uri = null)
 {
     if (null === $uri) {
         $uri = parse_url(pods_current_url());
         $uri = $uri['path'];
     } else {
         $uri = explode('?', $uri);
         $uri = explode('#', $uri[0]);
         $uri = $uri[0];
     }
     $home = parse_url(get_home_url());
     if (!empty($home) && isset($home['path']) && '/' != $home['path']) {
         $uri = substr($uri, strlen($home['path']));
     }
     $uri = trim($uri, '/');
     $uri_depth = count(array_filter(explode('/', $uri))) - 1;
     $pods_page_exclusions = array('wp-admin', 'wp-content', 'wp-includes', 'index.php', 'wp-login.php', 'wp-signup.php');
     $pods_page_exclusions = apply_filters('pods_page_exclusions', $pods_page_exclusions);
     if (is_admin() || empty($uri)) {
         return false;
     }
     foreach ($pods_page_exclusions as $exclusion) {
         if (0 === strpos($uri, $exclusion)) {
             return false;
         }
     }
     $object = false;
     if (false === strpos($uri, '*') && !apply_filters('pods_page_regex_matching', false)) {
         $object = pods_by_title($uri, ARRAY_A, '_pods_page', 'publish');
     }
     $wildcard = false;
     if (empty($object)) {
         if (false === strpos($uri, '*')) {
             $object = pods_cache_get($uri, 'pods_object_page_wildcard');
             if (!empty($object)) {
                 return $object;
             }
         }
         $pod_page_rewrites = pods_transient_get('pods_object_page_rewrites');
         if (empty($pod_page_rewrites)) {
             $pod_page_rewrites = self::flush_rewrites();
         } else {
             $pod_page_rewrites = array_flip($pod_page_rewrites);
         }
         $found_rewrite_page_id = 0;
         if (!empty($pod_page_rewrites)) {
             foreach ($pod_page_rewrites as $pod_page => $pod_page_id) {
                 if (!apply_filters('pods_page_regex_matching', false)) {
                     if (false === strpos($pod_page, '*')) {
                         continue;
                     }
                     $depth_check = strlen($pod_page) - strlen(str_replace('/', '', $pod_page));
                     $pod_page = preg_quote($pod_page, '/');
                     $pod_page = str_replace('\\*', '(.*)', $pod_page);
                     if ($uri_depth == $depth_check && preg_match('/^' . $pod_page . '$/', $uri)) {
                         $found_rewrite_page_id = $pod_page_id;
                         break;
                     }
                 } elseif (preg_match('/^' . str_replace('/', '\\/', $pod_page) . '$/', $uri)) {
                     $found_rewrite_page_id = $pod_page_id;
                     break;
                 }
             }
             if (!empty($found_rewrite_page_id)) {
                 $object = get_post($found_rewrite_page_id, ARRAY_A);
                 if (empty($object) || '_pods_page' != $object['post_type']) {
                     $object = false;
                 }
             }
         }
         $wildcard = true;
     }
     if (!empty($object)) {
         $object = array('id' => $object['ID'], 'uri' => $object['post_title'], 'code' => $object['post_content'], 'phpcode' => $object['post_content'], 'precode' => get_post_meta($object['ID'], 'precode', true), 'page_template' => get_post_meta($object['ID'], 'page_template', true), 'title' => get_post_meta($object['ID'], 'page_title', true), 'options' => array('admin_only' => (bool) get_post_meta($object['ID'], 'admin_only', true), 'restrict_role' => (bool) get_post_meta($object['ID'], 'restrict_role', true), 'restrict_capability' => (bool) get_post_meta($object['ID'], 'restrict_capability', true), 'roles_allowed' => get_post_meta($object['ID'], 'roles_allowed', true), 'capability_allowed' => get_post_meta($object['ID'], 'capability_allowed', true), 'restrict_redirect' => (bool) get_post_meta($object['ID'], 'restrict_redirect', true), 'restrict_redirect_login' => (bool) get_post_meta($object['ID'], 'restrict_redirect_login', true), 'restrict_redirect_url' => get_post_meta($object['ID'], 'restrict_redirect_url', true), 'pod' => get_post_meta($object['ID'], 'pod', true), 'pod_slug' => get_post_meta($object['ID'], 'pod_slug', true)));
         if ($wildcard) {
             pods_cache_set($uri, $object, 'pods_object_page_wildcard', 3600);
         }
         return $object;
     }
     return false;
 }
开发者ID:erkmen,项目名称:wpstartersetup,代码行数:90,代码来源:Pages.php

示例6: pods_v


//.........这里部分代码省略.........
                break;
            case 'site-transient':
                $output = get_site_transient($var);
                break;
            case 'cache':
                if (isset($GLOBALS['wp_object_cache']) && is_object($GLOBALS['wp_object_cache'])) {
                    $group = 'default';
                    $force = false;
                    if (!is_array($var)) {
                        $var = explode('|', $var);
                    }
                    if (isset($var[0])) {
                        if (isset($var[1])) {
                            $group = $var[1];
                        }
                        if (isset($var[2])) {
                            $force = $var[2];
                        }
                        $var = $var[0];
                        $output = wp_cache_get($var, $group, $force);
                    }
                }
                break;
            case 'pods-transient':
                $callback = null;
                if (!is_array($var)) {
                    $var = explode('|', $var);
                }
                if (isset($var[0])) {
                    if (isset($var[1])) {
                        $callback = $var[1];
                    }
                    $var = $var[0];
                    $output = pods_transient_get($var, $callback);
                }
                break;
            case 'pods-site-transient':
                $callback = null;
                if (!is_array($var)) {
                    $var = explode('|', $var);
                }
                if (isset($var[0])) {
                    if (isset($var[1])) {
                        $callback = $var[1];
                    }
                    $var = $var[0];
                    $output = pods_site_transient_get($var, $callback);
                }
                break;
            case 'pods-cache':
                if (isset($GLOBALS['wp_object_cache']) && is_object($GLOBALS['wp_object_cache'])) {
                    $group = 'default';
                    $callback = null;
                    if (!is_array($var)) {
                        $var = explode('|', $var);
                    }
                    if (isset($var[0])) {
                        if (isset($var[1])) {
                            $group = $var[1];
                        }
                        if (isset($var[2])) {
                            $callback = $var[2];
                        }
                        $var = $var[0];
                        $output = pods_cache_get($var, $group, $callback);
                    }
开发者ID:dylansmithing,项目名称:leader-of-rock-wordpress,代码行数:67,代码来源:data.php

示例7: setup_updated_messages

 /**
  * Update Post Type messages
  *
  * @param array $messages
  *
  * @return array
  * @since 2.0.2
  */
 public function setup_updated_messages($messages)
 {
     global $post, $post_ID;
     $post_types = PodsMeta::$post_types;
     $existing_post_types = get_post_types();
     $pods_cpt_ct = pods_transient_get('pods_wp_cpt_ct');
     if (empty($pods_cpt_ct) || empty($post_types)) {
         return $messages;
     }
     foreach ($post_types as $post_type) {
         if (!isset($pods_cpt_ct['post_types'][$post_type['name']])) {
             continue;
         }
         $labels = self::object_label_fix($pods_cpt_ct['post_types'][$post_type['name']], 'post_type');
         $labels = $labels['labels'];
         $messages[$post_type['name']] = array(1 => sprintf(__('%s updated. <a href="%s">%s</a>', 'pods'), $labels['singular_name'], esc_url(get_permalink($post_ID)), $labels['view_item']), 2 => __('Custom field updated.', 'pods'), 3 => __('Custom field deleted.', 'pods'), 4 => sprintf(__('%s updated.', 'pods'), $labels['singular_name']), 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'pods'), $labels['singular_name'], wp_post_revision_title((int) $_GET['revision'], false)) : false, 6 => sprintf(__('%s published. <a href="%s">%s</a>', 'pods'), $labels['singular_name'], esc_url(get_permalink($post_ID)), $labels['view_item']), 7 => sprintf(__('%s saved.', 'pods'), $labels['singular_name']), 8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'pods'), $labels['singular_name'], esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $labels['singular_name']), 9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'pods'), $labels['singular_name'], date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $labels['singular_name']), 10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'pods'), $labels['singular_name'], esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $labels['singular_name']));
         if (false === (bool) $pods_cpt_ct['post_types'][$post_type['name']]['public']) {
             $messages[$post_type['name']][1] = sprintf(__('%s updated.', 'pods'), $labels['singular_name']);
             $messages[$post_type['name']][6] = sprintf(__('%s published.', 'pods'), $labels['singular_name']);
             $messages[$post_type['name']][8] = sprintf(__('%s submitted.', 'pods'), $labels['singular_name']);
             $messages[$post_type['name']][9] = sprintf(__('%s scheduled for: <strong>%1$s</strong>.', 'pods'), $labels['singular_name'], date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)));
             $messages[$post_type['name']][10] = sprintf(__('%s draft updated.', 'pods'), $labels['singular_name']);
         }
     }
     return $messages;
 }
开发者ID:centaurustech,项目名称:chipin,代码行数:34,代码来源:PodsInit.php

示例8: get_table_info

 /**
  * Get information about an objects MySQL table
  *
  * @param string $object_type
  * @param string $object The object to look for
  * @param null $name (optional) Name of the pod to load
  * @param array $pod (optional) Array with pod information
  * @param array $field (optional) Array with field information
  *
  * @return array|bool
  *
  * @since 2.0
  */
 public function get_table_info($object_type, $object, $name = null, $pod = null, $field = null)
 {
     /**
      * @var $wpdb wpdb
      * @var $sitepress SitePress
      * @var $icl_adjust_id_url_filter_off boolean
      */
     global $wpdb, $sitepress, $icl_adjust_id_url_filter_off, $polylang;
     // @todo Handle $object arrays for Post Types, Taxonomies, Comments (table pulled from first object in array)
     $info = array('object_type' => $object_type, 'type' => null, 'object_name' => $object, 'object_hierarchical' => false, 'table' => $object, 'meta_table' => $object, 'pod_table' => $wpdb->prefix . 'pods_' . (empty($object) ? $name : $object), 'field_id' => 'id', 'field_index' => 'name', 'field_slug' => null, 'field_type' => null, 'field_parent' => null, 'field_parent_select' => null, 'meta_field_id' => 'id', 'meta_field_index' => 'name', 'meta_field_value' => 'name', 'pod_field_id' => 'id', 'pod_field_index' => 'name', 'pod_field_slug' => null, 'pod_field_parent' => null, 'join' => array(), 'where' => null, 'where_default' => null, 'orderby' => null, 'pod' => null, 'recurse' => false);
     if (empty($object_type)) {
         $object_type = 'post_type';
         $object = 'post';
     }
     $pod_name = $pod;
     if (is_array($pod_name)) {
         $pod_name = pods_var_raw('name', $pod_name, version_compare(PHP_VERSION, '5.4.0', '>=') ? json_encode($pod_name, JSON_UNESCAPED_UNICODE) : json_encode($pod_name), null, true);
     }
     $field_name = $field;
     if (is_array($field_name)) {
         $field_name = pods_var_raw('name', $field_name, version_compare(PHP_VERSION, '5.4.0', '>=') ? json_encode($pod_name, JSON_UNESCAPED_UNICODE) : json_encode($field_name), null, true);
     }
     $transient = 'pods_get_table_info_' . md5($object_type . '_object_' . $object . '_name_' . $name . '_pod_' . $pod_name . '_field_' . $field_name);
     $current_language = false;
     $current_language_t_id = $current_language_tt_id = 0;
     // WPML support
     if (is_object($sitepress) && !$icl_adjust_id_url_filter_off) {
         $current_language = pods_sanitize(ICL_LANGUAGE_CODE);
     } elseif (is_object($polylang) && function_exists('pll_current_language')) {
         $current_language = pods_sanitize(pll_current_language('slug'));
         if (!empty($current_language)) {
             $current_language_t_id = (int) $polylang->get_language($current_language)->term_id;
             $current_language_tt_id = (int) $polylang->get_language($current_language)->term_taxonomy_id;
         }
     }
     if (!empty($current_language)) {
         $transient = 'pods_get_table_info_' . $current_language . '_' . md5($object_type . '_object_' . $object . '_name_' . $name . '_pod_' . $pod_name . '_field_' . $field_name);
     }
     $_info = false;
     if (pods_api_cache()) {
         $_info = pods_transient_get($transient);
     }
     if (pods_api_cache() && false === $_info && !did_action('init')) {
         $_info = pods_transient_get($transient . '_pre_init');
     }
     if (false !== $_info) {
         $info = $_info;
     } else {
         if ('pod' == $object_type && null === $pod) {
             if (empty($name)) {
                 $prefix = 'pod-';
                 // Make sure we actually have the prefix before trying anything with the name
                 if (0 === strpos($object_type, $prefix)) {
                     $name = substr($object_type, strlen($prefix), strlen($object_type));
                 }
             }
             if (empty($name) && !empty($object)) {
                 $name = $object;
             }
             $pod = $this->load_pod(array('name' => $name, 'table_info' => false), false);
             if (!empty($pod)) {
                 $object_type = $pod['type'];
                 $name = $pod['name'];
                 $object = $pod['object'];
                 $info['pod'] = $pod;
             }
         } elseif (null === $pod) {
             if (empty($name)) {
                 $prefix = $object_type . '-';
                 // Make sure we actually have the prefix before trying anything with the name
                 if (0 === strpos($object_type, $prefix)) {
                     $name = substr($object_type, strlen($prefix), strlen($object_type));
                 }
             }
             if (empty($name) && !empty($object)) {
                 $name = $object;
             }
             if (!empty($name)) {
                 $pod = $this->load_pod(array('name' => $name, 'table_info' => false), false);
                 if (!empty($pod) && (null === $object_type || $object_type == $pod['type'])) {
                     $object_type = $pod['type'];
                     $name = $pod['name'];
                     $object = $pod['object'];
                     $info['pod'] = $pod;
                 }
             }
         } elseif (!empty($pod)) {
//.........这里部分代码省略.........
开发者ID:Ingenex,项目名称:redesign,代码行数:101,代码来源:PodsAPI.php

示例9: add_rest_support

 /**
  * Add REST API support to post type and taxonomy objects.
  *
  * @uses "init"
  *
  * @since 2.5.6
  */
 public function add_rest_support()
 {
     static $rest_support_added;
     if (!function_exists('register_rest_field')) {
         return;
     }
     include_once PODS_DIR . 'classes/PodsRESTFields.php';
     include_once PODS_DIR . 'classes/PodsRESTHandlers.php';
     $rest_bases = pods_transient_get('pods_rest_bases');
     if (empty($rest_bases)) {
         $pods = pods_api()->load_pods();
         $rest_bases = array();
         if (!empty($pods) && is_array($pods)) {
             foreach ($pods as $pod) {
                 $type = $pod['type'];
                 if (in_array($type, array('post_type', 'taxonomy'))) {
                     if ($pod && PodsRESTHandlers::pod_extends_core_route($pod)) {
                         $rest_bases[$pod['name']] = array('type' => $type, 'base' => sanitize_title(pods_v('rest_base', $pod['options'], $pod['name'])));
                     }
                 }
             }
         }
         if (empty($rest_bases)) {
             $rest_bases = 'none';
         }
         pods_transient_set('pods_rest_bases', $rest_bases);
     }
     if (empty($rest_support_added) && !empty($rest_bases) && 'none' !== $rest_bases) {
         foreach ($rest_bases as $pod_name => $pod_info) {
             $pod_type = $pod_info['type'];
             $rest_base = $pod_info['base'];
             if ('post_type' == $pod_type) {
                 PodsRESTHandlers::post_type_rest_support($pod_name, $rest_base);
             } elseif ('taxonomy' == $pod_type) {
                 PodsRESTHandlers::taxonomy_rest_support($pod_name, $rest_base);
             }
             new PodsRESTFields($pod_name);
         }
         $rest_support_added = true;
     }
 }
开发者ID:benbrandt,项目名称:pods,代码行数:48,代码来源:PodsInit.php

示例10: archive_test

 /**
  * Test if archive is set for post types that don't have archives.
  *
  * @return bool|mixed|null|void
  *
  * @since 2.4.5
  */
 function archive_test()
 {
     //try to get cached results of this method
     $key = 'pods_pfat_archive_test';
     $archive_test = pods_transient_get($key);
     if ($archive_test === false) {
         $front = $this->front_end(true);
         $auto_pods = $front->auto_pods();
         foreach ($auto_pods as $name => $pod) {
             if (!$pod['has_archive'] && $pod['archive'] && $pod['type'] !== 'taxonomy' && !in_array($name, array('post', 'page', 'attachment'))) {
                 $archive_test[$pod['label']] = 'fail';
             }
         }
         pods_transient_set($key, $archive_test);
     }
     return $archive_test;
 }
开发者ID:benbrandt,项目名称:pods,代码行数:24,代码来源:Pods_Templates_Auto_Template_Settings.php

示例11: pods_v


//.........这里部分代码省略.........
                break;
            case 'site-transient':
                $output = get_site_transient($var);
                break;
            case 'cache':
                if (isset($GLOBALS['wp_object_cache']) && is_object($GLOBALS['wp_object_cache'])) {
                    $group = 'default';
                    $force = false;
                    if (!is_array($var)) {
                        $var = explode('|', $var);
                    }
                    if (isset($var[0])) {
                        if (isset($var[1])) {
                            $group = $var[1];
                        }
                        if (isset($var[2])) {
                            $force = $var[2];
                        }
                        $var = $var[0];
                        $output = wp_cache_get($var, $group, $force);
                    }
                }
                break;
            case 'pods-transient':
                $callback = null;
                if (!is_array($var)) {
                    $var = explode('|', $var);
                }
                if (isset($var[0])) {
                    if (isset($var[1])) {
                        $callback = $var[1];
                    }
                    $var = $var[0];
                    $output = pods_transient_get($var, $callback);
                }
                break;
            case 'pods-site-transient':
                $callback = null;
                if (!is_array($var)) {
                    $var = explode('|', $var);
                }
                if (isset($var[0])) {
                    if (isset($var[1])) {
                        $callback = $var[1];
                    }
                    $var = $var[0];
                    $output = pods_site_transient_get($var, $callback);
                }
                break;
            case 'pods-cache':
                if (isset($GLOBALS['wp_object_cache']) && is_object($GLOBALS['wp_object_cache'])) {
                    $group = 'default';
                    $callback = null;
                    if (!is_array($var)) {
                        $var = explode('|', $var);
                    }
                    if (isset($var[0])) {
                        if (isset($var[1])) {
                            $group = $var[1];
                        }
                        if (isset($var[2])) {
                            $callback = $var[2];
                        }
                        $var = $var[0];
                        $output = pods_cache_get($var, $group, $callback);
                    }
开发者ID:pods-framework,项目名称:pods,代码行数:67,代码来源:data.php

示例12: get_avatar

 /**
  * Take over the avatar served from WordPress
  *
  * @param string $avatar Default Avatar Image output from WordPress
  * @param int|string|object $id_or_email A user ID, email address, or comment object
  * @param int $size Size of the avatar image
  * @param string $default URL to a default image to use if no avatar is available
  * @param string $alt Alternate text to use in image tag. Defaults to blank
  * @return string <img> tag for the user's avatar
  */
 public function get_avatar($avatar, $id_or_email, $size, $default = '', $alt = '')
 {
     $_user_ID = 0;
     if (is_numeric($id_or_email) && 0 < $id_or_email) {
         $_user_ID = (int) $id_or_email;
     } elseif (is_object($id_or_email) && isset($id_or_email->user_id) && 0 < $id_or_email->user_id) {
         $_user_ID = (int) $id_or_email->user_id;
     } elseif (is_object($id_or_email) && isset($id_or_email->ID) && isset($id_or_email->user_login) && 0 < $id_or_email->ID) {
         $_user_ID = (int) $id_or_email->ID;
     } elseif (!is_object($id_or_email) && false !== strpos($id_or_email, '@')) {
         $_user = get_user_by('email', $id_or_email);
         if (!empty($_user)) {
             $_user_ID = (int) $_user->ID;
         }
     }
     if (0 < $_user_ID && !empty(PodsMeta::$user)) {
         $avatar_cached = pods_cache_get($_user_ID . '-' . $size, 'pods_avatars');
         if (!empty($avatar_cached)) {
             $avatar = $avatar_cached;
         } else {
             $avatar_field = pods_transient_get('pods_avatar_field');
             $user = current(PodsMeta::$user);
             if (empty($avatar_field)) {
                 foreach ($user['fields'] as $field) {
                     if ('avatar' == $field['type']) {
                         $avatar_field = $field['name'];
                         pods_transient_set('pods_avatar_field', $avatar_field);
                         break;
                     }
                 }
             } elseif (!isset($user['fields'][$avatar_field])) {
                 $avatar_field = false;
             }
             if (!empty($avatar_field)) {
                 $user_avatar = get_user_meta($_user_ID, $avatar_field . '.ID', true);
                 if (!empty($user_avatar)) {
                     $attributes = array('alt' => '', 'class' => 'avatar avatar-' . $size . ' photo');
                     if (!empty($alt)) {
                         $attributes['alt'] = $alt;
                     }
                     $user_avatar = pods_image($user_avatar, array($size, $size), 0, $attributes);
                     if (!empty($user_avatar)) {
                         $avatar = $user_avatar;
                         pods_cache_set($_user_ID . '-' . $size, $avatar, 'pods_avatars');
                     }
                 }
             }
         }
     }
     return $avatar;
 }
开发者ID:centaurustech,项目名称:chipin,代码行数:61,代码来源:avatar.php

示例13: setup_related_objects

 /**
  * Setup related objects
  *
  * @param boolean $force Whether to force refresh of related objects
  *
  * @since 2.3
  */
 public function setup_related_objects($force = false)
 {
     $related_objects = pods_transient_get('pods_related_objects');
     if (!$force && !empty($related_objects)) {
         self::$related_objects = $related_objects;
     } else {
         // Custom
         self::$related_objects['custom-simple'] = array('label' => __('Simple (custom defined list)', 'pods'), 'group' => __('Custom', 'pods'), 'simple' => true);
         // Pods
         $pod_options = array();
         // Advanced Content Types
         $_pods = PodsMeta::$advanced_content_types;
         foreach ($_pods as $pod) {
             $pod_options[$pod['name']] = $pod['label'] . ' (' . $pod['name'] . ')';
         }
         // Settings
         $_pods = PodsMeta::$settings;
         foreach ($_pods as $pod) {
             $pod_options[$pod['name']] = $pod['label'] . ' (' . $pod['name'] . ')';
         }
         asort($pod_options);
         foreach ($pod_options as $pod => $label) {
             self::$related_objects['pod-' . $pod] = array('label' => $label, 'group' => __('Pods', 'pods'), 'bidirectional' => true);
         }
         // Post Types
         $post_types = get_post_types();
         asort($post_types);
         $ignore = array('attachment', 'revision', 'nav_menu_item');
         foreach ($post_types as $post_type => $label) {
             if (in_array($post_type, $ignore) || empty($post_type)) {
                 unset($post_types[$post_type]);
                 continue;
             } elseif (0 === strpos($post_type, '_pods_')) {
                 unset($post_types[$post_type]);
                 continue;
             }
             $post_type = get_post_type_object($post_type);
             self::$related_objects['post_type-' . $post_type->name] = array('label' => $post_type->label . ' (' . $post_type->name . ')', 'group' => __('Post Types', 'pods'), 'bidirectional' => true);
         }
         // Taxonomies
         $taxonomies = get_taxonomies();
         asort($taxonomies);
         $ignore = array('nav_menu', 'post_format');
         foreach ($taxonomies as $taxonomy => $label) {
             if (in_array($taxonomy, $ignore) || empty($taxonomy)) {
                 continue;
             }
             $taxonomy = get_taxonomy($taxonomy);
             self::$related_objects['taxonomy-' . $taxonomy->name] = array('label' => $taxonomy->label . ' (' . $taxonomy->name . ')', 'group' => __('Taxonomies', 'pods'), 'bidirectional' => true);
         }
         // Other WP Objects
         self::$related_objects['user'] = array('label' => __('Users', 'pods'), 'group' => __('Other WP Objects', 'pods'), 'bidirectional' => true);
         self::$related_objects['role'] = array('label' => __('User Roles', 'pods'), 'group' => __('Other WP Objects', 'pods'), 'simple' => true, 'data_callback' => array($this, 'data_roles'));
         self::$related_objects['capability'] = array('label' => __('User Capabilities', 'pods'), 'group' => __('Other WP Objects', 'pods'), 'simple' => true, 'data_callback' => array($this, 'data_capabilities'));
         self::$related_objects['media'] = array('label' => __('Media', 'pods'), 'group' => __('Other WP Objects', 'pods'), 'bidirectional' => true);
         self::$related_objects['comment'] = array('label' => __('Comments', 'pods'), 'group' => __('Other WP Objects', 'pods'), 'bidirectional' => true);
         self::$related_objects['image-size'] = array('label' => __('Image Sizes', 'pods'), 'group' => __('Other WP Objects', 'pods'), 'simple' => true, 'data_callback' => array($this, 'data_image_sizes'));
         self::$related_objects['nav_menu'] = array('label' => __('Navigation Menus', 'pods'), 'group' => __('Other WP Objects', 'pods'));
         self::$related_objects['post_format'] = array('label' => __('Post Formats', 'pods'), 'group' => __('Other WP Objects', 'pods'));
         self::$related_objects['post-status'] = array('label' => __('Post Status', 'pods'), 'group' => __('Other WP Objects', 'pods'), 'simple' => true, 'data_callback' => array($this, 'data_post_stati'));
         do_action('pods_form_ui_field_pick_related_objects_other');
         self::$related_objects['country'] = array('label' => __('Countries', 'pods'), 'group' => __('Predefined Lists', 'pods'), 'simple' => true, 'data_callback' => array($this, 'data_countries'));
         self::$related_objects['us_state'] = array('label' => __('US States', 'pods'), 'group' => __('Predefined Lists', 'pods'), 'simple' => true, 'data_callback' => array($this, 'data_us_states'));
         do_action('pods_form_ui_field_pick_related_objects_predefined');
         if (did_action('init')) {
             pods_transient_set('pods_related_objects', self::$related_objects);
         }
     }
     foreach (self::$custom_related_objects as $object => $related_object) {
         self::$related_objects[$object] = $related_object;
     }
 }
开发者ID:centaurustech,项目名称:chipin,代码行数:79,代码来源:pick.php

示例14: get_components

 /**
  * Get list of components available
  *
  * @since 2.0
  */
 public function get_components()
 {
     $components = pods_transient_get('pods_components');
     if (1 == pods_var('pods_debug_components', 'get', 0) && pods_is_admin(array('pods'))) {
         $components = array();
     }
     if (PodsInit::$version != PODS_VERSION || !is_array($components) || empty($components) || is_admin() && isset($_GET['page']) && 'pods-components' == $_GET['page'] && 1 !== pods_transient_get('pods_components_refresh')) {
         do_action('pods_components_get');
         $component_dir = @opendir(untrailingslashit($this->components_dir));
         $component_files = array();
         if (false !== $component_dir) {
             while (false !== ($file = readdir($component_dir))) {
                 if ('.' == substr($file, 0, 1)) {
                     continue;
                 } elseif (is_dir($this->components_dir . $file)) {
                     $component_subdir = @opendir($this->components_dir . $file);
                     if ($component_subdir) {
                         while (false !== ($subfile = readdir($component_subdir))) {
                             if ('.' == substr($subfile, 0, 1)) {
                                 continue;
                             } elseif ('.php' == substr($subfile, -4)) {
                                 $component_files[] = str_replace('\\', '/', $file . '/' . $subfile);
                             }
                         }
                         closedir($component_subdir);
                     }
                 } elseif ('.php' == substr($file, -4)) {
                     $component_files[] = $file;
                 }
             }
             closedir($component_dir);
         }
         $default_headers = array('ID' => 'ID', 'Name' => 'Name', 'ShortName' => 'Short Name', 'PluginName' => 'Plugin Name', 'ComponentName' => 'Component Name', 'URI' => 'URI', 'MenuName' => 'Menu Name', 'MenuPage' => 'Menu Page', 'MenuAddPage' => 'Menu Add Page', 'MustUse' => 'Must Use', 'Description' => 'Description', 'Version' => 'Version', 'Category' => 'Category', 'Author' => 'Author', 'AuthorURI' => 'Author URI', 'Class' => 'Class', 'Hide' => 'Hide', 'PluginDependency' => 'Plugin Dependency', 'ThemeDependency' => 'Theme Dependency', 'DeveloperMode' => 'Developer Mode', 'TablelessMode' => 'Tableless Mode', 'Capability' => 'Capability', 'Plugin' => 'Plugin');
         $component_files = apply_filters('pods_components_register', $component_files);
         $components = array();
         foreach ($component_files as $component_file) {
             $external = false;
             if (is_array($component_file) && isset($component_file['File'])) {
                 $component = $component_file = $component_file['File'];
                 $external = true;
             } else {
                 $component = $this->components_dir . $component_file;
             }
             if (!is_readable($component)) {
                 continue;
             }
             $component_data = get_file_data($component, $default_headers, 'pods_component');
             if (empty($component_data['Name']) && empty($component_data['ComponentName']) && empty($component_data['PluginName']) || 'yes' == $component_data['Hide']) {
                 continue;
             }
             if (isset($component_data['Plugin']) && pods_is_plugin_active($component_data['Plugin'])) {
                 continue;
             }
             if (empty($component_data['Name'])) {
                 if (!empty($component_data['ComponentName'])) {
                     $component_data['Name'] = $component_data['ComponentName'];
                 } elseif (!empty($component_data['PluginName'])) {
                     $component_data['Name'] = $component_data['PluginName'];
                 }
             }
             if (empty($component_data['ShortName'])) {
                 $component_data['ShortName'] = $component_data['Name'];
             }
             if (empty($component_data['MenuName'])) {
                 $component_data['MenuName'] = $component_data['Name'];
             }
             if (empty($component_data['Class'])) {
                 $component_data['Class'] = 'Pods_' . pods_clean_name(basename($component, '.php'), false);
             }
             if (empty($component_data['ID'])) {
                 $component_data['ID'] = $component_data['Name'];
             }
             $component_data['ID'] = sanitize_title($component_data['ID']);
             if ('on' == strtolower($component_data['DeveloperMode']) || 1 == $component_data['DeveloperMode']) {
                 $component_data['DeveloperMode'] = true;
             } else {
                 $component_data['DeveloperMode'] = false;
             }
             if ('on' == strtolower($component_data['TablelessMode']) || 1 == $component_data['TablelessMode']) {
                 $component_data['TablelessMode'] = true;
             } else {
                 $component_data['TablelessMode'] = false;
             }
             $component_data['External'] = (bool) $external;
             if ('on' == strtolower($component_data['MustUse']) || '1' == $component_data['MustUse']) {
                 $component_data['MustUse'] = true;
             } elseif ('off' == strtolower($component_data['MustUse']) || '0' == $component_data['MustUse']) {
                 $component_data['MustUse'] = false;
             } else {
                 $component_data['MustUse'] = $component_data['External'];
             }
             $component_data['File'] = $component_file;
             $components[$component_data['ID']] = $component_data;
         }
         ksort($components);
//.........这里部分代码省略.........
开发者ID:Ingenex,项目名称:redesign,代码行数:101,代码来源:PodsComponents.php

示例15: auto_pods

 /**
  * Get all Pods with auto template enable and its settings
  *
  * @return array With info about auto template settings per post type
  *
  * @since 2.4.5
  */
 function auto_pods()
 {
     /**
      * Filter to override all settings for which templates are used.
      *
      * Note: If this filter does not return null, all back-end settings are ignored. To add to settings with a filter, use 'pods_pfat_auto_pods';
      *
      * @param array $auto_pods Array of parameters to use instead of those from settings.
      *
      * @return array Settings arrays for each post type.
      *
      * @since 2.4.5
      */
     $auto_pods = apply_filters('pods_pfat_auto_pods_override', null);
     if (!is_null($auto_pods)) {
         return $auto_pods;
     }
     //try to get cached results of this method
     $key = '_pods_pfat_auto_pods';
     $auto_pods = pods_transient_get($key);
     //check if we already have the results cached & use it if we can.
     if ($auto_pods === false) {
         //get possible pods
         $the_pods = $this->the_pods();
         //start output array empty
         $auto_pods = array();
         //get pods api class
         $api = pods_api();
         //loop through each to see if auto templates is enabled
         foreach ($the_pods as $the_pod => $the_pod_label) {
             //get this Pods' data.
             $pod_data = $api->load_pod(array('name' => $the_pod));
             //if auto template is enabled add info about Pod to array
             if (1 == pods_v('pfat_enable', $pod_data['options'])) {
                 //check if pfat_single and pfat_archive are set
                 $single = pods_v('pfat_single', $pod_data['options'], false, true);
                 $archive = pods_v('pfat_archive', $pod_data['options'], false, true);
                 $single_append = pods_v('pfat_append_single', $pod_data['options'], true, true);
                 $archive_append = pods_v('pfat_append_archive', $pod_data['options'], true, true);
                 $single_filter = pods_v('pfat_filter_single', $pod_data['options'], 'the_content', true);
                 $archive_filter = pods_v('pfat_filter_archive', $pod_data['options'], 'the_content', true);
                 $type = pods_v('type', $pod_data, false, true);
                 //check if it's a post type that has an arhive
                 if ($type === 'post_type' && $the_pod !== 'post' || $the_pod !== 'page') {
                     $has_archive = pods_v('has_archive', $pod_data['options'], false, true);
                 } else {
                     $has_archive = true;
                 }
                 if (empty($single_filter)) {
                     $single_filter = 'the_content';
                 }
                 if (empty($archive_filter)) {
                     $archive_filter = 'the_content';
                 }
                 //build output array
                 $auto_pods[$the_pod] = array('name' => $the_pod, 'label' => $the_pod_label, 'single' => $single, 'archive' => $archive, 'single_append' => $single_append, 'archive_append' => $archive_append, 'has_archive' => $has_archive, 'single_filter' => $single_filter, 'archive_filter' => $archive_filter, 'type' => $type);
             }
         }
         //endforeach
         //cache the results
         pods_transient_set($key, $auto_pods);
     }
     /**
      * Add to or change settings.
      *
      * Use this filter to change or add to the settings set in the back-end for this plugin. Has no effect if 'pods_pfat_auto_pods_override' filter is being used.
      *
      * @param array $auto_pods Array of parameters to use instead of those from settings.
      *
      * @return array Settings arrays for each post type.
      *
      * @since 2.4.5
      */
     $auto_pods = apply_filters('pods_pfat_auto_pods', $auto_pods);
     return $auto_pods;
 }
开发者ID:pods-framework,项目名称:pods,代码行数:83,代码来源:Pods_Templates_Auto_Template_Front_End.php


注:本文中的pods_transient_get函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。