import-history.php
1 year ago
other-plugin-importer.php
1 week ago
page.php
3 months ago
plugin-settings.php
3 months ago
tab-importers.php
3 months ago
tab-status.php
3 months ago
tab-version.php
3 months ago
other-plugin-importer.php
86 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Render Importers |
| 4 | * |
| 5 | * @package AdvancedAds |
| 6 | * @author Advanced Ads <info@wpadvancedads.com> |
| 7 | * @since 1.50.0 |
| 8 | */ |
| 9 | |
| 10 | use AdvancedAds\Framework\Utilities\Params; |
| 11 | |
| 12 | $importers = wp_advads()->importers; |
| 13 | |
| 14 | $count = 0; |
| 15 | $links = []; |
| 16 | $inputs = []; |
| 17 | |
| 18 | foreach ( $importers->get_importers() as $importer ) { |
| 19 | if ( ! $importer->is_detected() ) { |
| 20 | continue; |
| 21 | } |
| 22 | |
| 23 | $tab_id = esc_attr( 'importer-' . $importer->get_id() ); |
| 24 | |
| 25 | $inputs[] = sprintf( |
| 26 | '<input type="radio" id="%1$s" name="other-plugin-importers"%2$s>', |
| 27 | $tab_id, |
| 28 | checked( 0 === $count++, true, false ) |
| 29 | ); |
| 30 | |
| 31 | $links[] = sprintf( |
| 32 | '<label for="%1$s">%2$s<span>%3$s</span></label>', |
| 33 | $tab_id, |
| 34 | $importer->get_icon(), |
| 35 | esc_html( $importer->get_title() ) |
| 36 | ); |
| 37 | } |
| 38 | ?> |
| 39 | <div class="advads-other-plugin-importer mt-8"> |
| 40 | <header> |
| 41 | <h2 class="advads-h2"><?php esc_html_e( 'Other Plugins', 'advanced-ads' ); ?></h2> |
| 42 | <p class="text-sm"><?php esc_html_e( 'To make things even easier, we are working on new ways to import your settings and data from other plugins.', 'advanced-ads' ); ?></p> |
| 43 | </header> |
| 44 | <div class="advads-tabs-wrap"> |
| 45 | <?php echo join( '', $inputs ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 46 | |
| 47 | <div class="advads-tab-nav"> |
| 48 | <?php echo join( '', $links ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 49 | </div> |
| 50 | <?php |
| 51 | foreach ( $importers->get_importers() as $importer ) : |
| 52 | if ( ! $importer->is_detected() ) { |
| 53 | continue; |
| 54 | } |
| 55 | ?> |
| 56 | <form |
| 57 | id="<?php echo esc_attr( $importer->get_id() ); ?>" |
| 58 | class="advads-tab-content" |
| 59 | method="post" |
| 60 | action="<?php echo esc_url( Params::server( 'REQUEST_URI' ) . '#' . $importer->get_id() ); ?>" |
| 61 | > |
| 62 | <?php wp_nonce_field( 'advads_import' ); ?> |
| 63 | <input type="hidden" name="action" value="advads_import"> |
| 64 | <input type="hidden" name="importer" value="<?php echo esc_attr( $importer->get_id() ); ?>"> |
| 65 | |
| 66 | <div class="advads-tab-content-body"> |
| 67 | <?php if ( $importer->get_description() ) : ?> |
| 68 | <p class="text-base"><?php echo esc_html( $importer->get_description() ); ?></p> |
| 69 | <?php endif; ?> |
| 70 | <div class="pt-2"> |
| 71 | <?php $importer->render_form(); ?> |
| 72 | </div> |
| 73 | </div> |
| 74 | |
| 75 | <?php if ( $importer->show_button() ) : ?> |
| 76 | <div class="advads-tab-content-footer"> |
| 77 | <button class="button button-primary button-large" type="submit"> |
| 78 | <?php esc_html_e( 'Start Importing', 'advanced-ads' ); ?> <?php echo esc_html( $importer->get_title() ); ?> |
| 79 | </button> |
| 80 | </div> |
| 81 | <?php endif; ?> |
| 82 | </form> |
| 83 | <?php endforeach; ?> |
| 84 | </div> |
| 85 | </div> |
| 86 |