當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PodsForm::field_types方法代碼示例

本文整理匯總了PHP中PodsForm::field_types方法的典型用法代碼示例。如果您正苦於以下問題:PHP PodsForm::field_types方法的具體用法?PHP PodsForm::field_types怎麽用?PHP PodsForm::field_types使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PodsForm的用法示例。


在下文中一共展示了PodsForm::field_types方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: field_types

 /**
  * Get a list of all available field types and include
  *
  * @return array Registered Field Types data
  *
  * @since 2.3
  */
 public static function field_types()
 {
     $field_types = array('text', 'website', 'phone', 'email', 'password', 'paragraph', 'wysiwyg', 'code', 'datetime', 'date', 'time', 'number', 'currency', 'file', 'avatar', 'pick', 'boolean', 'color', 'slug');
     $field_types = array_merge($field_types, array_keys(self::$field_types));
     $field_types = array_filter(array_unique($field_types));
     $types = apply_filters('pods_api_field_types', $field_types);
     $field_types = pods_transient_get('pods_field_types');
     if (empty($field_types) || count($types) != count($field_types)) {
         $field_types = array();
         foreach ($types as $field_type) {
             $file = null;
             if (isset(self::$field_types[$field_type])) {
                 $file = self::$field_types[$field_type]['file'];
             }
             self::field_loader($field_type, $file);
             if (!isset(self::$loaded[$field_type]) || !is_object(self::$loaded[$field_type])) {
                 continue;
             }
             $class_vars = get_class_vars(get_class(self::$loaded[$field_type]));
             // PHP 5.2.x workaround
             $field_types[$field_type] = $class_vars;
             $field_types[$field_type]['file'] = $file;
         }
         self::$field_types = $field_types;
         pods_transient_set('pods_field_types', self::$field_types);
     } else {
         self::$field_types = array_merge($field_types, self::$field_types);
     }
     return self::$field_types;
 }
開發者ID:erkmen,項目名稱:wpstartersetup,代碼行數:37,代碼來源:PodsForm.php

示例2: pods_api

<?php

