Tribe__PUE__Utility::to_wp_format( ?string $plugin_file = null )

Transform the update into the format used by WordPress native plugin API.


Parameters

$plugin_file

(?string) (Optional) Plugin bootstrap file path.

Default value: null


Top ↑

Return

(object)


Top ↑

Source

File: src/Tribe/PUE/Utility.php

		public function to_wp_format() {
			$update = new StdClass;

			$update->id          = $this->id;
			$update->plugin      = $this->plugin;
			$update->slug        = $this->slug;
			$update->new_version = $this->version;
			$update->url         = $this->homepage;
			$update->package     = $this->download_url;
			if ( ! empty( $this->upgrade_notice ) ) {
				$update->upgrade_notice = $this->upgrade_notice;
			}

			// Support custom $update properties coming straight from PUE
			if ( ! empty( $this->custom_update ) ) {
				$custom_update = get_object_vars( $this->custom_update );

				foreach ( $custom_update as $field => $custom_value ) {
					if ( is_object( $custom_value ) ) {
						$custom_value = get_object_vars( $custom_value );
					}

					$update->$field = $custom_value;
				}
			}

			return $update;
		}