-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathwp_all_export_zapier_response.php
47 lines (39 loc) · 1.44 KB
/
wp_all_export_zapier_response.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* =======================================
* Filter: wp_all_export_zapier_response
* =======================================
*
*
* @param $response - Current response.
*
* @return array
*/
add_filter('wp_all_export_zapier_response', 'wpae_wp_all_export_zapier_response', 10, 1);
function wpae_wp_all_export_zapier_response( $response ) {
// Code here.
}
// ----------------------------
// Example uses below
// ----------------------------
/**
* Example: Send export bundle file to Zapier.
*
*/
add_filter('wp_all_export_zapier_response', 'wpae_wp_all_export_zapier_response', 10, 1);
function wpae_wp_all_export_zapier_response( $response ) {
$export = new PMXE_Export_Record();
if ( ! $export->getById($response['export_id'])->isEmpty())
{
if ( ! empty($export->options['bundlepath']) )
{
$bundle_path = wp_all_export_get_absolute_path($export->options['bundlepath']);
$uploads = wp_upload_dir();
if ( @file_exists($bundle_path) )
{
$response['export_file_url'] = $uploads['baseurl'] . str_replace($uploads['basedir'], '', $bundle_path);
}
}
}
return $response;
}