|
@@ -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 ) ); |
|
@@ -446,15 +446,15 @@ discard block |
|
|
block discarded – undo |
|
446
|
446
|
public function add_plugin_action_link_filters() { |
|
447
|
447
|
foreach ( $this->plugins as $slug => $plugin ) { |
|
448
|
448
|
if ( false === $this->can_plugin_activate( $slug ) ) { |
|
449
|
|
- add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_activate' ), 20 ); |
|
|
449
|
+ add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_activate' ), 20 ); |
|
450
|
450
|
} |
|
451
|
451
|
|
|
452
|
|
- if ( true === $plugin['force_activation'] ) { |
|
453
|
|
- add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_deactivate' ), 20 ); |
|
|
452
|
+ if ( true === $plugin[ 'force_activation' ] ) { |
|
|
453
|
+ add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_deactivate' ), 20 ); |
|
454
|
454
|
} |
|
455
|
455
|
|
|
456
|
456
|
if ( false !== $this->does_plugin_require_update( $slug ) ) { |
|
457
|
|
- add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_update' ), 20 ); |
|
|
457
|
+ add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_update' ), 20 ); |
|
458
|
458
|
} |
|
459
|
459
|
} |
|
460
|
460
|
} |
|
@@ -469,7 +469,7 @@ discard block |
|
|
block discarded – undo |
|
469
|
469
|
* @return array |
|
470
|
470
|
*/ |
|
471
|
471
|
public function filter_plugin_action_links_activate( $actions ) { |
|
472
|
|
- unset( $actions['activate'] ); |
|
|
472
|
+ unset( $actions[ 'activate' ] ); |
|
473
|
473
|
|
|
474
|
474
|
return $actions; |
|
475
|
475
|
} |
|
@@ -483,7 +483,7 @@ discard block |
|
|
block discarded – undo |
|
483
|
483
|
* @return array |
|
484
|
484
|
*/ |
|
485
|
485
|
public function filter_plugin_action_links_deactivate( $actions ) { |
|
486
|
|
- unset( $actions['deactivate'] ); |
|
|
486
|
+ unset( $actions[ 'deactivate' ] ); |
|
487
|
487
|
|
|
488
|
488
|
return $actions; |
|
489
|
489
|
} |
|
@@ -498,7 +498,7 @@ discard block |
|
|
block discarded – undo |
|
498
|
498
|
* @return array |
|
499
|
499
|
*/ |
|
500
|
500
|
public function filter_plugin_action_links_update( $actions ) { |
|
501
|
|
- $actions['update'] = sprintf( |
|
|
501
|
+ $actions[ 'update' ] = sprintf( |
|
502
|
502
|
'<a href="%1$s" title="%2$s" class="edit">%3$s</a>', |
|
503
|
503
|
esc_url( $this->get_tgmpa_status_url( 'update' ) ), |
|
504
|
504
|
esc_attr__( 'This plugin needs to be updated to be compatible with your theme.', 'tgmpa' ), |
|
@@ -536,9 +536,9 @@ discard block |
|
|
block discarded – undo |
|
536
|
536
|
return; |
|
537
|
537
|
} |
|
538
|
538
|
|
|
539
|
|
- if ( isset( $_REQUEST['tab'] ) && 'plugin-information' === $_REQUEST['tab'] ) { |
|
|
539
|
+ if ( isset( $_REQUEST[ 'tab' ] ) && 'plugin-information' === $_REQUEST[ 'tab' ] ) { |
|
540
|
540
|
// Needed for install_plugin_information(). |
|
541
|
|
- require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
|
|
541
|
+ require_once ABSPATH.'wp-admin/includes/plugin-install.php'; |
|
542
|
542
|
|
|
543
|
543
|
wp_enqueue_style( 'plugin-install' ); |
|
544
|
544
|
|
|
@@ -566,7 +566,7 @@ discard block |
|
|
block discarded – undo |
|
566
|
566
|
* @since 2.1.0 |
|
567
|
567
|
*/ |
|
568
|
568
|
public function thickbox() { |
|
569
|
|
- if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) ) { |
|
|
569
|
+ if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, true ) ) { |
|
570
|
570
|
add_thickbox(); |
|
571
|
571
|
} |
|
572
|
572
|
} |
|
@@ -595,11 +595,11 @@ discard block |
|
|
block discarded – undo |
|
595
|
595
|
$args = apply_filters( |
|
596
|
596
|
'tgmpa_admin_menu_args', |
|
597
|
597
|
array( |
|
598
|
|
- 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
599
|
|
- 'page_title' => $this->strings['page_title'], // Page title. |
|
600
|
|
- 'menu_title' => $this->strings['menu_title'], // Menu title. |
|
601
|
|
- 'capability' => $this->capability, // Capability. |
|
602
|
|
- 'menu_slug' => $this->menu, // Menu slug. |
|
|
598
|
+ 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
|
599
|
+ 'page_title' => $this->strings[ 'page_title' ], // Page title. |
|
|
600
|
+ 'menu_title' => $this->strings[ 'menu_title' ], // Menu title. |
|
|
601
|
+ 'capability' => $this->capability, // Capability. |
|
|
602
|
+ 'menu_slug' => $this->menu, // Menu slug. |
|
603
|
603
|
'function' => array( $this, 'install_plugins_page' ), // Callback. |
|
604
|
604
|
) |
|
605
|
605
|
); |
|
@@ -620,17 +620,17 @@ discard block |
|
|
block discarded – undo |
|
620
|
620
|
$args = apply_filters( |
|
621
|
621
|
'tgmpa_admin_menu_args', |
|
622
|
622
|
array( |
|
623
|
|
- 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
624
|
|
- 'page_title' => $this->strings['page_title'], // Page title. |
|
625
|
|
- 'menu_title' => $this->strings['menu_title'], // Menu title. |
|
626
|
|
- 'capability' => $this->capability, // Capability. |
|
627
|
|
- 'menu_slug' => $this->menu, // Menu slug. |
|
|
623
|
+ 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
|
624
|
+ 'page_title' => $this->strings[ 'page_title' ], // Page title. |
|
|
625
|
+ 'menu_title' => $this->strings[ 'menu_title' ], // Menu title. |
|
|
626
|
+ 'capability' => $this->capability, // Capability. |
|
|
627
|
+ 'menu_slug' => $this->menu, // Menu slug. |
|
628
|
628
|
'function' => array( $this, 'install_plugins_page' ), // Callback. |
|
629
|
629
|
) |
|
630
|
630
|
); |
|
631
|
631
|
|
|
632
|
632
|
// register a page with a null parent, in this case it will not apear in the dashboard menu |
|
633
|
|
- $this->page_hook = call_user_func( 'add_submenu_page', null, $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] ); |
|
|
633
|
+ $this->page_hook = call_user_func( 'add_submenu_page', null, $args[ 'page_title' ], $args[ 'menu_title' ], $args[ 'capability' ], $args[ 'menu_slug' ], $args[ 'function' ] ); |
|
634
|
634
|
} |
|
635
|
635
|
|
|
636
|
636
|
/** |
|
@@ -649,9 +649,9 @@ discard block |
|
|
block discarded – undo |
|
649
|
649
|
} |
|
650
|
650
|
|
|
651
|
651
|
if ( 'themes.php' === $this->parent_slug ) { |
|
652
|
|
- $this->page_hook = call_user_func( 'add_theme_page', $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] ); |
|
|
652
|
+ $this->page_hook = call_user_func( 'add_theme_page', $args[ 'page_title' ], $args[ 'menu_title' ], $args[ 'capability' ], $args[ 'menu_slug' ], $args[ 'function' ] ); |
|
653
|
653
|
} else { |
|
654
|
|
- $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'] ); |
|
|
654
|
+ $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' ] ); |
|
655
|
655
|
} |
|
656
|
656
|
} |
|
657
|
657
|
|
|
@@ -720,37 +720,37 @@ discard block |
|
|
block discarded – undo |
|
720
|
720
|
* @return boolean True on success, false on failure. |
|
721
|
721
|
*/ |
|
722
|
722
|
protected function do_plugin_install() { |
|
723
|
|
- if ( empty( $_GET['plugin'] ) ) { |
|
|
723
|
+ if ( empty( $_GET[ 'plugin' ] ) ) { |
|
724
|
724
|
return false; |
|
725
|
725
|
} |
|
726
|
726
|
|
|
727
|
727
|
// All plugin information will be stored in an array for processing. |
|
728
|
|
- $slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) ); |
|
|
728
|
+ $slug = $this->sanitize_key( urldecode( $_GET[ 'plugin' ] ) ); |
|
729
|
729
|
|
|
730
|
730
|
if ( ! isset( $this->plugins[ $slug ] ) ) { |
|
731
|
731
|
return false; |
|
732
|
732
|
} |
|
733
|
733
|
|
|
734
|
734
|
// Was an install or upgrade action link clicked? |
|
735
|
|
- if ( ( isset( $_GET['tgmpa-install'] ) && 'install-plugin' === $_GET['tgmpa-install'] ) || ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) ) { |
|
|
735
|
+ if ( ( isset( $_GET[ 'tgmpa-install' ] ) && 'install-plugin' === $_GET[ 'tgmpa-install' ] ) || ( isset( $_GET[ 'tgmpa-update' ] ) && 'update-plugin' === $_GET[ 'tgmpa-update' ] ) ) { |
|
736
|
736
|
|
|
737
|
737
|
$install_type = 'install'; |
|
738
|
|
- if ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) { |
|
|
738
|
+ if ( isset( $_GET[ 'tgmpa-update' ] ) && 'update-plugin' === $_GET[ 'tgmpa-update' ] ) { |
|
739
|
739
|
$install_type = 'update'; |
|
740
|
740
|
} |
|
741
|
741
|
|
|
742
|
|
- check_admin_referer( 'tgmpa-' . $install_type, 'tgmpa-nonce' ); |
|
|
742
|
+ check_admin_referer( 'tgmpa-'.$install_type, 'tgmpa-nonce' ); |
|
743
|
743
|
|
|
744
|
744
|
// Pass necessary information via URL if WP_Filesystem is needed. |
|
745
|
745
|
$url = wp_nonce_url( |
|
746
|
746
|
add_query_arg( |
|
747
|
747
|
array( |
|
748
|
748
|
'plugin' => urlencode( $slug ), |
|
749
|
|
- 'tgmpa-' . $install_type => $install_type . '-plugin', |
|
|
749
|
+ 'tgmpa-'.$install_type => $install_type.'-plugin', |
|
750
|
750
|
), |
|
751
|
751
|
$this->get_tgmpa_url() |
|
752
|
752
|
), |
|
753
|
|
- 'tgmpa-' . $install_type, |
|
|
753
|
+ 'tgmpa-'.$install_type, |
|
754
|
754
|
'tgmpa-nonce' |
|
755
|
755
|
); |
|
756
|
756
|
|
|
@@ -769,29 +769,29 @@ discard block |
|
|
block discarded – undo |
|
769
|
769
|
|
|
770
|
770
|
// Prep variables for Plugin_Installer_Skin class. |
|
771
|
771
|
$extra = array(); |
|
772
|
|
- $extra['slug'] = $slug; // Needed for potentially renaming of directory name. |
|
|
772
|
+ $extra[ 'slug' ] = $slug; // Needed for potentially renaming of directory name. |
|
773
|
773
|
$source = $this->get_download_url( $slug ); |
|
774
|
|
- $api = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null; |
|
|
774
|
+ $api = ( 'repo' === $this->plugins[ $slug ][ 'source_type' ] ) ? $this->get_plugins_api( $slug ) : null; |
|
775
|
775
|
$api = ( false !== $api ) ? $api : null; |
|
776
|
776
|
|
|
777
|
777
|
$url = add_query_arg( |
|
778
|
778
|
array( |
|
779
|
|
- 'action' => $install_type . '-plugin', |
|
|
779
|
+ 'action' => $install_type.'-plugin', |
|
780
|
780
|
'plugin' => urlencode( $slug ), |
|
781
|
781
|
), |
|
782
|
782
|
'update.php' |
|
783
|
783
|
); |
|
784
|
784
|
|
|
785
|
785
|
if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
|
786
|
|
- require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
|
786
|
+ require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
787
|
787
|
} |
|
788
|
788
|
|
|
789
|
|
- $title = ( 'update' === $install_type ) ? $this->strings['updating'] : $this->strings['installing']; |
|
|
789
|
+ $title = ( 'update' === $install_type ) ? $this->strings[ 'updating' ] : $this->strings[ 'installing' ]; |
|
790
|
790
|
$skin_args = array( |
|
791
|
|
- 'type' => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload', |
|
792
|
|
- 'title' => sprintf( $title, $this->plugins[ $slug ]['name'] ), |
|
|
791
|
+ 'type' => ( 'bundled' !== $this->plugins[ $slug ][ 'source_type' ] ) ? 'web' : 'upload', |
|
|
792
|
+ 'title' => sprintf( $title, $this->plugins[ $slug ][ 'name' ] ), |
|
793
|
793
|
'url' => esc_url_raw( $url ), |
|
794
|
|
- 'nonce' => $install_type . '-plugin_' . $slug, |
|
|
794
|
+ 'nonce' => $install_type.'-plugin_'.$slug, |
|
795
|
795
|
'plugin' => '', |
|
796
|
796
|
'api' => $api, |
|
797
|
797
|
'extra' => $extra, |
|
@@ -799,7 +799,7 @@ discard block |
|
|
block discarded – undo |
|
799
|
799
|
unset( $title ); |
|
800
|
800
|
|
|
801
|
801
|
if ( 'update' === $install_type ) { |
|
802
|
|
- $skin_args['plugin'] = $this->plugins[ $slug ]['file_path']; |
|
|
802
|
+ $skin_args[ 'plugin' ] = $this->plugins[ $slug ][ 'file_path' ]; |
|
803
|
803
|
$skin = new Plugin_Upgrader_Skin( $skin_args ); |
|
804
|
804
|
} else { |
|
805
|
805
|
$skin = new Plugin_Installer_Skin( $skin_args ); |
|
@@ -814,10 +814,10 @@ discard block |
|
|
block discarded – undo |
|
814
|
814
|
if ( 'update' === $install_type ) { |
|
815
|
815
|
// Inject our info into the update transient. |
|
816
|
816
|
$to_inject = array( $slug => $this->plugins[ $slug ] ); |
|
817
|
|
- $to_inject[ $slug ]['source'] = $source; |
|
|
817
|
+ $to_inject[ $slug ][ 'source' ] = $source; |
|
818
|
818
|
$this->inject_update_info( $to_inject ); |
|
819
|
819
|
|
|
820
|
|
- $upgrader->upgrade( $this->plugins[ $slug ]['file_path'] ); |
|
|
820
|
+ $upgrader->upgrade( $this->plugins[ $slug ][ 'file_path' ] ); |
|
821
|
821
|
} else { |
|
822
|
822
|
$upgrader->install( $source ); |
|
823
|
823
|
} |
|
@@ -840,18 +840,18 @@ discard block |
|
|
block discarded – undo |
|
840
|
840
|
|
|
841
|
841
|
// Display message based on if all plugins are now active or not. |
|
842
|
842
|
if ( $this->is_tgmpa_complete() ) { |
|
843
|
|
- echo '<p>', sprintf( esc_html( $this->strings['complete'] ), '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' ), '</p>'; |
|
|
843
|
+ echo '<p>', sprintf( esc_html( $this->strings[ 'complete' ] ), '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' ), '</p>'; |
|
844
|
844
|
echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
|
845
|
845
|
} else { |
|
846
|
|
- echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; |
|
|
846
|
+ echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings[ 'return' ] ), '</a></p>'; |
|
847
|
847
|
} |
|
848
|
848
|
|
|
849
|
849
|
return true; |
|
850
|
|
- } elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) { |
|
|
850
|
+ } elseif ( isset( $this->plugins[ $slug ][ 'file_path' ], $_GET[ 'tgmpa-activate' ] ) && 'activate-plugin' === $_GET[ 'tgmpa-activate' ] ) { |
|
851
|
851
|
// Activate action link was clicked. |
|
852
|
852
|
check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' ); |
|
853
|
853
|
|
|
854
|
|
- if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) { |
|
|
854
|
+ if ( false === $this->activate_single_plugin( $this->plugins[ $slug ][ 'file_path' ], $slug ) ) { |
|
855
|
855
|
return true; // Finish execution of the function early as we encountered an error. |
|
856
|
856
|
} |
|
857
|
857
|
} |
|
@@ -874,7 +874,7 @@ discard block |
|
|
block discarded – undo |
|
874
|
874
|
} |
|
875
|
875
|
|
|
876
|
876
|
foreach ( $plugins as $slug => $plugin ) { |
|
877
|
|
- $file_path = $plugin['file_path']; |
|
|
877
|
+ $file_path = $plugin[ 'file_path' ]; |
|
878
|
878
|
|
|
879
|
879
|
if ( empty( $repo_updates->response[ $file_path ] ) ) { |
|
880
|
880
|
$repo_updates->response[ $file_path ] = new stdClass; |
|
@@ -883,10 +883,10 @@ discard block |
|
|
block discarded – undo |
|
883
|
883
|
// We only really need to set package, but let's do all we can in case WP changes something. |
|
884
|
884
|
$repo_updates->response[ $file_path ]->slug = $slug; |
|
885
|
885
|
$repo_updates->response[ $file_path ]->plugin = $file_path; |
|
886
|
|
- $repo_updates->response[ $file_path ]->new_version = $plugin['version']; |
|
887
|
|
- $repo_updates->response[ $file_path ]->package = $plugin['source']; |
|
888
|
|
- if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) { |
|
889
|
|
- $repo_updates->response[ $file_path ]->url = $plugin['external_url']; |
|
|
886
|
+ $repo_updates->response[ $file_path ]->new_version = $plugin[ 'version' ]; |
|
|
887
|
+ $repo_updates->response[ $file_path ]->package = $plugin[ 'source' ]; |
|
|
888
|
+ if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin[ 'external_url' ] ) ) { |
|
|
889
|
+ $repo_updates->response[ $file_path ]->url = $plugin[ 'external_url' ]; |
|
890
|
890
|
} |
|
891
|
891
|
} |
|
892
|
892
|
|
|
@@ -910,13 +910,13 @@ discard block |
|
|
block discarded – undo |
|
910
|
910
|
* @return string $source |
|
911
|
911
|
*/ |
|
912
|
912
|
public function maybe_adjust_source_dir( $source, $remote_source, $upgrader ) { |
|
913
|
|
- if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS['wp_filesystem'] ) ) { |
|
|
913
|
+ if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS[ 'wp_filesystem' ] ) ) { |
|
914
|
914
|
return $source; |
|
915
|
915
|
} |
|
916
|
916
|
|
|
917
|
917
|
// Check for single file plugins. |
|
918
|
|
- $source_files = array_keys( $GLOBALS['wp_filesystem']->dirlist( $remote_source ) ); |
|
919
|
|
- if ( 1 === count( $source_files ) && false === $GLOBALS['wp_filesystem']->is_dir( $source ) ) { |
|
|
918
|
+ $source_files = array_keys( $GLOBALS[ 'wp_filesystem' ]->dirlist( $remote_source ) ); |
|
|
919
|
+ if ( 1 === count( $source_files ) && false === $GLOBALS[ 'wp_filesystem' ]->is_dir( $source ) ) { |
|
920
|
920
|
return $source; |
|
921
|
921
|
} |
|
922
|
922
|
|
|
@@ -924,12 +924,12 @@ discard block |
|
|
block discarded – undo |
|
924
|
924
|
$desired_slug = ''; |
|
925
|
925
|
|
|
926
|
926
|
// Figure out what the slug is supposed to be. |
|
927
|
|
- if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options['extra']['slug'] ) ) { |
|
928
|
|
- $desired_slug = $upgrader->skin->options['extra']['slug']; |
|
|
927
|
+ if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options[ 'extra' ][ 'slug' ] ) ) { |
|
|
928
|
+ $desired_slug = $upgrader->skin->options[ 'extra' ][ 'slug' ]; |
|
929
|
929
|
} else { |
|
930
|
930
|
// Bulk installer contains less info, so fall back on the info registered here. |
|
931
|
931
|
foreach ( $this->plugins as $slug => $plugin ) { |
|
932
|
|
- if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
|
|
932
|
+ if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin[ 'name' ] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
|
933
|
933
|
$desired_slug = $slug; |
|
934
|
934
|
break; |
|
935
|
935
|
} |
|
@@ -942,15 +942,15 @@ discard block |
|
|
block discarded – undo |
|
942
|
942
|
|
|
943
|
943
|
if ( ! empty( $subdir_name ) && $subdir_name !== $desired_slug ) { |
|
944
|
944
|
$from = untrailingslashit( $source ); |
|
945
|
|
- $to = trailingslashit( $remote_source ) . $desired_slug; |
|
|
945
|
+ $to = trailingslashit( $remote_source ).$desired_slug; |
|
946
|
946
|
|
|
947
|
|
- if ( true === $GLOBALS['wp_filesystem']->move( $from, $to ) ) { |
|
|
947
|
+ if ( true === $GLOBALS[ 'wp_filesystem' ]->move( $from, $to ) ) { |
|
948
|
948
|
return trailingslashit( $to ); |
|
949
|
949
|
} else { |
|
950
|
|
- 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 ) ); |
|
|
950
|
+ 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 ) ); |
|
951
|
951
|
} |
|
952
|
952
|
} elseif ( empty( $subdir_name ) ) { |
|
953
|
|
- 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 ) ); |
|
|
953
|
+ 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 ) ); |
|
954
|
954
|
} |
|
955
|
955
|
} |
|
956
|
956
|
|
|
@@ -974,19 +974,19 @@ discard block |
|
|
block discarded – undo |
|
974
|
974
|
|
|
975
|
975
|
if ( is_wp_error( $activate ) ) { |
|
976
|
976
|
echo '<div id="message" class="error"><p>', wp_kses_post( $activate->get_error_message() ), '</p></div>', |
|
977
|
|
- '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; |
|
|
977
|
+ '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings[ 'return' ] ), '</a></p>'; |
|
978
|
978
|
|
|
979
|
979
|
return false; // End it here if there is an error with activation. |
|
980
|
980
|
} else { |
|
981
|
981
|
if ( ! $automatic ) { |
|
982
|
982
|
// Make sure message doesn't display again if bulk activation is performed |
|
983
|
983
|
// immediately after a single activation. |
|
984
|
|
- if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
985
|
|
- echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>'; |
|
|
984
|
+ if ( ! isset( $_POST[ 'action' ] ) ) { // WPCS: CSRF OK. |
|
|
985
|
+ echo '<div id="message" class="updated"><p>', esc_html( $this->strings[ 'activated_successfully' ] ), ' <strong>', esc_html( $this->plugins[ $slug ][ 'name' ] ), '.</strong></p></div>'; |
|
986
|
986
|
} |
|
987
|
987
|
} else { |
|
988
|
988
|
// Simpler message layout for use on the plugin install page. |
|
989
|
|
- echo '<p>', esc_html( $this->strings['plugin_activated'] ), '</p>'; |
|
|
989
|
+ echo '<p>', esc_html( $this->strings[ 'plugin_activated' ] ), '</p>'; |
|
990
|
990
|
} |
|
991
|
991
|
} |
|
992
|
992
|
} elseif ( $this->is_plugin_active( $slug ) ) { |
|
@@ -994,25 +994,25 @@ discard block |
|
|
block discarded – undo |
|
994
|
994
|
// on the plugin install page. |
|
995
|
995
|
echo '<div id="message" class="error"><p>', |
|
996
|
996
|
sprintf( |
|
997
|
|
- esc_html( $this->strings['plugin_already_active'] ), |
|
998
|
|
- '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
|
997
|
+ esc_html( $this->strings[ 'plugin_already_active' ] ), |
|
|
998
|
+ '<strong>'.esc_html( $this->plugins[ $slug ][ 'name' ] ).'</strong>' |
|
999
|
999
|
), |
|
1000
|
1000
|
'</p></div>'; |
|
1001
|
1001
|
} elseif ( $this->does_plugin_require_update( $slug ) ) { |
|
1002
|
1002
|
if ( ! $automatic ) { |
|
1003
|
1003
|
// Make sure message doesn't display again if bulk activation is performed |
|
1004
|
1004
|
// immediately after a single activation. |
|
1005
|
|
- if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
|
1005
|
+ if ( ! isset( $_POST[ 'action' ] ) ) { // WPCS: CSRF OK. |
|
1006
|
1006
|
echo '<div id="message" class="error"><p>', |
|
1007
|
1007
|
sprintf( |
|
1008
|
|
- esc_html( $this->strings['plugin_needs_higher_version'] ), |
|
1009
|
|
- '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
|
1008
|
+ esc_html( $this->strings[ 'plugin_needs_higher_version' ] ), |
|
|
1009
|
+ '<strong>'.esc_html( $this->plugins[ $slug ][ 'name' ] ).'</strong>' |
|
1010
|
1010
|
), |
|
1011
|
1011
|
'</p></div>'; |
|
1012
|
1012
|
} |
|
1013
|
1013
|
} else { |
|
1014
|
1014
|
// Simpler message layout for use on the plugin install page. |
|
1015
|
|
- echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>'; |
|
|
1015
|
+ echo '<p>', sprintf( esc_html( $this->strings[ 'plugin_needs_higher_version' ] ), esc_html( $this->plugins[ $slug ][ 'name' ] ) ), '</p>'; |
|
1016
|
1016
|
} |
|
1017
|
1017
|
} |
|
1018
|
1018
|
|
|
@@ -1036,7 +1036,7 @@ discard block |
|
|
block discarded – undo |
|
1036
|
1036
|
*/ |
|
1037
|
1037
|
public function notices() { |
|
1038
|
1038
|
// Remove nag on the install page / Return early if the nag message has been dismissed or user < author. |
|
1039
|
|
- if ( $this->is_tgmpa_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' ) ) ) { |
|
|
1039
|
+ if ( $this->is_tgmpa_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' ) ) ) { |
|
1040
|
1040
|
return; |
|
1041
|
1041
|
} |
|
1042
|
1042
|
|
|
@@ -1058,13 +1058,13 @@ discard block |
|
|
block discarded – undo |
|
1058
|
1058
|
if ( current_user_can( 'install_plugins' ) ) { |
|
1059
|
1059
|
$install_link_count++; |
|
1060
|
1060
|
|
|
1061
|
|
- if ( true === $plugin['required'] ) { |
|
1062
|
|
- $message['notice_can_install_required'][] = $slug; |
|
|
1061
|
+ if ( true === $plugin[ 'required' ] ) { |
|
|
1062
|
+ $message[ 'notice_can_install_required' ][ ] = $slug; |
|
1063
|
1063
|
} else { |
|
1064
|
|
- $message['notice_can_install_recommended'][] = $slug; |
|
|
1064
|
+ $message[ 'notice_can_install_recommended' ][ ] = $slug; |
|
1065
|
1065
|
} |
|
1066
|
1066
|
} |
|
1067
|
|
- if ( true === $plugin['required'] ) { |
|
|
1067
|
+ if ( true === $plugin[ 'required' ] ) { |
|
1068
|
1068
|
$total_required_action_count++; |
|
1069
|
1069
|
} |
|
1070
|
1070
|
} else { |
|
@@ -1072,13 +1072,13 @@ discard block |
|
|
block discarded – undo |
|
1072
|
1072
|
if ( current_user_can( 'activate_plugins' ) ) { |
|
1073
|
1073
|
$activate_link_count++; |
|
1074
|
1074
|
|
|
1075
|
|
- if ( true === $plugin['required'] ) { |
|
1076
|
|
- $message['notice_can_activate_required'][] = $slug; |
|
|
1075
|
+ if ( true === $plugin[ 'required' ] ) { |
|
|
1076
|
+ $message[ 'notice_can_activate_required' ][ ] = $slug; |
|
1077
|
1077
|
} else { |
|
1078
|
|
- $message['notice_can_activate_recommended'][] = $slug; |
|
|
1078
|
+ $message[ 'notice_can_activate_recommended' ][ ] = $slug; |
|
1079
|
1079
|
} |
|
1080
|
1080
|
} |
|
1081
|
|
- if ( true === $plugin['required'] ) { |
|
|
1081
|
+ if ( true === $plugin[ 'required' ] ) { |
|
1082
|
1082
|
$total_required_action_count++; |
|
1083
|
1083
|
} |
|
1084
|
1084
|
} |
|
@@ -1089,12 +1089,12 @@ discard block |
|
|
block discarded – undo |
|
1089
|
1089
|
$update_link_count++; |
|
1090
|
1090
|
|
|
1091
|
1091
|
if ( $this->does_plugin_require_update( $slug ) ) { |
|
1092
|
|
- $message['notice_ask_to_update'][] = $slug; |
|
|
1092
|
+ $message[ 'notice_ask_to_update' ][ ] = $slug; |
|
1093
|
1093
|
} elseif ( false !== $this->does_plugin_have_update( $slug ) ) { |
|
1094
|
|
- $message['notice_ask_to_update_maybe'][] = $slug; |
|
|
1094
|
+ $message[ 'notice_ask_to_update_maybe' ][ ] = $slug; |
|
1095
|
1095
|
} |
|
1096
|
1096
|
} |
|
1097
|
|
- if ( true === $plugin['required'] ) { |
|
|
1097
|
+ if ( true === $plugin[ 'required' ] ) { |
|
1098
|
1098
|
$total_required_action_count++; |
|
1099
|
1099
|
} |
|
1100
|
1100
|
} |
|
@@ -1109,10 +1109,10 @@ discard block |
|
|
block discarded – undo |
|
1109
|
1109
|
|
|
1110
|
1110
|
// As add_settings_error() wraps the final message in a <p> and as the final message can't be |
|
1111
|
1111
|
// filtered, using <p>'s in our html would render invalid html output. |
|
1112
|
|
- $line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>' . "\n"; |
|
|
1112
|
+ $line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>'."\n"; |
|
1113
|
1113
|
|
|
1114
|
1114
|
if ( ! current_user_can( 'activate_plugins' ) && ! current_user_can( 'install_plugins' ) && ! current_user_can( 'update_plugins' ) ) { |
|
1115
|
|
- $rendered = esc_html__( $this->strings['notice_cannot_install_activate'] ) . ' ' . esc_html__( $this->strings['contact_admin'] ); |
|
|
1115
|
+ $rendered = esc_html__( $this->strings[ 'notice_cannot_install_activate' ] ).' '.esc_html__( $this->strings[ 'contact_admin' ] ); |
|
1116
|
1116
|
$rendered .= $this->create_user_action_links_for_notice( 0, 0, 0, $line_template ); |
|
1117
|
1117
|
} else { |
|
1118
|
1118
|
|
|
@@ -1127,14 +1127,14 @@ discard block |
|
|
block discarded – undo |
|
1127
|
1127
|
|
|
1128
|
1128
|
// Get the external info link for a plugin if one is available. |
|
1129
|
1129
|
foreach ( $plugin_group as $plugin_slug ) { |
|
1130
|
|
- $linked_plugins[] = $this->get_info_link( $plugin_slug ); |
|
|
1130
|
+ $linked_plugins[ ] = $this->get_info_link( $plugin_slug ); |
|
1131
|
1131
|
} |
|
1132
|
1132
|
unset( $plugin_slug ); |
|
1133
|
1133
|
|
|
1134
|
1134
|
$count = count( $plugin_group ); |
|
1135
|
1135
|
$linked_plugins = array_map( array( 'TGMPA_Utils', 'wrap_in_em' ), $linked_plugins ); |
|
1136
|
1136
|
$last_plugin = array_pop( $linked_plugins ); // Pop off last name to prep for readability. |
|
1137
|
|
- $imploded = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
|
1137
|
+ $imploded = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); |
|
1138
|
1138
|
|
|
1139
|
1139
|
$rendered .= sprintf( |
|
1140
|
1140
|
$line_template, |
|
@@ -1156,7 +1156,7 @@ discard block |
|
|
block discarded – undo |
|
1156
|
1156
|
} |
|
1157
|
1157
|
|
|
1158
|
1158
|
// Admin options pages already output settings_errors, so this is to avoid duplication. |
|
1159
|
|
- if ( 'options-general' !== $GLOBALS['current_screen']->parent_base ) { |
|
|
1159
|
+ if ( 'options-general' !== $GLOBALS[ 'current_screen' ]->parent_base ) { |
|
1160
|
1160
|
$this->display_settings_errors(); |
|
1161
|
1161
|
} |
|
1162
|
1162
|
} |
|
@@ -1178,32 +1178,32 @@ discard block |
|
|
block discarded – undo |
|
1178
|
1178
|
'install' => '', |
|
1179
|
1179
|
'update' => '', |
|
1180
|
1180
|
'activate' => '', |
|
1181
|
|
- '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>' : '', |
|
|
1181
|
+ '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>' : '', |
|
1182
|
1182
|
); |
|
1183
|
1183
|
|
|
1184
|
1184
|
$link_template = '<a href="%2$s">%1$s</a>'; |
|
1185
|
1185
|
|
|
1186
|
1186
|
if ( current_user_can( 'install_plugins' ) ) { |
|
1187
|
1187
|
if ( $install_count > 0 ) { |
|
1188
|
|
- $action_links['install'] = sprintf( |
|
|
1188
|
+ $action_links[ 'install' ] = sprintf( |
|
1189
|
1189
|
$link_template, |
|
1190
|
|
- translate_nooped_plural( $this->strings['install_link'], $install_count, 'tgmpa' ), |
|
|
1190
|
+ translate_nooped_plural( $this->strings[ 'install_link' ], $install_count, 'tgmpa' ), |
|
1191
|
1191
|
esc_url( $this->get_tgmpa_status_url( 'install' ) ) |
|
1192
|
1192
|
); |
|
1193
|
1193
|
} |
|
1194
|
1194
|
if ( $update_count > 0 ) { |
|
1195
|
|
- $action_links['update'] = sprintf( |
|
|
1195
|
+ $action_links[ 'update' ] = sprintf( |
|
1196
|
1196
|
$link_template, |
|
1197
|
|
- translate_nooped_plural( $this->strings['update_link'], $update_count, 'tgmpa' ), |
|
|
1197
|
+ translate_nooped_plural( $this->strings[ 'update_link' ], $update_count, 'tgmpa' ), |
|
1198
|
1198
|
esc_url( $this->get_tgmpa_status_url( 'update' ) ) |
|
1199
|
1199
|
); |
|
1200
|
1200
|
} |
|
1201
|
1201
|
} |
|
1202
|
1202
|
|
|
1203
|
1203
|
if ( current_user_can( 'activate_plugins' ) && $activate_count > 0 ) { |
|
1204
|
|
- $action_links['activate'] = sprintf( |
|
|
1204
|
+ $action_links[ 'activate' ] = sprintf( |
|
1205
|
1205
|
$link_template, |
|
1206
|
|
- translate_nooped_plural( $this->strings['activate_link'], $activate_count, 'tgmpa' ), |
|
|
1206
|
+ translate_nooped_plural( $this->strings[ 'activate_link' ], $activate_count, 'tgmpa' ), |
|
1207
|
1207
|
esc_url( $this->get_tgmpa_status_url( 'activate' ) ) |
|
1208
|
1208
|
); |
|
1209
|
1209
|
} |
|
@@ -1231,8 +1231,8 @@ discard block |
|
|
block discarded – undo |
|
1231
|
1231
|
* @return string |
|
1232
|
1232
|
*/ |
|
1233
|
1233
|
protected function get_admin_notice_class() { |
|
1234
|
|
- if ( ! empty( $this->strings['nag_type'] ) ) { |
|
1235
|
|
- return sanitize_html_class( strtolower( $this->strings['nag_type'] ) ); |
|
|
1234
|
+ if ( ! empty( $this->strings[ 'nag_type' ] ) ) { |
|
|
1235
|
+ return sanitize_html_class( strtolower( $this->strings[ 'nag_type' ] ) ); |
|
1236
|
1236
|
} else { |
|
1237
|
1237
|
if ( version_compare( $this->wp_version, '4.2', '>=' ) ) { |
|
1238
|
1238
|
return 'notice-warning'; |
|
@@ -1255,7 +1255,7 @@ discard block |
|
|
block discarded – undo |
|
1255
|
1255
|
settings_errors( 'tgmpa' ); |
|
1256
|
1256
|
|
|
1257
|
1257
|
foreach ( (array) $wp_settings_errors as $key => $details ) { |
|
1258
|
|
- if ( 'tgmpa' === $details['setting'] ) { |
|
|
1258
|
+ if ( 'tgmpa' === $details[ 'setting' ] ) { |
|
1259
|
1259
|
unset( $wp_settings_errors[ $key ] ); |
|
1260
|
1260
|
break; |
|
1261
|
1261
|
} |
|
@@ -1270,8 +1270,8 @@ discard block |
|
|
block discarded – undo |
|
1270
|
1270
|
* @since 2.1.0 |
|
1271
|
1271
|
*/ |
|
1272
|
1272
|
public function dismiss() { |
|
1273
|
|
- if ( isset( $_GET['tgmpa-dismiss'] ) && check_admin_referer( 'tgmpa-dismis-' . get_current_user_id() ) ) { |
|
1274
|
|
- update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, 1 ); |
|
|
1273
|
+ if ( isset( $_GET[ 'tgmpa-dismiss' ] ) && check_admin_referer( 'tgmpa-dismis-'.get_current_user_id() ) ) { |
|
|
1274
|
+ update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, 1 ); |
|
1275
|
1275
|
} |
|
1276
|
1276
|
} |
|
1277
|
1277
|
|
|
@@ -1287,54 +1287,54 @@ discard block |
|
|
block discarded – undo |
|
1287
|
1287
|
* @return null Return early if incorrect argument. |
|
1288
|
1288
|
*/ |
|
1289
|
1289
|
public function register( $plugin ) { |
|
1290
|
|
- if ( empty( $plugin['slug'] ) || empty( $plugin['name'] ) ) { |
|
|
1290
|
+ if ( empty( $plugin[ 'slug' ] ) || empty( $plugin[ 'name' ] ) ) { |
|
1291
|
1291
|
return; |
|
1292
|
1292
|
} |
|
1293
|
1293
|
|
|
1294
|
|
- if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) { |
|
|
1294
|
+ if ( empty( $plugin[ 'slug' ] ) || ! is_string( $plugin[ 'slug' ] ) || isset( $this->plugins[ $plugin[ 'slug' ] ] ) ) { |
|
1295
|
1295
|
return; |
|
1296
|
1296
|
} |
|
1297
|
1297
|
|
|
1298
|
1298
|
$defaults = array( |
|
1299
|
|
- 'name' => '', // String |
|
1300
|
|
- 'slug' => '', // String |
|
1301
|
|
- 'source' => 'repo', // String |
|
1302
|
|
- 'required' => false, // Boolean |
|
1303
|
|
- 'version' => '', // String |
|
1304
|
|
- 'force_activation' => false, // Boolean |
|
1305
|
|
- 'force_deactivation' => false, // Boolean |
|
1306
|
|
- 'external_url' => '', // String |
|
1307
|
|
- 'is_callable' => '', // String|Array. |
|
|
1299
|
+ 'name' => '', // String |
|
|
1300
|
+ 'slug' => '', // String |
|
|
1301
|
+ 'source' => 'repo', // String |
|
|
1302
|
+ 'required' => false, // Boolean |
|
|
1303
|
+ 'version' => '', // String |
|
|
1304
|
+ 'force_activation' => false, // Boolean |
|
|
1305
|
+ 'force_deactivation' => false, // Boolean |
|
|
1306
|
+ 'external_url' => '', // String |
|
|
1307
|
+ 'is_callable' => '', // String|Array. |
|
1308
|
1308
|
); |
|
1309
|
1309
|
|
|
1310
|
1310
|
// Prepare the received data. |
|
1311
|
1311
|
$plugin = wp_parse_args( $plugin, $defaults ); |
|
1312
|
1312
|
|
|
1313
|
1313
|
// Standardize the received slug. |
|
1314
|
|
- $plugin['slug'] = $this->sanitize_key( $plugin['slug'] ); |
|
|
1314
|
+ $plugin[ 'slug' ] = $this->sanitize_key( $plugin[ 'slug' ] ); |
|
1315
|
1315
|
|
|
1316
|
1316
|
// Forgive users for using string versions of booleans or floats for version number. |
|
1317
|
|
- $plugin['version'] = (string) $plugin['version']; |
|
1318
|
|
- $plugin['source'] = empty( $plugin['source'] ) ? 'repo' : $plugin['source']; |
|
1319
|
|
- $plugin['required'] = TGMPA_Utils::validate_bool( $plugin['required'] ); |
|
1320
|
|
- $plugin['force_activation'] = TGMPA_Utils::validate_bool( $plugin['force_activation'] ); |
|
1321
|
|
- $plugin['force_deactivation'] = TGMPA_Utils::validate_bool( $plugin['force_deactivation'] ); |
|
|
1317
|
+ $plugin[ 'version' ] = (string) $plugin[ 'version' ]; |
|
|
1318
|
+ $plugin[ 'source' ] = empty( $plugin[ 'source' ] ) ? 'repo' : $plugin[ 'source' ]; |
|
|
1319
|
+ $plugin[ 'required' ] = TGMPA_Utils::validate_bool( $plugin[ 'required' ] ); |
|
|
1320
|
+ $plugin[ 'force_activation' ] = TGMPA_Utils::validate_bool( $plugin[ 'force_activation' ] ); |
|
|
1321
|
+ $plugin[ 'force_deactivation' ] = TGMPA_Utils::validate_bool( $plugin[ 'force_deactivation' ] ); |
|
1322
|
1322
|
|
|
1323
|
1323
|
// Enrich the received data. |
|
1324
|
|
- $plugin['file_path'] = $this->_get_plugin_basename_from_slug( $plugin['slug'] ); |
|
1325
|
|
- $plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] ); |
|
|
1324
|
+ $plugin[ 'file_path' ] = $this->_get_plugin_basename_from_slug( $plugin[ 'slug' ] ); |
|
|
1325
|
+ $plugin[ 'source_type' ] = $this->get_plugin_source_type( $plugin[ 'source' ] ); |
|
1326
|
1326
|
|
|
1327
|
1327
|
// Set the class properties. |
|
1328
|
|
- $this->plugins[ $plugin['slug'] ] = $plugin; |
|
1329
|
|
- $this->sort_order[ $plugin['slug'] ] = $plugin['name']; |
|
|
1328
|
+ $this->plugins[ $plugin[ 'slug' ] ] = $plugin; |
|
|
1329
|
+ $this->sort_order[ $plugin[ 'slug' ] ] = $plugin[ 'name' ]; |
|
1330
|
1330
|
|
|
1331
|
1331
|
// Should we add the force activation hook ? |
|
1332
|
|
- if ( true === $plugin['force_activation'] ) { |
|
|
1332
|
+ if ( true === $plugin[ 'force_activation' ] ) { |
|
1333
|
1333
|
$this->has_forced_activation = true; |
|
1334
|
1334
|
} |
|
1335
|
1335
|
|
|
1336
|
1336
|
// Should we add the force deactivation hook ? |
|
1337
|
|
- if ( true === $plugin['force_deactivation'] ) { |
|
|
1337
|
+ if ( true === $plugin[ 'force_deactivation' ] ) { |
|
1338
|
1338
|
$this->has_forced_deactivation = true; |
|
1339
|
1339
|
} |
|
1340
|
1340
|
} |
|
@@ -1460,11 +1460,11 @@ discard block |
|
|
block discarded – undo |
|
1460
|
1460
|
*/ |
|
1461
|
1461
|
public function populate_file_path( $plugin_slug = '' ) { |
|
1462
|
1462
|
if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) { |
|
1463
|
|
- $this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
|
1463
|
+ $this->plugins[ $plugin_slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
1464
|
1464
|
} else { |
|
1465
|
1465
|
// Add file_path key for all plugins. |
|
1466
|
1466
|
foreach ( $this->plugins as $slug => $values ) { |
|
1467
|
|
- $this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug ); |
|
|
1467
|
+ $this->plugins[ $slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $slug ); |
|
1468
|
1468
|
} |
|
1469
|
1469
|
} |
|
1470
|
1470
|
} |
|
@@ -1482,7 +1482,7 @@ discard block |
|
|
block discarded – undo |
|
1482
|
1482
|
$keys = array_keys( $this->get_plugins() ); |
|
1483
|
1483
|
|
|
1484
|
1484
|
foreach ( $keys as $key ) { |
|
1485
|
|
- if ( preg_match( '|^' . $slug . '/|', $key ) ) { |
|
|
1485
|
+ if ( preg_match( '|^'.$slug.'/|', $key ) ) { |
|
1486
|
1486
|
return $key; |
|
1487
|
1487
|
} |
|
1488
|
1488
|
} |
|
@@ -1504,7 +1504,7 @@ discard block |
|
|
block discarded – undo |
|
1504
|
1504
|
*/ |
|
1505
|
1505
|
public function _get_plugin_data_from_name( $name, $data = 'slug' ) { |
|
1506
|
1506
|
foreach ( $this->plugins as $values ) { |
|
1507
|
|
- if ( $name === $values['name'] && isset( $values[ $data ] ) ) { |
|
|
1507
|
+ if ( $name === $values[ 'name' ] && isset( $values[ $data ] ) ) { |
|
1508
|
1508
|
return $values[ $data ]; |
|
1509
|
1509
|
} |
|
1510
|
1510
|
} |
|
@@ -1523,13 +1523,13 @@ discard block |
|
|
block discarded – undo |
|
1523
|
1523
|
public function get_download_url( $slug ) { |
|
1524
|
1524
|
$dl_source = ''; |
|
1525
|
1525
|
|
|
1526
|
|
- switch ( $this->plugins[ $slug ]['source_type'] ) { |
|
|
1526
|
+ switch ( $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1527
|
1527
|
case 'repo': |
|
1528
|
1528
|
return $this->get_wp_repo_download_url( $slug ); |
|
1529
|
1529
|
case 'external': |
|
1530
|
|
- return $this->plugins[ $slug ]['source']; |
|
|
1530
|
+ return $this->plugins[ $slug ][ 'source' ]; |
|
1531
|
1531
|
case 'bundled': |
|
1532
|
|
- return $this->default_path . $this->plugins[ $slug ]['source']; |
|
|
1532
|
+ return $this->default_path.$this->plugins[ $slug ][ 'source' ]; |
|
1533
|
1533
|
} |
|
1534
|
1534
|
|
|
1535
|
1535
|
return $dl_source; // Should never happen. |
|
@@ -1567,7 +1567,7 @@ discard block |
|
|
block discarded – undo |
|
1567
|
1567
|
|
|
1568
|
1568
|
if ( ! isset( $api[ $slug ] ) ) { |
|
1569
|
1569
|
if ( ! function_exists( 'plugins_api' ) ) { |
|
1570
|
|
- require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
|
|
1570
|
+ require_once ABSPATH.'wp-admin/includes/plugin-install.php'; |
|
1571
|
1571
|
} |
|
1572
|
1572
|
|
|
1573
|
1573
|
$response = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ) ) ); |
|
@@ -1575,7 +1575,7 @@ discard block |
|
|
block discarded – undo |
|
1575
|
1575
|
$api[ $slug ] = false; |
|
1576
|
1576
|
|
|
1577
|
1577
|
if ( is_wp_error( $response ) ) { |
|
1578
|
|
- wp_die( esc_html( $this->strings['oops'] ) ); |
|
|
1578
|
+ wp_die( esc_html( $this->strings[ 'oops' ] ) ); |
|
1579
|
1579
|
} else { |
|
1580
|
1580
|
$api[ $slug ] = $response; |
|
1581
|
1581
|
} |
|
@@ -1594,13 +1594,13 @@ discard block |
|
|
block discarded – undo |
|
1594
|
1594
|
* or the plugin name if not. |
|
1595
|
1595
|
*/ |
|
1596
|
1596
|
public function get_info_link( $slug ) { |
|
1597
|
|
- if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) { |
|
|
1597
|
+ if ( ! empty( $this->plugins[ $slug ][ 'external_url' ] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ][ 'external_url' ] ) ) { |
|
1598
|
1598
|
$link = sprintf( |
|
1599
|
1599
|
'<a href="%1$s" target="_blank">%2$s</a>', |
|
1600
|
|
- esc_url( $this->plugins[ $slug ]['external_url'] ), |
|
1601
|
|
- esc_html( $this->plugins[ $slug ]['name'] ) |
|
|
1600
|
+ esc_url( $this->plugins[ $slug ][ 'external_url' ] ), |
|
|
1601
|
+ esc_html( $this->plugins[ $slug ][ 'name' ] ) |
|
1602
|
1602
|
); |
|
1603
|
|
- } elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) { |
|
|
1603
|
+ } elseif ( 'repo' === $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1604
|
1604
|
$url = add_query_arg( |
|
1605
|
1605
|
array( |
|
1606
|
1606
|
'tab' => 'plugin-information', |
|
@@ -1615,10 +1615,10 @@ discard block |
|
|
block discarded – undo |
|
1615
|
1615
|
$link = sprintf( |
|
1616
|
1616
|
'<a href="%1$s" class="thickbox">%2$s</a>', |
|
1617
|
1617
|
esc_url( $url ), |
|
1618
|
|
- esc_html( $this->plugins[ $slug ]['name'] ) |
|
|
1618
|
+ esc_html( $this->plugins[ $slug ][ 'name' ] ) |
|
1619
|
1619
|
); |
|
1620
|
1620
|
} else { |
|
1621
|
|
- $link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink. |
|
|
1621
|
+ $link = esc_html( $this->plugins[ $slug ][ 'name' ] ); // No hyperlink. |
|
1622
|
1622
|
} |
|
1623
|
1623
|
|
|
1624
|
1624
|
return $link; |
|
@@ -1632,7 +1632,7 @@ discard block |
|
|
block discarded – undo |
|
1632
|
1632
|
* @return boolean True when on the TGMPA page, false otherwise. |
|
1633
|
1633
|
*/ |
|
1634
|
1634
|
protected function is_tgmpa_page() { |
|
1635
|
|
- return isset( $_GET['page'] ) && $this->menu === $_GET['page']; |
|
|
1635
|
+ return isset( $_GET[ 'page' ] ) && $this->menu === $_GET[ 'page' ]; |
|
1636
|
1636
|
} |
|
1637
|
1637
|
|
|
1638
|
1638
|
/** |
|
@@ -1714,7 +1714,7 @@ discard block |
|
|
block discarded – undo |
|
1714
|
1714
|
public function is_plugin_installed( $slug ) { |
|
1715
|
1715
|
$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
|
1716
|
1716
|
|
|
1717
|
|
- return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) ); |
|
|
1717
|
+ return ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ] ) ); |
|
1718
|
1718
|
} |
|
1719
|
1719
|
|
|
1720
|
1720
|
/** |
|
@@ -1726,7 +1726,7 @@ discard block |
|
|
block discarded – undo |
|
1726
|
1726
|
* @return bool True if active, false otherwise. |
|
1727
|
1727
|
*/ |
|
1728
|
1728
|
public function is_plugin_active( $slug ) { |
|
1729
|
|
- return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) ); |
|
|
1729
|
+ return ( ( ! empty( $this->plugins[ $slug ][ 'is_callable' ] ) && is_callable( $this->plugins[ $slug ][ 'is_callable' ] ) ) || is_plugin_active( $this->plugins[ $slug ][ 'file_path' ] ) ); |
|
1730
|
1730
|
} |
|
1731
|
1731
|
|
|
1732
|
1732
|
/** |
|
@@ -1740,7 +1740,7 @@ discard block |
|
|
block discarded – undo |
|
1740
|
1740
|
*/ |
|
1741
|
1741
|
public function can_plugin_update( $slug ) { |
|
1742
|
1742
|
// We currently can't get reliable info on non-WP-repo plugins - issue #380. |
|
1743
|
|
- if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
|
1743
|
+ if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1744
|
1744
|
return true; |
|
1745
|
1745
|
} |
|
1746
|
1746
|
|
|
@@ -1796,8 +1796,8 @@ discard block |
|
|
block discarded – undo |
|
1796
|
1796
|
public function get_installed_version( $slug ) { |
|
1797
|
1797
|
$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
|
1798
|
1798
|
|
|
1799
|
|
- if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) { |
|
1800
|
|
- return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version']; |
|
|
1799
|
+ if ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ] ) ) { |
|
|
1800
|
+ return $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ]; |
|
1801
|
1801
|
} |
|
1802
|
1802
|
|
|
1803
|
1803
|
return ''; |
|
@@ -1813,7 +1813,7 @@ discard block |
|
|
block discarded – undo |
|
1813
|
1813
|
*/ |
|
1814
|
1814
|
public function does_plugin_require_update( $slug ) { |
|
1815
|
1815
|
$installed_version = $this->get_installed_version( $slug ); |
|
1816
|
|
- $minimum_version = $this->plugins[ $slug ]['version']; |
|
|
1816
|
+ $minimum_version = $this->plugins[ $slug ][ 'version' ]; |
|
1817
|
1817
|
|
|
1818
|
1818
|
return version_compare( $minimum_version, $installed_version, '>' ); |
|
1819
|
1819
|
} |
|
@@ -1828,9 +1828,9 @@ discard block |
|
|
block discarded – undo |
|
1828
|
1828
|
*/ |
|
1829
|
1829
|
public function does_plugin_have_update( $slug ) { |
|
1830
|
1830
|
// Presume bundled and external plugins will point to a package which meets the minimum required version. |
|
1831
|
|
- if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
|
1831
|
+ if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1832
|
1832
|
if ( $this->does_plugin_require_update( $slug ) ) { |
|
1833
|
|
- return $this->plugins[ $slug ]['version']; |
|
|
1833
|
+ return $this->plugins[ $slug ][ 'version' ]; |
|
1834
|
1834
|
} |
|
1835
|
1835
|
|
|
1836
|
1836
|
return false; |
|
@@ -1838,8 +1838,8 @@ discard block |
|
|
block discarded – undo |
|
1838
|
1838
|
|
|
1839
|
1839
|
$repo_updates = get_site_transient( 'update_plugins' ); |
|
1840
|
1840
|
|
|
1841
|
|
- if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) { |
|
1842
|
|
- return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version; |
|
|
1841
|
+ if ( isset( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version ) ) { |
|
|
1842
|
+ return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version; |
|
1843
|
1843
|
} |
|
1844
|
1844
|
|
|
1845
|
1845
|
return false; |
|
@@ -1855,14 +1855,14 @@ discard block |
|
|
block discarded – undo |
|
1855
|
1855
|
*/ |
|
1856
|
1856
|
public function get_upgrade_notice( $slug ) { |
|
1857
|
1857
|
// We currently can't get reliable info on non-WP-repo plugins - issue #380. |
|
1858
|
|
- if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
|
1858
|
+ if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1859
|
1859
|
return ''; |
|
1860
|
1860
|
} |
|
1861
|
1861
|
|
|
1862
|
1862
|
$repo_updates = get_site_transient( 'update_plugins' ); |
|
1863
|
1863
|
|
|
1864
|
|
- if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) { |
|
1865
|
|
- return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice; |
|
|
1864
|
+ if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice ) ) { |
|
|
1865
|
+ return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice; |
|
1866
|
1866
|
} |
|
1867
|
1867
|
|
|
1868
|
1868
|
return ''; |
|
@@ -1878,7 +1878,7 @@ discard block |
|
|
block discarded – undo |
|
1878
|
1878
|
*/ |
|
1879
|
1879
|
public function get_plugins( $plugin_folder = '' ) { |
|
1880
|
1880
|
if ( ! function_exists( 'get_plugins' ) ) { |
|
1881
|
|
- require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
|
1881
|
+ require_once ABSPATH.'wp-admin/includes/plugin.php'; |
|
1882
|
1882
|
} |
|
1883
|
1883
|
|
|
1884
|
1884
|
return get_plugins( $plugin_folder ); |
|
@@ -1893,7 +1893,7 @@ discard block |
|
|
block discarded – undo |
|
1893
|
1893
|
* @since 2.1.1 |
|
1894
|
1894
|
*/ |
|
1895
|
1895
|
public function update_dismiss() { |
|
1896
|
|
- delete_metadata( 'user', null, 'tgmpa_dismissed_notice_' . $this->id, null, true ); |
|
|
1896
|
+ delete_metadata( 'user', null, 'tgmpa_dismissed_notice_'.$this->id, null, true ); |
|
1897
|
1897
|
} |
|
1898
|
1898
|
|
|
1899
|
1899
|
/** |
|
@@ -1912,13 +1912,13 @@ discard block |
|
|
block discarded – undo |
|
1912
|
1912
|
*/ |
|
1913
|
1913
|
public function force_activation() { |
|
1914
|
1914
|
foreach ( $this->plugins as $slug => $plugin ) { |
|
1915
|
|
- if ( true === $plugin['force_activation'] ) { |
|
|
1915
|
+ if ( true === $plugin[ 'force_activation' ] ) { |
|
1916
|
1916
|
if ( ! $this->is_plugin_installed( $slug ) ) { |
|
1917
|
1917
|
// Oops, plugin isn't there so iterate to next condition. |
|
1918
|
1918
|
continue; |
|
1919
|
1919
|
} elseif ( $this->can_plugin_activate( $slug ) ) { |
|
1920
|
1920
|
// There we go, activate the plugin. |
|
1921
|
|
- activate_plugin( $plugin['file_path'] ); |
|
|
1921
|
+ activate_plugin( $plugin[ 'file_path' ] ); |
|
1922
|
1922
|
} |
|
1923
|
1923
|
} |
|
1924
|
1924
|
} |
|
@@ -1939,8 +1939,8 @@ discard block |
|
|
block discarded – undo |
|
1939
|
1939
|
public function force_deactivation() { |
|
1940
|
1940
|
foreach ( $this->plugins as $slug => $plugin ) { |
|
1941
|
1941
|
// Only proceed forward if the parameter is set to true and plugin is active. |
|
1942
|
|
- if ( true === $plugin['force_deactivation'] && $this->is_plugin_active( $slug ) ) { |
|
1943
|
|
- deactivate_plugins( $plugin['file_path'] ); |
|
|
1942
|
+ if ( true === $plugin[ 'force_deactivation' ] && $this->is_plugin_active( $slug ) ) { |
|
|
1943
|
+ deactivate_plugins( $plugin[ 'file_path' ] ); |
|
1944
|
1944
|
} |
|
1945
|
1945
|
} |
|
1946
|
1946
|
} |
|
@@ -1975,7 +1975,7 @@ discard block |
|
|
block discarded – undo |
|
1975
|
1975
|
* Ensure only one instance of the class is ever invoked. |
|
1976
|
1976
|
*/ |
|
1977
|
1977
|
function load_tgm_plugin_activation() { |
|
1978
|
|
- $GLOBALS['tgmpa'] = TGM_Plugin_Activation::get_instance(); |
|
|
1978
|
+ $GLOBALS[ 'tgmpa' ] = TGM_Plugin_Activation::get_instance(); |
|
1979
|
1979
|
} |
|
1980
|
1980
|
} |
|
1981
|
1981
|
|
|
@@ -1997,7 +1997,7 @@ discard block |
|
|
block discarded – undo |
|
1997
|
1997
|
* @param array $config Optional. An array of configuration values. |
|
1998
|
1998
|
*/ |
|
1999
|
1999
|
function tgmpa( $plugins, $config = array() ) { |
|
2000
|
|
- $instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
|
2000
|
+ $instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
2001
|
2001
|
|
|
2002
|
2002
|
foreach ( $plugins as $plugin ) { |
|
2003
|
2003
|
call_user_func( array( $instance, 'register' ), $plugin ); |
|
@@ -2005,17 +2005,17 @@ discard block |
|
|
block discarded – undo |
|
2005
|
2005
|
|
|
2006
|
2006
|
if ( ! empty( $config ) && is_array( $config ) ) { |
|
2007
|
2007
|
// Send out notices for deprecated arguments passed. |
|
2008
|
|
- if ( isset( $config['notices'] ) ) { |
|
|
2008
|
+ if ( isset( $config[ 'notices' ] ) ) { |
|
2009
|
2009
|
_deprecated_argument( __FUNCTION__, '2.2.0', 'The `notices` config parameter was renamed to `has_notices` in TGMPA 2.2.0. Please adjust your configuration.' ); |
|
2010
|
|
- if ( ! isset( $config['has_notices'] ) ) { |
|
2011
|
|
- $config['has_notices'] = $config['notices']; |
|
|
2010
|
+ if ( ! isset( $config[ 'has_notices' ] ) ) { |
|
|
2011
|
+ $config[ 'has_notices' ] = $config[ 'notices' ]; |
|
2012
|
2012
|
} |
|
2013
|
2013
|
} |
|
2014
|
2014
|
|
|
2015
|
|
- if ( isset( $config['parent_menu_slug'] ) ) { |
|
|
2015
|
+ if ( isset( $config[ 'parent_menu_slug' ] ) ) { |
|
2016
|
2016
|
_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.' ); |
|
2017
|
2017
|
} |
|
2018
|
|
- if ( isset( $config['parent_url_slug'] ) ) { |
|
|
2018
|
+ if ( isset( $config[ 'parent_url_slug' ] ) ) { |
|
2019
|
2019
|
_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.' ); |
|
2020
|
2020
|
} |
|
2021
|
2021
|
|
|
@@ -2031,7 +2031,7 @@ discard block |
|
|
block discarded – undo |
|
2031
|
2031
|
* @since 2.2.0 |
|
2032
|
2032
|
*/ |
|
2033
|
2033
|
if ( ! class_exists( 'WP_List_Table' ) ) { |
|
2034
|
|
- require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
|
2034
|
+ require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
2035
|
2035
|
} |
|
2036
|
2036
|
|
|
2037
|
2037
|
if ( ! class_exists( 'TGMPA_List_Table' ) ) { |
|
@@ -2092,7 +2092,7 @@ discard block |
|
|
block discarded – undo |
|
2092
|
2092
|
* @since 2.2.0 |
|
2093
|
2093
|
*/ |
|
2094
|
2094
|
public function __construct() { |
|
2095
|
|
- $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
|
2095
|
+ $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
2096
|
2096
|
|
|
2097
|
2097
|
parent::__construct( |
|
2098
|
2098
|
array( |
|
@@ -2102,8 +2102,8 @@ discard block |
|
|
block discarded – undo |
|
2102
|
2102
|
) |
|
2103
|
2103
|
); |
|
2104
|
2104
|
|
|
2105
|
|
- if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'install', 'update', 'activate' ), true ) ) { |
|
2106
|
|
- $this->view_context = sanitize_key( $_REQUEST['plugin_status'] ); |
|
|
2105
|
+ if ( isset( $_REQUEST[ 'plugin_status' ] ) && in_array( $_REQUEST[ 'plugin_status' ], array( 'install', 'update', 'activate' ), true ) ) { |
|
|
2106
|
+ $this->view_context = sanitize_key( $_REQUEST[ 'plugin_status' ] ); |
|
2107
|
2107
|
} |
|
2108
|
2108
|
|
|
2109
|
2109
|
add_filter( 'tgmpa_table_data_items', array( $this, 'sort_table_items' ) ); |
|
@@ -2150,20 +2150,20 @@ discard block |
|
|
block discarded – undo |
|
2150
|
2150
|
} |
|
2151
|
2151
|
|
|
2152
|
2152
|
foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) { |
|
2153
|
|
- $table_data[ $i ]['sanitized_plugin'] = $plugin['name']; |
|
2154
|
|
- $table_data[ $i ]['slug'] = $slug; |
|
2155
|
|
- $table_data[ $i ]['plugin'] = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>'; |
|
2156
|
|
- $table_data[ $i ]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] ); |
|
2157
|
|
- $table_data[ $i ]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] ); |
|
2158
|
|
- $table_data[ $i ]['status'] = $this->get_plugin_status_text( $slug ); |
|
2159
|
|
- $table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug ); |
|
2160
|
|
- $table_data[ $i ]['minimum_version'] = $plugin['version']; |
|
2161
|
|
- $table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
|
2153
|
+ $table_data[ $i ][ 'sanitized_plugin' ] = $plugin[ 'name' ]; |
|
|
2154
|
+ $table_data[ $i ][ 'slug' ] = $slug; |
|
|
2155
|
+ $table_data[ $i ][ 'plugin' ] = '<strong>'.$this->tgmpa->get_info_link( $slug ).'</strong>'; |
|
|
2156
|
+ $table_data[ $i ][ 'source' ] = $this->get_plugin_source_type_text( $plugin[ 'source_type' ] ); |
|
|
2157
|
+ $table_data[ $i ][ 'type' ] = $this->get_plugin_advise_type_text( $plugin[ 'required' ] ); |
|
|
2158
|
+ $table_data[ $i ][ 'status' ] = $this->get_plugin_status_text( $slug ); |
|
|
2159
|
+ $table_data[ $i ][ 'installed_version' ] = $this->tgmpa->get_installed_version( $slug ); |
|
|
2160
|
+ $table_data[ $i ][ 'minimum_version' ] = $plugin[ 'version' ]; |
|
|
2161
|
+ $table_data[ $i ][ 'available_version' ] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2162
|
2162
|
|
|
2163
|
2163
|
// Prep the upgrade notice info. |
|
2164
|
2164
|
$upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug ); |
|
2165
|
2165
|
if ( ! empty( $upgrade_notice ) ) { |
|
2166
|
|
- $table_data[ $i ]['upgrade_notice'] = $upgrade_notice; |
|
|
2166
|
+ $table_data[ $i ][ 'upgrade_notice' ] = $upgrade_notice; |
|
2167
|
2167
|
|
|
2168
|
2168
|
add_action( "tgmpa_after_plugin_row_$slug", array( $this, 'wp_plugin_update_row' ), 10, 2 ); |
|
2169
|
2169
|
} |
|
@@ -2194,17 +2194,17 @@ discard block |
|
|
block discarded – undo |
|
2194
|
2194
|
// No need to display plugins if they are installed, up-to-date and active. |
|
2195
|
2195
|
continue; |
|
2196
|
2196
|
} else { |
|
2197
|
|
- $plugins['all'][ $slug ] = $plugin; |
|
|
2197
|
+ $plugins[ 'all' ][ $slug ] = $plugin; |
|
2198
|
2198
|
|
|
2199
|
2199
|
if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) { |
|
2200
|
|
- $plugins['install'][ $slug ] = $plugin; |
|
|
2200
|
+ $plugins[ 'install' ][ $slug ] = $plugin; |
|
2201
|
2201
|
} else { |
|
2202
|
2202
|
if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) { |
|
2203
|
|
- $plugins['update'][ $slug ] = $plugin; |
|
|
2203
|
+ $plugins[ 'update' ][ $slug ] = $plugin; |
|
2204
|
2204
|
} |
|
2205
|
2205
|
|
|
2206
|
2206
|
if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
|
2207
|
|
- $plugins['activate'][ $slug ] = $plugin; |
|
|
2207
|
+ $plugins[ 'activate' ][ $slug ] = $plugin; |
|
2208
|
2208
|
} |
|
2209
|
2209
|
} |
|
2210
|
2210
|
} |
|
@@ -2323,8 +2323,8 @@ discard block |
|
|
block discarded – undo |
|
2323
|
2323
|
$name = array(); |
|
2324
|
2324
|
|
|
2325
|
2325
|
foreach ( $items as $i => $plugin ) { |
|
2326
|
|
- $type[ $i ] = $plugin['type']; // Required / recommended. |
|
2327
|
|
- $name[ $i ] = $plugin['sanitized_plugin']; |
|
|
2326
|
+ $type[ $i ] = $plugin[ 'type' ]; // Required / recommended. |
|
|
2327
|
+ $name[ $i ] = $plugin[ 'sanitized_plugin' ]; |
|
2328
|
2328
|
} |
|
2329
|
2329
|
|
|
2330
|
2330
|
array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items ); |
|
@@ -2406,9 +2406,9 @@ discard block |
|
|
block discarded – undo |
|
2406
|
2406
|
public function column_cb( $item ) { |
|
2407
|
2407
|
return sprintf( |
|
2408
|
2408
|
'<input type="checkbox" name="%1$s[]" value="%2$s" id="%3$s" />', |
|
2409
|
|
- esc_attr( $this->_args['singular'] ), |
|
2410
|
|
- esc_attr( $item['slug'] ), |
|
2411
|
|
- esc_attr( $item['sanitized_plugin'] ) |
|
|
2409
|
+ esc_attr( $this->_args[ 'singular' ] ), |
|
|
2410
|
+ esc_attr( $item[ 'slug' ] ), |
|
|
2411
|
+ esc_attr( $item[ 'sanitized_plugin' ] ) |
|
2412
|
2412
|
); |
|
2413
|
2413
|
} |
|
2414
|
2414
|
|
|
@@ -2423,7 +2423,7 @@ discard block |
|
|
block discarded – undo |
|
2423
|
2423
|
public function column_plugin( $item ) { |
|
2424
|
2424
|
return sprintf( |
|
2425
|
2425
|
'%1$s %2$s', |
|
2426
|
|
- $item['plugin'], |
|
|
2426
|
+ $item[ 'plugin' ], |
|
2427
|
2427
|
$this->row_actions( $this->get_row_actions( $item ), true ) |
|
2428
|
2428
|
); |
|
2429
|
2429
|
} |
|
@@ -2439,38 +2439,38 @@ discard block |
|
|
block discarded – undo |
|
2439
|
2439
|
public function column_version( $item ) { |
|
2440
|
2440
|
$output = array(); |
|
2441
|
2441
|
|
|
2442
|
|
- if ( $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
2443
|
|
- $installed = ! empty( $item['installed_version'] ) ? $item['installed_version'] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
|
2442
|
+ if ( $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
|
2443
|
+ $installed = ! empty( $item[ 'installed_version' ] ) ? $item[ 'installed_version' ] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
2444
|
2444
|
|
|
2445
|
2445
|
$color = ''; |
|
2446
|
|
- if ( ! empty( $item['minimum_version'] ) && $this->tgmpa->does_plugin_require_update( $item['slug'] ) ) { |
|
|
2446
|
+ if ( ! empty( $item[ 'minimum_version' ] ) && $this->tgmpa->does_plugin_require_update( $item[ 'slug' ] ) ) { |
|
2447
|
2447
|
$color = ' color: #ff0000; font-weight: bold;'; |
|
2448
|
2448
|
} |
|
2449
|
2449
|
|
|
2450
|
|
- $output[] = sprintf( |
|
2451
|
|
- '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Installed version:', 'tgmpa' ) . '</p>', |
|
|
2450
|
+ $output[ ] = sprintf( |
|
|
2451
|
+ '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Installed version:', 'tgmpa' ).'</p>', |
|
2452
|
2452
|
$color, |
|
2453
|
2453
|
$installed |
|
2454
|
2454
|
); |
|
2455
|
2455
|
} |
|
2456
|
2456
|
|
|
2457
|
|
- if ( ! empty( $item['minimum_version'] ) ) { |
|
2458
|
|
- $output[] = sprintf( |
|
2459
|
|
- '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>' . __( 'Minimum required version:', 'tgmpa' ) . '</p>', |
|
2460
|
|
- $item['minimum_version'] |
|
|
2457
|
+ if ( ! empty( $item[ 'minimum_version' ] ) ) { |
|
|
2458
|
+ $output[ ] = sprintf( |
|
|
2459
|
+ '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>'.__( 'Minimum required version:', 'tgmpa' ).'</p>', |
|
|
2460
|
+ $item[ 'minimum_version' ] |
|
2461
|
2461
|
); |
|
2462
|
2462
|
} |
|
2463
|
2463
|
|
|
2464
|
|
- if ( ! empty( $item['available_version'] ) ) { |
|
|
2464
|
+ if ( ! empty( $item[ 'available_version' ] ) ) { |
|
2465
|
2465
|
$color = ''; |
|
2466
|
|
- if ( ! empty( $item['minimum_version'] ) && version_compare( $item['available_version'], $item['minimum_version'], '>=' ) ) { |
|
|
2466
|
+ if ( ! empty( $item[ 'minimum_version' ] ) && version_compare( $item[ 'available_version' ], $item[ 'minimum_version' ], '>=' ) ) { |
|
2467
|
2467
|
$color = ' color: #71C671; font-weight: bold;'; |
|
2468
|
2468
|
} |
|
2469
|
2469
|
|
|
2470
|
|
- $output[] = sprintf( |
|
2471
|
|
- '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Available version:', 'tgmpa' ) . '</p>', |
|
|
2470
|
+ $output[ ] = sprintf( |
|
|
2471
|
+ '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Available version:', 'tgmpa' ).'</p>', |
|
2472
|
2472
|
$color, |
|
2473
|
|
- $item['available_version'] |
|
|
2473
|
+ $item[ 'available_version' ] |
|
2474
|
2474
|
); |
|
2475
|
2475
|
} |
|
2476
|
2476
|
|
|
@@ -2511,8 +2511,8 @@ discard block |
|
|
block discarded – undo |
|
2511
|
2511
|
); |
|
2512
|
2512
|
|
|
2513
|
2513
|
if ( 'all' === $this->view_context || 'update' === $this->view_context ) { |
|
2514
|
|
- $columns['version'] = __( 'Version', 'tgmpa' ); |
|
2515
|
|
- $columns['status'] = __( 'Status', 'tgmpa' ); |
|
|
2514
|
+ $columns[ 'version' ] = __( 'Version', 'tgmpa' ); |
|
|
2515
|
+ $columns[ 'status' ] = __( 'Status', 'tgmpa' ); |
|
2516
|
2516
|
} |
|
2517
|
2517
|
|
|
2518
|
2518
|
return apply_filters( 'tgmpa_table_columns', $columns ); |
|
@@ -2559,17 +2559,17 @@ discard block |
|
|
block discarded – undo |
|
2559
|
2559
|
$action_links = array(); |
|
2560
|
2560
|
|
|
2561
|
2561
|
// Display the 'Install' action link if the plugin is not yet available. |
|
2562
|
|
- if ( ! $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
2563
|
|
- $actions['install'] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
|
2562
|
+ if ( ! $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
|
2563
|
+ $actions[ 'install' ] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2564
|
2564
|
} else { |
|
2565
|
2565
|
// Display the 'Update' action link if an update is available and WP complies with plugin minimum. |
|
2566
|
|
- if ( false !== $this->tgmpa->does_plugin_have_update( $item['slug'] ) && $this->tgmpa->can_plugin_update( $item['slug'] ) ) { |
|
2567
|
|
- $actions['update'] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
|
2566
|
+ if ( false !== $this->tgmpa->does_plugin_have_update( $item[ 'slug' ] ) && $this->tgmpa->can_plugin_update( $item[ 'slug' ] ) ) { |
|
|
2567
|
+ $actions[ 'update' ] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2568
|
2568
|
} |
|
2569
|
2569
|
|
|
2570
|
2570
|
// Display the 'Activate' action link, but only if the plugin meets the minimum version. |
|
2571
|
|
- if ( $this->tgmpa->can_plugin_activate( $item['slug'] ) ) { |
|
2572
|
|
- $actions['activate'] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
|
2571
|
+ if ( $this->tgmpa->can_plugin_activate( $item[ 'slug' ] ) ) { |
|
|
2572
|
+ $actions[ 'activate' ] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2573
|
2573
|
} |
|
2574
|
2574
|
} |
|
2575
|
2575
|
|
|
@@ -2578,24 +2578,24 @@ discard block |
|
|
block discarded – undo |
|
2578
|
2578
|
$nonce_url = wp_nonce_url( |
|
2579
|
2579
|
add_query_arg( |
|
2580
|
2580
|
array( |
|
2581
|
|
- 'plugin' => urlencode( $item['slug'] ), |
|
2582
|
|
- 'tgmpa-' . $action => $action . '-plugin', |
|
|
2581
|
+ 'plugin' => urlencode( $item[ 'slug' ] ), |
|
|
2582
|
+ 'tgmpa-'.$action => $action.'-plugin', |
|
2583
|
2583
|
), |
|
2584
|
2584
|
$this->tgmpa->get_tgmpa_url() |
|
2585
|
2585
|
), |
|
2586
|
|
- 'tgmpa-' . $action, |
|
|
2586
|
+ 'tgmpa-'.$action, |
|
2587
|
2587
|
'tgmpa-nonce' |
|
2588
|
2588
|
); |
|
2589
|
2589
|
|
|
2590
|
2590
|
$action_links[ $action ] = sprintf( |
|
2591
|
|
- '<a href="%1$s">' . esc_html( $text ) . '</a>', |
|
|
2591
|
+ '<a href="%1$s">'.esc_html( $text ).'</a>', |
|
2592
|
2592
|
esc_url( $nonce_url ), |
|
2593
|
|
- '<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>' |
|
|
2593
|
+ '<span class="screen-reader-text">'.esc_html( $item[ 'sanitized_plugin' ] ).'</span>' |
|
2594
|
2594
|
); |
|
2595
|
2595
|
} |
|
2596
|
2596
|
|
|
2597
|
2597
|
$prefix = ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) ? 'network_admin_' : ''; |
|
2598
|
|
- return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item['slug'], $item, $this->view_context ); |
|
|
2598
|
+ return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item[ 'slug' ], $item, $this->view_context ); |
|
2599
|
2599
|
} |
|
2600
|
2600
|
|
|
2601
|
2601
|
/** |
|
@@ -2616,7 +2616,7 @@ discard block |
|
|
block discarded – undo |
|
2616
|
2616
|
* |
|
2617
|
2617
|
* @since 2.5.0 |
|
2618
|
2618
|
*/ |
|
2619
|
|
- do_action( "tgmpa_after_plugin_row_{$item['slug']}", $item['slug'], $item, $this->view_context ); |
|
|
2619
|
+ do_action( "tgmpa_after_plugin_row_{$item[ 'slug' ]}", $item[ 'slug' ], $item, $this->view_context ); |
|
2620
|
2620
|
} |
|
2621
|
2621
|
|
|
2622
|
2622
|
/** |
|
@@ -2631,7 +2631,7 @@ discard block |
|
|
block discarded – undo |
|
2631
|
2631
|
* @return null Return early if upgrade notice is empty. |
|
2632
|
2632
|
*/ |
|
2633
|
2633
|
public function wp_plugin_update_row( $slug, $item ) { |
|
2634
|
|
- if ( empty( $item['upgrade_notice'] ) ) { |
|
|
2634
|
+ if ( empty( $item[ 'upgrade_notice' ] ) ) { |
|
2635
|
2635
|
return; |
|
2636
|
2636
|
} |
|
2637
|
2637
|
|
|
@@ -2640,7 +2640,7 @@ discard block |
|
|
block discarded – undo |
|
2640
|
2640
|
<td colspan="', absint( $this->get_column_count() ), '" class="plugin-update colspanchange"> |
|
2641
|
2641
|
<div class="update-message">', |
|
2642
|
2642
|
esc_html__( 'Upgrade message from the plugin author:', 'tgmpa' ), |
|
2643
|
|
- ' <strong>', wp_kses_data( $item['upgrade_notice'] ), '</strong> |
|
|
2643
|
+ ' <strong>', wp_kses_data( $item[ 'upgrade_notice' ] ), '</strong> |
|
2644
|
2644
|
</div> |
|
2645
|
2645
|
</td> |
|
2646
|
2646
|
</tr>'; |
|
@@ -2672,16 +2672,16 @@ discard block |
|
|
block discarded – undo |
|
2672
|
2672
|
|
|
2673
|
2673
|
if ( 'update' !== $this->view_context && 'activate' !== $this->view_context ) { |
|
2674
|
2674
|
if ( current_user_can( 'install_plugins' ) ) { |
|
2675
|
|
- $actions['tgmpa-bulk-install'] = __( 'Install', 'tgmpa' ); |
|
|
2675
|
+ $actions[ 'tgmpa-bulk-install' ] = __( 'Install', 'tgmpa' ); |
|
2676
|
2676
|
} |
|
2677
|
2677
|
} |
|
2678
|
2678
|
|
|
2679
|
2679
|
if ( 'install' !== $this->view_context ) { |
|
2680
|
2680
|
if ( current_user_can( 'update_plugins' ) ) { |
|
2681
|
|
- $actions['tgmpa-bulk-update'] = __( 'Update', 'tgmpa' ); |
|
|
2681
|
+ $actions[ 'tgmpa-bulk-update' ] = __( 'Update', 'tgmpa' ); |
|
2682
|
2682
|
} |
|
2683
|
2683
|
if ( current_user_can( 'activate_plugins' ) ) { |
|
2684
|
|
- $actions['tgmpa-bulk-activate'] = __( 'Activate', 'tgmpa' ); |
|
|
2684
|
+ $actions[ 'tgmpa-bulk-activate' ] = __( 'Activate', 'tgmpa' ); |
|
2685
|
2685
|
} |
|
2686
|
2686
|
} |
|
2687
|
2687
|
|
|
@@ -2700,7 +2700,7 @@ discard block |
|
|
block discarded – undo |
|
2700
|
2700
|
// Bulk installation process. |
|
2701
|
2701
|
if ( 'tgmpa-bulk-install' === $this->current_action() || 'tgmpa-bulk-update' === $this->current_action() ) { |
|
2702
|
2702
|
|
|
2703
|
|
- check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
|
2703
|
+ check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2704
|
2704
|
|
|
2705
|
2705
|
$install_type = 'install'; |
|
2706
|
2706
|
if ( 'tgmpa-bulk-update' === $this->current_action() ) { |
|
@@ -2710,7 +2710,7 @@ discard block |
|
|
block discarded – undo |
|
2710
|
2710
|
$plugins_to_install = array(); |
|
2711
|
2711
|
|
|
2712
|
2712
|
// Did user actually select any plugins to install/update ? |
|
2713
|
|
- if ( empty( $_POST['plugin'] ) ) { |
|
|
2713
|
+ if ( empty( $_POST[ 'plugin' ] ) ) { |
|
2714
|
2714
|
if ( 'install' === $install_type ) { |
|
2715
|
2715
|
$message = __( 'No plugins were selected to be installed. No action taken.', 'tgmpa' ); |
|
2716
|
2716
|
} else { |
|
@@ -2722,11 +2722,11 @@ discard block |
|
|
block discarded – undo |
|
2722
|
2722
|
return false; |
|
2723
|
2723
|
} |
|
2724
|
2724
|
|
|
2725
|
|
- if ( is_array( $_POST['plugin'] ) ) { |
|
2726
|
|
- $plugins_to_install = (array) $_POST['plugin']; |
|
2727
|
|
- } elseif ( is_string( $_POST['plugin'] ) ) { |
|
|
2725
|
+ if ( is_array( $_POST[ 'plugin' ] ) ) { |
|
|
2726
|
+ $plugins_to_install = (array) $_POST[ 'plugin' ]; |
|
|
2727
|
+ } elseif ( is_string( $_POST[ 'plugin' ] ) ) { |
|
2728
|
2728
|
// Received via Filesystem page - un-flatten array (WP bug #19643). |
|
2729
|
|
- $plugins_to_install = explode( ',', $_POST['plugin'] ); |
|
|
2729
|
+ $plugins_to_install = explode( ',', $_POST[ 'plugin' ] ); |
|
2730
|
2730
|
} |
|
2731
|
2731
|
|
|
2732
|
2732
|
// Sanitize the received input. |
|
@@ -2768,11 +2768,11 @@ discard block |
|
|
block discarded – undo |
|
2768
|
2768
|
// Pass all necessary information if WP_Filesystem is needed. |
|
2769
|
2769
|
$url = wp_nonce_url( |
|
2770
|
2770
|
$this->tgmpa->get_tgmpa_url(), |
|
2771
|
|
- 'bulk-' . $this->_args['plural'] |
|
|
2771
|
+ 'bulk-'.$this->_args[ 'plural' ] |
|
2772
|
2772
|
); |
|
2773
|
2773
|
|
|
2774
|
2774
|
// Give validated data back to $_POST which is the only place the filesystem looks for extra fields. |
|
2775
|
|
- $_POST['plugin'] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
|
2775
|
+ $_POST[ 'plugin' ] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
2776
|
2776
|
|
|
2777
|
2777
|
$method = ''; // Leave blank so WP_Filesystem can populate it as necessary. |
|
2778
|
2778
|
$fields = array_keys( $_POST ); // Extra fields to pass to WP_Filesystem. |
|
@@ -2799,22 +2799,22 @@ discard block |
|
|
block discarded – undo |
|
2799
|
2799
|
|
|
2800
|
2800
|
// Prepare the data for validated plugins for the install/upgrade. |
|
2801
|
2801
|
foreach ( $plugins_to_install as $slug ) { |
|
2802
|
|
- $name = $this->tgmpa->plugins[ $slug ]['name']; |
|
|
2802
|
+ $name = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
2803
|
2803
|
$source = $this->tgmpa->get_download_url( $slug ); |
|
2804
|
2804
|
|
|
2805
|
2805
|
if ( ! empty( $name ) && ! empty( $source ) ) { |
|
2806
|
|
- $names[] = $name; |
|
|
2806
|
+ $names[ ] = $name; |
|
2807
|
2807
|
|
|
2808
|
2808
|
switch ( $install_type ) { |
|
2809
|
2809
|
|
|
2810
|
2810
|
case 'install': |
|
2811
|
|
- $sources[] = $source; |
|
|
2811
|
+ $sources[ ] = $source; |
|
2812
|
2812
|
break; |
|
2813
|
2813
|
|
|
2814
|
2814
|
case 'update': |
|
2815
|
|
- $file_paths[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
|
2815
|
+ $file_paths[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
2816
|
2816
|
$to_inject[ $slug ] = $this->tgmpa->plugins[ $slug ]; |
|
2817
|
|
- $to_inject[ $slug ]['source'] = $source; |
|
|
2817
|
+ $to_inject[ $slug ][ 'source' ] = $source; |
|
2818
|
2818
|
break; |
|
2819
|
2819
|
} |
|
2820
|
2820
|
} |
|
@@ -2826,7 +2826,7 @@ discard block |
|
|
block discarded – undo |
|
2826
|
2826
|
new TGMPA_Bulk_Installer_Skin( |
|
2827
|
2827
|
array( |
|
2828
|
2828
|
'url' => esc_url_raw( $this->tgmpa->get_tgmpa_url() ), |
|
2829
|
|
- 'nonce' => 'bulk-' . $this->_args['plural'], |
|
|
2829
|
+ 'nonce' => 'bulk-'.$this->_args[ 'plural' ], |
|
2830
|
2830
|
'names' => $names, |
|
2831
|
2831
|
'install_type' => $install_type, |
|
2832
|
2832
|
) |
|
@@ -2859,10 +2859,10 @@ discard block |
|
|
block discarded – undo |
|
2859
|
2859
|
|
|
2860
|
2860
|
// Bulk activation process. |
|
2861
|
2861
|
if ( 'tgmpa-bulk-activate' === $this->current_action() ) { |
|
2862
|
|
- check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
|
2862
|
+ check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2863
|
2863
|
|
|
2864
|
2864
|
// Did user actually select any plugins to activate ? |
|
2865
|
|
- if ( empty( $_POST['plugin'] ) ) { |
|
|
2865
|
+ if ( empty( $_POST[ 'plugin' ] ) ) { |
|
2866
|
2866
|
echo '<div id="message" class="error"><p>', esc_html__( 'No plugins were selected to be activated. No action taken.', 'tgmpa' ), '</p></div>'; |
|
2867
|
2867
|
|
|
2868
|
2868
|
return false; |
|
@@ -2870,8 +2870,8 @@ discard block |
|
|
block discarded – undo |
|
2870
|
2870
|
|
|
2871
|
2871
|
// Grab plugin data from $_POST. |
|
2872
|
2872
|
$plugins = array(); |
|
2873
|
|
- if ( isset( $_POST['plugin'] ) ) { |
|
2874
|
|
- $plugins = array_map( 'urldecode', (array) $_POST['plugin'] ); |
|
|
2873
|
+ if ( isset( $_POST[ 'plugin' ] ) ) { |
|
|
2874
|
+ $plugins = array_map( 'urldecode', (array) $_POST[ 'plugin' ] ); |
|
2875
|
2875
|
$plugins = array_map( array( $this->tgmpa, 'sanitize_key' ), $plugins ); |
|
2876
|
2876
|
} |
|
2877
|
2877
|
|
|
@@ -2881,8 +2881,8 @@ discard block |
|
|
block discarded – undo |
|
2881
|
2881
|
// Grab the file paths for the selected & inactive plugins from the registration array. |
|
2882
|
2882
|
foreach ( $plugins as $slug ) { |
|
2883
|
2883
|
if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
|
2884
|
|
- $plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
2885
|
|
- $plugin_names[] = $this->tgmpa->plugins[ $slug ]['name']; |
|
|
2884
|
+ $plugins_to_activate[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
|
2885
|
+ $plugin_names[ ] = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
2886
|
2886
|
} |
|
2887
|
2887
|
} |
|
2888
|
2888
|
unset( $slug ); |
|
@@ -2903,7 +2903,7 @@ discard block |
|
|
block discarded – undo |
|
2903
|
2903
|
$count = count( $plugin_names ); // Count so we can use _n function. |
|
2904
|
2904
|
$plugin_names = array_map( array( 'TGMPA_Utils', 'wrap_in_strong' ), $plugin_names ); |
|
2905
|
2905
|
$last_plugin = array_pop( $plugin_names ); // Pop off last name to prep for readability. |
|
2906
|
|
- $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
|
2906
|
+ $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); |
|
2907
|
2907
|
|
|
2908
|
2908
|
printf( // WPCS: xss ok. |
|
2909
|
2909
|
'<div id="message" class="updated"><p>%1$s %2$s.</p></div>', |
|
@@ -3006,16 +3006,16 @@ discard block |
|
|
block discarded – undo |
|
3006
|
3006
|
*/ |
|
3007
|
3007
|
function tgmpa_load_bulk_installer() { |
|
3008
|
3008
|
// Silently fail if 2.5+ is loaded *after* an older version. |
|
3009
|
|
- if ( ! isset( $GLOBALS['tgmpa'] ) ) { |
|
|
3009
|
+ if ( ! isset( $GLOBALS[ 'tgmpa' ] ) ) { |
|
3010
|
3010
|
return; |
|
3011
|
3011
|
} |
|
3012
|
3012
|
|
|
3013
|
3013
|
// Get TGMPA class instance. |
|
3014
|
|
- $tgmpa_instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
|
3014
|
+ $tgmpa_instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3015
|
3015
|
|
|
3016
|
|
- if ( isset( $_GET['page'] ) && $tgmpa_instance->menu === $_GET['page'] ) { |
|
|
3016
|
+ if ( isset( $_GET[ 'page' ] ) && $tgmpa_instance->menu === $_GET[ 'page' ] ) { |
|
3017
|
3017
|
if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
|
3018
|
|
- require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
|
3018
|
+ require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
3019
|
3019
|
} |
|
3020
|
3020
|
|
|
3021
|
3021
|
if ( ! class_exists( 'TGMPA_Bulk_Installer' ) ) { |
|
@@ -3082,11 +3082,11 @@ discard block |
|
|
block discarded – undo |
|
3082
|
3082
|
*/ |
|
3083
|
3083
|
public function __construct( $skin = null ) { |
|
3084
|
3084
|
// Get TGMPA class instance. |
|
3085
|
|
- $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
|
3085
|
+ $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3086
|
3086
|
|
|
3087
|
3087
|
parent::__construct( $skin ); |
|
3088
|
3088
|
|
|
3089
|
|
- if ( isset( $this->skin->options['install_type'] ) && 'update' === $this->skin->options['install_type'] ) { |
|
|
3089
|
+ if ( isset( $this->skin->options[ 'install_type' ] ) && 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3090
|
3090
|
$this->clear_destination = true; |
|
3091
|
3091
|
} |
|
3092
|
3092
|
|
|
@@ -3103,8 +3103,8 @@ discard block |
|
|
block discarded – undo |
|
3103
|
3103
|
* @since 2.2.0 |
|
3104
|
3104
|
*/ |
|
3105
|
3105
|
public function activate_strings() { |
|
3106
|
|
- $this->strings['activation_failed'] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
3107
|
|
- $this->strings['activation_success'] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
|
3106
|
+ $this->strings[ 'activation_failed' ] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
|
3107
|
+ $this->strings[ 'activation_success' ] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
3108
|
3108
|
} |
|
3109
|
3109
|
|
|
3110
|
3110
|
/** |
|
@@ -3122,7 +3122,7 @@ discard block |
|
|
block discarded – undo |
|
3122
|
3122
|
|
|
3123
|
3123
|
// Reset the strings in case we changed one during automatic activation. |
|
3124
|
3124
|
if ( $this->tgmpa->is_automatic ) { |
|
3125
|
|
- if ( 'update' === $this->skin->options['install_type'] ) { |
|
|
3125
|
+ if ( 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3126
|
3126
|
$this->upgrade_strings(); |
|
3127
|
3127
|
} else { |
|
3128
|
3128
|
$this->install_strings(); |
|
@@ -3280,7 +3280,7 @@ discard block |
|
|
block discarded – undo |
|
3280
|
3280
|
remove_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 ); |
|
3281
|
3281
|
|
|
3282
|
3282
|
// Force refresh of plugin update information. |
|
3283
|
|
- wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); |
|
|
3283
|
+ wp_clean_plugins_cache( $parsed_args[ 'clear_update_cache' ] ); |
|
3284
|
3284
|
|
|
3285
|
3285
|
return $results; |
|
3286
|
3286
|
} |
|
@@ -3331,13 +3331,13 @@ discard block |
|
|
block discarded – undo |
|
3331
|
3331
|
$activate = activate_plugin( $plugin_info ); |
|
3332
|
3332
|
|
|
3333
|
3333
|
// Adjust the success string based on the activation result. |
|
3334
|
|
- $this->strings['process_success'] = $this->strings['process_success'] . "<br />\n"; |
|
|
3334
|
+ $this->strings[ 'process_success' ] = $this->strings[ 'process_success' ]."<br />\n"; |
|
3335
|
3335
|
|
|
3336
|
3336
|
if ( is_wp_error( $activate ) ) { |
|
3337
|
3337
|
$this->skin->error( $activate ); |
|
3338
|
|
- $this->strings['process_success'] .= $this->strings['activation_failed']; |
|
|
3338
|
+ $this->strings[ 'process_success' ] .= $this->strings[ 'activation_failed' ]; |
|
3339
|
3339
|
} else { |
|
3340
|
|
- $this->strings['process_success'] .= $this->strings['activation_success']; |
|
|
3340
|
+ $this->strings[ 'process_success' ] .= $this->strings[ 'activation_success' ]; |
|
3341
|
3341
|
} |
|
3342
|
3342
|
} |
|
3343
|
3343
|
} |
|
@@ -3413,7 +3413,7 @@ discard block |
|
|
block discarded – undo |
|
3413
|
3413
|
*/ |
|
3414
|
3414
|
public function __construct( $args = array() ) { |
|
3415
|
3415
|
// Get TGMPA class instance. |
|
3416
|
|
- $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
|
3416
|
+ $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3417
|
3417
|
|
|
3418
|
3418
|
// Parse default and new args. |
|
3419
|
3419
|
$defaults = array( |
|
@@ -3422,10 +3422,10 @@ discard block |
|
|
block discarded – undo |
|
3422
|
3422
|
'names' => array(), |
|
3423
|
3423
|
'install_type' => 'install', |
|
3424
|
3424
|
); |
|
3425
|
|
- $args = wp_parse_args( $args, $defaults ); |
|
|
3425
|
+ $args = wp_parse_args( $args, $defaults ); |
|
3426
|
3426
|
|
|
3427
|
3427
|
// Set plugin names to $this->plugin_names property. |
|
3428
|
|
- $this->plugin_names = $args['names']; |
|
|
3428
|
+ $this->plugin_names = $args[ 'names' ]; |
|
3429
|
3429
|
|
|
3430
|
3430
|
// Extract the new args. |
|
3431
|
3431
|
parent::__construct( $args ); |
|
@@ -3440,25 +3440,25 @@ discard block |
|
|
block discarded – undo |
|
3440
|
3440
|
* @since 2.2.0 |
|
3441
|
3441
|
*/ |
|
3442
|
3442
|
public function add_strings() { |
|
3443
|
|
- if ( 'update' === $this->options['install_type'] ) { |
|
|
3443
|
+ if ( 'update' === $this->options[ 'install_type' ] ) { |
|
3444
|
3444
|
parent::add_strings(); |
|
3445
|
|
- $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
|
3445
|
+ $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3446
|
3446
|
} else { |
|
3447
|
|
- $this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
3448
|
|
- $this->upgrader->strings['skin_update_failed'] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
|
3447
|
+ $this->upgrader->strings[ 'skin_update_failed_error' ] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
|
3448
|
+ $this->upgrader->strings[ 'skin_update_failed' ] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
3449
|
3449
|
|
|
3450
|
3450
|
if ( $this->tgmpa->is_automatic ) { |
|
3451
|
3451
|
// Automatic activation strings. |
|
3452
|
|
- $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' ); |
|
3453
|
|
- $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>'; |
|
3454
|
|
- $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
3455
|
|
- $this->upgrader->strings['skin_before_update_header'] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
|
3452
|
+ $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' ); |
|
|
3453
|
+ $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>'; |
|
|
3454
|
+ $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
|
3455
|
+ $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3456
|
3456
|
} else { |
|
3457
|
3457
|
// Default installation strings. |
|
3458
|
|
- $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' ); |
|
3459
|
|
- $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>'; |
|
3460
|
|
- $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations have been completed.', 'tgmpa' ); |
|
3461
|
|
- $this->upgrader->strings['skin_before_update_header'] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
|
3458
|
+ $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' ); |
|
|
3459
|
+ $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>'; |
|
|
3460
|
+ $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations have been completed.', 'tgmpa' ); |
|
|
3461
|
+ $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3462
|
3462
|
} |
|
3463
|
3463
|
} |
|
3464
|
3464
|
} |
|
@@ -3516,12 +3516,12 @@ discard block |
|
|
block discarded – undo |
|
3516
|
3516
|
if ( $this->tgmpa->is_tgmpa_complete() ) { |
|
3517
|
3517
|
// All plugins are active, so we display the complete string and hide the menu to protect users. |
|
3518
|
3518
|
echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
|
3519
|
|
- $update_actions['dashboard'] = sprintf( |
|
3520
|
|
- esc_html( $this->tgmpa->strings['complete'] ), |
|
3521
|
|
- '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' |
|
|
3519
|
+ $update_actions[ 'dashboard' ] = sprintf( |
|
|
3520
|
+ esc_html( $this->tgmpa->strings[ 'complete' ] ), |
|
|
3521
|
+ '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' |
|
3522
|
3522
|
); |
|
3523
|
3523
|
} else { |
|
3524
|
|
- $update_actions['tgmpa_page'] = '<a href="' . esc_url( $this->tgmpa->get_tgmpa_url() ) . '" target="_parent">' . esc_html( $this->tgmpa->strings['return'] ) . '</a>'; |
|
|
3524
|
+ $update_actions[ 'tgmpa_page' ] = '<a href="'.esc_url( $this->tgmpa->get_tgmpa_url() ).'" target="_parent">'.esc_html( $this->tgmpa->strings[ 'return' ] ).'</a>'; |
|
3525
|
3525
|
} |
|
3526
|
3526
|
|
|
3527
|
3527
|
/** |
|
@@ -3611,7 +3611,7 @@ discard block |
|
|
block discarded – undo |
|
3611
|
3611
|
* @return string |
|
3612
|
3612
|
*/ |
|
3613
|
3613
|
public static function wrap_in_em( $string ) { |
|
3614
|
|
- return '<em>' . wp_kses_post( $string ) . '</em>'; |
|
|
3614
|
+ return '<em>'.wp_kses_post( $string ).'</em>'; |
|
3615
|
3615
|
} |
|
3616
|
3616
|
|
|
3617
|
3617
|
/** |
|
@@ -3625,7 +3625,7 @@ discard block |
|
|
block discarded – undo |
|
3625
|
3625
|
* @return string |
|
3626
|
3626
|
*/ |
|
3627
|
3627
|
public static function wrap_in_strong( $string ) { |
|
3628
|
|
- return '<strong>' . wp_kses_post( $string ) . '</strong>'; |
|
|
3628
|
+ return '<strong>'.wp_kses_post( $string ).'</strong>'; |
|
3629
|
3629
|
} |
|
3630
|
3630
|
|
|
3631
|
3631
|
/** |
|
@@ -3662,7 +3662,7 @@ discard block |
|
|
block discarded – undo |
|
3662
|
3662
|
*/ |
|
3663
|
3663
|
protected static function emulate_filter_bool( $value ) { |
|
3664
|
3664
|
// @codingStandardsIgnoreStart |
|
3665
|
|
- static $true = array( |
|
|
3665
|
+ static $true = array( |
|
3666
|
3666
|
'1', |
|
3667
|
3667
|
'true', 'True', 'TRUE', |
|
3668
|
3668
|
'y', 'Y', |