本文整理汇总了PHP中wpcf_admin_ajax_footer函数的典型用法代码示例。如果您正苦于以下问题:PHP wpcf_admin_ajax_footer函数的具体用法?PHP wpcf_admin_ajax_footer怎么用?PHP wpcf_admin_ajax_footer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpcf_admin_ajax_footer函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: 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
示例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_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
示例7: wpcf_pr_admin_edit_fields
//.........这里部分代码省略.........
}
}
$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;
}
/**
* remove "Specific fields" if there is no fields
*/
if (empty($options)) {
unset($form['select']['#options'][__('Specific fields', 'wpcf')]);
if ('specific' == $form['select']['#default_value']) {
$form['select']['#default_value'] = 'all_cf';
}
}
// Taxonomies
$taxonomies = get_object_taxonomies($post_type_child->name, 'objects');
if (!empty($taxonomies)) {
foreach ($taxonomies as $tax_id => $taxonomy) {
$options[$tax_id] = array();
$options[$tax_id]['#title'] = sprintf(__('Taxonomy - %s', 'wpcf'), $taxonomy->label);
$options[$tax_id]['#name'] = 'fields[_wpcf_pr_taxonomies][' . $tax_id . ']';
$options[$tax_id]['#default_value'] = isset($data['fields']['_wpcf_pr_taxonomies'][$tax_id]) ? 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="" class="types-select-child-fields">';
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 && 'only_list' != $form['select']['#default_value']) {
?>
jQuery('#wpcf-repetitive-warning').show();
<?php
}
?>
}
jQuery('input[name="fields_setting"]').change(function(){
if (jQuery(this).val() == 'specific') {
jQuery('#wpcf-specific').slideDown();
} else {
jQuery('#wpcf-specific').slideUp();
<?php
if ($repetitive_warning) {
?>
if ( 'only_list' != jQuery('input[name="fields_setting"]:checked').val()) {
jQuery('#wpcf-repetitive-warning').show();
}
<?php
}
?>
}
});
});
</script>
<?php
wpcf_admin_ajax_footer();
}
开发者ID:aarongillett,项目名称:B22-151217,代码行数:101,代码来源:post-relationship.php
示例8: wpcf_fields_skype_meta_box_ajax
//.........这里部分代码省略.........
?>
id="btn2" name="buttonstyle" tabindex="3" value="btn2" type="radio" />
<img alt="" id="btn2-img" src="http://www.skypeassets.com/i/legacy/images/share/buttons/call_blue_white_124x52.png" height="52" width="125" />
</label>
</td>
</tr>
<tr>
<td colspan="1" rowspan="1">
<label for="btn3">
<input <?php
if ($_GET['style'] == 'btn3') {
echo 'checked="checked" ';
}
?>
id="btn3" name="buttonstyle" tabindex="4" value="btn3" type="radio" />
<img alt="" id="btn3-img" src="http://www.skypeassets.com/i/legacy/images/share/buttons/call_green_white_92x82.png" height="82" width="92" />
</label>
</td>
<td colspan="1" rowspan="1">
<label for="btn4">
<input <?php
if ($_GET['style'] == 'btn4') {
echo 'checked="checked" ';
}
?>
id="btn4" name="buttonstyle" tabindex="5" value="btn4" type="radio" />
<img alt="" id="btn4-img" src="http://www.skypeassets.com/i/legacy/images/share/buttons/call_blue_transparent_34x34.png" height="34" width="34" />
</label>
</td>
</tr>
</tbody></table>
</div>
<h2><?php
_e('Skype buttons with status', 'wpcf');
?>
</h2>
<p><?php
_e('If you choose to show your Skype status, your Skype button will always reflect your availability on Skype. This status will be shown to everyone, whether they’re in your contact list or not.', 'wpcf');
?>
</p>
<div id="status-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="btn5">
<input <?php
if ($_GET['style'] == 'btn5') {
echo 'checked="checked" ';
}
?>
id="btn5" name="buttonstyle" tabindex="6" value="btn5" type="radio" />
<img alt="" id="btn5-img" src="http://www.skypeassets.com/i/legacy/images/share/buttons/anim_balloon.gif" height="60" width="150" />
</label>
</td>
<td colspan="1" rowspan="1">
<label for="btn6">
<input <?php
if ($_GET['style'] == 'btn6') {
echo 'checked="checked" ';
}
?>
id="btn6" name="buttonstyle" tabindex="7" value="btn6" type="radio" />
<img alt="" id="btn6-img" src="http://www.skypeassets.com/i/legacy/images/share/buttons/anim_rectangle.gif" height="44" width="182" />
</label>
</td>
</tr>
</tbody></table>
</div>
</div>
<?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:Netsoro,项目名称:gdnlteamgroup,代码行数:101,代码来源:skype.php
示例9: 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
示例10: 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
示例11: 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
示例12: _thickbox_check_submit
/**
* Process if submitted.
*
* Field should provide callback function
* that will be called automatically.
*
* Function should be named like:
* 'wpcf_fields_' . $field_type . '_editor_submit'
* e.g. 'wpcf_fields_checkbox_editor_submit'
*
* Function should return shortcode string.
*/
function _thickbox_check_submit()
{
if (!empty($_POST['__types_editor_nonce']) && wp_verify_nonce($_POST['__types_editor_nonce'], 'types_editor_frame')) {
$function = 'wpcf_fields_' . strtolower($this->field['type']) . '_editor_submit';
if (function_exists($function)) {
/*
* Callback
*/
$shortcode = call_user_func($function, $_POST, $this->field, $this->_meta_type);
} else {
/*
* Generic
*/
if ($this->_meta_type == 'usermeta') {
$add = wpcf_get_usermeta_form_addon_submit();
$shortcode = wpcf_usermeta_get_shortcode($this->field, $add);
} else {
$shortcode = wpcf_fields_get_shortcode($this->field);
}
}
if (!empty($shortcode)) {
/**
* remove <script> tag from all data
* remove not allowed tags from shortcode using wp_kses_post
*/
$shortcode = preg_replace('@</?script[^>]*>@im', '', wp_kses_post($shortcode));
// Add additional parameters if required
$shortcode = $this->_add_parameters_to_shortcode($shortcode, $_POST);
// Insert shortcode
echo '<script type="text/javascript">jQuery(function(){tedFrame.close(\'' . $shortcode . '\', \'' . esc_js($shortcode) . '\');});</script>';
} else {
echo '<div class="message error"><p>' . __('Shortcode generation failed', 'wpcf') . '</p></div>';
}
wpcf_admin_ajax_footer();
die;
}
}
开发者ID:santikrass,项目名称:apache,代码行数:49,代码来源:editor.php
示例13: wpcf_pr_admin_edit_fields
//.........这里部分代码省略.........
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;
}
$form = array();
$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);
// $wpcf_fields = wpcf_admin_fields_get_fields(true);
$groups = wpcf_admin_get_groups_by_post_type($child);
foreach ($groups as $group) {
$fields = wpcf_admin_fields_get_fields_by_group($group['id']);
foreach ($fields as $key => $cf) {
$options[WPCF_META_PREFIX . $key] = array();
$options[WPCF_META_PREFIX . $key]['#title'] = $cf['name'];
$options[WPCF_META_PREFIX . $key]['#name'] = 'fields[' . WPCF_META_PREFIX . $key . ']';
$options[WPCF_META_PREFIX . $key]['#default_value'] = isset($data['fields'][WPCF_META_PREFIX . $key]) ? 1 : 0;
}
}
$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;
}
// foreach ($wpcf_fields as $key => $cf) {
// $options[WPCF_META_PREFIX . $key] = array();
// $options[WPCF_META_PREFIX . $key]['#title'] = $cf['name'];
// $options[WPCF_META_PREFIX . $key]['#name'] = 'fields[' . WPCF_META_PREFIX . $key . ']';
// $options[WPCF_META_PREFIX . $key]['#default_value'] = isset($data['fields'][WPCF_META_PREFIX . $key]) ? 1 : 0;
// }
// $cf_all = $wpdb->get_results("
// SELECT meta_id, meta_key
// FROM $wpdb->postmeta
// GROUP BY meta_key
// HAVING meta_key NOT LIKE '\_%'
// ORDER BY meta_key");
// foreach ($cf_all as $key => $cf) {
// if (isset($options[$cf->meta_key])) {
// continue;
// }
// $options[$key] = array();
// $options[$key]['#title'] = $cf->meta_key;
// $options[$key]['#name'] = 'fields[' . $cf->meta_key . ']';
// $options[$key]['#default_value'] = isset($data['fields'][$cf->meta_key]) ? 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'), '#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();
}
jQuery('input[name="fields_setting"]').change(function(){
if (jQuery(this).val() == 'specific') {
jQuery('#wpcf-specific').slideDown();
} else {
jQuery('#wpcf-specific').slideUp();
}
});
});
</script>
<?php
wpcf_admin_ajax_footer();
}
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:101,代码来源:post-relationship.php
示例14: 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
示例15: wpcf_pr_admin_edit_fields
//.........这里部分代码省略.........
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
|
请发表评论