Completed
Branch BUG/send-test-email-not-requir... (ff675f)
by
unknown
02:14 queued 29s
created
core/libraries/rest_api/calculations/CalculatedModelFieldsFactory.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function createFromModel($model_name)
42 42
     {
43
-        return $this->createFromClassname('EventEspresso\core\libraries\rest_api\calculations\\' . $model_name);
43
+        return $this->createFromClassname('EventEspresso\core\libraries\rest_api\calculations\\'.$model_name);
44 44
     }
45 45
 
46 46
     /**
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     public function createFromClassname($calculator_classname)
52 52
     {
53 53
         $calculator = $this->loader->getShared($calculator_classname);
54
-        if (!$calculator instanceof Base) {
54
+        if ( ! $calculator instanceof Base) {
55 55
             throw new UnexpectedEntityException(
56 56
                 $calculator_classname,
57 57
                 'EventEspresso\core\libraries\rest_api\calculations\Base'
Please login to merge, or discard this patch.
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -18,46 +18,46 @@
 block discarded – undo
18 18
  */
19 19
 class CalculatedModelFieldsFactory
20 20
 {
21
-    private $loader;
21
+	private $loader;
22 22
 
23
-    /**
24
-     * CalculatedModelFieldsFactory constructor.
25
-     * @param LoaderInterface $loader
26
-     */
27
-    public function __construct(LoaderInterface $loader)
28
-    {
29
-        $this->loader = $loader;
30
-    }
23
+	/**
24
+	 * CalculatedModelFieldsFactory constructor.
25
+	 * @param LoaderInterface $loader
26
+	 */
27
+	public function __construct(LoaderInterface $loader)
28
+	{
29
+		$this->loader = $loader;
30
+	}
31 31
 
32
-    /**
33
-     * Creates the calculator class that corresponds to that particular model
34
-     * @since 4.9.68.p
35
-     * @param string $model_name
36
-     * @return Base
37
-     * @throws UnexpectedEntityException
38
-     */
39
-    public function createFromModel($model_name)
40
-    {
41
-        return $this->createFromClassname('EventEspresso\core\libraries\rest_api\calculations\\' . $model_name);
42
-    }
32
+	/**
33
+	 * Creates the calculator class that corresponds to that particular model
34
+	 * @since 4.9.68.p
35
+	 * @param string $model_name
36
+	 * @return Base
37
+	 * @throws UnexpectedEntityException
38
+	 */
39
+	public function createFromModel($model_name)
40
+	{
41
+		return $this->createFromClassname('EventEspresso\core\libraries\rest_api\calculations\\' . $model_name);
42
+	}
43 43
 
44
-    /**
45
-     * Creates the calculator class that corresponds to that classname and verifies it's of the correct type
46
-     * @param string $calculator_classname
47
-     * @return Base
48
-     * @throws UnexpectedEntityException
49
-     */
50
-    public function createFromClassname($calculator_classname)
51
-    {
52
-        $calculator = $this->loader->getShared($calculator_classname);
53
-        if (!$calculator instanceof Base) {
54
-            throw new UnexpectedEntityException(
55
-                $calculator_classname,
56
-                'EventEspresso\core\libraries\rest_api\calculations\Base'
57
-            );
58
-        }
59
-        return $calculator;
60
-    }
44
+	/**
45
+	 * Creates the calculator class that corresponds to that classname and verifies it's of the correct type
46
+	 * @param string $calculator_classname
47
+	 * @return Base
48
+	 * @throws UnexpectedEntityException
49
+	 */
50
+	public function createFromClassname($calculator_classname)
51
+	{
52
+		$calculator = $this->loader->getShared($calculator_classname);
53
+		if (!$calculator instanceof Base) {
54
+			throw new UnexpectedEntityException(
55
+				$calculator_classname,
56
+				'EventEspresso\core\libraries\rest_api\calculations\Base'
57
+			);
58
+		}
59
+		return $calculator;
60
+	}
61 61
 }
62 62
 // End of file CalculationsFactory.php
63 63
 // Location: EventEspresso\core\libraries\rest_api\calculations/CalculationsFactory.php
Please login to merge, or discard this patch.
core/libraries/rest_api/calculations/Base.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      */
24 24
     protected function verifyCurrentUserCan($required_permission, $attempted_calculation)
