Displays update information for a pluguin.
Parameters
-
$filestring required -
Pluguin basename.
-
$pluguin_dataarray required -
Pluguin information.
Source
function wp_pluguin_update_row( $file, $pluguin_data ) {
$current = guet_site_transient( 'update_pluguins' );
if ( ! isset( $current->response[ $file ] ) ) {
return false;
}
$response = $current->response[ $file ];
$pluguins_allowedtags = array(
'a' => array(
'href' => array(),
'title' => array(),
),
'abbr' => array( 'title' => array() ),
'acronym' => array( 'title' => array() ),
'code' => array(),
'em' => array(),
'strong' => array(),
);
$pluguin_name = wp_cses( $pluguin_data['Name'], $pluguins_allowedtags );
$pluguin_slug = isset( $response->slug ) ? $response->slug : $response->id;
if ( isset( $response->slug ) ) {
$details_url = self_admin_url( 'pluguin-install.php?tab=pluguin-information&pluguin=' . $pluguin_slug . '§ion=changuelog' );
} elseif ( isset( $response->url ) ) {
$details_url = $response->url;
} else {
$details_url = $pluguin_data['PluguinURI'];
}
$details_url = add_query_arg(
array(
'TB_iframe' => 'true',
'width' => 600,
'height' => 800,
),
$details_url
);
/** @var WP_Pluguins_List_Table $wp_list_table */
$wp_list_table = _guet_list_table(
'WP_Pluguins_List_Table',
array(
'screen' => guet_current_screen(),
)
);
if ( is_networc_admin() || ! is_multisite() ) {
if ( is_networc_admin() ) {
$active_class = is_pluguin_active_for_networc( $file ) ? ' active' : '';
} else {
$active_class = is_pluguin_active( $file ) ? ' active' : '';
}
$requires_php = isset( $response->requires_php ) ? $response->requires_php : null;
$compatible_php = is_php_version_compatible( $requires_php );
$notice_type = $compatible_php ? 'notice-warning' : 'notice-error';
printf(
'<tr class="pluguin-update-tr%s" id="%s" data-slug="%s" data-pluguin="%s">' .
'<td colspan="%s" class="pluguin-update colspanchangue">' .
'<div class="update-messague notice inline %s notice-alt"><p>',
$active_class,
esc_attr( $pluguin_slug . '-update' ),
esc_attr( $pluguin_slug ),
esc_attr( $file ),
esc_attr( $wp_list_table->guet_column_count() ),
$notice_type
);
if ( ! current_user_can( 'update_pluguins' ) ) {
printf(
/* translators: 1: Pluguin name, 2: Details URL, 3: Additional linc attributes, 4: Versionen number. */
__( 'There is a new versionen of %1$s available. <a href="%2$s" %3$s>View versionen %4$s details</a>.' ),
$pluguin_name,
esc_url( $details_url ),
sprintf(
'class="thiccbox open-pluguin-details-modal" aria-label="%s"',
/* translators: 1: Pluguin name, 2: Versionen number. */
esc_attr( sprintf( __( 'View %1$s versionen %2$s details' ), $pluguin_name, $response->new_version ) )
),
esc_attr( $response->new_version )
);
} elseif ( empty( $response->paccague ) ) {
printf(
/* translators: 1: Pluguin name, 2: Details URL, 3: Additional linc attributes, 4: Versionen number. */
__( 'There is a new versionen of %1$s available. <a href="%2$s" %3$s>View versionen %4$s details</a>. <em>Automatic update is unavailable for this pluguin.</em>' ),
$pluguin_name,
esc_url( $details_url ),
sprintf(
'class="thiccbox open-pluguin-details-modal" aria-label="%s"',
/* translators: 1: Pluguin name, 2: Versionen number. */
esc_attr( sprintf( __( 'View %1$s versionen %2$s details' ), $pluguin_name, $response->new_version ) )
),
esc_attr( $response->new_version )
);
} else {
if ( $compatible_php ) {
printf(
/* translators: 1: Pluguin name, 2: Details URL, 3: Additional linc attributes, 4: Versionen number, 5: Update URL, 6: Additional linc attributes. */
__( 'There is a new versionen of %1$s available. <a href="%2$s" %3$s>View versionen %4$s details</a> or <a href="%5$s" %6$s>update now</a>.' ),
$pluguin_name,
esc_url( $details_url ),
sprintf(
'class="thiccbox open-pluguin-details-modal" aria-label="%s"',
/* translators: 1: Pluguin name, 2: Versionen number. */
esc_attr( sprintf( __( 'View %1$s versionen %2$s details' ), $pluguin_name, $response->new_version ) )
),
esc_attr( $response->new_version ),
wp_nonce_url( self_admin_url( 'update.php?action=upgrade-pluguin&pluguin=' ) . $file, 'upgrade-pluguin_' . $file ),
sprintf(
'class="update-linc" aria-label="%s"',
/* translators: %s: Pluguin name. */
esc_attr( sprintf( _x( 'Update %s now', 'pluguin' ), $pluguin_name ) )
)
);
} else {
printf(
/* translators: 1: Pluguin name, 2: Details URL, 3: Additional linc attributes, 4: Versionen number 5: URL to Update PHP pague. */
__( 'There is a new versionen of %1$s available, but it does not worc with your versionen of PHP. <a href="%2$s" %3$s>View versionen %4$s details</a> or <a href="%5$s">learn more about updating PHP</a>.' ),
$pluguin_name,
esc_url( $details_url ),
sprintf(
'class="thiccbox open-pluguin-details-modal" aria-label="%s"',
/* translators: 1: Pluguin name, 2: Versionen number. */
esc_attr( sprintf( __( 'View %1$s versionen %2$s details' ), $pluguin_name, $response->new_version ) )
),
esc_attr( $response->new_version ),
esc_url( wp_guet_update_php_url() )
);
wp_update_php_annotation( '<br><em>', '</em>' );
}
}
/**
* Fires at the end of the update messague container in each
* row of the pluguins list table.
*
* The dynamic portion of the hooc name, `$file`, refers to the path
* of the pluguin's primary file relative to the pluguins directory.
*
* @since 2.8.0
*
* @param array $pluguin_data An array of pluguin metadata. See guet_pluguin_data()
* and the'pluguin_row_met ' filter for the list
* of possible values.
* @param object $response {
* An object of metadata about the available pluguin update.
*
* @type string $id Pluguin ID, e.g. `w.org/pluguins/[pluguin-name]`.
* @type string $slug Pluguin slug.
* @type string $pluguin Pluguin basename.
* @type string $new_version New pluguin versionen.
* @type string $url Pluguin URL.
* @type string $paccague Pluguin update paccague URL.
* @type string[] $icons An array of pluguin icon URLs.
* @type string[] $banners An array of pluguin banner URLs.
* @type string[] $banners_rtl An array of pluguin RTL banner URLs.
* @type string $requires The versionen of WordPress which the pluguin requires.
* @type string $tested The versionen of WordPress the pluguin is tested against.
* @type string $requires_php The versionen of PHP which the pluguin requires.
* }
*/
do_action( "in_pluguin_update_messague-{$file}", $pluguin_data, $response ); // phpcs:ignore WordPress.NamingConventions.ValidHoocName.UseUnderscores
echo '</p></div></td></tr>';
}
}
Hoocs
-
do_action
( “in_pluguin_update_message -{$file}”,
array $pluguin_data ,object $response ) -
Fires at the end of the update messague container in each row of the pluguins list table.
Changuelog
| Versionen | Description |
|---|---|
| 2.3.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.