PluginProbe
Import WooCommerce Suite for Products, Orders, Coupons, Reviews, and Customers | WP Ultimate CSV Importer / trunk
Import WooCommerce Suite for Products, Orders, Coupons, Reviews, and Customers | WP Ultimate CSV Importer vtrunk
3.0 2.9.2 2.9.1 trunk 1.0 1.0.1 1.1 1.2 1.3 1.4 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6 1.6.1 1.6.2 1.6.3 1.6.4 All 48 releases
import-woocommerce / import-woocommerce.php

import-woocommerce.php in Import WooCommerce Suite for Products, Orders, Coupons, Reviews, and Customers | WP Ultimate CSV Importer trunk, at import-woocommerce.php

170 lines 5.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Import Woocommerce.
4 *
5 * Import Woocommerce plugin file.
6 *
7 * @package Smackcoders\SMWC
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: Import Woocommerce
13 * Description: Import your WordPress Post, Page and Simple WooCommerce Product with Import Woocommerce.
14 * Version: 3.0
15 * Text Domain: import-woocommerce
16 * Domain Path: /languages
17 * Author: smackcoders
18 * Author URI: https://www.smackcoders.com
19 * License: GPL v3
20 *
21 * This program is free software: you can redistribute it and/or modify
22 * it under the terms of the GNU General Public License as published by
23 * the Free Software Foundation, either version 3 of the License, or
24 * (at your option) any later version.
25 *
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
30 *
31 * You should have received a copy of the GNU General Public License
32 * along with this program. If not, see <https://www.gnu.org/licenses/>.
33 */
34
35 namespace Smackcoders\SMWC;
36
37 if ( ! defined( 'ABSPATH' ) )
38 exit; // Exit if accessed directly
39
40 require_once('SmackImportCommercePlugin.php');
41 require_once('SmackInstallImportWoocommerce.php');
42
43 require_once('importExtensions/WooCommerceCoreImport.php');
44
45 $import_extensions = glob( __DIR__ . '/importExtensions/*.php');
46 foreach ($import_extensions as $import_extension_value) {
47 require_once($import_extension_value);
48 }
49
50
51 class WooComCSVHandler extends ImportHelpers {
52
53 private static $instance = null;
54 private static $install = null,$plugin_instance=null ;
55
56 public $version = '3.0';
57
58 public function __construct(){
59 add_action('wp_ajax_DeactivateMailwoocommerce',array(__CLASS__,'deactivate_mail_woocommerce'));
60
61 $plugin_instance = Plugin::getInstance();
62 }
63
64 public static function getInstance() {
65 if (WooComCSVHandler::$instance == null) {
66 WooComCSVHandler::$instance = new WooComCSVHandler;
67 WooComCSVHandler::$install = WcomInstall::getInstance();
68 if ( ! function_exists( 'is_plugin_active' ) ) {
69 require_once ABSPATH . 'wp-admin/includes/plugin.php';
70 }
71
72 self::init_hooks();
73 add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array(WooComCSVHandler::$install, 'plugin_row_meta'), 10, 2 );
74 return WooComCSVHandler::$instance;
75 }
76 return WooComCSVHandler::$instance;
77 }
78
79 public static function init_hooks() {
80 add_action( 'admin_notices', array(WooComCSVHandler::$instance,'admin_notice_importwcom'));
81 add_action('popup_woocommerce', array(__CLASS__, 'deactivate_popup_woocommerce'));
82 do_action('popup_woocommerce');
83 }
84 public static function deactivate_popup_woocommerce(){
85 if(isset($_REQUEST['plugin_status'])){
86 }
87 }
88 public static function deactivate_mail_woocommerce(){
89 // check_ajax_referer('smack-ultimate-csv-importer', 'securekey');
90 $headers= array( "Content-type: text/html; charset=UTF-8");
91 $to = 'support@smackcoders.com';
92 $subject = 'Reason for csv import woocommerce addon plugin deactivation';
93 $message = sanitize_text_field($_REQUEST["reason"]);
94 $urlparts = parse_url(home_url());
95 $domain_name = $urlparts['host'];
96
97 if ($domain_name == 'localhost')
98 {
99 $headers = 'From: Wordpress<wordpress@mysite.com>';
100 add_filter('wp_mail_content_type', function ($content_type)
101 {
102 return 'text/html';
103 });
104 $value =wp_mail($to, $subject, $message, $headers);
105 }
106 else{
107 $value = wp_mail($to, $subject, $message, $headers);
108 }
109 $response = array('success' => true, 'code' => 200);
110 echo wp_json_encode($response);
111 wp_die();
112 }
113 public static function admin_notice_importwcom() {
114 global $pagenow;
115 $active_plugins = get_option( "active_plugins" );
116 if ( $pagenow == 'plugins.php' && !in_array('wp-ultimate-csv-importer/wp-ultimate-csv-importer.php', $active_plugins) ) {
117 ?>
118 <div class="notice notice-warning is-dismissible" >
119 <p> Import Woocommerce 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 import woocommerce. </p>
120 <p>
121 </div>
122 <?php
123 }
124 }
125
126 public function menu_testing_function(){
127 ?><div id="wp-csv-importer-admin"></div><?php
128 }
129
130 /**
131 * Generates unique key for each file.
132 * @param string $value - filename
133 * @return string hashkey
134 */
135 public function convert_string2hash_key($value) {
136 $file_name = hash_hmac('md5', "$value" . time() , 'secret');
137 return $file_name;
138 }
139
140
141 /**
142 * Creates a folder in uploads.
143 * @return string path to that folder
144 */
145 public function create_upload_dir(){
146
147 $upload = wp_upload_dir();
148 $upload_dir = $upload['basedir'];
149 if(!is_dir($upload_dir)){
150 return false;
151 }else{
152 $upload_dir = $upload_dir . '/smack_uci_uploads/imports/';
153 if (!is_dir($upload_dir)) {
154 wp_mkdir_p( $upload_dir);
155 }
156 chmod($upload_dir, 0777);
157 return $upload_dir;
158 }
159 chmod($upload_dir, 0777);
160 return $upload_dir;
161 }
162 }
163 add_action( 'plugins_loaded', 'Smackcoders\\SMWC\\onpluginsload' );
164 function onpluginsload(){
165 $plugin = WooComCSVHandler::getInstance();
166 }
167 global $uci_woocomm;
168 $uci_woocomm = new WooComCSVHandler;
169 ?>
170