Skip to content

Commit

Permalink
updated to use latest subscriber agreement
Browse files Browse the repository at this point in the history
  • Loading branch information
felixarntz committed Aug 3, 2016
1 parent f515df1 commit 06c29cd
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 16 deletions.
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
== Changelog ==

= 1.0.0-beta.4 =
* Added: a link to the Let's Encrypt Subscriber Agreement is now displayed in the admin interface
* Fixed: plugin now supports using the latest Let's Encrypt Subscriber Agreement from August 1st, 2016

= 1.0.0-beta.3 =
* Added: plugin main class instance can now easily be accessed via a `wpenc()` function
* Enhanced: the admin class instance is now publicly accessible through a `WPENC\App::admin()` method
Expand Down
16 changes: 9 additions & 7 deletions inc/WPENC/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace WPENC;

use WPENC\Core\Util as CoreUtil;
use WPENC\Core\Client as Client;
use WPENC\Core\Certificate as Certificate;
use WPENC\Core\KeyPair as KeyPair;

Expand Down Expand Up @@ -214,7 +215,8 @@ public function render_page() {

<form class="wp-encrypt-form" method="post" action="<?php echo $form_action; ?>">
<p class="description">
<?php _e( 'By clicking on this button, you will register an account for the above organization with Let&apos;s Encrypt.', 'wp-encrypt' ); ?>
<?php _e( 'By clicking on this button, you will register an account for the above organization with Let&rsquo;s Encrypt.', 'wp-encrypt' ); ?>
<?php printf( __( 'By registering, you verify that you have read and accepted the <a href="%s" target="_blank">Let&rsquo;s Encrypt Subscriber Agreement</a>.', 'wp-encrypt' ), Client::get()->get_license_url() ); ?>
<?php if ( $account_registration_timestamp ) : ?>
<br />
<?php printf( __( 'Your account was registered on %1$s at %2$s.', 'wp-encrypt' ), date_i18n( get_option( 'date_format' ), $account_registration_timestamp ), date_i18n( get_option( 'time_format' ), $account_registration_timestamp ) ); ?>
Expand Down Expand Up @@ -345,7 +347,7 @@ public function render_settings_field( $args = array() ) {
$description = __( 'Generate a global certificate for all networks? This will ensure that all sites in your entire WordPress setup are covered.', 'wp-encrypt' );
break;
case 'autogenerate_certificate':
$description = __( 'Automatically regenerate the certificate prior to expiration? A Let&apos;s Encrypt certificate is valid for 90 days.', 'wp-encrypt' );
$description = __( 'Automatically regenerate the certificate prior to expiration? A Let&rsquo;s Encrypt certificate is valid for 90 days.', 'wp-encrypt' );
break;
case 'show_warning':
$description = __( 'Show a warning across the admin when the certificate is close to expire?', 'wp-encrypt' );
Expand Down Expand Up @@ -400,9 +402,9 @@ public function maybe_show_expire_warning() {
$url = App::get_admin_url( $this->context );

if ( Util::get_option( 'autogenerate_certificate' ) ) {
$text = _n( 'The Let&apos;s Encrypt certificate will expire in %1$s day. It will be automatically renewed prior to expiration, but you can also manually renew it <a href="%2$s">here</a>.', 'The Let&apos;s Encrypt certificate will expire in %1$s days. It will be automatically renewed prior to expiration, but you can also manually renew it <a href="%2$s">here</a>.', $diff, 'wp-encrypt' );
$text = _n( 'The Let&rsquo;s Encrypt certificate will expire in %1$s day. It will be automatically renewed prior to expiration, but you can also manually renew it <a href="%2$s">here</a>.', 'The Let&rsquo;s Encrypt certificate will expire in %1$s days. It will be automatically renewed prior to expiration, but you can also manually renew it <a href="%2$s">here</a>.', $diff, 'wp-encrypt' );
} else {
$text = _n( 'The Let&apos;s Encrypt certificate will expire in %1$s day. Please renew it soon <a href="%2$s">here</a>.', 'The Let&apos;s Encrypt certificate will expire in %1$s days. Please renew it soon <a href="%2$s">here</a>.', $diff, 'wp-encrypt' );
$text = _n( 'The Let&rsquo;s Encrypt certificate will expire in %1$s day. Please renew it soon <a href="%2$s">here</a>.', 'The Let&rsquo;s Encrypt certificate will expire in %1$s days. Please renew it soon <a href="%2$s">here</a>.', $diff, 'wp-encrypt' );
}

?>
Expand Down Expand Up @@ -513,7 +515,7 @@ public function render_help_getting_started() {
<?php _e( 'Hit the <em>Save Changes</em> button when you are done with the setup.', 'wp-encrypt' ); ?>
</li>
<li>
<?php _e( 'A new section will appear where you need to sign up for an account with Let&apos;s Encrypt.', 'wp-encrypt' ); ?>
<?php _e( 'A new section will appear where you need to sign up for an account with Let&rsquo;s Encrypt.', 'wp-encrypt' ); ?>
<?php _e( 'You do not need to worry about this account as it will only be used to generate the SSL certificates later.', 'wp-encrypt' ); ?><br />
<?php _e( 'Click on <em>Register Account</em> to sign up with the data you specified as account settings in the first step.', 'wp-encrypt' ); ?>
</li>
Expand Down Expand Up @@ -557,7 +559,7 @@ public function render_help_setting_up_ssl() {
<?php _e( 'In order to use the certificate you acquired, you need to configure SSL and set the paths to the certificate and the private key in your server configuration.', 'wp-encrypt' ); ?>
</p>
<p>
<?php _e( 'While the Let&apos;s Encrypt service and this plugin make it easy to manage SSL certificates, you still need to manually set up SSL on your web server.', 'wp-encrypt' ); ?>
<?php _e( 'While the Let&rsquo;s Encrypt service and this plugin make it easy to manage SSL certificates, you still need to manually set up SSL on your web server.', 'wp-encrypt' ); ?>
<?php _e( 'This is a one-time-only process you need to perform after you have obtained your first certificate.', 'wp-encrypt' ); ?>
</p>
<p>
Expand Down Expand Up @@ -586,7 +588,7 @@ public function render_help_setting_up_ssl() {
public function render_help_about_letsencrypt() {
?>
<p>
<?php _e( 'Let&apos;s Encrypt is a free, automated, and open certificate authority brought to you by the non-profit Internet Security Research Group (ISRG).', 'wp-encrypt' ); ?>
<?php _e( 'Let&rsquo;s Encrypt is a free, automated, and open certificate authority brought to you by the non-profit Internet Security Research Group (ISRG).', 'wp-encrypt' ); ?>
<?php _e( 'The project aims to promote encrypted connections on the web, ease the process of obtaining valid SSL certificates and make it possible to generate them for free.', 'wp-encrypt' ); ?><br />
<?php printf( __( 'For more information, please visit <a href="%s">their website</a>.', 'wp-encrypt' ), 'https://letsencrypt.org/' ); ?>
</p>
Expand Down
47 changes: 38 additions & 9 deletions inc/WPENC/Core/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,6 @@ final class Client {
*/
const RESOURCE_NEW = 'new-cert';

/**
* The license document URL.
*
* @since 1.0.0
*/
const LICENSE_URL = 'https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf';

/**
* Singleton instance.
*
Expand Down Expand Up @@ -171,13 +164,49 @@ public static function get() {
*/
private $last_links = null;

/**
* Array of license document URLs.
*
* @since 1.0.0
* @access private
* @var array
*/
private $licenses = array();

/**
* Constructor.
*
* Sets the license document URLs.
*
* @since 1.0.0
* @access private
*/
private function __construct() {}
private function __construct() {
// Newer licenses must come first.
$this->licenses = array(
'2016-08-01' => 'https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf',
'2015-07-27' => 'https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf',
);
}

/**
* Returns the URL to the current license document.
*
* @since 1.0.0
* @access private
* @return string URL to the license document.
*/
public function get_license_url() {
$now = current_time( 'timestamp' );

foreach ( $this->licenses as $date => $url ) {
if ( $now >= strtotime( $date ) ) {
return $url;
}
}

return '';
}

/**
* Registers an account with Let's Encrypt.
Expand All @@ -190,7 +219,7 @@ private function __construct() {}
public function register() {
return $this->signed_request( self::ENDPOINT_REGISTER, array(
'resource' => self::RESOURCE_REGISTER,
'agreement' => self::LICENSE_URL,
'agreement' => $this->get_license_url(),
) );
}

Expand Down
4 changes: 4 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ You can also contribute to the plugin by translating it. Simply visit [translate

== Changelog ==

= 1.0.0-beta.4 =
* Added: a link to the Let's Encrypt Subscriber Agreement is now displayed in the admin interface
* Fixed: plugin now supports using the latest Let's Encrypt Subscriber Agreement from August 1st, 2016

= 1.0.0-beta.3 =
* Added: plugin main class instance can now easily be accessed via a `wpenc()` function
* Enhanced: the admin class instance is now publicly accessible through a `WPENC\App::admin()` method
Expand Down

0 comments on commit 06c29cd

Please sign in to comment.