'import', 'upload_files' => 'upload_files', 'install_plugins' => 'install_plugins', 'activate_plugins' => 'activate_plugins', 'install_themes' => 'install_themes', 'switch_themes' => 'switch_themes', ); /** * Whether the current user may take one privileged action. * * @param string $action Key from CORE_ACTIONS. * @return bool False for an action nobody named, so a typo denies rather * than permits. */ public static function can( $action ) { if ( ! isset( self::CORE_ACTIONS[ $action ] ) ) { return false; } return current_user_can( self::CORE_ACTIONS[ $action ] ); } /** * Whether the current user may run a demo import. * * An import writes content and changes site settings, so it needs both * the plugin's own capability and WordPress's for importing. * * @return bool */ public static function current_user_can_import() { return self::current_user_can_manage() && self::can( 'import' ); } /** * Capability required to administer PageCore itself. * * @return string */ public static function manage() { return 'manage_options'; } /** * Whether the current user may administer PageCore. * * @return bool */ public static function current_user_can_manage() { return current_user_can( self::manage() ); } }