Commit dfbab3d 1 parent c18ee1d commit dfbab3d Copy full SHA for dfbab3d
File tree 1 file changed +27
-0
lines changed
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 13
13
exit ; // Exit if accessed directly.
14
14
}
15
15
16
+ // Add a function to check for plugin updates
17
+ function lgsl_check_for_plugin_update () {
18
+ $ current_version = '1.0 ' ;
19
+ $ remote_version_info_url = 'https://github.com/wahke/lgsl-wordpress-plugin/raw/main/lgsl-version.json ' ; // Replace with the URL to your version file
20
+
21
+ $ response = wp_remote_get ($ remote_version_info_url );
22
+ if (is_wp_error ($ response )) {
23
+ return ;
24
+ }
25
+
26
+ $ response_body = wp_remote_retrieve_body ($ response );
27
+ $ version_info = json_decode ($ response_body , true );
28
+
29
+ if (isset ($ version_info ['version ' ]) && version_compare ($ current_version , $ version_info ['version ' ], '< ' )) {
30
+ add_action ('admin_notices ' , 'lgsl_update_notification ' );
31
+ }
32
+ }
33
+ add_action ('admin_init ' , 'lgsl_check_for_plugin_update ' );
34
+
35
+ function lgsl_update_notification () {
36
+ $ update_url = 'https://your-update-server.com/lgsl-latest.zip ' ; // Replace with the URL to your update file
37
+ echo '<div class="notice notice-warning is-dismissible">
38
+ <p>Es ist eine neue Version des LGSL WordPress Plugins verfügbar. <a href=" ' . esc_url ($ update_url ) . '">Jetzt aktualisieren</a>.</p>
39
+ </div> ' ;
40
+ }
41
+
42
+
16
43
// Activation hook to set default options and redirect to setup
17
44
function lgsl_activate_plugin () {
18
45
// Set default options on activation
You can’t perform that action at this time.
0 commit comments