@@ -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 ) ); |
@@ -442,15 +442,15 @@ discard block |
||
442 | 442 | public function add_plugin_action_link_filters() { |
443 | 443 | foreach ( $this->plugins as $slug => $plugin ) { |
444 | 444 | if ( false === $this->can_plugin_activate( $slug ) ) { |
445 | - add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_activate' ), 20 ); |
|
445 | + add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_activate' ), 20 ); |
|
446 | 446 | } |
447 | 447 | |
448 | - if ( true === $plugin['force_activation'] ) { |
|
449 | - add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_deactivate' ), 20 ); |
|
448 | + if ( true === $plugin[ 'force_activation' ] ) { |
|
449 | + add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_deactivate' ), 20 ); |
|
450 | 450 | } |
451 | 451 | |
452 | 452 | if ( false !== $this->does_plugin_require_update( $slug ) ) { |
453 | - add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_update' ), 20 ); |
|
453 | + add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_update' ), 20 ); |
|
454 | 454 | } |
455 | 455 | } |
456 | 456 | } |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | * @return array |
466 | 466 | */ |
467 | 467 | public function filter_plugin_action_links_activate( $actions ) { |
468 | - unset( $actions['activate'] ); |
|
468 | + unset( $actions[ 'activate' ] ); |
|
469 | 469 | |
470 | 470 | return $actions; |
471 | 471 | } |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | * @return array |
480 | 480 | */ |
481 | 481 | public function filter_plugin_action_links_deactivate( $actions ) { |
482 | - unset( $actions['deactivate'] ); |
|
482 | + unset( $actions[ 'deactivate' ] ); |
|
483 | 483 | |
484 | 484 | return $actions; |
485 | 485 | } |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | * @return array |
495 | 495 | */ |
496 | 496 | public function filter_plugin_action_links_update( $actions ) { |
497 | - $actions['update'] = sprintf( |
|
497 | + $actions[ 'update' ] = sprintf( |
|
498 | 498 | '<a href="%1$s" title="%2$s" class="edit">%3$s</a>', |
499 | 499 | esc_url( $this->get_tgmpa_status_url( 'update' ) ), |
500 | 500 | esc_attr__( 'This plugin needs to be updated to be compatible with your theme.', 'tgmpa' ), |
@@ -532,9 +532,9 @@ discard block |
||
532 | 532 | return; |
533 | 533 | } |
534 | 534 | |
535 | - if ( isset( $_REQUEST['tab'] ) && 'plugin-information' === $_REQUEST['tab'] ) { |
|
535 | + if ( isset( $_REQUEST[ 'tab' ] ) && 'plugin-information' === $_REQUEST[ 'tab' ] ) { |
|
536 | 536 | // Needed for install_plugin_information(). |
537 | - require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
|
537 | + require_once ABSPATH.'wp-admin/includes/plugin-install.php'; |
|
538 | 538 | |
539 | 539 | wp_enqueue_style( 'plugin-install' ); |
540 | 540 | |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | * @since 2.1.0 |
563 | 563 | */ |
564 | 564 | public function thickbox() { |
565 | - if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) ) { |
|
565 | + if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, true ) ) { |
|
566 | 566 | add_thickbox(); |
567 | 567 | } |
568 | 568 | } |
@@ -591,11 +591,11 @@ discard block |
||
591 | 591 | $args = apply_filters( |
592 | 592 | 'tgmpa_admin_menu_args', |
593 | 593 | array( |
594 | - 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
595 | - 'page_title' => $this->strings['page_title'], // Page title. |
|
596 | - 'menu_title' => $this->strings['menu_title'], // Menu title. |
|
597 | - 'capability' => $this->capability, // Capability. |
|
598 | - 'menu_slug' => $this->menu, // Menu slug. |
|
594 | + 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
595 | + 'page_title' => $this->strings[ 'page_title' ], // Page title. |
|
596 | + 'menu_title' => $this->strings[ 'menu_title' ], // Menu title. |
|
597 | + 'capability' => $this->capability, // Capability. |
|
598 | + 'menu_slug' => $this->menu, // Menu slug. |
|
599 | 599 | 'function' => array( $this, 'install_plugins_page' ), // Callback. |
600 | 600 | ) |
601 | 601 | ); |
@@ -616,10 +616,10 @@ discard block |
||
616 | 616 | } |
617 | 617 | |
618 | 618 | if ( 'themes.php' === $this->parent_slug ) { |
619 | - $this->page_hook = call_user_func( 'add_theme_page', $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] ); |
|
619 | + $this->page_hook = call_user_func( 'add_theme_page', $args[ 'page_title' ], $args[ 'menu_title' ], $args[ 'capability' ], $args[ 'menu_slug' ], $args[ 'function' ] ); |
|
620 | 620 | } else { |
621 | 621 | $type = 'submenu'; |
622 | - $this->page_hook = call_user_func( "add_{$type}_page", $args['parent_slug'], $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] ); |
|
622 | + $this->page_hook = call_user_func( "add_{$type}_page", $args[ 'parent_slug' ], $args[ 'page_title' ], $args[ 'menu_title' ], $args[ 'capability' ], $args[ 'menu_slug' ], $args[ 'function' ] ); |
|
623 | 623 | } |
624 | 624 | } |
625 | 625 | |
@@ -688,37 +688,37 @@ discard block |
||
688 | 688 | * @return boolean True on success, false on failure. |
689 | 689 | */ |
690 | 690 | protected function do_plugin_install() { |
691 | - if ( empty( $_GET['plugin'] ) ) { |
|
691 | + if ( empty( $_GET[ 'plugin' ] ) ) { |
|
692 | 692 | return false; |
693 | 693 | } |
694 | 694 | |
695 | 695 | // All plugin information will be stored in an array for processing. |
696 | - $slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) ); |
|
696 | + $slug = $this->sanitize_key( urldecode( $_GET[ 'plugin' ] ) ); |
|
697 | 697 | |
698 | 698 | if ( ! isset( $this->plugins[ $slug ] ) ) { |
699 | 699 | return false; |
700 | 700 | } |
701 | 701 | |
702 | 702 | // Was an install or upgrade action link clicked? |
703 | - if ( ( isset( $_GET['tgmpa-install'] ) && 'install-plugin' === $_GET['tgmpa-install'] ) || ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) ) { |
|
703 | + if ( ( isset( $_GET[ 'tgmpa-install' ] ) && 'install-plugin' === $_GET[ 'tgmpa-install' ] ) || ( isset( $_GET[ 'tgmpa-update' ] ) && 'update-plugin' === $_GET[ 'tgmpa-update' ] ) ) { |
|
704 | 704 | |
705 | 705 | $install_type = 'install'; |
706 | - if ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) { |
|
706 | + if ( isset( $_GET[ 'tgmpa-update' ] ) && 'update-plugin' === $_GET[ 'tgmpa-update' ] ) { |
|
707 | 707 | $install_type = 'update'; |
708 | 708 | } |
709 | 709 | |
710 | - check_admin_referer( 'tgmpa-' . $install_type, 'tgmpa-nonce' ); |
|
710 | + check_admin_referer( 'tgmpa-'.$install_type, 'tgmpa-nonce' ); |
|
711 | 711 | |
712 | 712 | // Pass necessary information via URL if WP_Filesystem is needed. |
713 | 713 | $url = wp_nonce_url( |
714 | 714 | add_query_arg( |
715 | 715 | array( |
716 | 716 | 'plugin' => urlencode( $slug ), |
717 | - 'tgmpa-' . $install_type => $install_type . '-plugin', |
|
717 | + 'tgmpa-'.$install_type => $install_type.'-plugin', |
|
718 | 718 | ), |
719 | 719 | $this->get_tgmpa_url() |
720 | 720 | ), |
721 | - 'tgmpa-' . $install_type, |
|
721 | + 'tgmpa-'.$install_type, |
|
722 | 722 | 'tgmpa-nonce' |
723 | 723 | ); |
724 | 724 | |
@@ -737,29 +737,29 @@ discard block |
||
737 | 737 | |
738 | 738 | // Prep variables for Plugin_Installer_Skin class. |
739 | 739 | $extra = array(); |
740 | - $extra['slug'] = $slug; // Needed for potentially renaming of directory name. |
|
740 | + $extra[ 'slug' ] = $slug; // Needed for potentially renaming of directory name. |
|
741 | 741 | $source = $this->get_download_url( $slug ); |
742 | - $api = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null; |
|
742 | + $api = ( 'repo' === $this->plugins[ $slug ][ 'source_type' ] ) ? $this->get_plugins_api( $slug ) : null; |
|
743 | 743 | $api = ( false !== $api ) ? $api : null; |
744 | 744 | |
745 | 745 | $url = add_query_arg( |
746 | 746 | array( |
747 | - 'action' => $install_type . '-plugin', |
|
747 | + 'action' => $install_type.'-plugin', |
|
748 | 748 | 'plugin' => urlencode( $slug ), |
749 | 749 | ), |
750 | 750 | 'update.php' |
751 | 751 | ); |
752 | 752 | |
753 | 753 | if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
754 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
754 | + require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
755 | 755 | } |
756 | 756 | |
757 | - $title = ( 'update' === $install_type ) ? $this->strings['updating'] : $this->strings['installing']; |
|
757 | + $title = ( 'update' === $install_type ) ? $this->strings[ 'updating' ] : $this->strings[ 'installing' ]; |
|
758 | 758 | $skin_args = array( |
759 | - 'type' => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload', |
|
760 | - 'title' => sprintf( $title, $this->plugins[ $slug ]['name'] ), |
|
759 | + 'type' => ( 'bundled' !== $this->plugins[ $slug ][ 'source_type' ] ) ? 'web' : 'upload', |
|
760 | + 'title' => sprintf( $title, $this->plugins[ $slug ][ 'name' ] ), |
|
761 | 761 | 'url' => esc_url_raw( $url ), |
762 | - 'nonce' => $install_type . '-plugin_' . $slug, |
|
762 | + 'nonce' => $install_type.'-plugin_'.$slug, |
|
763 | 763 | 'plugin' => '', |
764 | 764 | 'api' => $api, |
765 | 765 | 'extra' => $extra, |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | unset( $title ); |
768 | 768 | |
769 | 769 | if ( 'update' === $install_type ) { |
770 | - $skin_args['plugin'] = $this->plugins[ $slug ]['file_path']; |
|
770 | + $skin_args[ 'plugin' ] = $this->plugins[ $slug ][ 'file_path' ]; |
|
771 | 771 | $skin = new Plugin_Upgrader_Skin( $skin_args ); |
772 | 772 | } else { |
773 | 773 | $skin = new Plugin_Installer_Skin( $skin_args ); |
@@ -782,10 +782,10 @@ discard block |
||
782 | 782 | if ( 'update' === $install_type ) { |
783 | 783 | // Inject our info into the update transient. |
784 | 784 | $to_inject = array( $slug => $this->plugins[ $slug ] ); |
785 | - $to_inject[ $slug ]['source'] = $source; |
|
785 | + $to_inject[ $slug ][ 'source' ] = $source; |
|
786 | 786 | $this->inject_update_info( $to_inject ); |
787 | 787 | |
788 | - $upgrader->upgrade( $this->plugins[ $slug ]['file_path'] ); |
|
788 | + $upgrader->upgrade( $this->plugins[ $slug ][ 'file_path' ] ); |
|
789 | 789 | } else { |
790 | 790 | $upgrader->install( $source ); |
791 | 791 | } |
@@ -808,18 +808,18 @@ discard block |
||
808 | 808 | |
809 | 809 | // Display message based on if all plugins are now active or not. |
810 | 810 | if ( $this->is_tgmpa_complete() ) { |
811 | - echo '<p>', sprintf( esc_html( $this->strings['complete'] ), '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' ), '</p>'; |
|
811 | + echo '<p>', sprintf( esc_html( $this->strings[ 'complete' ] ), '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' ), '</p>'; |
|
812 | 812 | echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
813 | 813 | } else { |
814 | - echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; |
|
814 | + echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings[ 'return' ] ), '</a></p>'; |
|
815 | 815 | } |
816 | 816 | |
817 | 817 | return true; |
818 | - } elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) { |
|
818 | + } elseif ( isset( $this->plugins[ $slug ][ 'file_path' ], $_GET[ 'tgmpa-activate' ] ) && 'activate-plugin' === $_GET[ 'tgmpa-activate' ] ) { |
|
819 | 819 | // Activate action link was clicked. |
820 | 820 | check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' ); |
821 | 821 | |
822 | - if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) { |
|
822 | + if ( false === $this->activate_single_plugin( $this->plugins[ $slug ][ 'file_path' ], $slug ) ) { |
|
823 | 823 | return true; // Finish execution of the function early as we encountered an error. |
824 | 824 | } |
825 | 825 | } |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | } |
843 | 843 | |
844 | 844 | foreach ( $plugins as $slug => $plugin ) { |
845 | - $file_path = $plugin['file_path']; |
|
845 | + $file_path = $plugin[ 'file_path' ]; |
|
846 | 846 | |
847 | 847 | if ( empty( $repo_updates->response[ $file_path ] ) ) { |
848 | 848 | $repo_updates->response[ $file_path ] = new stdClass; |
@@ -851,10 +851,10 @@ discard block |
||
851 | 851 | // We only really need to set package, but let's do all we can in case WP changes something. |
852 | 852 | $repo_updates->response[ $file_path ]->slug = $slug; |
853 | 853 | $repo_updates->response[ $file_path ]->plugin = $file_path; |
854 | - $repo_updates->response[ $file_path ]->new_version = $plugin['version']; |
|
855 | - $repo_updates->response[ $file_path ]->package = $plugin['source']; |
|
856 | - if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) { |
|
857 | - $repo_updates->response[ $file_path ]->url = $plugin['external_url']; |
|
854 | + $repo_updates->response[ $file_path ]->new_version = $plugin[ 'version' ]; |
|
855 | + $repo_updates->response[ $file_path ]->package = $plugin[ 'source' ]; |
|
856 | + if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin[ 'external_url' ] ) ) { |
|
857 | + $repo_updates->response[ $file_path ]->url = $plugin[ 'external_url' ]; |
|
858 | 858 | } |
859 | 859 | } |
860 | 860 | |
@@ -878,13 +878,13 @@ discard block |
||
878 | 878 | * @return string $source |
879 | 879 | */ |
880 | 880 | public function maybe_adjust_source_dir( $source, $remote_source, $upgrader ) { |
881 | - if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS['wp_filesystem'] ) ) { |
|
881 | + if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS[ 'wp_filesystem' ] ) ) { |
|
882 | 882 | return $source; |
883 | 883 | } |
884 | 884 | |
885 | 885 | // Check for single file plugins. |
886 | - $source_files = array_keys( $GLOBALS['wp_filesystem']->dirlist( $remote_source ) ); |
|
887 | - if ( 1 === count( $source_files ) && false === $GLOBALS['wp_filesystem']->is_dir( $source ) ) { |
|
886 | + $source_files = array_keys( $GLOBALS[ 'wp_filesystem' ]->dirlist( $remote_source ) ); |
|
887 | + if ( 1 === count( $source_files ) && false === $GLOBALS[ 'wp_filesystem' ]->is_dir( $source ) ) { |
|
888 | 888 | return $source; |
889 | 889 | } |
890 | 890 | |
@@ -892,12 +892,12 @@ discard block |
||
892 | 892 | $desired_slug = ''; |
893 | 893 | |
894 | 894 | // Figure out what the slug is supposed to be. |
895 | - if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options['extra']['slug'] ) ) { |
|
896 | - $desired_slug = $upgrader->skin->options['extra']['slug']; |
|
895 | + if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options[ 'extra' ][ 'slug' ] ) ) { |
|
896 | + $desired_slug = $upgrader->skin->options[ 'extra' ][ 'slug' ]; |
|
897 | 897 | } else { |
898 | 898 | // Bulk installer contains less info, so fall back on the info registered here. |
899 | 899 | foreach ( $this->plugins as $slug => $plugin ) { |
900 | - if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
|
900 | + if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin[ 'name' ] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
|
901 | 901 | $desired_slug = $slug; |
902 | 902 | break; |
903 | 903 | } |
@@ -910,15 +910,15 @@ discard block |
||
910 | 910 | |
911 | 911 | if ( ! empty( $subdir_name ) && $subdir_name !== $desired_slug ) { |
912 | 912 | $from = untrailingslashit( $source ); |
913 | - $to = trailingslashit( $remote_source ) . $desired_slug; |
|
913 | + $to = trailingslashit( $remote_source ).$desired_slug; |
|
914 | 914 | |
915 | - if ( true === $GLOBALS['wp_filesystem']->move( $from, $to ) ) { |
|
915 | + if ( true === $GLOBALS[ 'wp_filesystem' ]->move( $from, $to ) ) { |
|
916 | 916 | return trailingslashit( $to ); |
917 | 917 | } else { |
918 | - 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 ) ); |
|
918 | + 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 ) ); |
|
919 | 919 | } |
920 | 920 | } elseif ( empty( $subdir_name ) ) { |
921 | - 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 ) ); |
|
921 | + 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 ) ); |
|
922 | 922 | } |
923 | 923 | } |
924 | 924 | |
@@ -942,19 +942,19 @@ discard block |
||
942 | 942 | |
943 | 943 | if ( is_wp_error( $activate ) ) { |
944 | 944 | echo '<div id="message" class="error"><p>', wp_kses_post( $activate->get_error_message() ), '</p></div>', |
945 | - '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; |
|
945 | + '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings[ 'return' ] ), '</a></p>'; |
|
946 | 946 | |
947 | 947 | return false; // End it here if there is an error with activation. |
948 | 948 | } else { |
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. |
|
953 | - echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>'; |
|
952 | + if ( ! isset( $_POST[ 'action' ] ) ) { // WPCS: CSRF OK. |
|
953 | + echo '<div id="message" class="updated"><p>', esc_html( $this->strings[ 'activated_successfully' ] ), ' <strong>', esc_html( $this->plugins[ $slug ][ 'name' ] ), '.</strong></p></div>'; |
|
954 | 954 | } |
955 | 955 | } else { |
956 | 956 | // Simpler message layout for use on the plugin install page. |
957 | - echo '<p>', esc_html( $this->strings['plugin_activated'] ), '</p>'; |
|
957 | + echo '<p>', esc_html( $this->strings[ 'plugin_activated' ] ), '</p>'; |
|
958 | 958 | } |
959 | 959 | } |
960 | 960 | } elseif ( $this->is_plugin_active( $slug ) ) { |
@@ -962,25 +962,25 @@ discard block |
||
962 | 962 | // on the plugin install page. |
963 | 963 | echo '<div id="message" class="error"><p>', |
964 | 964 | sprintf( |
965 | - esc_html( $this->strings['plugin_already_active'] ), |
|
966 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
965 | + esc_html( $this->strings[ 'plugin_already_active' ] ), |
|
966 | + '<strong>'.esc_html( $this->plugins[ $slug ][ 'name' ] ).'</strong>' |
|
967 | 967 | ), |
968 | 968 | '</p></div>'; |
969 | 969 | } elseif ( $this->does_plugin_require_update( $slug ) ) { |
970 | 970 | if ( ! $automatic ) { |
971 | 971 | // Make sure message doesn't display again if bulk activation is performed |
972 | 972 | // immediately after a single activation. |
973 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
973 | + if ( ! isset( $_POST[ 'action' ] ) ) { // WPCS: CSRF OK. |
|
974 | 974 | echo '<div id="message" class="error"><p>', |
975 | 975 | sprintf( |
976 | - esc_html( $this->strings['plugin_needs_higher_version'] ), |
|
977 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
976 | + esc_html( $this->strings[ 'plugin_needs_higher_version' ] ), |
|
977 | + '<strong>'.esc_html( $this->plugins[ $slug ][ 'name' ] ).'</strong>' |
|
978 | 978 | ), |
979 | 979 | '</p></div>'; |
980 | 980 | } |
981 | 981 | } else { |
982 | 982 | // Simpler message layout for use on the plugin install page. |
983 | - echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>'; |
|
983 | + echo '<p>', sprintf( esc_html( $this->strings[ 'plugin_needs_higher_version' ] ), esc_html( $this->plugins[ $slug ][ 'name' ] ) ), '</p>'; |
|
984 | 984 | } |
985 | 985 | } |
986 | 986 | |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | */ |
1005 | 1005 | public function notices() { |
1006 | 1006 | // Remove nag on the install page / Return early if the nag message has been dismissed or user < author. |
1007 | - if ( $this->is_tgmpa_page() || get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) || ! current_user_can( apply_filters( 'tgmpa_show_admin_notice_capability', 'publish_posts' ) ) ) { |
|
1007 | + if ( $this->is_tgmpa_page() || get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, true ) || ! current_user_can( apply_filters( 'tgmpa_show_admin_notice_capability', 'publish_posts' ) ) ) { |
|
1008 | 1008 | return; |
1009 | 1009 | } |
1010 | 1010 | |
@@ -1026,13 +1026,13 @@ discard block |
||
1026 | 1026 | if ( current_user_can( 'install_plugins' ) ) { |
1027 | 1027 | $install_link_count++; |
1028 | 1028 | |
1029 | - if ( true === $plugin['required'] ) { |
|
1030 | - $message['notice_can_install_required'][] = $slug; |
|
1029 | + if ( true === $plugin[ 'required' ] ) { |
|
1030 | + $message[ 'notice_can_install_required' ][ ] = $slug; |
|
1031 | 1031 | } else { |
1032 | - $message['notice_can_install_recommended'][] = $slug; |
|
1032 | + $message[ 'notice_can_install_recommended' ][ ] = $slug; |
|
1033 | 1033 | } |
1034 | 1034 | } |
1035 | - if ( true === $plugin['required'] ) { |
|
1035 | + if ( true === $plugin[ 'required' ] ) { |
|
1036 | 1036 | $total_required_action_count++; |
1037 | 1037 | } |
1038 | 1038 | } else { |
@@ -1040,13 +1040,13 @@ discard block |
||
1040 | 1040 | if ( current_user_can( 'activate_plugins' ) ) { |
1041 | 1041 | $activate_link_count++; |
1042 | 1042 | |
1043 | - if ( true === $plugin['required'] ) { |
|
1044 | - $message['notice_can_activate_required'][] = $slug; |
|
1043 | + if ( true === $plugin[ 'required' ] ) { |
|
1044 | + $message[ 'notice_can_activate_required' ][ ] = $slug; |
|
1045 | 1045 | } else { |
1046 | - $message['notice_can_activate_recommended'][] = $slug; |
|
1046 | + $message[ 'notice_can_activate_recommended' ][ ] = $slug; |
|
1047 | 1047 | } |
1048 | 1048 | } |
1049 | - if ( true === $plugin['required'] ) { |
|
1049 | + if ( true === $plugin[ 'required' ] ) { |
|
1050 | 1050 | $total_required_action_count++; |
1051 | 1051 | } |
1052 | 1052 | } |
@@ -1057,12 +1057,12 @@ discard block |
||
1057 | 1057 | $update_link_count++; |
1058 | 1058 | |
1059 | 1059 | if ( $this->does_plugin_require_update( $slug ) ) { |
1060 | - $message['notice_ask_to_update'][] = $slug; |
|
1060 | + $message[ 'notice_ask_to_update' ][ ] = $slug; |
|
1061 | 1061 | } elseif ( false !== $this->does_plugin_have_update( $slug ) ) { |
1062 | - $message['notice_ask_to_update_maybe'][] = $slug; |
|
1062 | + $message[ 'notice_ask_to_update_maybe' ][ ] = $slug; |
|
1063 | 1063 | } |
1064 | 1064 | } |
1065 | - if ( true === $plugin['required'] ) { |
|
1065 | + if ( true === $plugin[ 'required' ] ) { |
|
1066 | 1066 | $total_required_action_count++; |
1067 | 1067 | } |
1068 | 1068 | } |
@@ -1077,10 +1077,10 @@ discard block |
||
1077 | 1077 | |
1078 | 1078 | // As add_settings_error() wraps the final message in a <p> and as the final message can't be |
1079 | 1079 | // filtered, using <p>'s in our html would render invalid html output. |
1080 | - $line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>' . "\n"; |
|
1080 | + $line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>'."\n"; |
|
1081 | 1081 | |
1082 | 1082 | if ( ! current_user_can( 'activate_plugins' ) && ! current_user_can( 'install_plugins' ) && ! current_user_can( 'update_plugins' ) ) { |
1083 | - $rendered = esc_html__( $this->strings['notice_cannot_install_activate'] ) . ' ' . esc_html__( $this->strings['contact_admin'] ); |
|
1083 | + $rendered = esc_html__( $this->strings[ 'notice_cannot_install_activate' ] ).' '.esc_html__( $this->strings[ 'contact_admin' ] ); |
|
1084 | 1084 | $rendered .= $this->create_user_action_links_for_notice( 0, 0, 0, $line_template ); |
1085 | 1085 | } else { |
1086 | 1086 | |
@@ -1095,14 +1095,14 @@ discard block |
||
1095 | 1095 | |
1096 | 1096 | // Get the external info link for a plugin if one is available. |
1097 | 1097 | foreach ( $plugin_group as $plugin_slug ) { |
1098 | - $linked_plugins[] = $this->get_info_link( $plugin_slug ); |
|
1098 | + $linked_plugins[ ] = $this->get_info_link( $plugin_slug ); |
|
1099 | 1099 | } |
1100 | 1100 | unset( $plugin_slug ); |
1101 | 1101 | |
1102 | 1102 | $count = count( $plugin_group ); |
1103 | 1103 | $linked_plugins = array_map( array( 'TGMPA_Utils', 'wrap_in_em' ), $linked_plugins ); |
1104 | 1104 | $last_plugin = array_pop( $linked_plugins ); // Pop off last name to prep for readability. |
1105 | - $imploded = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
1105 | + $imploded = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); |
|
1106 | 1106 | |
1107 | 1107 | $rendered .= sprintf( |
1108 | 1108 | $line_template, |
@@ -1124,7 +1124,7 @@ discard block |
||
1124 | 1124 | } |
1125 | 1125 | |
1126 | 1126 | // Admin options pages already output settings_errors, so this is to avoid duplication. |
1127 | - if ( 'options-general' !== $GLOBALS['current_screen']->parent_base ) { |
|
1127 | + if ( 'options-general' !== $GLOBALS[ 'current_screen' ]->parent_base ) { |
|
1128 | 1128 | $this->display_settings_errors(); |
1129 | 1129 | } |
1130 | 1130 | } |
@@ -1146,32 +1146,32 @@ discard block |
||
1146 | 1146 | 'install' => '', |
1147 | 1147 | 'update' => '', |
1148 | 1148 | 'activate' => '', |
1149 | - '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>' : '', |
|
1149 | + '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>' : '', |
|
1150 | 1150 | ); |
1151 | 1151 | |
1152 | 1152 | $link_template = '<a href="%2$s">%1$s</a>'; |
1153 | 1153 | |
1154 | 1154 | if ( current_user_can( 'install_plugins' ) ) { |
1155 | 1155 | if ( $install_count > 0 ) { |
1156 | - $action_links['install'] = sprintf( |
|
1156 | + $action_links[ 'install' ] = sprintf( |
|
1157 | 1157 | $link_template, |
1158 | - translate_nooped_plural( $this->strings['install_link'], $install_count, 'tgmpa' ), |
|
1158 | + translate_nooped_plural( $this->strings[ 'install_link' ], $install_count, 'tgmpa' ), |
|
1159 | 1159 | esc_url( $this->get_tgmpa_status_url( 'install' ) ) |
1160 | 1160 | ); |
1161 | 1161 | } |
1162 | 1162 | if ( $update_count > 0 ) { |
1163 | - $action_links['update'] = sprintf( |
|
1163 | + $action_links[ 'update' ] = sprintf( |
|
1164 | 1164 | $link_template, |
1165 | - translate_nooped_plural( $this->strings['update_link'], $update_count, 'tgmpa' ), |
|
1165 | + translate_nooped_plural( $this->strings[ 'update_link' ], $update_count, 'tgmpa' ), |
|
1166 | 1166 | esc_url( $this->get_tgmpa_status_url( 'update' ) ) |
1167 | 1167 | ); |
1168 | 1168 | } |
1169 | 1169 | } |
1170 | 1170 | |
1171 | 1171 | if ( current_user_can( 'activate_plugins' ) && $activate_count > 0 ) { |
1172 | - $action_links['activate'] = sprintf( |
|
1172 | + $action_links[ 'activate' ] = sprintf( |
|
1173 | 1173 | $link_template, |
1174 | - translate_nooped_plural( $this->strings['activate_link'], $activate_count, 'tgmpa' ), |
|
1174 | + translate_nooped_plural( $this->strings[ 'activate_link' ], $activate_count, 'tgmpa' ), |
|
1175 | 1175 | esc_url( $this->get_tgmpa_status_url( 'activate' ) ) |
1176 | 1176 | ); |
1177 | 1177 | } |
@@ -1199,8 +1199,8 @@ discard block |
||
1199 | 1199 | * @return string |
1200 | 1200 | */ |
1201 | 1201 | protected function get_admin_notice_class() { |
1202 | - if ( ! empty( $this->strings['nag_type'] ) ) { |
|
1203 | - return sanitize_html_class( strtolower( $this->strings['nag_type'] ) ); |
|
1202 | + if ( ! empty( $this->strings[ 'nag_type' ] ) ) { |
|
1203 | + return sanitize_html_class( strtolower( $this->strings[ 'nag_type' ] ) ); |
|
1204 | 1204 | } else { |
1205 | 1205 | if ( version_compare( $this->wp_version, '4.2', '>=' ) ) { |
1206 | 1206 | return 'notice-warning'; |
@@ -1223,7 +1223,7 @@ discard block |
||
1223 | 1223 | settings_errors( 'tgmpa' ); |
1224 | 1224 | |
1225 | 1225 | foreach ( (array) $wp_settings_errors as $key => $details ) { |
1226 | - if ( 'tgmpa' === $details['setting'] ) { |
|
1226 | + if ( 'tgmpa' === $details[ 'setting' ] ) { |
|
1227 | 1227 | unset( $wp_settings_errors[ $key ] ); |
1228 | 1228 | break; |
1229 | 1229 | } |
@@ -1238,8 +1238,8 @@ discard block |
||
1238 | 1238 | * @since 2.1.0 |
1239 | 1239 | */ |
1240 | 1240 | public function dismiss() { |
1241 | - if ( isset( $_GET['tgmpa-dismiss'] ) && check_admin_referer( 'tgmpa-dismis-' . get_current_user_id() ) ) { |
|
1242 | - update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, 1 ); |
|
1241 | + if ( isset( $_GET[ 'tgmpa-dismiss' ] ) && check_admin_referer( 'tgmpa-dismis-'.get_current_user_id() ) ) { |
|
1242 | + update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, 1 ); |
|
1243 | 1243 | } |
1244 | 1244 | } |
1245 | 1245 | |
@@ -1255,54 +1255,54 @@ discard block |
||
1255 | 1255 | * @return null Return early if incorrect argument. |
1256 | 1256 | */ |
1257 | 1257 | public function register( $plugin ) { |
1258 | - if ( empty( $plugin['slug'] ) || empty( $plugin['name'] ) ) { |
|
1258 | + if ( empty( $plugin[ 'slug' ] ) || empty( $plugin[ 'name' ] ) ) { |
|
1259 | 1259 | return; |
1260 | 1260 | } |
1261 | 1261 | |
1262 | - if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) { |
|
1262 | + if ( empty( $plugin[ 'slug' ] ) || ! is_string( $plugin[ 'slug' ] ) || isset( $this->plugins[ $plugin[ 'slug' ] ] ) ) { |
|
1263 | 1263 | return; |
1264 | 1264 | } |
1265 | 1265 | |
1266 | 1266 | $defaults = array( |
1267 | - 'name' => '', // String |
|
1268 | - 'slug' => '', // String |
|
1269 | - 'source' => 'repo', // String |
|
1270 | - 'required' => false, // Boolean |
|
1271 | - 'version' => '', // String |
|
1272 | - 'force_activation' => false, // Boolean |
|
1273 | - 'force_deactivation' => false, // Boolean |
|
1274 | - 'external_url' => '', // String |
|
1275 | - 'is_callable' => '', // String|Array. |
|
1267 | + 'name' => '', // String |
|
1268 | + 'slug' => '', // String |
|
1269 | + 'source' => 'repo', // String |
|
1270 | + 'required' => false, // Boolean |
|
1271 | + 'version' => '', // String |
|
1272 | + 'force_activation' => false, // Boolean |
|
1273 | + 'force_deactivation' => false, // Boolean |
|
1274 | + 'external_url' => '', // String |
|
1275 | + 'is_callable' => '', // String|Array. |
|
1276 | 1276 | ); |
1277 | 1277 | |
1278 | 1278 | // Prepare the received data. |
1279 | 1279 | $plugin = wp_parse_args( $plugin, $defaults ); |
1280 | 1280 | |
1281 | 1281 | // Standardize the received slug. |
1282 | - $plugin['slug'] = $this->sanitize_key( $plugin['slug'] ); |
|
1282 | + $plugin[ 'slug' ] = $this->sanitize_key( $plugin[ 'slug' ] ); |
|
1283 | 1283 | |
1284 | 1284 | // Forgive users for using string versions of booleans or floats for version number. |
1285 | - $plugin['version'] = (string) $plugin['version']; |
|
1286 | - $plugin['source'] = empty( $plugin['source'] ) ? 'repo' : $plugin['source']; |
|
1287 | - $plugin['required'] = TGMPA_Utils::validate_bool( $plugin['required'] ); |
|
1288 | - $plugin['force_activation'] = TGMPA_Utils::validate_bool( $plugin['force_activation'] ); |
|
1289 | - $plugin['force_deactivation'] = TGMPA_Utils::validate_bool( $plugin['force_deactivation'] ); |
|
1285 | + $plugin[ 'version' ] = (string) $plugin[ 'version' ]; |
|
1286 | + $plugin[ 'source' ] = empty( $plugin[ 'source' ] ) ? 'repo' : $plugin[ 'source' ]; |
|
1287 | + $plugin[ 'required' ] = TGMPA_Utils::validate_bool( $plugin[ 'required' ] ); |
|
1288 | + $plugin[ 'force_activation' ] = TGMPA_Utils::validate_bool( $plugin[ 'force_activation' ] ); |
|
1289 | + $plugin[ 'force_deactivation' ] = TGMPA_Utils::validate_bool( $plugin[ 'force_deactivation' ] ); |
|
1290 | 1290 | |
1291 | 1291 | // Enrich the received data. |
1292 | - $plugin['file_path'] = $this->_get_plugin_basename_from_slug( $plugin['slug'] ); |
|
1293 | - $plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] ); |
|
1292 | + $plugin[ 'file_path' ] = $this->_get_plugin_basename_from_slug( $plugin[ 'slug' ] ); |
|
1293 | + $plugin[ 'source_type' ] = $this->get_plugin_source_type( $plugin[ 'source' ] ); |
|
1294 | 1294 | |
1295 | 1295 | // Set the class properties. |
1296 | - $this->plugins[ $plugin['slug'] ] = $plugin; |
|
1297 | - $this->sort_order[ $plugin['slug'] ] = $plugin['name']; |
|
1296 | + $this->plugins[ $plugin[ 'slug' ] ] = $plugin; |
|
1297 | + $this->sort_order[ $plugin[ 'slug' ] ] = $plugin[ 'name' ]; |
|
1298 | 1298 | |
1299 | 1299 | // Should we add the force activation hook ? |
1300 | - if ( true === $plugin['force_activation'] ) { |
|
1300 | + if ( true === $plugin[ 'force_activation' ] ) { |
|
1301 | 1301 | $this->has_forced_activation = true; |
1302 | 1302 | } |
1303 | 1303 | |
1304 | 1304 | // Should we add the force deactivation hook ? |
1305 | - if ( true === $plugin['force_deactivation'] ) { |
|
1305 | + if ( true === $plugin[ 'force_deactivation' ] ) { |
|
1306 | 1306 | $this->has_forced_deactivation = true; |
1307 | 1307 | } |
1308 | 1308 | } |
@@ -1428,11 +1428,11 @@ discard block |
||
1428 | 1428 | */ |
1429 | 1429 | public function populate_file_path( $plugin_slug = '' ) { |
1430 | 1430 | if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) { |
1431 | - $this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
1431 | + $this->plugins[ $plugin_slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
1432 | 1432 | } else { |
1433 | 1433 | // Add file_path key for all plugins. |
1434 | 1434 | foreach ( $this->plugins as $slug => $values ) { |
1435 | - $this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug ); |
|
1435 | + $this->plugins[ $slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $slug ); |
|
1436 | 1436 | } |
1437 | 1437 | } |
1438 | 1438 | } |
@@ -1450,7 +1450,7 @@ discard block |
||
1450 | 1450 | $keys = array_keys( $this->get_plugins() ); |
1451 | 1451 | |
1452 | 1452 | foreach ( $keys as $key ) { |
1453 | - if ( preg_match( '|^' . $slug . '/|', $key ) ) { |
|
1453 | + if ( preg_match( '|^'.$slug.'/|', $key ) ) { |
|
1454 | 1454 | return $key; |
1455 | 1455 | } |
1456 | 1456 | } |
@@ -1472,7 +1472,7 @@ discard block |
||
1472 | 1472 | */ |
1473 | 1473 | public function _get_plugin_data_from_name( $name, $data = 'slug' ) { |
1474 | 1474 | foreach ( $this->plugins as $values ) { |
1475 | - if ( $name === $values['name'] && isset( $values[ $data ] ) ) { |
|
1475 | + if ( $name === $values[ 'name' ] && isset( $values[ $data ] ) ) { |
|
1476 | 1476 | return $values[ $data ]; |
1477 | 1477 | } |
1478 | 1478 | } |
@@ -1491,13 +1491,13 @@ discard block |
||
1491 | 1491 | public function get_download_url( $slug ) { |
1492 | 1492 | $dl_source = ''; |
1493 | 1493 | |
1494 | - switch ( $this->plugins[ $slug ]['source_type'] ) { |
|
1494 | + switch ( $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1495 | 1495 | case 'repo': |
1496 | 1496 | return $this->get_wp_repo_download_url( $slug ); |
1497 | 1497 | case 'external': |
1498 | - return $this->plugins[ $slug ]['source']; |
|
1498 | + return $this->plugins[ $slug ][ 'source' ]; |
|
1499 | 1499 | case 'bundled': |
1500 | - return $this->default_path . $this->plugins[ $slug ]['source']; |
|
1500 | + return $this->default_path.$this->plugins[ $slug ][ 'source' ]; |
|
1501 | 1501 | } |
1502 | 1502 | |
1503 | 1503 | return $dl_source; // Should never happen. |
@@ -1535,7 +1535,7 @@ discard block |
||
1535 | 1535 | |
1536 | 1536 | if ( ! isset( $api[ $slug ] ) ) { |
1537 | 1537 | if ( ! function_exists( 'plugins_api' ) ) { |
1538 | - require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
|
1538 | + require_once ABSPATH.'wp-admin/includes/plugin-install.php'; |
|
1539 | 1539 | } |
1540 | 1540 | |
1541 | 1541 | $response = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ) ) ); |
@@ -1543,7 +1543,7 @@ discard block |
||
1543 | 1543 | $api[ $slug ] = false; |
1544 | 1544 | |
1545 | 1545 | if ( is_wp_error( $response ) ) { |
1546 | - wp_die( esc_html( $this->strings['oops'] ) ); |
|
1546 | + wp_die( esc_html( $this->strings[ 'oops' ] ) ); |
|
1547 | 1547 | } else { |
1548 | 1548 | $api[ $slug ] = $response; |
1549 | 1549 | } |
@@ -1562,13 +1562,13 @@ discard block |
||
1562 | 1562 | * or the plugin name if not. |
1563 | 1563 | */ |
1564 | 1564 | public function get_info_link( $slug ) { |
1565 | - if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) { |
|
1565 | + if ( ! empty( $this->plugins[ $slug ][ 'external_url' ] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ][ 'external_url' ] ) ) { |
|
1566 | 1566 | $link = sprintf( |
1567 | 1567 | '<a href="%1$s" target="_blank">%2$s</a>', |
1568 | - esc_url( $this->plugins[ $slug ]['external_url'] ), |
|
1569 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
1568 | + esc_url( $this->plugins[ $slug ][ 'external_url' ] ), |
|
1569 | + esc_html( $this->plugins[ $slug ][ 'name' ] ) |
|
1570 | 1570 | ); |
1571 | - } elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) { |
|
1571 | + } elseif ( 'repo' === $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1572 | 1572 | $url = add_query_arg( |
1573 | 1573 | array( |
1574 | 1574 | 'tab' => 'plugin-information', |
@@ -1583,10 +1583,10 @@ discard block |
||
1583 | 1583 | $link = sprintf( |
1584 | 1584 | '<a href="%1$s" class="thickbox">%2$s</a>', |
1585 | 1585 | esc_url( $url ), |
1586 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
1586 | + esc_html( $this->plugins[ $slug ][ 'name' ] ) |
|
1587 | 1587 | ); |
1588 | 1588 | } else { |
1589 | - $link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink. |
|
1589 | + $link = esc_html( $this->plugins[ $slug ][ 'name' ] ); // No hyperlink. |
|
1590 | 1590 | } |
1591 | 1591 | |
1592 | 1592 | return $link; |
@@ -1600,7 +1600,7 @@ discard block |
||
1600 | 1600 | * @return boolean True when on the TGMPA page, false otherwise. |
1601 | 1601 | */ |
1602 | 1602 | protected function is_tgmpa_page() { |
1603 | - return isset( $_GET['page'] ) && $this->menu === $_GET['page']; |
|
1603 | + return isset( $_GET[ 'page' ] ) && $this->menu === $_GET[ 'page' ]; |
|
1604 | 1604 | } |
1605 | 1605 | |
1606 | 1606 | /** |
@@ -1682,7 +1682,7 @@ discard block |
||
1682 | 1682 | public function is_plugin_installed( $slug ) { |
1683 | 1683 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
1684 | 1684 | |
1685 | - return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) ); |
|
1685 | + return ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ] ) ); |
|
1686 | 1686 | } |
1687 | 1687 | |
1688 | 1688 | /** |
@@ -1694,7 +1694,7 @@ discard block |
||
1694 | 1694 | * @return bool True if active, false otherwise. |
1695 | 1695 | */ |
1696 | 1696 | public function is_plugin_active( $slug ) { |
1697 | - return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) ); |
|
1697 | + return ( ( ! empty( $this->plugins[ $slug ][ 'is_callable' ] ) && is_callable( $this->plugins[ $slug ][ 'is_callable' ] ) ) || is_plugin_active( $this->plugins[ $slug ][ 'file_path' ] ) ); |
|
1698 | 1698 | } |
1699 | 1699 | |
1700 | 1700 | /** |
@@ -1708,7 +1708,7 @@ discard block |
||
1708 | 1708 | */ |
1709 | 1709 | public function can_plugin_update( $slug ) { |
1710 | 1710 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
1711 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1711 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1712 | 1712 | return true; |
1713 | 1713 | } |
1714 | 1714 | |
@@ -1764,8 +1764,8 @@ discard block |
||
1764 | 1764 | public function get_installed_version( $slug ) { |
1765 | 1765 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
1766 | 1766 | |
1767 | - if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) { |
|
1768 | - return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version']; |
|
1767 | + if ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ] ) ) { |
|
1768 | + return $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ]; |
|
1769 | 1769 | } |
1770 | 1770 | |
1771 | 1771 | return ''; |
@@ -1781,7 +1781,7 @@ discard block |
||
1781 | 1781 | */ |
1782 | 1782 | public function does_plugin_require_update( $slug ) { |
1783 | 1783 | $installed_version = $this->get_installed_version( $slug ); |
1784 | - $minimum_version = $this->plugins[ $slug ]['version']; |
|
1784 | + $minimum_version = $this->plugins[ $slug ][ 'version' ]; |
|
1785 | 1785 | |
1786 | 1786 | return version_compare( $minimum_version, $installed_version, '>' ); |
1787 | 1787 | } |
@@ -1796,9 +1796,9 @@ discard block |
||
1796 | 1796 | */ |
1797 | 1797 | public function does_plugin_have_update( $slug ) { |
1798 | 1798 | // Presume bundled and external plugins will point to a package which meets the minimum required version. |
1799 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1799 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1800 | 1800 | if ( $this->does_plugin_require_update( $slug ) ) { |
1801 | - return $this->plugins[ $slug ]['version']; |
|
1801 | + return $this->plugins[ $slug ][ 'version' ]; |
|
1802 | 1802 | } |
1803 | 1803 | |
1804 | 1804 | return false; |
@@ -1806,8 +1806,8 @@ discard block |
||
1806 | 1806 | |
1807 | 1807 | $repo_updates = get_site_transient( 'update_plugins' ); |
1808 | 1808 | |
1809 | - if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) { |
|
1810 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version; |
|
1809 | + if ( isset( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version ) ) { |
|
1810 | + return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version; |
|
1811 | 1811 | } |
1812 | 1812 | |
1813 | 1813 | return false; |
@@ -1823,14 +1823,14 @@ discard block |
||
1823 | 1823 | */ |
1824 | 1824 | public function get_upgrade_notice( $slug ) { |
1825 | 1825 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
1826 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1826 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1827 | 1827 | return ''; |
1828 | 1828 | } |
1829 | 1829 | |
1830 | 1830 | $repo_updates = get_site_transient( 'update_plugins' ); |
1831 | 1831 | |
1832 | - if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) { |
|
1833 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice; |
|
1832 | + if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice ) ) { |
|
1833 | + return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice; |
|
1834 | 1834 | } |
1835 | 1835 | |
1836 | 1836 | return ''; |
@@ -1846,7 +1846,7 @@ discard block |
||
1846 | 1846 | */ |
1847 | 1847 | public function get_plugins( $plugin_folder = '' ) { |
1848 | 1848 | if ( ! function_exists( 'get_plugins' ) ) { |
1849 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
1849 | + require_once ABSPATH.'wp-admin/includes/plugin.php'; |
|
1850 | 1850 | } |
1851 | 1851 | |
1852 | 1852 | return get_plugins( $plugin_folder ); |
@@ -1861,7 +1861,7 @@ discard block |
||
1861 | 1861 | * @since 2.1.1 |
1862 | 1862 | */ |
1863 | 1863 | public function update_dismiss() { |
1864 | - delete_metadata( 'user', null, 'tgmpa_dismissed_notice_' . $this->id, null, true ); |
|
1864 | + delete_metadata( 'user', null, 'tgmpa_dismissed_notice_'.$this->id, null, true ); |
|
1865 | 1865 | } |
1866 | 1866 | |
1867 | 1867 | /** |
@@ -1880,13 +1880,13 @@ discard block |
||
1880 | 1880 | */ |
1881 | 1881 | public function force_activation() { |
1882 | 1882 | foreach ( $this->plugins as $slug => $plugin ) { |
1883 | - if ( true === $plugin['force_activation'] ) { |
|
1883 | + if ( true === $plugin[ 'force_activation' ] ) { |
|
1884 | 1884 | if ( ! $this->is_plugin_installed( $slug ) ) { |
1885 | 1885 | // Oops, plugin isn't there so iterate to next condition. |
1886 | 1886 | continue; |
1887 | 1887 | } elseif ( $this->can_plugin_activate( $slug ) ) { |
1888 | 1888 | // There we go, activate the plugin. |
1889 | - activate_plugin( $plugin['file_path'] ); |
|
1889 | + activate_plugin( $plugin[ 'file_path' ] ); |
|
1890 | 1890 | } |
1891 | 1891 | } |
1892 | 1892 | } |
@@ -1907,8 +1907,8 @@ discard block |
||
1907 | 1907 | public function force_deactivation() { |
1908 | 1908 | foreach ( $this->plugins as $slug => $plugin ) { |
1909 | 1909 | // Only proceed forward if the parameter is set to true and plugin is active. |
1910 | - if ( true === $plugin['force_deactivation'] && $this->is_plugin_active( $slug ) ) { |
|
1911 | - deactivate_plugins( $plugin['file_path'] ); |
|
1910 | + if ( true === $plugin[ 'force_deactivation' ] && $this->is_plugin_active( $slug ) ) { |
|
1911 | + deactivate_plugins( $plugin[ 'file_path' ] ); |
|
1912 | 1912 | } |
1913 | 1913 | } |
1914 | 1914 | } |
@@ -1943,7 +1943,7 @@ discard block |
||
1943 | 1943 | * Ensure only one instance of the class is ever invoked. |
1944 | 1944 | */ |
1945 | 1945 | function load_tgm_plugin_activation() { |
1946 | - $GLOBALS['tgmpa'] = TGM_Plugin_Activation::get_instance(); |
|
1946 | + $GLOBALS[ 'tgmpa' ] = TGM_Plugin_Activation::get_instance(); |
|
1947 | 1947 | } |
1948 | 1948 | } |
1949 | 1949 | |
@@ -1965,7 +1965,7 @@ discard block |
||
1965 | 1965 | * @param array $config Optional. An array of configuration values. |
1966 | 1966 | */ |
1967 | 1967 | function tgmpa( $plugins, $config = array() ) { |
1968 | - $instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
1968 | + $instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
1969 | 1969 | |
1970 | 1970 | foreach ( $plugins as $plugin ) { |
1971 | 1971 | call_user_func( array( $instance, 'register' ), $plugin ); |
@@ -1973,17 +1973,17 @@ discard block |
||
1973 | 1973 | |
1974 | 1974 | if ( ! empty( $config ) && is_array( $config ) ) { |
1975 | 1975 | // Send out notices for deprecated arguments passed. |
1976 | - if ( isset( $config['notices'] ) ) { |
|
1976 | + if ( isset( $config[ 'notices' ] ) ) { |
|
1977 | 1977 | _deprecated_argument( __FUNCTION__, '2.2.0', 'The `notices` config parameter was renamed to `has_notices` in TGMPA 2.2.0. Please adjust your configuration.' ); |
1978 | - if ( ! isset( $config['has_notices'] ) ) { |
|
1979 | - $config['has_notices'] = $config['notices']; |
|
1978 | + if ( ! isset( $config[ 'has_notices' ] ) ) { |
|
1979 | + $config[ 'has_notices' ] = $config[ 'notices' ]; |
|
1980 | 1980 | } |
1981 | 1981 | } |
1982 | 1982 | |
1983 | - if ( isset( $config['parent_menu_slug'] ) ) { |
|
1983 | + if ( isset( $config[ 'parent_menu_slug' ] ) ) { |
|
1984 | 1984 | _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.' ); |
1985 | 1985 | } |
1986 | - if ( isset( $config['parent_url_slug'] ) ) { |
|
1986 | + if ( isset( $config[ 'parent_url_slug' ] ) ) { |
|
1987 | 1987 | _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.' ); |
1988 | 1988 | } |
1989 | 1989 | |
@@ -1999,7 +1999,7 @@ discard block |
||
1999 | 1999 | * @since 2.2.0 |
2000 | 2000 | */ |
2001 | 2001 | if ( ! class_exists( 'WP_List_Table' ) ) { |
2002 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
2002 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
2003 | 2003 | } |
2004 | 2004 | |
2005 | 2005 | if ( ! class_exists( 'TGMPA_List_Table' ) ) { |
@@ -2060,7 +2060,7 @@ discard block |
||
2060 | 2060 | * @since 2.2.0 |
2061 | 2061 | */ |
2062 | 2062 | public function __construct() { |
2063 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
2063 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
2064 | 2064 | |
2065 | 2065 | parent::__construct( |
2066 | 2066 | array( |
@@ -2070,8 +2070,8 @@ discard block |
||
2070 | 2070 | ) |
2071 | 2071 | ); |
2072 | 2072 | |
2073 | - if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'install', 'update', 'activate' ), true ) ) { |
|
2074 | - $this->view_context = sanitize_key( $_REQUEST['plugin_status'] ); |
|
2073 | + if ( isset( $_REQUEST[ 'plugin_status' ] ) && in_array( $_REQUEST[ 'plugin_status' ], array( 'install', 'update', 'activate' ), true ) ) { |
|
2074 | + $this->view_context = sanitize_key( $_REQUEST[ 'plugin_status' ] ); |
|
2075 | 2075 | } |
2076 | 2076 | |
2077 | 2077 | add_filter( 'tgmpa_table_data_items', array( $this, 'sort_table_items' ) ); |
@@ -2118,20 +2118,20 @@ discard block |
||
2118 | 2118 | } |
2119 | 2119 | |
2120 | 2120 | foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) { |
2121 | - $table_data[ $i ]['sanitized_plugin'] = $plugin['name']; |
|
2122 | - $table_data[ $i ]['slug'] = $slug; |
|
2123 | - $table_data[ $i ]['plugin'] = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>'; |
|
2124 | - $table_data[ $i ]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] ); |
|
2125 | - $table_data[ $i ]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] ); |
|
2126 | - $table_data[ $i ]['status'] = $this->get_plugin_status_text( $slug ); |
|
2127 | - $table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug ); |
|
2128 | - $table_data[ $i ]['minimum_version'] = $plugin['version']; |
|
2129 | - $table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2121 | + $table_data[ $i ][ 'sanitized_plugin' ] = $plugin[ 'name' ]; |
|
2122 | + $table_data[ $i ][ 'slug' ] = $slug; |
|
2123 | + $table_data[ $i ][ 'plugin' ] = '<strong>'.$this->tgmpa->get_info_link( $slug ).'</strong>'; |
|
2124 | + $table_data[ $i ][ 'source' ] = $this->get_plugin_source_type_text( $plugin[ 'source_type' ] ); |
|
2125 | + $table_data[ $i ][ 'type' ] = $this->get_plugin_advise_type_text( $plugin[ 'required' ] ); |
|
2126 | + $table_data[ $i ][ 'status' ] = $this->get_plugin_status_text( $slug ); |
|
2127 | + $table_data[ $i ][ 'installed_version' ] = $this->tgmpa->get_installed_version( $slug ); |
|
2128 | + $table_data[ $i ][ 'minimum_version' ] = $plugin[ 'version' ]; |
|
2129 | + $table_data[ $i ][ 'available_version' ] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2130 | 2130 | |
2131 | 2131 | // Prep the upgrade notice info. |
2132 | 2132 | $upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug ); |
2133 | 2133 | if ( ! empty( $upgrade_notice ) ) { |
2134 | - $table_data[ $i ]['upgrade_notice'] = $upgrade_notice; |
|
2134 | + $table_data[ $i ][ 'upgrade_notice' ] = $upgrade_notice; |
|
2135 | 2135 | |
2136 | 2136 | add_action( "tgmpa_after_plugin_row_$slug", array( $this, 'wp_plugin_update_row' ), 10, 2 ); |
2137 | 2137 | } |
@@ -2162,17 +2162,17 @@ discard block |
||
2162 | 2162 | // No need to display plugins if they are installed, up-to-date and active. |
2163 | 2163 | continue; |
2164 | 2164 | } else { |
2165 | - $plugins['all'][ $slug ] = $plugin; |
|
2165 | + $plugins[ 'all' ][ $slug ] = $plugin; |
|
2166 | 2166 | |
2167 | 2167 | if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) { |
2168 | - $plugins['install'][ $slug ] = $plugin; |
|
2168 | + $plugins[ 'install' ][ $slug ] = $plugin; |
|
2169 | 2169 | } else { |
2170 | 2170 | if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) { |
2171 | - $plugins['update'][ $slug ] = $plugin; |
|
2171 | + $plugins[ 'update' ][ $slug ] = $plugin; |
|
2172 | 2172 | } |
2173 | 2173 | |
2174 | 2174 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
2175 | - $plugins['activate'][ $slug ] = $plugin; |
|
2175 | + $plugins[ 'activate' ][ $slug ] = $plugin; |
|
2176 | 2176 | } |
2177 | 2177 | } |
2178 | 2178 | } |
@@ -2291,8 +2291,8 @@ discard block |
||
2291 | 2291 | $name = array(); |
2292 | 2292 | |
2293 | 2293 | foreach ( $items as $i => $plugin ) { |
2294 | - $type[ $i ] = $plugin['type']; // Required / recommended. |
|
2295 | - $name[ $i ] = $plugin['sanitized_plugin']; |
|
2294 | + $type[ $i ] = $plugin[ 'type' ]; // Required / recommended. |
|
2295 | + $name[ $i ] = $plugin[ 'sanitized_plugin' ]; |
|
2296 | 2296 | } |
2297 | 2297 | |
2298 | 2298 | array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items ); |
@@ -2374,9 +2374,9 @@ discard block |
||
2374 | 2374 | public function column_cb( $item ) { |
2375 | 2375 | return sprintf( |
2376 | 2376 | '<input type="checkbox" name="%1$s[]" value="%2$s" id="%3$s" />', |
2377 | - esc_attr( $this->_args['singular'] ), |
|
2378 | - esc_attr( $item['slug'] ), |
|
2379 | - esc_attr( $item['sanitized_plugin'] ) |
|
2377 | + esc_attr( $this->_args[ 'singular' ] ), |
|
2378 | + esc_attr( $item[ 'slug' ] ), |
|
2379 | + esc_attr( $item[ 'sanitized_plugin' ] ) |
|
2380 | 2380 | ); |
2381 | 2381 | } |
2382 | 2382 | |
@@ -2391,7 +2391,7 @@ discard block |
||
2391 | 2391 | public function column_plugin( $item ) { |
2392 | 2392 | return sprintf( |
2393 | 2393 | '%1$s %2$s', |
2394 | - $item['plugin'], |
|
2394 | + $item[ 'plugin' ], |
|
2395 | 2395 | $this->row_actions( $this->get_row_actions( $item ), true ) |
2396 | 2396 | ); |
2397 | 2397 | } |
@@ -2407,38 +2407,38 @@ discard block |
||
2407 | 2407 | public function column_version( $item ) { |
2408 | 2408 | $output = array(); |
2409 | 2409 | |
2410 | - if ( $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
2411 | - $installed = ! empty( $item['installed_version'] ) ? $item['installed_version'] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
2410 | + if ( $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
2411 | + $installed = ! empty( $item[ 'installed_version' ] ) ? $item[ 'installed_version' ] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
2412 | 2412 | |
2413 | 2413 | $color = ''; |
2414 | - if ( ! empty( $item['minimum_version'] ) && $this->tgmpa->does_plugin_require_update( $item['slug'] ) ) { |
|
2414 | + if ( ! empty( $item[ 'minimum_version' ] ) && $this->tgmpa->does_plugin_require_update( $item[ 'slug' ] ) ) { |
|
2415 | 2415 | $color = ' color: #ff0000; font-weight: bold;'; |
2416 | 2416 | } |
2417 | 2417 | |
2418 | - $output[] = sprintf( |
|
2419 | - '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Installed version:', 'tgmpa' ) . '</p>', |
|
2418 | + $output[ ] = sprintf( |
|
2419 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Installed version:', 'tgmpa' ).'</p>', |
|
2420 | 2420 | $color, |
2421 | 2421 | $installed |
2422 | 2422 | ); |
2423 | 2423 | } |
2424 | 2424 | |
2425 | - if ( ! empty( $item['minimum_version'] ) ) { |
|
2426 | - $output[] = sprintf( |
|
2427 | - '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>' . __( 'Minimum required version:', 'tgmpa' ) . '</p>', |
|
2428 | - $item['minimum_version'] |
|
2425 | + if ( ! empty( $item[ 'minimum_version' ] ) ) { |
|
2426 | + $output[ ] = sprintf( |
|
2427 | + '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>'.__( 'Minimum required version:', 'tgmpa' ).'</p>', |
|
2428 | + $item[ 'minimum_version' ] |
|
2429 | 2429 | ); |
2430 | 2430 | } |
2431 | 2431 | |
2432 | - if ( ! empty( $item['available_version'] ) ) { |
|
2432 | + if ( ! empty( $item[ 'available_version' ] ) ) { |
|
2433 | 2433 | $color = ''; |
2434 | - if ( ! empty( $item['minimum_version'] ) && version_compare( $item['available_version'], $item['minimum_version'], '>=' ) ) { |
|
2434 | + if ( ! empty( $item[ 'minimum_version' ] ) && version_compare( $item[ 'available_version' ], $item[ 'minimum_version' ], '>=' ) ) { |
|
2435 | 2435 | $color = ' color: #71C671; font-weight: bold;'; |
2436 | 2436 | } |
2437 | 2437 | |
2438 | - $output[] = sprintf( |
|
2439 | - '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Available version:', 'tgmpa' ) . '</p>', |
|
2438 | + $output[ ] = sprintf( |
|
2439 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Available version:', 'tgmpa' ).'</p>', |
|
2440 | 2440 | $color, |
2441 | - $item['available_version'] |
|
2441 | + $item[ 'available_version' ] |
|
2442 | 2442 | ); |
2443 | 2443 | } |
2444 | 2444 | |
@@ -2479,8 +2479,8 @@ discard block |
||
2479 | 2479 | ); |
2480 | 2480 | |
2481 | 2481 | if ( 'all' === $this->view_context || 'update' === $this->view_context ) { |
2482 | - $columns['version'] = __( 'Version', 'tgmpa' ); |
|
2483 | - $columns['status'] = __( 'Status', 'tgmpa' ); |
|
2482 | + $columns[ 'version' ] = __( 'Version', 'tgmpa' ); |
|
2483 | + $columns[ 'status' ] = __( 'Status', 'tgmpa' ); |
|
2484 | 2484 | } |
2485 | 2485 | |
2486 | 2486 | return apply_filters( 'tgmpa_table_columns', $columns ); |
@@ -2527,17 +2527,17 @@ discard block |
||
2527 | 2527 | $action_links = array(); |
2528 | 2528 | |
2529 | 2529 | // Display the 'Install' action link if the plugin is not yet available. |
2530 | - if ( ! $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
2531 | - $actions['install'] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2530 | + if ( ! $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
2531 | + $actions[ 'install' ] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2532 | 2532 | } else { |
2533 | 2533 | // Display the 'Update' action link if an update is available and WP complies with plugin minimum. |
2534 | - if ( false !== $this->tgmpa->does_plugin_have_update( $item['slug'] ) && $this->tgmpa->can_plugin_update( $item['slug'] ) ) { |
|
2535 | - $actions['update'] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2534 | + if ( false !== $this->tgmpa->does_plugin_have_update( $item[ 'slug' ] ) && $this->tgmpa->can_plugin_update( $item[ 'slug' ] ) ) { |
|
2535 | + $actions[ 'update' ] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2536 | 2536 | } |
2537 | 2537 | |
2538 | 2538 | // Display the 'Activate' action link, but only if the plugin meets the minimum version. |
2539 | - if ( $this->tgmpa->can_plugin_activate( $item['slug'] ) ) { |
|
2540 | - $actions['activate'] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2539 | + if ( $this->tgmpa->can_plugin_activate( $item[ 'slug' ] ) ) { |
|
2540 | + $actions[ 'activate' ] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2541 | 2541 | } |
2542 | 2542 | } |
2543 | 2543 | |
@@ -2546,24 +2546,24 @@ discard block |
||
2546 | 2546 | $nonce_url = wp_nonce_url( |
2547 | 2547 | add_query_arg( |
2548 | 2548 | array( |
2549 | - 'plugin' => urlencode( $item['slug'] ), |
|
2550 | - 'tgmpa-' . $action => $action . '-plugin', |
|
2549 | + 'plugin' => urlencode( $item[ 'slug' ] ), |
|
2550 | + 'tgmpa-'.$action => $action.'-plugin', |
|
2551 | 2551 | ), |
2552 | 2552 | $this->tgmpa->get_tgmpa_url() |
2553 | 2553 | ), |
2554 | - 'tgmpa-' . $action, |
|
2554 | + 'tgmpa-'.$action, |
|
2555 | 2555 | 'tgmpa-nonce' |
2556 | 2556 | ); |
2557 | 2557 | |
2558 | 2558 | $action_links[ $action ] = sprintf( |
2559 | - '<a href="%1$s">' . esc_html( $text ) . '</a>', |
|
2559 | + '<a href="%1$s">'.esc_html( $text ).'</a>', |
|
2560 | 2560 | esc_url( $nonce_url ), |
2561 | - '<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>' |
|
2561 | + '<span class="screen-reader-text">'.esc_html( $item[ 'sanitized_plugin' ] ).'</span>' |
|
2562 | 2562 | ); |
2563 | 2563 | } |
2564 | 2564 | |
2565 | 2565 | $prefix = ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) ? 'network_admin_' : ''; |
2566 | - return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item['slug'], $item, $this->view_context ); |
|
2566 | + return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item[ 'slug' ], $item, $this->view_context ); |
|
2567 | 2567 | } |
2568 | 2568 | |
2569 | 2569 | /** |
@@ -2584,7 +2584,7 @@ discard block |
||
2584 | 2584 | * |
2585 | 2585 | * @since 2.5.0 |
2586 | 2586 | */ |
2587 | - do_action( "tgmpa_after_plugin_row_{$item['slug']}", $item['slug'], $item, $this->view_context ); |
|
2587 | + do_action( "tgmpa_after_plugin_row_{$item[ 'slug' ]}", $item[ 'slug' ], $item, $this->view_context ); |
|
2588 | 2588 | } |
2589 | 2589 | |
2590 | 2590 | /** |
@@ -2599,7 +2599,7 @@ discard block |
||
2599 | 2599 | * @return null Return early if upgrade notice is empty. |
2600 | 2600 | */ |
2601 | 2601 | public function wp_plugin_update_row( $slug, $item ) { |
2602 | - if ( empty( $item['upgrade_notice'] ) ) { |
|
2602 | + if ( empty( $item[ 'upgrade_notice' ] ) ) { |
|
2603 | 2603 | return; |
2604 | 2604 | } |
2605 | 2605 | |
@@ -2608,7 +2608,7 @@ discard block |
||
2608 | 2608 | <td colspan="', absint( $this->get_column_count() ), '" class="plugin-update colspanchange"> |
2609 | 2609 | <div class="update-message">', |
2610 | 2610 | esc_html__( 'Upgrade message from the plugin author:', 'tgmpa' ), |
2611 | - ' <strong>', wp_kses_data( $item['upgrade_notice'] ), '</strong> |
|
2611 | + ' <strong>', wp_kses_data( $item[ 'upgrade_notice' ] ), '</strong> |
|
2612 | 2612 | </div> |
2613 | 2613 | </td> |
2614 | 2614 | </tr>'; |
@@ -2640,16 +2640,16 @@ discard block |
||
2640 | 2640 | |
2641 | 2641 | if ( 'update' !== $this->view_context && 'activate' !== $this->view_context ) { |
2642 | 2642 | if ( current_user_can( 'install_plugins' ) ) { |
2643 | - $actions['tgmpa-bulk-install'] = __( 'Install', 'tgmpa' ); |
|
2643 | + $actions[ 'tgmpa-bulk-install' ] = __( 'Install', 'tgmpa' ); |
|
2644 | 2644 | } |
2645 | 2645 | } |
2646 | 2646 | |
2647 | 2647 | if ( 'install' !== $this->view_context ) { |
2648 | 2648 | if ( current_user_can( 'update_plugins' ) ) { |
2649 | - $actions['tgmpa-bulk-update'] = __( 'Update', 'tgmpa' ); |
|
2649 | + $actions[ 'tgmpa-bulk-update' ] = __( 'Update', 'tgmpa' ); |
|
2650 | 2650 | } |
2651 | 2651 | if ( current_user_can( 'activate_plugins' ) ) { |
2652 | - $actions['tgmpa-bulk-activate'] = __( 'Activate', 'tgmpa' ); |
|
2652 | + $actions[ 'tgmpa-bulk-activate' ] = __( 'Activate', 'tgmpa' ); |
|
2653 | 2653 | } |
2654 | 2654 | } |
2655 | 2655 | |
@@ -2668,7 +2668,7 @@ discard block |
||
2668 | 2668 | // Bulk installation process. |
2669 | 2669 | if ( 'tgmpa-bulk-install' === $this->current_action() || 'tgmpa-bulk-update' === $this->current_action() ) { |
2670 | 2670 | |
2671 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
2671 | + check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2672 | 2672 | |
2673 | 2673 | $install_type = 'install'; |
2674 | 2674 | if ( 'tgmpa-bulk-update' === $this->current_action() ) { |
@@ -2678,7 +2678,7 @@ discard block |
||
2678 | 2678 | $plugins_to_install = array(); |
2679 | 2679 | |
2680 | 2680 | // Did user actually select any plugins to install/update ? |
2681 | - if ( empty( $_POST['plugin'] ) ) { |
|
2681 | + if ( empty( $_POST[ 'plugin' ] ) ) { |
|
2682 | 2682 | if ( 'install' === $install_type ) { |
2683 | 2683 | $message = __( 'No plugins were selected to be installed. No action taken.', 'tgmpa' ); |
2684 | 2684 | } else { |
@@ -2690,11 +2690,11 @@ discard block |
||
2690 | 2690 | return false; |
2691 | 2691 | } |
2692 | 2692 | |
2693 | - if ( is_array( $_POST['plugin'] ) ) { |
|
2694 | - $plugins_to_install = (array) $_POST['plugin']; |
|
2695 | - } elseif ( is_string( $_POST['plugin'] ) ) { |
|
2693 | + if ( is_array( $_POST[ 'plugin' ] ) ) { |
|
2694 | + $plugins_to_install = (array) $_POST[ 'plugin' ]; |
|
2695 | + } elseif ( is_string( $_POST[ 'plugin' ] ) ) { |
|
2696 | 2696 | // Received via Filesystem page - un-flatten array (WP bug #19643). |
2697 | - $plugins_to_install = explode( ',', $_POST['plugin'] ); |
|
2697 | + $plugins_to_install = explode( ',', $_POST[ 'plugin' ] ); |
|
2698 | 2698 | } |
2699 | 2699 | |
2700 | 2700 | // Sanitize the received input. |
@@ -2736,11 +2736,11 @@ discard block |
||
2736 | 2736 | // Pass all necessary information if WP_Filesystem is needed. |
2737 | 2737 | $url = wp_nonce_url( |
2738 | 2738 | $this->tgmpa->get_tgmpa_url(), |
2739 | - 'bulk-' . $this->_args['plural'] |
|
2739 | + 'bulk-'.$this->_args[ 'plural' ] |
|
2740 | 2740 | ); |
2741 | 2741 | |
2742 | 2742 | // Give validated data back to $_POST which is the only place the filesystem looks for extra fields. |
2743 | - $_POST['plugin'] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
2743 | + $_POST[ 'plugin' ] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
2744 | 2744 | |
2745 | 2745 | $method = ''; // Leave blank so WP_Filesystem can populate it as necessary. |
2746 | 2746 | $fields = array_keys( $_POST ); // Extra fields to pass to WP_Filesystem. |
@@ -2767,22 +2767,22 @@ discard block |
||
2767 | 2767 | |
2768 | 2768 | // Prepare the data for validated plugins for the install/upgrade. |
2769 | 2769 | foreach ( $plugins_to_install as $slug ) { |
2770 | - $name = $this->tgmpa->plugins[ $slug ]['name']; |
|
2770 | + $name = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
2771 | 2771 | $source = $this->tgmpa->get_download_url( $slug ); |
2772 | 2772 | |
2773 | 2773 | if ( ! empty( $name ) && ! empty( $source ) ) { |
2774 | - $names[] = $name; |
|
2774 | + $names[ ] = $name; |
|
2775 | 2775 | |
2776 | 2776 | switch ( $install_type ) { |
2777 | 2777 | |
2778 | 2778 | case 'install': |
2779 | - $sources[] = $source; |
|
2779 | + $sources[ ] = $source; |
|
2780 | 2780 | break; |
2781 | 2781 | |
2782 | 2782 | case 'update': |
2783 | - $file_paths[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
2783 | + $file_paths[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
2784 | 2784 | $to_inject[ $slug ] = $this->tgmpa->plugins[ $slug ]; |
2785 | - $to_inject[ $slug ]['source'] = $source; |
|
2785 | + $to_inject[ $slug ][ 'source' ] = $source; |
|
2786 | 2786 | break; |
2787 | 2787 | } |
2788 | 2788 | } |
@@ -2794,7 +2794,7 @@ discard block |
||
2794 | 2794 | new TGMPA_Bulk_Installer_Skin( |
2795 | 2795 | array( |
2796 | 2796 | 'url' => esc_url_raw( $this->tgmpa->get_tgmpa_url() ), |
2797 | - 'nonce' => 'bulk-' . $this->_args['plural'], |
|
2797 | + 'nonce' => 'bulk-'.$this->_args[ 'plural' ], |
|
2798 | 2798 | 'names' => $names, |
2799 | 2799 | 'install_type' => $install_type, |
2800 | 2800 | ) |
@@ -2827,10 +2827,10 @@ discard block |
||
2827 | 2827 | |
2828 | 2828 | // Bulk activation process. |
2829 | 2829 | if ( 'tgmpa-bulk-activate' === $this->current_action() ) { |
2830 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
2830 | + check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2831 | 2831 | |
2832 | 2832 | // Did user actually select any plugins to activate ? |
2833 | - if ( empty( $_POST['plugin'] ) ) { |
|
2833 | + if ( empty( $_POST[ 'plugin' ] ) ) { |
|
2834 | 2834 | echo '<div id="message" class="error"><p>', esc_html__( 'No plugins were selected to be activated. No action taken.', 'tgmpa' ), '</p></div>'; |
2835 | 2835 | |
2836 | 2836 | return false; |
@@ -2838,8 +2838,8 @@ discard block |
||
2838 | 2838 | |
2839 | 2839 | // Grab plugin data from $_POST. |
2840 | 2840 | $plugins = array(); |
2841 | - if ( isset( $_POST['plugin'] ) ) { |
|
2842 | - $plugins = array_map( 'urldecode', (array) $_POST['plugin'] ); |
|
2841 | + if ( isset( $_POST[ 'plugin' ] ) ) { |
|
2842 | + $plugins = array_map( 'urldecode', (array) $_POST[ 'plugin' ] ); |
|
2843 | 2843 | $plugins = array_map( array( $this->tgmpa, 'sanitize_key' ), $plugins ); |
2844 | 2844 | } |
2845 | 2845 | |
@@ -2849,8 +2849,8 @@ discard block |
||
2849 | 2849 | // Grab the file paths for the selected & inactive plugins from the registration array. |
2850 | 2850 | foreach ( $plugins as $slug ) { |
2851 | 2851 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
2852 | - $plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
2853 | - $plugin_names[] = $this->tgmpa->plugins[ $slug ]['name']; |
|
2852 | + $plugins_to_activate[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
2853 | + $plugin_names[ ] = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
2854 | 2854 | } |
2855 | 2855 | } |
2856 | 2856 | unset( $slug ); |
@@ -2871,7 +2871,7 @@ discard block |
||
2871 | 2871 | $count = count( $plugin_names ); // Count so we can use _n function. |
2872 | 2872 | $plugin_names = array_map( array( 'TGMPA_Utils', 'wrap_in_strong' ), $plugin_names ); |
2873 | 2873 | $last_plugin = array_pop( $plugin_names ); // Pop off last name to prep for readability. |
2874 | - $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
2874 | + $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); |
|
2875 | 2875 | |
2876 | 2876 | printf( // WPCS: xss ok. |
2877 | 2877 | '<div id="message" class="updated"><p>%1$s %2$s.</p></div>', |
@@ -2974,16 +2974,16 @@ discard block |
||
2974 | 2974 | */ |
2975 | 2975 | function tgmpa_load_bulk_installer() { |
2976 | 2976 | // Silently fail if 2.5+ is loaded *after* an older version. |
2977 | - if ( ! isset( $GLOBALS['tgmpa'] ) ) { |
|
2977 | + if ( ! isset( $GLOBALS[ 'tgmpa' ] ) ) { |
|
2978 | 2978 | return; |
2979 | 2979 | } |
2980 | 2980 | |
2981 | 2981 | // Get TGMPA class instance. |
2982 | - $tgmpa_instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
2982 | + $tgmpa_instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
2983 | 2983 | |
2984 | - if ( isset( $_GET['page'] ) && $tgmpa_instance->menu === $_GET['page'] ) { |
|
2984 | + if ( isset( $_GET[ 'page' ] ) && $tgmpa_instance->menu === $_GET[ 'page' ] ) { |
|
2985 | 2985 | if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
2986 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
2986 | + require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
2987 | 2987 | } |
2988 | 2988 | |
2989 | 2989 | if ( ! class_exists( 'TGMPA_Bulk_Installer' ) ) { |
@@ -3050,11 +3050,11 @@ discard block |
||
3050 | 3050 | */ |
3051 | 3051 | public function __construct( $skin = null ) { |
3052 | 3052 | // Get TGMPA class instance. |
3053 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
3053 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3054 | 3054 | |
3055 | 3055 | parent::__construct( $skin ); |
3056 | 3056 | |
3057 | - if ( isset( $this->skin->options['install_type'] ) && 'update' === $this->skin->options['install_type'] ) { |
|
3057 | + if ( isset( $this->skin->options[ 'install_type' ] ) && 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3058 | 3058 | $this->clear_destination = true; |
3059 | 3059 | } |
3060 | 3060 | |
@@ -3071,8 +3071,8 @@ discard block |
||
3071 | 3071 | * @since 2.2.0 |
3072 | 3072 | */ |
3073 | 3073 | public function activate_strings() { |
3074 | - $this->strings['activation_failed'] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
3075 | - $this->strings['activation_success'] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
3074 | + $this->strings[ 'activation_failed' ] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
3075 | + $this->strings[ 'activation_success' ] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
3076 | 3076 | } |
3077 | 3077 | |
3078 | 3078 | /** |
@@ -3090,7 +3090,7 @@ discard block |
||
3090 | 3090 | |
3091 | 3091 | // Reset the strings in case we changed one during automatic activation. |
3092 | 3092 | if ( $this->tgmpa->is_automatic ) { |
3093 | - if ( 'update' === $this->skin->options['install_type'] ) { |
|
3093 | + if ( 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3094 | 3094 | $this->upgrade_strings(); |
3095 | 3095 | } else { |
3096 | 3096 | $this->install_strings(); |
@@ -3247,7 +3247,7 @@ discard block |
||
3247 | 3247 | remove_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 ); |
3248 | 3248 | |
3249 | 3249 | // Force refresh of plugin update information. |
3250 | - wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); |
|
3250 | + wp_clean_plugins_cache( $parsed_args[ 'clear_update_cache' ] ); |
|
3251 | 3251 | |
3252 | 3252 | return $results; |
3253 | 3253 | } |
@@ -3298,13 +3298,13 @@ discard block |
||
3298 | 3298 | $activate = activate_plugin( $plugin_info ); |
3299 | 3299 | |
3300 | 3300 | // Adjust the success string based on the activation result. |
3301 | - $this->strings['process_success'] = $this->strings['process_success'] . "<br />\n"; |
|
3301 | + $this->strings[ 'process_success' ] = $this->strings[ 'process_success' ]."<br />\n"; |
|
3302 | 3302 | |
3303 | 3303 | if ( is_wp_error( $activate ) ) { |
3304 | 3304 | $this->skin->error( $activate ); |
3305 | - $this->strings['process_success'] .= $this->strings['activation_failed']; |
|
3305 | + $this->strings[ 'process_success' ] .= $this->strings[ 'activation_failed' ]; |
|
3306 | 3306 | } else { |
3307 | - $this->strings['process_success'] .= $this->strings['activation_success']; |
|
3307 | + $this->strings[ 'process_success' ] .= $this->strings[ 'activation_success' ]; |
|
3308 | 3308 | } |
3309 | 3309 | } |
3310 | 3310 | } |
@@ -3380,7 +3380,7 @@ discard block |
||
3380 | 3380 | */ |
3381 | 3381 | public function __construct( $args = array() ) { |
3382 | 3382 | // Get TGMPA class instance. |
3383 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
3383 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3384 | 3384 | |
3385 | 3385 | // Parse default and new args. |
3386 | 3386 | $defaults = array( |
@@ -3389,10 +3389,10 @@ discard block |
||
3389 | 3389 | 'names' => array(), |
3390 | 3390 | 'install_type' => 'install', |
3391 | 3391 | ); |
3392 | - $args = wp_parse_args( $args, $defaults ); |
|
3392 | + $args = wp_parse_args( $args, $defaults ); |
|
3393 | 3393 | |
3394 | 3394 | // Set plugin names to $this->plugin_names property. |
3395 | - $this->plugin_names = $args['names']; |
|
3395 | + $this->plugin_names = $args[ 'names' ]; |
|
3396 | 3396 | |
3397 | 3397 | // Extract the new args. |
3398 | 3398 | parent::__construct( $args ); |
@@ -3407,25 +3407,25 @@ discard block |
||
3407 | 3407 | * @since 2.2.0 |
3408 | 3408 | */ |
3409 | 3409 | public function add_strings() { |
3410 | - if ( 'update' === $this->options['install_type'] ) { |
|
3410 | + if ( 'update' === $this->options[ 'install_type' ] ) { |
|
3411 | 3411 | parent::add_strings(); |
3412 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3412 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3413 | 3413 | } else { |
3414 | - $this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
3415 | - $this->upgrader->strings['skin_update_failed'] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
3414 | + $this->upgrader->strings[ 'skin_update_failed_error' ] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
3415 | + $this->upgrader->strings[ 'skin_update_failed' ] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
3416 | 3416 | |
3417 | 3417 | if ( $this->tgmpa->is_automatic ) { |
3418 | 3418 | // Automatic activation strings. |
3419 | - $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' ); |
|
3420 | - $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>'; |
|
3421 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
3422 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3419 | + $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' ); |
|
3420 | + $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>'; |
|
3421 | + $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
3422 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3423 | 3423 | } else { |
3424 | 3424 | // Default installation strings. |
3425 | - $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' ); |
|
3426 | - $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>'; |
|
3427 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations have been completed.', 'tgmpa' ); |
|
3428 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3425 | + $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' ); |
|
3426 | + $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>'; |
|
3427 | + $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations have been completed.', 'tgmpa' ); |
|
3428 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3429 | 3429 | } |
3430 | 3430 | } |
3431 | 3431 | } |
@@ -3483,12 +3483,12 @@ discard block |
||
3483 | 3483 | if ( $this->tgmpa->is_tgmpa_complete() ) { |
3484 | 3484 | // All plugins are active, so we display the complete string and hide the menu to protect users. |
3485 | 3485 | echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
3486 | - $update_actions['dashboard'] = sprintf( |
|
3487 | - esc_html( $this->tgmpa->strings['complete'] ), |
|
3488 | - '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' |
|
3486 | + $update_actions[ 'dashboard' ] = sprintf( |
|
3487 | + esc_html( $this->tgmpa->strings[ 'complete' ] ), |
|
3488 | + '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' |
|
3489 | 3489 | ); |
3490 | 3490 | } else { |
3491 | - $update_actions['tgmpa_page'] = '<a href="' . esc_url( $this->tgmpa->get_tgmpa_url() ) . '" target="_parent">' . esc_html( $this->tgmpa->strings['return'] ) . '</a>'; |
|
3491 | + $update_actions[ 'tgmpa_page' ] = '<a href="'.esc_url( $this->tgmpa->get_tgmpa_url() ).'" target="_parent">'.esc_html( $this->tgmpa->strings[ 'return' ] ).'</a>'; |
|
3492 | 3492 | } |
3493 | 3493 | |
3494 | 3494 | /** |
@@ -3578,7 +3578,7 @@ discard block |
||
3578 | 3578 | * @return string |
3579 | 3579 | */ |
3580 | 3580 | public static function wrap_in_em( $string ) { |
3581 | - return '<em>' . wp_kses_post( $string ) . '</em>'; |
|
3581 | + return '<em>'.wp_kses_post( $string ).'</em>'; |
|
3582 | 3582 | } |
3583 | 3583 | |
3584 | 3584 | /** |
@@ -3592,7 +3592,7 @@ discard block |
||
3592 | 3592 | * @return string |
3593 | 3593 | */ |
3594 | 3594 | public static function wrap_in_strong( $string ) { |
3595 | - return '<strong>' . wp_kses_post( $string ) . '</strong>'; |
|
3595 | + return '<strong>'.wp_kses_post( $string ).'</strong>'; |
|
3596 | 3596 | } |
3597 | 3597 | |
3598 | 3598 | /** |
@@ -3629,7 +3629,7 @@ discard block |
||
3629 | 3629 | */ |
3630 | 3630 | protected static function emulate_filter_bool( $value ) { |
3631 | 3631 | // @codingStandardsIgnoreStart |
3632 | - static $true = array( |
|
3632 | + static $true = array( |
|
3633 | 3633 | '1', |
3634 | 3634 | 'true', 'True', 'TRUE', |
3635 | 3635 | 'y', 'Y', |