Skip to content

Commit 701f56c

Browse files
committed
🗑️ Add deprecation notice for Impressum::set_plugin_file() and Admin::set_plugin_file()
1 parent f870538 commit 701f56c

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

impressum.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,4 @@
7878
// deprecated, don't use anymore
7979
if ( ! \defined( 'IMPRESSUM_BASE' ) ) \define( 'IMPRESSUM_BASE', \plugin_basename( __FILE__ ) );
8080

81-
Impressum::get_instance()->set_plugin_file( __FILE__ );
8281
Impressum::get_instance()->init();

inc/class-admin.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Admin {
2424
/**
2525
* @var string The full path to the main plugin file
2626
*/
27-
public $plugin_file = '';
27+
public $plugin_file = \EPI_IMPRESSUM_FILE;
2828

2929
/**
3030
* Initialize the admin functions.
@@ -616,6 +616,16 @@ public function register_plus_tab( $tabs ) {
616616
* @param string $file The path to the file
617617
*/
618618
public function set_plugin_file( $file ) {
619+
\_doing_it_wrong(
620+
__METHOD__,
621+
\sprintf(
622+
/* translators: alternative method */
623+
\esc_html__( 'Use %s instead', 'impressum' ),
624+
'EPI_IMPRESSUM_FILE'
625+
),
626+
'2.1.0'
627+
);
628+
619629
if ( \file_exists( $file ) ) {
620630
$this->plugin_file = $file;
621631
}

inc/class-impressum.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Impressum {
3434
/**
3535
* @var string The full path to the main plugin file
3636
*/
37-
public $plugin_file = '';
37+
public $plugin_file = \EPI_IMPRESSUM_FILE;
3838

3939
/**
4040
* @var array All settings fields.
@@ -668,9 +668,18 @@ public function load_textdomain() {
668668
* @param string $file The path to the file
669669
*/
670670
public function set_plugin_file( $file ) {
671+
\_doing_it_wrong(
672+
__METHOD__,
673+
\sprintf(
674+
/* translators: alternative method */
675+
\esc_html__( 'Use %s instead', 'impressum' ),
676+
'EPI_IMPRESSUM_FILE'
677+
),
678+
'2.1.0'
679+
);
680+
671681
if ( \file_exists( $file ) ) {
672682
$this->plugin_file = $file;
673-
$this->admin->set_plugin_file( $this->plugin_file );
674683
}
675684
}
676685

0 commit comments

Comments
 (0)