当前位置: 首页>>代码示例>>PHP>>正文


PHP cmb_Meta_Box::updated方法代码示例

本文整理汇总了PHP中cmb_Meta_Box::updated方法的典型用法代码示例。如果您正苦于以下问题:PHP cmb_Meta_Box::updated方法的具体用法?PHP cmb_Meta_Box::updated怎么用?PHP cmb_Meta_Box::updated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cmb_Meta_Box的用法示例。


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

示例1: save_fields

 /**
  * Loops through and saves field data
  * @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 save_fields($meta_box, $object_id, $object_type = '')
 {
     $meta_box = self::set_mb_defaults($meta_box);
     $meta_box['show_on'] = empty($meta_box['show_on']) ? array('key' => false, 'value' => false) : $meta_box['show_on'];
     self::set_object_id($object_id);
     // Set/get type
     $object_type = self::set_object_type($object_type ? $object_type : self::set_mb_type($meta_box));
     if (!apply_filters('cmb_show_on', true, $meta_box)) {
         return;
     }
     // save field ids of those that are updated
     self::$updated = array();
     foreach ($meta_box['fields'] as $field_args) {
         if ('group' == $field_args['type']) {
             self::save_group($field_args);
         } elseif ('media_picker' == $field_args['type']) {
             // Save XML field
             if (isset($_POST[$field_args['xml_name']['image']])) {
                 $num = sizeof($_POST[$field_args['xml_name']['image']]) - 1;
             } else {
                 $num = -1;
             }
             $slider_xml = "<slide-set>";
             for ($i = 0; $i <= $num; $i++) {
                 $slider_xml = $slider_xml . "<slide>";
                 $image = stripslashes($_POST[$field_args['xml_name']['image']][$i]);
                 $slider_xml = $slider_xml . create_xml_tag('image', $image);
                 $image_url = stripslashes($_POST[$field_args['xml_name']['image_url']][$i]);
                 $slider_xml = $slider_xml . create_xml_tag('image_url', $image_url);
                 $link_url = stripslashes($_POST[$field_args['xml_name']['link_url']][$i]);
                 $slider_xml = $slider_xml . create_xml_tag('link_url', $link_url);
                 $title = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['title']][$i]));
                 $slider_xml = $slider_xml . create_xml_tag('title', $title);
                 $description = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['description']][$i]));
                 $slider_xml = $slider_xml . create_xml_tag('description', $description);
                 $media_url = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['media_url']][$i]));
                 $slider_xml = $slider_xml . create_xml_tag('media_url', $media_url);
                 $embed_type = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['embed_type']][$i]));
                 $slider_xml = $slider_xml . create_xml_tag('embed_type', $embed_type);
                 $timeout = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['timeout']][$i]));
                 $slider_xml = $slider_xml . create_xml_tag('timeout', $timeout);
                 $autoplay = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['autoplay']][$i]));
                 $slider_xml = $slider_xml . create_xml_tag('autoplay', $autoplay);
                 $stage_content = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['stage_content']][$i]));
                 $slider_xml = $slider_xml . create_xml_tag('stage_content', $stage_content);
                 $title_overlay = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['title_overlay']][$i]));
                 $slider_xml = $slider_xml . create_xml_tag('title_overlay', $title_overlay);
                 $gallery3d_pieces = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['gallery3d_pieces']][$i]));
                 $slider_xml = $slider_xml . create_xml_tag('gallery3d_pieces', $gallery3d_pieces);
                 $gallery3d_depthoffset = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['gallery3d_depthoffset']][$i]));
                 $slider_xml = $slider_xml . create_xml_tag('gallery3d_depthoffset', $gallery3d_depthoffset);
                 $gallery3d_cubedist = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['gallery3d_cubedist']][$i]));
                 $slider_xml = $slider_xml . create_xml_tag('gallery3d_cubedist', $gallery3d_cubedist);
                 $gallery3d_tween = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['gallery3d_tween']][$i]));
                 $slider_xml = $slider_xml . create_xml_tag('gallery3d_tween', $gallery3d_tween);
                 $gallery3d_transtime = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['gallery3d_transtime']][$i]));
                 $slider_xml = $slider_xml . create_xml_tag('gallery3d_transtime', $gallery3d_transtime);
                 $gallery3d_seconds = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['gallery3d_seconds']][$i]));
                 $slider_xml = $slider_xml . create_xml_tag('gallery3d_seconds', $gallery3d_seconds);
                 $css_classes = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['css_classes']][$i]));
                 $slider_xml = $slider_xml . create_xml_tag('css_classes', $css_classes);
                 $filter_tags = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['filter_tags']][$i]));
                 $slider_xml = $slider_xml . create_xml_tag('filter_tags', $filter_tags);
                 $readmore_link = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['readmore_link']][$i]));
                 $slider_xml = $slider_xml . create_xml_tag('readmore_link', $readmore_link);
                 $slider_xml = $slider_xml . "</slide>";
             }
             global $post;
             $old = get_post_meta($post->ID, $field_args['xml'], true);
             $new = $slider_xml . "</slide-set>";
             if ($new && $new != $old) {
                 update_post_meta($post->ID, $field_args['xml'], $new);
             } elseif ('' == $new && $old) {
                 delete_post_meta($post->ID, $field_args['xml'], $old);
             }
             // Save default fields
             $field = new cmb_Meta_Box_field($field_args);
             self::save_field(self::sanitize_field($field), $field);
         } else {
             // Save default fields
             $field = new cmb_Meta_Box_field($field_args);
             self::save_field(self::sanitize_field($field), $field);
         }
     }
     // If options page, save the updated options
     if ($object_type == 'options-page') {
         self::save_option($object_id);
     }
     do_action("cmb_save_{$object_type}_fields", $object_id, $meta_box['id'], self::$updated, $meta_box);
 }
开发者ID:jgeletka,项目名称:simskin,代码行数:97,代码来源:init.php

示例2: save_fields

 /**
  * Loops through and saves field data
  * @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 save_fields($meta_box, $object_id, $object_type = '')
 {
     $meta_box = self::set_mb_defaults($meta_box);
     $meta_box['show_on'] = empty($meta_box['show_on']) ? array('key' => false, 'value' => false) : $meta_box['show_on'];
     self::set_object_id($object_id);
     // Set/get type
     $object_type = self::set_object_type($object_type ? $object_type : self::set_mb_type($meta_box));
     if (!apply_filters('cmb_show_on', true, $meta_box)) {
         return;
     }
     // save field ids of those that are updated
     self::$updated = array();
     foreach ($meta_box['fields'] as $field_args) {
         if ('group' == $field_args['type']) {
             self::save_group($field_args);
         } else {
             // Save default fields
             $field = new cmb_Meta_Box_field($field_args);
             self::save_field(self::sanitize_field($field), $field);
         }
     }
     // If options page, save the updated options
     if ($object_type == 'options-page') {
         self::save_option($object_id);
     }
     do_action("cmb_save_{$object_type}_fields", $object_id, $meta_box['id'], self::$updated, $meta_box);
 }
开发者ID:Inteleck,项目名称:hwc,代码行数:34,代码来源:init.php

示例3: save_fields

 /**
  * Loops through and saves field data
  * @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 save_fields($meta_box, $object_id, $object_type = '')
 {
     $meta_box = self::set_mb_defaults($meta_box);
     $meta_box['show_on'] = empty($meta_box['show_on']) ? array('key' => false, 'value' => false) : $meta_box['show_on'];
     self::set_object_id($object_id);
     // Set/get type
     $object_type = self::set_object_type($object_type ? $object_type : self::set_mb_type($meta_box));
     if (!apply_filters('cmb_show_on', true, $meta_box)) {
         return;
     }
     // save field ids of those that are updated
     self::$updated = array();
     foreach ($meta_box['fields'] as $field_args) {
         if ('group' == $field_args['type']) {
             self::save_group($field_args);
         } else {
             // Save default fields
             $field = new cmb_Meta_Box_field($field_args);
             self::save_field(self::sanitize_field($field), $field);
         }
     }
     // If options page, save the updated options
     if ($object_type == 'options-page') {
         self::save_option($object_id);
     }
     /**
      * Fires after all fields have been saved.
      *
      * The dynamic portion of the hook name, $object_type, refers to the metabox/form's object type
      * 	Usually `post` (this applies to all post-types).
      *  	Could also be `comment`, `user` or `options-page`.
      *
      * @param int    $object_id   The ID of the current object
      * @param array  $meta_box_id Metabox's id parameter
      * @param string $updated     All fields that were updated.
      *                            Will only include fields that had values change.
      * @param string $meta_box    The metabox config array.
      */
     do_action("cmb_save_{$object_type}_fields", $object_id, $meta_box['id'], self::$updated, $meta_box);
 }
开发者ID:ryansm,项目名称:saud,代码行数:47,代码来源:init.php


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