Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
6d2fe8b
Merge branch 'develop' into trunk
afragen Jun 1, 2022
d1c346c
Merge branch 'develop' into trunk
afragen Jun 1, 2022
cc10758
update for initial commit
afragen Jun 2, 2022
cda4a6a
Merge branch 'develop' into trunk
afragen Jun 2, 2022
f7e3f64
Merge branch 'develop' into trunk
afragen Jun 7, 2022
2c5ae21
Merge branch 'develop' into trunk
afragen Jun 11, 2022
bf1f9da
Merge branch 'develop' into trunk
afragen Jun 23, 2022
5370b15
Merge branch 'develop' into trunk
afragen Jul 4, 2022
d648d68
Merge branch 'develop' into trunk
afragen Jul 28, 2022
84dcc8a
Merge branch 'develop' into trunk
afragen Aug 18, 2022
7d7ea2e
Merge branch 'develop' into trunk
afragen Sep 2, 2022
64ddbde
Merge branch 'develop' into trunk
afragen Sep 2, 2022
1f08770
update composer
afragen Sep 2, 2022
367f858
Merge branch 'develop' into trunk
afragen Sep 3, 2022
25dc6a5
Merge branch 'develop' into trunk
afragen Oct 15, 2022
7a82c29
Merge branch 'develop' into trunk
afragen Oct 18, 2022
689f38b
Merge branch 'develop' into trunk
afragen Oct 19, 2022
7ce8906
Remove unnecessary Qualifier and fix typo (#28)
Soean Oct 20, 2022
fc05ebf
Unused local variable 'required'. The value of the variable is overwr…
Soean Oct 20, 2022
897a4c0
Merge branch 'develop' into trunk
afragen Oct 25, 2022
7bc2b82
Merge branch 'develop' into trunk
afragen Oct 25, 2022
7fd7f7d
Merge branch 'develop' into trunk
afragen Oct 25, 2022
a38aae1
Merge branch 'develop' into trunk
afragen Oct 27, 2022
bcf8b66
Merge branch 'develop' into trunk
afragen Jan 2, 2023
aedfac9
Merge branch 'develop' into trunk
afragen Feb 1, 2023
4052e80
Merge branch 'develop' into trunk
afragen Feb 8, 2023
8918b20
Merge branch 'develop' into trunk
afragen Feb 10, 2023
a4b552a
Merge branch 'develop' into trunk
afragen Feb 11, 2023
e8a9f7c
Merge branch 'develop' into trunk
afragen Feb 12, 2023
57941a3
Merge branch 'develop' into trunk
afragen Mar 3, 2023
517f987
Merge branch 'develop' into trunk
afragen Mar 3, 2023
bdf8dbf
Merge branch 'develop' into trunk
afragen Apr 5, 2023
0a34b0a
Merge branch 'develop' into trunk
afragen Apr 7, 2023
4586cba
Revert "tabs v spaces"
afragen Apr 7, 2023
bd55680
Merge branch 'develop' into trunk
afragen Apr 7, 2023
061d981
Merge branch 'develop' into trunk
afragen Apr 11, 2023
e28cdf6
Merge branch 'develop' into trunk
afragen Apr 29, 2023
15e3d6a
Adds a textdomain to I18N-strings
kebbet May 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function() {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
$tab = isset( $_GET['tab'] ) ? sanitize_title_with_dashes( wp_unslash( $_GET['tab'] ) ) : '';
if ( 'dependencies' === $tab ) {
echo '<p>' . esc_html__( 'These suggestions are based on dependencies required by installed plugins.' ) . '</p>';
echo '<p>' . esc_html__( 'These suggestions are based on dependencies required by installed plugins.', 'wp-plugin-dependencies' ) . '</p>';
}
}
);
Expand All @@ -93,7 +93,7 @@ function() {
* @return array
*/
public function add_install_tab( $tabs ) {
$tabs['dependencies'] = _x( 'Dependencies', 'Plugin Installer' );
$tabs['dependencies'] = _x( 'Dependencies', 'Plugin Installer tab name', 'wp-plugin-dependencies' );

return $tabs;
}
Expand Down
49 changes: 26 additions & 23 deletions wp-admin/includes/class-wp-plugin-dependencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public function modify_plugin_row_elements( $plugin_file, $plugin_data ) {
$sources = $this->get_dependency_sources( $plugin_data );
$requires_filepaths = $this->get_requires_paths( $plugin_data );
print '<script>';
print 'jQuery("tr[data-plugin=\'' . esc_attr( $plugin_file ) . '\'] .plugin-version-author-uri").append("<br><br><strong>' . esc_html__( 'Required by:' ) . '</strong> ' . esc_html( $sources ) . '");';
print 'jQuery("tr[data-plugin=\'' . esc_attr( $plugin_file ) . '\'] .plugin-version-author-uri").append("<br><br><strong>' . esc_html__( 'Required by:', 'wp-plugin-dependencies' ) . '</strong> ' . esc_html( $sources ) . '");';
foreach ( $requires_filepaths as $filepath ) {
if ( is_plugin_active( $filepath ) ) {
print 'jQuery(".active[data-plugin=\'' . esc_attr( $plugin_file ) . '\'] .check-column input").remove();';
Expand All @@ -395,7 +395,7 @@ public function modify_plugin_row_elements_requires( $plugin_file ) {
$links = $this->get_view_details_links( $plugin_file, $names );

print '<script>';
print 'jQuery("tr[data-plugin=\'' . esc_attr( $plugin_file ) . '\'] .plugin-version-author-uri").append("<br><br><strong>' . esc_html__( 'Requires:' ) . '</strong> ' . wp_kses_post( $links ) . '");';
print 'jQuery("tr[data-plugin=\'' . esc_attr( $plugin_file ) . '\'] .plugin-version-author-uri").append("<br><br><strong>' . esc_html__( 'Requires:', 'wp-plugin-dependencies' ) . '</strong> ' . wp_kses_post( $links ) . '");';
print '</script>';
}

Expand Down Expand Up @@ -424,9 +424,9 @@ public function modify_plugin_install_action_links( $action_links, $plugin ) {
foreach ( $requires_arr as $req ) {
if ( ! $dependencies[ $req ] || is_plugin_inactive( $dependencies[ $req ] ) ) {
if ( str_contains( $action_links[0], 'activate-now' ) ) {
$action_links[0] = str_replace( __( 'Network Activate' ), __( 'Activate' ), $action_links[0] );
$action_links[0] = str_replace( __( 'Activate' ), _x( 'Cannot Activate', 'plugin' ), $action_links[0] );
$action_links[0] .= '<span class="screen-reader-text">' . __( 'Cannot activate due to unmet dependency' ) . '</span>';
$action_links[0] = str_replace( __( 'Network Activate', 'wp-plugin-dependencies' ), __( 'Activate', 'wp-plugin-dependencies' ), $action_links[0] );
$action_links[0] = str_replace( __( 'Activate', 'wp-plugin-dependencies' ), _x( 'Cannot Activate', 'plugin', 'wp-plugin-dependencies' ), $action_links[0] );
$action_links[0] .= '<span class="screen-reader-text">' . __( 'Cannot activate due to unmet dependency', 'wp-plugin-dependencies' ) . '</span>';
$action_links[0] = str_replace( 'activate-now', 'button-disabled', $action_links[0] );
if ( 'plugin-install.php' !== $pagenow ) {
$action_links[] = $this->get_dependency_link();
Expand Down Expand Up @@ -457,9 +457,9 @@ public function empty_package_remove_install_button( $action_links, $plugin ) {
) {
return $action_links;
}
$action_links[0] = str_replace( __( 'Network Install' ), __( 'Install' ), $action_links[0] );
$action_links[0] = str_replace( __( 'Install Now' ), _x( 'Cannot Install', 'plugin' ), $action_links[0] );
$action_links[0] .= '<span class="screen-reader-text">' . __( 'Cannot install due to empty package' ) . '</span>';
$action_links[0] = str_replace( __( 'Network Install', 'wp-plugin-dependencies' ), __( 'Install', 'wp-plugin-dependencies' ), $action_links[0] );
$action_links[0] = str_replace( __( 'Install Now', 'wp-plugin-dependencies' ), _x( 'Cannot Install', 'plugin', 'wp-plugin-dependencies' ), $action_links[0] );
$action_links[0] .= '<span class="screen-reader-text">' . __( 'Cannot install due to empty package', 'wp-plugin-dependencies' ) . '</span>';
$action_links[0] = str_replace( 'install-now', 'button-disabled', $action_links[0] );

return $action_links;
Expand All @@ -476,7 +476,7 @@ public function plugin_install_description( $description, $plugin ) {
$required = null;
if ( in_array( $plugin['slug'], array_keys( $this->plugin_data ), true ) ) {
$dependents = $this->get_dependency_sources( $plugin );
$required = '<strong>' . __( 'Required by:' ) . '</strong> ' . $dependents;
$required = '<strong>' . __( 'Required by:', 'wp-plugin-dependencies' ) . '</strong> ' . $dependents;
$description = $description . '<p>' . $required . '</p>';
}

Expand All @@ -486,7 +486,7 @@ public function plugin_install_description( $description, $plugin ) {
$file = $this->plugin_dirnames[ $plugin['slug'] ];
if ( in_array( $file, array_keys( $this->requires_plugins ), true ) ) {
$require_names = $this->get_requires_plugins_names( $file );
$requires = '<strong>' . __( 'Requires:' ) . '</strong> ' . $require_names;
$requires = '<strong>' . __( 'Requires:', 'wp-plugin-dependencies' ) . '</strong> ' . $require_names;
$description = $description . '<p>' . $requires . '</p>';
}

Expand Down Expand Up @@ -523,7 +523,7 @@ private function get_view_details_links( $plugin_file, $names ) {
"<a href='%s' class='thickbox open-plugin-details-modal' aria-label='%s' data-title='%s'>%s</a>",
esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data['slug'] . '&TB_iframe=true&width=600&height=550' ) ),
/* translators: %s: Plugin name. */
sprintf( __( 'More information about %s' ), $name_attr ),
sprintf( __( 'More information about %s', 'wp-plugin-dependencies' ), $name_attr ),
$name_attr,
$name
);
Expand Down Expand Up @@ -572,8 +572,8 @@ public function cannot_activate_unmet_dependencies( $actions, $plugin_file ) {

foreach ( $plugin_dependencies as $plugin_dependency ) {
if ( ! $dependencies[ $plugin_dependency ] || is_plugin_inactive( $dependencies[ $plugin_dependency ] ) ) {
$activate = _x( 'Cannot Activate', 'plugin' );
$activate .= '<span class="screen-reader-text">' . __( 'Cannot activate due to unmet dependency' ) . '</span>';
$activate = _x( 'Cannot Activate', 'plugin', 'wp-plugin-dependencies' );
$activate .= '<span class="screen-reader-text">' . __( 'Cannot activate due to unmet dependency', 'wp-plugin-dependencies' ) . '</span>';
$dependencies = $this->get_dependency_link();
unset( $actions['activate'] );
$actions = array_merge(
Expand Down Expand Up @@ -633,7 +633,7 @@ public function admin_notices() {
printf(
'<div class="notice-error notice is-dismissible"><p>'
/* translators: 1: plugin names, 2: link to Dependencies install page */
. esc_html__( '%1$s plugin(s) have been deactivated. There are uninstalled or inactive dependencies. Go to the %2$s install page.' )
. esc_html__( '%1$s plugin(s) have been deactivated. There are uninstalled or inactive dependencies. Go to the %2$s install page.', 'wp-plugin-dependencies' )
. '</p></div>',
'<strong>' . esc_html( $deactivated_plugins ) . '</strong>',
wp_kses_post( $this->get_dependency_link( true ) )
Expand All @@ -644,14 +644,14 @@ public function admin_notices() {
$intersect = array_intersect( $this->slugs, $installed_slugs );
asort( $intersect );
if ( $intersect !== $this->slugs ) {
$message_html = __( 'There are additional plugins that must be installed.' );
$message_html = __( 'There are additional plugins that must be installed.', 'wp-plugin-dependencies' );

// Display link (if not already on Dependencies install page).
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
$tab = isset( $_GET['tab'] ) ? sanitize_title_with_dashes( wp_unslash( $_GET['tab'] ) ) : '';
if ( 'plugin-install.php' !== $pagenow || 'dependencies' !== $tab ) {
$message_html .= ' ' . sprintf(
/* translators: 1: link to Dependencies install page */
/* translators: link to Dependencies install page */
__( 'Go to the %s install page.' ),
wp_kses_post( $this->get_dependency_link( true ) ),
'</a>'
Expand All @@ -667,9 +667,12 @@ public function admin_notices() {

$circular_dependencies = $this->get_circular_dependencies();
if ( ! empty( $circular_dependencies ) && count( $circular_dependencies ) > 1 ) {
/* translators: circular dependencies names */
$messages = sprintf( __( 'You have circular dependencies with the following plugins: %s' ), implode( ', ', $circular_dependencies['names'] ) );
$messages .= '<br>' . __( 'Please contact the plugin developers and make them aware.' );
$messages = sprintf(
/* translators: circular dependencies names */
__('You have circular dependencies with the following plugins: %s', 'wp-plugin-dependencies' ),
implode( ', ', $circular_dependencies['names'] )
);
$messages .= '<br>' . __( 'Please contact the plugin developers and make them aware.', 'wp-plugin-dependencies' );
printf(
'<div class="notice-warning notice is-dismissible"><p>%s</p></div>',
wp_kses_post( $messages )
Expand Down Expand Up @@ -773,9 +776,9 @@ private function get_dependency_sources( $plugin_data ) {
* @return string
*/
private function get_dependency_link( $notice = false ) {
$link_text = $notice ? __( 'Dependencies' ) : __( 'Manage Dependencies' );
$link_text = $notice ? __( 'Dependencies', 'wp-plugin-dependencies' ) : __( 'Manage Dependencies', 'wp-plugin-dependencies' );
$link = sprintf(
'<a href=' . esc_url( network_admin_url( 'plugin-install.php?tab=dependencies' ) ) . ' aria-label="' . __( 'Go to Dependencies tab of Add Plugins page.' ) . '">%s</a>',
'<a href=' . esc_url( network_admin_url( 'plugin-install.php?tab=dependencies' ) ) . ' aria-label="' . __( 'Go to Dependencies tab of Add Plugins page.', 'wp-plugin-dependencies' ) . '">%s</a>',
$link_text
);

Expand Down Expand Up @@ -830,7 +833,7 @@ private function get_empty_plugins_api_response( $response, $args ) {
$dependencies = $this->get_dependency_filepaths();
$file = $dependencies[ $slug ];
$args = $file ? $this->plugins[ $file ] : $args;
$short_description = __( 'You will need to manually install this dependency. Please contact the plugin\'s developer and ask them to add plugin dependencies support and for information on how to install the this dependency.' );
$short_description = __( 'You will need to manually install this dependency. Please contact the plugin\'s developer and ask them to add plugin dependencies support and for information on how to install the this dependency.', 'wp-plugin-dependencies' );
$response = array(
'name' => $args['Name'],
'slug' => $slug,
Expand All @@ -842,7 +845,7 @@ private function get_empty_plugins_api_response( $response, $args ) {
'requires_php' => $args['RequiresPHP'],
'sections' => array(
'description' => '<p>' . $args['Description'] . '</p>' . $short_description,
'installation' => __( 'Ask the plugin developer where to download and install this plugin dependency.' ),
'installation' => __( 'Ask the plugin developer where to download and install this plugin dependency.', 'wp-plugin-dependencies' ),
),
'short_description' => '<p>' . $args['Description'] . '</p>' . $short_description,
'download_link' => '',
Expand Down