PageRenderTime 16ms CodeModel.GetById 11ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-content/plugins/contact-form-7/includes/capabilities.php

https://bitbucket.org/devbctph/futura_wp
PHP | 24 lines | 18 code | 6 blank | 0 comment | 1 complexity | 258a41dfac6c835183dce319eccdb5d4 MD5 | raw file
 1<?php
 2
 3add_filter( 'map_meta_cap', 'wpcf7_map_meta_cap', 10, 4 );
 4
 5function wpcf7_map_meta_cap( $caps, $cap, $user_id, $args ) {
 6	$meta_caps = array(
 7		'wpcf7_edit_contact_form' => WPCF7_ADMIN_READ_WRITE_CAPABILITY,
 8		'wpcf7_edit_contact_forms' => WPCF7_ADMIN_READ_WRITE_CAPABILITY,
 9		'wpcf7_read_contact_forms' => WPCF7_ADMIN_READ_CAPABILITY,
10		'wpcf7_delete_contact_form' => WPCF7_ADMIN_READ_WRITE_CAPABILITY,
11		'wpcf7_manage_integration' => 'manage_options',
12		'wpcf7_submit' => 'read',
13	);
14
15	$meta_caps = apply_filters( 'wpcf7_map_meta_cap', $meta_caps );
16
17	$caps = array_diff( $caps, array_keys( $meta_caps ) );
18
19	if ( isset( $meta_caps[$cap] ) ) {
20		$caps[] = $meta_caps[$cap];
21	}
22
23	return $caps;
24}