| @@ -1,81 +1,65 @@ | ||
| 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'; | |
| 1 | +<?php if ( ! defined( 'ABSPATH' ) ) exit; | |
| 2 | + global $wpdb; | |
| 3 | + $data = $wpdb->prefix . "wow_".self::PREF; | |
| 4 | + $info = (isset($_REQUEST["info"])) ? $_REQUEST["info"] : ''; | |
| 5 | + if ($info == "saved") { | |
| 6 | + echo "<div class='updated' id='message'><p><strong>Record Added</strong>.</p></div>"; | |
| 7 | + } | |
| 8 | + if ($info == "update") { | |
| 9 | + echo "<div class='updated' id='message'><p><strong>Record Updated</strong>.</p></div>"; | |
| 10 | + } | |
| 11 | + if ($info == "del") { | |
| 12 | + $delid = $_GET["did"]; | |
| 13 | + $wpdb->query("delete from " . $data . " where id=" . $delid); | |
| 14 | + $file_style = $this->plugindir.'asset/css/style-'.$delid.'.css'; | |
| 15 | + $file_script = $this->plugindir.'asset/js/script-'.$delid.'.js'; | |
| 16 | + if (file_exists($file_style)) { | |
| 17 | + wp_delete_file($file_style); | |
| 18 | + } | |
| 19 | + if (file_exists($file_script)) { | |
| 20 | + wp_delete_file($file_script); | |
| 21 | + } | |
| 22 | + echo "<div class='updated' id='message'><p><strong>Record Deleted</strong>.</p></div>"; | |
| 23 | + } | |
| 24 | + | |
| 25 | + $tool = (isset($_REQUEST["tool"])) ? sanitize_text_field($_REQUEST["tool"]) : 'list'; | |
| 26 | + $tabs = array( | |
| 27 | + 'list' => array('List','fa-list'), | |
| 28 | + 'add' => array('Add new','fa-plus'), | |
| 29 | + 'extension' => array('Extension','fa-arrows-alt'), | |
| 30 | + 'support' => array('Support','fa-life-ring'), | |
| 31 | + 'join_us' => array('Join Us','fa-facebook'), | |
| 32 | + | |
| 33 | + ); | |
| 34 | + | |
| 28 | 35 | ?> |
| 29 | - | |
| 30 | -<div class="wrap"> | |
| 31 | - <h1 class="wp-heading-inline"><?php echo $this->plugin_name; ?> v. <?php echo $this->plugin_version; ?></h1> | |
| 32 | - <a href="?page=<?php echo $this->plugin_slug; ?>&tab=add_new" | |
| 33 | - class="page-title-action"><?php _e( 'Add New', 'wpcoder' ); ?></a> <a href="https://www.facebook.com/wowaffect/" | |
| 34 | - class="page-title-action wow-facebook" | |
| 35 | - target="_blank">Stay in touch</a> | |
| 36 | - <hr class="wp-header-end"> | |
| 37 | - <?php if ( get_option( 'wp_coder_message' ) != 'read' ) : ?> | |
| 38 | - <div class="notice notice-info is-dismissible wow-plugin-message"> | |
| 39 | - <p class="ideas"> | |
| 40 | - <i class="dashicons dashicons-megaphone"></i>We are constantly trying to improve the plugin and add more useful | |
| 41 | - features to it. Your support and your ideas for improving the plugin are very important to us. <br/> | |
| 42 | - <i class="dashicons dashicons-star-filled"></i>If you like the plugin, please <a href="<?php echo esc_url( $rating ); ?>" | |
| 43 | - target="_blank">leave a review</a> about it | |
| 44 | - at WordPress.org.<br/> | |
| 45 | - <i class="dashicons dashicons-share"></i>Help other users find this plugin and take advantage of it. | |
| 46 | - <b>Share:</b> <span data-share="facebook">Facebook</span>, <span data-share="twitter">Twitter</span>, | |
| 47 | - <span data-share="vk">VK</span>, <span data-share="linkedin">LinkedIn</span>, <span | |
| 48 | - data-share="pinterest">Pinterest</span>, <span data-share="xing">XING</span>, <span | |
| 49 | - data-share="reddit">Reddit</span>, <span data-share="blogger">Blogger</span>, <span | |
| 50 | - data-share="telegram">Telegram</span> | |
| 51 | - </p> | |
| 52 | - <input type="hidden" id="wp-title" value="WP Coder – add custom html, css and js code"> | |
| 53 | - <input type="hidden" id="wp-url" value="https://wordpress.org/plugins/wp-coder/"> | |
| 54 | - </div> | |
| 55 | - <?php endif; ?> | |
| 56 | - | |
| 57 | - <?php | |
| 58 | - echo '<h2 class="nav-tab-wrapper">'; | |
| 59 | - foreach ( $tabs as $tab => $name ) { | |
| 60 | - $class = ( $tab === $current_tab ) ? ' nav-tab-active' : ''; | |
| 61 | - if ( $tab == 'add_new' ) { | |
| 62 | - $action = ( isset( $_REQUEST["act"] ) ) ? sanitize_text_field( $_REQUEST["act"] ) : ''; | |
| 63 | - if ( ! empty( $action ) && $action == 'update' ) { | |
| 64 | - echo '<a class="nav-tab' . esc_attr( $class ) . '" href="?page=' . $this->plugin_slug . '&tab=' . esc_attr( $tab ) . '">' . __( 'Update', 'leadgeneration' ) . ' #' . absint( $_REQUEST["id"] ) . '</a>'; | |
| 65 | - } else { | |
| 66 | - echo '<a class="nav-tab' . esc_attr( $class ) . '" href="?page=' . $this->plugin_slug . '&tab=' . esc_attr( $tab ) . '">' . esc_attr( $name ) . '</a>'; | |
| 36 | +<div class="wow"> | |
| 37 | + <span class="wow-plugin-title"><?php echo $name; ?></span> <span class="wow-plugin-version">(version <?php echo $version; ?>)</span> | |
| 38 | + <?php echo '<ul class="wow-admin-menu">'; | |
| 39 | + foreach( $tabs as $tab => $tab_name ){ | |
| 40 | + $class = ( $tab == $tool ) ? 'active' : ''; | |
| 41 | + echo "<li><a class='$class' href='?page=".$pluginname."&tool=$tab'>$tab_name[0] <i class='fa $tab_name[1]'></i></a></li> "; | |
| 42 | + } | |
| 43 | + echo '</ul>'; | |
| 44 | + echo '<p style="padding-bottom: 5px;margin-bottom:30px;"><span class="dashicons dashicons-star-filled"></span> Please rate <a href="https://wordpress.org/plugins/modal-window/reviews/?rate=5#new-post" target="_blank">us on WordPress.org</a>. With your help our products can become better!</p>'; | |
| 45 | + | |
| 46 | + if( $tool == 'list'){ | |
| 47 | + echo '</div>'; | |
| 48 | + include_once ($tool.'.php'); | |
| 49 | + } | |
| 50 | + elseif($tool == 'extension'){ | |
| 51 | + if(class_exists( 'Coder_Class_Extension' )){ | |
| 52 | + do_action('wp_coder_extension_page'); | |
| 67 | 53 | } |
| 68 | - } else { | |
| 69 | - echo '<a class="nav-tab' . esc_attr( $class ) . '" href="?page=' . $this->plugin_slug . '&tab=' . esc_attr( $tab ) . '">' . esc_attr( $name ) . '</a>'; | |
| 54 | + else { | |
| 55 | + include_once ($tool.'.php'); | |
| 56 | + echo '</div>'; | |
| 57 | + } | |
| 58 | + | |
| 70 | 59 | } |
| 71 | - | |
| 72 | - } | |
| 73 | - echo '</h2>'; | |
| 74 | - $current_tab = array_key_exists( $current_tab, $tabs ) ? $current_tab : 'list'; | |
| 75 | - $file = apply_filters( 'wp_coder_file', $current_tab ); | |
| 76 | - include_once( $file . '.php' ); | |
| 77 | - | |
| 60 | + else { | |
| 61 | + include_once ($tool.'.php'); | |
| 62 | + echo '</div>'; | |
| 63 | + } | |
| 64 | + | |
| 78 | 65 | ?> |
| 79 | -</div> | |
| 80 | - | |
| 81 | - | |