PluginProbe ʕ •ᴥ•ʔ
Really Simple Security – Simple and Performant Security (formerly Really Simple SSL) / 9.5.9
Really Simple Security – Simple and Performant Security (formerly Really Simple SSL) v9.5.9
9.5.11 9.5.10.1 9.5.10 trunk 9.4.0 9.4.1 9.4.2 9.4.3 9.5.0 9.5.0.1 9.5.0.2 9.5.1 9.5.2 9.5.2.2 9.5.2.3 9.5.3 9.5.3.1 9.5.3.2 9.5.4 9.5.5 9.5.6 9.5.7 9.5.8 9.5.9
really-simple-ssl / lets-encrypt / letsencrypt.php
really-simple-ssl / lets-encrypt Last commit date
config 2 months ago integrations 2 months ago vendor 2 months ago class-le-restapi.php 2 months ago class-letsencrypt-handler.php 2 months ago composer.json 2 months ago cron.php 2 months ago download.php 2 months ago functions.php 2 months ago index.php 2 months ago letsencrypt.php 2 months ago
letsencrypt.php
122 lines
1 <?php
2 defined('ABSPATH') or die();
3 /**
4 * Capability handling for Let's Encrypt
5 * @return bool
6 *
7 * php -r "readfile('https://getcomposer.org/installer');" | php
8 */
9 if (!function_exists('rsssl_letsencrypt_generation_allowed')) {
10 function rsssl_letsencrypt_generation_allowed($strict = false) {
11 $certificateGeneratedByRsssl = get_option('rsssl_le_certificate_generated_by_rsssl');
12
13 /**
14 * LE classes should also run if SSL is generated by rsssl, the plus one
15 * cache is cleared or when the cron runs
16 */
17 if ($certificateGeneratedByRsssl && (
18 !get_option('rsssl_plusone_count') || wp_doing_cron()
19 )) {
20 return apply_filters('rsssl_letsencrypt_generation_allowed', true, $strict);
21 }
22
23 if (current_user_can('manage_security') === false) {
24 return apply_filters('rsssl_letsencrypt_generation_allowed', false, $strict);
25 }
26
27 if ( isset($_GET['letsencrypt'])) {
28 return apply_filters('rsssl_letsencrypt_generation_allowed', true, $strict);
29 }
30
31 /**
32 * Filter: 'rsssl_letsencrypt_generation_allowed'
33 *
34 * Can be used to override the default behavior of allowing or
35 * disallowing Let's Encrypt certificate generation.
36 *
37 * @param bool $allowed
38 * @param bool $strict
39 * @return bool
40 */
41 return apply_filters('rsssl_letsencrypt_generation_allowed', false, $strict);
42 }
43 }
44
45 class RSSSL_LETSENCRYPT {
46 private static $instance;
47
48 public $le_restapi;
49 public $field;
50 public $hosts;
51 public $letsencrypt_handler;
52
53 private function __construct() {
54 }
55
56
57
58 public static function instance() {
59 if ( ! isset( self::$instance ) && ! ( self::$instance instanceof RSSSL_LETSENCRYPT ) ) {
60 self::$instance = new RSSSL_LETSENCRYPT;
61 self::$instance->setup_constants();
62 self::$instance->includes();
63 self::$instance->hosts = new rsssl_le_hosts();
64 if ( rsssl_letsencrypt_generation_allowed() ) {
65 self::$instance->letsencrypt_handler = new rsssl_letsencrypt_handler();
66 self::$instance->le_restapi = new rsssl_le_restapi();
67 }
68 }
69
70 return self::$instance;
71 }
72
73 private function setup_constants() {
74 define('rsssl_le_url', plugin_dir_url(__FILE__));
75 define('rsssl_le_path', trailingslashit(plugin_dir_path(__FILE__)));
76 }
77
78 private function includes() {
79 require_once( rsssl_le_path . 'functions.php');
80 require_once( rsssl_le_path . 'config/class-hosts.php' );
81 if ( rsssl_letsencrypt_generation_allowed() ) {
82 require_once( rsssl_le_path . 'config/fields.php');
83 require_once( rsssl_le_path . 'class-le-restapi.php' );
84 require_once( rsssl_le_path . 'class-letsencrypt-handler.php' );
85 require_once( rsssl_le_path . 'integrations/integrations.php' );
86 }
87 require_once( rsssl_le_path . 'config/notices.php' );
88 }
89
90 /**
91 * Notice about possible compatibility issues with add ons
92 */
93 public static function admin_notices() {
94
95 }
96 }
97
98 function RSSSL_LE() {
99 return RSSSL_LETSENCRYPT::instance();
100 }
101
102 add_action( 'plugins_loaded', 'RSSSL_LE', 9 );
103
104
105 class RSSSL_RESPONSE
106 {
107 public $message;
108 public $action;
109 public $status;
110 public $output;
111 public $request_success;
112
113 public function __construct($status, $action, $message, $output = false )
114 {
115 $this->status = $status;
116 $this->action = $action;
117 $this->message = $message;
118 $this->output = $output;
119 $this->request_success = true;
120 }
121
122 }