PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.3.2
Pods – Custom Content Types and Fields v3.3.2
trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / components / Migrate-PHP / ui / wizard.php
pods / components / Migrate-PHP / ui Last commit date
wizard.php 1 year ago
wizard.php
270 lines
1 <div class="wrap pods-admin">
2 <div id="icon-pods" class="icon32"><br /></div>
3
4 <form action="" method="post" class="pods-submittable">
5 <div class="pods-submittable-fields">
6 <?php echo PodsForm::field( 'action', 'pods_admin_components', 'hidden' ); ?>
7 <?php echo PodsForm::field( 'component', $component, 'hidden' ); ?>
8 <?php echo PodsForm::field( 'method', $method, 'hidden' ); ?>
9 <?php echo PodsForm::field( '_wpnonce', wp_create_nonce( 'pods-component-' . $component . '-' . $method ), 'hidden' ); ?>
10 <?php echo PodsForm::field( 'cleanup', 0, 'hidden', array( 'attributes' => array( 'id' => 'pods_cleanup' ) ) ); ?>
11
12 <h2 class="italicized"><?php esc_html_e( 'Migrate: Pod Page and Pod Template PHP into File-based templates', 'pods' ); ?></h2>
13
14 <img src="<?php echo esc_url( PODS_URL ); ?>ui/images/pods-logo-notext-rgb-transparent.png" class="pods-leaf-watermark-right" />
15
16 <div id="pods-wizard-box" class="pods-wizard-steps-2 pods-wizard-hide-first">
17 <div id="pods-wizard-heading">
18 <ul>
19 <li class="pods-wizard-menu-current" data-step="1">
20 <i></i> <span>1</span> <?php esc_html_e( 'Step 1: Setup', 'pods' ); ?>
21 <em></em>
22 </li>
23 <li data-step="2">
24 <i></i> <span>2</span> <?php esc_html_e( 'Step 2: Migrate', 'pods' ); ?>
25 <em></em>
26 </li>
27 </ul>
28 </div>
29 <div id="pods-wizard-main">
30 <div id="pods-wizard-panel-1" class="pods-wizard-panel">
31 <div class="pods-wizard-content">
32 <p><?php esc_html_e( 'PHP in Pods is deprecated and will no longer be supported. You can use this tool to migrate your Pod Pages and Pod Templates into files within your current theme.', 'pods' ); ?></p>
33
34 <?php if ( ! $has_objects_to_migrate ) : ?>
35 <p>�
36 <?php esc_html_e( 'No Pod Pages or Pod Templates have been found that contain PHP.', 'pods' ); ?></p>
37 <?php endif; ?>
38 </div>
39
40 <?php if ( $has_objects_to_migrate ) : ?>
41 <div id="pods-wizard-options">
42 <div class="pods-wizard-options-list">
43 <div class="pods-wizard-option">
44 <a href="#pods-wizard-run" data-opt="0">
45 <div>
46 <h2><?php esc_html_e( 'Migrate PHP to files', 'pods' ); ?></h2>
47
48 <p><?php esc_html_e( 'This will migrate Pod Pages and Pod Templates that have PHP in them into files in your theme folder.', 'pods' ); ?></p>
49 </div>
50 <span>&#10095;</span>
51 </a>
52 </div>
53 <div class="pods-wizard-option">
54 <a href="#pods-wizard-run-clean" data-opt="1">
55 <div>
56 <h2><?php esc_html_e( 'Migrate PHP to files and clear the content in the DB', 'pods' ); ?></h2>
57
58 <p><?php esc_html_e( 'This will migrate Pod Pages and Pod Templates that have PHP in them into files in your theme folder, and then clear the content in the DB for those.', 'pods' ); ?></p>
59 <p><?php esc_html_e( 'Please be sure to backup your database before you run this tool.', 'pods' ); ?></p>
60 </div>
61 <span>&#10095;</span>
62 </a>
63 </div>
64 </div>
65 </div>
66 <?php endif; ?>
67 </div>
68 <div id="pods-wizard-panel-2" class="pods-wizard-panel pods-wizard-option-content">
69 <div class="pods-wizard-content">
70 <p><?php esc_html_e( 'The objects listed have been determined to currently contain PHP that needs to be migrated. Choose below which Pod Page(s) and/or Pod Template(s) you want to migrate into theme files', 'pods' ); ?></p>
71 <p><?php esc_html_e( 'If you have chosen to clear the content in this migration, when you refresh this migration screen the migrated objects will no longer be shown.', 'pods' ); ?></p>
72
73 <p>
74 <a href="#toggle" class="button pods-wizard-toggle-all"
75 data-toggle="all"><?php esc_html_e( 'Toggle everything on / off', 'pods' ); ?></a>
76 </p>
77 </div>
78
79 <?php if ( ! empty( $pod_templates ) ) : ?>
80 <?php
81 $data = $pod_templates;
82 $data_name = 'templates';
83 ?>
84 <div class="stuffbox pods-migrate-php-group">
85 <h3>
86 <label
87 for="link_name"><?php esc_html_e( 'Choose which Pod Templates to migrate', 'pods' ); ?></label>
88 </h3>
89
90 <div class="inside pods-manage-field pods-dependency">
91 <div class="pods-field-option-group">
92 <div class="pods-pick-values pods-pick-checkbox pods-zebra">
93 <p>
94 <a href="#toggle" class="button pods-wizard-toggle-all"
95 data-toggle="<?php echo esc_attr( $data_name ); ?>"><?php esc_html_e( 'Toggle all on / off', 'pods' ); ?></a>
96 </p>
97
98 <ul>
99 <?php
100 $zebra = false;
101
102 foreach ( $data as $item ) {
103 $checked = true;
104
105 $class = ( $zebra ? 'even' : 'odd' );
106
107 $zebra = ( ! $zebra );
108 ?>
109 <li class="pods-zebra-<?php echo esc_attr( $class ); ?>">
110 <?php
111 echo PodsForm::field( $data_name . '[' . $item['id'] . ']', $checked, 'boolean', [
112 'boolean_yes_label' => $item['name'] . ( ! empty( $item['label'] ) ? ' (' . $item['label'] . ')' : '' ),
113 'disable_dfv' => true,
114 ] );
115 ?>
116 </li>
117 <?php
118 }
119 ?>
120 </ul>
121 </div>
122 </div>
123 </div>
124 </div>
125 <?php endif; ?>
126
127 <?php if ( ! empty( $pod_pages ) ) : ?>
128 <?php
129 $data = $pod_pages;
130 $data_name = 'pages';
131 ?>
132 <div class="stuffbox pods-migrate-php-group">
133 <h3>
134 <label
135 for="link_name"><?php esc_html_e( 'Choose which Pod Pages to migrate', 'pods' ); ?></label>
136 </h3>
137
138 <div class="inside pods-manage-field pods-dependency">
139 <div class="pods-field-option-group">
140 <div class="pods-pick-values pods-pick-checkbox pods-zebra">
141 <p>
142 <a href="#toggle" class="button pods-wizard-toggle-all"
143 data-toggle="<?php echo esc_attr( $data_name ); ?>"><?php esc_html_e( 'Toggle all on / off', 'pods' ); ?></a>
144 </p>
145
146 <ul>
147 <?php
148 $zebra = false;
149
150 foreach ( $data as $item ) {
151 $checked = true;
152
153 $class = ( $zebra ? 'even' : 'odd' );
154
155 $zebra = ( ! $zebra );
156 ?>
157 <li class="pods-zebra-<?php echo esc_attr( $class ); ?>">
158 <?php
159 echo PodsForm::field( $data_name . '[' . $item['id'] . ']', $checked, 'boolean', [
160 'boolean_yes_label' => $item['name'] . ( ! empty( $item['label'] ) ? ' (' . $item['label'] . ')' : '' ),
161 'disable_dfv' => true,
162 ] );
163 ?>
164 </li>
165 <?php
166 }
167 ?>
168 </ul>
169 </div>
170 </div>
171 </div>
172 </div>
173 <?php endif; ?>
174
175 <span id="pods-wizard-result"></span>
176
177 <div class="stuffbox hidden" id="pods-wizard-results">
178 <h3><?php esc_html_e( 'Migration Results', 'pods' ); ?></h3>
179
180 <div class="inside pods-manage-field pods-dependency">
181 <div class="pods-wizard-results"></div>
182 </div>
183 </div>
184 </div>
185
186 <div id="pods-wizard-actions" class="pods-wizard-button-interface">
187 <div id="pods-wizard-toolbar">
188 <button id="pods-wizard-start" class="button button-secondary"><?php esc_html_e( 'Start Over', 'pods' ); ?></button>
189 <button id="pods-wizard-next" class="button button-primary" data-again="<?php esc_attr_e( 'Process Again', 'pods' ); ?>" data-next="<?php esc_attr_e( 'Continue', 'pods' ); ?>" data-finished="<?php esc_attr_e( 'Finished', 'pods' ); ?>" data-processing="<?php esc_attr_e( 'Processing', 'pods' ); ?>.."><?php esc_html_e( 'Continue', 'pods' ); ?></button>
190 </div>
191 <div id="pods-wizard-finished">
192
193 </div>
194 </div>
195 </div>
196 </div>
197 </div>
198 </form>
199 </div>
200 <script type="text/javascript">
201 const $pods_admin_wizard_results = jQuery( '#pods-wizard-results' );
202
203 var pods_admin_wizard_callback = function ( step, completed ) {
204 if ( 2 == step || !step ) {
205 $pods_admin_wizard_results.slideUp( 'fast', function () {
206 jQuery( 'div.pods-wizard-results', $pods_admin_wizard_results ).html( '' );
207 } );
208 }
209
210 return true;
211 };
212
213 var pods_admin_option_select_callback = function ( $opt ) {
214 jQuery( '#pods_cleanup' ).val( $opt.data( 'opt' ) );
215 };
216
217 var pods_admin_submit_callback = function ( id ) {
218 jQuery( '#pods-wizard-next' ).css( 'cursor', 'pointer' );
219 jQuery( '#pods-wizard-next' ).prop( 'disabled', false );
220 jQuery( '#pods-wizard-next' ).text( jQuery( '#pods-wizard-next' ).data( 'again' ) );
221
222 window.location.hash = 'pods-wizard-result';
223
224 jQuery( 'div.pods-wizard-results', $pods_admin_wizard_results ).html( id );
225 $pods_admin_wizard_results.slideDown( 'fast' );
226
227 return false;
228 };
229
230 var pods_admin_wizard_startover_callback = function () {
231 $pods_admin_wizard_results.hide();
232 jQuery( 'div.pods-wizard-results', $pods_admin_wizard_results ).html( '' );
233 };
234
235 const toggle_all = {
236 all: true
237 };
238
239 jQuery( function ( $ ) {
240 $( '.pods-wizard-toggle-all' ).on( 'click', function ( e ) {
241 e.preventDefault();
242
243 const toggleData = $( this ).data( 'toggle' );
244
245 if ( 'undefined' == typeof toggle_all[toggleData] ) {
246 toggle_all[toggleData] = true;
247 }
248
249 let $parent;
250
251 if ( 'all' !== toggleData ) {
252 $parent = $( this ).closest( '.pods-field-option-group' );
253 } else {
254 $parent = $( this ).closest( '.pods-wizard-option-content' );
255 }
256
257 $parent.find( '.pods-field.pods-boolean input[type="checkbox"]' ).prop( 'checked', (!toggle_all[toggleData]) );
258
259 toggle_all[toggleData] = (!toggle_all[toggleData]);
260 } );
261
262 $( document ).Pods( 'validate' );
263 $( document ).Pods( 'submit' );
264 $( document ).Pods( 'wizard' );
265 $( document ).Pods( 'dependency' );
266 $( document ).Pods( 'advanced' );
267 $( document ).Pods( 'confirm' );
268 } );
269 </script>
270