Skip to content

Commit

Permalink
Minor code adjustments based on Scrutinizer feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfnl committed May 3, 2016
1 parent bd841f7 commit 1ef8ab4
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions class-tgm-plugin-activation.php
Original file line number Diff line number Diff line change
Expand Up @@ -1015,11 +1015,11 @@ public function maybe_adjust_source_dir( $source, $remote_source, $upgrader ) {
$subdir_name = untrailingslashit( str_replace( trailingslashit( $remote_source ), '', $source ) );

if ( ! empty( $subdir_name ) && $subdir_name !== $desired_slug ) {
$from = untrailingslashit( $source );
$to = trailingslashit( $remote_source ) . $desired_slug;
$from_path = untrailingslashit( $source );
$to_path = trailingslashit( $remote_source ) . $desired_slug;

if ( true === $GLOBALS['wp_filesystem']->move( $from, $to ) ) {
return trailingslashit( $to );
if ( true === $GLOBALS['wp_filesystem']->move( $from_path, $to_path ) ) {
return trailingslashit( $to_path );
} else {
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 ) );
}
Expand Down Expand Up @@ -1452,13 +1452,13 @@ public function sanitize_key( $key ) {
$key = preg_replace( '`[^A-Za-z0-9_-]`', '', $key );

/**
* Filter a sanitized key string.
*
* @since 2.5.0
*
* @param string $key Sanitized key.
* @param string $raw_key The key prior to sanitization.
*/
* Filter a sanitized key string.
*
* @since 2.5.0
*
* @param string $key Sanitized key.
* @param string $raw_key The key prior to sanitization.
*/
return apply_filters( 'tgmpa_sanitize_key', $key, $raw_key );
}

Expand Down Expand Up @@ -1501,7 +1501,7 @@ public function config( $config ) {
* @since 2.0.0
*
* @param array $install_actions Existing array of actions.
* @return array Amended array of actions.
* @return false|array Amended array of actions.
*/
public function actions( $install_actions ) {
// Remove action links on the TGMPA install page.
Expand Down Expand Up @@ -2069,7 +2069,7 @@ public function show_tgmpa_version() {
*
* @since 2.4.0
*
* @return object The TGM_Plugin_Activation object.
* @return \TGM_Plugin_Activation The TGM_Plugin_Activation object.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof self ) ) {
Expand Down Expand Up @@ -2275,7 +2275,7 @@ protected function _gather_plugin_data() {
if ( ! empty( $upgrade_notice ) ) {
$table_data[ $i ]['upgrade_notice'] = $upgrade_notice;

add_action( "tgmpa_after_plugin_row_$slug", array( $this, 'wp_plugin_update_row' ), 10, 2 );
add_action( "tgmpa_after_plugin_row_{$slug}", array( $this, 'wp_plugin_update_row' ), 10, 2 );
}

$table_data[ $i ] = apply_filters( 'tgmpa_table_data_item', $table_data[ $i ], $plugin );
Expand Down

0 comments on commit 1ef8ab4

Please sign in to comment.