Skip to content

Commit 2289007

Browse files
authored
Merge pull request #431 from codepress/release/4.7.20
Release 4.7.20
2 parents 7ab77ef + 5265f5d commit 2289007

31 files changed

+441
-348
lines changed

classes/Service/PluginUpdate.php

Lines changed: 99 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -12,118 +12,118 @@
1212
final class PluginUpdate implements Registerable
1313
{
1414

15-
private Plugin $plugin;
15+
private $plugin;
1616

17-
private Site $upgrade_url_template;
17+
private $upgrade_url_template;
1818

19-
public function __construct(Plugin $plugin, Site $upgrade_url_template)
20-
{
21-
$this->plugin = $plugin;
22-
$this->upgrade_url_template = $upgrade_url_template;
23-
}
19+
public function __construct(Plugin $plugin, Site $upgrade_url_template)
20+
{
21+
$this->plugin = $plugin;
22+
$this->upgrade_url_template = $upgrade_url_template;
23+
}
2424

25-
public function register(): void
26-
{
27-
add_action(
28-
'in_plugin_update_message-' . $this->plugin->get_basename(),
29-
[$this, 'render_additional_message'],
30-
10,
31-
2
32-
);
25+
public function register(): void
26+
{
27+
add_action(
28+
'in_plugin_update_message-' . $this->plugin->get_basename(),
29+
[$this, 'render_additional_message'],
30+
10,
31+
2
32+
);
3333

34-
// Use wp_clean_update_cache() to bypass cache
35-
add_filter('pre_set_site_transient_update_plugins', [$this, 'add_upgrade_notice_to_response'], 20);
34+
// Use wp_clean_update_cache() to bypass cache
35+
add_filter('pre_set_site_transient_update_plugins', [$this, 'add_upgrade_notice_to_response'], 20);
3636

37-
add_action('admin_head', function () {
38-
$screen = get_current_screen();
37+
add_action('admin_head', function () {
38+
$screen = get_current_screen();
3939

40-
if ( ! $screen || $screen->base !== 'plugins') {
41-
return;
42-
}
40+
if ( ! $screen || $screen->base !== 'plugins') {
41+
return;
42+
}
4343

44-
?>
44+
?>
4545

4646
<style>
4747
p.ac-plugin-icon-upgrade::before {
4848
content: '\f534' !important;
4949
}
5050
</style>
5151

52-
<?php
53-
});
54-
}
55-
56-
private function get_general_warning_message(): string
57-
{
58-
return __(
59-
'You are upgrading to a new a major version of Admin Columns, which can include <strong>breaking changes</strong>.',
60-
'codepress-admin-columns'
61-
);
62-
}
63-
64-
public function render_additional_message(array $data, object $response): void
65-
{
66-
$version = new Version($response->new_version);
67-
68-
if ($this->plugin->get_version()->get_major_version() >= $version->get_major_version()) {
69-
return;
70-
}
71-
72-
$tpl = $this->get_general_warning_message() . ' ' . _x(
73-
'Please review the %s for details.',
74-
'%s contains the link to upgrade guide. Label is translated separately.',
75-
'codepress-admin-columns'
76-
);
77-
78-
$tpl = wp_kses($tpl, [
79-
'strong' => [],
80-
]
81-
);
82-
83-
$url = sprintf((string)$this->upgrade_url_template, $version->get_major_version());
84-
85-
$url = sprintf(
86-
'<a href="%s" target="_blank">%s</a>',
87-
$url,
88-
esc_html_x('upgrade guide', 'Anchor text to upgrade guide.', 'codepress-admin-columns')
89-
);
90-
91-
$message = sprintf(
92-
$tpl,
93-
$url
94-
);
95-
96-
echo '</p><p class="ac-plugin-icon-upgrade">' . $message;
97-
}
98-
99-
/**
100-
* Add upgrade notice to the update message on the updates page in the WordPress admin
101-
*/
102-
public function add_upgrade_notice_to_response($transient): ?object
103-
{
104-
$basename = $this->plugin->get_basename();
105-
106-
if (
107-
is_object($transient) &&
108-
isset($transient->checked, $transient->response) &&
109-
! empty($transient->checked[$basename]) &&
110-
! empty($transient->response[$basename])
111-
) {
112-
$update_major = (new Version($transient->response[$basename]->new_version))->get_major_version();
113-
114-
if ($update_major > $this->plugin->get_version()->get_major_version()) {
115-
$notice = sprintf(
116-
'%s: %s %s',
117-
esc_html__('Warning'),
118-
strip_tags($this->get_general_warning_message()),
119-
esc_html__('See the Plugins page for details.', 'codepress-admin-columns')
120-
);
121-
122-
$transient->response[$basename]->upgrade_notice = $notice;
123-
}
124-
}
125-
126-
return $transient;
127-
}
52+
<?php
53+
});
54+
}
55+
56+
private function get_general_warning_message(): string
57+
{
58+
return __(
59+
'You are upgrading to a new a major version of Admin Columns, which can include <strong>breaking changes</strong>.',
60+
'codepress-admin-columns'
61+
);
62+
}
63+
64+
public function render_additional_message(array $data, object $response): void
65+
{
66+
$version = new Version($response->new_version);
67+
68+
if ($this->plugin->get_version()->get_major_version() >= $version->get_major_version()) {
69+
return;
70+
}
71+
72+
$tpl = $this->get_general_warning_message() . ' ' . _x(
73+
'Please review the %s for details.',
74+
'%s contains the link to upgrade guide. Label is translated separately.',
75+
'codepress-admin-columns'
76+
);
77+
78+
$tpl = wp_kses($tpl, [
79+
'strong' => [],
80+
]
81+
);
82+
83+
$url = sprintf((string)$this->upgrade_url_template, $version->get_major_version());
84+
85+
$url = sprintf(
86+
'<a href="%s" target="_blank">%s</a>',
87+
$url,
88+
esc_html_x('upgrade guide', 'Anchor text to upgrade guide.', 'codepress-admin-columns')
89+
);
90+
91+
$message = sprintf(
92+
$tpl,
93+
$url
94+
);
95+
96+
echo '</p><p class="ac-plugin-icon-upgrade">' . $message;
97+
}
98+
99+
/**
100+
* Add upgrade notice to the update message on the updates page in the WordPress admin
101+
*/
102+
public function add_upgrade_notice_to_response($transient)
103+
{
104+
$basename = $this->plugin->get_basename();
105+
106+
if (
107+
is_object($transient) &&
108+
isset($transient->checked, $transient->response) &&
109+
! empty($transient->checked[$basename]) &&
110+
! empty($transient->response[$basename])
111+
) {
112+
$update_major = (new Version($transient->response[$basename]->new_version))->get_major_version();
113+
114+
if ($update_major > $this->plugin->get_version()->get_major_version()) {
115+
$notice = sprintf(
116+
'%s: %s %s',
117+
esc_html__('Warning'),
118+
strip_tags($this->get_general_warning_message()),
119+
esc_html__('See the Plugins page for details.', 'codepress-admin-columns')
120+
);
121+
122+
$transient->response[$basename]->upgrade_notice = $notice;
123+
}
124+
}
125+
126+
return $transient;
127+
}
128128

129129
}

