@@ -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 | } |
@@ -2074,7 +2074,7 @@ discard block |
||
2074 | 2074 | * Ensure only one instance of the class is ever invoked. |
2075 | 2075 | */ |
2076 | 2076 | function load_tgm_plugin_activation() { |
2077 | - $GLOBALS['tgmpa'] = TGM_Plugin_Activation::get_instance(); |
|
2077 | + $GLOBALS[ 'tgmpa' ] = TGM_Plugin_Activation::get_instance(); |
|
2078 | 2078 | } |
2079 | 2079 | } |
2080 | 2080 | |
@@ -2096,7 +2096,7 @@ discard block |
||
2096 | 2096 | * @param array $config Optional. An array of configuration values. |
2097 | 2097 | */ |
2098 | 2098 | function tgmpa( $plugins, $config = array() ) { |
2099 | - $instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
2099 | + $instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
2100 | 2100 | |
2101 | 2101 | foreach ( $plugins as $plugin ) { |
2102 | 2102 | call_user_func( array( $instance, 'register' ), $plugin ); |
@@ -2104,17 +2104,17 @@ discard block |
||
2104 | 2104 | |
2105 | 2105 | if ( ! empty( $config ) && is_array( $config ) ) { |
2106 | 2106 | // Send out notices for deprecated arguments passed. |
2107 | - if ( isset( $config['notices'] ) ) { |
|
2107 | + if ( isset( $config[ 'notices' ] ) ) { |
|
2108 | 2108 | _deprecated_argument( __FUNCTION__, '2.2.0', 'The `notices` config parameter was renamed to `has_notices` in TGMPA 2.2.0. Please adjust your configuration.' ); |
2109 | - if ( ! isset( $config['has_notices'] ) ) { |
|
2110 | - $config['has_notices'] = $config['notices']; |
|
2109 | + if ( ! isset( $config[ 'has_notices' ] ) ) { |
|
2110 | + $config[ 'has_notices' ] = $config[ 'notices' ]; |
|
2111 | 2111 | } |
2112 | 2112 | } |
2113 | 2113 | |
2114 | - if ( isset( $config['parent_menu_slug'] ) ) { |
|
2114 | + if ( isset( $config[ 'parent_menu_slug' ] ) ) { |
|
2115 | 2115 | _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.' ); |
2116 | 2116 | } |
2117 | - if ( isset( $config['parent_url_slug'] ) ) { |
|
2117 | + if ( isset( $config[ 'parent_url_slug' ] ) ) { |
|
2118 | 2118 | _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.' ); |
2119 | 2119 | } |
2120 | 2120 | |
@@ -2130,7 +2130,7 @@ discard block |
||
2130 | 2130 | * @since 2.2.0 |
2131 | 2131 | */ |
2132 | 2132 | if ( ! class_exists( 'WP_List_Table' ) ) { |
2133 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
2133 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
2134 | 2134 | } |
2135 | 2135 | |
2136 | 2136 | if ( ! class_exists( 'TGMPA_List_Table' ) ) { |
@@ -2191,7 +2191,7 @@ discard block |
||
2191 | 2191 | * @since 2.2.0 |
2192 | 2192 | */ |
2193 | 2193 | public function __construct() { |
2194 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
2194 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
2195 | 2195 | |
2196 | 2196 | parent::__construct( |
2197 | 2197 | array( |
@@ -2201,8 +2201,8 @@ discard block |
||
2201 | 2201 | ) |
2202 | 2202 | ); |
2203 | 2203 | |
2204 | - if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'install', 'update', 'activate' ), true ) ) { |
|
2205 | - $this->view_context = sanitize_key( $_REQUEST['plugin_status'] ); |
|
2204 | + if ( isset( $_REQUEST[ 'plugin_status' ] ) && in_array( $_REQUEST[ 'plugin_status' ], array( 'install', 'update', 'activate' ), true ) ) { |
|
2205 | + $this->view_context = sanitize_key( $_REQUEST[ 'plugin_status' ] ); |
|
2206 | 2206 | } |
2207 | 2207 | |
2208 | 2208 | add_filter( 'tgmpa_table_data_items', array( $this, 'sort_table_items' ) ); |
@@ -2249,20 +2249,20 @@ discard block |
||
2249 | 2249 | } |
2250 | 2250 | |
2251 | 2251 | foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) { |
2252 | - $table_data[ $i ]['sanitized_plugin'] = $plugin['name']; |
|
2253 | - $table_data[ $i ]['slug'] = $slug; |
|
2254 | - $table_data[ $i ]['plugin'] = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>'; |
|
2255 | - $table_data[ $i ]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] ); |
|
2256 | - $table_data[ $i ]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] ); |
|
2257 | - $table_data[ $i ]['status'] = $this->get_plugin_status_text( $slug ); |
|
2258 | - $table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug ); |
|
2259 | - $table_data[ $i ]['minimum_version'] = $plugin['version']; |
|
2260 | - $table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2252 | + $table_data[ $i ][ 'sanitized_plugin' ] = $plugin[ 'name' ]; |
|
2253 | + $table_data[ $i ][ 'slug' ] = $slug; |
|
2254 | + $table_data[ $i ][ 'plugin' ] = '<strong>'.$this->tgmpa->get_info_link( $slug ).'</strong>'; |
|
2255 | + $table_data[ $i ][ 'source' ] = $this->get_plugin_source_type_text( $plugin[ 'source_type' ] ); |
|
2256 | + $table_data[ $i ][ 'type' ] = $this->get_plugin_advise_type_text( $plugin[ 'required' ] ); |
|
2257 | + $table_data[ $i ][ 'status' ] = $this->get_plugin_status_text( $slug ); |
|
2258 | + $table_data[ $i ][ 'installed_version' ] = $this->tgmpa->get_installed_version( $slug ); |
|
2259 | + $table_data[ $i ][ 'minimum_version' ] = $plugin[ 'version' ]; |
|
2260 | + $table_data[ $i ][ 'available_version' ] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2261 | 2261 | |
2262 | 2262 | // Prep the upgrade notice info. |
2263 | 2263 | $upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug ); |
2264 | 2264 | if ( ! empty( $upgrade_notice ) ) { |
2265 | - $table_data[ $i ]['upgrade_notice'] = $upgrade_notice; |
|
2265 | + $table_data[ $i ][ 'upgrade_notice' ] = $upgrade_notice; |
|
2266 | 2266 | |
2267 | 2267 | add_action( "tgmpa_after_plugin_row_$slug", array( $this, 'wp_plugin_update_row' ), 10, 2 ); |
2268 | 2268 | } |
@@ -2293,17 +2293,17 @@ discard block |
||
2293 | 2293 | // No need to display plugins if they are installed, up-to-date and active. |
2294 | 2294 | continue; |
2295 | 2295 | } else { |
2296 | - $plugins['all'][ $slug ] = $plugin; |
|
2296 | + $plugins[ 'all' ][ $slug ] = $plugin; |
|
2297 | 2297 | |
2298 | 2298 | if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) { |
2299 | - $plugins['install'][ $slug ] = $plugin; |
|
2299 | + $plugins[ 'install' ][ $slug ] = $plugin; |
|
2300 | 2300 | } else { |
2301 | 2301 | if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) { |
2302 | - $plugins['update'][ $slug ] = $plugin; |
|
2302 | + $plugins[ 'update' ][ $slug ] = $plugin; |
|
2303 | 2303 | } |
2304 | 2304 | |
2305 | 2305 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
2306 | - $plugins['activate'][ $slug ] = $plugin; |
|
2306 | + $plugins[ 'activate' ][ $slug ] = $plugin; |
|
2307 | 2307 | } |
2308 | 2308 | } |
2309 | 2309 | } |
@@ -2423,8 +2423,8 @@ discard block |
||
2423 | 2423 | $name = array(); |
2424 | 2424 | |
2425 | 2425 | foreach ( $items as $i => $plugin ) { |
2426 | - $type[ $i ] = $plugin['type']; // Required / recommended. |
|
2427 | - $name[ $i ] = $plugin['sanitized_plugin']; |
|
2426 | + $type[ $i ] = $plugin[ 'type' ]; // Required / recommended. |
|
2427 | + $name[ $i ] = $plugin[ 'sanitized_plugin' ]; |
|
2428 | 2428 | } |
2429 | 2429 | |
2430 | 2430 | array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items ); |
@@ -2506,9 +2506,9 @@ discard block |
||
2506 | 2506 | public function column_cb( $item ) { |
2507 | 2507 | return sprintf( |
2508 | 2508 | '<input type="checkbox" name="%1$s[]" value="%2$s" id="%3$s" />', |
2509 | - esc_attr( $this->_args['singular'] ), |
|
2510 | - esc_attr( $item['slug'] ), |
|
2511 | - esc_attr( $item['sanitized_plugin'] ) |
|
2509 | + esc_attr( $this->_args[ 'singular' ] ), |
|
2510 | + esc_attr( $item[ 'slug' ] ), |
|
2511 | + esc_attr( $item[ 'sanitized_plugin' ] ) |
|
2512 | 2512 | ); |
2513 | 2513 | } |
2514 | 2514 | |
@@ -2523,7 +2523,7 @@ discard block |
||
2523 | 2523 | public function column_plugin( $item ) { |
2524 | 2524 | return sprintf( |
2525 | 2525 | '%1$s %2$s', |
2526 | - $item['plugin'], |
|
2526 | + $item[ 'plugin' ], |
|
2527 | 2527 | $this->row_actions( $this->get_row_actions( $item ), true ) |
2528 | 2528 | ); |
2529 | 2529 | } |
@@ -2539,38 +2539,38 @@ discard block |
||
2539 | 2539 | public function column_version( $item ) { |
2540 | 2540 | $output = array(); |
2541 | 2541 | |
2542 | - if ( $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
2543 | - $installed = ! empty( $item['installed_version'] ) ? $item['installed_version'] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
2542 | + if ( $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
2543 | + $installed = ! empty( $item[ 'installed_version' ] ) ? $item[ 'installed_version' ] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
2544 | 2544 | |
2545 | 2545 | $color = ''; |
2546 | - if ( ! empty( $item['minimum_version'] ) && $this->tgmpa->does_plugin_require_update( $item['slug'] ) ) { |
|
2546 | + if ( ! empty( $item[ 'minimum_version' ] ) && $this->tgmpa->does_plugin_require_update( $item[ 'slug' ] ) ) { |
|
2547 | 2547 | $color = ' color: #ff0000; font-weight: bold;'; |
2548 | 2548 | } |
2549 | 2549 | |
2550 | - $output[] = sprintf( |
|
2551 | - '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Installed version:', 'tgmpa' ) . '</p>', |
|
2550 | + $output[ ] = sprintf( |
|
2551 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Installed version:', 'tgmpa' ).'</p>', |
|
2552 | 2552 | $color, |
2553 | 2553 | $installed |
2554 | 2554 | ); |
2555 | 2555 | } |
2556 | 2556 | |
2557 | - if ( ! empty( $item['minimum_version'] ) ) { |
|
2558 | - $output[] = sprintf( |
|
2559 | - '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>' . __( 'Minimum required version:', 'tgmpa' ) . '</p>', |
|
2560 | - $item['minimum_version'] |
|
2557 | + if ( ! empty( $item[ 'minimum_version' ] ) ) { |
|
2558 | + $output[ ] = sprintf( |
|
2559 | + '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>'.__( 'Minimum required version:', 'tgmpa' ).'</p>', |
|
2560 | + $item[ 'minimum_version' ] |
|
2561 | 2561 | ); |
2562 | 2562 | } |
2563 | 2563 | |
2564 | - if ( ! empty( $item['available_version'] ) ) { |
|
2564 | + if ( ! empty( $item[ 'available_version' ] ) ) { |
|
2565 | 2565 | $color = ''; |
2566 | - if ( ! empty( $item['minimum_version'] ) && version_compare( $item['available_version'], $item['minimum_version'], '>=' ) ) { |
|
2566 | + if ( ! empty( $item[ 'minimum_version' ] ) && version_compare( $item[ 'available_version' ], $item[ 'minimum_version' ], '>=' ) ) { |
|
2567 | 2567 | $color = ' color: #71C671; font-weight: bold;'; |
2568 | 2568 | } |
2569 | 2569 | |
2570 | - $output[] = sprintf( |
|
2571 | - '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Available version:', 'tgmpa' ) . '</p>', |
|
2570 | + $output[ ] = sprintf( |
|
2571 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Available version:', 'tgmpa' ).'</p>', |
|
2572 | 2572 | $color, |
2573 | - $item['available_version'] |
|
2573 | + $item[ 'available_version' ] |
|
2574 | 2574 | ); |
2575 | 2575 | } |
2576 | 2576 | |
@@ -2591,7 +2591,7 @@ discard block |
||
2591 | 2591 | * @since 2.2.0 |
2592 | 2592 | */ |
2593 | 2593 | public function no_items() { |
2594 | - echo esc_html__( 'No plugins to install, update or activate.', 'tgmpa' ) . ' <a href="' . esc_url( self_admin_url() ) . '"> ' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>'; |
|
2594 | + echo esc_html__( 'No plugins to install, update or activate.', 'tgmpa' ).' <a href="'.esc_url( self_admin_url() ).'"> '.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>'; |
|
2595 | 2595 | echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
2596 | 2596 | } |
2597 | 2597 | |
@@ -2611,8 +2611,8 @@ discard block |
||
2611 | 2611 | ); |
2612 | 2612 | |
2613 | 2613 | if ( 'all' === $this->view_context || 'update' === $this->view_context ) { |
2614 | - $columns['version'] = __( 'Version', 'tgmpa' ); |
|
2615 | - $columns['status'] = __( 'Status', 'tgmpa' ); |
|
2614 | + $columns[ 'version' ] = __( 'Version', 'tgmpa' ); |
|
2615 | + $columns[ 'status' ] = __( 'Status', 'tgmpa' ); |
|
2616 | 2616 | } |
2617 | 2617 | |
2618 | 2618 | return apply_filters( 'tgmpa_table_columns', $columns ); |
@@ -2659,20 +2659,20 @@ discard block |
||
2659 | 2659 | $action_links = array(); |
2660 | 2660 | |
2661 | 2661 | // Display the 'Install' action link if the plugin is not yet available. |
2662 | - if ( ! $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
2662 | + if ( ! $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
2663 | 2663 | /* translators: %s: plugin name in screen reader markup */ |
2664 | - $actions['install'] = __( 'Install %s', 'tgmpa' ); |
|
2664 | + $actions[ 'install' ] = __( 'Install %s', 'tgmpa' ); |
|
2665 | 2665 | } else { |
2666 | 2666 | // Display the 'Update' action link if an update is available and WP complies with plugin minimum. |
2667 | - if ( false !== $this->tgmpa->does_plugin_have_update( $item['slug'] ) && $this->tgmpa->can_plugin_update( $item['slug'] ) ) { |
|
2667 | + if ( false !== $this->tgmpa->does_plugin_have_update( $item[ 'slug' ] ) && $this->tgmpa->can_plugin_update( $item[ 'slug' ] ) ) { |
|
2668 | 2668 | /* translators: %s: plugin name in screen reader markup */ |
2669 | - $actions['update'] = __( 'Update %s', 'tgmpa' ); |
|
2669 | + $actions[ 'update' ] = __( 'Update %s', 'tgmpa' ); |
|
2670 | 2670 | } |
2671 | 2671 | |
2672 | 2672 | // Display the 'Activate' action link, but only if the plugin meets the minimum version. |
2673 | - if ( $this->tgmpa->can_plugin_activate( $item['slug'] ) ) { |
|
2673 | + if ( $this->tgmpa->can_plugin_activate( $item[ 'slug' ] ) ) { |
|
2674 | 2674 | /* translators: %s: plugin name in screen reader markup */ |
2675 | - $actions['activate'] = __( 'Activate %s', 'tgmpa' ); |
|
2675 | + $actions[ 'activate' ] = __( 'Activate %s', 'tgmpa' ); |
|
2676 | 2676 | } |
2677 | 2677 | } |
2678 | 2678 | |
@@ -2681,24 +2681,24 @@ discard block |
||
2681 | 2681 | $nonce_url = wp_nonce_url( |
2682 | 2682 | add_query_arg( |
2683 | 2683 | array( |
2684 | - 'plugin' => urlencode( $item['slug'] ), |
|
2685 | - 'tgmpa-' . $action => $action . '-plugin', |
|
2684 | + 'plugin' => urlencode( $item[ 'slug' ] ), |
|
2685 | + 'tgmpa-'.$action => $action.'-plugin', |
|
2686 | 2686 | ), |
2687 | 2687 | $this->tgmpa->get_tgmpa_url() |
2688 | 2688 | ), |
2689 | - 'tgmpa-' . $action, |
|
2689 | + 'tgmpa-'.$action, |
|
2690 | 2690 | 'tgmpa-nonce' |
2691 | 2691 | ); |
2692 | 2692 | |
2693 | 2693 | $action_links[ $action ] = sprintf( |
2694 | - '<a href="%1$s">' . esc_html( $text ) . '</a>', |
|
2694 | + '<a href="%1$s">'.esc_html( $text ).'</a>', |
|
2695 | 2695 | esc_url( $nonce_url ), |
2696 | - '<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>' |
|
2696 | + '<span class="screen-reader-text">'.esc_html( $item[ 'sanitized_plugin' ] ).'</span>' |
|
2697 | 2697 | ); |
2698 | 2698 | } |
2699 | 2699 | |
2700 | 2700 | $prefix = ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) ? 'network_admin_' : ''; |
2701 | - return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item['slug'], $item, $this->view_context ); |
|
2701 | + return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item[ 'slug' ], $item, $this->view_context ); |
|
2702 | 2702 | } |
2703 | 2703 | |
2704 | 2704 | /** |
@@ -2719,7 +2719,7 @@ discard block |
||
2719 | 2719 | * |
2720 | 2720 | * @since 2.5.0 |
2721 | 2721 | */ |
2722 | - do_action( "tgmpa_after_plugin_row_{$item['slug']}", $item['slug'], $item, $this->view_context ); |
|
2722 | + do_action( "tgmpa_after_plugin_row_{$item[ 'slug' ]}", $item[ 'slug' ], $item, $this->view_context ); |
|
2723 | 2723 | } |
2724 | 2724 | |
2725 | 2725 | /** |
@@ -2734,7 +2734,7 @@ discard block |
||
2734 | 2734 | * @return null Return early if upgrade notice is empty. |
2735 | 2735 | */ |
2736 | 2736 | public function wp_plugin_update_row( $slug, $item ) { |
2737 | - if ( empty( $item['upgrade_notice'] ) ) { |
|
2737 | + if ( empty( $item[ 'upgrade_notice' ] ) ) { |
|
2738 | 2738 | return; |
2739 | 2739 | } |
2740 | 2740 | |
@@ -2743,7 +2743,7 @@ discard block |
||
2743 | 2743 | <td colspan="', absint( $this->get_column_count() ), '" class="plugin-update colspanchange"> |
2744 | 2744 | <div class="update-message">', |
2745 | 2745 | esc_html__( 'Upgrade message from the plugin author:', 'tgmpa' ), |
2746 | - ' <strong>', wp_kses_data( $item['upgrade_notice'] ), '</strong> |
|
2746 | + ' <strong>', wp_kses_data( $item[ 'upgrade_notice' ] ), '</strong> |
|
2747 | 2747 | </div> |
2748 | 2748 | </td> |
2749 | 2749 | </tr>'; |
@@ -2775,16 +2775,16 @@ discard block |
||
2775 | 2775 | |
2776 | 2776 | if ( 'update' !== $this->view_context && 'activate' !== $this->view_context ) { |
2777 | 2777 | if ( current_user_can( 'install_plugins' ) ) { |
2778 | - $actions['tgmpa-bulk-install'] = __( 'Install', 'tgmpa' ); |
|
2778 | + $actions[ 'tgmpa-bulk-install' ] = __( 'Install', 'tgmpa' ); |
|
2779 | 2779 | } |
2780 | 2780 | } |
2781 | 2781 | |
2782 | 2782 | if ( 'install' !== $this->view_context ) { |
2783 | 2783 | if ( current_user_can( 'update_plugins' ) ) { |
2784 | - $actions['tgmpa-bulk-update'] = __( 'Update', 'tgmpa' ); |
|
2784 | + $actions[ 'tgmpa-bulk-update' ] = __( 'Update', 'tgmpa' ); |
|
2785 | 2785 | } |
2786 | 2786 | if ( current_user_can( 'activate_plugins' ) ) { |
2787 | - $actions['tgmpa-bulk-activate'] = __( 'Activate', 'tgmpa' ); |
|
2787 | + $actions[ 'tgmpa-bulk-activate' ] = __( 'Activate', 'tgmpa' ); |
|
2788 | 2788 | } |
2789 | 2789 | } |
2790 | 2790 | |
@@ -2803,7 +2803,7 @@ discard block |
||
2803 | 2803 | // Bulk installation process. |
2804 | 2804 | if ( 'tgmpa-bulk-install' === $this->current_action() || 'tgmpa-bulk-update' === $this->current_action() ) { |
2805 | 2805 | |
2806 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
2806 | + check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2807 | 2807 | |
2808 | 2808 | $install_type = 'install'; |
2809 | 2809 | if ( 'tgmpa-bulk-update' === $this->current_action() ) { |
@@ -2813,7 +2813,7 @@ discard block |
||
2813 | 2813 | $plugins_to_install = array(); |
2814 | 2814 | |
2815 | 2815 | // Did user actually select any plugins to install/update ? |
2816 | - if ( empty( $_POST['plugin'] ) ) { |
|
2816 | + if ( empty( $_POST[ 'plugin' ] ) ) { |
|
2817 | 2817 | if ( 'install' === $install_type ) { |
2818 | 2818 | $message = __( 'No plugins were selected to be installed. No action taken.', 'tgmpa' ); |
2819 | 2819 | } else { |
@@ -2825,11 +2825,11 @@ discard block |
||
2825 | 2825 | return false; |
2826 | 2826 | } |
2827 | 2827 | |
2828 | - if ( is_array( $_POST['plugin'] ) ) { |
|
2829 | - $plugins_to_install = (array) $_POST['plugin']; |
|
2830 | - } elseif ( is_string( $_POST['plugin'] ) ) { |
|
2828 | + if ( is_array( $_POST[ 'plugin' ] ) ) { |
|
2829 | + $plugins_to_install = (array) $_POST[ 'plugin' ]; |
|
2830 | + } elseif ( is_string( $_POST[ 'plugin' ] ) ) { |
|
2831 | 2831 | // Received via Filesystem page - un-flatten array (WP bug #19643). |
2832 | - $plugins_to_install = explode( ',', $_POST['plugin'] ); |
|
2832 | + $plugins_to_install = explode( ',', $_POST[ 'plugin' ] ); |
|
2833 | 2833 | } |
2834 | 2834 | |
2835 | 2835 | // Sanitize the received input. |
@@ -2871,11 +2871,11 @@ discard block |
||
2871 | 2871 | // Pass all necessary information if WP_Filesystem is needed. |
2872 | 2872 | $url = wp_nonce_url( |
2873 | 2873 | $this->tgmpa->get_tgmpa_url(), |
2874 | - 'bulk-' . $this->_args['plural'] |
|
2874 | + 'bulk-'.$this->_args[ 'plural' ] |
|
2875 | 2875 | ); |
2876 | 2876 | |
2877 | 2877 | // Give validated data back to $_POST which is the only place the filesystem looks for extra fields. |
2878 | - $_POST['plugin'] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
2878 | + $_POST[ 'plugin' ] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
2879 | 2879 | |
2880 | 2880 | $method = ''; // Leave blank so WP_Filesystem can populate it as necessary. |
2881 | 2881 | $fields = array_keys( $_POST ); // Extra fields to pass to WP_Filesystem. |
@@ -2902,22 +2902,22 @@ discard block |
||
2902 | 2902 | |
2903 | 2903 | // Prepare the data for validated plugins for the install/upgrade. |
2904 | 2904 | foreach ( $plugins_to_install as $slug ) { |
2905 | - $name = $this->tgmpa->plugins[ $slug ]['name']; |
|
2905 | + $name = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
2906 | 2906 | $source = $this->tgmpa->get_download_url( $slug ); |
2907 | 2907 | |
2908 | 2908 | if ( ! empty( $name ) && ! empty( $source ) ) { |
2909 | - $names[] = $name; |
|
2909 | + $names[ ] = $name; |
|
2910 | 2910 | |
2911 | 2911 | switch ( $install_type ) { |
2912 | 2912 | |
2913 | 2913 | case 'install': |
2914 | - $sources[] = $source; |
|
2914 | + $sources[ ] = $source; |
|
2915 | 2915 | break; |
2916 | 2916 | |
2917 | 2917 | case 'update': |
2918 | - $file_paths[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
2918 | + $file_paths[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
2919 | 2919 | $to_inject[ $slug ] = $this->tgmpa->plugins[ $slug ]; |
2920 | - $to_inject[ $slug ]['source'] = $source; |
|
2920 | + $to_inject[ $slug ][ 'source' ] = $source; |
|
2921 | 2921 | break; |
2922 | 2922 | } |
2923 | 2923 | } |
@@ -2929,7 +2929,7 @@ discard block |
||
2929 | 2929 | new TGMPA_Bulk_Installer_Skin( |
2930 | 2930 | array( |
2931 | 2931 | 'url' => esc_url_raw( $this->tgmpa->get_tgmpa_url() ), |
2932 | - 'nonce' => 'bulk-' . $this->_args['plural'], |
|
2932 | + 'nonce' => 'bulk-'.$this->_args[ 'plural' ], |
|
2933 | 2933 | 'names' => $names, |
2934 | 2934 | 'install_type' => $install_type, |
2935 | 2935 | ) |
@@ -2962,10 +2962,10 @@ discard block |
||
2962 | 2962 | |
2963 | 2963 | // Bulk activation process. |
2964 | 2964 | if ( 'tgmpa-bulk-activate' === $this->current_action() ) { |
2965 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
2965 | + check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2966 | 2966 | |
2967 | 2967 | // Did user actually select any plugins to activate ? |
2968 | - if ( empty( $_POST['plugin'] ) ) { |
|
2968 | + if ( empty( $_POST[ 'plugin' ] ) ) { |
|
2969 | 2969 | echo '<div id="message" class="error"><p>', esc_html__( 'No plugins were selected to be activated. No action taken.', 'tgmpa' ), '</p></div>'; |
2970 | 2970 | |
2971 | 2971 | return false; |
@@ -2973,8 +2973,8 @@ discard block |
||
2973 | 2973 | |
2974 | 2974 | // Grab plugin data from $_POST. |
2975 | 2975 | $plugins = array(); |
2976 | - if ( isset( $_POST['plugin'] ) ) { |
|
2977 | - $plugins = array_map( 'urldecode', (array) $_POST['plugin'] ); |
|
2976 | + if ( isset( $_POST[ 'plugin' ] ) ) { |
|
2977 | + $plugins = array_map( 'urldecode', (array) $_POST[ 'plugin' ] ); |
|
2978 | 2978 | $plugins = array_map( array( $this->tgmpa, 'sanitize_key' ), $plugins ); |
2979 | 2979 | } |
2980 | 2980 | |
@@ -2984,8 +2984,8 @@ discard block |
||
2984 | 2984 | // Grab the file paths for the selected & inactive plugins from the registration array. |
2985 | 2985 | foreach ( $plugins as $slug ) { |
2986 | 2986 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
2987 | - $plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
2988 | - $plugin_names[] = $this->tgmpa->plugins[ $slug ]['name']; |
|
2987 | + $plugins_to_activate[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
2988 | + $plugin_names[ ] = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
2989 | 2989 | } |
2990 | 2990 | } |
2991 | 2991 | unset( $slug ); |
@@ -3006,7 +3006,7 @@ discard block |
||
3006 | 3006 | $count = count( $plugin_names ); // Count so we can use _n function. |
3007 | 3007 | $plugin_names = array_map( array( 'TGMPA_Utils', 'wrap_in_strong' ), $plugin_names ); |
3008 | 3008 | $last_plugin = array_pop( $plugin_names ); // Pop off last name to prep for readability. |
3009 | - $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
3009 | + $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); |
|
3010 | 3010 | |
3011 | 3011 | printf( // WPCS: xss ok. |
3012 | 3012 | '<div id="message" class="updated"><p>%1$s %2$s.</p></div>', |
@@ -3109,16 +3109,16 @@ discard block |
||
3109 | 3109 | */ |
3110 | 3110 | function tgmpa_load_bulk_installer() { |
3111 | 3111 | // Silently fail if 2.5+ is loaded *after* an older version. |
3112 | - if ( ! isset( $GLOBALS['tgmpa'] ) ) { |
|
3112 | + if ( ! isset( $GLOBALS[ 'tgmpa' ] ) ) { |
|
3113 | 3113 | return; |
3114 | 3114 | } |
3115 | 3115 | |
3116 | 3116 | // Get TGMPA class instance. |
3117 | - $tgmpa_instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
3117 | + $tgmpa_instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3118 | 3118 | |
3119 | - if ( isset( $_GET['page'] ) && $tgmpa_instance->menu === $_GET['page'] ) { |
|
3119 | + if ( isset( $_GET[ 'page' ] ) && $tgmpa_instance->menu === $_GET[ 'page' ] ) { |
|
3120 | 3120 | if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
3121 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
3121 | + require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
3122 | 3122 | } |
3123 | 3123 | |
3124 | 3124 | if ( ! class_exists( 'TGMPA_Bulk_Installer' ) ) { |
@@ -3185,11 +3185,11 @@ discard block |
||
3185 | 3185 | */ |
3186 | 3186 | public function __construct( $skin = null ) { |
3187 | 3187 | // Get TGMPA class instance. |
3188 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
3188 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3189 | 3189 | |
3190 | 3190 | parent::__construct( $skin ); |
3191 | 3191 | |
3192 | - if ( isset( $this->skin->options['install_type'] ) && 'update' === $this->skin->options['install_type'] ) { |
|
3192 | + if ( isset( $this->skin->options[ 'install_type' ] ) && 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3193 | 3193 | $this->clear_destination = true; |
3194 | 3194 | } |
3195 | 3195 | |
@@ -3206,8 +3206,8 @@ discard block |
||
3206 | 3206 | * @since 2.2.0 |
3207 | 3207 | */ |
3208 | 3208 | public function activate_strings() { |
3209 | - $this->strings['activation_failed'] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
3210 | - $this->strings['activation_success'] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
3209 | + $this->strings[ 'activation_failed' ] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
3210 | + $this->strings[ 'activation_success' ] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
3211 | 3211 | } |
3212 | 3212 | |
3213 | 3213 | /** |
@@ -3225,7 +3225,7 @@ discard block |
||
3225 | 3225 | |
3226 | 3226 | // Reset the strings in case we changed one during automatic activation. |
3227 | 3227 | if ( $this->tgmpa->is_automatic ) { |
3228 | - if ( 'update' === $this->skin->options['install_type'] ) { |
|
3228 | + if ( 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3229 | 3229 | $this->upgrade_strings(); |
3230 | 3230 | } else { |
3231 | 3231 | $this->install_strings(); |
@@ -3383,7 +3383,7 @@ discard block |
||
3383 | 3383 | remove_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 ); |
3384 | 3384 | |
3385 | 3385 | // Force refresh of plugin update information. |
3386 | - wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); |
|
3386 | + wp_clean_plugins_cache( $parsed_args[ 'clear_update_cache' ] ); |
|
3387 | 3387 | |
3388 | 3388 | return $results; |
3389 | 3389 | } |
@@ -3434,13 +3434,13 @@ discard block |
||
3434 | 3434 | $activate = activate_plugin( $plugin_info ); |
3435 | 3435 | |
3436 | 3436 | // Adjust the success string based on the activation result. |
3437 | - $this->strings['process_success'] = $this->strings['process_success'] . "<br />\n"; |
|
3437 | + $this->strings[ 'process_success' ] = $this->strings[ 'process_success' ]."<br />\n"; |
|
3438 | 3438 | |
3439 | 3439 | if ( is_wp_error( $activate ) ) { |
3440 | 3440 | $this->skin->error( $activate ); |
3441 | - $this->strings['process_success'] .= $this->strings['activation_failed']; |
|
3441 | + $this->strings[ 'process_success' ] .= $this->strings[ 'activation_failed' ]; |
|
3442 | 3442 | } else { |
3443 | - $this->strings['process_success'] .= $this->strings['activation_success']; |
|
3443 | + $this->strings[ 'process_success' ] .= $this->strings[ 'activation_success' ]; |
|
3444 | 3444 | } |
3445 | 3445 | } |
3446 | 3446 | } |
@@ -3516,7 +3516,7 @@ discard block |
||
3516 | 3516 | */ |
3517 | 3517 | public function __construct( $args = array() ) { |
3518 | 3518 | // Get TGMPA class instance. |
3519 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
3519 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3520 | 3520 | |
3521 | 3521 | // Parse default and new args. |
3522 | 3522 | $defaults = array( |
@@ -3525,10 +3525,10 @@ discard block |
||
3525 | 3525 | 'names' => array(), |
3526 | 3526 | 'install_type' => 'install', |
3527 | 3527 | ); |
3528 | - $args = wp_parse_args( $args, $defaults ); |
|
3528 | + $args = wp_parse_args( $args, $defaults ); |
|
3529 | 3529 | |
3530 | 3530 | // Set plugin names to $this->plugin_names property. |
3531 | - $this->plugin_names = $args['names']; |
|
3531 | + $this->plugin_names = $args[ 'names' ]; |
|
3532 | 3532 | |
3533 | 3533 | // Extract the new args. |
3534 | 3534 | parent::__construct( $args ); |
@@ -3543,25 +3543,25 @@ discard block |
||
3543 | 3543 | * @since 2.2.0 |
3544 | 3544 | */ |
3545 | 3545 | public function add_strings() { |
3546 | - if ( 'update' === $this->options['install_type'] ) { |
|
3546 | + if ( 'update' === $this->options[ 'install_type' ] ) { |
|
3547 | 3547 | parent::add_strings(); |
3548 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3548 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3549 | 3549 | } else { |
3550 | - $this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
3551 | - $this->upgrader->strings['skin_update_failed'] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
3550 | + $this->upgrader->strings[ 'skin_update_failed_error' ] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
3551 | + $this->upgrader->strings[ 'skin_update_failed' ] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
3552 | 3552 | |
3553 | 3553 | if ( $this->tgmpa->is_automatic ) { |
3554 | 3554 | // Automatic activation strings. |
3555 | - $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' ); |
|
3556 | - $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>'; |
|
3557 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
3558 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3555 | + $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' ); |
|
3556 | + $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>'; |
|
3557 | + $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
3558 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3559 | 3559 | } else { |
3560 | 3560 | // Default installation strings. |
3561 | - $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' ); |
|
3562 | - $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>'; |
|
3563 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations have been completed.', 'tgmpa' ); |
|
3564 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3561 | + $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' ); |
|
3562 | + $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>'; |
|
3563 | + $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations have been completed.', 'tgmpa' ); |
|
3564 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3565 | 3565 | } |
3566 | 3566 | } |
3567 | 3567 | } |
@@ -3619,12 +3619,12 @@ discard block |
||
3619 | 3619 | if ( $this->tgmpa->is_tgmpa_complete() ) { |
3620 | 3620 | // All plugins are active, so we display the complete string and hide the menu to protect users. |
3621 | 3621 | echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
3622 | - $update_actions['dashboard'] = sprintf( |
|
3623 | - esc_html( $this->tgmpa->strings['complete'] ), |
|
3624 | - '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' |
|
3622 | + $update_actions[ 'dashboard' ] = sprintf( |
|
3623 | + esc_html( $this->tgmpa->strings[ 'complete' ] ), |
|
3624 | + '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' |
|
3625 | 3625 | ); |
3626 | 3626 | } else { |
3627 | - $update_actions['tgmpa_page'] = '<a href="' . esc_url( $this->tgmpa->get_tgmpa_url() ) . '" target="_parent">' . esc_html( $this->tgmpa->strings['return'] ) . '</a>'; |
|
3627 | + $update_actions[ 'tgmpa_page' ] = '<a href="'.esc_url( $this->tgmpa->get_tgmpa_url() ).'" target="_parent">'.esc_html( $this->tgmpa->strings[ 'return' ] ).'</a>'; |
|
3628 | 3628 | } |
3629 | 3629 | |
3630 | 3630 | /** |
@@ -3714,7 +3714,7 @@ discard block |
||
3714 | 3714 | * @return string |
3715 | 3715 | */ |
3716 | 3716 | public static function wrap_in_em( $string ) { |
3717 | - return '<em>' . wp_kses_post( $string ) . '</em>'; |
|
3717 | + return '<em>'.wp_kses_post( $string ).'</em>'; |
|
3718 | 3718 | } |
3719 | 3719 | |
3720 | 3720 | /** |
@@ -3728,7 +3728,7 @@ discard block |
||
3728 | 3728 | * @return string |
3729 | 3729 | */ |
3730 | 3730 | public static function wrap_in_strong( $string ) { |
3731 | - return '<strong>' . wp_kses_post( $string ) . '</strong>'; |
|
3731 | + return '<strong>'.wp_kses_post( $string ).'</strong>'; |
|
3732 | 3732 | } |
3733 | 3733 | |
3734 | 3734 | /** |
@@ -3765,7 +3765,7 @@ discard block |
||
3765 | 3765 | */ |
3766 | 3766 | protected static function emulate_filter_bool( $value ) { |
3767 | 3767 | // @codingStandardsIgnoreStart |
3768 | - static $true = array( |
|
3768 | + static $true = array( |
|
3769 | 3769 | '1', |
3770 | 3770 | 'true', 'True', 'TRUE', |
3771 | 3771 | 'y', 'Y', |