Make sure devs pass their own unique ID and use localisation for constructor

This commit is contained in:
Boro Sitnikovski 2018-05-03 10:47:30 +02:00
parent 1cfa6c6e4e
commit 194dba40e2
2 changed files with 9 additions and 9 deletions

View File

@ -116,7 +116,7 @@ abstract class WC_Abstract_Privacy {
* @param string $callback Exporter callback.
*/
public function add_exporter( $id, $name, $callback ) {
$this->exporters[ sanitize_title( $this->name . '-' . $id ) ] = array(
$this->exporters[ $id ] = array(
'exporter_friendly_name' => $name,
'callback' => $callback,
);
@ -131,7 +131,7 @@ abstract class WC_Abstract_Privacy {
* @param string $callback Exporter callback.
*/
public function add_eraser( $id, $name, $callback ) {
$this->erasers[ sanitize_title( $this->name . '-' . $id ) ] = array(
$this->erasers[ $id ] = array(
'eraser_friendly_name' => $name,
'callback' => $callback,
);

View File

@ -24,7 +24,7 @@ class WC_Privacy extends WC_Abstract_Privacy {
* Init - hook into events.
*/
public function __construct() {
parent::__construct( 'WooCommerce' );
parent::__construct( __( 'WooCommerce', 'woocommerce' ) );
if ( ! self::$background_process ) {
self::$background_process = new WC_Privacy_Background_Process();
@ -35,14 +35,14 @@ class WC_Privacy extends WC_Abstract_Privacy {
include_once 'class-wc-privacy-exporters.php';
// This hook registers WooCommerce data exporters.
$this->add_exporter( 'customer-data', __( 'Customer Data', 'woocommerce' ), array( 'WC_Privacy_Exporters', 'customer_data_exporter' ) );
$this->add_exporter( 'customer-orders', __( 'Customer Orders', 'woocommerce' ), array( 'WC_Privacy_Exporters', 'order_data_exporter' ) );
$this->add_exporter( 'customer-downloads', __( 'Customer Downloads', 'woocommerce' ), array( 'WC_Privacy_Exporters', 'download_data_exporter' ) );
$this->add_exporter( 'woocommerce-customer-data', __( 'Customer Data', 'woocommerce' ), array( 'WC_Privacy_Exporters', 'customer_data_exporter' ) );
$this->add_exporter( 'woocommerce-customer-orders', __( 'Customer Orders', 'woocommerce' ), array( 'WC_Privacy_Exporters', 'order_data_exporter' ) );
$this->add_exporter( 'woocommerce-customer-downloads', __( 'Customer Downloads', 'woocommerce' ), array( 'WC_Privacy_Exporters', 'download_data_exporter' ) );
// This hook registers WooCommerce data erasers.
$this->add_eraser( 'customer-data', __( 'Customer Data', 'woocommerce' ), array( 'WC_Privacy_Erasers', 'customer_data_eraser' ) );
$this->add_eraser( 'customer-orders', __( 'Customer Orders', 'woocommerce' ), array( 'WC_Privacy_Erasers', 'order_data_eraser' ) );
$this->add_eraser( 'customer-downloads', __( 'Customer Downloads', 'woocommerce' ), array( 'WC_Privacy_Erasers', 'download_data_eraser' ) );
$this->add_eraser( 'woocommerce-customer-data', __( 'Customer Data', 'woocommerce' ), array( 'WC_Privacy_Erasers', 'customer_data_eraser' ) );
$this->add_eraser( 'woocommerce-customer-orders', __( 'Customer Orders', 'woocommerce' ), array( 'WC_Privacy_Erasers', 'order_data_eraser' ) );
$this->add_eraser( 'woocommerce-customer-downloads', __( 'Customer Downloads', 'woocommerce' ), array( 'WC_Privacy_Erasers', 'download_data_eraser' ) );
// Cleanup orders daily - this is a callback on a daily cron event.
add_action( 'woocommerce_cleanup_personal_data', array( $this, 'queue_cleanup_personal_data' ) );