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 / Admin / Admin.php

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

103 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * SOFTWARE LICENSE INFORMATION
4 *
5 * Copyright (c) 2017 Buttonizer, all rights reserved.
6 *
7 * This file is part of Buttonizer
8 *
9 * For detailed information regarding to the licensing of
10 * this software, please review the license.txt or visit:
11 * https://buttonizer.pro/license/
12 */
13
14 namespace Buttonizer\Admin;
15
16 use Buttonizer\Api\Settings\MigrateToStandalone;
17 use Buttonizer\Core\Admin\BaseAdmin;
18 use Buttonizer\Core\Utils\PermissionCheck;
19
20 # No script kiddies
21 defined('ABSPATH') or die('No script kiddies please!');
22
23 class Admin extends BaseAdmin
24 {
25 /**
26 * Admin constructor.
27 */
28 public function __construct()
29 {
30 // Register shared admin hooks (assets, modules, notices)
31 parent::__construct();
32
33 // Add to admin menu
34 add_action('admin_menu', [$this, 'pluginAdminMenu']);
35
36 // Plugin information, add links
37 add_filter("plugin_action_links_" . BUTTONIZER_BASE_NAME, function ($actions) {
38 $links = [
39 '<a href="' . admin_url('admin.php?page=Buttonizer#/support') . '">' . __('Support', 'buttonizer-multifunctional-button') . '</a>',
40 '<a href="' . admin_url('admin.php?page=Buttonizer#/editor') . '">' . __('Edit buttons', 'buttonizer-multifunctional-button') . '</a>',
41 '<a href="' . admin_url('admin.php?page=Buttonizer#/settings') . '">' . __('Settings', 'buttonizer-multifunctional-button') . '</a>',
42 ];
43
44 return array_merge($actions, $links);
45 });
46 }
47
48 /**
49 * Create Admin menu
50 */
51 public function pluginAdminMenu()
52 {
53
54 if (!PermissionCheck::hasPermission()) return;
55
56 // Admin menu
57 add_menu_page('Buttonizer Buttons', 'Buttonizer', 'read', 'Buttonizer', [$this, 'page'], plugins_url('/assets/images/wp-icon.png', BUTTONIZER_PLUGIN_DIR), 81);
58
59 // Add submenu
60 add_submenu_page('Buttonizer', 'Edit buttons', __('Edit buttons', 'buttonizer-multifunctional-button'), 'read', 'admin.php?page=Buttonizer#/editor');
61
62 // Add support link
63 add_submenu_page('Buttonizer', __('I need support', 'buttonizer-multifunctional-button'), __('I need support', 'buttonizer-multifunctional-button'), 'read', 'admin.php?page=Buttonizer#/support');
64
65 // Add community link
66 add_submenu_page('Buttonizer', __('Community', 'buttonizer-multifunctional-button'), __('Community', 'buttonizer-multifunctional-button'), 'read', 'https://r.buttonizer.io/support/community?referral=buttonizer-plugin-menu');
67
68 // Add knowledge base link
69 add_submenu_page('Buttonizer', __('Knowledge base', 'buttonizer-multifunctional-button'), __('Knowledge base', 'buttonizer-multifunctional-button'), 'read', 'https://r.buttonizer.io/support/knowledgebase?referral=buttonizer-plugin-menu');
70 }
71
72 /**
73 * Lock the screen to a specific action.
74 *
75 * Adds legacy migration check on top of the base implementation.
76 *
77 * @return string lock
78 */
79 public function getActionLock(): string
80 {
81 // Needs migration (legacy-specific)
82 if (defined("BUTTONIZER_LEGACY_REQUESTED_MIGRATION") && !BUTTONIZER_LEGACY_REQUESTED_MIGRATION) {
83 return "migration";
84 }
85
86 return parent::getActionLock();
87 }
88
89 /**
90 * Migration status (legacy-specific).
91 *
92 * @return mixed
93 */
94 public function getBeforeMigrate()
95 {
96 if (!defined("BUTTONIZER_LEGACY_REQUESTED_MIGRATION")) {
97 return null;
98 }
99
100 return MigrateToStandalone::getReadyForMigration();
101 }
102 }
103