AJAX.php
3 years ago
Cleared_Cache_AJAX.php
3 years ago
Create_Campaign_AJAX.php
3 years ago
Delete_Data_AJAX.php
3 years ago
Export_Campaigns_AJAX.php
3 years ago
Export_Geo_AJAX.php
3 years ago
Export_Referrers_AJAX.php
3 years ago
Export_Views_AJAX.php
3 years ago
Filters_AJAX.php
3 years ago
Migration_Status_AJAX.php
3 years ago
Real_Time_AJAX.php
3 years ago
Test_Email_AJAX.php
3 years ago
Update_Capabilities_AJAX.php
3 years ago
Create_Campaign_AJAX.php
30 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWP\AJAX; |
| 4 | |
| 5 | use IAWP\Campaign_Builder; |
| 6 | use IAWP\Utils\Security; |
| 7 | |
| 8 | class Create_Campaign_AJAX extends AJAX |
| 9 | { |
| 10 | protected function action_name(): string |
| 11 | { |
| 12 | return 'iawp_create_campaign'; |
| 13 | } |
| 14 | |
| 15 | protected function action_callback(): void |
| 16 | { |
| 17 | $campaign_builder = new Campaign_Builder(); |
| 18 | $html = $campaign_builder->create_campaign( |
| 19 | Security::string(trim($this->get_field('path'))), |
| 20 | Security::string(trim($this->get_field('utm_source'))), |
| 21 | Security::string(trim($this->get_field('utm_medium'))), |
| 22 | Security::string(trim($this->get_field('utm_campaign'))), |
| 23 | Security::string(trim($this->get_field('utm_term'))), |
| 24 | Security::string(trim($this->get_field('utm_content'))) |
| 25 | ); |
| 26 | |
| 27 | wp_send_json_success(['html' => $html]); |
| 28 | } |
| 29 | } |
| 30 |