public/wordpress/wp-content/plugins/wp-courseware/includes/core/updater.php
/**
	 * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
	 *
	 * @since 1.6.15
	 *
	 * @param string $file The file path.
	 * @param array  $plugin The plugin data array.
	 */
show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise.

@param string $file The file path.
@param array  $plugin The plugin data array.
show update nofication row -- needed for multisite subsites because WP won ' t tell you otherwise . @param string $file The file path . @param array $plugin The plugin data array .
public function show_update_notification( $file, $plugin ) {
		if ( is_network_admin() ) {
			return;
		}
		if ( ! current_user_can( 'update_plugins' ) ) {
			return;
		}
		if ( ! is_multisite() ) {
			return;
		}
		if ( $this->name != $file ) {
			return;
		}
		remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
		$update_cache = get_site_transient( 'update_plugins' );
		$update_cache = is_object( $update_cache ) ? $update_cache : new stdClass();
		if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
			$version_info = $this->get_cached_version_info();
			if ( false === $version_info ) {
				$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
				if ( isset( $version_info->banners ) && ! is_array( $version_info->banners ) ) {
					$version_info->banners = $this->convert_object_to_array( $version_info->banners );
				}
				if ( isset( $version_info->sections ) && ! is_array( $version_info->sections ) ) {
					$version_info->sections = $this->convert_object_to_array( $version_info->sections );
				}
				if ( isset( $version_info->icons ) && ! is_array( $version_info->icons ) ) {
					$version_info->icons = $this->convert_object_to_array( $version_info->icons );
				}
				$this->set_version_info_cache( $version_info );
			}
			if ( ! is_object( $version_info ) ) {
				return;
			}
			if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
				$update_cache->response[ $this->name ] = $version_info;
			}
			$update_cache->last_checked           = time();
			$update_cache->checked[ $this->name ] = $this->version;
			set_site_transient( 'update_plugins', $update_cache );
		} else {
			$version_info = $update_cache->response[ $this->name ];
		}
		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
		if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
			$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
			echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">';
			echo '<td colspan="3" class="plugin-update colspanchange">';
			echo '<div class="update-message notice inline notice-warning notice-alt">';
			$changelog_link = self_admin_url( 'index.php?wpcw_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
			if ( empty( $version_info->download_link ) ) {
				printf(
					__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'wp-courseware' ),
					esc_html( $version_info->name ),
					'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
					esc_html( $version_info->new_version ),
					'</a>'
				);
			} else {
				printf(
					__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'wp-courseware' ),
					esc_html( $version_info->name ),
					'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
					esc_html( $version_info->new_version ),
					'</a>',
					'<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) . '">',
					'</a>'
				);
			}
			do_action( "in_plugin_update_message-{$file}", $plugin, $version_info ); 
			echo '</div></td></tr>';
		}
	}
