CategoriesController.php
8 years ago
ExportController.php
3 weeks ago
GoogleCategoriesController.php
3 weeks ago
SchedulingConnectionController.php
8 years ago
SchedulingLicenseController.php
3 weeks ago
ExportController.php
61 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Wpae\App\Controller; |
| 4 | |
| 5 | use PMXE_Export_Record; |
| 6 | use PMXE_Input; |
| 7 | use WP_Error; |
| 8 | use Wpae\App\Service\TemplateManager; |
| 9 | use Wpae\Controller\BaseController; |
| 10 | use Wpae\Http\JsonResponse; |
| 11 | use Wpae\Http\Request; |
| 12 | use PMXE_Plugin; |
| 13 | use XmlExportEngine; |
| 14 | |
| 15 | class ExportController extends BaseController |
| 16 | { |
| 17 | private $input; |
| 18 | |
| 19 | private $errors; |
| 20 | |
| 21 | private $data = array(); |
| 22 | |
| 23 | private $isWizard = true; |
| 24 | |
| 25 | public $baseUrlParamNames = array('page', 'pagenum', 'order', 'order_by', 'type', 's', 'f'); |
| 26 | |
| 27 | public function saveAction(Request $request) |
| 28 | { |
| 29 | die('Not Supported'); |
| 30 | } |
| 31 | |
| 32 | public function getAction(Request $request) |
| 33 | { |
| 34 | if(!$request->get('id')) { |
| 35 | $sessionData = PMXE_Plugin::$session->get_session_data(); |
| 36 | if(isset($sessionData['google_merchants_post_data'])) { |
| 37 | $exportData = unserialize($sessionData['google_merchants_post_data']); |
| 38 | } |
| 39 | else { |
| 40 | $exportData = false; |
| 41 | } |
| 42 | } else { |
| 43 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only request inspection; access controlled by parent admin page capability |
| 44 | $id = isset( $_GET['id'] ) ? intval( $_GET['id'] ) : 0; |
| 45 | $export = new \PMXE_Export_Record(); |
| 46 | if ($export->getById($id)->isEmpty()) { // specified import is not found |
| 47 | wp_safe_redirect(esc_url_raw(add_query_arg('page', 'pmxe-admin-manage', admin_url('admin.php')))); |
| 48 | die(); |
| 49 | } |
| 50 | |
| 51 | $exportData = $export->options['google_merchants_post_data']; |
| 52 | } |
| 53 | |
| 54 | if($exportData === 'false' || !$exportData) { |
| 55 | $exportData = null; |
| 56 | } |
| 57 | |
| 58 | return new JsonResponse($exportData); |
| 59 | } |
| 60 | |
| 61 | } |