Skip to content

Commit

Permalink
Merge pull request #1 from WordPress/fix/support-for-wp-6-1
Browse files Browse the repository at this point in the history
Add support for WordPress 6.1
  • Loading branch information
zaerl authored Dec 13, 2022
2 parents 1218793 + 0c3ee5f commit a16d69d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 15 deletions.
15 changes: 9 additions & 6 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Contributors: wordpressdotorg, Otto42, dd32, westi, dllh
Tags: tumblr, import
Requires at least: 3.2
Tested up to: 6.0
Stable tag: 0.9
Tested up to: 6.1
Stable tag: 1.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -25,11 +25,14 @@ Imports a Tumblr blog into a WordPress blog.

== Upgrade Notice ==

Version 0.9 Removes untested warning for the plugin.
Version 0.9 Removes untested warning for the plugin.

== Changelog ==

= 0.9 =
= 1.0 =
* Add support for WordPress 6.1.

= 0.9 =
* Force WP_IMPORTING to true during the do_blog_import process.

= 0.8 =
Expand All @@ -55,13 +58,13 @@ Version 0.9 Removes untested warning for the plugin.
* Import Media to server (Images, Audio, Custom uploaded Video's)
* Set the date on Media imports for easier management

= 0.3 =
= 0.3 =
* Handle multi-image posts
* Handle question/answer posts
* Handle video posts somewhat better
* Speedup (reduce importer delay from 3 minutes to 1 minute)

= 0.2 =
= 0.2 =
* The audio, video, and image formats no longer use the caption for the titles. Tumblr seems to facilitate putting all sorts of crazy stuff into the caption fields as part of their reblogging system. So instead, these types of posts will have no titles at all. Sorry, but Tumblr simply doesn't have any sort of title fields here to work with, and no data that can be used to "create" a title for them.
* Minor debug error cleanup.
* Sideloading now done on drafts and pages as well.
Expand Down
34 changes: 25 additions & 9 deletions tumblr-importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Description: Import posts from a Tumblr blog.
Author: wordpressdotorg
Author URI: http://wordpress.org/
Version: 0.9
Version: 1.0
License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
Text Domain: tumblr-importer
Domain Path: /languages
Expand Down Expand Up @@ -58,10 +58,13 @@ function __construct() {

// Figures out what to do, then does it.
function start() {
if ( isset($_POST['restart']) )
if ( isset($_POST['restart']) ) {
$this->restart();
}

if ( !isset($this->error) ) $this->error = null;
if ( !isset($this->error) ) {
$this->error = null;
}

@ $this->consumerkey = defined ('TUMBLR_CONSUMER_KEY') ? TUMBLR_CONSUMER_KEY : ( !empty($_POST['consumerkey']) ? $_POST['consumerkey'] : $this->consumerkey );
@ $this->secretkey = defined ('TUMBLR_SECRET_KEY') ? TUMBLR_SECRET_KEY : ( !empty($_POST['secretkey']) ? $_POST['secretkey'] : $this->secretkey );
Expand All @@ -85,7 +88,11 @@ function start() {

unset ($this->error);

if ( !isset($_POST['restart']) ) $saved = $this->save_vars();
$saved = false;

if ( !isset($_POST['restart']) ) {
$saved = $this->save_vars();
}

if ( $saved && !isset($_GET['noheader']) ) {
?>
Expand All @@ -102,12 +109,16 @@ function start() {
}

function greet($error=null) {

if ( !empty( $error ) )
echo "<div class='error'><p>{$error}</p></div>";
?>

<div class='wrap'><?php echo screen_icon(); ?>
<div class='wrap'>
<?php
if ( version_compare( get_bloginfo( 'version' ), '3.8.0', '<' ) ) {
screen_icon();
}
?>
<h2><?php _e('Import Tumblr', 'tumblr-importer'); ?></h2>
<?php if ( empty($this->request_tokens) ) { ?>
<p><?php _e('Howdy! This importer allows you to import posts from your Tumblr account into your WordPress site.', 'tumblr-importer'); ?></p>
Expand Down Expand Up @@ -214,9 +225,14 @@ function show_blogs($error=null) {
if ( !empty( $error ) )
echo "<div class='error'><p>{$error}</p></div>";

$authors = get_users( array('who' => 'authors') );
$authors = get_users( version_compare( get_bloginfo( 'version' ), '5.9.0', '<' ) ? array( 'who' => 'authors' ) : array( 'capability' => 'edit_posts' ) );
?>
<div class='wrap'>
<?php
if ( version_compare( get_bloginfo( 'version' ), '3.8.0', '<' ) ) {
screen_icon();
}
?>
<div class='wrap'><?php echo screen_icon(); ?>
<h2><?php _e('Import Tumblr', 'tumblr-importer'); ?></h2>
<p><?php _e('Please select the Tumblr blog you would like to import into your WordPress site and then click on the "Import this Blog" button to continue.'); ?></p>
<p><?php _e('If your import gets stuck for a long time or you would like to import from a different Tumblr account instead then click on the "Clear account information" button below to reset the importer.','tumblr-importer'); ?></p>
Expand Down Expand Up @@ -966,7 +982,7 @@ function tumblr_importer_metadata( $_post ) {
* Here we override the default behavior.
*/
function filter_allow_empty_content( $maybe_empty, $_post ) {
if ( 'gallery' == $_post['format'] )
if ( ! empty( $_post['format'] ) && 'gallery' == $_post['format'] )
return false;

return $maybe_empty;
Expand Down

0 comments on commit a16d69d

Please sign in to comment.