Completed
Branch master (c63335)
by
unknown
17:58 queued 13:20
created
core/services/encryption/EncryptionKeyManagerInterface.php 1 patch
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -12,85 +12,85 @@
 block discarded – undo
12 12
  */
13 13
 interface EncryptionKeyManagerInterface
14 14
 {
15
-    /**
16
-     * add an encryption key
17
-     *
18
-     * @param string $encryption_key_identifier - name of the encryption key to use
19
-     * @param string $encryption_key            - cryptographically secure passphrase. will generate if necessary
20
-     * @param bool   $overwrite                 - prevents accidental overwriting of an existing key which would be bad
21
-     * @return bool
22
-     */
23
-    public function addEncryptionKey($encryption_key_identifier, $encryption_key = '', $overwrite = false);
24
-
25
-
26
-    /**
27
-     * returns true if encryption key has already been generated
28
-     *
29
-     * @param string $encryption_key_identifier - encryption key name
30
-     * @return bool
31
-     */
32
-    public function encryptionKeyExists($encryption_key_identifier = '');
33
-
34
-
35
-    /**
36
-     * returns cryptographically secure passphrase. will use default if necessary
37
-     *
38
-     * @param string $encryption_key_identifier - encryption key name. will use default if necessary
39
-     * @param bool   $generate                  - will generate a new key if the requested one does not exist
40
-     * @param bool   $throw_exception           - if TRUE (default), will throw an exception if key is not found
41
-     * @return string
42
-     */
43
-    public function getEncryptionKey($encryption_key_identifier = '', $generate = false, $throw_exception = true);
44
-
45
-
46
-    /**
47
-     * creates a new encryption key
48
-     *
49
-     * @param bool $strong if true (default) will attempt to generate a cryptographically secure key
50
-     * @return string
51
-     */
52
-    public function generateEncryptionKey($strong = true);
53
-
54
-
55
-    /**
56
-     * @return int
57
-     */
58
-    public function bitDepth();
59
-
60
-
61
-    /**
62
-     * @param int $bit_depth options are 64, 128, 192, or 256
63
-     */
64
-    public function setBitDepth($bit_depth);
65
-
66
-
67
-    /**
68
-     * @return int
69
-     */
70
-    public function keyLength();
71
-
72
-
73
-    /**
74
-     * @param int $key_length
75
-     */
76
-    public function setKeyLength($key_length);
77
-
78
-
79
-    /**
80
-     * deletes ALL existing encryption keys from the db
81
-     *
82
-     * @return bool true if keys successfully deleted, false otherwise.
83
-     */
84
-    public function removeAllEncryptionKeys();
85
-
86
-
87
-    /**
88
-     * deletes an existing encryption key from those saved in the db
89
-     *
90
-     * @param string $encryption_key_identifier encryption key name
91
-     * @return int  1: key removed successfully.
92
-     *              0: key did not exist.
93
-     *             -1: failed to remove key
94
-     */
95
-    public function removeEncryptionKey($encryption_key_identifier = '');
15
+	/**
16
+	 * add an encryption key
17
+	 *
18
+	 * @param string $encryption_key_identifier - name of the encryption key to use
19
+	 * @param string $encryption_key            - cryptographically secure passphrase. will generate if necessary
20
+	 * @param bool   $overwrite                 - prevents accidental overwriting of an existing key which would be bad
21
+	 * @return bool
22
+	 */
23
+	public function addEncryptionKey($encryption_key_identifier, $encryption_key = '', $overwrite = false);
24
+
25
+
26
+	/**
27
+	 * returns true if encryption key has already been generated
28
+	 *
29
+	 * @param string $encryption_key_identifier - encryption key name
30
+	 * @return bool
31
+	 */
32
+	public function encryptionKeyExists($encryption_key_identifier = '');
33
+
34
+
35
+	/**
36
+	 * returns cryptographically secure passphrase. will use default if necessary
37
+	 *
38
+	 * @param string $encryption_key_identifier - encryption key name. will use default if necessary
39
+	 * @param bool   $generate                  - will generate a new key if the requested one does not exist
40
+	 * @param bool   $throw_exception           - if TRUE (default), will throw an exception if key is not found
41
+	 * @return string
42
+	 */
43
+	public function getEncryptionKey($encryption_key_identifier = '', $generate = false, $throw_exception = true);
44
+
45
+
46
+	/**
47
+	 * creates a new encryption key
48
+	 *
49
+	 * @param bool $strong if true (default) will attempt to generate a cryptographically secure key
50
+	 * @return string
51
+	 */
52
+	public function generateEncryptionKey($strong = true);
53
+
54
+
55
+	/**
56
+	 * @return int
57
+	 */
58
+	public function bitDepth();
59
+
60
+
61
+	/**
62
+	 * @param int $bit_depth options are 64, 128, 192, or 256
63
+	 */
64
+	public function setBitDepth($bit_depth);
65
+
66
+
67
+	/**
68
+	 * @return int
69
+	 */
70
+	public function keyLength();
71
+
72
+
73
+	/**
74
+	 * @param int $key_length
75
+	 */
76
+	public function setKeyLength($key_length);
77
+
78
+
79
+	/**
80
+	 * deletes ALL existing encryption keys from the db
81
+	 *
82
+	 * @return bool true if keys successfully deleted, false otherwise.
83
+	 */
84
+	public function removeAllEncryptionKeys();
85
+
86
+
87
+	/**
88
+	 * deletes an existing encryption key from those saved in the db
89
+	 *
90
+	 * @param string $encryption_key_identifier encryption key name
91
+	 * @return int  1: key removed successfully.
92
+	 *              0: key did not exist.
93
+	 *             -1: failed to remove key
94
+	 */
95
+	public function removeEncryptionKey($encryption_key_identifier = '');
96 96
 }
Please login to merge, or discard this patch.
core/services/encryption/EncryptionKeyManager.php 2 patches
Indentation   +297 added lines, -297 removed lines patch added patch discarded remove patch
@@ -16,301 +16,301 @@
 block discarded – undo
16 16
  */
17 17
 class EncryptionKeyManager implements EncryptionKeyManagerInterface
