Changeset 3335603
- Timestamp:
- 07/28/2025 11:47:23 PM (8 months ago)
- Location:
- tiny-widget-manager/trunk
- Files:
-
- 3 edited
-
includes/class-tiny-widget-manager.php (modified) (2 diffs)
-
includes/class-twim-hooks.php (modified) (3 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tiny-widget-manager/trunk/includes/class-tiny-widget-manager.php
r3335585 r3335603 28 28 private function __construct() 29 29 { 30 //$debug_mode = get_option('twim_debug_mode');30 $debug_mode = get_option('twim_debug_mode'); 31 31 32 32 $Settings = TWIM_Settings::get_instance(); … … 53 53 add_filter('sidebars_widgets', [$Hooks, 'filter_widgets_before_output'], 10, 3); 54 54 add_filter('dynamic_sidebar_params', [$Hooks, 'add_custom_widget_classes'], 10, 3); 55 //if ($debug_mode) {56 //add_filter('widget_display_callback', [$Hooks, 'maybe_append_debug_info'], 10, 3);57 //}55 if ($debug_mode) { 56 add_filter('widget_display_callback', [$Hooks, 'maybe_append_debug_info'], 10, 3); 57 } 58 58 } 59 59 -
tiny-widget-manager/trunk/includes/class-twim-hooks.php
r3335585 r3335603 518 518 * @return void 519 519 */ 520 //public function maybe_append_debug_info($instance, $widget, $args)521 //{522 //$id_base = $widget->id_base;523 //$widget_id = $widget->id;524 525 //echo '<div class="twim-debug-info" style="border:1px dashed red; padding:5px; font-size:11px; margin-top:5px;">';526 //echo '<div class="twim-debug-section" style="padding: 10px;">';527 //echo 'Widget ID: <strong>' . esc_html($widget_id) . '</strong><br>';528 //echo 'ID Base: <strong>' . esc_html($id_base) . '</strong><br>';529 //if (isset($instance['twim_visibility_andor'])) {530 //echo 'Visibility AND/OR: <strong>' . esc_html($instance['twim_visibility_andor']) . '</strong><br>';531 //}532 //echo 'wp_is_mobile() : <strong>' . (TWIMH::is_mobile() ? 'Is mobile' : 'Is not mobile') . '</strong><br>';533 //echo '</div>';534 //foreach ($this->sections as $section) {535 //$mode = $instance['twim_visibility_' . $section . '_mode'] ?? 'none';536 //$items = $instance['twim_visibility_' . $section . '_items'] ?? [];537 //echo '<div class="twim-debug-section section-' . esc_attr($section) . '" style="border-top: 1px dashed gray;padding: 10px;">';538 //echo esc_html(ucfirst($section)) . ' Mode: <strong>' . esc_html($mode) . '</strong><br>';539 //echo esc_html(ucfirst($section)) . ' Items: <strong>' . implode(', ', array_map('esc_html', (array)$items)) . '</strong><br>';540 //echo '</div>';541 //}542 //echo '</div>';543 544 //return $instance;545 //}520 public function maybe_append_debug_info($instance, $widget, $args) 521 { 522 $id_base = $widget->id_base; 523 $widget_id = $widget->id; 524 525 echo '<div class="twim-debug-info" style="border:1px dashed red; padding:5px; font-size:11px; margin-top:5px;">'; 526 echo '<div class="twim-debug-section" style="padding: 10px;">'; 527 echo 'Widget ID: <strong>' . esc_html($widget_id) . '</strong><br>'; 528 echo 'ID Base: <strong>' . esc_html($id_base) . '</strong><br>'; 529 if (isset($instance['twim_visibility_andor'])) { 530 echo 'Visibility AND/OR: <strong>' . esc_html($instance['twim_visibility_andor']) . '</strong><br>'; 531 } 532 echo 'wp_is_mobile() : <strong>' . (TWIMH::is_mobile() ? 'Is mobile' : 'Is not mobile') . '</strong><br>'; 533 echo '</div>'; 534 foreach ($this->sections as $section) { 535 $mode = $instance['twim_visibility_' . $section . '_mode'] ?? 'none'; 536 $items = $instance['twim_visibility_' . $section . '_items'] ?? []; 537 echo '<div class="twim-debug-section section-' . esc_attr($section) . '" style="border-top: 1px dashed gray;padding: 10px;">'; 538 echo esc_html(ucfirst($section)) . ' Mode: <strong>' . esc_html($mode) . '</strong><br>'; 539 echo esc_html(ucfirst($section)) . ' Items: <strong>' . implode(', ', array_map('esc_html', (array)$items)) . '</strong><br>'; 540 echo '</div>'; 541 } 542 echo '</div>'; 543 544 return $instance; 545 } 546 546 547 547 … … 621 621 private function match_section($section, $items) 622 622 { 623 if ( empty($items )) return false; 624 623 625 $post_id = get_the_ID(); 624 626 $post_type = get_post_type($post_id); … … 633 635 break; 634 636 case 'posts': 635 $post_type = $args['post_type'] ?? get_post_type(); 636 return in_array($post_type, $items); 637 return is_singular($items); 637 638 break; 638 639 case 'archives': -
tiny-widget-manager/trunk/readme.txt
r3335585 r3335603 6 6 Tested up to: 6.8 7 7 Requires PHP: 7.4 8 Stable tag: 1.0. 08 Stable tag: 1.0.1 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 85 85 * Initial release with support for page, post type, archive, user, and device-based visibility rules 86 86 * Added input for applying custom CSS classes to widgets 87 = 1.0.1 = 88 * Bug fix for post type = "post" also accepted for "post" archives 87 89 88 90 == Upgrade Notice == … … 90 92 = 1.0.0 = 91 93 First stable version. No upgrade steps required. 94 95
Note: See TracChangeset
for help on using the changeset viewer.