PluginProbe
Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder / trunk
Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder vtrunk
3.5.0 trunk 1.0.10 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.6.1 1.0.7 1.0.8 1.0.9 1.1 1.1.1 1.2 1.3 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.5 1.5.1 1.5.2 All 109 releases
buttonizer-multifunctional-button / app / Legacy / Utils / ProInstallFree.php

ProInstallFree.php in Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder trunk, at app/Legacy/Utils/ProInstallFree.php

49 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Buttonizer\Legacy\Utils;
4
5 class ProInstallFree
6 {
7 /**
8 * Download plugin/Latest version
9 *
10 * Since our standalone, we do not need to seperate installs
11 * This is why we are downloading/updating our older plugin
12 */
13 public static function upgrade()
14 {
15 // Include required libs for installation
16 require_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
17 require_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php');
18 require_once(ABSPATH . 'wp-admin/includes/class-wp-ajax-upgrader-skin.php');
19 require_once(ABSPATH . 'wp-admin/includes/class-plugin-upgrader.php');
20
21 // Cannot update/install
22 if (!current_user_can('install_plugins')) {
23 wp_die(__('Sorry, you are not allowed to install plugins on this site. Please ask your administrator to update.', 'buttonizer-multifunctional-button'));
24 }
25
26 $upgrader = new \Plugin_Upgrader(new \WP_Ajax_Upgrader_Skin());
27
28 // Is the free version already installed? Update it to the newest version
29 if (array_key_exists('buttonizer-multifunctional-button/buttonizer.php', \get_plugins())) {
30 $upgrader->upgrade("buttonizer-multifunctional-button");
31 } else {
32 $upgrader->install("https://downloads.wordpress.org/plugin/buttonizer-multifunctional-button.latest-stable.zip");
33 }
34
35 self::activatePlugin();
36 }
37
38 public static function activatePlugin()
39 {
40 // Activate original plugin
41 \activate_plugin("buttonizer-multifunctional-button", "", false, true);
42
43 // Deactivate Buttonizer PRO
44 \deactivate_plugins(plugin_basename(BUTTONIZER_PLUGIN_DIR), true);
45
46 exit;
47 }
48 }
49