Skip to content

Commit

Permalink
Update leaflet-elementor-widget.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Joolace committed Jun 21, 2024
1 parent 5cf86a2 commit 193a137
Showing 1 changed file with 33 additions and 7 deletions.
40 changes: 33 additions & 7 deletions leaflet-elementor-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Leaflet Elementor Widget
Plugin URI: https://github.com/Joolace/leaflet-elementor
Description: Widget Leaflet per Elementor
Version: 1.2.4
Version: 1.2.5
Author: Joolace
Author URI: https://github.com/Joolace/
*/
Expand Down Expand Up @@ -74,26 +74,51 @@ function update_leaflet_elementor_widget($download_url, $latest_version) {
}

function activate_leaflet_elementor_widget() {
update_option('leaflet_elementor_widget_version', '1.2.4');
update_option('leaflet_elementor_widget_version', '1.2.5');
}

function leaflet_elementor_widget_options_page() {
add_options_page(
'Impostazioni Leaflet Elementor Widget',
'Leaflet Elementor Widget',
'manage_options',
'leaflet-elementor-widget-settings',
'leaflet_elementor_widget_settings_page_content'
);
}

function leaflet_elementor_widget_settings_page_content() {
?>
<div class="wrap">
<h1>Impostazioni Leaflet Elementor Widget</h1>
<form method="post" action="options.php">
<?php
settings_fields('leaflet_elementor_widget_update_settings');
do_settings_sections('leaflet-elementor-widget-settings');
submit_button();
?>
</form>
</div>
<?php
}

function leaflet_elementor_widget_settings() {
add_settings_section(
'leaflet_elementor_widget_update_settings',
'Impostazioni Aggiornamento Automatico',
'Aggiornamento Automatico',
'leaflet_elementor_widget_update_settings_callback',
'reading'
'leaflet-elementor-widget-settings'
);

add_settings_field(
'enable_auto_update',
'Abilita Aggiornamento Automatico',
'enable_auto_update_callback',
'reading',
'leaflet-elementor-widget-settings',
'leaflet_elementor_widget_update_settings'
);

register_setting('reading', 'enable_auto_update');
register_setting('leaflet_elementor_widget_update_settings', 'enable_auto_update');
}

function enable_auto_update_callback() {
Expand All @@ -107,4 +132,5 @@ function leaflet_elementor_widget_update_settings_callback() {

register_activation_hook(__FILE__, 'activate_leaflet_elementor_widget');
add_action('admin_init', 'leaflet_elementor_widget_settings');
add_action('admin_init', 'check_for_leaflet_widget_update');
add_action('admin_init', 'check_for_leaflet_widget_update');
add_action('admin_menu', 'leaflet_elementor_widget_options_page');

0 comments on commit 193a137

Please sign in to comment.