| @@ -1,17 +1,17 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -namespace PXLBSAdminify\Inc\Classes; | |
| 3 | +namespace WPAdminify\Inc\Classes; | |
| 4 | 4 | |
| 5 | -use PXLBSAdminify\Inc\Utils; | |
| 6 | -use PXLBSAdminify\Inc\Admin\AdminSettings; | |
| 7 | -use PXLBSAdminify\Inc\Modules\MenuEditor\MenuEditorOptions; | |
| 5 | +use WPAdminify\Inc\Utils; | |
| 6 | +use WPAdminify\Inc\Admin\AdminSettings; | |
| 7 | +use WPAdminify\Inc\Modules\MenuEditor\MenuEditorOptions; | |
| 8 | 8 | // no direct access allowed |
| 9 | 9 | if ( !defined( 'ABSPATH' ) ) { |
| 10 | 10 | exit; |
| 11 | 11 | } |
| 12 | 12 | /** |
| 13 | - * PXLBSAdminify | |
| 13 | + * WPAdminify | |
| 14 | 14 | * Third Party Plugins Compatibility |
| 15 | 15 | * |
| 16 | 16 | * @author Jewel Theme <support@jeweltheme.com> |
| 17 | 17 | */ |
| @@ -22,77 +22,14 @@ | ||
| 22 | 22 | $this->menu_settings = ( new MenuEditorOptions() )->get(); |
| 23 | 23 | add_action( 'init', [$this, 'register_actions_on_init'], 0 ); |
| 24 | 24 | add_action( 'admin_init', [$this, 'register_actions_on_admin_init'], 0 ); |
| 25 | 25 | // 24-3-24 |
| 26 | - add_action( 'admin_enqueue_scripts', [$this, 'reset_theme_conflicts'], 999999 ); | |
| 26 | + add_action( 'admin_enqueue_scripts', [$this, 'jltwp_adminify_reset_theme_conflicts'], 999999 ); | |
| 27 | 27 | // 28-6-24 |
| 28 | - add_action( 'admin_head', [$this, 'plugin_conflicts'], 999999 ); | |
| 29 | - // Inject layout-tightening CSS INTO the block editor iframe (parent CSS | |
| 30 | - // cannot reach inside). Closes the huge top gap between the editor toolbar | |
| 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'] ); | |
| 33 | - if ( Utils::is_plugin_active( 'gravityforms/gravityforms.php' ) ) { | |
| 34 | - add_filter( | |
| 35 | - 'update_footer', | |
| 36 | - [$this, 'change_admin_footer'], | |
| 37 | - 9999, | |
| 38 | - 3 | |
| 39 | - ); | |
| 40 | - } | |
| 41 | - // All Fluent Plugin Assets Supports | |
| 42 | - $this->whitelist_assets_in_fluent_plugins(); | |
| 28 | + add_action( 'admin_head', [$this, 'jltwp_adminify_plugin_conflicts'], 999999 ); | |
| 43 | 29 | } |
| 44 | 30 | |
| 45 | - /** | |
| 46 | - * Whitelist Adminify assets in Fluent ecosystem no-conflict mode. | |
| 47 | - * | |
| 48 | - * Fluent Boards, Fluent Booking, Fluent CRM, Fluent Community, Fluent Forms, | |
| 49 | - * and Fluent Snippets (easy-code-manager) iterate $wp_scripts->queue on their | |
| 50 | - * admin pages and dequeue every plugin script whose src isn't in their approved | |
| 51 | - * slug list. Without this whitelist, Adminify's frame-adminify--admin script is | |
| 52 | - * stripped, leaving an empty React mount (white screen). | |
| 53 | - */ | |
| 54 | - public function whitelist_assets_in_fluent_plugins() { | |
| 55 | - $add_regex = function ( $slugs ) { | |
| 56 | - $slugs[] = '\\/adminify\\/'; | |
| 57 | - return $slugs; | |
| 58 | - }; | |
| 59 | - if ( Utils::is_plugin_active( 'fluent-boards/fluent-boards.php' ) ) { | |
| 60 | - add_filter( 'fluent_boards/asset_listed_slugs', $add_regex ); | |
| 61 | - } | |
| 62 | - if ( Utils::is_plugin_active( 'fluent-booking/fluent-booking.php' ) ) { | |
| 63 | - add_filter( 'fluent_booking/asset_listed_slugs', $add_regex ); | |
| 64 | - } | |
| 65 | - if ( Utils::is_plugin_active( 'fluent-crm/fluent-crm.php' ) ) { | |
| 66 | - add_filter( 'fluent_crm_asset_listed_slugs', $add_regex ); | |
| 67 | - } | |
| 68 | - if ( Utils::is_plugin_active( 'fluent-community/fluent-community.php' ) ) { | |
| 69 | - add_filter( 'fluent_community/asset_listed_slugs', $add_regex ); | |
| 70 | - add_filter( 'fluent_com_editor/asset_listed_slugs', $add_regex ); | |
| 71 | - } | |
| 72 | - if ( Utils::is_plugin_active( 'easy-code-manager/easy-code-manager.php' ) ) { | |
| 73 | - add_filter( 'fluent_snippets_asset_listed_slugs', $add_regex ); | |
| 74 | - } | |
| 75 | - if ( Utils::is_plugin_active( 'fluentform/fluentform.php' ) ) { | |
| 76 | - add_filter( 'fluentform/exclude_js_slugs_from_dequeue', function ( $slugs ) { | |
| 77 | - $slugs[] = 'adminify'; | |
| 78 | - return $slugs; | |
| 79 | - } ); | |
| 80 | - } | |
| 81 | - } | |
| 82 | - | |
| 83 | - /** | |
| 84 | - * Gravity Form Custom Footer missing div closing support | |
| 85 | - */ | |
| 86 | - public function change_admin_footer( $footer_text ) { | |
| 87 | - $current_screen = get_current_screen(); | |
| 88 | - if ( !empty( $current_screen ) && ($current_screen->id === 'toplevel_page_gf_edit_forms' || $current_screen->id === 'forms_page_gf_new_form') ) { | |
| 89 | - return $footer_text . '</div>'; | |
| 90 | - } | |
| 91 | - return $footer_text; | |
| 92 | - } | |
| 93 | - | |
| 94 | - public function plugin_conflicts() { | |
| 31 | + public function jltwp_adminify_plugin_conflicts() { | |
| 95 | 32 | $adminify_ui = AdminSettings::get_instance()->get( 'admin_ui' ); |
| 96 | 33 | if ( !empty( $adminify_ui ) ) { |
| 97 | 34 | // Motopress Hotel Booking Lite |
| 98 | 35 | if ( Utils::is_plugin_active( 'motopress-hotel-booking-lite/motopress-hotel-booking.php' ) ) { |
| @@ -106,66 +43,17 @@ | ||
| 106 | 43 | border-left-color: inherit !important; |
| 107 | 44 | } |
| 108 | 45 | </style>'; |
| 109 | 46 | } |
| 110 | - // Fluent Support | |
| 111 | - if ( Utils::is_plugin_active( 'fluent-support/fluent-support.php' ) ) { | |
| 112 | - echo '<style> | |
| 113 | - body.adminify-ui .fs_main_navbar{width:100%;top:0;left:0;} | |
| 114 | - </style>'; | |
| 115 | - } | |
| 116 | - // Fluent Affiliate | |
| 117 | - if ( Utils::is_plugin_active( 'fluent-affiliate/fluent-affiliate.php' ) ) { | |
| 118 | - echo '<style> | |
| 119 | - body.adminify-ui #fluent-affiliate-app #fa_aff_menu {top:0;} | |
| 120 | - </style>'; | |
| 121 | - } | |
| 122 | - // Fluent Cart | |
| 123 | - if ( Utils::is_plugin_active( 'fluent-cart/fluent-cart.php' ) ) { | |
| 124 | - echo '<style> | |
| 125 | - body.adminify-ui #wpbody-content #fct_admin_menu_holder .fct_admin_menu_wrap {width:100%;top:0;left:0;} | |
| 126 | - </style>'; | |
| 127 | - } | |
| 128 | - // Fluent CRM | |
| 129 | - if ( Utils::is_plugin_active( 'fluent-crm/fluent-crm.php' ) ) { | |
| 130 | - echo '<style> | |
| 131 | - .wp-adminify.adminify-ui .fcrm_topbar {top:0;} | |
| 132 | - </style>'; | |
| 133 | - } | |
| 134 | - // WP 7.0+ Command Palette: kill the focus border on the cmdk input | |
| 135 | - // (Adminify UI input styles bleed in) and wire the Adminify topbar | |
| 136 | - // item (#adminify-top-menu-command-palette) to open the palette. | |
| 47 | + } | |
| 48 | + if ( Utils::is_plugin_active( 'squirrly-seo/squirrly.php' ) ) { | |
| 137 | 49 | echo '<style> |
| 138 | - .wp-adminify .commands-command-menu__container input[cmdk-input], | |
| 139 | - .wp-adminify .commands-command-menu__container input[cmdk-input]:focus, | |
| 140 | - .wp-adminify .commands-command-menu__container input[cmdk-input]:focus-visible { | |
| 141 | - border: 0 !important; | |
| 142 | - outline: 0 !important; | |
| 143 | - box-shadow: none !important; | |
| 144 | - } | |
| 145 | - </style>'; | |
| 146 | - $pxlbsadminify_cmdk_js = "(function(){function openCmd(){try{if(window.wp&&wp.data&&wp.data.dispatch('core/commands')){wp.data.dispatch('core/commands').open();return;}}catch(e){}var isMac=/Mac|iPod|iPhone|iPad/.test(navigator.platform);document.dispatchEvent(new KeyboardEvent('keydown',{key:'k',code:'KeyK',keyCode:75,which:75,ctrlKey:!isMac,metaKey:isMac,bubbles:true,cancelable:true}));}document.addEventListener('click',function(e){var t=e.target&&e.target.closest&&e.target.closest('#adminify-top-menu-command-palette a, .adminify-top-menu-command-palette a');if(!t)return;e.preventDefault();openCmd();});}());"; | |
| 147 | - if ( function_exists( 'wp_print_inline_script_tag' ) ) { | |
| 148 | - wp_print_inline_script_tag( $pxlbsadminify_cmdk_js ); | |
| 149 | - } else { | |
| 150 | - echo '<script>' . $pxlbsadminify_cmdk_js . '</script>'; | |
| 151 | - // phpcs:ignore WordPress.WP.EnqueuedResources | |
| 50 | + .wp-adminify.adminify-ui.block-editor-page .interface-interface-skeleton { | |
| 51 | + top: 0 !important; | |
| 152 | 52 | } |
| 153 | - // WP 7.0 block editor interface skeleton: pin to 0/0 inside Adminify UI. | |
| 154 | - // WP's default left/top offsets are for the WP admin bar + sidebar which | |
| 155 | - // Adminify hides — without this, the editor shifts off-origin. | |
| 156 | - echo '<style> | |
| 157 | - body.wp-adminify.adminify-ui .editor-editor-interface.edit-post-layout.interface-interface-skeleton, | |
| 158 | - body.wp-adminify.adminify-ui .interface-interface-skeleton { | |
| 159 | - left: 0 !important; | |
| 160 | - top: 0 !important; | |
| 161 | - } | |
| 162 | - </style>'; | |
| 53 | + </style>'; | |
| 163 | 54 | } |
| 164 | - if ( Utils::is_plugin_active( 'squirrly-seo/squirrly.php' ) ) { | |
| 165 | - // kept as-is for squirrly compat; the generic adminify-ui rule below covers all editor pages | |
| 166 | - } | |
| 167 | - if ( Utils::is_plugin_active( 'surecart/surecart.php' ) || Utils::is_plugin_active( 'suremember/suremember.php' ) ) { | |
| 55 | + if ( Utils::is_plugin_active( 'surecart / surecart.php' ) || Utils::is_plugin_active( 'suremember/suremember.php' ) ) { | |
| 168 | 56 | if ( !empty( $adminify_ui ) ) { |
| 169 | 57 | echo '<style> |
| 170 | 58 | .css-wa3qun,.backdrop-blur-sm { |
| 171 | 59 | top: 0 !important; |
| @@ -195,9 +83,9 @@ | ||
| 195 | 83 | </style>'; |
| 196 | 84 | } |
| 197 | 85 | if ( Utils::is_plugin_active( 'advanced-access-manager/aam.php' ) ) { |
| 198 | 86 | add_filter( |
| 199 | - 'pxlbsadminify_menu_option_compatibility_filter', | |
| 87 | + 'jltwp_adminify_menu_option_compatibility_filter', | |
| 200 | 88 | array($this, 'apply_menu_restrictions_via_filter'), |
| 201 | 89 | 10, |
| 202 | 90 | 2 |
| 203 | 91 | ); |
| @@ -222,10 +110,9 @@ | ||
| 222 | 110 | } |
| 223 | 111 | if ( Utils::is_plugin_active( 'shopengine/shopengine.php' ) ) { |
| 224 | 112 | global $pagenow; |
| 225 | 113 | // e.g. "edit.php" |
| 226 | - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change. | |
| 227 | - $post_type = ( isset( $_GET['post_type'] ) ? sanitize_key( wp_unslash( $_GET['post_type'] ) ) : '' ); | |
| 114 | + $post_type = ( isset( $_GET['post_type'] ) ? sanitize_key( $_GET['post_type'] ) : '' ); | |
| 228 | 115 | // Build the slug |
| 229 | 116 | $slug = ( $post_type ? "{$pagenow}?post_type={$post_type}" : $pagenow ); |
| 230 | 117 | // Example usage: |
| 231 | 118 | if ( $slug === 'edit.php?post_type=shopengine-template' ) { |
| @@ -237,117 +124,8 @@ | ||
| 237 | 124 | } |
| 238 | 125 | </style>'; |
| 239 | 126 | } |
| 240 | 127 | } |
| 241 | - if ( Utils::is_plugin_active( 'breeze/breeze.php' ) ) { | |
| 242 | - echo '<script> | |
| 243 | - jQuery(document).ready(function($) { | |
| 244 | - | |
| 245 | - const iframe = document.getElementById("frame-adminify-app--iframe"); | |
| 246 | - | |
| 247 | - const fileBtn = document.getElementById("adminify-top-menu-breeze-purge-file-group"); | |
| 248 | - const objectCacheBtn = document.getElementById("adminify-top-menu-breeze-purge-object-cache-group"); | |
| 249 | - | |
| 250 | - if( fileBtn ) { | |
| 251 | - fileBtn.addEventListener("click", function (e) { | |
| 252 | - handleClickBreezeBtn("#wp-admin-bar-breeze-purge-file-group"); | |
| 253 | - }); | |
| 254 | - } | |
| 255 | - | |
| 256 | - if( objectCacheBtn ) { | |
| 257 | - objectCacheBtn.addEventListener("click", function (e) { | |
| 258 | - handleClickBreezeBtn("#wp-admin-bar-breeze-purge-object-cache-group"); | |
| 259 | - }); | |
| 260 | - } | |
| 261 | - | |
| 262 | - function handleClickBreezeBtn(selector) { | |
| 263 | - try { | |
| 264 | - const iframeDoc = iframe.contentDocument || iframe.contentWindow.document; | |
| 265 | - | |
| 266 | - // Find and click the button | |
| 267 | - const button = iframeDoc.querySelector(selector); | |
| 268 | - if (button) { | |
| 269 | - button.click(); | |
| 270 | - } | |
| 271 | - } catch (error) { | |
| 272 | - console.error("Cannot access iframe content:", error); | |
| 273 | - } | |
| 274 | - } | |
| 275 | - }); | |
| 276 | - </script>'; | |
| 277 | - } | |
| 278 | - // Redis Object Cache plugin compatibility | |
| 279 | - if ( Utils::is_plugin_active( 'redis-cache/redis-cache.php' ) ) { | |
| 280 | - $nonce = wp_create_nonce(); | |
| 281 | - $ajaxurl = esc_url( admin_url( 'admin-ajax.php' ) ); | |
| 282 | - $flushingText = __( 'Flushing cache...', 'adminify' ); | |
| 283 | - echo '<script> | |
| 284 | - jQuery(document).ready(function($) { | |
| 285 | - const flushBtn = document.getElementById("adminify-top-menu-redis-cache-flush"); | |
| 286 | - const parentMenu = document.getElementById("adminify-top-menu-redis-cache"); | |
| 287 | - | |
| 288 | - if (flushBtn) { | |
| 289 | - const flushLink = flushBtn.querySelector("a"); | |
| 290 | - | |
| 291 | - flushBtn.addEventListener("click", async function(e) { | |
| 292 | - e.preventDefault(); | |
| 293 | - e.stopPropagation(); | |
| 294 | - | |
| 295 | - if (!flushLink) return; | |
| 296 | - | |
| 297 | - // Store original text | |
| 298 | - const originalText = flushLink.textContent || flushLink.innerText; | |
| 299 | - | |
| 300 | - // Close dropdown and show flushing text on parent menu | |
| 301 | - const parentLink = parentMenu ? parentMenu.querySelector("a") : null; | |
| 302 | - const parentOriginalHTML = parentLink ? parentLink.innerHTML : null; | |
| 303 | - | |
| 304 | - if (parentLink) { | |
| 305 | - parentLink.innerHTML = "' . esc_js( $flushingText ) . '"; | |
| 306 | - } | |
| 307 | - | |
| 308 | - // Close dropdown | |
| 309 | - const dropdown = flushBtn.closest(".adminify-dropdown"); | |
| 310 | - if (dropdown) { | |
| 311 | - dropdown.classList.remove("show"); | |
| 312 | - } | |
| 313 | - | |
| 314 | - try { | |
| 315 | - const data = new FormData(); | |
| 316 | - data.append("action", "roc_flush_cache"); | |
| 317 | - data.append("nonce", "' . esc_js( $nonce ) . '"); | |
| 318 | - | |
| 319 | - const response = await fetch("' . esc_url( $ajaxurl ) . '", { | |
| 320 | - method: "POST", | |
| 321 | - body: data, | |
| 322 | - }); | |
| 323 | - | |
| 324 | - const resultText = await response.text(); | |
| 325 | - | |
| 326 | - // Show result text | |
| 327 | - if (parentLink) { | |
| 328 | - parentLink.innerHTML = resultText; | |
| 329 | - } | |
| 330 | - | |
| 331 | - // Reset to original after 3 seconds | |
| 332 | - setTimeout(function() { | |
| 333 | - if (parentLink && parentOriginalHTML) { | |
| 334 | - parentLink.innerHTML = parentOriginalHTML; | |
| 335 | - } | |
| 336 | - }, 3000); | |
| 337 | - | |
| 338 | - } catch (error) { | |
| 339 | - console.error("Object cache could not be flushed:", error); | |
| 340 | - // Reset on error | |
| 341 | - if (parentLink && parentOriginalHTML) { | |
| 342 | - parentLink.innerHTML = parentOriginalHTML; | |
| 343 | - } | |
| 344 | - } | |
| 345 | - }); | |
| 346 | - } | |
| 347 | - }); | |
| 348 | - </script>'; | |
| 349 | - } | |
| 350 | 128 | } |
| 351 | 129 | |
| 352 | 130 | public function apply_menu_restrictions_via_filter( $menu_options, $menu ) { |
| 353 | 131 | $aam_options = get_option( 'aam_access_settings', [] ); |
| @@ -395,9 +173,9 @@ | ||
| 395 | 173 | } |
| 396 | 174 | return $menu_options; |
| 397 | 175 | } |
| 398 | 176 | |
| 399 | - public function reset_theme_conflicts() { | |
| 177 | + public function jltwp_adminify_reset_theme_conflicts() { | |
| 400 | 178 | global $pagenow; |
| 401 | 179 | if ( $pagenow == 'wp-login.php' || $pagenow == 'wp-register.php' || $pagenow == 'customize.php' ) { |
| 402 | 180 | return; |
| 403 | 181 | } |
| @@ -406,11 +184,11 @@ | ||
| 406 | 184 | // Neve WordPress Theme |
| 407 | 185 | if ( 'Neve' == $theme->name || 'Neve' == $theme->parent_theme ) { |
| 408 | 186 | wp_enqueue_style( |
| 409 | 187 | 'wp-adminify_neve-theme', |
| 410 | - PXLBSADMINIFY_ASSETS . 'css/themes/neve.min.css', | |
| 188 | + WP_ADMINIFY_ASSETS . 'css/themes/neve.min.css', | |
| 411 | 189 | false, |
| 412 | - PXLBSADMINIFY_VER | |
| 190 | + WP_ADMINIFY_VER | |
| 413 | 191 | ); |
| 414 | 192 | } |
| 415 | 193 | // Phlox WordPress Theme |
| 416 | 194 | if ( 'Phlox' == $theme->name || 'Phlox' == $theme->parent_theme ) { |
| @@ -477,20 +255,20 @@ | ||
| 477 | 255 | }); |
| 478 | 256 | </script>'; |
| 479 | 257 | } |
| 480 | 258 | // Third Party Plugin CSS Conflict |
| 481 | - // $pxlbsadminify_plugin_conflict_css = ''; | |
| 259 | + // $jltwp_adminify_plugin_conflict_css = ''; | |
| 482 | 260 | // if (Utils::is_plugin_active('quillforms/quillforms.php')) { |
| 483 | - // $pxlbsadminify_plugin_conflict_css = '//css code here'; | |
| 484 | - // $pxlbsadminify_plugin_conflict_css = preg_replace('#/\*.*?\*/#s', '', $pxlbsadminify_plugin_conflict_css); | |
| 485 | - // $pxlbsadminify_plugin_conflict_css = preg_replace('/\s*([{}|:;,])\s+/', '$1', $pxlbsadminify_plugin_conflict_css); | |
| 486 | - // $pxlbsadminify_plugin_conflict_css = preg_replace('/\s\s+(.*)/', '$1', $pxlbsadminify_plugin_conflict_css); | |
| 261 | + // $jltwp_adminify_plugin_conflict_css = '//css code here'; | |
| 262 | + // $jltwp_adminify_plugin_conflict_css = preg_replace('#/\*.*?\*/#s', '', $jltwp_adminify_plugin_conflict_css); | |
| 263 | + // $jltwp_adminify_plugin_conflict_css = preg_replace('/\s*([{}|:;,])\s+/', '$1', $jltwp_adminify_plugin_conflict_css); | |
| 264 | + // $jltwp_adminify_plugin_conflict_css = preg_replace('/\s\s+(.*)/', '$1', $jltwp_adminify_plugin_conflict_css); | |
| 487 | 265 | // } |
| 488 | 266 | // $adminify_ui = AdminSettings::get_instance()->get('admin_ui'); |
| 489 | 267 | // if (!empty($adminify_ui)) { |
| 490 | - // wp_add_inline_style('wp-adminify-admin', wp_strip_all_tags($pxlbsadminify_plugin_conflict_css)); | |
| 268 | + // wp_add_inline_style('wp-adminify-admin', wp_strip_all_tags($jltwp_adminify_plugin_conflict_css)); | |
| 491 | 269 | // } else { |
| 492 | - // wp_add_inline_style('wp-adminify-default-ui', wp_strip_all_tags($pxlbsadminify_plugin_conflict_css)); | |
| 270 | + // wp_add_inline_style('wp-adminify-default-ui', wp_strip_all_tags($jltwp_adminify_plugin_conflict_css)); | |
| 493 | 271 | // } |
| 494 | 272 | if ( Utils::is_plugin_active( 'stackable-ultimate-gutenberg-blocks-premium/plugin.php' ) ) { |
| 495 | 273 | echo '<style> |
| 496 | 274 | .wp-adminify.adminify-ui #wpcontent .wp-adminify.adminify-top_bar { |
| @@ -529,12 +307,8 @@ | ||
| 529 | 307 | } |
| 530 | 308 | body.wp-adminify-admin-bar.admin-bar #e-admin-top-bar-root .e-admin-top-bar{ |
| 531 | 309 | padding-left: 20px; |
| 532 | 310 | } |
| 533 | - | |
| 534 | - body.adminify-ui.e-has-sidebar-navigation #wpwrap #wpcontent #editor-one-top-bar > header { | |
| 535 | - top: 0!important; | |
| 536 | - } | |
| 537 | 311 | </style>'; |
| 538 | 312 | } |
| 539 | 313 | if ( Utils::is_plugin_active( 'one-click-demo-import/one-click-demo-import.php' ) ) { |
| 540 | 314 | echo '<style> |
| @@ -543,9 +317,9 @@ | ||
| 543 | 317 | } |
| 544 | 318 | </style>'; |
| 545 | 319 | } |
| 546 | 320 | if ( Utils::is_plugin_active( 'wpforms-lite/wpforms.php' ) ) { |
| 547 | - if ( Utils::currentpage_id( 'dashboard' ) ) { | |
| 321 | + if ( Utils::jltwp_adminify_currentpage_id( 'dashboard' ) ) { | |
| 548 | 322 | wp_enqueue_style( |
| 549 | 323 | 'wpforms-full', |
| 550 | 324 | WPFORMS_PLUGIN_URL . 'assets/css/frontend/classic/wpforms-full.css', |
| 551 | 325 | [], |
| @@ -630,52 +404,8 @@ | ||
| 630 | 404 | } |
| 631 | 405 | </style>'; |
| 632 | 406 | } |
| 633 | 407 | } |
| 634 | - // Divi Theme - "Edit With Divi" link should reload parent page instead of iframe | |
| 635 | - if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme ) { | |
| 636 | - echo '<script> | |
| 637 | - document.addEventListener("DOMContentLoaded", function() { | |
| 638 | - var iframe = document.getElementById("frame-adminify-app--iframe"); | |
| 639 | - if (!iframe) return; | |
| 640 | - | |
| 641 | - function handleDiviLinks(iframeDoc) { | |
| 642 | - var diviLinks = iframeDoc.querySelectorAll("a[href*=\\"et_fb=1\\"], a.et_pb_toggle_builder_wrapper, a[href*=\\"page=et_divi_options\\"]"); | |
| 643 | - diviLinks.forEach(function(link) { | |
| 644 | - link.addEventListener("click", function(e) { | |
| 645 | - e.preventDefault(); | |
| 646 | - e.stopPropagation(); | |
| 647 | - window.top.location.href = link.href; | |
| 648 | - }); | |
| 649 | - }); | |
| 650 | - } | |
| 651 | - | |
| 652 | - iframe.addEventListener("load", function() { | |
| 653 | - try { | |
| 654 | - var iframeDoc = iframe.contentDocument || iframe.contentWindow.document; | |
| 655 | - handleDiviLinks(iframeDoc); | |
| 656 | - | |
| 657 | - var observer = new MutationObserver(function() { | |
| 658 | - handleDiviLinks(iframeDoc); | |
| 659 | - }); | |
| 660 | - observer.observe(iframeDoc.body, { childList: true, subtree: true }); | |
| 661 | - } catch(e) { | |
| 662 | - console.log("Divi compatibility: Cannot access iframe content"); | |
| 663 | - } | |
| 664 | - }); | |
| 665 | - }); | |
| 666 | - </script>'; | |
| 667 | - echo '<style> | |
| 668 | - #adminify-top-menu-et-builder-shortcode-framework, | |
| 669 | - #adminify-top-menu-et-builder-shortcode-framework-loaded, | |
| 670 | - #adminify-top-menu-et-builder-shortcode-framework-option, | |
| 671 | - #adminify-top-menu-et-builder-shortcode-framework-constant, | |
| 672 | - #adminify-top-menu-et-builder-shortcode-framework-hook, | |
| 673 | - #adminify-top-menu-et-builder-shortcode-framework-constant-value { | |
| 674 | - display: none; | |
| 675 | - } | |
| 676 | - </style>'; | |
| 677 | - } | |
| 678 | 408 | if ( Utils::is_plugin_active( 'js_composer/js_composer.php' ) ) { |
| 679 | 409 | echo '<style> |
| 680 | 410 | .adminify-ui .vc_dropdown-list-item p{ |
| 681 | 411 | color: #fff; |
| @@ -682,9 +412,9 @@ | ||
| 682 | 412 | } |
| 683 | 413 | </style>'; |
| 684 | 414 | } |
| 685 | 415 | // Third Party localize script |
| 686 | - wp_localize_script( 'adminify-admin', 'PXLBSADMINIFY_THIRDPARTY', $this->thirdparty_create_js_object() ); | |
| 416 | + wp_localize_script( 'wp-adminify-admin', 'WPAdminify_ThirdParty', $this->thirdparty_create_js_object() ); | |
| 687 | 417 | } |
| 688 | 418 | |
| 689 | 419 | public function thirdparty_create_js_object() { |
| 690 | 420 | // betterlinks menu settings |
| @@ -713,12 +443,11 @@ | ||
| 713 | 443 | } |
| 714 | 444 | |
| 715 | 445 | public function register_actions_on_init() { |
| 716 | 446 | // Brizy Builder |
| 717 | - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change. | |
| 718 | 447 | if ( isset( $_REQUEST['brizy-edit-iframe'] ) ) { |
| 719 | - add_filter( 'pxlbsadminify_defer_skip', '__return_true' ); | |
| 720 | - add_filter( 'pxlbsadminify_skip_removing_dashicons', '__return_true' ); | |
| 448 | + add_filter( 'wp_adminify_defer_skip', '__return_true' ); | |
| 449 | + add_filter( 'wp_adminify_skip_removing_dashicons', '__return_true' ); | |
| 721 | 450 | } |
| 722 | 451 | } |
| 723 | 452 | |
| 724 | 453 | public function register_actions_on_admin_init() { |
| @@ -727,9 +456,9 @@ | ||
| 727 | 456 | // Commented On: 24-3-24 |
| 728 | 457 | add_action( 'admin_enqueue_scripts', [$this, 'enqueue_scripts'], 999 ); |
| 729 | 458 | } |
| 730 | 459 | // Commented On: 10-6-24 |
| 731 | - // add_filter('pxlbsadminify_third_party_styles', [$this, 'register_compatability_styles']); | |
| 460 | + // add_filter('adminify_third_party_styles', [$this, 'register_compatability_styles']); | |
| 732 | 461 | // Fluent CRM |
| 733 | 462 | add_action( 'fluentcrm_skip_no_conflict', '__return_true' ); |
| 734 | 463 | // Fluent FORM |
| 735 | 464 | add_action( 'fluentform_skip_no_conflict', '__return_true' ); |
| @@ -743,10 +472,10 @@ | ||
| 743 | 472 | public function register_compatability_styles( $plugin_supports ) { |
| 744 | 473 | if ( !is_array( $plugin_supports ) ) { |
| 745 | 474 | $plugin_supports = []; |
| 746 | 475 | } |
| 747 | - $plugin_dir = PXLBSADMINIFY_ASSETS . 'css/plugins/'; | |
| 748 | - $plugin_files = list_files( PXLBSADMINIFY_PATH . 'assets/css/plugins/', 1 ); | |
| 476 | + $plugin_dir = WP_ADMINIFY_ASSETS . 'css/plugins/'; | |
| 477 | + $plugin_files = list_files( WP_ADMINIFY_PATH . 'assets/css/plugins/', 1 ); | |
| 749 | 478 | if ( !empty( $plugin_files ) ) { |
| 750 | 479 | foreach ( $plugin_files as $file ) { |
| 751 | 480 | $plugin_supports[wp_basename( $file, '.min.css' )] = $plugin_dir . wp_basename( $file ); |
| 752 | 481 | } |
| @@ -760,9 +489,9 @@ | ||
| 760 | 489 | * @return void |
| 761 | 490 | */ |
| 762 | 491 | public function enqueue_scripts() { |
| 763 | 492 | $plugin_supports = []; |
| 764 | - $plugin_supports = apply_filters( 'pxlbsadminify_third_party_styles', $plugin_supports ); | |
| 493 | + $plugin_supports = apply_filters( 'adminify_third_party_styles', $plugin_supports ); | |
| 765 | 494 | // Check Plugin Activated for Site Wide |
| 766 | 495 | if ( is_multisite() ) { |
| 767 | 496 | $active_plugins = get_site_option( 'active_sitewide_plugins' ); |
| 768 | 497 | foreach ( $active_plugins as $active_path => $active_plugin ) { |
| @@ -771,14 +500,14 @@ | ||
| 771 | 500 | $pluginname = $string[0]; |
| 772 | 501 | if ( isset( $plugin_supports[$pluginname] ) ) { |
| 773 | 502 | if ( $plugin_supports[$pluginname] != '' ) { |
| 774 | 503 | wp_register_style( |
| 775 | - 'adminify_site-wide_' . $pluginname . '_css', | |
| 504 | + 'wp-adminify_site-wide_' . $pluginname . '_css', | |
| 776 | 505 | $plugin_supports[$pluginname], |
| 777 | 506 | [], |
| 778 | - PXLBSADMINIFY_VER | |
| 507 | + WP_ADMINIFY_VER | |
| 779 | 508 | ); |
| 780 | - wp_enqueue_style( 'adminify_site-wide_' . $pluginname . '_css' ); | |
| 509 | + wp_enqueue_style( 'wp-adminify_site-wide_' . $pluginname . '_css' ); | |
| 781 | 510 | } |
| 782 | 511 | } |
| 783 | 512 | } |
| 784 | 513 | } |
| @@ -791,45 +520,17 @@ | ||
| 791 | 520 | $pluginname = $string[0]; |
| 792 | 521 | if ( isset( $plugin_supports[$pluginname] ) ) { |
| 793 | 522 | if ( $plugin_supports[$pluginname] != '' ) { |
| 794 | 523 | wp_register_style( |
| 795 | - 'adminify_' . $pluginname . '_css', | |
| 524 | + 'wp-adminify_' . $pluginname . '_css', | |
| 796 | 525 | $plugin_supports[$pluginname], |
| 797 | 526 | [], |
| 798 | - PXLBSADMINIFY_VER | |
| 527 | + WP_ADMINIFY_VER | |
| 799 | 528 | ); |
| 800 | - wp_enqueue_style( 'adminify_' . $pluginname . '_css' ); | |
| 529 | + wp_enqueue_style( 'wp-adminify_' . $pluginname . '_css' ); | |
| 801 | 530 | } |
| 802 | 531 | } |
| 803 | 532 | } |
| 804 | 533 | } |
| 805 | - } | |
| 806 | - | |
| 807 | - /** | |
| 808 | - * Inject layout-tightening CSS INTO the WP 6.3+/7.0 block editor iframe canvas. | |
| 809 | - * | |
| 810 | - * The Gutenberg canvas runs inside an iframe; styles enqueued via | |
| 811 | - * `enqueue_block_editor_assets` only reach the parent admin chrome. The | |
| 812 | - * `block_editor_settings_all` `styles` array IS injected into the iframe. | |
| 813 | - * | |
| 814 | - * The default Gutenberg post-title wrapper carries large block padding which, | |
| 815 | - * inside Adminify's iframe wrapper (already framed by topbar + sidebar), | |
| 816 | - * reads as a huge dead area between the editor toolbar and "Add title". | |
| 817 | - * Compress that wrapper + leading content padding so the title sits close | |
| 818 | - * under the toolbar. | |
| 819 | - */ | |
| 820 | - public function block_editor_iframe_layout_tweaks( $settings ) { | |
| 821 | - // Iframe body padding (Gutenberg ~50-60px default) + root container's first-child | |
| 822 | - // margin-block-start are the two real sources of the gap above "Add title". | |
| 823 | - // Multiple selectors cover WP 6.x ("edit-post-*") and WP 7.0+ ("editor-*", new | |
| 824 | - // "block-editor-iframe__body" body class on the iframe) class renames. | |
| 825 | - $css = 'html body.block-editor-iframe__body,' . 'html body.editor-styles-wrapper,' . '.block-editor-iframe__body,' . '.editor-styles-wrapper{padding-top:12px !important;margin-top:0 !important;}' . '.is-root-container,' . '.editor-styles-wrapper>.is-root-container,' . '.block-editor-block-list__layout.is-root-container,' . '.is-root-container.is-layout-flow,' . '.is-root-container.is-layout-constrained{padding-top:0 !important;margin-top:0 !important;}' . '.is-root-container>*:first-child,' . '.is-root-container>[data-block]:first-child,' . '.editor-styles-wrapper>[data-block]:first-child,' . '.editor-styles-wrapper>.wp-block:first-child{margin-block-start:0 !important;margin-top:0 !important;padding-top:0 !important;}' . '.wp-block-post-title,' . 'h1.wp-block-post-title,' . '.editor-post-title,' . 'h1.editor-post-title,' . '.editor-post-title__input,' . 'h1.editor-post-title__input{margin:0 !important;margin-block-start:0 !important;padding-top:0 !important;}' . '.edit-post-visual-editor,' . '.editor-visual-editor,' . '.edit-post-visual-editor__post-title-wrapper,' . '.editor-visual-editor__post-title-wrapper,' . '.edit-post-visual-editor__content-area,' . '.editor-visual-editor__content-area{padding-top:0 !important;margin-top:0 !important;}'; | |
| 826 | - if ( !isset( $settings['styles'] ) || !is_array( $settings['styles'] ) ) { | |
| 827 | - $settings['styles'] = array(); | |
| 828 | - } | |
| 829 | - $settings['styles'][] = array( | |
| 830 | - 'css' => $css, | |
| 831 | - ); | |
| 832 | - return $settings; | |
| 833 | 534 | } |
| 834 | 535 | |
| 835 | 536 | } |