| Conditions | 3 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | function add_retina_attributes($attr, $args, $attachment) { |
||
| 21 | global $current_foogallery; |
||
| 22 | |||
| 23 | if ( $current_foogallery && $current_foogallery->gallery_template ) { |
||
| 24 | |||
| 25 | //first check if the gallery template supports Retina thumbs |
||
| 26 | |||
| 27 | //Then get the retina settings, e.g. 2x, 3x, 4x |
||
| 28 | |||
| 29 | //apply scaling to the width and height attributes |
||
| 30 | $args['width'] = (int)$args['width'] * 2; |
||
| 31 | $args['height'] = (int)$args['height'] * 2; |
||
| 32 | |||
| 33 | //build up the retina attributes |
||
| 34 | $attr['srcset'] = $attachment->html_img_src( $args ) . ' ' . $args['width'] . 'w'; |
||
| 35 | } |
||
| 36 | |||
| 37 | return $attr; |
||
| 38 | } |
||
| 39 | } |
||
| 41 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.