PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 3.8.9
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v3.8.9
4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 All 200 releases
← All changes | includes/Editors/BlockEditor/FontLoader.php +67 -60 3.4.23.8.9 View file →
@@ -5,71 +5,78 @@
5 5 use WPDeveloper\BetterDocs\Utils\Base;
6 6
7 7 class FontLoader extends Base {
8 8
9 - public static $registered_blocks = [
10 - 'betterdocs/betterdocs-print',
11 - 'betterdocs/breadcrumb',
12 - 'betterdocs/categorybox',
13 - 'betterdocs/categorygrid',
14 - 'betterdocs/archive-doc-list',
15 - 'betterdocs/single-doc-content',
16 - 'betterdocs/date',
17 - 'betterdocs/doc-navigation',
18 - 'betterdocs/feedback-form',
19 - 'betterdocs/reactions',
20 - 'betterdocs/searchbox',
21 - 'betterdocs/sidebar',
22 - 'betterdocs/social-share',
23 - 'betterdocs/table-of-contents',
24 - 'betterdocs/multiple-kb'
25 - ];
9 + public static $registered_blocks = [
10 + 'betterdocs/betterdocs-print',
11 + 'betterdocs/breadcrumb',
12 + 'betterdocs/categorybox',
13 + 'betterdocs/categorygrid',
14 + 'betterdocs/archive-doc-list',
15 + 'betterdocs/single-doc-content',
16 + 'betterdocs/date',
17 + 'betterdocs/doc-navigation',
18 + 'betterdocs/feedback-form',
19 + 'betterdocs/reactions',
20 + 'betterdocs/searchbox',
21 + 'betterdocs/sidebar',
22 + 'betterdocs/social-share',
23 + 'betterdocs/table-of-contents',
24 + 'betterdocs/multiple-kb',
25 + 'betterdocs/betterdocs-encyclopedia',
26 + 'betterdocs/glossary-single-template',
27 + 'betterdocs/faq',
28 + 'betterdocs/multiple-kb-tab',
29 + 'betterdocs/categoryhandbook',
30 + 'betterdocs/popular-docs',
31 + 'betterdocs/related-categories'
32 + ];
26 33
27 - public static $retrieved_fonts = [];
34 + public static $retrieved_fonts = [];
28 35
29 - public function __construct() {
30 - add_filter( 'render_block', [$this, 'get_betterdocs_blocks'], 10, 2 );
31 - add_action( 'wp_footer', [$this, 'enqueue_google_fonts'], 10 );
32 - }
36 + public function __construct() {
37 + add_filter( 'render_block', [ $this, 'get_betterdocs_blocks' ], 10, 2 );
38 + add_action( 'wp_footer', [ $this, 'enqueue_google_fonts' ], 10 );
39 + }
33 40
34 - public function get_betterdocs_blocks( $block_content, $block ) {
35 - if ( isset( $block['attrs'] ) ) {
36 - if ( in_array( $block['blockName'], self::$registered_blocks ) ) {
37 - $fonts = self::get_fonts_family( $block['attrs'] );
38 - self::$retrieved_fonts = array_unique( array_merge( self::$retrieved_fonts, $fonts ) );
39 - }
40 - }
41 + public function get_betterdocs_blocks( $block_content, $block ) {
42 + if ( isset( $block['attrs'] ) ) {
43 + if ( in_array( $block['blockName'], self::$registered_blocks ) ) {
44 + $fonts = self::get_fonts_family( $block['attrs'] );
45 + self::$retrieved_fonts = array_unique( array_merge( self::$retrieved_fonts, $fonts ) );
46 + }
47 + }
41 48
42 - return $block_content;
43 - }
49 + return $block_content;
50 + }
44 51
45 - public static function get_fonts_family( $attributes ) {
46 - $keys = preg_grep( '/^(\w+)FontFamily/i', array_keys( $attributes ), 0 );
47 - $google_font_family = [];
48 - foreach ( $keys as $key ) {
49 - $google_font_family[$attributes[$key]] = $attributes[$key];
50 - }
51 - return $google_font_family;
52 - }
52 + public static function get_fonts_family( $attributes ) {
53 + $keys = preg_grep( '/^(\w+)FontFamily/i', array_keys( $attributes ), 0 );
54 + $google_font_family = [];
55 + foreach ( $keys as $key ) {
56 + $google_font_family[ $attributes[ $key ] ] = $attributes[ $key ];
57 + }
58 + return $google_font_family;
59 + }
53 60
54 - public function enqueue_google_fonts() {
55 - if( ! empty( self::$retrieved_fonts ) ) {
56 - $google_fonts = '';
57 - $google_fonts_attr = ':100,100italic,200,200italic,300,300italic,400,400italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic';
58 - foreach ( self::$retrieved_fonts as $font ) {
59 - $google_fonts .= str_replace( ' ', '+', trim( $font ) ) . $google_fonts_attr . '|';
60 - }
61 - if ( ! empty( $google_fonts ) ) {
62 - $query_args = [
63 - 'family' => $google_fonts
64 - ];
65 - wp_register_style(
66 - 'betterdocs-goggle-fonts',
67 - add_query_arg( $query_args, '//fonts.googleapis.com/css' ),
68 - [],
69 - betterdocs()->version
70 - );
71 - wp_enqueue_style( 'betterdocs-goggle-fonts' );
72 - }
73 - }
74 - }
61 + public function enqueue_google_fonts() {
62 + if ( ! empty( self::$retrieved_fonts ) ) {
63 + $google_fonts = '';
64 + $google_fonts_attr = ':100,100italic,200,200italic,300,300italic,400,400italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic';
65 + foreach ( self::$retrieved_fonts as $font ) {
66 + $google_fonts .= str_replace( ' ', '+', trim( $font ) ) . $google_fonts_attr . '|';
67 + }
68 + if ( ! empty( $google_fonts ) ) {
69 + $query_args = [
70 + 'family' => $google_fonts
71 + ];
72 + wp_register_style(
73 + 'betterdocs-goggle-fonts',
74 + add_query_arg( $query_args, '//fonts.googleapis.com/css' ),
75 + [],
76 + betterdocs()->version
77 + );
78 + wp_enqueue_style( 'betterdocs-goggle-fonts' );
79 + }
80 + }
81 + }
75 82 }