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

PHP wpcf_fields_get_shortcode函数代码示例

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

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



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

示例1: wpcf_fields_url_editor_submit

/**
 * Editor callback form submit.
 */
function wpcf_fields_url_editor_submit($data, $field, $context)
{
    $add = '';
    if (!empty($data['title'])) {
        $add .= ' title="' . strval($data['title']) . '"';
    }
    if (!empty($data['no_protocol'])) {
        $add .= ' no_protocol="true"';
    }
    if (!empty($data['target'])) {
        if ($data['target'] == 'framename') {
            $add .= ' target="' . strval($data['framename']) . '"';
        } else {
            if ($data['target'] != '_self') {
                $add .= ' target="' . strval($data['target']) . '"';
            }
        }
    }
    if ($context == 'usermeta') {
        $add .= wpcf_get_usermeta_form_addon_submit();
        $shortcode = wpcf_usermeta_get_shortcode($field, $add);
    } else {
        $shortcode = wpcf_fields_get_shortcode($field, $add);
    }
    return $shortcode;
}
开发者ID:SpencerNeitzke,项目名称:types,代码行数:29,代码来源:url.php


示例2: wpcf_fields_checkboxes_editor_submit

/**
 * Editor callback form submit.
 */
function wpcf_fields_checkboxes_editor_submit()
{
    $add = '';
    $field = wpcf_admin_fields_get_field($_GET['field_id']);
    $shortcode = '';
    if (!empty($field)) {
        if (!empty($_POST['options'])) {
            if ($_POST['display'] == 'display_all') {
                $separator = !empty($_POST['separator']) ? $_POST['separator'] : '';
                $shortcode .= '[types field="' . $field['slug'] . '" separator="' . $separator . '"]' . '[/types] ';
            } else {
                $i = 0;
                foreach ($_POST['options'] as $option_key => $option) {
                    if ($_POST['display'] == 'value') {
                        $shortcode .= '[types field="' . $field['slug'] . '" option="' . $i . '" state="checked"]' . $option['display_value_selected'] . '[/types] ';
                        $shortcode .= '[types field="' . $field['slug'] . '" option="' . $i . '" state="unchecked"]' . $option['display_value_not_selected'] . '[/types] ';
                    } else {
                        $add = ' option="' . $i . '"';
                        $shortcode .= wpcf_fields_get_shortcode($field, $add) . ' ';
                    }
                    $i++;
                }
            }
        }
        echo editor_admin_popup_insert_shortcode_js($shortcode);
        die;
    }
}
开发者ID:dewavi,项目名称:occupysandy.net,代码行数:31,代码来源:checkboxes.php


示例3: wpcf_fields_entry_editor_submit

/**
 * Editor callback form submit.
 */