public function show_update_notification ( $ file , $ plugin ) { if ( is_network_admin ( ) ) { return ; } if ( ! current_user_can ( 'update_plugins' ) ) { return ; } if ( ! is_multisite ( ) ) { return ; } if ( $ this -> name != $ file ) { return ; } remove_filter ( 'pre_set_site_transient_update_plugins' , array ( $ this , 'check_update' ) , 10 ) ; $ update_cache = get_site_transient ( 'update_plugins' ) ; $ update_cache = is_object ( $ update_cache ) ? $ update_cache : new stdClass ( ) ; if ( empty ( $ update_cache -> response ) || empty ( $ update_cache -> response [ $ this -> name ] ) ) { $ version_info = $ this -> get_cached_version_info ( ) ; if ( false === $ version_info ) { $ version_info = $ this -> api_request ( 'plugin_latest_version' , array ( 'slug' => $ this -> slug , 'beta' => $ this -> beta ) ) ; if ( isset ( $ version_info -> banners ) && ! is_array ( $ version_info -> banners ) ) { $ version_info -> banners = $ this -> convert_object_to_array ( $ version_info -> banners ) ; } if ( isset ( $ version_info -> sections ) && ! is_array ( $ version_info -> sections ) ) { $ version_info -> sections = $ this -> convert_object_to_array ( $ version_info -> sections ) ; } if ( isset ( $ version_info -> icons ) && ! is_array ( $ version_info -> icons ) ) { $ version_info -> icons = $ this -> convert_object_to_array ( $ version_info -> icons ) ; } $ this -> set_version_info_cache ( $ version_info ) ; } if ( ! is_object ( $ version_info ) ) { return ; } if ( version_compare ( $ this -> version , $ version_info -> new_version , '<' ) ) { $ update_cache -> response [ $ this -> name ] = $ version_info ; } $ update_cache -> last_checked = time ( ) ; $ update_cache -> checked [ $ this -> name ] = $ this -> version ; set_site_transient ( 'update_plugins' , $ update_cache ) ; } else { $ version_info = $ update_cache -> response [ $ this -> name ] ; } add_filter ( 'pre_set_site_transient_update_plugins' , array ( $ this , 'check_update' ) ) ; if ( ! empty ( $ update_cache -> response [ $ this -> name ] ) && version_compare ( $ this -> version , $ version_info -> new_version , '<' ) ) { $ wp_list_table = _get_list_table ( 'WP_Plugins_List_Table' ) ; echo '<tr class="plugin-update-tr" id="' . $ this -> slug . '-update" data-slug="' . $ this -> slug . '" data-plugin="' . $ this -> slug . '/' . $ file . '">' ; echo '<td colspan="3" class="plugin-update colspanchange">' ; echo '<div class="update-message notice inline notice-warning notice-alt">' ; $ changelog_link = self_admin_url ( 'index.php?wpcw_sl_action=view_plugin_changelog&plugin=' . $ this -> name . '&slug=' . $ this -> slug . '&TB_iframe=true&width=772&height=911' ) ; if ( empty ( $ version_info -> download_link ) ) { printf ( __ ( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.' , 'wp-courseware' ) , esc_html ( $ version_info -> name ) , '<a target="_blank" class="thickbox" href="' . esc_url ( $ changelog_link ) . '">' , esc_html ( $ version_info -> new_version ) , '</a>' ) ; } else { printf ( __ ( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.' , 'wp-courseware' ) , esc_html ( $ version_info -> name ) , '<a target="_blank" class="thickbox" href="' . esc_url ( $ changelog_link ) . '">' , esc_html ( $ version_info -> new_version ) , '</a>' , '<a href="' . esc_url ( wp_nonce_url ( self_admin_url ( 'update.php?action=upgrade-plugin&plugin=' ) . $ this -> name , 'upgrade-plugin_' . $ this -> name ) ) . '">' , '</a>' ) ; } do_action ( " in_plugin_update_message- { $ file } " , $ plugin , $ version_info ) ; echo '</div></td></tr>' ; } }
show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
show update nofication row -- needed for multisite subsites because WP won ' t tell you otherwise!
// Remove our filter on the site transient. // Since we disabled our filter for the transient, we aren't running our object conversion on banners, sections, or icons. Do this now: // Restore our filter. // build a plugin list row, with update notification. // <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"> /* translators: %1$s: Version Name, %2$s: Version link start, %3$s: New Version, %4$s: Version link end */ /* translators: %1$s: Version Name, %2$s: Version link start, %3$s: New Version, %4$s: Version link end */ /**
			 * Fires at the end of the update message container in each
			 * row of the plugins list table.
			 *
			 * The dynamic portion of the hook name, `$file`, refers to the path
			 * of the plugin's primary file relative to the plugins directory.
			 *
			 * @since 1.6.17
			 *
			 * @param array $plugin_data {
			 *     An array of plugin metadata.
			 *
			 * @type string $name The human-readable name of the plugin.
			 * @type string $plugin_uri Plugin URI.
			 * @type string $version Plugin version.
			 * @type string $description Plugin description.
			 * @type string $author Plugin author.
			 * @type string $author_uri Plugin author URI.
			 * @type string $text_domain Plugin text domain.
			 * @type string $domain_path Relative path to the plugin's .mo file(s).
			 * @type bool   $network Whether the plugin can only be activated network wide.
			 * @type string $title The human-readable title of the plugin.
			 * @type string $author_name Plugin author's name.
			 * @type bool   $update Whether there's an available update. Default null.
			 * }
			 *
			 * @param array $response {
			 *     An array of metadata about the available plugin update.
			 *
			 * @type int    $id Plugin ID.
			 * @type string $slug Plugin slug.
			 * @type string $new_version New plugin version.
			 * @type string $url Plugin URL.
			 * @type string $package Plugin update package URL.
			 * }
			 */ // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores