@@ -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() || $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' ) ) ) { |
|
1007 | + 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' ) ) ) { |
|
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'] . ' ' . $this->strings['contact_admin'] ); |
|
1083 | + $rendered = esc_html__( $this->strings[ 'notice_cannot_install_activate' ].' '.$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_link_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_link_count, 'tgmpa' ), |
|
1158 | + translate_nooped_plural( $this->strings[ 'install_link' ], $install_link_count, 'tgmpa' ), |
|
1159 | 1159 | esc_url( $this->get_tgmpa_status_url( 'install' ) ) |
1160 | 1160 | ); |
1161 | 1161 | } |
1162 | 1162 | if ( $update_link_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_link_count, 'tgmpa' ), |
|
1165 | + translate_nooped_plural( $this->strings[ 'update_link' ], $update_link_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_link_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_link_count, 'tgmpa' ), |
|
1174 | + translate_nooped_plural( $this->strings[ 'activate_link' ], $activate_link_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 | /** |
@@ -1621,10 +1621,10 @@ discard block |
||
1621 | 1621 | if ( 'update-core' === $screen->base ) { |
1622 | 1622 | // Core update screen. |
1623 | 1623 | return true; |
1624 | - } elseif ( 'plugins' === $screen->base && isset( $_POST['action'] ) ) { |
|
1624 | + } elseif ( 'plugins' === $screen->base && isset( $_POST[ 'action' ] ) ) { |
|
1625 | 1625 | // Plugins bulk update screen. |
1626 | 1626 | return true; |
1627 | - } elseif ( 'update' === $screen->base && isset( $_POST['action'] ) ) { |
|
1627 | + } elseif ( 'update' === $screen->base && isset( $_POST[ 'action' ] ) ) { |
|
1628 | 1628 | // Individual updates (ajax call). |
1629 | 1629 | return true; |
1630 | 1630 | } |
@@ -1711,7 +1711,7 @@ discard block |
||
1711 | 1711 | public function is_plugin_installed( $slug ) { |
1712 | 1712 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
1713 | 1713 | |
1714 | - return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) ); |
|
1714 | + return ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ] ) ); |
|
1715 | 1715 | } |
1716 | 1716 | |
1717 | 1717 | /** |
@@ -1723,7 +1723,7 @@ discard block |
||
1723 | 1723 | * @return bool True if active, false otherwise. |
1724 | 1724 | */ |
1725 | 1725 | public function is_plugin_active( $slug ) { |
1726 | - return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) ); |
|
1726 | + return ( ( ! empty( $this->plugins[ $slug ][ 'is_callable' ] ) && is_callable( $this->plugins[ $slug ][ 'is_callable' ] ) ) || is_plugin_active( $this->plugins[ $slug ][ 'file_path' ] ) ); |
|
1727 | 1727 | } |
1728 | 1728 | |
1729 | 1729 | /** |
@@ -1737,14 +1737,14 @@ discard block |
||
1737 | 1737 | */ |
1738 | 1738 | public function can_plugin_update( $slug ) { |
1739 | 1739 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
1740 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1740 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1741 | 1741 | return true; |
1742 | 1742 | } |
1743 | 1743 | |
1744 | 1744 | $api = $this->get_plugins_api( $slug ); |
1745 | 1745 | |
1746 | 1746 | if ( false !== $api && isset( $api->requires ) ) { |
1747 | - return version_compare( $GLOBALS['wp_version'], $api->requires, '>=' ); |
|
1747 | + return version_compare( $GLOBALS[ 'wp_version' ], $api->requires, '>=' ); |
|
1748 | 1748 | } |
1749 | 1749 | |
1750 | 1750 | // No usable info received from the plugins API, presume we can update. |
@@ -1793,8 +1793,8 @@ discard block |
||
1793 | 1793 | public function get_installed_version( $slug ) { |
1794 | 1794 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
1795 | 1795 | |
1796 | - if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) { |
|
1797 | - return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version']; |
|
1796 | + if ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ] ) ) { |
|
1797 | + return $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ]; |
|
1798 | 1798 | } |
1799 | 1799 | |
1800 | 1800 | return ''; |
@@ -1810,7 +1810,7 @@ discard block |
||
1810 | 1810 | */ |
1811 | 1811 | public function does_plugin_require_update( $slug ) { |
1812 | 1812 | $installed_version = $this->get_installed_version( $slug ); |
1813 | - $minimum_version = $this->plugins[ $slug ]['version']; |
|
1813 | + $minimum_version = $this->plugins[ $slug ][ 'version' ]; |
|
1814 | 1814 | |
1815 | 1815 | return version_compare( $minimum_version, $installed_version, '>' ); |
1816 | 1816 | } |
@@ -1825,9 +1825,9 @@ discard block |
||
1825 | 1825 | */ |
1826 | 1826 | public function does_plugin_have_update( $slug ) { |
1827 | 1827 | // Presume bundled and external plugins will point to a package which meets the minimum required version. |
1828 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1828 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1829 | 1829 | if ( $this->does_plugin_require_update( $slug ) ) { |
1830 | - return $this->plugins[ $slug ]['version']; |
|
1830 | + return $this->plugins[ $slug ][ 'version' ]; |
|
1831 | 1831 | } |
1832 | 1832 | |
1833 | 1833 | return false; |
@@ -1835,8 +1835,8 @@ discard block |
||
1835 | 1835 | |
1836 | 1836 | $repo_updates = get_site_transient( 'update_plugins' ); |
1837 | 1837 | |
1838 | - if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) { |
|
1839 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version; |
|
1838 | + if ( isset( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version ) ) { |
|
1839 | + return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version; |
|
1840 | 1840 | } |
1841 | 1841 | |
1842 | 1842 | return false; |
@@ -1852,14 +1852,14 @@ discard block |
||
1852 | 1852 | */ |
1853 | 1853 | public function get_upgrade_notice( $slug ) { |
1854 | 1854 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
1855 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1855 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1856 | 1856 | return ''; |
1857 | 1857 | } |
1858 | 1858 | |
1859 | 1859 | $repo_updates = get_site_transient( 'update_plugins' ); |
1860 | 1860 | |
1861 | - if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) { |
|
1862 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice; |
|
1861 | + if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice ) ) { |
|
1862 | + return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice; |
|
1863 | 1863 | } |
1864 | 1864 | |
1865 | 1865 | return ''; |
@@ -1875,7 +1875,7 @@ discard block |
||
1875 | 1875 | */ |
1876 | 1876 | public function get_plugins( $plugin_folder = '' ) { |
1877 | 1877 | if ( ! function_exists( 'get_plugins' ) ) { |
1878 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
1878 | + require_once ABSPATH.'wp-admin/includes/plugin.php'; |
|
1879 | 1879 | } |
1880 | 1880 | |
1881 | 1881 | return get_plugins( $plugin_folder ); |
@@ -1890,7 +1890,7 @@ discard block |
||
1890 | 1890 | * @since 2.1.1 |
1891 | 1891 | */ |
1892 | 1892 | public function update_dismiss() { |
1893 | - delete_metadata( 'user', null, 'tgmpa_dismissed_notice_' . $this->id, null, true ); |
|
1893 | + delete_metadata( 'user', null, 'tgmpa_dismissed_notice_'.$this->id, null, true ); |
|
1894 | 1894 | } |
1895 | 1895 | |
1896 | 1896 | /** |
@@ -1909,13 +1909,13 @@ discard block |
||
1909 | 1909 | */ |
1910 | 1910 | public function force_activation() { |
1911 | 1911 | foreach ( $this->plugins as $slug => $plugin ) { |
1912 | - if ( true === $plugin['force_activation'] ) { |
|
1912 | + if ( true === $plugin[ 'force_activation' ] ) { |
|
1913 | 1913 | if ( ! $this->is_plugin_installed( $slug ) ) { |
1914 | 1914 | // Oops, plugin isn't there so iterate to next condition. |
1915 | 1915 | continue; |
1916 | 1916 | } elseif ( $this->can_plugin_activate( $slug ) ) { |
1917 | 1917 | // There we go, activate the plugin. |
1918 | - activate_plugin( $plugin['file_path'] ); |
|
1918 | + activate_plugin( $plugin[ 'file_path' ] ); |
|
1919 | 1919 | } |
1920 | 1920 | } |
1921 | 1921 | } |
@@ -1936,8 +1936,8 @@ discard block |
||
1936 | 1936 | public function force_deactivation() { |
1937 | 1937 | foreach ( $this->plugins as $slug => $plugin ) { |
1938 | 1938 | // Only proceed forward if the parameter is set to true and plugin is active. |
1939 | - if ( true === $plugin['force_deactivation'] && $this->is_plugin_active( $slug ) ) { |
|
1940 | - deactivate_plugins( $plugin['file_path'] ); |
|
1939 | + if ( true === $plugin[ 'force_deactivation' ] && $this->is_plugin_active( $slug ) ) { |
|
1940 | + deactivate_plugins( $plugin[ 'file_path' ] ); |
|
1941 | 1941 | } |
1942 | 1942 | } |
1943 | 1943 | } |
@@ -1972,7 +1972,7 @@ discard block |
||
1972 | 1972 | * Ensure only one instance of the class is ever invoked. |
1973 | 1973 | */ |
1974 | 1974 | function load_tgm_plugin_activation() { |
1975 | - $GLOBALS['tgmpa'] = TGM_Plugin_Activation::get_instance(); |
|
1975 | + $GLOBALS[ 'tgmpa' ] = TGM_Plugin_Activation::get_instance(); |
|
1976 | 1976 | } |
1977 | 1977 | } |
1978 | 1978 | |
@@ -1994,7 +1994,7 @@ discard block |
||
1994 | 1994 | * @param array $config Optional. An array of configuration values. |
1995 | 1995 | */ |
1996 | 1996 | function tgmpa( $plugins, $config = array() ) { |
1997 | - $instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
1997 | + $instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
1998 | 1998 | |
1999 | 1999 | foreach ( $plugins as $plugin ) { |
2000 | 2000 | call_user_func( array( $instance, 'register' ), $plugin ); |
@@ -2002,17 +2002,17 @@ discard block |
||
2002 | 2002 | |
2003 | 2003 | if ( ! empty( $config ) && is_array( $config ) ) { |
2004 | 2004 | // Send out notices for deprecated arguments passed. |
2005 | - if ( isset( $config['notices'] ) ) { |
|
2005 | + if ( isset( $config[ 'notices' ] ) ) { |
|
2006 | 2006 | _deprecated_argument( __FUNCTION__, '2.2.0', 'The `notices` config parameter was renamed to `has_notices` in TGMPA 2.2.0. Please adjust your configuration.' ); |
2007 | - if ( ! isset( $config['has_notices'] ) ) { |
|
2008 | - $config['has_notices'] = $config['notices']; |
|
2007 | + if ( ! isset( $config[ 'has_notices' ] ) ) { |
|
2008 | + $config[ 'has_notices' ] = $config[ 'notices' ]; |
|
2009 | 2009 | } |
2010 | 2010 | } |
2011 | 2011 | |
2012 | - if ( isset( $config['parent_menu_slug'] ) ) { |
|
2012 | + if ( isset( $config[ 'parent_menu_slug' ] ) ) { |
|
2013 | 2013 | _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.' ); |
2014 | 2014 | } |
2015 | - if ( isset( $config['parent_url_slug'] ) ) { |
|
2015 | + if ( isset( $config[ 'parent_url_slug' ] ) ) { |
|
2016 | 2016 | _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.' ); |
2017 | 2017 | } |
2018 | 2018 | |
@@ -2028,7 +2028,7 @@ discard block |
||
2028 | 2028 | * @since 2.2.0 |
2029 | 2029 | */ |
2030 | 2030 | if ( ! class_exists( 'WP_List_Table' ) ) { |
2031 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
2031 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
2032 | 2032 | } |
2033 | 2033 | |
2034 | 2034 | if ( ! class_exists( 'TGMPA_List_Table' ) ) { |
@@ -2089,7 +2089,7 @@ discard block |
||
2089 | 2089 | * @since 2.2.0 |
2090 | 2090 | */ |
2091 | 2091 | public function __construct() { |
2092 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
2092 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
2093 | 2093 | |
2094 | 2094 | parent::__construct( |
2095 | 2095 | array( |
@@ -2099,8 +2099,8 @@ discard block |
||
2099 | 2099 | ) |
2100 | 2100 | ); |
2101 | 2101 | |
2102 | - if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'install', 'update', 'activate' ), true ) ) { |
|
2103 | - $this->view_context = sanitize_key( $_REQUEST['plugin_status'] ); |
|
2102 | + if ( isset( $_REQUEST[ 'plugin_status' ] ) && in_array( $_REQUEST[ 'plugin_status' ], array( 'install', 'update', 'activate' ), true ) ) { |
|
2103 | + $this->view_context = sanitize_key( $_REQUEST[ 'plugin_status' ] ); |
|
2104 | 2104 | } |
2105 | 2105 | |
2106 | 2106 | add_filter( 'tgmpa_table_data_items', array( $this, 'sort_table_items' ) ); |
@@ -2147,20 +2147,20 @@ discard block |
||
2147 | 2147 | } |
2148 | 2148 | |
2149 | 2149 | foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) { |
2150 | - $table_data[ $i ]['sanitized_plugin'] = $plugin['name']; |
|
2151 | - $table_data[ $i ]['slug'] = $slug; |
|
2152 | - $table_data[ $i ]['plugin'] = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>'; |
|
2153 | - $table_data[ $i ]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] ); |
|
2154 | - $table_data[ $i ]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] ); |
|
2155 | - $table_data[ $i ]['status'] = $this->get_plugin_status_text( $slug ); |
|
2156 | - $table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug ); |
|
2157 | - $table_data[ $i ]['minimum_version'] = $plugin['version']; |
|
2158 | - $table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2150 | + $table_data[ $i ][ 'sanitized_plugin' ] = $plugin[ 'name' ]; |
|
2151 | + $table_data[ $i ][ 'slug' ] = $slug; |
|
2152 | + $table_data[ $i ][ 'plugin' ] = '<strong>'.$this->tgmpa->get_info_link( $slug ).'</strong>'; |
|
2153 | + $table_data[ $i ][ 'source' ] = $this->get_plugin_source_type_text( $plugin[ 'source_type' ] ); |
|
2154 | + $table_data[ $i ][ 'type' ] = $this->get_plugin_advise_type_text( $plugin[ 'required' ] ); |
|
2155 | + $table_data[ $i ][ 'status' ] = $this->get_plugin_status_text( $slug ); |
|
2156 | + $table_data[ $i ][ 'installed_version' ] = $this->tgmpa->get_installed_version( $slug ); |
|
2157 | + $table_data[ $i ][ 'minimum_version' ] = $plugin[ 'version' ]; |
|
2158 | + $table_data[ $i ][ 'available_version' ] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2159 | 2159 | |
2160 | 2160 | // Prep the upgrade notice info. |
2161 | 2161 | $upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug ); |
2162 | 2162 | if ( ! empty( $upgrade_notice ) ) { |
2163 | - $table_data[ $i ]['upgrade_notice'] = $upgrade_notice; |
|
2163 | + $table_data[ $i ][ 'upgrade_notice' ] = $upgrade_notice; |
|
2164 | 2164 | |
2165 | 2165 | add_action( "tgmpa_after_plugin_row_$slug", array( $this, 'wp_plugin_update_row' ), 10, 2 ); |
2166 | 2166 | } |
@@ -2191,17 +2191,17 @@ discard block |
||
2191 | 2191 | // No need to display plugins if they are installed, up-to-date and active. |
2192 | 2192 | continue; |
2193 | 2193 | } else { |
2194 | - $plugins['all'][ $slug ] = $plugin; |
|
2194 | + $plugins[ 'all' ][ $slug ] = $plugin; |
|
2195 | 2195 | |
2196 | 2196 | if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) { |
2197 | - $plugins['install'][ $slug ] = $plugin; |
|
2197 | + $plugins[ 'install' ][ $slug ] = $plugin; |
|
2198 | 2198 | } else { |
2199 | 2199 | if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) { |
2200 | - $plugins['update'][ $slug ] = $plugin; |
|
2200 | + $plugins[ 'update' ][ $slug ] = $plugin; |
|
2201 | 2201 | } |
2202 | 2202 | |
2203 | 2203 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
2204 | - $plugins['activate'][ $slug ] = $plugin; |
|
2204 | + $plugins[ 'activate' ][ $slug ] = $plugin; |
|
2205 | 2205 | } |
2206 | 2206 | } |
2207 | 2207 | } |
@@ -2320,8 +2320,8 @@ discard block |
||
2320 | 2320 | $name = array(); |
2321 | 2321 | |
2322 | 2322 | foreach ( $items as $i => $plugin ) { |
2323 | - $type[ $i ] = $plugin['type']; // Required / recommended. |
|
2324 | - $name[ $i ] = $plugin['sanitized_plugin']; |
|
2323 | + $type[ $i ] = $plugin[ 'type' ]; // Required / recommended. |
|
2324 | + $name[ $i ] = $plugin[ 'sanitized_plugin' ]; |
|
2325 | 2325 | } |
2326 | 2326 | |
2327 | 2327 | array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items ); |
@@ -2403,9 +2403,9 @@ discard block |
||
2403 | 2403 | public function column_cb( $item ) { |
2404 | 2404 | return sprintf( |
2405 | 2405 | '<input type="checkbox" name="%1$s[]" value="%2$s" id="%3$s" />', |
2406 | - esc_attr( $this->_args['singular'] ), |
|
2407 | - esc_attr( $item['slug'] ), |
|
2408 | - esc_attr( $item['sanitized_plugin'] ) |
|
2406 | + esc_attr( $this->_args[ 'singular' ] ), |
|
2407 | + esc_attr( $item[ 'slug' ] ), |
|
2408 | + esc_attr( $item[ 'sanitized_plugin' ] ) |
|
2409 | 2409 | ); |
2410 | 2410 | } |
2411 | 2411 | |
@@ -2420,7 +2420,7 @@ discard block |
||
2420 | 2420 | public function column_plugin( $item ) { |
2421 | 2421 | return sprintf( |
2422 | 2422 | '%1$s %2$s', |
2423 | - $item['plugin'], |
|
2423 | + $item[ 'plugin' ], |
|
2424 | 2424 | $this->row_actions( $this->get_row_actions( $item ), true ) |
2425 | 2425 | ); |
2426 | 2426 | } |
@@ -2436,38 +2436,38 @@ discard block |
||
2436 | 2436 | public function column_version( $item ) { |
2437 | 2437 | $output = array(); |
2438 | 2438 | |
2439 | - if ( $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
2440 | - $installed = ! empty( $item['installed_version'] ) ? $item['installed_version'] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
2439 | + if ( $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
2440 | + $installed = ! empty( $item[ 'installed_version' ] ) ? $item[ 'installed_version' ] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
2441 | 2441 | |
2442 | 2442 | $color = ''; |
2443 | - if ( ! empty( $item['minimum_version'] ) && $this->tgmpa->does_plugin_require_update( $item['slug'] ) ) { |
|
2443 | + if ( ! empty( $item[ 'minimum_version' ] ) && $this->tgmpa->does_plugin_require_update( $item[ 'slug' ] ) ) { |
|
2444 | 2444 | $color = ' color: #ff0000; font-weight: bold;'; |
2445 | 2445 | } |
2446 | 2446 | |
2447 | - $output[] = sprintf( |
|
2448 | - '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Installed version:', 'tgmpa' ) . '</p>', |
|
2447 | + $output[ ] = sprintf( |
|
2448 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Installed version:', 'tgmpa' ).'</p>', |
|
2449 | 2449 | $color, |
2450 | 2450 | $installed |
2451 | 2451 | ); |
2452 | 2452 | } |
2453 | 2453 | |
2454 | - if ( ! empty( $item['minimum_version'] ) ) { |
|
2455 | - $output[] = sprintf( |
|
2456 | - '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>' . __( 'Minimum required version:', 'tgmpa' ) . '</p>', |
|
2457 | - $item['minimum_version'] |
|
2454 | + if ( ! empty( $item[ 'minimum_version' ] ) ) { |
|
2455 | + $output[ ] = sprintf( |
|
2456 | + '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>'.__( 'Minimum required version:', 'tgmpa' ).'</p>', |
|
2457 | + $item[ 'minimum_version' ] |
|
2458 | 2458 | ); |
2459 | 2459 | } |
2460 | 2460 | |
2461 | - if ( ! empty( $item['available_version'] ) ) { |
|
2461 | + if ( ! empty( $item[ 'available_version' ] ) ) { |
|
2462 | 2462 | $color = ''; |
2463 | - if ( ! empty( $item['minimum_version'] ) && version_compare( $item['available_version'], $item['minimum_version'], '>=' ) ) { |
|
2463 | + if ( ! empty( $item[ 'minimum_version' ] ) && version_compare( $item[ 'available_version' ], $item[ 'minimum_version' ], '>=' ) ) { |
|
2464 | 2464 | $color = ' color: #71C671; font-weight: bold;'; |
2465 | 2465 | } |
2466 | 2466 | |
2467 | - $output[] = sprintf( |
|
2468 | - '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Available version:', 'tgmpa' ) . '</p>', |
|
2467 | + $output[ ] = sprintf( |
|
2468 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Available version:', 'tgmpa' ).'</p>', |
|
2469 | 2469 | $color, |
2470 | - $item['available_version'] |
|
2470 | + $item[ 'available_version' ] |
|
2471 | 2471 | ); |
2472 | 2472 | } |
2473 | 2473 | |
@@ -2508,8 +2508,8 @@ discard block |
||
2508 | 2508 | ); |
2509 | 2509 | |
2510 | 2510 | if ( 'all' === $this->view_context || 'update' === $this->view_context ) { |
2511 | - $columns['version'] = __( 'Version', 'tgmpa' ); |
|
2512 | - $columns['status'] = __( 'Status', 'tgmpa' ); |
|
2511 | + $columns[ 'version' ] = __( 'Version', 'tgmpa' ); |
|
2512 | + $columns[ 'status' ] = __( 'Status', 'tgmpa' ); |
|
2513 | 2513 | } |
2514 | 2514 | |
2515 | 2515 | return apply_filters( 'tgmpa_table_columns', $columns ); |
@@ -2556,17 +2556,17 @@ discard block |
||
2556 | 2556 | $action_links = array(); |
2557 | 2557 | |
2558 | 2558 | // Display the 'Install' action link if the plugin is not yet available. |
2559 | - if ( ! $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
2560 | - $actions['install'] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2559 | + if ( ! $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
2560 | + $actions[ 'install' ] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2561 | 2561 | } else { |
2562 | 2562 | // Display the 'Update' action link if an update is available and WP complies with plugin minimum. |
2563 | - if ( false !== $this->tgmpa->does_plugin_have_update( $item['slug'] ) && $this->tgmpa->can_plugin_update( $item['slug'] ) ) { |
|
2564 | - $actions['update'] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2563 | + if ( false !== $this->tgmpa->does_plugin_have_update( $item[ 'slug' ] ) && $this->tgmpa->can_plugin_update( $item[ 'slug' ] ) ) { |
|
2564 | + $actions[ 'update' ] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2565 | 2565 | } |
2566 | 2566 | |
2567 | 2567 | // Display the 'Activate' action link, but only if the plugin meets the minimum version. |
2568 | - if ( $this->tgmpa->can_plugin_activate( $item['slug'] ) ) { |
|
2569 | - $actions['activate'] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2568 | + if ( $this->tgmpa->can_plugin_activate( $item[ 'slug' ] ) ) { |
|
2569 | + $actions[ 'activate' ] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2570 | 2570 | } |
2571 | 2571 | } |
2572 | 2572 | |
@@ -2575,24 +2575,24 @@ discard block |
||
2575 | 2575 | $nonce_url = wp_nonce_url( |
2576 | 2576 | add_query_arg( |
2577 | 2577 | array( |
2578 | - 'plugin' => urlencode( $item['slug'] ), |
|
2579 | - 'tgmpa-' . $action => $action . '-plugin', |
|
2578 | + 'plugin' => urlencode( $item[ 'slug' ] ), |
|
2579 | + 'tgmpa-'.$action => $action.'-plugin', |
|
2580 | 2580 | ), |
2581 | 2581 | $this->tgmpa->get_tgmpa_url() |
2582 | 2582 | ), |
2583 | - 'tgmpa-' . $action, |
|
2583 | + 'tgmpa-'.$action, |
|
2584 | 2584 | 'tgmpa-nonce' |
2585 | 2585 | ); |
2586 | 2586 | |
2587 | 2587 | $action_links[ $action ] = sprintf( |
2588 | - '<a href="%1$s">' . esc_html( $text ) . '</a>', |
|
2588 | + '<a href="%1$s">'.esc_html( $text ).'</a>', |
|
2589 | 2589 | esc_url( $nonce_url ), |
2590 | - '<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>' |
|
2590 | + '<span class="screen-reader-text">'.esc_html( $item[ 'sanitized_plugin' ] ).'</span>' |
|
2591 | 2591 | ); |
2592 | 2592 | } |
2593 | 2593 | |
2594 | 2594 | $prefix = ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) ? 'network_admin_' : ''; |
2595 | - return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item['slug'], $item, $this->view_context ); |
|
2595 | + return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item[ 'slug' ], $item, $this->view_context ); |
|
2596 | 2596 | } |
2597 | 2597 | |
2598 | 2598 | /** |
@@ -2613,7 +2613,7 @@ discard block |
||
2613 | 2613 | * |
2614 | 2614 | * @since 2.5.0 |
2615 | 2615 | */ |
2616 | - do_action( "tgmpa_after_plugin_row_{$item['slug']}", $item['slug'], $item, $this->view_context ); |
|
2616 | + do_action( "tgmpa_after_plugin_row_{$item[ 'slug' ]}", $item[ 'slug' ], $item, $this->view_context ); |
|
2617 | 2617 | } |
2618 | 2618 | |
2619 | 2619 | /** |
@@ -2628,7 +2628,7 @@ discard block |
||
2628 | 2628 | * @return null Return early if upgrade notice is empty. |
2629 | 2629 | */ |
2630 | 2630 | public function wp_plugin_update_row( $slug, $item ) { |
2631 | - if ( empty( $item['upgrade_notice'] ) ) { |
|
2631 | + if ( empty( $item[ 'upgrade_notice' ] ) ) { |
|
2632 | 2632 | return; |
2633 | 2633 | } |
2634 | 2634 | |
@@ -2637,7 +2637,7 @@ discard block |
||
2637 | 2637 | <td colspan="', absint( $this->get_column_count() ), '" class="plugin-update colspanchange"> |
2638 | 2638 | <div class="update-message">', |
2639 | 2639 | esc_html__( 'Upgrade message from the plugin author:', 'tgmpa' ), |
2640 | - ' <strong>', wp_kses_data( $item['upgrade_notice'] ), '</strong> |
|
2640 | + ' <strong>', wp_kses_data( $item[ 'upgrade_notice' ] ), '</strong> |
|
2641 | 2641 | </div> |
2642 | 2642 | </td> |
2643 | 2643 | </tr>'; |
@@ -2669,16 +2669,16 @@ discard block |
||
2669 | 2669 | |
2670 | 2670 | if ( 'update' !== $this->view_context && 'activate' !== $this->view_context ) { |
2671 | 2671 | if ( current_user_can( 'install_plugins' ) ) { |
2672 | - $actions['tgmpa-bulk-install'] = __( 'Install', 'tgmpa' ); |
|
2672 | + $actions[ 'tgmpa-bulk-install' ] = __( 'Install', 'tgmpa' ); |
|
2673 | 2673 | } |
2674 | 2674 | } |
2675 | 2675 | |
2676 | 2676 | if ( 'install' !== $this->view_context ) { |
2677 | 2677 | if ( current_user_can( 'update_plugins' ) ) { |
2678 | - $actions['tgmpa-bulk-update'] = __( 'Update', 'tgmpa' ); |
|
2678 | + $actions[ 'tgmpa-bulk-update' ] = __( 'Update', 'tgmpa' ); |
|
2679 | 2679 | } |
2680 | 2680 | if ( current_user_can( 'activate_plugins' ) ) { |
2681 | - $actions['tgmpa-bulk-activate'] = __( 'Activate', 'tgmpa' ); |
|
2681 | + $actions[ 'tgmpa-bulk-activate' ] = __( 'Activate', 'tgmpa' ); |
|
2682 | 2682 | } |
2683 | 2683 | } |
2684 | 2684 | |
@@ -2697,7 +2697,7 @@ discard block |
||
2697 | 2697 | // Bulk installation process. |
2698 | 2698 | if ( 'tgmpa-bulk-install' === $this->current_action() || 'tgmpa-bulk-update' === $this->current_action() ) { |
2699 | 2699 | |
2700 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
2700 | + check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2701 | 2701 | |
2702 | 2702 | $install_type = 'install'; |
2703 | 2703 | if ( 'tgmpa-bulk-update' === $this->current_action() ) { |
@@ -2707,7 +2707,7 @@ discard block |
||
2707 | 2707 | $plugins_to_install = array(); |
2708 | 2708 | |
2709 | 2709 | // Did user actually select any plugins to install/update ? |
2710 | - if ( empty( $_POST['plugin'] ) ) { |
|
2710 | + if ( empty( $_POST[ 'plugin' ] ) ) { |
|
2711 | 2711 | if ( 'install' === $install_type ) { |
2712 | 2712 | $message = __( 'No plugins were selected to be installed. No action taken.', 'tgmpa' ); |
2713 | 2713 | } else { |
@@ -2719,11 +2719,11 @@ discard block |
||
2719 | 2719 | return false; |
2720 | 2720 | } |
2721 | 2721 | |
2722 | - if ( is_array( $_POST['plugin'] ) ) { |
|
2723 | - $plugins_to_install = (array) $_POST['plugin']; |
|
2724 | - } elseif ( is_string( $_POST['plugin'] ) ) { |
|
2722 | + if ( is_array( $_POST[ 'plugin' ] ) ) { |
|
2723 | + $plugins_to_install = (array) $_POST[ 'plugin' ]; |
|
2724 | + } elseif ( is_string( $_POST[ 'plugin' ] ) ) { |
|
2725 | 2725 | // Received via Filesystem page - un-flatten array (WP bug #19643). |
2726 | - $plugins_to_install = explode( ',', $_POST['plugin'] ); |
|
2726 | + $plugins_to_install = explode( ',', $_POST[ 'plugin' ] ); |
|
2727 | 2727 | } |
2728 | 2728 | |
2729 | 2729 | // Sanitize the received input. |
@@ -2765,11 +2765,11 @@ discard block |
||
2765 | 2765 | // Pass all necessary information if WP_Filesystem is needed. |
2766 | 2766 | $url = wp_nonce_url( |
2767 | 2767 | $this->tgmpa->get_tgmpa_url(), |
2768 | - 'bulk-' . $this->_args['plural'] |
|
2768 | + 'bulk-'.$this->_args[ 'plural' ] |
|
2769 | 2769 | ); |
2770 | 2770 | |
2771 | 2771 | // Give validated data back to $_POST which is the only place the filesystem looks for extra fields. |
2772 | - $_POST['plugin'] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
2772 | + $_POST[ 'plugin' ] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
2773 | 2773 | |
2774 | 2774 | $method = ''; // Leave blank so WP_Filesystem can populate it as necessary. |
2775 | 2775 | $fields = array_keys( $_POST ); // Extra fields to pass to WP_Filesystem. |
@@ -2796,22 +2796,22 @@ discard block |
||
2796 | 2796 | |
2797 | 2797 | // Prepare the data for validated plugins for the install/upgrade. |
2798 | 2798 | foreach ( $plugins_to_install as $slug ) { |
2799 | - $name = $this->tgmpa->plugins[ $slug ]['name']; |
|
2799 | + $name = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
2800 | 2800 | $source = $this->tgmpa->get_download_url( $slug ); |
2801 | 2801 | |
2802 | 2802 | if ( ! empty( $name ) && ! empty( $source ) ) { |
2803 | - $names[] = $name; |
|
2803 | + $names[ ] = $name; |
|
2804 | 2804 | |
2805 | 2805 | switch ( $install_type ) { |
2806 | 2806 | |
2807 | 2807 | case 'install': |
2808 | - $sources[] = $source; |
|
2808 | + $sources[ ] = $source; |
|
2809 | 2809 | break; |
2810 | 2810 | |
2811 | 2811 | case 'update': |
2812 | - $file_paths[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
2812 | + $file_paths[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
2813 | 2813 | $to_inject[ $slug ] = $this->tgmpa->plugins[ $slug ]; |
2814 | - $to_inject[ $slug ]['source'] = $source; |
|
2814 | + $to_inject[ $slug ][ 'source' ] = $source; |
|
2815 | 2815 | break; |
2816 | 2816 | } |
2817 | 2817 | } |
@@ -2823,7 +2823,7 @@ discard block |
||
2823 | 2823 | new TGMPA_Bulk_Installer_Skin( |
2824 | 2824 | array( |
2825 | 2825 | 'url' => esc_url_raw( $this->tgmpa->get_tgmpa_url() ), |
2826 | - 'nonce' => 'bulk-' . $this->_args['plural'], |
|
2826 | + 'nonce' => 'bulk-'.$this->_args[ 'plural' ], |
|
2827 | 2827 | 'names' => $names, |
2828 | 2828 | 'install_type' => $install_type, |
2829 | 2829 | ) |
@@ -2856,10 +2856,10 @@ discard block |
||
2856 | 2856 | |
2857 | 2857 | // Bulk activation process. |
2858 | 2858 | if ( 'tgmpa-bulk-activate' === $this->current_action() ) { |
2859 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
2859 | + check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2860 | 2860 | |
2861 | 2861 | // Did user actually select any plugins to activate ? |
2862 | - if ( empty( $_POST['plugin'] ) ) { |
|
2862 | + if ( empty( $_POST[ 'plugin' ] ) ) { |
|
2863 | 2863 | echo '<div id="message" class="error"><p>', esc_html__( 'No plugins were selected to be activated. No action taken.', 'tgmpa' ), '</p></div>'; |
2864 | 2864 | |
2865 | 2865 | return false; |
@@ -2867,8 +2867,8 @@ discard block |
||
2867 | 2867 | |
2868 | 2868 | // Grab plugin data from $_POST. |
2869 | 2869 | $plugins = array(); |
2870 | - if ( isset( $_POST['plugin'] ) ) { |
|
2871 | - $plugins = array_map( 'urldecode', (array) $_POST['plugin'] ); |
|
2870 | + if ( isset( $_POST[ 'plugin' ] ) ) { |
|
2871 | + $plugins = array_map( 'urldecode', (array) $_POST[ 'plugin' ] ); |
|
2872 | 2872 | $plugins = array_map( array( $this->tgmpa, 'sanitize_key' ), $plugins ); |
2873 | 2873 | } |
2874 | 2874 | |
@@ -2878,8 +2878,8 @@ discard block |
||
2878 | 2878 | // Grab the file paths for the selected & inactive plugins from the registration array. |
2879 | 2879 | foreach ( $plugins as $slug ) { |
2880 | 2880 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
2881 | - $plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
2882 | - $plugin_names[] = $this->tgmpa->plugins[ $slug ]['name']; |
|
2881 | + $plugins_to_activate[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
2882 | + $plugin_names[ ] = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
2883 | 2883 | } |
2884 | 2884 | } |
2885 | 2885 | unset( $slug ); |
@@ -2900,7 +2900,7 @@ discard block |
||
2900 | 2900 | $count = count( $plugin_names ); // Count so we can use _n function. |
2901 | 2901 | $plugin_names = array_map( array( 'TGMPA_Utils', 'wrap_in_strong' ), $plugin_names ); |
2902 | 2902 | $last_plugin = array_pop( $plugin_names ); // Pop off last name to prep for readability. |
2903 | - $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
2903 | + $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); |
|
2904 | 2904 | |
2905 | 2905 | printf( // WPCS: xss ok. |
2906 | 2906 | '<div id="message" class="updated"><p>%1$s %2$s.</p></div>', |
@@ -3003,16 +3003,16 @@ discard block |
||
3003 | 3003 | */ |
3004 | 3004 | function tgmpa_load_bulk_installer() { |
3005 | 3005 | // Silently fail if 2.5+ is loaded *after* an older version. |
3006 | - if ( ! isset( $GLOBALS['tgmpa'] ) ) { |
|
3006 | + if ( ! isset( $GLOBALS[ 'tgmpa' ] ) ) { |
|
3007 | 3007 | return; |
3008 | 3008 | } |
3009 | 3009 | |
3010 | 3010 | // Get TGMPA class instance. |
3011 | - $tgmpa_instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
3011 | + $tgmpa_instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3012 | 3012 | |
3013 | - if ( isset( $_GET['page'] ) && $tgmpa_instance->menu === $_GET['page'] ) { |
|
3013 | + if ( isset( $_GET[ 'page' ] ) && $tgmpa_instance->menu === $_GET[ 'page' ] ) { |
|
3014 | 3014 | if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
3015 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
3015 | + require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
3016 | 3016 | } |
3017 | 3017 | |
3018 | 3018 | if ( ! class_exists( 'TGMPA_Bulk_Installer' ) ) { |
@@ -3079,11 +3079,11 @@ discard block |
||
3079 | 3079 | */ |
3080 | 3080 | public function __construct( $skin = null ) { |
3081 | 3081 | // Get TGMPA class instance. |
3082 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
3082 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3083 | 3083 | |
3084 | 3084 | parent::__construct( $skin ); |
3085 | 3085 | |
3086 | - if ( isset( $this->skin->options['install_type'] ) && 'update' === $this->skin->options['install_type'] ) { |
|
3086 | + if ( isset( $this->skin->options[ 'install_type' ] ) && 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3087 | 3087 | $this->clear_destination = true; |
3088 | 3088 | } |
3089 | 3089 | |
@@ -3100,8 +3100,8 @@ discard block |
||
3100 | 3100 | * @since 2.2.0 |
3101 | 3101 | */ |
3102 | 3102 | public function activate_strings() { |
3103 | - $this->strings['activation_failed'] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
3104 | - $this->strings['activation_success'] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
3103 | + $this->strings[ 'activation_failed' ] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
3104 | + $this->strings[ 'activation_success' ] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
3105 | 3105 | } |
3106 | 3106 | |
3107 | 3107 | /** |
@@ -3119,7 +3119,7 @@ discard block |
||
3119 | 3119 | |
3120 | 3120 | // Reset the strings in case we changed one during automatic activation. |
3121 | 3121 | if ( $this->tgmpa->is_automatic ) { |
3122 | - if ( 'update' === $this->skin->options['install_type'] ) { |
|
3122 | + if ( 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3123 | 3123 | $this->upgrade_strings(); |
3124 | 3124 | } else { |
3125 | 3125 | $this->install_strings(); |
@@ -3274,7 +3274,7 @@ discard block |
||
3274 | 3274 | remove_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 ); |
3275 | 3275 | |
3276 | 3276 | // Force refresh of plugin update information. |
3277 | - wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); |
|
3277 | + wp_clean_plugins_cache( $parsed_args[ 'clear_update_cache' ] ); |
|
3278 | 3278 | |
3279 | 3279 | return $results; |
3280 | 3280 | } |
@@ -3325,13 +3325,13 @@ discard block |
||
3325 | 3325 | $activate = activate_plugin( $plugin_info ); |
3326 | 3326 | |
3327 | 3327 | // Adjust the success string based on the activation result. |
3328 | - $this->strings['process_success'] = $this->strings['process_success'] . "<br />\n"; |
|
3328 | + $this->strings[ 'process_success' ] = $this->strings[ 'process_success' ]."<br />\n"; |
|
3329 | 3329 | |
3330 | 3330 | if ( is_wp_error( $activate ) ) { |
3331 | 3331 | $this->skin->error( $activate ); |
3332 | - $this->strings['process_success'] .= $this->strings['activation_failed']; |
|
3332 | + $this->strings[ 'process_success' ] .= $this->strings[ 'activation_failed' ]; |
|
3333 | 3333 | } else { |
3334 | - $this->strings['process_success'] .= $this->strings['activation_success']; |
|
3334 | + $this->strings[ 'process_success' ] .= $this->strings[ 'activation_success' ]; |
|
3335 | 3335 | } |
3336 | 3336 | } |
3337 | 3337 | } |
@@ -3407,7 +3407,7 @@ discard block |
||
3407 | 3407 | */ |
3408 | 3408 | public function __construct( $args = array() ) { |
3409 | 3409 | // Get TGMPA class instance. |
3410 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
3410 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3411 | 3411 | |
3412 | 3412 | // Parse default and new args. |
3413 | 3413 | $defaults = array( |
@@ -3416,10 +3416,10 @@ discard block |
||
3416 | 3416 | 'names' => array(), |
3417 | 3417 | 'install_type' => 'install', |
3418 | 3418 | ); |
3419 | - $args = wp_parse_args( $args, $defaults ); |
|
3419 | + $args = wp_parse_args( $args, $defaults ); |
|
3420 | 3420 | |
3421 | 3421 | // Set plugin names to $this->plugin_names property. |
3422 | - $this->plugin_names = $args['names']; |
|
3422 | + $this->plugin_names = $args[ 'names' ]; |
|
3423 | 3423 | |
3424 | 3424 | // Extract the new args. |
3425 | 3425 | parent::__construct( $args ); |
@@ -3434,25 +3434,25 @@ discard block |
||
3434 | 3434 | * @since 2.2.0 |
3435 | 3435 | */ |
3436 | 3436 | public function add_strings() { |
3437 | - if ( 'update' === $this->options['install_type'] ) { |
|
3437 | + if ( 'update' === $this->options[ 'install_type' ] ) { |
|
3438 | 3438 | parent::add_strings(); |
3439 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3439 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3440 | 3440 | } else { |
3441 | - $this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
3442 | - $this->upgrader->strings['skin_update_failed'] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
3441 | + $this->upgrader->strings[ 'skin_update_failed_error' ] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
3442 | + $this->upgrader->strings[ 'skin_update_failed' ] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
3443 | 3443 | |
3444 | 3444 | if ( $this->tgmpa->is_automatic ) { |
3445 | 3445 | // Automatic activation strings. |
3446 | - $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' ); |
|
3447 | - $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>'; |
|
3448 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
3449 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3446 | + $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' ); |
|
3447 | + $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>'; |
|
3448 | + $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
3449 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3450 | 3450 | } else { |
3451 | 3451 | // Default installation strings. |
3452 | - $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' ); |
|
3453 | - $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>'; |
|
3454 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations have been completed.', 'tgmpa' ); |
|
3455 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3452 | + $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' ); |
|
3453 | + $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>'; |
|
3454 | + $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations have been completed.', 'tgmpa' ); |
|
3455 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3456 | 3456 | } |
3457 | 3457 | } |
3458 | 3458 | } |
@@ -3510,12 +3510,12 @@ discard block |
||
3510 | 3510 | if ( $this->tgmpa->is_tgmpa_complete() ) { |
3511 | 3511 | // All plugins are active, so we display the complete string and hide the menu to protect users. |
3512 | 3512 | echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
3513 | - $update_actions['dashboard'] = sprintf( |
|
3514 | - esc_html( $this->tgmpa->strings['complete'] ), |
|
3515 | - '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' |
|
3513 | + $update_actions[ 'dashboard' ] = sprintf( |
|
3514 | + esc_html( $this->tgmpa->strings[ 'complete' ] ), |
|
3515 | + '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' |
|
3516 | 3516 | ); |
3517 | 3517 | } else { |
3518 | - $update_actions['tgmpa_page'] = '<a href="' . esc_url( $this->tgmpa->get_tgmpa_url() ) . '" target="_parent">' . esc_html( $this->tgmpa->strings['return'] ) . '</a>'; |
|
3518 | + $update_actions[ 'tgmpa_page' ] = '<a href="'.esc_url( $this->tgmpa->get_tgmpa_url() ).'" target="_parent">'.esc_html( $this->tgmpa->strings[ 'return' ] ).'</a>'; |
|
3519 | 3519 | } |
3520 | 3520 | |
3521 | 3521 | /** |
@@ -3605,7 +3605,7 @@ discard block |
||
3605 | 3605 | * @return string |
3606 | 3606 | */ |
3607 | 3607 | public static function wrap_in_em( $string ) { |
3608 | - return '<em>' . wp_kses_post( $string ) . '</em>'; |
|
3608 | + return '<em>'.wp_kses_post( $string ).'</em>'; |
|
3609 | 3609 | } |
3610 | 3610 | |
3611 | 3611 | /** |
@@ -3619,7 +3619,7 @@ discard block |
||
3619 | 3619 | * @return string |
3620 | 3620 | */ |
3621 | 3621 | public static function wrap_in_strong( $string ) { |
3622 | - return '<strong>' . wp_kses_post( $string ) . '</strong>'; |
|
3622 | + return '<strong>'.wp_kses_post( $string ).'</strong>'; |
|
3623 | 3623 | } |
3624 | 3624 | |
3625 | 3625 | /** |
@@ -3656,7 +3656,7 @@ discard block |
||
3656 | 3656 | */ |
3657 | 3657 | protected static function emulate_filter_bool( $value ) { |
3658 | 3658 | // @codingStandardsIgnoreStart |
3659 | - static $true = array( |
|
3659 | + static $true = array( |
|
3660 | 3660 | '1', |
3661 | 3661 | 'true', 'True', 'TRUE', |
3662 | 3662 | 'y', 'Y', |