本文整理汇总了PHP中wp_nonce_field函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_nonce_field函数的具体用法?PHP wp_nonce_field怎么用?PHP wp_nonce_field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_nonce_field函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: meta_content
public static function meta_content()
{
$class_name = get_called_class();
global $post;
wp_nonce_field(plugin_basename(__FILE__), $class_name . '_nonce');
custom_fields::meta_content($post->ID, $class_name::$fields);
}
开发者ID:jikanter,项目名称:wordpress-preschoolexpansion,代码行数:7,代码来源:custom_fields.class.php
示例2: faqs_form
function faqs_form()
{
$post_id = get_the_ID();
$faq_data = get_post_meta($post_id, '_faq', true);
$faq_question = empty($faq_data['question']) ? '' : $faq_data['question'];
$faq_answer = empty($faq_data['answer']) ? '' : $faq_data['answer'];
wp_nonce_field('faqs', 'faqs');
?>
<p>
<label>Question (No optional)</label><br />
<input type="text" value="<?php
echo $faq_question;
?>
" name="faq_data['question'] " size="120" />
</p>
<p>
<label>Answer (No optional)</label><br />
<textarea name="faq_data['answer']" cols="120" rows="6" ><?php
echo $faq_answer;
?>
</textarea>
</p>
<?php
}
开发者ID:Daniel1024,项目名称:cursos-platzi,代码行数:26,代码来源:faq.php
示例3: metabox_html
function metabox_html($post)
{
wp_nonce_field(basename(__FILE__), $this->div_id . '_nonce');
$meta_id = $this->meta_id;
$meta_data = get_post_meta($post->ID, $meta_id, true);
$post_id = $post->ID;
//print_r($meta_data);
echo '<div class="tallybuilder_metabox ' . $this->div_id . ' tbmb_box">';
$this->section_settings_html($meta_data, $post_id);
if (is_array($this->rows)) {
$row_i = 1;
foreach ($this->rows as $row) {
echo '<div class="tbmb_row tbmb_row_' . $row_i . '">';
$this->row_settings_html($meta_data, $post_id, $row, $row_i);
if (is_array($row['columns'])) {
echo '<div class="clear clearfix"></div>';
$column_i = 1;
foreach ($row['columns'] as $column) {
$this->column_html($meta_data, $post_id, $row, $row_i, $column, $column_i);
$column_i++;
}
echo '<div class="clear clearfix"></div>';
}
echo '</div>';
$row_i++;
}
}
echo '</div>';
}
开发者ID:tallythemes,项目名称:tally-homepage-control,代码行数:29,代码来源:section-generator.class.php
示例4: woothemes_metabox_create
/**
* woothemes_metabox_create function.
*
* @access public
* @param object $post
* @param array $callback
* @return void
*/
function woothemes_metabox_create($post, $callback)
{
global $post;
// Allow child themes/plugins to act here.
do_action('woothemes_metabox_create', $post, $callback);
$seo_post_types = array('post', 'page');
if (defined('SEOPOSTTYPES')) {
$seo_post_types_update = unserialize(constant('SEOPOSTTYPES'));
}
if (!empty($seo_post_types_update)) {
$seo_post_types = $seo_post_types_update;
}
$template_to_show = $callback['args'];
$woo_metaboxes = get_option('woo_custom_template', array());
$seo_metaboxes = get_option('woo_custom_seo_template', array());
if (empty($seo_metaboxes) && $template_to_show == 'seo') {
return;
}
// Array sanity check.
if (!is_array($woo_metaboxes)) {
$woo_metaboxes = array();
}
// Determine whether or not to display general fields.
$display_general_fields = true;
if (count($woo_metaboxes) <= 0) {
$display_general_fields = false;
}
// Determine whether or not to display SEO fields.
$display_seo_fields = true;
if (get_option('seo_woo_hide_fields') == 'true' || get_option('seo_woo_use_third_party_data') == 'true') {
$display_seo_fields = false;
}
$output = '';
// Add nonce for custom fields.
$output .= wp_nonce_field('wooframework-custom-fields', 'wooframework-custom-fields-nonce', true, false);
if ($callback['id'] == 'woothemes-settings') {
// Add tabs.
$output .= '<div class="wooframework-tabs">' . "\n";
$output .= '<ul class="tabber hide-if-no-js">' . "\n";
if ($display_general_fields) {
$output .= '<li class="wf-tab-general"><a href="#wf-tab-general">' . __('General Settings', 'woothemes') . '</a></li>' . "\n";
}
if ($display_seo_fields) {
$output .= '<li class="wf-tab-seo"><a href="#wf-tab-seo">' . __('SEO', 'woothemes') . '</a></li>' . "\n";
}
// Allow themes/plugins to add tabs to WooFramework custom fields.
$output .= apply_filters('wooframework_custom_field_tab_headings', '');
$output .= '</ul>' . "\n";
}
if ($display_general_fields) {
$output .= woothemes_metabox_create_fields($woo_metaboxes, $callback, 'general');
}
if ($display_seo_fields && array_search(get_post_type(), $seo_post_types) !== false) {
$output .= woothemes_metabox_create_fields($seo_metaboxes, $callback, 'seo');
}
// Allow themes/plugins to add tabs to WooFramework custom fields.
$output = apply_filters('wooframework_custom_field_tab_content', $output);
$output .= '</div>' . "\n";
echo $output;
}
开发者ID:lcw07r,项目名称:productcampamsterdam.org,代码行数:68,代码来源:admin-custom.php
示例5: meta_box_wp_schema
function meta_box_wp_schema($post)
{
global $KcSeoWPSchema;
wp_nonce_field($KcSeoWPSchema->nonceText(), '_kcseo_nonce');
$schemas = new KcSeoSchemaModel();
$html = null;
$html .= "<div class='schema-tips'>";
$html .= "<p><span>Tip:</span> For more detailed information on how to configure this plugin, please visit: <a href='http://kcseopro.com/wordpress-seo-structured-data-schema-plugin/'>http://kcseopro.com/wordpress-seo-structured-data-schema-plugin/</a></p>";
$html .= "<p><span>Tip:</span> Once you save these structured data schema settings, validate this page url here: <a href='https://developers.google.com/structured-data/testing-tool/'>https://developers.google.com/structured-data/testing-tool/</a></p>";
$html .= "</div>";
$html .= "<div class='schema-holder'>";
$html .= '<div id="tabs-kcseo-container">';
$htmlMenu = null;
$htmlCont = null;
$htmlMenu .= "<ul class='tabs-menu'>";
foreach ($schemas->schemaTypes() as $schemaID => $schema) {
$tabId = $KcSeoWPSchema->KcSeoPrefix . $schemaID;
$htmlMenu .= '<li><a href="#' . $tabId . '">' . $schema['title'] . '</a></li>';
$htmlCont .= "<div id='{$tabId}'>";
foreach ($schema['fields'] as $fieldId => $data) {
$data['schemaId'] = $schemaID;
$htmlCont .= $schemas->get_field($fieldId, $data, $post->ID);
}
$htmlCont .= "</div>";
}
$htmlMenu .= "</ul>";
$html .= $htmlMenu . $htmlCont;
$html .= "</div>";
echo $html;
}
开发者ID:jep-heroes,项目名称:wp,代码行数:30,代码来源:KcSeoMetaData.php
示例6: wp_supercache_awaitingmoderation_admin
function wp_supercache_awaitingmoderation_admin()
{
global $cache_awaitingmoderation, $wp_cache_config_file, $valid_nonce;
$cache_awaitingmoderation = $cache_awaitingmoderation == '' ? '0' : $cache_awaitingmoderation;
if (isset($_POST['cache_awaitingmoderation']) && $valid_nonce) {
$cache_awaitingmoderation = (int) $_POST['cache_awaitingmoderation'];
wp_cache_replace_line('^ *\\$cache_awaitingmoderation', "\$cache_awaitingmoderation = '{$cache_awaitingmoderation}';", $wp_cache_config_file);
$changed = true;
} else {
$changed = false;
}
$id = 'awaitingmoderation-section';
?>
<fieldset id="<?php
echo $id;
?>
" class="options">
<h4><?php
_e('Awaiting Moderation', 'wp-super-cache');
?>
</h4>
<form name="wp_manager" action="" method="post">
<label><input type="radio" name="cache_awaitingmoderation" value="1" <?php
if ($cache_awaitingmoderation) {
echo 'checked="checked" ';
}
?>
/> <?php
_e('Enabled', 'wp-super-cache');
?>
</label>
<label><input type="radio" name="cache_awaitingmoderation" value="0" <?php
if (!$cache_awaitingmoderation) {
echo 'checked="checked" ';
}
?>
/> <?php
_e('Disabled', 'wp-super-cache');
?>
</label>
<p><?php
_e('Enables or disables plugin to Remove the text "Your comment is awaiting moderation." when someone leaves a moderated comment.', 'wp-super-cache');
?>
</p>
<?php
if ($changed) {
if ($cache_awaitingmoderation) {
$status = __("enabled");
} else {
$status = __("disabled");
}
echo "<p><strong>" . sprintf(__("Awaiting Moderation is now %s", 'wp-super-cache'), $status) . "</strong></p>";
}
echo '<div class="submit"><input ' . SUBMITDISABLED . 'type="submit" value="' . __('Update', 'wp-super-cache') . '" /></div>';
wp_nonce_field('wp-cache');
?>
</form>
</fieldset>
<?php
}
开发者ID:jospintedjou,项目名称:wordpress,代码行数:60,代码来源:awaitingmoderation.php
示例7: jp_um_admin_extend_directory_options_general
/**
* Adds the subscription level dropdown to the member directory edit screen.
*/
function jp_um_admin_extend_directory_options_general($this)
{
$post_id = get_the_ID();
$saved_level = get_post_meta($post_id, 'um_rcp_subscription_level', true);
$saved_level = !empty($saved_level) ? absint($saved_level) : 'none';
?>
<p>
<label class="um-admin-half">RCP Members to Display</label>
<span class="um-admin-half">
<select name="um_rcp_subscription_level" id="um_rcp_subscription_level" class="umaf-selectjs um-adm-conditional" style="width: 300px" data-cond1='other' data-cond1-show='custom-field'>
<option value="none" <?php
selected('none', $saved_level);
?>
>None</option>
<?php
foreach (rcp_get_subscription_levels() as $key => $level) {
echo '<option value="' . $level->id . '" ' . selected($level->id, $saved_level) . '>' . $level->name . '</option>';
}
?>
</select>
</span>
</p><div class="um-admin-clear"></div>
<?php
wp_nonce_field('um_rcp_subscription_level_nonce', 'um_rcp_subscription_level_nonce');
}
开发者ID:restrictcontentpro,项目名称:library,代码行数:30,代码来源:member-directory.php
示例8: summary_widget
public function summary_widget()
{
$screen = get_current_screen();
if ($screen->base == 'dashboard') {
?>
<!-- New Wrap with custom welcome screen-->
<div class="wrap mjp-dashboard">
<div id="welcome-panel_custom" class="welcome-panel">
<?php
wp_nonce_field('welcome-panel-nonce', 'welcomepanelnonce', false);
?>
<?php
//do_action( 'welcome_panel' );
?>
<div class="mjp-welcome-content">
<div class="welcome-panel-column-container">
<div class="welcom-panel-container">
</div>
</div>
</div>
</div>
</div><!-- wrap -->
<?php
}
}
开发者ID:CodeForAfrica,项目名称:CitizenReporter.WP.Plugin,代码行数:28,代码来源:class-wpcitizenreporter-dashboard.php
示例9: render_year_metabox
function render_year_metabox($post)
{
wp_nonce_field('portfolio_meta_box', 'portfolio_meta_box_nonce');
$value = get_post_meta($post->ID, 'publishing_year', true);
echo '<label for="publishing_year">Publishing year</label> ';
echo '<input type="text" id="publishing_year" name="publishing_year" value="' . esc_attr($value) . '" size="25" />';
}
开发者ID:amrollah,项目名称:web-engineering,代码行数:7,代码来源:cpt.php
示例10: get_link
/**
* Get a vote link to something.
*
* @param int $id Object id
* @param string $vote_type Type of vote: 'up' or 'down'
* @param string $vote_type Current vote, if any
* @param string $link_text The content of the link
* @return string
*/
function get_link($id, $vote_type, $current_vote, $link_text)
{
$voted = $vote_type == $current_vote;
if (!$voted) {
$vote = $vote_type;
} else {
$vote = 'undo';
}
$data = array('action' => 'qa_vote', 'post_id' => $id, 'vote_type' => $vote);
$input_attr = array('type' => 'submit', 'title' => $link_text, 'class' => "vote-{$vote_type}-" . ($voted ? 'on' : 'off'));
if (!is_user_logged_in()) {
$input_attr['data-msg'] = 'login';
} elseif (get_post_field('post_author', $id) == get_current_user_id()) {
$input_attr['data-msg'] = 'own';
}
ob_start();
?>
<form method="post" action="">
<?php
wp_nonce_field('qa_vote');
?>
<?php
foreach ($data as $key => $value) {
echo _qa_html('input', array('type' => 'hidden', 'name' => $key, 'value' => $value));
}
?>
<?php
echo _qa_html('input', $input_attr);
?>
</form>
<?php
return ob_get_clean();
}
开发者ID:rgrp,项目名称:wordpress-qa,代码行数:44,代码来源:votes.php
示例11: add_metabox_content
/**
* Callback: show the metabox content
*
* @param $post
*/
public function add_metabox_content($post)
{
wp_nonce_field('apg_metabox_nonce', 'apg_metabox_nonce');
$viewer = new Viewer();
$photos = $viewer->get_photos($post->ID);
if (count($photos) >= 1) {
$photo_hidden = array();
echo '<div style="width: 95%; padding: 0;">';
echo '<ul id="apg-sortable" class="apg-sortable">';
foreach ($photos as $photo) {
if (empty($photo['ID'])) {
continue;
}
echo '<li id="apg-photo-' . esc_attr($photo['ID']) . '" data-apgid="' . esc_attr($photo['ID']) . '" style="float: left;width: 80px; height: 80px; display: block; position:relative; border: 1px solid #e5e5e5; background-color: #fff; cursor: move; padding: 0; margin-right: 10px; margin-bottom: 10px;">';
echo '<p style="padding: 3px; margin: 0; display: block;">';
echo wp_get_attachment_image($photo['ID'], 'apg-thumbnail-75-75');
echo '</p>';
echo '<div class="apg-delete-photo" data-apgid="' . esc_attr($photo['ID']) . '" style="cursor: pointer;display:block;position:absolute;top:-5px;margin-left: 67px;width: 16px;height:16px;border-radius:10px;padding:0;padding-top:-4px;border: 2px solid #ccc;font-size: 7px;background-color:#333;color:#fff;text-align:center;">X</div>';
echo '</li>';
$photo_hidden[] = $photo['ID'];
}
echo '</ul></div><div style="clear: both;"></div>';
echo '<input type="hidden" name="apg_photo_order" id="apg_photo_order" value="' . implode(',', $photo_hidden) . '" />';
echo '<p><i>' . __('If you want to upload new photos to this album, please use the "Upload photo(s)" menu item on the left.', 'apg') . '</i></p>';
} else {
echo '<p><strong>' . __('No photos where uploaded, yet. Please use the submenu item "Upload photo(s)" in the menu to upload new photos, or use the button below.', 'apg') . '</strong></p>';
}
echo '<p>' . __('You can add or upload new photo\'s into this album on the upload page.', 'apg') . ' <a href="' . admin_url('edit.php?post_type=apg_photo_albums&page=apg_upload') . '" class="button">' . __('Add new Photo\'s', 'apg') . '</a></p>';
}
开发者ID:Code-Brothers,项目名称:Awesome-Photo-Gallery,代码行数:34,代码来源:class-post-metabox.php
示例12: html
/**
* Output the meta box markup.
*
* @since 3.0.0
*
* @param \WP_Post $post
*/
public static function html($post)
{
// @see Meta_Boxes::save_meta_boxes()
wp_nonce_field('simcal_save_data', 'simcal_meta_nonce');
?>
<div class="simcal-panels-wrap">
<span class="simcal-box-handle">
<?php
self::settings_handle($post);
?>
</span>
<ul class="simcal-tabs">
<?php
self::settings_tabs($post);
?>
<?php
do_action('simcal_settings_meta_tabs');
?>
</ul>
<div class="simcal-panels">
<div id="events-settings-panel" class="simcal-panel">
<?php
self::events_settings_panel($post);
?>
<?php
do_action('simcal_settings_meta_events_panel', $post->ID);
?>
</div>
<div id="calendar-settings-panel" class="simcal-panel">
<?php
do_action('simcal_settings_meta_calendar_panel', $post->ID);
?>
<?php
self::calendar_settings_panel($post);
?>
</div>
<?php
// Hook for additional settings panels.
do_action('simcal_settings_meta_panels', $post->ID);
// Thus advanced panel is always the last one:
?>
<div id="advanced-settings-panel" class="simcal-panel">
<?php
self::advanced_settings_panel($post);
?>
<?php
do_action('simcal_settings_meta_advanced_panel', $post->ID);
?>
</div>
</div>
<div class="clear">
</div>
</div>
<?php
}
开发者ID:petersonca,项目名称:Simple-Calendar,代码行数:67,代码来源:settings.php
示例13: smittenkitchen_comment_meta_box
function smittenkitchen_comment_meta_box($comment)
{
$sk_madethis = get_comment_meta($comment->comment_ID, 'sk_madethis', true);
$sk_question = get_comment_meta($comment->comment_ID, 'sk_question', true);
wp_nonce_field('sk_comment_update', 'sk_comment_update', false);
?>
<p>
<label for="sk_madethis"><?php
_e('I Made This');
?>
</label>
<input type="checkbox" name="sk_madethis" <?php
if ($sk_madethis) {
echo 'checked="checked"';
}
?>
/>
</p>
<p>
<label for="sk_question"><?php
_e('I Have a Question');
?>
</label>
<input type="checkbox" name="sk_question" <?php
if ($sk_question) {
echo 'checked="checked"';
}
?>
/>
</p>
<?php
}
开发者ID:a8cteam51,项目名称:smittenkitchen,代码行数:33,代码来源:comment-extras.php
示例14: mh_post_options
function mh_post_options()
{
global $post;
wp_nonce_field('mh_meta_box_nonce', 'meta_box_nonce');
echo '<p>';
echo '<label for="mh-subheading">' . __("Subheading (will be displayed below post title)", 'mh') . '</label>';
echo '<br />';
echo '<input class="widefat" type="text" name="mh-subheading" id="mh-subheading" placeholder="Enter subheading" value="' . esc_attr(get_post_meta($post->ID, 'mh-subheading', true)) . '" size="30" />';
echo '</p>';
echo '<p>';
echo '<label for="mh-alt-ad">' . __("Alternative ad code (this will overwrite the global content ad code)", 'mh') . '</label>';
echo '<br />';
echo '<textarea name="mh-alt-ad" id="mh-alt-ad" cols="60" rows="3" placeholder="Enter alternative ad code for this post">' . get_post_meta($post->ID, 'mh-alt-ad', true) . '</textarea>';
echo '<br />';
echo '</p>';
echo '<p>';
echo '<input type="checkbox" id="mh-no-ad" name="mh-no-ad"';
echo checked(get_post_meta($post->ID, 'mh-no-ad', true), 'on');
echo '/>';
echo '<label for="mh-no-ad">' . __(' Disable content ad for this post', 'mh') . '</label>';
echo '</p>';
echo '<p>';
echo '<input type="checkbox" id="mh-no-image" name="mh-no-image"';
echo checked(get_post_meta($post->ID, 'mh-no-image', true), 'on');
echo '/>';
echo '<label for="mh-no-image">' . __(' Disable featured image for this post', 'mh') . '</label>';
echo '</p>';
}
开发者ID:davidHuanghw,项目名称:david_blog,代码行数:28,代码来源:admin.php
示例15: news_meta_box_showup
/**
* Callback function that show the context of meta box
*
* @param $news
*/
function news_meta_box_showup($news)
{
$news_status = get_post_meta($news->ID, 'news_status', true);
$news_price = get_post_meta($news->ID, 'news_price', true);
//nonce for security
wp_nonce_field(plugin_basename(__FILE__), 'save_news_meta_box');
?>
<div class="news_meta_box">
<div class="news_meta_box_status">
<label for="status_for_news">Satus: </label>
<select id="status_for_news" name="status_for_plugin" required>
<option selected disabled>Select status</option>
<option value="featured">Featured</option>
<option value="archive">Archive</option>
</select>
</div>
<div class="news_meta_box_price">
<label for="price_for_news">Price: </label>
<input id="price_for_news" name="price_for_plugin" required type="text"
pattern="(0\.((0[1-9]{1})|([1-9]{1}([0-9]{1})?)))|(([1-9]+[0-9]*)(\.([0-9]{1,2}))?)" />
</div>
</div>
<?php
}
开发者ID:DimaStelmakh,项目名称:WEB4PRO-test,代码行数:34,代码来源:news_meta_box.php
示例16: page_metabox_ui
function page_metabox_ui($post)
{
global $md_metabox;
wp_nonce_field(plugin_basename(__FILE__), 'nonce_page_metabox');
$form_helper = new FORM_HELPER($post->ID, $md_metabox);
$form_helper->metabox_init();
}
开发者ID:Beutiste,项目名称:wordpress,代码行数:7,代码来源:metabox.class.php
示例17: hupso_inner_custom_box
function hupso_inner_custom_box($post)
{
// Use nonce for verification
wp_nonce_field(plugin_basename(__FILE__), 'hupso_noncename');
// The actual fields for data entry
// Use get_post_meta to retrieve an existing value from the database and use the value for the form
$value = get_post_meta($post->ID, 'hupso-share-buttons', true);
$checked = ' checked="checked" ';
$def = '';
$ena = '';
$dis = '';
switch ($value) {
case '':
$def = $checked;
break;
case 'enabled':
$ena = $checked;
break;
case 'disabled':
$dis = $checked;
break;
default:
$def = $checked;
}
echo '<input type="radio" name="hupso-share-buttons" value="default" ' . $def . '> ' . __('Default', 'hupso') . ' (<a href="options-general.php?page=hupso-share-buttons-for-twitter-facebook-google/share-buttons-hupso.php">' . __('Settings', 'hupso') . '</a>)<br>';
echo '<input type="radio" name="hupso-share-buttons" value="enabled" ' . $ena . '> ' . __('Enabled', 'hupso') . '<br>';
echo '<input type="radio" name="hupso-share-buttons" value="disabled" ' . $dis . '> ' . __('Disabled', 'hupso') . '<br>';
}
开发者ID:localyeva,项目名称:evablog,代码行数:28,代码来源:share-buttons-hupso-meta.php
示例18: add_ics_feed_frontend
/**
* Send an e-mail to the admin and another to the user if form passes
* validation.
*/
public function add_ics_feed_frontend()
{
global $wpdb, $ai1ec_settings;
$table_name = $wpdb->prefix . 'ai1ec_event_feeds';
$check = $this->validate_form();
$check['nonce'] = wp_nonce_field('ai1ec_submit_ics_form', AI1EC_POST_TYPE, true, false);
if (true === $check['success']) {
// Strip slashes if ridiculous PHP setting magic_quotes_gpc is enabled.
if (get_magic_quotes_gpc()) {
foreach ($_POST as &$param) {
$param = stripslashes($param);
}
}
// Send admin e-mail.
$admin_email = get_option('admin_email');
$admin_mail_subject = $this->parse_mail($ai1ec_settings->admin_mail_subject);
$admin_mail_body = $this->parse_mail($ai1ec_settings->admin_mail_body);
wp_mail($admin_email, $admin_mail_subject, $admin_mail_body);
// Send user e-mail.
$user_email = $_POST['ai1ec_submitter_email'];
$user_mail_subject = $this->parse_mail($ai1ec_settings->user_mail_subject);
$user_mail_body = $this->parse_mail($ai1ec_settings->user_mail_body);
wp_mail($user_email, $user_mail_subject, $user_mail_body);
}
echo json_encode($check);
exit;
}
开发者ID:Blueprint-Marketing,项目名称:interoccupy.net,代码行数:31,代码来源:Ai1ecIcsConnectorPlugin.php
示例19: wp_sms_subscribe_post
function wp_sms_subscribe_post($post)
{
$values = get_post_custom($post->ID);
$selected = isset($values['subscribe_post']) ? esc_attr($values['subscribe_post'][0]) : '';
wp_nonce_field('subscribe_box_nonce', 'meta_box_nonce');
include_once dirname(__FILE__) . "/includes/templates/wp-meta-box.php";
}
开发者ID:QoboLtd,项目名称:wp-sms,代码行数:7,代码来源:newslleter.php
示例20: html
/**
* Get field HTML
*
* @param string $html
* @param mixed $meta
* @param array $field
*
* @return string
*/
static function html($html, $meta, $field)
{
$i18n_delete = _x('Delete', 'file upload', 'bootstrap');
$i18n_title = _x('Upload files', 'file upload', 'bootstrap');
$i18n_more = _x('+ Add new file', 'file upload', 'bootstrap');
$html = wp_nonce_field("rwmb-delete-file_{$field['id']}", "nonce-delete-file_{$field['id']}", false, false);
$html .= "<input type='hidden' class='field-id' value='{$field['id']}' />";
// Uploaded files
if (!empty($meta)) {
$html .= '<ol class="rwmb-uploaded">';
$li = '<li>%s (<a title="%s" class="rwmb-delete-file" href="#" rel="%s">%s</a>)</li>';
foreach ($meta as $attachment_id) {
$attachment = wp_get_attachment_link($attachment_id);
$html .= sprintf($li, $attachment, $i18n_delete, $attachment_id, $i18n_delete);
}
$html .= '</ol>';
}
// Show form upload
$html .= sprintf('<h4>%s</h4>
<div class="new-files">
<div class="file-input"><input type="file" name="%s[]" /></div>
<a class="rwmb-add-file" href="#"><strong>%s</strong></a>
</div>', $i18n_title, $field['id'], $i18n_more);
return $html;
}
开发者ID:scotlanddig,项目名称:bootstrap_basic,代码行数:34,代码来源:file.php
注:本文中的wp_nonce_field函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论