Skip to content

Commit 1f0fc39

Browse files
committed
Change |ucfirst to |capitalize
1 parent bb2c8a7 commit 1f0fc39

File tree

14 files changed

+108
-72
lines changed

14 files changed

+108
-72
lines changed

.github/workflows/code-analysis.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: 'PHPStan'
1818
run: composer phpstan
1919
- name: 'Coding Standards'
20-
run: composer fix-cs
20+
run: composer check-cs
2121
name: ${{ matrix.actions.name }}
2222
runs-on: ubuntu-latest
2323
steps:

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release Notes for Campaign
22

3+
## 3.5.10 - Unreleased
4+
5+
### Changed
6+
7+
- Changed the use of the deprecated `|ucfirst` filter to `|capitalize` in all Twig templates.
8+
39
## 3.5.9 - 2024-12-31
410

511
### Changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "putyourlightson/craft-campaign",
33
"description": "Send and manage email campaigns, contacts and mailing lists.",
4-
"version": "3.5.9",
4+
"version": "3.5.10",
55
"type": "craft-plugin",
66
"homepage": "https://putyourlightson.com/plugins/campaign",
77
"license": "proprietary",

src/base/BaseMessageController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
/**
1414
* @since 1.10.0
15-
*/
15+
*/
1616
abstract class BaseMessageController extends Controller
1717
{
1818
/**

src/templates/_includes/contact-mailing-list-subscribe-row.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</th>
1212
<td>
1313
<label class="subscriptionStatus {{ subscriptionStatus ?: 'none' }}">
14-
{{ subscriptionStatus ? subscriptionStatus|ucfirst|t('campaign') : 'None'|t('campaign') }}
14+
{{ subscriptionStatus ? subscriptionStatus|capitalize|t('campaign') : 'None'|t('campaign') }}
1515
</label>
1616
</td>
1717
<td class="thin">

src/templates/reports/_includes/devices.twig

+9-4
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,24 @@
1111
<tbody>
1212
{% for device in devices %}
1313
<tr>
14-
<td data-title="{{ 'Device'|t('campaign') }}"><span class="device {{ device.device }}"></span> {{ device.device ? device.device|ucfirst|t('campaign') : 'Unknown'|t('campaign') }}</td>
14+
<td data-title="{{ 'Device'|t('campaign') }}">
15+
<span class="device {{ device.device }}"></span> {{ device.device ? device.device|capitalize|t('campaign') : 'Unknown'|t('campaign') }}
16+
</td>
1517
{% if reportUrl is not defined %}
1618
<td data-title="{{ 'OS'|t('campaign') }}">{{ device.os and device.os != 'UNK' ? device.os|t('campaign') : 'Unknown'|t('campaign') }}</td>
1719
<td data-title="{{ 'Client'|t('campaign') }}">{{ device.client and device.client != 'UNK' ? device.client|t('campaign') : 'Unknown'|t('campaign') }}</td>
18-
{% endif %}
19-
<td data-order="{{ device.count }}" data-title="{{ (countLabel ?? 'Count')|t('campaign') }}">{{ device.count }} <code>[{{ device.countRate }}%]</code></td>
20+
{% endif %}
21+
<td data-order="{{ device.count }}" data-title="{{ (countLabel ?? 'Count')|t('campaign') }}">{{ device.count }}
22+
<code>[{{ device.countRate }}%]</code></td>
2023
</tr>
2124
{% endfor %}
2225
</tbody>
2326
</table>
2427

2528
{% if reportUrl is defined %}
26-
<p><a href="{{ reportUrl }}" class="go">{{ "View details"|t('campaign') }}</a></p>
29+
<p>
30+
<a href="{{ reportUrl }}" class="go">{{ "View details"|t('campaign') }}</a>
31+
</p>
2732
{% else %}
2833
{{ include('campaign/reports/_includes/datatable', {
2934
id: 'devices',

src/templates/reports/campaigns/_includes/contact-activity.twig

+4-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
{% endif %}
4343
</th>
4444
<td data-title="{{ 'Interaction'|t('campaign') }}">
45-
{{ activity.interaction|ucfirst|t('campaign') }}
45+
{{ activity.interaction|capitalize|t('campaign') }}
4646
{% if activity.links|length %}
4747
{% set info %}
4848
<p>
@@ -65,7 +65,9 @@
6565

6666
{% if limit is defined %}
6767
{% if limit == contactActivity|length and reportUrl is defined %}
68-
<p><a href="{{ reportUrl }}" class="go">{{ "View all"|t('campaign') }}</a></p>
68+
<p>
69+
<a href="{{ reportUrl }}" class="go">{{ "View all"|t('campaign') }}</a>
70+
</p>
6971
{% endif %}
7072
{% else %}
7173
{{ include('campaign/reports/_includes/datatable', {

src/templates/reports/campaigns/_includes/report.twig

+24-11
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,18 @@
4242
</select>
4343
</div>
4444
<a href="#" data-id="refresh" class="refresh">
45-
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18"><path fill="#8f98a3" d="M9 13.5c-2.49 0-4.5-2.01-4.5-4.5S6.51 4.5 9 4.5c1.24 0 2.36.52 3.17 1.33L10 8h5V3l-1.76 1.76C12.15 3.68 10.66 3 9 3 5.69 3 3.01 5.69 3.01 9S5.69 15 9 15c2.97 0 5.43-2.16 5.9-5h-1.52c-.46 2-2.24 3.5-4.38 3.5z"/></svg>
45+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
46+
<path fill="#8f98a3" d="M9 13.5c-2.49 0-4.5-2.01-4.5-4.5S6.51 4.5 9 4.5c1.24 0 2.36.52 3.17 1.33L10 8h5V3l-1.76 1.76C12.15 3.68 10.66 3 9 3 5.69 3 3.01 5.69 3.01 9S5.69 15 9 15c2.97 0 5.43-2.16 5.9-5h-1.52c-.46 2-2.24 3.5-4.38 3.5z"/>
47+
</svg>
4648
</a>
4749
<div class="spinner big"></div>
4850
<div data-id="chart"></div>
4951
</div>
5052

5153
{% js %}
52-
new Campaign.Chart({
53-
action: 'campaign/reports/get-campaign-chart-data',
54-
campaignId: '{{ campaign.id }}'
54+
new Campaign.Chart({
55+
action: 'campaign/reports/get-campaign-chart-data',
56+
campaignId: '{{ campaign.id }}'
5557
});
5658
{% endjs %}
5759
{% else %}
@@ -90,24 +92,33 @@
9092
</tr>
9193
<tr>
9294
<th class="light">{{ 'Opened'|t('campaign') }}</th>
93-
<td>{{ linkInteration(data.campaign, 'opened') }} <code>[{{ data.campaign.getRate('opened') }}%]</code>
95+
<td>{{ linkInteration(data.campaign, 'opened') }}
96+
<code>[{{ data.campaign.getRate('opened') }}%]</code>
9497
</td>
9598
</tr>
9699
<tr>
97100
<th class="light">{{ 'Clicked'|t('campaign') }}</th>
98-
<td>{{ linkInteration(data.campaign, 'clicked') }} <code>[{{ data.campaign.getRate('clicked') }}%]</code></td>
101+
<td>{{ linkInteration(data.campaign, 'clicked') }}
102+
<code>[{{ data.campaign.getRate('clicked') }}%]</code>
103+
</td>
99104
</tr>
100105
<tr>
101106
<th class="light">{{ 'Unsubscribed'|t('campaign') }}</th>
102-
<td>{{ linkInteration(data.campaign, 'unsubscribed') }} <code>[{{ data.campaign.getRate('unsubscribed') }}%]</code></td>
107+
<td>{{ linkInteration(data.campaign, 'unsubscribed') }}
108+
<code>[{{ data.campaign.getRate('unsubscribed') }}%]</code>
109+
</td>
103110
</tr>
104111
<tr>
105112
<th class="light">{{ 'Complained'|t('campaign') }}</th>
106-
<td>{{ linkInteration(data.campaign, 'complained') }} <code>[{{ data.campaign.getRate('complained') }}%]</code></td>
113+
<td>{{ linkInteration(data.campaign, 'complained') }}
114+
<code>[{{ data.campaign.getRate('complained') }}%]</code>
115+
</td>
107116
</tr>
108117
<tr>
109118
<th class="light">{{ 'Bounced'|t('campaign') }}</th>
110-
<td>{{ linkInteration(data.campaign, 'bounced') }} <code>[{{ data.campaign.getRate('bounced') }}%]</code></td>
119+
<td>{{ linkInteration(data.campaign, 'bounced') }}
120+
<code>[{{ data.campaign.getRate('bounced') }}%]</code>
121+
</td>
111122
</tr>
112123
<tr>
113124
<th class="light">
@@ -167,8 +178,10 @@
167178
<tbody>
168179
{% for sendout in data.sendouts %}
169180
<tr>
170-
<th scope="row" data-title="{{ 'Title'|t('app') }}"><a href="{{ sendout.cpEditUrl }}">{{ sendout.title }}</a></th>
171-
<td data-title="{{ 'Sendout Type'|t('campaign') }}">{{ sendout.sendoutType|ucfirst }}</td>
181+
<th scope="row" data-title="{{ 'Title'|t('app') }}">
182+
<a href="{{ sendout.cpEditUrl }}">{{ sendout.title }}</a>
183+
</th>
184+
<td data-title="{{ 'Sendout Type'|t('campaign') }}">{{ sendout.sendoutType|capitalize }}</td>
172185
<td data-title="{{ 'Recipients'|t('campaign') }}">{{ sendout.recipients }}</td>
173186
<td data-title="{{ 'Send Date'|t('campaign') }}">{{ sendout.sendDate ? sendout.sendDate|datetime }}</td>
174187
<td data-title="{{ 'Last Sent'|t('campaign') }}">{{ sendout.lastSent ? sendout.lastSent|datetime }}</td>

src/templates/reports/contacts/_includes/campaign-activity.twig

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
{% endif %}
1919
</th>
2020
<td data-title="{{ 'Interaction'|t('campaign') }}">
21-
{{ activity.interaction|ucfirst|t('campaign') }}
21+
{{ activity.interaction|capitalize|t('campaign') }}
2222
{% if activity.links|length %}
2323
<span class="info">
2424
<p>
@@ -38,7 +38,9 @@
3838
</table>
3939

4040
{% if limit is defined and limit == campaignActivity|length %}
41-
<p><a href="{{ url('campaign/reports/contacts/' ~ contact.id ~ '/campaign-activity') }}" class="go">{{ "View all"|t('campaign') }}</a></p>
41+
<p>
42+
<a href="{{ url('campaign/reports/contacts/' ~ contact.id ~ '/campaign-activity') }}" class="go">{{ "View all"|t('campaign') }}</a>
43+
</p>
4244
{% endif %}
4345

4446
{% else %}

src/templates/reports/contacts/_includes/mailinglist-activity.twig

+6-4
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
<span class="line-through">{{ model.mailingListTitle }}</span>
1818
{% endif %}
1919
</th>
20-
<td data-title="{{ 'Interaction'|t('campaign') }}">{{ activity.interaction|ucfirst|t('campaign') }}</td>
20+
<td data-title="{{ 'Interaction'|t('campaign') }}">{{ activity.interaction|capitalize|t('campaign') }}</td>
2121
<td data-title="{{ 'Source'|t('campaign') }}">
2222
{% if model.sourceType %}
2323
{% if activity.sourceUrl %}
24-
<a href="{{ activity.sourceUrl }}" class="go" target="_blank" rel="noopener">{{ model.sourceType|ucfirst|t('campaign') }}</a>
24+
<a href="{{ activity.sourceUrl }}" class="go" target="_blank" rel="noopener">{{ model.sourceType|capitalize|t('campaign') }}</a>
2525
{% else %}
26-
{{ model.sourceType|ucfirst|t('campaign') }}
26+
{{ model.sourceType|capitalize|t('campaign') }}
2727
{% endif %}
2828
{% endif %}
2929
</td>
@@ -34,7 +34,9 @@
3434
</table>
3535

3636
{% if limit is defined and limit == mailingListActivity|length %}
37-
<p><a href="{{ url('campaign/reports/contacts/' ~ contact.id ~ '/mailinglist-activity') }}" class="go">{{ "View all"|t('campaign') }}</a></p>
37+
<p>
38+
<a href="{{ url('campaign/reports/contacts/' ~ contact.id ~ '/mailinglist-activity') }}" class="go">{{ "View all"|t('campaign') }}</a>
39+
</p>
3840
{% endif %}
3941

4042
{% else %}

src/templates/reports/contacts/_includes/report.twig

+37-35
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44

55
<table class="data fullwidth fixed-layout">
66
<tbody>
7-
<tr>
8-
<th class="light">{{ "Email"|t('campaign') }}</th>
9-
<td>{{ contact.email }}</td>
10-
</tr>
11-
<tr>
12-
<th class="light">{{ "Location"|t('campaign') }}</th>
13-
<td>
14-
{% set geoIp = contact.geoIp %}
15-
{% if geoIp %}
16-
<span class="flag-icon flag-icon-{{ geoIp.countryCode ? geoIp.countryCode|lower : 'unknown' }}"></span>
17-
{{ geoIp.countryName }}
18-
<span class="info">
7+
<tr>
8+
<th class="light">{{ "Email"|t('campaign') }}</th>
9+
<td>{{ contact.email }}</td>
10+
</tr>
11+
<tr>
12+
<th class="light">{{ "Location"|t('campaign') }}</th>
13+
<td>
14+
{% set geoIp = contact.geoIp %}
15+
{% if geoIp %}
16+
<span class="flag-icon flag-icon-{{ geoIp.countryCode ? geoIp.countryCode|lower : 'unknown' }}"></span>
17+
{{ geoIp.countryName }}
18+
<span class="info">
1919
<p>
2020
{{ geoIp.city is defined ? ('City'|t('campaign') ~ ': ' ~ geoIp.city|escape ~ '<br>')|raw }}
2121
{{ geoIp.postCode is defined ? ('Post Code'|t('campaign') ~ ': ' ~ geoIp.postCode|escape ~ '<br>')|raw }}
@@ -25,29 +25,31 @@
2525
{{ geoIp.timeZone is defined ? ('Timezone'|t('campaign') ~ ': ' ~ geoIp.timeZone|escape ~ '<br>')|raw }}
2626
</p>
2727
</span>
28-
{% endif %}
29-
</td>
30-
</tr>
31-
<tr>
32-
<th class="light">{{ "Device"|t('campaign') }}</th>
33-
<td><span class="device {{ contact.device }}"></span> {{ contact.device ? contact.device|ucfirst|t('campaign') }}</td>
34-
</tr>
35-
<tr>
36-
<th class="light">{{ "OS"|t('campaign') }}</th>
37-
<td>{{ contact.os|t('campaign') }}</td>
38-
</tr>
39-
<tr>
40-
<th class="light">{{ "Client"|t('campaign') }}</th>
41-
<td>{{ contact.client|t('campaign') }}</td>
42-
</tr>
43-
<tr>
44-
<th class="light">{{ "Last Activity"|t('campaign') }}</th>
45-
<td>{{ contact.lastActivity ? contact.lastActivity|datetime }}</td>
46-
</tr>
47-
<tr>
48-
<th class="light">{{ "Verified"|t('campaign') }}</th>
49-
<td>{{ contact.verified ? contact.verified|datetime }}</td>
50-
</tr>
28+
{% endif %}
29+
</td>
30+
</tr>
31+
<tr>
32+
<th class="light">{{ "Device"|t('campaign') }}</th>
33+
<td>
34+
<span class="device {{ contact.device }}"></span> {{ contact.device ? contact.device|capitalize|t('campaign') }}
35+
</td>
36+
</tr>
37+
<tr>
38+
<th class="light">{{ "OS"|t('campaign') }}</th>
39+
<td>{{ contact.os|t('campaign') }}</td>
40+
</tr>
41+
<tr>
42+
<th class="light">{{ "Client"|t('campaign') }}</th>
43+
<td>{{ contact.client|t('campaign') }}</td>
44+
</tr>
45+
<tr>
46+
<th class="light">{{ "Last Activity"|t('campaign') }}</th>
47+
<td>{{ contact.lastActivity ? contact.lastActivity|datetime }}</td>
48+
</tr>
49+
<tr>
50+
<th class="light">{{ "Verified"|t('campaign') }}</th>
51+
<td>{{ contact.verified ? contact.verified|datetime }}</td>
52+
</tr>
5153
</tbody>
5254
</table>
5355

src/templates/reports/mailinglists/_includes/contact-activity.twig

+5-3
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
{% endif %}
2020
</th>
2121
<td data-title="{{ 'Interaction'|t('campaign') }}">
22-
{{ activity.interaction|ucfirst|t('campaign') }}
22+
{{ activity.interaction|capitalize|t('campaign') }}
2323
</td>
2424
<td data-title="{{ 'Source'|t('campaign') }}">
2525
{% if model.sourceType %}
26-
<a href="{{ activity.sourceUrl }}" class="go" target="_blank" rel="noopener">{{ model.sourceType|ucfirst|t('campaign') }}</a>
26+
<a href="{{ activity.sourceUrl }}" class="go" target="_blank" rel="noopener">{{ model.sourceType|capitalize|t('campaign') }}</a>
2727
{% endif %}
2828
</td>
2929
<td data-order="{{ activity.date|datetime('U') }}" data-title="{{ 'First Interaction'|t('campaign') }}">{{ activity.date|datetime }}</td>
@@ -35,7 +35,9 @@
3535

3636
{% if limit is defined %}
3737
{% if limit == contactActivity|length and reportUrl is defined %}
38-
<p><a href="{{ reportUrl }}" class="go">{{ "View all"|t('campaign') }}</a></p>
38+
<p>
39+
<a href="{{ reportUrl }}" class="go">{{ "View all"|t('campaign') }}</a>
40+
</p>
3941
{% endif %}
4042
{% else %}
4143
{{ include('campaign/reports/_includes/datatable', {

src/templates/reports/mailinglists/_includes/report.twig

+7-5
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
<br>
2323

2424
{% js %}
25-
new Campaign.Chart({
26-
action: 'campaign/reports/get-mailing-list-chart-data',
27-
mailingListId: '{{ mailingList.id }}'
25+
new Campaign.Chart({
26+
action: 'campaign/reports/get-mailing-list-chart-data',
27+
mailingListId: '{{ mailingList.id }}'
2828
});
2929
{% endjs %}
3030
{% else %}
@@ -96,8 +96,10 @@
9696
<tbody>
9797
{% for sendout in data.sendouts %}
9898
<tr>
99-
<th scope="row" data-title="{{ 'Title'|t('app') }}"><a href="{{ sendout.cpEditUrl }}">{{ sendout.title }}</a></th>
100-
<td data-title="{{ 'Sendout Type'|t('campaign') }}">{{ sendout.sendoutType|ucfirst }}</td>
99+
<th scope="row" data-title="{{ 'Title'|t('app') }}">
100+
<a href="{{ sendout.cpEditUrl }}">{{ sendout.title }}</a>
101+
</th>
102+
<td data-title="{{ 'Sendout Type'|t('campaign') }}">{{ sendout.sendoutType|capitalize }}</td>
101103
<td data-title="{{ 'Recipients'|t('campaign') }}">{{ sendout.recipients }}</td>
102104
<td data-title="{{ 'Send Date'|t('campaign') }}">{{ sendout.sendDate ? sendout.sendDate|datetime }}</td>
103105
<td data-title="{{ 'Last Sent'|t('campaign') }}">{{ sendout.lastSent ? sendout.lastSent|datetime }}</td>

tests/pest/phpunit.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/|version|/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
44
bootstrap="/var/www/html/vendor/autoload.php"
55
colors="true"
66
>
77
<testsuites>
88
<testsuite name="Test Suite">
9-
<directory suffix="Test.php">.</directory>
9+
<directory>.</directory>
1010
</testsuite>
1111
</testsuites>
1212
</phpunit>

0 commit comments

Comments
 (0)