ThemeGrill Demo Importer - Version 1.3.1

Version Description

  • Tweak - Load screenshot from theme instead of plugin for themes with single demo.
Download this release

Release Info

Developer ThemeGrill
Plugin Icon 128x128 ThemeGrill Demo Importer
Version 1.3.1
Comparing to
See all releases

Code changes from version 1.3.0 to 1.3.1

assets/images/colormag/colormag-free.jpg DELETED
Binary file
assets/images/spacious/spacious-free.jpg DELETED
Binary file
includes/class-demo-importer.php CHANGED
@@ -99,6 +99,32 @@ class TG_Demo_Importer {
99
 
100
  return trailingslashit( $working_dir ) . sanitize_file_name( $filename );
101
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
  /**
104
  * Get the import file path.
@@ -272,7 +298,7 @@ class TG_Demo_Importer {
272
  'name' => $demo_data['name'],
273
  'author' => $author,
274
  'installed' => $installed,
275
- 'screenshot' => "{$demo_assets_path}images/{$current_template}/{$demo_id}.jpg",
276
  'description' => isset( $demo_data['description'] ) ? $demo_data['description'] : '',
277
  'actions' => array(
278
  'preview_url' => $demo_data['preview'],
99
 
100
  return trailingslashit( $working_dir ) . sanitize_file_name( $filename );
101
  }
102
+ /**
103
+ * Get theme screenshot url to be used in demo importer preview
104
+ *
105
+ * @param string $demo_id
106
+ * @param string $demo_assets_path
107
+ * @param string $current_template
108
+ * @return string
109
+ */
110
+ public function get_screenshot_url( $demo_id, $demo_assets_path, $current_template ) {
111
+ $dir = plugin_dir_path( __FILE__ );
112
+
113
+ //build screenshot url that reside inside the plugin
114
+ $screenshot_plugin_url = $demo_assets_path. 'images/' .$current_template. '/' .$demo_id. '.jpg';
115
+
116
+ //build screenshot path that reside inside the plugin
117
+ $screenshot_plugin_path = ThemeGrill_Demo_Importer::plugin_dir_path() . '/assets/images/' .$current_template. '/' .$demo_id. '.jpg';
118
+
119
+ if ( file_exists( $screenshot_plugin_path ) ) {
120
+ $screenshot_url = $screenshot_plugin_url;
121
+ } else {
122
+ $theme_data = wp_get_theme();
123
+ $screenshot_url = $theme_data->get_screenshot();
124
+ }
125
+ return $screenshot_url;
126
+
127
+ }
128
 
129
  /**
130
  * Get the import file path.
298
  'name' => $demo_data['name'],
299
  'author' => $author,
300
  'installed' => $installed,
301
+ 'screenshot' => $this->get_screenshot_url( $demo_id, $demo_assets_path, $current_template ),
302
  'description' => isset( $demo_data['description'] ) ? $demo_data['description'] : '',
303
  'actions' => array(
304
  'preview_url' => $demo_data['preview'],
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: ThemeGrill, shivapoudel
3
  Tags: themegrill, themes, demo, importer, download
4
  Requires at least: 4.0
5
  Tested up to: 4.7
6
- Stable tag: 1.3.0
7
  License: GPLv3 or later
8
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -39,8 +39,11 @@ Yes you can! Join in on our [GitHub repository](https://github.com/themegrill/th
39
 
40
  == Changelog ==
41
 
 
 
 
42
  = 1.3.0 =
43
- * Tweak - Suppor data update for nested siteorigin nested layoutbuilder.
44
  * Fix - Import button not working on firefox.
45
 
46
  = 1.2.0 =
3
  Tags: themegrill, themes, demo, importer, download
4
  Requires at least: 4.0
5
  Tested up to: 4.7
6
+ Stable tag: 1.3.1
7
  License: GPLv3 or later
8
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
9
 
39
 
40
  == Changelog ==
41
 
42
+ = 1.3.1 =
43
+ * Tweak - Load screenshot from theme instead of plugin for themes with single demo.
44
+
45
  = 1.3.0 =
46
+ * Tweak - Support data update for nested siteorigin layoutbuilder.
47
  * Fix - Import button not working on firefox.
48
 
49
  = 1.2.0 =
themegrill-demo-importer.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
  * Plugin Name: ThemeGrill Demo Importer
4
- * Plugin URI: http://themegrill.com/demo-importer/
5
  * Description: Description: Import your demo content, widgets and theme settings with one click for ThemeGrill official themes.
6
- * Version: 1.3.0
7
  * Author: ThemeGrill
8
- * Author URI: http://themegrill.com
9
  * License: GPLv3 or later
10
  * Text Domain: themegrill-demo-importer
11
  * Domain Path: /languages/
@@ -26,7 +26,7 @@ final class ThemeGrill_Demo_Importer {
26
  * Plugin version.
27
  * @var string
28
  */
29
- const VERSION = '1.3.0';
30
 
31
  /**
32
  * Instance of this class.
@@ -119,7 +119,7 @@ final class ThemeGrill_Demo_Importer {
119
  */
120
  private function get_core_supported_themes() {
121
  $pro_themes = array();
122
- $core_themes = array( 'spacious', 'colormag', 'flash', 'estore' );
123
 
124
  // Check for core themes pro version :)
125
  foreach ( $core_themes as $core_theme ) {
@@ -160,6 +160,14 @@ final class ThemeGrill_Demo_Importer {
160
  return untrailingslashit( plugins_url( '/', __FILE__ ) );
161
  }
162
 
 
 
 
 
 
 
 
 
163
  /**
164
  * Display action links in the Plugins list table.
165
  * @param array $actions
1
  <?php
2
  /**
3
  * Plugin Name: ThemeGrill Demo Importer
4
+ * Plugin URI: https://themegrill.com/demo-importer/
5
  * Description: Description: Import your demo content, widgets and theme settings with one click for ThemeGrill official themes.
6
+ * Version: 1.3.1
7
  * Author: ThemeGrill
8
+ * Author URI: https://themegrill.com
9
  * License: GPLv3 or later
10
  * Text Domain: themegrill-demo-importer
11
  * Domain Path: /languages/
26
  * Plugin version.
27
  * @var string
28
  */
29
+ const VERSION = '1.3.1';
30
 
31
  /**
32
  * Instance of this class.
119
  */
120
  private function get_core_supported_themes() {
121
  $pro_themes = array();
122
+ $core_themes = array( 'spacious', 'colormag', 'flash', 'estore', 'ample', 'accelerate', 'colornews', 'foodhunt', 'fitclub', 'radiate','freedom', 'himalayas', 'esteem', 'envince' );
123
 
124
  // Check for core themes pro version :)
125
  foreach ( $core_themes as $core_theme ) {
160
  return untrailingslashit( plugins_url( '/', __FILE__ ) );
161
  }
162
 
163
+ /**
164
+ * Get the plugin dir path.
165
+ * @return string
166
+ */
167
+ public static function plugin_dir_path() {
168
+ return untrailingslashit( plugin_dir_path( __FILE__ ) );
169
+ }
170
+
171
  /**
172
  * Display action links in the Plugins list table.
173
  * @param array $actions