Skip to content

Commit

Permalink
Find correct plugin slug if not given
Browse files Browse the repository at this point in the history
  • Loading branch information
ernilambar committed Sep 20, 2024
1 parent 6f80489 commit 08056d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion includes/Checker/Abstract_Check_Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ abstract protected function get_categories_param();
/**
* Returns plugin slug parameter.
*
* @since 1.0.0
* @since 1.2.0
*
* @return string Plugin slug.
*/
Expand Down
5 changes: 3 additions & 2 deletions includes/Plugin_Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Plugin_Context {
/**
* Plugin slug.
*
* @since 1.0.0
* @since 1.2.0
* @var string
*/
protected $slug;
Expand All @@ -49,6 +49,7 @@ class Plugin_Context {
* Constructor.
*
* @since 1.0.0
* @since 1.2.0 Second argument $slug was introduced.
*
* @param string $main_file The absolute path to the plugin main file.
* @param string $slug The plugin slug.
Expand Down Expand Up @@ -80,7 +81,7 @@ public function __construct( $main_file, $slug = '' ) {
if ( ! empty( $slug ) ) {
$this->slug = $slug;
} else {
$this->slug = dirname( $this->main_file );
$this->slug = basename( dirname( $this->main_file ) );
}
}

Expand Down

0 comments on commit 08056d3

Please sign in to comment.