Completed
Branch BUG-10666-add-check-for-iconv (39eca5)
by
unknown
47:19 queued 36:07
created
form_sections/strategies/normalization/EE_Slug_Normalization.strategy.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php if (! defined('EVENT_ESPRESSO_VERSION')) {
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2 2
     exit('No direct script access allowed');
3 3
 }
4 4
 
Please login to merge, or discard this patch.
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if (! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -15,26 +15,26 @@  discard block
 block discarded – undo
15 15
 class EE_Slug_Normalization extends EE_Normalization_Strategy_Base
16 16
 {
17 17
 
18
-    /**
19
-     * @param string $value_to_normalize
20
-     * @return string
21
-     */
22
-    public function normalize($value_to_normalize)
23
-    {
24
-        return sanitize_title($value_to_normalize);
25
-    }
18
+	/**
19
+	 * @param string $value_to_normalize
20
+	 * @return string
21
+	 */
22
+	public function normalize($value_to_normalize)
23
+	{
24
+		return sanitize_title($value_to_normalize);
25
+	}
26 26
 
27 27
 
28 28
 
29
-    /**
30
-     * It's hard to unnormalize this- let's just take a guess
31
-     *
32
-     * @param string $normalized_value
33
-     * @return string
34
-     */
35
-    public function unnormalize($normalized_value)
36
-    {
37
-        return str_replace("-", " ", $normalized_value);
38
-    }
29
+	/**
30
+	 * It's hard to unnormalize this- let's just take a guess
31
+	 *
32
+	 * @param string $normalized_value
33
+	 * @return string
34
+	 */
35
+	public function unnormalize($normalized_value)
36
+	{
37
+		return str_replace("-", " ", $normalized_value);
38
+	}
39 39
 }
40 40
 // End of file EE_Slug_Normalization.strategy.php
Please login to merge, or discard this patch.
strategies/normalization/EE_All_Caps_Normalization.strategy.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php if (! defined('EVENT_ESPRESSO_VERSION')) {
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2 2
     exit('No direct script access allowed');
3 3
 }
4 4
 
Please login to merge, or discard this patch.
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if (! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -16,27 +16,27 @@  discard block
 block discarded – undo
16 16
 class EE_All_Caps_Normalization extends EE_Normalization_Strategy_Base
17 17
 {
18 18
 
19
-    /**
20
-     * @param string $value_to_normalize
21
-     * @return string
22
-     */
23
-    public function normalize($value_to_normalize)
24
-    {
25
-        return strtoupper($value_to_normalize);
26
-    }
27
-
28
-
29
-
30
-    /**
31
-     * It's kinda hard to unnormalize this- we can't determine which parts used to be lowercase
32
-     * so just return it as-is.
33
-     *
34
-     * @param string $normalized_value
35
-     * @return string
36
-     */
37
-    public function unnormalize($normalized_value)
38
-    {
39
-        return $normalized_value;
40
-    }
19
+	/**
20
+	 * @param string $value_to_normalize
21
+	 * @return string
22
+	 */
23
+	public function normalize($value_to_normalize)
24
+	{
25
+		return strtoupper($value_to_normalize);
26
+	}
27
+
28
+
29
+
30
+	/**
31
+	 * It's kinda hard to unnormalize this- we can't determine which parts used to be lowercase
32
+	 * so just return it as-is.
33
+	 *
34
+	 * @param string $normalized_value
35
+	 * @return string
36
+	 */
37
+	public function unnormalize($normalized_value)
38
+	{
39
+		return $normalized_value;
40
+	}
41 41
 
42 42
 }
43 43
\ No newline at end of file
Please login to merge, or discard this patch.
strategies/normalization/EE_Boolean_Normalization.strategy.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if (! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -18,28 +18,28 @@  discard block
 block discarded – undo
18 18
 class EE_Boolean_Normalization extends EE_Normalization_Strategy_Base
19 19
 {
20 20
 
21
-    /**
22
-     * @param string | int | bool $value_to_normalize
23
-     * @return boolean
24
-     */
25
-    public function normalize($value_to_normalize)
26
-    {
27
-        return filter_var($value_to_normalize, FILTER_VALIDATE_BOOLEAN);
28
-    }
21
+	/**
22
+	 * @param string | int | bool $value_to_normalize
23
+	 * @return boolean
24
+	 */
25
+	public function normalize($value_to_normalize)
26
+	{
27
+		return filter_var($value_to_normalize, FILTER_VALIDATE_BOOLEAN);
28
+	}
29 29
 
30 30
 
31 31
 
32
-    /**
33
-     * @param boolean $normalized_value
34
-     * @return string
35
-     */
36
-    public function unnormalize($normalized_value)
37
-    {
38
-        if ($normalized_value) {
39
-            return '1';
40
-        } else {
41
-            return '0';
42
-        }
43
-    }
32
+	/**
33
+	 * @param boolean $normalized_value
34
+	 * @return string
35
+	 */
36
+	public function unnormalize($normalized_value)
37
+	{
38
+		if ($normalized_value) {
39
+			return '1';
40
+		} else {
41
+			return '0';
42
+		}
43
+	}
44 44
 }
45 45
 // End of file EE_Boolean_Normalization.strategy.php
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php if (! defined('EVENT_ESPRESSO_VERSION')) {
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2 2
     exit('No direct script access allowed');
3 3
 }
4 4
 
Please login to merge, or discard this patch.
form_sections/strategies/normalization/EE_Text_Normalization.strategy.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if (! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -15,39 +15,39 @@  discard block
 block discarded – undo
15 15
 class EE_Text_Normalization extends EE_Normalization_Strategy_Base
16 16
 {
17 17
 
18
-    /**
19
-     * @param string $value_to_normalize
20
-     * @return array|mixed|string
21
-     */
22
-    public function normalize($value_to_normalize)
23
-    {
24
-        if (is_array($value_to_normalize)) {
25
-            return (string)array_shift($value_to_normalize);
26
-        }
27
-        // consider `"null"` values to be equivalent to null.
28
-        if ($value_to_normalize === '' || $value_to_normalize === null) {
29
-            return null;
30
-        }
31
-        return (string)$value_to_normalize;
32
-    }
18
+	/**
19
+	 * @param string $value_to_normalize
20
+	 * @return array|mixed|string
21
+	 */
22
+	public function normalize($value_to_normalize)
23
+	{
24
+		if (is_array($value_to_normalize)) {
25
+			return (string)array_shift($value_to_normalize);
26
+		}
27
+		// consider `"null"` values to be equivalent to null.
28
+		if ($value_to_normalize === '' || $value_to_normalize === null) {
29
+			return null;
30
+		}
31
+		return (string)$value_to_normalize;
32
+	}
33 33
 
34 34
 
35 35
 
36
-    /**
37
-     * IF its a string in PHP, it will be a string in the HTML form. easy
38
-     *
39
-     * @param string $normalized_value
40
-     * @return string
41
-     */
42
-    public function unnormalize($normalized_value)
43
-    {
44
-        //account for default "select here" option values
45
-        if ($normalized_value === null) {
46
-            return '';
47
-        }
48
-        //double-check it's a string. It's possible this value was a question option that happened to be a numeric
49
-        //string, in which case PHP has automatically converted it to an integer!
50
-        return (string)$normalized_value;
51
-    }
36
+	/**
37
+	 * IF its a string in PHP, it will be a string in the HTML form. easy
38
+	 *
39
+	 * @param string $normalized_value
40
+	 * @return string
41
+	 */
42
+	public function unnormalize($normalized_value)
43
+	{
44
+		//account for default "select here" option values
45
+		if ($normalized_value === null) {
46
+			return '';
47
+		}
48
+		//double-check it's a string. It's possible this value was a question option that happened to be a numeric
49
+		//string, in which case PHP has automatically converted it to an integer!
50
+		return (string)$normalized_value;
51
+	}
52 52
 }
53 53
 // End of file EE_Text_Normalization.strategy.php
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (! defined('EVENT_ESPRESSO_VERSION')) {
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2 2
     exit('No direct script access allowed');
3 3
 }
4 4
 
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
     public function normalize($value_to_normalize)
23 23
     {
24 24
         if (is_array($value_to_normalize)) {
25
-            return (string)array_shift($value_to_normalize);
25
+            return (string) array_shift($value_to_normalize);
26 26
         }
27 27
         // consider `"null"` values to be equivalent to null.
28 28
         if ($value_to_normalize === '' || $value_to_normalize === null) {
29 29
             return null;
30 30
         }
31
-        return (string)$value_to_normalize;
31
+        return (string) $value_to_normalize;
32 32
     }
33 33
 
34 34
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         }
48 48
         //double-check it's a string. It's possible this value was a question option that happened to be a numeric
49 49
         //string, in which case PHP has automatically converted it to an integer!
50
-        return (string)$normalized_value;
50
+        return (string) $normalized_value;
51 51
     }
52 52
 }
53 53
 // End of file EE_Text_Normalization.strategy.php
Please login to merge, or discard this patch.
strategies/normalization/EE_Normalization_Strategy_Base.strategy.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if (! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -14,60 +14,60 @@  discard block
 block discarded – undo
14 14
 abstract class EE_Normalization_Strategy_Base extends EE_Form_Input_Strategy_Base
15 15
 {
16 16
 
17
-    /**
18
-     * Takes the sanitized value for the input and casts it into the correct PHP type.
19
-     * Eg, turns it into an int, float, string, boolean, datetime, etc. The validation
20
-     * strategy should be able to depend on the normalized value being of the correct type.
21
-     * If the normalized value passes validation, the normalized value is what other code
22
-     * will operate on. If the sanitized value cannot be normalized, this method should either
23
-     * add a validation error onto the input, or wrangle the input into a format that can be normalized
24
-     * (eg, for a date input, if the user enters "2014/100/100", you can either add an error stating
25
-     * "hey! 2014/100/100 is not a valid date!", or simply convert it into a valid date like "2014/12/31".
26
-     * For this case, I'd prefer the former. But there may be cases where you'd just rather correct it for them)
27
-     *
28
-     * @param string $value_to_normalize it should always be a string. If the input receives an array, then the
29
-     *                                   validation strategy should be called on array elements, not on the entire array
30
-     * @return mixed the normalized value
31
-     */
32
-    abstract public function normalize($value_to_normalize);
17
+	/**
18
+	 * Takes the sanitized value for the input and casts it into the correct PHP type.
19
+	 * Eg, turns it into an int, float, string, boolean, datetime, etc. The validation
20
+	 * strategy should be able to depend on the normalized value being of the correct type.
21
+	 * If the normalized value passes validation, the normalized value is what other code
22
+	 * will operate on. If the sanitized value cannot be normalized, this method should either
23
+	 * add a validation error onto the input, or wrangle the input into a format that can be normalized
24
+	 * (eg, for a date input, if the user enters "2014/100/100", you can either add an error stating
25
+	 * "hey! 2014/100/100 is not a valid date!", or simply convert it into a valid date like "2014/12/31".
26
+	 * For this case, I'd prefer the former. But there may be cases where you'd just rather correct it for them)
27
+	 *
28
+	 * @param string $value_to_normalize it should always be a string. If the input receives an array, then the
29
+	 *                                   validation strategy should be called on array elements, not on the entire array
30
+	 * @return mixed the normalized value
31
+	 */
32
+	abstract public function normalize($value_to_normalize);
33 33
 
34 34
 
35 35
 
36
-    /**
37
-     * Identical to normalize, except normalize_one() CANNOT be passed an array and
38
-     * never returns an array. Useful if the normalization strategy converts between arrays
39
-     *
40
-     * @param string $individual_item_to_normalize
41
-     * @return mixed
42
-     */
43
-    public function normalize_one($individual_item_to_normalize)
44
-    {
45
-        return $this->normalize($individual_item_to_normalize);
46
-    }
36
+	/**
37
+	 * Identical to normalize, except normalize_one() CANNOT be passed an array and
38
+	 * never returns an array. Useful if the normalization strategy converts between arrays
39
+	 *
40
+	 * @param string $individual_item_to_normalize
41
+	 * @return mixed
42
+	 */
43
+	public function normalize_one($individual_item_to_normalize)
44
+	{
45
+		return $this->normalize($individual_item_to_normalize);
46
+	}
47 47
 
48 48
 
49 49
 
50
-    /**
51
-     * Takes the normalized value (for an Yes_No_Input this could be TRUE or FALSE), and converts it into
52
-     * the value you would use in the html form (for a Yes_No_Input this could be '1' or '0').
53
-     *
54
-     * @param $normalized_value
55
-     * @return array|string the 'raw' value as used in the form, usually a string or array of strings.
56
-     */
57
-    abstract public function unnormalize($normalized_value);
50
+	/**
51
+	 * Takes the normalized value (for an Yes_No_Input this could be TRUE or FALSE), and converts it into
52
+	 * the value you would use in the html form (for a Yes_No_Input this could be '1' or '0').
53
+	 *
54
+	 * @param $normalized_value
55
+	 * @return array|string the 'raw' value as used in the form, usually a string or array of strings.
56
+	 */
57
+	abstract public function unnormalize($normalized_value);
58 58
 
59 59
 
60 60
 
61
-    /**
62
-     * Normally the same as unnormalize, except it CANNOT be passed an array and
63
-     * ALWAYS returns a string
64
-     *
65
-     * @param mixed $individual_item_to_unnormalize NOT an array
66
-     * @return string
67
-     */
68
-    public function unnormalize_one($individual_item_to_unnormalize)
69
-    {
70
-        return $this->unnormalize($individual_item_to_unnormalize);
71
-    }
61
+	/**
62
+	 * Normally the same as unnormalize, except it CANNOT be passed an array and
63
+	 * ALWAYS returns a string
64
+	 *
65
+	 * @param mixed $individual_item_to_unnormalize NOT an array
66
+	 * @return string
67
+	 */
68
+	public function unnormalize_one($individual_item_to_unnormalize)
69
+	{
70
+		return $this->unnormalize($individual_item_to_unnormalize);
71
+	}
72 72
 }
73 73
 // End of file EE_Normalization_Strategy_Base.strategy.php
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php if (! defined('EVENT_ESPRESSO_VERSION')) {
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2 2
     exit('No direct script access allowed');
3 3
 }
4 4
 
Please login to merge, or discard this patch.
core/db_models/fields/EE_Post_Content_Field.php 2 patches
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -7,133 +7,133 @@
 block discarded – undo
7 7
  */
8 8
 class EE_Post_Content_Field extends EE_Text_Field_Base
9 9
 {
10
-    static protected $_added_the_content_basic_filters = false;
10
+	static protected $_added_the_content_basic_filters = false;
11 11
 
12
-    /**
13
-     * @param string $table_column
14
-     * @param string $nicename
15
-     * @param bool   $nullable
16
-     * @param null   $default_value
17
-     */
18
-    public function __construct($table_column, $nicename, $nullable, $default_value = null)
19
-    {
20
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
21
-        $this->setSchemaType('object');
22
-    }
12
+	/**
13
+	 * @param string $table_column
14
+	 * @param string $nicename
15
+	 * @param bool   $nullable
16
+	 * @param null   $default_value
17
+	 */
18
+	public function __construct($table_column, $nicename, $nullable, $default_value = null)
19
+	{
20
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
21
+		$this->setSchemaType('object');
22
+	}
23 23
 
24 24
 
25
-    /**
26
-     * removes all tags which a WP Post wouldn't allow in its content normally
27
-     *
28
-     * @param string $value
29
-     * @return string
30
-     */
31
-    function prepare_for_set($value)
32
-    {
33
-        if (! current_user_can('unfiltered_html')) {
34
-            $value = wp_kses("$value", wp_kses_allowed_html('post'));
35
-        }
36
-        return parent::prepare_for_set($value);
37
-    }
25
+	/**
26
+	 * removes all tags which a WP Post wouldn't allow in its content normally
27
+	 *
28
+	 * @param string $value
29
+	 * @return string
30
+	 */
31
+	function prepare_for_set($value)
32
+	{
33
+		if (! current_user_can('unfiltered_html')) {
34
+			$value = wp_kses("$value", wp_kses_allowed_html('post'));
35
+		}
36
+		return parent::prepare_for_set($value);
37
+	}
38 38
 
39
-    function prepare_for_set_from_db($value_found_in_db_for_model_object)
40
-    {
41
-        return $value_found_in_db_for_model_object;
42
-    }
39
+	function prepare_for_set_from_db($value_found_in_db_for_model_object)
40
+	{
41
+		return $value_found_in_db_for_model_object;
42
+	}
43 43
 
44 44
 
45 45
 
46
-    /**
47
-     * Runs the content through `the_content`, or if prepares the content for placing in a form input
48
-     * @param string $value_on_field_to_be_outputted
49
-     * @param string   $schema possible values: 'form_input' or null (if null, will run through 'the_content')
50
-     * @return string
51
-     * @throws EE_Error when WP_DEBUG is on and recursive calling is detected
52
-     */
53
-    public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
54
-    {
55
-        switch($schema){
56
-            case 'form_input':
57
-                return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema);
58
-            case 'the_content':
46
+	/**
47
+	 * Runs the content through `the_content`, or if prepares the content for placing in a form input
48
+	 * @param string $value_on_field_to_be_outputted
49
+	 * @param string   $schema possible values: 'form_input' or null (if null, will run through 'the_content')
50
+	 * @return string
51
+	 * @throws EE_Error when WP_DEBUG is on and recursive calling is detected
52
+	 */
53
+	public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
54
+	{
55
+		switch($schema){
56
+			case 'form_input':
57
+				return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema);
58
+			case 'the_content':
59 59
 
60
-                if(doing_filter( 'the_content')){
61
-                    if( defined('WP_DEBUG') && WP_DEBUG){
62
-                        throw new EE_Error(
63
-                            sprintf(
64
-                                esc_html__('You have recursively called "%1$s" with %2$s set to %3$s which uses "%2$s" filter. You should use it with %2$s "%3$s" instead here.', 'event_espresso'),
65
-                                'EE_Post_Content_Field::prepare_for_pretty_echoing',
66
-                                '$schema',
67
-                                'the_content',
68
-                                'the_content_wp_core_only'
69
-                            )
70
-                        );
71
-                    } else {
72
-                        return $this->prepare_for_pretty_echoing($value_on_field_to_be_outputted, 'the_content_wp_core_only');
73
-                    }
74
-                }
75
-                return apply_filters(
76
-                    'the_content',
77
-                    parent::prepare_for_pretty_echoing(
78
-                        $value_on_field_to_be_outputted,
79
-                        $schema
80
-                    )
81
-                );
82
-            case 'the_content_wp_core_only':
83
-            default:
84
-                self::_ensure_filters_setup();
85
-                return apply_filters(
86
-                    'the_content_wp_core_only',
87
-                    parent::prepare_for_pretty_echoing(
88
-                        $value_on_field_to_be_outputted,
89
-                        $schema
90
-                    )
91
-                );
92
-        }
93
-    }
60
+				if(doing_filter( 'the_content')){
61
+					if( defined('WP_DEBUG') && WP_DEBUG){
62
+						throw new EE_Error(
63
+							sprintf(
64
+								esc_html__('You have recursively called "%1$s" with %2$s set to %3$s which uses "%2$s" filter. You should use it with %2$s "%3$s" instead here.', 'event_espresso'),
65
+								'EE_Post_Content_Field::prepare_for_pretty_echoing',
66
+								'$schema',
67
+								'the_content',
68
+								'the_content_wp_core_only'
69
+							)
70
+						);
71
+					} else {
72
+						return $this->prepare_for_pretty_echoing($value_on_field_to_be_outputted, 'the_content_wp_core_only');
73
+					}
74
+				}
75
+				return apply_filters(
76
+					'the_content',
77
+					parent::prepare_for_pretty_echoing(
78
+						$value_on_field_to_be_outputted,
79
+						$schema
80
+					)
81
+				);
82
+			case 'the_content_wp_core_only':
83
+			default:
84
+				self::_ensure_filters_setup();
85
+				return apply_filters(
86
+					'the_content_wp_core_only',
87
+					parent::prepare_for_pretty_echoing(
88
+						$value_on_field_to_be_outputted,
89
+						$schema
90
+					)
91
+				);
92
+		}
93
+	}
94 94
 
95 95
 
96 96
 
97
-    /**
98
-     * Verifies we've setup the standard WP core filters on  'the_content_wp_core_only' filter
99
-     */
100
-    protected static function _ensure_filters_setup()
101
-    {
102
-        if( !self::$_added_the_content_basic_filters){
103
-            add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'run_shortcode'), 8);
104
-            add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'autoembed'), 8);
105
-            add_filter('the_content_wp_core_only', 'wptexturize', 10);
106
-            add_filter('the_content_wp_core_only', 'wpautop', 10);
107
-            add_filter('the_content_wp_core_only', 'shortcode_unautop', 10);
108
-            add_filter('the_content_wp_core_only', 'prepend_attachment', 10);
109
-            if(function_exists('wp_make_content_images_responsive')) {
110
-                add_filter('the_content_wp_core_only', 'wp_make_content_images_responsive', 10);
111
-            }
112
-            add_filter('the_content_wp_core_only', 'do_shortcode', 11);
113
-            add_filter('the_content_wp_core_only', 'convert_smilies', 20);
114
-            self::$_added_the_content_basic_filters = true;
115
-        }
116
-    }
97
+	/**
98
+	 * Verifies we've setup the standard WP core filters on  'the_content_wp_core_only' filter
99
+	 */
100
+	protected static function _ensure_filters_setup()
101
+	{
102
+		if( !self::$_added_the_content_basic_filters){
103
+			add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'run_shortcode'), 8);
104
+			add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'autoembed'), 8);
105
+			add_filter('the_content_wp_core_only', 'wptexturize', 10);
106
+			add_filter('the_content_wp_core_only', 'wpautop', 10);
107
+			add_filter('the_content_wp_core_only', 'shortcode_unautop', 10);
108
+			add_filter('the_content_wp_core_only', 'prepend_attachment', 10);
109
+			if(function_exists('wp_make_content_images_responsive')) {
110
+				add_filter('the_content_wp_core_only', 'wp_make_content_images_responsive', 10);
111
+			}
112
+			add_filter('the_content_wp_core_only', 'do_shortcode', 11);
113
+			add_filter('the_content_wp_core_only', 'convert_smilies', 20);
114
+			self::$_added_the_content_basic_filters = true;
115
+		}
116
+	}
117 117
 
