Conditions | 4 |
Paths | 3 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
22 | static function render( $attributes = array() ) { |
||
|
|||
23 | $accepted_attributes = array( |
||
24 | 'id', |
||
25 | 'detail', |
||
26 | ); |
||
27 | |||
28 | $shortcode_attributes = array(); |
||
29 | |||
30 | foreach ( $attributes as $attribute => $value ) { |
||
31 | $value = esc_attr( sanitize_text_field( $value ) ); |
||
32 | |||
33 | if ( in_array( $attribute, $accepted_attributes ) && ! empty( $value ) ) { |
||
34 | $shortcode_attributes[] = "{$attribute}={$value}"; |
||
35 | } |
||
36 | } |
||
37 | |||
38 | $shortcode = sprintf( '[gravityview %s]', implode( ' ', $shortcode_attributes ) ); |
||
39 | |||
40 | $output = do_shortcode( $shortcode ); |
||
41 | |||
42 | return $output; |
||
43 | } |
||
44 | } |
||
45 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.