Acme Demo Setup - Version 1.0.4

Version Description

Download this release

Release Info

Developer acmethemes
Plugin Icon 128x128 Acme Demo Setup
Version 1.0.4
Comparing to
See all releases

Code changes from version 1.0.3 to 1.0.4

acme-demo-setup.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Acme Demo Setup
4
  Plugin URI:
5
  Description: One click demo import
6
- Version: 1.0.3
7
  Author: Acme Themes
8
  Author URI: https://www.acmethemes.com/
9
  License: GPLv2 or later
@@ -15,7 +15,7 @@ if ( !function_exists( 'add_action' ) ) {
15
  exit;
16
  }
17
  /*Define Constants for this plugin*/
18
- define( 'ACME_DEMO_SETUP_VERSION', '1.0' );
19
  define( 'ACME_DEMO_SETUP_PATH', plugin_dir_path( __FILE__ ) );
20
  define( 'ACME_DEMO_SETUP_URL', plugin_dir_url( __FILE__ ) );
21
 
3
  Plugin Name: Acme Demo Setup
4
  Plugin URI:
5
  Description: One click demo import
6
+ Version: 1.0.4
7
  Author: Acme Themes
8
  Author URI: https://www.acmethemes.com/
9
  License: GPLv2 or later
15
  exit;
16
  }
17
  /*Define Constants for this plugin*/
18
+ define( 'ACME_DEMO_SETUP_VERSION', '1.0.4' );
19
  define( 'ACME_DEMO_SETUP_PATH', plugin_dir_path( __FILE__ ) );
20
  define( 'ACME_DEMO_SETUP_URL', plugin_dir_url( __FILE__ ) );
21
 
inc/admin/upload.php CHANGED
@@ -68,7 +68,7 @@ if( !class_exists( 'Acme_Demo_Setup') ):
68
  /**
69
  * Handle the demo content upload and called to process
70
  *
71
- * @return string HTML Results or Error message
72
  */
73
  function handler() {
74
  $error = '';
@@ -91,11 +91,13 @@ if( !class_exists( 'Acme_Demo_Setup') ):
91
  $destination = $upload_dir['basedir'] . '/acme-demo-importer/';
92
 
93
  /*the zip file shouldn't content greater than 3 files*/
94
- $za = new ZipArchive();
95
- $za->open( $upload_zip_archive['tmp_name'] );
96
- $file_on_zip = $za->numFiles;
97
- if( $file_on_zip > 3 ){
98
- $error[] = __( "Invalid ZIP greater than 3 files" ,'acme-demo-importer');
 
 
99
  }
100
 
101
  /*unzip file*/
@@ -120,8 +122,7 @@ if( !class_exists( 'Acme_Demo_Setup') ):
120
  $required_files['dat'] = $destination.$filename;
121
  }
122
  else{
123
- $wp_filesystem->rmdir($destination, true );
124
- $error[] = __( "Invalid ZIP destination file" ,'acme-demo-importer');
125
  }
126
  }
127
 
@@ -145,53 +146,62 @@ if( !class_exists( 'Acme_Demo_Setup') ):
145
  }
146
 
147
  /*process import*/
148
- $this->import( $required_files );
 
 
 
 
 
149
  }
150
  }
151
 
152
  /*import */
153
- function import( $required_files ){
154
- /*before import*/
155
- do_action( 'acme_demo_setup_before_import',$required_files );
156
-
157
- /*xml demo import*/
158
- if( isset( $required_files['xml'] ) && !empty( $required_files['xml'] ) ){
159
- esc_html_e('Importing Demo Content...','acme-demo-import');
160
- echo "<br /><br />";
161
-
162
- // Try to update PHP memory limit (so that it does not run out of it).
163
- ini_set( 'memory_limit', apply_filters( 'acme_demo_setup_memory_limit', '50M' ) );
164
-
165
- $xml_import = new Acme_Demo_Setup_Wp_Import();
166
- $xml_import->fetch_attachments = true;
167
- set_time_limit(0);
168
- $xml_import -> import( $required_files['xml'] );
169
- }
170
 
171
- /*customizer import*/
172
- if( isset( $required_files['dat'] ) && !empty( $required_files['dat'] ) ){
173
- esc_html_e('Importing Customizer Data...','acme-demo-import');
174
- echo "<br /><br />";
175
 
176
- $wie_import = new Acme_Demo_Setup_CEI_Core();
177
- $wie_import -> _import( $required_files['dat'] );
178
- }
 
179
 
180
- /*widget import*/
181
- if( isset( $required_files['dat'] ) && !empty( $required_files['dat'] ) ){
182
- esc_html_e('Importing Widget Data...','acme-demo-import');
183
- echo "<br /><br />";
184
 
185
- acme_demo_setup_wie_process_import_file( $required_files['wie'] );
186
- }
187
 
188
- do_action( 'acme_demo_setup_after_import',$required_files );
 
189
 
190
- printf( esc_html__('All Done Visit your %s site %s','acme-demo-import'),'<a href='.esc_url( get_home_url()).' target="_blank">','</a>' );
191
- echo "<br /><br />";
 
192
 
193
- exit;
194
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
 
196
  /**
197
  * The upload form
68
  /**
69
  * Handle the demo content upload and called to process
70
  *
71
+ * @return void
72
  */
73
  function handler() {
74
  $error = '';
91
  $destination = $upload_dir['basedir'] . '/acme-demo-importer/';
92
 
93
  /*the zip file shouldn't content greater than 3 files*/
94
+ if( function_exists( 'ZipArchive')){
95
+ $za = new ZipArchive();
96
+ $za->open( $upload_zip_archive['tmp_name'] );
97
+ $file_on_zip = $za->numFiles;
98
+ if( $file_on_zip > 3 ){
99
+ $error[] = __( "Invalid ZIP greater than 3 files" ,'acme-demo-importer');
100
+ }
101
  }
102
 
103
  /*unzip file*/
122
  $required_files['dat'] = $destination.$filename;
123
  }
124
  else{
125
+ $error[] = sprintf( __( "Invalid ZIP destination file %s" ,'acme-demo-importer'),$destination.$filename );
 
126
  }
127
  }
