• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP update_metadata函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中update_metadata函数的典型用法代码示例。如果您正苦于以下问题:PHP update_metadata函数的具体用法?PHP update_metadata怎么用?PHP update_metadata使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: update_meta

 /**
  * Update term meta field based on term ID.
  *
  */
 public static function update_meta($term_id, $meta_key, $meta_value, $prev_value = '')
 {
     if (current_theme_supports('extended-taxonomies')) {
         return update_post_meta(self::get_post_for_extended_term($term_id)->ID, $meta_key, $meta_value, $prev_value);
     }
     return update_metadata('taxonomy', $term_id, $meta_key, $meta_value, $prev_value);
 }
开发者ID:ksan5835,项目名称:rankproperties,代码行数:11,代码来源:class-term.php


示例2: restore_revision

 public static function restore_revision($post_id, $revision_id)
 {
     $meta = piklist('post_custom', $revision->ID);
     foreach ($meta as $key => $value) {
         update_metadata('post', $post_id, $key, $value);
     }
 }
开发者ID:Themes-Protoarte,项目名称:piklist,代码行数:7,代码来源:class-piklist-revision.php


示例3: test_slashed_key_for_existing_metadata

 /**
  * @ticket 35795
  */
 public function test_slashed_key_for_existing_metadata()
 {
     global $wpdb;
     add_metadata('post', 123, wp_slash('foo\\foo'), 'bar');
     update_metadata('post', 123, wp_slash('foo\\foo'), 'baz');
     $found = get_metadata('post', 123, 'foo\\foo', true);
     $this->assertSame('baz', $found);
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:11,代码来源:updateMetadata.php


示例4: persist

 /**
  * @param WP_Post $post
  * @param WP_Post $revision
  */
 public function persist(WP_Post $post, WP_Post $revision)
 {
     $value = $_REQUEST[$this->getKey()];
     $format = 'Y-m-d H:i:s';
     if (isset($this->options['config']['timepicker']) && $this->options['config']['timepicker'] == false) {
         $format = 'Y-m-d';
     }
     update_metadata('post', $revision->ID, $this->getKey(), date_i18n($format, strtotime($value)));
 }
开发者ID:tmf,项目名称:wp-metabox-helper,代码行数:13,代码来源:class-datetime-item.php


示例5: save_item_category

function save_item_category($term_id, $tt_id)
{
    if (!$term_id) {
        return;
    }
    if (isset($_POST['ait_item_category_thumbnail'])) {
        update_metadata(str_replace("-", "_", $_POST['taxonomy']), $term_id, 'ait_item_category_thumbnail', $_POST['ait_item_category_thumbnail']);
    }
}
开发者ID:simeont9,项目名称:stoneopen,代码行数:9,代码来源:item.php


示例6: update_field

 /**
  * Update the value of the specified metadata field of the object wrapped by this container. 
  *
  * @access protected
  *
  * @param string $field Meta name.
  * @param string $new_value New meta value. 
  * @param string $old_value old meta value.     
  * @return bool|WP_Error True on success, an error object if something went wrong.
  */
 function update_field($field, $new_value, $old_value = '')
 {
     $rez = update_metadata($this->meta_type, $this->container_id, $field, $new_value, $old_value);
     if ($rez) {
         return true;
     } else {
         return new WP_Error('metadata_update_failed', sprintf(__("Failed to update the meta field '%s' on %s [%d]", 'broken-link-checker'), $field, $this->meta_type, $this->container_id));
     }
 }
开发者ID:Weissenberger13,项目名称:web.portugalrentalcottages,代码行数:19,代码来源:custom_field.php


示例7: update

 /**
  * Update a meta field.
  *
  * @alias set
  * @synopsis <id> <key> <value>
  */
 public function update($args, $assoc_args)
 {
     list($object_id, $meta_key, $meta_value) = $args;
     $success = update_metadata($this->meta_type, $object_id, $meta_key, $meta_value);
     if ($success) {
         WP_CLI::success("Updated custom field.");
     } else {
         WP_CLI::error("Failed to update custom field.");
     }
 }
开发者ID:netcon-source,项目名称:wp-cli,代码行数:16,代码来源:class-wp-cli-command-with-meta.php


示例8: saveThumbnail

 public function saveThumbnail($termId, $ttId, $taxonomy)
 {
     if ($taxonomy != Types::PRODUCT_CATEGORY) {
         return;
     }
     $thumbnail = isset($_POST[Types::PRODUCT_CATEGORY . '_thumbnail_id']) ? $_POST[Types::PRODUCT_CATEGORY . '_thumbnail_id'] : false;
     if (!is_numeric($thumbnail)) {
         return;
     }
     update_metadata(Core::TERMS, $termId, 'thumbnail_id', (int) $thumbnail);
 }
开发者ID:jigoshop,项目名称:Jigoshop2,代码行数:11,代码来源:ProductCategories.php


示例9: update_data

 public function update_data($new_value, $single = true)
 {
     extract($this->data_args(array('new_value' => $new_value, 'single' => $single)));
     if ('options-page' === $type) {
         return rrze_Meta_Box::update_option($id, $field_id, $new_value, $single);
     }
     if (!$single) {
         return add_metadata($type, $id, $field_id, $new_value, false);
     }
     return update_metadata($type, $id, $field_id, $new_value);
 }
开发者ID:RRZE-Webteam,项目名称:fau-studienangebot,代码行数:11,代码来源:rrze_meta_box_field.php


示例10: easy_ads_update_section_meta

function easy_ads_update_section_meta($post_id, $field_name, $value = '')
{
    if (empty($value) or !$value) {
        $doo = delete_metadata('easy_ads_taxnomy_sections_', $post_id, $field_name, $value);
    } elseif (!get_metadata('easy_ads_taxnomy_sections_', $post_id, $field_name)) {
        $doo = add_metadata('easy_ads_taxnomy_sections_', $post_id, $field_name, $value);
    } else {
        $doo = update_metadata('easy_ads_taxnomy_sections_', $post_id, $field_name, $value);
    }
    return $doo;
}
开发者ID:shokry055,项目名称:easy-ads-manager,代码行数:11,代码来源:easy-ads-functions.php


示例11: save

 /**
  * Save matadata object
  *
  * @return int the metadata object id
  */
 function save()
 {
     if ($this->id > 0) {
         return update_metadata($this->id, $this->name, $this->value, $this->value_type, $this->owner_guid, $this->access_id);
     } else {
         $this->id = create_metadata($this->entity_guid, $this->name, $this->value, $this->value_type, $this->owner_guid, $this->access_id);
         if (!$this->id) {
             throw new IOException(elgg_echo('IOException:UnableToSaveNew', array(get_class())));
         }
         return $this->id;
     }
 }
开发者ID:redvabel,项目名称:Vabelgg,代码行数:17,代码来源:ElggMetadata.php


示例12: update

 /**
  * Update meta field for a user
  *
  * @param array $args
  * @param array $assoc_args
  **/
 public function update($args, $assoc_args)
 {
     $object_id = WP_CLI::get_numeric_arg($args, 0, "{$this->meta_type} ID");
     $meta_key = self::get_arg_or_error($args, 1, "meta_key");
     $meta_value = self::get_arg_or_error($args, 2, "meta_value");
     $success = update_metadata($this->meta_type, $object_id, $meta_key, $meta_value);
     if ($success) {
         WP_CLI::success("Updated custom field.");
     } else {
         WP_CLI::error("Failed to update custom field.");
     }
 }
开发者ID:roelven,项目名称:wp-cli,代码行数:18,代码来源:class-wp-cli-command-with-meta.php


示例13: save

 /**
  * Save metadata object
  *
  * @return int|bool the metadata object id or true if updated
  *
  * @throws IOException
  */
 public function save()
 {
     if ($this->id > 0) {
         return update_metadata($this->id, $this->name, $this->value, $this->value_type, $this->owner_guid, $this->access_id);
     } else {
         $this->id = create_metadata($this->entity_guid, $this->name, $this->value, $this->value_type, $this->owner_guid, $this->access_id);
         if (!$this->id) {
             throw new \IOException("Unable to save new " . get_class());
         }
         return $this->id;
     }
 }
开发者ID:ibou77,项目名称:elgg,代码行数:19,代码来源:ElggMetadata.php


示例14: do_save

 public function do_save($return_val, $params, $metas, $module)
 {
     $status = false;
     if (!isset($params['meta_value'])) {
         return false;
     }
     if (empty($params['meta_key'])) {
         return false;
     }
     if (!is_null($params['meta_value'])) {
         $status = update_metadata($this->object_name, $this->object_id, $params['meta_key'], $params['meta_value']);
     }
     return $status;
 }
开发者ID:juanfra,项目名称:fakerpress,代码行数:14,代码来源:meta.php


示例15: unsubscribe

 public function unsubscribe($user_id)
 {
     $subscriber_ids = $this->subscriber_ids();
     if (in_array($user_id, $subscriber_ids)) {
         $subscriber_ids = array_diff($subscriber_ids, array($user_id));
         update_metadata($this->meta_type, $this->id, self::SUBSCRIBED_META_KEY, $subscriber_ids);
         /**
          * A post subscription has been removed.
          *
          * @param int $subscriber_id
          * @param Prompt_Interface_Subscribable $object The thing subscribed to.
          */
         do_action('prompt/unsubscribed', $user_id, $this, $this->meta_type);
     }
     return $this;
 }
开发者ID:postmatic,项目名称:beta-dist,代码行数:16,代码来源:meta-subscribable-object.php


示例16: pre_save

 /**
  * Pre save page template and page type.
  *
  * @param int $id
  */
 protected function pre_save($id)
 {
     if (empty($id)) {
         return;
     }
     $data = $this->get_pre_data();
     foreach ($data as $key => $value) {
         if (empty($value)) {
             continue;
         }
         if (is_array($value)) {
             list($keys, $value) = $this->get_pre_deep_keys_value($value);
             $key = sprintf('%s_%s', $key, implode('_', $keys));
         }
         update_metadata($this->get_meta_type(), $id, $key, $value);
     }
 }
开发者ID:wp-papi,项目名称:papi,代码行数:22,代码来源:class-papi-admin-meta-handler.php


示例17: persist

 /**
  * @param WP_Post $post
  * @param WP_Post $revision
  */
 public function persist(WP_Post $post, WP_Post $revision)
 {
     $key = $this->getKey();
     $values = $_POST[$key];
     if (is_array($values)) {
         delete_metadata('post', $revision->ID, $key);
         foreach ($values as $value) {
             add_metadata('post', $revision->ID, $key, $value);
         }
     } else {
         if (empty($values)) {
             delete_post_meta($revision->ID, $key);
         } else {
             update_metadata('post', $revision->ID, $key, $values);
         }
     }
 }
开发者ID:tmf,项目名称:wp-metabox-helper,代码行数:21,代码来源:class-dropdown-item.php


示例18: save_ctax_meta

 function save_ctax_meta($term_id, $tt_id)
 {
     if (!$term_id) {
         return;
     }
     global $wpdb;
     foreach ($this->args as $fields) {
         if (isset($_POST[$fields['name']])) {
             //print_r('<hr />');
             //print_r($_POST['taxonomy']);
             //print_r($term_id);
             //print_r($fields['name']);
             //print_r($_POST[ $fields['name'] ] );
             $update = update_metadata($_POST['taxonomy'], $term_id, $fields['name'], $_POST[$fields['name']]);
         }
     }
 }
开发者ID:srolland,项目名称:dev,代码行数:17,代码来源:qqp_ctax_meta.php


示例19: hijack_oembed_cache_set

 /**
  * Hijacks saving of cached oEmbed.
  * Saves cached data to relevant object metadata (vs postmeta)
  *
  * @since  0.9.5
  * @param  boolean $check Whether to continue setting postmeta
  * @param  int $object_id Object ID to get postmeta from
  * @param  string $meta_key Postmeta's key
  * @param  mixed $meta_value Value of the postmeta to be saved
  * @return boolean             Whether to continue setting
  */
 public static function hijack_oembed_cache_set($check, $object_id, $meta_key, $meta_value)
 {
     if (!self::$hijack || self::$object_id != $object_id && 1987645321 !== $object_id) {
         return $check;
     }
     // Cache the result to our metadata
     if ('options-page' === self::$object_type) {
         // Set the option
         cmb_Meta_Box::update_option(self::$object_id, self::$embed_args['cache_key'], $meta_value, array('type' => 'oembed'));
         // Save the option
         cmb_Meta_Box::save_option(self::$object_id);
     } else {
         update_metadata(self::$object_type, self::$object_id, $meta_key, $meta_value);
     }
     // Anything other than `null` to cancel saving to postmeta
     return true;
 }
开发者ID:Telemedellin,项目名称:feriadelasfloresmedellin,代码行数:28,代码来源:cmb_Meta_Box_ajax.php


示例20: elggpg_import_key

function elggpg_import_key($public_key, $user)
{
    $gpg = new gnupg();
    $info = $gpg->import($public_key);
    $new_fp = $info['fingerprint'];
    $user_fp = current(elgg_get_metadata(array('guid' => $user->guid, 'metadata_name' => 'openpgp_publickey')));
    $access_id = ACCESS_LOGGED_IN;
    if ($user_fp && $user_fp->value != $new_fp) {
        update_metadata($user_fp->id, $user_fp->name, $new_fp, 'text', $user->guid, $access_id);
        $info['imported'] = 1;
    } elseif (!$user_fp) {
        create_metadata($user->guid, "openpgp_publickey", $new_fp, 'text', $user->guid, $access_id);
        $info['imported'] = 1;
    }
    $info['key_id'] = elggpg_fp2keyid($new_fp);
    return $info;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:17,代码来源:elggpg.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP update_metadata_by_mid函数代码示例发布时间:2022-05-23
下一篇:
PHP update_meta_cache函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap