← All changes
|
Libs/adminify-framework/classes/setup.class.php
+12
-24
4.2.21
→
4.0.3.2
View file →
| @@ -67,11 +67,9 @@ | ||
| 67 | 67 | // Init action |
| 68 | 68 | do_action( 'adminify_init' ); |
| 69 | 69 | |
| 70 | 70 | // Setup textdomain |
| 71 | - add_action( 'init', function(){ | |
| 72 | - self::textdomain(); | |
| 73 | - }); | |
| 71 | + self::textdomain(); | |
| 74 | 72 | |
| 75 | 73 | add_action( 'after_setup_theme', array( 'ADMINIFY', 'setup' ) ); |
| 76 | 74 | add_action( 'init', array( 'ADMINIFY', 'setup' ) ); |
| 77 | 75 | add_action( 'switch_theme', array( 'ADMINIFY', 'setup' ) ); |
| @@ -177,9 +175,9 @@ | ||
| 177 | 175 | |
| 178 | 176 | // Setup taxonomy option framework |
| 179 | 177 | $params = array(); |
| 180 | 178 | if ( class_exists( 'ADMINIFY_Taxonomy_Options' ) && ! empty( self::$args['taxonomy_options'] ) ) { |
| 181 | - $taxonomy = ( isset( $_GET['taxonomy'] ) ) ? sanitize_text_field( wp_unslash( $_GET['taxonomy'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change. | |
| 179 | + $taxonomy = ( isset( $_GET['taxonomy'] ) ) ? sanitize_text_field( wp_unslash( $_GET['taxonomy'] ) ) : ''; | |
| 182 | 180 | foreach ( self::$args['taxonomy_options'] as $key => $value ) { |
| 183 | 181 | if ( ! empty( self::$args['sections'][$key] ) && ! isset( self::$inited[$key] ) ) { |
| 184 | 182 | |
| 185 | 183 | $params['args'] = $value; |
| @@ -577,19 +575,14 @@ | ||
| 577 | 575 | // Wp color picker |
| 578 | 576 | wp_enqueue_style( 'wp-color-picker' ); |
| 579 | 577 | wp_enqueue_script( 'wp-color-picker' ); |
| 580 | 578 | |
| 581 | - // Font awesome 4 and 5 loader. The font files live in the main plugin's | |
| 582 | - // assets/ directory, not inside the framework, so resolve the base URL | |
| 583 | - // from there to avoid a 404 on the framework-relative path. | |
| 584 | - $adminify_fa_base = defined( 'PXLBSADMINIFY_ASSETS' ) | |
| 585 | - ? PXLBSADMINIFY_ASSETS . 'vendors/fontawesome/' | |
| 586 | - : self::include_plugin_url( 'assets/vendors/fontawesome/' ); | |
| 579 | + // Font awesome 4 and 5 loader | |
| 587 | 580 | if ( apply_filters( 'adminify_fa4', false ) ) { |
| 588 | - wp_enqueue_style( 'adminify-fa', $adminify_fa_base . 'fa4/css/font-awesome.min.css', array(), '4.7.0', 'all' ); | |
| 581 | + wp_enqueue_style( 'adminify-fa', 'https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css', array(), '4.7.0', 'all' ); | |
| 589 | 582 | } else { |
| 590 | - wp_enqueue_style( 'adminify-fa5', $adminify_fa_base . 'fa5/css/all.min.css', array(), '5.15.4', 'all' ); | |
| 591 | - wp_enqueue_style( 'adminify-fa5-v4-shims', $adminify_fa_base . 'fa5/css/v4-shims.min.css', array(), '5.15.4', 'all' ); | |
| 583 | + wp_enqueue_style( 'adminify-fa5', 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/all.min.css', array(), '5.15.5', 'all' ); | |
| 584 | + wp_enqueue_style( 'adminify-fa5-v4-shims', 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/v4-shims.min.css', array(), '5.15.5', 'all' ); | |
| 592 | 585 | } |
| 593 | 586 | |
| 594 | 587 | // Check for developer mode |
| 595 | 588 | $min = ( self::$premium && SCRIPT_DEBUG ) ? '' : '.min'; |
| @@ -610,9 +603,8 @@ | ||
| 610 | 603 | wp_localize_script( 'adminify', 'adminify_vars', array( |
| 611 | 604 | 'color_palette' => apply_filters( 'adminify_color_palette', array() ), |
| 612 | 605 | 'i18n' => array( |
| 613 | 606 | 'confirm' => esc_html__( 'Are you sure?', 'adminify' ), |
| 614 | - /* translators: %s: minimum number of characters required to trigger a search. */ | |
| 615 | 607 | 'typing_text' => esc_html__( 'Please enter %s or more characters', 'adminify' ), |
| 616 | 608 | 'searching_text' => esc_html__( 'Searching...', 'adminify' ), |
| 617 | 609 | 'no_results_text' => esc_html__( 'No results found.', 'adminify' ), |
| 618 | 610 | ), |
| @@ -663,9 +655,9 @@ | ||
| 663 | 655 | } |
| 664 | 656 | |
| 665 | 657 | $query['display'] = 'swap'; |
| 666 | 658 | |
| 667 | - wp_enqueue_style( 'adminify-google-web-fonts', esc_url( add_query_arg( $query, '//fonts.googleapis.com/css' ) ), array(), PXLBSADMINIFY_VER ); | |
| 659 | + wp_enqueue_style( 'adminify-google-web-fonts', esc_url( add_query_arg( $query, '//fonts.googleapis.com/css' ) ), array(), null ); | |
| 668 | 660 | |
| 669 | 661 | } |
| 670 | 662 | |
| 671 | 663 | if ( ! empty( self::$webfonts['async'] ) ) { |
| @@ -675,9 +667,9 @@ | ||
| 675 | 667 | foreach ( self::$webfonts['async'] as $family => $styles ) { |
| 676 | 668 | $fonts[] = $family . ( ( ! empty( $styles ) ) ? ':'. implode( ',', $styles ) : '' ); |
| 677 | 669 | } |
| 678 | 670 | |
| 679 | - wp_enqueue_script( 'adminify-google-web-fonts', self::include_plugin_url( 'assets/js/webfont.js' ), array(), self::$version, false ); | |
| 671 | + wp_enqueue_script( 'adminify-google-web-fonts', esc_url( '//ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js' ), array(), null ); | |
| 680 | 672 | |
| 681 | 673 | wp_localize_script( 'adminify-google-web-fonts', 'WebFontConfig', array( 'google' => array( 'families' => $fonts ) ) ); |
| 682 | 674 | |
| 683 | 675 | } |
| @@ -700,9 +692,9 @@ | ||
| 700 | 692 | // Add custom css to front page |
| 701 | 693 | public static function add_custom_css() { |
| 702 | 694 | |
| 703 | 695 | if ( ! empty( self::$css ) ) { |
| 704 | - echo '<style type="text/css">'. wp_strip_all_tags( self::$css ) .'</style>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- wp_strip_all_tags() removes all markup; CSS-only content cannot break out of the <style> block. | |
| 696 | + echo '<style type="text/css">'. wp_strip_all_tags( self::$css ) .'</style>'; | |
| 705 | 697 | } |
| 706 | 698 | |
| 707 | 699 | } |
| 708 | 700 | |
| @@ -760,17 +752,16 @@ | ||
| 760 | 752 | |
| 761 | 753 | } |
| 762 | 754 | |
| 763 | 755 | // These attributes has been sanitized above. |
| 764 | - ob_start(); | |
| 765 | - echo '<div class="adminify-field adminify-field-'. esc_attr( $field_type . $is_pseudo . $class . $visible ) .'"'. $depend .'>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- value pre-escaped where built. | |
| 756 | + echo '<div class="adminify-field adminify-field-'. $field_type . $is_pseudo . $class . $visible .'"'. $depend .'>'; | |
| 766 | 757 | |
| 767 | 758 | if ( ! empty( $field_type ) ) { |
| 768 | 759 | |
| 769 | 760 | if ( ! empty( $field['title'] ) ) { |
| 770 | 761 | echo '<div class="adminify-title">'; |
| 771 | - echo '<h4>'. wp_kses_post( $field['title'] ) .'</h4>'; | |
| 772 | - echo ( ! empty( $field['subtitle'] ) ) ? '<div class="adminify-subtitle-text">'. wp_kses_post( $field['subtitle'] ) .'</div>' : ''; | |
| 762 | + echo '<h4>'. $field['title'] .'</h4>'; | |
| 763 | + echo ( ! empty( $field['subtitle'] ) ) ? '<div class="adminify-subtitle-text">'. $field['subtitle'] .'</div>' : ''; | |
| 773 | 764 | echo '</div>'; |
| 774 | 765 | } |
| 775 | 766 | |
| 776 | 767 | echo ( ! empty( $field['title'] ) ) ? '<div class="adminify-fieldset">' : ''; |
| @@ -793,11 +784,8 @@ | ||
| 793 | 784 | |
| 794 | 785 | echo ( ! empty( $field['title'] ) ) ? '</div>' : ''; |
| 795 | 786 | echo '<div class="clear"></div>'; |
| 796 | 787 | echo '</div>'; |
| 797 | - | |
| 798 | - $html = ob_get_clean(); | |
| 799 | - echo apply_filters( 'pxlbsadminify_render_field_html', $html, $field ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- value pre-escaped where built. | |
| 800 | 788 | |
| 801 | 789 | } |
| 802 | 790 | |
| 803 | 791 | } |