Skip to content

Commit 46b4485

Browse files
committed
Minor code adjustments based on Scrutinizer feedback.
1 parent c352e3b commit 46b4485

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

class-tgm-plugin-activation.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,11 +1015,11 @@ public function maybe_adjust_source_dir( $source, $remote_source, $upgrader ) {
10151015
$subdir_name = untrailingslashit( str_replace( trailingslashit( $remote_source ), '', $source ) );
10161016

10171017
if ( ! empty( $subdir_name ) && $subdir_name !== $desired_slug ) {
1018-
$from = untrailingslashit( $source );
1019-
$to = trailingslashit( $remote_source ) . $desired_slug;
1018+
$from_path = untrailingslashit( $source );
1019+
$to_path = trailingslashit( $remote_source ) . $desired_slug;
10201020

1021-
if ( true === $GLOBALS['wp_filesystem']->move( $from, $to ) ) {
1022-
return trailingslashit( $to );
1021+
if ( true === $GLOBALS['wp_filesystem']->move( $from_path, $to_path ) ) {
1022+
return trailingslashit( $to_path );
10231023
} else {
10241024
return new WP_Error( 'rename_failed', esc_html__( 'The remote plugin package does not contain a folder with the desired slug and renaming did not work.', 'tgmpa' ) . ' ' . esc_html__( 'Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'tgmpa' ), array( 'found' => $subdir_name, 'expected' => $desired_slug ) );
10251025
}
@@ -1186,7 +1186,7 @@ public function notices() {
11861186
$line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>' . "\n";
11871187

11881188
if ( ! current_user_can( 'activate_plugins' ) && ! current_user_can( 'install_plugins' ) && ! current_user_can( 'update_plugins' ) ) {
1189-
$rendered = esc_html__( $this->strings['notice_cannot_install_activate'] ) . ' ' . esc_html__( $this->strings['contact_admin'] );
1189+
$rendered = esc_html__( $this->strings['notice_cannot_install_activate'] ) . ' ' . esc_html__( $this->strings['contact_admin'] );
11901190
$rendered .= $this->create_user_action_links_for_notice( 0, 0, 0, $line_template );
11911191
} else {
11921192

@@ -1452,13 +1452,13 @@ public function sanitize_key( $key ) {
14521452
$key = preg_replace( '`[^A-Za-z0-9_-]`', '', $key );
14531453

14541454
/**
1455-
* Filter a sanitized key string.
1456-
*
1457-
* @since 2.5.0
1458-
*
1459-
* @param string $key Sanitized key.
1460-
* @param string $raw_key The key prior to sanitization.
1461-
*/
1455+
* Filter a sanitized key string.
1456+
*
1457+
* @since 2.5.0
1458+
*
1459+
* @param string $key Sanitized key.
1460+
* @param string $raw_key The key prior to sanitization.
1461+
*/
14621462
return apply_filters( 'tgmpa_sanitize_key', $key, $raw_key );
14631463
}
14641464

@@ -1501,7 +1501,7 @@ public function config( $config ) {
15011501
* @since 2.0.0
15021502
*
15031503
* @param array $install_actions Existing array of actions.
1504-
* @return array Amended array of actions.
1504+
* @return false|array Amended array of actions.
15051505
*/
15061506
public function actions( $install_actions ) {
15071507
// Remove action links on the TGMPA install page.
@@ -1871,7 +1871,7 @@ public function is_plugin_updatetable( $slug ) {
18711871
if ( ! $this->is_plugin_installed( $slug ) ) {
18721872
return false;
18731873
} else {
1874-
return ( $this->does_plugin_have_update( $slug ) && $this->can_plugin_update( $slug ) );
1874+
return ( false !== $this->does_plugin_have_update( $slug ) && $this->can_plugin_update( $slug ) );
18751875
}
18761876
}
18771877

@@ -2069,7 +2069,7 @@ public function show_tgmpa_version() {
20692069
*
20702070
* @since 2.4.0
20712071
*
2072-
* @return object The TGM_Plugin_Activation object.
2072+
* @return \TGM_Plugin_Activation The TGM_Plugin_Activation object.
20732073
*/
20742074
public static function get_instance() {
20752075
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof self ) ) {
@@ -2275,7 +2275,7 @@ protected function _gather_plugin_data() {
22752275
if ( ! empty( $upgrade_notice ) ) {
22762276
$table_data[ $i ]['upgrade_notice'] = $upgrade_notice;
22772277

2278-
add_action( "tgmpa_after_plugin_row_$slug", array( $this, 'wp_plugin_update_row' ), 10, 2 );
2278+
add_action( "tgmpa_after_plugin_row_{$slug}", array( $this, 'wp_plugin_update_row' ), 10, 2 );
22792279
}
22802280

22812281
$table_data[ $i ] = apply_filters( 'tgmpa_table_data_item', $table_data[ $i ], $plugin );
@@ -3267,7 +3267,7 @@ public function run( $options ) {
32673267
*
32683268
* @param array $plugins The plugin sources needed for installation.
32693269
* @param array $args Arbitrary passed extra arguments.
3270-
* @return string|bool Install confirmation messages on success, false on failure.
3270+
* @return array|false Install confirmation messages on success, false on failure.
32713271
*/
32723272
public function bulk_install( $plugins, $args = array() ) {
32733273
// [TGMPA + ] Hook auto-activation in.
@@ -3566,22 +3566,22 @@ public function add_strings() {
35663566
/* translators: 1: plugin name, 2: error message. */
35673567
$this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' );
35683568
/* translators: 1: plugin name. */
3569-
$this->upgrader->strings['skin_update_failed'] = __( 'The installation of %1$s failed.', 'tgmpa' );
3569+
$this->upgrader->strings['skin_update_failed'] = __( 'The installation of %1$s failed.', 'tgmpa' );
35703570

35713571
if ( $this->tgmpa->is_automatic ) {
35723572
// Automatic activation strings.
3573-
$this->upgrader->strings['skin_upgrade_start'] = __( 'The installation and activation process is starting. This process may take a while on some hosts, so please be patient.', 'tgmpa' );
3573+
$this->upgrader->strings['skin_upgrade_start'] = __( 'The installation and activation process is starting. This process may take a while on some hosts, so please be patient.', 'tgmpa' );
35743574
/* translators: 1: plugin name. */
3575-
$this->upgrader->strings['skin_update_successful'] = __( '%1$s installed and activated successfully.', 'tgmpa' ) . ' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>' . esc_html__( 'Show Details', 'tgmpa' ) . '</span><span class="hidden">' . esc_html__( 'Hide Details', 'tgmpa' ) . '</span>.</a>';
3576-
$this->upgrader->strings['skin_upgrade_end'] = __( 'All installations and activations have been completed.', 'tgmpa' );
3575+
$this->upgrader->strings['skin_update_successful'] = __( '%1$s installed and activated successfully.', 'tgmpa' ) . ' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>' . esc_html__( 'Show Details', 'tgmpa' ) . '</span><span class="hidden">' . esc_html__( 'Hide Details', 'tgmpa' ) . '</span>.</a>';
3576+
$this->upgrader->strings['skin_upgrade_end'] = __( 'All installations and activations have been completed.', 'tgmpa' );
35773577
/* translators: 1: plugin name, 2: action number 3: total number of actions. */
35783578
$this->upgrader->strings['skin_before_update_header'] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' );
35793579
} else {
35803580
// Default installation strings.
3581-
$this->upgrader->strings['skin_upgrade_start'] = __( 'The installation process is starting. This process may take a while on some hosts, so please be patient.', 'tgmpa' );
3581+
$this->upgrader->strings['skin_upgrade_start'] = __( 'The installation process is starting. This process may take a while on some hosts, so please be patient.', 'tgmpa' );
35823582
/* translators: 1: plugin name. */
3583-
$this->upgrader->strings['skin_update_successful'] = esc_html__( '%1$s installed successfully.', 'tgmpa' ) . ' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>' . esc_html__( 'Show Details', 'tgmpa' ) . '</span><span class="hidden">' . esc_html__( 'Hide Details', 'tgmpa' ) . '</span>.</a>';
3584-
$this->upgrader->strings['skin_upgrade_end'] = __( 'All installations have been completed.', 'tgmpa' );
3583+
$this->upgrader->strings['skin_update_successful'] = esc_html__( '%1$s installed successfully.', 'tgmpa' ) . ' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>' . esc_html__( 'Show Details', 'tgmpa' ) . '</span><span class="hidden">' . esc_html__( 'Hide Details', 'tgmpa' ) . '</span>.</a>';
3584+
$this->upgrader->strings['skin_upgrade_end'] = __( 'All installations have been completed.', 'tgmpa' );
35853585
/* translators: 1: plugin name, 2: action number 3: total number of actions. */
35863586
$this->upgrader->strings['skin_before_update_header'] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' );
35873587
}

0 commit comments

Comments
 (0)