当前位置: 首页>>代码示例>>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;未经允许,请勿转载。