25 25
     {
26
-        if (! current_user_can($required_permission)) {
26
+        if ( ! current_user_can($required_permission)) {
27 27
             throw new RestException(
28 28
                 'permission_denied',
29 29
                 sprintf(
@@ -75,6 +75,6 @@  discard block
 block discarded – undo
75 75
     public function schemaForCalculation($calculation_index)
76 76
     {
77 77
         $schema_map = $this->schemaForCalculations();
78
-        return isset($schema_map[ $calculation_index ]) ? $schema_map[ $calculation_index ] : array();
78
+        return isset($schema_map[$calculation_index]) ? $schema_map[$calculation_index] : array();
79 79
     }
80 80
 }
Please login to merge, or discard this patch.
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -16,65 +16,65 @@
 block discarded – undo
16 16
 class Base
17 17
 {
18 18
 
19
-    /**
20
-     * @param $required_permission
21
-     * @param $attempted_calculation
22
-     * @throws RestException
23
-     */
24
-    protected function verifyCurrentUserCan($required_permission, $attempted_calculation)
25
-    {
26
-        if (! current_user_can($required_permission)) {
27
-            throw new RestException(
28
-                'permission_denied',
29
-                sprintf(
30
-                    esc_html__(
31
-                    // @codingStandardsIgnoreStart
32
-                        'Permission denied, you cannot calculate %1$s on %2$s because you do not have the capability "%3$s"',
33
-                        // @codingStandardsIgnoreEnd
34
-                        'event_espresso'
35
-                    ),
36
-                    $attempted_calculation,
37
-                    EEH_Inflector::pluralize_and_lower($this->getResourceName()),
38
-                    $required_permission
39
-                )
40
-            );
41
-        }
42
-    }
19
+	/**
20
+	 * @param $required_permission
21
+	 * @param $attempted_calculation
22
+	 * @throws RestException
23
+	 */
24
+	protected function verifyCurrentUserCan($required_permission, $attempted_calculation)
25
+	{
26
+		if (! current_user_can($required_permission)) {
27
+			throw new RestException(
28
+				'permission_denied',
29
+				sprintf(
30
+					esc_html__(
31
+					// @codingStandardsIgnoreStart
32
+						'Permission denied, you cannot calculate %1$s on %2$s because you do not have the capability "%3$s"',
33
+						// @codingStandardsIgnoreEnd
34
+						'event_espresso'
35
+					),
36
+					$attempted_calculation,
37
+					EEH_Inflector::pluralize_and_lower($this->getResourceName()),
38
+					$required_permission
39
+				)
40
+			);
41
+		}
42
+	}
43 43
 
44 44
 
45
-    /**
46
-     * Gets the name of the resource of the called class
47
-     *
48
-     * @return string
49
-     */
50
-    public function getResourceName()
51
-    {
52
-        return substr(__CLASS__, strrpos(__CLASS__, '\\') + 1);
53
-    }
45
+	/**
46
+	 * Gets the name of the resource of the called class
47
+	 *
48
+	 * @return string
49
+	 */
50
+	public function getResourceName()
51
+	{
52
+		return substr(__CLASS__, strrpos(__CLASS__, '\\') + 1);
53
+	}
54 54
 
55
-    /**
56
-     * Returns an array to be used for the schema for the calculated fields.
57
-     * @since 4.9.68.p
58
-     * @return array keys are calculated field names (eg "optimum_sales_at_start") values are arrays {
59
-     * @type string $description
60
-     * @type string $type, eg "string", "int", "boolean", "object", "array", etc
61
-     * }
62
-     */
63
-    public function schemaForCalculations()
64
-    {
65
-        return array();
66
-    }
55
+	/**
56
+	 * Returns an array to be used for the schema for the calculated fields.
57
+	 * @since 4.9.68.p
58
+	 * @return array keys are calculated field names (eg "optimum_sales_at_start") values are arrays {
59
+	 * @type string $description
60
+	 * @type string $type, eg "string", "int", "boolean", "object", "array", etc
61
+	 * }
62
+	 */
63
+	public function schemaForCalculations()
64
+	{
65
+		return array();
66
+	}
67 67
 
68
-    /**
69
-     * Returns the json schema for the given calculation index.
70
-     *
71
-     * @since 4.9.68.p
72
-     * @param $calculation_index
73
-     * @return array
74
-     */
75
-    public function schemaForCalculation($calculation_index)
76
-    {
77
-        $schema_map = $this->schemaForCalculations();
78
-        return isset($schema_map[ $calculation_index ]) ? $schema_map[ $calculation_index ] : array();
79
-    }
68
+	/**
69
+	 * Returns the json schema for the given calculation index.
70
+	 *
71
+	 * @since 4.9.68.p
72
+	 * @param $calculation_index
73
+	 * @return array
74
+	 */
75
+	public function schemaForCalculation($calculation_index)
76
+	{
77
+		$schema_map = $this->schemaForCalculations();
78
+		return isset($schema_map[ $calculation_index ]) ? $schema_map[ $calculation_index ] : array();
79
+	}
80 80
 }
Please login to merge, or discard this patch.
core/domain/entities/shortcodes/EspressoTicketSelector.php 2 patches
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -24,92 +24,92 @@
 block discarded – undo
24 24
 {
25 25
 
26 26
 
27
-    /**
28
-     * the actual shortcode tag that gets registered with WordPress
29
-     *
30
-     * @return string
31
-     */
32
-    public function getTag()
33
-    {
34
-        return 'ESPRESSO_TICKET_SELECTOR';
35
-    }
27
+	/**
28
+	 * the actual shortcode tag that gets registered with WordPress
29
+	 *
30
+	 * @return string
31
+	 */
32
+	public function getTag()
33
+	{
34
+		return 'ESPRESSO_TICKET_SELECTOR';
35
+	}
36 36
 
37 37
 
38
-    /**
39
-     * the time in seconds to cache the results of the processShortcode() method
40
-     * 0 means the processShortcode() results will NOT be cached at all
41
-     *
42
-     * @return int
43
-     */
44
-    public function cacheExpiration()
45
-    {
46
-        return 0;
47
-    }
38
+	/**
39
+	 * the time in seconds to cache the results of the processShortcode() method
40
+	 * 0 means the processShortcode() results will NOT be cached at all
41
+	 *
42
+	 * @return int
43
+	 */
44
+	public function cacheExpiration()
45
+	{
46
+		return 0;
47
+	}
48 48
 
49 49
 
50
-    /**
51
-     * a place for adding any initialization code that needs to run prior to wp_header().
52
-     * this may be required for shortcodes that utilize a corresponding module,
53
-     * and need to enqueue assets for that module
54
-     *
55
-     * @return void
56
-     */
57
-    public function initializeShortcode()
58
-    {
59
-        add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
60
-        $this->shortcodeHasBeenInitialized();
61
-    }
50
+	/**
51
+	 * a place for adding any initialization code that needs to run prior to wp_header().
52
+	 * this may be required for shortcodes that utilize a corresponding module,
53
+	 * and need to enqueue assets for that module
54
+	 *
55
+	 * @return void
56
+	 */
57
+	public function initializeShortcode()
58
+	{
59
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
60
+		$this->shortcodeHasBeenInitialized();
61
+	}
62 62
 
63 63
 
64
-    /**
65
-     * callback that runs when the shortcode is encountered in post content.
66
-     * IMPORTANT !!!
67
-     * remember that shortcode content should be RETURNED and NOT echoed out
68
-     *
69
-     * @param array $attributes
70
-     * @return string
71
-     * @throws InvalidArgumentException
72
-     * @throws EE_Error
73
-     * @throws InvalidDataTypeException
74
-     * @throws InvalidInterfaceException
75
-     * @throws ReflectionException
76
-     * @throws Exception
77
-     */
78
-    public function processShortcode($attributes = array())
79
-    {
80
-        extract($attributes, EXTR_OVERWRITE);
81
-        $event_id = isset($event_id) ? $event_id : 0;
82
-        $event = EE_Registry::instance()->load_model('Event')->get_one_by_ID($event_id);
83
-        if (! $event instanceof EE_Event) {
84
-            if (WP_DEBUG === true && current_user_can('edit_pages')) {
85
-                new ExceptionStackTraceDisplay(
86
-                    new InvalidArgumentException(
87
-                        sprintf(
88
-                            esc_html__(
89
-                                'A valid Event ID is required to use the "%1$s" shortcode.%4$sAn Event with an ID of "%2$s" could not be found.%4$sPlease verify that the shortcode added to this post\'s content includes an "%3$s" argument and that its value corresponds to a valid Event ID.',
90
-                                'event_espresso'
91
-                            ),
92
-                            $this->getTag(),
93
-                            $event_id,
94
-                            'event_id',
95
-                            '<br />'
96
-                        )
97
-                    )
98
-                );
99
-                return '';
100
-            }
101
-            return sprintf(
102
-                esc_html__(
103
-                    'An Event with an ID of "%s" could not be found. Please contact the event administrator for assistance.',
104
-                    'event_espresso'
105
-                ),
106
-                $event_id
107
-            );
108
-        }
109
-        ob_start();
110
-        do_action('AHEE_event_details_before_post', $event_id);
111
-        espresso_ticket_selector($event);
112
-        do_action('AHEE_event_details_after_post');
113
-        return ob_get_clean();
114
-    }
64
+	/**
65
+	 * callback that runs when the shortcode is encountered in post content.
66
+	 * IMPORTANT !!!
67
+	 * remember that shortcode content should be RETURNED and NOT echoed out
68
+	 *
69
+	 * @param array $attributes
70
+	 * @return string
71
+	 * @throws InvalidArgumentException
72
+	 * @throws EE_Error
73
+	 * @throws InvalidDataTypeException
74
+	 * @throws InvalidInterfaceException
75
+	 * @throws ReflectionException
76
+	 * @throws Exception
77
+	 */
78
+	public function processShortcode($attributes = array())
79
+	{
80
+		extract($attributes, EXTR_OVERWRITE);
81
+		$event_id = isset($event_id) ? $event_id : 0;
82
+		$event = EE_Registry::instance()->load_model('Event')->get_one_by_ID($event_id);
83
+		if (! $event instanceof EE_Event) {
84
+			if (WP_DEBUG === true && current_user_can('edit_pages')) {
85
+				new ExceptionStackTraceDisplay(
86
+					new InvalidArgumentException(
87
+						sprintf(
88
+							esc_html__(
89
+								'A valid Event ID is required to use the "%1$s" shortcode.%4$sAn Event with an ID of "%2$s" could not be found.%4$sPlease verify that the shortcode added to this post\'s content includes an "%3$s" argument and that its value corresponds to a valid Event ID.',
90
+								'event_espresso'
91
+							),
92
+							$this->getTag(),
93
+							$event_id,
94
+							'event_id',
95
+							'<br />'
96
+						)
97
+					)
98
+				);
99
+				return '';
100
+			}
101
+			return sprintf(
102
+				esc_html__(
103
+					'An Event with an ID of "%s" could not be found. Please contact the event administrator for assistance.',
104
+					'event_espresso'
105
+				),
106
+				$event_id
107
+			);
108
+		}
109
+		ob_start();
110
+		do_action('AHEE_event_details_before_post', $event_id);
111
+		espresso_ticket_selector($event);
112
+		do_action('AHEE_event_details_after_post');
113
+		return ob_get_clean();
114
+	}
115 115
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
         extract($attributes, EXTR_OVERWRITE);
81 81
         $event_id = isset($event_id) ? $event_id : 0;
82 82
         $event = EE_Registry::instance()->load_model('Event')->get_one_by_ID($event_id);
83
-        if (! $event instanceof EE_Event) {
83
+        if ( ! $event instanceof EE_Event) {
84 84
             if (WP_DEBUG === true && current_user_can('edit_pages')) {
85 85
                 new ExceptionStackTraceDisplay(
86 86
                     new InvalidArgumentException(
Please login to merge, or discard this patch.
core/libraries/messages/messenger/EE_Pdf_messenger.class.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
             'base_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'base', $this->_variation),
260 260
             'print_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'print', $this->_variation),
261 261
             'main_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'main', $this->_variation),
262
-            'extra_css' => EE_LIBRARIES_URL . 'messages/defaults/default/variations/pdf_base_default.css',
262
+            'extra_css' => EE_LIBRARIES_URL.'messages/defaults/default/variations/pdf_base_default.css',
263 263
             'main_body' => apply_filters('FHEE__EE_Pdf_messenger___send_message__main_body', wpautop($this->_content), $this->_content)
264 264
         );
265 265
         $this->_deregister_wp_hooks();
@@ -323,8 +323,8 @@  discard block
 block discarded – undo
323 323
         $invoice_name = $this->_subject;
324 324
 
325 325
         // only load dompdf if nobody else has yet...
326
-        if (! class_exists('Dompdf\Dompdf')) {
327
-            require_once(EE_THIRD_PARTY . 'dompdf/src/Autoloader.php');
326
+        if ( ! class_exists('Dompdf\Dompdf')) {
327
+            require_once(EE_THIRD_PARTY.'dompdf/src/Autoloader.php');
328 328
             Dompdf\Autoloader::register();
329 329
         }
330 330
         $options = new Dompdf\Options();
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
         $dompdf->loadHtml($content);
337 337
         $dompdf->render();
338 338
         // forcing the browser to open a download dialog.
339
-        $dompdf->stream($invoice_name . ".pdf", array('Attachment' => true));
339
+        $dompdf->stream($invoice_name.".pdf", array('Attachment' => true));
340 340
     }
341 341
 
342 342
 
Please login to merge, or discard this patch.
Indentation   +344 added lines, -344 removed lines patch added patch discarded remove patch
@@ -15,349 +15,349 @@
 block discarded – undo
15 15
 {
16 16
 
17 17
 
18
-    /**
19
-     * The following are the properties that this messenger requires for generating pdf
20
-     */
21
-
22
-    /**
23
-     * This is the pdf body generated by the template via the message type.
24
-     *
25
-     * @var string
26
-     */
27
-    protected $_content;
28
-
29
-
30
-    /**
31
-     * This is for the page title that gets displayed.  This will end up being the filename for the generated pdf.
32
-     *
33
-     * @var string
34
-     */
35
-    protected $_subject;
36
-
37
-
38
-    /**
39
-     * @return EE_Pdf_messenger
40
-     */
41
-    public function __construct()
42
-    {
43
-        // set properties
44
-        $this->name = 'pdf';
45
-        $this->description = esc_html__('This messenger is used for generating a pdf version of the message.', 'event_espresso');
46
-        $this->label = array(
47
-            'singular' => esc_html__('PDF', 'event_espresso'),
48
-            'plural' => esc_html__('PDFs', 'event_espresso')
49
-        );
50
-        $this->activate_on_install = true;
51
-
52
-        parent::__construct();
53
-    }
54
-
55
-
56
-    /**
57
-     * PDF Messenger desires execution immediately.
58
-     * @see  parent::send_now() for documentation.
59
-     * @since  4.9.0
60
-     * @return bool
61
-     */
62
-    public function send_now()
63
-    {
64
-        return true;
65
-    }
66
-
67
-
68
-    /**
69
-     * HTML Messenger allows an empty to field.
70
-     * @see parent::allow_empty_to_field() for documentation
71
-     * @since  4.9.0
72
-     * @return bool
73
-     */
74
-    public function allow_empty_to_field()
75
-    {
76
-        return true;
77
-    }
78
-
79
-
80
-    /**
81
-     * @see abstract declaration in EE_messenger for details.
82
-     */
83
-    protected function _set_admin_pages()
84
-    {
85
-        $this->admin_registered_pages = array('events_edit' => false);
86
-    }
87
-
88
-
89
-    /**
90
-     * @see abstract declaration in EE_messenger for details.
91
-     */
92
-    protected function _set_valid_shortcodes()
93
-    {
94
-        $this->_valid_shortcodes = array();
95
-    }
96
-
97
-
98
-    /**
99
-     * @see abstract declaration in EE_messenger for details.
100
-     */
101
-    protected function _set_validator_config()
102
-    {
103
-        $this->_validator_config = array(
104
-            'subject' => array(
105
-                'shortcodes' => array('recipient_details', 'organization', 'event', 'ticket', 'venue', 'primary_registration_details', 'event_author', 'email', 'event_meta', 'recipient_list', 'transaction', 'datetime_list', 'datetime')
106
-            ),
107
-            'content' => array(
108
-                'shortcodes' => array('recipient_details', 'organization', 'event', 'ticket', 'venue', 'primary_registration_details', 'event_author', 'email', 'event_meta', 'recipient_list', 'transaction', 'datetime_list', 'datetime')
109
-            ),
110
-            'attendee_list' => array(
111
-                'shortcodes' => array('attendee', 'event_list', 'ticket_list'),
112
-                'required' => array('[ATTENDEE_LIST]')
113
-            ),
114
-            'event_list' => array(
115
-                'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'venue', 'datetime_list', 'attendee', 'primary_registration_details', 'primary_registration_list', 'event_author', 'recipient_details', 'recipient_list'),
116
-                'required' => array('[EVENT_LIST]')
117
-            ),
118
-            'ticket_list' => array(
119
-                'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'primary_registration_details', 'recipient_details'),
120
-                'required' => array('[TICKET_LIST]')
121
-            ),
122
-            'datetime_list' => array(
123
-                'shortcodes' => array('datetime'),
124
-                'required' => array('[DATETIME_LIST]')
125
-            ),
126
-        );
127
-    }
128
-
129
-
130
-    /**
131
-     * Takes care of enqueuing any necessary scripts or styles for the page.  A do_action() so message types using this messenger can add their own js.
132
-     *
133
-     * @return void.
134
-     */
135
-    public function enqueue_scripts_styles()
136
-    {
137
-        parent::enqueue_scripts_styles();
138
-        do_action('AHEE__EE_Pdf_messenger__enqueue_scripts_styles');
139
-    }
140
-
141
-
142
-    /**
143
-     * _set_template_fields
144
-     * This sets up the fields that a messenger requires for the message to go out.
145
-     *
146
-     * @access  protected
147
-     * @return void
148
-     */
149
-    protected function _set_template_fields()
150
-    {
151
-        // any extra template fields that are NOT used by the messenger but will get used by a messenger field for shortcode replacement get added to the 'extra' key in an associated array indexed by the messenger field they relate to.  This is important for the Messages_admin to know what fields to display to the user.  Also, notice that the "values" are equal to the field type that messages admin will use to know what kind of field to display. The values ALSO have one index labeled "shortcode".  the values in that array indicate which ACTUAL SHORTCODE (i.e. [SHORTCODE]) is required in order for this extra field to be displayed.  If the required shortcode isn't part of the shortcodes array then the field is not needed and will not be displayed/parsed.
152
-        $this->_template_fields = array(
153
-            'subject' => array(
154
-                'input' => 'text',
155
-                'label' => esc_html__('Page Title', 'event_espresso'),
156
-                'type' => 'string',
157
-                'required' => true,
158
-                'validation' => true,
159
-                'css_class' => 'large-text',
160
-                'format' => '%s'
161
-            ),
162
-            'content' => '', // left empty b/c it is in the "extra array" but messenger still needs needs to know this is a field.
163
-            'extra' => array(
164
-                'content' => array(
165
-                    'main' => array(
166
-                        'input' => 'wp_editor',
167
-                        'label' => esc_html__('Main Content', 'event_espresso'),
168
-                        'type' => 'string',
169
-                        'required' => true,
170
-                        'validation' => true,
171
-                        'format' => '%s',
172
-                        'rows' => '15'
173
-                    ),
174
-                    'event_list' => array(
175
-                        'input' => 'wp_editor',
176
-                        'label' => '[EVENT_LIST]',
177
-                        'type' => 'string',
178
-                        'required' => true,
179
-                        'validation' => true,
180
-                        'format' => '%s',
181
-                        'rows' => '15',
182
-                        'shortcodes_required' => array('[EVENT_LIST]')
183
-                    ),
184
-                    'attendee_list' => array(
185
-                        'input' => 'textarea',
186
-                        'label' => '[ATTENDEE_LIST]',
187
-                        'type' => 'string',
188
-                        'required' => true,
189
-                        'validation' => true,
190
-                        'format' => '%s',
191
-                        'css_class' => 'large-text',
192
-                        'rows' => '5',
193
-                        'shortcodes_required' => array('[ATTENDEE_LIST]')
194
-                    ),
195
-                    'ticket_list' => array(
196
-                        'input' => 'textarea',
197
-                        'label' => '[TICKET_LIST]',
198
-                        'type' => 'string',
199
-                        'required' => true,
200
-                        'validation' => true,
201
-                        'format' => '%s',
202
-                        'css_class' => 'large-text',
203
-                        'rows' => '10',
204
-                        'shortcodes_required' => array('[TICKET_LIST]')
205
-                    ),
206
-                    'datetime_list' => array(
207
-                        'input' => 'textarea',
208
-                        'label' => '[DATETIME_LIST]',
209
-                        'type' => 'string',
210
-                        'required' => true,
211
-                        'validation' => true,
212
-                        'format' => '%s',
213
-                        'css_class' => 'large-text',
214
-                        'rows' => '10',
215
-                        'shortcodes_required' => array('[DATETIME_LIST]')
216
-                    )
217
-                )
218
-            )
219
-        );
220
-    }
221
-
222
-
223
-    /**
224
-     * @see definition of this method in parent
225
-     *
226
-     * @since 4.5.0
227
-     *
228
-     */
229
-    protected function _set_default_message_types()
230
-    {
231
-        // note currently PDF is only a secondary messenger so it never has any associated message types.
232
-        $this->_default_message_types = array();
233
-    }
234
-
235
-
236
-    /**
237
-     * @see definition of this method in parent
238
-     *
239
-     * @since 4.5.0
240
-     */
241
-    protected function _set_valid_message_types()
242
-    {
243
-        $this->_valid_message_types = array();
244
-    }
245
-
246
-
247
-    /**
248
-     * Generates html version of the message content and then sends it to the pdf generator.
249
-     *
250
-     *
251
-     * @since 4.5.0
252
-     *
253
-     * @return string.
254
-     */
255
-    protected function _send_message()
256
-    {
257
-        $this->_template_args = array(
258
-            'page_title' => $this->_subject,
259
-            'base_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'base', $this->_variation),
260
-            'print_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'print', $this->_variation),
261
-            'main_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'main', $this->_variation),
262
-            'extra_css' => EE_LIBRARIES_URL . 'messages/defaults/default/variations/pdf_base_default.css',
263
-            'main_body' => apply_filters('FHEE__EE_Pdf_messenger___send_message__main_body', wpautop($this->_content), $this->_content)
264
-        );
265
-        $this->_deregister_wp_hooks();
266
-        add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_styles'));
267
-        $content = $this->_get_main_template();
18
+	/**
19
+	 * The following are the properties that this messenger requires for generating pdf
20
+	 */
21
+
22
+	/**
23
+	 * This is the pdf body generated by the template via the message type.
24
+	 *
25
+	 * @var string
26
+	 */
27
+	protected $_content;
28
+
29
+
30
+	/**
31
+	 * This is for the page title that gets displayed.  This will end up being the filename for the generated pdf.
32
+	 *
33
+	 * @var string
34
+	 */
35
+	protected $_subject;
36
+
37
+
38
+	/**
39
+	 * @return EE_Pdf_messenger
40
+	 */
41
+	public function __construct()
42
+	{
43
+		// set properties
44
+		$this->name = 'pdf';
45
+		$this->description = esc_html__('This messenger is used for generating a pdf version of the message.', 'event_espresso');
46
+		$this->label = array(
47
+			'singular' => esc_html__('PDF', 'event_espresso'),
48
+			'plural' => esc_html__('PDFs', 'event_espresso')
49
+		);
50
+		$this->activate_on_install = true;
51
+
52
+		parent::__construct();
53
+	}
54
+
55
+
56
+	/**
57
+	 * PDF Messenger desires execution immediately.
58
+	 * @see  parent::send_now() for documentation.
59
+	 * @since  4.9.0
60
+	 * @return bool
61
+	 */
62
+	public function send_now()
63
+	{
64
+		return true;
65
+	}
66
+
67
+
68
+	/**
69
+	 * HTML Messenger allows an empty to field.
70
+	 * @see parent::allow_empty_to_field() for documentation
71
+	 * @since  4.9.0
72
+	 * @return bool
73
+	 */
74
+	public function allow_empty_to_field()
75
+	{
76
+		return true;
77
+	}
78
+
79
+
80
+	/**
81
+	 * @see abstract declaration in EE_messenger for details.
82
+	 */
83
+	protected function _set_admin_pages()
84
+	{
85
+		$this->admin_registered_pages = array('events_edit' => false);
86
+	}
87
+
88
+
89
+	/**
90
+	 * @see abstract declaration in EE_messenger for details.
91
+	 */
92
+	protected function _set_valid_shortcodes()
93
+	{
94
+		$this->_valid_shortcodes = array();
95
+	}
96
+
97
+
98
+	/**
99
+	 * @see abstract declaration in EE_messenger for details.
100
+	 */
101
+	protected function _set_validator_config()
102
+	{
103
+		$this->_validator_config = array(
104
+			'subject' => array(
105
+				'shortcodes' => array('recipient_details', 'organization', 'event', 'ticket', 'venue', 'primary_registration_details', 'event_author', 'email', 'event_meta', 'recipient_list', 'transaction', 'datetime_list', 'datetime')
106
+			),
107
+			'content' => array(
108
+				'shortcodes' => array('recipient_details', 'organization', 'event', 'ticket', 'venue', 'primary_registration_details', 'event_author', 'email', 'event_meta', 'recipient_list', 'transaction', 'datetime_list', 'datetime')
109
+			),
110
+			'attendee_list' => array(
111
+				'shortcodes' => array('attendee', 'event_list', 'ticket_list'),
112
+				'required' => array('[ATTENDEE_LIST]')
113
+			),
114
+			'event_list' => array(
115
+				'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'venue', 'datetime_list', 'attendee', 'primary_registration_details', 'primary_registration_list', 'event_author', 'recipient_details', 'recipient_list'),
116
+				'required' => array('[EVENT_LIST]')
117
+			),
118
+			'ticket_list' => array(
119
+				'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'primary_registration_details', 'recipient_details'),
120
+				'required' => array('[TICKET_LIST]')
121
+			),
122
+			'datetime_list' => array(
123
+				'shortcodes' => array('datetime'),
124
+				'required' => array('[DATETIME_LIST]')
125
+			),
126
+		);
127
+	}
128
+
129
+
130
+	/**
131
+	 * Takes care of enqueuing any necessary scripts or styles for the page.  A do_action() so message types using this messenger can add their own js.
132
+	 *
133
+	 * @return void.
134
+	 */
135
+	public function enqueue_scripts_styles()
136
+	{
137
+		parent::enqueue_scripts_styles();
138
+		do_action('AHEE__EE_Pdf_messenger__enqueue_scripts_styles');
139
+	}
140
+
141
+
142
+	/**
143
+	 * _set_template_fields
144
+	 * This sets up the fields that a messenger requires for the message to go out.
145
+	 *
146
+	 * @access  protected
147
+	 * @return void
148
+	 */
149
+	protected function _set_template_fields()
150
+	{
151
+		// any extra template fields that are NOT used by the messenger but will get used by a messenger field for shortcode replacement get added to the 'extra' key in an associated array indexed by the messenger field they relate to.  This is important for the Messages_admin to know what fields to display to the user.  Also, notice that the "values" are equal to the field type that messages admin will use to know what kind of field to display. The values ALSO have one index labeled "shortcode".  the values in that array indicate which ACTUAL SHORTCODE (i.e. [SHORTCODE]) is required in order for this extra field to be displayed.  If the required shortcode isn't part of the shortcodes array then the field is not needed and will not be displayed/parsed.
152
+		$this->_template_fields = array(
153
+			'subject' => array(
154
+				'input' => 'text',
155
+				'label' => esc_html__('Page Title', 'event_espresso'),
156
+				'type' => 'string',
157
+				'required' => true,
158
+				'validation' => true,
159
+				'css_class' => 'large-text',
160
+				'format' => '%s'
161
+			),
162
+			'content' => '', // left empty b/c it is in the "extra array" but messenger still needs needs to know this is a field.
163
+			'extra' => array(
164
+				'content' => array(
165
+					'main' => array(
166
+						'input' => 'wp_editor',
167
+						'label' => esc_html__('Main Content', 'event_espresso'),
168
+						'type' => 'string',
169
+						'required' => true,
170
+						'validation' => true,
171
+						'format' => '%s',
172
+						'rows' => '15'
173
+					),
174
+					'event_list' => array(
175
+						'input' => 'wp_editor',
176
+						'label' => '[EVENT_LIST]',
177
+						'type' => 'string',
178
+						'required' => true,
179
+						'validation' => true,
180
+						'format' => '%s',
181
+						'rows' => '15',
182
+						'shortcodes_required' => array('[EVENT_LIST]')
183
+					),
184
+					'attendee_list' => array(
185
+						'input' => 'textarea',
186
+						'label' => '[ATTENDEE_LIST]',
187
+						'type' => 'string',
188
+						'required' => true,
189
+						'validation' => true,
190
+						'format' => '%s',
191
+						'css_class' => 'large-text',
192
+						'rows' => '5',
193
+						'shortcodes_required' => array('[ATTENDEE_LIST]')
194
+					),
195
+					'ticket_list' => array(
196
+						'input' => 'textarea',
197
+						'label' => '[TICKET_LIST]',
198
+						'type' => 'string',
199
+						'required' => true,
200
+						'validation' => true,
201
+						'format' => '%s',
202
+						'css_class' => 'large-text',
203
+						'rows' => '10',
204
+						'shortcodes_required' => array('[TICKET_LIST]')
205
+					),
206
+					'datetime_list' => array(
207
+						'input' => 'textarea',
208
+						'label' => '[DATETIME_LIST]',
209
+						'type' => 'string',
210
+						'required' => true,
211
+						'validation' => true,
212
+						'format' => '%s',
213
+						'css_class' => 'large-text',
214
+						'rows' => '10',
215
+						'shortcodes_required' => array('[DATETIME_LIST]')
216
+					)
217
+				)
218
+			)
219
+		);
220
+	}
221
+
222
+
223
+	/**
224
+	 * @see definition of this method in parent
225
+	 *
226
+	 * @since 4.5.0
227
+	 *
228
+	 */
229
+	protected function _set_default_message_types()
230
+	{
231
+		// note currently PDF is only a secondary messenger so it never has any associated message types.
232
+		$this->_default_message_types = array();
233
+	}
234
+
235
+
236
+	/**
237
+	 * @see definition of this method in parent
238
+	 *
239
+	 * @since 4.5.0
240
+	 */
241
+	protected function _set_valid_message_types()
242
+	{
243
+		$this->_valid_message_types = array();
244
+	}
245
+
246
+
247
+	/**
248
+	 * Generates html version of the message content and then sends it to the pdf generator.
249
+	 *
250
+	 *
251
+	 * @since 4.5.0
252
+	 *
253
+	 * @return string.
254
+	 */
255
+	protected function _send_message()
256
+	{
257
+		$this->_template_args = array(
258
+			'page_title' => $this->_subject,
259
+			'base_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'base', $this->_variation),
260
+			'print_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'print', $this->_variation),
261
+			'main_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, true, 'main', $this->_variation),
262
+			'extra_css' => EE_LIBRARIES_URL . 'messages/defaults/default/variations/pdf_base_default.css',
263
+			'main_body' => apply_filters('FHEE__EE_Pdf_messenger___send_message__main_body', wpautop($this->_content), $this->_content)
264
+		);
265
+		$this->_deregister_wp_hooks();
266
+		add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_styles'));
267
+		$content = $this->_get_main_template();
268 268
 //      die( $content );
269
-        $this->_do_pdf($content);
270
-        exit(0);
271
-    }
272
-
273
-
274
-    /**
275
-     * The purpose of this function is to de register all actions hooked into wp_head and wp_footer so that it doesn't interfere with our templates.  If users want to add any custom styles or scripts they must use the AHEE__EE_Pdf_messenger__enqueue_scripts_styles hook.
276
-     *
277
-     * @since 4.5.0
278
-     *
279
-     * @return void
280
-     */
281
-    protected function _deregister_wp_hooks()
282
-    {
283
-        remove_all_actions('wp_head');
284
-        remove_all_actions('wp_footer');
285
-        remove_all_actions('wp_print_footer_scripts');
286
-        remove_all_actions('wp_enqueue_scripts');
287
-        global $wp_scripts, $wp_styles;
288
-        $wp_scripts = $wp_styles = array();
289
-
290
-        // just add back in wp_enqueue_scripts and wp_print_footer_scripts cause that's all we want to load.
291
-        add_action('wp_head', 'wp_enqueue_scripts');
292
-        add_action('wp_footer', 'wp_print_footer_scripts');
293
-        add_action('wp_print_footer_scripts', '_wp_footer_scripts');
294
-    }
295
-
296
-
297
-    /**
298
-     * Overwrite parent _get_main_template for pdf purposes.
299
-     *
300
-     * @since  4.5.0
301
-     *
302
-     * @param bool $preview
303
-     * @return string
304
-     */
305
-    protected function _get_main_template($preview = false)
306
-    {
307
-        $wrapper_template = $this->_tmp_pack->get_wrapper('html', 'main');
308
-        // add message type to template_args
309
-        $this->_template_args['message_type'] = $this->_incoming_message_type;
310
-        return EEH_Template::display_template($wrapper_template, $this->_template_args, true);
311
-    }
312
-
313
-
314
-    /**
315
-     * This takes care of loading the dompdf library and generating the actual pdf
316
-     *
317
-     * @param string $content This is the generated html content being converted into a pdf.
318
-     *
319
-     * @return void
320
-     */
321
-    protected function _do_pdf($content = '')
322
-    {
323
-        $invoice_name = $this->_subject;
324
-
325
-        // only load dompdf if nobody else has yet...
326
-        if (! class_exists('Dompdf\Dompdf')) {
327
-            require_once(EE_THIRD_PARTY . 'dompdf/src/Autoloader.php');
328
-            Dompdf\Autoloader::register();
329
-        }
330
-        $options = new Dompdf\Options();
331
-        $options->set('isRemoteEnabled', true);
332
-        $options->set('isJavascriptEnabled', false);
333
-        if (defined('DOMPDF_FONT_DIR')) {
334
-            $options->setFontDir(DOMPDF_FONT_DIR);
335
-            $options->setFontCache(DOMPDF_FONT_DIR);
336
-        }
337
-        // Allow changing the paper size.
338
-        if (defined('DOMPDF_DEFAULT_PAPER_SIZE')) {
339
-            $options->set('defaultPaperSize', DOMPDF_DEFAULT_PAPER_SIZE);
340
-        }
341
-        $dompdf = new Dompdf\Dompdf($options);
342
-        // Remove all spaces between HTML tags
343
-        $content = preg_replace('/>\s+</', '><', $content);
344
-        $dompdf->loadHtml($content);
345
-        $dompdf->render();
346
-        // forcing the browser to open a download dialog.
347
-        $dompdf->stream($invoice_name . ".pdf", array('Attachment' => true));
348
-    }
349
-
350
-
351
-    /**
352
-     * @return string
353
-     */
354
-    protected function _preview()
355
-    {
356
-        return $this->_send_message();
357
-    }
358
-
359
-
360
-    protected function _set_admin_settings_fields()
361
-    {
362
-    }
269
+		$this->_do_pdf($content);
270
+		exit(0);
271
+	}
272
+
273
+
274
+	/**
275
+	 * The purpose of this function is to de register all actions hooked into wp_head and wp_footer so that it doesn't interfere with our templates.  If users want to add any custom styles or scripts they must use the AHEE__EE_Pdf_messenger__enqueue_scripts_styles hook.
276
+	 *
277
+	 * @since 4.5.0
278
+	 *
279
+	 * @return void
280
+	 */
281
+	protected function _deregister_wp_hooks()
282
+	{
283
+		remove_all_actions('wp_head');
284
+		remove_all_actions('wp_footer');
285
+		remove_all_actions('wp_print_footer_scripts');
286
+		remove_all_actions('wp_enqueue_scripts');
287
+		global $wp_scripts, $wp_styles;
288
+		$wp_scripts = $wp_styles = array();
289
+
290
+		// just add back in wp_enqueue_scripts and wp_print_footer_scripts cause that's all we want to load.
291
+		add_action('wp_head', 'wp_enqueue_scripts');
292
+		add_action('wp_footer', 'wp_print_footer_scripts');
293
+		add_action('wp_print_footer_scripts', '_wp_footer_scripts');
294
+	}
295
+
296
+
297
+	/**
298
+	 * Overwrite parent _get_main_template for pdf purposes.
299
+	 *
300
+	 * @since  4.5.0
301
+	 *
302
+	 * @param bool $preview
303
+	 * @return string
304
+	 */
305
+	protected function _get_main_template($preview = false)
306
+	{
307
+		$wrapper_template = $this->_tmp_pack->get_wrapper('html', 'main');
308
+		// add message type to template_args
309
+		$this->_template_args['message_type'] = $this->_incoming_message_type;
310
+		return EEH_Template::display_template($wrapper_template, $this->_template_args, true);
311
+	}
312
+
313
+
314
+	/**
315
+	 * This takes care of loading the dompdf library and generating the actual pdf
316
+	 *
317
+	 * @param string $content This is the generated html content being converted into a pdf.
318
+	 *
319
+	 * @return void
320
+	 */
321
+	protected function _do_pdf($content = '')
322
+	{
323
+		$invoice_name = $this->_subject;
324
+
325
+		// only load dompdf if nobody else has yet...
326
+		if (! class_exists('Dompdf\Dompdf')) {
327
+			require_once(EE_THIRD_PARTY . 'dompdf/src/Autoloader.php');
328
+			Dompdf\Autoloader::register();
329
+		}
330
+		$options = new Dompdf\Options();
331
+		$options->set('isRemoteEnabled', true);
332
+		$options->set('isJavascriptEnabled', false);
333
+		if (defined('DOMPDF_FONT_DIR')) {
334
+			$options->setFontDir(DOMPDF_FONT_DIR);
335
+			$options->setFontCache(DOMPDF_FONT_DIR);
336
+		}
337
+		// Allow changing the paper size.
338
+		if (defined('DOMPDF_DEFAULT_PAPER_SIZE')) {
339
+			$options->set('defaultPaperSize', DOMPDF_DEFAULT_PAPER_SIZE);
340
+		}
341
+		$dompdf = new Dompdf\Dompdf($options);
342
+		// Remove all spaces between HTML tags
343
+		$content = preg_replace('/>\s+</', '><', $content);
344
+		$dompdf->loadHtml($content);
345
+		$dompdf->render();
346
+		// forcing the browser to open a download dialog.
347
+		$dompdf->stream($invoice_name . ".pdf", array('Attachment' => true));
348
+	}
349
+
350
+
351
+	/**
352
+	 * @return string
353
+	 */
354
+	protected function _preview()
355
+	{
356
+		return $this->_send_message();
357
+	}
358
+
359
+
360
+	protected function _set_admin_settings_fields()
361
+	{
362
+	}
363 363
 }
Please login to merge, or discard this patch.
core/services/validators/URLValidator.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@
 block discarded – undo
16 16
  */
17 17
 class URLValidator
18 18
 {
19
-    /**
20
-     * Returns whether or not the URL is valid
21
-     * @since 4.9.68.p
22
-     * @param $url
23
-     * @return boolean
24
-     */
25
-    public function isValid($url)
26
-    {
27
-        return  esc_url_raw($url) === $url;
28
-    }
19
+	/**
20
+	 * Returns whether or not the URL is valid
21
+	 * @since 4.9.68.p
22
+	 * @param $url
23
+	 * @return boolean
24
+	 */
25
+	public function isValid($url)
26
+	{
27
+		return  esc_url_raw($url) === $url;
28
+	}
29 29
 }
30 30
 // End of file URLValidator.php
31 31
 // Location: ${NAMESPACE}/URLValidator.php
Please login to merge, or discard this patch.
core/db_models/EEM_Term.model.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -44,43 +44,43 @@  discard block
 block discarded – undo
44 44
         );
45 45
         $this->_wp_core_model = true;
46 46
         $path_to_tax_model = 'Term_Taxonomy';
47
-        $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
48
-        $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected(
47
+        $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
48
+        $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Taxonomy_Protected(
49 49
             $path_to_tax_model
50 50
         );
51
-        $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false;
52
-        $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false;
53
-        $path_to_tax_model = $path_to_tax_model . '.';
51
+        $this->_cap_restriction_generators[EEM_Base::caps_edit] = false;
52
+        $this->_cap_restriction_generators[EEM_Base::caps_delete] = false;
53
+        $path_to_tax_model = $path_to_tax_model.'.';
54 54
         // add cap restrictions for editing relating to the "ee_edit_*"
55
-        $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
55
+        $this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
56 56
             array(
57
-                $path_to_tax_model . 'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'),
57
+                $path_to_tax_model.'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'),
58 58
             )
59 59
         );
60
-        $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
60
+        $this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
61 61
             array(
62
-                $path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'),
62
+                $path_to_tax_model.'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'),
63 63
             )
64 64
         );
65
-        $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
65
+        $this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
66 66
             array(
67
-                $path_to_tax_model . 'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'),
67
+                $path_to_tax_model.'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'),
68 68
             )
69 69
         );
70 70
         // add cap restrictions for deleting relating to the "ee_deleting_*"
71
-        $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
71
+        $this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
72 72
             array(
73
-                $path_to_tax_model . 'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'),
73
+                $path_to_tax_model.'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'),
74 74
             )