global $pods_i;
$api = pods_api();
$pod = $api->load_pod(array('id' => $obj->id));
if ('taxonomy' == $pod['type'] && 'none' == $pod['storage'] && 1 == pods_var('enable_extra_fields', 'get')) {
    $api->save_pod(array('id' => $obj->id, 'storage' => 'table'));
    $pod = $api->load_pod(array('id' => $obj->id));
    unset($_GET['enable_extra_fields']);
    pods_message(__('Extra fields were successfully enabled for this Custom Taxonomy.', 'pods'));
}
$field_types = PodsForm::field_types();
$field_types_select = array();
foreach ($field_types as $type => $field_type_data) {
    /**
     * @var $field_type PodsField
     */
    $field_type = PodsForm::field_loader($type, $field_type_data['file']);
    $field_type_vars = get_class_vars(get_class($field_type));
    if (!isset($field_type_vars['pod_types'])) {
        $field_type_vars['pod_types'] = true;
    }
    // Only show supported field types
    if (true !== $field_type_vars['pod_types']) {
        if (empty($field_type_vars['pod_types'])) {
            continue;
        } elseif (is_array($field_type_vars['pod_types']) && !in_array(pods_var('type', $pod), $field_type_vars['pod_types'])) {
            continue;
        } elseif (!is_array($field_type_vars['pod_types']) && pods_var('type', $pod) != $field_type_vars['pod_types']) {
            continue;
        }
開發者ID:jeremybradbury,項目名稱:wp-ninja-kit,代碼行數:31,代碼來源:setup-edit.php

示例3: get_field_types

 /**
  * Gets all field types
  *
  * @return array Array of field types
  *
  * @uses PodsForm::field_loader
  *
  * @since 2.0
  * @deprecated
  */
 public function get_field_types()
 {
     return PodsForm::field_types();
 }
開發者ID:satokora,項目名稱:IT354Project,代碼行數:14,代碼來源:PodsAPI.php

示例4: admin_setup_edit_field_options

 /**
  * Get list of Pod field options
  *
  * @return array
  */
 public function admin_setup_edit_field_options($pod)
 {
     $options = array();
     $options['additional-field'] = array();
     $field_types = PodsForm::field_types();
     foreach ($field_types as $type => $field_type_data) {
         /**
          * @var $field_type PodsField
          */
         $field_type = PodsForm::field_loader($type, $field_type_data['file']);
         $field_type_vars = get_class_vars(get_class($field_type));
         if (!isset($field_type_vars['pod_types'])) {
             $field_type_vars['pod_types'] = true;
         }
         $options['additional-field'][$type] = array();
         // Only show supported field types
         if (true !== $field_type_vars['pod_types']) {
             if (empty($field_type_vars['pod_types'])) {
                 continue;
             } elseif (is_array($field_type_vars['pod_types']) && !in_array(pods_var('type', $pod), $field_type_vars['pod_types'])) {
                 continue;
             } elseif (!is_array($field_type_vars['pod_types']) && pods_var('type', $pod) != $field_type_vars['pod_types']) {
                 continue;
             }
         }
         $options['additional-field'][$type] = PodsForm::ui_options($type);
     }
     $input_helpers = array('' => '-- Select --');
     if (class_exists('Pods_Helpers')) {
         $helpers = pods_api()->load_helpers(array('options' => array('helper_type' => 'input')));
         foreach ($helpers as $helper) {
             $input_helpers[$helper['name']] = $helper['name'];
         }
     }
     $options['advanced'] = array(__('Visual', 'pods') => array('class' => array('name' => 'class', 'label' => __('Additional CSS Classes', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => ''), 'input_helper' => array('name' => 'input_helper', 'label' => __('Input Helper', 'pods'), 'help' => __('help', 'pods'), 'type' => 'pick', 'default' => '', 'data' => $input_helpers)), __('Values', 'pods') => array('default_value' => array('name' => 'default_value', 'label' => __('Default Value', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => ''), 'default_value_parameter' => array('name' => 'default_value_parameter', 'label' => __('Set Default Value via Parameter', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => '')), __('Visibility', 'pods') => array('restrict_access' => array('name' => 'restrict_access', 'label' => __('Restrict Access', 'pods'), 'group' => array('admin_only' => array('name' => 'admin_only', 'label' => __('Restrict access to Admins?', 'pods'), 'default' => 0, 'type' => 'boolean', 'dependency' => true, 'help' => __('This field will only be able to be edited by users with the ability to manage_options or delete_users, or super admins of a WordPress Multisite network', 'pods')), 'restrict_role' => array('name' => 'restrict_role', 'label' => __('Restrict access by Role?', 'pods'), 'default' => 0, 'type' => 'boolean', 'dependency' => true), 'restrict_capability' => array('name' => 'restrict_capability', 'label' => __('Restrict access by Capability?', 'pods'), 'default' => 0, 'type' => 'boolean', 'dependency' => true), 'hidden' => array('name' => 'hidden', 'label' => __('Hide field from UI', 'pods'), 'default' => 0, 'type' => 'boolean', 'help' => __('This option is overriden by access restrictions. If the user does not have access to edit this field, it will be hidden. If no access restrictions are set, this field will always be hidden.', 'pods')), 'read_only' => array('name' => 'read_only', 'label' => __('Make field "Read Only" in UI', 'pods'), 'default' => 0, 'type' => 'boolean', 'help' => __('This option is overriden by access restrictions. If the user does not have access to edit this field, it will be read only. If no access restrictions are set, this field will always be read only.', 'pods'), 'depends-on' => array('type' => array('boolean', 'color', 'currency', 'date', 'datetime', 'email', 'number', 'paragraph', 'password', 'phone', 'slug', 'text', 'time', 'website'))))), 'roles_allowed' => array('name' => 'roles_allowed', 'label' => __('Role(s) Allowed', 'pods'), 'help' => __('help', 'pods'), 'type' => 'pick', 'pick_object' => 'role', 'pick_format_type' => 'multi', 'default' => 'administrator', 'depends-on' => array('restrict_role' => true)), 'capability_allowed' => array('name' => 'capability_allowed', 'label' => __('Capability Allowed', 'pods'), 'help' => __('Comma-separated list of cababilities, for example add_podname_item, please see the Roles and Capabilities component for the complete list and a way to add your own.', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('restrict_capability' => true))));
     if (!class_exists('Pods_Helpers')) {
         unset($options['advanced-options']['input_helper']);
     }
     $options = apply_filters('pods_admin_setup_edit_field_options', $options, $pod);
     return $options;
 }
開發者ID:erkmen,項目名稱:wpstartersetup,代碼行數:46,代碼來源:PodsAdmin.php

示例5: export

 /**
  * Export a Package
  *
  * $params['pods'] string|array|bool Pod IDs to export, or set to true to export all
  * $params['templates'] string|array|bool Template IDs to export, or set to true to export all
  * $params['pages'] string|array|bool Page IDs to export, or set to true to export all
  * $params['helpers'] string|array|bool Helper IDs to export, or set to true to export all
  *
  * @param array $params Array of things to export
  *
  * @return array|bool
  *
  * @static
  * @since 2.0.5
  */
 public static function export($params)
 {
     $export = array('meta' => array('version' => PODS_VERSION, 'build' => time()));
     if (is_object($params)) {
         $params = get_object_vars($params);
     }
     $api = pods_api();
     $pod_ids = pods_var_raw('pods', $params);
     $template_ids = pods_var_raw('templates', $params);
     $page_ids = pods_var_raw('pages', $params);
     $helper_ids = pods_var_raw('helpers', $params);
     if (!empty($pod_ids)) {
         $api_params = array('export' => true);
         if (true !== $pod_ids) {
             $api_params['ids'] = (array) $pod_ids;
         }
         $export['pods'] = $api->load_pods($api_params);
         $options_ignore = array('pod_id', 'old_name', 'object_type', 'object_name', 'object_hierarchical', 'table', 'meta_table', 'pod_table', 'field_id', 'field_index', 'field_slug', 'field_type', 'field_parent', 'field_parent_select', 'meta_field_id', 'meta_field_index', 'meta_field_value', 'pod_field_id', 'pod_field_index', 'object_fields', 'join', 'where', 'where_default', 'orderby', 'pod', 'recurse', 'table_info', 'attributes', 'group', 'grouped', 'developer_mode', 'dependency', 'depends-on', 'excludes-on');
         $field_types = PodsForm::field_types();
         $field_type_options = array();
         foreach ($field_types as $type => $field_type_data) {
             $field_type_options[$type] = PodsForm::ui_options($type);
         }
         foreach ($export['pods'] as &$pod) {
             if (isset($pod['options'])) {
                 $pod = array_merge($pod, $pod['options']);
                 unset($pod['options']);
             }
             foreach ($pod as $option => $option_value) {
                 if (in_array($option, $options_ignore) || null === $option_value) {
                     unset($pod[$option]);
                 }
             }
             if (!empty($pod['fields'])) {
                 foreach ($pod['fields'] as &$field) {
                     if (isset($field['options'])) {
                         $field = array_merge($field, $field['options']);
                         unset($field['options']);
                     }
                     foreach ($field as $option => $option_value) {
                         if (in_array($option, $options_ignore) || null === $option_value) {
                             unset($field[$option]);
                         }
                     }
                     foreach ($field_type_options as $type => $options) {
                         if ($type == pods_var('type', $field)) {
                             continue;
                         }
                         foreach ($options as $option_data) {
                             if (isset($option_data['group']) && is_array($option_data['group']) && !empty($option_data['group'])) {
                                 if (isset($field[$option_data['name']])) {
                                     unset($field[$option_data['name']]);
                                 }
                                 foreach ($option_data['group'] as $group_option_data) {
                                     if (isset($field[$group_option_data['name']])) {
                                         unset($field[$group_option_data['name']]);
                                     }
                                 }
                             } elseif (isset($field[$option_data['name']])) {
                                 unset($field[$option_data['name']]);
                             }
                         }
                     }
                 }
             }
         }
     }
     if (!empty($template_ids)) {
         $api_params = array();
         if (true !== $template_ids) {
             $api_params['ids'] = (array) $template_ids;
         }
         $export['templates'] = $api->load_templates($api_params);
     }
     if (!empty($page_ids)) {
         $api_params = array();
         if (true !== $page_ids) {
             $api_params['ids'] = (array) $page_ids;
         }
         $export['pages'] = $api->load_pages($api_params);
     }
     if (!empty($helper_ids)) {
         $api_params = array();
         if (true !== $helper_ids) {
             $api_params['ids'] = (array) $helper_ids;
//.........這裏部分代碼省略.........
開發者ID:dylansmithing,項目名稱:leader-of-rock-wordpress,代碼行數:101,代碼來源:Migrate-Packages.php

示例6: export_pod

 /**
  * @param string $pod_name
  *
  * @return string
  */
 public function export_pod($pod_name)
 {
     $output = '';
     // Attempt to load the pod, don't throw an exception on error
     $params = array('name' => $pod_name, 'fields' => true);
     $pod = $this->api->load_pod($params, false);
     // Exit if the pod wasn't found or is table based (not supported)
     if (false === $pod || !isset($pod['storage']) || 'table' == $pod['storage']) {
         return '';
     }
     // Pull out the field list
     $fields = $pod['fields'];
     $options_ignore = array('id', 'pod_id', 'old_name', 'object_type', 'object_name', 'object_hierarchical', 'table', 'meta_table', 'pod_table', 'field_id', 'field_index', 'field_slug', 'field_type', 'field_parent', 'field_parent_select', 'meta_field_id', 'meta_field_index', 'meta_field_value', 'pod_field_id', 'pod_field_index', 'fields', 'object_fields', 'join', 'where', 'where_default', 'orderby', 'pod', 'recurse', 'table_info', 'attributes', 'group', 'grouped', 'developer_mode', 'dependency', 'depends-on', 'excludes-on');
     $empties = array('description', 'alias', 'help', 'class', 'pick_object', 'pick_val', 'sister_id', 'required', 'unique', 'admin_only', 'restrict_role', 'restrict_capability', 'hidden', 'read_only', 'object', 'label_singular');
     $field_types = PodsForm::field_types();
     $field_type_options = array();
     foreach ($field_types as $type => $field_type_data) {
         $field_type_options[$type] = PodsForm::ui_options($type);
     }
     if (isset($pod['options'])) {
         $pod = array_merge($pod, $pod['options']);
         unset($pod['options']);
     }
     foreach ($pod as $option => $option_value) {
         if (in_array($option, $options_ignore) || null === $option_value) {
             unset($pod[$option]);
         } elseif (in_array($option, $empties) && (empty($option_value) || '0' == $option_value)) {
             if ('restrict_role' == $option && isset($pod['roles_allowed'])) {
                 unset($pod['roles_allowed']);
             } elseif ('restrict_capability' == $option && isset($pod['capabilities_allowed'])) {
                 unset($pod['capabilities_allowed']);
             }
             unset($pod[$option]);
         }
     }
     if (!empty($fields)) {
         foreach ($fields as &$field) {
             if (isset($field['options'])) {
                 $field = array_merge($field, $field['options']);
                 unset($field['options']);
             }
             foreach ($field as $option => $option_value) {
                 if (in_array($option, $options_ignore) || null === $option_value) {
                     unset($field[$option]);
                 } elseif (in_array($option, $empties) && (empty($option_value) || '0' == $option_value)) {
                     if ('restrict_role' == $option && isset($field['roles_allowed'])) {
                         unset($field['roles_allowed']);
                     } elseif ('restrict_capability' == $option && isset($field['capabilities_allowed'])) {
                         unset($field['capabilities_allowed']);
                     }
                     unset($field[$option]);
                 }
             }
             foreach ($field_type_options as $type => $options) {
                 if ($type == pods_var('type', $field)) {
                     continue;
                 }
                 foreach ($options as $option_data) {
                     if (isset($option_data['group']) && is_array($option_data['group']) && !empty($option_data['group'])) {
                         if (isset($field[$option_data['name']])) {
                             unset($field[$option_data['name']]);
                         }
                         foreach ($option_data['group'] as $group_option_data) {
                             if (isset($field[$group_option_data['name']])) {
                                 unset($field[$group_option_data['name']]);
                             }
                         }
                     } elseif (isset($field[$option_data['name']])) {
                         unset($field[$option_data['name']]);
                     }
                 }
             }
         }
     }
     // Output the pods_register_type() call
     $output .= sprintf("\t\$pod = %s;\n\n", $this->var_export_format($pod, 1));
     $output .= "\tpods_register_type( \$pod[ 'type' ], \$pod[ 'name' ], \$pod );\n\n";
     // Output a pods_register_field() call for each field
     foreach ($fields as $this_field) {
         $output .= sprintf("\t\$field = %s;\n\n", preg_replace('/\\d+ => /', '', $this->var_export_format($this_field, 1)));
         $output .= "\tpods_register_field( \$pod[ 'name' ], \$field[ 'name' ], \$field );\n\n";
     }
     return $output;
 }
開發者ID:oligoform,項目名稱:pods-export-code,代碼行數:89,代碼來源:pods-export-code-api.php


注:本文中的PodsForm::field_types方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。