Plugin Directory

Changeset 3292615


Ignore:
Timestamp:
05/13/2025 01:48:24 PM (11 months ago)
Author:
galbc
Message:

Release version 1.0.20

Location:
sapientseo
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • sapientseo/tags/1.0.20/inc/api/posts.php

    r3291488 r3292615  
    112112        'methods'  => 'GET',
    113113        'callback' => 'sapient_seo_get_post_details',
     114        'permission_callback' => function ($request) {
     115            return sapient_seo_api_key_permission($request);
     116        }
     117    ]);
     118    register_rest_route('sapientseo/v1', '/publish-post', [
     119        'methods'  => 'POST',
     120        'callback' => 'sapient_seo_quick_publish_post',
    114121        'permission_callback' => function ($request) {
    115122            return sapient_seo_api_key_permission($request);
     
    299306    ]);
    300307}
     308
     309// 🔹 Quick Publish Post
     310function sapient_seo_quick_publish_post(WP_REST_Request $request) {
     311    $post_id = intval($request->get_param('post_id'));
     312    if (!$post_id || get_post_status($post_id) === false) {
     313        return new WP_Error('invalid_post', 'Post not found.', ['status' => 404]);
     314    }
     315
     316    $update = wp_update_post([
     317        'ID' => $post_id,
     318        'post_status' => 'publish',
     319        'post_date' => current_time('mysql'),
     320        'post_date_gmt' => current_time('mysql', 1),
     321    ], true);
     322
     323    if (is_wp_error($update)) {
     324        return rest_ensure_response([
     325            'error' => 'publish_failed',
     326            'message' => 'Could not publish post.',
     327            'status' => 500
     328        ]);
     329    }
     330
     331    return rest_ensure_response(['post_id' => $post_id, 'message' => 'Post published successfully.']);
     332}
  • sapientseo/tags/1.0.20/readme.txt

    r3292121 r3292615  
    44Tested up to: 6.8
    55Requires PHP: 7.4
    6 Stable tag: 1.0.19
     6Stable tag: 1.0.20
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • sapientseo/tags/1.0.20/sapientseo.php

    r3292121 r3292615  
    33 * Plugin Name: SapientSEO
    44 * Description: Connect your WordPress site to SapientSEO using secure custom REST API endpoints.
    5  * Version: 1.0.19
     5 * Version: 1.0.20
    66 * Author: SapientSEO
    77 * Plugin URI: https://sapientseo.ai
  • sapientseo/trunk/inc/api/posts.php

    r3291488 r3292615  
    112112        'methods'  => 'GET',
    113113        'callback' => 'sapient_seo_get_post_details',
     114        'permission_callback' => function ($request) {
     115            return sapient_seo_api_key_permission($request);
     116        }
     117    ]);
     118    register_rest_route('sapientseo/v1', '/publish-post', [
     119        'methods'  => 'POST',
     120        'callback' => 'sapient_seo_quick_publish_post',
    114121        'permission_callback' => function ($request) {
    115122            return sapient_seo_api_key_permission($request);
     
    299306    ]);
    300307}
     308
     309// 🔹 Quick Publish Post
     310function sapient_seo_quick_publish_post(WP_REST_Request $request) {
     311    $post_id = intval($request->get_param('post_id'));
     312    if (!$post_id || get_post_status($post_id) === false) {
     313        return new WP_Error('invalid_post', 'Post not found.', ['status' => 404]);
     314    }
     315
     316    $update = wp_update_post([
     317        'ID' => $post_id,
     318        'post_status' => 'publish',
     319        'post_date' => current_time('mysql'),
     320        'post_date_gmt' => current_time('mysql', 1),
     321    ], true);
     322
     323    if (is_wp_error($update)) {
     324        return rest_ensure_response([
     325            'error' => 'publish_failed',
     326            'message' => 'Could not publish post.',
     327            'status' => 500
     328        ]);
     329    }
     330
     331    return rest_ensure_response(['post_id' => $post_id, 'message' => 'Post published successfully.']);
     332}
  • sapientseo/trunk/readme.txt

    r3292121 r3292615  
    44Tested up to: 6.8
    55Requires PHP: 7.4
    6 Stable tag: 1.0.19
     6Stable tag: 1.0.20
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • sapientseo/trunk/sapientseo.php

    r3292121 r3292615  
    33 * Plugin Name: SapientSEO
    44 * Description: Connect your WordPress site to SapientSEO using secure custom REST API endpoints.
    5  * Version: 1.0.19
     5 * Version: 1.0.20
    66 * Author: SapientSEO
    77 * Plugin URI: https://sapientseo.ai
Note: See TracChangeset for help on using the changeset viewer.