Media from FTP - Version 11.10

Version Description

The import feature has been deprecated. Added an error handler for the registration screen.

Download this release

Release Info

Developer Katsushi Kawamori
Plugin Icon wp plugin Media from FTP
Version 11.10
Comparing to
See all releases

Code changes from version 11.09 to 11.10

inc/class-mediafromftp.php CHANGED
@@ -930,6 +930,8 @@ class MediaFromFtp {
930
  }
931
  if ( 'server' === $dateset || 'exif' === $dateset ) {
932
  $postdategmt = get_gmt_from_date( $new_url_datetime );
 
 
933
  }
934
 
935
  $path_parts = pathinfo( $filename );
@@ -1027,9 +1029,6 @@ class MediaFromFtp {
1027
 
1028
  /* Date Time Regist */
1029
  if ( 'new' <> $dateset ) {
1030
- if ( 'fixed' === $dateset ) {
1031
- $postdategmt = get_gmt_from_date( $datefixed );
1032
- }
1033
  $postdate = get_date_from_gmt( $postdategmt );
1034
  $up_post = array(
1035
  'ID' => $attach_id,
@@ -1456,275 +1455,6 @@ class MediaFromFtp {
1456
 
1457
  }
1458
 
1459
- /** ==================================================
1460
- * Array replace for php < 5.3.0
1461
- *
1462
- * @return array $array
1463
- * @since 9.11
1464
- */
1465
- private function array_replace() {
1466
-
1467
- $array = array();
1468
- $n = func_num_args();
1469
-
1470
- while ( $n-- > 0 ) {
1471
- $array += func_get_arg( $n );
1472
- }
1473
- return $array;
1474
- }
1475
-
1476
-
1477
- /** ==================================================
1478
- * Author select for Media Library Import
1479
- *
1480
- * @param string $filename filename.
1481
- * @return array $authors
1482
- * @since 9.43
1483
- */
1484
- public function author_select( $filename ) {
1485
-
1486
- $scriptname = admin_url( 'admin.php?page=mediafromftp-import' );
1487
-
1488
- $s = @file_get_contents( $filename );
1489
- $control_code = array( "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\x0b", "\x0c", "\x0e", "\x0f" );
1490
- $s = str_replace( $control_code, '', $s );
1491
- if ( @simplexml_load_string( $s ) ) {
1492
- $xml = simplexml_load_string( $s );
1493
- } else {
1494
- return;
1495
- }
1496
-
1497
- $authors = array();
1498
- $namespaces = $xml->getDocNamespaces();
1499
- foreach ( $xml->xpath( '/rss/channel/wp:author' ) as $author_arr ) {
1500
- $a = $author_arr->children( $namespaces['wp'] );
1501
- $authors[] = array(
1502
- 'author_login' => (string) $a->author_login,
1503
- 'author_display_name' => (string) $a->author_display_name,
1504
- );
1505
- }
1506
-
1507
- $form_select = null;
1508
- $count = 0;
1509
- if ( current_user_can( 'manage_options' ) ) {
1510
- $blogusers = get_users();
1511
- foreach ( $authors as $key => $value ) {
1512
- ++$count;
1513
- $form_select .= '<div style="display: block; padding: 5px 10px">' . $count . '.' . __( 'Import author:', 'media-from-ftp' ) . '<strong>' . $value['author_display_name'] . '(' . $value['author_login'] . ')</strong></div>';
1514
- $form_select .= '<div style="display: block; padding: 5px 30px">' . __( 'Assign posts to an existing user:', 'media-from-ftp' ) . '<select name="' . $value['author_login'] . '">';
1515
- $form_select .= '<option value="-1" select>' . __( 'Select' ) . '</option>';
1516
- foreach ( $blogusers as $user ) {
1517
- $form_select .= '<option value="' . $user->ID . '">' . $user->display_name . '(' . $user->user_login . ')</option>';
1518
- }
1519
- $form_select .= '</select></div>';
1520
- }
1521
- $current_user = wp_get_current_user();
1522
- $current_user_html = '<strong>' . $current_user->display_name . '(' . $current_user->user_login . ')</strong>';
1523
- /* translators: Current user */
1524
- $form_select .= '<div style="display: block; padding: 10px 0px">' . sprintf( __( 'If not selected, assign posts to %1$s.', 'media-from-ftp' ), $current_user_html ) . '</div>';
1525
- } else {
1526
- $user = wp_get_current_user();
1527
- foreach ( $authors as $key => $value ) {
1528
- ++$count;
1529
- $form_select .= '<div style="display: block; padding: 5px 10px">' . $count . '.' . __( 'Import author:', 'media-from-ftp' ) . '<strong>' . $value['author_display_name'] . '(' . $value['author_login'] . ')</strong></div>';
1530
- $current_user_html = '<strong>' . $user->display_name . '(' . $user->user_login . ')</strong>';
1531
- /* translators: Current user */
1532
- $form_select .= '<div style="display: block; padding: 5px 30px">' . sprintf( __( 'Assign posts to %1$s', 'media-from-ftp' ), $current_user_html ) . '</div>';
1533
-
1534
- }
1535
- }
1536
- $button_value = get_submit_button( __( 'Apply' ), 'large', 'select_author', false );
1537
- $nonce_field = wp_nonce_field( 'mff_select_author', 'media_from_ftp_select_author' );
1538
-
1539
- $author_form = <<<MEDIAFROMFTP_AUTHOR_SELECT
1540
-
1541
- <!-- BEGIN: Media from FTP Media Library Import -->
1542
- <form method="post" action="$scriptname">
1543
- $nonce_field
1544
- $form_select
1545
- <div style="display: block; padding: 20px 0px">$button_value</div>
1546
- <input type="hidden" name="mediafromftp_select_author" value="1" />
1547
- <input type="hidden" name="mediafromftp_xml_file" value="$filename" />
1548
- </form>
1549
-
1550
- <!-- END: Media from FTP Media Library Import -->
1551
-
1552
- MEDIAFROMFTP_AUTHOR_SELECT;
1553
-
1554
- return $author_form;
1555
-
1556
- }
1557
-
1558
- /** ==================================================
1559
- * Make object for Media Library Import
1560
- *
1561
- * @param string $filename filename.
1562
- * @param array $select_author select_author.
1563
- * @return string $add_js
1564
- * @since 9.40
1565
- */
1566
- public function make_object( $filename, $select_author ) {
1567
-
1568
- $s = @file_get_contents( $filename );
1569
- $control_code = array( "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\x0b", "\x0c", "\x0e", "\x0f" );
1570
- $s = str_replace( $control_code, '', $s );
1571
- $xml = simplexml_load_string( $s );
1572
- $data = array();
1573
- foreach ( $xml->channel->item as $item ) {
1574
- $x = array();
1575
- $x['title'] = (string) $item->title;
1576
- $x['link'] = (string) $item->link;
1577
- $x['pubDate'] = (string) $item->pubDate;
1578
- $x['creator'] = (string) $item->children( 'dc', true )->creator;
1579
- $x['guid'] = (string) $item->guid;
1580
- $x['guid_atr'] = (string) $item->guid->attributes()->isPermaLink;
1581
- $x['description'] = (string) $item->description;
1582
- $x['content_encoded'] = (string) $item->children( 'content', true )->encoded;
1583
- $x['excerpt_encoded'] = (string) $item->children( 'excerpt', true )->encoded;
1584
- $x['post_id'] = (int) $item->children( 'wp', true )->post_id;
1585
- $x['post_date'] = (string) $item->children( 'wp', true )->post_date;
1586
- $x['post_date_gmt'] = (string) $item->children( 'wp', true )->post_date_gmt;
1587
- $x['comment_status'] = (string) $item->children( 'wp', true )->comment_status;
1588
- $x['ping_status'] = (string) $item->children( 'wp', true )->ping_status;
1589
- $x['post_name'] = (string) $item->children( 'wp', true )->post_name;
1590
- $x['status'] = (string) $item->children( 'wp', true )->status;
1591
- $x['post_parent'] = (int) $item->children( 'wp', true )->post_parent;
1592
- $x['menu_order'] = (int) $item->children( 'wp', true )->menu_order;
1593
- $x['post_type'] = (string) $item->children( 'wp', true )->post_type;
1594
- $x['post_password'] = (string) $item->children( 'wp', true )->post_password;
1595
- $x['is_sticky'] = (int) $item->children( 'wp', true )->is_sticky;
1596
- $x['attachment_url'] = (string) $item->children( 'wp', true )->attachment_url;
1597
-
1598
- $postmeta_count = count( $item->children( 'wp', true )->postmeta );
1599
- for ( $i = 0; $i < $postmeta_count; $i++ ) {
1600
- $wp_postmeta_node = $item->children( 'wp', true )->postmeta[ $i ];
1601
- $post_meta_key = (string) $wp_postmeta_node->meta_key;
1602
- $post_meta_value = (string) $wp_postmeta_node->meta_value;
1603
- if ( '_wp_attached_file' === $post_meta_key ) {
1604
- $x['postmeta_wp_attached_file'] = $post_meta_key;
1605
- $x['postmeta_wp_attached_file_value'] = $post_meta_value;
1606
- } else if ( '_thumbnail_id' === $post_meta_key ) {
1607
- $x['postmeta_thumbnail_id'] = $post_meta_key;
1608
- $x['postmeta_thumbnail_id_value'] = $post_meta_value;
1609
- } else if ( '_cover_hash' === $post_meta_key ) {
1610
- $x['postmeta_cover_hash'] = $post_meta_key;
1611
- $x['postmeta_cover_hash_value'] = $post_meta_value;
1612
- } else if ( '_wp_attachment_metadata' === $post_meta_key ) {
1613
- $x['postmeta_wp_attachment_metadata'] = $post_meta_key;
1614
- $x['postmeta_wp_attachment_metadata_value'] = $post_meta_value;
1615
- } else if ( '_wp_attachment_image_alt' === $post_meta_key ) {
1616
- $x['postmeta_wp_attachment_image_alt'] = $post_meta_key;
1617
- $x['postmeta_wp_attachment_image_alt_value'] = $post_meta_value;
1618
- }
1619
- }
1620
-
1621
- $data[] = $x;
1622
- }
1623
-
1624
- $count = 0;
1625
- $file_array = array();
1626
- $db_array = array();
1627
- $db_wp_attachment_metadata_array = array();
1628
- $db_thumbnail_id_array = array();
1629
- $db_cover_hash_array = array();
1630
- $db_wp_attachment_image_alt_array = array();
1631
- foreach ( $data as $key => $value ) {
1632
- if ( 'attachment' === $value['post_type'] ) {
1633
- $file = $this->upload_dir . '/' . $value['postmeta_wp_attached_file_value'];
1634
- $filetype = wp_check_filetype( basename( $file ), null );
1635
-
1636
- $user = wp_get_current_user();
1637
- $loginuser = $user->ID;
1638
- foreach ( $select_author as $authorkey => $authorvalue ) {
1639
- if ( $value['creator'] === $authorkey ) {
1640
- $loginuser = $authorvalue;
1641
- }
1642
- }
1643
-
1644
- $guid = $this->upload_url . '/' . $value['postmeta_wp_attached_file_value'];
1645
- $db_array[ $count ] = array(
1646
- 'ID' => $value['post_id'],
1647
- 'post_author' => $loginuser,
1648
- 'post_date' => $value['post_date'],
1649
- 'post_date_gmt' => $value['post_date_gmt'],
1650
- 'post_content' => $value['content_encoded'],
1651
- 'post_title' => $value['title'],
1652
- 'post_excerpt' => $value['excerpt_encoded'],
1653
- 'post_status' => $value['status'],
1654
- 'comment_status' => $value['comment_status'],
1655
- 'ping_status' => $value['ping_status'],
1656
- 'post_password' => $value['post_password'],
1657
- 'post_name' => $value['post_name'],
1658
- 'post_parent' => $value['post_parent'],
1659
- 'guid' => $guid,
1660
- 'menu_order' => $value['menu_order'],
1661
- 'post_type' => $value['post_type'],
1662
- 'post_mime_type' => $filetype['type'],
1663
- );
1664
-
1665
- $file_array[ $count ] = $file;
1666
-
1667
- if ( array_key_exists( 'postmeta_wp_attachment_metadata_value', $value ) ) {
1668
- $db_wp_attachment_metadata_array[ $count ] = json_encode( $value['postmeta_wp_attachment_metadata_value'] );
1669
- if ( strrpos( $value['postmeta_wp_attached_file_value'], '/' ) ) {
1670
- $monthdir = '/' . substr( $value['postmeta_wp_attached_file_value'], 0, strrpos( $value['postmeta_wp_attached_file_value'], '/' ) );
1671
- $dir = $this->upload_dir . $monthdir;
1672
- }
1673
- $thumbnails = maybe_unserialize( $value['postmeta_wp_attachment_metadata_value'] );
1674
- if ( is_array( $thumbnails ) ) {
1675
- foreach ( $thumbnails as $key1 => $value1 ) {
1676
- if ( is_array( $value1 ) ) {
1677
- foreach ( $value1 as $key2 => $value2 ) {
1678
- if ( is_array( $value2 ) ) {
1679
- foreach ( $value2 as $key3 => $value3 ) {
1680
- if ( 'file' === $key3 ) {
1681
- $thumbnail = $dir . '/' . $value3;
1682
- ++$count;
1683
- $file_array[ $count ] = $thumbnail;
1684
- }
1685
- }
1686
- }
1687
- }
1688
- }
1689
- }
1690
- }
1691
- }
1692
- if ( array_key_exists( 'postmeta_thumbnail_id_value', $value ) ) {
1693
- $db_thumbnail_id_array[ $count ] = $value['postmeta_thumbnail_id_value'];
1694
- }
1695
- if ( array_key_exists( 'postmeta_cover_hash_value', $value ) ) {
1696
- $db_cover_hash_array[ $count ] = $value['postmeta_cover_hash_value'];
1697
- }
1698
- if ( array_key_exists( 'postmeta_wp_attachment_image_alt_value', $value ) ) {
1699
- $db_wp_attachment_image_alt_array[ $count ] = $value['postmeta_wp_attachment_image_alt_value'];
1700
- }
1701
-
1702
- ++$count;
1703
- }
1704
- }
1705
-
1706
- $file_obj = json_encode( $file_array );
1707
- $db_array_obj = json_encode( $db_array );
1708
- $db_wp_attachment_metadata_obj = json_encode( $db_wp_attachment_metadata_array );
1709
- $db_thumbnail_id_obj = json_encode( $db_thumbnail_id_array );
1710
- $db_cover_hash_obj = json_encode( $db_cover_hash_array );
1711
- $db_wp_attachment_image_alt_obj = json_encode( $db_wp_attachment_image_alt_array );
1712
-
1713
- /* JS */
1714
- $add_js = '
1715
- medialibraryimport_maxcount = ' . $count . ';
1716
- medialibraryimport_file = ' . $file_obj . ';
1717
- medialibraryimport_db_array = ' . $db_array_obj . ';
1718
- medialibraryimport_db_wp_attachment_metadata = ' . $db_wp_attachment_metadata_obj . ';
1719
- medialibraryimport_db_thumbnail_id = ' . $db_thumbnail_id_obj . ';
1720
- medialibraryimport_db_cover_hash = ' . $db_cover_hash_obj . ';
1721
- medialibraryimport_db_wp_attachment_image_alt = ' . $db_wp_attachment_image_alt_obj . ';
1722
- ';
1723
-
1724
- return $add_js;
1725
-
1726
- }
1727
-
1728
  }
1729
 
1730
 
930
  }
931
  if ( 'server' === $dateset || 'exif' === $dateset ) {
932
  $postdategmt = get_gmt_from_date( $new_url_datetime );
933
+ } else if ( 'fixed' === $dateset ) {
934
+ $postdategmt = get_gmt_from_date( $datefixed );
935
  }
936
 
937
  $path_parts = pathinfo( $filename );
1029
 
1030
  /* Date Time Regist */
1031
  if ( 'new' <> $dateset ) {
 
 
 
1032
  $postdate = get_date_from_gmt( $postdategmt );
1033
  $up_post = array(
1034
  'ID' => $attach_id,
1455
 
1456
  }
1457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1458
  }
1459
 
1460
 
js/jquery.mediafromftp.js CHANGED
@@ -320,112 +320,5 @@ jQuery(
320
  }
321
  );
322
 
323
- /* Ajax for import */
324
- var medialibraryimport_defer = jQuery.Deferred().resolve();
325
- jQuery( '#medialibraryimport_ajax_update' ).submit(
326
- function(){
327
-
328
- jQuery( "#medialibraryimport-loading-container" ).empty();
329
- jQuery( ".updated" ).remove();
330
- jQuery( ".error" ).remove();
331
-
332
- jQuery( "#medialibraryimport-loading-container" ).append( "<div id=\"medialibraryimport-update-progress\"><progress value=\"0\" max=\"100\"></progress> 0%</div><button type=\"button\" id=\"medialibraryimport_ajax_stop\">Stop</button>" );
333
- jQuery( "#medialibraryimport-loading-container" ).append( "<div id=\"medialibraryimport-update-result\"></div>" );
334
- var update_continue = true;
335
- /* Stop button */
336
- jQuery( "#medialibraryimport_ajax_stop" ).click(
337
- function() {
338
- update_continue = false;
339
- jQuery( "#medialibraryimport_ajax_stop" ).text( "Stopping now.." );
340
- }
341
- );
342
-
343
- var count = 0;
344
- var success_count = 0;
345
- var db_success_count = 0;
346
- var error_count = 0;
347
- var error_update = "";
348
-
349
- jQuery.each(
350
- medialibraryimport_file,
351
- function(i){
352
- var j = i;
353
- medialibraryimport_defer = medialibraryimport_defer.then(
354
- function(){
355
- if ( update_continue == true ) {
356
- return jQuery.ajax(
357
- {
358
- type: 'POST',
359
- cache : false,
360
- url: MEDIAFROMFTPIMPORT.ajax_url,
361
- data: {
362
- 'action': MEDIAFROMFTPIMPORT.action,
363
- 'nonce': MEDIAFROMFTPIMPORT.nonce,
364
- 'maxcount': medialibraryimport_maxcount,
365
- 'file': medialibraryimport_file[j],
366
- 'db_array': medialibraryimport_db_array[j],
367
- 'db_wp_attachment_metadata': medialibraryimport_db_wp_attachment_metadata[j],
368
- 'db_thumbnail_id': medialibraryimport_db_thumbnail_id[j],
369
- 'db_cover_hash': medialibraryimport_db_cover_hash[j],
370
- 'db_wp_attachment_image_alt': medialibraryimport_db_wp_attachment_image_alt[j]
371
- }
372
- }
373
- ).then(
374
- function(result){
375
- count += 1;
376
- var update_view = result.split( "," );
377
- if ( update_view[0] == "success" ) {
378
- success_count += 1;
379
- } else if ( update_view[0] == "success_db" ) {
380
- success_count += 1;
381
- db_success_count += 1;
382
- } else {
383
- /* error_count += 1; */
384
- /* error_update += update_view[0]; */
385
- success_count += 1;
386
- db_success_count += 1;
387
- }
388
- jQuery( "#medialibraryimport-update-progress" ).empty();
389
- var progressper = Math.round( (count / medialibraryimport_maxcount) * 100 );
390
- jQuery( "#medialibraryimport-update-progress" ).append( "<progress value=\"" + progressper + "\" max=\"100\"></progress> " + progressper + "%" );
391
- jQuery( "#medialibraryimport-update-result" ).append( update_view[1] );
392
- if ( count == medialibraryimport_maxcount || update_continue == false ) {
393
- jQuery.ajax(
394
- {
395
- type: 'POST',
396
- url: MEDIAFROMFTPIMPORTMESSAGE.ajax_url,
397
- data: {
398
- 'action': MEDIAFROMFTPIMPORTMESSAGE.action,
399
- 'nonce': MEDIAFROMFTPIMPORTMESSAGE.nonce,
400
- 'error_count': error_count,
401
- 'error_update': error_update,
402
- 'success_count': success_count,
403
- 'db_success_count': db_success_count
404
- }
405
- }
406
- ).done(
407
- function(result){
408
- jQuery( "#medialibraryimport-update-progress" ).empty();
409
- jQuery( "#medialibraryimport-update-progress" ).append( result );
410
- jQuery( "#medialibraryimport_ajax_stop" ).hide();
411
- }
412
- );
413
- }
414
- }
415
- ).fail(
416
- function( jqXHR, textStatus, errorThrown){
417
- error_count += 1;
418
- error_update += "<div>" + medialibraryimport_file[j] + ": error -> status " + jqXHR.status + ' ' + textStatus.status + "</div>";
419
- }
420
- );
421
- }
422
- }
423
- );
424
- }
425
- );
426
- return false;
427
- }
428
- );
429
-
430
  }
