| 1 |
<?php |
| 2 |
/** |
| 3 |
* WP Ultimate Exporter plugin file. |
| 4 |
* |
| 5 |
* Copyright (C) 2010-2020, Smackcoders Inc - info@smackcoders.com |
| 6 |
*/ |
| 7 |
namespace Smackcoders\SMEXP; |
| 8 |
|
| 9 |
use Smackcoders\WCSV\WC_Coupon; |
| 10 |
|
| 11 |
if (! defined('ABSPATH')) |
| 12 |
exit; // Exit if accessed directly |
| 13 |
|
| 14 |
class JetReviewsExport |
| 15 |
{ |
| 16 |
protected static $instance = null, $mapping_instance, $export_handler, $export_instance, $post_export; |
| 17 |
public $totalRowCount; |
| 18 |
public $plugin; |
| 19 |
|
| 20 |
public static function getInstance() |
| 21 |
{ |
| 22 |
if (null == self::$instance) { |
| 23 |
self::$instance = new self; |
| 24 |
JetReviewsExport::$export_instance = ExportExtension::getInstance(); |
| 25 |
JetReviewsExport::$post_export = PostExport::getInstance(); |
| 26 |
} |
| 27 |
return self::$instance; |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* JetReviewsExport constructor. |
| 32 |
*/ |
| 33 |
public function __construct() |
| 34 |
{ |
| 35 |
$this->plugin = Plugin::getInstance(); |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Fetch JetReviews data for export |
| 40 |
* @param $reviewId |
| 41 |
*/ |
| 42 |
|
| 43 |
public function getJetReviewsData($id) { |
| 44 |
global $wpdb; |
| 45 |
// Retrieve review by ID |
| 46 |
$review = $wpdb->get_row( |
| 47 |
$wpdb->prepare("SELECT * FROM {$wpdb->prefix}jet_reviews WHERE id = %d", $id), |
| 48 |
ARRAY_A |
| 49 |
|
| 50 |
); |
| 51 |
if (!empty($review)) { |
| 52 |
|
| 53 |
|
| 54 |
// Populate data for the successful query |
| 55 |
JetReviewsExport::$export_instance->data[$id]['id'] = $review['id'] ?? ''; JetReviewsExport::$export_instance->data[$id]['post_id'] = $review['post_id'] ?? ''; |
| 56 |
JetReviewsExport::$export_instance->data[$id]['source'] = $review['source'] ?? ''; |
| 57 |
JetReviewsExport::$export_instance->data[$id]['post_type'] = $review['post_type'] ?? ''; |
| 58 |
JetReviewsExport::$export_instance->data[$id]['type_slug'] = $review['type_slug'] ?? ''; |
| 59 |
JetReviewsExport::$export_instance->data[$id]['author'] = $review['author'] ?? ''; |
| 60 |
JetReviewsExport::$export_instance->data[$id]['date'] = date('Y-m-d H:i:s', strtotime($review['date'])) ?? ''; |
| 61 |
JetReviewsExport::$export_instance->data[$id]['title'] = $review['title'] ?? ''; |
| 62 |
JetReviewsExport::$export_instance->data[$id]['content'] = $review['content'] ?? ''; |
| 63 |
JetReviewsExport::$export_instance->data[$id]['rating_data'] = $review['rating_data'] ?? ''; |
| 64 |
JetReviewsExport::$export_instance->data[$id]['rating'] = $review['rating'] ?? ''; |
| 65 |
JetReviewsExport::$export_instance->data[$id]['likes'] = $review['likes'] ?? ''; |
| 66 |
JetReviewsExport::$export_instance->data[$id]['dislikes'] = $review['dislikes'] ?? ''; |
| 67 |
JetReviewsExport::$export_instance->data[$id]['approved'] = $review['approved'] ?? ''; |
| 68 |
JetReviewsExport::$export_instance->data[$id]['pinned'] = $review['pinned'] ?? ''; |
| 69 |
} |
| 70 |
} |
| 71 |
} |
| 72 |
|