| 1 |
<?php |
| 2 |
// Set default config on plugin load if not set |
| 3 |
function flying_images_set_default_config() { |
| 4 |
|
| 5 |
if (FLYING_IMAGES_VERSION !== get_option('FLYING_IMAGES_VERSION')) { |
| 6 |
|
| 7 |
// Lazy loading |
| 8 |
if (get_option('flying_images_enable_lazyloading') === false) |
| 9 |
update_option('flying_images_enable_lazyloading', true); |
| 10 |
|
| 11 |
if (get_option('flying_images_lazymethod') === false) |
| 12 |
update_option('flying_images_lazymethod', "javascript"); |
| 13 |
|
| 14 |
if (get_option('flying_images_margin') === false) |
| 15 |
update_option('flying_images_margin', 500); |
| 16 |
|
| 17 |
if (get_option('flying_images_exclude_keywords') === false) |
| 18 |
update_option('flying_images_exclude_keywords', ['your-logo.png']); |
| 19 |
|
| 20 |
// CDN |
| 21 |
if (get_option('flying_images_enable_cdn') === false) |
| 22 |
update_option('flying_images_enable_cdn', true); |
| 23 |
|
| 24 |
if (get_option('flying_images_cdn_exclude_keywords') === false) |
| 25 |
update_option('flying_images_cdn_exclude_keywords', []); |
| 26 |
|
| 27 |
// Compression |
| 28 |
if (get_option('flying_images_enable_compression') === false) |
| 29 |
update_option('flying_images_enable_compression', true); |
| 30 |
|
| 31 |
if (get_option('flying_images_quality') === false) |
| 32 |
update_option('flying_images_quality', 100); |
| 33 |
|
| 34 |
// Responsiveness |
| 35 |
if (get_option('flying_images_enable_responsive_images') === false) |
| 36 |
update_option('flying_images_enable_responsive_images', true); |
| 37 |
|
| 38 |
update_option('FLYING_IMAGES_VERSION', FLYING_IMAGES_VERSION); |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
add_action('plugins_loaded', 'flying_images_set_default_config'); |
| 43 |
|