Completed
Branch ADMIN-REFRESH (093308)
by
unknown
02:56 queued 27s
created
core/services/blocks/BlockRendererInterface.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@
 block discarded – undo
14 14
 interface BlockRendererInterface
15 15
 {
16 16
 
17
-    /**
18
-     * This receives an array of attributes and returns rendered content for the block using those attributes.
19
-     *
20
-     * @param array $attributes
21
-     * @return string Rendered Content
22
-     */
23
-    public function render(array $attributes);
17
+	/**
18
+	 * This receives an array of attributes and returns rendered content for the block using those attributes.
19
+	 *
20
+	 * @param array $attributes
21
+	 * @return string Rendered Content
22
+	 */
23
+	public function render(array $attributes);
24 24
 }
Please login to merge, or discard this patch.
core/services/blocks/BlockRenderer.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
      */
43 43
     private function setTemplateRootPath()
44 44
     {
45
-        $this->template_root_path = $this->domain->pluginPath() . 'ui/blocks/';
45
+        $this->template_root_path = $this->domain->pluginPath().'ui/blocks/';
46 46
     }
47 47
 
48 48
 
Please login to merge, or discard this patch.
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -15,57 +15,57 @@
 block discarded – undo
15 15
 abstract class BlockRenderer implements BlockRendererInterface
16 16
 {
17 17
 
18
-    /**
19
-     * @var DomainInterface
20
-     */
21
-    protected $domain;
18
+	/**
19
+	 * @var DomainInterface
20
+	 */
21
+	protected $domain;
22 22
 
23
-    /**
24
-     * @var string
25
-     */
26
-    private $template_root_path;
23
+	/**
24
+	 * @var string
25
+	 */
26
+	private $template_root_path;
27 27
 
28 28
 
29
-    /**
30
-     * BlockRenderer constructor.
31
-     *
32
-     * @param DomainInterface $domain
33
-     */
34
-    public function __construct(DomainInterface $domain)
35
-    {
36
-        $this->domain = $domain;
37
-        $this->setTemplateRootPath();
38
-    }
29
+	/**
30
+	 * BlockRenderer constructor.
31
+	 *
32
+	 * @param DomainInterface $domain
33
+	 */
34
+	public function __construct(DomainInterface $domain)
35
+	{
36
+		$this->domain = $domain;
37
+		$this->setTemplateRootPath();
38
+	}
39 39
 
40 40
 
41
-    /**
42
-     * Sets the root path to the main block template.
43
-     */
44
-    private function setTemplateRootPath()
45
-    {
46
-        $this->template_root_path = $this->domain->pluginPath() . 'ui/blocks/';
47
-    }
41
+	/**
42
+	 * Sets the root path to the main block template.
43
+	 */
44
+	private function setTemplateRootPath()
45
+	{
46
+		$this->template_root_path = $this->domain->pluginPath() . 'ui/blocks/';
47
+	}
48 48
 
49 49
 
50
-    /**
51
-     * Exposes the root path for the main block template.
52
-     * @return string
53
-     */
54
-    public function templateRootPath()
55
-    {
56
-        return $this->template_root_path;
57
-    }
50
+	/**
51
+	 * Exposes the root path for the main block template.
52
+	 * @return string
53
+	 */
54
+	public function templateRootPath()
55
+	{
56
+		return $this->template_root_path;
57
+	}
58 58
 
59 59
 
60
-    /**
61
-     * converts GraphQL GUID into EE DB ID
62
-     *
63
-     * @param string $GUID
64
-     * @return int
65
-     */
66
-    protected function parseGUID($GUID)
67
-    {
68
-        $parts = Relay::fromGlobalId($GUID);
69
-        return ! empty($parts['id']) ? $parts['id'] : 0;
70
-    }
60
+	/**
61
+	 * converts GraphQL GUID into EE DB ID
62
+	 *
63
+	 * @param string $GUID
64
+	 * @return int
65
+	 */
66
+	protected function parseGUID($GUID)
67
+	{
68
+		$parts = Relay::fromGlobalId($GUID);
69
+		return ! empty($parts['id']) ? $parts['id'] : 0;
70
+	}
71 71
 }
Please login to merge, or discard this patch.
core/EE_Network_Config.core.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     public static function instance()
40 40
     {
41 41
         // check if class object is instantiated, and instantiated properly
42
-        if (! self::$_instance instanceof EE_Network_Config) {
42
+        if ( ! self::$_instance instanceof EE_Network_Config) {
43 43
             self::$_instance = new self();
44 44
         }
45 45
         return self::$_instance;
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         // need to bust cache for comparing original if this is a multisite install
137 137
         if (is_multisite()) {
138 138
             global $current_site;
139
-            $cache_key = $current_site->id . ':ee_network_config';
139
+            $cache_key = $current_site->id.':ee_network_config';
140 140
             wp_cache_delete($cache_key, 'site-options');
141 141
         }
142 142
 
Please login to merge, or discard this patch.
Indentation   +197 added lines, -197 removed lines patch added patch discarded remove patch
@@ -14,180 +14,180 @@  discard block
 block discarded – undo
14 14
 final class EE_Network_Config
15 15
 {
16 16
 
17
-    /**
18
-     * @var EE_Network_Config $_instance
19
-     */
20
-    private static $_instance;
21
-
22
-    /**
23
-     * addons can add their specific network_config objects to this property
24
-     *
25
-     * @var EE_Config_Base[] $addons
26
-     */
27
-    public $addons;
28
-
29
-    /**
30
-     * @var EE_Network_Core_Config $core
31
-     */
32
-    public $core;
33
-
34
-
35
-    /**
36
-     * @singleton method used to instantiate class object
37
-     * @return EE_Network_Config instance
38
-     */
39
-    public static function instance()
40
-    {
41
-        // check if class object is instantiated, and instantiated properly
42
-        if (! self::$_instance instanceof EE_Network_Config) {
43
-            self::$_instance = new self();
44
-        }
45
-        return self::$_instance;
46
-    }
47
-
48
-
49
-    /**
50
-     * class constructor
51
-     */
52
-    private function __construct()
53
-    {
54
-        do_action('AHEE__EE_Network_Config__construct__begin', $this);
55
-        // set defaults
56
-        $this->core = apply_filters('FHEE__EE_Network_Config___construct__core', new EE_Network_Core_Config());
57
-        $this->addons = array();
58
-
59
-        $this->_load_config();
60
-
61
-        // construct__end hook
62
-        do_action('AHEE__EE_Network_Config__construct__end', $this);
63
-    }
64
-
65
-
66
-    /**
67
-     * load EE Network Config options
68
-     *
69
-     * @return void
70
-     */
71
-    private function _load_config()
72
-    {
73
-        // load network config start hook
74
-        do_action('AHEE__EE_Network_Config___load_config__start', $this);
75
-        $config = $this->get_config();
76
-        foreach ($config as $config_prop => $settings) {
77
-            if ($config_prop === 'core' && ! $settings instanceof EE_Network_Core_Config) {
78
-                $core = new EE_Network_Core_Config();
79
-                foreach ($settings as $prop => $setting) {
80
-                    if (property_exists($core, $prop)) {
81
-                        $core->{$prop} = $setting;
82
-                    }
83
-                }
84
-                $settings = $core;
85
-                add_filter('FHEE__EE_Network_Config___load_config__update_network_config', '__return_true');
86
-            }
87
-            if (is_object($settings) && property_exists($this, $config_prop)) {
88
-                $this->{$config_prop} = apply_filters(
89
-                    'FHEE__EE_Network_Config___load_config__config_settings',
90
-                    $settings,
91
-                    $config_prop,
92
-                    $this
93
-                );
94
-                if (method_exists($settings, 'populate')) {
95
-                    $this->{$config_prop}->populate();
96
-                }
97
-                if (method_exists($settings, 'do_hooks')) {
98
-                    $this->{$config_prop}->do_hooks();
99
-                }
100
-            }
101
-        }
102
-        if (apply_filters('FHEE__EE_Network_Config___load_config__update_network_config', false)) {
103
-            $this->update_config();
104
-        }
105
-
106
-        // load network config end hook
107
-        do_action('AHEE__EE_Network_Config___load_config__end', $this);
108
-    }
109
-
110
-
111
-    /**
112
-     * get_config
113
-     *
114
-     * @return array of network config stuff
115
-     */
116
-    public function get_config()
117
-    {
118
-        // grab network configuration
119
-        $CFG = get_site_option('ee_network_config', array());
120
-        $CFG = apply_filters('FHEE__EE_Network_Config__get_config__CFG', $CFG);
121
-        return $CFG;
122
-    }
123
-
124
-
125
-    /**
126
-     * update_config
127
-     *
128
-     * @param bool $add_success
129
-     * @param bool $add_error
130
-     * @return bool success
131
-     */
132
-    public function update_config($add_success = false, $add_error = true)
133
-    {
134
-        do_action('AHEE__EE_Network_Config__update_config__begin', $this);
135
-
136
-        // need to bust cache for comparing original if this is a multisite install
137
-        if (is_multisite()) {
138
-            global $current_site;
139
-            $cache_key = $current_site->id . ':ee_network_config';
140
-            wp_cache_delete($cache_key, 'site-options');
141
-        }
142
-
143
-        // we have to compare existing saved config with config in memory because if there is no difference that means
144
-        // that the method executed fine but there just was no update.  WordPress doesn't distinguish between false because
145
-        // there were 0 records updated because of no change vs false because some error produced problems with the update.
146
-        $original = get_site_option('ee_network_config');
147
-
148
-        if ($original == $this) {
149
-            return true;
150
-        }
151
-        // update
152
-        $saved = update_site_option('ee_network_config', $this);
153
-
154
-        do_action('AHEE__EE_Network_Config__update_config__end', $this, $saved);
155
-        // if config remains the same or was updated successfully
156
-        if ($saved) {
157
-            if ($add_success) {
158
-                $msg = is_multisite() ? esc_html__(
159
-                    'The Event Espresso Network Configuration Settings have been successfully updated.',
160
-                    'event_espresso'
161
-                ) : esc_html__('Extra Event Espresso Configuration settings were successfully updated.', 'event_espresso');
162
-                EE_Error::add_success($msg);
163
-            }
164
-            return true;
165
-        }
166
-        if ($add_error) {
167
-            $msg = is_multisite() ? esc_html__(
168
-                'The Event Espresso Network Configuration Settings were not updated.',
169
-                'event_espresso'
170
-            ) : esc_html__('Extra Event Espresso Network Configuration settings were not updated.', 'event_espresso');
171
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
172
-        }
173
-        return false;
174
-    }
175
-
176
-
177
-    /**
178
-     * __sleep
179
-     *
180
-     * @return array
181
-     */
182
-    public function __sleep()
183
-    {
184
-        return apply_filters(
185
-            'FHEE__EE_Network_Config__sleep',
186
-            array(
187
-                'core',
188
-            )
189
-        );
190
-    }
17
+	/**
18
+	 * @var EE_Network_Config $_instance
19
+	 */
20
+	private static $_instance;
21
+
22
+	/**
23
+	 * addons can add their specific network_config objects to this property
24
+	 *
25
+	 * @var EE_Config_Base[] $addons
26
+	 */
27
+	public $addons;
28
+
29
+	/**
30
+	 * @var EE_Network_Core_Config $core
31
+	 */
32
+	public $core;
33
+
34
+
35
+	/**
36
+	 * @singleton method used to instantiate class object
37
+	 * @return EE_Network_Config instance
38
+	 */
39
+	public static function instance()
40
+	{
41
+		// check if class object is instantiated, and instantiated properly
42
+		if (! self::$_instance instanceof EE_Network_Config) {
43
+			self::$_instance = new self();
44
+		}
45
+		return self::$_instance;
46
+	}
47
+
48
+
49
+	/**
50
+	 * class constructor
51
+	 */
52
+	private function __construct()
53
+	{
54
+		do_action('AHEE__EE_Network_Config__construct__begin', $this);
55
+		// set defaults
56
+		$this->core = apply_filters('FHEE__EE_Network_Config___construct__core', new EE_Network_Core_Config());
57
+		$this->addons = array();
58
+
59
+		$this->_load_config();
60
+
61
+		// construct__end hook
62
+		do_action('AHEE__EE_Network_Config__construct__end', $this);
63
+	}
64
+
65
+
66
+	/**
67
+	 * load EE Network Config options
68
+	 *
69
+	 * @return void
70
+	 */
71
+	private function _load_config()
72
+	{
73
+		// load network config start hook
74
+		do_action('AHEE__EE_Network_Config___load_config__start', $this);
75
+		$config = $this->get_config();
76
+		foreach ($config as $config_prop => $settings) {
77
+			if ($config_prop === 'core' && ! $settings instanceof EE_Network_Core_Config) {
78
+				$core = new EE_Network_Core_Config();
79
+				foreach ($settings as $prop => $setting) {
80
+					if (property_exists($core, $prop)) {
81
+						$core->{$prop} = $setting;
82
+					}
83
+				}
84
+				$settings = $core;
85
+				add_filter('FHEE__EE_Network_Config___load_config__update_network_config', '__return_true');
86
+			}
87
+			if (is_object($settings) && property_exists($this, $config_prop)) {
88
+				$this->{$config_prop} = apply_filters(
89
+					'FHEE__EE_Network_Config___load_config__config_settings',
90
+					$settings,
91
+					$config_prop,
92
+					$this
93
+				);
94
+				if (method_exists($settings, 'populate')) {
95
+					$this->{$config_prop}->populate();
96
+				}
97
+				if (method_exists($settings, 'do_hooks')) {
98
+					$this->{$config_prop}->do_hooks();
99
+				}
100
+			}
101
+		}
102
+		if (apply_filters('FHEE__EE_Network_Config___load_config__update_network_config', false)) {
103
+			$this->update_config();
104
+		}
105
+
106
+		// load network config end hook
107
+		do_action('AHEE__EE_Network_Config___load_config__end', $this);
108
+	}
109
+
110
+
111
+	/**
112
+	 * get_config
113
+	 *
114
+	 * @return array of network config stuff
115
+	 */
116
+	public function get_config()
117
+	{
118
+		// grab network configuration
119
+		$CFG = get_site_option('ee_network_config', array());
120
+		$CFG = apply_filters('FHEE__EE_Network_Config__get_config__CFG', $CFG);
121
+		return $CFG;
122
+	}
123
+
124
+
125
+	/**
126
+	 * update_config
127
+	 *
128
+	 * @param bool $add_success
129
+	 * @param bool $add_error
130
+	 * @return bool success
131
+	 */
132
+	public function update_config($add_success = false, $add_error = true)
133
+	{
134
+		do_action('AHEE__EE_Network_Config__update_config__begin', $this);
135
+
136
+		// need to bust cache for comparing original if this is a multisite install
137
+		if (is_multisite()) {
138
+			global $current_site;
139
+			$cache_key = $current_site->id . ':ee_network_config';
140
+			wp_cache_delete($cache_key, 'site-options');
141
+		}
142
+
143
+		// we have to compare existing saved config with config in memory because if there is no difference that means
144
+		// that the method executed fine but there just was no update.  WordPress doesn't distinguish between false because
145
+		// there were 0 records updated because of no change vs false because some error produced problems with the update.
146
+		$original = get_site_option('ee_network_config');
147
+
148
+		if ($original == $this) {
149
+			return true;
150
+		}
151
+		// update
152
+		$saved = update_site_option('ee_network_config', $this);
153
+
154
+		do_action('AHEE__EE_Network_Config__update_config__end', $this, $saved);
155
+		// if config remains the same or was updated successfully
156
+		if ($saved) {
157
+			if ($add_success) {
158
+				$msg = is_multisite() ? esc_html__(
159
+					'The Event Espresso Network Configuration Settings have been successfully updated.',
160
+					'event_espresso'
161
+				) : esc_html__('Extra Event Espresso Configuration settings were successfully updated.', 'event_espresso');
162
+				EE_Error::add_success($msg);
163
+			}
164
+			return true;
165
+		}
166
+		if ($add_error) {
167
+			$msg = is_multisite() ? esc_html__(
168
+				'The Event Espresso Network Configuration Settings were not updated.',
169
+				'event_espresso'
170
+			) : esc_html__('Extra Event Espresso Network Configuration settings were not updated.', 'event_espresso');
171
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
172
+		}
173
+		return false;
174
+	}
175
+
176
+
177
+	/**
178
+	 * __sleep
179
+	 *
180
+	 * @return array
181
+	 */
182
+	public function __sleep()
183
+	{
184
+		return apply_filters(
185
+			'FHEE__EE_Network_Config__sleep',
186
+			array(
187
+				'core',
188
+			)
189
+		);
190
+	}
191 191
 }
192 192
 
193 193
 
@@ -197,27 +197,27 @@  discard block
 block discarded – undo
197 197
 class EE_Network_Core_Config extends EE_Config_Base
198 198
 {
199 199
 
200
-    /**
201
-     * PUE site license key
202
-     *
203
-     * @var string $site_license_key
204
-     */
205
-    public $site_license_key;
206
-
207
-    /**
208
-     * This indicates whether messages system processing should be done on the same request or not.
209
-     *
210
-     * @var boolean $do_messages_on_same_request
211
-     */
212
-    public $do_messages_on_same_request;
213
-
214
-
215
-    /**
216
-     * EE_Network_Core_Config constructor.
217
-     */
218
-    public function __construct()
219
-    {
220
-        $this->site_license_key = '';
221
-        $this->do_messages_on_same_request = false;
222
-    }
200
+	/**
201
+	 * PUE site license key
202
+	 *
203
+	 * @var string $site_license_key
204
+	 */
205
+	public $site_license_key;
206
+
207
+	/**
208
+	 * This indicates whether messages system processing should be done on the same request or not.
209
+	 *
210
+	 * @var boolean $do_messages_on_same_request
211
+	 */
212
+	public $do_messages_on_same_request;
213
+
214
+
215
+	/**
216
+	 * EE_Network_Core_Config constructor.
217
+	 */
218
+	public function __construct()
219
+	{
220
+		$this->site_license_key = '';
221
+		$this->do_messages_on_same_request = false;
222
+	}
223 223
 }
Please login to merge, or discard this patch.
core/services/assets/BlockAssetManagerInterface.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -12,42 +12,42 @@
 block discarded – undo
12 12
  */
13 13
 interface BlockAssetManagerInterface
14 14
 {
15
-    /**
16
-     * @since 4.9.71.p
17
-     * @return string
18
-     */
19
-    public function assetNamespace();
20
-
21
-    /**
22
-     * @since 4.9.71.p
23
-     * @return void
24
-     */
25
-    public function setAssetHandles();
26
-
27
-    /**
28
-     * @since 4.9.71.p
29
-     * @return string
30
-     */
31
-    public function getEditorScriptHandle();
32
-
33
-
34
-    /**
35
-     * @since 4.9.71.p
36
-     * @return string
37
-     */
38
-    public function getEditorStyleHandle();
39
-
40
-
41
-    /**
42
-     * @since 4.9.71.p
43
-     * @return string
44
-     */
45
-    public function getScriptHandle();
46
-
47
-
48
-    /**
49
-     * @since 4.9.71.p
50
-     * @return string
51
-     */
52
-    public function getStyleHandle();
15
+	/**
16
+	 * @since 4.9.71.p
17
+	 * @return string
18
+	 */
19
+	public function assetNamespace();
20
+
21
+	/**
22
+	 * @since 4.9.71.p
23
+	 * @return void
24
+	 */
25
+	public function setAssetHandles();
26
+
27
+	/**
28
+	 * @since 4.9.71.p
29
+	 * @return string
30
+	 */
31
+	public function getEditorScriptHandle();
32
+
33
+
34
+	/**
35
+	 * @since 4.9.71.p
36
+	 * @return string
37
+	 */
38
+	public function getEditorStyleHandle();
39
+
40
+
41
+	/**
42
+	 * @since 4.9.71.p
43
+	 * @return string
44
+	 */
45
+	public function getScriptHandle();
46
+
47
+
48
+	/**
49
+	 * @since 4.9.71.p
50
+	 * @return string
51
+	 */
52
+	public function getStyleHandle();
53 53
 }
54 54
\ No newline at end of file
Please login to merge, or discard this patch.
core/services/dependencies/DependencyResolverInterface.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -15,16 +15,16 @@
 block discarded – undo
15 15
  */
16 16
 interface DependencyResolverInterface
17 17
 {
18
-    /**
19
-     * Used to configure and/or setup any aliases or recursions required by the DependencyResolver
20
-     *
21
-     * @since 4.9.71.p
22
-     */
23
-    public function initialize();
18
+	/**
19
+	 * Used to configure and/or setup any aliases or recursions required by the DependencyResolver
20
+	 *
21
+	 * @since 4.9.71.p
22
+	 */
23
+	public function initialize();
24 24
 
25
-    /**
26
-     * @param string $fqcn Fully Qualified Class Name
27
-     * @since 4.9.71.p
28
-     */
29
-    public function resolveDependenciesForClass($fqcn);
25
+	/**
26
+	 * @param string $fqcn Fully Qualified Class Name
27
+	 * @since 4.9.71.p
28
+	 */
29
+	public function resolveDependenciesForClass($fqcn);
30 30
 }
Please login to merge, or discard this patch.
core/libraries/rest_api/RestIncomingQueryParamContext.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -18,61 +18,61 @@
 block discarded – undo
18 18
  */
19 19
 class RestIncomingQueryParamContext
20 20
 {
21
-    /**
22
-     * @var EEM_Base
23
-     */
24
-    private $model;
25
-    /**
26
-     * @var string
27
-     */
28
-    private $requested_version;
29
-    /**
30
-     * @var boolean
31
-     */
32
-    private $writing;
21
+	/**
22
+	 * @var EEM_Base
23
+	 */
24
+	private $model;
25
+	/**
26
+	 * @var string
27
+	 */
28
+	private $requested_version;
29
+	/**
30
+	 * @var boolean
31
+	 */
32
+	private $writing;
33 33
 
34
-    /**
35
-     * RestIncomingQueryParamContext constructor.
36
-     * @param EEM_Base $model
37
-     * @param string $requested_version
38
-     * @param boolean $writing
39
-     */
40
-    public function __construct(EEM_Base $model, $requested_version, $writing)
41
-    {
42
-        $this->model = $model;
43
-        $this->requested_version = (string) $requested_version;
44
-        $this->writing = filter_var($writing, FILTER_VALIDATE_BOOLEAN);
45
-    }
34
+	/**
35
+	 * RestIncomingQueryParamContext constructor.
36
+	 * @param EEM_Base $model
37
+	 * @param string $requested_version
38
+	 * @param boolean $writing
39
+	 */
40
+	public function __construct(EEM_Base $model, $requested_version, $writing)
41
+	{
42
+		$this->model = $model;
43
+		$this->requested_version = (string) $requested_version;
44
+		$this->writing = filter_var($writing, FILTER_VALIDATE_BOOLEAN);
45
+	}
46 46
 
47
-    /**
48
-     * Gets the model currently being requested, eg class EEM_Event
49
-     * @since 4.9.72.p
50
-     * @return EEM_Base
51
-     */
52
-    public function getModel()
53
-    {
54
-        return $this->model;
55
-    }
47
+	/**
48
+	 * Gets the model currently being requested, eg class EEM_Event
49
+	 * @since 4.9.72.p
50
+	 * @return EEM_Base
51
+	 */
52
+	public function getModel()
53
+	{
54
+		return $this->model;
55
+	}
56 56
 
57
-    /**
58
-     * Gets the version being requested, eg 4.8.36
59
-     * @since 4.9.72.p
60
-     * @return string
61
-     */
62
-    public function getRequestedVersion()
63
-    {
64
-        return $this->requested_version;
65
-    }
57
+	/**
58
+	 * Gets the version being requested, eg 4.8.36
59
+	 * @since 4.9.72.p
60
+	 * @return string
61
+	 */
62
+	public function getRequestedVersion()
63
+	{
64
+		return $this->requested_version;
65
+	}
66 66
 
67
-    /**
68
-     * Gets if the current request is for a writing request or just simple read
69
-     * @since 4.9.72.p
70
-     * @return bool
71
-     */
72
-    public function isWriting()
73
-    {
74
-        return $this->writing;
75
-    }
67
+	/**
68
+	 * Gets if the current request is for a writing request or just simple read
69
+	 * @since 4.9.72.p
70
+	 * @return bool
71
+	 */
72
+	public function isWriting()
73
+	{
74
+		return $this->writing;
75
+	}
76 76
 }
77 77
 // End of file RestIncomingQueryParamContext.php
78 78
 // Location: EventEspresso\core\libraries\rest_api/RestIncomingQueryParamContext.php
Please login to merge, or discard this patch.
core/wordpress-shims.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  * Note: this file should only be required right before calling the function the shim is for.  This is to ensure that
5 5
  * it does not override any existing definition of the function in WP.
6 6
  */
7
-if (! function_exists('get_preview_post_link')) {
7
+if ( ! function_exists('get_preview_post_link')) {
8 8
     /**
9 9
      * Function was added in WordPress 4.4.0
10 10
      *
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
     function get_preview_post_link($post = null, $query_args = array(), $preview_link = '')
17 17
     {
18 18
         $post = get_post($post);
19
-        if (! $post) {
19
+        if ( ! $post) {
20 20
             return '';
21 21
         }
22 22
 
23 23
         $post_type_object = get_post_type_object($post->post_type);
24 24
         if (is_post_type_viewable($post_type_object)) {
25
-            if (! $preview_link) {
25
+            if ( ! $preview_link) {
26 26
                 $preview_link = set_url_scheme(get_permalink($post));
27 27
             }
28 28
 
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
     }
43 43
 }
44 44
 
45
-if (! function_exists('is_post_type_viewable')) {
45
+if ( ! function_exists('is_post_type_viewable')) {
46 46
     function is_post_type_viewable($post_type)
47 47
     {
48 48
         if (is_scalar($post_type)) {
49 49
             $post_type = get_post_type_object($post_type);
50
-            if (! $post_type) {
50
+            if ( ! $post_type) {
51 51
                 return false;
52 52
             }
53 53
         }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     }
57 57
 }
58 58
 
59
-if (! function_exists('wp_scripts_get_suffix')) {
59
+if ( ! function_exists('wp_scripts_get_suffix')) {
60 60
     /**
61 61
      * Returns the suffix that can be used for the scripts.
62 62
      *
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
         static $suffixes;
74 74
 
75 75
         if ($suffixes === null) {
76
-            include(ABSPATH . WPINC . '/version.php'); // include an unmodified $wp_version
76
+            include(ABSPATH.WPINC.'/version.php'); // include an unmodified $wp_version
77 77
 
78 78
             $develop_src = false !== strpos($wp_version, '-src');
79 79
 
80
-            if (! defined('SCRIPT_DEBUG')) {
80
+            if ( ! defined('SCRIPT_DEBUG')) {
81 81
                 define('SCRIPT_DEBUG', $develop_src);
82 82
             }
83 83
             $suffix = SCRIPT_DEBUG ? '' : '.min';
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     }
95 95
 }
96 96
 
97
-if (! function_exists('get_user_locale')) {
97
+if ( ! function_exists('get_user_locale')) {
98 98
     /**
99 99
      * Shim for get_user_locale that was added in WP 4.7.0
100 100
      *
Please login to merge, or discard this patch.
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -5,105 +5,105 @@
 block discarded – undo
5 5
  * it does not override any existing definition of the function in WP.
6 6
  */
7 7
 if (! function_exists('get_preview_post_link')) {
8
-    /**
9
-     * Function was added in WordPress 4.4.0
10
-     *
11
-     * @param null   $post
12
-     * @param array  $query_args
13
-     * @param string $preview_link
14
-     * @return mixed
15
-     */
16
-    function get_preview_post_link($post = null, $query_args = array(), $preview_link = '')
17
-    {
18
-        $post = get_post($post);
19
-        if (! $post) {
20
-            return '';
21
-        }
8
+	/**
9
+	 * Function was added in WordPress 4.4.0
10
+	 *
11
+	 * @param null   $post
12
+	 * @param array  $query_args
13
+	 * @param string $preview_link
14
+	 * @return mixed
15
+	 */
16
+	function get_preview_post_link($post = null, $query_args = array(), $preview_link = '')
17
+	{
18
+		$post = get_post($post);
19
+		if (! $post) {
20
+			return '';
21
+		}
22 22
 
23
-        $post_type_object = get_post_type_object($post->post_type);
24
-        if (is_post_type_viewable($post_type_object)) {
25
-            if (! $preview_link) {
26
-                $preview_link = set_url_scheme(get_permalink($post));
27
-            }
23
+		$post_type_object = get_post_type_object($post->post_type);
24
+		if (is_post_type_viewable($post_type_object)) {
25
+			if (! $preview_link) {
26
+				$preview_link = set_url_scheme(get_permalink($post));
27
+			}
28 28
 
29
-            $query_args['preview'] = 'true';
30
-            $preview_link = add_query_arg($query_args, $preview_link);
31
-        }
29
+			$query_args['preview'] = 'true';
30
+			$preview_link = add_query_arg($query_args, $preview_link);
31
+		}
32 32
 
33
-        /**
34
-         * Filters the URL used for a post preview.
35
-         *
36
-         * @since 2.0.5
37
-         * @since 4.0.0 Added the `$post` parameter.
38
-         * @param string  $preview_link URL used for the post preview.
39
-         * @param WP_Post $post         Post object.
40
-         */
41
-        return apply_filters('preview_post_link', $preview_link, $post);
42
-    }
33
+		/**
34
+		 * Filters the URL used for a post preview.
35
+		 *
36
+		 * @since 2.0.5
37
+		 * @since 4.0.0 Added the `$post` parameter.
38
+		 * @param string  $preview_link URL used for the post preview.
39
+		 * @param WP_Post $post         Post object.
40
+		 */
41
+		return apply_filters('preview_post_link', $preview_link, $post);
42
+	}
43 43
 }
44 44
 
45 45
 if (! function_exists('is_post_type_viewable')) {
46
-    function is_post_type_viewable($post_type)
47
-    {
48
-        if (is_scalar($post_type)) {
49
-            $post_type = get_post_type_object($post_type);
50
-            if (! $post_type) {
51
-                return false;
52
-            }
53
-        }
46
+	function is_post_type_viewable($post_type)
47
+	{
48
+		if (is_scalar($post_type)) {
49
+			$post_type = get_post_type_object($post_type);
50
+			if (! $post_type) {
51
+				return false;
52
+			}
53
+		}
54 54
 
55
-        return $post_type->publicly_queryable || ($post_type->_builtin && $post_type->public);
56
-    }
55
+		return $post_type->publicly_queryable || ($post_type->_builtin && $post_type->public);
56
+	}
57 57
 }
58 58
 
59 59
 if (! function_exists('wp_scripts_get_suffix')) {
60
-    /**
61
-     * Returns the suffix that can be used for the scripts.
62
-     *
63
-     * There are two suffix types, the normal one and the dev suffix.
64
-     *
65
-     * @since 5.0.0
66
-     *
67
-     * @param string $type The type of suffix to retrieve.
68
-     * @return string The script suffix.
69
-     */
70
-    function wp_scripts_get_suffix($type = '')
71
-    {
72
-        global $wp_version;
73
-        static $suffixes;
60
+	/**
61
+	 * Returns the suffix that can be used for the scripts.
62
+	 *
63
+	 * There are two suffix types, the normal one and the dev suffix.
64
+	 *
65
+	 * @since 5.0.0
66
+	 *
67
+	 * @param string $type The type of suffix to retrieve.
68
+	 * @return string The script suffix.
69
+	 */
70
+	function wp_scripts_get_suffix($type = '')
71
+	{
72
+		global $wp_version;
73
+		static $suffixes;
74 74
 
75
-        if ($suffixes === null) {
76
-            include(ABSPATH . WPINC . '/version.php'); // include an unmodified $wp_version
75
+		if ($suffixes === null) {
76
+			include(ABSPATH . WPINC . '/version.php'); // include an unmodified $wp_version
77 77
 
78
-            $develop_src = false !== strpos($wp_version, '-src');
78
+			$develop_src = false !== strpos($wp_version, '-src');
79 79
 
80
-            if (! defined('SCRIPT_DEBUG')) {
81
-                define('SCRIPT_DEBUG', $develop_src);
82
-            }
83
-            $suffix = SCRIPT_DEBUG ? '' : '.min';
84
-            $dev_suffix = $develop_src ? '' : '.min';
80
+			if (! defined('SCRIPT_DEBUG')) {
81
+				define('SCRIPT_DEBUG', $develop_src);
82
+			}
83
+			$suffix = SCRIPT_DEBUG ? '' : '.min';
84
+			$dev_suffix = $develop_src ? '' : '.min';
85 85
 
86
-            $suffixes = array('suffix' => $suffix, 'dev_suffix' => $dev_suffix);
87
-        }
86
+			$suffixes = array('suffix' => $suffix, 'dev_suffix' => $dev_suffix);
87
+		}
88 88
 
89
-        if ($type === 'dev') {
90
-            return $suffixes['dev_suffix'];
91
-        }
89
+		if ($type === 'dev') {
90
+			return $suffixes['dev_suffix'];
91
+		}
92 92
 
93
-        return $suffixes['suffix'];
94
-    }
93
+		return $suffixes['suffix'];
94
+	}
95 95
 }
96 96
 
97 97
 if (! function_exists('get_user_locale')) {
98
-    /**
99
-     * Shim for get_user_locale that was added in WP 4.7.0
100
-     *
101
-     * @param int $user_id
102
-     * @return string
103
-     * @since 4.9.73.p
104
-     */
105
-    function get_user_locale($user_id = 0)
106
-    {
107
-        return get_locale();
108
-    }
98
+	/**
99
+	 * Shim for get_user_locale that was added in WP 4.7.0
100
+	 *
101
+	 * @param int $user_id
102
+	 * @return string
103
+	 * @since 4.9.73.p
104
+	 */
105
+	function get_user_locale($user_id = 0)
106
+	{
107
+		return get_locale();
108
+	}
109 109
 }
110 110
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_models/relations/EE_HABTM_Relation.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -65,18 +65,18 @@  discard block
 block discarded – undo
65 65
         // remember the model relation chain to the JOIN model, because we'll
66 66
         // need it for get_join_statement()
67 67
         $this->_model_relation_chain_to_join_model = $model_relation_chain;
68
-        $this_table_pk_field                       = $this->get_this_model()->get_primary_key_field();// get_foreign_key_to($this->get_other_model()->get_this_model_name());
68
+        $this_table_pk_field                       = $this->get_this_model()->get_primary_key_field(); // get_foreign_key_to($this->get_other_model()->get_this_model_name());
69 69
         $join_table_fk_field_to_this_table         = $this->get_join_model()->get_foreign_key_to($this->get_this_model()->get_this_model_name());
70 70
         $this_table_alias                          = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
71 71
             $model_relation_chain,
72 72
             $this->get_this_model()->get_this_model_name()
73
-        ) . $this_table_pk_field->get_table_alias();
73
+        ).$this_table_pk_field->get_table_alias();
74 74
 
75 75
         $join_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
76 76
             $model_relation_chain,
77 77
             $this->get_join_model()->get_this_model_name()
78
-        ) . $join_table_fk_field_to_this_table->get_table_alias();
79
-        $join_table       = $this->get_join_model()->get_table_for_alias($join_table_alias);
78
+        ).$join_table_fk_field_to_this_table->get_table_alias();
79
+        $join_table = $this->get_join_model()->get_table_for_alias($join_table_alias);
80 80
         // phew! ok, we have all the info we need, now we can create the SQL join string
