Skip to content

Commit

Permalink
Updated "Twitter" to "X" in codebase.
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdharmesh committed Nov 29, 2023
1 parent fc6dc8f commit bf35aad
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 51 deletions.
6 changes: 3 additions & 3 deletions autoshare-for-twitter.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Plugin Name: Autoshare for Twitter
* Description: Automatically tweets the post title or custom message and a link to the post.
* Plugin Name: Autopost for X (formerly Autoshare for Twitter)
* Description: Automatically shares the post title or custom message and a link to the post to X/Twitter.
* Disclaimer: TWITTER, TWEET, RETWEET and the Twitter logo are trademarks of Twitter, Inc. or its affiliates.
* Version: 2.1.1
* Requires at least: 5.7
Expand Down Expand Up @@ -58,7 +58,7 @@ function () {
echo wp_kses_post(
sprintf(
/* translators: %s: Minimum required PHP version */
__( 'Autoshare for Twitter requires PHP version %s or later. Please upgrade PHP or disable the plugin.', 'autoshare-for-twitter' ),
__( 'Autopost for X requires PHP version %s or later. Please upgrade PHP or disable the plugin.', 'autoshare-for-twitter' ),
esc_html( minimum_php_requirement() )
)
);
Expand Down
16 changes: 8 additions & 8 deletions includes/admin/post-meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
const TWEET_BODY_KEY = 'tweet-body';

/**
* Holds the formatted response object from Twitter.
* Holds the formatted response object from X.
*
* @see post-transition.php
*/
Expand All @@ -53,7 +53,7 @@
* @return void
*/
function setup() {
// Add Autoshare for twitter meta box to classic editor.
// Add Autopost for X meta box to classic editor.
add_action( 'add_meta_boxes', __NAMESPACE__ . '\autoshare_for_twitter_metabox', 10, 2 );
add_action( 'save_post', __NAMESPACE__ . '\save_tweet_meta', 10, 3 );
}
Expand Down Expand Up @@ -204,7 +204,7 @@ function save_autoshare_for_twitter_meta_data( $post_id, $data ) {
}

/**
* Add Autoshare for twitter metabox on post/post types.
* Add Autopost for X metabox on post/post types.
*
* @param string $post_type Post Type.
* @param WP_Post $post WP_Post object.
Expand All @@ -221,7 +221,7 @@ function autoshare_for_twitter_metabox( $post_type, $post ) {

add_meta_box(
'autoshare_for_twitter_metabox',
__( 'Autoshare for Twitter ', 'autoshare-for-twitter' ),
__( 'Autopost for X', 'autoshare-for-twitter' ),
__NAMESPACE__ . '\render_tweet_submitbox',
null,
'side',
Expand Down Expand Up @@ -279,7 +279,7 @@ function render_tweet_submitbox( $post ) {


/**
* Render the Twitter accounts to be used for autosharing.
* Render the X accounts to be used for autoposting.
*
* @param int $post_id The post ID.
*/
Expand Down Expand Up @@ -475,7 +475,7 @@ function get_tweet_status_logs( $post ) {

/**
* Outputs the markup and language to be used when a post has been successfully
* sent to Twitter
* sent to X
*
* @param array $status_meta The status meta.
*
Expand All @@ -499,7 +499,7 @@ function markup_published( $status_meta ) {

/**
* Outputs the markup and language to be used when a post has had an error
* when posting to Twitter
* when posting to X
*
* @param array $status_meta The status meta.
*
Expand All @@ -525,7 +525,7 @@ function markup_error( $status_meta ) {
}

/**
* Outputs the markup and language to be used when a post NOT been auto-posted to Twitter.
* Outputs the markup and language to be used when a post NOT been auto-posted to X.
* Also considered a fallback message of sorts.
*
* @param array $status_meta The status meta.
Expand Down
40 changes: 20 additions & 20 deletions includes/admin/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ function setup() {
*/
function admin_menu() {
add_options_page(
__( 'Autoshare for Twitter Settings', 'autoshare-for-twitter' ),
__( 'Autoshare for Twitter', 'autoshare-for-twitter' ),
__( 'Autopost for X Settings', 'autoshare-for-twitter' ),
__( 'Autopost for X', 'autoshare-for-twitter' ),
'manage_options',
'autoshare-for-twitter',
__NAMESPACE__ . '\options_page'
Expand Down Expand Up @@ -84,7 +84,7 @@ function register_settings() {
// Post type.
add_settings_field(
'autoshare-enable_for',
__( 'Enable Autoshare for', 'autoshare-for-twitter' ),
__( 'Enable Autopost for', 'autoshare-for-twitter' ),
__NAMESPACE__ . '\radio_field_cb',
'autoshare-for-twitter',
'autoshare-general_section',
Expand Down Expand Up @@ -140,10 +140,10 @@ function register_settings() {
]
);

// Twitter account connection table.
// X account connection table.
add_settings_field(
'autoshare-autoshare_accounts',
__( 'Twitter accounts', 'autoshare-for-twitter' ),
__( 'X accounts', 'autoshare-for-twitter' ),
__NAMESPACE__ . '\twitter_accounts_field_cb',
'autoshare-for-twitter',
'autoshare-general_section',
Expand All @@ -155,7 +155,7 @@ function register_settings() {
// Register the credential setting section.
add_settings_section(
'autoshare-cred_section',
__( 'Twitter connection settings', 'autoshare-for-twitter' ),
__( 'X connection settings', 'autoshare-for-twitter' ),
__NAMESPACE__ . '\cred_section_cb',
'autoshare-for-twitter'
);
Expand Down Expand Up @@ -293,7 +293,7 @@ function checkbox_field_cb( $args ) {
}

/**
* Helper for outputting a Twitter account list table.
* Helper for outputting a X account list table.
*
* @param array $args The field arguments.
*
Expand All @@ -314,7 +314,7 @@ function general_section_cb() {
$cred_class = Utils\is_twitter_configured() ? 'connected' : '';
?>
<div class="general-settings <?php echo esc_attr( $cred_class ); ?>">
<h2><?php esc_html_e( 'Twitter Settings', 'autoshare-for-twitter' ); ?>
<h2><?php esc_html_e( 'X Settings', 'autoshare-for-twitter' ); ?>
</div>
<?php
}
Expand All @@ -338,27 +338,27 @@ function cred_section_cb() {
</p>
<?php endif; ?>
<section class="credentials-instructions">
<h4><a href="https://developer.twitter.com/en/portal/petition/essential/basic-info" target="_blank"><?php esc_html_e( '1. Sign up for a Twitter developer account', 'autoshare-for-twitter' ); ?></a></h4>
<h4><a href="https://developer.twitter.com/en/portal/petition/essential/basic-info" target="_blank"><?php esc_html_e( '1. Sign up for a X developer account', 'autoshare-for-twitter' ); ?></a></h4>
<ul>
<li><?php esc_html_e( 'Click on "Sign up for Free Account" button to proceed with free access.', 'autoshare-for-twitter' ); ?></li>
<li><?php echo wp_kses_data( __( "Fill out the <code>Describe all of your use cases of Twitter's data and API</code> field. You can find an example response below.", 'autoshare-for-twitter' ) ); ?>
<li><?php echo wp_kses_data( __( "Fill out the <code>Describe all of your use cases of X's data and API</code> field. You can find an example response below.", 'autoshare-for-twitter' ) ); ?>
</li>
<div class="copy-container-wrap">
<p class="copy-container">
<span class="copy-content"><?php esc_html_e( 'I am planning to add an auto-tweet feature on my WordPress website with the help of the Autoshare for Twitter, WordPress plugin. Whenever a new post will be published on the website, Autoshare for Twitter plugin will use the post data to curate and trigger a Tweet.', 'autoshare-for-twitter' ); ?></span>
<span class="copy-content"><?php esc_html_e( 'I am planning to add an auto-tweet feature on my WordPress website with the help of the Autopost for X, WordPress plugin. Whenever a new post will be published on the website, Autopost for X plugin will use the post data to curate and trigger a Tweet.', 'autoshare-for-twitter' ); ?></span>
<a href="#" class="astCopyToClipCard"><span class="dashicons dashicons-clipboard"></span></a>
</p>
</div>
<li><?php esc_html_e( 'Click on "Submit" button, it will redirect you to Developer portal.', 'autoshare-for-twitter' ); ?></li>
</ul>

<h4><?php esc_html_e( '2. Configure access to your Twitter app access tokens', 'autoshare-for-twitter' ); ?></h4>
<h4><?php esc_html_e( '2. Configure access to your X app access tokens', 'autoshare-for-twitter' ); ?></h4>
<ul>
<li>
<?php
printf(
/* translators: Placeholders %1$s - opening HTML <a> link tag, closing HTML </a> link tag */
wp_kses_data( __( 'Go to the %1$sTwitter developer portal%2$s', 'autoshare-for-twitter' ) ),
wp_kses_data( __( 'Go to the %1$sX developer portal%2$s', 'autoshare-for-twitter' ) ),
'<a href="https://developer.twitter.com/en/portal/dashboard" target="_blank">',
'</a>'
);
Expand All @@ -376,7 +376,7 @@ function cred_section_cb() {
</li>
<li>
<?php
/* translators: Placeholders %s - Callback URL for Twitter Auth */
/* translators: Placeholders %s - Callback URL for X Auth */
echo wp_kses_data( sprintf( __( 'Set the <code>Callback URLs</code> fields to <code>%s</code> and click <code>Save</code>.', 'autoshare-for-twitter' ), esc_url( admin_url( 'admin-post.php?action=authoshare_authorize_callback' ) ) ) );
?>
</li>
Expand All @@ -390,10 +390,10 @@ function cred_section_cb() {
<li><?php echo wp_kses_data( __( 'Click the <code>Save Changes</code> button below to save settings.', 'autoshare-for-twitter' ) ); ?></li>
</ul>

<h4><?php esc_html_e( '4. Connect your Twitter account', 'autoshare-for-twitter' ); ?></h4>
<h4><?php esc_html_e( '4. Connect your X account', 'autoshare-for-twitter' ); ?></h4>
<ul>
<li><?php echo wp_kses_data( __( 'After saving settings, you will see the option to connect your Twitter account.', 'autoshare-for-twitter' ) ); ?></li>
<li><?php echo wp_kses_data( __( 'Click the <code>Connect Twitter account</code> button and follow the instructions provided there to connect your Twitter account with this site.', 'autoshare-for-twitter' ) ); ?></li>
<li><?php echo wp_kses_data( __( 'After saving settings, you will see the option to connect your X account.', 'autoshare-for-twitter' ) ); ?></li>
<li><?php echo wp_kses_data( __( 'Click the <code>Connect X account</code> button and follow the instructions provided there to connect your X account with this site.', 'autoshare-for-twitter' ) ); ?></li>
</ul>
</section>
</section>
Expand All @@ -409,7 +409,7 @@ function options_page() {

?>
<div class="wrap">
<h1><?php esc_html_e( 'Autoshare for Twitter Settings', 'autoshare-for-twitter' ); ?></h1>
<h1><?php esc_html_e( 'Autopost for X Settings', 'autoshare-for-twitter' ); ?></h1>

<div class="autoshare-settings">
<div class="settings-wrapper">
Expand All @@ -427,7 +427,7 @@ function options_page() {
</a>
<p>
<strong>
<?php echo esc_html__( 'Autoshare for Twitter', 'autoshare-for-twitter' ) . ' ' . esc_html__( 'by', 'autoshare-for-twitter' ); ?> <a href="https://10up.com" class="logo" title="<?php esc_attr_e( '10up', 'autoshare-for-twitter' ); ?>"><?php esc_html_e( '10up', 'autoshare-for-twitter' ); ?></a>
<?php echo esc_html__( 'Autopost for X', 'autoshare-for-twitter' ) . ' ' . esc_html__( 'by', 'autoshare-for-twitter' ); ?> <a href="https://10up.com" class="logo" title="<?php esc_attr_e( '10up', 'autoshare-for-twitter' ); ?>"><?php esc_html_e( '10up', 'autoshare-for-twitter' ); ?></a>
</strong>
</p>
<nav>
Expand Down Expand Up @@ -462,7 +462,7 @@ function action_links( $links ) {
} else {
$new_links['initial-setup'] = sprintf(
/* translators: %s is the plugin setting page URL */
__( '<a href="%s">Set up your Twitter account</a>', 'autoshare-for-twitter' ),
__( '<a href="%s">Set up your X account</a>', 'autoshare-for-twitter' ),
esc_url( admin_url( 'options-general.php?page=autoshare-for-twitter' ) )
);
}
Expand Down
4 changes: 2 additions & 2 deletions includes/class-ast-staging.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace TenUp\AutoshareForTwitter\Core\AST_Staging;

/**
* Autoshare For Twitter staging mode handler.
* Autopost for X staging mode handler.
*
* @package TenUp\AutoshareForTwitter\Core
*
Expand Down Expand Up @@ -68,7 +68,7 @@ public static function handle_site_change_notice() {
<?php
printf(
// translators: 1$-2$: opening and closing <strong> tags. 3$-4$: Opening and closing link to production URL. 5$: Production URL.
esc_html__( 'It looks like this site has moved or is a duplicate site. %1$sAutoshare for Twitter%2$s has disabled publish tweets on this site to prevent tweets from a staging or test environment. %1$sAutoshare for Twitter%2$s considers %3$s%5$s%4$s to be the site\'s URL. ', 'autoshare-for-twitter' ),
esc_html__( 'It looks like this site has moved or is a duplicate site. %1$sAutopost for X%2$s has disabled publish tweets on this site to prevent tweets from a staging or test environment. %1$sAutopost for X%2$s considers %3$s%5$s%4$s to be the site\'s URL. ', 'autoshare-for-twitter' ),
'<strong>',
'</strong>',
'<a href="' . esc_url( self::get_url_from_source( 'autoshare' ) ) . '" target="_blank">',
Expand Down
8 changes: 4 additions & 4 deletions includes/class-twitter-accounts-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public function __construct() {
*/
public function get_columns() {
return array(
'account' => __( 'Twitter account', 'autoshare-for-twitter' ),
'autoshare_accounts' => __( 'Autoshare by default', 'autoshare-for-twitter' ),
'account' => __( 'X account', 'autoshare-for-twitter' ),
'autoshare_accounts' => __( 'Autopost by default', 'autoshare-for-twitter' ),
'action' => __( 'Action', 'autoshare-for-twitter' ),
);
}
Expand Down Expand Up @@ -128,7 +128,7 @@ public function column_default( $item, $column_name ) {
*/
public function no_items() {
?>
<p><?php esc_html_e( 'No Twitter accounts are connected. Please connect at least one Twitter account to continue using Autoshare for Twitter.', 'autoshare-for-twitter' ); ?></p>
<p><?php esc_html_e( 'No Twitter accounts are connected. Please connect at least one Twitter account to continue using Autopost for X.', 'autoshare-for-twitter' ); ?></p>
<?php
}

Expand All @@ -148,7 +148,7 @@ protected function display_tablenav( $which ) {
<?php if ( 'bottom' === $which ) : ?>
<div class="alignleft">
<a href="<?php echo esc_url( $connect_url ); ?>" class="button button-secondary">
<?php echo ( ! empty( $this->items ) ? esc_attr__( 'Connect another account', 'autoshare-for-twitter' ) : esc_attr__( 'Connect Twitter account', 'autoshare-for-twitter' ) ); ?>
<?php echo ( ! empty( $this->items ) ? esc_attr__( 'Connect another account', 'autoshare-for-twitter' ) : esc_attr__( 'Connect X account', 'autoshare-for-twitter' ) ); ?>
</a>
</div>
<?php endif; ?>
Expand Down
6 changes: 3 additions & 3 deletions includes/class-twitter-accounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function authoshare_authorize_user_callback() {

// Save account details.
$this->save_twitter_account( $account );
$this->set_connection_notice( 'success', __( 'Twitter account authenticated successfully' ) );
$this->set_connection_notice( 'success', __( 'X account authenticated successfully' ) );
} catch ( \Exception $e ) {
$error_message = $e->getMessage();
$this->set_connection_notice( 'error', $error_message );
Expand All @@ -162,7 +162,7 @@ public function authoshare_authorize_user_callback() {
}

/**
* Disconnect twitter account.
* Disconnect X account.
*/
public function twitter_disconnect() {
// Check if the user has the correct permissions.
Expand All @@ -176,7 +176,7 @@ public function twitter_disconnect() {
}

if ( ! isset( $_GET['account_id'] ) ) {
wp_die( esc_html__( 'Twitter account ID is required to perform this operation.', 'autoshare-for-twitter' ) );
wp_die( esc_html__( 'X account ID is required to perform this operation.', 'autoshare-for-twitter' ) );
}

try {
Expand Down
2 changes: 1 addition & 1 deletion includes/class-twitter-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public function upload_media( $image ) {
}

/**
* Disconnect Twitter account.
* Disconnect X account.
*
* @return bool True if account was disconnected, false otherwise.
*/
Expand Down
2 changes: 1 addition & 1 deletion includes/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ function migrate_to_twitter_v2_api() {
<?php
printf(
// translators: 1$-2$: Opening and closing <a> tags for Twitter V2 API, 3$-4$: Opening and closing <a> tags for migrate app, 5$-6$: Opening and closing <a> tags for learn more.
wp_kses_post( __( 'Autoshare for Twitter now utilizes the %1$sTwitter v2 API%2$s. If you have not already done so, please %3$smigrate your app%4$s to Twitter v2 API to continue using Autoshare for Twitter. %5$sLearn more about migrating here%6$s.', 'autoshare-for-twitter' ) ),
wp_kses_post( __( 'Autopost for X now utilizes the %1$sTwitter v2 API%2$s. If you have not already done so, please %3$smigrate your app%4$s to Twitter v2 API to continue using Autopost for X. %5$sLearn more about migrating here%6$s.', 'autoshare-for-twitter' ) ),
'<a href="https://developer.twitter.com/en/products/twitter-api" target="_blank">',
'</a>',
'<a href="https://developer.twitter.com/en/portal/projects-and-apps" target="_blank">',
Expand Down
2 changes: 1 addition & 1 deletion includes/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function update_autoshare_for_twitter_meta( $id, $key, $value ) {
}

/**
* Determines whether an Autoshare for Twitter post meta key exists on the provided post.
* Determines whether an Autopost for X post meta key exists on the provided post.
*
* @param int $id A Post ID.
* @param string $key A meta key.
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/e2e/admin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Configure the plugin', () => {
cy.login();
});

it('Configure the plugin settings and Twitter accounts', () => {
it('Configure the plugin settings and X accounts', () => {
cy.visit('/wp-admin/options-general.php?page=autoshare-for-twitter');
cy.get('.large-text:nth-child(1) .large-text').clear().type( 'TEST_TWITTER_API_KEY' );
cy.get('.large-text:nth-child(2) .large-text').clear().type( 'TEST_TWITTER_API_SECRET' );
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/e2e/block-editor.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getRandomText } from "../support/functions";

describe('Test Autoshare for Twitter with Block Editor.', () => {
describe('Test Autopost for X with Block Editor.', () => {
before(() => {
cy.login();
// Ignore WP 5.2 Synchronous XHR error.
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/e2e/classic-editor.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getRandomText } from "../support/functions";

describe('Test Autoshare for Twitter with Classic Editor.', () => {
describe('Test Autopost for X with Classic Editor.', () => {
before(() => {
cy.login();

Expand Down
4 changes: 2 additions & 2 deletions tests/cypress/e2e/disconnect.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('Admin can disconnect connected Twitter accounts', () => {
describe('Admin can disconnect connected X accounts', () => {
before(() => {
cy.login();
cy.configurePlugin();
Expand All @@ -8,7 +8,7 @@ describe('Admin can disconnect connected Twitter accounts', () => {
cy.login();
});

it('Admin can disconnect connected Twitter accounts', () => {
it('Admin can disconnect connected X accounts', () => {
cy.visit('/wp-admin/options-general.php?page=autoshare-for-twitter');
cy.get('.twitter_accounts #the-list tr').should('be.visible').should('have.length', 2);
cy.get('.column-action a.button').should('be.visible').first().click();
Expand Down
4 changes: 2 additions & 2 deletions tests/cypress/e2e/mutli-accounts.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('Twitter accounts should visible in Autotweet Panel and should respect Autoshare settings', () => {
describe('X accounts should visible in Autotweet Panel and should respect Autoshare settings', () => {
before(() => {
cy.login();
cy.configurePlugin();
Expand All @@ -8,7 +8,7 @@ describe('Twitter accounts should visible in Autotweet Panel and should respect
cy.login();
});

it('Can see Twitter accounts in Block editor', () => {
it('Can see X accounts in Block editor', () => {
//Block editor.
cy.enableEditor('block');
cy.startCreatePost();
Expand Down
2 changes: 1 addition & 1 deletion tests/test-plugin/e2e-test-plugin.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Plugin name: Autoshare for Twitter Cypress Test plugin
* Plugin name: Autopost for X Cypress Test plugin
* Description: Mock the Twitter API requests.
*
* @package autoshare-for-twitter
Expand Down

0 comments on commit bf35aad

Please sign in to comment.