| 1 |
<?php |
| 2 |
/** |
| 3 |
* WP Ultimate Exporter. |
| 4 |
* |
| 5 |
* WP Ultimate Exporter plugin file. |
| 6 |
* |
| 7 |
* @package Smackcoders\SMEXP |
| 8 |
* @copyright Copyright (C) 2010-2020, Smackcoders Inc - info@smackcoders.com |
| 9 |
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License, version 3 or higher |
| 10 |
* |
| 11 |
* @wordpress-plugin |
| 12 |
* Plugin Name: WP Ultimate Exporter |
| 13 |
* Version: 2.9 |
| 14 |
* Plugin URI: https://www.smackcoders.com/ultimate-exporter.html |
| 15 |
* Description: Backup tool to export all your WordPress data as CSV file. eCommerce data of WooCommerce, eCommerce, Custom Post and Custom field information along with default WordPress modules. |
| 16 |
* Author: Smackcoders |
| 17 |
* Author URI: https://www.smackcoders.com/wordpress.html |
| 18 |
* Text Domain: wp-ultimate-exporter |
| 19 |
* Domain Path: /languages |
| 20 |
* License: GPL v3 |
| 21 |
* |
| 22 |
* This program is free software: you can redistribute it and/or modify |
| 23 |
* it under the terms of the GNU General Public License as published by |
| 24 |
* the Free Software Foundation, either version 3 of the License, or |
| 25 |
* (at your option) any later version. |
| 26 |
* |
| 27 |
* This program is distributed in the hope that it will be useful, |
| 28 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 29 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 30 |
* GNU General Public License for more details. |
| 31 |
* |
| 32 |
* You should have received a copy of the GNU General Public License |
| 33 |
* along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 34 |
*/ |
| 35 |
|
| 36 |
namespace Smackcoders\SMEXP; |
| 37 |
|
| 38 |
if ( ! defined( 'ABSPATH' ) ) |
| 39 |
exit; // Exit if accessed directly |
| 40 |
|
| 41 |
define('IMPORTER_VERSION', '7.10.10'); |
| 42 |
define('EXPORTER_VERSION', '2.8.2'); |
| 43 |
require_once('Plugin.php'); |
| 44 |
require_once('SmackExporterInstall.php'); |
| 45 |
require_once('exportExtensions/ExportExtension.php'); |
| 46 |
|
| 47 |
if ( ! function_exists( 'is_plugin_active' ) ) { |
| 48 |
require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 49 |
} |
| 50 |
$upload = wp_upload_dir(); |
| 51 |
$exports_dir = $upload['basedir'] . '/smack_uci_uploads/exports/'; |
| 52 |
$htaccess_file = $exports_dir . '.htaccess'; |
| 53 |
if (file_exists($htaccess_file)) { |
| 54 |
unlink($htaccess_file); |
| 55 |
} |
| 56 |
if (is_plugin_active('wp-ultimate-exporter/wp-ultimate-exporter.php')) { |
| 57 |
$plugin_pages = ['com.smackcoders.csvimporternew.menu']; |
| 58 |
include __DIR__ . '/wp-exp-hooks.php'; |
| 59 |
global $plugin_ajax_hooks; |
| 60 |
|
| 61 |
$request_page = isset($_REQUEST['page']) ? $_REQUEST['page'] : ''; |
| 62 |
$request_action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; |
| 63 |
if (in_array($request_page, $plugin_pages) || in_array($request_action, $plugin_ajax_hooks)) { |
| 64 |
require_once('exportExtensions/JetEngine.php'); |
| 65 |
require_once('exportExtensions/LearnPress.php'); |
| 66 |
require_once('exportExtensions/MetaBox.php'); |
| 67 |
require_once('exportExtensions/ExportHandler.php'); |
| 68 |
require_once('exportExtensions/CustomerReviewsExport.php'); |
| 69 |
require_once('exportExtensions/PostExport.php'); |
| 70 |
require_once('exportExtensions/WooComExport.php'); |
| 71 |
|
| 72 |
} |
| 73 |
} |
| 74 |
|
| 75 |
if(! class_exists('Smackcoders\SMEXP\ExportExtension')){ |
| 76 |
ExpInstall::init(plugin_basename( __FILE__ )); |
| 77 |
add_action( 'admin_notices', 'Smackcoders\\SMEXP\\Notice_msg_exporter_free' ); |
| 78 |
} |
| 79 |
else { |
| 80 |
class ExpCSVHandler extends ExportExtension{ |
| 81 |
|
| 82 |
protected static $instance = null,$install,$exp_instance; |
| 83 |
|
| 84 |
public function __construct(){ |
| 85 |
$this->plugin = Plugin::getInstance(); |
| 86 |
add_action('wp_ajax_get_plugin_notice', array($this,'check_parent_plugin_version')); |
| 87 |
// add_action('wp_ajax_upgrade_notices_csv_bro',array($this,'dismiss_function')); |
| 88 |
add_action('wp_ajax_upgrade_notices_csv_bro', array($this,'dismiss_function')); |
| 89 |
add_action('wp_ajax_nopriv_upgrade_notices_csv_bro', array($this,'dismiss_function')); |
| 90 |
add_action('wp_ajax_dismiss_notice',array($this,'dismiss_function_new')); |
| 91 |
} |
| 92 |
|
| 93 |
public function dismiss_function_new() { |
| 94 |
update_option('csv_update_option', 0); |
| 95 |
exit(); |
| 96 |
} |
| 97 |
|
| 98 |
public function dismiss_function() { |
| 99 |
update_option('csv_update_option', 0); |
| 100 |
$response =array(); |
| 101 |
$response['value'] = 0; |
| 102 |
echo wp_json_encode($response); |
| 103 |
wp_die(); |
| 104 |
// exit(); |
| 105 |
} |
| 106 |
function check_parent_plugin_version() { |
| 107 |
$parent_plugin_dir = WP_PLUGIN_DIR . '/wp-ultimate-csv-importer/wp-ultimate-csv-importer.php'; |
| 108 |
$parent_plugin_data = get_plugin_data($parent_plugin_dir); |
| 109 |
$parent_version=$parent_plugin_data['Version']; |
| 110 |
|
| 111 |
$child_plugin_dir = WP_PLUGIN_DIR . '/wp-ultimate-exporter/wp-ultimate-exporter.php'; |
| 112 |
$child_plugin_data = get_plugin_data($child_plugin_dir); |
| 113 |
$child_version=$child_plugin_data['Version']; |
| 114 |
// if($parent_version < IMPORTER_VERSION || $child_version < EXPORTER_VERSION ){ |
| 115 |
if(version_compare($parent_version, IMPORTER_VERSION, '<') || version_compare($child_version,EXPORTER_VERSION, '<')){ |
| 116 |
$option_name = 'csv_update_option'; |
| 117 |
$option_value = 1; |
| 118 |
$autoload = true; |
| 119 |
if (get_option($option_name) === false) { |
| 120 |
add_option($option_name, $option_value, '', $autoload); |
| 121 |
} |
| 122 |
if(get_option('csv_update_option') == 1){ |
| 123 |
$response=array(); |
| 124 |
$response['message'] ='Important note: Please upgrade latest versions for security updates.'; |
| 125 |
$response['link'] = admin_url('plugins.php'); |
| 126 |
$response['value'] = 1; |
| 127 |
$response['dismiss'] = 'Dismiss this notice.'; |
| 128 |
$response['upgrade'] = 'Upgrade Now'; |
| 129 |
echo wp_json_encode($response); |
| 130 |
wp_die(); |
| 131 |
?> |
| 132 |
<!-- <div class="notice notice-info is-dismissible"> |
| 133 |
<p><?php//_e('Important note: Please upgrade your WP Ultimate CSV Importer to latest versions for security updates.', 'wp-ultimate-exporter'); ?></p> |
| 134 |
<p><a href="<?php //echo admin_url('plugins.php'); ?>" class="button"><?php //_e('Upgrade Now', 'wp-ultimate-exporter'); ?></a></p> |
| 135 |
<button type="submit"class="notice-dismiss" id="upgrade_notices_csv_bro"> |
| 136 |
<span class="screen-reader-text">Dismiss this notice.</span> |
| 137 |
</button> |
| 138 |
</div> --> |
| 139 |
<?php |
| 140 |
} |
| 141 |
} |
| 142 |
} |
| 143 |
// public static function is_upgrade_notice_dismissed() { |
| 144 |
// return get_option('csv_update_option', false); |
| 145 |
// } |
| 146 |
public static function getInstance() { |
| 147 |
if (ExpCSVHandler::$instance == null) { |
| 148 |
ExpCSVHandler::$instance = new ExpCSVHandler; |
| 149 |
ExpCSVHandler::$install = ExpInstall::getInstance(); |
| 150 |
ExpCSVHandler::$exp_instance = ExportExtension::getInstance(); |
| 151 |
|
| 152 |
return ExpCSVHandler::$instance; |
| 153 |
} |
| 154 |
return ExpCSVHandler::$instance; |
| 155 |
} |
| 156 |
/** |
| 157 |
* Init UserSmCSVHandlerPro when WordPress Initialises. |
| 158 |
*/ |
| 159 |
public function init() { |
| 160 |
if(is_admin()) { |
| 161 |
// Init action. |
| 162 |
do_action('uci_init'); |
| 163 |
} |
| 164 |
} |
| 165 |
} |
| 166 |
} |
| 167 |
|
| 168 |
add_action( 'plugins_loaded', 'Smackcoders\\SMEXP\\onpluginsload' ); |
| 169 |
|
| 170 |
|
| 171 |
function onpluginsload(){ |
| 172 |
$plugin_pages = ['com.smackcoders.csvimporternew.menu']; |
| 173 |
include __DIR__ . '/wp-exp-hooks.php'; |
| 174 |
global $plugin_ajax_hooks; |
| 175 |
|
| 176 |
$request_page = isset($_REQUEST['page']) ? $_REQUEST['page'] : ''; |
| 177 |
$request_action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; |
| 178 |
if (in_array($request_page, $plugin_pages) || in_array($request_action, $plugin_ajax_hooks)) { |
| 179 |
$plugin = ExpCSVHandler::getInstance(); |
| 180 |
} |
| 181 |
$upload = wp_upload_dir(); |
| 182 |
$upload_dir = $upload['basedir']; |
| 183 |
// if(!is_dir($upload_dir)){ |
| 184 |
// return false; |
| 185 |
// } |
| 186 |
// else{ |
| 187 |
// $exports_dir = $upload['basedir'] . '/smack_uci_uploads/exports/'; |
| 188 |
// $htaccess_content = "deny from all\n"; |
| 189 |
// $htaccess_file = $exports_dir . '.htaccess'; |
| 190 |
// if (!file_exists($htaccess_file)) { |
| 191 |
// file_put_contents($htaccess_file, $htaccess_content); |
| 192 |
// } |
| 193 |
// } |
| 194 |
} |
| 195 |
|
| 196 |
function Notice_msg_exporter_free() { |
| 197 |
|
| 198 |
?> |
| 199 |
<div class="notice notice-warning is-dismissible" > |
| 200 |
<p> WP Ultimate Exporter is an addon of <a href="https://wordpress.org/plugins/wp-ultimate-csv-importer" target="blank" style="cursor: pointer;text-decoration:none">WP Ultimate CSV Importer</a> plugin, kindly install it to continue using WP ultimate exporter. </p> |
| 201 |
</div> |
| 202 |
<?php |
| 203 |
|
| 204 |
}?> |
| 205 |
|