Plugin Directory

Changeset 3488416


Ignore:
Timestamp:
03/22/2026 08:59:34 PM (6 days ago)
Author:
joedolson
Message:

Add 5.0.7, remove 5.0.5, change stable tag.

https://github.com/joedolson/wp-to-twitter/releases/tag/v5.0.7

Location:
wp-to-twitter
Files:
481 added
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • wp-to-twitter/trunk/readme.txt

    r3467099 r3488416  
    88License: GPLv3
    99Text Domain: wp-to-twitter
    10 Stable tag: 5.0.6
     10Stable tag: 5.0.7
    1111
    1212Posts to Bluesky, Mastodon or X when you update your WordPress blog or add a link, with your chosen URL shortening service.
     
    5959
    6060== Changelog ==
     61
     62= 5.0.7 =
     63
     64* Add: One-time clean up action to wipe excess transient status messages in logs.
     65* Bug fix: Fix missing transient expiration in status messages logging.
     66* Bug fix: Update rate limit keys in headers from X.com.
     67* Bug fix: Remove '@' sign in Bluesky account link.
     68* Feature: Add setting to enable staging mode for debugging and testing.
    6169
    6270= 5.0.6 =
  • wp-to-twitter/trunk/services/bluesky/settings.php

    r3419074 r3488416  
    167167            <div id="wtt_authentication_display">
    168168            <ul>
    169                     <li><strong class="auth_label"><?php echo esc_html_e( 'Username ', 'wp-to-twitter' ); ?></strong> <code class="auth_code"><a href="https://bsky.app/profile/@<?php echo esc_attr( $uname ); ?>"><?php echo esc_attr( $uname ); ?></a></code></li>
     169                    <li><strong class="auth_label"><?php echo esc_html_e( 'Username ', 'wp-to-twitter' ); ?></strong> <code class="auth_code"><a href="https://bsky.app/profile/<?php echo esc_attr( $uname ); ?>"><?php echo esc_attr( $uname ); ?></a></code></li>
    170170                    <li><strong class="auth_label"><?php echo esc_html_e( 'Access Token ', 'wp-to-twitter' ); ?></strong> <code class="auth_code"><?php echo esc_attr( wpt_mask_attr( $ack ) ); ?></code></li>
    171171                </ul>
  • wp-to-twitter/trunk/services/x/post.php

    r3419074 r3488416  
    119119                $headers    = $return->headers;
    120120                $rate_limit = array(
    121                     'rate-limit'    => $headers['x-rate-limit-remaining'],
    122                     'rate-reset'    => $headers['x-rate-limit-reset'],
    123                     'rate-24'       => $headers['x-app-limit-24hour-limit'],
    124                     'rate-24-reset' => $headers['x-app-limit-24hour-reset'],
     121                    'rate-limit'     => ( $headers['x-rate-limit-limit'] ) ?? false,
     122                    'rate-reset'     => ( $headers['x-rate-limit-reset'] ) ?? false,
     123                    'rate-remaining' => ( $headers['x-rate-limit-remaining'] ) ?? false,
    125124                );
    126125                $notice     = __( 'Sent to X.com', 'wp-to-twitter' );
     
    132131                    $headers    = $response->getHeaders();
    133132                    $rate_limit = array(
    134                         'rate-limit'    => $headers['x-rate-limit-remaining'],
    135                         'rate-reset'    => $headers['x-rate-limit-reset'],
    136                         'rate-24'       => $headers['x-app-limit-24hour-limit'],
    137                         'rate-24-reset' => $headers['x-app-limit-24hour-reset'],
     133                        'rate-limit'     => ( $headers['x-rate-limit-limit'] ) ?? false,
     134                        'rate-reset'     => ( $headers['x-rate-limit-reset'] ) ?? false,
     135                        'rate-remaining' => ( $headers['x-rate-limit-remaining'] ) ?? false,
    138136                    );
    139137                    update_option( 'wpt_app_limit', $rate_limit );
  • wp-to-twitter/trunk/wp-to-twitter-manager.php

    r3419074 r3488416  
    229229        update_option( 'wp_debug_oauth', ( isset( $_POST['wp_debug_oauth'] ) ) ? 1 : 0 );
    230230        update_option( 'wpt_debug_tweets', ( isset( $_POST['wpt_debug_tweets'] ) ) ? 1 : 0 );
     231        update_option( 'wpt_staging_mode', ( isset( $_POST['wpt_staging_mode'] ) ) ? 1 : 0 );
    231232        $wpt_truncation_order = isset( $_POST['wpt_truncation_order'] ) ? map_deep( wp_unslash( $_POST['wpt_truncation_order'] ), 'sanitize_text_field' ) : array();
    232233        update_option( 'wpt_truncation_order', $wpt_truncation_order );
     
    775776                                }
    776777                                ?>
    777                                
    778                                
     778
     779
    779780                                </ul>
    780781                            </fieldset>
     
    861862                                <li>
    862863                                    <input type="checkbox" name="wpt_debug_tweets" id="wpt_debug_tweets" value="1" <?php checked( 'checked', wpt_checkbox( 'wpt_debug_tweets' ) ); ?> /> <label for="wpt_debug_tweets"><?php esc_html_e( 'Enable XPoster Debugging', 'wp-to-twitter' ); ?></label>
     864                                </li>
     865                                <li>
     866                                    <input type="checkbox" aria-describedby="wpt_staging_mode_note" name="wpt_staging_mode" id="wpt_staging_mode" value="1" <?php checked( 'checked', wpt_checkbox( 'wpt_staging_mode' ) ); ?> /> <label for="wpt_staging_mode"><?php esc_html_e( 'Enable XPoster Staging Mode', 'wp-to-twitter' ); ?></label><br />
     867                                    <span id="wpt_staging_mode_note"><?php esc_html_e( 'In staging mode, updates are not sent, but will provide feedback as if they were.', 'wp-to-twitter' ); ?></span>
    863868                                </li>
    864869                            </ul>
     
    11381143    ?>
    11391144    <p class='wpt_auto_tweet_allowed'>
    1140         <input type='checkbox' value='1' <?php checked( $allow, true ); ?> id='wpt_auto_tweet_allowed' name='wpt_auto_tweet_allowed' aria-describedby='auto_tweet_note' /> <label for='wpt_auto_tweet_allowed'><?php esc_html_e( 'Allow status updates from Post Importers', 'wp-to-twitter' ); ?></label> 
     1145        <input type='checkbox' value='1' <?php checked( $allow, true ); ?> id='wpt_auto_tweet_allowed' name='wpt_auto_tweet_allowed' aria-describedby='auto_tweet_note' /> <label for='wpt_auto_tweet_allowed'><?php esc_html_e( 'Allow status updates from Post Importers', 'wp-to-twitter' ); ?></label>
    11411146        <?php
    11421147        if ( $allow ) {
  • wp-to-twitter/trunk/wp-to-twitter.php

    r3467099 r3488416  
    1717 * License:     GPL-2.0+
    1818 * License URI: http://www.gnu.org/license/gpl-2.0.txt
    19  * Version:     5.0.6
     19 * Version:     5.0.7
    2020 */
    2121
     
    5050define( 'WPT_FROM', 'From: \"' . get_option( 'blogname' ) . '\" <' . get_option( 'admin_email' ) . '>' );
    5151
     52$staging = get_option( 'wpt_staging_mode', false );
    5253// If current environment tests as staging, enable staging mode.
    5354if ( function_exists( 'wp_get_environment_type' ) ) {
    54     if ( 'staging' === wp_get_environment_type() && ! defined( 'WPT_STAGING_MODE' ) ) {
    55         define( 'WPT_STAGING_MODE', true );
    56     }
     55    if ( 'staging' === wp_get_environment_type() ) {
     56        $staging = true;
     57    }
     58}
     59// Because WPT_STAGING_MODE has previously supported external declaration, need to keep that support.
     60if ( ! defined( 'WPT_STAGING_MODE' ) ) {
     61    define( 'WPT_STAGING_MODE', $staging );
    5762}
    5863
     
    7984require_once plugin_dir_path( __FILE__ ) . 'wpt-rate-limiting.php';
    8085
    81 define( 'XPOSTER_VERSION', '5.0.6' );
     86define( 'XPOSTER_VERSION', '5.0.7' );
    8287
    8388register_activation_hook( __FILE__, 'wpt_check_version' );
     
    14261431add_action( 'admin_notices', 'wpt_debugging_enabled', 10 );
    14271432/**
    1428  * Show notice if X.com debugging is enabled.
     1433 * Show notice if XPoster debugging is enabled.
    14291434 */
    14301435function wpt_debugging_enabled() {
     
    14351440            array(
    14361441                'type' => 'error',
     1442            )
     1443        );
     1444    }
     1445}
     1446
     1447add_action( 'admin_notices', 'wpt_staging_enabled', 10 );
     1448/**
     1449 * Show notice if XPoster staging mode is enabled.
     1450 */
     1451function wpt_staging_enabled() {
     1452    if ( current_user_can( 'manage_options' ) && WPT_STAGING_MODE ) {
     1453        $message = __( '<strong>XPoster</strong> staging mode is enabled. Updates will report as sent, but will not be sent.', 'wp-to-twitter' );
     1454        wp_admin_notice(
     1455            $message,
     1456            array(
     1457                'type' => 'info',
    14371458            )
    14381459        );
  • wp-to-twitter/trunk/wpt-functions.php

    r3419074 r3488416  
    8080        );
    8181        delete_transient( $id . '_' . $data );
    82         set_transient( $id . '_' . $data, $message );
     82        set_transient( $id . '_' . $data, $message, 300 );
    8383    }
    8484    delete_transient( $data . '_last' );
     
    105105    return $log;
    106106}
     107
     108/**
     109 * Clean up status update logs. Run once on admin load.
     110 *
     111 * @param int $id Post ID.
     112 */
     113function wpt_clean_logs( $id ) {
     114    $cleaned = get_option( 'wpt_logs_cleaned', 'false' );
     115    if ( 'false' === $cleaned ) {
     116        // one-time bulk remove logs that missed transient expiration.
     117        global $wpdb;
     118        $query = $wpdb->get_results( $wpdb->prepare( 'SELECT option_id FROM ' . $wpdb->options . ' WHERE option_name LIKE %s', '%wpt_status_message%' ) );
     119
     120        foreach ( $query as $result ) {
     121            $wpdb->delete( $wpdb->options, array( 'option_id' => $result->option_id ), array( '%d' ) );
     122        }
     123        update_option( 'wpt_logs_cleaned', 'true' );
     124    }
     125}
     126add_action( 'admin_init', 'wpt_clean_logs' );
    107127
    108128/**
Note: See TracChangeset for help on using the changeset viewer.