Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../public_h.../wp-conte.../plugins/wordpres.../admin/capabili...
File: class-capability-manager-integration.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WPSEO plugin file.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WPSEO\Admin\Capabilities
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Integrates Yoast SEO capabilities with third party role manager plugins.
[8] Fix | Delete
*
[9] Fix | Delete
* Integrates with: Members
[10] Fix | Delete
* Integrates with: User Role Editor
[11] Fix | Delete
*/
[12] Fix | Delete
class WPSEO_Capability_Manager_Integration implements WPSEO_WordPress_Integration {
[13] Fix | Delete
[14] Fix | Delete
/**
[15] Fix | Delete
* Capability manager to use.
[16] Fix | Delete
*
[17] Fix | Delete
* @var WPSEO_Capability_Manager
[18] Fix | Delete
*/
[19] Fix | Delete
public $manager;
[20] Fix | Delete
[21] Fix | Delete
/**
[22] Fix | Delete
* WPSEO_Capability_Manager_Integration constructor.
[23] Fix | Delete
*
[24] Fix | Delete
* @param WPSEO_Capability_Manager $manager The capability manager to use.
[25] Fix | Delete
*/
[26] Fix | Delete
public function __construct( WPSEO_Capability_Manager $manager ) {
[27] Fix | Delete
$this->manager = $manager;
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
/**
[31] Fix | Delete
* Registers the hooks.
[32] Fix | Delete
*
[33] Fix | Delete
* @return void
[34] Fix | Delete
*/
[35] Fix | Delete
public function register_hooks() {
[36] Fix | Delete
add_filter( 'members_get_capabilities', [ $this, 'get_capabilities' ] );
[37] Fix | Delete
add_action( 'members_register_cap_groups', [ $this, 'action_members_register_cap_group' ] );
[38] Fix | Delete
[39] Fix | Delete
add_filter( 'ure_capabilities_groups_tree', [ $this, 'filter_ure_capabilities_groups_tree' ] );
[40] Fix | Delete
add_filter( 'ure_custom_capability_groups', [ $this, 'filter_ure_custom_capability_groups' ], 10, 2 );
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
/**
[44] Fix | Delete
* Get the Yoast SEO capabilities.
[45] Fix | Delete
* Optionally append them to an existing array.
[46] Fix | Delete
*
[47] Fix | Delete
* @param array $caps Optional existing capability list.
[48] Fix | Delete
* @return array
[49] Fix | Delete
*/
[50] Fix | Delete
public function get_capabilities( array $caps = [] ) {
[51] Fix | Delete
if ( ! did_action( 'wpseo_register_capabilities' ) ) {
[52] Fix | Delete
do_action( 'wpseo_register_capabilities' );
[53] Fix | Delete
}
[54] Fix | Delete
[55] Fix | Delete
return array_merge( $caps, $this->manager->get_capabilities() );
[56] Fix | Delete
}
[57] Fix | Delete
[58] Fix | Delete
/**
[59] Fix | Delete
* Add capabilities to its own group in the Members plugin.
[60] Fix | Delete
*
[61] Fix | Delete
* @see members_register_cap_group()
[62] Fix | Delete
*
[63] Fix | Delete
* @return void
[64] Fix | Delete
*/
[65] Fix | Delete
public function action_members_register_cap_group() {
[66] Fix | Delete
if ( ! function_exists( 'members_register_cap_group' ) ) {
[67] Fix | Delete
return;
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
// Register the yoast group.
[71] Fix | Delete
$args = [
[72] Fix | Delete
'label' => esc_html__( 'Yoast SEO', 'wordpress-seo' ),
[73] Fix | Delete
'caps' => $this->get_capabilities(),
[74] Fix | Delete
'icon' => 'dashicons-admin-plugins',
[75] Fix | Delete
'diff_added' => true,
[76] Fix | Delete
];
[77] Fix | Delete
members_register_cap_group( 'wordpress-seo', $args );
[78] Fix | Delete
}
[79] Fix | Delete
[80] Fix | Delete
/**
[81] Fix | Delete
* Adds Yoast SEO capability group in the User Role Editor plugin.
[82] Fix | Delete
*
[83] Fix | Delete
* @see URE_Capabilities_Groups_Manager::get_groups_tree()
[84] Fix | Delete
*
[85] Fix | Delete
* @param array $groups Current groups.
[86] Fix | Delete
*
[87] Fix | Delete
* @return array Filtered list of capabilty groups.
[88] Fix | Delete
*/
[89] Fix | Delete
public function filter_ure_capabilities_groups_tree( $groups = [] ) {
[90] Fix | Delete
$groups = (array) $groups;
[91] Fix | Delete
[92] Fix | Delete
$groups['wordpress-seo'] = [
[93] Fix | Delete
'caption' => 'Yoast SEO',
[94] Fix | Delete
'parent' => 'custom',
[95] Fix | Delete
'level' => 3,
[96] Fix | Delete
];
[97] Fix | Delete
[98] Fix | Delete
return $groups;
[99] Fix | Delete
}
[100] Fix | Delete
[101] Fix | Delete
/**
[102] Fix | Delete
* Adds capabilities to the Yoast SEO group in the User Role Editor plugin.
[103] Fix | Delete
*
[104] Fix | Delete
* @see URE_Capabilities_Groups_Manager::get_cap_groups()
[105] Fix | Delete
*
[106] Fix | Delete
* @param array $groups Current capability groups.
[107] Fix | Delete
* @param string $cap_id Capability identifier.
[108] Fix | Delete
*
[109] Fix | Delete
* @return array List of filtered groups.
[110] Fix | Delete
*/
[111] Fix | Delete
public function filter_ure_custom_capability_groups( $groups = [], $cap_id = '' ) {
[112] Fix | Delete
if ( in_array( $cap_id, $this->get_capabilities(), true ) ) {
[113] Fix | Delete
$groups = (array) $groups;
[114] Fix | Delete
$groups[] = 'wordpress-seo';
[115] Fix | Delete
}
[116] Fix | Delete
[117] Fix | Delete
return $groups;
[118] Fix | Delete
}
[119] Fix | Delete
}
[120] Fix | Delete
[121] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function