| @@ -1,82 +1,89 @@ | ||
| 1 | -<?php | |
| 2 | - /** | |
| 3 | - * Plugin main page | |
| 4 | - * | |
| 5 | - * @package Wow Plugin | |
| 6 | - * @copyright Copyright (c) 2018, Dmytro Lobov | |
| 7 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License | |
| 8 | - * @since 1.0 | |
| 9 | - */ | |
| 10 | - | |
| 11 | - if ( ! defined( 'ABSPATH' ) ) exit; | |
| 12 | - | |
| 13 | - require_once plugin_dir_path( __FILE__ ) . 'tools-data-base.php'; | |
| 14 | - | |
| 15 | - $current_tab = ( isset( $_REQUEST["tab"] ) ) ? sanitize_text_field( $_REQUEST["tab"] ) : 'list'; | |
| 16 | - | |
| 17 | - $tabs = apply_filters( 'wp_coder_menu', array( | |
| 18 | - 'list' => __( 'List', 'wpcoder' ), | |
| 19 | - 'add_new' => __( 'Add new', 'wpcoder' ), | |
| 20 | - 'items' => __( 'Items', 'wpcoder' ), | |
| 21 | - 'extension' => __( 'Extension', 'wpcoder' ), | |
| 22 | - 'support' => __( 'Support', 'wpcoder' ), | |
| 23 | - ) ); | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Plugin main page | |
| 4 | + * | |
| 5 | + * @package Wow Plugin | |
| 6 | + * @copyright Copyright (c) 2018, Dmytro Lobov | |
| 7 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License | |
| 8 | + * @since 1.0 | |
| 9 | + */ | |
| 10 | + | |
| 11 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 12 | + exit; | |
| 13 | +} | |
| 14 | + | |
| 15 | +require_once plugin_dir_path( __FILE__ ) . 'tools-data-base.php'; | |
| 16 | + | |
| 17 | +$current_tab = ( isset( $_REQUEST["tab"] ) ) ? sanitize_text_field( $_REQUEST["tab"] ) : 'list'; | |
| 18 | + | |
| 19 | +$tabs = apply_filters( 'wp_coder_menu', array( | |
| 20 | + 'list' => __( 'List', 'wpcoder' ), | |
| 21 | + 'add_new' => __( 'Add new', 'wpcoder' ), | |
| 22 | + 'items' => __( 'CSS & JS Items', 'wpcoder' ), | |
| 23 | + 'extension' => __( 'Extension', 'wpcoder' ), | |
| 24 | + 'support' => __( 'Support', 'wpcoder' ), | |
| 25 | +) ); | |
| 26 | + | |
| 27 | +$rating = 'https://wordpress.org/support/plugin/wp-coder/reviews/?filter=5#new-post'; | |
| 24 | 28 | ?> |
| 25 | 29 | |
| 26 | -<style> | |
| 27 | - .nav-tab-wrapper { | |
| 28 | - margin-bottom: 20px; | |
| 29 | - } | |
| 30 | - .wrap .nav-tab-wrapper .page-title-action { | |
| 31 | - top: 4px; | |
| 32 | - margin-left: 5px; | |
| 33 | -} | |
| 34 | -.wow-facebook::after { | |
| 35 | - font-family: dashicons; | |
| 36 | - content: "\f305"; | |
| 37 | - margin-left: 5px; | |
| 38 | -} | |
| 39 | -.dashicons { | |
| 40 | - color: #e95645; | |
| 41 | - margin-right: 10px; | |
| 42 | -} | |
| 43 | -.ideas { | |
| 44 | - font-size: 14px; | |
| 45 | - font-weight: 600; | |
| 46 | -} | |
| 47 | -</style> | |
| 30 | +<div class="wowp-header"> | |
| 31 | + <div class="wowp-header-wrapper"> | |
| 32 | + <h1 class="wowp-heading-inline"> | |
| 33 | + <img src="<?php echo esc_url( $this->plugin_url ); ?>admin/general/image/logo.png" alt=""> | |
| 34 | + <span><?php echo esc_attr( $this->plugin_name ); ?> | |
| 35 | + <sup> <?php echo esc_attr( $this->plugin_version ); ?></sup></span> | |
| 36 | + </h1> | |
| 37 | + <a href="?page=<?php echo esc_attr($this->plugin_slug); ?>&tab=add_new" class="page-title-action button "> | |
| 38 | + <?php esc_attr_e( 'Add New', 'side-menu' ); ?></a> | |
| 39 | + </div> | |
| 40 | +</div> | |
| 48 | 41 | |
| 49 | 42 | <div class="wrap"> |
| 50 | - <h1 class="wp-heading-inline"><?php echo $this->plugin_name; ?> v. <?php echo $this->plugin_version; ?></h1> | |
| 51 | - <a href="?page=<?php echo $this->plugin_slug; ?>&tab=add_new" class="page-title-action"><?php _e( 'Add New', 'wpcoder' ); ?></a> <a href="https://www.facebook.com/wowaffect/" class="page-title-action wow-facebook" target="_blank">Stay in touch</a> | |
| 52 | - <hr class="wp-header-end"> | |
| 53 | - <p class="ideas"> | |
| 54 | - <span class="dashicons dashicons-megaphone"></span> <?php printf( __( 'We want to hear your Ideas about improving the plugin. <a href="%1$s" target="_blank">Send Message</a>!', $this->plugin_pref ), 'https://wow-estore.com/item/wp-coder-extension/' ); ?> | |
| 55 | - </p> | |
| 43 | + <hr class="wp-header-end"> | |
| 44 | + <?php if ( get_option( 'wp_coder_message' ) != 'read' ) : ?> | |
| 45 | + <div class="notice notice-info is-dismissible wow-plugin-message"> | |
| 46 | + <p class="ideas"> | |
| 47 | + <i class="dashicons dashicons-megaphone"></i>We are constantly trying to improve the plugin and add more | |
| 48 | + useful | |
| 49 | + features to it. Your support and your ideas for improving the plugin are very important to us. <br/> | |
| 50 | + <i class="dashicons dashicons-star-filled"></i>If you like the plugin, please <a | |
| 51 | + href="<?php echo esc_url( $rating ); ?>" target="_blank">leave a review</a> about it | |
| 52 | + at WordPress.org.<br/> | |
| 53 | + <i class="dashicons dashicons-share"></i>Help other users find this plugin and take advantage of it. | |
| 54 | + <b>Share:</b> <span data-share="facebook">Facebook</span>, <span data-share="twitter">Twitter</span>, | |
| 55 | + <span data-share="linkedin">LinkedIn</span>, <span | |
| 56 | + data-share="pinterest">Pinterest</span>, <span data-share="xing">XING</span>, <span | |
| 57 | + data-share="reddit">Reddit</span>, <span data-share="blogger">Blogger</span>, <span | |
| 58 | + data-share="telegram">Telegram</span> | |
| 59 | + </p> | |
| 60 | + <input type="hidden" id="wp-title" value="WP Coder – add custom html, css and js code"> | |
| 61 | + <input type="hidden" id="wp-url" value="https://wordpress.org/plugins/wp-coder/"> | |
| 62 | + </div> | |
| 63 | + <?php endif; ?> | |
| 64 | + | |
| 56 | 65 | <?php |
| 57 | - echo '<h2 class="nav-tab-wrapper">'; | |
| 58 | - foreach ( $tabs as $tab => $name ) { | |
| 59 | - $class = ( $tab === $current_tab ) ? ' nav-tab-active' : ''; | |
| 60 | - if ( $tab == 'add_new' ) { | |
| 61 | - $action = ( isset( $_REQUEST["act"] ) ) ? sanitize_text_field( $_REQUEST["act"] ) : ''; | |
| 62 | - if ( !empty( $action ) && $action == 'update' ) { | |
| 63 | - echo '<a class="nav-tab' .esc_attr( $class ) . '" href="?page=' . $this->plugin_slug . '&tab=' . esc_attr( $tab ) . '">' . __( 'Update', 'leadgeneration' ) . ' #' . absint( $_REQUEST["id"] ) . '</a>'; | |
| 64 | - } | |
| 65 | - else { | |
| 66 | - echo '<a class="nav-tab' .esc_attr( $class ) . '" href="?page=' . $this->plugin_slug . '&tab=' . esc_attr( $tab ) . '">' . esc_attr( $name ) . '</a>'; | |
| 67 | - } | |
| 66 | + echo '<h2 class="nav-tab-wrapper">'; | |
| 67 | + foreach ( $tabs as $tab => $name ) { | |
| 68 | + $class = ( $tab === $current_tab ) ? ' nav-tab-active' : ''; | |
| 69 | + if ( $tab === 'add_new' ) { | |
| 70 | + $action = ( isset( $_REQUEST["act"] ) ) ? sanitize_text_field( $_REQUEST["act"] ) : ''; | |
| 71 | + if ( ! empty( $action ) && $action === 'update' ) { | |
| 72 | + echo '<a class="nav-tab' . esc_attr( $class ) . '" href="?page=' . esc_attr($this->plugin_slug) . '&tab=' . esc_attr( $tab ) . '">' . esc_html__( 'Update', 'leadgeneration' ) . ' #' . absint( $_REQUEST["id"] ) . '</a>'; | |
| 73 | + } else { | |
| 74 | + echo '<a class="nav-tab' . esc_attr( $class ) . '" href="?page=' . esc_attr($this->plugin_slug) . '&tab=' . esc_attr( $tab ) . '">' . esc_attr( $name ) . '</a>'; | |
| 68 | 75 | } |
| 69 | - else { | |
| 70 | - echo '<a class="nav-tab' .esc_attr( $class ) . '" href="?page=' . $this->plugin_slug . '&tab=' . esc_attr( $tab ) . '">' . esc_attr( $name ) . '</a>'; | |
| 71 | - } | |
| 72 | - | |
| 76 | + } else { | |
| 77 | + echo '<a class="nav-tab' . esc_attr( $class ) . '" href="?page=' . esc_attr($this->plugin_slug) . '&tab=' . esc_attr( $tab ) . '">' . esc_attr( $name ) . '</a>'; | |
| 73 | 78 | } |
| 74 | - echo '</h2>'; | |
| 75 | - | |
| 76 | - $file = apply_filters( 'wp_coder_file', $current_tab ); | |
| 77 | - include_once ( $file . '.php' ); | |
| 78 | - | |
| 79 | + | |
| 80 | + } | |
| 81 | + echo '</h2>'; | |
| 82 | + $current_tab = array_key_exists( $current_tab, $tabs ) ? $current_tab : 'list'; | |
| 83 | + $file = apply_filters( 'wp_coder_file', $current_tab ); | |
| 84 | + include_once( $file . '.php' ); | |
| 85 | + | |
| 79 | 86 | ?> |
| 80 | 87 | </div> |
| 81 | 88 | |
| 82 | 89 | |