431
  );
320
  }
321
  );
322
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
323
  }
324
  );
mediafromftp.php CHANGED
@@ -3,7 +3,7 @@
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.09
7
  * Author: Katsushi Kawamori
8
  * Author URI: https://riverforest-wp.info/
9
  * License: GPL2
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.10
7
  * Author: Katsushi Kawamori
8
  * Author URI: https://riverforest-wp.info/
9
  * License: GPL2
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.4
8
- Stable tag: 11.09
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -19,7 +19,6 @@ Register to media library from files that have been uploaded by FTP.
19
  * Change the date/time.
20
  * Work with [DateTimePicker](https://xdsoft.net/jqplugins/datetimepicker/). jQuery plugin select date/time.
21
  * Export the log to a CSV file.
22
- * To Import the files to Media Library from a WordPress export file.
23
  * You can register a large number of files without timeout work with Ajax.
24
  * Sibling plugin -> [Media from ZIP](https://wordpress.org/plugins/media-from-zip/).
25
  * Sibling plugin -> [Moving Media Library](https://wordpress.org/plugins/moving-media-library/).
@@ -130,11 +129,13 @@ Password: live789user
130
  5. Registration file selection
131
  6. File registration result
132
  7. Log screen
133
- 8. Import File Load
134
- 9. Import result
135
 
136
  == Changelog ==
137
 
 
 
 
 
138
  = 11.09 =
139
  A dedicated notification bar has been added.
140
  Fixed a problem of target="_blank".
5
  Requires at least: 3.6.0
6
  Requires PHP: 5.6
7
  Tested up to: 5.4
8
+ Stable tag: 11.10
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
19
  * Change the date/time.
20
  * Work with [DateTimePicker](https://xdsoft.net/jqplugins/datetimepicker/). jQuery plugin select date/time.
21
  * Export the log to a CSV file.
 
22
  * You can register a large number of files without timeout work with Ajax.
23
  * Sibling plugin -> [Media from ZIP](https://wordpress.org/plugins/media-from-zip/).
24
  * Sibling plugin -> [Moving Media Library](https://wordpress.org/plugins/moving-media-library/).
129
  5. Registration file selection
130
  6. File registration result
131
  7. Log screen
 
 
132
 
133
  == Changelog ==
134
 
135
+ = 11.10 =
136
+ The import feature has been deprecated.
137
+ Added an error handler for the registration screen.
138
+
139
  = 11.09 =
140
  A dedicated notification bar has been added.
141
  Fixed a problem of target="_blank".
req/class-mediafromftpadmin.php CHANGED
@@ -21,9 +21,6 @@
21
  */
22
 
23
  $mediafromftpadmin = new MediaFromFtpAdmin();
24
- add_filter( 'plugin_action_links', array( $mediafromftpadmin, 'settings_link' ), 10, 2 );
25
- add_action( 'admin_footer', array( $mediafromftpadmin, 'custom_bulk_admin_footer' ) );
26
- add_action( 'admin_notices', array( $mediafromftpadmin, 'notices' ) );
27
 
28
  /** ==================================================
29
  * Management screen
@@ -146,9 +143,11 @@ class MediaFromFtpAdmin {
146
  'wpcron' => $wpcron_active,
147
  );
148
 
 
 
 
149
  add_action( 'admin_menu', array( $this, 'add_pages' ) );
150
  add_action( 'admin_enqueue_scripts', array( $this, 'load_custom_wp_admin_style' ) );
151
- add_action( 'admin_footer', array( $this, 'load_custom_wp_admin_style2' ) );
152
  add_action( 'screen_settings', array( $this, 'search_register_show_screen_options' ), 10, 2 );
153
  add_filter( 'set-screen-option', array( $this, 'search_register_set_screen_options' ), 11, 3 );
154
  add_filter( 'admin_head', array( $this, 'search_register_help_tab' ) );
@@ -179,7 +178,6 @@ class MediaFromFtpAdmin {
179
  unset( $mediafromftpaddonwpcron );
180
  }
181
  $links[] = '<a href="' . admin_url( 'admin.php?page=mediafromftp-log' ) . '">' . __( 'Log', 'media-from-ftp' ) . '</a>';
182
- $links[] = '<a href="' . admin_url( 'admin.php?page=mediafromftp-import' ) . '">' . __( 'Import' ) . '</a>';
183
  $links[] = '<a href="' . admin_url( 'admin.php?page=mediafromftp-addons' ) . '">' . __( 'Add-Ons', 'media-from-ftp' ) . '</a>';
184
  }
185
  return $links;
@@ -228,14 +226,6 @@ class MediaFromFtpAdmin {
228
  'mediafromftp-log',
229
  array( $this, 'log_page' )
230
  );
231
- add_submenu_page(
232
- 'mediafromftp',
233
- __( 'Import' ),
234
- __( 'Import' ),
235
- 'upload_files',
236
- 'mediafromftp-import',
237
- array( $this, 'medialibrary_import_page' )
238
- );
239
  add_submenu_page(
240
  'mediafromftp',
241
  __( 'Add-Ons', 'media-from-ftp' ),
@@ -299,7 +289,7 @@ class MediaFromFtpAdmin {
299
 
300
  $current_screen = get_current_screen();
301
  $screen_id = $current_screen->id;
302
- if ( 'media-from-ftp_page_mediafromftp-search-register' === $screen_id || 'media-from-ftp_page_mediafromftp-settings' === $screen_id || 'media-from-ftp_page_mediafromftp-event' === $screen_id || 'media-from-ftp_page_mediafromftp-log' === $screen_id || 'media-from-ftp_page_mediafromftp-import' === $screen_id || 'media-from-ftp_page_mediafromftp-addons' === $screen_id ) {
303
 
304
  $current_screen->add_help_tab( $this->get_help_message( $screen_id ) );
305
 
@@ -358,13 +348,6 @@ class MediaFromFtpAdmin {
358
  $outline = '<p>' . __( 'Display history of registration.', 'media-from-ftp' ) . '</p>';
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;
368
  case 'media-from-ftp_page_mediafromftp-addons':
369
  $outline = '<p>' . __( 'This page shows paid add-ons and their summaries.', 'media-from-ftp' ) . '</p>';
370
  $outline .= '<p>' . __( 'You can check whether it is installed or activated.', 'media-from-ftp' ) . '</p>';
@@ -404,9 +387,7 @@ class MediaFromFtpAdmin {
404
 
405
  $handle = 'mediafromftp-ajax-script';
406
  $action1 = 'mediafromftp-update-ajax-action';
407
- $action2 = 'mediafromftp-import-ajax-action';
408
  $action3 = 'mediafromftp_message';
409
- $action4 = 'mediafromftp_medialibraryimport_message';
410
  wp_enqueue_script( $handle, $this->plugin_base_url . '/js/jquery.mediafromftp.js', array( 'jquery' ), '1.00', false );
411
  wp_localize_script(
412
  $handle,
@@ -417,15 +398,6 @@ class MediaFromFtpAdmin {
417
  'nonce' => wp_create_nonce( $action1 ),
418
  )
419
  );
420
- wp_localize_script(
421
- $handle,
422
- 'MEDIAFROMFTPIMPORT',
423
- array(
424
- 'ajax_url' => admin_url( 'admin-ajax.php' ),
425
- 'action' => $action2,
426
- 'nonce' => wp_create_nonce( $action2 ),
427
- )
428
- );
429
  wp_localize_script(
430
  $handle,
431
  'MEDIAFROMFTPMESSAGE',
@@ -435,55 +407,6 @@ class MediaFromFtpAdmin {
435
  'nonce' => wp_create_nonce( $action3 ),
436
  )
437
  );
438
- wp_localize_script(
439
- $handle,
440
- 'MEDIAFROMFTPIMPORTMESSAGE',
441
- array(
442
- 'ajax_url' => admin_url( 'admin-ajax.php' ),
443
- 'action' => $action4,
444
- 'nonce' => wp_create_nonce( $action4 ),
445
- )
446
- );
447
- }
448
- }
449
-
450
- /** ==================================================
451
- * Add Script on footer
452
- *
453
- * @since 1.0
454
- */
455
- public function load_custom_wp_admin_style2() {
456
- if ( $this->is_my_plugin_screen2() ) {
457
- if ( isset( $_POST['media_from_ftp_select_author'] ) && ! empty( $_POST['media_from_ftp_select_author'] ) ) {
458
- if ( check_admin_referer( 'mff_select_author', 'media_from_ftp_select_author' ) ) {
459
- if ( ! empty( $_POST['mediafromftp_select_author'] ) && ! empty( $_POST['mediafromftp_xml_file'] ) ) {
460
- $filename = sanitize_text_field( wp_unslash( $_POST['mediafromftp_xml_file'] ) );
461
- if ( is_file( $filename ) ) {
462
- $select_author = array();
463
- foreach ( array_keys( $_POST ) as $key ) {
464
- if ( 'select_author' === $key || 'mediafromftp_select_author' === $key || 'mediafromftp_xml_file' === $key ) {
465
- /* skip */
466
- $dummy = 0;
467
- } else {
468
- if ( isset( $_POST[ $key ] ) && -1 <> $_POST[ $key ] ) {
469
- $select_author[ $key ] = intval( $_POST[ $key ] );
470
- }
471
- }
472
- }
473
- if ( ! validate_file( $filename ) ) {
474
- $filename = sanitize_text_field( wp_unslash( $_POST['mediafromftp_xml_file'] ) );
475
- $mediafromftp = new MediaFromFtp();
476
- $handle = 'mediafromftp-import-ajax-script';
477
- wp_enqueue_script( 'jquery' );
478
- wp_enqueue_script( $handle, $this->plugin_base_url . '/js/jquery.mediafromftp.js', array( 'jquery' ), '1.00', false );
479
- wp_add_inline_script( $handle, $mediafromftp->make_object( $filename, $select_author ) );
480
- unset( $mediafromftp );
481
- unlink( $filename );
482
- }
483
- }
484
- }
485
- }
486
- }
487
  }
488
  }
489
 
@@ -504,8 +427,6 @@ class MediaFromFtpAdmin {
504
  return true;
505
  } else if ( is_object( $screen ) && 'media-from-ftp_page_mediafromftp-log' === $screen->id ) {
506
  return true;
507
- } else if ( is_object( $screen ) && 'media-from-ftp_page_mediafromftp-import' === $screen->id ) {
508
- return true;
509
  } else if ( is_object( $screen ) && 'media-from-ftp_page_mediafromftp-addons' === $screen->id ) {
510
  return true;
511
  } else {
@@ -513,20 +434,6 @@ class MediaFromFtpAdmin {
513
  }
514
  }
515
 
516
- /** ==================================================
517
- * For only admin style
518
- *
519
- * @since 8.82
520
- */
521
- private function is_my_plugin_screen2() {
522
- $screen = get_current_screen();
523
- if ( is_object( $screen ) && 'media-from-ftp_page_mediafromftp-import' === $screen->id ) {
524
- return true;
525
- } else {
526
- return false;
527
- }
528
- }
529
-
530
  /** ==================================================
531
  * For only admin style
532
  *
@@ -571,7 +478,6 @@ class MediaFromFtpAdmin {
571
  }
572
  ?>
573
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-log' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Log', 'media-from-ftp' ); ?></a>
574
- <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-import' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Import' ); ?></a>
575
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-addons' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Add-Ons', 'media-from-ftp' ); ?></a>
576
  </h2>
577
  <div style="clear: both;"></div>
@@ -755,7 +661,6 @@ class MediaFromFtpAdmin {
755
  }
756
  ?>
757
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-log' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Log', 'media-from-ftp' ); ?></a>
758
- <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-import' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Import' ); ?></a>
759
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-addons' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Add-Ons', 'media-from-ftp' ); ?></a>
760
  </h2>
761
  <div style="clear: both;"></div>
@@ -1176,7 +1081,6 @@ class MediaFromFtpAdmin {
1176
  }
1177
  ?>
1178
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-log' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Log', 'media-from-ftp' ); ?></a>
1179
- <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-import' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Import' ); ?></a>
1180
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-addons' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Add-Ons', 'media-from-ftp' ); ?></a>
1181
  </h2>
1182
  <div style="clear: both;"></div>
@@ -1296,7 +1200,6 @@ class MediaFromFtpAdmin {
1296
  <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>
1297
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-settings' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Settings' ); ?></a>
1298
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-log' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Log', 'media-from-ftp' ); ?></a>
1299
- <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-import' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Import' ); ?></a>
1300
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-addons' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Add-Ons', 'media-from-ftp' ); ?></a>
1301
  </h2>
1302
  <div style="clear: both;"></div>
@@ -1411,7 +1314,6 @@ class MediaFromFtpAdmin {
1411
  unset( $mediafromftpaddonwpcron );
1412
  }
1413
  ?>
1414
- <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-import' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Import' ); ?></a>
1415
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-addons' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Add-Ons', 'media-from-ftp' ); ?></a>
1416
  </h2>
1417
  <div style="clear: both;"></div>
@@ -1637,156 +1539,6 @@ class MediaFromFtpAdmin {
1637
 
1638
  }
1639
 
1640
- /** ==================================================
1641
- * Sub Menu
1642
- *
1643
- * @since 1.00
1644
- */
1645
- public function medialibrary_import_page() {
1646
-
1647
- if ( ! current_user_can( 'upload_files' ) ) {
1648
- wp_die( esc_html__( 'You do not have sufficient permissions to access this page.' ) );
1649
- }
1650
-
1651
- do_action( 'media_from_ftp_notices' );
1652
-
1653
- $scriptname = admin_url( 'admin.php?page=mediafromftp-import' );
1654
-
1655
- ?>
1656
- <div class="wrap">
1657
- <h2>Media from FTP <a href="<?php echo esc_url( $scriptname ); ?>" style="text-decoration: none;"><?php esc_html_e( 'Import' ); ?></a>
1658
- <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>
1659
- <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-settings' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Settings' ); ?></a>
1660
- <?php
1661
- if ( $this->is_add_on_activate['wpcron'] ) {
1662
- $mediafromftpaddonwpcron = new MediaFromFtpAddOnWpcron();
1663
- $mediafromftpaddonwpcron->mediafromftp_event_link_html();
1664
- unset( $mediafromftpaddonwpcron );
1665
- }
1666
- ?>
1667
- <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-log' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Log', 'media-from-ftp' ); ?></a>
1668
- <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-addons' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Add-Ons', 'media-from-ftp' ); ?></a>
1669
- </h2>
1670
- <div style="clear: both;"></div>
1671
-
1672
- <div id="mediafromftp-loading"><img src="<?php echo esc_url( $this->plugin_base_url ) . '/css/loading.gif'; ?>"></div>
1673
- <div id="medialibraryimport-loading-container">
1674
-
1675
- <?php
1676
- if ( isset( $_POST['media_from_ftp_file_load'] ) && ! empty( $_POST['media_from_ftp_file_load'] ) ) {
1677
- if ( check_admin_referer( 'mff_file_load', 'media_from_ftp_file_load' ) ) {
1678
- if ( isset( $_FILES['filename']['name'] ) && ! empty( $_FILES['filename']['name'] ) ) {
1679
- if ( isset( $_FILES['filename']['tmp_name'] ) && ! empty( $_FILES['filename']['tmp_name'] ) &&
1680
- isset( $_FILES['filename']['name'] ) && ! empty( $_FILES['filename']['name'] ) &&
1681
- isset( $_FILES['filename']['type'] ) && ! empty( $_FILES['filename']['type'] ) &&
1682
- isset( $_FILES['filename']['error'] ) ) {
1683
- if ( 0 === intval( wp_unslash( $_FILES['filename']['error'] ) ) ) {
1684
- $filename = sanitize_text_field( wp_unslash( $_FILES['filename']['tmp_name'] ) );
1685
- $org_name = sanitize_file_name( wp_unslash( $_FILES['filename']['name'] ) );
1686
- $mimetype = sanitize_text_field( wp_unslash( $_FILES['filename']['type'] ) );
1687
- $filetype = wp_check_filetype( $org_name, array( 'xml' => $mimetype ) );
1688
- if ( ! $filetype['ext'] && ! current_user_can( 'unfiltered_upload' ) ) {
1689
- echo '<div class="notice notice-error is-dismissible"><ul><li>' . esc_html__( 'Sorry, this file type is not permitted for security reasons.' ) . '</li></ul></div>';
1690
- } else {
1691
- $name = sanitize_file_name( wp_basename( $filename ) );
1692
- move_uploaded_file( $filename, $this->plugin_tmp_dir . '/' . $name );
1693
-
1694
- $mediafromftp = new MediaFromFtp();
1695
-
1696
- $allowed_author_select_html = array(
1697
- 'h4' => array(),
1698
- 'strong' => array(),
1699
- 'div' => array(
1700
- 'style' => array(),
1701
- ),
1702
- 'form' => array(
1703
- 'method' => array(),
1704
- 'action' => array(),
1705
- ),
1706
- 'select' => array(
1707
- 'name' => array(),
1708
- ),
1709
- 'option' => array(
1710
- 'value' => array(),
1711
- 'select' => array(),
1712
- ),
1713
- 'input' => array(
1714
- 'name' => array(),
1715
- 'type' => array(),
1716
- 'size' => array(),
1717
- 'id' => array(),
1718
- 'class' => array(),
1719
- 'value' => array(),
1720
- ),
1721
- );
1722
- $author_select_html = $mediafromftp->author_select( $this->plugin_tmp_dir . '/' . $name );
1723
- if ( $author_select_html ) {
1724
- $author_select_html = '<h4>' . __( 'Assign Authors', 'media-from-ftp' ) . '</h4>' . $author_select_html;
1725
- echo wp_kses( $author_select_html, $allowed_author_select_html );
1726
- } else {
1727
- if ( file_exists( $this->plugin_tmp_dir . '/' . $name ) ) {
1728
- unlink( $this->plugin_tmp_dir . '/' . $name );
1729
- }
1730
- $export_html = '<a style="text-decoration: none;" href="' . admin_url( 'export.php' ) . '">' . __( 'Export' ) . '</a>';
1731
- /* translators: %1$s: Export link */
1732
- 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>';
1733
- ?>
1734
- <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-import' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Continue' ); ?></a>
1735
- <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>
1736
- <?php
1737
- }
1738
- }
1739
- } else {
1740
- echo '<div class="notice notice-error is-dismissible"><ul><li>' . esc_html__( 'No such file exists! Double check the name and try again.' ) . '</li></ul></div>';
1741
- }
1742
- }
1743
- }
1744
- }
1745
- } else if ( isset( $_POST['media_from_ftp_select_author'] ) && ! empty( $_POST['media_from_ftp_select_author'] ) ) {
1746
- if ( check_admin_referer( 'mff_select_author', 'media_from_ftp_select_author' ) ) {
1747
- if ( ! empty( $_POST['mediafromftp_select_author'] ) && ! empty( $_POST['mediafromftp_xml_file'] ) ) {
1748
- if ( validate_file( wp_unslash( $_POST['mediafromftp_xml_file'] ) ) ) {
1749
- echo '<div class="notice notice-error is-dismissible"><ul><li>' . esc_html__( 'No such file exists! Double check the name and try again.' ) . '</li></ul></div>';
1750
- ?>
1751
- <form method="post" action="<?php echo esc_url( $scriptname ); ?>" enctype="multipart/form-data">
1752
- <?php wp_nonce_field( 'mff_file_load', 'media_from_ftp_file_load' ); ?>
1753
- <h4><?php esc_html_e( 'Select File' ); ?>[WordPress eXtended RSS (WXR)(.xml)]</h4>
1754
- <div><input name="filename" type="file" accept="text/xml" size="80" /></div>
1755
- <div>
1756
- <?php submit_button( __( 'File Load', 'media-from-ftp' ), 'large', '', false ); ?>
1757
- </div>
1758
- </form>
1759
- <?php
1760
- } else {
1761
- ?>
1762
- <h4><?php esc_html_e( 'Ready to import. Press the following button to start the import.', 'media-from-ftp' ); ?></h4>
1763
- <form method="post" id="medialibraryimport_ajax_update">
1764
- <?php submit_button( __( 'Import' ), 'primary', '', false ); ?>
1765
- </form>
1766
- <?php
1767
- }
1768
- }
1769
- }
1770
- } else {
1771
- ?>
1772
- <form method="post" action="<?php echo esc_url( $scriptname ); ?>" enctype="multipart/form-data">
1773
- <?php wp_nonce_field( 'mff_file_load', 'media_from_ftp_file_load' ); ?>
1774
- <h4><?php esc_html_e( 'Select File' ); ?>[WordPress eXtended RSS (WXR)(.xml)]</h4>
1775
- <div><input name="filename" type="file" accept="text/xml" size="80" /></div>
1776
- <div>
1777
- <?php submit_button( __( 'File Load', 'media-from-ftp' ), 'large', '', false ); ?>
1778
- </div>
1779
- </form>
1780
- <?php
1781
- }
1782
- ?>
1783
-
1784
- </div>
1785
- </div>
1786
-
1787
- <?php
1788
- }
1789
-
1790
  /** ==================================================
1791
  * Sub Menu
1792
  *
@@ -1816,7 +1568,6 @@ class MediaFromFtpAdmin {
1816
  }
1817
  ?>
1818
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-log' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Log', 'media-from-ftp' ); ?></a>
1819
- <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-import' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Import' ); ?></a>
1820
  </h2>
1821
  <div style="clear: both;"></div>
1822
 
@@ -2284,6 +2035,12 @@ class MediaFromFtpAdmin {
2284
  /* translators: %1$s: message %2$s: media settings %3$s: settings */
2285
  echo '<div class="notice notice-warning is-dismissible"><ul><li>' . wp_kses_post( sprintf( __( '"%1$s" is checked. This is the default setting for the WordPress Media Library. In this setting, the file is moved to month- and year-based folders. If you do not want to move, please uncheck.(%2$s,%3$s)', 'media-from-ftp' ), $html1, $link1, $link2 ) ) . '</li></ul></div>';
2286
  }
 
 
 
 
 
 
2287
  }