118 118
 
119 119
 
120
-    public function getSchemaProperties()
121
-    {
122
-        return array(
123
-            'raw' => array(
124
-                'description' =>  sprintf(
125
-                    __('%s - the content as it exists in the database.', 'event_espresso'),
126
-                    $this->get_nicename()
127
-                ),
128
-                'type' => 'string'
129
-            ),
130
-            'rendered' => array(
131
-                'description' =>  sprintf(
132
-                    __('%s - the content rendered for display.', 'event_espresso'),
133
-                    $this->get_nicename()
134
-                ),
135
-                'type' => 'string'
136
-            )
137
-        );
138
-    }
120
+	public function getSchemaProperties()
121
+	{
122
+		return array(
123
+			'raw' => array(
124
+				'description' =>  sprintf(
125
+					__('%s - the content as it exists in the database.', 'event_espresso'),
126
+					$this->get_nicename()
127
+				),
128
+				'type' => 'string'
129
+			),
130
+			'rendered' => array(
131
+				'description' =>  sprintf(
132
+					__('%s - the content rendered for display.', 'event_espresso'),
133
+					$this->get_nicename()
134
+				),
135
+				'type' => 'string'
136
+			)
137
+		);
138
+	}
139 139
 }
140 140
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      */
31 31
     function prepare_for_set($value)
