Skip to content

Commit 261408e

Browse files
committed
Fix: Authorization: Improved reliability of authorization by using unique code identifier
1 parent 70c179c commit 261408e

4 files changed

Lines changed: 9 additions & 177 deletions

File tree

includes/class-social-post-flow-admin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ public function __construct() {
5454
public function maybe_get_access_token() {
5555

5656
// If a code is included in the request, exchange it for an access token.
57-
if ( ! filter_has_var( INPUT_GET, 'code' ) ) {
57+
if ( ! filter_has_var( INPUT_GET, 'social-post-flow-code' ) ) {
5858
return;
5959
}
6060

6161
// Setup notices class.
6262
social_post_flow()->get_class( 'notices' )->set_key_prefix( 'social_post_flow_' . wp_get_current_user()->ID );
6363

6464
// Sanitize token.
65-
$authorization_code = filter_input( INPUT_GET, 'code', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
65+
$authorization_code = filter_input( INPUT_GET, 'social-post-flow-code', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
6666

6767
// Exchange the authorization code and verifier for an access token.
6868
$result = social_post_flow()->get_class( 'api' )->get_access_token( $authorization_code );

includes/class-social-post-flow-publish.php

Lines changed: 0 additions & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -2674,177 +2674,6 @@ public function parse_text( $post, $message ) {
26742674

26752675
}
26762676

2677-
/**
2678-
* Parses the status' Google Business configuration to return an array of compatible
2679-
* arguments that can be used to send the status.
2680-
*
2681-
* @since 1.0.0
2682-
*
2683-
* @param WP_Post $post Post.
2684-
* @param array $status Status.
2685-
* @return bool|array Google Business Profile status configuration
2686-
*/
2687-
public function parse_google_business( $post, $status ) {
2688-
2689-
// Bail if no Google Business configuration exists in the status.
2690-
if ( ! isset( $status['googlebusiness'] ) ) {
2691-
return false;
2692-
}
2693-
if ( ! is_array( $status['googlebusiness'] ) ) {
2694-
return false;
2695-
}
2696-
if ( ! isset( $status['googlebusiness']['post_type'] ) ) {
2697-
return false;
2698-
}
2699-
2700-
// Start building arguments.
2701-
$google_business_args = array(
2702-
'post_type' => $status['googlebusiness']['post_type'],
2703-
'link' => $this->get_permalink( $post ),
2704-
);
2705-
2706-
// Depending on the Google Business Post Type, build arguments.
2707-
switch ( $status['googlebusiness']['post_type'] ) {
2708-
case 'offer':
2709-
case 'event':
2710-
// Title.
2711-
$google_business_args['title'] = $this->parse_text( $post, $status['googlebusiness']['title'] );
2712-
2713-
// Code and Terms: Offers.
2714-
if ( $status['googlebusiness']['post_type'] === 'offer' ) {
2715-
$google_business_args = array_merge(
2716-
$google_business_args,
2717-
array(
2718-
'code' => $this->parse_text( $post, $status['googlebusiness']['code'] ),
2719-
'terms' => $this->parse_text( $post, $status['googlebusiness']['terms'] ),
2720-
)
2721-
);
2722-
} else {
2723-
// Event: Button.
2724-
$google_business_args['cta'] = $status['googlebusiness']['cta'];
2725-
}
2726-
2727-
// Start Date.
2728-
switch ( $status['googlebusiness']['start_date_option'] ) {
2729-
/**
2730-
* Custom Post Meta
2731-
*/
2732-
case 'custom':
2733-
// Fetch the Post's Meta Value based on the given Custom Field Key.
2734-
$date = get_post_meta( $post->ID, $status['googlebusiness']['start_date'], true );
2735-
2736-
// If the post date is numeric, it's most likely a timestamp
2737-
// Convert it to a date and time.
2738-
if ( is_numeric( $date ) ) {
2739-
$date = date( 'Y-m-d H:i:s', $date ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
2740-
}
2741-
2742-
// Set start date.
2743-
$google_business_args['start_date'] = strtotime( $date );
2744-
$google_business_args['start_time'] = date( 'H:i', strtotime( $date ) ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
2745-
break;
2746-
2747-
/**
2748-
* None
2749-
*/
2750-
case '':
2751-
break;
2752-
2753-
/**
2754-
* Third Party integrations
2755-
*/
2756-
default:
2757-
$date = false;
2758-
2759-
/**
2760-
* Allows integrations to define the status' start date for a Google Business Profile Offer or Event.
2761-
*
2762-
* @since 1.0.0
2763-
*
2764-
* @param bool|string $date Date (yyyy-mm-dd hh:mm:ss format).
2765-
* @param array $google_business_args Google Business specific arguments for status.
2766-
* @param array $status Status.
2767-
* @param WP_Post $post WordPress Post.
2768-
*/
2769-
$date = apply_filters( 'social_post_flow_publish_parse_google_business_start_date_' . $status['googlebusiness']['start_date_option'], $date, $google_business_args, $status, $post );
2770-
2771-
// Ignore if no date defined.
2772-
if ( ! $date ) {
2773-
break;
2774-
}
2775-
2776-
// Set start date.
2777-
$google_business_args['start_date'] = strtotime( $date );
2778-
$google_business_args['start_time'] = date( 'H:i', strtotime( $date ) ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
2779-
break;
2780-
}
2781-
2782-
// End Date.
2783-
switch ( $status['googlebusiness']['end_date_option'] ) {
2784-
/**
2785-
* Custom Post Meta
2786-
*/
2787-
case 'custom':
2788-
// Fetch the Post's Meta Value based on the given Custom Field Key.
2789-
$date = get_post_meta( $post->ID, $status['googlebusiness']['end_date'], true );
2790-
2791-
// If the post date is numeric, it's most likely a timestamp
2792-
// Convert it to a date and time.
2793-
if ( is_numeric( $date ) ) {
2794-
$date = date( 'Y-m-d H:i:s', $date ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
2795-
}
2796-
2797-
// Set end date.
2798-
$google_business_args['end_date'] = strtotime( $date );
2799-
$google_business_args['end_time'] = date( 'H:i', strtotime( $date ) ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
2800-
break;
2801-
2802-
/**
2803-
* None
2804-
*/
2805-
case '':
2806-
break;
2807-
2808-
/**
2809-
* Third Party integrations
2810-
*/
2811-
default:
2812-
$date = false;
2813-
2814-
/**
2815-
* Allows integrations to define the status' end date for a Google Business Profile Offer or Event.
2816-
*
2817-
* @since 1.0.0
2818-
*
2819-
* @param bool|string $date Date (yyyy-mm-dd hh:mm:ss format).
2820-
* @param array $google_business_args Google Business specific arguments for status.
2821-
* @param array $status Status.
2822-
* @param WP_Post $post WordPress Post.
2823-
*/
2824-
$date = apply_filters( 'social_post_flow_publish_parse_google_business_end_date_' . $status['googlebusiness']['end_date_option'], $date, $google_business_args, $status, $post );
2825-
2826-
// Ignore if no date defined.
2827-
if ( ! $date ) {
2828-
break;
2829-
}
2830-
2831-
// Set end date.
2832-
$google_business_args['end_date'] = strtotime( $date );
2833-
$google_business_args['end_time'] = date( 'H:i', strtotime( $date ) ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
2834-
break;
2835-
}
2836-
break;
2837-
2838-
case 'whats_new':
2839-
default:
2840-
$google_business_args['cta'] = $status['googlebusiness']['cta'];
2841-
break;
2842-
}
2843-
2844-
return $google_business_args;
2845-
2846-
}
2847-
28482677
/**
28492678
* Returns default tag parameters for the given tag e.g. {title:transformation(args)} or {title}.
28502679
*

readme.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Tags: auto post, social media, twitter, instagram, tiktok
55
Requires at least: 6.0
66
Tested up to: 6.9
77
Requires PHP: 7.4
8-
Stable tag: 1.2.0
8+
Stable tag: 1.2.1
99
License: GPLv3 or later
1010
License URI: https://www.gnu.org/licenses/gpl-3.0.html
1111

@@ -442,6 +442,9 @@ Social Post Flow offers a 7-day free trial so you can test all features before p
442442

443443
== Changelog ==
444444

445+
= 1.2.1 (2026-01-29) =
446+
* Fix: Authorization: Improved reliability of authorization by using unique code identifier
447+
445448
= 1.2.0 (2026-01-26) =
446449
* Added: TikTok support
447450

social-post-flow.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @wordpress-plugin
99
* Plugin Name: Social Post Flow
1010
* Plugin URI: http://www.socialpostflow.com/integrations/wordpress
11-
* Version: 1.2.0
11+
* Version: 1.2.1
1212
* Author: Social Post Flow
1313
* Author URI: http://www.socialpostflow.com
1414
* Description: Send WordPress Pages, Posts or Custom Post Types to social media for scheduled publishing to social networks.
@@ -27,8 +27,8 @@
2727
}
2828

2929
// Define Plugin version and build date.
30-
define( 'SOCIAL_POST_FLOW_PLUGIN_VERSION', '1.2.0' );
31-
define( 'SOCIAL_POST_FLOW_PLUGIN_BUILD_DATE', '2026-01-26 20:00:00' );
30+
define( 'SOCIAL_POST_FLOW_PLUGIN_VERSION', '1.2.1' );
31+
define( 'SOCIAL_POST_FLOW_PLUGIN_BUILD_DATE', '2026-01-29 13:00:00' );
3232

3333
// Define Plugin paths.
3434
define( 'SOCIAL_POST_FLOW_PLUGIN_URL', plugin_dir_url( __FILE__ ) );

0 commit comments

Comments
 (0)