18 18
 {
19
-    /**
20
-     * @var Base64Encoder
21
-     */
22
-    protected $base64_encoder;
23
-
24
-    /**
25
-     * name used for a default encryption key in case no others are set
26
-     *
27
-     * @var string
28
-     */
29
-    private $default_encryption_key_id;
30
-
31
-    /**
32
-     * name used for saving encryption keys to the wp_options table
33
-     *
34
-     * @var string
35
-     */
36
-    private $encryption_keys_option_name;
37
-
38
-    /**
39
-     * @var array
40
-     */
41
-    private $encryption_keys = null;
42
-
43
-    /**
44
-     * number of bits used when generating cryptographically secure keys
45
-     *
46
-     * @var int
47
-     */
48
-    private $bit_depth = 128;
49
-
50
-    /**
51
-     * @var int[]
52
-     */
53
-    private $bit_depth_options = [64, 128, 192, 256];
54
-
55
-    /**
56
-     * number of characters used when generating cryptographically weak keys
57
-     *
58
-     * @var int
59
-     */
60
-    private $key_length = 40;
61
-
62
-
63
-    /**
64
-     * @param Base64Encoder $base64_encoder
65
-     * @param string        $default_encryption_key_id
66
-     * @param string        $encryption_keys_option_name
67
-     */
68
-    public function __construct(Base64Encoder $base64_encoder, $default_encryption_key_id, $encryption_keys_option_name)
69
-    {
70
-        $this->base64_encoder              = $base64_encoder;
71
-        $this->default_encryption_key_id   = $default_encryption_key_id;
72
-        $this->encryption_keys_option_name = $encryption_keys_option_name;
73
-    }
74
-
75
-
76
-    /**
77
-     * add an encryption key
78
-     *
79
-     * @param string $encryption_key_identifier - name of the encryption key to use
80
-     * @param string $encryption_key            - cryptographically secure passphrase. will generate if necessary
81
-     * @param bool   $overwrite                 - prevents accidental overwriting of an existing key which would be bad
82
-     * @return bool
83
-     * @throws Exception
84
-     */
85
-    public function addEncryptionKey($encryption_key_identifier, $encryption_key = '', $overwrite = false)
86
-    {
87
-        $encryption_key_identifier = $encryption_key_identifier ?: $this->default_encryption_key_id;
88
-        if ($this->encryptionKeyExists($encryption_key_identifier) && ! $overwrite) {
89
-            // WOAH!!! that key already exists and we don't want to overwrite it
90
-            throw new RuntimeException(
91
-                sprintf(
92
-                    esc_html__(
93
-                        'The "%1$s" encryption key already exists and can not be overwritten because previously encrypted values would no longer be capable of being decrypted.',
94
-                        'event_espresso'
95
-                    ),
96
-                    $encryption_key_identifier
97
-                )
98
-            );
99
-        }
100
-        $this->encryption_keys[ $encryption_key_identifier ] = $encryption_key ?: $this->generateEncryptionKey();
101
-        return $this->saveEncryptionKeys();
102
-    }
103
-
104
-
105
-    /**
106
-     * returns true if encryption key has already been generated
107
-     *
108
-     * @param string $encryption_key_identifier - encryption key name
109
-     * @return bool
110
-     * @throws Exception
111
-     * @throws OutOfBoundsException
112
-     */
113
-    public function encryptionKeyExists($encryption_key_identifier = '')
114
-    {
115
-        // ensure keys are loaded
116
-        $this->retrieveEncryptionKeys();
117
-        return isset($this->encryption_keys[ $encryption_key_identifier ]);
118
-    }
119
-
120
-
121
-    /**
122
-     * returns cryptographically secure passphrase. will use default if necessary
123
-     *
124
-     * @param string $encryption_key_identifier - encryption key name. will use default if necessary
125
-     * @param bool   $generate                  - will generate a new key if the requested one does not exist
126
-     * @param bool   $throw_exception           - if TRUE (default), will throw an exception if key is not found
127
-     * @return string
128
-     * @throws Exception
129
-     */
130
-    public function getEncryptionKey($encryption_key_identifier = '', $generate = true, $throw_exception = true)
131
-    {
132
-        $encryption_key_identifier = $encryption_key_identifier ?: $this->default_encryption_key_id;
133
-        // if encryption key has not been set
134
-        if (! $this->encryptionKeyExists($encryption_key_identifier)) {
135
-            if ($generate) {
136
-                $this->addEncryptionKey($encryption_key_identifier);
137
-            } else {
138
-                if (! $throw_exception) {
139
-                    return '';
140
-                }
141
-                throw new OutOfBoundsException(
142
-                    sprintf(
143
-                        esc_html__('The "%1$s" encryption key was not found or is invalid.', 'event_espresso'),
144
-                        $encryption_key_identifier
145
-                    )
146
-                );
147
-            }
148
-        }
149
-        return $this->encryption_keys[ $encryption_key_identifier ];
150
-    }
151
-
152
-
153
-    /**
154
-     * creates a new encryption key
155
-     *
156
-     * @param bool $strong if true (default) will attempt to generate a cryptographically secure key
157
-     * @return string
158
-     * @throws Exception
159
-     */
160
-    public function generateEncryptionKey($strong = true)
161
-    {
162
-        return $strong && PHP_VERSION_ID >= 70100
163
-            ? $this->generateStrongEncryptionKey()
164
-            : $this->generateWeakEncryptionKey();
165
-    }
166
-
167
-
168
-    /**
169
-     * creates a new cryptographically secure encryption key
170
-     *
171
-     * @return string
172
-     * @throws Exception
173
-     */
174
-    protected function generateStrongEncryptionKey()
175
-    {
176
-        // bit_depth needs to be divided by 8 to convert to bytes
177
-        return $this->base64_encoder->encodeString(random_bytes($this->bit_depth / 8));
178
-    }
179
-
180
-
181
-    /**
182
-     * creates a new encryption key that should not be trusted to be cryptographically secure
183
-     *
184
-     * @return string
185
-     * @throws Exception
186
-     */
187
-    protected function generateWeakEncryptionKey()
188
-    {
189
-        // @see http://stackoverflow.com/questions/637278/what-is-the-best-way-to-generate-a-random-key-within-php
190
-        $iterations    = ceil($this->key_length / 40);
191
-        $random_string = '';
192
-        for ($i = 0; $i < $iterations; $i++) {
193
-            $random_string .= sha1(microtime(true) . mt_rand(10000, 90000));
194
-        }
195
-        $random_string = (string) substr($random_string, 0, $this->key_length);
196
-        return $this->base64_encoder->encodeString($random_string);
197
-    }
198
-
199
-
200
-    /**
201
-     * @return int
202
-     */
203
-    public function bitDepth()
204
-    {
205
-        return $this->bit_depth;
206
-    }
207
-
208
-
209
-    /**
210
-     * @param int $bit_depth options are 64, 128, 192, or 256
211
-     */
212
-    public function setBitDepth($bit_depth)
213
-    {
214
-        $bit_depth       = absint($bit_depth);
215
-        $this->bit_depth = in_array($bit_depth, $this->bit_depth_options, true) ? $bit_depth : 128;
216
-    }
217
-
218
-
219
-    /**
220
-     * @return int
221
-     */
222
-    public function keyLength()
223
-    {
224
-        return $this->key_length;
225
-    }
226
-
227
-
228
-    /**
229
-     * @param int $key_length
230
-     */
231
-    public function setKeyLength($key_length)
232
-    {
233
-        // let's not let the key length go below 8 or above 128
234
-        $this->key_length = min(max(absint($key_length), 8), 128);
235
-    }
236
-
237
-
238
-    /**
239
-     * deletes ALL existing encryption keys from the db
240
-     *
241
-     * @return bool true if keys successfully deleted, false otherwise.
242
-     */
243
-    public function removeAllEncryptionKeys()
244
-    {
245
-        return delete_option($this->encryption_keys_option_name);
246
-    }
247
-
248
-
249
-    /**
250
-     * deletes an existing encryption key from those saved in the db
251
-     *
252
-     * @param string $encryption_key_identifier encryption key name
253
-     * @return int  1: key removed successfully.
254
-     *              0: key did not exist.
255
-     *             -1: failed to remove key
256
-     * @throws Exception
257
-     */
258
-    public function removeEncryptionKey($encryption_key_identifier = '')
259
-    {
260
-        // if encryption key has not been set
261
-        if (! $this->encryptionKeyExists($encryption_key_identifier)) {
262
-            return 0;
263
-        }
264
-        unset($this->encryption_keys[ $encryption_key_identifier ]);
265
-        return $this->saveEncryptionKeys() ? 1 : -1;
266
-    }
267
-
268
-
269
-    /**
270
-     * retrieves encryption keys from db
271
-     *
272
-     * @return array
273
-     * @throws Exception
274
-     * @throws RuntimeException
275
-     */
276
-    protected function retrieveEncryptionKeys()
277
-    {
278
-        // if encryption key has not been set
279
-        if (empty($this->encryption_keys)) {
280
-            // retrieve encryption_key from db
281
-            $this->encryption_keys = get_option($this->encryption_keys_option_name, null);
282
-            // WHAT?? No encryption keys in the db ??
283
-            if ($this->encryption_keys === null) {
284
-                $this->encryption_keys = [];
285
-                // let's create the default key and save it
286
-                $new_key                                                   = $this->generateEncryptionKey();
287
-                $this->encryption_keys[ $this->default_encryption_key_id ] = $new_key;
288
-                if (! $this->saveEncryptionKeys(true)) {
289
-                    throw new RuntimeException(
290
-                        sprintf(
291
-                            esc_html__(
292
-                                'Failed to save the "%1$s" encryption keys array to the database.',
293
-                                'event_espresso'
294
-                            ),
295
-                            $this->encryption_keys_option_name
296
-                        )
297
-                    );
298
-                }
299
-            }
300
-        }
301
-        return $this->encryption_keys;
302
-    }
303
-
304
-
305
-    /**
306
-     * saves encryption keys from db
307
-     *
308
-     * @return bool
309
-     */
310
-    protected function saveEncryptionKeys($initialize = false)
311
-    {
312
-        return $initialize
313
-            ? add_option($this->encryption_keys_option_name, $this->encryption_keys, '', false)
314
-            : update_option($this->encryption_keys_option_name, $this->encryption_keys, false);
315
-    }
19
+	/**
20
+	 * @var Base64Encoder
21
+	 */
22
+	protected $base64_encoder;
23
+
24
+	/**
25
+	 * name used for a default encryption key in case no others are set
26
+	 *
27
+	 * @var string
28
+	 */
29
+	private $default_encryption_key_id;
30
+
31
+	/**
32
+	 * name used for saving encryption keys to the wp_options table
33
+	 *
34
+	 * @var string
35
+	 */
36
+	private $encryption_keys_option_name;
37
+
38
+	/**
39
+	 * @var array
40
+	 */
41
+	private $encryption_keys = null;
42
+
43
+	/**
44
+	 * number of bits used when generating cryptographically secure keys
45
+	 *
46
+	 * @var int
47
+	 */
48
+	private $bit_depth = 128;
49
+
50
+	/**
51
+	 * @var int[]
52
+	 */
53
+	private $bit_depth_options = [64, 128, 192, 256];
54
+
55
+	/**
56
+	 * number of characters used when generating cryptographically weak keys
57
+	 *
58
+	 * @var int
59
+	 */
60
+	private $key_length = 40;
61
+
62
+
63
+	/**
64
+	 * @param Base64Encoder $base64_encoder
65
+	 * @param string        $default_encryption_key_id
66
+	 * @param string        $encryption_keys_option_name
67
+	 */
68
+	public function __construct(Base64Encoder $base64_encoder, $default_encryption_key_id, $encryption_keys_option_name)
69
+	{
70
+		$this->base64_encoder              = $base64_encoder;
71
+		$this->default_encryption_key_id   = $default_encryption_key_id;
72
+		$this->encryption_keys_option_name = $encryption_keys_option_name;
73
+	}
74
+
75
+
76
+	/**
77
+	 * add an encryption key
78
+	 *
79
+	 * @param string $encryption_key_identifier - name of the encryption key to use
80
+	 * @param string $encryption_key            - cryptographically secure passphrase. will generate if necessary
81
+	 * @param bool   $overwrite                 - prevents accidental overwriting of an existing key which would be bad
82
+	 * @return bool
83
+	 * @throws Exception
84
+	 */
85
+	public function addEncryptionKey($encryption_key_identifier, $encryption_key = '', $overwrite = false)
86
+	{
87
+		$encryption_key_identifier = $encryption_key_identifier ?: $this->default_encryption_key_id;
88
+		if ($this->encryptionKeyExists($encryption_key_identifier) && ! $overwrite) {
89
+			// WOAH!!! that key already exists and we don't want to overwrite it
90
+			throw new RuntimeException(
91
+				sprintf(
92
+					esc_html__(
93
+						'The "%1$s" encryption key already exists and can not be overwritten because previously encrypted values would no longer be capable of being decrypted.',
94
+						'event_espresso'
95
+					),
96
+					$encryption_key_identifier
97
+				)
98
+			);
99
+		}
100
+		$this->encryption_keys[ $encryption_key_identifier ] = $encryption_key ?: $this->generateEncryptionKey();
101
+		return $this->saveEncryptionKeys();
102
+	}
103
+
104
+
105
+	/**
106
+	 * returns true if encryption key has already been generated
107
+	 *
108
+	 * @param string $encryption_key_identifier - encryption key name
109
+	 * @return bool
110
+	 * @throws Exception
111
+	 * @throws OutOfBoundsException
112
+	 */
113
+	public function encryptionKeyExists($encryption_key_identifier = '')
114
+	{
115
+		// ensure keys are loaded
116
+		$this->retrieveEncryptionKeys();
117
+		return isset($this->encryption_keys[ $encryption_key_identifier ]);
118
+	}
119
+
120
+
121
+	/**
122
+	 * returns cryptographically secure passphrase. will use default if necessary
123
+	 *
124
+	 * @param string $encryption_key_identifier - encryption key name. will use default if necessary
125
+	 * @param bool   $generate                  - will generate a new key if the requested one does not exist
126
+	 * @param bool   $throw_exception           - if TRUE (default), will throw an exception if key is not found
127
+	 * @return string
128
+	 * @throws Exception
129
+	 */
130
+	public function getEncryptionKey($encryption_key_identifier = '', $generate = true, $throw_exception = true)
131
+	{
132
+		$encryption_key_identifier = $encryption_key_identifier ?: $this->default_encryption_key_id;
133
+		// if encryption key has not been set
134
+		if (! $this->encryptionKeyExists($encryption_key_identifier)) {
135
+			if ($generate) {
136
+				$this->addEncryptionKey($encryption_key_identifier);
137
+			} else {
138
+				if (! $throw_exception) {
139
+					return '';
140
+				}
141
+				throw new OutOfBoundsException(
142
+					sprintf(
143
+						esc_html__('The "%1$s" encryption key was not found or is invalid.', 'event_espresso'),
144
+						$encryption_key_identifier
145
+					)
146
+				);
147
+			}
148
+		}
149
+		return $this->encryption_keys[ $encryption_key_identifier ];
150
+	}
151
+
152
+
153
+	/**
154
+	 * creates a new encryption key
155
+	 *
156
+	 * @param bool $strong if true (default) will attempt to generate a cryptographically secure key
157
+	 * @return string
158
+	 * @throws Exception
159
+	 */
160
+	public function generateEncryptionKey($strong = true)
161
+	{
162
+		return $strong && PHP_VERSION_ID >= 70100
163
+			? $this->generateStrongEncryptionKey()
164
+			: $this->generateWeakEncryptionKey();
165
+	}
166
+
167
+
168
+	/**
169
+	 * creates a new cryptographically secure encryption key
170
+	 *
171
+	 * @return string
172
+	 * @throws Exception
173
+	 */
174
+	protected function generateStrongEncryptionKey()
175
+	{
176
+		// bit_depth needs to be divided by 8 to convert to bytes
177
+		return $this->base64_encoder->encodeString(random_bytes($this->bit_depth / 8));
178
+	}
179
+
180
+
181
+	/**
182
+	 * creates a new encryption key that should not be trusted to be cryptographically secure
183
+	 *
184
+	 * @return string
185
+	 * @throws Exception
186
+	 */
187
+	protected function generateWeakEncryptionKey()
188
+	{
189
+		// @see http://stackoverflow.com/questions/637278/what-is-the-best-way-to-generate-a-random-key-within-php
190
+		$iterations    = ceil($this->key_length / 40);
191
+		$random_string = '';
192
+		for ($i = 0; $i < $iterations; $i++) {
193
+			$random_string .= sha1(microtime(true) . mt_rand(10000, 90000));
194
+		}
195
+		$random_string = (string) substr($random_string, 0, $this->key_length);
196
+		return $this->base64_encoder->encodeString($random_string);
197
+	}
198
+
199
+
200
+	/**
201
+	 * @return int
202
+	 */
203
+	public function bitDepth()
204
+	{
205
+		return $this->bit_depth;
206
+	}
207
+
208
+
209
+	/**
210
+	 * @param int $bit_depth options are 64, 128, 192, or 256
211
+	 */
212
+	public function setBitDepth($bit_depth)
213
+	{
214
+		$bit_depth       = absint($bit_depth);
215
+		$this->bit_depth = in_array($bit_depth, $this->bit_depth_options, true) ? $bit_depth : 128;
216
+	}
217
+
218
+
219
+	/**
220
+	 * @return int
221
+	 */
222
+	public function keyLength()
223
+	{
224
+		return $this->key_length;
225
+	}
226
+
227
+
228
+	/**
229
+	 * @param int $key_length
230
+	 */
231
+	public function setKeyLength($key_length)
232
+	{
233
+		// let's not let the key length go below 8 or above 128
234
+		$this->key_length = min(max(absint($key_length), 8), 128);
235
+	}
236
+
237
+
238
+	/**
239
+	 * deletes ALL existing encryption keys from the db
240
+	 *
241
+	 * @return bool true if keys successfully deleted, false otherwise.
242
+	 */
243
+	public function removeAllEncryptionKeys()
244
+	{
245
+		return delete_option($this->encryption_keys_option_name);
246
+	}
247
+
248
+
249
+	/**
250
+	 * deletes an existing encryption key from those saved in the db
251
+	 *
252
+	 * @param string $encryption_key_identifier encryption key name
253
+	 * @return int  1: key removed successfully.
254
+	 *              0: key did not exist.
255
+	 *             -1: failed to remove key
256
+	 * @throws Exception
257
+	 */
258
+	public function removeEncryptionKey($encryption_key_identifier = '')
259
+	{
260
+		// if encryption key has not been set
261
+		if (! $this->encryptionKeyExists($encryption_key_identifier)) {
262
+			return 0;
263
+		}
264
+		unset($this->encryption_keys[ $encryption_key_identifier ]);
265
+		return $this->saveEncryptionKeys() ? 1 : -1;
266
+	}
267
+
268
+
269
+	/**
270
+	 * retrieves encryption keys from db
271
+	 *
272
+	 * @return array
273
+	 * @throws Exception
274
+	 * @throws RuntimeException
275
+	 */
276
+	protected function retrieveEncryptionKeys()
277
+	{
278
+		// if encryption key has not been set
279
+		if (empty($this->encryption_keys)) {
280
+			// retrieve encryption_key from db
281
+			$this->encryption_keys = get_option($this->encryption_keys_option_name, null);
282
+			// WHAT?? No encryption keys in the db ??
283
+			if ($this->encryption_keys === null) {
284
+				$this->encryption_keys = [];
285
+				// let's create the default key and save it
286
+				$new_key                                                   = $this->generateEncryptionKey();
287
+				$this->encryption_keys[ $this->default_encryption_key_id ] = $new_key;
288
+				if (! $this->saveEncryptionKeys(true)) {
289
+					throw new RuntimeException(
290
+						sprintf(
291
+							esc_html__(
292
+								'Failed to save the "%1$s" encryption keys array to the database.',
293
+								'event_espresso'
294
+							),
295
+							$this->encryption_keys_option_name
296
+						)
297
+					);
298
+				}
299
+			}
300
+		}
301
+		return $this->encryption_keys;
302
+	}
303
+
304
+
305
+	/**
306
+	 * saves encryption keys from db
307
+	 *
308
+	 * @return bool
309
+	 */
310
+	protected function saveEncryptionKeys($initialize = false)
311
+	{
312
+		return $initialize
313
+			? add_option($this->encryption_keys_option_name, $this->encryption_keys, '', false)
314
+			: update_option($this->encryption_keys_option_name, $this->encryption_keys, false);
315
+	}
316 316
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
                 )