81 81
         $SQL = $this->_left_join(
82 82
             $join_table,
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             $join_table_fk_field_to_this_table->get_table_column(),
85 85
             $this_table_alias,
86 86
             $this_table_pk_field->get_table_column()
87
-        ) . $this->get_join_model()->_construct_internal_join_to_table_with_alias($join_table_alias);
87
+        ).$this->get_join_model()->_construct_internal_join_to_table_with_alias($join_table_alias);
88 88
 
89 89
         return $SQL;
90 90
     }
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
         $join_table_alias                   = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
114 114
             $this->_model_relation_chain_to_join_model,
115 115
             $this->get_join_model()->get_this_model_name()
116
-        ) . $join_table_fk_field_to_this_table->get_table_alias();
116
+        ).$join_table_fk_field_to_this_table->get_table_alias();
117 117
         $other_table_pk_field               = $this->get_other_model()->get_primary_key_field();
118 118
         $join_table_fk_field_to_other_table = $this->get_join_model()->get_foreign_key_to($this->get_other_model()->get_this_model_name());
119 119
         $other_table_alias                  = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
120 120
             $model_relation_chain,
121 121
             $this->get_other_model()->get_this_model_name()
122
-        ) . $other_table_pk_field->get_table_alias();
123
-        $other_table                        = $this->get_other_model()->get_table_for_alias($other_table_alias);
122
+        ).$other_table_pk_field->get_table_alias();
123
+        $other_table = $this->get_other_model()->get_table_for_alias($other_table_alias);
124 124
 
