PluginProbe
WP Coder – Insert & Manage Code Snippets / 4.5.2
WP Coder – Insert & Manage Code Snippets v4.5.2
4.5.2 4.5.1 1.1 2.3.1 2.3.2 2.4.1 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.1 3.1.1 3.2 3.2.1 3.3 3.4 3.5 All 40 releases
← All changes | classes/Admin/AdminInitializer.php +50 -13 3.3 → 4.5.2 View file →
@@ -23,9 +23,9 @@
23 23 if ( false === strpos( $file, WPCoder::basename() ) ) {
24 24 return $links;
25 25 }
26 26 $link = admin_url( 'admin.php?page=' . WPCoder::SLUG );
27 - $text = esc_attr__( 'Settings', 'wpcoder' );
27 + $text = esc_attr__( 'Settings', 'wp-coder' );
28 28 $settings_link = '<a href="' . esc_url( $link ) . '">' . esc_attr( $text ) . '</a>';
29 29 array_unshift( $links, $settings_link );
30 30
31 31 return $links;
@@ -35,9 +35,10 @@
35 35 global $pagenow;
36 36
37 37 if ( $pagenow === 'admin.php' && ( isset( $_GET['page'] ) && $_GET['page'] === WPCoder::SLUG ) ) {
38 38 $text = sprintf(
39 - __( 'Thank you for using <b>%2$s</b>! Please <a href="%1$s" target="_blank">rate us</a>', 'wpcoder' ),
39 + /* translators: 1. link to the plugin page 2. plugin name */
40 + __( 'Thank you for using <b>%2$s</b>! Please <a href="%1$s" target="_blank">rate us</a>', 'wp-coder' ),
40 41 esc_url( WPCoder::PluginURL ),
41 42 esc_attr( WPCoder::info( 'name' ) )
42 43 );
43 44
@@ -47,30 +48,41 @@
47 48 return $footer_text;
48 49 }
49 50
50 51 public static function add_admin_page(): void {
52 + if ( ! WPCoder::user_can_manage() ) {
53 + return;
54 + }
55 +
51 56 $icon = 'data:image/svg+xml;base64,' . base64_encode( self::icon() );
52 57 $parent = 'wp-coder';
53 58 $title = WPCoder::info( 'name' ) . ' version ' . WPCoder::info( 'version' );
54 - $main_title = WPCoder::info( 'name' );
55 59 $menu_title = 'All Codes';
56 - $capability = 'unfiltered_html';
60 + $capability = WPCoder::CAPABILITY;
57 61 $slug = WPCoder::SLUG;
58 - $url_update = 'https://wpcoder.pro/?utm_source=wordpress&utm_medium=admin-menu&utm_campaign=upgrade-to-pro';
59 62
60 - add_menu_page( $main_title, $main_title, 'unfiltered_html', $slug, [ __CLASS__, 'plugin_page' ], $icon );
63 + add_menu_page( 'WP Coder Pro', 'WP Coder', $capability, $slug, [ __CLASS__, 'plugin_page' ], $icon );
61 64
62 65 add_submenu_page( $slug, $title, $menu_title, $capability, $slug, [ __CLASS__, 'plugin_page' ] );
63 66
64 67 add_submenu_page( $slug, $title, 'Add new', $capability, $slug . '-settings', [ __CLASS__, 'settings' ] );
68 + add_submenu_page( $slug, $title, 'Snippets', $capability, $slug . '-snippets', [ __CLASS__, 'snippets' ] );
69 + add_submenu_page( $slug, $title, 'Tools', $capability, $slug . '-tools', [ __CLASS__, 'tools' ] );
65 70 add_submenu_page( $slug, $title, 'Global PHP', $capability, $slug . '-global', [ __CLASS__, 'global_php' ] );
66 - add_submenu_page( $slug, $title, 'Tools', $capability, $slug . '-tools', [ __CLASS__, 'tools' ] );
71 + add_submenu_page( $slug, $title, 'Debug Log', $capability, $slug . '-debug', [ __CLASS__, 'debug_log' ] );
72 + add_submenu_page( $slug, $title, 'Import / Export', $capability, $slug . '-import-export', [ __CLASS__, 'import_export' ] );
67 73 add_submenu_page( $slug, $title, 'Support', $capability, $slug . '-support', [ __CLASS__, 'support' ] );
68 - add_submenu_page( $slug, $title, 'Upgrade to Pro', $capability, $url_update );
74 +
69 75 }
70 76
71 77 public static function icon(): string {
72 - return '<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><title>48px_code</title><g><path d="M14.562 14.75a1.998 1.998 0 0 0-2.811-.312l-10.001 8a2 2 0 0 0 0 3.124l10 8a1.997 1.997 0 0 0 2.811-.312 2 2 0 0 0-.312-2.81L6.201 24l8.048-6.438a2 2 0 0 0 .312-2.81v-.003h.001z" fill="url(#1699598250888-4824476_nc-code-0_linear_235_116)"></path><path d="M36.25 14.438a2 2 0 0 0-2.499 3.123L41.799 24l-8.048 6.438a2 2 0 0 0 2.499 3.123l10-8a2 2 0 0 0 0-3.124l-10-8v.002z" fill="url(#1699598250888-4824476_nc-code-1_linear_235_116)"></path><path d="M29.535 4.073a2.003 2.003 0 0 0-2.462 1.392l-10 36a2 2 0 0 0 3.854 1.07l10-36a2 2 0 0 0-1.392-2.462z" fill="url(#1699598250888-4824476_nc-code-2_linear_235_116)"></path><defs><linearGradient id="1699598250888-4824476_nc-code-0_linear_235_116" x1="8" y1="13.999" x2="8" y2="34" gradientUnits="userSpaceOnUse"><stop stop-color="#5B5E71"></stop><stop offset="1" stop-color="#393A46"></stop></linearGradient><linearGradient id="1699598250888-4824476_nc-code-1_linear_235_116" x1="40" y1="13.999" x2="40" y2="33.998" gradientUnits="userSpaceOnUse"><stop stop-color="#5B5E71"></stop><stop offset="1" stop-color="#393A46"></stop></linearGradient><linearGradient id="1699598250888-4824476_nc-code-2_linear_235_116" x1="24" y1="4" x2="24" y2="44" gradientUnits="userSpaceOnUse"><stop stop-color="#E0E0E6"></stop><stop offset="1" stop-color="#C2C3CD"></stop></linearGradient></defs></g></svg>';
78 + return '<svg width="512" height="512" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
79 + <path id="1728127909379-8007129Oval-Copy" fill="#2b7fff" fill-rule="evenodd" stroke="none" d="M 496 101 C 496 128.614227 473.614227 151 446 151 C 418.385773 151 396 128.614227 396 101 C 396 73.385773 418.385773 51 446 51 C 473.614227 51 496 73.385773 496 101 Z"/>
80 + <g id="window-code">
81 + <path id="Path" fill="#212121" stroke="none" d="M 245.714279 232.714294 L 74.285713 61.285736 C 60.571426 47.571411 40 47.571411 26.285713 61.285736 C 12.571427 75 12.571427 95.571442 26.285713 109.285706 L 173.714279 256.714294 L 26.285713 404.142853 C 12.571427 417.857147 12.571427 438.428589 26.285713 452.142853 C 33.142857 459 40 462.428558 50.285713 462.428558 C 60.571426 462.428558 67.428574 459 74.285713 452.142853 L 245.714279 280.714294 C 259.428589 267 259.428589 246.428558 245.714279 232.714294 Z"/>
82 + <path id="Rounded-Rectangle" fill="#212121" fill-rule="evenodd" stroke="none" d="M 256 431 C 256 448.673096 270.326874 463 288 463 L 464 463 C 481.673096 463 496 448.673096 496 431 L 496 429 C 496 411.326904 481.673096 397 464 397 L 288 397 C 270.326874 397 256 411.326904 256 429 Z"/>
83 + </g>
84 +</svg>';
73 85 }
74 86
75 87 public static function plugin_page(): void {
76 88 $page_path = DashboardHelper::get_folder_path( 'pages' ) . '/1.list.php';
@@ -87,10 +99,26 @@
87 99 require_once $page_path;
88 100 }
89 101 }
90 102
103 + public static function snippets() {
104 + $page_path = DashboardHelper::get_folder_path( 'pages' ) . '/3.snippets.php';
105 +
106 + if ( file_exists( $page_path ) ) {
107 + require_once $page_path;
108 + }
109 + }
110 +
111 + public static function tools() {
112 + $page_path = DashboardHelper::get_folder_path( 'pages' ) . '/4.tools.php';
113 +
114 + if ( file_exists( $page_path ) ) {
115 + require_once $page_path;
116 + }
117 + }
118 +
91 119 public static function global_php() {
92 - $page_path = DashboardHelper::get_folder_path( 'pages' ) . '/global-php.php';
120 + $page_path = DashboardHelper::get_folder_path( 'pages' ) . '/5.global-php.php';
93 121
94 122 if ( file_exists( $page_path ) ) {
95 123 require_once $page_path;
96 124 }
@@ -95,11 +123,12 @@
95 123 require_once $page_path;
96 124 }
97 125 }
98 126
99 - public static function tools() {
100 - $page_path = DashboardHelper::get_folder_path( 'pages' ) . '/3.tools.php';
101 127
128 + public static function import_export() {
129 + $page_path = DashboardHelper::get_folder_path( 'pages' ) . '/6.import-export.php';
130 +
102 131 if ( file_exists( $page_path ) ) {
103 132 require_once $page_path;
104 133 }
105 134 }
@@ -104,9 +133,17 @@
104 133 }
105 134 }
106 135
107 136 public static function support() {
108 - $page_path = DashboardHelper::get_folder_path( 'pages' ) . '/4.support.php';
137 + $page_path = DashboardHelper::get_folder_path( 'pages' ) . '/7.support.php';
138 +
139 + if ( file_exists( $page_path ) ) {
140 + require_once $page_path;
141 + }
142 + }
143 +
144 + public static function debug_log() {
145 + $page_path = DashboardHelper::get_folder_path( 'pages' ) . '/10.debug-log.php';
109 146
110 147 if ( file_exists( $page_path ) ) {
111 148 require_once $page_path;
112 149 }