PluginProbe
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP / 1.2.76
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP v1.2.76
1.2.76 1.2.75 1.2.74 1.2.73 1.2.72 1.2.71 1.2.70 1.2.69 1.2.68 1.2.67 1.2.66 1.2.65 1.2.64 1.2.63 trunk 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 All 176 releases
← All changes | vendor/ayecode/wp-ayecode-ui/includes/ayecode-ui-settings.php +219 -131 1.2.63 → 1.2.76 View file →
@@ -34,9 +34,9 @@
34 34 * Class version version.
35 35 *
36 36 * @var string
37 37 */
38 - public $version = '0.2.47';
38 + public $version = '0.2.56';
39 39
40 40 /**
41 41 * Class textdomain.
42 42 *
@@ -151,24 +151,25 @@
151 151 /**
152 152 * Setup some constants.
153 153 */
154 154 public function constants(){
155 - define( 'AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be" );
156 - define( 'AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d' );
157 - define( 'AUI_INFO_COLOR_ORIGINAL', '#17a2b8' );
158 - define( 'AUI_WARNING_COLOR_ORIGINAL', '#ffc107' );
159 - define( 'AUI_DANGER_COLOR_ORIGINAL', '#dc3545' );
160 - define( 'AUI_SUCCESS_COLOR_ORIGINAL', '#44c553' );
161 - define( 'AUI_LIGHT_COLOR_ORIGINAL', '#f8f9fa' );
162 - define( 'AUI_DARK_COLOR_ORIGINAL', '#343a40' );
163 - define( 'AUI_WHITE_COLOR_ORIGINAL', '#fff' );
164 - define( 'AUI_PURPLE_COLOR_ORIGINAL', '#ad6edd' );
165 - define( 'AUI_SALMON_COLOR_ORIGINAL', '#ff977a' );
166 - define( 'AUI_CYAN_COLOR_ORIGINAL', '#35bdff' );
167 - define( 'AUI_GRAY_COLOR_ORIGINAL', '#ced4da' );
168 - define( 'AUI_INDIGO_COLOR_ORIGINAL', '#502c6c' );
169 - define( 'AUI_ORANGE_COLOR_ORIGINAL', '#orange' );
170 - define( 'AUI_BLACK_COLOR_ORIGINAL', '#000' );
155 + // Another copy of this package may have defined these already.
156 + defined( 'AUI_PRIMARY_COLOR_ORIGINAL' ) || define( 'AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be" );
157 + defined( 'AUI_SECONDARY_COLOR_ORIGINAL' ) || define( 'AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d' );
158 + defined( 'AUI_INFO_COLOR_ORIGINAL' ) || define( 'AUI_INFO_COLOR_ORIGINAL', '#17a2b8' );
159 + defined( 'AUI_WARNING_COLOR_ORIGINAL' ) || define( 'AUI_WARNING_COLOR_ORIGINAL', '#ffc107' );
160 + defined( 'AUI_DANGER_COLOR_ORIGINAL' ) || define( 'AUI_DANGER_COLOR_ORIGINAL', '#dc3545' );
161 + defined( 'AUI_SUCCESS_COLOR_ORIGINAL' ) || define( 'AUI_SUCCESS_COLOR_ORIGINAL', '#44c553' );
162 + defined( 'AUI_LIGHT_COLOR_ORIGINAL' ) || define( 'AUI_LIGHT_COLOR_ORIGINAL', '#f8f9fa' );
163 + defined( 'AUI_DARK_COLOR_ORIGINAL' ) || define( 'AUI_DARK_COLOR_ORIGINAL', '#343a40' );
164 + defined( 'AUI_WHITE_COLOR_ORIGINAL' ) || define( 'AUI_WHITE_COLOR_ORIGINAL', '#fff' );
165 + defined( 'AUI_PURPLE_COLOR_ORIGINAL' ) || define( 'AUI_PURPLE_COLOR_ORIGINAL', '#ad6edd' );
166 + defined( 'AUI_SALMON_COLOR_ORIGINAL' ) || define( 'AUI_SALMON_COLOR_ORIGINAL', '#ff977a' );
167 + defined( 'AUI_CYAN_COLOR_ORIGINAL' ) || define( 'AUI_CYAN_COLOR_ORIGINAL', '#35bdff' );
168 + defined( 'AUI_GRAY_COLOR_ORIGINAL' ) || define( 'AUI_GRAY_COLOR_ORIGINAL', '#ced4da' );
169 + defined( 'AUI_INDIGO_COLOR_ORIGINAL' ) || define( 'AUI_INDIGO_COLOR_ORIGINAL', '#502c6c' );
170 + defined( 'AUI_ORANGE_COLOR_ORIGINAL' ) || define( 'AUI_ORANGE_COLOR_ORIGINAL', '#orange' );
171 + defined( 'AUI_BLACK_COLOR_ORIGINAL' ) || define( 'AUI_BLACK_COLOR_ORIGINAL', '#000' );
171 172
172 173 if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) {
173 174 define( 'AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL );
174 175 }
@@ -333,8 +334,10 @@
333 334 add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), $priority );
334 335 }
335 336 if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
336 337 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
338 + // WordPress 6.9+ iframe compatibility.
339 + add_action( 'enqueue_block_assets', [ $this, 'enqueue_block_assets' ], 100 );
337 340 }
338 341
339 342 // maybe load JS
340 343 if ( $this->settings['js'] ) {
@@ -400,17 +403,16 @@
400 403 * Check if the current admin screen should load scripts.
401 404 *
402 405 * @return bool
403 406 */
404 - public function is_aui_screen(){
405 -// echo '###';exit;
407 + public function is_aui_screen() {
406 408 $load = false;
407 - // check if we should load or not
409 +
410 + // Check if we should load or not
408 411 if ( is_admin() ) {
409 412 // Only enable on set pages
410 413 $aui_screens = array(
411 414 'page',
412 - //'docs',
413 415 'post',
414 416 'settings_page_ayecode-ui-settings',
415 417 'appearance_page_gutenberg-widgets',
416 418 'widgets',
@@ -416,27 +418,23 @@
416 418 'widgets',
417 419 'ayecode-ui-settings',
418 420 'site-editor'
419 421 );
422 +
420 423 $screen_ids = apply_filters( 'aui_screen_ids', $aui_screens );
424 + $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : array();
421 425
422 - $screen = get_current_screen();
423 -
424 -// echo '###'.$screen->id;
425 -
426 - // check if we are on a AUI screen
426 + // Check if we are on a AUI screen
427 427 if ( $screen && in_array( $screen->id, $screen_ids ) ) {
428 428 $load = true;
429 429 }
430 430
431 - //load for widget previews in WP 5.8
432 - if( !empty($_REQUEST['legacy-widget-preview'])){
431 + // Load for widget previews in WP 5.8
432 + if ( ! empty( $_REQUEST['legacy-widget-preview'] ) ) {
433 433 $load = true;
434 434 }
435 435 }
436 436
437 -
438 -
439 437 return apply_filters( 'aui_load_on_admin' , $load );
440 438 }
441 439
442 440 /**
@@ -454,93 +452,96 @@
454 452
455 453 /**
456 454 * Adds the styles.
457 455 */
458 - public function enqueue_style() {
459 - global $aui_bs5;
456 + public function enqueue_style( $context = '' ) {
457 + global $aui_bs5;
460 458
461 - $load_fse = false;
459 + $load_fse = false;
462 460
463 461 if ( is_admin() && ! $this->is_aui_screen() ) {
464 462 // Don't add wp-admin scripts if not requested to.
465 463 } else {
466 464 $css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
467 - $rtl = is_rtl() && ! $aui_bs5 ? '-rtl' : '';
468 - $bs_ver = $this->settings['bs_ver'] == '5' ? '-v5' : '';
465 + $rtl = is_rtl() && ! $aui_bs5 ? '-rtl' : '';
466 + $bs_ver = $this->settings['bs_ver'] == '5' ? '-v5' : '';
469 467
470 468 if ( $this->settings[ $css_setting ] ) {
471 - $compatibility = $this->settings[$css_setting]=='core' ? false : true;
472 - $url = $this->settings[$css_setting]=='core' ? $this->url.'assets'.$bs_ver.'/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets'.$bs_ver.'/css/ayecode-ui-compatibility'.$rtl.'.css';
469 + $compatibility = $this->settings[ $css_setting ] == 'core' ? false : true;
470 + $base_url = $this->url . 'assets' . $bs_ver . '/css/';
471 + $url = $this->settings[ $css_setting ] == 'core' ? $base_url . 'ayecode-ui' . $rtl . '.css' : $base_url . 'ayecode-ui-compatibility' . $rtl . '.css';
473 472
474 473 wp_register_style( 'ayecode-ui', $url, array(), $this->version );
475 474 wp_enqueue_style( 'ayecode-ui' );
476 475
477 - if ( is_admin() && ( !empty($_REQUEST['postType']) || self::is_block_editor() ) && ( defined( 'BLOCKSTRAP_VERSION' ) || defined( 'AUI_FSE' ) ) ) {
478 - $url = $this->url.'assets'.$bs_ver.'/css/ayecode-ui-fse.css';
476 + if ( is_admin() && ( ! empty( $_REQUEST['postType'] ) || self::is_block_editor() ) && ( defined( 'BLOCKSTRAP_VERSION' ) || defined( 'AUI_FSE' ) ) ) {
477 + $url = $base_url . 'ayecode-ui-fse.css';
478 + $load_fse = true;
479 +
479 480 wp_register_style( 'ayecode-ui-fse', $url, array(), $this->version );
480 481 wp_enqueue_style( 'ayecode-ui-fse' );
481 - $load_fse = true;
482 482 }
483 483
484 - // flatpickr
485 - wp_register_style( 'flatpickr', $this->url.'assets'.$bs_ver.'/css/flatpickr.min.css', array(), $this->version );
484 + // Flatpickr
485 + wp_register_style( 'flatpickr', $base_url . 'flatpickr.min.css', array(), $this->version );
486 486
487 - // fix some wp-admin issues
488 - if(is_admin()){
489 - $custom_css = "
490 - body{
491 - background-color: #f1f1f1;
492 - font-family: -apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif;
493 - font-size:13px;
494 - }
495 - a {
496 - color: #0073aa;
497 - text-decoration: underline;
498 - }
499 - label {
500 - display: initial;
501 - margin-bottom: 0;
502 - }
503 - input, select {
504 - margin: 1px;
505 - line-height: initial;
506 - }
507 - th, td, div, h2 {
508 - box-sizing: content-box;
509 - }
510 - h1, h2, h3, h4, h5, h6 {
511 - display: block;
512 - font-weight: 600;
513 - }
514 - h2,h3 {
515 - font-size: 1.3em;
516 - margin: 1em 0
517 - }
518 - .blocks-widgets-container .bsui *{
519 - box-sizing: border-box;
520 - }
521 - .bs-tooltip-top .arrow{
522 - margin-left:0px;
523 - }
524 - .custom-switch input[type=checkbox]{
525 - display:none;
526 - }
527 - ";
487 + // Fix some wp-admin issues
488 + if ( is_admin() ) {
489 +$custom_css = "
490 +body:not(.editor-styles-wrapper){
491 + background-color: #f1f1f1;
492 + font-family: -apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif;
493 + font-size:13px;
494 +}
495 +a {
496 + color: #0073aa;
497 + text-decoration: underline;
498 +}
499 +label {
500 + display: initial;
501 + margin-bottom: 0;
502 +}
503 +input, select {
504 + margin: 1px;
505 + line-height: initial;
506 +}
507 +th, td, div, h2 {
508 + box-sizing: content-box;
509 +}
510 +h1, h2, h3, h4, h5, h6 {
511 + display: block;
512 + font-weight: 600;
513 +}
514 +h2,h3 {
515 + font-size: 1.3em;
516 + margin: 1em 0
517 +}
518 +.blocks-widgets-container .bsui *{
519 + box-sizing: border-box;
520 +}
521 +.bs-tooltip-top .arrow{
522 + margin-left:0px;
523 +}
524 +.custom-switch input[type=checkbox]{
525 + display:none;
526 +}
527 +";
528 528
529 - // @todo, remove once fixed :: fix for this bug https://github.com/WordPress/gutenberg/issues/14377
530 - $custom_css .= "
531 - .edit-post-sidebar input[type=color].components-text-control__input{
532 - padding: 0;
533 - }
534 - ";
529 +// @todo, remove once fixed :: fix for this bug https://github.com/WordPress/gutenberg/issues/14377
530 +$custom_css .= "
531 +.edit-post-sidebar input[type=color].components-text-control__input{
532 + padding: 0;
533 +}
534 +";
535 +
535 536 wp_add_inline_style( 'ayecode-ui', $custom_css );
536 537 }
537 538
538 - // custom changes
539 + // Custom changes.
539 540 if ( $load_fse ) {
540 - wp_add_inline_style( 'ayecode-ui-fse', self::custom_css($compatibility, true) );
541 - }else{
542 - wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
541 + wp_add_inline_style( 'ayecode-ui-fse', self::custom_css( $compatibility, true ) );
542 + } else {
543 + wp_add_inline_style( 'ayecode-ui', self::custom_css( $compatibility ) );
543 544 }
544 545 }
545 546 }
546 547 }
@@ -545,8 +546,20 @@
545 546 }
546 547 }
547 548
548 549 /**
550 + * Enqueue styles for block assets (both editor and frontend).
551 + * This ensures compatibility with WordPress 6.9+ requirements.
552 + */
553 + public function enqueue_block_assets() {
554 + global $wp_version;
555 +
556 + if ( is_admin() && version_compare( $wp_version, '6.9', '>=' ) ) {
557 + $this->enqueue_style( 'block_assets' );
558 + }
559 + }
560 +
561 + /**
549 562 * Get inline script used if bootstrap enqueued
550 563 *
551 564 * If this remains small then its best to use this than to add another JS file.
552 565 */
@@ -732,41 +745,53 @@
732 745 wp_enqueue_style( 'iconpicker' );
733 746 wp_enqueue_script( 'iconpicker' );
734 747 }
735 748
736 - /**
737 - * Get the url path to the current folder.
738 - *
739 - * This can be called very early, hence the need for the dynamic way of getting the URL.
740 - *
741 - * @since 0.2.31 changed to support edge cases like bitnami containers.
742 - * @return string
743 - */
744 - public function get_url() {
745 - $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
746 - $content_url = untrailingslashit( WP_CONTENT_URL );
749 + /**
750 + * Get the url path to the current folder.
751 + *
752 + * This can be called very early, hence the need for the dynamic way of getting the URL.
753 + *
754 + * @since 0.2.31 changed to support edge cases like bitnami containers.
755 + * @return string
756 + */
757 + public function get_url() {
758 + $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
759 + $content_url = untrailingslashit( WP_CONTENT_URL );
747 760
748 - // maybe Replace http:// to https://.
749 - if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
750 - $content_url = str_replace( 'http://', 'https://', $content_url );
751 - }
761 + // maybe Replace http:// to https://.
762 + if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
763 + $content_url = str_replace( 'http://', 'https://', $content_url );
764 + }
752 765
753 - // First find where in the path our content directory starts
754 - $content_basename = basename($content_dir);
755 - $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
766 + // First find where in the path our content directory starts
767 + $content_basename = basename($content_dir);
768 + $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
756 769
757 - // Find the relative path by matching from content directory name
758 - $after_content = substr($file_dir, strpos($file_dir, '/' . $content_basename . '/') + strlen('/' . $content_basename . '/'));
770 + // Find the relative path by matching from content directory name
771 + $after_content = substr($file_dir, strpos($file_dir, '/' . $content_basename . '/') + strlen('/' . $content_basename . '/'));
759 772
760 - // Build URL using WP_CONTENT_URL and the relative path
761 - $url = trailingslashit($content_url) . $after_content;
773 + // Build URL using WP_CONTENT_URL and the relative path
774 + $url = trailingslashit($content_url) . $after_content;
762 775
763 - // some hosts end up with /wp-content/wp-content/
764 - $url = str_replace( '/wp-content/wp-content/', '/wp-content/', $url );
776 + // some hosts end up with /wp-content/wp-content/
777 + $url = str_replace( '/wp-content/wp-content/', '/wp-content/', $url );
765 778
766 - return trailingslashit($url);
767 - }
779 + /**
780 + * Filters the URL to the AyeCode UI folder.
781 + *
782 + * Useful when the folder URL can't be worked out from its path, e.g. a symlinked plugin.
783 + *
784 + * @since 0.2.54
785 + *
786 + * @param string $url The AyeCode UI folder URL.
787 + * @param string $file_dir The AyeCode UI folder path.
788 + */
789 + $url = apply_filters( 'ayecode_ui_url', $url, $file_dir );
768 790
791 + return trailingslashit($url);
792 + }
793 +
769 794 /**
770 795 * Get the url path to the current folder.
771 796 * @todo remove
772 797 * @return string
@@ -1190,8 +1215,11 @@
1190 1215 if ( is_admin() ) {
1191 1216 echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}';
1192 1217 }
1193 1218
1219 + /* Prevent the backdrop from covering the modal inside a sticky element */
1220 + echo 'body.modal-open .sticky:has(.modal),body.modal-open .sticky-top:has(.modal){position:static!important}';
1221 +
1194 1222 $custom_css = '';
1195 1223
1196 1224 if ( $aui_bs5 && defined( 'BLOCKSTRAP_VERSION' ) && $bs_custom_css ) {
1197 1225 $css = '';
@@ -1331,8 +1359,15 @@
1331 1359 return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
1332 1360 }
1333 1361
1334 1362 public static function hex_to_rgb( $hex ) {
1363 + $hex = trim( (string) $hex );
1364 +
1365 + // CSS variables can't be resolved to RGB server side.
1366 + if ( $hex === '' || strpos( $hex, 'var(' ) !== false ) {
1367 + return '';
1368 + }
1369 +
1335 1370 // Remove '#' if present
1336 1371 $hex = str_replace( '#', '', $hex );
1337 1372
1338 1373 // Check if input is RGB
@@ -1345,10 +1380,15 @@
1345 1380
1346 1381 return $rgb;
1347 1382 }
1348 1383
1349 - // Convert 3-digit hex to 6-digit hex
1350 - if ( strlen( $hex ) == 3 ) {
1384 + // Only 3, 4, 6 or 8 digit hex can be converted, anything else (named colours, hsl() etc.) would give a wrong value.
1385 + if ( ! preg_match( '/^([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i', $hex ) ) {
1386 + return '';
1387 + }
1388 +
1389 + // Convert 3 or 4 digit hex to 6-digit hex (alpha is ignored)
1390 + if ( strlen( $hex ) <= 4 ) {
1351 1391 $hex = str_repeat( substr( $hex, 0, 1 ), 2 ) . str_repeat( substr( $hex, 1, 1 ), 2 ) . str_repeat( substr( $hex, 2, 1 ), 2 );
1352 1392 }
1353 1393
1354 1394 // Convert hex to RGB
@@ -1360,8 +1400,34 @@
1360 1400 return $r . ',' . $g . ',' . $b;
1361 1401 }
1362 1402
1363 1403 /**
1404 + * Replace --bs-{type}-rgb usages when the color has no RGB value (eg a CSS variable).
1405 + *
1406 + * rgba(var(--bs-{type}-rgb), .5) would be invalid without the -rgb variable, so use color-mix() on the color itself.
1407 + *
1408 + * @param string $css The generated CSS.
1409 + * @param string $type The color slug.
1410 + * @param string $color_code The color value.
1411 + *
1412 + * @return string
1413 + */
1414 + public static function css_rgb_fallback( $css, $type, $color_code ) {
1415 + $type = preg_quote( $type, '/' );
1416 +
1417 + // A comma triplet is required here, so leave the value from the stylesheet in place.
1418 + $css = preg_replace( '/--bs-btn-focus-shadow-rgb:\s*var\(--bs-' . $type . '-rgb\);/', '', $css );
1419 +
1420 + return preg_replace_callback( '/rgba?\(\s*var\(--bs-' . $type . '-rgb\)\s*(?:,\s*([0-9]*\.?[0-9]+)\s*)?\)/', function( $m ) use ( $color_code ) {
1421 + if ( ! isset( $m[1] ) || (float) $m[1] >= 1 ) {
1422 + return $color_code;
1423 + }
1424 +
1425 + return 'color-mix(in srgb, ' . $color_code . ' ' . round( (float) $m[1] * 100, 2 ) . '%, transparent)';
1426 + }, $css );
1427 + }
1428 +
1429 + /**
1364 1430 * Build the CSS to overwrite a bootstrap color variable.
1365 1431 *
1366 1432 * @param $type
1367 1433 * @param $color_code
@@ -1478,9 +1544,9 @@
1478 1544 } else if ( $aui_bs5 ) {
1479 1545 $output .= $prefix . ' .text-' . sanitize_key( $type ) . '{color: var(--bs-' . sanitize_key( $type ) . ') !important;}';
1480 1546 }
1481 1547
1482 - $output .= $prefix . ' .link-'.esc_attr($type).' {color: var(--bs-'.esc_attr($type).'-rgb) !important;}';
1548 + $output .= $prefix . ' .link-'.esc_attr($type).' {color: var(--bs-'.esc_attr($type).') !important;}';
1483 1549 $output .= $prefix . ' .link-'.esc_attr($type).':hover {color: rgba(var(--bs-'.esc_attr($type).'-rgb), .8) !important;}';
1484 1550
1485 1551 // buttons
1486 1552 $output .= $prefix . ' .btn-'.esc_attr($type).'{';
@@ -1488,9 +1554,9 @@
1488 1554 --bs-btn-bg: '.esc_attr($color_code).';
1489 1555 --bs-btn-border-color: '.esc_attr($color_code).';
1490 1556 --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1491 1557 --bs-btn-hover-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1492 - --bs-btn-focus-shadow-rgb: --bs-'.esc_attr($type).'-rgb;
1558 + --bs-btn-focus-shadow-rgb: var(--bs-'.esc_attr($type).'-rgb);
1493 1559 --bs-btn-active-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1494 1560 --bs-btn-active-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1495 1561 --bs-btn-active-shadow: unset;
1496 1562 --bs-btn-disabled-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .5);
@@ -1510,9 +1576,9 @@
1510 1576 --bs-btn-color: '.esc_attr($color_code).';
1511 1577 --bs-btn-border-color: '.esc_attr($color_code).';
1512 1578 --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1513 1579 --bs-btn-hover-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1514 - --bs-btn-focus-shadow-rgb: --bs-'.esc_attr($type).'-rgb;
1580 + --bs-btn-focus-shadow-rgb: var(--bs-'.esc_attr($type).'-rgb);
1515 1581 --bs-btn-active-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1516 1582 --bs-btn-active-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1517 1583 --bs-btn-active-shadow: unset;
1518 1584 --bs-btn-disabled-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .5);
@@ -1541,16 +1607,15 @@
1541 1607 }
1542 1608
1543 1609 // $output .= $is_var ? 'html body {--bs-'.esc_attr($type).'-rgb: '.$color_code.'; }' : 'html body {--bs-'.esc_attr($type).'-rgb: '.self::hex_to_rgb($color_code).'; }';
1544 1610 $output .= 'html body {--bs-'.esc_attr($type).': '.esc_attr($color_code).'; }';
1545 - $output .= 'html body {--bs-'.esc_attr($type).'-rgb: '.$rgb.'; }';
1611 +
1612 + if ( $rgb !== '' ) {
1613 + $output .= 'html body {--bs-' . esc_attr( $type ) . '-rgb: ' . $rgb . '; }';
1614 + }
1546 1615 }
1547 1616
1548 -
1549 1617 if ( $is_custom ) {
1550 -
1551 -// echo '###'.$type;exit;
1552 -
1553 1618 // build rules into each type
1554 1619 foreach($selectors as $selector => $types){
1555 1620 $selector = $compatibility ? $compatibility . " ".$selector : $selector;
1556 1621 $types = array_combine($types,$types);
@@ -1651,8 +1716,18 @@
1651 1716 // $output .= $is_var ? '' : $prefix ." .alert-{$type} {background-color: ".$color_code."20; border-color: ".$color_code."30;color:$darker_40} ";
1652 1717 $output .= $prefix ." .alert-{$type} {--bs-alert-bg: rgba(var(--bs-{$type}-rgb), .1 ) !important;--bs-alert-border-color: rgba(var(--bs-{$type}-rgb), .25 ) !important;--bs-alert-color: rgba(var(--bs-{$type}-rgb), 1 ) !important;} ";
1653 1718 }
1654 1719
1720 + if ( $rgb === '' ) {
1721 + // The stylesheet builds these from --bs-{type}-rgb, which is not set for this color.
1722 + if ( $aui_bs5 ) {
1723 + $output .= $prefix . " .bg-{$type}{background-color: color-mix(in srgb, $color_code calc(var(--bs-bg-opacity, 1) * 100%), transparent) !important;} ";
1724 + $output .= $prefix . " .border-{$type}{border-color: color-mix(in srgb, $color_code calc(var(--bs-border-opacity, 1) * 100%), transparent) !important;} ";
1725 + }
1726 +
1727 + $output = self::css_rgb_fallback( $output, $type, $color_code );
1728 + }
1729 +
1655 1730 return $output;
1656 1731 }
1657 1732
1658 1733 /**
@@ -1769,9 +1844,12 @@
1769 1844 $output = '';
1770 1845
1771 1846 if ( $aui_bs5 ) {
1772 1847 // $output .= $is_var ? 'html body {--bs-'.esc_attr($type).'-rgb: '.$color_code.'; }' : 'html body {--bs-'.esc_attr($type).'-rgb: '.self::hex_to_rgb($color_code).'; }';
1773 - $output .= 'html body {--bs-'.esc_attr($type).'-rgb: '.$rgb.'; }';
1848 +
1849 + if ( $rgb !== '' ) {
1850 + $output .= 'html body {--bs-' . esc_attr( $type ) . '-rgb: ' . $rgb . '; }';
1851 + }
1774 1852 }
1775 1853
1776 1854 // build rules into each type
1777 1855 foreach($selectors as $selector => $types){
@@ -1867,8 +1945,18 @@
1867 1945 // $output .= $is_var ? '' : $prefix ." .alert-{$type} {background-color: ".$color_code."20; border-color: ".$color_code."30;color:$darker_40} ";
1868 1946 $output .= $prefix ." .alert-{$type} {--bs-alert-bg: rgba(var(--bs-{$type}-rgb), .1 ) !important;--bs-alert-border-color: rgba(var(--bs-{$type}-rgb), .25 ) !important;--bs-alert-color: rgba(var(--bs-{$type}-rgb), 1 ) !important;} ";
1869 1947 }
1870 1948
1949 + if ( $rgb === '' ) {
1950 + // The stylesheet builds these from --bs-{type}-rgb, which is not set for this color.
1951 + if ( $aui_bs5 ) {
1952 + $output .= $prefix . " .bg-{$type}{background-color: color-mix(in srgb, $color_code calc(var(--bs-bg-opacity, 1) * 100%), transparent) !important;} ";
1953 + $output .= $prefix . " .border-{$type}{border-color: color-mix(in srgb, $color_code calc(var(--bs-border-opacity, 1) * 100%), transparent) !important;} ";
1954 + }
1955 +
1956 + $output = self::css_rgb_fallback( $output, $type, $color_code );
1957 + }
1958 +
1871 1959 return $output;
1872 1960 }
1873 1961
1874 1962 /**
@@ -3187,9 +3275,9 @@
3187 3275 * @return bool
3188 3276 */
3189 3277 public static function is_block_editor() {
3190 3278 if ( is_admin() ) {
3191 - $current_screen = function_exists('get_current_screen' ) ? get_current_screen() : array();
3279 + $current_screen = function_exists( 'get_current_screen' ) ? get_current_screen() : array();
3192 3280
3193 3281 if ( ! empty( $current_screen ) && $current_screen->is_block_editor() ) {
3194 3282 return true;
3195 3283 }