BP_Export

BP_Export

描述

文件:bp-core / gdpr / class-bp-export.php

抽象类BP_Export{受保护的$ export_name = ";Protected $ export_label = ";Protected $items_per_batch = 50;/** * @param $name * @param $label ** @since BuddyBoss 1.0.0 */ function setup($name, $label) {$this-> export_name = $name;$ this - > exporter_label = $标签;/ /全局过滤器。$this->items_per_batch = apply_filters('buddyboss_bp_gdpr_item_per_batch', $this->items_per_batch);/ /特定的过滤器。$this->items_per_batch = apply_filters('buddyboss_bp_gdpr_item_per_batch_{$name}', $this->items_per_batch);$ this - >钩子(); } /** * Register erase and export hooks. * * @since BuddyBoss 1.0.0 */ function hooks() { add_filter( 'wp_privacy_personal_data_exporters', array( $this, 'register_exporter' ), 10 ); add_filter( 'wp_privacy_personal_data_erasers', array( $this, 'register_eraser' ), 10 ); } /** * Register exporter callback. * * @param $exporters * * @since BuddyBoss 1.0.0 * * @return mixed */ function register_exporter( $exporters ) { $exporters[ $this->exporter_name ] = array( 'exporter_friendly_name' => $this->exporter_label, 'callback' => array( $this, 'process_export_callback' ), ); return $exporters; } /** * Register delete callback. * * @param $erasers * * @since BuddyBoss 1.0.0 * * @return mixed */ function register_eraser( $erasers ) { $erasers[ $this->exporter_name ] = array( 'eraser_friendly_name' => $this->exporter_label, 'callback' => array( $this, "process_eraser_callback" ), ); return $erasers; } /** * Process export callback. * * @param $email_address * @param int $page * * @since BuddyBoss 1.0.0 * * @return array */ function process_export_callback( $email_address, $page = 1 ) { $user = get_user_by( 'email', $email_address ); /** * @todo add title/description * * @since BuddyBoss 1.0.0 */ do_action( 'buddyboss_bp_gdpr_pre_exporter_callback', $email_address, $page, $user ); return $this->process_data( $user, $page, $email_address ); } /** * Process delete callback * * @param $email_address * @param int $page * * @since BuddyBoss 1.0.0 * * @return mixed */ function process_eraser_callback( $email_address, $page = 1 ) { $user = get_user_by( 'email', $email_address ); /** * @todo add title/description * * @since BuddyBoss 1.0.0 */ do_action( 'buddyboss_bp_gdpr_pre_eraser_callback', $email_address, $page, $user ); return $this->process_erase( $user, $page, $email_address ); } /** * Fallback. * * @param $user * @param $page * @param bool $email_address * * @since BuddyBoss 1.0.0 * @ignore * @return array */ function process_data( $user, $page, $email_address ) { return $this->response( array(), true ); } /** * Fallback. * * @param $user * @param $page * @param bool $email_address * * @since BuddyBoss 1.0.0 * @ignore * @return array */ function process_erase( $user, $page, $email_address ) { return $this->response_erase( false, true ); } /** * Export data response. * * @param array $export_data * @param bool $done * * @since BuddyBoss 1.0.0 * * @return array */ function response( $export_data = array(), $done = false ) { return array( 'data' => $export_data, 'done' => $done, ); } /** * Delete data response. * * @param bool $item_removed * @param bool $done * @param array $messages * @param bool $items_retained * * @since BuddyBoss 1.0.0 * * @return array */ function response_erase( $item_removed = true, $done = false, $messages = array(), $items_retained = false ) { return array( 'items_removed' => $item_removed, 'items_retained' => $items_retained, 'messages' => $messages, 'done' => $done, ); } /** * Convert serialized meta to readable data. * * @param $value * * @since BuddyBoss 1.0.0 * * @return string */ function easy_readable( $value ) { if ( ! is_serialized( $value ) && ! is_array( $value ) && ! is_object( $value ) ) { return $value; } $value = maybe_serialize( $value ); return wp_json_encode( $value, JSON_PRETTY_PRINT ); } }

更新日志

更新日志
版本 描述
BuddyBoss 1.0.0 介绍了。

方法

问题吗?

我们总是很乐意帮助您解决代码或其他问题!搜索我们的开发人员文档联络支持,或与我们联系销售团队