@@ -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'] ), |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | */ |
267 | 267 | public function __construct() { |
268 | 268 | // Set the current WordPress version. |
269 | - $this->wp_version = $GLOBALS['wp_version']; |
|
269 | + $this->wp_version = $GLOBALS[ 'wp_version' ]; |
|
270 | 270 | |
271 | 271 | // Announce that the class is ready, and pass the object (for advanced use). |
272 | 272 | do_action_ref_array( 'tgmpa_init', array( $this ) ); |
@@ -452,15 +452,15 @@ discard block |
||
452 | 452 | public function add_plugin_action_link_filters() { |
453 | 453 | foreach ( $this->plugins as $slug => $plugin ) { |
454 | 454 | if ( false === $this->can_plugin_activate( $slug ) ) { |
455 | - add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_activate' ), 20 ); |
|
455 | + add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_activate' ), 20 ); |
|
456 | 456 | } |
457 | 457 | |
458 | - if ( true === $plugin['force_activation'] ) { |
|
459 | - add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_deactivate' ), 20 ); |
|
458 | + if ( true === $plugin[ 'force_activation' ] ) { |
|
459 | + add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_deactivate' ), 20 ); |
|
460 | 460 | } |
461 | 461 | |
462 | 462 | if ( false !== $this->does_plugin_require_update( $slug ) ) { |
463 | - add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_update' ), 20 ); |
|
463 | + add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_update' ), 20 ); |
|
464 | 464 | } |
465 | 465 | } |
466 | 466 | } |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | * @return array |
476 | 476 | */ |
477 | 477 | public function filter_plugin_action_links_activate( $actions ) { |
478 | - unset( $actions['activate'] ); |
|
478 | + unset( $actions[ 'activate' ] ); |
|
479 | 479 | |
480 | 480 | return $actions; |
481 | 481 | } |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | * @return array |
490 | 490 | */ |
491 | 491 | public function filter_plugin_action_links_deactivate( $actions ) { |
492 | - unset( $actions['deactivate'] ); |
|
492 | + unset( $actions[ 'deactivate' ] ); |
|
493 | 493 | |
494 | 494 | return $actions; |
495 | 495 | } |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | * @return array |
505 | 505 | */ |
506 | 506 | public function filter_plugin_action_links_update( $actions ) { |
507 | - $actions['update'] = sprintf( |
|
507 | + $actions[ 'update' ] = sprintf( |
|
508 | 508 | '<a href="%1$s" title="%2$s" class="edit">%3$s</a>', |
509 | 509 | esc_url( $this->get_tgmpa_status_url( 'update' ) ), |
510 | 510 | esc_attr__( 'This plugin needs to be updated to be compatible with your theme.', 'tgmpa' ), |
@@ -542,9 +542,9 @@ discard block |
||
542 | 542 | return; |
543 | 543 | } |
544 | 544 | |
545 | - if ( isset( $_REQUEST['tab'] ) && 'plugin-information' === $_REQUEST['tab'] ) { |
|
545 | + if ( isset( $_REQUEST[ 'tab' ] ) && 'plugin-information' === $_REQUEST[ 'tab' ] ) { |
|
546 | 546 | // Needed for install_plugin_information(). |
547 | - require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
|
547 | + require_once ABSPATH.'wp-admin/includes/plugin-install.php'; |
|
548 | 548 | |
549 | 549 | wp_enqueue_style( 'plugin-install' ); |
550 | 550 | |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | * @since 2.1.0 |
573 | 573 | */ |
574 | 574 | public function thickbox() { |
575 | - if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) ) { |
|
575 | + if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, true ) ) { |
|
576 | 576 | add_thickbox(); |
577 | 577 | } |
578 | 578 | } |
@@ -601,11 +601,11 @@ discard block |
||
601 | 601 | $args = apply_filters( |
602 | 602 | 'tgmpa_admin_menu_args', |
603 | 603 | array( |
604 | - 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
605 | - 'page_title' => $this->strings['page_title'], // Page title. |
|
606 | - 'menu_title' => $this->strings['menu_title'], // Menu title. |
|
607 | - 'capability' => $this->capability, // Capability. |
|
608 | - 'menu_slug' => $this->menu, // Menu slug. |
|
604 | + 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
605 | + 'page_title' => $this->strings[ 'page_title' ], // Page title. |
|
606 | + 'menu_title' => $this->strings[ 'menu_title' ], // Menu title. |
|
607 | + 'capability' => $this->capability, // Capability. |
|
608 | + 'menu_slug' => $this->menu, // Menu slug. |
|
609 | 609 | 'function' => array( $this, 'install_plugins_page' ), // Callback. |
610 | 610 | ) |
611 | 611 | ); |
@@ -626,10 +626,10 @@ discard block |
||
626 | 626 | } |
627 | 627 | |
628 | 628 | if ( 'themes.php' === $this->parent_slug ) { |
629 | - $this->page_hook = call_user_func( 'add_theme_page', $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] ); |
|
629 | + $this->page_hook = call_user_func( 'add_theme_page', $args[ 'page_title' ], $args[ 'menu_title' ], $args[ 'capability' ], $args[ 'menu_slug' ], $args[ 'function' ] ); |
|
630 | 630 | } else { |
631 | 631 | $type = 'submenu'; |
632 | - $this->page_hook = call_user_func( "add_{$type}_page", $args['parent_slug'], $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] ); |
|
632 | + $this->page_hook = call_user_func( "add_{$type}_page", $args[ 'parent_slug' ], $args[ 'page_title' ], $args[ 'menu_title' ], $args[ 'capability' ], $args[ 'menu_slug' ], $args[ 'function' ] ); |
|
633 | 633 | } |
634 | 634 | } |
635 | 635 | |
@@ -698,37 +698,37 @@ discard block |
||
698 | 698 | * @return boolean True on success, false on failure. |
699 | 699 | */ |
700 | 700 | protected function do_plugin_install() { |
701 | - if ( empty( $_GET['plugin'] ) ) { |
|
701 | + if ( empty( $_GET[ 'plugin' ] ) ) { |
|
702 | 702 | return false; |
703 | 703 | } |
704 | 704 | |
705 | 705 | // All plugin information will be stored in an array for processing. |
706 | - $slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) ); |
|
706 | + $slug = $this->sanitize_key( urldecode( $_GET[ 'plugin' ] ) ); |
|
707 | 707 | |
708 | 708 | if ( ! isset( $this->plugins[ $slug ] ) ) { |
709 | 709 | return false; |
710 | 710 | } |
711 | 711 | |
712 | 712 | // Was an install or upgrade action link clicked? |
713 | - if ( ( isset( $_GET['tgmpa-install'] ) && 'install-plugin' === $_GET['tgmpa-install'] ) || ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) ) { |
|
713 | + if ( ( isset( $_GET[ 'tgmpa-install' ] ) && 'install-plugin' === $_GET[ 'tgmpa-install' ] ) || ( isset( $_GET[ 'tgmpa-update' ] ) && 'update-plugin' === $_GET[ 'tgmpa-update' ] ) ) { |
|
714 | 714 | |
715 | 715 | $install_type = 'install'; |
716 | - if ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) { |
|
716 | + if ( isset( $_GET[ 'tgmpa-update' ] ) && 'update-plugin' === $_GET[ 'tgmpa-update' ] ) { |
|
717 | 717 | $install_type = 'update'; |
718 | 718 | } |
719 | 719 | |
720 | - check_admin_referer( 'tgmpa-' . $install_type, 'tgmpa-nonce' ); |
|
720 | + check_admin_referer( 'tgmpa-'.$install_type, 'tgmpa-nonce' ); |
|
721 | 721 | |
722 | 722 | // Pass necessary information via URL if WP_Filesystem is needed. |
723 | 723 | $url = wp_nonce_url( |
724 | 724 | add_query_arg( |
725 | 725 | array( |
726 | 726 | 'plugin' => urlencode( $slug ), |
727 | - 'tgmpa-' . $install_type => $install_type . '-plugin', |
|
727 | + 'tgmpa-'.$install_type => $install_type.'-plugin', |
|
728 | 728 | ), |
729 | 729 | $this->get_tgmpa_url() |
730 | 730 | ), |
731 | - 'tgmpa-' . $install_type, |
|
731 | + 'tgmpa-'.$install_type, |
|
732 | 732 | 'tgmpa-nonce' |
733 | 733 | ); |
734 | 734 | |
@@ -747,35 +747,35 @@ discard block |
||
747 | 747 | |
748 | 748 | // Prep variables for Plugin_Installer_Skin class. |
749 | 749 | $extra = array(); |
750 | - $extra['slug'] = $slug; // Needed for potentially renaming of directory name. |
|
750 | + $extra[ 'slug' ] = $slug; // Needed for potentially renaming of directory name. |
|
751 | 751 | $source = $this->get_download_url( $slug ); |
752 | - $api = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null; |
|
752 | + $api = ( 'repo' === $this->plugins[ $slug ][ 'source_type' ] ) ? $this->get_plugins_api( $slug ) : null; |
|
753 | 753 | $api = ( false !== $api ) ? $api : null; |
754 | 754 | |
755 | 755 | $url = add_query_arg( |
756 | 756 | array( |
757 | - 'action' => $install_type . '-plugin', |
|
757 | + 'action' => $install_type.'-plugin', |
|
758 | 758 | 'plugin' => urlencode( $slug ), |
759 | 759 | ), |
760 | 760 | 'update.php' |
761 | 761 | ); |
762 | 762 | |
763 | 763 | if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
764 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
764 | + require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
765 | 765 | } |
766 | 766 | |
767 | 767 | $skin_args = array( |
768 | - 'type' => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload', |
|
769 | - 'title' => sprintf( $this->strings['installing'], $this->plugins[ $slug ]['name'] ), |
|
768 | + 'type' => ( 'bundled' !== $this->plugins[ $slug ][ 'source_type' ] ) ? 'web' : 'upload', |
|
769 | + 'title' => sprintf( $this->strings[ 'installing' ], $this->plugins[ $slug ][ 'name' ] ), |
|
770 | 770 | 'url' => esc_url_raw( $url ), |
771 | - 'nonce' => $install_type . '-plugin_' . $slug, |
|
771 | + 'nonce' => $install_type.'-plugin_'.$slug, |
|
772 | 772 | 'plugin' => '', |
773 | 773 | 'api' => $api, |
774 | 774 | 'extra' => $extra, |
775 | 775 | ); |
776 | 776 | |
777 | 777 | if ( 'update' === $install_type ) { |
778 | - $skin_args['plugin'] = $this->plugins[ $slug ]['file_path']; |
|
778 | + $skin_args[ 'plugin' ] = $this->plugins[ $slug ][ 'file_path' ]; |
|
779 | 779 | $skin = new Plugin_Upgrader_Skin( $skin_args ); |
780 | 780 | } else { |
781 | 781 | $skin = new Plugin_Installer_Skin( $skin_args ); |
@@ -790,10 +790,10 @@ discard block |
||
790 | 790 | if ( 'update' === $install_type ) { |
791 | 791 | // Inject our info into the update transient. |
792 | 792 | $to_inject = array( $slug => $this->plugins[ $slug ] ); |
793 | - $to_inject[ $slug ]['source'] = $source; |
|
793 | + $to_inject[ $slug ][ 'source' ] = $source; |
|
794 | 794 | $this->inject_update_info( $to_inject ); |
795 | 795 | |
796 | - $upgrader->upgrade( $this->plugins[ $slug ]['file_path'] ); |
|
796 | + $upgrader->upgrade( $this->plugins[ $slug ][ 'file_path' ] ); |
|
797 | 797 | } else { |
798 | 798 | $upgrader->install( $source ); |
799 | 799 | } |
@@ -816,18 +816,18 @@ discard block |
||
816 | 816 | |
817 | 817 | // Display message based on if all plugins are now active or not. |
818 | 818 | if ( $this->is_tgmpa_complete() ) { |
819 | - echo '<p>', sprintf( esc_html( $this->strings['complete'] ), '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' ), '</p>'; |
|
819 | + echo '<p>', sprintf( esc_html( $this->strings[ 'complete' ] ), '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' ), '</p>'; |
|
820 | 820 | echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
821 | 821 | } else { |
822 | - echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; |
|
822 | + echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings[ 'return' ] ), '</a></p>'; |
|
823 | 823 | } |
824 | 824 | |
825 | 825 | return true; |
826 | - } elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) { |
|
826 | + } elseif ( isset( $this->plugins[ $slug ][ 'file_path' ], $_GET[ 'tgmpa-activate' ] ) && 'activate-plugin' === $_GET[ 'tgmpa-activate' ] ) { |
|
827 | 827 | // Activate action link was clicked. |
828 | 828 | check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' ); |
829 | 829 | |
830 | - if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) { |
|
830 | + if ( false === $this->activate_single_plugin( $this->plugins[ $slug ][ 'file_path' ], $slug ) ) { |
|
831 | 831 | return true; // Finish execution of the function early as we encountered an error. |
832 | 832 | } |
833 | 833 | } |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | } |
851 | 851 | |
852 | 852 | foreach ( $plugins as $slug => $plugin ) { |
853 | - $file_path = $plugin['file_path']; |
|
853 | + $file_path = $plugin[ 'file_path' ]; |
|
854 | 854 | |
855 | 855 | if ( empty( $repo_updates->response[ $file_path ] ) ) { |
856 | 856 | $repo_updates->response[ $file_path ] = new stdClass; |
@@ -859,10 +859,10 @@ discard block |
||
859 | 859 | // We only really need to set package, but let's do all we can in case WP changes something. |
860 | 860 | $repo_updates->response[ $file_path ]->slug = $slug; |
861 | 861 | $repo_updates->response[ $file_path ]->plugin = $file_path; |
862 | - $repo_updates->response[ $file_path ]->new_version = $plugin['version']; |
|
863 | - $repo_updates->response[ $file_path ]->package = $plugin['source']; |
|
864 | - if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) { |
|
865 | - $repo_updates->response[ $file_path ]->url = $plugin['external_url']; |
|
862 | + $repo_updates->response[ $file_path ]->new_version = $plugin[ 'version' ]; |
|
863 | + $repo_updates->response[ $file_path ]->package = $plugin[ 'source' ]; |
|
864 | + if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin[ 'external_url' ] ) ) { |
|
865 | + $repo_updates->response[ $file_path ]->url = $plugin[ 'external_url' ]; |
|
866 | 866 | } |
867 | 867 | } |
868 | 868 | |
@@ -886,13 +886,13 @@ discard block |
||
886 | 886 | * @return string $source |
887 | 887 | */ |
888 | 888 | public function maybe_adjust_source_dir( $source, $remote_source, $upgrader ) { |
889 | - if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS['wp_filesystem'] ) ) { |
|
889 | + if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS[ 'wp_filesystem' ] ) ) { |
|
890 | 890 | return $source; |
891 | 891 | } |
892 | 892 | |
893 | 893 | // Check for single file plugins. |
894 | - $source_files = array_keys( $GLOBALS['wp_filesystem']->dirlist( $remote_source ) ); |
|
895 | - if ( 1 === count( $source_files ) && false === $GLOBALS['wp_filesystem']->is_dir( $source ) ) { |
|
894 | + $source_files = array_keys( $GLOBALS[ 'wp_filesystem' ]->dirlist( $remote_source ) ); |
|
895 | + if ( 1 === count( $source_files ) && false === $GLOBALS[ 'wp_filesystem' ]->is_dir( $source ) ) { |
|
896 | 896 | return $source; |
897 | 897 | } |
898 | 898 | |
@@ -900,12 +900,12 @@ discard block |
||
900 | 900 | $desired_slug = ''; |
901 | 901 | |
902 | 902 | // Figure out what the slug is supposed to be. |
903 | - if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options['extra']['slug'] ) ) { |
|
904 | - $desired_slug = $upgrader->skin->options['extra']['slug']; |
|
903 | + if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options[ 'extra' ][ 'slug' ] ) ) { |
|
904 | + $desired_slug = $upgrader->skin->options[ 'extra' ][ 'slug' ]; |
|
905 | 905 | } else { |
906 | 906 | // Bulk installer contains less info, so fall back on the info registered here. |
907 | 907 | foreach ( $this->plugins as $slug => $plugin ) { |
908 | - if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
|
908 | + if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin[ 'name' ] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
|
909 | 909 | $desired_slug = $slug; |
910 | 910 | break; |
911 | 911 | } |
@@ -918,15 +918,15 @@ discard block |
||
918 | 918 | |
919 | 919 | if ( ! empty( $subdir_name ) && $subdir_name !== $desired_slug ) { |
920 | 920 | $from = untrailingslashit( $source ); |
921 | - $to = trailingslashit( $remote_source ) . $desired_slug; |
|
921 | + $to = trailingslashit( $remote_source ).$desired_slug; |
|
922 | 922 | |
923 | - if ( true === $GLOBALS['wp_filesystem']->move( $from, $to ) ) { |
|
923 | + if ( true === $GLOBALS[ 'wp_filesystem' ]->move( $from, $to ) ) { |
|
924 | 924 | return trailingslashit( $to ); |
925 | 925 | } else { |
926 | - 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 ) ); |
|
926 | + 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 ) ); |
|
927 | 927 | } |
928 | 928 | } elseif ( empty( $subdir_name ) ) { |
929 | - 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 ) ); |
|
929 | + 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 ) ); |
|
930 | 930 | } |
931 | 931 | } |
932 | 932 | |
@@ -950,19 +950,19 @@ discard block |
||
950 | 950 | |
951 | 951 | if ( is_wp_error( $activate ) ) { |
952 | 952 | echo '<div id="message" class="error"><p>', wp_kses_post( $activate->get_error_message() ), '</p></div>', |
953 | - '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; |
|
953 | + '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings[ 'return' ] ), '</a></p>'; |
|
954 | 954 | |
955 | 955 | return false; // End it here if there is an error with activation. |
956 | 956 | } else { |
957 | 957 | if ( ! $automatic ) { |
958 | 958 | // Make sure message doesn't display again if bulk activation is performed |
959 | 959 | // immediately after a single activation. |
960 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
961 | - echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>'; |
|
960 | + if ( ! isset( $_POST[ 'action' ] ) ) { // WPCS: CSRF OK. |
|
961 | + echo '<div id="message" class="updated"><p>', esc_html( $this->strings[ 'activated_successfully' ] ), ' <strong>', esc_html( $this->plugins[ $slug ][ 'name' ] ), '.</strong></p></div>'; |
|
962 | 962 | } |
963 | 963 | } else { |
964 | 964 | // Simpler message layout for use on the plugin install page. |
965 | - echo '<p>', esc_html( $this->strings['plugin_activated'] ), '</p>'; |
|
965 | + echo '<p>', esc_html( $this->strings[ 'plugin_activated' ] ), '</p>'; |
|
966 | 966 | } |
967 | 967 | } |
968 | 968 | } elseif ( $this->is_plugin_active( $slug ) ) { |
@@ -970,25 +970,25 @@ discard block |
||
970 | 970 | // on the plugin install page. |
971 | 971 | echo '<div id="message" class="error"><p>', |
972 | 972 | sprintf( |
973 | - esc_html( $this->strings['plugin_already_active'] ), |
|
974 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
973 | + esc_html( $this->strings[ 'plugin_already_active' ] ), |
|
974 | + '<strong>'.esc_html( $this->plugins[ $slug ][ 'name' ] ).'</strong>' |
|
975 | 975 | ), |
976 | 976 | '</p></div>'; |
977 | 977 | } elseif ( $this->does_plugin_require_update( $slug ) ) { |
978 | 978 | if ( ! $automatic ) { |
979 | 979 | // Make sure message doesn't display again if bulk activation is performed |
980 | 980 | // immediately after a single activation. |
981 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
981 | + if ( ! isset( $_POST[ 'action' ] ) ) { // WPCS: CSRF OK. |
|
982 | 982 | echo '<div id="message" class="error"><p>', |
983 | 983 | sprintf( |
984 | - esc_html( $this->strings['plugin_needs_higher_version'] ), |
|
985 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
984 | + esc_html( $this->strings[ 'plugin_needs_higher_version' ] ), |
|
985 | + '<strong>'.esc_html( $this->plugins[ $slug ][ 'name' ] ).'</strong>' |
|
986 | 986 | ), |
987 | 987 | '</p></div>'; |
988 | 988 | } |
989 | 989 | } else { |
990 | 990 | // Simpler message layout for use on the plugin install page. |
991 | - echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>'; |
|
991 | + echo '<p>', sprintf( esc_html( $this->strings[ 'plugin_needs_higher_version' ] ), esc_html( $this->plugins[ $slug ][ 'name' ] ) ), '</p>'; |
|
992 | 992 | } |
993 | 993 | } |
994 | 994 | |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | */ |
1013 | 1013 | public function notices() { |
1014 | 1014 | // Remove nag on the install page / Return early if the nag message has been dismissed or user < author. |
1015 | - 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' ) ) ) { |
|
1015 | + 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' ) ) ) { |
|
1016 | 1016 | return; |
1017 | 1017 | } |
1018 | 1018 | |
@@ -1034,13 +1034,13 @@ discard block |
||
1034 | 1034 | if ( current_user_can( 'install_plugins' ) ) { |
1035 | 1035 | $install_link_count++; |
1036 | 1036 | |
1037 | - if ( true === $plugin['required'] ) { |
|
1038 | - $message['notice_can_install_required'][] = $slug; |
|
1037 | + if ( true === $plugin[ 'required' ] ) { |
|
1038 | + $message[ 'notice_can_install_required' ][ ] = $slug; |
|
1039 | 1039 | } else { |
1040 | - $message['notice_can_install_recommended'][] = $slug; |
|
1040 | + $message[ 'notice_can_install_recommended' ][ ] = $slug; |
|
1041 | 1041 | } |
1042 | 1042 | } |
1043 | - if ( true === $plugin['required'] ) { |
|
1043 | + if ( true === $plugin[ 'required' ] ) { |
|
1044 | 1044 | $total_required_action_count++; |
1045 | 1045 | } |
1046 | 1046 | } else { |
@@ -1048,13 +1048,13 @@ discard block |
||
1048 | 1048 | if ( current_user_can( 'activate_plugins' ) ) { |
1049 | 1049 | $activate_link_count++; |
1050 | 1050 | |
1051 | - if ( true === $plugin['required'] ) { |
|
1052 | - $message['notice_can_activate_required'][] = $slug; |
|
1051 | + if ( true === $plugin[ 'required' ] ) { |
|
1052 | + $message[ 'notice_can_activate_required' ][ ] = $slug; |
|
1053 | 1053 | } else { |
1054 | - $message['notice_can_activate_recommended'][] = $slug; |
|
1054 | + $message[ 'notice_can_activate_recommended' ][ ] = $slug; |
|
1055 | 1055 | } |
1056 | 1056 | } |
1057 | - if ( true === $plugin['required'] ) { |
|
1057 | + if ( true === $plugin[ 'required' ] ) { |
|
1058 | 1058 | $total_required_action_count++; |
1059 | 1059 | } |
1060 | 1060 | } |
@@ -1065,12 +1065,12 @@ discard block |
||
1065 | 1065 | $update_link_count++; |
1066 | 1066 | |
1067 | 1067 | if ( $this->does_plugin_require_update( $slug ) ) { |
1068 | - $message['notice_ask_to_update'][] = $slug; |
|
1068 | + $message[ 'notice_ask_to_update' ][ ] = $slug; |
|
1069 | 1069 | } elseif ( false !== $this->does_plugin_have_update( $slug ) ) { |
1070 | - $message['notice_ask_to_update_maybe'][] = $slug; |
|
1070 | + $message[ 'notice_ask_to_update_maybe' ][ ] = $slug; |
|
1071 | 1071 | } |
1072 | 1072 | } |
1073 | - if ( true === $plugin['required'] ) { |
|
1073 | + if ( true === $plugin[ 'required' ] ) { |
|
1074 | 1074 | $total_required_action_count++; |
1075 | 1075 | } |
1076 | 1076 | } |
@@ -1085,10 +1085,10 @@ discard block |
||
1085 | 1085 | |
1086 | 1086 | // As add_settings_error() wraps the final message in a <p> and as the final message can't be |
1087 | 1087 | // filtered, using <p>'s in our html would render invalid html output. |
1088 | - $line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>' . "\n"; |
|
1088 | + $line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>'."\n"; |
|
1089 | 1089 | |
1090 | 1090 | if ( ! current_user_can( 'activate_plugins' ) && ! current_user_can( 'install_plugins' ) && ! current_user_can( 'update_plugins' ) ) { |
1091 | - $rendered = esc_html__( $this->strings['notice_cannot_install_activate'] . ' ' . $this->strings['contact_admin'] ); |
|
1091 | + $rendered = esc_html__( $this->strings[ 'notice_cannot_install_activate' ].' '.$this->strings[ 'contact_admin' ] ); |
|
1092 | 1092 | $rendered .= $this->create_user_action_links_for_notice( 0, 0, 0, $line_template ); |
1093 | 1093 | } else { |
1094 | 1094 | |
@@ -1103,14 +1103,14 @@ discard block |
||
1103 | 1103 | |
1104 | 1104 | // Get the external info link for a plugin if one is available. |
1105 | 1105 | foreach ( $plugin_group as $plugin_slug ) { |
1106 | - $linked_plugins[] = $this->get_info_link( $plugin_slug ); |
|
1106 | + $linked_plugins[ ] = $this->get_info_link( $plugin_slug ); |
|
1107 | 1107 | } |
1108 | 1108 | unset( $plugin_slug ); |
1109 | 1109 | |
1110 | 1110 | $count = count( $plugin_group ); |
1111 | 1111 | $linked_plugins = array_map( array( 'TGMPA_Utils', 'wrap_in_em' ), $linked_plugins ); |
1112 | 1112 | $last_plugin = array_pop( $linked_plugins ); // Pop off last name to prep for readability. |
1113 | - $imploded = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
1113 | + $imploded = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); |
|
1114 | 1114 | |
1115 | 1115 | $rendered .= sprintf( |
1116 | 1116 | $line_template, |
@@ -1128,8 +1128,8 @@ discard block |
||
1128 | 1128 | } |
1129 | 1129 | |
1130 | 1130 | // Register the nag messages and prepare them to be processed. |
1131 | - if ( ! empty( $this->strings['nag_type'] ) ) { |
|
1132 | - add_settings_error( 'tgmpa', 'tgmpa', $rendered, sanitize_html_class( strtolower( $this->strings['nag_type'] ) ) ); |
|
1131 | + if ( ! empty( $this->strings[ 'nag_type' ] ) ) { |
|
1132 | + add_settings_error( 'tgmpa', 'tgmpa', $rendered, sanitize_html_class( strtolower( $this->strings[ 'nag_type' ] ) ) ); |
|
1133 | 1133 | } else { |
1134 | 1134 | $nag_class = version_compare( $this->wp_version, '3.8', '<' ) ? 'updated' : 'update-nag'; |
1135 | 1135 | add_settings_error( 'tgmpa', 'tgmpa', $rendered, $nag_class ); |
@@ -1137,7 +1137,7 @@ discard block |
||
1137 | 1137 | } |
1138 | 1138 | |
1139 | 1139 | // Admin options pages already output settings_errors, so this is to avoid duplication. |
1140 | - if ( 'options-general' !== $GLOBALS['current_screen']->parent_base ) { |
|
1140 | + if ( 'options-general' !== $GLOBALS[ 'current_screen' ]->parent_base ) { |
|
1141 | 1141 | $this->display_settings_errors(); |
1142 | 1142 | } |
1143 | 1143 | } |
@@ -1157,32 +1157,32 @@ discard block |
||
1157 | 1157 | 'install' => '', |
1158 | 1158 | 'update' => '', |
1159 | 1159 | 'activate' => '', |
1160 | - 'dismiss' => $this->dismissable ? '<a href="' . esc_url( add_query_arg( 'tgmpa-dismiss', 'dismiss_admin_notices' ) ) . '" class="dismiss-notice" target="_parent">' . esc_html( $this->strings['dismiss'] ) . '</a>' : '', |
|
1160 | + 'dismiss' => $this->dismissable ? '<a href="'.esc_url( add_query_arg( 'tgmpa-dismiss', 'dismiss_admin_notices' ) ).'" class="dismiss-notice" target="_parent">'.esc_html( $this->strings[ 'dismiss' ] ).'</a>' : '', |
|
1161 | 1161 | ); |
1162 | 1162 | |
1163 | 1163 | $link_template = '<a href="%2$s">%1$s</a>'; |
1164 | 1164 | |
1165 | 1165 | if ( current_user_can( 'install_plugins' ) ) { |
1166 | 1166 | if ( $install_link_count > 0 ) { |
1167 | - $action_links['install'] = sprintf( |
|
1167 | + $action_links[ 'install' ] = sprintf( |
|
1168 | 1168 | $link_template, |
1169 | - translate_nooped_plural( $this->strings['install_link'], $install_link_count, 'tgmpa' ), |
|
1169 | + translate_nooped_plural( $this->strings[ 'install_link' ], $install_link_count, 'tgmpa' ), |
|
1170 | 1170 | esc_url( $this->get_tgmpa_status_url( 'install' ) ) |
1171 | 1171 | ); |
1172 | 1172 | } |
1173 | 1173 | if ( $update_link_count > 0 ) { |
1174 | - $action_links['update'] = sprintf( |
|
1174 | + $action_links[ 'update' ] = sprintf( |
|
1175 | 1175 | $link_template, |
1176 | - translate_nooped_plural( $this->strings['update_link'], $update_link_count, 'tgmpa' ), |
|
1176 | + translate_nooped_plural( $this->strings[ 'update_link' ], $update_link_count, 'tgmpa' ), |
|
1177 | 1177 | esc_url( $this->get_tgmpa_status_url( 'update' ) ) |
1178 | 1178 | ); |
1179 | 1179 | } |
1180 | 1180 | } |
1181 | 1181 | |
1182 | 1182 | if ( current_user_can( 'activate_plugins' ) && $activate_link_count > 0 ) { |
1183 | - $action_links['activate'] = sprintf( |
|
1183 | + $action_links[ 'activate' ] = sprintf( |
|
1184 | 1184 | $link_template, |
1185 | - translate_nooped_plural( $this->strings['activate_link'], $activate_link_count, 'tgmpa' ), |
|
1185 | + translate_nooped_plural( $this->strings[ 'activate_link' ], $activate_link_count, 'tgmpa' ), |
|
1186 | 1186 | esc_url( $this->get_tgmpa_status_url( 'activate' ) ) |
1187 | 1187 | ); |
1188 | 1188 | } |
@@ -1210,7 +1210,7 @@ discard block |
||
1210 | 1210 | settings_errors( 'tgmpa' ); |
1211 | 1211 | |
1212 | 1212 | foreach ( (array) $wp_settings_errors as $key => $details ) { |
1213 | - if ( 'tgmpa' === $details['setting'] ) { |
|
1213 | + if ( 'tgmpa' === $details[ 'setting' ] ) { |
|
1214 | 1214 | unset( $wp_settings_errors[ $key ] ); |
1215 | 1215 | break; |
1216 | 1216 | } |
@@ -1225,8 +1225,8 @@ discard block |
||
1225 | 1225 | * @since 2.1.0 |
1226 | 1226 | */ |
1227 | 1227 | public function dismiss() { |
1228 | - if ( isset( $_GET['tgmpa-dismiss'] ) ) { |
|
1229 | - update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, 1 ); |
|
1228 | + if ( isset( $_GET[ 'tgmpa-dismiss' ] ) ) { |
|
1229 | + update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, 1 ); |
|
1230 | 1230 | } |
1231 | 1231 | } |
1232 | 1232 | |
@@ -1242,54 +1242,54 @@ discard block |
||
1242 | 1242 | * @return null Return early if incorrect argument. |
1243 | 1243 | */ |
1244 | 1244 | public function register( $plugin ) { |
1245 | - if ( empty( $plugin['slug'] ) || empty( $plugin['name'] ) ) { |
|
1245 | + if ( empty( $plugin[ 'slug' ] ) || empty( $plugin[ 'name' ] ) ) { |
|
1246 | 1246 | return; |
1247 | 1247 | } |
1248 | 1248 | |
1249 | - if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) { |
|
1249 | + if ( empty( $plugin[ 'slug' ] ) || ! is_string( $plugin[ 'slug' ] ) || isset( $this->plugins[ $plugin[ 'slug' ] ] ) ) { |
|
1250 | 1250 | return; |
1251 | 1251 | } |
1252 | 1252 | |
1253 | 1253 | $defaults = array( |
1254 | - 'name' => '', // String |
|
1255 | - 'slug' => '', // String |
|
1256 | - 'source' => 'repo', // String |
|
1257 | - 'required' => false, // Boolean |
|
1258 | - 'version' => '', // String |
|
1259 | - 'force_activation' => false, // Boolean |
|
1260 | - 'force_deactivation' => false, // Boolean |
|
1261 | - 'external_url' => '', // String |
|
1262 | - 'is_callable' => '', // String|Array. |
|
1254 | + 'name' => '', // String |
|
1255 | + 'slug' => '', // String |
|
1256 | + 'source' => 'repo', // String |
|
1257 | + 'required' => false, // Boolean |
|
1258 | + 'version' => '', // String |
|
1259 | + 'force_activation' => false, // Boolean |
|
1260 | + 'force_deactivation' => false, // Boolean |
|
1261 | + 'external_url' => '', // String |
|
1262 | + 'is_callable' => '', // String|Array. |
|
1263 | 1263 | ); |
1264 | 1264 | |
1265 | 1265 | // Prepare the received data. |
1266 | 1266 | $plugin = wp_parse_args( $plugin, $defaults ); |
1267 | 1267 | |
1268 | 1268 | // Standardize the received slug. |
1269 | - $plugin['slug'] = $this->sanitize_key( $plugin['slug'] ); |
|
1269 | + $plugin[ 'slug' ] = $this->sanitize_key( $plugin[ 'slug' ] ); |
|
1270 | 1270 | |
1271 | 1271 | // Forgive users for using string versions of booleans or floats for version number. |
1272 | - $plugin['version'] = (string) $plugin['version']; |
|
1273 | - $plugin['source'] = empty( $plugin['source'] ) ? 'repo' : $plugin['source']; |
|
1274 | - $plugin['required'] = TGMPA_Utils::validate_bool( $plugin['required'] ); |
|
1275 | - $plugin['force_activation'] = TGMPA_Utils::validate_bool( $plugin['force_activation'] ); |
|
1276 | - $plugin['force_deactivation'] = TGMPA_Utils::validate_bool( $plugin['force_deactivation'] ); |
|
1272 | + $plugin[ 'version' ] = (string) $plugin[ 'version' ]; |
|
1273 | + $plugin[ 'source' ] = empty( $plugin[ 'source' ] ) ? 'repo' : $plugin[ 'source' ]; |
|
1274 | + $plugin[ 'required' ] = TGMPA_Utils::validate_bool( $plugin[ 'required' ] ); |
|
1275 | + $plugin[ 'force_activation' ] = TGMPA_Utils::validate_bool( $plugin[ 'force_activation' ] ); |
|
1276 | + $plugin[ 'force_deactivation' ] = TGMPA_Utils::validate_bool( $plugin[ 'force_deactivation' ] ); |
|
1277 | 1277 | |
1278 | 1278 | // Enrich the received data. |
1279 | - $plugin['file_path'] = $this->_get_plugin_basename_from_slug( $plugin['slug'] ); |
|
1280 | - $plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] ); |
|
1279 | + $plugin[ 'file_path' ] = $this->_get_plugin_basename_from_slug( $plugin[ 'slug' ] ); |
|
1280 | + $plugin[ 'source_type' ] = $this->get_plugin_source_type( $plugin[ 'source' ] ); |
|
1281 | 1281 | |
1282 | 1282 | // Set the class properties. |
1283 | - $this->plugins[ $plugin['slug'] ] = $plugin; |
|
1284 | - $this->sort_order[ $plugin['slug'] ] = $plugin['name']; |
|
1283 | + $this->plugins[ $plugin[ 'slug' ] ] = $plugin; |
|
1284 | + $this->sort_order[ $plugin[ 'slug' ] ] = $plugin[ 'name' ]; |
|
1285 | 1285 | |
1286 | 1286 | // Should we add the force activation hook ? |
1287 | - if ( true === $plugin['force_activation'] ) { |
|
1287 | + if ( true === $plugin[ 'force_activation' ] ) { |
|
1288 | 1288 | $this->has_forced_activation = true; |
1289 | 1289 | } |
1290 | 1290 | |
1291 | 1291 | // Should we add the force deactivation hook ? |
1292 | - if ( true === $plugin['force_deactivation'] ) { |
|
1292 | + if ( true === $plugin[ 'force_deactivation' ] ) { |
|
1293 | 1293 | $this->has_forced_deactivation = true; |
1294 | 1294 | } |
1295 | 1295 | } |
@@ -1415,11 +1415,11 @@ discard block |
||
1415 | 1415 | */ |
1416 | 1416 | public function populate_file_path( $plugin_slug = '' ) { |
1417 | 1417 | if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) { |
1418 | - $this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
1418 | + $this->plugins[ $plugin_slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
1419 | 1419 | } else { |
1420 | 1420 | // Add file_path key for all plugins. |
1421 | 1421 | foreach ( $this->plugins as $slug => $values ) { |
1422 | - $this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug ); |
|
1422 | + $this->plugins[ $slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $slug ); |
|
1423 | 1423 | } |
1424 | 1424 | } |
1425 | 1425 | } |
@@ -1437,7 +1437,7 @@ discard block |
||
1437 | 1437 | $keys = array_keys( $this->get_plugins() ); |
1438 | 1438 | |
1439 | 1439 | foreach ( $keys as $key ) { |
1440 | - if ( preg_match( '|^' . $slug . '/|', $key ) ) { |
|
1440 | + if ( preg_match( '|^'.$slug.'/|', $key ) ) { |
|
1441 | 1441 | return $key; |
1442 | 1442 | } |
1443 | 1443 | } |
@@ -1459,7 +1459,7 @@ discard block |
||
1459 | 1459 | */ |
1460 | 1460 | public function _get_plugin_data_from_name( $name, $data = 'slug' ) { |
1461 | 1461 | foreach ( $this->plugins as $values ) { |
1462 | - if ( $name === $values['name'] && isset( $values[ $data ] ) ) { |
|
1462 | + if ( $name === $values[ 'name' ] && isset( $values[ $data ] ) ) { |
|
1463 | 1463 | return $values[ $data ]; |
1464 | 1464 | } |
1465 | 1465 | } |
@@ -1478,13 +1478,13 @@ discard block |
||
1478 | 1478 | public function get_download_url( $slug ) { |
1479 | 1479 | $dl_source = ''; |
1480 | 1480 | |
1481 | - switch ( $this->plugins[ $slug ]['source_type'] ) { |
|
1481 | + switch ( $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1482 | 1482 | case 'repo': |
1483 | 1483 | return $this->get_wp_repo_download_url( $slug ); |
1484 | 1484 | case 'external': |
1485 | - return $this->plugins[ $slug ]['source']; |
|
1485 | + return $this->plugins[ $slug ][ 'source' ]; |
|
1486 | 1486 | case 'bundled': |
1487 | - return $this->default_path . $this->plugins[ $slug ]['source']; |
|
1487 | + return $this->default_path.$this->plugins[ $slug ][ 'source' ]; |
|
1488 | 1488 | } |
1489 | 1489 | |
1490 | 1490 | return $dl_source; // Should never happen. |
@@ -1522,7 +1522,7 @@ discard block |
||
1522 | 1522 | |
1523 | 1523 | if ( ! isset( $api[ $slug ] ) ) { |
1524 | 1524 | if ( ! function_exists( 'plugins_api' ) ) { |
1525 | - require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
|
1525 | + require_once ABSPATH.'wp-admin/includes/plugin-install.php'; |
|
1526 | 1526 | } |
1527 | 1527 | |
1528 | 1528 | $response = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ) ) ); |
@@ -1530,7 +1530,7 @@ discard block |
||
1530 | 1530 | $api[ $slug ] = false; |
1531 | 1531 | |
1532 | 1532 | if ( is_wp_error( $response ) ) { |
1533 | - wp_die( esc_html( $this->strings['oops'] ) ); |
|
1533 | + wp_die( esc_html( $this->strings[ 'oops' ] ) ); |
|
1534 | 1534 | } else { |
1535 | 1535 | $api[ $slug ] = $response; |
1536 | 1536 | } |
@@ -1549,13 +1549,13 @@ discard block |
||
1549 | 1549 | * or the plugin name if not. |
1550 | 1550 | */ |
1551 | 1551 | public function get_info_link( $slug ) { |
1552 | - if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) { |
|
1552 | + if ( ! empty( $this->plugins[ $slug ][ 'external_url' ] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ][ 'external_url' ] ) ) { |
|
1553 | 1553 | $link = sprintf( |
1554 | 1554 | '<a href="%1$s" target="_blank">%2$s</a>', |
1555 | - esc_url( $this->plugins[ $slug ]['external_url'] ), |
|
1556 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
1555 | + esc_url( $this->plugins[ $slug ][ 'external_url' ] ), |
|
1556 | + esc_html( $this->plugins[ $slug ][ 'name' ] ) |
|
1557 | 1557 | ); |
1558 | - } elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) { |
|
1558 | + } elseif ( 'repo' === $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1559 | 1559 | $url = add_query_arg( |
1560 | 1560 | array( |
1561 | 1561 | 'tab' => 'plugin-information', |
@@ -1570,10 +1570,10 @@ discard block |
||
1570 | 1570 | $link = sprintf( |
1571 | 1571 | '<a href="%1$s" class="thickbox">%2$s</a>', |
1572 | 1572 | esc_url( $url ), |
1573 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
1573 | + esc_html( $this->plugins[ $slug ][ 'name' ] ) |
|
1574 | 1574 | ); |
1575 | 1575 | } else { |
1576 | - $link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink. |
|
1576 | + $link = esc_html( $this->plugins[ $slug ][ 'name' ] ); // No hyperlink. |
|
1577 | 1577 | } |
1578 | 1578 | |
1579 | 1579 | return $link; |
@@ -1587,7 +1587,7 @@ discard block |
||
1587 | 1587 | * @return boolean True when on the TGMPA page, false otherwise. |
1588 | 1588 | */ |
1589 | 1589 | protected function is_tgmpa_page() { |
1590 | - return isset( $_GET['page'] ) && $this->menu === $_GET['page']; |
|
1590 | + return isset( $_GET[ 'page' ] ) && $this->menu === $_GET[ 'page' ]; |
|
1591 | 1591 | } |
1592 | 1592 | |
1593 | 1593 | /** |
@@ -1669,7 +1669,7 @@ discard block |
||
1669 | 1669 | public function is_plugin_installed( $slug ) { |
1670 | 1670 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
1671 | 1671 | |
1672 | - return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) ); |
|
1672 | + return ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ] ) ); |
|
1673 | 1673 | } |
1674 | 1674 | |
1675 | 1675 | /** |
@@ -1681,7 +1681,7 @@ discard block |
||
1681 | 1681 | * @return bool True if active, false otherwise. |
1682 | 1682 | */ |
1683 | 1683 | public function is_plugin_active( $slug ) { |
1684 | - return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) ); |
|
1684 | + return ( ( ! empty( $this->plugins[ $slug ][ 'is_callable' ] ) && is_callable( $this->plugins[ $slug ][ 'is_callable' ] ) ) || is_plugin_active( $this->plugins[ $slug ][ 'file_path' ] ) ); |
|
1685 | 1685 | } |
1686 | 1686 | |
1687 | 1687 | /** |
@@ -1695,14 +1695,14 @@ discard block |
||
1695 | 1695 | */ |
1696 | 1696 | public function can_plugin_update( $slug ) { |
1697 | 1697 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
1698 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1698 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1699 | 1699 | return true; |
1700 | 1700 | } |
1701 | 1701 | |
1702 | 1702 | $api = $this->get_plugins_api( $slug ); |
1703 | 1703 | |
1704 | 1704 | if ( false !== $api && isset( $api->requires ) ) { |
1705 | - return version_compare( $GLOBALS['wp_version'], $api->requires, '>=' ); |
|
1705 | + return version_compare( $GLOBALS[ 'wp_version' ], $api->requires, '>=' ); |
|
1706 | 1706 | } |
1707 | 1707 | |
1708 | 1708 | // No usable info received from the plugins API, presume we can update. |
@@ -1734,8 +1734,8 @@ discard block |
||
1734 | 1734 | public function get_installed_version( $slug ) { |
1735 | 1735 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
1736 | 1736 | |
1737 | - if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) { |
|
1738 | - return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version']; |
|
1737 | + if ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ] ) ) { |
|
1738 | + return $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ]; |
|
1739 | 1739 | } |
1740 | 1740 | |
1741 | 1741 | return ''; |
@@ -1751,7 +1751,7 @@ discard block |
||
1751 | 1751 | */ |
1752 | 1752 | public function does_plugin_require_update( $slug ) { |
1753 | 1753 | $installed_version = $this->get_installed_version( $slug ); |
1754 | - $minimum_version = $this->plugins[ $slug ]['version']; |
|
1754 | + $minimum_version = $this->plugins[ $slug ][ 'version' ]; |
|
1755 | 1755 | |
1756 | 1756 | return version_compare( $minimum_version, $installed_version, '>' ); |
1757 | 1757 | } |
@@ -1766,9 +1766,9 @@ discard block |
||
1766 | 1766 | */ |
1767 | 1767 | public function does_plugin_have_update( $slug ) { |
1768 | 1768 | // Presume bundled and external plugins will point to a package which meets the minimum required version. |
1769 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1769 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1770 | 1770 | if ( $this->does_plugin_require_update( $slug ) ) { |
1771 | - return $this->plugins[ $slug ]['version']; |
|
1771 | + return $this->plugins[ $slug ][ 'version' ]; |
|
1772 | 1772 | } |
1773 | 1773 | |
1774 | 1774 | return false; |
@@ -1776,8 +1776,8 @@ discard block |
||
1776 | 1776 | |
1777 | 1777 | $repo_updates = get_site_transient( 'update_plugins' ); |
1778 | 1778 | |
1779 | - if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) { |
|
1780 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version; |
|
1779 | + if ( isset( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version ) ) { |
|
1780 | + return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version; |
|
1781 | 1781 | } |
1782 | 1782 | |
1783 | 1783 | return false; |
@@ -1793,14 +1793,14 @@ discard block |
||
1793 | 1793 | */ |
1794 | 1794 | public function get_upgrade_notice( $slug ) { |
1795 | 1795 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
1796 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1796 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1797 | 1797 | return ''; |
1798 | 1798 | } |
1799 | 1799 | |
1800 | 1800 | $repo_updates = get_site_transient( 'update_plugins' ); |
1801 | 1801 | |
1802 | - if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) { |
|
1803 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice; |
|
1802 | + if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice ) ) { |
|
1803 | + return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice; |
|
1804 | 1804 | } |
1805 | 1805 | |
1806 | 1806 | return ''; |
@@ -1816,7 +1816,7 @@ discard block |
||
1816 | 1816 | */ |
1817 | 1817 | public function get_plugins( $plugin_folder = '' ) { |
1818 | 1818 | if ( ! function_exists( 'get_plugins' ) ) { |
1819 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
1819 | + require_once ABSPATH.'wp-admin/includes/plugin.php'; |
|
1820 | 1820 | } |
1821 | 1821 | |
1822 | 1822 | return get_plugins( $plugin_folder ); |
@@ -1831,7 +1831,7 @@ discard block |
||
1831 | 1831 | * @since 2.1.1 |
1832 | 1832 | */ |
1833 | 1833 | public function update_dismiss() { |
1834 | - delete_metadata( 'user', null, 'tgmpa_dismissed_notice_' . $this->id, null, true ); |
|
1834 | + delete_metadata( 'user', null, 'tgmpa_dismissed_notice_'.$this->id, null, true ); |
|
1835 | 1835 | } |
1836 | 1836 | |
1837 | 1837 | /** |
@@ -1850,13 +1850,13 @@ discard block |
||
1850 | 1850 | */ |
1851 | 1851 | public function force_activation() { |
1852 | 1852 | foreach ( $this->plugins as $slug => $plugin ) { |
1853 | - if ( true === $plugin['force_activation'] ) { |
|
1853 | + if ( true === $plugin[ 'force_activation' ] ) { |
|
1854 | 1854 | if ( ! $this->is_plugin_installed( $slug ) ) { |
1855 | 1855 | // Oops, plugin isn't there so iterate to next condition. |
1856 | 1856 | continue; |
1857 | 1857 | } elseif ( $this->can_plugin_activate( $slug ) ) { |
1858 | 1858 | // There we go, activate the plugin. |
1859 | - activate_plugin( $plugin['file_path'] ); |
|
1859 | + activate_plugin( $plugin[ 'file_path' ] ); |
|
1860 | 1860 | } |
1861 | 1861 | } |
1862 | 1862 | } |
@@ -1877,8 +1877,8 @@ discard block |
||
1877 | 1877 | public function force_deactivation() { |
1878 | 1878 | foreach ( $this->plugins as $slug => $plugin ) { |
1879 | 1879 | // Only proceed forward if the parameter is set to true and plugin is active. |
1880 | - if ( true === $plugin['force_deactivation'] && $this->is_plugin_active( $slug ) ) { |
|
1881 | - deactivate_plugins( $plugin['file_path'] ); |
|
1880 | + if ( true === $plugin[ 'force_deactivation' ] && $this->is_plugin_active( $slug ) ) { |
|
1881 | + deactivate_plugins( $plugin[ 'file_path' ] ); |
|
1882 | 1882 | } |
1883 | 1883 | } |
1884 | 1884 | } |
@@ -1913,7 +1913,7 @@ discard block |
||
1913 | 1913 | * Ensure only one instance of the class is ever invoked. |
1914 | 1914 | */ |
1915 | 1915 | function load_tgm_plugin_activation() { |
1916 | - $GLOBALS['tgmpa'] = TGM_Plugin_Activation::get_instance(); |
|
1916 | + $GLOBALS[ 'tgmpa' ] = TGM_Plugin_Activation::get_instance(); |
|
1917 | 1917 | } |
1918 | 1918 | } |
1919 | 1919 | |
@@ -1935,7 +1935,7 @@ discard block |
||
1935 | 1935 | * @param array $config Optional. An array of configuration values. |
1936 | 1936 | */ |
1937 | 1937 | function tgmpa( $plugins, $config = array() ) { |
1938 | - $instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
1938 | + $instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
1939 | 1939 | |
1940 | 1940 | foreach ( $plugins as $plugin ) { |
1941 | 1941 | call_user_func( array( $instance, 'register' ), $plugin ); |
@@ -1943,17 +1943,17 @@ discard block |
||
1943 | 1943 | |
1944 | 1944 | if ( ! empty( $config ) && is_array( $config ) ) { |
1945 | 1945 | // Send out notices for deprecated arguments passed. |
1946 | - if ( isset( $config['notices'] ) ) { |
|
1946 | + if ( isset( $config[ 'notices' ] ) ) { |
|
1947 | 1947 | _deprecated_argument( __FUNCTION__, '2.2.0', 'The `notices` config parameter was renamed to `has_notices` in TGMPA 2.2.0. Please adjust your configuration.' ); |
1948 | - if ( ! isset( $config['has_notices'] ) ) { |
|
1949 | - $config['has_notices'] = $config['notices']; |
|
1948 | + if ( ! isset( $config[ 'has_notices' ] ) ) { |
|
1949 | + $config[ 'has_notices' ] = $config[ 'notices' ]; |
|
1950 | 1950 | } |
1951 | 1951 | } |
1952 | 1952 | |
1953 | - if ( isset( $config['parent_menu_slug'] ) ) { |
|
1953 | + if ( isset( $config[ 'parent_menu_slug' ] ) ) { |
|
1954 | 1954 | _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.' ); |
1955 | 1955 | } |
1956 | - if ( isset( $config['parent_url_slug'] ) ) { |
|
1956 | + if ( isset( $config[ 'parent_url_slug' ] ) ) { |
|
1957 | 1957 | _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.' ); |
1958 | 1958 | } |
1959 | 1959 | |
@@ -1969,7 +1969,7 @@ discard block |
||
1969 | 1969 | * @since 2.2.0 |
1970 | 1970 | */ |
1971 | 1971 | if ( ! class_exists( 'WP_List_Table' ) ) { |
1972 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
1972 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
1973 | 1973 | } |
1974 | 1974 | |
1975 | 1975 | if ( ! class_exists( 'TGMPA_List_Table' ) ) { |
@@ -2030,7 +2030,7 @@ discard block |
||
2030 | 2030 | * @since 2.2.0 |
2031 | 2031 | */ |
2032 | 2032 | public function __construct() { |
2033 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
2033 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
2034 | 2034 | |
2035 | 2035 | parent::__construct( |
2036 | 2036 | array( |
@@ -2040,8 +2040,8 @@ discard block |
||
2040 | 2040 | ) |
2041 | 2041 | ); |
2042 | 2042 | |
2043 | - if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'install', 'update', 'activate' ), true ) ) { |
|
2044 | - $this->view_context = sanitize_key( $_REQUEST['plugin_status'] ); |
|
2043 | + if ( isset( $_REQUEST[ 'plugin_status' ] ) && in_array( $_REQUEST[ 'plugin_status' ], array( 'install', 'update', 'activate' ), true ) ) { |
|
2044 | + $this->view_context = sanitize_key( $_REQUEST[ 'plugin_status' ] ); |
|
2045 | 2045 | } |
2046 | 2046 | |
2047 | 2047 | add_filter( 'tgmpa_table_data_items', array( $this, 'sort_table_items' ) ); |
@@ -2088,20 +2088,20 @@ discard block |
||
2088 | 2088 | } |
2089 | 2089 | |
2090 | 2090 | foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) { |
2091 | - $table_data[ $i ]['sanitized_plugin'] = $plugin['name']; |
|
2092 | - $table_data[ $i ]['slug'] = $slug; |
|
2093 | - $table_data[ $i ]['plugin'] = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>'; |
|
2094 | - $table_data[ $i ]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] ); |
|
2095 | - $table_data[ $i ]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] ); |
|
2096 | - $table_data[ $i ]['status'] = $this->get_plugin_status_text( $slug ); |
|
2097 | - $table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug ); |
|
2098 | - $table_data[ $i ]['minimum_version'] = $plugin['version']; |
|
2099 | - $table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2091 | + $table_data[ $i ][ 'sanitized_plugin' ] = $plugin[ 'name' ]; |
|
2092 | + $table_data[ $i ][ 'slug' ] = $slug; |
|
2093 | + $table_data[ $i ][ 'plugin' ] = '<strong>'.$this->tgmpa->get_info_link( $slug ).'</strong>'; |
|
2094 | + $table_data[ $i ][ 'source' ] = $this->get_plugin_source_type_text( $plugin[ 'source_type' ] ); |
|
2095 | + $table_data[ $i ][ 'type' ] = $this->get_plugin_advise_type_text( $plugin[ 'required' ] ); |
|
2096 | + $table_data[ $i ][ 'status' ] = $this->get_plugin_status_text( $slug ); |
|
2097 | + $table_data[ $i ][ 'installed_version' ] = $this->tgmpa->get_installed_version( $slug ); |
|
2098 | + $table_data[ $i ][ 'minimum_version' ] = $plugin[ 'version' ]; |
|
2099 | + $table_data[ $i ][ 'available_version' ] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2100 | 2100 | |
2101 | 2101 | // Prep the upgrade notice info. |
2102 | 2102 | $upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug ); |
2103 | 2103 | if ( ! empty( $upgrade_notice ) ) { |
2104 | - $table_data[ $i ]['upgrade_notice'] = $upgrade_notice; |
|
2104 | + $table_data[ $i ][ 'upgrade_notice' ] = $upgrade_notice; |
|
2105 | 2105 | |
2106 | 2106 | add_action( "tgmpa_after_plugin_row_$slug", array( $this, 'wp_plugin_update_row' ), 10, 2 ); |
2107 | 2107 | } |
@@ -2132,17 +2132,17 @@ discard block |
||
2132 | 2132 | // No need to display plugins if they are installed, up-to-date and active. |
2133 | 2133 | continue; |
2134 | 2134 | } else { |
2135 | - $plugins['all'][ $slug ] = $plugin; |
|
2135 | + $plugins[ 'all' ][ $slug ] = $plugin; |
|
2136 | 2136 | |
2137 | 2137 | if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) { |
2138 | - $plugins['install'][ $slug ] = $plugin; |
|
2138 | + $plugins[ 'install' ][ $slug ] = $plugin; |
|
2139 | 2139 | } else { |
2140 | 2140 | if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) { |
2141 | - $plugins['update'][ $slug ] = $plugin; |
|
2141 | + $plugins[ 'update' ][ $slug ] = $plugin; |
|
2142 | 2142 | } |
2143 | 2143 | |
2144 | 2144 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
2145 | - $plugins['activate'][ $slug ] = $plugin; |
|
2145 | + $plugins[ 'activate' ][ $slug ] = $plugin; |
|
2146 | 2146 | } |
2147 | 2147 | } |
2148 | 2148 | } |
@@ -2261,8 +2261,8 @@ discard block |
||
2261 | 2261 | $name = array(); |
2262 | 2262 | |
2263 | 2263 | foreach ( $items as $i => $plugin ) { |
2264 | - $type[ $i ] = $plugin['type']; // Required / recommended. |
|
2265 | - $name[ $i ] = $plugin['sanitized_plugin']; |
|
2264 | + $type[ $i ] = $plugin[ 'type' ]; // Required / recommended. |
|
2265 | + $name[ $i ] = $plugin[ 'sanitized_plugin' ]; |
|
2266 | 2266 | } |
2267 | 2267 | |
2268 | 2268 | array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items ); |
@@ -2344,9 +2344,9 @@ discard block |
||
2344 | 2344 | public function column_cb( $item ) { |
2345 | 2345 | return sprintf( |
2346 | 2346 | '<input type="checkbox" name="%1$s[]" value="%2$s" id="%3$s" />', |
2347 | - esc_attr( $this->_args['singular'] ), |
|
2348 | - esc_attr( $item['slug'] ), |
|
2349 | - esc_attr( $item['sanitized_plugin'] ) |
|
2347 | + esc_attr( $this->_args[ 'singular' ] ), |
|
2348 | + esc_attr( $item[ 'slug' ] ), |
|
2349 | + esc_attr( $item[ 'sanitized_plugin' ] ) |
|
2350 | 2350 | ); |
2351 | 2351 | } |
2352 | 2352 | |
@@ -2361,7 +2361,7 @@ discard block |
||
2361 | 2361 | public function column_plugin( $item ) { |
2362 | 2362 | return sprintf( |
2363 | 2363 | '%1$s %2$s', |
2364 | - $item['plugin'], |
|
2364 | + $item[ 'plugin' ], |
|
2365 | 2365 | $this->row_actions( $this->get_row_actions( $item ), true ) |
2366 | 2366 | ); |
2367 | 2367 | } |
@@ -2377,38 +2377,38 @@ discard block |
||
2377 | 2377 | public function column_version( $item ) { |
2378 | 2378 | $output = array(); |
2379 | 2379 | |
2380 | - if ( $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
2381 | - $installed = ! empty( $item['installed_version'] ) ? $item['installed_version'] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
2380 | + if ( $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
2381 | + $installed = ! empty( $item[ 'installed_version' ] ) ? $item[ 'installed_version' ] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
2382 | 2382 | |
2383 | 2383 | $color = ''; |
2384 | - if ( ! empty( $item['minimum_version'] ) && $this->tgmpa->does_plugin_require_update( $item['slug'] ) ) { |
|
2384 | + if ( ! empty( $item[ 'minimum_version' ] ) && $this->tgmpa->does_plugin_require_update( $item[ 'slug' ] ) ) { |
|
2385 | 2385 | $color = ' color: #ff0000; font-weight: bold;'; |
2386 | 2386 | } |
2387 | 2387 | |
2388 | - $output[] = sprintf( |
|
2389 | - '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Installed version:', 'tgmpa' ) . '</p>', |
|
2388 | + $output[ ] = sprintf( |
|
2389 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Installed version:', 'tgmpa' ).'</p>', |
|
2390 | 2390 | $color, |
2391 | 2391 | $installed |
2392 | 2392 | ); |
2393 | 2393 | } |
2394 | 2394 | |
2395 | - if ( ! empty( $item['minimum_version'] ) ) { |
|
2396 | - $output[] = sprintf( |
|
2397 | - '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>' . __( 'Minimum required version:', 'tgmpa' ) . '</p>', |
|
2398 | - $item['minimum_version'] |
|
2395 | + if ( ! empty( $item[ 'minimum_version' ] ) ) { |
|
2396 | + $output[ ] = sprintf( |
|
2397 | + '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>'.__( 'Minimum required version:', 'tgmpa' ).'</p>', |
|
2398 | + $item[ 'minimum_version' ] |
|
2399 | 2399 | ); |
2400 | 2400 | } |
2401 | 2401 | |
2402 | - if ( ! empty( $item['available_version'] ) ) { |
|
2402 | + if ( ! empty( $item[ 'available_version' ] ) ) { |
|
2403 | 2403 | $color = ''; |
2404 | - if ( ! empty( $item['minimum_version'] ) && version_compare( $item['available_version'], $item['minimum_version'], '>=' ) ) { |
|
2404 | + if ( ! empty( $item[ 'minimum_version' ] ) && version_compare( $item[ 'available_version' ], $item[ 'minimum_version' ], '>=' ) ) { |
|
2405 | 2405 | $color = ' color: #71C671; font-weight: bold;'; |
2406 | 2406 | } |
2407 | 2407 | |
2408 | - $output[] = sprintf( |
|
2409 | - '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Available version:', 'tgmpa' ) . '</p>', |
|
2408 | + $output[ ] = sprintf( |
|
2409 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Available version:', 'tgmpa' ).'</p>', |
|
2410 | 2410 | $color, |
2411 | - $item['available_version'] |
|
2411 | + $item[ 'available_version' ] |
|
2412 | 2412 | ); |
2413 | 2413 | } |
2414 | 2414 | |
@@ -2449,8 +2449,8 @@ discard block |
||
2449 | 2449 | ); |
2450 | 2450 | |
2451 | 2451 | if ( 'all' === $this->view_context || 'update' === $this->view_context ) { |
2452 | - $columns['version'] = __( 'Version', 'tgmpa' ); |
|
2453 | - $columns['status'] = __( 'Status', 'tgmpa' ); |
|
2452 | + $columns[ 'version' ] = __( 'Version', 'tgmpa' ); |
|
2453 | + $columns[ 'status' ] = __( 'Status', 'tgmpa' ); |
|
2454 | 2454 | } |
2455 | 2455 | |
2456 | 2456 | return apply_filters( 'tgmpa_table_columns', $columns ); |
@@ -2497,17 +2497,17 @@ discard block |
||
2497 | 2497 | $action_links = array(); |
2498 | 2498 | |
2499 | 2499 | // Display the 'Install' action link if the plugin is not yet available. |
2500 | - if ( ! $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
2501 | - $actions['install'] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2500 | + if ( ! $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
2501 | + $actions[ 'install' ] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2502 | 2502 | } else { |
2503 | 2503 | // Display the 'Update' action link if an update is available and WP complies with plugin minimum. |
2504 | - if ( false !== $this->tgmpa->does_plugin_have_update( $item['slug'] ) && $this->tgmpa->can_plugin_update( $item['slug'] ) ) { |
|
2505 | - $actions['update'] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2504 | + if ( false !== $this->tgmpa->does_plugin_have_update( $item[ 'slug' ] ) && $this->tgmpa->can_plugin_update( $item[ 'slug' ] ) ) { |
|
2505 | + $actions[ 'update' ] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2506 | 2506 | } |
2507 | 2507 | |
2508 | 2508 | // Display the 'Activate' action link, but only if the plugin meets the minimum version. |
2509 | - if ( $this->tgmpa->can_plugin_activate( $item['slug'] ) ) { |
|
2510 | - $actions['activate'] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2509 | + if ( $this->tgmpa->can_plugin_activate( $item[ 'slug' ] ) ) { |
|
2510 | + $actions[ 'activate' ] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2511 | 2511 | } |
2512 | 2512 | } |
2513 | 2513 | |
@@ -2516,24 +2516,24 @@ discard block |
||
2516 | 2516 | $nonce_url = wp_nonce_url( |
2517 | 2517 | add_query_arg( |
2518 | 2518 | array( |
2519 | - 'plugin' => urlencode( $item['slug'] ), |
|
2520 | - 'tgmpa-' . $action => $action . '-plugin', |
|
2519 | + 'plugin' => urlencode( $item[ 'slug' ] ), |
|
2520 | + 'tgmpa-'.$action => $action.'-plugin', |
|
2521 | 2521 | ), |
2522 | 2522 | $this->tgmpa->get_tgmpa_url() |
2523 | 2523 | ), |
2524 | - 'tgmpa-' . $action, |
|
2524 | + 'tgmpa-'.$action, |
|
2525 | 2525 | 'tgmpa-nonce' |
2526 | 2526 | ); |
2527 | 2527 | |
2528 | 2528 | $action_links[ $action ] = sprintf( |
2529 | - '<a href="%1$s">' . esc_html( $text ) . '</a>', |
|
2529 | + '<a href="%1$s">'.esc_html( $text ).'</a>', |
|
2530 | 2530 | esc_url( $nonce_url ), |
2531 | - '<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>' |
|
2531 | + '<span class="screen-reader-text">'.esc_html( $item[ 'sanitized_plugin' ] ).'</span>' |
|
2532 | 2532 | ); |
2533 | 2533 | } |
2534 | 2534 | |
2535 | 2535 | $prefix = ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) ? 'network_admin_' : ''; |
2536 | - return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item['slug'], $item, $this->view_context ); |
|
2536 | + return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item[ 'slug' ], $item, $this->view_context ); |
|
2537 | 2537 | } |
2538 | 2538 | |
2539 | 2539 | /** |
@@ -2554,7 +2554,7 @@ discard block |
||
2554 | 2554 | * |
2555 | 2555 | * @since 2.5.0 |
2556 | 2556 | */ |
2557 | - do_action( "tgmpa_after_plugin_row_{$item['slug']}", $item['slug'], $item, $this->view_context ); |
|
2557 | + do_action( "tgmpa_after_plugin_row_{$item[ 'slug' ]}", $item[ 'slug' ], $item, $this->view_context ); |
|
2558 | 2558 | } |
2559 | 2559 | |
2560 | 2560 | /** |
@@ -2569,7 +2569,7 @@ discard block |
||
2569 | 2569 | * @return null Return early if upgrade notice is empty. |
2570 | 2570 | */ |
2571 | 2571 | public function wp_plugin_update_row( $slug, $item ) { |
2572 | - if ( empty( $item['upgrade_notice'] ) ) { |
|
2572 | + if ( empty( $item[ 'upgrade_notice' ] ) ) { |
|
2573 | 2573 | return; |
2574 | 2574 | } |
2575 | 2575 | |
@@ -2578,7 +2578,7 @@ discard block |
||
2578 | 2578 | <td colspan="', absint( $this->get_column_count() ), '" class="plugin-update colspanchange"> |
2579 | 2579 | <div class="update-message">', |
2580 | 2580 | esc_html__( 'Upgrade message from the plugin author:', 'tgmpa' ), |
2581 | - ' <strong>', wp_kses_data( $item['upgrade_notice'] ), '</strong> |
|
2581 | + ' <strong>', wp_kses_data( $item[ 'upgrade_notice' ] ), '</strong> |
|
2582 | 2582 | </div> |
2583 | 2583 | </td> |
2584 | 2584 | </tr>'; |
@@ -2610,16 +2610,16 @@ discard block |
||
2610 | 2610 | |
2611 | 2611 | if ( 'update' !== $this->view_context && 'activate' !== $this->view_context ) { |
2612 | 2612 | if ( current_user_can( 'install_plugins' ) ) { |
2613 | - $actions['tgmpa-bulk-install'] = __( 'Install', 'tgmpa' ); |
|
2613 | + $actions[ 'tgmpa-bulk-install' ] = __( 'Install', 'tgmpa' ); |
|
2614 | 2614 | } |
2615 | 2615 | } |
2616 | 2616 | |
2617 | 2617 | if ( 'install' !== $this->view_context ) { |
2618 | 2618 | if ( current_user_can( 'update_plugins' ) ) { |
2619 | - $actions['tgmpa-bulk-update'] = __( 'Update', 'tgmpa' ); |
|
2619 | + $actions[ 'tgmpa-bulk-update' ] = __( 'Update', 'tgmpa' ); |
|
2620 | 2620 | } |
2621 | 2621 | if ( current_user_can( 'activate_plugins' ) ) { |
2622 | - $actions['tgmpa-bulk-activate'] = __( 'Activate', 'tgmpa' ); |
|
2622 | + $actions[ 'tgmpa-bulk-activate' ] = __( 'Activate', 'tgmpa' ); |
|
2623 | 2623 | } |
2624 | 2624 | } |
2625 | 2625 | |
@@ -2638,7 +2638,7 @@ discard block |
||
2638 | 2638 | // Bulk installation process. |
2639 | 2639 | if ( 'tgmpa-bulk-install' === $this->current_action() || 'tgmpa-bulk-update' === $this->current_action() ) { |
2640 | 2640 | |
2641 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
2641 | + check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2642 | 2642 | |
2643 | 2643 | $install_type = 'install'; |
2644 | 2644 | if ( 'tgmpa-bulk-update' === $this->current_action() ) { |
@@ -2648,7 +2648,7 @@ discard block |
||
2648 | 2648 | $plugins_to_install = array(); |
2649 | 2649 | |
2650 | 2650 | // Did user actually select any plugins to install/update ? |
2651 | - if ( empty( $_POST['plugin'] ) ) { |
|
2651 | + if ( empty( $_POST[ 'plugin' ] ) ) { |
|
2652 | 2652 | if ( 'install' === $install_type ) { |
2653 | 2653 | $message = __( 'No plugins were selected to be installed. No action taken.', 'tgmpa' ); |
2654 | 2654 | } else { |
@@ -2660,11 +2660,11 @@ discard block |
||
2660 | 2660 | return false; |
2661 | 2661 | } |
2662 | 2662 | |
2663 | - if ( is_array( $_POST['plugin'] ) ) { |
|
2664 | - $plugins_to_install = (array) $_POST['plugin']; |
|
2665 | - } elseif ( is_string( $_POST['plugin'] ) ) { |
|
2663 | + if ( is_array( $_POST[ 'plugin' ] ) ) { |
|
2664 | + $plugins_to_install = (array) $_POST[ 'plugin' ]; |
|
2665 | + } elseif ( is_string( $_POST[ 'plugin' ] ) ) { |
|
2666 | 2666 | // Received via Filesystem page - un-flatten array (WP bug #19643). |
2667 | - $plugins_to_install = explode( ',', $_POST['plugin'] ); |
|
2667 | + $plugins_to_install = explode( ',', $_POST[ 'plugin' ] ); |
|
2668 | 2668 | } |
2669 | 2669 | |
2670 | 2670 | // Sanitize the received input. |
@@ -2701,11 +2701,11 @@ discard block |
||
2701 | 2701 | // Pass all necessary information if WP_Filesystem is needed. |
2702 | 2702 | $url = wp_nonce_url( |
2703 | 2703 | $this->tgmpa->get_tgmpa_url(), |
2704 | - 'bulk-' . $this->_args['plural'] |
|
2704 | + 'bulk-'.$this->_args[ 'plural' ] |
|
2705 | 2705 | ); |
2706 | 2706 | |
2707 | 2707 | // Give validated data back to $_POST which is the only place the filesystem looks for extra fields. |
2708 | - $_POST['plugin'] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
2708 | + $_POST[ 'plugin' ] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
2709 | 2709 | |
2710 | 2710 | $method = ''; // Leave blank so WP_Filesystem can populate it as necessary. |
2711 | 2711 | $fields = array_keys( $_POST ); // Extra fields to pass to WP_Filesystem. |
@@ -2732,22 +2732,22 @@ discard block |
||
2732 | 2732 | |
2733 | 2733 | // Prepare the data for validated plugins for the install/upgrade. |
2734 | 2734 | foreach ( $plugins_to_install as $slug ) { |
2735 | - $name = $this->tgmpa->plugins[ $slug ]['name']; |
|
2735 | + $name = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
2736 | 2736 | $source = $this->tgmpa->get_download_url( $slug ); |
2737 | 2737 | |
2738 | 2738 | if ( ! empty( $name ) && ! empty( $source ) ) { |
2739 | - $names[] = $name; |
|
2739 | + $names[ ] = $name; |
|
2740 | 2740 | |
2741 | 2741 | switch ( $install_type ) { |
2742 | 2742 | |
2743 | 2743 | case 'install': |
2744 | - $sources[] = $source; |
|
2744 | + $sources[ ] = $source; |
|
2745 | 2745 | break; |
2746 | 2746 | |
2747 | 2747 | case 'update': |
2748 | - $file_paths[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
2748 | + $file_paths[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
2749 | 2749 | $to_inject[ $slug ] = $this->tgmpa->plugins[ $slug ]; |
2750 | - $to_inject[ $slug ]['source'] = $source; |
|
2750 | + $to_inject[ $slug ][ 'source' ] = $source; |
|
2751 | 2751 | break; |
2752 | 2752 | } |
2753 | 2753 | } |
@@ -2759,7 +2759,7 @@ discard block |
||
2759 | 2759 | new TGMPA_Bulk_Installer_Skin( |
2760 | 2760 | array( |
2761 | 2761 | 'url' => esc_url_raw( $this->tgmpa->get_tgmpa_url() ), |
2762 | - 'nonce' => 'bulk-' . $this->_args['plural'], |
|
2762 | + 'nonce' => 'bulk-'.$this->_args[ 'plural' ], |
|
2763 | 2763 | 'names' => $names, |
2764 | 2764 | 'install_type' => $install_type, |
2765 | 2765 | ) |
@@ -2791,10 +2791,10 @@ discard block |
||
2791 | 2791 | |
2792 | 2792 | // Bulk activation process. |
2793 | 2793 | if ( 'tgmpa-bulk-activate' === $this->current_action() ) { |
2794 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
2794 | + check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2795 | 2795 | |
2796 | 2796 | // Did user actually select any plugins to activate ? |
2797 | - if ( empty( $_POST['plugin'] ) ) { |
|
2797 | + if ( empty( $_POST[ 'plugin' ] ) ) { |
|
2798 | 2798 | echo '<div id="message" class="error"><p>', esc_html__( 'No plugins were selected to be activated. No action taken.', 'tgmpa' ), '</p></div>'; |
2799 | 2799 | |
2800 | 2800 | return false; |
@@ -2802,8 +2802,8 @@ discard block |
||
2802 | 2802 | |
2803 | 2803 | // Grab plugin data from $_POST. |
2804 | 2804 | $plugins = array(); |
2805 | - if ( isset( $_POST['plugin'] ) ) { |
|
2806 | - $plugins = array_map( 'urldecode', (array) $_POST['plugin'] ); |
|
2805 | + if ( isset( $_POST[ 'plugin' ] ) ) { |
|
2806 | + $plugins = array_map( 'urldecode', (array) $_POST[ 'plugin' ] ); |
|
2807 | 2807 | $plugins = array_map( array( $this->tgmpa, 'sanitize_key' ), $plugins ); |
2808 | 2808 | } |
2809 | 2809 | |
@@ -2813,8 +2813,8 @@ discard block |
||
2813 | 2813 | // Grab the file paths for the selected & inactive plugins from the registration array. |
2814 | 2814 | foreach ( $plugins as $slug ) { |
2815 | 2815 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
2816 | - $plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
2817 | - $plugin_names[] = $this->tgmpa->plugins[ $slug ]['name']; |
|
2816 | + $plugins_to_activate[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
2817 | + $plugin_names[ ] = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
2818 | 2818 | } |
2819 | 2819 | } |
2820 | 2820 | unset( $slug ); |
@@ -2835,7 +2835,7 @@ discard block |
||
2835 | 2835 | $count = count( $plugin_names ); // Count so we can use _n function. |
2836 | 2836 | $plugin_names = array_map( array( 'TGMPA_Utils', 'wrap_in_strong' ), $plugin_names ); |
2837 | 2837 | $last_plugin = array_pop( $plugin_names ); // Pop off last name to prep for readability. |
2838 | - $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
2838 | + $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); |
|
2839 | 2839 | |
2840 | 2840 | printf( // WPCS: xss ok. |
2841 | 2841 | '<div id="message" class="updated"><p>%1$s %2$s.</p></div>', |
@@ -2938,16 +2938,16 @@ discard block |
||
2938 | 2938 | */ |
2939 | 2939 | function tgmpa_load_bulk_installer() { |
2940 | 2940 | // Silently fail if 2.5+ is loaded *after* an older version. |
2941 | - if ( ! isset( $GLOBALS['tgmpa'] ) ) { |
|
2941 | + if ( ! isset( $GLOBALS[ 'tgmpa' ] ) ) { |
|
2942 | 2942 | return; |
2943 | 2943 | } |
2944 | 2944 | |
2945 | 2945 | // Get TGMPA class instance. |
2946 | - $tgmpa_instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
2946 | + $tgmpa_instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
2947 | 2947 | |
2948 | - if ( isset( $_GET['page'] ) && $tgmpa_instance->menu === $_GET['page'] ) { |
|
2948 | + if ( isset( $_GET[ 'page' ] ) && $tgmpa_instance->menu === $_GET[ 'page' ] ) { |
|
2949 | 2949 | if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
2950 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
2950 | + require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
2951 | 2951 | } |
2952 | 2952 | |
2953 | 2953 | if ( ! class_exists( 'TGMPA_Bulk_Installer' ) ) { |
@@ -3014,11 +3014,11 @@ discard block |
||
3014 | 3014 | */ |
3015 | 3015 | public function __construct( $skin = null ) { |
3016 | 3016 | // Get TGMPA class instance. |
3017 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
3017 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3018 | 3018 | |
3019 | 3019 | parent::__construct( $skin ); |
3020 | 3020 | |
3021 | - if ( isset( $this->skin->options['install_type'] ) && 'update' === $this->skin->options['install_type'] ) { |
|
3021 | + if ( isset( $this->skin->options[ 'install_type' ] ) && 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3022 | 3022 | $this->clear_destination = true; |
3023 | 3023 | } |
3024 | 3024 | |
@@ -3035,8 +3035,8 @@ discard block |
||
3035 | 3035 | * @since 2.2.0 |
3036 | 3036 | */ |
3037 | 3037 | public function activate_strings() { |
3038 | - $this->strings['activation_failed'] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
3039 | - $this->strings['activation_success'] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
3038 | + $this->strings[ 'activation_failed' ] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
3039 | + $this->strings[ 'activation_success' ] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
3040 | 3040 | } |
3041 | 3041 | |
3042 | 3042 | /** |
@@ -3054,7 +3054,7 @@ discard block |
||
3054 | 3054 | |
3055 | 3055 | // Reset the strings in case we changed one during automatic activation. |
3056 | 3056 | if ( $this->tgmpa->is_automatic ) { |
3057 | - if ( 'update' === $this->skin->options['install_type'] ) { |
|
3057 | + if ( 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3058 | 3058 | $this->upgrade_strings(); |
3059 | 3059 | } else { |
3060 | 3060 | $this->install_strings(); |
@@ -3207,7 +3207,7 @@ discard block |
||
3207 | 3207 | remove_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 ); |
3208 | 3208 | |
3209 | 3209 | // Force refresh of plugin update information. |
3210 | - wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); |
|
3210 | + wp_clean_plugins_cache( $parsed_args[ 'clear_update_cache' ] ); |
|
3211 | 3211 | |
3212 | 3212 | return $results; |
3213 | 3213 | } |
@@ -3258,13 +3258,13 @@ discard block |
||
3258 | 3258 | $activate = activate_plugin( $plugin_info ); |
3259 | 3259 | |
3260 | 3260 | // Adjust the success string based on the activation result. |
3261 | - $this->strings['process_success'] = $this->strings['process_success'] . "<br />\n"; |
|
3261 | + $this->strings[ 'process_success' ] = $this->strings[ 'process_success' ]."<br />\n"; |
|
3262 | 3262 | |
3263 | 3263 | if ( is_wp_error( $activate ) ) { |
3264 | 3264 | $this->skin->error( $activate ); |
3265 | - $this->strings['process_success'] .= $this->strings['activation_failed']; |
|
3265 | + $this->strings[ 'process_success' ] .= $this->strings[ 'activation_failed' ]; |
|
3266 | 3266 | } else { |
3267 | - $this->strings['process_success'] .= $this->strings['activation_success']; |
|
3267 | + $this->strings[ 'process_success' ] .= $this->strings[ 'activation_success' ]; |
|
3268 | 3268 | } |
3269 | 3269 | } |
3270 | 3270 | } |
@@ -3340,7 +3340,7 @@ discard block |
||
3340 | 3340 | */ |
3341 | 3341 | public function __construct( $args = array() ) { |
3342 | 3342 | // Get TGMPA class instance. |
3343 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
3343 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3344 | 3344 | |
3345 | 3345 | // Parse default and new args. |
3346 | 3346 | $defaults = array( |
@@ -3349,10 +3349,10 @@ discard block |
||
3349 | 3349 | 'names' => array(), |
3350 | 3350 | 'install_type' => 'install', |
3351 | 3351 | ); |
3352 | - $args = wp_parse_args( $args, $defaults ); |
|
3352 | + $args = wp_parse_args( $args, $defaults ); |
|
3353 | 3353 | |
3354 | 3354 | // Set plugin names to $this->plugin_names property. |
3355 | - $this->plugin_names = $args['names']; |
|
3355 | + $this->plugin_names = $args[ 'names' ]; |
|
3356 | 3356 | |
3357 | 3357 | // Extract the new args. |
3358 | 3358 | parent::__construct( $args ); |
@@ -3367,25 +3367,25 @@ discard block |
||
3367 | 3367 | * @since 2.2.0 |
3368 | 3368 | */ |
3369 | 3369 | public function add_strings() { |
3370 | - if ( 'update' === $this->options['install_type'] ) { |
|
3370 | + if ( 'update' === $this->options[ 'install_type' ] ) { |
|
3371 | 3371 | parent::add_strings(); |
3372 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3372 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3373 | 3373 | } else { |
3374 | - $this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
3375 | - $this->upgrader->strings['skin_update_failed'] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
3374 | + $this->upgrader->strings[ 'skin_update_failed_error' ] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
3375 | + $this->upgrader->strings[ 'skin_update_failed' ] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
3376 | 3376 | |
3377 | 3377 | if ( $this->tgmpa->is_automatic ) { |
3378 | 3378 | // Automatic activation strings. |
3379 | - $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' ); |
|
3380 | - $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>'; |
|
3381 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
3382 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3379 | + $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' ); |
|
3380 | + $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>'; |
|
3381 | + $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
3382 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3383 | 3383 | } else { |
3384 | 3384 | // Default installation strings. |
3385 | - $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' ); |
|
3386 | - $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>'; |
|
3387 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations have been completed.', 'tgmpa' ); |
|
3388 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3385 | + $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' ); |
|
3386 | + $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>'; |
|
3387 | + $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations have been completed.', 'tgmpa' ); |
|
3388 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3389 | 3389 | } |
3390 | 3390 | } |
3391 | 3391 | } |
@@ -3443,12 +3443,12 @@ discard block |
||
3443 | 3443 | if ( $this->tgmpa->is_tgmpa_complete() ) { |
3444 | 3444 | // All plugins are active, so we display the complete string and hide the menu to protect users. |
3445 | 3445 | echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
3446 | - $update_actions['dashboard'] = sprintf( |
|
3447 | - esc_html( $this->tgmpa->strings['complete'] ), |
|
3448 | - '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' |
|
3446 | + $update_actions[ 'dashboard' ] = sprintf( |
|
3447 | + esc_html( $this->tgmpa->strings[ 'complete' ] ), |
|
3448 | + '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' |
|
3449 | 3449 | ); |
3450 | 3450 | } else { |
3451 | - $update_actions['tgmpa_page'] = '<a href="' . esc_url( $this->tgmpa->get_tgmpa_url() ) . '" target="_parent">' . esc_html( $this->tgmpa->strings['return'] ) . '</a>'; |
|
3451 | + $update_actions[ 'tgmpa_page' ] = '<a href="'.esc_url( $this->tgmpa->get_tgmpa_url() ).'" target="_parent">'.esc_html( $this->tgmpa->strings[ 'return' ] ).'</a>'; |
|
3452 | 3452 | } |
3453 | 3453 | |
3454 | 3454 | /** |
@@ -3538,7 +3538,7 @@ discard block |
||
3538 | 3538 | * @return string |
3539 | 3539 | */ |
3540 | 3540 | public static function wrap_in_em( $string ) { |
3541 | - return '<em>' . wp_kses_post( $string ) . '</em>'; |
|
3541 | + return '<em>'.wp_kses_post( $string ).'</em>'; |
|
3542 | 3542 | } |
3543 | 3543 | |
3544 | 3544 | /** |
@@ -3552,7 +3552,7 @@ discard block |
||
3552 | 3552 | * @return string |
3553 | 3553 | */ |
3554 | 3554 | public static function wrap_in_strong( $string ) { |
3555 | - return '<strong>' . wp_kses_post( $string ) . '</strong>'; |
|
3555 | + return '<strong>'.wp_kses_post( $string ).'</strong>'; |
|
3556 | 3556 | } |
3557 | 3557 | |
3558 | 3558 | /** |
@@ -3589,7 +3589,7 @@ discard block |
||
3589 | 3589 | */ |
3590 | 3590 | protected static function emulate_filter_bool( $value ) { |
3591 | 3591 | // @codingStandardsIgnoreStart |
3592 | - static $true = array( |
|
3592 | + static $true = array( |
|
3593 | 3593 | '1', |
3594 | 3594 | 'true', 'True', 'TRUE', |
3595 | 3595 | '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( |