← All changes
|
admin/classes/admin-options/class-merchant-settings-renderer.php
+16
-3
2.3.0
→
2.3.2
View file →
| @@ -110,9 +110,13 @@ | ||
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | $is_pro_field = ! merchant_is_pro_active() && isset( $field['pro'] ) && $field['pro'] === true; |
| 113 | 113 | |
| 114 | - if ( $is_pro_module || $is_pro_field ) { | |
| 114 | + // A locked section or field is disabled without the Pro badge: the | |
| 115 | + // gate behind it is a plan tier, not the free-vs-pro split. | |
| 116 | + $is_locked = ! empty( $settings['locked'] ) || ! empty( $field['locked'] ); | |
| 117 | + | |
| 118 | + if ( $is_pro_module || $is_pro_field || $is_locked ) { | |
| 115 | 119 | self::disabled_field( $field, $value ); |
| 116 | 120 | } else { |
| 117 | 121 | self::field( $field, $value, $module_id ); |
| 118 | 122 | } |
| @@ -376,11 +380,20 @@ | ||
| 376 | 380 | ob_start(); |
| 377 | 381 | self::field( $settings, $value, $module_id ); |
| 378 | 382 | $field_html = (string) ob_get_clean(); |
| 379 | 383 | |
| 384 | + // Matched on the tag name, not on "<input " — templates break their | |
| 385 | + // attributes across lines however they like, and a newline right after the | |
| 386 | + // tag name used to slip past this and leave the control editable. | |
| 387 | + $field_html = (string) preg_replace( | |
| 388 | + '/<(input|select|textarea|button)(?=[\s>])/i', | |
| 389 | + '<$1 disabled', | |
| 390 | + $field_html | |
| 391 | + ); | |
| 392 | + | |
| 380 | 393 | $field_html = str_replace( |
| 381 | - array( '<input ', '<select ', '<textarea ', '<button ', 'merchant-module-page-setting-field-inner' ), | |
| 382 | - array( '<input disabled ', '<select disabled ', '<textarea disabled ', '<button disabled ', 'merchant-module-page-setting-field-inner disabled' ), | |
| 394 | + 'merchant-module-page-setting-field-inner', | |
| 395 | + 'merchant-module-page-setting-field-inner disabled', | |
| 383 | 396 | $field_html |
| 384 | 397 | ); |
| 385 | 398 | |
| 386 | 399 | // The HTML is generated by self::field() — trusted admin output. |