2288
  if ( $this->is_my_plugin_screen() ) {
2289
  if ( function_exists( 'extend_media_upload_load_textdomain' ) ) {
@@ -2302,6 +2059,35 @@ class MediaFromFtpAdmin {
2302
 
2303
  }
2304
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2305
  }
2306
 
2307
 
21
  */
22
 
23
  $mediafromftpadmin = new MediaFromFtpAdmin();
 
 
 
24
 
25
  /** ==================================================
26
  * Management screen
143
  'wpcron' => $wpcron_active,
144
  );
145
 
146
+ add_filter( 'plugin_action_links', array( $this, 'settings_link' ), 10, 2 );
147
+ add_action( 'admin_footer', array( $this, 'custom_bulk_admin_footer' ) );
148
+ add_action( 'admin_notices', array( $this, 'notices' ) );
149
  add_action( 'admin_menu', array( $this, 'add_pages' ) );
150
  add_action( 'admin_enqueue_scripts', array( $this, 'load_custom_wp_admin_style' ) );
 
151
  add_action( 'screen_settings', array( $this, 'search_register_show_screen_options' ), 10, 2 );
152
  add_filter( 'set-screen-option', array( $this, 'search_register_set_screen_options' ), 11, 3 );
153
  add_filter( 'admin_head', array( $this, 'search_register_help_tab' ) );
178
  unset( $mediafromftpaddonwpcron );
179
  }
180
  $links[] = '<a href="' . admin_url( 'admin.php?page=mediafromftp-log' ) . '">' . __( 'Log', 'media-from-ftp' ) . '</a>';
 
181
  $links[] = '<a href="' . admin_url( 'admin.php?page=mediafromftp-addons' ) . '">' . __( 'Add-Ons', 'media-from-ftp' ) . '</a>';
182
  }
183
  return $links;
226
  'mediafromftp-log',
227
  array( $this, 'log_page' )
228
  );
 
 
 
 
 
 
 
 
229
  add_submenu_page(
230
  'mediafromftp',
231
  __( 'Add-Ons', 'media-from-ftp' ),
289
 
290
  $current_screen = get_current_screen();
291
  $screen_id = $current_screen->id;
292
+ if ( 'media-from-ftp_page_mediafromftp-search-register' === $screen_id || 'media-from-ftp_page_mediafromftp-settings' === $screen_id || 'media-from-ftp_page_mediafromftp-event' === $screen_id || 'media-from-ftp_page_mediafromftp-log' === $screen_id || 'media-from-ftp_page_mediafromftp-addons' === $screen_id ) {
293
 
294
  $current_screen->add_help_tab( $this->get_help_message( $screen_id ) );
295
 
348
  $outline = '<p>' . __( 'Display history of registration.', 'media-from-ftp' ) . '</p>';
349
  $outline .= '<p>' . __( 'You can export to CSV format.', 'media-from-ftp' ) . '</p>';
350
  break;
 
 
 
 
 
 
 
351
  case 'media-from-ftp_page_mediafromftp-addons':
352
  $outline = '<p>' . __( 'This page shows paid add-ons and their summaries.', 'media-from-ftp' ) . '</p>';
353
  $outline .= '<p>' . __( 'You can check whether it is installed or activated.', 'media-from-ftp' ) . '</p>';
387
 
388
  $handle = 'mediafromftp-ajax-script';
389
  $action1 = 'mediafromftp-update-ajax-action';
 
390
  $action3 = 'mediafromftp_message';
 
391
  wp_enqueue_script( $handle, $this->plugin_base_url . '/js/jquery.mediafromftp.js', array( 'jquery' ), '1.00', false );
392
  wp_localize_script(
393
  $handle,
398
  'nonce' => wp_create_nonce( $action1 ),
399
  )
400
  );
 
 
 
 
 
 
 
 
 
401
  wp_localize_script(
402
  $handle,
403
  'MEDIAFROMFTPMESSAGE',
407
  'nonce' => wp_create_nonce( $action3 ),
408
  )
409
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
410
  }
411
  }
412
 
427
  return true;
428
  } else if ( is_object( $screen ) && 'media-from-ftp_page_mediafromftp-log' === $screen->id ) {
429
  return true;
 
 
430
  } else if ( is_object( $screen ) && 'media-from-ftp_page_mediafromftp-addons' === $screen->id ) {
431
  return true;
432
  } else {
434
  }
435
  }
436
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
437
  /** ==================================================
438
  * For only admin style
439
  *
478
  }
479
  ?>
480
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-log' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Log', 'media-from-ftp' ); ?></a>
 
481
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-addons' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Add-Ons', 'media-from-ftp' ); ?></a>
482
  </h2>
483
  <div style="clear: both;"></div>
661
  }
662
  ?>
663
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-log' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Log', 'media-from-ftp' ); ?></a>
 
664
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-addons' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Add-Ons', 'media-from-ftp' ); ?></a>
665
  </h2>
666
  <div style="clear: both;"></div>
1081
  }
1082
  ?>
1083
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-log' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Log', 'media-from-ftp' ); ?></a>
 
1084
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-addons' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Add-Ons', 'media-from-ftp' ); ?></a>
1085
  </h2>
1086
  <div style="clear: both;"></div>
1200
  <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>
1201
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-settings' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Settings' ); ?></a>
1202
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-log' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Log', 'media-from-ftp' ); ?></a>
 
1203
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-addons' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Add-Ons', 'media-from-ftp' ); ?></a>
1204
  </h2>
1205
  <div style="clear: both;"></div>
1314
  unset( $mediafromftpaddonwpcron );
1315
  }
1316
  ?>
 
1317
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-addons' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Add-Ons', 'media-from-ftp' ); ?></a>
1318
  </h2>
1319
  <div style="clear: both;"></div>
1539
 
1540
  }
1541
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1542
  /** ==================================================
1543
  * Sub Menu
1544
  *
1568
  }
1569
  ?>
1570
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=mediafromftp-log' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Log', 'media-from-ftp' ); ?></a>
 
1571
  </h2>
1572
  <div style="clear: both;"></div>
1573
 
2035
  /* translators: %1$s: message %2$s: media settings %3$s: settings */
2036
  echo '<div class="notice notice-warning is-dismissible"><ul><li>' . wp_kses_post( sprintf( __( '"%1$s" is checked. This is the default setting for the WordPress Media Library. In this setting, the file is moved to month- and year-based folders. If you do not want to move, please uncheck.(%2$s,%3$s)', 'media-from-ftp' ), $html1, $link1, $link2 ) ) . '</li></ul></div>';
2037
  }
2038
+
2039
+ $httpcode = $this->get_status( admin_url( 'admin-ajax.php' ) );
2040
+ if ( 403 == $httpcode ) {
2041
+ /* translators: %1$s: admin-ajax.php */
2042
+ echo '<div class="notice notice-error is-dismissible"><ul><li>' . wp_kses_post( sprintf( __( 'In this condition, cannot update the media. "%1$s" is not available. It is possible that some security measures have restricted "%1$s". Please fix your server settings.', 'media-from-ftp' ), 'admin-ajax.php' ) ) . '</li></ul></div>';
2043
+ }
2044
  }
2045
  if ( $this->is_my_plugin_screen() ) {
2046
  if ( function_exists( 'extend_media_upload_load_textdomain' ) ) {
2059
 
2060
  }
2061
 
2062
+ /** ==================================================
2063
+ * Get status
2064
+ *
2065
+ * @param string $url url.
2066
+ * @return string $httpcode httpcode.
2067
+ * @since 11.10
2068
+ */
2069
+ private function get_status( $url ) {
2070
+
2071
+ $option = [
2072
+ CURLOPT_HEADER => true,
2073
+ CURLOPT_NOBODY => true,
2074
+ CURLOPT_RETURNTRANSFER => true,
2075
+ CURLOPT_TIMEOUT => 3,
2076
+ CURLOPT_SSL_VERIFYPEER => false,
2077
+ ];
2078
+
2079
+ $ch = curl_init( $url );
2080
+ curl_setopt_array( $ch, $option );
2081
+
2082
+ $output = curl_exec( $ch );
2083
+ $httpcode = curl_getinfo( $ch, CURLINFO_RESPONSE_CODE );
2084
+
2085
+ curl_close( $ch );
2086
+
2087
+ return $httpcode;
2088
+
2089
+ }
2090
+
2091
  }