function wpcf_fields_entry_editor_submit($data, $field, $context)
{
    $shortcode = '';
    if (isset($data['display']) && preg_match('/^post-[\\-a-z]+$/', $data['display'])) {
        $add = sprintf(' display="%s"', $data['display']);
        if ($context == 'usermeta') {
            $shortcode = wpcf_usermeta_get_shortcode($field, $add);
        } else {
            $shortcode = wpcf_fields_get_shortcode($field, $add);
        }
    }
    return $shortcode;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:16,代码来源:entry.php


示例4: wpcf_fields_email_editor_submit

/**
 * Editor callback form submit.
 */
function wpcf_fields_email_editor_submit()
{
    $add = '';
    if (!empty($_POST['title'])) {
        $add = ' title="' . strval($_POST['title']) . '"';
    }
    $field = wpcf_admin_fields_get_field($_GET['field_id']);
    if (!empty($field)) {
        $shortcode = wpcf_fields_get_shortcode($field, $add);
        wpcf_admin_fields_save_field_last_settings($_GET['field_id'], $_POST);
        echo wpcf_admin_fields_popup_insert_shortcode_js($shortcode);
        die;
    }
}
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:17,代码来源:email.php


示例5: wpcf_fields_skype_editor_submit

/**
 * Editor submit.
 */
function wpcf_fields_skype_editor_submit($data, $field, $context)
{
    $add = '';
    if (!empty($data['button_style'])) {
        $add .= ' button_style="' . strval($data['button_style']) . '"';
    }
    if ($context == 'usermeta') {
        $add .= wpcf_get_usermeta_form_addon_submit();
        $shortcode = wpcf_usermeta_get_shortcode($field, $add);
    } else {
        $shortcode = wpcf_fields_get_shortcode($field, $add);
    }
    return $shortcode;
}
开发者ID:SpencerNeitzke,项目名称:types,代码行数:17,代码来源:skype.php


示例6: wpcf_fields_url_editor_submit

/**
 * Editor callback form submit.
 */
function wpcf_fields_url_editor_submit()
{
    $add = '';
    if (!empty($_POST['title'])) {
        $add .= ' title="' . strval($_POST['title']) . '"';
    }
    $add .= ' class=""';
    $field = wpcf_admin_fields_get_field($_GET['field_id']);
    if (!empty($field)) {
        $shortcode = wpcf_fields_get_shortcode($field, $add);
        echo wpcf_admin_fields_popup_insert_shortcode_js($shortcode);
        die;
    }
}
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:17,代码来源:url.php


示例7: wpcf_fields_numeric_editor_submit

/**
 * Editor callback form submit.
 */
function wpcf_fields_numeric_editor_submit()
{
    $add = '';
    if (!empty($_POST['format'])) {
        $add .= ' format="' . strval($_POST['format']) . '"';
    }
    $field = wpcf_admin_fields_get_field($_GET['field_id']);
    if (!empty($field)) {
        $shortcode = wpcf_fields_get_shortcode($field, $add);
        wpcf_admin_fields_save_field_last_settings($_GET['field_id'], array('format' => $_POST['format']));
        echo editor_admin_popup_insert_shortcode_js($shortcode);
        die;
    }
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:17,代码来源:numeric.php


示例8: wpcf_fields_checkbox_editor_submit

/**
 * Editor callback form submit.
 */
function wpcf_fields_checkbox_editor_submit()
{
    $add = '';
    $field = wpcf_admin_fields_get_field($_GET['field_id']);
    if (!empty($field)) {
        if ($_POST['display'] == 'value') {
            $shortcode = '[types field="' . $field['slug'] . '" state="checked"]' . $_POST['display_value_selected'] . '[/types] ';
            $shortcode .= '[types field="' . $field['slug'] . '" state="unchecked"]' . $_POST['display_value_not_selected'] . '[/types]';
        } else {
            $shortcode = wpcf_fields_get_shortcode($field, $add);
        }
        echo wpcf_admin_fields_popup_insert_shortcode_js($shortcode);
        die;
    }
}
开发者ID:sriram911,项目名称:pls,代码行数:18,代码来源:checkbox.php


示例9: wpcf_fields_radio_editor_submit

/**
 * Editor callback form submit.
 */
function wpcf_fields_radio_editor_submit()
{
    $add = '';
    $field = wpcf_admin_fields_get_field($_GET['field_id']);
    if (!empty($field)) {
        if ($_POST['display'] == 'value' && !empty($_POST['options'])) {
            $shortcode = '';
            foreach ($_POST['options'] as $option_id => $value) {
                $shortcode .= '[types field="' . $field['slug'] . '" option="' . $option_id . '"]' . $value . '[/types] ';
            }
        } else {
            $shortcode = wpcf_fields_get_shortcode($field, $add);
        }
        echo wpcf_admin_fields_popup_insert_shortcode_js($shortcode);
        die;
    }
}
开发者ID:rdbartlett,项目名称:kellyspencer.co.nz,代码行数:20,代码来源:radio.php


示例10: wpcf_fields_audio_editor_submit

/**
 * Editor callback form submit.
 */
function wpcf_fields_audio_editor_submit($data, $field, $context)
{
    $add = '';
    if (!empty($data['loop'])) {
        $add .= " loop=\"{$data['loop']}\"";
    }
    if (!empty($data['autoplay'])) {
        $add .= " autoplay=\"{$data['autoplay']}\"";
    }
    if (!empty($data['preload'])) {
        $add .= " preload=\"{$data['preload']}\"";
    }
    if ($context == 'usermeta') {
        $add .= wpcf_get_usermeta_form_addon_submit();
        $shortcode = wpcf_usermeta_get_shortcode($field, $add);
    } else {
        $shortcode = wpcf_fields_get_shortcode($field, $add);
    }
    return $shortcode;
}
开发者ID:CrankMaster336,项目名称:FFW-TR,代码行数:23,代码来源:audio.php


示例11: wpcf_fields_radio_editor_submit

/**
 * Editor callback form submit.
 */
function wpcf_fields_radio_editor_submit($data, $field, $context)
{
    $add = '';
    $types_attr = $context == 'usermeta' ? 'usermeta' : 'field';
    if ($context == 'usermeta') {
        $add .= wpcf_get_usermeta_form_addon_submit();
    }
    if (isset($data['display']) && $data['display'] == 'value' && !empty($data['options'])) {
        $shortcode = '';
        foreach ($data['options'] as $option_id => $value) {
            $shortcode .= '[types ' . $types_attr . '="' . $field['slug'] . '" ' . $add . ' option="' . $option_id . '"]' . $value . '[/types] ';
        }
    } else {
        if ($context == 'usermeta') {
            $shortcode = wpcf_usermeta_get_shortcode($field, $add);
        } else {
            $shortcode = wpcf_fields_get_shortcode($field, $add);
        }
    }
    return $shortcode;
}
开发者ID:nhainam,项目名称:wordpress4,代码行数:24,代码来源:radio.php


示例12: _thickbox_check_submit

 /**
  * Process if submitted.
  *
  * Field should provide callback function
  * that will be called automatically.
  *
  * Function should be named like:
  * 'wpcf_fields_' . $field_type . '_editor_submit'
  * e.g. 'wpcf_fields_checkbox_editor_submit'
  *
  * Function should return shortcode string.
  */
 function _thickbox_check_submit()
 {
     if (!empty($_POST['__types_editor_nonce']) && wp_verify_nonce($_POST['__types_editor_nonce'], 'types_editor_frame')) {
         $function = 'wpcf_fields_' . strtolower($this->field['type']) . '_editor_submit';
         if (function_exists($function)) {
             /*
              * Callback
              */
             $shortcode = call_user_func($function, $_POST, $this->field, $this->_meta_type);
         } else {
             /*
              * Generic
              */
             if ($this->_meta_type == 'usermeta') {
                 $add = wpcf_get_usermeta_form_addon_submit();
                 $shortcode = wpcf_usermeta_get_shortcode($this->field, $add);
             } else {
                 $shortcode = wpcf_fields_get_shortcode($this->field);
             }
         }
         if (!empty($shortcode)) {
             /**
              * remove <script> tag from all data
              * remove not allowed tags from shortcode using wp_kses_post
              */
             $shortcode = preg_replace('@</?script[^>]*>@im', '', wp_kses_post($shortcode));
             // Add additional parameters if required
             $shortcode = $this->_add_parameters_to_shortcode($shortcode, $_POST);
             // Insert shortcode
             echo '<script type="text/javascript">jQuery(function(){tedFrame.close(\'' . $shortcode . '\', \'' . esc_js($shortcode) . '\');});</script>';
         } else {
             echo '<div class="message error"><p>' . __('Shortcode generation failed', 'wpcf') . '</p></div>';
         }
         wpcf_admin_ajax_footer();
         die;
     }
 }
开发者ID:santikrass,项目名称:apache,代码行数:49,代码来源:editor.php


示例13: wpcf_fields_file_editor_submit

/**
 * Editor callback form submit.
 */
function wpcf_fields_file_editor_submit()
{
    $add = '';
    if (!empty($_POST['link'])) {
        $add .= ' link="true"';
        if (!empty($_POST['title'])) {
            $add .= ' title="' . strval($_POST['title']) . '"';
        }
    }
    if (!empty($_POST['class'])) {
        $add .= ' class="' . $_POST['class'] . '"';
    }
    if (!empty($_POST['style'])) {
        $add .= ' style="' . $_POST['style'] . '"';
    }
    $field = wpcf_admin_fields_get_field($_GET['field_id']);
    if (!empty($field)) {
        $shortcode = wpcf_fields_get_shortcode($field, $add);
        wpcf_admin_fields_save_field_last_settings($_GET['field_id'], $_POST);
        echo editor_admin_popup_insert_shortcode_js($shortcode);
        die;
    }
}
开发者ID:par-orillonsoft,项目名称:Wishmagnet,代码行数:26,代码来源:file.php


示例14: wpcf_admin_post_editor_addon_menus_filter

/**
 * Adds items to view dropdown.
 * 
 * @param type $items
 * @return type 
 */
function wpcf_admin_post_editor_addon_menus_filter($items)
{
    $groups = wpcf_admin_fields_get_groups();
    $add = array();
    if (!empty($groups)) {
        // $group_id is blank therefore not equal to $group['id']
        // use array for item key and CSS class
        $item_styles = array();
        $all_post_types = implode(' ', get_post_types(array('public' => true)));
        foreach ($groups as $group_id => $group) {
            $fields = wpcf_admin_fields_get_fields_by_group($group['id'], 'slug', true, false, true);
            if (!empty($fields)) {
                // code from Types used here without breaking the flow
                // get post types list for every group or apply all
                $post_types = get_post_meta($group['id'], '_wp_types_group_post_types', true);
                if ($post_types == 'all') {
                    $post_types = $all_post_types;
                }
                $post_types = trim(str_replace(',', ' ', $post_types));
                $item_styles[$group['name']] = $post_types;
                foreach ($fields as $field_id => $field) {
                    // Get field data
                    $data = wpcf_fields_type_action($field['type']);
                    // Get inherited field
                    if (isset($data['inherited_field_type'])) {
                        $inherited_field_data = wpcf_fields_type_action($data['inherited_field_type']);
                    }
                    $callback = '';
                    if (isset($data['editor_callback'])) {
                        $callback = sprintf($data['editor_callback'], $field['id']);
                    } else {
                        // Set callback if function exists
                        $function = 'wpcf_fields_' . $field['type'] . '_editor_callback';
                        $callback = function_exists($function) ? 'wpcfFieldsEditorCallback(\'' . $field['id'] . '\')' : '';
                    }
                    $add[$group['name']][stripslashes($field['name'])] = array(stripslashes($field['name']), trim(wpcf_fields_get_shortcode($field), '[]'), $group['name'], $callback);
                    // Process JS
                    if (!empty($data['meta_box_js'])) {
                        foreach ($data['meta_box_js'] as $handle => $data_script) {
                            if (isset($data_script['inline'])) {
                                add_action('admin_footer', $data_script['inline']);
                                continue;
                            }
                            $deps = !empty($data_script['deps']) ? $data_script['deps'] : array();
                            wp_enqueue_script($handle, $data_script['src'], $deps, WPCF_VERSION);
                        }
                    }
                    // Process CSS
                    if (!empty($data['meta_box_css'])) {
                        foreach ($data['meta_box_css'] as $handle => $data_script) {
                            $deps = !empty($data_script['deps']) ? $data_script['deps'] : array();
                            if (isset($data_script['inline'])) {
                                add_action('admin_header', $data_script['inline']);
                                continue;
                            }
                            wp_enqueue_style($handle, $data_script['src'], $deps, WPCF_VERSION);
                        }
                    }
                }
            }
        }
    }
    $search_key = '';
    // Iterate all items to be displayed in the "V" menu
    foreach ($items as $key => $item) {
        if ($key == __('Basic', 'wpv-views')) {
            $search_key = 'found';
            continue;
        }
        if ($search_key == 'found') {
            $search_key = $key;
        }
        if ($key == __('Field', 'wpv-views') && isset($item[trim(wpcf_types_get_meta_prefix(), '-')])) {
            unset($items[$key][trim(wpcf_types_get_meta_prefix(), '-')]);
        }
    }
    if (empty($search_key) || $search_key == 'found') {
        $search_key = count($items);
    }
    $insert_position = array_search($search_key, array_keys($items));
    $part_one = array_slice($items, 0, $insert_position);
    $part_two = array_slice($items, $insert_position);
    $items = $part_one + $add + $part_two;
    // apply CSS styles to each item based on post types
    foreach ($items as $key => $value) {
        if (isset($item_styles[$key])) {
            $items[$key]['css'] = $item_styles[$key];
        } else {
            $items[$key]['css'] = $all_post_types;
        }
    }
    return $items;
}
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:99,代码来源:fields-post.php


示例15: wpcf_fields_embed_editor_submit

/**
 * Editor callback form submit.
 */
function wpcf_fields_embed_editor_submit($data, $field, $context)
{
    $add = '';
    if (!empty($data['width'])) {
        $add .= " width=\"{$data['width']}\"";
    }
    if (!empty($data['height'])) {
        $add .= " height=\"{$data['height']}\"";
    }
    if ($context == 'usermeta') {
        $add .= wpcf_get_usermeta_form_addon_submit();
        $shortcode = wpcf_usermeta_get_shortcode($field, $add);
    } else {
        $shortcode = wpcf_fields_get_shortcode($field, $add);
    }
    return $shortcode;
}
开发者ID:CrankMaster336,项目名称:FFW-TR,代码行数:20,代码来源:embed.php


示例16: wpcf_fields_video_editor_submit

/**
 * Editor callback form submit.
 */
function wpcf_fields_video_editor_submit($data, $field, $context)
{
    $add = '';
    if (!empty($data['width'])) {
        $add .= " width=\"{$data['width']}\"";
    }
    if (!empty($data['height'])) {
        $add .= " height=\"{$data['height']}\"";
    }
    if (!empty($data['poster'])) {
        $add .= " poster=\"{$data['poster']}\"";
    }
    if (!empty($data['loop'])) {
        $add .= " loop=\"{$data['loop']}\"";
    }
    if (!empty($data['autoplay'])) {
        $add .= " autoplay=\"{$data['autoplay']}\"";
    }
    if (!empty($data['preload'])) {
        $add .= " preload=\"{$data['preload']}\"";
    }
    if ($context == 'usermeta') {
        $add .= wpcf_get_usermeta_form_addon_submit();
        $shortcode = wpcf_usermeta_get_shortcode($field, $add);
    } elseif ($context == 'termmeta') {
        $add .= wpcf_get_termmeta_form_addon_submit();
        $shortcode = wpcf_termmeta_get_shortcode($field, $add);
    } else {
        $shortcode = wpcf_fields_get_shortcode($field, $add);
    }
    return $shortcode;
}
开发者ID:lytranuit,项目名称:wordpress,代码行数:35,代码来源:video.php


示例17: wpcf_fields_checkbox_editor_submit

/**
 * Editor callback form submit.
 */
function wpcf_fields_checkbox_editor_submit($data, $field, $context)
{
    $add = '';
    $types_attr = 'field';
    if ($context == 'usermeta') {
        $add .= wpcf_get_usermeta_form_addon_submit();
        $types_attr = 'usermeta';
    }
    if (isset($data['display']) && $data['display'] == 'value') {
        $checked_add = $add . ' state="checked"';
        $unchecked_add = $add . ' state="unchecked"';
        if ($context == 'usermeta') {
            $shortcode_checked = wpcf_usermeta_get_shortcode($field, $checked_add, $data['selected']);
            $shortcode_unchecked = wpcf_usermeta_get_shortcode($field, $unchecked_add, $data['not_selected']);
        } else {
            $shortcode_checked = wpcf_fields_get_shortcode($field, $checked_add, $data['selected']);
            $shortcode_unchecked = wpcf_fields_get_shortcode($field, $unchecked_add, $data['not_selected']);
        }
        $shortcode = $shortcode_checked . $shortcode_unchecked;
    } else {
        if ($context == 'usermeta') {
            $shortcode = wpcf_usermeta_get_shortcode($field, $add);
        } else {
            $shortcode = wpcf_fields_get_shortcode($field, $add);
        }
    }
    return $shortcode;
}
开发者ID:chrismathers,项目名称:premierplacement,代码行数:31,代码来源:checkbox.php


示例18: wpcf_admin_post_editor_addon_menus_filter

/**
 * Adds items to view dropdown.
 * 
 * @param type $items
 * @return type 
 */
function wpcf_admin_post_editor_addon_menus_filter($items)
{
    $groups = wpcf_admin_fields_get_groups();
    $add = array();
    if (!empty($groups)) {
        foreach ($groups as $group_id => $group) {
            $fields = wpcf_admin_fields_get_fields_by_group($group['id'], 'slug', true, false, true);
            if (!empty($fields)) {
                foreach ($fields as $field_id => $field) {
                    // Get field data
                    $data = wpcf_fields_type_action($field['type']);
                    // Get inherited field
                    if (isset($data['inherited_field_type'])) {
                        $inherited_field_data = wpcf_fields_type_action($data['inherited_field_type']);
                    }
                    $callback = '';
                    if (isset($data['editor_callback'])) {
                        $callback = sprintf($data['editor_callback'], $field['id']);
                    } else {
                        // Set callback if function exists
                        $function = 'wpcf_fields_' . $field['type'] . '_editor_callback';
                        $callback = function_exists($function) ? 'wpcfFieldsEditorCallback(\'' . $field['id'] . '\')' : '';
                    }
                    $add[$group['name']][stripslashes($field['name'])] = array(stripslashes($field['name']), trim(wpcf_fields_get_shortcode($field), '[]'), $group['name'], $callback);
                    // Process JS
                    if (!empty($data['meta_box_js'])) {
                        foreach ($data['meta_box_js'] as $handle => $data_script) {
                            if (isset($data_script['inline'])) {
                                add_action('admin_footer', $data_script['inline']);
                                continue;
                            }
                            $deps = !empty($data_script['deps']) ? $data_script['deps'] : array();
                            wp_enqueue_script($handle, $data_script['src'], $deps, WPCF_VERSION);
                        }
                    }
                    // Process CSS
                    if (!empty($data['meta_box_css'])) {
                        foreach ($data['meta_box_css'] as $handle => $data_script) {
                            $deps = !empty($data_script['deps']) ? $data_script['deps'] : array();
                            if (isset($data_script['inline'])) {
                                add_action('admin_header', $data_script['inline']);
                                continue;
                            }
                            wp_enqueue_style($handle, $data_script['src'], $deps, WPCF_VERSION);
                        }
                    }
                }
            }
        }
    }
    $search_key = '';
    foreach ($items as $key => $item) {
        if ($key == __('Basic', 'wpv-views')) {
            $search_key = 'found';
            continue;
        }
        if ($search_key == 'found') {
            $search_key = $key;
        }
        if ($key == __('Field', 'wpv-views') && isset($item[trim(wpcf_types_get_meta_prefix(), '-')])) {
            unset($items[$key][trim(wpcf_types_get_meta_prefix(), '-')]);
        }
    }
    if (empty($search_key) || $search_key == 'found') {
        $search_key = count($items);
    }
    $insert_position = array_search($search_key, array_keys($items));
    $part_one = array_slice($items, 0, $insert_position);
    $part_two = array_slice($items, $insert_position);
    $items = $part_one + $add + $part_two;
    return $items;
}
开发者ID:rdbartlett,项目名称:kellyspencer.co.nz,代码行数:78,代码来源:fields-post.php


示例19: wpcf_fields_date_editor_form_submit

/**
 * Inserts shortcode in editor.
 * 
 * @return type 
 */
function wpcf_fields_date_editor_form_submit()
{
    require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php';
    if (!isset($_POST['wpcf']['field_id'])) {
        return false;
    }
    $field = wpcf_admin_fields_get_field($_POST['wpcf']['field_id']);
    if (empty($field)) {
        return false;
    }
    $add = ' ';
    $style = isset($_POST['wpcf']['style']) ? $_POST['wpcf']['style'] : 'text';
    $add .= 'style="' . $style . '"';
    $format = '';
    if ($style == 'text') {
        if ($_POST['wpcf']['format'] == 'custom') {
            $format = $_POST['wpcf']['format-custom'];
        } else {
            $format = $_POST['wpcf']['format'];
        }
        if (empty($format)) {
            $format = get_option('date_format');
        }
        $add .= ' format="' . $format . '"';
    }
    $shortcode = wpcf_fields_get_shortcode($field, $add);
    wpcf_admin_fields_save_field_last_settings($_POST['wpcf']['field_id'], array('style' => $style, 'format' => $_POST['wpcf']['format'], 'format-custom' => $_POST['wpcf']['format-custom']));
    echo editor_admin_popup_insert_shortcode_js($shortcode);
    die;
}
开发者ID:par-orillonsoft,项目名称:Wishmagnet,代码行数:35,代码来源:date.php


示例20: wpcf_admin_post_editor_addon_menus_filter

/**
 * Adds items to view dropdown.
 *
 * Core function. Works and stable. Do not move or change.
 * If required, add hooks only.
 *
 * @todo Remove (to WPCF_WPViews)
 *
 * @param type $menu
 * @return type
 */
function wpcf_admin_post_editor_addon_menus_filter($menu)
{
    global $wpcf;
    $post = wpcf_admin_get_edited_post();
    if (empty($post)) {
        $post = (object) array('ID' => -1);
    }
    $groups = wpcf_admin_fields_get_groups('wp-types-group', 'group_active');
    $all_post_types = implode(' ', get_post_types(array('public' => true)));
    $add = array();
    if (!empty($groups)) {
        // $group_id is blank therefore not equal to $group['id']
        // use array for item key and CSS class
        $item_styles = array();
        foreach ($groups as $group_id => $group) {
            $fields = wpcf_admin_fields_get_fields_by_group($group['id'], 'slug', true, false, true);
            if (!empty($fields)) {
                // code from Types used here without breaking the flow
                // get post types list for every group or apply all
                $post_types = get_post_meta($group['id'], '_wp_types_group_post_types', true);
                if ($post_types == 'all') {
                    $post_types = $all_post_types;
                }
                $post_types = trim(str_replace(',', ' ', $post_types));
                $item_styles[$group['name']] = $post_types;
                foreach ($fields as $field_id => $field) {
                    // Use field class
                    $wpcf->field->set($wpcf->post, $field);
                    // Get field data
                    $data = (array) $wpcf->field->config;
                    // Get inherited field
                    if (isset($data['inherited_field_type'])) {
                        $inherited_field_data = wpcf_fields_type_action($data['inherited_field_type']);
                    }
                    $callback = 'wpcfFieldsEditorCallback(\'' . $field['id'] . '\', \'postmeta\', ' . $post->ID . ')';
                    $menu[$group['name']][stripslashes($field['name'])] = array(stripslashes($field['name']), trim(wpcf_fields_get_shortcode($field), '[]'), $group['name'], $callback);
                    /*
                     * Since Types 1.2
                     * We use field class to enqueue JS and CSS
                     */
                    $wpcf->field->enqueue_script();
                    $wpcf->field->enqueue_style();
                }
            }
        }
    }
    /*
        $search_key = '';
    
        // Iterate all items to be displayed in the "V" menu
        foreach ( $items as $key => $item ) {
            if ( $key == __( 'Basic', 'wpv-views' ) ) {
                $search_key = 'found';
                continue;
            }
            if ( $search_key == 'found' ) {
                $search_key = $key;
            }
    
            if ( $key == __( 'Field', 'wpv-views' ) && isset( $item[trim( wpcf_types_get_meta_prefix(),
                                    '-' )] ) ) {
                unset( $items[$key][trim( wpcf_types_get_meta_prefix(), '-' )] );
            }
        }
        if ( empty( $search_key ) || $search_key == 'found' ) {
            $search_key = count( $items );
        }
    
        $insert_position = array_search( $search_key, array_keys( $items ) );
        $part_one = array_slice( $items, 0, $insert_position );
        $part_two = array_slice( $items, $insert_position );
        $items = $part_one + $add + $part_two;
    
        // apply CSS styles to each item based on post types
        foreach ( $items as $key => $value ) {
            if ( isset( $item_styles[$key] ) ) {
                $items[$key]['css'] = $item_styles[$key];
            } else {
                $items[$key]['css'] = $all_post_types;
            }
        }
    */
    return $menu;
}
开发者ID:SpencerNeitzke,项目名称:types,代码行数:95,代码来源:fields-post.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP wpcf_fields_type_action函数代码示例发布时间:2022-05-23
下一篇:
PHP wpcf_fields_get_field_form_data函数代码示例发布时间: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