1313use Dwnload \WpSettingsApi \WpSettingsApi ;
1414use TheFrosty \WpUtilities \Plugin \HooksTrait ;
1515use TheFrosty \WpUtilities \Plugin \WpHooksInterface ;
16+ use function __ ;
1617use function admin_url ;
1718use function apply_filters ;
1819use function check_ajax_referer ;
1920use function defined ;
21+ use function dirname ;
2022use function plugin_basename ;
23+ use function plugins_url ;
2124use function sanitize_key ;
2225use function sanitize_text_field ;
2326use function sprintf ;
27+ use function str_replace ;
2428use function wp_create_nonce ;
2529use function wp_enqueue_script ;
2630use function wp_enqueue_style ;
@@ -68,27 +72,24 @@ protected function init(
6872 $ section_id = $ section_manager ->addSection (
6973 new SettingSection ([
7074 SettingSection::SECTION_ID => 'edd_license_manager ' ,
71- SettingSection::SECTION_TITLE => 'License(s) ' ,
75+ SettingSection::SECTION_TITLE => 'License ' ,
7276 ])
7377 );
7478
75- $ licenses = (array )apply_filters ('dwnload_edd_slm_licenses ' , []);
76- foreach ($ licenses as $ plugin_id => $ plugin_name ) {
77- $ field_manager ->addField (
78- new SettingField (
79- [
80- SettingField::NAME => $ plugin_id ,
81- SettingField::LABEL => sprintf (
82- \__ ('%s License ' , 'edd-software-license-manager ' ),
83- $ plugin_name
84- ),
85- SettingField::TYPE => FieldTypes::FIELD_TYPE_TEXT ,
86- SettingField::DESC => include \dirname (__DIR__ , 2 ) . '/views/license.php ' ,
87- SettingField::SECTION_ID => $ section_id ,
88- ]
89- )
90- );
91- }
79+ $ field_manager ->addField (
80+ new SettingField (
81+ [
82+ SettingField::NAME => $ this ->parent ->getSlug (),
83+ SettingField::LABEL => sprintf (
84+ __ ('%s License ' , 'edd-software-license-manager ' ),
85+ $ this ->pluginData ->getItemName ()
86+ ),
87+ SettingField::TYPE => FieldTypes::FIELD_TYPE_TEXT ,
88+ SettingField::DESC => include dirname (__DIR__ , 2 ) . '/views/license.php ' ,
89+ SettingField::SECTION_ID => $ section_id ,
90+ ]
91+ )
92+ );
9293 }
9394
9495 /**
@@ -99,15 +100,15 @@ protected function enqueueScripts(): void
99100 $ use_local = apply_filters ('dwnload_edd_slm_use_local_scripts ' , false );
100101 $ get_src = static function (string $ path ) use ($ use_local ): string {
101102 if ($ use_local ) {
102- return \ plugins_url ($ path , \ dirname (__DIR__ ));
103+ return plugins_url ($ path , dirname (__DIR__ ));
103104 }
104105
105106 $ debug = defined ('SCRIPT_DEBUG ' ) && SCRIPT_DEBUG ;
106107
107108 return sprintf (
108109 'https://cdn.jsdelivr.net/gh/dwnload/EddSoftwareLicenseManager@%s/%s ' ,
109110 apply_filters ('dwnload_edd_slm_scripts_version ' , self ::VERSION ),
110- $ debug === true ? $ path : \ str_replace (['.css ' , '.js ' ], ['.min.css ' , '.min.js ' ], $ path )
111+ $ debug === true ? $ path : str_replace (['.css ' , '.js ' ], ['.min.css ' , '.min.js ' ], $ path )
111112 );
112113 };
113114
0 commit comments