-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0df0d40
commit 5e87528
Showing
112 changed files
with
13,971 additions
and
6,206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace AIOSEO\Plugin\Common\Api; | ||
|
||
// Exit if accessed directly. | ||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
/** | ||
* Email Summary related REST API endpoint callbacks. | ||
* | ||
* @since 4.7.2 | ||
*/ | ||
class EmailSummary { | ||
/** | ||
* Sends a summary. | ||
* | ||
* @since 4.7.2 | ||
* | ||
* @param \WP_REST_Request $request The REST Request | ||
* @return \WP_REST_Response The response. | ||
*/ | ||
public static function send( $request ) { | ||
try { | ||
$body = $request->get_json_params(); | ||
|
||
$to = $body['to'] ?? ''; | ||
$frequency = $body['frequency'] ?? ''; | ||
if ( $to && $frequency ) { | ||
aioseo()->emailReports->summary->run( [ | ||
'recipient' => $to, | ||
'frequency' => $frequency, | ||
] ); | ||
} | ||
|
||
return new \WP_REST_Response( [ | ||
'success' => true, | ||
], 200 ); | ||
} catch ( \Exception $e ) { | ||
return new \WP_REST_Response( [ | ||
'success' => false, | ||
'message' => $e->getMessage() | ||
], 200 ); | ||
} | ||
} | ||
} |
Oops, something went wrong.