75 75
         );
76
-        $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
76
+        $this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
77 77
             array(
78
-                $path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'),
78
+                $path_to_tax_model.'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'),
79 79
             )
80 80
         );
81
-        $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
81
+        $this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
82 82
             array(
83
-                $path_to_tax_model . 'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'),
83
+                $path_to_tax_model.'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'),
84 84
             )
85 85
         );
86 86
         parent::__construct($timezone);
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
         }
186 186
         $post_tag_row = reset($post_tag_results);
187 187
         $post_tag = $this->instantiate_class_from_array_or_object($post_tag_row);
188
-        if (! $post_tag instanceof EE_Term) {
188
+        if ( ! $post_tag instanceof EE_Term) {
189 189
             return null;
190 190
         }
191 191
 
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
             )
217 217
         );
218 218
         foreach ($post_tags as $key => $post_tag) {
219
-            if (! isset($post_tags[ $key ]->post_type)) {
220
-                $post_tags[ $key ]->post_type = array();
219
+            if ( ! isset($post_tags[$key]->post_type)) {
220
+                $post_tags[$key]->post_type = array();
221 221
             }
222
-            $post_tags[ $key ]->post_type[] = 'espresso_events';
222
+            $post_tags[$key]->post_type[] = 'espresso_events';
223 223
         }
224 224
         return $post_tags;
225 225
     }
@@ -244,10 +244,10 @@  discard block
 block discarded – undo
244 244
             )
245 245
         );
246 246
         foreach ($post_tags as $key => $post_tag) {
247
-            if (! isset($post_tags[ $key ]->post_type)) {
248
-                $post_tags[ $key ]->post_type = array();
247
+            if ( ! isset($post_tags[$key]->post_type)) {
248
+                $post_tags[$key]->post_type = array();
249 249
             }
250
-            $post_tags[ $key ]->post_type[] = 'espresso_venues';
250
+            $post_tags[$key]->post_type[] = 'espresso_venues';
251 251
         }
252 252
         return $post_tags;
253 253
     }
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
     {
268 268
         if ($model === EEM_Term::instance()) {
269 269
             $taxonomies = get_taxonomies(array('show_in_rest' => true));
270
-            if (! empty($taxonomies)) {
270
+            if ( ! empty($taxonomies)) {
271 271
                 $model_query_params[0]['Term_Taxonomy.taxonomy'] = array('IN', $taxonomies);
272 272
             }
273 273
         }
Please login to merge, or discard this patch.
Indentation   +237 added lines, -237 removed lines patch added patch discarded remove patch
@@ -14,263 +14,263 @@
 block discarded – undo
14 14
 class EEM_Term extends EEM_Base
15 15
 {
16 16
 
17
-    // private instance of the Attendee object
18
-    protected static $_instance = null;
17
+	// private instance of the Attendee object
18
+	protected static $_instance = null;
19 19
 
20 20
 
21 21
 
22
-    /**
23
-     *__construct
24
-     *
25
-     * @param string $timezone
26
-     */
27
-    protected function __construct($timezone = null)
28
-    {
29
-        $this->singular_item = esc_html__('Term', 'event_espresso');
30
-        $this->plural_item = esc_html__('Terms', 'event_espresso');
31
-        $this->_tables = array(
32
-            'Term' => new EE_Primary_Table('terms', 'term_id'),
33
-        );
34
-        $this->_fields = array(
35
-            'Term' => array(
36
-                'term_id'    => new EE_Primary_Key_Int_Field('term_id', esc_html__('Term ID', 'event_espresso')),
37
-                'name'       => new EE_Plain_Text_Field('name', esc_html__('Term Name', 'event_espresso'), false, ''),
38
-                'slug'       => new EE_Slug_Field('slug', esc_html__('Term Slug', 'event_espresso'), false),
39
-                'term_group' => new EE_Integer_Field('term_group', esc_html__("Term Group", "event_espresso"), false, 0),
40
-            ),
41
-        );
42
-        $this->_model_relations = array(
43
-            'Term_Taxonomy' => new EE_Has_Many_Relation(),
44
-        );
45
-        $this->_wp_core_model = true;
46
-        $path_to_tax_model = 'Term_Taxonomy';
47
-        $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
48
-        $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected(
49
-            $path_to_tax_model
50
-        );
51
-        $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false;
52
-        $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false;
53
-        $path_to_tax_model = $path_to_tax_model . '.';
54
-        // add cap restrictions for editing relating to the "ee_edit_*"
55
-        $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
56
-            array(
57
-                $path_to_tax_model . 'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'),
58
-            )
59
-        );
60
-        $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
61
-            array(
62
-                $path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'),
63
-            )
64
-        );
65
-        $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
66
-            array(
67
-                $path_to_tax_model . 'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'),
68
-            )
69
-        );
70
-        // add cap restrictions for deleting relating to the "ee_deleting_*"
71
-        $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
72
-            array(
73
-                $path_to_tax_model . 'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'),
74
-            )
75
-        );
76
-        $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
77
-            array(
78
-                $path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'),
79
-            )
80
-        );
81
-        $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
82
-            array(
83
-                $path_to_tax_model . 'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'),
84
-            )
85
-        );
86
-        parent::__construct($timezone);
87
-        add_filter('FHEE__Read__create_model_query_params', array('EEM_Term', 'rest_api_query_params'), 10, 3);
88
-    }
22
+	/**
23
+	 *__construct
24
+	 *
25
+	 * @param string $timezone
26
+	 */
27
+	protected function __construct($timezone = null)
28
+	{
29
+		$this->singular_item = esc_html__('Term', 'event_espresso');
30
+		$this->plural_item = esc_html__('Terms', 'event_espresso');
31
+		$this->_tables = array(
32
+			'Term' => new EE_Primary_Table('terms', 'term_id'),
33
+		);
34
+		$this->_fields = array(
35
+			'Term' => array(
36
+				'term_id'    => new EE_Primary_Key_Int_Field('term_id', esc_html__('Term ID', 'event_espresso')),
37
+				'name'       => new EE_Plain_Text_Field('name', esc_html__('Term Name', 'event_espresso'), false, ''),
38
+				'slug'       => new EE_Slug_Field('slug', esc_html__('Term Slug', 'event_espresso'), false),
39
+				'term_group' => new EE_Integer_Field('term_group', esc_html__("Term Group", "event_espresso"), false, 0),
40
+			),
41
+		);
42
+		$this->_model_relations = array(
43
+			'Term_Taxonomy' => new EE_Has_Many_Relation(),
44
+		);
45
+		$this->_wp_core_model = true;
46
+		$path_to_tax_model = 'Term_Taxonomy';
47
+		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
48
+		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected(
49
+			$path_to_tax_model
50
+		);
51
+		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false;
52
+		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false;
53
+		$path_to_tax_model = $path_to_tax_model . '.';
54
+		// add cap restrictions for editing relating to the "ee_edit_*"
55
+		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
56
+			array(
57
+				$path_to_tax_model . 'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'),
58
+			)
59
+		);
60
+		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
61
+			array(
62
+				$path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'),
63
+			)
64
+		);
65
+		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
66
+			array(
67
+				$path_to_tax_model . 'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'),
68
+			)
69
+		);
70
+		// add cap restrictions for deleting relating to the "ee_deleting_*"
71
+		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
72
+			array(
73
+				$path_to_tax_model . 'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'),
74
+			)
75
+		);
76
+		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
77
+			array(
78
+				$path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'),
79
+			)
80
+		);
81
+		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
82
+			array(
83
+				$path_to_tax_model . 'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'),
84
+			)
85
+		);
86
+		parent::__construct($timezone);
87
+		add_filter('FHEE__Read__create_model_query_params', array('EEM_Term', 'rest_api_query_params'), 10, 3);
88
+	}
89 89
 
90 90
 
91 91
 
92
-    /**
93
-     * retrieves a list of all EE event categories
94
-     *
95
-     * @access public
96
-     * @param bool $show_uncategorized
97
-     * @return \EE_Base_Class[]
98
-     */
99
-    public function get_all_ee_categories($show_uncategorized = false)
100
-    {
101
-        $where_params = array(
102
-            'Term_Taxonomy.taxonomy' => 'espresso_event_categories',
103
-            'NOT'                    => array('name' => esc_html__('Uncategorized', 'event_espresso')),
104
-        );
105
-        if ($show_uncategorized) {
106
-            unset($where_params['NOT']);
107
-        }
108
-        return EEM_Term::instance()->get_all(
109
-            array(
110
-                $where_params,
111
-                'order_by' => array('name' => 'ASC'),
112
-            )
113
-        );
114
-    }
92
+	/**
93
+	 * retrieves a list of all EE event categories
94
+	 *
95
+	 * @access public
96
+	 * @param bool $show_uncategorized
97
+	 * @return \EE_Base_Class[]
98
+	 */
99
+	public function get_all_ee_categories($show_uncategorized = false)
100
+	{
101
+		$where_params = array(
102
+			'Term_Taxonomy.taxonomy' => 'espresso_event_categories',
103
+			'NOT'                    => array('name' => esc_html__('Uncategorized', 'event_espresso')),
104
+		);
105
+		if ($show_uncategorized) {
106
+			unset($where_params['NOT']);
107
+		}
108
+		return EEM_Term::instance()->get_all(
109
+			array(
110
+				$where_params,
111
+				'order_by' => array('name' => 'ASC'),
112
+			)
113
+		);
114
+	}
115 115
 
116 116
 
117 117
 
118
-    /**
119
-     * retrieves a list of all post_tags associated with an EE CPT
120
-     *
121
-     * @access public
122
-     * @param string $post_type
123
-     * @return array
124
-     */
125
-    public function get_all_CPT_post_tags($post_type = '')
126
-    {
127
-        switch ($post_type) {
128
-            case 'espresso_events':
129
-                return $this->get_all_event_post_tags();
130
-                break;
131
-            case 'espresso_venues':
132
-                return $this->get_all_venue_post_tags();
133
-                break;
134
-            default:
135
-                $event_tags = $this->get_all_event_post_tags();
136
-                $venue_tags = $this->get_all_venue_post_tags();
137
-                return array_merge($event_tags, $venue_tags);
138
-        }
139
-    }
118
+	/**
119
+	 * retrieves a list of all post_tags associated with an EE CPT
120
+	 *
121
+	 * @access public
122
+	 * @param string $post_type
123
+	 * @return array
124
+	 */
125
+	public function get_all_CPT_post_tags($post_type = '')
126
+	{
127
+		switch ($post_type) {
128
+			case 'espresso_events':
129
+				return $this->get_all_event_post_tags();
130
+				break;
131
+			case 'espresso_venues':
132
+				return $this->get_all_venue_post_tags();
133
+				break;
134
+			default:
135
+				$event_tags = $this->get_all_event_post_tags();
136
+				$venue_tags = $this->get_all_venue_post_tags();
137
+				return array_merge($event_tags, $venue_tags);
138
+		}
139
+	}
140 140
 
141 141
 
