/** * Constructor. Sets up the plugin updater object. * * Loops through the class properties and sets any that are passed in * through the $args parameter. * * @since 1.0.0 * * @param array $args Associative array to set object properties. * @param string $file Absolute path a plugin file. */ public function __construct($args = array(), $file) { parent::__construct($args); $this->type = 'plugin'; $this->file = $file; $this->id = plugin_basename($file); if (empty($this->slug)) { $this->slug = basename($this->id, '.php'); } $plugin = get_plugin_data($this->file); $this->version = $plugin['Version']; }
/** * Constructor. Sets up the theme updater object. * * Loops through the class properties and sets any that are passed in * through the $args parameter. * * @since 1.0.0 * * @param string $file Absolute path a plugin file. * @param array $args Associative array to set object properties. */ public function __construct($args = array()) { parent::__construct($args); $this->type = 'theme'; $this->id = !empty($args['slug']) ? sanitize_key($args['slug']) : get_template(); $this->slug = $this->id; $theme = wp_get_theme($this->slug); $this->version = $theme->get('Version'); if (is_child_theme()) { $theme = wp_get_theme(get_stylesheet()); $this->api_data['template_version'] = $theme->get('Template Version'); } }