bsf_get_current_name( string $template, string $type )

Get name of plugin / theme.


Description


Parameters

$template

(string) (Required) plugin template/slug.

$type

(string) (Required) type of product.


Return

(string)


Source

File: admin/bsf-core/auto-update/admin-functions.php

	function bsf_get_current_name( $template, $type ) {
		if ( '' === $template ) {
			return false;
		}
		if ( 'theme' === $type || 'themes' === $type ) {
			$theme = wp_get_theme( $template );
			$name  = $theme->get( 'Name' );
		} elseif ( 'plugin' === $type || 'plugins' === $type ) {
			$plugin_file = rtrim( WP_PLUGIN_DIR, '/' ) . '/' . $template;
			if ( ! is_file( $plugin_file ) ) {
				return false;
			}
			$plugin = get_plugin_data( $plugin_file );
			$name   = $plugin['Name'];
		}
		return $name;
	}


User Contributed Notes

You must log in before being able to contribute a note or feedback.