codepress-admin-columns.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/*
33
Plugin Name: Admin Columns
4-
Version: 4.7.19
4+
Version: 4.7.20
55
Description: Customize columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
66
Author: AdminColumns.com
77
Author URI: https://www.admincolumns.com
@@ -37,7 +37,7 @@
3737
}
3838

3939
define('AC_FILE', __FILE__);
40-
define('AC_VERSION', '4.7.19');
40+
define('AC_VERSION', '4.7.20');
4141

4242
require_once __DIR__ . '/classes/Dependencies.php';
4343

languages/codepress-admin-columns-ar_AR.po

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ msgstr ""
1111
"Language: ar\n"
1212
"Project-Id-Version: Plugins - Admin Columns - Stable (latest release)\n"
1313

14+
#: templates/admin/side-banner.php:118
15+
msgid "Get up to %s Off!"
16+
msgstr ""
17+
18+
#: classes/Promo/BlackFriday.php:32
19+
msgid "Save up to %s from Black Friday to Cyber Monday"
20+
msgstr ""
21+
1422
#: templates/admin/edit-menu.php:35
1523
msgid "View %s"
1624
msgstr ""
@@ -990,11 +998,7 @@ msgstr ""
990998
msgid "Filter by Term"
991999
msgstr ""
9921000

993-
#: classes/Promo/BlackFriday.php:22
994-
msgid "%s Off from Black Friday to Cyber Monday"
995-
msgstr ""
996-
997-
#: classes/Check/Promotion.php:76
1001+
#: classes/Promo/BlackFriday.php:39
9981002
msgid "Get %s now"
9991003
msgstr ""
10001004

@@ -1345,7 +1349,7 @@ msgstr ""
13451349
msgid "User Nicename"
13461350
msgstr ""
13471351

1348-
#: templates/admin/side-banner.php:166
1352+
#: templates/admin/side-banner.php:168
13491353
msgid "Send me the discount"
13501354
msgstr ""
13511355

@@ -1603,7 +1607,7 @@ msgstr ""
16031607
msgid "Full Path"
16041608
msgstr ""
16051609

1606-
#: templates/admin/side-banner.php:123
1610+
#: templates/admin/side-banner.php:125
16071611
msgid "Discount is valid until %s"
16081612
msgstr ""
16091613

@@ -1677,19 +1681,19 @@ msgstr ""
16771681
msgid "I'm using Admin Columns for WordPress!"
16781682
msgstr ""
16791683

1680-
#: templates/admin/side-banner.php:162
1684+
#: templates/admin/side-banner.php:164
16811685
msgid "Your First Name"
16821686
msgstr ""
16831687

1684-
#: templates/admin/side-banner.php:158
1688+
#: templates/admin/side-banner.php:160
16851689
msgid "Your Email"
16861690
msgstr ""
16871691

1688-
#: templates/admin/side-banner.php:143
1692+
#: templates/admin/side-banner.php:145
16891693
msgid "Submit your email and we'll send you a discount for %s off."
16901694
msgstr ""
16911695

1692-
#: templates/admin/side-banner.php:117 templates/admin/side-banner.php:136
1696+
#: templates/admin/side-banner.php:138
16931697
msgid "Get %s Off!"
16941698
msgstr ""
16951699

languages/codepress-admin-columns-bg_BG.po

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ msgstr ""
1111
"Language: bg\n"
1212
"Project-Id-Version: Plugins - Admin Columns - Stable (latest release)\n"
1313

14+
#: templates/admin/side-banner.php:118
15+
msgid "Get up to %s Off!"
16+
msgstr ""
17+
18+
#: classes/Promo/BlackFriday.php:32
19+
msgid "Save up to %s from Black Friday to Cyber Monday"
20+
msgstr ""
21+
1422
#: templates/admin/edit-menu.php:35
1523
msgid "View %s"
1624
msgstr ""
@@ -982,11 +990,7 @@ msgstr ""
982990
msgid "Filter by Term"
983991
msgstr ""
984992

985-
#: classes/Promo/BlackFriday.php:22
986-
msgid "%s Off from Black Friday to Cyber Monday"
987-
msgstr ""
988-
989-
#: classes/Check/Promotion.php:76
993+
#: classes/Promo/BlackFriday.php:39
990994
msgid "Get %s now"
991995
msgstr ""
992996

@@ -1337,7 +1341,7 @@ msgstr "Откъса липсва."
13371341
msgid "User Nicename"
13381342
msgstr "Потребителски пряков"
13391343

1340-
#: templates/admin/side-banner.php:166
1344+
#: templates/admin/side-banner.php:168
13411345
msgid "Send me the discount"
13421346
msgstr "Изпратете ми отстъпка"
13431347

@@ -1595,7 +1599,7 @@ msgstr "Стандартно"
15951599
msgid "Full Path"
15961600
msgstr "Пълен път"
15971601

1598-
#: templates/admin/side-banner.php:123
1602+
#: templates/admin/side-banner.php:125
15991603
msgid "Discount is valid until %s"
16001604
msgstr "Отстъпката е валидна до %s"
16011605

@@ -1665,19 +1669,19 @@ msgstr "Изчистване на всички колони"
16651669
msgid "I'm using Admin Columns for WordPress!"
16661670
msgstr "Аз използвам Admin Columns за WordPress!"
16671671

1668-
#: templates/admin/side-banner.php:162
1672+
#: templates/admin/side-banner.php:164
16691673
msgid "Your First Name"
16701674
msgstr "Вашето първо име"
16711675

1672-
#: templates/admin/side-banner.php:158
1676+
#: templates/admin/side-banner.php:160
16731677
msgid "Your Email"
16741678
msgstr "Вашият Email"
16751679

1676-
#: templates/admin/side-banner.php:143
1680+
#: templates/admin/side-banner.php:145
16771681
msgid "Submit your email and we'll send you a discount for %s off."
16781682
msgstr "Подайте Вашият email и ние ще Ви изпратим отстъпка от %s."
16791683

1680-
#: templates/admin/side-banner.php:117 templates/admin/side-banner.php:136
1684+
#: templates/admin/side-banner.php:138
16811685
msgid "Get %s Off!"
16821686
msgstr "Вземете %s отстъпка!"
16831687

0 commit comments

Comments
 (0)