當前位置: 首頁>>代碼示例>>PHP>>正文


PHP cmb_Meta_Box::nonce_added方法代碼示例

本文整理匯總了PHP中cmb_Meta_Box::nonce_added方法的典型用法代碼示例。如果您正苦於以下問題:PHP cmb_Meta_Box::nonce_added方法的具體用法?PHP cmb_Meta_Box::nonce_added怎麽用?PHP cmb_Meta_Box::nonce_added使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cmb_Meta_Box的用法示例。


在下文中一共展示了cmb_Meta_Box::nonce_added方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: show_form

 /**
  * Loops through and displays fields
  * @since  1.0.0
  * @param  array  $meta_box    Metabox config array
  * @param  int    $object_id   Object ID
  * @param  string $object_type Type of object being saved. (e.g., post, user, or comment)
  */
 public static function show_form($meta_box, $object_id = 0, $object_type = '')
 {
     $meta_box = self::set_mb_defaults($meta_box);
     // Set/get type
     $object_type = self::set_object_type($object_type ? $object_type : self::set_mb_type($meta_box));
     // Set/get ID
     $object_id = self::set_object_id($object_id ? $object_id : self::get_object_id());
     // Add nonce only once per page.
     if (!self::$nonce_added) {
         wp_nonce_field(self::nonce(), 'wp_meta_box_nonce', false, true);
         self::$nonce_added = true;
     }
     // Use nonce for verification
     echo "\n<!-- Begin CMB Fields -->\n";
     do_action('cmb_before_table', $meta_box, $object_id, $object_type);
     echo '<table class="form-table cmb_metabox">';
     foreach ($meta_box['fields'] as $field_args) {
         $field_args['context'] = $meta_box['context'];
         if ('group' == $field_args['type']) {
             if (!isset($field_args['show_names'])) {
                 $field_args['show_names'] = $meta_box['show_names'];
             }
             self::render_group($field_args);
         } else {
             $field_args['show_names'] = $meta_box['show_names'];
             // Render default fields
             $field = new cmb_Meta_Box_field($field_args);
             $field->render_field();
         }
     }
     echo '</table>';
     do_action('cmb_after_table', $meta_box, $object_id, $object_type);
     echo "\n<!-- End CMB Fields -->\n";
 }
開發者ID:Inteleck,項目名稱:hwc,代碼行數:41,代碼來源:init.php

示例2: show_form

 /**
  * Loops through and displays fields
  * @since  1.0.0
  * @param  array  $meta_box    Metabox config array
  * @param  int    $object_id   Object ID
  * @param  string $object_type Type of object being saved. (e.g., post, user, or comment)
  */
 public static function show_form($meta_box, $object_id = 0, $object_type = '')
 {
     $meta_box = self::set_mb_defaults($meta_box);
     // Set/get type
     $object_type = self::set_object_type($object_type ? $object_type : self::set_mb_type($meta_box));
     // Set/get ID
     $object_id = self::set_object_id($object_id ? $object_id : self::get_object_id());
     // Add nonce only once per page.
     if (!self::$nonce_added) {
         // Use nonce for verification
         wp_nonce_field(self::nonce(), 'wp_meta_box_nonce', false, true);
         self::$nonce_added = true;
     }
     echo "\n<!-- Begin CMB Fields -->\n";
     /**
      * Hook before form table begins
      *
      * @param array  $meta_box    Metabox config array
      * @param int    $object_id   The ID of the current object
      * @param string $object_type The type of object you are working with.
      *	                           Usually `post` (this applies to all post-types).
      *	                           Could also be `comment`, `user` or `options-page`.
      */
     do_action('cmb_before_table', $meta_box, $object_id, $object_type);
     echo '<table class="form-table cmb_metabox">';
     foreach ($meta_box['fields'] as $field_args) {
         $field_args['context'] = $meta_box['context'];
         if ('group' == $field_args['type']) {
             if (!isset($field_args['show_names'])) {
                 $field_args['show_names'] = $meta_box['show_names'];
             }
             self::render_group($field_args);
         } else {
             $field_args['show_names'] = $meta_box['show_names'];
             // Render default fields
             $field = new cmb_Meta_Box_field($field_args);
             $field->render_field();
         }
     }
     echo '</table>';
     /**
      * Hook after form table has been rendered
      *
      * @param array  $meta_box    Metabox config array
      * @param int    $object_id   The ID of the current object
      * @param string $object_type The type of object you are working with.
      *	                           Usually `post` (this applies to all post-types).
      *	                           Could also be `comment`, `user` or `options-page`.
      */
     do_action('cmb_after_table', $meta_box, $object_id, $object_type);
     echo "\n<!-- End CMB Fields -->\n";
 }
開發者ID:ryansm,項目名稱:saud,代碼行數:59,代碼來源:init.php


注:本文中的cmb_Meta_Box::nonce_added方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。