| @@ -480,107 +480,5 @@ | ||
| 480 | 480 | ], |
| 481 | 481 | admin_url( 'admin.php' ) |
| 482 | 482 | ); |
| 483 | 483 | } |
| 484 | - | |
| 485 | - public static function get_plugin_work_info() { | |
| 486 | - $plugin_work = [ | |
| 487 | - 'yaymail' => false, | |
| 488 | - 'yaymagic-email-builder' => false, | |
| 489 | - ]; | |
| 490 | - | |
| 491 | - if ( function_exists( '\YayMail\init' ) && function_exists( 'WC' ) ) { | |
| 492 | - if ( class_exists( 'YaymailPluginAdapter', false ) && method_exists( 'YaymailPluginAdapter', 'is_licensed' ) ) { | |
| 493 | - $plugin_work['yaymail'] = \YaymailPluginAdapter::is_licensed(); | |
| 494 | - } else { | |
| 495 | - $plugin_work['yaymail'] = true; | |
| 496 | - } | |
| 497 | - } | |
| 498 | - | |
| 499 | - if ( function_exists( '\YayMail\wp_mail_init' ) ) { | |
| 500 | - if ( class_exists( 'YaymailWpPluginAdapter', false ) && method_exists( 'YaymailWpPluginAdapter', 'is_licensed' ) ) { | |
| 501 | - $plugin_work['yaymagic-email-builder'] = \YaymailWpPluginAdapter::is_licensed(); | |
| 502 | - } else { | |
| 503 | - $plugin_work['yaymagic-email-builder'] = true; | |
| 504 | - } | |
| 505 | - } | |
| 506 | - | |
| 507 | - return $plugin_work; | |
| 508 | - } | |
| 509 | - | |
| 510 | - public static function get_plugin_path() { | |
| 511 | - return \YayMail\Platform\PlatformRegistry::host_platform()->plugin_path(); | |
| 512 | - } | |
| 513 | - | |
| 514 | - public static function get_plugin_url() { | |
| 515 | - return \YayMail\Platform\PlatformRegistry::host_platform()->plugin_url(); | |
| 516 | - } | |
| 517 | - public static function scope_css_block( $css, $scope_selector ) { | |
| 518 | - $result = ''; | |
| 519 | - $length = strlen( $css ); | |
| 520 | - $offset = 0; | |
| 521 | - | |
| 522 | - while ( $offset < $length ) { | |
| 523 | - $open_brace_pos = strpos( $css, '{', $offset ); | |
| 524 | - if ( false === $open_brace_pos ) { | |
| 525 | - $result .= substr( $css, $offset ); | |
| 526 | - break; | |
| 527 | - } | |
| 528 | - | |
| 529 | - $selector_text = trim( substr( $css, $offset, $open_brace_pos - $offset ) ); | |
| 530 | - $cursor = $open_brace_pos + 1; | |
| 531 | - $depth = 1; | |
| 532 | - | |
| 533 | - while ( $cursor < $length && $depth > 0 ) { | |
| 534 | - $char = $css[ $cursor ]; | |
| 535 | - if ( '{' === $char ) { | |
| 536 | - ++$depth; | |
| 537 | - } elseif ( '}' === $char ) { | |
| 538 | - --$depth; | |
| 539 | - } | |
| 540 | - ++$cursor; | |
| 541 | - } | |
| 542 | - | |
| 543 | - $body_text = substr( $css, $open_brace_pos + 1, $cursor - $open_brace_pos - 2 ); | |
| 544 | - $offset = $cursor; | |
| 545 | - | |
| 546 | - if ( '' === $selector_text ) { | |
| 547 | - continue; | |
| 548 | - } | |
| 549 | - | |
| 550 | - if ( str_starts_with( $selector_text, '@media' ) || str_starts_with( $selector_text, '@supports' ) ) { | |
| 551 | - $result .= $selector_text . '{' . self::scope_css_block( $body_text, $scope_selector ) . '}'; | |
| 552 | - continue; | |
| 553 | - } | |
| 554 | - | |
| 555 | - if ( str_starts_with( $selector_text, '@' ) ) { | |
| 556 | - $result .= $selector_text . '{' . $body_text . '}'; | |
| 557 | - continue; | |
| 558 | - } | |
| 559 | - | |
| 560 | - $selector_list = array_filter( | |
| 561 | - array_map( 'trim', explode( ',', $selector_text ) ), | |
| 562 | - static function( $selector ) { | |
| 563 | - return '' !== $selector; | |
| 564 | - } | |
| 565 | - ); | |
| 566 | - | |
| 567 | - if ( empty( $selector_list ) ) { | |
| 568 | - continue; | |
| 569 | - } | |
| 570 | - | |
| 571 | - $scoped_selectors = array_map( | |
| 572 | - static function( $selector ) use ( $scope_selector ) { | |
| 573 | - if ( str_starts_with( $selector, $scope_selector ) ) { | |
| 574 | - return $selector; | |
| 575 | - } | |
| 576 | - return $scope_selector . ' ' . $selector; | |
| 577 | - }, | |
| 578 | - $selector_list | |
| 579 | - ); | |
| 580 | - | |
| 581 | - $result .= implode( ', ', $scoped_selectors ) . '{' . $body_text . '}'; | |
| 582 | - }//end while | |
| 583 | - | |
| 584 | - return $result; | |
| 585 | - } | |
| 586 | 484 | } |