diff --git a/includes/Performance.php b/includes/Performance.php index ac50c2f..8ce0db1 100644 --- a/includes/Performance.php +++ b/includes/Performance.php @@ -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; /** @@ -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' ) ); @@ -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 ); @@ -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' ); } @@ -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 + ); + } }