WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Самая быстрая Тема-конструктор для WordPress
класс не описан

WPSEO_Role_Manager_VIP{} Yoast 1.0

VIP implementation of the Role Manager.

Хуков нет.

Возвращает

Null. Ничего.

Использование

$WPSEO_Role_Manager_VIP = new WPSEO_Role_Manager_VIP();
// use class methods

Методы

  1. add_role( $role, $display_name, array $capabilities = [] )
  2. remove_role( $role )

Код WPSEO_Role_Manager_VIP{} Yoast 15.2

<?php
final class WPSEO_Role_Manager_VIP extends WPSEO_Abstract_Role_Manager {

	/**
	 * Adds a role to the system.
	 *
	 * @param string $role         Role to add.
	 * @param string $display_name Name to display for the role.
	 * @param array  $capabilities Capabilities to add to the role.
	 *
	 * @return void
	 */
	protected function add_role( $role, $display_name, array $capabilities = [] ) {
		$enabled_capabilities  = [];
		$disabled_capabilities = [];

		// Build lists of enabled and disabled capabilities.
		foreach ( $capabilities as $capability => $grant ) {
			if ( $grant ) {
				$enabled_capabilities[] = $capability;
			}

			if ( ! $grant ) {
				$disabled_capabilities[] = $capability;
			}
		}

		wpcom_vip_add_role( $role, $display_name, $enabled_capabilities );
		if ( $disabled_capabilities !== [] ) {
			wpcom_vip_remove_role_caps( $role, $disabled_capabilities );
		}
	}

	/**
	 * Removes a role from the system.
	 *
	 * @param string $role Role to remove.
	 *
	 * @return void
	 */
	protected function remove_role( $role ) {
		remove_role( $role );
	}
}