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