@@ -29,42 +29,42 @@ class Admin_Banner {
2929 *
3030 * @var array<string, mixed>
3131 */
32- private array $ config = array ();
32+ public array $ config = array ();
3333
3434 /**
3535 * Derived class names keyed by component.
3636 *
3737 * @var array<string, array<int, string>>
3838 */
39- private array $ class_names = array ();
39+ public array $ class_names = array ();
4040
4141 /**
4242 * Localized strings.
4343 *
4444 * @var array<string, string>
4545 */
46- private array $ strings = array ();
46+ public array $ strings = array ();
4747
4848 /**
4949 * Style configuration.
5050 *
5151 * @var array<string, mixed>
5252 */
53- private array $ style = array ();
53+ public array $ style = array ();
5454
5555 /**
5656 * Base class prefix shared by all banners.
5757 *
5858 * @var string
5959 */
60- private string $ base_prefix = 'wz-admin-banner ' ;
60+ public string $ base_prefix = 'wz-admin-banner ' ;
6161
6262 /**
6363 * Unique class prefix derived from the provided prefix.
6464 *
6565 * @var string
6666 */
67- private string $ unique_prefix = 'admin-banner ' ;
67+ public string $ unique_prefix = 'admin-banner ' ;
6868
6969 /**
7070 * Constructor.
@@ -108,7 +108,7 @@ public function __construct( array $config ) {
108108 /**
109109 * Register hooks.
110110 */
111- private function hooks (): void {
111+ public function hooks (): void {
112112 Hook_Registry::add_action ( 'admin_enqueue_scripts ' , array ( $ this , 'maybe_enqueue_styles ' ) );
113113 Hook_Registry::add_action ( 'in_admin_header ' , array ( $ this , 'render ' ) );
114114 }
@@ -197,7 +197,7 @@ public function render(): void {
197197 /**
198198 * Enqueue the banner stylesheet.
199199 */
200- private function enqueue_style (): void {
200+ public function enqueue_style (): void {
201201 wp_register_style (
202202 $ this ->style ['handle ' ],
203203 $ this ->style ['url ' ],
@@ -213,7 +213,7 @@ private function enqueue_style(): void {
213213 * @param \WP_Screen $screen Current admin screen.
214214 * @param string $page_slug Current request page slug.
215215 */
216- private function should_render_on_screen ( \WP_Screen $ screen , string $ page_slug ): bool {
216+ public function should_render_on_screen ( \WP_Screen $ screen , string $ page_slug ): bool {
217217 $ screen_base = (string ) $ screen ->base ;
218218 if ( '' !== $ screen_base && in_array ( $ screen_base , (array ) $ this ->config ['exclude_screen_bases ' ], true ) ) {
219219 return false ;
@@ -237,7 +237,7 @@ private function should_render_on_screen( \WP_Screen $screen, string $page_slug
237237 * @param \WP_Screen $screen Current admin screen.
238238 * @param string $page_slug Current request page slug.
239239 */
240- private function resolve_current_section ( \WP_Screen $ screen , string $ page_slug ): string {
240+ public function resolve_current_section ( \WP_Screen $ screen , string $ page_slug ): string {
241241 $ screen_id = (string ) $ screen ->id ;
242242
243243 foreach ( $ this ->config ['sections ' ] as $ section_key => $ section ) {
@@ -260,7 +260,7 @@ private function resolve_current_section( \WP_Screen $screen, string $page_slug
260260 *
261261 * @param array $strings Raw strings array.
262262 */
263- private function prepare_strings ( array $ strings ): array {
263+ public function prepare_strings ( array $ strings ): array {
264264 $ defaults = array (
265265 'region_label ' => '' ,
266266 'nav_label ' => '' ,
@@ -277,7 +277,7 @@ private function prepare_strings( array $strings ): array {
277277 *
278278 * @param string $prefix Base prefix.
279279 */
280- private function resolve_wrapper_prefix ( string $ prefix ): string {
280+ public function resolve_wrapper_prefix ( string $ prefix ): string {
281281 $ prefix = sanitize_key ( $ prefix );
282282
283283 if ( '' === $ prefix ) {
@@ -292,7 +292,7 @@ private function resolve_wrapper_prefix( string $prefix ): string {
292292 *
293293 * @param array $style Style configuration.
294294 */
295- private function prepare_style_config ( array $ style ): array {
295+ public function prepare_style_config ( array $ style ): array {
296296 $ defaults = array (
297297 'handle ' => $ this ->sanitize_handle ( "{$ this ->unique_prefix }-styles " ),
298298 'deps ' => array (),
@@ -306,7 +306,8 @@ private function prepare_style_config( array $style ): array {
306306 if ( empty ( $ style_config ['url ' ] ) ) {
307307 $ assets_base = trailingslashit ( plugin_dir_url ( __FILE__ ) ) . 'css/ ' ;
308308 $ min_suffix = ( defined ( 'SCRIPT_DEBUG ' ) && SCRIPT_DEBUG ) ? '' : '.min ' ;
309- $ style_config ['url ' ] = $ assets_base . $ style_config ['filename ' ] . $ min_suffix . '.css ' ;
309+ $ rtl_suffix = is_rtl () ? '-rtl ' : '' ;
310+ $ style_config ['url ' ] = $ assets_base . $ style_config ['filename ' ] . $ rtl_suffix . $ min_suffix . '.css ' ;
310311 }
311312
312313 return $ style_config ;
@@ -319,7 +320,7 @@ private function prepare_style_config( array $style ): array {
319320 *
320321 * @return array
321322 */
322- private function sanitize_sections ( array $ sections ): array {
323+ public function sanitize_sections ( array $ sections ): array {
323324 $ sanitized = array ();
324325
325326 foreach ( $ sections as $ key => $ section ) {
@@ -348,7 +349,7 @@ private function sanitize_sections( array $sections ): array {
348349 *
349350 * @return array<string, array<int, string>>
350351 */
351- private function derive_class_names (): array {
352+ public function derive_class_names (): array {
352353 $ build = function ( string $ suffix = '' ): array {
353354 $ classes = array ( $ this ->base_prefix . $ suffix );
354355
@@ -381,7 +382,7 @@ private function derive_class_names(): array {
381382 *
382383 * @return array
383384 */
384- private function collect_targets_from_sections ( string $ target_key ): array {
385+ public function collect_targets_from_sections ( string $ target_key ): array {
385386 $ values = array ();
386387
387388 foreach ( $ this ->config ['sections ' ] as $ section ) {
@@ -401,7 +402,7 @@ private function collect_targets_from_sections( string $target_key ): array {
401402 *
402403 * @param array $section Section configuration.
403404 */
404- private function get_section_link_classes ( array $ section ): array {
405+ public function get_section_link_classes ( array $ section ): array {
405406 $ classes = $ this ->class_names ['link ' ] ?? array ();
406407 $ type = isset ( $ section ['type ' ] ) ? sanitize_key ( $ section ['type ' ] ) : 'secondary ' ;
407408 $ type = '' !== $ type ? $ type : 'secondary ' ;
@@ -422,7 +423,7 @@ private function get_section_link_classes( array $section ): array {
422423 * @param array $classes Class list.
423424 * @return string Class attribute string.
424425 */
425- private function implode_classes ( array $ classes ): string {
426+ public function implode_classes ( array $ classes ): string {
426427 return implode ( ' ' , array_unique ( array_filter ( $ classes ) ) );
427428 }
428429
@@ -432,7 +433,7 @@ private function implode_classes( array $classes ): string {
432433 * @param string $key Classes array key.
433434 * @return string Class attribute string.
434435 */
435- private function class_attr ( string $ key ): string {
436+ public function class_attr ( string $ key ): string {
436437 return $ this ->implode_classes ( $ this ->class_names [ $ key ] ?? array () );
437438 }
438439
@@ -441,19 +442,15 @@ private function class_attr( string $key ): string {
441442 *
442443 * @param string $handle Raw handle.
443444 */
444- private function sanitize_handle ( string $ handle ): string {
445+ public function sanitize_handle ( string $ handle ): string {
445446 return sanitize_title_with_dashes ( $ handle );
446447 }
447448
448449 /**
449450 * Get the current page slug from the request.
450451 */
451- private function get_request_page_slug (): string {
452- $ page_param_raw = filter_input ( INPUT_GET , 'page ' , FILTER_UNSAFE_RAW );
453-
454- if ( is_string ( $ page_param_raw ) && '' !== $ page_param_raw ) {
455- $ page_raw = sanitize_text_field ( $ page_param_raw );
456- } elseif ( isset ( $ _GET ['page ' ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
452+ public function get_request_page_slug (): string {
453+ if ( isset ( $ _GET ['page ' ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
457454 $ page_raw = sanitize_text_field ( wp_unslash ( $ _GET ['page ' ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
458455 } else {
459456 return '' ;
0 commit comments