PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.0
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.0
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
← All changes | WpInit/Menu.php +10 -1 10.11.1 → 11.1.0 View file →
@@ -10,18 +10,23 @@
10 10 {
11 11 $this->router = $router;
12 12
13 13 if (defined('WP_ADMIN') && WP_ADMIN) {
14 + // Add AcyMailing menu in the back-end's left menu of WordPress
14 15 add_action('admin_menu', [$this, 'addMenus'], 99);
15 16 }
16 17
18 + // Add "settings" link for acym on plugins listing
17 19 add_filter('plugin_action_links_'.plugin_basename(dirname(__DIR__).'/index.php'), [$this, 'addPluginLinks']);
18 20 }
19 21
22 + // Add AcyMailing menu to WP left menu and define controllers
20 23 public function addMenus()
21 24 {
25 + // Everyone in WordPress can read, the real test is made bellow
22 26 $capability = 'read';
23 27
28 + // Make sure the user is allowed to see admin features
24 29 $config = acym_config();
25 30 $allowedGroups = explode(',', $config->get('wp_access', 'administrator'));
26 31 $userGroups = acym_getGroupsByUser();
27 32
@@ -33,9 +38,10 @@
33 38 }
34 39 }
35 40 if (!$allowed) return;
36 41
37 - $svg = acym_loaderLogo(false);
42 + // Add the Acy menu items to the WP menu
43 + $svg = acym_fileGetContent(ACYM_IMAGES.'logos/logo_grey.svg');
38 44 add_menu_page(
39 45 acym_translation('ACYM_DASHBOARD'),
40 46 'AcyMailing',
41 47 $capability,
@@ -81,8 +87,9 @@
81 87 [$this->router, 'router']
82 88 );
83 89 }
84 90
91 + // Declare invisible menus
85 92 $controllers = ['dynamics', 'file', 'language'];
86 93 foreach ($controllers as $oneCtrl) {
87 94 add_submenu_page(
88 95 ACYM_COMPONENT.'_'.$oneCtrl,
@@ -93,8 +100,9 @@
93 100 [$this->router, 'router']
94 101 );
95 102 }
96 103
104 + // In WordPress, the first submenu is called "AcyMailing" instead of "Dashboard" so we rename it manually
97 105 global $submenu;
98 106 if (isset($submenu[ACYM_COMPONENT.'_dashboard'])) {
99 107 $submenu[ACYM_COMPONENT.'_dashboard'][0][0] = acym_translation('ACYM_DASHBOARD');
100 108 }
@@ -99,8 +107,9 @@
99 107 $submenu[ACYM_COMPONENT.'_dashboard'][0][0] = acym_translation('ACYM_DASHBOARD');
100 108 }
101 109 }
102 110
111 + // Add links on the plugins listing
103 112 public function addPluginLinks($links): array
104 113 {
105 114 $settings_link = '<a href="admin.php?page='.ACYM_COMPONENT.'_configuration">'.acym_translation('ACYM_SETTINGS').'</a>';
106 115