removing DKIM and useless classes
This commit is contained in:
@@ -34,16 +34,13 @@ define(
|
||||
// show sending methods
|
||||
jQuery('.mailpoet_sending_methods').fadeIn();
|
||||
} else {
|
||||
// toggle SPF/DKIM (hidden if the sending method is MailPoet)
|
||||
// toggle SPF (hidden if the sending method is MailPoet)
|
||||
jQuery('#mailpoet_mta_spf')[
|
||||
(group === 'mailpoet')
|
||||
? 'hide'
|
||||
: 'show'
|
||||
]();
|
||||
|
||||
// (HIDDEN FOR BETA)
|
||||
jQuery('#mailpoet_mta_dkim').hide();
|
||||
|
||||
// hide sending methods
|
||||
jQuery('.mailpoet_sending_methods').hide();
|
||||
|
||||
|
83
composer.lock
generated
83
composer.lock
generated
@@ -1847,16 +1847,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "5.4.4",
|
||||
"version": "5.4.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "02d5b64aa0837a038a5a4faeeefa5ef44bdcb928"
|
||||
"reference": "2f1fc94b77ea6418bd6a06c64a1dac0645fbce59"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/02d5b64aa0837a038a5a4faeeefa5ef44bdcb928",
|
||||
"reference": "02d5b64aa0837a038a5a4faeeefa5ef44bdcb928",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2f1fc94b77ea6418bd6a06c64a1dac0645fbce59",
|
||||
"reference": "2f1fc94b77ea6418bd6a06c64a1dac0645fbce59",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1875,7 +1875,7 @@
|
||||
"phpunit/phpunit-mock-objects": "^3.2",
|
||||
"sebastian/comparator": "~1.1",
|
||||
"sebastian/diff": "~1.2",
|
||||
"sebastian/environment": "~1.3",
|
||||
"sebastian/environment": "^1.3 || ^2.0",
|
||||
"sebastian/exporter": "~1.2",
|
||||
"sebastian/global-state": "~1.0",
|
||||
"sebastian/object-enumerator": "~1.0",
|
||||
@@ -1921,7 +1921,7 @@
|
||||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2016-06-09 09:09:27"
|
||||
"time": "2016-06-16 06:01:15"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit-mock-objects",
|
||||
@@ -2295,16 +2295,16 @@
|
||||
},
|
||||
{
|
||||
"name": "sebastian/exporter",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/exporter.git",
|
||||
"reference": "7ae5513327cb536431847bcc0c10edba2701064e"
|
||||
"reference": "42c4c2eec485ee3e159ec9884f95b431287edde4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e",
|
||||
"reference": "7ae5513327cb536431847bcc0c10edba2701064e",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4",
|
||||
"reference": "42c4c2eec485ee3e159ec9884f95b431287edde4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2312,12 +2312,13 @@
|
||||
"sebastian/recursion-context": "~1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-mbstring": "*",
|
||||
"phpunit/phpunit": "~4.4"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.2.x-dev"
|
||||
"dev-master": "1.3.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -2357,7 +2358,7 @@
|
||||
"export",
|
||||
"exporter"
|
||||
],
|
||||
"time": "2015-06-21 07:55:53"
|
||||
"time": "2016-06-17 09:04:28"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/global-state",
|
||||
@@ -2596,7 +2597,7 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/browser-kit",
|
||||
"version": "v3.1.0",
|
||||
"version": "v3.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/browser-kit.git",
|
||||
@@ -2706,16 +2707,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v3.1.0",
|
||||
"version": "v3.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "f62db5b8afec27073a4609b8c84b1f9936652259"
|
||||
"reference": "64a4d43b045f07055bb197650159769604cb2a92"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/f62db5b8afec27073a4609b8c84b1f9936652259",
|
||||
"reference": "f62db5b8afec27073a4609b8c84b1f9936652259",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/64a4d43b045f07055bb197650159769604cb2a92",
|
||||
"reference": "64a4d43b045f07055bb197650159769604cb2a92",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2762,20 +2763,20 @@
|
||||
],
|
||||
"description": "Symfony Console Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-05-30 06:58:39"
|
||||
"time": "2016-06-14 11:18:07"
|
||||
},
|
||||
{
|
||||
"name": "symfony/css-selector",
|
||||
"version": "v3.1.0",
|
||||
"version": "v3.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/css-selector.git",
|
||||
"reference": "e17f386efef7258ac671c24e727673abd086b0cf"
|
||||
"reference": "c526d7b3cb4fe1673c6a34e13be2ff63f519df99"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/css-selector/zipball/e17f386efef7258ac671c24e727673abd086b0cf",
|
||||
"reference": "e17f386efef7258ac671c24e727673abd086b0cf",
|
||||
"url": "https://api.github.com/repos/symfony/css-selector/zipball/c526d7b3cb4fe1673c6a34e13be2ff63f519df99",
|
||||
"reference": "c526d7b3cb4fe1673c6a34e13be2ff63f519df99",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2815,11 +2816,11 @@
|
||||
],
|
||||
"description": "Symfony CssSelector Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-03-04 07:56:56"
|
||||
"time": "2016-06-06 11:42:41"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dom-crawler",
|
||||
"version": "v3.1.0",
|
||||
"version": "v3.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/dom-crawler.git",
|
||||
@@ -2984,7 +2985,7 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
"version": "v3.1.0",
|
||||
"version": "v3.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/finder.git",
|
||||
@@ -3294,16 +3295,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
"version": "v3.1.0",
|
||||
"version": "v3.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/process.git",
|
||||
"reference": "1574f3451b40fa9bbae518ef71d19a56f409cac0"
|
||||
"reference": "6350e63ed9c232da50e00f00a7e0330f066387a2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/1574f3451b40fa9bbae518ef71d19a56f409cac0",
|
||||
"reference": "1574f3451b40fa9bbae518ef71d19a56f409cac0",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/6350e63ed9c232da50e00f00a7e0330f066387a2",
|
||||
"reference": "6350e63ed9c232da50e00f00a7e0330f066387a2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3339,7 +3340,7 @@
|
||||
],
|
||||
"description": "Symfony Process Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-04-12 19:11:33"
|
||||
"time": "2016-06-06 11:42:41"
|
||||
},
|
||||
{
|
||||
"name": "symfony/property-access",
|
||||
@@ -3559,16 +3560,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
"version": "v3.1.0",
|
||||
"version": "v3.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/yaml.git",
|
||||
"reference": "eca51b7b65eb9be6af88ad7cc91685f1556f5c9a"
|
||||
"reference": "c5a7e7fc273c758b92b85dcb9c46149ccda89623"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/eca51b7b65eb9be6af88ad7cc91685f1556f5c9a",
|
||||
"reference": "eca51b7b65eb9be6af88ad7cc91685f1556f5c9a",
|
||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/c5a7e7fc273c758b92b85dcb9c46149ccda89623",
|
||||
"reference": "c5a7e7fc273c758b92b85dcb9c46149ccda89623",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3604,7 +3605,7 @@
|
||||
],
|
||||
"description": "Symfony Yaml Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-05-26 21:46:24"
|
||||
"time": "2016-06-14 11:18:07"
|
||||
},
|
||||
{
|
||||
"name": "twig/extensions",
|
||||
@@ -3709,16 +3710,16 @@
|
||||
},
|
||||
{
|
||||
"name": "vlucas/phpdotenv",
|
||||
"version": "v2.2.1",
|
||||
"version": "v2.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/vlucas/phpdotenv.git",
|
||||
"reference": "63f37b9395e8041cd4313129c08ece896d06ca8e"
|
||||
"reference": "9ca5644c536654e9509b9d257f53c58630eb2a6a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/63f37b9395e8041cd4313129c08ece896d06ca8e",
|
||||
"reference": "63f37b9395e8041cd4313129c08ece896d06ca8e",
|
||||
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/9ca5644c536654e9509b9d257f53c58630eb2a6a",
|
||||
"reference": "9ca5644c536654e9509b9d257f53c58630eb2a6a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3730,7 +3731,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.2-dev"
|
||||
"dev-master": "2.3-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -3755,7 +3756,7 @@
|
||||
"env",
|
||||
"environment"
|
||||
],
|
||||
"time": "2016-04-15 10:48:49"
|
||||
"time": "2016-06-14 14:14:52"
|
||||
},
|
||||
{
|
||||
"name": "webmozart/assert",
|
||||
|
@@ -12,7 +12,6 @@ use MailPoet\Settings\Charsets;
|
||||
use MailPoet\Settings\Hosts;
|
||||
use MailPoet\Settings\Pages;
|
||||
use MailPoet\Subscribers\ImportExport\ImportExportFactory;
|
||||
use MailPoet\Util\DKIM;
|
||||
use MailPoet\Util\Permissions;
|
||||
use MailPoet\Listing;
|
||||
use MailPoet\WP\DateTime;
|
||||
@@ -294,21 +293,6 @@ class Menu {
|
||||
$settings = Setting::getAll();
|
||||
$flags = $this->_getFlags();
|
||||
|
||||
// dkim: check if public/private keys have been generated
|
||||
if(
|
||||
empty($settings['dkim'])
|
||||
or empty($settings['dkim']['public_key'])
|
||||
or empty($settings['dkim']['private_key'])
|
||||
) {
|
||||
// generate public/private keys
|
||||
$keys = DKIM::generateKeys();
|
||||
$settings['dkim'] = array(
|
||||
'public_key' => $keys['public'],
|
||||
'private_key' => $keys['private'],
|
||||
'domain' => preg_replace('/^www\./', '', $_SERVER['SERVER_NAME'])
|
||||
);
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'settings' => $settings,
|
||||
'segments' => Segment::getPublic()->findArray(),
|
||||
|
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
namespace MailPoet\Util;
|
||||
use \phpseclib\Crypt\RSA;
|
||||
|
||||
class DKIM {
|
||||
static function generateKeys() {
|
||||
try {
|
||||
$rsa = new RSA();
|
||||
$rsa_keys = $rsa->createKey();
|
||||
|
||||
return array(
|
||||
'public' => self::trimKey($rsa_keys['publickey']),
|
||||
'private' => self::trimKey($rsa_keys['privatekey'])
|
||||
);
|
||||
} catch(\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static function trimKey($key) {
|
||||
$lines = explode("\n", trim($key));
|
||||
// remove first line
|
||||
array_shift($lines);
|
||||
// remove last line
|
||||
array_pop($lines);
|
||||
return join('', $lines);
|
||||
}
|
||||
}
|
@@ -11,11 +11,9 @@ class Security {
|
||||
static function generateRandomString($length = 5) {
|
||||
// non-cryptographically strong random generator
|
||||
return substr(
|
||||
md5(
|
||||
uniqid(
|
||||
mt_rand(), true)
|
||||
),
|
||||
md5(uniqid(mt_rand(), true)),
|
||||
0,
|
||||
(!is_int($length) || $length <= 5 || $length >= 32) ? 5 : $length);
|
||||
min(max(5, (int)$length), 32)
|
||||
);
|
||||
}
|
||||
}
|
@@ -2,9 +2,6 @@
|
||||
namespace MailPoet\Util;
|
||||
|
||||
class Url {
|
||||
function __construct() {
|
||||
}
|
||||
|
||||
static function getCurrentUrl() {
|
||||
return home_url(add_query_arg(null, null));
|
||||
}
|
||||
|
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
namespace MailPoet\WP;
|
||||
|
||||
class Option {
|
||||
|
||||
function __construct() {
|
||||
$this->prefix = 'mailpoet_';
|
||||
}
|
||||
|
||||
function get($name) {
|
||||
return get_option($this->prefix . $name);
|
||||
}
|
||||
|
||||
function set($name, $value) {
|
||||
return update_option($this->prefix .$name, $value);
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
class UtilCSSTest extends MailPoetTest {
|
||||
class CSSTest extends MailPoetTest {
|
||||
public function _before() {
|
||||
$this->css = new \MailPoet\Util\CSS();
|
||||
}
|
32
tests/unit/Util/SecurityTest.php
Normal file
32
tests/unit/Util/SecurityTest.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
use \MailPoet\Util\Security;
|
||||
|
||||
class SecurityTest extends MailPoetTest {
|
||||
|
||||
function testItCanGenerateWPNonce() {
|
||||
$wp_nonce = Security::generateToken();
|
||||
// expect length of nonce to be exactly 10
|
||||
expect(strlen($wp_nonce))->equals(10);
|
||||
// expect only alphanumerical characters
|
||||
expect(ctype_alnum($wp_nonce))->true();
|
||||
}
|
||||
|
||||
function testItCanGenerateARandomString() {
|
||||
// it has a default length of 5
|
||||
$hash = Security::generateRandomString();
|
||||
expect(strlen($hash))->equals(5);
|
||||
|
||||
// it has a min length of 5
|
||||
$short_hash = Security::generateRandomString(1);
|
||||
expect(strlen($short_hash))->equals(5);
|
||||
|
||||
// it has a max length of 32
|
||||
$long_hash = Security::generateRandomString(64);
|
||||
expect(strlen($long_hash))->equals(32);
|
||||
|
||||
// expect only alphanumerical characters
|
||||
expect(ctype_alnum($hash))->true();
|
||||
expect(ctype_alnum($short_hash))->true();
|
||||
expect(ctype_alnum($long_hash))->true();
|
||||
}
|
||||
}
|
9
tests/unit/Util/UrlTest.php
Normal file
9
tests/unit/Util/UrlTest.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
use \MailPoet\Util\Url;
|
||||
|
||||
class UrlTest extends MailPoetTest {
|
||||
function testItCanReturnCurrentUrl() {
|
||||
$current_url = Url::getCurrentUrl();
|
||||
expect($current_url)->startsWith('http');
|
||||
}
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
class UtilDKIMTest extends MailPoetTest {
|
||||
|
||||
public function testItCanGenerateKeys() {
|
||||
$keys = \MailPoet\Util\DKIM::generateKeys();
|
||||
|
||||
$public_header = 'PUBLIC KEY-----';
|
||||
$private_header = 'PRIVATE KEY-----';
|
||||
|
||||
expect($keys['public'])->notEmpty();
|
||||
expect($keys['private'])->notEmpty();
|
||||
|
||||
expect($keys['public'])->notContains($public_header);
|
||||
expect($keys['private'])->notContains($private_header);
|
||||
}
|
||||
}
|
@@ -77,6 +77,6 @@ class DateTimeTest extends MailPoetTest {
|
||||
}
|
||||
|
||||
function _afterStep() {
|
||||
WordPress::releaseAllFunctions();
|
||||
WordPressHelper::releaseAllFunctions();
|
||||
}
|
||||
}
|
||||
|
@@ -38,23 +38,6 @@
|
||||
name="mta[frequency][interval]"
|
||||
value="<%= settings.mta.frequency.interval %>"
|
||||
/>
|
||||
<!-- dkim: public / private keys -->
|
||||
<input
|
||||
type="hidden"
|
||||
name="dkim[public_key]"
|
||||
value="<%= settings.dkim.public_key %>"
|
||||
/>
|
||||
<input
|
||||
type="hidden"
|
||||
name="dkim[private_key]"
|
||||
value="<%= settings.dkim.private_key %>"
|
||||
/>
|
||||
<!-- dkim: domain -->
|
||||
<input
|
||||
type="hidden"
|
||||
name="dkim[domain]"
|
||||
value="<%= settings.dkim.domain %>"
|
||||
/>
|
||||
|
||||
<!-- smtp: available sending methods -->
|
||||
<ul class="mailpoet_sending_methods clearfix">
|
||||
@@ -616,70 +599,6 @@
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- dkim -->
|
||||
<tr id="mailpoet_mta_dkim" style="display:none;">
|
||||
<th scope="row">
|
||||
<label for="settings[dkim_enabled]">
|
||||
<%= __('DKIM Signature (Highly recommended!)') %>
|
||||
<p class="description">
|
||||
<%= __('Improve your spam score. MailPoet can sign all your emails with DKIM.') %>
|
||||
<a
|
||||
href="#todo/guide-to-dkim-in-wysija/"
|
||||
target="_blank"
|
||||
title=""
|
||||
><%= __('Read more.') %></a>
|
||||
</p>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<input
|
||||
data-toggle="mailpoet_mta_dkim_content"
|
||||
type="checkbox"
|
||||
value="1"
|
||||
id="settings[dkim_enabled]"
|
||||
name="dkim[enabled]"
|
||||
<% if(settings.dkim.enabled) %>checked="checked"<% endif %>
|
||||
/>
|
||||
</p>
|
||||
<div id="mailpoet_mta_dkim_content">
|
||||
<fieldset style="border: 1px solid #ccc;margin: 0;padding: 10px;">
|
||||
<legend>
|
||||
<%= __('Configure your DNS by adding a key/value record in TXT as shown below.') %>
|
||||
<a
|
||||
href="http://support.mailpoet.com/knowledgebase/guide-to-dkim-in-wysija/?utm_source=wpadmin&utm_campaign=settings"
|
||||
target="_blank"
|
||||
><%= __('Read more.') %></a>
|
||||
</legend>
|
||||
<p>
|
||||
<label>
|
||||
<%= __('Key') %>
|
||||
<input
|
||||
type="text"
|
||||
class="regular-text"
|
||||
onClick="this.focus();this.select();"
|
||||
readonly="readonly"
|
||||
value="wys._domainkey"
|
||||
size="12"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<%= __('Value') %>
|
||||
<input
|
||||
type="text"
|
||||
class="regular-text"
|
||||
|
||||
onClick="this.focus();this.select();"
|
||||
readonly="readonly"
|
||||
value="v=DKIM1;s=email;t=s;p=<%= settings.dkim.public_key %>"
|
||||
/>
|
||||
</label>
|
||||
</p>
|
||||
</fieldset>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- test method -->
|
||||
<tr>
|
||||
<th scope="row">
|
||||
|
Reference in New Issue
Block a user