| 1 | <?php |
||
| 11 | class FooGallery_WPRocket_Compatibility { |
||
|
|
|||
| 12 | |||
| 13 | function __construct() { |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Alters the image URL's to use WP Rocket's get_rocket_cdn_url function |
||
| 20 | * |
||
| 21 | * @uses "foogallery_attachment_html_image_attributes" filter |
||
| 22 | * |
||
| 23 | * @param $attr |
||
| 24 | * @param $args |
||
| 25 | * @param object|FooGalleryAttachment $object |
||
| 26 | * |
||
| 27 | * @return array |
||
| 28 | */ |
||
| 29 | function alter_image_attributes( $attr, $args, $object ) { |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Alters the image URL's to use WP Rocket's get_rocket_cdn_url function |
||
| 40 | * |
||
| 41 | * @uses "foogallery_attachment_html_link_attributes" filter |
||
| 42 | * |
||
| 43 | * @param $attr |
||
| 44 | * @param $args |
||
| 45 | * @param object|FooGalleryAttachment $object |
||
| 46 | * |
||
| 47 | * @return array |
||
| 48 | */ |
||
| 49 | function alter_link_attributes( $attr, $args, $object ) { |
||
| 57 | |||
| 58 | function replace_url( $url ) { |
||
| 65 | } |
||
| 66 | } |
||
| 67 |
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.