PluginProbe
WP Directory Kit / 1.1.8
WP Directory Kit v1.1.8
1.5.9 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 All 37 releases
wpdirectorykit / application / views / wdk_demo_import / step_1.php

step_1.php in WP Directory Kit 1.1.8, at application/views/wdk_demo_import/step_1.php

212 lines 7.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The template for Settings.
4 *
5 * This is the template that edit form settings
6 *
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly.
11 }
12 ?>
13 <!-- This file should primarily consist of HTML with a little bit of PHP. -->
14
15 <div class="wrap wdk-wrap">
16 <h1 class="wp-heading-inline"><?php echo __('WDK Demo Import', 'wpdirectorykit'); ?></h1>
17 <br /><br />
18 <div class="wdk-body">
19 <div class="postbox" style="display: block;">
20 <div class="postbox-header">
21 <h3><?php echo __('Step 1 Import for theme:', 'wpdirectorykit'); ?> <?php echo esc_html($current_theme->get( 'Name' )); ?></h3>
22 </div>
23 <div class="inside">
24 <div class="wdk-install-plugins-content-header">
25 <h2><?php echo __('Before We Import Your Demo', 'wpdirectorykit'); ?></h2>
26 <p><?php echo __('To ensure the best experience, installing the following plugins is strongly recommended, and in some cases required.', 'wpdirectorykit'); ?></p>
27 </div>
28 <?php foreach($theme_plugins as $theme_plugin): ?>
29
30 <label slug="<?php echo esc_attr($theme_plugin['slug']); ?>" source="<?php echo isset($theme_plugin['source'])?esc_attr($theme_plugin['source']):''; ?>"
31 class="plugin-item plugin-item-<?php echo esc_attr($theme_plugin['slug']); ?> <?php echo is_plugin_active( $theme_plugin['slug'].'/'.$theme_plugin['slug'].'.php' )?'plugin_active':'';?>plugin-item--active plugin-item--required" for="wdk-<?php echo esc_attr($theme_plugin['slug']); ?>-plugin">
32 <div class="plugin-item-content">
33 <div class="plugin-item-content-title">
34 <h3><img src="<?php echo WPDIRECTORYKIT_URL; ?>admin/img/loader.svg" class="wdk-loading wdk-loading-md hidden" alt="Loading..."><?php echo esc_html($theme_plugin['name']); ?></h3>
35 </div>
36 <div class="plugin-item-error js-wdk-plugin-item-error"></div>
37 <div class="plugin-item-info js-wdk-plugin-item-info"></div>
38 </div>
39 <span class="plugin-item-checkbox">
40 <?php if(is_plugin_active( $theme_plugin['slug'].'/'.$theme_plugin['slug'].'.php' )): ?>
41 <span class="green"><?php echo __('Already active', 'wpdirectorykit'); ?><span>
42 <?php else: ?>
43 <input type="checkbox" id="wdk-<?php echo esc_attr($theme_plugin['slug']); ?>-plugin" name="<?php echo esc_attr($theme_plugin['slug']); ?>" <?php echo is_plugin_active( $theme_plugin['slug'].'/'.$theme_plugin['slug'].'.php' )?'':'checked="checked"';?>>
44 <?php endif; ?>
45 </span>
46 </label>
47
48 <?php endforeach; ?>
49 </div>
50 </div>
51 <p class="wdk_button-container">
52 <a href="<?php echo admin_url('tools.php?page=wdk_demo_import&function=step_2');?>" class="install_button wdk_button button button-hero button-primary"><?php echo __('Continue & Import','wpdirectorykit'); ?></a>
53 </p>
54 </div>
55 <br/>
56 <div class="alert alert-info" role="alert"><a href="<?php echo esc_html($current_theme->get( 'ThemeURI' )); ?>" target="_blank"><?php echo __('Theme Data will be downloaded from API:','wpdirectorykit'); ?> <?php echo esc_html($current_theme->get( 'AuthorURI' )); ?> <?php echo __('On any trouble contact us via website contact page.','wpdirectorykit'); ?></a></div>
57 </div>
58
59 <script>
60
61 jQuery( document ).ready(function($) {
62
63 $('.install_button').click(function (event) {
64
65 // Don't follow the link
66 event.preventDefault();
67
68 if($(this)[0].hasAttribute("disabled"))
69 {
70 alert('Wait until proccess complete or if takes to long (more then 10 mins) then refresh');
71 return false;
72 }
73
74 $(this).attr('disabled','disabled');
75
76 $.ajaxSetup({async: false});
77
78 var is_failed=false;
79
80 $( ".plugin-item" ).each(function() {
81 var slug = $( this ).attr('slug');
82 var source = $( this ).attr('source');
83
84 if (typeof source == "undefined" ) {
85 source = '';
86 }
87
88 if(!$(this).find('input[type="checkbox"]').is(':checked'))
89 return;
90
91 var ajax_nonce = '<?php echo wp_create_nonce( 'updates' ); ?>';
92
93 var that = $(this);
94
95 var ajax_param = {
96 "page": 'wdk_backendajax',
97 "function": 'plugin_upgrader',
98 "action": 'wdk_public_action',
99 "slug": slug,
100 "source": source,
101 };
102
103 that.attr("disabled", "disabled");
104 /*that.unbind('click');*/
105
106 var ajax_indicator = $(this).find('.wdk-loading');
107 ajax_indicator.show();
108 that.addClass('active');
109 var jqxhr = $.post( "<?php echo admin_url( 'admin-ajax.php' ); ?>", ajax_param, function(data) {
110
111 if(data.success == true)
112 {
113 that.find('h3').css('color', 'green');
114 } else if(typeof(data.slug) != "undefined") {
115 that.after("<div class=\"alert alert-danger\" role=\"alert\"><?php echo __('Error:', 'wpdirectorykit'); ?> <b style=\"color:red;\">"+data.slug+" "+data.message+"</b></div>");
116 }
117 else
118 {
119 that.after("<div class=\"alert alert-danger\" role=\"alert\"><?php echo __('Error:', 'wpdirectorykit'); ?> <b style=\"color:red;\">"+data+"</b></div>");
120 }
121
122 })
123 .done(function(data) {
124 })
125 .fail(function(data) {
126
127 if(typeof(data.responseText) != "undefined")
128 {
129 that.after("<div class=\"alert alert-danger\" role=\"alert\"><?php echo __('Error:', 'wpdirectorykit'); ?> <b style=\"color:red;\">"+data.responseText+"</b></div>");
130 }
131 else
132 {
133 that.after("<div class=\"alert alert-danger\" role=\"alert\"><?php echo __('Error:', 'wpdirectorykit'); ?> <b style=\"color:red;\">"+data+"</b></div>");
134 }
135
136 is_failed=true;
137 })
138 .always(function(data) {
139 ajax_indicator.hide();
140 that.removeClass('active');
141 });
142
143 });
144
145 $.ajaxSetup({async: true});
146
147 if(is_failed == false)
148 window.location.replace($(this).attr('href'));
149 else
150 $(this).removeAttr('disabled');
151 });
152 });
153
154
155 </script>
156
157 <style>
158
159 .wdk-install-plugins-content-header {
160 padding: 30px;
161 border-bottom: 1px solid #dddddd;
162 }
163
164 .inside .plugin-item{
165 display: -webkit-box;
166 display: -ms-flexbox;
167 display: flex;
168 -webkit-box-pack: justify;
169 -ms-flex-pack: justify;
170 justify-content: space-between;
171 -webkit-box-align: center;
172 -ms-flex-align: center;
173 align-items: center;
174 margin: 0 30px;
175 padding: 0px 0;
176 border-bottom: 1px solid #eeeeee;
177 }
178
179 .wdk-loading-md {
180 width: 32px;
181 height: 32px;
182 }
183
184 .wdk-loading {
185 -webkit-animation: 0.65s linear infinite wdk-rotation;
186 animation: 0.65s linear infinite wdk-rotation;
187 height:18px;
188 margin-right: 5px;
189 }
190
191 .wdk-loading.hidden
192 {
193 display:none;
194 }
195
196 @keyframes wdk-rotation {
197 from {
198 transform: rotate(0deg);
199 }
200 to {
201 transform: rotate(359deg);
202 }
203 }
204
205 span.green
206 {
207 color: green;
208 }
209
210 </style>
211
212 <?php $this->view('general/footer', $data); ?>