Skip to content

Commit

Permalink
tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
circlecube committed May 14, 2024
1 parent 9a37188 commit a85e586
Showing 1 changed file with 51 additions and 57 deletions.
108 changes: 51 additions & 57 deletions includes/PerformanceFeature.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,75 +15,69 @@

/**
* Child class for a feature
*
*
* Child classes should define a name property as the feature name for all API calls. This name will be used in the registry.
* Child class naming convention is {FeatureName}Feature.
*/
class PerformanceFeature extends \NewfoldLabs\WP\Module\Features\Feature {

/**
* The feature name.
*
* @var string
*/
protected $name = 'performance';
/**
* The feature name.
*
* @var string
*/
protected $name = 'performance';

/**
* The feature value. Defaults to on.
*
* @var boolean
*/
protected $value = true; // default to on
protected $value = true; // default to on

/**
* Initialize performance feature.
*/
public function initialize() {
if ( function_exists( 'add_action' ) ) {

// Register module
add_action(
'plugins_loaded',
function () {
new Performance( getContainer() );
}
);
/**
* Initialize performance feature.
*/
public function initialize() {
if ( function_exists( 'add_action' ) ) {

// Container Hooks
add_action(
'newfold_container_set',
function ( Container $container ) {
// Register module
add_action(
'plugins_loaded',
function () {
new Performance( getContainer() );
}
);

register_activation_hook(
$container->plugin()->file,
function () use ( $container ) {

Skip404::onActivation();
File::onActivation();
Browser::onActivation();

// Add headers to .htaccess
$responseHeaderManager = new ResponseHeaderManager();
$responseHeaderManager->addHeader( 'X-Newfold-Cache-Level', absint( getCacheLevel() ) );

}
);

register_deactivation_hook(
$container->plugin()->file,
function () use ( $container ) {

Skip404::onDeactivation();
File::onDeactivation();
Browser::onDeactivation();

// Remove all headers from .htaccess
$responseHeaderManager = new ResponseHeaderManager();
$responseHeaderManager->removeAllHeaders();
}
);
}
);
}
}
// Container Hooks
add_action(
'newfold_container_set',
function ( Container $container ) {
register_activation_hook(
$container->plugin()->file,
function () use ( $container ) {
Skip404::onActivation();
File::onActivation();
Browser::onActivation();
// Add headers to .htaccess
$responseHeaderManager = new ResponseHeaderManager();
$responseHeaderManager->addHeader( 'X-Newfold-Cache-Level', absint( getCacheLevel() ) );

}
);
register_deactivation_hook(
$container->plugin()->file,
function () use ( $container ) {
Skip404::onDeactivation();
File::onDeactivation();
Browser::onDeactivation();
// Remove all headers from .htaccess
$responseHeaderManager = new ResponseHeaderManager();
$responseHeaderManager->removeAllHeaders();
}
);
}
);
}
}
}

0 comments on commit a85e586

Please sign in to comment.