98 98
             );
99 99
         }
100
-        $this->encryption_keys[ $encryption_key_identifier ] = $encryption_key ?: $this->generateEncryptionKey();
100
+        $this->encryption_keys[$encryption_key_identifier] = $encryption_key ?: $this->generateEncryptionKey();
101 101
         return $this->saveEncryptionKeys();
102 102
     }
103 103
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     {
115 115
         // ensure keys are loaded
116 116
         $this->retrieveEncryptionKeys();
117
-        return isset($this->encryption_keys[ $encryption_key_identifier ]);
117
+        return isset($this->encryption_keys[$encryption_key_identifier]);
118 118
     }
119 119
 
120 120
 
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
     {
132 132
         $encryption_key_identifier = $encryption_key_identifier ?: $this->default_encryption_key_id;
133 133
         // if encryption key has not been set
134
-        if (! $this->encryptionKeyExists($encryption_key_identifier)) {
134
+        if ( ! $this->encryptionKeyExists($encryption_key_identifier)) {
135 135
             if ($generate) {
136 136
                 $this->addEncryptionKey($encryption_key_identifier);
137 137
             } else {
138
-                if (! $throw_exception) {
138
+                if ( ! $throw_exception) {
139 139
                     return '';
140 140
                 }
141 141
                 throw new OutOfBoundsException(
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
                 );
147 147
             }
148 148
         }
149
-        return $this->encryption_keys[ $encryption_key_identifier ];
149
+        return $this->encryption_keys[$encryption_key_identifier];
150 150
     }
151 151
 
152 152
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
         $iterations    = ceil($this->key_length / 40);
191 191
         $random_string = '';
192 192
         for ($i = 0; $i < $iterations; $i++) {
193
-            $random_string .= sha1(microtime(true) . mt_rand(10000, 90000));
193
+            $random_string .= sha1(microtime(true).mt_rand(10000, 90000));
194 194
         }
195 195
         $random_string = (string) substr($random_string, 0, $this->key_length);
196 196
         return $this->base64_encoder->encodeString($random_string);
@@ -258,10 +258,10 @@  discard block
 block discarded – undo
258 258
     public function removeEncryptionKey($encryption_key_identifier = '')
259 259
     {
260 260
         // if encryption key has not been set
261
-        if (! $this->encryptionKeyExists($encryption_key_identifier)) {
261
+        if ( ! $this->encryptionKeyExists($encryption_key_identifier)) {
262 262
             return 0;
263 263
         }
264
-        unset($this->encryption_keys[ $encryption_key_identifier ]);
264
+        unset($this->encryption_keys[$encryption_key_identifier]);
265 265
         return $this->saveEncryptionKeys() ? 1 : -1;
266 266
     }
267 267
 
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
                 $this->encryption_keys = [];
285 285
                 // let's create the default key and save it
286 286
                 $new_key                                                   = $this->generateEncryptionKey();
287
-                $this->encryption_keys[ $this->default_encryption_key_id ] = $new_key;
288
-                if (! $this->saveEncryptionKeys(true)) {
287
+                $this->encryption_keys[$this->default_encryption_key_id] = $new_key;
288
+                if ( ! $this->saveEncryptionKeys(true)) {
289 289
                     throw new RuntimeException(
290 290
                         sprintf(
291 291
                             esc_html__(
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/content-espresso_venues-thumbnail.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
3 3
 
4 4
 global $post;
5 5
 
6
-do_action( 'AHEE__content_espresso_venues_template__before_featured_img', $post );
6
+do_action('AHEE__content_espresso_venues_template__before_featured_img', $post);
7 7
 
8
-if ( has_post_thumbnail( $post->ID )) :
9
-	if ( $img_ID = get_post_thumbnail_id( $post->ID )) :
10
-		if ( $featured_img = wp_get_attachment_image_src( $img_ID, 'large' )) :
11
-			$caption = get_post( get_post( $img_ID ))->post_excerpt;
8
+if (has_post_thumbnail($post->ID)) :
9
+	if ($img_ID = get_post_thumbnail_id($post->ID)) :
10
+		if ($featured_img = wp_get_attachment_image_src($img_ID, 'large')) :
11
+			$caption = get_post(get_post($img_ID))->post_excerpt;
12 12
 			$wrap_class .= ' has-img';
13 13
 			?>
14 14
 <div id="ee-venue-img-dv-<?php echo esc_attr($post->ID); ?>" class="ee-venue-img-dv">
@@ -26,5 +26,5 @@  discard block
 block discarded – undo
26 26
 	endif;
27 27
 endif;
28 28
 ?>		
29
-<?php do_action( 'AHEE__content_espresso_venues_template__after_featured_img', $post );?>
29
+<?php do_action('AHEE__content_espresso_venues_template__after_featured_img', $post); ?>
30 30
 <!-- .venue-content -->
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/content-espresso_events-details.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -13,20 +13,20 @@
 block discarded – undo
13 13
 	    <?php if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : ?>
14 14
 	    <span class="comments-link">
15 15
         <?php comments_popup_link(
16
-            esc_html__( 'Leave a comment', 'event_espresso' ),
17
-            esc_html__( '1 Comment', 'event_espresso' ),
18
-            esc_html__( '% Comments', 'event_espresso' )
19
-        ); ?>
16
+			esc_html__( 'Leave a comment', 'event_espresso' ),
17
+			esc_html__( '1 Comment', 'event_espresso' ),
18
+			esc_html__( '% Comments', 'event_espresso' )
19
+		); ?>
20 20
         </span>
21 21
 
22 22
         <?php
23
-            endif;
24
-            edit_post_link(
25
-                esc_html__( 'Edit', 'event_espresso' ),
26
-                '<span class="edit-link">',
27
-                '</span>'
28
-            );
29
-        ?>
23
+			endif;
24
+			edit_post_link(
25
+				esc_html__( 'Edit', 'event_espresso' ),
26
+				'<span class="edit-link">',
27
+				'</span>'
28
+			);
29
+		?>
30 30
 	</div>
31 31
 
32 32
 <?php endif;
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -4,27 +4,27 @@  discard block
 block discarded – undo
4 4
 <div class="event-content">
5 5
 <?php use EventEspresso\core\services\request\sanitizers\AllowedTags;
6 6
 
7
-if ( apply_filters( 'FHEE__content_espresso_events_details_template__display_entry_meta', TRUE )): ?>
7
+if (apply_filters('FHEE__content_espresso_events_details_template__display_entry_meta', TRUE)): ?>
8 8
 
9 9
 	<div class="entry-meta">
10 10
 
11 11
 		<span class="tags-links">
12
-            <?php espresso_event_categories( $post->ID, TRUE, TRUE ); ?>
12
+            <?php espresso_event_categories($post->ID, TRUE, TRUE); ?>
13 13
         </span>
14 14
 
15
-	    <?php if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : ?>
15
+	    <?php if ( ! post_password_required() && (comments_open() || get_comments_number())) : ?>
16 16
 	    <span class="comments-link">
17 17
         <?php comments_popup_link(
18
-            esc_html__( 'Leave a comment', 'event_espresso' ),
19
-            esc_html__( '1 Comment', 'event_espresso' ),
20
-            esc_html__( '% Comments', 'event_espresso' )
18
+            esc_html__('Leave a comment', 'event_espresso'),
19
+            esc_html__('1 Comment', 'event_espresso'),
20
+            esc_html__('% Comments', 'event_espresso')
21 21
         ); ?>
22 22
         </span>
23 23
 
24 24
         <?php
25 25
             endif;
26 26
             edit_post_link(
27
-                esc_html__( 'Edit', 'event_espresso' ),
27
+                esc_html__('Edit', 'event_espresso'),
28 28
                 '<span class="edit-link">',
29 29
                 '</span>'
30 30
             );
@@ -32,25 +32,25 @@  discard block
 block discarded – undo
32 32
 	</div>
33 33
 
34 34
 <?php endif;
35
-	$event_phone = espresso_event_phone( $post->ID, FALSE );
35
+	$event_phone = espresso_event_phone($post->ID, FALSE);
36 36
 
37
-	if ( $event_phone != '' ) : ?>
37
+	if ($event_phone != '') : ?>
38 38
 	<p class="event-phone">
39 39
 		<span class="small-text">
40
-            <strong><?php esc_html_e( 'Event Phone:', 'event_espresso' ); ?> </strong>
40
+            <strong><?php esc_html_e('Event Phone:', 'event_espresso'); ?> </strong>
41 41
         </span>
42 42
         <?php echo wp_kses($event_phone, AllowedTags::getAllowedTags()); ?>
43 43
 	</p>
44
-<?php endif;  ?>
44
+<?php endif; ?>
45 45
 
46 46
 <?php
47
-	if ( apply_filters( 'FHEE__content_espresso_events_details_template__display_the_content', true ) ) {
48
-		do_action( 'AHEE_event_details_before_the_content', $post );
47
+	if (apply_filters('FHEE__content_espresso_events_details_template__display_the_content', true)) {
48
+		do_action('AHEE_event_details_before_the_content', $post);
49 49
 		echo apply_filters(
50 50
 			'FHEE__content_espresso_events_details_template__the_content',
51
-			espresso_event_content_or_excerpt( 55, null, false ) 
51
+			espresso_event_content_or_excerpt(55, null, false) 
52 52
 		);
53
-		do_action( 'AHEE_event_details_after_the_content', $post );
53
+		do_action('AHEE_event_details_after_the_content', $post);
54 54
 	}
55 55
  ?>
56 56
 </div>
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/content-espresso_venues-location.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php //echo '<h1>' . __FILE__ . '</h1>'; 
2 2
 global $post; 
3
-if ( espresso_venue_has_address( $post->ID )) :
3
+if (espresso_venue_has_address($post->ID)) :
4 4
 ?>
5 5
 <div class="venue-location">
6 6
 	
7 7
 	<h3 class="venue-address-h3 ee-venue-h3">
8
-		<span class="dashicons dashicons-location-alt"></span><?php esc_html_e( 'Location', 'event_espresso' ); ?>
8
+		<span class="dashicons dashicons-location-alt"></span><?php esc_html_e('Location', 'event_espresso'); ?>
9 9
 	</h3>
10
-	<span class="small-text"><strong><?php esc_html_e( 'Address:', 'event_espresso' ); ?></strong></span><?php espresso_venue_address( 'inline', $post->ID ); ?>
10
+	<span class="small-text"><strong><?php esc_html_e('Address:', 'event_espresso'); ?></strong></span><?php espresso_venue_address('inline', $post->ID); ?>
11 11
 	<div class="clear"></div>
12 12
 
13
-	<div class="venue-gmap"><?php espresso_venue_gmap( $post->ID ); ?></div>
13
+	<div class="venue-gmap"><?php espresso_venue_gmap($post->ID); ?></div>
14 14
 	<div class="clear"></div>
15 15
 	
16 16
 </div>
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/content-espresso_events-venues.php 2 patches
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,8 +51,11 @@  discard block
 block discarded – undo
51 51
 		<?php echo do_shortcode( $venue_description ); ?>
52 52
 	</p>
53 53
 		<?php endif;  ?>
54
-	<?php else : ?>
55
-		<?php $venue_excerpt = espresso_venue_excerpt( $VNU_ID, FALSE ); ?>
54
+	<?php else {
55
+	: ?>
56
+		<?php $venue_excerpt = espresso_venue_excerpt( $VNU_ID, FALSE );
57
+}
58
+?>
56 59
 		<?php if ( $venue_excerpt ) : ?>
57 60
 	<p>
58 61
 		<strong><?php esc_html_e( 'Description:', 'event_espresso' ); ?></strong><br/>
@@ -64,12 +67,15 @@  discard block
 block discarded – undo
64 67
 <!-- .espresso-venue-dv -->
65 68
 <?php
66 69
 do_action( 'AHEE_event_details_after_venue_details', $post );
67
-else :
70
+else {
71
+	:
68 72
 	if ( espresso_venue_is_password_protected() ) :
69 73
 ?>
70 74
 	<div class="espresso-venue-dv  espresso-password-protected-venue-dv" >
71 75
 		<h3 class="event-venues-h3 ee-event-h3">
72
-			<?php esc_html_e( 'Location', 'event_espresso' );?>
76
+			<?php esc_html_e( 'Location', 'event_espresso' );
77
+}
78
+?>
73 79
 		</h3>
74 80
 		<?php echo espresso_password_protected_venue_form(); ?>
75 81
 	</div>
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -3,75 +3,75 @@
 block discarded – undo
3 3
 use EventEspresso\core\services\request\sanitizers\AllowedTags;
4 4
 
5 5
 if (
6
-	( is_single() && espresso_display_venue_in_event_details() )
7
-	|| ( is_archive() && espresso_display_venue_in_event_list() )
6
+	(is_single() && espresso_display_venue_in_event_details())
7
+	|| (is_archive() && espresso_display_venue_in_event_list())
8 8
 ) :
9 9
 	global $post;
10
-	do_action( 'AHEE_event_details_before_venue_details', $post );
11
-	$venue_name = espresso_venue_name( 0, 'details', FALSE );
12
-	if ( empty( $venue_name ) && espresso_is_venue_private() ) {
13
-		do_action( 'AHEE_event_details_after_venue_details', $post );
10
+	do_action('AHEE_event_details_before_venue_details', $post);
11
+	$venue_name = espresso_venue_name(0, 'details', FALSE);
12
+	if (empty($venue_name) && espresso_is_venue_private()) {
13
+		do_action('AHEE_event_details_after_venue_details', $post);
14 14
 		return '';
15 15
 	}
16 16
 ?>
17 17
 
18 18
 <div class="espresso-venue-dv<?php echo espresso_is_venue_private() ? ' espresso-private-venue-dv' : ''; ?>">
19 19
 	<h4>
20
-        <strong><?php esc_html_e( 'Venue:', 'event_espresso' ); ?></strong>&nbsp;&nbsp;
20
+        <strong><?php esc_html_e('Venue:', 'event_espresso'); ?></strong>&nbsp;&nbsp;
21 21
         <strong> <?php echo wp_kses($venue_name, AllowedTags::getAllowedTags()); ?></strong>
22 22
     </h4>
23 23
 	<p><span class="smaller-text tags-links"><?php echo espresso_venue_categories(); ?></span></p>
24
-<?php  if ( $venue_phone = espresso_venue_phone( $post->ID, FALSE )) : ?>
24
+<?php  if ($venue_phone = espresso_venue_phone($post->ID, FALSE)) : ?>
25 25
 	<p>
26 26
 		<span class="small-text">
27
-            <strong><?php esc_html_e( 'Venue Phone:', 'event_espresso' ); ?></strong>
27
+            <strong><?php esc_html_e('Venue Phone:', 'event_espresso'); ?></strong>
28 28
         </span>
29 29
         <?php echo wp_kses($venue_phone, AllowedTags::getAllowedTags()); ?>
30 30
 	</p>
31
-<?php endif;  ?>
32
-<?php if ( $venue_website = espresso_venue_website( $post->ID, FALSE )) : ?>
31
+<?php endif; ?>
32
+<?php if ($venue_website = espresso_venue_website($post->ID, FALSE)) : ?>
33 33
 	<p>
34 34
 		<span class="small-text">
35
-            <strong><?php esc_html_e( 'Venue Website:', 'event_espresso' ); ?></strong>
35
+            <strong><?php esc_html_e('Venue Website:', 'event_espresso'); ?></strong>
36 36
         </span>
37 37
         <?php echo wp_kses($venue_website, AllowedTags::getAllowedTags()); ?>
38 38
 	</p>
39 39
 <?php endif; ?>
40
-<?php  if ( espresso_venue_has_address( $post->ID )) : ?>
41
-	<strong><span class="dashicons dashicons-location-alt"></span><?php esc_html_e( 'Address:', 'event_espresso' ); ?></strong>
42
-	<?php espresso_venue_address( 'inline' ); // already escaped ?>
43
-	<?php espresso_venue_gmap( $post->ID ); // already escaped ?>
40
+<?php  if (espresso_venue_has_address($post->ID)) : ?>
41
+	<strong><span class="dashicons dashicons-location-alt"></span><?php esc_html_e('Address:', 'event_espresso'); ?></strong>
42
+	<?php espresso_venue_address('inline'); // already escaped ?>
43
+	<?php espresso_venue_gmap($post->ID); // already escaped ?>
44 44
 	<div class="clear"><br/></div>
45
-<?php endif;  ?>
45
+<?php endif; ?>
46 46
 
47
-	<?php $VNU_ID = espresso_venue_id( $post->ID ); ?>
48
-	<?php if ( is_single() ) : ?>
49
-		<?php $venue_description = espresso_venue_description( $VNU_ID, FALSE ); ?>
50
-		<?php if ( $venue_description ) : ?>
47
+	<?php $VNU_ID = espresso_venue_id($post->ID); ?>
48
+	<?php if (is_single()) : ?>
49
+		<?php $venue_description = espresso_venue_description($VNU_ID, FALSE); ?>
50
+		<?php if ($venue_description) : ?>
51 51
 	<p>
52
-		<strong><?php esc_html_e( 'Description:', 'event_espresso' ); ?></strong><br/>
53
-		<?php echo do_shortcode( $venue_description ); ?>
52
+		<strong><?php esc_html_e('Description:', 'event_espresso'); ?></strong><br/>
53
+		<?php echo do_shortcode($venue_description); ?>
54 54
 	</p>
55
-		<?php endif;  ?>
55
+		<?php endif; ?>
56 56
 	<?php else : ?>
57
-		<?php $venue_excerpt = espresso_venue_excerpt( $VNU_ID, FALSE ); ?>
58
-		<?php if ( $venue_excerpt ) : ?>
57
+		<?php $venue_excerpt = espresso_venue_excerpt($VNU_ID, FALSE); ?>
58
+		<?php if ($venue_excerpt) : ?>
59 59
 	<p>
60
-		<strong><?php esc_html_e( 'Description:', 'event_espresso' ); ?></strong><br/>
60
+		<strong><?php esc_html_e('Description:', 'event_espresso'); ?></strong><br/>
61 61
 		<?php echo wp_kses($venue_excerpt, AllowedTags::getAllowedTags()); ?>
62 62
 	</p>
63
-			<?php endif;  ?>
64
-		<?php endif;  ?>
63
+			<?php endif; ?>
64
+		<?php endif; ?>
65 65
 </div>
66 66
 <!-- .espresso-venue-dv -->
67 67
 <?php
68
-do_action( 'AHEE_event_details_after_venue_details', $post );
68
+do_action('AHEE_event_details_after_venue_details', $post);
69 69
 else :
70
-	if ( espresso_venue_is_password_protected() ) :
70
+	if (espresso_venue_is_password_protected()) :
71 71
 ?>
72 72
 	<div class="espresso-venue-dv  espresso-password-protected-venue-dv" >
73 73
 		<h3 class="event-venues-h3 ee-event-h3">
74
-			<?php esc_html_e( 'Location', 'event_espresso' );?>
74
+			<?php esc_html_e('Location', 'event_espresso'); ?>
75 75
 		</h3>
76 76
 		<?php echo espresso_password_protected_venue_form(); ?>
77 77
 	</div>
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/content-espresso_events-header.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@
 block discarded – undo
7 7
 	<?php echo "<{$tag}  id=\"event-details-{$tag}-{$post->ID}\" class=\"entry-title\">"; ?>
8 8
 		<a class="ee-event-header-lnk"
9 9
            href="<?php the_permalink(); ?>"
10
-           <?php echo \EED_Events_Archive::link_target();?>
10
+           <?php echo \EED_Events_Archive::link_target(); ?>
11 11
         >
12 12
             <?php the_title(); ?>
13 13
         </a>
14 14
 	<?php echo "</{$tag}>"; ?>
15
-	<?php if ( ! is_archive() && has_excerpt( $post->ID )): the_excerpt(); endif;?>
15
+	<?php if ( ! is_archive() && has_excerpt($post->ID)): the_excerpt(); endif; ?>
16 16
 </header>
Please login to merge, or discard this patch.
ui/blocks/event-attendees.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -13,25 +13,25 @@  discard block
 block discarded – undo
13 13
 <div id="ee-block-event-attendees" class="ee-core-blocks event-espresso-blocks event-attendees">
14 14
     <ul>
15 15
         <?php
16
-        foreach ($attendees as $attendee) {
17
-            $attendee_name = esc_html($attendee->full_name());
16
+		foreach ($attendees as $attendee) {
17
+			$attendee_name = esc_html($attendee->full_name());
18 18
 
19
-            $gravatar = $attributes['showGravatar']
20
-                ? get_avatar_url(
21
-                    $attendee->email(),
22
-                    array(
23
-                        'width'   => $attributes['avatarSize'],
24
-                        'height'  => $attributes['avatarSize']
25
-                    )
26
-                )
27
-                : '';
19
+			$gravatar = $attributes['showGravatar']
20
+				? get_avatar_url(
21
+					$attendee->email(),
22
+					array(
23
+						'width'   => $attributes['avatarSize'],
24
+						'height'  => $attributes['avatarSize']
25
+					)
26
+				)
27
+				: '';
28 28
 
29
-            $gravatar_class = $attributes['avatarClass']
30
-                ? $attributes['avatarClass'] . ' contact-avatar-img avatar'
31
-                : 'contact-avatar-img avatar';
29
+			$gravatar_class = $attributes['avatarClass']
30
+				? $attributes['avatarClass'] . ' contact-avatar-img avatar'
31
+				: 'contact-avatar-img avatar';
32 32
 
33
-            $gravatar = $gravatar !== ''
34
-                ? '
33
+			$gravatar = $gravatar !== ''
34
+				? '
35 35
                 <div class="contact-image-wrap-div">
36 36
                     <img class="' . esc_attr($gravatar_class) . '"
37 37
                          width="' . esc_attr($attributes['avatarSize']) . '"
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
                          alt="contact avatar"
41 41
                      >
42 42
                  </div>'
43
-                : '';
43
+				: '';
44 44
 
45
-            echo "
45
+			echo "
46 46
             <li>
47 47
                 {$gravatar}<span>{$attendee_name}</span>
48 48
             </li>";
49
-        }
50
-        ?>
49
+		}
50
+		?>
51 51
     </ul>
52 52
 </div>
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,16 +27,16 @@
 block discarded – undo
27 27
                 : '';
28 28
 
29 29
             $gravatar_class = $attributes['avatarClass']
30
-                ? $attributes['avatarClass'] . ' contact-avatar-img avatar'
30
+                ? $attributes['avatarClass'].' contact-avatar-img avatar'
31 31
                 : 'contact-avatar-img avatar';
32 32
 
33 33
             $gravatar = $gravatar !== ''
34 34
                 ? '
35 35
                 <div class="contact-image-wrap-div">
36
-                    <img class="' . esc_attr($gravatar_class) . '"
37
-                         width="' . esc_attr($attributes['avatarSize']) . '"
38
-                         height="' . esc_attr($attributes['avatarSize']) . '"
39
-                         src="' . esc_url_raw($gravatar) . '" 
36
+                    <img class="' . esc_attr($gravatar_class).'"
37
+                         width="' . esc_attr($attributes['avatarSize']).'"
38
+                         height="' . esc_attr($attributes['avatarSize']).'"
39
+                         src="' . esc_url_raw($gravatar).'" 
40 40
                          alt="contact avatar"
41 41
                      >
42 42
                  </div>'
Please login to merge, or discard this patch.
core/templates/espresso-ajax-notices.template.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <div id="espresso-ajax-loading" style="display:none;">
2 2
     <span class="ee-spinner ee-spin"></span><span style="display:none;">
3 3
         <?php esc_html_e(
4
-            'loading...',
5
-            'event_espresso'
6
-        ); ?></span>
4
+			'loading...',
5
+			'event_espresso'
6
+		); ?></span>
7 7
 </div>
8 8
 
9 9
 <div id="espresso-ajax-notices">
Please login to merge, or discard this patch.