| @@ -7,9 +7,10 @@ | ||
| 7 | 7 | * Function to render the queue panel. |
| 8 | 8 | */ |
| 9 | 9 | function ao_ccss_render_queue() { |
| 10 | 10 | // Attach required arrays. |
| 11 | - global $ao_ccss_queue; | |
| 11 | + $criticalcss = autoptimize()->criticalcss(); | |
| 12 | + $ao_ccss_queue = $criticalcss->get_option( 'queue' ); | |
| 12 | 13 | |
| 13 | 14 | // Prepare the queue object. |
| 14 | 15 | if ( empty( $ao_ccss_queue ) ) { |
| 15 | 16 | $ao_ccss_queue = ''; |
| @@ -15,9 +16,9 @@ | ||
| 15 | 16 | $ao_ccss_queue = ''; |
| 16 | 17 | } else { |
| 17 | 18 | $ao_ccss_queue = json_encode( $ao_ccss_queue ); |
| 18 | 19 | } |
| 19 | -?> | |
| 20 | + ?> | |
| 20 | 21 | |
| 21 | 22 | <ul id="queue-panel"> |
| 22 | 23 | <li class="itemDetail"> |
| 23 | 24 | <h2 class="itemTitle fleft"><?php _e( 'Job Queue', 'autoptimize' ); ?></h2> |
| @@ -24,9 +25,9 @@ | ||
| 24 | 25 | <button type="button" class="toggle-btn"> |
| 25 | 26 | <span class="toggle-indicator dashicons dashicons-arrow-up dashicons-arrow-down"></span> |
| 26 | 27 | </button> |
| 27 | 28 | <?php |
| 28 | - if ( autoptimizeCriticalCSSSettings::ao_ccss_has_autorules() ) { | |
| 29 | + if ( $criticalcss->has_autorules() ) { | |
| 29 | 30 | $_queue_visibility = 'hidden'; |
| 30 | 31 | } else { |
| 31 | 32 | $_queue_visibility = 'visible'; |
| 32 | 33 | } |
| @@ -51,9 +52,9 @@ | ||
| 51 | 52 | |
| 52 | 53 | <!-- BEGIN Queue UI --> |
| 53 | 54 | <div class="howto"> |
| 54 | 55 | <div class="title-wrap"> |
| 55 | - <h4 class="title"><?php _e( 'How To Use Autoptimize CriticalCSS Power-Up Queue', 'autoptimize' ); ?></h4> | |
| 56 | + <h4 class="title"><?php _e( 'How To Use Autoptimize CriticalCSS Queue', 'autoptimize' ); ?></h4> | |
| 56 | 57 | <p class="subtitle"><?php _e( 'Click the side arrow to toggle instructions', 'autoptimize' ); ?></p> |
| 57 | 58 | </div> |
| 58 | 59 | <button type="button" class="toggle-btn"> |
| 59 | 60 | <span class="toggle-indicator dashicons dashicons-arrow-up dashicons-arrow-down"></span> |
| @@ -62,14 +63,14 @@ | ||
| 62 | 63 | <p><?php _e( 'TL;DR:<br /><strong>Queue runs every 10 minutes.</strong> Job statuses are <span class="badge new">N</span> for NEW, <span class="badge pending">P</span> for PENDING, <span class="badge error">E</span> for ERROR and <span class="badge unknown">U</span> for UNKOWN.', 'autoptimize' ); ?></p> |
| 63 | 64 | <ol> |
| 64 | 65 | <li><?php _e( 'The queue operates <strong>automatically, asynchronously and on regular intervals of 10 minutes.</strong> To view updated queue status, refresh this page.', 'autoptimize' ); ?></li> |
| 65 | 66 | <li><?php _e( 'When the conditions to create a job are met (i.e. user not logged in, no matching <span class="badge manual">MANUAL</span> rule or CSS files has changed for an <span class="badge auto">AUTO</span> rule), a <span class="badge new">N</span> job is created in the queue.', 'autoptimize' ); ?></li> |
| 66 | - <li><?php _e( "Autoptimize CriticalCSS Power-Up constantly query the queue for <span class='badge new'>N</span> jobs. When it finds one, gears spins and jobs becomes <span class='badge pending'>P</span> while they are running and <a href='https://criticalcss.com/?aff=1' target='_blank'>criticalcss.com</a> doesn't return a result.", 'autoptimize' ); ?></li> | |
| 67 | + <li><?php _e( "Autoptimize constantly queries the queue for <span class='badge new'>N</span> jobs. When it finds one, gears spins and jobs becomes <span class='badge pending'>P</span> while they are running and <a href='https://criticalcss.com/?aff=1' target='_blank'>criticalcss.com</a> doesn't return a result.", 'autoptimize' ); ?></li> | |
| 67 | 68 | <li><?php _e( 'As soon as <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> returns a valid critical CSS file, the job is then finished and removed from the queue.', 'autoptimize' ); ?></li> |
| 68 | 69 | <li><?php _e( 'When things go wrong, a job is marked as <span class="badge error">E</span>. You can retry faulty jobs, delete them or get in touch with <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> for assistance.', 'autoptimize' ); ?></li> |
| 69 | 70 | <li><?php _e( 'Sometimes an unknown condition can happen. In this case, the job status becomes <span class="badge unknown">U</span> and you may want to ask <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> for help or just delete it.', 'autoptimize' ); ?></li> |
| 70 | 71 | <li><?php _e( 'To get more information about jobs statuses, specially the ones with <span class="badge error">E</span> and <span class="badge unknown">U</span> status, hover your mouse in the status badge of that job. This information might be crucial when contacting <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> for assistance.', 'autoptimize' ); ?></li> |
| 71 | - <li><?php _e( '<strong>A word about WordPress cron:</strong> Autoptimize CriticalCSS Power-Up watch the queue by using WordPress Cron (or WP-Cron for short.) It <a href="https://www.smashingmagazine.com/2013/10/schedule-events-using-wordpress-cron/#limitations-of-wordpress-cron-and-solutions-to-fix-em" target="_blank">could be faulty</a> on very light or very heavy loads. If your site receives just a few or thousands visits a day, it might be a good idea to <a href="https://developer.wordpress.org/plugins/cron/hooking-wp-cron-into-the-system-task-scheduler/" target="_blank">turn WP-Cron off and use your system task scheduler</a> to fire it instead.', 'autoptimize' ); ?></li> | |
| 72 | + <li><?php _e( '<strong>A word about WordPress cron:</strong> Autoptimize watches the queue by using WordPress Cron (or WP-Cron for short.) It <a href="https://www.smashingmagazine.com/2013/10/schedule-events-using-wordpress-cron/#limitations-of-wordpress-cron-and-solutions-to-fix-em" target="_blank">could be faulty</a> on very light or very heavy loads. If your site receives just a few or thousands visits a day, it might be a good idea to <a href="https://developer.wordpress.org/plugins/cron/hooking-wp-cron-into-the-system-task-scheduler/" target="_blank">turn WP-Cron off and use your system task scheduler</a> to fire it instead.', 'autoptimize' ); ?></li> | |
| 72 | 73 | </ol> |
| 73 | 74 | </div> |
| 74 | 75 | </div> |
| 75 | 76 | <table id="queue-tbl" class="queue tablesorter" cellspacing="0"> |
| @@ -79,8 +80,11 @@ | ||
| 79 | 80 | <tbody id="queue"></tbody> |
| 80 | 81 | </table> |
| 81 | 82 | <input class="hidden" type="text" id="ao-ccss-queue" name="autoptimize_ccss_queue" value='<?php echo( $ao_ccss_queue ); ?>'> |
| 82 | 83 | <div class="submit jobs-btn"> |
| 84 | + <div id="queuerunner-container" class="alignleft hidden"> | |
| 85 | + <span id="queuerunner" class="button-secondary"><?php _e( 'Manually process the job queue', 'autoptimize' ); ?></span> | |
| 86 | + </div> | |
| 83 | 87 | <div class="alignright"> |
| 84 | 88 | <span id="removeAllJobs" class="button-secondary" style="color:red;"><?php _e( 'Remove all jobs', 'autoptimize' ); ?></span> |
| 85 | 89 | </div> |
| 86 | 90 | </div> |
| @@ -87,6 +91,6 @@ | ||
| 87 | 91 | </div> |
| 88 | 92 | <!-- END Queue UI --> |
| 89 | 93 | </li> |
| 90 | 94 | </ul> |
| 91 | -<?php | |
| 95 | + <?php | |
| 92 | 96 | } |