admin
7 months ago
compatibility
7 months ago
extensions
7 months ago
foopluginbase
7 months ago
public
7 months ago
thumbs
7 months ago
.DS_Store
7 months ago
class-attachment-filters.php
7 months ago
class-foogallery-animated-gif-support.php
7 months ago
class-foogallery-attachment-custom-class.php
7 months ago
class-foogallery-attachment-type.php
7 months ago
class-foogallery-attachment.php
7 months ago
class-foogallery-cache.php
7 months ago
class-foogallery-common-fields.php
7 months ago
class-foogallery-crop-position.php
7 months ago
class-foogallery-datasource-media_library.php
7 months ago
class-foogallery-debug.php
7 months ago
class-foogallery-extensions-compatibility.php
7 months ago
class-foogallery-force-https.php
7 months ago
class-foogallery-lazyload.php
7 months ago
class-foogallery-lightbox.php
7 months ago
class-foogallery-paging.php
7 months ago
class-foogallery-password-protect.php
7 months ago
class-foogallery-sitemaps.php
7 months ago
class-foogallery-widget.php
7 months ago
class-foogallery.php
7 months ago
class-gallery-advanced-settings.php
7 months ago
class-il8n.php
7 months ago
class-override-thumbnail.php
7 months ago
class-posttypes.php
7 months ago
class-retina.php
7 months ago
class-thumbnail-dimensions.php
7 months ago
class-thumbnails.php
7 months ago
class-version-check.php
7 months ago
constants.php
7 months ago
functions.php
7 months ago
includes.php
7 months ago
index.php
11 years ago
render-functions.php
7 months ago
class-version-check.php
47 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Created by brad. |
| 4 | * Date: 15/11/2015 |
| 5 | */ |
| 6 | if ( ! class_exists( 'FooGallery_Version_Check' ) ) { |
| 7 | |
| 8 | class FooGallery_Version_Check { |
| 9 | |
| 10 | /** |
| 11 | * Wire up the so the check is done in the admin once all plugins have been loaded |
| 12 | */ |
| 13 | public function wire_up_checker() { |
| 14 | if ( is_admin() ) { |
| 15 | //when in admin, check if a new version is running |
| 16 | add_action( 'plugins_loaded', array( $this, 'perform_check' ) ); |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * Perform a check to see if the plugin has been updated |
| 22 | */ |
| 23 | public function perform_check() { |
| 24 | if ( get_site_option( FOOGALLERY_OPTION_VERSION ) != FOOGALLERY_VERSION ) { |
| 25 | //This code will run every time the plugin is updated |
| 26 | |
| 27 | //perform all our housekeeping |
| 28 | $this->perform_housekeeping(); |
| 29 | |
| 30 | //set the current version, so that this does not run again until the next update! |
| 31 | update_site_option( FOOGALLERY_OPTION_VERSION, FOOGALLERY_VERSION ); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Runs after FooGallery has been updated via the backend |
| 37 | */ |
| 38 | function perform_housekeeping() { |
| 39 | //allow extensions or other plugins to do stuff when foogallery is updated |
| 40 | // this will catch both manual and auto updates! |
| 41 | do_action( 'foogallery_admin_new_version_detected' ); |
| 42 | |
| 43 | //we need to clear the foogallery css load optimizations when we update the plugin, to ensure the latest CSS files are loaded |
| 44 | foogallery_clear_all_css_load_optimizations(); |
| 45 | } |
| 46 | } |
| 47 | } |