2092
 
2093
 
req/class-mediafromftpajax.php CHANGED
@@ -78,12 +78,8 @@ class MediaFromFtpAjax {
78
 
79
  $action1 = 'mediafromftp-update-ajax-action';
80
  $action3 = 'mediafromftp_message';
81
- $action2 = 'mediafromftp-import-ajax-action';
82
- $action4 = 'mediafromftp_medialibraryimport_message';
83
  add_action( 'wp_ajax_' . $action1, array( $this, 'mediafromftp_update_callback' ) );
84
  add_action( 'wp_ajax_' . $action3, array( $this, 'mediafromftp_message_callback' ) );
85
- add_action( 'wp_ajax_' . $action2, array( $this, 'mediafromftp_medialibraryimport_update_callback' ) );
86
- add_action( 'wp_ajax_' . $action4, array( $this, 'mediafromftp_medialibraryimport_message_callback' ) );
87
 
88
  }
89
 
@@ -273,160 +269,6 @@ class MediaFromFtpAjax {
273
 
274
  }
275
 
276
- /** ==================================================
277
- * Import Files Callback
278
- *
279
- * @since 9.40
280
- */
281
- public function mediafromftp_medialibraryimport_update_callback() {
282
-
283
- $action2 = 'mediafromftp-import-ajax-action';
284
- if ( check_ajax_referer( $action2, 'nonce', false ) ) {
285
- if ( current_user_can( 'upload_files' ) ) {
286
- if ( ! empty( $_POST['file'] ) ) {
287
- $file = sanitize_text_field( wp_unslash( $_POST['file'] ) );
288
- } else {
289
- return;
290
- }
291
- $filepath = str_replace( $this->upload_dir . '/', '', $file );
292
- if ( is_file( $file ) ) {
293
- if ( ! empty( $_POST['db_array'] ) ) {
294
- $db_array = filter_var(
295
- wp_unslash( $_POST['db_array'] ),
296
- FILTER_CALLBACK,
297
- [
298
- 'options' => function( $value ) {
299
- return sanitize_text_field( $value );
300
- },
301
- ]
302
- );
303
- $db_id = intval( $db_array['ID'] );
304
- global $wpdb;
305
- $table_name = $wpdb->prefix . 'posts';
306
- $wpdb->insert( $table_name, $db_array );
307
- update_attached_file( $db_id, $filepath );
308
- if ( ! empty( $_POST['db_wp_attachment_metadata'] ) ) {
309
- $metadata_json = sanitize_text_field( wp_unslash( $_POST['db_wp_attachment_metadata'] ) );
310
- $metadata = json_decode( $metadata_json );
311
- $table_meta_name = $wpdb->prefix . 'postmeta';
312
- $db_meta_array = array(
313
- 'post_id' => $db_id,
314
- 'meta_key' => '_wp_attachment_metadata',
315
- 'meta_value' => $metadata,
316
- );
317
- $wpdb->insert( $table_meta_name, $db_meta_array );
318
- }
319
- if ( ! empty( $_POST['db_thumbnail_id'] ) ) {
320
- update_post_meta( $db_id, '_thumbnail_id', intval( $_POST['db_thumbnail_id'] ) );
321
- }
322
- if ( ! empty( $_POST['db_cover_hash'] ) ) {
323
- update_post_meta( $db_id, '_cover_hash', sanitize_text_field( wp_unslash( $_POST['db_cover_hash'] ) ) );
324
- }
325
- if ( ! empty( $_POST['db_wp_attachment_image_alt'] ) ) {
326
- update_post_meta( $db_id, '_wp_attachment_image_alt', sanitize_text_field( wp_unslash( $_POST['db_wp_attachment_image_alt'] ) ) );
327
- }
328
- $msg = 'success_db';
329
- $output_html = $msg . ',<div>' . __( 'Media' ) . ': <a href="' . get_permalink( $db_id ) . '" target="_blank" rel="noopener noreferrer" style="text-decoration: none; color: green;">' . $this->esc_title( $db_array['post_title'] ) . '</a>: <a href="' . $this->upload_url . '/' . $filepath . '" target="_blank" rel="noopener noreferrer" style="text-decoration: none;">' . $filepath . '</a></div>';
330
- } else {
331
- $msg = 'success';
332
- $output_html = $msg . ',<div>' . __( 'Thumbnail' ) . ': <a href="' . $this->upload_url . '/' . $filepath . '" target="_blank" rel="noopener noreferrer" style="text-decoration: none;">' . $filepath . '</a></div>';
333
- }
334
- } else {
335
- $error_string = __( 'No file!', 'media-from-ftp' );
336
- $msg = '<div>' . $filepath . ': ' . $error_string . '</div>';
337
- $output_html = $msg . ',<div>' . $filepath . '<span style="color: red;"> &#8811; ' . $error_string . '</span></div>';
338
- }
339
-
340
- header( 'Content-type: text/html; charset=UTF-8' );
341
- $allowed_output_html = array(
342
- 'a' => array(
343
- 'href' => array(),
344
- 'target' => array(),
345
- 'rel' => array(),
346
- 'style' => array(),
347
- ),
348
- 'div' => array(),
349
- 'span' => array(
350
- 'class' => array(),
351
- ),
352
- );
353
- echo wp_kses( $output_html, $allowed_output_html );
354
- }
355
- } else {
356
- status_header( '403' );
357
- echo 'Forbidden';
358
- }
359
-
360
- wp_die();
361
-
362
- }
363
-
364
- /** ==================================================
365
- * Import Messages Callback
366
- *
367
- * @since 9.40
368
- */
369
- public function mediafromftp_medialibraryimport_message_callback() {
370
-
371
- $action4 = 'mediafromftp_medialibraryimport_message';
372
- if ( check_ajax_referer( $action4, 'nonce', false ) ) {
373
- $error_count = 0;
374
- $error_update = null;
375
- $success_count = 0;
376
- $db_success_count = 0;
377
- if ( ! empty( $_POST['error_count'] ) ) {
378
- $error_count = intval( $_POST['error_count'] );
379
- }
380
- if ( ! empty( $_POST['error_update'] ) ) {
381
- $error_update = sanitize_text_field( wp_unslash( $_POST['error_update'] ) );
382
- }
383
- if ( ! empty( $_POST['success_count'] ) ) {
384
- $success_count = intval( $_POST['success_count'] );
385
- }
386
- if ( ! empty( $_POST['db_success_count'] ) ) {
387
- $db_success_count = intval( $_POST['db_success_count'] );
388
- }
389
-
390
- $output_html = null;
391
- if ( $error_count > 0 ) {
392
- /* translators: error message */
393
- $error_message = sprintf( __( 'Errored to the registration of %1$d files.', 'media-from-ftp' ), $error_count );
394
- $output_html .= '<div class="notice notice-error is-dismissible"><ul><li><div>' . $error_message . '</div>' . $error_update . '</li></ul></div>';
395
- }
396
- /* translators: success message */
397
- $success_message = sprintf( __( 'Succeeded to the registration of %1$d files and %2$d items for MediaLibrary.', 'media-from-ftp' ), $success_count, $db_success_count );
398
- $output_html .= '<div class="notice notice-success is-dismissible"><ul><li><div>' . $success_message . '</li></ul></div>';
399
-
400
- header( 'Content-type: text/html; charset=UTF-8' );
401
- $allowed_output_html = array(
402
- 'div' => array(
403
- 'class' => array(),
404
- ),
405
- 'ul' => array(),
406
- 'li' => array(),
407
- );
408
- echo wp_kses( $output_html, $allowed_output_html );
409
- }
410
-
411
- wp_die();
412
-
413
- }
414
-
415
- /** ==================================================
416
- * Escape Title
417
- *
418
- * @param string $str str.
419
- * @return string $str
420
- * @since 9.41
421
- */
422
- private function esc_title( $str ) {
423
-
424
- $str = esc_html( $str );
425
- $str = str_replace( ',', '&#44;', $str );
426
-
427
- return $str;
428
- }
429
-
430
  }
