PluginProbe ʕ •ᴥ•ʔ
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets / 4.2.0
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets v4.2.0
4.2.5 4.2.4 trunk 3.7.10 3.7.11 3.7.12 3.7.13 3.7.14 3.7.2 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8 3.8.1 3.8.10 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.8.8 3.8.9 3.8.9.1 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.5.1 4.0.6 4.0.6.1 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.2 4.1.3 4.2.0 4.2.1 4.2.2 4.2.3
widget-options / includes / install.php
widget-options / includes Last commit date
admin 3 months ago pagebuilders 3 months ago snippets 3 months ago widgets 3 months ago ajax-functions.php 3 months ago extras.php 3 months ago install.php 3 months ago scripts.php 3 months ago transient.php 3 months ago
install.php
123 lines
1 <?php
2
3 /**
4 * Install Function
5 *
6 * @copyright Copyright (c) 2016, Jeffrey Carandang
7 * @since 3.0
8 */
9 // Exit if accessed directly
10 if (!defined('ABSPATH')) exit;
11
12 //check if free version is activated
13 if (!function_exists('widgetopts_upgraded')) {
14 add_action('admin_notices', 'widgetopts_upgraded');
15 function widgetopts_upgraded()
16 {
17 if (is_plugin_active('widget-options/plugin.php') && is_plugin_active('extended-widget-options/plugin.php')) { ?>
18 <div class="widgetopts_activated_notice notice-error notice" style="box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);">
19 <p>
20 <?php _e('Please deactivate <strong>Widget Options</strong> Plugin, it may cause issue with the extended plugin version. Thanks!', 'widget-options'); ?>
21 </p>
22 </div>
23 <?php }
24 }
25 }
26
27 //add settings link on plugin page
28 if (!function_exists('widgetopts_filter_plugin_actions')) {
29 add_action('plugin_action_links_' . plugin_basename(WIDGETOPTS_PLUGIN_FILE), 'widgetopts_filter_plugin_actions');
30 function widgetopts_filter_plugin_actions($links)
31 {
32
33 if (!is_array($links)) {
34 $links = array();
35 }
36
37 $links[] = '<a href="' . esc_url(admin_url('options-general.php?page=widgetopts_plugin_settings')) . '">' . __('Settings', 'widget-options') . '</a>';
38 $upgrade_link = apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE) . 'pricing/?utm_source=upgradebtn&utm_medium=plugins&utm_campaign=widgetoptspluginlink');
39 $links[] = '<a href="' . esc_url($upgrade_link) . '" target="_blank" style="color: #3db634">' . __('Upgrade', 'widget-options') . '</a>';
40 return $links;
41 }
42 }
43
44 //register default values
45 if (!function_exists('widgetopts_register_defaults')) {
46 register_activation_hook(WIDGETOPTS_PLUGIN_FILE, function () {
47 add_option('Activated_Plugin', WIDGETOPTS_PLUGIN_FILE);
48 update_option('widgetopts_force_migration_rescan', 1);
49 widgetopts_register_defaults();
50 });
51
52 add_action('admin_init', function () {
53 if (is_admin() && get_option('widgetopts_force_migration_rescan')) {
54 delete_option('widgetopts_force_migration_rescan');
55 if (class_exists('WidgetOpts_Snippets_Migration')) {
56 WidgetOpts_Snippets_Migration::rescan_and_update_flag();
57 } elseif (class_exists('WidgetOpts_Snippets_CPT')) {
58 delete_option('wopts_display_logic_migration_required');
59 WidgetOpts_Snippets_CPT::scan_for_legacy_logic();
60 }
61 }
62
63 if (is_admin() && get_option('Activated_Plugin') == WIDGETOPTS_PLUGIN_FILE) {
64 delete_option('Activated_Plugin');
65 exit(wp_redirect(admin_url('options-general.php?page=widgetopts_plugin_settings')));
66 }
67 });
68
69 add_action('plugins_loaded', 'widgetopts_register_defaults');
70 function widgetopts_register_defaults()
71 {
72 if (is_admin()) {
73
74 if (!get_option('widgetopts_installDate')) {
75 add_option('widgetopts_installDate', date('Y-m-d h:i:s'));
76 }
77
78 if (!get_option('_widgetopts_default_registered_')) {
79 //activate free version modules
80 add_option('widgetopts_tabmodule-visibility', 'activate');
81 add_option('widgetopts_tabmodule-devices', 'activate');
82 add_option('widgetopts_tabmodule-alignment', 'activate');
83 add_option('widgetopts_tabmodule-hide_title', 'activate');
84 add_option('widgetopts_tabmodule-classes', 'activate');
85 add_option('widgetopts_tabmodule-logic', 'activate');
86 add_option('widgetopts_tabmodule-state', 'activate');
87 add_option('widgetopts_tabmodule-classic_widgets_screen', 'activate');
88 //add free version settings
89 $defaults = array(
90 'visibility' => array(
91 'post_type' => '1',
92 'taxonomies' => '1',
93 'misc' => '1'
94 ),
95 'classes' => array(
96 'id' => '1',
97 'type' => 'both'
98 ),
99 );
100 //upgraded settings from previous version
101 $options = get_option('extwopts_class_settings');
102 if (isset($options['class_field'])) {
103 $defaults['classes']['type'] = $options['class_field'];
104 }
105 if (isset($options['classlists'])) {
106 $defaults['classes']['classlists'] = $options['classlists'];
107 }
108 add_option('widgetopts_tabmodule-settings', serialize($defaults));
109 add_option('_widgetopts_default_registered_', '1');
110 delete_transient('widgetopts_tabs_transient'); //remove transient for settings
111 delete_option('widgetopts_settings');
112 }
113
114 //make sure to delete previous pages cache
115 if (!get_option('widgetopts_removed_global_pages')) {
116 delete_option('widgetopts_global_pages');
117 add_option('widgetopts_removed_global_pages', 1);
118 }
119 }
120 }
121 }
122
123 ?>