@@ -1327,13 +1327,13 @@ |
||
1327 | 1327 | $key = preg_replace( '`[^A-Za-z0-9_-]`', '', $key ); |
1328 | 1328 | |
1329 | 1329 | /** |
1330 | - * Filter a sanitized key string. |
|
1331 | - * |
|
1332 | - * @since 3.0.0 |
|
1333 | - * |
|
1334 | - * @param string $key Sanitized key. |
|
1335 | - * @param string $raw_key The key prior to sanitization. |
|
1336 | - */ |
|
1330 | + * Filter a sanitized key string. |
|
1331 | + * |
|
1332 | + * @since 3.0.0 |
|
1333 | + * |
|
1334 | + * @param string $key Sanitized key. |
|
1335 | + * @param string $raw_key The key prior to sanitization. |
|
1336 | + */ |
|
1337 | 1337 | return apply_filters( 'tgmpa_sanitize_key', $key, $raw_key ); |
1338 | 1338 | } |
1339 | 1339 |
@@ -949,7 +949,8 @@ discard block |
||
949 | 949 | if ( ! $automatic ) { |
950 | 950 | // Make sure message doesn't display again if bulk activation is performed |
951 | 951 | // immediately after a single activation. |
952 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
952 | + if ( ! isset( $_POST['action'] ) ) { |
|
953 | +// WPCS: CSRF OK. |
|
953 | 954 | echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>'; |
954 | 955 | } |
955 | 956 | } else { |
@@ -970,7 +971,8 @@ discard block |
||
970 | 971 | if ( ! $automatic ) { |
971 | 972 | // Make sure message doesn't display again if bulk activation is performed |
972 | 973 | // immediately after a single activation. |
973 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
974 | + if ( ! isset( $_POST['action'] ) ) { |
|
975 | +// WPCS: CSRF OK. |
|
974 | 976 | echo '<div id="message" class="error"><p>', |
975 | 977 | sprintf( |
976 | 978 | esc_html( $this->strings['plugin_needs_higher_version'] ), |
@@ -1621,10 +1623,12 @@ discard block |
||
1621 | 1623 | if ( 'update-core' === $screen->base ) { |
1622 | 1624 | // Core update screen. |
1623 | 1625 | return true; |
1624 | - } elseif ( 'plugins' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok. |
|
1626 | + } elseif ( 'plugins' === $screen->base && ! empty( $_POST['action'] ) ) { |
|
1627 | +// WPCS: CSRF ok. |
|
1625 | 1628 | // Plugins bulk update screen. |
1626 | 1629 | return true; |
1627 | - } elseif ( 'update' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok. |
|
1630 | + } elseif ( 'update' === $screen->base && ! empty( $_POST['action'] ) ) { |
|
1631 | +// WPCS: CSRF ok. |
|
1628 | 1632 | // Individual updates (ajax call). |
1629 | 1633 | return true; |
1630 | 1634 | } |
@@ -255,7 +255,7 @@ discard block |
||
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 ) ); |
@@ -459,10 +459,10 @@ discard block |
||
459 | 459 | if ( false !== strpos( __FILE__, WP_PLUGIN_DIR ) || false !== strpos( __FILE__, WPMU_PLUGIN_DIR ) ) { |
460 | 460 | // Plugin, we'll need to adjust the file name. |
461 | 461 | add_action( 'load_textdomain_mofile', array( $this, 'correct_plugin_mofile' ), 10, 2 ); |
462 | - load_theme_textdomain( 'tgmpa', dirname( __FILE__ ) . '/languages' ); |
|
462 | + load_theme_textdomain( 'tgmpa', dirname( __FILE__ ).'/languages' ); |
|
463 | 463 | remove_action( 'load_textdomain_mofile', array( $this, 'correct_plugin_mofile' ), 10 ); |
464 | 464 | } else { |
465 | - load_theme_textdomain( 'tgmpa', dirname( __FILE__ ) . '/languages' ); |
|
465 | + load_theme_textdomain( 'tgmpa', dirname( __FILE__ ).'/languages' ); |
|
466 | 466 | } |
467 | 467 | } |
468 | 468 | |
@@ -535,15 +535,15 @@ discard block |
||
535 | 535 | public function add_plugin_action_link_filters() { |
536 | 536 | foreach ( $this->plugins as $slug => $plugin ) { |
537 | 537 | if ( false === $this->can_plugin_activate( $slug ) ) { |
538 | - add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_activate' ), 20 ); |
|
538 | + add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_activate' ), 20 ); |
|
539 | 539 | } |
540 | 540 | |
541 | - if ( true === $plugin['force_activation'] ) { |
|
542 | - add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_deactivate' ), 20 ); |
|
541 | + if ( true === $plugin[ 'force_activation' ] ) { |
|
542 | + add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_deactivate' ), 20 ); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | if ( false !== $this->does_plugin_require_update( $slug ) ) { |
546 | - add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_update' ), 20 ); |
|
546 | + add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_update' ), 20 ); |
|
547 | 547 | } |
548 | 548 | } |
549 | 549 | } |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | * @return array |
559 | 559 | */ |
560 | 560 | public function filter_plugin_action_links_activate( $actions ) { |
561 | - unset( $actions['activate'] ); |
|
561 | + unset( $actions[ 'activate' ] ); |
|
562 | 562 | |
563 | 563 | return $actions; |
564 | 564 | } |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | * @return array |
573 | 573 | */ |
574 | 574 | public function filter_plugin_action_links_deactivate( $actions ) { |
575 | - unset( $actions['deactivate'] ); |
|
575 | + unset( $actions[ 'deactivate' ] ); |
|
576 | 576 | |
577 | 577 | return $actions; |
578 | 578 | } |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | * @return array |
588 | 588 | */ |
589 | 589 | public function filter_plugin_action_links_update( $actions ) { |
590 | - $actions['update'] = sprintf( |
|
590 | + $actions[ 'update' ] = sprintf( |
|
591 | 591 | '<a href="%1$s" title="%2$s" class="edit">%3$s</a>', |
592 | 592 | esc_url( $this->get_tgmpa_status_url( 'update' ) ), |
593 | 593 | esc_attr__( 'This plugin needs to be updated to be compatible with your theme.', 'tgmpa' ), |
@@ -625,9 +625,9 @@ discard block |
||
625 | 625 | return; |
626 | 626 | } |
627 | 627 | |
628 | - if ( isset( $_REQUEST['tab'] ) && 'plugin-information' === $_REQUEST['tab'] ) { |
|
628 | + if ( isset( $_REQUEST[ 'tab' ] ) && 'plugin-information' === $_REQUEST[ 'tab' ] ) { |
|
629 | 629 | // Needed for install_plugin_information(). |
630 | - require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
|
630 | + require_once ABSPATH.'wp-admin/includes/plugin-install.php'; |
|
631 | 631 | |
632 | 632 | wp_enqueue_style( 'plugin-install' ); |
633 | 633 | |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | * @since 2.1.0 |
656 | 656 | */ |
657 | 657 | public function thickbox() { |
658 | - if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) ) { |
|
658 | + if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, true ) ) { |
|
659 | 659 | add_thickbox(); |
660 | 660 | } |
661 | 661 | } |
@@ -684,11 +684,11 @@ discard block |
||
684 | 684 | $args = apply_filters( |
685 | 685 | 'tgmpa_admin_menu_args', |
686 | 686 | array( |
687 | - 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
688 | - 'page_title' => $this->strings['page_title'], // Page title. |
|
689 | - 'menu_title' => $this->strings['menu_title'], // Menu title. |
|
690 | - 'capability' => $this->capability, // Capability. |
|
691 | - 'menu_slug' => $this->menu, // Menu slug. |
|
687 | + 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
688 | + 'page_title' => $this->strings[ 'page_title' ], // Page title. |
|
689 | + 'menu_title' => $this->strings[ 'menu_title' ], // Menu title. |
|
690 | + 'capability' => $this->capability, // Capability. |
|
691 | + 'menu_slug' => $this->menu, // Menu slug. |
|
692 | 692 | 'function' => array( $this, 'install_plugins_page' ), // Callback. |
693 | 693 | ) |
694 | 694 | ); |
@@ -712,9 +712,9 @@ discard block |
||
712 | 712 | } |
713 | 713 | |
714 | 714 | if ( 'themes.php' === $this->parent_slug ) { |
715 | - $this->page_hook = call_user_func( 'add_theme_page', $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] ); |
|
715 | + $this->page_hook = call_user_func( 'add_theme_page', $args[ 'page_title' ], $args[ 'menu_title' ], $args[ 'capability' ], $args[ 'menu_slug' ], $args[ 'function' ] ); |
|
716 | 716 | } else { |
717 | - $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'] ); |
|
717 | + $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' ] ); |
|
718 | 718 | } |
719 | 719 | } |
720 | 720 | |
@@ -783,37 +783,37 @@ discard block |
||
783 | 783 | * @return boolean True on success, false on failure. |
784 | 784 | */ |
785 | 785 | protected function do_plugin_install() { |
786 | - if ( empty( $_GET['plugin'] ) ) { |
|
786 | + if ( empty( $_GET[ 'plugin' ] ) ) { |
|
787 | 787 | return false; |
788 | 788 | } |
789 | 789 | |
790 | 790 | // All plugin information will be stored in an array for processing. |
791 | - $slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) ); |
|
791 | + $slug = $this->sanitize_key( urldecode( $_GET[ 'plugin' ] ) ); |
|
792 | 792 | |
793 | 793 | if ( ! isset( $this->plugins[ $slug ] ) ) { |
794 | 794 | return false; |
795 | 795 | } |
796 | 796 | |
797 | 797 | // Was an install or upgrade action link clicked? |
798 | - if ( ( isset( $_GET['tgmpa-install'] ) && 'install-plugin' === $_GET['tgmpa-install'] ) || ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) ) { |
|
798 | + if ( ( isset( $_GET[ 'tgmpa-install' ] ) && 'install-plugin' === $_GET[ 'tgmpa-install' ] ) || ( isset( $_GET[ 'tgmpa-update' ] ) && 'update-plugin' === $_GET[ 'tgmpa-update' ] ) ) { |
|
799 | 799 | |
800 | 800 | $install_type = 'install'; |
801 | - if ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) { |
|
801 | + if ( isset( $_GET[ 'tgmpa-update' ] ) && 'update-plugin' === $_GET[ 'tgmpa-update' ] ) { |
|
802 | 802 | $install_type = 'update'; |
803 | 803 | } |
804 | 804 | |
805 | - check_admin_referer( 'tgmpa-' . $install_type, 'tgmpa-nonce' ); |
|
805 | + check_admin_referer( 'tgmpa-'.$install_type, 'tgmpa-nonce' ); |
|
806 | 806 | |
807 | 807 | // Pass necessary information via URL if WP_Filesystem is needed. |
808 | 808 | $url = wp_nonce_url( |
809 | 809 | add_query_arg( |
810 | 810 | array( |
811 | 811 | 'plugin' => urlencode( $slug ), |
812 | - 'tgmpa-' . $install_type => $install_type . '-plugin', |
|
812 | + 'tgmpa-'.$install_type => $install_type.'-plugin', |
|
813 | 813 | ), |
814 | 814 | $this->get_tgmpa_url() |
815 | 815 | ), |
816 | - 'tgmpa-' . $install_type, |
|
816 | + 'tgmpa-'.$install_type, |
|
817 | 817 | 'tgmpa-nonce' |
818 | 818 | ); |
819 | 819 | |
@@ -832,29 +832,29 @@ discard block |
||
832 | 832 | |
833 | 833 | // Prep variables for Plugin_Installer_Skin class. |
834 | 834 | $extra = array(); |
835 | - $extra['slug'] = $slug; // Needed for potentially renaming of directory name. |
|
835 | + $extra[ 'slug' ] = $slug; // Needed for potentially renaming of directory name. |
|
836 | 836 | $source = $this->get_download_url( $slug ); |
837 | - $api = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null; |
|
837 | + $api = ( 'repo' === $this->plugins[ $slug ][ 'source_type' ] ) ? $this->get_plugins_api( $slug ) : null; |
|
838 | 838 | $api = ( false !== $api ) ? $api : null; |
839 | 839 | |
840 | 840 | $url = add_query_arg( |
841 | 841 | array( |
842 | - 'action' => $install_type . '-plugin', |
|
842 | + 'action' => $install_type.'-plugin', |
|
843 | 843 | 'plugin' => urlencode( $slug ), |
844 | 844 | ), |
845 | 845 | 'update.php' |
846 | 846 | ); |
847 | 847 | |
848 | 848 | if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
849 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
849 | + require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
850 | 850 | } |
851 | 851 | |
852 | - $title = ( 'update' === $install_type ) ? $this->strings['updating'] : $this->strings['installing']; |
|
852 | + $title = ( 'update' === $install_type ) ? $this->strings[ 'updating' ] : $this->strings[ 'installing' ]; |
|
853 | 853 | $skin_args = array( |
854 | - 'type' => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload', |
|
855 | - 'title' => sprintf( $title, $this->plugins[ $slug ]['name'] ), |
|
854 | + 'type' => ( 'bundled' !== $this->plugins[ $slug ][ 'source_type' ] ) ? 'web' : 'upload', |
|
855 | + 'title' => sprintf( $title, $this->plugins[ $slug ][ 'name' ] ), |
|
856 | 856 | 'url' => esc_url_raw( $url ), |
857 | - 'nonce' => $install_type . '-plugin_' . $slug, |
|
857 | + 'nonce' => $install_type.'-plugin_'.$slug, |
|
858 | 858 | 'plugin' => '', |
859 | 859 | 'api' => $api, |
860 | 860 | 'extra' => $extra, |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | unset( $title ); |
863 | 863 | |
864 | 864 | if ( 'update' === $install_type ) { |
865 | - $skin_args['plugin'] = $this->plugins[ $slug ]['file_path']; |
|
865 | + $skin_args[ 'plugin' ] = $this->plugins[ $slug ][ 'file_path' ]; |
|
866 | 866 | $skin = new Plugin_Upgrader_Skin( $skin_args ); |
867 | 867 | } else { |
868 | 868 | $skin = new Plugin_Installer_Skin( $skin_args ); |
@@ -877,10 +877,10 @@ discard block |
||
877 | 877 | if ( 'update' === $install_type ) { |
878 | 878 | // Inject our info into the update transient. |
879 | 879 | $to_inject = array( $slug => $this->plugins[ $slug ] ); |
880 | - $to_inject[ $slug ]['source'] = $source; |
|
880 | + $to_inject[ $slug ][ 'source' ] = $source; |
|
881 | 881 | $this->inject_update_info( $to_inject ); |
882 | 882 | |
883 | - $upgrader->upgrade( $this->plugins[ $slug ]['file_path'] ); |
|
883 | + $upgrader->upgrade( $this->plugins[ $slug ][ 'file_path' ] ); |
|
884 | 884 | } else { |
885 | 885 | $upgrader->install( $source ); |
886 | 886 | } |
@@ -903,18 +903,18 @@ discard block |
||
903 | 903 | |
904 | 904 | // Display message based on if all plugins are now active or not. |
905 | 905 | if ( $this->is_tgmpa_complete() ) { |
906 | - echo '<p>', sprintf( esc_html( $this->strings['complete'] ), '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' ), '</p>'; |
|
906 | + echo '<p>', sprintf( esc_html( $this->strings[ 'complete' ] ), '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' ), '</p>'; |
|
907 | 907 | echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
908 | 908 | } else { |
909 | - echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; |
|
909 | + echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings[ 'return' ] ), '</a></p>'; |
|
910 | 910 | } |
911 | 911 | |
912 | 912 | return true; |
913 | - } elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) { |
|
913 | + } elseif ( isset( $this->plugins[ $slug ][ 'file_path' ], $_GET[ 'tgmpa-activate' ] ) && 'activate-plugin' === $_GET[ 'tgmpa-activate' ] ) { |
|
914 | 914 | // Activate action link was clicked. |
915 | 915 | check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' ); |
916 | 916 | |
917 | - if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) { |
|
917 | + if ( false === $this->activate_single_plugin( $this->plugins[ $slug ][ 'file_path' ], $slug ) ) { |
|
918 | 918 | return true; // Finish execution of the function early as we encountered an error. |
919 | 919 | } |
920 | 920 | } |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | } |
938 | 938 | |
939 | 939 | foreach ( $plugins as $slug => $plugin ) { |
940 | - $file_path = $plugin['file_path']; |
|
940 | + $file_path = $plugin[ 'file_path' ]; |
|
941 | 941 | |
942 | 942 | if ( empty( $repo_updates->response[ $file_path ] ) ) { |
943 | 943 | $repo_updates->response[ $file_path ] = new stdClass; |
@@ -946,10 +946,10 @@ discard block |
||
946 | 946 | // We only really need to set package, but let's do all we can in case WP changes something. |
947 | 947 | $repo_updates->response[ $file_path ]->slug = $slug; |
948 | 948 | $repo_updates->response[ $file_path ]->plugin = $file_path; |
949 | - $repo_updates->response[ $file_path ]->new_version = $plugin['version']; |
|
950 | - $repo_updates->response[ $file_path ]->package = $plugin['source']; |
|
951 | - if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) { |
|
952 | - $repo_updates->response[ $file_path ]->url = $plugin['external_url']; |
|
949 | + $repo_updates->response[ $file_path ]->new_version = $plugin[ 'version' ]; |
|
950 | + $repo_updates->response[ $file_path ]->package = $plugin[ 'source' ]; |
|
951 | + if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin[ 'external_url' ] ) ) { |
|
952 | + $repo_updates->response[ $file_path ]->url = $plugin[ 'external_url' ]; |
|
953 | 953 | } |
954 | 954 | } |
955 | 955 | |
@@ -973,13 +973,13 @@ discard block |
||
973 | 973 | * @return string $source |
974 | 974 | */ |
975 | 975 | public function maybe_adjust_source_dir( $source, $remote_source, $upgrader ) { |
976 | - if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS['wp_filesystem'] ) ) { |
|
976 | + if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS[ 'wp_filesystem' ] ) ) { |
|
977 | 977 | return $source; |
978 | 978 | } |
979 | 979 | |
980 | 980 | // Check for single file plugins. |
981 | - $source_files = array_keys( $GLOBALS['wp_filesystem']->dirlist( $remote_source ) ); |
|
982 | - if ( 1 === count( $source_files ) && false === $GLOBALS['wp_filesystem']->is_dir( $source ) ) { |
|
981 | + $source_files = array_keys( $GLOBALS[ 'wp_filesystem' ]->dirlist( $remote_source ) ); |
|
982 | + if ( 1 === count( $source_files ) && false === $GLOBALS[ 'wp_filesystem' ]->is_dir( $source ) ) { |
|
983 | 983 | return $source; |
984 | 984 | } |
985 | 985 | |
@@ -987,12 +987,12 @@ discard block |
||
987 | 987 | $desired_slug = ''; |
988 | 988 | |
989 | 989 | // Figure out what the slug is supposed to be. |
990 | - if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options['extra']['slug'] ) ) { |
|
991 | - $desired_slug = $upgrader->skin->options['extra']['slug']; |
|
990 | + if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options[ 'extra' ][ 'slug' ] ) ) { |
|
991 | + $desired_slug = $upgrader->skin->options[ 'extra' ][ 'slug' ]; |
|
992 | 992 | } else { |
993 | 993 | // Bulk installer contains less info, so fall back on the info registered here. |
994 | 994 | foreach ( $this->plugins as $slug => $plugin ) { |
995 | - if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
|
995 | + if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin[ 'name' ] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
|
996 | 996 | $desired_slug = $slug; |
997 | 997 | break; |
998 | 998 | } |
@@ -1005,15 +1005,15 @@ discard block |
||
1005 | 1005 | |
1006 | 1006 | if ( ! empty( $subdir_name ) && $subdir_name !== $desired_slug ) { |
1007 | 1007 | $from = untrailingslashit( $source ); |
1008 | - $to = trailingslashit( $remote_source ) . $desired_slug; |
|
1008 | + $to = trailingslashit( $remote_source ).$desired_slug; |
|
1009 | 1009 | |
1010 | - if ( true === $GLOBALS['wp_filesystem']->move( $from, $to ) ) { |
|
1010 | + if ( true === $GLOBALS[ 'wp_filesystem' ]->move( $from, $to ) ) { |
|
1011 | 1011 | return trailingslashit( $to ); |
1012 | 1012 | } else { |
1013 | - 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 ) ); |
|
1013 | + 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 ) ); |
|
1014 | 1014 | } |
1015 | 1015 | } elseif ( empty( $subdir_name ) ) { |
1016 | - 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 ) ); |
|
1016 | + 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 ) ); |
|
1017 | 1017 | } |
1018 | 1018 | } |
1019 | 1019 | |
@@ -1037,19 +1037,19 @@ discard block |
||
1037 | 1037 | |
1038 | 1038 | if ( is_wp_error( $activate ) ) { |
1039 | 1039 | echo '<div id="message" class="error"><p>', wp_kses_post( $activate->get_error_message() ), '</p></div>', |
1040 | - '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; |
|
1040 | + '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings[ 'return' ] ), '</a></p>'; |
|
1041 | 1041 | |
1042 | 1042 | return false; // End it here if there is an error with activation. |
1043 | 1043 | } else { |
1044 | 1044 | if ( ! $automatic ) { |
1045 | 1045 | // Make sure message doesn't display again if bulk activation is performed |
1046 | 1046 | // immediately after a single activation. |
1047 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
1048 | - echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>'; |
|
1047 | + if ( ! isset( $_POST[ 'action' ] ) ) { // WPCS: CSRF OK. |
|
1048 | + echo '<div id="message" class="updated"><p>', esc_html( $this->strings[ 'activated_successfully' ] ), ' <strong>', esc_html( $this->plugins[ $slug ][ 'name' ] ), '.</strong></p></div>'; |
|
1049 | 1049 | } |
1050 | 1050 | } else { |
1051 | 1051 | // Simpler message layout for use on the plugin install page. |
1052 | - echo '<p>', esc_html( $this->strings['plugin_activated'] ), '</p>'; |
|
1052 | + echo '<p>', esc_html( $this->strings[ 'plugin_activated' ] ), '</p>'; |
|
1053 | 1053 | } |
1054 | 1054 | } |
1055 | 1055 | } elseif ( $this->is_plugin_active( $slug ) ) { |
@@ -1057,25 +1057,25 @@ discard block |
||
1057 | 1057 | // on the plugin install page. |
1058 | 1058 | echo '<div id="message" class="error"><p>', |
1059 | 1059 | sprintf( |
1060 | - esc_html( $this->strings['plugin_already_active'] ), |
|
1061 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
1060 | + esc_html( $this->strings[ 'plugin_already_active' ] ), |
|
1061 | + '<strong>'.esc_html( $this->plugins[ $slug ][ 'name' ] ).'</strong>' |
|
1062 | 1062 | ), |
1063 | 1063 | '</p></div>'; |
1064 | 1064 | } elseif ( $this->does_plugin_require_update( $slug ) ) { |
1065 | 1065 | if ( ! $automatic ) { |
1066 | 1066 | // Make sure message doesn't display again if bulk activation is performed |
1067 | 1067 | // immediately after a single activation. |
1068 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
1068 | + if ( ! isset( $_POST[ 'action' ] ) ) { // WPCS: CSRF OK. |
|
1069 | 1069 | echo '<div id="message" class="error"><p>', |
1070 | 1070 | sprintf( |
1071 | - esc_html( $this->strings['plugin_needs_higher_version'] ), |
|
1072 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
1071 | + esc_html( $this->strings[ 'plugin_needs_higher_version' ] ), |
|
1072 | + '<strong>'.esc_html( $this->plugins[ $slug ][ 'name' ] ).'</strong>' |
|
1073 | 1073 | ), |
1074 | 1074 | '</p></div>'; |
1075 | 1075 | } |
1076 | 1076 | } else { |
1077 | 1077 | // Simpler message layout for use on the plugin install page. |
1078 | - echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>'; |
|
1078 | + echo '<p>', sprintf( esc_html( $this->strings[ 'plugin_needs_higher_version' ] ), esc_html( $this->plugins[ $slug ][ 'name' ] ) ), '</p>'; |
|
1079 | 1079 | } |
1080 | 1080 | } |
1081 | 1081 | |
@@ -1099,7 +1099,7 @@ discard block |
||
1099 | 1099 | */ |
1100 | 1100 | public function notices() { |
1101 | 1101 | // Remove nag on the install page / Return early if the nag message has been dismissed or user < author. |
1102 | - if ( ( $this->is_tgmpa_page() || $this->is_core_update_page() ) || get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) || ! current_user_can( apply_filters( 'tgmpa_show_admin_notice_capability', 'publish_posts' ) ) ) { |
|
1102 | + if ( ( $this->is_tgmpa_page() || $this->is_core_update_page() ) || get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, true ) || ! current_user_can( apply_filters( 'tgmpa_show_admin_notice_capability', 'publish_posts' ) ) ) { |
|
1103 | 1103 | return; |
1104 | 1104 | } |
1105 | 1105 | |
@@ -1121,13 +1121,13 @@ discard block |
||
1121 | 1121 | if ( current_user_can( 'install_plugins' ) ) { |
1122 | 1122 | $install_link_count++; |
1123 | 1123 | |
1124 | - if ( true === $plugin['required'] ) { |
|
1125 | - $message['notice_can_install_required'][] = $slug; |
|
1124 | + if ( true === $plugin[ 'required' ] ) { |
|
1125 | + $message[ 'notice_can_install_required' ][ ] = $slug; |
|
1126 | 1126 | } else { |
1127 | - $message['notice_can_install_recommended'][] = $slug; |
|
1127 | + $message[ 'notice_can_install_recommended' ][ ] = $slug; |
|
1128 | 1128 | } |
1129 | 1129 | } |
1130 | - if ( true === $plugin['required'] ) { |
|
1130 | + if ( true === $plugin[ 'required' ] ) { |
|
1131 | 1131 | $total_required_action_count++; |
1132 | 1132 | } |
1133 | 1133 | } else { |
@@ -1135,13 +1135,13 @@ discard block |
||
1135 | 1135 | if ( current_user_can( 'activate_plugins' ) ) { |
1136 | 1136 | $activate_link_count++; |
1137 | 1137 | |
1138 | - if ( true === $plugin['required'] ) { |
|
1139 | - $message['notice_can_activate_required'][] = $slug; |
|
1138 | + if ( true === $plugin[ 'required' ] ) { |
|
1139 | + $message[ 'notice_can_activate_required' ][ ] = $slug; |
|
1140 | 1140 | } else { |
1141 | - $message['notice_can_activate_recommended'][] = $slug; |
|
1141 | + $message[ 'notice_can_activate_recommended' ][ ] = $slug; |
|
1142 | 1142 | } |
1143 | 1143 | } |
1144 | - if ( true === $plugin['required'] ) { |
|
1144 | + if ( true === $plugin[ 'required' ] ) { |
|
1145 | 1145 | $total_required_action_count++; |
1146 | 1146 | } |
1147 | 1147 | } |
@@ -1152,12 +1152,12 @@ discard block |
||
1152 | 1152 | $update_link_count++; |
1153 | 1153 | |
1154 | 1154 | if ( $this->does_plugin_require_update( $slug ) ) { |
1155 | - $message['notice_ask_to_update'][] = $slug; |
|
1155 | + $message[ 'notice_ask_to_update' ][ ] = $slug; |
|
1156 | 1156 | } elseif ( false !== $this->does_plugin_have_update( $slug ) ) { |
1157 | - $message['notice_ask_to_update_maybe'][] = $slug; |
|
1157 | + $message[ 'notice_ask_to_update_maybe' ][ ] = $slug; |
|
1158 | 1158 | } |
1159 | 1159 | } |
1160 | - if ( true === $plugin['required'] ) { |
|
1160 | + if ( true === $plugin[ 'required' ] ) { |
|
1161 | 1161 | $total_required_action_count++; |
1162 | 1162 | } |
1163 | 1163 | } |
@@ -1172,10 +1172,10 @@ discard block |
||
1172 | 1172 | |
1173 | 1173 | // As add_settings_error() wraps the final message in a <p> and as the final message can't be |
1174 | 1174 | // filtered, using <p>'s in our html would render invalid html output. |
1175 | - $line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>' . "\n"; |
|
1175 | + $line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>'."\n"; |
|
1176 | 1176 | |
1177 | 1177 | if ( ! current_user_can( 'activate_plugins' ) && ! current_user_can( 'install_plugins' ) && ! current_user_can( 'update_plugins' ) ) { |
1178 | - $rendered = esc_html__( $this->strings['notice_cannot_install_activate'] ) . ' ' . esc_html__( $this->strings['contact_admin'] ); |
|
1178 | + $rendered = esc_html__( $this->strings[ 'notice_cannot_install_activate' ] ).' '.esc_html__( $this->strings[ 'contact_admin' ] ); |
|
1179 | 1179 | $rendered .= $this->create_user_action_links_for_notice( 0, 0, 0, $line_template ); |
1180 | 1180 | } else { |
1181 | 1181 | |
@@ -1190,14 +1190,14 @@ discard block |
||
1190 | 1190 | |
1191 | 1191 | // Get the external info link for a plugin if one is available. |
1192 | 1192 | foreach ( $plugin_group as $plugin_slug ) { |
1193 | - $linked_plugins[] = $this->get_info_link( $plugin_slug ); |
|
1193 | + $linked_plugins[ ] = $this->get_info_link( $plugin_slug ); |
|
1194 | 1194 | } |
1195 | 1195 | unset( $plugin_slug ); |
1196 | 1196 | |
1197 | 1197 | $count = count( $plugin_group ); |
1198 | 1198 | $linked_plugins = array_map( array( 'TGMPA_Utils', 'wrap_in_em' ), $linked_plugins ); |
1199 | 1199 | $last_plugin = array_pop( $linked_plugins ); // Pop off last name to prep for readability. |
1200 | - $imploded = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
1200 | + $imploded = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); |
|
1201 | 1201 | |
1202 | 1202 | $rendered .= sprintf( |
1203 | 1203 | $line_template, |
@@ -1219,7 +1219,7 @@ discard block |
||
1219 | 1219 | } |
1220 | 1220 | |
1221 | 1221 | // Admin options pages already output settings_errors, so this is to avoid duplication. |
1222 | - if ( 'options-general' !== $GLOBALS['current_screen']->parent_base ) { |
|
1222 | + if ( 'options-general' !== $GLOBALS[ 'current_screen' ]->parent_base ) { |
|
1223 | 1223 | $this->display_settings_errors(); |
1224 | 1224 | } |
1225 | 1225 | } |
@@ -1241,32 +1241,32 @@ discard block |
||
1241 | 1241 | 'install' => '', |
1242 | 1242 | 'update' => '', |
1243 | 1243 | 'activate' => '', |
1244 | - '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>' : '', |
|
1244 | + '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>' : '', |
|
1245 | 1245 | ); |
1246 | 1246 | |
1247 | 1247 | $link_template = '<a href="%2$s">%1$s</a>'; |
1248 | 1248 | |
1249 | 1249 | if ( current_user_can( 'install_plugins' ) ) { |
1250 | 1250 | if ( $install_count > 0 ) { |
1251 | - $action_links['install'] = sprintf( |
|
1251 | + $action_links[ 'install' ] = sprintf( |
|
1252 | 1252 | $link_template, |
1253 | - translate_nooped_plural( $this->strings['install_link'], $install_count, 'tgmpa' ), |
|
1253 | + translate_nooped_plural( $this->strings[ 'install_link' ], $install_count, 'tgmpa' ), |
|
1254 | 1254 | esc_url( $this->get_tgmpa_status_url( 'install' ) ) |
1255 | 1255 | ); |
1256 | 1256 | } |
1257 | 1257 | if ( $update_count > 0 ) { |
1258 | - $action_links['update'] = sprintf( |
|
1258 | + $action_links[ 'update' ] = sprintf( |
|
1259 | 1259 | $link_template, |
1260 | - translate_nooped_plural( $this->strings['update_link'], $update_count, 'tgmpa' ), |
|
1260 | + translate_nooped_plural( $this->strings[ 'update_link' ], $update_count, 'tgmpa' ), |
|
1261 | 1261 | esc_url( $this->get_tgmpa_status_url( 'update' ) ) |
1262 | 1262 | ); |
1263 | 1263 | } |
1264 | 1264 | } |
1265 | 1265 | |
1266 | 1266 | if ( current_user_can( 'activate_plugins' ) && $activate_count > 0 ) { |
1267 | - $action_links['activate'] = sprintf( |
|
1267 | + $action_links[ 'activate' ] = sprintf( |
|
1268 | 1268 | $link_template, |
1269 | - translate_nooped_plural( $this->strings['activate_link'], $activate_count, 'tgmpa' ), |
|
1269 | + translate_nooped_plural( $this->strings[ 'activate_link' ], $activate_count, 'tgmpa' ), |
|
1270 | 1270 | esc_url( $this->get_tgmpa_status_url( 'activate' ) ) |
1271 | 1271 | ); |
1272 | 1272 | } |
@@ -1294,8 +1294,8 @@ discard block |
||
1294 | 1294 | * @return string |
1295 | 1295 | */ |
1296 | 1296 | protected function get_admin_notice_class() { |
1297 | - if ( ! empty( $this->strings['nag_type'] ) ) { |
|
1298 | - return sanitize_html_class( strtolower( $this->strings['nag_type'] ) ); |
|
1297 | + if ( ! empty( $this->strings[ 'nag_type' ] ) ) { |
|
1298 | + return sanitize_html_class( strtolower( $this->strings[ 'nag_type' ] ) ); |
|
1299 | 1299 | } else { |
1300 | 1300 | if ( version_compare( $this->wp_version, '4.2', '>=' ) ) { |
1301 | 1301 | return 'notice-warning'; |
@@ -1318,7 +1318,7 @@ discard block |
||
1318 | 1318 | settings_errors( 'tgmpa' ); |
1319 | 1319 | |
1320 | 1320 | foreach ( (array) $wp_settings_errors as $key => $details ) { |
1321 | - if ( 'tgmpa' === $details['setting'] ) { |
|
1321 | + if ( 'tgmpa' === $details[ 'setting' ] ) { |
|
1322 | 1322 | unset( $wp_settings_errors[ $key ] ); |
1323 | 1323 | break; |
1324 | 1324 | } |
@@ -1334,8 +1334,8 @@ discard block |
||
1334 | 1334 | * @since 2.1.0 |
1335 | 1335 | */ |
1336 | 1336 | public function dismiss() { |
1337 | - if ( isset( $_GET['tgmpa-dismiss'] ) && check_admin_referer( 'tgmpa-dismiss-' . get_current_user_id() ) ) { |
|
1338 | - update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, 1 ); |
|
1337 | + if ( isset( $_GET[ 'tgmpa-dismiss' ] ) && check_admin_referer( 'tgmpa-dismiss-'.get_current_user_id() ) ) { |
|
1338 | + update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, 1 ); |
|
1339 | 1339 | } |
1340 | 1340 | } |
1341 | 1341 | |
@@ -1351,54 +1351,54 @@ discard block |
||
1351 | 1351 | * @return null Return early if incorrect argument. |
1352 | 1352 | */ |
1353 | 1353 | public function register( $plugin ) { |
1354 | - if ( empty( $plugin['slug'] ) || empty( $plugin['name'] ) ) { |
|
1354 | + if ( empty( $plugin[ 'slug' ] ) || empty( $plugin[ 'name' ] ) ) { |
|
1355 | 1355 | return; |
1356 | 1356 | } |
1357 | 1357 | |
1358 | - if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) { |
|
1358 | + if ( empty( $plugin[ 'slug' ] ) || ! is_string( $plugin[ 'slug' ] ) || isset( $this->plugins[ $plugin[ 'slug' ] ] ) ) { |
|
1359 | 1359 | return; |
1360 | 1360 | } |
1361 | 1361 | |
1362 | 1362 | $defaults = array( |
1363 | - 'name' => '', // String |
|
1364 | - 'slug' => '', // String |
|
1365 | - 'source' => 'repo', // String |
|
1366 | - 'required' => false, // Boolean |
|
1367 | - 'version' => '', // String |
|
1368 | - 'force_activation' => false, // Boolean |
|
1369 | - 'force_deactivation' => false, // Boolean |
|
1370 | - 'external_url' => '', // String |
|
1371 | - 'is_callable' => '', // String|Array. |
|
1363 | + 'name' => '', // String |
|
1364 | + 'slug' => '', // String |
|
1365 | + 'source' => 'repo', // String |
|
1366 | + 'required' => false, // Boolean |
|
1367 | + 'version' => '', // String |
|
1368 | + 'force_activation' => false, // Boolean |
|
1369 | + 'force_deactivation' => false, // Boolean |
|
1370 | + 'external_url' => '', // String |
|
1371 | + 'is_callable' => '', // String|Array. |
|
1372 | 1372 | ); |
1373 | 1373 | |
1374 | 1374 | // Prepare the received data. |
1375 | 1375 | $plugin = wp_parse_args( $plugin, $defaults ); |
1376 | 1376 | |
1377 | 1377 | // Standardize the received slug. |
1378 | - $plugin['slug'] = $this->sanitize_key( $plugin['slug'] ); |
|
1378 | + $plugin[ 'slug' ] = $this->sanitize_key( $plugin[ 'slug' ] ); |
|
1379 | 1379 | |
1380 | 1380 | // Forgive users for using string versions of booleans or floats for version number. |
1381 | - $plugin['version'] = (string) $plugin['version']; |
|
1382 | - $plugin['source'] = empty( $plugin['source'] ) ? 'repo' : $plugin['source']; |
|
1383 | - $plugin['required'] = TGMPA_Utils::validate_bool( $plugin['required'] ); |
|
1384 | - $plugin['force_activation'] = TGMPA_Utils::validate_bool( $plugin['force_activation'] ); |
|
1385 | - $plugin['force_deactivation'] = TGMPA_Utils::validate_bool( $plugin['force_deactivation'] ); |
|
1381 | + $plugin[ 'version' ] = (string) $plugin[ 'version' ]; |
|
1382 | + $plugin[ 'source' ] = empty( $plugin[ 'source' ] ) ? 'repo' : $plugin[ 'source' ]; |
|
1383 | + $plugin[ 'required' ] = TGMPA_Utils::validate_bool( $plugin[ 'required' ] ); |
|
1384 | + $plugin[ 'force_activation' ] = TGMPA_Utils::validate_bool( $plugin[ 'force_activation' ] ); |
|
1385 | + $plugin[ 'force_deactivation' ] = TGMPA_Utils::validate_bool( $plugin[ 'force_deactivation' ] ); |
|
1386 | 1386 | |
1387 | 1387 | // Enrich the received data. |
1388 | - $plugin['file_path'] = $this->_get_plugin_basename_from_slug( $plugin['slug'] ); |
|
1389 | - $plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] ); |
|
1388 | + $plugin[ 'file_path' ] = $this->_get_plugin_basename_from_slug( $plugin[ 'slug' ] ); |
|
1389 | + $plugin[ 'source_type' ] = $this->get_plugin_source_type( $plugin[ 'source' ] ); |
|
1390 | 1390 | |
1391 | 1391 | // Set the class properties. |
1392 | - $this->plugins[ $plugin['slug'] ] = $plugin; |
|
1393 | - $this->sort_order[ $plugin['slug'] ] = $plugin['name']; |
|
1392 | + $this->plugins[ $plugin[ 'slug' ] ] = $plugin; |
|
1393 | + $this->sort_order[ $plugin[ 'slug' ] ] = $plugin[ 'name' ]; |
|
1394 | 1394 | |
1395 | 1395 | // Should we add the force activation hook ? |
1396 | - if ( true === $plugin['force_activation'] ) { |
|
1396 | + if ( true === $plugin[ 'force_activation' ] ) { |
|
1397 | 1397 | $this->has_forced_activation = true; |
1398 | 1398 | } |
1399 | 1399 | |
1400 | 1400 | // Should we add the force deactivation hook ? |
1401 | - if ( true === $plugin['force_deactivation'] ) { |
|
1401 | + if ( true === $plugin[ 'force_deactivation' ] ) { |
|
1402 | 1402 | $this->has_forced_deactivation = true; |
1403 | 1403 | } |
1404 | 1404 | } |
@@ -1524,11 +1524,11 @@ discard block |
||
1524 | 1524 | */ |
1525 | 1525 | public function populate_file_path( $plugin_slug = '' ) { |
1526 | 1526 | if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) { |
1527 | - $this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
1527 | + $this->plugins[ $plugin_slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
1528 | 1528 | } else { |
1529 | 1529 | // Add file_path key for all plugins. |
1530 | 1530 | foreach ( $this->plugins as $slug => $values ) { |
1531 | - $this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug ); |
|
1531 | + $this->plugins[ $slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $slug ); |
|
1532 | 1532 | } |
1533 | 1533 | } |
1534 | 1534 | } |
@@ -1546,7 +1546,7 @@ discard block |
||
1546 | 1546 | $keys = array_keys( $this->get_plugins() ); |
1547 | 1547 | |
1548 | 1548 | foreach ( $keys as $key ) { |
1549 | - if ( preg_match( '|^' . $slug . '/|', $key ) ) { |
|
1549 | + if ( preg_match( '|^'.$slug.'/|', $key ) ) { |
|
1550 | 1550 | return $key; |
1551 | 1551 | } |
1552 | 1552 | } |
@@ -1568,7 +1568,7 @@ discard block |
||
1568 | 1568 | */ |
1569 | 1569 | public function _get_plugin_data_from_name( $name, $data = 'slug' ) { |
1570 | 1570 | foreach ( $this->plugins as $values ) { |
1571 | - if ( $name === $values['name'] && isset( $values[ $data ] ) ) { |
|
1571 | + if ( $name === $values[ 'name' ] && isset( $values[ $data ] ) ) { |
|
1572 | 1572 | return $values[ $data ]; |
1573 | 1573 | } |
1574 | 1574 | } |
@@ -1587,13 +1587,13 @@ discard block |
||
1587 | 1587 | public function get_download_url( $slug ) { |
1588 | 1588 | $dl_source = ''; |
1589 | 1589 | |
1590 | - switch ( $this->plugins[ $slug ]['source_type'] ) { |
|
1590 | + switch ( $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1591 | 1591 | case 'repo': |
1592 | 1592 | return $this->get_wp_repo_download_url( $slug ); |
1593 | 1593 | case 'external': |
1594 | - return $this->plugins[ $slug ]['source']; |
|
1594 | + return $this->plugins[ $slug ][ 'source' ]; |
|
1595 | 1595 | case 'bundled': |
1596 | - return $this->default_path . $this->plugins[ $slug ]['source']; |
|
1596 | + return $this->default_path.$this->plugins[ $slug ][ 'source' ]; |
|
1597 | 1597 | } |
1598 | 1598 | |
1599 | 1599 | return $dl_source; // Should never happen. |
@@ -1631,7 +1631,7 @@ discard block |
||
1631 | 1631 | |
1632 | 1632 | if ( ! isset( $api[ $slug ] ) ) { |
1633 | 1633 | if ( ! function_exists( 'plugins_api' ) ) { |
1634 | - require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
|
1634 | + require_once ABSPATH.'wp-admin/includes/plugin-install.php'; |
|
1635 | 1635 | } |
1636 | 1636 | |
1637 | 1637 | $response = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ) ) ); |
@@ -1639,7 +1639,7 @@ discard block |
||
1639 | 1639 | $api[ $slug ] = false; |
1640 | 1640 | |
1641 | 1641 | if ( is_wp_error( $response ) ) { |
1642 | - wp_die( esc_html( $this->strings['oops'] ) ); |
|
1642 | + wp_die( esc_html( $this->strings[ 'oops' ] ) ); |
|
1643 | 1643 | } else { |
1644 | 1644 | $api[ $slug ] = $response; |
1645 | 1645 | } |
@@ -1658,13 +1658,13 @@ discard block |
||
1658 | 1658 | * or the plugin name if not. |
1659 | 1659 | */ |
1660 | 1660 | public function get_info_link( $slug ) { |
1661 | - if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) { |
|
1661 | + if ( ! empty( $this->plugins[ $slug ][ 'external_url' ] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ][ 'external_url' ] ) ) { |
|
1662 | 1662 | $link = sprintf( |
1663 | 1663 | '<a href="%1$s" target="_blank">%2$s</a>', |
1664 | - esc_url( $this->plugins[ $slug ]['external_url'] ), |
|
1665 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
1664 | + esc_url( $this->plugins[ $slug ][ 'external_url' ] ), |
|
1665 | + esc_html( $this->plugins[ $slug ][ 'name' ] ) |
|
1666 | 1666 | ); |
1667 | - } elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) { |
|
1667 | + } elseif ( 'repo' === $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1668 | 1668 | $url = add_query_arg( |
1669 | 1669 | array( |
1670 | 1670 | 'tab' => 'plugin-information', |
@@ -1679,10 +1679,10 @@ discard block |
||
1679 | 1679 | $link = sprintf( |
1680 | 1680 | '<a href="%1$s" class="thickbox">%2$s</a>', |
1681 | 1681 | esc_url( $url ), |
1682 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
1682 | + esc_html( $this->plugins[ $slug ][ 'name' ] ) |
|
1683 | 1683 | ); |
1684 | 1684 | } else { |
1685 | - $link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink. |
|
1685 | + $link = esc_html( $this->plugins[ $slug ][ 'name' ] ); // No hyperlink. |
|
1686 | 1686 | } |
1687 | 1687 | |
1688 | 1688 | return $link; |
@@ -1696,7 +1696,7 @@ discard block |
||
1696 | 1696 | * @return boolean True when on the TGMPA page, false otherwise. |
1697 | 1697 | */ |
1698 | 1698 | protected function is_tgmpa_page() { |
1699 | - return isset( $_GET['page'] ) && $this->menu === $_GET['page']; |
|
1699 | + return isset( $_GET[ 'page' ] ) && $this->menu === $_GET[ 'page' ]; |
|
1700 | 1700 | } |
1701 | 1701 | |
1702 | 1702 | /** |
@@ -1717,10 +1717,10 @@ discard block |
||
1717 | 1717 | if ( 'update-core' === $screen->base ) { |
1718 | 1718 | // Core update screen. |
1719 | 1719 | return true; |
1720 | - } elseif ( 'plugins' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok. |
|
1720 | + } elseif ( 'plugins' === $screen->base && ! empty( $_POST[ 'action' ] ) ) { // WPCS: CSRF ok. |
|
1721 | 1721 | // Plugins bulk update screen. |
1722 | 1722 | return true; |
1723 | - } elseif ( 'update' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok. |
|
1723 | + } elseif ( 'update' === $screen->base && ! empty( $_POST[ 'action' ] ) ) { // WPCS: CSRF ok. |
|
1724 | 1724 | // Individual updates (ajax call). |
1725 | 1725 | return true; |
1726 | 1726 | } |
@@ -1807,7 +1807,7 @@ discard block |
||
1807 | 1807 | public function is_plugin_installed( $slug ) { |
1808 | 1808 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
1809 | 1809 | |
1810 | - return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) ); |
|
1810 | + return ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ] ) ); |
|
1811 | 1811 | } |
1812 | 1812 | |
1813 | 1813 | /** |
@@ -1819,7 +1819,7 @@ discard block |
||
1819 | 1819 | * @return bool True if active, false otherwise. |
1820 | 1820 | */ |
1821 | 1821 | public function is_plugin_active( $slug ) { |
1822 | - return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) ); |
|
1822 | + return ( ( ! empty( $this->plugins[ $slug ][ 'is_callable' ] ) && is_callable( $this->plugins[ $slug ][ 'is_callable' ] ) ) || is_plugin_active( $this->plugins[ $slug ][ 'file_path' ] ) ); |
|
1823 | 1823 | } |
1824 | 1824 | |
1825 | 1825 | /** |
@@ -1833,7 +1833,7 @@ discard block |
||
1833 | 1833 | */ |
1834 | 1834 | public function can_plugin_update( $slug ) { |
1835 | 1835 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
1836 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1836 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1837 | 1837 | return true; |
1838 | 1838 | } |
1839 | 1839 | |
@@ -1889,8 +1889,8 @@ discard block |
||
1889 | 1889 | public function get_installed_version( $slug ) { |
1890 | 1890 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
1891 | 1891 | |
1892 | - if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) { |
|
1893 | - return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version']; |
|
1892 | + if ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ] ) ) { |
|
1893 | + return $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ]; |
|
1894 | 1894 | } |
1895 | 1895 | |
1896 | 1896 | return ''; |
@@ -1906,7 +1906,7 @@ discard block |
||
1906 | 1906 | */ |
1907 | 1907 | public function does_plugin_require_update( $slug ) { |
1908 | 1908 | $installed_version = $this->get_installed_version( $slug ); |
1909 | - $minimum_version = $this->plugins[ $slug ]['version']; |
|
1909 | + $minimum_version = $this->plugins[ $slug ][ 'version' ]; |
|
1910 | 1910 | |
1911 | 1911 | return version_compare( $minimum_version, $installed_version, '>' ); |
1912 | 1912 | } |
@@ -1921,9 +1921,9 @@ discard block |
||
1921 | 1921 | */ |
1922 | 1922 | public function does_plugin_have_update( $slug ) { |
1923 | 1923 | // Presume bundled and external plugins will point to a package which meets the minimum required version. |
1924 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1924 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1925 | 1925 | if ( $this->does_plugin_require_update( $slug ) ) { |
1926 | - return $this->plugins[ $slug ]['version']; |
|
1926 | + return $this->plugins[ $slug ][ 'version' ]; |
|
1927 | 1927 | } |
1928 | 1928 | |
1929 | 1929 | return false; |
@@ -1931,8 +1931,8 @@ discard block |
||
1931 | 1931 | |
1932 | 1932 | $repo_updates = get_site_transient( 'update_plugins' ); |
1933 | 1933 | |
1934 | - if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) { |
|
1935 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version; |
|
1934 | + if ( isset( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version ) ) { |
|
1935 | + return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version; |
|
1936 | 1936 | } |
1937 | 1937 | |
1938 | 1938 | return false; |
@@ -1948,14 +1948,14 @@ discard block |
||
1948 | 1948 | */ |
1949 | 1949 | public function get_upgrade_notice( $slug ) { |
1950 | 1950 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
1951 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1951 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1952 | 1952 | return ''; |
1953 | 1953 | } |
1954 | 1954 | |
1955 | 1955 | $repo_updates = get_site_transient( 'update_plugins' ); |
1956 | 1956 | |
1957 | - if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) { |
|
1958 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice; |
|
1957 | + if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice ) ) { |
|
1958 | + return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice; |
|
1959 | 1959 | } |
1960 | 1960 | |
1961 | 1961 | return ''; |
@@ -1971,7 +1971,7 @@ discard block |
||
1971 | 1971 | */ |
1972 | 1972 | public function get_plugins( $plugin_folder = '' ) { |
1973 | 1973 | if ( ! function_exists( 'get_plugins' ) ) { |
1974 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
1974 | + require_once ABSPATH.'wp-admin/includes/plugin.php'; |
|
1975 | 1975 | } |
1976 | 1976 | |
1977 | 1977 | return get_plugins( $plugin_folder ); |
@@ -1986,7 +1986,7 @@ discard block |
||
1986 | 1986 | * @since 2.1.1 |
1987 | 1987 | */ |
1988 | 1988 | public function update_dismiss() { |
1989 | - delete_metadata( 'user', null, 'tgmpa_dismissed_notice_' . $this->id, null, true ); |
|
1989 | + delete_metadata( 'user', null, 'tgmpa_dismissed_notice_'.$this->id, null, true ); |
|
1990 | 1990 | } |
1991 | 1991 | |
1992 | 1992 | /** |
@@ -2005,13 +2005,13 @@ discard block |
||
2005 | 2005 | */ |
2006 | 2006 | public function force_activation() { |
2007 | 2007 | foreach ( $this->plugins as $slug => $plugin ) { |
2008 | - if ( true === $plugin['force_activation'] ) { |
|
2008 | + if ( true === $plugin[ 'force_activation' ] ) { |
|
2009 | 2009 | if ( ! $this->is_plugin_installed( $slug ) ) { |
2010 | 2010 | // Oops, plugin isn't there so iterate to next condition. |
2011 | 2011 | continue; |
2012 | 2012 | } elseif ( $this->can_plugin_activate( $slug ) ) { |
2013 | 2013 | // There we go, activate the plugin. |
2014 | - activate_plugin( $plugin['file_path'] ); |
|
2014 | + activate_plugin( $plugin[ 'file_path' ] ); |
|
2015 | 2015 | } |
2016 | 2016 | } |
2017 | 2017 | } |
@@ -2032,8 +2032,8 @@ discard block |
||
2032 | 2032 | public function force_deactivation() { |
2033 | 2033 | foreach ( $this->plugins as $slug => $plugin ) { |
2034 | 2034 | // Only proceed forward if the parameter is set to true and plugin is active. |
2035 | - if ( true === $plugin['force_deactivation'] && $this->is_plugin_active( $slug ) ) { |
|
2036 | - deactivate_plugins( $plugin['file_path'] ); |
|
2035 | + if ( true === $plugin[ 'force_deactivation' ] && $this->is_plugin_active( $slug ) ) { |
|
2036 | + deactivate_plugins( $plugin[ 'file_path' ] ); |
|
2037 | 2037 | } |
2038 | 2038 | } |
2039 | 2039 | } |
@@ -2068,7 +2068,7 @@ discard block |
||
2068 | 2068 | * Ensure only one instance of the class is ever invoked. |
2069 | 2069 | */ |
2070 | 2070 | function load_tgm_plugin_activation() { |
2071 | - $GLOBALS['tgmpa'] = TGM_Plugin_Activation::get_instance(); |
|
2071 | + $GLOBALS[ 'tgmpa' ] = TGM_Plugin_Activation::get_instance(); |
|
2072 | 2072 | } |
2073 | 2073 | } |
2074 | 2074 | |
@@ -2090,7 +2090,7 @@ discard block |
||
2090 | 2090 | * @param array $config Optional. An array of configuration values. |
2091 | 2091 | */ |
2092 | 2092 | function tgmpa( $plugins, $config = array() ) { |
2093 | - $instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
2093 | + $instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
2094 | 2094 | |
2095 | 2095 | foreach ( $plugins as $plugin ) { |
2096 | 2096 | call_user_func( array( $instance, 'register' ), $plugin ); |
@@ -2098,17 +2098,17 @@ discard block |
||
2098 | 2098 | |
2099 | 2099 | if ( ! empty( $config ) && is_array( $config ) ) { |
2100 | 2100 | // Send out notices for deprecated arguments passed. |
2101 | - if ( isset( $config['notices'] ) ) { |
|
2101 | + if ( isset( $config[ 'notices' ] ) ) { |
|
2102 | 2102 | _deprecated_argument( __FUNCTION__, '2.2.0', 'The `notices` config parameter was renamed to `has_notices` in TGMPA 2.2.0. Please adjust your configuration.' ); |
2103 | - if ( ! isset( $config['has_notices'] ) ) { |
|
2104 | - $config['has_notices'] = $config['notices']; |
|
2103 | + if ( ! isset( $config[ 'has_notices' ] ) ) { |
|
2104 | + $config[ 'has_notices' ] = $config[ 'notices' ]; |
|
2105 | 2105 | } |
2106 | 2106 | } |
2107 | 2107 | |
2108 | - if ( isset( $config['parent_menu_slug'] ) ) { |
|
2108 | + if ( isset( $config[ 'parent_menu_slug' ] ) ) { |
|
2109 | 2109 | _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.' ); |
2110 | 2110 | } |
2111 | - if ( isset( $config['parent_url_slug'] ) ) { |
|
2111 | + if ( isset( $config[ 'parent_url_slug' ] ) ) { |
|
2112 | 2112 | _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.' ); |
2113 | 2113 | } |
2114 | 2114 | |
@@ -2124,7 +2124,7 @@ discard block |
||
2124 | 2124 | * @since 2.2.0 |
2125 | 2125 | */ |
2126 | 2126 | if ( ! class_exists( 'WP_List_Table' ) ) { |
2127 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
2127 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
2128 | 2128 | } |
2129 | 2129 | |
2130 | 2130 | if ( ! class_exists( 'TGMPA_List_Table' ) ) { |
@@ -2185,7 +2185,7 @@ discard block |
||
2185 | 2185 | * @since 2.2.0 |
2186 | 2186 | */ |
2187 | 2187 | public function __construct() { |
2188 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
2188 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
2189 | 2189 | |
2190 | 2190 | parent::__construct( |
2191 | 2191 | array( |
@@ -2195,8 +2195,8 @@ discard block |
||
2195 | 2195 | ) |
2196 | 2196 | ); |
2197 | 2197 | |
2198 | - if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'install', 'update', 'activate' ), true ) ) { |
|
2199 | - $this->view_context = sanitize_key( $_REQUEST['plugin_status'] ); |
|
2198 | + if ( isset( $_REQUEST[ 'plugin_status' ] ) && in_array( $_REQUEST[ 'plugin_status' ], array( 'install', 'update', 'activate' ), true ) ) { |
|
2199 | + $this->view_context = sanitize_key( $_REQUEST[ 'plugin_status' ] ); |
|
2200 | 2200 | } |
2201 | 2201 | |
2202 | 2202 | add_filter( 'tgmpa_table_data_items', array( $this, 'sort_table_items' ) ); |
@@ -2243,20 +2243,20 @@ discard block |
||
2243 | 2243 | } |
2244 | 2244 | |
2245 | 2245 | foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) { |
2246 | - $table_data[ $i ]['sanitized_plugin'] = $plugin['name']; |
|
2247 | - $table_data[ $i ]['slug'] = $slug; |
|
2248 | - $table_data[ $i ]['plugin'] = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>'; |
|
2249 | - $table_data[ $i ]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] ); |
|
2250 | - $table_data[ $i ]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] ); |
|
2251 | - $table_data[ $i ]['status'] = $this->get_plugin_status_text( $slug ); |
|
2252 | - $table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug ); |
|
2253 | - $table_data[ $i ]['minimum_version'] = $plugin['version']; |
|
2254 | - $table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2246 | + $table_data[ $i ][ 'sanitized_plugin' ] = $plugin[ 'name' ]; |
|
2247 | + $table_data[ $i ][ 'slug' ] = $slug; |
|
2248 | + $table_data[ $i ][ 'plugin' ] = '<strong>'.$this->tgmpa->get_info_link( $slug ).'</strong>'; |
|
2249 | + $table_data[ $i ][ 'source' ] = $this->get_plugin_source_type_text( $plugin[ 'source_type' ] ); |
|
2250 | + $table_data[ $i ][ 'type' ] = $this->get_plugin_advise_type_text( $plugin[ 'required' ] ); |
|
2251 | + $table_data[ $i ][ 'status' ] = $this->get_plugin_status_text( $slug ); |
|
2252 | + $table_data[ $i ][ 'installed_version' ] = $this->tgmpa->get_installed_version( $slug ); |
|
2253 | + $table_data[ $i ][ 'minimum_version' ] = $plugin[ 'version' ]; |
|
2254 | + $table_data[ $i ][ 'available_version' ] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2255 | 2255 | |
2256 | 2256 | // Prep the upgrade notice info. |
2257 | 2257 | $upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug ); |
2258 | 2258 | if ( ! empty( $upgrade_notice ) ) { |
2259 | - $table_data[ $i ]['upgrade_notice'] = $upgrade_notice; |
|
2259 | + $table_data[ $i ][ 'upgrade_notice' ] = $upgrade_notice; |
|
2260 | 2260 | |
2261 | 2261 | add_action( "tgmpa_after_plugin_row_$slug", array( $this, 'wp_plugin_update_row' ), 10, 2 ); |
2262 | 2262 | } |
@@ -2287,17 +2287,17 @@ discard block |
||
2287 | 2287 | // No need to display plugins if they are installed, up-to-date and active. |
2288 | 2288 | continue; |
2289 | 2289 | } else { |
2290 | - $plugins['all'][ $slug ] = $plugin; |
|
2290 | + $plugins[ 'all' ][ $slug ] = $plugin; |
|
2291 | 2291 | |
2292 | 2292 | if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) { |
2293 | - $plugins['install'][ $slug ] = $plugin; |
|
2293 | + $plugins[ 'install' ][ $slug ] = $plugin; |
|
2294 | 2294 | } else { |
2295 | 2295 | if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) { |
2296 | - $plugins['update'][ $slug ] = $plugin; |
|
2296 | + $plugins[ 'update' ][ $slug ] = $plugin; |
|
2297 | 2297 | } |
2298 | 2298 | |
2299 | 2299 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
2300 | - $plugins['activate'][ $slug ] = $plugin; |
|
2300 | + $plugins[ 'activate' ][ $slug ] = $plugin; |
|
2301 | 2301 | } |
2302 | 2302 | } |
2303 | 2303 | } |
@@ -2416,8 +2416,8 @@ discard block |
||
2416 | 2416 | $name = array(); |
2417 | 2417 | |
2418 | 2418 | foreach ( $items as $i => $plugin ) { |
2419 | - $type[ $i ] = $plugin['type']; // Required / recommended. |
|
2420 | - $name[ $i ] = $plugin['sanitized_plugin']; |
|
2419 | + $type[ $i ] = $plugin[ 'type' ]; // Required / recommended. |
|
2420 | + $name[ $i ] = $plugin[ 'sanitized_plugin' ]; |
|
2421 | 2421 | } |
2422 | 2422 | |
2423 | 2423 | array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items ); |
@@ -2499,9 +2499,9 @@ discard block |
||
2499 | 2499 | public function column_cb( $item ) { |
2500 | 2500 | return sprintf( |
2501 | 2501 | '<input type="checkbox" name="%1$s[]" value="%2$s" id="%3$s" />', |
2502 | - esc_attr( $this->_args['singular'] ), |
|
2503 | - esc_attr( $item['slug'] ), |
|
2504 | - esc_attr( $item['sanitized_plugin'] ) |
|
2502 | + esc_attr( $this->_args[ 'singular' ] ), |
|
2503 | + esc_attr( $item[ 'slug' ] ), |
|
2504 | + esc_attr( $item[ 'sanitized_plugin' ] ) |
|
2505 | 2505 | ); |
2506 | 2506 | } |
2507 | 2507 | |
@@ -2516,7 +2516,7 @@ discard block |
||
2516 | 2516 | public function column_plugin( $item ) { |
2517 | 2517 | return sprintf( |
2518 | 2518 | '%1$s %2$s', |
2519 | - $item['plugin'], |
|
2519 | + $item[ 'plugin' ], |
|
2520 | 2520 | $this->row_actions( $this->get_row_actions( $item ), true ) |
2521 | 2521 | ); |
2522 | 2522 | } |
@@ -2532,38 +2532,38 @@ discard block |
||
2532 | 2532 | public function column_version( $item ) { |
2533 | 2533 | $output = array(); |
2534 | 2534 | |
2535 | - if ( $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
2536 | - $installed = ! empty( $item['installed_version'] ) ? $item['installed_version'] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
2535 | + if ( $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
2536 | + $installed = ! empty( $item[ 'installed_version' ] ) ? $item[ 'installed_version' ] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
2537 | 2537 | |
2538 | 2538 | $color = ''; |
2539 | - if ( ! empty( $item['minimum_version'] ) && $this->tgmpa->does_plugin_require_update( $item['slug'] ) ) { |
|
2539 | + if ( ! empty( $item[ 'minimum_version' ] ) && $this->tgmpa->does_plugin_require_update( $item[ 'slug' ] ) ) { |
|
2540 | 2540 | $color = ' color: #ff0000; font-weight: bold;'; |
2541 | 2541 | } |
2542 | 2542 | |
2543 | - $output[] = sprintf( |
|
2544 | - '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Installed version:', 'tgmpa' ) . '</p>', |
|
2543 | + $output[ ] = sprintf( |
|
2544 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Installed version:', 'tgmpa' ).'</p>', |
|
2545 | 2545 | $color, |
2546 | 2546 | $installed |
2547 | 2547 | ); |
2548 | 2548 | } |
2549 | 2549 | |
2550 | - if ( ! empty( $item['minimum_version'] ) ) { |
|
2551 | - $output[] = sprintf( |
|
2552 | - '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>' . __( 'Minimum required version:', 'tgmpa' ) . '</p>', |
|
2553 | - $item['minimum_version'] |
|
2550 | + if ( ! empty( $item[ 'minimum_version' ] ) ) { |
|
2551 | + $output[ ] = sprintf( |
|
2552 | + '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>'.__( 'Minimum required version:', 'tgmpa' ).'</p>', |
|
2553 | + $item[ 'minimum_version' ] |
|
2554 | 2554 | ); |
2555 | 2555 | } |
2556 | 2556 | |
2557 | - if ( ! empty( $item['available_version'] ) ) { |
|
2557 | + if ( ! empty( $item[ 'available_version' ] ) ) { |
|
2558 | 2558 | $color = ''; |
2559 | - if ( ! empty( $item['minimum_version'] ) && version_compare( $item['available_version'], $item['minimum_version'], '>=' ) ) { |
|
2559 | + if ( ! empty( $item[ 'minimum_version' ] ) && version_compare( $item[ 'available_version' ], $item[ 'minimum_version' ], '>=' ) ) { |
|
2560 | 2560 | $color = ' color: #71C671; font-weight: bold;'; |
2561 | 2561 | } |
2562 | 2562 | |
2563 | - $output[] = sprintf( |
|
2564 | - '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Available version:', 'tgmpa' ) . '</p>', |
|
2563 | + $output[ ] = sprintf( |
|
2564 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Available version:', 'tgmpa' ).'</p>', |
|
2565 | 2565 | $color, |
2566 | - $item['available_version'] |
|
2566 | + $item[ 'available_version' ] |
|
2567 | 2567 | ); |
2568 | 2568 | } |
2569 | 2569 | |
@@ -2604,8 +2604,8 @@ discard block |
||
2604 | 2604 | ); |
2605 | 2605 | |
2606 | 2606 | if ( 'all' === $this->view_context || 'update' === $this->view_context ) { |
2607 | - $columns['version'] = __( 'Version', 'tgmpa' ); |
|
2608 | - $columns['status'] = __( 'Status', 'tgmpa' ); |
|
2607 | + $columns[ 'version' ] = __( 'Version', 'tgmpa' ); |
|
2608 | + $columns[ 'status' ] = __( 'Status', 'tgmpa' ); |
|
2609 | 2609 | } |
2610 | 2610 | |
2611 | 2611 | return apply_filters( 'tgmpa_table_columns', $columns ); |
@@ -2652,17 +2652,17 @@ discard block |
||
2652 | 2652 | $action_links = array(); |
2653 | 2653 | |
2654 | 2654 | // Display the 'Install' action link if the plugin is not yet available. |
2655 | - if ( ! $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
2656 | - $actions['install'] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2655 | + if ( ! $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
2656 | + $actions[ 'install' ] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2657 | 2657 | } else { |
2658 | 2658 | // Display the 'Update' action link if an update is available and WP complies with plugin minimum. |
2659 | - if ( false !== $this->tgmpa->does_plugin_have_update( $item['slug'] ) && $this->tgmpa->can_plugin_update( $item['slug'] ) ) { |
|
2660 | - $actions['update'] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2659 | + if ( false !== $this->tgmpa->does_plugin_have_update( $item[ 'slug' ] ) && $this->tgmpa->can_plugin_update( $item[ 'slug' ] ) ) { |
|
2660 | + $actions[ 'update' ] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2661 | 2661 | } |
2662 | 2662 | |
2663 | 2663 | // Display the 'Activate' action link, but only if the plugin meets the minimum version. |
2664 | - if ( $this->tgmpa->can_plugin_activate( $item['slug'] ) ) { |
|
2665 | - $actions['activate'] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2664 | + if ( $this->tgmpa->can_plugin_activate( $item[ 'slug' ] ) ) { |
|
2665 | + $actions[ 'activate' ] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2666 | 2666 | } |
2667 | 2667 | } |
2668 | 2668 | |
@@ -2671,24 +2671,24 @@ discard block |
||
2671 | 2671 | $nonce_url = wp_nonce_url( |
2672 | 2672 | add_query_arg( |
2673 | 2673 | array( |
2674 | - 'plugin' => urlencode( $item['slug'] ), |
|
2675 | - 'tgmpa-' . $action => $action . '-plugin', |
|
2674 | + 'plugin' => urlencode( $item[ 'slug' ] ), |
|
2675 | + 'tgmpa-'.$action => $action.'-plugin', |
|
2676 | 2676 | ), |
2677 | 2677 | $this->tgmpa->get_tgmpa_url() |
2678 | 2678 | ), |
2679 | - 'tgmpa-' . $action, |
|
2679 | + 'tgmpa-'.$action, |
|
2680 | 2680 | 'tgmpa-nonce' |
2681 | 2681 | ); |
2682 | 2682 | |
2683 | 2683 | $action_links[ $action ] = sprintf( |
2684 | - '<a href="%1$s">' . esc_html( $text ) . '</a>', |
|
2684 | + '<a href="%1$s">'.esc_html( $text ).'</a>', |
|
2685 | 2685 | esc_url( $nonce_url ), |
2686 | - '<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>' |
|
2686 | + '<span class="screen-reader-text">'.esc_html( $item[ 'sanitized_plugin' ] ).'</span>' |
|
2687 | 2687 | ); |
2688 | 2688 | } |
2689 | 2689 | |
2690 | 2690 | $prefix = ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) ? 'network_admin_' : ''; |
2691 | - return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item['slug'], $item, $this->view_context ); |
|
2691 | + return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item[ 'slug' ], $item, $this->view_context ); |
|
2692 | 2692 | } |
2693 | 2693 | |
2694 | 2694 | /** |
@@ -2709,7 +2709,7 @@ discard block |
||
2709 | 2709 | * |
2710 | 2710 | * @since 2.5.0 |
2711 | 2711 | */ |
2712 | - do_action( "tgmpa_after_plugin_row_{$item['slug']}", $item['slug'], $item, $this->view_context ); |
|
2712 | + do_action( "tgmpa_after_plugin_row_{$item[ 'slug' ]}", $item[ 'slug' ], $item, $this->view_context ); |
|
2713 | 2713 | } |
2714 | 2714 | |
2715 | 2715 | /** |
@@ -2724,7 +2724,7 @@ discard block |
||
2724 | 2724 | * @return null Return early if upgrade notice is empty. |
2725 | 2725 | */ |
2726 | 2726 | public function wp_plugin_update_row( $slug, $item ) { |
2727 | - if ( empty( $item['upgrade_notice'] ) ) { |
|
2727 | + if ( empty( $item[ 'upgrade_notice' ] ) ) { |
|
2728 | 2728 | return; |
2729 | 2729 | } |
2730 | 2730 | |
@@ -2733,7 +2733,7 @@ discard block |
||
2733 | 2733 | <td colspan="', absint( $this->get_column_count() ), '" class="plugin-update colspanchange"> |
2734 | 2734 | <div class="update-message">', |
2735 | 2735 | esc_html__( 'Upgrade message from the plugin author:', 'tgmpa' ), |
2736 | - ' <strong>', wp_kses_data( $item['upgrade_notice'] ), '</strong> |
|
2736 | + ' <strong>', wp_kses_data( $item[ 'upgrade_notice' ] ), '</strong> |
|
2737 | 2737 | </div> |
2738 | 2738 | </td> |
2739 | 2739 | </tr>'; |
@@ -2765,16 +2765,16 @@ discard block |
||
2765 | 2765 | |
2766 | 2766 | if ( 'update' !== $this->view_context && 'activate' !== $this->view_context ) { |
2767 | 2767 | if ( current_user_can( 'install_plugins' ) ) { |
2768 | - $actions['tgmpa-bulk-install'] = __( 'Install', 'tgmpa' ); |
|
2768 | + $actions[ 'tgmpa-bulk-install' ] = __( 'Install', 'tgmpa' ); |
|
2769 | 2769 | } |
2770 | 2770 | } |
2771 | 2771 | |
2772 | 2772 | if ( 'install' !== $this->view_context ) { |
2773 | 2773 | if ( current_user_can( 'update_plugins' ) ) { |
2774 | - $actions['tgmpa-bulk-update'] = __( 'Update', 'tgmpa' ); |
|
2774 | + $actions[ 'tgmpa-bulk-update' ] = __( 'Update', 'tgmpa' ); |
|
2775 | 2775 | } |
2776 | 2776 | if ( current_user_can( 'activate_plugins' ) ) { |
2777 | - $actions['tgmpa-bulk-activate'] = __( 'Activate', 'tgmpa' ); |
|
2777 | + $actions[ 'tgmpa-bulk-activate' ] = __( 'Activate', 'tgmpa' ); |
|
2778 | 2778 | } |
2779 | 2779 | } |
2780 | 2780 | |
@@ -2793,7 +2793,7 @@ discard block |
||
2793 | 2793 | // Bulk installation process. |
2794 | 2794 | if ( 'tgmpa-bulk-install' === $this->current_action() || 'tgmpa-bulk-update' === $this->current_action() ) { |
2795 | 2795 | |
2796 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
2796 | + check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2797 | 2797 | |
2798 | 2798 | $install_type = 'install'; |
2799 | 2799 | if ( 'tgmpa-bulk-update' === $this->current_action() ) { |
@@ -2803,7 +2803,7 @@ discard block |
||
2803 | 2803 | $plugins_to_install = array(); |
2804 | 2804 | |
2805 | 2805 | // Did user actually select any plugins to install/update ? |
2806 | - if ( empty( $_POST['plugin'] ) ) { |
|
2806 | + if ( empty( $_POST[ 'plugin' ] ) ) { |
|
2807 | 2807 | if ( 'install' === $install_type ) { |
2808 | 2808 | $message = __( 'No plugins were selected to be installed. No action taken.', 'tgmpa' ); |
2809 | 2809 | } else { |
@@ -2815,11 +2815,11 @@ discard block |
||
2815 | 2815 | return false; |
2816 | 2816 | } |
2817 | 2817 | |
2818 | - if ( is_array( $_POST['plugin'] ) ) { |
|
2819 | - $plugins_to_install = (array) $_POST['plugin']; |
|
2820 | - } elseif ( is_string( $_POST['plugin'] ) ) { |
|
2818 | + if ( is_array( $_POST[ 'plugin' ] ) ) { |
|
2819 | + $plugins_to_install = (array) $_POST[ 'plugin' ]; |
|
2820 | + } elseif ( is_string( $_POST[ 'plugin' ] ) ) { |
|
2821 | 2821 | // Received via Filesystem page - un-flatten array (WP bug #19643). |
2822 | - $plugins_to_install = explode( ',', $_POST['plugin'] ); |
|
2822 | + $plugins_to_install = explode( ',', $_POST[ 'plugin' ] ); |
|
2823 | 2823 | } |
2824 | 2824 | |
2825 | 2825 | // Sanitize the received input. |
@@ -2861,11 +2861,11 @@ discard block |
||
2861 | 2861 | // Pass all necessary information if WP_Filesystem is needed. |
2862 | 2862 | $url = wp_nonce_url( |
2863 | 2863 | $this->tgmpa->get_tgmpa_url(), |
2864 | - 'bulk-' . $this->_args['plural'] |
|
2864 | + 'bulk-'.$this->_args[ 'plural' ] |
|
2865 | 2865 | ); |
2866 | 2866 | |
2867 | 2867 | // Give validated data back to $_POST which is the only place the filesystem looks for extra fields. |
2868 | - $_POST['plugin'] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
2868 | + $_POST[ 'plugin' ] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
2869 | 2869 | |
2870 | 2870 | $method = ''; // Leave blank so WP_Filesystem can populate it as necessary. |
2871 | 2871 | $fields = array_keys( $_POST ); // Extra fields to pass to WP_Filesystem. |
@@ -2892,22 +2892,22 @@ discard block |
||
2892 | 2892 | |
2893 | 2893 | // Prepare the data for validated plugins for the install/upgrade. |
2894 | 2894 | foreach ( $plugins_to_install as $slug ) { |
2895 | - $name = $this->tgmpa->plugins[ $slug ]['name']; |
|
2895 | + $name = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
2896 | 2896 | $source = $this->tgmpa->get_download_url( $slug ); |
2897 | 2897 | |
2898 | 2898 | if ( ! empty( $name ) && ! empty( $source ) ) { |
2899 | - $names[] = $name; |
|
2899 | + $names[ ] = $name; |
|
2900 | 2900 | |
2901 | 2901 | switch ( $install_type ) { |
2902 | 2902 | |
2903 | 2903 | case 'install': |
2904 | - $sources[] = $source; |
|
2904 | + $sources[ ] = $source; |
|
2905 | 2905 | break; |
2906 | 2906 | |
2907 | 2907 | case 'update': |
2908 | - $file_paths[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
2908 | + $file_paths[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
2909 | 2909 | $to_inject[ $slug ] = $this->tgmpa->plugins[ $slug ]; |
2910 | - $to_inject[ $slug ]['source'] = $source; |
|
2910 | + $to_inject[ $slug ][ 'source' ] = $source; |
|
2911 | 2911 | break; |
2912 | 2912 | } |
2913 | 2913 | } |
@@ -2919,7 +2919,7 @@ discard block |
||
2919 | 2919 | new TGMPA_Bulk_Installer_Skin( |
2920 | 2920 | array( |
2921 | 2921 | 'url' => esc_url_raw( $this->tgmpa->get_tgmpa_url() ), |
2922 | - 'nonce' => 'bulk-' . $this->_args['plural'], |
|
2922 | + 'nonce' => 'bulk-'.$this->_args[ 'plural' ], |
|
2923 | 2923 | 'names' => $names, |
2924 | 2924 | 'install_type' => $install_type, |
2925 | 2925 | ) |
@@ -2952,10 +2952,10 @@ discard block |
||
2952 | 2952 | |
2953 | 2953 | // Bulk activation process. |
2954 | 2954 | if ( 'tgmpa-bulk-activate' === $this->current_action() ) { |
2955 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
2955 | + check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2956 | 2956 | |
2957 | 2957 | // Did user actually select any plugins to activate ? |
2958 | - if ( empty( $_POST['plugin'] ) ) { |
|
2958 | + if ( empty( $_POST[ 'plugin' ] ) ) { |
|
2959 | 2959 | echo '<div id="message" class="error"><p>', esc_html__( 'No plugins were selected to be activated. No action taken.', 'tgmpa' ), '</p></div>'; |
2960 | 2960 | |
2961 | 2961 | return false; |
@@ -2963,8 +2963,8 @@ discard block |
||
2963 | 2963 | |
2964 | 2964 | // Grab plugin data from $_POST. |
2965 | 2965 | $plugins = array(); |
2966 | - if ( isset( $_POST['plugin'] ) ) { |
|
2967 | - $plugins = array_map( 'urldecode', (array) $_POST['plugin'] ); |
|
2966 | + if ( isset( $_POST[ 'plugin' ] ) ) { |
|
2967 | + $plugins = array_map( 'urldecode', (array) $_POST[ 'plugin' ] ); |
|
2968 | 2968 | $plugins = array_map( array( $this->tgmpa, 'sanitize_key' ), $plugins ); |
2969 | 2969 | } |
2970 | 2970 | |
@@ -2974,8 +2974,8 @@ discard block |
||
2974 | 2974 | // Grab the file paths for the selected & inactive plugins from the registration array. |
2975 | 2975 | foreach ( $plugins as $slug ) { |
2976 | 2976 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
2977 | - $plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
2978 | - $plugin_names[] = $this->tgmpa->plugins[ $slug ]['name']; |
|
2977 | + $plugins_to_activate[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
2978 | + $plugin_names[ ] = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
2979 | 2979 | } |
2980 | 2980 | } |
2981 | 2981 | unset( $slug ); |
@@ -2996,7 +2996,7 @@ discard block |
||
2996 | 2996 | $count = count( $plugin_names ); // Count so we can use _n function. |
2997 | 2997 | $plugin_names = array_map( array( 'TGMPA_Utils', 'wrap_in_strong' ), $plugin_names ); |
2998 | 2998 | $last_plugin = array_pop( $plugin_names ); // Pop off last name to prep for readability. |
2999 | - $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
2999 | + $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); |
|
3000 | 3000 | |
3001 | 3001 | printf( // WPCS: xss ok. |
3002 | 3002 | '<div id="message" class="updated"><p>%1$s %2$s.</p></div>', |
@@ -3099,16 +3099,16 @@ discard block |
||
3099 | 3099 | */ |
3100 | 3100 | function tgmpa_load_bulk_installer() { |
3101 | 3101 | // Silently fail if 2.5+ is loaded *after* an older version. |
3102 | - if ( ! isset( $GLOBALS['tgmpa'] ) ) { |
|
3102 | + if ( ! isset( $GLOBALS[ 'tgmpa' ] ) ) { |
|
3103 | 3103 | return; |
3104 | 3104 | } |
3105 | 3105 | |
3106 | 3106 | // Get TGMPA class instance. |
3107 | - $tgmpa_instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
3107 | + $tgmpa_instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3108 | 3108 | |
3109 | - if ( isset( $_GET['page'] ) && $tgmpa_instance->menu === $_GET['page'] ) { |
|
3109 | + if ( isset( $_GET[ 'page' ] ) && $tgmpa_instance->menu === $_GET[ 'page' ] ) { |
|
3110 | 3110 | if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
3111 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
3111 | + require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
3112 | 3112 | } |
3113 | 3113 | |
3114 | 3114 | if ( ! class_exists( 'TGMPA_Bulk_Installer' ) ) { |
@@ -3175,11 +3175,11 @@ discard block |
||
3175 | 3175 | */ |
3176 | 3176 | public function __construct( $skin = null ) { |
3177 | 3177 | // Get TGMPA class instance. |
3178 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
3178 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3179 | 3179 | |
3180 | 3180 | parent::__construct( $skin ); |
3181 | 3181 | |
3182 | - if ( isset( $this->skin->options['install_type'] ) && 'update' === $this->skin->options['install_type'] ) { |
|
3182 | + if ( isset( $this->skin->options[ 'install_type' ] ) && 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3183 | 3183 | $this->clear_destination = true; |
3184 | 3184 | } |
3185 | 3185 | |
@@ -3196,8 +3196,8 @@ discard block |
||
3196 | 3196 | * @since 2.2.0 |
3197 | 3197 | */ |
3198 | 3198 | public function activate_strings() { |
3199 | - $this->strings['activation_failed'] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
3200 | - $this->strings['activation_success'] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
3199 | + $this->strings[ 'activation_failed' ] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
3200 | + $this->strings[ 'activation_success' ] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
3201 | 3201 | } |
3202 | 3202 | |
3203 | 3203 | /** |
@@ -3215,7 +3215,7 @@ discard block |
||
3215 | 3215 | |
3216 | 3216 | // Reset the strings in case we changed one during automatic activation. |
3217 | 3217 | if ( $this->tgmpa->is_automatic ) { |
3218 | - if ( 'update' === $this->skin->options['install_type'] ) { |
|
3218 | + if ( 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3219 | 3219 | $this->upgrade_strings(); |
3220 | 3220 | } else { |
3221 | 3221 | $this->install_strings(); |
@@ -3373,7 +3373,7 @@ discard block |
||
3373 | 3373 | remove_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 ); |
3374 | 3374 | |
3375 | 3375 | // Force refresh of plugin update information. |
3376 | - wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); |
|
3376 | + wp_clean_plugins_cache( $parsed_args[ 'clear_update_cache' ] ); |
|
3377 | 3377 | |
3378 | 3378 | return $results; |
3379 | 3379 | } |
@@ -3424,13 +3424,13 @@ discard block |
||
3424 | 3424 | $activate = activate_plugin( $plugin_info ); |
3425 | 3425 | |
3426 | 3426 | // Adjust the success string based on the activation result. |
3427 | - $this->strings['process_success'] = $this->strings['process_success'] . "<br />\n"; |
|
3427 | + $this->strings[ 'process_success' ] = $this->strings[ 'process_success' ]."<br />\n"; |
|
3428 | 3428 | |
3429 | 3429 | if ( is_wp_error( $activate ) ) { |
3430 | 3430 | $this->skin->error( $activate ); |
3431 | - $this->strings['process_success'] .= $this->strings['activation_failed']; |
|
3431 | + $this->strings[ 'process_success' ] .= $this->strings[ 'activation_failed' ]; |
|
3432 | 3432 | } else { |
3433 | - $this->strings['process_success'] .= $this->strings['activation_success']; |
|
3433 | + $this->strings[ 'process_success' ] .= $this->strings[ 'activation_success' ]; |
|
3434 | 3434 | } |
3435 | 3435 | } |
3436 | 3436 | } |
@@ -3506,7 +3506,7 @@ discard block |
||
3506 | 3506 | */ |
3507 | 3507 | public function __construct( $args = array() ) { |
3508 | 3508 | // Get TGMPA class instance. |
3509 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
3509 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3510 | 3510 | |
3511 | 3511 | // Parse default and new args. |
3512 | 3512 | $defaults = array( |
@@ -3515,10 +3515,10 @@ discard block |
||
3515 | 3515 | 'names' => array(), |
3516 | 3516 | 'install_type' => 'install', |
3517 | 3517 | ); |
3518 | - $args = wp_parse_args( $args, $defaults ); |
|
3518 | + $args = wp_parse_args( $args, $defaults ); |
|
3519 | 3519 | |
3520 | 3520 | // Set plugin names to $this->plugin_names property. |
3521 | - $this->plugin_names = $args['names']; |
|
3521 | + $this->plugin_names = $args[ 'names' ]; |
|
3522 | 3522 | |
3523 | 3523 | // Extract the new args. |
3524 | 3524 | parent::__construct( $args ); |
@@ -3533,25 +3533,25 @@ discard block |
||
3533 | 3533 | * @since 2.2.0 |
3534 | 3534 | */ |
3535 | 3535 | public function add_strings() { |
3536 | - if ( 'update' === $this->options['install_type'] ) { |
|
3536 | + if ( 'update' === $this->options[ 'install_type' ] ) { |
|
3537 | 3537 | parent::add_strings(); |
3538 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3538 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3539 | 3539 | } else { |
3540 | - $this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
3541 | - $this->upgrader->strings['skin_update_failed'] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
3540 | + $this->upgrader->strings[ 'skin_update_failed_error' ] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
3541 | + $this->upgrader->strings[ 'skin_update_failed' ] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
3542 | 3542 | |
3543 | 3543 | if ( $this->tgmpa->is_automatic ) { |
3544 | 3544 | // Automatic activation strings. |
3545 | - $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' ); |
|
3546 | - $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>'; |
|
3547 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
3548 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3545 | + $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' ); |
|
3546 | + $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>'; |
|
3547 | + $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
3548 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3549 | 3549 | } else { |
3550 | 3550 | // Default installation strings. |
3551 | - $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' ); |
|
3552 | - $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>'; |
|
3553 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations have been completed.', 'tgmpa' ); |
|
3554 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3551 | + $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' ); |
|
3552 | + $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>'; |
|
3553 | + $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations have been completed.', 'tgmpa' ); |
|
3554 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3555 | 3555 | } |
3556 | 3556 | } |
3557 | 3557 | } |
@@ -3609,12 +3609,12 @@ discard block |
||
3609 | 3609 | if ( $this->tgmpa->is_tgmpa_complete() ) { |
3610 | 3610 | // All plugins are active, so we display the complete string and hide the menu to protect users. |
3611 | 3611 | echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
3612 | - $update_actions['dashboard'] = sprintf( |
|
3613 | - esc_html( $this->tgmpa->strings['complete'] ), |
|
3614 | - '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' |
|
3612 | + $update_actions[ 'dashboard' ] = sprintf( |
|
3613 | + esc_html( $this->tgmpa->strings[ 'complete' ] ), |
|
3614 | + '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' |
|
3615 | 3615 | ); |
3616 | 3616 | } else { |
3617 | - $update_actions['tgmpa_page'] = '<a href="' . esc_url( $this->tgmpa->get_tgmpa_url() ) . '" target="_parent">' . esc_html( $this->tgmpa->strings['return'] ) . '</a>'; |
|
3617 | + $update_actions[ 'tgmpa_page' ] = '<a href="'.esc_url( $this->tgmpa->get_tgmpa_url() ).'" target="_parent">'.esc_html( $this->tgmpa->strings[ 'return' ] ).'</a>'; |
|
3618 | 3618 | } |
3619 | 3619 | |
3620 | 3620 | /** |
@@ -3704,7 +3704,7 @@ discard block |
||
3704 | 3704 | * @return string |
3705 | 3705 | */ |
3706 | 3706 | public static function wrap_in_em( $string ) { |
3707 | - return '<em>' . wp_kses_post( $string ) . '</em>'; |
|
3707 | + return '<em>'.wp_kses_post( $string ).'</em>'; |
|
3708 | 3708 | } |
3709 | 3709 | |
3710 | 3710 | /** |
@@ -3718,7 +3718,7 @@ discard block |
||
3718 | 3718 | * @return string |
3719 | 3719 | */ |
3720 | 3720 | public static function wrap_in_strong( $string ) { |
3721 | - return '<strong>' . wp_kses_post( $string ) . '</strong>'; |
|
3721 | + return '<strong>'.wp_kses_post( $string ).'</strong>'; |
|
3722 | 3722 | } |
3723 | 3723 | |
3724 | 3724 | /** |
@@ -3755,7 +3755,7 @@ discard block |
||
3755 | 3755 | */ |
3756 | 3756 | protected static function emulate_filter_bool( $value ) { |
3757 | 3757 | // @codingStandardsIgnoreStart |
3758 | - static $true = array( |
|
3758 | + static $true = array( |
|
3759 | 3759 | '1', |
3760 | 3760 | 'true', 'True', 'TRUE', |
3761 | 3761 | 'y', 'Y', |