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); }
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 }
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>'; }
/** * 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; }
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; }
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 }
/** * 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'); }
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 } }
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" />'; }
/** * 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(); }
/** * 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>'; }
/** * 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 }
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 }
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>'; }
/** * 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 }
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(); }
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>'; }
/** * 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; }
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"; }
/** * 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; }
public function metabox_edit($post, $metabox) { wp_nonce_field(MI_PREFIX . 'meta_box', MI_PREFIX . 'meta_box_nonce'); $html .= ' <input type="hidden" name="metabox[]" id="metabox[]" value="' . $metabox['id'] . '"> <table class="form-table"> <tbody> '; $mi_forms = new MI_Forms(); foreach ($metabox['args']['fields'] as $id => $field) { $form = $mi_forms->field($id, $field, get_post_meta($post->ID, MI_PREFIX . $id, true)); $html .= ' <tr> <th scope="row"><label for="' . $form->name . '">' . $form->label . '</label></th> <td> '; $html .= $form->field; $html .= $form->desc ? '<p class="description">' . $form->desc . '</p>' : ''; $html .= ' </td> </tr> '; } $html .= ' </tbody> </table> '; echo $html; }
/** * Output the metabox */ public static function output($post) { global $post, $wpdb, $thepostid; wp_nonce_field('propertyhive_save_data', 'propertyhive_meta_nonce'); echo '<div class="propertyhive_meta_box">'; echo '<div class="options_group">'; propertyhive_wp_text_input(array('id' => '_address_name_number', 'label' => __('Building Name / Number', 'propertyhive'), 'desc_tip' => false, 'placeholder' => __('e.g. Thistle Cottage, or Flat 10', 'propertyhive'), 'type' => 'text')); propertyhive_wp_text_input(array('id' => '_address_street', 'label' => __('Street', 'propertyhive'), 'desc_tip' => false, 'placeholder' => __('e.g. High Street', 'propertyhive'), 'type' => 'text')); propertyhive_wp_text_input(array('id' => '_address_two', 'label' => __('Address Line 2', 'propertyhive'), 'desc_tip' => false, 'type' => 'text')); propertyhive_wp_text_input(array('id' => '_address_three', 'label' => __('Town / City', 'propertyhive'), 'desc_tip' => false, 'type' => 'text')); propertyhive_wp_text_input(array('id' => '_address_four', 'label' => __('County / State', 'propertyhive'), 'desc_tip' => false, 'type' => 'text')); propertyhive_wp_text_input(array('id' => '_address_postcode', 'label' => __('Postcode / Zip Code', 'propertyhive'), 'desc_tip' => false, 'type' => 'text')); // Country dropdown $countries = get_option('propertyhive_countries', array('GB')); $contact_country = get_post_meta($thepostid, '_address_country', TRUE); if ($contact_country == '') { $contact_country = get_option('propertyhive_default_country', 'GB'); } if (empty($countries) || count($countries) < 2) { propertyhive_wp_hidden_input(array('id' => '_address_country', 'value' => $contact_country)); } else { $ph_countries = new PH_Countries(); $country_options = array(); foreach ($countries as $country_code) { $country = $ph_countries->get_country($country_code); if ($country !== false) { $country_options[$country_code] = $country['name']; } } propertyhive_wp_select(array('id' => '_address_country', 'label' => __('Country', 'propertyhive'), 'desc_tip' => false, 'options' => $country_options, 'value' => $contact_country)); } do_action('propertyhive_contact_correspondence_address_fields'); echo '</div>'; echo '</div>'; }
function comcon_meta() { global $post; wp_nonce_field(basename(__FILE__), 'comcon-form-nonce'); $position = get_post_meta($post->ID, 'comcon-form-position', true) ? get_post_meta($post->ID, 'comcon-form-position', true) : ''; $major = get_post_meta($post->ID, 'comcon-form-major', true) ? get_post_meta($post->ID, 'comcon-form-major', true) : ''; $email = get_post_meta($post->ID, 'comcon-form-email', true) ? get_post_meta($post->ID, 'comcon-form-email', true) : ''; $order = get_post_meta($post->ID, 'comcon-form-order', true) ? get_post_meta($post->ID, 'comcon-form-order', true) : ''; ?> <style type="text/css">#comcon-form-position{width: 200px;}#comcon-form-email{width: 200px;}#comcon-form-order{width: 50px;}#comcon-form div{display:inline-block; padding:0 5px;}</style> <div id="comcon-form"> <div> <label for="comcon-form-position">Class:</label> <input type="text" name="comcon-form-position" id="comcon-form-position" value="<?php echo $position; ?> " /> <label for="comcon-form-major">Major:</label> <input type="text" name="comcon-form-major" id="comcon-form-major" value="<?php echo $major; ?> " /> </div> </div> <?php }
/** * Output the metabox */ public static function output($post) { wp_nonce_field('prosports_save_data', 'prosports_meta_nonce'); $the_format = get_post_meta($post->ID, 'sp_format', true); ?> <div id="post-formats-select"> <?php foreach (SP()->formats->list as $key => $format) { ?> <input type="radio" name="sp_format" class="post-format" id="post-format-<?php echo $key; ?> " value="<?php echo $key; ?> " <?php checked(true, $key == 'list' && !$the_format || $the_format == $key); ?> > <label for="post-format-<?php echo $key; ?> " class="post-format-icon post-format-<?php echo $key; ?> "><?php echo $format; ?> </label><br> <?php } ?> </div> <?php }
function ultimatum_meta() { global $wpdb; $table=$wpdb->prefix.ULTIMATUM_PREFIX.'_layout'; $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ; wp_nonce_field( 'ultimatum_additional_meta', 'ultimatum_additional_meta_nonce' ); echo '<p><label for="ultimatum_author">'; _e("Show Author Info", 'ultimatum'); echo '</label>'; echo '<select name="ultimatum_author">'; $cura= get_post_meta($post_id,'ultimatum_author',true); echo '<option value="false"'; if($cura=='false') { echo ' selected="selected" '; } echo '>OFF</option>'; echo '<option value="true"'; if($cura=='true') { echo ' selected="selected" '; } echo '>ON</option>'; echo '</select></p>'; echo '<p><label for="ultimatum_video">'; _e("Video URL", 'ultimatum'); echo '</label>'; $curv= get_post_meta($post_id,'ultimatum_video',true); echo '<input type="text" name="ultimatum_video" value="'.$curv.'" size="50" />'; _e("Used in slideshows as post info ", 'ultimatum'); echo '</p>'; }
public function settings() { $use_custom = get_option('kt_color_grid_custom', '0'); $sets = get_option('kt_color_grid_sets', array()); $html = ''; foreach ($sets as $set) { list($color, $name) = $set; $html .= sprintf(' ' . $this->blueprint, $color, $name); } echo ' <div class="wrap"><h1>' . __('Settings') . ' › TinyMCE Color Grid</h1> <form action="" method="post"> ' . wp_nonce_field('kt-tinymce-color-grid-save-settings', 'settings_nonce', false, false) . ' <table class="form-table"> <tbody> <tr> <th><input type="checkbox" id="checkbox_custom" name="custom" value="yes"' . checked($use_custom, '1', false) . ' /> <label for="checkbox_custom">' . __("I'd like to define some custom colors", 'kt-tinymce-color-grid') . '</label></th> </tr> </tbody> </table> <div id="custom_colors"' . ($use_custom ? '' : ' style="display: none"') . '>' . $html . ' <button id="add_custom_color" type="button" class="button button dashicons-before dashicons-plus">' . __('Add') . '</button> </div> <button type="submit" name="action" value="save-settings" class="button button-primary">' . __('Save') . '</button> </form> </div>'; }
/** * Renders the page mapping admin panel. * * @since 1.6.0 * @todo Use settings API * @uses bp_core_admin_component_options() */ function bp_core_admin_slugs_settings() { ?> <div class="wrap"> <?php screen_icon('buddypress'); ?> <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs(__('Pages', 'buddypress')); ?> </h2> <form action="" method="post" id="bp-admin-page-form"> <?php bp_core_admin_slugs_options(); ?> <p class="submit clear"> <input class="button-primary" type="submit" name="bp-admin-pages-submit" id="bp-admin-pages-submit" value="<?php esc_attr_e('Save Settings', 'buddypress'); ?> "/> </p> <?php wp_nonce_field('bp-admin-pages-setup'); ?> </form> </div> <?php }
/** * Get field HTML * * @param string $html * @param mixed $meta * @param array $field * * @return string */ static function html($html, $meta, $field) { global $wpdb; $i18n_msg = _x('Uploaded files', 'image upload', RWMB_TEXTDOMAIN); $i18n_del_file = _x('Delete this file', 'image upload', RWMB_TEXTDOMAIN); $i18n_delete = _x('Delete', 'image upload', RWMB_TEXTDOMAIN); $i18n_edit = _x('Edit', 'image upload', RWMB_TEXTDOMAIN); $i18n_title = _x('Upload files', 'image upload', RWMB_TEXTDOMAIN); $i18n_more = _x('Add another file', 'image upload', RWMB_TEXTDOMAIN); $html = wp_nonce_field("rwmb-delete-file_{$field['id']}", "nonce-delete-file_{$field['id']}", false, false); $html .= wp_nonce_field("rwmb-reorder-images_{$field['id']}", "nonce-reorder-images_{$field['id']}", false, false); $html .= "<input type='hidden' class='field-id' value='{$field['id']}' />"; // Uploaded images if (!empty($meta)) { $html .= "<h4>{$i18n_msg}</h4>"; $html .= "<ul class='rwmb-images rwmb-uploaded'>"; foreach ($meta as $image) { $src = wp_get_attachment_image_src($image, 'thumbnail'); $src = $src[0]; $link = get_edit_post_link($image); $html .= "<li id='item_{$image}'>\n\t\t\t\t\t\t<img src='{$src}' />\n\t\t\t\t\t\t<div class='rwmb-image-bar'>\n\t\t\t\t\t\t\t<a title='{$i18n_edit}' class='rwmb-edit-file' href='{$link}' target='_blank'>{$i18n_edit}</a> |\n\t\t\t\t\t\t\t<a title='{$i18n_del_file}' class='rwmb-delete-file' href='#' rel='{$image}'>{$i18n_delete}</a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</li>"; } $html .= '</ul>'; } // Show form upload $html .= "\n\t\t\t<h4>{$i18n_title}</h4>\n\t\t\t<div class='new-files'>\n\t\t\t\t<div class='file-input'><input type='file' name='{$field['id']}[]' /></div>\n\t\t\t\t<a class='rwmb-add-file' href='#'>{$i18n_more}</a>\n\t\t\t</div>"; return $html; }
public function wp_nonce_field($params, $template) { $default_params = array('action' => '-1', 'name' => '_wpnonce', 'referer' => false, 'echo' => false); $params = array_merge($default_params, $params); $nonce = wp_nonce_field($params['action'], $params['name'], $params['referer'], $params['echo']); return $nonce; }
/** * Displays metabox to for select layout option */ function freedom_page_layout() { global $page_layout, $post; // Use nonce for verification wp_nonce_field(basename(__FILE__), 'custom_meta_box_nonce'); foreach ($page_layout as $field) { $layout_meta = get_post_meta($post->ID, $field['id'], true); if (empty($layout_meta)) { $layout_meta = 'default_layout'; } ?> <input class="post-format" type="radio" name="<?php echo $field['id']; ?> " value="<?php echo $field['value']; ?> " <?php checked($field['value'], $layout_meta); ?> /> <label class="post-format-icon"><?php echo $field['label']; ?> </label><br/> <?php } }