32 32
     {
33
-        if (! current_user_can('unfiltered_html')) {
33
+        if ( ! current_user_can('unfiltered_html')) {
34 34
             $value = wp_kses("$value", wp_kses_allowed_html('post'));
35 35
         }
36 36
         return parent::prepare_for_set($value);
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
54 54
     {
55
-        switch($schema){
55
+        switch ($schema) {
56 56
             case 'form_input':
57 57
                 return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema);
58 58
             case 'the_content':
59 59
 
60
-                if(doing_filter( 'the_content')){
61
-                    if( defined('WP_DEBUG') && WP_DEBUG){
60
+                if (doing_filter('the_content')) {
61
+                    if (defined('WP_DEBUG') && WP_DEBUG) {
62 62
                         throw new EE_Error(
63 63
                             sprintf(
64 64
                                 esc_html__('You have recursively called "%1$s" with %2$s set to %3$s which uses "%2$s" filter. You should use it with %2$s "%3$s" instead here.', 'event_espresso'),
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
      */
100 100
     protected static function _ensure_filters_setup()
101 101
     {
102
-        if( !self::$_added_the_content_basic_filters){
103
-            add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'run_shortcode'), 8);
104
-            add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'autoembed'), 8);
102
+        if ( ! self::$_added_the_content_basic_filters) {
103
+            add_filter('the_content_wp_core_only', array($GLOBALS['wp_embed'], 'run_shortcode'), 8);
104
+            add_filter('the_content_wp_core_only', array($GLOBALS['wp_embed'], 'autoembed'), 8);
105 105
             add_filter('the_content_wp_core_only', 'wptexturize', 10);
106 106
             add_filter('the_content_wp_core_only', 'wpautop', 10);
107 107
             add_filter('the_content_wp_core_only', 'shortcode_unautop', 10);
108 108
             add_filter('the_content_wp_core_only', 'prepend_attachment', 10);
109
-            if(function_exists('wp_make_content_images_responsive')) {
109
+            if (function_exists('wp_make_content_images_responsive')) {
110 110
                 add_filter('the_content_wp_core_only', 'wp_make_content_images_responsive', 10);
111 111
             }
112 112
             add_filter('the_content_wp_core_only', 'do_shortcode', 11);
Please login to merge, or discard this patch.
espresso.php 1 patch
Indentation   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('ABSPATH')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /*
5 5
   Plugin Name:		Event Espresso
@@ -40,243 +40,243 @@  discard block
 block discarded – undo
40 40
  * @since            4.0
41 41
  */
42 42
 if (function_exists('espresso_version')) {
43
-    /**
44
-     *    espresso_duplicate_plugin_error
45
-     *    displays if more than one version of EE is activated at the same time
46
-     */
47
-    function espresso_duplicate_plugin_error()
48
-    {
49
-        ?>
43
+	/**
44
+	 *    espresso_duplicate_plugin_error
45
+	 *    displays if more than one version of EE is activated at the same time
46
+	 */
47
+	function espresso_duplicate_plugin_error()
48
+	{
49
+		?>
50 50
         <div class="error">
51 51
             <p>
52 52
                 <?php echo esc_html__(
53
-                        'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
-                        'event_espresso'
55
-                ); ?>
53
+						'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
+						'event_espresso'
55
+				); ?>
56 56
             </p>
57 57
         </div>
58 58
         <?php
59
-        espresso_deactivate_plugin(plugin_basename(__FILE__));
60
-    }
59
+		espresso_deactivate_plugin(plugin_basename(__FILE__));
60
+	}
61 61
 
62
-    add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
62
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
63 63
 } else {
64
-    define('EE_MIN_PHP_VER_REQUIRED', '5.3.9');
65
-    if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
-        /**
67
-         * espresso_minimum_php_version_error
68
-         *
69
-         * @return void
70
-         */
71
-        function espresso_minimum_php_version_error()
72
-        {
73
-            ?>
64
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.9');
65
+	if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
+		/**
67
+		 * espresso_minimum_php_version_error
68
+		 *
69
+		 * @return void
70
+		 */
71
+		function espresso_minimum_php_version_error()
72
+		{
73
+			?>
74 74
             <div class="error">
75 75
                 <p>
76 76
                     <?php
77
-                    printf(
78
-                            esc_html__(
79
-                                    'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
-                                    'event_espresso'
81
-                            ),
82
-                            EE_MIN_PHP_VER_REQUIRED,
83
-                            PHP_VERSION,
84
-                            '<br/>',
85
-                            '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
-                    );
87
-                    ?>
77
+					printf(
78
+							esc_html__(
79
+									'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
+									'event_espresso'
81
+							),
82
+							EE_MIN_PHP_VER_REQUIRED,
83
+							PHP_VERSION,
84
+							'<br/>',
85
+							'<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
+					);
87
+					?>
88 88
                 </p>
89 89
             </div>
90 90
             <?php
91
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
92
-        }
91
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
92
+		}
93 93
 
94
-        add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
-    } else {
96
-        /**
97
-         * espresso_version
98
-         * Returns the plugin version
99
-         *
100
-         * @return string
101
-         */
102
-        function espresso_version()
103
-        {
104
-            return apply_filters('FHEE__espresso__espresso_version', '4.9.38.rc.043');
105
-        }
94
+		add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
+	} else {
96
+		/**
97
+		 * espresso_version
98
+		 * Returns the plugin version
99
+		 *
100
+		 * @return string
101
+		 */
102
+		function espresso_version()
103
+		{
104
+			return apply_filters('FHEE__espresso__espresso_version', '4.9.38.rc.043');
105
+		}
106 106
 
107
-        // define versions
108
-        define('EVENT_ESPRESSO_VERSION', espresso_version());
109
-        define('EE_MIN_WP_VER_REQUIRED', '4.1');
110
-        define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
111
-        define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
112
-        define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
113
-        //used to be DIRECTORY_SEPARATOR, but that caused issues on windows
114
-        if ( ! defined('DS')) {
115
-            define('DS', '/');
116
-        }
117
-        if ( ! defined('PS')) {
118
-            define('PS', PATH_SEPARATOR);
119
-        }
120
-        if ( ! defined('SP')) {
121
-            define('SP', ' ');
122
-        }
123
-        if ( ! defined('EENL')) {
124
-            define('EENL', "\n");
125
-        }
126
-        define('EE_SUPPORT_EMAIL', '[email protected]');
127
-        // define the plugin directory and URL
128
-        define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
129
-        define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
130
-        define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
131
-        // main root folder paths
132
-        define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS);
133
-        define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS);
134
-        define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS);
135
-        define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS);
136
-        define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS);
137
-        define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS);
138
-        define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS);
139
-        define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS);
140
-        // core system paths
141
-        define('EE_ADMIN', EE_CORE . 'admin' . DS);
142
-        define('EE_CPTS', EE_CORE . 'CPTs' . DS);
143
-        define('EE_CLASSES', EE_CORE . 'db_classes' . DS);
144
-        define('EE_INTERFACES', EE_CORE . 'interfaces' . DS);
145
-        define('EE_BUSINESS', EE_CORE . 'business' . DS);
146
-        define('EE_MODELS', EE_CORE . 'db_models' . DS);
147
-        define('EE_HELPERS', EE_CORE . 'helpers' . DS);
148
-        define('EE_LIBRARIES', EE_CORE . 'libraries' . DS);
149
-        define('EE_TEMPLATES', EE_CORE . 'templates' . DS);
150
-        define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS);
151
-        define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS);
152
-        define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS);
153
-        // gateways
154
-        define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS);
155
-        define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS);
156
-        // asset URL paths
157
-        define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS);
158
-        define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS);
159
-        define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS);
160
-        define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS);
161
-        define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/');
162
-        define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/');
163
-        // define upload paths
164
-        $uploads = wp_upload_dir();
165
-        // define the uploads directory and URL
166
-        define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS);
167
-        define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS);
168
-        // define the templates directory and URL
169
-        define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS);
170
-        define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS);
171
-        // define the gateway directory and URL
172
-        define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS);
173
-        define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS);
174
-        // languages folder/path
175
-        define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS);
176
-        define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS);
177
-        //check for dompdf fonts in uploads
178
-        if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) {
179
-            define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS);
180
-        }
181
-        //ajax constants
182
-        define(
183
-                'EE_FRONT_AJAX',
184
-                isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false
185
-        );
186
-        define(
187
-                'EE_ADMIN_AJAX',
188
-                isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false
189
-        );
190
-        //just a handy constant occasionally needed for finding values representing infinity in the DB
191
-        //you're better to use this than its straight value (currently -1) in case you ever
192
-        //want to change its default value! or find when -1 means infinity
193
-        define('EE_INF_IN_DB', -1);
194
-        define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX);
195
-        define('EE_DEBUG', false);
196
-        // for older WP versions
197
-        if ( ! defined('MONTH_IN_SECONDS')) {
198
-            define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30);
199
-        }
200
-        /**
201
-         *    espresso_plugin_activation
202
-         *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
203
-         */
204
-        function espresso_plugin_activation()
205
-        {
206
-            update_option('ee_espresso_activation', true);
207
-        }
107
+		// define versions
108
+		define('EVENT_ESPRESSO_VERSION', espresso_version());
109
+		define('EE_MIN_WP_VER_REQUIRED', '4.1');
110
+		define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
111
+		define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
112
+		define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
113
+		//used to be DIRECTORY_SEPARATOR, but that caused issues on windows
114
+		if ( ! defined('DS')) {
115
+			define('DS', '/');
116
+		}
117
+		if ( ! defined('PS')) {
118
+			define('PS', PATH_SEPARATOR);
119
+		}
120
+		if ( ! defined('SP')) {
121
+			define('SP', ' ');
122
+		}
123
+		if ( ! defined('EENL')) {
124
+			define('EENL', "\n");
125
+		}
126
+		define('EE_SUPPORT_EMAIL', '[email protected]');
127
+		// define the plugin directory and URL
128
+		define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
129
+		define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
130
+		define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
131
+		// main root folder paths
132
+		define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS);
133
+		define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS);
134
+		define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS);
135
+		define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS);
136
+		define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS);
137
+		define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS);
138
+		define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS);
139
+		define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS);
140
+		// core system paths
141
+		define('EE_ADMIN', EE_CORE . 'admin' . DS);
142
+		define('EE_CPTS', EE_CORE . 'CPTs' . DS);
143
+		define('EE_CLASSES', EE_CORE . 'db_classes' . DS);
144
+		define('EE_INTERFACES', EE_CORE . 'interfaces' . DS);
145
+		define('EE_BUSINESS', EE_CORE . 'business' . DS);
146
+		define('EE_MODELS', EE_CORE . 'db_models' . DS);
147
+		define('EE_HELPERS', EE_CORE . 'helpers' . DS);
148
+		define('EE_LIBRARIES', EE_CORE . 'libraries' . DS);
149
+		define('EE_TEMPLATES', EE_CORE . 'templates' . DS);
150
+		define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS);
151
+		define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS);
152
+		define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS);
153
+		// gateways
154
+		define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS);
155
+		define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS);
156
+		// asset URL paths
157
+		define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS);
158
+		define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS);
159
+		define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS);
160
+		define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS);
161
+		define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/');
162
+		define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/');
163
+		// define upload paths
164
+		$uploads = wp_upload_dir();
165
+		// define the uploads directory and URL
166
+		define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS);
167
+		define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS);
168
+		// define the templates directory and URL
169
+		define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS);
170
+		define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS);
171
+		// define the gateway directory and URL
172
+		define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS);
173
+		define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS);
174
+		// languages folder/path
175
+		define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS);
176
+		define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS);
177
+		//check for dompdf fonts in uploads
178
+		if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) {
179
+			define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS);
180
+		}
181
+		//ajax constants
182
+		define(
183
+				'EE_FRONT_AJAX',
184
+				isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false
185
+		);
186
+		define(
187
+				'EE_ADMIN_AJAX',
188
+				isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false
189
+		);
190
+		//just a handy constant occasionally needed for finding values representing infinity in the DB
191
+		//you're better to use this than its straight value (currently -1) in case you ever
192
+		//want to change its default value! or find when -1 means infinity
193
+		define('EE_INF_IN_DB', -1);
194
+		define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX);
195
+		define('EE_DEBUG', false);
196
+		// for older WP versions
197
+		if ( ! defined('MONTH_IN_SECONDS')) {
198
+			define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30);
199
+		}
200
+		/**
201
+		 *    espresso_plugin_activation
202
+		 *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
203
+		 */
204
+		function espresso_plugin_activation()
205
+		{
206
+			update_option('ee_espresso_activation', true);
207
+		}
208 208
 