125 125
         $SQL = $this->_left_join(
126 126
             $other_table,
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             $other_table_pk_field->get_table_column(),
129 129
             $join_table_alias,
130 130
             $join_table_fk_field_to_other_table->get_table_column()
131
-        ) . $this->get_other_model()->_construct_internal_join_to_table_with_alias($other_table_alias);
131
+        ).$this->get_other_model()->_construct_internal_join_to_table_with_alias($other_table_alias);
132 132
         return $SQL;
133 133
     }
134 134
 
@@ -161,17 +161,17 @@  discard block
 block discarded – undo
161 161
         );
162 162
 
163 163
         // if $where_query exists lets add them to the query_params.
164
-        if (! empty($extra_join_model_fields_n_values)) {
164
+        if ( ! empty($extra_join_model_fields_n_values)) {
165 165
             // make sure we strip any of the join model names from the $where_query cause we don't need that in here (why? because client code may have used the same conditionals for get_all_related which DOES need the join model name)
166 166
             // make sure we strip THIS models name from the query param
167 167
             $parsed_query = array();
168 168
             foreach ($extra_join_model_fields_n_values as $query_param => $val) {
169
-                $query_param                = str_replace(
170
-                    $this->get_join_model()->get_this_model_name() . ".",
169
+                $query_param = str_replace(
170
+                    $this->get_join_model()->get_this_model_name().".",
171 171
                     "",
172 172
                     $query_param
173 173
                 );
174
-                $parsed_query[ $query_param ] = $val;
174
+                $parsed_query[$query_param] = $val;
175 175
             }
176 176
             $all_fields = array_merge($foreign_keys, $parsed_query);
177 177
         }
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         // new row.
182 182
         // Again, if you want more sophisticated logic or insertions (handling more columns than just 2 foreign keys to
183 183
         // the other tables) use the joining model directly!
184
-        if (! $existing_entry_in_join_table) {
184
+        if ( ! $existing_entry_in_join_table) {
185 185
             $this->get_join_model()->insert($all_fields);
186 186
         } else {
187 187
             $this->get_join_model()->update(
@@ -217,17 +217,17 @@  discard block
 block discarded – undo
217 217
         );
218 218
 
219 219
         // if $where_query exists lets add them to the query_params.
220
-        if (! empty($where_query)) {
220
+        if ( ! empty($where_query)) {
221 221
             // make sure we strip any of the join model names from the $where_query cause we don't need that in here (why? because client code may have used the same conditionals for get_all_related which DOES need the join model name)
222 222
             // make sure we strip THIS models name from the query param
223 223
             $parsed_query = array();
224 224
             foreach ($where_query as $query_param => $val) {
225
-                $query_param                = str_replace(
226
-                    $this->get_join_model()->get_this_model_name() . ".",
225
+                $query_param = str_replace(
226
+                    $this->get_join_model()->get_this_model_name().".",
227 227
                     "",
228 228
                     $query_param
229 229
                 );
230
-                $parsed_query[ $query_param ] = $val;
230
+                $parsed_query[$query_param] = $val;
231 231
             }
232 232
             $cols_n_values = array_merge($cols_n_values, $parsed_query);
233 233
         }
Please login to merge, or discard this patch.
Indentation   +239 added lines, -239 removed lines patch added patch discarded remove patch
@@ -9,266 +9,266 @@
 block discarded – undo
9 9
  */
10 10
 class EE_HABTM_Relation extends EE_Model_Relation_Base
11 11
 {
12
-    /**
13
-     * Model which defines the relation between two other models. Eg, the EE_Event_Question_Group model,
14
-     * which joins EE_Event and EE_Question_Group
15
-     *
16
-     * @var EEM_Base
17
-     */
18
-    protected $_joining_model_name;
12
+	/**
13
+	 * Model which defines the relation between two other models. Eg, the EE_Event_Question_Group model,
14
+	 * which joins EE_Event and EE_Question_Group
15
+	 *
16
+	 * @var EEM_Base
17
+	 */
18
+	protected $_joining_model_name;
19 19
 
20
-    protected $_model_relation_chain_to_join_model;
20
+	protected $_model_relation_chain_to_join_model;
21 21
 
22 22
 
23
-    /**
24
-     * Object representing the relationship between two models. HasAndBelongsToMany relations always use a join-table
25
-     * (and an ee joining-model.) This knows how to join the models,
26
-     * get related models across the relation, and add-and-remove the relationships.
27
-     *
28
-     * @param bool    $joining_model_name
29
-     * @param boolean $block_deletes                 for this type of relation, we block by default for now. if there
30
-     *                                               are related models across this relation, block (prevent and add an
31
-     *                                               error) the deletion of this model
32
-     * @param string  $blocking_delete_error_message a customized error message on blocking deletes instead of the
33
-     *                                               default
34
-     */
35
-    public function __construct($joining_model_name, $block_deletes = true, $blocking_delete_error_message = '')
36
-    {
37
-        $this->_joining_model_name = $joining_model_name;
38
-        parent::__construct($block_deletes, $blocking_delete_error_message);
39
-    }
23
+	/**
24
+	 * Object representing the relationship between two models. HasAndBelongsToMany relations always use a join-table
25
+	 * (and an ee joining-model.) This knows how to join the models,
26
+	 * get related models across the relation, and add-and-remove the relationships.
27
+	 *
28
+	 * @param bool    $joining_model_name
29
+	 * @param boolean $block_deletes                 for this type of relation, we block by default for now. if there
30
+	 *                                               are related models across this relation, block (prevent and add an
31
+	 *                                               error) the deletion of this model
32
+	 * @param string  $blocking_delete_error_message a customized error message on blocking deletes instead of the
33
+	 *                                               default
34
+	 */
35
+	public function __construct($joining_model_name, $block_deletes = true, $blocking_delete_error_message = '')
36
+	{
37
+		$this->_joining_model_name = $joining_model_name;
38
+		parent::__construct($block_deletes, $blocking_delete_error_message);
39
+	}
40 40
 
41
-    /**
42
-     * Gets the joining model's object
43
-     *
44
-     * @return EEM_Base
45
-     */
46
-    public function get_join_model()
47
-    {
48
-        return $this->_get_model($this->_joining_model_name);
49
-    }
41
+	/**
42
+	 * Gets the joining model's object
43
+	 *
44
+	 * @return EEM_Base
45
+	 */
46
+	public function get_join_model()
47
+	{
48
+		return $this->_get_model($this->_joining_model_name);
49
+	}
50 50
 
51 51
 
52
-    /**
53
-     * Gets the SQL string for joining the main model's table containing the pk to the join table. Eg "LEFT JOIN
54
-     * real_join_table AS join_table_alias ON this_table_alias.pk = join_table_alias.fk_to_this_table"
55
-     *
56
-     * @param string $model_relation_chain like 'Event.Event_Venue.Venue'
57
-     * @return string of SQL
58
-     * @throws \EE_Error
59
-     */
60
-    public function get_join_to_intermediate_model_statement($model_relation_chain)
61
-    {
62
-        // create sql like
63
-        // LEFT JOIN join_table AS join_table_alias ON this_table_alias.this_table_pk = join_table_alias.join_table_fk_to_this
64
-        // LEFT JOIN other_table AS other_table_alias ON join_table_alias.join_table_fk_to_other = other_table_alias.other_table_pk
65
-        // remember the model relation chain to the JOIN model, because we'll
66
-        // need it for get_join_statement()
67
-        $this->_model_relation_chain_to_join_model = $model_relation_chain;
68
-        $this_table_pk_field                       = $this->get_this_model()->get_primary_key_field();// get_foreign_key_to($this->get_other_model()->get_this_model_name());
69
-        $join_table_fk_field_to_this_table         = $this->get_join_model()->get_foreign_key_to($this->get_this_model()->get_this_model_name());
70
-        $this_table_alias                          = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
71
-            $model_relation_chain,
72
-            $this->get_this_model()->get_this_model_name()
73
-        ) . $this_table_pk_field->get_table_alias();
52
+	/**
53
+	 * Gets the SQL string for joining the main model's table containing the pk to the join table. Eg "LEFT JOIN
54
+	 * real_join_table AS join_table_alias ON this_table_alias.pk = join_table_alias.fk_to_this_table"
55
+	 *
56
+	 * @param string $model_relation_chain like 'Event.Event_Venue.Venue'
57
+	 * @return string of SQL
58
+	 * @throws \EE_Error
59
+	 */
60
+	public function get_join_to_intermediate_model_statement($model_relation_chain)
61
+	{
62
+		// create sql like
63
+		// LEFT JOIN join_table AS join_table_alias ON this_table_alias.this_table_pk = join_table_alias.join_table_fk_to_this
64
+		// LEFT JOIN other_table AS other_table_alias ON join_table_alias.join_table_fk_to_other = other_table_alias.other_table_pk
65
+		// remember the model relation chain to the JOIN model, because we'll
66
+		// need it for get_join_statement()
67
+		$this->_model_relation_chain_to_join_model = $model_relation_chain;
68
+		$this_table_pk_field                       = $this->get_this_model()->get_primary_key_field();// get_foreign_key_to($this->get_other_model()->get_this_model_name());
69
+		$join_table_fk_field_to_this_table         = $this->get_join_model()->get_foreign_key_to($this->get_this_model()->get_this_model_name());
70
+		$this_table_alias                          = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
71
+			$model_relation_chain,
72
+			$this->get_this_model()->get_this_model_name()
73
+		) . $this_table_pk_field->get_table_alias();
74 74
 
75
-        $join_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
76
-            $model_relation_chain,
77
-            $this->get_join_model()->get_this_model_name()
78
-        ) . $join_table_fk_field_to_this_table->get_table_alias();
79
-        $join_table       = $this->get_join_model()->get_table_for_alias($join_table_alias);
80
-        // phew! ok, we have all the info we need, now we can create the SQL join string
81
-        $SQL = $this->_left_join(
82
-            $join_table,
83
-            $join_table_alias,
84
-            $join_table_fk_field_to_this_table->get_table_column(),
85
-            $this_table_alias,
86
-            $this_table_pk_field->get_table_column()
87
-        ) . $this->get_join_model()->_construct_internal_join_to_table_with_alias($join_table_alias);
75
+		$join_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
76
+			$model_relation_chain,
77
+			$this->get_join_model()->get_this_model_name()
78
+		) . $join_table_fk_field_to_this_table->get_table_alias();
79
+		$join_table       = $this->get_join_model()->get_table_for_alias($join_table_alias);
80
+		// phew! ok, we have all the info we need, now we can create the SQL join string
81
+		$SQL = $this->_left_join(
82
+			$join_table,
83
+			$join_table_alias,
84
+			$join_table_fk_field_to_this_table->get_table_column(),
85
+			$this_table_alias,
86
+			$this_table_pk_field->get_table_column()
87
+		) . $this->get_join_model()->_construct_internal_join_to_table_with_alias($join_table_alias);
88 88
 
89
-        return $SQL;
90
-    }
89
+		return $SQL;
90
+	}
91 91
 
92 92
 
93
-    /**
94
-     * Gets the SQL string for joining the join table to the other model's pk's table. Eg "LEFT JOIN real_other_table
95
-     * AS other_table_alias ON join_table_alias.fk_to_other_table = other_table_alias.pk" If you want to join between
96
-     * modelA -> joinModelAB -> modelB (eg, Event -> Event_Question_Group -> Question_Group), you should prepend the
97
-     * result of this function with results from get_join_to_intermediate_model_statement(), so that you join first to
98
-     * the intermediate join table, and then to the other model's pk's table
99
-     *
100
-     * @param string $model_relation_chain like 'Event.Event_Venue.Venue'
101
-     * @return string of SQL
102
-     * @throws \EE_Error
103
-     */
104
-    public function get_join_statement($model_relation_chain)
105
-    {
106
-        if ($this->_model_relation_chain_to_join_model === null) {
107
-            throw new EE_Error(sprintf(esc_html__(
108
-                'When using EE_HABTM_Relation to create a join, you must call get_join_to_intermediate_model_statement BEFORE get_join_statement',
109
-                'event_espresso'
110
-            )));
111
-        }
112
-        $join_table_fk_field_to_this_table  = $this->get_join_model()->get_foreign_key_to($this->get_this_model()->get_this_model_name());
113
-        $join_table_alias                   = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
114
-            $this->_model_relation_chain_to_join_model,
115
-            $this->get_join_model()->get_this_model_name()
116
-        ) . $join_table_fk_field_to_this_table->get_table_alias();
117
-        $other_table_pk_field               = $this->get_other_model()->get_primary_key_field();
118
-        $join_table_fk_field_to_other_table = $this->get_join_model()->get_foreign_key_to($this->get_other_model()->get_this_model_name());
119
-        $other_table_alias                  = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
120
-            $model_relation_chain,
121
-            $this->get_other_model()->get_this_model_name()
122
-        ) . $other_table_pk_field->get_table_alias();
123
-        $other_table                        = $this->get_other_model()->get_table_for_alias($other_table_alias);
93
+	/**
94
+	 * Gets the SQL string for joining the join table to the other model's pk's table. Eg "LEFT JOIN real_other_table
95
+	 * AS other_table_alias ON join_table_alias.fk_to_other_table = other_table_alias.pk" If you want to join between
96
+	 * modelA -> joinModelAB -> modelB (eg, Event -> Event_Question_Group -> Question_Group), you should prepend the
97
+	 * result of this function with results from get_join_to_intermediate_model_statement(), so that you join first to
98
+	 * the intermediate join table, and then to the other model's pk's table
99
+	 *
100
+	 * @param string $model_relation_chain like 'Event.Event_Venue.Venue'
101
+	 * @return string of SQL
102
+	 * @throws \EE_Error
103
+	 */
104
+	public function get_join_statement($model_relation_chain)
105
+	{
106
+		if ($this->_model_relation_chain_to_join_model === null) {
107
+			throw new EE_Error(sprintf(esc_html__(
108
+				'When using EE_HABTM_Relation to create a join, you must call get_join_to_intermediate_model_statement BEFORE get_join_statement',
109
+				'event_espresso'
110
+			)));
111
+		}
112
+		$join_table_fk_field_to_this_table  = $this->get_join_model()->get_foreign_key_to($this->get_this_model()->get_this_model_name());
113
+		$join_table_alias                   = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
114
+			$this->_model_relation_chain_to_join_model,
115
+			$this->get_join_model()->get_this_model_name()
116
+		) . $join_table_fk_field_to_this_table->get_table_alias();
117
+		$other_table_pk_field               = $this->get_other_model()->get_primary_key_field();
118
+		$join_table_fk_field_to_other_table = $this->get_join_model()->get_foreign_key_to($this->get_other_model()->get_this_model_name());
119
+		$other_table_alias                  = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix(
120
+			$model_relation_chain,
121
+			$this->get_other_model()->get_this_model_name()
122
+		) . $other_table_pk_field->get_table_alias();
123
+		$other_table                        = $this->get_other_model()->get_table_for_alias($other_table_alias);
124 124
 
125
-        $SQL = $this->_left_join(
126
-            $other_table,
127
-            $other_table_alias,
128
-            $other_table_pk_field->get_table_column(),
129
-            $join_table_alias,
130
-            $join_table_fk_field_to_other_table->get_table_column()
131
-        ) . $this->get_other_model()->_construct_internal_join_to_table_with_alias($other_table_alias);
132
-        return $SQL;
133
-    }
125
+		$SQL = $this->_left_join(
126
+			$other_table,
127
+			$other_table_alias,
128
+			$other_table_pk_field->get_table_column(),
129
+			$join_table_alias,
130
+			$join_table_fk_field_to_other_table->get_table_column()
131
+		) . $this->get_other_model()->_construct_internal_join_to_table_with_alias($other_table_alias);
132
+		return $SQL;
133
+	}
134 134
 
