• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP pods_version_check函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了pods_version_check函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: admin_setup_edit_options

 /**
  * Get list of Pod options
  *
  * @return array
  */
 public function admin_setup_edit_options($pod)
 {
     $options = array();
     // @todo fill this in
     $options['labels'] = array('temporary' => 'This has the fields hardcoded');
     if ('post_type' == $pod['type']) {
         $options['admin-ui'] = array('description' => array('label' => __('Post Type Description', 'pods'), 'help' => __('A short descriptive summary of what the post type is.', 'pods'), 'type' => 'text', 'default' => ''), 'show_ui' => array('label' => __('Show Admin UI', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => pods_var_raw('public', $pod, true), 'boolean_yes_label' => ''), 'show_in_menu' => array('label' => __('Show Admin Menu in Dashboard', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => pods_var_raw('public', $pod, true), 'dependency' => true, 'boolean_yes_label' => ''), 'menu_location_custom' => array('label' => __('Parent Menu ID (optional)', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'depends-on' => array('show_in_menu' => true)), 'menu_name' => array('label' => __('Menu Name', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('show_in_menu' => true)), 'menu_position' => array('label' => __('Menu Position', 'pods'), 'help' => __('help', 'pods'), 'type' => 'number', 'default' => 0, 'depends-on' => array('show_in_menu' => true)), 'menu_icon' => array('label' => __('Menu Icon', 'pods'), 'help' => __('URL or Dashicon name for the menu icon. You may specify the path to the icon using one of the <a href="http://pods.io/docs/build/special-magic-tags/#site-tags" target="_blank">site tag</a> type <a href="http://pods.io/docs/build/special-magic-tags/" target="_blank">special magic tags</a>. For example, for a file in your theme directory, use "{@template-url}/path/to/image.png". You may also use the name of a <a href="http://melchoyce.github.io/dashicons/" target="_blank">Dashicon</a>. For example, to use the empty star icon, use "dashicons-star-empty".', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('show_in_menu' => true)), 'show_in_nav_menus' => array('label' => __('Show in Navigation Menus', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => true, 'boolean_yes_label' => ''), 'show_in_admin_bar' => array('label' => __('Show in Admin Bar "New" Menu', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => true, 'boolean_yes_label' => ''));
         $options['advanced'] = array('public' => array('label' => __('Public', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => true, 'boolean_yes_label' => ''), 'publicly_queryable' => array('label' => __('Publicly Queryable', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => pods_var_raw('public', $pod, true), 'boolean_yes_label' => ''), 'exclude_from_search' => array('label' => __('Exclude from Search', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => !pods_var_raw('public', $pod, true), 'boolean_yes_label' => ''), 'capability_type' => array('label' => __('User Capability', 'pods'), 'help' => __('Uses these capabilties for access to this post type: edit_{capability}, read_{capability}, and delete_{capability}', 'pods'), 'type' => 'pick', 'default' => 'post', 'data' => array('post' => 'post', 'page' => 'page', 'custom' => __('Custom Capability', 'pods')), 'dependency' => true), 'capability_type_custom' => array('label' => __('Custom User Capability', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => pods_var_raw('name', $pod), 'depends-on' => array('capability_type' => 'custom')), 'capability_type_extra' => array('label' => __('Additional User Capabilities', 'pods'), 'help' => __('Enables additional capabilities for this Post Type including: delete_{capability}s, delete_private_{capability}s, delete_published_{capability}s, delete_others_{capability}s, edit_private_{capability}s, and edit_published_{capability}s', 'pods'), 'type' => 'boolean', 'default' => true, 'boolean_yes_label' => ''), 'has_archive' => array('label' => __('Enable Archive Page', 'pods'), 'help' => __('If enabled, creates an archive page with list of of items in this custom post type. Functions like a category page for posts. Can be controlled with a template in your theme called "archive-{$post-type}.php".', 'pods'), 'type' => 'boolean', 'default' => false, 'dependency' => true, 'boolean_yes_label' => ''), 'has_archive_slug' => array('label' => __('Archive Page Slug Override', 'pods'), 'help' => __('If archive page is enabled, you can override the slug used by WordPress, which defaults to the name of the post type.', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('has_archive' => true)), 'hierarchical' => array('label' => __('Hierarchical', 'pods'), 'help' => __('Allows for parent/ child relationships between items, just like with Pages. Note: To edit relationships in the post editor, you must enable "Page Attributes" in the "Supports" section below.', 'pods'), 'type' => 'boolean', 'default' => false, 'dependency' => true, 'boolean_yes_label' => ''), 'label_parent_item_colon' => array('label' => __('<strong>Label: </strong> Parent <span class="pods-slugged" data-sluggable="label_singular">Item</span>', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('hierarchical' => true)), 'label_parent' => array('label' => __('<strong>Label: </strong> Parent', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('hierarchical' => true)), 'rewrite' => array('label' => __('Rewrite', 'pods'), 'help' => __('Allows you to use pretty permalinks, if set in WordPress Settings->Reading. If not enbabled, your links will be in the form of "example.com/?pod_name=post_slug" regardless of your permalink settings.', 'pods'), 'type' => 'boolean', 'default' => true, 'dependency' => true, 'boolean_yes_label' => ''), 'rewrite_custom_slug' => array('label' => __('Custom Rewrite Slug', 'pods'), 'help' => __('Changes the first segment of the URL, which by default is the name of the Pod. For example, if your Pod is called "foo", if this field is left blank, your link will be "example.com/foo/post_slug", but if you were to enter "bar" your link will be "example.com/bar/post_slug".', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('rewrite' => true)), 'rewrite_with_front' => array('label' => __('Rewrite with Front', 'pods'), 'help' => __('Allows permalinks to be prepended with your front base (example: if your permalink structure is /blog/, then your links will be: Unchecked->/news/, Checked->/blog/news/)', 'pods'), 'type' => 'boolean', 'default' => true, 'depends-on' => array('rewrite' => true), 'boolean_yes_label' => ''), 'rewrite_feeds' => array('label' => __('Rewrite Feeds', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => false, 'depends-on' => array('rewrite' => true), 'boolean_yes_label' => ''), 'rewrite_pages' => array('label' => __('Rewrite Pages', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => true, 'depends-on' => array('rewrite' => true), 'boolean_yes_label' => ''), 'query_var' => array('label' => __('Query Var', 'pods'), 'help' => __('The Query Var is used in the URL and underneath the WordPress Rewrite API to tell WordPress what page or post type you are on. For a list of reserved Query Vars, read <a href="http://codex.wordpress.org/WordPress_Query_Vars">WordPress Query Vars</a> from the WordPress Codex.', 'pods'), 'type' => 'boolean', 'default' => true, 'boolean_yes_label' => ''), 'can_export' => array('label' => __('Exportable', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => true, 'boolean_yes_label' => ''), 'default_status' => array('label' => __('Default Status', 'pods'), 'help' => __('help', 'pods'), 'type' => 'pick', 'pick_object' => 'post-status', 'default' => apply_filters('pods_api_default_status_' . pods_var_raw('name', $pod, 'post_type', null, true), 'draft', $pod)));
     } elseif ('taxonomy' == $pod['type']) {
         $options['admin-ui'] = array('show_ui' => array('label' => __('Show Admin UI', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => pods_var_raw('public', $pod, true), 'dependency' => true, 'boolean_yes_label' => ''), 'menu_name' => array('label' => __('Menu Name', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('show_ui' => true)), 'menu_location' => array('label' => __('Menu Location', 'pods'), 'help' => __('help', 'pods'), 'type' => 'pick', 'default' => 'default', 'depends-on' => array('show_ui' => true), 'data' => array('default' => __('Default - Add to associated Post Type(s) menus', 'pods'), 'settings' => __('Add to Settings menu', 'pods'), 'appearances' => __('Add to Appearances menu', 'pods'), 'objects' => __('Make a top-level menu item', 'pods'), 'top' => __('Make a new top-level menu item below Settings', 'pods'), 'submenu' => __('Add a submenu item to another menu', 'pods')), 'dependency' => true), 'menu_location_custom' => array('label' => __('Custom Menu Location', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'depends-on' => array('menu_location' => 'submenu')), 'menu_position' => array('label' => __('Menu Position', 'pods'), 'help' => __('help', 'pods'), 'type' => 'number', 'default' => 0, 'depends-on' => array('menu_location' => array('objects', 'top'))), 'menu_icon' => array('label' => __('Menu Icon URL', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('menu_location' => array('objects', 'top'))), 'show_in_nav_menus' => array('label' => __('Show in Navigation Menus', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => pods_var_raw('public', $pod, true), 'boolean_yes_label' => ''), 'show_tagcloud' => array('label' => __('Allow in Tagcloud Widget', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => pods_var_raw('show_ui', $pod, pods_var_raw('public', $pod, true)), 'boolean_yes_label' => ''));
         if (pods_version_check('wp', '3.5')) {
             $options['admin-ui']['show_admin_column'] = array('label' => __('Show Taxonomy column on Post Types', 'pods'), 'help' => __('Whether to add a column for this taxonomy on the associated post types manage screens', 'pods'), 'type' => 'boolean', 'default' => false, 'boolean_yes_label' => '');
         }
         // Integration for Single Value Taxonomy UI
         if (function_exists('tax_single_value_meta_box')) {
             $options['admin-ui']['single_value'] = array('label' => __('Single Value Taxonomy', 'pods'), 'help' => __('Use a drop-down for the input instead of the WordPress default', 'pods'), 'type' => 'boolean', 'default' => false, 'boolean_yes_label' => '');
             $options['admin-ui']['single_value_required'] = array('label' => __('Single Value Taxonomy - Required', 'pods'), 'help' => __('A term will be selected by default in the Post Editor, not optional', 'pods'), 'type' => 'boolean', 'default' => false, 'boolean_yes_label' => '');
         }
         // @todo fill this in
         $options['advanced'] = array('temporary' => 'This type has the fields hardcoded');
     } elseif ('settings' == $pod['type']) {
         $options['admin-ui'] = array('ui_style' => array('label' => __('Admin UI Style', 'pods'), 'help' => __('help', 'pods'), 'type' => 'pick', 'default' => 'settings', 'data' => array('settings' => __('Normal Settings Form', 'pods'), 'post_type' => __('Post Type UI', 'pods'), 'custom' => __('Custom (hook into pods_admin_ui_custom or pods_admin_ui_custom_{podname} action)', 'pods')), 'dependency' => true), 'menu_location' => array('label' => __('Menu Location', 'pods'), 'help' => __('help', 'pods'), 'type' => 'pick', 'default' => 'settings', 'data' => array('settings' => __('Add to Settings menu', 'pods'), 'appearances' => __('Add to Appearances menu', 'pods'), 'top' => __('Make a new top-level menu item below Settings', 'pods'), 'submenu' => __('Add a submenu item to another menu', 'pods')), 'dependency' => true), 'menu_location_custom' => array('label' => __('Custom Menu Location', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'depends-on' => array('menu_location' => 'submenu')), 'menu_position' => array('label' => __('Menu Position', 'pods'), 'help' => __('help', 'pods'), 'type' => 'number', 'default' => 0, 'depends-on' => array('menu_location' => 'top')), 'menu_icon' => array('label' => __('Menu Icon URL', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('menu_location' => 'top')));
         // @todo fill this in
         $options['advanced'] = array('temporary' => 'This type has the fields hardcoded');
     } elseif ('pod' == $pod['type']) {
         $options['admin-ui'] = array('ui_style' => array('label' => __('Admin UI Style', 'pods'), 'help' => __('help', 'pods'), 'type' => 'pick', 'default' => 'settings', 'data' => array('post_type' => __('Normal (Looks like the Post Type UI)', 'pods'), 'custom' => __('Custom (hook into pods_admin_ui_custom or pods_admin_ui_custom_{podname} action)', 'pods')), 'dependency' => true), 'show_in_menu' => array('label' => __('Show Admin Menu in Dashboard', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => false, 'boolean_yes_label' => '', 'dependency' => true), 'menu_location_custom' => array('label' => __('Parent Menu ID (optional)', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'depends-on' => array('show_in_menu' => true)), 'menu_position' => array('label' => __('Menu Position', 'pods'), 'help' => __('help', 'pods'), 'type' => 'number', 'default' => 0, 'depends-on' => array('show_in_menu' => true)), 'menu_icon' => array('label' => __('Menu Icon URL', 'pods'), 'help' => __('This is the icon shown to the left of the menu text for this content type.', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('show_in_menu' => true)), 'ui_icon' => array('label' => __('Header Icon', 'pods'), 'help' => __('This is the icon shown to the left of the heading text at the top of the manage pages for this content type.', 'pods'), 'type' => 'file', 'default' => '', 'file_edit_title' => 0, 'depends-on' => array('show_in_menu' => true)), 'ui_actions_enabled' => array('label' => __('Actions Available', 'pods'), 'help' => __('help', 'pods'), 'type' => 'pick', 'default' => 1 == pods_var('ui_export', $pod) ? array('add', 'edit', 'duplicate', 'delete', 'export') : array('add', 'edit', 'duplicate', 'delete'), 'data' => array('add' => __('Add New', 'pods'), 'edit' => __('Edit', 'pods'), 'duplicate' => __('Duplicate', 'pods'), 'delete' => __('Delete', 'pods'), 'reorder' => __('Reorder', 'pods'), 'export' => __('Export', 'pods')), 'pick_format_type' => 'multi', 'dependency' => true), 'ui_reorder_field' => array('label' => __('Reorder Field', 'pods'), 'help' => __('This is the field that will be reordered on, it should be numeric.', 'pods'), 'type' => 'text', 'default' => 'menu_order', 'depends-on' => array('ui_actions_enabled' => 'reorder')), 'ui_fields_manage' => array('label' => __('Admin Table Columns', 'pods'), 'help' => __('help', 'pods'), 'type' => 'pick', 'default' => array(), 'data' => array(), 'pick_format_type' => 'multi'), 'ui_filters' => array('label' => __('Search Filters', 'pods'), 'help' => __('help', 'pods'), 'type' => 'pick', 'default' => array(), 'data' => array(), 'pick_format_type' => 'multi'));
         if (!empty($pod['fields'])) {
             if (isset($pod['fields'][pods_var_raw('pod_index', $pod, 'name')])) {
                 $options['admin-ui']['ui_fields_manage']['default'][] = pods_var_raw('pod_index', $pod, 'name');
             }
             if (isset($pod['fields']['modified'])) {
                 $options['admin-ui']['ui_fields_manage']['default'][] = 'modified';
             }
             foreach ($pod['fields'] as $field) {
                 $type = '';
                 if (isset($field_types[$field['type']])) {
                     $type = ' <small>(' . $field_types[$field['type']]['label'] . ')</small>';
                 }
                 $options['admin-ui']['ui_fields_manage']['data'][$field['name']] = $field['label'] . $type;
                 $options['admin-ui']['ui_filters']['data'][$field['name']] = $field['label'] . $type;
             }
             $options['admin-ui']['ui_fields_manage']['data']['id'] = 'ID';
         } else {
             unset($options['admin-ui']['ui_fields_manage']);
             unset($options['admin-ui']['ui_filters']);
         }
         // @todo fill this in
         $options['advanced'] = array('temporary' => 'This type has the fields hardcoded');
     }
     /**
      * Add admin fields to the Pods editor for a specific Pod
      *
      * @params array $options The Options fields
      * @params object $pod Current Pods object
      *
      * @since unkown
      */
     $options = apply_filters('pods_admin_setup_edit_options_' . $pod['type'] . '_' . $pod['name'], $options, $pod);
     /**
      * Add admin fields to the Pods editor for any Pod of a specific content type.
      */
     $options = apply_filters('pods_admin_setup_edit_options_' . $pod['type'], $options, $pod);
     /**
      * Add admin fields to the Pods editor for all Pods
      */
     $options = apply_filters('pods_admin_setup_edit_options', $options, $pod);
     return $options;
 }
开发者ID:erkmen,项目名称:wpstartersetup,代码行数:73,代码来源:PodsAdmin.php


示例5: 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


示例6: 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


示例7: 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


示例8: 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


示例9: 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


示例10: 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


示例11: admin_setup_edit_options


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP pods_view函数代码示例发布时间:2022-05-15
下一篇:
PHP pods_var_raw函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap