| Server IP : 121.121.20.254 / Your IP : 216.73.216.202 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/KnowledgeBase/wp-content/plugins/aioseo-link-assistant/app/Api/ |
Upload File : |
<?php
namespace AIOSEO\Plugin\Addon\LinkAssistant\Api;
use AIOSEO\Plugin\Addon\LinkAssistant\Models;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Handles requests from the metabox.
*
* @since 1.0.0
*/
class PostSettings extends Common {
/**
* Returns the updated link & suggestion results.
*
* @since 1.0.0
*
* @param \WP_Request $request The request.
* @return \WP_Response The response with the link data.
*/
public static function update( $request ) {
$postId = isset( $request['postId'] ) ? $request['postId'] : 0;
$postContent = isset( $request['postContent'] ) ? $request['postContent'] : '';
if ( ! $postId || ! $postContent ) {
return new \WP_REST_Response( [
'success' => false,
'error' => 'No post ID or content was passed.'
], 404 );
}
// Scan for new links; suggestions are updated in the background.
aioseoLinkAssistant()->main->links->data->indexLinks( $postId, $postContent );
return new \WP_REST_Response( [
'success' => true,
'links' => aioseoLinkAssistant()->helpers->getPostLinks( $postId, null )
], 200 );
}
}