animations
7 months ago
images
7 months ago
javascript
5 months ago
modals
5 months ago
stylesheet
7 months ago
templates
1 year ago
admin.php
5 months ago
connect-oneclick.php
1 year ago
connect.php
7 months ago
dashboard-oneclick.php
5 months ago
dashboard.php
5 months ago
oneclick.php
7 months ago
preview-site.php
7 months ago
system-report.php
1 year ago
dashboard.php
271 lines
| 1 | <?php |
| 2 | $settings = new \NitroPack\WordPress\Settings(); |
| 3 | $notifications = new \NitroPack\WordPress\Notifications\Notifications(); |
| 4 | |
| 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 | $cache_warmup_stats = $nitro->getApi()->getWarmupStats(); |
| 16 | $cache_warmup_enabled = ! empty( $cache_warmup_stats['status'] ) && $cache_warmup_stats['status'] === 1 ? true : false; |
| 17 | |
| 18 | if ( empty( $dismissed_notices['skip_cache_warmup'] ) && ! $cache_warmup_enabled ) : ?> |
| 19 | <div class="card cache-warmup"> |
| 20 | <div class="progress-wrapper mb-4"> |
| 21 | <div class="progress-bar"> |
| 22 | <div class="progress" style="width: 100%;"></div> |
| 23 | </div> |
| 24 | <div class="step"><?php esc_html_e( 'Step', 'nitropack' ); ?> 3/3</div> |
| 25 | </div> |
| 26 | <div class="card-body"> |
| 27 | <h3><?php esc_html_e( 'Enable proactive optimizations', 'nitropack' ); ?> |
| 28 | </h3> |
| 29 | <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' ); ?> |
| 30 | </p> |
| 31 | </div> |
| 32 | <div class="card-footer"> |
| 33 | <button id="enable-cache-warmup" |
| 34 | class="btn btn-primary"><?php esc_html_e( 'Enable Cache Warmup', 'nitropack' ); ?></button> |
| 35 | <a id="skip-cache-warmup" class="btn btn-secondary ml-2"><?php esc_html_e( 'Skip', 'nitropack' ); ?></a> |
| 36 | </div> |
| 37 | </div> |
| 38 | <?php endif; ?> |
| 39 | <div class="grid grid-cols-2 gap-6 grid-col-1-tablet items-start nitropack-dashboard"> |
| 40 | <div class="col-span-1"> |
| 41 | <!-- Go to app Card --> |
| 42 | <div class="card app-card"> |
| 43 | <div class="card-header"> |
| 44 | <h3><?php esc_html_e( 'Customize NitroPack\'s Optimization Settings in Your Account', 'nitropack' ); ?> |
| 45 | </h3> |
| 46 | </div> |
| 47 | <div class="card-body"> |
| 48 | <div class="flex items-center justify-between"> |
| 49 | <div class="text-box"> |
| 50 | <p> |
| 51 | <?php esc_html_e( 'You can further configure how NitroPack\'s optimization behaves through your account.', 'nitropack' ); ?> |
| 52 | </p> |
| 53 | </div> |
| 54 | <?php |
| 55 | function getNitropackDashboardUrl() { |
| 56 | $siteId = nitropack_get_current_site_id(); |
| 57 | $dashboardUrl = 'https://app.nitropack.io/dashboard'; |
| 58 | |
| 59 | if ( $siteId !== null ) { |
| 60 | $dashboardUrl .= '?update_session_website_id=' . urlencode( $siteId ); |
| 61 | } |
| 62 | |
| 63 | return $dashboardUrl; |
| 64 | } |
| 65 | ?> |
| 66 | <a href="<?php echo esc_url( getNitropackDashboardUrl() ); ?>" target="_blank" |
| 67 | class="btn btn-primary ml-2 flex-shrink-0"><?php esc_html_e( 'Go to app', 'nitropack' ); ?></a> |
| 68 | </div> |
| 69 | </div> |
| 70 | </div> |
| 71 | <!-- Go to app card End --> |
| 72 | <!-- Optimized Pages Card --> |
| 73 | <?php $settings->optimizations->render(); ?> |
| 74 | <!-- Optimized Pages Card End --> |
| 75 | <!-- Optimization Mode Card --> |
| 76 | <?php $settings->optimization_level->render(); ?> |
| 77 | <!-- Optimization Mode Card End --> |
| 78 | <!-- Automated Behavior Card --> |
| 79 | <div class="card card-automated-behavior"> |
| 80 | <div class="card-header"> |
| 81 | <h3><?php esc_html_e( 'Automated Behavior', 'nitropack' ); ?></h3> |
| 82 | </div> |
| 83 | <div class="card-body"> |
| 84 | <div class="options-container"> |
| 85 | <div class="nitro-option" id="purge-cache-widget"> |
| 86 | <div class="nitro-option-main"> |
| 87 | <div class="text-box"> |
| 88 | <h6><?php esc_html_e( 'Purge cache', 'nitropack' ); ?></h6> |
| 89 | <p><?php esc_html_e( 'Purge affected cache when content is updated or published', 'nitropack' ); ?> |
| 90 | </p> |
| 91 | </div> |
| 92 | <label class="inline-flex items-center cursor-pointer ml-auto"> |
| 93 | <input type="checkbox" value="" class="sr-only peer" name="purge_cache" |
| 94 | id="auto-purge-status" <?php if ( $autoCachePurge ) |
| 95 | echo "checked"; ?>> |
| 96 | <div class="toggle"></div> |
| 97 | </label> |
| 98 | </div> |
| 99 | </div> |
| 100 | <div class="nitro-option" id="page-optimization-widget"> |
| 101 | <div class="nitro-option-main"> |
| 102 | <div class="text-box"> |
| 103 | <h6><?php esc_html_e( 'Page optimization', 'nitropack' ); ?></h6> |
| 104 | <p><?php esc_html_e( 'Select what post/page types get optimized', 'nitropack' ); ?></p> |
| 105 | </div> |
| 106 | <a data-modal-target="modal-posttypes" data-modal-toggle="modal-posttypes" |
| 107 | class="btn btn-secondary btn-icon"> |
| 108 | <img src="<?php echo plugin_dir_url( __FILE__ ); ?>images/setting-icon.svg"> |
| 109 | </a> |
| 110 | </div> |
| 111 | <?php require_once NITROPACK_PLUGIN_DIR . 'view/modals/modal-posttypes.php'; ?> |
| 112 | </div> |
| 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 | <div class="nitro-option" id="ajax-shortcodes-widget"> |
| 125 | <?php $settings->shortcodes->render(); ?> |
| 126 | </div> |
| 127 | </div> |
| 128 | </div> |
| 129 | </div> |
| 130 | <!-- Go to app card End --> |
| 131 | </div> |
| 132 | <div class="col-span-1"> |
| 133 | <!-- Subscription Card --> |
| 134 | <?php $settings->subscription->render(); ?> |
| 135 | |
| 136 | <!-- Subscription Card End --> |
| 137 | <!-- Basic Settings Card --> |
| 138 | <div class="card card-basic-settings"> |
| 139 | <div class="card-header"> |
| 140 | <h3><?php esc_html_e( 'Basic Settings', 'nitropack' ); ?></h3> |
| 141 | </div> |
| 142 | <div class="card-body"> |
| 143 | <div class="options-container"> |
| 144 | |
| 145 | <?php $settings->cache_warmup->render(); |
| 146 | $settings->test_mode->render(); ?> |
| 147 | |
| 148 | <div class="nitro-option" id="compression-widget"> |
| 149 | <div class="nitro-option-main"> |
| 150 | <div class="text-box"> |
| 151 | <h6><span |
| 152 | id="detected-compression"><?php esc_html_e( 'HTML Compression', 'nitropack' ); ?> |
| 153 | </span></h6> |
| 154 | <p> |
| 155 | <?php esc_html_e( 'Compressing the structure of your HTML, ensures faster page rendering and an optimized browsing experience for your users.', 'nitropack' ); ?> |
| 156 | <a href="https://support.nitropack.io/en/articles/8390333-nitropack-plugin-settings-in-wordpress#h_29b7ab4836" |
| 157 | class="text-blue" |
| 158 | target="_blank"><?php esc_html_e( 'Learn more', 'nitropack' ); ?></a> |
| 159 | </p> |
| 160 | </div> |
| 161 | <label class="inline-flex items-center cursor-pointer ml-auto"> |
| 162 | <input type="checkbox" id="compression-status" class="sr-only peer" <?php echo (int) $enableCompression === 1 ? "checked" : ""; ?>> |
| 163 | <div class="toggle"></div> |
| 164 | </label> |
| 165 | </div> |
| 166 | <div class="mt-4 text-primary"> |
| 167 | <a href="javascript:void(0);" id="compression-test-btn" |
| 168 | class="text-primary"><?php esc_html_e( 'Run compression test', 'nitropack' ); ?></a> |
| 169 | <div class="flex items-start msg-container hidden"> |
| 170 | <span class="msg"></span> |
| 171 | </div> |
| 172 | </div> |
| 173 | </div> |
| 174 | <?php if ( \NitroPack\Integration\Plugin\BeaverBuilder::isActive() ) { ?> |
| 175 | <div class="nitro-option" id="beaver-builder-widget"> |
| 176 | <div class="nitro-option-main"> |
| 177 | <div class="text-box"> |
| 178 | <h6><span |
| 179 | id="detected-compression"><?php esc_html_e( 'Sync NitroPack Purge with Beaver Builder', 'nitropack' ); ?> |
| 180 | </span></h6> |
| 181 | <p> |
| 182 | <?php esc_html_e( 'When Beaver Builder cache is purged, NitroPack will perform a full cache purge keeping your site\'s content up-to-date.', 'nitropack' ); ?> |
| 183 | </p> |
| 184 | </div> |
| 185 | <label class="inline-flex items-center cursor-pointer ml-auto"> |
| 186 | <input type="checkbox" class="sr-only peer" id="bb-purge-status" <?php if ( $bbCacheSyncPurge ) |
| 187 | echo "checked"; ?>> |
| 188 | <div class="toggle"></div> |
| 189 | </label> |
| 190 | </div> |
| 191 | </div> |
| 192 | <?php } ?> |
| 193 | <div class="nitro-option" id="can-editor-clear-cache-widget"> |
| 194 | <div class="nitro-option-main"> |
| 195 | <div class="text-box"> |
| 196 | <h6><?php esc_html_e( 'Allow Editors to purge cache', 'nitropack' ); ?></h6> |
| 197 | <p><?php esc_html_e( 'Give Editors the right to purge cache when content is updated.', 'nitropack' ); ?> |
| 198 | </p> |
| 199 | </div> |
| 200 | <label class="inline-flex items-center cursor-pointer ml-auto"> |
| 201 | <input type="checkbox" id="can-editor-clear-cache" class="sr-only peer" <?php echo (int) $canEditorClearCache === 1 ? "checked" : ""; ?>> |
| 202 | <div class="toggle"></div> |
| 203 | </label> |
| 204 | </div> |
| 205 | </div> |
| 206 | <?php if ( nitropack_render_woocommerce_cart_cache_option() ) { ?> |
| 207 | <div class="nitro-option" id="cart-cache-widget"> |
| 208 | <div class="nitro-option-main"> |
| 209 | <div class="text-box"> |
| 210 | <h6><?php esc_html_e( 'Cart cache', 'nitropack' ); ?></h6> |
| 211 | <p> |
| 212 | <?php esc_html_e( 'Your visitors will enjoy full site speed while browsing with items in cart. Fully optimized page cache will be served.', 'nitropack' ); ?> |
| 213 | </p> |
| 214 | |
| 215 | </div> |
| 216 | <label class="inline-flex items-center cursor-pointer ml-auto"> |
| 217 | <input type="checkbox" id="cart-cache-status" class="sr-only peer" <?php if ( nitropack_is_cart_cache_active() ) |
| 218 | echo "checked"; ?> <?php if ( ! nitropack_is_cart_cache_available() ) |
| 219 | echo "disabled"; ?>> |
| 220 | <div class="toggle"></div> |
| 221 | </label> |
| 222 | </div> |
| 223 | <?php if ( ! nitropack_is_cart_cache_available() ) : ?> |
| 224 | <div class="msg-container bg-success paid-msg"> |
| 225 | <p><svg width="20" height="20" viewBox="0 0 20 20" fill="none" |
| 226 | xmlns="http://www.w3.org/2000/svg" class="text-success"> |
| 227 | <g clip-path="url(#clip0_1244_36215)"> |
| 228 | <path |
| 229 | d="M10.0001 18.3333C14.6025 18.3333 18.3334 14.6023 18.3334 9.99996C18.3334 5.39759 14.6025 1.66663 10.0001 1.66663C5.39771 1.66663 1.66675 5.39759 1.66675 9.99996C1.66675 14.6023 5.39771 18.3333 10.0001 18.3333Z" |
| 230 | stroke="currentColor" stroke-width="1.5" stroke-linecap="round" |
| 231 | stroke-linejoin="round"></path> |
| 232 | <path d="M13.3334 9.99996L10.0001 6.66663L6.66675 9.99996" stroke="currentColor" |
| 233 | stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path> |
| 234 | <path d="M10 13.3333V6.66663" stroke="currentColor" stroke-width="1.5" |
| 235 | stroke-linecap="round" stroke-linejoin="round"></path> |
| 236 | </g> |
| 237 | <defs> |
| 238 | <clipPath id="clip0_1244_36215"> |
| 239 | <rect width="20" height="20" fill="white"></rect> |
| 240 | </clipPath> |
| 241 | </defs> |
| 242 | </svg> |
| 243 | <?php esc_html_e( 'This feature is available on Plus plan and above.', 'nitropack' ); ?> |
| 244 | <a href="https://app.nitropack.io/subscription/buy" class="text-primary" |
| 245 | target="_blank"><b><?php esc_html_e( 'Upgrade here', 'nitropack' ); ?></b></a> |
| 246 | </p> |
| 247 | </div> |
| 248 | <?php endif; ?> |
| 249 | </div> |
| 250 | <?php $settings->stock_refresh->render(); ?> |
| 251 | <?php } ?> |
| 252 | |
| 253 | </div> |
| 254 | </div> |
| 255 | <div class="card-footer disconnect-container"> |
| 256 | <a class="text-primary btn-link" |
| 257 | id="disconnect-btn"><?php esc_html_e( 'Disconnect NitroPack plugin', 'nitropack' ); ?></a> |
| 258 | <?php require_once NITROPACK_PLUGIN_DIR . 'view/modals/modal-disconnect.php'; ?> |
| 259 | </div> |
| 260 | </div> |
| 261 | <!-- Basic Settings Card End --> |
| 262 | |
| 263 | </div> |
| 264 | <?php $notOptimizedCPTs = nitropack_filter_non_optimized(); |
| 265 | $notices = get_option( 'nitropack-dismissed-notices', [] ); |
| 266 | $optimizedCPT_notice = in_array( 'OptimizeCPT', $notices, true ) ? true : false; |
| 267 | if ( ! $optimizedCPT_notice && ! empty( $notOptimizedCPTs ) ) |
| 268 | require_once NITROPACK_PLUGIN_DIR . 'view/modals/modal-not-optimized-CPT.php'; ?> |
| 269 | |
| 270 | </div> |
| 271 | <?php require_once NITROPACK_PLUGIN_DIR . 'view/modals/modal-unsaved-changes.php'; ?> |