Skip to content

Commit

Permalink
added sub menu Performance link in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
geckod22 committed Nov 20, 2024
1 parent 37cddfe commit 0939baf
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions includes/Performance.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace NewfoldLabs\WP\Module\Performance;

use NewfoldLabs\WP\Module\Performance\CacheTypes\Browser;
use NewfoldLabs\WP\Module\Performance\CacheTypes\File;
use NewfoldLabs\WP\Module\Performance\CacheTypes\Skip404;
use NewfoldLabs\WP\ModuleLoader\Container;

/**
Expand Down Expand Up @@ -77,6 +74,8 @@ public function __construct( Container $container ) {
add_action( 'admin_bar_menu', array( $this, 'adminBarMenu' ), 100 );
}

add_action( 'admin_menu', array( $this, 'add_sub_menu_page' ) );

$container->set( 'cachePurger', $cachePurger );

$container->set( 'hasMustUsePlugin', file_exists( WPMU_PLUGIN_DIR . '/endurance-page-cache.php' ) );
Expand Down Expand Up @@ -105,10 +104,8 @@ function () {

/**
* Add hooks.
*
* @param Container $container the container
*/
public function hooks( Container $container ) {
public function hooks() {

add_action( 'admin_init', array( $this, 'registerSettings' ), 11 );

Expand Down Expand Up @@ -149,11 +146,9 @@ function () {
* @hooked action_scheduler_retention_period
* @see ActionScheduler_QueueCleaner::delete_old_actions()
*
* @param int $retention_period Minimum scheduled age in seconds of the actions to be deleted.
*
* @return int New retention period in seconds.
*/
public function nfd_asr_default( $retention_period ) {
public function nfd_asr_default() {
return 5 * constant( 'DAY_IN_SECONDS' );
}

Expand Down Expand Up @@ -292,4 +287,19 @@ public function adminBarMenu( \WP_Admin_Bar $wp_admin_bar ) {
);
}
}

/**
* Add performance menu in WP/Settings
*/
public function add_sub_menu_page() {
$brand = $this->container->get( 'plugin' )['id'];
add_options_page(
__( 'Performance', 'newfold-performance-module' ),
__( 'Performance', 'newfold-performance-module' ),
'manage_options',
admin_url( "admin.php?page=$brand#/performance" ),
null,
5
);
}
}

0 comments on commit 0939baf

Please sign in to comment.