128
 
146
  }
147
 
148
  /*process import*/
149
+ $this->import( $required_files , 0);
150
+
151
+ /*delete demo files*/
152
+ $wp_filesystem->rmdir($destination, true );
153
+
154
+ exit;
155
  }
156
  }
157
 
158
  /*import */
159
+ function import( $required_files, $exit = 1 ){
160
+ /*before import*/
161
+ do_action( 'acme_demo_setup_before_import',$required_files );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
 
163
+ /*xml demo import*/
164
+ if( isset( $required_files['xml'] ) && !empty( $required_files['xml'] ) ){
165
+ // Try to update PHP memory limit (so that it does not run out of it).
166
+ ini_set( 'memory_limit', apply_filters( 'acme_demo_setup_memory_limit', '50M' ) );
167
 
168
+ $xml_import = new Acme_Demo_Setup_Wp_Import();
169
+ $xml_import->fetch_attachments = true;
170
+ set_time_limit(0);
171
+ $xml_import -> import( $required_files['xml'] );
172
 
173
+ esc_html_e('Imported Demo Content xml...','acme-demo-import');
174
+ echo "<br /><br />";
175
+ }
 
176
 
177
+ /*customizer import*/
178
+ if( isset( $required_files['dat'] ) && !empty( $required_files['dat'] ) ){
179
 
180
+ $wie_import = new Acme_Demo_Setup_CEI_Core();
181
+ $wie_import -> _import( $required_files['dat'] );
182
 
183
+ esc_html_e('Imported Customizer Data...','acme-demo-import');
184
+ echo "<br /><br />";
185
+ }
186
 
187
+ /*widget import*/
188
+ if( isset( $required_files['dat'] ) && !empty( $required_files['dat'] ) ){
189
+
190
+ acme_demo_setup_wie_process_import_file( $required_files['wie'] );
191
+
192
+ esc_html_e('Imported Widget Data...','acme-demo-import');
193
+ echo "<br /><br />";
194
+ }
195
+
196
+ do_action( 'acme_demo_setup_after_import',$required_files );
197
+
198
+ printf( esc_html__('All Done Visit your %s site %s','acme-demo-import'),'<a href='.esc_url( get_home_url()).' target="_blank">','</a>' );
199
+ echo "<br /><br />";
200
+
201
+ if( $exit ){
202
+ exit;
203
+ }
204
+ }
205
 
206
  /**
207
  * The upload form
inc/frameworks/customizer-export-import/class-cei-core.php CHANGED
@@ -140,9 +140,9 @@ final class Acme_Demo_Setup_CEI_Core {
140
  $data = new stdClass();
141
 
142
  if ( ! function_exists( 'media_handle_sideload' ) ) {
143
- require_once( ABSPATH . 'wp-admin/includes/media.php' );
144
- require_once( ABSPATH . 'wp-admin/includes/file.php' );
145
- require_once( ABSPATH . 'wp-admin/includes/image.php' );
146
  }
147
  if ( ! empty( $file ) ) {
148
 
140
  $data = new stdClass();
141
 
142
  if ( ! function_exists( 'media_handle_sideload' ) ) {
143
+ require_once(ABSPATH . 'wp-admin/includes/media.php');
144
+ require_once(ABSPATH . 'wp-admin/includes/file.php');
145
+ require_once(ABSPATH . 'wp-admin/includes/image.php');
146
  }
147
  if ( ! empty( $file ) ) {
148
 
inc/frameworks/wordpress-importer/wordpress-importer.php CHANGED
@@ -13,7 +13,7 @@ if ( ! class_exists( 'WP_Importer' ) ) {
13
  }
14
 
15
  // include WXR file parsers
16
- require dirname( __FILE__ ) . '/parsers.php';
17
 
18
  /**
19
  * WordPress Importer class for managing the import process of a WXR file
13
  }
14
 
15
  // include WXR file parsers
16
+ require dirname(__FILE__) . '/parsers.php';
17
 
18
  /**
19
  * WordPress Importer class for managing the import process of a WXR file
readme.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: acmethemes, codersantosh
4
  Tags: demo, dummydata, import, acmethemes, themes, oneclick, customizer, widget
5
  Requires at least: 4.5
6
  Tested up to: 4.7.4
7
- Stable tag: 1.0.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -94,6 +94,9 @@ If you have the issues on the plugin [Visit Support Page](https://wordpress.org/
94
 
95
  == Changelog ==
96
 
 
 
 
97
  = 1.0.3
98
  * Update : Read Me
99
 
4
  Tags: demo, dummydata, import, acmethemes, themes, oneclick, customizer, widget
5
  Requires at least: 4.5
6
  Tested up to: 4.7.4
7
+ Stable tag: 1.0.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
94
 
95
  == Changelog ==
96
 
97
+ = 1.0.4
98
+ * Fixed : undefined function ZipArchive on some hosting
99
+
100
  = 1.0.3
101
  * Update : Read Me
102