209
-        register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
210
-        /**
211
-         *    espresso_load_error_handling
212
-         *    this function loads EE's class for handling exceptions and errors
213
-         */
214
-        function espresso_load_error_handling()
215
-        {
216
-            // load debugging tools
217
-            if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
218
-                require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php');
219
-                EEH_Debug_Tools::instance();
220
-            }
221
-            // load error handling
222
-            if (is_readable(EE_CORE . 'EE_Error.core.php')) {
223
-                require_once(EE_CORE . 'EE_Error.core.php');
224
-            } else {
225
-                wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
226
-            }
227
-        }
209
+		register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
210
+		/**
211
+		 *    espresso_load_error_handling
212
+		 *    this function loads EE's class for handling exceptions and errors
213
+		 */
214
+		function espresso_load_error_handling()
215
+		{
216
+			// load debugging tools
217
+			if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
218
+				require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php');
219
+				EEH_Debug_Tools::instance();
220
+			}
221
+			// load error handling
222
+			if (is_readable(EE_CORE . 'EE_Error.core.php')) {
223
+				require_once(EE_CORE . 'EE_Error.core.php');
224
+			} else {
225
+				wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
226
+			}
227
+		}
228 228
 
229
-        /**
230
-         *    espresso_load_required
231
-         *    given a class name and path, this function will load that file or throw an exception
232
-         *
233
-         * @param    string $classname
234
-         * @param    string $full_path_to_file
235
-         * @throws    EE_Error
236
-         */
237
-        function espresso_load_required($classname, $full_path_to_file)
238
-        {
239
-            static $error_handling_loaded = false;
240
-            if ( ! $error_handling_loaded) {
241
-                espresso_load_error_handling();
242
-                $error_handling_loaded = true;
243
-            }
244
-            if (is_readable($full_path_to_file)) {
245
-                require_once($full_path_to_file);
246
-            } else {
247
-                throw new EE_Error (
248
-                        sprintf(
249
-                                esc_html__(
250
-                                        'The %s class file could not be located or is not readable due to file permissions.',
251
-                                        'event_espresso'
252
-                                ),
253
-                                $classname
254
-                        )
255
-                );
256
-            }
257
-        }
229
+		/**
230
+		 *    espresso_load_required
231
+		 *    given a class name and path, this function will load that file or throw an exception
232
+		 *
233
+		 * @param    string $classname
234
+		 * @param    string $full_path_to_file
235
+		 * @throws    EE_Error
236
+		 */
237
+		function espresso_load_required($classname, $full_path_to_file)
238
+		{
239
+			static $error_handling_loaded = false;
240
+			if ( ! $error_handling_loaded) {
241
+				espresso_load_error_handling();
242
+				$error_handling_loaded = true;
243
+			}
244
+			if (is_readable($full_path_to_file)) {
245
+				require_once($full_path_to_file);
246
+			} else {
247
+				throw new EE_Error (
248
+						sprintf(
249
+								esc_html__(
250
+										'The %s class file could not be located or is not readable due to file permissions.',
251
+										'event_espresso'
252
+								),
253
+								$classname
254
+						)
255
+				);
256
+			}
257
+		}
258 258
 
