class-foogallery-export-view-helper.php
7 months ago
class-foogallery-import-export-extension.php
7 months ago
class-foogallery-import-export.php
7 months ago
class-foogallery-import-view-helper.php
7 months ago
functions.php
7 months ago
view-import-export.php
7 months ago
view-import-export.php
75 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Import / Export view |
| 4 | * |
| 5 | * @package foogallery |
| 6 | */ |
| 7 | |
| 8 | $galleries = foogallery_get_all_galleries(); |
| 9 | $export_helper = new FooGallery_Export_View_Helper(); |
| 10 | $import_helper = new FooGallery_Import_View_Helper(); |
| 11 | ?> |
| 12 | <style> |
| 13 | .foo-nav-tabs a:focus { |
| 14 | -webkit-box-shadow: none; |
| 15 | box-shadow: none; |
| 16 | } |
| 17 | |
| 18 | .foo-nav-container { |
| 19 | margin-top: 10px; |
| 20 | } |
| 21 | |
| 22 | .foogallery-help { |
| 23 | margin-bottom: 10px; |
| 24 | } |
| 25 | </style> |
| 26 | <script> |
| 27 | jQuery(function ($) { |
| 28 | $('.foo-nav-tabs').on('click', 'a', function (e) { |
| 29 | $('.foo-nav-container').hide(); |
| 30 | var tab = $(this).data('tab'); |
| 31 | $('#' + tab).show(); |
| 32 | $('.nav-tab').removeClass('nav-tab-active'); |
| 33 | $(this).addClass('nav-tab-active'); |
| 34 | }); |
| 35 | |
| 36 | if (window.location.hash) { |
| 37 | $('.foo-nav-tabs a[href="' + window.location.hash + '"]').click(); |
| 38 | } |
| 39 | }); |
| 40 | </script> |
| 41 | |
| 42 | <h2><?php esc_html_e( 'FooGallery Import / Export', 'foogallery' ); ?></h2> |
| 43 | |
| 44 | <h2 class="foo-nav-tabs nav-tab-wrapper"> |
| 45 | <a href="#import" data-tab="foogallery_import_galleries" class="nav-tab nav-tab-active"><?php esc_html_e('Import', 'foogallery'); ?></a> |
| 46 | <a href="#export" data-tab="foogallery_export_galleries" class="nav-tab"><?php esc_html_e('Export', 'foogallery'); ?></a> |
| 47 | |
| 48 | |
| 49 | </h2> |
| 50 | |
| 51 | <div class="foo-nav-container" id="foogallery_import_galleries"> |
| 52 | <div class="foogallery-help"> |
| 53 | <?php echo esc_html( __( 'Paste the output from a previous export into the textarea below and click Import.', 'foogallery' ) ); ?> |
| 54 | <br /> |
| 55 | <?php echo esc_html( __( 'Attachments will be imported into the media library, but only if the exported images are publicly available. Galleries with large amounts of images will take a long time to import.', 'foogallery' ) ); ?> |
| 56 | </div> |
| 57 | <?php $import_helper->render_import_form(); ?> |
| 58 | </div> |
| 59 | <div class="foo-nav-container" id="foogallery_export_galleries" style="display: none"> |
| 60 | <?php |
| 61 | if ( ! $galleries ) { |
| 62 | esc_html_e( 'There are no galleries to export!', 'foogallery' ); |
| 63 | } else { ?> |
| 64 | <div class="foogallery-help"> |
| 65 | <?php echo esc_html( __( 'Choose the galleries you want to export and click Export. You can then copy the output and use that to import on another WordPress install.', 'foogallery' ) ); ?> |
| 66 | <br /> |
| 67 | <?php echo esc_html( __( 'If your galleries are loaded from another source, images will not be exported.', 'foogallery' ) ); ?> |
| 68 | <br /> |
| 69 | <?php echo esc_html( __( 'Only images that are publicly accessible will be able to be imported.', 'foogallery' ) ); ?> |
| 70 | </div> |
| 71 | |
| 72 | <?php $export_helper->render_export_form( $galleries ); ?> |
| 73 | <?php } ?> |
| 74 | </div> |
| 75 |