PluginProbe ʕ •ᴥ•ʔ
WPCode – Insert Headers and Footers + Custom Code Snippets – WordPress Code Manager / 2.2.4
WPCode – Insert Headers and Footers + Custom Code Snippets – WordPress Code Manager v2.2.4
2.3.6 trunk 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.5.0 1.6.0 1.6.1 1.6.2 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.13.1 2.0.2 2.0.3 2.0.4 2.0.4.1 2.0.4.2 2.0.4.3 2.0.4.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.8.1 2.0.9 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.2 2.1.3 2.1.3.1 2.1.4 2.1.4.1 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.3.1 2.2.4 2.2.4.1 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 2.3.2.1 2.3.3 2.3.4 2.3.5
insert-headers-and-footers / includes / capabilities.php
insert-headers-and-footers / includes Last commit date
admin 1 year ago auto-insert 1 year ago conditional-logic 1 year ago execute 1 year ago generator 2 years ago lite 1 year ago capabilities.php 2 years ago class-wpcode-admin-bar-info.php 2 years ago class-wpcode-auto-insert.php 1 year ago class-wpcode-capabilities.php 3 years ago class-wpcode-conditional-logic.php 1 year ago class-wpcode-error.php 2 years ago class-wpcode-file-cache.php 1 year ago class-wpcode-file-logger.php 3 years ago class-wpcode-generator.php 3 years ago class-wpcode-install.php 2 years ago class-wpcode-library-auth.php 1 year ago class-wpcode-library.php 1 year ago class-wpcode-settings.php 2 years ago class-wpcode-smart-tags.php 2 years ago class-wpcode-snippet-cache.php 2 years ago class-wpcode-snippet-execute.php 1 year ago class-wpcode-snippet.php 1 year ago compat.php 2 years ago global-output.php 2 years ago helpers.php 1 year ago icons.php 1 year ago ihaf.php 3 years ago legacy.php 3 years ago pluggable.php 2 years ago post-type.php 1 year ago safe-mode.php 2 years ago shortcode.php 2 years ago
capabilities.php
88 lines
1 <?php
2 /**
3 * Map capabilites with backwards compatibility.
4 *
5 * @package WPCode
6 */
7
8 // Prevent direct access.
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 add_filter( 'map_meta_cap', 'wpcode_map_meta_cap', 10, 4 );
14
15 /**
16 * Map capabilites with backwards compatibility.
17 *
18 * @param string[] $caps Primitive capabilities required of the user.
19 * @param string $cap Capability being checked.
20 * @param int $user_id The user ID.
21 * @param array $args Adds context to the capability check, typically
22 * starting with an object ID.
23 *
24 * @return array
25 */
26 function wpcode_map_meta_cap( $caps, $cap, $user_id, $args ) {
27
28 $custom_capabilities = array(
29 'wpcode_edit_php_snippets',
30 'wpcode_edit_html_snippets',
31 'wpcode_manage_conversion_pixels',
32 'wpcode_file_editor',
33 'wpcode_manage_settings',
34 );
35
36 if ( in_array( $cap, $custom_capabilities, true ) ) {
37 return array( 'wpcode_edit_snippets' );
38 }
39
40 return $caps;
41 }
42
43 /**
44 * Get an array of the custom capabilities that WPCode uses.
45 *
46 * @return array[]
47 */
48 function wpcode_custom_capabilities() {
49 return array(
50 'wpcode_edit_text_snippets' => array(
51 'label' => __( 'Edit Text/Blocks Snippets', 'insert-headers-and-footers' ),
52 'description' => __( 'This enables users to edit just text & blocks snippets, no HTML code is allowed.', 'insert-headers-and-footers' ),
53 ),
54 'wpcode_edit_html_snippets' => array(
55 'label' => __( 'Edit HTML, JavaScript & CSS Snippets', 'insert-headers-and-footers' ),
56 'description' => __( 'This enables users to add and manage HTML, JavaScript & CSS snippets but also Text & Blocks snippets.', 'insert-headers-and-footers' ),
57 ),
58 'wpcode_edit_php_snippets' => array(
59 'label' => __( 'Edit PHP Snippets', 'insert-headers-and-footers' ),
60 'description' => __( 'This enables users to add and manage PHP snippets and all the other types of snippets.', 'insert-headers-and-footers' ),
61 ),
62 'wpcode_manage_conversion_pixels' => array(
63 'label' => __( 'Manage Conversion Pixels Settings', 'insert-headers-and-footers' ),
64 'description' => __( 'This enables users to manage the conversion pixels settings.', 'insert-headers-and-footers' ),
65 ),
66 'wpcode_file_editor' => array(
67 'label' => __( 'Use the File Editor', 'insert-headers-and-footers' ),
68 'description' => __( 'This enables users to use the file editor.', 'insert-headers-and-footers' ),
69 ),
70 );
71 }
72
73 /**
74 * Return just the keys to avoid a gettext call that causes an endless loop with TranslatePress.
75 *
76 * @return string[]
77 */
78 function wpcode_custom_capabilities_keys() {
79 return array(
80 'wpcode_edit_text_snippets',
81 'wpcode_edit_html_snippets',
82 'wpcode_edit_php_snippets',
83 'wpcode_manage_conversion_pixels',
84 'wpcode_file_editor',
85 );
86 }
87
88