| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin main page |
| 4 |
* |
| 5 |
* @package Wow_Plugin |
| 6 |
* @subpackage Admin/Main_page |
| 7 |
* @author Dmytro Lobov <i@wpbiker.com> |
| 8 |
* @copyright 2019 Wow-Company |
| 9 |
* @license GNU Public License |
| 10 |
* @version 1.0 |
| 11 |
*/ |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) { |
| 14 |
exit; |
| 15 |
} |
| 16 |
|
| 17 |
require_once 'tools-data-base.php'; |
| 18 |
|
| 19 |
$current_tab = ( isset( $_REQUEST["tab"] ) ) ? sanitize_text_field( $_REQUEST["tab"] ) : 'list'; |
| 20 |
|
| 21 |
$tabs = apply_filters( $this->plugin['slug'] . '_tab_menu', array( |
| 22 |
'list' => esc_attr__( 'List', $this->plugin['text'] ), |
| 23 |
'add-new' => esc_attr__( 'Add new', $this->plugin['text'] ), |
| 24 |
'generator' => esc_attr__( 'Icon for menu', $this->plugin['text'] ), |
| 25 |
'extension' => esc_attr__( 'Pro Features', $this->plugin['text'] ), |
| 26 |
'support' => esc_attr__( 'Support', $this->plugin['text'] ), |
| 27 |
'items' => esc_attr__( 'Plugins', $this->plugin['text'] ), |
| 28 |
'rate' => esc_attr__( 'Rate', $this->plugin['text'] ), |
| 29 |
) ); |
| 30 |
|
| 31 |
$rate_url = 'https://wordpress.org/support/plugin/bubble-menu/reviews/#new-post'; |
| 32 |
|
| 33 |
?> |
| 34 |
|
| 35 |
<div class="wrap"> |
| 36 |
<h1 class="wp-heading-inline"><?php echo $this->plugin['name']; ?> |
| 37 |
v. <?php echo $this->plugin['version']; ?></h1> |
| 38 |
<a href="?page=<?php echo $this->plugin['slug']; ?>&tab=add-new" class="page-title-action"> |
| 39 |
<?php esc_attr_e( 'Add New', $this->plugin['text'] ); ?></a> |
| 40 |
<a href="<?php echo $this->url['facebook']; ?>" class="page-title-action" target="_blank">Stay in touch</a> |
| 41 |
<hr class="wp-header-end"> |
| 42 |
|
| 43 |
<div id="wow-message"></div> |
| 44 |
|
| 45 |
<?php |
| 46 |
echo '<h2 class="nav-tab-wrapper">'; |
| 47 |
foreach ( $tabs as $tab => $name ) { |
| 48 |
$class = ( $tab === $current_tab ) ? ' nav-tab-active' : ''; |
| 49 |
if ( $tab == 'add-new' ) { |
| 50 |
$action = ( isset( $_REQUEST["act"] ) ) ? sanitize_text_field( $_REQUEST["act"] ) : ''; |
| 51 |
if ( ! empty( $action ) && $action == 'update' ) { |
| 52 |
echo '<a class="nav-tab' . esc_attr( $class ) . '" href="?page=' . $this->plugin['slug'] . '&tab=' |
| 53 |
. esc_attr( $tab ) . '">' . esc_attr__( 'Update', $this->plugin['prefix'] ) . ' #' |
| 54 |
. absint( $_REQUEST["id"] ) . '</a>'; |
| 55 |
} else { |
| 56 |
echo '<a class="nav-tab' . esc_attr( $class ) . '" href="?page=' . $this->plugin['slug'] . '&tab=' |
| 57 |
. esc_attr( $tab ) . '">' . esc_attr( $name ) . '</a>'; |
| 58 |
} |
| 59 |
} elseif ( $tab === 'rate' ) { |
| 60 |
echo '<a class="nav-tab' . esc_attr( $class ) . '" href="' . esc_url( $rate_url ) . '" target="_blank"><span class="dashicons dashicons-star-filled" style="color:#ffcc01;"></span> ' . esc_attr( $name ) . '</a>'; |
| 61 |
|
| 62 |
} else { |
| 63 |
echo '<a class="nav-tab' . esc_attr( $class ) . '" href="?page=' . $this->plugin['slug'] . '&tab=' |
| 64 |
. esc_attr( $tab ) . '">' . esc_attr( $name ) . '</a>'; |
| 65 |
} |
| 66 |
|
| 67 |
} |
| 68 |
echo '</h2>'; |
| 69 |
$file = apply_filters( $this->plugin['slug'] . '_menu_file', $current_tab ); |
| 70 |
include_once( $file . '.php' ); |
| 71 |
?> |
| 72 |
</div> |
| 73 |
<?php |
| 74 |
|