135 135
 
136
-    /**
137
-     * Ensures there is an entry in the join table between these two models. Feel free to do this manually if you like.
138
-     * If the join table has additional columns (eg, the Event_Question_Group table has a is_primary column), then
139
-     * you'll want to directly use the EEM_Event_Question_Group model to add the entry to the table and set those extra
140
-     * columns' values
141
-     *
142
-     * @param EE_Base_Class|int $this_obj_or_id
143
-     * @param EE_Base_Class|int $other_obj_or_id
144
-     * @param array             $extra_join_model_fields_n_values col=>val pairs that are used as extra conditions for
145
-     *                                                            checking existing values and for setting new rows if
146
-     *                                                            no exact matches.
147
-     * @return EE_Base_Class
148
-     * @throws \EE_Error
149
-     */
150
-    public function add_relation_to($this_obj_or_id, $other_obj_or_id, $extra_join_model_fields_n_values = array())
151
-    {
152
-        $this_model_obj  = $this->get_this_model()->ensure_is_obj($this_obj_or_id, true);
153
-        $other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id, true);
154
-        // check if such a relationship already exists
155
-        $join_model_fk_to_this_model  = $this->get_join_model()->get_foreign_key_to($this->get_this_model()->get_this_model_name());
156
-        $join_model_fk_to_other_model = $this->get_join_model()->get_foreign_key_to($this->get_other_model()->get_this_model_name());
136
+	/**
137
+	 * Ensures there is an entry in the join table between these two models. Feel free to do this manually if you like.
138
+	 * If the join table has additional columns (eg, the Event_Question_Group table has a is_primary column), then
139
+	 * you'll want to directly use the EEM_Event_Question_Group model to add the entry to the table and set those extra
140
+	 * columns' values
141
+	 *
142
+	 * @param EE_Base_Class|int $this_obj_or_id
143
+	 * @param EE_Base_Class|int $other_obj_or_id
144
+	 * @param array             $extra_join_model_fields_n_values col=>val pairs that are used as extra conditions for
145
+	 *                                                            checking existing values and for setting new rows if
146
+	 *                                                            no exact matches.
147
+	 * @return EE_Base_Class
148
+	 * @throws \EE_Error
149
+	 */
150
+	public function add_relation_to($this_obj_or_id, $other_obj_or_id, $extra_join_model_fields_n_values = array())
151
+	{
152
+		$this_model_obj  = $this->get_this_model()->ensure_is_obj($this_obj_or_id, true);
153
+		$other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id, true);
154
+		// check if such a relationship already exists
155
+		$join_model_fk_to_this_model  = $this->get_join_model()->get_foreign_key_to($this->get_this_model()->get_this_model_name());
156
+		$join_model_fk_to_other_model = $this->get_join_model()->get_foreign_key_to($this->get_other_model()->get_this_model_name());
157 157
 
