Completed
Branch dependabot/composer/wp-graphql... (d51bd9)
by
unknown
05:53 queued 14s
created
core/domain/values/FilePath.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,14 +31,14 @@
 block discarded – undo
31 31
      */
32 32
     public function __construct(string $file_path)
33 33
     {
34
-        if (! is_string($file_path)) {
34
+        if ( ! is_string($file_path)) {
35 35
             throw new InvalidDataTypeException(
36 36
                 '$file_path',
37 37
                 $file_path,
38 38
                 'string'
39 39
             );
40 40
         }
41
-        if (! is_readable($file_path)) {
41
+        if ( ! is_readable($file_path)) {
42 42
             throw new InvalidFilePathException($file_path);
43 43
         }
44 44
         $this->file_path = $file_path;
Please login to merge, or discard this patch.
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -15,40 +15,40 @@
 block discarded – undo
15 15
  */
16 16
 class FilePath
17 17
 {
18
-    /**
19
-     * @var string file_path
20
-     */
21
-    private $file_path;
18
+	/**
19
+	 * @var string file_path
20
+	 */
21
+	private $file_path;
22 22
 
23 23
 
24
-    /**
25
-     * FilePath constructor.
26
-     *
27
-     * @param string $file_path
28
-     * @throws InvalidDataTypeException
29
-     * @throws InvalidFilePathException
30
-     */
31
-    public function __construct(string $file_path)
32
-    {
33
-        if (! is_string($file_path)) {
34
-            throw new InvalidDataTypeException(
35
-                '$file_path',
36
-                $file_path,
37
-                'string'
38
-            );
39
-        }
40
-        if (! is_readable($file_path)) {
41
-            throw new InvalidFilePathException($file_path);
42
-        }
43
-        $this->file_path = $file_path;
44
-    }
24
+	/**
25
+	 * FilePath constructor.
26
+	 *
27
+	 * @param string $file_path
28
+	 * @throws InvalidDataTypeException
29
+	 * @throws InvalidFilePathException
30
+	 */
31
+	public function __construct(string $file_path)
32
+	{
33
+		if (! is_string($file_path)) {
34
+			throw new InvalidDataTypeException(
35
+				'$file_path',
36
+				$file_path,
37
+				'string'
38
+			);
39
+		}
40
+		if (! is_readable($file_path)) {
41
+			throw new InvalidFilePathException($file_path);
42
+		}
43
+		$this->file_path = $file_path;
44
+	}
45 45
 
46 46
 
47
-    /**
48
-     * @return string
49
-     */
50
-    public function __toString(): string
51
-    {
52
-        return $this->file_path;
53
-    }
47
+	/**
48
+	 * @return string
49
+	 */
50
+	public function __toString(): string
51
+	{
52
+		return $this->file_path;
53
+	}
54 54
 }
Please login to merge, or discard this patch.
core/domain/values/FullyQualifiedName.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,14 +33,14 @@
 block discarded – undo
33 33
      */
34 34
     public function __construct(string $fully_qualified_name)
35 35
     {
36
-        if (! is_string($fully_qualified_name)) {
36
+        if ( ! is_string($fully_qualified_name)) {
37 37
             throw new InvalidDataTypeException(
38 38
                 '$fully_qualified_name',
39 39
                 $fully_qualified_name,
40 40
                 'string'
41 41
             );
42 42
         }
43
-        if (! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) {
43
+        if ( ! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) {
44 44
             if (strpos($fully_qualified_name, 'Interface') !== false) {
45 45
                 throw new InvalidInterfaceException($fully_qualified_name);
46 46
             }
Please login to merge, or discard this patch.
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -16,53 +16,53 @@
 block discarded – undo
16 16
  */
17 17
 class FullyQualifiedName
18 18
 {
19
-    /**
20
-     * @var string $fully_qualified_name
21
-     */
22
-    private $fully_qualified_name;
19
+	/**
20
+	 * @var string $fully_qualified_name
21
+	 */
22
+	private $fully_qualified_name;
23 23
 
24 24
 
25
-    /**
26
-     * FullyQualifiedName constructor.
27
-     *
28
-     * @param string $fully_qualified_name
29
-     * @throws InvalidClassException
30
-     * @throws InvalidInterfaceException
31
-     * @throws InvalidDataTypeException
32
-     */
33
-    public function __construct(string $fully_qualified_name)
34
-    {
35
-        if (! is_string($fully_qualified_name)) {
36
-            throw new InvalidDataTypeException(
37
-                '$fully_qualified_name',
38
-                $fully_qualified_name,
39
-                'string'
40
-            );
41
-        }
42
-        if (! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) {
43
-            if (strpos($fully_qualified_name, 'Interface') !== false) {
44
-                throw new InvalidInterfaceException($fully_qualified_name);
45
-            }
46
-            throw new InvalidClassException($fully_qualified_name);
47
-        }
48
-        $this->fully_qualified_name = $fully_qualified_name;
49
-    }
25
+	/**
26
+	 * FullyQualifiedName constructor.
27
+	 *
28
+	 * @param string $fully_qualified_name
29
+	 * @throws InvalidClassException
30
+	 * @throws InvalidInterfaceException
31
+	 * @throws InvalidDataTypeException
32
+	 */
33
+	public function __construct(string $fully_qualified_name)
34
+	{
35
+		if (! is_string($fully_qualified_name)) {
36
+			throw new InvalidDataTypeException(
37
+				'$fully_qualified_name',
38
+				$fully_qualified_name,
39
+				'string'
40
+			);
41
+		}
42
+		if (! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) {
43
+			if (strpos($fully_qualified_name, 'Interface') !== false) {
44
+				throw new InvalidInterfaceException($fully_qualified_name);
45
+			}
46
+			throw new InvalidClassException($fully_qualified_name);
47
+		}
48
+		$this->fully_qualified_name = $fully_qualified_name;
49
+	}
50 50
 
51 51
 
52
-    /**
53
-     * @return string
54
-     */
55
-    public function string(): string
56
-    {
57
-        return $this->fully_qualified_name;
58
-    }
52
+	/**
53
+	 * @return string
54
+	 */
55
+	public function string(): string
56
+	{
57
+		return $this->fully_qualified_name;
58
+	}
59 59
 
60 60
 
61
-    /**
62
-     * @return string
63
-     */
64
-    public function __toString(): string
65
-    {
66
-        return $this->fully_qualified_name;
67
-    }
61
+	/**
62
+	 * @return string
63
+	 */
64
+	public function __toString(): string
65
+	{
66
+		return $this->fully_qualified_name;
67
+	}
68 68
 }
Please login to merge, or discard this patch.
core/domain/DomainFactory.php 2 patches
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -22,101 +22,101 @@
 block discarded – undo
22 22
  */
23 23
 class DomainFactory
24 24
 {
25
-    /**
26
-     * @var DomainInterface[]
27
-     */
28
-    protected static $domains = [];
25
+	/**
26
+	 * @var DomainInterface[]
27
+	 */
28
+	protected static $domains = [];
29 29
 
30 30
 
31
-    /**
32
-     * @param string $domain_fqcn       [required] Fully Qualified Class Name for the Domain class
33
-     * @param string $main_file         [required] path to the main plugin file
34
-     * @param string $version           [required] version string for the plugin
35
-     * @return DomainInterface
36
-     * @throws DomainException
37
-     * @throws InvalidArgumentException
38
-     * @throws InvalidDataTypeException
39
-     * @throws InvalidInterfaceException
40
-     */
41
-    public static function create(string $domain_fqcn, string $main_file, string $version): DomainInterface
42
-    {
43
-        $fqcn = new FullyQualifiedName($domain_fqcn);
44
-        return DomainFactory::getDomain($fqcn->string(), [$main_file, $version]);
45
-    }
31
+	/**
32
+	 * @param string $domain_fqcn       [required] Fully Qualified Class Name for the Domain class
33
+	 * @param string $main_file         [required] path to the main plugin file
34
+	 * @param string $version           [required] version string for the plugin
35
+	 * @return DomainInterface
36
+	 * @throws DomainException
37
+	 * @throws InvalidArgumentException
38
+	 * @throws InvalidDataTypeException
39
+	 * @throws InvalidInterfaceException
40
+	 */
41
+	public static function create(string $domain_fqcn, string $main_file, string $version): DomainInterface
42
+	{
43
+		$fqcn = new FullyQualifiedName($domain_fqcn);
44
+		return DomainFactory::getDomain($fqcn->string(), [$main_file, $version]);
45
+	}
46 46
 
47 47
 
48
-    /**
49
-     * @param FullyQualifiedName $domain_fqcn   [required] Fully Qualified Class Name for the Domain class
50
-     * @param array              $arguments     [required] array of arguments to be passed to the Domain class
51
-     *                                          constructor. Must at least include the following two value objects:
52
-     *                                          [
53
-     *                                              EventEspresso\core\domain\values\FilePath $plugin_file
54
-     *                                              EventEspresso\core\domain\values\Version $version
55
-     *                                          ]
56
-     * @return DomainInterface
57
-     * @throws DomainException
58
-     * @throws InvalidArgumentException
59
-     * @throws InvalidDataTypeException
60
-     * @throws InvalidInterfaceException
61
-     */
62
-    public static function getShared(FullyQualifiedName $domain_fqcn, array $arguments): DomainInterface
63
-    {
64
-        return DomainFactory::getDomain($domain_fqcn->string(), $arguments);
65
-    }
48
+	/**
49
+	 * @param FullyQualifiedName $domain_fqcn   [required] Fully Qualified Class Name for the Domain class
50
+	 * @param array              $arguments     [required] array of arguments to be passed to the Domain class
51
+	 *                                          constructor. Must at least include the following two value objects:
52
+	 *                                          [
53
+	 *                                              EventEspresso\core\domain\values\FilePath $plugin_file
54
+	 *                                              EventEspresso\core\domain\values\Version $version
55
+	 *                                          ]
56
+	 * @return DomainInterface
57
+	 * @throws DomainException
58
+	 * @throws InvalidArgumentException
59
+	 * @throws InvalidDataTypeException
60
+	 * @throws InvalidInterfaceException
61
+	 */
62
+	public static function getShared(FullyQualifiedName $domain_fqcn, array $arguments): DomainInterface
63
+	{
64
+		return DomainFactory::getDomain($domain_fqcn->string(), $arguments);
65
+	}
66 66
 
67 67
 
68
-    /**
69
-     * @return DomainInterface
70
-     * @throws DomainException
71
-     * @throws InvalidArgumentException
72
-     * @throws InvalidDataTypeException
73
-     * @throws InvalidFilePathException
74
-     * @throws InvalidInterfaceException
75
-     */
76
-    public static function getEventEspressoCoreDomain(): DomainInterface
77
-    {
78
-        $fqcn = 'EventEspresso\core\domain\Domain';
79
-        if (! isset(DomainFactory::$domains[ $fqcn ])) {
80
-            DomainFactory::getDomain($fqcn, [EVENT_ESPRESSO_MAIN_FILE, espresso_version()]);
81
-        }
82
-        return DomainFactory::$domains[ $fqcn ];
83
-    }
68
+	/**
69
+	 * @return DomainInterface
70
+	 * @throws DomainException
71
+	 * @throws InvalidArgumentException
72
+	 * @throws InvalidDataTypeException
73
+	 * @throws InvalidFilePathException
74
+	 * @throws InvalidInterfaceException
75
+	 */
76
+	public static function getEventEspressoCoreDomain(): DomainInterface
77
+	{
78
+		$fqcn = 'EventEspresso\core\domain\Domain';
79
+		if (! isset(DomainFactory::$domains[ $fqcn ])) {
80
+			DomainFactory::getDomain($fqcn, [EVENT_ESPRESSO_MAIN_FILE, espresso_version()]);
81
+		}
82
+		return DomainFactory::$domains[ $fqcn ];
83
+	}
84 84
 
85 85
 
86
-    /**
87
-     * @param string $fqcn
88
-     * @param array  $arguments
89
-     * @return DomainInterface
90
-     */
91
-    private static function getDomain(string $fqcn, array $arguments): DomainInterface
92
-    {
93
-        if (! isset(DomainFactory::$domains[ $fqcn ])) {
94
-            if (! isset($arguments[0], $arguments[1])) {
95
-                throw new InvalidArgumentException(
96
-                    esc_html__(
97
-                        'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class',
98
-                        'event_espresso'
99
-                    )
100
-                );
101
-            }
102
-            $filepath = $arguments[0] instanceof FilePath ? $arguments[0] : new FilePath($arguments[0]);
103
-            $version  = $arguments[1] instanceof Version ? $arguments[1] : Version::fromString($arguments[1]);
104
-            $domain   = new $fqcn($filepath, $version);
105
-            if (! $domain instanceof DomainBase || ! $domain instanceof $fqcn) {
106
-                throw new DomainException(
107
-                    sprintf(
108
-                        esc_html__(
109
-                            'The requested Domain class "%1$s" could not be loaded.',
110
-                            'event_espresso'
111
-                        ),
112
-                        $fqcn
113
-                    )
114
-                );
115
-            }
116
-            DomainFactory::$domains[ $fqcn ] = $domain;
117
-            // we still need to share this with the core loader to facilitate automatic dependency injection
118
-            LoaderFactory::getLoader()->share($fqcn, $domain, [$filepath, $version, $domain->assetNamespace()]);
119
-        }
120
-        return DomainFactory::$domains[ $fqcn ];
121
-    }
86
+	/**
87
+	 * @param string $fqcn
88
+	 * @param array  $arguments
89
+	 * @return DomainInterface
90
+	 */
91
+	private static function getDomain(string $fqcn, array $arguments): DomainInterface
92
+	{
93
+		if (! isset(DomainFactory::$domains[ $fqcn ])) {
94
+			if (! isset($arguments[0], $arguments[1])) {
95
+				throw new InvalidArgumentException(
96
+					esc_html__(
97
+						'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class',
98
+						'event_espresso'
99
+					)
100
+				);
101
+			}
102
+			$filepath = $arguments[0] instanceof FilePath ? $arguments[0] : new FilePath($arguments[0]);
103
+			$version  = $arguments[1] instanceof Version ? $arguments[1] : Version::fromString($arguments[1]);
104
+			$domain   = new $fqcn($filepath, $version);
105
+			if (! $domain instanceof DomainBase || ! $domain instanceof $fqcn) {
106
+				throw new DomainException(
107
+					sprintf(
108
+						esc_html__(
109
+							'The requested Domain class "%1$s" could not be loaded.',
110
+							'event_espresso'
111
+						),
112
+						$fqcn
113
+					)
114
+				);
115
+			}
116
+			DomainFactory::$domains[ $fqcn ] = $domain;
117
+			// we still need to share this with the core loader to facilitate automatic dependency injection
118
+			LoaderFactory::getLoader()->share($fqcn, $domain, [$filepath, $version, $domain->assetNamespace()]);
119
+		}
120
+		return DomainFactory::$domains[ $fqcn ];
121
+	}
122 122
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -76,10 +76,10 @@  discard block
 block discarded – undo
76 76
     public static function getEventEspressoCoreDomain(): DomainInterface
77 77
     {
78 78
         $fqcn = 'EventEspresso\core\domain\Domain';
79
-        if (! isset(DomainFactory::$domains[ $fqcn ])) {
79
+        if ( ! isset(DomainFactory::$domains[$fqcn])) {
80 80
             DomainFactory::getDomain($fqcn, [EVENT_ESPRESSO_MAIN_FILE, espresso_version()]);
81 81
         }
82
-        return DomainFactory::$domains[ $fqcn ];
82
+        return DomainFactory::$domains[$fqcn];
83 83
     }
84 84
 
85 85
 
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
      */
91 91
     private static function getDomain(string $fqcn, array $arguments): DomainInterface
92 92
     {
93
-        if (! isset(DomainFactory::$domains[ $fqcn ])) {
94
-            if (! isset($arguments[0], $arguments[1])) {
93
+        if ( ! isset(DomainFactory::$domains[$fqcn])) {
94
+            if ( ! isset($arguments[0], $arguments[1])) {
95 95
                 throw new InvalidArgumentException(
96 96
                     esc_html__(
97 97
                         'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class',
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
             $filepath = $arguments[0] instanceof FilePath ? $arguments[0] : new FilePath($arguments[0]);
103 103
             $version  = $arguments[1] instanceof Version ? $arguments[1] : Version::fromString($arguments[1]);
104 104
             $domain   = new $fqcn($filepath, $version);
105
-            if (! $domain instanceof DomainBase || ! $domain instanceof $fqcn) {
105
+            if ( ! $domain instanceof DomainBase || ! $domain instanceof $fqcn) {
106 106
                 throw new DomainException(
107 107
                     sprintf(
108 108
                         esc_html__(
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
                     )
114 114
                 );
115 115
             }
116
-            DomainFactory::$domains[ $fqcn ] = $domain;
116
+            DomainFactory::$domains[$fqcn] = $domain;
117 117
             // we still need to share this with the core loader to facilitate automatic dependency injection
118 118
             LoaderFactory::getLoader()->share($fqcn, $domain, [$filepath, $version, $domain->assetNamespace()]);
119 119
         }
120
-        return DomainFactory::$domains[ $fqcn ];
120
+        return DomainFactory::$domains[$fqcn];
121 121
     }
122 122
 }
Please login to merge, or discard this patch.
admin_pages/messages/help_tabs/messages_templates.help_tab.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -3,25 +3,25 @@
 block discarded – undo
3 3
 </p>
4 4
 <p>
5 5
     <?php
6
-    printf(
7
-        esc_html__(
8
-            'Message Templates are the %1$sformat%2$s of the messages going out. Think of them as a “form letter”. Templates tell the Messages system how to style your messages and the content (information) they will have when they are delivered.',
9
-            'event_espresso'
10
-        ),
11
-        '<em>',
12
-        '</em>'
13
-    );
14
-    ?>
6
+	printf(
7
+		esc_html__(
8
+			'Message Templates are the %1$sformat%2$s of the messages going out. Think of them as a “form letter”. Templates tell the Messages system how to style your messages and the content (information) they will have when they are delivered.',
9
+			'event_espresso'
10
+		),
11
+		'<em>',
12
+		'</em>'
13
+	);
14
+	?>
15 15
 </p>
16 16
 <p>
17 17
     <?php esc_html_e(
18
-        'There is a template created for each Messenger / Message Type and context combination. For example, messages that are sent for Payment Confirmation have a template for Event Administrator and a different one for Primary Registrant.  Whereas, messages that are sent for the Registration confirmation have 3 templates: one for Event Administrator, one for the Primary Registrant, and another for each additional Registrant(s).',
19
-        'event_espresso'
20
-    ); ?>
18
+		'There is a template created for each Messenger / Message Type and context combination. For example, messages that are sent for Payment Confirmation have a template for Event Administrator and a different one for Primary Registrant.  Whereas, messages that are sent for the Registration confirmation have 3 templates: one for Event Administrator, one for the Primary Registrant, and another for each additional Registrant(s).',
19
+		'event_espresso'
20
+	); ?>
21 21
 </p>
22 22
 <p>
23 23
     <?php esc_html_e(
24
-        'With the Event Espresso Messages system, every Messenger, Message Type, and context will have a global template created with some default content on creation. You have the ability to edit the global template that will be used for all events you create. Additionally, you have the ability to create custom templates for each event on the edit event page for the event (in a metabox labelled "Notifications").',
25
-        'event_espresso'
26
-    ); ?>
24
+		'With the Event Espresso Messages system, every Messenger, Message Type, and context will have a global template created with some default content on creation. You have the ability to edit the global template that will be used for all events you create. Additionally, you have the ability to create custom templates for each event on the edit event page for the event (in a metabox labelled "Notifications").',
25
+		'event_espresso'
26
+	); ?>
27 27
 </p>
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Datetime_List_Shortcodes.lib.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     private function _get_datetimes_from_event(EE_Event $event)
169 169
     {
170 170
         return isset($this->_extra_data['data']->events)
171
-            ? $this->_extra_data['data']->events[ $event->ID() ]['dtt_objs']
171
+            ? $this->_extra_data['data']->events[$event->ID()]['dtt_objs']
172 172
             : [];
173 173
     }
174 174
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
     private function _get_datetimes_from_ticket(EE_Ticket $ticket)
183 183
     {
184 184
         return isset($this->_extra_data['data']->tickets)
185
-            ? $this->_extra_data['data']->tickets[ $ticket->ID() ]['dtt_objs']
185
+            ? $this->_extra_data['data']->tickets[$ticket->ID()]['dtt_objs']
186 186
             : [];
187 187
     }
188 188
 }
Please login to merge, or discard this patch.
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -18,168 +18,168 @@
 block discarded – undo
18 18
  */
19 19
 class EE_Datetime_List_Shortcodes extends EE_Shortcodes
20 20
 {
21
-    protected function _init_props()
22
-    {
23
-        $this->label       = esc_html__('Datetime List Shortcodes', 'event_espresso');
24
-        $this->description = esc_html__('All shortcodes specific to datetime lists', 'event_espresso');
25
-        $this->_shortcodes = [
26
-            '[DATETIME_LIST]' => esc_html__(
27
-                'Will output a list of datetimes according to the layout specified in the datetime list field.',
28
-                'event_espresso'
29
-            ),
30
-        ];
31
-    }
32
-
33
-
34
-    /**
35
-     * @param string $shortcode
36
-     * @return string
37
-     * @throws EE_Error
38
-     * @throws ReflectionException
39
-     */
40
-    protected function _parser($shortcode)
41
-    {
42
-        if ($shortcode == '[DATETIME_LIST]') {
43
-            return $this->_get_datetime_list();
44
-        }
45
-        return '';
46
-    }
47
-
48
-
49
-    /**
50
-     * figure out what the incoming data is and then return the appropriate parsed value.
51
-     *
52
-     * @return string
53
-     * @throws EE_Error
54
-     * @throws ReflectionException
55
-     */
56
-    private function _get_datetime_list()
57
-    {
58
-        $this->_validate_list_requirements();
59
-
60
-        if ($this->_data['data'] instanceof EE_Ticket) {
61
-            return $this->_get_datetime_list_for_ticket();
62
-        }
63
-        if ($this->_data['data'] instanceof EE_Event) {
64
-            return $this->_get_datetime_list_for_event();
65
-        }
66
-        if (
67
-            $this->_data['data'] instanceof EE_Messages_Addressee
68
-            && $this->_data['data']->reg_obj instanceof EE_Registration
69
-        ) {
70
-            return $this->_get_datetime_list_for_registration();
71
-        }
72
-        // prevent recursive loop
73
-        return '';
74
-    }
75
-
76
-
77
-    /**
78
-     * return parsed list of datetimes for an event
79
-     *
80
-     * @return string
81
-     * @throws EE_Error
82
-     * @throws ReflectionException
83
-     */
84
-    private function _get_datetime_list_for_event()
85
-    {
86
-        $event            = $this->_data['data'];
87
-        $valid_shortcodes = ['datetime', 'attendee'];
88
-        $template         = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list'])
89
-            ? $this->_data['template']['datetime_list']
90
-            : $this->_extra_data['template']['datetime_list'];
91
-
92
-        // here we're setting up the datetimes for the datetime list template for THIS event.
93
-        $dtt_parsed = '';
94
-        $datetimes  = $this->_get_datetimes_from_event($event);
95
-
96
-        // each datetime in this case should be an datetime object.
97
-        foreach ($datetimes as $datetime) {
98
-            $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template(
99
-                $template,
100
-                $datetime,
101
-                $valid_shortcodes,
102
-                $this->_extra_data
103
-            );
104
-        }
105
-
106
-        return $dtt_parsed;
107
-    }
108
-
109
-
110
-    /**
111
-     * return parsed list of datetimes for an ticket
112
-     *
113
-     * @return string
114
-     * @throws EE_Error
115
-     */
116
-    private function _get_datetime_list_for_ticket()
117
-    {
118
-        $valid_shortcodes = ['datetime', 'attendee'];
119
-
120
-        $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list'])
121
-            ? $this->_data['template']['datetime_list']
122
-            : $this->_extra_data['template']['datetime_list'];
123
-        $ticket   = $this->_data['data'];
124
-
125
-        // here we're setting up the datetimes for the datetime list template for THIS ticket.
126
-        $dtt_parsed = '';
127
-        $datetimes  = $this->_get_datetimes_from_ticket($ticket);
128
-
129
-        // each datetime in this case should be an datetime object.
130
-        foreach ($datetimes as $datetime) {
131
-            $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template(
132
-                $template,
133
-                $datetime,
134
-                $valid_shortcodes,
135
-                $this->_extra_data
136
-            );
137
-        }
138
-
139
-        return $dtt_parsed;
140
-    }
141
-
142
-
143
-    /**
144
-     * return parsed list of datetimes from a given registration.
145
-     *
146
-     * @return string
147
-     * @throws EE_Error
148
-     * @throws EE_Error
149
-     */
150
-    private function _get_datetime_list_for_registration()
151
-    {
152
-        $registration = $this->_data['data']->reg_obj;
153
-
154
-        // now let's just get the ticket, set $this->_data['data'] to the ticket and then call _get_datetime_list_for__ticket();
155
-        $this->_data['data'] = $registration->ticket();
156
-        return $this->_get_datetime_list_for_ticket();
157
-    }
158
-
159
-
160
-    /**
161
-     * @param EE_Event $event
162
-     * @return array|mixed
163
-     * @throws EE_Error
164
-     * @throws ReflectionException
165
-     */
166
-    private function _get_datetimes_from_event(EE_Event $event)
167
-    {
168
-        return isset($this->_extra_data['data']->events)
169
-            ? $this->_extra_data['data']->events[ $event->ID() ]['dtt_objs']
170
-            : [];
171
-    }
172
-
173
-
174
-    /**
175
-     * @param EE_Ticket $ticket
176
-     * @return array|mixed
177
-     * @throws EE_Error
178
-     */
179
-    private function _get_datetimes_from_ticket(EE_Ticket $ticket)
180
-    {
181
-        return isset($this->_extra_data['data']->tickets)
182
-            ? $this->_extra_data['data']->tickets[ $ticket->ID() ]['dtt_objs']
183
-            : [];
184
-    }
21
+	protected function _init_props()
22
+	{
23
+		$this->label       = esc_html__('Datetime List Shortcodes', 'event_espresso');
24
+		$this->description = esc_html__('All shortcodes specific to datetime lists', 'event_espresso');
25
+		$this->_shortcodes = [
26
+			'[DATETIME_LIST]' => esc_html__(
27
+				'Will output a list of datetimes according to the layout specified in the datetime list field.',
28
+				'event_espresso'
29
+			),
30
+		];
31
+	}
32
+
33
+
34
+	/**
35
+	 * @param string $shortcode
36
+	 * @return string
37
+	 * @throws EE_Error
38
+	 * @throws ReflectionException
39
+	 */
40
+	protected function _parser($shortcode)
41
+	{
42
+		if ($shortcode == '[DATETIME_LIST]') {
43
+			return $this->_get_datetime_list();
44
+		}
45
+		return '';
46
+	}
47
+
48
+
49
+	/**
50
+	 * figure out what the incoming data is and then return the appropriate parsed value.
51
+	 *
52
+	 * @return string
53
+	 * @throws EE_Error
54
+	 * @throws ReflectionException
55
+	 */
56
+	private function _get_datetime_list()
57
+	{
58
+		$this->_validate_list_requirements();
59
+
60
+		if ($this->_data['data'] instanceof EE_Ticket) {
61
+			return $this->_get_datetime_list_for_ticket();
62
+		}
63
+		if ($this->_data['data'] instanceof EE_Event) {
64
+			return $this->_get_datetime_list_for_event();
65
+		}
66
+		if (
67
+			$this->_data['data'] instanceof EE_Messages_Addressee
68
+			&& $this->_data['data']->reg_obj instanceof EE_Registration
69
+		) {
70
+			return $this->_get_datetime_list_for_registration();
71
+		}
72
+		// prevent recursive loop
73
+		return '';
74
+	}
75
+
76
+
77
+	/**
78
+	 * return parsed list of datetimes for an event
79
+	 *
80
+	 * @return string
81
+	 * @throws EE_Error
82
+	 * @throws ReflectionException
83
+	 */
84
+	private function _get_datetime_list_for_event()
85
+	{
86
+		$event            = $this->_data['data'];
87
+		$valid_shortcodes = ['datetime', 'attendee'];
88
+		$template         = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list'])
89
+			? $this->_data['template']['datetime_list']
90
+			: $this->_extra_data['template']['datetime_list'];
91
+
92
+		// here we're setting up the datetimes for the datetime list template for THIS event.
93
+		$dtt_parsed = '';
94
+		$datetimes  = $this->_get_datetimes_from_event($event);
95
+
96
+		// each datetime in this case should be an datetime object.
97
+		foreach ($datetimes as $datetime) {
98
+			$dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template(
99
+				$template,
100
+				$datetime,
101
+				$valid_shortcodes,
102
+				$this->_extra_data
103
+			);
104
+		}
105
+
106
+		return $dtt_parsed;
107
+	}
108
+
109
+
110
+	/**
111
+	 * return parsed list of datetimes for an ticket
112
+	 *
113
+	 * @return string
114
+	 * @throws EE_Error
115
+	 */
116
+	private function _get_datetime_list_for_ticket()
117
+	{
118
+		$valid_shortcodes = ['datetime', 'attendee'];
119
+
120
+		$template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list'])
121
+			? $this->_data['template']['datetime_list']
122
+			: $this->_extra_data['template']['datetime_list'];
123
+		$ticket   = $this->_data['data'];
124
+
125
+		// here we're setting up the datetimes for the datetime list template for THIS ticket.
126
+		$dtt_parsed = '';
127
+		$datetimes  = $this->_get_datetimes_from_ticket($ticket);
128
+
129
+		// each datetime in this case should be an datetime object.
130
+		foreach ($datetimes as $datetime) {
131
+			$dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template(
132
+				$template,
133
+				$datetime,
134
+				$valid_shortcodes,
135
+				$this->_extra_data
136
+			);
137
+		}
138
+
139
+		return $dtt_parsed;
140
+	}
141
+
142
+
143
+	/**
144
+	 * return parsed list of datetimes from a given registration.
145
+	 *
146
+	 * @return string
147
+	 * @throws EE_Error
148
+	 * @throws EE_Error
149
+	 */
150
+	private function _get_datetime_list_for_registration()
151
+	{
152
+		$registration = $this->_data['data']->reg_obj;
153
+
154
+		// now let's just get the ticket, set $this->_data['data'] to the ticket and then call _get_datetime_list_for__ticket();
155
+		$this->_data['data'] = $registration->ticket();
156
+		return $this->_get_datetime_list_for_ticket();
157
+	}
158
+
159
+
160
+	/**
161
+	 * @param EE_Event $event
162
+	 * @return array|mixed
163
+	 * @throws EE_Error
164
+	 * @throws ReflectionException
165
+	 */
166
+	private function _get_datetimes_from_event(EE_Event $event)
167
+	{
168
+		return isset($this->_extra_data['data']->events)
169
+			? $this->_extra_data['data']->events[ $event->ID() ]['dtt_objs']
170
+			: [];
171
+	}
172
+
173
+
174
+	/**
175
+	 * @param EE_Ticket $ticket
176
+	 * @return array|mixed
177
+	 * @throws EE_Error
178
+	 */
179
+	private function _get_datetimes_from_ticket(EE_Ticket $ticket)
180
+	{
181
+		return isset($this->_extra_data['data']->tickets)
182
+			? $this->_extra_data['data']->tickets[ $ticket->ID() ]['dtt_objs']
183
+			: [];
184
+	}
185 185
 }
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Ticket_List_Shortcodes.lib.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     private function _get_tickets_from_event(EE_Event $event)
203 203
     {
204 204
         return isset($this->_extra_data['data']->events)
205
-            ? $this->_extra_data['data']->events[ $event->ID() ]['tkt_objs']
205
+            ? $this->_extra_data['data']->events[$event->ID()]['tkt_objs']
206 206
             : [];
207 207
     }
208 208
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     private function _get_ticket_list_from_registration(EE_Registration $registration)
217 217
     {
218 218
         return isset($this->_extra_data['data']->registrations)
219
-            ? [$this->_extra_data['data']->registrations[ $registration->ID() ]['tkt_obj']]
219
+            ? [$this->_extra_data['data']->registrations[$registration->ID()]['tkt_obj']]
220 220
             : [];
221 221
     }
222 222
 }
Please login to merge, or discard this patch.
Indentation   +199 added lines, -199 removed lines patch added patch discarded remove patch
@@ -18,203 +18,203 @@
 block discarded – undo
18 18
  */
19 19
 class EE_Ticket_List_Shortcodes extends EE_Shortcodes
20 20
 {
21
-    protected function _init_props()
22
-    {
23
-        $this->label       = esc_html__('Ticket List Shortcodes', 'event_espresso');
24
-        $this->description = esc_html__('All shortcodes specific to ticket lists', 'event_espresso');
25
-        $this->_shortcodes = [
26
-            '[TICKET_LIST]' => esc_html__('Will output a list of tickets', 'event_espresso'),
27
-        ];
28
-    }
29
-
30
-
31
-    /**
32
-     * @param string $shortcode
33
-     * @return string
34
-     * @throws EE_Error
35
-     * @throws ReflectionException
36
-     */
37
-    protected function _parser($shortcode)
38
-    {
39
-        if ($shortcode == '[TICKET_LIST]') {
40
-            return $this->_get_ticket_list();
41
-        }
42
-        return '';
43
-    }
44
-
45
-
46
-    /**
47
-     * figure out what the incoming data is and then return the appropriate parsed value.
48
-     *
49
-     * @return string
50
-     * @throws EE_Error
51
-     * @throws ReflectionException
52
-     */
53
-    private function _get_ticket_list()
54
-    {
55
-        $this->_validate_list_requirements();
56
-
57
-        if ($this->_data['data'] instanceof EE_Messages_Addressee) {
58
-            return $this->_get_ticket_list_for_main();
59
-        }
60
-        if ($this->_data['data'] instanceof EE_Registration) {
61
-            return $this->_get_ticket_list_for_attendee();
62
-        }
63
-        if ($this->_data['data'] instanceof EE_Event) {
64
-            return $this->_get_ticket_list_for_event();
65
-        }
66
-        // prevent recursive loop
67
-        return '';
68
-    }
69
-
70
-
71
-    /**
72
-     * This returns the parsed ticket list for main template;
73
-     */
74
-    private function _get_ticket_list_for_main()
75
-    {
76
-        $valid_shortcodes = [
77
-            'ticket',
78
-            'event_list',
79
-            'attendee_list',
80
-            'datetime_list',
81
-            'attendee',
82
-            'line_item_list',
83
-            'primary_registration_details',
84
-            'recipient_details',
85
-        ];
86
-        $template         = $this->_data['template'];
87
-        $data             = $this->_data['data'];
88
-        $ticket_list      = '';
89
-
90
-
91
-        // now we need to loop through the ticket list and send data to the EE_Parser helper.
92
-        foreach ($data->tickets as $ticket) {
93
-            $ticket_list .= $this->_shortcode_helper->parse_ticket_list_template(
94
-                $template,
95
-                $ticket['ticket'],
96
-                $valid_shortcodes,
97
-                $this->_extra_data
98
-            );
99
-        }
100
-
101
-        return $ticket_list;
102
-    }
103
-
104
-
105
-    /**
106
-     * return parsed list of tickets for an event
107
-     *
108
-     * @return string
109
-     * @throws EE_Error
110
-     * @throws ReflectionException
111
-     */
112
-    private function _get_ticket_list_for_event()
113
-    {
114
-        $valid_shortcodes = [
115
-            'ticket',
116
-            'attendee_list',
117
-            'datetime_list',
118
-            'attendee',
119
-            'venue',
120
-            'line_item_list',
121
-            'primary_registration_details',
122
-            'recipient_details',
123
-        ];
124
-        $template         = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list'])
125
-            ? $this->_data['template']['ticket_list']
126
-            : $this->_extra_data['template']['ticket_list'];
127
-        $event            = $this->_data['data'];
128
-
129
-        // let's remove any existing [EVENT_LIST] shortcodes from the ticket list template so that we don't get recursion.
130
-        $template = str_replace('[EVENT_LIST]', '', $template);
131
-
132
-        // here we're setting up the tickets for the ticket list template for THIS event.
133
-        $tkt_parsed = '';
134
-        $tickets    = $this->_get_tickets_from_event($event);
135
-
136
-        // each ticket in this case should be an ticket object.
137
-        foreach ($tickets as $ticket) {
138
-            $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template(
139
-                $template,
140
-                $ticket,
141
-                $valid_shortcodes,
142
-                $this->_extra_data
143
-            );
144
-        }
145
-
146
-        return $tkt_parsed;
147
-    }
148
-
149
-
150
-    /**
151
-     * return parsed list of tickets for an attendee
152
-     *
153
-     * @return string
154
-     * @throws EE_Error
155
-     * @throws ReflectionException
156
-     */
157
-    private function _get_ticket_list_for_attendee()
158
-    {
159
-        $valid_shortcodes = [
160
-            'ticket',
161
-            'event_list',
162
-            'datetime_list',
163
-            'attendee',
164
-            'primary_registration_details',
165
-            'recipient_details',
166
-        ];
167
-
168
-        $template     = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list'])
169
-            ? $this->_data['template']['ticket_list']
170
-            : $this->_extra_data['template']['ticket_list'];
171
-        $registration = $this->_data['data'];
172
-
173
-        // let's remove any existing [ATTENDEE_LIST] shortcode from the ticket list template so that we don't get recursion.
174
-        $template = str_replace('[ATTENDEE_LIST]', '', $template);
175
-
176
-        // here we're setting up the tickets for the ticket list template for THIS attendee.
177
-        $tkt_parsed = '';
178
-        $tickets    = $this->_get_ticket_list_from_registration($registration);
179
-
180
-        // each ticket in this case should be an ticket object.
181
-        foreach ($tickets as $ticket) {
182
-            $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template(
183
-                $template,
184
-                $ticket,
185
-                $valid_shortcodes,
186
-                $this->_extra_data
187
-            );
188
-        }
189
-
190
-        return $tkt_parsed;
191
-    }
192
-
193
-
194
-    /**
195
-     * @param EE_Event $event
196
-     * @return array|mixed
197
-     * @throws EE_Error
198
-     * @throws ReflectionException
199
-     */
200
-    private function _get_tickets_from_event(EE_Event $event)
201
-    {
202
-        return isset($this->_extra_data['data']->events)
203
-            ? $this->_extra_data['data']->events[ $event->ID() ]['tkt_objs']
204
-            : [];
205
-    }
206
-
207
-
208
-    /**
209
-     * @param EE_Registration $registration
210
-     * @return array
211
-     * @throws EE_Error
212
-     * @throws ReflectionException
213
-     */
214
-    private function _get_ticket_list_from_registration(EE_Registration $registration)
215
-    {
216
-        return isset($this->_extra_data['data']->registrations)
217
-            ? [$this->_extra_data['data']->registrations[ $registration->ID() ]['tkt_obj']]
218
-            : [];
219
-    }
21
+	protected function _init_props()
22
+	{
23
+		$this->label       = esc_html__('Ticket List Shortcodes', 'event_espresso');
24
+		$this->description = esc_html__('All shortcodes specific to ticket lists', 'event_espresso');
25
+		$this->_shortcodes = [
26
+			'[TICKET_LIST]' => esc_html__('Will output a list of tickets', 'event_espresso'),
27
+		];
28
+	}
29
+
30
+
31
+	/**
32
+	 * @param string $shortcode
33
+	 * @return string
34
+	 * @throws EE_Error
35
+	 * @throws ReflectionException
36
+	 */
37
+	protected function _parser($shortcode)
38
+	{
39
+		if ($shortcode == '[TICKET_LIST]') {
40
+			return $this->_get_ticket_list();
41
+		}
42
+		return '';
43
+	}
44
+
45
+
46
+	/**
47
+	 * figure out what the incoming data is and then return the appropriate parsed value.
48
+	 *
49
+	 * @return string
50
+	 * @throws EE_Error
51
+	 * @throws ReflectionException
52
+	 */
53
+	private function _get_ticket_list()
54
+	{
55
+		$this->_validate_list_requirements();
56
+
57
+		if ($this->_data['data'] instanceof EE_Messages_Addressee) {
58
+			return $this->_get_ticket_list_for_main();
59
+		}
60
+		if ($this->_data['data'] instanceof EE_Registration) {
61
+			return $this->_get_ticket_list_for_attendee();
62
+		}
63
+		if ($this->_data['data'] instanceof EE_Event) {
64
+			return $this->_get_ticket_list_for_event();
65
+		}
66
+		// prevent recursive loop
67
+		return '';
68
+	}
69
+
70
+
71
+	/**
72
+	 * This returns the parsed ticket list for main template;
73
+	 */
74
+	private function _get_ticket_list_for_main()
75
+	{
76
+		$valid_shortcodes = [
77
+			'ticket',
78
+			'event_list',
79
+			'attendee_list',
80
+			'datetime_list',
81
+			'attendee',
82
+			'line_item_list',
83
+			'primary_registration_details',
84
+			'recipient_details',
85
+		];
86
+		$template         = $this->_data['template'];
87
+		$data             = $this->_data['data'];
88
+		$ticket_list      = '';
89
+
90
+
91
+		// now we need to loop through the ticket list and send data to the EE_Parser helper.
92
+		foreach ($data->tickets as $ticket) {
93
+			$ticket_list .= $this->_shortcode_helper->parse_ticket_list_template(
94
+				$template,
95
+				$ticket['ticket'],
96
+				$valid_shortcodes,
97
+				$this->_extra_data
98
+			);
99
+		}
100
+
101
+		return $ticket_list;
102
+	}
103
+
104
+
105
+	/**
106
+	 * return parsed list of tickets for an event
107
+	 *
108
+	 * @return string
109
+	 * @throws EE_Error
110
+	 * @throws ReflectionException
111
+	 */
112
+	private function _get_ticket_list_for_event()
113
+	{
114
+		$valid_shortcodes = [
115
+			'ticket',
116
+			'attendee_list',
117
+			'datetime_list',
118
+			'attendee',
119
+			'venue',
120
+			'line_item_list',
121
+			'primary_registration_details',
122
+			'recipient_details',
123
+		];
124
+		$template         = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list'])
125
+			? $this->_data['template']['ticket_list']
126
+			: $this->_extra_data['template']['ticket_list'];
127
+		$event            = $this->_data['data'];
128
+
129
+		// let's remove any existing [EVENT_LIST] shortcodes from the ticket list template so that we don't get recursion.
130
+		$template = str_replace('[EVENT_LIST]', '', $template);
131
+
132
+		// here we're setting up the tickets for the ticket list template for THIS event.
133
+		$tkt_parsed = '';
134
+		$tickets    = $this->_get_tickets_from_event($event);
135
+
136
+		// each ticket in this case should be an ticket object.
137
+		foreach ($tickets as $ticket) {
138
+			$tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template(
139
+				$template,
140
+				$ticket,
141
+				$valid_shortcodes,
142
+				$this->_extra_data
143
+			);
144
+		}
145
+
146
+		return $tkt_parsed;
147
+	}
148
+
149
+
150
+	/**
151
+	 * return parsed list of tickets for an attendee
152
+	 *
153
+	 * @return string
154
+	 * @throws EE_Error
155
+	 * @throws ReflectionException
156
+	 */
157
+	private function _get_ticket_list_for_attendee()
158
+	{
159
+		$valid_shortcodes = [
160
+			'ticket',
161
+			'event_list',
162
+			'datetime_list',
163
+			'attendee',
164
+			'primary_registration_details',
165
+			'recipient_details',
166
+		];
167
+
168
+		$template     = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list'])
169
+			? $this->_data['template']['ticket_list']
170
+			: $this->_extra_data['template']['ticket_list'];
171
+		$registration = $this->_data['data'];
172
+
173
+		// let's remove any existing [ATTENDEE_LIST] shortcode from the ticket list template so that we don't get recursion.
174
+		$template = str_replace('[ATTENDEE_LIST]', '', $template);
175
+
176
+		// here we're setting up the tickets for the ticket list template for THIS attendee.
177
+		$tkt_parsed = '';
178
+		$tickets    = $this->_get_ticket_list_from_registration($registration);
179
+
180
+		// each ticket in this case should be an ticket object.
181
+		foreach ($tickets as $ticket) {
182
+			$tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template(
183
+				$template,
184
+				$ticket,
185
+				$valid_shortcodes,
186
+				$this->_extra_data
187
+			);
188
+		}
189
+
190
+		return $tkt_parsed;
191
+	}
192
+
193
+
194
+	/**
195
+	 * @param EE_Event $event
196
+	 * @return array|mixed
197
+	 * @throws EE_Error
198
+	 * @throws ReflectionException
199
+	 */
200
+	private function _get_tickets_from_event(EE_Event $event)
201
+	{
202
+		return isset($this->_extra_data['data']->events)
203
+			? $this->_extra_data['data']->events[ $event->ID() ]['tkt_objs']
204
+			: [];
205
+	}
206
+
207
+
208
+	/**
209
+	 * @param EE_Registration $registration
210
+	 * @return array
211
+	 * @throws EE_Error
212
+	 * @throws ReflectionException
213
+	 */
214
+	private function _get_ticket_list_from_registration(EE_Registration $registration)
215
+	{
216
+		return isset($this->_extra_data['data']->registrations)
217
+			? [$this->_extra_data['data']->registrations[ $registration->ID() ]['tkt_obj']]
218
+			: [];
219
+	}
220 220
 }
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Event_List_Shortcodes.lib.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@
 block discarded – undo
163 163
     private function _get_events_from_registration(EE_Registration $registration)
164 164
     {
165 165
         return isset($this->_extra_data['data']->registrations)
166
-            ? [$this->_extra_data['data']->registrations[ $registration->ID() ]['evt_obj']]
166
+            ? [$this->_extra_data['data']->registrations[$registration->ID()]['evt_obj']]
167 167
             : [];
168 168
     }
169 169
 }
Please login to merge, or discard this patch.
Indentation   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -18,155 +18,155 @@
 block discarded – undo
18 18
  */
19 19
 class EE_Event_List_Shortcodes extends EE_Shortcodes
20 20
 {
21
-    public function __construct()
22
-    {
23
-        parent::__construct();
24
-    }
25
-
26
-
27
-    protected function _init_props()
28
-    {
29
-        $this->label       = esc_html__('Event List Shortcodes', 'event_espresso');
30
-        $this->description = esc_html__('All shortcodes specific to event lists', 'event_espresso');
31
-        $this->_shortcodes = [
32
-            '[EVENT_LIST]' => esc_html__('Will output a list of events', 'event_espresso'),
33
-        ];
34
-    }
35
-
36
-
37
-    /**
38
-     * @param string $shortcode
39
-     * @return string
40
-     * @throws EE_Error
41
-     * @throws ReflectionException
42
-     */
43
-    protected function _parser($shortcode)
44
-    {
45
-        if ($shortcode == '[EVENT_LIST]') {
46
-            return $this->_get_event_list();
47
-        }
48
-        return '';
49
-    }
50
-
51
-
52
-    /**
53
-     * figure out what the incoming data is and then return the appropriate parsed value.
54
-     *
55
-     * @return string
56
-     * @throws EE_Error
57
-     * @throws ReflectionException
58
-     */
59
-    private function _get_event_list()
60
-    {
61
-        $this->_validate_list_requirements();
62
-
63
-        if ($this->_data['data'] instanceof EE_Messages_Addressee) {
64
-            return $this->_get_event_list_for_main();
65
-        }
66
-        if ($this->_data['data'] instanceof EE_Registration) {
67
-            return $this->_get_event_list_for_registration();
68
-        }
69
-        // prevent recursive loop
70
-        return '';
71
-    }
72
-
73
-
74
-    /**
75
-     * This returns the parsed event list for main template
76
-     *
77
-     * @return string
78
-     */
79
-    private function _get_event_list_for_main()
80
-    {
81
-
82
-        $valid_shortcodes = [
83
-            'event',
84
-            'attendee_list',
85
-            'ticket_list',
86
-            'datetime_list',
87
-            'venue',
88
-            'attendee',
89
-            'recipient_list',
90
-            'recipient_details',
91
-            'primary_registration_list',
92
-            'primary_registration_details',
93
-            'event_author',
94
-            'organization',
95
-        ];
96
-        $template         = $this->_data['template'];
97
-        $data             = $this->_data['data'];
98
-        $events           = '';
99
-
100
-        // now we need to loop through the events array in EE_Messages_Addressee and send data to the EE_Parser helper.
101
-        foreach ($data->events as $event) {
102
-            $events .= $this->_shortcode_helper->parse_event_list_template(
103
-                $template,
104
-                $event['event'],
105
-                $valid_shortcodes,
106
-                $this->_extra_data
107
-            );
108
-        }
109
-        return $events;
110
-    }
111
-
112
-
113
-    /**
114
-     * This returns the parsed event list for an attendee
115
-     *
116
-     * @return string
117
-     * @throws EE_Error
118
-     * @throws ReflectionException
119
-     */
120
-    private function _get_event_list_for_registration()
121
-    {
122
-        $valid_shortcodes = [
123
-            'event',
124
-            'ticket_list',
125
-            'datetime_list',
126
-            'attendee',
127
-            'event_author',
128
-            'recipient_details',
129
-            'recipient_list',
130
-            'venue',
131
-            'organization',
132
-        ];
133
-        $template         = is_array($this->_data['template']) && isset($this->_data['template']['event_list'])
134
-            ? $this->_data['template']['event_list']
135
-            : $this->_extra_data['template']['event_list'];
136
-        $registration     = $this->_data['data'];
137
-
138
-        // let's remove any existing [ATTENDEE_LIST] shortcode from the event list template so that we don't get recursion.
139
-        $template = str_replace('[ATTENDEE_LIST]', '', $template);
140
-
141
-        // here we're setting up the events for the event_list template for THIS registration.
142
-        $all_events = $this->_get_events_from_registration($registration);
143
-
144
-        // we're NOT going to prepare a list of attendees this time around
145
-        $events = '';
146
-
147
-        foreach ($all_events as $event) {
148
-            $events .= $this->_shortcode_helper->parse_event_list_template(
149
-                $template,
150
-                $event,
151
-                $valid_shortcodes,
152
-                $this->_extra_data
153
-            );
154
-        }
155
-
156
-        return $events;
157
-    }
158
-
159
-
160
-    /**
161
-     * @param EE_Registration $registration
162
-     * @return array
163
-     * @throws EE_Error
164
-     * @throws ReflectionException
165
-     */
166
-    private function _get_events_from_registration(EE_Registration $registration)
167
-    {
168
-        return isset($this->_extra_data['data']->registrations)
169
-            ? [$this->_extra_data['data']->registrations[ $registration->ID() ]['evt_obj']]
170
-            : [];
171
-    }
21
+	public function __construct()
22
+	{
23
+		parent::__construct();
24
+	}
25
+
26
+
27
+	protected function _init_props()
28
+	{
29
+		$this->label       = esc_html__('Event List Shortcodes', 'event_espresso');
30
+		$this->description = esc_html__('All shortcodes specific to event lists', 'event_espresso');
31
+		$this->_shortcodes = [
32
+			'[EVENT_LIST]' => esc_html__('Will output a list of events', 'event_espresso'),
33
+		];
34
+	}
35
+
36
+
37
+	/**
38
+	 * @param string $shortcode
39
+	 * @return string
40
+	 * @throws EE_Error
41
+	 * @throws ReflectionException
42
+	 */
43
+	protected function _parser($shortcode)
44
+	{
45
+		if ($shortcode == '[EVENT_LIST]') {
46
+			return $this->_get_event_list();
47
+		}
48
+		return '';
49
+	}
50
+
51
+
52
+	/**
53
+	 * figure out what the incoming data is and then return the appropriate parsed value.
54
+	 *
55
+	 * @return string
56
+	 * @throws EE_Error
57
+	 * @throws ReflectionException
58
+	 */
59
+	private function _get_event_list()
60
+	{
61
+		$this->_validate_list_requirements();
62
+
63
+		if ($this->_data['data'] instanceof EE_Messages_Addressee) {
64
+			return $this->_get_event_list_for_main();
65
+		}
66
+		if ($this->_data['data'] instanceof EE_Registration) {
67
+			return $this->_get_event_list_for_registration();
68
+		}
69
+		// prevent recursive loop
70
+		return '';
71
+	}
72
+
73
+
74
+	/**
75
+	 * This returns the parsed event list for main template
76
+	 *
77
+	 * @return string
78
+	 */
79
+	private function _get_event_list_for_main()
80
+	{
81
+
82
+		$valid_shortcodes = [
83
+			'event',
84
+			'attendee_list',
85
+			'ticket_list',
86
+			'datetime_list',
87
+			'venue',
88
+			'attendee',
89
+			'recipient_list',
90
+			'recipient_details',
91
+			'primary_registration_list',
92
+			'primary_registration_details',
93
+			'event_author',
94
+			'organization',
95
+		];
96
+		$template         = $this->_data['template'];
97
+		$data             = $this->_data['data'];
98
+		$events           = '';
99
+
100
+		// now we need to loop through the events array in EE_Messages_Addressee and send data to the EE_Parser helper.
101
+		foreach ($data->events as $event) {
102
+			$events .= $this->_shortcode_helper->parse_event_list_template(
103
+				$template,
104
+				$event['event'],
105
+				$valid_shortcodes,
106
+				$this->_extra_data
107
+			);
108
+		}
109
+		return $events;
110
+	}
111
+
112
+
113
+	/**
114
+	 * This returns the parsed event list for an attendee
115
+	 *
116
+	 * @return string
117
+	 * @throws EE_Error
118
+	 * @throws ReflectionException
119
+	 */
120
+	private function _get_event_list_for_registration()
121
+	{
122
+		$valid_shortcodes = [
123
+			'event',
124
+			'ticket_list',
125
+			'datetime_list',
126
+			'attendee',
127
+			'event_author',
128
+			'recipient_details',
129
+			'recipient_list',
130
+			'venue',
131
+			'organization',
132
+		];
133
+		$template         = is_array($this->_data['template']) && isset($this->_data['template']['event_list'])
134
+			? $this->_data['template']['event_list']
135
+			: $this->_extra_data['template']['event_list'];
136
+		$registration     = $this->_data['data'];
137
+
138
+		// let's remove any existing [ATTENDEE_LIST] shortcode from the event list template so that we don't get recursion.
139
+		$template = str_replace('[ATTENDEE_LIST]', '', $template);
140
+
141
+		// here we're setting up the events for the event_list template for THIS registration.
142
+		$all_events = $this->_get_events_from_registration($registration);
143
+
144
+		// we're NOT going to prepare a list of attendees this time around
145
+		$events = '';
146
+
147
+		foreach ($all_events as $event) {
148
+			$events .= $this->_shortcode_helper->parse_event_list_template(
149
+				$template,
150
+				$event,
151
+				$valid_shortcodes,
152
+				$this->_extra_data
153
+			);
154
+		}
155
+
156
+		return $events;
157
+	}
158
+
159
+
160
+	/**
161
+	 * @param EE_Registration $registration
162
+	 * @return array
163
+	 * @throws EE_Error
164
+	 * @throws ReflectionException
165
+	 */
166
+	private function _get_events_from_registration(EE_Registration $registration)
167
+	{
168
+		return isset($this->_extra_data['data']->registrations)
169
+			? [$this->_extra_data['data']->registrations[ $registration->ID() ]['evt_obj']]
170
+			: [];
171
+	}
172 172
 }
Please login to merge, or discard this patch.
templates/admin_general_metabox_contents_espresso_sponsors.template.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@  discard block
 block discarded – undo
1 1
 <div class="padding">
2 2
     <p>
3 3
         <?php
4
-        printf(
5
-            esc_html__(
6
-                'Upgrade to an %1$sEvent Espresso 4 support license%2$s to get access to dedicated support staff and premium features, such as a calendar, printable tickets and check-in capabilities, MailChimp integration, and more!',
7
-                'event_espresso'
8
-            ),
9
-            '<a
4
+		printf(
5
+			esc_html__(
6
+				'Upgrade to an %1$sEvent Espresso 4 support license%2$s to get access to dedicated support staff and premium features, such as a calendar, printable tickets and check-in capabilities, MailChimp integration, and more!',
7
+				'event_espresso'
8
+			),
9
+			'<a
10 10
             href="https://eventespresso.com/pricing/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=event_espresso_highlights_widget&utm_content=link"
11 11
             target="_blank">',
12
-            '</a>'
13
-        );
14
-        ?>
12
+			'</a>'
13
+		);
14
+		?>
15 15
     </p>
16 16
     <p>
17 17
         <a href='https://eventespresso.com/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=event_espresso_highlights_widget&utm_content=banner'
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
     </p>
24 24
     <p>
25 25
         <?php
26
-        printf(
27
-            esc_html__(
28
-                'Visit %1$sEvent Espresso%2$s for more details.',
29
-                'event_espresso'
30
-            ),
31
-            '<a
26
+		printf(
27
+			esc_html__(
28
+				'Visit %1$sEvent Espresso%2$s for more details.',
29
+				'event_espresso'
30
+			),
31
+			'<a
32 32
             href="https://eventespresso.com/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=event_espresso_highlights_widget&utm_content=link"
33 33
             target="_blank">',
34
-            '</a>'
35
-        );
36
-        ?>
34
+			'</a>'
35
+		);
36
+		?>
37 37
         </p>
38 38
 </div>
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
         <a href='https://eventespresso.com/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=event_espresso_highlights_widget&utm_content=banner'
18 18
            target='_blank'>
19 19
             <img alt="<?php esc_html_e('manage events faster', 'event_espresso'); ?>"
20
-                 src="<?php echo esc_url_raw(EE_GLOBAL_ASSETS_URL . 'images/manage-events-faster-240x240.jpg'); ?>"
20
+                 src="<?php echo esc_url_raw(EE_GLOBAL_ASSETS_URL.'images/manage-events-faster-240x240.jpg'); ?>"
21 21
             />
22 22
         </a>
23 23
     </p>
Please login to merge, or discard this patch.
domain/services/graphql/connection_resolvers/PriceConnectionResolver.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -80,24 +80,24 @@  discard block
 block discarded – undo
80 80
          * Collect the input_fields and sanitize them to prepare them for sending to the Query
81 81
          */
82 82
         $input_fields = [];
83
-        if (! empty($this->args['where'])) {
83
+        if ( ! empty($this->args['where'])) {
84 84
             $input_fields = $this->sanitizeInputFields($this->args['where']);
85 85
 
86 86
             // Use the proper operator.
87
-            if (! empty($input_fields['PRC_ID']) && is_array($input_fields['PRC_ID'])) {
87
+            if ( ! empty($input_fields['PRC_ID']) && is_array($input_fields['PRC_ID'])) {
88 88
                 $input_fields['PRC_ID'] = ['in', $input_fields['PRC_ID']];
89 89
             }
90
-            if (! empty($input_fields['Ticket.TKT_ID']) && is_array($input_fields['Ticket.TKT_ID'])) {
90
+            if ( ! empty($input_fields['Ticket.TKT_ID']) && is_array($input_fields['Ticket.TKT_ID'])) {
91 91
                 $input_fields['Ticket.TKT_ID'] = ['in', $input_fields['Ticket.TKT_ID']];
92 92
             }
93
-            if (! empty($input_fields['Price_Type.PBT_ID']) && is_array($input_fields['Price_Type.PBT_ID'])) {
93
+            if ( ! empty($input_fields['Price_Type.PBT_ID']) && is_array($input_fields['Price_Type.PBT_ID'])) {
94 94
                 $input_fields['Price_Type.PBT_ID'] = ['in', $input_fields['Price_Type.PBT_ID']];
95 95
             }
96
-            if (! empty($input_fields['Price_Type.PRT_ID']) && is_array($input_fields['Price_Type.PRT_ID'])) {
96
+            if ( ! empty($input_fields['Price_Type.PRT_ID']) && is_array($input_fields['Price_Type.PRT_ID'])) {
97 97
                 $input_fields['Price_Type.PRT_ID'] = ['in', $input_fields['Price_Type.PRT_ID']];
98 98
             }
99 99
             // if event ID is passed but not a ticket ID
100
-            if (! isset($input_fields['Ticket.TKT_ID']) && isset($input_fields['Event.EVT_ID'])) {
100
+            if ( ! isset($input_fields['Ticket.TKT_ID']) && isset($input_fields['Event.EVT_ID'])) {
101 101
                 $event_id = $input_fields['Event.EVT_ID'];
102 102
                 // Ensure that this doesn't go to the query.
103 103
                 // After all there is no DB relation between event and price
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         /**
133 133
          * Merge the input_fields with the default query_args
134 134
          */
135
-        if (! empty($input_fields)) {
135
+        if ( ! empty($input_fields)) {
136 136
             $where_params = array_merge($where_params, $input_fields);
137 137
         }
138 138
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         $default_prices_params = [];
142 142
 
143 143
         // If default ticket prices should be included.
144
-        if (! empty($this->args['where']['includeDefaultTicketsPrices'])) {
144
+        if ( ! empty($this->args['where']['includeDefaultTicketsPrices'])) {
145 145
             $default_ticket_ids = EEM_Ticket::instance()->get_col([
146 146
                 [
147 147
                     'TKT_is_default' => 1,
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             ]);
151 151
 
152 152
             // if we have default tickets
153
-            if (! empty($default_ticket_ids)) {
153
+            if ( ! empty($default_ticket_ids)) {
154 154
                 $default_prices_params['OR'] = [
155 155
                     'Ticket.TKT_ID' => ['IN', $default_ticket_ids],
156 156
                 ];
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
         }
159 159
 
160 160
         // If default prices should be included.
161
-        if (! empty($this->args['where']['includeDefaultPrices'])) {
161
+        if ( ! empty($this->args['where']['includeDefaultPrices'])) {
162 162
             $default_prices_params['AND'] = [
163 163
                 'PRC_deleted'    => 0,
164 164
                 'PRC_is_default' => 1,
165 165
             ];
166 166
         }
167 167
 
168
-        if (! empty($default_prices_params)) {
168
+        if ( ! empty($default_prices_params)) {
169 169
             if (empty($where_params)) {
170 170
                 $where_params['OR'] = $default_prices_params;
171 171
             } else {
Please login to merge, or discard this patch.
Indentation   +215 added lines, -215 removed lines patch added patch discarded remove patch
@@ -17,219 +17,219 @@
 block discarded – undo
17 17
  */
18 18
 class PriceConnectionResolver extends AbstractConnectionResolver
19 19
 {
20
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
21
-    public function get_loader_name(): string
22
-    {
23
-        return 'espresso_price';
24
-    }
25
-
26
-    /**
27
-     * @return EEM_Price
28
-     * @throws EE_Error
29
-     * @throws InvalidArgumentException
30
-     * @throws InvalidDataTypeException
31
-     * @throws InvalidInterfaceException
32
-     * @throws ReflectionException
33
-     */
34
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
35
-    public function get_query(): EEM_Price
36
-    {
37
-        return EEM_Price::instance();
38
-    }
39
-
40
-
41
-    /**
42
-     * Return an array of item IDs from the query
43
-     *
44
-     * @return array
45
-     */
46
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
47
-    public function get_ids(): array
48
-    {
49
-        $results = $this->query->get_col($this->query_args);
50
-
51
-        return ! empty($results) ? $results : [];
52
-    }
53
-
54
-
55
-    /**
56
-     * Here, we map the args from the input, then we make sure that we're only querying
57
-     * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers
58
-     * handle batch resolution of the posts.
59
-     *
60
-     * @return array
61
-     * @throws EE_Error
62
-     * @throws InvalidArgumentException
63
-     * @throws ReflectionException
64
-     * @throws InvalidDataTypeException
65
-     * @throws InvalidInterfaceException
66
-     */
67
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
68
-    public function get_query_args(): array
69
-    {
70
-        $where_params = [];
71
-        $query_args   = [];
72
-
73
-        $query_args['limit'] = $this->getLimit();
74
-
75
-        // Avoid multiple entries by join.
76
-        $query_args['group_by'] = 'PRC_ID';
77
-
78
-        $query_args['default_where_conditions'] = 'minimum';
79
-
80
-        /**
81
-         * Collect the input_fields and sanitize them to prepare them for sending to the Query
82
-         */
83
-        $input_fields = [];
84
-        if (! empty($this->args['where'])) {
85
-            $input_fields = $this->sanitizeInputFields($this->args['where']);
86
-
87
-            // Use the proper operator.
88
-            if (! empty($input_fields['PRC_ID']) && is_array($input_fields['PRC_ID'])) {
89
-                $input_fields['PRC_ID'] = ['in', $input_fields['PRC_ID']];
90
-            }
91
-            if (! empty($input_fields['Ticket.TKT_ID']) && is_array($input_fields['Ticket.TKT_ID'])) {
92
-                $input_fields['Ticket.TKT_ID'] = ['in', $input_fields['Ticket.TKT_ID']];
93
-            }
94
-            if (! empty($input_fields['Price_Type.PBT_ID']) && is_array($input_fields['Price_Type.PBT_ID'])) {
95
-                $input_fields['Price_Type.PBT_ID'] = ['in', $input_fields['Price_Type.PBT_ID']];
96
-            }
97
-            if (! empty($input_fields['Price_Type.PRT_ID']) && is_array($input_fields['Price_Type.PRT_ID'])) {
98
-                $input_fields['Price_Type.PRT_ID'] = ['in', $input_fields['Price_Type.PRT_ID']];
99
-            }
100
-            // if event ID is passed but not a ticket ID
101
-            if (! isset($input_fields['Ticket.TKT_ID']) && isset($input_fields['Event.EVT_ID'])) {
102
-                $event_id = $input_fields['Event.EVT_ID'];
103
-                // Ensure that this doesn't go to the query.
104
-                // After all there is no DB relation between event and price
105
-                unset($input_fields['Event.EVT_ID']);
106
-                // get all the datetimeIds of the event
107
-                $event_datetime_ids = EEM_Datetime::instance()->get_col([
108
-                    [
109
-                        'EVT_ID'      => $event_id,
110
-                    ],
111
-                    'default_where_conditions' => 'minimum'
112
-                ]);
113
-                // get all the related ticket Ids
114
-                $ticket_ids = EEM_Ticket::instance()->get_col([
115
-                    [
116
-                        'Datetime.DTT_ID' => ['IN', $event_datetime_ids],
117
-                    ],
118
-                    'default_where_conditions' => 'minimum'
119
-                ]);
120
-
121
-                // add tickets relation to the query
122
-                $input_fields['Ticket.TKT_ID'] = ['IN', $ticket_ids];
123
-            }
124
-        }
125
-
126
-        /**
127
-         * Determine where we're at in the Graph and adjust the query context appropriately.
128
-         */
129
-        if ($this->source instanceof EE_Ticket) {
130
-            $where_params['Ticket.TKT_ID'] = $this->source->ID();
131
-        }
132
-
133
-        /**
134
-         * Merge the input_fields with the default query_args
135
-         */
136
-        if (! empty($input_fields)) {
137
-            $where_params = array_merge($where_params, $input_fields);
138
-        }
139
-
140
-        [$query_args, $where_params] = $this->mapOrderbyInputArgs($query_args, $where_params, 'PRC_ID');
141
-
142
-        $default_prices_params = [];
143
-
144
-        // If default ticket prices should be included.
145
-        if (! empty($this->args['where']['includeDefaultTicketsPrices'])) {
146
-            $default_ticket_ids = EEM_Ticket::instance()->get_col([
147
-                [
148
-                    'TKT_is_default' => 1,
149
-                ],
150
-                'default_where_conditions' => 'minimum'
151
-            ]);
152
-
153
-            // if we have default tickets
154
-            if (! empty($default_ticket_ids)) {
155
-                $default_prices_params['OR'] = [
156
-                    'Ticket.TKT_ID' => ['IN', $default_ticket_ids],
157
-                ];
158
-            }
159
-        }
160
-
161
-        // If default prices should be included.
162
-        if (! empty($this->args['where']['includeDefaultPrices'])) {
163
-            $default_prices_params['AND'] = [
164
-                'PRC_deleted'    => 0,
165
-                'PRC_is_default' => 1,
166
-            ];
167
-        }
168
-
169
-        if (! empty($default_prices_params)) {
170
-            if (empty($where_params)) {
171
-                $where_params['OR'] = $default_prices_params;
172
-            } else {
173
-                $where_params = [
174
-                    'OR' => [
175
-                        'OR'  => $default_prices_params,
176
-                        'AND' => $where_params,
177
-                    ],
178
-                ];
179
-            }
180
-        }
181
-
182
-        $where_params = apply_filters(
183
-            'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__price_where_params',
184
-            $where_params,
185
-            $this->source,
186
-            $this->args
187
-        );
188
-
189
-        $query_args[] = $where_params;
190
-
191
-        /**
192
-         * Return the $query_args
193
-         */
194
-        return apply_filters(
195
-            'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__price_query_args',
196
-            $query_args,
197
-            $this->source,
198
-            $this->args
199
-        );
200
-    }
201
-
202
-
203
-    /**
204
-     * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model
205
-     * friendly keys.
206
-     *
207
-     * @param array $where_args
208
-     * @return array
209
-     */
210
-    public function sanitizeInputFields(array $where_args): array
211
-    {
212
-        $arg_mapping = [
213
-            'in'              => 'PRC_ID',
214
-            'idIn'            => 'PRC_ID',
215
-            'isDefault'       => 'PRC_is_default',
216
-            'event'           => 'Event.EVT_ID',
217
-            'eventId'         => 'Event.EVT_ID', // priority.
218
-            'ticket'          => 'Ticket.TKT_ID',
219
-            'ticketIn'        => 'Ticket.TKT_ID',
220
-            'ticketIdIn'      => 'Ticket.TKT_ID',
221
-            'ticketId'        => 'Ticket.TKT_ID', // priority.
222
-            'priceType'       => 'Price_Type.PRT_ID',
223
-            'priceTypeIn'     => 'Price_Type.PRT_ID',
224
-            'priceTypeIdIn'   => 'Price_Type.PRT_ID',
225
-            'priceTypeId'     => 'Price_Type.PRT_ID', // priority.
226
-            'priceBaseType'   => 'Price_Type.PBT_ID',
227
-            'priceBaseTypeIn' => 'Price_Type.PBT_ID',
228
-        ];
229
-        return $this->sanitizeWhereArgsForInputFields(
230
-            $where_args,
231
-            $arg_mapping,
232
-            ['in', 'event', 'ticket', 'ticketIn', 'priceType', 'priceTypeIn']
233
-        );
234
-    }
20
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
21
+	public function get_loader_name(): string
22
+	{
23
+		return 'espresso_price';
24
+	}
25
+
26
+	/**
27
+	 * @return EEM_Price
28
+	 * @throws EE_Error
29
+	 * @throws InvalidArgumentException
30
+	 * @throws InvalidDataTypeException
31
+	 * @throws InvalidInterfaceException
32
+	 * @throws ReflectionException
33
+	 */
34
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
35
+	public function get_query(): EEM_Price
36
+	{
37
+		return EEM_Price::instance();
38
+	}
39
+
40
+
41
+	/**
42
+	 * Return an array of item IDs from the query
43
+	 *
44
+	 * @return array
45
+	 */
46
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
47
+	public function get_ids(): array
48
+	{
49
+		$results = $this->query->get_col($this->query_args);
50
+
51
+		return ! empty($results) ? $results : [];
52
+	}
53
+
54
+
55
+	/**
56
+	 * Here, we map the args from the input, then we make sure that we're only querying
57
+	 * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers
58
+	 * handle batch resolution of the posts.
59
+	 *
60
+	 * @return array
61
+	 * @throws EE_Error
62
+	 * @throws InvalidArgumentException
63
+	 * @throws ReflectionException
64
+	 * @throws InvalidDataTypeException
65
+	 * @throws InvalidInterfaceException
66
+	 */
67
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
68
+	public function get_query_args(): array
69
+	{
70
+		$where_params = [];
71
+		$query_args   = [];
72
+
73
+		$query_args['limit'] = $this->getLimit();
74
+
75
+		// Avoid multiple entries by join.
76
+		$query_args['group_by'] = 'PRC_ID';
77
+
78
+		$query_args['default_where_conditions'] = 'minimum';
79
+
80
+		/**
81
+		 * Collect the input_fields and sanitize them to prepare them for sending to the Query
82
+		 */
83
+		$input_fields = [];
84
+		if (! empty($this->args['where'])) {
85
+			$input_fields = $this->sanitizeInputFields($this->args['where']);
86
+
87
+			// Use the proper operator.
88
+			if (! empty($input_fields['PRC_ID']) && is_array($input_fields['PRC_ID'])) {
89
+				$input_fields['PRC_ID'] = ['in', $input_fields['PRC_ID']];
90
+			}
91
+			if (! empty($input_fields['Ticket.TKT_ID']) && is_array($input_fields['Ticket.TKT_ID'])) {
92
+				$input_fields['Ticket.TKT_ID'] = ['in', $input_fields['Ticket.TKT_ID']];
93
+			}
94
+			if (! empty($input_fields['Price_Type.PBT_ID']) && is_array($input_fields['Price_Type.PBT_ID'])) {
95
+				$input_fields['Price_Type.PBT_ID'] = ['in', $input_fields['Price_Type.PBT_ID']];
96
+			}
97
+			if (! empty($input_fields['Price_Type.PRT_ID']) && is_array($input_fields['Price_Type.PRT_ID'])) {
98
+				$input_fields['Price_Type.PRT_ID'] = ['in', $input_fields['Price_Type.PRT_ID']];
99
+			}
100
+			// if event ID is passed but not a ticket ID
101
+			if (! isset($input_fields['Ticket.TKT_ID']) && isset($input_fields['Event.EVT_ID'])) {
102
+				$event_id = $input_fields['Event.EVT_ID'];
103
+				// Ensure that this doesn't go to the query.
104
+				// After all there is no DB relation between event and price
105
+				unset($input_fields['Event.EVT_ID']);
106
+				// get all the datetimeIds of the event
107
+				$event_datetime_ids = EEM_Datetime::instance()->get_col([
108
+					[
109
+						'EVT_ID'      => $event_id,
110
+					],
111
+					'default_where_conditions' => 'minimum'
112
+				]);
113
+				// get all the related ticket Ids
114
+				$ticket_ids = EEM_Ticket::instance()->get_col([
115
+					[
116
+						'Datetime.DTT_ID' => ['IN', $event_datetime_ids],
117
+					],
118
+					'default_where_conditions' => 'minimum'
119
+				]);
120
+
121
+				// add tickets relation to the query
122
+				$input_fields['Ticket.TKT_ID'] = ['IN', $ticket_ids];
123
+			}
124
+		}
125
+
126
+		/**
127
+		 * Determine where we're at in the Graph and adjust the query context appropriately.
128
+		 */
129
+		if ($this->source instanceof EE_Ticket) {
130
+			$where_params['Ticket.TKT_ID'] = $this->source->ID();
131
+		}
132
+
133
+		/**
134
+		 * Merge the input_fields with the default query_args
135
+		 */
136
+		if (! empty($input_fields)) {
137
+			$where_params = array_merge($where_params, $input_fields);
138
+		}
139
+
140
+		[$query_args, $where_params] = $this->mapOrderbyInputArgs($query_args, $where_params, 'PRC_ID');
141
+
142
+		$default_prices_params = [];
143
+
144
+		// If default ticket prices should be included.
145
+		if (! empty($this->args['where']['includeDefaultTicketsPrices'])) {
146
+			$default_ticket_ids = EEM_Ticket::instance()->get_col([
147
+				[
148
+					'TKT_is_default' => 1,
149
+				],
150
+				'default_where_conditions' => 'minimum'
151
+			]);
152
+
153
+			// if we have default tickets
154
+			if (! empty($default_ticket_ids)) {
155
+				$default_prices_params['OR'] = [
156
+					'Ticket.TKT_ID' => ['IN', $default_ticket_ids],
157
+				];
158
+			}
159
+		}
160
+
161
+		// If default prices should be included.
162
+		if (! empty($this->args['where']['includeDefaultPrices'])) {
163
+			$default_prices_params['AND'] = [
164
+				'PRC_deleted'    => 0,
165
+				'PRC_is_default' => 1,
166
+			];
167
+		}
168
+
169
+		if (! empty($default_prices_params)) {
170
+			if (empty($where_params)) {
171
+				$where_params['OR'] = $default_prices_params;
172
+			} else {
173
+				$where_params = [
174
+					'OR' => [
175
+						'OR'  => $default_prices_params,
176
+						'AND' => $where_params,
177
+					],
178
+				];
179
+			}
180
+		}
181
+
182
+		$where_params = apply_filters(
183
+			'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__price_where_params',
184
+			$where_params,
185
+			$this->source,
186
+			$this->args
187
+		);
188
+
189
+		$query_args[] = $where_params;
190
+
191
+		/**
192
+		 * Return the $query_args
193
+		 */
194
+		return apply_filters(
195
+			'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__price_query_args',
196
+			$query_args,
197
+			$this->source,
198
+			$this->args
199
+		);
200
+	}
201
+
202
+
203
+	/**
204
+	 * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model
205
+	 * friendly keys.
206
+	 *
207
+	 * @param array $where_args
208
+	 * @return array
209
+	 */
210
+	public function sanitizeInputFields(array $where_args): array
211
+	{
212
+		$arg_mapping = [
213
+			'in'              => 'PRC_ID',
214
+			'idIn'            => 'PRC_ID',
215
+			'isDefault'       => 'PRC_is_default',
216
+			'event'           => 'Event.EVT_ID',
217
+			'eventId'         => 'Event.EVT_ID', // priority.
218
+			'ticket'          => 'Ticket.TKT_ID',
219
+			'ticketIn'        => 'Ticket.TKT_ID',
220
+			'ticketIdIn'      => 'Ticket.TKT_ID',
221
+			'ticketId'        => 'Ticket.TKT_ID', // priority.
222
+			'priceType'       => 'Price_Type.PRT_ID',
223
+			'priceTypeIn'     => 'Price_Type.PRT_ID',
224
+			'priceTypeIdIn'   => 'Price_Type.PRT_ID',
225
+			'priceTypeId'     => 'Price_Type.PRT_ID', // priority.
226
+			'priceBaseType'   => 'Price_Type.PBT_ID',
227
+			'priceBaseTypeIn' => 'Price_Type.PBT_ID',
228
+		];
229
+		return $this->sanitizeWhereArgsForInputFields(
230
+			$where_args,
231
+			$arg_mapping,
232
+			['in', 'event', 'ticket', 'ticketIn', 'priceType', 'priceTypeIn']
233
+		);
234
+	}
235 235
 }
Please login to merge, or discard this patch.