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


PHP pods_version_check函数代码示例

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


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

示例1: pods_var

$title_editable = pods_var($form_field_type . '_edit_title', $options, 0);
if ('images' == $limit_file_type) {
    $limit_types = 'jpg,jpeg,png,gif';
} elseif ('video' == $limit_file_type) {
    $limit_types = 'mpg,mov,flv,mp4';
} elseif ('audio' == $limit_file_type) {
    $limit_types = 'mp3,m4a,wav,wma';
} elseif ('text' == $limit_file_type) {
    $limit_types = 'txt,rtx,csv,tsv';
} elseif ('any' == $limit_file_type) {
    $limit_types = '';
} else {
    $limit_types = pods_var($form_field_type . '_allowed_extensions', $options, '', null, true);
}
$limit_types = trim(str_replace(array(' ', '.', "\n", "\t", ';'), array('', ',', ',', ','), $limit_types), ',');
if (pods_version_check('wp', '3.5')) {
    $mime_types = wp_get_mime_types();
    if (in_array($limit_file_type, array('images', 'audio', 'video'))) {
        $new_limit_types = array();
        foreach ($mime_types as $type => $mime) {
            if (0 === strpos($mime, $limit_file_type)) {
                $type = explode('|', $type);
                $new_limit_types = array_merge($new_limit_types, $type);
            }
        }
        if (!empty($new_limit_types)) {
            $limit_types = implode(',', $new_limit_types);
        }
    } elseif ('any' != $limit_file_type) {
        $new_limit_types = array();
        $limit_types = explode(',', $limit_types);
开发者ID:Ingenex,项目名称:redesign,代码行数:31,代码来源:plupload.php

示例2: pods_compatibility_check

/**
 * Check if Pods is compatible with WP / PHP / MySQL or not
 *
 * @return bool
 *
 * @since 1.10
 */
function pods_compatibility_check()
{
    $compatible = true;
    if (!pods_version_check('wp', PODS_WP_VERSION_MINIMUM)) {
        $compatible = false;
        add_action('admin_notices', 'pods_version_notice_wp');
    }
    if (!pods_version_check('php', PODS_PHP_VERSION_MINIMUM)) {
        $compatible = false;
        add_action('admin_notices', 'pods_version_notice_php');
    }
    if (!pods_version_check('mysql', PODS_MYSQL_VERSION_MINIMUM)) {
        $compatible = false;
        add_action('admin_notices', 'pods_version_notice_mysql');
    }
    return $compatible;
}
开发者ID:Ingenex,项目名称:redesign,代码行数:24,代码来源:general.php

示例3: group_add

 /**
  * Add a meta group of fields to add/edit forms
  *
  * @param string|array $pod The pod or type of element to attach the group to.
  * @param string $label Title of the edit screen section, visible to user.
  * @param string|array $fields Either a comma separated list of text fields or an associative array containing field infomration.
  * @param string $context (optional) The part of the page where the edit screen section should be shown ('normal', 'advanced', or 'side').
  * @param string $priority (optional) The priority within the context where the boxes should show ('high', 'core', 'default' or 'low').
  *
  * @since 2.0
  *
  * @return mixed|void
  */
 public function group_add($pod, $label, $fields, $context = 'normal', $priority = 'default')
 {
     if (!is_array($pod)) {
         $_pod = pods_api()->load_pod(array('name' => $pod), false);
         if (!empty($_pod)) {
             $pod = $_pod;
         } else {
             $type = 'post_type';
             if (in_array($pod, array('media', 'user', 'comment'))) {
                 $type = $pod;
             }
             $pod = array('name' => $pod, 'type' => $type);
         }
     }
     if (is_array($pod) && !isset($pod['id'])) {
         $defaults = array('name' => '', 'type' => 'post_type');
         $pod = array_merge($defaults, $pod);
     }
     if ('post' == $pod['type']) {
         $pod['type'] = 'post_type';
     }
     if (empty($pod['name']) && isset($pod['object']) && !empty($pod['object'])) {
         $pod['name'] = $pod['object'];
     } elseif (!isset($pod['object']) || empty($pod['object'])) {
         $pod['object'] = $pod['name'];
     }
     if (empty($pod['object'])) {
         return pods_error(__('Object required to add a Pods meta group', 'pods'));
     }
     $object_name = $pod['object'];
     if ('pod' == $pod['type']) {
         $object_name = $pod['name'];
     }
     if (!isset(self::$groups[$pod['type']])) {
         self::$groups[$pod['type']] = array();
     }
     if (!isset(self::$groups[$pod['type']][$object_name])) {
         self::$groups[$pod['type']][$object_name] = array();
     }
     $_fields = array();
     if (!is_array($fields)) {
         $fields = explode(',', $fields);
     }
     foreach ($fields as $k => $field) {
         $name = $k;
         $defaults = array('name' => $name, 'label' => $name, 'type' => 'text');
         if (!is_array($field)) {
             $name = trim($field);
             $field = array('name' => $name, 'label' => $name);
         }
         $field = array_merge($defaults, $field);
         $field['name'] = trim($field['name']);
         if (isset($pod['fields']) && isset($pod['fields'][$field['name']])) {
             $field = array_merge($field, $pod['fields'][$field['name']]);
         }
         $_fields[$k] = $field;
     }
     // Setup field options
     $fields = PodsForm::fields_setup($_fields);
     $group = array('pod' => $pod, 'label' => $label, 'fields' => $fields, 'context' => $context, 'priority' => $priority);
     // Filter group data, pass vars separately for reference down the line (in case array changed by other filter)
     $group = apply_filters('pods_meta_group_add_' . $pod['type'] . '_' . $object_name, $group, $pod, $label, $fields);
     $group = apply_filters('pods_meta_group_add_' . $pod['type'], $group, $pod, $label, $fields);
     $group = apply_filters('pods_meta_group_add', $group, $pod, $label, $fields);
     self::$groups[$pod['type']][$object_name][] = $group;
     // Hook it up!
     if ('post_type' == $pod['type']) {
         if (!has_action('add_meta_boxes', array($this, 'meta_post_add'))) {
             add_action('add_meta_boxes', array($this, 'meta_post_add'));
         }
         /*if ( !has_action( 'save_post', array( $this, 'save_post' ), 10, 2 ) )
           add_action( 'save_post', array( $this, 'save_post' ), 10, 2 );*/
     } elseif ('taxonomy' == $pod['type']) {
         if (!has_action($pod['object'] . '_edit_form_fields', array($this, 'meta_taxonomy'), 10, 2)) {
             add_action($pod['object'] . '_edit_form_fields', array($this, 'meta_taxonomy'), 10, 2);
             add_action($pod['object'] . '_add_form_fields', array($this, 'meta_taxonomy'), 10, 1);
         }
         if (!has_action('edit_term', array($this, 'save_taxonomy'), 10, 3)) {
             add_action('edit_term', array($this, 'save_taxonomy'), 10, 3);
             add_action('create_term', array($this, 'save_taxonomy'), 10, 3);
         }
     } elseif ('media' == $pod['type']) {
         if (!has_filter('wp_update_attachment_metadata', array($this, 'save_media'), 10, 2)) {
             if (pods_version_check('wp', '3.5')) {
                 add_action('add_meta_boxes', array($this, 'meta_post_add'));
                 add_action('wp_ajax_save-attachment-compat', array($this, 'save_media_ajax'), 0);
             }
//.........这里部分代码省略.........
开发者ID:centaurustech,项目名称:chipin,代码行数:101,代码来源:PodsMeta.php

示例4: pods_v_set

/**
 * Set a variable
 *
 * @param mixed $value The value to be set
 * @param mixed $var The variable name, or URI segment position / query var name (if $type is 'url')
 * @param string|array|object $type (optional) Super globals, url/url-relative, constants, globals, user data, Pod field values
 *
 * @return mixed Updated URL (if $type is 'url'), $value (if $type is 'constant'), Item ID (if $type is 'pods'), $type, or false if not set
 * @since 2.3.10
 */
function pods_v_set($value, $var, $type = 'get')
{
    $ret = false;
    if (null === $var || '' === $var) {
        // Invalid $var
    } elseif (null === $type || '' === $type) {
        // Invalid $type
    } elseif (is_array($type)) {
        $type[$var] = $value;
        $ret = $type;
    } elseif (is_object($type)) {
        $type->{$var} = $value;
        $ret = $type;
    } else {
        $type = strtolower($type);
        if ('get' == $type) {
            $_GET[$var] = $value;
            $ret = $_GET;
        } elseif ('post' == $type) {
            $_POST[$var] = $value;
            $ret = $_POST;
        } elseif ('request' == $type) {
            $_REQUEST[$var] = $value;
            $ret = $_REQUEST;
        } elseif ('url' == $type) {
            if (is_numeric($var) && function_exists('http_build_url')) {
                $url = parse_url(pods_current_url());
                $uri = trim($url['path'], '/');
                $uri = array_filter(explode('/', $uri));
                if ('first' == $var) {
                    $var = 0;
                } elseif ('last' == $var) {
                    $var = -1;
                }
                if ($var < 0) {
                    $uri[count($uri) + $var] = $value;
                } else {
                    $uri[$var] = $value;
                }
                $url['path'] = '/' . implode('/', $uri) . '/';
                $url['path'] = trim($url['path'], '/');
                $ret = http_build_url($url);
            } else {
                $ret = add_query_arg(array($var => $value));
            }
        } elseif ('server' == $type) {
            $_SERVER[$var] = $value;
            $ret = $_SERVER;
        } elseif (in_array($type, array('global', 'globals'))) {
            $GLOBALS[$var] = $value;
            $ret = $GLOBALS;
        } elseif ('session' == $type) {
            // Session start
            pods_session_start();
            $_SESSION[$var] = $value;
            $ret = $_SESSION;
        } elseif ('cookie' == $type && !headers_sent()) {
            setcookie($var, $value, time() + 10 * DAY_IN_SECONDS, COOKIEPATH);
            $ret = $_COOKIE;
        } elseif ('constant' == $type && !defined($var) && (is_scalar($value) || null === $value)) {
            define($var, $value);
            $ret = constant($var);
        } elseif ('user' == $type && is_user_logged_in()) {
            $user = get_userdata(get_current_user_id());
            if (!pods_version_check('wp', '3.5')) {
                $user_data = get_object_vars($user->data);
            } else {
                $user_data = $user->to_array();
            }
            // Role
            if ('role' == $var) {
                $user->set_role($value);
            } elseif (isset($user_data[$var])) {
                wp_update_user(array('ID' => $user->ID, $var => $value));
            } else {
                update_user_meta($user->ID, $var, $value);
            }
            $ret = get_userdata($user->ID);
        } elseif ('pods' == $type) {
            /**
             * @var $pods Pods
             */
            global $pods;
            if (is_object($pods) && 'Pods' == get_class($pods) && $pods->exists()) {
                $ret = $pods->save($var, $value);
            }
        } else {
            $ret = apply_filters('pods_var_set_' . $type, $value, $var);
        }
    }
//.........这里部分代码省略.........
开发者ID:dylansmithing,项目名称:leader-of-rock-wordpress,代码行数:101,代码来源:data.php

示例5: input

 /**
  * Customize output of the form field
  *
  * @param string $name
  * @param mixed $value
  * @param array $options
  * @param array $pod
  * @param int $id
  *
  * @since 2.0
  */
 public function input($name, $value = null, $options = null, $pod = null, $id = null)
 {
     $options = (array) $options;
     $form_field_type = PodsForm::$field_type;
     if (is_array($value)) {
         $value = implode(' ', $value);
     }
     // Farbtastic for below 3.5
     if (pods_version_check('wp', '3.5', '>')) {
         pods_view(PODS_DIR . 'ui/fields/farbtastic.php', compact(array_keys(get_defined_vars())));
     } else {
         pods_view(PODS_DIR . 'ui/fields/color.php', compact(array_keys(get_defined_vars())));
     }
 }
开发者ID:centaurustech,项目名称:chipin,代码行数:25,代码来源:color.php

示例6: admin_ajax_upload


//.........这里部分代码省略.........
                 $limit_size = (double) trim(str_ireplace('KB', '', $limit_size));
                 $limit_size = $limit_size * 1025 * 1025;
                 // convert to B
             } elseif (false !== stripos($limit_size, 'GB')) {
                 $limit_size = (double) trim(str_ireplace('GB', '', $limit_size));
                 $limit_size = $limit_size * 1025 * 1025 * 1025;
                 // convert to MB to KB to B
             } elseif (false !== stripos($limit_size, 'B')) {
                 $limit_size = (double) trim(str_ireplace('B', '', $limit_size));
             } else {
                 $limit_size = wp_max_upload_size();
             }
             if (0 < $limit_size && $limit_size < $file['size']) {
                 $error = __('File size too large, max size is %s', 'pods');
                 $error = sprintf($error, pods_var($field['type'] . '_restrict_filesize', $field['options']));
                 pods_error('<div style="color:#FF0000">Error: ' . $error . '</div>');
             }
         }
         $limit_file_type = pods_var($field['type'] . '_type', $field['options'], 'images');
         if ('images' == $limit_file_type) {
             $limit_types = 'jpg,png,gif';
         } elseif ('video' == $limit_file_type) {
             $limit_types = 'mpg,mov,flv,mp4';
         } elseif ('audio' == $limit_file_type) {
             $limit_types = 'mp3,m4a,wav,wma';
         } elseif ('text' == $limit_file_type) {
             $limit_types = 'txt,rtx,csv,tsv';
         } elseif ('any' == $limit_file_type) {
             $limit_types = '';
         } else {
             $limit_types = pods_var($field['type'] . '_allowed_extensions', $field['options'], '', null, true);
         }
         $limit_types = trim(str_replace(array(' ', '.', "\n", "\t", ';'), array('', ',', ',', ','), $limit_types), ',');
         if (pods_version_check('wp', '3.5')) {
             $mime_types = wp_get_mime_types();
             if (in_array($limit_file_type, array('images', 'audio', 'video'))) {
                 $new_limit_types = array();
                 foreach ($mime_types as $type => $mime) {
                     if (0 === strpos($mime, $limit_file_type)) {
                         $type = explode('|', $type);
                         $new_limit_types = array_merge($new_limit_types, $type);
                     }
                 }
                 if (!empty($new_limit_types)) {
                     $limit_types = implode(',', $new_limit_types);
                 }
             } elseif ('any' != $limit_file_type) {
                 $new_limit_types = array();
                 $limit_types = explode(',', $limit_types);
                 foreach ($limit_types as $k => $limit_type) {
                     $found = false;
                     foreach ($mime_types as $type => $mime) {
                         if (0 === strpos($mime, $limit_type)) {
                             $type = explode('|', $type);
                             foreach ($type as $t) {
                                 if (!in_array($t, $new_limit_types)) {
                                     $new_limit_types[] = $t;
                                 }
                             }
                             $found = true;
                         }
                     }
                     if (!$found) {
                         $new_limit_types[] = $limit_type;
                     }
                 }
开发者ID:centaurustech,项目名称:chipin,代码行数:67,代码来源:file.php

示例7: setup_content_types

 /**
  * Register Post Types and Taxonomies
  */
 public function setup_content_types($force = false)
 {
     $post_types = PodsMeta::$post_types;
     $taxonomies = PodsMeta::$taxonomies;
     $existing_post_types = get_post_types();
     $existing_taxonomies = get_taxonomies();
     $pods_cpt_ct = pods_transient_get('pods_wp_cpt_ct');
     $cpt_positions = array();
     if (empty($pods_cpt_ct) && (!empty($post_types) || !empty($taxonomies))) {
         $force = true;
     } elseif (!empty($pods_cpt_ct) && empty($pods_cpt_ct['post_types']) && !empty($post_types)) {
         $force = true;
     } elseif (!empty($pods_cpt_ct) && empty($pods_cpt_ct['taxonomies']) && !empty($taxonomies)) {
         $force = true;
     }
     if (false === $pods_cpt_ct || $force) {
         $pods_cpt_ct = array('post_types' => array(), 'taxonomies' => array());
         $pods_post_types = $pods_taxonomies = array();
         $supported_post_types = $supported_taxonomies = array();
         foreach ($post_types as $post_type) {
             // Post Type exists already
             if (isset($pods_cpt_ct['post_types'][$post_type['name']])) {
                 continue;
             } elseif (!empty($post_type['object']) && isset($existing_post_types[$post_type['object']])) {
                 continue;
             } elseif (!$force && isset($existing_post_types[$post_type['name']])) {
                 continue;
             }
             $post_type['options']['name'] = $post_type['name'];
             $post_type = array_merge($post_type, (array) $post_type['options']);
             // Labels
             $cpt_label = esc_html(pods_var_raw('label', $post_type, ucwords(str_replace('_', ' ', pods_var_raw('name', $post_type))), null, true));
             $cpt_singular = esc_html(pods_var_raw('label_singular', $post_type, ucwords(str_replace('_', ' ', pods_var_raw('label', $post_type, pods_var('name', $post_type), null, true))), null, true));
             $cpt_labels = array();
             $cpt_labels['name'] = $cpt_label;
             $cpt_labels['singular_name'] = $cpt_singular;
             $cpt_labels['menu_name'] = pods_var_raw('menu_name', $post_type, '', null, true);
             $cpt_labels['add_new'] = pods_var_raw('label_add_new', $post_type, '', null, true);
             $cpt_labels['add_new_item'] = pods_var_raw('label_add_new_item', $post_type, '', null, true);
             $cpt_labels['new_item'] = pods_var_raw('label_new_item', $post_type, '', null, true);
             $cpt_labels['edit'] = pods_var_raw('label_edit', $post_type, '', null, true);
             $cpt_labels['edit_item'] = pods_var_raw('label_edit_item', $post_type, '', null, true);
             $cpt_labels['view'] = pods_var_raw('label_view', $post_type, '', null, true);
             $cpt_labels['view_item'] = pods_var_raw('label_view_item', $post_type, '', null, true);
             $cpt_labels['all_items'] = pods_var_raw('label_all_items', $post_type, '', null, true);
             $cpt_labels['search_items'] = pods_var_raw('label_search_items', $post_type, '', null, true);
             $cpt_labels['not_found'] = pods_var_raw('label_not_found', $post_type, '', null, true);
             $cpt_labels['not_found_in_trash'] = pods_var_raw('label_not_found_in_trash', $post_type, '', null, true);
             $cpt_labels['parent'] = pods_var_raw('label_parent', $post_type, '', null, true);
             $cpt_labels['parent_item_colon'] = pods_var_raw('label_parent_item_colon', $post_type, '', null, true);
             // Supported
             $cpt_supported = array('title' => (bool) pods_var('supports_title', $post_type, false), 'editor' => (bool) pods_var('supports_editor', $post_type, false), 'author' => (bool) pods_var('supports_author', $post_type, false), 'thumbnail' => (bool) pods_var('supports_thumbnail', $post_type, false), 'excerpt' => (bool) pods_var('supports_excerpt', $post_type, false), 'trackbacks' => (bool) pods_var('supports_trackbacks', $post_type, false), 'custom-fields' => (bool) pods_var('supports_custom_fields', $post_type, false), 'comments' => (bool) pods_var('supports_comments', $post_type, false), 'revisions' => (bool) pods_var('supports_revisions', $post_type, false), 'page-attributes' => (bool) pods_var('supports_page_attributes', $post_type, false), 'post-formats' => (bool) pods_var('supports_post_formats', $post_type, false));
             // Custom Supported
             $cpt_supported_custom = pods_var('supports_custom', $post_type, '');
             if (!empty($cpt_supported_custom)) {
                 $cpt_supported_custom = explode(',', $cpt_supported_custom);
                 $cpt_supported_custom = array_filter(array_unique($cpt_supported_custom));
                 foreach ($cpt_supported_custom as $cpt_support) {
                     $cpt_supported[$cpt_support] = true;
                 }
             }
             // Genesis Support
             if (function_exists('genesis')) {
                 $cpt_supported['genesis-seo'] = (bool) pods_var('supports_genesis_seo', $post_type, false);
                 $cpt_supported['genesis-layouts'] = (bool) pods_var('supports_genesis_layouts', $post_type, false);
                 $cpt_supported['genesis-simple-sidebars'] = (bool) pods_var('supports_genesis_simple_sidebars', $post_type, false);
             }
             // WP needs something, if this was empty and none were enabled, it would show title+editor pre 3.5 :(
             $cpt_supports = array();
             if (!pods_version_check('wp', '3.5')) {
                 $cpt_supports = array('_bug_fix_pre_35');
             }
             foreach ($cpt_supported as $cpt_support => $supported) {
                 if (true === $supported) {
                     $cpt_supports[] = $cpt_support;
                 }
             }
             if (empty($cpt_supports) && pods_version_check('wp', '3.5')) {
                 $cpt_supports = false;
             }
             // Rewrite
             $cpt_rewrite = (bool) pods_var('rewrite', $post_type, true);
             $cpt_rewrite_array = array('slug' => pods_var('rewrite_custom_slug', $post_type, str_replace('_', '-', pods_var('name', $post_type)), null, true), 'with_front' => (bool) pods_var('rewrite_with_front', $post_type, true), 'feeds' => (bool) pods_var('rewrite_feeds', $post_type, (bool) pods_var('has_archive', $post_type, false)), 'pages' => (bool) pods_var('rewrite_pages', $post_type, true));
             if (false !== $cpt_rewrite) {
                 $cpt_rewrite = $cpt_rewrite_array;
             }
             $capability_type = pods_var('capability_type', $post_type, 'post');
             if ('custom' == $capability_type) {
                 $capability_type = pods_var('capability_type_custom', $post_type, 'post');
             }
             $show_in_menu = (bool) pods_var('show_in_menu', $post_type, true);
             if ($show_in_menu && 0 < strlen(pods_var_raw('menu_location_custom', $post_type))) {
                 $show_in_menu = pods_var_raw('menu_location_custom', $post_type);
             }
             // Register Post Type
             $pods_post_types[pods_var('name', $post_type)] = array('label' => $cpt_label, 'labels' => $cpt_labels, 'description' => esc_html(pods_var_raw('description', $post_type)), 'public' => (bool) pods_var('public', $post_type, true), 'publicly_queryable' => (bool) pods_var('publicly_queryable', $post_type, (bool) pods_var('public', $post_type, true)), 'exclude_from_search' => (bool) pods_var('exclude_from_search', $post_type, (bool) pods_var('public', $post_type, true) ? false : true), 'show_ui' => (bool) pods_var('show_ui', $post_type, (bool) pods_var('public', $post_type, true)), 'show_in_menu' => $show_in_menu, 'show_in_admin_bar' => (bool) pods_var('show_in_admin_bar', $post_type, (bool) pods_var('show_in_menu', $post_type, true)), 'menu_position' => (int) pods_var('menu_position', $post_type, 0, null, true), 'menu_icon' => pods_var('menu_icon', $post_type, null, null, true), 'capability_type' => $capability_type, 'map_meta_cap' => (bool) pods_var('capability_type_extra', $post_type, true), 'hierarchical' => (bool) pods_var('hierarchical', $post_type, false), 'supports' => $cpt_supports, 'has_archive' => (bool) pods_var('has_archive', $post_type, false), 'rewrite' => $cpt_rewrite, 'query_var' => false !== (bool) pods_var('query_var', $post_type, true) ? pods_var('query_var_string', $post_type, pods_var('name', $post_type), null, true) : false, 'can_export' => (bool) pods_var('can_export', $post_type, true), 'show_in_nav_menus' => (bool) pods_var('show_in_nav_menus', $post_type, (bool) pods_var('public', $post_type, true)));
             if (25 == $pods_post_types[pods_var('name', $post_type)]['menu_position']) {
//.........这里部分代码省略.........
开发者ID:centaurustech,项目名称:chipin,代码行数:101,代码来源:PodsInit.php

示例8: input

 /**
  * Customize output of the form field
  *
  * @param string $name
  * @param mixed $value
  * @param array $options
  * @param array $pod
  * @param int $id
  *
  * @since 2.0
  */
 public function input($name, $value = null, $options = null, $pod = null, $id = null)
 {
     $options = (array) $options;
     $form_field_type = PodsForm::$field_type;
     if (!is_admin()) {
         include_once ABSPATH . '/wp-admin/includes/template.php';
         if (is_multisite()) {
             include_once ABSPATH . '/wp-admin/includes/ms.php';
         }
     }
     if ((defined('PODS_DISABLE_FILE_UPLOAD') && true === PODS_DISABLE_FILE_UPLOAD || defined('PODS_UPLOAD_REQUIRE_LOGIN') && is_bool(PODS_UPLOAD_REQUIRE_LOGIN) && true === PODS_UPLOAD_REQUIRE_LOGIN && !is_user_logged_in() || defined('PODS_UPLOAD_REQUIRE_LOGIN') && !is_bool(PODS_UPLOAD_REQUIRE_LOGIN) && (!is_user_logged_in() || !current_user_can(PODS_UPLOAD_REQUIRE_LOGIN))) && (defined('PODS_DISABLE_FILE_BROWSER') && true === PODS_DISABLE_FILE_BROWSER || defined('PODS_FILES_REQUIRE_LOGIN') && is_bool(PODS_FILES_REQUIRE_LOGIN) && true === PODS_FILES_REQUIRE_LOGIN && !is_user_logged_in() || defined('PODS_FILES_REQUIRE_LOGIN') && !is_bool(PODS_FILES_REQUIRE_LOGIN) && (!is_user_logged_in() || !current_user_can(PODS_FILES_REQUIRE_LOGIN)))) {
         ?>
     <p>You do not have access to upload / browse files. Contact your website admin to resolve.</p>
     <?php 
         return;
     }
     if ('plupload' == pods_var(self::$type . '_uploader', $options)) {
         $field_type = 'plupload';
     } elseif ('attachment' == pods_var(self::$type . '_uploader', $options)) {
         if (!pods_version_check('wp', '3.5') || !is_admin()) {
             // @todo test frontend media modal
             $field_type = 'attachment';
         } else {
             $field_type = 'media';
         }
     } else {
         // Support custom File Uploader integration
         do_action('pods_form_ui_field_avatar_uploader_' . pods_var(self::$type . '_uploader', $options), $name, $value, $options, $pod, $id);
         do_action('pods_form_ui_field_avatar_uploader', pods_var(self::$type . '_uploader', $options), $name, $value, $options, $pod, $id);
         return;
     }
     pods_view(PODS_DIR . 'ui/fields/' . $field_type . '.php', compact(array_keys(get_defined_vars())));
 }
开发者ID:centaurustech,项目名称:chipin,代码行数:44,代码来源:avatar.php

示例9: get_object

 /**
  * @param $object_type
  * @param $object_id
  * @param string $aux
  *
  * @return bool|mixed
  */
 public function get_object($object_type, $object_id, $aux = '')
 {
     global $wpdb;
     if ('term' == $object_type) {
         $object_type = 'taxonomy';
     }
     if ('post_type' == $object_type) {
         $objects = self::$post_types;
     } elseif ('taxonomy' == $object_type) {
         $objects = self::$taxonomies;
     } elseif ('media' == $object_type) {
         $objects = self::$media;
     } elseif ('user' == $object_type) {
         $objects = self::$user;
     } elseif ('comment' == $object_type) {
         $objects = self::$comment;
     } elseif ('settings' == $object_type) {
         $objects = self::$settings;
     } else {
         return false;
     }
     if (empty($objects) || !is_array($objects)) {
         return false;
     }
     $object_name = null;
     if ('media' == $object_type) {
         return @current($objects);
     } elseif ('user' == $object_type) {
         return @current($objects);
     } elseif ('comment' == $object_type) {
         return @current($objects);
     } elseif ('post_type' == $object_type) {
         $object = get_post($object_id);
         if (!is_object($object) || !isset($object->post_type)) {
             return false;
         }
         $object_name = $object->post_type;
     } elseif ('taxonomy' == $object_type) {
         if (pods_version_check('wp', '4.4')) {
             $object = get_term($object_id);
             if (!is_object($object) || !isset($object->taxonomy)) {
                 return false;
             }
             $object_name = $object->taxonomy;
         } elseif (empty($aux)) {
             $object_name = $wpdb->get_var($wpdb->prepare("SELECT `taxonomy` FROM `{$wpdb->term_taxonomy}` WHERE `term_id` = %d", $object_id));
         } else {
             $object_name = $aux;
         }
     } elseif ('settings' == $object_type) {
         $object = $object_id;
     } else {
         return false;
     }
     $reserved_post_types = array('revision');
     $reserved_post_types = apply_filters('pods_meta_reserved_post_types', $reserved_post_types, $object_type, $object_id, $object_name, $objects);
     if (empty($object_name) || ('post_type' == $object_type && 0 === strpos($object_name, '_pods_') || in_array($object_name, $reserved_post_types))) {
         return false;
     } elseif ('attachment' == $object_name) {
         return @current(self::$media);
     }
     $recheck = array();
     // Return first created by Pods, save extended for later
     foreach ($objects as $pod) {
         if ($object_name == $pod['object']) {
             $recheck[] = $pod;
         }
         if ('' == $pod['object'] && $object_name == $pod['name']) {
             return $pod;
         }
     }
     // If no objects created by Pods, return first extended
     foreach ($recheck as $pod) {
         return $pod;
     }
     return false;
 }
开发者ID:pods-framework,项目名称:pods,代码行数:84,代码来源:PodsMeta.php

示例10: input

 /**
  * Customize output of the form field
  *
  * @param string $name
  * @param mixed $value
  * @param array $options
  * @param array $pod
  * @param int $id
  *
  * @since 2.0
  */
 public function input($name, $value = null, $options = null, $pod = null, $id = null)
 {
     $options = (array) $options;
     $form_field_type = PodsForm::$field_type;
     if (is_array($value)) {
         $value = implode(' ', $value);
     }
     // WP Color Picker for 3.5+
     if (pods_version_check('wp', '3.5')) {
         $field_type = 'color';
     } else {
         $field_type = 'farbtastic';
     }
     if (isset($options['name']) && false === PodsForm::permission(self::$type, $options['name'], $options, null, $pod, $id)) {
         if (pods_v('read_only', $options, false)) {
             $options['readonly'] = true;
             $field_type = 'text';
         } else {
             return;
         }
     } elseif (!pods_has_permissions($options) && pods_v('read_only', $options, false)) {
         $options['readonly'] = true;
         $field_type = 'text';
     }
     pods_view(PODS_DIR . 'ui/fields/' . $field_type . '.php', compact(array_keys(get_defined_vars())));
 }
开发者ID:danielhuamani,项目名称:AGN-Ingenieros,代码行数:37,代码来源:color.php

示例11: pods_unslash

/**
 * Filter input and return unslashed output
 *
 * @param mixed $input The string, array, or object to unsanitize
 *
 * @return array|mixed|object|string|void
 *
 * @since 2.3.9
 *
 * @see wp_unslash
 */
function pods_unslash($input)
{
    $output = array();
    if (empty($input)) {
        $output = $input;
    } elseif (is_object($input)) {
        $input = get_object_vars($input);
        foreach ($input as $key => $val) {
            $output[$key] = pods_unslash($val);
        }
        $output = (object) $output;
    } elseif (is_array($input)) {
        foreach ($input as $key => $val) {
            $output[$key] = pods_unslash($val);
        }
    } else {
        $output = pods_version_check('wp', '3.6') ? wp_unslash($input) : stripslashes($input);
    }
    return $output;
}
开发者ID:Ingenex,项目名称:redesign,代码行数:31,代码来源:data.php


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