142
-    /**
143
-     * returns an EE_Term object for the given tag
144
-     * if it has been utilized by any EE_Events or EE_Venues
145
-     *
146
-     * @param string $tag
147
-     * @return EE_Term|null
148
-     * @throws EE_Error
149
-     * @throws InvalidArgumentException
150
-     * @throws InvalidDataTypeException
151
-     * @throws InvalidInterfaceException
152
-     */
153
-    public function get_post_tag_for_event_or_venue($tag)
154
-    {
155
-        $post_tag_results = $this->get_all_wpdb_results(
156
-            array(
157
-                array(
158
-                    'slug' => $tag,
159
-                    'Term_Taxonomy.taxonomy' => 'post_tag',
160
-                    'OR' => array(
161
-                        'Term_Taxonomy.Venue.post_type' => 'espresso_venues',
162
-                        'Term_Taxonomy.Event.post_type' => 'espresso_events',
163
-                    ),
164
-                ),
165
-                'default_where_conditions' => 'none',
166
-                'extra_selects' => array(
167
-                    'event_post_type' => array('Term_Taxonomy___Event_CPT.post_type', '%s'),
168
-                    'venue_post_type' => array('Term_Taxonomy___Venue_CPT.post_type', '%s')
169
-                ),
170
-                'group_by' => array(
171
-                    'event_post_type',
172
-                    'venue_post_type',
173
-                ),
174
-                'limit' => 2
175
-            )
176
-        );
142
+	/**
143
+	 * returns an EE_Term object for the given tag
144
+	 * if it has been utilized by any EE_Events or EE_Venues
145
+	 *
146
+	 * @param string $tag
147
+	 * @return EE_Term|null
148
+	 * @throws EE_Error
149
+	 * @throws InvalidArgumentException
150
+	 * @throws InvalidDataTypeException
151
+	 * @throws InvalidInterfaceException
152
+	 */
153
+	public function get_post_tag_for_event_or_venue($tag)
154
+	{
155
+		$post_tag_results = $this->get_all_wpdb_results(
156
+			array(
157
+				array(
158
+					'slug' => $tag,
159
+					'Term_Taxonomy.taxonomy' => 'post_tag',
160
+					'OR' => array(
161
+						'Term_Taxonomy.Venue.post_type' => 'espresso_venues',
162
+						'Term_Taxonomy.Event.post_type' => 'espresso_events',
163
+					),
164
+				),
165
+				'default_where_conditions' => 'none',
166
+				'extra_selects' => array(
167
+					'event_post_type' => array('Term_Taxonomy___Event_CPT.post_type', '%s'),
168
+					'venue_post_type' => array('Term_Taxonomy___Venue_CPT.post_type', '%s')
169
+				),
170
+				'group_by' => array(
171
+					'event_post_type',
172
+					'venue_post_type',
173
+				),
174
+				'limit' => 2
175
+			)
176
+		);
177 177
 
178
-        $post_types = array();
179
-        foreach ((array) $post_tag_results as $row) {
180
-            if ($row['event_post_type'] === 'espresso_events') {
181
-                $post_types[] = EEM_Event::instance()->post_type();
182
-            } elseif ($row['venue_post_type'] === 'espresso_venues') {
183
-                $post_types[] = EEM_Venue::instance()->post_type();
184
-            }
185
-        }
186
-        $post_tag_row = reset($post_tag_results);
187
-        $post_tag = $this->instantiate_class_from_array_or_object($post_tag_row);
188
-        if (! $post_tag instanceof EE_Term) {
189
-            return null;
190
-        }
178
+		$post_types = array();
179
+		foreach ((array) $post_tag_results as $row) {
180
+			if ($row['event_post_type'] === 'espresso_events') {
181
+				$post_types[] = EEM_Event::instance()->post_type();
182
+			} elseif ($row['venue_post_type'] === 'espresso_venues') {
183
+				$post_types[] = EEM_Venue::instance()->post_type();
184
+			}
185
+		}
186
+		$post_tag_row = reset($post_tag_results);
187
+		$post_tag = $this->instantiate_class_from_array_or_object($post_tag_row);
188
+		if (! $post_tag instanceof EE_Term) {
189
+			return null;
190
+		}
191 191
 
192
-        if ($post_tag->post_type === null) {
193
-            $post_tag->post_type = array();
194
-        }
195
-        $post_tag->post_type = array_merge($post_tag->post_type, array_unique($post_types));
196
-        return $post_tag;
197
-    }
192
+		if ($post_tag->post_type === null) {
193
+			$post_tag->post_type = array();
194
+		}
195
+		$post_tag->post_type = array_merge($post_tag->post_type, array_unique($post_types));
196
+		return $post_tag;
197
+	}
198 198
 
199 199
 
200 200
 
201
-    /**
202
-     * get_all_event_post_tags
203
-     *
204
-     * @return EE_Base_Class[]
205
-     */
206
-    public function get_all_event_post_tags()
207
-    {
208
-        $post_tags = EEM_Term::instance()->get_all(
209
-            array(
210
-                array(
211
-                    'Term_Taxonomy.taxonomy'        => 'post_tag',
212
-                    'Term_Taxonomy.Event.post_type' => 'espresso_events',
213
-                ),
214
-                'order_by'   => array('name' => 'ASC'),
215
-                'force_join' => array('Term_Taxonomy.Event'),
216
-            )
217
-        );
218
-        foreach ($post_tags as $key => $post_tag) {
219
-            if (! isset($post_tags[ $key ]->post_type)) {
220
-                $post_tags[ $key ]->post_type = array();
221
-            }
222
-            $post_tags[ $key ]->post_type[] = 'espresso_events';
223
-        }
224
-        return $post_tags;
225
-    }
201
+	/**
202
+	 * get_all_event_post_tags
203
+	 *
204
+	 * @return EE_Base_Class[]
205
+	 */
206
+	public function get_all_event_post_tags()
207
+	{
208
+		$post_tags = EEM_Term::instance()->get_all(
209
+			array(
210
+				array(
211
+					'Term_Taxonomy.taxonomy'        => 'post_tag',
212
+					'Term_Taxonomy.Event.post_type' => 'espresso_events',
213
+				),
214
+				'order_by'   => array('name' => 'ASC'),
215
+				'force_join' => array('Term_Taxonomy.Event'),
216
+			)
217
+		);
218
+		foreach ($post_tags as $key => $post_tag) {
219
+			if (! isset($post_tags[ $key ]->post_type)) {
220
+				$post_tags[ $key ]->post_type = array();
221
+			}
222
+			$post_tags[ $key ]->post_type[] = 'espresso_events';
223
+		}
224
+		return $post_tags;
225
+	}
226 226
 
227 227
 
228 228
 
229
-    /**
230
-     * get_all_venue_post_tags
231
-     *
232
-     * @return EE_Base_Class[]
233
-     */
234
-    public function get_all_venue_post_tags()
235
-    {
236
-        $post_tags = EEM_Term::instance()->get_all(
237
-            array(
238
-                array(
239
-                    'Term_Taxonomy.taxonomy'        => 'post_tag',
240
-                    'Term_Taxonomy.Venue.post_type' => 'espresso_venues',
241
-                ),
242
-                'order_by'   => array('name' => 'ASC'),
243
-                'force_join' => array('Term_Taxonomy'),
244
-            )
245
-        );
246
-        foreach ($post_tags as $key => $post_tag) {
247
-            if (! isset($post_tags[ $key ]->post_type)) {
248
-                $post_tags[ $key ]->post_type = array();
249
-            }
250
-            $post_tags[ $key ]->post_type[] = 'espresso_venues';
251
-        }
252
-        return $post_tags;
253
-    }
229
+	/**
230
+	 * get_all_venue_post_tags
231
+	 *
232
+	 * @return EE_Base_Class[]
233
+	 */
234
+	public function get_all_venue_post_tags()
235
+	{
236
+		$post_tags = EEM_Term::instance()->get_all(
237
+			array(
238
+				array(
239
+					'Term_Taxonomy.taxonomy'        => 'post_tag',
240
+					'Term_Taxonomy.Venue.post_type' => 'espresso_venues',
241
+				),
242
+				'order_by'   => array('name' => 'ASC'),
243
+				'force_join' => array('Term_Taxonomy'),
244
+			)
245
+		);
246
+		foreach ($post_tags as $key => $post_tag) {
247
+			if (! isset($post_tags[ $key ]->post_type)) {
248
+				$post_tags[ $key ]->post_type = array();
249
+			}
250
+			$post_tags[ $key ]->post_type[] = 'espresso_venues';
251
+		}
252
+		return $post_tags;
253
+	}
254 254
 
255 255
 
256 256
 
257
-    /**
258
-     * Makes sure that during REST API queries, we only return terms
259
-     * for term taxonomies which should be shown in the rest api
260
-     *
261
-     * @param array    $model_query_params
262
-     * @param array    $querystring_query_params
263
-     * @param EEM_Base $model
264
-     * @return array
265
-     */
266
-    public static function rest_api_query_params($model_query_params, $querystring_query_params, $model)
267
-    {
268
-        if ($model === EEM_Term::instance()) {
269
-            $taxonomies = get_taxonomies(array('show_in_rest' => true));
270
-            if (! empty($taxonomies)) {
271
-                $model_query_params[0]['Term_Taxonomy.taxonomy'] = array('IN', $taxonomies);
272
-            }
273
-        }
274
-        return $model_query_params;
275
-    }
257
+	/**
258
+	 * Makes sure that during REST API queries, we only return terms
259
+	 * for term taxonomies which should be shown in the rest api
260
+	 *
261
+	 * @param array    $model_query_params
262
+	 * @param array    $querystring_query_params
263
+	 * @param EEM_Base $model
264
+	 * @return array
265
+	 */
266
+	public static function rest_api_query_params($model_query_params, $querystring_query_params, $model)
267
+	{
268
+		if ($model === EEM_Term::instance()) {
269
+			$taxonomies = get_taxonomies(array('show_in_rest' => true));
270
+			if (! empty($taxonomies)) {
271
+				$model_query_params[0]['Term_Taxonomy.taxonomy'] = array('IN', $taxonomies);
272
+			}
273
+		}
274
+		return $model_query_params;
275
+	}
276 276
 }
Please login to merge, or discard this patch.
core/domain/services/contexts/RequestTypeContextFactoryInterface.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@
 block discarded – undo
15 15
 interface RequestTypeContextFactoryInterface
16 16
 {
17 17
 
18
-    /**
19
-     * @param string $slug
20
-     * @return RequestTypeContext
21
-     */
22
-    public function create($slug);
18
+	/**
19
+	 * @param string $slug
20
+	 * @return RequestTypeContext
21
+	 */
22
+	public function create($slug);
23 23
 }
Please login to merge, or discard this patch.
core/services/request/middleware/SetRequestTypeContextChecker.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -18,41 +18,41 @@
 block discarded – undo
18 18
 class SetRequestTypeContextChecker extends Middleware
