Skip to content

Commit

Permalink
Move default string assignment to constructor
Browse files Browse the repository at this point in the history
This allows the default strings to be overridden via configuration after instantiation but before they are used.

TGMPA#804
  • Loading branch information
XedinUnknown committed Apr 27, 2021
1 parent 2d34264 commit 71ac1e2
Showing 1 changed file with 75 additions and 75 deletions.
150 changes: 75 additions & 75 deletions class-tgm-plugin-activation.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,81 @@ public function __construct() {
// Set the current WordPress version.
$this->wp_version = $GLOBALS['wp_version'];

// Load class strings.
$this->strings = array(
'page_title' => __( 'Install Required Plugins', 'tgmpa' ),
'menu_title' => __( 'Install Plugins', 'tgmpa' ),
/* translators: %s: plugin name. */
'installing' => __( 'Installing Plugin: %s', 'tgmpa' ),
/* translators: %s: plugin name. */
'updating' => __( 'Updating Plugin: %s', 'tgmpa' ),
'oops' => __( 'Something went wrong with the plugin API.', 'tgmpa' ),
/* translators: 1: plugin name(s). */
'notice_can_install_required' => _n_noop(
'This theme requires the following plugin: %1$s.',
'This theme requires the following plugins: %1$s.',
'tgmpa'
),
/* translators: 1: plugin name(s). */
'notice_can_install_recommended' => _n_noop(
'This theme recommends the following plugin: %1$s.',
'This theme recommends the following plugins: %1$s.',
'tgmpa'
),
/* translators: 1: plugin name(s). */
'notice_ask_to_update' => _n_noop(
'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.',
'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.',
'tgmpa'
),
/* translators: 1: plugin name(s). */
'notice_ask_to_update_maybe' => _n_noop(
'There is an update available for: %1$s.',
'There are updates available for the following plugins: %1$s.',
'tgmpa'
),
/* translators: 1: plugin name(s). */
'notice_can_activate_required' => _n_noop(
'The following required plugin is currently inactive: %1$s.',
'The following required plugins are currently inactive: %1$s.',
'tgmpa'
),
/* translators: 1: plugin name(s). */
'notice_can_activate_recommended' => _n_noop(
'The following recommended plugin is currently inactive: %1$s.',
'The following recommended plugins are currently inactive: %1$s.',
'tgmpa'
),
'install_link' => _n_noop(
'Begin installing plugin',
'Begin installing plugins',
'tgmpa'
),
'update_link' => _n_noop(
'Begin updating plugin',
'Begin updating plugins',
'tgmpa'
),
'activate_link' => _n_noop(
'Begin activating plugin',
'Begin activating plugins',
'tgmpa'
),
'return' => __( 'Return to Required Plugins Installer', 'tgmpa' ),
'dashboard' => __( 'Return to the Dashboard', 'tgmpa' ),
'plugin_activated' => __( 'Plugin activated successfully.', 'tgmpa' ),
'activated_successfully' => __( 'The following plugin was activated successfully:', 'tgmpa' ),
/* translators: 1: plugin name. */
'plugin_already_active' => __( 'No action taken. Plugin %1$s was already active.', 'tgmpa' ),
/* translators: 1: plugin name. */
'plugin_needs_higher_version' => __( 'Plugin not activated. A higher version of %s is needed for this theme. Please update the plugin.', 'tgmpa' ),
/* translators: 1: dashboard link. */
'complete' => __( 'All plugins installed and activated successfully. %1$s', 'tgmpa' ),
'dismiss' => __( 'Dismiss this notice', 'tgmpa' ),
'notice_cannot_install_activate' => __( 'There are one or more required or recommended plugins to install, update or activate.', 'tgmpa' ),
'contact_admin' => __( 'Please contact the administrator of this site for help.', 'tgmpa' ),
);

// Announce that the class is ready, and pass the object (for advanced use).
do_action_ref_array( 'tgmpa_init', array( $this ) );

Expand Down Expand Up @@ -335,81 +410,6 @@ public function init() {
return;
}

// Load class strings.
$this->strings = array(
'page_title' => __( 'Install Required Plugins', 'tgmpa' ),
'menu_title' => __( 'Install Plugins', 'tgmpa' ),
/* translators: %s: plugin name. */
'installing' => __( 'Installing Plugin: %s', 'tgmpa' ),
/* translators: %s: plugin name. */
'updating' => __( 'Updating Plugin: %s', 'tgmpa' ),
'oops' => __( 'Something went wrong with the plugin API.', 'tgmpa' ),
/* translators: 1: plugin name(s). */
'notice_can_install_required' => _n_noop(
'This theme requires the following plugin: %1$s.',
'This theme requires the following plugins: %1$s.',
'tgmpa'
),
/* translators: 1: plugin name(s). */
'notice_can_install_recommended' => _n_noop(
'This theme recommends the following plugin: %1$s.',
'This theme recommends the following plugins: %1$s.',
'tgmpa'
),
/* translators: 1: plugin name(s). */
'notice_ask_to_update' => _n_noop(
'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.',
'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.',
'tgmpa'
),
/* translators: 1: plugin name(s). */
'notice_ask_to_update_maybe' => _n_noop(
'There is an update available for: %1$s.',
'There are updates available for the following plugins: %1$s.',
'tgmpa'
),
/* translators: 1: plugin name(s). */
'notice_can_activate_required' => _n_noop(
'The following required plugin is currently inactive: %1$s.',
'The following required plugins are currently inactive: %1$s.',
'tgmpa'
),
/* translators: 1: plugin name(s). */
'notice_can_activate_recommended' => _n_noop(
'The following recommended plugin is currently inactive: %1$s.',
'The following recommended plugins are currently inactive: %1$s.',
'tgmpa'
),
'install_link' => _n_noop(
'Begin installing plugin',
'Begin installing plugins',
'tgmpa'
),
'update_link' => _n_noop(
'Begin updating plugin',
'Begin updating plugins',
'tgmpa'
),
'activate_link' => _n_noop(
'Begin activating plugin',
'Begin activating plugins',
'tgmpa'
),
'return' => __( 'Return to Required Plugins Installer', 'tgmpa' ),
'dashboard' => __( 'Return to the Dashboard', 'tgmpa' ),
'plugin_activated' => __( 'Plugin activated successfully.', 'tgmpa' ),
'activated_successfully' => __( 'The following plugin was activated successfully:', 'tgmpa' ),
/* translators: 1: plugin name. */
'plugin_already_active' => __( 'No action taken. Plugin %1$s was already active.', 'tgmpa' ),
/* translators: 1: plugin name. */
'plugin_needs_higher_version' => __( 'Plugin not activated. A higher version of %s is needed for this theme. Please update the plugin.', 'tgmpa' ),
/* translators: 1: dashboard link. */
'complete' => __( 'All plugins installed and activated successfully. %1$s', 'tgmpa' ),
'dismiss' => __( 'Dismiss this notice', 'tgmpa' ),
'notice_cannot_install_activate' => __( 'There are one or more required or recommended plugins to install, update or activate.', 'tgmpa' ),
'contact_admin' => __( 'Please contact the administrator of this site for help.', 'tgmpa' ),
);

do_action( 'tgmpa_register' );

/* After this point, the plugins should be registered and the configuration set. */
Expand Down

0 comments on commit 71ac1e2

Please sign in to comment.