|
@@ -255,7 +255,7 @@ discard block |
|
|
block discarded – undo |
|
255
|
255
|
*/ |
|
256
|
256
|
public function __construct() { |
|
257
|
257
|
// Set the current WordPress version. |
|
258
|
|
- $this->wp_version = $GLOBALS['wp_version']; |
|
|
258
|
+ $this->wp_version = $GLOBALS[ 'wp_version' ]; |
|
259
|
259
|
|
|
260
|
260
|
// Announce that the class is ready, and pass the object (for advanced use). |
|
261
|
261
|
do_action_ref_array( 'tgmpa_init', array( $this ) ); |
|
@@ -470,10 +470,10 @@ discard block |
|
|
block discarded – undo |
|
470
|
470
|
if ( false !== strpos( __FILE__, WP_PLUGIN_DIR ) || false !== strpos( __FILE__, WPMU_PLUGIN_DIR ) ) { |
|
471
|
471
|
// Plugin, we'll need to adjust the file name. |
|
472
|
472
|
add_action( 'load_textdomain_mofile', array( $this, 'correct_plugin_mofile' ), 10, 2 ); |
|
473
|
|
- load_theme_textdomain( 'tgmpa', dirname( __FILE__ ) . '/languages' ); |
|
|
473
|
+ load_theme_textdomain( 'tgmpa', dirname( __FILE__ ).'/languages' ); |
|
474
|
474
|
remove_action( 'load_textdomain_mofile', array( $this, 'correct_plugin_mofile' ), 10 ); |
|
475
|
475
|
} else { |
|
476
|
|
- load_theme_textdomain( 'tgmpa', dirname( __FILE__ ) . '/languages' ); |
|
|
476
|
+ load_theme_textdomain( 'tgmpa', dirname( __FILE__ ).'/languages' ); |
|
477
|
477
|
} |
|
478
|
478
|
} |
|
479
|
479
|
|
|
@@ -546,15 +546,15 @@ discard block |
|
|
block discarded – undo |
|
546
|
546
|
public function add_plugin_action_link_filters() { |
|
547
|
547
|
foreach ( $this->plugins as $slug => $plugin ) { |
|
548
|
548
|
if ( false === $this->can_plugin_activate( $slug ) ) { |
|
549
|
|
- add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_activate' ), 20 ); |
|
|
549
|
+ add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_activate' ), 20 ); |
|
550
|
550
|
} |
|
551
|
551
|
|
|
552
|
|
- if ( true === $plugin['force_activation'] ) { |
|
553
|
|
- add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_deactivate' ), 20 ); |
|
|
552
|
+ if ( true === $plugin[ 'force_activation' ] ) { |
|
|
553
|
+ add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_deactivate' ), 20 ); |
|
554
|
554
|
} |
|
555
|
555
|
|
|
556
|
556
|
if ( false !== $this->does_plugin_require_update( $slug ) ) { |
|
557
|
|
- add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_update' ), 20 ); |
|
|
557
|
+ add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_update' ), 20 ); |
|
558
|
558
|
} |
|
559
|
559
|
} |
|
560
|
560
|
} |
|
@@ -569,7 +569,7 @@ discard block |
|
|
block discarded – undo |
|
569
|
569
|
* @return array |
|
570
|
570
|
*/ |
|
571
|
571
|
public function filter_plugin_action_links_activate( $actions ) { |
|
572
|
|
- unset( $actions['activate'] ); |
|
|
572
|
+ unset( $actions[ 'activate' ] ); |
|
573
|
573
|
|
|
574
|
574
|
return $actions; |
|
575
|
575
|
} |
|
@@ -583,7 +583,7 @@ discard block |
|
|
block discarded – undo |
|
583
|
583
|
* @return array |
|
584
|
584
|
*/ |
|
585
|
585
|
public function filter_plugin_action_links_deactivate( $actions ) { |
|
586
|
|
- unset( $actions['deactivate'] ); |
|
|
586
|
+ unset( $actions[ 'deactivate' ] ); |
|
587
|
587
|
|
|
588
|
588
|
return $actions; |
|
589
|
589
|
} |
|
@@ -598,7 +598,7 @@ discard block |
|
|
block discarded – undo |
|
598
|
598
|
* @return array |
|
599
|
599
|
*/ |
|
600
|
600
|
public function filter_plugin_action_links_update( $actions ) { |
|
601
|
|
- $actions['update'] = sprintf( |
|
|
601
|
+ $actions[ 'update' ] = sprintf( |
|
602
|
602
|
'<a href="%1$s" title="%2$s" class="edit">%3$s</a>', |
|
603
|
603
|
esc_url( $this->get_tgmpa_status_url( 'update' ) ), |
|
604
|
604
|
esc_attr__( 'This plugin needs to be updated to be compatible with your theme.', 'tgmpa' ), |
|
@@ -636,9 +636,9 @@ discard block |
|
|
block discarded – undo |
|
636
|
636
|
return; |
|
637
|
637
|
} |
|
638
|
638
|
|
|
639
|
|
- if ( isset( $_REQUEST['tab'] ) && 'plugin-information' === $_REQUEST['tab'] ) { |
|
|
639
|
+ if ( isset( $_REQUEST[ 'tab' ] ) && 'plugin-information' === $_REQUEST[ 'tab' ] ) { |
|
640
|
640
|
// Needed for install_plugin_information(). |
|
641
|
|
- require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
|
|
641
|
+ require_once ABSPATH.'wp-admin/includes/plugin-install.php'; |
|
642
|
642
|
|
|
643
|
643
|
wp_enqueue_style( 'plugin-install' ); |
|
644
|
644
|
|
|
@@ -666,7 +666,7 @@ discard block |
|
|
block discarded – undo |
|
666
|
666
|
* @since 2.1.0 |
|
667
|
667
|
*/ |
|
668
|
668
|
public function thickbox() { |
|
669
|
|
- if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) ) { |
|
|
669
|
+ if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, true ) ) { |
|
670
|
670
|
add_thickbox(); |
|
671
|
671
|
} |
|
672
|
672
|
} |
|
@@ -695,11 +695,11 @@ discard block |
|
|
block discarded – undo |
|
695
|
695
|
$args = apply_filters( |
|
696
|
696
|
'tgmpa_admin_menu_args', |
|
697
|
697
|
array( |
|
698
|
|
- 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
699
|
|
- 'page_title' => $this->strings['page_title'], // Page title. |
|
700
|
|
- 'menu_title' => $this->strings['menu_title'], // Menu title. |
|
701
|
|
- 'capability' => $this->capability, // Capability. |
|
702
|
|
- 'menu_slug' => $this->menu, // Menu slug. |
|
|
698
|
+ 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
|
699
|
+ 'page_title' => $this->strings[ 'page_title' ], // Page title. |
|
|
700
|
+ 'menu_title' => $this->strings[ 'menu_title' ], // Menu title. |
|
|
701
|
+ 'capability' => $this->capability, // Capability. |
|
|
702
|
+ 'menu_slug' => $this->menu, // Menu slug. |
|
703
|
703
|
'function' => array( $this, 'install_plugins_page' ), // Callback. |
|
704
|
704
|
) |
|
705
|
705
|
); |
|
@@ -723,9 +723,9 @@ discard block |
|
|
block discarded – undo |
|
723
|
723
|
} |
|
724
|
724
|
|
|
725
|
725
|
if ( 'themes.php' === $this->parent_slug ) { |
|
726
|
|
- $this->page_hook = call_user_func( 'add_theme_page', $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] ); |
|
|
726
|
+ $this->page_hook = call_user_func( 'add_theme_page', $args[ 'page_title' ], $args[ 'menu_title' ], $args[ 'capability' ], $args[ 'menu_slug' ], $args[ 'function' ] ); |
|
727
|
727
|
} else { |
|
728
|
|
- $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'] ); |
|
|
728
|
+ $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' ] ); |
|
729
|
729
|
} |
|
730
|
730
|
} |
|
731
|
731
|
|
|
@@ -794,37 +794,37 @@ discard block |
|
|
block discarded – undo |
|
794
|
794
|
* @return boolean True on success, false on failure. |
|
795
|
795
|
*/ |
|
796
|
796
|
protected function do_plugin_install() { |
|
797
|
|
- if ( empty( $_GET['plugin'] ) ) { |
|
|
797
|
+ if ( empty( $_GET[ 'plugin' ] ) ) { |
|
798
|
798
|
return false; |
|
799
|
799
|
} |
|
800
|
800
|
|
|
801
|
801
|
// All plugin information will be stored in an array for processing. |
|
802
|
|
- $slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) ); |
|
|
802
|
+ $slug = $this->sanitize_key( urldecode( $_GET[ 'plugin' ] ) ); |
|
803
|
803
|
|
|
804
|
804
|
if ( ! isset( $this->plugins[ $slug ] ) ) { |
|
805
|
805
|
return false; |
|
806
|
806
|
} |
|
807
|
807
|
|
|
808
|
808
|
// Was an install or upgrade action link clicked? |
|
809
|
|
- if ( ( isset( $_GET['tgmpa-install'] ) && 'install-plugin' === $_GET['tgmpa-install'] ) || ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) ) { |
|
|
809
|
+ if ( ( isset( $_GET[ 'tgmpa-install' ] ) && 'install-plugin' === $_GET[ 'tgmpa-install' ] ) || ( isset( $_GET[ 'tgmpa-update' ] ) && 'update-plugin' === $_GET[ 'tgmpa-update' ] ) ) { |
|
810
|
810
|
|
|
811
|
811
|
$install_type = 'install'; |
|
812
|
|
- if ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) { |
|
|
812
|
+ if ( isset( $_GET[ 'tgmpa-update' ] ) && 'update-plugin' === $_GET[ 'tgmpa-update' ] ) { |
|
813
|
813
|
$install_type = 'update'; |
|
814
|
814
|
} |
|
815
|
815
|
|
|
816
|
|
- check_admin_referer( 'tgmpa-' . $install_type, 'tgmpa-nonce' ); |
|
|
816
|
+ check_admin_referer( 'tgmpa-'.$install_type, 'tgmpa-nonce' ); |
|
817
|
817
|
|
|
818
|
818
|
// Pass necessary information via URL if WP_Filesystem is needed. |
|
819
|
819
|
$url = wp_nonce_url( |
|
820
|
820
|
add_query_arg( |
|
821
|
821
|
array( |
|
822
|
822
|
'plugin' => urlencode( $slug ), |
|
823
|
|
- 'tgmpa-' . $install_type => $install_type . '-plugin', |
|
|
823
|
+ 'tgmpa-'.$install_type => $install_type.'-plugin', |
|
824
|
824
|
), |
|
825
|
825
|
$this->get_tgmpa_url() |
|
826
|
826
|
), |
|
827
|
|
- 'tgmpa-' . $install_type, |
|
|
827
|
+ 'tgmpa-'.$install_type, |
|
828
|
828
|
'tgmpa-nonce' |
|
829
|
829
|
); |
|
830
|
830
|
|
|
@@ -843,29 +843,29 @@ discard block |
|
|
block discarded – undo |
|
843
|
843
|
|
|
844
|
844
|
// Prep variables for Plugin_Installer_Skin class. |
|
845
|
845
|
$extra = array(); |
|
846
|
|
- $extra['slug'] = $slug; // Needed for potentially renaming of directory name. |
|
|
846
|
+ $extra[ 'slug' ] = $slug; // Needed for potentially renaming of directory name. |
|
847
|
847
|
$source = $this->get_download_url( $slug ); |
|
848
|
|
- $api = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null; |
|
|
848
|
+ $api = ( 'repo' === $this->plugins[ $slug ][ 'source_type' ] ) ? $this->get_plugins_api( $slug ) : null; |
|
849
|
849
|
$api = ( false !== $api ) ? $api : null; |
|
850
|
850
|
|
|
851
|
851
|
$url = add_query_arg( |
|
852
|
852
|
array( |
|
853
|
|
- 'action' => $install_type . '-plugin', |
|
|
853
|
+ 'action' => $install_type.'-plugin', |
|
854
|
854
|
'plugin' => urlencode( $slug ), |
|
855
|
855
|
), |
|
856
|
856
|
'update.php' |
|
857
|
857
|
); |
|
858
|
858
|
|
|
859
|
859
|
if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
|
860
|
|
- require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
|
860
|
+ require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
861
|
861
|
} |
|
862
|
862
|
|
|
863
|
|
- $title = ( 'update' === $install_type ) ? $this->strings['updating'] : $this->strings['installing']; |
|
|
863
|
+ $title = ( 'update' === $install_type ) ? $this->strings[ 'updating' ] : $this->strings[ 'installing' ]; |
|
864
|
864
|
$skin_args = array( |
|
865
|
|
- 'type' => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload', |
|
866
|
|
- 'title' => sprintf( $title, $this->plugins[ $slug ]['name'] ), |
|
|
865
|
+ 'type' => ( 'bundled' !== $this->plugins[ $slug ][ 'source_type' ] ) ? 'web' : 'upload', |
|
|
866
|
+ 'title' => sprintf( $title, $this->plugins[ $slug ][ 'name' ] ), |
|
867
|
867
|
'url' => esc_url_raw( $url ), |
|
868
|
|
- 'nonce' => $install_type . '-plugin_' . $slug, |
|
|
868
|
+ 'nonce' => $install_type.'-plugin_'.$slug, |
|
869
|
869
|
'plugin' => '', |
|
870
|
870
|
'api' => $api, |
|
871
|
871
|
'extra' => $extra, |
|
@@ -873,7 +873,7 @@ discard block |
|
|
block discarded – undo |
|
873
|
873
|
unset( $title ); |
|
874
|
874
|
|
|
875
|
875
|
if ( 'update' === $install_type ) { |
|
876
|
|
- $skin_args['plugin'] = $this->plugins[ $slug ]['file_path']; |
|
|
876
|
+ $skin_args[ 'plugin' ] = $this->plugins[ $slug ][ 'file_path' ]; |
|
877
|
877
|
$skin = new Plugin_Upgrader_Skin( $skin_args ); |
|
878
|
878
|
} else { |
|
879
|
879
|
$skin = new Plugin_Installer_Skin( $skin_args ); |
|
@@ -888,10 +888,10 @@ discard block |
|
|
block discarded – undo |
|
888
|
888
|
if ( 'update' === $install_type ) { |
|
889
|
889
|
// Inject our info into the update transient. |
|
890
|
890
|
$to_inject = array( $slug => $this->plugins[ $slug ] ); |
|
891
|
|
- $to_inject[ $slug ]['source'] = $source; |
|
|
891
|
+ $to_inject[ $slug ][ 'source' ] = $source; |
|
892
|
892
|
$this->inject_update_info( $to_inject ); |
|
893
|
893
|
|
|
894
|
|
- $upgrader->upgrade( $this->plugins[ $slug ]['file_path'] ); |
|
|
894
|
+ $upgrader->upgrade( $this->plugins[ $slug ][ 'file_path' ] ); |
|
895
|
895
|
} else { |
|
896
|
896
|
$upgrader->install( $source ); |
|
897
|
897
|
} |
|
@@ -914,18 +914,18 @@ discard block |
|
|
block discarded – undo |
|
914
|
914
|
|
|
915
|
915
|
// Display message based on if all plugins are now active or not. |
|
916
|
916
|
if ( $this->is_tgmpa_complete() ) { |
|
917
|
|
- echo '<p>', sprintf( esc_html( $this->strings['complete'] ), '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' ), '</p>'; |
|
|
917
|
+ echo '<p>', sprintf( esc_html( $this->strings[ 'complete' ] ), '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' ), '</p>'; |
|
918
|
918
|
echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
|
919
|
919
|
} else { |
|
920
|
|
- echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; |
|
|
920
|
+ echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings[ 'return' ] ), '</a></p>'; |
|
921
|
921
|
} |
|
922
|
922
|
|
|
923
|
923
|
return true; |
|
924
|
|
- } elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) { |
|
|
924
|
+ } elseif ( isset( $this->plugins[ $slug ][ 'file_path' ], $_GET[ 'tgmpa-activate' ] ) && 'activate-plugin' === $_GET[ 'tgmpa-activate' ] ) { |
|
925
|
925
|
// Activate action link was clicked. |
|
926
|
926
|
check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' ); |
|
927
|
927
|
|
|
928
|
|
- if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) { |
|
|
928
|
+ if ( false === $this->activate_single_plugin( $this->plugins[ $slug ][ 'file_path' ], $slug ) ) { |
|
929
|
929
|
return true; // Finish execution of the function early as we encountered an error. |
|
930
|
930
|
} |
|
931
|
931
|
} |
|
@@ -948,7 +948,7 @@ discard block |
|
|
block discarded – undo |
|
948
|
948
|
} |
|
949
|
949
|
|
|
950
|
950
|
foreach ( $plugins as $slug => $plugin ) { |
|
951
|
|
- $file_path = $plugin['file_path']; |
|
|
951
|
+ $file_path = $plugin[ 'file_path' ]; |
|
952
|
952
|
|
|
953
|
953
|
if ( empty( $repo_updates->response[ $file_path ] ) ) { |
|
954
|
954
|
$repo_updates->response[ $file_path ] = new stdClass; |
|
@@ -957,10 +957,10 @@ discard block |
|
|
block discarded – undo |
|
957
|
957
|
// We only really need to set package, but let's do all we can in case WP changes something. |
|
958
|
958
|
$repo_updates->response[ $file_path ]->slug = $slug; |
|
959
|
959
|
$repo_updates->response[ $file_path ]->plugin = $file_path; |
|
960
|
|
- $repo_updates->response[ $file_path ]->new_version = $plugin['version']; |
|
961
|
|
- $repo_updates->response[ $file_path ]->package = $plugin['source']; |
|
962
|
|
- if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) { |
|
963
|
|
- $repo_updates->response[ $file_path ]->url = $plugin['external_url']; |
|
|
960
|
+ $repo_updates->response[ $file_path ]->new_version = $plugin[ 'version' ]; |
|
|
961
|
+ $repo_updates->response[ $file_path ]->package = $plugin[ 'source' ]; |
|
|
962
|
+ if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin[ 'external_url' ] ) ) { |
|
|
963
|
+ $repo_updates->response[ $file_path ]->url = $plugin[ 'external_url' ]; |
|
964
|
964
|
} |
|
965
|
965
|
} |
|
966
|
966
|
|
|
@@ -984,13 +984,13 @@ discard block |
|
|
block discarded – undo |
|
984
|
984
|
* @return string $source |
|
985
|
985
|
*/ |
|
986
|
986
|
public function maybe_adjust_source_dir( $source, $remote_source, $upgrader ) { |
|
987
|
|
- if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS['wp_filesystem'] ) ) { |
|
|
987
|
+ if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS[ 'wp_filesystem' ] ) ) { |
|
988
|
988
|
return $source; |
|
989
|
989
|
} |
|
990
|
990
|
|
|
991
|
991
|
// Check for single file plugins. |
|
992
|
|
- $source_files = array_keys( $GLOBALS['wp_filesystem']->dirlist( $remote_source ) ); |
|
993
|
|
- if ( 1 === count( $source_files ) && false === $GLOBALS['wp_filesystem']->is_dir( $source ) ) { |
|
|
992
|
+ $source_files = array_keys( $GLOBALS[ 'wp_filesystem' ]->dirlist( $remote_source ) ); |
|
|
993
|
+ if ( 1 === count( $source_files ) && false === $GLOBALS[ 'wp_filesystem' ]->is_dir( $source ) ) { |
|
994
|
994
|
return $source; |
|
995
|
995
|
} |
|
996
|
996
|
|
|
@@ -998,12 +998,12 @@ discard block |
|
|
block discarded – undo |
|
998
|
998
|
$desired_slug = ''; |
|
999
|
999
|
|
|
1000
|
1000
|
// Figure out what the slug is supposed to be. |
|
1001
|
|
- if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options['extra']['slug'] ) ) { |
|
1002
|
|
- $desired_slug = $upgrader->skin->options['extra']['slug']; |
|
|
1001
|
+ if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options[ 'extra' ][ 'slug' ] ) ) { |
|
|
1002
|
+ $desired_slug = $upgrader->skin->options[ 'extra' ][ 'slug' ]; |
|
1003
|
1003
|
} else { |
|
1004
|
1004
|
// Bulk installer contains less info, so fall back on the info registered here. |
|
1005
|
1005
|
foreach ( $this->plugins as $slug => $plugin ) { |
|
1006
|
|
- if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
|
|
1006
|
+ if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin[ 'name' ] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
|
1007
|
1007
|
$desired_slug = $slug; |
|
1008
|
1008
|
break; |
|
1009
|
1009
|
} |
|
@@ -1016,15 +1016,15 @@ discard block |
|
|
block discarded – undo |
|
1016
|
1016
|
|
|
1017
|
1017
|
if ( ! empty( $subdir_name ) && $subdir_name !== $desired_slug ) { |
|
1018
|
1018
|
$from = untrailingslashit( $source ); |
|
1019
|
|
- $to = trailingslashit( $remote_source ) . $desired_slug; |
|
|
1019
|
+ $to = trailingslashit( $remote_source ).$desired_slug; |
|
1020
|
1020
|
|
|
1021
|
|
- if ( true === $GLOBALS['wp_filesystem']->move( $from, $to ) ) { |
|
|
1021
|
+ if ( true === $GLOBALS[ 'wp_filesystem' ]->move( $from, $to ) ) { |
|
1022
|
1022
|
return trailingslashit( $to ); |
|
1023
|
1023
|
} else { |
|
1024
|
|
- 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 ) ); |
|
|
1024
|
+ 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 ) ); |
|
1025
|
1025
|
} |
|
1026
|
1026
|
} elseif ( empty( $subdir_name ) ) { |
|
1027
|
|
- 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 ) ); |
|
|
1027
|
+ 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 ) ); |
|
1028
|
1028
|
} |
|
1029
|
1029
|
} |
|
1030
|
1030
|
|
|
@@ -1048,19 +1048,19 @@ discard block |
|
|
block discarded – undo |
|
1048
|
1048
|
|
|
1049
|
1049
|
if ( is_wp_error( $activate ) ) { |
|
1050
|
1050
|
echo '<div id="message" class="error"><p>', wp_kses_post( $activate->get_error_message() ), '</p></div>', |
|
1051
|
|
- '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; |
|
|
1051
|
+ '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings[ 'return' ] ), '</a></p>'; |
|
1052
|
1052
|
|
|
1053
|
1053
|
return false; // End it here if there is an error with activation. |
|
1054
|
1054
|
} else { |
|
1055
|
1055
|
if ( ! $automatic ) { |
|
1056
|
1056
|
// Make sure message doesn't display again if bulk activation is performed |
|
1057
|
1057
|
// immediately after a single activation. |
|
1058
|
|
- if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
1059
|
|
- echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>'; |
|
|
1058
|
+ if ( ! isset( $_POST[ 'action' ] ) ) { // WPCS: CSRF OK. |
|
|
1059
|
+ echo '<div id="message" class="updated"><p>', esc_html( $this->strings[ 'activated_successfully' ] ), ' <strong>', esc_html( $this->plugins[ $slug ][ 'name' ] ), '.</strong></p></div>'; |
|
1060
|
1060
|
} |
|
1061
|
1061
|
} else { |
|
1062
|
1062
|
// Simpler message layout for use on the plugin install page. |
|
1063
|
|
- echo '<p>', esc_html( $this->strings['plugin_activated'] ), '</p>'; |
|
|
1063
|
+ echo '<p>', esc_html( $this->strings[ 'plugin_activated' ] ), '</p>'; |
|
1064
|
1064
|
} |
|
1065
|
1065
|
} |
|
1066
|
1066
|
} elseif ( $this->is_plugin_active( $slug ) ) { |
|
@@ -1068,25 +1068,25 @@ discard block |
|
|
block discarded – undo |
|
1068
|
1068
|
// on the plugin install page. |
|
1069
|
1069
|
echo '<div id="message" class="error"><p>', |
|
1070
|
1070
|
sprintf( |
|
1071
|
|
- esc_html( $this->strings['plugin_already_active'] ), |
|
1072
|
|
- '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
|
1071
|
+ esc_html( $this->strings[ 'plugin_already_active' ] ), |
|
|
1072
|
+ '<strong>'.esc_html( $this->plugins[ $slug ][ 'name' ] ).'</strong>' |
|
1073
|
1073
|
), |
|
1074
|
1074
|
'</p></div>'; |
|
1075
|
1075
|
} elseif ( $this->does_plugin_require_update( $slug ) ) { |
|
1076
|
1076
|
if ( ! $automatic ) { |
|
1077
|
1077
|
// Make sure message doesn't display again if bulk activation is performed |
|
1078
|
1078
|
// immediately after a single activation. |
|
1079
|
|
- if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
|
1079
|
+ if ( ! isset( $_POST[ 'action' ] ) ) { // WPCS: CSRF OK. |
|
1080
|
1080
|
echo '<div id="message" class="error"><p>', |
|
1081
|
1081
|
sprintf( |
|
1082
|
|
- esc_html( $this->strings['plugin_needs_higher_version'] ), |
|
1083
|
|
- '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
|
1082
|
+ esc_html( $this->strings[ 'plugin_needs_higher_version' ] ), |
|
|
1083
|
+ '<strong>'.esc_html( $this->plugins[ $slug ][ 'name' ] ).'</strong>' |
|
1084
|
1084
|
), |
|
1085
|
1085
|
'</p></div>'; |
|
1086
|
1086
|
} |
|
1087
|
1087
|
} else { |
|
1088
|
1088
|
// Simpler message layout for use on the plugin install page. |
|
1089
|
|
- echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>'; |
|
|
1089
|
+ echo '<p>', sprintf( esc_html( $this->strings[ 'plugin_needs_higher_version' ] ), esc_html( $this->plugins[ $slug ][ 'name' ] ) ), '</p>'; |
|
1090
|
1090
|
} |
|
1091
|
1091
|
} |
|
1092
|
1092
|
|
|
@@ -1110,7 +1110,7 @@ discard block |
|
|
block discarded – undo |
|
1110
|
1110
|
*/ |
|
1111
|
1111
|
public function notices() { |
|
1112
|
1112
|
// Remove nag on the install page / Return early if the nag message has been dismissed or user < author. |
|
1113
|
|
- 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' ) ) ) { |
|
|
1113
|
+ 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' ) ) ) { |
|
1114
|
1114
|
return; |
|
1115
|
1115
|
} |
|
1116
|
1116
|
|
|
@@ -1132,13 +1132,13 @@ discard block |
|
|
block discarded – undo |
|
1132
|
1132
|
if ( current_user_can( 'install_plugins' ) ) { |
|
1133
|
1133
|
$install_link_count++; |
|
1134
|
1134
|
|
|
1135
|
|
- if ( true === $plugin['required'] ) { |
|
1136
|
|
- $message['notice_can_install_required'][] = $slug; |
|
|
1135
|
+ if ( true === $plugin[ 'required' ] ) { |
|
|
1136
|
+ $message[ 'notice_can_install_required' ][ ] = $slug; |
|
1137
|
1137
|
} else { |
|
1138
|
|
- $message['notice_can_install_recommended'][] = $slug; |
|
|
1138
|
+ $message[ 'notice_can_install_recommended' ][ ] = $slug; |
|
1139
|
1139
|
} |
|
1140
|
1140
|
} |
|
1141
|
|
- if ( true === $plugin['required'] ) { |
|
|
1141
|
+ if ( true === $plugin[ 'required' ] ) { |
|
1142
|
1142
|
$total_required_action_count++; |
|
1143
|
1143
|
} |
|
1144
|
1144
|
} else { |
|
@@ -1146,13 +1146,13 @@ discard block |
|
|
block discarded – undo |
|
1146
|
1146
|
if ( current_user_can( 'activate_plugins' ) ) { |
|
1147
|
1147
|
$activate_link_count++; |
|
1148
|
1148
|
|
|
1149
|
|
- if ( true === $plugin['required'] ) { |
|
1150
|
|
- $message['notice_can_activate_required'][] = $slug; |
|
|
1149
|
+ if ( true === $plugin[ 'required' ] ) { |
|
|
1150
|
+ $message[ 'notice_can_activate_required' ][ ] = $slug; |
|
1151
|
1151
|
} else { |
|
1152
|
|
- $message['notice_can_activate_recommended'][] = $slug; |
|
|
1152
|
+ $message[ 'notice_can_activate_recommended' ][ ] = $slug; |
|
1153
|
1153
|
} |
|
1154
|
1154
|
} |
|
1155
|
|
- if ( true === $plugin['required'] ) { |
|
|
1155
|
+ if ( true === $plugin[ 'required' ] ) { |
|
1156
|
1156
|
$total_required_action_count++; |
|
1157
|
1157
|
} |
|
1158
|
1158
|
} |
|
@@ -1163,12 +1163,12 @@ discard block |
|
|
block discarded – undo |
|
1163
|
1163
|
$update_link_count++; |
|
1164
|
1164
|
|
|
1165
|
1165
|
if ( $this->does_plugin_require_update( $slug ) ) { |
|
1166
|
|
- $message['notice_ask_to_update'][] = $slug; |
|
|
1166
|
+ $message[ 'notice_ask_to_update' ][ ] = $slug; |
|
1167
|
1167
|
} elseif ( false !== $this->does_plugin_have_update( $slug ) ) { |
|
1168
|
|
- $message['notice_ask_to_update_maybe'][] = $slug; |
|
|
1168
|
+ $message[ 'notice_ask_to_update_maybe' ][ ] = $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
|
} |
|
@@ -1183,10 +1183,10 @@ discard block |
|
|
block discarded – undo |
|
1183
|
1183
|
|
|
1184
|
1184
|
// As add_settings_error() wraps the final message in a <p> and as the final message can't be |
|
1185
|
1185
|
// filtered, using <p>'s in our html would render invalid html output. |
|
1186
|
|
- $line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>' . "\n"; |
|
|
1186
|
+ $line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>'."\n"; |
|
1187
|
1187
|
|
|
1188
|
1188
|
if ( ! current_user_can( 'activate_plugins' ) && ! current_user_can( 'install_plugins' ) && ! current_user_can( 'update_plugins' ) ) { |
|
1189
|
|
- $rendered = esc_html__( $this->strings['notice_cannot_install_activate'] ) . ' ' . esc_html__( $this->strings['contact_admin'] ); |
|
|
1189
|
+ $rendered = esc_html__( $this->strings[ 'notice_cannot_install_activate' ] ).' '.esc_html__( $this->strings[ 'contact_admin' ] ); |
|
1190
|
1190
|
$rendered .= $this->create_user_action_links_for_notice( 0, 0, 0, $line_template ); |
|
1191
|
1191
|
} else { |
|
1192
|
1192
|
|
|
@@ -1201,14 +1201,14 @@ discard block |
|
|
block discarded – undo |
|
1201
|
1201
|
|
|
1202
|
1202
|
// Get the external info link for a plugin if one is available. |
|
1203
|
1203
|
foreach ( $plugin_group as $plugin_slug ) { |
|
1204
|
|
- $linked_plugins[] = $this->get_info_link( $plugin_slug ); |
|
|
1204
|
+ $linked_plugins[ ] = $this->get_info_link( $plugin_slug ); |
|
1205
|
1205
|
} |
|
1206
|
1206
|
unset( $plugin_slug ); |
|
1207
|
1207
|
|
|
1208
|
1208
|
$count = count( $plugin_group ); |
|
1209
|
1209
|
$linked_plugins = array_map( array( 'TGMPA_Utils', 'wrap_in_em' ), $linked_plugins ); |
|
1210
|
1210
|
$last_plugin = array_pop( $linked_plugins ); // Pop off last name to prep for readability. |
|
1211
|
|
- $imploded = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
|
1211
|
+ $imploded = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); |
|
1212
|
1212
|
|
|
1213
|
1213
|
$rendered .= sprintf( |
|
1214
|
1214
|
$line_template, |
|
@@ -1230,7 +1230,7 @@ discard block |
|
|
block discarded – undo |
|
1230
|
1230
|
} |
|
1231
|
1231
|
|
|
1232
|
1232
|
// Admin options pages already output settings_errors, so this is to avoid duplication. |
|
1233
|
|
- if ( 'options-general' !== $GLOBALS['current_screen']->parent_base ) { |
|
|
1233
|
+ if ( 'options-general' !== $GLOBALS[ 'current_screen' ]->parent_base ) { |
|
1234
|
1234
|
$this->display_settings_errors(); |
|
1235
|
1235
|
} |
|
1236
|
1236
|
} |
|
@@ -1252,32 +1252,32 @@ discard block |
|
|
block discarded – undo |
|
1252
|
1252
|
'install' => '', |
|
1253
|
1253
|
'update' => '', |
|
1254
|
1254
|
'activate' => '', |
|
1255
|
|
- '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>' : '', |
|
|
1255
|
+ '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>' : '', |
|
1256
|
1256
|
); |
|
1257
|
1257
|
|
|
1258
|
1258
|
$link_template = '<a href="%2$s">%1$s</a>'; |
|
1259
|
1259
|
|
|
1260
|
1260
|
if ( current_user_can( 'install_plugins' ) ) { |
|
1261
|
1261
|
if ( $install_count > 0 ) { |
|
1262
|
|
- $action_links['install'] = sprintf( |
|
|
1262
|
+ $action_links[ 'install' ] = sprintf( |
|
1263
|
1263
|
$link_template, |
|
1264
|
|
- translate_nooped_plural( $this->strings['install_link'], $install_count, 'tgmpa' ), |
|
|
1264
|
+ translate_nooped_plural( $this->strings[ 'install_link' ], $install_count, 'tgmpa' ), |
|
1265
|
1265
|
esc_url( $this->get_tgmpa_status_url( 'install' ) ) |
|
1266
|
1266
|
); |
|
1267
|
1267
|
} |
|
1268
|
1268
|
if ( $update_count > 0 ) { |
|
1269
|
|
- $action_links['update'] = sprintf( |
|
|
1269
|
+ $action_links[ 'update' ] = sprintf( |
|
1270
|
1270
|
$link_template, |
|
1271
|
|
- translate_nooped_plural( $this->strings['update_link'], $update_count, 'tgmpa' ), |
|
|
1271
|
+ translate_nooped_plural( $this->strings[ 'update_link' ], $update_count, 'tgmpa' ), |
|
1272
|
1272
|
esc_url( $this->get_tgmpa_status_url( 'update' ) ) |
|
1273
|
1273
|
); |
|
1274
|
1274
|
} |
|
1275
|
1275
|
} |
|
1276
|
1276
|
|
|
1277
|
1277
|
if ( current_user_can( 'activate_plugins' ) && $activate_count > 0 ) { |
|
1278
|
|
- $action_links['activate'] = sprintf( |
|
|
1278
|
+ $action_links[ 'activate' ] = sprintf( |
|
1279
|
1279
|
$link_template, |
|
1280
|
|
- translate_nooped_plural( $this->strings['activate_link'], $activate_count, 'tgmpa' ), |
|
|
1280
|
+ translate_nooped_plural( $this->strings[ 'activate_link' ], $activate_count, 'tgmpa' ), |
|
1281
|
1281
|
esc_url( $this->get_tgmpa_status_url( 'activate' ) ) |
|
1282
|
1282
|
); |
|
1283
|
1283
|
} |
|
@@ -1305,8 +1305,8 @@ discard block |
|
|
block discarded – undo |
|
1305
|
1305
|
* @return string |
|
1306
|
1306
|
*/ |
|
1307
|
1307
|
protected function get_admin_notice_class() { |
|
1308
|
|
- if ( ! empty( $this->strings['nag_type'] ) ) { |
|
1309
|
|
- return sanitize_html_class( strtolower( $this->strings['nag_type'] ) ); |
|
|
1308
|
+ if ( ! empty( $this->strings[ 'nag_type' ] ) ) { |
|
|
1309
|
+ return sanitize_html_class( strtolower( $this->strings[ 'nag_type' ] ) ); |
|
1310
|
1310
|
} else { |
|
1311
|
1311
|
if ( version_compare( $this->wp_version, '4.2', '>=' ) ) { |
|
1312
|
1312
|
return 'notice-warning'; |
|
@@ -1329,7 +1329,7 @@ discard block |
|
|
block discarded – undo |
|
1329
|
1329
|
settings_errors( 'tgmpa' ); |
|
1330
|
1330
|
|
|
1331
|
1331
|
foreach ( (array) $wp_settings_errors as $key => $details ) { |
|
1332
|
|
- if ( 'tgmpa' === $details['setting'] ) { |
|
|
1332
|
+ if ( 'tgmpa' === $details[ 'setting' ] ) { |
|
1333
|
1333
|
unset( $wp_settings_errors[ $key ] ); |
|
1334
|
1334
|
break; |
|
1335
|
1335
|
} |
|
@@ -1345,8 +1345,8 @@ discard block |
|
|
block discarded – undo |
|
1345
|
1345
|
* @since 2.1.0 |
|
1346
|
1346
|
*/ |
|
1347
|
1347
|
public function dismiss() { |
|
1348
|
|
- if ( isset( $_GET['tgmpa-dismiss'] ) && check_admin_referer( 'tgmpa-dismiss-' . get_current_user_id() ) ) { |
|
1349
|
|
- update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, 1 ); |
|
|
1348
|
+ if ( isset( $_GET[ 'tgmpa-dismiss' ] ) && check_admin_referer( 'tgmpa-dismiss-'.get_current_user_id() ) ) { |
|
|
1349
|
+ update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, 1 ); |
|
1350
|
1350
|
} |
|
1351
|
1351
|
} |
|
1352
|
1352
|
|
|
@@ -1362,54 +1362,54 @@ discard block |
|
|
block discarded – undo |
|
1362
|
1362
|
* @return null Return early if incorrect argument. |
|
1363
|
1363
|
*/ |
|
1364
|
1364
|
public function register( $plugin ) { |
|
1365
|
|
- if ( empty( $plugin['slug'] ) || empty( $plugin['name'] ) ) { |
|
|
1365
|
+ if ( empty( $plugin[ 'slug' ] ) || empty( $plugin[ 'name' ] ) ) { |
|
1366
|
1366
|
return; |
|
1367
|
1367
|
} |
|
1368
|
1368
|
|
|
1369
|
|
- if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) { |
|
|
1369
|
+ if ( empty( $plugin[ 'slug' ] ) || ! is_string( $plugin[ 'slug' ] ) || isset( $this->plugins[ $plugin[ 'slug' ] ] ) ) { |
|
1370
|
1370
|
return; |
|
1371
|
1371
|
} |
|
1372
|
1372
|
|
|
1373
|
1373
|
$defaults = array( |
|
1374
|
|
- 'name' => '', // String |
|
1375
|
|
- 'slug' => '', // String |
|
1376
|
|
- 'source' => 'repo', // String |
|
1377
|
|
- 'required' => false, // Boolean |
|
1378
|
|
- 'version' => '', // String |
|
1379
|
|
- 'force_activation' => false, // Boolean |
|
1380
|
|
- 'force_deactivation' => false, // Boolean |
|
1381
|
|
- 'external_url' => '', // String |
|
1382
|
|
- 'is_callable' => '', // String|Array. |
|
|
1374
|
+ 'name' => '', // String |
|
|
1375
|
+ 'slug' => '', // String |
|
|
1376
|
+ 'source' => 'repo', // String |
|
|
1377
|
+ 'required' => false, // Boolean |
|
|
1378
|
+ 'version' => '', // String |
|
|
1379
|
+ 'force_activation' => false, // Boolean |
|
|
1380
|
+ 'force_deactivation' => false, // Boolean |
|
|
1381
|
+ 'external_url' => '', // String |
|
|
1382
|
+ 'is_callable' => '', // String|Array. |
|
1383
|
1383
|
); |
|
1384
|
1384
|
|
|
1385
|
1385
|
// Prepare the received data. |
|
1386
|
1386
|
$plugin = wp_parse_args( $plugin, $defaults ); |
|
1387
|
1387
|
|
|
1388
|
1388
|
// Standardize the received slug. |
|
1389
|
|
- $plugin['slug'] = $this->sanitize_key( $plugin['slug'] ); |
|
|
1389
|
+ $plugin[ 'slug' ] = $this->sanitize_key( $plugin[ 'slug' ] ); |
|
1390
|
1390
|
|
|
1391
|
1391
|
// Forgive users for using string versions of booleans or floats for version number. |
|
1392
|
|
- $plugin['version'] = (string) $plugin['version']; |
|
1393
|
|
- $plugin['source'] = empty( $plugin['source'] ) ? 'repo' : $plugin['source']; |
|
1394
|
|
- $plugin['required'] = TGMPA_Utils::validate_bool( $plugin['required'] ); |
|
1395
|
|
- $plugin['force_activation'] = TGMPA_Utils::validate_bool( $plugin['force_activation'] ); |
|
1396
|
|
- $plugin['force_deactivation'] = TGMPA_Utils::validate_bool( $plugin['force_deactivation'] ); |
|
|
1392
|
+ $plugin[ 'version' ] = (string) $plugin[ 'version' ]; |
|
|
1393
|
+ $plugin[ 'source' ] = empty( $plugin[ 'source' ] ) ? 'repo' : $plugin[ 'source' ]; |
|
|
1394
|
+ $plugin[ 'required' ] = TGMPA_Utils::validate_bool( $plugin[ 'required' ] ); |
|
|
1395
|
+ $plugin[ 'force_activation' ] = TGMPA_Utils::validate_bool( $plugin[ 'force_activation' ] ); |
|
|
1396
|
+ $plugin[ 'force_deactivation' ] = TGMPA_Utils::validate_bool( $plugin[ 'force_deactivation' ] ); |
|
1397
|
1397
|
|
|
1398
|
1398
|
// Enrich the received data. |
|
1399
|
|
- $plugin['file_path'] = $this->_get_plugin_basename_from_slug( $plugin['slug'] ); |
|
1400
|
|
- $plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] ); |
|
|
1399
|
+ $plugin[ 'file_path' ] = $this->_get_plugin_basename_from_slug( $plugin[ 'slug' ] ); |
|
|
1400
|
+ $plugin[ 'source_type' ] = $this->get_plugin_source_type( $plugin[ 'source' ] ); |
|
1401
|
1401
|
|
|
1402
|
1402
|
// Set the class properties. |
|
1403
|
|
- $this->plugins[ $plugin['slug'] ] = $plugin; |
|
1404
|
|
- $this->sort_order[ $plugin['slug'] ] = $plugin['name']; |
|
|
1403
|
+ $this->plugins[ $plugin[ 'slug' ] ] = $plugin; |
|
|
1404
|
+ $this->sort_order[ $plugin[ 'slug' ] ] = $plugin[ 'name' ]; |
|
1405
|
1405
|
|
|
1406
|
1406
|
// Should we add the force activation hook ? |
|
1407
|
|
- if ( true === $plugin['force_activation'] ) { |
|
|
1407
|
+ if ( true === $plugin[ 'force_activation' ] ) { |
|
1408
|
1408
|
$this->has_forced_activation = true; |
|
1409
|
1409
|
} |
|
1410
|
1410
|
|
|
1411
|
1411
|
// Should we add the force deactivation hook ? |
|
1412
|
|
- if ( true === $plugin['force_deactivation'] ) { |
|
|
1412
|
+ if ( true === $plugin[ 'force_deactivation' ] ) { |
|
1413
|
1413
|
$this->has_forced_deactivation = true; |
|
1414
|
1414
|
} |
|
1415
|
1415
|
} |
|
@@ -1535,11 +1535,11 @@ discard block |
|
|
block discarded – undo |
|
1535
|
1535
|
*/ |
|
1536
|
1536
|
public function populate_file_path( $plugin_slug = '' ) { |
|
1537
|
1537
|
if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) { |
|
1538
|
|
- $this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
|
1538
|
+ $this->plugins[ $plugin_slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
1539
|
1539
|
} else { |
|
1540
|
1540
|
// Add file_path key for all plugins. |
|
1541
|
1541
|
foreach ( $this->plugins as $slug => $values ) { |
|
1542
|
|
- $this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug ); |
|
|
1542
|
+ $this->plugins[ $slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $slug ); |
|
1543
|
1543
|
} |
|
1544
|
1544
|
} |
|
1545
|
1545
|
} |
|
@@ -1557,7 +1557,7 @@ discard block |
|
|
block discarded – undo |
|
1557
|
1557
|
$keys = array_keys( $this->get_plugins() ); |
|
1558
|
1558
|
|
|
1559
|
1559
|
foreach ( $keys as $key ) { |
|
1560
|
|
- if ( preg_match( '|^' . $slug . '/|', $key ) ) { |
|
|
1560
|
+ if ( preg_match( '|^'.$slug.'/|', $key ) ) { |
|
1561
|
1561
|
return $key; |
|
1562
|
1562
|
} |
|
1563
|
1563
|
} |
|
@@ -1579,7 +1579,7 @@ discard block |
|
|
block discarded – undo |
|
1579
|
1579
|
*/ |
|
1580
|
1580
|
public function _get_plugin_data_from_name( $name, $data = 'slug' ) { |
|
1581
|
1581
|
foreach ( $this->plugins as $values ) { |
|
1582
|
|
- if ( $name === $values['name'] && isset( $values[ $data ] ) ) { |
|
|
1582
|
+ if ( $name === $values[ 'name' ] && isset( $values[ $data ] ) ) { |
|
1583
|
1583
|
return $values[ $data ]; |
|
1584
|
1584
|
} |
|
1585
|
1585
|
} |
|
@@ -1598,13 +1598,13 @@ discard block |
|
|
block discarded – undo |
|
1598
|
1598
|
public function get_download_url( $slug ) { |
|
1599
|
1599
|
$dl_source = ''; |
|
1600
|
1600
|
|
|
1601
|
|
- switch ( $this->plugins[ $slug ]['source_type'] ) { |
|
|
1601
|
+ switch ( $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1602
|
1602
|
case 'repo': |
|
1603
|
1603
|
return $this->get_wp_repo_download_url( $slug ); |
|
1604
|
1604
|
case 'external': |
|
1605
|
|
- return $this->plugins[ $slug ]['source']; |
|
|
1605
|
+ return $this->plugins[ $slug ][ 'source' ]; |
|
1606
|
1606
|
case 'bundled': |
|
1607
|
|
- return $this->default_path . $this->plugins[ $slug ]['source']; |
|
|
1607
|
+ return $this->default_path.$this->plugins[ $slug ][ 'source' ]; |
|
1608
|
1608
|
} |
|
1609
|
1609
|
|
|
1610
|
1610
|
return $dl_source; // Should never happen. |
|
@@ -1642,7 +1642,7 @@ discard block |
|
|
block discarded – undo |
|
1642
|
1642
|
|
|
1643
|
1643
|
if ( ! isset( $api[ $slug ] ) ) { |
|
1644
|
1644
|
if ( ! function_exists( 'plugins_api' ) ) { |
|
1645
|
|
- require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
|
|
1645
|
+ require_once ABSPATH.'wp-admin/includes/plugin-install.php'; |
|
1646
|
1646
|
} |
|
1647
|
1647
|
|
|
1648
|
1648
|
$response = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ) ) ); |
|
@@ -1650,7 +1650,7 @@ discard block |
|
|
block discarded – undo |
|
1650
|
1650
|
$api[ $slug ] = false; |
|
1651
|
1651
|
|
|
1652
|
1652
|
if ( is_wp_error( $response ) ) { |
|
1653
|
|
- wp_die( esc_html( $this->strings['oops'] ) ); |
|
|
1653
|
+ wp_die( esc_html( $this->strings[ 'oops' ] ) ); |
|
1654
|
1654
|
} else { |
|
1655
|
1655
|
$api[ $slug ] = $response; |
|
1656
|
1656
|
} |
|
@@ -1669,13 +1669,13 @@ discard block |
|
|
block discarded – undo |
|
1669
|
1669
|
* or the plugin name if not. |
|
1670
|
1670
|
*/ |
|
1671
|
1671
|
public function get_info_link( $slug ) { |
|
1672
|
|
- if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) { |
|
|
1672
|
+ if ( ! empty( $this->plugins[ $slug ][ 'external_url' ] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ][ 'external_url' ] ) ) { |
|
1673
|
1673
|
$link = sprintf( |
|
1674
|
1674
|
'<a href="%1$s" target="_blank">%2$s</a>', |
|
1675
|
|
- esc_url( $this->plugins[ $slug ]['external_url'] ), |
|
1676
|
|
- esc_html( $this->plugins[ $slug ]['name'] ) |
|
|
1675
|
+ esc_url( $this->plugins[ $slug ][ 'external_url' ] ), |
|
|
1676
|
+ esc_html( $this->plugins[ $slug ][ 'name' ] ) |
|
1677
|
1677
|
); |
|
1678
|
|
- } elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) { |
|
|
1678
|
+ } elseif ( 'repo' === $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1679
|
1679
|
$url = add_query_arg( |
|
1680
|
1680
|
array( |
|
1681
|
1681
|
'tab' => 'plugin-information', |
|
@@ -1690,10 +1690,10 @@ discard block |
|
|
block discarded – undo |
|
1690
|
1690
|
$link = sprintf( |
|
1691
|
1691
|
'<a href="%1$s" class="thickbox">%2$s</a>', |
|
1692
|
1692
|
esc_url( $url ), |
|
1693
|
|
- esc_html( $this->plugins[ $slug ]['name'] ) |
|
|
1693
|
+ esc_html( $this->plugins[ $slug ][ 'name' ] ) |
|
1694
|
1694
|
); |
|
1695
|
1695
|
} else { |
|
1696
|
|
- $link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink. |
|
|
1696
|
+ $link = esc_html( $this->plugins[ $slug ][ 'name' ] ); // No hyperlink. |
|
1697
|
1697
|
} |
|
1698
|
1698
|
|
|
1699
|
1699
|
return $link; |
|
@@ -1707,7 +1707,7 @@ discard block |
|
|
block discarded – undo |
|
1707
|
1707
|
* @return boolean True when on the TGMPA page, false otherwise. |
|
1708
|
1708
|
*/ |
|
1709
|
1709
|
protected function is_tgmpa_page() { |
|
1710
|
|
- return isset( $_GET['page'] ) && $this->menu === $_GET['page']; |
|
|
1710
|
+ return isset( $_GET[ 'page' ] ) && $this->menu === $_GET[ 'page' ]; |
|
1711
|
1711
|
} |
|
1712
|
1712
|
|
|
1713
|
1713
|
/** |
|
@@ -1728,10 +1728,10 @@ discard block |
|
|
block discarded – undo |
|
1728
|
1728
|
if ( 'update-core' === $screen->base ) { |
|
1729
|
1729
|
// Core update screen. |
|
1730
|
1730
|
return true; |
|
1731
|
|
- } elseif ( 'plugins' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok. |
|
|
1731
|
+ } elseif ( 'plugins' === $screen->base && ! empty( $_POST[ 'action' ] ) ) { // WPCS: CSRF ok. |
|
1732
|
1732
|
// Plugins bulk update screen. |
|
1733
|
1733
|
return true; |
|
1734
|
|
- } elseif ( 'update' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok. |
|
|
1734
|
+ } elseif ( 'update' === $screen->base && ! empty( $_POST[ 'action' ] ) ) { // WPCS: CSRF ok. |
|
1735
|
1735
|
// Individual updates (ajax call). |
|
1736
|
1736
|
return true; |
|
1737
|
1737
|
} |
|
@@ -1818,7 +1818,7 @@ discard block |
|
|
block discarded – undo |
|
1818
|
1818
|
public function is_plugin_installed( $slug ) { |
|
1819
|
1819
|
$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
|
1820
|
1820
|
|
|
1821
|
|
- return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) ); |
|
|
1821
|
+ return ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ] ) ); |
|
1822
|
1822
|
} |
|
1823
|
1823
|
|
|
1824
|
1824
|
/** |
|
@@ -1830,7 +1830,7 @@ discard block |
|
|
block discarded – undo |
|
1830
|
1830
|
* @return bool True if active, false otherwise. |
|
1831
|
1831
|
*/ |
|
1832
|
1832
|
public function is_plugin_active( $slug ) { |
|
1833
|
|
- return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) ); |
|
|
1833
|
+ return ( ( ! empty( $this->plugins[ $slug ][ 'is_callable' ] ) && is_callable( $this->plugins[ $slug ][ 'is_callable' ] ) ) || is_plugin_active( $this->plugins[ $slug ][ 'file_path' ] ) ); |
|
1834
|
1834
|
} |
|
1835
|
1835
|
|
|
1836
|
1836
|
/** |
|
@@ -1844,7 +1844,7 @@ discard block |
|
|
block discarded – undo |
|
1844
|
1844
|
*/ |
|
1845
|
1845
|
public function can_plugin_update( $slug ) { |
|
1846
|
1846
|
// We currently can't get reliable info on non-WP-repo plugins - issue #380. |
|
1847
|
|
- if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
|
1847
|
+ if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1848
|
1848
|
return true; |
|
1849
|
1849
|
} |
|
1850
|
1850
|
|
|
@@ -1900,8 +1900,8 @@ discard block |
|
|
block discarded – undo |
|
1900
|
1900
|
public function get_installed_version( $slug ) { |
|
1901
|
1901
|
$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
|
1902
|
1902
|
|
|
1903
|
|
- if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) { |
|
1904
|
|
- return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version']; |
|
|
1903
|
+ if ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ] ) ) { |
|
|
1904
|
+ return $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ]; |
|
1905
|
1905
|
} |
|
1906
|
1906
|
|
|
1907
|
1907
|
return ''; |
|
@@ -1917,7 +1917,7 @@ discard block |
|
|
block discarded – undo |
|
1917
|
1917
|
*/ |
|
1918
|
1918
|
public function does_plugin_require_update( $slug ) { |
|
1919
|
1919
|
$installed_version = $this->get_installed_version( $slug ); |
|
1920
|
|
- $minimum_version = $this->plugins[ $slug ]['version']; |
|
|
1920
|
+ $minimum_version = $this->plugins[ $slug ][ 'version' ]; |
|
1921
|
1921
|
|
|
1922
|
1922
|
return version_compare( $minimum_version, $installed_version, '>' ); |
|
1923
|
1923
|
} |
|
@@ -1932,9 +1932,9 @@ discard block |
|
|
block discarded – undo |
|
1932
|
1932
|
*/ |
|
1933
|
1933
|
public function does_plugin_have_update( $slug ) { |
|
1934
|
1934
|
// Presume bundled and external plugins will point to a package which meets the minimum required version. |
|
1935
|
|
- if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
|
1935
|
+ if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1936
|
1936
|
if ( $this->does_plugin_require_update( $slug ) ) { |
|
1937
|
|
- return $this->plugins[ $slug ]['version']; |
|
|
1937
|
+ return $this->plugins[ $slug ][ 'version' ]; |
|
1938
|
1938
|
} |
|
1939
|
1939
|
|
|
1940
|
1940
|
return false; |
|
@@ -1942,8 +1942,8 @@ discard block |
|
|
block discarded – undo |
|
1942
|
1942
|
|
|
1943
|
1943
|
$repo_updates = get_site_transient( 'update_plugins' ); |
|
1944
|
1944
|
|
|
1945
|
|
- if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) { |
|
1946
|
|
- return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version; |
|
|
1945
|
+ if ( isset( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version ) ) { |
|
|
1946
|
+ return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version; |
|
1947
|
1947
|
} |
|
1948
|
1948
|
|
|
1949
|
1949
|
return false; |
|
@@ -1959,14 +1959,14 @@ discard block |
|
|
block discarded – undo |
|
1959
|
1959
|
*/ |
|
1960
|
1960
|
public function get_upgrade_notice( $slug ) { |
|
1961
|
1961
|
// We currently can't get reliable info on non-WP-repo plugins - issue #380. |
|
1962
|
|
- if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
|
1962
|
+ if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1963
|
1963
|
return ''; |
|
1964
|
1964
|
} |
|
1965
|
1965
|
|
|
1966
|
1966
|
$repo_updates = get_site_transient( 'update_plugins' ); |
|
1967
|
1967
|
|
|
1968
|
|
- if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) { |
|
1969
|
|
- return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice; |
|
|
1968
|
+ if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice ) ) { |
|
|
1969
|
+ return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice; |
|
1970
|
1970
|
} |
|
1971
|
1971
|
|
|
1972
|
1972
|
return ''; |
|
@@ -1982,7 +1982,7 @@ discard block |
|
|
block discarded – undo |
|
1982
|
1982
|
*/ |
|
1983
|
1983
|
public function get_plugins( $plugin_folder = '' ) { |
|
1984
|
1984
|
if ( ! function_exists( 'get_plugins' ) ) { |
|
1985
|
|
- require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
|
1985
|
+ require_once ABSPATH.'wp-admin/includes/plugin.php'; |
|
1986
|
1986
|
} |
|
1987
|
1987
|
|
|
1988
|
1988
|
return get_plugins( $plugin_folder ); |
|
@@ -1997,7 +1997,7 @@ discard block |
|
|
block discarded – undo |
|
1997
|
1997
|
* @since 2.1.1 |
|
1998
|
1998
|
*/ |
|
1999
|
1999
|
public function update_dismiss() { |
|
2000
|
|
- delete_metadata( 'user', null, 'tgmpa_dismissed_notice_' . $this->id, null, true ); |
|
|
2000
|
+ delete_metadata( 'user', null, 'tgmpa_dismissed_notice_'.$this->id, null, true ); |
|
2001
|
2001
|
} |
|
2002
|
2002
|
|
|
2003
|
2003
|
/** |
|
@@ -2016,13 +2016,13 @@ discard block |
|
|
block discarded – undo |
|
2016
|
2016
|
*/ |
|
2017
|
2017
|
public function force_activation() { |
|
2018
|
2018
|
foreach ( $this->plugins as $slug => $plugin ) { |
|
2019
|
|
- if ( true === $plugin['force_activation'] ) { |
|
|
2019
|
+ if ( true === $plugin[ 'force_activation' ] ) { |
|
2020
|
2020
|
if ( ! $this->is_plugin_installed( $slug ) ) { |
|
2021
|
2021
|
// Oops, plugin isn't there so iterate to next condition. |
|
2022
|
2022
|
continue; |
|
2023
|
2023
|
} elseif ( $this->can_plugin_activate( $slug ) ) { |
|
2024
|
2024
|
// There we go, activate the plugin. |
|
2025
|
|
- activate_plugin( $plugin['file_path'] ); |
|
|
2025
|
+ activate_plugin( $plugin[ 'file_path' ] ); |
|
2026
|
2026
|
} |
|
2027
|
2027
|
} |
|
2028
|
2028
|
} |
|
@@ -2043,8 +2043,8 @@ discard block |
|
|
block discarded – undo |
|
2043
|
2043
|
public function force_deactivation() { |
|
2044
|
2044
|
foreach ( $this->plugins as $slug => $plugin ) { |
|
2045
|
2045
|
// Only proceed forward if the parameter is set to true and plugin is active. |
|
2046
|
|
- if ( true === $plugin['force_deactivation'] && $this->is_plugin_active( $slug ) ) { |
|
2047
|
|
- deactivate_plugins( $plugin['file_path'] ); |
|
|
2046
|
+ if ( true === $plugin[ 'force_deactivation' ] && $this->is_plugin_active( $slug ) ) { |
|
|
2047
|
+ deactivate_plugins( $plugin[ 'file_path' ] ); |
|
2048
|
2048
|
} |
|
2049
|
2049
|
} |
|
2050
|
2050
|
} |
|
@@ -2085,7 +2085,7 @@ discard block |
|
|
block discarded – undo |
|
2085
|
2085
|
* Ensure only one instance of the class is ever invoked. |
|
2086
|
2086
|
*/ |
|
2087
|
2087
|
function load_tgm_plugin_activation() { |
|
2088
|
|
- $GLOBALS['tgmpa'] = TGM_Plugin_Activation::get_instance(); |
|
|
2088
|
+ $GLOBALS[ 'tgmpa' ] = TGM_Plugin_Activation::get_instance(); |
|
2089
|
2089
|
} |
|
2090
|
2090
|
} |
|
2091
|
2091
|
|
|
@@ -2107,7 +2107,7 @@ discard block |
|
|
block discarded – undo |
|
2107
|
2107
|
* @param array $config Optional. An array of configuration values. |
|
2108
|
2108
|
*/ |
|
2109
|
2109
|
function tgmpa( $plugins, $config = array() ) { |
|
2110
|
|
- $instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
|
2110
|
+ $instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
2111
|
2111
|
|
|
2112
|
2112
|
foreach ( $plugins as $plugin ) { |
|
2113
|
2113
|
call_user_func( array( $instance, 'register' ), $plugin ); |
|
@@ -2115,17 +2115,17 @@ discard block |
|
|
block discarded – undo |
|
2115
|
2115
|
|
|
2116
|
2116
|
if ( ! empty( $config ) && is_array( $config ) ) { |
|
2117
|
2117
|
// Send out notices for deprecated arguments passed. |
|
2118
|
|
- if ( isset( $config['notices'] ) ) { |
|
|
2118
|
+ if ( isset( $config[ 'notices' ] ) ) { |
|
2119
|
2119
|
_deprecated_argument( __FUNCTION__, '2.2.0', 'The `notices` config parameter was renamed to `has_notices` in TGMPA 2.2.0. Please adjust your configuration.' ); |
|
2120
|
|
- if ( ! isset( $config['has_notices'] ) ) { |
|
2121
|
|
- $config['has_notices'] = $config['notices']; |
|
|
2120
|
+ if ( ! isset( $config[ 'has_notices' ] ) ) { |
|
|
2121
|
+ $config[ 'has_notices' ] = $config[ 'notices' ]; |
|
2122
|
2122
|
} |
|
2123
|
2123
|
} |
|
2124
|
2124
|
|
|
2125
|
|
- if ( isset( $config['parent_menu_slug'] ) ) { |
|
|
2125
|
+ if ( isset( $config[ 'parent_menu_slug' ] ) ) { |
|
2126
|
2126
|
_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.' ); |
|
2127
|
2127
|
} |
|
2128
|
|
- if ( isset( $config['parent_url_slug'] ) ) { |
|
|
2128
|
+ if ( isset( $config[ 'parent_url_slug' ] ) ) { |
|
2129
|
2129
|
_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.' ); |
|
2130
|
2130
|
} |
|
2131
|
2131
|
|
|
@@ -2141,7 +2141,7 @@ discard block |
|
|
block discarded – undo |
|
2141
|
2141
|
* @since 2.2.0 |
|
2142
|
2142
|
*/ |
|
2143
|
2143
|
if ( ! class_exists( 'WP_List_Table' ) ) { |
|
2144
|
|
- require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
|
2144
|
+ require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
2145
|
2145
|
} |
|
2146
|
2146
|
|
|
2147
|
2147
|
if ( ! class_exists( 'TGMPA_List_Table' ) ) { |
|
@@ -2202,7 +2202,7 @@ discard block |
|
|
block discarded – undo |
|
2202
|
2202
|
* @since 2.2.0 |
|
2203
|
2203
|
*/ |
|
2204
|
2204
|
public function __construct() { |
|
2205
|
|
- $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
|
2205
|
+ $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
2206
|
2206
|
|
|
2207
|
2207
|
parent::__construct( |
|
2208
|
2208
|
array( |
|
@@ -2212,8 +2212,8 @@ discard block |
|
|
block discarded – undo |
|
2212
|
2212
|
) |
|
2213
|
2213
|
); |
|
2214
|
2214
|
|
|
2215
|
|
- if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'install', 'update', 'activate' ), true ) ) { |
|
2216
|
|
- $this->view_context = sanitize_key( $_REQUEST['plugin_status'] ); |
|
|
2215
|
+ if ( isset( $_REQUEST[ 'plugin_status' ] ) && in_array( $_REQUEST[ 'plugin_status' ], array( 'install', 'update', 'activate' ), true ) ) { |
|
|
2216
|
+ $this->view_context = sanitize_key( $_REQUEST[ 'plugin_status' ] ); |
|
2217
|
2217
|
} |
|
2218
|
2218
|
|
|
2219
|
2219
|
add_filter( 'tgmpa_table_data_items', array( $this, 'sort_table_items' ) ); |
|
@@ -2260,20 +2260,20 @@ discard block |
|
|
block discarded – undo |
|
2260
|
2260
|
} |
|
2261
|
2261
|
|
|
2262
|
2262
|
foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) { |
|
2263
|
|
- $table_data[ $i ]['sanitized_plugin'] = $plugin['name']; |
|
2264
|
|
- $table_data[ $i ]['slug'] = $slug; |
|
2265
|
|
- $table_data[ $i ]['plugin'] = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>'; |
|
2266
|
|
- $table_data[ $i ]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] ); |
|
2267
|
|
- $table_data[ $i ]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] ); |
|
2268
|
|
- $table_data[ $i ]['status'] = $this->get_plugin_status_text( $slug ); |
|
2269
|
|
- $table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug ); |
|
2270
|
|
- $table_data[ $i ]['minimum_version'] = $plugin['version']; |
|
2271
|
|
- $table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
|
2263
|
+ $table_data[ $i ][ 'sanitized_plugin' ] = $plugin[ 'name' ]; |
|
|
2264
|
+ $table_data[ $i ][ 'slug' ] = $slug; |
|
|
2265
|
+ $table_data[ $i ][ 'plugin' ] = '<strong>'.$this->tgmpa->get_info_link( $slug ).'</strong>'; |
|
|
2266
|
+ $table_data[ $i ][ 'source' ] = $this->get_plugin_source_type_text( $plugin[ 'source_type' ] ); |
|
|
2267
|
+ $table_data[ $i ][ 'type' ] = $this->get_plugin_advise_type_text( $plugin[ 'required' ] ); |
|
|
2268
|
+ $table_data[ $i ][ 'status' ] = $this->get_plugin_status_text( $slug ); |
|
|
2269
|
+ $table_data[ $i ][ 'installed_version' ] = $this->tgmpa->get_installed_version( $slug ); |
|
|
2270
|
+ $table_data[ $i ][ 'minimum_version' ] = $plugin[ 'version' ]; |
|
|
2271
|
+ $table_data[ $i ][ 'available_version' ] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2272
|
2272
|
|
|
2273
|
2273
|
// Prep the upgrade notice info. |
|
2274
|
2274
|
$upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug ); |
|
2275
|
2275
|
if ( ! empty( $upgrade_notice ) ) { |
|
2276
|
|
- $table_data[ $i ]['upgrade_notice'] = $upgrade_notice; |
|
|
2276
|
+ $table_data[ $i ][ 'upgrade_notice' ] = $upgrade_notice; |
|
2277
|
2277
|
|
|
2278
|
2278
|
add_action( "tgmpa_after_plugin_row_$slug", array( $this, 'wp_plugin_update_row' ), 10, 2 ); |
|
2279
|
2279
|
} |
|
@@ -2304,17 +2304,17 @@ discard block |
|
|
block discarded – undo |
|
2304
|
2304
|
// No need to display plugins if they are installed, up-to-date and active. |
|
2305
|
2305
|
continue; |
|
2306
|
2306
|
} else { |
|
2307
|
|
- $plugins['all'][ $slug ] = $plugin; |
|
|
2307
|
+ $plugins[ 'all' ][ $slug ] = $plugin; |
|
2308
|
2308
|
|
|
2309
|
2309
|
if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) { |
|
2310
|
|
- $plugins['install'][ $slug ] = $plugin; |
|
|
2310
|
+ $plugins[ 'install' ][ $slug ] = $plugin; |
|
2311
|
2311
|
} else { |
|
2312
|
2312
|
if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) { |
|
2313
|
|
- $plugins['update'][ $slug ] = $plugin; |
|
|
2313
|
+ $plugins[ 'update' ][ $slug ] = $plugin; |
|
2314
|
2314
|
} |
|
2315
|
2315
|
|
|
2316
|
2316
|
if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
|
2317
|
|
- $plugins['activate'][ $slug ] = $plugin; |
|
|
2317
|
+ $plugins[ 'activate' ][ $slug ] = $plugin; |
|
2318
|
2318
|
} |
|
2319
|
2319
|
} |
|
2320
|
2320
|
} |
|
@@ -2434,8 +2434,8 @@ discard block |
|
|
block discarded – undo |
|
2434
|
2434
|
$name = array(); |
|
2435
|
2435
|
|
|
2436
|
2436
|
foreach ( $items as $i => $plugin ) { |
|
2437
|
|
- $type[ $i ] = $plugin['type']; // Required / recommended. |
|
2438
|
|
- $name[ $i ] = $plugin['sanitized_plugin']; |
|
|
2437
|
+ $type[ $i ] = $plugin[ 'type' ]; // Required / recommended. |
|
|
2438
|
+ $name[ $i ] = $plugin[ 'sanitized_plugin' ]; |
|
2439
|
2439
|
} |
|
2440
|
2440
|
|
|
2441
|
2441
|
array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items ); |
|
@@ -2521,9 +2521,9 @@ discard block |
|
|
block discarded – undo |
|
2521
|
2521
|
public function column_cb( $item ) { |
|
2522
|
2522
|
return sprintf( |
|
2523
|
2523
|
'<input type="checkbox" name="%1$s[]" value="%2$s" id="%3$s" />', |
|
2524
|
|
- esc_attr( $this->_args['singular'] ), |
|
2525
|
|
- esc_attr( $item['slug'] ), |
|
2526
|
|
- esc_attr( $item['sanitized_plugin'] ) |
|
|
2524
|
+ esc_attr( $this->_args[ 'singular' ] ), |
|
|
2525
|
+ esc_attr( $item[ 'slug' ] ), |
|
|
2526
|
+ esc_attr( $item[ 'sanitized_plugin' ] ) |
|
2527
|
2527
|
); |
|
2528
|
2528
|
} |
|
2529
|
2529
|
|
|
@@ -2538,7 +2538,7 @@ discard block |
|
|
block discarded – undo |
|
2538
|
2538
|
public function column_plugin( $item ) { |
|
2539
|
2539
|
return sprintf( |
|
2540
|
2540
|
'%1$s %2$s', |
|
2541
|
|
- $item['plugin'], |
|
|
2541
|
+ $item[ 'plugin' ], |
|
2542
|
2542
|
$this->row_actions( $this->get_row_actions( $item ), true ) |
|
2543
|
2543
|
); |
|
2544
|
2544
|
} |
|
@@ -2554,38 +2554,38 @@ discard block |
|
|
block discarded – undo |
|
2554
|
2554
|
public function column_version( $item ) { |
|
2555
|
2555
|
$output = array(); |
|
2556
|
2556
|
|
|
2557
|
|
- if ( $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
2558
|
|
- $installed = ! empty( $item['installed_version'] ) ? $item['installed_version'] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
|
2557
|
+ if ( $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
|
2558
|
+ $installed = ! empty( $item[ 'installed_version' ] ) ? $item[ 'installed_version' ] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
2559
|
2559
|
|
|
2560
|
2560
|
$color = ''; |
|
2561
|
|
- if ( ! empty( $item['minimum_version'] ) && $this->tgmpa->does_plugin_require_update( $item['slug'] ) ) { |
|
|
2561
|
+ if ( ! empty( $item[ 'minimum_version' ] ) && $this->tgmpa->does_plugin_require_update( $item[ 'slug' ] ) ) { |
|
2562
|
2562
|
$color = ' color: #ff0000; font-weight: bold;'; |
|
2563
|
2563
|
} |
|
2564
|
2564
|
|
|
2565
|
|
- $output[] = sprintf( |
|
2566
|
|
- '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Installed version:', 'tgmpa' ) . '</p>', |
|
|
2565
|
+ $output[ ] = sprintf( |
|
|
2566
|
+ '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Installed version:', 'tgmpa' ).'</p>', |
|
2567
|
2567
|
$color, |
|
2568
|
2568
|
$installed |
|
2569
|
2569
|
); |
|
2570
|
2570
|
} |
|
2571
|
2571
|
|
|
2572
|
|
- if ( ! empty( $item['minimum_version'] ) ) { |
|
2573
|
|
- $output[] = sprintf( |
|
2574
|
|
- '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>' . __( 'Minimum required version:', 'tgmpa' ) . '</p>', |
|
2575
|
|
- $item['minimum_version'] |
|
|
2572
|
+ if ( ! empty( $item[ 'minimum_version' ] ) ) { |
|
|
2573
|
+ $output[ ] = sprintf( |
|
|
2574
|
+ '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>'.__( 'Minimum required version:', 'tgmpa' ).'</p>', |
|
|
2575
|
+ $item[ 'minimum_version' ] |
|
2576
|
2576
|
); |
|
2577
|
2577
|
} |
|
2578
|
2578
|
|
|
2579
|
|
- if ( ! empty( $item['available_version'] ) ) { |
|
|
2579
|
+ if ( ! empty( $item[ 'available_version' ] ) ) { |
|
2580
|
2580
|
$color = ''; |
|
2581
|
|
- if ( ! empty( $item['minimum_version'] ) && version_compare( $item['available_version'], $item['minimum_version'], '>=' ) ) { |
|
|
2581
|
+ if ( ! empty( $item[ 'minimum_version' ] ) && version_compare( $item[ 'available_version' ], $item[ 'minimum_version' ], '>=' ) ) { |
|
2582
|
2582
|
$color = ' color: #71C671; font-weight: bold;'; |
|
2583
|
2583
|
} |
|
2584
|
2584
|
|
|
2585
|
|
- $output[] = sprintf( |
|
2586
|
|
- '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Available version:', 'tgmpa' ) . '</p>', |
|
|
2585
|
+ $output[ ] = sprintf( |
|
|
2586
|
+ '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Available version:', 'tgmpa' ).'</p>', |
|
2587
|
2587
|
$color, |
|
2588
|
|
- $item['available_version'] |
|
|
2588
|
+ $item[ 'available_version' ] |
|
2589
|
2589
|
); |
|
2590
|
2590
|
} |
|
2591
|
2591
|
|
|
@@ -2606,7 +2606,7 @@ discard block |
|
|
block discarded – undo |
|
2606
|
2606
|
* @since 2.2.0 |
|
2607
|
2607
|
*/ |
|
2608
|
2608
|
public function no_items() { |
|
2609
|
|
- 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>'; |
|
|
2609
|
+ 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>'; |
|
2610
|
2610
|
echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
|
2611
|
2611
|
} |
|
2612
|
2612
|
|
|
@@ -2626,8 +2626,8 @@ discard block |
|
|
block discarded – undo |
|
2626
|
2626
|
); |
|
2627
|
2627
|
|
|
2628
|
2628
|
if ( 'all' === $this->view_context || 'update' === $this->view_context ) { |
|
2629
|
|
- $columns['version'] = __( 'Version', 'tgmpa' ); |
|
2630
|
|
- $columns['status'] = __( 'Status', 'tgmpa' ); |
|
|
2629
|
+ $columns[ 'version' ] = __( 'Version', 'tgmpa' ); |
|
|
2630
|
+ $columns[ 'status' ] = __( 'Status', 'tgmpa' ); |
|
2631
|
2631
|
} |
|
2632
|
2632
|
|
|
2633
|
2633
|
return apply_filters( 'tgmpa_table_columns', $columns ); |
|
@@ -2674,20 +2674,20 @@ discard block |
|
|
block discarded – undo |
|
2674
|
2674
|
$action_links = array(); |
|
2675
|
2675
|
|
|
2676
|
2676
|
// Display the 'Install' action link if the plugin is not yet available. |
|
2677
|
|
- if ( ! $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
|
2677
|
+ if ( ! $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
2678
|
2678
|
/* translators: %s: plugin name in screen reader markup */ |
|
2679
|
|
- $actions['install'] = __( 'Install %s', 'tgmpa' ); |
|
|
2679
|
+ $actions[ 'install' ] = __( 'Install %s', 'tgmpa' ); |
|
2680
|
2680
|
} else { |
|
2681
|
2681
|
// Display the 'Update' action link if an update is available and WP complies with plugin minimum. |
|
2682
|
|
- if ( false !== $this->tgmpa->does_plugin_have_update( $item['slug'] ) && $this->tgmpa->can_plugin_update( $item['slug'] ) ) { |
|
|
2682
|
+ if ( false !== $this->tgmpa->does_plugin_have_update( $item[ 'slug' ] ) && $this->tgmpa->can_plugin_update( $item[ 'slug' ] ) ) { |
|
2683
|
2683
|
/* translators: %s: plugin name in screen reader markup */ |
|
2684
|
|
- $actions['update'] = __( 'Update %s', 'tgmpa' ); |
|
|
2684
|
+ $actions[ 'update' ] = __( 'Update %s', 'tgmpa' ); |
|
2685
|
2685
|
} |
|
2686
|
2686
|
|
|
2687
|
2687
|
// Display the 'Activate' action link, but only if the plugin meets the minimum version. |
|
2688
|
|
- if ( $this->tgmpa->can_plugin_activate( $item['slug'] ) ) { |
|
|
2688
|
+ if ( $this->tgmpa->can_plugin_activate( $item[ 'slug' ] ) ) { |
|
2689
|
2689
|
/* translators: %s: plugin name in screen reader markup */ |
|
2690
|
|
- $actions['activate'] = __( 'Activate %s', 'tgmpa' ); |
|
|
2690
|
+ $actions[ 'activate' ] = __( 'Activate %s', 'tgmpa' ); |
|
2691
|
2691
|
} |
|
2692
|
2692
|
} |
|
2693
|
2693
|
|
|
@@ -2696,24 +2696,24 @@ discard block |
|
|
block discarded – undo |
|
2696
|
2696
|
$nonce_url = wp_nonce_url( |
|
2697
|
2697
|
add_query_arg( |
|
2698
|
2698
|
array( |
|
2699
|
|
- 'plugin' => urlencode( $item['slug'] ), |
|
2700
|
|
- 'tgmpa-' . $action => $action . '-plugin', |
|
|
2699
|
+ 'plugin' => urlencode( $item[ 'slug' ] ), |
|
|
2700
|
+ 'tgmpa-'.$action => $action.'-plugin', |
|
2701
|
2701
|
), |
|
2702
|
2702
|
$this->tgmpa->get_tgmpa_url() |
|
2703
|
2703
|
), |
|
2704
|
|
- 'tgmpa-' . $action, |
|
|
2704
|
+ 'tgmpa-'.$action, |
|
2705
|
2705
|
'tgmpa-nonce' |
|
2706
|
2706
|
); |
|
2707
|
2707
|
|
|
2708
|
2708
|
$action_links[ $action ] = sprintf( |
|
2709
|
|
- '<a href="%1$s">' . esc_html( $text ) . '</a>', |
|
|
2709
|
+ '<a href="%1$s">'.esc_html( $text ).'</a>', |
|
2710
|
2710
|
esc_url( $nonce_url ), |
|
2711
|
|
- '<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>' |
|
|
2711
|
+ '<span class="screen-reader-text">'.esc_html( $item[ 'sanitized_plugin' ] ).'</span>' |
|
2712
|
2712
|
); |
|
2713
|
2713
|
} |
|
2714
|
2714
|
|
|
2715
|
2715
|
$prefix = ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) ? 'network_admin_' : ''; |
|
2716
|
|
- return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item['slug'], $item, $this->view_context ); |
|
|
2716
|
+ return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item[ 'slug' ], $item, $this->view_context ); |
|
2717
|
2717
|
} |
|
2718
|
2718
|
|
|
2719
|
2719
|
/** |
|
@@ -2734,7 +2734,7 @@ discard block |
|
|
block discarded – undo |
|
2734
|
2734
|
* |
|
2735
|
2735
|
* @since 2.5.0 |
|
2736
|
2736
|
*/ |
|
2737
|
|
- do_action( "tgmpa_after_plugin_row_{$item['slug']}", $item['slug'], $item, $this->view_context ); |
|
|
2737
|
+ do_action( "tgmpa_after_plugin_row_{$item[ 'slug' ]}", $item[ 'slug' ], $item, $this->view_context ); |
|
2738
|
2738
|
} |
|
2739
|
2739
|
|
|
2740
|
2740
|
/** |
|
@@ -2749,7 +2749,7 @@ discard block |
|
|
block discarded – undo |
|
2749
|
2749
|
* @return null Return early if upgrade notice is empty. |
|
2750
|
2750
|
*/ |
|
2751
|
2751
|
public function wp_plugin_update_row( $slug, $item ) { |
|
2752
|
|
- if ( empty( $item['upgrade_notice'] ) ) { |
|
|
2752
|
+ if ( empty( $item[ 'upgrade_notice' ] ) ) { |
|
2753
|
2753
|
return; |
|
2754
|
2754
|
} |
|
2755
|
2755
|
|
|
@@ -2758,7 +2758,7 @@ discard block |
|
|
block discarded – undo |
|
2758
|
2758
|
<td colspan="', absint( $this->get_column_count() ), '" class="plugin-update colspanchange"> |
|
2759
|
2759
|
<div class="update-message">', |
|
2760
|
2760
|
esc_html__( 'Upgrade message from the plugin author:', 'tgmpa' ), |
|
2761
|
|
- ' <strong>', wp_kses_data( $item['upgrade_notice'] ), '</strong> |
|
|
2761
|
+ ' <strong>', wp_kses_data( $item[ 'upgrade_notice' ] ), '</strong> |
|
2762
|
2762
|
</div> |
|
2763
|
2763
|
</td> |
|
2764
|
2764
|
</tr>'; |
|
@@ -2790,16 +2790,16 @@ discard block |
|
|
block discarded – undo |
|
2790
|
2790
|
|
|
2791
|
2791
|
if ( 'update' !== $this->view_context && 'activate' !== $this->view_context ) { |
|
2792
|
2792
|
if ( current_user_can( 'install_plugins' ) ) { |
|
2793
|
|
- $actions['tgmpa-bulk-install'] = __( 'Install', 'tgmpa' ); |
|
|
2793
|
+ $actions[ 'tgmpa-bulk-install' ] = __( 'Install', 'tgmpa' ); |
|
2794
|
2794
|
} |
|
2795
|
2795
|
} |
|
2796
|
2796
|
|
|
2797
|
2797
|
if ( 'install' !== $this->view_context ) { |
|
2798
|
2798
|
if ( current_user_can( 'update_plugins' ) ) { |
|
2799
|
|
- $actions['tgmpa-bulk-update'] = __( 'Update', 'tgmpa' ); |
|
|
2799
|
+ $actions[ 'tgmpa-bulk-update' ] = __( 'Update', 'tgmpa' ); |
|
2800
|
2800
|
} |
|
2801
|
2801
|
if ( current_user_can( 'activate_plugins' ) ) { |
|
2802
|
|
- $actions['tgmpa-bulk-activate'] = __( 'Activate', 'tgmpa' ); |
|
|
2802
|
+ $actions[ 'tgmpa-bulk-activate' ] = __( 'Activate', 'tgmpa' ); |
|
2803
|
2803
|
} |
|
2804
|
2804
|
} |
|
2805
|
2805
|
|
|
@@ -2818,7 +2818,7 @@ discard block |
|
|
block discarded – undo |
|
2818
|
2818
|
// Bulk installation process. |
|
2819
|
2819
|
if ( 'tgmpa-bulk-install' === $this->current_action() || 'tgmpa-bulk-update' === $this->current_action() ) { |
|
2820
|
2820
|
|
|
2821
|
|
- check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
|
2821
|
+ check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2822
|
2822
|
|
|
2823
|
2823
|
$install_type = 'install'; |
|
2824
|
2824
|
if ( 'tgmpa-bulk-update' === $this->current_action() ) { |
|
@@ -2828,7 +2828,7 @@ discard block |
|
|
block discarded – undo |
|
2828
|
2828
|
$plugins_to_install = array(); |
|
2829
|
2829
|
|
|
2830
|
2830
|
// Did user actually select any plugins to install/update ? |
|
2831
|
|
- if ( empty( $_POST['plugin'] ) ) { |
|
|
2831
|
+ if ( empty( $_POST[ 'plugin' ] ) ) { |
|
2832
|
2832
|
if ( 'install' === $install_type ) { |
|
2833
|
2833
|
$message = __( 'No plugins were selected to be installed. No action taken.', 'tgmpa' ); |
|
2834
|
2834
|
} else { |
|
@@ -2840,11 +2840,11 @@ discard block |
|
|
block discarded – undo |
|
2840
|
2840
|
return false; |
|
2841
|
2841
|
} |
|
2842
|
2842
|
|
|
2843
|
|
- if ( is_array( $_POST['plugin'] ) ) { |
|
2844
|
|
- $plugins_to_install = (array) $_POST['plugin']; |
|
2845
|
|
- } elseif ( is_string( $_POST['plugin'] ) ) { |
|
|
2843
|
+ if ( is_array( $_POST[ 'plugin' ] ) ) { |
|
|
2844
|
+ $plugins_to_install = (array) $_POST[ 'plugin' ]; |
|
|
2845
|
+ } elseif ( is_string( $_POST[ 'plugin' ] ) ) { |
|
2846
|
2846
|
// Received via Filesystem page - un-flatten array (WP bug #19643). |
|
2847
|
|
- $plugins_to_install = explode( ',', $_POST['plugin'] ); |
|
|
2847
|
+ $plugins_to_install = explode( ',', $_POST[ 'plugin' ] ); |
|
2848
|
2848
|
} |
|
2849
|
2849
|
|
|
2850
|
2850
|
// Sanitize the received input. |
|
@@ -2886,11 +2886,11 @@ discard block |
|
|
block discarded – undo |
|
2886
|
2886
|
// Pass all necessary information if WP_Filesystem is needed. |
|
2887
|
2887
|
$url = wp_nonce_url( |
|
2888
|
2888
|
$this->tgmpa->get_tgmpa_url(), |
|
2889
|
|
- 'bulk-' . $this->_args['plural'] |
|
|
2889
|
+ 'bulk-'.$this->_args[ 'plural' ] |
|
2890
|
2890
|
); |
|
2891
|
2891
|
|
|
2892
|
2892
|
// Give validated data back to $_POST which is the only place the filesystem looks for extra fields. |
|
2893
|
|
- $_POST['plugin'] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
|
2893
|
+ $_POST[ 'plugin' ] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
2894
|
2894
|
|
|
2895
|
2895
|
$method = ''; // Leave blank so WP_Filesystem can populate it as necessary. |
|
2896
|
2896
|
$fields = array_keys( $_POST ); // Extra fields to pass to WP_Filesystem. |
|
@@ -2917,22 +2917,22 @@ discard block |
|
|
block discarded – undo |
|
2917
|
2917
|
|
|
2918
|
2918
|
// Prepare the data for validated plugins for the install/upgrade. |
|
2919
|
2919
|
foreach ( $plugins_to_install as $slug ) { |
|
2920
|
|
- $name = $this->tgmpa->plugins[ $slug ]['name']; |
|
|
2920
|
+ $name = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
2921
|
2921
|
$source = $this->tgmpa->get_download_url( $slug ); |
|
2922
|
2922
|
|
|
2923
|
2923
|
if ( ! empty( $name ) && ! empty( $source ) ) { |
|
2924
|
|
- $names[] = $name; |
|
|
2924
|
+ $names[ ] = $name; |
|
2925
|
2925
|
|
|
2926
|
2926
|
switch ( $install_type ) { |
|
2927
|
2927
|
|
|
2928
|
2928
|
case 'install': |
|
2929
|
|
- $sources[] = $source; |
|
|
2929
|
+ $sources[ ] = $source; |
|
2930
|
2930
|
break; |
|
2931
|
2931
|
|
|
2932
|
2932
|
case 'update': |
|
2933
|
|
- $file_paths[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
|
2933
|
+ $file_paths[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
2934
|
2934
|
$to_inject[ $slug ] = $this->tgmpa->plugins[ $slug ]; |
|
2935
|
|
- $to_inject[ $slug ]['source'] = $source; |
|
|
2935
|
+ $to_inject[ $slug ][ 'source' ] = $source; |
|
2936
|
2936
|
break; |
|
2937
|
2937
|
} |
|
2938
|
2938
|
} |
|
@@ -2944,7 +2944,7 @@ discard block |
|
|
block discarded – undo |
|
2944
|
2944
|
new TGMPA_Bulk_Installer_Skin( |
|
2945
|
2945
|
array( |
|
2946
|
2946
|
'url' => esc_url_raw( $this->tgmpa->get_tgmpa_url() ), |
|
2947
|
|
- 'nonce' => 'bulk-' . $this->_args['plural'], |
|
|
2947
|
+ 'nonce' => 'bulk-'.$this->_args[ 'plural' ], |
|
2948
|
2948
|
'names' => $names, |
|
2949
|
2949
|
'install_type' => $install_type, |
|
2950
|
2950
|
) |
|
@@ -2977,10 +2977,10 @@ discard block |
|
|
block discarded – undo |
|
2977
|
2977
|
|
|
2978
|
2978
|
// Bulk activation process. |
|
2979
|
2979
|
if ( 'tgmpa-bulk-activate' === $this->current_action() ) { |
|
2980
|
|
- check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
|
2980
|
+ check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2981
|
2981
|
|
|
2982
|
2982
|
// Did user actually select any plugins to activate ? |
|
2983
|
|
- if ( empty( $_POST['plugin'] ) ) { |
|
|
2983
|
+ if ( empty( $_POST[ 'plugin' ] ) ) { |
|
2984
|
2984
|
echo '<div id="message" class="error"><p>', esc_html__( 'No plugins were selected to be activated. No action taken.', 'tgmpa' ), '</p></div>'; |
|
2985
|
2985
|
|
|
2986
|
2986
|
return false; |
|
@@ -2988,8 +2988,8 @@ discard block |
|
|
block discarded – undo |
|
2988
|
2988
|
|
|
2989
|
2989
|
// Grab plugin data from $_POST. |
|
2990
|
2990
|
$plugins = array(); |
|
2991
|
|
- if ( isset( $_POST['plugin'] ) ) { |
|
2992
|
|
- $plugins = array_map( 'urldecode', (array) $_POST['plugin'] ); |
|
|
2991
|
+ if ( isset( $_POST[ 'plugin' ] ) ) { |
|
|
2992
|
+ $plugins = array_map( 'urldecode', (array) $_POST[ 'plugin' ] ); |
|
2993
|
2993
|
$plugins = array_map( array( $this->tgmpa, 'sanitize_key' ), $plugins ); |
|
2994
|
2994
|
} |
|
2995
|
2995
|
|
|
@@ -2999,8 +2999,8 @@ discard block |
|
|
block discarded – undo |
|
2999
|
2999
|
// Grab the file paths for the selected & inactive plugins from the registration array. |
|
3000
|
3000
|
foreach ( $plugins as $slug ) { |
|
3001
|
3001
|
if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
|
3002
|
|
- $plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
3003
|
|
- $plugin_names[] = $this->tgmpa->plugins[ $slug ]['name']; |
|
|
3002
|
+ $plugins_to_activate[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
|
3003
|
+ $plugin_names[ ] = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
3004
|
3004
|
} |
|
3005
|
3005
|
} |
|
3006
|
3006
|
unset( $slug ); |
|
@@ -3021,7 +3021,7 @@ discard block |
|
|
block discarded – undo |
|
3021
|
3021
|
$count = count( $plugin_names ); // Count so we can use _n function. |
|
3022
|
3022
|
$plugin_names = array_map( array( 'TGMPA_Utils', 'wrap_in_strong' ), $plugin_names ); |
|
3023
|
3023
|
$last_plugin = array_pop( $plugin_names ); // Pop off last name to prep for readability. |
|
3024
|
|
- $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
|
3024
|
+ $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); |
|
3025
|
3025
|
|
|
3026
|
3026
|
printf( // WPCS: xss ok. |
|
3027
|
3027
|
'<div id="message" class="updated"><p>%1$s %2$s.</p></div>', |
|
@@ -3124,16 +3124,16 @@ discard block |
|
|
block discarded – undo |
|
3124
|
3124
|
*/ |
|
3125
|
3125
|
function tgmpa_load_bulk_installer() { |
|
3126
|
3126
|
// Silently fail if 2.5+ is loaded *after* an older version. |
|
3127
|
|
- if ( ! isset( $GLOBALS['tgmpa'] ) ) { |
|
|
3127
|
+ if ( ! isset( $GLOBALS[ 'tgmpa' ] ) ) { |
|
3128
|
3128
|
return; |
|
3129
|
3129
|
} |
|
3130
|
3130
|
|
|
3131
|
3131
|
// Get TGMPA class instance. |
|
3132
|
|
- $tgmpa_instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
|
3132
|
+ $tgmpa_instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3133
|
3133
|
|
|
3134
|
|
- if ( isset( $_GET['page'] ) && $tgmpa_instance->menu === $_GET['page'] ) { |
|
|
3134
|
+ if ( isset( $_GET[ 'page' ] ) && $tgmpa_instance->menu === $_GET[ 'page' ] ) { |
|
3135
|
3135
|
if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
|
3136
|
|
- require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
|
3136
|
+ require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
3137
|
3137
|
} |
|
3138
|
3138
|
|
|
3139
|
3139
|
if ( ! class_exists( 'TGMPA_Bulk_Installer' ) ) { |
|
@@ -3200,11 +3200,11 @@ discard block |
|
|
block discarded – undo |
|
3200
|
3200
|
*/ |
|
3201
|
3201
|
public function __construct( $skin = null ) { |
|
3202
|
3202
|
// Get TGMPA class instance. |
|
3203
|
|
- $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
|
3203
|
+ $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3204
|
3204
|
|
|
3205
|
3205
|
parent::__construct( $skin ); |
|
3206
|
3206
|
|
|
3207
|
|
- if ( isset( $this->skin->options['install_type'] ) && 'update' === $this->skin->options['install_type'] ) { |
|
|
3207
|
+ if ( isset( $this->skin->options[ 'install_type' ] ) && 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3208
|
3208
|
$this->clear_destination = true; |
|
3209
|
3209
|
} |
|
3210
|
3210
|
|
|
@@ -3221,8 +3221,8 @@ discard block |
|
|
block discarded – undo |
|
3221
|
3221
|
* @since 2.2.0 |
|
3222
|
3222
|
*/ |
|
3223
|
3223
|
public function activate_strings() { |
|
3224
|
|
- $this->strings['activation_failed'] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
3225
|
|
- $this->strings['activation_success'] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
|
3224
|
+ $this->strings[ 'activation_failed' ] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
|
3225
|
+ $this->strings[ 'activation_success' ] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
3226
|
3226
|
} |
|
3227
|
3227
|
|
|
3228
|
3228
|
/** |
|
@@ -3240,7 +3240,7 @@ discard block |
|
|
block discarded – undo |
|
3240
|
3240
|
|
|
3241
|
3241
|
// Reset the strings in case we changed one during automatic activation. |
|
3242
|
3242
|
if ( $this->tgmpa->is_automatic ) { |
|
3243
|
|
- if ( 'update' === $this->skin->options['install_type'] ) { |
|
|
3243
|
+ if ( 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3244
|
3244
|
$this->upgrade_strings(); |
|
3245
|
3245
|
} else { |
|
3246
|
3246
|
$this->install_strings(); |
|
@@ -3398,7 +3398,7 @@ discard block |
|
|
block discarded – undo |
|
3398
|
3398
|
remove_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 ); |
|
3399
|
3399
|
|
|
3400
|
3400
|
// Force refresh of plugin update information. |
|
3401
|
|
- wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); |
|
|
3401
|
+ wp_clean_plugins_cache( $parsed_args[ 'clear_update_cache' ] ); |
|
3402
|
3402
|
|
|
3403
|
3403
|
return $results; |
|
3404
|
3404
|
} |
|
@@ -3449,13 +3449,13 @@ discard block |
|
|
block discarded – undo |
|
3449
|
3449
|
$activate = activate_plugin( $plugin_info ); |
|
3450
|
3450
|
|
|
3451
|
3451
|
// Adjust the success string based on the activation result. |
|
3452
|
|
- $this->strings['process_success'] = $this->strings['process_success'] . "<br />\n"; |
|
|
3452
|
+ $this->strings[ 'process_success' ] = $this->strings[ 'process_success' ]."<br />\n"; |
|
3453
|
3453
|
|
|
3454
|
3454
|
if ( is_wp_error( $activate ) ) { |
|
3455
|
3455
|
$this->skin->error( $activate ); |
|
3456
|
|
- $this->strings['process_success'] .= $this->strings['activation_failed']; |
|
|
3456
|
+ $this->strings[ 'process_success' ] .= $this->strings[ 'activation_failed' ]; |
|
3457
|
3457
|
} else { |
|
3458
|
|
- $this->strings['process_success'] .= $this->strings['activation_success']; |
|
|
3458
|
+ $this->strings[ 'process_success' ] .= $this->strings[ 'activation_success' ]; |
|
3459
|
3459
|
} |
|
3460
|
3460
|
} |
|
3461
|
3461
|
} |
|
@@ -3531,7 +3531,7 @@ discard block |
|
|
block discarded – undo |
|
3531
|
3531
|
*/ |
|
3532
|
3532
|
public function __construct( $args = array() ) { |
|
3533
|
3533
|
// Get TGMPA class instance. |
|
3534
|
|
- $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
|
3534
|
+ $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3535
|
3535
|
|
|
3536
|
3536
|
// Parse default and new args. |
|
3537
|
3537
|
$defaults = array( |
|
@@ -3540,10 +3540,10 @@ discard block |
|
|
block discarded – undo |
|
3540
|
3540
|
'names' => array(), |
|
3541
|
3541
|
'install_type' => 'install', |
|
3542
|
3542
|
); |
|
3543
|
|
- $args = wp_parse_args( $args, $defaults ); |
|
|
3543
|
+ $args = wp_parse_args( $args, $defaults ); |
|
3544
|
3544
|
|
|
3545
|
3545
|
// Set plugin names to $this->plugin_names property. |
|
3546
|
|
- $this->plugin_names = $args['names']; |
|
|
3546
|
+ $this->plugin_names = $args[ 'names' ]; |
|
3547
|
3547
|
|
|
3548
|
3548
|
// Extract the new args. |
|
3549
|
3549
|
parent::__construct( $args ); |
|
@@ -3558,32 +3558,32 @@ discard block |
|
|
block discarded – undo |
|
3558
|
3558
|
* @since 2.2.0 |
|
3559
|
3559
|
*/ |
|
3560
|
3560
|
public function add_strings() { |
|
3561
|
|
- if ( 'update' === $this->options['install_type'] ) { |
|
|
3561
|
+ if ( 'update' === $this->options[ 'install_type' ] ) { |
|
3562
|
3562
|
parent::add_strings(); |
|
3563
|
3563
|
/* translators: 1: plugin name, 2: action number 3: total number of actions. */ |
|
3564
|
|
- $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
|
3564
|
+ $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3565
|
3565
|
} else { |
|
3566
|
3566
|
/* translators: 1: plugin name, 2: error message. */ |
|
3567
|
|
- $this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
|
3567
|
+ $this->upgrader->strings[ 'skin_update_failed_error' ] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
3568
|
3568
|
/* translators: 1: plugin name. */ |
|
3569
|
|
- $this->upgrader->strings['skin_update_failed'] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
|
3569
|
+ $this->upgrader->strings[ 'skin_update_failed' ] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
3570
|
3570
|
|
|
3571
|
3571
|
if ( $this->tgmpa->is_automatic ) { |
|
3572
|
3572
|
// Automatic activation strings. |
|
3573
|
|
- $this->upgrader->strings['skin_upgrade_start'] = __( 'The installation and activation process is starting. This process may take a while on some hosts, so please be patient.', 'tgmpa' ); |
|
|
3573
|
+ $this->upgrader->strings[ 'skin_upgrade_start' ] = __( 'The installation and activation process is starting. This process may take a while on some hosts, so please be patient.', 'tgmpa' ); |
|
3574
|
3574
|
/* translators: 1: plugin name. */ |
|
3575
|
|
- $this->upgrader->strings['skin_update_successful'] = __( '%1$s installed and activated successfully.', 'tgmpa' ) . ' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>' . esc_html__( 'Show Details', 'tgmpa' ) . '</span><span class="hidden">' . esc_html__( 'Hide Details', 'tgmpa' ) . '</span>.</a>'; |
|
3576
|
|
- $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
|
3575
|
+ $this->upgrader->strings[ 'skin_update_successful' ] = __( '%1$s installed and activated successfully.', 'tgmpa' ).' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>'.esc_html__( 'Show Details', 'tgmpa' ).'</span><span class="hidden">'.esc_html__( 'Hide Details', 'tgmpa' ).'</span>.</a>'; |
|
|
3576
|
+ $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
3577
|
3577
|
/* translators: 1: plugin name, 2: action number 3: total number of of actions. */ |
|
3578
|
|
- $this->upgrader->strings['skin_before_update_header'] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
|
3578
|
+ $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3579
|
3579
|
} else { |
|
3580
|
3580
|
// Default installation strings. |
|
3581
|
|
- $this->upgrader->strings['skin_upgrade_start'] = __( 'The installation process is starting. This process may take a while on some hosts, so please be patient.', 'tgmpa' ); |
|
|
3581
|
+ $this->upgrader->strings[ 'skin_upgrade_start' ] = __( 'The installation process is starting. This process may take a while on some hosts, so please be patient.', 'tgmpa' ); |
|
3582
|
3582
|
/* translators: 1: plugin name. */ |
|
3583
|
|
- $this->upgrader->strings['skin_update_successful'] = esc_html__( '%1$s installed successfully.', 'tgmpa' ) . ' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>' . esc_html__( 'Show Details', 'tgmpa' ) . '</span><span class="hidden">' . esc_html__( 'Hide Details', 'tgmpa' ) . '</span>.</a>'; |
|
3584
|
|
- $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations have been completed.', 'tgmpa' ); |
|
|
3583
|
+ $this->upgrader->strings[ 'skin_update_successful' ] = esc_html__( '%1$s installed successfully.', 'tgmpa' ).' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>'.esc_html__( 'Show Details', 'tgmpa' ).'</span><span class="hidden">'.esc_html__( 'Hide Details', 'tgmpa' ).'</span>.</a>'; |
|
|
3584
|
+ $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations have been completed.', 'tgmpa' ); |
|
3585
|
3585
|
/* translators: 1: plugin name, 2: action number 3: total number of of actions. */ |
|
3586
|
|
- $this->upgrader->strings['skin_before_update_header'] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
|
3586
|
+ $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3587
|
3587
|
} |
|
3588
|
3588
|
} |
|
3589
|
3589
|
} |
|
@@ -3641,12 +3641,12 @@ discard block |
|
|
block discarded – undo |
|
3641
|
3641
|
if ( $this->tgmpa->is_tgmpa_complete() ) { |
|
3642
|
3642
|
// All plugins are active, so we display the complete string and hide the menu to protect users. |
|
3643
|
3643
|
echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
|
3644
|
|
- $update_actions['dashboard'] = sprintf( |
|
3645
|
|
- esc_html( $this->tgmpa->strings['complete'] ), |
|
3646
|
|
- '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' |
|
|
3644
|
+ $update_actions[ 'dashboard' ] = sprintf( |
|
|
3645
|
+ esc_html( $this->tgmpa->strings[ 'complete' ] ), |
|
|
3646
|
+ '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' |
|
3647
|
3647
|
); |
|
3648
|
3648
|
} else { |
|
3649
|
|
- $update_actions['tgmpa_page'] = '<a href="' . esc_url( $this->tgmpa->get_tgmpa_url() ) . '" target="_parent">' . esc_html( $this->tgmpa->strings['return'] ) . '</a>'; |
|
|
3649
|
+ $update_actions[ 'tgmpa_page' ] = '<a href="'.esc_url( $this->tgmpa->get_tgmpa_url() ).'" target="_parent">'.esc_html( $this->tgmpa->strings[ 'return' ] ).'</a>'; |
|
3650
|
3650
|
} |
|
3651
|
3651
|
|
|
3652
|
3652
|
/** |
|
@@ -3736,7 +3736,7 @@ discard block |
|
|
block discarded – undo |
|
3736
|
3736
|
* @return string |
|
3737
|
3737
|
*/ |
|
3738
|
3738
|
public static function wrap_in_em( $string ) { |
|
3739
|
|
- return '<em>' . wp_kses_post( $string ) . '</em>'; |
|
|
3739
|
+ return '<em>'.wp_kses_post( $string ).'</em>'; |
|
3740
|
3740
|
} |
|
3741
|
3741
|
|
|
3742
|
3742
|
/** |
|
@@ -3750,7 +3750,7 @@ discard block |
|
|
block discarded – undo |
|
3750
|
3750
|
* @return string |
|
3751
|
3751
|
*/ |
|
3752
|
3752
|
public static function wrap_in_strong( $string ) { |
|
3753
|
|
- return '<strong>' . wp_kses_post( $string ) . '</strong>'; |
|
|
3753
|
+ return '<strong>'.wp_kses_post( $string ).'</strong>'; |
|
3754
|
3754
|
} |
|
3755
|
3755
|
|
|
3756
|
3756
|
/** |
|
@@ -3787,7 +3787,7 @@ discard block |
|
|
block discarded – undo |
|
3787
|
3787
|
*/ |
|
3788
|
3788
|
protected static function emulate_filter_bool( $value ) { |
|
3789
|
3789
|
// @codingStandardsIgnoreStart |
|
3790
|
|
- static $true = array( |
|
|
3790
|
+ static $true = array( |
|
3791
|
3791
|
'1', |
|
3792
|
3792
|
'true', 'True', 'TRUE', |
|
3793
|
3793
|
'y', 'Y', |