diff --git a/README.md b/README.md index a28310c..66a1db4 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![Blogger to WordPress Redirection](https://plugins.svn.wordpress.org/blogger-to-wordpress-redirection/assets/banner-772x250.jpg) -* **Contributors:** [rtcamp](http://profiles.wordpress.org/rtcamp), [rahul286](http://profiles.wordpress.org/rahul286), [nitun.lanjewar](http://profiles.wordpress.org/nitun.lanjewar), [rakshit](http://profiles.wordpress.org/rakshit), [saurabhshukla](http://profiles.wordpress.org/saurabhshukla), [faishal](http://profiles.wordpress.org/faishal), [anantshri](http://profiles.wordpress.org/anantshri), [deepaklalwani](https://profiles.wordpress.org/deepaklalwani/), [vaishu.agola27](https://profiles.wordpress.org/vaishuagola27/), [Nikhil Joshua](https://profiles.wordpress.org/nikhiljoshua/), [Pavan Patil](https://profiles.wordpress.org/pavanpatil1/) +* **Contributors:** [rtcamp](http://profiles.wordpress.org/rtcamp), [rahul286](http://profiles.wordpress.org/rahul286), [nitun.lanjewar](http://profiles.wordpress.org/nitun.lanjewar), [rakshit](http://profiles.wordpress.org/rakshit), [saurabhshukla](http://profiles.wordpress.org/saurabhshukla), [faishal](http://profiles.wordpress.org/faishal), [anantshri](http://profiles.wordpress.org/anantshri), [deepaklalwani](https://profiles.wordpress.org/deepaklalwani/), [vaishu.agola27](https://profiles.wordpress.org/vaishuagola27/), [Nikhil Joshua](https://profiles.wordpress.org/nikhiljoshua/), [Pavan Patil](https://profiles.wordpress.org/pavanpatil1/), [Devansh Chaudhary](https://profiles.wordpress.org/devansh2002/) * **License:** [GPL v2 or later](http://www.gnu.org/licenses/gpl-2.0.html) @@ -47,6 +47,13 @@ Use [support forum](https://wordpress.org/support/plugin/blogger-to-wordpress-re ## Changelog +### 2.3.1 + +* Compatible with PHP 8.3 compatibility. +* Compatible with WordPress 6.6 +* Compatible with WordPress VIP. +* Fix redirection issue when using for multiple blogs. + ### 2.3.0 * Blogger to WordPress Redirection 2.3.0 with PHP 8.1 Compatibility. @@ -103,6 +110,13 @@ New features added: ## Upgrade Notice +### 2.3.1 + +* Compatible with PHP 8.3 compatibility. +* Compatible with WordPress 6.6 +* Compatible with WordPress VIP. +* Fix redirection issue when using for multiple blogs. + ### 2.3.0 * Blogger to WordPress Redirection 2.3.0 with PHP 8.1 Compatibility. diff --git a/b2w-redirection.php b/b2w-redirection.php index b4c8402..b1f1fb5 100644 --- a/b2w-redirection.php +++ b/b2w-redirection.php @@ -3,11 +3,11 @@ * Plugin Name: Blogger To WordPress * Plugin URI: https://bloggertowp.org/tutorials/blogger-to-wordpress-redirection-plugin/ * Description: This plugin is useful for setting up 1-to-1 mapping between Blogger.com blog posts and WordPress blog posts. This works nicely for blogs with old subdomain address (e.g. xyz.blogspot.com) which are moved to new custom domain (e.g. xyz.com) - * Version: 2.3.0 + * Version: 2.3.1 * Author: rtCamp * Author URI: https://rtcamp.com/ * Requires at least: 3.2 - * Tested up to: 6.3 + * Tested up to: 6.6 * Text Domain: blogger-to-wordpress-redirection * * @package Blogger_To_WordPress @@ -18,11 +18,13 @@ define( 'RT_B2WR_BLOG_URL', get_bloginfo( 'url' ) ); /** - * Add option to Tools Menu + * Add option to Tools Menu + * + * @return void */ -function rt_blogger_to_wordpress_add_option() { +function rt_blogger_to_wordpress_add_option(): void { - add_management_page( __( 'Blogger To WordPress Redirection', 'blogger-to-wordpress-redirection' ), __( 'Blogger To WordPress Redirection', 'blogger-to-wordpress-redirection' ), 'administrator', 'rt-blogger-to-wordpress-redirection', 'rt_blogger_to_wordpress_administrative_page' ); + add_management_page( __( 'Blogger To WordPress Redirection', 'blogger-to-wordpress-redirection' ), __( 'Blogger To WordPress Redirection', 'blogger-to-wordpress-redirection' ), 'manage_options', 'rt-blogger-to-wordpress-redirection', 'rt_blogger_to_wordpress_administrative_page' ); wp_enqueue_script( 'rt-blogger-to-wordpress-redirection-js', ( RT_B2WR_PLUGIN_URL . 'js/b2w-redirection-ajax.js' ), array( 'jquery', 'postbox' ), filemtime( RT_B2WR_PLUGIN_DIR . 'js/b2w-redirection-ajax.js' ), true ); @@ -39,52 +41,33 @@ function rt_blogger_to_wordpress_add_option() { wp_enqueue_style( 'dashboard' ); } - } add_action( 'admin_menu', 'rt_blogger_to_wordpress_add_option' ); /** * Administrative Page - Begin + * + * @return void */ -function rt_blogger_to_wordpress_administrative_page() { - - require_once RT_B2WR_PLUGIN_DIR . 'templates/settings.php'; - -} - -/** - * Get Configuration, called via AJAX - */ -function rt_b2wr_get_config() { - +function rt_blogger_to_wordpress_administrative_page(): void { global $wpdb; - if ( ! isset( $_POST['nonce'] ) - || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'b2w_admin_nonce' ) - ) { - return; - } - // get all blogger domains, if avaliable. $sql = "SELECT DISTINCT meta_value FROM {$wpdb->postmeta} where meta_key = 'blogger_blog'"; // unprepared sql ok. $results = $wpdb->get_results( $sql ); //phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.PreparedSQL.NotPrepared,WordPress.DB.DirectDatabaseQuery.NoCaching - require_once RT_B2WR_PLUGIN_DIR . 'templates/get-config.php'; - - die(); - + require_once RT_B2WR_PLUGIN_DIR . 'templates/settings.php'; } -add_action( 'wp_ajax_rt_b2wr_get_config', 'rt_b2wr_get_config' ); - - /** - * Redirection Function (!important) + * Redirection Function (!important) + * + * @return void */ -function rt_blogger_to_wordpress_redirection() { +function rt_blogger_to_wordpress_redirection(): void { global $wpdb; @@ -125,22 +108,21 @@ function rt_blogger_to_wordpress_redirection() { // wp redirect ok. wp_redirect( get_permalink( $wpurl[0][0] ) ); // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect - - exit; - } else { - wp_safe_redirect( home_url(), 301 ); exit; } } - + wp_safe_redirect( home_url(), 301 ); + exit(); } add_action( 'init', 'rt_blogger_to_wordpress_redirection' ); /** - * Verify Configuration + * Verify Configuration + * + * @return void */ -function rt_b2wr_verify_config() { +function rt_b2wr_verify_config(): void { global $wpdb; @@ -166,18 +148,24 @@ function rt_b2wr_verify_config() { $blogger_url = 'https://' . $domain_name . $rand_col2[0]->meta_value; $local_url = get_permalink( $rand_post_id ); - require_once RT_B2WR_PLUGIN_DIR . 'templates/verify-config.php'; - + echo wp_json_encode( + array( + 'blogger_url' => esc_url( $blogger_url ), + 'local_url' => esc_url( $local_url ), + ) + ); + die(); - } add_action( 'wp_ajax_rt_b2wr_verify_config', 'rt_b2wr_verify_config' ); /** * Get Latest Feeds - Begin + * + * @return void */ -function rt_get_feeds_from_blogger_to_wp() { +function rt_get_feeds_from_blogger_to_wp(): void { require_once ABSPATH . WPINC . '/feed.php'; @@ -189,24 +177,26 @@ function rt_get_feeds_from_blogger_to_wp() { } require_once RT_B2WR_PLUGIN_DIR . 'templates/feeds.php'; - } /** * Update Notice - Begin + * + * @return void */ -function rt_blogger_to_wordpress_update_notice() { +function rt_blogger_to_wordpress_update_notice(): void { if ( empty( get_option( 'rtb2wr206' ) ) ) { require_once RT_B2WR_PLUGIN_DIR . 'template/update-notice.php'; } - } /** * Hide Notice block + * + * @return void */ -function rt_b2wr_hide_notice_block() { +function rt_b2wr_hide_notice_block(): void { if ( ! isset( $_POST['update_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['update_nonce'] ) ), 'b2w_update_nonce' ) @@ -215,7 +205,6 @@ function rt_b2wr_hide_notice_block() { } update_option( 'rtb2wr206', 'done' ); - } add_action( 'wp_ajax_rt_b2wr_hide_notice_block', 'rt_b2wr_hide_notice_block' ); diff --git a/js/b2w-redirection-ajax.js b/js/b2w-redirection-ajax.js index 41649fc..79b064c 100644 --- a/js/b2w-redirection-ajax.js +++ b/js/b2w-redirection-ajax.js @@ -7,27 +7,12 @@ /** * Gets configuration and appends to dom. * - * @param {String} nonce - * * @returns {void} */ -function rt_start_config( nonce ){ - - if ( jQuery( '#get_config' ).html() != '' ) { - jQuery( '#get_config' ).html( '' ); - } - - jQuery.ajax( - { - url:'admin-ajax.php', - type: 'POST', - data: 'action=rt_b2wr_get_config&nonce=' + nonce, - success: function(result){ - jQuery( '#get_config' ).append( result ); - } - } - ); +function rt_start_config(){ + jQuery( '#get_config' ).show(); } + /** * Generates blogger code * @@ -38,14 +23,15 @@ function rt_start_config( nonce ){ * @returns {void} */ function generate_code( domain_name, curr_domain, nonce){ - + let blogger_code = jQuery( '#blogger-code-textarea' ).val(); + blogger_code = blogger_code.replace( /{{curr_domain}}/g, curr_domain ); + jQuery( '#blogger-code-textarea' ).val( blogger_code ); + jQuery( '#redirection-domain-name-1' ).attr( 'href', domain_name ); + jQuery( '#redirection-domain-name-1' ).text( domain_name ); + jQuery( '#redirection-domain-name-2' ).text( domain_name ); + jQuery( '#check_config' ).attr( 'onClick', 'check_configuration("' + domain_name + '","' + nonce + '")' ); jQuery( '#code_here' ).show(); - var response = jQuery( '#code_here' ).html(); - response = response.replace( /{{curr_domain}}/g, curr_domain ); - response = response.replace( /{{domain_name}}/g, domain_name ); - response = response.replace( /{{nonce}}/g, nonce ); - jQuery( '#code_here' ).html( response ); - + jQuery( '#verify_config' ).hide(); } /** @@ -57,18 +43,18 @@ function generate_code( domain_name, curr_domain, nonce){ * @returns {void} */ function check_configuration( domain_name, nonce ) { - - if ( jQuery( '#verify_config' ).html() != '' ) { - jQuery( '#verify_config' ).html( '' ); - } - jQuery.ajax( { url:'admin-ajax.php', type: 'POST', data: 'action=rt_b2wr_verify_config&dname=' + domain_name + '&config_nonce=' + nonce, success: function(result) { - jQuery( '#verify_config' ).append( result ); + const { blogger_url, local_url } = JSON.parse(result); + jQuery( '#blogger_url' ).attr( 'href', blogger_url ); + jQuery( '#local_url' ).attr( 'href', local_url ); + jQuery( '#blogger_url' ).text( blogger_url ); + jQuery( '#local_url' ).text( local_url ); + jQuery( '#verify_config' ).show(); } } ); diff --git a/languages/blogger-to-wordpress-redirection.pot b/languages/blogger-to-wordpress-redirection.pot new file mode 100644 index 0000000..abf5d70 --- /dev/null +++ b/languages/blogger-to-wordpress-redirection.pot @@ -0,0 +1,249 @@ +# Copyright (C) 2024 rtCamp +# This file is distributed under the same license as the Blogger To WordPress plugin. +msgid "" +msgstr "" +"Project-Id-Version: Blogger To WordPress 2.3.1\n" +"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/blogger-to-wordpress\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"POT-Creation-Date: 2024-07-26T09:06:13+00:00\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"X-Generator: WP-CLI 2.10.0\n" +"X-Domain: blogger-to-wordpress-redirection\n" + +#. Plugin Name of the plugin +#: b2w-redirection.php +msgid "Blogger To WordPress" +msgstr "" + +#. Plugin URI of the plugin +#: b2w-redirection.php +msgid "https://bloggertowp.org/tutorials/blogger-to-wordpress-redirection-plugin/" +msgstr "" + +#. Description of the plugin +#: b2w-redirection.php +msgid "This plugin is useful for setting up 1-to-1 mapping between Blogger.com blog posts and WordPress blog posts. This works nicely for blogs with old subdomain address (e.g. xyz.blogspot.com) which are moved to new custom domain (e.g. xyz.com)" +msgstr "" + +#. Author of the plugin +#: b2w-redirection.php +msgid "rtCamp" +msgstr "" + +#. Author URI of the plugin +#: b2w-redirection.php +msgid "https://rtcamp.com/" +msgstr "" + +#: b2w-redirection.php:27 +msgid "Blogger To WordPress Redirection" +msgstr "" + +#: templates/blogger-code.php:13 +msgid "Generated Code" +msgstr "" + +#: templates/blogger-code.php:16 +msgid "Redirection code for" +msgstr "" + +#: templates/blogger-code.php:20 +msgid "Copy template code generated below and paste them in your Blogger.com template." +msgstr "" + +#: templates/blogger-code.php:20 +msgid "How to do this?" +msgstr "" + +#: templates/blogger-code.php:23 +msgid "Important:" +msgstr "" + +#: templates/blogger-code.php:23 +msgid "Do NOT forget to take a backup of old template code." +msgstr "" + +#: templates/blogger-code.php:120 +msgid "After the redirection setup press" +msgstr "" + +#: templates/blogger-code.php:120 +#: templates/blogger-code.php:124 +msgid "Verify Configuration" +msgstr "" + +#: templates/blogger-code.php:120 +msgid "button below to test your configuration." +msgstr "" + +#: templates/blogger-code.php:120 +msgid "When you press the button it will generate a random link for a post on" +msgstr "" + +#: templates/feeds.php:14 +msgid "No Items" +msgstr "" + +#: templates/feeds.php:22 +msgid "Posted" +msgstr "" + +#: templates/get-config.php:14 +msgid "Sorry… No posts found that were imported from a Blogger.com blog" +msgstr "" + +#: templates/get-config.php:17 +msgid "Import from Blogger.com" +msgstr "" + +#: templates/get-config.php:20 +msgid "first and then \"Start Configuration\"" +msgstr "" + +#: templates/get-config.php:28 +msgid "List of Blogs" +msgstr "" + +#: templates/get-config.php:34 +msgid "We found posts from following Blogger Blog(s) in your current WordPress installation. Click on Get Code button to generate the redirection code for the chosen Blogger blog

" +msgstr "" + +#: templates/get-config.php:57 +msgid "Get Code" +msgstr "" + +#: templates/settings.php:12 +msgid "B2W-Redirection" +msgstr "" + +#: templates/settings.php:13 +msgid "Blogger to WordPress Redirection" +msgstr "" + +#: templates/settings.php:34 +msgid "Please keep this plugin activated for redirection to work." +msgstr "" + +#: templates/settings.php:45 +#: templates/settings.php:57 +msgid "Start Configuration" +msgstr "" + +#: templates/settings.php:50 +msgid "Press \"Start Configuration\" button to generate code for Blogger.com blog" +msgstr "" + +#: templates/settings.php:54 +msgid "Plugin will automatically detect Blogger.com blog from where you have imported." +msgstr "" + +#: templates/settings.php:70 +msgid "Click to toggle" +msgstr "" + +#: templates/settings.php:72 +msgid "Getting Social is Good" +msgstr "" + +#: templates/settings.php:75 +msgid "Become a fan on Facebook" +msgstr "" + +#: templates/settings.php:75 +msgid "Twitter" +msgstr "" + +#: templates/settings.php:76 +msgid "Follow us on Twitter" +msgstr "" + +#: templates/settings.php:76 +msgid "Facebook" +msgstr "" + +#: templates/settings.php:77 +msgid "Subscribe to our feeds" +msgstr "" + +#: templates/settings.php:77 +msgid "RSS Feeds" +msgstr "" + +#: templates/settings.php:82 +#: templates/settings.php:92 +#: templates/settings.php:130 +#: templates/settings.php:150 +msgid "Click to Toggle" +msgstr "" + +#: templates/settings.php:84 +msgid "Join Us on Facebook" +msgstr "" + +#: templates/settings.php:94 +msgid "Promote, Donate, Share..." +msgstr "" + +#: templates/settings.php:98 +msgid "A lot of time and effort goes into the development of this plugin. If you find it useful, please consider making a donation, or a review on your blog or sharing this with your friends to help us." +msgstr "" + +#: templates/settings.php:109 +msgid "PayPal - The safer, easier way to pay online!" +msgstr "" + +#: templates/settings.php:120 +msgid "Blogger to WordPress Redirection Plugin" +msgstr "" + +#: templates/settings.php:120 +msgid "Tweet" +msgstr "" + +#: templates/settings.php:132 +msgid "Free Support" +msgstr "" + +#: templates/settings.php:137 +msgid "If you have any problems with this plugin or good ideas for improvements, please talk about them in the support forums." +msgstr "" + +#: templates/settings.php:152 +msgid "Latest News from Our Blog" +msgstr "" + +#: templates/update-notice.php:13 +msgid "Due to recent updates on blogger.com, Blogger to WordPress Redirection plugin has been rewritten. The process has also changed completely. Please refer the updated instructions here:" +msgstr "" + +#: templates/update-notice.php:15 +msgid "Read more details about this update at Our Blog" +msgstr "" + +#: templates/update-notice.php:15 +msgid "(Read More…)" +msgstr "" + +#: templates/update-notice.php:19 +msgid "Hide this message!" +msgstr "" + +#: templates/verify-config.php:11 +msgid "Test Case" +msgstr "" + +#: templates/verify-config.php:14 +msgid "Clicking this link" +msgstr "" + +#: templates/verify-config.php:20 +msgid "Should redirect to" +msgstr "" + +#: templates/verify-config.php:30 +msgid "If you are stuck, you can use our free support forum or hire us." +msgstr "" diff --git a/readme.txt b/readme.txt index 65d6eb4..a580d09 100644 --- a/readme.txt +++ b/readme.txt @@ -1,9 +1,9 @@ === Blogger To WordPress === -Contributors: rtcamp, rahul286, nitun.lanjewar, rakshit, saurabhshukla, faishal, anantshri, deepaklalwani, vaishu.agola27, nikhiljoshua +Contributors: rtcamp, rahul286, nitun.lanjewar, rakshit, saurabhshukla, faishal, anantshri, deepaklalwani, vaishu.agola27, nikhiljoshua, devansh2002 Tags: Wordpress, Blogger, Traffic, Redirection, Blogspot, Permalink, SEO, rel-canonical, meta-refresh Requires at least: 3.2 -Tested up to: 6.3 -Stable tag: 2.3.0 +Tested up to: 6.6 +Stable tag: 2.3.1 License: GPLv2 or later (of-course) License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -48,6 +48,13 @@ Use [support forum](https://wordpress.org/support/plugin/blogger-to-wordpress-re == Changelog == += 2.3.1 = + +* Compatible with PHP 8.3 compatibility. +* Compatible with WordPress 6.6 +* Compatible with WordPress VIP. +* Fix redirection issue when using for multiple blogs. + = 2.3.0 = * Blogger to WordPress Redirection 2.3.0 with PHP 8.1 compatibility. @@ -104,6 +111,13 @@ New features added: == Upgrade Notice == += 2.3.1 = + +* Compatible with PHP 8.3 compatibility. +* Compatible with WordPress 6.6 +* Compatible with WordPress VIP. +* Fix redirection issue when using for multiple blogs. + = 2.3.0 = * Blogger to WordPress Redirection 2.3.0 with PHP 8.1 compatibility. diff --git a/templates/blogger-code.php b/templates/blogger-code.php index bcd1c25..49b2bca 100644 --- a/templates/blogger-code.php +++ b/templates/blogger-code.php @@ -10,22 +10,22 @@

- Generated Code +

-Redirection code for {{domain_name}} +
-Copy template code generated below and paste them in your Blogger.com template. (How to do this?)
+ ()
- (Important: Do NOT forget to take a backup of old template code.) + ()

-