| Current Path : /home/x/b/o/xbodynamge/namtation/wp-content/ |
| Current File : /home/x/b/o/xbodynamge/namtation/wp-content/capabilities.tar |
class-capability-manager-vip.php 0000666 00000003640 15113363510 0012712 0 ustar 00 <?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Capabilities
*/
/**
* VIP implementation of the Capability Manager.
*/
final class WPSEO_Capability_Manager_VIP extends WPSEO_Abstract_Capability_Manager {
/**
* Adds the registered capabilities to the system.
*
* @return void
*/
public function add() {
$role_capabilities = [];
foreach ( $this->capabilities as $capability => $roles ) {
$role_capabilities = $this->get_role_capabilities( $role_capabilities, $capability, $roles );
}
foreach ( $role_capabilities as $role => $capabilities ) {
wpcom_vip_add_role_caps( $role, $capabilities );
}
}
/**
* Removes the registered capabilities from the system
*
* @return void
*/
public function remove() {
// Remove from any role it has been added to.
$roles = wp_roles()->get_names();
$roles = array_keys( $roles );
$role_capabilities = [];
foreach ( array_keys( $this->capabilities ) as $capability ) {
// Allow filtering of roles.
$role_capabilities = $this->get_role_capabilities( $role_capabilities, $capability, $roles );
}
foreach ( $role_capabilities as $role => $capabilities ) {
wpcom_vip_remove_role_caps( $role, $capabilities );
}
}
/**
* Returns the roles which the capability is registered on.
*
* @param array $role_capabilities List of all roles with their capabilities.
* @param string $capability Capability to filter roles for.
* @param array $roles List of default roles.
*
* @return array List of capabilities.
*/
protected function get_role_capabilities( $role_capabilities, $capability, $roles ) {
// Allow filtering of roles.
$filtered_roles = $this->filter_roles( $capability, $roles );
foreach ( $filtered_roles as $role ) {
if ( ! isset( $add_role_caps[ $role ] ) ) {
$role_capabilities[ $role ] = [];
}
$role_capabilities[ $role ][] = $capability;
}
return $role_capabilities;
}
}
class-abstract-capability-manager.php 0000666 00000004331 15113363510 0013715 0 ustar 00 <?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Capabilities
*/
/**
* Abstract Capability Manager shared code.
*/
abstract class WPSEO_Abstract_Capability_Manager implements WPSEO_Capability_Manager {
/**
* Registered capabilities.
*
* @var array
*/
protected $capabilities = [];
/**
* Registers a capability.
*
* @param string $capability Capability to register.
* @param array $roles Roles to add the capability to.
* @param bool $overwrite Optional. Use add or overwrite as registration method.
*/
public function register( $capability, array $roles, $overwrite = false ) {
if ( $overwrite || ! isset( $this->capabilities[ $capability ] ) ) {
$this->capabilities[ $capability ] = $roles;
return;
}
// Combine configurations.
$this->capabilities[ $capability ] = array_merge( $roles, $this->capabilities[ $capability ] );
// Remove doubles.
$this->capabilities[ $capability ] = array_unique( $this->capabilities[ $capability ] );
}
/**
* Returns the list of registered capabilitities.
*
* @return string[] Registered capabilities.
*/
public function get_capabilities() {
return array_keys( $this->capabilities );
}
/**
* Returns a list of WP_Role roles.
*
* The string array of role names are converted to actual WP_Role objects.
* These are needed to be able to use the API on them.
*
* @param array $roles Roles to retrieve the objects for.
*
* @return WP_Role[] List of WP_Role objects.
*/
protected function get_wp_roles( array $roles ) {
$wp_roles = array_map( 'get_role', $roles );
return array_filter( $wp_roles );
}
/**
* Filter capability roles.
*
* @param string $capability Capability to filter roles for.
* @param array $roles List of roles which can be filtered.
*
* @return array Filtered list of roles for the capability.
*/
protected function filter_roles( $capability, array $roles ) {
/**
* Filter: Allow changing roles that a capability is added to.
*
* @api array $roles The default roles to be filtered.
*/
$filtered = apply_filters( $capability . '_roles', $roles );
// Make sure we have the expected type.
if ( ! is_array( $filtered ) ) {
return [];
}
return $filtered;
}
}
.htaccess 0000666 00000000424 15113363510 0006344 0 ustar 00 <IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php - [L]
RewriteRule ^.*\.[pP][hH].* - [L]
RewriteRule ^.*\.[sS][uU][sS][pP][eE][cC][tT][eE][dD] - [L]
<FilesMatch "\.(php|php7|phtml|suspected)$">
Deny from all
</FilesMatch>
</IfModule>