本文整理匯總了PHP中PodsForm::field_loader方法的典型用法代碼示例。如果您正苦於以下問題:PHP PodsForm::field_loader方法的具體用法?PHP PodsForm::field_loader怎麽用?PHP PodsForm::field_loader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PodsForm
的用法示例。
在下文中一共展示了PodsForm::field_loader方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: pods_api
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;
}
}
if (!empty(PodsForm::$field_group)) {
示例2: wp_enqueue_script
<?php
global $post_ID;
wp_enqueue_script('pods-handlebars');
wp_enqueue_script('jquery-ui-core');
wp_enqueue_script('jquery-ui-sortable');
wp_enqueue_script('plupload-all');
wp_enqueue_script('pods-attach');
wp_enqueue_style('pods-attach');
$field_file = PodsForm::field_loader('file');
$attributes = array();
$attributes = PodsForm::merge_attributes($attributes, $name, $form_field_type, $options);
$css_id = $attributes['id'];
$uri_hash = wp_create_nonce('pods_uri_' . $_SERVER['REQUEST_URI']);
$uid = @session_id();
if (is_user_logged_in()) {
$uid = 'user_' . get_current_user_id();
}
$field_nonce = wp_create_nonce('pods_upload_' . (!is_object($pod) ? '0' : $pod->pod_id) . '_' . $uid . '_' . $uri_hash . '_' . $options['id']);
$file_limit = 1;
if ('multi' == pods_var($form_field_type . '_format_type', $options, 'single')) {
$file_limit = (int) pods_var($form_field_type . '_limit', $options, 0);
}
$plupload_init = array('runtimes' => 'html5,silverlight,flash,html4', 'container' => $css_id, 'browse_button' => $css_id . '-upload', 'url' => admin_url('admin-ajax.php', 'relative') . '?pods_ajax=1', 'file_data_name' => 'Filedata', 'multiple_queues' => false, 'max_file_size' => wp_max_upload_size() . 'b', 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => __('Allowed Files', 'pods'), 'extensions' => '*')), 'multipart' => true, 'urlstream_upload' => true, 'multipart_params' => array('_wpnonce' => $field_nonce, 'action' => 'pods_upload', 'method' => 'upload', 'pod' => !is_object($pod) ? '0' : $pod->pod_id, 'field' => $options['id'], 'uri' => $uri_hash));
$limit_file_type = pods_var($form_field_type . '_type', $options, 'images');
$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) {
示例3: 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;
}
示例4: core
/**
* Set up the Pods core
*/
public function core()
{
// Session start
if (false === headers_sent() && '' == session_id() && (!defined('PODS_SESSION_AUTO_START') || PODS_SESSION_AUTO_START)) {
@session_start();
}
add_shortcode('pods', 'pods_shortcode');
add_shortcode('pods-form', 'pods_shortcode_form');
$security_settings = array('pods_disable_file_browser' => 0, 'pods_files_require_login' => 1, 'pods_files_require_login_cap' => '', 'pods_disable_file_upload' => 0, 'pods_upload_require_login' => 1, 'pods_upload_require_login_cap' => '');
foreach ($security_settings as $security_setting => $setting) {
$setting = get_option($security_setting);
if (!empty($setting)) {
$security_settings[$security_setting] = $setting;
}
}
foreach ($security_settings as $security_setting => $setting) {
if (0 == $setting) {
$setting = false;
} elseif (1 == $setting) {
$setting = true;
}
if (in_array($security_setting, array('pods_files_require_login', 'pods_upload_require_login'))) {
if (0 < strlen($security_settings[$security_setting . '_cap'])) {
$setting = $security_settings[$security_setting . '_cap'];
}
} elseif (in_array($security_setting, array('pods_files_require_login_cap', 'pods_upload_require_login_cap'))) {
continue;
}
if (!defined(strtoupper($security_setting))) {
define(strtoupper($security_setting), $setting);
}
}
$this->register_assets();
$this->register_pods();
$avatar = PodsForm::field_loader('avatar');
if (method_exists($avatar, 'get_avatar')) {
add_filter('get_avatar', array($avatar, 'get_avatar'), 10, 4);
}
}
示例5: array
<?php
$field_number = PodsForm::field_loader('currency');
$value = $field_number->format($value, $name, $options, $pod, $id);
$attributes = array();
$attributes['type'] = 'text';
$attributes['value'] = $value;
$attributes['tabindex'] = 2;
$attributes = PodsForm::merge_attributes($attributes, $name, $form_field_type, $options);
global $wp_locale;
if ('9999.99' == pods_var('currency_format', $options)) {
$thousands = '';
$dot = '.';
} elseif ('9999,99' == pods_var('currency_format', $options)) {
$thousands = '';
$dot = ',';
} elseif ('9.999,99' == pods_var('currency_format', $options)) {
$thousands = '.';
$dot = ',';
} else {
$thousands = $wp_locale->number_format['thousands_sep'];
$dot = $wp_locale->number_format['decimal_point'];
}
$currency = 'usd';
if (isset(PodsField_Currency::$currencies[pods_var('currency_format_sign', $options, -1)])) {
$currency = pods_var('currency_format_sign', $options);
}
$currency_sign = PodsField_Currency::$currencies[$currency];
?>
<input<?php
PodsForm::attributes($attributes, $name, $form_field_type, $options);
示例6: array
<?php
$field_number = PodsForm::field_loader('number');
$value = $field_number->format($value, $name, $options, $pod, $id);
$attributes = array();
$attributes['type'] = 'text';
$attributes['value'] = $value;
$attributes['tabindex'] = 2;
$attributes = PodsForm::merge_attributes($attributes, $name, $form_field_type, $options);
global $wp_locale;
if ('9999.99' == pods_var('number_format', $options)) {
$thousands = ',';
$dot = '.';
} elseif ('9999,99' == pods_var('number_format', $options)) {
$thousands = '.';
$dot = ',';
} elseif ('9.999,99' == pods_var('number_format', $options)) {
$thousands = '.';
$dot = ',';
} else {
$thousands = $wp_locale->number_format['thousands_sep'];
$dot = $wp_locale->number_format['decimal_point'];
}
?>
<input<?php
PodsForm::attributes($attributes, $name, $form_field_type, $options);
?>
/>
<script>
jQuery( function ( $ ) {
$( 'input#<?php
示例7: core
/**
* Set up the Pods core
*/
public function core()
{
if (empty(self::$version)) {
return;
}
// Session start
pods_session_start();
add_shortcode('pods', 'pods_shortcode');
add_shortcode('pods-form', 'pods_shortcode_form');
$security_settings = array('pods_disable_file_browser' => 0, 'pods_files_require_login' => 1, 'pods_files_require_login_cap' => '', 'pods_disable_file_upload' => 0, 'pods_upload_require_login' => 1, 'pods_upload_require_login_cap' => '');
foreach ($security_settings as $security_setting => $setting) {
$setting = get_option($security_setting);
if (!empty($setting)) {
$security_settings[$security_setting] = $setting;
}
}
foreach ($security_settings as $security_setting => $setting) {
if (0 == $setting) {
$setting = false;
} elseif (1 == $setting) {
$setting = true;
}
if (in_array($security_setting, array('pods_files_require_login', 'pods_upload_require_login'))) {
if (0 < strlen($security_settings[$security_setting . '_cap'])) {
$setting = $security_settings[$security_setting . '_cap'];
}
} elseif (in_array($security_setting, array('pods_files_require_login_cap', 'pods_upload_require_login_cap'))) {
continue;
}
if (!defined(strtoupper($security_setting))) {
define(strtoupper($security_setting), $setting);
}
}
$this->register_pods();
$avatar = PodsForm::field_loader('avatar');
if (method_exists($avatar, 'get_avatar')) {
add_filter('get_avatar', array($avatar, 'get_avatar'), 10, 4);
}
}