@@ -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 |
@@ -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'] ) . ' ' . esc_html__( $this->strings['contact_admin'] ); |
|
1080 | + $rendered = esc_html__( $this->strings[ 'notice_cannot_install_activate' ] ).' '.esc_html__( $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_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_count, 'tgmpa' ), |
|
1155 | + translate_nooped_plural( $this->strings[ 'install_link' ], $install_count, 'tgmpa' ), |
|
1156 | 1156 | esc_url( $this->get_tgmpa_status_url( 'install' ) ) |
1157 | 1157 | ); |
1158 | 1158 | } |
1159 | 1159 | if ( $update_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_count, 'tgmpa' ), |
|
1162 | + translate_nooped_plural( $this->strings[ 'update_link' ], $update_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_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_count, 'tgmpa' ), |
|
1171 | + translate_nooped_plural( $this->strings[ 'activate_link' ], $activate_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,7 +1705,7 @@ 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 | |
@@ -1761,8 +1761,8 @@ discard block |
||
1761 | 1761 | public function get_installed_version( $slug ) { |
1762 | 1762 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
1763 | 1763 | |
1764 | - if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) { |
|
1765 | - return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version']; |
|
1764 | + if ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ] ) ) { |
|
1765 | + return $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ]; |
|
1766 | 1766 | } |
1767 | 1767 | |
1768 | 1768 | return ''; |
@@ -1778,7 +1778,7 @@ discard block |
||
1778 | 1778 | */ |
1779 | 1779 | public function does_plugin_require_update( $slug ) { |
1780 | 1780 | $installed_version = $this->get_installed_version( $slug ); |
1781 | - $minimum_version = $this->plugins[ $slug ]['version']; |
|
1781 | + $minimum_version = $this->plugins[ $slug ][ 'version' ]; |
|
1782 | 1782 | |
1783 | 1783 | return version_compare( $minimum_version, $installed_version, '>' ); |
1784 | 1784 | } |
@@ -1793,9 +1793,9 @@ discard block |
||
1793 | 1793 | */ |
1794 | 1794 | public function does_plugin_have_update( $slug ) { |
1795 | 1795 | // Presume bundled and external plugins will point to a package which meets the minimum required version. |
1796 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1796 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1797 | 1797 | if ( $this->does_plugin_require_update( $slug ) ) { |
1798 | - return $this->plugins[ $slug ]['version']; |
|
1798 | + return $this->plugins[ $slug ][ 'version' ]; |
|
1799 | 1799 | } |
1800 | 1800 | |
1801 | 1801 | return false; |
@@ -1803,8 +1803,8 @@ discard block |
||
1803 | 1803 | |
1804 | 1804 | $repo_updates = get_site_transient( 'update_plugins' ); |
1805 | 1805 | |
1806 | - if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) { |
|
1807 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version; |
|
1806 | + if ( isset( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version ) ) { |
|
1807 | + return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version; |
|
1808 | 1808 | } |
1809 | 1809 | |
1810 | 1810 | return false; |
@@ -1820,14 +1820,14 @@ discard block |
||
1820 | 1820 | */ |
1821 | 1821 | public function get_upgrade_notice( $slug ) { |
1822 | 1822 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
1823 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1823 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1824 | 1824 | return ''; |
1825 | 1825 | } |
1826 | 1826 | |
1827 | 1827 | $repo_updates = get_site_transient( 'update_plugins' ); |
1828 | 1828 | |
1829 | - if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) { |
|
1830 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice; |
|
1829 | + if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice ) ) { |
|
1830 | + return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice; |
|
1831 | 1831 | } |
1832 | 1832 | |
1833 | 1833 | return ''; |
@@ -1843,7 +1843,7 @@ discard block |
||
1843 | 1843 | */ |
1844 | 1844 | public function get_plugins( $plugin_folder = '' ) { |
1845 | 1845 | if ( ! function_exists( 'get_plugins' ) ) { |
1846 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
1846 | + require_once ABSPATH.'wp-admin/includes/plugin.php'; |
|
1847 | 1847 | } |
1848 | 1848 | |
1849 | 1849 | return get_plugins( $plugin_folder ); |
@@ -1858,7 +1858,7 @@ discard block |
||
1858 | 1858 | * @since 2.1.1 |
1859 | 1859 | */ |
1860 | 1860 | public function update_dismiss() { |
1861 | - delete_metadata( 'user', null, 'tgmpa_dismissed_notice_' . $this->id, null, true ); |
|
1861 | + delete_metadata( 'user', null, 'tgmpa_dismissed_notice_'.$this->id, null, true ); |
|
1862 | 1862 | } |
1863 | 1863 | |
1864 | 1864 | /** |
@@ -1877,13 +1877,13 @@ discard block |
||
1877 | 1877 | */ |
1878 | 1878 | public function force_activation() { |
1879 | 1879 | foreach ( $this->plugins as $slug => $plugin ) { |
1880 | - if ( true === $plugin['force_activation'] ) { |
|
1880 | + if ( true === $plugin[ 'force_activation' ] ) { |
|
1881 | 1881 | if ( ! $this->is_plugin_installed( $slug ) ) { |
1882 | 1882 | // Oops, plugin isn't there so iterate to next condition. |
1883 | 1883 | continue; |
1884 | 1884 | } elseif ( $this->can_plugin_activate( $slug ) ) { |
1885 | 1885 | // There we go, activate the plugin. |
1886 | - activate_plugin( $plugin['file_path'] ); |
|
1886 | + activate_plugin( $plugin[ 'file_path' ] ); |
|
1887 | 1887 | } |
1888 | 1888 | } |
1889 | 1889 | } |
@@ -1904,8 +1904,8 @@ discard block |
||
1904 | 1904 | public function force_deactivation() { |
1905 | 1905 | foreach ( $this->plugins as $slug => $plugin ) { |
1906 | 1906 | // Only proceed forward if the parameter is set to true and plugin is active. |
1907 | - if ( true === $plugin['force_deactivation'] && $this->is_plugin_active( $slug ) ) { |
|
1908 | - deactivate_plugins( $plugin['file_path'] ); |
|
1907 | + if ( true === $plugin[ 'force_deactivation' ] && $this->is_plugin_active( $slug ) ) { |
|
1908 | + deactivate_plugins( $plugin[ 'file_path' ] ); |
|
1909 | 1909 | } |
1910 | 1910 | } |
1911 | 1911 | } |
@@ -1940,7 +1940,7 @@ discard block |
||
1940 | 1940 | * Ensure only one instance of the class is ever invoked. |
1941 | 1941 | */ |
1942 | 1942 | function load_tgm_plugin_activation() { |
1943 | - $GLOBALS['tgmpa'] = TGM_Plugin_Activation::get_instance(); |
|
1943 | + $GLOBALS[ 'tgmpa' ] = TGM_Plugin_Activation::get_instance(); |
|
1944 | 1944 | } |
1945 | 1945 | } |
1946 | 1946 | |
@@ -1962,7 +1962,7 @@ discard block |
||
1962 | 1962 | * @param array $config Optional. An array of configuration values. |
1963 | 1963 | */ |
1964 | 1964 | function tgmpa( $plugins, $config = array() ) { |
1965 | - $instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
1965 | + $instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
1966 | 1966 | |
1967 | 1967 | foreach ( $plugins as $plugin ) { |
1968 | 1968 | call_user_func( array( $instance, 'register' ), $plugin ); |
@@ -1970,17 +1970,17 @@ discard block |
||
1970 | 1970 | |
1971 | 1971 | if ( ! empty( $config ) && is_array( $config ) ) { |
1972 | 1972 | // Send out notices for deprecated arguments passed. |
1973 | - if ( isset( $config['notices'] ) ) { |
|
1973 | + if ( isset( $config[ 'notices' ] ) ) { |
|
1974 | 1974 | _deprecated_argument( __FUNCTION__, '2.2.0', 'The `notices` config parameter was renamed to `has_notices` in TGMPA 2.2.0. Please adjust your configuration.' ); |
1975 | - if ( ! isset( $config['has_notices'] ) ) { |
|
1976 | - $config['has_notices'] = $config['notices']; |
|
1975 | + if ( ! isset( $config[ 'has_notices' ] ) ) { |
|
1976 | + $config[ 'has_notices' ] = $config[ 'notices' ]; |
|
1977 | 1977 | } |
1978 | 1978 | } |
1979 | 1979 | |
1980 | - if ( isset( $config['parent_menu_slug'] ) ) { |
|
1980 | + if ( isset( $config[ 'parent_menu_slug' ] ) ) { |
|
1981 | 1981 | _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.' ); |
1982 | 1982 | } |
1983 | - if ( isset( $config['parent_url_slug'] ) ) { |
|
1983 | + if ( isset( $config[ 'parent_url_slug' ] ) ) { |
|
1984 | 1984 | _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.' ); |
1985 | 1985 | } |
1986 | 1986 | |
@@ -1996,7 +1996,7 @@ discard block |
||
1996 | 1996 | * @since 2.2.0 |
1997 | 1997 | */ |
1998 | 1998 | if ( ! class_exists( 'WP_List_Table' ) ) { |
1999 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
1999 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
2000 | 2000 | } |
2001 | 2001 | |
2002 | 2002 | if ( ! class_exists( 'TGMPA_List_Table' ) ) { |
@@ -2057,7 +2057,7 @@ discard block |
||
2057 | 2057 | * @since 2.2.0 |
2058 | 2058 | */ |
2059 | 2059 | public function __construct() { |
2060 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
2060 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
2061 | 2061 | |
2062 | 2062 | parent::__construct( |
2063 | 2063 | array( |
@@ -2067,8 +2067,8 @@ discard block |
||
2067 | 2067 | ) |
2068 | 2068 | ); |
2069 | 2069 | |
2070 | - if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'install', 'update', 'activate' ), true ) ) { |
|
2071 | - $this->view_context = sanitize_key( $_REQUEST['plugin_status'] ); |
|
2070 | + if ( isset( $_REQUEST[ 'plugin_status' ] ) && in_array( $_REQUEST[ 'plugin_status' ], array( 'install', 'update', 'activate' ), true ) ) { |
|
2071 | + $this->view_context = sanitize_key( $_REQUEST[ 'plugin_status' ] ); |
|
2072 | 2072 | } |
2073 | 2073 | |
2074 | 2074 | add_filter( 'tgmpa_table_data_items', array( $this, 'sort_table_items' ) ); |
@@ -2115,20 +2115,20 @@ discard block |
||
2115 | 2115 | } |
2116 | 2116 | |
2117 | 2117 | foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) { |
2118 | - $table_data[ $i ]['sanitized_plugin'] = $plugin['name']; |
|
2119 | - $table_data[ $i ]['slug'] = $slug; |
|
2120 | - $table_data[ $i ]['plugin'] = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>'; |
|
2121 | - $table_data[ $i ]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] ); |
|
2122 | - $table_data[ $i ]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] ); |
|
2123 | - $table_data[ $i ]['status'] = $this->get_plugin_status_text( $slug ); |
|
2124 | - $table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug ); |
|
2125 | - $table_data[ $i ]['minimum_version'] = $plugin['version']; |
|
2126 | - $table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2118 | + $table_data[ $i ][ 'sanitized_plugin' ] = $plugin[ 'name' ]; |
|
2119 | + $table_data[ $i ][ 'slug' ] = $slug; |
|
2120 | + $table_data[ $i ][ 'plugin' ] = '<strong>'.$this->tgmpa->get_info_link( $slug ).'</strong>'; |
|
2121 | + $table_data[ $i ][ 'source' ] = $this->get_plugin_source_type_text( $plugin[ 'source_type' ] ); |
|
2122 | + $table_data[ $i ][ 'type' ] = $this->get_plugin_advise_type_text( $plugin[ 'required' ] ); |
|
2123 | + $table_data[ $i ][ 'status' ] = $this->get_plugin_status_text( $slug ); |
|
2124 | + $table_data[ $i ][ 'installed_version' ] = $this->tgmpa->get_installed_version( $slug ); |
|
2125 | + $table_data[ $i ][ 'minimum_version' ] = $plugin[ 'version' ]; |
|
2126 | + $table_data[ $i ][ 'available_version' ] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2127 | 2127 | |
2128 | 2128 | // Prep the upgrade notice info. |
2129 | 2129 | $upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug ); |
2130 | 2130 | if ( ! empty( $upgrade_notice ) ) { |
2131 | - $table_data[ $i ]['upgrade_notice'] = $upgrade_notice; |
|
2131 | + $table_data[ $i ][ 'upgrade_notice' ] = $upgrade_notice; |
|
2132 | 2132 | |
2133 | 2133 | add_action( "tgmpa_after_plugin_row_$slug", array( $this, 'wp_plugin_update_row' ), 10, 2 ); |
2134 | 2134 | } |
@@ -2159,17 +2159,17 @@ discard block |
||
2159 | 2159 | // No need to display plugins if they are installed, up-to-date and active. |
2160 | 2160 | continue; |
2161 | 2161 | } else { |
2162 | - $plugins['all'][ $slug ] = $plugin; |
|
2162 | + $plugins[ 'all' ][ $slug ] = $plugin; |
|
2163 | 2163 | |
2164 | 2164 | if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) { |
2165 | - $plugins['install'][ $slug ] = $plugin; |
|
2165 | + $plugins[ 'install' ][ $slug ] = $plugin; |
|
2166 | 2166 | } else { |
2167 | 2167 | if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) { |
2168 | - $plugins['update'][ $slug ] = $plugin; |
|
2168 | + $plugins[ 'update' ][ $slug ] = $plugin; |
|
2169 | 2169 | } |
2170 | 2170 | |
2171 | 2171 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
2172 | - $plugins['activate'][ $slug ] = $plugin; |
|
2172 | + $plugins[ 'activate' ][ $slug ] = $plugin; |
|
2173 | 2173 | } |
2174 | 2174 | } |
2175 | 2175 | } |
@@ -2288,8 +2288,8 @@ discard block |
||
2288 | 2288 | $name = array(); |
2289 | 2289 | |
2290 | 2290 | foreach ( $items as $i => $plugin ) { |
2291 | - $type[ $i ] = $plugin['type']; // Required / recommended. |
|
2292 | - $name[ $i ] = $plugin['sanitized_plugin']; |
|
2291 | + $type[ $i ] = $plugin[ 'type' ]; // Required / recommended. |
|
2292 | + $name[ $i ] = $plugin[ 'sanitized_plugin' ]; |
|
2293 | 2293 | } |
2294 | 2294 | |
2295 | 2295 | array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items ); |
@@ -2371,9 +2371,9 @@ discard block |
||
2371 | 2371 | public function column_cb( $item ) { |
2372 | 2372 | return sprintf( |
2373 | 2373 | '<input type="checkbox" name="%1$s[]" value="%2$s" id="%3$s" />', |
2374 | - esc_attr( $this->_args['singular'] ), |
|
2375 | - esc_attr( $item['slug'] ), |
|
2376 | - esc_attr( $item['sanitized_plugin'] ) |
|
2374 | + esc_attr( $this->_args[ 'singular' ] ), |
|
2375 | + esc_attr( $item[ 'slug' ] ), |
|
2376 | + esc_attr( $item[ 'sanitized_plugin' ] ) |
|
2377 | 2377 | ); |
2378 | 2378 | } |
2379 | 2379 | |
@@ -2388,7 +2388,7 @@ discard block |
||
2388 | 2388 | public function column_plugin( $item ) { |
2389 | 2389 | return sprintf( |
2390 | 2390 | '%1$s %2$s', |
2391 | - $item['plugin'], |
|
2391 | + $item[ 'plugin' ], |
|
2392 | 2392 | $this->row_actions( $this->get_row_actions( $item ), true ) |
2393 | 2393 | ); |
2394 | 2394 | } |
@@ -2404,38 +2404,38 @@ discard block |
||
2404 | 2404 | public function column_version( $item ) { |
2405 | 2405 | $output = array(); |
2406 | 2406 | |
2407 | - if ( $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
2408 | - $installed = ! empty( $item['installed_version'] ) ? $item['installed_version'] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
2407 | + if ( $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
2408 | + $installed = ! empty( $item[ 'installed_version' ] ) ? $item[ 'installed_version' ] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
2409 | 2409 | |
2410 | 2410 | $color = ''; |
2411 | - if ( ! empty( $item['minimum_version'] ) && $this->tgmpa->does_plugin_require_update( $item['slug'] ) ) { |
|
2411 | + if ( ! empty( $item[ 'minimum_version' ] ) && $this->tgmpa->does_plugin_require_update( $item[ 'slug' ] ) ) { |
|
2412 | 2412 | $color = ' color: #ff0000; font-weight: bold;'; |
2413 | 2413 | } |
2414 | 2414 | |
2415 | - $output[] = sprintf( |
|
2416 | - '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Installed version:', 'tgmpa' ) . '</p>', |
|
2415 | + $output[ ] = sprintf( |
|
2416 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Installed version:', 'tgmpa' ).'</p>', |
|
2417 | 2417 | $color, |
2418 | 2418 | $installed |
2419 | 2419 | ); |
2420 | 2420 | } |
2421 | 2421 | |
2422 | - if ( ! empty( $item['minimum_version'] ) ) { |
|
2423 | - $output[] = sprintf( |
|
2424 | - '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>' . __( 'Minimum required version:', 'tgmpa' ) . '</p>', |
|
2425 | - $item['minimum_version'] |
|
2422 | + if ( ! empty( $item[ 'minimum_version' ] ) ) { |
|
2423 | + $output[ ] = sprintf( |
|
2424 | + '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>'.__( 'Minimum required version:', 'tgmpa' ).'</p>', |
|
2425 | + $item[ 'minimum_version' ] |
|
2426 | 2426 | ); |
2427 | 2427 | } |
2428 | 2428 | |
2429 | - if ( ! empty( $item['available_version'] ) ) { |
|
2429 | + if ( ! empty( $item[ 'available_version' ] ) ) { |
|
2430 | 2430 | $color = ''; |
2431 | - if ( ! empty( $item['minimum_version'] ) && version_compare( $item['available_version'], $item['minimum_version'], '>=' ) ) { |
|
2431 | + if ( ! empty( $item[ 'minimum_version' ] ) && version_compare( $item[ 'available_version' ], $item[ 'minimum_version' ], '>=' ) ) { |
|
2432 | 2432 | $color = ' color: #71C671; font-weight: bold;'; |
2433 | 2433 | } |
2434 | 2434 | |
2435 | - $output[] = sprintf( |
|
2436 | - '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Available version:', 'tgmpa' ) . '</p>', |
|
2435 | + $output[ ] = sprintf( |
|
2436 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Available version:', 'tgmpa' ).'</p>', |
|
2437 | 2437 | $color, |
2438 | - $item['available_version'] |
|
2438 | + $item[ 'available_version' ] |
|
2439 | 2439 | ); |
2440 | 2440 | } |
2441 | 2441 | |
@@ -2476,8 +2476,8 @@ discard block |
||
2476 | 2476 | ); |
2477 | 2477 | |
2478 | 2478 | if ( 'all' === $this->view_context || 'update' === $this->view_context ) { |
2479 | - $columns['version'] = __( 'Version', 'tgmpa' ); |
|
2480 | - $columns['status'] = __( 'Status', 'tgmpa' ); |
|
2479 | + $columns[ 'version' ] = __( 'Version', 'tgmpa' ); |
|
2480 | + $columns[ 'status' ] = __( 'Status', 'tgmpa' ); |
|
2481 | 2481 | } |
2482 | 2482 | |
2483 | 2483 | return apply_filters( 'tgmpa_table_columns', $columns ); |
@@ -2524,17 +2524,17 @@ discard block |
||
2524 | 2524 | $action_links = array(); |
2525 | 2525 | |
2526 | 2526 | // Display the 'Install' action link if the plugin is not yet available. |
2527 | - if ( ! $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
2528 | - $actions['install'] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2527 | + if ( ! $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
2528 | + $actions[ 'install' ] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2529 | 2529 | } else { |
2530 | 2530 | // Display the 'Update' action link if an update is available and WP complies with plugin minimum. |
2531 | - if ( false !== $this->tgmpa->does_plugin_have_update( $item['slug'] ) && $this->tgmpa->can_plugin_update( $item['slug'] ) ) { |
|
2532 | - $actions['update'] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2531 | + if ( false !== $this->tgmpa->does_plugin_have_update( $item[ 'slug' ] ) && $this->tgmpa->can_plugin_update( $item[ 'slug' ] ) ) { |
|
2532 | + $actions[ 'update' ] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2533 | 2533 | } |
2534 | 2534 | |
2535 | 2535 | // Display the 'Activate' action link, but only if the plugin meets the minimum version. |
2536 | - if ( $this->tgmpa->can_plugin_activate( $item['slug'] ) ) { |
|
2537 | - $actions['activate'] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2536 | + if ( $this->tgmpa->can_plugin_activate( $item[ 'slug' ] ) ) { |
|
2537 | + $actions[ 'activate' ] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2538 | 2538 | } |
2539 | 2539 | } |
2540 | 2540 | |
@@ -2543,24 +2543,24 @@ discard block |
||
2543 | 2543 | $nonce_url = wp_nonce_url( |
2544 | 2544 | add_query_arg( |
2545 | 2545 | array( |
2546 | - 'plugin' => urlencode( $item['slug'] ), |
|
2547 | - 'tgmpa-' . $action => $action . '-plugin', |
|
2546 | + 'plugin' => urlencode( $item[ 'slug' ] ), |
|
2547 | + 'tgmpa-'.$action => $action.'-plugin', |
|
2548 | 2548 | ), |
2549 | 2549 | $this->tgmpa->get_tgmpa_url() |
2550 | 2550 | ), |
2551 | - 'tgmpa-' . $action, |
|
2551 | + 'tgmpa-'.$action, |
|
2552 | 2552 | 'tgmpa-nonce' |
2553 | 2553 | ); |
2554 | 2554 | |
2555 | 2555 | $action_links[ $action ] = sprintf( |
2556 | - '<a href="%1$s">' . esc_html( $text ) . '</a>', |
|
2556 | + '<a href="%1$s">'.esc_html( $text ).'</a>', |
|
2557 | 2557 | esc_url( $nonce_url ), |
2558 | - '<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>' |
|
2558 | + '<span class="screen-reader-text">'.esc_html( $item[ 'sanitized_plugin' ] ).'</span>' |
|
2559 | 2559 | ); |
2560 | 2560 | } |
2561 | 2561 | |
2562 | 2562 | $prefix = ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) ? 'network_admin_' : ''; |
2563 | - return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item['slug'], $item, $this->view_context ); |
|
2563 | + return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item[ 'slug' ], $item, $this->view_context ); |
|
2564 | 2564 | } |
2565 | 2565 | |
2566 | 2566 | /** |
@@ -2581,7 +2581,7 @@ discard block |
||
2581 | 2581 | * |
2582 | 2582 | * @since 2.5.0 |
2583 | 2583 | */ |
2584 | - do_action( "tgmpa_after_plugin_row_{$item['slug']}", $item['slug'], $item, $this->view_context ); |
|
2584 | + do_action( "tgmpa_after_plugin_row_{$item[ 'slug' ]}", $item[ 'slug' ], $item, $this->view_context ); |
|
2585 | 2585 | } |
2586 | 2586 | |
2587 | 2587 | /** |
@@ -2596,7 +2596,7 @@ discard block |
||
2596 | 2596 | * @return null Return early if upgrade notice is empty. |
2597 | 2597 | */ |
2598 | 2598 | public function wp_plugin_update_row( $slug, $item ) { |
2599 | - if ( empty( $item['upgrade_notice'] ) ) { |
|
2599 | + if ( empty( $item[ 'upgrade_notice' ] ) ) { |
|
2600 | 2600 | return; |
2601 | 2601 | } |
2602 | 2602 | |
@@ -2605,7 +2605,7 @@ discard block |
||
2605 | 2605 | <td colspan="', absint( $this->get_column_count() ), '" class="plugin-update colspanchange"> |
2606 | 2606 | <div class="update-message">', |
2607 | 2607 | esc_html__( 'Upgrade message from the plugin author:', 'tgmpa' ), |
2608 | - ' <strong>', wp_kses_data( $item['upgrade_notice'] ), '</strong> |
|
2608 | + ' <strong>', wp_kses_data( $item[ 'upgrade_notice' ] ), '</strong> |
|
2609 | 2609 | </div> |
2610 | 2610 | </td> |
2611 | 2611 | </tr>'; |
@@ -2637,16 +2637,16 @@ discard block |
||
2637 | 2637 | |
2638 | 2638 | if ( 'update' !== $this->view_context && 'activate' !== $this->view_context ) { |
2639 | 2639 | if ( current_user_can( 'install_plugins' ) ) { |
2640 | - $actions['tgmpa-bulk-install'] = __( 'Install', 'tgmpa' ); |
|
2640 | + $actions[ 'tgmpa-bulk-install' ] = __( 'Install', 'tgmpa' ); |
|
2641 | 2641 | } |
2642 | 2642 | } |
2643 | 2643 | |
2644 | 2644 | if ( 'install' !== $this->view_context ) { |
2645 | 2645 | if ( current_user_can( 'update_plugins' ) ) { |
2646 | - $actions['tgmpa-bulk-update'] = __( 'Update', 'tgmpa' ); |
|
2646 | + $actions[ 'tgmpa-bulk-update' ] = __( 'Update', 'tgmpa' ); |
|
2647 | 2647 | } |
2648 | 2648 | if ( current_user_can( 'activate_plugins' ) ) { |
2649 | - $actions['tgmpa-bulk-activate'] = __( 'Activate', 'tgmpa' ); |
|
2649 | + $actions[ 'tgmpa-bulk-activate' ] = __( 'Activate', 'tgmpa' ); |
|
2650 | 2650 | } |
2651 | 2651 | } |
2652 | 2652 | |
@@ -2665,7 +2665,7 @@ discard block |
||
2665 | 2665 | // Bulk installation process. |
2666 | 2666 | if ( 'tgmpa-bulk-install' === $this->current_action() || 'tgmpa-bulk-update' === $this->current_action() ) { |
2667 | 2667 | |
2668 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
2668 | + check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2669 | 2669 | |
2670 | 2670 | $install_type = 'install'; |
2671 | 2671 | if ( 'tgmpa-bulk-update' === $this->current_action() ) { |
@@ -2675,7 +2675,7 @@ discard block |
||
2675 | 2675 | $plugins_to_install = array(); |
2676 | 2676 | |
2677 | 2677 | // Did user actually select any plugins to install/update ? |
2678 | - if ( empty( $_POST['plugin'] ) ) { |
|
2678 | + if ( empty( $_POST[ 'plugin' ] ) ) { |
|
2679 | 2679 | if ( 'install' === $install_type ) { |
2680 | 2680 | $message = __( 'No plugins were selected to be installed. No action taken.', 'tgmpa' ); |
2681 | 2681 | } else { |
@@ -2687,11 +2687,11 @@ discard block |
||
2687 | 2687 | return false; |
2688 | 2688 | } |
2689 | 2689 | |
2690 | - if ( is_array( $_POST['plugin'] ) ) { |
|
2691 | - $plugins_to_install = (array) $_POST['plugin']; |
|
2692 | - } elseif ( is_string( $_POST['plugin'] ) ) { |
|
2690 | + if ( is_array( $_POST[ 'plugin' ] ) ) { |
|
2691 | + $plugins_to_install = (array) $_POST[ 'plugin' ]; |
|
2692 | + } elseif ( is_string( $_POST[ 'plugin' ] ) ) { |
|
2693 | 2693 | // Received via Filesystem page - un-flatten array (WP bug #19643). |
2694 | - $plugins_to_install = explode( ',', $_POST['plugin'] ); |
|
2694 | + $plugins_to_install = explode( ',', $_POST[ 'plugin' ] ); |
|
2695 | 2695 | } |
2696 | 2696 | |
2697 | 2697 | // Sanitize the received input. |
@@ -2733,11 +2733,11 @@ discard block |
||
2733 | 2733 | // Pass all necessary information if WP_Filesystem is needed. |
2734 | 2734 | $url = wp_nonce_url( |
2735 | 2735 | $this->tgmpa->get_tgmpa_url(), |
2736 | - 'bulk-' . $this->_args['plural'] |
|
2736 | + 'bulk-'.$this->_args[ 'plural' ] |
|
2737 | 2737 | ); |
2738 | 2738 | |
2739 | 2739 | // Give validated data back to $_POST which is the only place the filesystem looks for extra fields. |
2740 | - $_POST['plugin'] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
2740 | + $_POST[ 'plugin' ] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
2741 | 2741 | |
2742 | 2742 | $method = ''; // Leave blank so WP_Filesystem can populate it as necessary. |
2743 | 2743 | $fields = array_keys( $_POST ); // Extra fields to pass to WP_Filesystem. |
@@ -2764,22 +2764,22 @@ discard block |
||
2764 | 2764 | |
2765 | 2765 | // Prepare the data for validated plugins for the install/upgrade. |
2766 | 2766 | foreach ( $plugins_to_install as $slug ) { |
2767 | - $name = $this->tgmpa->plugins[ $slug ]['name']; |
|
2767 | + $name = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
2768 | 2768 | $source = $this->tgmpa->get_download_url( $slug ); |
2769 | 2769 | |
2770 | 2770 | if ( ! empty( $name ) && ! empty( $source ) ) { |
2771 | - $names[] = $name; |
|
2771 | + $names[ ] = $name; |
|
2772 | 2772 | |
2773 | 2773 | switch ( $install_type ) { |
2774 | 2774 | |
2775 | 2775 | case 'install': |
2776 | - $sources[] = $source; |
|
2776 | + $sources[ ] = $source; |
|
2777 | 2777 | break; |
2778 | 2778 | |
2779 | 2779 | case 'update': |
2780 | - $file_paths[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
2780 | + $file_paths[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
2781 | 2781 | $to_inject[ $slug ] = $this->tgmpa->plugins[ $slug ]; |
2782 | - $to_inject[ $slug ]['source'] = $source; |
|
2782 | + $to_inject[ $slug ][ 'source' ] = $source; |
|
2783 | 2783 | break; |
2784 | 2784 | } |
2785 | 2785 | } |
@@ -2791,7 +2791,7 @@ discard block |
||
2791 | 2791 | new TGMPA_Bulk_Installer_Skin( |
2792 | 2792 | array( |
2793 | 2793 | 'url' => esc_url_raw( $this->tgmpa->get_tgmpa_url() ), |
2794 | - 'nonce' => 'bulk-' . $this->_args['plural'], |
|
2794 | + 'nonce' => 'bulk-'.$this->_args[ 'plural' ], |
|
2795 | 2795 | 'names' => $names, |
2796 | 2796 | 'install_type' => $install_type, |
2797 | 2797 | ) |
@@ -2823,10 +2823,10 @@ discard block |
||
2823 | 2823 | |
2824 | 2824 | // Bulk activation process. |
2825 | 2825 | if ( 'tgmpa-bulk-activate' === $this->current_action() ) { |
2826 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
2826 | + check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2827 | 2827 | |
2828 | 2828 | // Did user actually select any plugins to activate ? |
2829 | - if ( empty( $_POST['plugin'] ) ) { |
|
2829 | + if ( empty( $_POST[ 'plugin' ] ) ) { |
|
2830 | 2830 | echo '<div id="message" class="error"><p>', esc_html__( 'No plugins were selected to be activated. No action taken.', 'tgmpa' ), '</p></div>'; |
2831 | 2831 | |
2832 | 2832 | return false; |
@@ -2834,8 +2834,8 @@ discard block |
||
2834 | 2834 | |
2835 | 2835 | // Grab plugin data from $_POST. |
2836 | 2836 | $plugins = array(); |
2837 | - if ( isset( $_POST['plugin'] ) ) { |
|
2838 | - $plugins = array_map( 'urldecode', (array) $_POST['plugin'] ); |
|
2837 | + if ( isset( $_POST[ 'plugin' ] ) ) { |
|
2838 | + $plugins = array_map( 'urldecode', (array) $_POST[ 'plugin' ] ); |
|
2839 | 2839 | $plugins = array_map( array( $this->tgmpa, 'sanitize_key' ), $plugins ); |
2840 | 2840 | } |
2841 | 2841 | |
@@ -2845,8 +2845,8 @@ discard block |
||
2845 | 2845 | // Grab the file paths for the selected & inactive plugins from the registration array. |
2846 | 2846 | foreach ( $plugins as $slug ) { |
2847 | 2847 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
2848 | - $plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
2849 | - $plugin_names[] = $this->tgmpa->plugins[ $slug ]['name']; |
|
2848 | + $plugins_to_activate[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
2849 | + $plugin_names[ ] = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
2850 | 2850 | } |
2851 | 2851 | } |
2852 | 2852 | unset( $slug ); |
@@ -2867,7 +2867,7 @@ discard block |
||
2867 | 2867 | $count = count( $plugin_names ); // Count so we can use _n function. |
2868 | 2868 | $plugin_names = array_map( array( 'TGMPA_Utils', 'wrap_in_strong' ), $plugin_names ); |
2869 | 2869 | $last_plugin = array_pop( $plugin_names ); // Pop off last name to prep for readability. |
2870 | - $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
2870 | + $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); |
|
2871 | 2871 | |
2872 | 2872 | printf( // WPCS: xss ok. |
2873 | 2873 | '<div id="message" class="updated"><p>%1$s %2$s.</p></div>', |
@@ -2970,16 +2970,16 @@ discard block |
||
2970 | 2970 | */ |
2971 | 2971 | function tgmpa_load_bulk_installer() { |
2972 | 2972 | // Silently fail if 2.5+ is loaded *after* an older version. |
2973 | - if ( ! isset( $GLOBALS['tgmpa'] ) ) { |
|
2973 | + if ( ! isset( $GLOBALS[ 'tgmpa' ] ) ) { |
|
2974 | 2974 | return; |
2975 | 2975 | } |
2976 | 2976 | |
2977 | 2977 | // Get TGMPA class instance. |
2978 | - $tgmpa_instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
2978 | + $tgmpa_instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
2979 | 2979 | |
2980 | - if ( isset( $_GET['page'] ) && $tgmpa_instance->menu === $_GET['page'] ) { |
|
2980 | + if ( isset( $_GET[ 'page' ] ) && $tgmpa_instance->menu === $_GET[ 'page' ] ) { |
|
2981 | 2981 | if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
2982 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
2982 | + require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
2983 | 2983 | } |
2984 | 2984 | |
2985 | 2985 | if ( ! class_exists( 'TGMPA_Bulk_Installer' ) ) { |
@@ -3046,11 +3046,11 @@ discard block |
||
3046 | 3046 | */ |
3047 | 3047 | public function __construct( $skin = null ) { |
3048 | 3048 | // Get TGMPA class instance. |
3049 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
3049 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3050 | 3050 | |
3051 | 3051 | parent::__construct( $skin ); |
3052 | 3052 | |
3053 | - if ( isset( $this->skin->options['install_type'] ) && 'update' === $this->skin->options['install_type'] ) { |
|
3053 | + if ( isset( $this->skin->options[ 'install_type' ] ) && 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3054 | 3054 | $this->clear_destination = true; |
3055 | 3055 | } |
3056 | 3056 | |
@@ -3067,8 +3067,8 @@ discard block |
||
3067 | 3067 | * @since 2.2.0 |
3068 | 3068 | */ |
3069 | 3069 | public function activate_strings() { |
3070 | - $this->strings['activation_failed'] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
3071 | - $this->strings['activation_success'] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
3070 | + $this->strings[ 'activation_failed' ] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
3071 | + $this->strings[ 'activation_success' ] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
3072 | 3072 | } |
3073 | 3073 | |
3074 | 3074 | /** |
@@ -3086,7 +3086,7 @@ discard block |
||
3086 | 3086 | |
3087 | 3087 | // Reset the strings in case we changed one during automatic activation. |
3088 | 3088 | if ( $this->tgmpa->is_automatic ) { |
3089 | - if ( 'update' === $this->skin->options['install_type'] ) { |
|
3089 | + if ( 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3090 | 3090 | $this->upgrade_strings(); |
3091 | 3091 | } else { |
3092 | 3092 | $this->install_strings(); |
@@ -3243,7 +3243,7 @@ discard block |
||
3243 | 3243 | remove_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 ); |
3244 | 3244 | |
3245 | 3245 | // Force refresh of plugin update information. |
3246 | - wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); |
|
3246 | + wp_clean_plugins_cache( $parsed_args[ 'clear_update_cache' ] ); |
|
3247 | 3247 | |
3248 | 3248 | return $results; |
3249 | 3249 | } |
@@ -3294,13 +3294,13 @@ discard block |
||
3294 | 3294 | $activate = activate_plugin( $plugin_info ); |
3295 | 3295 | |
3296 | 3296 | // Adjust the success string based on the activation result. |
3297 | - $this->strings['process_success'] = $this->strings['process_success'] . "<br />\n"; |
|
3297 | + $this->strings[ 'process_success' ] = $this->strings[ 'process_success' ]."<br />\n"; |
|
3298 | 3298 | |
3299 | 3299 | if ( is_wp_error( $activate ) ) { |
3300 | 3300 | $this->skin->error( $activate ); |
3301 | - $this->strings['process_success'] .= $this->strings['activation_failed']; |
|
3301 | + $this->strings[ 'process_success' ] .= $this->strings[ 'activation_failed' ]; |
|
3302 | 3302 | } else { |
3303 | - $this->strings['process_success'] .= $this->strings['activation_success']; |
|
3303 | + $this->strings[ 'process_success' ] .= $this->strings[ 'activation_success' ]; |
|
3304 | 3304 | } |
3305 | 3305 | } |
3306 | 3306 | } |
@@ -3376,7 +3376,7 @@ discard block |
||
3376 | 3376 | */ |
3377 | 3377 | public function __construct( $args = array() ) { |
3378 | 3378 | // Get TGMPA class instance. |
3379 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
3379 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3380 | 3380 | |
3381 | 3381 | // Parse default and new args. |
3382 | 3382 | $defaults = array( |
@@ -3385,10 +3385,10 @@ discard block |
||
3385 | 3385 | 'names' => array(), |
3386 | 3386 | 'install_type' => 'install', |
3387 | 3387 | ); |
3388 | - $args = wp_parse_args( $args, $defaults ); |
|
3388 | + $args = wp_parse_args( $args, $defaults ); |
|
3389 | 3389 | |
3390 | 3390 | // Set plugin names to $this->plugin_names property. |
3391 | - $this->plugin_names = $args['names']; |
|
3391 | + $this->plugin_names = $args[ 'names' ]; |
|
3392 | 3392 | |
3393 | 3393 | // Extract the new args. |
3394 | 3394 | parent::__construct( $args ); |
@@ -3403,25 +3403,25 @@ discard block |
||
3403 | 3403 | * @since 2.2.0 |
3404 | 3404 | */ |
3405 | 3405 | public function add_strings() { |
3406 | - if ( 'update' === $this->options['install_type'] ) { |
|
3406 | + if ( 'update' === $this->options[ 'install_type' ] ) { |
|
3407 | 3407 | parent::add_strings(); |
3408 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3408 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3409 | 3409 | } else { |
3410 | - $this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
3411 | - $this->upgrader->strings['skin_update_failed'] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
3410 | + $this->upgrader->strings[ 'skin_update_failed_error' ] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
3411 | + $this->upgrader->strings[ 'skin_update_failed' ] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
3412 | 3412 | |
3413 | 3413 | if ( $this->tgmpa->is_automatic ) { |
3414 | 3414 | // Automatic activation strings. |
3415 | - $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' ); |
|
3416 | - $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>'; |
|
3417 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
3418 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3415 | + $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' ); |
|
3416 | + $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>'; |
|
3417 | + $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
3418 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3419 | 3419 | } else { |
3420 | 3420 | // Default installation strings. |
3421 | - $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' ); |
|
3422 | - $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>'; |
|
3423 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations have been completed.', 'tgmpa' ); |
|
3424 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3421 | + $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' ); |
|
3422 | + $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>'; |
|
3423 | + $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations have been completed.', 'tgmpa' ); |
|
3424 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3425 | 3425 | } |
3426 | 3426 | } |
3427 | 3427 | } |
@@ -3479,12 +3479,12 @@ discard block |
||
3479 | 3479 | if ( $this->tgmpa->is_tgmpa_complete() ) { |
3480 | 3480 | // All plugins are active, so we display the complete string and hide the menu to protect users. |
3481 | 3481 | echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
3482 | - $update_actions['dashboard'] = sprintf( |
|
3483 | - esc_html( $this->tgmpa->strings['complete'] ), |
|
3484 | - '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' |
|
3482 | + $update_actions[ 'dashboard' ] = sprintf( |
|
3483 | + esc_html( $this->tgmpa->strings[ 'complete' ] ), |
|
3484 | + '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' |
|
3485 | 3485 | ); |
3486 | 3486 | } else { |
3487 | - $update_actions['tgmpa_page'] = '<a href="' . esc_url( $this->tgmpa->get_tgmpa_url() ) . '" target="_parent">' . esc_html( $this->tgmpa->strings['return'] ) . '</a>'; |
|
3487 | + $update_actions[ 'tgmpa_page' ] = '<a href="'.esc_url( $this->tgmpa->get_tgmpa_url() ).'" target="_parent">'.esc_html( $this->tgmpa->strings[ 'return' ] ).'</a>'; |
|
3488 | 3488 | } |
3489 | 3489 | |
3490 | 3490 | /** |
@@ -3574,7 +3574,7 @@ discard block |
||
3574 | 3574 | * @return string |
3575 | 3575 | */ |
3576 | 3576 | public static function wrap_in_em( $string ) { |
3577 | - return '<em>' . wp_kses_post( $string ) . '</em>'; |
|
3577 | + return '<em>'.wp_kses_post( $string ).'</em>'; |
|
3578 | 3578 | } |
3579 | 3579 | |
3580 | 3580 | /** |
@@ -3588,7 +3588,7 @@ discard block |
||
3588 | 3588 | * @return string |
3589 | 3589 | */ |
3590 | 3590 | public static function wrap_in_strong( $string ) { |
3591 | - return '<strong>' . wp_kses_post( $string ) . '</strong>'; |
|
3591 | + return '<strong>'.wp_kses_post( $string ).'</strong>'; |
|
3592 | 3592 | } |
3593 | 3593 | |
3594 | 3594 | /** |
@@ -3625,7 +3625,7 @@ discard block |
||
3625 | 3625 | */ |
3626 | 3626 | protected static function emulate_filter_bool( $value ) { |
3627 | 3627 | // @codingStandardsIgnoreStart |
3628 | - static $true = array( |
|
3628 | + static $true = array( |
|
3629 | 3629 | '1', |
3630 | 3630 | 'true', 'True', 'TRUE', |
3631 | 3631 | 'y', 'Y', |