@@ -1892,7 +1892,7 @@ discard block |
||
| 1892 | 1892 | * |
| 1893 | 1893 | * @since 2.4.0 |
| 1894 | 1894 | * |
| 1895 | - * @return object The TGM_Plugin_Activation object. |
|
| 1895 | + * @return TGM_Plugin_Activation The TGM_Plugin_Activation object. |
|
| 1896 | 1896 | */ |
| 1897 | 1897 | public static function get_instance() { |
| 1898 | 1898 | if ( ! isset( self::$instance ) && ! ( self::$instance instanceof self ) ) { |
@@ -2049,7 +2049,7 @@ discard block |
||
| 2049 | 2049 | * |
| 2050 | 2050 | * @since 2.5.0 |
| 2051 | 2051 | * |
| 2052 | - * @return array CSS classnames. |
|
| 2052 | + * @return string[] CSS classnames. |
|
| 2053 | 2053 | */ |
| 2054 | 2054 | public function get_table_classes() { |
| 2055 | 2055 | return array( 'widefat', 'fixed' ); |
@@ -1327,13 +1327,13 @@ |
||
| 1327 | 1327 | $key = preg_replace( '`[^A-Za-z0-9_-]`', '', $key ); |
| 1328 | 1328 | |
| 1329 | 1329 | /** |
| 1330 | - * Filter a sanitized key string. |
|
| 1331 | - * |
|
| 1332 | - * @since 3.0.0 |
|
| 1333 | - * |
|
| 1334 | - * @param string $key Sanitized key. |
|
| 1335 | - * @param string $raw_key The key prior to sanitization. |
|
| 1336 | - */ |
|
| 1330 | + * Filter a sanitized key string. |
|
| 1331 | + * |
|
| 1332 | + * @since 3.0.0 |
|
| 1333 | + * |
|
| 1334 | + * @param string $key Sanitized key. |
|
| 1335 | + * @param string $raw_key The key prior to sanitization. |
|
| 1336 | + */ |
|
| 1337 | 1337 | return apply_filters( 'tgmpa_sanitize_key', $key, $raw_key ); |
| 1338 | 1338 | } |
| 1339 | 1339 | |
@@ -971,7 +971,8 @@ discard block |
||
| 971 | 971 | if ( ! $automatic ) { |
| 972 | 972 | // Make sure message doesn't display again if bulk activation is performed |
| 973 | 973 | // immediately after a single activation. |
| 974 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
| 974 | + if ( ! isset( $_POST['action'] ) ) { |
|
| 975 | +// WPCS: CSRF OK. |
|
| 975 | 976 | echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>'; |
| 976 | 977 | } |
| 977 | 978 | } else { |
@@ -992,7 +993,8 @@ discard block |
||
| 992 | 993 | if ( ! $automatic ) { |
| 993 | 994 | // Make sure message doesn't display again if bulk activation is performed |
| 994 | 995 | // immediately after a single activation. |
| 995 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
| 996 | + if ( ! isset( $_POST['action'] ) ) { |
|
| 997 | +// WPCS: CSRF OK. |
|
| 996 | 998 | echo '<div id="message" class="error"><p>', |
| 997 | 999 | sprintf( |
| 998 | 1000 | esc_html( $this->strings['plugin_needs_higher_version'] ), |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | public function __construct() { |
| 268 | 268 | // Set the current WordPress version. |
| 269 | - $this->wp_version = $GLOBALS['wp_version']; |
|
| 269 | + $this->wp_version = $GLOBALS[ 'wp_version' ]; |
|
| 270 | 270 | |
| 271 | 271 | // Announce that the class is ready, and pass the object (for advanced use). |
| 272 | 272 | do_action_ref_array( 'tgmpa_init', array( $this ) ); |
@@ -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 | } |
@@ -1184,7 +1184,7 @@ discard block |
||
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | // Admin options pages already output settings_errors, so this is to avoid duplication. |
| 1187 | - if ( 'options-general' !== $GLOBALS['current_screen']->parent_base ) { |
|
| 1187 | + if ( 'options-general' !== $GLOBALS[ 'current_screen' ]->parent_base ) { |
|
| 1188 | 1188 | $this->display_settings_errors(); |
| 1189 | 1189 | } |
| 1190 | 1190 | } |
@@ -1200,8 +1200,8 @@ discard block |
||
| 1200 | 1200 | * @return string |
| 1201 | 1201 | */ |
| 1202 | 1202 | protected function get_admin_notice_class() { |
| 1203 | - if ( ! empty( $this->strings['nag_type'] ) ) { |
|
| 1204 | - return sanitize_html_class( strtolower( $this->strings['nag_type'] ) ); |
|
| 1203 | + if ( ! empty( $this->strings[ 'nag_type' ] ) ) { |
|
| 1204 | + return sanitize_html_class( strtolower( $this->strings[ 'nag_type' ] ) ); |
|
| 1205 | 1205 | } else { |
| 1206 | 1206 | if ( version_compare( $this->wp_version, '4.2', '>=' ) ) { |
| 1207 | 1207 | return 'notice-warning'; |
@@ -1224,7 +1224,7 @@ discard block |
||
| 1224 | 1224 | settings_errors( 'tgmpa' ); |
| 1225 | 1225 | |
| 1226 | 1226 | foreach ( (array) $wp_settings_errors as $key => $details ) { |
| 1227 | - if ( 'tgmpa' === $details['setting'] ) { |
|
| 1227 | + if ( 'tgmpa' === $details[ 'setting' ] ) { |
|
| 1228 | 1228 | unset( $wp_settings_errors[ $key ] ); |
| 1229 | 1229 | break; |
| 1230 | 1230 | } |
@@ -1239,8 +1239,8 @@ discard block |
||
| 1239 | 1239 | * @since 2.1.0 |
| 1240 | 1240 | */ |
| 1241 | 1241 | public function dismiss() { |
| 1242 | - if ( isset( $_GET['tgmpa-dismiss'] ) ) { |
|
| 1243 | - update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, 1 ); |
|
| 1242 | + if ( isset( $_GET[ 'tgmpa-dismiss' ] ) ) { |
|
| 1243 | + update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, 1 ); |
|
| 1244 | 1244 | } |
| 1245 | 1245 | } |
| 1246 | 1246 | |
@@ -1256,54 +1256,54 @@ discard block |
||
| 1256 | 1256 | * @return null Return early if incorrect argument. |
| 1257 | 1257 | */ |
| 1258 | 1258 | public function register( $plugin ) { |
| 1259 | - if ( empty( $plugin['slug'] ) || empty( $plugin['name'] ) ) { |
|
| 1259 | + if ( empty( $plugin[ 'slug' ] ) || empty( $plugin[ 'name' ] ) ) { |
|
| 1260 | 1260 | return; |
| 1261 | 1261 | } |
| 1262 | 1262 | |
| 1263 | - if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) { |
|
| 1263 | + if ( empty( $plugin[ 'slug' ] ) || ! is_string( $plugin[ 'slug' ] ) || isset( $this->plugins[ $plugin[ 'slug' ] ] ) ) { |
|
| 1264 | 1264 | return; |
| 1265 | 1265 | } |
| 1266 | 1266 | |
| 1267 | 1267 | $defaults = array( |
| 1268 | - 'name' => '', // String |
|
| 1269 | - 'slug' => '', // String |
|
| 1270 | - 'source' => 'repo', // String |
|
| 1271 | - 'required' => false, // Boolean |
|
| 1272 | - 'version' => '', // String |
|
| 1273 | - 'force_activation' => false, // Boolean |
|
| 1274 | - 'force_deactivation' => false, // Boolean |
|
| 1275 | - 'external_url' => '', // String |
|
| 1276 | - 'is_callable' => '', // String|Array. |
|
| 1268 | + 'name' => '', // String |
|
| 1269 | + 'slug' => '', // String |
|
| 1270 | + 'source' => 'repo', // String |
|
| 1271 | + 'required' => false, // Boolean |
|
| 1272 | + 'version' => '', // String |
|
| 1273 | + 'force_activation' => false, // Boolean |
|
| 1274 | + 'force_deactivation' => false, // Boolean |
|
| 1275 | + 'external_url' => '', // String |
|
| 1276 | + 'is_callable' => '', // String|Array. |
|
| 1277 | 1277 | ); |
| 1278 | 1278 | |
| 1279 | 1279 | // Prepare the received data. |
| 1280 | 1280 | $plugin = wp_parse_args( $plugin, $defaults ); |
| 1281 | 1281 | |
| 1282 | 1282 | // Standardize the received slug. |
| 1283 | - $plugin['slug'] = $this->sanitize_key( $plugin['slug'] ); |
|
| 1283 | + $plugin[ 'slug' ] = $this->sanitize_key( $plugin[ 'slug' ] ); |
|
| 1284 | 1284 | |
| 1285 | 1285 | // Forgive users for using string versions of booleans or floats for version number. |
| 1286 | - $plugin['version'] = (string) $plugin['version']; |
|
| 1287 | - $plugin['source'] = empty( $plugin['source'] ) ? 'repo' : $plugin['source']; |
|
| 1288 | - $plugin['required'] = TGMPA_Utils::validate_bool( $plugin['required'] ); |
|
| 1289 | - $plugin['force_activation'] = TGMPA_Utils::validate_bool( $plugin['force_activation'] ); |
|
| 1290 | - $plugin['force_deactivation'] = TGMPA_Utils::validate_bool( $plugin['force_deactivation'] ); |
|
| 1286 | + $plugin[ 'version' ] = (string) $plugin[ 'version' ]; |
|
| 1287 | + $plugin[ 'source' ] = empty( $plugin[ 'source' ] ) ? 'repo' : $plugin[ 'source' ]; |
|
| 1288 | + $plugin[ 'required' ] = TGMPA_Utils::validate_bool( $plugin[ 'required' ] ); |
|
| 1289 | + $plugin[ 'force_activation' ] = TGMPA_Utils::validate_bool( $plugin[ 'force_activation' ] ); |
|
| 1290 | + $plugin[ 'force_deactivation' ] = TGMPA_Utils::validate_bool( $plugin[ 'force_deactivation' ] ); |
|
| 1291 | 1291 | |
| 1292 | 1292 | // Enrich the received data. |
| 1293 | - $plugin['file_path'] = $this->_get_plugin_basename_from_slug( $plugin['slug'] ); |
|
| 1294 | - $plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] ); |
|
| 1293 | + $plugin[ 'file_path' ] = $this->_get_plugin_basename_from_slug( $plugin[ 'slug' ] ); |
|
| 1294 | + $plugin[ 'source_type' ] = $this->get_plugin_source_type( $plugin[ 'source' ] ); |
|
| 1295 | 1295 | |
| 1296 | 1296 | // Set the class properties. |
| 1297 | - $this->plugins[ $plugin['slug'] ] = $plugin; |
|
| 1298 | - $this->sort_order[ $plugin['slug'] ] = $plugin['name']; |
|
| 1297 | + $this->plugins[ $plugin[ 'slug' ] ] = $plugin; |
|
| 1298 | + $this->sort_order[ $plugin[ 'slug' ] ] = $plugin[ 'name' ]; |
|
| 1299 | 1299 | |
| 1300 | 1300 | // Should we add the force activation hook ? |
| 1301 | - if ( true === $plugin['force_activation'] ) { |
|
| 1301 | + if ( true === $plugin[ 'force_activation' ] ) { |
|
| 1302 | 1302 | $this->has_forced_activation = true; |
| 1303 | 1303 | } |
| 1304 | 1304 | |
| 1305 | 1305 | // Should we add the force deactivation hook ? |
| 1306 | - if ( true === $plugin['force_deactivation'] ) { |
|
| 1306 | + if ( true === $plugin[ 'force_deactivation' ] ) { |
|
| 1307 | 1307 | $this->has_forced_deactivation = true; |
| 1308 | 1308 | } |
| 1309 | 1309 | } |
@@ -1429,11 +1429,11 @@ discard block |
||
| 1429 | 1429 | */ |
| 1430 | 1430 | public function populate_file_path( $plugin_slug = '' ) { |
| 1431 | 1431 | if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) { |
| 1432 | - $this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
| 1432 | + $this->plugins[ $plugin_slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
| 1433 | 1433 | } else { |
| 1434 | 1434 | // Add file_path key for all plugins. |
| 1435 | 1435 | foreach ( $this->plugins as $slug => $values ) { |
| 1436 | - $this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug ); |
|
| 1436 | + $this->plugins[ $slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $slug ); |
|
| 1437 | 1437 | } |
| 1438 | 1438 | } |
| 1439 | 1439 | } |
@@ -1451,7 +1451,7 @@ discard block |
||
| 1451 | 1451 | $keys = array_keys( $this->get_plugins() ); |
| 1452 | 1452 | |
| 1453 | 1453 | foreach ( $keys as $key ) { |
| 1454 | - if ( preg_match( '|^' . $slug . '/|', $key ) ) { |
|
| 1454 | + if ( preg_match( '|^'.$slug.'/|', $key ) ) { |
|
| 1455 | 1455 | return $key; |
| 1456 | 1456 | } |
| 1457 | 1457 | } |
@@ -1473,7 +1473,7 @@ discard block |
||
| 1473 | 1473 | */ |
| 1474 | 1474 | public function _get_plugin_data_from_name( $name, $data = 'slug' ) { |
| 1475 | 1475 | foreach ( $this->plugins as $values ) { |
| 1476 | - if ( $name === $values['name'] && isset( $values[ $data ] ) ) { |
|
| 1476 | + if ( $name === $values[ 'name' ] && isset( $values[ $data ] ) ) { |
|
| 1477 | 1477 | return $values[ $data ]; |
| 1478 | 1478 | } |
| 1479 | 1479 | } |
@@ -1492,13 +1492,13 @@ discard block |
||
| 1492 | 1492 | public function get_download_url( $slug ) { |
| 1493 | 1493 | $dl_source = ''; |
| 1494 | 1494 | |
| 1495 | - switch ( $this->plugins[ $slug ]['source_type'] ) { |
|
| 1495 | + switch ( $this->plugins[ $slug ][ 'source_type' ] ) { |
|
| 1496 | 1496 | case 'repo': |
| 1497 | 1497 | return $this->get_wp_repo_download_url( $slug ); |
| 1498 | 1498 | case 'external': |
| 1499 | - return $this->plugins[ $slug ]['source']; |
|
| 1499 | + return $this->plugins[ $slug ][ 'source' ]; |
|
| 1500 | 1500 | case 'bundled': |
| 1501 | - return $this->default_path . $this->plugins[ $slug ]['source']; |
|
| 1501 | + return $this->default_path.$this->plugins[ $slug ][ 'source' ]; |
|
| 1502 | 1502 | } |
| 1503 | 1503 | |
| 1504 | 1504 | return $dl_source; // Should never happen. |
@@ -1536,7 +1536,7 @@ discard block |
||
| 1536 | 1536 | |
| 1537 | 1537 | if ( ! isset( $api[ $slug ] ) ) { |
| 1538 | 1538 | if ( ! function_exists( 'plugins_api' ) ) { |
| 1539 | - require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
|
| 1539 | + require_once ABSPATH.'wp-admin/includes/plugin-install.php'; |
|
| 1540 | 1540 | } |
| 1541 | 1541 | |
| 1542 | 1542 | $response = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ) ) ); |
@@ -1544,7 +1544,7 @@ discard block |
||
| 1544 | 1544 | $api[ $slug ] = false; |
| 1545 | 1545 | |
| 1546 | 1546 | if ( is_wp_error( $response ) ) { |
| 1547 | - wp_die( esc_html( $this->strings['oops'] ) ); |
|
| 1547 | + wp_die( esc_html( $this->strings[ 'oops' ] ) ); |
|
| 1548 | 1548 | } else { |
| 1549 | 1549 | $api[ $slug ] = $response; |
| 1550 | 1550 | } |
@@ -1563,13 +1563,13 @@ discard block |
||
| 1563 | 1563 | * or the plugin name if not. |
| 1564 | 1564 | */ |
| 1565 | 1565 | public function get_info_link( $slug ) { |
| 1566 | - if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) { |
|
| 1566 | + if ( ! empty( $this->plugins[ $slug ][ 'external_url' ] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ][ 'external_url' ] ) ) { |
|
| 1567 | 1567 | $link = sprintf( |
| 1568 | 1568 | '<a href="%1$s" target="_blank">%2$s</a>', |
| 1569 | - esc_url( $this->plugins[ $slug ]['external_url'] ), |
|
| 1570 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
| 1569 | + esc_url( $this->plugins[ $slug ][ 'external_url' ] ), |
|
| 1570 | + esc_html( $this->plugins[ $slug ][ 'name' ] ) |
|
| 1571 | 1571 | ); |
| 1572 | - } elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) { |
|
| 1572 | + } elseif ( 'repo' === $this->plugins[ $slug ][ 'source_type' ] ) { |
|
| 1573 | 1573 | $url = add_query_arg( |
| 1574 | 1574 | array( |
| 1575 | 1575 | 'tab' => 'plugin-information', |
@@ -1584,10 +1584,10 @@ discard block |
||
| 1584 | 1584 | $link = sprintf( |
| 1585 | 1585 | '<a href="%1$s" class="thickbox">%2$s</a>', |
| 1586 | 1586 | esc_url( $url ), |
| 1587 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
| 1587 | + esc_html( $this->plugins[ $slug ][ 'name' ] ) |
|
| 1588 | 1588 | ); |
| 1589 | 1589 | } else { |
| 1590 | - $link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink. |
|
| 1590 | + $link = esc_html( $this->plugins[ $slug ][ 'name' ] ); // No hyperlink. |
|
| 1591 | 1591 | } |
| 1592 | 1592 | |
| 1593 | 1593 | return $link; |
@@ -1601,7 +1601,7 @@ discard block |
||
| 1601 | 1601 | * @return boolean True when on the TGMPA page, false otherwise. |
| 1602 | 1602 | */ |
| 1603 | 1603 | protected function is_tgmpa_page() { |
| 1604 | - return isset( $_GET['page'] ) && $this->menu === $_GET['page']; |
|
| 1604 | + return isset( $_GET[ 'page' ] ) && $this->menu === $_GET[ 'page' ]; |
|
| 1605 | 1605 | } |
| 1606 | 1606 | |
| 1607 | 1607 | /** |
@@ -1683,7 +1683,7 @@ discard block |
||
| 1683 | 1683 | public function is_plugin_installed( $slug ) { |
| 1684 | 1684 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
| 1685 | 1685 | |
| 1686 | - return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) ); |
|
| 1686 | + return ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ] ) ); |
|
| 1687 | 1687 | } |
| 1688 | 1688 | |
| 1689 | 1689 | /** |
@@ -1695,7 +1695,7 @@ discard block |
||
| 1695 | 1695 | * @return bool True if active, false otherwise. |
| 1696 | 1696 | */ |
| 1697 | 1697 | public function is_plugin_active( $slug ) { |
| 1698 | - return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) ); |
|
| 1698 | + return ( ( ! empty( $this->plugins[ $slug ][ 'is_callable' ] ) && is_callable( $this->plugins[ $slug ][ 'is_callable' ] ) ) || is_plugin_active( $this->plugins[ $slug ][ 'file_path' ] ) ); |
|
| 1699 | 1699 | } |
| 1700 | 1700 | |
| 1701 | 1701 | /** |
@@ -1709,14 +1709,14 @@ discard block |
||
| 1709 | 1709 | */ |
| 1710 | 1710 | public function can_plugin_update( $slug ) { |
| 1711 | 1711 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
| 1712 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
| 1712 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
| 1713 | 1713 | return true; |
| 1714 | 1714 | } |
| 1715 | 1715 | |
| 1716 | 1716 | $api = $this->get_plugins_api( $slug ); |
| 1717 | 1717 | |
| 1718 | 1718 | if ( false !== $api && isset( $api->requires ) ) { |
| 1719 | - return version_compare( $GLOBALS['wp_version'], $api->requires, '>=' ); |
|
| 1719 | + return version_compare( $GLOBALS[ 'wp_version' ], $api->requires, '>=' ); |
|
| 1720 | 1720 | } |
| 1721 | 1721 | |
| 1722 | 1722 | // No usable info received from the plugins API, presume we can update. |
@@ -1748,8 +1748,8 @@ discard block |
||
| 1748 | 1748 | public function get_installed_version( $slug ) { |
| 1749 | 1749 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
| 1750 | 1750 | |
| 1751 | - if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) { |
|
| 1752 | - return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version']; |
|
| 1751 | + if ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ] ) ) { |
|
| 1752 | + return $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ]; |
|
| 1753 | 1753 | } |
| 1754 | 1754 | |
| 1755 | 1755 | return ''; |
@@ -1765,7 +1765,7 @@ discard block |
||
| 1765 | 1765 | */ |
| 1766 | 1766 | public function does_plugin_require_update( $slug ) { |
| 1767 | 1767 | $installed_version = $this->get_installed_version( $slug ); |
| 1768 | - $minimum_version = $this->plugins[ $slug ]['version']; |
|
| 1768 | + $minimum_version = $this->plugins[ $slug ][ 'version' ]; |
|
| 1769 | 1769 | |
| 1770 | 1770 | return version_compare( $minimum_version, $installed_version, '>' ); |
| 1771 | 1771 | } |
@@ -1780,9 +1780,9 @@ discard block |
||
| 1780 | 1780 | */ |
| 1781 | 1781 | public function does_plugin_have_update( $slug ) { |
| 1782 | 1782 | // Presume bundled and external plugins will point to a package which meets the minimum required version. |
| 1783 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
| 1783 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
| 1784 | 1784 | if ( $this->does_plugin_require_update( $slug ) ) { |
| 1785 | - return $this->plugins[ $slug ]['version']; |
|
| 1785 | + return $this->plugins[ $slug ][ 'version' ]; |
|
| 1786 | 1786 | } |
| 1787 | 1787 | |
| 1788 | 1788 | return false; |
@@ -1790,8 +1790,8 @@ discard block |
||
| 1790 | 1790 | |
| 1791 | 1791 | $repo_updates = get_site_transient( 'update_plugins' ); |
| 1792 | 1792 | |
| 1793 | - if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) { |
|
| 1794 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version; |
|
| 1793 | + if ( isset( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version ) ) { |
|
| 1794 | + return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version; |
|
| 1795 | 1795 | } |
| 1796 | 1796 | |
| 1797 | 1797 | return false; |
@@ -1807,14 +1807,14 @@ discard block |
||
| 1807 | 1807 | */ |
| 1808 | 1808 | public function get_upgrade_notice( $slug ) { |
| 1809 | 1809 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
| 1810 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
| 1810 | + if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) { |
|
| 1811 | 1811 | return ''; |
| 1812 | 1812 | } |
| 1813 | 1813 | |
| 1814 | 1814 | $repo_updates = get_site_transient( 'update_plugins' ); |
| 1815 | 1815 | |
| 1816 | - if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) { |
|
| 1817 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice; |
|
| 1816 | + if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice ) ) { |
|
| 1817 | + return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->upgrade_notice; |
|
| 1818 | 1818 | } |
| 1819 | 1819 | |
| 1820 | 1820 | return ''; |
@@ -1830,7 +1830,7 @@ discard block |
||
| 1830 | 1830 | */ |
| 1831 | 1831 | public function get_plugins( $plugin_folder = '' ) { |
| 1832 | 1832 | if ( ! function_exists( 'get_plugins' ) ) { |
| 1833 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
| 1833 | + require_once ABSPATH.'wp-admin/includes/plugin.php'; |
|
| 1834 | 1834 | } |
| 1835 | 1835 | |
| 1836 | 1836 | return get_plugins( $plugin_folder ); |
@@ -1845,7 +1845,7 @@ discard block |
||
| 1845 | 1845 | * @since 2.1.1 |
| 1846 | 1846 | */ |
| 1847 | 1847 | public function update_dismiss() { |
| 1848 | - delete_metadata( 'user', null, 'tgmpa_dismissed_notice_' . $this->id, null, true ); |
|
| 1848 | + delete_metadata( 'user', null, 'tgmpa_dismissed_notice_'.$this->id, null, true ); |
|
| 1849 | 1849 | } |
| 1850 | 1850 | |
| 1851 | 1851 | /** |
@@ -1864,13 +1864,13 @@ discard block |
||
| 1864 | 1864 | */ |
| 1865 | 1865 | public function force_activation() { |
| 1866 | 1866 | foreach ( $this->plugins as $slug => $plugin ) { |
| 1867 | - if ( true === $plugin['force_activation'] ) { |
|
| 1867 | + if ( true === $plugin[ 'force_activation' ] ) { |
|
| 1868 | 1868 | if ( ! $this->is_plugin_installed( $slug ) ) { |
| 1869 | 1869 | // Oops, plugin isn't there so iterate to next condition. |
| 1870 | 1870 | continue; |
| 1871 | 1871 | } elseif ( $this->can_plugin_activate( $slug ) ) { |
| 1872 | 1872 | // There we go, activate the plugin. |
| 1873 | - activate_plugin( $plugin['file_path'] ); |
|
| 1873 | + activate_plugin( $plugin[ 'file_path' ] ); |
|
| 1874 | 1874 | } |
| 1875 | 1875 | } |
| 1876 | 1876 | } |
@@ -1891,8 +1891,8 @@ discard block |
||
| 1891 | 1891 | public function force_deactivation() { |
| 1892 | 1892 | foreach ( $this->plugins as $slug => $plugin ) { |
| 1893 | 1893 | // Only proceed forward if the parameter is set to true and plugin is active. |
| 1894 | - if ( true === $plugin['force_deactivation'] && $this->is_plugin_active( $slug ) ) { |
|
| 1895 | - deactivate_plugins( $plugin['file_path'] ); |
|
| 1894 | + if ( true === $plugin[ 'force_deactivation' ] && $this->is_plugin_active( $slug ) ) { |
|
| 1895 | + deactivate_plugins( $plugin[ 'file_path' ] ); |
|
| 1896 | 1896 | } |
| 1897 | 1897 | } |
| 1898 | 1898 | } |
@@ -1927,7 +1927,7 @@ discard block |
||
| 1927 | 1927 | * Ensure only one instance of the class is ever invoked. |
| 1928 | 1928 | */ |
| 1929 | 1929 | function load_tgm_plugin_activation() { |
| 1930 | - $GLOBALS['tgmpa'] = TGM_Plugin_Activation::get_instance(); |
|
| 1930 | + $GLOBALS[ 'tgmpa' ] = TGM_Plugin_Activation::get_instance(); |
|
| 1931 | 1931 | } |
| 1932 | 1932 | } |
| 1933 | 1933 | |
@@ -1949,7 +1949,7 @@ discard block |
||
| 1949 | 1949 | * @param array $config Optional. An array of configuration values. |
| 1950 | 1950 | */ |
| 1951 | 1951 | function tgmpa( $plugins, $config = array() ) { |
| 1952 | - $instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
| 1952 | + $instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
| 1953 | 1953 | |
| 1954 | 1954 | foreach ( $plugins as $plugin ) { |
| 1955 | 1955 | call_user_func( array( $instance, 'register' ), $plugin ); |
@@ -1957,17 +1957,17 @@ discard block |
||
| 1957 | 1957 | |
| 1958 | 1958 | if ( ! empty( $config ) && is_array( $config ) ) { |
| 1959 | 1959 | // Send out notices for deprecated arguments passed. |
| 1960 | - if ( isset( $config['notices'] ) ) { |
|
| 1960 | + if ( isset( $config[ 'notices' ] ) ) { |
|
| 1961 | 1961 | _deprecated_argument( __FUNCTION__, '2.2.0', 'The `notices` config parameter was renamed to `has_notices` in TGMPA 2.2.0. Please adjust your configuration.' ); |
| 1962 | - if ( ! isset( $config['has_notices'] ) ) { |
|
| 1963 | - $config['has_notices'] = $config['notices']; |
|
| 1962 | + if ( ! isset( $config[ 'has_notices' ] ) ) { |
|
| 1963 | + $config[ 'has_notices' ] = $config[ 'notices' ]; |
|
| 1964 | 1964 | } |
| 1965 | 1965 | } |
| 1966 | 1966 | |
| 1967 | - if ( isset( $config['parent_menu_slug'] ) ) { |
|
| 1967 | + if ( isset( $config[ 'parent_menu_slug' ] ) ) { |
|
| 1968 | 1968 | _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.' ); |
| 1969 | 1969 | } |
| 1970 | - if ( isset( $config['parent_url_slug'] ) ) { |
|
| 1970 | + if ( isset( $config[ 'parent_url_slug' ] ) ) { |
|
| 1971 | 1971 | _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.' ); |
| 1972 | 1972 | } |
| 1973 | 1973 | |
@@ -1983,7 +1983,7 @@ discard block |
||
| 1983 | 1983 | * @since 2.2.0 |
| 1984 | 1984 | */ |
| 1985 | 1985 | if ( ! class_exists( 'WP_List_Table' ) ) { |
| 1986 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 1986 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 1987 | 1987 | } |
| 1988 | 1988 | |
| 1989 | 1989 | if ( ! class_exists( 'TGMPA_List_Table' ) ) { |
@@ -2044,7 +2044,7 @@ discard block |
||
| 2044 | 2044 | * @since 2.2.0 |
| 2045 | 2045 | */ |
| 2046 | 2046 | public function __construct() { |
| 2047 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
| 2047 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
| 2048 | 2048 | |
| 2049 | 2049 | parent::__construct( |
| 2050 | 2050 | array( |
@@ -2054,8 +2054,8 @@ discard block |
||
| 2054 | 2054 | ) |
| 2055 | 2055 | ); |
| 2056 | 2056 | |
| 2057 | - if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'install', 'update', 'activate' ), true ) ) { |
|
| 2058 | - $this->view_context = sanitize_key( $_REQUEST['plugin_status'] ); |
|
| 2057 | + if ( isset( $_REQUEST[ 'plugin_status' ] ) && in_array( $_REQUEST[ 'plugin_status' ], array( 'install', 'update', 'activate' ), true ) ) { |
|
| 2058 | + $this->view_context = sanitize_key( $_REQUEST[ 'plugin_status' ] ); |
|
| 2059 | 2059 | } |
| 2060 | 2060 | |
| 2061 | 2061 | add_filter( 'tgmpa_table_data_items', array( $this, 'sort_table_items' ) ); |
@@ -2102,20 +2102,20 @@ discard block |
||
| 2102 | 2102 | } |
| 2103 | 2103 | |
| 2104 | 2104 | foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) { |
| 2105 | - $table_data[ $i ]['sanitized_plugin'] = $plugin['name']; |
|
| 2106 | - $table_data[ $i ]['slug'] = $slug; |
|
| 2107 | - $table_data[ $i ]['plugin'] = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>'; |
|
| 2108 | - $table_data[ $i ]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] ); |
|
| 2109 | - $table_data[ $i ]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] ); |
|
| 2110 | - $table_data[ $i ]['status'] = $this->get_plugin_status_text( $slug ); |
|
| 2111 | - $table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug ); |
|
| 2112 | - $table_data[ $i ]['minimum_version'] = $plugin['version']; |
|
| 2113 | - $table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
| 2105 | + $table_data[ $i ][ 'sanitized_plugin' ] = $plugin[ 'name' ]; |
|
| 2106 | + $table_data[ $i ][ 'slug' ] = $slug; |
|
| 2107 | + $table_data[ $i ][ 'plugin' ] = '<strong>'.$this->tgmpa->get_info_link( $slug ).'</strong>'; |
|
| 2108 | + $table_data[ $i ][ 'source' ] = $this->get_plugin_source_type_text( $plugin[ 'source_type' ] ); |
|
| 2109 | + $table_data[ $i ][ 'type' ] = $this->get_plugin_advise_type_text( $plugin[ 'required' ] ); |
|
| 2110 | + $table_data[ $i ][ 'status' ] = $this->get_plugin_status_text( $slug ); |
|
| 2111 | + $table_data[ $i ][ 'installed_version' ] = $this->tgmpa->get_installed_version( $slug ); |
|
| 2112 | + $table_data[ $i ][ 'minimum_version' ] = $plugin[ 'version' ]; |
|
| 2113 | + $table_data[ $i ][ 'available_version' ] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
| 2114 | 2114 | |
| 2115 | 2115 | // Prep the upgrade notice info. |
| 2116 | 2116 | $upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug ); |
| 2117 | 2117 | if ( ! empty( $upgrade_notice ) ) { |
| 2118 | - $table_data[ $i ]['upgrade_notice'] = $upgrade_notice; |
|
| 2118 | + $table_data[ $i ][ 'upgrade_notice' ] = $upgrade_notice; |
|
| 2119 | 2119 | |
| 2120 | 2120 | add_action( "tgmpa_after_plugin_row_$slug", array( $this, 'wp_plugin_update_row' ), 10, 2 ); |
| 2121 | 2121 | } |
@@ -2146,17 +2146,17 @@ discard block |
||
| 2146 | 2146 | // No need to display plugins if they are installed, up-to-date and active. |
| 2147 | 2147 | continue; |
| 2148 | 2148 | } else { |
| 2149 | - $plugins['all'][ $slug ] = $plugin; |
|
| 2149 | + $plugins[ 'all' ][ $slug ] = $plugin; |
|
| 2150 | 2150 | |
| 2151 | 2151 | if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) { |
| 2152 | - $plugins['install'][ $slug ] = $plugin; |
|
| 2152 | + $plugins[ 'install' ][ $slug ] = $plugin; |
|
| 2153 | 2153 | } else { |
| 2154 | 2154 | if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) { |
| 2155 | - $plugins['update'][ $slug ] = $plugin; |
|
| 2155 | + $plugins[ 'update' ][ $slug ] = $plugin; |
|
| 2156 | 2156 | } |
| 2157 | 2157 | |
| 2158 | 2158 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
| 2159 | - $plugins['activate'][ $slug ] = $plugin; |
|
| 2159 | + $plugins[ 'activate' ][ $slug ] = $plugin; |
|
| 2160 | 2160 | } |
| 2161 | 2161 | } |
| 2162 | 2162 | } |
@@ -2275,8 +2275,8 @@ discard block |
||
| 2275 | 2275 | $name = array(); |
| 2276 | 2276 | |
| 2277 | 2277 | foreach ( $items as $i => $plugin ) { |
| 2278 | - $type[ $i ] = $plugin['type']; // Required / recommended. |
|
| 2279 | - $name[ $i ] = $plugin['sanitized_plugin']; |
|
| 2278 | + $type[ $i ] = $plugin[ 'type' ]; // Required / recommended. |
|
| 2279 | + $name[ $i ] = $plugin[ 'sanitized_plugin' ]; |
|
| 2280 | 2280 | } |
| 2281 | 2281 | |
| 2282 | 2282 | array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items ); |
@@ -2358,9 +2358,9 @@ discard block |
||
| 2358 | 2358 | public function column_cb( $item ) { |
| 2359 | 2359 | return sprintf( |
| 2360 | 2360 | '<input type="checkbox" name="%1$s[]" value="%2$s" id="%3$s" />', |
| 2361 | - esc_attr( $this->_args['singular'] ), |
|
| 2362 | - esc_attr( $item['slug'] ), |
|
| 2363 | - esc_attr( $item['sanitized_plugin'] ) |
|
| 2361 | + esc_attr( $this->_args[ 'singular' ] ), |
|
| 2362 | + esc_attr( $item[ 'slug' ] ), |
|
| 2363 | + esc_attr( $item[ 'sanitized_plugin' ] ) |
|
| 2364 | 2364 | ); |
| 2365 | 2365 | } |
| 2366 | 2366 | |
@@ -2375,7 +2375,7 @@ discard block |
||
| 2375 | 2375 | public function column_plugin( $item ) { |
| 2376 | 2376 | return sprintf( |
| 2377 | 2377 | '%1$s %2$s', |
| 2378 | - $item['plugin'], |
|
| 2378 | + $item[ 'plugin' ], |
|
| 2379 | 2379 | $this->row_actions( $this->get_row_actions( $item ), true ) |
| 2380 | 2380 | ); |
| 2381 | 2381 | } |
@@ -2391,38 +2391,38 @@ discard block |
||
| 2391 | 2391 | public function column_version( $item ) { |
| 2392 | 2392 | $output = array(); |
| 2393 | 2393 | |
| 2394 | - if ( $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
| 2395 | - $installed = ! empty( $item['installed_version'] ) ? $item['installed_version'] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
| 2394 | + if ( $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
| 2395 | + $installed = ! empty( $item[ 'installed_version' ] ) ? $item[ 'installed_version' ] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
| 2396 | 2396 | |
| 2397 | 2397 | $color = ''; |
| 2398 | - if ( ! empty( $item['minimum_version'] ) && $this->tgmpa->does_plugin_require_update( $item['slug'] ) ) { |
|
| 2398 | + if ( ! empty( $item[ 'minimum_version' ] ) && $this->tgmpa->does_plugin_require_update( $item[ 'slug' ] ) ) { |
|
| 2399 | 2399 | $color = ' color: #ff0000; font-weight: bold;'; |
| 2400 | 2400 | } |
| 2401 | 2401 | |
| 2402 | - $output[] = sprintf( |
|
| 2403 | - '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Installed version:', 'tgmpa' ) . '</p>', |
|
| 2402 | + $output[ ] = sprintf( |
|
| 2403 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Installed version:', 'tgmpa' ).'</p>', |
|
| 2404 | 2404 | $color, |
| 2405 | 2405 | $installed |
| 2406 | 2406 | ); |
| 2407 | 2407 | } |
| 2408 | 2408 | |
| 2409 | - if ( ! empty( $item['minimum_version'] ) ) { |
|
| 2410 | - $output[] = sprintf( |
|
| 2411 | - '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>' . __( 'Minimum required version:', 'tgmpa' ) . '</p>', |
|
| 2412 | - $item['minimum_version'] |
|
| 2409 | + if ( ! empty( $item[ 'minimum_version' ] ) ) { |
|
| 2410 | + $output[ ] = sprintf( |
|
| 2411 | + '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>'.__( 'Minimum required version:', 'tgmpa' ).'</p>', |
|
| 2412 | + $item[ 'minimum_version' ] |
|
| 2413 | 2413 | ); |
| 2414 | 2414 | } |
| 2415 | 2415 | |
| 2416 | - if ( ! empty( $item['available_version'] ) ) { |
|
| 2416 | + if ( ! empty( $item[ 'available_version' ] ) ) { |
|
| 2417 | 2417 | $color = ''; |
| 2418 | - if ( ! empty( $item['minimum_version'] ) && version_compare( $item['available_version'], $item['minimum_version'], '>=' ) ) { |
|
| 2418 | + if ( ! empty( $item[ 'minimum_version' ] ) && version_compare( $item[ 'available_version' ], $item[ 'minimum_version' ], '>=' ) ) { |
|
| 2419 | 2419 | $color = ' color: #71C671; font-weight: bold;'; |
| 2420 | 2420 | } |
| 2421 | 2421 | |
| 2422 | - $output[] = sprintf( |
|
| 2423 | - '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Available version:', 'tgmpa' ) . '</p>', |
|
| 2422 | + $output[ ] = sprintf( |
|
| 2423 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__( 'Available version:', 'tgmpa' ).'</p>', |
|
| 2424 | 2424 | $color, |
| 2425 | - $item['available_version'] |
|
| 2425 | + $item[ 'available_version' ] |
|
| 2426 | 2426 | ); |
| 2427 | 2427 | } |
| 2428 | 2428 | |
@@ -2463,8 +2463,8 @@ discard block |
||
| 2463 | 2463 | ); |
| 2464 | 2464 | |
| 2465 | 2465 | if ( 'all' === $this->view_context || 'update' === $this->view_context ) { |
| 2466 | - $columns['version'] = __( 'Version', 'tgmpa' ); |
|
| 2467 | - $columns['status'] = __( 'Status', 'tgmpa' ); |
|
| 2466 | + $columns[ 'version' ] = __( 'Version', 'tgmpa' ); |
|
| 2467 | + $columns[ 'status' ] = __( 'Status', 'tgmpa' ); |
|
| 2468 | 2468 | } |
| 2469 | 2469 | |
| 2470 | 2470 | return apply_filters( 'tgmpa_table_columns', $columns ); |
@@ -2511,17 +2511,17 @@ discard block |
||
| 2511 | 2511 | $action_links = array(); |
| 2512 | 2512 | |
| 2513 | 2513 | // Display the 'Install' action link if the plugin is not yet available. |
| 2514 | - if ( ! $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
| 2515 | - $actions['install'] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
| 2514 | + if ( ! $this->tgmpa->is_plugin_installed( $item[ 'slug' ] ) ) { |
|
| 2515 | + $actions[ 'install' ] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
| 2516 | 2516 | } else { |
| 2517 | 2517 | // Display the 'Update' action link if an update is available and WP complies with plugin minimum. |
| 2518 | - if ( false !== $this->tgmpa->does_plugin_have_update( $item['slug'] ) && $this->tgmpa->can_plugin_update( $item['slug'] ) ) { |
|
| 2519 | - $actions['update'] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
| 2518 | + if ( false !== $this->tgmpa->does_plugin_have_update( $item[ 'slug' ] ) && $this->tgmpa->can_plugin_update( $item[ 'slug' ] ) ) { |
|
| 2519 | + $actions[ 'update' ] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
| 2520 | 2520 | } |
| 2521 | 2521 | |
| 2522 | 2522 | // Display the 'Activate' action link, but only if the plugin meets the minimum version. |
| 2523 | - if ( $this->tgmpa->can_plugin_activate( $item['slug'] ) ) { |
|
| 2524 | - $actions['activate'] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
| 2523 | + if ( $this->tgmpa->can_plugin_activate( $item[ 'slug' ] ) ) { |
|
| 2524 | + $actions[ 'activate' ] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' ); |
|
| 2525 | 2525 | } |
| 2526 | 2526 | } |
| 2527 | 2527 | |
@@ -2530,24 +2530,24 @@ discard block |
||
| 2530 | 2530 | $nonce_url = wp_nonce_url( |
| 2531 | 2531 | add_query_arg( |
| 2532 | 2532 | array( |
| 2533 | - 'plugin' => urlencode( $item['slug'] ), |
|
| 2534 | - 'tgmpa-' . $action => $action . '-plugin', |
|
| 2533 | + 'plugin' => urlencode( $item[ 'slug' ] ), |
|
| 2534 | + 'tgmpa-'.$action => $action.'-plugin', |
|
| 2535 | 2535 | ), |
| 2536 | 2536 | $this->tgmpa->get_tgmpa_url() |
| 2537 | 2537 | ), |
| 2538 | - 'tgmpa-' . $action, |
|
| 2538 | + 'tgmpa-'.$action, |
|
| 2539 | 2539 | 'tgmpa-nonce' |
| 2540 | 2540 | ); |
| 2541 | 2541 | |
| 2542 | 2542 | $action_links[ $action ] = sprintf( |
| 2543 | - '<a href="%1$s">' . esc_html( $text ) . '</a>', |
|
| 2543 | + '<a href="%1$s">'.esc_html( $text ).'</a>', |
|
| 2544 | 2544 | esc_url( $nonce_url ), |
| 2545 | - '<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>' |
|
| 2545 | + '<span class="screen-reader-text">'.esc_html( $item[ 'sanitized_plugin' ] ).'</span>' |
|
| 2546 | 2546 | ); |
| 2547 | 2547 | } |
| 2548 | 2548 | |
| 2549 | 2549 | $prefix = ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) ? 'network_admin_' : ''; |
| 2550 | - return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item['slug'], $item, $this->view_context ); |
|
| 2550 | + return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item[ 'slug' ], $item, $this->view_context ); |
|
| 2551 | 2551 | } |
| 2552 | 2552 | |
| 2553 | 2553 | /** |
@@ -2568,7 +2568,7 @@ discard block |
||
| 2568 | 2568 | * |
| 2569 | 2569 | * @since 2.5.0 |
| 2570 | 2570 | */ |
| 2571 | - do_action( "tgmpa_after_plugin_row_{$item['slug']}", $item['slug'], $item, $this->view_context ); |
|
| 2571 | + do_action( "tgmpa_after_plugin_row_{$item[ 'slug' ]}", $item[ 'slug' ], $item, $this->view_context ); |
|
| 2572 | 2572 | } |
| 2573 | 2573 | |
| 2574 | 2574 | /** |
@@ -2583,7 +2583,7 @@ discard block |
||
| 2583 | 2583 | * @return null Return early if upgrade notice is empty. |
| 2584 | 2584 | */ |
| 2585 | 2585 | public function wp_plugin_update_row( $slug, $item ) { |
| 2586 | - if ( empty( $item['upgrade_notice'] ) ) { |
|
| 2586 | + if ( empty( $item[ 'upgrade_notice' ] ) ) { |
|
| 2587 | 2587 | return; |
| 2588 | 2588 | } |
| 2589 | 2589 | |
@@ -2592,7 +2592,7 @@ discard block |
||
| 2592 | 2592 | <td colspan="', absint( $this->get_column_count() ), '" class="plugin-update colspanchange"> |
| 2593 | 2593 | <div class="update-message">', |
| 2594 | 2594 | esc_html__( 'Upgrade message from the plugin author:', 'tgmpa' ), |
| 2595 | - ' <strong>', wp_kses_data( $item['upgrade_notice'] ), '</strong> |
|
| 2595 | + ' <strong>', wp_kses_data( $item[ 'upgrade_notice' ] ), '</strong> |
|
| 2596 | 2596 | </div> |
| 2597 | 2597 | </td> |
| 2598 | 2598 | </tr>'; |
@@ -2624,16 +2624,16 @@ discard block |
||
| 2624 | 2624 | |
| 2625 | 2625 | if ( 'update' !== $this->view_context && 'activate' !== $this->view_context ) { |
| 2626 | 2626 | if ( current_user_can( 'install_plugins' ) ) { |
| 2627 | - $actions['tgmpa-bulk-install'] = __( 'Install', 'tgmpa' ); |
|
| 2627 | + $actions[ 'tgmpa-bulk-install' ] = __( 'Install', 'tgmpa' ); |
|
| 2628 | 2628 | } |
| 2629 | 2629 | } |
| 2630 | 2630 | |
| 2631 | 2631 | if ( 'install' !== $this->view_context ) { |
| 2632 | 2632 | if ( current_user_can( 'update_plugins' ) ) { |
| 2633 | - $actions['tgmpa-bulk-update'] = __( 'Update', 'tgmpa' ); |
|
| 2633 | + $actions[ 'tgmpa-bulk-update' ] = __( 'Update', 'tgmpa' ); |
|
| 2634 | 2634 | } |
| 2635 | 2635 | if ( current_user_can( 'activate_plugins' ) ) { |
| 2636 | - $actions['tgmpa-bulk-activate'] = __( 'Activate', 'tgmpa' ); |
|
| 2636 | + $actions[ 'tgmpa-bulk-activate' ] = __( 'Activate', 'tgmpa' ); |
|
| 2637 | 2637 | } |
| 2638 | 2638 | } |
| 2639 | 2639 | |
@@ -2652,7 +2652,7 @@ discard block |
||
| 2652 | 2652 | // Bulk installation process. |
| 2653 | 2653 | if ( 'tgmpa-bulk-install' === $this->current_action() || 'tgmpa-bulk-update' === $this->current_action() ) { |
| 2654 | 2654 | |
| 2655 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
| 2655 | + check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
| 2656 | 2656 | |
| 2657 | 2657 | $install_type = 'install'; |
| 2658 | 2658 | if ( 'tgmpa-bulk-update' === $this->current_action() ) { |
@@ -2662,7 +2662,7 @@ discard block |
||
| 2662 | 2662 | $plugins_to_install = array(); |
| 2663 | 2663 | |
| 2664 | 2664 | // Did user actually select any plugins to install/update ? |
| 2665 | - if ( empty( $_POST['plugin'] ) ) { |
|
| 2665 | + if ( empty( $_POST[ 'plugin' ] ) ) { |
|
| 2666 | 2666 | if ( 'install' === $install_type ) { |
| 2667 | 2667 | $message = __( 'No plugins were selected to be installed. No action taken.', 'tgmpa' ); |
| 2668 | 2668 | } else { |
@@ -2674,11 +2674,11 @@ discard block |
||
| 2674 | 2674 | return false; |
| 2675 | 2675 | } |
| 2676 | 2676 | |
| 2677 | - if ( is_array( $_POST['plugin'] ) ) { |
|
| 2678 | - $plugins_to_install = (array) $_POST['plugin']; |
|
| 2679 | - } elseif ( is_string( $_POST['plugin'] ) ) { |
|
| 2677 | + if ( is_array( $_POST[ 'plugin' ] ) ) { |
|
| 2678 | + $plugins_to_install = (array) $_POST[ 'plugin' ]; |
|
| 2679 | + } elseif ( is_string( $_POST[ 'plugin' ] ) ) { |
|
| 2680 | 2680 | // Received via Filesystem page - un-flatten array (WP bug #19643). |
| 2681 | - $plugins_to_install = explode( ',', $_POST['plugin'] ); |
|
| 2681 | + $plugins_to_install = explode( ',', $_POST[ 'plugin' ] ); |
|
| 2682 | 2682 | } |
| 2683 | 2683 | |
| 2684 | 2684 | // Sanitize the received input. |
@@ -2715,11 +2715,11 @@ discard block |
||
| 2715 | 2715 | // Pass all necessary information if WP_Filesystem is needed. |
| 2716 | 2716 | $url = wp_nonce_url( |
| 2717 | 2717 | $this->tgmpa->get_tgmpa_url(), |
| 2718 | - 'bulk-' . $this->_args['plural'] |
|
| 2718 | + 'bulk-'.$this->_args[ 'plural' ] |
|
| 2719 | 2719 | ); |
| 2720 | 2720 | |
| 2721 | 2721 | // Give validated data back to $_POST which is the only place the filesystem looks for extra fields. |
| 2722 | - $_POST['plugin'] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
| 2722 | + $_POST[ 'plugin' ] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
| 2723 | 2723 | |
| 2724 | 2724 | $method = ''; // Leave blank so WP_Filesystem can populate it as necessary. |
| 2725 | 2725 | $fields = array_keys( $_POST ); // Extra fields to pass to WP_Filesystem. |
@@ -2746,22 +2746,22 @@ discard block |
||
| 2746 | 2746 | |
| 2747 | 2747 | // Prepare the data for validated plugins for the install/upgrade. |
| 2748 | 2748 | foreach ( $plugins_to_install as $slug ) { |
| 2749 | - $name = $this->tgmpa->plugins[ $slug ]['name']; |
|
| 2749 | + $name = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
| 2750 | 2750 | $source = $this->tgmpa->get_download_url( $slug ); |
| 2751 | 2751 | |
| 2752 | 2752 | if ( ! empty( $name ) && ! empty( $source ) ) { |
| 2753 | - $names[] = $name; |
|
| 2753 | + $names[ ] = $name; |
|
| 2754 | 2754 | |
| 2755 | 2755 | switch ( $install_type ) { |
| 2756 | 2756 | |
| 2757 | 2757 | case 'install': |
| 2758 | - $sources[] = $source; |
|
| 2758 | + $sources[ ] = $source; |
|
| 2759 | 2759 | break; |
| 2760 | 2760 | |
| 2761 | 2761 | case 'update': |
| 2762 | - $file_paths[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
| 2762 | + $file_paths[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
| 2763 | 2763 | $to_inject[ $slug ] = $this->tgmpa->plugins[ $slug ]; |
| 2764 | - $to_inject[ $slug ]['source'] = $source; |
|
| 2764 | + $to_inject[ $slug ][ 'source' ] = $source; |
|
| 2765 | 2765 | break; |
| 2766 | 2766 | } |
| 2767 | 2767 | } |
@@ -2773,7 +2773,7 @@ discard block |
||
| 2773 | 2773 | new TGMPA_Bulk_Installer_Skin( |
| 2774 | 2774 | array( |
| 2775 | 2775 | 'url' => esc_url_raw( $this->tgmpa->get_tgmpa_url() ), |
| 2776 | - 'nonce' => 'bulk-' . $this->_args['plural'], |
|
| 2776 | + 'nonce' => 'bulk-'.$this->_args[ 'plural' ], |
|
| 2777 | 2777 | 'names' => $names, |
| 2778 | 2778 | 'install_type' => $install_type, |
| 2779 | 2779 | ) |
@@ -2805,10 +2805,10 @@ discard block |
||
| 2805 | 2805 | |
| 2806 | 2806 | // Bulk activation process. |
| 2807 | 2807 | if ( 'tgmpa-bulk-activate' === $this->current_action() ) { |
| 2808 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
| 2808 | + check_admin_referer( 'bulk-'.$this->_args[ 'plural' ] ); |
|
| 2809 | 2809 | |
| 2810 | 2810 | // Did user actually select any plugins to activate ? |
| 2811 | - if ( empty( $_POST['plugin'] ) ) { |
|
| 2811 | + if ( empty( $_POST[ 'plugin' ] ) ) { |
|
| 2812 | 2812 | echo '<div id="message" class="error"><p>', esc_html__( 'No plugins were selected to be activated. No action taken.', 'tgmpa' ), '</p></div>'; |
| 2813 | 2813 | |
| 2814 | 2814 | return false; |
@@ -2816,8 +2816,8 @@ discard block |
||
| 2816 | 2816 | |
| 2817 | 2817 | // Grab plugin data from $_POST. |
| 2818 | 2818 | $plugins = array(); |
| 2819 | - if ( isset( $_POST['plugin'] ) ) { |
|
| 2820 | - $plugins = array_map( 'urldecode', (array) $_POST['plugin'] ); |
|
| 2819 | + if ( isset( $_POST[ 'plugin' ] ) ) { |
|
| 2820 | + $plugins = array_map( 'urldecode', (array) $_POST[ 'plugin' ] ); |
|
| 2821 | 2821 | $plugins = array_map( array( $this->tgmpa, 'sanitize_key' ), $plugins ); |
| 2822 | 2822 | } |
| 2823 | 2823 | |
@@ -2827,8 +2827,8 @@ discard block |
||
| 2827 | 2827 | // Grab the file paths for the selected & inactive plugins from the registration array. |
| 2828 | 2828 | foreach ( $plugins as $slug ) { |
| 2829 | 2829 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
| 2830 | - $plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
| 2831 | - $plugin_names[] = $this->tgmpa->plugins[ $slug ]['name']; |
|
| 2830 | + $plugins_to_activate[ ] = $this->tgmpa->plugins[ $slug ][ 'file_path' ]; |
|
| 2831 | + $plugin_names[ ] = $this->tgmpa->plugins[ $slug ][ 'name' ]; |
|
| 2832 | 2832 | } |
| 2833 | 2833 | } |
| 2834 | 2834 | unset( $slug ); |
@@ -2849,7 +2849,7 @@ discard block |
||
| 2849 | 2849 | $count = count( $plugin_names ); // Count so we can use _n function. |
| 2850 | 2850 | $plugin_names = array_map( array( 'TGMPA_Utils', 'wrap_in_strong' ), $plugin_names ); |
| 2851 | 2851 | $last_plugin = array_pop( $plugin_names ); // Pop off last name to prep for readability. |
| 2852 | - $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
| 2852 | + $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin ); |
|
| 2853 | 2853 | |
| 2854 | 2854 | printf( // WPCS: xss ok. |
| 2855 | 2855 | '<div id="message" class="updated"><p>%1$s %2$s.</p></div>', |
@@ -2952,16 +2952,16 @@ discard block |
||
| 2952 | 2952 | */ |
| 2953 | 2953 | function tgmpa_load_bulk_installer() { |
| 2954 | 2954 | // Silently fail if 2.5+ is loaded *after* an older version. |
| 2955 | - if ( ! isset( $GLOBALS['tgmpa'] ) ) { |
|
| 2955 | + if ( ! isset( $GLOBALS[ 'tgmpa' ] ) ) { |
|
| 2956 | 2956 | return; |
| 2957 | 2957 | } |
| 2958 | 2958 | |
| 2959 | 2959 | // Get TGMPA class instance. |
| 2960 | - $tgmpa_instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
| 2960 | + $tgmpa_instance = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
| 2961 | 2961 | |
| 2962 | - if ( isset( $_GET['page'] ) && $tgmpa_instance->menu === $_GET['page'] ) { |
|
| 2962 | + if ( isset( $_GET[ 'page' ] ) && $tgmpa_instance->menu === $_GET[ 'page' ] ) { |
|
| 2963 | 2963 | if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
| 2964 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
| 2964 | + require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
| 2965 | 2965 | } |
| 2966 | 2966 | |
| 2967 | 2967 | if ( ! class_exists( 'TGMPA_Bulk_Installer' ) ) { |
@@ -3028,11 +3028,11 @@ discard block |
||
| 3028 | 3028 | */ |
| 3029 | 3029 | public function __construct( $skin = null ) { |
| 3030 | 3030 | // Get TGMPA class instance. |
| 3031 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
| 3031 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
| 3032 | 3032 | |
| 3033 | 3033 | parent::__construct( $skin ); |
| 3034 | 3034 | |
| 3035 | - if ( isset( $this->skin->options['install_type'] ) && 'update' === $this->skin->options['install_type'] ) { |
|
| 3035 | + if ( isset( $this->skin->options[ 'install_type' ] ) && 'update' === $this->skin->options[ 'install_type' ] ) { |
|
| 3036 | 3036 | $this->clear_destination = true; |
| 3037 | 3037 | } |
| 3038 | 3038 | |
@@ -3049,8 +3049,8 @@ discard block |
||
| 3049 | 3049 | * @since 2.2.0 |
| 3050 | 3050 | */ |
| 3051 | 3051 | public function activate_strings() { |
| 3052 | - $this->strings['activation_failed'] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
| 3053 | - $this->strings['activation_success'] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
| 3052 | + $this->strings[ 'activation_failed' ] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
| 3053 | + $this->strings[ 'activation_success' ] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
| 3054 | 3054 | } |
| 3055 | 3055 | |
| 3056 | 3056 | /** |
@@ -3068,7 +3068,7 @@ discard block |
||
| 3068 | 3068 | |
| 3069 | 3069 | // Reset the strings in case we changed one during automatic activation. |
| 3070 | 3070 | if ( $this->tgmpa->is_automatic ) { |
| 3071 | - if ( 'update' === $this->skin->options['install_type'] ) { |
|
| 3071 | + if ( 'update' === $this->skin->options[ 'install_type' ] ) { |
|
| 3072 | 3072 | $this->upgrade_strings(); |
| 3073 | 3073 | } else { |
| 3074 | 3074 | $this->install_strings(); |
@@ -3221,7 +3221,7 @@ discard block |
||
| 3221 | 3221 | remove_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 ); |
| 3222 | 3222 | |
| 3223 | 3223 | // Force refresh of plugin update information. |
| 3224 | - wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); |
|
| 3224 | + wp_clean_plugins_cache( $parsed_args[ 'clear_update_cache' ] ); |
|
| 3225 | 3225 | |
| 3226 | 3226 | return $results; |
| 3227 | 3227 | } |
@@ -3272,13 +3272,13 @@ discard block |
||
| 3272 | 3272 | $activate = activate_plugin( $plugin_info ); |
| 3273 | 3273 | |
| 3274 | 3274 | // Adjust the success string based on the activation result. |
| 3275 | - $this->strings['process_success'] = $this->strings['process_success'] . "<br />\n"; |
|
| 3275 | + $this->strings[ 'process_success' ] = $this->strings[ 'process_success' ]."<br />\n"; |
|
| 3276 | 3276 | |
| 3277 | 3277 | if ( is_wp_error( $activate ) ) { |
| 3278 | 3278 | $this->skin->error( $activate ); |
| 3279 | - $this->strings['process_success'] .= $this->strings['activation_failed']; |
|
| 3279 | + $this->strings[ 'process_success' ] .= $this->strings[ 'activation_failed' ]; |
|
| 3280 | 3280 | } else { |
| 3281 | - $this->strings['process_success'] .= $this->strings['activation_success']; |
|
| 3281 | + $this->strings[ 'process_success' ] .= $this->strings[ 'activation_success' ]; |
|
| 3282 | 3282 | } |
| 3283 | 3283 | } |
| 3284 | 3284 | } |
@@ -3354,7 +3354,7 @@ discard block |
||
| 3354 | 3354 | */ |
| 3355 | 3355 | public function __construct( $args = array() ) { |
| 3356 | 3356 | // Get TGMPA class instance. |
| 3357 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
| 3357 | + $this->tgmpa = call_user_func( array( get_class( $GLOBALS[ 'tgmpa' ] ), 'get_instance' ) ); |
|
| 3358 | 3358 | |
| 3359 | 3359 | // Parse default and new args. |
| 3360 | 3360 | $defaults = array( |
@@ -3363,10 +3363,10 @@ discard block |
||
| 3363 | 3363 | 'names' => array(), |
| 3364 | 3364 | 'install_type' => 'install', |
| 3365 | 3365 | ); |
| 3366 | - $args = wp_parse_args( $args, $defaults ); |
|
| 3366 | + $args = wp_parse_args( $args, $defaults ); |
|
| 3367 | 3367 | |
| 3368 | 3368 | // Set plugin names to $this->plugin_names property. |
| 3369 | - $this->plugin_names = $args['names']; |
|
| 3369 | + $this->plugin_names = $args[ 'names' ]; |
|
| 3370 | 3370 | |
| 3371 | 3371 | // Extract the new args. |
| 3372 | 3372 | parent::__construct( $args ); |
@@ -3381,25 +3381,25 @@ discard block |
||
| 3381 | 3381 | * @since 2.2.0 |
| 3382 | 3382 | */ |
| 3383 | 3383 | public function add_strings() { |
| 3384 | - if ( 'update' === $this->options['install_type'] ) { |
|
| 3384 | + if ( 'update' === $this->options[ 'install_type' ] ) { |
|
| 3385 | 3385 | parent::add_strings(); |
| 3386 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
| 3386 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
| 3387 | 3387 | } else { |
| 3388 | - $this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
| 3389 | - $this->upgrader->strings['skin_update_failed'] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
| 3388 | + $this->upgrader->strings[ 'skin_update_failed_error' ] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
| 3389 | + $this->upgrader->strings[ 'skin_update_failed' ] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
| 3390 | 3390 | |
| 3391 | 3391 | if ( $this->tgmpa->is_automatic ) { |
| 3392 | 3392 | // Automatic activation strings. |
| 3393 | - $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' ); |
|
| 3394 | - $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>'; |
|
| 3395 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
| 3396 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
| 3393 | + $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' ); |
|
| 3394 | + $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>'; |
|
| 3395 | + $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
| 3396 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
| 3397 | 3397 | } else { |
| 3398 | 3398 | // Default installation strings. |
| 3399 | - $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' ); |
|
| 3400 | - $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>'; |
|
| 3401 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations have been completed.', 'tgmpa' ); |
|
| 3402 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
| 3399 | + $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' ); |
|
| 3400 | + $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>'; |
|
| 3401 | + $this->upgrader->strings[ 'skin_upgrade_end' ] = __( 'All installations have been completed.', 'tgmpa' ); |
|
| 3402 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
| 3403 | 3403 | } |
| 3404 | 3404 | } |
| 3405 | 3405 | } |
@@ -3457,12 +3457,12 @@ discard block |
||
| 3457 | 3457 | if ( $this->tgmpa->is_tgmpa_complete() ) { |
| 3458 | 3458 | // All plugins are active, so we display the complete string and hide the menu to protect users. |
| 3459 | 3459 | echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
| 3460 | - $update_actions['dashboard'] = sprintf( |
|
| 3461 | - esc_html( $this->tgmpa->strings['complete'] ), |
|
| 3462 | - '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' |
|
| 3460 | + $update_actions[ 'dashboard' ] = sprintf( |
|
| 3461 | + esc_html( $this->tgmpa->strings[ 'complete' ] ), |
|
| 3462 | + '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' |
|
| 3463 | 3463 | ); |
| 3464 | 3464 | } else { |
| 3465 | - $update_actions['tgmpa_page'] = '<a href="' . esc_url( $this->tgmpa->get_tgmpa_url() ) . '" target="_parent">' . esc_html( $this->tgmpa->strings['return'] ) . '</a>'; |
|
| 3465 | + $update_actions[ 'tgmpa_page' ] = '<a href="'.esc_url( $this->tgmpa->get_tgmpa_url() ).'" target="_parent">'.esc_html( $this->tgmpa->strings[ 'return' ] ).'</a>'; |
|
| 3466 | 3466 | } |
| 3467 | 3467 | |
| 3468 | 3468 | /** |
@@ -3552,7 +3552,7 @@ discard block |
||
| 3552 | 3552 | * @return string |
| 3553 | 3553 | */ |
| 3554 | 3554 | public static function wrap_in_em( $string ) { |
| 3555 | - return '<em>' . wp_kses_post( $string ) . '</em>'; |
|
| 3555 | + return '<em>'.wp_kses_post( $string ).'</em>'; |
|
| 3556 | 3556 | } |
| 3557 | 3557 | |
| 3558 | 3558 | /** |
@@ -3566,7 +3566,7 @@ discard block |
||
| 3566 | 3566 | * @return string |
| 3567 | 3567 | */ |
| 3568 | 3568 | public static function wrap_in_strong( $string ) { |
| 3569 | - return '<strong>' . wp_kses_post( $string ) . '</strong>'; |
|
| 3569 | + return '<strong>'.wp_kses_post( $string ).'</strong>'; |
|
| 3570 | 3570 | } |
| 3571 | 3571 | |
| 3572 | 3572 | /** |
@@ -3603,7 +3603,7 @@ discard block |
||
| 3603 | 3603 | */ |
| 3604 | 3604 | protected static function emulate_filter_bool( $value ) { |
| 3605 | 3605 | // @codingStandardsIgnoreStart |
| 3606 | - static $true = array( |
|
| 3606 | + static $true = array( |
|
| 3607 | 3607 | '1', |
| 3608 | 3608 | 'true', 'True', 'TRUE', |
| 3609 | 3609 | 'y', 'Y', |
@@ -1,21 +1,21 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * This file represents an example of the code that themes would use to register |
|
| 4 | - * the required plugins. |
|
| 5 | - * |
|
| 6 | - * It is expected that theme authors would copy and paste this code into their |
|
| 7 | - * functions.php file, and amend to suit. |
|
| 8 | - * |
|
| 9 | - * @see http://tgmpluginactivation.com/configuration/ for detailed documentation. |
|
| 10 | - * |
|
| 11 | - * @package TGM-Plugin-Activation |
|
| 12 | - * @subpackage Example |
|
| 13 | - * @version 2.5.2 |
|
| 14 | - * @author Thomas Griffin, Gary Jones, Juliette Reinders Folmer |
|
| 15 | - * @copyright Copyright (c) 2011, Thomas Griffin |
|
| 16 | - * @license http://opensource.org/licenses/gpl-2.0.php GPL v2 or later |
|
| 17 | - * @link https://github.com/TGMPA/TGM-Plugin-Activation |
|
| 18 | - */ |
|
| 3 | + * This file represents an example of the code that themes would use to register |
|
| 4 | + * the required plugins. |
|
| 5 | + * |
|
| 6 | + * It is expected that theme authors would copy and paste this code into their |
|
| 7 | + * functions.php file, and amend to suit. |
|
| 8 | + * |
|
| 9 | + * @see http://tgmpluginactivation.com/configuration/ for detailed documentation. |
|
| 10 | + * |
|
| 11 | + * @package TGM-Plugin-Activation |
|
| 12 | + * @subpackage Example |
|
| 13 | + * @version 2.5.2 |
|
| 14 | + * @author Thomas Griffin, Gary Jones, Juliette Reinders Folmer |
|
| 15 | + * @copyright Copyright (c) 2011, Thomas Griffin |
|
| 16 | + * @license http://opensource.org/licenses/gpl-2.0.php GPL v2 or later |
|
| 17 | + * @link https://github.com/TGMPA/TGM-Plugin-Activation |
|
| 18 | + */ |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Include the TGM_Plugin_Activation class. |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | /** |
| 21 | 21 | * Include the TGM_Plugin_Activation class. |
| 22 | 22 | */ |
| 23 | -require_once dirname( __FILE__ ) . '/class-tgm-plugin-activation.php'; |
|
| 23 | +require_once dirname( __FILE__ ).'/class-tgm-plugin-activation.php'; |
|
| 24 | 24 | |
| 25 | 25 | add_action( 'tgmpa_register', 'my_theme_register_required_plugins' ); |
| 26 | 26 | /** |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | array( |
| 49 | 49 | 'name' => 'TGM Example Plugin', // The plugin name. |
| 50 | 50 | 'slug' => 'tgm-example-plugin', // The plugin slug (typically the folder name). |
| 51 | - 'source' => get_stylesheet_directory() . '/lib/plugins/tgm-example-plugin.zip', // The plugin source. |
|
| 51 | + 'source' => get_stylesheet_directory().'/lib/plugins/tgm-example-plugin.zip', // The plugin source. |
|
| 52 | 52 | 'required' => true, // If false, the plugin is only 'recommended' instead of required. |
| 53 | 53 | 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher. If the plugin version is higher than the plugin version installed, the user will be notified to update the plugin. |
| 54 | 54 | 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch. |
@@ -106,16 +106,16 @@ discard block |
||
| 106 | 106 | * Only uncomment the strings in the config array if you want to customize the strings. |
| 107 | 107 | */ |
| 108 | 108 | $config = array( |
| 109 | - 'id' => 'tgmpa', // Unique ID for hashing notices for multiple instances of TGMPA. |
|
| 110 | - 'default_path' => '', // Default absolute path to bundled plugins. |
|
| 109 | + 'id' => 'tgmpa', // Unique ID for hashing notices for multiple instances of TGMPA. |
|
| 110 | + 'default_path' => '', // Default absolute path to bundled plugins. |
|
| 111 | 111 | 'menu' => 'tgmpa-install-plugins', // Menu slug. |
| 112 | - 'parent_slug' => 'themes.php', // Parent menu slug. |
|
| 113 | - 'capability' => 'edit_theme_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used. |
|
| 114 | - 'has_notices' => true, // Show admin notices or not. |
|
| 115 | - 'dismissable' => true, // If false, a user cannot dismiss the nag message. |
|
| 116 | - 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag. |
|
| 117 | - 'is_automatic' => false, // Automatically activate plugins after installation or not. |
|
| 118 | - 'message' => '', // Message to output right before the plugins table. |
|
| 112 | + 'parent_slug' => 'themes.php', // Parent menu slug. |
|
| 113 | + 'capability' => 'edit_theme_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used. |
|
| 114 | + 'has_notices' => true, // Show admin notices or not. |
|
| 115 | + 'dismissable' => true, // If false, a user cannot dismiss the nag message. |
|
| 116 | + 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag. |
|
| 117 | + 'is_automatic' => false, // Automatically activate plugins after installation or not. |
|
| 118 | + 'message' => '', // Message to output right before the plugins table. |
|
| 119 | 119 | |
| 120 | 120 | /* |
| 121 | 121 | 'strings' => array( |