mirror of
https://github.com/10h30/display-featured-image-genesis.git
synced 2026-07-18 14:03:20 +09:00
Add basename constant for functions' use
Deactivate and settings links use this.
This commit is contained in:
@@ -24,6 +24,10 @@ if ( ! defined( 'WPINC' ) ) {
|
||||
die;
|
||||
}
|
||||
|
||||
if ( ! defined( 'DISPLAYFEATUREDIMAGEGENESIS_BASENAME' ) ) {
|
||||
define( 'DISPLAYFEATUREDIMAGEGENESIS_BASENAME', plugin_basename( __FILE__ ) );
|
||||
}
|
||||
|
||||
function display_featured_image_genesis_require() {
|
||||
$files = array(
|
||||
'class-displayfeaturedimagegenesis',
|
||||
|
||||
@@ -30,7 +30,6 @@ class Display_Featured_Image_Genesis {
|
||||
public function run() {
|
||||
if ( 'genesis' !== basename( get_template_directory() ) ) {
|
||||
add_action( 'admin_init', array( $this, 'deactivate' ) );
|
||||
add_action( 'admin_notices', array( $this, 'error_message' ) );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -47,6 +46,7 @@ class Display_Featured_Image_Genesis {
|
||||
add_action( 'get_header', array( $this->output, 'manage_output' ) );
|
||||
add_action( 'template_redirect', array( $this->rss, 'maybe_do_feed' ) );
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
||||
add_filter( 'plugin_action_links_' . DISPLAYFEATUREDIMAGEGENESIS_BASENAME, array( $this, 'add_settings_link' ) );
|
||||
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ class Display_Featured_Image_Genesis {
|
||||
*
|
||||
*/
|
||||
public function deactivate() {
|
||||
$dirname = version_compare( PHP_VERSION, '5.3', '>=' ) ? __DIR__ : dirname( __FILE__ );
|
||||
deactivate_plugins( plugin_basename( dirname( $dirname ) ) . '/display-featured-image-genesis.php' );
|
||||
deactivate_plugins( DISPLAYFEATUREDIMAGEGENESIS_BASENAME );
|
||||
add_action( 'admin_notices', array( $this, 'error_message' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user