Changeset 3095264
- Timestamp:
- 05/30/2024 03:59:42 PM (22 months ago)
- Location:
- sync-post-with-other-site/trunk
- Files:
-
- 3 edited
-
SyncPostWithOtherSite.php (modified) (2 diffs)
-
includes/sps_sync.class.php (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sync-post-with-other-site/trunk/SyncPostWithOtherSite.php
r3063897 r3095264 2 2 /* 3 3 Plugin Name: Sync Post With Other Site 4 Plugin URI: https:// syncpostwithothersite.in/4 Plugin URI: https://kp4coder.com/ 5 5 Description: Allows user to sync post with multiple websites. 6 Version: 1. 5.16 Version: 1.6 7 7 Author: kp4coder 8 Author URI: https:// syncpostwithothersite.in/author/8 Author URI: https://kp4coder.com/ 9 9 Domain Path: /languages 10 10 Text Domain: sps_text_domain … … 52 52 53 53 global $sps_version; 54 $sps_version = '1. 5.1';54 $sps_version = '1.6'; 55 55 56 56 class SyncPostWithOtherSite { -
sync-post-with-other-site/trunk/includes/sps_sync.class.php
r2972270 r3095264 15 15 add_action( "save_post", array( $this, "sps_save_post" ), 10 , 3 ); 16 16 17 add_action( "init", array( $this, "sps_get_request" ) );18 19 17 add_action( "spsp_after_save_data", array( $this, "spsp_grab_content_images" ), 10, 2 ); 20 18 19 add_action( 'rest_api_init', array( $this, 'rest_api_init_func' ) ); // Register custom API endpoints 20 } 21 22 23 function rest_api_init_func() { 24 register_rest_route( 'sps/v1', '/data', array( 25 'methods' => 'POST', 26 'callback' => array( $this, 'sps_get_request' ), 27 ) ); 21 28 } 22 29 … … 74 81 function sps_remote_post( $action, $args = array() ) { 75 82 do_action( 'spsp_before_send_data', $args ); 76 $url = $args['sps']['host_name']."/?sps_action=".$action; 77 return wp_remote_post( $url, array( 'body' => $args )); 83 $args['sps_action'] = $action; 84 $url = $args['sps']['host_name']."/wp-json/sps/v1/data"; 85 $return = wp_remote_post( $url, array( 'body' => $args )); 86 return $return; 78 87 } 79 88 … … 351 360 } 352 361 353 function sps_get_request() { 354 355 if( isset($_REQUEST['sps_action']) && !empty($_REQUEST['sps_action']) ) { 362 function sps_get_request( $request ) { 363 364 $sps_sync_data = $request->get_params(); 365 if( isset($sps_sync_data['sps_action']) && !empty($sps_sync_data['sps_action']) ) { 356 366 $this->is_website_post = false; 357 $sps_sync_data = $_REQUEST; 358 367 359 368 $sps_host_name = isset($sps_sync_data['sps']['host_name']) ? esc_url_raw($sps_sync_data['sps']['host_name']) : ''; 360 369 $sps_content_username = isset($sps_sync_data['sps']['content_username']) ? sanitize_text_field($sps_sync_data['sps']['content_username']) : ''; … … 393 402 $return['msg'] = __('Username or Password is null.', SPS_txt_domain); 394 403 } 395 echo json_encode( $return );396 exit;404 405 return new WP_REST_Response( $return, 200 ); 397 406 } 398 407 } -
sync-post-with-other-site/trunk/readme.txt
r3093320 r3095264 2 2 Contributors: kp4coder 3 3 Donate link: https://buymeacoffee.com/kp4coder 4 Tags: wp sync post, sync post content, sync post with multiple sites, post attachments, post content, post content sync, migrate post content, moving post data, synchronization post4 Tags: wp sync post, sync post with multiple sites, post content sync, migrate post content, synchronization post 5 5 Requires at least: 4.5 6 Tested up to: 6.5 7 Stable tag: 1. 36 Tested up to: 6.5.3 7 Stable tag: 1.5 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 99 99 * Fix: Security Update 100 100 101 = 1.5.3 - April 03, 2024 = 102 * Fix: Send data using API, Security Update 103 101 104 == Upgrade notice == 102 105
Note: See TracChangeset
for help on using the changeset viewer.