431
 
432
 
78
 
79
  $action1 = 'mediafromftp-update-ajax-action';
80
  $action3 = 'mediafromftp_message';
 
 
81
  add_action( 'wp_ajax_' . $action1, array( $this, 'mediafromftp_update_callback' ) );
82
  add_action( 'wp_ajax_' . $action3, array( $this, 'mediafromftp_message_callback' ) );
 
 
83
 
84
  }
85
 
269
 
270
  }
271
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
272
  }
273
 
274
 
req/class-mediafromftpregist.php CHANGED
@@ -332,7 +332,7 @@ class MediaFromFtpRegist {
332
  $page = str_replace( 'media-from-ftp_page_', '', $screen->id );
333
  $scriptname = admin_url( 'admin.php?page=' . $page );
334
  }
335
- if ( 11.08 == get_option( 'mediafromftp_notice' ) ) {
336
  if ( class_exists( 'MovingMediaLibrary' ) ) {
337
  $movingmedialibrary_url = admin_url( 'admin.php?page=movingmedialibrary' );
338
  } else {
@@ -342,7 +342,7 @@ class MediaFromFtpRegist {
342
  $movingmedialibrary_url = admin_url( 'plugin-install.php?tab=plugin-information&plugin=moving-media-library' );
343
  }
344
  }
345
- $import_html = '<strong><a style="text-decoration: none;" href="' . admin_url( 'admin.php?page=mediafromftp-import' ) . '">' . __( 'Import' ) . '</a></strong>';
346
  $allowed_button_html = array(
347
  'input' => array(
348
  'type' => array(),
@@ -352,22 +352,41 @@ class MediaFromFtpRegist {
352
  'value' => array(),
353
  ),
354
  );
355
- ?>
356
- <div class="notice notice-warning is-dismissible"><ul><li>
357
- <form method="post" action="<?php echo esc_url( $scriptname ); ?>">
358
- <?php
359
- wp_nonce_field( 'mff_nt', 'mediafromftp_notice' );
360
- $movingmedialibrary_link = '<strong><a style="text-decoration: none;" href="' . $movingmedialibrary_url . '">Moving Media Library</a></strong>';
361
  $dismiss_button = get_submit_button( __( 'Dismiss' ), 'small', 'Notice_Dismiss', true );
362
- /* translators: %1$s Plugin link %2$s Import link */
363
- echo wp_kses_post( sprintf( __( 'Created a plugin %1$s to move your media library. You can do it with your current %2$s, but it is faster and more accurate.', 'media-from-ftp' ), $movingmedialibrary_link, $import_html ) );
364
- ?>
365
- &nbsp
366
- <?php echo wp_kses( $dismiss_button, $allowed_button_html ); ?>
367
- <input type="hidden" name="notice_update_version" value="11.09">
368
- </form>
369
- </li></ul></div>
370
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
371
  }
372
  }