158
-        $foreign_keys = $all_fields = array(
159
-            $join_model_fk_to_this_model->get_name()  => $this_model_obj->ID(),
160
-            $join_model_fk_to_other_model->get_name() => $other_model_obj->ID(),
161
-        );
158
+		$foreign_keys = $all_fields = array(
159
+			$join_model_fk_to_this_model->get_name()  => $this_model_obj->ID(),
160
+			$join_model_fk_to_other_model->get_name() => $other_model_obj->ID(),
161
+		);
162 162
 
163
-        // if $where_query exists lets add them to the query_params.
164
-        if (! empty($extra_join_model_fields_n_values)) {
165
-            // make sure we strip any of the join model names from the $where_query cause we don't need that in here (why? because client code may have used the same conditionals for get_all_related which DOES need the join model name)
166
-            // make sure we strip THIS models name from the query param
167
-            $parsed_query = array();
168
-            foreach ($extra_join_model_fields_n_values as $query_param => $val) {
169
-                $query_param                = str_replace(
170
-                    $this->get_join_model()->get_this_model_name() . ".",
171
-                    "",
172
-                    $query_param
173
-                );
174
-                $parsed_query[ $query_param ] = $val;
175
-            }
176
-            $all_fields = array_merge($foreign_keys, $parsed_query);
177
-        }
163
+		// if $where_query exists lets add them to the query_params.
164
+		if (! empty($extra_join_model_fields_n_values)) {
165
+			// make sure we strip any of the join model names from the $where_query cause we don't need that in here (why? because client code may have used the same conditionals for get_all_related which DOES need the join model name)
166
+			// make sure we strip THIS models name from the query param
167
+			$parsed_query = array();
168
+			foreach ($extra_join_model_fields_n_values as $query_param => $val) {
169
+				$query_param                = str_replace(
170
+					$this->get_join_model()->get_this_model_name() . ".",
171
+					"",
172
+					$query_param
173
+				);
174
+				$parsed_query[ $query_param ] = $val;
175
+			}
176
+			$all_fields = array_merge($foreign_keys, $parsed_query);
177
+		}
178 178
 
