| Conditions | 4 |
| Paths | 3 |
| Total Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | static function render( $attributes = array() ) { |
||
|
|
|||
| 25 | |||
| 26 | $accepted_attributes = array( |
||
| 27 | 'view_id', |
||
| 28 | 'entry_id', |
||
| 29 | 'field_id', |
||
| 30 | 'custom_label', |
||
| 31 | ); |
||
| 32 | |||
| 33 | $shortcode_attributes = array(); |
||
| 34 | |||
| 35 | foreach ( $attributes as $attribute => $value ) { |
||
| 36 | $value = esc_attr( sanitize_text_field( $value ) ); |
||
| 37 | |||
| 38 | if ( in_array( $attribute, $accepted_attributes ) && ! empty( $value ) ) { |
||
| 39 | $shortcode_attributes[] = "{$attribute}={$value}"; |
||
| 40 | } |
||
| 41 | } |
||
| 42 | |||
| 43 | $shortcode = sprintf( '[gvfield %s]', implode( ' ', $shortcode_attributes ) ); |
||
| 44 | |||
| 45 | $output = do_shortcode( $shortcode ); |
||
| 46 | |||
| 47 | return $output; |
||
| 48 | } |
||
| 49 | } |
||
| 50 |
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.