deleted plugin `wp_mail_smtp.php`

This commit is contained in:
Gitium 2021-02-27 21:52:46 +00:00
parent 14b774a998
commit a60ce58ddd
860 changed files with 0 additions and 199188 deletions

View File

@ -1 +0,0 @@
#wpadminbar .wp-mail-smtp-admin-bar-menu-notification-counter,#wpadminbar .wp-mail-smtp-admin-bar-menu-error{display:inline-block !important;vertical-align:top !important;box-sizing:border-box !important;margin:7px 0 0 2px !important;padding:0 5px !important;min-width:18px !important;height:18px !important;border-radius:9px !important;background-color:#ca4a1f !important;color:#fff !important;font-size:11px !important;line-height:1.6 !important;text-align:center !important}#wpadminbar .wp-mail-smtp-admin-bar-menu-notification-counter span,#wpadminbar .wp-mail-smtp-admin-bar-menu-error span{line-height:1 !important;font-size:11px !important}

View File

@ -1 +0,0 @@
#wp-mail-smtp-notifications{position:relative;background:#FFFFFF 0 0 no-repeat padding-box;box-shadow:0 5px 15px #0000000D;border-radius:6px;opacity:1;min-height:48px;padding:15px 102px 15px 72px;margin:0 0 14px 0}#wp-mail-smtp-notifications *{box-sizing:border-box}#wp-mail-smtp-notifications .bell{position:absolute;top:15px;left:15px;width:42px;height:48px}#wp-mail-smtp-notifications .messages .message{display:none}#wp-mail-smtp-notifications .messages .message.current{display:block}#wp-mail-smtp-notifications .messages .message .title{font-weight:bold;font-size:17px;line-height:20px;margin:0;color:#444}#wp-mail-smtp-notifications .messages .message .content{font-weight:normal;font-size:13px;line-height:20px;margin:6px 0 40px 0}#wp-mail-smtp-notifications .messages .message .buttons{margin:-30px 80px 0 0}#wp-mail-smtp-notifications .messages .message .buttons a{margin:0 6px 0 0;padding:8px 10px;line-height:13px;font-size:13px;min-height:unset}#wp-mail-smtp-notifications .messages .message .buttons .button-secondary{border:1px solid #0071A1}#wp-mail-smtp-notifications .dismiss{position:absolute;top:15px;right:15px;width:16px;height:16px;color:#72777C;font-size:16px;cursor:pointer;text-align:center;vertical-align:middle;line-height:16px}#wp-mail-smtp-notifications .dismiss:hover{color:#dc3232}#wp-mail-smtp-notifications .navigation{position:absolute;bottom:15px;right:15px;width:63px;height:30px}#wp-mail-smtp-notifications .navigation a{display:block;width:30px;height:30px;border:1px solid #7E8993;border-radius:3px;font-size:8px;text-align:center;vertical-align:middle;line-height:30px;cursor:pointer;background-color:#ffffff;color:#41454A}#wp-mail-smtp-notifications .navigation a:hover{background-color:#f1f1f1}#wp-mail-smtp-notifications .navigation a .dashicons{margin-top:8px;font-size:12px}#wp-mail-smtp-notifications .navigation .prev{float:left}#wp-mail-smtp-notifications .navigation .next{float:right}#wp-mail-smtp-notifications .navigation .disabled{border-color:#dddddd;color:#A0A5AA;cursor:default}#wp-mail-smtp-notifications .navigation .disabled:hover{background-color:#ffffff}@media screen and (max-width: 768px){#wp-mail-smtp-notifications{padding:15px 15px 15px 72px}#wp-mail-smtp-notifications .messages .message .title{margin:0 30px 0 0}#wp-mail-smtp-notifications .messages .message .content{font-size:16px;line-height:24px}#wp-mail-smtp-notifications .messages .message .buttons{margin:-30px 80px 0 0}#wp-mail-smtp-notifications .messages .message .buttons a{margin:0;display:table}#wp-mail-smtp-notifications .messages .message .buttons .button-secondary{margin-top:6px}}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
<svg viewBox="0 0 37 28" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.41"><path d="M12.29 26.46c.33.38.75.56 1.27.56s.93-.18 1.26-.56L35.56 5.8c.33-.33.5-.75.5-1.27 0-.51-.17-.93-.5-1.26L32.96.73a1.57 1.57 0 00-1.23-.57c-.5 0-.92.2-1.3.57L13.56 17.6 5.68 9.73c-.37-.38-.8-.57-1.3-.57s-.9.2-1.23.57l-2.6 2.53c-.33.33-.5.75-.5 1.26 0 .52.17.94.5 1.27l11.74 11.67z" fill="#6ab255" fill-rule="nonzero"/></svg>

Before

Width:  |  Height:  |  Size: 480 B

View File

@ -1 +0,0 @@
<svg viewBox="0 0 33 33" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.41"><path d="M27.6 32.36a1.93 1.93 0 01-1.43.58 1.93 1.93 0 01-1.41-.58l-8.09-8.08-8.08 8.08a1.93 1.93 0 01-1.42.58 1.93 1.93 0 01-1.41-.58l-4.5-4.5a1.93 1.93 0 01-.59-1.42c0-.55.2-1.03.59-1.42l8.08-8.08-8.08-8.08a1.93 1.93 0 01-.59-1.42c0-.55.2-1.03.59-1.42l4.5-4.5A1.93 1.93 0 017.18.95c.55 0 1.02.2 1.41.58l8.09 8.09 8.08-8.08a1.93 1.93 0 011.41-.59c.56 0 1.03.2 1.42.59l4.5 4.5c.4.38.58.86.58 1.41 0 .56-.19 1.03-.58 1.42l-8.08 8.08 8.08 8.08c.4.4.58.87.58 1.42 0 .56-.19 1.03-.58 1.42l-4.5 4.5z" fill="#d83638" fill-rule="nonzero"/></svg>

Before

Width:  |  Height:  |  Size: 688 B

View File

@ -1 +0,0 @@
<svg viewBox="0 0 53 53" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-miterlimit="10"><path d="M37.6 42.36a1.93 1.93 0 01-1.43.58 1.93 1.93 0 01-1.41-.58l-8.08-8.08-8.09 8.08a1.93 1.93 0 01-1.42.58 1.93 1.93 0 01-1.41-.58l-4.5-4.5a1.93 1.93 0 01-.59-1.42c0-.55.2-1.03.59-1.41l8.08-8.09-8.08-8.08a1.93 1.93 0 01-.59-1.42c0-.55.2-1.03.59-1.41l4.5-4.5a1.93 1.93 0 011.41-.59 1.93 1.93 0 011.42.59l8.09 8.08 8.08-8.08a1.93 1.93 0 011.42-.59 1.93 1.93 0 011.41.59l4.5 4.5c.4.38.58.86.58 1.41 0 .56-.19 1.03-.58 1.42l-8.08 8.08 8.08 8.09c.4.38.58.86.58 1.41s-.19 1.03-.58 1.42l-4.5 4.5z" fill="none" stroke="#d83638" stroke-width="2" stroke-dasharray="4,2"/></svg>

Before

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

View File

@ -1 +0,0 @@
<svg aria-hidden="true" data-prefix="fas" data-icon="check-circle" class="svg-inline--fa fa-check-circle fa-w-16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#2ecc71" d="M504 256a248 248 0 11-496 0 248 248 0 01496 0zM227 387l184-184c7-6 7-16 0-22l-22-23c-7-6-17-6-23 0L216 308l-70-70c-6-6-16-6-23 0l-22 23c-7 6-7 16 0 22l104 104c6 7 16 7 22 0z"/></svg>

Before

Width:  |  Height:  |  Size: 377 B

View File

@ -1 +0,0 @@
<svg aria-hidden="true" data-prefix="far" data-icon="exclamation-circle" class="svg-inline--fa fa-exclamation-circle fa-w-16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#e74c3c" d="M256 8a248 248 0 100 496 248 248 0 000-496zm0 448a200 200 0 11-.1-400.1A200 200 0 01256 456zm42-104a42 42 0 11-84 0 42 42 0 0184 0zm-81.4-211.4l6.8 136a12 12 0 0012 11.4h41.2a12 12 0 0012-11.4l6.8-136a12 12 0 00-12-12.6h-54.8a12 12 0 00-12 12.6z"/></svg>

Before

Width:  |  Height:  |  Size: 461 B

View File

@ -1 +0,0 @@
<svg aria-hidden="true" data-prefix="fas" data-icon="exclamation-circle" class="svg-inline--fa fa-exclamation-circle fa-w-16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#f1c40f" d="M504 256a248 248 0 11-496 0 248 248 0 01496 0zm-248 50a46 46 0 100 92 46 46 0 000-92zm-43.7-165.3l7.4 136a12 12 0 0012 11.3h48.6a12 12 0 0012-11.3l7.4-136a12 12 0 00-12-12.7h-63.4a12 12 0 00-12 12.7z"/></svg>

Before

Width:  |  Height:  |  Size: 415 B

View File

@ -1 +0,0 @@
<svg aria-hidden="true" data-prefix="fas" data-icon="exclamation-circle" class="svg-inline--fa fa-exclamation-circle fa-w-16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#DC3232" d="M504 256a248 248 0 11-496 0 248 248 0 01496 0zm-248 50a46 46 0 100 92 46 46 0 000-92zm-43.7-165.3l7.4 136a12 12 0 0012 11.3h48.6a12 12 0 0012-11.3l7.4-136a12 12 0 00-12-12.7h-63.4a12 12 0 00-12 12.7z"/></svg>

Before

Width:  |  Height:  |  Size: 415 B

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80"><g fill="none" stroke-width="8"><g data-name="wpf-loading-track" stroke="rgba(0,0,0,0.1)"><circle cx="40" cy="40" r="40" stroke="none"/><circle cx="40" cy="40" r="36"/></g><g data-name="wpf-loading-seqment" stroke="#6693af" stroke-linecap="round" stroke-dasharray="60 1000"><circle cx="40" cy="40" r="40" stroke="none"/><circle cx="40" cy="40" r="36"/></g></g></svg>

Before

Width:  |  Height:  |  Size: 429 B

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80"><g fill="none" stroke-width="8"><g data-name="wpf-loading-track" stroke="rgba(0,0,0,0.15)"><circle cx="40" cy="40" r="40" stroke="none"/><circle cx="40" cy="40" r="36"/></g><g data-name="wpf-loading-seqment" stroke="#fff" stroke-linecap="round" stroke-dasharray="60 1000"><circle cx="40" cy="40" r="40" stroke="none"/><circle cx="40" cy="40" r="36"/></g></g></svg>

Before

Width:  |  Height:  |  Size: 427 B

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80"><g fill="none" stroke-width="8"><g data-name="wpf-loading-track" stroke="rgba(0,0,0,0.1)"><circle cx="40" cy="40" r="40" stroke="none"/><circle cx="40" cy="40" r="36"/></g><g data-name="wpf-loading-seqment" stroke="#e27730" stroke-linecap="round" stroke-dasharray="60 1000"><circle cx="40" cy="40" r="40" stroke="none"/><circle cx="40" cy="40" r="36"/></g></g></svg>

Before

Width:  |  Height:  |  Size: 429 B

View File

@ -1 +0,0 @@
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" x="0" y="0" viewBox="0 0 232.7 60" xml:space="preserve"><style>.st1{fill:none}.st8,.st9{fill-rule:evenodd;clip-rule:evenodd;fill:#86a196}.st9{fill:#fff}</style><path d="M69.1 21.4l-4.4 12.4h-.1l-1.9-6.6-2-6.1h-3.1v.4l6 17.9h1.7l4.4-11.7h.1l4.4 11.7h1.6l6.1-17.9v-.4h-3.2l-1.9 6.1-1.8 6.5h-.1l-4.3-12.4h-1.5zm18.6 17.9h-3V21.1h7.5c3.4-.1 6.3 2.5 6.4 5.9v.5c.1 3.4-2.6 6.2-6 6.3h-5l.1 5.5zm-.1-8.1h4.6c2 0 3.5-1.6 3.5-3.6v-.2c.1-1.9-1.3-3.6-3.3-3.7h-4.8v7.5zm29-.7l-7.4-9.4h-1.1v18.2h3V27.9l5.3 6.7h.4l5.2-6.7v11.4h3.1V21.1H124l-7.4 9.4zm24.1-2.8v7.9c0 1.1 0 1.9 1.4 1.7v1.9c-1.8.3-3.6.1-3.6-2v-.5c-.7 1.7-2.5 2.8-4.3 2.7-3.8 0-5.7-3.1-5.7-6.6.1-4.2 3.1-6.4 7.1-6.4 1.8.1 3.5.5 5.1 1.3zM138 33v-3.7c-.8-.4-1.7-.5-2.6-.5-2.4 0-4 1.4-4.1 4.1 0 2.3 1.1 4.1 3.4 4.1 2.2 0 3.2-1.7 3.3-4zm6.6-10.1c0 .9.7 1.7 1.6 1.7h.1c.9 0 1.6-.6 1.7-1.5v-.2c-.1-.9-.9-1.6-1.8-1.6-.9.1-1.5.8-1.6 1.6zm3.1 4h-2.8v12.4h2.8V26.9zm3.6-6.6v14.5c0 4.2 1.8 5.2 5.6 4.5l-.1-2.2c-2.1.3-2.7-.3-2.7-2.4V20.3h-2.8zm13.5 13.9c.1 3.8 3.8 5.6 7.4 5.5 3.4 0 7.2-1.5 7.2-5.5 0-4.2-3.4-4.9-7.1-5.3-2.1-.3-4.2-.5-4.2-2.6s2.2-2.7 3.8-2.7 3.9.6 4 2.6h2.9c-.1-3.7-3.4-5.3-6.8-5.3s-6.8 1.8-6.8 5.5 3.3 4.7 6.6 5c2.1.2 4.6.4 4.6 2.8S174 37 172.1 37s-4.2-.8-4.4-2.8h-2.9zm26.4-3.7l-7.4-9.4h-1.1v18.2h3V27.9l5.3 6.7h.4l5.2-6.7v11.4h3V21.1h-1.1l-7.3 9.4zm16.6-6.7v15.5h3V23.8h5.2v-2.7h-13.5v2.7h5.3zm14 15.5h-3V21.1h7.5c3.4-.1 6.3 2.5 6.4 5.9v.5c.1 3.4-2.6 6.2-6 6.3h-5l.1 5.5zm0-8.1h4.6c2 0 3.5-1.6 3.5-3.6v-.2c.1-1.9-1.3-3.6-3.3-3.7h-4.8v7.5z" fill-rule="evenodd" clip-rule="evenodd" fill="#23282c"/><path class="st1" d="M-6.2 0h60v60h-60z"/><path d="M16.7 8.1c-4 2.1-6.9 5.8-7.9 10.2-10 8.3-11.4 23.1-3.1 33.1s23.1 11.4 33.1 3.1 11.4-23.1 3.1-33.1c-.9-1.1-2-2.2-3.1-3.1-1.2-4.9-4.7-9-9.4-10.8-.2-1.2-1-2.2-2.1-2.7C27.2 2.2 25 .3 22.5.4c-1.8.1-3.3 1.1-4 2.8-.8 1.5-1.4 3.2-1.8 4.9z" fill-rule="evenodd" clip-rule="evenodd" fill="#395360"/><path fill="#fbaa6f" d="M18 26h12v14H18z"/><path d="M25.9 33.2l-.1-.1c-.6-.5-.8-1.3-.3-2 .5-.6 1.3-.8 2-.3-.5.1-.9.4-1.2.8-.4.5-.6 1-.4 1.6zm-4.5 0c.1-.5 0-1.1-.4-1.5-.3-.4-.7-.7-1.2-.8.6-.5 1.5-.3 2 .3.4.6.3 1.5-.4 2 0-.1 0 0 0 0zm7.2-3.2h.5L28 34.8l-2.1 6.4h-4.3l-3.2-5.4 1.1-3.2c1.1 1.4 1.8 2.3 2.1 2.7.5.5 2.7.5 3.8-.5 1.2-1.5 2.3-3.1 3.2-4.8z" fill-rule="evenodd" clip-rule="evenodd" fill="#dc7f3c"/><path d="M9.7 29H15v-9h-4.1c.6-4.4 3.5-8.2 7.5-10 .8-3.3 1.7-5.6 2.7-6.8l.2-.2h.1c.3-.2.7-.4 1.1-.5 1.3-.2 2.5.7 2.7 1.9.1.7-.1 1.3-.5 1.8h-.1l-.3.3c-.5.5-.9 1-1.3 1.6.8-.8 1.9-1.4 3-1.5.2 0 .5.1.7.2.6.4.9 1.2.5 1.8l-.6.6c5.4 1.2 9.4 5.6 10.1 11l.1.9H33v8h4.8l1.8 13.4c-4.2 2.6-9.5 3.9-15.9 3.9s-11.5-1.3-15.7-4L9.7 29zm15.2 9.4c2.6-4.3 3.9-6.8 3.9-7.6 0-2.2-3.2-4.1-4.9-4.1S19 28.5 19 30.8c0 .8 1.3 3.4 3.8 7.6.2.4.6.6 1.1.6.4 0 .8-.2 1-.6z" fill-rule="evenodd" clip-rule="evenodd" fill="#bdcfc8"/><path class="st1" d="M19 31.1h9.6l-1.6 16h-6.4z"/><path d="M39.8 48.8c-6.6 8.9-19.1 10.7-28 4.1-1.6-1.2-2.9-2.5-4.1-4.1l.8-6.1c.3.1.7.2 1 .2 1.4 0 2.6-1 2.8-2.4v1.2c0 1.6 1.3 2.8 2.8 2.8s2.8-1.3 2.8-2.8v1.6c.1 1.6 1.4 2.8 3 2.7 1.4-.1 2.6-1.2 2.7-2.7 0 1.6 1.3 2.8 2.8 2.8s2.8-1.3 2.8-2.8v-1.6c0 1.6 1.3 2.8 2.8 2.8s2.8-1.3 2.8-2.8v-1.2C35.3 42 36.5 43 38 43c.3 0 .7-.1 1-.2l.8 6z" fill-rule="evenodd" clip-rule="evenodd" fill="#809eb0"/><path d="M8.3 44.7l.3-1.9c.3.1.7.2 1 .2 1.4 0 2.6-1 2.8-2.4v1.2c0 1.6 1.3 2.8 2.8 2.8s2.8-1.3 2.8-2.8v1.6c.1 1.6 1.4 2.8 3 2.7 1.4-.1 2.6-1.2 2.7-2.7 0 1.6 1.3 2.8 2.8 2.8s2.8-1.3 2.8-2.8v-1.6c0 1.6 1.3 2.8 2.8 2.8s2.8-1.3 2.8-2.8v-1.2C35.3 42 36.5 43 38 43c.3 0 .7-.1 1-.2l.2 1.9c-1.4.7-3.1.1-3.8-1.3-.1-.3-.2-.5-.3-.8v1.2c0 1.6-1.3 2.8-2.8 2.8s-2.8-1.3-2.8-2.8v1.6c0 1.6-1.3 2.8-2.8 2.8s-2.8-1.3-2.8-2.8c-.1 1.6-1.4 2.8-3 2.7-1.4-.1-2.6-1.2-2.7-2.7v-1.7c0 1.6-1.3 2.8-2.8 2.8s-2.8-1.3-2.8-2.8v-1.2C12.3 44 11 45 9.6 45c-.5 0-.9-.1-1.3-.3z" fill-rule="evenodd" clip-rule="evenodd" fill="#738e9e"/><path class="st8" d="M37.8 22.4c-1-2.9-3-4.7-4.7-4.5-2.2.2-2.7 3.8-2.3 8s1.7 7.6 3.9 7.3 4-3.9 3.7-8c-.1 1.2-.5 2.3-1.4 2.4-1.1.1-1.4-1.2-1.6-2.8s-.1-3 1-3.1c.5-.1 1.1.2 1.4.7z"/><path class="st9" d="M37 21.8c-.6-1.2-1.5-2-2.4-1.9-1.5.1-1.9 2.6-1.6 5.5s1.2 5.2 2.7 5c1.1-.1 1.9-1.5 2.2-3.4-.2.3-.5.5-.9.6-1.1.1-1.4-1.2-1.6-2.8s-.1-3 1-3.1c.2 0 .4 0 .6.1z"/><path class="st8" d="M9.6 22.4c1-2.9 3-4.7 4.7-4.5 2.2.2 2.7 3.8 2.3 8s-1.7 7.6-3.9 7.3-4-3.9-3.7-8c.1 1.2.5 2.3 1.4 2.4 1.1.1 1.4-1.2 1.6-2.8s.1-3-1-3.1c-.6-.1-1.1.2-1.4.7z"/><path class="st9" d="M10.4 21.8c.6-1.2 1.5-2 2.4-1.9 1.5.1 1.9 2.6 1.6 5.5s-1.2 5.2-2.7 5c-1.1-.1-1.9-1.5-2.2-3.4.2.3.5.5.9.6 1.1.1 1.4-1.2 1.6-2.8s.1-3-1-3.1c-.2-.1-.5 0-.6.1z"/><path d="M19 28.6v-.7c0-2.5 1.2-5.3 4.9-5.3s4.9 2.8 4.9 5.3c0 .3 0 .7-.1 1-.8-1.4-2.3-2.2-4.8-2.2-2.5.1-4 .8-4.9 1.9z" fill-rule="evenodd" clip-rule="evenodd" fill="#f4f8ff"/><path class="st8" d="M26.5 9.2L23.3 9l3.9-1.2c.1.6-.2 1.1-.7 1.4zM23 8.1l-1.3 1c.8-1.2 1.5-2.4 2-3.7.3-.8.4-1.7.3-2.6.8.4 1.3 1.3 1.2 2.2-.1.6-.3 1.1-.8 1.5-.5.5-1 1.1-1.4 1.6z"/></svg>

Before

Width:  |  Height:  |  Size: 4.9 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="#9ea3a8" width="64" height="64" viewBox="0 0 43 34"><path d="M.007 3.585v16.836q0 3.586 3.751 3.585L20 24v-5h10v-4.986l.991-1L34 13V3.585Q34 0 30.249 0H3.758Q.007 0 .007 3.585zm3.517 2.572a1.49 1.49 0 01-.508-.935 1.581 1.581 0 01.274-1.208 1.449 1.449 0 011.094-.663 1.756 1.756 0 011.25.312l11.409 7.716 11.331-7.716a1.96 1.96 0 011.289-.312 1.546 1.546 0 011.094.663 1.4 1.4 0 01.273 1.208 1.67 1.67 0 01-.547.935l-13.44 11.068z"/><path d="M22 28h10l-.009 4.624a1.126 1.126 0 001.922.8l8.25-8.236a1.126 1.126 0 000-1.594l-8.25-8.241a1.126 1.126 0 00-1.922.8v4.866L22 21v7z"/></svg>

Before

Width:  |  Height:  |  Size: 630 B

View File

@ -1 +0,0 @@
<svg width="40" height="17" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M31.5 0h-23a8.5 8.5 0 000 17h23a8.5 8.5 0 000-17z" fill="#999"/><path d="M7.51 5.36v7H9.3V10.4h1.26c1.8 0 2.82-.95 2.82-2.59 0-1.56-1.03-2.44-2.82-2.44H7.51zm1.79 1.4h1.17c.79 0 1.23.37 1.23 1.1 0 .74-.44 1.13-1.22 1.13H9.29V6.76zm9.23 5.6h2.02l-1.47-2.3c.82-.42 1.27-1.19 1.27-2.26 0-1.56-1.06-2.44-2.9-2.44H14.3v7h1.78V10.4h1.42l1.04 1.97zM16.1 9V6.76h1.35c.77 0 1.22.37 1.22 1.1 0 .74-.45 1.13-1.22 1.13H16.1zm8.78-3.69c-2.16 0-3.78 1.51-3.78 3.55 0 2.05 1.62 3.6 3.78 3.6 2.17 0 3.79-1.56 3.79-3.6 0-2.03-1.62-3.55-3.8-3.55zm.02 1.5c1.08 0 1.94.88 1.94 2.06 0 1.18-.86 2.1-1.94 2.1a2.04 2.04 0 01-1.98-2.1c0-1.18.9-2.07 1.98-2.07zm8.78 2.84v-1.1H32V6.87h-1.1v1.68h-1.66v1.1h1.67v1.67H32V9.64h1.68z" fill="#fff"/></svg>

Before

Width:  |  Height:  |  Size: 806 B

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 180"><path d="M84.4 65.4c0 3.7.4 6.7 1.1 8.9.8 2.2 1.8 4.6 3.2 7.2.5.8.7 1.6.7 2.3 0 1-.6 2-1.9 3L81.2 91c-.9.6-1.8.9-2.6.9-1 0-2-.5-3-1.4a31 31 0 01-3.6-4.7l-3.1-5.9a37 37 0 01-29.4 13.8c-8.4 0-15.1-2.4-20-7.2a25.7 25.7 0 01-7.4-19.2c0-8.5 3-15.4 9.1-20.6s14.2-7.8 24.5-7.8c3.4 0 6.9.3 10.6.8s7.5 1.3 11.5 2.2v-7.3c0-7.6-1.6-12.9-4.7-16-3.2-3.1-8.6-4.6-16.3-4.6-3.5 0-7.1.4-10.8 1.3A79.7 79.7 0 0021.7 20l-1.6.3c-1.4 0-2.1-1-2.1-3.1v-4.9c0-1.6.2-2.8.7-3.5s1.4-1.4 2.8-2.1A60.6 60.6 0 0149.7.3C61.6.3 70.3 3 75.9 8.4c5.5 5.4 8.3 13.6 8.3 24.6v32.4h.2zM43.8 80.6c3.3 0 6.7-.6 10.3-1.8 3.6-1.2 6.8-3.4 9.5-6.4 1.6-1.9 2.8-4 3.4-6.4.6-2.4 1-5.3 1-8.7v-4.2a83.5 83.5 0 00-18.6-2.3c-6.7 0-11.6 1.3-14.9 4-3.3 2.7-4.9 6.5-4.9 11.5 0 4.7 1.2 8.2 3.7 10.6 2.4 2.5 5.9 3.7 10.5 3.7zm80.3 10.8c-1.8 0-3-.3-3.8-1-.8-.6-1.5-2-2.1-3.9L94.7 9.2c-.6-2-.9-3.3-.9-4 0-1.6.8-2.5 2.4-2.5h9.8c1.9 0 3.2.3 3.9 1 .8.6 1.4 2 2 3.9l16.8 66.2 15.6-66.2c.5-2 1.1-3.3 1.9-3.9.8-.6 2.2-1 4-1h8c1.9 0 3.2.3 4 1 .8.6 1.5 2 1.9 3.9l15.8 67 17.3-67c.6-2 1.3-3.3 2-3.9.8-.6 2.1-1 3.9-1h9.3c1.6 0 2.5.8 2.5 2.5l-.2 1.6-.7 2.5-24.1 77.3c-.6 2-1.3 3.3-2.1 3.9s-2.1 1-3.8 1h-8.6c-1.9 0-3.2-.3-4-1-.8-.7-1.5-2-1.9-4L154 22l-15.4 64.4c-.5 2-1.1 3.3-1.9 4-.8.7-2.2 1-4 1h-8.6zm128.5 2.7a66.2 66.2 0 01-26.9-5.8c-1.6-.9-2.7-1.9-3.1-2.8a7 7 0 01-.6-2.8v-5.1c0-2.1.8-3.1 2.3-3.1l1.8.3 2.5 1a54.4 54.4 0 0022.9 4.7 27 27 0 0014.6-3.3c3.4-2.2 5.2-5.4 5.2-9.5 0-2.8-.9-5.1-2.7-7a25 25 0 00-10.1-5.2L244 51a30.5 30.5 0 01-16-10.2A23.8 23.8 0 01232.9 7c3-2.3 6.4-4 10.4-5.2A43.6 43.6 0 01262.6.5l6.5 1.1 5.7 1.6c1.8.6 3.2 1.2 4.2 1.8 1.4.8 2.4 1.6 3 2.5.6.8.9 1.9.9 3.3v4.7c0 2.1-.8 3.2-2.3 3.2-.8 0-2.1-.4-3.8-1.2a45.7 45.7 0 00-19.2-3.9c-5.7 0-10.2.9-13.3 2.8-3.1 1.9-4.7 4.8-4.7 8.9 0 2.8 1 5.2 3 7.1 2 1.9 5.7 3.8 11 5.5l14.2 4.5c7.2 2.3 12.4 5.5 15.5 9.6s4.6 8.8 4.6 14c0 4.3-.9 8.2-2.6 11.6a26.9 26.9 0 01-7.3 8.8 32.2 32.2 0 01-11.1 5.6 47.6 47.6 0 01-14.3 2.1z" fill="#262f3e"/><path d="M271.5 142.7c-32.9 24.3-80.7 37.2-121.8 37.2A220.3 220.3 0 011 123.2c-3.1-2.8-.3-6.6 3.4-4.4a299.9 299.9 0 00148.8 39.5 297 297 0 00113.5-23.2c5.5-2.5 10.2 3.6 4.8 7.6zm13.7-15.6c-4.2-5.4-27.8-2.6-38.5-1.3-3.2.4-3.7-2.4-.8-4.5 18.8-13.2 49.7-9.4 53.3-5 3.6 4.5-1 35.4-18.6 50.2-2.7 2.3-5.3 1.1-4.1-1.9 4-9.9 12.9-32.2 8.7-37.5z" fill="#f59931"/></svg>

Before

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -1 +0,0 @@
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" x="0" y="0" viewBox="0 0 254.8 80.3" xml:space="preserve"><style>.st0{fill:#4285f4}.st1{fill:#ea4335}</style><g id="XMLID_11_"><path id="XMLID_10_" class="st0" d="M31.9 28.6v8.6h20.5c-.6 4.8-2.2 8.3-4.7 10.8A21 21 0 0132 54.3C19.2 54.3 9.3 44 9.3 31.5a22.6 22.6 0 0138-16.7l6-6C48.4 3.7 41.5 0 32 0 14.6 0 0 14.1 0 31.4s14.6 31.4 31.9 31.4c9.3 0 16.4-3 21.9-8.8a28.4 28.4 0 007.4-20c0-2-.1-3.9-.4-5.4h-29z"/><path id="XMLID_24_" class="st1" d="M86.9 21.6A20 20 0 0066.5 42c0 11.7 9.2 20.3 20.4 20.3s20.3-8.6 20.3-20.3A20 20 0 0087 21.6zm0 32.6c-6.2 0-11.5-5-11.5-12.3 0-7.3 5.3-12.3 11.5-12.3s11.4 5 11.4 12.3C98.3 49 93 54.2 87 54.2z"/><path id="XMLID_21_" class="st0" d="M186.7 26.1h-.4a14 14 0 00-10.6-4.5c-10.2 0-19 8.8-19 20.3 0 11.4 8.8 20.3 19 20.3 4.8 0 8.7-2.2 10.6-4.6h.3v2.8c0 7.7-4.1 11.9-10.8 11.9-5.4 0-8.8-4-10.2-7.2l-7.7 3.2c2.2 5.3 8 12 18 12C186.2 80.2 195 74 195 59V22.6h-8.4v3.5zm-10.3 28c-6.1 0-10.8-5.2-10.8-12.2 0-7.2 4.7-12.3 10.8-12.3 6 0 10.8 5.2 10.8 12.4 0 7-4.7 12.2-10.8 12.2z"/><path id="XMLID_18_" d="M132.3 21.6A20 20 0 00111.9 42c0 11.7 9.2 20.3 20.4 20.3s20.3-8.6 20.3-20.3a20 20 0 00-20.3-20.3zm0 32.6c-6.2 0-11.5-5-11.5-12.3 0-7.3 5.3-12.3 11.5-12.3s11.4 5 11.4 12.3c0 7.2-5.3 12.3-11.4 12.3z" fill="#fbbc05"/><path id="XMLID_3_" d="M202 .8h8.8v61.4h-8.7V.8z" fill="#34a853"/><path id="XMLID_14_" class="st1" d="M237.9 54.2c-4.6 0-7.8-2-9.9-6.2l27.2-11.2-1-2.3c-1.6-4.5-6.8-12.9-17.3-12.9-10.4 0-19.1 8.2-19.1 20.3 0 11.4 8.6 20.3 20 20.3 9.4 0 14.7-5.7 17-9l-7-4.6a11.6 11.6 0 01-10 5.6zm-.6-25c3.6 0 6.6 1.9 7.6 4.5l-18.3 7.6c0-8.6 6-12 10.7-12z"/></g></svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 604 129"><path d="M213.2 74.3l-3.6 10.2h-.3c-.6-2.3-1.7-5.8-3.5-10L186.5 26h-18.9v77.3h12.5V55.6L180 45l-.4-4.9h.3c.6 3 1.3 5.2 1.8 6.6l23.2 56.4h8.8l23-56.9c.5-1.3 1-3.9 1.5-6.1h.3l-.6 13.9v49h13.3V25.8H233l-19.8 48.5zm50.6-26.7h13V103h-13zm6.6-23.4c-2.2 0-4 .8-5.5 2.2a7.1 7.1 0 00-2.3 5.4 7 7 0 002.3 5.3c1.5 1.4 3.3 2.1 5.5 2.1s4.1-.8 5.5-2.1a7.4 7.4 0 000-10.7 7.3 7.3 0 00-5.5-2.2m52.5 22.9c-2.4-.5-4.9-.8-7.3-.8-5.9 0-11.3 1.3-15.8 3.9a26.1 26.1 0 00-10.4 10.7 34 34 0 00-.1 30.3 24 24 0 009.8 9.9c4.1 2.3 8.9 3.5 14.3 3.5 6.2 0 11.5-1.3 15.7-3.7l.1-.1v-12l-.5.4a22.3 22.3 0 01-12.5 4.5c-5.2 0-9.3-1.5-12.2-4.8-3-3.2-4.5-7.6-4.5-13.1 0-5.7 1.5-10.2 4.6-13.5a16 16 0 0112.2-5c4.2 0 8.5 1.4 12.4 4.2l.5.4V49.2l-.1-.1c-1.7-.7-3.6-1.5-6.2-2m42.9-.4c-3.2 0-6.2 1-8.8 3.1a18.7 18.7 0 00-5 7.5h-.1v-9.7h-13V103h13V74.7c0-4.8 1-8.8 3.2-11.7 2.2-3 5-4.5 8.4-4.5 1.2 0 2.4.3 3.9.5 1.4.4 2.4.8 3.1 1.3l.5.4v-13l-.3-.1c-.9-.6-2.7-.9-4.9-.9m35.4-.3c-9.1 0-16.4 2.7-21.5 8a29.8 29.8 0 00-7.7 21.8c0 8.6 2.6 15.6 7.6 20.7 5 5 11.8 7.6 20.3 7.6 8.9 0 16-2.7 21.1-8.1a29.7 29.7 0 007.7-21.5 29 29 0 00-7.3-20.9c-4.7-5.1-11.6-7.6-20.2-7.6M411.6 89c-2.4 3.1-6.2 4.6-10.9 4.6s-8.5-1.5-11.2-4.8c-2.7-3.1-4-7.6-4-13.3a21 21 0 014-13.6c2.7-3.2 6.4-4.8 11.1-4.8 4.6 0 8.2 1.5 10.8 4.6 2.6 3.1 4 7.6 4 13.5-.2 6-1.3 10.7-3.8 13.8m46.1-18.4c-4.1-1.7-6.7-3-7.9-4.1-1-1-1.5-2.4-1.5-4.2 0-1.5.6-3 2.1-4s3.2-1.5 5.7-1.5c2.2 0 4.5.4 6.7 1s4.2 1.5 5.8 2.7l.5.4V48.7l-.3-.1a36 36 0 00-12.3-2.3c-6.2 0-11.3 1.5-15.3 4.8-4 3.1-5.9 7.3-5.9 12.2 0 2.6.4 4.9 1.3 6.8.9 1.9 2.2 3.7 4 5.2 1.8 1.4 4.4 3 8 4.5a81 81 0 016.7 3.1c1.4.8 2.3 1.7 3 2.4.5.8.8 1.8.8 3.1 0 3.7-2.8 5.5-8.5 5.5a27.8 27.8 0 01-14.5-5l-.5-.4v12.7l.3.1a38.8 38.8 0 0014.5 3.1c6.7 0 12.2-1.5 16.1-4.8 4-3.2 6.1-7.3 6.1-12.6 0-3.7-1-7-3.2-9.5a40.5 40.5 0 00-11.7-6.9m49.2-24.2c-9.1 0-16.4 2.7-21.5 8s-7.7 12.6-7.7 21.8c0 8.6 2.6 15.6 7.6 20.7 5 5 11.8 7.6 20.3 7.6 8.9 0 16-2.7 21.1-8.1a29.7 29.7 0 007.7-21.5 29 29 0 00-7.3-20.9c-4.7-5.1-11.6-7.6-20.2-7.6M517.2 89c-2.4 3.1-6.2 4.6-10.9 4.6-4.8 0-8.5-1.5-11.2-4.8-2.7-3.1-4-7.6-4-13.3a21 21 0 014-13.6c2.7-3.2 6.4-4.8 11.1-4.8 4.5 0 8.2 1.5 10.8 4.6 2.6 3.1 4 7.6 4 13.5 0 6-1.3 10.7-3.8 13.8m86.7-30.7V47.6h-13.1V31.2l-.4.1L578 35l-.3.1v12.5h-19.6v-7c0-3.2.8-5.7 2.2-7.3s3.5-2.4 6.1-2.4c1.8 0 3.7.4 5.8 1.3l.5.3V21.2l-.3-.1c-1.8-.6-4.2-1-7.3-1-3.9 0-7.3.9-10.4 2.4-3.1 1.7-5.4 4-7.1 7.1-1.7 3-2.6 6.4-2.6 10.3v7.7h-9.1v10.6h9.1V103h13.1V58.3h19.6v28.5c0 11.7 5.5 17.6 16.5 17.6 1.8 0 3.7-.3 5.5-.6a18 18 0 004.1-1.3l.1-.1V91.7l-.5.4c-.8.5-1.5.9-2.7 1.2-1 .3-1.9.4-2.6.4-2.6 0-4.4-.6-5.7-2.1-1.2-1.4-1.8-3.7-1.8-7.1V58.3h13.3z" fill="#737373"/><path fill="#F25022" d="M0 0h61.3v61.3H0z"/><path fill="#7FBA00" d="M67.7 0H129v61.3H67.7z"/><path fill="#00A4EF" d="M0 67.7h61.3V129H0z"/><path fill="#FFB900" d="M67.7 67.7H129V129H67.7z"/></svg>

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="152" height="80"><path d="M77.5 0C118.64 0 152 17.9 152 40s-33.35 40-74.5 40S0 62.1 0 40 36.35 0 77.5 0z" fill-rule="evenodd" fill="#777bb3"/><path d="M32.33 21.35h15.95q7.03.06 10.18 4.05t2.08 10.88a20.86 20.86 0 01-1.84 6.19 18.39 18.39 0 01-3.8 5.47 13.3 13.3 0 01-6.38 3.92 29.34 29.34 0 01-7.02.84h-7.14L32.09 64h-8.27l8.51-42.64m6.97 6.78l-3.58 17.84a4.38 4.38 0 00.72.06h.83a31.32 31.32 0 009.52-1.14q3.81-1.24 5.12-8.68 1.07-6.24-2.14-7.2a26.73 26.73 0 00-7.92-.89q-.71.06-1.37.06h-1.24l.05-.06M69.97 9.99h8.21l-2.32 11.36h7.38q6.07.12 9.05 2.5 3.03 2.38 1.78 9.04L90.1 52.7h-8.34l3.81-18.91q.6-2.98-.36-4.23t-4.1-1.25l-6.6-.06L69.6 52.7h-8.2L69.97 10m32.93 11.35h15.95q7.02.06 10.18 4.05t2.08 10.88a20.86 20.86 0 01-1.84 6.19 18.39 18.39 0 01-3.81 5.47 13.3 13.3 0 01-6.37 3.92 29.34 29.34 0 01-7.02.84h-7.15L102.66 64h-8.28l8.52-42.65m6.96 6.78l-3.57 17.85a4.38 4.38 0 00.72.05h.83a31.32 31.32 0 009.52-1.13q3.81-1.25 5.12-8.68 1.07-6.24-2.14-7.2a26.72 26.72 0 00-7.92-.9q-.71.07-1.37.07h-1.25l.06-.06" fill="#fff" fill-rule="evenodd"/></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1 +0,0 @@
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" x="0" y="0" viewBox="0 0 733.7 160" xml:space="preserve"><style>.st0{fill:#243846}.st2{fill:#3f7cbc}</style><path class="st0" d="M151.1 140.8l18.5-14.5c5.2 9 13.5 14.2 23 14.2 10.3 0 15.8-6.7 15.8-14 0-8.7-10.6-11.5-21.9-15-14.2-4.4-30.1-9.9-30.1-30.2 0-17 14.8-30.5 35.3-30.5 17.3 0 27.2 6.5 35.8 15.4l-16.7 12.6c-4.4-6.5-10.6-10-18.9-10-9.4 0-14.5 5.1-14.5 11.8 0 8.1 10.2 10.9 21.5 14.7 14.4 4.7 30.7 11 30.7 31.4 0 16.9-13.4 33.1-36.8 33.1-19.3.1-32.1-8.1-41.7-19zm162.6-55.1h19.8v8.1c4.7-6 11.8-9.6 20.1-9.6 17.1 0 27.5 11 27.5 29.8v44.3h-20.3v-41.7c0-9.7-4.5-15.4-13.4-15.4-7.6 0-13.8 5.2-13.8 17.4v39.7h-19.9V85.7zm72 36.4c0-25.7 18.9-37.8 35.3-37.8 9.4 0 16.9 3.5 21.7 8.6V52.3h19.9v106.1h-19.9v-8.1c-4.8 5.7-12.5 9.6-21.9 9.6-15.5 0-35.1-12.3-35.1-37.8zm57.5-.2c0-10.8-7.8-19.5-18.6-19.5-11 0-19.5 8.3-19.5 19.5s8.4 19.6 19.5 19.6c10.8 0 18.6-8.8 18.6-19.6zm24-16.5c0-30.2 22.8-54.5 54.2-54.5 15.7 0 28.9 5.7 38.5 14.7 3.9 3.7 7.2 7.9 9.8 12.5L552 88.9c-6.5-12.1-16.6-18.3-30.4-18.3-19.3 0-34.3 15.8-34.3 34.9 0 19.5 14.7 34.9 35 34.9 15.4 0 26.3-8.7 30.1-22.2h-33.3V98.9h55.1v8.1c0 28.5-20.3 53-51.9 53-33.2-.1-55.1-25.3-55.1-54.6zm112-19.7H599v11.9c3.6-7.6 10.2-11.9 20.1-11.9h8l-7.2 19.3h-5.4c-10.6 0-15.3 5.5-15.3 19v34.3h-19.9V85.7h-.1zm53 0h19.9v72.7h-19.9v-53.3H625l7.2-19.4zm10-11c6.6 0 11.9-5.3 11.9-11.9s-5.3-11.9-11.9-11.9c-6.6 0-11.9 5.3-11.9 11.9 0 6.5 5.3 11.9 11.9 11.9zm14.6 47.4c0-25.7 18.9-37.8 35.3-37.8 9.4 0 16.9 3.5 21.7 8.6V52.3h19.9v106.1h-19.9v-8.1c-4.8 5.7-12.5 9.6-21.9 9.6-15.5 0-35.1-12.3-35.1-37.8zm57.6-.2c0-10.8-7.8-19.5-18.6-19.5-11 0-19.5 8.3-19.5 19.5s8.4 19.6 19.5 19.6c10.7 0 18.6-8.8 18.6-19.6zm-405.4 0c0-20.9-15.3-37.6-37.5-37.6-20.9 0-37.8 16.9-37.8 37.8s15.7 37.8 38.4 37.8c15.7 0 27-7.6 33.3-18.4l-15.8-9.4c-3.3 6.4-9.8 10.4-17.4 10.4-10.5 0-17-5.2-19.3-13.2H309v-7.4zm-55.2-8.7c3.1-6.8 9.4-11.5 17.9-11.5 8.4 0 14.7 3.9 17.3 11.5h-35.2z"/><path d="M42.4 116h42.4v42.4H42.4zm0-42.5H0V116h42.4z" fill="#9edbee"/><path class="st2" d="M0 116h42.4v42.4H0z"/><path d="M127.3 73.5H84.9V116h42.4zM42.4 31.1h42.4v42.4H42.4z" fill="#07b2e2"/><path fill="#0f9cd5" d="M42.4 73.5V116h42.5V73.5z"/><path class="st2" d="M84.9 31.1h42.4v42.4H84.9z"/><path class="st0" d="M171.2 5.5v24.7h-5.7V5.5h-8.8v-5h23.4v4.9h-8.9v.1zm50.5 24.7h-5.4l-6.6-21.6-6.6 21.6h-5.4L189.4.4l6 .1 5.5 21 6.2-21h5.7l6.2 21 5.4-21h5.7l-8.4 29.7zm19.8 0V.5h5.7v29.7h-5.7zm19 0V.5h5.7v24.7h9.9l.1 5h-15.7zm27.5 0V.5h5.7v29.7H288zm31.8.6c-8.4 0-13.9-6.2-13.9-15.4S311.4 0 319.9 0s13.9 6.2 13.9 15.4c-.1 9.1-5.5 15.4-14 15.4zm0-26.1c-5.1 0-8.1 4.2-8.1 10.7s3.1 10.7 8.1 10.7c5.1 0 8.2-4.2 8.2-10.7s-3.1-10.7-8.2-10.7z"/></svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 713 103"><path d="M150.3 32.9c-7.2 0-11.9 2.4-11.9 6.6s4.9 6.1 12.1 6.9c10.3.9 23.7 2.6 23.7 16.6 0 9.9-9.4 17-23.8 17-9.1 0-17.8-2-25.5-9.9l6.1-7.9c5.1 5.1 12 8 19.2 7.9 6.2 0 12.3-1.9 12.3-6.9s-4.8-6.7-13-7.4c-10.4-.9-22.8-4-22.8-15.9s12.8-16.4 23.2-16.4c7.8-.2 15.3 2.3 21.5 7.1l-6.1 7.1c-4.2-3.3-9.5-5-15-4.8zm62.5 36.6c5.9 0 12.7-2 16.2-5.8l7.6 7.1a33.7 33.7 0 01-24 9.2c-18.3 0-30.1-11-30.1-28.2 0-16.4 12.2-28.2 29.9-28.2 16.4 0 27.7 9.3 27.7 27.8l-.2 4.8h-45.2c.9 8.3 7.8 13.3 18.1 13.3zm-.4-36c-8.5 0-15.8 4.5-17.6 13.2h33.9c-.8-8.6-6.6-13.2-16.3-13.2zm81.7 15c0-9.3-5.4-14.6-15.1-14.6a15.7 15.7 0 00-15.7 16.4v28.5h-11.7v-54h10.7l.7 7.5a24.1 24.1 0 0118.8-8.8c13.5 0 24 8.1 24 24.9v30.3H294l.1-30.2zM377 78.7h-11l-.7-8.5A22.4 22.4 0 01346 80c-16.2 0-28.5-10.4-28.5-28.2 0-18.3 12.1-28.2 28.3-28.2 6.8 0 16 3.2 19.6 9.6V2.5h11.7l-.1 76.2zm-47.9-27a17 17 0 0017.6 17.8c9.6 0 17.5-7.9 17.5-17.7s-7.8-17.7-17.5-17.7c-9.9 0-17.6 6.7-17.6 17.6zM398.7 1c1.9-.2 3.7.5 5.1 1.8S406 6 406 7.9a7.2 7.2 0 01-14.4 0c0-1.9.7-3.8 2.1-5.1s3.2-1.9 5-1.8zm5.8 77.7h-11.7V24.8h11.7v53.9zm58.2-30.2c0-9.3-5.4-14.6-15.1-14.6a15.7 15.7 0 00-15.7 16.4v28.5h-11.7v-54h10.6l.7 7.5a24.2 24.2 0 0118.8-8.8c13.5 0 24 8.1 24 24.9v30.3h-11.7l.1-30.2zm38.4-14.9c3.6-6.4 12.8-10.1 19.6-10.1 16.1 0 28.3 9.9 28.3 28.2 0 17.9-13.1 28.2-28.4 28.2a23 23 0 01-19.5-9.8l-.7 8.5h-11V2.5h11.7v31.1zm.7 18.1c-.1 4.8 1.8 9.4 5.2 12.8a17 17 0 0012.7 5c10.2 0 17.6-6.9 17.6-17.8S529.8 34 519.7 34a17.5 17.5 0 00-17.9 17.7zm71.7 27h-11.7V2.5h11.7v76.2zm27.1-24.6c0 9.2 5.3 15.5 15.2 15.5 4.2 0 8.3-1.7 11.2-4.7 2.9-3.1 4.5-7.2 4.3-11.5V24.8H643v53.9h-10.5l-.7-7.4c-4.8 5.8-11.9 9-19.2 8.7-13.7 0-23.5-9.5-23.5-25.7V24.8h11.7l-.2 29.3zm85.1 15.4c5.9 0 12.7-2 16.2-5.8l7.6 7.1a33.7 33.7 0 01-24 9.2c-18.3 0-30.1-11-30.1-28.2 0-16.4 12.2-28.2 29.9-28.2 16.4 0 27.7 9.3 27.7 27.8l-.2 4.8h-45.3c1 8.3 7.9 13.3 18.2 13.3zm-.4-36c-8.5 0-15.9 4.5-17.6 13.2h33.8c-.7-8.6-6.6-13.2-16.2-13.2z" fill="#091e3f"/><path d="M90.8 26.3c-3.6-6.4-9.6-11-16.7-12.9-1.5-.4-3-.6-4.5-.8a27.1 27.1 0 00-44.7.1 27.4 27.4 0 00-22.4 39A27.9 27.9 0 003.6 77a27.1 27.1 0 0021.3 13.7 27 27 0 0044.8-.1 27.5 27.5 0 0022.3-39 27.9 27.9 0 00-1.2-25.3zm-6.8 4c2.2 3.8 3 8.1 2.3 12.4a27.5 27.5 0 00-37.4 0A19 19 0 0184 30.3zM47.2 9.9c4.2 0 8.3 1.5 11.5 4.2a27.2 27.2 0 00-18.1 31.7 18.7 18.7 0 016.6-35.9zM10.6 30.8c2.1-3.6 5.5-6.4 9.5-8a27.2 27.2 0 0018.7 31.6 19 19 0 01-21.3 1.7 18.3 18.3 0 01-7-25.3h.1zM10.5 73c-2.2-3.8-3-8.1-2.3-12.4a28 28 0 0037.4 0A19 19 0 0110.5 73zm36.9 20.4c-4.2 0-8.3-1.5-11.5-4.2a27.3 27.3 0 0018.2-31.6c8.2 3.3 13 11.9 11.4 20.6a18.8 18.8 0 01-18.1 15.2zm34.7-20.8a19 19 0 01-9.2 8 27 27 0 00-18.1-31.7 18 18 0 0120.7-1.6 18.6 18.6 0 016.6 25.3z" fill="#0092ff"/></svg>

Before

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 403.5 76.8"><g data-name="Layer 2"><g data-name="Layer 1"><path d="M0 0h105.7v76.6a16.4 16.4 0 01-1.9.2H0zm102.6 73.7V4.6l-96 69a11.2 11.2 0 001.2.2H43a5.2 5.2 0 002.7-1l12.5-9 18.5-13.3 1.8 2.5-28.7 20.7zM3.2 4.5v67.8l47.4-34zm4.3-1.3a6 6 0 00.7.8L52 35.2c1.4 1 2.2.4 3.2-.3L96.8 4.6c.5-.3.9-.8 1.6-1.4zm198.3 22.6v49.8h-15V1.8l2.6-.1h14a3.6 3.6 0 014 2.3c5.6 12.1 11.4 24.2 17.2 36.2L230 43l1.6-3 17.6-36a3.3 3.3 0 013.5-2.3h16.9v74h-15V26.1l-.7-.2-1.2 2.1c-5.5 10.3-11 20.6-16.3 31a3.1 3.1 0 01-3.4 2c-2.6-.3-5.8.7-7.8-.5s-2.7-4.4-4-6.7l-13.7-26c-.3-.8-.8-1.5-1.2-2.2zm155.8 49.9h-15.3V1.9a6.7 6.7 0 011.3-.2c10.7 0 21.4 0 32.2.3a28 28 0 018.2 1.7 22.2 22.2 0 0115.4 23.9c-.7 10-8 18-18.7 20.3a55.8 55.8 0 01-9.4 1c-4.5.2-9 0-13.7 0zm0-38.2h13.6a22.9 22.9 0 004.2-.4c5.1-1 8.4-5 8.8-10.6.4-5.8-2.4-11-7.4-12.4-6.3-1.8-12.7-.6-19.1-.8zm-186.5-32l-3.8 12.8-4.8-2.2A37.4 37.4 0 00147 13c-5.5.6-8.8 4-8.6 8.8a7.5 7.5 0 004.6 6.6c4 1.9 8.1 3.2 12.2 4.9 5 2 10.1 3.7 14.7 6.5a18.9 18.9 0 018.5 21.7 17.8 17.8 0 01-8.5 10.8 30.8 30.8 0 01-13.9 4.4c-11.8.9-23.2-.7-34-5.8l-1-.6 3-12.9a42.7 42.7 0 0018.8 6.8 77.6 77.6 0 0012.6.2c3.6-.2 6.9-1.7 8-5.6s-.3-7.6-4.3-10c-3-1.7-6.5-2.8-9.8-4.1-5.2-2.2-10.7-4-15.7-6.7s-9-6.9-10-12.8c-1.5-8 1.2-14.3 7.8-19a30.5 30.5 0 0116-5.3 59.3 59.3 0 0127.8 4.8zm125.3 7.8h-21.5V2.8c0-.4 1.3-1 2-1 4-.2 7.9-.1 11.8-.1h44.5v11.5h-21.5v62.4h-15.3z"/><path d="M7.5 3.2h90.9l-1.6 1.4-41.6 30.3c-1 .7-1.9 1.3-3.2.3L8.2 4a6 6 0 01-.7-.8z" fill="#21b193"/><path d="M361.7 37.5V13.2c6.4.3 12.8-1 19.1.9 5 1.4 7.8 6.6 7.4 12.4-.4 5.5-3.7 9.5-8.8 10.6a22.9 22.9 0 01-4.2.4h-13.5z" fill="#fff"/></g></g></svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="181" height="60"><defs><style>.cls-1{fill:#ccc;fill-rule:evenodd}</style></defs><path id="Rounded_Rectangle_1" data-name="Rounded Rectangle 1" class="cls-1" d="M47.12 46.08h34.3a4.28 4.28 0 110 8.56h-34.3a4.28 4.28 0 110-8.56z"/><path id="Rounded_Rectangle_1-2" data-name="Rounded Rectangle 1" class="cls-1" d="M25.7 26.78h55.7a4.28 4.28 0 014.3 4.28v.02a4.28 4.28 0 01-4.3 4.28H25.7a4.28 4.28 0 01-4.28-4.28v-.02a4.28 4.28 0 014.29-4.28z"/><path id="Rounded_Rectangle_1-3" data-name="Rounded Rectangle 1" class="cls-1" d="M4.28 6.42h77.13a4.28 4.28 0 014.28 4.28v.02A4.28 4.28 0 0181.41 15H4.28A4.28 4.28 0 010 10.72v-.02a4.28 4.28 0 014.28-4.28z"/><path id="_" data-name="" d="M178.88 57.78a6.91 6.91 0 01-5.19 2.2h-68.95a6.9 6.9 0 01-5.19-2.2 7.32 7.32 0 01-2.11-5.26v-44a7.33 7.33 0 012.11-5.27 6.91 6.91 0 015.19-2.2h68.95a6.92 6.92 0 015.19 2.2 7.34 7.34 0 012.11 5.27v44a7.33 7.33 0 01-2.11 5.26zm-8.84-49.45L139.31 33 108.58 8.33q-2.7-2.3-4.8-.39a2.67 2.67 0 00-.77 2.2 3.33 3.33 0 00.96 1.82l19.98 18.37-19.21 19.9a1.74 1.74 0 00-.2 2.48 1.4 1.4 0 001.26.58 2.53 2.53 0 001.44-.39l21.5-18.17 10.57 9.37 10.37-9.38L171.2 52.9a2.54 2.54 0 001.44.38 1.96 1.96 0 001.44-.57q.96-1.15-.38-2.49l-19.21-19.9 19.97-18.36a4.02 4.02 0 001.06-1.82 2.27 2.27 0 00-.87-2.2q-1.92-1.9-4.6.39z" fill="#819eaf" fill-rule="evenodd"/></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 562.3 193.9"><path fill="#dc7e28" d="M562.3 41.4v133.4l-18.1 18.1V62.3z"/><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="421" y1="59.1" x2="542" y2="192.3"><stop offset="0" stop-color="#f8c51b"/><stop offset="1" stop-color="#e78f24"/></linearGradient><path fill="url(#a)" d="M422.3 62.3h122v130.6h-122z"/><path fill="#fdd600" d="M441.4 41.5l-19.1 20.8h121.9l18.1-20.9z"/><path fill="#90c7ea" d="M290.3 47.2l120-16.7-10.1 28.8-118.3 16.1z"/><linearGradient id="b" gradientUnits="userSpaceOnUse" x1="286.2" y1="75.3" x2="410.9" y2="175.5"><stop offset="0" stop-color="#1f8aca"/><stop offset="1" stop-color="#01659e"/></linearGradient><path fill="url(#b)" d="M400.2 59.3l16.7 117-118.3 16.6-16.7-117.5z"/><path fill="#0b98d5" d="M400.2 59.3l16.7 117 9-25.3-15.5-119.8-.1-.7"/><linearGradient id="c" gradientUnits="userSpaceOnUse" x1="218.1" y1="80.8" x2="218.1" y2="190.1"><stop offset="0" stop-color="#269f49"/><stop offset="1" stop-color="#008a54"/></linearGradient><path fill="url(#c)" d="M189 37.2l106.2 48-47.9 108.7L141.1 146z"/><path fill="#95cea0" d="M178 0l11 37.2 106.2 48-8.9-35.6z"/><path fill="#69bf6d" d="M178 0l-42.8 101.4 5.9 44.6L189 37.2z"/><linearGradient id="d" gradientUnits="userSpaceOnUse" x1="59.5" y1="70.1" x2="78.3" y2="183.6"><stop offset="0" stop-color="#d81f32"/><stop offset="1" stop-color="#bb2637"/></linearGradient><path fill="url(#d)" d="M118.7 59.1l17.5 115.2-117.3 18.4L0 77.3z"/><path fill="#761216" d="M126.7 17.2l17.4 116.2-7.9 40.9-17.5-115.2z"/><path d="M525.6 109.3a48.6 48.6 0 00-25.9-26.7 48.6 48.6 0 00-36.6 0A44.4 44.4 0 00447.9 93a46.4 46.4 0 00-10.6 16.2 53.6 53.6 0 00-3.5 19.8c0 7.1 1.2 13.7 3.6 19.8a48.7 48.7 0 0025.6 26.7 48.4 48.4 0 0062.7-26.7 53.6 53.6 0 00-.1-39.5zm-25.1 43a24 24 0 01-19.1 8.5c-8.2 0-14.5-2.8-19.2-8.4a35.2 35.2 0 01-7.1-23.3c0-10.1 2.4-18 7-23.6 4.7-5.7 11-8.5 19.2-8.5 8.1 0 14.4 2.8 19.1 8.5a36 36 0 017 23.6c.2 9.9-2.2 17.6-6.9 23.2zM78.6 125.9zm27.5 30a9 9 0 00-3.7-2.5c-1.6-.5-3.4-.8-5.7-.8-2.1 0-4.5.2-7.2.7l-31 5.3c.3-2.4 1.5-5.5 3.6-9.3 2.3-4.3 5.8-9.4 10.3-15.4l3.6-4.8 2.5-3.2a76.5 76.5 0 0013.2-22.8 52 52 0 001.8-10.2l.1-2.8c0-2.4-.2-4.9-.6-7.2-.4-2.2-.9-4-1.6-5.4a7.8 7.8 0 00-2.7-3.2c-1.3-.8-3-1.1-5.4-1.1-1.9 0-4.2.2-6.9.7L40.5 80c-4.3.7-7.5 2-9.6 3.9a7.8 7.8 0 00-2.5 5.8l.2 1.8a8 8 0 004.6 6.4c1.5.7 3.3 1 5.5 1 1.4 0 3-.2 4.8-.4l30-5.1.1 1.6c0 1.9-.3 3.7-1 5.5-.9 2.5-3.1 6-6.7 10.5l-4.6 5.7a140.6 140.6 0 00-17.4 25.1 56.4 56.4 0 00-5.2 14.1 35.6 35.6 0 00-.4 13c.4 2.4 1 4.4 1.8 5.9a7.4 7.4 0 003.1 3.4c1.2.6 2.9.9 5.2.9 3 0 7-.4 12.1-1.3l32.5-5.6c5.8-1 9.8-2.4 12.1-4.3a7.4 7.4 0 002.8-6.1l-.2-1.9a7.1 7.1 0 00-1.6-4zm147.3-77.8a44.2 44.2 0 00-15.2-10.4 45.7 45.7 0 00-17.9-3.8h-.3a50 50 0 00-34.3 15.5 57 57 0 00-11.2 17.5 57 57 0 00-4.7 20.2l-.1 2.3a50 50 0 0012.7 33.1 46.2 46.2 0 0033.3 14.2h.2c6.1 0 12.1-1.3 18-3.9a51.2 51.2 0 0016.4-11.5 57.3 57.3 0 0011.3-17.5 57.6 57.6 0 004.7-20.2v-1.9a51.3 51.3 0 00-12.9-33.6zm-11.6 47.4c-4 9.4-9.3 15.9-15.8 19.5a22.4 22.4 0 01-20.8.7 23.2 23.2 0 01-14.1-15.4c-.7-2.4-1-4.9-1-7.6 0-5.3 1.3-11.1 4-17.3a38.6 38.6 0 0116-19.8 22.4 22.4 0 0120.9-.7c7.4 3.1 12 8.2 13.9 15.5.6 2.4 1 4.8 1 7.5 0 5.2-1.4 11.1-4.1 17.6zm138.3-43.8c-.5-3.6-1.8-6.4-3.8-8.2a8.3 8.3 0 00-5.9-2.2l-1.8.1a9.3 9.3 0 00-6.9 4.2c-1 1.7-1.6 3.7-1.6 6.1l.2 2.8 4.3 30.4-34 5-4.3-30.4a13 13 0 00-3.7-8.1 8.4 8.4 0 00-5.9-2.3l-1.6.1a9.8 9.8 0 00-7.1 4.2 10.9 10.9 0 00-1.6 6.1l.2 2.9 11.6 79.2c.5 3.6 1.8 6.4 3.9 8.2a9 9 0 006 2.1l2-.2a8.6 8.6 0 006.6-4.2c1-1.7 1.5-3.7 1.5-6l-.2-2.9-4.8-31.3 34-5 4.8 31.3c.5 3.6 1.8 6.3 3.8 8.2a9 9 0 006 2.2l1.8-.1a8.7 8.7 0 006.8-4.2c1-1.7 1.5-3.7 1.5-6l-.2-2.9-11.6-79.1z" fill="#fff"/><path fill="#ec473f" d="M0 77.3l2.3-11.6 5.9-29.5 118.5-19-8 41.9z"/></svg>

Before

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -1 +0,0 @@
<svg id="recommended_-_orange_overlay" data-name="recommended - orange overlay" xmlns="http://www.w3.org/2000/svg" width="159" height="22"><defs><style>.cls-2{fill:#fff;fill-rule:evenodd}</style></defs><path id="reocmmended_bg" data-name="reocmmended bg" d="M0 0h155a4 4 0 014 4v18H4a4 4 0 01-4-4V0z" fill="#fb963c"/><path id="recommended" class="cls-2" d="M1524.3 1519.9a3.7 3.7 0 012.5.8 2.7 2.7 0 011 2.2 3.4 3.4 0 01-.5 1.8 2.4 2.4 0 01-1.5 1v.1a2 2 0 01.8.3 1.9 1.9 0 01.5.6 2 2 0 01.2.7 6.7 6.7 0 01.2.8v.8a7.9 7.9 0 00.1.9 5 5 0 00.2.7 2 2 0 00.4.7h-1.7a1 1 0 01-.3-.5 4.5 4.5 0 010-.7v-.8a5.8 5.8 0 00-.2-.8l-.1-.8a1.7 1.7 0 00-.3-.7 1.4 1.4 0 00-.6-.4 2 2 0 00-.9-.2h-3.7v5h-1.5v-11.5h5.4zm.3 5.2a2.2 2.2 0 00.8-.3 1.7 1.7 0 00.6-.7 2.2 2.2 0 00.2-1 2 2 0 00-.5-1.4 2 2 0 00-1.5-.5h-3.8v4h3.2a5.5 5.5 0 001-.1zm13.6-5.2v1.3h-6.4v3.6h6v1.3h-6v4h6.4v1.2h-8V1520h8zm9.1 1.6a3.6 3.6 0 00-2-.6 3.7 3.7 0 00-1.8.4 3.6 3.6 0 00-1.2 1 4.6 4.6 0 00-.7 1.5 7 7 0 00-.2 1.7 7.9 7.9 0 00.2 1.9 4.5 4.5 0 00.7 1.5 3.6 3.6 0 001.2 1 3.7 3.7 0 001.8.4 3.4 3.4 0 001.3-.2 3 3 0 001.7-1.8 4.3 4.3 0 00.3-1.3h1.5a5.2 5.2 0 01-1.5 3.4 4.8 4.8 0 01-3.4 1.2 5.4 5.4 0 01-2.4-.5 4.6 4.6 0 01-1.6-1.2 5.7 5.7 0 01-1-2 8 8 0 01-.3-2.3 7.7 7.7 0 01.3-2.3 5.8 5.8 0 011-2 4.7 4.7 0 011.8-1.2 5.4 5.4 0 012.3-.5 5.8 5.8 0 011.7.3 4.5 4.5 0 011.4.7 4.1 4.1 0 011 1.1 4 4 0 01.6 1.6h-1.5a2.8 2.8 0 00-1.2-1.8zm6.2 5.8a4.7 4.7 0 00.7 1.5 3.8 3.8 0 001.2 1.1 4.2 4.2 0 003.6 0 3.8 3.8 0 001.2-1 4.7 4.7 0 00.7-1.6 6.4 6.4 0 000-3.4 4.7 4.7 0 00-.7-1.5 3.8 3.8 0 00-1.2-1.1 4.2 4.2 0 00-3.6 0 3.8 3.8 0 00-1.2 1 4.7 4.7 0 00-.7 1.6 6.4 6.4 0 000 3.4zm-1.4-4a5.6 5.6 0 011-1.9 5.1 5.1 0 011.7-1.3 6 6 0 014.8 0 5.1 5.1 0 011.7 1.3 5.6 5.6 0 011 2 7.4 7.4 0 010 4.4 5.6 5.6 0 01-1 2 5.1 5.1 0 01-1.7 1.3 6 6 0 01-4.8 0 5.1 5.1 0 01-1.7-1.3 5.6 5.6 0 01-1-2 7.4 7.4 0 010-4.5zm15-3.4l3.6 9.6 3.6-9.6h2v11.4h-1.4v-9.5l-3.6 9.5h-1.3l-3.5-9.5v9.5h-1.5V1520h2zm14.3 0l3.6 9.6 3.6-9.6h2.1v11.4h-1.4v-9.5l-3.6 9.5h-1.3l-3.6-9.5v9.5h-1.5V1520h2.1zm20.1 0v1.3h-6.4v3.6h6v1.3h-6v4h6.5v1.2h-8V1520h8zm3.9 0l6 9.2v-9.2h1.5v11.4h-1.7l-6-9.2v9.2h-1.4V1520h1.6zm14.4 10.1a5.6 5.6 0 00.6 0 3.3 3.3 0 00.9-.2 3.8 3.8 0 00.8-.4 2.8 2.8 0 00.8-.8 4.2 4.2 0 00.5-1.3 6.3 6.3 0 00.2-1.8 7.9 7.9 0 00-.2-1.8 3.4 3.4 0 00-.6-1.4 2.9 2.9 0 00-1.2-.8 4.8 4.8 0 00-1.8-.3h-2.5v8.8h2.5zm-.1-10.1a5.7 5.7 0 014 1.3 5.4 5.4 0 011.5 4.1 9.4 9.4 0 01-.4 2.6 4.7 4.7 0 01-1 1.8 4.2 4.2 0 01-1.7 1.2 6.8 6.8 0 01-2.4.4h-4V1520h4zm15.6 0v1.3h-6.4v3.6h6v1.3h-6v4h6.4v1.2h-7.9V1520h7.9zm6.3 10.1a5.6 5.6 0 00.7 0 3.3 3.3 0 00.8-.2 3.8 3.8 0 00.8-.4 2.8 2.8 0 00.8-.8 4.2 4.2 0 00.6-1.3 6.3 6.3 0 00.2-1.8 7.9 7.9 0 00-.2-1.8 3.4 3.4 0 00-.7-1.4 2.9 2.9 0 00-1.2-.8 4.8 4.8 0 00-1.7-.3h-2.6v8.8h2.5zm0-10.1a5.7 5.7 0 014 1.3 5.4 5.4 0 011.4 4.1 9.4 9.4 0 01-.3 2.6 4.7 4.7 0 01-1 1.8 4.2 4.2 0 01-1.7 1.2 6.8 6.8 0 01-2.5.4h-4V1520h4z" transform="translate(-1493 -1514)"/><path id="star" class="cls-2" d="M1504.6 1518.7l-1.8 3.6-4 .6a.9.9 0 00-.5 1.5l2.9 2.8-.7 4a.9.9 0 001.3.9l3.6-1.9 3.5 1.9a.9.9 0 001.3-1l-.7-4 2.9-2.7a.9.9 0 00-.5-1.5l-4-.6-1.8-3.6a.9.9 0 00-1.5 0z" transform="translate(-1493 -1514)"/></svg>

Before

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -1,181 +0,0 @@
/* eslint-disable no-prototype-builtins */
/* global wp_mail_smtp_about */
'use strict';
var WPMailSMTP = window.WPMailSMTP || {};
WPMailSMTP.Admin = WPMailSMTP.Admin || {};
/**
* WP Mail SMTP Admin area About module.
*
* @since 1.5.0
*/
WPMailSMTP.Admin.About = WPMailSMTP.Admin.About || ( function( document, window, $ ) {
/**
* Public functions and properties.
*
* @since 1.5.0
*
* @type {object}
*/
var app = {
/**
* Start the engine. DOM is not ready yet, use only to init something.
*
* @since 1.5.0
*/
init: function() {
// Do that when DOM is ready.
$( document ).ready( app.ready );
},
/**
* DOM is fully loaded.
*
* @since 1.5.0
*/
ready: function() {
app.pageHolder = $( '.wp-mail-smtp-page-about' );
app.bindActions();
$( '.wp-mail-smtp-page' ).trigger( 'WPMailSMTP.Admin.About.ready' );
},
/**
* Process all generic actions/events, mostly custom that were fired by our API.
*
* @since 1.5.0
*/
bindActions: function() {
/*
* Make plugins description the same height.
*/
jQuery( '.wp-mail-smtp-admin-about-plugins .plugin-item .details' ).matchHeight();
/*
* Install/Active the plugins.
*/
$( document ).on( 'click', '.wp-mail-smtp-admin-about-plugins .plugin-item .action-button .button', function( e ) {
e.preventDefault();
var $btn = $( this );
if ( $btn.hasClass( 'disabled' ) || $btn.hasClass( 'loading' ) ) {
return false;
}
var $plugin = $btn.closest( '.plugin-item' ),
plugin = $btn.attr( 'data-plugin' ),
task,
cssClass,
statusText,
buttonText,
successText;
$btn.addClass( 'loading disabled' );
$btn.text( wp_mail_smtp_about.plugin_processing );
if ( $btn.hasClass( 'status-inactive' ) ) {
// Activate.
task = 'about_plugin_activate';
cssClass = 'status-active button button-secondary disabled';
statusText = wp_mail_smtp_about.plugin_active;
buttonText = wp_mail_smtp_about.plugin_activated;
} else if ( $btn.hasClass( 'status-download' ) ) {
// Install & Activate.
task = 'about_plugin_install';
cssClass = 'status-active button disabled';
statusText = wp_mail_smtp_about.plugin_active;
buttonText = wp_mail_smtp_about.plugin_activated;
} else {
return;
}
// Setup ajax POST data.
var data = {
action: 'wp_mail_smtp_ajax',
task: task,
nonce : wp_mail_smtp_about.nonce,
plugin: plugin
};
$.post( wp_mail_smtp_about.ajax_url, data, function( res ) {
var isInstallSuccessful;
if ( res.success ) {
isInstallSuccessful = true;
if ( 'about_plugin_install' === task ) {
$btn.attr( 'data-plugin', res.data.basename );
successText = res.data.msg;
if ( ! res.data.is_activated ) {
cssClass = 'button';
statusText = wp_mail_smtp_about.plugin_inactive;
buttonText = wp_mail_smtp_about.plugin_activate;
}
} else {
successText = res.data;
}
$plugin.find( '.actions' ).append( '<div class="msg success">' + successText + '</div>' );
$plugin.find( 'span.status-label' )
.removeClass( 'status-active status-inactive status-download' )
.addClass( cssClass )
.removeClass( 'button button-primary button-secondary disabled' )
.text( statusText );
$btn
.removeClass( 'status-active status-inactive status-download' )
.removeClass( 'button button-primary button-secondary disabled' )
.addClass( cssClass ).html( buttonText );
} else {
isInstallSuccessful = false;
if (
res.hasOwnProperty( 'data' ) &&
res.data.hasOwnProperty( 0 ) &&
res.data[ 0 ].hasOwnProperty( 'code' ) &&
res.data[ 0 ].code === 'download_failed'
) {
// Specific server-returned error.
$plugin.find( '.actions' ).append( '<div class="msg error">' + wp_mail_smtp_about.plugin_install_error + '</div>' );
} else {
// Generic error.
$plugin.find( '.actions' ).append( '<div class="msg error">' + res.data + '</div>' );
}
$btn.html( wp_mail_smtp_about.plugin_download_btn );
}
if ( ! isInstallSuccessful ) {
$btn.removeClass( 'disabled' );
}
$btn.removeClass( 'loading' );
// Automatically clear plugin messages after 3 seconds.
setTimeout( function() {
$( '.plugin-item .msg' ).remove();
}, 3000 );
} ).fail( function( xhr ) {
console.log( xhr.responseText );
} );
} );
}
};
// Provide access to public functions/properties.
return app;
}( document, window, jQuery ) );
// Initialize.
WPMailSMTP.Admin.About.init();

View File

@ -1 +0,0 @@
"use strict";var WPMailSMTP=window.WPMailSMTP||{};WPMailSMTP.Admin=WPMailSMTP.Admin||{},WPMailSMTP.Admin.About=WPMailSMTP.Admin.About||function(a,p){var t={init:function(){p(a).ready(t.ready)},ready:function(){t.pageHolder=p(".wp-mail-smtp-page-about"),t.bindActions(),p(".wp-mail-smtp-page").trigger("WPMailSMTP.Admin.About.ready")},bindActions:function(){jQuery(".wp-mail-smtp-admin-about-plugins .plugin-item .details").matchHeight(),p(a).on("click",".wp-mail-smtp-admin-about-plugins .plugin-item .action-button .button",function(a){a.preventDefault();var i=p(this);if(i.hasClass("disabled")||i.hasClass("loading"))return!1;var s,n,l,e,o,d=i.closest(".plugin-item"),t=i.attr("data-plugin");if(i.addClass("loading disabled"),i.text(wp_mail_smtp_about.plugin_processing),i.hasClass("status-inactive"))s="about_plugin_activate",n="status-active button button-secondary disabled",l=wp_mail_smtp_about.plugin_active,e=wp_mail_smtp_about.plugin_activated;else{if(!i.hasClass("status-download"))return;s="about_plugin_install",n="status-active button disabled",l=wp_mail_smtp_about.plugin_active,e=wp_mail_smtp_about.plugin_activated}var u={action:"wp_mail_smtp_ajax",task:s,nonce:wp_mail_smtp_about.nonce,plugin:t};p.post(wp_mail_smtp_about.ajax_url,u,function(a){var t;a.success?(t=!0,"about_plugin_install"===s?(i.attr("data-plugin",a.data.basename),o=a.data.msg,a.data.is_activated||(n="button",l=wp_mail_smtp_about.plugin_inactive,e=wp_mail_smtp_about.plugin_activate)):o=a.data,d.find(".actions").append('<div class="msg success">'+o+"</div>"),d.find("span.status-label").removeClass("status-active status-inactive status-download").addClass(n).removeClass("button button-primary button-secondary disabled").text(l),i.removeClass("status-active status-inactive status-download").removeClass("button button-primary button-secondary disabled").addClass(n).html(e)):(t=!1,a.hasOwnProperty("data")&&a.data.hasOwnProperty(0)&&a.data[0].hasOwnProperty("code")&&"download_failed"===a.data[0].code?d.find(".actions").append('<div class="msg error">'+wp_mail_smtp_about.plugin_install_error+"</div>"):d.find(".actions").append('<div class="msg error">'+a.data+"</div>"),i.html(wp_mail_smtp_about.plugin_download_btn)),t||i.removeClass("disabled"),i.removeClass("loading"),setTimeout(function(){p(".plugin-item .msg").remove()},3e3)}).fail(function(a){console.log(a.responseText)})})}};return t}(document,(window,jQuery)),WPMailSMTP.Admin.About.init();

View File

@ -1,400 +0,0 @@
/* globals wp_mail_smtp, ajaxurl */
'use strict';
var WPMailSMTP = window.WPMailSMTP || {};
WPMailSMTP.Admin = WPMailSMTP.Admin || {};
/**
* WP Mail SMTP Admin area module.
*
* @since 1.6.0
*/
WPMailSMTP.Admin.Settings = WPMailSMTP.Admin.Settings || ( function( document, window, $ ) {
/**
* Public functions and properties.
*
* @since 1.6.0
*
* @type {object}
*/
var app = {
/**
* State attribute showing if one of the plugin settings
* changed and was not yet saved.
*
* @since 1.9.0
*
* @type {boolean}
*/
pluginSettingsChanged: false,
/**
* Start the engine. DOM is not ready yet, use only to init something.
*
* @since 1.6.0
*/
init: function() {
// Do that when DOM is ready.
$( document ).ready( app.ready );
},
/**
* DOM is fully loaded.
*
* @since 1.6.0
*/
ready: function() {
app.pageHolder = $( '.wp-mail-smtp-tab-settings' );
// If there are screen options we have to move them.
$( '#screen-meta-links, #screen-meta' ).prependTo( '#wp-mail-smtp-header-temp' ).show();
app.bindActions();
},
/**
* Process all generic actions/events, mostly custom that were fired by our API.
*
* @since 1.6.0
*/
bindActions: function() {
// Mailer selection.
$( '.wp-mail-smtp-mailer-image', app.pageHolder ).click( function() {
$( this ).parents( '.wp-mail-smtp-mailer' ).find( 'input' ).trigger( 'click' );
} );
$( '.wp-mail-smtp-mailer input', app.pageHolder ).click( function() {
var $input = $( this );
if ( $input.prop( 'disabled' ) ) {
// Educational Popup.
if ( $input.hasClass( 'educate' ) ) {
app.education.upgradeMailer( $input );
}
return false;
}
// Deselect the current mailer.
$( '.wp-mail-smtp-mailer', app.pageHolder ).removeClass( 'active' );
// Select the correct one.
$( this ).parents( '.wp-mail-smtp-mailer' ).addClass( 'active' );
// Hide all mailers options and display for a currently clicked one.
$( '.wp-mail-smtp-mailer-option', app.pageHolder ).addClass( 'hidden' ).removeClass( 'active' );
$( '.wp-mail-smtp-mailer-option-' + $( this ).val(), app.pageHolder ).addClass( 'active' ).removeClass( 'hidden' );
} );
app.mailers.smtp.bindActions();
// Dismiss Pro banner at the bottom of the page.
$( '#wp-mail-smtp-pro-banner-dismiss', app.pageHolder ).on( 'click', function() {
$.ajax( {
url: ajaxurl,
dataType: 'json',
type: 'POST',
data: {
action: 'wp_mail_smtp_ajax',
task: 'pro_banner_dismiss'
}
} )
.always( function() {
$( '#wp-mail-smtp-pro-banner', app.pageHolder ).fadeOut( 'fast' );
} );
} );
// Dissmis educational notices for certain mailers.
$( '.js-wp-mail-smtp-mailer-notice-dismiss', app.pageHolder ).on( 'click', function( e ) {
e.preventDefault();
var $btn = $( this ),
$notice = $btn.parents( '.inline-notice' );
if ( $btn.hasClass( 'disabled' ) ) {
return false;
}
$.ajax( {
url: ajaxurl,
dataType: 'json',
type: 'POST',
data: {
action: 'wp_mail_smtp_ajax',
task: 'notice_dismiss',
notice: $notice.data( 'notice' ),
mailer: $notice.data( 'mailer' )
},
beforeSend: function() {
$btn.addClass( 'disabled' );
}
} )
.always( function() {
$notice.fadeOut( 'fast', function() {
$btn.removeClass( 'disabled' );
} );
} );
} );
// Show/hide debug output.
$( '#wp-mail-smtp-debug .error-log-toggle' ).on( 'click', function( e ) {
e.preventDefault();
$( '#wp-mail-smtp-debug .error-log-toggle' ).find( '.dashicons' ).toggleClass( 'dashicons-arrow-right-alt2 dashicons-arrow-down-alt2' );
$( '#wp-mail-smtp-debug .error-log' ).slideToggle();
$( '#wp-mail-smtp-debug .error-log-note' ).toggle();
} );
// Remove mailer connection.
$( '.js-wp-mail-smtp-provider-remove', app.pageHolder ).on( 'click', function() {
return confirm( wp_mail_smtp.text_provider_remove );
} );
// Copy input text to clipboard.
$( '.wp-mail-smtp-setting-copy', app.pageHolder ).click( function( e ) {
e.preventDefault();
var target = $( '#' + $( this ).data( 'source_id' ) ).get( 0 );
target.select();
document.execCommand( 'Copy' );
var $buttonIcon = $( this ).find( '.dashicons' );
$buttonIcon
.removeClass( 'dashicons-admin-page' )
.addClass( 'dashicons-yes-alt wp-mail-smtp-success wp-mail-smtp-animate' );
setTimeout(
function() {
$buttonIcon
.removeClass( 'dashicons-yes-alt wp-mail-smtp-success wp-mail-smtp-animate' )
.addClass( 'dashicons-admin-page' );
},
1000
);
} );
// Notice bar: click on the dissmiss button.
$( '#wp-mail-smtp-notice-bar' ).on( 'click', '.dismiss', function() {
var $notice = $( this ).closest( '#wp-mail-smtp-notice-bar' );
$notice.addClass( 'out' );
setTimeout(
function() {
$notice.remove();
},
300
);
$.post(
ajaxurl,
{
action: 'wp_mail_smtp_notice_bar_dismiss',
nonce: wp_mail_smtp.nonce,
}
);
} );
app.triggerExitNotice();
app.beforeSaveChecks();
// Register change event to show/hide plugin supported settings for currently selected mailer.
$( '.js-wp-mail-smtp-setting-mailer-radio-input', app.pageHolder ).on( 'change', this.processMailerSettingsOnChange );
},
education: {
upgradeMailer: function( $input ) {
$.alert( {
backgroundDismiss: true,
escapeKey: true,
animationBounce: 1,
theme: 'modern',
type: 'blue',
animateFromElement: false,
draggable: false,
closeIcon: true,
useBootstrap: false,
title: wp_mail_smtp.education.upgrade_title.replace( /%name%/g, $input.siblings( 'label' ).text().trim() ),
icon: '"></i>' + wp_mail_smtp.education.upgrade_icon_lock + '<i class="',
content: $( '.wp-mail-smtp-mailer-options .wp-mail-smtp-mailer-option-' + $input.val() + ' .wp-mail-smtp-setting-field' ).html(),
boxWidth: '550px',
onOpenBefore: function() {
this.$btnc.after( '<div class="discount-note">' + wp_mail_smtp.education.upgrade_bonus + wp_mail_smtp.education.upgrade_doc + '</div>' );
},
buttons: {
confirm: {
text: wp_mail_smtp.education.upgrade_button,
btnClass: 'btn-confirm',
keys: [ 'enter' ],
action: function() {
window.open( wp_mail_smtp.education.upgrade_url + '&utm_content=' + encodeURI( $input.val() ), '_blank' );
}
}
}
} );
}
},
/**
* Individual mailers specific js code.
*
* @since 1.6.0
*/
mailers: {
smtp: {
bindActions: function() {
// Hide SMTP-specific user/pass when Auth disabled.
$( '#wp-mail-smtp-setting-smtp-auth' ).change( function() {
$( '#wp-mail-smtp-setting-row-smtp-user, #wp-mail-smtp-setting-row-smtp-pass' ).toggleClass( 'inactive' );
} );
// Port default values based on encryption type.
$( '#wp-mail-smtp-setting-row-smtp-encryption input' ).change( function() {
var $input = $( this ),
$smtpPort = $( '#wp-mail-smtp-setting-smtp-port', app.pageHolder );
if ( 'tls' === $input.val() ) {
$smtpPort.val( '587' );
$( '#wp-mail-smtp-setting-row-smtp-autotls' ).addClass( 'inactive' );
} else if ( 'ssl' === $input.val() ) {
$smtpPort.val( '465' );
$( '#wp-mail-smtp-setting-row-smtp-autotls' ).removeClass( 'inactive' );
} else {
$smtpPort.val( '25' );
$( '#wp-mail-smtp-setting-row-smtp-autotls' ).removeClass( 'inactive' );
}
} );
}
}
},
/**
* Exit notice JS code when plugin settings are not saved.
*
* @since 1.9.0
*/
triggerExitNotice: function() {
var $settingPages = $( '.wp-mail-smtp-page-general:not( .wp-mail-smtp-tab-test )' );
// Display an exit notice, if settings are not saved.
$( window ).on( 'beforeunload', function() {
if ( app.pluginSettingsChanged ) {
return wp_mail_smtp.text_settings_not_saved;
}
} );
// Set settings changed attribute, if any input was changed.
$( ':input:not( #wp-mail-smtp-setting-license-key, .wp-mail-smtp-not-form-input )', $settingPages ).on( 'change', function() {
app.pluginSettingsChanged = true;
} );
// Clear the settings changed attribute, if the settings are about to be saved.
$( 'form', $settingPages ).on( 'submit', function() {
app.pluginSettingsChanged = false;
} );
},
/**
* Perform any checks before the settings are saved.
*
* Checks:
* - warn users if they try to save the settings with the default (PHP) mailer selected.
*
* @since 2.1.0
*/
beforeSaveChecks: function() {
$( 'form', app.pageHolder ).on( 'submit', function() {
if ( $( '.wp-mail-smtp-mailer input:checked', app.pageHolder ).val() === 'mail' ) {
var $thisForm = $( this );
$.alert( {
backgroundDismiss: false,
escapeKey: false,
animationBounce: 1,
theme: 'modern',
type: 'orange',
animateFromElement: false,
draggable: false,
closeIcon: false,
useBootstrap: false,
icon: '"></i><img src="' + wp_mail_smtp.plugin_url + '/assets/images/font-awesome/exclamation-circle-solid-orange.svg" style="width: 40px; height: 40px;" alt="' + wp_mail_smtp.default_mailer_notice.icon_alt + '"><i class="',
title: wp_mail_smtp.default_mailer_notice.title,
content: wp_mail_smtp.default_mailer_notice.content,
boxWidth: '550px',
buttons: {
confirm: {
text: wp_mail_smtp.default_mailer_notice.save_button,
btnClass: 'btn-confirm',
keys: [ 'enter' ],
action: function() {
$thisForm.off( 'submit' ).submit();
}
},
cancel: {
text: wp_mail_smtp.default_mailer_notice.cancel_button,
},
}
} );
return false;
}
} );
},
/**
* On change callback for showing/hiding plugin supported settings for currently selected mailer.
*
* @since 2.3.0
*/
processMailerSettingsOnChange: function() {
var mailerSupportedSettings = wp_mail_smtp.all_mailers_supports[ $( this ).val() ];
for ( var setting in mailerSupportedSettings ) {
// eslint-disable-next-line no-prototype-builtins
if ( mailerSupportedSettings.hasOwnProperty( setting ) ) {
$( '.js-wp-mail-smtp-setting-' + setting, app.pageHolder ).toggle( mailerSupportedSettings[ setting ] );
}
}
// Special case: "from email" (group settings).
var $mainSettingInGroup = $( '.js-wp-mail-smtp-setting-from_email' );
$mainSettingInGroup.closest( '.wp-mail-smtp-setting-row' ).toggle(
mailerSupportedSettings['from_email'] || mailerSupportedSettings['from_email_force']
);
$mainSettingInGroup.siblings( '.wp-mail-smtp-setting-mid-row-sep' ).toggle(
mailerSupportedSettings['from_email'] && mailerSupportedSettings['from_email_force']
);
// Special case: "from name" (group settings).
$mainSettingInGroup = $( '.js-wp-mail-smtp-setting-from_name' );
$mainSettingInGroup.closest( '.wp-mail-smtp-setting-row' ).toggle(
mailerSupportedSettings['from_name'] || mailerSupportedSettings['from_name_force']
);
$mainSettingInGroup.siblings( '.wp-mail-smtp-setting-mid-row-sep' ).toggle(
mailerSupportedSettings['from_name'] && mailerSupportedSettings['from_name_force']
);
}
};
// Provide access to public functions/properties.
return app;
}( document, window, jQuery ) );
// Initialize.
WPMailSMTP.Admin.Settings.init();

File diff suppressed because one or more lines are too long

View File

@ -1,185 +0,0 @@
/* global wp_mail_smtp, ajaxurl */
/**
* WP Mail SMTP Admin Notifications.
*
* @since 2.3.0
*/
'use strict';
var WPMailSMTPAdminNotifications = window.WPMailSMTPAdminNotifications || ( function( document, window, $ ) {
/**
* Elements holder.
*
* @since 2.3.0
*
* @type {object}
*/
var el = {
$notifications: $( '#wp-mail-smtp-notifications' ),
$nextButton: $( '#wp-mail-smtp-notifications .navigation .next' ),
$prevButton: $( '#wp-mail-smtp-notifications .navigation .prev' ),
$adminBarCounter: $( '#wp-admin-bar-wp-mail-smtp-menu .wp-mail-smtp-admin-bar-menu-notification-counter' ),
};
/**
* Public functions and properties.
*
* @since 2.3.0
*
* @type {object}
*/
var app = {
/**
* Start the engine.
*
* @since 2.3.0
*/
init: function() {
$( document ).ready( app.ready );
},
/**
* Document ready.
*
* @since 2.3.0
*/
ready: function() {
app.updateNavigation();
app.events();
},
/**
* Register JS events.
*
* @since 2.3.0
*/
events: function() {
el.$notifications
.on( 'click', '.dismiss', app.dismiss )
.on( 'click', '.next', app.navNext )
.on( 'click', '.prev', app.navPrev );
},
/**
* Click on the Dismiss notification button.
*
* @since 2.3.0
*
* @param {object} event Event object.
*/
dismiss: function( event ) {
if ( el.$currentMessage.length === 0 ) {
return;
}
// AJAX call - update option.
var data = {
action: 'wp_mail_smtp_notification_dismiss',
nonce: wp_mail_smtp.nonce,
id: el.$currentMessage.data( 'message-id' ),
};
$.post( ajaxurl, data, function( response ) {
if ( ! response.success ) {
return;
}
// Update counter.
var count = parseInt( el.$adminBarCounter.text(), 10 );
if ( count > 1 ) {
--count;
el.$adminBarCounter.html( '<span>' + count + '</span>' );
} else {
el.$adminBarCounter.remove();
}
// Remove notification.
var $nextMessage = el.$nextMessage.length < 1 ? el.$prevMessage : el.$nextMessage;
if ( $nextMessage.length === 0 ) {
el.$notifications.remove();
} else {
el.$currentMessage.remove();
$nextMessage.addClass( 'current' );
app.updateNavigation();
}
} );
},
/**
* Click on the Next notification button.
*
* @since 2.3.0
*
* @param {object} event Event object.
*/
navNext: function( event ) {
if ( el.$nextButton.hasClass( 'disabled' ) ) {
return;
}
el.$currentMessage.removeClass( 'current' );
el.$nextMessage.addClass( 'current' );
app.updateNavigation();
},
/**
* Click on the Previous notification button.
*
* @since 2.3.0
*
* @param {object} event Event object.
*/
navPrev: function( event ) {
if ( el.$prevButton.hasClass( 'disabled' ) ) {
return;
}
el.$currentMessage.removeClass( 'current' );
el.$prevMessage.addClass( 'current' );
app.updateNavigation();
},
/**
* Update navigation buttons.
*
* @since 2.3.0
*/
updateNavigation: function() {
el.$currentMessage = el.$notifications.find( '.message.current' );
el.$nextMessage = el.$currentMessage.next( '.message' );
el.$prevMessage = el.$currentMessage.prev( '.message' );
if ( el.$nextMessage.length === 0 ) {
el.$nextButton.addClass( 'disabled' );
} else {
el.$nextButton.removeClass( 'disabled' );
}
if ( el.$prevMessage.length === 0 ) {
el.$prevButton.addClass( 'disabled' );
} else {
el.$prevButton.removeClass( 'disabled' );
}
},
};
return app;
}( document, window, jQuery ) );
// Initialize.
WPMailSMTPAdminNotifications.init();

View File

@ -1 +0,0 @@
"use strict";var WPMailSMTPAdminNotifications=window.WPMailSMTPAdminNotifications||function(e,t){var a={$notifications:t("#wp-mail-smtp-notifications"),$nextButton:t("#wp-mail-smtp-notifications .navigation .next"),$prevButton:t("#wp-mail-smtp-notifications .navigation .prev"),$adminBarCounter:t("#wp-admin-bar-wp-mail-smtp-menu .wp-mail-smtp-admin-bar-menu-notification-counter")},s={init:function(){t(e).ready(s.ready)},ready:function(){s.updateNavigation(),s.events()},events:function(){a.$notifications.on("click",".dismiss",s.dismiss).on("click",".next",s.navNext).on("click",".prev",s.navPrev)},dismiss:function(e){if(0!==a.$currentMessage.length){var n={action:"wp_mail_smtp_notification_dismiss",nonce:wp_mail_smtp.nonce,id:a.$currentMessage.data("message-id")};t.post(ajaxurl,n,function(e){if(e.success){var n=parseInt(a.$adminBarCounter.text(),10);1<n?(--n,a.$adminBarCounter.html("<span>"+n+"</span>")):a.$adminBarCounter.remove();var t=a.$nextMessage.length<1?a.$prevMessage:a.$nextMessage;0===t.length?a.$notifications.remove():(a.$currentMessage.remove(),t.addClass("current"),s.updateNavigation())}})}},navNext:function(e){a.$nextButton.hasClass("disabled")||(a.$currentMessage.removeClass("current"),a.$nextMessage.addClass("current"),s.updateNavigation())},navPrev:function(e){a.$prevButton.hasClass("disabled")||(a.$currentMessage.removeClass("current"),a.$prevMessage.addClass("current"),s.updateNavigation())},updateNavigation:function(){a.$currentMessage=a.$notifications.find(".message.current"),a.$nextMessage=a.$currentMessage.next(".message"),a.$prevMessage=a.$currentMessage.prev(".message"),0===a.$nextMessage.length?a.$nextButton.addClass("disabled"):a.$nextButton.removeClass("disabled"),0===a.$prevMessage.length?a.$prevButton.addClass("disabled"):a.$prevButton.removeClass("disabled")}};return s}(document,(window,jQuery));WPMailSMTPAdminNotifications.init();

View File

@ -1,388 +0,0 @@
/**
* jquery-match-height 0.7.2 by @liabru
* http://brm.io/jquery-match-height/
* License: MIT
*/
;(function(factory) { // eslint-disable-line no-extra-semi
'use strict';
if (typeof define === 'function' && define.amd) {
// AMD
define(['jquery'], factory);
} else if (typeof module !== 'undefined' && module.exports) {
// CommonJS
module.exports = factory(require('jquery'));
} else {
// Global
factory(jQuery);
}
})(function($) {
/*
* internal
*/
var _previousResizeWidth = -1,
_updateTimeout = -1;
/*
* _parse
* value parse utility function
*/
var _parse = function(value) {
// parse value and convert NaN to 0
return parseFloat(value) || 0;
};
/*
* _rows
* utility function returns array of jQuery selections representing each row
* (as displayed after float wrapping applied by browser)
*/
var _rows = function(elements) {
var tolerance = 1,
$elements = $(elements),
lastTop = null,
rows = [];
// group elements by their top position
$elements.each(function(){
var $that = $(this),
top = $that.offset().top - _parse($that.css('margin-top')),
lastRow = rows.length > 0 ? rows[rows.length - 1] : null;
if (lastRow === null) {
// first item on the row, so just push it
rows.push($that);
} else {
// if the row top is the same, add to the row group
if (Math.floor(Math.abs(lastTop - top)) <= tolerance) {
rows[rows.length - 1] = lastRow.add($that);
} else {
// otherwise start a new row group
rows.push($that);
}
}
// keep track of the last row top
lastTop = top;
});
return rows;
};
/*
* _parseOptions
* handle plugin options
*/
var _parseOptions = function(options) {
var opts = {
byRow: true,
property: 'height',
target: null,
remove: false
};
if (typeof options === 'object') {
return $.extend(opts, options);
}
if (typeof options === 'boolean') {
opts.byRow = options;
} else if (options === 'remove') {
opts.remove = true;
}
return opts;
};
/*
* matchHeight
* plugin definition
*/
var matchHeight = $.fn.matchHeight = function(options) {
var opts = _parseOptions(options);
// handle remove
if (opts.remove) {
var that = this;
// remove fixed height from all selected elements
this.css(opts.property, '');
// remove selected elements from all groups
$.each(matchHeight._groups, function(key, group) {
group.elements = group.elements.not(that);
});
// TODO: cleanup empty groups
return this;
}
if (this.length <= 1 && !opts.target) {
return this;
}
// keep track of this group so we can re-apply later on load and resize events
matchHeight._groups.push({
elements: this,
options: opts
});
// match each element's height to the tallest element in the selection
matchHeight._apply(this, opts);
return this;
};
/*
* plugin global options
*/
matchHeight.version = '0.7.2';
matchHeight._groups = [];
matchHeight._throttle = 80;
matchHeight._maintainScroll = false;
matchHeight._beforeUpdate = null;
matchHeight._afterUpdate = null;
matchHeight._rows = _rows;
matchHeight._parse = _parse;
matchHeight._parseOptions = _parseOptions;
/*
* matchHeight._apply
* apply matchHeight to given elements
*/
matchHeight._apply = function(elements, options) {
var opts = _parseOptions(options),
$elements = $(elements),
rows = [$elements];
// take note of scroll position
var scrollTop = $(window).scrollTop(),
htmlHeight = $('html').outerHeight(true);
// get hidden parents
var $hiddenParents = $elements.parents().filter(':hidden');
// cache the original inline style
$hiddenParents.each(function() {
var $that = $(this);
$that.data('style-cache', $that.attr('style'));
});
// temporarily must force hidden parents visible
$hiddenParents.css('display', 'block');
// get rows if using byRow, otherwise assume one row
if (opts.byRow && !opts.target) {
// must first force an arbitrary equal height so floating elements break evenly
$elements.each(function() {
var $that = $(this),
display = $that.css('display');
// temporarily force a usable display value
if (display !== 'inline-block' && display !== 'flex' && display !== 'inline-flex') {
display = 'block';
}
// cache the original inline style
$that.data('style-cache', $that.attr('style'));
$that.css({
'display': display,
'padding-top': '0',
'padding-bottom': '0',
'margin-top': '0',
'margin-bottom': '0',
'border-top-width': '0',
'border-bottom-width': '0',
'height': '100px',
'overflow': 'hidden'
});
});
// get the array of rows (based on element top position)
rows = _rows($elements);
// revert original inline styles
$elements.each(function() {
var $that = $(this);
$that.attr('style', $that.data('style-cache') || '');
});
}
$.each(rows, function(key, row) {
var $row = $(row),
targetHeight = 0;
if (!opts.target) {
// skip apply to rows with only one item
if (opts.byRow && $row.length <= 1) {
$row.css(opts.property, '');
return;
}
// iterate the row and find the max height
$row.each(function(){
var $that = $(this),
style = $that.attr('style'),
display = $that.css('display');
// temporarily force a usable display value
if (display !== 'inline-block' && display !== 'flex' && display !== 'inline-flex') {
display = 'block';
}
// ensure we get the correct actual height (and not a previously set height value)
var css = { 'display': display };
css[opts.property] = '';
$that.css(css);
// find the max height (including padding, but not margin)
if ($that.outerHeight(false) > targetHeight) {
targetHeight = $that.outerHeight(false);
}
// revert styles
if (style) {
$that.attr('style', style);
} else {
$that.css('display', '');
}
});
} else {
// if target set, use the height of the target element
targetHeight = opts.target.outerHeight(false);
}
// iterate the row and apply the height to all elements
$row.each(function(){
var $that = $(this),
verticalPadding = 0;
// don't apply to a target
if (opts.target && $that.is(opts.target)) {
return;
}
// handle padding and border correctly (required when not using border-box)
if ($that.css('box-sizing') !== 'border-box') {
verticalPadding += _parse($that.css('border-top-width')) + _parse($that.css('border-bottom-width'));
verticalPadding += _parse($that.css('padding-top')) + _parse($that.css('padding-bottom'));
}
// set the height (accounting for padding and border)
$that.css(opts.property, (targetHeight - verticalPadding) + 'px');
});
});
// revert hidden parents
$hiddenParents.each(function() {
var $that = $(this);
$that.attr('style', $that.data('style-cache') || null);
});
// restore scroll position if enabled
if (matchHeight._maintainScroll) {
$(window).scrollTop((scrollTop / htmlHeight) * $('html').outerHeight(true));
}
return this;
};
/*
* matchHeight._applyDataApi
* applies matchHeight to all elements with a data-match-height attribute
*/
matchHeight._applyDataApi = function() {
var groups = {};
// generate groups by their groupId set by elements using data-match-height
$('[data-match-height], [data-mh]').each(function() {
var $this = $(this),
groupId = $this.attr('data-mh') || $this.attr('data-match-height');
if (groupId in groups) {
groups[groupId] = groups[groupId].add($this);
} else {
groups[groupId] = $this;
}
});
// apply matchHeight to each group
$.each(groups, function() {
this.matchHeight(true);
});
};
/*
* matchHeight._update
* updates matchHeight on all current groups with their correct options
*/
var _update = function(event) {
if (matchHeight._beforeUpdate) {
matchHeight._beforeUpdate(event, matchHeight._groups);
}
$.each(matchHeight._groups, function() {
matchHeight._apply(this.elements, this.options);
});
if (matchHeight._afterUpdate) {
matchHeight._afterUpdate(event, matchHeight._groups);
}
};
matchHeight._update = function(throttle, event) {
// prevent update if fired from a resize event
// where the viewport width hasn't actually changed
// fixes an event looping bug in IE8
if (event && event.type === 'resize') {
var windowWidth = $(window).width();
if (windowWidth === _previousResizeWidth) {
return;
}
_previousResizeWidth = windowWidth;
}
// throttle updates
if (!throttle) {
_update(event);
} else if (_updateTimeout === -1) {
_updateTimeout = setTimeout(function() {
_update(event);
_updateTimeout = -1;
}, matchHeight._throttle);
}
};
/*
* bind events
*/
// apply on DOM ready event
$(matchHeight._applyDataApi);
// use on or bind where supported
var on = $.fn.on ? 'on' : 'bind';
// update heights on load and resize events
$(window)[on]('load', function(event) {
matchHeight._update(false, event);
});
// throttled update heights on resize events
$(window)[on]('resize orientationchange', function(event) {
matchHeight._update(true, event);
});
});

View File

@ -1 +0,0 @@
!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"undefined"!=typeof module&&module.exports?module.exports=t(require("jquery")):t(jQuery)}(function(l){function c(t){return parseFloat(t)||0}function h(t){var e=l(t),n=null,a=[];return e.each(function(){var t=l(this),e=t.offset().top-c(t.css("margin-top")),o=0<a.length?a[a.length-1]:null;null!==o&&Math.floor(Math.abs(n-e))<=1?a[a.length-1]=o.add(t):a.push(t),n=e}),a}function p(t){var e={byRow:!0,property:"height",target:null,remove:!1};return"object"==typeof t?l.extend(e,t):("boolean"==typeof t?e.byRow=t:"remove"===t&&(e.remove=!0),e)}var n=-1,a=-1,d=l.fn.matchHeight=function(t){var e=p(t);if(e.remove){var o=this;return this.css(e.property,""),l.each(d._groups,function(t,e){e.elements=e.elements.not(o)}),this}return this.length<=1&&!e.target||(d._groups.push({elements:this,options:e}),d._apply(this,e)),this};d.version="0.7.2",d._groups=[],d._throttle=80,d._maintainScroll=!1,d._beforeUpdate=null,d._afterUpdate=null,d._rows=h,d._parse=c,d._parseOptions=p,d._apply=function(t,e){var i=p(e),o=l(t),n=[o],a=l(window).scrollTop(),r=l("html").outerHeight(!0),s=o.parents().filter(":hidden");return s.each(function(){var t=l(this);t.data("style-cache",t.attr("style"))}),s.css("display","block"),i.byRow&&!i.target&&(o.each(function(){var t=l(this),e=t.css("display");"inline-block"!==e&&"flex"!==e&&"inline-flex"!==e&&(e="block"),t.data("style-cache",t.attr("style")),t.css({display:e,"padding-top":"0","padding-bottom":"0","margin-top":"0","margin-bottom":"0","border-top-width":"0","border-bottom-width":"0",height:"100px",overflow:"hidden"})}),n=h(o),o.each(function(){var t=l(this);t.attr("style",t.data("style-cache")||"")})),l.each(n,function(t,e){var o=l(e),a=0;if(i.target)a=i.target.outerHeight(!1);else{if(i.byRow&&o.length<=1)return void o.css(i.property,"");o.each(function(){var t=l(this),e=t.attr("style"),o=t.css("display");"inline-block"!==o&&"flex"!==o&&"inline-flex"!==o&&(o="block");var n={display:o};n[i.property]="",t.css(n),t.outerHeight(!1)>a&&(a=t.outerHeight(!1)),e?t.attr("style",e):t.css("display","")})}o.each(function(){var t=l(this),e=0;i.target&&t.is(i.target)||("border-box"!==t.css("box-sizing")&&(e+=c(t.css("border-top-width"))+c(t.css("border-bottom-width")),e+=c(t.css("padding-top"))+c(t.css("padding-bottom"))),t.css(i.property,a-e+"px"))})}),s.each(function(){var t=l(this);t.attr("style",t.data("style-cache")||null)}),d._maintainScroll&&l(window).scrollTop(a/r*l("html").outerHeight(!0)),this},d._applyDataApi=function(){var o={};l("[data-match-height], [data-mh]").each(function(){var t=l(this),e=t.attr("data-mh")||t.attr("data-match-height");o[e]=e in o?o[e].add(t):t}),l.each(o,function(){this.matchHeight(!0)})};function i(t){d._beforeUpdate&&d._beforeUpdate(t,d._groups),l.each(d._groups,function(){d._apply(this.elements,this.options)}),d._afterUpdate&&d._afterUpdate(t,d._groups)}d._update=function(t,e){if(e&&"resize"===e.type){var o=l(window).width();if(o===n)return;n=o}t?-1===a&&(a=setTimeout(function(){i(e),a=-1},d._throttle)):i(e)},l(d._applyDataApi);var t=l.fn.on?"on":"bind";l(window)[t]("load",function(t){d._update(!1,t)}),l(window)[t]("resize orientationchange",function(t){d._update(!0,t)})});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,486 +0,0 @@
=== WP Mail SMTP by WPForms ===
Contributors: wpforms, jaredatch, smub, slaFFik
Tags: smtp, wp mail smtp, wordpress smtp, gmail smtp, sendgrid smtp, mailgun smtp, mail, mailer, phpmailer, wp_mail, email, mailgun, sengrid, gmail, sendinblue, wp smtp
Requires at least: 4.9
Tested up to: 5.5
Stable tag: 2.5.1
Requires PHP: 5.5.0
Make email delivery easy for WordPress. Connect with SMTP, Gmail, Outlook, SendGrid, Mailgun, Zoho, SES, and more.
== Description ==
### WordPress Mail SMTP Plugin
Having problems with your WordPress site not sending emails? You're not alone. Over 1 million websites use WP Mail SMTP to send their emails reliably.
Our goal is to make email deliverability easy and reliable. We want to ensure your emails reach the inbox.
WP Mail SMTP fixes your email deliverability by reconfiguring WordPress to use a proper SMTP provider when sending emails.
= What is SMTP? =
SMTP (Simple Mail Transfer Protocol) is an industry standard for sending emails. Proper SMTP configuration helps increase email deliverability by using authentication.
Popular email clients like Gmail, Yahoo, Office 365, and Zoho are in a constant battle with email spammers. One of the things they look at is if an email is originating from the location it claims to be originating from.
If the proper authentication isn't there, then emails either go in the SPAM folder or worst, don't get delivered at all.
This is a problem for a lot of WordPress sites because by default, WordPress uses the PHP mail function to send emails generated by WordPress or any contact form plugin like <a href="https://wpforms.com/" rel="friend">WPForms</a>.
The issue is that most <a href="https://www.wpbeginner.com/wordpress-hosting/" rel="friend">WordPress hosting companies</a> don't have their servers properly configured for sending PHP emails.
The combination of two causes your WordPress emails to not get delivered.
= How does WP Mail SMTP work? =
WP Mail SMTP plugin easily resolves email delivery problems by improving and changing how your WordPress site sends email. We reconfigure the `wp_mail()` function to either use proper SMTP host credentials or leverage a built-in SMTP mail provider.
When using one of our built-in SMTP mail provider integrations (recommended), emails are sent using the provider's direct API. This means even if your web host is blocking SMTP ports, your emails still send successfully.
This helps you fix all WordPress not sending email issues.
WP Mail SMTP plugin includes many different SMTP setup options:
1. SMTP.com <strong>(Recommended)</strong>
2. Sendinblue SMTP <strong>(Recommended)</strong>
3. Mailgun SMTP
4. SendGrid SMTP
5. Gmail SMTP
6. Microsoft SMTP (Outlook.com and Office 365) <a href="https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion&utm_content=readme" rel="friend">[Pro]</a>
7. Amazon SES SMTP <a href="https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion&utm_content=readme" rel="friend">[Pro]</a>
8. Zoho Mail SMTP <a href="https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion&utm_content=readme" rel="friend">[Pro]</a>
9. All Other SMTP
For most options, you can specify the "from name" and "email address" for outgoing emails.
Instead of having users use different SMTP plugins and workflows for different SMTP providers, we decided to bring it all in one. This is what makes WP Mail SMTP, the best SMTP solution for WordPress.
= SMTP.COM =
SMTP.com is a recommended transactional email service.
With over 22 years of email delivery expertise, SMTP.com has been around for almost as long as email itself. They are known among internet providers as one of the most reliable senders on the internet.
Their easy integration process lets you start sending emails in minutes and benefit from years of experience. SMTP.com provides users 50,000 free emails the first 30 days.
Read our <a href="https://wpmailsmtp.com/docs/how-to-set-up-the-smtp-com-mailer-in-wp-mail-smtp" rel="friend">SMTP.com documentation</a> for more details.
= Sendinblue SMTP =
Sendinblue is a recommended transactional email service.
They serve 80,000+ growing companies around the world and send over 30 million emails each day.
Their email deliverability experts are constantly at work optimizing the reliability and speed of their SMTP infrastructure. Sendinblue provides users 300 free emails per day.
Read our <a href="https://wpmailsmtp.com/docs/how-to-set-up-the-sendinblue-mailer-in-wp-mail-smtp/" rel="friend">Sendinblue documentation</a> for more details.
= Mailgun SMTP =
Mailgun SMTP is a popular SMTP service provider that allows you to send large quantities of emails. They provide 5,000 free emails per month for 3 months.
WP Mail SMTP plugin offers a native integration with MailGun. All you have to do is connect your Mailgun account, and you will improve your email deliverability.
Read our <a href="https://wpmailsmtp.com/docs/how-to-set-up-the-mailgun-mailer-in-wp-mail-smtp/" rel="friend">Mailgun documentation</a> for more details.
= SendGrid SMTP =
SendGrid has a free SMTP plan that you can use to send up to 100 emails per day. With our native SendGrid SMTP integration, you can easily and securely set up SendGrid SMTP on your WordPress site.
Read our <a href="https://wpmailsmtp.com/docs/how-to-set-up-the-sendgrid-mailer-in-wp-mail-smtp/" rel="friend">SendGrid documentation</a> for more details.
= Gmail SMTP =
Often bloggers and small business owners don't want to use third-party SMTP services. Well you can use your Gmail or G Suite account for SMTP emails.
This allows you to use your <a href="http://www.wpbeginner.com/beginners-guide/how-to-setup-a-professional-email-address-with-gmail-and-google-apps/" rel="friend">professional email address</a> and improve email deliverability.
Unlike other Gmail SMTP plugins, our Gmail SMTP option uses OAuth to authenticate your Google account, keeping your login information 100% secure.
Read our <a href="https://wpmailsmtp.com/docs/how-to-set-up-the-gmail-mailer-in-wp-mail-smtp/" rel="friend">Gmail documentation</a> for more details.
= Microsoft SMTP (Outlook.com and Office 365) =
Many business use Outlook.com or Office 365 to their to power their email. For those users, the Microsoft mailer can be a great option. This integration allows you to use your existing Outlook.com or Office 365 account to send your emails reliably.
= Amazon SES SMTP =
Advanced or technical users can harness the power of Amazon AWS (Amazon Web Services) with the Amazon SES mailer. With this integration, you can send a high volume of emails at a very reasonable rate.
Read our <a href="https://wpmailsmtp.com/docs/how-to-set-up-the-amazon-ses-mailer-in-wp-mail-smtp/" rel="friend">Amazon SES documentation</a> for more details.
= Zoho Mail SMTP =
Send emails using your personal or business Zoho Mail account, all while keeping your login credentials safe.
Read our <a href="https://wpmailsmtp.com/docs/how-to-set-up-the-zoho-mailer-in-wp-mail-smtp/" rel="friend">Zoho Mail documentation</a> for more details.
= Other SMTP =
WP Mail SMTP plugin also works with all major email services such as Gmail, Yahoo, Outlook, Microsoft Live, and any other email sending service that offers SMTP.
You can set the following options:
* Specify an SMTP host.
* Specify an SMTP port.
* Choose SSL / TLS encryption.
* Choose to use SMTP authentication or not.
* Specify an SMTP username and password.
To see recommended settings for the popular services as well as troubleshooting tips, check out our <a href="https://wpmailsmtp.com/docs/how-to-set-up-the-other-smtp-mailer-in-wp-mail-smtp/" rel="friend">SMTP documentation</a>.
We hope that you find WP Mail SMTP plugin helpful!
### WP Mail SMTP PRO
In addition to native Microsoft and Amazon SES integrations, WP Mail SMTP Pro provides access to many other powerful features and services.
<a href="https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion&utm_content=readme" rel="friend">Click here to purchase WP Mail SMTP Pro now!</a>
= Email Log =
Email Logging lets you log and view all emails sent from your site. Email logs are helpful for storing emails for your records, auditing outgoing emails, and debugging during site development.
= Manage WordPress Emails and Notifications =
The Manage Notification feature gives you full control over which email notifications WordPress sends. This means you can disable different WordPress notification emails. Don't want to receive emails when new users are created? No problem, turn it off.
= Expert Support =
We provide <a href="https://wordpress.org/support/topic/wp-mail-smtp-support-policy/">limited support</a> for the WP Mail SMTP plugin on the WordPress.org forums. Access to our world class one-on-one email support is available to <a href="https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion&utm_content=readme" rel="friend">WP Mail SMTP Pro</a> users.
= White Glove Setup =
Our White Glove Setup service is a great option that anyone can benefit from. Whether you don't have the time or maybe you feel a bit in over your head - we've got you covered.
You can sit back and relax while we set up everything for you. White glove setup includes WP Mail SMTP plugin installation and setup, configuration adjustments to your DNS for proper email domain name verification, Mailgun setup, and final testing to confirm everything is passing with flying colors.
### Security
The WP Mail SMTP team takes security very seriously. Not only does the plugin follow all security best practices, but we have several options available to ensure your site is safe and secure.
- Direct SMTP mailer integrations (recommended), such as SMTP.com, SendGrid and Mailgun, use the official provider APIs. This means you never enter your username or password in the plugin settings and these credentials are not stored in the database. Instead, we use tokens or API keys which are much more secure.
- When using Other SMTP mailer, we provide the option to insert your password in your `wp-config.php` file, so it's not visible in your WordPress settings or saved in the database.
### Credits
WP Mail SMTP plugin was originally created by Callum Macdonald. It is now owned and maintained by the team behind <a href="https://wpforms.com/" rel="friend">WPForms</a> - the best drag & drop form builder for WordPress.
You can try the <a href="https://wordpress.org/plugins/wpforms-lite/" rel="friend">free version of WPForms plugin</a> to see why it's the best in the market.
### What's Next
If you like this plugin, then consider checking out our other projects:
* <a href="https://optinmonster.com/" rel="friend" title="OptinMonster">OptinMonster</a> - Get More Email Subscribers with the most popular conversion optimization plugin for WordPress.
* <a href="https://www.monsterinsights.com/" rel="friend" title="MonsterInsights">MonsterInsights</a> - See the Stats that Matter and Grow Your Business with Confidence. Best Google Analytics Plugin for WordPress.
* <a href="https://www.seedprod.com/" rel="friend" title="SeedProd">SeedProd</a> - Jumpstart your website with the #1 Coming Soon & Maintenance Mode Plugin for WordPress.
Visit <a href="http://www.wpbeginner.com/" rel="friend" title="WPBeginner">WPBeginner</a> to learn from our <a href="http://www.wpbeginner.com/category/wp-tutorials/" rel="friend" title="WordPress Tutorials">WordPress Tutorials</a> and find out about other <a href="http://www.wpbeginner.com/category/plugins/" rel="friend" title="Best WordPress Plugins">best WordPress plugins</a>.
== Installation ==
1. Install WP Mail SMTP by WPForms either via the WordPress.org plugin repository or by uploading the files to your server. (See instructions on <a href="http://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/" rel="friend">how to install a WordPress plugin</a>)
2. Activate WP Mail SMTP by WPForms.
3. Navigate to the Settings area of WP Mail SMTP in the WordPress admin.
4. Choose your SMTP option (Mailgun SMTP, SendGrid SMTP, Gmail SMTP, or Other SMTP) and follow the instructions to set it up.
5. Need more help? Get support with <a href="https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion&utm_content=readme" rel="friend" title="WPForms">WP Mail SMTP PRO</a>.
== Frequently Asked Questions ==
= Can I use this plugin to send email via Gmail, G Suite, Outlook.com, Office 365, Hotmail, Yahoo, or AOL SMTP? =
Yes! We have extensive documentation that covers setting up SMTP most popular email services.
<a href="https://wpmailsmtp.com/docs/a-complete-guide-to-wp-mail-smtp-mailers/" rel="friend">Read our docs</a> to see the correct SMTP settings for each service.
= Help! I need support or have an issue. =
Please read <a href="https://wordpress.org/support/topic/wp-mail-smtp-support-policy/">our support policy</a> for more information.
Limited support is available for WP Mail SMTP users via WordPress.org support forums.
Email support and set up assistance is available to WP Mail SMTP Pro users.
= I found a bug, now what? =
If you've stumbled upon a bug, the best place to report it is in the <a href="https://github.com/awesomemotive/wp-mail-smtp">WP Mail SMTP GitHub repository</a>. GitHub is where the plugin is actively developed, and posting there will get your issue quickly seen by our developers (myself and Slava). Once posted, we'll review your bug report and triage the bug. When creating an issue, the more details you can add to your report, the faster the bug can be solved.
= Can you add feature x, y or z to the plugin? =
Short answer: maybe.
By all means please contact us to discuss features or options you'd like to see added to the plugin. We can't guarantee to add all of them, but we will consider all sensible requests. We can be contacted here:
<a href="https://wpmailsmtp.com/contact/" rel="friend">https://wpmailsmtp.com/contact/</a>
== Screenshots ==
1. WP Mail SMTP Settings page
2. List of mailers
3. Other SMTP settings
4. Email Test page
5. Email Log settings page (Pro)
6. Email Controls settings page (Pro)
7. Email Log archive page (Pro)
8. Email Log single page (Pro)
== Changelog ==
= 2.5.1 - 2020-10-28 =
* The automatic updates issue with Gmail mailer token refresh.
* The 'wp-amil-smtp' typo in a plugin text-domain and a HTML class.
= 2.5.0 - 2020-10-22 =
* Added: Other SMTP mailer password encryption/decryption.
* Changed: Gmail mailer suggested steps for `invalid_grant` error on the Settings > Email Test page.
* Changed: Gmail mailer redirect URI was changed to fix issues with `mod_security` or redirect blocking plugins/solutions.
* Fixed: Plugin options re-saving with unescaped magic quote characters.
* Fixed: SMTP.com mailer email delivery for certain SMTP servers if attachment's encoded string is too long.
= 2.4.0 - 2020-09-17 =
* Added: Prefix all 3rd-party libraries to avoid compatibility issues with other plugins using different versions of the same libraries.
* Changed: Sendinblue SDK library version to 6.4.
* Changed: Google apiclient library version to 2.7.
* Changed: Improve plugin settings input and toggle focus states.
* Fixed: Hide admin bar menu when errors are present and the "Hide Email Delivery Errors" setting is enabled.
* Fixed: CSS sourcemaps warning messages in browser dev tools.
* Fixed: Action Scheduler tasks being registered too early and not getting assigned to the plugin group.
* Fixed: Admin bar CSS asset loading when the admin bar is not showing.
* Fixed: Fatal error on plugin uninstall if `ActionScheduler_QueueRunner::unhook_dispatch_async_request` method does not exist.
* Fixed: PHP Deprecated notice for `base_convert()` function usage in the Mailgun mailer.
= 2.3.1 - 2020-08-20 =
* Added: A WP Mail SMTP admin bar menu if there is an email delivery error or notifications.
* Added: WordPress 5.5 compatibility.
* Changed: Improve copy button user experience for Gmail Authorized redirect URI option.
* Changed: Email delivery error admin notices are now displayed only on plugin pages.
* Changed: Improve plugin settings UI by hiding certain options if the mailer does not support them.
* Changed: Pepipost API mailer is no longer available for new installs.
* Fixed: WP Site Health check for missing DB tables.
* Fixed: PHP errors caused by Actions Scheduler library used inside the plugin.
* Fixed: PHP error on plugin settings and WP Site Health pages if the plugin mailer option is empty for some reason.
= 2.2.1 - 2020-07-09 =
* Added: Gmail mailer now supports aliases.
* Added: Support both old PHPMailer v5 (WordPress <=5.4) and PHPMailer v6 (WordPress >=5.5).
* Changed: Pepipost mailer is now using the native API v5 instead of the SendGrid migration API.
* Fixed: Incorrect Mailgun Domain Name option was not showing an email delivery error.
* Fixed: Empty debug errors for the Sendinblue mailer are no more.
* Fixed: Properly compare From Email option value with a correct default email address from WP core.
= 2.1.1 - 2020-06-08 =
* Changed: Remove current automatic default reply-to address and add WP filter `wp_mail_smtp_processor_set_default_reply_to` for setting default reply-to addresses.
* Changed: Improve description for several options with links to an article about how to properly use constants.
* Fixed: PHP parse error connected to Monolog library on PHP versions < 7.x.
= 2.1.0 - 2020-06-04 =
* Added: Async/scheduled tasks management support.
* Added: New warning notification for selecting the "Default (none)" mailer and saving the plugin settings.
* Changed: Set the original From Email as Reply-To address if it was overwritten by the Force From Email option.
* Changed: The Force From Email option is now enabled by default, for new plugin installs.
* Changed: Reply-To header is now set when not provided, equals to From Name/Email.
* Fixed: Display a non-empty PHPMailer error when some non-SMTP mailers generate errors.
* Fixed: Display a more accurate message, when the "channel - not found" error is triggered by SMTP.com API.
* Fixed: Save and display debug errors for the "Other SMTP" mailer.
* Fixed: Improve the debug details for the "Invalid address (setFrom)" error in the Email Test tab.
* Fixed: Improve the debug details for SMTP CA verification fail, Gmail Guzzle requirements, and Gmail invalid grant errors.
* Fixed: Improve the uninstall cleanup procedure.
= 2.0.1 - 2020-05-07 =
* Changed: Improved description of the "Do Not Send" plugin option.
* Fixed: Due to Pepipost API changes we now convert new lines so they are preserved in plain text emails.
* Fixed: Downgrade internal Guzzle dependency to 6.4 to temporarily fix compatibility issues with WordPress and Guzzle 6.5. Affects Gmail mailer.
= 2.0.0 - 2020-04-27 =
* IMPORTANT: Support for PHP 5.2-5.4 has been discontinued. If you are running one of those versions, you MUST upgrade PHP before installing or upgrading to WP Mail SMTP v2.0. Failure to do that will disable WP Mail SMTP functionality.
* Added: new mailer - SMTP.com integration.
* Changed: Plugin filters that change the FROM Name/Email in emails are now always running last.
* Fixed: `false` value of the `WPMS_SMTP_AUTH`/`WPMS_SMTP_AUTOTLS` constants was not properly handled in UI.
* Fixed: various minor code and internal links improvements.
= 1.9.0 - 2020-03-23 =
* Added: Add various Status tests and Info section on Tools > Site Health page.
* Added: Notify admin if there are unsaved changes in plugin admin area options.
* Fixed: Test email now has a proper bottom margin for better look.
* Changed: Update "About us" plugin page with relevant information.
* Changed: Save default WordPress FROM Email address when incorrect FROM Email address is saved by a user.
= 1.8.1 - 2019-12-13 =
* Fixed: Revert Guzzle version to 6.4.1 because Sendinblue and Gmail mailers may experience issues under certain circumstances while sending emails (not all sites are affected).
* Fixed: Make compatible the WordPress PhpMailer class inline attachments management with the Sendgrid API.
= 1.8.0 - 2019-12-12 =
* Added: New recommended mailer: Pepipost.
* Added: "Suggest a Mailer" link in a list of mailers to send us your ideas about new ones.
* Fixed: Sendgrid: Content ID for attachments missing.
* Changed: Timeout to HTTP requests (pepipost, sendgrid, mailgun), same as max_execution_time, to prevent fails when sending emails with big attachments.
= 1.7.1 - 2019-11-11 =
* Fixed: Compatibility with WordPress 5.3.
* Fixed: `Processor::get_default_email()` always returns empty value when server incorrectly configured.
= 1.7.0 - 2019-10-24 =
* Added: Add a new constant `WPMS_DO_NOT_SEND` to block email sending.
* Fixed: Default email (wordpress@example.com) rewriting in CLI mode.
* Fixed: Incorrect conflicts detection with certain plugins.
* Fixed: various typos in plugin settings.
= 1.6.2 - 2019-09-02 =
* Fixed: Race condition when loading with certain plugins, that send emails very early. Makes email delivery more reliable.
= 1.6.0 - 2019-08-21 =
* Added: New transactional mailer: Sendinblue.
* Added: Educate users to use transactional mailers for better deliverability.
* Added: New option and filter to disable admin area delivery error notices.
* Changed: Hide private API key saved in the DB for API based mailers using `input[type=password]`.
* Changed: Update links to various docs, pointing now to https://wpmailsmtp.com.
= 1.5.2 - 2019-07-18 =
* Fixed: "Redirect URI mismatch" error for "Gmail" mailer when trying to re-authorize an account that was initially created with version < v1.5.0.
* Changed: Make "Authentication" setting in "Other SMTP" mailer ON by default for new users.
* Changed: Mailers docs links now point to wpmailsmtp.com own site.
= 1.5.1 - 2019-07-12 =
* Fixed: Duplicated emails sent to the first recipient in a loop (and others not receiving their emails).
= 1.5.0 - 2019-07-09 =
* Added: Loсo plugin support.
* Added: "About us" admin area page.
* Added: Display in debug output a possible conflicting plugin existence.
* Added: Lots of actions and filters to improve flexibility of the plugin.
* Changed: Plugin menu is now top level.
* Changed: Hide secrets/API keys in page DOM in plugin admin area.
* Changed: Do not save constant values into the database when plugin settings are saved.
* Changed: Lots of i18n improvements to support translation for both free and paid version of the plugin.
* Changed: Gmail mailer - allow to change From Name email header.
* Changed: Gmail mailer - display email used to create a connection.
* Changed: WordPress 4.9 is the minimum WordPress version we support.
* Fixed: X-Mailer header should be present in all emails.
* Fixed: PHP notices when migrating under certain circumstances from 0.x version of the plugin.
* Fixed: Options::get_group() now supports values set via constants.
= 1.4.2 - 2019-03-23 =
* Changed: Tested up to WordPress 5.1.x.
* Changed: Removed TGMPA library.
= 1.4.1 - 2018-12-03 =
* Fixed: correctly process backslashes in SMTP passwords defined via constants.
* Changed: allow to send a Test Email when Default (none) mailer is selected in plugin settings.
= 1.4.0 - 2018-11-29 =
* Added: New option: Do Not Send - block emails from being sent.
* Added: New option: Send HTML or plain text emails when doing an Email Test.
* Added: New option: Mailgun region selection - US and EU (US is default to preserve compatibility).
* Fixed: Compatibility with WordPress 3.6+.
* Fixed: Compatibility with WordPress 5.0.
* Fixed: Constants usage is much more reliable now, works correctly on Multisite. Constants are global accross the whole network.
* Fixed: Preserve multipart emails when using Sendgrid/Mailgun mailers (were converted to HTML-only).
* Fixed: Security hardening.
* Changed: Prefill Email Test page From field with currently logged in user email.
* Changed: Update libraries: google/apiclient-services, google/auth, phpseclib/phpseclib and their dependecies.
* Changed: Display in debug output cURL version if Gmail mailing failed.
* Changed: Display in debug output OpenSSL version if it exists if Gmail/SMTP mailing failed.
* Changed: Display plugin version in dashboard error notice when emailing failed.
* Changed: Do not allow to send Test Email if mailer not configured properly.
* Changed: Notify in plugin admin area that Gmail doesn't allow to redefine From Name/Email etc.
* Changed: List all constants with descriptions in plugin main file: wp_mail_smtp.php.
* Changed: TGMPA: change descriptions from "Required" to "Recommended" (labels were incorrect).
= 1.3.3 - 2018-07-05 =
* Fixed: Compatibility with other plugins, that are using Google Service or Google Client classes.
* Changed: Optimize code loading.
= 1.3.2 - 2018-06-29 =
* Make sure that other plugins/themes are not conflicting with our TGMPA library.
= 1.3.1 - 2018-06-29 =
* Fixed: Other SMTP: Clear new Debug messages about failed email delivery on next successful email sending.
* Fixed: Introduce conditional autoloader to workaround Gmail PHP 5.5 requirement and its library compatibility issues vs PHP 5.3+ minimum viable plugin version.
= 1.3.0 - 2018-06-28 =
* Added: New option: force From Email rewrite regardless of the current value.
* Added: New option: force From Name rewrite regardless of the current value.
* Added: New option: remove all plugin data on plugin uninstall (when user deletes it).
* Added: Notify site admins in wp-admin area with a notice about last failed email delivery. Cleans up on successful delivery.
* Added: Notify site admins in wp-admin area with a notice about possible compatibility issues with other SMTP and email delivery plugins.
* Added: Improve User Debug Experience when doing Email Test - display helpful description and steps to fix the issue.
* Added: New users: provide default SMTP Port value for new users based on Encryption selection.
* Added: New users: notify about not configured plugin settings.
* Added: New users: Recommend free WPForms Lite plugin for those who don't have it.
* Added: SendGrid/Mailgun: provide support for multipart/alternative types of emails.
* Added: Gmail: new button to remove connection and to connect a new Google account.
* Fixed: Support plugin installation into /mu-plugins/ directory.
* Fixed: SendGrid: required text/plain part of email being the first one - fixes plain text emails not having links.
* Fixed: SendGrid and Mailgun: improperly sending plain text emails in html format.
* Fixed: SMTP Debug output was empty in some cases.
* Fixed: Compatibility with lots of other plugins that use Google Analytics library of different versions.
* Fixed: "client_id is empty" is no more a problem, should be fixed.
* Changed: For SendGrid and Mailgun allow using custom defined attachments names if present. Fallback to file name.
* Changed: Gmail: switch to a wider scope to prevent possible issues in certain circumstances.
* Changed: Remove whitespaces start/end of keys, secrets etc.
* Changed: Improved helpful description tests of various options.
* Changed: Improved plugin autoloading functionality.
= 1.2.5 - 2017-02-05 =
* Fixed: `Return path` can't be turned off.
* Fixed: `Authentication` sometimes can't be turned off.
* Fixed: `Auto TLS` sometimes can't be turned off.
* Fixed: BCC support for Gmail was broken.
* Fixed: Debug output improved to handle SELinux and grsecurity.
* Fixed: Strip slashes from plugin settings (useful for `From Name` option).
* Fixed: Change the way sanitization is done to prevent accidental removal of useful data.
* Fixed: Plugin activation will not overwrite settings back to defaults.
* Fixed: Properly set `Auto TLS` option on plugin activation.
* Fixed: Providers autoloading improved for certain Windows-based installs.
* Fixed: Use the proper path to load translations from plugin's `/languages` directory.
* Changed: Do not autoload on each page request plugin settings from WordPress options table.
* Changed: Do not autoload Pepipost classes unless it's saved as active mailer in settings.
= 1.2.4 - 2017-01-28 =
* Fixed: Improved escaping in debug reporting.
= 1.2.3 - 2017-01-22 =
* Fixed: Gmail tokens were reset after clicking Save Settings.
* Fixed: Slight typo in Gmail success message.
= 1.2.2 - 2017-12-27 =
* Fixed: Correctly handle Mailgun debug message for an incorrect api key.
* Fixed: Fatal error for Gmail and SMTP mailers with Nginx web-server (without Apache at all).
* Changed: Update X-Mailer emails header to show the real sender with a mailer and plugin version.
= 1.2.1 - 2017-12-21 =
* Fixed: Failed SMTP connections generate fatal errors.
= 1.2.0 - 2017-12-21 =
* Fixed: Decrease the factual minimum WordPress version from 3.9 to 3.6.
* Changed: Improve debug output for all mail providers.
= 1.1.0 - 2017-12-18 =
* Added: New option "Auto TLS" for SMTP mailer. Default is enabled. Migration routine for all sites.
* Changed: Improve debug output - clear styles and context-aware content.
* Changed: Better exceptions handling for Google authentication process.
* Changed: Do not sanitize passwords, api keys etc - as they may contain special characters in certain order and sanitization will break those values.
* Changed: Improve wording of some helpful texts inside plugin admin area.
* Fixed: Do not include certain files in dependency libraries that are not used by Google mailer. This should stop flagging plugin by Wordfence and VaultPress.
* Fixed: Constants usage is working now, to define the SMTP password, for example.
* Fixed: Notice for default mailer.
= 1.0.2 - 2017-12-12 =
* Fixed: PHPMailer using incorrect SMTPSecure value.
= 1.0.1 - 2017-12-12 =
* Fixed: Global POST processing conflict.
= 1.0.0 - 2017-12-12 =
* Added: Automatic migration tool to move options from older storage format to a new one.
* Added: Added Gmail & G Suite email provider integration - without your email and password.
* Added: Added SendGrid email provider integration - using the API key only.
* Added: Added Mailgun email provider integration - using the API key and configured domain only.
* Added: New compatibility mode - for PHP 5.2 old plugin will be loaded, for PHP 5.3 and higher - new version of admin area and new functionality.
* Changed: The new look of the admin area.
* Changed: SMTP password field now has "password" type.
* Changed: SMTP password field does not display real password at all when using constants in `wp-config.php` to define it.
* Changed: Escape properly all translations.
* Changed: More helpful test email content (with a mailer name).

View File

@ -1,164 +0,0 @@
<?php
namespace WPMailSMTP\Admin;
use WPMailSMTP\Debug;
use WPMailSMTP\Options;
/**
* WP Mail SMTP admin bar menu.
*
* @since 2.3.0
*/
class AdminBarMenu {
/**
* Initialize class.
*
* @since 2.3.0
*/
public function init() {
$this->hooks();
}
/**
* Register hooks.
*
* @since 2.3.0
*/
public function hooks() {
add_action( 'wp_enqueue_scripts', [ $this, 'enqueues' ] );
add_action( 'admin_enqueue_scripts', [ $this, 'enqueues' ] );
add_action( 'admin_bar_menu', [ $this, 'register' ], 999 );
}
/**
* Check if current user has access to see admin bar menu.
*
* @since 2.3.0
*
* @return bool
*/
public function has_access() {
$access = false;
if (
is_user_logged_in() &&
current_user_can( 'manage_options' )
) {
$access = true;
}
return apply_filters( 'wp_mail_smtp_admin_adminbarmenu_has_access', $access );
}
/**
* Check if new notifications are available.
*
* @since 2.3.0
*
* @return bool
*/
public function has_notifications() {
return wp_mail_smtp()->get_notifications()->get_count();
}
/**
* Enqueue styles.
*
* @since 2.3.0
*/
public function enqueues() {
if ( ! is_admin_bar_showing() ) {
return;
}
if ( ! $this->has_access() ) {
return;
}
wp_enqueue_style(
'wp-mail-smtp-admin-bar',
wp_mail_smtp()->assets_url . '/css/admin-bar.min.css',
[],
WPMS_PLUGIN_VER
);
}
/**
* Register and render admin menu bar.
*
* @since 2.3.0
*
* @param \WP_Admin_Bar $wp_admin_bar WordPress Admin Bar object.
*/
public function register( \WP_Admin_Bar $wp_admin_bar ) {
if (
! $this->has_access() ||
(
(
empty( Debug::get_last() ) ||
(bool) Options::init()->get( 'general', 'email_delivery_errors_hidden' )
) &&
empty( $this->has_notifications() )
)
) {
return;
}
$items = apply_filters(
'wp_mail_smtp_admin_adminbarmenu_register',
[
'main_menu',
],
$wp_admin_bar
);
foreach ( $items as $item ) {
$this->{ $item }( $wp_admin_bar );
do_action( "wp_mail_smtp_admin_adminbarmenu_register_{$item}_after", $wp_admin_bar );
}
}
/**
* Render primary top-level admin menu bar item.
*
* @since 2.3.0
*
* @param \WP_Admin_Bar $wp_admin_bar WordPress Admin Bar object.
*/
public function main_menu( \WP_Admin_Bar $wp_admin_bar ) {
if (
! empty( Debug::get_last() ) &&
! (bool) Options::init()->get( 'general', 'email_delivery_errors_hidden' )
) {
$indicator = ' <span class="wp-mail-smtp-admin-bar-menu-error">!</span>';
} elseif ( ! empty( $this->has_notifications() ) ) {
$count = $this->has_notifications() < 10 ? $this->has_notifications() : '!';
$indicator = ' <div class="wp-mail-smtp-admin-bar-menu-notification-counter"><span>' . $count . '</span></div>';
}
if ( ! isset( $indicator ) ) {
return;
}
$wp_admin_bar->add_menu(
[
'id' => 'wp-mail-smtp-menu',
'title' => 'WP Mail SMTP' . $indicator,
'href' => apply_filters(
'wp_mail_smtp_admin_adminbarmenu_main_menu_href',
wp_mail_smtp()->get_admin()->get_admin_page_url()
),
]
);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,102 +0,0 @@
<?php
namespace WPMailSMTP\Admin;
/**
* WP Mail SMTP enhancements to admin pages to educate Lite users on what is available in WP Mail SMTP Pro.
*
* @since 2.3.0
*/
class Education {
/**
* The dismissed notice bar user meta key.
*
* @since 2.3.0
*/
const DISMISS_NOTICE_BAR_KEY = 'wp_mail_smtp_edu_notice_bar_dismissed';
/**
* Hooks.
*
* @since 2.3.0
*/
public function hooks() {
if ( apply_filters( 'wp_mail_smtp_admin_education_notice_bar', true ) ) {
add_action( 'admin_init', [ $this, 'notice_bar_init' ] );
}
}
/**
* Notice bar init.
*
* @since 2.3.0
*/
public function notice_bar_init() {
add_action( 'wp_mail_smtp_admin_header_before', [ $this, 'notice_bar_display' ] );
add_action( 'wp_ajax_wp_mail_smtp_notice_bar_dismiss', [ $this, 'notice_bar_ajax_dismiss' ] );
}
/**
* Notice bar display message.
*
* @since 2.3.0
*/
public function notice_bar_display() {
// Bail if we're not on a plugin admin page.
if ( ! wp_mail_smtp()->get_admin()->is_admin_page() ) {
return;
}
$dismissed = get_user_meta( get_current_user_id(), self::DISMISS_NOTICE_BAR_KEY, true );
if ( ! empty( $dismissed ) ) {
return;
}
printf(
'<div id="wp-mail-smtp-notice-bar">
<div class="wp-mail-smtp-notice-bar-container">
<span class="wp-mail-smtp-notice-bar-message">%s</span>
<button type="button" class="dismiss" title="%s" />
</div>
</div>',
wp_kses(
sprintf( /* translators: %s - WPMailSMTP.com Upgrade page URL. */
__( 'Youre using WP Mail SMTP Lite. To unlock more features consider <a href="%s" target="_blank" rel="noopener noreferrer">upgrading to Pro</a>.', 'wp-mail-smtp' ),
wp_mail_smtp()->get_upgrade_link( [ 'medium' => 'notice-bar' ] )
),
[
'a' => [
'href' => [],
'rel' => [],
'target' => [],
],
]
),
esc_attr__( 'Dismiss this message.', 'wp-mail-smtp' )
);
}
/**
* Ajax handler for dismissing notices.
*
* @since 2.3.0
*/
public function notice_bar_ajax_dismiss() {
// Run a security check.
check_ajax_referer( 'wp-mail-smtp-admin', 'nonce' );
// Check for permissions.
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error();
}
update_user_meta( get_current_user_id(), self::DISMISS_NOTICE_BAR_KEY, time() );
wp_send_json_success();
}
}

View File

@ -1,492 +0,0 @@
<?php
namespace WPMailSMTP\Admin;
use WPMailSMTP\Options;
use WPMailSMTP\Tasks\Tasks;
use WPMailSMTP\WP;
/**
* Notifications.
*
* @since 2.3.0
*/
class Notifications {
/**
* Source of notifications content.
*
* @since 2.3.0
*
* @var string
*/
const SOURCE_URL = 'https://plugin-cdn.wpmailsmtp.com/wp-content/notifications.json';
/**
* The WP option key for storing the notification options.
*
* @since 2.3.0
*
* @var string
*/
const OPTION_KEY = 'wp_mail_smtp_notifications';
/**
* Option value.
*
* @since 2.3.0
*
* @var bool|array
*/
public $option = false;
/**
* Initialize class.
*
* @since 2.3.0
*/
public function init() {
$this->hooks();
}
/**
* Register hooks.
*
* @since 2.3.0
*/
public function hooks() {
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] );
add_action( 'wp_mail_smtp_admin_pages_before_content', [ $this, 'output' ] );
add_action( 'wp_mail_smtp_admin_notifications_update', [ $this, 'update' ] );
add_action( 'wp_ajax_wp_mail_smtp_notification_dismiss', [ $this, 'dismiss' ] );
}
/**
* Check if user has access and is enabled.
*
* @since 2.3.0
*
* @return bool
*/
public function has_access() {
$access = false;
if (
current_user_can( 'manage_options' ) &&
! ( new Options() )->get( 'general', 'am_notifications_hidden' )
) {
$access = true;
}
return apply_filters( 'wp_mail_smtp_admin_notifications_has_access', $access );
}
/**
* Get option value.
*
* @since 2.3.0
*
* @param bool $cache Reference property cache if available.
*
* @return array
*/
public function get_option( $cache = true ) {
if ( $this->option && $cache ) {
return $this->option;
}
$option = get_option( self::OPTION_KEY, [] );
$this->option = [
'update' => ! empty( $option['update'] ) ? $option['update'] : 0,
'events' => ! empty( $option['events'] ) ? $option['events'] : [],
'feed' => ! empty( $option['feed'] ) ? $option['feed'] : [],
'dismissed' => ! empty( $option['dismissed'] ) ? $option['dismissed'] : [],
];
return $this->option;
}
/**
* Fetch notifications from feed.
*
* @since 2.3.0
*
* @return array
*/
protected function fetch_feed() {
$response = wp_remote_get( self::SOURCE_URL );
if ( is_wp_error( $response ) ) {
return [];
}
$body = wp_remote_retrieve_body( $response );
if ( empty( $body ) ) {
return [];
}
return $this->verify( json_decode( $body, true ) );
}
/**
* Verify notification data before it is saved.
*
* @since 2.3.0
*
* @param array $notifications Array of notification items to verify.
*
* @return array
*/
protected function verify( $notifications ) { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh
$data = [];
if ( ! is_array( $notifications ) || empty( $notifications ) ) {
return $data;
}
$option = $this->get_option();
foreach ( $notifications as $notification ) {
// The message and license should never be empty, if they are, ignore.
if ( empty( $notification['content'] ) || empty( $notification['type'] ) ) {
continue;
}
// Ignore if license type does not match.
if ( ! in_array( wp_mail_smtp()->get_license_type(), $notification['type'], true ) ) {
continue;
}
// Ignore if expired.
if ( ! empty( $notification['end'] ) && time() > strtotime( $notification['end'] ) ) {
continue;
}
// Ignore if notification has already been dismissed.
if ( ! empty( $option['dismissed'] ) && in_array( $notification['id'], $option['dismissed'] ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
continue;
}
// Ignore if notification existed before installing WPForms.
// Prevents bombarding the user with notifications after activation.
$activated = get_option( 'wp_mail_smtp_activated_time' );
if (
! empty( $activated ) &&
! empty( $notification['start'] ) &&
$activated > strtotime( $notification['start'] )
) {
continue;
}
$data[] = $notification;
}
return $data;
}
/**
* Verify saved notification data for active notifications.
*
* @since 2.3.0
*
* @param array $notifications Array of notification items to verify.
*
* @return array
*/
protected function verify_active( $notifications ) {
if ( ! is_array( $notifications ) || empty( $notifications ) ) {
return [];
}
// Remove notifications that are not active.
foreach ( $notifications as $key => $notification ) {
if (
( ! empty( $notification['start'] ) && time() < strtotime( $notification['start'] ) ) ||
( ! empty( $notification['end'] ) && time() > strtotime( $notification['end'] ) )
) {
unset( $notifications[ $key ] );
}
}
return $notifications;
}
/**
* Get notification data.
*
* @since 2.3.0
*
* @return array
*/
public function get() {
if ( ! $this->has_access() ) {
return [];
}
$option = $this->get_option();
// Update notifications using async task.
if ( empty( $option['update'] ) || time() > $option['update'] + DAY_IN_SECONDS ) {
if ( empty( Tasks::is_scheduled( 'wp_mail_smtp_admin_notifications_update' ) ) ) {
wp_mail_smtp()->get_tasks()
->create( 'wp_mail_smtp_admin_notifications_update' )
->async()
->params()
->register();
}
}
$events = ! empty( $option['events'] ) ? $this->verify_active( $option['events'] ) : [];
$feed = ! empty( $option['feed'] ) ? $this->verify_active( $option['feed'] ) : [];
return array_merge( $events, $feed );
}
/**
* Get notification count.
*
* @since 2.3.0
*
* @return int
*/
public function get_count() {
return count( $this->get() );
}
/**
* Add a manual notification event.
*
* @since 2.3.0
*
* @param array $notification Notification data.
*/
public function add( $notification ) {
if ( empty( $notification['id'] ) ) {
return;
}
$option = $this->get_option();
if ( in_array( $notification['id'], $option['dismissed'] ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
return;
}
foreach ( $option['events'] as $item ) {
if ( $item['id'] === $notification['id'] ) {
return;
}
}
$notification = $this->verify( [ $notification ] );
update_option(
self::OPTION_KEY,
[
'update' => $option['update'],
'feed' => $option['feed'],
'events' => array_merge( $notification, $option['events'] ),
'dismissed' => $option['dismissed'],
]
);
}
/**
* Update notification data from feed.
*
* @since 2.3.0
*/
public function update() {
$feed = $this->fetch_feed();
$option = $this->get_option();
update_option(
self::OPTION_KEY,
[
'update' => time(),
'feed' => $feed,
'events' => $option['events'],
'dismissed' => $option['dismissed'],
]
);
}
/**
* Admin area assets.
*
* @since 2.3.0
*
* @param string $hook Hook suffix for the current admin page.
*/
public function enqueue_assets( $hook ) {
if ( strpos( $hook, Area::SLUG ) === false ) {
return;
}
if ( ! $this->has_access() ) {
return;
}
$notifications = $this->get();
if ( empty( $notifications ) ) {
return;
}
wp_enqueue_style(
'wp-mail-smtp-admin-notifications',
wp_mail_smtp()->assets_url . '/css/admin-notifications.min.css',
[],
WPMS_PLUGIN_VER
);
wp_enqueue_script(
'wp-mail-smtp-admin-notifications',
wp_mail_smtp()->assets_url . '/js/smtp-notifications' . WP::asset_min() . '.js',
[ 'jquery' ],
WPMS_PLUGIN_VER,
true
);
}
/**
* Output notifications.
*
* @since 2.3.0
*/
public function output() { // phpcs:ignore Generic.Metrics.NestingLevel.MaxExceeded
$notifications = $this->get();
if ( empty( $notifications ) ) {
return;
}
$notifications_html = '';
$current_class = ' current';
$content_allowed_tags = [
'em' => [],
'i' => [],
'strong' => [],
'span' => [
'style' => [],
],
'a' => [
'href' => [],
'target' => [],
'rel' => [],
],
];
foreach ( $notifications as $notification ) {
// Buttons HTML.
$buttons_html = '';
if ( ! empty( $notification['btns'] ) && is_array( $notification['btns'] ) ) {
foreach ( $notification['btns'] as $btn_type => $btn ) {
if ( empty( $btn['text'] ) ) {
continue;
}
$buttons_html .= sprintf(
'<a href="%1$s" class="button button-%2$s"%3$s>%4$s</a>',
! empty( $btn['url'] ) ? esc_url( $btn['url'] ) : '',
$btn_type === 'main' ? 'primary' : 'secondary',
! empty( $btn['target'] ) && $btn['target'] === '_blank' ? ' target="_blank" rel="noopener noreferrer"' : '',
sanitize_text_field( $btn['text'] )
);
}
$buttons_html = ! empty( $buttons_html ) ? '<div class="buttons">' . $buttons_html . '</div>' : '';
}
// Notification HTML.
$notifications_html .= sprintf(
'<div class="message%5$s" data-message-id="%4$s">
<h3 class="title">%1$s</h3>
<p class="content">%2$s</p>
%3$s
</div>',
! empty( $notification['title'] ) ? sanitize_text_field( $notification['title'] ) : '',
! empty( $notification['content'] ) ? wp_kses( $notification['content'], $content_allowed_tags ) : '',
$buttons_html,
! empty( $notification['id'] ) ? esc_attr( sanitize_text_field( $notification['id'] ) ) : 0,
$current_class
);
// Only first notification is current.
$current_class = '';
}
?>
<div id="wp-mail-smtp-notifications">
<div class="bell">
<svg xmlns="http://www.w3.org/2000/svg" width="42" height="48" viewBox="0 0 42 48"><defs><style>.a{fill:#777;}.b{fill:#ca4a1f;}</style></defs><path class="a" d="M23-79a6.005,6.005,0,0,1-6-6h10.06a12.066,12.066,0,0,0,1.791,1.308,6.021,6.021,0,0,1-2.077,3.352A6.008,6.008,0,0,1,23-79Zm1.605-9H5.009a2.955,2.955,0,0,1-2.173-.923A3.088,3.088,0,0,1,2-91a2.919,2.919,0,0,1,.807-2.036c.111-.12.229-.243.351-.371a14.936,14.936,0,0,0,3.126-4.409A23.283,23.283,0,0,0,8.007-107.5a14.846,14.846,0,0,1,.906-5.145,14.5,14.5,0,0,1,2.509-4.324A15.279,15.279,0,0,1,20-122.046V-124a3,3,0,0,1,3-3,3,3,0,0,1,3,3v1.954a15.28,15.28,0,0,1,8.58,5.078,14.5,14.5,0,0,1,2.509,4.324,14.846,14.846,0,0,1,.906,5.145c0,.645.016,1.281.047,1.888A12.036,12.036,0,0,0,35-106a11.921,11.921,0,0,0-8.485,3.515A11.923,11.923,0,0,0,23-94a12,12,0,0,0,1.6,6Z" transform="translate(-2 127)"/><circle class="b" cx="9" cy="9" r="9" transform="translate(24 24)"/></svg>
</div>
<a class="dismiss" title="<?php echo esc_attr__( 'Dismiss this message', 'wp-mail-smtp' ); ?>"><span class="dashicons dashicons-dismiss"></span></a>
<div class="navigation">
<a class="prev disabled" title="<?php echo esc_attr__( 'Previous message', 'wp-mail-smtp' ); ?>"><span class="dashicons dashicons-arrow-left-alt2"></span></a>
<a class="next disabled" title="<?php echo esc_attr__( 'Next message', 'wp-mail-smtp' ); ?>"><span class="dashicons dashicons-arrow-right-alt2"></span></a>
</div>
<div class="messages">
<?php echo $notifications_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
</div>
<?php
}
/**
* Dismiss notification via AJAX.
*
* @since 2.3.0
*/
public function dismiss() {
// Run a security check.
check_ajax_referer( 'wp-mail-smtp-admin', 'nonce' );
// Check for access and required param.
if ( ! current_user_can( 'manage_options' ) || empty( $_POST['id'] ) ) {
wp_send_json_error();
}
$id = sanitize_text_field( wp_unslash( $_POST['id'] ) );
$option = $this->get_option();
$type = is_numeric( $id ) ? 'feed' : 'events';
$option['dismissed'][] = $id;
$option['dismissed'] = array_unique( $option['dismissed'] );
// Remove notification.
if ( is_array( $option[ $type ] ) && ! empty( $option[ $type ] ) ) {
foreach ( $option[ $type ] as $key => $notification ) {
if ( $notification['id'] == $id ) { // phpcs:ignore WordPress.PHP.StrictComparisons
unset( $option[ $type ][ $key ] );
break;
}
}
}
update_option( self::OPTION_KEY, $option );
wp_send_json_success();
}
}

View File

@ -1,89 +0,0 @@
<?php
namespace WPMailSMTP\Admin;
use WPMailSMTP\WP;
/**
* Class PageAbstract.
*
* @since 1.0.0
*/
abstract class PageAbstract implements PageInterface {
/**
* @var string Slug of a tab.
*/
protected $slug;
/**
* @inheritdoc
*/
public function get_link() {
return esc_url(
add_query_arg(
'tab',
$this->slug,
WP::admin_url( 'admin.php?page=' . Area::SLUG )
)
);
}
/**
* Process tab form submission ($_POST ).
*
* @since 1.0.0
*
* @param array $data $_POST data specific for the plugin.
*/
public function process_post( $data ) {
}
/**
* Process tab & mailer specific Auth actions.
*
* @since 1.0.0
*/
public function process_auth() {
}
/**
* Print the nonce field for a specific tab.
*
* @since 1.0.0
*/
public function wp_nonce_field() {
wp_nonce_field( Area::SLUG . '-' . $this->slug );
}
/**
* Make sure that a user was referred from plugin admin page.
* To avoid security problems.
*
* @since 1.0.0
*/
public function check_admin_referer() {
check_admin_referer( Area::SLUG . '-' . $this->slug );
}
/**
* Save button to be reused on other tabs.
*
* @since 1.5.0
*/
public function display_save_btn() {
?>
<p class="wp-mail-smtp-submit">
<button type="submit" class="wp-mail-smtp-btn wp-mail-smtp-btn-md wp-mail-smtp-btn-orange">
<?php esc_html_e( 'Save Settings', 'wp-mail-smtp' ); ?>
</button>
</p>
<?php
}
}

View File

@ -1,45 +0,0 @@
<?php
namespace WPMailSMTP\Admin;
/**
* Class PageInterface defines what should be in each page class.
*
* @since 1.0.0
*/
interface PageInterface {
/**
* URL to a tab.
*
* @since 1.0.0
*
* @return string
*/
public function get_link();
/**
* Title of a tab.
*
* @since 1.0.0
*
* @return string
*/
public function get_title();
/**
* Link label of a tab.
*
* @since 1.0.0
*
* @return string
*/
public function get_label();
/**
* Tab content.
*
* @since 1.0.0
*/
public function display();
}

View File

@ -1,758 +0,0 @@
<?php
namespace WPMailSMTP\Admin\Pages;
use WPMailSMTP\Admin\Area;
use WPMailSMTP\Admin\PageAbstract;
use WPMailSMTP\Admin\PluginsInstallSkin;
use WPMailSMTP\Admin\PluginsInstallUpgrader;
use WPMailSMTP\WP;
/**
* Class About to display a page with About Us and Versus content.
*
* @since 1.5.0
*/
class About extends PageAbstract {
/**
* @since 1.5.0
*
* @var string Slug of a page.
*/
protected $slug = 'about';
/**
* @since 1.5.0
*
* @var array List of supported tabs.
*/
protected $tabs = array( 'about', 'versus' );
/**
* Get the page/tab link.
*
* @since 1.5.0
*
* @param string $tab Tab to generate a link to.
*
* @return string
*/
public function get_link( $tab = '' ) {
return add_query_arg(
'tab',
$this->get_defined_tab( $tab ),
WP::admin_url( 'admin.php?page=' . Area::SLUG . '-' . $this->slug )
);
}
/**
* Get the current tab.
*
* @since 1.5.0
*
* @return string Current tab.
*/
public function get_current_tab() {
if ( empty( $_GET['tab'] ) ) { // phpcs:ignore
return $this->slug;
}
return $this->get_defined_tab( $_GET['tab'] ); // phpcs:ignore
}
/**
* Get the defined or default tab.
*
* @since 1.5.0
*
* @param string $tab Tab to check.
*
* @return string Defined tab. Fallback to default one if it doesn't exist.
*/
protected function get_defined_tab( $tab ) {
$tab = \sanitize_key( $tab );
return \in_array( $tab, $this->tabs, true ) ? $tab : $this->slug;
}
/**
* Get label for a tab.
* Process only those that exists.
* Defaults to "About Us".
*
* @since 1.5.0
*
* @param string $tab Tab to get label for.
*
* @return string
*/
public function get_label( $tab = '' ) {
switch ( $this->get_defined_tab( $tab ) ) {
case 'versus':
$label = \sprintf(
/* translators: %s - plugin current license type. */
\esc_html__( '%s vs Pro', 'wp-mail-smtp' ),
\ucfirst( \wp_mail_smtp()->get_license_type() )
);
break;
case 'about':
default:
$label = \esc_html__( 'About Us', 'wp-mail-smtp' );
break;
}
return $label;
}
/**
* @inheritdoc
*/
public function get_title() {
return $this->get_label( $this->get_current_tab() );
}
/**
* Display About page content based on the current tab.
*
* @since 1.5.0
*/
public function display() {
?>
<div class="wp-mail-smtp-page-title">
<a href="<?php echo \esc_url( $this->get_link() ); ?>" class="tab <?php echo $this->get_current_tab() === 'about' ? 'active' : ''; ?>">
<?php echo \esc_html( $this->get_label( 'about' ) ); ?>
</a>
<?php if ( \wp_mail_smtp()->get_license_type() === 'lite' ) : ?>
<a href="<?php echo \esc_url( $this->get_link( 'versus' ) ); ?>" class="tab <?php echo $this->get_current_tab() === 'versus' ? 'active' : ''; ?>">
<?php echo \esc_html( $this->get_label( 'versus' ) ); ?>
</a>
<?php endif; ?>
</div>
<div class="wp-mail-smtp-page-content">
<h1 class="screen-reader-text">
<?php echo \esc_html( $this->get_label( $this->get_current_tab() ) ); ?>
</h1>
<?php do_action( 'wp_mail_smtp_admin_pages_before_content' ); ?>
<?php
$callback = 'display_' . $this->get_current_tab();
if ( \method_exists( $this, $callback ) ) {
$this->{$callback}();
} else {
$this->display_about();
}
?>
</div>
<?php
}
/**
* Display an "About Us" tab content.
*
* @since 1.5.0
*/
protected function display_about() {
?>
<div class="wp-mail-smtp-admin-about-section wp-mail-smtp-admin-columns">
<div class="wp-mail-smtp-admin-column-60">
<h3>
<?php esc_html_e( 'Hello and welcome to WP Mail SMTP, the easiest and most popular WordPress SMTP plugin. We build software that helps your site reliably deliver emails every time.', 'wp-mail-smtp' ); ?>
</h3>
<p>
<?php esc_html_e( 'Email deliverability has been a well-documented problem for all WordPress websites. However as WPForms grew, we became more aware of this painful issue that affects our users and the larger WordPress community. So we decided to solve this problem and make a solution that\'s beginner friendly.', 'wp-mail-smtp' ); ?>
</p>
<p>
<?php esc_html_e( 'Our goal is to make reliable email deliverability easy for WordPress.', 'wp-mail-smtp' ); ?>
</p>
<p>
<?php
printf(
wp_kses(
/* translators: %1$s - WPForms URL, %2$s - WPBeginner URL, %3$s - OptinMonster URL, %4$s - MonsterInsights URL, %5$s - RafflePress URL */
__( 'WP Mail SMTP is brought to you by the same team that\'s behind the most user friendly WordPress forms, <a href="%1$s" target="_blank" rel="noopener noreferrer">WPForms</a>, the largest WordPress resource site, <a href="%2$s" target="_blank" rel="noopener noreferrer">WPBeginner</a>, the most popular lead-generation software, <a href="%3$s" target="_blank" rel="noopener noreferrer">OptinMonster</a>, the best WordPress analytics plugin, <a href="%4$s" target="_blank" rel="noopener noreferrer">MonsterInsights</a>, and the most powerful WordPress contest plugin, <a href="%5$s" target="_blank" rel="noopener noreferrer">RafflePress</a>.', 'wp-mail-smtp' ),
array(
'a' => array(
'href' => array(),
'rel' => array(),
'target' => array(),
),
)
),
'https://wpforms.com/?utm_source=wpmailsmtpplugin&utm_medium=pluginaboutpage&utm_campaign=aboutwpmailsmtp',
'https://www.wpbeginner.com/?utm_source=wpmailsmtpplugin&utm_medium=pluginaboutpage&utm_campaign=aboutwpmailsmtp',
'https://optinmonster.com/?utm_source=wpmailsmtpplugin&utm_medium=pluginaboutpage&utm_campaign=aboutwpmailsmtp',
'https://www.monsterinsights.com/?utm_source=wpmailsmtpplugin&utm_medium=pluginaboutpage&utm_campaign=aboutwpmailsmtp',
'https://rafflepress.com/?utm_source=wpmailsmtpplugin&utm_medium=pluginaboutpage&utm_campaign=aboutwpmailsmtp'
);
?>
</p>
<p>
<?php esc_html_e( 'Yup, we know a thing or two about building awesome products that customers love.', 'wp-mail-smtp' ); ?>
</p>
</div>
<div class="wp-mail-smtp-admin-column-40 wp-mail-smtp-admin-column-last">
<figure>
<img src="<?php echo esc_url( wp_mail_smtp()->assets_url . '/images/about/team.jpg' ); ?>" alt="<?php esc_attr_e( 'The WPForms Team photo', 'wp-mail-smtp' ); ?>">
<figcaption>
<?php esc_html_e( 'The WPForms Team', 'wp-mail-smtp' ); ?>
</figcaption>
</figure>
</div>
</div>
<?php
// Do not display the plugin section if the user can't install or activate them.
if ( ! current_user_can( 'install_plugins' ) && ! current_user_can( 'activate_plugins' ) ) {
return;
}
$this->display_plugins();
}
/**
* Display the plugins section.
*
* @since 2.2.0
*/
protected function display_plugins() {
?>
<div class="wp-mail-smtp-admin-about-plugins">
<div class="plugins-container">
<?php
foreach ( $this->get_am_plugins() as $key => $plugin ) :
$is_url_external = false;
$data = $this->get_about_plugins_data( $plugin );
if ( isset( $plugin['pro'] ) && \array_key_exists( $plugin['pro']['path'], \get_plugins() ) ) {
$is_url_external = true;
$plugin = $plugin['pro'];
$data = array_merge( $data, $this->get_about_plugins_data( $plugin, true ) );
}
// Do not display a plugin which has to be installed and the user can't install it.
if ( ! current_user_can( 'install_plugins' ) && $data['status_class'] === 'status-download' ) {
continue;
}
?>
<div class="plugin-container">
<div class="plugin-item">
<div class="details wp-mail-smtp-clear">
<img src="<?php echo \esc_url( $plugin['icon'] ); ?>" alt="<?php esc_attr_e( 'Plugin icon', 'wp-mail-smtp' ); ?>">
<h5 class="plugin-name">
<?php echo $plugin['name']; ?>
</h5>
<p class="plugin-desc">
<?php echo $plugin['desc']; ?>
</p>
</div>
<div class="actions wp-mail-smtp-clear">
<div class="status">
<strong>
<?php
\printf(
/* translators: %s - status HTML text. */
\esc_html__( 'Status: %s', 'wp-mail-smtp' ),
'<span class="status-label ' . $data['status_class'] . '">' . $data['status_text'] . '</span>'
);
?>
</strong>
</div>
<div class="action-button">
<?php
$go_to_class = '';
if ( $is_url_external && $data['status_class'] === 'status-download' ) {
$go_to_class = 'go_to';
}
?>
<a href="<?php echo \esc_url( $plugin['url'] ); ?>"
class="<?php echo \esc_attr( $data['action_class'] ); ?> <?php echo $go_to_class; ?>"
data-plugin="<?php echo $data['plugin_src']; ?>">
<?php echo $data['action_text']; ?>
</a>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php
}
/**
* Generate all the required CSS classed and labels to be used in rendering.
*
* @since 1.5.0
*
* @param array $plugin
* @param bool $is_pro
*
* @return mixed
*/
protected function get_about_plugins_data( $plugin, $is_pro = false ) {
$data = array();
if ( \array_key_exists( $plugin['path'], \get_plugins() ) ) {
if ( \is_plugin_active( $plugin['path'] ) ) {
// Status text/status.
$data['status_class'] = 'status-active';
$data['status_text'] = \esc_html__( 'Active', 'wp-mail-smtp' );
// Button text/status.
$data['action_class'] = $data['status_class'] . ' button button-secondary disabled';
$data['action_text'] = \esc_html__( 'Activated', 'wp-mail-smtp' );
$data['plugin_src'] = \esc_attr( $plugin['path'] );
} else {
// Status text/status.
$data['status_class'] = 'status-inactive';
$data['status_text'] = \esc_html__( 'Inactive', 'wp-mail-smtp' );
// Button text/status.
$data['action_class'] = $data['status_class'] . ' button button-secondary';
$data['action_text'] = \esc_html__( 'Activate', 'wp-mail-smtp' );
$data['plugin_src'] = \esc_attr( $plugin['path'] );
}
} else {
if ( ! $is_pro ) {
// Doesn't exist, install.
// Status text/status.
$data['status_class'] = 'status-download';
$data['status_text'] = \esc_html__( 'Not Installed', 'wp-mail-smtp' );
// Button text/status.
$data['action_class'] = $data['status_class'] . ' button button-primary';
$data['action_text'] = \esc_html__( 'Install Plugin', 'wp-mail-smtp' );
$data['plugin_src'] = \esc_url( $plugin['url'] );
}
}
return $data;
}
/**
* List of AM plugins that we propose to install.
*
* @since 1.5.0
*
* @return array
*/
private function get_am_plugins() {
$data = array(
'mi' => array(
'path' => 'google-analytics-for-wordpress/googleanalytics.php',
'icon' => \wp_mail_smtp()->assets_url . '/images/about/plugin-mi.png',
'name' => \esc_html__( 'MonsterInsights', 'wp-mail-smtp' ),
'desc' => \esc_html__( 'MonsterInsights makes it “effortless” to properly connect your WordPress site with Google Analytics, so you can start making data-driven decisions to grow your business.', 'wp-mail-smtp' ),
'url' => 'https://downloads.wordpress.org/plugin/google-analytics-for-wordpress.zip',
'pro' => array(
'path' => 'google-analytics-premium/googleanalytics-premium.php',
'icon' => \wp_mail_smtp()->assets_url . '/images/about/plugin-mi.png',
'name' => \esc_html__( 'MonsterInsights Pro', 'wp-mail-smtp' ),
'desc' => \esc_html__( 'MonsterInsights makes it “effortless” to properly connect your WordPress site with Google Analytics, so you can start making data-driven decisions to grow your business.', 'wp-mail-smtp' ),
'url' => 'https://www.monsterinsights.com/?utm_source=WordPress&utm_medium=about&utm_campaign=smtp',
),
),
'om' => array(
'path' => 'optinmonster/optin-monster-wp-api.php',
'icon' => \wp_mail_smtp()->assets_url . '/images/about/plugin-om.png',
'name' => \esc_html__( 'OptinMonster', 'wp-mail-smtp' ),
'desc' => \esc_html__( 'Our high-converting optin forms like Exit-Intent® popups, Fullscreen Welcome Mats, and Scroll boxes help you dramatically boost conversions and get more email subscribers.', 'wp-mail-smtp' ),
'url' => 'https://downloads.wordpress.org/plugin/optinmonster.zip',
),
'wpforms' => array(
'path' => 'wpforms-lite/wpforms.php',
'icon' => \wp_mail_smtp()->assets_url . '/images/about/plugin-wpf.png',
'name' => \esc_html__( 'Contact Forms by WPForms', 'wp-mail-smtp' ),
'desc' => \esc_html__( 'The best WordPress contact form plugin. Drag & Drop online form builder that helps you create beautiful contact forms with just a few clicks.', 'wp-mail-smtp' ),
'url' => 'https://downloads.wordpress.org/plugin/wpforms-lite.zip',
'pro' => array(
'path' => 'wpforms/wpforms.php',
'icon' => \wp_mail_smtp()->assets_url . '/images/about/plugin-wpf.png',
'name' => \esc_html__( 'WPForms Pro', 'wp-mail-smtp' ),
'desc' => \esc_html__( 'The best WordPress contact form plugin. Drag & Drop online form builder that helps you create beautiful contact forms with just a few clicks.', 'wp-mail-smtp' ),
'url' => 'https://wpforms.com/?utm_source=WordPress&utm_medium=about&utm_campaign=smtp',
),
),
'rafflepress' => array(
'path' => 'rafflepress/rafflepress.php',
'icon' => \wp_mail_smtp()->assets_url . '/images/about/plugin-rp.png',
'name' => \esc_html__( 'RafflePress', 'wp-mail-smtp' ),
'desc' => \esc_html__( 'Turn your visitors into brand ambassadors! Easily grow your email list, website traffic, and social media followers with powerful viral giveaways & contests.', 'wp-mail-smtp' ),
'url' => 'https://downloads.wordpress.org/plugin/rafflepress.zip',
'pro' => array(
'path' => 'rafflepress-pro/rafflepress-pro.php',
'icon' => \wp_mail_smtp()->assets_url . '/images/about/plugin-rp.png',
'name' => \esc_html__( 'RafflePress Pro', 'wp-mail-smtp' ),
'desc' => \esc_html__( 'Turn your visitors into brand ambassadors! Easily grow your email list, website traffic, and social media followers with powerful viral giveaways & contests.', 'wp-mail-smtp' ),
'url' => 'https://rafflepress.com/pricing/',
),
),
);
return $data;
}
/**
* Active the given plugin.
*
* @since 1.5.0
*/
public static function ajax_plugin_activate() {
// Run a security check.
\check_ajax_referer( 'wp-mail-smtp-about', 'nonce' );
$error = \esc_html__( 'Could not activate the plugin. Please activate it from the Plugins page.', 'wp-mail-smtp' );
// Check for permissions.
if ( ! \current_user_can( 'activate_plugins' ) ) {
\wp_send_json_error( $error );
}
if ( isset( $_POST['plugin'] ) ) {
$activate = \activate_plugins( $_POST['plugin'] ); // phpcs:ignore
if ( ! \is_wp_error( $activate ) ) {
\wp_send_json_success( esc_html__( 'Plugin activated.', 'wp-mail-smtp' ) );
}
}
\wp_send_json_error( $error );
}
/**
* Install & activate the given plugin.
*
* @since 1.5.0
*/
public static function ajax_plugin_install() {
// Run a security check.
\check_ajax_referer( 'wp-mail-smtp-about', 'nonce' );
$error = \esc_html__( 'Could not install the plugin.', 'wp-mail-smtp' );
// Check for permissions.
if ( ! \current_user_can( 'install_plugins' ) ) {
\wp_send_json_error( $error );
}
if ( empty( $_POST['plugin'] ) ) {
\wp_send_json_error();
}
// Set the current screen to avoid undefined notices.
\set_current_screen( 'wp-mail-smtp_page_wp-mail-smtp-about' );
// Prepare variables.
$url = \esc_url_raw(
\add_query_arg(
array(
'page' => 'wp-mail-smtp-about',
),
\admin_url( 'admin.php' )
)
);
$creds = \request_filesystem_credentials( $url, '', false, false, null );
// Check for file system permissions.
if ( false === $creds ) {
\wp_send_json_error( $error );
}
if ( ! \WP_Filesystem( $creds ) ) {
\wp_send_json_error( $error );
}
// Do not allow WordPress to search/download translations, as this will break JS output.
\remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
// Create the plugin upgrader with our custom skin.
$installer = new PluginsInstallUpgrader( new PluginsInstallSkin() );
// Error check.
if ( ! \method_exists( $installer, 'install' ) || empty( $_POST['plugin'] ) ) {
\wp_send_json_error( $error );
}
$installer->install( $_POST['plugin'] ); // phpcs:ignore
// Flush the cache and return the newly installed plugin basename.
\wp_cache_flush();
if ( $installer->plugin_info() ) {
$plugin_basename = $installer->plugin_info();
// Activate the plugin silently.
$activated = \activate_plugin( $plugin_basename );
if ( ! \is_wp_error( $activated ) ) {
\wp_send_json_success(
array(
'msg' => \esc_html__( 'Plugin installed & activated.', 'wp-mail-smtp' ),
'is_activated' => true,
'basename' => $plugin_basename,
)
);
} else {
\wp_send_json_success(
array(
'msg' => esc_html__( 'Plugin installed.', 'wp-mail-smtp' ),
'is_activated' => false,
'basename' => $plugin_basename,
)
);
}
}
\wp_send_json_error( $error );
}
/**
* Display a "Lite vs Pro" tab content.
*
* @since 1.5.0
*/
protected function display_versus() {
$license = \wp_mail_smtp()->get_license_type();
?>
<div class="wp-mail-smtp-admin-about-section wp-mail-smtp-admin-about-section-squashed">
<h1 class="centered">
<strong>
<?php
\printf(
/* translators: %s - plugin current license type. */
\esc_html__( '%s vs Pro', 'wp-mail-smtp' ),
\esc_html( \ucfirst( $license ) )
);
?>
</strong>
</h1>
<p class="centered <?php echo ( $license === 'pro' ? 'hidden' : '' ); ?>">
<?php esc_html_e( 'Get the most out of WP Mail SMTP by upgrading to Pro and unlocking all of the powerful features.', 'wp-mail-smtp' ); ?>
</p>
</div>
<div class="wp-mail-smtp-admin-about-section wp-mail-smtp-admin-about-section-squashed wp-mail-smtp-admin-about-section-hero wp-mail-smtp-admin-about-section-table">
<div class="wp-mail-smtp-admin-about-section-hero-main wp-mail-smtp-admin-columns">
<div class="wp-mail-smtp-admin-column-33">
<h3 class="no-margin">
<?php esc_html_e( 'Feature', 'wp-mail-smtp' ); ?>
</h3>
</div>
<div class="wp-mail-smtp-admin-column-33">
<h3 class="no-margin">
<?php echo esc_html( ucfirst( $license ) ); ?>
</h3>
</div>
<div class="wp-mail-smtp-admin-column-33">
<h3 class="no-margin">
<?php esc_html_e( 'Pro', 'wp-mail-smtp' ); ?>
</h3>
</div>
</div>
<div class="wp-mail-smtp-admin-about-section-hero-extra no-padding wp-mail-smtp-admin-columns">
<table>
<?php
foreach ( $this->get_license_features() as $slug => $name ) {
$current = $this->get_license_data( $slug, $license );
$pro = $this->get_license_data( $slug, 'pro' );
?>
<tr class="wp-mail-smtp-admin-columns">
<td class="wp-mail-smtp-admin-column-33">
<p><?php echo $name; ?></p>
</td>
<td class="wp-mail-smtp-admin-column-33">
<p class="features-<?php echo esc_attr( $current['status'] ); ?>">
<?php echo \implode( '<br>', $current['text'] ); ?>
</p>
</td>
<td class="wp-mail-smtp-admin-column-33">
<p class="features-full">
<?php echo \implode( '<br>', $pro['text'] ); ?>
</p>
</td>
</tr>
<?php
}
?>
</table>
</div>
</div>
<?php if ( 'lite' === $license ) : ?>
<div class="wp-mail-smtp-admin-about-section wp-mail-smtp-admin-about-section-hero">
<div class="wp-mail-smtp-admin-about-section-hero-main no-border">
<h3 class="call-to-action centered">
<a href="<?php echo esc_url( wp_mail_smtp()->get_upgrade_link( 'lite-vs-pro' ) ); ?>" target="_blank" rel="noopener noreferrer">
<?php \esc_html_e( 'Get WP Mail SMTP Pro Today and Unlock all of these Powerful Features', 'wp-mail-smtp' ); ?>
</a>
</h3>
<p class="centered">
<?php
echo \wp_kses(
\__( 'Bonus: WP Mail SMTP Lite users get <span class="price-off">$50 off regular price</span>, automatically applied at checkout.', 'wp-mail-smtp' ),
array(
'span' => array(
'class' => array(),
),
)
);
?>
</p>
</div>
</div>
<?php endif; ?>
<?php
}
/**
* Get the list of features for all licenses.
*
* @since 1.5.0
*
* @return array
*/
private function get_license_features() {
return [
'log' => \esc_html__( 'Email Log', 'wp-mail-smtp' ),
'control' => \esc_html__( 'Email Controls', 'wp-mail-smtp' ),
'mailers' => \esc_html__( 'Mailer Options', 'wp-mail-smtp' ),
'multisite' => \esc_html__( 'WordPress Multisite', 'wp-mail-smtp' ),
'support' => \esc_html__( 'Customer Support', 'wp-mail-smtp' ),
];
}
/**
* Get the array of data that compared the license data.
*
* @since 1.5.0
*
* @param string $feature Feature name.
* @param string $license License type to get data for.
*
* @return array|false
*/
private function get_license_data( $feature, $license ) {
$data = [
'log' => [
'lite' => [
'status' => 'none',
'text' => [
'<strong>' . esc_html__( 'Emails are not logged', 'wp-mail-smtp' ) . '</strong>',
],
],
'pro' => [
'status' => 'full',
'text' => [
'<strong>' . esc_html__( 'Access to all Email Logging options right inside WordPress', 'wp-mail-smtp' ) . '</strong>',
],
],
],
'control' => [
'lite' => [
'status' => 'none',
'text' => [
'<strong>' . esc_html__( 'No controls over whether default WordPress emails are sent', 'wp-mail-smtp' ) . '</strong>',
],
],
'pro' => [
'status' => 'full',
'text' => [
'<strong>' . esc_html__( 'Complete Email Controls management for most default WordPress emails', 'wp-mail-smtp' ) . '</strong>',
],
],
],
'mailers' => [
'lite' => [
'status' => 'none',
'text' => [
'<strong>' . esc_html__( 'Limited Mailers', 'wp-mail-smtp' ) . '</strong><br>' . esc_html__( 'Access is limited to standard mailer options only', 'wp-mail-smtp' ),
],
],
'pro' => [
'status' => 'full',
'text' => [
'<strong>' . esc_html__( 'Additional Mailer Options', 'wp-mail-smtp' ) . '</strong><br>' . esc_html__( 'Microsoft Outlook (with Office365 support), Amazon SES and Zoho Mail', 'wp-mail-smtp' ),
],
],
],
'multisite' => [
'lite' => [
'status' => 'none',
'text' => [
'<strong>' . esc_html__( 'No Global Network Settings', 'wp-mail-smtp' ) . '</strong>',
],
],
'pro' => [
'status' => 'full',
'text' => [
'<strong>' . esc_html__( 'All Global Network Settings', 'wp-mail-smtp' ) . '</strong><br>' . esc_html__( 'Optionally configure settings at the network level or manage separately for each subsite', 'wp-mail-smtp' ),
],
],
],
'support' => [
'lite' => [
'status' => 'none',
'text' => [
'<strong>' . esc_html__( 'Limited Support', 'wp-mail-smtp' ) . '</strong>',
],
],
'pro' => [
'status' => 'full',
'text' => [
'<strong>' . esc_html__( 'Priority Support', 'wp-mail-smtp' ) . '</strong>',
],
],
],
];
// Wrong feature?
if ( ! isset( $data[ $feature ] ) ) {
return false;
}
// Wrong license type?
if ( ! isset( $data[ $feature ][ $license ] ) ) {
return false;
}
return $data[ $feature ][ $license ];
}
}

View File

@ -1,63 +0,0 @@
<?php
namespace WPMailSMTP\Admin\Pages;
use WPMailSMTP\Options;
use WPMailSMTP\Providers\AuthAbstract;
/**
* Class AuthTab.
*
* @since 1.0.0
*/
class AuthTab {
/**
* @var string Slug of a tab.
*/
protected $slug = 'auth';
/**
* Launch mailer specific Auth logic.
*
* @since 1.0.0
*/
public function process_auth() {
$auth = wp_mail_smtp()->get_providers()->get_auth( Options::init()->get( 'mail', 'mailer' ) );
if (
$auth &&
$auth instanceof AuthAbstract &&
method_exists( $auth, 'process' )
) {
$auth->process();
}
}
/**
* Return nothing, as we don't need this functionality.
*
* @since 1.0.0
*/
public function get_label() {
return '';
}
/**
* Return nothing, as we don't need this functionality.
*
* @since 1.0.0
*/
public function get_title() {
return '';
}
/**
* Do nothing, as we don't need this functionality.
*
* @since 1.0.0
*/
public function display() {
}
}

View File

@ -1,137 +0,0 @@
<?php
namespace WPMailSMTP\Admin\Pages;
use WPMailSMTP\Admin\PageAbstract;
/**
* Class ControlTab is a placeholder for Pro Email Control tab settings.
* Displays an upsell.
*
* @since 1.6.0
*/
class ControlTab extends PageAbstract {
/**
* @since 1.6.0
*
* @var string Slug of a tab.
*/
protected $slug = 'control';
/**
* @inheritdoc
*/
public function get_label() {
return esc_html__( 'Email Controls', 'wp-mail-smtp' );
}
/**
* @inheritdoc
*/
public function get_title() {
return $this->get_label();
}
/**
* {@inheritdoc}
*
* @since 2.1.0 Replaced images with SVGs.
*/
public function display() {
$features = [
[
'svg' => '<svg xmlns="http://www.w3.org/2000/svg" focusable="false" viewBox="0 0 64 64"><path class="st0" d="M39.1,35.5H18l-9.2,6.9c-0.5,0.4-1.2,0.3-1.5-0.2c-0.1-0.2-0.2-0.4-0.2-0.6v-6c-3.9,0-7.1-3.2-7.1-7.1V10.7c0-3.9,3.2-7.1,7.1-7.1h32c3.9,0,7.1,3.2,7.1,7.1v17.8C46.2,32.4,43,35.5,39.1,35.5C39.1,35.5,39.1,35.5,39.1,35.5z"/><path class="st1" d="M64,28.4v17.8c0,3.9-3.2,7.1-7.1,7.1h-3.6v6c0,0.6-0.5,1.1-1.1,1.1c-0.2,0-0.5-0.1-0.6-0.2l-9.2-6.9h-14c-3.9,0-7.1-3.2-7.1-7.1v-7.1h17.8c5.9,0,10.7-4.8,10.7-10.7v-7.1h7.1C60.8,21.3,64,24.5,64,28.4z"/></svg>',
'title' => esc_html__( 'Comment Notifications', 'wp-mail-smtp' ),
'desc' => esc_html__( 'Manage emails sent when comments are published or awaiting moderation.', 'wp-mail-smtp' ),
],
[
'svg' => '<svg xmlns="http://www.w3.org/2000/svg" focusable="false" viewBox="0 0 64 64"><path class="st0" d="M63.6 45.2l-2.6-1.5c0.3-1.4 0.3-2.9 0-4.3l2.6-1.5c0.3-0.2 0.4-0.5 0.3-0.9 -0.7-2.1-1.8-4.1-3.3-5.7 -0.2-0.3-0.6-0.3-0.9-0.1l-2.6 1.5c-1.1-0.9-2.3-1.7-3.7-2.1v-3c0-0.3-0.2-0.6-0.6-0.7 -2.2-0.5-4.4-0.5-6.6 0 -0.3 0.1-0.6 0.4-0.6 0.7v3c-1.4 0.5-2.6 1.2-3.7 2.1l-2.6-1.5c-0.3-0.2-0.7-0.1-0.9 0.1C37 33 35.9 35 35.2 37.1c-0.1 0.3 0 0.7 0.3 0.9l2.6 1.5c-0.3 1.4-0.3 2.9 0 4.3l-2.6 1.5c-0.3 0.2-0.4 0.5-0.3 0.9 0.7 2.1 1.8 4.1 3.3 5.7 0.2 0.3 0.6 0.3 0.9 0.1l2.6-1.5c1.1 0.9 2.3 1.7 3.7 2.1v3c0 0.3 0.2 0.6 0.6 0.7 2.2 0.5 4.4 0.5 6.6 0 0.3-0.1 0.6-0.4 0.6-0.7v-3c1.4-0.5 2.6-1.2 3.7-2.1l2.6 1.5c0.3 0.2 0.7 0.1 0.9-0.1 1.5-1.6 2.7-3.6 3.3-5.7C64.1 45.7 63.9 45.4 63.6 45.2zM49.6 46.5c-2.7 0-4.9-2.2-4.9-4.9s2.2-4.9 4.9-4.9c2.7 0 4.9 2.2 4.9 4.9S52.3 46.5 49.6 46.5z"/><path class="st1" d="M42.5 55.6v-0.9c-0.2-0.1-0.5-0.3-0.7-0.4l-0.8 0.5c-1.6 0.9-3.6 0.6-4.9-0.7 -1.8-2-3.2-4.4-4-7 -0.6-1.8 0.2-3.7 1.8-4.6l0.8-0.5c0-0.3 0-0.5 0-0.8L34 40.8c-1.6-0.9-2.3-2.8-1.8-4.6 0.1-0.3 0.2-0.6 0.3-0.9 -0.4 0-0.8-0.1-1.1-0.1h-1.7c-4.6 2.1-10 2.1-14.6 0h-1.7C6 35.2 0 41.2 0 48.6v4.2c0 2.7 2.2 4.8 4.8 4.8l0 0H40c1 0 1.9-0.3 2.7-0.9C42.6 56.4 42.5 56 42.5 55.6zM22.4 32c7.1 0 12.8-5.7 12.8-12.8S29.5 6.4 22.4 6.4 9.6 12.1 9.6 19.2 15.3 32 22.4 32z"/></svg>',
'title' => esc_html__( 'Site Admin Email Change Notifications', 'wp-mail-smtp' ),
'desc' => esc_html__( 'Manage emails sent when site admin\'s account has been changed.', 'wp-mail-smtp' ),
],
[
'svg' => '<svg xmlns="http://www.w3.org/2000/svg" focusable="false" viewBox="0 0 64 64"><path class="st0" d="M9.6 28.8c3.5 0 6.4-2.9 6.4-6.4S13.1 16 9.6 16s-6.4 2.9-6.4 6.4S6.1 28.8 9.6 28.8zM57.6 32h-6.4c-1.7 0-3.3 0.7-4.5 1.9 4.1 2.2 6.9 6.3 7.5 10.9h6.6c1.8 0 3.2-1.4 3.2-3.2v-3.2C64 34.9 61.1 32 57.6 32zM6.4 32C2.9 32 0 34.9 0 38.4v3.2c0 1.8 1.4 3.2 3.2 3.2h6.6c0.6-4.6 3.4-8.7 7.5-10.9 -1.2-1.2-2.8-1.9-4.5-1.9H6.4zM54.4 28.8c3.5 0 6.4-2.9 6.4-6.4S57.9 16 54.4 16 48 18.9 48 22.4 50.9 28.8 54.4 28.8z"/><path class="st1" d="M39.7 35.2h-0.8c-2.1 1-4.5 1.6-6.8 1.6 -2.5 0-4.8-0.6-6.9-1.6h-0.8c-6.4 0-11.5 5.2-11.5 11.5v2.9c0 2.7 2.1 4.8 4.8 4.8h28.8c2.6 0 4.8-2.2 4.8-4.8v-2.9C51.2 40.4 46 35.2 39.7 35.2zM32 32c6.2 0 11.2-5 11.2-11.2S38.2 9.6 32 9.6s-11.2 5-11.2 11.2C20.8 27 25.8 32 32 32L32 32z"/></svg>',
'title' => esc_html__( 'User Change Notifications', 'wp-mail-smtp' ),
'desc' => esc_html__( 'Limit emails triggered by password changed/reset, email changed, and more.', 'wp-mail-smtp' ),
],
[
'svg' => '<svg xmlns="http://www.w3.org/2000/svg" focusable="false" viewBox="0 0 64 64"><path class="st0" d="M35.9 52.6L32 60l-3.9-7.4L30 44l-2.2-4.5c2.8 0.6 5.7 0.6 8.5 0L34 44 35.9 52.6zM32 35.9c8.8 0 16-7.1 16-15.9 -0.9 0.2-1.9 0.4-3 0.5v0.8c0 0-0.8 0.4-0.9 0.8 -0.5 1.6-1 3.3-2.2 4.5 -1.4 1.3-6.5 3-8.7-3.4 -0.4-1.1-2.1-1.1-2.5 0 -2.3 6.8-7.6 4.4-8.7 3.4 -1.3-1.2-1.7-2.9-2.2-4.5 -0.1-0.3-0.9-0.8-0.9-0.8v-0.8c-1.1-0.2-2.1-0.3-3-0.5C16 28.8 23.2 35.9 32 35.9z"/><path class="st1" d="M19 20.5v0.8c0 0 0.8 0.5 0.9 0.8 0.5 1.6 1 3.3 2.2 4.5 1.1 1 6.4 3.4 8.7-3.4 0.4-1.1 2.1-1.1 2.5 0 2.2 6.4 7.3 4.7 8.7 3.4 1.3-1.2 1.7-2.9 2.2-4.5 0.1-0.4 0.9-0.8 0.9-0.8v-0.8c6.6-1 11-2.7 11-4.6 0-1.7-3.4-3.3-8.8-4.3 -1.2-4-3.3-8-5-10.1C41 0 39-0.4 37.2 0.4l-3.5 1.7c-1.1 0.6-2.5 0.6-3.6 0l-3.5-1.7C25-0.4 23 0 21.8 1.5c-1.7 2.1-3.8 6.1-5 10.1 -5.4 1-8.8 2.5-8.8 4.3C8 17.8 12.3 19.6 19 20.5zM52 38.5l3-7.8c0.4-1-0.1-2.2-1.2-2.6 -0.2-0.1-0.5-0.1-0.7-0.1h-4L32 60 14.9 27.9H11c-1.1 0-2 0.9-2 2 0 0.3 0.1 0.5 0.2 0.8l3.2 7.5c-5.2 3-8.4 8.5-8.4 14.5V58c0 3.3 2.7 6 6 6l0 0H54c3.3 0 6-2.7 6-6l0 0v-5.2C60.1 46.9 57 41.5 52 38.5L52 38.5z"/></svg>',
'title' => esc_html__( 'Personal Data Requests Notifications', 'wp-mail-smtp' ),
'desc' => esc_html__( 'Control emails for data requests and data removal actions.', 'wp-mail-smtp' ),
],
[
'svg' => '<svg xmlns="http://www.w3.org/2000/svg" focusable="false" viewBox="0 0 64 64"><path class="st0" d="M0 57.6V40.3c0-1.7 1.4-3.1 3.1-3.1h17.3c2.8 0 4.1 3.3 2.2 5.3l-5.4 5.4c4 3.8 9.3 5.9 14.8 5.8 10 0 18.6-6.9 21-16.4 0.2-0.7 0.8-1.2 1.5-1.2h7.4c0.9 0 1.5 0.7 1.5 1.5 0 0.1 0 0.2 0 0.3C60.7 52.8 47.6 64 32 64c-8.2 0-16.2-3.2-22.1-8.9l-4.6 4.6C3.3 61.7 0 60.3 0 57.6z"/><path class="st1" d="M0.6 26C3.3 11.2 16.4 0 32 0c8.2 0 16.2 3.2 22.1 8.9l4.6-4.6C60.7 2.3 64 3.7 64 6.5v17.3c0 1.7-1.4 3.1-3.1 3.1H43.6c-2.8 0-4.1-3.3-2.2-5.3l5.4-5.4c-4-3.8-9.3-5.9-14.8-5.8 -10 0-18.6 6.9-21 16.4 -0.2 0.7-0.8 1.2-1.5 1.2H2.1c-0.9 0-1.5-0.7-1.5-1.5C0.5 26.2 0.5 26.1 0.6 26z"/></svg>',
'title' => esc_html__( 'Automatic Update Notifications', 'wp-mail-smtp' ),
'desc' => esc_html__( 'Manage emails sent by the core automatic update process.', 'wp-mail-smtp' ),
],
[
'svg' => '<svg xmlns="http://www.w3.org/2000/svg" focusable="false" viewBox="0 0 64 64"><path class="st0" d="M64 28.8V32c0 0.9-0.7 1.6-1.6 1.6H56V40c0 0.9-0.7 1.6-1.6 1.6h-3.2c-0.9 0-1.6-0.7-1.6-1.6v-6.4h-6.4c-0.9 0-1.6-0.7-1.6-1.6v-3.2c0-0.9 0.7-1.6 1.6-1.6h6.4v-6.4c0-0.9 0.7-1.6 1.6-1.6h3.2c0.9 0 1.6 0.7 1.6 1.6v6.4h6.4C63.3 27.2 64 27.9 64 28.8z"/><path class="st1" d="M22.4 32c7.1 0 12.8-5.7 12.8-12.8S29.5 6.4 22.4 6.4 9.6 12.1 9.6 19.2 15.3 32 22.4 32zM31.4 35.2h-1.7c-4.6 2.1-9.9 2.1-14.6 0h-1.7C6 35.2 0 41.2 0 48.6v4.2c0 2.7 2.2 4.8 4.8 4.8l0 0H40c2.7 0 4.8-2.1 4.8-4.8l0 0v-4.2C44.8 41.2 38.8 35.2 31.4 35.2z"/></svg>',
'title' => esc_html__( 'New User Notifications', 'wp-mail-smtp' ),
'desc' => esc_html__( 'Toggle emails sent to both user and site administrator about new user accounts.', 'wp-mail-smtp' ),
],
];
$allowed_svg_html = [
'svg' => [
'xmlns' => [],
'focusable' => [],
'viewbox' => [],
],
'path' => [
'class' => [],
'd' => [],
],
];
?>
<div class="wp-mail-smtp-page-upsell">
<h2><?php esc_html_e( 'Unlock Email Controls', 'wp-mail-smtp' ); ?></h2>
<h3>
<?php esc_html_e( 'Email Controls allows you to granularly manage emails sent by WordPress.', 'wp-mail-smtp' ); ?>
</h3>
<div class="wp-mail-smtp-page-upsell-content">
<div class="wp-mail-smtp-page-upsell-features">
<?php foreach ( $features as $feature ) : ?>
<div class="wp-mail-smtp-page-upsell-feature">
<div class="wp-mail-smtp-page-upsell-feature-image">
<?php echo wp_kses( $feature['svg'], $allowed_svg_html ); ?>
</div>
<div class="wp-mail-smtp-page-upsell-feature-content">
<h4><?php echo esc_html( $feature['title'] ); ?></h4>
<p><?php echo esc_html( $feature['desc'] ); ?></p>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<div class="wp-mail-smtp-page-upsell-button">
<a href="<?php echo esc_url( add_query_arg( 'discount', 'LITEUPGRADE', wp_mail_smtp()->get_upgrade_link( [ 'medium' => 'logs', 'content' => '' ] ) ) ); // phpcs:ignore ?>"
class="wp-mail-smtp-btn wp-mail-smtp-btn-lg wp-mail-smtp-btn-orange" target="_blank" rel="noopener noreferrer">
<?php esc_html_e( 'Upgrade to WP Mail SMTP Pro', 'wp-mail-smtp' ); ?>
</a>
</div>
</div>
<?php
}
/**
* Not used as we display an upsell.
*
* @since 1.6.0
*
* @param array $data
*/
public function process_post( $data ) {
}
}

View File

@ -1,68 +0,0 @@
<?php
namespace WPMailSMTP\Admin\Pages;
use WPMailSMTP\Admin\Area;
use WPMailSMTP\Admin\PageAbstract;
use WPMailSMTP\WP;
/**
* Class Logs
*/
class Logs extends PageAbstract {
/**
* Slug of a page.
*
* @since 1.5.0
*
* @var string
*/
protected $slug = 'logs';
/**
* Get the page/tab link.
*
* @since 1.5.0
* @since 2.1.0 Changed the URL to point to the email log settings tab.
*
* @return string
*/
public function get_link() {
return add_query_arg(
'tab',
$this->slug,
WP::admin_url( 'admin.php?page=' . Area::SLUG )
);
}
/**
* Link label of a tab.
*
* @since 1.5.0
*
* @return string
*/
public function get_label() {
return esc_html__( 'Email Log', 'wp-mail-smtp' );
}
/**
* Title of a tab.
*
* @since 1.5.0
*
* @return string
*/
public function get_title() {
return $this->get_label();
}
/**
* Tab content.
*
* @since 2.1.0 Moved the display content to the email log settings tab.
*/
public function display() {}
}

View File

@ -1,86 +0,0 @@
<?php
namespace WPMailSMTP\Admin\Pages;
use WPMailSMTP\Admin\PageAbstract;
/**
* Class LogsTab is a placeholder for Lite users and redirects them to Email Log page.
*
* @since 1.6.0
*/
class LogsTab extends PageAbstract {
/**
* Part of the slug of a tab.
*
* @since 1.6.0
*
* @var string
*/
protected $slug = 'logs';
/**
* @inheritdoc
*
* @since 1.6.0
*/
public function get_label() {
return esc_html__( 'Email Log', 'wp-mail-smtp' );
}
/**
* @inheritdoc
*
* @since 1.6.0
*/
public function get_title() {
return $this->get_label();
}
/**
* Display the upsell content for the Email Log feature.
*
* @since 1.6.0
* @since 2.1.0 Moved the display content from the email log page (WP admin menu "Email Log" page).
*/
public function display() {
?>
<div class="wp-mail-smtp-page-upsell">
<h2><?php esc_html_e( 'Unlock Email Logging', 'wp-mail-smtp' ); ?></h2>
<h3>
<?php esc_html_e( 'Keep track of every email sent from your WordPress site with email logging.', 'wp-mail-smtp' ); ?><br>
<?php esc_html_e( 'Troubleshoot sending issues, recover lost emails, and more!', 'wp-mail-smtp' ); ?>
</h3>
<div class="wp-mail-smtp-page-upsell-images">
<img src="<?php echo esc_url( wp_mail_smtp()->assets_url . '/images/logs/archive.png' ); ?>" alt="<?php esc_attr_e( 'Logs Archive Page Screenshot', 'wp-mail-smtp' ); ?>">
<img src="<?php echo esc_url( wp_mail_smtp()->assets_url . '/images/logs/single.png' ); ?>" alt="<?php esc_attr_e( 'Logs Single Page Screenshot', 'wp-mail-smtp' ); ?>">
</div>
<div class="wp-mail-smtp-page-upsell-button">
<a href="<?php echo esc_url( add_query_arg( 'discount', 'LITEUPGRADE', wp_mail_smtp()->get_upgrade_link( [ 'medium' => 'logs', 'content' => '' ] ) ) ); // phpcs:ignore ?>"
class="wp-mail-smtp-btn wp-mail-smtp-btn-lg wp-mail-smtp-btn-orange wp-mail-smtp-upgrade-modal" target="_blank" rel="noopener noreferrer">
<?php esc_html_e( 'Upgrade to WP Mail SMTP Pro', 'wp-mail-smtp' ); ?>
</a>
</div>
</div>
<?php
}
/**
* Not used as we are simply redirecting users.
*
* @since 1.6.0
*
* @param array $data
*/
public function process_post( $data ) {
}
}

View File

@ -1,259 +0,0 @@
<?php
namespace WPMailSMTP\Admin\Pages;
use WPMailSMTP\Admin\PageAbstract;
use WPMailSMTP\Options;
use WPMailSMTP\UsageTracking\UsageTracking;
use WPMailSMTP\WP;
/**
* Class MiscTab is part of Area, displays different plugin-related settings of the plugin (not related to emails).
*
* @since 1.0.0
*/
class MiscTab extends PageAbstract {
/**
* @var string Slug of a tab.
*/
protected $slug = 'misc';
/**
* @inheritdoc
*/
public function get_label() {
return esc_html__( 'Misc', 'wp-mail-smtp' );
}
/**
* @inheritdoc
*/
public function get_title() {
return $this->get_label();
}
/**
* @inheritdoc
*/
public function display() {
$options = new Options();
?>
<form method="POST" action="">
<?php $this->wp_nonce_field(); ?>
<!-- Section Title -->
<div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-content wp-mail-smtp-clear section-heading no-desc" id="wp-mail-smtp-setting-row-email-heading">
<div class="wp-mail-smtp-setting-field">
<h2><?php echo $this->get_title(); ?></h2>
</div>
</div>
<!-- Do not send -->
<div id="wp-mail-smtp-setting-row-do_not_send" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-do_not_send">
<?php esc_html_e( 'Do Not Send', 'wp-mail-smtp' ); ?>
</label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[general][do_not_send]" type="checkbox" value="true" id="wp-mail-smtp-setting-do_not_send"
<?php echo $options->is_const_defined( 'general', 'do_not_send' ) ? 'disabled' : ''; ?>
<?php checked( true, $options->get( 'general', 'do_not_send' ) ); ?>
>
<label for="wp-mail-smtp-setting-do_not_send">
<?php esc_html_e( 'Check this if you would like to stop sending all emails.', 'wp-mail-smtp' ); ?>
</label>
<p class="desc">
<?php
printf(
wp_kses(
__( 'Some plugins, like BuddyPress and Events Manager, are using their own email delivery solutions. By default, this option does not block their emails, as those plugins do not use default <code>wp_mail()</code> function to send emails.', 'wp-mail-smtp' ),
array(
'code' => array(),
)
)
);
?>
<br>
<?php esc_html_e( 'You will need to consult with their documentation to switch them to use default WordPress email delivery.', 'wp-mail-smtp' ); ?>
<br>
<?php esc_html_e( 'Test emails are allowed to be sent, regardless of this option.', 'wp-mail-smtp' ); ?>
<br>
<?php
if ( $options->is_const_defined( 'general', 'do_not_send' ) ) {
printf( /* translators: %1$s - constant that was used; %2$s - file where it was used. */
esc_html__( 'The value of this field was set using a constant %1$s most likely inside %2$s of your WordPress installation.', 'wp-mail-smtp' ),
'<code>WPMS_DO_NOT_SEND</code>',
'<code>wp-config.php</code>'
);
} else {
printf(
wp_kses( /* translators: %s - The URL to the constants support article. */
__( 'Please read this <a href="%s" target="_blank" rel="noopener noreferrer">support article</a> if you want to enable this option using constants.', 'wp-mail-smtp' ),
[
'a' => [
'href' => [],
'target' => [],
'rel' => [],
],
]
),
'https://wpmailsmtp.com/docs/how-to-secure-smtp-settings-by-using-constants/'
);
}
?>
</p>
</div>
</div>
<!-- Hide Announcements -->
<div id="wp-mail-smtp-setting-row-am_notifications_hidden" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-am_notifications_hidden">
<?php esc_html_e( 'Hide Announcements', 'wp-mail-smtp' ); ?>
</label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[general][am_notifications_hidden]" type="checkbox"
value="true" <?php checked( true, $options->get( 'general', 'am_notifications_hidden' ) ); ?>
id="wp-mail-smtp-setting-am_notifications_hidden"
>
<label for="wp-mail-smtp-setting-am_notifications_hidden">
<?php esc_html_e( 'Check this if you would like to hide plugin announcements and update details.', 'wp-mail-smtp' ); ?>
</label>
</div>
</div>
<!-- Hide Email Delivery Errors -->
<div id="wp-mail-smtp-setting-row-email_delivery_errors_hidden"
class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-email_delivery_errors_hidden">
<?php esc_html_e( 'Hide Email Delivery Errors', 'wp-mail-smtp' ); ?>
</label>
</div>
<div class="wp-mail-smtp-setting-field">
<?php
$is_hard_disabled = has_filter( 'wp_mail_smtp_admin_is_error_delivery_notice_enabled' ) && ! wp_mail_smtp()->get_admin()->is_error_delivery_notice_enabled();
?>
<?php if ( $is_hard_disabled ) : ?>
<input type="checkbox" disabled checked id="wp-mail-smtp-setting-email_delivery_errors_hidden">
<?php else : ?>
<input name="wp-mail-smtp[general][email_delivery_errors_hidden]" type="checkbox" value="true"
<?php checked( true, $options->get( 'general', 'email_delivery_errors_hidden' ) ); ?>
id="wp-mail-smtp-setting-email_delivery_errors_hidden">
<?php endif; ?>
<label for="wp-mail-smtp-setting-email_delivery_errors_hidden">
<?php esc_html_e( 'Check this if you would like to hide warnings alerting of email delivery errors.', 'wp-mail-smtp' ); ?>
</label>
<?php if ( $is_hard_disabled ) : ?>
<p class="desc">
<?php
printf( /* translators: %s - filter that was used to disabled. */
esc_html__( 'Email Delivery Errors were disabled using a %s filter.', 'wp-mail-smtp' ),
'<code>wp_mail_smtp_admin_is_error_delivery_notice_enabled</code>'
);
?>
</p>
<?php else : ?>
<p class="desc">
<?php
echo wp_kses(
__( '<strong>This is not recommended</strong> and should only be done for staging or development sites.', 'wp-mail-smtp' ),
array(
'strong' => true,
)
);
?>
</p>
<?php endif; ?>
</div>
</div>
<!-- Uninstall -->
<div id="wp-mail-smtp-setting-row-uninstall" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-uninstall">
<?php esc_html_e( 'Uninstall WP Mail SMTP', 'wp-mail-smtp' ); ?>
</label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[general][uninstall]" type="checkbox"
value="true" <?php checked( true, $options->get( 'general', 'uninstall' ) ); ?>
id="wp-mail-smtp-setting-uninstall">
<label for="wp-mail-smtp-setting-uninstall">
<?php esc_html_e( 'Check this if you would like to remove ALL WP Mail SMTP data upon plugin deletion. All settings will be unrecoverable.', 'wp-mail-smtp' ); ?>
</label>
</div>
</div>
<?php if ( apply_filters( 'wp_mail_smtp_admin_pages_misc_tab_show_usage_tracking_setting', true ) ) : ?>
<!-- Usage Tracking -->
<div id="wp-mail-smtp-setting-row-usage-tracking" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-usage-tracking">
<?php esc_html_e( 'Allow Usage Tracking', 'wp-mail-smtp' ); ?>
</label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[general][<?php echo esc_attr( UsageTracking::SETTINGS_SLUG ); ?>]" type="checkbox"
value="true" <?php checked( true, $options->get( 'general', UsageTracking::SETTINGS_SLUG ) ); ?>
id="wp-mail-smtp-setting-usage-tracking">
<label for="wp-mail-smtp-setting-usage-tracking">
<?php esc_html_e( 'By allowing us to track usage data we can better help you because we know with which WordPress configurations, themes and plugins we should test.', 'wp-mail-smtp' ); ?>
</label>
</div>
</div>
<?php endif; ?>
<?php $this->display_save_btn(); ?>
</form>
<?php
}
/**
* Process tab form submission ($_POST).
*
* @since 1.0.0
* @since 2.2.0 Fixed checkbox saving and use the correct merge to prevent breaking other 'general' checkboxes.
*
* @param array $data Tab data specific for the plugin ($_POST).
*/
public function process_post( $data ) {
$this->check_admin_referer();
$options = new Options();
// Unchecked checkboxes doesn't exist in $_POST, so we need to ensure we actually have them in data to save.
if ( empty( $data['general']['do_not_send'] ) ) {
$data['general']['do_not_send'] = false;
}
if ( empty( $data['general']['am_notifications_hidden'] ) ) {
$data['general']['am_notifications_hidden'] = false;
}
if ( empty( $data['general']['email_delivery_errors_hidden'] ) ) {
$data['general']['email_delivery_errors_hidden'] = false;
}
if ( empty( $data['general']['uninstall'] ) ) {
$data['general']['uninstall'] = false;
}
if ( empty( $data['general'][ UsageTracking::SETTINGS_SLUG ] ) ) {
$data['general'][ UsageTracking::SETTINGS_SLUG ] = false;
}
// All the sanitization is done there.
$options->set( $data, false, false );
WP::add_admin_notice(
esc_html__( 'Settings were successfully saved.', 'wp-mail-smtp' ),
WP::ADMIN_NOTICE_SUCCESS
);
}
}

View File

@ -1,608 +0,0 @@
<?php
namespace WPMailSMTP\Admin\Pages;
use WPMailSMTP\Admin\PageAbstract;
use WPMailSMTP\Debug;
use WPMailSMTP\Options;
use WPMailSMTP\Providers\Gmail\Auth;
use WPMailSMTP\WP;
/**
* Class SettingsTab is part of Area, displays general settings of the plugin.
*
* @since 1.0.0
*/
class SettingsTab extends PageAbstract {
/**
* Settings constructor.
*
* @since 1.5.0
*/
public function __construct() {
add_action( 'wp_mail_smtp_admin_pages_settings_license_key', array( __CLASS__, 'display_license_key_field_content' ) );
}
/**
* @var string Slug of a tab.
*/
protected $slug = 'settings';
/**
* @inheritdoc
*/
public function get_label() {
return esc_html__( 'General', 'wp-mail-smtp' );
}
/**
* @inheritdoc
*/
public function get_title() {
return $this->get_label();
}
/**
* @inheritdoc
*/
public function display() {
$options = new Options();
$mailer = $options->get( 'mail', 'mailer' );
$disabled_email = in_array( $mailer, [ 'gmail', 'outlook', 'zoho' ], true ) ? 'disabled' : '';
$disabled_name = 'outlook' === $mailer ? 'disabled' : '';
if ( empty( $mailer ) ) {
$mailer = 'mail';
}
$mailer_supported_settings = wp_mail_smtp()->get_providers()->get_options( $mailer )->get_supports();
?>
<form method="POST" action="" autocomplete="off">
<?php $this->wp_nonce_field(); ?>
<?php ob_start(); ?>
<!-- License Section Title -->
<div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-content wp-mail-smtp-clear section-heading" id="wp-mail-smtp-setting-row-license-heading">
<div class="wp-mail-smtp-setting-field">
<h2><?php esc_html_e( 'License', 'wp-mail-smtp' ); ?></h2>
<p class="desc">
<?php esc_html_e( 'Your license key provides access to updates and support.', 'wp-mail-smtp' ); ?>
</p>
</div>
</div>
<!-- License Key -->
<div id="wp-mail-smtp-setting-row-license_key" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-license_key wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-license_key"><?php esc_html_e( 'License Key', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<?php do_action( 'wp_mail_smtp_admin_pages_settings_license_key', $options ); ?>
</div>
</div>
<!-- Mail Section Title -->
<div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-content wp-mail-smtp-clear section-heading no-desc" id="wp-mail-smtp-setting-row-email-heading">
<div class="wp-mail-smtp-setting-field">
<h2><?php esc_html_e( 'Mail', 'wp-mail-smtp' ); ?></h2>
</div>
</div>
<!-- From Email -->
<div id="wp-mail-smtp-setting-row-from_email" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-email wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-from_email"><?php esc_html_e( 'From Email', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<div class="js-wp-mail-smtp-setting-from_email" style="display: <?php echo empty( $mailer_supported_settings['from_email'] ) ? 'none' : 'block'; ?>;">
<?php if ( 'gmail' !== $mailer ) : ?>
<input name="wp-mail-smtp[mail][from_email]" type="email"
value="<?php echo esc_attr( $options->get( 'mail', 'from_email' ) ); ?>"
<?php echo $options->is_const_defined( 'mail', 'from_email' ) || ! empty( $disabled_email ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-from_email" spellcheck="false"
placeholder="<?php echo esc_attr( wp_mail_smtp()->get_processor()->get_default_email() ); ?>">
<?php else : ?>
<?php
// Gmail mailer From Email selector.
$gmail_auth = new Auth();
$gmail_aliases = $gmail_auth->is_clients_saved() ? $gmail_auth->get_user_possible_send_from_addresses() : [];
?>
<?php if ( empty( $gmail_aliases ) ) : ?>
<select name="wp-mail-smtp[mail][from_email]" id="wp-mail-smtp-setting-from_email" disabled>
<option value=""><?php esc_html_e( 'Please first authorize the Gmail mailer below', 'wp-mail-smtp' ); ?></option>
</select>
<?php else : ?>
<select name="wp-mail-smtp[mail][from_email]" id="wp-mail-smtp-setting-from_email">
<?php foreach ( $gmail_aliases as $gmail_email_address ) : ?>
<option value="<?php echo esc_attr( $gmail_email_address ); ?>" <?php selected( $options->get( 'mail', 'from_email' ), $gmail_email_address ); ?>><?php echo esc_html( $gmail_email_address ); ?></option>
<?php endforeach; ?>
</select>
<?php endif; ?>
<?php endif; ?>
<?php if ( empty( $disabled_email ) ) : ?>
<p class="desc">
<?php esc_html_e( 'The email address which emails are sent from.', 'wp-mail-smtp' ); ?><br/>
<?php esc_html_e( 'If you\'re using an email provider (Yahoo, Outlook.com, etc) this should be your email address for that account.', 'wp-mail-smtp' ); ?>
</p>
<p class="desc">
<?php esc_html_e( 'Please note that other plugins can change this, to prevent this use the setting below.', 'wp-mail-smtp' ); ?>
</p>
<?php endif; ?>
</div>
<hr class="wp-mail-smtp-setting-mid-row-sep" style="display: <?php echo ( ! empty( $mailer_supported_settings['from_email'] ) && ! empty( $mailer_supported_settings['from_email_force'] ) ) ? 'block' : 'none'; ?>;">
<div class="js-wp-mail-smtp-setting-from_email_force" style="display: <?php echo empty( $mailer_supported_settings['from_email_force'] ) ? 'none' : 'block'; ?>;">
<?php if ( 'gmail' !== $mailer ) : ?>
<input name="wp-mail-smtp[mail][from_email_force]" type="checkbox"
value="true" <?php checked( true, (bool) $options->get( 'mail', 'from_email_force' ) ); ?>
<?php echo $options->is_const_defined( 'mail', 'from_email_force' ) || ! empty( $disabled_email ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-from_email_force">
<?php else : ?>
<input name="wp-mail-smtp[mail][from_email_force]" type="checkbox"
value="true" checked="checked" disabled
id="wp-mail-smtp-setting-from_email_force">
<?php endif; ?>
<label for="wp-mail-smtp-setting-from_email_force">
<?php esc_html_e( 'Force From Email', 'wp-mail-smtp' ); ?>
</label>
<?php if ( ! empty( $disabled_email ) ) : ?>
<p class="desc">
<?php
if ( 'gmail' !== $mailer ) :
esc_html_e( 'Current provider will automatically force From Email to be the email address that you use to set up the connection below.', 'wp-mail-smtp' );
else :
esc_html_e( 'Gmail mailer will automatically force From Email to be the email address that you selected above.', 'wp-mail-smtp' );
endif;
?>
</p>
<?php else : ?>
<p class="desc">
<?php esc_html_e( 'If checked, the From Email setting above will be used for all emails, ignoring values set by other plugins.', 'wp-mail-smtp' ); ?>
</p>
<?php endif; ?>
</div>
</div>
</div>
<!-- From Name -->
<div id="wp-mail-smtp-setting-row-from_name" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-from_name"><?php esc_html_e( 'From Name', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<div class="js-wp-mail-smtp-setting-from_name" style="display: <?php echo empty( $mailer_supported_settings['from_name'] ) ? 'none' : 'block'; ?>;">
<input name="wp-mail-smtp[mail][from_name]" type="text"
value="<?php echo esc_attr( $options->get( 'mail', 'from_name' ) ); ?>"
<?php echo $options->is_const_defined( 'mail', 'from_name' ) || ! empty( $disabled_name ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-from_name" spellcheck="false"
placeholder="<?php echo esc_attr( wp_mail_smtp()->get_processor()->get_default_name() ); ?>">
<?php if ( empty( $disabled_name ) ) : ?>
<p class="desc">
<?php esc_html_e( 'The name which emails are sent from.', 'wp-mail-smtp' ); ?>
</p>
<?php endif; ?>
</div>
<hr class="wp-mail-smtp-setting-mid-row-sep" style="display: <?php echo ( ! empty( $mailer_supported_settings['from_name'] ) && ! empty( $mailer_supported_settings['from_name_force'] ) ) ? 'block' : 'none'; ?>;">
<div class="js-wp-mail-smtp-setting-from_name_force" style="display: <?php echo empty( $mailer_supported_settings['from_name_force'] ) ? 'none' : 'block'; ?>;">
<input name="wp-mail-smtp[mail][from_name_force]" type="checkbox"
value="true" <?php checked( true, (bool) $options->get( 'mail', 'from_name_force' ) ); ?>
<?php echo $options->is_const_defined( 'mail', 'from_name_force' ) || ! empty( $disabled_name ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-from_name_force">
<label for="wp-mail-smtp-setting-from_name_force">
<?php esc_html_e( 'Force From Name', 'wp-mail-smtp' ); ?>
</label>
<?php if ( ! empty( $disabled_name ) ) : ?>
<p class="desc">
<?php esc_html_e( 'Current provider doesn\'t support setting and forcing From Name. Emails will be sent on behalf of the account name used to setup the connection below.', 'wp-mail-smtp' ); ?>
</p>
<?php else : ?>
<p class="desc">
<?php esc_html_e( 'If checked, the From Name setting above will be used for all emails, ignoring values set by other plugins.', 'wp-mail-smtp' ); ?>
</p>
<?php endif; ?>
</div>
</div>
</div>
<!-- Return Path -->
<div id="wp-mail-smtp-setting-row-return_path" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear js-wp-mail-smtp-setting-return_path" style="display: <?php echo empty( $mailer_supported_settings['return_path'] ) ? 'none' : 'block'; ?>;">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-return_path"><?php esc_html_e( 'Return Path', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[mail][return_path]" type="checkbox"
value="true" <?php checked( true, (bool) $options->get( 'mail', 'return_path' ) ); ?>
<?php echo $options->is_const_defined( 'mail', 'return_path' ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-return_path">
<label for="wp-mail-smtp-setting-return_path">
<?php esc_html_e( 'Set the return-path to match the From Email', 'wp-mail-smtp' ); ?>
</label>
<p class="desc">
<?php esc_html_e( 'Return Path indicates where non-delivery receipts - or bounce messages - are to be sent.', 'wp-mail-smtp' ); ?><br/>
<?php esc_html_e( 'If unchecked, bounce messages may be lost. Some providers may ignore this option.', 'wp-mail-smtp' ); ?>
</p>
</div>
</div>
<!-- Mailer -->
<div id="wp-mail-smtp-setting-row-mailer" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-mailer wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-mailer"><?php esc_html_e( 'Mailer', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<div class="wp-mail-smtp-mailers">
<?php foreach ( wp_mail_smtp()->get_providers()->get_options_all() as $provider ) : ?>
<div class="wp-mail-smtp-mailer wp-mail-smtp-mailer-<?php echo esc_attr( $provider->get_slug() ); ?> <?php echo $mailer === $provider->get_slug() ? 'active' : ''; ?>">
<div class="wp-mail-smtp-mailer-image <?php echo $provider->is_recommended() ? 'is-recommended' : ''; ?>">
<img src="<?php echo esc_url( $provider->get_logo_url() ); ?>"
alt="<?php echo esc_attr( $provider->get_title() ); ?>">
</div>
<div class="wp-mail-smtp-mailer-text">
<?php if ( $provider->is_disabled() ) : ?>
<input type="radio" name="wp-mail-smtp[mail][mailer]" disabled
class="js-wp-mail-smtp-setting-mailer-radio-input educate"
id="wp-mail-smtp-setting-mailer-<?php echo esc_attr( $provider->get_slug() ); ?>"
value="<?php echo esc_attr( $provider->get_slug() ); ?>"
/>
<?php else : ?>
<input id="wp-mail-smtp-setting-mailer-<?php echo esc_attr( $provider->get_slug() ); ?>"
type="radio" name="wp-mail-smtp[mail][mailer]"
value="<?php echo esc_attr( $provider->get_slug() ); ?>"
class="js-wp-mail-smtp-setting-mailer-radio-input<?php echo $provider->is_disabled() ? ' educate' : ''; ?>"
<?php checked( $provider->get_slug(), $mailer ); ?>
<?php echo $options->is_const_defined( 'mail', 'mailer' ) || $provider->is_disabled() ? 'disabled' : ''; ?>
/>
<?php endif; ?>
<label for="wp-mail-smtp-setting-mailer-<?php echo esc_attr( $provider->get_slug() ); ?>">
<?php echo esc_html( $provider->get_title() ); ?>
</label>
</div>
</div>
<?php endforeach; ?>
</div>
<!-- Suggest a mailer -->
<div class="wp-mail-smtp-suggest-new-mailer">
<p class="desc">
<?php esc_html_e( 'Don\'t see what you\'re looking for?', 'wp-mail-smtp' ); ?>
<a href="https://wpmailsmtp.com/suggest-a-mailer" target="_blank" rel="noopener noreferrer">
<?php esc_html_e( 'Suggest a Mailer', 'wp-mail-smtp' ); ?>
</a>
</p>
</div>
</div>
</div>
<!-- Mailer Options -->
<div class="wp-mail-smtp-mailer-options">
<?php foreach ( wp_mail_smtp()->get_providers()->get_options_all() as $provider ) : ?>
<?php $provider_desc = $provider->get_description(); ?>
<div class="wp-mail-smtp-mailer-option wp-mail-smtp-mailer-option-<?php echo esc_attr( $provider->get_slug() ); ?> <?php echo $mailer === $provider->get_slug() ? 'active' : 'hidden'; ?>">
<!-- Mailer Title/Notice/Description -->
<div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-content wp-mail-smtp-clear section-heading <?php echo empty( $provider_desc ) ? 'no-desc' : ''; ?>" id="wp-mail-smtp-setting-row-email-heading">
<div class="wp-mail-smtp-setting-field">
<?php if ( $provider->is_disabled() ) : ?>
<?php $provider->display_options(); ?>
<?php else : ?>
<h2><?php echo $provider->get_title(); ?></h2>
<?php
$provider_edu_notice = $provider->get_notice( 'educational' );
$is_dismissed = (bool) get_user_meta( get_current_user_id(), "wp_mail_smtp_notice_educational_for_{$provider->get_slug()}_dismissed", true );
if ( ! empty( $provider_edu_notice ) && ! $is_dismissed ) :
?>
<p class="inline-notice inline-edu-notice"
data-notice="educational"
data-mailer="<?php echo esc_attr( $provider->get_slug() ); ?>">
<a href="#" title="<?php esc_attr_e( 'Dismiss this notice', 'wp-mail-smtp' ); ?>"
class="wp-mail-smtp-mailer-notice-dismiss js-wp-mail-smtp-mailer-notice-dismiss">
<span class="dashicons dashicons-dismiss"></span>
</a>
<?php echo $provider_edu_notice; ?>
</p>
<?php endif; ?>
<?php if ( ! empty( $provider_desc ) ) : ?>
<p class="desc"><?php echo $provider_desc; ?></p>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
<?php $provider->display_options(); ?>
</div>
<?php endforeach; ?>
</div>
<?php
$settings_content = apply_filters( 'wp_mail_smtp_admin_settings_tab_display', ob_get_clean() );
echo $settings_content; // phpcs:ignore
?>
<?php $this->display_save_btn(); ?>
</form>
<?php
$this->display_wpforms();
$this->display_pro_banner();
}
/**
* License key text for a Lite version of the plugin.
*
* @since 1.5.0
*
* @param Options $options
*/
public static function display_license_key_field_content( $options ) {
?>
<p><?php esc_html_e( 'You\'re using WP Mail SMTP Lite - no license needed. Enjoy!', 'wp-mail-smtp' ); ?> 🙂</p>
<p>
<?php
printf(
wp_kses( /* translators: %s - WPMailSMTP.com upgrade URL. */
__( 'To unlock more features consider <strong><a href="%s" target="_blank" rel="noopener noreferrer" class="wp-mail-smtp-upgrade-modal">upgrading to PRO</a></strong>.', 'wp-mail-smtp' ),
array(
'a' => array(
'href' => array(),
'class' => array(),
'target' => array(),
'rel' => array(),
),
'strong' => array(),
)
),
esc_url( wp_mail_smtp()->get_upgrade_link( 'general-license-key' ) )
);
?>
</p>
<p class="desc">
<?php
echo wp_kses(
__( 'As a valued WP Mail SMTP Lite user you receive <strong>$50 off</strong>, automatically applied at checkout!', 'wp-mail-smtp' ),
array(
'strong' => array(),
'br' => array(),
)
);
?>
</p>
<?php
}
/**
* Display a WPForms related message.
*
* @since 1.3.0
* @since 1.4.0 Display only to site admins.
* @since 1.5.0 Do nothing.
*/
protected function display_wpforms() {
/*
* Used to have this check:
*
* $is_dismissed = get_user_meta( get_current_user_id(), 'wp_mail_smtp_wpforms_dismissed', true );
*/
}
/**
* Display WP Mail SMTP Pro upgrade banner.
*
* @since 1.5.0
*/
protected function display_pro_banner() {
// Display only to site admins. Only site admins can install plugins.
if ( ! is_super_admin() ) {
return;
}
// Do not display if WP Mail SMTP Pro already installed.
if ( wp_mail_smtp()->is_pro() ) {
return;
}
$is_dismissed = get_user_meta( get_current_user_id(), 'wp_mail_smtp_pro_banner_dismissed', true );
// Do not display if user dismissed.
if ( (bool) $is_dismissed === true ) {
return;
}
?>
<div id="wp-mail-smtp-pro-banner">
<span class="wp-mail-smtp-pro-banner-dismiss">
<button id="wp-mail-smtp-pro-banner-dismiss">
<span class="dashicons dashicons-dismiss"></span>
</button>
</span>
<h2>
<?php esc_html_e( 'Get WP Mail SMTP Pro and Unlock all the Powerful Features', 'wp-mail-smtp' ); ?>
</h2>
<p>
<?php esc_html_e( 'Thanks for being a loyal WP Mail SMTP user. Upgrade to WP Mail SMTP Pro to unlock more awesome features and experience why WP Mail SMTP is the most popular SMTP plugin.', 'wp-mail-smtp' ); ?>
</p>
<p>
<?php esc_html_e( 'We know that you will truly love WP Mail SMTP. It\'s used by over 1,000,000 websites.', 'wp-mail-smtp' ); ?>
</p>
<p><strong><?php esc_html_e( 'Pro Features:', 'wp-mail-smtp' ); ?></strong></p>
<div class="benefits">
<ul>
<li><?php esc_html_e( 'Manage Notifications - control which emails your site sends', 'wp-mail-smtp' ); ?></li>
<li><?php esc_html_e( 'Email Logging - keep track of every email sent from your site', 'wp-mail-smtp' ); ?></li>
<li><?php esc_html_e( 'Office 365 - send emails using your Office 365 account', 'wp-mail-smtp' ); ?></li>
<li><?php esc_html_e( 'Amazon SES - harness the power of AWS', 'wp-mail-smtp' ); ?></li>
<li><?php esc_html_e( 'Outlook.com - send emails using your Outlook.com account', 'wp-mail-smtp' ); ?></li>
<li><?php esc_html_e( 'Access to our world class support team', 'wp-mail-smtp' ); ?></li>
</ul>
<ul>
<li><?php esc_html_e( 'White Glove Setup - sit back and relax while we handle everything for you', 'wp-mail-smtp' ); ?></li>
<li class="arrow-right"><?php esc_html_e( 'Install WP Mail SMTP Pro plugin', 'wp-mail-smtp' ); ?></li>
<li class="arrow-right"><?php esc_html_e( 'Set up domain name verification (DNS)', 'wp-mail-smtp' ); ?></li>
<li class="arrow-right"><?php esc_html_e( 'Configure Mailgun service', 'wp-mail-smtp' ); ?></li>
<li class="arrow-right"><?php esc_html_e( 'Set up WP Mail SMTP Pro plugin', 'wp-mail-smtp' ); ?></li>
<li class="arrow-right"><?php esc_html_e( 'Test and verify email delivery', 'wp-mail-smtp' ); ?></li>
</ul>
</div>
<p>
<?php
printf(
wp_kses( /* translators: %s - WPMailSMTP.com URL. */
__( '<a href="%s" target="_blank" rel="noopener noreferrer">Get WP Mail SMTP Pro Today and Unlock all the Powerful Features &raquo;</a>', 'wp-mail-smtp' ),
array(
'a' => array(
'href' => array(),
'target' => array(),
'rel' => array(),
),
'strong' => array(),
)
),
esc_url( wp_mail_smtp()->get_upgrade_link( 'general-cta' ) )
);
?>
</p>
<p>
<?php
echo wp_kses(
__( '<strong>Bonus:</strong> WP Mail SMTP users get <span class="price-off">$50 off regular price</span>, automatically applied at checkout.', 'wp-mail-smtp' ),
array(
'strong' => array(),
'span' => array(
'class' => array(),
),
)
);
?>
</p>
</div>
<?php
}
/**
* @inheritdoc
*/
public function process_post( $data ) {
$this->check_admin_referer();
$options = new Options();
$old_opt = $options->get_all();
// When checkbox is unchecked - it's not submitted at all, so we need to define its default false value.
if ( ! isset( $data['mail']['from_email_force'] ) ) {
$data['mail']['from_email_force'] = false;
}
if ( ! isset( $data['mail']['from_name_force'] ) ) {
$data['mail']['from_name_force'] = false;
}
if ( ! isset( $data['mail']['return_path'] ) ) {
$data['mail']['return_path'] = false;
}
if ( ! isset( $data['smtp']['autotls'] ) ) {
$data['smtp']['autotls'] = false;
}
if ( ! isset( $data['smtp']['auth'] ) ) {
$data['smtp']['auth'] = false;
}
// When switching mailers.
if (
! empty( $old_opt['mail']['mailer'] ) &&
! empty( $data['mail']['mailer'] ) &&
$old_opt['mail']['mailer'] !== $data['mail']['mailer']
) {
// Remove all debug messages when switching mailers.
Debug::clear();
// Save correct from email address if Zoho or Outlook mailers are already configured.
if (
in_array( $data['mail']['mailer'], [ 'zoho', 'outlook' ], true ) &&
! empty( $old_opt[ $data['mail']['mailer'] ]['user_details']['email'] )
) {
$data['mail']['from_email'] = $old_opt[ $data['mail']['mailer'] ]['user_details']['email'];
}
}
$to_redirect = false;
// Old and new Gmail client id/secret values are different - we need to invalidate tokens and scroll to Auth button.
if (
$options->get( 'mail', 'mailer' ) === 'gmail' &&
! empty( $data['gmail']['client_id'] ) &&
! empty( $data['gmail']['client_secret'] ) &&
(
$options->get( 'gmail', 'client_id' ) !== $data['gmail']['client_id'] ||
$options->get( 'gmail', 'client_secret' ) !== $data['gmail']['client_secret']
)
) {
unset( $old_opt['gmail'] );
if (
! empty( $data['gmail']['client_id'] ) &&
! empty( $data['gmail']['client_secret'] )
) {
$to_redirect = true;
}
}
$data = apply_filters( 'wp_mail_smtp_settings_tab_process_post', $data );
// All the sanitization is done in Options class.
$options->set( $data, false, false );
if ( $to_redirect ) {
wp_redirect( $_POST['_wp_http_referer'] . '#wp-mail-smtp-setting-row-gmail-authorize' );
exit;
}
WP::add_admin_notice(
esc_html__( 'Settings were successfully saved.', 'wp-mail-smtp' ),
WP::ADMIN_NOTICE_SUCCESS
);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,55 +0,0 @@
<?php
namespace WPMailSMTP\Admin;
/**
* WordPress class extended for on-the-fly plugin installations.
*
* @since 1.5.0
* @since 1.7.1 Removed feedback() method override to be compatible with PHP5.3+ and WP5.3.
*/
class PluginsInstallSkin extends \WP_Upgrader_Skin {
/**
* Empty out the header of its HTML content and only check to see if it has
* been performed or not.
*
* @since 1.5.0
*/
public function header() {
}
/**
* Empty out the footer of its HTML contents.
*
* @since 1.5.0
*/
public function footer() {
}
/**
* Instead of outputting HTML for errors, json_encode the errors and send them
* back to the Ajax script for processing.
*
* @since 1.5.0
*
* @param array $errors Array of errors with the install process.
*/
public function error( $errors ) {
if ( ! empty( $errors ) ) {
wp_send_json_error( $errors );
}
}
/**
* Empty out JavaScript output that calls function to decrement the update counts.
*
* @since 1.5.0
*
* @param string $type Type of update count to decrement.
*/
public function decrement_update_count( $type ) {
}
}

View File

@ -1,581 +0,0 @@
<?php
namespace WPMailSMTP\Admin;
use WP_Error;
use WP_Upgrader;
use WP_Filesystem_Base;
/** \WP_Upgrader class */
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
/** \Plugin_Upgrader class */
require_once ABSPATH . 'wp-admin/includes/class-plugin-upgrader.php';
/**
* In WP 5.3 a PHP 5.6 splat operator (...$args) was added to \WP_Upgrader_Skin::feedback().
* We need to remove all calls to *Skin::feedback() method, as we can't override it in own Skin
* without breaking support for PHP 5.3-5.5.
*
* @internal Please do not use this class outside of core WPForms development. May be removed at any time.
*
* @since 1.7.1
*/
class PluginsInstallUpgrader extends \Plugin_Upgrader {
/**
* Run an upgrade/installation.
*
* Attempts to download the package (if it is not a local file), unpack it, and
* install it in the destination folder.
*
* @since 2.8.0
*
* @param array $options {
* Array or string of arguments for upgrading/installing a package.
*
* @type string $package The full path or URI of the package to install.
* Default empty.
* @type string $destination The full path to the destination folder.
* Default empty.
* @type bool $clear_destination Whether to delete any files already in the
* destination folder. Default false.
* @type bool $clear_working Whether to delete the files form the working
* directory after copying to the destination.
* Default false.
* @type bool $abort_if_destination_exists Whether to abort the installation if the destination
* folder already exists. When true, `$clear_destination`
* should be false. Default true.
* @type bool $is_multi Whether this run is one of multiple upgrade/installation
* actions being performed in bulk. When true, the skin
* WP_Upgrader::header() and WP_Upgrader::footer()
* aren't called. Default false.
* @type array $hook_extra Extra arguments to pass to the filter hooks called by
* WP_Upgrader::run().
* }
* @return array|false|WP_error The result from self::install_package() on success, otherwise a WP_Error,
* or false if unable to connect to the filesystem.
*/
public function run( $options ) {
$defaults = array(
'package' => '', // Please always pass this.
'destination' => '', // And this
'clear_destination' => false,
'abort_if_destination_exists' => true, // Abort if the Destination directory exists, Pass clear_destination as false please
'clear_working' => true,
'is_multi' => false,
'hook_extra' => array(), // Pass any extra $hook_extra args here, this will be passed to any hooked filters.
);
$options = wp_parse_args( $options, $defaults );
/**
* Filters the package options before running an update.
*
* See also {@see 'upgrader_process_complete'}.
*
* @since 4.3.0
*
* @param array $options {
* Options used by the upgrader.
*
* @type string $package Package for update.
* @type string $destination Update location.
* @type bool $clear_destination Clear the destination resource.
* @type bool $clear_working Clear the working resource.
* @type bool $abort_if_destination_exists Abort if the Destination directory exists.
* @type bool $is_multi Whether the upgrader is running multiple times.
* @type array $hook_extra {
* Extra hook arguments.
*
* @type string $action Type of action. Default 'update'.
* @type string $type Type of update process. Accepts 'plugin', 'theme', or 'core'.
* @type bool $bulk Whether the update process is a bulk update. Default true.
* @type string $plugin Path to the plugin file relative to the plugins directory.
* @type string $theme The stylesheet or template name of the theme.
* @type string $language_update_type The language pack update type. Accepts 'plugin', 'theme',
* or 'core'.
* @type object $language_update The language pack update offer.
* }
* }
*/
$options = apply_filters( 'upgrader_package_options', $options );
if ( ! $options['is_multi'] ) { // call $this->header separately if running multiple times
$this->skin->header();
}
// Connect to the Filesystem first.
$res = $this->fs_connect( array( WP_CONTENT_DIR, $options['destination'] ) );
// Mainly for non-connected filesystem.
if ( ! $res ) {
if ( ! $options['is_multi'] ) {
$this->skin->footer();
}
return false;
}
$this->skin->before();
if ( is_wp_error( $res ) ) {
$this->skin->error( $res );
$this->skin->after();
if ( ! $options['is_multi'] ) {
$this->skin->footer();
}
return $res;
}
/*
* Download the package (Note, This just returns the filename
* of the file if the package is a local file)
*/
$download = $this->download_package( $options['package'], true );
// Allow for signature soft-fail.
// WARNING: This may be removed in the future.
if ( is_wp_error( $download ) && $download->get_error_data( 'softfail-filename' ) ) {
// Don't output the 'no signature could be found' failure message for now.
if ( 'signature_verification_no_signature' != $download->get_error_code() || WP_DEBUG ) {
// Outout the failure error as a normal feedback, and not as an error:
//$this->skin->feedback( $download->get_error_message() );
// Report this failure back to WordPress.org for debugging purposes.
wp_version_check(
array(
'signature_failure_code' => $download->get_error_code(),
'signature_failure_data' => $download->get_error_data(),
)
);
}
// Pretend this error didn't happen.
$download = $download->get_error_data( 'softfail-filename' );
}
if ( is_wp_error( $download ) ) {
$this->skin->error( $download );
$this->skin->after();
if ( ! $options['is_multi'] ) {
$this->skin->footer();
}
return $download;
}
$delete_package = ( $download != $options['package'] ); // Do not delete a "local" file
// Unzips the file into a temporary directory.
$working_dir = $this->unpack_package( $download, $delete_package );
if ( is_wp_error( $working_dir ) ) {
$this->skin->error( $working_dir );
$this->skin->after();
if ( ! $options['is_multi'] ) {
$this->skin->footer();
}
return $working_dir;
}
// With the given options, this installs it to the destination directory.
$result = $this->install_package(
array(
'source' => $working_dir,
'destination' => $options['destination'],
'clear_destination' => $options['clear_destination'],
'abort_if_destination_exists' => $options['abort_if_destination_exists'],
'clear_working' => $options['clear_working'],
'hook_extra' => $options['hook_extra'],
)
);
$this->skin->set_result( $result );
if ( is_wp_error( $result ) ) {
$this->skin->error( $result );
//$this->skin->feedback( 'process_failed' );
} else {
// Installation succeeded.
//$this->skin->feedback( 'process_success' );
}
$this->skin->after();
if ( ! $options['is_multi'] ) {
/**
* Fires when the upgrader process is complete.
*
* See also {@see 'upgrader_package_options'}.
*
* @since 3.6.0
* @since 3.7.0 Added to WP_Upgrader::run().
* @since 4.6.0 `$translations` was added as a possible argument to `$hook_extra`.
*
* @param WP_Upgrader $this WP_Upgrader instance. In other contexts, $this, might be a
* Theme_Upgrader, Plugin_Upgrader, Core_Upgrade, or Language_Pack_Upgrader instance.
* @param array $hook_extra {
* Array of bulk item update data.
*
* @type string $action Type of action. Default 'update'.
* @type string $type Type of update process. Accepts 'plugin', 'theme', 'translation', or 'core'.
* @type bool $bulk Whether the update process is a bulk update. Default true.
* @type array $plugins Array of the basename paths of the plugins' main files.
* @type array $themes The theme slugs.
* @type array $translations {
* Array of translations update data.
*
* @type string $language The locale the translation is for.
* @type string $type Type of translation. Accepts 'plugin', 'theme', or 'core'.
* @type string $slug Text domain the translation is for. The slug of a theme/plugin or
* 'default' for core translations.
* @type string $version The version of a theme, plugin, or core.
* }
* }
*/
do_action( 'upgrader_process_complete', $this, $options['hook_extra'] );
$this->skin->footer();
}
return $result;
}
/**
* Toggle maintenance mode for the site.
*
* Creates/deletes the maintenance file to enable/disable maintenance mode.
*
* @since 2.8.0
*
* @global WP_Filesystem_Base $wp_filesystem Subclass
*
* @param bool $enable True to enable maintenance mode, false to disable.
*/
public function maintenance_mode( $enable = false ) {
global $wp_filesystem;
$file = $wp_filesystem->abspath() . '.maintenance';
if ( $enable ) {
//$this->skin->feedback( 'maintenance_start' );
// Create maintenance file to signal that we are upgrading
$maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
$wp_filesystem->delete( $file );
$wp_filesystem->put_contents( $file, $maintenance_string, FS_CHMOD_FILE );
} elseif ( ! $enable && $wp_filesystem->exists( $file ) ) {
//$this->skin->feedback( 'maintenance_end' );
$wp_filesystem->delete( $file );
}
}
/**
* Download a package.
*
* @since 2.8.0
* @since 5.5.0 Added the `$hook_extra` parameter.
*
* @param string $package The URI of the package. If this is the full path to an
* existing local file, it will be returned untouched.
* @param bool $check_signatures Whether to validate file signatures. Default false.
* @param array $hook_extra Extra arguments to pass to the filter hooks. Default empty array.
*
* @return string|WP_Error The full path to the downloaded package file, or a WP_Error object.
*/
public function download_package( $package, $check_signatures = false, $hook_extra = array() ) {
/**
* Filters whether to return the package.
*
* @since 3.7.0
* @since 5.5.0 Added the `$hook_extra` parameter.
*
* @param bool $reply Whether to bail without returning the package.
* Default false.
* @param string $package The package file name.
* @param WP_Upgrader $this The WP_Upgrader instance.
* @param array $hook_extra Extra arguments passed to hooked filters.
*/
$reply = apply_filters( 'upgrader_pre_download', false, $package, $this, $hook_extra );
if ( false !== $reply ) {
return $reply;
}
if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) { //Local file or remote?
return $package; //must be a local file..
}
if ( empty( $package ) ) {
return new WP_Error( 'no_package', $this->strings['no_package'] );
}
//$this->skin->feedback( 'downloading_package', $package );
$download_file = download_url( $package, 300, $check_signatures );
if ( is_wp_error( $download_file ) && ! $download_file->get_error_data( 'softfail-filename' ) ) {
return new WP_Error( 'download_failed', $this->strings['download_failed'], $download_file->get_error_message() );
}
return $download_file;
}
/**
* Unpack a compressed package file.
*
* @since 2.8.0
*
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
*
* @param string $package Full path to the package file.
* @param bool $delete_package Optional. Whether to delete the package file after attempting
* to unpack it. Default true.
* @return string|WP_Error The path to the unpacked contents, or a WP_Error on failure.
*/
public function unpack_package( $package, $delete_package = true ) {
global $wp_filesystem;
//$this->skin->feedback( 'unpack_package' );
$upgrade_folder = $wp_filesystem->wp_content_dir() . 'upgrade/';
//Clean up contents of upgrade directory beforehand.
$upgrade_files = $wp_filesystem->dirlist( $upgrade_folder );
if ( ! empty( $upgrade_files ) ) {
foreach ( $upgrade_files as $file ) {
$wp_filesystem->delete( $upgrade_folder . $file['name'], true );
}
}
// We need a working directory - Strip off any .tmp or .zip suffixes
$working_dir = $upgrade_folder . basename( basename( $package, '.tmp' ), '.zip' );
// Clean up working directory
if ( $wp_filesystem->is_dir( $working_dir ) ) {
$wp_filesystem->delete( $working_dir, true );
}
// Unzip package to working directory
$result = unzip_file( $package, $working_dir );
// Once extracted, delete the package if required.
if ( $delete_package ) {
unlink( $package );
}
if ( is_wp_error( $result ) ) {
$wp_filesystem->delete( $working_dir, true );
if ( 'incompatible_archive' == $result->get_error_code() ) {
return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], $result->get_error_data() );
}
return $result;
}
return $working_dir;
}
/**
* Install a package.
*
* Copies the contents of a package form a source directory, and installs them in
* a destination directory. Optionally removes the source. It can also optionally
* clear out the destination folder if it already exists.
*
* @since 2.8.0
*
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
* @global array $wp_theme_directories
*
* @param array|string $args {
* Optional. Array or string of arguments for installing a package. Default empty array.
*
* @type string $source Required path to the package source. Default empty.
* @type string $destination Required path to a folder to install the package in.
* Default empty.
* @type bool $clear_destination Whether to delete any files already in the destination
* folder. Default false.
* @type bool $clear_working Whether to delete the files form the working directory
* after copying to the destination. Default false.
* @type bool $abort_if_destination_exists Whether to abort the installation if
* the destination folder already exists. Default true.
* @type array $hook_extra Extra arguments to pass to the filter hooks called by
* WP_Upgrader::install_package(). Default empty array.
* }
*
* @return array|WP_Error The result (also stored in `WP_Upgrader::$result`), or a WP_Error on failure.
*/
public function install_package( $args = array() ) {
global $wp_filesystem, $wp_theme_directories;
$defaults = array(
'source' => '', // Please always pass this
'destination' => '', // and this
'clear_destination' => false,
'clear_working' => false,
'abort_if_destination_exists' => true,
'hook_extra' => array(),
);
$args = wp_parse_args( $args, $defaults );
// These were previously extract()'d.
$source = $args['source'];
$destination = $args['destination'];
$clear_destination = $args['clear_destination'];
set_time_limit( 300 );
if ( empty( $source ) || empty( $destination ) ) {
return new WP_Error( 'bad_request', $this->strings['bad_request'] );
}
//$this->skin->feedback( 'installing_package' );
/**
* Filters the install response before the installation has started.
*
* Returning a truthy value, or one that could be evaluated as a WP_Error
* will effectively short-circuit the installation, returning that value
* instead.
*
* @since 2.8.0
*
* @param bool|WP_Error $response Response.
* @param array $hook_extra Extra arguments passed to hooked filters.
*/
$res = apply_filters( 'upgrader_pre_install', true, $args['hook_extra'] );
if ( is_wp_error( $res ) ) {
return $res;
}
//Retain the Original source and destinations
$remote_source = $args['source'];
$local_destination = $destination;
$source_files = array_keys( $wp_filesystem->dirlist( $remote_source ) );
$remote_destination = $wp_filesystem->find_folder( $local_destination );
//Locate which directory to copy to the new folder, This is based on the actual folder holding the files.
if ( 1 == count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) { //Only one folder? Then we want its contents.
$source = trailingslashit( $args['source'] ) . trailingslashit( $source_files[0] );
} elseif ( count( $source_files ) == 0 ) {
return new WP_Error( 'incompatible_archive_empty', $this->strings['incompatible_archive'], $this->strings['no_files'] ); // There are no files?
} else { // It's only a single file, the upgrader will use the folder name of this file as the destination folder. Folder name is based on zip filename.
$source = trailingslashit( $args['source'] );
}
/**
* Filters the source file location for the upgrade package.
*
* @since 2.8.0
* @since 4.4.0 The $hook_extra parameter became available.
*
* @param string $source File source location.
* @param string $remote_source Remote file source location.
* @param WP_Upgrader $this WP_Upgrader instance.
* @param array $hook_extra Extra arguments passed to hooked filters.
*/
$source = apply_filters( 'upgrader_source_selection', $source, $remote_source, $this, $args['hook_extra'] );
if ( is_wp_error( $source ) ) {
return $source;
}
// Has the source location changed? If so, we need a new source_files list.
if ( $source !== $remote_source ) {
$source_files = array_keys( $wp_filesystem->dirlist( $source ) );
}
/*
* Protection against deleting files in any important base directories.
* Theme_Upgrader & Plugin_Upgrader also trigger this, as they pass the
* destination directory (WP_PLUGIN_DIR / wp-content/themes) intending
* to copy the directory into the directory, whilst they pass the source
* as the actual files to copy.
*/
$protected_directories = array( ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_CONTENT_DIR . '/themes' );
if ( is_array( $wp_theme_directories ) ) {
$protected_directories = array_merge( $protected_directories, $wp_theme_directories );
}
if ( in_array( $destination, $protected_directories ) ) {
$remote_destination = trailingslashit( $remote_destination ) . trailingslashit( basename( $source ) );
$destination = trailingslashit( $destination ) . trailingslashit( basename( $source ) );
}
if ( $clear_destination ) {
// We're going to clear the destination if there's something there.
//$this->skin->feedback( 'remove_old' );
$removed = $this->clear_destination( $remote_destination );
/**
* Filters whether the upgrader cleared the destination.
*
* @since 2.8.0
*
* @param mixed $removed Whether the destination was cleared. true on success, WP_Error on failure
* @param string $local_destination The local package destination.
* @param string $remote_destination The remote package destination.
* @param array $hook_extra Extra arguments passed to hooked filters.
*/
$removed = apply_filters( 'upgrader_clear_destination', $removed, $local_destination, $remote_destination, $args['hook_extra'] );
if ( is_wp_error( $removed ) ) {
return $removed;
}
} elseif ( $args['abort_if_destination_exists'] && $wp_filesystem->exists( $remote_destination ) ) {
//If we're not clearing the destination folder and something exists there already, Bail.
//But first check to see if there are actually any files in the folder.
$_files = $wp_filesystem->dirlist( $remote_destination );
if ( ! empty( $_files ) ) {
$wp_filesystem->delete( $remote_source, true ); //Clear out the source files.
return new WP_Error( 'folder_exists', $this->strings['folder_exists'], $remote_destination );
}
}
//Create destination if needed
if ( ! $wp_filesystem->exists( $remote_destination ) ) {
if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) ) {
return new WP_Error( 'mkdir_failed_destination', $this->strings['mkdir_failed'], $remote_destination );
}
}
// Copy new version of item into place.
$result = copy_dir( $source, $remote_destination );
if ( is_wp_error( $result ) ) {
if ( $args['clear_working'] ) {
$wp_filesystem->delete( $remote_source, true );
}
return $result;
}
//Clear the Working folder?
if ( $args['clear_working'] ) {
$wp_filesystem->delete( $remote_source, true );
}
$destination_name = basename( str_replace( $local_destination, '', $destination ) );
if ( '.' == $destination_name ) {
$destination_name = '';
}
$this->result = compact( 'source', 'source_files', 'destination', 'destination_name', 'local_destination', 'remote_destination', 'clear_destination' );
/**
* Filters the installation response after the installation has finished.
*
* @since 2.8.0
*
* @param bool $response Installation response.
* @param array $hook_extra Extra arguments passed to hooked filters.
* @param array $result Installation result data.
*/
$res = apply_filters( 'upgrader_post_install', true, $args['hook_extra'], $this->result );
if ( is_wp_error( $res ) ) {
$this->result = $res;
return $res;
}
//Bombard the calling function will all the info which we've just used.
return $this->result;
}
}

View File

@ -1,203 +0,0 @@
<?php
namespace WPMailSMTP\Admin;
use WPMailSMTP\Options;
/**
* Class for admin notice requesting plugin review.
*
* @since 2.1.0
*/
class Review {
/**
* The name of the WP option for the review notice data.
*
* Data attributes:
* - time
* - dismissed
*
* @since 2.1.0
*/
const NOTICE_OPTION = 'wp_mail_smtp_review_notice';
/**
* Days the plugin waits before displaying a review request.
*
* @since 2.1.0
*/
const WAIT_PERIOD = 14;
/**
* Initialize hooks.
*
* @since 2.1.0
*/
public function hooks() {
add_action( 'admin_notices', array( $this, 'review_request' ) );
add_action( 'wp_ajax_wp_mail_smtp_review_dismiss', array( $this, 'review_dismiss' ) );
}
/**
* Add admin notices as needed for reviews.
*
* @since 2.1.0
*/
public function review_request() {
// Only consider showing the review request to admin users.
if ( ! is_super_admin() ) {
return;
}
// Verify that we can do a check for reviews.
$review = get_option( self::NOTICE_OPTION );
$time = time();
$load = false;
if ( empty( $review ) ) {
$review = [
'time' => $time,
'dismissed' => false,
];
update_option( self::NOTICE_OPTION, $review );
} else {
// Check if it has been dismissed or not.
if ( isset( $review['dismissed'] ) && ! $review['dismissed'] ) {
$load = true;
}
}
// If we cannot load, return early.
if ( ! $load ) {
return;
}
$this->review();
}
/**
* Maybe show review request.
*
* @since 2.1.0
*/
private function review() {
// Get the currently selected mailer.
$mailer = Options::init()->get( 'mail', 'mailer' );
// Skip if no or the default mailer is selected.
if ( empty( $mailer ) || $mailer === 'mail' ) {
return;
}
// Fetch when plugin was initially activated.
$activated = get_option( 'wp_mail_smtp_activated_time' );
// Skip if the plugin activated time is not set.
if ( empty( $activated ) ) {
return;
}
// Check if mailer setup is complete.
$mailer_setup_complete = wp_mail_smtp()
->get_providers()
->get_mailer( $mailer, wp_mail_smtp()->get_processor()->get_phpmailer() )
->is_mailer_complete();
// Skip if the mailer is not set or the plugin is active for less then a defined number of days.
if ( ! $mailer_setup_complete || ( $activated + ( DAY_IN_SECONDS * self::WAIT_PERIOD ) ) > time() ) {
return;
}
// We have a candidate! Output a review message.
?>
<div class="notice notice-info is-dismissible wp-mail-smtp-review-notice">
<div class="wp-mail-smtp-review-step wp-mail-smtp-review-step-1">
<p><?php esc_html_e( 'Are you enjoying WP Mail SMTP?', 'wp-mail-smtp' ); ?></p>
<p>
<a href="#" class="wp-mail-smtp-review-switch-step" data-step="3"><?php esc_html_e( 'Yes', 'wp-mail-smtp' ); ?></a><br />
<a href="#" class="wp-mail-smtp-review-switch-step" data-step="2"><?php esc_html_e( 'Not Really', 'wp-mail-smtp' ); ?></a>
</p>
</div>
<div class="wp-mail-smtp-review-step wp-mail-smtp-review-step-2" style="display: none">
<p><?php esc_html_e( 'We\'re sorry to hear you aren\'t enjoying WP Mail SMTP. We would love a chance to improve. Could you take a minute and let us know what we can do better?', 'wp-mail-smtp' ); ?></p>
<p>
<a href="https://wpmailsmtp.com/plugin-feedback/" class="wp-mail-smtp-dismiss-review-notice wp-mail-smtp-review-out" target="_blank" rel="noopener noreferrer">
<?php esc_html_e( 'Give Feedback', 'wp-mail-smtp' ); ?>
</a><br>
<a href="#" class="wp-mail-smtp-dismiss-review-notice" target="_blank" rel="noopener noreferrer">
<?php esc_html_e( 'No thanks', 'wp-mail-smtp' ); ?>
</a>
</p>
</div>
<div class="wp-mail-smtp-review-step wp-mail-smtp-review-step-3" style="display: none">
<p><?php esc_html_e( 'Thats awesome! Could you please do me a BIG favor and give it a 5-star rating on WordPress to help us spread the word and boost our motivation?', 'wp-mail-smtp' ); ?></p>
<p><strong><?php echo wp_kses( __( '~ Jared Atchison<br>Lead Developer, WP Mail SMTP', 'wp-mail-smtp' ), [ 'br' => [] ] ); ?></strong></p>
<p>
<a href="https://wordpress.org/support/plugin/wp-mail-smtp/reviews/?filter=5#new-post" class="wp-mail-smtp-dismiss-review-notice wp-mail-smtp-review-out" target="_blank" rel="noopener noreferrer">
<?php esc_html_e( 'Ok, you deserve it', 'wp-mail-smtp' ); ?>
</a><br>
<a href="#" class="wp-mail-smtp-dismiss-review-notice" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Nope, maybe later', 'wp-mail-smtp' ); ?></a><br>
<a href="#" class="wp-mail-smtp-dismiss-review-notice" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'I already did', 'wp-mail-smtp' ); ?></a>
</p>
</div>
</div>
<script type="text/javascript">
jQuery( document ).ready( function ( $ ) {
$( document ).on( 'click', '.wp-mail-smtp-dismiss-review-notice, .wp-mail-smtp-review-notice button', function( e ) {
if ( ! $( this ).hasClass( 'wp-mail-smtp-review-out' ) ) {
e.preventDefault();
}
$.post( ajaxurl, { action: 'wp_mail_smtp_review_dismiss' } );
$( '.wp-mail-smtp-review-notice' ).remove();
} );
$( document ).on( 'click', '.wp-mail-smtp-review-switch-step', function( e ) {
e.preventDefault();
var target = parseInt( $( this ).attr( 'data-step' ), 10 );
if ( target ) {
var $notice = $( this ).closest( '.wp-mail-smtp-review-notice' );
var $review_step = $notice.find( '.wp-mail-smtp-review-step-' + target );
if ( $review_step.length > 0 ) {
$notice.find( '.wp-mail-smtp-review-step:visible' ).fadeOut( function() {
$review_step.fadeIn();
} );
}
}
} );
} );
</script>
<?php
}
/**
* Dismiss the review admin notice.
*
* @since 2.1.0
*/
public function review_dismiss() {
$review = get_option( self::NOTICE_OPTION, [] );
$review['time'] = time();
$review['dismissed'] = true;
update_option( self::NOTICE_OPTION, $review );
if ( is_super_admin() && is_multisite() ) {
$site_list = get_sites();
foreach ( (array) $site_list as $site ) {
switch_to_blog( $site->blog_id );
update_option( self::NOTICE_OPTION, $review );
restore_current_blog();
}
}
wp_send_json_success();
}
}

View File

@ -1,184 +0,0 @@
<?php
namespace WPMailSMTP;
/**
* Class Conflicts
*
* @since 1.5.0
*/
class Conflicts {
/**
* @since 1.5.0
*
* @var array List of plugins WP Mail SMTP may be conflicting with.
*/
public static $plugins = array(
'swpsmtp_init_smtp' => array(
'name' => 'Easy WP SMTP',
),
'postman_start' => array(
'name' => 'Postman SMTP',
),
'post_start' => array(
'name' => 'Post SMTP Mailer/Email Log',
),
'mail_bank' => array(
'name' => 'WP Mail Bank',
),
'SMTP_MAILER' => array(
'name' => 'SMTP Mailer',
'class' => true,
),
'GMAIL_SMTP' => array(
'name' => 'Gmail SMTP',
'class' => true,
),
'WP_Email_Smtp' => array(
'name' => 'WP Email SMTP',
'class' => true,
),
'smtpmail_include' => array(
'name' => 'SMTP Mail',
),
'bwssmtp_init' => array(
'name' => 'SMTP by BestWebSoft',
),
'WPSendGrid_SMTP' => array(
'name' => 'WP SendGrid SMTP',
'class' => true,
),
'sar_friendly_smtp' => array(
'name' => 'SAR Friendly SMTP',
),
'WPGmail_SMTP' => array(
'name' => 'WP Gmail SMTP',
'class' => true,
),
'st_smtp_check_config' => array(
'name' => 'Cimy Swift SMTP',
),
'WP_Easy_SMTP' => array(
'name' => 'WP Easy SMTP',
'class' => true,
),
'WPMailgun_SMTP' => array(
'name' => 'WP Mailgun SMTP',
'class' => true,
),
'my_smtp_wp' => array(
'name' => 'MY SMTP WP',
),
'mail_booster' => array(
'name' => 'WP Mail Booster',
),
'Sendgrid_Settings' => array(
'name' => 'SendGrid',
'class' => true,
),
'WPMS_php_mailer' => array(
'name' => 'WP Mail Smtp Mailer',
),
'WPAmazonSES_SMTP' => array(
'name' => 'WP Amazon SES SMTP',
'class' => true,
),
'Postmark_Mail' => array(
'name' => 'Postmark for WordPress',
'class' => true,
),
'Mailgun' => array(
'name' => 'Mailgun',
'class' => true,
),
'WPSparkPost\SparkPost' => array(
'name' => 'SparkPost',
'class' => true,
),
'WPYahoo_SMTP' => array(
'name' => 'WP Yahoo SMTP',
'class' => true,
),
'wpses_init' => array(
'name' => 'WP SES',
'class' => true,
),
'TSPHPMailer' => array(
'name' => 'turboSMTP',
),
'WP_SMTP' => array(
'name' => 'WP SMTP',
'class' => true,
),
);
/**
* @var array Conflict information.
*/
protected $conflict = array();
/**
* Whether we have a conflict with predefined list of plugins.
*
* @since 1.5.0
*
* @return bool
*/
public function is_detected() {
foreach ( self::$plugins as $callback => $plugin ) {
if ( ! empty( $plugin['class'] ) ) {
$detected = \class_exists( $callback, false );
} else {
$detected = \function_exists( $callback );
}
if ( $detected ) {
$this->conflict = $plugin;
break;
}
}
return ! empty( $this->conflict );
}
/**
* Add a warning admin message to a user about the conflicting plugin.
*
* @since 1.5.0
*/
public function notify() {
if ( empty( $this->conflict ) ) {
return;
}
WP::add_admin_notice(
\sprintf( /* translators: %1$s - Plugin name causing conflict; %2$s - Plugin name causing conflict. */
\esc_html__( 'Heads up! WP Mail SMTP has detected %1$s is activated. Please deactivate %2$s to prevent conflicts.', 'wp-mail-smtp' ),
$this->get_conflict_name(),
$this->get_conflict_name()
),
WP::ADMIN_NOTICE_WARNING
);
}
/**
* Get the conflicting plugin name is any.
*
* @since 1.5.0
*
* @return null|string
*/
public function get_conflict_name() {
$name = null;
if ( ! empty( $this->conflict['name'] ) ) {
$name = $this->conflict['name'];
}
return $name;
}
}

View File

@ -1,981 +0,0 @@
<?php
namespace WPMailSMTP;
use WPMailSMTP\Admin\AdminBarMenu;
use WPMailSMTP\Admin\Notifications;
use WPMailSMTP\UsageTracking\UsageTracking;
/**
* Class Core to handle all plugin initialization.
*
* @since 1.0.0
*/
class Core {
/**
* URL to plugin directory.
*
* @since 1.0.0
*
* @var string Without trailing slash.
*/
public $plugin_url;
/**
* URL to Lite plugin assets directory.
*
* @since 1.5.0
*
* @var string Without trailing slash.
*/
public $assets_url;
/**
* Path to plugin directory.
*
* @since 1.0.0
*
* @var string Without trailing slash.
*/
public $plugin_path;
/**
* Shortcut to get access to Pro functionality using wp_mail_smtp()->pro->example().
*
* @since 1.5.0
*
* @var \WPMailSMTP\Pro\Pro
*/
public $pro;
/**
* Core constructor.
*
* @since 1.0.0
*/
public function __construct() {
$this->plugin_url = rtrim( plugin_dir_url( __DIR__ ), '/\\' );
$this->assets_url = $this->plugin_url . '/assets';
$this->plugin_path = rtrim( plugin_dir_path( __DIR__ ), '/\\' );
if ( $this->is_not_loadable() ) {
add_action( 'admin_notices', 'wp_mail_smtp_insecure_php_version_notice' );
if ( WP::use_global_plugin_settings() ) {
add_action( 'network_admin_notices', 'wp_mail_smtp_insecure_php_version_notice' );
}
return;
}
// Finally, load all the plugin.
$this->hooks();
$this->init_early();
}
/**
* Currently used for Pro version only.
*
* @since 1.5.0
*
* @return bool
*/
protected function is_not_loadable() {
// Check the Pro.
if (
is_readable( $this->plugin_path . '/src/Pro/Pro.php' ) &&
! $this->is_pro_allowed()
) {
// So there is a Pro version, but its PHP version check failed.
return true;
}
return false;
}
/**
* Assign all hooks to proper places.
*
* @since 1.0.0
*/
public function hooks() {
// Force from_email_force to always return true if current mailer is Gmail.
if ( ( new Options() )->get( 'mail', 'mailer' ) === 'gmail' ) {
add_filter( 'wp_mail_smtp_options_get', [ $this, 'gmail_mailer_get_from_email_force' ], 1, 3 );
}
// Action Scheduler requires a special early loading procedure.
add_action( 'plugins_loaded', [ $this, 'load_action_scheduler' ], - 10 );
// Activation hook.
register_activation_hook( WPMS_PLUGIN_FILE, [ $this, 'activate' ] );
// Redefine PHPMailer.
add_action( 'plugins_loaded', [ $this, 'get_processor' ] );
add_action( 'plugins_loaded', [ $this, 'replace_phpmailer' ] );
// Various notifications.
add_action( 'admin_init', [ $this, 'init_notifications' ] );
add_action( 'init', [ $this, 'init' ] );
// Initialize Action Scheduler tasks.
add_action( 'init', [ $this, 'get_tasks' ], 5 );
add_action( 'plugins_loaded', [ $this, 'get_pro' ] );
add_action( 'plugins_loaded', [ $this, 'get_usage_tracking' ] );
add_action( 'plugins_loaded', [ $this, 'get_admin_bar_menu' ] );
add_action( 'plugins_loaded', [ $this, 'get_notifications' ] );
}
/**
* Initial plugin actions.
*
* @since 1.0.0
*/
public function init() {
// Load translations just in case.
load_plugin_textdomain( 'wp-mail-smtp', false, plugin_basename( wp_mail_smtp()->plugin_path ) . '/assets/languages' );
/*
* Constantly check in admin area, that we don't need to upgrade DB.
* Do not wait for the `admin_init` hook, because some actions are already done
* on `plugins_loaded`, so migration has to be done before.
* We should not fire this in AJAX requests.
*/
if ( WP::in_wp_admin() ) {
$this->get_migration();
$this->get_upgrade();
$this->detect_conflicts();
}
// In admin area, regardless of AJAX or not AJAX request.
if ( is_admin() ) {
$this->get_admin();
$this->get_site_health()->init();
}
// Plugin admin area notices. Display to "admins" only.
if ( current_user_can( 'manage_options' ) ) {
add_action( 'admin_notices', array( '\WPMailSMTP\WP', 'display_admin_notices' ) );
add_action( 'admin_notices', array( $this, 'display_general_notices' ) );
if ( WP::use_global_plugin_settings() ) {
add_action( 'network_admin_notices', array( '\WPMailSMTP\WP', 'display_admin_notices' ) );
add_action( 'network_admin_notices', array( $this, 'display_general_notices' ) );
}
}
}
/**
* Whether the Pro part of the plugin is allowed to be loaded.
*
* @since 1.5.0
* @since 1.6.0 Added a filter.
*
* @return bool
*/
protected function is_pro_allowed() {
$is_allowed = true;
if ( ! is_readable( $this->plugin_path . '/src/Pro/Pro.php' ) ) {
$is_allowed = false;
}
if ( version_compare( phpversion(), '5.6', '<' ) ) {
$is_allowed = false;
}
return apply_filters( 'wp_mail_smtp_core_is_pro_allowed', $is_allowed );
}
/**
* Get/Load the Pro code of the plugin if it exists.
*
* @since 1.6.2
*
* @return \WPMailSMTP\Pro\Pro
*/
public function get_pro() {
if ( ! $this->is_pro_allowed() ) {
return $this->pro;
}
if ( ! $this->is_pro() ) {
$this->pro = new \WPMailSMTP\Pro\Pro();
}
return $this->pro;
}
/**
* Get/Load the Tasks code of the plugin.
*
* @since 2.1.0
*
* @return \WPMailSMTP\Tasks\Tasks
*/
public function get_tasks() {
static $tasks;
if ( ! isset( $tasks ) ) {
$tasks = apply_filters( 'wp_mail_smtp_core_get_tasks', new Tasks\Tasks() );
$tasks->init();
}
return $tasks;
}
/**
* This method allows to overwrite certain core WP functions, because it's fired:
* - after `muplugins_loaded` hook,
* - before WordPress own `wp-includes/pluggable.php` file include,
* - before `plugin_loaded` and `plugins_loaded` hooks.
*
* @since 1.5.0
*/
protected function init_early() {
$pro_files = $this->is_pro_allowed() ? \WPMailSMTP\Pro\Pro::PLUGGABLE_FILES : array();
$files = (array) apply_filters( 'wp_mail_smtp_core_init_early_include_files', $pro_files );
foreach ( $files as $file ) {
$path = $this->plugin_path . '/' . $file;
if ( is_readable( $path ) ) {
/** @noinspection PhpIncludeInspection */
include_once $path;
}
}
}
/**
* Load the plugin core processor.
*
* @since 1.0.0
*
* @return Processor
*/
public function get_processor() {
static $processor;
if ( ! isset( $processor ) ) {
$processor = apply_filters( 'wp_mail_smtp_core_get_processor', new Processor() );
if ( method_exists( $processor, 'hooks' ) ) {
$processor->hooks();
}
}
return $processor;
}
/**
* Load the plugin admin area.
*
* @since 1.0.0
*
* @return Admin\Area
*/
public function get_admin() {
static $admin;
if ( ! isset( $admin ) ) {
$admin = apply_filters( 'wp_mail_smtp_core_get_admin', new Admin\Area() );
}
return $admin;
}
/**
* Load the plugin providers loader.
*
* @since 1.0.0
*
* @return Providers\Loader
*/
public function get_providers() {
static $providers;
if ( ! isset( $providers ) ) {
$providers = apply_filters( 'wp_mail_smtp_core_get_providers', new Providers\Loader() );
}
return $providers;
}
/**
* Load the plugin option migrator.
*
* @since 1.0.0
*
* @return Migration
*/
public function get_migration() {
static $migration;
if ( ! isset( $migration ) ) {
$migration = apply_filters( 'wp_mail_smtp_core_get_migration', new Migration() );
}
return $migration;
}
/**
* Load the plugin upgrader.
*
* @since 1.1.0
*
* @return Upgrade
*/
public function get_upgrade() {
static $upgrade;
if ( ! isset( $upgrade ) ) {
$upgrade = apply_filters( 'wp_mail_smtp_core_get_upgrade', new Upgrade() );
}
return $upgrade;
}
/**
* Get the plugin's WP Site Health object.
*
* @since 1.9.0
*
* @return SiteHealth
*/
public function get_site_health() {
static $site_health;
if ( ! isset( $site_health ) ) {
$site_health = apply_filters( 'wp_mail_smtp_core_get_site_health', new SiteHealth() );
}
return $site_health;
}
/**
* Display various notifications to a user
*
* @since 1.0.0
*/
public function init_notifications() {
// Old PHP version notification.
if (
version_compare( phpversion(), '5.6', '<' ) &&
is_super_admin() &&
(
isset( $GLOBALS['pagenow'] ) &&
$GLOBALS['pagenow'] === 'index.php'
)
) {
WP::add_admin_notice(
sprintf(
wp_kses( /* translators: %1$s - WP Mail SMTP plugin name; %2$s - WPMailSMTP.com URL to a related doc. */
__( 'Your site is running an outdated version of PHP that is no longer supported and may cause issues with %1$s. <a href="%2$s" target="_blank" rel="noopener noreferrer">Read more</a> for additional information.', 'wp-mail-smtp' ),
array(
'a' => array(
'href' => array(),
'target' => array(),
'rel' => array(),
),
)
),
'<strong>WP Mail SMTP</strong>',
'https://wpmailsmtp.com/docs/supported-php-versions-for-wp-mail-smtp/'
) .
'<br><br><em>' .
wp_kses(
__( '<strong>Please Note:</strong> Support for PHP 5.5 will be discontinued in 2020. After this, if no further action is taken, WP Mail SMTP functionality will be disabled.', 'wp-mail-smtp' ),
array(
'strong' => array(),
'em' => array(),
)
) .
'</em>',
WP::ADMIN_NOTICE_ERROR,
false
);
}
// Awesome Motive Notifications.
if ( Options::init()->get( 'general', 'am_notifications_hidden' ) ) {
return;
}
}
/**
* Display all debug mail-delivery related notices.
*
* @since 1.3.0
* @since 1.6.0 Added a filter that allows to hide debug errors.
*/
public static function display_general_notices() {
if ( wp_mail_smtp()->is_blocked() ) {
?>
<div class="notice <?php echo esc_attr( WP::ADMIN_NOTICE_ERROR ); ?>">
<p>
<?php
$notices[] = sprintf(
wp_kses( /* translators: %s - plugin name and its version. */
__( '<strong>EMAILING DISABLED:</strong> The %s is currently blocking all emails from being sent.', 'wp-mail-smtp' ),
array(
'strong' => true,
)
),
esc_html( 'WP Mail SMTP v' . WPMS_PLUGIN_VER )
);
if ( Options::init()->is_const_defined( 'general', 'do_not_send' ) ) {
$notices[] = sprintf(
wp_kses( /* translators: %1$s - constant name; %2$s - constant value. */
__( 'To send emails, change the value of the %1$s constant to %2$s.', 'wp-mail-smtp' ),
array(
'code' => true,
)
),
'<code>WPMS_DO_NOT_SEND</code>',
'<code>false</code>'
);
} else {
$notices[] = sprintf(
wp_kses( /* translators: %s - plugin Misc settings page URL. */
__( 'To send emails, go to plugin <a href="%s">Misc settings</a> and disable the "Do Not Send" option.', 'wp-mail-smtp' ),
array(
'a' => array(
'href' => true,
),
)
),
esc_url( add_query_arg( 'tab', 'misc', wp_mail_smtp()->get_admin()->get_admin_page_url() ) )
);
}
echo implode( ' ', $notices );
?>
</p>
</div>
<?php
return;
}
if ( wp_mail_smtp()->get_admin()->is_error_delivery_notice_enabled() ) {
$screen = get_current_screen();
// Skip the error notice if not on plugin page.
if (
is_object( $screen ) &&
strpos( $screen->id, 'page_wp-mail-smtp' ) === false
) {
return;
}
$notice = apply_filters(
'wp_mail_smtp_core_display_general_notices_email_delivery_error_notice',
Debug::get_last()
);
if ( ! empty( $notice ) ) {
?>
<div class="notice <?php echo esc_attr( WP::ADMIN_NOTICE_ERROR ); ?>">
<p>
<?php
printf(
wp_kses( /* translators: %s - plugin name and its version. */
__( '<strong>EMAIL DELIVERY ERROR:</strong> the plugin %s logged this error during the last time it tried to send an email:', 'wp-mail-smtp' ),
array(
'strong' => array(),
)
),
esc_html( 'WP Mail SMTP v' . WPMS_PLUGIN_VER )
);
?>
</p>
<blockquote>
<pre><?php echo $notice; ?></pre>
</blockquote>
<p>
<?php
if ( ! wp_mail_smtp()->get_admin()->is_admin_page() ) {
printf(
wp_kses( /* translators: %s - plugin admin page URL. */
__( 'Please review your WP Mail SMTP settings in <a href="%s">plugin admin area</a>.' ) . ' ',
array(
'a' => array(
'href' => array(),
),
)
),
esc_url( wp_mail_smtp()->get_admin()->get_admin_page_url() )
);
}
esc_html_e( 'Consider running an email test after fixing it.', 'wp-mail-smtp' );
?>
</p>
</div>
<?php
}
}
}
/**
* Check whether we are working with a new plugin install.
*
* @since 1.3.0
*
* @return bool
*/
protected function is_new_install() {
/*
* No previously installed 0.*.
* 'wp_mail_smtp_initial_version' option appeared in 1.3.0. So we make sure it exists.
* No previous plugin upgrades.
*/
if (
! get_option( 'mailer', false ) &&
get_option( 'wp_mail_smtp_initial_version', false ) &&
version_compare( WPMS_PLUGIN_VER, get_option( 'wp_mail_smtp_initial_version' ), '=' )
) {
return true;
}
return false;
}
/**
* Detect if there are plugins activated that will cause a conflict.
*
* @since 1.3.0
* @since 1.5.0 Moved the logic to Conflicts class.
*/
public function detect_conflicts() {
// Display only for those who can actually deactivate plugins.
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
$conflicts = new Conflicts();
if ( $conflicts->is_detected() ) {
$conflicts->notify();
}
}
/**
* Init the \PHPMailer replacement.
*
* @since 1.0.0
*
* @return MailCatcherInterface
*/
public function replace_phpmailer() {
global $phpmailer;
return $this->replace_w_fake_phpmailer( $phpmailer );
}
/**
* Overwrite default PhpMailer with our MailCatcher.
*
* @since 1.0.0
* @since 1.5.0 Throw external PhpMailer exceptions, inherits default WP behavior.
*
* @param null $obj PhpMailer object to override with own implementation.
*
* @return MailCatcherInterface
*/
protected function replace_w_fake_phpmailer( &$obj = null ) {
$obj = $this->generate_mail_catcher( true );
return $obj;
}
/**
* What to do on plugin activation.
*
* @since 1.0.0
* @since 2.0.0 Changed from general `plugin_activate` hook to this plugin specific activation hook.
*/
public function activate() {
// Store the plugin version when initial install occurred.
add_option( 'wp_mail_smtp_initial_version', WPMS_PLUGIN_VER, '', false );
// Store the plugin version activated to reference with upgrades.
update_option( 'wp_mail_smtp_version', WPMS_PLUGIN_VER, false );
// Save default options, only once.
Options::init()->set( Options::get_defaults(), true );
/**
* Store the timestamp of first plugin activation.
*
* @since 2.1.0
*/
add_option( 'wp_mail_smtp_activated_time', time(), '', false );
/**
* Store the timestamp of the first plugin activation by license type.
*
* @since 2.3.0
*/
$license_type = is_readable( $this->plugin_path . '/src/Pro/Pro.php' ) ? 'pro' : 'lite';
$activated = get_option( 'wp_mail_smtp_activated', [] );
if ( empty( $activated[ $license_type ] ) ) {
$activated[ $license_type ] = time();
update_option( 'wp_mail_smtp_activated', $activated );
}
}
/**
* Whether this is a Pro version of a plugin.
*
* @since 1.5.0
*
* @return bool
*/
public function is_pro() {
return apply_filters( 'wp_mail_smtp_core_is_pro', ! empty( $this->pro ) );
}
/**
* Get the current license type.
*
* @since 1.5.0
*
* @return string Default value: lite.
*/
public function get_license_type() {
$type = Options::init()->get( 'license', 'type' );
if ( empty( $type ) ) {
$type = 'lite';
}
return strtolower( $type );
}
/**
* Get the current license key.
*
* @since 1.5.0
*
* @return string
*/
public function get_license_key() {
$key = Options::init()->get( 'license', 'key' );
if ( empty( $key ) ) {
$key = '';
}
return $key;
}
/**
* Upgrade link used within the various admin pages.
*
* @since 1.5.0
* @since 1.5.1 Support all UTM params.
*
* @param array|string $utm Array of UTM params, or if string provided - utm_content URL parameter.
*
* @return string
*/
public function get_upgrade_link( $utm ) {
// Defaults.
$source = 'WordPress';
$medium = 'plugin-settings';
$campaign = 'liteplugin';
$content = 'general';
if ( is_array( $utm ) ) {
if ( isset( $utm['source'] ) ) {
$source = $utm['source'];
}
if ( isset( $utm['medium'] ) ) {
$medium = $utm['medium'];
}
if ( isset( $utm['campaign'] ) ) {
$campaign = $utm['campaign'];
}
if ( isset( $utm['content'] ) ) {
$content = $utm['content'];
}
} elseif ( is_string( $utm ) ) {
$content = $utm;
}
$url = 'https://wpmailsmtp.com/lite-upgrade/?utm_source=' . esc_attr( $source ) . '&utm_medium=' . esc_attr( $medium ) . '&utm_campaign=' . esc_attr( $campaign );
if ( ! empty( $content ) ) {
$url .= '&utm_content=' . esc_attr( $content );
}
return apply_filters( 'wp_mail_smtp_core_get_upgrade_link', $url );
}
/**
* Whether the emailing functionality is blocked, with either an option or a constatnt.
*
* @since 1.7.0
*
* @return bool
*/
public function is_blocked() {
return (bool) Options::init()->get( 'general', 'do_not_send' );
}
/**
* Whether the white-labeling is enabled.
* White-labeling disables the plugin "About us" page, it replaces any plugin marketing texts or images with
* white label ones.
*
* @since 2.0.0
*
* @return bool
*/
public function is_white_labeled() {
return (bool) apply_filters( 'wp_mail_smtp_is_white_labeled', false );
}
/**
* Require the action scheduler in an early plugins_loaded hook (-10).
*
* @see https://actionscheduler.org/usage/#load-order
*
* @since 2.1.0
*/
public function load_action_scheduler() {
require_once $this->plugin_path . '/vendor/woocommerce/action-scheduler/action-scheduler.php';
}
/**
* Get the list of all custom DB tables that should be present in the DB.
*
* @since 2.1.2
*
* @return array List of table names.
*/
public function get_custom_db_tables() {
$tables = [
\WPMailSMTP\Tasks\Meta::get_table_name(),
];
return apply_filters( 'wp_mail_smtp_core_get_custom_db_tables', $tables );
}
/**
* Generate the correct MailCatcher object based on the PHPMailer version used in WP.
*
* Also conditionally require the needed class files.
*
* @see https://make.wordpress.org/core/2020/07/01/external-library-updates-in-wordpress-5-5-call-for-testing/
*
* @since 2.2.0
*
* @param bool $exceptions True if external exceptions should be thrown.
*
* @return MailCatcherInterface
*/
public function generate_mail_catcher( $exceptions = null ) {
if ( version_compare( get_bloginfo( 'version' ), '5.5-alpha', '<' ) ) {
if ( ! class_exists( '\PHPMailer', false ) ) {
require_once ABSPATH . WPINC . '/class-phpmailer.php';
}
$mail_catcher = new MailCatcher( $exceptions );
} else {
if ( ! class_exists( '\PHPMailer\PHPMailer\PHPMailer', false ) ) {
require_once ABSPATH . WPINC . '/PHPMailer/PHPMailer.php';
}
if ( ! class_exists( '\PHPMailer\PHPMailer\Exception', false ) ) {
require_once ABSPATH . WPINC . '/PHPMailer/Exception.php';
}
if ( ! class_exists( '\PHPMailer\PHPMailer\SMTP', false ) ) {
require_once ABSPATH . WPINC . '/PHPMailer/SMTP.php';
}
$mail_catcher = new MailCatcherV6( $exceptions );
}
return $mail_catcher;
}
/**
* Check if the passed object is a valid PHPMailer object.
*
* @since 2.2.0
*
* @param object $phpmailer A potential PHPMailer object to be tested.
*
* @return bool
*/
public function is_valid_phpmailer( $phpmailer ) {
return $phpmailer instanceof MailCatcherInterface ||
$phpmailer instanceof \PHPMailer ||
$phpmailer instanceof \PHPMailer\PHPMailer\PHPMailer;
}
/**
* Force the `mail.from_email_force` plugin option to always return true if the current saved mailer is Gmail.
* Alters the plugin options retrieving via the Options::get method.
*
* The gmail mailer check is performed when this filter is added.
*
* @since 2.2.0
*
* @param mixed $value The value of the plugin option that is being retrieved via Options::get method.
* @param string $group The group of the plugin option that is being retrieved via Options::get method.
* @param string $key The key of the plugin option that is being retrieved via Options::get method.
*
* @return mixed
*/
public function gmail_mailer_get_from_email_force( $value, $group, $key ) {
if ( $group === 'mail' && $key === 'from_email_force' ) {
$value = true;
}
return $value;
}
/**
* Load the plugin admin bar menu and initialize it.
*
* @since 2.3.0
*
* @return AdminBarMenu
*/
public function get_admin_bar_menu() {
static $admin_bar_menu;
if ( ! isset( $admin_bar_menu ) ) {
$admin_bar_menu = apply_filters(
'wp_mail_smtp_core_get_admin_bar_menu',
new AdminBarMenu()
);
if ( method_exists( $admin_bar_menu, 'init' ) ) {
$admin_bar_menu->init();
}
}
return $admin_bar_menu;
}
/**
* Load the plugin usage tracking.
*
* @since 2.3.0
*
* @return UsageTracking
*/
public function get_usage_tracking() {
static $usage_tracking;
if ( ! isset( $usage_tracking ) ) {
$usage_tracking = apply_filters( 'wp_mail_smtp_core_get_usage_tracking', new UsageTracking() );
if ( method_exists( $usage_tracking, 'load' ) ) {
$usage_tracking->load();
}
}
return $usage_tracking;
}
/**
* Load the plugin admin notifications functionality and initializes it.
*
* @since 2.3.0
*
* @return Notifications
*/
public function get_notifications() {
static $notifications;
if ( ! isset( $notifications ) ) {
$notifications = apply_filters(
'wp_mail_smtp_core_get_notifications',
new Notifications()
);
if ( method_exists( $notifications, 'init' ) ) {
$notifications->init();
}
}
return $notifications;
}
/**
* Prepare the HTML output for a plugin loader/spinner.
*
* @since 2.4.0
*
* @param string $color The color of the loader ('', 'blue' or 'white'), where '' is default orange.
* @param string $size The size of the loader ('lg', 'md', 'sm').
*
* @return string
*/
public function prepare_loader( $color = '', $size = 'md' ) {
$svg_name = 'loading';
if ( in_array( $color, [ 'blue', 'white' ], true ) ) {
$svg_name .= '-' . $color;
}
if ( ! in_array( $size, [ 'lg', 'md', 'sm' ], true ) ) {
$size = 'md';
}
return '<img src="' . esc_url( $this->plugin_url . '/assets/images/loaders/' . $svg_name . '.svg' ) . '" alt="' . esc_html__( 'Loading', 'wp-mail-smtp' ) . '" class="wp-mail-smtp-loading wp-mail-smtp-loading-' . $size . '">';
}
}

View File

@ -1,122 +0,0 @@
<?php
namespace WPMailSMTP;
/**
* Class Debug that will save all errors or warnings generated by APIs or SMTP
* and display in area for administrators.
*
* Usage example:
* Debug::set( 'Some warning: %s', array( '%s' => $e->getMessage() );
* $debug = Debug::get(); // array
* $debug = Debug::get_last(); // string
*
* @since 1.2.0
*/
class Debug {
/**
* Key for options table where all messages will be saved to.
*/
const OPTION_KEY = 'wp_mail_smtp_debug';
/**
* Save unique debug message to a debug log.
* Adds one more to a list, at the end.
*
* @since 1.2.0
*
* @param mixed $message
*/
public static function set( $message ) {
if ( empty( $message ) ) {
return;
}
if ( ! is_string( $message ) ) {
$message = wp_json_encode( $message );
} else {
$message = wp_strip_all_tags( $message, false );
}
$all = self::get();
array_push( $all, $message );
update_option( self::OPTION_KEY, array_unique( $all ), false );
}
/**
* Remove all messages for a debug log.
*
* @since 1.2.0
*/
public static function clear() {
update_option( self::OPTION_KEY, array(), false );
}
/**
* Retrieve all messages from a debug log.
*
* @since 1.2.0
*
* @return array
*/
public static function get() {
$all = get_option( self::OPTION_KEY, array() );
if ( ! is_array( $all ) ) {
$all = (array) $all;
}
return $all;
}
/**
* Get the last message that was saved to a debug log.
*
* @since 1.2.0
*
* @return string
*/
public static function get_last() {
$all = self::get();
if ( ! empty( $all ) && is_array( $all ) ) {
return (string) end( $all );
}
return '';
}
/**
* Get the proper variable content output to debug.
*
* @since 1.2.0
*
* @param mixed $var
*
* @return string
*/
public static function pvar( $var = '' ) {
ob_start();
echo '<code>';
if ( is_bool( $var ) || empty( $var ) ) {
var_dump( $var );
} else {
print_r( $var );
}
echo '</code>';
$output = ob_get_clean();
return str_replace( array( "\r\n", "\r", "\n" ), '', $output );
}
}

View File

@ -1,164 +0,0 @@
<?php
namespace WPMailSMTP;
/**
* Class Geo to work with location, domain, IPs etc.
*
* @since 1.5.0
*/
class Geo {
/**
* Get the current site hostname.
* In case of CLI we don't have SERVER_NAME, so use host name instead, may be not a domain name.
* Examples: example.com, localhost.
*
* @since 1.5.0
*
* @return string
*/
public static function get_site_domain() {
return ! empty( $_SERVER['SERVER_NAME'] ) ? wp_unslash( $_SERVER['SERVER_NAME'] ) : wp_parse_url( get_home_url( get_current_blog_id() ), PHP_URL_HOST );
}
/**
* Get the domain IP address.
* Uses gethostbyname() which is quite slow, but this is done only one time.
*
* @since 1.5.0
*
* @param string $domain
*
* @return string
*/
public static function get_ip_by_domain( $domain ) {
if ( $domain === 'localhost' ) {
return '127.0.0.1';
}
return gethostbyname( $domain );
}
/**
* Get the location coordinates by IP address.
* We make a request to 3rd party services.
*
* @since 1.5.0
* @since 1.6.0 Added new geo API endpoint, provided by WPForms.
* @since 2.0.0 Updated the WPForms geo API endpoint to v3.
*
* @param string $ip The IP address.
*
* @return array Empty array for localhost.
*/
public static function get_location_by_ip( $ip ) {
// Check for a non-local IP.
if ( empty( $ip ) || in_array( $ip, [ '127.0.0.1', '::1' ], true ) ) {
return [];
}
$request = wp_remote_get( 'https://geo.wpforms.com/v3/geolocate/json/' . $ip );
if ( ! is_wp_error( $request ) ) {
$request = json_decode( wp_remote_retrieve_body( $request ), true );
if ( ! empty( $request['latitude'] ) && ! empty( $request['longitude'] ) ) {
$data = [
'latitude' => sanitize_text_field( $request['latitude'] ),
'longitude' => sanitize_text_field( $request['longitude'] ),
'city' => isset( $request['city'] ) ? sanitize_text_field( $request['city'] ) : '',
'region' => isset( $request['region_name'] ) ? sanitize_text_field( $request['region_name'] ) : '',
'country' => isset( $request['country_iso'] ) ? sanitize_text_field( $request['country_iso'] ) : '',
'postal' => isset( $request['zip_code'] ) ? sanitize_text_field( $request['zip_code'] ) : '',
];
return $data;
}
}
$request = wp_remote_get( 'https://ipapi.co/' . $ip . '/json' );
if ( ! is_wp_error( $request ) ) {
$request = json_decode( wp_remote_retrieve_body( $request ), true );
if ( ! empty( $request['latitude'] ) && ! empty( $request['longitude'] ) ) {
$data = [
'latitude' => sanitize_text_field( $request['latitude'] ),
'longitude' => sanitize_text_field( $request['longitude'] ),
'city' => isset( $request['city'] ) ? sanitize_text_field( $request['city'] ) : '',
'region' => isset( $request['region'] ) ? sanitize_text_field( $request['region'] ) : '',
'country' => isset( $request['country'] ) ? sanitize_text_field( $request['country'] ) : '',
'postal' => isset( $request['postal'] ) ? sanitize_text_field( $request['postal'] ) : '',
];
return $data;
}
}
$request = wp_remote_get( 'https://tools.keycdn.com/geo.json?host=' . $ip );
if ( ! is_wp_error( $request ) ) {
$request = json_decode( wp_remote_retrieve_body( $request ), true );
if ( ! empty( $request['data']['geo']['latitude'] ) && ! empty( $request['data']['geo']['longitude'] ) ) {
$data = [
'latitude' => sanitize_text_field( $request['data']['geo']['latitude'] ),
'longitude' => sanitize_text_field( $request['data']['geo']['longitude'] ),
'city' => isset( $request['data']['geo']['city'] ) ? sanitize_text_field( $request['data']['geo']['city'] ) : '',
'region' => isset( $request['data']['geo']['region_name'] ) ? sanitize_text_field( $request['data']['geo']['region_name'] ) : '',
'country' => isset( $request['data']['geo']['country_code'] ) ? sanitize_text_field( $request['data']['geo']['country_code'] ) : '',
'postal' => isset( $request['data']['geo']['postal_code'] ) ? sanitize_text_field( $request['data']['geo']['postal_code'] ) : '',
];
return $data;
}
}
return [];
}
/**
* This routine calculates the distance between two points (given the latitude/longitude of those points).
* Definitions: South latitudes are negative, east longitudes are positive.
*
* @see https://www.geodatasource.com/developers/php
*
* @since 1.5.0
*
* @param float $lat1 Latitude of point 1 (in decimal degrees).
* @param float $lon1 Longitude of point 1 (in decimal degrees).
* @param float $lat2 Latitude of point 2 (in decimal degrees).
* @param float $lon2 Longitude of point 2 (in decimal degrees).
* @param string $unit Supported values: M, K, N. Miles by default.
*
* @return float|int
*/
public static function get_distance_between( $lat1, $lon1, $lat2, $lon2, $unit = 'M' ) {
if ( ( $lat1 === $lat2 ) && ( $lon1 === $lon2 ) ) {
return 0;
}
$theta = $lon1 - $lon2;
$dist = sin( deg2rad( $lat1 ) ) * sin( deg2rad( $lat2 ) ) + cos( deg2rad( $lat1 ) ) * cos( deg2rad( $lat2 ) ) * cos( deg2rad( $theta ) );
$dist = acos( $dist );
$dist = rad2deg( $dist );
$miles = $dist * 60 * 1.1515;
$unit = strtoupper( $unit );
if ( $unit === 'K' ) {
return ( $miles * 1.609344 );
} elseif ( $unit === 'N' ) {
return ( $miles * 0.8684 );
}
return $miles;
}
}

View File

@ -1,162 +0,0 @@
<?php
namespace WPMailSMTP\Helpers;
// WP 5.2+ already load Sodium Compat polyfill for libsodium-fallback.
// We need to do the same for under 5.2 versions (4.9-5.1).
if ( ! version_compare( get_bloginfo( 'version' ), '5.2', '>=' ) && ! function_exists( 'sodium_crypto_box' ) ) {
require_once dirname( WPMS_PLUGIN_FILE ) . '/vendor/paragonie/sodium_compat/autoload.php';
}
/**
* Class for encryption functionality.
*
* @since 2.5.0
*
* @link https://www.php.net/manual/en/intro.sodium.php
*/
class Crypto {
/**
* Get a secret key for encrypt/decrypt.
*
* @since 2.5.0
*
* @param bool $create Should the key be created, if it does not exist yet.
*
* @return string|bool
*/
public static function get_secret_key( $create = false ) {
if ( defined( 'WPMS_CRYPTO_KEY' ) ) {
return WPMS_CRYPTO_KEY;
}
$secret_key = get_option( 'wp_mail_smtp_mail_key' );
// If we already have the secret, send it back.
if ( false !== $secret_key ) {
return base64_decode( $secret_key ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode
}
if ( $create ) {
// We don't have a secret, so let's generate one.
try {
$secret_key = sodium_crypto_secretbox_keygen(); // phpcs:ignore
} catch ( \Exception $e ) {
$secret_key = wp_generate_password( SODIUM_CRYPTO_SECRETBOX_KEYBYTES ); // phpcs:ignore
}
add_option( 'wp_mail_smtp_mail_key', base64_encode( $secret_key ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
return $secret_key;
}
return false;
}
/**
* Encrypt a message.
*
* @since 2.5.0
*
* @param string $message Message to encrypt.
* @param string $key Encryption key.
*
* @return string
* @throws \Exception The exception object.
*/
public static function encrypt( $message, $key = '' ) {
if ( apply_filters( 'wp_mail_smtp_helpers_crypto_stop', false ) ) {
return $message;
}
// Create a nonce for this operation. It will be stored and recovered in the message itself.
$nonce = random_bytes( SODIUM_CRYPTO_SECRETBOX_NONCEBYTES ); // phpcs:ignore
if ( empty( $key ) ) {
$key = self::get_secret_key( true );
}
// Encrypt message and combine with nonce.
$cipher = base64_encode( // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
$nonce .
sodium_crypto_secretbox( // phpcs:ignore
$message,
$nonce,
$key
)
);
try {
sodium_memzero( $message ); // phpcs:ignore
sodium_memzero( $key ); // phpcs:ignore
} catch ( \Exception $e ) {
return $cipher;
}
return $cipher;
}
/**
* Decrypt a message.
* Returns encrypted message on any failure and the decrypted message on success.
*
* @since 2.5.0
*
* @param string $encrypted Encrypted message.
* @param string $key Encryption key.
*
* @return string
* @throws \Exception The exception object.
*/
public static function decrypt( $encrypted, $key = '' ) {
if ( apply_filters( 'wp_mail_smtp_helpers_crypto_stop', false ) ) {
return $encrypted;
}
// Unpack base64 message.
$decoded = base64_decode( $encrypted ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode
if ( false === $decoded ) {
return $encrypted;
}
if ( mb_strlen( $decoded, '8bit' ) < ( SODIUM_CRYPTO_SECRETBOX_NONCEBYTES + SODIUM_CRYPTO_SECRETBOX_MACBYTES ) ) { // phpcs:ignore
return $encrypted;
}
// Pull nonce and ciphertext out of unpacked message.
$nonce = mb_substr( $decoded, 0, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, '8bit' ); // phpcs:ignore
$ciphertext = mb_substr( $decoded, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, null, '8bit' ); // phpcs:ignore
$key = empty( $key ) ? self::get_secret_key() : $key;
if ( empty( $key ) ) {
return $encrypted;
}
// Decrypt it.
$message = sodium_crypto_secretbox_open( // phpcs:ignore
$ciphertext,
$nonce,
$key
);
// Check for decryption failures.
if ( false === $message ) {
return $encrypted;
}
try {
sodium_memzero( $ciphertext ); // phpcs:ignore
sodium_memzero( $key ); // phpcs:ignore
} catch ( \Exception $e ) {
return $message;
}
return $message;
}
}

View File

@ -1,181 +0,0 @@
<?php
namespace WPMailSMTP;
// Load PHPMailer class, so we can subclass it.
if ( ! class_exists( 'PHPMailer', false ) ) {
require_once ABSPATH . WPINC . '/class-phpmailer.php';
}
/**
* Class MailCatcher replaces the \PHPMailer and modifies the email sending logic.
* Thus, we can use other mailers API to do what we need, or stop emails completely.
*
* @since 1.0.0
*/
class MailCatcher extends \PHPMailer implements MailCatcherInterface {
/**
* Callback Action function name.
*
* The function that handles the result of the send email action.
* It is called out by send() for each email sent.
*
* @since 1.3.0
*
* @var string
*/
public $action_function = '\WPMailSMTP\Processor::send_callback';
/**
* Modify the default send() behaviour.
* For those mailers, that relies on PHPMailer class - call it directly.
* For others - init the correct provider and process it.
*
* @since 1.0.0
* @since 1.4.0 Process "Do Not Send" option, but always allow test email.
*
* @throws \phpmailerException When sending via PhpMailer fails for some reason.
*
* @return bool
*/
public function send() {
$options = new Options();
$mail_mailer = sanitize_key( $options->get( 'mail', 'mailer' ) );
$is_emailing_blocked = false;
if ( wp_mail_smtp()->is_blocked() ) {
$is_emailing_blocked = true;
}
// Always allow a test email - check for the specific header.
foreach ( (array) $this->getCustomHeaders() as $header ) {
if (
! empty( $header[0] ) &&
! empty( $header[1] ) &&
$header[0] === 'X-Mailer-Type' &&
trim( $header[1] ) === 'WPMailSMTP/Admin/Test'
) {
$is_emailing_blocked = false;
}
};
// Do not send emails if admin desired that.
if ( $is_emailing_blocked ) {
return false;
}
// Define a custom header, that will be used to identify the plugin and the mailer.
$this->XMailer = 'WPMailSMTP/Mailer/' . $mail_mailer . ' ' . WPMS_PLUGIN_VER;
// Use the default PHPMailer, as we inject our settings there for certain providers.
if (
$mail_mailer === 'mail' ||
$mail_mailer === 'smtp' ||
$mail_mailer === 'pepipost'
) {
try {
// Allow to hook early to catch any early failed emails.
do_action( 'wp_mail_smtp_mailcatcher_smtp_pre_send_before', $this );
// Prepare all the headers.
if ( ! $this->preSend() ) {
return false;
}
// Allow to hook after all the preparation before the actual sending.
do_action( 'wp_mail_smtp_mailcatcher_smtp_send_before', $this );
return $this->postSend();
} catch ( \phpmailerException $e ) {
$this->mailHeader = '';
$this->setError( $e->getMessage() );
// Set the debug error, but not for default PHP mailer.
if ( $mail_mailer !== 'mail' ) {
Debug::set(
'Mailer: ' . esc_html( wp_mail_smtp()->get_providers()->get_options( $mail_mailer )->get_title() ) . PHP_EOL .
$e->getMessage()
);
}
if ( $this->exceptions ) {
throw $e;
}
return false;
}
}
// We need this so that the \PHPMailer class will correctly prepare all the headers.
$this->Mailer = 'mail';
// Prepare everything (including the message) for sending.
if ( ! $this->preSend() ) {
return false;
}
$mailer = wp_mail_smtp()->get_providers()->get_mailer( $mail_mailer, $this );
if ( ! $mailer ) {
return false;
}
if ( ! $mailer->is_php_compatible() ) {
return false;
}
/*
* Send the actual email.
* We reuse everything, that was preprocessed for usage in \PHPMailer.
*/
$mailer->send();
$is_sent = $mailer->is_email_sent();
// Allow to perform any actions with the data.
do_action( 'wp_mail_smtp_mailcatcher_send_after', $mailer, $this );
return $is_sent;
}
/**
* Returns all custom headers.
* In older versions of \PHPMailer class this method didn't exist.
* As we support WordPress 3.6+ - we need to make sure this method is always present.
*
* @since 1.5.0
*
* @return array
*/
public function getCustomHeaders() {
return $this->CustomHeader;
}
/**
* Get the PHPMailer line ending.
*
* @since 2.2.0
*
* @return string
*/
public function get_line_ending() {
return $this->LE; // phpcs:ignore
}
/**
* Create a unique ID to use for multipart email boundaries.
*
* @since 2.4.0
*
* @return string
*/
public function generate_id() {
return $this->generateId();
}
}

View File

@ -1,42 +0,0 @@
<?php
namespace WPMailSMTP;
/**
* Interface MailCatcherInterface.
*
* @since 2.2.0
*/
interface MailCatcherInterface {
/**
* Modify the default send() behaviour.
* For those mailers, that relies on PHPMailer class - call it directly.
* For others - init the correct provider and process it.
*
* @since 2.2.0
*
* @throws \phpmailerException|\PHPMailer\PHPMailer\Exception When sending via PhpMailer fails for some reason.
*
* @return bool
*/
public function send();
/**
* Get the PHPMailer line ending.
*
* @since 2.2.0
*
* @return string
*/
public function get_line_ending();
/**
* Create a unique ID to use for multipart email boundaries.
*
* @since 2.4.0
*
* @return string
*/
public function generate_id();
}

View File

@ -1,161 +0,0 @@
<?php
namespace WPMailSMTP;
/**
* Class MailCatcher replaces the \PHPMailer\PHPMailer\PHPMailer introduced in WP 5.5 and
* modifies the email sending logic. Thus, we can use other mailers API to do what we need, or stop emails completely.
*
* @since 2.2.0
*/
class MailCatcherV6 extends \PHPMailer\PHPMailer\PHPMailer implements MailCatcherInterface {
/**
* Callback Action function name.
*
* The function that handles the result of the send email action.
* It is called out by send() for each email sent.
*
* @since 2.2.0
*
* @var string
*/
public $action_function = '\WPMailSMTP\Processor::send_callback';
/**
* Modify the default send() behaviour.
* For those mailers, that relies on PHPMailer class - call it directly.
* For others - init the correct provider and process it.
*
* @since 2.2.0
*
* @throws \PHPMailer\PHPMailer\Exception When sending via PhpMailer fails for some reason.
*
* @return bool
*/
public function send() { // phpcs:ignore
$options = new Options();
$mail_mailer = sanitize_key( $options->get( 'mail', 'mailer' ) );
$is_emailing_blocked = false;
if ( wp_mail_smtp()->is_blocked() ) {
$is_emailing_blocked = true;
}
// Always allow a test email - check for the specific header.
foreach ( (array) $this->getCustomHeaders() as $header ) {
if (
! empty( $header[0] ) &&
! empty( $header[1] ) &&
$header[0] === 'X-Mailer-Type' &&
trim( $header[1] ) === 'WPMailSMTP/Admin/Test'
) {
$is_emailing_blocked = false;
}
};
// Do not send emails if admin desired that.
if ( $is_emailing_blocked ) {
return false;
}
// Define a custom header, that will be used to identify the plugin and the mailer.
$this->XMailer = 'WPMailSMTP/Mailer/' . $mail_mailer . ' ' . WPMS_PLUGIN_VER; // phpcs:ignore
// Use the default PHPMailer, as we inject our settings there for certain providers.
if (
$mail_mailer === 'mail' ||
$mail_mailer === 'smtp' ||
$mail_mailer === 'pepipost'
) {
try {
// Allow to hook early to catch any early failed emails.
do_action( 'wp_mail_smtp_mailcatcher_smtp_pre_send_before', $this );
// Prepare all the headers.
if ( ! $this->preSend() ) {
return false;
}
// Allow to hook after all the preparation before the actual sending.
do_action( 'wp_mail_smtp_mailcatcher_smtp_send_before', $this );
return $this->postSend();
} catch ( \PHPMailer\PHPMailer\Exception $e ) {
$this->mailHeader = ''; // phpcs:ignore
$this->setError( $e->getMessage() );
// Set the debug error, but not for default PHP mailer.
if ( $mail_mailer !== 'mail' ) {
Debug::set(
'Mailer: ' . esc_html( wp_mail_smtp()->get_providers()->get_options( $mail_mailer )->get_title() ) . PHP_EOL .
$e->getMessage()
);
}
if ( $this->exceptions ) {
throw $e;
}
return false;
}
}
// We need this so that the PHPMailer class will correctly prepare all the headers.
$this->Mailer = 'mail'; // phpcs:ignore
// Prepare everything (including the message) for sending.
if ( ! $this->preSend() ) {
return false;
}
$mailer = wp_mail_smtp()->get_providers()->get_mailer( $mail_mailer, $this );
if ( ! $mailer ) {
return false;
}
if ( ! $mailer->is_php_compatible() ) {
return false;
}
/*
* Send the actual email.
* We reuse everything, that was preprocessed for usage in PHPMailer.
*/
$mailer->send();
$is_sent = $mailer->is_email_sent();
// Allow to perform any actions with the data.
do_action( 'wp_mail_smtp_mailcatcher_send_after', $mailer, $this );
return $is_sent;
}
/**
* Get the PHPMailer line ending.
*
* @since 2.2.0
*
* @return string
*/
public function get_line_ending() {
return static::$LE; // phpcs:ignore
}
/**
* Create a unique ID to use for multipart email boundaries.
*
* @since 2.4.0
*
* @return string
*/
public function generate_id() {
return $this->generateId();
}
}

View File

@ -1,401 +0,0 @@
<?php
namespace WPMailSMTP;
use WPMailSMTP\Tasks\Meta;
/**
* Class Migration helps migrate plugin options, DB tables and more.
*
* @since 1.0.0 Migrate all plugin options saved from separate WP options into one.
* @since 2.1.0 Major overhaul of this class to use DB migrations (or any other migrations per version).
*/
class Migration {
/**
* Version of the latest migration.
*
* @since 2.1.0
*/
const VERSION = 2;
/**
* Option key where we save the current migration version.
*
* @since 2.1.0
*/
const OPTION_NAME = 'wp_mail_smtp_migration_version';
/**
* Current migration version, received from self::OPTION_NAME WP option
*
* @since 2.1.0
*
* @var int
*/
protected $cur_ver;
/**
* All old values for pre 1.0 version of a plugin.
*
* @since 1.0.0
*
* @var array
*/
protected $old_keys = array(
'pepipost_ssl',
'pepipost_port',
'pepipost_pass',
'pepipost_user',
'smtp_pass',
'smtp_user',
'smtp_auth',
'smtp_ssl',
'smtp_port',
'smtp_host',
'mail_set_return_path',
'mailer',
'mail_from_name',
'mail_from',
'wp_mail_smtp_am_notifications_hidden',
);
/**
* Old values, taken from $old_keys options.
*
* @since 1.0.0
*
* @var array
*/
protected $old_values = array();
/**
* Converted array of data from previous option values.
*
* @since 1.0.0
*
* @var array
*/
protected $new_values = array();
/**
* Migration constructor.
*
* @since 1.0.0
* @since 2.1.0 Redefined constructor - major overhaul.
*/
public function __construct() {
$this->cur_ver = self::get_cur_version();
$this->maybe_migrate();
}
/**
* Static on purpose, to get current migration version without __construct() and validation.
*
* @since 2.1.0
*
* @return int
*/
public static function get_cur_version() {
return (int) get_option( self::OPTION_NAME, 0 );
}
/**
* Run the migration if needed.
*
* @since 2.1.0
*/
protected function maybe_migrate() {
if ( ! is_admin() ) {
return;
}
if ( version_compare( $this->cur_ver, self::VERSION, '<' ) ) {
$this->run( self::VERSION );
}
}
/**
* Actual migration launcher.
*
* @since 2.1.0
*
* @param int $version The version of migration to run.
*/
protected function run( $version ) {
$function_version = (int) $version;
if ( method_exists( $this, 'migrate_to_' . $function_version ) ) {
$this->{'migrate_to_' . $function_version}();
} else {
$message = sprintf( /* translators: %1$s - WP Mail SMTP, %2$s - error message. */
esc_html__( 'There was an error while upgrading the database. Please contact %1$s support with this information: %2$s.', 'wp-mail-smtp' ),
'<strong>WP Mail SMTP</strong>',
'<code>migration from v' . self::get_cur_version() . ' to v' . self::VERSION . ' failed. Plugin version: v' . WPMS_PLUGIN_VER . '</code>'
);
WP::add_admin_notice( $message, WP::ADMIN_NOTICE_ERROR );
}
}
/**
* Update migration version in options table.
*
* @since 2.1.0
*
* @param int $version Migration version.
*/
protected function update_db_ver( $version ) {
if ( empty( $version ) ) {
$version = self::VERSION;
}
// Autoload it, because this value is checked all the time
// and no need to request it separately from all autoloaded options.
update_option( self::OPTION_NAME, $version, true );
}
/**
* Prevent running the same migration twice.
* Run migration only when required.
*
* @since 2.1.0
*
* @param string $version The version of migration to check for potential execution.
*/
protected function maybe_required_older_migrations( $version ) {
if ( version_compare( $this->cur_ver, $version, '<' ) ) {
$this->run( $version );
}
}
/**
* Migration from 0.x to 1.0.0.
* Move separate plugin WP options to one main plugin WP option setting.
*
* @since 2.1.0
*/
private function migrate_to_1() {
if ( $this->is_migrated() ) {
return;
}
$this->old_values = $this->get_old_values();
$this->new_values = $this->get_converted_options();
Options::init()->set( $this->new_values, true );
$this->update_db_ver( 1 );
}
/**
* Migration from 1.x to 2.1.0.
* Create Tasks\Meta table, if it does not exist.
*
* @since 2.1.0
*/
private function migrate_to_2() {
$this->maybe_required_older_migrations( 1 );
$meta = new Meta();
// Create the table if it doesn't exist.
if ( $meta && ! $meta->table_exists() ) {
$meta->create_table();
}
$this->update_db_ver( 2 );
}
/**
* Whether we already migrated or not.
*
* @since 1.0.0
*
* @return bool
*/
protected function is_migrated() {
$is_migrated = false;
$new_values = get_option( Options::META_KEY, array() );
if ( ! empty( $new_values ) ) {
$is_migrated = true;
}
return $is_migrated;
}
/**
* Get all old values from DB.
*
* @since 1.0.0
*
* @return array
*/
protected function get_old_values() {
$old_values = array();
foreach ( $this->old_keys as $old_key ) {
$value = get_option( $old_key, '' );
if ( ! empty( $value ) ) {
$old_values[ $old_key ] = $value;
}
}
return $old_values;
}
/**
* Convert old values from key=>value to a multidimensional array of data.
*
* @since 1.0.0
*/
protected function get_converted_options() {
$converted = array();
foreach ( $this->old_keys as $old_key ) {
$old_value = isset( $this->old_values[ $old_key ] ) ? $this->old_values[ $old_key ] : '';
switch ( $old_key ) {
case 'pepipost_user':
case 'pepipost_pass':
case 'pepipost_port':
case 'pepipost_ssl':
// Do not migrate pepipost options if it's not activated at the moment.
if ( isset( $this->old_values['mailer'] ) && $this->old_values['mailer'] === 'pepipost' ) {
$shortcut = explode( '_', $old_key );
if ( $old_key === 'pepipost_ssl' ) {
$converted[ $shortcut[0] ]['encryption'] = $old_value;
} else {
$converted[ $shortcut[0] ][ $shortcut[1] ] = $old_value;
}
}
break;
case 'smtp_host':
case 'smtp_port':
case 'smtp_ssl':
case 'smtp_auth':
case 'smtp_user':
case 'smtp_pass':
$shortcut = explode( '_', $old_key );
if ( $old_key === 'smtp_ssl' ) {
$converted[ $shortcut[0] ]['encryption'] = $old_value;
} elseif ( $old_key === 'smtp_auth' ) {
$converted[ $shortcut[0] ][ $shortcut[1] ] = ( $old_value === 'true' ? 'yes' : 'no' );
} else {
$converted[ $shortcut[0] ][ $shortcut[1] ] = $old_value;
}
break;
case 'mail_from':
$converted['mail']['from_email'] = $old_value;
break;
case 'mail_from_name':
$converted['mail']['from_name'] = $old_value;
break;
case 'mail_set_return_path':
$converted['mail']['return_path'] = ( $old_value === 'true' );
break;
case 'mailer':
$converted['mail']['mailer'] = ! empty( $old_value ) ? $old_value : 'mail';
break;
case 'wp_mail_smtp_am_notifications_hidden':
$converted['general']['am_notifications_hidden'] = ( isset( $old_value ) && $old_value === 'true' );
break;
}
}
$converted = $this->get_converted_constants_options( $converted );
return $converted;
}
/**
* Some users use constants in wp-config.php to define values.
* We need to prioritize them and reapply data to options.
* Use only those that are actually defined.
*
* @since 1.0.0
*
* @param array $converted
*
* @return array
*/
protected function get_converted_constants_options( $converted ) {
// Are we configured via constants?
if ( ! defined( 'WPMS_ON' ) || ! WPMS_ON ) {
return $converted;
}
/*
* Mail settings.
*/
if ( defined( 'WPMS_MAIL_FROM' ) ) {
$converted['mail']['from_email'] = WPMS_MAIL_FROM;
}
if ( defined( 'WPMS_MAIL_FROM_NAME' ) ) {
$converted['mail']['from_name'] = WPMS_MAIL_FROM_NAME;
}
if ( defined( 'WPMS_MAILER' ) ) {
$converted['mail']['mailer'] = WPMS_MAILER;
}
if ( defined( 'WPMS_SET_RETURN_PATH' ) ) {
$converted['mail']['return_path'] = WPMS_SET_RETURN_PATH;
}
/*
* SMTP settings.
*/
if ( defined( 'WPMS_SMTP_HOST' ) ) {
$converted['smtp']['host'] = WPMS_SMTP_HOST;
}
if ( defined( 'WPMS_SMTP_PORT' ) ) {
$converted['smtp']['port'] = WPMS_SMTP_PORT;
}
if ( defined( 'WPMS_SSL' ) ) {
$converted['smtp']['ssl'] = WPMS_SSL;
}
if ( defined( 'WPMS_SMTP_AUTH' ) ) {
$converted['smtp']['auth'] = WPMS_SMTP_AUTH;
}
if ( defined( 'WPMS_SMTP_USER' ) ) {
$converted['smtp']['user'] = WPMS_SMTP_USER;
}
if ( defined( 'WPMS_SMTP_PASS' ) ) {
$converted['smtp']['pass'] = WPMS_SMTP_PASS;
}
return $converted;
}
/**
* Delete all old values that are stored separately each.
*
* @since 1.0.0
*/
protected function clean_deprecated_data() {
foreach ( $this->old_keys as $old_key ) {
delete_option( $old_key );
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,336 +0,0 @@
<?php
namespace WPMailSMTP;
/**
* Class Processor modifies the behaviour of wp_mail() function.
*
* @since 1.0.0
*/
class Processor {
/**
* This attribute will hold the "original" WP from email address passed to the wp_mail_from filter,
* that is not equal to the default email address.
*
* It should hold an email address set via the wp_mail_from filter, before we might overwrite it.
*
* @since 2.1.0
*
* @var string
*/
protected $wp_mail_from;
/**
* Assign all hooks to proper places.
*
* @since 1.0.0
*/
public function hooks() {
add_action( 'phpmailer_init', array( $this, 'phpmailer_init' ) );
// High priority number tries to ensure our plugin code executes last and respects previous hooks, if not forced.
add_filter( 'wp_mail_from', array( $this, 'filter_mail_from_email' ), PHP_INT_MAX );
add_filter( 'wp_mail_from_name', array( $this, 'filter_mail_from_name' ), PHP_INT_MAX );
}
/**
* Redefine certain PHPMailer options with our custom ones.
*
* @since 1.0.0
*
* @param \PHPMailer $phpmailer It's passed by reference, so no need to return anything.
*/
public function phpmailer_init( $phpmailer ) {
$options = new Options();
$mailer = $options->get( 'mail', 'mailer' );
// Check that mailer is not blank, and if mailer=smtp, host is not blank.
if (
! $mailer ||
( 'smtp' === $mailer && ! $options->get( 'smtp', 'host' ) )
) {
return;
}
// If the mailer is pepipost, make sure we have a username and password.
if (
'pepipost' === $mailer &&
( ! $options->get( 'pepipost', 'user' ) && ! $options->get( 'pepipost', 'pass' ) )
) {
return;
}
// Set the mailer type as per config above, this overrides the already called isMail method.
// It's basically always 'smtp'.
$phpmailer->Mailer = $mailer;
// Set the Sender (return-path) if required.
if ( $options->get( 'mail', 'return_path' ) ) {
$phpmailer->Sender = $phpmailer->From;
}
// Set the SMTPSecure value, if set to none, leave this blank. Possible values: 'ssl', 'tls', ''.
if ( 'none' === $options->get( $mailer, 'encryption' ) ) {
$phpmailer->SMTPSecure = '';
} else {
$phpmailer->SMTPSecure = $options->get( $mailer, 'encryption' );
}
// Check if user has disabled SMTPAutoTLS.
if ( $options->get( $mailer, 'encryption' ) !== 'tls' && ! $options->get( $mailer, 'autotls' ) ) {
$phpmailer->SMTPAutoTLS = false;
}
// Check if original WP from email can be set as the reply_to attribute.
if ( $this->allow_setting_original_from_email_to_reply_to( $phpmailer->getReplyToAddresses(), $mailer ) ) {
$phpmailer->addReplyTo( $this->wp_mail_from );
}
// If we're sending via SMTP, set the host.
if ( 'smtp' === $mailer ) {
// Set the other options.
$phpmailer->Host = $options->get( $mailer, 'host' );
$phpmailer->Port = $options->get( $mailer, 'port' );
// If we're using smtp auth, set the username & password.
if ( $options->get( $mailer, 'auth' ) ) {
$phpmailer->SMTPAuth = true;
$phpmailer->Username = $options->get( $mailer, 'user' );
$phpmailer->Password = $options->get( $mailer, 'pass' );
}
} elseif ( 'pepipost' === $mailer ) {
// Set the Pepipost settings for BC.
$phpmailer->Mailer = 'smtp';
$phpmailer->Host = 'smtp.pepipost.com';
$phpmailer->Port = $options->get( $mailer, 'port' );
$phpmailer->SMTPSecure = $options->get( $mailer, 'encryption' ) === 'none' ? '' : $options->get( $mailer, 'encryption' );
$phpmailer->SMTPAuth = true;
$phpmailer->Username = $options->get( $mailer, 'user' );
$phpmailer->Password = $options->get( $mailer, 'pass' );
}
// Maybe set default reply-to header.
$this->set_default_reply_to( $phpmailer );
// You can add your own options here.
// See the phpmailer documentation for more info: https://github.com/PHPMailer/PHPMailer/tree/5.2-stable.
/** @noinspection PhpUnusedLocalVariableInspection It's passed by reference. */
$phpmailer = apply_filters( 'wp_mail_smtp_custom_options', $phpmailer );
}
/**
* Check if it's allowed to set the original WP from email to the reply_to field.
*
* @since 2.1.0
*
* @param array $reply_to Array of currently set reply to emails.
* @param string $mailer The slug of current mailer.
*
* @return bool
*/
protected function allow_setting_original_from_email_to_reply_to( $reply_to, $mailer ) {
$options = new Options();
$forced = $options->get( 'mail', 'from_email_force' );
$from_email = $options->get( 'mail', 'from_email' );
if ( ! empty( $reply_to ) || empty( $this->wp_mail_from ) ) {
return false;
}
if ( $mailer === 'gmail' ) {
$forced = true;
} elseif ( in_array( $mailer, [ 'outlook', 'zoho' ], true ) ) {
$sender = $options->get( $mailer, 'user_details' );
$from_email = ! empty( $sender['email'] ) ? $sender['email'] : '';
$forced = true;
}
if (
$from_email === $this->wp_mail_from ||
! $forced
) {
return false;
}
return true;
}
/**
* This method will be called every time 'smtp' and 'mail' mailers will be used to send emails.
*
* @since 1.3.0
* @since 1.5.0 Added a do_action() to be able to hook into.
*
* @param bool $is_sent
* @param array $to
* @param array $cc
* @param array $bcc
* @param string $subject
* @param string $body
* @param string $from
*/
public static function send_callback( $is_sent, $to, $cc, $bcc, $subject, $body, $from ) {
if ( ! $is_sent ) {
// Add mailer to the beginning and save to display later.
Debug::set(
'Mailer: ' . esc_html( wp_mail_smtp()->get_providers()->get_options( Options::init()->get( 'mail', 'mailer' ) )->get_title() ) . "\r\n" .
'PHPMailer was able to connect to SMTP server but failed while trying to send an email.'
);
} else {
Debug::clear();
}
do_action( 'wp_mail_smtp_mailcatcher_smtp_send_after', $is_sent, $to, $cc, $bcc, $subject, $body, $from );
}
/**
* Modify the email address that is used for sending emails.
*
* @since 1.0.0
* @since 1.3.0 Forcing email rewrite if option is selected.
* @since 1.7.0 Default email may be empty, so pay attention to that as well.
*
* @param string $wp_email The email address passed by the filter.
*
* @return string
*/
public function filter_mail_from_email( $wp_email ) {
$options = new Options();
$forced = $options->get( 'mail', 'from_email_force' );
$from_email = $options->get( 'mail', 'from_email' );
$def_email = WP::get_default_email();
// Save the "original" set WP email from address for later use.
if ( $wp_email !== $def_email ) {
$this->wp_mail_from = filter_var( $wp_email, FILTER_VALIDATE_EMAIL );
}
// Return FROM EMAIL if forced in settings.
if ( $forced & ! empty( $from_email ) ) {
return $from_email;
}
// If the FROM EMAIL is not the default, return it unchanged.
if ( ! empty( $def_email ) && $wp_email !== $def_email ) {
return $wp_email;
}
return ! empty( $from_email ) ? $from_email : $wp_email;
}
/**
* Modify the sender name that is used for sending emails.
*
* @since 1.0.0
* @since 1.3.0 Forcing name rewrite if option is selected.
*
* @param string $name
*
* @return string
*/
public function filter_mail_from_name( $name ) {
$options = new Options();
$force = $options->get( 'mail', 'from_name_force' );
// If the FROM NAME is not the default and not forced, return it unchanged.
if ( ! $force && $name !== $this->get_default_name() ) {
return $name;
}
$name = $options->get( 'mail', 'from_name' );
return $name;
}
/**
* Get the default email address based on domain name.
*
* @since 1.0.0
* @since 1.7.0 May return an empty string.
*
* @return string Empty string when we aren't able to get the site domain (CLI, misconfigured server etc).
*/
public function get_default_email() {
$server_name = Geo::get_site_domain();
if ( empty( $server_name ) ) {
return '';
}
// Get rid of www.
$sitename = strtolower( $server_name );
if ( substr( $sitename, 0, 4 ) === 'www.' ) {
$sitename = substr( $sitename, 4 );
}
return 'wordpress@' . $sitename;
}
/**
* Get the default email FROM NAME generated by WordPress.
*
* @since 1.3.0
*
* @return string
*/
public function get_default_name() {
return 'WordPress';
}
/**
* Get or create the phpmailer.
*
* @since 1.9.0
*
* @return MailCatcherInterface
*/
public function get_phpmailer() {
global $phpmailer;
// Make sure the PHPMailer class has been instantiated.
if ( ! is_object( $phpmailer ) || ! is_a( $phpmailer, 'PHPMailer' ) ) {
$phpmailer = wp_mail_smtp()->generate_mail_catcher( true ); // phpcs:ignore
}
return $phpmailer;
}
/**
* Set the default reply_to header, if:
* - no other reply_to headers are already set and,
* - the default reply_to address filter `wp_mail_smtp_processor_default_reply_to_addresses` is configured.
*
* @since 2.1.1
*
* @param MailCatcherInterface $phpmailer The PHPMailer object.
*/
private function set_default_reply_to( $phpmailer ) {
if ( ! empty( $phpmailer->getReplyToAddresses() ) ) {
return;
}
$default_reply_to_emails = apply_filters( 'wp_mail_smtp_processor_set_default_reply_to', '' );
if ( empty( $default_reply_to_emails ) ) {
return;
}
foreach ( explode( ',', $default_reply_to_emails ) as $email ) {
$email = trim( $email );
if ( filter_var( $email, FILTER_VALIDATE_EMAIL ) ) {
$phpmailer->addReplyTo( $email );
}
}
}
}

View File

@ -1,44 +0,0 @@
<?php
namespace WPMailSMTP\Providers\AmazonSES;
use WPMailSMTP\Providers\OptionsAbstract;
/**
* Class Options.
*
* @since 1.7.0
*/
class Options extends OptionsAbstract {
/**
* AmazonSES Options constructor.
*
* @since 1.7.0
*/
public function __construct() {
parent::__construct(
array(
'logo_url' => wp_mail_smtp()->assets_url . '/images/providers/aws.svg',
'slug' => 'amazonses',
'title' => esc_html__( 'Amazon SES', 'wp-mail-smtp' ),
'disabled' => true,
)
);
}
/**
* @inheritdoc
*/
public function display_options() {
?>
<p>
<?php esc_html_e( 'We\'re sorry, the Amazon SES mailer is not available on your plan. Please upgrade to the PRO plan to unlock all these awesome features.', 'wp-mail-smtp' ); ?>
</p>
<?php
}
}

View File

@ -1,151 +0,0 @@
<?php
namespace WPMailSMTP\Providers;
use WPMailSMTP\Options as PluginOptions;
/**
* Class AuthAbstract.
*
* @since 1.0.0
*/
abstract class AuthAbstract implements AuthInterface {
/**
* Mailer DB options.
*
* @since 1.0.0
*
* @var array
*/
protected $options = array();
/**
* @since 1.0.0
*
* @var mixed
*/
protected $client;
/**
* Mailer slug.
*
* @since 1.0.0
*
* @var string
*/
protected $mailer_slug = '';
/**
* Key for a stored unique state value.
*
* @since 1.5.0
*
* @var string
*/
public $state_key = 'wp_mail_smtp_provider_client_state';
/**
* Use the composer autoloader to include the auth library and all dependencies.
*
* @since 1.0.0
*/
protected function include_vendor_lib() {
require_once wp_mail_smtp()->plugin_path . '/vendor/autoload.php';
}
/**
* Get the url, that users will be redirected back to finish the OAuth process.
*
* @since 1.0.0
*
* @return string
*/
public static function get_plugin_auth_url() {
return add_query_arg( 'tab', 'auth', wp_mail_smtp()->get_admin()->get_admin_page_url() );
}
/**
* Update auth code in our DB.
*
* @since 1.0.0
*
* @param string $code
*/
protected function update_auth_code( $code ) {
$options = new PluginOptions();
$all = $options->get_all();
// To save in DB.
$all[ $this->mailer_slug ]['auth_code'] = $code;
// To save in currently retrieved options array.
$this->options['auth_code'] = $code;
// NOTE: These options need to be saved by overwriting all options, because WP automatic updates can cause an issue: GH #575!
$options->set( $all, false, true );
}
/**
* Update access token in our DB.
*
* @since 1.0.0
*
* @param mixed $token
*/
protected function update_access_token( $token ) {
$options = new PluginOptions();
$all = $options->get_all();
// To save in DB.
$all[ $this->mailer_slug ]['access_token'] = $token;
// To save in currently retrieved options array.
$this->options['access_token'] = $token;
// NOTE: These options need to be saved by overwriting all options, because WP automatic updates can cause an issue: GH #575!
$options->set( $all, false, true );
}
/**
* Update refresh token in our DB.
*
* @since 1.0.0
*
* @param mixed $token
*/
protected function update_refresh_token( $token ) {
$options = new PluginOptions();
$all = $options->get_all();
// To save in DB.
$all[ $this->mailer_slug ]['refresh_token'] = $token;
// To save in currently retrieved options array.
$this->options['refresh_token'] = $token;
// NOTE: These options need to be saved by overwriting all options, because WP automatic updates can cause an issue: GH #575!
$options->set( $all, false, true );
}
/**
* @inheritdoc
*/
public function is_clients_saved() {
return ! empty( $this->options['client_id'] ) && ! empty( $this->options['client_secret'] );
}
/**
* @inheritdoc
*/
public function is_auth_required() {
return empty( $this->options['access_token'] ) || empty( $this->options['refresh_token'] );
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace WPMailSMTP\Providers;
/**
* Interface AuthInterface.
*
* @since 1.0.0
*/
interface AuthInterface {
/**
* Whether user saved Client ID/App ID and Client Secret/App Password or not.
* Both options are required.
*
* @since 1.0.0
*
* @return bool
*/
public function is_clients_saved();
/**
* Whether we have an access and refresh tokens or not.
*
* @since 1.0.0
*
* @return bool
*/
public function is_auth_required();
}

View File

@ -1,354 +0,0 @@
<?php
namespace WPMailSMTP\Providers\Gmail;
use WPMailSMTP\Admin\Area;
use WPMailSMTP\Debug;
use WPMailSMTP\Options as PluginOptions;
use WPMailSMTP\Providers\AuthAbstract;
use WPMailSMTP\Vendor\Google_Client;
use WPMailSMTP\Vendor\Google_Service_Gmail;
/**
* Class Auth to request access and refresh tokens.
*
* @since 1.0.0
*/
class Auth extends AuthAbstract {
/**
* List of all possible "from email" email addresses (aliases).
*
* @since 2.2.0
*
* @var null|array
*/
private $aliases = null;
/**
* Auth constructor.
*
* @since 1.0.0
*/
public function __construct() {
$options = new PluginOptions();
$this->mailer_slug = $options->get( 'mail', 'mailer' );
if ( $this->mailer_slug !== Options::SLUG ) {
return;
}
$this->options = $options->get_group( $this->mailer_slug );
if ( $this->is_clients_saved() ) {
$this->include_vendor_lib();
$this->client = $this->get_client();
}
}
/**
* Get the url, that users will be redirected back to finish the OAuth process.
*
* @since 1.5.2 Returned to the old, pre-1.5, structure of the link to preserve BC.
*
* @return string
*/
public static function get_plugin_auth_url() {
return apply_filters(
'wp_mail_smtp_gmail_get_plugin_auth_url',
add_query_arg(
array(
'page' => Area::SLUG,
'tab' => 'auth',
),
admin_url( 'options-general.php' )
)
);
}
/**
* Init and get the Google Client object.
*
* @since 1.0.0
* @since 1.5.0 Add ability to apply custom options to the client via a filter.
*
* @return Google_Client
*/
public function get_client() {
// Doesn't load client twice + gives ability to overwrite.
if ( ! empty( $this->client ) ) {
return $this->client;
}
$this->include_vendor_lib();
$client = new Google_Client(
array(
'client_id' => $this->options['client_id'],
'client_secret' => $this->options['client_secret'],
'redirect_uris' => array(
self::get_oauth_redirect_url(),
),
)
);
$client->setApplicationName( 'WP Mail SMTP v' . WPMS_PLUGIN_VER );
$client->setAccessType( 'offline' );
$client->setApprovalPrompt( 'force' );
$client->setIncludeGrantedScopes( true );
// We request only the sending capability, as it's what we only need to do.
$client->setScopes( array( Google_Service_Gmail::MAIL_GOOGLE_COM ) );
$client->setRedirectUri( self::get_oauth_redirect_url() );
$client->setState( self::get_plugin_auth_url() );
// Apply custom options to the client.
$client = apply_filters( 'wp_mail_smtp_providers_gmail_auth_get_client_custom_options', $client );
if (
$this->is_auth_required() &&
! empty( $this->options['auth_code'] )
) {
try {
$creds = $client->fetchAccessTokenWithAuthCode( $this->options['auth_code'] );
} catch ( \Exception $e ) {
$creds['error'] = $e->getMessage();
}
// Bail if we have an error.
if ( ! empty( $creds['error'] ) ) {
if ( $creds['error'] === 'invalid_client' ) {
$creds['error'] .= PHP_EOL . esc_html__( 'Please make sure your Google Client ID and Secret in the plugin settings are valid. Save the settings and try the Authorization again.' , 'wp-mail-smtp' );
}
Debug::set(
'Mailer: Gmail' . "\r\n" .
$creds['error']
);
return $client;
} else {
Debug::clear();
}
$this->update_access_token( $client->getAccessToken() );
$this->update_refresh_token( $client->getRefreshToken() );
}
if ( ! empty( $this->options['access_token'] ) ) {
$client->setAccessToken( $this->options['access_token'] );
}
// Refresh the token if it's expired.
if ( $client->isAccessTokenExpired() ) {
$refresh = $client->getRefreshToken();
if ( empty( $refresh ) && isset( $this->options['refresh_token'] ) ) {
$refresh = $this->options['refresh_token'];
}
if ( ! empty( $refresh ) ) {
try {
$creds = $client->fetchAccessTokenWithRefreshToken( $refresh );
} catch ( \Exception $e ) {
$creds['error'] = $e->getMessage();
Debug::set(
'Mailer: Gmail' . "\r\n" .
$e->getMessage()
);
}
// Bail if we have an error.
if ( ! empty( $creds['error'] ) ) {
return $client;
}
$this->update_access_token( $client->getAccessToken() );
$this->update_refresh_token( $client->getRefreshToken() );
}
}
return $client;
}
/**
* Get the auth code from the $_GET and save it.
* Redirect user back to settings with an error message, if failed.
*
* @since 1.0.0
*/
public function process() {
if ( ! ( isset( $_GET['tab'] ) && $_GET['tab'] === 'auth' ) ) { // phpcs:ignore
wp_safe_redirect( wp_mail_smtp()->get_admin()->get_admin_page_url() );
exit;
}
// We can't process without saved client_id/secret.
if ( ! $this->is_clients_saved() ) {
Debug::set(
esc_html__( 'There was an error while processing the Google authentication request. Please make sure that you have Client ID and Client Secret both valid and saved.', 'wp-mail-smtp' )
);
wp_safe_redirect(
add_query_arg(
'error',
'google_no_clients',
wp_mail_smtp()->get_admin()->get_admin_page_url()
)
);
exit;
}
$this->include_vendor_lib();
$code = '';
$scope = '';
$error = '';
if ( isset( $_GET['error'] ) ) { // phpcs:ignore
$error = sanitize_key( $_GET['error'] ); // phpcs:ignore
}
// In case of any error: display a message to a user.
if ( ! empty( $error ) ) {
wp_safe_redirect(
add_query_arg(
'error',
'google_' . $error,
wp_mail_smtp()->get_admin()->get_admin_page_url()
)
);
exit;
}
if ( isset( $_GET['code'] ) ) { // phpcs:ignore
$code = urldecode( $_GET['code'] ); // phpcs:ignore
}
if ( isset( $_GET['scope'] ) ) { // phpcs:ignore
$scope = urldecode( base64_decode( $_GET['scope'] ) ); // phpcs:ignore
}
// Let's try to get the access token.
if (
! empty( $code ) &&
(
$scope === Google_Service_Gmail::MAIL_GOOGLE_COM . ' ' . Google_Service_Gmail::GMAIL_SEND ||
$scope === Google_Service_Gmail::GMAIL_SEND . ' ' . Google_Service_Gmail::MAIL_GOOGLE_COM ||
$scope === Google_Service_Gmail::GMAIL_SEND ||
$scope === Google_Service_Gmail::MAIL_GOOGLE_COM
)
) {
// Save the auth code. So Google_Client can reuse it to retrieve the access token.
$this->update_auth_code( $code );
} else {
wp_safe_redirect(
add_query_arg(
'error',
'google_no_code_scope',
wp_mail_smtp()->get_admin()->get_admin_page_url()
)
);
exit;
}
wp_safe_redirect(
add_query_arg(
'success',
'google_site_linked',
wp_mail_smtp()->get_admin()->get_admin_page_url()
)
);
exit;
}
/**
* Get the auth URL used to proceed to Provider to request access to send emails.
*
* @since 1.0.0
*
* @return string
*/
public function get_auth_url() {
if (
! empty( $this->client ) &&
class_exists( 'WPMailSMTP\Vendor\Google_Client', false ) &&
$this->client instanceof Google_Client
) {
return filter_var( $this->client->createAuthUrl(), FILTER_SANITIZE_URL );
}
return '#';
}
/**
* Get user information (like email etc) that is associated with the current connection.
*
* @since 1.5.0
*
* @return array
*/
public function get_user_info() {
$gmail = new Google_Service_Gmail( $this->get_client() );
try {
$email = $gmail->users->getProfile( 'me' )->getEmailAddress();
} catch ( \Exception $e ) {
$email = '';
}
return array( 'email' => $email );
}
/**
* Get the registered email addresses that the user can use as the "from email".
*
* @since 2.2.0
*
* @return array The list of possible from email addresses.
*/
public function get_user_possible_send_from_addresses() {
if ( isset( $this->aliases ) ) {
return $this->aliases;
}
$gmail = new Google_Service_Gmail( $this->get_client() );
try {
$response = $gmail->users_settings_sendAs->listUsersSettingsSendAs( 'me' ); // phpcs:ignore
// phpcs:disable
$this->aliases = array_map(
function( $sendAsObject ) {
return $sendAsObject['sendAsEmail'];
},
(array) $response->getSendAs()
);
// phpcs:enable
} catch ( \Exception $exception ) {
$this->aliases = [];
}
return $this->aliases;
}
/**
* Get the Google oAuth 2.0 redirect URL.
*
* This is the URL that Google will redirect after the access to the Gmail account is granted or rejected.
* The below endpoint will then redirect back to the user's WP site (to self::get_plugin_auth_url() URL).
*
* @since 2.5.0
*
* @return string
*/
public static function get_oauth_redirect_url() {
return 'https://connect.wpmailsmtp.com/google/';
}
}

View File

@ -1,315 +0,0 @@
<?php
namespace WPMailSMTP\Providers\Gmail;
use WPMailSMTP\Debug;
use WPMailSMTP\MailCatcherInterface;
use WPMailSMTP\Providers\MailerAbstract;
use WPMailSMTP\Vendor\Google_Service_Gmail;
use WPMailSMTP\Vendor\Google_Service_Gmail_Message;
/**
* Class Mailer.
*
* @since 1.0.0
*/
class Mailer extends MailerAbstract {
/**
* URL to make an API request to.
* Not used for Gmail, as we are using its API.
*
* @since 1.0.0
*
* @var string
*/
protected $url = 'https://www.googleapis.com/upload/gmail/v1/users/{userId}/messages/send';
/**
* Gmail message.
*
* @since 1.0.0
*
* @var Google_Service_Gmail_Message
*/
protected $message;
/**
* Mailer constructor.
*
* @since 1.0.0
*
* @param MailCatcherInterface $phpmailer The MailCatcher object.
*/
public function __construct( $phpmailer ) {
parent::__construct( $phpmailer );
if ( ! $this->is_php_compatible() ) {
return;
}
}
/**
* Re-use the MailCatcher class methods and properties.
*
* @since 1.2.0
*
* @param MailCatcherInterface $phpmailer The MailCatcher object.
*/
public function process_phpmailer( $phpmailer ) {
// Make sure that we have access to PHPMailer class methods.
if ( ! wp_mail_smtp()->is_valid_phpmailer( $phpmailer ) ) {
return;
}
$this->phpmailer = $phpmailer;
}
/**
* Use Google API Services to send emails.
*
* @since 1.0.0
*/
public function send() {
// Include the Google library.
require_once wp_mail_smtp()->plugin_path . '/vendor/autoload.php';
$auth = new Auth();
$message = new Google_Service_Gmail_Message();
// Set the authorized Gmail email address as the "from email" if the set email is not on the list of aliases.
$possible_from_emails = $auth->get_user_possible_send_from_addresses();
if ( ! in_array( $this->phpmailer->From, $possible_from_emails, true ) ) {
$user_info = $auth->get_user_info();
if ( ! empty( $user_info['email'] ) ) {
$this->phpmailer->From = $user_info['email'];
$this->phpmailer->Sender = $user_info['email'];
}
}
try {
// Prepare a message for sending if any changes happened above.
$this->phpmailer->preSend();
// Get the raw MIME email using MailCatcher data. We need to make base64URL-safe string.
$base64 = str_replace(
[ '+', '/', '=' ],
[ '-', '_', '' ],
base64_encode( $this->phpmailer->getSentMIMEMessage() ) //phpcs:ignore
);
$message->setRaw( $base64 );
$service = new Google_Service_Gmail( $auth->get_client() );
$response = $service->users_messages->send( 'me', $message );
$this->process_response( $response );
} catch ( \Exception $e ) {
$this->error_message = $e->getMessage();
Debug::set(
'Mailer: Gmail' . "\r\n" .
$this->process_exception_message( $e->getMessage() )
);
return;
}
}
/**
* Save response from the API to use it later.
*
* @since 1.0.0
* @since 1.5.0 Added action "wp_mail_smtp_providers_gmail_mailer_process_response" with $response.
*
* @param Google_Service_Gmail_Message $response Instance of Gmail response.
*/
protected function process_response( $response ) {
$this->response = $response;
if ( ! method_exists( $this->response, 'getId' ) ) {
$this->error_message = esc_html__( 'The response object is invalid (missing getId method).', 'wp-mail-smtp' );
} else {
$message_id = $this->response->getId();
if ( empty( $message_id ) ) {
$this->error_message = esc_html__( 'The email message ID is missing.', 'wp-mail-smtp' );
}
}
do_action( 'wp_mail_smtp_providers_gmail_mailer_process_response', $this->response, $this->phpmailer );
}
/**
* Check whether the email was sent.
*
* @since 1.0.0
*
* @return bool
*/
public function is_email_sent() {
$is_sent = false;
if ( method_exists( $this->response, 'getId' ) ) {
$message_id = $this->response->getId();
if ( ! empty( $message_id ) ) {
$is_sent = true;
}
}
// Clear debug messages if email is successfully sent.
if ( $is_sent ) {
Debug::clear();
}
return $is_sent;
}
/**
* This method is relevant to SMTP and Pepipost.
* All other custom mailers should override it with own information.
*
* @since 1.2.0
*
* @return string
*/
public function get_debug_info() {
$gmail_text = array();
$options = new \WPMailSMTP\Options();
$gmail = $options->get_group( 'gmail' );
$curl_ver = 'No';
if ( function_exists( 'curl_version' ) ) {
$curl = curl_version(); // phpcs:ignore
$curl_ver = $curl['version'];
}
$gmail_text[] = '<strong>Client ID/Secret:</strong> ' . ( ! empty( $gmail['client_id'] ) && ! empty( $gmail['client_secret'] ) ? 'Yes' : 'No' );
$gmail_text[] = '<strong>Auth Code:</strong> ' . ( ! empty( $gmail['auth_code'] ) ? 'Yes' : 'No' );
$gmail_text[] = '<strong>Access Token:</strong> ' . ( ! empty( $gmail['access_token'] ) ? 'Yes' : 'No' );
$gmail_text[] = '<br><strong>Server:</strong>';
$gmail_text[] = '<strong>OpenSSL:</strong> ' . ( extension_loaded( 'openssl' ) && defined( 'OPENSSL_VERSION_TEXT' ) ? OPENSSL_VERSION_TEXT : 'No' );
$gmail_text[] = '<strong>PHP.allow_url_fopen:</strong> ' . ( ini_get( 'allow_url_fopen' ) ? 'Yes' : 'No' );
$gmail_text[] = '<strong>PHP.stream_socket_client():</strong> ' . ( function_exists( 'stream_socket_client' ) ? 'Yes' : 'No' );
$gmail_text[] = '<strong>PHP.fsockopen():</strong> ' . ( function_exists( 'fsockopen' ) ? 'Yes' : 'No' );
$gmail_text[] = '<strong>PHP.curl_version():</strong> ' . $curl_ver; // phpcs:ignore
if ( function_exists( 'apache_get_modules' ) ) {
$modules = apache_get_modules();
$gmail_text[] = '<strong>Apache.mod_security:</strong> ' . ( in_array( 'mod_security', $modules, true ) || in_array( 'mod_security2', $modules, true ) ? 'Yes' : 'No' );
}
if ( function_exists( 'selinux_is_enabled' ) ) {
$gmail_text[] = '<strong>OS.SELinux:</strong> ' . ( selinux_is_enabled() ? 'Yes' : 'No' );
}
if ( function_exists( 'grsecurity_is_enabled' ) ) {
$gmail_text[] = '<strong>OS.grsecurity:</strong> ' . ( grsecurity_is_enabled() ? 'Yes' : 'No' );
}
return implode( '<br>', $gmail_text );
}
/**
* Whether the mailer has all its settings correctly set up and saved.
*
* @since 1.4.0
*
* @return bool
*/
public function is_mailer_complete() {
if ( ! $this->is_php_compatible() ) {
return false;
}
$auth = new Auth();
if (
$auth->is_clients_saved() &&
! $auth->is_auth_required()
) {
return true;
}
return false;
}
/**
* Process the exception message and append additional explanation to it.
*
* @since 2.1.0
*
* @param mixed $message A string or an object with strings.
*
* @return string
*/
protected function process_exception_message( $message ) {
// Transform the passed message to a string.
if ( ! is_string( $message ) ) {
$message = wp_json_encode( $message );
} else {
$message = wp_strip_all_tags( $message, false );
}
// Define known errors, that we will scan the message with.
$known_errors = array(
array(
'errors' => array(
'invalid_grant',
),
'explanation' => esc_html__( 'Please re-grant Google app permissions!', 'wp-mail-smtp' ) . ' ' . PHP_EOL .
esc_html__( 'Go to WP Mail SMTP plugin settings page. Click the “Remove Connection” button.', 'wp-mail-smtp' ) . ' ' . PHP_EOL .
esc_html__( 'Then click the “Allow plugin to send emails using your Google account” button and re-enable access.', 'wp-mail-smtp' ),
),
);
// Check if we get a match and append the explanation to the original message.
foreach ( $known_errors as $error ) {
foreach ( $error['errors'] as $error_fragment ) {
if ( false !== strpos( $message, $error_fragment ) ) {
return $message . PHP_EOL . $error['explanation'];
}
}
}
// If we get no match we return the original message (as a string).
return $message;
}
/**
* Get the default email addresses for the reply to email parameter.
*
* @deprecated 2.1.1
*
* @since 2.1.0
* @since 2.1.1 Not used anymore.
*
* @return array
*/
public function default_reply_to_addresses() {
_deprecated_function( __CLASS__ . '::' . __METHOD__, '2.1.1 of WP Mail SMTP plugin' );
$gmail_creds = ( new Auth() )->get_user_info();
if ( empty( $gmail_creds['email'] ) ) {
return [];
}
return [
$gmail_creds['email'] => [
$gmail_creds['email'],
'',
],
];
}
}

View File

@ -1,259 +0,0 @@
<?php
namespace WPMailSMTP\Providers\Gmail;
use WPMailSMTP\Providers\OptionsAbstract;
/**
* Class Option.
*
* @since 1.0.0
*/
class Options extends OptionsAbstract {
/**
* Mailer slug.
*
* @since 1.5.0
*/
const SLUG = 'gmail';
/**
* Gmail Options constructor.
*
* @since 1.0.0
* @since 2.3.0 Added supports parameter.
*/
public function __construct() {
parent::__construct(
[
'logo_url' => wp_mail_smtp()->assets_url . '/images/providers/google.svg',
'slug' => self::SLUG,
'title' => esc_html__( 'Gmail', 'wp-mail-smtp' ),
'description' => sprintf(
wp_kses( /* translators: %s - URL to our Gmail doc. */
__( 'Send emails using your Gmail or G Suite (formerly Google Apps) account, all while keeping your login credentials safe. Other Google SMTP methods require enabling less secure apps in your account and entering your password. However, this integration uses the Google API to improve email delivery issues while keeping your site secure.<br><br>Read our <a href="%s" target="_blank" rel="noopener noreferrer">Gmail documentation</a> to learn how to configure Gmail or G Suite.', 'wp-mail-smtp' ),
[
'br' => [],
'a' => [
'href' => [],
'rel' => [],
'target' => [],
],
]
),
'https://wpmailsmtp.com/docs/how-to-set-up-the-gmail-mailer-in-wp-mail-smtp/'
),
'notices' => [
'educational' => esc_html__( 'The Gmail mailer works well for sites that send low numbers of emails. However, Gmail\'s API has rate limitations and a number of additional restrictions that can lead to challenges during setup. If you expect to send a high volume of emails, or if you find that your web host is not compatible with the Gmail API restrictions, then we recommend considering a different mailer option.', 'wp-mail-smtp' ),
],
'php' => '5.5',
'supports' => [
'from_email' => true,
'from_name' => true,
'return_path' => false,
'from_email_force' => true,
'from_name_force' => true,
],
]
);
}
/**
* @inheritdoc
*/
public function display_options() {
// Do not display options if PHP version is not correct.
if ( ! $this->is_php_correct() ) {
$this->display_php_warning();
return;
}
?>
<!-- Client ID -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-client_id"
class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-client_id"><?php esc_html_e( 'Client ID', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][client_id]" type="text"
value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'client_id' ) ); ?>"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'client_id' ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-client_id" spellcheck="false"
/>
</div>
</div>
<!-- Client Secret -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-client_secret"
class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-client_secret"><?php esc_html_e( 'Client Secret', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<?php if ( $this->options->is_const_defined( $this->get_slug(), 'client_secret' ) ) : ?>
<input type="text" disabled value="****************************************"
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-client_secret"
/>
<?php $this->display_const_set_message( 'WPMS_GMAIL_CLIENT_SECRET' ); ?>
<?php else : ?>
<input type="password" spellcheck="false"
name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][client_secret]"
value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'client_secret' ) ); ?>"
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-client_secret"
/>
<?php endif; ?>
</div>
</div>
<!-- Authorized redirect URI -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-client_redirect"
class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-client_redirect"><?php esc_html_e( 'Authorized redirect URI', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<input type="text" readonly="readonly" onfocus="this.select();"
value="<?php echo esc_attr( Auth::get_oauth_redirect_url() ); ?>"
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-client_redirect"
/>
<button type="button" class="wp-mail-smtp-btn wp-mail-smtp-btn-md wp-mail-smtp-btn-light-grey wp-mail-smtp-setting-copy"
title="<?php esc_attr_e( 'Copy URL to clipboard', 'wp-mail-smtp' ); ?>"
data-source_id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-client_redirect">
<span class="dashicons dashicons-admin-page"></span>
</button>
<p class="desc">
<?php esc_html_e( 'Please copy this URL into the "Authorized redirect URIs" field of your Google web application.', 'wp-mail-smtp' ); ?>
</p>
</div>
</div>
<!-- Auth users button -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-authorize"
class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label><?php esc_html_e( 'Authorization', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<?php $this->display_auth_setting_action(); ?>
</div>
</div>
<?php
}
/**
* Display either an "Allow..." or "Remove..." button.
*
* @since 1.3.0
*/
protected function display_auth_setting_action() {
// Do the processing on the fly, as having ajax here is too complicated.
$this->process_provider_remove();
$auth = new Auth();
?>
<?php if ( $auth->is_clients_saved() ) : ?>
<?php if ( $auth->is_auth_required() ) : ?>
<a href="<?php echo esc_url( $auth->get_auth_url() ); ?>" class="wp-mail-smtp-btn wp-mail-smtp-btn-md wp-mail-smtp-btn-orange">
<?php esc_html_e( 'Allow plugin to send emails using your Google account', 'wp-mail-smtp' ); ?>
</a>
<p class="desc">
<?php esc_html_e( 'Click the button above to confirm authorization.', 'wp-mail-smtp' ); ?>
</p>
<?php else : ?>
<a href="<?php echo esc_url( wp_nonce_url( wp_mail_smtp()->get_admin()->get_admin_page_url(), 'gmail_remove', 'gmail_remove_nonce' ) ); ?>#wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-authorize" class="wp-mail-smtp-btn wp-mail-smtp-btn-md wp-mail-smtp-btn-red js-wp-mail-smtp-provider-remove">
<?php esc_html_e( 'Remove Connection', 'wp-mail-smtp' ); ?>
</a>
<span class="connected-as">
<?php
$user = $auth->get_user_info();
if ( ! empty( $user['email'] ) ) {
printf(
/* translators: %s - email address, as received from Google API. */
esc_html__( 'Connected as %s', 'wp-mail-smtp' ),
'<code>' . esc_html( $user['email'] ) . '</code>'
);
}
?>
</span>
<p class="desc">
<?php
printf(
wp_kses( /* translators: %s - URL to Google Gmail alias documentation page. */
__( 'If you want to use a different From Email address you can set-up a Google email alias. <a href="%s" target="_blank" rel="noopener noreferrer">Follow these instructions</a> and then select the From Email at the top of this page.', 'wp-mail-smtp' ),
[
'a' => [
'href' => [],
'rel' => [],
'target' => [],
],
]
),
'https://support.google.com/a/answer/33327'
);
?>
</p>
<p class="desc">
<?php esc_html_e( 'Removing the connection will give you an ability to redo the connection or link to another Google account.', 'wp-mail-smtp' ); ?>
</p>
<?php endif; ?>
<?php else : ?>
<p class="inline-notice inline-error">
<?php esc_html_e( 'You need to save settings with Client ID and Client Secret before you can proceed.', 'wp-mail-smtp' ); ?>
</p>
<?php
endif;
}
/**
* Remove Provider connection.
*
* @since 1.3.0
*/
public function process_provider_remove() {
if ( ! is_super_admin() ) {
return;
}
if (
! isset( $_GET['gmail_remove_nonce'] ) ||
! wp_verify_nonce( $_GET['gmail_remove_nonce'], 'gmail_remove' ) // phpcs:ignore
) {
return;
}
$options = new \WPMailSMTP\Options();
if ( $options->get( 'mail', 'mailer' ) !== $this->get_slug() ) {
return;
}
$old_opt = $options->get_all_raw();
foreach ( $old_opt[ $this->get_slug() ] as $key => $value ) {
// Unset everything except Client ID and Secret.
if ( ! in_array( $key, array( 'client_id', 'client_secret' ), true ) ) {
unset( $old_opt[ $this->get_slug() ][ $key ] );
}
}
$options->set( $old_opt );
}
}

View File

@ -1,239 +0,0 @@
<?php
namespace WPMailSMTP\Providers;
use WPMailSMTP\Debug;
use WPMailSMTP\MailCatcherInterface;
use WPMailSMTP\Options;
/**
* Class Loader.
*
* @since 1.0.0
*/
class Loader {
/**
* Key is the mailer option, value is the path to its classes.
*
* @since 1.0.0
* @since 1.6.0 Added Sendinblue.
* @since 1.7.0 Added AmazonSES/Outlook as indication of the Pro mailers.
*
* @var array
*/
protected $providers = array(
'mail' => 'WPMailSMTP\Providers\Mail\\',
'smtpcom' => 'WPMailSMTP\Providers\SMTPcom\\',
'sendinblue' => 'WPMailSMTP\Providers\Sendinblue\\',
'pepipostapi' => 'WPMailSMTP\Providers\PepipostAPI\\',
'mailgun' => 'WPMailSMTP\Providers\Mailgun\\',
'sendgrid' => 'WPMailSMTP\Providers\Sendgrid\\',
'amazonses' => 'WPMailSMTP\Providers\AmazonSES\\',
'gmail' => 'WPMailSMTP\Providers\Gmail\\',
'outlook' => 'WPMailSMTP\Providers\Outlook\\',
'zoho' => 'WPMailSMTP\Providers\Zoho\\',
'smtp' => 'WPMailSMTP\Providers\SMTP\\',
'pepipost' => 'WPMailSMTP\Providers\Pepipost\\',
);
/**
* @since 1.0.0
*
* @var MailCatcherInterface
*/
private $phpmailer;
/**
* Get all the supported providers.
*
* @since 1.0.0
*
* @return array
*/
public function get_providers() {
if ( ! Options::init()->is_mailer_active( 'pepipost' ) ) {
unset( $this->providers['pepipost'] );
}
if ( ! Options::init()->is_mailer_active( 'pepipostapi' ) ) {
unset( $this->providers['pepipostapi'] );
}
return apply_filters( 'wp_mail_smtp_providers_loader_get_providers', $this->providers );
}
/**
* Get a single provider FQN-path based on its name.
*
* @since 1.0.0
*
* @param string $provider
*
* @return string|null
*/
public function get_provider_path( $provider ) {
$provider = sanitize_key( $provider );
$providers = $this->get_providers();
return apply_filters(
'wp_mail_smtp_providers_loader_get_provider_path',
isset( $providers[ $provider ] ) ? $providers[ $provider ] : null,
$provider
);
}
/**
* Get the provider options, if exists.
*
* @since 1.0.0
*
* @param string $provider
*
* @return OptionsAbstract|null
*/
public function get_options( $provider ) {
return $this->get_entity( $provider, 'Options' );
}
/**
* Get all options of all providers.
*
* @since 1.0.0
*
* @return OptionsAbstract[]
*/
public function get_options_all() {
$options = array();
foreach ( $this->get_providers() as $provider => $path ) {
$option = $this->get_options( $provider );
if ( ! $option instanceof OptionsAbstract ) {
continue;
}
$slug = $option->get_slug();
$title = $option->get_title();
if ( empty( $title ) || empty( $slug ) ) {
continue;
}
$options[] = $option;
}
return apply_filters( 'wp_mail_smtp_providers_loader_get_providers_all', $options );
}
/**
* Get the provider mailer, if exists.
*
* @since 1.0.0
*
* @param string $provider The provider name.
* @param MailCatcherInterface $phpmailer The MailCatcher object.
*
* @return MailerAbstract|null
*/
public function get_mailer( $provider, $phpmailer ) {
if ( wp_mail_smtp()->is_valid_phpmailer( $phpmailer ) ) {
$this->phpmailer = $phpmailer;
}
return $this->get_entity( $provider, 'Mailer' );
}
/**
* Get the provider auth, if exists.
*
* @param string $provider
*
* @return AuthAbstract|null
*/
public function get_auth( $provider ) {
return $this->get_entity( $provider, 'Auth' );
}
/**
* Get a generic entity based on the request.
*
* @uses \ReflectionClass
*
* @since 1.0.0
*
* @param string $provider
* @param string $request
*
* @return OptionsAbstract|MailerAbstract|AuthAbstract|null
*/
protected function get_entity( $provider, $request ) {
$provider = sanitize_key( $provider );
$request = sanitize_text_field( $request );
$path = $this->get_provider_path( $provider );
$entity = null;
if ( empty( $path ) ) {
return $entity;
}
try {
$reflection = new \ReflectionClass( $path . $request );
if ( file_exists( $reflection->getFileName() ) ) {
$class = $path . $request;
if ( $this->phpmailer ) {
$entity = new $class( $this->phpmailer );
} else {
$entity = new $class();
}
}
}
catch ( \Exception $e ) {
Debug::set( "There was a problem while retrieving {$request} for {$provider}: {$e->getMessage()}" );
$entity = null;
}
return apply_filters( 'wp_mail_smtp_providers_loader_get_entity', $entity, $provider, $request );
}
/**
* Get supports options for all mailers.
*
* @since 2.3.0
*
* @return array
*/
public function get_supports_all() {
$supports = [];
foreach ( $this->get_providers() as $provider => $path ) {
$option = $this->get_options( $provider );
if ( ! $option instanceof OptionsAbstract ) {
continue;
}
$mailer_slug = $option->get_slug();
$mailer_supports = $option->get_supports();
if ( empty( $mailer_slug ) || empty( $mailer_supports ) ) {
continue;
}
$supports[ $mailer_slug ] = $mailer_supports;
}
return apply_filters( 'wp_mail_smtp_providers_loader_get_supports_all', $supports );
}
}

View File

@ -1,49 +0,0 @@
<?php
namespace WPMailSMTP\Providers\Mail;
use WPMailSMTP\Providers\MailerAbstract;
/**
* Class Mailer inherits everything from parent abstract class.
* This file is required for a proper work of Loader and \ReflectionClass.
*
* @package WPMailSMTP\Providers\Mail
*/
class Mailer extends MailerAbstract {
/**
* @inheritdoc
*/
public function get_debug_info() {
$mail_text = array();
$mail_text[] = '<br><strong>Server:</strong>';
$disabled_functions = ini_get( 'disable_functions' );
$disabled = (array) explode( ',', trim( $disabled_functions ) );
$mail_text[] = '<strong>PHP.mail():</strong> ' . ( in_array( 'mail', $disabled, true ) || ! function_exists( 'mail' ) ? 'No' : 'Yes' );
if ( function_exists( 'apache_get_modules' ) ) {
$modules = apache_get_modules();
$mail_text[] = '<strong>Apache.mod_security:</strong> ' . ( in_array( 'mod_security', $modules, true ) || in_array( 'mod_security2', $modules, true ) ? 'Yes' : 'No' );
}
if ( function_exists( 'selinux_is_enabled' ) ) {
$mail_text[] = '<strong>OS.SELinux:</strong> ' . ( selinux_is_enabled() ? 'Yes' : 'No' );
}
if ( function_exists( 'grsecurity_is_enabled' ) ) {
$mail_text[] = '<strong>OS.grsecurity:</strong> ' . ( grsecurity_is_enabled() ? 'Yes' : 'No' );
}
return implode( '<br>', $mail_text );
}
/**
* @inheritdoc
*/
public function is_mailer_complete() {
return true;
}
}

View File

@ -1,42 +0,0 @@
<?php
namespace WPMailSMTP\Providers\Mail;
use WPMailSMTP\Providers\OptionsAbstract;
/**
* Class Option.
*
* @since 1.0.0
*/
class Options extends OptionsAbstract {
/**
* Mail constructor.
*
* @since 1.0.0
*/
public function __construct() {
parent::__construct(
array(
'logo_url' => wp_mail_smtp()->assets_url . '/images/providers/php.svg',
'slug' => 'mail',
'title' => esc_html__( 'Default (none)', 'wp-mail-smtp' ),
)
);
}
/**
* @inheritdoc
*/
public function display_options() {
?>
<blockquote>
<?php esc_html_e( 'You currently have the native WordPress option selected. Please select any other Mailer option above to continue the setup.', 'wp-mail-smtp' ); ?>
</blockquote>
<?php
}
}

View File

@ -1,531 +0,0 @@
<?php
namespace WPMailSMTP\Providers;
use WPMailSMTP\Conflicts;
use WPMailSMTP\Debug;
use WPMailSMTP\MailCatcherInterface;
use WPMailSMTP\Options;
use WPMailSMTP\WP;
/**
* Class MailerAbstract.
*
* @since 1.0.0
*/
abstract class MailerAbstract implements MailerInterface {
/**
* Which response code from HTTP provider is considered to be successful?
*
* @since 1.0.0
*
* @var int
*/
protected $email_sent_code = 200;
/**
* @since 1.0.0
*
* @var Options
*/
protected $options;
/**
* @since 1.0.0
*
* @var MailCatcherInterface
*/
protected $phpmailer;
/**
* @since 1.0.0
*
* @var string
*/
protected $mailer = '';
/**
* URL to make an API request to.
*
* @since 1.0.0
*
* @var string
*/
protected $url = '';
/**
* @since 1.0.0
*
* @var array
*/
protected $headers = array();
/**
* @since 1.0.0
*
* @var array
*/
protected $body = array();
/**
* @since 1.0.0
*
* @var mixed
*/
protected $response = array();
/**
* The error message recorded when email sending failed and the error can't be processed from the API response.
*
* @since 2.5.0
*
* @var string
*/
protected $error_message = '';
/**
* Should the email sent by this mailer have its "sent status" verified via its API?
*
* @since 2.5.0
*
* @var bool
*/
protected $verify_sent_status = false;
/**
* Mailer constructor.
*
* @since 1.0.0
*
* @param MailCatcherInterface $phpmailer The MailCatcher object.
*/
public function __construct( MailCatcherInterface $phpmailer ) {
$this->options = new Options();
$this->mailer = $this->options->get( 'mail', 'mailer' );
// Only non-SMTP mailers need URL and extra processing for PHPMailer class.
if ( ! $this->options->is_mailer_smtp() && empty( $this->url ) ) {
return;
}
$this->process_phpmailer( $phpmailer );
}
/**
* Re-use the MailCatcher class methods and properties.
*
* @since 1.0.0
*
* @param MailCatcherInterface $phpmailer The MailCatcher object.
*/
public function process_phpmailer( $phpmailer ) {
// Make sure that we have access to PHPMailer class methods.
if ( ! wp_mail_smtp()->is_valid_phpmailer( $phpmailer ) ) {
return;
}
$this->phpmailer = $phpmailer;
// Prevent working with those methods, as they are not needed for SMTP-like mailers.
if ( $this->options->is_mailer_smtp() ) {
return;
}
$this->set_headers( $this->phpmailer->getCustomHeaders() );
$this->set_from( $this->phpmailer->From, $this->phpmailer->FromName );
$this->set_recipients(
array(
'to' => $this->phpmailer->getToAddresses(),
'cc' => $this->phpmailer->getCcAddresses(),
'bcc' => $this->phpmailer->getBccAddresses(),
)
);
$this->set_subject( $this->phpmailer->Subject );
if ( $this->phpmailer->ContentType === 'text/plain' ) {
$this->set_content( $this->phpmailer->Body );
} else {
$this->set_content(
array(
'text' => $this->phpmailer->AltBody,
'html' => $this->phpmailer->Body,
)
);
}
$this->set_return_path( $this->phpmailer->From );
$this->set_reply_to( $this->phpmailer->getReplyToAddresses() );
/*
* In some cases we will need to modify the internal structure
* of the body content, if attachments are present.
* So lets make this call the last one.
*/
$this->set_attachments( $this->phpmailer->getAttachments() );
}
/**
* Set the email headers.
*
* @since 1.0.0
*
* @param array $headers List of key=>value pairs.
*/
public function set_headers( $headers ) {
foreach ( $headers as $header ) {
$name = isset( $header[0] ) ? $header[0] : false;
$value = isset( $header[1] ) ? $header[1] : false;
if ( empty( $name ) || empty( $value ) ) {
continue;
}
$this->set_header( $name, $value );
}
}
/**
* Set individual header key=>value pair for the email.
*
* @since 1.0.0
*
* @param string $name
* @param string $value
*/
public function set_header( $name, $value ) {
$name = sanitize_text_field( $name );
$this->headers[ $name ] = WP::sanitize_value( $value );
}
/**
* Set email subject.
*
* @since 1.0.0
*
* @param string $subject
*/
public function set_subject( $subject ) {
$this->set_body_param(
array(
'subject' => $subject,
)
);
}
/**
* Set the request params, that goes to the body of the HTTP request.
*
* @since 1.0.0
*
* @param array $param Key=>value of what should be sent to a 3rd party API.
*
* @internal param array $params
*/
protected function set_body_param( $param ) {
$this->body = Options::array_merge_recursive( $this->body, $param );
}
/**
* Get the email body.
*
* @since 1.0.0
*
* @return string|array
*/
public function get_body() {
return apply_filters( 'wp_mail_smtp_providers_mailer_get_body', $this->body, $this->mailer );
}
/**
* Get the email headers.
*
* @since 1.0.0
*
* @return array
*/
public function get_headers() {
return apply_filters( 'wp_mail_smtp_providers_mailer_get_headers', $this->headers, $this->mailer );
}
/**
* Send the email.
*
* @since 1.0.0
* @since 1.8.0 Added timeout for requests, same as max_execution_time.
*/
public function send() {
$timeout = (int) ini_get( 'max_execution_time' );
$params = Options::array_merge_recursive(
$this->get_default_params(),
array(
'headers' => $this->get_headers(),
'body' => $this->get_body(),
'timeout' => $timeout ? $timeout : 30,
)
);
$response = wp_safe_remote_post( $this->url, $params );
$this->process_response( $response );
}
/**
* We might need to do something after the email was sent to the API.
* In this method we preprocess the response from the API.
*
* @since 1.0.0
*
* @param mixed $response
*/
protected function process_response( $response ) {
if ( is_wp_error( $response ) ) {
// Save the error text.
$errors = $response->get_error_messages();
foreach ( $errors as $error ) {
$this->error_message .= $error . PHP_EOL;
}
return;
}
if ( isset( $response['body'] ) && WP::is_json( $response['body'] ) ) {
$response['body'] = \json_decode( $response['body'] );
}
$this->response = $response;
}
/**
* Get the default params, required for wp_safe_remote_post().
*
* @since 1.0.0
*
* @return array
*/
protected function get_default_params() {
return apply_filters(
'wp_mail_smtp_providers_mailer_get_default_params',
array(
'timeout' => 15,
'httpversion' => '1.1',
'blocking' => true,
),
$this->mailer
);
}
/**
* Whether the email is sent or not.
* We basically check the response code from a request to provider.
* Might not be 100% correct, not guarantees that email is delivered.
*
* @since 1.0.0
*
* @return bool
*/
public function is_email_sent() {
$is_sent = false;
if ( wp_remote_retrieve_response_code( $this->response ) === $this->email_sent_code ) {
$is_sent = true;
} else {
$error = $this->get_response_error();
if ( ! empty( $error ) ) {
// Add mailer to the beginning and save to display later.
$message = 'Mailer: ' . esc_html( wp_mail_smtp()->get_providers()->get_options( $this->mailer )->get_title() ) . "\r\n";
$conflicts = new Conflicts();
if ( $conflicts->is_detected() ) {
$message .= 'Conflicts: ' . esc_html( $conflicts->get_conflict_name() ) . "\r\n";
}
Debug::set( $message . $error );
}
}
// Clear debug messages if email is successfully sent.
if ( $is_sent ) {
Debug::clear();
}
return apply_filters( 'wp_mail_smtp_providers_mailer_is_email_sent', $is_sent, $this->mailer );
}
/**
* The error message when email sending failed.
* Should be overwritten when appropriate.
*
* @since 1.2.0
* @since 2.5.0 Return a non-empty error_message attribute.
*
* @return string
*/
public function get_response_error() {
return ! empty( $this->error_message ) ? $this->error_message : '';
}
/**
* Whether the mailer supports the current PHP version or not.
*
* @since 1.0.0
*
* @return bool
*/
public function is_php_compatible() {
$options = wp_mail_smtp()->get_providers()->get_options( $this->mailer );
return version_compare( phpversion(), $options->get_php_version(), '>=' );
}
/**
* This method is relevant to SMTP and Pepipost.
* All other custom mailers should override it with own information.
*
* @since 1.2.0
*
* @return string
*/
public function get_debug_info() {
global $phpmailer;
$smtp_text = array();
// Mail mailer has nothing to return.
if ( $this->options->is_mailer_smtp() ) {
// phpcs:disable
$smtp_text[] = '<strong>ErrorInfo:</strong> ' . make_clickable( wp_strip_all_tags( $phpmailer->ErrorInfo ) );
$smtp_text[] = '<strong>Host:</strong> ' . $phpmailer->Host;
$smtp_text[] = '<strong>Port:</strong> ' . $phpmailer->Port;
$smtp_text[] = '<strong>SMTPSecure:</strong> ' . Debug::pvar( $phpmailer->SMTPSecure );
$smtp_text[] = '<strong>SMTPAutoTLS:</strong> ' . Debug::pvar( $phpmailer->SMTPAutoTLS );
$smtp_text[] = '<strong>SMTPAuth:</strong> ' . Debug::pvar( $phpmailer->SMTPAuth );
if ( ! empty( $phpmailer->SMTPOptions ) ) {
$smtp_text[] = '<strong>SMTPOptions:</strong> <code>' . wp_json_encode( $phpmailer->SMTPOptions ) . '</code>';
}
// phpcs:enable
}
$smtp_text[] = '<br><strong>Server:</strong>';
$smtp_text[] = '<strong>OpenSSL:</strong> ' . ( extension_loaded( 'openssl' ) && defined( 'OPENSSL_VERSION_TEXT' ) ? OPENSSL_VERSION_TEXT : 'No' );
if ( function_exists( 'apache_get_modules' ) ) {
$modules = apache_get_modules();
$smtp_text[] = '<strong>Apache.mod_security:</strong> ' . ( in_array( 'mod_security', $modules, true ) || in_array( 'mod_security2', $modules, true ) ? 'Yes' : 'No' );
}
if ( function_exists( 'selinux_is_enabled' ) ) {
$smtp_text[] = '<strong>OS.SELinux:</strong> ' . ( selinux_is_enabled() ? 'Yes' : 'No' );
}
if ( function_exists( 'grsecurity_is_enabled' ) ) {
$smtp_text[] = '<strong>OS.grsecurity:</strong> ' . ( grsecurity_is_enabled() ? 'Yes' : 'No' );
}
return implode( '<br>', $smtp_text );
}
/**
* Get the email addresses for the reply to email parameter.
*
* @deprecated 2.1.1
*
* @since 2.1.0
* @since 2.1.1 Not used anymore.
*
* @return array
*/
public function get_reply_to_addresses() {
_deprecated_function( __CLASS__ . '::' . __METHOD__, '2.1.1 of WP Mail SMTP plugin' );
$reply_to = $this->phpmailer->getReplyToAddresses();
// Return the passed reply to addresses, if defined.
if ( ! empty( $reply_to ) ) {
return $reply_to;
}
// Return the default reply to addresses.
return apply_filters(
'wp_mail_smtp_providers_mailer_default_reply_to_addresses',
$this->default_reply_to_addresses()
);
}
/**
* Get the default email addresses for the reply to email parameter.
*
* @deprecated 2.1.1
*
* @since 2.1.0
* @since 2.1.1 Not used anymore.
*
* @return array
*/
public function default_reply_to_addresses() {
_deprecated_function( __CLASS__ . '::' . __METHOD__, '2.1.1 of WP Mail SMTP plugin' );
return [
$this->phpmailer->From => [
$this->phpmailer->From,
$this->phpmailer->FromName,
],
];
}
/**
* Should the email sent by this mailer have its "sent status" verified via its API?
*
* @since 2.5.0
*
* @return bool
*/
public function should_verify_sent_status() {
return $this->verify_sent_status;
}
/**
* Verify the "sent status" of the provided email log ID.
* The actual verification background task is triggered in the below action hook.
*
* @since 2.5.0
*
* @param int $email_log_id The ID of the email log.
*/
public function verify_sent_status( $email_log_id ) {
if ( ! $this->should_verify_sent_status() ) {
return;
}
do_action( 'wp_mail_smtp_providers_mailer_verify_sent_status', $email_log_id, $this );
}
/**
* Get the name/slug of the current mailer.
*
* @since 2.5.0
*
* @return string
*/
public function get_mailer_name() {
return $this->mailer;
}
}

View File

@ -1,86 +0,0 @@
<?php
namespace WPMailSMTP\Providers;
use WPMailSMTP\MailCatcher;
use WPMailSMTP\MailCatcherV6;
/**
* Interface MailerInterface.
*
* @since 1.0.0
*/
interface MailerInterface {
/**
* Send the email.
*
* @since 1.0.0
*/
public function send();
/**
* Whether the email is sent or not.
* We basically check the response code from a request to provider.
* Might not be 100% correct, not guarantees that email is delivered.
*
* @since 1.0.0
*
* @return bool
*/
public function is_email_sent();
/**
* Whether the mailer supports the current PHP version or not.
*
* @since 1.0.0
*
* @return bool
*/
public function is_php_compatible();
/**
* Whether the mailer has all its settings correctly set up and saved.
*
* @since 1.4.0
*
* @return bool
*/
public function is_mailer_complete();
/**
* Get the email body.
*
* @since 1.0.0
*
* @return string|array
*/
public function get_body();
/**
* Get the email headers.
*
* @since 1.0.0
*
* @return array
*/
public function get_headers();
/**
* Get an array of all debug information relevant to the mailer.
*
* @since 1.2.0
*
* @return array
*/
public function get_debug_info();
/**
* Re-use the MailCatcher class methods and properties.
*
* @since 1.2.0
*
* @param MailCatcherInterface $phpmailer The MailCatcher object.
*/
public function process_phpmailer( $phpmailer );
}

View File

@ -1,490 +0,0 @@
<?php
namespace WPMailSMTP\Providers\Mailgun;
use WPMailSMTP\Debug;
use WPMailSMTP\Providers\MailerAbstract;
use WPMailSMTP\WP;
/**
* Class Mailer.
*
* @since 1.0.0
*/
class Mailer extends MailerAbstract {
/**
* Which response code from HTTP provider is considered to be successful?
*
* @since 1.0.0
*
* @var int
*/
protected $email_sent_code = 200;
/**
* API endpoint used for sites from all regions.
*
* @since 1.4.0
*
* @var string
*/
const API_BASE_US = 'https://api.mailgun.net/v3/';
/**
* API endpoint used for sites from EU region.
*
* @since 1.4.0
*
* @var string
*/
const API_BASE_EU = 'https://api.eu.mailgun.net/v3/';
/**
* URL to make an API request to.
*
* @since 1.0.0
*
* @var string
*/
protected $url = '';
/**
* @inheritdoc
*/
public function __construct( $phpmailer ) {
// Default value should be defined before the parent class contructor fires.
$this->url = self::API_BASE_US;
// We want to prefill everything from MailCatcher class, which extends PHPMailer.
parent::__construct( $phpmailer );
// We have a special API URL to query in case of EU region.
if ( 'EU' === $this->options->get( $this->mailer, 'region' ) ) {
$this->url = self::API_BASE_EU;
}
/*
* Append the url with a domain,
* to avoid passing the domain name as a query parameter with all requests.
*/
$this->url .= sanitize_text_field( $this->options->get( $this->mailer, 'domain' ) . '/messages' );
$this->set_header( 'Authorization', 'Basic ' . base64_encode( 'api:' . $this->options->get( $this->mailer, 'api_key' ) ) );
}
/**
* @inheritdoc
*/
public function set_from( $email, $name = '' ) {
if ( ! filter_var( $email, FILTER_VALIDATE_EMAIL ) ) {
return;
}
if ( ! empty( $name ) ) {
$this->set_body_param(
array(
'from' => $name . ' <' . $email . '>',
)
);
} else {
$this->set_body_param(
array(
'from' => $email,
)
);
}
}
/**
* @inheritdoc
*/
public function set_recipients( $recipients ) {
if ( empty( $recipients ) ) {
return;
}
$default = array( 'to', 'cc', 'bcc' );
foreach ( $recipients as $kind => $emails ) {
if (
! in_array( $kind, $default, true ) ||
empty( $emails ) ||
! is_array( $emails )
) {
continue;
}
$data = array();
foreach ( $emails as $email ) {
$addr = isset( $email[0] ) ? $email[0] : false;
$name = isset( $email[1] ) ? $email[1] : false;
if ( ! filter_var( $addr, FILTER_VALIDATE_EMAIL ) ) {
continue;
}
if ( ! empty( $name ) ) {
$data[] = $name . ' <' . $addr . '>';
} else {
$data[] = $addr;
}
}
if ( ! empty( $data ) ) {
$this->set_body_param(
array(
$kind => implode( ', ', $data ),
)
);
}
}
}
/**
* @inheritdoc
*/
public function set_content( $content ) {
if ( is_array( $content ) ) {
$default = array( 'text', 'html' );
foreach ( $content as $type => $mail ) {
if (
! in_array( $type, $default, true ) ||
empty( $mail )
) {
continue;
}
$this->set_body_param(
array(
$type => $mail,
)
);
}
} else {
$type = 'html';
if ( $this->phpmailer->ContentType === 'text/plain' ) {
$type = 'text';
}
if ( ! empty( $content ) ) {
$this->set_body_param(
array(
$type => $content,
)
);
}
}
}
/**
* Redefine the way custom headers are process for this mailer - they should be in body.
*
* @since 1.5.0
*
* @param array $headers
*/
public function set_headers( $headers ) {
foreach ( $headers as $header ) {
$name = isset( $header[0] ) ? $header[0] : false;
$value = isset( $header[1] ) ? $header[1] : false;
$this->set_body_header( $name, $value );
}
// Add custom PHPMailer-specific header.
$this->set_body_header( 'X-Mailer', 'WPMailSMTP/Mailer/' . $this->mailer . ' ' . WPMS_PLUGIN_VER );
}
/**
* This mailer supports email-related custom headers inside a body of the message with a special prefix "h:".
*
* @since 1.5.0
*/
public function set_body_header( $name, $value ) {
$name = sanitize_text_field( $name );
$this->set_body_param(
array(
'h:' . $name => WP::sanitize_value( $value ),
)
);
}
/**
* It's the last one, so we can modify the whole body.
*
* @since 1.0.0
*
* @param array $attachments The array of attachments data.
*/
public function set_attachments( $attachments ) {
if ( empty( $attachments ) ) {
return;
}
$payload = '';
$data = array();
foreach ( $attachments as $attachment ) {
$file = false;
/*
* We are not using WP_Filesystem API as we can't reliably work with it.
* It is not always available, same as credentials for FTP.
*/
try {
if ( is_file( $attachment[0] ) && is_readable( $attachment[0] ) ) {
$file = file_get_contents( $attachment[0] );
}
} catch ( \Exception $e ) {
$file = false;
}
if ( $file === false ) {
continue;
}
$data[] = array(
'content' => $file,
'name' => $attachment[2],
);
}
if ( ! empty( $data ) ) {
// First, generate a boundary for the multipart message.
$boundary = $this->phpmailer->generate_id();
// Iterate through pre-built params and build a payload.
foreach ( $this->body as $key => $value ) {
if ( is_array( $value ) ) {
foreach ( $value as $child_key => $child_value ) {
$payload .= '--' . $boundary;
$payload .= "\r\n";
$payload .= 'Content-Disposition: form-data; name="' . $key . "\"\r\n\r\n";
$payload .= $child_value;
$payload .= "\r\n";
}
} else {
$payload .= '--' . $boundary;
$payload .= "\r\n";
$payload .= 'Content-Disposition: form-data; name="' . $key . '"' . "\r\n\r\n";
$payload .= $value;
$payload .= "\r\n";
}
}
// Now iterate through our attachments, and add them too.
foreach ( $data as $key => $attachment ) {
$payload .= '--' . $boundary;
$payload .= "\r\n";
$payload .= 'Content-Disposition: form-data; name="attachment[' . $key . ']"; filename="' . $attachment['name'] . '"' . "\r\n\r\n";
$payload .= $attachment['content'];
$payload .= "\r\n";
}
$payload .= '--' . $boundary . '--';
// Redefine the body the "dirty way".
$this->body = $payload;
$this->set_header( 'Content-Type', 'multipart/form-data; boundary=' . $boundary );
}
}
/**
* @inheritdoc
*/
public function set_reply_to( $reply_to ) {
if ( empty( $reply_to ) ) {
return;
}
$data = array();
foreach ( $reply_to as $key => $emails ) {
if (
empty( $emails ) ||
! is_array( $emails )
) {
continue;
}
$addr = isset( $emails[0] ) ? $emails[0] : false;
$name = isset( $emails[1] ) ? $emails[1] : false;
if ( ! filter_var( $addr, FILTER_VALIDATE_EMAIL ) ) {
continue;
}
if ( ! empty( $name ) ) {
$data[] = $name . ' <' . $addr . '>';
} else {
$data[] = $addr;
}
}
if ( ! empty( $data ) ) {
$this->set_body_param(
array(
'h:Reply-To' => implode( ',', $data ),
)
);
}
}
/**
* @inheritdoc
*/
public function set_return_path( $email ) {
if (
$this->options->get( 'mail', 'return_path' ) !== true ||
! filter_var( $email, FILTER_VALIDATE_EMAIL )
) {
return;
}
$this->set_body_param(
array(
'sender' => $email,
)
);
}
/**
* We might need to do something after the email was sent to the API.
* In this method we preprocess the response from the API.
*
* @since 2.5.0
*
* @param mixed $response Response data.
*/
protected function process_response( $response ) {
parent::process_response( $response );
if (
! is_wp_error( $response ) &&
! empty( $this->response['body']->id )
) {
$this->phpmailer->MessageID = $this->response['body']->id;
$this->verify_sent_status = true;
}
}
/**
* Whether the email is sent or not.
* We basically check the response code from a request to provider.
* Might not be 100% correct, not guarantees that email is delivered.
*
* In Mailgun's case it looks like we have to check if the response body has the message ID.
* All successful API responses should have `id` key in the response body.
*
* @since 2.2.0
*
* @return bool
*/
public function is_email_sent() {
$is_sent = parent::is_email_sent();
if (
$is_sent &&
isset( $this->response['body'] ) &&
! array_key_exists( 'id', (array) $this->response['body'] )
) {
$message = 'Mailer: Mailgun' . PHP_EOL .
esc_html__( 'Mailgun API request was successful, but it could not queue the email for delivery.', 'wp-mail-smtp' ) . PHP_EOL .
esc_html__( 'This could point to an incorrect Domain Name in the plugin settings.', 'wp-mail-smtp' ) . PHP_EOL .
esc_html__( 'Please check the WP Mail SMTP plugin settings and make sure the Mailgun Domain Name setting is correct.', 'wp-mail-smtp' );
$this->error_message = $message;
Debug::set( $message );
return false;
}
return $is_sent;
}
/**
* Get a Mailgun-specific response with a helpful error.
*
* @since 1.2.0
*
* @return string
*/
public function get_response_error() {
$body = (array) wp_remote_retrieve_body( $this->response );
$error_text = array();
if ( ! empty( $body['message'] ) ) {
if ( is_string( $body['message'] ) ) {
$error_text[] = $body['message'];
} else {
$error_text[] = \json_encode( $body['message'] );
}
} elseif ( ! empty( $this->error_message ) ) {
$error_text[] = $this->error_message;
} elseif ( ! empty( $body[0] ) ) {
if ( is_string( $body[0] ) ) {
$error_text[] = $body[0];
} else {
$error_text[] = \json_encode( $body[0] );
}
}
return implode( '<br>', array_map( 'esc_textarea', $error_text ) );
}
/**
* @inheritdoc
*/
public function get_debug_info() {
$mg_text = array();
$options = new \WPMailSMTP\Options();
$mailgun = $options->get_group( 'mailgun' );
$mg_text[] = '<strong>Api Key / Domain:</strong> ' . ( ! empty( $mailgun['api_key'] ) && ! empty( $mailgun['domain'] ) ? 'Yes' : 'No' );
return implode( '<br>', $mg_text );
}
/**
* @inheritdoc
*/
public function is_mailer_complete() {
$options = $this->options->get_group( $this->mailer );
// API key is the only required option.
if (
! empty( $options['api_key'] ) &&
! empty( $options['domain'] )
) {
return true;
}
return false;
}
}

View File

@ -1,161 +0,0 @@
<?php
namespace WPMailSMTP\Providers\Mailgun;
use WPMailSMTP\Providers\OptionsAbstract;
/**
* Class Option.
*
* @since 1.0.0
*/
class Options extends OptionsAbstract {
/**
* Mailgun constructor.
*
* @since 1.0.0
*/
public function __construct() {
parent::__construct(
array(
'logo_url' => wp_mail_smtp()->assets_url . '/images/providers/mailgun.svg',
'slug' => 'mailgun',
'title' => esc_html__( 'Mailgun', 'wp-mail-smtp' ),
'description' => sprintf(
wp_kses(
/* translators: %1$s - opening link tag; %2$s - closing link tag; %3$s - opening link tag; %4$s - closing link tag. */
__( '%1$sMailgun%2$s is one of the leading transactional email services trusted by over 150,000+ businesses. They provide 5,000 free emails per month for 3 months.<br><br>Read our %3$sMailgun documentation%4$s to learn how to configure Mailgun and improve your email deliverability.', 'wp-mail-smtp' ),
array(
'br' => array(),
'a' => array(
'href' => array(),
'rel' => array(),
'target' => array(),
),
)
),
'<a href="https://www.mailgun.com" target="_blank" rel="noopener noreferrer">',
'</a>',
'<a href="https://wpmailsmtp.com/docs/how-to-set-up-the-mailgun-mailer-in-wp-mail-smtp/" target="_blank" rel="noopener noreferrer">',
'</a>'
),
)
);
}
/**
* @inheritdoc
*/
public function display_options() {
?>
<!-- API Key -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-api_key" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"><?php esc_html_e( 'Private API Key', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<?php if ( $this->options->is_const_defined( $this->get_slug(), 'api_key' ) ) : ?>
<input type="text" disabled value="****************************************"
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"
/>
<?php $this->display_const_set_message( 'WPMS_MAILGUN_API_KEY' ); ?>
<?php else : ?>
<input type="password" spellcheck="false"
name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][api_key]"
value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'api_key' ) ); ?>"
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"
/>
<?php endif; ?>
<p class="desc">
<?php
printf(
/* translators: %s - API key link. */
esc_html__( 'Follow this link to get an API Key from Mailgun: %s.', 'wp-mail-smtp' ),
'<a href="https://app.mailgun.com/app/account/security/api_keys" target="_blank" rel="noopener noreferrer">' .
esc_html__( 'Get a Private API Key', 'wp-mail-smtp' ) .
'</a>'
);
?>
</p>
</div>
</div>
<!-- Domain -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-domain" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-domain"><?php esc_html_e( 'Domain Name', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][domain]" type="text"
value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'domain' ) ); ?>"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'domain' ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-domain" spellcheck="false"
/>
<p class="desc">
<?php
printf(
/* translators: %s - Domain Name link. */
esc_html__( 'Follow this link to get a Domain Name from Mailgun: %s.', 'wp-mail-smtp' ),
'<a href="https://app.mailgun.com/app/domains" target="_blank" rel="noopener noreferrer">' .
esc_html__( 'Get a Domain Name', 'wp-mail-smtp' ) .
'</a>'
);
?>
</p>
</div>
</div>
<!-- Region -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-region" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-radio wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label><?php esc_html_e( 'Region', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-region-us">
<input type="radio" id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-region-us"
name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][region]" value="US"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'region' ) ? 'disabled' : ''; ?>
<?php checked( 'US', $this->options->get( $this->get_slug(), 'region' ) ); ?>
/>
<?php esc_html_e( 'US', 'wp-mail-smtp' ); ?>
</label>
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-region-eu">
<input type="radio" id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-region-eu"
name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][region]" value="EU"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'region' ) ? 'disabled' : ''; ?>
<?php checked( 'EU', $this->options->get( $this->get_slug(), 'region' ) ); ?>
/>
<?php esc_html_e( 'EU', 'wp-mail-smtp' ); ?>
</label>
<p class="desc">
<?php esc_html_e( 'Define which endpoint you want to use for sending messages.', 'wp-mail-smtp' ); ?><br>
<?php esc_html_e( 'If you are operating under EU laws, you may be required to use EU region.', 'wp-mail-smtp' ); ?>
<?php
printf(
wp_kses(
/* translators: %s - URL to Mailgun.com page. */
__( '<a href="%s" rel="" target="_blank">More information</a> on Mailgun.com.', 'wp-mail-smtp' ),
array(
'a' => array(
'href' => array(),
'rel' => array(),
'target' => array(),
),
)
),
'https://www.mailgun.com/regions'
);
?>
</p>
</div>
</div>
<?php
}
}

View File

@ -1,518 +0,0 @@
<?php
namespace WPMailSMTP\Providers;
use WPMailSMTP\Options;
/**
* Abstract Class ProviderAbstract to contain common providers functionality.
*
* @since 1.0.0
*/
abstract class OptionsAbstract implements OptionsInterface {
/**
* @var string
*/
private $logo_url = '';
/**
* @var string
*/
private $slug = '';
/**
* @var string
*/
private $title = '';
/**
* @var string
*/
private $description = '';
/**
* @since 1.6.0
*
* @var array
*/
private $notices = array();
/**
* @since 1.6.0
*
* @var bool
*/
private $recommended = false;
/**
* @since 1.7.0
*
* @var bool
*/
private $disabled = false;
/**
* @var string
*/
private $php = WPMS_PHP_VER;
/**
* @var Options
*/
protected $options;
/**
* An array with mailer supported setting fields.
*
* @since 2.3.0
*
* @var array
*/
protected $supports;
/**
* ProviderAbstract constructor.
*
* @since 1.0.0
* @since 2.3.0 Added supports parameter.
*
* @param array $params The mailer options parameters.
*/
public function __construct( $params ) {
if (
empty( $params['slug'] ) ||
empty( $params['title'] )
) {
return;
}
$this->slug = sanitize_key( $params['slug'] );
$this->title = sanitize_text_field( $params['title'] );
if ( ! empty( $params['description'] ) ) {
$this->description = wp_kses_post( $params['description'] );
}
if ( ! empty( $params['notices'] ) ) {
foreach ( (array) $params['notices'] as $key => $notice ) {
$key = sanitize_key( $key );
if ( empty( $key ) ) {
continue;
}
$notice = wp_kses(
$notice,
array(
'br' => true,
'strong' => true,
'em' => true,
'a' => array(
'href' => true,
'rel' => true,
'target' => true,
),
)
);
if ( empty( $notice ) ) {
continue;
}
$this->notices[ $key ] = $notice;
}
}
if ( isset( $params['recommended'] ) ) {
$this->recommended = (bool) $params['recommended'];
}
if ( isset( $params['disabled'] ) ) {
$this->disabled = (bool) $params['disabled'];
}
if ( ! empty( $params['php'] ) ) {
$this->php = sanitize_text_field( $params['php'] );
}
if ( ! empty( $params['logo_url'] ) ) {
$this->logo_url = esc_url_raw( $params['logo_url'] );
}
$this->supports = ( ! empty( $params['supports'] ) ) ? $params['supports'] : $this->get_supports_defaults();
$this->options = new Options();
}
/**
* @inheritdoc
*/
public function get_logo_url() {
return apply_filters( 'wp_mail_smtp_providers_provider_get_logo_url', $this->logo_url, $this );
}
/**
* @inheritdoc
*/
public function get_slug() {
return apply_filters( 'wp_mail_smtp_providers_provider_get_slug', $this->slug, $this );
}
/**
* @inheritdoc
*/
public function get_title() {
return apply_filters( 'wp_mail_smtp_providers_provider_get_title', $this->title, $this );
}
/**
* @inheritdoc
*/
public function get_description() {
return apply_filters( 'wp_mail_smtp_providers_provider_get_description', $this->description, $this );
}
/**
* Some mailers may display a notice above its options.
*
* @since 1.6.0
*
* @param string $type
*
* @return string
*/
public function get_notice( $type ) {
$type = sanitize_key( $type );
return apply_filters( 'wp_mail_smtp_providers_provider_get_notice', isset( $this->notices[ $type ] ) ? $this->notices[ $type ] : '', $this );
}
/**
* @inheritdoc
*/
public function get_php_version() {
return apply_filters( 'wp_mail_smtp_providers_provider_get_php_version', $this->php, $this );
}
/**
* @inheritdoc
*/
public function display_options() {
?>
<!-- SMTP Host -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-host" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-host"><?php esc_html_e( 'SMTP Host', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][host]" type="text"
value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'host' ) ); ?>"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'host' ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-host" spellcheck="false"
/>
</div>
</div>
<!-- SMTP Encryption -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-encryption" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-radio wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label><?php esc_html_e( 'Encryption', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-enc-none">
<input type="radio" id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-enc-none"
name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][encryption]" value="none"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'encryption' ) ? 'disabled' : ''; ?>
<?php checked( 'none', $this->options->get( $this->get_slug(), 'encryption' ) ); ?>
/>
<?php esc_html_e( 'None', 'wp-mail-smtp' ); ?>
</label>
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-enc-ssl">
<input type="radio" id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-enc-ssl"
name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][encryption]" value="ssl"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'encryption' ) ? 'disabled' : ''; ?>
<?php checked( 'ssl', $this->options->get( $this->get_slug(), 'encryption' ) ); ?>
/>
<?php esc_html_e( 'SSL', 'wp-mail-smtp' ); ?>
</label>
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-enc-tls">
<input type="radio" id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-enc-tls"
name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][encryption]" value="tls"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'encryption' ) ? 'disabled' : ''; ?>
<?php checked( 'tls', $this->options->get( $this->get_slug(), 'encryption' ) ); ?>
/>
<?php esc_html_e( 'TLS', 'wp-mail-smtp' ); ?>
</label>
<p class="desc">
<?php esc_html_e( 'For most servers TLS is the recommended option. If your SMTP provider offers both SSL and TLS options, we recommend using TLS.', 'wp-mail-smtp' ); ?>
</p>
</div>
</div>
<!-- SMTP Port -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-port" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-number wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-port"><?php esc_html_e( 'SMTP Port', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][port]" type="number"
value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'port' ) ); ?>"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'port' ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-port" class="small-text" spellcheck="false"
/>
</div>
</div>
<!-- PHPMailer SMTPAutoTLS -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-autotls" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox-toggle wp-mail-smtp-clear <?php echo $this->options->is_const_defined( $this->get_slug(), 'encryption' ) || 'tls' === $this->options->get( $this->get_slug(), 'encryption' ) ? 'inactive' : ''; ?>">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-autotls"><?php esc_html_e( 'Auto TLS', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-autotls">
<input type="checkbox" id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-autotls"
name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][autotls]" value="yes"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'autotls' ) ? 'disabled' : ''; ?>
<?php checked( true, (bool) $this->options->get( $this->get_slug(), 'autotls' ) ); ?>
/>
<span class="wp-mail-smtp-setting-toggle-switch"></span>
<span class="wp-mail-smtp-setting-toggle-checked-label"><?php esc_html_e( 'On', 'wp-mail-smtp' ); ?></span>
<span class="wp-mail-smtp-setting-toggle-unchecked-label"><?php esc_html_e( 'Off', 'wp-mail-smtp' ); ?></span>
</label>
<p class="desc">
<?php esc_html_e( 'By default TLS encryption is automatically used if the server supports it, which is recommended. In some cases, due to server misconfigurations, this can cause issues and may need to be disabled.', 'wp-mail-smtp' ); ?>
</p>
</div>
</div>
<!-- SMTP Authentication -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-auth" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox-toggle wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-auth"><?php esc_html_e( 'Authentication', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-auth">
<input type="checkbox" id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-auth"
name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][auth]" value="yes"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'auth' ) ? 'disabled' : ''; ?>
<?php checked( true, (bool) $this->options->get( $this->get_slug(), 'auth' ) ); ?>
/>
<span class="wp-mail-smtp-setting-toggle-switch"></span>
<span class="wp-mail-smtp-setting-toggle-checked-label"><?php esc_html_e( 'On', 'wp-mail-smtp' ); ?></span>
<span class="wp-mail-smtp-setting-toggle-unchecked-label"><?php esc_html_e( 'Off', 'wp-mail-smtp' ); ?></span>
</label>
</div>
</div>
<!-- SMTP Username -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-user" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear <?php echo ! $this->options->is_const_defined( $this->get_slug(), 'auth' ) && ! $this->options->get( $this->get_slug(), 'auth' ) ? 'inactive' : ''; ?>">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-user"><?php esc_html_e( 'SMTP Username', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][user]" type="text"
value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'user' ) ); ?>"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'user' ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-user" spellcheck="false" autocomplete="new-password"
/>
</div>
</div>
<!-- SMTP Password -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-pass" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-password wp-mail-smtp-clear <?php echo ! $this->options->is_const_defined( $this->get_slug(), 'auth' ) && ! $this->options->get( $this->get_slug(), 'auth' ) ? 'inactive' : ''; ?>">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-pass"><?php esc_html_e( 'SMTP Password', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<?php if ( $this->options->is_const_defined( $this->get_slug(), 'pass' ) ) : ?>
<input type="text" value="*************" disabled id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-pass"/>
<?php $this->display_const_set_message( 'WPMS_SMTP_PASS' ); ?>
<p class="desc">
<?php
printf(
/* translators: %s - constant name: WPMS_SMTP_PASS. */
esc_html__( 'To change the password you need to change the value of the constant there: %s', 'wp-mail-smtp' ),
'<code>define( \'WPMS_SMTP_PASS\', \'your_old_password\' );</code>'
);
?>
<br>
<?php
printf(
/* translators: %1$s - wp-config.php file, %2$s - WPMS_ON constant name. */
esc_html__( 'If you want to disable the use of constants, find in %1$s file the constant %2$s and turn if off:', 'wp-mail-smtp' ),
'<code>wp-config.php</code>',
'<code>WPMS_ON</code>'
);
?>
</p>
<pre>
define( 'WPMS_ON', false );
</pre>
<p class="desc">
<?php esc_html_e( 'All the defined constants will stop working and you will be able to change all the values on this page.', 'wp-mail-smtp' ); ?>
</p>
<?php else : ?>
<input name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][pass]" type="password"
value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'pass' ) ); ?>"
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-pass" spellcheck="false" autocomplete="new-password"
/>
<p class="desc">
<?php esc_html_e( 'The password is encrypted in the database, but for improved security we recommend using your site\'s WordPress configuration file to set your password.', 'wp-mail-smtp' ); ?>
<br>
<a href="https://wpmailsmtp.com/docs/how-to-secure-smtp-settings-by-using-constants/" target="_blank" rel="noopener noreferrer">
<strong><?php esc_html_e( 'Learn More', 'wp-mail-smtp' ); ?></strong>
</a>
</p>
<?php endif; ?>
</div>
</div>
<?php
}
/**
* Whether this mailer is recommended or not.
*
* @since 1.6.0
*
* @return bool
*/
public function is_recommended() {
return (bool) apply_filters( 'wp_mail_smtp_providers_provider_is_recommended', $this->recommended, $this );
}
/**
* Whether this mailer is disabled or not.
* Used for displaying Pro mailers inside Lite plugin.
*
* @since 1.7.0
*
* @return bool
*/
public function is_disabled() {
return (bool) apply_filters( 'wp_mail_smtp_providers_provider_is_disabled', $this->disabled, $this );
}
/**
* Check whether we can use this provider based on the PHP version.
* Valid for those, that use SDK.
*
* @since 1.0.0
*
* @return bool
*/
public function is_php_correct() {
return version_compare( phpversion(), $this->php, '>=' );
}
/**
* Display a helpful message to those users, that are using an outdated version of PHP,
* which is not supported by the currently selected Provider.
*
* @since 1.0.0
*/
protected function display_php_warning() {
?>
<blockquote>
<?php
printf(
/* translators: %1$s - Provider name; %2$s - PHP version required by Provider; %3$s - current PHP version. */
esc_html__( '%1$s requires PHP %2$s to work and does not support your current PHP version %3$s. Please contact your host and request a PHP upgrade to the latest one.', 'wp-mail-smtp' ),
esc_html( $this->get_title() ),
esc_html( $this->php ),
esc_html( phpversion() )
);
?>
<br>
<?php esc_html_e( 'Meanwhile you can switch to some other mailers.', 'wp-mail-smtp' ); ?>
</blockquote>
<?php
}
/**
* Display a helpful message to those users, that are using an outdated version of PHP,
* which is not supported by the currently selected Provider.
*
* @since 1.5.0
*/
protected function display_ssl_warning() {
?>
<blockquote>
<?php
printf(
wp_kses( /* translators: %s - Provider name */
__( '%s requires an SSL certificate, and so is not currently compatible with your site. Please contact your host to request a SSL certificate, or check out <a href="https://www.wpbeginner.com/wp-tutorials/how-to-add-ssl-and-https-in-wordpress/" target="_blank">WPBeginner\'s tutorial on how to set up SSL</a>.', 'wp-mail-smtp' ),
[
'a' => [
'href' => [],
'target' => [],
],
]
),
esc_html( $this->get_title() )
);
?>
<br>
<br>
<?php esc_html_e( 'If you\'d prefer not to set up SSL, or need an SMTP solution in the meantime, please select a different mailer option.', 'wp-mail-smtp' ); ?>
</blockquote>
<?php
}
/**
* Display a message of a constant that was set inside wp-config.php file.
*
* @since 1.5.0
*
* @param string $constant Constant name.
*/
protected function display_const_set_message( $constant ) {
?>
<p class="desc">
<?php
printf( /* translators: %1$s - constant that was used; %2$s - file where it was used. */
esc_html__( 'The value of this field was set using a constant %1$s most likely inside %2$s of your WordPress installation.', 'wp-mail-smtp' ),
'<code>' . esc_attr( $constant ) . '</code>',
'<code>wp-config.php</code>'
);
?>
</p>
<?php
}
/**
* Return the defaults for the mailer supported settings.
*
* @since 2.3.0
*
* @return array
*/
public function get_supports_defaults() {
return [
'from_email' => true,
'from_name' => true,
'return_path' => true,
'from_email_force' => true,
'from_name_force' => true,
];
}
/**
* Get the mailer supported settings.
*
* @since 2.3.0
*
* @return array
*/
public function get_supports() {
return apply_filters( 'wp_mail_smtp_providers_provider_get_supports', $this->supports, $this );
}
}

View File

@ -1,71 +0,0 @@
<?php
namespace WPMailSMTP\Providers;
/**
* Interface ProviderInterface, shared between all current and future providers.
* Defines required methods across all providers.
*
* @since 1.0.0
*/
interface OptionsInterface {
/**
* Get the mailer provider slug.
*
* @since 1.0.0
*
* @return string
*/
public function get_slug();
/**
* Get the mailer provider title (or name).
*
* @since 1.0.0
*
* @return string
*/
public function get_title();
/**
* Get the mailer provider description.
*
* @since 1.0.0
*
* @return string
*/
public function get_description();
/**
* Get the mailer provider minimum PHP version.
*
* @since 1.0.0
*
* @return string
*/
public function get_php_version();
/**
* Get the mailer provider logo URL.
*
* @since 1.0.0
*
* @return string
*/
public function get_logo_url();
/**
* Output the mailer provider options.
*
* @since 1.0.0
*/
public function display_options();
/**
* Get the mailer supported settings.
*
* @since 2.3.0
*/
public function get_supports();
}

View File

@ -1,44 +0,0 @@
<?php
namespace WPMailSMTP\Providers\Outlook;
use WPMailSMTP\Providers\OptionsAbstract;
/**
* Class Options.
*
* @since 1.7.0
*/
class Options extends OptionsAbstract {
/**
* Outlook Options constructor.
*
* @since 1.7.0
*/
public function __construct() {
parent::__construct(
array(
'logo_url' => wp_mail_smtp()->assets_url . '/images/providers/microsoft.svg',
'slug' => 'outlook',
'title' => esc_html__( 'Outlook', 'wp-mail-smtp' ),
'disabled' => true,
)
);
}
/**
* @inheritdoc
*/
public function display_options() {
?>
<p>
<?php esc_html_e( 'We\'re sorry, the Microsoft Outlook mailer is not available on your plan. Please upgrade to the PRO plan to unlock all these awesome features.', 'wp-mail-smtp' ); ?>
</p>
<?php
}
}

View File

@ -1,32 +0,0 @@
<?php
namespace WPMailSMTP\Providers\Pepipost;
use WPMailSMTP\Providers\MailerAbstract;
/**
* Class Mailer inherits everything from parent abstract class.
* This file is required for a proper work of Loader and \ReflectionClass.
*
* @package WPMailSMTP\Providers\Pepipost
*/
class Mailer extends MailerAbstract {
/**
* @inheritdoc
*/
public function is_mailer_complete() {
$options = $this->options->get_group( $this->mailer );
// Host and Port are the only really required options.
if (
! empty( $options['host'] ) &&
! empty( $options['port'] )
) {
return true;
}
return false;
}
}

View File

@ -1,29 +0,0 @@
<?php
namespace WPMailSMTP\Providers\Pepipost;
use WPMailSMTP\Providers\OptionsAbstract;
/**
* Class Options.
*
* @since 1.0.0
*/
class Options extends OptionsAbstract {
/**
* Pepipost constructor.
*
* @since 1.0.0
*/
public function __construct() {
parent::__construct(
array(
'logo_url' => wp_mail_smtp()->assets_url . '/images/providers/pepipost-smtp.png',
'slug' => 'pepipost',
'title' => esc_html__( 'Pepipost SMTP', 'wp-mail-smtp' ),
)
);
}
}

Some files were not shown because too many files have changed in this diff Show More