| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPAdminify\Inc\Classes; |
| 4 |
|
| 5 |
use WPAdminify\Inc\Utils; |
| 6 |
use WPAdminify\Inc\Admin\AdminSettings; |
| 7 |
use WPAdminify\Inc\Modules\MenuEditor\MenuEditorOptions; |
| 8 |
// no direct access allowed |
| 9 |
if ( !defined( 'ABSPATH' ) ) { |
| 10 |
exit; |
| 11 |
} |
| 12 |
/** |
| 13 |
* WPAdminify |
| 14 |
* Third Party Plugins Compatibility |
| 15 |
* |
| 16 |
* @author Jewel Theme <support@jeweltheme.com> |
| 17 |
*/ |
| 18 |
class ThirdPartyCompatibility { |
| 19 |
public $menu_settings; |
| 20 |
|
| 21 |
public function __construct() { |
| 22 |
$this->menu_settings = ( new MenuEditorOptions() )->get(); |
| 23 |
add_action( 'init', [$this, 'register_actions_on_init'], 0 ); |
| 24 |
add_action( 'admin_init', [$this, 'register_actions_on_admin_init'], 0 ); |
| 25 |
// 24-3-24 |
| 26 |
add_action( 'admin_enqueue_scripts', [$this, 'jltwp_adminify_reset_theme_conflicts'], 999999 ); |
| 27 |
// 28-6-24 |
| 28 |
add_action( 'admin_head', [$this, 'jltwp_adminify_plugin_conflicts'], 999999 ); |
| 29 |
} |
| 30 |
|
| 31 |
public function jltwp_adminify_plugin_conflicts() { |
| 32 |
$adminify_ui = AdminSettings::get_instance()->get( 'admin_ui' ); |
| 33 |
if ( !empty( $adminify_ui ) ) { |
| 34 |
// Motopress Hotel Booking Lite |
| 35 |
if ( Utils::is_plugin_active( 'motopress-hotel-booking-lite/motopress-hotel-booking.php' ) ) { |
| 36 |
echo '<style> |
| 37 |
.wp-adminify.bookings_page_mphb_calendar .widefat thead th, |
| 38 |
.wp-adminify.bookings_page_mphb_calendar .widefat tfoot th, |
| 39 |
.wp-adminify.bookings_page_mphb_calendar .widefat tbody td { |
| 40 |
padding: 0 !important; |
| 41 |
} |
| 42 |
.adminify-ui .widefat tbody tr td:first-child { |
| 43 |
border-left-color: inherit !important; |
| 44 |
} |
| 45 |
</style>'; |
| 46 |
} |
| 47 |
} |
| 48 |
if ( Utils::is_plugin_active( 'squirrly-seo/squirrly.php' ) ) { |
| 49 |
echo '<style> |
| 50 |
.wp-adminify.adminify-ui.block-editor-page .interface-interface-skeleton { |
| 51 |
top: 0 !important; |
| 52 |
} |
| 53 |
</style>'; |
| 54 |
} |
| 55 |
if ( Utils::is_plugin_active( 'surecart / surecart.php' ) || Utils::is_plugin_active( 'suremember/suremember.php' ) ) { |
| 56 |
if ( !empty( $adminify_ui ) ) { |
| 57 |
echo '<style> |
| 58 |
.css-wa3qun,.backdrop-blur-sm { |
| 59 |
top: 0 !important; |
| 60 |
} |
| 61 |
#suremembers-settings-content::before, #sc-settings-content::before{ |
| 62 |
width: 250px !important; |
| 63 |
} |
| 64 |
</style>'; |
| 65 |
} |
| 66 |
} |
| 67 |
if ( Utils::is_plugin_active( 'advanced-database-cleaner-pro/advanced-db-cleaner.php' ) ) { |
| 68 |
echo '<style> |
| 69 |
.wp-adminify.toplevel_page_advanced_db_cleaner #wpbody-content .wp-list-table.widefat td{ |
| 70 |
padding: 10px 10px; |
| 71 |
} |
| 72 |
.wp-adminify.toplevel_page_advanced_db_cleaner #wpbody-content input#aDBc_keep_button_revision { |
| 73 |
padding: 0px 3px !important; |
| 74 |
line-height: inherit !important; |
| 75 |
} |
| 76 |
</style>'; |
| 77 |
} |
| 78 |
if ( Utils::is_plugin_active( 'insert-headers-and-footers/ihaf.php' ) ) { |
| 79 |
echo '<style> |
| 80 |
.wp-adminify .wpcode-code-type-picker, .wp-adminify .wpcode-code-type-picker-backdrop { |
| 81 |
left: 0; |
| 82 |
} |
| 83 |
</style>'; |
| 84 |
} |
| 85 |
if ( Utils::is_plugin_active( 'advanced-access-manager/aam.php' ) ) { |
| 86 |
add_filter( |
| 87 |
'jltwp_adminify_menu_option_compatibility_filter', |
| 88 |
array($this, 'apply_menu_restrictions_via_filter'), |
| 89 |
10, |
| 90 |
2 |
| 91 |
); |
| 92 |
} |
| 93 |
if ( Utils::is_plugin_active( 'meta-box/meta-box.php' ) ) { |
| 94 |
echo '<style> |
| 95 |
.adminify-ui .og.mb { |
| 96 |
left: 0; |
| 97 |
} |
| 98 |
</style>'; |
| 99 |
} |
| 100 |
if ( Utils::is_plugin_active( 'wp-security-audit-log/wp-security-audit-log.php' ) ) { |
| 101 |
echo '<script> |
| 102 |
jQuery(document).ready(function($) { |
| 103 |
$("body.wp-adminify.adminify-ui ul.frame-adminify-admin-menu li a .frame-adminify-menu-item-name").find("style").remove(); |
| 104 |
|
| 105 |
setInterval(function() { |
| 106 |
$("body.wp-adminify.adminify-ui ul.frame-adminify-admin-menu li a .frame-adminify-menu-item-name").find("style").remove(); |
| 107 |
}, 1000); |
| 108 |
}); |
| 109 |
</script>'; |
| 110 |
} |
| 111 |
if ( Utils::is_plugin_active( 'shopengine/shopengine.php' ) ) { |
| 112 |
global $pagenow; |
| 113 |
// e.g. "edit.php" |
| 114 |
$post_type = ( isset( $_GET['post_type'] ) ? sanitize_key( $_GET['post_type'] ) : '' ); |
| 115 |
// Build the slug |
| 116 |
$slug = ( $post_type ? "{$pagenow}?post_type={$post_type}" : $pagenow ); |
| 117 |
// Example usage: |
| 118 |
if ( $slug === 'edit.php?post_type=shopengine-template' ) { |
| 119 |
echo '<style> |
| 120 |
#wpfooter { |
| 121 |
position: inherit !important; |
| 122 |
display: flex; |
| 123 |
flex-direction: column-reverse; |
| 124 |
} |
| 125 |
</style>'; |
| 126 |
} |
| 127 |
} |
| 128 |
if ( Utils::is_plugin_active( 'breeze/breeze.php' ) ) { |
| 129 |
echo '<script> |
| 130 |
jQuery(document).ready(function($) { |
| 131 |
|
| 132 |
const iframe = document.getElementById("frame-adminify-app--iframe"); |
| 133 |
|
| 134 |
const fileBtn = document.getElementById("adminify-top-menu-breeze-purge-file-group"); |
| 135 |
const objectCacheBtn = document.getElementById("adminify-top-menu-breeze-purge-object-cache-group"); |
| 136 |
|
| 137 |
if( fileBtn ) { |
| 138 |
fileBtn.addEventListener("click", function (e) { |
| 139 |
handleClickBreezeBtn("#wp-admin-bar-breeze-purge-file-group"); |
| 140 |
}); |
| 141 |
} |
| 142 |
|
| 143 |
if( objectCacheBtn ) { |
| 144 |
objectCacheBtn.addEventListener("click", function (e) { |
| 145 |
handleClickBreezeBtn("#wp-admin-bar-breeze-purge-object-cache-group"); |
| 146 |
}); |
| 147 |
} |
| 148 |
|
| 149 |
function handleClickBreezeBtn(selector) { |
| 150 |
try { |
| 151 |
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document; |
| 152 |
|
| 153 |
// Find and click the button |
| 154 |
const button = iframeDoc.querySelector(selector); |
| 155 |
if (button) { |
| 156 |
button.click(); |
| 157 |
} |
| 158 |
} catch (error) { |
| 159 |
console.error("Cannot access iframe content:", error); |
| 160 |
} |
| 161 |
} |
| 162 |
}); |
| 163 |
</script>'; |
| 164 |
} |
| 165 |
// Redis Object Cache plugin compatibility |
| 166 |
if ( Utils::is_plugin_active( 'redis-cache/redis-cache.php' ) ) { |
| 167 |
$nonce = wp_create_nonce(); |
| 168 |
$ajaxurl = esc_url( admin_url( 'admin-ajax.php' ) ); |
| 169 |
$flushingText = __( 'Flushing cache...', 'redis-cache' ); |
| 170 |
echo '<script> |
| 171 |
jQuery(document).ready(function($) { |
| 172 |
const flushBtn = document.getElementById("adminify-top-menu-redis-cache-flush"); |
| 173 |
const parentMenu = document.getElementById("adminify-top-menu-redis-cache"); |
| 174 |
|
| 175 |
if (flushBtn) { |
| 176 |
const flushLink = flushBtn.querySelector("a"); |
| 177 |
|
| 178 |
flushBtn.addEventListener("click", async function(e) { |
| 179 |
e.preventDefault(); |
| 180 |
e.stopPropagation(); |
| 181 |
|
| 182 |
if (!flushLink) return; |
| 183 |
|
| 184 |
// Store original text |
| 185 |
const originalText = flushLink.textContent || flushLink.innerText; |
| 186 |
|
| 187 |
// Close dropdown and show flushing text on parent menu |
| 188 |
const parentLink = parentMenu ? parentMenu.querySelector("a") : null; |
| 189 |
const parentOriginalHTML = parentLink ? parentLink.innerHTML : null; |
| 190 |
|
| 191 |
if (parentLink) { |
| 192 |
parentLink.innerHTML = "' . esc_js( $flushingText ) . '"; |
| 193 |
} |
| 194 |
|
| 195 |
// Close dropdown |
| 196 |
const dropdown = flushBtn.closest(".adminify-dropdown"); |
| 197 |
if (dropdown) { |
| 198 |
dropdown.classList.remove("show"); |
| 199 |
} |
| 200 |
|
| 201 |
try { |
| 202 |
const data = new FormData(); |
| 203 |
data.append("action", "roc_flush_cache"); |
| 204 |
data.append("nonce", "' . esc_js( $nonce ) . '"); |
| 205 |
|
| 206 |
const response = await fetch("' . $ajaxurl . '", { |
| 207 |
method: "POST", |
| 208 |
body: data, |
| 209 |
}); |
| 210 |
|
| 211 |
const resultText = await response.text(); |
| 212 |
|
| 213 |
// Show result text |
| 214 |
if (parentLink) { |
| 215 |
parentLink.innerHTML = resultText; |
| 216 |
} |
| 217 |
|
| 218 |
// Reset to original after 3 seconds |
| 219 |
setTimeout(function() { |
| 220 |
if (parentLink && parentOriginalHTML) { |
| 221 |
parentLink.innerHTML = parentOriginalHTML; |
| 222 |
} |
| 223 |
}, 3000); |
| 224 |
|
| 225 |
} catch (error) { |
| 226 |
console.error("Object cache could not be flushed:", error); |
| 227 |
// Reset on error |
| 228 |
if (parentLink && parentOriginalHTML) { |
| 229 |
parentLink.innerHTML = parentOriginalHTML; |
| 230 |
} |
| 231 |
} |
| 232 |
}); |
| 233 |
} |
| 234 |
}); |
| 235 |
</script>'; |
| 236 |
} |
| 237 |
} |
| 238 |
|
| 239 |
public function apply_menu_restrictions_via_filter( $menu_options, $menu ) { |
| 240 |
$aam_options = get_option( 'aam_access_settings', [] ); |
| 241 |
if ( is_array( $aam_options ) ) { |
| 242 |
$simplified_aam_option = $this->simplify_aam_menu_restriction( $aam_options ); |
| 243 |
$menu_options = $this->update_aam_menu_option( $menu_options, $simplified_aam_option ); |
| 244 |
} |
| 245 |
return $menu_options; |
| 246 |
} |
| 247 |
|
| 248 |
public function simplify_aam_menu_restriction( $aam_option ) { |
| 249 |
$simplified_aam_option = []; |
| 250 |
foreach ( $aam_option['role'] as $role => $aam_role ) { |
| 251 |
if ( !empty( $aam_role['menu'] ) ) { |
| 252 |
foreach ( $aam_role['menu'] as $menu_item => $value ) { |
| 253 |
if ( !$value ) { |
| 254 |
continue; |
| 255 |
} |
| 256 |
$menu_item = str_replace( 'menu-', '', $menu_item ); |
| 257 |
if ( !isset( $simplified_aam_option[$menu_item] ) ) { |
| 258 |
$simplified_aam_option[$menu_item] = []; |
| 259 |
} |
| 260 |
$simplified_aam_option[$menu_item][] = $role; |
| 261 |
} |
| 262 |
} |
| 263 |
} |
| 264 |
return $simplified_aam_option; |
| 265 |
} |
| 266 |
|
| 267 |
public function update_aam_menu_option( $menu_options, $simplified_aam_option ) { |
| 268 |
foreach ( $menu_options as $key => $item ) { |
| 269 |
// If this menu item is in restricted list, update hidden_for |
| 270 |
if ( isset( $simplified_aam_option[$key] ) ) { |
| 271 |
if ( !isset( $item['hidden_for'] ) ) { |
| 272 |
$item['hidden_for'] = []; |
| 273 |
} |
| 274 |
$item['hidden_for'] = array_merge( $item['hidden_for'], $simplified_aam_option[$key] ); |
| 275 |
$item['hidden_for'] = array_unique( $item['hidden_for'] ); |
| 276 |
} |
| 277 |
// If submenu exists, apply the function recursively |
| 278 |
// if (isset($item['submenu']) && is_array($item['submenu'])) { |
| 279 |
// $item['submenu'] = update_aam_menu_option($item['submenu'], $simplified_aam_option); |
| 280 |
// } |
| 281 |
$menu_options[$key] = $item; |
| 282 |
} |
| 283 |
return $menu_options; |
| 284 |
} |
| 285 |
|
| 286 |
public function jltwp_adminify_reset_theme_conflicts() { |
| 287 |
global $pagenow; |
| 288 |
if ( $pagenow == 'wp-login.php' || $pagenow == 'wp-register.php' || $pagenow == 'customize.php' ) { |
| 289 |
return; |
| 290 |
} |
| 291 |
$screen = get_current_screen(); |
| 292 |
$theme = wp_get_theme(); |
| 293 |
// Neve WordPress Theme |
| 294 |
if ( 'Neve' == $theme->name || 'Neve' == $theme->parent_theme ) { |
| 295 |
wp_enqueue_style( |
| 296 |
'wp-adminify_neve-theme', |
| 297 |
WP_ADMINIFY_ASSETS . 'css/themes/neve.min.css', |
| 298 |
false, |
| 299 |
WP_ADMINIFY_VER |
| 300 |
); |
| 301 |
} |
| 302 |
// Phlox WordPress Theme |
| 303 |
if ( 'Phlox' == $theme->name || 'Phlox' == $theme->parent_theme ) { |
| 304 |
echo '<style> |
| 305 |
.wp-adminify.adminify-ui #wpcontent .wp-adminify.adminify-top_bar { |
| 306 |
opacity: 1 !important; |
| 307 |
} |
| 308 |
</style>'; |
| 309 |
} |
| 310 |
// Enfold WordPress Theme |
| 311 |
if ( 'Enfold' == $theme->name || 'Enfold' == $theme->parent_theme ) { |
| 312 |
echo '<style> |
| 313 |
.wp-adminify.avia-advanced-editor-enabled #wpadminbar{ |
| 314 |
display: none !important; |
| 315 |
} |
| 316 |
</style>'; |
| 317 |
} |
| 318 |
// BrightHub theme compatibility fix |
| 319 |
if ( 'BrightHub' == $theme->name || 'BrightHub' == $theme->parent_theme ) { |
| 320 |
echo '<style> |
| 321 |
body.wp-adminify.adminify-ui.wp-theme-brighthub #wpadminbar, |
| 322 |
body.wp-adminify.adminify-ui.wp-theme-brighthub #adminmenumain{ |
| 323 |
display: none !important; |
| 324 |
} |
| 325 |
.adminify-toolbar-wrapper .adminify-toolbar ul.adminify-top-menu li.adminify-top-menu-item{ |
| 326 |
display: flex; |
| 327 |
width: auto; |
| 328 |
justify-content: center; |
| 329 |
align-items: center; |
| 330 |
} |
| 331 |
</style>'; |
| 332 |
echo '<script> |
| 333 |
document.addEventListener("DOMContentLoaded", function() { |
| 334 |
document.documentElement.setAttribute("frame-adminify-app", "true"); |
| 335 |
|
| 336 |
var iframe = document.querySelector(".adminify-frame-wrapper iframe"); |
| 337 |
if (iframe) { |
| 338 |
iframe.addEventListener("load", function() { |
| 339 |
try { |
| 340 |
iframe.contentDocument.documentElement.setAttribute("frame-adminify-iframe", "true"); |
| 341 |
} catch(e) { |
| 342 |
console.log("Could not access iframe content"); |
| 343 |
} |
| 344 |
}); |
| 345 |
|
| 346 |
try { |
| 347 |
if (iframe.contentDocument && iframe.contentDocument.documentElement) { |
| 348 |
iframe.contentDocument.documentElement.setAttribute("frame-adminify-iframe", "true"); |
| 349 |
} |
| 350 |
} catch(e) { |
| 351 |
// Cross-origin restrictions might prevent access |
| 352 |
} |
| 353 |
} |
| 354 |
}); |
| 355 |
document.addEventListener("DOMContentLoaded", function() { |
| 356 |
var menuItems = document.querySelectorAll(".wp-adminify.adminify-ui .adminify-toolbar-wrapper .adminify-toolbar .adminify-top-menu li"); |
| 357 |
menuItems.forEach(function(item) { |
| 358 |
var link = item.querySelector("a"); |
| 359 |
var divInLink = item.querySelector("a > div"); |
| 360 |
if (link && divInLink) { |
| 361 |
link.textContent = divInLink.textContent; |
| 362 |
} |
| 363 |
}); |
| 364 |
}); |
| 365 |
</script>'; |
| 366 |
} |
| 367 |
// Third Party Plugin CSS Conflict |
| 368 |
// $jltwp_adminify_plugin_conflict_css = ''; |
| 369 |
// if (Utils::is_plugin_active('quillforms/quillforms.php')) { |
| 370 |
// $jltwp_adminify_plugin_conflict_css = '//css code here'; |
| 371 |
// $jltwp_adminify_plugin_conflict_css = preg_replace('#/\*.*?\*/#s', '', $jltwp_adminify_plugin_conflict_css); |
| 372 |
// $jltwp_adminify_plugin_conflict_css = preg_replace('/\s*([{}|:;,])\s+/', '$1', $jltwp_adminify_plugin_conflict_css); |
| 373 |
// $jltwp_adminify_plugin_conflict_css = preg_replace('/\s\s+(.*)/', '$1', $jltwp_adminify_plugin_conflict_css); |
| 374 |
// } |
| 375 |
// $adminify_ui = AdminSettings::get_instance()->get('admin_ui'); |
| 376 |
// if (!empty($adminify_ui)) { |
| 377 |
// wp_add_inline_style('wp-adminify-admin', wp_strip_all_tags($jltwp_adminify_plugin_conflict_css)); |
| 378 |
// } else { |
| 379 |
// wp_add_inline_style('wp-adminify-default-ui', wp_strip_all_tags($jltwp_adminify_plugin_conflict_css)); |
| 380 |
// } |
| 381 |
if ( Utils::is_plugin_active( 'stackable-ultimate-gutenberg-blocks-premium/plugin.php' ) ) { |
| 382 |
echo '<style> |
| 383 |
.wp-adminify.adminify-ui #wpcontent .wp-adminify.adminify-top_bar { |
| 384 |
opacity: 1 !important; |
| 385 |
} |
| 386 |
</style>'; |
| 387 |
} |
| 388 |
if ( Utils::is_plugin_active( 'woocommerce/woocommerce.php' ) ) { |
| 389 |
echo '<style> |
| 390 |
.adminify-ui #woocommerce-embedded-root .woocommerce-layout__header, .adminify-ui .woocommerce-layout .woocommerce-layout__header { |
| 391 |
width: 100%; |
| 392 |
top: 0; |
| 393 |
} |
| 394 |
.adminify-ui #woocommerce-embedded-root .woocommerce-layout__header .woocommerce-layout__header-wrapper, .adminify-ui .woocommerce-layout .woocommerce-layout__header .woocommerce-layout__header-wrapper { |
| 395 |
margin-right: 1rem; |
| 396 |
} |
| 397 |
body.woocommerce-page #wpwrap #wpcontent, |
| 398 |
body.woocommerce-page.woocommerce_page_wc-admin #wpwrap #wpbody-content { |
| 399 |
overflow-x: unset !important; |
| 400 |
position: unset !important; |
| 401 |
} |
| 402 |
</style>'; |
| 403 |
} |
| 404 |
if ( Utils::is_plugin_active( 'tinymce-templates/tinymce-templates.php' ) ) { |
| 405 |
echo '<style>#tinymce-templates-wrap #tinymce-templates-preview { height: 500px !important; }</style>'; |
| 406 |
} |
| 407 |
if ( Utils::is_plugin_active( 'elementor/elementor.php' ) ) { |
| 408 |
echo '<style> |
| 409 |
body.wp-adminify-admin-bar.admin-bar .dialog-lightbox-widget { |
| 410 |
height: calc(100vh - 0px) !important; |
| 411 |
} |
| 412 |
body.wp-adminify-admin-bar.admin-bar #e-admin-top-bar-root{ |
| 413 |
padding-top: 70px !important; |
| 414 |
width: calc(100% + 20px) !important; |
| 415 |
margin-left: -20px; |
| 416 |
} |
| 417 |
body.wp-adminify-admin-bar.admin-bar #e-admin-top-bar-root .e-admin-top-bar{ |
| 418 |
padding-left: 20px; |
| 419 |
} |
| 420 |
|
| 421 |
body.adminify-ui.e-has-sidebar-navigation #wpwrap #wpcontent #editor-one-top-bar > header { |
| 422 |
top: 0!important; |
| 423 |
} |
| 424 |
</style>'; |
| 425 |
} |
| 426 |
if ( Utils::is_plugin_active( 'one-click-demo-import/one-click-demo-import.php' ) ) { |
| 427 |
echo '<style> |
| 428 |
.wp-adminify.appearance_page_one-click-demo-import .button-hero { |
| 429 |
min-height: auto !important; |
| 430 |
} |
| 431 |
</style>'; |
| 432 |
} |
| 433 |
if ( Utils::is_plugin_active( 'wpforms-lite/wpforms.php' ) ) { |
| 434 |
if ( Utils::jltwp_adminify_currentpage_id( 'dashboard' ) ) { |
| 435 |
wp_enqueue_style( |
| 436 |
'wpforms-full', |
| 437 |
WPFORMS_PLUGIN_URL . 'assets/css/frontend/classic/wpforms-full.css', |
| 438 |
[], |
| 439 |
WPFORMS_VERSION |
| 440 |
); |
| 441 |
} |
| 442 |
} |
| 443 |
if ( Utils::is_plugin_active( 'classic-editor/classic-editor.php' ) ) { |
| 444 |
echo '<style> |
| 445 |
#ed_toolbar{ |
| 446 |
width: 100% !important; |
| 447 |
} |
| 448 |
#ed_toolbar #qt_content_dfw{ |
| 449 |
line-height: inherit; |
| 450 |
padding: 0; |
| 451 |
} |
| 452 |
</style>'; |
| 453 |
} |
| 454 |
if ( Utils::is_plugin_active( 'updraftplus/updraftplus.php' ) ) { |
| 455 |
echo '<style> |
| 456 |
.wp-adminify.settings_page_updraftplus input{ |
| 457 |
border-radius: 4px !important; |
| 458 |
border: 1px solid #CCC !important; |
| 459 |
} |
| 460 |
.wp-adminify.adminify-dark-mode .updraft_feat_table, |
| 461 |
.wp-adminify.adminify-dark-mode .updraft_feat_table td, |
| 462 |
.wp-adminify.adminify-dark-mode .updraft_next_scheduled_backups_wrapper > div, |
| 463 |
.wp-adminify.adminify-dark-mode .updraft_migrate_widget_module_content{ |
| 464 |
background: inherit; |
| 465 |
} |
| 466 |
.wp-adminify.adminify-dark-mode .updraft_premium_cta, |
| 467 |
.wp-adminify.adminify-dark-mode .updraft_premium_cta__bottom, |
| 468 |
.wp-adminify.adminify-dark-mode .udp-box, |
| 469 |
.wp-adminify.adminify-dark-mode .updraftcentral_cloud_connect, |
| 470 |
.wp-adminify.adminify-dark-mode .updraft_advert_bottom, |
| 471 |
.wp-adminify.adminify-dark-mode #remote-storage-container label{ |
| 472 |
background: #020407; |
| 473 |
} |
| 474 |
.wp-adminify.adminify-dark-mode .expertmode .advanced_settings_container .advanced_settings_menu .advanced_tools_button{ |
| 475 |
color: inherit; |
| 476 |
} |
| 477 |
</style>'; |
| 478 |
} |
| 479 |
if ( Utils::is_plugin_active( 'tinymce-advanced/tinymce-advanced.php' ) ) { |
| 480 |
echo '<style> |
| 481 |
.wp-editor-container .mce-container-body .mce-menubar.mce-toolbar{ |
| 482 |
position: initial !important; |
| 483 |
} |
| 484 |
.wp-editor-container .mce-container-body .mce-toolbar-grp .mce-container-body{ |
| 485 |
position: relative !important; |
| 486 |
} |
| 487 |
.wp-editor-container .mce-container-body .mce-toolbar-grp .mce-toolbar.mce-first { |
| 488 |
padding-right: 0 !important; |
| 489 |
} |
| 490 |
#ed_toolbar{ |
| 491 |
width: 100% !important; |
| 492 |
} |
| 493 |
#ed_toolbar #qt_content_dfw{ |
| 494 |
line-height: inherit; |
| 495 |
padding: 0; |
| 496 |
} |
| 497 |
</style>'; |
| 498 |
} |
| 499 |
if ( Utils::is_plugin_active( 'email-template-customizer-for-woo/email-template-customizer-for-woo.php' ) ) { |
| 500 |
if ( $screen->id === 'edit-viwec_template' ) { |
| 501 |
echo '<style> |
| 502 |
#wpfooter{ |
| 503 |
position: relative !important; |
| 504 |
display: flex; |
| 505 |
flex-direction: column-reverse; |
| 506 |
} |
| 507 |
</style>'; |
| 508 |
} |
| 509 |
} |
| 510 |
if ( Utils::is_plugin_active( 'woocommerce-orders-tracking/woocommerce-orders-tracking.php' ) ) { |
| 511 |
if ( $screen->id === 'woocommerce_page_wc-orders' ) { |
| 512 |
echo '<style> |
| 513 |
#wpfooter{ |
| 514 |
position: relative !important; |
| 515 |
display: block !important; |
| 516 |
flex-direction: column-reverse; |
| 517 |
} |
| 518 |
</style>'; |
| 519 |
} |
| 520 |
} |
| 521 |
if ( Utils::is_plugin_active( 'js_composer/js_composer.php' ) ) { |
| 522 |
echo '<style> |
| 523 |
.adminify-ui .vc_dropdown-list-item p{ |
| 524 |
color: #fff; |
| 525 |
} |
| 526 |
</style>'; |
| 527 |
} |
| 528 |
// Third Party localize script |
| 529 |
wp_localize_script( 'wp-adminify-admin', 'WPAdminify_ThirdParty', $this->thirdparty_create_js_object() ); |
| 530 |
} |
| 531 |
|
| 532 |
public function thirdparty_create_js_object() { |
| 533 |
// betterlinks menu settings |
| 534 |
$betterlinks = [ |
| 535 |
'active' => false, |
| 536 |
]; |
| 537 |
if ( Utils::is_plugin_active( 'betterlinks/betterlinks.php' ) ) { |
| 538 |
if ( is_array( $this->menu_settings ) && array_key_exists( 'betterlinks', $this->menu_settings ) ) { |
| 539 |
$menu_name = ( !empty( $this->menu_settings['betterlinks']['name'] ) ? esc_html( $this->menu_settings['betterlinks']['name'] ) : '' ); |
| 540 |
$submenu_manage = ( !empty( $this->menu_settings['betterlinks']['submenu']['betterlinks']['name'] ) ? esc_html( $this->menu_settings['betterlinks']['submenu']['betterlinks']['name'] ) : '' ); |
| 541 |
$submenu_name = ( !empty( $this->menu_settings['betterlinks']['submenu']['betterlinks-analytics']['name'] ) ? esc_html( $this->menu_settings['betterlinks']['submenu']['betterlinks-analytics']['name'] ) : '' ); |
| 542 |
$submenu_settings = ( !empty( $this->menu_settings['betterlinks']['submenu']['betterlinks-settings']['name'] ) ? esc_html( $this->menu_settings['betterlinks']['submenu']['betterlinks-settings']['name'] ) : '' ); |
| 543 |
$betterlinks = [ |
| 544 |
'active' => true, |
| 545 |
'menu_name' => esc_html( $menu_name ), |
| 546 |
'submenu_manage' => esc_html( $submenu_manage ), |
| 547 |
'submenu_name' => esc_html( $submenu_name ), |
| 548 |
'submenu_settings' => esc_html( $submenu_settings ), |
| 549 |
]; |
| 550 |
} |
| 551 |
} |
| 552 |
return [ |
| 553 |
'ajax_url' => admin_url( 'admin-ajax.php' ), |
| 554 |
'better_links' => wp_kses_post_deep( $betterlinks ), |
| 555 |
]; |
| 556 |
} |
| 557 |
|
| 558 |
public function register_actions_on_init() { |
| 559 |
// Brizy Builder |
| 560 |
if ( isset( $_REQUEST['brizy-edit-iframe'] ) ) { |
| 561 |
add_filter( 'wp_adminify_defer_skip', '__return_true' ); |
| 562 |
add_filter( 'wp_adminify_skip_removing_dashicons', '__return_true' ); |
| 563 |
} |
| 564 |
} |
| 565 |
|
| 566 |
public function register_actions_on_admin_init() { |
| 567 |
$adminify_ui = AdminSettings::get_instance()->get( 'admin_ui' ); |
| 568 |
if ( !empty( $adminify_ui ) ) { |
| 569 |
// Commented On: 24-3-24 |
| 570 |
add_action( 'admin_enqueue_scripts', [$this, 'enqueue_scripts'], 999 ); |
| 571 |
} |
| 572 |
// Commented On: 10-6-24 |
| 573 |
// add_filter('adminify_third_party_styles', [$this, 'register_compatability_styles']); |
| 574 |
// Fluent CRM |
| 575 |
add_action( 'fluentcrm_skip_no_conflict', '__return_true' ); |
| 576 |
// Fluent FORM |
| 577 |
add_action( 'fluentform_skip_no_conflict', '__return_true' ); |
| 578 |
} |
| 579 |
|
| 580 |
/** |
| 581 |
* Register Third Party Styles |
| 582 |
* |
| 583 |
* @since 1.0.0 |
| 584 |
*/ |
| 585 |
public function register_compatability_styles( $plugin_supports ) { |
| 586 |
if ( !is_array( $plugin_supports ) ) { |
| 587 |
$plugin_supports = []; |
| 588 |
} |
| 589 |
$plugin_dir = WP_ADMINIFY_ASSETS . 'css/plugins/'; |
| 590 |
$plugin_files = list_files( WP_ADMINIFY_PATH . 'assets/css/plugins/', 1 ); |
| 591 |
if ( !empty( $plugin_files ) ) { |
| 592 |
foreach ( $plugin_files as $file ) { |
| 593 |
$plugin_supports[wp_basename( $file, '.min.css' )] = $plugin_dir . wp_basename( $file ); |
| 594 |
} |
| 595 |
} |
| 596 |
return $plugin_supports; |
| 597 |
} |
| 598 |
|
| 599 |
/** |
| 600 |
* Admin Enqueue Third Party Scripts/Styles |
| 601 |
* |
| 602 |
* @return void |
| 603 |
*/ |
| 604 |
public function enqueue_scripts() { |
| 605 |
$plugin_supports = []; |
| 606 |
$plugin_supports = apply_filters( 'adminify_third_party_styles', $plugin_supports ); |
| 607 |
// Check Plugin Activated for Site Wide |
| 608 |
if ( is_multisite() ) { |
| 609 |
$active_plugins = get_site_option( 'active_sitewide_plugins' ); |
| 610 |
foreach ( $active_plugins as $active_path => $active_plugin ) { |
| 611 |
if ( is_plugin_active_for_network( $active_path ) ) { |
| 612 |
$string = explode( '/', $active_path ); |
| 613 |
$pluginname = $string[0]; |
| 614 |
if ( isset( $plugin_supports[$pluginname] ) ) { |
| 615 |
if ( $plugin_supports[$pluginname] != '' ) { |
| 616 |
wp_register_style( |
| 617 |
'wp-adminify_site-wide_' . $pluginname . '_css', |
| 618 |
$plugin_supports[$pluginname], |
| 619 |
[], |
| 620 |
WP_ADMINIFY_VER |
| 621 |
); |
| 622 |
wp_enqueue_style( 'wp-adminify_site-wide_' . $pluginname . '_css' ); |
| 623 |
} |
| 624 |
} |
| 625 |
} |
| 626 |
} |
| 627 |
} |
| 628 |
// Check Plugin Activated for Individual Sites |
| 629 |
$activeplugins = get_option( 'active_plugins' ); |
| 630 |
foreach ( $activeplugins as $plugin ) { |
| 631 |
if ( Utils::is_plugin_active( $plugin ) ) { |
| 632 |
$string = explode( '/', $plugin ); |
| 633 |
$pluginname = $string[0]; |
| 634 |
if ( isset( $plugin_supports[$pluginname] ) ) { |
| 635 |
if ( $plugin_supports[$pluginname] != '' ) { |
| 636 |
wp_register_style( |
| 637 |
'wp-adminify_' . $pluginname . '_css', |
| 638 |
$plugin_supports[$pluginname], |
| 639 |
[], |
| 640 |
WP_ADMINIFY_VER |
| 641 |
); |
| 642 |
wp_enqueue_style( 'wp-adminify_' . $pluginname . '_css' ); |
| 643 |
} |
| 644 |
} |
| 645 |
} |
| 646 |
} |
| 647 |
} |
| 648 |
|
| 649 |
} |
| 650 |
|