| @@ -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' ); | 
| @@ -1327,13 +1327,13 @@ | ||
| 1327 | 1327 | $key = preg_replace( '`[^A-Za-z0-9_-]`', '', $key ); | 
| 1328 | 1328 | |
| 1329 | 1329 | /** | 
| 1330 | - * Filter a sanitized key string. | |
| 1331 | - * | |
| 1332 | - * @since 3.0.0 | |
| 1333 | - * | |
| 1334 | - * @param string $key Sanitized key. | |
| 1335 | - * @param string $raw_key The key prior to sanitization. | |
| 1336 | - */ | |
| 1330 | + * Filter a sanitized key string. | |
| 1331 | + * | |
| 1332 | + * @since 3.0.0 | |
| 1333 | + * | |
| 1334 | + * @param string $key Sanitized key. | |
| 1335 | + * @param string $raw_key The key prior to sanitization. | |
| 1336 | + */ | |
| 1337 | 1337 | return apply_filters( 'tgmpa_sanitize_key', $key, $raw_key ); | 
| 1338 | 1338 | } | 
| 1339 | 1339 | |
| @@ -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 ) ); | 
| @@ -459,10 +459,10 @@ discard block | ||
| 459 | 459 |  			if ( false !== strpos( __FILE__, WP_PLUGIN_DIR ) || false !== strpos( __FILE__, WPMU_PLUGIN_DIR ) ) { | 
| 460 | 460 | // Plugin, we'll need to adjust the file name. | 
| 461 | 461 | add_action( 'load_textdomain_mofile', array( $this, 'correct_plugin_mofile' ), 10, 2 ); | 
| 462 | - load_theme_textdomain( 'tgmpa', dirname( __FILE__ ) . '/languages' ); | |
| 462 | + load_theme_textdomain( 'tgmpa', dirname( __FILE__ ).'/languages' ); | |
| 463 | 463 | remove_action( 'load_textdomain_mofile', array( $this, 'correct_plugin_mofile' ), 10 ); | 
| 464 | 464 |  			} else { | 
| 465 | - load_theme_textdomain( 'tgmpa', dirname( __FILE__ ) . '/languages' ); | |
| 465 | + load_theme_textdomain( 'tgmpa', dirname( __FILE__ ).'/languages' ); | |
| 466 | 466 | } | 
| 467 | 467 | } | 
| 468 | 468 | |
| @@ -535,15 +535,15 @@ discard block | ||
| 535 | 535 |  		public function add_plugin_action_link_filters() { | 
| 536 | 536 |  			foreach ( $this->plugins as $slug => $plugin ) { | 
| 537 | 537 |  				if ( false === $this->can_plugin_activate( $slug ) ) { | 
| 538 | - add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_activate' ), 20 ); | |
| 538 | + add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_activate' ), 20 ); | |
| 539 | 539 | } | 
| 540 | 540 | |
| 541 | -				if ( true === $plugin['force_activation'] ) { | |
| 542 | - add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_deactivate' ), 20 ); | |
| 541 | +				if ( true === $plugin[ 'force_activation' ] ) { | |
| 542 | + add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_deactivate' ), 20 ); | |
| 543 | 543 | } | 
| 544 | 544 | |
| 545 | 545 |  				if ( false !== $this->does_plugin_require_update( $slug ) ) { | 
| 546 | - add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_update' ), 20 ); | |
| 546 | + add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_update' ), 20 ); | |
| 547 | 547 | } | 
| 548 | 548 | } | 
| 549 | 549 | } | 
| @@ -558,7 +558,7 @@ discard block | ||
| 558 | 558 | * @return array | 
| 559 | 559 | */ | 
| 560 | 560 |  		public function filter_plugin_action_links_activate( $actions ) { | 
| 561 | - unset( $actions['activate'] ); | |
| 561 | + unset( $actions[ 'activate' ] ); | |
| 562 | 562 | |
| 563 | 563 | return $actions; | 
| 564 | 564 | } | 
| @@ -572,7 +572,7 @@ discard block | ||
| 572 | 572 | * @return array | 
| 573 | 573 | */ | 
| 574 | 574 |  		public function filter_plugin_action_links_deactivate( $actions ) { | 
| 575 | - unset( $actions['deactivate'] ); | |
| 575 | + unset( $actions[ 'deactivate' ] ); | |
| 576 | 576 | |
| 577 | 577 | return $actions; | 
| 578 | 578 | } | 
| @@ -587,7 +587,7 @@ discard block | ||
| 587 | 587 | * @return array | 
| 588 | 588 | */ | 
| 589 | 589 |  		public function filter_plugin_action_links_update( $actions ) { | 
| 590 | - $actions['update'] = sprintf( | |
| 590 | + $actions[ 'update' ] = sprintf( | |
| 591 | 591 | '<a href="%1$s" title="%2$s" class="edit">%3$s</a>', | 
| 592 | 592 | esc_url( $this->get_tgmpa_status_url( 'update' ) ), | 
| 593 | 593 | esc_attr__( 'This plugin needs to be updated to be compatible with your theme.', 'tgmpa' ), | 
| @@ -625,9 +625,9 @@ discard block | ||
| 625 | 625 | return; | 
| 626 | 626 | } | 
| 627 | 627 | |
| 628 | -			if ( isset( $_REQUEST['tab'] ) && 'plugin-information' === $_REQUEST['tab'] ) { | |
| 628 | +			if ( isset( $_REQUEST[ 'tab' ] ) && 'plugin-information' === $_REQUEST[ 'tab' ] ) { | |
| 629 | 629 | // Needed for install_plugin_information(). | 
| 630 | - require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; | |
| 630 | + require_once ABSPATH.'wp-admin/includes/plugin-install.php'; | |
| 631 | 631 | |
| 632 | 632 | wp_enqueue_style( 'plugin-install' ); | 
| 633 | 633 | |
| @@ -655,7 +655,7 @@ discard block | ||
| 655 | 655 | * @since 2.1.0 | 
| 656 | 656 | */ | 
| 657 | 657 |  		public function thickbox() { | 
| 658 | -			if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) ) { | |
| 658 | +			if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, true ) ) { | |
| 659 | 659 | add_thickbox(); | 
| 660 | 660 | } | 
| 661 | 661 | } | 
| @@ -684,11 +684,11 @@ discard block | ||
| 684 | 684 | $args = apply_filters( | 
| 685 | 685 | 'tgmpa_admin_menu_args', | 
| 686 | 686 | array( | 
| 687 | - 'parent_slug' => $this->parent_slug, // Parent Menu slug. | |
| 688 | - 'page_title' => $this->strings['page_title'], // Page title. | |
| 689 | - 'menu_title' => $this->strings['menu_title'], // Menu title. | |
| 690 | - 'capability' => $this->capability, // Capability. | |
| 691 | - 'menu_slug' => $this->menu, // Menu slug. | |
| 687 | + 'parent_slug' => $this->parent_slug, // Parent Menu slug. | |
| 688 | + 'page_title' => $this->strings[ 'page_title' ], // Page title. | |
| 689 | + 'menu_title' => $this->strings[ 'menu_title' ], // Menu title. | |
| 690 | + 'capability' => $this->capability, // Capability. | |
| 691 | + 'menu_slug' => $this->menu, // Menu slug. | |
| 692 | 692 | 'function' => array( $this, 'install_plugins_page' ), // Callback. | 
| 693 | 693 | ) | 
| 694 | 694 | ); | 
| @@ -712,9 +712,9 @@ discard block | ||
| 712 | 712 | } | 
| 713 | 713 | |
| 714 | 714 |  			if ( 'themes.php' === $this->parent_slug ) { | 
| 715 | - $this->page_hook = call_user_func( 'add_theme_page', $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] ); | |
| 715 | + $this->page_hook = call_user_func( 'add_theme_page', $args[ 'page_title' ], $args[ 'menu_title' ], $args[ 'capability' ], $args[ 'menu_slug' ], $args[ 'function' ] ); | |
| 716 | 716 |  			} else { | 
| 717 | - $this->page_hook = call_user_func( 'add_submenu_page', $args['parent_slug'], $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] ); | |
| 717 | + $this->page_hook = call_user_func( 'add_submenu_page', $args[ 'parent_slug' ], $args[ 'page_title' ], $args[ 'menu_title' ], $args[ 'capability' ], $args[ 'menu_slug' ], $args[ 'function' ] ); | |
| 718 | 718 | } | 
| 719 | 719 | } | 
| 720 | 720 | |
| @@ -783,37 +783,37 @@ discard block | ||
| 783 | 783 | * @return boolean True on success, false on failure. | 
| 784 | 784 | */ | 
| 785 | 785 |  		protected function do_plugin_install() { | 
| 786 | -			if ( empty( $_GET['plugin'] ) ) { | |
| 786 | +			if ( empty( $_GET[ 'plugin' ] ) ) { | |
| 787 | 787 | return false; | 
| 788 | 788 | } | 
| 789 | 789 | |
| 790 | 790 | // All plugin information will be stored in an array for processing. | 
| 791 | - $slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) ); | |
| 791 | + $slug = $this->sanitize_key( urldecode( $_GET[ 'plugin' ] ) ); | |
| 792 | 792 | |
| 793 | 793 |  			if ( ! isset( $this->plugins[ $slug ] ) ) { | 
| 794 | 794 | return false; | 
| 795 | 795 | } | 
| 796 | 796 | |
| 797 | 797 | // Was an install or upgrade action link clicked? | 
| 798 | -			if ( ( isset( $_GET['tgmpa-install'] ) && 'install-plugin' === $_GET['tgmpa-install'] ) || ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) ) { | |
| 798 | +			if ( ( isset( $_GET[ 'tgmpa-install' ] ) && 'install-plugin' === $_GET[ 'tgmpa-install' ] ) || ( isset( $_GET[ 'tgmpa-update' ] ) && 'update-plugin' === $_GET[ 'tgmpa-update' ] ) ) { | |
| 799 | 799 | |
| 800 | 800 | $install_type = 'install'; | 
| 801 | -				if ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) { | |
| 801 | +				if ( isset( $_GET[ 'tgmpa-update' ] ) && 'update-plugin' === $_GET[ 'tgmpa-update' ] ) { | |
| 802 | 802 | $install_type = 'update'; | 
| 803 | 803 | } | 
| 804 | 804 | |
| 805 | - check_admin_referer( 'tgmpa-' . $install_type, 'tgmpa-nonce' ); | |
| 805 | + check_admin_referer( 'tgmpa-'.$install_type, 'tgmpa-nonce' ); | |
| 806 | 806 | |
| 807 | 807 | // Pass necessary information via URL if WP_Filesystem is needed. | 
| 808 | 808 | $url = wp_nonce_url( | 
| 809 | 809 | add_query_arg( | 
| 810 | 810 | array( | 
| 811 | 811 | 'plugin' => urlencode( $slug ), | 
| 812 | - 'tgmpa-' . $install_type => $install_type . '-plugin', | |
| 812 | + 'tgmpa-'.$install_type => $install_type.'-plugin', | |
| 813 | 813 | ), | 
| 814 | 814 | $this->get_tgmpa_url() | 
| 815 | 815 | ), | 
| 816 | - 'tgmpa-' . $install_type, | |
| 816 | + 'tgmpa-'.$install_type, | |
| 817 | 817 | 'tgmpa-nonce' | 
| 818 | 818 | ); | 
| 819 | 819 | |
| @@ -832,29 +832,29 @@ discard block | ||
| 832 | 832 | |
| 833 | 833 | // Prep variables for Plugin_Installer_Skin class. | 
| 834 | 834 | $extra = array(); | 
| 835 | - $extra['slug'] = $slug; // Needed for potentially renaming of directory name. | |
| 835 | + $extra[ 'slug' ] = $slug; // Needed for potentially renaming of directory name. | |
| 836 | 836 | $source = $this->get_download_url( $slug ); | 
| 837 | - $api = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null; | |
| 837 | + $api = ( 'repo' === $this->plugins[ $slug ][ 'source_type' ] ) ? $this->get_plugins_api( $slug ) : null; | |
| 838 | 838 | $api = ( false !== $api ) ? $api : null; | 
| 839 | 839 | |
| 840 | 840 | $url = add_query_arg( | 
| 841 | 841 | array( | 
| 842 | - 'action' => $install_type . '-plugin', | |
| 842 | + 'action' => $install_type.'-plugin', | |
| 843 | 843 | 'plugin' => urlencode( $slug ), | 
| 844 | 844 | ), | 
| 845 | 845 | 'update.php' | 
| 846 | 846 | ); | 
| 847 | 847 | |
| 848 | 848 |  				if ( ! class_exists( 'Plugin_Upgrader', false ) ) { | 
| 849 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; | |
| 849 | + require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; | |
| 850 | 850 | } | 
| 851 | 851 | |
| 852 | - $title = ( 'update' === $install_type ) ? $this->strings['updating'] : $this->strings['installing']; | |
| 852 | + $title = ( 'update' === $install_type ) ? $this->strings[ 'updating' ] : $this->strings[ 'installing' ]; | |
| 853 | 853 | $skin_args = array( | 
| 854 | - 'type' => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload', | |
| 855 | - 'title' => sprintf( $title, $this->plugins[ $slug ]['name'] ), | |
| 854 | + 'type' => ( 'bundled' !== $this->plugins[ $slug ][ 'source_type' ] ) ? 'web' : 'upload', | |
| 855 | + 'title' => sprintf( $title, $this->plugins[ $slug ][ 'name' ] ), | |
| 856 | 856 | 'url' => esc_url_raw( $url ), | 
| 857 | - 'nonce' => $install_type . '-plugin_' . $slug, | |
| 857 | + 'nonce' => $install_type.'-plugin_'.$slug, | |
| 858 | 858 | 'plugin' => '', | 
| 859 | 859 | 'api' => $api, | 
| 860 | 860 | 'extra' => $extra, | 
| @@ -862,7 +862,7 @@ discard block | ||
| 862 | 862 | unset( $title ); | 
| 863 | 863 | |
| 864 | 864 |  				if ( 'update' === $install_type ) { | 
| 865 | - $skin_args['plugin'] = $this->plugins[ $slug ]['file_path']; | |
| 865 | + $skin_args[ 'plugin' ] = $this->plugins[ $slug ][ 'file_path' ]; | |
| 866 | 866 | $skin = new Plugin_Upgrader_Skin( $skin_args ); | 
| 867 | 867 |  				} else { | 
| 868 | 868 | $skin = new Plugin_Installer_Skin( $skin_args ); | 
| @@ -877,10 +877,10 @@ discard block | ||
| 877 | 877 |  				if ( 'update' === $install_type ) { | 
| 878 | 878 | // Inject our info into the update transient. | 
| 879 | 879 | $to_inject = array( $slug => $this->plugins[ $slug ] ); | 
| 880 | - $to_inject[ $slug ]['source'] = $source; | |
| 880 | + $to_inject[ $slug ][ 'source' ] = $source; | |
| 881 | 881 | $this->inject_update_info( $to_inject ); | 
| 882 | 882 | |
| 883 | - $upgrader->upgrade( $this->plugins[ $slug ]['file_path'] ); | |
| 883 | + $upgrader->upgrade( $this->plugins[ $slug ][ 'file_path' ] ); | |
| 884 | 884 |  				} else { | 
| 885 | 885 | $upgrader->install( $source ); | 
| 886 | 886 | } | 
| @@ -903,18 +903,18 @@ discard block | ||
| 903 | 903 | |
| 904 | 904 | // Display message based on if all plugins are now active or not. | 
| 905 | 905 |  				if ( $this->is_tgmpa_complete() ) { | 
| 906 | - echo '<p>', sprintf( esc_html( $this->strings['complete'] ), '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' ), '</p>'; | |
| 906 | + echo '<p>', sprintf( esc_html( $this->strings[ 'complete' ] ), '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' ), '</p>'; | |
| 907 | 907 |  					echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; | 
| 908 | 908 |  				} else { | 
| 909 | - echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; | |
| 909 | + echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings[ 'return' ] ), '</a></p>'; | |
| 910 | 910 | } | 
| 911 | 911 | |
| 912 | 912 | return true; | 
| 913 | -			} elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) { | |
| 913 | +			} elseif ( isset( $this->plugins[ $slug ][ 'file_path' ], $_GET[ 'tgmpa-activate' ] ) && 'activate-plugin' === $_GET[ 'tgmpa-activate' ] ) { | |
| 914 | 914 | // Activate action link was clicked. | 
| 915 | 915 | check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' ); | 
| 916 | 916 | |
| 917 | -				if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) { | |
| 917 | +				if ( false === $this->activate_single_plugin( $this->plugins[ $slug ][ 'file_path' ], $slug ) ) { | |
| 918 | 918 | return true; // Finish execution of the function early as we encountered an error. | 
| 919 | 919 | } | 
| 920 | 920 | } | 
| @@ -937,7 +937,7 @@ discard block | ||
| 937 | 937 | } | 
| 938 | 938 | |
| 939 | 939 |  			foreach ( $plugins as $slug => $plugin ) { | 
| 940 | - $file_path = $plugin['file_path']; | |
| 940 | + $file_path = $plugin[ 'file_path' ]; | |
| 941 | 941 | |
| 942 | 942 |  				if ( empty( $repo_updates->response[ $file_path ] ) ) { | 
| 943 | 943 | $repo_updates->response[ $file_path ] = new stdClass; | 
| @@ -946,10 +946,10 @@ discard block | ||
| 946 | 946 | // We only really need to set package, but let's do all we can in case WP changes something. | 
| 947 | 947 | $repo_updates->response[ $file_path ]->slug = $slug; | 
| 948 | 948 | $repo_updates->response[ $file_path ]->plugin = $file_path; | 
| 949 | - $repo_updates->response[ $file_path ]->new_version = $plugin['version']; | |
| 950 | - $repo_updates->response[ $file_path ]->package = $plugin['source']; | |
| 951 | -				if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) { | |
| 952 | - $repo_updates->response[ $file_path ]->url = $plugin['external_url']; | |
| 949 | + $repo_updates->response[ $file_path ]->new_version = $plugin[ 'version' ]; | |
| 950 | + $repo_updates->response[ $file_path ]->package = $plugin[ 'source' ]; | |
| 951 | +				if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin[ 'external_url' ] ) ) { | |
| 952 | + $repo_updates->response[ $file_path ]->url = $plugin[ 'external_url' ]; | |
| 953 | 953 | } | 
| 954 | 954 | } | 
| 955 | 955 | |
| @@ -973,13 +973,13 @@ discard block | ||
| 973 | 973 | * @return string $source | 
| 974 | 974 | */ | 
| 975 | 975 |  		public function maybe_adjust_source_dir( $source, $remote_source, $upgrader ) { | 
| 976 | -			if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS['wp_filesystem'] ) ) { | |
| 976 | +			if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS[ 'wp_filesystem' ] ) ) { | |
| 977 | 977 | return $source; | 
| 978 | 978 | } | 
| 979 | 979 | |
| 980 | 980 | // Check for single file plugins. | 
| 981 | - $source_files = array_keys( $GLOBALS['wp_filesystem']->dirlist( $remote_source ) ); | |
| 982 | -			if ( 1 === count( $source_files ) && false === $GLOBALS['wp_filesystem']->is_dir( $source ) ) { | |
| 981 | + $source_files = array_keys( $GLOBALS[ 'wp_filesystem' ]->dirlist( $remote_source ) ); | |
| 982 | +			if ( 1 === count( $source_files ) && false === $GLOBALS[ 'wp_filesystem' ]->is_dir( $source ) ) { | |
| 983 | 983 | return $source; | 
| 984 | 984 | } | 
| 985 | 985 | |
| @@ -987,12 +987,12 @@ discard block | ||
| 987 | 987 | $desired_slug = ''; | 
| 988 | 988 | |
| 989 | 989 | // Figure out what the slug is supposed to be. | 
| 990 | -			if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options['extra']['slug'] ) ) { | |
| 991 | - $desired_slug = $upgrader->skin->options['extra']['slug']; | |
| 990 | +			if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options[ 'extra' ][ 'slug' ] ) ) { | |
| 991 | + $desired_slug = $upgrader->skin->options[ 'extra' ][ 'slug' ]; | |
| 992 | 992 |  			} else { | 
| 993 | 993 | // Bulk installer contains less info, so fall back on the info registered here. | 
| 994 | 994 |  				foreach ( $this->plugins as $slug => $plugin ) { | 
| 995 | -					if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { | |
| 995 | +					if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin[ 'name' ] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { | |
| 996 | 996 | $desired_slug = $slug; | 
| 997 | 997 | break; | 
| 998 | 998 | } | 
| @@ -1005,15 +1005,15 @@ discard block | ||
| 1005 | 1005 | |
| 1006 | 1006 |  				if ( ! empty( $subdir_name ) && $subdir_name !== $desired_slug ) { | 
| 1007 | 1007 | $from = untrailingslashit( $source ); | 
| 1008 | - $to = trailingslashit( $remote_source ) . $desired_slug; | |
| 1008 | + $to = trailingslashit( $remote_source ).$desired_slug; | |
| 1009 | 1009 | |
| 1010 | -					if ( true === $GLOBALS['wp_filesystem']->move( $from, $to ) ) { | |
| 1010 | +					if ( true === $GLOBALS[ 'wp_filesystem' ]->move( $from, $to ) ) { | |
| 1011 | 1011 | return trailingslashit( $to ); | 
| 1012 | 1012 |  					} else { | 
| 1013 | - return new WP_Error( 'rename_failed', esc_html__( 'The remote plugin package does not contain a folder with the desired slug and renaming did not work.', 'tgmpa' ) . ' ' . esc_html__( 'Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'tgmpa' ), array( 'found' => $subdir_name, 'expected' => $desired_slug ) ); | |
| 1013 | + return new WP_Error( 'rename_failed', esc_html__( 'The remote plugin package does not contain a folder with the desired slug and renaming did not work.', 'tgmpa' ).' '.esc_html__( 'Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'tgmpa' ), array( 'found' => $subdir_name, 'expected' => $desired_slug ) ); | |
| 1014 | 1014 | } | 
| 1015 | 1015 |  				} elseif ( empty( $subdir_name ) ) { | 
| 1016 | - return new WP_Error( 'packaged_wrong', esc_html__( 'The remote plugin package consists of more than one file, but the files are not packaged in a folder.', 'tgmpa' ) . ' ' . esc_html__( 'Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'tgmpa' ), array( 'found' => $subdir_name, 'expected' => $desired_slug ) ); | |
| 1016 | + return new WP_Error( 'packaged_wrong', esc_html__( 'The remote plugin package consists of more than one file, but the files are not packaged in a folder.', 'tgmpa' ).' '.esc_html__( 'Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'tgmpa' ), array( 'found' => $subdir_name, 'expected' => $desired_slug ) ); | |
| 1017 | 1017 | } | 
| 1018 | 1018 | } | 
| 1019 | 1019 | |
| @@ -1037,19 +1037,19 @@ discard block | ||
| 1037 | 1037 | |
| 1038 | 1038 |  				if ( is_wp_error( $activate ) ) { | 
| 1039 | 1039 | echo '<div id="message" class="error"><p>', wp_kses_post( $activate->get_error_message() ), '</p></div>', | 
| 1040 | - '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; | |
| 1040 | + '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings[ 'return' ] ), '</a></p>'; | |
| 1041 | 1041 | |
| 1042 | 1042 | return false; // End it here if there is an error with activation. | 
| 1043 | 1043 |  				} else { | 
| 1044 | 1044 |  					if ( ! $automatic ) { | 
| 1045 | 1045 | // Make sure message doesn't display again if bulk activation is performed | 
| 1046 | 1046 | // immediately after a single activation. | 
| 1047 | -						if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. | |
| 1048 | - echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>'; | |
| 1047 | +						if ( ! isset( $_POST[ 'action' ] ) ) { // WPCS: CSRF OK. | |
| 1048 | + echo '<div id="message" class="updated"><p>', esc_html( $this->strings[ 'activated_successfully' ] ), ' <strong>', esc_html( $this->plugins[ $slug ][ 'name' ] ), '.</strong></p></div>'; | |
| 1049 | 1049 | } | 
| 1050 | 1050 |  					} else { | 
| 1051 | 1051 | // Simpler message layout for use on the plugin install page. | 
| 1052 | - echo '<p>', esc_html( $this->strings['plugin_activated'] ), '</p>'; | |
| 1052 | + echo '<p>', esc_html( $this->strings[ 'plugin_activated' ] ), '</p>'; | |
| 1053 | 1053 | } | 
| 1054 | 1054 | } | 
| 1055 | 1055 |  			} elseif ( $this->is_plugin_active( $slug ) ) { | 
| @@ -1057,25 +1057,25 @@ discard block | ||
| 1057 | 1057 | // on the plugin install page. | 
| 1058 | 1058 | echo '<div id="message" class="error"><p>', | 
| 1059 | 1059 | sprintf( | 
| 1060 | - esc_html( $this->strings['plugin_already_active'] ), | |
| 1061 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' | |
| 1060 | + esc_html( $this->strings[ 'plugin_already_active' ] ), | |
| 1061 | + '<strong>'.esc_html( $this->plugins[ $slug ][ 'name' ] ).'</strong>' | |
| 1062 | 1062 | ), | 
| 1063 | 1063 | '</p></div>'; | 
| 1064 | 1064 |  			} elseif ( $this->does_plugin_require_update( $slug ) ) { | 
| 1065 | 1065 |  				if ( ! $automatic ) { | 
| 1066 | 1066 | // Make sure message doesn't display again if bulk activation is performed | 
| 1067 | 1067 | // immediately after a single activation. | 
| 1068 | -					if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. | |
| 1068 | +					if ( ! isset( $_POST[ 'action' ] ) ) { // WPCS: CSRF OK. | |
| 1069 | 1069 | echo '<div id="message" class="error"><p>', | 
| 1070 | 1070 | sprintf( | 
| 1071 | - esc_html( $this->strings['plugin_needs_higher_version'] ), | |
| 1072 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' | |
| 1071 | + esc_html( $this->strings[ 'plugin_needs_higher_version' ] ), | |
| 1072 | + '<strong>'.esc_html( $this->plugins[ $slug ][ 'name' ] ).'</strong>' | |
| 1073 | 1073 | ), | 
| 1074 | 1074 | '</p></div>'; | 
| 1075 | 1075 | } | 
| 1076 | 1076 |  				} else { | 
| 1077 | 1077 | // Simpler message layout for use on the plugin install page. | 
| 1078 | - echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>'; | |
| 1078 | + echo '<p>', sprintf( esc_html( $this->strings[ 'plugin_needs_higher_version' ] ), esc_html( $this->plugins[ $slug ][ 'name' ] ) ), '</p>'; | |
| 1079 | 1079 | } | 
| 1080 | 1080 | } | 
| 1081 | 1081 | |
| @@ -1099,7 +1099,7 @@ discard block | ||
| 1099 | 1099 | */ | 
| 1100 | 1100 |  		public function notices() { | 
| 1101 | 1101 | // Remove nag on the install page / Return early if the nag message has been dismissed or user < author. | 
| 1102 | -			if ( $this->is_tgmpa_page() || get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) || ! current_user_can( apply_filters( 'tgmpa_show_admin_notice_capability', 'publish_posts' ) ) ) { | |
| 1102 | +			if ( $this->is_tgmpa_page() || get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, true ) || ! current_user_can( apply_filters( 'tgmpa_show_admin_notice_capability', 'publish_posts' ) ) ) { | |
| 1103 | 1103 | return; | 
| 1104 | 1104 | } | 
| 1105 | 1105 | |
| @@ -1121,13 +1121,13 @@ discard block | ||
| 1121 | 1121 |  					if ( current_user_can( 'install_plugins' ) ) { | 
| 1122 | 1122 | $install_link_count++; | 
| 1123 | 1123 | |
| 1124 | -						if ( true === $plugin['required'] ) { | |
| 1125 | - $message['notice_can_install_required'][] = $slug; | |
| 1124 | +						if ( true === $plugin[ 'required' ] ) { | |
| 1125 | + $message[ 'notice_can_install_required' ][ ] = $slug; | |
| 1126 | 1126 |  						} else { | 
| 1127 | - $message['notice_can_install_recommended'][] = $slug; | |
| 1127 | + $message[ 'notice_can_install_recommended' ][ ] = $slug; | |
| 1128 | 1128 | } | 
| 1129 | 1129 | } | 
| 1130 | -					if ( true === $plugin['required'] ) { | |
| 1130 | +					if ( true === $plugin[ 'required' ] ) { | |
| 1131 | 1131 | $total_required_action_count++; | 
| 1132 | 1132 | } | 
| 1133 | 1133 |  				} else { | 
| @@ -1135,13 +1135,13 @@ discard block | ||
| 1135 | 1135 |  						if ( current_user_can( 'activate_plugins' ) ) { | 
| 1136 | 1136 | $activate_link_count++; | 
| 1137 | 1137 | |
| 1138 | -							if ( true === $plugin['required'] ) { | |
| 1139 | - $message['notice_can_activate_required'][] = $slug; | |
| 1138 | +							if ( true === $plugin[ 'required' ] ) { | |
| 1139 | + $message[ 'notice_can_activate_required' ][ ] = $slug; | |
| 1140 | 1140 |  							} else { | 
| 1141 | - $message['notice_can_activate_recommended'][] = $slug; | |
| 1141 | + $message[ 'notice_can_activate_recommended' ][ ] = $slug; | |
| 1142 | 1142 | } | 
| 1143 | 1143 | } | 
| 1144 | -						if ( true === $plugin['required'] ) { | |
| 1144 | +						if ( true === $plugin[ 'required' ] ) { | |
| 1145 | 1145 | $total_required_action_count++; | 
| 1146 | 1146 | } | 
| 1147 | 1147 | } | 
| @@ -1152,12 +1152,12 @@ discard block | ||
| 1152 | 1152 | $update_link_count++; | 
| 1153 | 1153 | |
| 1154 | 1154 |  							if ( $this->does_plugin_require_update( $slug ) ) { | 
| 1155 | - $message['notice_ask_to_update'][] = $slug; | |
| 1155 | + $message[ 'notice_ask_to_update' ][ ] = $slug; | |
| 1156 | 1156 |  							} elseif ( false !== $this->does_plugin_have_update( $slug ) ) { | 
| 1157 | - $message['notice_ask_to_update_maybe'][] = $slug; | |
| 1157 | + $message[ 'notice_ask_to_update_maybe' ][ ] = $slug; | |
| 1158 | 1158 | } | 
| 1159 | 1159 | } | 
| 1160 | -						if ( true === $plugin['required'] ) { | |
| 1160 | +						if ( true === $plugin[ 'required' ] ) { | |
| 1161 | 1161 | $total_required_action_count++; | 
| 1162 | 1162 | } | 
| 1163 | 1163 | } | 
| @@ -1172,10 +1172,10 @@ discard block | ||
| 1172 | 1172 | |
| 1173 | 1173 | // As add_settings_error() wraps the final message in a <p> and as the final message can't be | 
| 1174 | 1174 | // filtered, using <p>'s in our html would render invalid html output. | 
| 1175 | - $line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>' . "\n"; | |
| 1175 | + $line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>'."\n"; | |
| 1176 | 1176 | |
| 1177 | 1177 |  				if ( ! current_user_can( 'activate_plugins' ) && ! current_user_can( 'install_plugins' ) && ! current_user_can( 'update_plugins' ) ) { | 
| 1178 | - $rendered = esc_html__( $this->strings['notice_cannot_install_activate'] ) . ' ' . esc_html__( $this->strings['contact_admin'] ); | |
| 1178 | + $rendered = esc_html__( $this->strings[ 'notice_cannot_install_activate' ] ).' '.esc_html__( $this->strings[ 'contact_admin' ] ); | |
| 1179 | 1179 | $rendered .= $this->create_user_action_links_for_notice( 0, 0, 0, $line_template ); | 
| 1180 | 1180 |  				} else { | 
| 1181 | 1181 | |
| @@ -1190,14 +1190,14 @@ discard block | ||
| 1190 | 1190 | |
| 1191 | 1191 | // Get the external info link for a plugin if one is available. | 
| 1192 | 1192 |  						foreach ( $plugin_group as $plugin_slug ) { | 
| 1193 | - $linked_plugins[] = $this->get_info_link( $plugin_slug ); | |
| 1193 | + $linked_plugins[ ] = $this->get_info_link( $plugin_slug ); | |
| 1194 | 1194 | } | 
| 1195 | 1195 | unset( $plugin_slug ); | 
| 1196 | 1196 | |
| 1197 | 1197 | $count = count( $plugin_group ); | 
| 1198 | 1198 | $linked_plugins = array_map( array( 'TGMPA_Utils', 'wrap_in_em' ), $linked_plugins ); | 
| 1199 | 1199 | $last_plugin = array_pop( $linked_plugins ); // Pop off last name to prep for readability. | 
| 1200 | - $imploded = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); | |
| 1200 | + $imploded = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); | |
| 1201 | 1201 | |
| 1202 | 1202 | $rendered .= sprintf( | 
| 1203 | 1203 | $line_template, | 
| @@ -1219,7 +1219,7 @@ discard block | ||
| 1219 | 1219 | } | 
| 1220 | 1220 | |
| 1221 | 1221 | // Admin options pages already output settings_errors, so this is to avoid duplication. | 
| 1222 | -			if ( 'options-general' !== $GLOBALS['current_screen']->parent_base ) { | |
| 1222 | +			if ( 'options-general' !== $GLOBALS[ 'current_screen' ]->parent_base ) { | |
| 1223 | 1223 | $this->display_settings_errors(); | 
| 1224 | 1224 | } | 
| 1225 | 1225 | } | 
| @@ -1241,32 +1241,32 @@ discard block | ||
| 1241 | 1241 | 'install' => '', | 
| 1242 | 1242 | 'update' => '', | 
| 1243 | 1243 | 'activate' => '', | 
| 1244 | - 'dismiss' => $this->dismissable ? '<a href="' . esc_url( wp_nonce_url( add_query_arg( 'tgmpa-dismiss', 'dismiss_admin_notices' ), 'tgmpa-dismiss-' . get_current_user_id() ) ) . '" class="dismiss-notice" target="_parent">' . esc_html( $this->strings['dismiss'] ) . '</a>' : '', | |
| 1244 | + 'dismiss' => $this->dismissable ? '<a href="'.esc_url( wp_nonce_url( add_query_arg( 'tgmpa-dismiss', 'dismiss_admin_notices' ), 'tgmpa-dismiss-'.get_current_user_id() ) ).'" class="dismiss-notice" target="_parent">'.esc_html( $this->strings[ 'dismiss' ] ).'</a>' : '', | |
| 1245 | 1245 | ); | 
| 1246 | 1246 | |
| 1247 | 1247 | $link_template = '<a href="%2$s">%1$s</a>'; | 
| 1248 | 1248 | |
| 1249 | 1249 |  			if ( current_user_can( 'install_plugins' ) ) { | 
| 1250 | 1250 |  				if ( $install_count > 0 ) { | 
| 1251 | - $action_links['install'] = sprintf( | |
| 1251 | + $action_links[ 'install' ] = sprintf( | |
| 1252 | 1252 | $link_template, | 
| 1253 | - translate_nooped_plural( $this->strings['install_link'], $install_count, 'tgmpa' ), | |
| 1253 | + translate_nooped_plural( $this->strings[ 'install_link' ], $install_count, 'tgmpa' ), | |
| 1254 | 1254 | esc_url( $this->get_tgmpa_status_url( 'install' ) ) | 
| 1255 | 1255 | ); | 
| 1256 | 1256 | } | 
| 1257 | 1257 |  				if ( $update_count > 0 ) { | 
| 1258 | - $action_links['update'] = sprintf( | |
| 1258 | + $action_links[ 'update' ] = sprintf( | |
| 1259 | 1259 | $link_template, | 
| 1260 | - translate_nooped_plural( $this->strings['update_link'], $update_count, 'tgmpa' ), | |
| 1260 | + translate_nooped_plural( $this->strings[ 'update_link' ], $update_count, 'tgmpa' ), | |
| 1261 | 1261 | esc_url( $this->get_tgmpa_status_url( 'update' ) ) | 
| 1262 | 1262 | ); | 
| 1263 | 1263 | } | 
| 1264 | 1264 | } | 
| 1265 | 1265 | |
| 1266 | 1266 |  			if ( current_user_can( 'activate_plugins' ) && $activate_count > 0 ) { | 
| 1267 | - $action_links['activate'] = sprintf( | |
| 1267 | + $action_links[ 'activate' ] = sprintf( | |
| 1268 | 1268 | $link_template, | 
| 1269 | - translate_nooped_plural( $this->strings['activate_link'], $activate_count, 'tgmpa' ), | |
| 1269 | + translate_nooped_plural( $this->strings[ 'activate_link' ], $activate_count, 'tgmpa' ), | |
| 1270 | 1270 | esc_url( $this->get_tgmpa_status_url( 'activate' ) ) | 
| 1271 | 1271 | ); | 
| 1272 | 1272 | } | 
| @@ -1294,8 +1294,8 @@ discard block | ||
| 1294 | 1294 | * @return string | 
| 1295 | 1295 | */ | 
| 1296 | 1296 |  		protected function get_admin_notice_class() { | 
| 1297 | -			if ( ! empty( $this->strings['nag_type'] ) ) { | |
| 1298 | - return sanitize_html_class( strtolower( $this->strings['nag_type'] ) ); | |
| 1297 | +			if ( ! empty( $this->strings[ 'nag_type' ] ) ) { | |
| 1298 | + return sanitize_html_class( strtolower( $this->strings[ 'nag_type' ] ) ); | |
| 1299 | 1299 |  			} else { | 
| 1300 | 1300 |  				if ( version_compare( $this->wp_version, '4.2', '>=' ) ) { | 
| 1301 | 1301 | return 'notice-warning'; | 
| @@ -1318,7 +1318,7 @@ discard block | ||
| 1318 | 1318 | settings_errors( 'tgmpa' ); | 
| 1319 | 1319 | |
| 1320 | 1320 |  			foreach ( (array) $wp_settings_errors as $key => $details ) { | 
| 1321 | -				if ( 'tgmpa' === $details['setting'] ) { | |
| 1321 | +				if ( 'tgmpa' === $details[ 'setting' ] ) { | |
| 1322 | 1322 | unset( $wp_settings_errors[ $key ] ); | 
| 1323 | 1323 | break; | 
| 1324 | 1324 | } | 
| @@ -1334,8 +1334,8 @@ discard block | ||
| 1334 | 1334 | * @since 2.1.0 | 
| 1335 | 1335 | */ | 
| 1336 | 1336 |  		public function dismiss() { | 
| 1337 | -			if ( isset( $_GET['tgmpa-dismiss'] ) && check_admin_referer( 'tgmpa-dismiss-' . get_current_user_id() ) ) { | |
| 1338 | - update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, 1 ); | |
| 1337 | +			if ( isset( $_GET[ 'tgmpa-dismiss' ] ) && check_admin_referer( 'tgmpa-dismiss-'.get_current_user_id() ) ) { | |
| 1338 | + update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, 1 ); | |
| 1339 | 1339 | } | 
| 1340 | 1340 | } | 
| 1341 | 1341 | |
| @@ -1351,54 +1351,54 @@ discard block | ||
| 1351 | 1351 | * @return null Return early if incorrect argument. | 
| 1352 | 1352 | */ | 
| 1353 | 1353 |  		public function register( $plugin ) { | 
| 1354 | -			if ( empty( $plugin['slug'] ) || empty( $plugin['name'] ) ) { | |
| 1354 | +			if ( empty( $plugin[ 'slug' ] ) || empty( $plugin[ 'name' ] ) ) { | |
| 1355 | 1355 | return; | 
| 1356 | 1356 | } | 
| 1357 | 1357 | |
| 1358 | -			if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) { | |
| 1358 | +			if ( empty( $plugin[ 'slug' ] ) || ! is_string( $plugin[ 'slug' ] ) || isset( $this->plugins[ $plugin[ 'slug' ] ] ) ) { | |
| 1359 | 1359 | return; | 
| 1360 | 1360 | } | 
| 1361 | 1361 | |
| 1362 | 1362 | $defaults = array( | 
| 1363 | - 'name' => '', // String | |
| 1364 | - 'slug' => '', // String | |
| 1365 | - 'source' => 'repo', // String | |
| 1366 | - 'required' => false, // Boolean | |
| 1367 | - 'version' => '', // String | |
| 1368 | - 'force_activation' => false, // Boolean | |
| 1369 | - 'force_deactivation' => false, // Boolean | |
| 1370 | - 'external_url' => '', // String | |
| 1371 | - 'is_callable' => '', // String|Array. | |
| 1363 | + 'name' => '', // String | |
| 1364 | + 'slug' => '', // String | |
| 1365 | + 'source' => 'repo', // String | |
| 1366 | + 'required' => false, // Boolean | |
| 1367 | + 'version' => '', // String | |
| 1368 | + 'force_activation' => false, // Boolean | |
| 1369 | + 'force_deactivation' => false, // Boolean | |
| 1370 | + 'external_url' => '', // String | |
| 1371 | + 'is_callable' => '', // String|Array. | |
| 1372 | 1372 | ); | 
| 1373 | 1373 | |
| 1374 | 1374 | // Prepare the received data. | 
| 1375 | 1375 | $plugin = wp_parse_args( $plugin, $defaults ); | 
| 1376 | 1376 | |
| 1377 | 1377 | // Standardize the received slug. | 
| 1378 | - $plugin['slug'] = $this->sanitize_key( $plugin['slug'] ); | |
| 1378 | + $plugin[ 'slug' ] = $this->sanitize_key( $plugin[ 'slug' ] ); | |
| 1379 | 1379 | |
| 1380 | 1380 | // Forgive users for using string versions of booleans or floats for version number. | 
| 1381 | - $plugin['version'] = (string) $plugin['version']; | |
| 1382 | - $plugin['source'] = empty( $plugin['source'] ) ? 'repo' : $plugin['source']; | |
| 1383 | - $plugin['required'] = TGMPA_Utils::validate_bool( $plugin['required'] ); | |
| 1384 | - $plugin['force_activation'] = TGMPA_Utils::validate_bool( $plugin['force_activation'] ); | |
| 1385 | - $plugin['force_deactivation'] = TGMPA_Utils::validate_bool( $plugin['force_deactivation'] ); | |
| 1381 | + $plugin[ 'version' ] = (string) $plugin[ 'version' ]; | |
| 1382 | + $plugin[ 'source' ] = empty( $plugin[ 'source' ] ) ? 'repo' : $plugin[ 'source' ]; | |
| 1383 | + $plugin[ 'required' ] = TGMPA_Utils::validate_bool( $plugin[ 'required' ] ); | |
| 1384 | + $plugin[ 'force_activation' ] = TGMPA_Utils::validate_bool( $plugin[ 'force_activation' ] ); | |
| 1385 | + $plugin[ 'force_deactivation' ] = TGMPA_Utils::validate_bool( $plugin[ 'force_deactivation' ] ); | |
| 1386 | 1386 | |
| 1387 | 1387 | // Enrich the received data. | 
| 1388 | - $plugin['file_path'] = $this->_get_plugin_basename_from_slug( $plugin['slug'] ); | |
| 1389 | - $plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] ); | |
| 1388 | + $plugin[ 'file_path' ] = $this->_get_plugin_basename_from_slug( $plugin[ 'slug' ] ); | |
| 1389 | + $plugin[ 'source_type' ] = $this->get_plugin_source_type( $plugin[ 'source' ] ); | |
| 1390 | 1390 | |
| 1391 | 1391 | // Set the class properties. | 
| 1392 | - $this->plugins[ $plugin['slug'] ] = $plugin; | |
| 1393 | - $this->sort_order[ $plugin['slug'] ] = $plugin['name']; | |
| 1392 | + $this->plugins[ $plugin[ 'slug' ] ] = $plugin; | |
| 1393 | + $this->sort_order[ $plugin[ 'slug' ] ] = $plugin[ 'name' ]; | |
| 1394 | 1394 | |
| 1395 | 1395 | // Should we add the force activation hook ? | 
| 1396 | -			if ( true === $plugin['force_activation'] ) { | |
| 1396 | +			if ( true === $plugin[ 'force_activation' ] ) { | |
| 1397 | 1397 | $this->has_forced_activation = true; | 
| 1398 | 1398 | } | 
| 1399 | 1399 | |
| 1400 | 1400 | // Should we add the force deactivation hook ? | 
| 1401 | -			if ( true === $plugin['force_deactivation'] ) { | |
| 1401 | +			if ( true === $plugin[ 'force_deactivation' ] ) { | |
| 1402 | 1402 | $this->has_forced_deactivation = true; | 
| 1403 | 1403 | } | 
| 1404 | 1404 | } | 
| @@ -1524,11 +1524,11 @@ discard block | ||
| 1524 | 1524 | */ | 
| 1525 | 1525 |  		public function populate_file_path( $plugin_slug = '' ) { | 
| 1526 | 1526 |  			if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) { | 
| 1527 | - $this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug ); | |
| 1527 | + $this->plugins[ $plugin_slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $plugin_slug ); | |
| 1528 | 1528 |  			} else { | 
| 1529 | 1529 | // Add file_path key for all plugins. | 
| 1530 | 1530 |  				foreach ( $this->plugins as $slug => $values ) { | 
| 1531 | - $this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug ); | |
| 1531 | + $this->plugins[ $slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $slug ); | |
| 1532 | 1532 | } | 
| 1533 | 1533 | } | 
| 1534 | 1534 | } | 
| @@ -1546,7 +1546,7 @@ discard block | ||
| 1546 | 1546 | $keys = array_keys( $this->get_plugins() ); | 
| 1547 | 1547 | |
| 1548 | 1548 |  			foreach ( $keys as $key ) { | 
| 1549 | -				if ( preg_match( '|^' . $slug . '/|', $key ) ) { | |
| 1549 | +				if ( preg_match( '|^'.$slug.'/|', $key ) ) { | |
| 1550 | 1550 | return $key; | 
| 1551 | 1551 | } | 
| 1552 | 1552 | } | 
| @@ -1568,7 +1568,7 @@ discard block | ||
| 1568 | 1568 | */ | 
| 1569 | 1569 |  		public function _get_plugin_data_from_name( $name, $data = 'slug' ) { | 
| 1570 | 1570 |  			foreach ( $this->plugins as $values ) { | 
| 1571 | -				if ( $name === $values['name'] && isset( $values[ $data ] ) ) { | |
| 1571 | +				if ( $name === $values[ 'name' ] && isset( $values[ $data ] ) ) { | |
| 1572 | 1572 | return $values[ $data ]; | 
| 1573 | 1573 | } | 
| 1574 | 1574 | } | 
| @@ -1587,13 +1587,13 @@ discard block | ||
| 1587 | 1587 |  		public function get_download_url( $slug ) { | 
| 1588 | 1588 | $dl_source = ''; | 
| 1589 | 1589 | |
| 1590 | -			switch ( $this->plugins[ $slug ]['source_type'] ) { | |
| 1590 | +			switch ( $this->plugins[ $slug ][ 'source_type' ] ) { | |
| 1591 | 1591 | case 'repo': | 
| 1592 | 1592 | return $this->get_wp_repo_download_url( $slug ); | 
| 1593 | 1593 | case 'external': | 
| 1594 | - return $this->plugins[ $slug ]['source']; | |
| 1594 | + return $this->plugins[ $slug ][ 'source' ]; | |
| 1595 | 1595 | case 'bundled': | 
| 1596 | - return $this->default_path . $this->plugins[ $slug ]['source']; | |
| 1596 | + return $this->default_path.$this->plugins[ $slug ][ 'source' ]; | |
| 1597 | 1597 | } | 
| 1598 | 1598 | |
| 1599 | 1599 | return $dl_source; // Should never happen. | 
| @@ -1631,7 +1631,7 @@ discard block | ||
| 1631 | 1631 | |
| 1632 | 1632 |  			if ( ! isset( $api[ $slug ] ) ) { | 
| 1633 | 1633 |  				if ( ! function_exists( 'plugins_api' ) ) { | 
| 1634 | - require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; | |
| 1634 | + require_once ABSPATH.'wp-admin/includes/plugin-install.php'; | |
| 1635 | 1635 | } | 
| 1636 | 1636 | |
| 1637 | 1637 | $response = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ) ) ); | 
| @@ -1639,7 +1639,7 @@ discard block | ||
| 1639 | 1639 | $api[ $slug ] = false; | 
| 1640 | 1640 | |
| 1641 | 1641 |  				if ( is_wp_error( $response ) ) { | 
| 1642 | - wp_die( esc_html( $this->strings['oops'] ) ); | |
| 1642 | + wp_die( esc_html( $this->strings[ 'oops' ] ) ); | |
| 1643 | 1643 |  				} else { | 
| 1644 | 1644 | $api[ $slug ] = $response; | 
| 1645 | 1645 | } | 
| @@ -1658,13 +1658,13 @@ discard block | ||
| 1658 | 1658 | * or the plugin name if not. | 
| 1659 | 1659 | */ | 
| 1660 | 1660 |  		public function get_info_link( $slug ) { | 
| 1661 | -			if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) { | |
| 1661 | +			if ( ! empty( $this->plugins[ $slug ][ 'external_url' ] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ][ 'external_url' ] ) ) { | |
| 1662 | 1662 | $link = sprintf( | 
| 1663 | 1663 | '<a href="%1$s" target="_blank">%2$s</a>', | 
| 1664 | - esc_url( $this->plugins[ $slug ]['external_url'] ), | |
| 1665 | - esc_html( $this->plugins[ $slug ]['name'] ) | |
| 1664 | + esc_url( $this->plugins[ $slug ][ 'external_url' ] ), | |
| 1665 | + esc_html( $this->plugins[ $slug ][ 'name' ] ) | |
| 1666 | 1666 | ); | 
| 1667 | -			} elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) { | |
| 1667 | +			} elseif ( 'repo' === $this->plugins[ $slug ][ 'source_type' ] ) { | |
| 1668 | 1668 | $url = add_query_arg( | 
| 1669 | 1669 | array( | 
| 1670 | 1670 | 'tab' => 'plugin-information', | 
| @@ -1679,10 +1679,10 @@ discard block | ||
| 1679 | 1679 | $link = sprintf( | 
| 1680 | 1680 | '<a href="%1$s" class="thickbox">%2$s</a>', | 
| 1681 | 1681 | esc_url( $url ), | 
| 1682 | - esc_html( $this->plugins[ $slug ]['name'] ) | |
| 1682 | + esc_html( $this->plugins[ $slug ][ 'name' ] ) | |
| 1683 | 1683 | ); | 
| 1684 | 1684 |  			} else { | 
| 1685 | - $link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink. | |
| 1685 | + $link = esc_html( $this->plugins[ $slug ][ 'name' ] ); // No hyperlink. | |
| 1686 | 1686 | } | 
| 1687 | 1687 | |
| 1688 | 1688 | return $link; | 
| @@ -1696,7 +1696,7 @@ discard block | ||
| 1696 | 1696 | * @return boolean True when on the TGMPA page, false otherwise. | 
| 1697 | 1697 | */ | 
| 1698 | 1698 |  		protected function is_tgmpa_page() { | 
| 1699 | - return isset( $_GET['page'] ) && $this->menu === $_GET['page']; | |
| 1699 | + return isset( $_GET[ 'page' ] ) && $this->menu === $_GET[ 'page' ]; | |
| 1700 | 1700 | } | 
| 1701 | 1701 | |
| 1702 | 1702 | /** | 
| @@ -1778,7 +1778,7 @@ discard block | ||
| 1778 | 1778 |  		public function is_plugin_installed( $slug ) { | 
| 1779 | 1779 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). | 
| 1780 | 1780 | |
| 1781 | - return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) ); | |
| 1781 | + return ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ] ) ); | |
| 1782 | 1782 | } | 
| 1783 | 1783 | |
| 1784 | 1784 | /** | 
| @@ -1790,7 +1790,7 @@ discard block | ||
| 1790 | 1790 | * @return bool True if active, false otherwise. | 
| 1791 | 1791 | */ | 
| 1792 | 1792 |  		public function is_plugin_active( $slug ) { | 
| 1793 | - return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) ); | |
| 1793 | + return ( ( ! empty( $this->plugins[ $slug ][ 'is_callable' ] ) && is_callable( $this->plugins[ $slug ][ 'is_callable' ] ) ) || is_plugin_active( $this->plugins[ $slug ][ 'file_path' ] ) ); | |
| 1794 | 1794 | } | 
| 1795 | 1795 | |
| 1796 | 1796 | /** | 
| @@ -1804,7 +1804,7 @@ discard block | ||
| 1804 | 1804 | */ | 
| 1805 | 1805 |  		public function can_plugin_update( $slug ) { | 
| 1806 | 1806 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. | 
| 1807 | -			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { | |
| 1807 | +			if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { | |
| 1808 | 1808 | return true; | 
| 1809 | 1809 | } | 
| 1810 | 1810 | |
| @@ -1860,8 +1860,8 @@ discard block | ||
| 1860 | 1860 |  		public function get_installed_version( $slug ) { | 
| 1861 | 1861 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). | 
| 1862 | 1862 | |
| 1863 | -			if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) { | |
| 1864 | - return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version']; | |
| 1863 | +			if ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ] ) ) { | |
| 1864 | + return $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ]; | |
| 1865 | 1865 | } | 
| 1866 | 1866 | |
| 1867 | 1867 | return ''; | 
| @@ -1877,7 +1877,7 @@ discard block | ||
| 1877 | 1877 | */ | 
| 1878 | 1878 |  		public function does_plugin_require_update( $slug ) { | 
| 1879 | 1879 | $installed_version = $this->get_installed_version( $slug ); | 
| 1880 | - $minimum_version = $this->plugins[ $slug ]['version']; | |
| 1880 | + $minimum_version = $this->plugins[ $slug ][ 'version' ]; | |
| 1881 | 1881 | |
| 1882 | 1882 | return version_compare( $minimum_version, $installed_version, '>' ); | 
| 1883 | 1883 | } | 
| @@ -1892,9 +1892,9 @@ discard block | ||
| 1892 | 1892 | */ | 
| 1893 | 1893 |  		public function does_plugin_have_update( $slug ) { | 
| 1894 | 1894 | // Presume bundled and external plugins will point to a package which meets the minimum required version. | 
| 1895 | -			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { | |
| 1895 | +			if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { | |
| 1896 | 1896 |  				if ( $this->does_plugin_require_update( $slug ) ) { | 
| 1897 | - return $this->plugins[ $slug ]['version']; | |
| 1897 | + return $this->plugins[ $slug ][ 'version' ]; | |
| 1898 | 1898 | } | 
| 1899 | 1899 | |
| 1900 | 1900 | return false; | 
| @@ -1902,8 +1902,8 @@ discard block | ||
| 1902 | 1902 | |
| 1903 | 1903 | $repo_updates = get_site_transient( 'update_plugins' ); | 
| 1904 | 1904 | |
| 1905 | -			if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) { | |
| 1906 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version; | |
| 1905 | +			if ( isset( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version ) ) { | |
| 1906 | + return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version; | |
| 1907 | 1907 | } | 
| 1908 | 1908 | |
| 1909 | 1909 | return false; | 
| @@ -1919,14 +1919,14 @@ discard block | ||
| 1919 | 1919 | */ | 
| 1920 | 1920 |  		public function get_upgrade_notice( $slug ) { | 
| 1921 | 1921 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. | 
| 1922 | -			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { | |
| 1922 | +			if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { | |
| 1923 | 1923 | return ''; | 
| 1924 | 1924 | } | 
| 1925 | 1925 | |
| 1926 | 1926 | $repo_updates = get_site_transient( 'update_plugins' ); | 
| 1927 | 1927 | |
| 1928 | -			if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) { | |
| 1929 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice; | |
| 1928 | +			if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice ) ) { | |
| 1929 | + return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice; | |
| 1930 | 1930 | } | 
| 1931 | 1931 | |
| 1932 | 1932 | return ''; | 
| @@ -1942,7 +1942,7 @@ discard block | ||
| 1942 | 1942 | */ | 
| 1943 | 1943 |  		public function get_plugins( $plugin_folder = '' ) { | 
| 1944 | 1944 |  			if ( ! function_exists( 'get_plugins' ) ) { | 
| 1945 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 1945 | + require_once ABSPATH.'wp-admin/includes/plugin.php'; | |
| 1946 | 1946 | } | 
| 1947 | 1947 | |
| 1948 | 1948 | return get_plugins( $plugin_folder ); | 
| @@ -1957,7 +1957,7 @@ discard block | ||
| 1957 | 1957 | * @since 2.1.1 | 
| 1958 | 1958 | */ | 
| 1959 | 1959 |  		public function update_dismiss() { | 
| 1960 | - delete_metadata( 'user', null, 'tgmpa_dismissed_notice_' . $this->id, null, true ); | |
| 1960 | + delete_metadata( 'user', null, 'tgmpa_dismissed_notice_'.$this->id, null, true ); | |
| 1961 | 1961 | } | 
| 1962 | 1962 | |
| 1963 | 1963 | /** | 
| @@ -1976,13 +1976,13 @@ discard block | ||
| 1976 | 1976 | */ | 
| 1977 | 1977 |  		public function force_activation() { | 
| 1978 | 1978 |  			foreach ( $this->plugins as $slug => $plugin ) { | 
| 1979 | -				if ( true === $plugin['force_activation'] ) { | |
| 1979 | +				if ( true === $plugin[ 'force_activation' ] ) { | |
| 1980 | 1980 |  					if ( ! $this->is_plugin_installed( $slug ) ) { | 
| 1981 | 1981 | // Oops, plugin isn't there so iterate to next condition. | 
| 1982 | 1982 | continue; | 
| 1983 | 1983 |  					} elseif ( $this->can_plugin_activate( $slug ) ) { | 
| 1984 | 1984 | // There we go, activate the plugin. | 
| 1985 | - activate_plugin( $plugin['file_path'] ); | |
| 1985 | + activate_plugin( $plugin[ 'file_path' ] ); | |
| 1986 | 1986 | } | 
| 1987 | 1987 | } | 
| 1988 | 1988 | } | 
| @@ -2003,8 +2003,8 @@ discard block | ||
| 2003 | 2003 |  		public function force_deactivation() { | 
| 2004 | 2004 |  			foreach ( $this->plugins as $slug => $plugin ) { | 
| 2005 | 2005 | // Only proceed forward if the parameter is set to true and plugin is active. | 
| 2006 | -				if ( true === $plugin['force_deactivation'] && $this->is_plugin_active( $slug ) ) { | |
| 2007 | - deactivate_plugins( $plugin['file_path'] ); | |
| 2006 | +				if ( true === $plugin[ 'force_deactivation' ] && $this->is_plugin_active( $slug ) ) { | |
| 2007 | + deactivate_plugins( $plugin[ 'file_path' ] ); | |
| 2008 | 2008 | } | 
| 2009 | 2009 | } | 
| 2010 | 2010 | } | 
| @@ -2039,7 +2039,7 @@ discard block | ||
| 2039 | 2039 | * Ensure only one instance of the class is ever invoked. | 
| 2040 | 2040 | */ | 
| 2041 | 2041 |  		function load_tgm_plugin_activation() { | 
| 2042 | - $GLOBALS['tgmpa'] = TGM_Plugin_Activation::get_instance(); | |
| 2042 | + $GLOBALS[ 'tgmpa' ] = TGM_Plugin_Activation::get_instance(); | |
| 2043 | 2043 | } | 
| 2044 | 2044 | } | 
| 2045 | 2045 | |
| @@ -2061,7 +2061,7 @@ discard block | ||
| 2061 | 2061 | * @param array $config Optional. An array of configuration values. | 
| 2062 | 2062 | */ | 
| 2063 | 2063 |  	function tgmpa( $plugins, $config = array() ) { | 
| 2064 | - $instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); | |
| 2064 | + $instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); | |
| 2065 | 2065 | |
| 2066 | 2066 |  		foreach ( $plugins as $plugin ) { | 
| 2067 | 2067 | call_user_func( array( $instance, 'register' ), $plugin ); | 
| @@ -2069,17 +2069,17 @@ discard block | ||
| 2069 | 2069 | |
| 2070 | 2070 |  		if ( ! empty( $config ) && is_array( $config ) ) { | 
| 2071 | 2071 | // Send out notices for deprecated arguments passed. | 
| 2072 | -			if ( isset( $config['notices'] ) ) { | |
| 2072 | +			if ( isset( $config[ 'notices' ] ) ) { | |
| 2073 | 2073 | _deprecated_argument( __FUNCTION__, '2.2.0', 'The `notices` config parameter was renamed to `has_notices` in TGMPA 2.2.0. Please adjust your configuration.' ); | 
| 2074 | -				if ( ! isset( $config['has_notices'] ) ) { | |
| 2075 | - $config['has_notices'] = $config['notices']; | |
| 2074 | +				if ( ! isset( $config[ 'has_notices' ] ) ) { | |
| 2075 | + $config[ 'has_notices' ] = $config[ 'notices' ]; | |
| 2076 | 2076 | } | 
| 2077 | 2077 | } | 
| 2078 | 2078 | |
| 2079 | -			if ( isset( $config['parent_menu_slug'] ) ) { | |
| 2079 | +			if ( isset( $config[ 'parent_menu_slug' ] ) ) { | |
| 2080 | 2080 | _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.' ); | 
| 2081 | 2081 | } | 
| 2082 | -			if ( isset( $config['parent_url_slug'] ) ) { | |
| 2082 | +			if ( isset( $config[ 'parent_url_slug' ] ) ) { | |
| 2083 | 2083 | _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.' ); | 
| 2084 | 2084 | } | 
| 2085 | 2085 | |
| @@ -2095,7 +2095,7 @@ discard block | ||
| 2095 | 2095 | * @since 2.2.0 | 
| 2096 | 2096 | */ | 
| 2097 | 2097 |  if ( ! class_exists( 'WP_List_Table' ) ) { | 
| 2098 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; | |
| 2098 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; | |
| 2099 | 2099 | } | 
| 2100 | 2100 | |
| 2101 | 2101 |  if ( ! class_exists( 'TGMPA_List_Table' ) ) { | 
| @@ -2156,7 +2156,7 @@ discard block | ||
| 2156 | 2156 | * @since 2.2.0 | 
| 2157 | 2157 | */ | 
| 2158 | 2158 |  		public function __construct() { | 
| 2159 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); | |
| 2159 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); | |
| 2160 | 2160 | |
| 2161 | 2161 | parent::__construct( | 
| 2162 | 2162 | array( | 
| @@ -2166,8 +2166,8 @@ discard block | ||
| 2166 | 2166 | ) | 
| 2167 | 2167 | ); | 
| 2168 | 2168 | |
| 2169 | -			if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'install', 'update', 'activate' ), true ) ) { | |
| 2170 | - $this->view_context = sanitize_key( $_REQUEST['plugin_status'] ); | |
| 2169 | +			if ( isset( $_REQUEST[ 'plugin_status' ] ) && in_array( $_REQUEST[ 'plugin_status' ], array( 'install', 'update', 'activate' ), true ) ) { | |
| 2170 | + $this->view_context = sanitize_key( $_REQUEST[ 'plugin_status' ] ); | |
| 2171 | 2171 | } | 
| 2172 | 2172 | |
| 2173 | 2173 | add_filter( 'tgmpa_table_data_items', array( $this, 'sort_table_items' ) ); | 
| @@ -2214,20 +2214,20 @@ discard block | ||
| 2214 | 2214 | } | 
| 2215 | 2215 | |
| 2216 | 2216 |  			foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) { | 
| 2217 | - $table_data[ $i ]['sanitized_plugin'] = $plugin['name']; | |
| 2218 | - $table_data[ $i ]['slug'] = $slug; | |
| 2219 | - $table_data[ $i ]['plugin'] = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>'; | |
| 2220 | - $table_data[ $i ]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] ); | |
| 2221 | - $table_data[ $i ]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] ); | |
| 2222 | - $table_data[ $i ]['status'] = $this->get_plugin_status_text( $slug ); | |
| 2223 | - $table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug ); | |
| 2224 | - $table_data[ $i ]['minimum_version'] = $plugin['version']; | |
| 2225 | - $table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug ); | |
| 2217 | + $table_data[ $i ][ 'sanitized_plugin' ] = $plugin[ 'name' ]; | |
| 2218 | + $table_data[ $i ][ 'slug' ] = $slug; | |
| 2219 | + $table_data[ $i ][ 'plugin' ] = '<strong>'.$this->tgmpa->get_info_link( $slug ).'</strong>'; | |
| 2220 | + $table_data[ $i ][ 'source' ] = $this->get_plugin_source_type_text( $plugin[ 'source_type' ] ); | |
| 2221 | + $table_data[ $i ][ 'type' ] = $this->get_plugin_advise_type_text( $plugin[ 'required' ] ); | |
| 2222 | + $table_data[ $i ][ 'status' ] = $this->get_plugin_status_text( $slug ); | |
| 2223 | + $table_data[ $i ][ 'installed_version' ] = $this->tgmpa->get_installed_version( $slug ); | |
| 2224 | + $table_data[ $i ][ 'minimum_version' ] = $plugin[ 'version' ]; | |
| 2225 | + $table_data[ $i ][ 'available_version' ] = $this->tgmpa->does_plugin_have_update( $slug ); | |
| 2226 | 2226 | |
| 2227 | 2227 | // Prep the upgrade notice info. | 
| 2228 | 2228 | $upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug ); | 
| 2229 | 2229 |  				if ( ! empty( $upgrade_notice ) ) { | 
| 2230 | - $table_data[ $i ]['upgrade_notice'] = $upgrade_notice; | |
| 2230 | + $table_data[ $i ][ 'upgrade_notice' ] = $upgrade_notice; | |
| 2231 | 2231 | |
| 2232 | 2232 | add_action( "tgmpa_after_plugin_row_$slug", array( $this, 'wp_plugin_update_row' ), 10, 2 ); | 
| 2233 | 2233 | } | 
| @@ -2258,17 +2258,17 @@ discard block | ||
| 2258 | 2258 | // No need to display plugins if they are installed, up-to-date and active. | 
| 2259 | 2259 | continue; | 
| 2260 | 2260 |  				} else { | 
| 2261 | - $plugins['all'][ $slug ] = $plugin; | |
| 2261 | + $plugins[ 'all' ][ $slug ] = $plugin; | |
| 2262 | 2262 | |
| 2263 | 2263 |  					if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) { | 
| 2264 | - $plugins['install'][ $slug ] = $plugin; | |
| 2264 | + $plugins[ 'install' ][ $slug ] = $plugin; | |
| 2265 | 2265 |  					} else { | 
| 2266 | 2266 |  						if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) { | 
| 2267 | - $plugins['update'][ $slug ] = $plugin; | |
| 2267 | + $plugins[ 'update' ][ $slug ] = $plugin; | |
| 2268 | 2268 | } | 
| 2269 | 2269 | |
| 2270 | 2270 |  						if ( $this->tgmpa->can_plugin_activate( $slug ) ) { | 
| 2271 | - $plugins['activate'][ $slug ] = $plugin; | |
| 2271 | + $plugins[ 'activate' ][ $slug ] = $plugin; | |
| 2272 | 2272 | } | 
| 2273 | 2273 | } | 
| 2274 | 2274 | } | 
| @@ -2387,8 +2387,8 @@ discard block | ||
| 2387 | 2387 | $name = array(); | 
| 2388 | 2388 | |
| 2389 | 2389 |  			foreach ( $items as $i => $plugin ) { | 
| 2390 | - $type[ $i ] = $plugin['type']; // Required / recommended. | |
| 2391 | - $name[ $i ] = $plugin['sanitized_plugin']; | |
| 2390 | + $type[ $i ] = $plugin[ 'type' ]; // Required / recommended. | |
| 2391 | + $name[ $i ] = $plugin[ 'sanitized_plugin' ]; | |
| 2392 | 2392 | } | 
| 2393 | 2393 | |
| 2394 | 2394 | array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items ); | 
| @@ -2470,9 +2470,9 @@ discard block | ||
| 2470 | 2470 |  		public function column_cb( $item ) { | 
| 2471 | 2471 | return sprintf( | 
| 2472 | 2472 | '<input type="checkbox" name="%1$s[]" value="%2$s" id="%3$s" />', | 
| 2473 | - esc_attr( $this->_args['singular'] ), | |
| 2474 | - esc_attr( $item['slug'] ), | |
| 2475 | - esc_attr( $item['sanitized_plugin'] ) | |
| 2473 | + esc_attr( $this->_args[ 'singular' ] ), | |
| 2474 | + esc_attr( $item[ 'slug' ] ), | |
| 2475 | + esc_attr( $item[ 'sanitized_plugin' ] ) | |
| 2476 | 2476 | ); | 
| 2477 | 2477 | } | 
| 2478 | 2478 | |
| @@ -2487,7 +2487,7 @@ discard block | ||
| 2487 | 2487 |  		public function column_plugin( $item ) { | 
| 2488 | 2488 | return sprintf( | 
| 2489 | 2489 | '%1$s %2$s', | 
| 2490 | - $item['plugin'], | |
| 2490 | + $item[ 'plugin' ], | |
| 2491 | 2491 | $this->row_actions( $this->get_row_actions( $item ), true ) | 
| 2492 | 2492 | ); | 
| 2493 | 2493 | } | 
| @@ -2503,38 +2503,38 @@ discard block | ||
| 2503 | 2503 |  		public function column_version( $item ) { | 
| 2504 | 2504 | $output = array(); | 
| 2505 | 2505 | |
| 2506 | -			if ( $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { | |
| 2507 | - $installed = ! empty( $item['installed_version'] ) ? $item['installed_version'] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); | |
| 2506 | +			if ( $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { | |
| 2507 | + $installed = ! empty( $item[ 'installed_version' ] ) ? $item[ 'installed_version' ] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); | |
| 2508 | 2508 | |
| 2509 | 2509 | $color = ''; | 
| 2510 | -				if ( ! empty( $item['minimum_version'] ) && $this->tgmpa->does_plugin_require_update( $item['slug'] ) ) { | |
| 2510 | +				if ( ! empty( $item[ 'minimum_version' ] ) && $this->tgmpa->does_plugin_require_update( $item[ 'slug' ] ) ) { | |
| 2511 | 2511 | $color = ' color: #ff0000; font-weight: bold;'; | 
| 2512 | 2512 | } | 
| 2513 | 2513 | |
| 2514 | - $output[] = sprintf( | |
| 2515 | - '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Installed version:', 'tgmpa' ) . '</p>', | |
| 2514 | + $output[ ] = sprintf( | |
| 2515 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Installed version:', 'tgmpa' ).'</p>', | |
| 2516 | 2516 | $color, | 
| 2517 | 2517 | $installed | 
| 2518 | 2518 | ); | 
| 2519 | 2519 | } | 
| 2520 | 2520 | |
| 2521 | -			if ( ! empty( $item['minimum_version'] ) ) { | |
| 2522 | - $output[] = sprintf( | |
| 2523 | - '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>' . __( 'Minimum required version:', 'tgmpa' ) . '</p>', | |
| 2524 | - $item['minimum_version'] | |
| 2521 | +			if ( ! empty( $item[ 'minimum_version' ] ) ) { | |
| 2522 | + $output[ ] = sprintf( | |
| 2523 | + '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>'.__( 'Minimum required version:', 'tgmpa' ).'</p>', | |
| 2524 | + $item[ 'minimum_version' ] | |
| 2525 | 2525 | ); | 
| 2526 | 2526 | } | 
| 2527 | 2527 | |
| 2528 | -			if ( ! empty( $item['available_version'] ) ) { | |
| 2528 | +			if ( ! empty( $item[ 'available_version' ] ) ) { | |
| 2529 | 2529 | $color = ''; | 
| 2530 | -				if ( ! empty( $item['minimum_version'] ) && version_compare( $item['available_version'], $item['minimum_version'], '>=' ) ) { | |
| 2530 | +				if ( ! empty( $item[ 'minimum_version' ] ) && version_compare( $item[ 'available_version' ], $item[ 'minimum_version' ], '>=' ) ) { | |
| 2531 | 2531 | $color = ' color: #71C671; font-weight: bold;'; | 
| 2532 | 2532 | } | 
| 2533 | 2533 | |
| 2534 | - $output[] = sprintf( | |
| 2535 | - '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Available version:', 'tgmpa' ) . '</p>', | |
| 2534 | + $output[ ] = sprintf( | |
| 2535 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Available version:', 'tgmpa' ).'</p>', | |
| 2536 | 2536 | $color, | 
| 2537 | - $item['available_version'] | |
| 2537 | + $item[ 'available_version' ] | |
| 2538 | 2538 | ); | 
| 2539 | 2539 | } | 
| 2540 | 2540 | |
| @@ -2575,8 +2575,8 @@ discard block | ||
| 2575 | 2575 | ); | 
| 2576 | 2576 | |
| 2577 | 2577 |  			if ( 'all' === $this->view_context || 'update' === $this->view_context ) { | 
| 2578 | - $columns['version'] = __( 'Version', 'tgmpa' ); | |
| 2579 | - $columns['status'] = __( 'Status', 'tgmpa' ); | |
| 2578 | + $columns[ 'version' ] = __( 'Version', 'tgmpa' ); | |
| 2579 | + $columns[ 'status' ] = __( 'Status', 'tgmpa' ); | |
| 2580 | 2580 | } | 
| 2581 | 2581 | |
| 2582 | 2582 | return apply_filters( 'tgmpa_table_columns', $columns ); | 
| @@ -2623,17 +2623,17 @@ discard block | ||
| 2623 | 2623 | $action_links = array(); | 
| 2624 | 2624 | |
| 2625 | 2625 | // Display the 'Install' action link if the plugin is not yet available. | 
| 2626 | -			if ( ! $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { | |
| 2627 | - $actions['install'] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); | |
| 2626 | +			if ( ! $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { | |
| 2627 | + $actions[ 'install' ] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); | |
| 2628 | 2628 |  			} else { | 
| 2629 | 2629 | // Display the 'Update' action link if an update is available and WP complies with plugin minimum. | 
| 2630 | -				if ( false !== $this->tgmpa->does_plugin_have_update( $item['slug'] ) && $this->tgmpa->can_plugin_update( $item['slug'] ) ) { | |
| 2631 | - $actions['update'] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); | |
| 2630 | +				if ( false !== $this->tgmpa->does_plugin_have_update( $item[ 'slug' ] ) && $this->tgmpa->can_plugin_update( $item[ 'slug' ] ) ) { | |
| 2631 | + $actions[ 'update' ] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); | |
| 2632 | 2632 | } | 
| 2633 | 2633 | |
| 2634 | 2634 | // Display the 'Activate' action link, but only if the plugin meets the minimum version. | 
| 2635 | -				if ( $this->tgmpa->can_plugin_activate( $item['slug'] ) ) { | |
| 2636 | - $actions['activate'] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); | |
| 2635 | +				if ( $this->tgmpa->can_plugin_activate( $item[ 'slug' ] ) ) { | |
| 2636 | + $actions[ 'activate' ] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); | |
| 2637 | 2637 | } | 
| 2638 | 2638 | } | 
| 2639 | 2639 | |
| @@ -2642,24 +2642,24 @@ discard block | ||
| 2642 | 2642 | $nonce_url = wp_nonce_url( | 
| 2643 | 2643 | add_query_arg( | 
| 2644 | 2644 | array( | 
| 2645 | - 'plugin' => urlencode( $item['slug'] ), | |
| 2646 | - 'tgmpa-' . $action => $action . '-plugin', | |
| 2645 | + 'plugin' => urlencode( $item[ 'slug' ] ), | |
| 2646 | + 'tgmpa-'.$action => $action.'-plugin', | |
| 2647 | 2647 | ), | 
| 2648 | 2648 | $this->tgmpa->get_tgmpa_url() | 
| 2649 | 2649 | ), | 
| 2650 | - 'tgmpa-' . $action, | |
| 2650 | + 'tgmpa-'.$action, | |
| 2651 | 2651 | 'tgmpa-nonce' | 
| 2652 | 2652 | ); | 
| 2653 | 2653 | |
| 2654 | 2654 | $action_links[ $action ] = sprintf( | 
| 2655 | - '<a href="%1$s">' . esc_html( $text ) . '</a>', | |
| 2655 | + '<a href="%1$s">'.esc_html( $text ).'</a>', | |
| 2656 | 2656 | esc_url( $nonce_url ), | 
| 2657 | - '<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>' | |
| 2657 | + '<span class="screen-reader-text">'.esc_html( $item[ 'sanitized_plugin' ] ).'</span>' | |
| 2658 | 2658 | ); | 
| 2659 | 2659 | } | 
| 2660 | 2660 | |
| 2661 | 2661 | $prefix = ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) ? 'network_admin_' : ''; | 
| 2662 | -			return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item['slug'], $item, $this->view_context ); | |
| 2662 | +			return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item[ 'slug' ], $item, $this->view_context ); | |
| 2663 | 2663 | } | 
| 2664 | 2664 | |
| 2665 | 2665 | /** | 
| @@ -2680,7 +2680,7 @@ discard block | ||
| 2680 | 2680 | * | 
| 2681 | 2681 | * @since 2.5.0 | 
| 2682 | 2682 | */ | 
| 2683 | -			do_action( "tgmpa_after_plugin_row_{$item['slug']}", $item['slug'], $item, $this->view_context ); | |
| 2683 | +			do_action( "tgmpa_after_plugin_row_{$item[ 'slug' ]}", $item[ 'slug' ], $item, $this->view_context ); | |
| 2684 | 2684 | } | 
| 2685 | 2685 | |
| 2686 | 2686 | /** | 
| @@ -2695,7 +2695,7 @@ discard block | ||
| 2695 | 2695 | * @return null Return early if upgrade notice is empty. | 
| 2696 | 2696 | */ | 
| 2697 | 2697 |  		public function wp_plugin_update_row( $slug, $item ) { | 
| 2698 | -			if ( empty( $item['upgrade_notice'] ) ) { | |
| 2698 | +			if ( empty( $item[ 'upgrade_notice' ] ) ) { | |
| 2699 | 2699 | return; | 
| 2700 | 2700 | } | 
| 2701 | 2701 | |
| @@ -2704,7 +2704,7 @@ discard block | ||
| 2704 | 2704 | <td colspan="', absint( $this->get_column_count() ), '" class="plugin-update colspanchange"> | 
| 2705 | 2705 | <div class="update-message">', | 
| 2706 | 2706 | esc_html__( 'Upgrade message from the plugin author:', 'tgmpa' ), | 
| 2707 | - ' <strong>', wp_kses_data( $item['upgrade_notice'] ), '</strong> | |
| 2707 | + ' <strong>', wp_kses_data( $item[ 'upgrade_notice' ] ), '</strong> | |
| 2708 | 2708 | </div> | 
| 2709 | 2709 | </td> | 
| 2710 | 2710 | </tr>'; | 
| @@ -2736,16 +2736,16 @@ discard block | ||
| 2736 | 2736 | |
| 2737 | 2737 |  			if ( 'update' !== $this->view_context && 'activate' !== $this->view_context ) { | 
| 2738 | 2738 |  				if ( current_user_can( 'install_plugins' ) ) { | 
| 2739 | - $actions['tgmpa-bulk-install'] = __( 'Install', 'tgmpa' ); | |
| 2739 | + $actions[ 'tgmpa-bulk-install' ] = __( 'Install', 'tgmpa' ); | |
| 2740 | 2740 | } | 
| 2741 | 2741 | } | 
| 2742 | 2742 | |
| 2743 | 2743 |  			if ( 'install' !== $this->view_context ) { | 
| 2744 | 2744 |  				if ( current_user_can( 'update_plugins' ) ) { | 
| 2745 | - $actions['tgmpa-bulk-update'] = __( 'Update', 'tgmpa' ); | |
| 2745 | + $actions[ 'tgmpa-bulk-update' ] = __( 'Update', 'tgmpa' ); | |
| 2746 | 2746 | } | 
| 2747 | 2747 |  				if ( current_user_can( 'activate_plugins' ) ) { | 
| 2748 | - $actions['tgmpa-bulk-activate'] = __( 'Activate', 'tgmpa' ); | |
| 2748 | + $actions[ 'tgmpa-bulk-activate' ] = __( 'Activate', 'tgmpa' ); | |
| 2749 | 2749 | } | 
| 2750 | 2750 | } | 
| 2751 | 2751 | |
| @@ -2764,7 +2764,7 @@ discard block | ||
| 2764 | 2764 | // Bulk installation process. | 
| 2765 | 2765 |  			if ( 'tgmpa-bulk-install' === $this->current_action() || 'tgmpa-bulk-update' === $this->current_action() ) { | 
| 2766 | 2766 | |
| 2767 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); | |
| 2767 | + check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); | |
| 2768 | 2768 | |
| 2769 | 2769 | $install_type = 'install'; | 
| 2770 | 2770 |  				if ( 'tgmpa-bulk-update' === $this->current_action() ) { | 
| @@ -2774,7 +2774,7 @@ discard block | ||
| 2774 | 2774 | $plugins_to_install = array(); | 
| 2775 | 2775 | |
| 2776 | 2776 | // Did user actually select any plugins to install/update ? | 
| 2777 | -				if ( empty( $_POST['plugin'] ) ) { | |
| 2777 | +				if ( empty( $_POST[ 'plugin' ] ) ) { | |
| 2778 | 2778 |  					if ( 'install' === $install_type ) { | 
| 2779 | 2779 | $message = __( 'No plugins were selected to be installed. No action taken.', 'tgmpa' ); | 
| 2780 | 2780 |  					} else { | 
| @@ -2786,11 +2786,11 @@ discard block | ||
| 2786 | 2786 | return false; | 
| 2787 | 2787 | } | 
| 2788 | 2788 | |
| 2789 | -				if ( is_array( $_POST['plugin'] ) ) { | |
| 2790 | - $plugins_to_install = (array) $_POST['plugin']; | |
| 2791 | -				} elseif ( is_string( $_POST['plugin'] ) ) { | |
| 2789 | +				if ( is_array( $_POST[ 'plugin' ] ) ) { | |
| 2790 | + $plugins_to_install = (array) $_POST[ 'plugin' ]; | |
| 2791 | +				} elseif ( is_string( $_POST[ 'plugin' ] ) ) { | |
| 2792 | 2792 | // Received via Filesystem page - un-flatten array (WP bug #19643). | 
| 2793 | - $plugins_to_install = explode( ',', $_POST['plugin'] ); | |
| 2793 | + $plugins_to_install = explode( ',', $_POST[ 'plugin' ] ); | |
| 2794 | 2794 | } | 
| 2795 | 2795 | |
| 2796 | 2796 | // Sanitize the received input. | 
| @@ -2832,11 +2832,11 @@ discard block | ||
| 2832 | 2832 | // Pass all necessary information if WP_Filesystem is needed. | 
| 2833 | 2833 | $url = wp_nonce_url( | 
| 2834 | 2834 | $this->tgmpa->get_tgmpa_url(), | 
| 2835 | - 'bulk-' . $this->_args['plural'] | |
| 2835 | + 'bulk-'.$this->_args[ 'plural' ] | |
| 2836 | 2836 | ); | 
| 2837 | 2837 | |
| 2838 | 2838 | // Give validated data back to $_POST which is the only place the filesystem looks for extra fields. | 
| 2839 | - $_POST['plugin'] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. | |
| 2839 | + $_POST[ 'plugin' ] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. | |
| 2840 | 2840 | |
| 2841 | 2841 | $method = ''; // Leave blank so WP_Filesystem can populate it as necessary. | 
| 2842 | 2842 | $fields = array_keys( $_POST ); // Extra fields to pass to WP_Filesystem. | 
| @@ -2863,22 +2863,22 @@ discard block | ||
| 2863 | 2863 | |
| 2864 | 2864 | // Prepare the data for validated plugins for the install/upgrade. | 
| 2865 | 2865 |  				foreach ( $plugins_to_install as $slug ) { | 
| 2866 | - $name = $this->tgmpa->plugins[ $slug ]['name']; | |
| 2866 | + $name = $this->tgmpa->plugins[ $slug ][ 'name' ]; | |
| 2867 | 2867 | $source = $this->tgmpa->get_download_url( $slug ); | 
| 2868 | 2868 | |
| 2869 | 2869 |  					if ( ! empty( $name ) && ! empty( $source ) ) { | 
| 2870 | - $names[] = $name; | |
| 2870 | + $names[ ] = $name; | |
| 2871 | 2871 | |
| 2872 | 2872 |  						switch ( $install_type ) { | 
| 2873 | 2873 | |
| 2874 | 2874 | case 'install': | 
| 2875 | - $sources[] = $source; | |
| 2875 | + $sources[ ] = $source; | |
| 2876 | 2876 | break; | 
| 2877 | 2877 | |
| 2878 | 2878 | case 'update': | 
| 2879 | - $file_paths[] = $this->tgmpa->plugins[ $slug ]['file_path']; | |
| 2879 | + $file_paths[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; | |
| 2880 | 2880 | $to_inject[ $slug ] = $this->tgmpa->plugins[ $slug ]; | 
| 2881 | - $to_inject[ $slug ]['source'] = $source; | |
| 2881 | + $to_inject[ $slug ][ 'source' ] = $source; | |
| 2882 | 2882 | break; | 
| 2883 | 2883 | } | 
| 2884 | 2884 | } | 
| @@ -2890,7 +2890,7 @@ discard block | ||
| 2890 | 2890 | new TGMPA_Bulk_Installer_Skin( | 
| 2891 | 2891 | array( | 
| 2892 | 2892 | 'url' => esc_url_raw( $this->tgmpa->get_tgmpa_url() ), | 
| 2893 | - 'nonce' => 'bulk-' . $this->_args['plural'], | |
| 2893 | + 'nonce' => 'bulk-'.$this->_args[ 'plural' ], | |
| 2894 | 2894 | 'names' => $names, | 
| 2895 | 2895 | 'install_type' => $install_type, | 
| 2896 | 2896 | ) | 
| @@ -2923,10 +2923,10 @@ discard block | ||
| 2923 | 2923 | |
| 2924 | 2924 | // Bulk activation process. | 
| 2925 | 2925 |  			if ( 'tgmpa-bulk-activate' === $this->current_action() ) { | 
| 2926 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); | |
| 2926 | + check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); | |
| 2927 | 2927 | |
| 2928 | 2928 | // Did user actually select any plugins to activate ? | 
| 2929 | -				if ( empty( $_POST['plugin'] ) ) { | |
| 2929 | +				if ( empty( $_POST[ 'plugin' ] ) ) { | |
| 2930 | 2930 | echo '<div id="message" class="error"><p>', esc_html__( 'No plugins were selected to be activated. No action taken.', 'tgmpa' ), '</p></div>'; | 
| 2931 | 2931 | |
| 2932 | 2932 | return false; | 
| @@ -2934,8 +2934,8 @@ discard block | ||
| 2934 | 2934 | |
| 2935 | 2935 | // Grab plugin data from $_POST. | 
| 2936 | 2936 | $plugins = array(); | 
| 2937 | -				if ( isset( $_POST['plugin'] ) ) { | |
| 2938 | - $plugins = array_map( 'urldecode', (array) $_POST['plugin'] ); | |
| 2937 | +				if ( isset( $_POST[ 'plugin' ] ) ) { | |
| 2938 | + $plugins = array_map( 'urldecode', (array) $_POST[ 'plugin' ] ); | |
| 2939 | 2939 | $plugins = array_map( array( $this->tgmpa, 'sanitize_key' ), $plugins ); | 
| 2940 | 2940 | } | 
| 2941 | 2941 | |
| @@ -2945,8 +2945,8 @@ discard block | ||
| 2945 | 2945 | // Grab the file paths for the selected & inactive plugins from the registration array. | 
| 2946 | 2946 |  				foreach ( $plugins as $slug ) { | 
| 2947 | 2947 |  					if ( $this->tgmpa->can_plugin_activate( $slug ) ) { | 
| 2948 | - $plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path']; | |
| 2949 | - $plugin_names[] = $this->tgmpa->plugins[ $slug ]['name']; | |
| 2948 | + $plugins_to_activate[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; | |
| 2949 | + $plugin_names[ ] = $this->tgmpa->plugins[ $slug ][ 'name' ]; | |
| 2950 | 2950 | } | 
| 2951 | 2951 | } | 
| 2952 | 2952 | unset( $slug ); | 
| @@ -2967,7 +2967,7 @@ discard block | ||
| 2967 | 2967 | $count = count( $plugin_names ); // Count so we can use _n function. | 
| 2968 | 2968 | $plugin_names = array_map( array( 'TGMPA_Utils', 'wrap_in_strong' ), $plugin_names ); | 
| 2969 | 2969 | $last_plugin = array_pop( $plugin_names ); // Pop off last name to prep for readability. | 
| 2970 | - $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); | |
| 2970 | + $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); | |
| 2971 | 2971 | |
| 2972 | 2972 | printf( // WPCS: xss ok. | 
| 2973 | 2973 | '<div id="message" class="updated"><p>%1$s %2$s.</p></div>', | 
| @@ -3070,16 +3070,16 @@ discard block | ||
| 3070 | 3070 | */ | 
| 3071 | 3071 |  	function tgmpa_load_bulk_installer() { | 
| 3072 | 3072 | // Silently fail if 2.5+ is loaded *after* an older version. | 
| 3073 | -		if ( ! isset( $GLOBALS['tgmpa'] ) ) { | |
| 3073 | +		if ( ! isset( $GLOBALS[ 'tgmpa' ] ) ) { | |
| 3074 | 3074 | return; | 
| 3075 | 3075 | } | 
| 3076 | 3076 | |
| 3077 | 3077 | // Get TGMPA class instance. | 
| 3078 | - $tgmpa_instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); | |
| 3078 | + $tgmpa_instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); | |
| 3079 | 3079 | |
| 3080 | -		if ( isset( $_GET['page'] ) && $tgmpa_instance->menu === $_GET['page'] ) { | |
| 3080 | +		if ( isset( $_GET[ 'page' ] ) && $tgmpa_instance->menu === $_GET[ 'page' ] ) { | |
| 3081 | 3081 |  			if ( ! class_exists( 'Plugin_Upgrader', false ) ) { | 
| 3082 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; | |
| 3082 | + require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; | |
| 3083 | 3083 | } | 
| 3084 | 3084 | |
| 3085 | 3085 |  			if ( ! class_exists( 'TGMPA_Bulk_Installer' ) ) { | 
| @@ -3146,11 +3146,11 @@ discard block | ||
| 3146 | 3146 | */ | 
| 3147 | 3147 |  					public function __construct( $skin = null ) { | 
| 3148 | 3148 | // Get TGMPA class instance. | 
| 3149 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); | |
| 3149 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); | |
| 3150 | 3150 | |
| 3151 | 3151 | parent::__construct( $skin ); | 
| 3152 | 3152 | |
| 3153 | -						if ( isset( $this->skin->options['install_type'] ) && 'update' === $this->skin->options['install_type'] ) { | |
| 3153 | +						if ( isset( $this->skin->options[ 'install_type' ] ) && 'update' === $this->skin->options[ 'install_type' ] ) { | |
| 3154 | 3154 | $this->clear_destination = true; | 
| 3155 | 3155 | } | 
| 3156 | 3156 | |
| @@ -3167,8 +3167,8 @@ discard block | ||
| 3167 | 3167 | * @since 2.2.0 | 
| 3168 | 3168 | */ | 
| 3169 | 3169 |  					public function activate_strings() { | 
| 3170 | - $this->strings['activation_failed'] = __( 'Plugin activation failed.', 'tgmpa' ); | |
| 3171 | - $this->strings['activation_success'] = __( 'Plugin activated successfully.', 'tgmpa' ); | |
| 3170 | + $this->strings[ 'activation_failed' ] = __( 'Plugin activation failed.', 'tgmpa' ); | |
| 3171 | + $this->strings[ 'activation_success' ] = __( 'Plugin activated successfully.', 'tgmpa' ); | |
| 3172 | 3172 | } | 
| 3173 | 3173 | |
| 3174 | 3174 | /** | 
| @@ -3186,7 +3186,7 @@ discard block | ||
| 3186 | 3186 | |
| 3187 | 3187 | // Reset the strings in case we changed one during automatic activation. | 
| 3188 | 3188 |  						if ( $this->tgmpa->is_automatic ) { | 
| 3189 | -							if ( 'update' === $this->skin->options['install_type'] ) { | |
| 3189 | +							if ( 'update' === $this->skin->options[ 'install_type' ] ) { | |
| 3190 | 3190 | $this->upgrade_strings(); | 
| 3191 | 3191 |  							} else { | 
| 3192 | 3192 | $this->install_strings(); | 
| @@ -3344,7 +3344,7 @@ discard block | ||
| 3344 | 3344 | remove_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 ); | 
| 3345 | 3345 | |
| 3346 | 3346 | // Force refresh of plugin update information. | 
| 3347 | - wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); | |
| 3347 | + wp_clean_plugins_cache( $parsed_args[ 'clear_update_cache' ] ); | |
| 3348 | 3348 | |
| 3349 | 3349 | return $results; | 
| 3350 | 3350 | } | 
| @@ -3395,13 +3395,13 @@ discard block | ||
| 3395 | 3395 | $activate = activate_plugin( $plugin_info ); | 
| 3396 | 3396 | |
| 3397 | 3397 | // Adjust the success string based on the activation result. | 
| 3398 | - $this->strings['process_success'] = $this->strings['process_success'] . "<br />\n"; | |
| 3398 | + $this->strings[ 'process_success' ] = $this->strings[ 'process_success' ]."<br />\n"; | |
| 3399 | 3399 | |
| 3400 | 3400 |  								if ( is_wp_error( $activate ) ) { | 
| 3401 | 3401 | $this->skin->error( $activate ); | 
| 3402 | - $this->strings['process_success'] .= $this->strings['activation_failed']; | |
| 3402 | + $this->strings[ 'process_success' ] .= $this->strings[ 'activation_failed' ]; | |
| 3403 | 3403 |  								} else { | 
| 3404 | - $this->strings['process_success'] .= $this->strings['activation_success']; | |
| 3404 | + $this->strings[ 'process_success' ] .= $this->strings[ 'activation_success' ]; | |
| 3405 | 3405 | } | 
| 3406 | 3406 | } | 
| 3407 | 3407 | } | 
| @@ -3477,7 +3477,7 @@ discard block | ||
| 3477 | 3477 | */ | 
| 3478 | 3478 |  					public function __construct( $args = array() ) { | 
| 3479 | 3479 | // Get TGMPA class instance. | 
| 3480 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); | |
| 3480 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); | |
| 3481 | 3481 | |
| 3482 | 3482 | // Parse default and new args. | 
| 3483 | 3483 | $defaults = array( | 
| @@ -3486,10 +3486,10 @@ discard block | ||
| 3486 | 3486 | 'names' => array(), | 
| 3487 | 3487 | 'install_type' => 'install', | 
| 3488 | 3488 | ); | 
| 3489 | - $args = wp_parse_args( $args, $defaults ); | |
| 3489 | + $args = wp_parse_args( $args, $defaults ); | |
| 3490 | 3490 | |
| 3491 | 3491 | // Set plugin names to $this->plugin_names property. | 
| 3492 | - $this->plugin_names = $args['names']; | |
| 3492 | + $this->plugin_names = $args[ 'names' ]; | |
| 3493 | 3493 | |
| 3494 | 3494 | // Extract the new args. | 
| 3495 | 3495 | parent::__construct( $args ); | 
| @@ -3504,25 +3504,25 @@ discard block | ||
| 3504 | 3504 | * @since 2.2.0 | 
| 3505 | 3505 | */ | 
| 3506 | 3506 |  					public function add_strings() { | 
| 3507 | -						if ( 'update' === $this->options['install_type'] ) { | |
| 3507 | +						if ( 'update' === $this->options[ 'install_type' ] ) { | |
| 3508 | 3508 | parent::add_strings(); | 
| 3509 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); | |
| 3509 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); | |
| 3510 | 3510 |  						} else { | 
| 3511 | - $this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); | |
| 3512 | - $this->upgrader->strings['skin_update_failed'] = __( 'The installation of %1$s failed.', 'tgmpa' ); | |
| 3511 | + $this->upgrader->strings[ 'skin_update_failed_error' ] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); | |
| 3512 | + $this->upgrader->strings[ 'skin_update_failed' ] = __( 'The installation of %1$s failed.', 'tgmpa' ); | |
| 3513 | 3513 | |
| 3514 | 3514 |  							if ( $this->tgmpa->is_automatic ) { | 
| 3515 | 3515 | // Automatic activation strings. | 
| 3516 | - $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' ); | |
| 3517 | - $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>'; | |
| 3518 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations and activations have been completed.', 'tgmpa' ); | |
| 3519 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); | |
| 3516 | + $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' ); | |
| 3517 | + $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>'; | |
| 3518 | + $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations and activations have been completed.', 'tgmpa' ); | |
| 3519 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); | |
| 3520 | 3520 |  							} else { | 
| 3521 | 3521 | // Default installation strings. | 
| 3522 | - $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' ); | |
| 3523 | - $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>'; | |
| 3524 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations have been completed.', 'tgmpa' ); | |
| 3525 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); | |
| 3522 | + $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' ); | |
| 3523 | + $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>'; | |
| 3524 | + $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations have been completed.', 'tgmpa' ); | |
| 3525 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); | |
| 3526 | 3526 | } | 
| 3527 | 3527 | } | 
| 3528 | 3528 | } | 
| @@ -3580,12 +3580,12 @@ discard block | ||
| 3580 | 3580 |  						if ( $this->tgmpa->is_tgmpa_complete() ) { | 
| 3581 | 3581 | // All plugins are active, so we display the complete string and hide the menu to protect users. | 
| 3582 | 3582 |  							echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; | 
| 3583 | - $update_actions['dashboard'] = sprintf( | |
| 3584 | - esc_html( $this->tgmpa->strings['complete'] ), | |
| 3585 | - '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' | |
| 3583 | + $update_actions[ 'dashboard' ] = sprintf( | |
| 3584 | + esc_html( $this->tgmpa->strings[ 'complete' ] ), | |
| 3585 | + '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' | |
| 3586 | 3586 | ); | 
| 3587 | 3587 |  						} else { | 
| 3588 | - $update_actions['tgmpa_page'] = '<a href="' . esc_url( $this->tgmpa->get_tgmpa_url() ) . '" target="_parent">' . esc_html( $this->tgmpa->strings['return'] ) . '</a>'; | |
| 3588 | + $update_actions[ 'tgmpa_page' ] = '<a href="'.esc_url( $this->tgmpa->get_tgmpa_url() ).'" target="_parent">'.esc_html( $this->tgmpa->strings[ 'return' ] ).'</a>'; | |
| 3589 | 3589 | } | 
| 3590 | 3590 | |
| 3591 | 3591 | /** | 
| @@ -3675,7 +3675,7 @@ discard block | ||
| 3675 | 3675 | * @return string | 
| 3676 | 3676 | */ | 
| 3677 | 3677 |  		public static function wrap_in_em( $string ) { | 
| 3678 | - return '<em>' . wp_kses_post( $string ) . '</em>'; | |
| 3678 | + return '<em>'.wp_kses_post( $string ).'</em>'; | |
| 3679 | 3679 | } | 
| 3680 | 3680 | |
| 3681 | 3681 | /** | 
| @@ -3689,7 +3689,7 @@ discard block | ||
| 3689 | 3689 | * @return string | 
| 3690 | 3690 | */ | 
| 3691 | 3691 |  		public static function wrap_in_strong( $string ) { | 
| 3692 | - return '<strong>' . wp_kses_post( $string ) . '</strong>'; | |
| 3692 | + return '<strong>'.wp_kses_post( $string ).'</strong>'; | |
| 3693 | 3693 | } | 
| 3694 | 3694 | |
| 3695 | 3695 | /** | 
| @@ -3726,7 +3726,7 @@ discard block | ||
| 3726 | 3726 | */ | 
| 3727 | 3727 |  		protected static function emulate_filter_bool( $value ) { | 
| 3728 | 3728 | // @codingStandardsIgnoreStart | 
| 3729 | - static $true = array( | |
| 3729 | + static $true = array( | |
| 3730 | 3730 | '1', | 
| 3731 | 3731 | 'true', 'True', 'TRUE', | 
| 3732 | 3732 | 'y', 'Y', | 
| @@ -1,21 +1,21 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | /** | 
| 3 | - * This file represents an example of the code that themes would use to register | |
| 4 | - * the required plugins. | |
| 5 | - * | |
| 6 | - * It is expected that theme authors would copy and paste this code into their | |
| 7 | - * functions.php file, and amend to suit. | |
| 8 | - * | |
| 9 | - * @see http://tgmpluginactivation.com/configuration/ for detailed documentation. | |
| 10 | - * | |
| 11 | - * @package TGM-Plugin-Activation | |
| 12 | - * @subpackage Example | |
| 13 | - * @version 2.5.2 | |
| 14 | - * @author Thomas Griffin, Gary Jones, Juliette Reinders Folmer | |
| 15 | - * @copyright Copyright (c) 2011, Thomas Griffin | |
| 16 | - * @license http://opensource.org/licenses/gpl-2.0.php GPL v2 or later | |
| 17 | - * @link https://github.com/TGMPA/TGM-Plugin-Activation | |
| 18 | - */ | |
| 3 | + * This file represents an example of the code that themes would use to register | |
| 4 | + * the required plugins. | |
| 5 | + * | |
| 6 | + * It is expected that theme authors would copy and paste this code into their | |
| 7 | + * functions.php file, and amend to suit. | |
| 8 | + * | |
| 9 | + * @see http://tgmpluginactivation.com/configuration/ for detailed documentation. | |
| 10 | + * | |
| 11 | + * @package TGM-Plugin-Activation | |
| 12 | + * @subpackage Example | |
| 13 | + * @version 2.5.2 | |
| 14 | + * @author Thomas Griffin, Gary Jones, Juliette Reinders Folmer | |
| 15 | + * @copyright Copyright (c) 2011, Thomas Griffin | |
| 16 | + * @license http://opensource.org/licenses/gpl-2.0.php GPL v2 or later | |
| 17 | + * @link https://github.com/TGMPA/TGM-Plugin-Activation | |
| 18 | + */ | |
| 19 | 19 | |
| 20 | 20 | /** | 
| 21 | 21 | * Include the TGM_Plugin_Activation class. | 
| @@ -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( |