| @@ -28,9 +28,9 @@ | ||
| 28 | 28 | add_action( 'admin_head', [$this, 'plugin_conflicts'], 999999 ); |
| 29 | 29 | // Inject layout-tightening CSS INTO the block editor iframe (parent CSS |
| 30 | 30 | // cannot reach inside). Closes the huge top gap between the editor toolbar |
| 31 | 31 | // and the post title that's amplified inside the Adminify iframe wrapper. |
| 32 | - add_filter( 'block_editor_settings_all', [$this, 'block_editor_iframe_layout_tweaks'] ); | |
| 32 | + // add_filter('block_editor_settings_all', [$this, 'block_editor_iframe_layout_tweaks']); // TODO: comment because not product this issue. if we product this issue then think about why create this this and solve it all type of users | |
| 33 | 33 | if ( Utils::is_plugin_active( 'gravityforms/gravityforms.php' ) ) { |
| 34 | 34 | add_filter( |
| 35 | 35 | 'update_footer', |
| 36 | 36 | [$this, 'change_admin_footer'], |
| @@ -37,8 +37,10 @@ | ||
| 37 | 37 | 9999, |
| 38 | 38 | 3 |
| 39 | 39 | ); |
| 40 | 40 | } |
| 41 | + // YITH Plugin Framework panels rendered on WP list pages. | |
| 42 | + add_action( 'in_admin_header', [$this, 'reorder_notice_wrapper_for_yith_panel'], 0 ); | |
| 41 | 43 | // All Fluent Plugin Assets Supports |
| 42 | 44 | $this->whitelist_assets_in_fluent_plugins(); |
| 43 | 45 | } |
| 44 | 46 | |
| @@ -90,8 +92,62 @@ | ||
| 90 | 92 | } |
| 91 | 93 | return $footer_text; |
| 92 | 94 | } |
| 93 | 95 | |
| 96 | + /** | |
| 97 | + * YITH Plugin Framework panel pages (YITH WooCommerce Multi Vendor, Booking, | |
| 98 | + * Membership, ... — anything using plugin-fw) render blank while the | |
| 99 | + * "Hide Admin Notices" option is on. | |
| 100 | + * | |
| 101 | + * YIT_Plugin_Panel::print_panel_tabs_in_wp_pages() hooks all_admin_notices at | |
| 102 | + * priority 10 and opens page wrapper <div>s on purpose — they stay open until | |
| 103 | + * admin_footer. Adminify closes its own .adminify-notices-wrapper on | |
| 104 | + * all_admin_notices at priority 99999999, so that </div> lands inside YITH's | |
| 105 | + * markup and closes YITH's .wrap instead. The notice wrapper then never closes | |
| 106 | + * and swallows the rest of the page, which Adminify hides through | |
| 107 | + * `.adminify-notices-wrapper > *:not(...) { display: none !important; }`. | |
| 108 | + * | |
| 109 | + * Fix: close the notice wrapper before YITH opens its own markup, so both | |
| 110 | + * outputs stay balanced. Notices printed after that point are not wrapped, | |
| 111 | + * which costs nothing here — plugin-fw moves every notice into its own | |
| 112 | + * #yith-plugin-fw__panel__notices box with JS on these screens anyway. | |
| 113 | + * | |
| 114 | + * @return void | |
| 115 | + */ | |
| 116 | + public function reorder_notice_wrapper_for_yith_panel() { | |
| 117 | + global $wp_filter; | |
| 118 | + if ( empty( $wp_filter['all_admin_notices'] ) || empty( $wp_filter['all_admin_notices']->callbacks ) ) { | |
| 119 | + return; | |
| 120 | + } | |
| 121 | + $hooked_callbacks = $wp_filter['all_admin_notices']->callbacks; | |
| 122 | + // Priority YITH opens its unclosed page wrapper at, if it does at all. | |
| 123 | + $yith_priority = null; | |
| 124 | + foreach ( $hooked_callbacks as $priority => $callbacks ) { | |
| 125 | + foreach ( $callbacks as $callback ) { | |
| 126 | + if ( is_array( $callback['function'] ) && isset( $callback['function'][1] ) && 'print_panel_tabs_in_wp_pages' === $callback['function'][1] ) { | |
| 127 | + $yith_priority = (int) $priority; | |
| 128 | + break 2; | |
| 129 | + } | |
| 130 | + } | |
| 131 | + } | |
| 132 | + // No YITH panel on this screen, or no room left to close before it. | |
| 133 | + if ( null === $yith_priority || $yith_priority < 1 ) { | |
| 134 | + return; | |
| 135 | + } | |
| 136 | + // Move Adminify's notice wrapper closer ahead of YITH's opening markup. | |
| 137 | + foreach ( $hooked_callbacks as $priority => $callbacks ) { | |
| 138 | + if ( (int) $priority <= $yith_priority ) { | |
| 139 | + continue; | |
| 140 | + } | |
| 141 | + foreach ( $callbacks as $callback ) { | |
| 142 | + if ( is_array( $callback['function'] ) && isset( $callback['function'][1] ) && 'finish_notice_capture' === $callback['function'][1] ) { | |
| 143 | + remove_action( 'all_admin_notices', $callback['function'], $priority ); | |
| 144 | + add_action( 'all_admin_notices', $callback['function'], $yith_priority - 1 ); | |
| 145 | + } | |
| 146 | + } | |
| 147 | + } | |
| 148 | + } | |
| 149 | + | |
| 94 | 150 | public function plugin_conflicts() { |
| 95 | 151 | $adminify_ui = AdminSettings::get_instance()->get( 'admin_ui' ); |
| 96 | 152 | if ( !empty( $adminify_ui ) ) { |
| 97 | 153 | // Motopress Hotel Booking Lite |
| @@ -159,8 +215,22 @@ | ||
| 159 | 215 | left: 0 !important; |
| 160 | 216 | top: 0 !important; |
| 161 | 217 | } |
| 162 | 218 | </style>'; |
| 219 | + // WPML (sitepress-multilingual-cms) admin language switcher | |
| 220 | + // (#WPML_ALS) is mirrored into the Adminify topbar. Its language | |
| 221 | + // links otherwise switch inside the iframe, so the parent admin | |
| 222 | + // chrome keeps the old language. Force a full top-window reload to | |
| 223 | + // the chosen language URL so the whole admin re-renders. | |
| 224 | + if ( Utils::is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' ) ) { | |
| 225 | + $pxlbsadminify_wpml_js = "(function(){document.addEventListener('click',function(e){var li=e.target&&e.target.closest&&e.target.closest('[id^=\"adminify-top-menu-WPML_ALS_\"]');if(!li)return;var a=li.querySelector('a')||(e.target.closest('a'));if(!a)return;var href=a.getAttribute('href')||a.href;if(!href||href==='#')return;e.preventDefault();e.stopPropagation();window.top.location.href=href;},true);}());"; | |
| 226 | + if ( function_exists( 'wp_print_inline_script_tag' ) ) { | |
| 227 | + wp_print_inline_script_tag( $pxlbsadminify_wpml_js ); | |
| 228 | + } else { | |
| 229 | + echo '<script>' . $pxlbsadminify_wpml_js . '</script>'; | |
| 230 | + // phpcs:ignore WordPress.WP.EnqueuedResources | |
| 231 | + } | |
| 232 | + } | |
| 163 | 233 | } |
| 164 | 234 | if ( Utils::is_plugin_active( 'squirrly-seo/squirrly.php' ) ) { |
| 165 | 235 | // kept as-is for squirrly compat; the generic adminify-ui rule below covers all editor pages |
| 166 | 236 | } |
| @@ -533,8 +603,9 @@ | ||
| 533 | 603 | |
| 534 | 604 | body.adminify-ui.e-has-sidebar-navigation #wpwrap #wpcontent #editor-one-top-bar > header { |
| 535 | 605 | top: 0!important; |
| 536 | 606 | } |
| 607 | + body.adminify-ui #wpbody-content #elementor-home-app main header {top: 0!important} | |
| 537 | 608 | </style>'; |
| 538 | 609 | } |
| 539 | 610 | if ( Utils::is_plugin_active( 'one-click-demo-import/one-click-demo-import.php' ) ) { |
| 540 | 611 | echo '<style> |