259
-        espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php');
260
-        espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php');
261
-        espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php');
262
-        new EE_Bootstrap();
263
-    }
259
+		espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php');
260
+		espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php');
261
+		espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php');
262
+		new EE_Bootstrap();
263
+	}
264 264
 }
265 265
 if ( ! function_exists('espresso_deactivate_plugin')) {
266
-    /**
267
-     *    deactivate_plugin
268
-     * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
269
-     *
270
-     * @access public
271
-     * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
272
-     * @return    void
273
-     */
274
-    function espresso_deactivate_plugin($plugin_basename = '')
275
-    {
276
-        if ( ! function_exists('deactivate_plugins')) {
277
-            require_once(ABSPATH . 'wp-admin/includes/plugin.php');
278
-        }
279
-        unset($_GET['activate'], $_REQUEST['activate']);
280
-        deactivate_plugins($plugin_basename);
281
-    }
266
+	/**
267
+	 *    deactivate_plugin
268
+	 * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
269
+	 *
270
+	 * @access public
271
+	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
272
+	 * @return    void
273
+	 */
274
+	function espresso_deactivate_plugin($plugin_basename = '')
275
+	{
276
+		if ( ! function_exists('deactivate_plugins')) {
277
+			require_once(ABSPATH . 'wp-admin/includes/plugin.php');
278
+		}
279
+		unset($_GET['activate'], $_REQUEST['activate']);
280
+		deactivate_plugins($plugin_basename);
281
+	}
282 282
 }
283 283
\ No newline at end of file
Please login to merge, or discard this patch.