PluginProbe
Advanced Custom Fields (ACF®) / 3.1.5
Advanced Custom Fields (ACF®) v3.1.5
6.8.9 6.8.8 6.8.7 6.8.6 6.8.5 6.8.4 6.8.3 6.8.2 6.8.1 5.8.5 5.8.6 5.8.7 5.8.8 5.8.9 5.9.0 5.9.1 5.9.2 5.9.3 5.9.4 5.9.5 5.9.6 5.9.7 5.9.8 5.9.9 6.0.0 All 230 releases
advanced-custom-fields / core / admin / upgrade.php
upgrade.php
87 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*--------------------------------------------------------------------------------------
4 *
5 * Update - Ajax Functions
6 *
7 * @author Elliot Condon
8 * @since 3.0.0
9 *
10 *-------------------------------------------------------------------------------------*/
11
12 $version = get_option('acf_version','1.0.5');
13 $next = false;
14
15 // list of starting points
16 if(version_compare($version,'3.0.0') < 0)
17 {
18 $next = '3.0.0';
19 }
20 ?>
21
22 <script type="text/javascript">
23 (function($){
24
25 function add_message(messaage)
26 {
27 $('#wpbody-content').append('<p>' + messaage + '</p>');
28 }
29
30 function run_upgrade(version)
31 {
32 $.ajax({
33 url: ajaxurl,
34 data: { action : 'acf_upgrade', version : version },
35 type: 'post',
36 dataType: 'json',
37 success: function(json){
38
39 if(json)
40 {
41 if(json.status)
42 {
43 add_message(json.message);
44
45 // next update?
46 if(json.next)
47 {
48 run_upgrade(json.next);
49 }
50 else
51 {
52 // all done
53 add_message('Upgrade Complete! <a href="<?php echo admin_url(); ?>edit.php?post_type=acf">Continue to ACF &raquo;</a>');
54 }
55 }
56 else
57 {
58 // error!
59 add_message('Error: ' + json.message);
60 }
61 }
62 else
63 {
64 // major error!
65 add_message('Sorry. Something went wrong during the upgrade process. Please report this on the support forum');
66 }
67 }
68 });
69 }
70
71 <?php if($next){ echo 'run_upgrade("' . $next . '");'; } ?>
72
73 })(jQuery);
74 </script>
75 <style type="text/css">
76 #message {
77 display: none;
78 }
79 </style>
80 <?php
81
82 if(!$next)
83 {
84 echo '<p>No Upgrade Required</p>';
85 }
86
87 ?>