Advertisement
duskopro

update-plugin.class.php

May 9th, 2024
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. public function update_state($transient) {
  2. if (!is_object($transient) || !isset($transient->response)) {
  3. return $transient;
  4. }
  5.  
  6. $plugin = $this->plugin;
  7.  
  8. if (!empty($plugin) && isset($plugin['version']) && version_compare($plugin['version'], TG_VERSION) > 0) {
  9. $API = new TG_Envato_API();
  10.  
  11. $_plugin = [
  12. 'slug' => dirname($plugin['slug']),
  13. 'new_version' => $plugin['version'],
  14. 'url' => $plugin['url'],
  15. 'package' => $API->deferred_download($plugin['id']),
  16. 'name' => $plugin['name'],
  17. ];
  18.  
  19. $transient->response[$plugin['slug']] = (object)$_plugin;
  20. } else {
  21. unset($transient->response['the-grid/the-grid.php']);
  22. }
  23.  
  24. return $transient;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement