| Conditions | 4 |
| Paths | 6 |
| Total Lines | 28 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | protected function process_output( $output, $value ) { |
||
| 25 | // Make sure we've got everything by defining some defaults. |
||
| 26 | $value = wp_parse_args( $value, array( |
||
| 27 | 'angle' => 0, |
||
| 28 | 'start' => array( |
||
| 29 | 'color' => 'rgba(0,0,0,0)', |
||
| 30 | 'position' => 0, |
||
| 31 | ), |
||
| 32 | 'end' => array( |
||
| 33 | 'color' => 'rgba(0,0,0,0)', |
||
| 34 | 'position' => 100, |
||
| 35 | ), |
||
| 36 | 'mode' => 'linear', |
||
| 37 | ) ); |
||
| 38 | |||
| 39 | $output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global'; |
||
| 40 | |||
| 41 | $this->styles[ $output['media_query'] ][ $output['element'] ]['background'] = $value['start']['color']; |
||
| 42 | switch ( $value['mode'] ) { |
||
| 43 | |||
| 44 | case 'linear': |
||
| 45 | $this->styles[ $output['media_query'] ][ $output['element'] ]['background'] = 'linear-gradient(' . intval( $value['angle'] ) . 'deg, ' . $value['start']['color'] . ' ' . $value['start']['position'] . '%,' . $value['end']['color'] . ' ' . $value['end']['position'] . '%)'; |
||
| 46 | break; |
||
| 47 | case 'radial': |
||
| 48 | $this->styles[ $output['media_query'] ][ $output['element'] ]['background'] = 'radial-gradient(ellipse at center,' . $value['start']['color'] . ' ' . $value['start']['position'] . '%,' . $value['end']['color'] . ' ' . $value['end']['position'] . '%)'; |
||
| 49 | break; |
||
| 50 | } |
||
| 51 | } |
||
| 52 | } |
||
| 53 |