@@ -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 |
@@ -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 ) ); |
@@ -466,15 +466,15 @@ discard block |
||
466 | 466 | public function add_plugin_action_link_filters() { |
467 | 467 | foreach ( $this->plugins as $slug => $plugin ) { |
468 | 468 | if ( false === $this->can_plugin_activate( $slug ) ) { |
469 | - add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_activate' ), 20 ); |
|
469 | + add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_activate' ), 20 ); |
|
470 | 470 | } |
471 | 471 | |
472 | - if ( true === $plugin['force_activation'] ) { |
|
473 | - add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_deactivate' ), 20 ); |
|
472 | + if ( true === $plugin[ 'force_activation' ] ) { |
|
473 | + add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_deactivate' ), 20 ); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | if ( false !== $this->does_plugin_require_update( $slug ) ) { |
477 | - add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_update' ), 20 ); |
|
477 | + add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_update' ), 20 ); |
|
478 | 478 | } |
479 | 479 | } |
480 | 480 | } |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | * @return array |
490 | 490 | */ |
491 | 491 | public function filter_plugin_action_links_activate( $actions ) { |
492 | - unset( $actions['activate'] ); |
|
492 | + unset( $actions[ 'activate' ] ); |
|
493 | 493 | |
494 | 494 | return $actions; |
495 | 495 | } |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | * @return array |
504 | 504 | */ |
505 | 505 | public function filter_plugin_action_links_deactivate( $actions ) { |
506 | - unset( $actions['deactivate'] ); |
|
506 | + unset( $actions[ 'deactivate' ] ); |
|
507 | 507 | |
508 | 508 | return $actions; |
509 | 509 | } |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | * @return array |
519 | 519 | */ |
520 | 520 | public function filter_plugin_action_links_update( $actions ) { |
521 | - $actions['update'] = sprintf( |
|
521 | + $actions[ 'update' ] = sprintf( |
|
522 | 522 | '<a href="%1$s" title="%2$s" class="edit">%3$s</a>', |
523 | 523 | esc_url( $this->get_tgmpa_status_url( 'update' ) ), |
524 | 524 | esc_attr__( 'This plugin needs to be updated to be compatible with your theme.', 'tgmpa' ), |
@@ -556,9 +556,9 @@ discard block |
||
556 | 556 | return; |
557 | 557 | } |
558 | 558 | |
559 | - if ( isset( $_REQUEST['tab'] ) && 'plugin-information' === $_REQUEST['tab'] ) { |
|
559 | + if ( isset( $_REQUEST[ 'tab' ] ) && 'plugin-information' === $_REQUEST[ 'tab' ] ) { |
|
560 | 560 | // Needed for install_plugin_information(). |
561 | - require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
|
561 | + require_once ABSPATH.'wp-admin/includes/plugin-install.php'; |
|
562 | 562 | |
563 | 563 | wp_enqueue_style( 'plugin-install' ); |
564 | 564 | |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | * @since 2.1.0 |
587 | 587 | */ |
588 | 588 | public function thickbox() { |
589 | - if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) ) { |
|
589 | + if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, true ) ) { |
|
590 | 590 | add_thickbox(); |
591 | 591 | } |
592 | 592 | } |
@@ -615,11 +615,11 @@ discard block |
||
615 | 615 | $args = apply_filters( |
616 | 616 | 'tgmpa_admin_menu_args', |
617 | 617 | array( |
618 | - 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
619 | - 'page_title' => $this->strings['page_title'], // Page title. |
|
620 | - 'menu_title' => $this->strings['menu_title'], // Menu title. |
|
621 | - 'capability' => $this->capability, // Capability. |
|
622 | - 'menu_slug' => $this->menu, // Menu slug. |
|
618 | + 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
619 | + 'page_title' => $this->strings[ 'page_title' ], // Page title. |
|
620 | + 'menu_title' => $this->strings[ 'menu_title' ], // Menu title. |
|
621 | + 'capability' => $this->capability, // Capability. |
|
622 | + 'menu_slug' => $this->menu, // Menu slug. |
|
623 | 623 | 'function' => array( $this, 'install_plugins_page' ), // Callback. |
624 | 624 | ) |
625 | 625 | ); |
@@ -640,10 +640,10 @@ discard block |
||
640 | 640 | } |
641 | 641 | |
642 | 642 | if ( 'themes.php' === $this->parent_slug ) { |
643 | - $this->page_hook = call_user_func( 'add_theme_page', $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] ); |
|
643 | + $this->page_hook = call_user_func( 'add_theme_page', $args[ 'page_title' ], $args[ 'menu_title' ], $args[ 'capability' ], $args[ 'menu_slug' ], $args[ 'function' ] ); |
|
644 | 644 | } else { |
645 | 645 | $type = 'submenu'; |
646 | - $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'] ); |
|
646 | + $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' ] ); |
|
647 | 647 | } |
648 | 648 | } |
649 | 649 | |
@@ -712,37 +712,37 @@ discard block |
||
712 | 712 | * @return boolean True on success, false on failure. |
713 | 713 | */ |
714 | 714 | protected function do_plugin_install() { |
715 | - if ( empty( $_GET['plugin'] ) ) { |
|
715 | + if ( empty( $_GET[ 'plugin' ] ) ) { |
|
716 | 716 | return false; |
717 | 717 | } |
718 | 718 | |
719 | 719 | // All plugin information will be stored in an array for processing. |
720 | - $slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) ); |
|
720 | + $slug = $this->sanitize_key( urldecode( $_GET[ 'plugin' ] ) ); |
|
721 | 721 | |
722 | 722 | if ( ! isset( $this->plugins[ $slug ] ) ) { |
723 | 723 | return false; |
724 | 724 | } |
725 | 725 | |
726 | 726 | // Was an install or upgrade action link clicked? |
727 | - if ( ( isset( $_GET['tgmpa-install'] ) && 'install-plugin' === $_GET['tgmpa-install'] ) || ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) ) { |
|
727 | + if ( ( isset( $_GET[ 'tgmpa-install' ] ) && 'install-plugin' === $_GET[ 'tgmpa-install' ] ) || ( isset( $_GET[ 'tgmpa-update' ] ) && 'update-plugin' === $_GET[ 'tgmpa-update' ] ) ) { |
|
728 | 728 | |
729 | 729 | $install_type = 'install'; |
730 | - if ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) { |
|
730 | + if ( isset( $_GET[ 'tgmpa-update' ] ) && 'update-plugin' === $_GET[ 'tgmpa-update' ] ) { |
|
731 | 731 | $install_type = 'update'; |
732 | 732 | } |
733 | 733 | |
734 | - check_admin_referer( 'tgmpa-' . $install_type, 'tgmpa-nonce' ); |
|
734 | + check_admin_referer( 'tgmpa-'.$install_type, 'tgmpa-nonce' ); |
|
735 | 735 | |
736 | 736 | // Pass necessary information via URL if WP_Filesystem is needed. |
737 | 737 | $url = wp_nonce_url( |
738 | 738 | add_query_arg( |
739 | 739 | array( |
740 | 740 | 'plugin' => urlencode( $slug ), |
741 | - 'tgmpa-' . $install_type => $install_type . '-plugin', |
|
741 | + 'tgmpa-'.$install_type => $install_type.'-plugin', |
|
742 | 742 | ), |
743 | 743 | $this->get_tgmpa_url() |
744 | 744 | ), |
745 | - 'tgmpa-' . $install_type, |
|
745 | + 'tgmpa-'.$install_type, |
|
746 | 746 | 'tgmpa-nonce' |
747 | 747 | ); |
748 | 748 | |
@@ -761,35 +761,35 @@ discard block |
||
761 | 761 | |
762 | 762 | // Prep variables for Plugin_Installer_Skin class. |
763 | 763 | $extra = array(); |
764 | - $extra['slug'] = $slug; // Needed for potentially renaming of directory name. |
|
764 | + $extra[ 'slug' ] = $slug; // Needed for potentially renaming of directory name. |
|
765 | 765 | $source = $this->get_download_url( $slug ); |
766 | - $api = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null; |
|
766 | + $api = ( 'repo' === $this->plugins[ $slug ][ 'source_type' ] ) ? $this->get_plugins_api( $slug ) : null; |
|
767 | 767 | $api = ( false !== $api ) ? $api : null; |
768 | 768 | |
769 | 769 | $url = add_query_arg( |
770 | 770 | array( |
771 | - 'action' => $install_type . '-plugin', |
|
771 | + 'action' => $install_type.'-plugin', |
|
772 | 772 | 'plugin' => urlencode( $slug ), |
773 | 773 | ), |
774 | 774 | 'update.php' |
775 | 775 | ); |
776 | 776 | |
777 | 777 | if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
778 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
778 | + require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
779 | 779 | } |
780 | 780 | |
781 | 781 | $skin_args = array( |
782 | - 'type' => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload', |
|
783 | - 'title' => sprintf( $this->strings['installing'], $this->plugins[ $slug ]['name'] ), |
|
782 | + 'type' => ( 'bundled' !== $this->plugins[ $slug ][ 'source_type' ] ) ? 'web' : 'upload', |
|
783 | + 'title' => sprintf( $this->strings[ 'installing' ], $this->plugins[ $slug ][ 'name' ] ), |
|
784 | 784 | 'url' => esc_url_raw( $url ), |
785 | - 'nonce' => $install_type . '-plugin_' . $slug, |
|
785 | + 'nonce' => $install_type.'-plugin_'.$slug, |
|
786 | 786 | 'plugin' => '', |
787 | 787 | 'api' => $api, |
788 | 788 | 'extra' => $extra, |
789 | 789 | ); |
790 | 790 | |
791 | 791 | if ( 'update' === $install_type ) { |
792 | - $skin_args['plugin'] = $this->plugins[ $slug ]['file_path']; |
|
792 | + $skin_args[ 'plugin' ] = $this->plugins[ $slug ][ 'file_path' ]; |
|
793 | 793 | $skin = new Plugin_Upgrader_Skin( $skin_args ); |
794 | 794 | } else { |
795 | 795 | $skin = new Plugin_Installer_Skin( $skin_args ); |
@@ -804,10 +804,10 @@ discard block |
||
804 | 804 | if ( 'update' === $install_type ) { |
805 | 805 | // Inject our info into the update transient. |
806 | 806 | $to_inject = array( $slug => $this->plugins[ $slug ] ); |
807 | - $to_inject[ $slug ]['source'] = $source; |
|
807 | + $to_inject[ $slug ][ 'source' ] = $source; |
|
808 | 808 | $this->inject_update_info( $to_inject ); |
809 | 809 | |
810 | - $upgrader->upgrade( $this->plugins[ $slug ]['file_path'] ); |
|
810 | + $upgrader->upgrade( $this->plugins[ $slug ][ 'file_path' ] ); |
|
811 | 811 | } else { |
812 | 812 | $upgrader->install( $source ); |
813 | 813 | } |
@@ -830,18 +830,18 @@ discard block |
||
830 | 830 | |
831 | 831 | // Display message based on if all plugins are now active or not. |
832 | 832 | if ( $this->is_tgmpa_complete() ) { |
833 | - echo '<p>', sprintf( esc_html( $this->strings['complete'] ), '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' ), '</p>'; |
|
833 | + echo '<p>', sprintf( esc_html( $this->strings[ 'complete' ] ), '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' ), '</p>'; |
|
834 | 834 | echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
835 | 835 | } else { |
836 | - echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; |
|
836 | + echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings[ 'return' ] ), '</a></p>'; |
|
837 | 837 | } |
838 | 838 | |
839 | 839 | return true; |
840 | - } elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) { |
|
840 | + } elseif ( isset( $this->plugins[ $slug ][ 'file_path' ], $_GET[ 'tgmpa-activate' ] ) && 'activate-plugin' === $_GET[ 'tgmpa-activate' ] ) { |
|
841 | 841 | // Activate action link was clicked. |
842 | 842 | check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' ); |
843 | 843 | |
844 | - if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) { |
|
844 | + if ( false === $this->activate_single_plugin( $this->plugins[ $slug ][ 'file_path' ], $slug ) ) { |
|
845 | 845 | return true; // Finish execution of the function early as we encountered an error. |
846 | 846 | } |
847 | 847 | } |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | } |
865 | 865 | |
866 | 866 | foreach ( $plugins as $slug => $plugin ) { |
867 | - $file_path = $plugin['file_path']; |
|
867 | + $file_path = $plugin[ 'file_path' ]; |
|
868 | 868 | |
869 | 869 | if ( empty( $repo_updates->response[ $file_path ] ) ) { |
870 | 870 | $repo_updates->response[ $file_path ] = new stdClass; |
@@ -873,10 +873,10 @@ discard block |
||
873 | 873 | // We only really need to set package, but let's do all we can in case WP changes something. |
874 | 874 | $repo_updates->response[ $file_path ]->slug = $slug; |
875 | 875 | $repo_updates->response[ $file_path ]->plugin = $file_path; |
876 | - $repo_updates->response[ $file_path ]->new_version = $plugin['version']; |
|
877 | - $repo_updates->response[ $file_path ]->package = $plugin['source']; |
|
878 | - if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) { |
|
879 | - $repo_updates->response[ $file_path ]->url = $plugin['external_url']; |
|
876 | + $repo_updates->response[ $file_path ]->new_version = $plugin[ 'version' ]; |
|
877 | + $repo_updates->response[ $file_path ]->package = $plugin[ 'source' ]; |
|
878 | + if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin[ 'external_url' ] ) ) { |
|
879 | + $repo_updates->response[ $file_path ]->url = $plugin[ 'external_url' ]; |
|
880 | 880 | } |
881 | 881 | } |
882 | 882 | |
@@ -900,13 +900,13 @@ discard block |
||
900 | 900 | * @return string $source |
901 | 901 | */ |
902 | 902 | public function maybe_adjust_source_dir( $source, $remote_source, $upgrader ) { |
903 | - if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS['wp_filesystem'] ) ) { |
|
903 | + if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS[ 'wp_filesystem' ] ) ) { |
|
904 | 904 | return $source; |
905 | 905 | } |
906 | 906 | |
907 | 907 | // Check for single file plugins. |
908 | - $source_files = array_keys( $GLOBALS['wp_filesystem']->dirlist( $remote_source ) ); |
|
909 | - if ( 1 === count( $source_files ) && false === $GLOBALS['wp_filesystem']->is_dir( $source ) ) { |
|
908 | + $source_files = array_keys( $GLOBALS[ 'wp_filesystem' ]->dirlist( $remote_source ) ); |
|
909 | + if ( 1 === count( $source_files ) && false === $GLOBALS[ 'wp_filesystem' ]->is_dir( $source ) ) { |
|
910 | 910 | return $source; |
911 | 911 | } |
912 | 912 | |
@@ -914,12 +914,12 @@ discard block |
||
914 | 914 | $desired_slug = ''; |
915 | 915 | |
916 | 916 | // Figure out what the slug is supposed to be. |
917 | - if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options['extra']['slug'] ) ) { |
|
918 | - $desired_slug = $upgrader->skin->options['extra']['slug']; |
|
917 | + if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options[ 'extra' ][ 'slug' ] ) ) { |
|
918 | + $desired_slug = $upgrader->skin->options[ 'extra' ][ 'slug' ]; |
|
919 | 919 | } else { |
920 | 920 | // Bulk installer contains less info, so fall back on the info registered here. |
921 | 921 | foreach ( $this->plugins as $slug => $plugin ) { |
922 | - if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
|
922 | + if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin[ 'name' ] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
|
923 | 923 | $desired_slug = $slug; |
924 | 924 | break; |
925 | 925 | } |
@@ -932,15 +932,15 @@ discard block |
||
932 | 932 | |
933 | 933 | if ( ! empty( $subdir_name ) && $subdir_name !== $desired_slug ) { |
934 | 934 | $from = untrailingslashit( $source ); |
935 | - $to = trailingslashit( $remote_source ) . $desired_slug; |
|
935 | + $to = trailingslashit( $remote_source ).$desired_slug; |
|
936 | 936 | |
937 | - if ( true === $GLOBALS['wp_filesystem']->move( $from, $to ) ) { |
|
937 | + if ( true === $GLOBALS[ 'wp_filesystem' ]->move( $from, $to ) ) { |
|
938 | 938 | return trailingslashit( $to ); |
939 | 939 | } else { |
940 | - 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 ) ); |
|
940 | + 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 ) ); |
|
941 | 941 | } |
942 | 942 | } elseif ( empty( $subdir_name ) ) { |
943 | - 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 ) ); |
|
943 | + 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 ) ); |
|
944 | 944 | } |
945 | 945 | } |
946 | 946 | |
@@ -964,19 +964,19 @@ discard block |
||
964 | 964 | |
965 | 965 | if ( is_wp_error( $activate ) ) { |
966 | 966 | echo '<div id="message" class="error"><p>', wp_kses_post( $activate->get_error_message() ), '</p></div>', |
967 | - '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; |
|
967 | + '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings[ 'return' ] ), '</a></p>'; |
|
968 | 968 | |
969 | 969 | return false; // End it here if there is an error with activation. |
970 | 970 | } else { |
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. |
|
975 | - echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>'; |
|
974 | + if ( ! isset( $_POST[ 'action' ] ) ) { // WPCS: CSRF OK. |
|
975 | + echo '<div id="message" class="updated"><p>', esc_html( $this->strings[ 'activated_successfully' ] ), ' <strong>', esc_html( $this->plugins[ $slug ][ 'name' ] ), '.</strong></p></div>'; |
|
976 | 976 | } |
977 | 977 | } else { |
978 | 978 | // Simpler message layout for use on the plugin install page. |
979 | - echo '<p>', esc_html( $this->strings['plugin_activated'] ), '</p>'; |
|
979 | + echo '<p>', esc_html( $this->strings[ 'plugin_activated' ] ), '</p>'; |
|
980 | 980 | } |
981 | 981 | } |
982 | 982 | } elseif ( $this->is_plugin_active( $slug ) ) { |
@@ -984,25 +984,25 @@ discard block |
||
984 | 984 | // on the plugin install page. |
985 | 985 | echo '<div id="message" class="error"><p>', |
986 | 986 | sprintf( |
987 | - esc_html( $this->strings['plugin_already_active'] ), |
|
988 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
987 | + esc_html( $this->strings[ 'plugin_already_active' ] ), |
|
988 | + '<strong>'.esc_html( $this->plugins[ $slug ][ 'name' ] ).'</strong>' |
|
989 | 989 | ), |
990 | 990 | '</p></div>'; |
991 | 991 | } elseif ( $this->does_plugin_require_update( $slug ) ) { |
992 | 992 | if ( ! $automatic ) { |
993 | 993 | // Make sure message doesn't display again if bulk activation is performed |
994 | 994 | // immediately after a single activation. |
995 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
995 | + if ( ! isset( $_POST[ 'action' ] ) ) { // WPCS: CSRF OK. |
|
996 | 996 | echo '<div id="message" class="error"><p>', |
997 | 997 | sprintf( |
998 | - esc_html( $this->strings['plugin_needs_higher_version'] ), |
|
999 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
998 | + esc_html( $this->strings[ 'plugin_needs_higher_version' ] ), |
|
999 | + '<strong>'.esc_html( $this->plugins[ $slug ][ 'name' ] ).'</strong>' |
|
1000 | 1000 | ), |
1001 | 1001 | '</p></div>'; |
1002 | 1002 | } |
1003 | 1003 | } else { |
1004 | 1004 | // Simpler message layout for use on the plugin install page. |
1005 | - echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>'; |
|
1005 | + echo '<p>', sprintf( esc_html( $this->strings[ 'plugin_needs_higher_version' ] ), esc_html( $this->plugins[ $slug ][ 'name' ] ) ), '</p>'; |
|
1006 | 1006 | } |
1007 | 1007 | } |
1008 | 1008 | |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | */ |
1027 | 1027 | public function notices() { |
1028 | 1028 | // Remove nag on the install page / Return early if the nag message has been dismissed. |
1029 | - if ( $this->is_tgmpa_page() || get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) ) { |
|
1029 | + if ( $this->is_tgmpa_page() || get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, true ) ) { |
|
1030 | 1030 | return; |
1031 | 1031 | } |
1032 | 1032 | |
@@ -1047,28 +1047,28 @@ discard block |
||
1047 | 1047 | if ( current_user_can( 'install_plugins' ) ) { |
1048 | 1048 | $install_link_count++; |
1049 | 1049 | |
1050 | - if ( true === $plugin['required'] ) { |
|
1051 | - $message['notice_can_install_required'][] = $slug; |
|
1050 | + if ( true === $plugin[ 'required' ] ) { |
|
1051 | + $message[ 'notice_can_install_required' ][ ] = $slug; |
|
1052 | 1052 | } else { |
1053 | - $message['notice_can_install_recommended'][] = $slug; |
|
1053 | + $message[ 'notice_can_install_recommended' ][ ] = $slug; |
|
1054 | 1054 | } |
1055 | 1055 | } else { |
1056 | 1056 | // Need higher privileges to install the plugin. |
1057 | - $message['notice_cannot_install'][] = $slug; |
|
1057 | + $message[ 'notice_cannot_install' ][ ] = $slug; |
|
1058 | 1058 | } |
1059 | 1059 | } else { |
1060 | 1060 | if ( ! $this->is_plugin_active( $slug ) && $this->can_plugin_activate( $slug ) ) { |
1061 | 1061 | if ( current_user_can( 'activate_plugins' ) ) { |
1062 | 1062 | $activate_link_count++; |
1063 | 1063 | |
1064 | - if ( true === $plugin['required'] ) { |
|
1065 | - $message['notice_can_activate_required'][] = $slug; |
|
1064 | + if ( true === $plugin[ 'required' ] ) { |
|
1065 | + $message[ 'notice_can_activate_required' ][ ] = $slug; |
|
1066 | 1066 | } else { |
1067 | - $message['notice_can_activate_recommended'][] = $slug; |
|
1067 | + $message[ 'notice_can_activate_recommended' ][ ] = $slug; |
|
1068 | 1068 | } |
1069 | 1069 | } else { |
1070 | 1070 | // Need higher privileges to activate the plugin. |
1071 | - $message['notice_cannot_activate'][] = $slug; |
|
1071 | + $message[ 'notice_cannot_activate' ][ ] = $slug; |
|
1072 | 1072 | } |
1073 | 1073 | } |
1074 | 1074 | |
@@ -1078,13 +1078,13 @@ discard block |
||
1078 | 1078 | $update_link_count++; |
1079 | 1079 | |
1080 | 1080 | if ( $this->does_plugin_require_update( $slug ) ) { |
1081 | - $message['notice_ask_to_update'][] = $slug; |
|
1081 | + $message[ 'notice_ask_to_update' ][ ] = $slug; |
|
1082 | 1082 | } elseif ( false !== $this->does_plugin_have_update( $slug ) ) { |
1083 | - $message['notice_ask_to_update_maybe'][] = $slug; |
|
1083 | + $message[ 'notice_ask_to_update_maybe' ][ ] = $slug; |
|
1084 | 1084 | } |
1085 | 1085 | } else { |
1086 | 1086 | // Need higher privileges to update the plugin. |
1087 | - $message['notice_cannot_update'][] = $slug; |
|
1087 | + $message[ 'notice_cannot_update' ][ ] = $slug; |
|
1088 | 1088 | } |
1089 | 1089 | } |
1090 | 1090 | } |
@@ -1098,7 +1098,7 @@ discard block |
||
1098 | 1098 | |
1099 | 1099 | // As add_settings_error() wraps the final message in a <p> and as the final message can't be |
1100 | 1100 | // filtered, using <p>'s in our html would render invalid html output. |
1101 | - $line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>' . "\n"; |
|
1101 | + $line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>'."\n"; |
|
1102 | 1102 | |
1103 | 1103 | // If dismissable is false and a message is set, output it now. |
1104 | 1104 | if ( ! $this->dismissable && ! empty( $this->dismiss_msg ) ) { |
@@ -1111,14 +1111,14 @@ discard block |
||
1111 | 1111 | |
1112 | 1112 | // Get the external info link for a plugin if one is available. |
1113 | 1113 | foreach ( $plugin_group as $plugin_slug ) { |
1114 | - $linked_plugins[] = $this->get_info_link( $plugin_slug ); |
|
1114 | + $linked_plugins[ ] = $this->get_info_link( $plugin_slug ); |
|
1115 | 1115 | } |
1116 | 1116 | unset( $plugin_slug ); |
1117 | 1117 | |
1118 | 1118 | $count = count( $plugin_group ); |
1119 | 1119 | $linked_plugins = array_map( array( 'TGMPA_Utils', 'wrap_in_em' ), $linked_plugins ); |
1120 | 1120 | $last_plugin = array_pop( $linked_plugins ); // Pop off last name to prep for readability. |
1121 | - $imploded = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
1121 | + $imploded = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); |
|
1122 | 1122 | |
1123 | 1123 | $rendered .= sprintf( |
1124 | 1124 | $line_template, |
@@ -1130,7 +1130,7 @@ discard block |
||
1130 | 1130 | ); |
1131 | 1131 | |
1132 | 1132 | if ( 0 === strpos( $type, 'notice_cannot' ) ) { |
1133 | - $rendered .= $this->strings['contact_admin']; |
|
1133 | + $rendered .= $this->strings[ 'contact_admin' ]; |
|
1134 | 1134 | } |
1135 | 1135 | } |
1136 | 1136 | unset( $type, $plugin_group, $linked_plugins, $count, $last_plugin, $imploded ); |
@@ -1140,32 +1140,32 @@ discard block |
||
1140 | 1140 | 'install' => '', |
1141 | 1141 | 'update' => '', |
1142 | 1142 | 'activate' => '', |
1143 | - '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>' : '', |
|
1143 | + '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>' : '', |
|
1144 | 1144 | ); |
1145 | 1145 | |
1146 | 1146 | $link_template = '<a href="%2$s">%1$s</a>'; |
1147 | 1147 | |
1148 | 1148 | if ( current_user_can( 'install_plugins' ) ) { |
1149 | 1149 | if ( $install_link_count > 0 ) { |
1150 | - $action_links['install'] = sprintf( |
|
1150 | + $action_links[ 'install' ] = sprintf( |
|
1151 | 1151 | $link_template, |
1152 | - translate_nooped_plural( $this->strings['install_link'], $install_link_count, 'tgmpa' ), |
|
1152 | + translate_nooped_plural( $this->strings[ 'install_link' ], $install_link_count, 'tgmpa' ), |
|
1153 | 1153 | esc_url( $this->get_tgmpa_status_url( 'install' ) ) |
1154 | 1154 | ); |
1155 | 1155 | } |
1156 | 1156 | if ( $update_link_count > 0 ) { |
1157 | - $action_links['update'] = sprintf( |
|
1157 | + $action_links[ 'update' ] = sprintf( |
|
1158 | 1158 | $link_template, |
1159 | - translate_nooped_plural( $this->strings['update_link'], $update_link_count, 'tgmpa' ), |
|
1159 | + translate_nooped_plural( $this->strings[ 'update_link' ], $update_link_count, 'tgmpa' ), |
|
1160 | 1160 | esc_url( $this->get_tgmpa_status_url( 'update' ) ) |
1161 | 1161 | ); |
1162 | 1162 | } |
1163 | 1163 | } |
1164 | 1164 | |
1165 | 1165 | if ( current_user_can( 'activate_plugins' ) && $activate_link_count > 0 ) { |
1166 | - $action_links['activate'] = sprintf( |
|
1166 | + $action_links[ 'activate' ] = sprintf( |
|
1167 | 1167 | $link_template, |
1168 | - translate_nooped_plural( $this->strings['activate_link'], $activate_link_count, 'tgmpa' ), |
|
1168 | + translate_nooped_plural( $this->strings[ 'activate_link' ], $activate_link_count, 'tgmpa' ), |
|
1169 | 1169 | esc_url( $this->get_tgmpa_status_url( 'activate' ) ) |
1170 | 1170 | ); |
1171 | 1171 | } |
@@ -1180,8 +1180,8 @@ discard block |
||
1180 | 1180 | } |
1181 | 1181 | |
1182 | 1182 | // Register the nag messages and prepare them to be processed. |
1183 | - if ( ! empty( $this->strings['nag_type'] ) ) { |
|
1184 | - add_settings_error( 'tgmpa', 'tgmpa', $rendered, sanitize_html_class( strtolower( $this->strings['nag_type'] ) ) ); |
|
1183 | + if ( ! empty( $this->strings[ 'nag_type' ] ) ) { |
|
1184 | + add_settings_error( 'tgmpa', 'tgmpa', $rendered, sanitize_html_class( strtolower( $this->strings[ 'nag_type' ] ) ) ); |
|
1185 | 1185 | } else { |
1186 | 1186 | $nag_class = version_compare( $this->wp_version, '3.8', '<' ) ? 'updated' : 'notice-warning'; |
1187 | 1187 | add_settings_error( 'tgmpa', 'tgmpa', $rendered, $nag_class ); |
@@ -1189,7 +1189,7 @@ discard block |
||
1189 | 1189 | } |
1190 | 1190 | |
1191 | 1191 | // Admin options pages already output settings_errors, so this is to avoid duplication. |
1192 | - if ( 'options-general' !== $GLOBALS['current_screen']->parent_base ) { |
|
1192 | + if ( 'options-general' !== $GLOBALS[ 'current_screen' ]->parent_base ) { |
|
1193 | 1193 | $this->display_settings_errors(); |
1194 | 1194 | } |
1195 | 1195 | } |
@@ -1205,7 +1205,7 @@ discard block |
||
1205 | 1205 | settings_errors( 'tgmpa' ); |
1206 | 1206 | |
1207 | 1207 | foreach ( (array) $wp_settings_errors as $key => $details ) { |
1208 | - if ( 'tgmpa' === $details['setting'] ) { |
|
1208 | + if ( 'tgmpa' === $details[ 'setting' ] ) { |
|
1209 | 1209 | unset( $wp_settings_errors[ $key ] ); |
1210 | 1210 | break; |
1211 | 1211 | } |
@@ -1220,8 +1220,8 @@ discard block |
||
1220 | 1220 | * @since 2.1.0 |
1221 | 1221 | */ |
1222 | 1222 | public function dismiss() { |
1223 | - if ( isset( $_GET['tgmpa-dismiss'] ) ) { |
|
1224 | - update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, 1 ); |
|
1223 | + if ( isset( $_GET[ 'tgmpa-dismiss' ] ) ) { |
|
1224 | + update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, 1 ); |
|
1225 | 1225 | } |
1226 | 1226 | } |
1227 | 1227 | |
@@ -1237,54 +1237,54 @@ discard block |
||
1237 | 1237 | * @return null Return early if incorrect argument. |
1238 | 1238 | */ |
1239 | 1239 | public function register( $plugin ) { |
1240 | - if ( empty( $plugin['slug'] ) || empty( $plugin['name'] ) ) { |
|
1240 | + if ( empty( $plugin[ 'slug' ] ) || empty( $plugin[ 'name' ] ) ) { |
|
1241 | 1241 | return; |
1242 | 1242 | } |
1243 | 1243 | |
1244 | - if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) { |
|
1244 | + if ( empty( $plugin[ 'slug' ] ) || ! is_string( $plugin[ 'slug' ] ) || isset( $this->plugins[ $plugin[ 'slug' ] ] ) ) { |
|
1245 | 1245 | return; |
1246 | 1246 | } |
1247 | 1247 | |
1248 | 1248 | $defaults = array( |
1249 | - 'name' => '', // String |
|
1250 | - 'slug' => '', // String |
|
1251 | - 'source' => 'repo', // String |
|
1252 | - 'required' => false, // Boolean |
|
1253 | - 'version' => '', // String |
|
1254 | - 'force_activation' => false, // Boolean |
|
1255 | - 'force_deactivation' => false, // Boolean |
|
1256 | - 'external_url' => '', // String |
|
1257 | - 'is_callable' => '', // String|Array. |
|
1249 | + 'name' => '', // String |
|
1250 | + 'slug' => '', // String |
|
1251 | + 'source' => 'repo', // String |
|
1252 | + 'required' => false, // Boolean |
|
1253 | + 'version' => '', // String |
|
1254 | + 'force_activation' => false, // Boolean |
|
1255 | + 'force_deactivation' => false, // Boolean |
|
1256 | + 'external_url' => '', // String |
|
1257 | + 'is_callable' => '', // String|Array. |
|
1258 | 1258 | ); |
1259 | 1259 | |
1260 | 1260 | // Prepare the received data. |
1261 | 1261 | $plugin = wp_parse_args( $plugin, $defaults ); |
1262 | 1262 | |
1263 | 1263 | // Standardize the received slug. |
1264 | - $plugin['slug'] = $this->sanitize_key( $plugin['slug'] ); |
|
1264 | + $plugin[ 'slug' ] = $this->sanitize_key( $plugin[ 'slug' ] ); |
|
1265 | 1265 | |
1266 | 1266 | // Forgive users for using string versions of booleans or floats for version number. |
1267 | - $plugin['version'] = (string) $plugin['version']; |
|
1268 | - $plugin['source'] = empty( $plugin['source'] ) ? 'repo' : $plugin['source']; |
|
1269 | - $plugin['required'] = TGMPA_Utils::validate_bool( $plugin['required'] ); |
|
1270 | - $plugin['force_activation'] = TGMPA_Utils::validate_bool( $plugin['force_activation'] ); |
|
1271 | - $plugin['force_deactivation'] = TGMPA_Utils::validate_bool( $plugin['force_deactivation'] ); |
|
1267 | + $plugin[ 'version' ] = (string) $plugin[ 'version' ]; |
|
1268 | + $plugin[ 'source' ] = empty( $plugin[ 'source' ] ) ? 'repo' : $plugin[ 'source' ]; |
|
1269 | + $plugin[ 'required' ] = TGMPA_Utils::validate_bool( $plugin[ 'required' ] ); |
|
1270 | + $plugin[ 'force_activation' ] = TGMPA_Utils::validate_bool( $plugin[ 'force_activation' ] ); |
|
1271 | + $plugin[ 'force_deactivation' ] = TGMPA_Utils::validate_bool( $plugin[ 'force_deactivation' ] ); |
|
1272 | 1272 | |
1273 | 1273 | // Enrich the received data. |
1274 | - $plugin['file_path'] = $this->_get_plugin_basename_from_slug( $plugin['slug'] ); |
|
1275 | - $plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] ); |
|
1274 | + $plugin[ 'file_path' ] = $this->_get_plugin_basename_from_slug( $plugin[ 'slug' ] ); |
|
1275 | + $plugin[ 'source_type' ] = $this->get_plugin_source_type( $plugin[ 'source' ] ); |
|
1276 | 1276 | |
1277 | 1277 | // Set the class properties. |
1278 | - $this->plugins[ $plugin['slug'] ] = $plugin; |
|
1279 | - $this->sort_order[ $plugin['slug'] ] = $plugin['name']; |
|
1278 | + $this->plugins[ $plugin[ 'slug' ] ] = $plugin; |
|
1279 | + $this->sort_order[ $plugin[ 'slug' ] ] = $plugin[ 'name' ]; |
|
1280 | 1280 | |
1281 | 1281 | // Should we add the force activation hook ? |
1282 | - if ( true === $plugin['force_activation'] ) { |
|
1282 | + if ( true === $plugin[ 'force_activation' ] ) { |
|
1283 | 1283 | $this->has_forced_activation = true; |
1284 | 1284 | } |
1285 | 1285 | |
1286 | 1286 | // Should we add the force deactivation hook ? |
1287 | - if ( true === $plugin['force_deactivation'] ) { |
|
1287 | + if ( true === $plugin[ 'force_deactivation' ] ) { |
|
1288 | 1288 | $this->has_forced_deactivation = true; |
1289 | 1289 | } |
1290 | 1290 | } |
@@ -1410,11 +1410,11 @@ discard block |
||
1410 | 1410 | */ |
1411 | 1411 | public function populate_file_path( $plugin_slug = '' ) { |
1412 | 1412 | if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) { |
1413 | - $this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
1413 | + $this->plugins[ $plugin_slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
1414 | 1414 | } else { |
1415 | 1415 | // Add file_path key for all plugins. |
1416 | 1416 | foreach ( $this->plugins as $slug => $values ) { |
1417 | - $this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug ); |
|
1417 | + $this->plugins[ $slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $slug ); |
|
1418 | 1418 | } |
1419 | 1419 | } |
1420 | 1420 | } |
@@ -1432,7 +1432,7 @@ discard block |
||
1432 | 1432 | $keys = array_keys( $this->get_plugins() ); |
1433 | 1433 | |
1434 | 1434 | foreach ( $keys as $key ) { |
1435 | - if ( preg_match( '|^' . $slug . '/|', $key ) ) { |
|
1435 | + if ( preg_match( '|^'.$slug.'/|', $key ) ) { |
|
1436 | 1436 | return $key; |
1437 | 1437 | } |
1438 | 1438 | } |
@@ -1454,7 +1454,7 @@ discard block |
||
1454 | 1454 | */ |
1455 | 1455 | public function _get_plugin_data_from_name( $name, $data = 'slug' ) { |
1456 | 1456 | foreach ( $this->plugins as $values ) { |
1457 | - if ( $name === $values['name'] && isset( $values[ $data ] ) ) { |
|
1457 | + if ( $name === $values[ 'name' ] && isset( $values[ $data ] ) ) { |
|
1458 | 1458 | return $values[ $data ]; |
1459 | 1459 | } |
1460 | 1460 | } |
@@ -1473,13 +1473,13 @@ discard block |
||
1473 | 1473 | public function get_download_url( $slug ) { |
1474 | 1474 | $dl_source = ''; |
1475 | 1475 | |
1476 | - switch ( $this->plugins[ $slug ]['source_type'] ) { |
|
1476 | + switch ( $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1477 | 1477 | case 'repo': |
1478 | 1478 | return $this->get_wp_repo_download_url( $slug ); |
1479 | 1479 | case 'external': |
1480 | - return $this->plugins[ $slug ]['source']; |
|
1480 | + return $this->plugins[ $slug ][ 'source' ]; |
|
1481 | 1481 | case 'bundled': |
1482 | - return $this->default_path . $this->plugins[ $slug ]['source']; |
|
1482 | + return $this->default_path.$this->plugins[ $slug ][ 'source' ]; |
|
1483 | 1483 | } |
1484 | 1484 | |
1485 | 1485 | return $dl_source; // Should never happen. |
@@ -1517,7 +1517,7 @@ discard block |
||
1517 | 1517 | |
1518 | 1518 | if ( ! isset( $api[ $slug ] ) ) { |
1519 | 1519 | if ( ! function_exists( 'plugins_api' ) ) { |
1520 | - require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
|
1520 | + require_once ABSPATH.'wp-admin/includes/plugin-install.php'; |
|
1521 | 1521 | } |
1522 | 1522 | |
1523 | 1523 | $response = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ) ) ); |
@@ -1525,7 +1525,7 @@ discard block |
||
1525 | 1525 | $api[ $slug ] = false; |
1526 | 1526 | |
1527 | 1527 | if ( is_wp_error( $response ) ) { |
1528 | - wp_die( esc_html( $this->strings['oops'] ) ); |
|
1528 | + wp_die( esc_html( $this->strings[ 'oops' ] ) ); |
|
1529 | 1529 | } else { |
1530 | 1530 | $api[ $slug ] = $response; |
1531 | 1531 | } |
@@ -1544,13 +1544,13 @@ discard block |
||
1544 | 1544 | * or the plugin name if not. |
1545 | 1545 | */ |
1546 | 1546 | public function get_info_link( $slug ) { |
1547 | - if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) { |
|
1547 | + if ( ! empty( $this->plugins[ $slug ][ 'external_url' ] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ][ 'external_url' ] ) ) { |
|
1548 | 1548 | $link = sprintf( |
1549 | 1549 | '<a href="%1$s" target="_blank">%2$s</a>', |
1550 | - esc_url( $this->plugins[ $slug ]['external_url'] ), |
|
1551 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
1550 | + esc_url( $this->plugins[ $slug ][ 'external_url' ] ), |
|
1551 | + esc_html( $this->plugins[ $slug ][ 'name' ] ) |
|
1552 | 1552 | ); |
1553 | - } elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) { |
|
1553 | + } elseif ( 'repo' === $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1554 | 1554 | $url = add_query_arg( |
1555 | 1555 | array( |
1556 | 1556 | 'tab' => 'plugin-information', |
@@ -1565,10 +1565,10 @@ discard block |
||
1565 | 1565 | $link = sprintf( |
1566 | 1566 | '<a href="%1$s" class="thickbox">%2$s</a>', |
1567 | 1567 | esc_url( $url ), |
1568 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
1568 | + esc_html( $this->plugins[ $slug ][ 'name' ] ) |
|
1569 | 1569 | ); |
1570 | 1570 | } else { |
1571 | - $link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink. |
|
1571 | + $link = esc_html( $this->plugins[ $slug ][ 'name' ] ); // No hyperlink. |
|
1572 | 1572 | } |
1573 | 1573 | |
1574 | 1574 | return $link; |
@@ -1582,7 +1582,7 @@ discard block |
||
1582 | 1582 | * @return boolean True when on the TGMPA page, false otherwise. |
1583 | 1583 | */ |
1584 | 1584 | protected function is_tgmpa_page() { |
1585 | - return isset( $_GET['page'] ) && $this->menu === $_GET['page']; |
|
1585 | + return isset( $_GET[ 'page' ] ) && $this->menu === $_GET[ 'page' ]; |
|
1586 | 1586 | } |
1587 | 1587 | |
1588 | 1588 | /** |
@@ -1664,7 +1664,7 @@ discard block |
||
1664 | 1664 | public function is_plugin_installed( $slug ) { |
1665 | 1665 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
1666 | 1666 | |
1667 | - return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) ); |
|
1667 | + return ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ] ) ); |
|
1668 | 1668 | } |
1669 | 1669 | |
1670 | 1670 | /** |
@@ -1676,7 +1676,7 @@ discard block |
||
1676 | 1676 | * @return bool True if active, false otherwise. |
1677 | 1677 | */ |
1678 | 1678 | public function is_plugin_active( $slug ) { |
1679 | - return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) ); |
|
1679 | + return ( ( ! empty( $this->plugins[ $slug ][ 'is_callable' ] ) && is_callable( $this->plugins[ $slug ][ 'is_callable' ] ) ) || is_plugin_active( $this->plugins[ $slug ][ 'file_path' ] ) ); |
|
1680 | 1680 | } |
1681 | 1681 | |
1682 | 1682 | /** |
@@ -1690,14 +1690,14 @@ discard block |
||
1690 | 1690 | */ |
1691 | 1691 | public function can_plugin_update( $slug ) { |
1692 | 1692 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
1693 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1693 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1694 | 1694 | return true; |
1695 | 1695 | } |
1696 | 1696 | |
1697 | 1697 | $api = $this->get_plugins_api( $slug ); |
1698 | 1698 | |
1699 | 1699 | if ( false !== $api && isset( $api->requires ) ) { |
1700 | - return version_compare( $GLOBALS['wp_version'], $api->requires, '>=' ); |
|
1700 | + return version_compare( $GLOBALS[ 'wp_version' ], $api->requires, '>=' ); |
|
1701 | 1701 | } |
1702 | 1702 | |
1703 | 1703 | // No usable info received from the plugins API, presume we can update. |
@@ -1729,8 +1729,8 @@ discard block |
||
1729 | 1729 | public function get_installed_version( $slug ) { |
1730 | 1730 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
1731 | 1731 | |
1732 | - if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) { |
|
1733 | - return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version']; |
|
1732 | + if ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ] ) ) { |
|
1733 | + return $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ]; |
|
1734 | 1734 | } |
1735 | 1735 | |
1736 | 1736 | return ''; |
@@ -1746,7 +1746,7 @@ discard block |
||
1746 | 1746 | */ |
1747 | 1747 | public function does_plugin_require_update( $slug ) { |
1748 | 1748 | $installed_version = $this->get_installed_version( $slug ); |
1749 | - $minimum_version = $this->plugins[ $slug ]['version']; |
|
1749 | + $minimum_version = $this->plugins[ $slug ][ 'version' ]; |
|
1750 | 1750 | |
1751 | 1751 | return version_compare( $minimum_version, $installed_version, '>' ); |
1752 | 1752 | } |
@@ -1761,9 +1761,9 @@ discard block |
||
1761 | 1761 | */ |
1762 | 1762 | public function does_plugin_have_update( $slug ) { |
1763 | 1763 | // Presume bundled and external plugins will point to a package which meets the minimum required version. |
1764 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1764 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1765 | 1765 | if ( $this->does_plugin_require_update( $slug ) ) { |
1766 | - return $this->plugins[ $slug ]['version']; |
|
1766 | + return $this->plugins[ $slug ][ 'version' ]; |
|
1767 | 1767 | } |
1768 | 1768 | |
1769 | 1769 | return false; |
@@ -1771,8 +1771,8 @@ discard block |
||
1771 | 1771 | |
1772 | 1772 | $repo_updates = get_site_transient( 'update_plugins' ); |
1773 | 1773 | |
1774 | - if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) { |
|
1775 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version; |
|
1774 | + if ( isset( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version ) ) { |
|
1775 | + return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version; |
|
1776 | 1776 | } |
1777 | 1777 | |
1778 | 1778 | return false; |
@@ -1788,14 +1788,14 @@ discard block |
||
1788 | 1788 | */ |
1789 | 1789 | public function get_upgrade_notice( $slug ) { |
1790 | 1790 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
1791 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1791 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
1792 | 1792 | return ''; |
1793 | 1793 | } |
1794 | 1794 | |
1795 | 1795 | $repo_updates = get_site_transient( 'update_plugins' ); |
1796 | 1796 | |
1797 | - if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) { |
|
1798 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice; |
|
1797 | + if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice ) ) { |
|
1798 | + return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice; |
|
1799 | 1799 | } |
1800 | 1800 | |
1801 | 1801 | return ''; |
@@ -1811,7 +1811,7 @@ discard block |
||
1811 | 1811 | */ |
1812 | 1812 | public function get_plugins( $plugin_folder = '' ) { |
1813 | 1813 | if ( ! function_exists( 'get_plugins' ) ) { |
1814 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
1814 | + require_once ABSPATH.'wp-admin/includes/plugin.php'; |
|
1815 | 1815 | } |
1816 | 1816 | |
1817 | 1817 | return get_plugins( $plugin_folder ); |
@@ -1826,7 +1826,7 @@ discard block |
||
1826 | 1826 | * @since 2.1.1 |
1827 | 1827 | */ |
1828 | 1828 | public function update_dismiss() { |
1829 | - delete_metadata( 'user', null, 'tgmpa_dismissed_notice_' . $this->id, null, true ); |
|
1829 | + delete_metadata( 'user', null, 'tgmpa_dismissed_notice_'.$this->id, null, true ); |
|
1830 | 1830 | } |
1831 | 1831 | |
1832 | 1832 | /** |
@@ -1845,13 +1845,13 @@ discard block |
||
1845 | 1845 | */ |
1846 | 1846 | public function force_activation() { |
1847 | 1847 | foreach ( $this->plugins as $slug => $plugin ) { |
1848 | - if ( true === $plugin['force_activation'] ) { |
|
1848 | + if ( true === $plugin[ 'force_activation' ] ) { |
|
1849 | 1849 | if ( ! $this->is_plugin_installed( $slug ) ) { |
1850 | 1850 | // Oops, plugin isn't there so iterate to next condition. |
1851 | 1851 | continue; |
1852 | 1852 | } elseif ( $this->can_plugin_activate( $slug ) ) { |
1853 | 1853 | // There we go, activate the plugin. |
1854 | - activate_plugin( $plugin['file_path'] ); |
|
1854 | + activate_plugin( $plugin[ 'file_path' ] ); |
|
1855 | 1855 | } |
1856 | 1856 | } |
1857 | 1857 | } |
@@ -1872,8 +1872,8 @@ discard block |
||
1872 | 1872 | public function force_deactivation() { |
1873 | 1873 | foreach ( $this->plugins as $slug => $plugin ) { |
1874 | 1874 | // Only proceed forward if the parameter is set to true and plugin is active. |
1875 | - if ( true === $plugin['force_deactivation'] && $this->is_plugin_active( $slug ) ) { |
|
1876 | - deactivate_plugins( $plugin['file_path'] ); |
|
1875 | + if ( true === $plugin[ 'force_deactivation' ] && $this->is_plugin_active( $slug ) ) { |
|
1876 | + deactivate_plugins( $plugin[ 'file_path' ] ); |
|
1877 | 1877 | } |
1878 | 1878 | } |
1879 | 1879 | } |
@@ -1908,7 +1908,7 @@ discard block |
||
1908 | 1908 | * Ensure only one instance of the class is ever invoked. |
1909 | 1909 | */ |
1910 | 1910 | function load_tgm_plugin_activation() { |
1911 | - $GLOBALS['tgmpa'] = TGM_Plugin_Activation::get_instance(); |
|
1911 | + $GLOBALS[ 'tgmpa' ] = TGM_Plugin_Activation::get_instance(); |
|
1912 | 1912 | } |
1913 | 1913 | } |
1914 | 1914 | |
@@ -1930,7 +1930,7 @@ discard block |
||
1930 | 1930 | * @param array $config Optional. An array of configuration values. |
1931 | 1931 | */ |
1932 | 1932 | function tgmpa( $plugins, $config = array() ) { |
1933 | - $instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
1933 | + $instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
1934 | 1934 | |
1935 | 1935 | foreach ( $plugins as $plugin ) { |
1936 | 1936 | call_user_func( array( $instance, 'register' ), $plugin ); |
@@ -1938,17 +1938,17 @@ discard block |
||
1938 | 1938 | |
1939 | 1939 | if ( ! empty( $config ) && is_array( $config ) ) { |
1940 | 1940 | // Send out notices for deprecated arguments passed. |
1941 | - if ( isset( $config['notices'] ) ) { |
|
1941 | + if ( isset( $config[ 'notices' ] ) ) { |
|
1942 | 1942 | _deprecated_argument( __FUNCTION__, '2.2.0', 'The `notices` config parameter was renamed to `has_notices` in TGMPA 2.2.0. Please adjust your configuration.' ); |
1943 | - if ( ! isset( $config['has_notices'] ) ) { |
|
1944 | - $config['has_notices'] = $config['notices']; |
|
1943 | + if ( ! isset( $config[ 'has_notices' ] ) ) { |
|
1944 | + $config[ 'has_notices' ] = $config[ 'notices' ]; |
|
1945 | 1945 | } |
1946 | 1946 | } |
1947 | 1947 | |
1948 | - if ( isset( $config['parent_menu_slug'] ) ) { |
|
1948 | + if ( isset( $config[ 'parent_menu_slug' ] ) ) { |
|
1949 | 1949 | _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.' ); |
1950 | 1950 | } |
1951 | - if ( isset( $config['parent_url_slug'] ) ) { |
|
1951 | + if ( isset( $config[ 'parent_url_slug' ] ) ) { |
|
1952 | 1952 | _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.' ); |
1953 | 1953 | } |
1954 | 1954 | |
@@ -1964,7 +1964,7 @@ discard block |
||
1964 | 1964 | * @since 2.2.0 |
1965 | 1965 | */ |
1966 | 1966 | if ( ! class_exists( 'WP_List_Table' ) ) { |
1967 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
1967 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
1968 | 1968 | } |
1969 | 1969 | |
1970 | 1970 | if ( ! class_exists( 'TGMPA_List_Table' ) ) { |
@@ -2025,7 +2025,7 @@ discard block |
||
2025 | 2025 | * @since 2.2.0 |
2026 | 2026 | */ |
2027 | 2027 | public function __construct() { |
2028 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
2028 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
2029 | 2029 | |
2030 | 2030 | parent::__construct( |
2031 | 2031 | array( |
@@ -2035,8 +2035,8 @@ discard block |
||
2035 | 2035 | ) |
2036 | 2036 | ); |
2037 | 2037 | |
2038 | - if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'install', 'update', 'activate' ), true ) ) { |
|
2039 | - $this->view_context = sanitize_key( $_REQUEST['plugin_status'] ); |
|
2038 | + if ( isset( $_REQUEST[ 'plugin_status' ] ) && in_array( $_REQUEST[ 'plugin_status' ], array( 'install', 'update', 'activate' ), true ) ) { |
|
2039 | + $this->view_context = sanitize_key( $_REQUEST[ 'plugin_status' ] ); |
|
2040 | 2040 | } |
2041 | 2041 | |
2042 | 2042 | add_filter( 'tgmpa_table_data_items', array( $this, 'sort_table_items' ) ); |
@@ -2083,20 +2083,20 @@ discard block |
||
2083 | 2083 | } |
2084 | 2084 | |
2085 | 2085 | foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) { |
2086 | - $table_data[ $i ]['sanitized_plugin'] = $plugin['name']; |
|
2087 | - $table_data[ $i ]['slug'] = $slug; |
|
2088 | - $table_data[ $i ]['plugin'] = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>'; |
|
2089 | - $table_data[ $i ]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] ); |
|
2090 | - $table_data[ $i ]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] ); |
|
2091 | - $table_data[ $i ]['status'] = $this->get_plugin_status_text( $slug ); |
|
2092 | - $table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug ); |
|
2093 | - $table_data[ $i ]['minimum_version'] = $plugin['version']; |
|
2094 | - $table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2086 | + $table_data[ $i ][ 'sanitized_plugin' ] = $plugin[ 'name' ]; |
|
2087 | + $table_data[ $i ][ 'slug' ] = $slug; |
|
2088 | + $table_data[ $i ][ 'plugin' ] = '<strong>'.$this->tgmpa->get_info_link( $slug ).'</strong>'; |
|
2089 | + $table_data[ $i ][ 'source' ] = $this->get_plugin_source_type_text( $plugin[ 'source_type' ] ); |
|
2090 | + $table_data[ $i ][ 'type' ] = $this->get_plugin_advise_type_text( $plugin[ 'required' ] ); |
|
2091 | + $table_data[ $i ][ 'status' ] = $this->get_plugin_status_text( $slug ); |
|
2092 | + $table_data[ $i ][ 'installed_version' ] = $this->tgmpa->get_installed_version( $slug ); |
|
2093 | + $table_data[ $i ][ 'minimum_version' ] = $plugin[ 'version' ]; |
|
2094 | + $table_data[ $i ][ 'available_version' ] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2095 | 2095 | |
2096 | 2096 | // Prep the upgrade notice info. |
2097 | 2097 | $upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug ); |
2098 | 2098 | if ( ! empty( $upgrade_notice ) ) { |
2099 | - $table_data[ $i ]['upgrade_notice'] = $upgrade_notice; |
|
2099 | + $table_data[ $i ][ 'upgrade_notice' ] = $upgrade_notice; |
|
2100 | 2100 | |
2101 | 2101 | add_action( "tgmpa_after_plugin_row_$slug", array( $this, 'wp_plugin_update_row' ), 10, 2 ); |
2102 | 2102 | } |
@@ -2127,17 +2127,17 @@ discard block |
||
2127 | 2127 | // No need to display plugins if they are installed, up-to-date and active. |
2128 | 2128 | continue; |
2129 | 2129 | } else { |
2130 | - $plugins['all'][ $slug ] = $plugin; |
|
2130 | + $plugins[ 'all' ][ $slug ] = $plugin; |
|
2131 | 2131 | |
2132 | 2132 | if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) { |
2133 | - $plugins['install'][ $slug ] = $plugin; |
|
2133 | + $plugins[ 'install' ][ $slug ] = $plugin; |
|
2134 | 2134 | } else { |
2135 | 2135 | if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) { |
2136 | - $plugins['update'][ $slug ] = $plugin; |
|
2136 | + $plugins[ 'update' ][ $slug ] = $plugin; |
|
2137 | 2137 | } |
2138 | 2138 | |
2139 | 2139 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
2140 | - $plugins['activate'][ $slug ] = $plugin; |
|
2140 | + $plugins[ 'activate' ][ $slug ] = $plugin; |
|
2141 | 2141 | } |
2142 | 2142 | } |
2143 | 2143 | } |
@@ -2256,8 +2256,8 @@ discard block |
||
2256 | 2256 | $name = array(); |
2257 | 2257 | |
2258 | 2258 | foreach ( $items as $i => $plugin ) { |
2259 | - $type[ $i ] = $plugin['type']; // Required / recommended. |
|
2260 | - $name[ $i ] = $plugin['sanitized_plugin']; |
|
2259 | + $type[ $i ] = $plugin[ 'type' ]; // Required / recommended. |
|
2260 | + $name[ $i ] = $plugin[ 'sanitized_plugin' ]; |
|
2261 | 2261 | } |
2262 | 2262 | |
2263 | 2263 | array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items ); |
@@ -2339,9 +2339,9 @@ discard block |
||
2339 | 2339 | public function column_cb( $item ) { |
2340 | 2340 | return sprintf( |
2341 | 2341 | '<input type="checkbox" name="%1$s[]" value="%2$s" id="%3$s" />', |
2342 | - esc_attr( $this->_args['singular'] ), |
|
2343 | - esc_attr( $item['slug'] ), |
|
2344 | - esc_attr( $item['sanitized_plugin'] ) |
|
2342 | + esc_attr( $this->_args[ 'singular' ] ), |
|
2343 | + esc_attr( $item[ 'slug' ] ), |
|
2344 | + esc_attr( $item[ 'sanitized_plugin' ] ) |
|
2345 | 2345 | ); |
2346 | 2346 | } |
2347 | 2347 | |
@@ -2356,7 +2356,7 @@ discard block |
||
2356 | 2356 | public function column_plugin( $item ) { |
2357 | 2357 | return sprintf( |
2358 | 2358 | '%1$s %2$s', |
2359 | - $item['plugin'], |
|
2359 | + $item[ 'plugin' ], |
|
2360 | 2360 | $this->row_actions( $this->get_row_actions( $item ), true ) |
2361 | 2361 | ); |
2362 | 2362 | } |
@@ -2372,38 +2372,38 @@ discard block |
||
2372 | 2372 | public function column_version( $item ) { |
2373 | 2373 | $output = array(); |
2374 | 2374 | |
2375 | - if ( $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
2376 | - $installed = ! empty( $item['installed_version'] ) ? $item['installed_version'] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
2375 | + if ( $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
2376 | + $installed = ! empty( $item[ 'installed_version' ] ) ? $item[ 'installed_version' ] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
2377 | 2377 | |
2378 | 2378 | $color = ''; |
2379 | - if ( ! empty( $item['minimum_version'] ) && $this->tgmpa->does_plugin_require_update( $item['slug'] ) ) { |
|
2379 | + if ( ! empty( $item[ 'minimum_version' ] ) && $this->tgmpa->does_plugin_require_update( $item[ 'slug' ] ) ) { |
|
2380 | 2380 | $color = ' color: #ff0000; font-weight: bold;'; |
2381 | 2381 | } |
2382 | 2382 | |
2383 | - $output[] = sprintf( |
|
2384 | - '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Installed version:', 'tgmpa' ) . '</p>', |
|
2383 | + $output[ ] = sprintf( |
|
2384 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Installed version:', 'tgmpa' ).'</p>', |
|
2385 | 2385 | $color, |
2386 | 2386 | $installed |
2387 | 2387 | ); |
2388 | 2388 | } |
2389 | 2389 | |
2390 | - if ( ! empty( $item['minimum_version'] ) ) { |
|
2391 | - $output[] = sprintf( |
|
2392 | - '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>' . __( 'Minimum required version:', 'tgmpa' ) . '</p>', |
|
2393 | - $item['minimum_version'] |
|
2390 | + if ( ! empty( $item[ 'minimum_version' ] ) ) { |
|
2391 | + $output[ ] = sprintf( |
|
2392 | + '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>'.__( 'Minimum required version:', 'tgmpa' ).'</p>', |
|
2393 | + $item[ 'minimum_version' ] |
|
2394 | 2394 | ); |
2395 | 2395 | } |
2396 | 2396 | |
2397 | - if ( ! empty( $item['available_version'] ) ) { |
|
2397 | + if ( ! empty( $item[ 'available_version' ] ) ) { |
|
2398 | 2398 | $color = ''; |
2399 | - if ( ! empty( $item['minimum_version'] ) && version_compare( $item['available_version'], $item['minimum_version'], '>=' ) ) { |
|
2399 | + if ( ! empty( $item[ 'minimum_version' ] ) && version_compare( $item[ 'available_version' ], $item[ 'minimum_version' ], '>=' ) ) { |
|
2400 | 2400 | $color = ' color: #71C671; font-weight: bold;'; |
2401 | 2401 | } |
2402 | 2402 | |
2403 | - $output[] = sprintf( |
|
2404 | - '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Available version:', 'tgmpa' ) . '</p>', |
|
2403 | + $output[ ] = sprintf( |
|
2404 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Available version:', 'tgmpa' ).'</p>', |
|
2405 | 2405 | $color, |
2406 | - $item['available_version'] |
|
2406 | + $item[ 'available_version' ] |
|
2407 | 2407 | ); |
2408 | 2408 | } |
2409 | 2409 | |
@@ -2444,8 +2444,8 @@ discard block |
||
2444 | 2444 | ); |
2445 | 2445 | |
2446 | 2446 | if ( 'all' === $this->view_context || 'update' === $this->view_context ) { |
2447 | - $columns['version'] = __( 'Version', 'tgmpa' ); |
|
2448 | - $columns['status'] = __( 'Status', 'tgmpa' ); |
|
2447 | + $columns[ 'version' ] = __( 'Version', 'tgmpa' ); |
|
2448 | + $columns[ 'status' ] = __( 'Status', 'tgmpa' ); |
|
2449 | 2449 | } |
2450 | 2450 | |
2451 | 2451 | return apply_filters( 'tgmpa_table_columns', $columns ); |
@@ -2492,17 +2492,17 @@ discard block |
||
2492 | 2492 | $action_links = array(); |
2493 | 2493 | |
2494 | 2494 | // Display the 'Install' action link if the plugin is not yet available. |
2495 | - if ( ! $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
2496 | - $actions['install'] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2495 | + if ( ! $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
2496 | + $actions[ 'install' ] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2497 | 2497 | } else { |
2498 | 2498 | // Display the 'Update' action link if an update is available and WP complies with plugin minimum. |
2499 | - if ( false !== $this->tgmpa->does_plugin_have_update( $item['slug'] ) && $this->tgmpa->can_plugin_update( $item['slug'] ) ) { |
|
2500 | - $actions['update'] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2499 | + if ( false !== $this->tgmpa->does_plugin_have_update( $item[ 'slug' ] ) && $this->tgmpa->can_plugin_update( $item[ 'slug' ] ) ) { |
|
2500 | + $actions[ 'update' ] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2501 | 2501 | } |
2502 | 2502 | |
2503 | 2503 | // Display the 'Activate' action link, but only if the plugin meets the minimum version. |
2504 | - if ( $this->tgmpa->can_plugin_activate( $item['slug'] ) ) { |
|
2505 | - $actions['activate'] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2504 | + if ( $this->tgmpa->can_plugin_activate( $item[ 'slug' ] ) ) { |
|
2505 | + $actions[ 'activate' ] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
2506 | 2506 | } |
2507 | 2507 | } |
2508 | 2508 | |
@@ -2511,24 +2511,24 @@ discard block |
||
2511 | 2511 | $nonce_url = wp_nonce_url( |
2512 | 2512 | add_query_arg( |
2513 | 2513 | array( |
2514 | - 'plugin' => urlencode( $item['slug'] ), |
|
2515 | - 'tgmpa-' . $action => $action . '-plugin', |
|
2514 | + 'plugin' => urlencode( $item[ 'slug' ] ), |
|
2515 | + 'tgmpa-'.$action => $action.'-plugin', |
|
2516 | 2516 | ), |
2517 | 2517 | $this->tgmpa->get_tgmpa_url() |
2518 | 2518 | ), |
2519 | - 'tgmpa-' . $action, |
|
2519 | + 'tgmpa-'.$action, |
|
2520 | 2520 | 'tgmpa-nonce' |
2521 | 2521 | ); |
2522 | 2522 | |
2523 | 2523 | $action_links[ $action ] = sprintf( |
2524 | - '<a href="%1$s">' . esc_html( $text ) . '</a>', |
|
2524 | + '<a href="%1$s">'.esc_html( $text ).'</a>', |
|
2525 | 2525 | esc_url( $nonce_url ), |
2526 | - '<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>' |
|
2526 | + '<span class="screen-reader-text">'.esc_html( $item[ 'sanitized_plugin' ] ).'</span>' |
|
2527 | 2527 | ); |
2528 | 2528 | } |
2529 | 2529 | |
2530 | 2530 | $prefix = ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) ? 'network_admin_' : ''; |
2531 | - return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item['slug'], $item, $this->view_context ); |
|
2531 | + return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item[ 'slug' ], $item, $this->view_context ); |
|
2532 | 2532 | } |
2533 | 2533 | |
2534 | 2534 | /** |
@@ -2549,7 +2549,7 @@ discard block |
||
2549 | 2549 | * |
2550 | 2550 | * @since 2.5.0 |
2551 | 2551 | */ |
2552 | - do_action( "tgmpa_after_plugin_row_{$item['slug']}", $item['slug'], $item, $this->view_context ); |
|
2552 | + do_action( "tgmpa_after_plugin_row_{$item[ 'slug' ]}", $item[ 'slug' ], $item, $this->view_context ); |
|
2553 | 2553 | } |
2554 | 2554 | |
2555 | 2555 | /** |
@@ -2564,7 +2564,7 @@ discard block |
||
2564 | 2564 | * @return null Return early if upgrade notice is empty. |
2565 | 2565 | */ |
2566 | 2566 | public function wp_plugin_update_row( $slug, $item ) { |
2567 | - if ( empty( $item['upgrade_notice'] ) ) { |
|
2567 | + if ( empty( $item[ 'upgrade_notice' ] ) ) { |
|
2568 | 2568 | return; |
2569 | 2569 | } |
2570 | 2570 | |
@@ -2573,7 +2573,7 @@ discard block |
||
2573 | 2573 | <td colspan="', absint( $this->get_column_count() ), '" class="plugin-update colspanchange"> |
2574 | 2574 | <div class="update-message">', |
2575 | 2575 | esc_html__( 'Upgrade message from the plugin author:', 'tgmpa' ), |
2576 | - ' <strong>', wp_kses_data( $item['upgrade_notice'] ), '</strong> |
|
2576 | + ' <strong>', wp_kses_data( $item[ 'upgrade_notice' ] ), '</strong> |
|
2577 | 2577 | </div> |
2578 | 2578 | </td> |
2579 | 2579 | </tr>'; |
@@ -2605,16 +2605,16 @@ discard block |
||
2605 | 2605 | |
2606 | 2606 | if ( 'update' !== $this->view_context && 'activate' !== $this->view_context ) { |
2607 | 2607 | if ( current_user_can( 'install_plugins' ) ) { |
2608 | - $actions['tgmpa-bulk-install'] = __( 'Install', 'tgmpa' ); |
|
2608 | + $actions[ 'tgmpa-bulk-install' ] = __( 'Install', 'tgmpa' ); |
|
2609 | 2609 | } |
2610 | 2610 | } |
2611 | 2611 | |
2612 | 2612 | if ( 'install' !== $this->view_context ) { |
2613 | 2613 | if ( current_user_can( 'update_plugins' ) ) { |
2614 | - $actions['tgmpa-bulk-update'] = __( 'Update', 'tgmpa' ); |
|
2614 | + $actions[ 'tgmpa-bulk-update' ] = __( 'Update', 'tgmpa' ); |
|
2615 | 2615 | } |
2616 | 2616 | if ( current_user_can( 'activate_plugins' ) ) { |
2617 | - $actions['tgmpa-bulk-activate'] = __( 'Activate', 'tgmpa' ); |
|
2617 | + $actions[ 'tgmpa-bulk-activate' ] = __( 'Activate', 'tgmpa' ); |
|
2618 | 2618 | } |
2619 | 2619 | } |
2620 | 2620 | |
@@ -2633,7 +2633,7 @@ discard block |
||
2633 | 2633 | // Bulk installation process. |
2634 | 2634 | if ( 'tgmpa-bulk-install' === $this->current_action() || 'tgmpa-bulk-update' === $this->current_action() ) { |
2635 | 2635 | |
2636 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
2636 | + check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2637 | 2637 | |
2638 | 2638 | $install_type = 'install'; |
2639 | 2639 | if ( 'tgmpa-bulk-update' === $this->current_action() ) { |
@@ -2643,7 +2643,7 @@ discard block |
||
2643 | 2643 | $plugins_to_install = array(); |
2644 | 2644 | |
2645 | 2645 | // Did user actually select any plugins to install/update ? |
2646 | - if ( empty( $_POST['plugin'] ) ) { |
|
2646 | + if ( empty( $_POST[ 'plugin' ] ) ) { |
|
2647 | 2647 | if ( 'install' === $install_type ) { |
2648 | 2648 | $message = __( 'No plugins were selected to be installed. No action taken.', 'tgmpa' ); |
2649 | 2649 | } else { |
@@ -2655,11 +2655,11 @@ discard block |
||
2655 | 2655 | return false; |
2656 | 2656 | } |
2657 | 2657 | |
2658 | - if ( is_array( $_POST['plugin'] ) ) { |
|
2659 | - $plugins_to_install = (array) $_POST['plugin']; |
|
2660 | - } elseif ( is_string( $_POST['plugin'] ) ) { |
|
2658 | + if ( is_array( $_POST[ 'plugin' ] ) ) { |
|
2659 | + $plugins_to_install = (array) $_POST[ 'plugin' ]; |
|
2660 | + } elseif ( is_string( $_POST[ 'plugin' ] ) ) { |
|
2661 | 2661 | // Received via Filesystem page - un-flatten array (WP bug #19643). |
2662 | - $plugins_to_install = explode( ',', $_POST['plugin'] ); |
|
2662 | + $plugins_to_install = explode( ',', $_POST[ 'plugin' ] ); |
|
2663 | 2663 | } |
2664 | 2664 | |
2665 | 2665 | // Sanitize the received input. |
@@ -2696,11 +2696,11 @@ discard block |
||
2696 | 2696 | // Pass all necessary information if WP_Filesystem is needed. |
2697 | 2697 | $url = wp_nonce_url( |
2698 | 2698 | $this->tgmpa->get_tgmpa_url(), |
2699 | - 'bulk-' . $this->_args['plural'] |
|
2699 | + 'bulk-'.$this->_args[ 'plural' ] |
|
2700 | 2700 | ); |
2701 | 2701 | |
2702 | 2702 | // Give validated data back to $_POST which is the only place the filesystem looks for extra fields. |
2703 | - $_POST['plugin'] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
2703 | + $_POST[ 'plugin' ] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
2704 | 2704 | |
2705 | 2705 | $method = ''; // Leave blank so WP_Filesystem can populate it as necessary. |
2706 | 2706 | $fields = array_keys( $_POST ); // Extra fields to pass to WP_Filesystem. |
@@ -2727,22 +2727,22 @@ discard block |
||
2727 | 2727 | |
2728 | 2728 | // Prepare the data for validated plugins for the install/upgrade. |
2729 | 2729 | foreach ( $plugins_to_install as $slug ) { |
2730 | - $name = $this->tgmpa->plugins[ $slug ]['name']; |
|
2730 | + $name = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
2731 | 2731 | $source = $this->tgmpa->get_download_url( $slug ); |
2732 | 2732 | |
2733 | 2733 | if ( ! empty( $name ) && ! empty( $source ) ) { |
2734 | - $names[] = $name; |
|
2734 | + $names[ ] = $name; |
|
2735 | 2735 | |
2736 | 2736 | switch ( $install_type ) { |
2737 | 2737 | |
2738 | 2738 | case 'install': |
2739 | - $sources[] = $source; |
|
2739 | + $sources[ ] = $source; |
|
2740 | 2740 | break; |
2741 | 2741 | |
2742 | 2742 | case 'update': |
2743 | - $file_paths[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
2743 | + $file_paths[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
2744 | 2744 | $to_inject[ $slug ] = $this->tgmpa->plugins[ $slug ]; |
2745 | - $to_inject[ $slug ]['source'] = $source; |
|
2745 | + $to_inject[ $slug ][ 'source' ] = $source; |
|
2746 | 2746 | break; |
2747 | 2747 | } |
2748 | 2748 | } |
@@ -2754,7 +2754,7 @@ discard block |
||
2754 | 2754 | new TGMPA_Bulk_Installer_Skin( |
2755 | 2755 | array( |
2756 | 2756 | 'url' => esc_url_raw( $this->tgmpa->get_tgmpa_url() ), |
2757 | - 'nonce' => 'bulk-' . $this->_args['plural'], |
|
2757 | + 'nonce' => 'bulk-'.$this->_args[ 'plural' ], |
|
2758 | 2758 | 'names' => $names, |
2759 | 2759 | 'install_type' => $install_type, |
2760 | 2760 | ) |
@@ -2786,10 +2786,10 @@ discard block |
||
2786 | 2786 | |
2787 | 2787 | // Bulk activation process. |
2788 | 2788 | if ( 'tgmpa-bulk-activate' === $this->current_action() ) { |
2789 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
2789 | + check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
2790 | 2790 | |
2791 | 2791 | // Did user actually select any plugins to activate ? |
2792 | - if ( empty( $_POST['plugin'] ) ) { |
|
2792 | + if ( empty( $_POST[ 'plugin' ] ) ) { |
|
2793 | 2793 | echo '<div id="message" class="error"><p>', esc_html__( 'No plugins were selected to be activated. No action taken.', 'tgmpa' ), '</p></div>'; |
2794 | 2794 | |
2795 | 2795 | return false; |
@@ -2797,8 +2797,8 @@ discard block |
||
2797 | 2797 | |
2798 | 2798 | // Grab plugin data from $_POST. |
2799 | 2799 | $plugins = array(); |
2800 | - if ( isset( $_POST['plugin'] ) ) { |
|
2801 | - $plugins = array_map( 'urldecode', (array) $_POST['plugin'] ); |
|
2800 | + if ( isset( $_POST[ 'plugin' ] ) ) { |
|
2801 | + $plugins = array_map( 'urldecode', (array) $_POST[ 'plugin' ] ); |
|
2802 | 2802 | $plugins = array_map( array( $this->tgmpa, 'sanitize_key' ), $plugins ); |
2803 | 2803 | } |
2804 | 2804 | |
@@ -2808,8 +2808,8 @@ discard block |
||
2808 | 2808 | // Grab the file paths for the selected & inactive plugins from the registration array. |
2809 | 2809 | foreach ( $plugins as $slug ) { |
2810 | 2810 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
2811 | - $plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
2812 | - $plugin_names[] = $this->tgmpa->plugins[ $slug ]['name']; |
|
2811 | + $plugins_to_activate[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
2812 | + $plugin_names[ ] = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
2813 | 2813 | } |
2814 | 2814 | } |
2815 | 2815 | unset( $slug ); |
@@ -2830,7 +2830,7 @@ discard block |
||
2830 | 2830 | $count = count( $plugin_names ); // Count so we can use _n function. |
2831 | 2831 | $plugin_names = array_map( array( 'TGMPA_Utils', 'wrap_in_strong' ), $plugin_names ); |
2832 | 2832 | $last_plugin = array_pop( $plugin_names ); // Pop off last name to prep for readability. |
2833 | - $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
2833 | + $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); |
|
2834 | 2834 | |
2835 | 2835 | printf( // WPCS: xss ok. |
2836 | 2836 | '<div id="message" class="updated"><p>%1$s %2$s.</p></div>', |
@@ -2933,16 +2933,16 @@ discard block |
||
2933 | 2933 | */ |
2934 | 2934 | function tgmpa_load_bulk_installer() { |
2935 | 2935 | // Silently fail if 2.5+ is loaded *after* an older version. |
2936 | - if ( ! isset( $GLOBALS['tgmpa'] ) ) { |
|
2936 | + if ( ! isset( $GLOBALS[ 'tgmpa' ] ) ) { |
|
2937 | 2937 | return; |
2938 | 2938 | } |
2939 | 2939 | |
2940 | 2940 | // Get TGMPA class instance. |
2941 | - $tgmpa_instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
2941 | + $tgmpa_instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
2942 | 2942 | |
2943 | - if ( isset( $_GET['page'] ) && $tgmpa_instance->menu === $_GET['page'] ) { |
|
2943 | + if ( isset( $_GET[ 'page' ] ) && $tgmpa_instance->menu === $_GET[ 'page' ] ) { |
|
2944 | 2944 | if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
2945 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
2945 | + require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
2946 | 2946 | } |
2947 | 2947 | |
2948 | 2948 | if ( ! class_exists( 'TGMPA_Bulk_Installer' ) ) { |
@@ -3009,11 +3009,11 @@ discard block |
||
3009 | 3009 | */ |
3010 | 3010 | public function __construct( $skin = null ) { |
3011 | 3011 | // Get TGMPA class instance. |
3012 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
3012 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3013 | 3013 | |
3014 | 3014 | parent::__construct( $skin ); |
3015 | 3015 | |
3016 | - if ( isset( $this->skin->options['install_type'] ) && 'update' === $this->skin->options['install_type'] ) { |
|
3016 | + if ( isset( $this->skin->options[ 'install_type' ] ) && 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3017 | 3017 | $this->clear_destination = true; |
3018 | 3018 | } |
3019 | 3019 | |
@@ -3030,8 +3030,8 @@ discard block |
||
3030 | 3030 | * @since 2.2.0 |
3031 | 3031 | */ |
3032 | 3032 | public function activate_strings() { |
3033 | - $this->strings['activation_failed'] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
3034 | - $this->strings['activation_success'] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
3033 | + $this->strings[ 'activation_failed' ] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
3034 | + $this->strings[ 'activation_success' ] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
3035 | 3035 | } |
3036 | 3036 | |
3037 | 3037 | /** |
@@ -3049,7 +3049,7 @@ discard block |
||
3049 | 3049 | |
3050 | 3050 | // Reset the strings in case we changed one during automatic activation. |
3051 | 3051 | if ( $this->tgmpa->is_automatic ) { |
3052 | - if ( 'update' === $this->skin->options['install_type'] ) { |
|
3052 | + if ( 'update' === $this->skin->options[ 'install_type' ] ) { |
|
3053 | 3053 | $this->upgrade_strings(); |
3054 | 3054 | } else { |
3055 | 3055 | $this->install_strings(); |
@@ -3202,7 +3202,7 @@ discard block |
||
3202 | 3202 | remove_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 ); |
3203 | 3203 | |
3204 | 3204 | // Force refresh of plugin update information. |
3205 | - wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); |
|
3205 | + wp_clean_plugins_cache( $parsed_args[ 'clear_update_cache' ] ); |
|
3206 | 3206 | |
3207 | 3207 | return $results; |
3208 | 3208 | } |
@@ -3253,13 +3253,13 @@ discard block |
||
3253 | 3253 | $activate = activate_plugin( $plugin_info ); |
3254 | 3254 | |
3255 | 3255 | // Adjust the success string based on the activation result. |
3256 | - $this->strings['process_success'] = $this->strings['process_success'] . "<br />\n"; |
|
3256 | + $this->strings[ 'process_success' ] = $this->strings[ 'process_success' ]."<br />\n"; |
|
3257 | 3257 | |
3258 | 3258 | if ( is_wp_error( $activate ) ) { |
3259 | 3259 | $this->skin->error( $activate ); |
3260 | - $this->strings['process_success'] .= $this->strings['activation_failed']; |
|
3260 | + $this->strings[ 'process_success' ] .= $this->strings[ 'activation_failed' ]; |
|
3261 | 3261 | } else { |
3262 | - $this->strings['process_success'] .= $this->strings['activation_success']; |
|
3262 | + $this->strings[ 'process_success' ] .= $this->strings[ 'activation_success' ]; |
|
3263 | 3263 | } |
3264 | 3264 | } |
3265 | 3265 | } |
@@ -3335,7 +3335,7 @@ discard block |
||
3335 | 3335 | */ |
3336 | 3336 | public function __construct( $args = array() ) { |
3337 | 3337 | // Get TGMPA class instance. |
3338 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
3338 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
3339 | 3339 | |
3340 | 3340 | // Parse default and new args. |
3341 | 3341 | $defaults = array( |
@@ -3344,10 +3344,10 @@ discard block |
||
3344 | 3344 | 'names' => array(), |
3345 | 3345 | 'install_type' => 'install', |
3346 | 3346 | ); |
3347 | - $args = wp_parse_args( $args, $defaults ); |
|
3347 | + $args = wp_parse_args( $args, $defaults ); |
|
3348 | 3348 | |
3349 | 3349 | // Set plugin names to $this->plugin_names property. |
3350 | - $this->plugin_names = $args['names']; |
|
3350 | + $this->plugin_names = $args[ 'names' ]; |
|
3351 | 3351 | |
3352 | 3352 | // Extract the new args. |
3353 | 3353 | parent::__construct( $args ); |
@@ -3362,25 +3362,25 @@ discard block |
||
3362 | 3362 | * @since 2.2.0 |
3363 | 3363 | */ |
3364 | 3364 | public function add_strings() { |
3365 | - if ( 'update' === $this->options['install_type'] ) { |
|
3365 | + if ( 'update' === $this->options[ 'install_type' ] ) { |
|
3366 | 3366 | parent::add_strings(); |
3367 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3367 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3368 | 3368 | } else { |
3369 | - $this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
3370 | - $this->upgrader->strings['skin_update_failed'] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
3369 | + $this->upgrader->strings[ 'skin_update_failed_error' ] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
3370 | + $this->upgrader->strings[ 'skin_update_failed' ] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
3371 | 3371 | |
3372 | 3372 | if ( $this->tgmpa->is_automatic ) { |
3373 | 3373 | // Automatic activation strings. |
3374 | - $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' ); |
|
3375 | - $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>'; |
|
3376 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
3377 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3374 | + $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' ); |
|
3375 | + $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>'; |
|
3376 | + $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
3377 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3378 | 3378 | } else { |
3379 | 3379 | // Default installation strings. |
3380 | - $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' ); |
|
3381 | - $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>'; |
|
3382 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations have been completed.', 'tgmpa' ); |
|
3383 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3380 | + $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' ); |
|
3381 | + $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>'; |
|
3382 | + $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations have been completed.', 'tgmpa' ); |
|
3383 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
3384 | 3384 | } |
3385 | 3385 | } |
3386 | 3386 | } |
@@ -3438,12 +3438,12 @@ discard block |
||
3438 | 3438 | if ( $this->tgmpa->is_tgmpa_complete() ) { |
3439 | 3439 | // All plugins are active, so we display the complete string and hide the menu to protect users. |
3440 | 3440 | echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
3441 | - $update_actions['dashboard'] = sprintf( |
|
3442 | - esc_html( $this->tgmpa->strings['complete'] ), |
|
3443 | - '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' |
|
3441 | + $update_actions[ 'dashboard' ] = sprintf( |
|
3442 | + esc_html( $this->tgmpa->strings[ 'complete' ] ), |
|
3443 | + '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' |
|
3444 | 3444 | ); |
3445 | 3445 | } else { |
3446 | - $update_actions['tgmpa_page'] = '<a href="' . esc_url( $this->tgmpa->get_tgmpa_url() ) . '" target="_parent">' . esc_html( $this->tgmpa->strings['return'] ) . '</a>'; |
|
3446 | + $update_actions[ 'tgmpa_page' ] = '<a href="'.esc_url( $this->tgmpa->get_tgmpa_url() ).'" target="_parent">'.esc_html( $this->tgmpa->strings[ 'return' ] ).'</a>'; |
|
3447 | 3447 | } |
3448 | 3448 | |
3449 | 3449 | /** |
@@ -3533,7 +3533,7 @@ discard block |
||
3533 | 3533 | * @return string |
3534 | 3534 | */ |
3535 | 3535 | public static function wrap_in_em( $string ) { |
3536 | - return '<em>' . wp_kses_post( $string ) . '</em>'; |
|
3536 | + return '<em>'.wp_kses_post( $string ).'</em>'; |
|
3537 | 3537 | } |
3538 | 3538 | |
3539 | 3539 | /** |
@@ -3547,7 +3547,7 @@ discard block |
||
3547 | 3547 | * @return string |
3548 | 3548 | */ |
3549 | 3549 | public static function wrap_in_strong( $string ) { |
3550 | - return '<strong>' . wp_kses_post( $string ) . '</strong>'; |
|
3550 | + return '<strong>'.wp_kses_post( $string ).'</strong>'; |
|
3551 | 3551 | } |
3552 | 3552 | |
3553 | 3553 | /** |
@@ -3584,7 +3584,7 @@ discard block |
||
3584 | 3584 | */ |
3585 | 3585 | protected static function emulate_filter_bool( $value ) { |
3586 | 3586 | // @codingStandardsIgnoreStart |
3587 | - static $true = array( |
|
3587 | + static $true = array( |
|
3588 | 3588 | '1', |
3589 | 3589 | 'true', 'True', 'TRUE', |
3590 | 3590 | 'y', 'Y', |
@@ -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'] ), |
@@ -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( |