本文整理汇总了PHP中wpcf_translate函数的典型用法代码示例。如果您正苦于以下问题:PHP wpcf_translate函数的具体用法?PHP wpcf_translate怎么用?PHP wpcf_translate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpcf_translate函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wpcf_fields_skype_meta_box_form
/**
* Form data for post edit page.
*
* @param type $field
*/
function wpcf_fields_skype_meta_box_form($field)
{
add_thickbox();
if (isset($field['value'])) {
$field['value'] = maybe_unserialize($field['value']);
}
$form = array();
add_filter('wpcf_fields_shortcode_slug_' . $field['slug'], 'wpcf_fields_skype_shortcode_filter', 10, 2);
$rand = wpcf_unique_id(serialize($field));
$form['skypename'] = array('#type' => 'textfield', '#value' => isset($field['value']['skypename']) ? $field['value']['skypename'] : '', '#name' => 'wpcf[' . $field['slug'] . '][skypename]', '#id' => 'wpcf-fields-skype-' . $field['slug'] . '-' . $rand . '-skypename', '#inline' => true, '#suffix' => ' ' . __('Skype name', 'wpcf'), '#description' => '', '#prefix' => !empty($field['description']) ? wpcf_translate('field ' . $field['id'] . ' description', $field['description']) . '<br /><br />' : '', '#attributes' => array('style' => 'width:60%;'), '#_validate_this' => true, '#before' => '<div class="wpcf-skype">');
$form['style'] = array('#type' => 'hidden', '#value' => isset($field['value']['style']) ? $field['value']['style'] : 'btn2', '#name' => 'wpcf[' . $field['slug'] . '][style]', '#id' => 'wpcf-fields-skype-' . $field['slug'] . '-' . $rand . '-style');
$preview_skypename = !empty($field['value']['skypename']) ? $field['value']['skypename'] : '--not--';
$preview_style = !empty($field['value']['style']) ? $field['value']['style'] : 'btn2';
$preview = wpcf_fields_skype_get_button_image($preview_skypename, $preview_style);
// Set button
// TODO WPML move
if (isset($field['disable']) || wpcf_wpml_field_is_copied($field)) {
$edit_button = '';
} else {
$edit_button = '' . '<a href="' . admin_url('admin-ajax.php?action=wpcf_ajax&' . 'wpcf_action=insert_skype_button&_wpnonce=' . wp_create_nonce('insert_skype_button') . '&update=wpcf-fields-skype-' . $field['slug'] . '-' . $rand . '&skypename=' . $preview_skypename . '&button_style=' . $preview_style . '&keepThis=true&TB_iframe=true&width=500&height=500') . '"' . ' class="thickbox wpcf-fields-skype button-secondary"' . ' title="' . __('Edit Skype button', 'wpcf') . '"' . '>' . __('Edit Skype button', 'wpcf') . '</a>';
}
$form['markup'] = array('#type' => 'markup', '#markup' => '<div class="wpcf-form-item">' . '<div id="wpcf-fields-skype-' . $field['slug'] . '-' . $rand . '-preview">' . $preview . '</div>' . $edit_button . '</div>');
$form['markup-close'] = array('#type' => 'markup', '#markup' => '</div>');
return $form;
}
开发者ID:SpencerNeitzke,项目名称:types,代码行数:30,代码来源:skype.php
示例2: wpcf_fields_select_view
/**
* View function.
*
* @param type $params
*/
function wpcf_fields_select_view($params)
{
$field = wpcf_fields_get_field_by_slug($params['field']['slug']);
$output = '';
if (!empty($field['data']['options'])) {
$field_value = $params['field_value'];
foreach ($field['data']['options'] as $option_key => $option) {
if (isset($option['value']) && $option['value'] == $params['field_value']) {
$field_value = wpcf_translate('field ' . $params['field']['id'] . ' option ' . $option_key . ' title', $option['title']);
}
}
$output = $field_value;
}
return $output;
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:20,代码来源:select.php
示例3: column_default
/** ************************************************************************
* Recommended. This method is called when the parent class can't find a method
* specifically build for a given column. Generally, it's recommended to include
* one method for each column you want to render, keeping your package class
* neat and organized. For example, if the class needs to process a column
* named 'title', it would first see if a method named $this->column_title()
* exists - if it does, that method will be used. If it doesn't, this one will
* be used. Generally, you should try to use custom column methods as much as
* possible.
*
* Since we have defined a column_title() method later on, this method doesn't
* need to concern itself with any column with a name of 'title'. Instead, it
* needs to handle everything else.
*
* For more detailed insight into how columns are handled, take a look at
* WP_List_Table::single_row_columns()
*
* @param array $item A singular item (one full row's worth of data)
* @param array $column_name The name/slug of the column to be processed
* @return string Text or HTML to be placed inside the column <td>
**************************************************************************/
function column_default($item, $column_name)
{
switch ($column_name) {
case 'title':
case 'description':
return stripslashes($item[$column_name]);
case 'supports':
$rows = array();
if (!empty($item[$column_name])) {
foreach ($item[$column_name] as $temp_post_type => $true) {
$rows[] = stripslashes(wpcf_translate($temp_post_type . ' name', $temp_post_type, 'Types-CPT'));
}
}
return empty($rows) ? __('None', 'wpcf') : implode(', ', $rows);
case 'status':
return 'active' == $item[$column_name] ? __('Yes', 'wpcf') : __('No', 'wpcf');
default:
return print_r($item, true);
//Show the whole array for troubleshooting purposes
}
}
开发者ID:aarongillett,项目名称:B22-151217,代码行数:42,代码来源:class.wpcf.custom.taxonomies.list.table.php
示例4: wpcf_fields_select_view
/**
* View function.
*
* @param type $params
*/
function wpcf_fields_select_view($params)
{
if (isset($params['usermeta']) && !empty($params['usermeta'])) {
$field = wpcf_fields_get_field_by_slug($params['field']['slug'], 'wpcf-usermeta');
} else {
$field = wpcf_fields_get_field_by_slug($params['field']['slug']);
}
$output = '';
if (!empty($field['data']['options'])) {
$field_value = $params['field_value'];
foreach ($field['data']['options'] as $option_key => $option) {
if (isset($option['value']) && $option['value'] == $params['field_value']) {
// We need to translate here because the stored value is on the original language
// When updaing the value in the Field group, we might have problems
$field_value = wpcf_translate('field ' . $params['field']['id'] . ' option ' . $option_key . ' title', $option['title']);
}
}
$output = $field_value;
}
return $output;
}
开发者ID:lytranuit,项目名称:wordpress,代码行数:26,代码来源:select.php
示例5: wpcf_repetitive_delete_umbutton
/**
* HTML formatted output for 'Delete Field'.
*
* @param type $field
* @param type $post
* @return string
*/
function wpcf_repetitive_delete_umbutton($field, $user_id, $meta_id)
{
// TODO WPML move Add repetitive control buttons if not copied by WPML
if (wpcf_wpml_is_translated_profile_page($field)) {
return '';
}
// Let's cache calls
static $cache = array();
if (empty($field)) {
$field = array();
}
if (empty($user_id)) {
$post = array();
}
$cache_key = md5(serialize((array) $field) . $meta_id . serialize((array) $user_id));
// Return cached if there
if (isset($cache[$cache_key])) {
return $cache[$cache_key];
}
// If post is new show different delete button
if (empty($user_id)) {
$cache[$cache_key] = wpcf_repetitive_delete_new_umbutton($field, $user_id);
return $cache[$cache_key];
}
// Regular delete button
$button = '';
$title = wpcf_translate("field {$field['id']} name", $field['name']);
/*
* No need for old_value anymore.
* Use meta_id.
*/
$button .= ' <a href="' . admin_url('admin-ajax.php?action=wpcf_ajax' . '&wpcf_action=um_repetitive_delete' . '&_wpnonce=' . wp_create_nonce('um_repetitive_delete') . '&user_id=' . $user_id . '&field_id=' . $field['id'] . '&meta_id=' . $meta_id) . '&wpcf_warning=' . __('Are you sure?', 'wpcf') . '&field_id_md5=' . md5($field['id']) . '" class="wpcf-repetitive-delete button-secondary">' . sprintf(__('Delete %s', 'wpcf'), $title) . '</a>';
// Cache it
$cache[$cache_key] = $button;
return $button;
}
开发者ID:olechka1505,项目名称:hungrylemur,代码行数:43,代码来源:repetitive-usermetafields-ordering.php
示例6: wpcf_admin_post_process_field
/**
* Processes single field.
*
* @staticvar array $repetitive_started
* @param type $post
* @param type $field
* @param type $use_cache
* @param type $add_to_editor
* @param type $context
* @param type $original_cf
* @param type $invalid_fields
* @return mixed boolean|array
*/
function wpcf_admin_post_process_field($post = false, $field_unedited = array(), $use_cache = true, $add_to_editor = true, $context = 'group', $original_cf = array(), $invalid_fields = array())
{
$field = wpcf_admin_fields_get_field($field_unedited['id']);
if (!empty($field)) {
// Set values
$field['value'] = isset($field_unedited['value']) ? $field_unedited['value'] : '';
$field['wpml_action'] = isset($field_unedited['wpml_action']) ? $field_unedited['wpml_action'] : '';
if (isset($count[$field['type'] . '-' . $field['slug']])) {
$field_id = 'wpcf-' . $field['type'] . '-' . $field['slug'] . '-' . $count[$field['type'] . '-' . $field['slug']] . '-' . mt_rand();
$count[$field['type'] . '-' . $field['slug']] += 1;
} else {
$field_id = 'wpcf-' . $field['type'] . '-' . $field['slug'] . '-' . mt_rand();
$count[$field['type'] . '-' . $field['slug']] = 1;
}
$field_init_data = wpcf_fields_type_action($field['type']);
// Get inherited field
$inherited_field_data = false;
if (isset($field_init_data['inherited_field_type'])) {
$inherited_field_data = wpcf_fields_type_action($field_init_data['inherited_field_type']);
}
// Mark any field that is going to be copied.
if (!empty($original_cf['fields'])) {
foreach ($original_cf['fields'] as $cf_id) {
if (wpcf_types_get_meta_prefix($field) . $field['slug'] == $cf_id) {
$field['readonly'] = true;
$field['wpml_action'] = 'copy';
break;
}
}
}
// Apply filters
$field['value'] = apply_filters('wpcf_fields_value_get', $field['value'], $field, $field_init_data);
$field['value'] = apply_filters('wpcf_fields_slug_' . $field['slug'] . '_value_get', $field['value'], $field, $field_init_data);
$field['value'] = apply_filters('wpcf_fields_type_' . $field['type'] . '_value_get', $field['value'], $field, $field_init_data);
wpcf_admin_post_field_load_js_css($field_init_data);
$element = array();
// Set generic values
$element = array('#type' => isset($field_init_data['inherited_field_type']) ? $field_init_data['inherited_field_type'] : $field['type'], '#id' => $field_id, '#title' => wpcf_translate('field ' . $field['id'] . ' name', $field['name']), '#description' => wpautop(wpcf_translate('field ' . $field['id'] . ' description', $field['description'])), '#name' => 'wpcf[' . $field['slug'] . ']', '#value' => isset($field['value']) ? $field['value'] : '', 'wpcf-id' => $field['id'], 'wpcf-slug' => $field['slug'], 'wpcf-type' => $field['type']);
// Set inherited values
$element_inherited = array();
if ($inherited_field_data) {
if (function_exists('wpcf_fields_' . $field_init_data['inherited_field_type'] . '_meta_box_form')) {
$element_inherited = call_user_func_array('wpcf_fields_' . $field_init_data['inherited_field_type'] . '_meta_box_form', array($field, $element));
}
}
$element = array_merge($element, $element_inherited);
if (isset($field['description_extra'])) {
$element['#description'] .= wpautop($field['description_extra']);
}
// Set atributes #1
if (isset($field['disable'])) {
$field['#disable'] = $field['disable'];
}
if (!empty($field['disable'])) {
$field['#attributes']['disabled'] = 'disabled';
}
if (!empty($field['readonly'])) {
$field['#attributes']['readonly'] = 'readonly';
}
// Set specific values
if (defined('WPCF_INC_ABSPATH') && file_exists(WPCF_INC_ABSPATH . '/fields/' . $field['type'] . '.php')) {
require_once WPCF_INC_ABSPATH . '/fields/' . $field['type'] . '.php';
}
// Load field
if (function_exists('wpcf_fields_' . $field['type'] . '_meta_box_form')) {
$element_specific = call_user_func_array('wpcf_fields_' . $field['type'] . '_meta_box_form', array($field, $element));
// Check if it's single
if (isset($element_specific['#type'])) {
// Format description
if (!empty($element_specific['#description'])) {
$element_specific['#description'] = wpautop($element_specific['#description']);
}
$element = array_merge($element, $element_specific);
// Set validation element
if (isset($field['data']['validate'])) {
$element['#validate'] = $field['data']['validate'];
}
// Repetitive fields
if (wpcf_admin_is_repetitive($field) && $context != 'post_relationship' && (!isset($field['wpml_action']) || $field['wpml_action'] != 'copy')) {
$element = wpcf_admin_post_process_repetitive_field($post, $field, $element);
}
} else {
// More fields, loop all
// Only Skype for now have multiple fields, so process only that
if ($field['type'] == 'skype') {
$skype_element = array();
foreach ($element_specific as $element_specific_fields_key => $element_specific_fields_value) {
//.........这里部分代码省略.........
开发者ID:sriram911,项目名称:pls,代码行数:101,代码来源:fields-post.php
示例7: wpcf_fields_checkboxes_view
/**
* View function.
*
* @param type $params
*/
function wpcf_fields_checkboxes_view($params)
{
$option = array();
// Basic checks
if (empty($params['field']['data']['options']) || !is_array($params['field_value'])) {
return '__wpcf_skip_empty';
}
/*
*
* NO OPTION specified
* loop over all options and display all of them
*/
if (!isset($params['option'])) {
$separator = isset($params['separator']) ? html_entity_decode($params['separator']) : ', ';
foreach ($params['field_value'] as $name => &$value) {
/*
*
* Set option
*/
if (isset($params['field']['data']['options'][$name])) {
$option = $params['field']['data']['options'][$name];
} else {
// Unset if not valid
unset($params['field_value'][$name]);
continue;
}
/*
*
* Set output according to settings.
* 'db' or 'value'
*/
if ($option['display'] == 'db' && !empty($option['set_value']) && !empty($value)) {
$value = $option['set_value'];
$value = wpcf_translate('field ' . $params['field']['id'] . ' option ' . $name . ' value', $value);
} else {
if ($option['display'] == 'value') {
if (isset($option['display_value_selected']) && !empty($value)) {
$value = $option['display_value_selected'];
$value = wpcf_translate('field ' . $params['field']['id'] . ' option ' . $name . ' display value selected', $value);
} else {
$value = $option['display_value_not_selected'];
$value = wpcf_translate('field ' . $params['field']['id'] . ' option ' . $name . ' display value not selected', $value);
}
} else {
unset($params['field_value'][$name]);
}
}
}
$output = implode(array_values($params['field_value']), $separator);
return empty($output) ? '__wpcf_skip_empty' : stripslashes($output);
}
/*
*
*
* OPTION specified - set required option.
*/
$i = 0;
foreach ($params['field']['data']['options'] as $option_key => $option_value) {
if (intval($params['option']) == $i) {
$option['key'] = $option_key;
$option['data'] = $option_value;
$option['value'] = !empty($params['field_value'][$option_key]) ? $params['field_value'][$option_key] : '__wpcf_unchecked';
break;
}
$i++;
}
$output = '';
/*
* STATE set - use #content is as render value.
* If setings are faulty - return '__wpcf_skip_empty'.
*/
if (isset($params['state'])) {
$content = !empty($params['#content']) ? htmlspecialchars_decode($params['#content']) : '__wpcf_skip_empty';
if ($params['state'] == 'checked' && $option['value'] != '__wpcf_unchecked') {
return $content;
} else {
if ($params['state'] == 'unchecked' && $option['value'] == '__wpcf_unchecked') {
return $content;
} else {
if (isset($params['state'])) {
return '__wpcf_skip_empty';
}
}
}
}
/*
*
* MAIN settings
* 'db' - Use 'set_value' as render value
* 'value' - Use values set in Group form data 'display_value_selected'
* or 'display_value_not_selected'
*
* Only set if it matches settings.
* Otherwise leave empty and '__wpcf_skip_empty' will be returned.
*
//.........这里部分代码省略.........
开发者ID:CrankMaster336,项目名称:FFW-TR,代码行数:101,代码来源:checkboxes.php
示例8: wpcf_admin_ctt_list
/**
* Renders 'widefat' table.
*/
function wpcf_admin_ctt_list()
{
$custom_types = get_option('wpcf-custom-types', array());
$custom_taxonomies = get_option('wpcf-custom-taxonomies', array());
if (empty($custom_types) && empty($custom_taxonomies)) {
echo '<p>' . __('Custom Post Types are user-defined content types. Custom Taxonomies are used to categorize your content.', 'wpcf') . ' ' . __('You can read more about Custom Post Types and Taxonomies in this tutorial. <a href="http://wp-types.com/learn/custom-post-types/" target="_blank">http://wp-types.com/learn/custom-post-types/</a>', 'wpcf') . '</p>';
}
echo '<br /><a class="button-secondary" href="' . admin_url('admin.php?page=wpcf-edit-type') . '">' . __('Add Custom Post Type', 'wpcf') . '</a>' . ' <a class="button-secondary" href="' . admin_url('admin.php?page=wpcf-edit-tax') . '">' . __('Add Custom Taxonomy', 'wpcf') . '</a><br /><br />';
if (!empty($custom_types)) {
$rows = array();
$header = array('name' => __('Post Type Name', 'wpcf'), 'description' => __('Description', 'wpcf'), 'active' => __('Active', 'wpcf'), 'tax' => __('Taxonomies', 'wpcf'));
foreach ($custom_types as $post_type => $type) {
$name = '';
$name .= '<a href="' . admin_url('admin.php?page=wpcf-edit-type&wpcf-post-type=' . $post_type) . '">' . wpcf_translate($post_type . ' name', $type['labels']['name'], 'Types-CPT') . '</a>';
$name .= '<br />';
$name .= '<a href="' . admin_url('admin.php?page=wpcf-edit-type&wpcf-post-type=' . $post_type) . '">' . __('Edit', 'wpcf') . '</a> | ';
$name .= empty($type['disabled']) ? wpcf_admin_custom_types_get_ajax_deactivation_link($post_type) . ' | ' : wpcf_admin_custom_types_get_ajax_activation_link($post_type) . ' | ';
$name .= '<a href="' . admin_url('admin-ajax.php?action=wpcf_ajax&' . 'wpcf_action=delete_post_type&wpcf-post-type=' . $post_type . '&wpcf_ajax_update=wpcf_list_ajax_response_' . $post_type) . '&wpcf_ajax_callback=wpcfRefresh&_wpnonce=' . wp_create_nonce('delete_post_type') . '&wpcf_warning=' . __('Are you sure?', 'wpcf') . '" class="wpcf-ajax-link" id="wpcf-list-delete-' . $post_type . '">' . __('Delete Permanently', 'wpcf') . '</a>';
$name .= '<div id="wpcf_list_ajax_response_' . $post_type . '"></div>';
$rows[$post_type]['name'] = $name;
$rows[$post_type]['description'] = isset($type['description']) ? htmlspecialchars(stripslashes(wpcf_translate($post_type . ' description', $type['description'], 'Types-CPT')), ENT_QUOTES) : '';
$rows[$post_type]['active-' . $post_type] = !empty($type['disabled']) ? __('No', 'wpcf') : __('Yes', 'wpcf');
$rows[$post_type]['tax'] = array();
if (!empty($type['taxonomies'])) {
foreach ($type['taxonomies'] as $temp_tax => $true) {
$rows[$post_type]['tax'][] = wpcf_translate($temp_tax . ' name', $temp_tax, 'Types-TAX');
}
}
$rows[$post_type]['tax'] = !empty($rows[$post_type]['tax']) ? implode(', ', $rows[$post_type]['tax']) : __('None', 'wpcf');
}
// Render table
wpcf_admin_widefat_table('wpcf_types_list', $header, $rows);
}
if (!empty($custom_taxonomies)) {
$rows = array();
$header = array('name' => __('Taxonomy Name', 'wpcf'), 'description' => __('Description', 'wpcf'), 'active' => __('Active', 'wpcf'), 'post_types' => __('Post Types', 'wpcf'));
foreach ($custom_taxonomies as $taxonomy => $data) {
$name = '';
$name .= '<a href="' . admin_url('admin.php?page=wpcf-edit-tax&wpcf-tax=' . $taxonomy) . '">' . wpcf_translate($taxonomy . ' name', $data['labels']['name'], 'Types-TAX') . '</a>';
$name .= '<br />';
$name .= '<a href="' . admin_url('admin.php?page=wpcf-edit-tax&wpcf-tax=' . $taxonomy) . '">' . __('Edit', 'wpcf') . '</a> | ';
$name .= empty($data['disabled']) ? wpcf_admin_custom_taxonomies_get_ajax_deactivation_link($taxonomy) . ' | ' : wpcf_admin_custom_taxonomies_get_ajax_activation_link($taxonomy) . ' | ';
$name .= '<a href="' . admin_url('admin-ajax.php?action=wpcf_ajax&' . 'wpcf_action=delete_taxonomy&wpcf-tax=' . $taxonomy . '&wpcf_ajax_callback=wpcfRefresh&wpcf_ajax_update=wpcf_list_ajax_response_' . $taxonomy) . '&_wpnonce=' . wp_create_nonce('delete_taxonomy') . '&wpcf_warning=' . __('Are you sure?', 'wpcf') . '" class="wpcf-ajax-link" id="wpcf-list-delete-' . $taxonomy . '">' . __('Delete Permanently', 'wpcf') . '</a>';
$name .= '<div id="wpcf_list_ajax_response_' . $taxonomy . '"></div>';
$rows[$taxonomy]['name'] = $name;
$rows[$taxonomy]['description'] = isset($data['description']) ? htmlspecialchars(stripslashes(wpcf_translate($taxonomy . ' description', $type['description'], 'Types-TAX')), ENT_QUOTES) : '';
$rows[$taxonomy]['active-' . $taxonomy] = !empty($data['disabled']) ? __('No', 'wpcf') : __('Yes', 'wpcf');
$rows[$taxonomy]['post_types'] = array();
if (!empty($data['supports'])) {
foreach ($data['supports'] as $temp_post_type => $true) {
$rows[$taxonomy]['post_types'][] = wpcf_translate($temp_post_type . ' name', $temp_post_type, 'Types-CPT');
}
}
$rows[$taxonomy]['post_types'] = !empty($rows[$taxonomy]['post_types']) ? implode(', ', $rows[$taxonomy]['post_types']) : __('None', 'wpcf');
}
// Render table
echo '<br />';
wpcf_admin_widefat_table('wpcf_tax_list', $header, $rows);
}
do_action('wpcf_types_tax_list_table_after');
}
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:64,代码来源:custom-types-taxonomies-list.php
示例9: wpcf_admin_post_meta_box
/**
* Renders meta box content.
*
* Core function. Works and stable.
* If required, add hooks only.
*
* @todo Revise this 1.1.5
*
* @param type $post
* @param type $group
* @param type $echo
* @param type boolean $open_style_editor if true use code for open style editor when edit group
*/
function wpcf_admin_post_meta_box($post, $group, $echo = '', $open_style_editor = false)
{
if (false === $open_style_editor && defined('WPTOOLSET_FORMS_VERSION')) {
if (isset($group['args']['html'])) {
/**
* show group description
*/
if (array_key_exists('description', $group['args']) && !empty($group['args']['description'])) {
echo '<div class="wpcf-meta-box-description">';
echo wpautop(wpcf_translate('group ' . $group['args']['id'] . ' description', $group['args']['description']));
echo '</div>';
}
foreach ($group['args']['html'] as $field) {
echo is_array($field) ? wptoolset_form_field('post', $field['config'], $field['meta']) : $field;
}
}
return;
}
global $wpcf;
/**
* fake post object if need
*/
$post = wpcf_admin_create_fake_post_if_need($post);
static $nonce_added = false;
$group_output = '';
if (!isset($group['title'])) {
$temp = $group;
$group = '';
$group['args'] = $temp;
$group['id'] = $temp['slug'];
$group['title'] = $temp['name'];
$name = $temp['name'];
}
if (!empty($echo)) {
$group_output = '<h3>This Preview generated for latest post "' . $post->post_title . '"</h3>' . "\n" . '<!-- Previous lines visible only in Admin Style Editor.-->' . "\n\n";
$group_output .= '<div id="wpcf-group-' . $group['id'] . '" class="postbox " >
<h3 class=\'hndle\'><span>' . $name . '</span></h3>
<div class="inside">' . "\n";
}
/*
* TODO Document where this is used
*/
if (!$nonce_added && empty($echo)) {
$nonce_action = 'update-' . $post->post_type . '_' . $post->ID;
wp_nonce_field($nonce_action, '_wpcf_post_wpnonce');
$nonce_added = true;
}
$group_output .= "\n\n" . '<div id="wpcf-group-metabox-id-' . $group['args']['slug'] . '">' . "\n";
/*
* TODO Move to Conditional code
*
* This is already checked. Use hook to add wrapper DIVS and apply CSS.
*/
if (!empty($group['args']['_conditional_display'])) {
if ($group['args']['_conditional_display'] == 'failed') {
$group_output .= '<div class="wpcf-cd-group wpcf-cd-group-failed" style="display:none;">';
} else {
$group_output .= '<div class="wpcf-cd-group wpcf-cd-group-passed">';
}
}
/*
* TODO Move this into Field code
* Process fields
*/
if (!empty($group['args']['fields'])) {
// Display description
if (!empty($group['args']['description'])) {
$group_output .= '<div class="wpcf-meta-box-description">' . wpautop(wpcf_translate('group ' . $group['args']['id'] . ' description', $group['args']['description'])) . '</div>';
}
foreach ($group['args']['fields'] as $field_slug => $field) {
if (empty($field) || !is_array($field)) {
continue;
}
$field = $wpcf->field->_parse_cf_form_element($field);
if (isset($field['wpcf-type'])) {
// May be ignored
$field = apply_filters('wpcf_fields_' . $field['wpcf-type'] . '_meta_box_form_value_display', $field);
}
if (!isset($field['#id'])) {
$field['#id'] = wpcf_unique_id(serialize($field));
}
// Render form elements
if (wpcf_compare_wp_version() && array_key_exists('#type', $field) && 'wysiwyg' == $field['#type'] && !isset($field['#attributes']['disabled'])) {
// if ( isset( $field['#attributes']['disabled'] ) ) {
// $field['#editor_settings']['tinymce'] = false;
// $field['#editor_settings']['teeny'] = false;
// $field['#editor_settings']['media_buttons'] = false;
//.........这里部分代码省略.........
开发者ID:SpencerNeitzke,项目名称:types,代码行数:101,代码来源:fields-post.php
示例10: get_display_name
/**
* Get group name as it should be displayed to the user.
*
* Handles string translation if applicable.
*/
public function get_display_name()
{
return wpcf_translate(sprintf('group %d name', $this->get_id()), $this->get_name());
}
开发者ID:axeljohansson1988,项目名称:oddcv,代码行数:9,代码来源:group.php
示例11: wpcf_fields_radio_view
/**
* View function.
*
* @param type $params
*/
function wpcf_fields_radio_view($params)
{
if (isset($params['style']) && $params['style'] == 'raw') {
return '';
}
if (isset($params['termmeta']) && !empty($params['termmeta'])) {
$field = wpcf_fields_get_field_by_slug($params['field']['slug'], 'wpcf-termmeta');
} else {
if (isset($params['usermeta']) && !empty($params['usermeta'])) {
$field = wpcf_fields_get_field_by_slug($params['field']['slug'], 'wpcf-usermeta');
} else {
$field = wpcf_fields_get_field_by_slug($params['field']['slug']);
}
}
$output = '';
// See if user specified output for each field
if (isset($params['option'])) {
foreach ($field['data']['options'] as $option_key => $option) {
if (isset($option['value'])) {
$test_val = stripslashes(strval($option['value']));
if ($test_val == $params['field_value'] && $option_key == $params['option']) {
return htmlspecialchars_decode($params['#content']);
}
}
}
// return ' ';
return '__wpcf_skip_empty';
}
if (!empty($field['data']['options'])) {
$field_value = $params['field_value'];
foreach ($field['data']['options'] as $option_key => $option) {
if (isset($option['value']) && stripslashes($option['value']) == stripslashes($params['field_value'])) {
// We need to translate here because the stored value is on the original language
// When updaing the value in the Field group, we might have problems
$field_value = wpcf_translate('field ' . $params['field']['id'] . ' option ' . $option_key . ' title', $option['title']);
if (isset($params['field']['data']['display']) && $params['field']['data']['display'] != 'db' && !empty($option['display_value'])) {
// We need to translate here because the stored value is on the original language
// When updaing the value in the Field group, we might have problems
$field_value = wpcf_translate('field ' . $params['field']['id'] . ' option ' . $option_key . ' display value', $option['display_value']);
}
}
}
$output = $field_value;
}
return $output;
}
开发者ID:phuocdungit,项目名称:fundy,代码行数:51,代码来源:radio.php
示例12: wpcf_icl_editor_cf_description_filter
/**
* WPML editor filter
*
* @param type $cf_name
* @param type $description
* @return type
*/
function wpcf_icl_editor_cf_description_filter($description, $cf_name)
{
require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php';
$fields = wpcf_admin_fields_get_fields();
if (empty($fields)) {
return $description;
}
$cf_name = substr($cf_name, 6);
if (strpos($cf_name, WPCF_META_PREFIX) == 0) {
$cf_name = str_replace(WPCF_META_PREFIX, '', $cf_name);
}
if (isset($fields[$cf_name]['description'])) {
$description = wpcf_translate('field ' . $fields[$cf_name]['id'] . ' description', $fields[$cf_name]['description']);
}
return $description;
}
开发者ID:sriram911,项目名称:pls,代码行数:23,代码来源:admin.php
示例13: wpcf_fields_radio_view
/**
* View function.
*
* @param type $params
*/
function wpcf_fields_radio_view($params)
{
if ($params['style'] == 'raw') {
return '';
}
$field = wpcf_fields_get_field_by_slug($params['field']['slug']);
$output = '';
// See if user specified output for each field
if (isset($params['option'])) {
foreach ($field['data']['options'] as $option_key => $option) {
if (isset($option['value']) && $option['value'] == $params['field_value'] && $option_key == $params['option']) {
return htmlspecialchars_decode($params['#content']);
}
}
return ' ';
}
if (!empty($field['data']['options'])) {
$field_value = $params['field_value'];
foreach ($field['data']['options'] as $option_key => $option) {
if (isset($option['value']) && $option['value'] == $params['field_value']) {
$field_value = wpcf_translate('field ' . $params['field']['id'] . ' option ' . $option_key . ' title', $option['title']);
if (isset($params['field']['data']['display']) && $params['field']['data']['display'] != 'db' && !empty($option['display_value'])) {
$field_value = wpcf_translate('field ' . $params['field']['id'] . ' option ' . $option_key . ' display value', $option['display_value']);
}
}
}
$field_value = wpcf_frontend_wrap_field_value($params['field'], $field_value, $params);
$output = wpcf_frontend_wrap_field($params['field'], $field_value);
}
return $output;
}
开发者ID:rdbartlett,项目名称:kellyspencer.co.nz,代码行数:36,代码来源:radio.php
示例14: wpcf_admin_post_meta_box
/**
* Renders meta box content.
*
* Core function. Works and stable.
* If required, add hooks only.
*
* @todo Revise this 1.1.5
*
* @param type $post
* @param type $group
*/
function wpcf_admin_post_meta_box($post, $group)
{
global $wpcf;
static $nonce_added = false;
/*
* TODO Document where this is used
*/
if (!$nonce_added) {
$nonce_action = 'update-' . $post->post_type . '_' . $post->ID;
wp_nonce_field($nonce_action, '_wpcf_post_wpnonce');
$nonce_added = true;
}
/*
* TODO Move to Conditional code
*
* This is already checked. Use hook to add wrapper DIVS and apply CSS.
*/
if (!empty($group['args']['_conditional_display'])) {
if ($group['args']['_conditional_display'] == 'failed') {
echo '<div class="wpcf-cd-group wpcf-cd-group-failed" style="display:none;">';
} else {
echo '<div class="wpcf-cd-group wpcf-cd-group-passed">';
}
}
/*
* TODO Move this into Field code
* Process fields
*/
if (!empty($group['args']['fields'])) {
// Display description
if (!empty($group['args']['description'])) {
echo '<div class="wpcf-meta-box-description">' . wpautop(wpcf_translate('group ' . $group['args']['id'] . ' description', $group['args']['description'])) . '</div>';
}
foreach ($group['args']['fields'] as $field_slug => $field) {
if (empty($field) || !is_array($field)) {
continue;
}
$field = $wpcf->field->_parse_cf_form_element($field);
if (!isset($field['#id'])) {
$field['#id'] = wpcf_unique_id(serialize($field));
}
// Render form elements
if (wpcf_compare_wp_version() && $field['#type'] == 'wysiwyg') {
// Especially for WYSIWYG
echo '<div class="wpcf-wysiwyg">';
echo '<div id="wpcf-textarea-textarea-wrapper" class="form-item form-item-textarea wpcf-form-item wpcf-form-item-textarea">';
echo isset($field['#before']) ? $field['#before'] : '';
echo '
<label class="wpcf-form-label wpcf-form-textarea-label">' . $field['#title'] . '</label>';
echo '<div class="description wpcf-form-description wpcf-form-description-textarea description-textarea">
' . wpautop($field['#description']) . '</div>';
wp_editor($field['#value'], $field['#id'], $field['#editor_settings']);
$field['slug'] = str_replace(WPCF_META_PREFIX . 'wysiwyg-', '', $field_slug);
$field['type'] = 'wysiwyg';
echo '</div>';
echo isset($field['#after']) ? $field['#after'] : '';
echo '</div><br /><br />';
} else {
if ($field['#type'] == 'wysiwyg') {
$field['#type'] = 'textarea';
}
echo wpcf_form_simple(array($field['#id'] => $field));
}
do_action('wpcf_fields_' . $field_slug . '_meta_box_form', $field);
if (isset($field['wpcf-type'])) {
// May be ignored
do_action('wpcf_fields_' . $field['wpcf-type'] . '_meta_box_form', $field);
}
}
}
/*
* TODO Move to Conditional code
*
* This is already checked. Use hook to add wrapper DIVS and apply CSS.
*/
if (!empty($group['args']['_conditional_display'])) {
echo '</div>';
}
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:90,代码来源:fields-post.php
示例15: wpcf_fields_checkbox_view
/**
* View function.
*
* @param type $params
*/
function wpcf_fields_checkbox_view($params)
{
$output = '';
if (isset($params['state']) && $params['state'] == 'unchecked' && empty($params['field_value'])) {
return htmlspecialchars_decode($params['#content']);
} else {
if (isset($params['state']) && $params['state'] == 'unchecked') {
return '__wpcf_skip_empty';
}
}
if (isset($params['state']) && $params['state'] == 'checked' && !empty($params['field_value'])) {
return htmlspecialchars_decode($params['#content']);
} else {
if (isset($params['state']) && $params['state'] == 'checked') {
return '__wpcf_skip_empty';
}
}
if (!empty($params['#content'])) {
return htmlspecialchars_decode($params['#content']);
}
if ($params['field']['data']['display'] == 'db' && $params['field_value'] != '') {
$field = wpcf_fields_get_field_by_slug($params['field']['slug']);
$output = $field['data']['set_value'];
// Show the translated value if we have one.
$output = wpcf_translate('field ' . $field['id'] . ' checkbox value', $output);
} else {
if ($params['field']['data']['display'] == 'value' && $params['field_value'] != '') {
if (!empty($params['field']['data']['display_value_selected'])) {
$output = $params['field']['data']['display_value_selected'];
$output = wpcf_translate('field ' . $params['field']['id'] . ' checkbox value selected', $output);
}
} else {
if ($params['field']['data']['display'] == 'value') {
if (!empty($params['field']['data']['display_value_not_selected'])) {
$output = $params['field']['data']['display_value_not_selected'];
$output = wpcf_translate('field ' . $params['field']['id'] . ' checkbox value not selected', $output);
}
}
}
}
return $output;
}
开发者ID:sriram911,项目名称:pls,代码行数:47,代码来源:checkbox.php
示例16: types_render_field
/**
* Calls view function for specific field type.
*
* @param type $field
* @param type $atts
* @return type
*/
function types_render_field($field, $params, $content = null, $code = '')
{
require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php';
// Count fields (if there are duplicates)
static $count = array();
// Get field
$field = wpcf_fields_get_field_by_slug($field);
if (empty($field)) {
return '';
}
// Count it
if (!isset($count[$field['slug']])) {
$count[$field['slug']] = 1;
} else {
$count[$field['slug']] += 1;
}
// Get post field value
global $post;
$value = get_post_meta($post->ID, wpcf_types_get_meta_prefix($field) . $field['slug'], true);
if ($value == '' && $field['type'] != 'checkbox') {
return '';
}
// Load type
$type = wpcf_fields_type_action($field['type']);
// Apply filters to field value
$value = apply_filters('wpcf_fields_value_display', $value);
$value = apply_filters('wpcf_fields_slug_' . $field['slug'] . '_value_display', $value);
$value = apply_filters('wpcf_fields_type_' . $field['type'] . '_value_display', $value);
// To make sure
if (is_string($value)) {
$value = addslashes(stripslashes($value));
}
// Set values
$field['name'] = wpcf_translate('field ' . $field['id'] . ' name', $field['name']);
$params['field'] = $field;
$params['post'] = $post;
$params['field_value'] = $value;
// Get output
$params['#content'] = htmlspecialchars($content);
$params['#code'] = $code;
$output = wpcf_fields_type_action($field['type'], 'view', $params);
// Convert to string
if (!empty($output)) {
$output = strval($output);
}
// @todo Reconsider if ever changing this (works fine now)
// If no output or 'raw' return default
if (($params['raw'] == 'true' || empt
|
请发表评论