当前位置: 首页>>代码示例>>PHP>>正文


PHP wpcf_form函数代码示例

本文整理汇总了PHP中wpcf_form函数的典型用法代码示例。如果您正苦于以下问题:PHP wpcf_form函数的具体用法?PHP wpcf_form怎么用?PHP wpcf_form使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wpcf_form函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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_admin_menu_edit_user_fields

/**
 * Add/Edit usermeta fields group
 *
 * @author Gen gen.i@icanlocalize.com
 * @since Types 1.3
 */
function wpcf_admin_menu_edit_user_fields()
{
    if (isset($_GET['group_id'])) {
        $title = __('Edit Usermeta Group', 'wpcf');
    } else {
        $title = __('Add New Usermeta Group', 'wpcf');
    }
    wpcf_add_admin_header($title);
    $form = wpcf_form('wpcf_form_fields');
    echo '<br /><form method="post" action="" class="wpcf-fields-form ' . 'wpcf-form-validate" onsubmit="';
    echo 'if (jQuery(\'#wpcf-group-name\').val() == \'' . __('Enter group title', 'wpcf') . '\') { jQuery(\'#wpcf-group-name\').val(\'\'); }';
    echo 'if (jQuery(\'#wpcf-group-description\').val() == \'' . __('Enter a description for this group', 'wpcf') . '\') { jQuery(\'#wpcf-group-description\').val(\'\'); }';
    echo 'jQuery(\'.wpcf-forms-set-legend\').each(function(){
        if (jQuery(this).val() == \'' . __('Enter field name', 'wpcf') . '\') {
            jQuery(this).val(\'\');
        }
        if (jQuery(this).next().val() == \'' . __('Enter field slug', 'wpcf') . '\') {
            jQuery(this).next().val(\'\');
        }
        if (jQuery(this).next().next().val() == \'' . __('Describe this field', 'wpcf') . '\') {
            jQuery(this).next().next().val(\'\');
        }
	});';
    echo '">';
    echo $form->renderForm();
    echo '</form>';
    wpcf_add_admin_footer();
}
开发者ID:KryvunRoman,项目名称:yobko,代码行数:34,代码来源:usermeta-init.php

示例4: 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

示例5: wpcf_admin_fields_list_metabox_to_custom_fields_control

/**
 * Show link to Control Custom Field
 *
 * @since 1.8.0
 *
 */
function wpcf_admin_fields_list_metabox_to_custom_fields_control()
{
    $form['table-1-open'] = array('#type' => 'markup', '#markup' => '<table class="wpcf-types-form-table widefat js-wpcf-slugize-container"><thead><tr><th>' . __('Post Field Control', 'wpcf') . '</th></tr></thead><tbody>', '_builtin' => true);
    $form['table-row-1-open'] = array('#type' => 'markup', '#markup' => '<tr><td>', '_builtin' => true);
    $form['table-row-1-content-1'] = array('#type' => 'markup', '#markup' => '<p>' . __('You can control Post Fields by removing them from the groups, changing type or just deleting.', 'wpcf'), '_builtin' => true);
    $form['table-row-1-content-2'] = array('#type' => 'markup', '#markup' => sprintf(' <a class="button" href="%s">%s</a></p>', Types_Page_Field_Control::get_page_url(Types_Field_Utils::DOMAIN_POSTS), __('Post Field Control', 'wpcf')), '_builtin' => true);
    $form['table-row-1-close'] = array('#type' => 'markup', '#markup' => '</td></tr>', '_builtin' => true);
    $form['table-1-close'] = array('#type' => 'markup', '#markup' => '</tbody></table>', '_builtin' => true);
    $form = wpcf_form(__FUNCTION__, $form);
    echo $form->renderForm();
}
开发者ID:axeljohansson1988,项目名称:oddcv,代码行数:17,代码来源:fields-list.php

示例6: show_term_field_control_box

 /**
  * Show box with a link to Term Field Control page.
  */
 function show_term_field_control_box()
 {
     $form = array();
     $form['table-1-open'] = array('#type' => 'markup', '#markup' => '<table class="wpcf-types-form-table widefat js-wpcf-slugize-container"><thead><tr><th>' . __('Term Field Control', 'wpcf') . '</th></tr></thead><tbody>', '_builtin' => true);
     $form['table-row-1-open'] = array('#type' => 'markup', '#markup' => '<tr><td>', '_builtin' => true);
     $form['table-row-1-content-1'] = array('#type' => 'markup', '#markup' => '<p>' . __('You can control Term Fields by removing them from the groups, changing type or just deleting.', 'wpcf'), '_builtin' => true);
     $form['table-row-1-content-2'] = array('#type' => 'markup', '#markup' => sprintf(' <a class="button" href="%s">%s</a></p>', Types_Page_Field_Control::get_page_url(Types_Field_Utils::DOMAIN_TERMS), __('Term Field Control', 'wpcf')), '_builtin' => true);
     $form['table-row-1-close'] = array('#type' => 'markup', '#markup' => '</td></tr>', '_builtin' => true);
     $form['table-1-close'] = array('#type' => 'markup', '#markup' => '</tbody></table>', '_builtin' => true);
     $form = wpcf_form(self::PAGE_NAME . '-field-control-box', $form);
     echo $form->renderForm();
 }
开发者ID:axeljohansson1988,项目名称:oddcv,代码行数:15,代码来源:termmeta.php

示例7: 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

示例8: 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

示例9: 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

示例10: 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' => '&nbsp;' . 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

示例11: page_handler

 public function page_handler()
 {
     // Following code taken from the legacy parts. Needs refactoring.
     // By now we expect that prepare_form_maybe_redirect() was already called. If not, something went terribly wrong.
     if (null == $this->wpcf_admin) {
         return;
     }
     // Well this doesn't look right.
     $post_type = current_filter();
     // Start rendering the page.
     // Header and title
     $page_purpose = $this->wpcf_admin->get_page_purpose();
     $add_new_button = 'edit' == $page_purpose ? array('page' => self::PAGE_NAME) : false;
     wpcf_add_admin_header($this->get_page_title($page_purpose), $add_new_button);
     // Display WPML admin notices if there are any.
     wpcf_wpml_warning();
     // Transform the form data into an Enlimbo form
     $form = wpcf_form(self::FORM_NAME, $this->form);
     // Dark magic happens here.
     echo '<form method="post" action="" class="wpcf-fields-form wpcf-form-validate js-types-show-modal">';
     wpcf_admin_screen($post_type, $form->renderForm());
     echo '</form>';
     wpcf_add_admin_footer();
 }
开发者ID:lytranuit,项目名称:wordpress,代码行数:24,代码来源:termmeta.php

示例12: wpcf_admin_menu_migration

/**
 * Menu page display.
 */
function wpcf_admin_menu_migration()
{
    echo wpcf_add_admin_header(__('Migration', 'wpcf'));
    echo '<br /><form method="post" action="" id="wpcf-migration-form" class="wpcf-migration-form ' . 'wpcf-form-validate" enctype="multipart/form-data">';
    $form = wpcf_form('wpcf_form_migration');
    echo $form->renderForm();
    echo '</form>';
    echo wpcf_add_admin_footer();
}
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:12,代码来源:admin.php

示例13: add_usermeta_to_groups

 /**
  * Summary.
  *
  * Description.
  *
  * @since x.x.x
  * @access (for functions: only use if private)
  *
  * @see Function/method/class relied on
  * @link URL
  * @global type $varname Description.
  * @global type $varname Description.
  *
  * @param type $var Description.
  * @param type $var Optional. Description.
  * @return type Description.
  */
 public function add_usermeta_to_groups()
 {
     /**
      * check nonce
      */
     if (0 || !isset($_REQUEST['_wpnonce']) || !wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_control')) {
         $this->verification_failed_and_die();
     }
     $form = $this->get_group_list(array(), 'wpcf-usermeta');
     $form = wpcf_form(__FUNCTION__, $form);
     echo $form->renderForm();
     die;
 }
开发者ID:lytranuit,项目名称:wordpress,代码行数:30,代码来源:class.types.admin.control.fields.php

示例14: wpcf_admin_menu_settings

/**
 * Menu page display.
 */
function wpcf_admin_menu_settings()
{
    ob_start();
    wpcf_add_admin_header(__('Settings', 'wpcf'));
    ?>
<form method="post" action="" id="wpcf-general-settings-form" class="wpcf-settings-form wpcf-form-validate">
<?php 
    $form = wpcf_form('wpcf_form_general_settings');
    echo $form->renderForm();
    ?>
    </form>
<?php 
    wpcf_add_admin_footer();
    echo ob_get_clean();
}
开发者ID:torch2424,项目名称:Team-No-Comply-Games-Wordpress,代码行数:18,代码来源:admin.php

示例15: box_taxonomy_type

 /**
  * Summary.
  *
  * Description.
  *
  * @since x.x.x
  * @access (for functions: only use if private)
  *
  * @see Function/method/class relied on
  * @link URL
  * @global type $varname Description.
  * @global type $varname Description.
  *
  * @param type $var Description.
  * @param type $var Optional. Description.
  * @return type Description.
  */
 public function box_taxonomy_type()
 {
     $form = array();
     $form['make-hierarchical'] = array('#type' => 'radios', '#name' => 'ct[hierarchical]', '#default_value' => empty($this->ct['hierarchical']) || $this->ct['hierarchical'] == 'hierarchical' ? 'hierarchical' : 'flat', '#inline' => true, '#options' => array(sprintf('<b>%s</b> - %s', __('Hierarchical', 'wpcf'), __('like post categories, with parent / children relationship and checkboxes to select taxonomy', 'wpcf')) => 'hierarchical', sprintf('<b>%s</b> - %s', __('Flat', 'wpcf'), __('like post tags, with a text input to enter terms', 'wpcf')) => 'flat'));
     $form = wpcf_form(__FUNCTION__, $form);
     echo $form->renderForm();
 }
开发者ID:phuocdungit,项目名称:fundy,代码行数:24,代码来源:class.types.admin.edit.taxonomy.php


注:本文中的wpcf_form函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。