本文整理汇总了PHP中wpcf_admin_ajax_head函数的典型用法代码示例。如果您正苦于以下问题:PHP wpcf_admin_ajax_head函数的具体用法?PHP wpcf_admin_ajax_head怎么用?PHP wpcf_admin_ajax_head使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpcf_admin_ajax_head函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wpcf_fields_checkbox_editor_callback
/**
* Editor callback form.
*/
function wpcf_fields_checkbox_editor_callback()
{
$form = array();
$value_not_selected = '';
$value_selected = '';
if (isset($_GET['field_id'])) {
$field = wpcf_admin_fields_get_field($_GET['field_id']);
if (!empty($field)) {
if (isset($field['data']['display_value_not_selected'])) {
$value_not_selected = $field['data']['display_value_not_selected'];
}
if (isset($field['data']['display_value_selected'])) {
$value_selected = $field['data']['display_value_selected'];
}
}
}
$form['#form']['callback'] = 'wpcf_fields_checkbox_editor_submit';
$form['display'] = array('#type' => 'radios', '#default_value' => 'db', '#name' => 'display', '#options' => array('display_from_db' => array('#title' => __('Display the value of this field from the database', 'wpcf'), '#name' => 'display', '#value' => 'db', '#inline' => true, '#after' => '<br />'), 'display_values' => array('#title' => __('Show one of these two values:', 'wpcf'), '#name' => 'display', '#value' => 'value')), '#inline' => true);
$form['display-value-1'] = array('#type' => 'textfield', '#title' => '<td style="text-align:right;">' . __('Not selected:', 'wpcf') . '</td><td>', '#name' => 'display_value_not_selected', '#value' => $value_not_selected, '#inline' => true, '#before' => '<table><tr>', '#after' => '</td></tr>');
$form['display-value-2'] = array('#type' => 'textfield', '#title' => '<td style="text-align:right;">' . __('Selected:', 'wpcf') . '</td><td>', '#name' => 'display_value_selected', '#value' => $value_selected, '#after' => '</tr></table>');
$form['submit'] = array('#type' => 'submit', '#name' => 'submit', '#value' => __('Save Changes'), '#attributes' => array('class' => 'button-primary'));
$f = wpcf_form('wpcf-form', $form);
wpcf_admin_ajax_head('Insert checkbox', 'wpcf');
echo '<form method="post" action="">';
echo $f->renderForm();
echo '</form>';
wpcf_admin_ajax_footer();
}
开发者ID:sriram911,项目名称:pls,代码行数:31,代码来源:checkbox.php
示例2: wpcf_fields_radio_editor_callback
/**
* Editor callback form.
*/
function wpcf_fields_radio_editor_callback()
{
wpcf_admin_ajax_head('Insert checkbox', 'wpcf');
$field = wpcf_admin_fields_get_field($_GET['field_id']);
if (empty($field)) {
echo '<div class="message error"><p>' . __('Wrong field specified', 'wpcf') . '</p></div>';
wpcf_admin_ajax_footer();
return '';
}
$form = array();
$form['#form']['callback'] = 'wpcf_fields_radio_editor_submit';
$form['display'] = array('#type' => 'radios', '#default_value' => 'db', '#name' => 'display', '#options' => array('display_from_db' => array('#title' => __('Display the value of this field from the database', 'wpcf'), '#name' => 'display', '#value' => 'db', '#inline' => true, '#after' => '<br />'), 'display_values' => array('#title' => __('Show one of these values:', 'wpcf'), '#name' => 'display', '#value' => 'value')), '#inline' => true);
if (!empty($field['data']['options'])) {
$form['table-open'] = array('#type' => 'markup', '#markup' => '<table style="margin-top:20px;" cellpadding="0" cellspacing="8">');
foreach ($field['data']['options'] as $option_id => $option) {
if ($option_id == 'default') {
continue;
}
$value = isset($option['display_value']) ? $option['display_value'] : $option['value'];
$form['display-value-' . $option_id] = array('#type' => 'textfield', '#title' => $option['title'], '#name' => 'options[' . $option_id . ']', '#value' => $value, '#inline' => true, '#pattern' => '<tr><td style="text-align:right;"><LABEL></td><td><ELEMENT></td></tr>', '#attributes' => array('style' => 'width:200px;'));
}
$form['table-close'] = array('#type' => 'markup', '#markup' => '</table>');
}
$form['submit'] = array('#type' => 'markup', '#markup' => get_submit_button());
$f = wpcf_form('wpcf-form', $form);
echo '<form method="post" action="">';
echo $f->renderForm();
echo '</form>';
wpcf_admin_ajax_footer();
}
开发者ID:rdbartlett,项目名称:kellyspencer.co.nz,代码行数:33,代码来源:radio.php
示例3: wpcf_fields_checkbox_editor_callback
/**
* Editor callback form.
*/
function wpcf_fields_checkbox_editor_callback()
{
wp_enqueue_script('jquery');
$form = array();
$value_not_selected = '';
$value_selected = '';
if (isset($_GET['field_id'])) {
$field = wpcf_admin_fields_get_field($_GET['field_id']);
if (!empty($field)) {
if (isset($field['data']['display_value_not_selected'])) {
$value_not_selected = $field['data']['display_value_not_selected'];
}
if (isset($field['data']['display_value_selected'])) {
$value_selected = $field['data']['display_value_selected'];
}
}
}
$form['#form']['callback'] = 'wpcf_fields_checkbox_editor_submit';
$form['display'] = array('#type' => 'radios', '#default_value' => 'db', '#name' => 'display', '#options' => array('display_from_db' => array('#title' => __('Display the value of this field from the database', 'wpcf'), '#name' => 'display', '#value' => 'db', '#inline' => true, '#after' => '<br />'), 'display_values' => array('#title' => __('Enter values for \'selected\' and \'not selected\' states', 'wpcf'), '#name' => 'display', '#value' => 'value')), '#inline' => true);
$form['states-start'] = array('#type' => 'markup', '#markup' => '<div id="wpcf-checkbox-states" style="display:none;margin-left:20px">');
$form['display-value-1'] = array('#type' => 'textfield', '#title' => '<td style="text-align:right;">' . __('Not selected:', 'wpcf') . '</td><td>', '#name' => 'display_value_not_selected', '#value' => $value_not_selected, '#inline' => true, '#before' => '<table><tr>', '#after' => '</td></tr>');
$form['display-value-2'] = array('#type' => 'textfield', '#title' => '<td style="text-align:right;">' . __('Selected:', 'wpcf') . '</td><td>', '#name' => 'display_value_selected', '#value' => $value_selected, '#before' => '<tr>', '#after' => '</tr></table>');
$form['states-end'] = array('#type' => 'markup', '#markup' => '</div>');
$form = wpcf_form_popup_add_optional($form);
$help = array('url' => "http://wp-types.com/documentation/functions/checkbox/", 'text' => __('Checkbox help', 'wpcf'));
$form = wpcf_form_popup_helper($form, __('Insert', 'wpcf'), __('Cancel', 'wpcf'), $help);
$f = wpcf_form('wpcf-form', $form);
add_action('admin_head_wpcf_ajax', 'wpcf_fields_checkbox_form_script');
wpcf_admin_ajax_head('Insert checkbox', 'wpcf');
echo '<form method="post" action="">';
echo $f->renderForm();
echo '</form>';
wpcf_admin_ajax_footer();
}
开发者ID:dewavi,项目名称:occupysandy.net,代码行数:37,代码来源:checkbox.php
示例4: wpcf_fields_url_editor_callback
/**
* Editor callback form.
*/
function wpcf_fields_url_editor_callback()
{
$form = array();
$form['#form']['callback'] = 'wpcf_fields_url_editor_submit';
$form['title'] = array('#type' => 'textfield', '#title' => __('Title', 'wpcf'), '#description' => __('If set, this text will be displayed instead of raw data'), '#name' => 'title');
$form['submit'] = array('#type' => 'submit', '#name' => 'submit', '#value' => __('Save Changes'), '#attributes' => array('class' => 'button-primary'));
$f = wpcf_form('wpcf-form', $form);
wpcf_admin_ajax_head('Insert URL', 'wpcf');
echo '<form method="post" action="">';
echo $f->renderForm();
echo '</form>';
wpcf_admin_ajax_footer();
}
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:16,代码来源:url.php
示例5: wpcf_fields_email_editor_callback
/**
* Editor callback form.
*/
function wpcf_fields_email_editor_callback()
{
$last_settings = wpcf_admin_fields_get_field_last_settings($_GET['field_id']);
$form = array();
$form['#form']['callback'] = 'wpcf_fields_email_editor_submit';
$form['title'] = array('#type' => 'textfield', '#title' => __('Title', 'wpcf'), '#description' => __('If set, this text will be displayed instead of raw data'), '#name' => 'title', '#value' => isset($last_settings['title']) ? $last_settings['title'] : '');
$form['submit'] = array('#type' => 'markup', '#markup' => get_submit_button());
$f = wpcf_form('wpcf-form', $form);
wpcf_admin_ajax_head('Insert email', 'wpcf');
echo '<form method="post" action="">';
echo $f->renderForm();
echo '</form>';
wpcf_admin_ajax_footer();
}
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:17,代码来源:email.php
示例6: wpcf_fields_google_map_editor_callback
/**
* Adds editor popup callnack.
*
* This form will be showed in editor popup
*/
function wpcf_fields_google_map_editor_callback()
{
wp_enqueue_style('wpcf-fields-google_map', WPCF_EMBEDDED_RES_RELPATH . '/css/basic.css', array(), WPCF_VERSION);
wp_enqueue_script('jquery');
// Get field
$field = wpcf_admin_fields_get_field($_GET['field_id']);
if (empty($field)) {
_e('Wrong field specified', 'wpcf');
die;
}
$last_settings = wpcf_admin_fields_get_field_last_settings($_GET['field_id']);
if (isset($_POST['_wpnonce_wpcf_form']) && wp_verify_nonce($_POST['_wpnonce_wpcf_form'], 'wpcf-form')) {
add_action('admin_head_wpcf_ajax', 'wpcf_fields_google_map_editor_submit');
}
wpcf_admin_ajax_head(__('Insert Google Map', 'wpcf'));
?>
<form method="post" action="">
<h2><?php
_e('Google Maps');
?>
</h2>
<?php
_e('Specify width and height for Google Map:');
?>
<br /><br />
<?php
wp_nonce_field('wpcf-form', '_wpnonce_wpcf_form');
?>
<input type="text" name="width" value="<?php
echo isset($last_settings['width']) ? $last_settings['width'] : '425';
?>
" />
<br />
<input type="text" name="height" value="<?php
echo isset($last_settings['height']) ? $last_settings['height'] : '350';
?>
" />
<br /><br /><input type="submit" class="button-primary" value="<?php
_e('Insert Google Map');
?>
" />
</form>
<?php
wpcf_admin_ajax_footer();
}
开发者ID:pwillems,项目名称:mimosa-contents,代码行数:50,代码来源:google-map.php
示例7: wpcf_fields_numeric_editor_callback
/**
* Editor callback form.
*/
function wpcf_fields_numeric_editor_callback()
{
wp_enqueue_style('wpcf-fields', WPCF_EMBEDDED_RES_RELPATH . '/css/basic.css', array(), WPCF_VERSION);
wp_enqueue_script('jquery');
// Get field
$field = wpcf_admin_fields_get_field($_GET['field_id']);
if (empty($field)) {
_e('Wrong field specified', 'wpcf');
die;
}
$last_settings = wpcf_admin_fields_get_field_last_settings($_GET['field_id']);
$form = array();
$form['#form']['callback'] = 'wpcf_fields_numeric_editor_submit';
$form['format'] = array('#type' => 'textfield', '#title' => __('Output format', 'wpcf'), '#description' => __("Similar to sprintf function. Default: 'FIELD_NAME: FIELD_VALUE'.", 'wpcf'), '#name' => 'format', '#value' => isset($last_settings['format']) ? $last_settings['format'] : 'FIELD_NAME: FIELD_VALUE');
$form['submit'] = array('#type' => 'submit', '#name' => 'submit', '#value' => __('Insert shortcode', 'wpcf'), '#attributes' => array('class' => 'button-primary'));
$f = wpcf_form('wpcf-form', $form);
wpcf_admin_ajax_head('Insert numeric', 'wpcf');
echo '<form method="post" action="">';
echo $f->renderForm();
echo '</form>';
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:24,代码来源:numeric.php
示例8: wpcf_fields_checkboxes_editor_callback
/**
* Editor callback form.
*/
function wpcf_fields_checkboxes_editor_callback()
{
$form = array();
$form['#form']['callback'] = 'wpcf_fields_checkboxes_editor_submit';
$form['display'] = array('#type' => 'radios', '#default_value' => 'display_all', '#name' => 'display', '#options' => array('display_from_db' => array('#title' => __('Display the value of this field from the database', 'wpcf'), '#name' => 'display', '#value' => 'db', '#inline' => true, '#after' => '<br />'), 'display_all' => array('#title' => __('Display all values with separator', 'wpcf'), '#name' => 'display', '#value' => 'display_all', '#inline' => true, '#after' => ' ' . wpcf_form_simple(array('separator' => array('#type' => 'textfield', '#name' => 'separator', '#value' => ', ', '#inline' => true))) . '<br />'), 'display_values' => array('#title' => __('Show one of these two values:', 'wpcf'), '#name' => 'display', '#value' => 'value')), '#inline' => true);
if (isset($_GET['field_id'])) {
$field = wpcf_admin_fields_get_field($_GET['field_id']);
if (!empty($field['data']['options'])) {
foreach ($field['data']['options'] as $option_key => $option) {
$form[$option_key . '-markup'] = array('#type' => 'markup', '#markup' => '<h3>' . $option['title'] . '</h3>');
$form[$option_key . '-display-value-1'] = array('#type' => 'textfield', '#title' => '<td style="text-align:right;">' . __('Not selected:', 'wpcf') . '</td><td>', '#name' => 'options[' . $option_key . '][display_value_not_selected]', '#value' => $option['display_value_not_selected'], '#inline' => true, '#before' => '<table><tr>', '#after' => '</td></tr>');
$form[$option_key . '-display-value-2'] = array('#type' => 'textfield', '#title' => '<td style="text-align:right;">' . __('Selected:', 'wpcf') . '</td><td>', '#name' => 'options[' . $option_key . '][display_value_selected]', '#value' => $option['display_value_selected'], '#after' => '</tr></table>');
}
}
}
$form['submit'] = array('#type' => 'submit', '#name' => 'submit', '#value' => __('Save Changes'), '#attributes' => array('class' => 'button-primary'));
$f = wpcf_form('wpcf-form', $form);
wpcf_admin_ajax_head('Insert checkbox', 'wpcf');
echo '<form method="post" action="">';
echo $f->renderForm();
echo '</form>';
wpcf_admin_ajax_footer();
}
开发者ID:dewavi,项目名称:occupysandy.net,代码行数:26,代码来源:checkboxes.php
示例9: wpcf_fields_file_editor_callback
/**
* Editor callback form.
*/
function wpcf_fields_file_editor_callback()
{
wp_enqueue_style('wpcf-fields-file', WPCF_EMBEDDED_RES_RELPATH . '/css/basic.css', array(), WPCF_VERSION);
// Get field
$field = wpcf_admin_fields_get_field($_GET['field_id']);
if (empty($field)) {
_e('Wrong field specified', 'wpcf');
die;
}
// Get post_ID
$post_ID = false;
if (isset($_POST['post_id'])) {
$post_ID = intval($_POST['post_id']);
} else {
$http_referer = explode('?', $_SERVER['HTTP_REFERER']);
parse_str($http_referer[1], $http_referer);
if (isset($http_referer['post'])) {
$post_ID = $http_referer['post'];
}
}
// Get attachment
$attachment_id = false;
if ($post_ID) {
$file = get_post_meta($post_ID, wpcf_types_get_meta_prefix($field) . $field['slug'], true);
if (!empty($file)) {
// Get attachment by guid
global $wpdb;
$attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts}\r\n WHERE post_type = 'attachment' AND guid=%s", $file));
}
}
$last_settings = wpcf_admin_fields_get_field_last_settings($_GET['field_id']);
$form = array();
$form['#form']['callback'] = 'wpcf_fields_file_editor_submit';
if ($attachment_id) {
$form['preview'] = array('#type' => 'markup', '#markup' => '<div class="message updated" style="margin: 0 0 20px 0"><p>' . $file . '</p></div>');
}
$form['link'] = array('#type' => 'checkbox', '#title' => __('Display as link', 'wpcf'), '#name' => 'link', '#default_value' => isset($last_settings['link']) ? $last_settings['link'] : 1);
$form['title'] = array('#type' => 'textfield', '#title' => __('Link title', 'wpcf'), '#name' => 'title', '#value' => isset($last_settings['title']) ? $last_settings['title'] : '');
$form['class'] = array('#type' => 'textfield', '#title' => __('Class', 'wpcf'), '#name' => 'class', '#value' => isset($last_settings['class']) ? $last_settings['class'] : '');
$form['style'] = array('#type' => 'textfield', '#title' => __('Style', 'wpcf'), '#name' => 'style', '#value' => isset($last_settings['style']) ? $last_settings['style'] : '');
$form['submit'] = array('#type' => 'submit', '#name' => 'submit', '#value' => __('Insert shortcode', 'wpcf'), '#attributes' => array('class' => 'button-primary'));
$f = wpcf_form('wpcf-form', $form);
wpcf_admin_ajax_head('Insert email', 'wpcf');
echo '<form method="post" action="">';
echo $f->renderForm();
echo '</form>';
wpcf_admin_ajax_footer();
}
开发者ID:par-orillonsoft,项目名称:Wishmagnet,代码行数:51,代码来源:file.php
示例10: wpcf_fields_image_editor_callback
//.........这里部分代码省略.........
$post_type = $http_referer['post_type'];
}
}
$image_data = wpcf_fields_image_get_data($image);
if (!in_array($post_type, array('view', 'view-template'))) {
// We must ignore errors here and treat image as outsider
if (!empty($image_data['error'])) {
$image_data['is_outsider'] = 1;
$image_data['is_attachment'] = 0;
}
} else {
if (!empty($image_data['error'])) {
$image_data['is_outsider'] = 0;
$image_data['is_attachment'] = 0;
}
}
$last_settings = wpcf_admin_fields_get_field_last_settings($_GET['field_id']);
$form = array();
$form['#form']['callback'] = 'wpcf_fields_image_editor_submit';
if ($attachment_id) {
$form['preview'] = array('#type' => 'markup', '#markup' => '<div style="position:absolute; margin-left:300px;">' . wp_get_attachment_image($attachment_id, 'thumbnail') . '</div>');
}
$alt = '';
$title = '';
if ($attachment_id) {
$alt = trim(strip_tags(get_post_meta($attachment_id, '_wp_attachment_image_alt', true)));
$attachment_post = get_post($attachment_id);
if (!empty($attachment_post)) {
$title = trim(strip_tags($attachment_post->post_title));
} else {
if (!empty($alt)) {
$title = $alt;
}
}
if (empty($alt)) {
$alt = $title;
}
}
$form['title'] = array('#type' => 'textfield', '#title' => __('Image title', 'wpcf'), '#description' => __('Title text for the image, e.g. “The Mona Lisa”', 'wpcf'), '#name' => 'title', '#value' => isset($last_settings['title']) ? $last_settings['title'] : $title);
$form['alt'] = array('#type' => 'textfield', '#title' => __('Alternate Text', 'wpcf'), '#description' => __('Alt text for the image, e.g. “The Mona Lisa”', 'wpcf'), '#name' => 'alt', '#value' => isset($last_settings['alt']) ? $last_settings['alt'] : $alt);
$form['alignment'] = array('#type' => 'radios', '#title' => __('Alignment', 'wpcf'), '#name' => 'alignment', '#default_value' => isset($last_settings['alignment']) ? $last_settings['alignment'] : 'none', '#options' => array(__('None', 'wpcf') => 'none', __('Left', 'wpcf') => 'left', __('Center', 'wpcf') => 'center', __('Right', 'wpcf') => 'right'));
if (!in_array($post_type, array('view', 'view-template'))) {
$attributes_outsider = $image_data['is_outsider'] ? array('disabled' => 'disabled') : array();
$attributes_attachment = !$image_data['is_attachment'] ? array('disabled' => 'disabled') : array();
} else {
$attributes_outsider = array();
$attributes_attachment = array();
}
if (!in_array($post_type, array('view', 'view-template')) && $image_data['is_outsider']) {
$form['notice'] = array('#type' => 'markup', '#markup' => '<div class="message error" style="margin:0 0 20px 0;"><p>' . __('Types can only resize images that you upload to this site and not images from other domains.', 'wpcf') . '</p></div>');
} else {
if ($image_data['is_outsider']) {
$form['notice'] = array('#type' => 'markup', '#markup' => '<div class="message error" style="margin:0 0 20px 0;"><p>' . __('Types will be able to resize images that are uploaded to the post. If you specify URLs of images on other sites, Types will not resize them.', 'wpcf') . '</p></div>');
}
}
if ($image_data['is_attachment']) {
$default_value = isset($last_settings['image-size']) ? $last_settings['image-size'] : 'thumbnail';
} else {
if (!$image_data['is_outsider']) {
$default_value = 'wpcf-custom';
} else {
$default_value = 'thumbnail';
}
}
$form['size'] = array('#type' => 'radios', '#title' => __('Pre-defined sizes', 'wpcf'), '#name' => 'image-size', '#default_value' => $default_value, '#options' => array('thumbnail' => array('#title' => __('Thumbnail', 'wpcf'), '#value' => 'thumbnail', '#attributes' => $attributes_attachment), 'medium' => array('#title' => __('Medium', 'wpcf'), '#value' => 'medium', '#attributes' => $attributes_attachment), 'large' => array('#title' => __('Large', 'wpcf'), '#value' => 'large', '#attributes' => $attributes_attachment), 'full' => array('#title' => __('Full Size', 'wpcf'), '#value' => 'full', '#attributes' => $attributes_attachment), 'wpcf-custom' => array('#title' => __('Custom size', 'wpcf'), '#value' => 'wpcf-custom', '#attributes' => $attributes_outsider)));
$form['toggle-open'] = array('#type' => 'markup', '#markup' => '<div id="wpcf-toggle" style="display:none;">');
$form['width'] = array('#type' => 'textfield', '#title' => __('Width', 'wpcf'), '#description' => __('Specify custom width', 'wpcf'), '#name' => 'width', '#value' => isset($last_settings['width']) ? $last_settings['width'] : '', '#suffix' => ' px', '#attributes' => $attributes_outsider);
$form['height'] = array('#type' => 'textfield', '#title' => __('Height', 'wpcf'), '#description' => __('Specify custom height', 'wpcf'), '#name' => 'height', '#value' => isset($last_settings['height']) ? $last_settings['height'] : '', '#suffix' => ' px', '#attributes' => $attributes_outsider);
$form['proportional'] = array('#type' => 'checkbox', '#title' => __('Keep proportional', 'wpcf'), '#name' => 'proportional', '#default_value' => 1, '#attributes' => $attributes_outsider);
$form['toggle-close'] = array('#type' => 'markup', '#markup' => '</div>', '#attributes' => $attributes_outsider);
if ($post_ID) {
$form['post_id'] = array('#type' => 'hidden', '#name' => 'post_id', '#value' => $post_ID);
}
$form['submit'] = array('#type' => 'submit', '#name' => 'submit', '#value' => __('Insert shortcode', 'wpcf'), '#attributes' => array('class' => 'button-primary'));
$f = wpcf_form('wpcf-form', $form);
wpcf_admin_ajax_head('Insert email', 'wpcf');
echo '<form method="post" action="">';
echo $f->renderForm();
echo '</form>';
?>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function(){
jQuery('input:radio[name="image-size"]').change(function(){
if (jQuery(this).val() == 'wpcf-custom') {
jQuery('#wpcf-toggle').slideDown();
} else {
jQuery('#wpcf-toggle').slideUp();
}
});
if (jQuery('input:radio[name="image-size"]:checked').val() == 'wpcf-custom') {
jQuery('#wpcf-toggle').show();
}
});
//]]>
</script>
<?php
wpcf_admin_ajax_footer();
}
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:101,代码来源:image.php
示例11: wpcf_fields_date_editor_callback
/**
* TinyMCE editor form.
*/
function wpcf_fields_date_editor_callback()
{
$last_settings = wpcf_admin_fields_get_field_last_settings($_GET['field_id']);
wp_enqueue_script('jquery');
$form = array();
$form['#form']['callback'] = 'wpcf_fields_date_editor_form_submit';
$form['style'] = array('#type' => 'radios', '#name' => 'wpcf[style]', '#options' => array(__('Show as calendar', 'wpcf') => 'calendar', __('Show as text', 'wpcf') => 'text'), '#default_value' => isset($last_settings['style']) ? $last_settings['style'] : 'text', '#after' => '<br />');
$date_formats = apply_filters('date_formats', array(__('F j, Y'), 'Y/m/d', 'm/d/Y', 'd/m/Y'));
$options = array();
foreach ($date_formats as $format) {
$title = date($format, time());
$field['#title'] = $title;
$field['#value'] = $format;
$options[] = $field;
}
$custom_format = isset($last_settings['format-custom']) ? $last_settings['format-custom'] : get_option('date_format');
$options[] = array('#title' => __('Custom', 'wpcf'), '#value' => 'custom', '#suffix' => wpcf_form_simple(array('custom' => array('#name' => 'wpcf[format-custom]', '#type' => 'textfield', '#value' => $custom_format, '#suffix' => ' ' . date($custom_format, time()), '#inline' => true))));
$form['toggle-open'] = array('#type' => 'markup', '#markup' => '<div id="wpcf-toggle" style="display:none;">');
$form['format'] = array('#type' => 'radios', '#name' => 'wpcf[format]', '#options' => $options, '#default_value' => isset($last_settings['format']) ? $last_settings['format'] : get_option('date_format'), '#after' => '<a href="http://codex.wordpress.org/Formatting_Date_and_Time" target="_blank">' . __('Documentation on date and time formatting', 'wpcf') . '</a>');
$form['toggle-close'] = array('#type' => 'markup', '#markup' => '</div>');
$form['field_id'] = array('#type' => 'hidden', '#name' => 'wpcf[field_id]', '#value' => $_GET['field_id']);
$form['submit'] = array('#type' => 'submit', '#name' => 'submit', '#value' => __('Insert date', 'wpcf'), '#attributes' => array('class' => 'button-primary'));
$f = wpcf_form('wpcf-fields-date-editor', $form);
add_action('admin_head_wpcf_ajax', 'wpcf_fields_date_editor_form_script');
wpcf_admin_ajax_head(__('Insert date', 'wpcf'));
echo '<form id="wpcf-form" method="post" action="">';
echo $f->renderForm();
echo '</form>';
wpcf_admin_ajax_footer();
}
开发者ID:par-orillonsoft,项目名称:Wishmagnet,代码行数:33,代码来源:date.php
示例12: wpcf_pr_admin_edit_fields
/**
* Edit fields form.
*
* @global type $wpdb
* @param type $parent
* @param type $child
*/
function wpcf_pr_admin_edit_fields($parent, $child)
{
global $wpdb;
$post_type_parent = get_post_type_object($parent);
$post_type_child = get_post_type_object($child);
if (empty($post_type_parent) || empty($post_type_child)) {
die(__('Wrong post types'));
}
$relationships = get_option('wpcf_post_relationship', array());
if (!isset($relationships[$parent][$child])) {
die(__('Relationship do not exist'));
}
$data = $relationships[$parent][$child];
wp_enqueue_script('jquery');
wpcf_admin_ajax_head('Edit fields', 'wpcf');
// Process submit
if (isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'pt_edit_fields')) {
$relationships[$parent][$child]['fields_setting'] = $_POST['fields_setting'];
$relationships[$parent][$child]['fields'] = isset($_POST['fields']) ? $_POST['fields'] : array();
update_option('wpcf_post_relationship', $relationships);
?>
<script type="text/javascript">
window.parent.jQuery('#TB_closeWindowButton').trigger('click');
window.parent.location.reload();
</script>
<?php
die;
}
$groups = wpcf_admin_get_groups_by_post_type($child);
$options_cf = array();
$repetitive_warning = false;
$repetitive_warning_markup = array();
$repetitive_warning_txt = __('Repeating fields should not be used in child posts. Types will update all field values.', 'wpcf');
foreach ($groups as $group) {
$fields = wpcf_admin_fields_get_fields_by_group($group['id']);
foreach ($fields as $key => $cf) {
$options_cf[WPCF_META_PREFIX . $key] = array();
$options_cf[WPCF_META_PREFIX . $key]['#title'] = $cf['name'];
$options_cf[WPCF_META_PREFIX . $key]['#name'] = 'fields[' . WPCF_META_PREFIX . $key . ']';
$options_cf[WPCF_META_PREFIX . $key]['#default_value'] = isset($data['fields'][WPCF_META_PREFIX . $key]) ? 1 : 0;
// Repetitive warning
if (wpcf_admin_is_repetitive($cf)) {
if (!$repetitive_warning) {
$repetitive_warning_markup = array('#type' => 'markup', '#markup' => '<div class="message error" style="display:none;" id="wpcf-repetitive-warning"><p>' . $repetitive_warning_txt . '</p></div>');
}
$repetitive_warning = true;
$options_cf[WPCF_META_PREFIX . $key]['#after'] = !isset($data['fields'][WPCF_META_PREFIX . $key]) ? '<div class="message error" style="display:none;"><p>' : '<div class="message error"><p>';
$options_cf[WPCF_META_PREFIX . $key]['#after'] .= $repetitive_warning_txt;
$options_cf[WPCF_META_PREFIX . $key]['#after'] .= '</p></div>';
$options_cf[WPCF_META_PREFIX . $key]['#attributes'] = array('onclick' => 'jQuery(this).parent().find(\'.message\').toggle();');
}
}
}
$form = array();
$form['repetitive_warning_markup'] = $repetitive_warning_markup;
$form['select'] = array('#type' => 'radios', '#name' => 'fields_setting', '#options' => array(__('Title, all custom fields and parents', 'wpcf') => 'all_cf', __('All fields, including the standard post fields', 'wpcf') => 'all_cf_standard', __('Specific fields', 'wpcf') => 'specific'), '#default_value' => empty($data['fields_setting']) ? 'all_cf' : $data['fields_setting']);
$options = array();
$options['_wp_title'] = array('#title' => __('Post title', 'wpcf'), '#name' => 'fields[_wp_title]', '#default_value' => isset($data['fields']['_wp_title']) ? 1 : 0);
$options['_wp_body'] = array('#title' => __('Post body', 'wpcf'), '#name' => 'fields[_wp_body]', '#default_value' => isset($data['fields']['_wp_body']) ? 1 : 0);
$options = $options + $options_cf;
$temp_belongs = wpcf_pr_admin_get_belongs($child);
foreach ($temp_belongs as $temp_parent => $temp_data) {
if ($temp_parent == $parent) {
continue;
}
$temp_parent_type = get_post_type_object($temp_parent);
$options[$temp_parent] = array();
$options[$temp_parent]['#title'] = $temp_parent_type->label;
$options[$temp_parent]['#name'] = 'fields[_wpcf_pr_parents][' . $temp_parent . ']';
$options[$temp_parent]['#default_value'] = isset($data['fields']['_wpcf_pr_parents'][$temp_parent]) ? 1 : 0;
}
$form['specific'] = array('#type' => 'checkboxes', '#name' => 'fields', '#options' => $options, '#default_value' => isset($data['fields']), '#before' => '<div id="wpcf-specific" style="display:none;margin:10px 0 0 20px;">', '#after' => '</div>');
$form['submit'] = array('#type' => 'submit', '#name' => 'submit', '#value' => __('Save', 'wpcf'), '#attributes' => array('class' => 'button-primary'));
echo '<form method="post" action="">';
echo wpcf_form_simple($form);
echo wp_nonce_field('pt_edit_fields');
echo '</form>';
?>
<script type="text/javascript">
jQuery(document).ready(function(){
if (jQuery('input[name="fields_setting"]:checked').val() == 'specific') {
jQuery('#wpcf-specific').show();
} else {
<?php
if ($repetitive_warning) {
?>
jQuery('#wpcf-repetitive-warning').show();
<?php
}
?>
}
jQuery('input[name="fields_setting"]').change(function(){
if (jQuery(this).val() == 'specific') {
//.........这里部分代码省略.........
开发者ID:adisonc,项目名称:MaineLearning,代码行数:101,代码来源:post-relationship.php
示例13: wpcf_fields_skype_meta_box_ajax
/**
* Edit Skype button AJAX call.
*/
function wpcf_fields_skype_meta_box_ajax()
{
if (isset($_POST['_wpnonce_wpcf_form']) && wp_verify_nonce($_POST['_wpnonce_wpcf_form'], 'wpcf-form')) {
add_action('admin_head_wpcf_ajax', 'wpcf_fields_skype_meta_box_submit');
}
wp_enqueue_script('jquery');
wpcf_admin_ajax_head(__('Insert skype button', 'wpcf'));
?>
<form method="post" action="">
<h2><?php
_e('Enter your Skype Name', 'wpcf');
?>
</h2>
<p>
<input id="btn-skypename" name="skypename" value="<?php
esc_attr_e($_GET['skypename']);
?>
" type="text" />
</p>
<?php
echo WPCF_Loader::template('skype-select-button', $_GET);
?>
<?php
wp_nonce_field('wpcf-form', '_wpnonce_wpcf_form');
?>
<br /><br />
<input type="submit" class="button-primary" value="<?php
_e('Insert skype button', 'wpcf');
?>
" />
</form>
<?php
$update = esc_attr($_GET['update']);
?>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function(){
jQuery('#btn-skypename').val(window.parent.jQuery('#<?php
echo $update;
?>
-skypename').val());
});
//]]>
</script>
<?php
wpcf_admin_ajax_footer();
}
开发者ID:SpencerNeitzke,项目名称:types,代码行数:50,代码来源:skype.php
示例14: wpcf_pr_admin_edit_fields
/**
* Edit fields form.
*
* @param type $parent
* @param type $child
*/
function wpcf_pr_admin_edit_fields($parent, $child)
{
$post_type_parent = get_post_type_object($parent);
$post_type_child = get_post_type_object($child);
if (empty($post_type_parent) || empty($post_type_child)) {
die(__('Wrong post types', 'wpcf'));
}
$relationships = get_option('wpcf_post_relationship', array());
if (!isset($relationships[$parent][$child])) {
die(__('Relationship do not exist', 'wpcf'));
}
$data = $relationships[$parent][$child];
wp_enqueue_script('jquery');
wp_enqueue_style('types');
wpcf_admin_ajax_head('Edit fields', 'wpcf');
// Process submit
if (isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'pt_edit_fields')) {
$relationships[$parent][$child]['fields_setting'] = sanitize_text_field($_POST['fields_setting']);
// @todo Maybe sanitization here
$relationships[$parent][$child]['fields'] = isset($_POST['fields']) ? $_POST['fields'] : array();
update_option('wpcf_post_relationship', $relationships);
?>
<script type="text/javascript">
window.parent.jQuery('#TB_closeWindowButton').trigger('click');
window.parent.location.reload();
</script>
<?php
die;
}
$groups = wpcf_admin_get_groups_by_post_type($child);
$options_cf = array();
$repetitive_warning = false;
$repetitive_warning_markup = array();
$repetitive_warning_txt = __('Repeating fields should not be used in child posts. Types will update all field values.', 'wpcf');
foreach ($groups as $group) {
$fields = wpcf_admin_fields_get_fields_by_group($group['id']);
foreach ($fields as $key => $cf) {
$__key = wpcf_types_cf_under_control('check_outsider', $key) ? $key : WPCF_META_PREFIX . $key;
$options_cf[$__key] = array();
$options_cf[$__key]['#title'] = $cf['name'];
$options_cf[$__key]['#name'] = 'fields[' . $__key . ']';
$options_cf[$__key]['#default_value'] = isset($data['fields'][$__key]) ? 1 : 0;
// Repetitive warning
if (wpcf_admin_is_repetitive($cf)) {
if (!$repetitive_warning) {
$repetitive_warning_markup = array('#type' => 'markup', '#markup' => '<div class="message error" style="display:none;" id="wpcf-repetitive-warning"><p>' . $repetitive_warning_txt . '</p></div>');
}
$repetitive_warning = true;
$options_cf[$__key]['#after'] = !isset($data['fields'][$__key]) ? '<div class="message error" style="display:none;"><p>' : '<div class="message error"><p>';
$options_cf[$__key]['#after'] .= $repetitive_warning_txt;
$options_cf[$__key]['#after'] .= '</p></div>';
$options_cf[$__key]['#attributes'] = array('onclick' => 'jQuery(this).parent().find(\'.message\').toggle();', 'disabled' => 'disabled');
}
}
}
$form = array();
$form['repetitive_warning_markup'] = $repetitive_warning_markup;
$form['select'] = array('#type' => 'radios', '#name' => 'fields_setting', '#options' => array(__('Title, all custom fields and parents', 'wpcf') => 'all_cf', __('Do not show management options for this post type', 'wpcf') => 'only_list', __('All fields, including the standard post fields', 'wpcf') => 'all_cf_standard', __('Specific fields', 'wpcf') => 'specific'), '#default_value' => empty($data['fields_setting']) ? 'all_cf' : $data['fields_setting']);
/**
* check default, to avoid missing configuration
*/
if (!in_array($form['select']['#default_value'], $form['select']['#options'])) {
$form['select']['#default_value'] = 'all_cf';
}
/**
* build options for "Specific fields"
*/
$options = array();
/**
* check and add build-in properites
*/
$check_support = array('title' => array('name' => '_wp_title', 'title' => __('Post title', 'wpcf')), 'editor' => array('name' => '_wp_body', 'title' => __('Post body', 'wpcf')), 'excerpt' => array('name' => '_wp_excerpt', 'title' => __('Post excerpt', 'wpcf')), 'thumbnail' => array('name' => '_wp_featured_image', 'title' => __('Post featured image', 'wpcf')));
foreach ($check_support as $child_field_key => $child_field_data) {
if (!post_type_supports($child, $child_field_key)) {
continue;
}
$options[$child_field_data['name']] = array('#title' => $child_field_data['title'], '#name' => sprintf('fields[%s]', $child_field_data['name']), '#default_value' => isset($data['fields'][$child_field_data['name']]) ? 1 : 0);
}
/**
* add custom fields
*/
$options = $options + $options_cf;
$temp_belongs = wpcf_pr_admin_get_belongs($child);
foreach ($temp_belongs as $temp_parent => $temp_data) {
if ($temp_parent == $parent) {
continue;
}
$temp_parent_type = get_post_type_object($temp_parent);
$options[$temp_parent] = array();
$options[$temp_parent]['#title'] = $temp_parent_type->label;
$options[$temp_parent]['#name'] = 'fields[_wpcf_pr_parents][' . $temp_parent . ']';
$options[$temp_parent]['#default_value'] = isset($data['fields']['_wpcf_pr_parents'][$temp_parent]) ? 1 : 0;
}
/**
//.........这里部分代码省略.........
开发者ID:aarongillett,项目名称:B22-151217,代码行数:101,代码来源:post-relationship.php
示例15: wpcf_fields_skype_meta_box_ajax
/**
* Edit Skype button AJAX call.
*/
function wpcf_fields_skype_meta_box_ajax()
{
if (isset($_POST['_wpnonce_wpcf_form']) && wp_verify_nonce($_POST['_wpnonce_wpcf_form'], 'wpcf-form')) {
add_action('admin_head_wpcf_ajax', 'wpcf_fields_skype_meta_box_submit');
}
wp_enqueue_script('jquery');
wpcf_admin_ajax_head(__('Insert skype button', 'wpcf'));
?>
<form method="post" action="">
<div id="paddedContent">
<div id="step1">
<h2><?php
_e('Enter your Skype Name', 'wpcf');
?>
</h2>
<p>
<input id="btn-skypename" name="skypename" value="<?php
echo $_GET['skypename'];
?>
" type="text" />
</p>
</div>
<div id="step2">
<h2><?php
_e('Select a button from below', 'wpcf');
?>
</h2>
<div id="static-buttons">
<table border="0" cellpadding="0" cellspacing="0" width="445">
<colgroup><col span="1" width="223">
<col span="1" width="222">
</colgroup><tbody><tr>
<td colspan="1" rowspan="1">
<label for="btn1">
<input <?php
if ($_GET['style'] == 'btn1') {
echo 'checked="checked" ';
}
?>
id="btn1" name="buttonstyle" tabindex="2" value="btn1" type="radio" />
<img alt="" id="btn1-img" src="http://www.skypeassets.com/i/legacy/images/share/buttons/call_green_white_153x63.png" height="63" width="153" />
</label>
</td>
|
请发表评论