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


PHP wpcf_admin_get_taxonomies_by_group函数代码示例

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


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

示例1: column_default

 /** ************************************************************************
  * Recommended. This method is called when the parent class can't find a method
  * specifically build for a given column. Generally, it's recommended to include
  * one method for each column you want to render, keeping your package class
  * neat and organized. For example, if the class needs to process a column
  * named 'title', it would first see if a method named $this->column_title()
  * exists - if it does, that method will be used. If it doesn't, this one will
  * be used. Generally, you should try to use custom column methods as much as
  * possible.
  *
  * Since we have defined a column_title() method later on, this method doesn't
  * need to concern itself with any column with a name of 'title'. Instead, it
  * needs to handle everything else.
  *
  * For more detailed insight into how columns are handled, take a look at
  * WP_List_Table::single_row_columns()
  *
  * @param array $item A singular item (one full row's worth of data)
  * @param array $column_name The name/slug of the column to be processed
  * @return string Text or HTML to be placed inside the column <td>
  **************************************************************************/
 function column_default($item, $column_name)
 {
     switch ($column_name) {
         case 'title':
         case 'description':
             return stripslashes($item[$column_name]);
         case 'post_types':
             $post_types = wpcf_admin_get_post_types_by_group($item['id']);
             return empty($post_types) ? __('All post types', 'wpcf') : implode(', ', $post_types);
             break;
         case 'taxonomies':
             $taxonomies = wpcf_admin_get_taxonomies_by_group($item['id']);
             $output = '';
             if (empty($taxonomies)) {
                 $output = __('None', 'wpcf');
             } else {
                 foreach ($taxonomies as $taxonomy => $terms) {
                     $output .= '<em>' . $taxonomy . '</em>: ';
                     $terms_output = array();
                     foreach ($terms as $term_id => $term) {
                         $terms_output[] = $term['name'];
                     }
                     $output .= implode(', ', $terms_output) . '<br />';
                 }
             }
             return $output;
         case 'status':
             return 'active' == $item[$column_name] ? __('Yes', 'wpcf') : __('No', 'wpcf');
         default:
             return print_r($item, true);
             //Show the whole array for troubleshooting purposes
     }
 }
开发者ID:KryvunRoman,项目名称:yobko,代码行数:54,代码来源:class.wpcf.custom.fields.list.table.php

示例2: wpcf_admin_fields_list

/**
 * Renders 'widefat' table.
 */
function wpcf_admin_fields_list()
{
    $groups = wpcf_admin_fields_get_groups();
    if (empty($groups)) {
        echo '<p>' . __("To use custom fields, please create a group to hold them.", 'wpcf') . '</p>';
        echo '<br /><a class="button-primary" href="' . admin_url('admin.php?page=wpcf-edit') . '">' . __('Add a custom fields group', 'wpcf') . '</a><br /><br />';
    } else {
        echo '<br /><a class="button-secondary" href="' . admin_url('admin.php?page=wpcf-edit') . '">' . __('Add a custom fields group', 'wpcf') . '</a><br /><br />';
        $rows = array();
        $header = array('group_name' => __('Group name', 'wpcf'), 'group_description' => __('Description', 'wpcf'), 'group_active' => __('Active', 'wpcf'), 'group_post_types' => __('Post types', 'wpcf'), 'group_taxonomies' => __('Taxonomies', 'wpcf'));
        foreach ($groups as $group) {
            // Set 'name' column
            $name = '';
            $name .= '<a href="' . admin_url('admin.php?page=wpcf-edit&amp;group_id=' . $group['id']) . '">' . $group['name'] . '</a>';
            $name .= '<br />';
            $name .= '<a href="' . admin_url('admin.php?page=wpcf-edit&amp;group_id=' . $group['id']) . '">' . __('Edit', 'wpcf') . '</a> | ';
            $name .= $group['is_active'] ? wpcf_admin_fields_get_ajax_deactivation_link($group['id']) . ' | ' : wpcf_admin_fields_get_ajax_activation_link($group['id']) . ' | ';
            $name .= '<a href="' . admin_url('admin-ajax.php?action=wpcf_ajax&amp;' . 'wpcf_action=delete_group&amp;group_id=' . $group['id'] . '&amp;wpcf_ajax_update=wpcf_list_ajax_response_' . $group['id']) . '&amp;_wpnonce=' . wp_create_nonce('delete_group') . '&amp;wpcf_warning=' . __('Are you sure?', 'wpcf') . '" class="wpcf-ajax-link" ' . 'id="wpcf-list-delete-' . $group['id'] . '">' . __('Delete Permanently', 'wpcf') . '</a>';
            $name .= '<div id="wpcf_list_ajax_response_' . $group['id'] . '"></div>';
            $rows[$group['id']]['name'] = $name;
            $rows[$group['id']]['raw_name'] = $group['name'];
            $rows[$group['id']]['description'] = $group['description'];
            $rows[$group['id']]['active-' . $group['id']] = $group['is_active'] ? __('Yes', 'wpcf') : __('No', 'wpcf');
            $rows[$group['id']]['status'] = $group['is_active'] ? 'active' : 'inactive';
            // Set 'post_tpes' column
            $post_types = wpcf_admin_get_post_types_by_group($group['id']);
            $rows[$group['id']]['post_types'] = empty($post_types) ? __('All post types', 'wpcf') : implode(', ', $post_types);
            // Set 'taxonomies' column
            $taxonomies = wpcf_admin_get_taxonomies_by_group($group['id']);
            $output = '';
            if (empty($taxonomies)) {
                $output = __('None', 'wpcf');
            } else {
                foreach ($taxonomies as $taxonomy => $terms) {
                    $output .= '<em>' . $taxonomy . '</em>: ';
                    $terms_output = array();
                    foreach ($terms as $term_id => $term) {
                        $terms_output[] = $term['name'];
                    }
                    $output .= implode(', ', $terms_output) . '<br />';
                }
            }
            $rows[$group['id']]['tax'] = $output;
        }
        uasort($rows, 'wpcf_admin_fields_list_sort');
        // Render table
        wpcf_admin_widefat_table('wpcf_groups_list', $header, $rows);
    }
    do_action('wpcf_groups_list_table_after');
}
开发者ID:sandum150,项目名称:cheltuieli,代码行数:53,代码来源:fields-list.php

