|
@@ -264,7 +264,7 @@ discard block |
|
|
block discarded – undo |
|
264
|
264
|
*/ |
|
265
|
265
|
public function __construct() { |
|
266
|
266
|
// Set the current WordPress version. |
|
267
|
|
- $this->wp_version = $GLOBALS['wp_version']; |
|
|
267
|
+ $this->wp_version = $GLOBALS[ 'wp_version' ]; |
|
268
|
268
|
|
|
269
|
269
|
// Announce that the class is ready, and pass the object (for advanced use). |
|
270
|
270
|
do_action_ref_array( 'tgmpa_init', array( $this ) ); |
|
@@ -482,10 +482,10 @@ discard block |
|
|
block discarded – undo |
|
482
|
482
|
if ( false !== strpos( __FILE__, WP_PLUGIN_DIR ) || false !== strpos( __FILE__, WPMU_PLUGIN_DIR ) ) { |
|
483
|
483
|
// Plugin, we'll need to adjust the file name. |
|
484
|
484
|
add_action( 'load_textdomain_mofile', array( $this, 'correct_plugin_mofile' ), 10, 2 ); |
|
485
|
|
- load_theme_textdomain( 'tgmpa', dirname( __FILE__ ) . '/languages' ); |
|
|
485
|
+ load_theme_textdomain( 'tgmpa', dirname( __FILE__ ).'/languages' ); |
|
486
|
486
|
remove_action( 'load_textdomain_mofile', array( $this, 'correct_plugin_mofile' ), 10 ); |
|
487
|
487
|
} else { |
|
488
|
|
- load_theme_textdomain( 'tgmpa', dirname( __FILE__ ) . '/languages' ); |
|
|
488
|
+ load_theme_textdomain( 'tgmpa', dirname( __FILE__ ).'/languages' ); |
|
489
|
489
|
} |
|
490
|
490
|
} |
|
491
|
491
|
|
|
@@ -558,15 +558,15 @@ discard block |
|
|
block discarded – undo |
|
558
|
558
|
public function add_plugin_action_link_filters() { |
|
559
|
559
|
foreach ( $this->plugins as $slug => $plugin ) { |
|
560
|
560
|
if ( false === $this->can_plugin_activate( $slug ) ) { |
|
561
|
|
- add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_activate' ), 20 ); |
|
|
561
|
+ add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_activate' ), 20 ); |
|
562
|
562
|
} |
|
563
|
563
|
|
|
564
|
|
- if ( true === $plugin['force_activation'] ) { |
|
565
|
|
- add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_deactivate' ), 20 ); |
|
|
564
|
+ if ( true === $plugin[ 'force_activation' ] ) { |
|
|
565
|
+ add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_deactivate' ), 20 ); |
|
566
|
566
|
} |
|
567
|
567
|
|
|
568
|
568
|
if ( false !== $this->does_plugin_require_update( $slug ) ) { |
|
569
|
|
- add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_update' ), 20 ); |
|
|
569
|
+ add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_update' ), 20 ); |
|
570
|
570
|
} |
|
571
|
571
|
} |
|
572
|
572
|
} |
|
@@ -581,7 +581,7 @@ discard block |
|
|
block discarded – undo |
|
581
|
581
|
* @return array |
|
582
|
582
|
*/ |
|
583
|
583
|
public function filter_plugin_action_links_activate( $actions ) { |
|
584
|
|
- unset( $actions['activate'] ); |
|
|
584
|
+ unset( $actions[ 'activate' ] ); |
|
585
|
585
|
|
|
586
|
586
|
return $actions; |
|
587
|
587
|
} |
|
@@ -595,7 +595,7 @@ discard block |
|
|
block discarded – undo |
|
595
|
595
|
* @return array |
|
596
|
596
|
*/ |
|
597
|
597
|
public function filter_plugin_action_links_deactivate( $actions ) { |
|
598
|
|
- unset( $actions['deactivate'] ); |
|
|
598
|
+ unset( $actions[ 'deactivate' ] ); |
|
599
|
599
|
|
|
600
|
600
|
return $actions; |
|
601
|
601
|
} |
|
@@ -610,7 +610,7 @@ discard block |
|
|
block discarded – undo |
|
610
|
610
|
* @return array |
|
611
|
611
|
*/ |
|
612
|
612
|
public function filter_plugin_action_links_update( $actions ) { |
|
613
|
|
- $actions['update'] = sprintf( |
|
|
613
|
+ $actions[ 'update' ] = sprintf( |
|
614
|
614
|
'<a href="%1$s" title="%2$s" class="edit">%3$s</a>', |
|
615
|
615
|
esc_url( $this->get_tgmpa_status_url( 'update' ) ), |
|
616
|
616
|
esc_attr__( 'This plugin needs to be updated to be compatible with your theme.', 'tgmpa' ), |
|
@@ -648,9 +648,9 @@ discard block |
|
|
block discarded – undo |
|
648
|
648
|
return; |
|
649
|
649
|
} |
|
650
|
650
|
|
|
651
|
|
- if ( isset( $_REQUEST['tab'] ) && 'plugin-information' === $_REQUEST['tab'] ) { |
|
|
651
|
+ if ( isset( $_REQUEST[ 'tab' ] ) && 'plugin-information' === $_REQUEST[ 'tab' ] ) { |
|
652
|
652
|
// Needed for install_plugin_information(). |
|
653
|
|
- require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
|
|
653
|
+ require_once ABSPATH.'wp-admin/includes/plugin-install.php'; |
|
654
|
654
|
|
|
655
|
655
|
wp_enqueue_style( 'plugin-install' ); |
|
656
|
656
|
|
|
@@ -678,7 +678,7 @@ discard block |
|
|
block discarded – undo |
|
678
|
678
|
* @since 2.1.0 |
|
679
|
679
|
*/ |
|
680
|
680
|
public function thickbox() { |
|
681
|
|
- if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) ) { |
|
|
681
|
+ if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, true ) ) { |
|
682
|
682
|
add_thickbox(); |
|
683
|
683
|
} |
|
684
|
684
|
} |
|
@@ -707,11 +707,11 @@ discard block |
|
|
block discarded – undo |
|
707
|
707
|
$args = apply_filters( |
|
708
|
708
|
'tgmpa_admin_menu_args', |
|
709
|
709
|
array( |
|
710
|
|
- 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
711
|
|
- 'page_title' => $this->strings['page_title'], // Page title. |
|
712
|
|
- 'menu_title' => $this->strings['menu_title'], // Menu title. |
|
713
|
|
- 'capability' => $this->capability, // Capability. |
|
714
|
|
- 'menu_slug' => $this->menu, // Menu slug. |
|
|
710
|
+ 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
|
711
|
+ 'page_title' => $this->strings[ 'page_title' ], // Page title. |
|
|
712
|
+ 'menu_title' => $this->strings[ 'menu_title' ], // Menu title. |
|
|
713
|
+ 'capability' => $this->capability, // Capability. |
|
|
714
|
+ 'menu_slug' => $this->menu, // Menu slug. |
|
715
|
715
|
'function' => array( $this, 'install_plugins_page' ), // Callback. |
|
716
|
716
|
) |
|
717
|
717
|
); |
|
@@ -735,9 +735,9 @@ discard block |
|
|
block discarded – undo |
|
735
|
735
|
} |
|
736
|
736
|
|
|
737
|
737
|
if ( 'themes.php' === $this->parent_slug ) { |
|
738
|
|
- $this->page_hook = call_user_func( 'add_theme_page', $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] ); |
|
|
738
|
+ $this->page_hook = call_user_func( 'add_theme_page', $args[ 'page_title' ], $args[ 'menu_title' ], $args[ 'capability' ], $args[ 'menu_slug' ], $args[ 'function' ] ); |
|
739
|
739
|
} else { |
|
740
|
|
- $this->page_hook = call_user_func( 'add_submenu_page', $args['parent_slug'], $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] ); |
|
|
740
|
+ $this->page_hook = call_user_func( 'add_submenu_page', $args[ 'parent_slug' ], $args[ 'page_title' ], $args[ 'menu_title' ], $args[ 'capability' ], $args[ 'menu_slug' ], $args[ 'function' ] ); |
|
741
|
741
|
} |
|
742
|
742
|
} |
|
743
|
743
|
|
|
@@ -806,37 +806,37 @@ discard block |
|
|
block discarded – undo |
|
806
|
806
|
* @return boolean True on success, false on failure. |
|
807
|
807
|
*/ |
|
808
|
808
|
protected function do_plugin_install() { |
|
809
|
|
- if ( empty( $_GET['plugin'] ) ) { |
|
|
809
|
+ if ( empty( $_GET[ 'plugin' ] ) ) { |
|
810
|
810
|
return false; |
|
811
|
811
|
} |
|
812
|
812
|
|
|
813
|
813
|
// All plugin information will be stored in an array for processing. |
|
814
|
|
- $slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) ); |
|
|
814
|
+ $slug = $this->sanitize_key( urldecode( $_GET[ 'plugin' ] ) ); |
|
815
|
815
|
|
|
816
|
816
|
if ( ! isset( $this->plugins[ $slug ] ) ) { |
|
817
|
817
|
return false; |
|
818
|
818
|
} |
|
819
|
819
|
|
|
820
|
820
|
// Was an install or upgrade action link clicked? |
|
821
|
|
- if ( ( isset( $_GET['tgmpa-install'] ) && 'install-plugin' === $_GET['tgmpa-install'] ) || ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) ) { |
|
|
821
|
+ if ( ( isset( $_GET[ 'tgmpa-install' ] ) && 'install-plugin' === $_GET[ 'tgmpa-install' ] ) || ( isset( $_GET[ 'tgmpa-update' ] ) && 'update-plugin' === $_GET[ 'tgmpa-update' ] ) ) { |
|
822
|
822
|
|
|
823
|
823
|
$install_type = 'install'; |
|
824
|
|
- if ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) { |
|
|
824
|
+ if ( isset( $_GET[ 'tgmpa-update' ] ) && 'update-plugin' === $_GET[ 'tgmpa-update' ] ) { |
|
825
|
825
|
$install_type = 'update'; |
|
826
|
826
|
} |
|
827
|
827
|
|
|
828
|
|
- check_admin_referer( 'tgmpa-' . $install_type, 'tgmpa-nonce' ); |
|
|
828
|
+ check_admin_referer( 'tgmpa-'.$install_type, 'tgmpa-nonce' ); |
|
829
|
829
|
|
|
830
|
830
|
// Pass necessary information via URL if WP_Filesystem is needed. |
|
831
|
831
|
$url = wp_nonce_url( |
|
832
|
832
|
add_query_arg( |
|
833
|
833
|
array( |
|
834
|
834
|
'plugin' => urlencode( $slug ), |
|
835
|
|
- 'tgmpa-' . $install_type => $install_type . '-plugin', |
|
|
835
|
+ 'tgmpa-'.$install_type => $install_type.'-plugin', |
|
836
|
836
|
), |
|
837
|
837
|
$this->get_tgmpa_url() |
|
838
|
838
|
), |
|
839
|
|
- 'tgmpa-' . $install_type, |
|
|
839
|
+ 'tgmpa-'.$install_type, |
|
840
|
840
|
'tgmpa-nonce' |
|
841
|
841
|
); |
|
842
|
842
|
|
|
@@ -855,29 +855,29 @@ discard block |
|
|
block discarded – undo |
|
855
|
855
|
|
|
856
|
856
|
// Prep variables for Plugin_Installer_Skin class. |
|
857
|
857
|
$extra = array(); |
|
858
|
|
- $extra['slug'] = $slug; // Needed for potentially renaming of directory name. |
|
|
858
|
+ $extra[ 'slug' ] = $slug; // Needed for potentially renaming of directory name. |
|
859
|
859
|
$source = $this->get_download_url( $slug ); |
|
860
|
|
- $api = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null; |
|
|
860
|
+ $api = ( 'repo' === $this->plugins[ $slug ][ 'source_type' ] ) ? $this->get_plugins_api( $slug ) : null; |
|
861
|
861
|
$api = ( false !== $api ) ? $api : null; |
|
862
|
862
|
|
|
863
|
863
|
$url = add_query_arg( |
|
864
|
864
|
array( |
|
865
|
|
- 'action' => $install_type . '-plugin', |
|
|
865
|
+ 'action' => $install_type.'-plugin', |
|
866
|
866
|
'plugin' => urlencode( $slug ), |
|
867
|
867
|
), |
|
868
|
868
|
'update.php' |
|
869
|
869
|
); |
|
870
|
870
|
|
|
871
|
871
|
if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
|
872
|
|
- require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
|
872
|
+ require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
873
|
873
|
} |
|
874
|
874
|
|
|
875
|
|
- $title = ( 'update' === $install_type ) ? $this->strings['updating'] : $this->strings['installing']; |
|
|
875
|
+ $title = ( 'update' === $install_type ) ? $this->strings[ 'updating' ] : $this->strings[ 'installing' ]; |
|
876
|
876
|
$skin_args = array( |
|
877
|
|
- 'type' => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload', |
|
878
|
|
- 'title' => sprintf( $title, $this->plugins[ $slug ]['name'] ), |
|
|
877
|
+ 'type' => ( 'bundled' !== $this->plugins[ $slug ][ 'source_type' ] ) ? 'web' : 'upload', |
|
|
878
|
+ 'title' => sprintf( $title, $this->plugins[ $slug ][ 'name' ] ), |
|
879
|
879
|
'url' => esc_url_raw( $url ), |
|
880
|
|
- 'nonce' => $install_type . '-plugin_' . $slug, |
|
|
880
|
+ 'nonce' => $install_type.'-plugin_'.$slug, |
|
881
|
881
|
'plugin' => '', |
|
882
|
882
|
'api' => $api, |
|
883
|
883
|
'extra' => $extra, |
|
@@ -885,7 +885,7 @@ discard block |
|
|
block discarded – undo |
|
885
|
885
|
unset( $title ); |
|
886
|
886
|
|
|
887
|
887
|
if ( 'update' === $install_type ) { |
|
888
|
|
- $skin_args['plugin'] = $this->plugins[ $slug ]['file_path']; |
|
|
888
|
+ $skin_args[ 'plugin' ] = $this->plugins[ $slug ][ 'file_path' ]; |
|
889
|
889
|
$skin = new Plugin_Upgrader_Skin( $skin_args ); |
|
890
|
890
|
} else { |
|
891
|
891
|
$skin = new Plugin_Installer_Skin( $skin_args ); |
|
@@ -900,10 +900,10 @@ discard block |
|
|
block discarded – undo |
|
900
|
900
|
if ( 'update' === $install_type ) { |
|
901
|
901
|
// Inject our info into the update transient. |
|
902
|
902
|
$to_inject = array( $slug => $this->plugins[ $slug ] ); |
|
903
|
|
- $to_inject[ $slug ]['source'] = $source; |
|
|
903
|
+ $to_inject[ $slug ][ 'source' ] = $source; |
|
904
|
904
|
$this->inject_update_info( $to_inject ); |
|
905
|
905
|
|
|
906
|
|
- $upgrader->upgrade( $this->plugins[ $slug ]['file_path'] ); |
|
|
906
|
+ $upgrader->upgrade( $this->plugins[ $slug ][ 'file_path' ] ); |
|
907
|
907
|
} else { |
|
908
|
908
|
$upgrader->install( $source ); |
|
909
|
909
|
} |
|
@@ -926,18 +926,18 @@ discard block |
|
|
block discarded – undo |
|
926
|
926
|
|
|
927
|
927
|
// Display message based on if all plugins are now active or not. |
|
928
|
928
|
if ( $this->is_tgmpa_complete() ) { |
|
929
|
|
- echo '<p>', sprintf( esc_html( $this->strings['complete'] ), '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' ), '</p>'; |
|
|
929
|
+ echo '<p>', sprintf( esc_html( $this->strings[ 'complete' ] ), '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' ), '</p>'; |
|
930
|
930
|
echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
|
931
|
931
|
} else { |
|
932
|
|
- echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; |
|
|
932
|
+ echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings[ 'return' ] ), '</a></p>'; |
|
933
|
933
|
} |
|
934
|
934
|
|
|
935
|
935
|
return true; |
|
936
|
|
- } elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) { |
|
|
936
|
+ } elseif ( isset( $this->plugins[ $slug ][ 'file_path' ], $_GET[ 'tgmpa-activate' ] ) && 'activate-plugin' === $_GET[ 'tgmpa-activate' ] ) { |
|
937
|
937
|
// Activate action link was clicked. |
|
938
|
938
|
check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' ); |
|
939
|
939
|
|
|
940
|
|
- if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) { |
|
|
940
|
+ if ( false === $this->activate_single_plugin( $this->plugins[ $slug ][ 'file_path' ], $slug ) ) { |
|
941
|
941
|
return true; // Finish execution of the function early as we encountered an error. |
|
942
|
942
|
} |
|
943
|
943
|
} |
|
@@ -960,7 +960,7 @@ discard block |
|
|
block discarded – undo |
|
960
|
960
|
} |
|
961
|
961
|
|
|
962
|
962
|
foreach ( $plugins as $slug => $plugin ) { |
|
963
|
|
- $file_path = $plugin['file_path']; |
|
|
963
|
+ $file_path = $plugin[ 'file_path' ]; |
|
964
|
964
|
|
|
965
|
965
|
if ( empty( $repo_updates->response[ $file_path ] ) ) { |
|
966
|
966
|
$repo_updates->response[ $file_path ] = new stdClass; |
|
@@ -969,10 +969,10 @@ discard block |
|
|
block discarded – undo |
|
969
|
969
|
// We only really need to set package, but let's do all we can in case WP changes something. |
|
970
|
970
|
$repo_updates->response[ $file_path ]->slug = $slug; |
|
971
|
971
|
$repo_updates->response[ $file_path ]->plugin = $file_path; |
|
972
|
|
- $repo_updates->response[ $file_path ]->new_version = $plugin['version']; |
|
973
|
|
- $repo_updates->response[ $file_path ]->package = $plugin['source']; |
|
974
|
|
- if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) { |
|
975
|
|
- $repo_updates->response[ $file_path ]->url = $plugin['external_url']; |
|
|
972
|
+ $repo_updates->response[ $file_path ]->new_version = $plugin[ 'version' ]; |
|
|
973
|
+ $repo_updates->response[ $file_path ]->package = $plugin[ 'source' ]; |
|
|
974
|
+ if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin[ 'external_url' ] ) ) { |
|
|
975
|
+ $repo_updates->response[ $file_path ]->url = $plugin[ 'external_url' ]; |
|
976
|
976
|
} |
|
977
|
977
|
} |
|
978
|
978
|
|
|
@@ -996,13 +996,13 @@ discard block |
|
|
block discarded – undo |
|
996
|
996
|
* @return string $source |
|
997
|
997
|
*/ |
|
998
|
998
|
public function maybe_adjust_source_dir( $source, $remote_source, $upgrader ) { |
|
999
|
|
- if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS['wp_filesystem'] ) ) { |
|
|
999
|
+ if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS[ 'wp_filesystem' ] ) ) { |
|
1000
|
1000
|
return $source; |
|
1001
|
1001
|
} |
|
1002
|
1002
|
|
|
1003
|
1003
|
// Check for single file plugins. |
|
1004
|
|
- $source_files = array_keys( $GLOBALS['wp_filesystem']->dirlist( $remote_source ) ); |
|
1005
|
|
- if ( 1 === count( $source_files ) && false === $GLOBALS['wp_filesystem']->is_dir( $source ) ) { |
|
|
1004
|
+ $source_files = array_keys( $GLOBALS[ 'wp_filesystem' ]->dirlist( $remote_source ) ); |
|
|
1005
|
+ if ( 1 === count( $source_files ) && false === $GLOBALS[ 'wp_filesystem' ]->is_dir( $source ) ) { |
|
1006
|
1006
|
return $source; |
|
1007
|
1007
|
} |
|
1008
|
1008
|
|
|
@@ -1010,12 +1010,12 @@ discard block |
|
|
block discarded – undo |
|
1010
|
1010
|
$desired_slug = ''; |
|
1011
|
1011
|
|
|
1012
|
1012
|
// Figure out what the slug is supposed to be. |
|
1013
|
|
- if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options['extra']['slug'] ) ) { |
|
1014
|
|
- $desired_slug = $upgrader->skin->options['extra']['slug']; |
|
|
1013
|
+ if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options[ 'extra' ][ 'slug' ] ) ) { |
|
|
1014
|
+ $desired_slug = $upgrader->skin->options[ 'extra' ][ 'slug' ]; |
|
1015
|
1015
|
} else { |
|
1016
|
1016
|
// Bulk installer contains less info, so fall back on the info registered here. |
|
1017
|
1017
|
foreach ( $this->plugins as $slug => $plugin ) { |
|
1018
|
|
- if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
|
|
1018
|
+ if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin[ 'name' ] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
|
1019
|
1019
|
$desired_slug = $slug; |
|
1020
|
1020
|
break; |
|
1021
|
1021
|
} |
|
@@ -1028,15 +1028,15 @@ discard block |
|
|
block discarded – undo |
|
1028
|
1028
|
|
|
1029
|
1029
|
if ( ! empty( $subdir_name ) && $subdir_name !== $desired_slug ) { |
|
1030
|
1030
|
$from = untrailingslashit( $source ); |
|
1031
|
|
- $to = trailingslashit( $remote_source ) . $desired_slug; |
|
|
1031
|
+ $to = trailingslashit( $remote_source ).$desired_slug; |
|
1032
|
1032
|
|
|
1033
|
|
- if ( true === $GLOBALS['wp_filesystem']->move( $from, $to ) ) { |
|
|
1033
|
+ if ( true === $GLOBALS[ 'wp_filesystem' ]->move( $from, $to ) ) { |
|
1034
|
1034
|
return trailingslashit( $to ); |
|
1035
|
1035
|
} else { |
|
1036
|
|
- 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 ) ); |
|
|
1036
|
+ 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 ) ); |
|
1037
|
1037
|
} |
|
1038
|
1038
|
} elseif ( empty( $subdir_name ) ) { |
|
1039
|
|
- return new WP_Error( 'packaged_wrong', esc_html__( 'The remote plugin package consists of more than one file, but the files are not packaged in a folder.', '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 ) ); |
|
|
1039
|
+ return new WP_Error( 'packaged_wrong', esc_html__( 'The remote plugin package consists of more than one file, but the files are not packaged in a folder.', '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 ) ); |
|
1040
|
1040
|
} |
|
1041
|
1041
|
} |
|
1042
|
1042
|
|
|
@@ -1060,19 +1060,19 @@ discard block |
|
|
block discarded – undo |
|
1060
|
1060
|
|
|
1061
|
1061
|
if ( is_wp_error( $activate ) ) { |
|
1062
|
1062
|
echo '<div id="message" class="error"><p>', wp_kses_post( $activate->get_error_message() ), '</p></div>', |
|
1063
|
|
- '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; |
|
|
1063
|
+ '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings[ 'return' ] ), '</a></p>'; |
|
1064
|
1064
|
|
|
1065
|
1065
|
return false; // End it here if there is an error with activation. |
|
1066
|
1066
|
} else { |
|
1067
|
1067
|
if ( ! $automatic ) { |
|
1068
|
1068
|
// Make sure message doesn't display again if bulk activation is performed |
|
1069
|
1069
|
// immediately after a single activation. |
|
1070
|
|
- if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
1071
|
|
- echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>'; |
|
|
1070
|
+ if ( ! isset( $_POST[ 'action' ] ) ) { // WPCS: CSRF OK. |
|
|
1071
|
+ echo '<div id="message" class="updated"><p>', esc_html( $this->strings[ 'activated_successfully' ] ), ' <strong>', esc_html( $this->plugins[ $slug ][ 'name' ] ), '.</strong></p></div>'; |
|
1072
|
1072
|
} |
|
1073
|
1073
|
} else { |
|
1074
|
1074
|
// Simpler message layout for use on the plugin install page. |
|
1075
|
|
- echo '<p>', esc_html( $this->strings['plugin_activated'] ), '</p>'; |
|
|
1075
|
+ echo '<p>', esc_html( $this->strings[ 'plugin_activated' ] ), '</p>'; |
|
1076
|
1076
|
} |
|
1077
|
1077
|
} |
|
1078
|
1078
|
} elseif ( $this->is_plugin_active( $slug ) ) { |
|
@@ -1080,25 +1080,25 @@ discard block |
|
|
block discarded – undo |
|
1080
|
1080
|
// on the plugin install page. |
|
1081
|
1081
|
echo '<div id="message" class="error"><p>', |
|
1082
|
1082
|
sprintf( |
|
1083
|
|
- esc_html( $this->strings['plugin_already_active'] ), |
|
1084
|
|
- '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
|
1083
|
+ esc_html( $this->strings[ 'plugin_already_active' ] ), |
|
|
1084
|
+ '<strong>'.esc_html( $this->plugins[ $slug ][ 'name' ] ).'</strong>' |
|
1085
|
1085
|
), |
|
1086
|
1086
|
'</p></div>'; |
|
1087
|
1087
|
} elseif ( $this->does_plugin_require_update( $slug ) ) { |
|
1088
|
1088
|
if ( ! $automatic ) { |
|
1089
|
1089
|
// Make sure message doesn't display again if bulk activation is performed |
|
1090
|
1090
|
// immediately after a single activation. |
|
1091
|
|
- if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
|
1091
|
+ if ( ! isset( $_POST[ 'action' ] ) ) { // WPCS: CSRF OK. |
|
1092
|
1092
|
echo '<div id="message" class="error"><p>', |
|
1093
|
1093
|
sprintf( |
|
1094
|
|
- esc_html( $this->strings['plugin_needs_higher_version'] ), |
|
1095
|
|
- '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
|
1094
|
+ esc_html( $this->strings[ 'plugin_needs_higher_version' ] ), |
|
|
1095
|
+ '<strong>'.esc_html( $this->plugins[ $slug ][ 'name' ] ).'</strong>' |
|
1096
|
1096
|
), |
|
1097
|
1097
|
'</p></div>'; |
|
1098
|
1098
|
} |
|
1099
|
1099
|
} else { |
|
1100
|
1100
|
// Simpler message layout for use on the plugin install page. |
|
1101
|
|
- echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>'; |
|
|
1101
|
+ echo '<p>', sprintf( esc_html( $this->strings[ 'plugin_needs_higher_version' ] ), esc_html( $this->plugins[ $slug ][ 'name' ] ) ), '</p>'; |
|
1102
|
1102
|
} |
|
1103
|
1103
|
} |
|
1104
|
1104
|
|
|
@@ -1122,7 +1122,7 @@ discard block |
|
|
block discarded – undo |
|
1122
|
1122
|
*/ |
|
1123
|
1123
|
public function notices() { |
|
1124
|
1124
|
// Remove nag on the install page / Return early if the nag message has been dismissed or user < author. |
|
1125
|
|
- if ( ( $this->is_tgmpa_page() || $this->is_core_update_page() ) || get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) || ! current_user_can( apply_filters( 'tgmpa_show_admin_notice_capability', 'publish_posts' ) ) ) { |
|
|
1125
|
+ if ( ( $this->is_tgmpa_page() || $this->is_core_update_page() ) || get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, true ) || ! current_user_can( apply_filters( 'tgmpa_show_admin_notice_capability', 'publish_posts' ) ) ) { |
|
1126
|
1126
|
return; |
|
1127
|
1127
|
} |
|
1128
|
1128
|
|
|
@@ -1143,18 +1143,18 @@ discard block |
|
|
block discarded – undo |
|
1143
|
1143
|
} |
|
1144
|
1144
|
|
|
1145
|
1145
|
if ( $force_activated ) { |
|
1146
|
|
- $message['notice_force_activation'][] = $slug; |
|
|
1146
|
+ $message[ 'notice_force_activation' ][ ] = $slug; |
|
1147
|
1147
|
} else if ( ! $this->is_plugin_installed( $slug ) ) { |
|
1148
|
1148
|
if ( current_user_can( 'install_plugins' ) ) { |
|
1149
|
1149
|
$install_link_count++; |
|
1150
|
1150
|
|
|
1151
|
|
- if ( true === $plugin['required'] ) { |
|
1152
|
|
- $message['notice_can_install_required'][] = $slug; |
|
|
1151
|
+ if ( true === $plugin[ 'required' ] ) { |
|
|
1152
|
+ $message[ 'notice_can_install_required' ][ ] = $slug; |
|
1153
|
1153
|
} else { |
|
1154
|
|
- $message['notice_can_install_recommended'][] = $slug; |
|
|
1154
|
+ $message[ 'notice_can_install_recommended' ][ ] = $slug; |
|
1155
|
1155
|
} |
|
1156
|
1156
|
} |
|
1157
|
|
- if ( true === $plugin['required'] ) { |
|
|
1157
|
+ if ( true === $plugin[ 'required' ] ) { |
|
1158
|
1158
|
$total_required_action_count++; |
|
1159
|
1159
|
} |
|
1160
|
1160
|
} else { |
|
@@ -1162,13 +1162,13 @@ discard block |
|
|
block discarded – undo |
|
1162
|
1162
|
if ( current_user_can( 'activate_plugins' ) ) { |
|
1163
|
1163
|
$activate_link_count++; |
|
1164
|
1164
|
|
|
1165
|
|
- if ( true === $plugin['required'] ) { |
|
1166
|
|
- $message['notice_can_activate_required'][] = $slug; |
|
|
1165
|
+ if ( true === $plugin[ 'required' ] ) { |
|
|
1166
|
+ $message[ 'notice_can_activate_required' ][ ] = $slug; |
|
1167
|
1167
|
} else { |
|
1168
|
|
- $message['notice_can_activate_recommended'][] = $slug; |
|
|
1168
|
+ $message[ 'notice_can_activate_recommended' ][ ] = $slug; |
|
1169
|
1169
|
} |
|
1170
|
1170
|
} |
|
1171
|
|
- if ( true === $plugin['required'] ) { |
|
|
1171
|
+ if ( true === $plugin[ 'required' ] ) { |
|
1172
|
1172
|
$total_required_action_count++; |
|
1173
|
1173
|
} |
|
1174
|
1174
|
} |
|
@@ -1179,12 +1179,12 @@ discard block |
|
|
block discarded – undo |
|
1179
|
1179
|
$update_link_count++; |
|
1180
|
1180
|
|
|
1181
|
1181
|
if ( $this->does_plugin_require_update( $slug ) ) { |
|
1182
|
|
- $message['notice_ask_to_update'][] = $slug; |
|
|
1182
|
+ $message[ 'notice_ask_to_update' ][ ] = $slug; |
|
1183
|
1183
|
} elseif ( false !== $this->does_plugin_have_update( $slug ) ) { |
|
1184
|
|
- $message['notice_ask_to_update_maybe'][] = $slug; |
|
|
1184
|
+ $message[ 'notice_ask_to_update_maybe' ][ ] = $slug; |
|
1185
|
1185
|
} |
|
1186
|
1186
|
} |
|
1187
|
|
- if ( true === $plugin['required'] ) { |
|
|
1187
|
+ if ( true === $plugin[ 'required' ] ) { |
|
1188
|
1188
|
$total_required_action_count++; |
|
1189
|
1189
|
} |
|
1190
|
1190
|
} |
|
@@ -1199,10 +1199,10 @@ discard block |
|
|
block discarded – undo |
|
1199
|
1199
|
|
|
1200
|
1200
|
// As add_settings_error() wraps the final message in a <p> and as the final message can't be |
|
1201
|
1201
|
// filtered, using <p>'s in our html would render invalid html output. |
|
1202
|
|
- $line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>' . "\n"; |
|
|
1202
|
+ $line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>'."\n"; |
|
1203
|
1203
|
|
|
1204
|
1204
|
if ( ! current_user_can( 'activate_plugins' ) && ! current_user_can( 'install_plugins' ) && ! current_user_can( 'update_plugins' ) ) { |
|
1205
|
|
- $rendered = esc_html__( $this->strings['notice_cannot_install_activate'] ) . ' ' . esc_html__( $this->strings['contact_admin'] ); |
|
|
1205
|
+ $rendered = esc_html__( $this->strings[ 'notice_cannot_install_activate' ] ).' '.esc_html__( $this->strings[ 'contact_admin' ] ); |
|
1206
|
1206
|
$rendered .= $this->create_user_action_links_for_notice( 0, 0, 0, $line_template ); |
|
1207
|
1207
|
} else { |
|
1208
|
1208
|
|
|
@@ -1217,14 +1217,14 @@ discard block |
|
|
block discarded – undo |
|
1217
|
1217
|
|
|
1218
|
1218
|
// Get the external info link for a plugin if one is available. |
|
1219
|
1219
|
foreach ( $plugin_group as $plugin_slug ) { |
|
1220
|
|
- $linked_plugins[] = $this->get_info_link( $plugin_slug ); |
|
|
1220
|
+ $linked_plugins[ ] = $this->get_info_link( $plugin_slug ); |
|
1221
|
1221
|
} |
|
1222
|
1222
|
unset( $plugin_slug ); |
|
1223
|
1223
|
|
|
1224
|
1224
|
$count = count( $plugin_group ); |
|
1225
|
1225
|
$linked_plugins = array_map( array( 'TGMPA_Utils', 'wrap_in_em' ), $linked_plugins ); |
|
1226
|
1226
|
$last_plugin = array_pop( $linked_plugins ); // Pop off last name to prep for readability. |
|
1227
|
|
- $imploded = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
|
1227
|
+ $imploded = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); |
|
1228
|
1228
|
|
|
1229
|
1229
|
$rendered .= sprintf( |
|
1230
|
1230
|
$line_template, |
|
@@ -1246,7 +1246,7 @@ discard block |
|
|
block discarded – undo |
|
1246
|
1246
|
} |
|
1247
|
1247
|
|
|
1248
|
1248
|
// Admin options pages already output settings_errors, so this is to avoid duplication. |
|
1249
|
|
- if ( 'options-general' !== $GLOBALS['current_screen']->parent_base ) { |
|
|
1249
|
+ if ( 'options-general' !== $GLOBALS[ 'current_screen' ]->parent_base ) { |
|
1250
|
1250
|
$this->display_settings_errors(); |
|
1251
|
1251
|
} |
|
1252
|
1252
|
} |
|
@@ -1268,32 +1268,32 @@ discard block |
|
|
block discarded – undo |
|
1268
|
1268
|
'install' => '', |
|
1269
|
1269
|
'update' => '', |
|
1270
|
1270
|
'activate' => '', |
|
1271
|
|
- 'dismiss' => $this->dismissable ? '<a href="' . esc_url( wp_nonce_url( add_query_arg( 'tgmpa-dismiss', 'dismiss_admin_notices' ), 'tgmpa-dismiss-' . get_current_user_id() ) ) . '" class="dismiss-notice" target="_parent">' . esc_html( $this->strings['dismiss'] ) . '</a>' : '', |
|
|
1271
|
+ 'dismiss' => $this->dismissable ? '<a href="'.esc_url( wp_nonce_url( add_query_arg( 'tgmpa-dismiss', 'dismiss_admin_notices' ), 'tgmpa-dismiss-'.get_current_user_id() ) ).'" class="dismiss-notice" target="_parent">'.esc_html( $this->strings[ 'dismiss' ] ).'</a>' : '', |
|
1272
|
1272
|
); |
|
1273
|
1273
|
|
|
1274
|
1274
|
$link_template = '<a href="%2$s">%1$s</a>'; |
|
1275
|
1275
|
|
|
1276
|
1276
|
if ( current_user_can( 'install_plugins' ) ) { |
|
1277
|
1277
|
if ( $install_count > 0 ) { |
|
1278
|
|
- $action_links['install'] = sprintf( |
|
|
1278
|
+ $action_links[ 'install' ] = sprintf( |
|
1279
|
1279
|
$link_template, |
|
1280
|
|
- translate_nooped_plural( $this->strings['install_link'], $install_count, 'tgmpa' ), |
|
|
1280
|
+ translate_nooped_plural( $this->strings[ 'install_link' ], $install_count, 'tgmpa' ), |
|
1281
|
1281
|
esc_url( $this->get_tgmpa_status_url( 'install' ) ) |
|
1282
|
1282
|
); |
|
1283
|
1283
|
} |
|
1284
|
1284
|
if ( $update_count > 0 ) { |
|
1285
|
|
- $action_links['update'] = sprintf( |
|
|
1285
|
+ $action_links[ 'update' ] = sprintf( |
|
1286
|
1286
|
$link_template, |
|
1287
|
|
- translate_nooped_plural( $this->strings['update_link'], $update_count, 'tgmpa' ), |
|
|
1287
|
+ translate_nooped_plural( $this->strings[ 'update_link' ], $update_count, 'tgmpa' ), |
|
1288
|
1288
|
esc_url( $this->get_tgmpa_status_url( 'update' ) ) |
|
1289
|
1289
|
); |
|
1290
|
1290
|
} |
|
1291
|
1291
|
} |
|
1292
|
1292
|
|
|
1293
|
1293
|
if ( current_user_can( 'activate_plugins' ) && $activate_count > 0 ) { |
|
1294
|
|
- $action_links['activate'] = sprintf( |
|
|
1294
|
+ $action_links[ 'activate' ] = sprintf( |
|
1295
|
1295
|
$link_template, |
|
1296
|
|
- translate_nooped_plural( $this->strings['activate_link'], $activate_count, 'tgmpa' ), |
|
|
1296
|
+ translate_nooped_plural( $this->strings[ 'activate_link' ], $activate_count, 'tgmpa' ), |
|
1297
|
1297
|
esc_url( $this->get_tgmpa_status_url( 'activate' ) ) |
|
1298
|
1298
|
); |
|
1299
|
1299
|
} |
|
@@ -1321,8 +1321,8 @@ discard block |
|
|
block discarded – undo |
|
1321
|
1321
|
* @return string |
|
1322
|
1322
|
*/ |
|
1323
|
1323
|
protected function get_admin_notice_class() { |
|
1324
|
|
- if ( ! empty( $this->strings['nag_type'] ) ) { |
|
1325
|
|
- return sanitize_html_class( strtolower( $this->strings['nag_type'] ) ); |
|
|
1324
|
+ if ( ! empty( $this->strings[ 'nag_type' ] ) ) { |
|
|
1325
|
+ return sanitize_html_class( strtolower( $this->strings[ 'nag_type' ] ) ); |
|
1326
|
1326
|
} else { |
|
1327
|
1327
|
if ( version_compare( $this->wp_version, '4.2', '>=' ) ) { |
|
1328
|
1328
|
return 'notice-warning'; |
|
@@ -1345,7 +1345,7 @@ discard block |
|
|
block discarded – undo |
|
1345
|
1345
|
settings_errors( 'tgmpa' ); |
|
1346
|
1346
|
|
|
1347
|
1347
|
foreach ( (array) $wp_settings_errors as $key => $details ) { |
|
1348
|
|
- if ( 'tgmpa' === $details['setting'] ) { |
|
|
1348
|
+ if ( 'tgmpa' === $details[ 'setting' ] ) { |
|
1349
|
1349
|
unset( $wp_settings_errors[ $key ] ); |
|
1350
|
1350
|
break; |
|
1351
|
1351
|
} |
|
@@ -1361,8 +1361,8 @@ discard block |
|
|
block discarded – undo |
|
1361
|
1361
|
* @since 2.1.0 |
|
1362
|
1362
|
*/ |
|
1363
|
1363
|
public function dismiss() { |
|
1364
|
|
- if ( isset( $_GET['tgmpa-dismiss'] ) && check_admin_referer( 'tgmpa-dismiss-' . get_current_user_id() ) ) { |
|
1365
|
|
- update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, 1 ); |
|
|
1364
|
+ if ( isset( $_GET[ 'tgmpa-dismiss' ] ) && check_admin_referer( 'tgmpa-dismiss-'.get_current_user_id() ) ) { |
|
|
1365
|
+ update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, 1 ); |
|
1366
|
1366
|
} |
|
1367
|
1367
|
} |
|
1368
|
1368
|
|
|
@@ -1378,54 +1378,54 @@ discard block |
|
|
block discarded – undo |
|
1378
|
1378
|
* @return null Return early if incorrect argument. |
|
1379
|
1379
|
*/ |
|
1380
|
1380
|
public function register( $plugin ) { |
|
1381
|
|
- if ( empty( $plugin['slug'] ) || empty( $plugin['name'] ) ) { |
|
|
1381
|
+ if ( empty( $plugin[ 'slug' ] ) || empty( $plugin[ 'name' ] ) ) { |
|
1382
|
1382
|
return; |
|
1383
|
1383
|
} |
|
1384
|
1384
|
|
|
1385
|
|
- if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) { |
|
|
1385
|
+ if ( empty( $plugin[ 'slug' ] ) || ! is_string( $plugin[ 'slug' ] ) || isset( $this->plugins[ $plugin[ 'slug' ] ] ) ) { |
|
1386
|
1386
|
return; |
|
1387
|
1387
|
} |
|
1388
|
1388
|
|
|
1389
|
1389
|
$defaults = array( |
|
1390
|
|
- 'name' => '', // String |
|
1391
|
|
- 'slug' => '', // String |
|
1392
|
|
- 'source' => 'repo', // String |
|
1393
|
|
- 'required' => false, // Boolean |
|
1394
|
|
- 'version' => '', // String |
|
1395
|
|
- 'force_activation' => false, // Boolean |
|
1396
|
|
- 'force_deactivation' => false, // Boolean |
|
1397
|
|
- 'external_url' => '', // String |
|
1398
|
|
- 'is_callable' => '', // String|Array. |
|
|
1390
|
+ 'name' => '', // String |
|
|
1391
|
+ 'slug' => '', // String |
|
|
1392
|
+ 'source' => 'repo', // String |
|
|
1393
|
+ 'required' => false, // Boolean |
|
|
1394
|
+ 'version' => '', // String |
|
|
1395
|
+ 'force_activation' => false, // Boolean |
|
|
1396
|
+ 'force_deactivation' => false, // Boolean |
|
|
1397
|
+ 'external_url' => '', // String |
|
|
1398
|
+ 'is_callable' => '', // String|Array. |
|
1399
|
1399
|
); |
|
1400
|
1400
|
|
|
1401
|
1401
|
// Prepare the received data. |
|
1402
|
1402
|
$plugin = wp_parse_args( $plugin, $defaults ); |
|
1403
|
1403
|
|
|
1404
|
1404
|
// Standardize the received slug. |
|
1405
|
|
- $plugin['slug'] = $this->sanitize_key( $plugin['slug'] ); |
|
|
1405
|
+ $plugin[ 'slug' ] = $this->sanitize_key( $plugin[ 'slug' ] ); |
|
1406
|
1406
|
|
|
1407
|
1407
|
// Forgive users for using string versions of booleans or floats for version number. |
|
1408
|
|
- $plugin['version'] = (string) $plugin['version']; |
|
1409
|
|
- $plugin['source'] = empty( $plugin['source'] ) ? 'repo' : $plugin['source']; |
|
1410
|
|
- $plugin['required'] = TGMPA_Utils::validate_bool( $plugin['required'] ); |
|
1411
|
|
- $plugin['force_activation'] = TGMPA_Utils::validate_bool( $plugin['force_activation'] ); |
|
1412
|
|
- $plugin['force_deactivation'] = TGMPA_Utils::validate_bool( $plugin['force_deactivation'] ); |
|
|
1408
|
+ $plugin[ 'version' ] = (string) $plugin[ 'version' ]; |
|
|
1409
|
+ $plugin[ 'source' ] = empty( $plugin[ 'source' ] ) ? 'repo' : $plugin[ 'source' ]; |
|
|
1410
|
+ $plugin[ 'required' ] = TGMPA_Utils::validate_bool( $plugin[ 'required' ] ); |
|
|
1411
|
+ $plugin[ 'force_activation' ] = TGMPA_Utils::validate_bool( $plugin[ 'force_activation' ] ); |
|
|
1412
|
+ $plugin[ 'force_deactivation' ] = TGMPA_Utils::validate_bool( $plugin[ 'force_deactivation' ] ); |
|
1413
|
1413
|
|
|
1414
|
1414
|
// Enrich the received data. |
|
1415
|
|
- $plugin['file_path'] = $this->_get_plugin_basename_from_slug( $plugin['slug'] ); |
|
1416
|
|
- $plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] ); |
|
|
1415
|
+ $plugin[ 'file_path' ] = $this->_get_plugin_basename_from_slug( $plugin[ 'slug' ] ); |
|
|
1416
|
+ $plugin[ 'source_type' ] = $this->get_plugin_source_type( $plugin[ 'source' ] ); |
|
1417
|
1417
|
|
|
1418
|
1418
|
// Set the class properties. |
|
1419
|
|
- $this->plugins[ $plugin['slug'] ] = $plugin; |
|
1420
|
|
- $this->sort_order[ $plugin['slug'] ] = $plugin['name']; |
|
|
1419
|
+ $this->plugins[ $plugin[ 'slug' ] ] = $plugin; |
|
|
1420
|
+ $this->sort_order[ $plugin[ 'slug' ] ] = $plugin[ 'name' ]; |
|
1421
|
1421
|
|
|
1422
|
1422
|
// Should we add the force activation hook ? |
|
1423
|
|
- if ( true === $plugin['force_activation'] ) { |
|
|
1423
|
+ if ( true === $plugin[ 'force_activation' ] ) { |
|
1424
|
1424
|
$this->has_forced_activation = true; |
|
1425
|
1425
|
} |
|
1426
|
1426
|
|
|
1427
|
1427
|
// Should we add the force deactivation hook ? |
|
1428
|
|
- if ( true === $plugin['force_deactivation'] ) { |
|
|
1428
|
+ if ( true === $plugin[ 'force_deactivation' ] ) { |
|
1429
|
1429
|
$this->has_forced_deactivation = true; |
|
1430
|
1430
|
} |
|
1431
|
1431
|
} |
|
@@ -1551,11 +1551,11 @@ discard block |
|
|
block discarded – undo |
|
1551
|
1551
|
*/ |
|
1552
|
1552
|
public function populate_file_path( $plugin_slug = '' ) { |
|
1553
|
1553
|
if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) { |
|
1554
|
|
- $this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
|
1554
|
+ $this->plugins[ $plugin_slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
1555
|
1555
|
} else { |
|
1556
|
1556
|
// Add file_path key for all plugins. |
|
1557
|
1557
|
foreach ( $this->plugins as $slug => $values ) { |
|
1558
|
|
- $this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug ); |
|
|
1558
|
+ $this->plugins[ $slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $slug ); |
|
1559
|
1559
|
} |
|
1560
|
1560
|
} |
|
1561
|
1561
|
} |
|
@@ -1573,7 +1573,7 @@ discard block |
|
|
block discarded – undo |
|
1573
|
1573
|
$keys = array_keys( $this->get_plugins() ); |
|
1574
|
1574
|
|
|
1575
|
1575
|
foreach ( $keys as $key ) { |
|
1576
|
|
- if ( preg_match( '|^' . $slug . '/|', $key ) ) { |
|
|
1576
|
+ if ( preg_match( '|^'.$slug.'/|', $key ) ) { |
|
1577
|
1577
|
return $key; |
|
1578
|
1578
|
} |
|
1579
|
1579
|
} |
|
@@ -1595,7 +1595,7 @@ discard block |
|
|
block discarded – undo |
|
1595
|
1595
|
*/ |
|
1596
|
1596
|
public function _get_plugin_data_from_name( $name, $data = 'slug' ) { |
|
1597
|
1597
|
foreach ( $this->plugins as $values ) { |
|
1598
|
|
- if ( $name === $values['name'] && isset( $values[ $data ] ) ) { |
|
|
1598
|
+ if ( $name === $values[ 'name' ] && isset( $values[ $data ] ) ) { |
|
1599
|
1599
|
return $values[ $data ]; |
|
1600
|
1600
|
} |
|
1601
|
1601
|
} |
|
@@ -1614,13 +1614,13 @@ discard block |
|
|
block discarded – undo |
|
1614
|
1614
|
public function get_download_url( $slug ) { |
|
1615
|
1615
|
$dl_source = ''; |
|
1616
|
1616
|
|
|
1617
|
|
- switch ( $this->plugins[ $slug ]['source_type'] ) { |
|
|
1617
|
+ switch ( $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1618
|
1618
|
case 'repo': |
|
1619
|
1619
|
return $this->get_wp_repo_download_url( $slug ); |
|
1620
|
1620
|
case 'external': |
|
1621
|
|
- return $this->plugins[ $slug ]['source']; |
|
|
1621
|
+ return $this->plugins[ $slug ][ 'source' ]; |
|
1622
|
1622
|
case 'bundled': |
|
1623
|
|
- return $this->default_path . $this->plugins[ $slug ]['source']; |
|
|
1623
|
+ return $this->default_path.$this->plugins[ $slug ][ 'source' ]; |
|
1624
|
1624
|
} |
|
1625
|
1625
|
|
|
1626
|
1626
|
return $dl_source; // Should never happen. |
|
@@ -1658,7 +1658,7 @@ discard block |
|
|
block discarded – undo |
|
1658
|
1658
|
|
|
1659
|
1659
|
if ( ! isset( $api[ $slug ] ) ) { |
|
1660
|
1660
|
if ( ! function_exists( 'plugins_api' ) ) { |
|
1661
|
|
- require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
|
|
1661
|
+ require_once ABSPATH.'wp-admin/includes/plugin-install.php'; |
|
1662
|
1662
|
} |
|
1663
|
1663
|
|
|
1664
|
1664
|
$response = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ) ) ); |
|
@@ -1666,7 +1666,7 @@ discard block |
|
|
block discarded – undo |
|
1666
|
1666
|
$api[ $slug ] = false; |
|
1667
|
1667
|
|
|
1668
|
1668
|
if ( is_wp_error( $response ) ) { |
|
1669
|
|
- wp_die( esc_html( $this->strings['oops'] ) ); |
|
|
1669
|
+ wp_die( esc_html( $this->strings[ 'oops' ] ) ); |
|
1670
|
1670
|
} else { |
|
1671
|
1671
|
$api[ $slug ] = $response; |
|
1672
|
1672
|
} |
|
@@ -1685,13 +1685,13 @@ discard block |
|
|
block discarded – undo |
|
1685
|
1685
|
* or the plugin name if not. |
|
1686
|
1686
|
*/ |
|
1687
|
1687
|
public function get_info_link( $slug ) { |
|
1688
|
|
- if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) { |
|
|
1688
|
+ if ( ! empty( $this->plugins[ $slug ][ 'external_url' ] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ][ 'external_url' ] ) ) { |
|
1689
|
1689
|
$link = sprintf( |
|
1690
|
1690
|
'<a href="%1$s" target="_blank">%2$s</a>', |
|
1691
|
|
- esc_url( $this->plugins[ $slug ]['external_url'] ), |
|
1692
|
|
- esc_html( $this->plugins[ $slug ]['name'] ) |
|
|
1691
|
+ esc_url( $this->plugins[ $slug ][ 'external_url' ] ), |
|
|
1692
|
+ esc_html( $this->plugins[ $slug ][ 'name' ] ) |
|
1693
|
1693
|
); |
|
1694
|
|
- } elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) { |
|
|
1694
|
+ } elseif ( 'repo' === $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1695
|
1695
|
$url = add_query_arg( |
|
1696
|
1696
|
array( |
|
1697
|
1697
|
'tab' => 'plugin-information', |
|
@@ -1706,10 +1706,10 @@ discard block |
|
|
block discarded – undo |
|
1706
|
1706
|
$link = sprintf( |
|
1707
|
1707
|
'<a href="%1$s" class="thickbox">%2$s</a>', |
|
1708
|
1708
|
esc_url( $url ), |
|
1709
|
|
- esc_html( $this->plugins[ $slug ]['name'] ) |
|
|
1709
|
+ esc_html( $this->plugins[ $slug ][ 'name' ] ) |
|
1710
|
1710
|
); |
|
1711
|
1711
|
} else { |
|
1712
|
|
- $link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink. |
|
|
1712
|
+ $link = esc_html( $this->plugins[ $slug ][ 'name' ] ); // No hyperlink. |
|
1713
|
1713
|
} |
|
1714
|
1714
|
|
|
1715
|
1715
|
return $link; |
|
@@ -1723,7 +1723,7 @@ discard block |
|
|
block discarded – undo |
|
1723
|
1723
|
* @return boolean True when on the TGMPA page, false otherwise. |
|
1724
|
1724
|
*/ |
|
1725
|
1725
|
protected function is_tgmpa_page() { |
|
1726
|
|
- return isset( $_GET['page'] ) && $this->menu === $_GET['page']; |
|
|
1726
|
+ return isset( $_GET[ 'page' ] ) && $this->menu === $_GET[ 'page' ]; |
|
1727
|
1727
|
} |
|
1728
|
1728
|
|
|
1729
|
1729
|
/** |
|
@@ -1744,10 +1744,10 @@ discard block |
|
|
block discarded – undo |
|
1744
|
1744
|
if ( 'update-core' === $screen->base ) { |
|
1745
|
1745
|
// Core update screen. |
|
1746
|
1746
|
return true; |
|
1747
|
|
- } elseif ( 'plugins' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok. |
|
|
1747
|
+ } elseif ( 'plugins' === $screen->base && ! empty( $_POST[ 'action' ] ) ) { // WPCS: CSRF ok. |
|
1748
|
1748
|
// Plugins bulk update screen. |
|
1749
|
1749
|
return true; |
|
1750
|
|
- } elseif ( 'update' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok. |
|
|
1750
|
+ } elseif ( 'update' === $screen->base && ! empty( $_POST[ 'action' ] ) ) { // WPCS: CSRF ok. |
|
1751
|
1751
|
// Individual updates (ajax call). |
|
1752
|
1752
|
return true; |
|
1753
|
1753
|
} |
|
@@ -1834,7 +1834,7 @@ discard block |
|
|
block discarded – undo |
|
1834
|
1834
|
public function is_plugin_installed( $slug ) { |
|
1835
|
1835
|
$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
|
1836
|
1836
|
|
|
1837
|
|
- return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) ); |
|
|
1837
|
+ return ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ] ) ); |
|
1838
|
1838
|
} |
|
1839
|
1839
|
|
|
1840
|
1840
|
/** |
|
@@ -1846,7 +1846,7 @@ discard block |
|
|
block discarded – undo |
|
1846
|
1846
|
* @return bool True if active, false otherwise. |
|
1847
|
1847
|
*/ |
|
1848
|
1848
|
public function is_plugin_active( $slug ) { |
|
1849
|
|
- return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) ); |
|
|
1849
|
+ return ( ( ! empty( $this->plugins[ $slug ][ 'is_callable' ] ) && is_callable( $this->plugins[ $slug ][ 'is_callable' ] ) ) || is_plugin_active( $this->plugins[ $slug ][ 'file_path' ] ) ); |
|
1850
|
1850
|
} |
|
1851
|
1851
|
|
|
1852
|
1852
|
/** |
|
@@ -1860,7 +1860,7 @@ discard block |
|
|
block discarded – undo |
|
1860
|
1860
|
*/ |
|
1861
|
1861
|
public function can_plugin_update( $slug ) { |
|
1862
|
1862
|
// We currently can't get reliable info on non-WP-repo plugins - issue #380. |
|
1863
|
|
- if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
|
1863
|
+ if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1864
|
1864
|
return true; |
|
1865
|
1865
|
} |
|
1866
|
1866
|
|
|
@@ -1916,8 +1916,8 @@ discard block |
|
|
block discarded – undo |
|
1916
|
1916
|
public function get_installed_version( $slug ) { |
|
1917
|
1917
|
$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
|
1918
|
1918
|
|
|
1919
|
|
- if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) { |
|
1920
|
|
- return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version']; |
|
|
1919
|
+ if ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ] ) ) { |
|
|
1920
|
+ return $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ]; |
|
1921
|
1921
|
} |
|
1922
|
1922
|
|
|
1923
|
1923
|
return ''; |
|
@@ -1933,7 +1933,7 @@ discard block |
|
|
block discarded – undo |
|
1933
|
1933
|
*/ |
|
1934
|
1934
|
public function does_plugin_require_update( $slug ) { |
|
1935
|
1935
|
$installed_version = $this->get_installed_version( $slug ); |
|
1936
|
|
- $minimum_version = $this->plugins[ $slug ]['version']; |
|
|
1936
|
+ $minimum_version = $this->plugins[ $slug ][ 'version' ]; |
|
1937
|
1937
|
|
|
1938
|
1938
|
return version_compare( $minimum_version, $installed_version, '>' ); |
|
1939
|
1939
|
} |
|
@@ -1948,9 +1948,9 @@ discard block |
|
|
block discarded – undo |
|
1948
|
1948
|
*/ |
|
1949
|
1949
|
public function does_plugin_have_update( $slug ) { |
|
1950
|
1950
|
// Presume bundled and external plugins will point to a package which meets the minimum required version. |
|
1951
|
|
- if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
|
1951
|
+ if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1952
|
1952
|
if ( $this->does_plugin_require_update( $slug ) ) { |
|
1953
|
|
- return $this->plugins[ $slug ]['version']; |
|
|
1953
|
+ return $this->plugins[ $slug ][ 'version' ]; |
|
1954
|
1954
|
} |
|
1955
|
1955
|
|
|
1956
|
1956
|
return false; |
|
@@ -1958,8 +1958,8 @@ discard block |
|
|
block discarded – undo |
|
1958
|
1958
|
|
|
1959
|
1959
|
$repo_updates = get_site_transient( 'update_plugins' ); |
|
1960
|
1960
|
|
|
1961
|
|
- if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) { |
|
1962
|
|
- return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version; |
|
|
1961
|
+ if ( isset( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version ) ) { |
|
|
1962
|
+ return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version; |
|
1963
|
1963
|
} |
|
1964
|
1964
|
|
|
1965
|
1965
|
return false; |
|
@@ -1975,14 +1975,14 @@ discard block |
|
|
block discarded – undo |
|
1975
|
1975
|
*/ |
|
1976
|
1976
|
public function get_upgrade_notice( $slug ) { |
|
1977
|
1977
|
// We currently can't get reliable info on non-WP-repo plugins - issue #380. |
|
1978
|
|
- if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
|
1978
|
+ if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1979
|
1979
|
return ''; |
|
1980
|
1980
|
} |
|
1981
|
1981
|
|
|
1982
|
1982
|
$repo_updates = get_site_transient( 'update_plugins' ); |
|
1983
|
1983
|
|
|
1984
|
|
- if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) { |
|
1985
|
|
- return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice; |
|
|
1984
|
+ if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice ) ) { |
|
|
1985
|
+ return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice; |
|
1986
|
1986
|
} |
|
1987
|
1987
|
|
|
1988
|
1988
|
return ''; |
|
@@ -1998,7 +1998,7 @@ discard block |
|
|
block discarded – undo |
|
1998
|
1998
|
*/ |
|
1999
|
1999
|
public function get_plugins( $plugin_folder = '' ) { |
|
2000
|
2000
|
if ( ! function_exists( 'get_plugins' ) ) { |
|
2001
|
|
- require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
|
2001
|
+ require_once ABSPATH.'wp-admin/includes/plugin.php'; |
|
2002
|
2002
|
} |
|
2003
|
2003
|
|
|
2004
|
2004
|
return get_plugins( $plugin_folder ); |
|
@@ -2013,7 +2013,7 @@ discard block |
|
|
block discarded – undo |
|
2013
|
2013
|
* @since 2.1.1 |
|
2014
|
2014
|
*/ |
|
2015
|
2015
|
public function update_dismiss() { |
|
2016
|
|
- delete_metadata( 'user', null, 'tgmpa_dismissed_notice_' . $this->id, null, true ); |
|
|
2016
|
+ delete_metadata( 'user', null, 'tgmpa_dismissed_notice_'.$this->id, null, true ); |
|
2017
|
2017
|
} |
|
2018
|
2018
|
|
|
2019
|
2019
|
/** |
|
@@ -2032,14 +2032,14 @@ discard block |
|
|
block discarded – undo |
|
2032
|
2032
|
*/ |
|
2033
|
2033
|
public function force_activation() { |
|
2034
|
2034
|
foreach ( $this->plugins as $slug => $plugin ) { |
|
2035
|
|
- if ( true === $plugin['force_activation'] ) { |
|
|
2035
|
+ if ( true === $plugin[ 'force_activation' ] ) { |
|
2036
|
2036
|
if ( ! $this->is_plugin_installed( $slug ) ) { |
|
2037
|
2037
|
// Oops, plugin isn't there so iterate to next condition. |
|
2038
|
2038
|
continue; |
|
2039
|
2039
|
} elseif ( $this->can_plugin_activate( $slug ) ) { |
|
2040
|
2040
|
// There we go, activate the plugin. |
|
2041
|
|
- activate_plugin( $plugin['file_path'] ); |
|
2042
|
|
- $this->force_activated_plugins[] = $slug; |
|
|
2041
|
+ activate_plugin( $plugin[ 'file_path' ] ); |
|
|
2042
|
+ $this->force_activated_plugins[ ] = $slug; |
|
2043
|
2043
|
} |
|
2044
|
2044
|
} |
|
2045
|
2045
|
} |
|
@@ -2060,8 +2060,8 @@ discard block |
|
|
block discarded – undo |
|
2060
|
2060
|
public function force_deactivation() { |
|
2061
|
2061
|
foreach ( $this->plugins as $slug => $plugin ) { |
|
2062
|
2062
|
// Only proceed forward if the parameter is set to true and plugin is active. |
|
2063
|
|
- if ( true === $plugin['force_deactivation'] && $this->is_plugin_active( $slug ) ) { |
|
2064
|
|
- deactivate_plugins( $plugin['file_path'] ); |
|
|
2063
|
+ if ( true === $plugin[ 'force_deactivation' ] && $this->is_plugin_active( $slug ) ) { |
|
|
2064
|
+ deactivate_plugins( $plugin[ 'file_path' ] ); |
|
2065
|
2065
|
} |
|
2066
|
2066
|
} |
|
2067
|
2067
|
} |
|
@@ -2102,7 +2102,7 @@ discard block |
|
|
block discarded – undo |
|
2102
|
2102
|
* Ensure only one instance of the class is ever invoked. |
|
2103
|
2103
|
*/ |
|
2104
|
2104
|
function load_tgm_plugin_activation() { |
|
2105
|
|
- $GLOBALS['tgmpa'] = TGM_Plugin_Activation::get_instance(); |
|
|
2105
|
+ $GLOBALS[ 'tgmpa' ] = TGM_Plugin_Activation::get_instance(); |
|
2106
|
2106
|
} |
|
2107
|
2107
|
} |
|
2108
|
2108
|
|
|
@@ -2124,7 +2124,7 @@ discard block |
|
|
block discarded – undo |
|
2124
|
2124
|
* @param array $config Optional. An array of configuration values. |
|
2125
|
2125
|
*/ |
|
2126
|
2126
|
function tgmpa( $plugins, $config = array() ) { |
|
2127
|
|
- $instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
|
2127
|
+ $instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
2128
|
2128
|
|
|
2129
|
2129
|
foreach ( $plugins as $plugin ) { |
|
2130
|
2130
|
call_user_func( array( $instance, 'register' ), $plugin ); |
|
@@ -2132,17 +2132,17 @@ discard block |
|
|
block discarded – undo |
|
2132
|
2132
|
|
|
2133
|
2133
|
if ( ! empty( $config ) && is_array( $config ) ) { |
|
2134
|
2134
|
// Send out notices for deprecated arguments passed. |
|
2135
|
|
- if ( isset( $config['notices'] ) ) { |
|
|
2135
|
+ if ( isset( $config[ 'notices' ] ) ) { |
|
2136
|
2136
|
_deprecated_argument( __FUNCTION__, '2.2.0', 'The `notices` config parameter was renamed to `has_notices` in TGMPA 2.2.0. Please adjust your configuration.' ); |
|
2137
|
|
- if ( ! isset( $config['has_notices'] ) ) { |
|
2138
|
|
- $config['has_notices'] = $config['notices']; |
|
|
2137
|
+ if ( ! isset( $config[ 'has_notices' ] ) ) { |
|
|
2138
|
+ $config[ 'has_notices' ] = $config[ 'notices' ]; |
|
2139
|
2139
|
} |
|
2140
|
2140
|
} |
|
2141
|
2141
|
|
|
2142
|
|
- if ( isset( $config['parent_menu_slug'] ) ) { |
|
|
2142
|
+ if ( isset( $config[ 'parent_menu_slug' ] ) ) { |
|
2143
|
2143
|
_deprecated_argument( __FUNCTION__, '2.4.0', 'The `parent_menu_slug` config parameter was removed in TGMPA 2.4.0. In TGMPA 2.5.0 an alternative was (re-)introduced. Please adjust your configuration. For more information visit the website: http://tgmpluginactivation.com/configuration/#h-configuration-options.' ); |
|
2144
|
2144
|
} |
|
2145
|
|
- if ( isset( $config['parent_url_slug'] ) ) { |
|
|
2145
|
+ if ( isset( $config[ 'parent_url_slug' ] ) ) { |
|
2146
|
2146
|
_deprecated_argument( __FUNCTION__, '2.4.0', 'The `parent_url_slug` config parameter was removed in TGMPA 2.4.0. In TGMPA 2.5.0 an alternative was (re-)introduced. Please adjust your configuration. For more information visit the website: http://tgmpluginactivation.com/configuration/#h-configuration-options.' ); |
|
2147
|
2147
|
} |
|
2148
|
2148
|
|
|
@@ -2158,7 +2158,7 @@ discard block |
|
|
block discarded – undo |
|
2158
|
2158
|
* @since 2.2.0 |
|
2159
|
2159
|
*/ |
|
2160
|
2160
|
if ( ! class_exists( 'WP_List_Table' ) ) { |
|
2161
|
|
- require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
|
2161
|
+ require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
2162
|
2162
|
} |
|
2163
|
2163
|
|
|
2164
|
2164
|
if ( ! class_exists( 'TGMPA_List_Table' ) ) { |
|
@@ -2219,7 +2219,7 @@ discard block |
|
|
block discarded – undo |
|
2219
|
2219
|
* @since 2.2.0 |
|
2220
|
2220
|
*/ |
|
2221
|
2221
|
public function __construct() { |
|
2222
|
|
- $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
|
2222
|
+ $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
2223
|
2223
|
|
|
2224
|
2224
|
parent::__construct( |
|
2225
|
2225
|
array( |
|
@@ -2229,8 +2229,8 @@ discard block |
|
|
block discarded – undo |
|
2229
|
2229
|
) |
|
2230
|
2230
|
); |
|
2231
|
2231
|
|
|
2232
|
|
- if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'install', 'update', 'activate' ), true ) ) { |
|
2233
|
|
- $this->view_context = sanitize_key( $_REQUEST['plugin_status'] ); |
|
|
2232
|
+ if ( isset( $_REQUEST[ 'plugin_status' ] ) && in_array( $_REQUEST[ 'plugin_status' ], array( 'install', 'update', 'activate' ), true ) ) { |
|
|
2233
|
+ $this->view_context = sanitize_key( $_REQUEST[ 'plugin_status' ] ); |
|
2234
|
2234
|
} |
|
2235
|
2235
|
|
|
2236
|
2236
|
add_filter( 'tgmpa_table_data_items', array( $this, 'sort_table_items' ) ); |
|
@@ -2277,20 +2277,20 @@ discard block |
|
|
block discarded – undo |
|
2277
|
2277
|
} |
|
2278
|
2278
|
|
|
2279
|
2279
|
foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) { |
|
2280
|
|
- $table_data[ $i ]['sanitized_plugin'] = $plugin['name']; |
|
2281
|
|
- $table_data[ $i ]['slug'] = $slug; |
|
2282
|
|
- $table_data[ $i ]['plugin'] = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>'; |
|
2283
|
|
- $table_data[ $i ]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] ); |
|
2284
|
|
- $table_data[ $i ]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] ); |
|
2285
|
|
- $table_data[ $i ]['status'] = $this->get_plugin_status_text( $slug ); |
|
2286
|
|
- $table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug ); |
|
2287
|
|
- $table_data[ $i ]['minimum_version'] = $plugin['version']; |
|
2288
|
|
- $table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
|
2280
|
+ $table_data[ $i ][ 'sanitized_plugin' ] = $plugin[ 'name' ]; |
|
|
2281
|
+ $table_data[ $i ][ 'slug' ] = $slug; |
|
|
2282
|
+ $table_data[ $i ][ 'plugin' ] = '<strong>'.$this->tgmpa->get_info_link( $slug ).'</strong>'; |
|
|
2283
|
+ $table_data[ $i ][ 'source' ] = $this->get_plugin_source_type_text( $plugin[ 'source_type' ] ); |
|
|
2284
|
+ $table_data[ $i ][ 'type' ] = $this->get_plugin_advise_type_text( $plugin[ 'required' ] ); |
|
|
2285
|
+ $table_data[ $i ][ 'status' ] = $this->get_plugin_status_text( $slug ); |
|
|
2286
|
+ $table_data[ $i ][ 'installed_version' ] = $this->tgmpa->get_installed_version( $slug ); |
|
|
2287
|
+ $table_data[ $i ][ 'minimum_version' ] = $plugin[ 'version' ]; |
|
|
2288
|
+ $table_data[ $i ][ 'available_version' ] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2289
|
2289
|
|
|
2290
|
2290
|
// Prep the upgrade notice info. |
|
2291
|
2291
|
$upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug ); |
|
2292
|
2292
|
if ( ! empty( $upgrade_notice ) ) { |
|
2293
|
|
- $table_data[ $i ]['upgrade_notice'] = $upgrade_notice; |
|
|
2293
|
+ $table_data[ $i ][ 'upgrade_notice' ] = $upgrade_notice; |
|
2294
|
2294
|
|
|
2295
|
2295
|
add_action( "tgmpa_after_plugin_row_$slug", array( $this, 'wp_plugin_update_row' ), 10, 2 ); |
|
2296
|
2296
|
} |
|
@@ -2321,17 +2321,17 @@ discard block |
|
|
block discarded – undo |
|
2321
|
2321
|
// No need to display plugins if they are installed, up-to-date and active. |
|
2322
|
2322
|
continue; |
|
2323
|
2323
|
} else { |
|
2324
|
|
- $plugins['all'][ $slug ] = $plugin; |
|
|
2324
|
+ $plugins[ 'all' ][ $slug ] = $plugin; |
|
2325
|
2325
|
|
|
2326
|
2326
|
if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) { |
|
2327
|
|
- $plugins['install'][ $slug ] = $plugin; |
|
|
2327
|
+ $plugins[ 'install' ][ $slug ] = $plugin; |
|
2328
|
2328
|
} else { |
|
2329
|
2329
|
if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) { |
|
2330
|
|
- $plugins['update'][ $slug ] = $plugin; |
|
|
2330
|
+ $plugins[ 'update' ][ $slug ] = $plugin; |
|
2331
|
2331
|
} |
|
2332
|
2332
|
|
|
2333
|
2333
|
if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
|
2334
|
|
- $plugins['activate'][ $slug ] = $plugin; |
|
|
2334
|
+ $plugins[ 'activate' ][ $slug ] = $plugin; |
|
2335
|
2335
|
} |
|
2336
|
2336
|
} |
|
2337
|
2337
|
} |
|
@@ -2451,8 +2451,8 @@ discard block |
|
|
block discarded – undo |
|
2451
|
2451
|
$name = array(); |
|
2452
|
2452
|
|
|
2453
|
2453
|
foreach ( $items as $i => $plugin ) { |
|
2454
|
|
- $type[ $i ] = $plugin['type']; // Required / recommended. |
|
2455
|
|
- $name[ $i ] = $plugin['sanitized_plugin']; |
|
|
2454
|
+ $type[ $i ] = $plugin[ 'type' ]; // Required / recommended. |
|
|
2455
|
+ $name[ $i ] = $plugin[ 'sanitized_plugin' ]; |
|
2456
|
2456
|
} |
|
2457
|
2457
|
|
|
2458
|
2458
|
array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items ); |
|
@@ -2538,9 +2538,9 @@ discard block |
|
|
block discarded – undo |
|
2538
|
2538
|
public function column_cb( $item ) { |
|
2539
|
2539
|
return sprintf( |
|
2540
|
2540
|
'<input type="checkbox" name="%1$s[]" value="%2$s" id="%3$s" />', |
|
2541
|
|
- esc_attr( $this->_args['singular'] ), |
|
2542
|
|
- esc_attr( $item['slug'] ), |
|
2543
|
|
- esc_attr( $item['sanitized_plugin'] ) |
|
|
2541
|
+ esc_attr( $this->_args[ 'singular' ] ), |
|
|
2542
|
+ esc_attr( $item[ 'slug' ] ), |
|
|
2543
|
+ esc_attr( $item[ 'sanitized_plugin' ] ) |
|
2544
|
2544
|
); |
|
2545
|
2545
|
} |
|
2546
|
2546
|
|
|
@@ -2555,7 +2555,7 @@ discard block |
|
|
block discarded – undo |
|
2555
|
2555
|
public function column_plugin( $item ) { |
|
2556
|
2556
|
return sprintf( |
|
2557
|
2557
|
'%1$s %2$s', |
|
2558
|
|
- $item['plugin'], |
|
|
2558
|
+ $item[ 'plugin' ], |
|
2559
|
2559
|
$this->row_actions( $this->get_row_actions( $item ), true ) |
|
2560
|
2560
|
); |
|
2561
|
2561
|
} |
|
@@ -2571,38 +2571,38 @@ discard block |
|
|
block discarded – undo |
|
2571
|
2571
|
public function column_version( $item ) { |
|
2572
|
2572
|
$output = array(); |
|
2573
|
2573
|
|
|
2574
|
|
- if ( $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
2575
|
|
- $installed = ! empty( $item['installed_version'] ) ? $item['installed_version'] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
|
2574
|
+ if ( $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
|
2575
|
+ $installed = ! empty( $item[ 'installed_version' ] ) ? $item[ 'installed_version' ] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
2576
|
2576
|
|
|
2577
|
2577
|
$color = ''; |
|
2578
|
|
- if ( ! empty( $item['minimum_version'] ) && $this->tgmpa->does_plugin_require_update( $item['slug'] ) ) { |
|
|
2578
|
+ if ( ! empty( $item[ 'minimum_version' ] ) && $this->tgmpa->does_plugin_require_update( $item[ 'slug' ] ) ) { |
|
2579
|
2579
|
$color = ' color: #ff0000; font-weight: bold;'; |
|
2580
|
2580
|
} |
|
2581
|
2581
|
|
|
2582
|
|
- $output[] = sprintf( |
|
2583
|
|
- '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Installed version:', 'tgmpa' ) . '</p>', |
|
|
2582
|
+ $output[ ] = sprintf( |
|
|
2583
|
+ '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Installed version:', 'tgmpa' ).'</p>', |
|
2584
|
2584
|
$color, |
|
2585
|
2585
|
$installed |
|
2586
|
2586
|
); |
|
2587
|
2587
|
} |
|
2588
|
2588
|
|
|
2589
|
|
- if ( ! empty( $item['minimum_version'] ) ) { |
|
2590
|
|
- $output[] = sprintf( |
|
2591
|
|
- '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>' . __( 'Minimum required version:', 'tgmpa' ) . '</p>', |
|
2592
|
|
- $item['minimum_version'] |
|
|
2589
|
+ if ( ! empty( $item[ 'minimum_version' ] ) ) { |
|
|
2590
|
+ $output[ ] = sprintf( |
|
|
2591
|
+ '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>'.__( 'Minimum required version:', 'tgmpa' ).'</p>', |
|
|
2592
|
+ $item[ 'minimum_version' ] |
|
2593
|
2593
|
); |
|
2594
|
2594
|
} |
|
2595
|
2595
|
|
|
2596
|
|
- if ( ! empty( $item['available_version'] ) ) { |
|
|
2596
|
+ if ( ! empty( $item[ 'available_version' ] ) ) { |
|
2597
|
2597
|
$color = ''; |
|
2598
|
|
- if ( ! empty( $item['minimum_version'] ) && version_compare( $item['available_version'], $item['minimum_version'], '>=' ) ) { |
|
|
2598
|
+ if ( ! empty( $item[ 'minimum_version' ] ) && version_compare( $item[ 'available_version' ], $item[ 'minimum_version' ], '>=' ) ) { |
|
2599
|
2599
|
$color = ' color: #71C671; font-weight: bold;'; |
|
2600
|
2600
|
} |
|
2601
|
2601
|
|
|
2602
|
|
- $output[] = sprintf( |
|
2603
|
|
- '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Available version:', 'tgmpa' ) . '</p>', |
|
|
2602
|
+ $output[ ] = sprintf( |
|
|
2603
|
+ '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Available version:', 'tgmpa' ).'</p>', |
|
2604
|
2604
|
$color, |
|
2605
|
|
- $item['available_version'] |
|
|
2605
|
+ $item[ 'available_version' ] |
|
2606
|
2606
|
); |
|
2607
|
2607
|
} |
|
2608
|
2608
|
|
|
@@ -2623,7 +2623,7 @@ discard block |
|
|
block discarded – undo |
|
2623
|
2623
|
* @since 2.2.0 |
|
2624
|
2624
|
*/ |
|
2625
|
2625
|
public function no_items() { |
|
2626
|
|
- echo esc_html__( 'No plugins to install, update or activate.', 'tgmpa' ) . ' <a href="' . esc_url( self_admin_url() ) . '"> ' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>'; |
|
|
2626
|
+ echo esc_html__( 'No plugins to install, update or activate.', 'tgmpa' ).' <a href="'.esc_url( self_admin_url() ).'"> '.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>'; |
|
2627
|
2627
|
echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
|
2628
|
2628
|
} |
|
2629
|
2629
|
|
|
@@ -2643,8 +2643,8 @@ discard block |
|
|
block discarded – undo |
|
2643
|
2643
|
); |
|
2644
|
2644
|
|
|
2645
|
2645
|
if ( 'all' === $this->view_context || 'update' === $this->view_context ) { |
|
2646
|
|
- $columns['version'] = __( 'Version', 'tgmpa' ); |
|
2647
|
|
- $columns['status'] = __( 'Status', 'tgmpa' ); |
|
|
2646
|
+ $columns[ 'version' ] = __( 'Version', 'tgmpa' ); |
|
|
2647
|
+ $columns[ 'status' ] = __( 'Status', 'tgmpa' ); |
|
2648
|
2648
|
} |
|
2649
|
2649
|
|
|
2650
|
2650
|
return apply_filters( 'tgmpa_table_columns', $columns ); |
|
@@ -2691,20 +2691,20 @@ discard block |
|
|
block discarded – undo |
|
2691
|
2691
|
$action_links = array(); |
|
2692
|
2692
|
|
|
2693
|
2693
|
// Display the 'Install' action link if the plugin is not yet available. |
|
2694
|
|
- if ( ! $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
|
2694
|
+ if ( ! $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
2695
|
2695
|
/* translators: %s: plugin name in screen reader markup */ |
|
2696
|
|
- $actions['install'] = __( 'Install %s', 'tgmpa' ); |
|
|
2696
|
+ $actions[ 'install' ] = __( 'Install %s', 'tgmpa' ); |
|
2697
|
2697
|
} else { |
|
2698
|
2698
|
// Display the 'Update' action link if an update is available and WP complies with plugin minimum. |
|
2699
|
|
- if ( false !== $this->tgmpa->does_plugin_have_update( $item['slug'] ) && $this->tgmpa->can_plugin_update( $item['slug'] ) ) { |
|
|
2699
|
+ if ( false !== $this->tgmpa->does_plugin_have_update( $item[ 'slug' ] ) && $this->tgmpa->can_plugin_update( $item[ 'slug' ] ) ) { |
|
2700
|
2700
|
/* translators: %s: plugin name in screen reader markup */ |
|
2701
|
|
- $actions['update'] = __( 'Update %s', 'tgmpa' ); |
|
|
2701
|
+ $actions[ 'update' ] = __( 'Update %s', 'tgmpa' ); |
|
2702
|
2702
|
} |
|
2703
|
2703
|
|
|
2704
|
2704
|
// Display the 'Activate' action link, but only if the plugin meets the minimum version. |
|
2705
|
|
- if ( $this->tgmpa->can_plugin_activate( $item['slug'] ) ) { |
|
|
2705
|
+ if ( $this->tgmpa->can_plugin_activate( $item[ 'slug' ] ) ) { |
|
2706
|
2706
|
/* translators: %s: plugin name in screen reader markup */ |
|
2707
|
|
- $actions['activate'] = __( 'Activate %s', 'tgmpa' ); |
|
|
2707
|
+ $actions[ 'activate' ] = __( 'Activate %s', 'tgmpa' ); |
|
2708
|
2708
|
} |
|
2709
|
2709
|
} |
|
2710
|
2710
|
|
|
@@ -2713,24 +2713,24 @@ discard block |
|
|
block discarded – undo |
|
2713
|
2713
|
$nonce_url = wp_nonce_url( |
|
2714
|
2714
|
add_query_arg( |
|
2715
|
2715
|
array( |
|
2716
|
|
- 'plugin' => urlencode( $item['slug'] ), |
|
2717
|
|
- 'tgmpa-' . $action => $action . '-plugin', |
|
|
2716
|
+ 'plugin' => urlencode( $item[ 'slug' ] ), |
|
|
2717
|
+ 'tgmpa-'.$action => $action.'-plugin', |
|
2718
|
2718
|
), |
|
2719
|
2719
|
$this->tgmpa->get_tgmpa_url() |
|
2720
|
2720
|
), |
|
2721
|
|
- 'tgmpa-' . $action, |
|
|
2721
|
+ 'tgmpa-'.$action, |
|
2722
|
2722
|
'tgmpa-nonce' |
|
2723
|
2723
|
); |
|
2724
|
2724
|
|
|
2725
|
2725
|
$action_links[ $action ] = sprintf( |
|
2726
|
|
- '<a href="%1$s">' . esc_html( $text ) . '</a>', |
|
|
2726
|
+ '<a href="%1$s">'.esc_html( $text ).'</a>', |
|
2727
|
2727
|
esc_url( $nonce_url ), |
|
2728
|
|
- '<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>' |
|
|
2728
|
+ '<span class="screen-reader-text">'.esc_html( $item[ 'sanitized_plugin' ] ).'</span>' |
|
2729
|
2729
|
); |
|
2730
|
2730
|
} |
|
2731
|
2731
|
|
|
2732
|
2732
|
$prefix = ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) ? 'network_admin_' : ''; |
|
2733
|
|
- return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item['slug'], $item, $this->view_context ); |
|
|
2733
|
+ return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item[ 'slug' ], $item, $this->view_context ); |
|
2734
|
2734
|
} |
|
2735
|
2735
|
|
|
2736
|
2736
|
/** |
|
@@ -2751,7 +2751,7 @@ discard block |
|
|
block discarded – undo |
|
2751
|
2751
|
* |
|
2752
|
2752
|
* @since 2.5.0 |
|
2753
|
2753
|
*/ |
|
2754
|
|
- do_action( "tgmpa_after_plugin_row_{$item['slug']}", $item['slug'], $item, $this->view_context ); |
|
|
2754
|
+ do_action( "tgmpa_after_plugin_row_{$item[ 'slug' ]}", $item[ 'slug' ], $item, $this->view_context ); |
|
2755
|
2755
|
} |
|
2756
|
2756
|
|
|
2757
|
2757
|
/** |
|
@@ -2766,7 +2766,7 @@ discard block |
|
|
block discarded – undo |
|
2766
|
2766
|
* @return null Return early if upgrade notice is empty. |
|
2767
|
2767
|
*/ |
|
2768
|
2768
|
public function wp_plugin_update_row( $slug, $item ) { |
|
2769
|
|
- if ( empty( $item['upgrade_notice'] ) ) { |
|
|
2769
|
+ if ( empty( $item[ 'upgrade_notice' ] ) ) { |
|
2770
|
2770
|
return; |
|
2771
|
2771
|
} |
|
2772
|
2772
|
|
|
@@ -2775,7 +2775,7 @@ discard block |
|
|
block discarded – undo |
|
2775
|
2775
|
<td colspan="', absint( $this->get_column_count() ), '" class="plugin-update colspanchange"> |
|
2776
|
2776
|
<div class="update-message">', |
|
2777
|
2777
|
esc_html__( 'Upgrade message from the plugin author:', 'tgmpa' ), |
|
2778
|
|
- ' <strong>', wp_kses_data( $item['upgrade_notice'] ), '</strong> |
|
|
2778
|
+ ' <strong>', wp_kses_data( $item[ 'upgrade_notice' ] ), '</strong> |
|
2779
|
2779
|
</div> |
|
2780
|
2780
|
</td> |
|
2781
|
2781
|
</tr>'; |
|
@@ -2807,16 +2807,16 @@ discard block |
|
|
block discarded – undo |
|
2807
|
2807
|
|
|
2808
|
2808
|
if ( 'update' !== $this->view_context && 'activate' !== $this->view_context ) { |
|
2809
|
2809
|
if ( current_user_can( 'install_plugins' ) ) { |
|
2810
|
|
- $actions['tgmpa-bulk-install'] = __( 'Install', 'tgmpa' ); |
|
|
2810
|
+ $actions[ 'tgmpa-bulk-install' ] = __( 'Install', 'tgmpa' ); |
|
2811
|
2811
|
} |
|
2812
|
2812
|
} |
|
2813
|
2813
|
|
|
2814
|
2814
|
if ( 'install' !== $this->view_context ) { |
|
2815
|
2815
|
if ( current_user_can( 'update_plugins' ) ) { |
|
2816
|
|
- $actions['tgmpa-bulk-update'] = __( 'Update', 'tgmpa' ); |
|
|
2816
|
+ $actions[ 'tgmpa-bulk-update' ] = __( 'Update', 'tgmpa' ); |
|
2817
|
2817
|
} |
|
2818
|
2818
|
if ( current_user_can( 'activate_plugins' ) ) { |
|
2819
|
|
- $actions['tgmpa-bulk-activate'] = __( 'Activate', 'tgmpa' ); |
|
|
2819
|
+ $actions[ 'tgmpa-bulk-activate' ] = __( 'Activate', 'tgmpa' ); |
|
2820
|
2820
|
} |
|
2821
|
2821
|
} |
|
2822
|
2822
|
|
|
@@ -2835,7 +2835,7 @@ discard block |
|
|
block discarded – undo |
|
2835
|
2835
|
// Bulk installation process. |
|
2836
|
2836
|
if ( 'tgmpa-bulk-install' === $this->current_action() || 'tgmpa-bulk-update' === $this->current_action() ) { |
|
2837
|
2837
|
|
|
2838
|
|
- check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
|
2838
|
+ check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2839
|
2839
|
|
|
2840
|
2840
|
$install_type = 'install'; |
|
2841
|
2841
|
if ( 'tgmpa-bulk-update' === $this->current_action() ) { |
|
@@ -2845,7 +2845,7 @@ discard block |
|
|
block discarded – undo |
|
2845
|
2845
|
$plugins_to_install = array(); |
|
2846
|
2846
|
|
|
2847
|
2847
|
// Did user actually select any plugins to install/update ? |
|
2848
|
|
- if ( empty( $_POST['plugin'] ) ) { |
|
|
2848
|
+ if ( empty( $_POST[ 'plugin' ] ) ) { |
|
2849
|
2849
|
if ( 'install' === $install_type ) { |
|
2850
|
2850
|
$message = __( 'No plugins were selected to be installed. No action taken.', 'tgmpa' ); |
|
2851
|
2851
|
} else { |
|
@@ -2857,11 +2857,11 @@ discard block |
|
|
block discarded – undo |
|
2857
|
2857
|
return false; |
|
2858
|
2858
|
} |
|
2859
|
2859
|
|
|
2860
|
|
- if ( is_array( $_POST['plugin'] ) ) { |
|
2861
|
|
- $plugins_to_install = (array) $_POST['plugin']; |
|
2862
|
|
- } elseif ( is_string( $_POST['plugin'] ) ) { |
|
|
2860
|
+ if ( is_array( $_POST[ 'plugin' ] ) ) { |
|
|
2861
|
+ $plugins_to_install = (array) $_POST[ 'plugin' ]; |
|
|
2862
|
+ } elseif ( is_string( $_POST[ 'plugin' ] ) ) { |
|
2863
|
2863
|
// Received via Filesystem page - un-flatten array (WP bug #19643). |
|
2864
|
|
- $plugins_to_install = explode( ',', $_POST['plugin'] ); |
|
|
2864
|
+ $plugins_to_install = explode( ',', $_POST[ 'plugin' ] ); |
|
2865
|
2865
|
} |
|
2866
|
2866
|
|
|
2867
|
2867
|
// Sanitize the received input. |
|
@@ -2903,11 +2903,11 @@ discard block |
|
|
block discarded – undo |
|
2903
|
2903
|
// Pass all necessary information if WP_Filesystem is needed. |
|
2904
|
2904
|
$url = wp_nonce_url( |
|
2905
|
2905
|
$this->tgmpa->get_tgmpa_url(), |
|
2906
|
|
- 'bulk-' . $this->_args['plural'] |
|
|
2906
|
+ 'bulk-'.$this->_args[ 'plural' ] |
|
2907
|
2907
|
); |
|
2908
|
2908
|
|
|
2909
|
2909
|
// Give validated data back to $_POST which is the only place the filesystem looks for extra fields. |
|
2910
|
|
- $_POST['plugin'] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
|
2910
|
+ $_POST[ 'plugin' ] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
2911
|
2911
|
|
|
2912
|
2912
|
$method = ''; // Leave blank so WP_Filesystem can populate it as necessary. |
|
2913
|
2913
|
$fields = array_keys( $_POST ); // Extra fields to pass to WP_Filesystem. |
|
@@ -2934,22 +2934,22 @@ discard block |
|
|
block discarded – undo |
|
2934
|
2934
|
|
|
2935
|
2935
|
// Prepare the data for validated plugins for the install/upgrade. |
|
2936
|
2936
|
foreach ( $plugins_to_install as $slug ) { |
|
2937
|
|
- $name = $this->tgmpa->plugins[ $slug ]['name']; |
|
|
2937
|
+ $name = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
2938
|
2938
|
$source = $this->tgmpa->get_download_url( $slug ); |
|
2939
|
2939
|
|
|
2940
|
2940
|
if ( ! empty( $name ) && ! empty( $source ) ) { |
|
2941
|
|
- $names[] = $name; |
|
|
2941
|
+ $names[ ] = $name; |
|
2942
|
2942
|
|
|
2943
|
2943
|
switch ( $install_type ) { |
|
2944
|
2944
|
|
|
2945
|
2945
|
case 'install': |
|
2946
|
|
- $sources[] = $source; |
|
|
2946
|
+ $sources[ ] = $source; |
|
2947
|
2947
|
break; |
|
2948
|
2948
|
|
|
2949
|
2949
|
case 'update': |
|
2950
|
|
- $file_paths[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
|
2950
|
+ $file_paths[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
2951
|
2951
|
$to_inject[ $slug ] = $this->tgmpa->plugins[ $slug ]; |
|
2952
|
|
- $to_inject[ $slug ]['source'] = $source; |
|
|
2952
|
+ $to_inject[ $slug ][ 'source' ] = $source; |
|
2953
|
2953
|
break; |
|
2954
|
2954
|
} |
|
2955
|
2955
|
} |
|
@@ -2961,7 +2961,7 @@ discard block |
|
|
block discarded – undo |
|
2961
|
2961
|
new TGMPA_Bulk_Installer_Skin( |
|
2962
|
2962
|
array( |
|
2963
|
2963
|
'url' => esc_url_raw( $this->tgmpa->get_tgmpa_url() ), |
|
2964
|
|
- 'nonce' => 'bulk-' . $this->_args['plural'], |
|
|
2964
|
+ 'nonce' => 'bulk-'.$this->_args[ 'plural' ], |
|
2965
|
2965
|
'names' => $names, |
|
2966
|
2966
|
'install_type' => $install_type, |
|
2967
|
2967
|
) |
|
@@ -2994,10 +2994,10 @@ discard block |
|
|
block discarded – undo |
|
2994
|
2994
|
|
|
2995
|
2995
|
// Bulk activation process. |
|
2996
|
2996
|
if ( 'tgmpa-bulk-activate' === $this->current_action() ) { |
|
2997
|
|
- check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
|
2997
|
+ check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2998
|
2998
|
|
|
2999
|
2999
|
// Did user actually select any plugins to activate ? |
|
3000
|
|
- if ( empty( $_POST['plugin'] ) ) { |
|
|
3000
|
+ if ( empty( $_POST[ 'plugin' ] ) ) { |
|
3001
|
3001
|
echo '<div id="message" class="error"><p>', esc_html__( 'No plugins were selected to be activated. No action taken.', 'tgmpa' ), '</p></div>'; |
|
3002
|
3002
|
|
|
3003
|
3003
|
return false; |
|
@@ -3005,8 +3005,8 @@ discard block |
|
|
block discarded – undo |
|
3005
|
3005
|
|
|
3006
|
3006
|
// Grab plugin data from $_POST. |
|
3007
|
3007
|
$plugins = array(); |
|
3008
|
|
- if ( isset( $_POST['plugin'] ) ) { |
|
3009
|
|
- $plugins = array_map( 'urldecode', (array) $_POST['plugin'] ); |
|
|
3008
|
+ if ( isset( $_POST[ 'plugin' ] ) ) { |
|
|
3009
|
+ $plugins = array_map( 'urldecode', (array) $_POST[ 'plugin' ] ); |
|
3010
|
3010
|
$plugins = array_map( array( $this->tgmpa, 'sanitize_key' ), $plugins ); |
|
3011
|
3011
|
} |
|
3012
|
3012
|
|
|
@@ -3016,8 +3016,8 @@ discard block |
|
|
block discarded – undo |
|
3016
|
3016
|
// Grab the file paths for the selected & inactive plugins from the registration array. |
|
3017
|
3017
|
foreach ( $plugins as $slug ) { |
|
3018
|
3018
|
if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
|
3019
|
|
- $plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
3020
|
|
- $plugin_names[] = $this->tgmpa->plugins[ $slug ]['name']; |
|
|
3019
|
+ $plugins_to_activate[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
|
3020
|
+ $plugin_names[ ] = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
3021
|
3021
|
} |
|
3022
|
3022
|
} |
|
3023
|
3023
|
unset( $slug ); |
|
@@ -3038,7 +3038,7 @@ discard block |
|
|
block discarded – undo |
|
3038
|
3038
|
$count = count( $plugin_names ); // Count so we can use _n function. |
|
3039
|
3039
|
$plugin_names = array_map( array( 'TGMPA_Utils', 'wrap_in_strong' ), $plugin_names ); |
|
3040
|
3040
|
$last_plugin = array_pop( $plugin_names ); // Pop off last name to prep for readability. |
|
3041
|
|
- $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
|
3041
|
+ $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); |
|
3042
|
3042
|
|
|
3043
|
3043
|
printf( // WPCS: xss ok. |
|
3044
|
3044
|
'<div id="message" class="updated"><p>%1$s %2$s.</p></div>', |
|
@@ -3141,16 +3141,16 @@ discard block |
|
|
block discarded – undo |
|
3141
|
3141
|
*/ |
|
3142
|
3142
|
function tgmpa_load_bulk_installer() { |
|
3143
|
3143
|
// Silently fail if 2.5+ is loaded *after* an older version. |
|
3144
|
|
- if ( ! isset( $GLOBALS['tgmpa'] ) ) { |
|
|
3144
|
+ if ( ! isset( $GLOBALS[ 'tgmpa' ] ) ) { |
|
3145
|
3145
|
return; |
|
3146
|
3146
|
} |
|
3147
|
3147
|
|
|
3148
|
3148
|
// Get TGMPA class instance. |
|
3149
|
|
- $tgmpa_instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
|
3149
|
+ $tgmpa_instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3150
|
3150
|
|
|
3151
|
|
- if ( isset( $_GET['page'] ) && $tgmpa_instance->menu === $_GET['page'] ) { |
|
|
3151
|
+ if ( isset( $_GET[ 'page' ] ) && $tgmpa_instance->menu === $_GET[ 'page' ] ) { |
|
3152
|
3152
|
if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
|
3153
|
|
- require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
|
3153
|
+ require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
3154
|
3154
|
} |
|
3155
|
3155
|
|
|
3156
|
3156
|
if ( ! class_exists( 'TGMPA_Bulk_Installer' ) ) { |
|
@@ -3217,11 +3217,11 @@ discard block |
|
|
block discarded – undo |
|
3217
|
3217
|
*/ |
|
3218
|
3218
|
public function __construct( $skin = null ) { |
|
3219
|
3219
|
// Get TGMPA class instance. |
|
3220
|
|
- $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
|
3220
|
+ $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3221
|
3221
|
|
|
3222
|
3222
|
parent::__construct( $skin ); |
|
3223
|
3223
|
|
|
3224
|
|
- if ( isset( $this->skin->options['install_type'] ) && 'update' === $this->skin->options['install_type'] ) { |
|
|
3224
|
+ if ( isset( $this->skin->options[ 'install_type' ] ) && 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3225
|
3225
|
$this->clear_destination = true; |
|
3226
|
3226
|
} |
|
3227
|
3227
|
|
|
@@ -3238,8 +3238,8 @@ discard block |
|
|
block discarded – undo |
|
3238
|
3238
|
* @since 2.2.0 |
|
3239
|
3239
|
*/ |
|
3240
|
3240
|
public function activate_strings() { |
|
3241
|
|
- $this->strings['activation_failed'] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
3242
|
|
- $this->strings['activation_success'] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
|
3241
|
+ $this->strings[ 'activation_failed' ] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
|
3242
|
+ $this->strings[ 'activation_success' ] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
3243
|
3243
|
} |
|
3244
|
3244
|
|
|
3245
|
3245
|
/** |
|
@@ -3257,7 +3257,7 @@ discard block |
|
|
block discarded – undo |
|
3257
|
3257
|
|
|
3258
|
3258
|
// Reset the strings in case we changed one during automatic activation. |
|
3259
|
3259
|
if ( $this->tgmpa->is_automatic ) { |
|
3260
|
|
- if ( 'update' === $this->skin->options['install_type'] ) { |
|
|
3260
|
+ if ( 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3261
|
3261
|
$this->upgrade_strings(); |
|
3262
|
3262
|
} else { |
|
3263
|
3263
|
$this->install_strings(); |
|
@@ -3415,7 +3415,7 @@ discard block |
|
|
block discarded – undo |
|
3415
|
3415
|
remove_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 ); |
|
3416
|
3416
|
|
|
3417
|
3417
|
// Force refresh of plugin update information. |
|
3418
|
|
- wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); |
|
|
3418
|
+ wp_clean_plugins_cache( $parsed_args[ 'clear_update_cache' ] ); |
|
3419
|
3419
|
|
|
3420
|
3420
|
return $results; |
|
3421
|
3421
|
} |
|
@@ -3466,13 +3466,13 @@ discard block |
|
|
block discarded – undo |
|
3466
|
3466
|
$activate = activate_plugin( $plugin_info ); |
|
3467
|
3467
|
|
|
3468
|
3468
|
// Adjust the success string based on the activation result. |
|
3469
|
|
- $this->strings['process_success'] = $this->strings['process_success'] . "<br />\n"; |
|
|
3469
|
+ $this->strings[ 'process_success' ] = $this->strings[ 'process_success' ]."<br />\n"; |
|
3470
|
3470
|
|
|
3471
|
3471
|
if ( is_wp_error( $activate ) ) { |
|
3472
|
3472
|
$this->skin->error( $activate ); |
|
3473
|
|
- $this->strings['process_success'] .= $this->strings['activation_failed']; |
|
|
3473
|
+ $this->strings[ 'process_success' ] .= $this->strings[ 'activation_failed' ]; |
|
3474
|
3474
|
} else { |
|
3475
|
|
- $this->strings['process_success'] .= $this->strings['activation_success']; |
|
|
3475
|
+ $this->strings[ 'process_success' ] .= $this->strings[ 'activation_success' ]; |
|
3476
|
3476
|
} |
|
3477
|
3477
|
} |
|
3478
|
3478
|
} |
|
@@ -3548,7 +3548,7 @@ discard block |
|
|
block discarded – undo |
|
3548
|
3548
|
*/ |
|
3549
|
3549
|
public function __construct( $args = array() ) { |
|
3550
|
3550
|
// Get TGMPA class instance. |
|
3551
|
|
- $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
|
3551
|
+ $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3552
|
3552
|
|
|
3553
|
3553
|
// Parse default and new args. |
|
3554
|
3554
|
$defaults = array( |
|
@@ -3557,10 +3557,10 @@ discard block |
|
|
block discarded – undo |
|
3557
|
3557
|
'names' => array(), |
|
3558
|
3558
|
'install_type' => 'install', |
|
3559
|
3559
|
); |
|
3560
|
|
- $args = wp_parse_args( $args, $defaults ); |
|
|
3560
|
+ $args = wp_parse_args( $args, $defaults ); |
|
3561
|
3561
|
|
|
3562
|
3562
|
// Set plugin names to $this->plugin_names property. |
|
3563
|
|
- $this->plugin_names = $args['names']; |
|
|
3563
|
+ $this->plugin_names = $args[ 'names' ]; |
|
3564
|
3564
|
|
|
3565
|
3565
|
// Extract the new args. |
|
3566
|
3566
|
parent::__construct( $args ); |
|
@@ -3575,32 +3575,32 @@ discard block |
|
|
block discarded – undo |
|
3575
|
3575
|
* @since 2.2.0 |
|
3576
|
3576
|
*/ |
|
3577
|
3577
|
public function add_strings() { |
|
3578
|
|
- if ( 'update' === $this->options['install_type'] ) { |
|
|
3578
|
+ if ( 'update' === $this->options[ 'install_type' ] ) { |
|
3579
|
3579
|
parent::add_strings(); |
|
3580
|
3580
|
/* translators: 1: plugin name, 2: action number 3: total number of actions. */ |
|
3581
|
|
- $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
|
3581
|
+ $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3582
|
3582
|
} else { |
|
3583
|
3583
|
/* translators: 1: plugin name, 2: error message. */ |
|
3584
|
|
- $this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
|
3584
|
+ $this->upgrader->strings[ 'skin_update_failed_error' ] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
3585
|
3585
|
/* translators: 1: plugin name. */ |
|
3586
|
|
- $this->upgrader->strings['skin_update_failed'] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
|
3586
|
+ $this->upgrader->strings[ 'skin_update_failed' ] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
3587
|
3587
|
|
|
3588
|
3588
|
if ( $this->tgmpa->is_automatic ) { |
|
3589
|
3589
|
// Automatic activation strings. |
|
3590
|
|
- $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' ); |
|
|
3590
|
+ $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' ); |
|
3591
|
3591
|
/* translators: 1: plugin name. */ |
|
3592
|
|
- $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>'; |
|
3593
|
|
- $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
|
3592
|
+ $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>'; |
|
|
3593
|
+ $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
3594
|
3594
|
/* translators: 1: plugin name, 2: action number 3: total number of actions. */ |
|
3595
|
|
- $this->upgrader->strings['skin_before_update_header'] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
|
3595
|
+ $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3596
|
3596
|
} else { |
|
3597
|
3597
|
// Default installation strings. |
|
3598
|
|
- $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' ); |
|
|
3598
|
+ $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' ); |
|
3599
|
3599
|
/* translators: 1: plugin name. */ |
|
3600
|
|
- $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>'; |
|
3601
|
|
- $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations have been completed.', 'tgmpa' ); |
|
|
3600
|
+ $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>'; |
|
|
3601
|
+ $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations have been completed.', 'tgmpa' ); |
|
3602
|
3602
|
/* translators: 1: plugin name, 2: action number 3: total number of actions. */ |
|
3603
|
|
- $this->upgrader->strings['skin_before_update_header'] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
|
3603
|
+ $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3604
|
3604
|
} |
|
3605
|
3605
|
} |
|
3606
|
3606
|
} |
|
@@ -3658,12 +3658,12 @@ discard block |
|
|
block discarded – undo |
|
3658
|
3658
|
if ( $this->tgmpa->is_tgmpa_complete() ) { |
|
3659
|
3659
|
// All plugins are active, so we display the complete string and hide the menu to protect users. |
|
3660
|
3660
|
echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
|
3661
|
|
- $update_actions['dashboard'] = sprintf( |
|
3662
|
|
- esc_html( $this->tgmpa->strings['complete'] ), |
|
3663
|
|
- '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' |
|
|
3661
|
+ $update_actions[ 'dashboard' ] = sprintf( |
|
|
3662
|
+ esc_html( $this->tgmpa->strings[ 'complete' ] ), |
|
|
3663
|
+ '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' |
|
3664
|
3664
|
); |
|
3665
|
3665
|
} else { |
|
3666
|
|
- $update_actions['tgmpa_page'] = '<a href="' . esc_url( $this->tgmpa->get_tgmpa_url() ) . '" target="_parent">' . esc_html( $this->tgmpa->strings['return'] ) . '</a>'; |
|
|
3666
|
+ $update_actions[ 'tgmpa_page' ] = '<a href="'.esc_url( $this->tgmpa->get_tgmpa_url() ).'" target="_parent">'.esc_html( $this->tgmpa->strings[ 'return' ] ).'</a>'; |
|
3667
|
3667
|
} |
|
3668
|
3668
|
|
|
3669
|
3669
|
/** |
|
@@ -3753,7 +3753,7 @@ discard block |
|
|
block discarded – undo |
|
3753
|
3753
|
* @return string |
|
3754
|
3754
|
*/ |
|
3755
|
3755
|
public static function wrap_in_em( $string ) { |
|
3756
|
|
- return '<em>' . wp_kses_post( $string ) . '</em>'; |
|
|
3756
|
+ return '<em>'.wp_kses_post( $string ).'</em>'; |
|
3757
|
3757
|
} |
|
3758
|
3758
|
|
|
3759
|
3759
|
/** |
|
@@ -3767,7 +3767,7 @@ discard block |
|
|
block discarded – undo |
|
3767
|
3767
|
* @return string |
|
3768
|
3768
|
*/ |
|
3769
|
3769
|
public static function wrap_in_strong( $string ) { |
|
3770
|
|
- return '<strong>' . wp_kses_post( $string ) . '</strong>'; |
|
|
3770
|
+ return '<strong>'.wp_kses_post( $string ).'</strong>'; |
|
3771
|
3771
|
} |
|
3772
|
3772
|
|
|
3773
|
3773
|
/** |
|
@@ -3804,7 +3804,7 @@ discard block |
|
|
block discarded – undo |
|
3804
|
3804
|
*/ |
|
3805
|
3805
|
protected static function emulate_filter_bool( $value ) { |
|
3806
|
3806
|
// @codingStandardsIgnoreStart |
|
3807
|
|
- static $true = array( |
|
|
3807
|
+ static $true = array( |
|
3808
|
3808
|
'1', |
|
3809
|
3809
|
'true', 'True', 'TRUE', |
|
3810
|
3810
|
'y', 'Y', |