Update.php 749 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace YahnisElsts\PluginUpdateChecker\v5p1;
  3. use stdClass;
  4. if ( !class_exists(Update::class, false) ):
  5. /**
  6. * A simple container class for holding information about an available update.
  7. *
  8. * @author Janis Elsts
  9. * @access public
  10. */
  11. abstract class Update extends Metadata {
  12. public $slug;
  13. public $version;
  14. public $download_url;
  15. public $translations = array();
  16. /**
  17. * @return string[]
  18. */
  19. protected function getFieldNames() {
  20. return array('slug', 'version', 'download_url', 'translations');
  21. }
  22. public function toWpFormat() {
  23. $update = new stdClass();
  24. $update->slug = $this->slug;
  25. $update->new_version = $this->version;
  26. $update->package = $this->download_url;
  27. return $update;
  28. }
  29. }
  30. endif;