示例3: wpcf_admin_fields_list

/**
 * Renders 'widefat' table.
 */
function wpcf_admin_fields_list()
{
    $groups = wpcf_admin_fields_get_groups();
    if (empty($groups)) {
        echo '<p>' . __("Custom Fields (also known as post-meta) are information attached to WordPress posts. This data can then be queried and filtered in your database. With Types you can create Custom Field Groups which are then attached to any post type (including Posts, Pages and Custom Post Types) or taxonomy.", 'wpcf') . '<br /><br />' . __('You can read more about Custom Fields in this tutorial: <a href="http://wp-types.com/user-guides/using-custom-fields/" target="_blank">http://wp-types.com/user-guides/using-custom-fields/ &raquo;</a>.', 'wpcf') . '</p>';
    }
    echo '<br /><a class="button-secondary" href="' . admin_url('admin.php?page=wpcf-edit') . '">' . __('Add a custom fields group', 'wpcf') . '</a><br /><br />';
    if (!empty($groups)) {
        $rows = array();
        $header = array('group_name' => __('Group name', 'wpcf'), 'group_description' => __('Description', 'wpcf'), 'group_active' => __('Active', 'wpcf'), 'group_post_types' => __('Post types', 'wpcf'), 'group_taxonomies' => __('Taxonomies', 'wpcf'));
        foreach ($groups as $group) {
            // Set 'name' column
            $name = '';
            $name .= '<a href="' . admin_url('admin.php?page=wpcf-edit&amp;group_id=' . $group['id']) . '">' . $group['name'] . '</a>';
            $name .= '<br />';
            $name .= '<a href="' . admin_url('admin.php?page=wpcf-edit&amp;group_id=' . $group['id']) . '">' . __('Edit', 'wpcf') . '</a> | ';
            $name .= $group['is_active'] ? wpcf_admin_fields_get_ajax_deactivation_link($group['id']) . ' | ' : wpcf_admin_fields_get_ajax_activation_link($group['id']) . ' | ';
            $name .= '<a href="' . admin_url('admin-ajax.php?action=wpcf_ajax&amp;' . 'wpcf_action=delete_group&amp;group_id=' . $group['id'] . '&amp;wpcf_ajax_update=wpcf_list_ajax_response_' . $group['id']) . '&amp;_wpnonce=' . wp_create_nonce('delete_group') . '&amp;wpcf_warning=' . __('Are you sure?', 'wpcf') . '" class="wpcf-ajax-link" ' . 'id="wpcf-list-delete-' . $group['id'] . '">' . __('Delete Permanently', 'wpcf') . '</a>';
            $name .= '<div id="wpcf_list_ajax_response_' . $group['id'] . '"></div>';
            $rows[$group['id']]['name'] = $name;
            $rows[$group['id']]['description'] = $group['description'];
            $rows[$group['id']]['active-' . $group['id']] = $group['is_active'] ? __('Yes', 'wpcf') : __('No', 'wpcf');
            // Set 'post_tpes' column
            $post_types = wpcf_admin_get_post_types_by_group($group['id']);
            $rows[$group['id']]['post_types'] = empty($post_types) ? __('None', 'wpcf') : implode(', ', $post_types);
            // Set 'taxonomies' column
            $taxonomies = wpcf_admin_get_taxonomies_by_group($group['id']);
            $output = '';
            if (empty($taxonomies)) {
                $output = __('None', 'wpcf');
            } else {
                foreach ($taxonomies as $taxonomy => $terms) {
                    $output .= '<em>' . $taxonomy . '</em>: ';
                    $terms_output = array();
                    foreach ($terms as $term_id => $term) {
                        $terms_output[] = $term['name'];
                    }
                    $output .= implode(', ', $terms_output) . '<br />';
                }
            }
            $rows[$group['id']]['tax'] = $output;
        }
        // Render table
        wpcf_admin_widefat_table('wpcf_groups_list', $header, $rows);
    }
    do_action('wpcf_groups_list_table_after');
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:50,代码来源:fields-list.php

示例4: wpcf_admin_fields_form

/**
 * Generates form data.
 */
function wpcf_admin_fields_form()
{
    wpcf_admin_add_js_settings('wpcf_nonce_toggle_group', '\'' . wp_create_nonce('group_form_collapsed') . '\'');
    wpcf_admin_add_js_settings('wpcf_nonce_toggle_fieldset', '\'' . wp_create_nonce('form_fieldset_toggle') . '\'');
    $default = array();
    // If it's update, get data
    $update = false;
    if (isset($_REQUEST['group_id'])) {
        $update = wpcf_admin_fields_get_group(intval($_REQUEST['group_id']));
        if (empty($update)) {
            $update = false;
            wpcf_admin_message(sprintf(__("Group with ID %d do not exist", 'wpcf'), intval($_REQUEST['group_id'])));
        } else {
            $update['fields'] = wpcf_admin_fields_get_fields_by_group($_REQUEST['group_id']);
            $update['post_types'] = wpcf_admin_get_post_types_by_group($_REQUEST['group_id']);
            $update['taxonomies'] = wpcf_admin_get_taxonomies_by_group($_REQUEST['group_id']);
            $update['templates'] = wpcf_admin_get_templates_by_group($_REQUEST['group_id']);
        }
    }
    $form = array();
    $form['#form']['callback'] = array('wpcf_admin_save_fields_groups_submit');
    // Form sidebars
    $form['open-sidebar'] = array('#type' => 'markup', '#markup' => '<div class="wpcf-form-fields-align-right">');
    $form['submit2'] = array('#type' => 'submit', '#name' => 'save', '#value' => __('Save', 'wpcf'), '#attributes' => array('class' => 'button-primary'));
    $form['fields'] = array('#type' => 'fieldset', '#title' => __('Available fields', 'wpcf'));
    // Get field types
    $fields_registered = wpcf_admin_fields_get_available_types();
    //    foreach (glob(WPCF_EMBEDDED_INC_ABSPATH . '/fields/*.php') as $filename) {
    foreach ($fields_registered as $filename => $data) {
        //        require_once $filename;
        //        if (function_exists('wpcf_fields_' . basename($filename, '.php'))) {
        //            $data = call_user_func('wpcf_fields_' . basename($filename, '.php'));
        //            if (isset($data['wp_version']) && wpcf_compare_wp_version($data['wp_version'],
        //                            '<')) {
        //                continue;
        //            }
        $form['fields'][basename($filename, '.php')] = array('#type' => 'markup', '#markup' => '<a href="' . admin_url('admin-ajax.php' . '?action=wpcf_ajax&amp;wpcf_action=fields_insert' . '&amp;field=' . basename($filename, '.php')) . '&amp;_wpnonce=' . wp_create_nonce('fields_insert') . '" ' . 'class="wpcf-fields-add-ajax-link button-secondary">' . $data['title'] . '</a> ');
        // Process JS
        if (!empty($data['group_form_js'])) {
            foreach ($data['group_form_js'] as $handle => $script) {
                if (isset($script['inline'])) {
                    add_action('admin_footer', $script['inline']);
                    continue;
                }
                $deps = !empty($script['deps']) ? $script['deps'] : array();
                $in_footer = !empty($script['in_footer']) ? $script['in_footer'] : false;
                wp_register_script($handle, $script['src'], $deps, WPCF_VERSION, $in_footer);
                wp_enqueue_script($handle);
            }
        }
        // Process CSS
        if (!empty($data['group_form_css'])) {
            foreach ($data['group_form_css'] as $handle => $script) {
                if (isset($script['src'])) {
                    $deps = !empty($script['deps']) ? $script['deps'] : array();
                    wp_enqueue_style($handle, $script['src'], $deps, WPCF_VERSION);
                } else {
                    if (isset($script['inline'])) {
                        add_action('admin_head', $script['inline']);
                    }
                }
            }
        }
        //        }
    }
    // Get fields created by user
    $fields = wpcf_admin_fields_get_fields(true, true);
    if (!empty($fields)) {
        $form['fields-existing'] = array('#type' => 'fieldset', '#title' => __('User created fields', 'wpcf'), '#id' => 'wpcf-form-groups-user-fields');
        foreach ($fields as $key => $field) {
            if (isset($update['fields']) && array_key_exists($key, $update['fields'])) {
                continue;
            }
            if (!empty($field['data']['removed_from_history'])) {
                continue;
            }
            $form['fields-existing'][$key] = array('#type' => 'markup', '#markup' => '<div id="wpcf-user-created-fields-wrapper-' . $field['id'] . '" style="float:left; margin-right: 10px;"><a href="' . admin_url('admin-ajax.php' . '?action=wpcf_ajax' . '&amp;wpcf_action=fields_insert_existing' . '&amp;field=' . $field['id']) . '&amp;_wpnonce=' . wp_create_nonce('fields_insert_existing') . '" ' . 'class="wpcf-fields-add-ajax-link button-secondary" onclick="jQuery(this).parent().fadeOut();">' . htmlspecialchars(stripslashes($field['name'])) . '</a>' . '<a href="' . admin_url('admin-ajax.php' . '?action=wpcf_ajax' . '&amp;wpcf_action=remove_from_history' . '&amp;field_id=' . $field['id']) . '&amp;_wpnonce=' . wp_create_nonce('remove_from_history') . '&amp;wpcf_warning=' . sprintf(__('Are you sure that you want to remove field %s from history?', 'wpcf'), htmlspecialchars(stripslashes($field['name']))) . '&amp;wpcf_ajax_update=wpcf-user-created-fields-wrapper-' . $field['id'] . '" title="' . sprintf(__('Remove field %s', 'wpcf'), htmlspecialchars(stripslashes($field['name']))) . '" class="wpcf-ajax-link"><img src="' . WPCF_RES_RELPATH . '/images/delete-2.png" style="postion:absolute;margin-top:5px;margin-left:-4px;" /></a></div>');
        }
    }
    $form['close-sidebar'] = array('#type' => 'markup', '#markup' => '</div>');
    // Group data
    $form['open-main'] = array('#type' => 'markup', '#markup' => '<div id="wpcf-form-fields-main">');
    $form['title'] = array('#type' => 'textfield', '#name' => 'wpcf[group][name]', '#id' => 'wpcf-group-name', '#value' => $update ? $update['name'] : __('Enter group title', 'wpcf'), '#inline' => true, '#attributes' => array('style' => 'width:100%;margin-bottom:10px;'), '#validate' => array('required' => array('value' => true)));
    if (!$update) {
        $form['title']['#attributes']['onfocus'] = 'if (jQuery(this).val() == \'' . __('Enter group title', 'wpcf') . '\') { jQuery(this).val(\'\'); }';
        $form['title']['#attributes']['onblur'] = 'if (jQuery(this).val() == \'\') { jQuery(this).val(\'' . __('Enter group title', 'wpcf') . '\') }';
    }
    $form['description'] = array('#type' => 'textarea', '#id' => 'wpcf-group-description', '#name' => 'wpcf[group][description]', '#value' => $update ? $update['description'] : __('Enter a description for this group', 'wpcf'));
    if (!$update) {
        $form['description']['#attributes']['onfocus'] = 'if (jQuery(this).val() == \'' . __('Enter a description for this group', 'wpcf') . '\') { jQuery(this).val(\'\'); }';
        $form['description']['#attributes']['onblur'] = 'if (jQuery(this).val() == \'\') { jQuery(this).val(\'' . __('Enter a description for this group', 'wpcf') . '\') }';
    }
    // Support post types and taxonomies
    $post_types = get_post_types('', 'objects');
    $options = array();
    $post_types_currently_supported = array();
    $form_types = array();
//.........这里部分代码省略.........
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:101,代码来源:fields-form.php

示例5: wpcf_admin_fields_form

/**
 * Generates form data.
 */
function wpcf_admin_fields_form()
{
    wpcf_admin_add_js_settings('wpcf_nonce_toggle_group', '\'' . wp_create_nonce('group_form_collapsed') . '\'');
    wpcf_admin_add_js_settings('wpcf_nonce_toggle_fieldset', '\'' . wp_create_nonce('form_fieldset_toggle') . '\'');
    $default = array();
    global $wpcf_button_style;
    global $wpcf_button_style30;
    global $wpcf;
    // If it's update, get data
    $update = false;
    if (isset($_REQUEST['group_id'])) {
        $update = wpcf_admin_fields_get_group(intval($_REQUEST['group_id']));
        if (empty($update)) {
            $update = false;
            wpcf_admin_message(sprintf(__("Group with ID %d do not exist", 'wpcf'), intval($_REQUEST['group_id'])));
        } else {
            $update['fields'] = wpcf_admin_fields_get_fields_by_group(sanitize_text_field($_REQUEST['group_id']), 'slug', false, true);
            $update['post_types'] = wpcf_admin_get_post_types_by_group(sanitize_text_field($_REQUEST['group_id']));
            $update['taxonomies'] = wpcf_admin_get_taxonomies_by_group(sanitize_text_field($_REQUEST['group_id']));
            $update['templates'] = wpcf_admin_get_templates_by_group(sanitize_text_field($_REQUEST['group_id']));
            $update['admin_styles'] = wpcf_admin_get_groups_admin_styles_by_group(sanitize_text_field($_REQUEST['group_id']));
        }
    }
    $form = array();
    $form['#form']['callback'] = array('wpcf_admin_save_fields_groups_submit');
    // Form sidebars
    $form['open-sidebar'] = array('#type' => 'markup', '#markup' => '<div class="wpcf-form-fields-align-right">');
    // Set help icon
    $form['help-icon'] = array('#type' => 'markup', '#markup' => '<div class="wpcf-admin-fields-help"><img src="' . WPCF_EMBEDDED_RELPATH . '/common/res/images/question.png" style="position:relative;top:2px;" />&nbsp;<a href="http://wp-types.com/documentation/user-guides/using-custom-fields/?utm_source=typesplugin&utm_medium=help&utm_term=fields-help&utm_content=fields-editor&utm_campaign=types" target="_blank">' . __('Custom fields help', 'wpcf') . '</a></div>');
    $form['submit2'] = array('#type' => 'submit', '#name' => 'save', '#value' => __('Save', 'wpcf'), '#attributes' => array('class' => 'button-primary wpcf-disabled-on-submit'));
    $form['fields'] = array('#type' => 'fieldset', '#title' => __('Available fields', 'wpcf'));
    // Get field types
    $fields_registered = wpcf_admin_fields_get_available_types();
    foreach ($fields_registered as $filename => $data) {
        $form['fields'][basename($filename, '.php')] = array('#type' => 'markup', '#markup' => '<a href="' . admin_url('admin-ajax.php' . '?action=wpcf_ajax&amp;wpcf_action=fields_insert' . '&amp;field=' . basename($filename, '.php') . '&amp;page=wpcf-edit') . '&amp;_wpnonce=' . wp_create_nonce('fields_insert') . '" ' . 'class="wpcf-fields-add-ajax-link button-secondary">' . $data['title'] . '</a> ');
        // Process JS
        if (!empty($data['group_form_js'])) {
            foreach ($data['group_form_js'] as $handle => $script) {
                if (isset($script['inline'])) {
                    add_action('admin_footer', $script['inline']);
                    continue;
                }
                $deps = !empty($script['deps']) ? $script['deps'] : array();
                $in_footer = !empty($script['in_footer']) ? $script['in_footer'] : false;
                wp_register_script($handle, $script['src'], $deps, WPCF_VERSION, $in_footer);
                wp_enqueue_script($handle);
            }
        }
        // Process CSS
        if (!empty($data['group_form_css'])) {
            foreach ($data['group_form_css'] as $handle => $script) {
                if (isset($script['src'])) {
                    $deps = !empty($script['deps']) ? $script['deps'] : array();
                    wp_enqueue_style($handle, $script['src'], $deps, WPCF_VERSION);
                } else {
                    if (isset($script['inline'])) {
                        add_action('admin_head', $script['inline']);
                    }
                }
            }
        }
    }
    // Get fields created by user
    $fields = wpcf_admin_fields_get_fields(true, true);
    if (!empty($fields)) {
        $form['fields-existing'] = array('#type' => 'fieldset', '#title' => __('User created fields', 'wpcf'), '#id' => 'wpcf-form-groups-user-fields');
        foreach ($fields as $key => $field) {
            if (isset($update['fields']) && array_key_exists($key, $update['fields'])) {
                continue;
            }
            if (!empty($field['data']['removed_from_history'])) {
                continue;
            }
            $form['fields-existing'][$key] = array('#type' => 'markup', '#markup' => '<div id="wpcf-user-created-fields-wrapper-' . $field['id'] . '" style="float:left; margin-right: 10px;"><a href="' . admin_url('admin-ajax.php' . '?action=wpcf_ajax' . '&amp;wpcf_action=fields_insert_existing' . '&amp;page=wpcf-edit' . '&amp;field=' . $field['id']) . '&amp;_wpnonce=' . wp_create_nonce('fields_insert_existing') . '" ' . 'class="wpcf-fields-add-ajax-link button-secondary" onclick="jQuery(this).parent().fadeOut();" ' . ' data-slug="' . $field['id'] . '">' . htmlspecialchars(stripslashes($field['name'])) . '</a>' . '<a href="' . admin_url('admin-ajax.php' . '?action=wpcf_ajax' . '&amp;wpcf_action=remove_from_history' . '&amp;field_id=' . $field['id']) . '&amp;_wpnonce=' . wp_create_nonce('remove_from_history') . '&amp;wpcf_warning=' . sprintf(__('Are you sure that you want to remove field %s from history?', 'wpcf'), htmlspecialchars(stripslashes($field['name']))) . '&amp;wpcf_ajax_update=wpcf-user-created-fields-wrapper-' . $field['id'] . '" title="' . sprintf(__('Remove field %s', 'wpcf'), htmlspecialchars(stripslashes($field['name']))) . '" class="wpcf-ajax-link"><img src="' . WPCF_RES_RELPATH . '/images/delete-2.png" style="postion:absolute;margin-top:5px;margin-left:-4px;" /></a></div>');
        }
    }
    $form['close-sidebar'] = array('#type' => 'markup', '#markup' => '</div>');
    // Group data
    $form['open-main'] = array('#type' => 'markup', '#markup' => '<div id="wpcf-form-fields-main">');
    $form['title'] = array('#type' => 'textfield', '#name' => 'wpcf[group][name]', '#id' => 'wpcf-group-name', '#value' => $update ? $update['name'] : '', '#inline' => true, '#attributes' => array('style' => 'width:100%;margin-bottom:10px;', 'placeholder' => __('Enter group title', 'wpcf')), '#validate' => array('required' => array('value' => true)));
    $form['description'] = array('#type' => 'textarea', '#id' => 'wpcf-group-description', '#name' => 'wpcf[group][description]', '#value' => $update ? $update['description'] : '', '#attributes' => array('placeholder' => __('Enter a description for this group', 'wpcf')));
    /**
     *
     * FILTER BOX
     * Since Types 1.2 we moved JS to /embedded/resources/js/custom-fields-form-filter.js
     *
     */
    // Support post types and taxonomies
    $post_types = get_post_types('', 'objects');
    $options = array();
    $post_types_currently_supported = array();
    $form_types = array();
    foreach ($post_types as $post_type_slug => $post_type) {
        if (in_array($post_type_slug, $wpcf->excluded_post_types) || !$post_type->show_ui) {
            continue;
        }
        $options[$post_type_slug]['#name'] = 'wpcf[group][supports][' . $post_type_slug . ']';
//.........这里部分代码省略.........
开发者ID:chrismathers,项目名称:premierplacement,代码行数:101,代码来源:fields-form.php

示例6: column_default

 /** ************************************************************************
  * Recommended. This method is called when the parent class can't find a method
  * specifically build for a given column. Generally, it's recommended to include
  * one method for each column you want to render, keeping your package class
  * neat and organized. For example, if the class needs to process a column
  * named 'title', it would first see if a method named $this->column_title()
  * exists - if it does, that method will be used. If it doesn't, this one will
  * be used. Generally, you should try to use custom column methods as much as
  * possible.
  *
  * Since we have defined a column_title() method later on, this method doesn't
  * need to concern itself with any column with a name of 'title'. Instead, it
  * needs to handle everything else.
  *
  * For more detailed insight into how columns are handled, take a look at
  * WP_List_Table::single_row_columns()
  *
  * @param array $item A singular item (one full row's worth of data)
  * @param array $column_name The name/slug of the column to be processed
  * @return string Text or HTML to be placed inside the column <td>
  **************************************************************************/
 function column_default($item, $column_name)
 {
     switch ($column_name) {
         case 'title':
         case 'description':
             return stripslashes($item[$column_name]);
         case 'post_types':
             global $wp_post_types;
             $post_types = wpcf_admin_get_post_types_by_group($item['id']);
             $supports = array();
             if (!empty($post_types)) {
                 foreach ($post_types as $key => $post_type_slug) {
                     if (isset($wp_post_types[$post_type_slug]->labels->singular_name)) {
                         $supports[] = $wp_post_types[$post_type_slug]->labels->singular_name;
                     } else {
                         $supports[] = $post_type_slug;
                     }
                 }
             }
             return empty($post_types) ? __('All post types', 'wpcf') : implode(', ', $supports);
             break;
         case 'taxonomies':
             global $wp_taxonomies;
             $taxonomies = wpcf_admin_get_taxonomies_by_group($item['id']);
             $output = '';
             if (empty($taxonomies)) {
                 $output = __('None', 'wpcf');
             } else {
                 foreach ($taxonomies as $taxonomy => $terms) {
                     $output .= isset($wp_taxonomies[$taxonomy]->labels->singular_name) ? '<em>' . $wp_taxonomies[$taxonomy]->labels->singular_name . '</em>: ' : '<em>' . $taxonomy . '</em>: ';
                     $terms_output = array();
                     foreach ($terms as $term_id => $term) {
                         $terms_output[] = $term['name'];
                     }
                     $output .= implode(', ', $terms_output) . '<br />';
                 }
             }
             return $output;
         case 'status':
             return 'active' == $item[$column_name] ? __('Yes', 'wpcf') : __('No', 'wpcf');
         default:
             return print_r($item, true);
             //Show the whole array for troubleshooting purposes
     }
 }
开发者ID:phuocdungit,项目名称:fundy,代码行数:66,代码来源:class.wpcf.custom.fields.list.table.php

示例7: form_add_filter_dialog

 /**
  * Summary.
  *
  * Description.
  *
  * @since x.x.x
  * @access (for functions: only use if private)
  *
  * @param $filter
  * @param $form
  */
 protected function form_add_filter_dialog($filter, &$form)
 {
     global $wpcf;
     switch ($filter) {
         /**
          * post types
          */
         case 'post-types':
             $form['post-types-description'] = array('#type' => 'markup', '#markup' => '<p class="description js-wpcf-description">' . __('Select specific Post Types that you want to use with this Field Group:', 'wpcf') . '</p>');
             $form['post-types-ul-open'] = array('#type' => 'markup', '#markup' => '<ul>');
             $currently_supported = wpcf_admin_get_post_types_by_group(sanitize_text_field($_REQUEST['id']));
             $post_types = get_post_types(array('show_ui' => true), 'objects');
             ksort($post_types);
             foreach ($post_types as $post_type_slug => $post_type) {
                 if (in_array($post_type_slug, $wpcf->excluded_post_types)) {
                     continue;
                 }
                 $form['option_' . $post_type_slug] = array('#name' => esc_attr($post_type_slug), '#type' => 'checkbox', '#value' => 1, '#default_value' => $this->ajax_filter_default_value($post_type_slug, $currently_supported, 'post-type'), '#inline' => true, '#before' => '<li>', '#after' => '</li>', '#title' => $post_type->label, '#attributes' => array('data-wpcf-value' => esc_attr($post_type_slug), 'data-wpcf-prefix' => 'post-type-'));
             }
             $form['post-types-ul-close'] = array('#type' => 'markup', '#markup' => '</ul><br class="clear" />');
             break;
             /**
              * taxonomies
              */
         /**
          * taxonomies
          */
         case 'taxonomies':
             $form['taxonomies-description'] = array('#type' => 'markup', '#markup' => '<p class="description js-wpcf-description">' . __('Select ' . 'specific Terms from Taxonomies below that you want to use with this Field Group:', 'wpcf') . '</p>');
             include_once WPCF_INC_ABSPATH . '/fields.php';
             $currently_supported = wpcf_admin_get_taxonomies_by_group($_REQUEST['id']);
             $taxonomies = apply_filters('wpcf_group_form_filter_taxonomies', get_taxonomies('', 'objects'));
             $taxonomies_settings = get_option(WPCF_OPTION_NAME_CUSTOM_TAXONOMIES, array());
             $form['taxonomies-div-open'] = array('#type' => 'markup', '#markup' => '<div id="poststuff" class="meta-box-sortables">');
             foreach ($taxonomies as $category_slug => $category) {
                 if ($category_slug == 'nav_menu' || $category_slug == 'link_category' || $category_slug == 'post_format' || isset($taxonomies_settings[$category_slug]['disabled']) && $taxonomies_settings[$category_slug]['disabled'] == 1 || empty($category->labels->name)) {
                     continue;
                 }
                 $terms = apply_filters('wpcf_group_form_filter_terms', get_terms($category_slug, array('hide_empty' => false)));
                 if (empty($terms)) {
                     continue;
                 }
                 $form_tax = array();
                 $form_tax[$category_slug . '-search'] = array('#type' => 'textfield', '#name' => $category_slug . '-search', '#attributes' => array('class' => 'widefat js-wpcf-taxonomy-search', 'placeholder' => esc_attr__('Search', 'wpcf')));
                 foreach ($terms as $term) {
                     $form_tax[$term->term_taxonomy_id] = array('#type' => 'checkbox', '#name' => esc_attr(sprintf('tax-%d', $term->term_taxonomy_id)), '#value' => 1, '#inline' => true, '#before' => '<li>', '#after' => '</li>', '#title' => $term->name, '#default_value' => $this->ajax_filter_default_value($term->term_taxonomy_id, $currently_supported, 'taxonomy', $category_slug), '#attributes' => array('data-wpcf-value' => esc_attr($term->term_taxonomy_id), 'data-wpcf-slug' => esc_attr($term->slug), 'data-wpcf-name' => esc_attr($term->name), 'data-wpcf-taxonomy-slug' => esc_attr($category_slug), 'data-wpcf-prefix' => ''));
                 }
                 $form += $this->ajax_filter_add_box($category_slug, $category->labels->name, $form_tax);
             }
             $form['taxonomies-div-close'] = array('#type' => 'markup', '#markup' => '</div>');
             break;
             /**
              * templates
              */
         /**
          * templates
          */
         case 'templates':
             $form['templates-description'] = array('#type' => 'markup', '#markup' => '<p class="description js-wpcf-description">' . __('Select specific Template that you want to use with this Field Group:', 'wpcf') . '</p>');
             $form['templates-ul-open'] = array('#type' => 'markup', '#markup' => '<ul>');
             include_once WPCF_INC_ABSPATH . '/fields.php';
             $currently_supported = wpcf_admin_get_templates_by_group(sanitize_text_field($_REQUEST['id']));
             $templates = get_page_templates();
             $templates_views = get_posts(array('post_type' => 'view-template', 'numberposts' => -1, 'status' => 'publish'));
             $form['default-template'] = array('#type' => 'checkbox', '#default_value' => $this->ajax_filter_default_value('default', $currently_supported, 'template'), '#name' => 'default', '#value' => 1, '#inline' => true, '#title' => __('Default', 'wpcf'), '#before' => '<li>', '#after' => '</li>', '#attributes' => array('data-wpcf-value' => esc_attr('default'), 'data-wpcf-prefix' => 'templates-'));
             foreach ($templates as $template_name => $template_filename) {
                 $form[$template_filename] = array('#type' => 'checkbox', '#default_value' => $this->ajax_filter_default_value($template_filename, $currently_supported, 'template'), '#value' => 1, '#inline' => true, '#title' => $template_name, '#name' => sanitize_title_with_dashes($template_filename), '#before' => '<li>', '#after' => '</li>', '#attributes' => array('data-wpcf-value' => esc_attr($template_filename), 'data-wpcf-prefix' => 'templates-'));
             }
             foreach ($templates_views as $template_view) {
                 $form[$template_view->post_name] = array('#type' => 'checkbox', '#value' => 1, '#default_value' => $this->ajax_filter_default_value($template_view->ID, $currently_supported, 'template'), '#inline' => true, '#title' => apply_filters('the_title', $template_view->post_title), '#name' => $template_view->ID, '#before' => '<li>', '#after' => '</li>', '#attributes' => array('data-wpcf-value' => esc_attr($template_view->ID), 'data-wpcf-prefix' => 'templates-'));
             }
             $form['templates-ul-close'] = array('#type' => 'markup', '#markup' => '</ul><br class="clear" />');
             break;
             /**
              * data dependant
              */
         /**
          * data dependant
          */
         case 'data-dependant':
             require_once WPCF_INC_ABSPATH . '/classes/class.types.fields.conditional.php';
             $data_dependant = new Types_Fields_Conditional();
             $form += $data_dependant->group_condition_get(true);
             break;
     }
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:97,代码来源:class.types.admin.edit.custom.fields.group.php


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