179
-        $existing_entry_in_join_table = $this->get_join_model()->get_one(array($foreign_keys));
180
-        // If there is already an entry in the join table, indicating a relationship, update it instead of adding a
181
-        // new row.
182
-        // Again, if you want more sophisticated logic or insertions (handling more columns than just 2 foreign keys to
183
-        // the other tables) use the joining model directly!
184
-        if (! $existing_entry_in_join_table) {
185
-            $this->get_join_model()->insert($all_fields);
186
-        } else {
187
-            $this->get_join_model()->update(
188
-                $all_fields,
189
-                [$foreign_keys]
190
-            );
191
-        }
192
-        return $other_model_obj;
193
-    }
179
+		$existing_entry_in_join_table = $this->get_join_model()->get_one(array($foreign_keys));
180
+		// If there is already an entry in the join table, indicating a relationship, update it instead of adding a
181
+		// new row.
182
+		// Again, if you want more sophisticated logic or insertions (handling more columns than just 2 foreign keys to
183
+		// the other tables) use the joining model directly!
184
+		if (! $existing_entry_in_join_table) {
185
+			$this->get_join_model()->insert($all_fields);
186
+		} else {
187
+			$this->get_join_model()->update(
188
+				$all_fields,
189
+				[$foreign_keys]
190
+			);
191
+		}
192
+		return $other_model_obj;
193
+	}
194 194
 
195 195
 
196
-    /**
197
-     * Deletes any rows in the join table that have foreign keys matching the other model objects specified
198
-     *
199
-     * @param EE_Base_Class|int $this_obj_or_id
200
-     * @param EE_Base_Class|int $other_obj_or_id
201
-     * @param array             $where_query col=>val pairs that are used as extra conditions for checking existing
202
-     *                                       values and for removing existing rows if exact matches exist.
203
-     * @return EE_Base_Class
204
-     * @throws \EE_Error
205
-     */
206
-    public function remove_relation_to($this_obj_or_id, $other_obj_or_id, $where_query = array())
207
-    {
208
-        $this_model_obj  = $this->get_this_model()->ensure_is_obj($this_obj_or_id, true);
209
-        $other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id, true);
210
-        // check if such a relationship already exists
211
-        $join_model_fk_to_this_model  = $this->get_join_model()->get_foreign_key_to($this->get_this_model()->get_this_model_name());
212
-        $join_model_fk_to_other_model = $this->get_join_model()->get_foreign_key_to($this->get_other_model()->get_this_model_name());
196
+	/**
197
+	 * Deletes any rows in the join table that have foreign keys matching the other model objects specified
198
+	 *
199
+	 * @param EE_Base_Class|int $this_obj_or_id
200
+	 * @param EE_Base_Class|int $other_obj_or_id
201
+	 * @param array             $where_query col=>val pairs that are used as extra conditions for checking existing
202
+	 *                                       values and for removing existing rows if exact matches exist.
203
+	 * @return EE_Base_Class
204
+	 * @throws \EE_Error
205
+	 */
206
+	public function remove_relation_to($this_obj_or_id, $other_obj_or_id, $where_query = array())
207
+	{
208
+		$this_model_obj  = $this->get_this_model()->ensure_is_obj($this_obj_or_id, true);
209
+		$other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id, true);
210
+		// check if such a relationship already exists
211
+		$join_model_fk_to_this_model  = $this->get_join_model()->get_foreign_key_to($this->get_this_model()->get_this_model_name());
212
+		$join_model_fk_to_other_model = $this->get_join_model()->get_foreign_key_to($this->get_other_model()->get_this_model_name());
213 213
 
