芝麻web文件管理V1.00
编辑当前文件:/home/ezdajrnh/www/wp-content/plugins/wordpress-seo-premium/src/routes/link-suggestions-route.php
link_suggestions_action = $link_suggestions_action; } /** * Registers routes with WordPress. * * @return void */ public function register_routes() { $route_args = [ 'methods' => 'GET', 'args' => [ 'prominent_words' => [ 'required' => true, 'type' => 'object', 'description' => 'Stems of prominent words and their term frequencies we want link suggestions based on', ], 'object_id' => [ 'required' => true, 'type' => 'integer', 'description' => 'The object id of the current indexable.', ], 'object_type' => [ 'required' => true, 'type' => 'string', 'description' => 'The object type of the current indexable.', ], 'limit' => [ 'required' => false, 'default' => 5, 'type' => 'integer', 'description' => 'The maximum number of link suggestions to retrieve', ], ], 'callback' => [ $this, 'run_get_suggestions_action' ], 'permission_callback' => [ $this, 'can_retrieve_data' ], ]; \register_rest_route( Main::API_V1_NAMESPACE, self::ENDPOINT_QUERY, $route_args ); } /** * Runs the get suggestions action.. * * @param WP_REST_Request $request The request object. * * @return WP_REST_Response The response for the query of link suggestions. */ public function run_get_suggestions_action( WP_REST_Request $request ) { $prominent_words = $request->get_param( 'prominent_words' ); $limit = $request->get_param( 'limit' ); $object_id = $request->get_param( 'object_id' ); $object_type = $request->get_param( 'object_type' ); $post_type = $request->get_param( 'post_type' ); return new WP_REST_Response( $this->link_suggestions_action->get_suggestions( $prominent_words, $limit, $object_id, $object_type, true, $post_type ) ); } /** * Determines if the current user is allowed to use this endpoint. * * @return bool */ public function can_retrieve_data() { return \current_user_can( 'edit_posts' ); } }