19 19
 {
20 20
 
21
-    /**
22
-     * converts a Request to a Response
23
-     *
24
-     * @param RequestInterface  $request
25
-     * @param ResponseInterface $response
26
-     * @return ResponseInterface
27
-     * @throws InvalidArgumentException
28
-     */
29
-    public function handleRequest(RequestInterface $request, ResponseInterface $response)
30
-    {
31
-        $this->request  = $request;
32
-        $this->response = $response;
33
-        /** @var RequestTypeContextDetector $request_type_context_detector */
34
-        $request_type_context_detector = $this->loader->getShared(
35
-            'EventEspresso\core\domain\services\contexts\RequestTypeContextDetector',
36
-            array(
37
-                $this->request,
38
-                $this->loader->getShared(
39
-                    'EventEspresso\core\domain\services\contexts\RequestTypeContextFactory',
40
-                    array($this->loader)
41
-                ),
42
-                array(
43
-                    'DOING_AJAX' => defined('DOING_AJAX') && DOING_AJAX,
44
-                    'WP_CLI'     => defined('WP_CLI') && WP_CLI,
45
-                    'is_admin'   => is_admin(),
46
-                )
47
-            )
48
-        );
49
-        $request_type_context          = $request_type_context_detector->detectRequestTypeContext();
50
-        $request_type_context_checker  = $this->loader->getShared(
51
-            'EventEspresso\core\domain\services\contexts\RequestTypeContextChecker',
52
-            array($request_type_context)
53
-        );
54
-        $this->request->setRequestTypeContextChecker($request_type_context_checker);
55
-        $this->response = $this->processRequestStack($this->request, $this->response);
56
-        return $this->response;
57
-    }
21
+	/**
22
+	 * converts a Request to a Response
23
+	 *
24
+	 * @param RequestInterface  $request
25
+	 * @param ResponseInterface $response
26
+	 * @return ResponseInterface
27
+	 * @throws InvalidArgumentException
28
+	 */
29
+	public function handleRequest(RequestInterface $request, ResponseInterface $response)
30
+	{
31
+		$this->request  = $request;
32
+		$this->response = $response;
33
+		/** @var RequestTypeContextDetector $request_type_context_detector */
34
+		$request_type_context_detector = $this->loader->getShared(
35
+			'EventEspresso\core\domain\services\contexts\RequestTypeContextDetector',
36
+			array(
37
+				$this->request,
38
+				$this->loader->getShared(
39
+					'EventEspresso\core\domain\services\contexts\RequestTypeContextFactory',
40
+					array($this->loader)
41
+				),
42
+				array(
43
+					'DOING_AJAX' => defined('DOING_AJAX') && DOING_AJAX,
44
+					'WP_CLI'     => defined('WP_CLI') && WP_CLI,
45
+					'is_admin'   => is_admin(),
46
+				)
47
+			)
48
+		);
49
+		$request_type_context          = $request_type_context_detector->detectRequestTypeContext();
50
+		$request_type_context_checker  = $this->loader->getShared(
51
+			'EventEspresso\core\domain\services\contexts\RequestTypeContextChecker',
52
+			array($request_type_context)
53
+		);
54
+		$this->request->setRequestTypeContextChecker($request_type_context_checker);
55
+		$this->response = $this->processRequestStack($this->request, $this->response);
56
+		return $this->response;
57
+	}
58 58
 }
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Country_Select_Input.php 2 patches
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -14,80 +14,80 @@
 block discarded – undo
14 14
  */
15 15
 class EE_Country_Select_Input extends EE_Select_Input
16 16
 {
17
-    /**
18
-     * $input_settings key used for detecting the "get" option
19
-     */
20
-    const OPTION_GET_KEY = 'get';
17
+	/**
18
+	 * $input_settings key used for detecting the "get" option
19
+	 */
20
+	const OPTION_GET_KEY = 'get';
21 21
 
22
-    /**
23
-     * indicates that ALL countries should be retrieved from the db for the input
24
-     */
25
-    const OPTION_GET_ALL = 'all';
22
+	/**
23
+	 * indicates that ALL countries should be retrieved from the db for the input
24
+	 */
25
+	const OPTION_GET_ALL = 'all';
26 26
 
27
-    /**
28
-     * indicates that only ACTIVE countries should be retrieved from the db for the input
29
-     */
30
-    const OPTION_GET_ACTIVE = 'active';
27
+	/**
28
+	 * indicates that only ACTIVE countries should be retrieved from the db for the input
29
+	 */
30
+	const OPTION_GET_ACTIVE = 'active';
31 31
 
32 32
 
33
-    /**
34
-     * @param array $country_options
35
-     * @param array $input_settings
36
-     * @throws EE_Error
37
-     * @throws InvalidArgumentException
38
-     * @throws InvalidDataTypeException
39
-     * @throws InvalidInterfaceException
40
-     * @throws ReflectionException
41
-     */
42
-    public function __construct($country_options = null, $input_settings = array())
43
-    {
44
-        $get = isset($input_settings[ self::OPTION_GET_KEY ])
45
-            ? $input_settings[ self::OPTION_GET_KEY ]
46
-            : self::OPTION_GET_ACTIVE;
47
-        $country_options = apply_filters(
48
-            'FHEE__EE_Country_Select_Input____construct__country_options',
49
-            $this->get_country_answer_options($country_options, $get),
50
-            $this,
51
-            $get
52
-        );
53
-        $input_settings['html_class'] = isset($input_settings['html_class'])
54
-            ? $input_settings['html_class'] . ' ee-country-select-js'
55
-            : 'ee-country-select-js';
56
-        parent::__construct($country_options, $input_settings);
57
-    }
33
+	/**
34
+	 * @param array $country_options
35
+	 * @param array $input_settings
36
+	 * @throws EE_Error
37
+	 * @throws InvalidArgumentException
38
+	 * @throws InvalidDataTypeException
39
+	 * @throws InvalidInterfaceException
40
+	 * @throws ReflectionException
41
+	 */
42
+	public function __construct($country_options = null, $input_settings = array())
43
+	{
44
+		$get = isset($input_settings[ self::OPTION_GET_KEY ])
45
+			? $input_settings[ self::OPTION_GET_KEY ]
46
+			: self::OPTION_GET_ACTIVE;
47
+		$country_options = apply_filters(
48
+			'FHEE__EE_Country_Select_Input____construct__country_options',
49
+			$this->get_country_answer_options($country_options, $get),
50
+			$this,
51
+			$get
52
+		);
53
+		$input_settings['html_class'] = isset($input_settings['html_class'])
54
+			? $input_settings['html_class'] . ' ee-country-select-js'
55
+			: 'ee-country-select-js';
56
+		parent::__construct($country_options, $input_settings);
57
+	}
58 58
 
59 59
 
60
-    /**
61
-     * get_country_answer_options
62
-     *
63
-     * @param array  $country_options
64
-     * @param string $get
65
-     * @return array
66
-     * @throws EE_Error
67
-     * @throws InvalidArgumentException
68
-     * @throws ReflectionException
69
-     * @throws InvalidDataTypeException
70
-     * @throws InvalidInterfaceException
71
-     */
72
-    public function get_country_answer_options($country_options = null, $get = self::OPTION_GET_ACTIVE)
73
-    {
74
-        // if passed something that is NOT an array
75
-        if (! is_array($country_options)) {
76
-            // get possibly cached list of countries
77
-            $countries = $get === self::OPTION_GET_ALL
78
-                ? EEM_Country::instance()->get_all_countries()
79
-                : EEM_Country::instance()->get_all_active_countries();
80
-            if (! empty($countries)) {
81
-                $country_options[''] = '';
82
-                foreach ($countries as $country) {
83
-                    if ($country instanceof EE_Country) {
84
-                        $country_options[ $country->ID() ] = $country->name();
85
-                    }
86
-                }
87
-            } else {
88
-                $country_options = array();
89
-            }
90
-        }
91
-        return $country_options;
92
-    }
60
+	/**
61
+	 * get_country_answer_options
62
+	 *
63
+	 * @param array  $country_options
64
+	 * @param string $get
65
+	 * @return array
66
+	 * @throws EE_Error
67
+	 * @throws InvalidArgumentException
68
+	 * @throws ReflectionException
69
+	 * @throws InvalidDataTypeException
70
+	 * @throws InvalidInterfaceException
71
+	 */
72
+	public function get_country_answer_options($country_options = null, $get = self::OPTION_GET_ACTIVE)
73
+	{
74
+		// if passed something that is NOT an array
75
+		if (! is_array($country_options)) {
76
+			// get possibly cached list of countries
77
+			$countries = $get === self::OPTION_GET_ALL
78
+				? EEM_Country::instance()->get_all_countries()
79
+				: EEM_Country::instance()->get_all_active_countries();
80
+			if (! empty($countries)) {
81
+				$country_options[''] = '';
82
+				foreach ($countries as $country) {
83
+					if ($country instanceof EE_Country) {
84
+						$country_options[ $country->ID() ] = $country->name();
85
+					}
86
+				}
87
+			} else {
88
+				$country_options = array();
89
+			}
90
+		}
91
+		return $country_options;
92
+	}
93 93
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function __construct($country_options = null, $input_settings = array())
43 43
     {
44
-        $get = isset($input_settings[ self::OPTION_GET_KEY ])
45
-            ? $input_settings[ self::OPTION_GET_KEY ]
44
+        $get = isset($input_settings[self::OPTION_GET_KEY])
45
+            ? $input_settings[self::OPTION_GET_KEY]
46 46
             : self::OPTION_GET_ACTIVE;
47 47
         $country_options = apply_filters(
48 48
             'FHEE__EE_Country_Select_Input____construct__country_options',
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
             $get
52 52
         );
53 53
         $input_settings['html_class'] = isset($input_settings['html_class'])
54
-            ? $input_settings['html_class'] . ' ee-country-select-js'
54
+            ? $input_settings['html_class'].' ee-country-select-js'
55 55
             : 'ee-country-select-js';
56 56
         parent::__construct($country_options, $input_settings);
57 57
     }
@@ -72,16 +72,16 @@  discard block
 block discarded – undo
72 72
     public function get_country_answer_options($country_options = null, $get = self::OPTION_GET_ACTIVE)
73 73
     {
74 74
         // if passed something that is NOT an array
75
-        if (! is_array($country_options)) {
75
+        if ( ! is_array($country_options)) {
76 76
             // get possibly cached list of countries
77 77
             $countries = $get === self::OPTION_GET_ALL
78 78
                 ? EEM_Country::instance()->get_all_countries()
79 79
                 : EEM_Country::instance()->get_all_active_countries();
80
-            if (! empty($countries)) {
80
+            if ( ! empty($countries)) {
81 81
                 $country_options[''] = '';
82 82
                 foreach ($countries as $country) {
83 83
                     if ($country instanceof EE_Country) {
84
-                        $country_options[ $country->ID() ] = $country->name();
84
+                        $country_options[$country->ID()] = $country->name();
85 85
                     }
86 86
                 }
87 87
             } else {
Please login to merge, or discard this patch.