| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPAdminify\Inc\Classes; |
| 4 |
|
| 5 |
use WPAdminify\Inc\Utils; |
| 6 |
use WPAdminify\Inc\Admin\AdminSettings; |
| 7 |
|
| 8 |
// no direct access allowed |
| 9 |
if (!defined('ABSPATH')) { |
| 10 |
exit; |
| 11 |
} |
| 12 |
/** |
| 13 |
* WPAdminify |
| 14 |
* Dark Mode Conflicts with other plugins supports |
| 15 |
* |
| 16 |
* @author Jewel Theme <support@jeweltheme.com> |
| 17 |
*/ |
| 18 |
|
| 19 |
class DarkModeConflicts |
| 20 |
{ |
| 21 |
public $options; |
| 22 |
|
| 23 |
public function __construct() |
| 24 |
{ |
| 25 |
add_action('admin_enqueue_scripts', array($this, 'jltwp_adminify_darkmode_scripts'), 100); |
| 26 |
} |
| 27 |
|
| 28 |
public function jltwp_adminify_darkmode_scripts() |
| 29 |
{ |
| 30 |
|
| 31 |
$this->options = (array) AdminSettings::get_instance()->get(); |
| 32 |
$this->options = !empty($this->options['light_dark_mode']['admin_ui_mode']) ? $this->options['light_dark_mode']['admin_ui_mode'] : ''; |
| 33 |
|
| 34 |
if ($this->options == 'light') { |
| 35 |
return; |
| 36 |
} |
| 37 |
|
| 38 |
|
| 39 |
$dark_mode_style = '.ReactModal__Content, |
| 40 |
.select2-selection, |
| 41 |
.select2-results__options, |
| 42 |
.adminify-dark-mode.toplevel_page_aio-contact-lite, |
| 43 |
.aio-contact-menu, |
| 44 |
.bsr-action-form input.regular-text, |
| 45 |
.select2-dropdown, |
| 46 |
.form-cancel-btn, |
| 47 |
.folders-tabs, |
| 48 |
.folder-tab-menu, |
| 49 |
.folder-tab-menu a, |
| 50 |
.custom-checkbox span, |
| 51 |
.preview-inner-box, |
| 52 |
.preview-inner-box .form-options, |
| 53 |
.media-buttons, |
| 54 |
.popup-form-content, |
| 55 |
.select2-results__option, |
| 56 |
div.tagsinput, |
| 57 |
.settings-tabs-list .nav-tab, |
| 58 |
input[type=number], |
| 59 |
.bulk-action-select .bulk-action-select__control, |
| 60 |
.bulk-action-select__menu, |
| 61 |
.wprf-section-fields, |
| 62 |
.wprf-section-title, |
| 63 |
.wprf-input-radio-option:not(.wprf-option-selected) .wprf-input-label, |
| 64 |
.wprf-control-field .components-button, |
| 65 |
.wprf-select__menu, |
| 66 |
.wprf-select__control, |
| 67 |
.wprf-tab-content, |
| 68 |
.squirrly-seo-settings #wpcontent .bg-light, |
| 69 |
.bootstrap-select, |
| 70 |
.bg-white, |
| 71 |
.wdt-addons-intro { |
| 72 |
background: white !important; |
| 73 |
} |
| 74 |
|
| 75 |
.el-checkbox.is-checked ~ div, |
| 76 |
.fluentcrm_header { |
| 77 |
background: none!important; |
| 78 |
} |
| 79 |
|
| 80 |
.folder-user-settings .pro-feature-popup { |
| 81 |
background: rgb(0, 0, 0, 0.4) |
| 82 |
} |
| 83 |
|
| 84 |
.big-pluspro-btn, |
| 85 |
.dokan-btn, |
| 86 |
.close_dp_help, |
| 87 |
.dup-btn, |
| 88 |
.folder-tab-menu a, |
| 89 |
.pro-feature-popup .pro-feature-content > a, |
| 90 |
.user-upgrade-inline-btn, |
| 91 |
.pro-feature-popup .pro-feature-content .pro-user-title, |
| 92 |
.pro-feature-popup .pro-feature-content .pro-user-desc, |
| 93 |
.folder-access, |
| 94 |
.add-new-folder, |
| 95 |
.media-select option, |
| 96 |
.popup-form-content, |
| 97 |
.nf-button:hover, |
| 98 |
.wp-react-form h1, |
| 99 |
.wp-react-form h2, |
| 100 |
.wp-react-form h3, |
| 101 |
.wp-react-form h4, |
| 102 |
.wprf-input-label, |
| 103 |
.wprf-tab-nav-item:not(:hover), |
| 104 |
.swift-btn, |
| 105 |
.wpcode-button, |
| 106 |
.wdt-constructor-type-selecter-block .card-body h4, |
| 107 |
.wdt-constructor-type-selecter-block .card-body h4 span, |
| 108 |
.yoast-button-upsell, |
| 109 |
.aioseo-button:hover, |
| 110 |
.el-button { |
| 111 |
color: white !important; |
| 112 |
} |
| 113 |
|
| 114 |
.folders-tabs .dashicons-editor-help, |
| 115 |
.folder-tab-menu a.active, |
| 116 |
.folder-list li a span, |
| 117 |
.select2-selection__rendered, |
| 118 |
.fp-item-name, |
| 119 |
.select2-results__option, |
| 120 |
.form-sample, |
| 121 |
input[type=number], |
| 122 |
.wprf-select__single-value, |
| 123 |
.wprf-code-viewer textarea, |
| 124 |
.wdt-constructor-type-selecter-block .card-body span, |
| 125 |
.mce-menu-item > span { |
| 126 |
color: gray !important; |
| 127 |
} |
| 128 |
|
| 129 |
.select2-selection, |
| 130 |
.bsr-action-form input.regular-text, |
| 131 |
#bsr-table-select, |
| 132 |
.custom-checkbox input+span, |
| 133 |
.preview-inner-box, |
| 134 |
div.tagsinput, |
| 135 |
input[type=number], |
| 136 |
.bulk-action-select .bulk-action-select__control, |
| 137 |
.wprf-tab-nav-item, |
| 138 |
.wprf-control-field .components-button, |
| 139 |
.wprf-select__control, |
| 140 |
.wprf-control-field input[type="checkbox"], |
| 141 |
.bootstrap-select { |
| 142 |
border-color: #D0D5DD !important; |
| 143 |
} |
| 144 |
|
| 145 |
.dokan-admin-header-logo img, |
| 146 |
.dup-header img { |
| 147 |
filter: grayscale(1) brightness(5); |
| 148 |
} |
| 149 |
|
| 150 |
.jetpack-logo, |
| 151 |
.it-ui-list div[direction="horizontal"] > svg { |
| 152 |
fill: black !important; |
| 153 |
} |
| 154 |
|
| 155 |
.jp-form-block-fade { |
| 156 |
opacity: 0.5; |
| 157 |
} |
| 158 |
'; |
| 159 |
|
| 160 |
// Elementor Style issues |
| 161 |
// if (Utils::is_plugin_active('elementor/elementor.php')) { |
| 162 |
// $dark_mode_style .= '.darkmode{ |
| 163 |
// background: white !important; |
| 164 |
// }'; |
| 165 |
// } |
| 166 |
|
| 167 |
// Better Links Style issues |
| 168 |
if (Utils::is_plugin_active('betterlinks/betterlinks.php')) { |
| 169 |
$dark_mode_style .= '#betterlinksbody .kpyoXL, |
| 170 |
.btl-react-select__menu, |
| 171 |
#betterlinksbody .jlDjrx { |
| 172 |
background: white !important; |
| 173 |
} |
| 174 |
#betterlinksbody .kpyoXL{ |
| 175 |
color: white !important; |
| 176 |
} |
| 177 |
'; |
| 178 |
} |
| 179 |
|
| 180 |
// Forminator Style issues |
| 181 |
if (Utils::is_plugin_active('forminator/forminator.php')) { |
| 182 |
$dark_mode_style .= '.sui-box, |
| 183 |
.sui-icon-plugin-2, |
| 184 |
.sui-vertical-tab a.current, |
| 185 |
.sui-wrap .fui-multi-answers, |
| 186 |
.sui-wrap .fui-multi-answers .fui-answers>li, |
| 187 |
.sui-dropdown.open ul, |
| 188 |
.sui-notice-content, |
| 189 |
.sui-wrap .sui-box-selectors, |
| 190 |
.sui-select-dropdown, |
| 191 |
.sui-accordion-item, |
| 192 |
.sui-tabs-menu, |
| 193 |
.forminator-addon-card--footer, |
| 194 |
.sui-vertical-tab.current, |
| 195 |
.sui-form-control, |
| 196 |
select#forminator-field-user_role, |
| 197 |
.forminator-save-field-settings { |
| 198 |
background: white !important; |
| 199 |
} |
| 200 |
|
| 201 |
.sui-upgrade-page, |
| 202 |
.sui-upgrade-page-header, |
| 203 |
.sui-upgrade-page-cta { |
| 204 |
background: none!important; |
| 205 |
} |
| 206 |
|
| 207 |
.sui-header-title, |
| 208 |
.sui-summary-large, |
| 209 |
.sui-list-label, |
| 210 |
.sui-box-title, |
| 211 |
.sui-wrap h1, |
| 212 |
.sui-wrap h2, |
| 213 |
.sui-wrap h3, |
| 214 |
.sui-button, |
| 215 |
.sui-vertical-tab a.current, |
| 216 |
.sui-table thead>tr>th, |
| 217 |
.sui-trim-text, |
| 218 |
.sui-message-content h2, |
| 219 |
.sui-tab-item.active, |
| 220 |
.sui-vertical-tab.current a, |
| 221 |
select#forminator-field-user_role { |
| 222 |
color: white !important; |
| 223 |
} |
| 224 |
|
| 225 |
.sui-upsell-list li, |
| 226 |
.sui-table-item-title, |
| 227 |
.sui-vertical-tab a, |
| 228 |
.sui-form-control, |
| 229 |
.sui-settings-label { |
| 230 |
color: gray !important; |
| 231 |
} |
| 232 |
|
| 233 |
.sui-list li, |
| 234 |
.sui-box-header, |
| 235 |
#sui-cross-sell-footer>div, |
| 236 |
.sui-box-settings-row, |
| 237 |
.sui-dropdown.open ul, |
| 238 |
.sui-box-footer, |
| 239 |
.sui-status-changes, |
| 240 |
.sui-table thead>tr>th, |
| 241 |
.sui-select-dropdown, |
| 242 |
.sui-tab-content, |
| 243 |
.forminator-addon-card--footer, |
| 244 |
.sui-table.fui-table--apps, |
| 245 |
.sui-table tbody>tr>td, |
| 246 |
.sui-tabs-overflow, |
| 247 |
.sui-form-control, |
| 248 |
.sui-button, |
| 249 |
select#forminator-field-user_role { |
| 250 |
border-color: #D0D5DD !important; |
| 251 |
} |
| 252 |
|
| 253 |
.sui-dropdown.open ul::after, |
| 254 |
.sui-dropdown.open ul::before { |
| 255 |
border-color: #D0D5DD rgba(0, 0, 0, 0)!important; |
| 256 |
} |
| 257 |
|
| 258 |
.sui-box, |
| 259 |
.sui-accordion-item, |
| 260 |
.sui-tabs-menu { |
| 261 |
box-shadow: none!important; |
| 262 |
} |
| 263 |
|
| 264 |
.sui-chartjs-message--empty { |
| 265 |
background-blend-mode: exclusion; |
| 266 |
} |
| 267 |
|
| 268 |
.sui-tag, |
| 269 |
.sui-tabs-menu .sui-tab-item { |
| 270 |
background: #6f6f6f!important; |
| 271 |
color: #fff!important; |
| 272 |
} |
| 273 |
|
| 274 |
.sui-tab-item.active { |
| 275 |
background: black!important; |
| 276 |
} |
| 277 |
'; |
| 278 |
} |
| 279 |
|
| 280 |
// Loginpress |
| 281 |
if (Utils::is_plugin_active('loginpress/loginpress.php')) { |
| 282 |
$dark_mode_style .= '.loginpress-help-page pre textarea, |
| 283 |
.loginpress-import-export-page .upload-file, |
| 284 |
.loginpress-extension { |
| 285 |
background: white !important; |
| 286 |
} |
| 287 |
|
| 288 |
.toplevel_page_loginpress-settings #wpcontent, |
| 289 |
.loginpress_page_loginpress-help #wpcontent, |
| 290 |
.loginpress_page_loginpress-import-export #wpcontent, |
| 291 |
.loginpress-header-wrapper, |
| 292 |
.loginpress-settings { |
| 293 |
background: none!important; |
| 294 |
} |
| 295 |
|
| 296 |
.loginpress-help-page h2, |
| 297 |
.loginpress-import-export-page h2, |
| 298 |
.loginpress-addons-wrap h2, |
| 299 |
.loginpress-extension h3 span, |
| 300 |
.loginpress-settings h3{ |
| 301 |
color: white !important; |
| 302 |
} |
| 303 |
|
| 304 |
.loginpress-help-page pre textarea, |
| 305 |
.loginpress-import-export-page > div, |
| 306 |
.loginpress-settings .form-table tr th, |
| 307 |
.loginpress-settings .form-table tr td fieldset label { |
| 308 |
color: gray !important |
| 309 |
} |
| 310 |
|
| 311 |
.loginpress-help-page pre textarea, |
| 312 |
.loginpress-import-export-page .upload-file, |
| 313 |
.loginpress-extension h3, |
| 314 |
.loginpress-extension { |
| 315 |
border-color: #D0D5DD !important; |
| 316 |
} |
| 317 |
|
| 318 |
.loginpress-header-logo img { |
| 319 |
filter: grayscale(1) brightness(5); |
| 320 |
} |
| 321 |
|
| 322 |
'; |
| 323 |
} |
| 324 |
|
| 325 |
// Notificationx Style issues |
| 326 |
if (Utils::is_plugin_active('notificationx/notificationx.php')) { |
| 327 |
$dark_mode_style .= '.nx-analytics-counter, |
| 328 |
#notificationx .notificationx-items .nx-admin-menu>ul li:not(.nx-active) a, |
| 329 |
.nx-admin-sidebar .sidebar-widget, |
| 330 |
.nx-settings-right, |
| 331 |
.nx-admin-block, |
| 332 |
.nx-sidebar, |
| 333 |
.nx-quick-builder-wrapper { |
| 334 |
background: white !important; |
| 335 |
} |
| 336 |
|
| 337 |
.nx-button:not(:hover) { |
| 338 |
background: none!important; |
| 339 |
} |
| 340 |
|
| 341 |
.nx-counter-number, |
| 342 |
.nx-admin-title { |
| 343 |
color: white !important; |
| 344 |
} |
| 345 |
|
| 346 |
#notificationx .notificationx-items .nx-admin-menu>ul li:not(.nx-active) a, |
| 347 |
#nx-title, |
| 348 |
#notification-template, |
| 349 |
.nx-admin-sidebar-cta a:not(:hover) { |
| 350 |
color: gray !important; |
| 351 |
} |
| 352 |
|
| 353 |
#notificationx .notificationx-items .nx-admin-menu>ul li:not(.nx-active) a, |
| 354 |
#nx-title, |
| 355 |
.nx-widget-title, |
| 356 |
#notification-template { |
| 357 |
border-color: #D0D5DD !important; |
| 358 |
} |
| 359 |
|
| 360 |
.nx-admin-sidebar-logo img { |
| 361 |
filter: grayscale(1) brightness(5); |
| 362 |
} |
| 363 |
|
| 364 |
.nx-admin-header svg g { |
| 365 |
fill: #fff!important; |
| 366 |
} |
| 367 |
'; |
| 368 |
} |
| 369 |
|
| 370 |
// Wpdatatables Style issues |
| 371 |
if (Utils::is_plugin_active('wpdatatables/wpdatatables.php')) { |
| 372 |
$dark_mode_style .= '.wpdt-c.toplevel_page_wpdatatables-dashboard, |
| 373 |
.wpdt-c .wdt-datatables-admin-wrap .plugin-dashboard, |
| 374 |
.wpdt-c.wpdatatables_page_wpdatatables-administration, |
| 375 |
.card-header.wdt-admin-card-header.ch-alt, |
| 376 |
#wdt-datatables-browse-table, |
| 377 |
.manage-column, |
| 378 |
.wpdt-c.wpdatatables_page_wpdatatables-constructor, |
| 379 |
.wdt-constructor-type-selecter-block .card-header, |
| 380 |
.wpdt-c, |
| 381 |
.chart-wizard-breadcrumb, |
| 382 |
.wpdt-c .chart-name, |
| 383 |
.wpdt-c .render-engine { |
| 384 |
background: white !important; |
| 385 |
} |
| 386 |
|
| 387 |
'; |
| 388 |
} |
| 389 |
|
| 390 |
|
| 391 |
|
| 392 |
$dark_mode_style = preg_replace('#/\*.*?\*/#s', '', $dark_mode_style); |
| 393 |
$dark_mode_style = preg_replace('/\s*([{}|:;,])\s+/', '$1', $dark_mode_style); |
| 394 |
$dark_mode_style = preg_replace('/\s\s+(.*)/', '$1', $dark_mode_style); |
| 395 |
wp_add_inline_style('wp-adminify-admin', wp_strip_all_tags($dark_mode_style)); |
| 396 |
} |
| 397 |
} |
| 398 |
|