@@ -1892,7 +1892,7 @@ discard block |
||
1892 | 1892 | * |
1893 | 1893 | * @since 2.4.0 |
1894 | 1894 | * |
1895 | - * @return object The TGM_Plugin_Activation object. |
|
1895 | + * @return TGM_Plugin_Activation The TGM_Plugin_Activation object. |
|
1896 | 1896 | */ |
1897 | 1897 | public static function get_instance() { |
1898 | 1898 | if ( ! isset( self::$instance ) && ! ( self::$instance instanceof self ) ) { |
@@ -2049,7 +2049,7 @@ discard block |
||
2049 | 2049 | * |
2050 | 2050 | * @since 2.5.0 |
2051 | 2051 | * |
2052 | - * @return array CSS classnames. |
|
2052 | + * @return string[] CSS classnames. |
|
2053 | 2053 | */ |
2054 | 2054 | public function get_table_classes() { |
2055 | 2055 | return array( 'widefat', 'fixed' ); |
@@ -971,7 +971,8 @@ discard block |
||
971 | 971 | if ( ! $automatic ) { |
972 | 972 | // Make sure message doesn't display again if bulk activation is performed |
973 | 973 | // immediately after a single activation. |
974 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
974 | + if ( ! isset( $_POST['action'] ) ) { |
|
975 | +// WPCS: CSRF OK. |
|
975 | 976 | echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>'; |
976 | 977 | } |
977 | 978 | } else { |
@@ -992,7 +993,8 @@ discard block |
||
992 | 993 | if ( ! $automatic ) { |
993 | 994 | // Make sure message doesn't display again if bulk activation is performed |
994 | 995 | // immediately after a single activation. |
995 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
996 | + if ( ! isset( $_POST['action'] ) ) { |
|
997 | +// WPCS: CSRF OK. |
|
996 | 998 | echo '<div id="message" class="error"><p>', |
997 | 999 | sprintf( |
998 | 1000 | esc_html( $this->strings['plugin_needs_higher_version'] ), |
@@ -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 ) ); |
@@ -441,15 +441,15 @@ discard block |
||
441 | 441 | public function add_plugin_action_link_filters() { |
442 | 442 | foreach ( $this->plugins as $slug => $plugin ) { |
443 | 443 | if ( false === $this->can_plugin_activate( $slug ) ) { |
444 | - add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_activate' ), 20 ); |
|
444 | + add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_activate' ), 20 ); |
|
445 | 445 | } |
446 | 446 | |
447 | - if ( true === $plugin['force_activation'] ) { |
|
448 | - add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_deactivate' ), 20 ); |
|
447 | + if ( true === $plugin[ 'force_activation' ] ) { |
|
448 | + add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_deactivate' ), 20 ); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | if ( false !== $this->does_plugin_require_update( $slug ) ) { |
452 | - add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_update' ), 20 ); |
|
452 | + add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_update' ), 20 ); |
|
453 | 453 | } |
454 | 454 | } |
455 | 455 | } |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | * @return array |
465 | 465 | */ |
466 | 466 | public function filter_plugin_action_links_activate( $actions ) { |
467 | - unset( $actions['activate'] ); |
|
467 | + unset( $actions[ 'activate' ] ); |
|
468 | 468 | |
469 | 469 | return $actions; |
470 | 470 | } |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | * @return array |
479 | 479 | */ |
480 | 480 | public function filter_plugin_action_links_deactivate( $actions ) { |
481 | - unset( $actions['deactivate'] ); |
|
481 | + unset( $actions[ 'deactivate' ] ); |
|
482 | 482 | |
483 | 483 | return $actions; |
484 | 484 | } |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | * @return array |
494 | 494 | */ |
495 | 495 | public function filter_plugin_action_links_update( $actions ) { |
496 | - $actions['update'] = sprintf( |
|
496 | + $actions[ 'update' ] = sprintf( |
|
497 | 497 | '<a href="%1$s" title="%2$s" class="edit">%3$s</a>', |
498 | 498 | esc_url( $this->get_tgmpa_status_url( 'update' ) ), |
499 | 499 | esc_attr__( 'This plugin needs to be updated to be compatible with your theme.', 'tgmpa' ), |
@@ -531,9 +531,9 @@ discard block |
||
531 | 531 | return; |
532 | 532 | } |
533 | 533 | |
534 | - if ( isset( $_REQUEST['tab'] ) && 'plugin-information' === $_REQUEST['tab'] ) { |
|
534 | + if ( isset( $_REQUEST[ 'tab' ] ) && 'plugin-information' === $_REQUEST[ 'tab' ] ) { |
|
535 | 535 | // Needed for install_plugin_information(). |
536 | - require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
|
536 | + require_once ABSPATH.'wp-admin/includes/plugin-install.php'; |
|
537 | 537 | |
538 | 538 | wp_enqueue_style( 'plugin-install' ); |
539 | 539 | |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | * @since 2.1.0 |
562 | 562 | */ |
563 | 563 | public function thickbox() { |
564 | - if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) ) { |
|
564 | + if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, true ) ) { |
|
565 | 565 | add_thickbox(); |
566 | 566 | } |
567 | 567 | } |
@@ -590,11 +590,11 @@ discard block |
||
590 | 590 | $args = apply_filters( |
591 | 591 | 'tgmpa_admin_menu_args', |
592 | 592 | array( |
593 | - 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
594 | - 'page_title' => $this->strings['page_title'], // Page title. |
|
595 | - 'menu_title' => $this->strings['menu_title'], // Menu title. |
|
596 | - 'capability' => $this->capability, // Capability. |
|
597 | - 'menu_slug' => $this->menu, // Menu slug. |
|
593 | + 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
594 | + 'page_title' => $this->strings[ 'page_title' ], // Page title. |
|
595 | + 'menu_title' => $this->strings[ 'menu_title' ], // Menu title. |
|
596 | + 'capability' => $this->capability, // Capability. |
|
597 | + 'menu_slug' => $this->menu, // Menu slug. |
|
598 | 598 | 'function' => array( $this, 'install_plugins_page' ), // Callback. |
599 | 599 | ) |
600 | 600 | ); |
@@ -615,10 +615,10 @@ discard block |
||
615 | 615 | } |
616 | 616 | |
617 | 617 | if ( 'themes.php' === $this->parent_slug ) { |
618 | - $this->page_hook = call_user_func( 'add_theme_page', $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] ); |
|
618 | + $this->page_hook = call_user_func( 'add_theme_page', $args[ 'page_title' ], $args[ 'menu_title' ], $args[ 'capability' ], $args[ 'menu_slug' ], $args[ 'function' ] ); |
|
619 | 619 | } else { |
620 | 620 | $type = 'submenu'; |
621 | - $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'] ); |
|
621 | + $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 | 622 | } |
623 | 623 | } |
624 | 624 | |
@@ -687,37 +687,37 @@ discard block |
||
687 | 687 | * @return boolean True on success, false on failure. |
688 | 688 | */ |
689 | 689 | protected function do_plugin_install() { |
690 | - if ( empty( $_GET['plugin'] ) ) { |
|
690 | + if ( empty( $_GET[ 'plugin' ] ) ) { |
|
691 | 691 | return false; |
692 | 692 | } |
693 | 693 | |
694 | 694 | // All plugin information will be stored in an array for processing. |
695 | - $slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) ); |
|
695 | + $slug = $this->sanitize_key( urldecode( $_GET[ 'plugin' ] ) ); |
|
696 | 696 | |
697 | 697 | if ( ! isset( $this->plugins[ $slug ] ) ) { |
698 | 698 | return false; |
699 | 699 | } |
700 | 700 | |
701 | 701 | // Was an install or upgrade action link clicked? |
702 | - if ( ( isset( $_GET['tgmpa-install'] ) && 'install-plugin' === $_GET['tgmpa-install'] ) || ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) ) { |
|
702 | + if ( ( isset( $_GET[ 'tgmpa-install' ] ) && 'install-plugin' === $_GET[ 'tgmpa-install' ] ) || ( isset( $_GET[ 'tgmpa-update' ] ) && 'update-plugin' === $_GET[ 'tgmpa-update' ] ) ) { |
|
703 | 703 | |
704 | 704 | $install_type = 'install'; |
705 | - if ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) { |
|
705 | + if ( isset( $_GET[ 'tgmpa-update' ] ) && 'update-plugin' === $_GET[ 'tgmpa-update' ] ) { |
|
706 | 706 | $install_type = 'update'; |
707 | 707 | } |
708 | 708 | |
709 | - check_admin_referer( 'tgmpa-' . $install_type, 'tgmpa-nonce' ); |
|
709 | + check_admin_referer( 'tgmpa-'.$install_type, 'tgmpa-nonce' ); |
|
710 | 710 | |
711 | 711 | // Pass necessary information via URL if WP_Filesystem is needed. |
712 | 712 | $url = wp_nonce_url( |
713 | 713 | add_query_arg( |
714 | 714 | array( |
715 | 715 | 'plugin' => urlencode( $slug ), |
716 | - 'tgmpa-' . $install_type => $install_type . '-plugin', |
|
716 | + 'tgmpa-'.$install_type => $install_type.'-plugin', |
|
717 | 717 | ), |
718 | 718 | $this->get_tgmpa_url() |
719 | 719 | ), |
720 | - 'tgmpa-' . $install_type, |
|
720 | + 'tgmpa-'.$install_type, |
|
721 | 721 | 'tgmpa-nonce' |
722 | 722 | ); |
723 | 723 | |
@@ -736,35 +736,35 @@ discard block |
||
736 | 736 | |
737 | 737 | // Prep variables for Plugin_Installer_Skin class. |
738 | 738 | $extra = array(); |
739 | - $extra['slug'] = $slug; // Needed for potentially renaming of directory name. |
|
739 | + $extra[ 'slug' ] = $slug; // Needed for potentially renaming of directory name. |
|
740 | 740 | $source = $this->get_download_url( $slug ); |
741 | - $api = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null; |
|
741 | + $api = ( 'repo' === $this->plugins[ $slug ][ 'source_type' ] ) ? $this->get_plugins_api( $slug ) : null; |
|
742 | 742 | $api = ( false !== $api ) ? $api : null; |
743 | 743 | |
744 | 744 | $url = add_query_arg( |
745 | 745 | array( |
746 | - 'action' => $install_type . '-plugin', |
|
746 | + 'action' => $install_type.'-plugin', |
|
747 | 747 | 'plugin' => urlencode( $slug ), |
748 | 748 | ), |
749 | 749 | 'update.php' |
750 | 750 | ); |
751 | 751 | |
752 | 752 | if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
753 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
753 | + require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
754 | 754 | } |
755 | 755 | |
756 | 756 | $skin_args = array( |
757 | - 'type' => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload', |
|
758 | - 'title' => sprintf( $this->strings['installing'], $this->plugins[ $slug ]['name'] ), |
|
757 | + 'type' => ( 'bundled' !== $this->plugins[ $slug ][ 'source_type' ] ) ? 'web' : 'upload', |
|
758 | + 'title' => sprintf( $this->strings[ 'installing' ], $this->plugins[ $slug ][ 'name' ] ), |
|
759 | 759 | 'url' => esc_url_raw( $url ), |
760 | - 'nonce' => $install_type . '-plugin_' . $slug, |
|
760 | + 'nonce' => $install_type.'-plugin_'.$slug, |
|
761 | 761 | 'plugin' => '', |
762 | 762 | 'api' => $api, |
763 | 763 | 'extra' => $extra, |
764 | 764 | ); |
765 | 765 | |
766 | 766 | if ( 'update' === $install_type ) { |
767 | - $skin_args['plugin'] = $this->plugins[ $slug ]['file_path']; |
|
767 | + $skin_args[ 'plugin' ] = $this->plugins[ $slug ][ 'file_path' ]; |
|
768 | 768 | $skin = new Plugin_Upgrader_Skin( $skin_args ); |
769 | 769 | } else { |
770 | 770 | $skin = new Plugin_Installer_Skin( $skin_args ); |
@@ -779,10 +779,10 @@ discard block |
||
779 | 779 | if ( 'update' === $install_type ) { |
780 | 780 | // Inject our info into the update transient. |
781 | 781 | $to_inject = array( $slug => $this->plugins[ $slug ] ); |
782 | - $to_inject[ $slug ]['source'] = $source; |
|
782 | + $to_inject[ $slug ][ 'source' ] = $source; |
|
783 | 783 | $this->inject_update_info( $to_inject ); |
784 | 784 | |
785 | - $upgrader->upgrade( $this->plugins[ $slug ]['file_path'] ); |
|
785 | + $upgrader->upgrade( $this->plugins[ $slug ][ 'file_path' ] ); |
|
786 | 786 | } else { |
787 | 787 | $upgrader->install( $source ); |
788 | 788 | } |
@@ -805,18 +805,18 @@ discard block |
||
805 | 805 | |
806 | 806 | // Display message based on if all plugins are now active or not. |
807 | 807 | if ( $this->is_tgmpa_complete() ) { |
808 | - echo '<p>', sprintf( esc_html( $this->strings['complete'] ), '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' ), '</p>'; |
|
808 | + echo '<p>', sprintf( esc_html( $this->strings[ 'complete' ] ), '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' ), '</p>'; |
|
809 | 809 | echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
810 | 810 | } else { |
811 | - echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; |
|
811 | + echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings[ 'return' ] ), '</a></p>'; |
|
812 | 812 | } |
813 | 813 | |
814 | 814 | return true; |
815 | - } elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) { |
|
815 | + } elseif ( isset( $this->plugins[ $slug ][ 'file_path' ], $_GET[ 'tgmpa-activate' ] ) && 'activate-plugin' === $_GET[ 'tgmpa-activate' ] ) { |
|
816 | 816 | // Activate action link was clicked. |
817 | 817 | check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' ); |
818 | 818 | |
819 | - if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) { |
|
819 | + if ( false === $this->activate_single_plugin( $this->plugins[ $slug ][ 'file_path' ], $slug ) ) { |
|
820 | 820 | return true; // Finish execution of the function early as we encountered an error. |
821 | 821 | } |
822 | 822 | } |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | } |
840 | 840 | |
841 | 841 | foreach ( $plugins as $slug => $plugin ) { |
842 | - $file_path = $plugin['file_path']; |
|
842 | + $file_path = $plugin[ 'file_path' ]; |
|
843 | 843 | |
844 | 844 | if ( empty( $repo_updates->response[ $file_path ] ) ) { |
845 | 845 | $repo_updates->response[ $file_path ] = new stdClass; |
@@ -848,10 +848,10 @@ discard block |
||
848 | 848 | // We only really need to set package, but let's do all we can in case WP changes something. |
849 | 849 | $repo_updates->response[ $file_path ]->slug = $slug; |
850 | 850 | $repo_updates->response[ $file_path ]->plugin = $file_path; |
851 | - $repo_updates->response[ $file_path ]->new_version = $plugin['version']; |
|
852 | - $repo_updates->response[ $file_path ]->package = $plugin['source']; |
|
853 | - if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) { |
|
854 | - $repo_updates->response[ $file_path ]->url = $plugin['external_url']; |
|
851 | + $repo_updates->response[ $file_path ]->new_version = $plugin[ 'version' ]; |
|
852 | + $repo_updates->response[ $file_path ]->package = $plugin[ 'source' ]; |
|
853 | + if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin[ 'external_url' ] ) ) { |
|
854 | + $repo_updates->response[ $file_path ]->url = $plugin[ 'external_url' ]; |
|
855 | 855 | } |
856 | 856 | } |
857 | 857 | |
@@ -875,13 +875,13 @@ discard block |
||
875 | 875 | * @return string $source |
876 | 876 | */ |
877 | 877 | public function maybe_adjust_source_dir( $source, $remote_source, $upgrader ) { |
878 | - if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS['wp_filesystem'] ) ) { |
|
878 | + if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS[ 'wp_filesystem' ] ) ) { |
|
879 | 879 | return $source; |
880 | 880 | } |
881 | 881 | |
882 | 882 | // Check for single file plugins. |
883 | - $source_files = array_keys( $GLOBALS['wp_filesystem']->dirlist( $remote_source ) ); |
|
884 | - if ( 1 === count( $source_files ) && false === $GLOBALS['wp_filesystem']->is_dir( $source ) ) { |
|
883 | + $source_files = array_keys( $GLOBALS[ 'wp_filesystem' ]->dirlist( $remote_source ) ); |
|
884 | + if ( 1 === count( $source_files ) && false === $GLOBALS[ 'wp_filesystem' ]->is_dir( $source ) ) { |
|
885 | 885 | return $source; |
886 | 886 | } |
887 | 887 | |
@@ -889,12 +889,12 @@ discard block |
||
889 | 889 | $desired_slug = ''; |
890 | 890 | |
891 | 891 | // Figure out what the slug is supposed to be. |
892 | - if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options['extra']['slug'] ) ) { |
|
893 | - $desired_slug = $upgrader->skin->options['extra']['slug']; |
|
892 | + if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options[ 'extra' ][ 'slug' ] ) ) { |
|
893 | + $desired_slug = $upgrader->skin->options[ 'extra' ][ 'slug' ]; |
|
894 | 894 | } else { |
895 | 895 | // Bulk installer contains less info, so fall back on the info registered here. |
896 | 896 | foreach ( $this->plugins as $slug => $plugin ) { |
897 | - if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
|
897 | + if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin[ 'name' ] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
|
898 | 898 | $desired_slug = $slug; |
899 | 899 | break; |
900 | 900 | } |
@@ -907,15 +907,15 @@ discard block |
||
907 | 907 | |
908 | 908 | if ( ! empty( $subdir_name ) && $subdir_name !== $desired_slug ) { |
909 | 909 | $from = untrailingslashit( $source ); |
910 | - $to = trailingslashit( $remote_source ) . $desired_slug; |
|
910 | + $to = trailingslashit( $remote_source ).$desired_slug; |
|
911 | 911 | |
912 | - if ( true === $GLOBALS['wp_filesystem']->move( $from, $to ) ) { |
|
912 | + if ( true === $GLOBALS[ 'wp_filesystem' ]->move( $from, $to ) ) { |
|
913 | 913 | return trailingslashit( $to ); |
914 | 914 | } else { |
915 | - 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 ) ); |
|
915 | + 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 ) ); |
|
916 | 916 | } |
917 | 917 | } elseif ( empty( $subdir_name ) ) { |
918 | - 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 ) ); |
|
918 | + 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 ) ); |
|
919 | 919 | } |
920 | 920 | } |
921 | 921 | |
@@ -939,19 +939,19 @@ discard block |
||
939 | 939 | |
940 | 940 | if ( is_wp_error( $activate ) ) { |
941 | 941 | echo '<div id="message" class="error"><p>', wp_kses_post( $activate->get_error_message() ), '</p></div>', |
942 | - '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; |
|
942 | + '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings[ 'return' ] ), '</a></p>'; |
|
943 | 943 | |
944 | 944 | return false; // End it here if there is an error with activation. |
945 | 945 | } else { |
946 | 946 | if ( ! $automatic ) { |
947 | 947 | // Make sure message doesn't display again if bulk activation is performed |
948 | 948 | // immediately after a single activation. |
949 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
950 | - echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>'; |
|
949 | + if ( ! isset( $_POST[ 'action' ] ) ) { // WPCS: CSRF OK. |
|
950 | + echo '<div id="message" class="updated"><p>', esc_html( $this->strings[ 'activated_successfully' ] ), ' <strong>', esc_html( $this->plugins[ $slug ][ 'name' ] ), '.</strong></p></div>'; |
|
951 | 951 | } |
952 | 952 | } else { |
953 | 953 | // Simpler message layout for use on the plugin install page. |
954 | - echo '<p>', esc_html( $this->strings['plugin_activated'] ), '</p>'; |
|
954 | + echo '<p>', esc_html( $this->strings[ 'plugin_activated' ] ), '</p>'; |
|
955 | 955 | } |
956 | 956 | } |
957 | 957 | } elseif ( $this->is_plugin_active( $slug ) ) { |
@@ -959,25 +959,25 @@ discard block |
||
959 | 959 | // on the plugin install page. |
960 | 960 | echo '<div id="message" class="error"><p>', |
961 | 961 | sprintf( |
962 | - esc_html( $this->strings['plugin_already_active'] ), |
|
963 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
962 | + esc_html( $this->strings[ 'plugin_already_active' ] ), |
|
963 | + '<strong>'.esc_html( $this->plugins[ $slug ][ 'name' ] ).'</strong>' |
|
964 | 964 | ), |
965 | 965 | '</p></div>'; |
966 | 966 | } elseif ( $this->does_plugin_require_update( $slug ) ) { |
967 | 967 | if ( ! $automatic ) { |
968 | 968 | // Make sure message doesn't display again if bulk activation is performed |
969 | 969 | // immediately after a single activation. |
970 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
970 | + if ( ! isset( $_POST[ 'action' ] ) ) { // WPCS: CSRF OK. |
|
971 | 971 | echo '<div id="message" class="error"><p>', |
972 | 972 | sprintf( |
973 | - esc_html( $this->strings['plugin_needs_higher_version'] ), |
|
974 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
973 | + esc_html( $this->strings[ 'plugin_needs_higher_version' ] ), |
|
974 | + '<strong>'.esc_html( $this->plugins[ $slug ][ 'name' ] ).'</strong>' |
|
975 | 975 | ), |
976 | 976 | '</p></div>'; |
977 | 977 | } |
978 | 978 | } else { |
979 | 979 | // Simpler message layout for use on the plugin install page. |
980 | - echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>'; |
|
980 | + echo '<p>', sprintf( esc_html( $this->strings[ 'plugin_needs_higher_version' ] ), esc_html( $this->plugins[ $slug ][ 'name' ] ) ), '</p>'; |
|
981 | 981 | } |
982 | 982 | } |
983 | 983 | |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | */ |
1002 | 1002 | public function notices() { |
1003 | 1003 | // Remove nag on the install page / Return early if the nag message has been dismissed or user < author. |
1004 | - 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' ) ) ) { |
|
1004 | + 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' ) ) ) { |
|
1005 | 1005 | return; |
1006 | 1006 | } |
1007 | 1007 | |
@@ -1023,13 +1023,13 @@ discard block |
||
1023 | 1023 | if ( current_user_can( 'install_plugins' ) ) { |
1024 | 1024 | $install_link_count++; |
1025 | 1025 | |
1026 | - if ( true === $plugin['required'] ) { |
|
1027 | - $message['notice_can_install_required'][] = $slug; |
|
1026 | + if ( true === $plugin[ 'required' ] ) { |
|
1027 | + $message[ 'notice_can_install_required' ][ ] = $slug; |
|
1028 | 1028 | } else { |
1029 | - $message['notice_can_install_recommended'][] = $slug; |
|
1029 | + $message[ 'notice_can_install_recommended' ][ ] = $slug; |
|
1030 | 1030 | } |
1031 | 1031 | } |
1032 | - if ( true === $plugin['required'] ) { |
|
1032 | + if ( true === $plugin[ 'required' ] ) { |
|
1033 | 1033 | $total_required_action_count++; |
1034 | 1034 | } |
1035 | 1035 | } else { |
@@ -1037,13 +1037,13 @@ discard block |
||
1037 | 1037 | if ( current_user_can( 'activate_plugins' ) ) { |
1038 | 1038 | $activate_link_count++; |
1039 | 1039 | |
1040 | - if ( true === $plugin['required'] ) { |
|
1041 | - $message['notice_can_activate_required'][] = $slug; |
|
1040 | + if ( true === $plugin[ 'required' ] ) { |
|
1041 | + $message[ 'notice_can_activate_required' ][ ] = $slug; |
|
1042 | 1042 | } else { |
1043 | - $message['notice_can_activate_recommended'][] = $slug; |
|
1043 | + $message[ 'notice_can_activate_recommended' ][ ] = $slug; |
|
1044 | 1044 | } |
1045 | 1045 | } |
1046 | - if ( true === $plugin['required'] ) { |
|
1046 | + if ( true === $plugin[ 'required' ] ) { |
|
1047 | 1047 | $total_required_action_count++; |
1048 | 1048 | } |
1049 | 1049 | } |
@@ -1054,12 +1054,12 @@ discard block |
||
1054 | 1054 | $update_link_count++; |
1055 | 1055 | |
1056 | 1056 | if ( $this->does_plugin_require_update( $slug ) ) { |
1057 | - $message['notice_ask_to_update'][] = $slug; |
|
1057 | + $message[ 'notice_ask_to_update' ][ ] = $slug; |
|
1058 | 1058 | } elseif ( false !== $this->does_plugin_have_update( $slug ) ) { |
1059 | - $message['notice_ask_to_update_maybe'][] = $slug; |
|
1059 | + $message[ 'notice_ask_to_update_maybe' ][ ] = $slug; |
|
1060 | 1060 | } |
1061 | 1061 | } |
1062 | - if ( true === $plugin['required'] ) { |
|
1062 | + if ( true === $plugin[ 'required' ] ) { |
|
1063 | 1063 | $total_required_action_count++; |
1064 | 1064 | } |
1065 | 1065 | } |
@@ -1074,10 +1074,10 @@ discard block |
||
1074 | 1074 | |
1075 | 1075 | // As add_settings_error() wraps the final message in a <p> and as the final message can't be |
1076 | 1076 | // filtered, using <p>'s in our html would render invalid html output. |
1077 | - $line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>' . "\n"; |
|
1077 | + $line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>'."\n"; |
|
1078 | 1078 | |
1079 | 1079 | if ( ! current_user_can( 'activate_plugins' ) && ! current_user_can( 'install_plugins' ) && ! current_user_can( 'update_plugins' ) ) { |
1080 | - $rendered = esc_html__( $this->strings['notice_cannot_install_activate'] . ' ' . $this->strings['contact_admin'] ); |
|
1080 | + $rendered = esc_html__( $this->strings[ 'notice_cannot_install_activate' ].' '.$this->strings[ 'contact_admin' ] ); |
|
1081 | 1081 | $rendered .= $this->create_user_action_links_for_notice( 0, 0, 0, $line_template ); |
1082 | 1082 | } else { |
1083 | 1083 | |
@@ -1092,14 +1092,14 @@ discard block |
||
1092 | 1092 | |
1093 | 1093 | // Get the external info link for a plugin if one is available. |
1094 | 1094 | foreach ( $plugin_group as $plugin_slug ) { |
1095 | - $linked_plugins[] = $this->get_info_link( $plugin_slug ); |
|
1095 | + $linked_plugins[ ] = $this->get_info_link( $plugin_slug ); |
|
1096 | 1096 | } |
1097 | 1097 | unset( $plugin_slug ); |
1098 | 1098 | |
1099 | 1099 | $count = count( $plugin_group ); |
1100 | 1100 | $linked_plugins = array_map( array( 'TGMPA_Utils', 'wrap_in_em' ), $linked_plugins ); |
1101 | 1101 | $last_plugin = array_pop( $linked_plugins ); // Pop off last name to prep for readability. |
1102 | - $imploded = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
1102 | + $imploded = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); |
|
1103 | 1103 | |
1104 | 1104 | $rendered .= sprintf( |
1105 | 1105 | $line_template, |
@@ -1121,7 +1121,7 @@ discard block |
||
1121 | 1121 | } |
1122 | 1122 | |
1123 | 1123 | // Admin options pages already output settings_errors, so this is to avoid duplication. |
1124 | - if ( 'options-general' !== $GLOBALS['current_screen']->parent_base ) { |
|
1124 | + if ( 'options-general' !== $GLOBALS[ 'current_screen' ]->parent_base ) { |
|
1125 | 1125 | $this->display_settings_errors(); |
1126 | 1126 | } |
1127 | 1127 | } |
@@ -1143,32 +1143,32 @@ discard block |
||
1143 | 1143 | 'install' => '', |
1144 | 1144 | 'update' => '', |
1145 | 1145 | 'activate' => '', |
1146 | - '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>' : '', |
|
1146 | + '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>' : '', |
|
1147 | 1147 | ); |
1148 | 1148 | |
1149 | 1149 | $link_template = '<a href="%2$s">%1$s</a>'; |
1150 | 1150 | |
1151 | 1151 | if ( current_user_can( 'install_plugins' ) ) { |
1152 | 1152 | if ( $install_link_count > 0 ) { |
1153 | - $action_links['install'] = sprintf( |
|
1153 | + $action_links[ 'install' ] = sprintf( |
|
1154 | 1154 | $link_template, |
1155 | - translate_nooped_plural( $this->strings['install_link'], $install_link_count, 'tgmpa' ), |
|
1155 | + translate_nooped_plural( $this->strings[ 'install_link' ], $install_link_count, 'tgmpa' ), |
|
1156 | 1156 | esc_url( $this->get_tgmpa_status_url( 'install' ) ) |
1157 | 1157 | ); |
1158 | 1158 | } |
1159 | 1159 | if ( $update_link_count > 0 ) { |
1160 | - $action_links['update'] = sprintf( |
|
1160 | + $action_links[ 'update' ] = sprintf( |
|
1161 | 1161 | $link_template, |
1162 | - translate_nooped_plural( $this->strings['update_link'], $update_link_count, 'tgmpa' ), |
|
1162 | + translate_nooped_plural( $this->strings[ 'update_link' ], $update_link_count, 'tgmpa' ), |
|
1163 | 1163 | esc_url( $this->get_tgmpa_status_url( 'update' ) ) |
1164 | 1164 | ); |
1165 | 1165 | } |
1166 | 1166 | } |
1167 | 1167 | |
1168 | 1168 | if ( current_user_can( 'activate_plugins' ) && $activate_link_count > 0 ) { |
1169 | - $action_links['activate'] = sprintf( |
|
1169 | + $action_links[ 'activate' ] = sprintf( |
|
1170 | 1170 | $link_template, |
1171 | - translate_nooped_plural( $this->strings['activate_link'], $activate_link_count, 'tgmpa' ), |
|
1171 | + translate_nooped_plural( $this->strings[ 'activate_link' ], $activate_link_count, 'tgmpa' ), |
|
1172 | 1172 | esc_url( $this->get_tgmpa_status_url( 'activate' ) ) |
1173 | 1173 | ); |
1174 | 1174 | } |
@@ -1196,8 +1196,8 @@ discard block |
||
1196 | 1196 | * @return string |
1197 | 1197 | */ |
1198 | 1198 | protected function get_admin_notice_class() { |
1199 | - if ( ! empty( $this->strings['nag_type'] ) ) { |
|
1200 | - return sanitize_html_class( strtolower( $this->strings['nag_type'] ) ); |
|
1199 | + if ( ! empty( $this->strings[ 'nag_type' ] ) ) { |
|
1200 | + return sanitize_html_class( strtolower( $this->strings[ 'nag_type' ] ) ); |
|
1201 | 1201 | } else { |
1202 | 1202 | if ( version_compare( $this->wp_version, '4.2', '>=' ) ) { |
1203 | 1203 | return 'notice-warning'; |
@@ -1220,7 +1220,7 @@ discard block |
||
1220 | 1220 | settings_errors( 'tgmpa' ); |
1221 | 1221 | |
1222 | 1222 | foreach ( (array) $wp_settings_errors as $key => $details ) { |
1223 | - if ( 'tgmpa' === $details['setting'] ) { |
|
1223 | + if ( 'tgmpa' === $details[ 'setting' ] ) { |
|
1224 | 1224 | unset( $wp_settings_errors[ $key ] ); |
1225 | 1225 | break; |
1226 | 1226 | } |
@@ -1235,8 +1235,8 @@ discard block |
||
1235 | 1235 | * @since 2.1.0 |
1236 | 1236 | */ |
1237 | 1237 | public function dismiss() { |
1238 | - if ( isset( $_GET['tgmpa-dismiss'] ) && check_admin_referer( 'tgmpa-dismis-' . get_current_user_id() ) ) { |
|
1239 | - update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, 1 ); |
|
1238 | + if ( isset( $_GET[ 'tgmpa-dismiss' ] ) && check_admin_referer( 'tgmpa-dismis-'.get_current_user_id() ) ) { |
|
1239 | + update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, 1 ); |
|
1240 | 1240 | } |
1241 | 1241 | } |
1242 | 1242 | |
@@ -1252,54 +1252,54 @@ discard block |
||
1252 | 1252 | * @return null Return early if incorrect argument. |
1253 | 1253 | */ |
1254 | 1254 | public function register( $plugin ) { |
1255 | - if ( empty( $plugin['slug'] ) || empty( $plugin['name'] ) ) { |
|
1255 | + if ( empty( $plugin[ 'slug' ] ) || empty( $plugin[ 'name' ] ) ) { |
|
1256 | 1256 | return; |
1257 | 1257 | } |
1258 | 1258 | |
1259 | - if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) { |
|
1259 | + if ( empty( $plugin[ 'slug' ] ) || ! is_string( $plugin[ 'slug' ] ) || isset( $this->plugins[ $plugin[ 'slug' ] ] ) ) { |
|
1260 | 1260 | return; |
1261 | 1261 | } |
1262 | 1262 | |
1263 | 1263 | $defaults = array( |
1264 | - 'name' => '', // String |
|
1265 | - 'slug' => '', // String |
|
1266 | - 'source' => 'repo', // String |
|
1267 | - 'required' => false, // Boolean |
|
1268 | - 'version' => '', // String |
|
1269 | - 'force_activation' => false, // Boolean |
|
1270 | - 'force_deactivation' => false, // Boolean |
|
1271 | - 'external_url' => '', // String |
|
1272 | - 'is_callable' => '', // String|Array. |
|
1264 | + 'name' => '', // String |
|
1265 | + 'slug' => '', // String |
|
1266 | + 'source' => 'repo', // String |
|
1267 | + 'required' => false, // Boolean |
|
1268 | + 'version' => '', // String |
|
1269 | + 'force_activation' => false, // Boolean |
|
1270 | + 'force_deactivation' => false, // Boolean |
|
1271 | + 'external_url' => '', // String |
|
1272 | + 'is_callable' => '', // String|Array. |
|
1273 | 1273 | ); |
1274 | 1274 | |
1275 | 1275 | // Prepare the received data. |
1276 | 1276 | $plugin = wp_parse_args( $plugin, $defaults ); |
1277 | 1277 | |
1278 | 1278 | // Standardize the received slug. |
1279 | - $plugin['slug'] = $this->sanitize_key( $plugin['slug'] ); |
|
1279 | + $plugin[ 'slug' ] = $this->sanitize_key( $plugin[ 'slug' ] ); |
|
1280 | 1280 | |
1281 | 1281 | // Forgive users for using string versions of booleans or floats for version number. |
1282 | - $plugin['version'] = (string) $plugin['version']; |
|
1283 | - $plugin['source'] = empty( $plugin['source'] ) ? 'repo' : $plugin['source']; |
|
1284 | - $plugin['required'] = TGMPA_Utils::validate_bool( $plugin['required'] ); |
|
1285 | - $plugin['force_activation'] = TGMPA_Utils::validate_bool( $plugin['force_activation'] ); |
|
1286 | - $plugin['force_deactivation'] = TGMPA_Utils::validate_bool( $plugin['force_deactivation'] ); |
|
1282 | + $plugin[ 'version' ] = (string) $plugin[ 'version' ]; |
|
1283 | + $plugin[ 'source' ] = empty( $plugin[ 'source' ] ) ? 'repo' : $plugin[ 'source' ]; |
|
1284 | + $plugin[ 'required' ] = TGMPA_Utils::validate_bool( $plugin[ 'required' ] ); |
|
1285 | + $plugin[ 'force_activation' ] = TGMPA_Utils::validate_bool( $plugin[ 'force_activation' ] ); |
|
1286 | + $plugin[ 'force_deactivation' ] = TGMPA_Utils::validate_bool( $plugin[ 'force_deactivation' ] ); |
|
1287 | 1287 | |
1288 | 1288 | // Enrich the received data. |
1289 | - $plugin['file_path'] = $this->_get_plugin_basename_from_slug( $plugin['slug'] ); |
|
1290 | - $plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] ); |
|
1289 | + $plugin[ 'file_path' ] = $this->_get_plugin_basename_from_slug( $plugin[ 'slug' ] ); |
|
1290 | + $plugin[ 'source_type' ] = $this->get_plugin_source_type( $plugin[ 'source' ] ); |
|
1291 | 1291 | |
1292 | 1292 | // Set the class properties. |
1293 | - $this->plugins[ $plugin['slug'] ] = $plugin; |
|
1294 | - $this->sort_order[ $plugin['slug'] ] = $plugin['name']; |
|
1293 | + $this->plugins[ $plugin[ 'slug' ] ] = $plugin; |
|
1294 | + $this->sort_order[ $plugin[ 'slug' ] ] = $plugin[ 'name' ]; |
|
1295 | 1295 | |
1296 | 1296 | // Should we add the force activation hook ? |
1297 | - if ( true === $plugin['force_activation'] ) { |
|
1297 | + if ( true === $plugin[ 'force_activation' ] ) { |
|
1298 | 1298 | $this->has_forced_activation = true; |
1299 | 1299 | } |
1300 | 1300 | |
1301 | 1301 | // Should we add the force deactivation hook ? |
1302 | - if ( true === $plugin['force_deactivation'] ) { |
|
1302 | + if ( true === $plugin[ 'force_deactivation' ] ) { |
|
1303 | 1303 | $this->has_forced_deactivation = true; |
1304 | 1304 | } |
1305 | 1305 | } |
@@ -1425,11 +1425,11 @@ discard block |
||
1425 | 1425 | */ |
1426 | 1426 | public function populate_file_path( $plugin_slug = '' ) { |
1427 | 1427 | if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) { |
1428 | - $this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
1428 | + $this->plugins[ $plugin_slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
1429 | 1429 | } else { |
1430 | 1430 | // Add file_path key for all plugins. |
1431 | 1431 | foreach ( $this->plugins as $slug => $values ) { |
1432 | - $this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug ); |
|
1432 | + $this->plugins[ $slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $slug ); |
|
1433 | 1433 | } |
1434 | 1434 | } |
1435 | 1435 | } |
@@ -1447,7 +1447,7 @@ discard block |
||
1447 | 1447 | $keys = array_keys( $this->get_plugins() ); |
1448 | 1448 | |
1449 | 1449 | foreach ( $keys as $key ) { |
1450 | - if ( preg_match( '|^' . $slug . '/|', $key ) ) { |
|
1450 | + if ( preg_match( '|^'.$slug.'/|', $key ) ) { |
|
1451 | 1451 | return $key; |
1452 | 1452 | } |
1453 | 1453 | } |
@@ -1469,7 +1469,7 @@ discard block |
||
1469 | 1469 | */ |
1470 | 1470 | public function _get_plugin_data_from_name( $name, $data = 'slug' ) { |
1471 | 1471 | foreach ( $this->plugins as $values ) { |
1472 | - if ( $name === $values['name'] && isset( $values[ $data ] ) ) { |
|
1472 | + if ( $name === $values[ 'name' ] && isset( $values[ $data ] ) ) { |
|
1473 | 1473 | return $values[ $data ]; |
1474 | 1474 | } |
1475 | 1475 | } |
@@ -1488,13 +1488,13 @@ discard block |
||
1488 | 1488 | public function get_download_url( $slug ) { |
1489 | 1489 | $dl_source = ''; |
1490 | 1490 | |
1491 | - switch ( $this->plugins[ $slug ]['source_type'] ) { |
|
1491 | + switch ( $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1492 | 1492 | case 'repo': |
1493 | 1493 | return $this->get_wp_repo_download_url( $slug ); |
1494 | 1494 | case 'external': |
1495 | - return $this->plugins[ $slug ]['source']; |
|
1495 | + return $this->plugins[ $slug ][ 'source' ]; |
|
1496 | 1496 | case 'bundled': |
1497 | - return $this->default_path . $this->plugins[ $slug ]['source']; |
|
1497 | + return $this->default_path.$this->plugins[ $slug ][ 'source' ]; |
|
1498 | 1498 | } |
1499 | 1499 | |
1500 | 1500 | return $dl_source; // Should never happen. |
@@ -1532,7 +1532,7 @@ discard block |
||
1532 | 1532 | |
1533 | 1533 | if ( ! isset( $api[ $slug ] ) ) { |
1534 | 1534 | if ( ! function_exists( 'plugins_api' ) ) { |
1535 | - require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
|
1535 | + require_once ABSPATH.'wp-admin/includes/plugin-install.php'; |
|
1536 | 1536 | } |
1537 | 1537 | |
1538 | 1538 | $response = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ) ) ); |
@@ -1540,7 +1540,7 @@ discard block |
||
1540 | 1540 | $api[ $slug ] = false; |
1541 | 1541 | |
1542 | 1542 | if ( is_wp_error( $response ) ) { |
1543 | - wp_die( esc_html( $this->strings['oops'] ) ); |
|
1543 | + wp_die( esc_html( $this->strings[ 'oops' ] ) ); |
|
1544 | 1544 | } else { |
1545 | 1545 | $api[ $slug ] = $response; |
1546 | 1546 | } |
@@ -1559,13 +1559,13 @@ discard block |
||
1559 | 1559 | * or the plugin name if not. |
1560 | 1560 | */ |
1561 | 1561 | public function get_info_link( $slug ) { |
1562 | - if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) { |
|
1562 | + if ( ! empty( $this->plugins[ $slug ][ 'external_url' ] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ][ 'external_url' ] ) ) { |
|
1563 | 1563 | $link = sprintf( |
1564 | 1564 | '<a href="%1$s" target="_blank">%2$s</a>', |
1565 | - esc_url( $this->plugins[ $slug ]['external_url'] ), |
|
1566 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
1565 | + esc_url( $this->plugins[ $slug ][ 'external_url' ] ), |
|
1566 | + esc_html( $this->plugins[ $slug ][ 'name' ] ) |
|
1567 | 1567 | ); |
1568 | - } elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) { |
|
1568 | + } elseif ( 'repo' === $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1569 | 1569 | $url = add_query_arg( |
1570 | 1570 | array( |
1571 | 1571 | 'tab' => 'plugin-information', |
@@ -1580,10 +1580,10 @@ discard block |
||
1580 | 1580 | $link = sprintf( |
1581 | 1581 | '<a href="%1$s" class="thickbox">%2$s</a>', |
1582 | 1582 | esc_url( $url ), |
1583 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
1583 | + esc_html( $this->plugins[ $slug ][ 'name' ] ) |
|
1584 | 1584 | ); |
1585 | 1585 | } else { |
1586 | - $link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink. |
|
1586 | + $link = esc_html( $this->plugins[ $slug ][ 'name' ] ); // No hyperlink. |
|
1587 | 1587 | } |
1588 | 1588 | |
1589 | 1589 | return $link; |
@@ -1597,7 +1597,7 @@ discard block |
||
1597 | 1597 | * @return boolean True when on the TGMPA page, false otherwise. |
1598 | 1598 | */ |
1599 | 1599 | protected function is_tgmpa_page() { |
1600 | - return isset( $_GET['page'] ) && $this->menu === $_GET['page']; |
|
1600 | + return isset( $_GET[ 'page' ] ) && $this->menu === $_GET[ 'page' ]; |
|
1601 | 1601 | } |
1602 | 1602 | |
1603 | 1603 | /** |
@@ -1679,7 +1679,7 @@ discard block |
||
1679 | 1679 | public function is_plugin_installed( $slug ) { |
1680 | 1680 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
1681 | 1681 | |
1682 | - return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) ); |
|
1682 | + return ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ] ) ); |
|
1683 | 1683 | } |
1684 | 1684 | |
1685 | 1685 | /** |
@@ -1691,7 +1691,7 @@ discard block |
||
1691 | 1691 | * @return bool True if active, false otherwise. |
1692 | 1692 | */ |
1693 | 1693 | public function is_plugin_active( $slug ) { |
1694 | - return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) ); |
|
1694 | + return ( ( ! empty( $this->plugins[ $slug ][ 'is_callable' ] ) && is_callable( $this->plugins[ $slug ][ 'is_callable' ] ) ) || is_plugin_active( $this->plugins[ $slug ][ 'file_path' ] ) ); |
|
1695 | 1695 | } |
1696 | 1696 | |
1697 | 1697 | /** |
@@ -1705,14 +1705,14 @@ discard block |
||
1705 | 1705 | */ |
1706 | 1706 | public function can_plugin_update( $slug ) { |
1707 | 1707 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
1708 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1708 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1709 | 1709 | return true; |
1710 | 1710 | } |
1711 | 1711 | |
1712 | 1712 | $api = $this->get_plugins_api( $slug ); |
1713 | 1713 | |
1714 | 1714 | if ( false !== $api && isset( $api->requires ) ) { |
1715 | - return version_compare( $GLOBALS['wp_version'], $api->requires, '>=' ); |
|
1715 | + return version_compare( $GLOBALS[ 'wp_version' ], $api->requires, '>=' ); |
|
1716 | 1716 | } |
1717 | 1717 | |
1718 | 1718 | // No usable info received from the plugins API, presume we can update. |
@@ -1744,8 +1744,8 @@ discard block |
||
1744 | 1744 | public function get_installed_version( $slug ) { |
1745 | 1745 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
1746 | 1746 | |
1747 | - if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) { |
|
1748 | - return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version']; |
|
1747 | + if ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ] ) ) { |
|
1748 | + return $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ]; |
|
1749 | 1749 | } |
1750 | 1750 | |
1751 | 1751 | return ''; |
@@ -1761,7 +1761,7 @@ discard block |
||
1761 | 1761 | */ |
1762 | 1762 | public function does_plugin_require_update( $slug ) { |
1763 | 1763 | $installed_version = $this->get_installed_version( $slug ); |
1764 | - $minimum_version = $this->plugins[ $slug ]['version']; |
|
1764 | + $minimum_version = $this->plugins[ $slug ][ 'version' ]; |
|
1765 | 1765 | |
1766 | 1766 | return version_compare( $minimum_version, $installed_version, '>' ); |
1767 | 1767 | } |
@@ -1776,9 +1776,9 @@ discard block |
||
1776 | 1776 | */ |
1777 | 1777 | public function does_plugin_have_update( $slug ) { |
1778 | 1778 | // Presume bundled and external plugins will point to a package which meets the minimum required version. |
1779 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1779 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1780 | 1780 | if ( $this->does_plugin_require_update( $slug ) ) { |
1781 | - return $this->plugins[ $slug ]['version']; |
|
1781 | + return $this->plugins[ $slug ][ 'version' ]; |
|
1782 | 1782 | } |
1783 | 1783 | |
1784 | 1784 | return false; |
@@ -1786,8 +1786,8 @@ discard block |
||
1786 | 1786 | |
1787 | 1787 | $repo_updates = get_site_transient( 'update_plugins' ); |
1788 | 1788 | |
1789 | - if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) { |
|
1790 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version; |
|
1789 | + if ( isset( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version ) ) { |
|
1790 | + return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version; |
|
1791 | 1791 | } |
1792 | 1792 | |
1793 | 1793 | return false; |
@@ -1803,14 +1803,14 @@ discard block |
||
1803 | 1803 | */ |
1804 | 1804 | public function get_upgrade_notice( $slug ) { |
1805 | 1805 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
1806 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1806 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1807 | 1807 | return ''; |
1808 | 1808 | } |
1809 | 1809 | |
1810 | 1810 | $repo_updates = get_site_transient( 'update_plugins' ); |
1811 | 1811 | |
1812 | - if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) { |
|
1813 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice; |
|
1812 | + if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice ) ) { |
|
1813 | + return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice; |
|
1814 | 1814 | } |
1815 | 1815 | |
1816 | 1816 | return ''; |
@@ -1826,7 +1826,7 @@ discard block |
||
1826 | 1826 | */ |
1827 | 1827 | public function get_plugins( $plugin_folder = '' ) { |
1828 | 1828 | if ( ! function_exists( 'get_plugins' ) ) { |
1829 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
1829 | + require_once ABSPATH.'wp-admin/includes/plugin.php'; |
|
1830 | 1830 | } |
1831 | 1831 | |
1832 | 1832 | return get_plugins( $plugin_folder ); |
@@ -1841,7 +1841,7 @@ discard block |
||
1841 | 1841 | * @since 2.1.1 |
1842 | 1842 | */ |
1843 | 1843 | public function update_dismiss() { |
1844 | - delete_metadata( 'user', null, 'tgmpa_dismissed_notice_' . $this->id, null, true ); |
|
1844 | + delete_metadata( 'user', null, 'tgmpa_dismissed_notice_'.$this->id, null, true ); |
|
1845 | 1845 | } |
1846 | 1846 | |
1847 | 1847 | /** |
@@ -1860,13 +1860,13 @@ discard block |
||
1860 | 1860 | */ |
1861 | 1861 | public function force_activation() { |
1862 | 1862 | foreach ( $this->plugins as $slug => $plugin ) { |
1863 | - if ( true === $plugin['force_activation'] ) { |
|
1863 | + if ( true === $plugin[ 'force_activation' ] ) { |
|
1864 | 1864 | if ( ! $this->is_plugin_installed( $slug ) ) { |
1865 | 1865 | // Oops, plugin isn't there so iterate to next condition. |
1866 | 1866 | continue; |
1867 | 1867 | } elseif ( $this->can_plugin_activate( $slug ) ) { |
1868 | 1868 | // There we go, activate the plugin. |
1869 | - activate_plugin( $plugin['file_path'] ); |
|
1869 | + activate_plugin( $plugin[ 'file_path' ] ); |
|
1870 | 1870 | } |
1871 | 1871 | } |
1872 | 1872 | } |
@@ -1887,8 +1887,8 @@ discard block |
||
1887 | 1887 | public function force_deactivation() { |
1888 | 1888 | foreach ( $this->plugins as $slug => $plugin ) { |
1889 | 1889 | // Only proceed forward if the parameter is set to true and plugin is active. |
1890 | - if ( true === $plugin['force_deactivation'] && $this->is_plugin_active( $slug ) ) { |
|
1891 | - deactivate_plugins( $plugin['file_path'] ); |
|
1890 | + if ( true === $plugin[ 'force_deactivation' ] && $this->is_plugin_active( $slug ) ) { |
|
1891 | + deactivate_plugins( $plugin[ 'file_path' ] ); |
|
1892 | 1892 | } |
1893 | 1893 | } |
1894 | 1894 | } |
@@ -1923,7 +1923,7 @@ discard block |
||
1923 | 1923 | * Ensure only one instance of the class is ever invoked. |
1924 | 1924 | */ |
1925 | 1925 | function load_tgm_plugin_activation() { |
1926 | - $GLOBALS['tgmpa'] = TGM_Plugin_Activation::get_instance(); |
|
1926 | + $GLOBALS[ 'tgmpa' ] = TGM_Plugin_Activation::get_instance(); |
|
1927 | 1927 | } |
1928 | 1928 | } |
1929 | 1929 | |
@@ -1945,7 +1945,7 @@ discard block |
||
1945 | 1945 | * @param array $config Optional. An array of configuration values. |
1946 | 1946 | */ |
1947 | 1947 | function tgmpa( $plugins, $config = array() ) { |
1948 | - $instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
1948 | + $instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
1949 | 1949 | |
1950 | 1950 | foreach ( $plugins as $plugin ) { |
1951 | 1951 | call_user_func( array( $instance, 'register' ), $plugin ); |
@@ -1953,17 +1953,17 @@ discard block |
||
1953 | 1953 | |
1954 | 1954 | if ( ! empty( $config ) && is_array( $config ) ) { |
1955 | 1955 | // Send out notices for deprecated arguments passed. |
1956 | - if ( isset( $config['notices'] ) ) { |
|
1956 | + if ( isset( $config[ 'notices' ] ) ) { |
|
1957 | 1957 | _deprecated_argument( __FUNCTION__, '2.2.0', 'The `notices` config parameter was renamed to `has_notices` in TGMPA 2.2.0. Please adjust your configuration.' ); |
1958 | - if ( ! isset( $config['has_notices'] ) ) { |
|
1959 | - $config['has_notices'] = $config['notices']; |
|
1958 | + if ( ! isset( $config[ 'has_notices' ] ) ) { |
|
1959 | + $config[ 'has_notices' ] = $config[ 'notices' ]; |
|
1960 | 1960 | } |
1961 | 1961 | } |
1962 | 1962 | |
1963 | - if ( isset( $config['parent_menu_slug'] ) ) { |
|
1963 | + if ( isset( $config[ 'parent_menu_slug' ] ) ) { |
|
1964 | 1964 | _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.' ); |
1965 | 1965 | } |
1966 | - if ( isset( $config['parent_url_slug'] ) ) { |
|
1966 | + if ( isset( $config[ 'parent_url_slug' ] ) ) { |
|
1967 | 1967 | _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.' ); |
1968 | 1968 | } |
1969 | 1969 | |
@@ -1979,7 +1979,7 @@ discard block |
||
1979 | 1979 | * @since 2.2.0 |
1980 | 1980 | */ |
1981 | 1981 | if ( ! class_exists( 'WP_List_Table' ) ) { |
1982 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
1982 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
1983 | 1983 | } |
1984 | 1984 | |
1985 | 1985 | if ( ! class_exists( 'TGMPA_List_Table' ) ) { |
@@ -2040,7 +2040,7 @@ discard block |
||
2040 | 2040 | * @since 2.2.0 |
2041 | 2041 | */ |
2042 | 2042 | public function __construct() { |
2043 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
2043 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
2044 | 2044 | |
2045 | 2045 | parent::__construct( |
2046 | 2046 | array( |
@@ -2050,8 +2050,8 @@ discard block |
||
2050 | 2050 | ) |
2051 | 2051 | ); |
2052 | 2052 | |
2053 | - if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'install', 'update', 'activate' ), true ) ) { |
|
2054 | - $this->view_context = sanitize_key( $_REQUEST['plugin_status'] ); |
|
2053 | + if ( isset( $_REQUEST[ 'plugin_status' ] ) && in_array( $_REQUEST[ 'plugin_status' ], array( 'install', 'update', 'activate' ), true ) ) { |
|
2054 | + $this->view_context = sanitize_key( $_REQUEST[ 'plugin_status' ] ); |
|
2055 | 2055 | } |
2056 | 2056 | |
2057 | 2057 | add_filter( 'tgmpa_table_data_items', array( $this, 'sort_table_items' ) ); |
@@ -2098,20 +2098,20 @@ discard block |
||
2098 | 2098 | } |
2099 | 2099 | |
2100 | 2100 | foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) { |
2101 | - $table_data[ $i ]['sanitized_plugin'] = $plugin['name']; |
|
2102 | - $table_data[ $i ]['slug'] = $slug; |
|
2103 | - $table_data[ $i ]['plugin'] = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>'; |
|
2104 | - $table_data[ $i ]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] ); |
|
2105 | - $table_data[ $i ]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] ); |
|
2106 | - $table_data[ $i ]['status'] = $this->get_plugin_status_text( $slug ); |
|
2107 | - $table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug ); |
|
2108 | - $table_data[ $i ]['minimum_version'] = $plugin['version']; |
|
2109 | - $table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2101 | + $table_data[ $i ][ 'sanitized_plugin' ] = $plugin[ 'name' ]; |
|
2102 | + $table_data[ $i ][ 'slug' ] = $slug; |
|
2103 | + $table_data[ $i ][ 'plugin' ] = '<strong>'.$this->tgmpa->get_info_link( $slug ).'</strong>'; |
|
2104 | + $table_data[ $i ][ 'source' ] = $this->get_plugin_source_type_text( $plugin[ 'source_type' ] ); |
|
2105 | + $table_data[ $i ][ 'type' ] = $this->get_plugin_advise_type_text( $plugin[ 'required' ] ); |
|
2106 | + $table_data[ $i ][ 'status' ] = $this->get_plugin_status_text( $slug ); |
|
2107 | + $table_data[ $i ][ 'installed_version' ] = $this->tgmpa->get_installed_version( $slug ); |
|
2108 | + $table_data[ $i ][ 'minimum_version' ] = $plugin[ 'version' ]; |
|
2109 | + $table_data[ $i ][ 'available_version' ] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2110 | 2110 | |
2111 | 2111 | // Prep the upgrade notice info. |
2112 | 2112 | $upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug ); |
2113 | 2113 | if ( ! empty( $upgrade_notice ) ) { |
2114 | - $table_data[ $i ]['upgrade_notice'] = $upgrade_notice; |
|
2114 | + $table_data[ $i ][ 'upgrade_notice' ] = $upgrade_notice; |
|
2115 | 2115 | |
2116 | 2116 | add_action( "tgmpa_after_plugin_row_$slug", array( $this, 'wp_plugin_update_row' ), 10, 2 ); |
2117 | 2117 | } |
@@ -2142,17 +2142,17 @@ discard block |
||
2142 | 2142 | // No need to display plugins if they are installed, up-to-date and active. |
2143 | 2143 | continue; |
2144 | 2144 | } else { |
2145 | - $plugins['all'][ $slug ] = $plugin; |
|
2145 | + $plugins[ 'all' ][ $slug ] = $plugin; |
|
2146 | 2146 | |
2147 | 2147 | if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) { |
2148 | - $plugins['install'][ $slug ] = $plugin; |
|
2148 | + $plugins[ 'install' ][ $slug ] = $plugin; |
|
2149 | 2149 | } else { |
2150 | 2150 | if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) { |
2151 | - $plugins['update'][ $slug ] = $plugin; |
|
2151 | + $plugins[ 'update' ][ $slug ] = $plugin; |
|
2152 | 2152 | } |
2153 | 2153 | |
2154 | 2154 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
2155 | - $plugins['activate'][ $slug ] = $plugin; |
|
2155 | + $plugins[ 'activate' ][ $slug ] = $plugin; |
|
2156 | 2156 | } |
2157 | 2157 | } |
2158 | 2158 | } |
@@ -2271,8 +2271,8 @@ discard block |
||
2271 | 2271 | $name = array(); |
2272 | 2272 | |
2273 | 2273 | foreach ( $items as $i => $plugin ) { |
2274 | - $type[ $i ] = $plugin['type']; // Required / recommended. |
|
2275 | - $name[ $i ] = $plugin['sanitized_plugin']; |
|
2274 | + $type[ $i ] = $plugin[ 'type' ]; // Required / recommended. |
|
2275 | + $name[ $i ] = $plugin[ 'sanitized_plugin' ]; |
|
2276 | 2276 | } |
2277 | 2277 | |
2278 | 2278 | array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items ); |
@@ -2354,9 +2354,9 @@ discard block |
||
2354 | 2354 | public function column_cb( $item ) { |
2355 | 2355 | return sprintf( |
2356 | 2356 | '<input type="checkbox" name="%1$s[]" value="%2$s" id="%3$s" />', |
2357 | - esc_attr( $this->_args['singular'] ), |
|
2358 | - esc_attr( $item['slug'] ), |
|
2359 | - esc_attr( $item['sanitized_plugin'] ) |
|
2357 | + esc_attr( $this->_args[ 'singular' ] ), |
|
2358 | + esc_attr( $item[ 'slug' ] ), |
|
2359 | + esc_attr( $item[ 'sanitized_plugin' ] ) |
|
2360 | 2360 | ); |
2361 | 2361 | } |
2362 | 2362 | |
@@ -2371,7 +2371,7 @@ discard block |
||
2371 | 2371 | public function column_plugin( $item ) { |
2372 | 2372 | return sprintf( |
2373 | 2373 | '%1$s %2$s', |
2374 | - $item['plugin'], |
|
2374 | + $item[ 'plugin' ], |
|
2375 | 2375 | $this->row_actions( $this->get_row_actions( $item ), true ) |
2376 | 2376 | ); |
2377 | 2377 | } |
@@ -2387,38 +2387,38 @@ discard block |
||
2387 | 2387 | public function column_version( $item ) { |
2388 | 2388 | $output = array(); |
2389 | 2389 | |
2390 | - if ( $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
2391 | - $installed = ! empty( $item['installed_version'] ) ? $item['installed_version'] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
2390 | + if ( $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
2391 | + $installed = ! empty( $item[ 'installed_version' ] ) ? $item[ 'installed_version' ] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
2392 | 2392 | |
2393 | 2393 | $color = ''; |
2394 | - if ( ! empty( $item['minimum_version'] ) && $this->tgmpa->does_plugin_require_update( $item['slug'] ) ) { |
|
2394 | + if ( ! empty( $item[ 'minimum_version' ] ) && $this->tgmpa->does_plugin_require_update( $item[ 'slug' ] ) ) { |
|
2395 | 2395 | $color = ' color: #ff0000; font-weight: bold;'; |
2396 | 2396 | } |
2397 | 2397 | |
2398 | - $output[] = sprintf( |
|
2399 | - '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Installed version:', 'tgmpa' ) . '</p>', |
|
2398 | + $output[ ] = sprintf( |
|
2399 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Installed version:', 'tgmpa' ).'</p>', |
|
2400 | 2400 | $color, |
2401 | 2401 | $installed |
2402 | 2402 | ); |
2403 | 2403 | } |
2404 | 2404 | |
2405 | - if ( ! empty( $item['minimum_version'] ) ) { |
|
2406 | - $output[] = sprintf( |
|
2407 | - '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>' . __( 'Minimum required version:', 'tgmpa' ) . '</p>', |
|
2408 | - $item['minimum_version'] |
|
2405 | + if ( ! empty( $item[ 'minimum_version' ] ) ) { |
|
2406 | + $output[ ] = sprintf( |
|
2407 | + '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>'.__( 'Minimum required version:', 'tgmpa' ).'</p>', |
|
2408 | + $item[ 'minimum_version' ] |
|
2409 | 2409 | ); |
2410 | 2410 | } |
2411 | 2411 | |
2412 | - if ( ! empty( $item['available_version'] ) ) { |
|
2412 | + if ( ! empty( $item[ 'available_version' ] ) ) { |
|
2413 | 2413 | $color = ''; |
2414 | - if ( ! empty( $item['minimum_version'] ) && version_compare( $item['available_version'], $item['minimum_version'], '>=' ) ) { |
|
2414 | + if ( ! empty( $item[ 'minimum_version' ] ) && version_compare( $item[ 'available_version' ], $item[ 'minimum_version' ], '>=' ) ) { |
|
2415 | 2415 | $color = ' color: #71C671; 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>' . __( 'Available version:', 'tgmpa' ) . '</p>', |
|
2418 | + $output[ ] = sprintf( |
|
2419 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Available version:', 'tgmpa' ).'</p>', |
|
2420 | 2420 | $color, |
2421 | - $item['available_version'] |
|
2421 | + $item[ 'available_version' ] |
|
2422 | 2422 | ); |
2423 | 2423 | } |
2424 | 2424 | |
@@ -2459,8 +2459,8 @@ discard block |
||
2459 | 2459 | ); |
2460 | 2460 | |
2461 | 2461 | if ( 'all' === $this->view_context || 'update' === $this->view_context ) { |
2462 | - $columns['version'] = __( 'Version', 'tgmpa' ); |
|
2463 | - $columns['status'] = __( 'Status', 'tgmpa' ); |
|
2462 | + $columns[ 'version' ] = __( 'Version', 'tgmpa' ); |
|
2463 | + $columns[ 'status' ] = __( 'Status', 'tgmpa' ); |
|
2464 | 2464 | } |
2465 | 2465 | |
2466 | 2466 | return apply_filters( 'tgmpa_table_columns', $columns ); |
@@ -2507,17 +2507,17 @@ discard block |
||
2507 | 2507 | $action_links = array(); |
2508 | 2508 | |
2509 | 2509 | // Display the 'Install' action link if the plugin is not yet available. |
2510 | - if ( ! $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
2511 | - $actions['install'] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2510 | + if ( ! $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
2511 | + $actions[ 'install' ] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2512 | 2512 | } else { |
2513 | 2513 | // Display the 'Update' action link if an update is available and WP complies with plugin minimum. |
2514 | - if ( false !== $this->tgmpa->does_plugin_have_update( $item['slug'] ) && $this->tgmpa->can_plugin_update( $item['slug'] ) ) { |
|
2515 | - $actions['update'] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2514 | + if ( false !== $this->tgmpa->does_plugin_have_update( $item[ 'slug' ] ) && $this->tgmpa->can_plugin_update( $item[ 'slug' ] ) ) { |
|
2515 | + $actions[ 'update' ] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2516 | 2516 | } |
2517 | 2517 | |
2518 | 2518 | // Display the 'Activate' action link, but only if the plugin meets the minimum version. |
2519 | - if ( $this->tgmpa->can_plugin_activate( $item['slug'] ) ) { |
|
2520 | - $actions['activate'] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2519 | + if ( $this->tgmpa->can_plugin_activate( $item[ 'slug' ] ) ) { |
|
2520 | + $actions[ 'activate' ] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2521 | 2521 | } |
2522 | 2522 | } |
2523 | 2523 | |
@@ -2526,24 +2526,24 @@ discard block |
||
2526 | 2526 | $nonce_url = wp_nonce_url( |
2527 | 2527 | add_query_arg( |
2528 | 2528 | array( |
2529 | - 'plugin' => urlencode( $item['slug'] ), |
|
2530 | - 'tgmpa-' . $action => $action . '-plugin', |
|
2529 | + 'plugin' => urlencode( $item[ 'slug' ] ), |
|
2530 | + 'tgmpa-'.$action => $action.'-plugin', |
|
2531 | 2531 | ), |
2532 | 2532 | $this->tgmpa->get_tgmpa_url() |
2533 | 2533 | ), |
2534 | - 'tgmpa-' . $action, |
|
2534 | + 'tgmpa-'.$action, |
|
2535 | 2535 | 'tgmpa-nonce' |
2536 | 2536 | ); |
2537 | 2537 | |
2538 | 2538 | $action_links[ $action ] = sprintf( |
2539 | - '<a href="%1$s">' . esc_html( $text ) . '</a>', |
|
2539 | + '<a href="%1$s">'.esc_html( $text ).'</a>', |
|
2540 | 2540 | esc_url( $nonce_url ), |
2541 | - '<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>' |
|
2541 | + '<span class="screen-reader-text">'.esc_html( $item[ 'sanitized_plugin' ] ).'</span>' |
|
2542 | 2542 | ); |
2543 | 2543 | } |
2544 | 2544 | |
2545 | 2545 | $prefix = ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) ? 'network_admin_' : ''; |
2546 | - return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item['slug'], $item, $this->view_context ); |
|
2546 | + return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item[ 'slug' ], $item, $this->view_context ); |
|
2547 | 2547 | } |
2548 | 2548 | |
2549 | 2549 | /** |
@@ -2564,7 +2564,7 @@ discard block |
||
2564 | 2564 | * |
2565 | 2565 | * @since 2.5.0 |
2566 | 2566 | */ |
2567 | - do_action( "tgmpa_after_plugin_row_{$item['slug']}", $item['slug'], $item, $this->view_context ); |
|
2567 | + do_action( "tgmpa_after_plugin_row_{$item[ 'slug' ]}", $item[ 'slug' ], $item, $this->view_context ); |
|
2568 | 2568 | } |
2569 | 2569 | |
2570 | 2570 | /** |
@@ -2579,7 +2579,7 @@ discard block |
||
2579 | 2579 | * @return null Return early if upgrade notice is empty. |
2580 | 2580 | */ |
2581 | 2581 | public function wp_plugin_update_row( $slug, $item ) { |
2582 | - if ( empty( $item['upgrade_notice'] ) ) { |
|
2582 | + if ( empty( $item[ 'upgrade_notice' ] ) ) { |
|
2583 | 2583 | return; |
2584 | 2584 | } |
2585 | 2585 | |
@@ -2588,7 +2588,7 @@ discard block |
||
2588 | 2588 | <td colspan="', absint( $this->get_column_count() ), '" class="plugin-update colspanchange"> |
2589 | 2589 | <div class="update-message">', |
2590 | 2590 | esc_html__( 'Upgrade message from the plugin author:', 'tgmpa' ), |
2591 | - ' <strong>', wp_kses_data( $item['upgrade_notice'] ), '</strong> |
|
2591 | + ' <strong>', wp_kses_data( $item[ 'upgrade_notice' ] ), '</strong> |
|
2592 | 2592 | </div> |
2593 | 2593 | </td> |
2594 | 2594 | </tr>'; |
@@ -2620,16 +2620,16 @@ discard block |
||
2620 | 2620 | |
2621 | 2621 | if ( 'update' !== $this->view_context && 'activate' !== $this->view_context ) { |
2622 | 2622 | if ( current_user_can( 'install_plugins' ) ) { |
2623 | - $actions['tgmpa-bulk-install'] = __( 'Install', 'tgmpa' ); |
|
2623 | + $actions[ 'tgmpa-bulk-install' ] = __( 'Install', 'tgmpa' ); |
|
2624 | 2624 | } |
2625 | 2625 | } |
2626 | 2626 | |
2627 | 2627 | if ( 'install' !== $this->view_context ) { |
2628 | 2628 | if ( current_user_can( 'update_plugins' ) ) { |
2629 | - $actions['tgmpa-bulk-update'] = __( 'Update', 'tgmpa' ); |
|
2629 | + $actions[ 'tgmpa-bulk-update' ] = __( 'Update', 'tgmpa' ); |
|
2630 | 2630 | } |
2631 | 2631 | if ( current_user_can( 'activate_plugins' ) ) { |
2632 | - $actions['tgmpa-bulk-activate'] = __( 'Activate', 'tgmpa' ); |
|
2632 | + $actions[ 'tgmpa-bulk-activate' ] = __( 'Activate', 'tgmpa' ); |
|
2633 | 2633 | } |
2634 | 2634 | } |
2635 | 2635 | |
@@ -2648,7 +2648,7 @@ discard block |
||
2648 | 2648 | // Bulk installation process. |
2649 | 2649 | if ( 'tgmpa-bulk-install' === $this->current_action() || 'tgmpa-bulk-update' === $this->current_action() ) { |
2650 | 2650 | |
2651 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
2651 | + check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2652 | 2652 | |
2653 | 2653 | $install_type = 'install'; |
2654 | 2654 | if ( 'tgmpa-bulk-update' === $this->current_action() ) { |
@@ -2658,7 +2658,7 @@ discard block |
||
2658 | 2658 | $plugins_to_install = array(); |
2659 | 2659 | |
2660 | 2660 | // Did user actually select any plugins to install/update ? |
2661 | - if ( empty( $_POST['plugin'] ) ) { |
|
2661 | + if ( empty( $_POST[ 'plugin' ] ) ) { |
|
2662 | 2662 | if ( 'install' === $install_type ) { |
2663 | 2663 | $message = __( 'No plugins were selected to be installed. No action taken.', 'tgmpa' ); |
2664 | 2664 | } else { |
@@ -2670,11 +2670,11 @@ discard block |
||
2670 | 2670 | return false; |
2671 | 2671 | } |
2672 | 2672 | |
2673 | - if ( is_array( $_POST['plugin'] ) ) { |
|
2674 | - $plugins_to_install = (array) $_POST['plugin']; |
|
2675 | - } elseif ( is_string( $_POST['plugin'] ) ) { |
|
2673 | + if ( is_array( $_POST[ 'plugin' ] ) ) { |
|
2674 | + $plugins_to_install = (array) $_POST[ 'plugin' ]; |
|
2675 | + } elseif ( is_string( $_POST[ 'plugin' ] ) ) { |
|
2676 | 2676 | // Received via Filesystem page - un-flatten array (WP bug #19643). |
2677 | - $plugins_to_install = explode( ',', $_POST['plugin'] ); |
|
2677 | + $plugins_to_install = explode( ',', $_POST[ 'plugin' ] ); |
|
2678 | 2678 | } |
2679 | 2679 | |
2680 | 2680 | // Sanitize the received input. |
@@ -2716,11 +2716,11 @@ discard block |
||
2716 | 2716 | // Pass all necessary information if WP_Filesystem is needed. |
2717 | 2717 | $url = wp_nonce_url( |
2718 | 2718 | $this->tgmpa->get_tgmpa_url(), |
2719 | - 'bulk-' . $this->_args['plural'] |
|
2719 | + 'bulk-'.$this->_args[ 'plural' ] |
|
2720 | 2720 | ); |
2721 | 2721 | |
2722 | 2722 | // Give validated data back to $_POST which is the only place the filesystem looks for extra fields. |
2723 | - $_POST['plugin'] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
2723 | + $_POST[ 'plugin' ] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
2724 | 2724 | |
2725 | 2725 | $method = ''; // Leave blank so WP_Filesystem can populate it as necessary. |
2726 | 2726 | $fields = array_keys( $_POST ); // Extra fields to pass to WP_Filesystem. |
@@ -2747,22 +2747,22 @@ discard block |
||
2747 | 2747 | |
2748 | 2748 | // Prepare the data for validated plugins for the install/upgrade. |
2749 | 2749 | foreach ( $plugins_to_install as $slug ) { |
2750 | - $name = $this->tgmpa->plugins[ $slug ]['name']; |
|
2750 | + $name = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
2751 | 2751 | $source = $this->tgmpa->get_download_url( $slug ); |
2752 | 2752 | |
2753 | 2753 | if ( ! empty( $name ) && ! empty( $source ) ) { |
2754 | - $names[] = $name; |
|
2754 | + $names[ ] = $name; |
|
2755 | 2755 | |
2756 | 2756 | switch ( $install_type ) { |
2757 | 2757 | |
2758 | 2758 | case 'install': |
2759 | - $sources[] = $source; |
|
2759 | + $sources[ ] = $source; |
|
2760 | 2760 | break; |
2761 | 2761 | |
2762 | 2762 | case 'update': |
2763 | - $file_paths[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
2763 | + $file_paths[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
2764 | 2764 | $to_inject[ $slug ] = $this->tgmpa->plugins[ $slug ]; |
2765 | - $to_inject[ $slug ]['source'] = $source; |
|
2765 | + $to_inject[ $slug ][ 'source' ] = $source; |
|
2766 | 2766 | break; |
2767 | 2767 | } |
2768 | 2768 | } |
@@ -2774,7 +2774,7 @@ discard block |
||
2774 | 2774 | new TGMPA_Bulk_Installer_Skin( |
2775 | 2775 | array( |
2776 | 2776 | 'url' => esc_url_raw( $this->tgmpa->get_tgmpa_url() ), |
2777 | - 'nonce' => 'bulk-' . $this->_args['plural'], |
|
2777 | + 'nonce' => 'bulk-'.$this->_args[ 'plural' ], |
|
2778 | 2778 | 'names' => $names, |
2779 | 2779 | 'install_type' => $install_type, |
2780 | 2780 | ) |
@@ -2806,10 +2806,10 @@ discard block |
||
2806 | 2806 | |
2807 | 2807 | // Bulk activation process. |
2808 | 2808 | if ( 'tgmpa-bulk-activate' === $this->current_action() ) { |
2809 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
2809 | + check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2810 | 2810 | |
2811 | 2811 | // Did user actually select any plugins to activate ? |
2812 | - if ( empty( $_POST['plugin'] ) ) { |
|
2812 | + if ( empty( $_POST[ 'plugin' ] ) ) { |
|
2813 | 2813 | echo '<div id="message" class="error"><p>', esc_html__( 'No plugins were selected to be activated. No action taken.', 'tgmpa' ), '</p></div>'; |
2814 | 2814 | |
2815 | 2815 | return false; |
@@ -2817,8 +2817,8 @@ discard block |
||
2817 | 2817 | |
2818 | 2818 | // Grab plugin data from $_POST. |
2819 | 2819 | $plugins = array(); |
2820 | - if ( isset( $_POST['plugin'] ) ) { |
|
2821 | - $plugins = array_map( 'urldecode', (array) $_POST['plugin'] ); |
|
2820 | + if ( isset( $_POST[ 'plugin' ] ) ) { |
|
2821 | + $plugins = array_map( 'urldecode', (array) $_POST[ 'plugin' ] ); |
|
2822 | 2822 | $plugins = array_map( array( $this->tgmpa, 'sanitize_key' ), $plugins ); |
2823 | 2823 | } |
2824 | 2824 | |
@@ -2828,8 +2828,8 @@ discard block |
||
2828 | 2828 | // Grab the file paths for the selected & inactive plugins from the registration array. |
2829 | 2829 | foreach ( $plugins as $slug ) { |
2830 | 2830 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
2831 | - $plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
2832 | - $plugin_names[] = $this->tgmpa->plugins[ $slug ]['name']; |
|
2831 | + $plugins_to_activate[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
2832 | + $plugin_names[ ] = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
2833 | 2833 | } |
2834 | 2834 | } |
2835 | 2835 | unset( $slug ); |
@@ -2850,7 +2850,7 @@ discard block |
||
2850 | 2850 | $count = count( $plugin_names ); // Count so we can use _n function. |
2851 | 2851 | $plugin_names = array_map( array( 'TGMPA_Utils', 'wrap_in_strong' ), $plugin_names ); |
2852 | 2852 | $last_plugin = array_pop( $plugin_names ); // Pop off last name to prep for readability. |
2853 | - $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
2853 | + $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); |
|
2854 | 2854 | |
2855 | 2855 | printf( // WPCS: xss ok. |
2856 | 2856 | '<div id="message" class="updated"><p>%1$s %2$s.</p></div>', |
@@ -2953,16 +2953,16 @@ discard block |
||
2953 | 2953 | */ |
2954 | 2954 | function tgmpa_load_bulk_installer() { |
2955 | 2955 | // Silently fail if 2.5+ is loaded *after* an older version. |
2956 | - if ( ! isset( $GLOBALS['tgmpa'] ) ) { |
|
2956 | + if ( ! isset( $GLOBALS[ 'tgmpa' ] ) ) { |
|
2957 | 2957 | return; |
2958 | 2958 | } |
2959 | 2959 | |
2960 | 2960 | // Get TGMPA class instance. |
2961 | - $tgmpa_instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
2961 | + $tgmpa_instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
2962 | 2962 | |
2963 | - if ( isset( $_GET['page'] ) && $tgmpa_instance->menu === $_GET['page'] ) { |
|
2963 | + if ( isset( $_GET[ 'page' ] ) && $tgmpa_instance->menu === $_GET[ 'page' ] ) { |
|
2964 | 2964 | if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
2965 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
2965 | + require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
2966 | 2966 | } |
2967 | 2967 | |
2968 | 2968 | if ( ! class_exists( 'TGMPA_Bulk_Installer' ) ) { |
@@ -3029,11 +3029,11 @@ discard block |
||
3029 | 3029 | */ |
3030 | 3030 | public function __construct( $skin = null ) { |
3031 | 3031 | // Get TGMPA class instance. |
3032 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
3032 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3033 | 3033 | |
3034 | 3034 | parent::__construct( $skin ); |
3035 | 3035 | |
3036 | - if ( isset( $this->skin->options['install_type'] ) && 'update' === $this->skin->options['install_type'] ) { |
|
3036 | + if ( isset( $this->skin->options[ 'install_type' ] ) && 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3037 | 3037 | $this->clear_destination = true; |
3038 | 3038 | } |
3039 | 3039 | |
@@ -3050,8 +3050,8 @@ discard block |
||
3050 | 3050 | * @since 2.2.0 |
3051 | 3051 | */ |
3052 | 3052 | public function activate_strings() { |
3053 | - $this->strings['activation_failed'] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
3054 | - $this->strings['activation_success'] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
3053 | + $this->strings[ 'activation_failed' ] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
3054 | + $this->strings[ 'activation_success' ] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
3055 | 3055 | } |
3056 | 3056 | |
3057 | 3057 | /** |
@@ -3069,7 +3069,7 @@ discard block |
||
3069 | 3069 | |
3070 | 3070 | // Reset the strings in case we changed one during automatic activation. |
3071 | 3071 | if ( $this->tgmpa->is_automatic ) { |
3072 | - if ( 'update' === $this->skin->options['install_type'] ) { |
|
3072 | + if ( 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3073 | 3073 | $this->upgrade_strings(); |
3074 | 3074 | } else { |
3075 | 3075 | $this->install_strings(); |
@@ -3224,7 +3224,7 @@ discard block |
||
3224 | 3224 | remove_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 ); |
3225 | 3225 | |
3226 | 3226 | // Force refresh of plugin update information. |
3227 | - wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); |
|
3227 | + wp_clean_plugins_cache( $parsed_args[ 'clear_update_cache' ] ); |
|
3228 | 3228 | |
3229 | 3229 | return $results; |
3230 | 3230 | } |
@@ -3275,13 +3275,13 @@ discard block |
||
3275 | 3275 | $activate = activate_plugin( $plugin_info ); |
3276 | 3276 | |
3277 | 3277 | // Adjust the success string based on the activation result. |
3278 | - $this->strings['process_success'] = $this->strings['process_success'] . "<br />\n"; |
|
3278 | + $this->strings[ 'process_success' ] = $this->strings[ 'process_success' ]."<br />\n"; |
|
3279 | 3279 | |
3280 | 3280 | if ( is_wp_error( $activate ) ) { |
3281 | 3281 | $this->skin->error( $activate ); |
3282 | - $this->strings['process_success'] .= $this->strings['activation_failed']; |
|
3282 | + $this->strings[ 'process_success' ] .= $this->strings[ 'activation_failed' ]; |
|
3283 | 3283 | } else { |
3284 | - $this->strings['process_success'] .= $this->strings['activation_success']; |
|
3284 | + $this->strings[ 'process_success' ] .= $this->strings[ 'activation_success' ]; |
|
3285 | 3285 | } |
3286 | 3286 | } |
3287 | 3287 | } |
@@ -3357,7 +3357,7 @@ discard block |
||
3357 | 3357 | */ |
3358 | 3358 | public function __construct( $args = array() ) { |
3359 | 3359 | // Get TGMPA class instance. |
3360 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
3360 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3361 | 3361 | |
3362 | 3362 | // Parse default and new args. |
3363 | 3363 | $defaults = array( |
@@ -3366,10 +3366,10 @@ discard block |
||
3366 | 3366 | 'names' => array(), |
3367 | 3367 | 'install_type' => 'install', |
3368 | 3368 | ); |
3369 | - $args = wp_parse_args( $args, $defaults ); |
|
3369 | + $args = wp_parse_args( $args, $defaults ); |
|
3370 | 3370 | |
3371 | 3371 | // Set plugin names to $this->plugin_names property. |
3372 | - $this->plugin_names = $args['names']; |
|
3372 | + $this->plugin_names = $args[ 'names' ]; |
|
3373 | 3373 | |
3374 | 3374 | // Extract the new args. |
3375 | 3375 | parent::__construct( $args ); |
@@ -3384,25 +3384,25 @@ discard block |
||
3384 | 3384 | * @since 2.2.0 |
3385 | 3385 | */ |
3386 | 3386 | public function add_strings() { |
3387 | - if ( 'update' === $this->options['install_type'] ) { |
|
3387 | + if ( 'update' === $this->options[ 'install_type' ] ) { |
|
3388 | 3388 | parent::add_strings(); |
3389 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3389 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3390 | 3390 | } else { |
3391 | - $this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
3392 | - $this->upgrader->strings['skin_update_failed'] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
3391 | + $this->upgrader->strings[ 'skin_update_failed_error' ] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
3392 | + $this->upgrader->strings[ 'skin_update_failed' ] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
3393 | 3393 | |
3394 | 3394 | if ( $this->tgmpa->is_automatic ) { |
3395 | 3395 | // Automatic activation strings. |
3396 | - $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' ); |
|
3397 | - $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>'; |
|
3398 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
3399 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3396 | + $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' ); |
|
3397 | + $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>'; |
|
3398 | + $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
3399 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3400 | 3400 | } else { |
3401 | 3401 | // Default installation strings. |
3402 | - $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' ); |
|
3403 | - $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>'; |
|
3404 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations have been completed.', 'tgmpa' ); |
|
3405 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3402 | + $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' ); |
|
3403 | + $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>'; |
|
3404 | + $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations have been completed.', 'tgmpa' ); |
|
3405 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3406 | 3406 | } |
3407 | 3407 | } |
3408 | 3408 | } |
@@ -3460,12 +3460,12 @@ discard block |
||
3460 | 3460 | if ( $this->tgmpa->is_tgmpa_complete() ) { |
3461 | 3461 | // All plugins are active, so we display the complete string and hide the menu to protect users. |
3462 | 3462 | echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
3463 | - $update_actions['dashboard'] = sprintf( |
|
3464 | - esc_html( $this->tgmpa->strings['complete'] ), |
|
3465 | - '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' |
|
3463 | + $update_actions[ 'dashboard' ] = sprintf( |
|
3464 | + esc_html( $this->tgmpa->strings[ 'complete' ] ), |
|
3465 | + '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' |
|
3466 | 3466 | ); |
3467 | 3467 | } else { |
3468 | - $update_actions['tgmpa_page'] = '<a href="' . esc_url( $this->tgmpa->get_tgmpa_url() ) . '" target="_parent">' . esc_html( $this->tgmpa->strings['return'] ) . '</a>'; |
|
3468 | + $update_actions[ 'tgmpa_page' ] = '<a href="'.esc_url( $this->tgmpa->get_tgmpa_url() ).'" target="_parent">'.esc_html( $this->tgmpa->strings[ 'return' ] ).'</a>'; |
|
3469 | 3469 | } |
3470 | 3470 | |
3471 | 3471 | /** |
@@ -3555,7 +3555,7 @@ discard block |
||
3555 | 3555 | * @return string |
3556 | 3556 | */ |
3557 | 3557 | public static function wrap_in_em( $string ) { |
3558 | - return '<em>' . wp_kses_post( $string ) . '</em>'; |
|
3558 | + return '<em>'.wp_kses_post( $string ).'</em>'; |
|
3559 | 3559 | } |
3560 | 3560 | |
3561 | 3561 | /** |
@@ -3569,7 +3569,7 @@ discard block |
||
3569 | 3569 | * @return string |
3570 | 3570 | */ |
3571 | 3571 | public static function wrap_in_strong( $string ) { |
3572 | - return '<strong>' . wp_kses_post( $string ) . '</strong>'; |
|
3572 | + return '<strong>'.wp_kses_post( $string ).'</strong>'; |
|
3573 | 3573 | } |
3574 | 3574 | |
3575 | 3575 | /** |
@@ -3606,7 +3606,7 @@ discard block |
||
3606 | 3606 | */ |
3607 | 3607 | protected static function emulate_filter_bool( $value ) { |
3608 | 3608 | // @codingStandardsIgnoreStart |
3609 | - static $true = array( |
|
3609 | + static $true = array( |
|
3610 | 3610 | '1', |
3611 | 3611 | 'true', 'True', 'TRUE', |
3612 | 3612 | 'y', 'Y', |
@@ -1,19 +1,19 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Plugin installation and activation for WordPress themes. |
|
4 | - * |
|
5 | - * Please note that this is a drop-in library for a theme or plugin. |
|
6 | - * The authors of this library (Thomas, Gary and Juliette) are NOT responsible |
|
7 | - * for the support of your plugin or theme. Please contact the plugin |
|
8 | - * or theme author for support. |
|
9 | - * |
|
10 | - * @package TGM-Plugin-Activation |
|
11 | - * @version 2.5.2 |
|
12 | - * @link http://tgmpluginactivation.com/ |
|
13 | - * @author Thomas Griffin, Gary Jones, Juliette Reinders Folmer |
|
14 | - * @copyright Copyright (c) 2011, Thomas Griffin |
|
15 | - * @license GPL-2.0+ |
|
16 | - */ |
|
3 | + * Plugin installation and activation for WordPress themes. |
|
4 | + * |
|
5 | + * Please note that this is a drop-in library for a theme or plugin. |
|
6 | + * The authors of this library (Thomas, Gary and Juliette) are NOT responsible |
|
7 | + * for the support of your plugin or theme. Please contact the plugin |
|
8 | + * or theme author for support. |
|
9 | + * |
|
10 | + * @package TGM-Plugin-Activation |
|
11 | + * @version 2.5.2 |
|
12 | + * @link http://tgmpluginactivation.com/ |
|
13 | + * @author Thomas Griffin, Gary Jones, Juliette Reinders Folmer |
|
14 | + * @copyright Copyright (c) 2011, Thomas Griffin |
|
15 | + * @license GPL-2.0+ |
|
16 | + */ |
|
17 | 17 | |
18 | 18 | /* |
19 | 19 | Copyright 2011 Thomas Griffin (thomasgriffinmedia.com) |
@@ -1342,13 +1342,13 @@ discard block |
||
1342 | 1342 | $key = preg_replace( '`[^A-Za-z0-9_-]`', '', $key ); |
1343 | 1343 | |
1344 | 1344 | /** |
1345 | - * Filter a sanitized key string. |
|
1346 | - * |
|
1347 | - * @since 3.0.0 |
|
1348 | - * |
|
1349 | - * @param string $key Sanitized key. |
|
1350 | - * @param string $raw_key The key prior to sanitization. |
|
1351 | - */ |
|
1345 | + * Filter a sanitized key string. |
|
1346 | + * |
|
1347 | + * @since 3.0.0 |
|
1348 | + * |
|
1349 | + * @param string $key Sanitized key. |
|
1350 | + * @param string $raw_key The key prior to sanitization. |
|
1351 | + */ |
|
1352 | 1352 | return apply_filters( 'tgmpa_sanitize_key', $key, $raw_key ); |
1353 | 1353 | } |
1354 | 1354 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * Include the TGM_Plugin_Activation class. |
22 | 22 | */ |
23 | -require_once dirname( __FILE__ ) . '/class-tgm-plugin-activation.php'; |
|
23 | +require_once dirname( __FILE__ ).'/class-tgm-plugin-activation.php'; |
|
24 | 24 | |
25 | 25 | add_action( 'tgmpa_register', 'my_theme_register_required_plugins' ); |
26 | 26 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | array( |
49 | 49 | 'name' => 'TGM Example Plugin', // The plugin name. |
50 | 50 | 'slug' => 'tgm-example-plugin', // The plugin slug (typically the folder name). |
51 | - 'source' => get_stylesheet_directory() . '/lib/plugins/tgm-example-plugin.zip', // The plugin source. |
|
51 | + 'source' => get_stylesheet_directory().'/lib/plugins/tgm-example-plugin.zip', // The plugin source. |
|
52 | 52 | 'required' => true, // If false, the plugin is only 'recommended' instead of required. |
53 | 53 | 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher. If the plugin version is higher than the plugin version installed, the user will be notified to update the plugin. |
54 | 54 | 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch. |
@@ -106,16 +106,16 @@ discard block |
||
106 | 106 | * Only uncomment the strings in the config array if you want to customize the strings. |
107 | 107 | */ |
108 | 108 | $config = array( |
109 | - 'id' => 'tgmpa', // Unique ID for hashing notices for multiple instances of TGMPA. |
|
110 | - 'default_path' => '', // Default absolute path to bundled plugins. |
|
109 | + 'id' => 'tgmpa', // Unique ID for hashing notices for multiple instances of TGMPA. |
|
110 | + 'default_path' => '', // Default absolute path to bundled plugins. |
|
111 | 111 | 'menu' => 'tgmpa-install-plugins', // Menu slug. |
112 | - 'parent_slug' => 'themes.php', // Parent menu slug. |
|
113 | - 'capability' => 'edit_theme_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used. |
|
114 | - 'has_notices' => true, // Show admin notices or not. |
|
115 | - 'dismissable' => true, // If false, a user cannot dismiss the nag message. |
|
116 | - 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag. |
|
117 | - 'is_automatic' => false, // Automatically activate plugins after installation or not. |
|
118 | - 'message' => '', // Message to output right before the plugins table. |
|
112 | + 'parent_slug' => 'themes.php', // Parent menu slug. |
|
113 | + 'capability' => 'edit_theme_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used. |
|
114 | + 'has_notices' => true, // Show admin notices or not. |
|
115 | + 'dismissable' => true, // If false, a user cannot dismiss the nag message. |
|
116 | + 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag. |
|
117 | + 'is_automatic' => false, // Automatically activate plugins after installation or not. |
|
118 | + 'message' => '', // Message to output right before the plugins table. |
|
119 | 119 | |
120 | 120 | /* |
121 | 121 | 'strings' => array( |