|
27 | 27 | die; |
28 | 28 | } |
29 | 29 |
|
| 30 | +// Track the starting time of the plugin. |
| 31 | +$benchpress_start_time = microtime( true ); |
| 32 | + |
30 | 33 | // Define constants. |
31 | 34 | define( 'BENCHPRESS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
32 | 35 | define( 'BENCHPRESS_VERSION', '1.0.0' ); |
@@ -85,8 +88,8 @@ function benchpress_admin_menu() { |
85 | 88 | 'manage_options', |
86 | 89 | 'benchpress', |
87 | 90 | 'benchpress_render_page', |
88 | | - 'dashicons-performance', |
89 | | - 5 |
| 91 | + plugin_dir_url( __FILE__ ) . 'assets/img/barbell-icon.svg', |
| 92 | + 2 |
90 | 93 | ); |
91 | 94 |
|
92 | 95 | add_submenu_page( |
@@ -152,16 +155,22 @@ function benchpress_render_page() { |
152 | 155 | return; |
153 | 156 | } |
154 | 157 |
|
| 158 | + global $benchpress_start_time; |
| 159 | + $benchpress_execution_time = microtime( true ) - $benchpress_start_time; |
| 160 | + $formatted_execution_time = number_format( $benchpress_execution_time, 4 ); |
| 161 | + |
155 | 162 | echo '<div class="wrap"><h1>' . esc_html__( 'BenchPress', 'benchpress' ); |
156 | 163 | echo ' <button id="benchpress-snapshot-btn" class="button"><span class="dashicons dashicons-camera"></span> ' . esc_html__( 'Save Snapshot', 'benchpress' ) . '</button>'; |
157 | 164 | echo ' <button id="benchpress-refresh-btn" class="button"><span class="dashicons dashicons-update"></span> ' . esc_html__( 'Refresh Tests', 'benchpress' ) . '</button>'; |
158 | | - echo '</h1><hr />'; |
| 165 | + echo '</h1>'; |
| 166 | + echo '<hr />'; |
159 | 167 | echo '<p><a href="https://robertdevore.com/benchpress-documentation/" target="_blank">' . esc_html__( 'Documentation', 'benchpress' ) . '</a> · <a href="https://robertdevore.com/contact/" target="_blank">' . esc_html__( 'Support', 'benchpress' ) . '</a> · <a href="https://robertdevore.com/wordpress-and-woocommerce-plugins/" target="_blank">' . esc_html__( 'More Plugins', 'benchpress' ) . '</a></p>'; |
160 | 168 |
|
161 | 169 | echo '<div id="benchpress-results">'; |
162 | 170 | $table = new BenchPress_Table(); |
163 | 171 | $table->prepare_items(); |
164 | 172 | $table->display(); |
| 173 | + echo '<p>' . sprintf( esc_html__( 'Total Execution Time: %s seconds', 'benchpress' ), $formatted_execution_time ) . '</p>'; |
165 | 174 | echo '</div></div>'; |
166 | 175 | } |
167 | 176 |
|
@@ -354,6 +363,26 @@ function benchpress_enqueue_assets() { |
354 | 363 | } |
355 | 364 | add_action( 'admin_enqueue_scripts', 'benchpress_enqueue_assets' ); |
356 | 365 |
|
| 366 | +/** |
| 367 | + * Enqueue custom admin styles for BenchPress plugin. |
| 368 | + * |
| 369 | + * This function loads the custom CSS file for the BenchPress plugin's |
| 370 | + * admin interface. It adds styling to the BenchPress menu icon in |
| 371 | + * the WordPress® admin sidebar, including hover effects. |
| 372 | + * |
| 373 | + * @since 1.0.0 |
| 374 | + * @return void |
| 375 | + */ |
| 376 | +function benchpress_enqueue_admin_styles() { |
| 377 | + wp_enqueue_style( |
| 378 | + 'benchpress-admin-style', |
| 379 | + plugin_dir_url( __FILE__ ) . 'assets/css/admin-style.css', |
| 380 | + [], |
| 381 | + BENCHPRESS_VERSION |
| 382 | + ); |
| 383 | +} |
| 384 | +add_action( 'admin_enqueue_scripts', 'benchpress_enqueue_admin_styles' ); |
| 385 | + |
357 | 386 | /** |
358 | 387 | * Handles AJAX request to refresh benchmark results. |
359 | 388 | * |
|
0 commit comments