Passed
Push — master ( e51c9a...41921a )
by Chris
04:16
created

lib/theme-support.php (17 issues)

1
<?php
0 ignored issues
show
This file is missing a doc comment.
Loading history...
2
3
/**
4
 * Enqueues the editor styles.
5
 *
6
 * @return void
7
 */
8
function editor_styles() {
0 ignored issues
show
Expected 2 blank lines before function; 1 found
Loading history...
Expected 0 blank lines after opening function brace; 1 found
Loading history...
9
10
	// Enqueue  shared editor styles.
11
	add_editor_style(
12
		'/assets/css/admin/gutenberg-admin.css'
13
	);
14
	add_editor_style(
15
		'/assets/css/yoast/yoast.css'
16
	);
17
18
}
0 ignored issues
show
Expected 2 blank lines after function; 0 found
Loading history...
19
add_action( 'admin_init', 'editor_styles' );
20
21
/**
22
 * Add theme support functions.
23
 *
24
 * @package lsx
25
 */
26
27
if ( ! function_exists( 'theme_support' ) ) :
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
28
	/**
29
	 * Add theme support functions.
30
	 *
31
	 * @return void
32
	 */
33
	function theme_support() {
0 ignored issues
show
Expected 2 blank lines before function; 0 found
Loading history...
34
		// Add support for editor styles.
35
		add_theme_support( 'editor-styles' );
36
		// Add support for full and wide align images.
37
		add_theme_support( 'align-wide' );
38
		// Add support for styling blocks.
39
		add_theme_support( 'wp-block-styles' );
40
		// Add support for responsive embedded content.
41
		add_theme_support( 'responsive-embeds' );
42
		// Add support for Custom Line Heights.
43
		add_theme_support( 'custom-line-height' );
44
		// Add support for Custom Units.
45
		add_theme_support( 'custom-units' );
46
		// Add custom editor font sizes.
47
		add_theme_support(
48
			'editor-font-sizes',
49
			array(
50
				array(
51
					'name'      => esc_html_x( 'Small', 'font size option label', 'lsx' ),
52
					'shortName' => esc_html_x( 'S', 'abbreviation of the font size option label', 'lsx' ),
53
					'size'      => 13,
54
					'slug'      => 'small',
55
				),
56
				array(
57
					'name'      => esc_html_x( 'Normal', 'font size option label', 'lsx' ),
58
					'shortName' => esc_html_x( 'N', 'abbreviation of the font size option label', 'lsx' ),
59
					'size'      => 15,
60
					'slug'      => 'normal',
61
				),
62
				array(
63
					'name'      => esc_html_x( 'Medium', 'font size option label', 'lsx' ),
64
					'shortName' => esc_html_x( 'M', 'abbreviation of the font size option label', 'lsx' ),
65
					'size'      => 22,
66
					'slug'      => 'medium',
67
				),
68
				array(
69
					'name'      => esc_html_x( 'Large', 'font size option label', 'lsx' ),
70
					'shortName' => esc_html_x( 'L', 'abbreviation of the font size option label', 'lsx' ),
71
					'size'      => 30,
72
					'slug'      => 'large',
73
				),
74
				array(
75
					'name'      => esc_html_x( 'Huge', 'font size option label', 'lsx' ),
76
					'shortName' => esc_html_x( 'XL', 'abbreviation of the font size option label', 'lsx' ),
77
					'size'      => 40,
78
					'slug'      => 'huge',
79
				),
80
			)
81
		);
82
83
		// Add support for custom color scheme.
84
		add_theme_support( 'editor-color-palette', array(
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
For multi-line function calls, each argument should be on a separate line.

For a function calls that spawns multiple lines, the coding style suggests to split arguments to separate lines like this:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
);
Loading history...
85
			array(
86
				'name'  => __( 'Strong Blue', 'lsx' ),
87
				'slug'  => 'strong-blue',
88
				'color' => '#27639e',
89
			),
90
			array(
91
				'name'  => __( 'Lighter Blue', 'lsx' ),
92
				'slug'  => 'lighter-blue',
93
				'color' => '#428bca',
94
			),
95
			array(
96
				'name'  => __( 'Yellow', 'lsx' ),
97
				'slug'  => 'light-yellow',
98
				'color' => '#f7ae00',
99
			),
100
			array(
101
				'name'  => __( 'Dark Yellow', 'lsx' ),
102
				'slug'  => 'dark-yellow',
103
				'color' => '#ab7800',
104
			),
105
			array(
106
				'name'  => __( 'Green', 'lsx' ),
107
				'slug'  => 'light-green',
108
				'color' => '#6BA913',
109
			),
110
			array(
111
				'name'  => __( 'Dark Green', 'lsx' ),
112
				'slug'  => 'dark-green',
113
				'color' => '#3F640B',
114
			),
115
			array(
116
				'name'  => __( 'White', 'lsx' ),
117
				'slug'  => 'white',
118
				'color' => '#ffffff',
119
			),
120
			array(
121
				'name'  => __( 'Black', 'lsx' ),
122
				'slug'  => 'black',
123
				'color' => '#000000',
124
			),
125
		) );
0 ignored issues
show
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
126
127
		$primary_color    = 'rgba(39,99,158,1)';
128
		$secondary_color  = 'rgba(247,174,0,1)';
129
		$tertiary_color   = 'rgba(107,169,19,1)';
130
		$background_color = 'rgba(249,249,249,1)';
131
132
		add_theme_support(
133
			'editor-gradient-presets',
134
			array(
135
				array(
136
					'name'     => __( 'Primary to Secondary', 'lsx' ),
137
					'gradient' => 'linear-gradient(135deg, ' . esc_attr( $primary_color ) . ' 0%, ' . esc_attr( $secondary_color ) . ' 100%)',
138
					'slug'     => 'primary-to-secondary',
139
				),
140
				array(
141
					'name'     => __( 'Primary to Tertiary', 'lsx' ),
142
					'gradient' => 'linear-gradient(135deg, ' . esc_attr( $primary_color ) . ' 0%, ' . esc_attr( $tertiary_color ) . ' 100%)',
143
					'slug'     => 'primary-to-tertiary',
144
				),
145
				array(
146
					'name'     => __( 'Primary to Background', 'lsx' ),
147
					'gradient' => 'linear-gradient(135deg, ' . esc_attr( $primary_color ) . ' 0%, ' . esc_attr( $background_color ) . ' 100%)',
148
					'slug'     => 'primary-to-background',
149
				),
150
				array(
151
					'name'     => __( 'Secondary to Tertiary', 'lsx' ),
152
					'gradient' => 'linear-gradient(135deg, ' . esc_attr( $secondary_color ) . ' 0%, ' . esc_attr( $tertiary_color ) . ' 100%)',
153
					'slug'     => 'secondary-to-tertiary',
154
				),
155
			)
156
		);
157
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 0 found
Loading history...
158
endif;
159
add_action( 'after_setup_theme', 'theme_support' );
160
161
/**
162
 * WPForms submit button, match Gutenberg button block
163
 *
164
 * @param [type] $form_data
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
165
 * @return void
0 ignored issues
show
Function return type is void, but function contains return statement
Loading history...
166
 */
167
function lsx_wpforms_match_button_block( $form_data ) {
0 ignored issues
show
Expected 2 blank lines before function; 1 found
Loading history...
168
	$form_data['settings']['submit_class'] .= ' btn';
169
	return $form_data;
170
}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 0 found
Loading history...
171
add_filter( 'wpforms_frontend_form_data', 'lsx_wpforms_match_button_block' );
172