modals
1 month ago
templates
1 month ago
admin.php
1 month ago
connect-oneclick.php
1 month ago
connect.php
2 weeks ago
dashboard-oneclick.php
1 month ago
dashboard.php
1 month ago
oneclick.php
1 month ago
preview-site.php
7 months ago
system-report.php
4 months ago
dashboard.php
171 lines
| 1 | <?php |
| 2 | $settings = new \NitroPack\WordPress\Settings(); |
| 3 | $components = new \NitroPack\WordPress\Settings\Components(); |
| 4 | $notifications = new \NitroPack\WordPress\Notifications\Notifications(); |
| 5 | $conflictingPlugins = \NitroPack\WordPress\ConflictingPlugins::getInstance(); |
| 6 | $conflictingPlugins_list = $conflictingPlugins->nitropack_get_conflicting_plugins(); |
| 7 | if ( $conflictingPlugins_list ) { |
| 8 | require_once NITROPACK_PLUGIN_DIR . 'view/modals/modal-plugin-deactivate.php'; |
| 9 | } |
| 10 | |
| 11 | $notifications->nitropack_display_admin_notices(); |
| 12 | $dismissed_notices = get_option( 'nitropack-dismissed-notices' ); |
| 13 | |
| 14 | $nitro = get_nitropack_sdk(); |
| 15 | if ( ! $nitro ) { |
| 16 | ?> |
| 17 | <div class="card"> |
| 18 | <div class="card-header"> |
| 19 | <h3><?php esc_html_e( 'NitroPack failed to connect correctly', 'nitropack' ); ?> |
| 20 | </h3> |
| 21 | </div> |
| 22 | <div class="card-body"> |
| 23 | <p><?php esc_html_e( 'This usually happens when the plugin is installed and the connection process is started, but for some reason the connection process is not completed.', 'nitropack' ); ?><br> |
| 24 | <?php esc_html_e( 'Please disconnect and re-connect the plugin again and make sure your API key is correct and the site is connected in', 'nitropack' ); ?> |
| 25 | <a href="https://app.nitropack.io/dashboard" target="_blank">https://app.nitropack.io/dashboard</a> |
| 26 | </p> |
| 27 | <p><?php esc_html_e( 'If the issue persists, please contact our support team.', 'nitropack' ); ?></p> |
| 28 | </div> |
| 29 | <div class="card-footer disconnect-container"> |
| 30 | <a class="btn btn-primary" id="disconnect-btn"><?php esc_html_e( 'Disconnect NitroPack', 'nitropack' ); ?></a> |
| 31 | <?php require_once NITROPACK_PLUGIN_DIR . 'view/modals/modal-disconnect.php'; ?> |
| 32 | </div> |
| 33 | </div> |
| 34 | <?php |
| 35 | return; |
| 36 | } |
| 37 | try { |
| 38 | $cache_warmup_stats = $nitro->getApi()->getWarmupStats(); |
| 39 | } catch ( \Exception $e ) { |
| 40 | $cache_warmup_stats = [ 'status' => 0 ]; |
| 41 | } |
| 42 | $cache_warmup_enabled = ! empty( $cache_warmup_stats['status'] ) && $cache_warmup_stats['status'] === 1 ? true : false; |
| 43 | |
| 44 | if ( empty( $dismissed_notices['skip_cache_warmup'] ) && ! $cache_warmup_enabled ) : ?> |
| 45 | <div class="card cache-warmup"> |
| 46 | <div class="progress-wrapper mb-4"> |
| 47 | <div class="progress-bar"> |
| 48 | <div class="progress" style="width: 100%;"></div> |
| 49 | </div> |
| 50 | <div class="step"><?php esc_html_e( 'Step', 'nitropack' ); ?> 3/3</div> |
| 51 | </div> |
| 52 | <div class="card-body"> |
| 53 | <h3><?php esc_html_e( 'Enable proactive optimizations', 'nitropack' ); ?> |
| 54 | </h3> |
| 55 | <p><?php esc_html_e( 'Turn on Cache Warmup so NitroPack can start optimizing your pages immediately, without waiting for traffic. This guarantees a fast site for every visitor right from the start.', 'nitropack' ); ?> |
| 56 | </p> |
| 57 | </div> |
| 58 | <div class="card-footer"> |
| 59 | <button id="enable-cache-warmup" |
| 60 | class="btn btn-primary"><?php esc_html_e( 'Enable Cache Warmup', 'nitropack' ); ?></button> |
| 61 | <a id="skip-cache-warmup" class="btn btn-secondary ml-2"><?php esc_html_e( 'Skip', 'nitropack' ); ?></a> |
| 62 | </div> |
| 63 | </div> |
| 64 | <?php endif; ?> |
| 65 | <div class="grid grid-cols-2 gap-6 grid-col-1-tablet items-start nitropack-dashboard"> |
| 66 | <div class="col-span-1"> |
| 67 | <!-- Go to app Card --> |
| 68 | <div class="card app-card"> |
| 69 | <div class="card-header"> |
| 70 | <h3><?php esc_html_e( 'Customize NitroPack\'s Optimization Settings in Your Account', 'nitropack' ); ?> |
| 71 | </h3> |
| 72 | </div> |
| 73 | <div class="card-body"> |
| 74 | <div class="flex items-center justify-between"> |
| 75 | <div class="text-box"> |
| 76 | <p> |
| 77 | <?php esc_html_e( 'You can further configure how NitroPack\'s optimization behaves through your account.', 'nitropack' ); ?> |
| 78 | </p> |
| 79 | </div> |
| 80 | <?php |
| 81 | function getNitropackDashboardUrl() { |
| 82 | $siteId = nitropack_get_current_site_id(); |
| 83 | $dashboardUrl = 'https://app.nitropack.io/dashboard'; |
| 84 | |
| 85 | if ( $siteId !== null ) { |
| 86 | $dashboardUrl .= '?update_session_website_id=' . urlencode( $siteId ); |
| 87 | } |
| 88 | |
| 89 | return $dashboardUrl; |
| 90 | } |
| 91 | echo $components->render_button( [ 'text' => 'Go to app', 'type' => null, 'classes' => 'btn btn-primary ml-2 flex-shrink-0', 'href' => esc_url( getNitropackDashboardUrl() ), 'attributes' => [ 'target' => '_blank' ] ] ); |
| 92 | ?> |
| 93 | |
| 94 | </div> |
| 95 | </div> |
| 96 | </div> |
| 97 | <!-- Go to app card End --> |
| 98 | <!-- Optimized Pages Card --> |
| 99 | <?php $settings->optimizations->render(); ?> |
| 100 | <!-- Optimized Pages Card End --> |
| 101 | <!-- Optimization Mode Card --> |
| 102 | <?php $settings->optimization_level->render(); ?> |
| 103 | <!-- Optimization Mode Card End --> |
| 104 | <!-- Automated Behavior Card --> |
| 105 | <div class="card card-automated-behavior"> |
| 106 | <div class="card-header"> |
| 107 | <h3><?php esc_html_e( 'Automated Behavior', 'nitropack' ); ?></h3> |
| 108 | </div> |
| 109 | <div class="card-body"> |
| 110 | <div class="options-container"> |
| 111 | <?php $settings->auto_purge->render(); |
| 112 | $settings->cpt_optimization->render(); ?> |
| 113 | </div> |
| 114 | </div> |
| 115 | </div> |
| 116 | <!-- Automated Behavior Card End --> |
| 117 | <!-- Go to app Card --> |
| 118 | <div class="card exclusion-card"> |
| 119 | <div class="card-header"> |
| 120 | <h3><?php esc_html_e( 'Exclusions', 'nitropack' ); ?></h3> |
| 121 | </div> |
| 122 | <div class="card-body"> |
| 123 | <div class="options-container"> |
| 124 | <?php $settings->shortcodes->render(); ?> |
| 125 | </div> |
| 126 | </div> |
| 127 | </div> |
| 128 | <!-- Go to app card End --> |
| 129 | </div> |
| 130 | <div class="col-span-1"> |
| 131 | <!-- Subscription Card --> |
| 132 | <?php $settings->subscription->render(); ?> |
| 133 | |
| 134 | <!-- Subscription Card End --> |
| 135 | <!-- Basic Settings Card --> |
| 136 | <div class="card card-basic-settings"> |
| 137 | <div class="card-header"> |
| 138 | <h3><?php esc_html_e( 'Basic Settings', 'nitropack' ); ?></h3> |
| 139 | </div> |
| 140 | <div class="card-body"> |
| 141 | <div class="options-container"> |
| 142 | <?php |
| 143 | $settings->cache_warmup->render(); |
| 144 | $settings->test_mode->render(); |
| 145 | $settings->html_compression->render(); |
| 146 | $settings->beaver_builder->render(); |
| 147 | $settings->editor_clear_cache->render(); |
| 148 | if ( class_exists( 'WooCommerce' ) ) { ?> |
| 149 | <?php $settings->cart_cache->render(); ?> |
| 150 | <?php $settings->stock_refresh->render(); |
| 151 | } ?> |
| 152 | </div> |
| 153 | </div> |
| 154 | <div class="card-footer disconnect-container"> |
| 155 | <a class="text-primary btn-link" |
| 156 | id="disconnect-btn"><?php esc_html_e( 'Disconnect NitroPack plugin', 'nitropack' ); ?></a> |
| 157 | <?php require_once NITROPACK_PLUGIN_DIR . 'view/modals/modal-disconnect.php'; ?> |
| 158 | </div> |
| 159 | </div> |
| 160 | <!-- Basic Settings Card End --> |
| 161 | |
| 162 | </div> |
| 163 | <?php $CPTOptimization = NitroPack\WordPress\Settings\CPTOptimization::getInstance(); |
| 164 | $notOptimizedCPTs = $CPTOptimization->nitropack_filter_non_optimized(); |
| 165 | $notices = get_option( 'nitropack-dismissed-notices', [] ); |
| 166 | $optimizedCPT_notice = in_array( 'OptimizeCPT', $notices, true ) ? true : false; |
| 167 | if ( ! $optimizedCPT_notice && ! empty( $notOptimizedCPTs ) ) |
| 168 | require_once NITROPACK_PLUGIN_DIR . 'view/modals/modal-not-optimized-CPT.php'; ?> |
| 169 | |
| 170 | </div> |
| 171 | <?php require_once NITROPACK_PLUGIN_DIR . 'view/modals/modal-unsaved-changes.php'; ?> |