| 1 |
<?php |
| 2 |
|
| 3 |
namespace StoreEngine\Addons\Csv; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) { |
| 6 |
exit; |
| 7 |
} |
| 8 |
|
| 9 |
class Hooks { |
| 10 |
|
| 11 |
public static function init() { |
| 12 |
$self = new self(); |
| 13 |
add_action( 'storeengine/csv/clean_tmp_csv', [ $self, 'clean_tmp_csv' ] ); |
| 14 |
add_filter( 'storeengine/backend_scripts_data', [ $self, 'add_scripts_data' ] ); |
| 15 |
} |
| 16 |
|
| 17 |
public function clean_tmp_csv( string $filepath ) { |
| 18 |
if ( file_exists( $filepath ) ) { |
| 19 |
wp_delete_file( $filepath ); |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
public function add_scripts_data( array $data ): array { |
| 24 |
return array_merge( $data, [ |
| 25 |
'csv' => [ |
| 26 |
'rcp_activated' => function_exists( 'rcp_get_membership_level' ), |
| 27 |
], |
| 28 |
] ); |
| 29 |
} |
| 30 |
|
| 31 |
} |
| 32 |
|