214
-        $cols_n_values = array(
215
-            $join_model_fk_to_this_model->get_name()  => $this_model_obj->ID(),
216
-            $join_model_fk_to_other_model->get_name() => $other_model_obj->ID(),
217
-        );
214
+		$cols_n_values = array(
215
+			$join_model_fk_to_this_model->get_name()  => $this_model_obj->ID(),
216
+			$join_model_fk_to_other_model->get_name() => $other_model_obj->ID(),
217
+		);
218 218
 
219
-        // if $where_query exists lets add them to the query_params.
220
-        if (! empty($where_query)) {
221
-            // make sure we strip any of the join model names from the $where_query cause we don't need that in here (why? because client code may have used the same conditionals for get_all_related which DOES need the join model name)
222
-            // make sure we strip THIS models name from the query param
223
-            $parsed_query = array();
224
-            foreach ($where_query as $query_param => $val) {
225
-                $query_param                = str_replace(
226
-                    $this->get_join_model()->get_this_model_name() . ".",
227
-                    "",
228
-                    $query_param
229
-                );
230
-                $parsed_query[ $query_param ] = $val;
231
-            }
232
-            $cols_n_values = array_merge($cols_n_values, $parsed_query);
233
-        }
219
+		// if $where_query exists lets add them to the query_params.
220
+		if (! empty($where_query)) {
221
+			// make sure we strip any of the join model names from the $where_query cause we don't need that in here (why? because client code may have used the same conditionals for get_all_related which DOES need the join model name)
222
+			// make sure we strip THIS models name from the query param
223
+			$parsed_query = array();
224
+			foreach ($where_query as $query_param => $val) {
225
+				$query_param                = str_replace(
226
+					$this->get_join_model()->get_this_model_name() . ".",
227
+					"",
228
+					$query_param
229
+				);
230
+				$parsed_query[ $query_param ] = $val;
231
+			}
232
+			$cols_n_values = array_merge($cols_n_values, $parsed_query);
233
+		}
234 234
 
235
-        $this->get_join_model()->delete(array($cols_n_values));
236
-        return $other_model_obj;
237
-    }
235
+		$this->get_join_model()->delete(array($cols_n_values));
236
+		return $other_model_obj;
237
+	}
238 238
 
239
-    /**
240
-     * Gets all the non-key fields (ie, not the primary key and not foreign keys) on the join model.
241
-     * @since 4.9.76.p
242
-     * @return EE_Model_Field_Base[]
243
-     * @throws EE_Error
244
-     */
245
-    public function getNonKeyFields()
246
-    {
247
-        // all fields besides the primary key and two foreign keys should be parameters
248
-        $join_model = $this->get_join_model();
249
-        $standard_fields = array();
250
-        if ($join_model->has_primary_key_field()) {
251
-            $standard_fields[] = $join_model->primary_key_name();
252
-        }
253
-        if ($this->get_this_model()->has_primary_key_field()) {
254
-            $standard_fields[] = $this->get_this_model()->primary_key_name();
255
-        }
256
-        if ($this->get_other_model()->has_primary_key_field()) {
257
-            $standard_fields[] = $this->get_other_model()->primary_key_name();
258
-        }
259
-        return array_diff_key(
260
-            $join_model->field_settings(),
261
-            array_flip($standard_fields)
262
-        );
263
-    }
239
+	/**
240
+	 * Gets all the non-key fields (ie, not the primary key and not foreign keys) on the join model.
241
+	 * @since 4.9.76.p
242
+	 * @return EE_Model_Field_Base[]
243
+	 * @throws EE_Error
244
+	 */
245
+	public function getNonKeyFields()
246
+	{
247
+		// all fields besides the primary key and two foreign keys should be parameters
248
+		$join_model = $this->get_join_model();
249
+		$standard_fields = array();
250
+		if ($join_model->has_primary_key_field()) {
251
+			$standard_fields[] = $join_model->primary_key_name();
252
+		}
253
+		if ($this->get_this_model()->has_primary_key_field()) {
254
+			$standard_fields[] = $this->get_this_model()->primary_key_name();
255
+		}
256
+		if ($this->get_other_model()->has_primary_key_field()) {
257
+			$standard_fields[] = $this->get_other_model()->primary_key_name();
258
+		}
259
+		return array_diff_key(
260
+			$join_model->field_settings(),
261
+			array_flip($standard_fields)
262
+		);
263
+	}
264 264
 
265
-    /**
266
-     * Returns true if the join model has non-key fields (ie, fields that aren't the primary key or foreign keys.)
267
-     * @since 4.9.76.p
268
-     * @return boolean
269
-     */
270
-    public function hasNonKeyFields()
271
-    {
272
-        return count($this->get_join_model()->field_settings()) > 3;
273
-    }
265
+	/**
266
+	 * Returns true if the join model has non-key fields (ie, fields that aren't the primary key or foreign keys.)
267
+	 * @since 4.9.76.p
268
+	 * @return boolean
269
+	 */
270
+	public function hasNonKeyFields()
271
+	{
272
+		return count($this->get_join_model()->field_settings()) > 3;
273
+	}
274 274
 }
Please login to merge, or discard this patch.
core/libraries/rest_api/calculations/Attendee.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -17,43 +17,43 @@
 block discarded – undo
17 17
 class Attendee extends AttendeeCalculationsBase
18 18
 {
19 19
 
20
-    /**
21
-     * @param array                  $wpdb_row
22
-     * @param WP_REST_Request        $request
23
-     * @param AttendeeControllerBase $controller
24
-     * @since 4.9.66.p
25
-     * @return string
26
-     */
27
-    public function userAvatar(array $wpdb_row, WP_REST_Request $request, AttendeeControllerBase $controller)
28
-    {
29
-        if (is_array($wpdb_row) && isset($wpdb_row['Attendee_Meta.ATT_email'])) {
30
-            $email_address = $wpdb_row['Attendee_Meta.ATT_email'];
31
-        }
32
-        if (empty($email_address)) {
33
-            return get_avatar_url('', array('force_default' => true));
34
-        }
35
-        $avatar = get_avatar_url($email_address);
36
-        return $avatar ? $avatar : '';
37
-    }
20
+	/**
21
+	 * @param array                  $wpdb_row
22
+	 * @param WP_REST_Request        $request
23
+	 * @param AttendeeControllerBase $controller
24
+	 * @since 4.9.66.p
25
+	 * @return string
26
+	 */
27
+	public function userAvatar(array $wpdb_row, WP_REST_Request $request, AttendeeControllerBase $controller)
28
+	{
29
+		if (is_array($wpdb_row) && isset($wpdb_row['Attendee_Meta.ATT_email'])) {
30
+			$email_address = $wpdb_row['Attendee_Meta.ATT_email'];
31
+		}
32
+		if (empty($email_address)) {
33
+			return get_avatar_url('', array('force_default' => true));
34
+		}
35
+		$avatar = get_avatar_url($email_address);
36
+		return $avatar ? $avatar : '';
37
+	}
38 38
 
39 39
 
40
-    /**
41
-     * Provides an array for all the calculations possible that outlines a json schema for those calculations.
42
-     * Array is indexed by calculation (snake case) and value is the schema for that calculation.
43
-     *
44
-     * @since 4.9.68.p
45
-     * @return array
46
-     */
47
-    public function schemaForCalculations()
48
-    {
49
-        return array(
50
-            'user_avatar' => array(
51
-                'description' => esc_html__(
52
-                    'The avatar url for the attendee (if available).',
53
-                    'event_espresso'
54
-                ),
55
-                'type'        => 'string',
56
-            ),
57
-        );
58
-    }
40
+	/**
41
+	 * Provides an array for all the calculations possible that outlines a json schema for those calculations.
42
+	 * Array is indexed by calculation (snake case) and value is the schema for that calculation.
43
+	 *
44
+	 * @since 4.9.68.p
45
+	 * @return array
46
+	 */
47
+	public function schemaForCalculations()
48
+	{
49
+		return array(
50
+			'user_avatar' => array(
51
+				'description' => esc_html__(
52
+					'The avatar url for the attendee (if available).',
53
+					'event_espresso'
54
+				),
55
+				'type'        => 'string',
56
+			),
57
+		);
58
+	}
59 59
 }
Please login to merge, or discard this patch.