Version Description
Download this release
Release Info
Developer | FameThemes |
Plugin | FameTheme Demo Importer |
Version | 1.0.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.2
- assets/css/importer.css +11 -0
- famethemes-demo-importer.php +121 -2
- readme.txt +3 -0
assets/css/importer.css
CHANGED
@@ -42,3 +42,14 @@
|
|
42 |
.ft-import-error {
|
43 |
border-left-color: #dc3232;
|
44 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
.ft-import-error {
|
43 |
border-left-color: #dc3232;
|
44 |
}
|
45 |
+
.recommend-plugins {
|
46 |
+
background: #fff none repeat scroll 0 0;
|
47 |
+
box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
|
48 |
+
font-size: 14px;
|
49 |
+
line-height: 2.1em;
|
50 |
+
margin-bottom: 25px;
|
51 |
+
max-width: 1050px;
|
52 |
+
overflow: auto;
|
53 |
+
padding: 0px 25px 10px;
|
54 |
+
position: relative;
|
55 |
+
}
|
famethemes-demo-importer.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://github.com/FameThemes/famethemes-demo-importer
|
|
5 |
Description: Demo data import tool for FameThemes's themes.
|
6 |
Author: famethemes
|
7 |
Author URI: http://www.famethemes.com/
|
8 |
-
Version: 1.0.
|
9 |
Text Domain: ftdi
|
10 |
License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
*/
|
@@ -34,7 +34,6 @@ class FT_Demo_Content_Importer {
|
|
34 |
add_action( $theme_slug.'_demo_import_content_tab', array( $this, 'display_import' ) );
|
35 |
}
|
36 |
|
37 |
-
|
38 |
add_action( 'customize_controls_print_footer_scripts', array( $this, 'update_customizer_keys' ) );
|
39 |
if ( is_admin() ) {
|
40 |
add_action( 'admin_enqueue_scripts', array( $this, 'css' ) );
|
@@ -99,6 +98,115 @@ class FT_Demo_Content_Importer {
|
|
99 |
update_option( $key, $data );
|
100 |
}
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
function display_import(){
|
103 |
$nonce = wp_create_nonce( 'ft_demo_import' );
|
104 |
$url = admin_url('admin-ajax.php');
|
@@ -136,6 +244,8 @@ class FT_Demo_Content_Importer {
|
|
136 |
|
137 |
$this->js();
|
138 |
|
|
|
|
|
139 |
?>
|
140 |
<div class="ft-import-box ft-import-welcome">
|
141 |
<h3><?php esc_html_e( 'Welcome to FameThemes Demo Importer!', 'ftdi' ); ?></h3>
|
@@ -150,6 +260,15 @@ class FT_Demo_Content_Importer {
|
|
150 |
<p><?php esc_html_e( 'Notice: If your site already has content, please make sure you backup your database and WordPress files before import demo data.', 'ftdi' ); ?></p>
|
151 |
</div>
|
152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
|
154 |
<?php if ( $this->check_data_exists( $current_item ) ){ ?>
|
155 |
<div class="ft-import-box ft-import-theme">
|
5 |
Description: Demo data import tool for FameThemes's themes.
|
6 |
Author: famethemes
|
7 |
Author URI: http://www.famethemes.com/
|
8 |
+
Version: 1.0.2
|
9 |
Text Domain: ftdi
|
10 |
License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
*/
|
34 |
add_action( $theme_slug.'_demo_import_content_tab', array( $this, 'display_import' ) );
|
35 |
}
|
36 |
|
|
|
37 |
add_action( 'customize_controls_print_footer_scripts', array( $this, 'update_customizer_keys' ) );
|
38 |
if ( is_admin() ) {
|
39 |
add_action( 'admin_enqueue_scripts', array( $this, 'css' ) );
|
98 |
update_option( $key, $data );
|
99 |
}
|
100 |
|
101 |
+
function get_recommend_plugins(){
|
102 |
+
$recommend_plugins = get_theme_support( 'recommend-plugins' );
|
103 |
+
if ( is_array( $recommend_plugins ) && isset( $recommend_plugins[0] ) ){
|
104 |
+
$recommend_plugins = $recommend_plugins[0];
|
105 |
+
} else {
|
106 |
+
$recommend_plugins[] = array();
|
107 |
+
}
|
108 |
+
|
109 |
+
return $recommend_plugins;
|
110 |
+
}
|
111 |
+
|
112 |
+
function has_inactive_recommend_plugins( $recommend_plugins = false ){
|
113 |
+
if ( ! $recommend_plugins ) {
|
114 |
+
$recommend_plugins = $this->get_recommend_plugins( ) ;
|
115 |
+
}
|
116 |
+
$all_active = true;
|
117 |
+
if ( ! empty( $recommend_plugins ) ) {
|
118 |
+
foreach ( $recommend_plugins as $plugin_slug => $plugin_info ) {
|
119 |
+
$plugin_info = wp_parse_args( $plugin_info, array(
|
120 |
+
'name' => '',
|
121 |
+
'active_filename' => '',
|
122 |
+
) );
|
123 |
+
if ( $plugin_info['active_filename'] ) {
|
124 |
+
$active_file_name = $plugin_info['active_filename'] ;
|
125 |
+
} else {
|
126 |
+
$active_file_name = $plugin_slug . '/' . $plugin_slug . '.php';
|
127 |
+
}
|
128 |
+
if ( ! is_plugin_active( $active_file_name ) ) {
|
129 |
+
$all_active = false;
|
130 |
+
}
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
return ( $all_active ) ? false : true;
|
135 |
+
}
|
136 |
+
|
137 |
+
function render_recommend_plugins( $recommend_plugins = false ){
|
138 |
+
if ( ! $recommend_plugins ) {
|
139 |
+
$recommend_plugins = $this->get_recommend_plugins( ) ;
|
140 |
+
}
|
141 |
+
|
142 |
+
if ( empty( $recommend_plugins ) ) {
|
143 |
+
return false;
|
144 |
+
}
|
145 |
+
foreach ( $recommend_plugins as $plugin_slug => $plugin_info ) {
|
146 |
+
$plugin_info = wp_parse_args( $plugin_info, array(
|
147 |
+
'name' => '',
|
148 |
+
'active_filename' => '',
|
149 |
+
) );
|
150 |
+
$plugin_name = $plugin_info['name'];
|
151 |
+
$status = is_dir( WP_PLUGIN_DIR . '/' . $plugin_slug );
|
152 |
+
$button_class = 'install-now button';
|
153 |
+
if ( $plugin_info['active_filename'] ) {
|
154 |
+
$active_file_name = $plugin_info['active_filename'] ;
|
155 |
+
} else {
|
156 |
+
$active_file_name = $plugin_slug . '/' . $plugin_slug . '.php';
|
157 |
+
}
|
158 |
+
|
159 |
+
if ( ! is_plugin_active( $active_file_name ) ) {
|
160 |
+
$button_txt = esc_html__( 'Install Now', 'ftdi' );
|
161 |
+
if ( ! $status ) {
|
162 |
+
$install_url = wp_nonce_url(
|
163 |
+
add_query_arg(
|
164 |
+
array(
|
165 |
+
'action' => 'install-plugin',
|
166 |
+
'plugin' => $plugin_slug
|
167 |
+
),
|
168 |
+
network_admin_url( 'update.php' )
|
169 |
+
),
|
170 |
+
'install-plugin_'.$plugin_slug
|
171 |
+
);
|
172 |
+
|
173 |
+
} else {
|
174 |
+
$install_url = add_query_arg(array(
|
175 |
+
'action' => 'activate',
|
176 |
+
'plugin' => rawurlencode( $active_file_name ),
|
177 |
+
'plugin_status' => 'all',
|
178 |
+
'paged' => '1',
|
179 |
+
'_wpnonce' => wp_create_nonce('activate-plugin_' . $active_file_name ),
|
180 |
+
), network_admin_url('plugins.php'));
|
181 |
+
$button_class = 'activate-now button-primary';
|
182 |
+
$button_txt = esc_html__( 'Active Now', 'ftdi' );
|
183 |
+
}
|
184 |
+
|
185 |
+
$detail_link = add_query_arg(
|
186 |
+
array(
|
187 |
+
'tab' => 'plugin-information',
|
188 |
+
'plugin' => $plugin_slug,
|
189 |
+
'TB_iframe' => 'true',
|
190 |
+
'width' => '772',
|
191 |
+
'height' => '349',
|
192 |
+
|
193 |
+
),
|
194 |
+
network_admin_url( 'plugin-install.php' )
|
195 |
+
);
|
196 |
+
|
197 |
+
echo '<div class="rcp">';
|
198 |
+
echo '<h4 class="rcp-name">';
|
199 |
+
echo esc_html( $plugin_name );
|
200 |
+
echo '</h4>';
|
201 |
+
echo '<p class="action-btn plugin-card-'.esc_attr( $plugin_slug ).'"><a href="'.esc_url( $install_url ).'" data-slug="'.esc_attr( $plugin_slug ).'" class="'.esc_attr( $button_class ).'">'.$button_txt.'</a></p>';
|
202 |
+
echo '<a class="plugin-detail thickbox open-plugin-details-modal" href="'.esc_url( $detail_link ).'">'.esc_html__( 'Details', 'ftdi' ).'</a>';
|
203 |
+
echo '</div>';
|
204 |
+
}
|
205 |
+
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
+
|
210 |
function display_import(){
|
211 |
$nonce = wp_create_nonce( 'ft_demo_import' );
|
212 |
$url = admin_url('admin-ajax.php');
|
244 |
|
245 |
$this->js();
|
246 |
|
247 |
+
$recommend_plugins = $this->get_recommend_plugins();
|
248 |
+
|
249 |
?>
|
250 |
<div class="ft-import-box ft-import-welcome">
|
251 |
<h3><?php esc_html_e( 'Welcome to FameThemes Demo Importer!', 'ftdi' ); ?></h3>
|
260 |
<p><?php esc_html_e( 'Notice: If your site already has content, please make sure you backup your database and WordPress files before import demo data.', 'ftdi' ); ?></p>
|
261 |
</div>
|
262 |
|
263 |
+
<?php if ( ! empty( $recommend_plugins ) && $this->has_inactive_recommend_plugins( $recommend_plugins ) ) { ?>
|
264 |
+
<div id="plugin-filter" class="recommend-plugins">
|
265 |
+
<h3><?php esc_html_e( 'Recommend Plugins', 'ftdi' ); ?></h3>
|
266 |
+
<p><?php esc_html_e( 'To fully import demo content, please install and activate all recommend plugins before import.', 'ftdi' ); ?></p>
|
267 |
+
<?php
|
268 |
+
$this->render_recommend_plugins();
|
269 |
+
?>
|
270 |
+
</div>
|
271 |
+
<?php } ?>
|
272 |
|
273 |
<?php if ( $this->check_data_exists( $current_item ) ){ ?>
|
274 |
<div class="ft-import-box ft-import-theme">
|
readme.txt
CHANGED
@@ -29,6 +29,9 @@ Working with themes:
|
|
29 |
|
30 |
|
31 |
== Changelog ==
|
|
|
|
|
|
|
32 |
= 1.0.1
|
33 |
* Improve and fix bug.
|
34 |
|
29 |
|
30 |
|
31 |
== Changelog ==
|
32 |
+
= 1.0.2
|
33 |
+
* Add recommend plugins notices.
|
34 |
+
|
35 |
= 1.0.1
|
36 |
* Improve and fix bug.
|
37 |
|