Version Description
Added error handler for XML import.
Download this release
Release Info
Developer | Katsushi Kawamori |
Plugin | Media from FTP |
Version | 11.05 |
Comparing to | |
See all releases |
Code changes from version 11.04 to 11.05
- inc/class-mediafromftp.php +6 -2
- mediafromftp.php +1 -4
- readme.txt +10 -6
- req/class-mediafromftpadmin.php +34 -18
- uninstall.php +1 -1
inc/class-mediafromftp.php
CHANGED
@@ -445,7 +445,7 @@ class MediaFromFtp {
|
|
445 |
}
|
446 |
}
|
447 |
|
448 |
-
$del_cash_thumb_filename = $this->plugin_tmp_dir . '
|
449 |
foreach ( glob( $del_cash_thumb_filename ) as $val ) {
|
450 |
unlink( $val );
|
451 |
++$del_cash_count;
|
@@ -1484,7 +1484,11 @@ class MediaFromFtp {
|
|
1484 |
$s = @file_get_contents( $filename );
|
1485 |
$control_code = array( "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\x0b", "\x0c", "\x0e", "\x0f" );
|
1486 |
$s = str_replace( $control_code, '', $s );
|
1487 |
-
|
|
|
|
|
|
|
|
|
1488 |
|
1489 |
$authors = array();
|
1490 |
$namespaces = $xml->getDocNamespaces();
|
445 |
}
|
446 |
}
|
447 |
|
448 |
+
$del_cash_thumb_filename = $this->plugin_tmp_dir . '/*';
|
449 |
foreach ( glob( $del_cash_thumb_filename ) as $val ) {
|
450 |
unlink( $val );
|
451 |
++$del_cash_count;
|
1484 |
$s = @file_get_contents( $filename );
|
1485 |
$control_code = array( "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\x0b", "\x0c", "\x0e", "\x0f" );
|
1486 |
$s = str_replace( $control_code, '', $s );
|
1487 |
+
if ( @simplexml_load_string( $s ) ) {
|
1488 |
+
$xml = simplexml_load_string( $s );
|
1489 |
+
} else {
|
1490 |
+
return;
|
1491 |
+
}
|
1492 |
|
1493 |
$authors = array();
|
1494 |
$namespaces = $xml->getDocNamespaces();
|
mediafromftp.php
CHANGED
@@ -3,13 +3,12 @@
|
|
3 |
* Plugin Name: Media from FTP
|
4 |
* Plugin URI: https://wordpress.org/plugins/media-from-ftp/
|
5 |
* Description: Register to media library from files that have been uploaded by FTP.
|
6 |
-
* Version: 11.
|
7 |
* Author: Katsushi Kawamori
|
8 |
* Author URI: https://riverforest-wp.info/
|
9 |
* License: GPL2
|
10 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
* Text Domain: media-from-ftp
|
12 |
-
* Domain Path: /languages
|
13 |
*
|
14 |
* @package Media from FTP
|
15 |
*/
|
@@ -50,5 +49,3 @@ if ( ! class_exists( 'MediaFromFtpAjax' ) ) {
|
|
50 |
require_once( dirname( __FILE__ ) . '/req/class-mediafromftpajax.php' );
|
51 |
}
|
52 |
|
53 |
-
|
54 |
-
|
3 |
* Plugin Name: Media from FTP
|
4 |
* Plugin URI: https://wordpress.org/plugins/media-from-ftp/
|
5 |
* Description: Register to media library from files that have been uploaded by FTP.
|
6 |
+
* Version: 11.05
|
7 |
* Author: Katsushi Kawamori
|
8 |
* Author URI: https://riverforest-wp.info/
|
9 |
* License: GPL2
|
10 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
* Text Domain: media-from-ftp
|
|
|
12 |
*
|
13 |
* @package Media from FTP
|
14 |
*/
|
49 |
require_once( dirname( __FILE__ ) . '/req/class-mediafromftpajax.php' );
|
50 |
}
|
51 |
|
|
|
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: files, ftp, import, media, sync, uploads
|
|
5 |
Requires at least: 3.6.0
|
6 |
Requires PHP: 5.6
|
7 |
Tested up to: 5.3
|
8 |
-
Stable tag: 11.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -35,13 +35,14 @@ Password: live789user
|
|
35 |
* In the media uploader, you may not be able to upload by the environment of server. That's when the files are large. You do not mind the size of the file if FTP.
|
36 |
|
37 |
= Special Thanks! Translator =
|
38 |
-
*
|
39 |
-
*
|
40 |
-
*
|
41 |
-
* Français [Li-An](https://www.echodesplugins.li-an.fr/)
|
42 |
* Italian [ironicmoka](https://profiles.wordpress.org/photoironic/)
|
|
|
43 |
* Russian [khomenkov](https://awesomeprintstudio.com/)
|
44 |
-
*
|
|
|
45 |
|
46 |
== Installation ==
|
47 |
|
@@ -131,6 +132,9 @@ Password: live789user
|
|
131 |
|
132 |
== Changelog ==
|
133 |
|
|
|
|
|
|
|
134 |
= 11.04 =
|
135 |
Fixed problem of help tab.
|
136 |
|
5 |
Requires at least: 3.6.0
|
6 |
Requires PHP: 5.6
|
7 |
Tested up to: 5.3
|
8 |
+
Stable tag: 11.05
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
35 |
* In the media uploader, you may not be able to upload by the environment of server. That's when the files are large. You do not mind the size of the file if FTP.
|
36 |
|
37 |
= Special Thanks! Translator =
|
38 |
+
* French (France) [Li-An](https://www.echodesplugins.li-an.fr/)
|
39 |
+
* German [pixelverbieger](https://www.pixelverbieger.de/)
|
40 |
+
* German (Formal) [transl8or](https://profiles.wordpress.org/transl8or/)
|
|
|
41 |
* Italian [ironicmoka](https://profiles.wordpress.org/photoironic/)
|
42 |
+
* Persian [lusha](https://profiles.wordpress.org/lusha/)
|
43 |
* Russian [khomenkov](https://awesomeprintstudio.com/)
|
44 |
+
* Spanish (Spain) [Yordan Soares](https://www.yordansoar.es/)
|
45 |
+
* Spanish (Venezuela) [Yordan Soares](https://www.yordansoar.es/)
|
46 |
|
47 |
== Installation ==
|
48 |
|
132 |
|
133 |
== Changelog ==
|
134 |
|
135 |
+
= 11.05 =
|
136 |
+
Added error handler for XML import.
|
137 |
+
|
138 |
= 11.04 =
|
139 |
Fixed problem of help tab.
|
140 |
|
req/class-mediafromftpadmin.php
CHANGED
@@ -359,7 +359,9 @@ class MediaFromFtpAdmin {
|
|
359 |
$outline .= '<p>' . __( 'You can export to CSV format.', 'media-from-ftp' ) . '</p>';
|
360 |
break;
|
361 |
case 'media-from-ftp_page_mediafromftp-import':
|
362 |
-
$
|
|
|
|
|
363 |
/* translators: Upload directory */
|
364 |
$outline .= '<p>' . sprintf( __( 'In uploads directory(%1$s), that you need to copy the file to the same state as the import source by FTP.', 'media-from-ftp' ), $upload_dir_html ) . '</p>';
|
365 |
break;
|
@@ -1665,28 +1667,27 @@ class MediaFromFtpAdmin {
|
|
1665 |
if ( isset( $_FILES['filename']['tmp_name'] ) && ! empty( $_FILES['filename']['tmp_name'] ) ) {
|
1666 |
$filename = sanitize_text_field( wp_unslash( $_FILES['filename']['tmp_name'] ) );
|
1667 |
}
|
1668 |
-
$name =
|
1669 |
move_uploaded_file( $filename, $this->plugin_tmp_dir . '/' . $name );
|
1670 |
|
1671 |
$mediafromftp = new MediaFromFtp();
|
1672 |
-
|
1673 |
-
<h4><?php esc_html_e( 'Assign Authors', 'media-from-ftp' ); ?></h4>
|
1674 |
-
<?php
|
1675 |
$allowed_author_select_html = array(
|
1676 |
-
'
|
1677 |
-
'
|
1678 |
-
|
|
|
1679 |
),
|
1680 |
-
'form'
|
1681 |
-
'method'
|
1682 |
-
'action'
|
1683 |
),
|
1684 |
-
'select'
|
1685 |
-
'name'
|
1686 |
),
|
1687 |
-
'option'
|
1688 |
'value' => array(),
|
1689 |
-
'select'
|
1690 |
),
|
1691 |
'input' => array(
|
1692 |
'name' => array(),
|
@@ -1697,7 +1698,22 @@ class MediaFromFtpAdmin {
|
|
1697 |
'value' => array(),
|
1698 |
),
|
1699 |
);
|
1700 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1701 |
}
|
1702 |
}
|
1703 |
} else if ( isset( $_POST['media_from_ftp_select_author'] ) && ! empty( $_POST['media_from_ftp_select_author'] ) ) {
|
@@ -1709,7 +1725,7 @@ class MediaFromFtpAdmin {
|
|
1709 |
<form method="post" action="<?php echo esc_url( $scriptname ); ?>" enctype="multipart/form-data">
|
1710 |
<?php wp_nonce_field( 'mff_file_load', 'media_from_ftp_file_load' ); ?>
|
1711 |
<h4><?php esc_html_e( 'Select File' ); ?>[WordPress eXtended RSS (WXR)(.xml)]</h4>
|
1712 |
-
<div><input name="filename" type="file" size="80" /></div>
|
1713 |
<div>
|
1714 |
<?php submit_button( __( 'File Load', 'media-from-ftp' ), 'large', '', false ); ?>
|
1715 |
</div>
|
@@ -1730,7 +1746,7 @@ class MediaFromFtpAdmin {
|
|
1730 |
<form method="post" action="<?php echo esc_url( $scriptname ); ?>" enctype="multipart/form-data">
|
1731 |
<?php wp_nonce_field( 'mff_file_load', 'media_from_ftp_file_load' ); ?>
|
1732 |
<h4><?php esc_html_e( 'Select File' ); ?>[WordPress eXtended RSS (WXR)(.xml)]</h4>
|
1733 |
-
<div><input name="filename" type="file" size="80" /></div>
|
1734 |
<div>
|
1735 |
<?php submit_button( __( 'File Load', 'media-from-ftp' ), 'large', '', false ); ?>
|
1736 |
</div>
|
359 |
$outline .= '<p>' . __( 'You can export to CSV format.', 'media-from-ftp' ) . '</p>';
|
360 |
break;
|
361 |
case 'media-from-ftp_page_mediafromftp-import':
|
362 |
+
$export_html = '<a style="text-decoration: none;" href="' . admin_url( 'export.php' ) . '">' . __( 'Export' ) . '</a>';
|
363 |
+
/* translators: %1$s: Export link */
|
364 |
+
$outline = '<p>' . sprintf( __( 'To Import the files to Media Library from a WordPress %1$s file.', 'media-from-ftp' ), $export_html ) . '</p>';
|
365 |
/* translators: Upload directory */
|
366 |
$outline .= '<p>' . sprintf( __( 'In uploads directory(%1$s), that you need to copy the file to the same state as the import source by FTP.', 'media-from-ftp' ), $upload_dir_html ) . '</p>';
|
367 |
break;
|
1667 |
if ( isset( $_FILES['filename']['tmp_name'] ) && ! empty( $_FILES['filename']['tmp_name'] ) ) {
|
1668 |
$filename = sanitize_text_field( wp_unslash( $_FILES['filename']['tmp_name'] ) );
|
1669 |
}
|
1670 |
+
$name = wp_basename( $filename );
|
1671 |
move_uploaded_file( $filename, $this->plugin_tmp_dir . '/' . $name );
|
1672 |
|
1673 |
$mediafromftp = new MediaFromFtp();
|
1674 |
+
|
|
|
|
|
1675 |
$allowed_author_select_html = array(
|
1676 |
+
'h4' => array(),
|
1677 |
+
'strong' => array(),
|
1678 |
+
'div' => array(
|
1679 |
+
'style' => array(),
|
1680 |
),
|
1681 |
+
'form' => array(
|
1682 |
+
'method' => array(),
|
1683 |
+
'action' => array(),
|
1684 |
),
|
1685 |
+
'select' => array(
|
1686 |
+
'name' => array(),
|
1687 |
),
|
1688 |
+
'option' => array(
|
1689 |
'value' => array(),
|
1690 |
+
'select' => array(),
|
1691 |
),
|
1692 |
'input' => array(
|
1693 |
'name' => array(),
|
1698 |
'value' => array(),
|
1699 |
),
|
1700 |
);
|
1701 |
+
$author_select_html = $mediafromftp->author_select( $this->plugin_tmp_dir . '/' . $name );
|
1702 |
+
if ( $author_select_html ) {
|
1703 |
+
$author_select_html = '<h4>' . __( 'Assign Authors', 'media-from-ftp' ) . '</h4>' . $author_select_html;
|
1704 |
+
echo wp_kses( $author_select_html, $allowed_author_select_html );
|
1705 |
+
} else {
|
1706 |
+
if ( file_exists( $this->plugin_tmp_dir . '/' . $name ) ) {
|
1707 |
+
unlink( $this->plugin_tmp_dir . '/' . $name );
|
1708 |
+
}
|
1709 |
+
$export_html = '<a style="text-decoration: none;" href="' . admin_url( 'export.php' ) . '">' . __( 'Export' ) . '</a>';
|
1710 |
+
/* translators: %1$s: Export link */
|
1711 |
+
echo '<div class="notice notice-error is-dismissible"><ul><li>' . wp_kses_post( sprintf( __( 'This screen reads the XML file created when exporting media with WordPress %1$s.', 'media-from-ftp' ), $export_html ) ) . '</li></ul></div>';
|
1712 |
+
?>
|
1713 |
+
<a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-import' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Continue' ); ?></a>
|
1714 |
+
<a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-search-register' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Search & Register', 'media-from-ftp' ); ?></a>
|
1715 |
+
<?php
|
1716 |
+
}
|
1717 |
}
|
1718 |
}
|
1719 |
} else if ( isset( $_POST['media_from_ftp_select_author'] ) && ! empty( $_POST['media_from_ftp_select_author'] ) ) {
|
1725 |
<form method="post" action="<?php echo esc_url( $scriptname ); ?>" enctype="multipart/form-data">
|
1726 |
<?php wp_nonce_field( 'mff_file_load', 'media_from_ftp_file_load' ); ?>
|
1727 |
<h4><?php esc_html_e( 'Select File' ); ?>[WordPress eXtended RSS (WXR)(.xml)]</h4>
|
1728 |
+
<div><input name="filename" type="file" accept="text/xml" size="80" /></div>
|
1729 |
<div>
|
1730 |
<?php submit_button( __( 'File Load', 'media-from-ftp' ), 'large', '', false ); ?>
|
1731 |
</div>
|
1746 |
<form method="post" action="<?php echo esc_url( $scriptname ); ?>" enctype="multipart/form-data">
|
1747 |
<?php wp_nonce_field( 'mff_file_load', 'media_from_ftp_file_load' ); ?>
|
1748 |
<h4><?php esc_html_e( 'Select File' ); ?>[WordPress eXtended RSS (WXR)(.xml)]</h4>
|
1749 |
+
<div><input name="filename" type="file" accept="text/xml" size="80" /></div>
|
1750 |
<div>
|
1751 |
<?php submit_button( __( 'File Load', 'media-from-ftp' ), 'large', '', false ); ?>
|
1752 |
</div>
|
uninstall.php
CHANGED
@@ -65,7 +65,7 @@ foreach ( $del_transients as $del_transient ) {
|
|
65 |
delete_transient( $del_cash_thumb_key );
|
66 |
}
|
67 |
}
|
68 |
-
$del_cash_thumb_filename = $tmp_dir . '
|
69 |
foreach ( glob( $del_cash_thumb_filename ) as $val ) {
|
70 |
unlink( $val );
|
71 |
}
|
65 |
delete_transient( $del_cash_thumb_key );
|
66 |
}
|
67 |
}
|
68 |
+
$del_cash_thumb_filename = $tmp_dir . '/*';
|
69 |
foreach ( glob( $del_cash_thumb_filename ) as $val ) {
|
70 |
unlink( $val );
|
71 |
}
|