| @@ -2,9 +2,9 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: WP Coder |
| 4 | 4 | * Plugin URI: https://wordpress.org/plugins/wp-coder/ |
| 5 | 5 | * Description: Adding custom HTML, CSS, JavaScript and PHP code to your WordPress site. |
| 6 | - * Version: 4.5.1 | |
| 6 | + * Version: 4.5.2 | |
| 7 | 7 | * Author: WPCoder |
| 8 | 8 | * Author URI: https://wpcoder.pro |
| 9 | 9 | * Author Email: [email protected] |
| 10 | 10 | * License: GPL-2.0+ |
| @@ -88,8 +88,16 @@ | ||
| 88 | 88 | public static function url(): string { |
| 89 | 89 | return plugin_dir_url( __FILE__ ); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | + | |
| 93 | + // Capability required to access the plugin (it can execute PHP, so administrators only). | |
| 94 | + public const CAPABILITY = 'manage_options'; | |
| 95 | + | |
| 96 | + // Check if the current user can manage codes. On multisite, unfiltered_html is limited to super admins. | |
| 97 | + public static function user_can_manage(): bool { | |
| 98 | + return current_user_can( self::CAPABILITY ) && current_user_can( 'unfiltered_html' ); | |
| 99 | + } | |
| 92 | 100 | |
| 93 | 101 | // Get Plugin Info |
| 94 | 102 | public static function info( $show = '' ): string { |
| 95 | 103 | $data = [ |