373
 
332
  $page = str_replace( 'media-from-ftp_page_', '', $screen->id );
333
  $scriptname = admin_url( 'admin.php?page=' . $page );
334
  }
335
+ if ( 11.08 == get_option( 'mediafromftp_notice' ) || 11.09 == get_option( 'mediafromftp_notice' ) ) {
336
  if ( class_exists( 'MovingMediaLibrary' ) ) {
337
  $movingmedialibrary_url = admin_url( 'admin.php?page=movingmedialibrary' );
338
  } else {
342
  $movingmedialibrary_url = admin_url( 'plugin-install.php?tab=plugin-information&plugin=moving-media-library' );
343
  }
344
  }
345
+ $movingmedialibrary_link = '<strong><a style="text-decoration: none;" href="' . $movingmedialibrary_url . '">Moving Media Library</a></strong>';
346
  $allowed_button_html = array(
347
  'input' => array(
348
  'type' => array(),
352
  'value' => array(),
353
  ),
354
  );
 
 
 
 
 
 
355
  $dismiss_button = get_submit_button( __( 'Dismiss' ), 'small', 'Notice_Dismiss', true );
356
+ if ( 11.08 == get_option( 'mediafromftp_notice' ) ) {
357
+ $import_html = '<strong><a style="text-decoration: none;" href="' . admin_url( 'admin.php?page=mediafromftp-import' ) . '">' . __( 'Import' ) . '</a></strong>';
358
+ ?>
359
+ <div class="notice notice-warning is-dismissible"><ul><li>
360
+ <form method="post" action="<?php echo esc_url( $scriptname ); ?>">
361
+ <?php
362
+ wp_nonce_field( 'mff_nt', 'mediafromftp_notice' );
363
+ /* translators: %1$s Plugin link %2$s Import link */
364
+ echo wp_kses_post( sprintf( __( 'Created a plugin %1$s to move your media library. You can do it with your current %2$s, but it is faster and more accurate.', 'media-from-ftp' ), $movingmedialibrary_link, $import_html ) );
365
+ ?>
366
+ &nbsp
367
+ <?php echo wp_kses( $dismiss_button, $allowed_button_html ); ?>
368
+ <input type="hidden" name="notice_update_version" value="11.09">
369
+ </form>
370
+ </li></ul></div>
371
+ <?php
372
+ }
373
+ if ( 11.09 == get_option( 'mediafromftp_notice' ) ) {
374
+ $import_html = '<strong><a style="text-decoration: none;" href="' . admin_url( 'admin.php?page=mediafromftp-import' ) . '">' . __( 'Import' ) . '</a></strong>';
375
+ ?>
376
+ <div class="notice notice-warning is-dismissible"><ul><li>
377
+ <form method="post" action="<?php echo esc_url( $scriptname ); ?>">
378
+ <?php
379
+ wp_nonce_field( 'mff_nt', 'mediafromftp_notice' );
380
+ /* translators: %1$s New plugin link */
381
+ echo wp_kses_post( sprintf( __( 'The import feature has been deprecated. Please use a new plugin %1$s to replace it.', 'media-from-ftp' ), $movingmedialibrary_link ) );
382
+ ?>
383
+ &nbsp
384
+ <?php echo wp_kses( $dismiss_button, $allowed_button_html ); ?>
385
+ <input type="hidden" name="notice_update_version" value="11.10">
386
+ </form>
387
+ </li></ul></div>
388
+ <?php
389
+ }
390
  }
391
  }
392