• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / whip / 7300735247

22 Dec 2023 02:07PM UTC coverage: 31.683% (+3.0%) from 28.713%
7300735247

push

github

web-flow
Merge pull request #157 from Yoast/move-to-namespace-v2

Move source classes to the `Yoast\WHIPv2` namespace

30 of 114 new or added lines in 18 files covered. (26.32%)

96 of 303 relevant lines covered (31.68%)

2.66 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Messages/UpgradePhpMessage.php
1
<?php
2

3
namespace Yoast\WHIPv2\Messages;
4

5
use Yoast\WHIPv2\Host;
6
use Yoast\WHIPv2\Interfaces\Message;
7
use Yoast\WHIPv2\MessageFormatter;
8

9
/**
10
 * Class UpgradePhpMessage
11
 */
12
class UpgradePhpMessage implements Message {
13

14
        /**
15
         * The text domain to use for the translations.
16
         *
17
         * @var string
18
         */
19
        private $textdomain;
20

21
        /**
22
         * UpgradePhpMessage constructor.
23
         *
24
         * @param string $textdomain The text domain to use for the translations.
25
         */
NEW
26
        public function __construct( $textdomain ) {
×
NEW
27
                $this->textdomain = $textdomain;
×
28
        }
29

30
        /**
31
         * Retrieves the message body to display.
32
         *
33
         * @return string The message to display.
34
         */
NEW
35
        public function body() {
×
NEW
36
                $textdomain = $this->textdomain;
×
37

NEW
38
                $message = array();
×
39

NEW
40
                $message[] = MessageFormatter::strongParagraph( \__( 'Your site could be faster and more secure with a newer PHP version.', $textdomain ) ) . '<br />';
×
NEW
41
                $message[] = MessageFormatter::paragraph( \__( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and all its plugins and themes are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you to this notice.', $textdomain ) );
×
NEW
42
                $message[] = MessageFormatter::paragraph( \__( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', $textdomain ) );
×
NEW
43
                $message[] = MessageFormatter::strongParagraph( \__( 'To which version should I update?', $textdomain ) ) . '<br />';
×
NEW
44
                $message[] = MessageFormatter::paragraph(
×
NEW
45
                        \sprintf(
×
46
                                /* translators: 1: link open tag; 2: link close tag. */
NEW
47
                                \__( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. We have an article on how to test whether that\'s an option for you %1$shere%2$s. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', $textdomain ),
×
NEW
48
                                '<a href="https://yoa.st/wg" target="_blank">',
×
49
                                '</a>'
50
                        )
51
                );
52

NEW
53
                if ( Host::name() !== '' ) {
×
NEW
54
                        $hostMessage = new HostMessage( 'WHIP_MESSAGE_FROM_HOST_ABOUT_PHP', $textdomain );
×
NEW
55
                        $message[]   = $hostMessage->body();
×
56
                }
57

NEW
58
                $hostingPageUrl = Host::hostingPageUrl();
×
59

NEW
60
                $message[] = MessageFormatter::strongParagraph( \__( 'Can\'t update? Ask your host!', $textdomain ) ) . '<br />';
×
61

NEW
62
                if ( \function_exists( 'apply_filters' ) && \apply_filters( Host::HOSTING_PAGE_FILTER_KEY, false ) ) {
×
NEW
63
                        $message[] = MessageFormatter::paragraph(
×
NEW
64
                                \sprintf(
×
65
                                        /* translators: 1: link open tag; 2: link close tag; 3: link open tag. */
NEW
66
                                        \__( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. We have %1$sexamples here%2$s. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %3$sWordPress hosting partners%2$s.', $textdomain ),
×
NEW
67
                                        '<a href="https://yoa.st/wh" target="_blank">',
×
NEW
68
                                        '</a>',
×
NEW
69
                                        \sprintf( '<a href="%1$s" target="_blank">', \esc_url( $hostingPageUrl ) )
×
70
                                )
71
                        );
72
                }
73
                else {
NEW
74
                        $message[] = MessageFormatter::paragraph(
×
NEW
75
                                \sprintf(
×
76
                                        /* translators: 1: link open tag; 2: link close tag; 3: link open tag. */
NEW
77
                                        \__( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. We have %1$sexamples here%2$s. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of our recommended %3$sWordPress hosting partners%2$s, they\'ve all been vetted by the Yoast support team and provide all the features a modern host should provide.', $textdomain ),
×
NEW
78
                                        '<a href="https://yoa.st/wh" target="_blank">',
×
NEW
79
                                        '</a>',
×
NEW
80
                                        \sprintf( '<a href="%1$s" target="_blank">', \esc_url( $hostingPageUrl ) )
×
81
                                )
82
                        );
83
                }
84

NEW
85
                return \implode( "\n", $message );
×
86
        }
87
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc