• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wpcf_form函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: print_notice

 /**
  * 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.
  */
 protected function print_notice($notice, $add_wrap = 'no-wrap', $print = true)
 {
     $form = array();
     if ('add-wpcf-inside' == $add_wrap) {
         $form['wrap-begin'] = array('#type' => 'markup', '#markup' => '<div class="wpcf-inside">');
     }
     $form['alert'] = array('#type' => 'notice', '#markup' => $notice);
     if ('add-wpcf-inside' == $add_wrap) {
         $form['wrap-end'] = array('#type' => 'markup', '#markup' => '</div>');
     }
     $form = wpcf_form(__FUNCTION__, $form);
     if ($print) {
         echo $form->renderForm();
     } else {
         return $form->renderForm();
     }
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:34,代码来源:class.types.admin.page.php


示例17: wpcf_admin_menu_edit_user_fields

/**
 * Add/Edit usermeta fields group
 *
 * @author Gen [email protected]
 * @since Types 1.3
 */
function wpcf_admin_menu_edit_user_fields()
{
    $add_new = false;
    $post_type = current_filter();
    $title = __('View User Field Group', 'wpcf');
    if (isset($_GET['group_id'])) {
        $item = wpcf_admin_get_user_field_group_by_id((int) $_GET['group_id']);
        if (WPCF_Roles::user_can_edit('user-meta-field', $item)) {
            $title = __('Edit User Field Group', 'wpcf');
            $add_new = array('page' => 'wpcf-edit-usermeta');
        }
    } else {
        if (WPCF_Roles::user_can_create('user-meta-field')) {
            $title = __('Add New User Field Group', 'wpcf');
        }
    }
    wpcf_add_admin_header($title, $add_new);
    $form = wpcf_form('wpcf_form_fields');
    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();
    return;
    $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:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:49,代码来源:usermeta-init.php


示例18: ajax_filter_dialog

 public function ajax_filter_dialog()
 {
     /**
      * check nonce
      */
     if (!isset($_REQUEST['id']) || !isset($_REQUEST['_wpnonce']) || !isset($_REQUEST['type']) || !wp_verify_nonce($_REQUEST['_wpnonce'], $_REQUEST['type'])) {
         _e('Verification failed.', 'wpcf');
         die;
     }
     if (isset($_REQUEST['all_fields']) && !is_array($_POST['all_fields'])) {
         parse_str($_REQUEST['all_fields'], $_REQUEST['all_fields']);
     }
     $form = array();
     $tabs = $this->get_tabs_for_filter_dialog();
     // html: open tabs menu
     $html_tabs_menu = '<ul class="wpcf-tabs-menu">';
     // css: class for first menu
     $first_menu_active = ' class="wpcf-tabs-menu-current"';
     // build tabs menu
     foreach ($tabs as $id => $tab) {
         // html: tabs menu list item
         $html_tabs_menu .= '<li' . $first_menu_active . '>';
         $html_tabs_menu .= '<span data-open-tab="#' . $id . '">';
         $html_tabs_menu .= $tab['title'] . '</span></li>';
         // next menu won't be active
         $first_menu_active = '';
     }
     // html: close tabs menu
     $html_tabs_menu .= '</ul>';
     // form: add tabs menu
     $form['tabs-menu'] = array('#type' => 'markup', '#markup' => $html_tabs_menu);
     // form: open tabs
     $form['tabs-open'] = array('#type' => 'markup', '#markup' => '<div class="wpcf-tabs">');
     // build tabs
     foreach ($tabs as $id => $tab) {
         // form: tab open
         $form['tabs-tab-open-' . $id] = array('#type' => 'markup', '#markup' => '<div id="' . $id . '">');
         // form: tab content
         $this->form_add_filter_dialog($id, $form);
         // form: tab close
         $form['tabs-tab-close-' . $id] = array('#type' => 'markup', '#markup' => '</div>');
     }
     // form: open tabs
     $form['tabs-close'] = array('#type' => 'markup', '#markup' => '</div>');
     $form = wpcf_form(__FUNCTION__, $form);
     echo $form->renderForm();
     die;
 }
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:48,代码来源:class.types.admin.edit.fields.php


示例19: 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. &#8220;The Mona Lisa&#8221;', '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. &#8220;The Mona Lisa&#8221;', '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' => '&nbsp;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' => '&nbsp;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


示例20: 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' = 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wpcf_form_add_js_validation函数代码示例发布时间:2022-05-23
下一篇:
PHP wpcf_fields_type_action函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap