Automattic\WooCommerce\Utilities
StringUtil::plugin_name_from_plugin_file
Get the name of a plugin in the form 'directory/file.php', as in the keys of the array returned by 'get_plugins'.
Метод класса: StringUtil{}
Хуков нет.
Возвращает
Строку. The name of the plugin in the form 'directory/file.php'.
Использование
$result = StringUtil::plugin_name_from_plugin_file( $plugin_file_path ): string;
- $plugin_file_path(строка) (обязательный)
- The path of the main plugin file (can be passed as __FILE__ from the plugin itself).
Код StringUtil::plugin_name_from_plugin_file() StringUtil::plugin name from plugin file WC 11.0.1
public static function plugin_name_from_plugin_file( string $plugin_file_path ): string {
return basename( dirname( $plugin_file_path ) ) . DIRECTORY_SEPARATOR . basename( $plugin_file_path );
}