本文整理汇总了PHP中wpcf_wpml_post_is_original函数的典型用法代码示例。如果您正苦于以下问题:PHP wpcf_wpml_post_is_original函数的具体用法?PHP wpcf_wpml_post_is_original怎么用?PHP wpcf_wpml_post_is_original使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpcf_wpml_post_is_original函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: metaform
public function metaform()
{
$attributes = $this->getAttr();
$form = array();
$markup = '';
$wpml_action = $this->getWPMLAction();
if (is_admin()) {
$markup .= '<div class="form-item form-item-markup">';
$extra_markup = '';
if (defined('WPML_TM_VERSION') && intval($wpml_action) === 1 && function_exists('wpcf_wpml_post_is_original') && !wpcf_wpml_post_is_original() && function_exists('wpcf_wpml_have_original') && wpcf_wpml_have_original()) {
$attributes['readonly'] = 'readonly';
$extra_markup .= sprintf('<img src="%s/images/locked.png" alt="%s" title="%s" style="position:relative;left:2px;top:2px;" />', WPCF_EMBEDDED_RES_RELPATH, __('This field is locked for editing because WPML will copy its value from the original language.', 'wpcf'), __('This field is locked for editing because WPML will copy its value from the original language.', 'wpcf'));
}
$markup .= sprintf('<label class="wpt-form-label wpt-form-textfield-label">%1$s%2$s</label>', stripcslashes($this->getTitle()), $extra_markup);
}
if (is_admin()) {
$markup .= '<div class="description wpt-form-description wpt-form-description-textfield description-textfield">' . stripcslashes($this->getDescription()) . '</div>';
} else {
$markup .= stripcslashes($this->getDescription());
}
$markup .= $this->_editor($attributes);
if (is_admin()) {
$markup .= '</div>';
}
$form[] = array('#type' => 'markup', '#markup' => $markup);
return $form;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:27,代码来源:class.wysiwyg.php
示例2: metaform
public function metaform()
{
$value = wp_parse_args($this->getValue(), $this->_defaults);
$attributes = $this->getAttr();
$wpml_action = $this->getWPMLAction();
if (isset($attributes['class'])) {
$attributes['class'] .= ' ';
} else {
$attributes['class'] = '';
}
$attributes['class'] = 'js-wpt-skypename js-wpt-cond-trigger regular-text';
// What is this js-wpt-cond-trigger classname for?
$form = array();
$form[] = array('#type' => 'textfield', '#title' => $this->getTitle(), '#description' => $this->getDescription(), '#name' => $this->getName() . "[skypename]", '#attributes' => array(), '#value' => $value['skypename'], '#validate' => $this->getValidationData(), '#attributes' => $attributes, '#repetitive' => $this->isRepetitive(), 'wpml_action' => $wpml_action);
/**
* action
*/
$form[] = array('#type' => 'hidden', '#value' => $value['action'], '#name' => $this->getName() . '[action]', '#attributes' => array('class' => 'js-wpt-skype-action'));
/**
* color
*/
$form[] = array('#type' => 'hidden', '#value' => $value['color'], '#name' => $this->getName() . '[color]', '#attributes' => array('class' => 'js-wpt-skype-color'));
/**
* size
*/
$form[] = array('#type' => 'hidden', '#value' => $value['size'], '#name' => $this->getName() . '[size]', '#attributes' => array('class' => 'js-wpt-skype-size'));
if (!is_admin()) {
return $form;
}
$button_element = array('#name' => '', '#type' => 'button', '#value' => esc_attr(__('Edit Skype', 'wpv-views')), '#attributes' => array('class' => 'js-wpt-skype-edit-button button button-small button-secondary'));
if (is_admin() && defined('WPML_TM_VERSION') && intval($wpml_action) === 1 && function_exists('wpcf_wpml_post_is_original') && !wpcf_wpml_post_is_original() && function_exists('wpcf_wpml_have_original') && wpcf_wpml_have_original()) {
$button_element['#attributes']['disabled'] = 'disabled';
}
foreach ($value as $key => $val) {
$button_element['#attributes']['data-' . esc_attr($key)] = $val;
}
$form[] = $button_element;
return $form;
}
开发者ID:lytranuit,项目名称:wordpress,代码行数:39,代码来源:class.skype.php
示例3: wpcf_admin_post_process_fields
/**
* Creates form elements.
*
* Core function. Works and stable. Do not move or change.
* If required, add hooks only.
*
* @param type $post
* @param type $fields
* @return type
*/
function wpcf_admin_post_process_fields($post = false, $fields = array(), $use_cache = true, $add_to_editor = true, $context = 'group')
{
global $wpcf;
$wpcf->field->use_cache = $use_cache;
$wpcf->field->add_to_editor = $add_to_editor;
$wpcf->repeater->use_cache = $use_cache;
$wpcf->repeater->add_to_editor = $add_to_editor;
// Get cached
static $cache = array();
$cache_key = !empty($post->ID) ? $post->ID . md5(serialize($fields)) : false;
if ($use_cache && $cache_key && isset($cache[$cache_key])) {
return $cache[$cache_key];
}
$fields_processed = array();
// Get invalid fields (if submitted)
$invalid_fields = array();
if (!empty($post->ID)) {
$invalid_fields = get_post_meta($post->ID, 'wpcf-invalid-fields', true);
delete_post_meta($post->ID, 'wpcf-invalid-fields');
/*
*
* Add it to global $wpcf
* From now on take it there.
*/
$wpcf->field->invalid_fields = $invalid_fields;
}
// TODO WPML Get WPML original fields
$original_cf = array();
if (function_exists('wpml_get_copied_fields_for_post_edit') && !wpcf_wpml_post_is_original($post)) {
$__fields_slugs = array();
foreach ($fields as $_f) {
$__fields_slugs[] = $_f['meta_key'];
}
$original_cf = wpml_get_copied_fields_for_post_edit($__fields_slugs);
}
foreach ($fields as $field) {
// Repetitive fields
if (wpcf_admin_is_repetitive($field) && $context != 'post_relationship') {
// First check if repetitive fields are copied using WPML
/*
* TODO All WPML specific code needs moving to
* /embedded/includes/wpml.php
*
* @since Types 1.2
*/
// TODO WPML move
if (!empty($original_cf['fields']) && in_array(wpcf_types_get_meta_prefix($field) . $field['slug'], $original_cf['fields'])) {
/*
* See if repeater can handle copied fields
*/
$wpcf->repeater->set(get_post($original_cf['original_post_id']), $field);
$fields_processed = $fields_processed + $wpcf->repeater->get_fields_form();
} else {
// Set repeater
/*
*
*
* @since Types 1.2
* Now we're using repeater class to handle repetitive forms.
* Main change is - use form from $field_meta_box_form() without
* re-processing form elements.
*
* Field should pass form as array:
* 'my_checkbox' => array('#type' => 'checkbox' ...),
* 'my_textfield' => array('#type' => 'textfield' ...),
*
* In form it should set values to be stored.
* Use hooks to adjust saved data.
*/
$wpcf->repeater->set($post, $field);
$fields_processed = $fields_processed + $wpcf->repeater->get_fields_form();
}
/*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
* Non-repetitive fields
*/
//.........这里部分代码省略.........
开发者ID:SpencerNeitzke,项目名称:types,代码行数:101,代码来源:fields-post.php
示例4: wpcf_wpml_field_is_copied
/**
* Checks if field is copied on post edit screen.
*
* @global type $sitepress
* @param type $field
* @param type $post
* @return boolean
*/
function wpcf_wpml_field_is_copied($field, $post = null)
{
if (defined('ICL_SITEPRESS_VERSION') && defined('WPML_TM_VERSION') && !defined('DOING_AJAX')) {
if (!wpcf_wpml_post_is_original($post)) {
return wpcf_wpml_have_original($post) && wpcf_wpml_field_is_copy($field);
}
}
return false;
}
开发者ID:evdant,项目名称:firstwp,代码行数:17,代码来源:wpml.php
示例5: metaform
/**
*
* @global object $wpdb
*
*/
public function metaform()
{
$value = $this->getValue();
$type = $this->getType();
$translated_type = '';
$form = array();
$preview = '';
$wpml_action = $this->getWPMLAction();
// Get attachment by guid
if (!empty($value)) {
global $wpdb;
$attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_type = 'attachment' AND guid=%s", $value));
}
// Set preview
if (!empty($attachment_id)) {
$attributes = array();
$full = wp_get_attachment_image_src($attachment_id, 'full');
if (!empty($full)) {
$attributes['data-full-src'] = esc_attr($full[0]);
}
$preview = wp_get_attachment_image($attachment_id, 'thumbnail', false, $attributes);
} else {
// If external image set preview
$file_path = parse_url($value);
if ($file_path && isset($file_path['path'])) {
$file = pathinfo($file_path['path']);
} else {
$file = pathinfo($value);
}
if (isset($file['extension']) && in_array(strtolower($file['extension']), array('jpg', 'jpeg', 'gif', 'png'))) {
$preview = '<img alt="" src="' . $value . '" />';
}
}
// Set button
switch ($type) {
case 'audio':
$translated_type = __('audio', 'wpv-views');
break;
case 'image':
$translated_type = __('image', 'wpv-views');
break;
case 'video':
$translated_type = __('video', 'wpv-views');
break;
default:
$translated_type = __('file', 'wpv-views');
break;
}
$button_status = '';
if (is_admin() && defined('WPML_TM_VERSION') && intval($wpml_action) === 1 && function_exists('wpcf_wpml_post_is_original') && !wpcf_wpml_post_is_original() && function_exists('wpcf_wpml_have_original') && wpcf_wpml_have_original()) {
$button_status = ' disabled="disabled"';
}
$button = sprintf('<button class="js-wpt-file-upload button button-secondary" data-wpt-type="%s"%s>%s</button>', $type, $button_status, sprintf(__('Select %s', 'wpv-views'), $translated_type));
// Set form
$form[] = array('#type' => 'textfield', '#name' => $this->getName(), '#title' => $this->getTitle(), '#description' => $this->getDescription(), '#value' => $value, '#suffix' => ' ' . $button, '#validate' => $this->getValidationData(), '#repetitive' => $this->isRepetitive(), '#attributes' => $this->getAttr(), 'wpml_action' => $wpml_action);
$form[] = array('#type' => 'markup', '#markup' => '<div class="js-wpt-file-preview wpt-file-preview">' . $preview . '</div>');
return $form;
}
开发者ID:lytranuit,项目名称:wordpress,代码行数:63,代码来源:class.file.php
示例6: metaform
public function metaform()
{
$time_value = $this->getValue();
$datepicker = $hour = $minute = null;
$timestamp = null;
$readonly = false;
$wpml_action = $this->getWPMLAction();
if (is_admin()) {
if (is_array($time_value) && array_key_exists('timestamp', $time_value) && $time_value) {
$timestamp = $time_value['timestamp'];
}
$datepicker = self::timetodate($timestamp);
$hour = self::timetodate($timestamp, 'H');
$minute = self::timetodate($timestamp, 'i');
} else {
// We are on a CRED form, on frontend, so getVAlue returns nothing or a string or an array of the kind array( 'datepicker' =>, 'hour' =>, 'minute' => )
// Note that even if the array is passed, 'hour' and 'minute' will only be passed if there are any
if (!empty($time_value)) {
if (is_array($time_value)) {
if (isset($time_value['timestamp']) && is_numeric($time_value['timestamp']) && self::_isTimestampInRange($time_value['timestamp'])) {
$timestamp = $time_value['timestamp'];
$datepicker = self::timetodate($timestamp);
} elseif (isset($time_value['datepicker']) && $time_value['datepicker'] !== false && is_numeric($time_value['datepicker']) && self::_isTimestampInRange($time_value['datepicker'])) {
$timestamp = $time_value['datepicker'];
$datepicker = self::timetodate($timestamp);
}
$hour = self::timetodate($timestamp, 'H');
if (isset($time_value['hour']) && is_numeric($time_value['hour'])) {
$hour = $time_value['hour'];
}
$minute = self::timetodate($timestamp, 'i');
if (isset($time_value['minute']) && is_numeric($time_value['minute'])) {
$minute = $time_value['minute'];
}
} else {
if (is_numeric($time_value) && self::_isTimestampInRange($time_value)) {
$timestamp = $time_value;
$datepicker = self::timetodate($timestamp);
} else {
$timestamp = self::strtotime($time_value);
$datepicker = $time_value;
}
$hour = self::timetodate($timestamp, 'H');
$minute = self::timetodate($timestamp, 'i');
}
}
}
$data = $this->getData();
$field_disable = false;
$def_class_aux = 'js-wpt-date-auxiliar';
if (is_admin() && defined('WPML_TM_VERSION') && intval($wpml_action) === 1 && function_exists('wpcf_wpml_post_is_original') && !wpcf_wpml_post_is_original() && function_exists('wpcf_wpml_have_original') && wpcf_wpml_have_original()) {
$field_disable = true;
// this will stop js validation of date field value (as it will get duplicated)
$def_class_aux = '';
}
if (!$timestamp) {
// If there is no timestamp, we need to make it an empty string
// A false value would render the hidden field with a value of 1
$timestamp = '';
$datepicker = null;
}
$def_class = 'js-wpt-date';
if ($field_disable || isset($data['attribute']) && isset($data['attribute']['readonly']) && $data['attribute']['readonly'] == 'readonly') {
$def_class .= ' js-wpv-date-readonly';
$def_class_aux .= ' js-wpt-date-readonly';
$readonly = true;
}
$form = array();
$validate = $this->getValidationData();
$title = $this->getTitle();
if (isset($validate['required']) && !empty($title)) {
// Asterisk
$title .= '*';
}
$attr_visible = array('class' => $def_class, 'style' => 'display:inline;width:150px;position:relative;', 'readonly' => 'readonly', 'title' => esc_attr(__('Select', 'wpv-views')) . " Date");
$attr_hidden = array('class' => $def_class_aux, 'data-ts' => $timestamp, 'data-wpt-type' => 'date');
if (isset($data['attribute']) && isset($data['attribute']['placeholder'])) {
$attr_visible['placeholder'] = $data['attribute']['placeholder'];
}
$form[] = array('#type' => 'textfield', '#title' => $title, '#description' => $this->getDescription(), '#attributes' => $attr_visible, '#name' => $this->getName() . '[display-only]', '#value' => $datepicker, '#inline' => true, 'wpml_action' => $wpml_action);
$form[] = array('#type' => 'hidden', '#title' => $title, '#attributes' => $attr_hidden, '#name' => $this->getName() . '[datepicker]', '#value' => $timestamp, '#validate' => $validate, '#repetitive' => $this->isRepetitive());
/*
// This was the old implementaton
// We have implemented the above one because we need a hidden field to hold the timestamp
// And the visible text input field to display the date string to the user
$form[] = array(
'#type' => 'textfield',
'#title' => $this->getTitle(),
'#attributes' => array('class' => $def_class, 'style' => 'width:150px;'),
'#name' => $this->getName() . '[datepicker]',
'#value' => $timestamp,
'#validate' => $this->getValidationData(),
'#repetitive' => $this->isRepetitive(),
);
*/
if (!empty($data['add_time'])) {
// Shared attributes
$attributes_hour_minute = array();
if ($readonly) {
$attributes_hour_minute['disabled'] = 'disabled';
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:class.date.php
注:本文中的wpcf_wpml_post_is_original函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论