Completed
Branch update-venue-ui (4b9c7e)
by
unknown
02:27
created
core/domain/services/graphql/enums/TicketStatusEnum.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
      */
22 22
     public function __construct()
23 23
     {
24
-        $this->setName($this->namespace . 'TicketStatusEnum');
24
+        $this->setName($this->namespace.'TicketStatusEnum');
25 25
         $this->setDescription(esc_html__('Whether the ticket is On Sale, Pending, or Expired', 'event_espresso'));
26 26
         parent::__construct();
27 27
     }
Please login to merge, or discard this patch.
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -16,38 +16,38 @@
 block discarded – undo
16 16
 class TicketStatusEnum extends EnumBase
17 17
 {
18 18
 
19
-    /**
20
-     * TicketStatusEnum constructor.
21
-     */
22
-    public function __construct()
23
-    {
24
-        $this->setName($this->namespace . 'TicketStatusEnum');
25
-        $this->setDescription(esc_html__('Whether the ticket is On Sale, Pending, or Expired', 'event_espresso'));
26
-        parent::__construct();
27
-    }
19
+	/**
20
+	 * TicketStatusEnum constructor.
21
+	 */
22
+	public function __construct()
23
+	{
24
+		$this->setName($this->namespace . 'TicketStatusEnum');
25
+		$this->setDescription(esc_html__('Whether the ticket is On Sale, Pending, or Expired', 'event_espresso'));
26
+		parent::__construct();
27
+	}
28 28
 
29 29
 
30
-    /**
31
-     * @return array
32
-     */
33
-    protected function getValues(): array
34
-    {
35
-        return [
36
-            'SOLD_OUT'     => [
37
-                'value'       => EE_Ticket::sold_out,
38
-            ],
39
-            'EXPIRED'     => [
40
-                'value'       => EE_Ticket::expired,
41
-            ],
42
-            'ARCHIVED'     => [
43
-                'value'       => EE_Ticket::archived,
44
-            ],
45
-            'PENDING'     => [
46
-                'value'       => EE_Ticket::pending,
47
-            ],
48
-            'ONSALE'     => [
49
-                'value'       => EE_Ticket::onsale,
50
-            ],
51
-        ];
52
-    }
30
+	/**
31
+	 * @return array
32
+	 */
33
+	protected function getValues(): array
34
+	{
35
+		return [
36
+			'SOLD_OUT'     => [
37
+				'value'       => EE_Ticket::sold_out,
38
+			],
39
+			'EXPIRED'     => [
40
+				'value'       => EE_Ticket::expired,
41
+			],
42
+			'ARCHIVED'     => [
43
+				'value'       => EE_Ticket::archived,
44
+			],
45
+			'PENDING'     => [
46
+				'value'       => EE_Ticket::pending,
47
+			],
48
+			'ONSALE'     => [
49
+				'value'       => EE_Ticket::onsale,
50
+			],
51
+		];
52
+	}
53 53
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/enums/DatetimeStatusEnum.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
      */
22 22
     public function __construct()
23 23
     {
24
-        $this->setName($this->namespace . 'DatetimeStatusEnum');
24
+        $this->setName($this->namespace.'DatetimeStatusEnum');
25 25
         $this->setDescription(esc_html__('Datetime status', 'event_espresso'));
26 26
         parent::__construct();
27 27
     }
Please login to merge, or discard this patch.
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -16,44 +16,44 @@
 block discarded – undo
16 16
 class DatetimeStatusEnum extends EnumBase
17 17
 {
18 18
 
19
-    /**
20
-     * DatetimeStatusEnum constructor.
21
-     */
22
-    public function __construct()
23
-    {
24
-        $this->setName($this->namespace . 'DatetimeStatusEnum');
25
-        $this->setDescription(esc_html__('Datetime status', 'event_espresso'));
26
-        parent::__construct();
27
-    }
19
+	/**
20
+	 * DatetimeStatusEnum constructor.
21
+	 */
22
+	public function __construct()
23
+	{
24
+		$this->setName($this->namespace . 'DatetimeStatusEnum');
25
+		$this->setDescription(esc_html__('Datetime status', 'event_espresso'));
26
+		parent::__construct();
27
+	}
28 28
 
29 29
 
30
-    /**
31
-     * @return array
32
-     */
33
-    protected function getValues(): array
34
-    {
35
-        return [
36
-            'SOLD_OUT'     => [
37
-                'value'       => EE_Datetime::sold_out,
38
-            ],
39
-            'ACTIVE'     => [
40
-                'value'       => EE_Datetime::active,
41
-            ],
42
-            'UPCOMING'     => [
43
-                'value'       => EE_Datetime::upcoming,
44
-            ],
45
-            'POSTPONED'     => [
46
-                'value'       => EE_Datetime::postponed,
47
-            ],
48
-            'CANCELLED'     => [
49
-                'value'       => EE_Datetime::cancelled,
50
-            ],
51
-            'EXPIRED'     => [
52
-                'value'       => EE_Datetime::expired,
53
-            ],
54
-            'INACTIVE'     => [
55
-                'value'       => EE_Datetime::inactive,
56
-            ],
57
-        ];
58
-    }
30
+	/**
31
+	 * @return array
32
+	 */
33
+	protected function getValues(): array
34
+	{
35
+		return [
36
+			'SOLD_OUT'     => [
37
+				'value'       => EE_Datetime::sold_out,
38
+			],
39
+			'ACTIVE'     => [
40
+				'value'       => EE_Datetime::active,
41
+			],
42
+			'UPCOMING'     => [
43
+				'value'       => EE_Datetime::upcoming,
44
+			],
45
+			'POSTPONED'     => [
46
+				'value'       => EE_Datetime::postponed,
47
+			],
48
+			'CANCELLED'     => [
49
+				'value'       => EE_Datetime::cancelled,
50
+			],
51
+			'EXPIRED'     => [
52
+				'value'       => EE_Datetime::expired,
53
+			],
54
+			'INACTIVE'     => [
55
+				'value'       => EE_Datetime::inactive,
56
+			],
57
+		];
58
+	}
59 59
 }
Please login to merge, or discard this patch.
admin_pages/events/templates/event_preview_deletion.template.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -1,97 +1,97 @@
 block discarded – undo
1 1
 <h2><?php esc_html_e('Please Confirm You Want to Permanently Delete the Following Data', 'event_espresso'); ?></h2>
2 2
 <h3>
3 3
     <?php
4
-    printf(
5
-        esc_html(
6
-            // translators: 1: number of events
7
-            _n('%1$d Event', '%1$d Events', count($events), 'event_espresso')
8
-        ),
9
-        count($events)
10
-    );
11
-    ?>
4
+	printf(
5
+		esc_html(
6
+			// translators: 1: number of events
7
+			_n('%1$d Event', '%1$d Events', count($events), 'event_espresso')
8
+		),
9
+		count($events)
10
+	);
11
+	?>
12 12
 </h3>
13 13
 <ul>
14 14
     <?php
15
-    foreach ($events as $event) {
16
-        ?>
15
+	foreach ($events as $event) {
16
+		?>
17 17
         <li>
18 18
             <?php echo $event->name(); ?>
19 19
         </li>
20 20
         <?php
21
-    }
22
-    ?>
21
+	}
22
+	?>
23 23
 </ul>
24 24
 <h3>
25 25
     <?php
26
-    printf(
27
-        esc_html(
28
-            // translators: 1: number of datetimes
29
-            _n('%1$d Datetime', '%1$d Datetimes', count($datetimes), 'event_espresso')
30
-        ),
31
-        count($datetimes)
32
-    );
33
-    ?>
26
+	printf(
27
+		esc_html(
28
+			// translators: 1: number of datetimes
29
+			_n('%1$d Datetime', '%1$d Datetimes', count($datetimes), 'event_espresso')
30
+		),
31
+		count($datetimes)
32
+	);
33
+	?>
34 34
 </h3>
35 35
 <ul>
36 36
     <?php
37
-    foreach ($datetimes as $datetime) {
38
-        ?>
37
+	foreach ($datetimes as $datetime) {
38
+		?>
39 39
         <li>
40 40
             <?php echo $datetime->get_dtt_display_name(true); ?>
41 41
         </li>
42 42
         <?php
43
-    }
44
-    ?>
43
+	}
44
+	?>
45 45
 </ul>
46 46
 <h3>
47 47
     <?php
48
-    printf(
49
-        esc_html(
50
-            _n('%1$d Registration', '%1$d Registrations', $reg_count, 'event_espresso')
51
-        ),
52
-        $reg_count
53
-    );
54
-    ?>
48
+	printf(
49
+		esc_html(
50
+			_n('%1$d Registration', '%1$d Registrations', $reg_count, 'event_espresso')
51
+		),
52
+		$reg_count
53
+	);
54
+	?>
55 55
 </h3>
56 56
 <?php
57 57
 if ($reg_count > count($registrations)) {
58
-    ?>
58
+	?>
59 59
     <p class="notice">
60 60
         <?php
61
-        printf(
62
-            esc_html__('Only showing first %1$d.', 'event_espresso'),
63
-            count($registrations)
64
-        );
65
-        ?>
61
+		printf(
62
+			esc_html__('Only showing first %1$d.', 'event_espresso'),
63
+			count($registrations)
64
+		);
65
+		?>
66 66
     </p>
67 67
     <?php
68 68
 }
69 69
 ?>
70 70
 <?php
71 71
 if ($reg_count > 0) {
72
-    ?>
72
+	?>
73 73
     <p><?php esc_html_e('Note: contacts will not be deleted, only their registrations for the enumerated events.', 'event_espresso'); ?></p>
74 74
     <?php
75 75
 }
76 76
 ?>
77 77
 <ul>
78 78
     <?php
79
-    foreach ($registrations as $registration) {
80
-        ?>
79
+	foreach ($registrations as $registration) {
80
+		?>
81 81
         <li>
82 82
             <?php
83
-            printf(
84
-                esc_html(
85
-                    _x('%1$s (%2$d of %3$d)', 'Registration name (number of count)', 'event_espresso')
86
-                ),
87
-                $registration->attendeeName(true),
88
-                $registration->count(),
89
-                $registration->group_size()
90
-            ); ?>
83
+			printf(
84
+				esc_html(
85
+					_x('%1$s (%2$d of %3$d)', 'Registration name (number of count)', 'event_espresso')
86
+				),
87
+				$registration->attendeeName(true),
88
+				$registration->count(),
89
+				$registration->group_size()
90
+			); ?>
91 91
         </li>
92 92
         <?php
93
-    }
94
-    ?>
93
+	}
94
+	?>
95 95
 </ul>
96 96
 <form action="<?php echo $form_url; ?>" method="POST">
97 97
     <?php echo $form->get_html_and_js(); ?>
Please login to merge, or discard this patch.
admin_pages/events/form_sections/ConfirmEventDeletionForm.php 2 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -22,55 +22,55 @@
 block discarded – undo
22 22
  */
23 23
 class ConfirmEventDeletionForm extends \EE_Form_Section_Proper
24 24
 {
25
-    /**
26
-     * @var EE_Event[]
27
-     */
28
-    protected $events;
29
-    public function __construct($event_ids, $options_array = array())
30
-    {
31
-        if (! isset($options_array['subsections'])) {
32
-            $options_array['subsections'] = [];
33
-        }
34
-        if (! isset($options_array['subsections']['events'])) {
35
-            $events_subsection = new \EE_Form_Section_Proper();
36
-            $options_array['subsections']['events'] = $events_subsection;
37
-        }
38
-        $events = EEM_Event::instance()->get_all_deleted_and_undeleted(
39
-            [
40
-                [
41
-                    'EVT_ID' => ['IN',$event_ids]
42
-                ]
43
-            ]
44
-        );
45
-        if (! is_array($events)) {
46
-            throw new UnexpectedEntityException($event_ids, 'array');
47
-        }
48
-        $this->events = $events;
49
-        $events_inputs = [
50
-        ];
51
-        foreach ($events as $event) {
52
-            $events_inputs[ $event->ID() ] = new EE_Checkbox_Multi_Input(
53
-                [
54
-                    'yes' => $event->name(),
55
-                ],
56
-                [
57
-                    'html_label_text' => esc_html__('Please confirm you wish to delete:', 'event_espresso'),
58
-                    'required' => true
59
-                ]
60
-            );
61
-        }
62
-        $events_subsection->add_subsections($events_inputs);
63
-        $options_array['subsections']['backup'] = new EE_Checkbox_Multi_Input(
64
-            [
65
-                'yes' => esc_html__('I have backed up my database.', 'event_espresso')
66
-            ],
67
-            [
68
-                'html_label_text' => esc_html__('Deleting this data cannot be undone. Please confirm you have a usable database backup.', 'event_espresso'),
69
-                'required' => true
70
-            ]
71
-        );
72
-        parent::__construct($options_array);
73
-    }
25
+	/**
26
+	 * @var EE_Event[]
27
+	 */
28
+	protected $events;
29
+	public function __construct($event_ids, $options_array = array())
30
+	{
31
+		if (! isset($options_array['subsections'])) {
32
+			$options_array['subsections'] = [];
33
+		}
34
+		if (! isset($options_array['subsections']['events'])) {
35
+			$events_subsection = new \EE_Form_Section_Proper();
36
+			$options_array['subsections']['events'] = $events_subsection;
37
+		}
38
+		$events = EEM_Event::instance()->get_all_deleted_and_undeleted(
39
+			[
40
+				[
41
+					'EVT_ID' => ['IN',$event_ids]
42
+				]
43
+			]
44
+		);
45
+		if (! is_array($events)) {
46
+			throw new UnexpectedEntityException($event_ids, 'array');
47
+		}
48
+		$this->events = $events;
49
+		$events_inputs = [
50
+		];
51
+		foreach ($events as $event) {
52
+			$events_inputs[ $event->ID() ] = new EE_Checkbox_Multi_Input(
53
+				[
54
+					'yes' => $event->name(),
55
+				],
56
+				[
57
+					'html_label_text' => esc_html__('Please confirm you wish to delete:', 'event_espresso'),
58
+					'required' => true
59
+				]
60
+			);
61
+		}
62
+		$events_subsection->add_subsections($events_inputs);
63
+		$options_array['subsections']['backup'] = new EE_Checkbox_Multi_Input(
64
+			[
65
+				'yes' => esc_html__('I have backed up my database.', 'event_espresso')
66
+			],
67
+			[
68
+				'html_label_text' => esc_html__('Deleting this data cannot be undone. Please confirm you have a usable database backup.', 'event_espresso'),
69
+				'required' => true
70
+			]
71
+		);
72
+		parent::__construct($options_array);
73
+	}
74 74
 }
75 75
 // End of file ConfirmEventDeletionForm.php
76 76
 // Location: EventEspresso\admin_pages\events\form_sections/ConfirmEventDeletionForm.php
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,28 +28,28 @@
 block discarded – undo
28 28
     protected $events;
29 29
     public function __construct($event_ids, $options_array = array())
30 30
     {
31
-        if (! isset($options_array['subsections'])) {
31
+        if ( ! isset($options_array['subsections'])) {
32 32
             $options_array['subsections'] = [];
33 33
         }
34
-        if (! isset($options_array['subsections']['events'])) {
34
+        if ( ! isset($options_array['subsections']['events'])) {
35 35
             $events_subsection = new \EE_Form_Section_Proper();
36 36
             $options_array['subsections']['events'] = $events_subsection;
37 37
         }
38 38
         $events = EEM_Event::instance()->get_all_deleted_and_undeleted(
39 39
             [
40 40
                 [
41
-                    'EVT_ID' => ['IN',$event_ids]
41
+                    'EVT_ID' => ['IN', $event_ids]
42 42
                 ]
43 43
             ]
44 44
         );
45
-        if (! is_array($events)) {
45
+        if ( ! is_array($events)) {
46 46
             throw new UnexpectedEntityException($event_ids, 'array');
47 47
         }
48 48
         $this->events = $events;
49 49
         $events_inputs = [
50 50
         ];
51 51
         foreach ($events as $event) {
52
-            $events_inputs[ $event->ID() ] = new EE_Checkbox_Multi_Input(
52
+            $events_inputs[$event->ID()] = new EE_Checkbox_Multi_Input(
53 53
                 [
54 54
                     'yes' => $event->name(),
55 55
                 ],
Please login to merge, or discard this patch.
modules/ical/EED_Ical.module.php 2 patches
Indentation   +237 added lines, -237 removed lines patch added patch discarded remove patch
@@ -11,241 +11,241 @@
 block discarded – undo
11 11
 class EED_Ical extends EED_Module
12 12
 {
13 13
 
14
-    const iCal_datetime_format = 'Ymd\THis\Z';
15
-
16
-
17
-    /**
18
-     * @return EED_Ical|EED_Module
19
-     */
20
-    public static function instance()
21
-    {
22
-        return parent::get_instance(__CLASS__);
23
-    }
24
-
25
-
26
-    /**
27
-     *    set_hooks - for hooking into EE Core, other modules, etc
28
-     *
29
-     * @access    public
30
-     * @return    void
31
-     */
32
-    public static function set_hooks()
33
-    {
34
-        // create download buttons
35
-        add_filter(
36
-            'FHEE__espresso_list_of_event_dates__datetime_html',
37
-            array('EED_Ical', 'generate_add_to_iCal_button'),
38
-            10,
39
-            2
40
-        );
41
-        // process ics download request
42
-        EE_Config::register_route('download_ics_file', 'EED_Ical', 'download_ics_file');
43
-    }
44
-
45
-
46
-    /**
47
-     *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
48
-     *
49
-     * @access    public
50
-     * @return    void
51
-     */
52
-    public static function set_hooks_admin()
53
-    {
54
-    }
55
-
56
-
57
-    /**
58
-     *    run - initial module setup
59
-     *
60
-     * @access    public
61
-     * @param    WP $WP
62
-     * @return    void
63
-     */
64
-    public function run($WP)
65
-    {
66
-    }
67
-
68
-
69
-    /**
70
-     *    generate_add_to_iCal_button
71
-     *
72
-     * @access    public
73
-     * @param $html
74
-     * @param $datetime
75
-     * @return    string
76
-     * @throws \EE_Error
77
-     */
78
-    public static function generate_add_to_iCal_button($html, $datetime)
79
-    {
80
-        // first verify a proper datetime object has been received
81
-        if ($datetime instanceof EE_Datetime) {
82
-            // set whether a link or submit button is shown
83
-            $iCal_type = apply_filters('FHEE__EED_Ical__generate_add_to_iCal_button__iCal_type', 'submit');
84
-            // generate a link to the route we registered in set_hooks()
85
-            $URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $datetime->ID()), site_url());
86
-            // what type ?
87
-            switch ($iCal_type) {
88
-                // submit buttons appear as buttons and are very compatible with a theme's style
89
-                case 'submit':
90
-                    $html .= '<form id="download-iCal-frm-' . $datetime->ID();
91
-                    $html .= '" class="download-iCal-frm" action="' . $URL . '" method="post" >';
92
-                    $html .= '<input type="submit" class="ee-ical-sbmt" value="&#xf145;" title="';
93
-                    $html .= esc_html__('Add to iCal Calendar', 'event_espresso') . '"/>';
94
-                    $html .= '</form>';
95
-                    break;
96
-                // buttons are just links that have been styled to appear as buttons,
97
-                // but may not be blend with a theme as well as submit buttons
98
-                case 'button':
99
-                    $html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="' . $URL;
100
-                    $html .= '" title="' . esc_html__('Add to iCal Calendar', 'event_espresso') . '">';
101
-                    $html .= ' <span class="dashicons dashicons-calendar"></span>';
102
-                    $html .= '</a>';
103
-                    break;
104
-                // links are just links that use the calendar dashicon
105
-                case 'icon':
106
-                    $html .= '<a class="ee-ical-lnk" href="' . $URL . '" title="';
107
-                    $html .= esc_html__('Add to iCal Calendar', 'event_espresso') . '">';
108
-                    $html .= ' <span class="dashicons dashicons-calendar"></span>';
109
-                    $html .= '</a>';
110
-                    break;
111
-            }
112
-        }
113
-        return $html;
114
-    }
115
-
116
-
117
-    /**
118
-     *    download_ics_file
119
-     *
120
-     * @access    public
121
-     * @return    void
122
-     * @throws \EE_Error
123
-     */
124
-    public static function download_ics_file()
125
-    {
126
-        if (EE_Registry::instance()->REQ->is_set('ics_id')) {
127
-            $DTT_ID = absint(EE_Registry::instance()->REQ->get('ics_id'));
128
-            $datetime = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($DTT_ID);
129
-            if ($datetime instanceof EE_Datetime) {
130
-                // get related event, venues, and event categories
131
-                $event = $datetime->event();
132
-                if ($event instanceof EE_Event) {
133
-                    // get related category Term object and it's name
134
-                    $category = $event->first_event_category();
135
-                    if ($category instanceof EE_Term) {
136
-                        $category = $category->name();
137
-                    }
138
-                    $location = '';
139
-                    // get first related venue and convert to CSV string
140
-                    $venue = $event->venues(array('limit' => 1));
141
-                    if (is_array($venue) && ! empty($venue)) {
142
-                        $venue = array_shift($venue);
143
-                        if ($venue instanceof EE_Venue) {
144
-                            $location = espresso_venue_raw_address('inline', $venue->ID(), false);
145
-                        }
146
-                    }
147
-
148
-                    // Generate filename
149
-                    $filename = $event->slug() . '-' . $datetime->start_date('Y-m-d') . '.ics';
150
-
151
-                    // Check the datetime status has not been cancelled and set the ics value accordingly
152
-                    $status = $datetime->get_active_status();
153
-                    $status = $status === EE_Datetime::cancelled ? 'CANCELLED' : 'CONFIRMED';
154
-
155
-                    // Create array of ics details, escape strings, convert timestamps to ics format, etc
156
-                    $ics_data = array(
157
-                        'ORGANIZER_NAME' => EE_Registry::instance()->CFG->organization->name,
158
-                        'UID'            => md5($event->name() . $event->ID() . $datetime->ID()),
159
-                        'ORGANIZER'      => EE_Registry::instance()->CFG->organization->email,
160
-                        'DTSTAMP'        => date(EED_Ical::iCal_datetime_format),
161
-                        'LOCATION'       => $location,
162
-                        'SUMMARY'        => $event->name(),
163
-                        'DESCRIPTION'    => wp_strip_all_tags($event->description()),
164
-                        'STATUS'         => $status,
165
-                        'CATEGORIES'     => $category,
166
-                        'URL;VALUE=URI'  => get_permalink($event->ID()),
167
-                        'DTSTART'        => date(EED_Ical::iCal_datetime_format, $datetime->start()),
168
-                        'DTEND'          => date(EED_Ical::iCal_datetime_format, $datetime->end()),
169
-                    );
170
-
171
-                    // Filter the values used within the ics output.
172
-                    // NOTE - all values within ics_data will be escaped automatically.
173
-                    $ics_data = apply_filters('FHEE__EED_Ical__download_ics_file_ics_data', $ics_data, $datetime);
174
-
175
-                    // Escape all ics data
176
-                    foreach ($ics_data as $key => $value) {
177
-                        // Description is escaped differently from all all values
178
-                        if ($key === 'DESCRIPTION') {
179
-                            $ics_data[ $key ] = EED_Ical::_escape_ICal_description(wp_strip_all_tags($value));
180
-                        } else {
181
-                            $ics_data[ $key ] = EED_Ical::_escape_ICal_data($value);
182
-                        }
183
-                    }
184
-
185
-                    // Pull the organizer name from ics_data and remove it from the array.
186
-                    $organizer_name = isset($ics_data['ORGANIZER_NAME']) ? $ics_data['ORGANIZER_NAME'] : '';
187
-                    unset($ics_data['ORGANIZER_NAME']);
188
-
189
-                    // set headers
190
-                    header('Content-type: text/calendar; charset=utf-8');
191
-                    header('Content-Disposition: attachment; filename="' . $filename . '"');
192
-                    header('Cache-Control: private, max-age=0, must-revalidate');
193
-                    header('Pragma: public');
194
-                    header('Content-Type: application/octet-stream');
195
-                    header('Content-Type: application/force-download');
196
-                    header('Cache-Control: no-cache, must-revalidate');
197
-                    header('Content-Transfer-Encoding: binary');
198
-                    header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // past date
199
-                    ini_set('zlib.output_compression', '0');
200
-                    // echo the output
201
-                    echo "BEGIN:VCALENDAR\r\n";
202
-                    echo "VERSION:2.0\r\n";
203
-                    echo "PRODID:-//{$organizer_name}//NONSGML PDA Calendar Version 1.0//EN\r\n";
204
-                    echo "CALSCALE:GREGORIAN\r\n";
205
-                    echo "BEGIN:VEVENT\r\n";
206
-
207
-                    // Output all remaining values from ics_data.
208
-                    foreach ($ics_data as $key => $value) {
209
-                        echo $key . ':' . $value . "\r\n";
210
-                    }
211
-
212
-                    echo "END:VEVENT\r\n";
213
-                    echo "END:VCALENDAR\r\n";
214
-                }
215
-            }
216
-        }
217
-        die();
218
-    }
219
-
220
-
221
-    /**
222
-     *    _escape_ICal_data
223
-     *
224
-     * @access    private
225
-     * @param    string $string
226
-     * @return    string
227
-     */
228
-    private static function _escape_ICal_data($string = '')
229
-    {
230
-        return preg_replace('/([\,;])/', '\\\$1', $string);
231
-    }
232
-
233
-    /**
234
-     *    _escape_ICal_description
235
-     *
236
-     * @access    private
237
-     * @param    string $description
238
-     * @return    string
239
-     */
240
-    private static function _escape_ICal_description($description = '')
241
-    {
242
-
243
-        // Escape special chars within the description
244
-        $description = EED_Ical::_escape_ICal_data($description);
245
-
246
-        // Remove line breaks and output in iCal format
247
-        $description = str_replace(array("\r\n", "\n"), '\n', $description);
248
-
249
-        return $description;
250
-    }
14
+	const iCal_datetime_format = 'Ymd\THis\Z';
15
+
16
+
17
+	/**
18
+	 * @return EED_Ical|EED_Module
19
+	 */
20
+	public static function instance()
21
+	{
22
+		return parent::get_instance(__CLASS__);
23
+	}
24
+
25
+
26
+	/**
27
+	 *    set_hooks - for hooking into EE Core, other modules, etc
28
+	 *
29
+	 * @access    public
30
+	 * @return    void
31
+	 */
32
+	public static function set_hooks()
33
+	{
34
+		// create download buttons
35
+		add_filter(
36
+			'FHEE__espresso_list_of_event_dates__datetime_html',
37
+			array('EED_Ical', 'generate_add_to_iCal_button'),
38
+			10,
39
+			2
40
+		);
41
+		// process ics download request
42
+		EE_Config::register_route('download_ics_file', 'EED_Ical', 'download_ics_file');
43
+	}
44
+
45
+
46
+	/**
47
+	 *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
48
+	 *
49
+	 * @access    public
50
+	 * @return    void
51
+	 */
52
+	public static function set_hooks_admin()
53
+	{
54
+	}
55
+
56
+
57
+	/**
58
+	 *    run - initial module setup
59
+	 *
60
+	 * @access    public
61
+	 * @param    WP $WP
62
+	 * @return    void
63
+	 */
64
+	public function run($WP)
65
+	{
66
+	}
67
+
68
+
69
+	/**
70
+	 *    generate_add_to_iCal_button
71
+	 *
72
+	 * @access    public
73
+	 * @param $html
74
+	 * @param $datetime
75
+	 * @return    string
76
+	 * @throws \EE_Error
77
+	 */
78
+	public static function generate_add_to_iCal_button($html, $datetime)
79
+	{
80
+		// first verify a proper datetime object has been received
81
+		if ($datetime instanceof EE_Datetime) {
82
+			// set whether a link or submit button is shown
83
+			$iCal_type = apply_filters('FHEE__EED_Ical__generate_add_to_iCal_button__iCal_type', 'submit');
84
+			// generate a link to the route we registered in set_hooks()
85
+			$URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $datetime->ID()), site_url());
86
+			// what type ?
87
+			switch ($iCal_type) {
88
+				// submit buttons appear as buttons and are very compatible with a theme's style
89
+				case 'submit':
90
+					$html .= '<form id="download-iCal-frm-' . $datetime->ID();
91
+					$html .= '" class="download-iCal-frm" action="' . $URL . '" method="post" >';
92
+					$html .= '<input type="submit" class="ee-ical-sbmt" value="&#xf145;" title="';
93
+					$html .= esc_html__('Add to iCal Calendar', 'event_espresso') . '"/>';
94
+					$html .= '</form>';
95
+					break;
96
+				// buttons are just links that have been styled to appear as buttons,
97
+				// but may not be blend with a theme as well as submit buttons
98
+				case 'button':
99
+					$html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="' . $URL;
100
+					$html .= '" title="' . esc_html__('Add to iCal Calendar', 'event_espresso') . '">';
101
+					$html .= ' <span class="dashicons dashicons-calendar"></span>';
102
+					$html .= '</a>';
103
+					break;
104
+				// links are just links that use the calendar dashicon
105
+				case 'icon':
106
+					$html .= '<a class="ee-ical-lnk" href="' . $URL . '" title="';
107
+					$html .= esc_html__('Add to iCal Calendar', 'event_espresso') . '">';
108
+					$html .= ' <span class="dashicons dashicons-calendar"></span>';
109
+					$html .= '</a>';
110
+					break;
111
+			}
112
+		}
113
+		return $html;
114
+	}
115
+
116
+
117
+	/**
118
+	 *    download_ics_file
119
+	 *
120
+	 * @access    public
121
+	 * @return    void
122
+	 * @throws \EE_Error
123
+	 */
124
+	public static function download_ics_file()
125
+	{
126
+		if (EE_Registry::instance()->REQ->is_set('ics_id')) {
127
+			$DTT_ID = absint(EE_Registry::instance()->REQ->get('ics_id'));
128
+			$datetime = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($DTT_ID);
129
+			if ($datetime instanceof EE_Datetime) {
130
+				// get related event, venues, and event categories
131
+				$event = $datetime->event();
132
+				if ($event instanceof EE_Event) {
133
+					// get related category Term object and it's name
134
+					$category = $event->first_event_category();
135
+					if ($category instanceof EE_Term) {
136
+						$category = $category->name();
137
+					}
138
+					$location = '';
139
+					// get first related venue and convert to CSV string
140
+					$venue = $event->venues(array('limit' => 1));
141
+					if (is_array($venue) && ! empty($venue)) {
142
+						$venue = array_shift($venue);
143
+						if ($venue instanceof EE_Venue) {
144
+							$location = espresso_venue_raw_address('inline', $venue->ID(), false);
145
+						}
146
+					}
147
+
148
+					// Generate filename
149
+					$filename = $event->slug() . '-' . $datetime->start_date('Y-m-d') . '.ics';
150
+
151
+					// Check the datetime status has not been cancelled and set the ics value accordingly
152
+					$status = $datetime->get_active_status();
153
+					$status = $status === EE_Datetime::cancelled ? 'CANCELLED' : 'CONFIRMED';
154
+
155
+					// Create array of ics details, escape strings, convert timestamps to ics format, etc
156
+					$ics_data = array(
157
+						'ORGANIZER_NAME' => EE_Registry::instance()->CFG->organization->name,
158
+						'UID'            => md5($event->name() . $event->ID() . $datetime->ID()),
159
+						'ORGANIZER'      => EE_Registry::instance()->CFG->organization->email,
160
+						'DTSTAMP'        => date(EED_Ical::iCal_datetime_format),
161
+						'LOCATION'       => $location,
162
+						'SUMMARY'        => $event->name(),
163
+						'DESCRIPTION'    => wp_strip_all_tags($event->description()),
164
+						'STATUS'         => $status,
165
+						'CATEGORIES'     => $category,
166
+						'URL;VALUE=URI'  => get_permalink($event->ID()),
167
+						'DTSTART'        => date(EED_Ical::iCal_datetime_format, $datetime->start()),
168
+						'DTEND'          => date(EED_Ical::iCal_datetime_format, $datetime->end()),
169
+					);
170
+
171
+					// Filter the values used within the ics output.
172
+					// NOTE - all values within ics_data will be escaped automatically.
173
+					$ics_data = apply_filters('FHEE__EED_Ical__download_ics_file_ics_data', $ics_data, $datetime);
174
+
175
+					// Escape all ics data
176
+					foreach ($ics_data as $key => $value) {
177
+						// Description is escaped differently from all all values
178
+						if ($key === 'DESCRIPTION') {
179
+							$ics_data[ $key ] = EED_Ical::_escape_ICal_description(wp_strip_all_tags($value));
180
+						} else {
181
+							$ics_data[ $key ] = EED_Ical::_escape_ICal_data($value);
182
+						}
183
+					}
184
+
185
+					// Pull the organizer name from ics_data and remove it from the array.
186
+					$organizer_name = isset($ics_data['ORGANIZER_NAME']) ? $ics_data['ORGANIZER_NAME'] : '';
187
+					unset($ics_data['ORGANIZER_NAME']);
188
+
189
+					// set headers
190
+					header('Content-type: text/calendar; charset=utf-8');
191
+					header('Content-Disposition: attachment; filename="' . $filename . '"');
192
+					header('Cache-Control: private, max-age=0, must-revalidate');
193
+					header('Pragma: public');
194
+					header('Content-Type: application/octet-stream');
195
+					header('Content-Type: application/force-download');
196
+					header('Cache-Control: no-cache, must-revalidate');
197
+					header('Content-Transfer-Encoding: binary');
198
+					header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // past date
199
+					ini_set('zlib.output_compression', '0');
200
+					// echo the output
201
+					echo "BEGIN:VCALENDAR\r\n";
202
+					echo "VERSION:2.0\r\n";
203
+					echo "PRODID:-//{$organizer_name}//NONSGML PDA Calendar Version 1.0//EN\r\n";
204
+					echo "CALSCALE:GREGORIAN\r\n";
205
+					echo "BEGIN:VEVENT\r\n";
206
+
207
+					// Output all remaining values from ics_data.
208
+					foreach ($ics_data as $key => $value) {
209
+						echo $key . ':' . $value . "\r\n";
210
+					}
211
+
212
+					echo "END:VEVENT\r\n";
213
+					echo "END:VCALENDAR\r\n";
214
+				}
215
+			}
216
+		}
217
+		die();
218
+	}
219
+
220
+
221
+	/**
222
+	 *    _escape_ICal_data
223
+	 *
224
+	 * @access    private
225
+	 * @param    string $string
226
+	 * @return    string
227
+	 */
228
+	private static function _escape_ICal_data($string = '')
229
+	{
230
+		return preg_replace('/([\,;])/', '\\\$1', $string);
231
+	}
232
+
233
+	/**
234
+	 *    _escape_ICal_description
235
+	 *
236
+	 * @access    private
237
+	 * @param    string $description
238
+	 * @return    string
239
+	 */
240
+	private static function _escape_ICal_description($description = '')
241
+	{
242
+
243
+		// Escape special chars within the description
244
+		$description = EED_Ical::_escape_ICal_data($description);
245
+
246
+		// Remove line breaks and output in iCal format
247
+		$description = str_replace(array("\r\n", "\n"), '\n', $description);
248
+
249
+		return $description;
250
+	}
251 251
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -87,24 +87,24 @@  discard block
 block discarded – undo
87 87
             switch ($iCal_type) {
88 88
                 // submit buttons appear as buttons and are very compatible with a theme's style
89 89
                 case 'submit':
90
-                    $html .= '<form id="download-iCal-frm-' . $datetime->ID();
91
-                    $html .= '" class="download-iCal-frm" action="' . $URL . '" method="post" >';
90
+                    $html .= '<form id="download-iCal-frm-'.$datetime->ID();
91
+                    $html .= '" class="download-iCal-frm" action="'.$URL.'" method="post" >';
92 92
                     $html .= '<input type="submit" class="ee-ical-sbmt" value="&#xf145;" title="';
93
-                    $html .= esc_html__('Add to iCal Calendar', 'event_espresso') . '"/>';
93
+                    $html .= esc_html__('Add to iCal Calendar', 'event_espresso').'"/>';
94 94
                     $html .= '</form>';
95 95
                     break;
96 96
                 // buttons are just links that have been styled to appear as buttons,
97 97
                 // but may not be blend with a theme as well as submit buttons
98 98
                 case 'button':
99
-                    $html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="' . $URL;
100
-                    $html .= '" title="' . esc_html__('Add to iCal Calendar', 'event_espresso') . '">';
99
+                    $html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="'.$URL;
100
+                    $html .= '" title="'.esc_html__('Add to iCal Calendar', 'event_espresso').'">';
101 101
                     $html .= ' <span class="dashicons dashicons-calendar"></span>';
102 102
                     $html .= '</a>';
103 103
                     break;
104 104
                 // links are just links that use the calendar dashicon
105 105
                 case 'icon':
106
-                    $html .= '<a class="ee-ical-lnk" href="' . $URL . '" title="';
107
-                    $html .= esc_html__('Add to iCal Calendar', 'event_espresso') . '">';
106
+                    $html .= '<a class="ee-ical-lnk" href="'.$URL.'" title="';
107
+                    $html .= esc_html__('Add to iCal Calendar', 'event_espresso').'">';
108 108
                     $html .= ' <span class="dashicons dashicons-calendar"></span>';
109 109
                     $html .= '</a>';
110 110
                     break;
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
                     }
147 147
 
148 148
                     // Generate filename
149
-                    $filename = $event->slug() . '-' . $datetime->start_date('Y-m-d') . '.ics';
149
+                    $filename = $event->slug().'-'.$datetime->start_date('Y-m-d').'.ics';
150 150
 
151 151
                     // Check the datetime status has not been cancelled and set the ics value accordingly
152 152
                     $status = $datetime->get_active_status();
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
                     // Create array of ics details, escape strings, convert timestamps to ics format, etc
156 156
                     $ics_data = array(
157 157
                         'ORGANIZER_NAME' => EE_Registry::instance()->CFG->organization->name,
158
-                        'UID'            => md5($event->name() . $event->ID() . $datetime->ID()),
158
+                        'UID'            => md5($event->name().$event->ID().$datetime->ID()),
159 159
                         'ORGANIZER'      => EE_Registry::instance()->CFG->organization->email,
160 160
                         'DTSTAMP'        => date(EED_Ical::iCal_datetime_format),
161 161
                         'LOCATION'       => $location,
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
                     foreach ($ics_data as $key => $value) {
177 177
                         // Description is escaped differently from all all values
178 178
                         if ($key === 'DESCRIPTION') {
179
-                            $ics_data[ $key ] = EED_Ical::_escape_ICal_description(wp_strip_all_tags($value));
179
+                            $ics_data[$key] = EED_Ical::_escape_ICal_description(wp_strip_all_tags($value));
180 180
                         } else {
181
-                            $ics_data[ $key ] = EED_Ical::_escape_ICal_data($value);
181
+                            $ics_data[$key] = EED_Ical::_escape_ICal_data($value);
182 182
                         }
183 183
                     }
184 184
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 
189 189
                     // set headers
190 190
                     header('Content-type: text/calendar; charset=utf-8');
191
-                    header('Content-Disposition: attachment; filename="' . $filename . '"');
191
+                    header('Content-Disposition: attachment; filename="'.$filename.'"');
192 192
                     header('Cache-Control: private, max-age=0, must-revalidate');
193 193
                     header('Pragma: public');
194 194
                     header('Content-Type: application/octet-stream');
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 
207 207
                     // Output all remaining values from ics_data.
208 208
                     foreach ($ics_data as $key => $value) {
209
-                        echo $key . ':' . $value . "\r\n";
209
+                        echo $key.':'.$value."\r\n";
210 210
                     }
211 211
 
212 212
                     echo "END:VEVENT\r\n";
Please login to merge, or discard this patch.
core/admin/templates/espresso_ratings_request_content.template.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <div class="padding">
2 2
     <p><?php
3
-        _e(
4
-            'We need your help to continue maintaining and providing this plugin for free. You can help by leaving a positive review in the WordPress plugin directory. 5 star ratings bring Event Espresso Decaf to the attention of more users which increases our support and features for this version of Event Espresso.',
5
-            'event_espresso'
6
-        ); ?></p>
3
+		_e(
4
+			'We need your help to continue maintaining and providing this plugin for free. You can help by leaving a positive review in the WordPress plugin directory. 5 star ratings bring Event Espresso Decaf to the attention of more users which increases our support and features for this version of Event Espresso.',
5
+			'event_espresso'
6
+		); ?></p>
7 7
     <p><?php _e('Rate it five stars today!', 'event_espresso'); ?></p><span
8 8
         class="ee-wp-blue dashicons dashicons-star-filled"></span><span
9 9
         class="ee-wp-blue dashicons dashicons-star-filled"></span><span
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
         class="ee-wp-blue dashicons dashicons-star-filled"></span>
13 13
     <p><a class="button button-primary"
14 14
           href="https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Fview%2Fplugin-reviews%2Fevent-espresso-decaf%3Frate%3D5%23postform"><?php
15
-            _e(
16
-                'Rate It!',
17
-                'event_espresso'
18
-            ); ?></a></p>
15
+			_e(
16
+				'Rate It!',
17
+				'event_espresso'
18
+			); ?></a></p>
19 19
 </div>
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
line_item_display/EE_Admin_Table_Line_Item_Display_Strategy.strategy.php 2 patches
Indentation   +328 added lines, -328 removed lines patch added patch discarded remove patch
@@ -14,332 +14,332 @@
 block discarded – undo
14 14
 {
15 15
 
16 16
 
17
-    /**
18
-     * whether to display the taxes row or not
19
-     * @type bool $_show_taxes
20
-     */
21
-    protected $_show_taxes = false;
22
-
23
-    /**
24
-     * html for any tax rows
25
-     * @type string $_show_taxes
26
-     */
27
-    protected $_taxes_html = '';
28
-
29
-
30
-    /**
31
-     * total amount including tax we can bill for at this time
32
-     * @type float $_grand_total
33
-     */
34
-    protected $_grand_total = 0.00;
35
-
36
-
37
-
38
-    /**
39
-     * @return float
40
-     */
41
-    public function grand_total()
42
-    {
43
-        return $this->_grand_total;
44
-    }
45
-
46
-
47
-
48
-    /**
49
-     * This is used to output a single
50
-     * @param EE_Line_Item $line_item
51
-     * @param array        $options
52
-     * @return mixed
53
-     */
54
-    public function display_line_item(EE_Line_Item $line_item, $options = array())
55
-    {
56
-
57
-        $html = '';
58
-        // set some default options and merge with incoming
59
-        $default_options = array(
60
-            'odd' => true,
61
-            'use_table_wrapper' => true,
62
-            'table_css_class' => 'admin-primary-mbox-tbl',
63
-            'taxes_tr_css_class' => 'admin-primary-mbox-taxes-tr',
64
-            'total_tr_css_class' => 'admin-primary-mbox-total-tr'
65
-        );
66
-        $options = array_merge($default_options, (array) $options);
67
-
68
-        switch ($line_item->type()) {
69
-            case EEM_Line_Item::type_line_item:
70
-                // item row
71
-                $html .= $this->_item_row($line_item, $options);
72
-                break;
73
-
74
-            case EEM_Line_Item::type_sub_line_item:
75
-                $html .= $this->_sub_item_row($line_item, $options);
76
-                break;
77
-
78
-            case EEM_Line_Item::type_sub_total:
79
-                if ($line_item->quantity() === 0) {
80
-                    return $html;
81
-                }
82
-                // loop through children
83
-                $child_line_items = $line_item->children();
84
-                // loop through children
85
-                foreach ($child_line_items as $child_line_item) {
86
-                    // recursively feed children back into this method
87
-                    $html .= $this->display_line_item($child_line_item, $options);
88
-                }
89
-                $html .= $this->_sub_total_row($line_item, $options);
90
-                break;
91
-
92
-            case EEM_Line_Item::type_tax:
93
-                if ($this->_show_taxes) {
94
-                    $this->_taxes_html .= $this->_tax_row($line_item, $options);
95
-                }
96
-                break;
97
-
98
-            case EEM_Line_Item::type_tax_sub_total:
99
-                foreach ($line_item->children() as $child_line_item) {
100
-                    if ($child_line_item->type() == EEM_Line_Item::type_tax) {
101
-                        $this->display_line_item($child_line_item, $options);
102
-                    }
103
-                }
104
-                break;
105
-
106
-            case EEM_Line_Item::type_total:
107
-                // determine whether to display taxes or not
108
-                $this->_show_taxes = $line_item->get_total_tax() > 0 ? true : false;
109
-                // get all child line items
110
-                $children = $line_item->children();
111
-
112
-                // loop thru all non-tax child line items
113
-                foreach ($children as $child_line_item) {
114
-                        $html .= $this->display_line_item($child_line_item, $options);
115
-                }
116
-
117
-                $html .= $this->_taxes_html;
118
-                $html .= $this->_total_row($line_item, $options);
119
-                if ($options['use_table_wrapper']) {
120
-                    $html = $this->_table_header($options) . $html . $this->_table_footer($options);
121
-                }
122
-                break;
123
-        }
124
-
125
-        return $html;
126
-    }
127
-
128
-
129
-
130
-    /**
131
-     * Table header for display.
132
-     * @since   4.8
133
-     * @param array $options
134
-     * @return string
135
-     */
136
-    protected function _table_header($options)
137
-    {
138
-        $html = EEH_HTML::table('', '', $options['table_css_class']);
139
-        $html .= EEH_HTML::thead();
140
-        $html .= EEH_HTML::tr();
141
-        $html .= EEH_HTML::th(__('Name', 'event_espresso'), '', 'jst-left');
142
-        $html .= EEH_HTML::th(__('Type', 'event_espresso'), '', 'jst-left');
143
-        $html .= EEH_HTML::th(__('Amount', 'event_espresso'), '', 'jst-cntr');
144
-        $html .= EEH_HTML::th(__('Qty', 'event_espresso'), '', 'jst-cntr');
145
-        $html .= EEH_HTML::th(__('Line Total', 'event_espresso'), '', 'jst-cntr');
146
-        $html .= EEH_HTML::tbody();
147
-        return $html;
148
-    }
149
-
150
-
151
-    /**
152
-     * Table footer for display
153
-     * @since 4.8
154
-     * @param array $options array of options for the table.
155
-     * @return string
156
-     */
157
-    protected function _table_footer($options)
158
-    {
159
-        return EEH_HTML::tbodyx() .  EEH_HTML::tablex();
160
-    }
161
-
162
-
163
-
164
-    /**
165
-     *    _item_row
166
-     *
167
-     * @param EE_Line_Item $line_item
168
-     * @param array        $options
169
-     * @return mixed
170
-     */
171
-    protected function _item_row(EE_Line_Item $line_item, $options = array())
172
-    {
173
-        $line_item_related_object = $line_item->get_object();
174
-        $parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->get_object() : null;
175
-        // start of row
176
-        $row_class = $options['odd'] ? 'item odd' : 'item';
177
-        $html = EEH_HTML::tr('', '', $row_class);
178
-
179
-
180
-        // Name Column
181
-        $name_link = $line_item_related_object instanceof EEI_Admin_Links ? $line_item_related_object->get_admin_details_link() : '';
182
-
183
-        // related object scope.
184
-        $parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object ? $parent_line_item_related_object->name() : '';
185
-        $parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name;
186
-        $parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links ? $parent_line_item_related_object->get_admin_details_link() : '';
187
-
188
-
189
-        $name_html = $line_item_related_object instanceof EEI_Line_Item_Object ? $line_item_related_object->name() : $line_item->name();
190
-        $name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html;
191
-        $name_html .= $line_item->is_taxable() ? ' *' : '';
192
-        // maybe preface with icon?
193
-        $name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon() . $name_html : $name_html;
194
-        $name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>';
195
-        $name_html .=  sprintf(
196
-            _x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
197
-            '<span class="ee-line-item-related-parent-object">',
198
-            $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __('Item:', 'event_espresso'),
199
-            $parent_related_object_link ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' : $parent_related_object_name,
200
-            '</span>'
201
-        );
202
-
203
-        $name_html = apply_filters(
204
-            'FHEE__EE_Admin_Table_Line_Item_Display_Strategy___item_row__name_html',
205
-            $name_html,
206
-            $line_item,
207
-            $options
208
-        );
209
-
210
-        $html .= EEH_HTML::td($name_html, '', 'jst-left');
211
-        // Type Column
212
-        $type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() : '';
213
-        $type_html .= $this->_get_cancellations($line_item);
214
-        $type_html .= $line_item->OBJ_type() ? '<br />' : '';
215
-        $code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : '';
216
-        $type_html .= ! empty($code) ? '<span class="ee-line-item-id">' . sprintf(__('Code: %s', 'event_espresso'), $code) . '</span>' : '';
217
-        $html .= EEH_HTML::td($type_html, '', 'jst-left');
218
-
219
-
220
-        // Amount Column
221
-        if ($line_item->is_percent()) {
222
-            $html .= EEH_HTML::td($line_item->percent() . '%', '', 'jst-rght');
223
-        } else {
224
-            $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght');
225
-        }
226
-
227
-        // QTY column
228
-        $html .= EEH_HTML::td($line_item->quantity(), '', 'jst-rght');
229
-
230
-        // total column
231
-        $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
232
-
233
-        // finish things off and return
234
-        $html .= EEH_HTML::trx();
235
-        return $html;
236
-    }
237
-
238
-
239
-
240
-    /**
241
-     *    _get_cancellations
242
-     *
243
-     * @param EE_Line_Item $line_item
244
-     * @return string
245
-     */
246
-    protected function _get_cancellations(EE_Line_Item $line_item)
247
-    {
248
-        $html = '';
249
-        $cancellations = $line_item->get_cancellations();
250
-        $cancellation = reset($cancellations);
251
-        // \EEH_Debug_Tools::printr( $cancellation, '$cancellation', __FILE__, __LINE__ );
252
-        if ($cancellation instanceof EE_Line_Item) {
253
-            $html .= ' <span class="ee-line-item-id">';
254
-            $html .= sprintf(
255
-                _n(
256
-                    '(%1$s Cancellation)',
257
-                    '(%1$s Cancellations)',
258
-                    $cancellation->quantity(),
259
-                    'event_espresso'
260
-                ),
261
-                $cancellation->quantity()
262
-            );
263
-            $html .= '</span>';
264
-        }
265
-        return $html;
266
-    }
267
-
268
-
269
-
270
-    /**
271
-     *  _sub_item_row
272
-     *
273
-     * @param EE_Line_Item $line_item
274
-     * @param array        $options
275
-     * @return mixed
276
-     */
277
-    protected function _sub_item_row(EE_Line_Item $line_item, $options = array())
278
-    {
279
-        // for now we're not showing sub-items
280
-        return '';
281
-    }
282
-
283
-
284
-
285
-    /**
286
-     *  _tax_row
287
-     *
288
-     * @param EE_Line_Item $line_item
289
-     * @param array        $options
290
-     * @return mixed
291
-     */
292
-    protected function _tax_row(EE_Line_Item $line_item, $options = array())
293
-    {
294
-        // start of row
295
-        $html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr');
296
-        // name th
297
-        $html .= EEH_HTML::th($line_item->name() . '(' . $line_item->get_pretty('LIN_percent') . '%)', '', 'jst-rght', '', ' colspan="4"');
298
-        // total th
299
-        $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
300
-        // end of row
301
-        $html .= EEH_HTML::trx();
302
-        return $html;
303
-    }
304
-
305
-
306
-
307
-
308
-    /**
309
-     *  _total_row
310
-     *
311
-     * @param EE_Line_Item $line_item
312
-     * @param string       $text
313
-     * @param array        $options
314
-     * @return mixed
315
-     */
316
-    protected function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array())
317
-    {
318
-        // currently not showing subtotal row
319
-        return '';
320
-    }
321
-
322
-
323
-
324
-    /**
325
-     *  _total_row
326
-     *
327
-     * @param EE_Line_Item $line_item
328
-     * @param array        $options
329
-     * @return mixed
330
-     */
331
-    protected function _total_row(EE_Line_Item $line_item, $options = array())
332
-    {
333
-        // start of row
334
-        $html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr');
335
-        // Total th label
336
-        $total_label = sprintf(__('Transaction Total %s', 'event_espresso'), '(' . EE_Registry::instance()->CFG->currency->code . ')');
337
-        $html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"');
338
-        // total th
339
-
340
-        $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
341
-        // end of row
342
-        $html .= EEH_HTML::trx();
343
-        return $html;
344
-    }
17
+	/**
18
+	 * whether to display the taxes row or not
19
+	 * @type bool $_show_taxes
20
+	 */
21
+	protected $_show_taxes = false;
22
+
23
+	/**
24
+	 * html for any tax rows
25
+	 * @type string $_show_taxes
26
+	 */
27
+	protected $_taxes_html = '';
28
+
29
+
30
+	/**
31
+	 * total amount including tax we can bill for at this time
32
+	 * @type float $_grand_total
33
+	 */
34
+	protected $_grand_total = 0.00;
35
+
36
+
37
+
38
+	/**
39
+	 * @return float
40
+	 */
41
+	public function grand_total()
42
+	{
43
+		return $this->_grand_total;
44
+	}
45
+
46
+
47
+
48
+	/**
49
+	 * This is used to output a single
50
+	 * @param EE_Line_Item $line_item
51
+	 * @param array        $options
52
+	 * @return mixed
53
+	 */
54
+	public function display_line_item(EE_Line_Item $line_item, $options = array())
55
+	{
56
+
57
+		$html = '';
58
+		// set some default options and merge with incoming
59
+		$default_options = array(
60
+			'odd' => true,
61
+			'use_table_wrapper' => true,
62
+			'table_css_class' => 'admin-primary-mbox-tbl',
63
+			'taxes_tr_css_class' => 'admin-primary-mbox-taxes-tr',
64
+			'total_tr_css_class' => 'admin-primary-mbox-total-tr'
65
+		);
66
+		$options = array_merge($default_options, (array) $options);
67
+
68
+		switch ($line_item->type()) {
69
+			case EEM_Line_Item::type_line_item:
70
+				// item row
71
+				$html .= $this->_item_row($line_item, $options);
72
+				break;
73
+
74
+			case EEM_Line_Item::type_sub_line_item:
75
+				$html .= $this->_sub_item_row($line_item, $options);
76
+				break;
77
+
78
+			case EEM_Line_Item::type_sub_total:
79
+				if ($line_item->quantity() === 0) {
80
+					return $html;
81
+				}
82
+				// loop through children
83
+				$child_line_items = $line_item->children();
84
+				// loop through children
85
+				foreach ($child_line_items as $child_line_item) {
86
+					// recursively feed children back into this method
87
+					$html .= $this->display_line_item($child_line_item, $options);
88
+				}
89
+				$html .= $this->_sub_total_row($line_item, $options);
90
+				break;
91
+
92
+			case EEM_Line_Item::type_tax:
93
+				if ($this->_show_taxes) {
94
+					$this->_taxes_html .= $this->_tax_row($line_item, $options);
95
+				}
96
+				break;
97
+
98
+			case EEM_Line_Item::type_tax_sub_total:
99
+				foreach ($line_item->children() as $child_line_item) {
100
+					if ($child_line_item->type() == EEM_Line_Item::type_tax) {
101
+						$this->display_line_item($child_line_item, $options);
102
+					}
103
+				}
104
+				break;
105
+
106
+			case EEM_Line_Item::type_total:
107
+				// determine whether to display taxes or not
108
+				$this->_show_taxes = $line_item->get_total_tax() > 0 ? true : false;
109
+				// get all child line items
110
+				$children = $line_item->children();
111
+
112
+				// loop thru all non-tax child line items
113
+				foreach ($children as $child_line_item) {
114
+						$html .= $this->display_line_item($child_line_item, $options);
115
+				}
116
+
117
+				$html .= $this->_taxes_html;
118
+				$html .= $this->_total_row($line_item, $options);
119
+				if ($options['use_table_wrapper']) {
120
+					$html = $this->_table_header($options) . $html . $this->_table_footer($options);
121
+				}
122
+				break;
123
+		}
124
+
125
+		return $html;
126
+	}
127
+
128
+
129
+
130
+	/**
131
+	 * Table header for display.
132
+	 * @since   4.8
133
+	 * @param array $options
134
+	 * @return string
135
+	 */
136
+	protected function _table_header($options)
137
+	{
138
+		$html = EEH_HTML::table('', '', $options['table_css_class']);
139
+		$html .= EEH_HTML::thead();
140
+		$html .= EEH_HTML::tr();
141
+		$html .= EEH_HTML::th(__('Name', 'event_espresso'), '', 'jst-left');
142
+		$html .= EEH_HTML::th(__('Type', 'event_espresso'), '', 'jst-left');
143
+		$html .= EEH_HTML::th(__('Amount', 'event_espresso'), '', 'jst-cntr');
144
+		$html .= EEH_HTML::th(__('Qty', 'event_espresso'), '', 'jst-cntr');
145
+		$html .= EEH_HTML::th(__('Line Total', 'event_espresso'), '', 'jst-cntr');
146
+		$html .= EEH_HTML::tbody();
147
+		return $html;
148
+	}
149
+
150
+
151
+	/**
152
+	 * Table footer for display
153
+	 * @since 4.8
154
+	 * @param array $options array of options for the table.
155
+	 * @return string
156
+	 */
157
+	protected function _table_footer($options)
158
+	{
159
+		return EEH_HTML::tbodyx() .  EEH_HTML::tablex();
160
+	}
161
+
162
+
163
+
164
+	/**
165
+	 *    _item_row
166
+	 *
167
+	 * @param EE_Line_Item $line_item
168
+	 * @param array        $options
169
+	 * @return mixed
170
+	 */
171
+	protected function _item_row(EE_Line_Item $line_item, $options = array())
172
+	{
173
+		$line_item_related_object = $line_item->get_object();
174
+		$parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->get_object() : null;
175
+		// start of row
176
+		$row_class = $options['odd'] ? 'item odd' : 'item';
177
+		$html = EEH_HTML::tr('', '', $row_class);
178
+
179
+
180
+		// Name Column
181
+		$name_link = $line_item_related_object instanceof EEI_Admin_Links ? $line_item_related_object->get_admin_details_link() : '';
182
+
183
+		// related object scope.
184
+		$parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object ? $parent_line_item_related_object->name() : '';
185
+		$parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name;
186
+		$parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links ? $parent_line_item_related_object->get_admin_details_link() : '';
187
+
188
+
189
+		$name_html = $line_item_related_object instanceof EEI_Line_Item_Object ? $line_item_related_object->name() : $line_item->name();
190
+		$name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html;
191
+		$name_html .= $line_item->is_taxable() ? ' *' : '';
192
+		// maybe preface with icon?
193
+		$name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon() . $name_html : $name_html;
194
+		$name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>';
195
+		$name_html .=  sprintf(
196
+			_x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
197
+			'<span class="ee-line-item-related-parent-object">',
198
+			$line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __('Item:', 'event_espresso'),
199
+			$parent_related_object_link ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' : $parent_related_object_name,
200
+			'</span>'
201
+		);
202
+
203
+		$name_html = apply_filters(
204
+			'FHEE__EE_Admin_Table_Line_Item_Display_Strategy___item_row__name_html',
205
+			$name_html,
206
+			$line_item,
207
+			$options
208
+		);
209
+
210
+		$html .= EEH_HTML::td($name_html, '', 'jst-left');
211
+		// Type Column
212
+		$type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() : '';
213
+		$type_html .= $this->_get_cancellations($line_item);
214
+		$type_html .= $line_item->OBJ_type() ? '<br />' : '';
215
+		$code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : '';
216
+		$type_html .= ! empty($code) ? '<span class="ee-line-item-id">' . sprintf(__('Code: %s', 'event_espresso'), $code) . '</span>' : '';
217
+		$html .= EEH_HTML::td($type_html, '', 'jst-left');
218
+
219
+
220
+		// Amount Column
221
+		if ($line_item->is_percent()) {
222
+			$html .= EEH_HTML::td($line_item->percent() . '%', '', 'jst-rght');
223
+		} else {
224
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght');
225
+		}
226
+
227
+		// QTY column
228
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'jst-rght');
229
+
230
+		// total column
231
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
232
+
233
+		// finish things off and return
234
+		$html .= EEH_HTML::trx();
235
+		return $html;
236
+	}
237
+
238
+
239
+
240
+	/**
241
+	 *    _get_cancellations
242
+	 *
243
+	 * @param EE_Line_Item $line_item
244
+	 * @return string
245
+	 */
246
+	protected function _get_cancellations(EE_Line_Item $line_item)
247
+	{
248
+		$html = '';
249
+		$cancellations = $line_item->get_cancellations();
250
+		$cancellation = reset($cancellations);
251
+		// \EEH_Debug_Tools::printr( $cancellation, '$cancellation', __FILE__, __LINE__ );
252
+		if ($cancellation instanceof EE_Line_Item) {
253
+			$html .= ' <span class="ee-line-item-id">';
254
+			$html .= sprintf(
255
+				_n(
256
+					'(%1$s Cancellation)',
257
+					'(%1$s Cancellations)',
258
+					$cancellation->quantity(),
259
+					'event_espresso'
260
+				),
261
+				$cancellation->quantity()
262
+			);
263
+			$html .= '</span>';
264
+		}
265
+		return $html;
266
+	}
267
+
268
+
269
+
270
+	/**
271
+	 *  _sub_item_row
272
+	 *
273
+	 * @param EE_Line_Item $line_item
274
+	 * @param array        $options
275
+	 * @return mixed
276
+	 */
277
+	protected function _sub_item_row(EE_Line_Item $line_item, $options = array())
278
+	{
279
+		// for now we're not showing sub-items
280
+		return '';
281
+	}
282
+
283
+
284
+
285
+	/**
286
+	 *  _tax_row
287
+	 *
288
+	 * @param EE_Line_Item $line_item
289
+	 * @param array        $options
290
+	 * @return mixed
291
+	 */
292
+	protected function _tax_row(EE_Line_Item $line_item, $options = array())
293
+	{
294
+		// start of row
295
+		$html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr');
296
+		// name th
297
+		$html .= EEH_HTML::th($line_item->name() . '(' . $line_item->get_pretty('LIN_percent') . '%)', '', 'jst-rght', '', ' colspan="4"');
298
+		// total th
299
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
300
+		// end of row
301
+		$html .= EEH_HTML::trx();
302
+		return $html;
303
+	}
304
+
305
+
306
+
307
+
308
+	/**
309
+	 *  _total_row
310
+	 *
311
+	 * @param EE_Line_Item $line_item
312
+	 * @param string       $text
313
+	 * @param array        $options
314
+	 * @return mixed
315
+	 */
316
+	protected function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array())
317
+	{
318
+		// currently not showing subtotal row
319
+		return '';
320
+	}
321
+
322
+
323
+
324
+	/**
325
+	 *  _total_row
326
+	 *
327
+	 * @param EE_Line_Item $line_item
328
+	 * @param array        $options
329
+	 * @return mixed
330
+	 */
331
+	protected function _total_row(EE_Line_Item $line_item, $options = array())
332
+	{
333
+		// start of row
334
+		$html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr');
335
+		// Total th label
336
+		$total_label = sprintf(__('Transaction Total %s', 'event_espresso'), '(' . EE_Registry::instance()->CFG->currency->code . ')');
337
+		$html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"');
338
+		// total th
339
+
340
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
341
+		// end of row
342
+		$html .= EEH_HTML::trx();
343
+		return $html;
344
+	}
345 345
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                 $html .= $this->_taxes_html;
118 118
                 $html .= $this->_total_row($line_item, $options);
119 119
                 if ($options['use_table_wrapper']) {
120
-                    $html = $this->_table_header($options) . $html . $this->_table_footer($options);
120
+                    $html = $this->_table_header($options).$html.$this->_table_footer($options);
121 121
                 }
122 122
                 break;
123 123
         }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      */
157 157
     protected function _table_footer($options)
158 158
     {
159
-        return EEH_HTML::tbodyx() .  EEH_HTML::tablex();
159
+        return EEH_HTML::tbodyx().EEH_HTML::tablex();
160 160
     }
161 161
 
162 162
 
@@ -187,16 +187,16 @@  discard block
 block discarded – undo
187 187
 
188 188
 
189 189
         $name_html = $line_item_related_object instanceof EEI_Line_Item_Object ? $line_item_related_object->name() : $line_item->name();
190
-        $name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html;
190
+        $name_html = $name_link ? '<a href="'.$name_link.'">'.$name_html.'</a>' : $name_html;
191 191
         $name_html .= $line_item->is_taxable() ? ' *' : '';
192 192
         // maybe preface with icon?
193
-        $name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon() . $name_html : $name_html;
194
-        $name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>';
195
-        $name_html .=  sprintf(
193
+        $name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon().$name_html : $name_html;
194
+        $name_html = '<span class="ee-line-item-name linked">'.$name_html.'</span><br>';
195
+        $name_html .= sprintf(
196 196
             _x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
197 197
             '<span class="ee-line-item-related-parent-object">',
198 198
             $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __('Item:', 'event_espresso'),
199
-            $parent_related_object_link ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' : $parent_related_object_name,
199
+            $parent_related_object_link ? '<a href="'.$parent_related_object_link.'">'.$parent_related_object_name.'</a>' : $parent_related_object_name,
200 200
             '</span>'
201 201
         );
202 202
 
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
         $type_html .= $this->_get_cancellations($line_item);
214 214
         $type_html .= $line_item->OBJ_type() ? '<br />' : '';
215 215
         $code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : '';
216
-        $type_html .= ! empty($code) ? '<span class="ee-line-item-id">' . sprintf(__('Code: %s', 'event_espresso'), $code) . '</span>' : '';
216
+        $type_html .= ! empty($code) ? '<span class="ee-line-item-id">'.sprintf(__('Code: %s', 'event_espresso'), $code).'</span>' : '';
217 217
         $html .= EEH_HTML::td($type_html, '', 'jst-left');
218 218
 
219 219
 
220 220
         // Amount Column
221 221
         if ($line_item->is_percent()) {
222
-            $html .= EEH_HTML::td($line_item->percent() . '%', '', 'jst-rght');
222
+            $html .= EEH_HTML::td($line_item->percent().'%', '', 'jst-rght');
223 223
         } else {
224 224
             $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght');
225 225
         }
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
         // start of row
295 295
         $html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr');
296 296
         // name th
297
-        $html .= EEH_HTML::th($line_item->name() . '(' . $line_item->get_pretty('LIN_percent') . '%)', '', 'jst-rght', '', ' colspan="4"');
297
+        $html .= EEH_HTML::th($line_item->name().'('.$line_item->get_pretty('LIN_percent').'%)', '', 'jst-rght', '', ' colspan="4"');
298 298
         // total th
299 299
         $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
300 300
         // end of row
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
         // start of row
334 334
         $html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr');
335 335
         // Total th label
336
-        $total_label = sprintf(__('Transaction Total %s', 'event_espresso'), '(' . EE_Registry::instance()->CFG->currency->code . ')');
336
+        $total_label = sprintf(__('Transaction Total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')');
337 337
         $html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"');
338 338
         // total th
339 339
 
Please login to merge, or discard this patch.
admin_pages/general_settings/General_Settings_Admin_Page.core.php 2 patches
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -291,12 +291,12 @@  discard block
 block discarded – undo
291 291
         wp_enqueue_script('thickbox');
292 292
         wp_register_script(
293 293
             'organization_settings',
294
-            GEN_SET_ASSETS_URL . 'your_organization_settings.js',
294
+            GEN_SET_ASSETS_URL.'your_organization_settings.js',
295 295
             array('jquery', 'media-upload', 'thickbox'),
296 296
             EVENT_ESPRESSO_VERSION,
297 297
             true
298 298
         );
299
-        wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
299
+        wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION);
300 300
         wp_enqueue_script('organization_settings');
301 301
         wp_enqueue_style('organization-css');
302 302
         $confirm_image_delete = array(
@@ -319,12 +319,12 @@  discard block
 block discarded – undo
319 319
         // scripts
320 320
         wp_register_script(
321 321
             'gen_settings_countries',
322
-            GEN_SET_ASSETS_URL . 'gen_settings_countries.js',
322
+            GEN_SET_ASSETS_URL.'gen_settings_countries.js',
323 323
             array('ee_admin_js'),
324 324
             EVENT_ESPRESSO_VERSION,
325 325
             true
326 326
         );
327
-        wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
327
+        wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION);
328 328
         wp_enqueue_script('gen_settings_countries');
329 329
         wp_enqueue_style('organization-css');
330 330
     }
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
         $this->_set_add_edit_form_tags('update_espresso_page_settings');
375 375
         $this->_set_publish_post_box_vars(null, false, false, null, false);
376 376
         $this->_template_args['admin_page_content'] = EEH_Template::display_template(
377
-            GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php',
377
+            GEN_SET_TEMPLATE_PATH.'espresso_page_settings.template.php',
378 378
             $this->_template_args,
379 379
             true
380 380
         );
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
     {
534 534
         try {
535 535
             $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
536
-            $admin_options_settings_form->process($this->_req_data[ $admin_options_settings_form->slug() ]);
536
+            $admin_options_settings_form->process($this->_req_data[$admin_options_settings_form->slug()]);
537 537
             EE_Registry::instance()->CFG->admin = apply_filters(
538 538
                 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin',
539 539
                 EE_Registry::instance()->CFG->admin
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
         $this->_set_add_edit_form_tags('update_country_settings');
651 651
         $this->_set_publish_post_box_vars(null, false, false, null, false);
652 652
         $this->_template_args['admin_page_content'] = EEH_Template::display_template(
653
-            GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php',
653
+            GEN_SET_TEMPLATE_PATH.'countries_settings.template.php',
654 654
             $this->_template_args,
655 655
             true
656 656
         );
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
         $CNT_ISO = isset($this->_req_data['country'])
679 679
             ? strtoupper(sanitize_text_field($this->_req_data['country']))
680 680
             : $CNT_ISO;
681
-        if (! $CNT_ISO) {
681
+        if ( ! $CNT_ISO) {
682 682
             return '';
683 683
         }
684 684
 
@@ -694,59 +694,59 @@  discard block
 block discarded – undo
694 694
         $country_input_types = array(
695 695
             'CNT_active'      => array(
696 696
                 'type'             => 'RADIO_BTN',
697
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
697
+                'input_name'       => 'cntry['.$CNT_ISO.']',
698 698
                 'class'            => '',
699 699
                 'options'          => $this->_yes_no_values,
700 700
                 'use_desc_4_label' => true,
701 701
             ),
702 702
             'CNT_ISO'         => array(
703 703
                 'type'       => 'TEXT',
704
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
704
+                'input_name' => 'cntry['.$CNT_ISO.']',
705 705
                 'class'      => 'small-text',
706 706
             ),
707 707
             'CNT_ISO3'        => array(
708 708
                 'type'       => 'TEXT',
709
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
709
+                'input_name' => 'cntry['.$CNT_ISO.']',
710 710
                 'class'      => 'small-text',
711 711
             ),
712 712
             'RGN_ID'          => array(
713 713
                 'type'       => 'TEXT',
714
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
714
+                'input_name' => 'cntry['.$CNT_ISO.']',
715 715
                 'class'      => 'small-text',
716 716
             ),
717 717
             'CNT_name'        => array(
718 718
                 'type'       => 'TEXT',
719
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
719
+                'input_name' => 'cntry['.$CNT_ISO.']',
720 720
                 'class'      => 'regular-text',
721 721
             ),
722 722
             'CNT_cur_code'    => array(
723 723
                 'type'       => 'TEXT',
724
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
724
+                'input_name' => 'cntry['.$CNT_ISO.']',
725 725
                 'class'      => 'small-text',
726 726
                 'disabled'   => $CNT_cur_disabled,
727 727
             ),
728 728
             'CNT_cur_single'  => array(
729 729
                 'type'       => 'TEXT',
730
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
730
+                'input_name' => 'cntry['.$CNT_ISO.']',
731 731
                 'class'      => 'medium-text',
732 732
                 'disabled'   => $CNT_cur_disabled,
733 733
             ),
734 734
             'CNT_cur_plural'  => array(
735 735
                 'type'       => 'TEXT',
736
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
736
+                'input_name' => 'cntry['.$CNT_ISO.']',
737 737
                 'class'      => 'medium-text',
738 738
                 'disabled'   => $CNT_cur_disabled,
739 739
             ),
740 740
             'CNT_cur_sign'    => array(
741 741
                 'type'         => 'TEXT',
742
-                'input_name'   => 'cntry[' . $CNT_ISO . ']',
742
+                'input_name'   => 'cntry['.$CNT_ISO.']',
743 743
                 'class'        => 'small-text',
744 744
                 'htmlentities' => false,
745 745
                 'disabled'     => $CNT_cur_disabled,
746 746
             ),
747 747
             'CNT_cur_sign_b4' => array(
748 748
                 'type'             => 'RADIO_BTN',
749
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
749
+                'input_name'       => 'cntry['.$CNT_ISO.']',
750 750
                 'class'            => '',
751 751
                 'options'          => $this->_yes_no_values,
752 752
                 'use_desc_4_label' => true,
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
             ),
755 755
             'CNT_cur_dec_plc' => array(
756 756
                 'type'       => 'RADIO_BTN',
757
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
757
+                'input_name' => 'cntry['.$CNT_ISO.']',
758 758
                 'class'      => '',
759 759
                 'options'    => array(
760 760
                     array('id' => 0, 'text' => ''),
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
             ),
767 767
             'CNT_cur_dec_mrk' => array(
768 768
                 'type'             => 'RADIO_BTN',
769
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
769
+                'input_name'       => 'cntry['.$CNT_ISO.']',
770 770
                 'class'            => '',
771 771
                 'options'          => array(
772 772
                     array(
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
             ),
781 781
             'CNT_cur_thsnds'  => array(
782 782
                 'type'             => 'RADIO_BTN',
783
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
783
+                'input_name'       => 'cntry['.$CNT_ISO.']',
784 784
                 'class'            => '',
785 785
                 'options'          => array(
786 786
                     array(
@@ -801,12 +801,12 @@  discard block
 block discarded – undo
801 801
             ),
802 802
             'CNT_tel_code'    => array(
803 803
                 'type'       => 'TEXT',
804
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
804
+                'input_name' => 'cntry['.$CNT_ISO.']',
805 805
                 'class'      => 'small-text',
806 806
             ),
807 807
             'CNT_is_EU'       => array(
808 808
                 'type'             => 'RADIO_BTN',
809
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
809
+                'input_name'       => 'cntry['.$CNT_ISO.']',
810 810
                 'class'            => '',
811 811
                 'options'          => $this->_yes_no_values,
812 812
                 'use_desc_4_label' => true,
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
             $country_input_types
818 818
         );
819 819
         $country_details_settings = EEH_Template::display_template(
820
-            GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php',
820
+            GEN_SET_TEMPLATE_PATH.'country_details_settings.template.php',
821 821
             $this->_template_args,
822 822
             true
823 823
         );
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
         $CNT_ISO = isset($this->_req_data['country'])
856 856
             ? sanitize_text_field($this->_req_data['country'])
857 857
             : $CNT_ISO;
858
-        if (! $CNT_ISO) {
858
+        if ( ! $CNT_ISO) {
859 859
             return '';
860 860
         }
861 861
         // for ajax
@@ -885,22 +885,22 @@  discard block
 block discarded – undo
885 885
                     $state_input_types = array(
886 886
                         'STA_abbrev' => array(
887 887
                             'type'       => 'TEXT',
888
-                            'input_name' => 'states[' . $STA_ID . ']',
888
+                            'input_name' => 'states['.$STA_ID.']',
889 889
                             'class'      => 'mid-text',
890 890
                         ),
891 891
                         'STA_name'   => array(
892 892
                             'type'       => 'TEXT',
893
-                            'input_name' => 'states[' . $STA_ID . ']',
893
+                            'input_name' => 'states['.$STA_ID.']',
894 894
                             'class'      => 'regular-text',
895 895
                         ),
896 896
                         'STA_active' => array(
897 897
                             'type'             => 'RADIO_BTN',
898
-                            'input_name'       => 'states[' . $STA_ID . ']',
898
+                            'input_name'       => 'states['.$STA_ID.']',
899 899
                             'options'          => $this->_yes_no_values,
900 900
                             'use_desc_4_label' => true,
901 901
                         ),
902 902
                     );
903
-                    $this->_template_args['states'][ $STA_ID ]['inputs'] =
903
+                    $this->_template_args['states'][$STA_ID]['inputs'] =
904 904
                         EE_Question_Form_Input::generate_question_form_inputs_for_object(
905 905
                             $state,
906 906
                             $state_input_types
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
                         'CNT_ISO'    => $CNT_ISO,
912 912
                         'STA_abbrev' => $state->abbrev(),
913 913
                     );
914
-                    $this->_template_args['states'][ $STA_ID ]['delete_state_url'] =
914
+                    $this->_template_args['states'][$STA_ID]['delete_state_url'] =
915 915
                         EE_Admin_Page::add_query_args_and_nonce(
916 916
                             $query_args,
917 917
                             GEN_SET_ADMIN_URL
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
         );
929 929
 
930 930
         $state_details_settings = EEH_Template::display_template(
931
-            GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php',
931
+            GEN_SET_TEMPLATE_PATH.'state_details_settings.template.php',
932 932
             $this->_template_args,
933 933
             true
934 934
         );
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
         $CNT_ISO = isset($this->_req_data['CNT_ISO'])
968 968
             ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO']))
969 969
             : false;
970
-        if (! $CNT_ISO) {
970
+        if ( ! $CNT_ISO) {
971 971
             EE_Error::add_error(
972 972
                 esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'),
973 973
                 __FILE__,
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
         $STA_abbrev = isset($this->_req_data['STA_abbrev'])
980 980
             ? sanitize_text_field($this->_req_data['STA_abbrev'])
981 981
             : false;
982
-        if (! $STA_abbrev) {
982
+        if ( ! $STA_abbrev) {
983 983
             EE_Error::add_error(
984 984
                 esc_html__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'),
985 985
                 __FILE__,
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
         $STA_name = isset($this->_req_data['STA_name'])
992 992
             ? sanitize_text_field($this->_req_data['STA_name'])
993 993
             : false;
994
-        if (! $STA_name) {
994
+        if ( ! $STA_name) {
995 995
             EE_Error::add_error(
996 996
                 esc_html__('No State name or an invalid State name was received.', 'event_espresso'),
997 997
                 __FILE__,
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
         $STA_abbrev = isset($this->_req_data['STA_abbrev'])
1044 1044
             ? sanitize_text_field($this->_req_data['STA_abbrev'])
1045 1045
             : false;
1046
-        if (! $STA_ID) {
1046
+        if ( ! $STA_ID) {
1047 1047
             EE_Error::add_error(
1048 1048
                 esc_html__('No State ID or an invalid State ID was received.', 'event_espresso'),
1049 1049
                 __FILE__,
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
         $CNT_ISO = isset($this->_req_data['country'])
1096 1096
             ? strtoupper(sanitize_text_field($this->_req_data['country']))
1097 1097
             : false;
1098
-        if (! $CNT_ISO) {
1098
+        if ( ! $CNT_ISO) {
1099 1099
             EE_Error::add_error(
1100 1100
                 esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'),
1101 1101
                 __FILE__,
@@ -1106,63 +1106,63 @@  discard block
 block discarded – undo
1106 1106
             return;
1107 1107
         }
1108 1108
         $cols_n_values = array();
1109
-        $cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_ISO3'])
1110
-            ? strtoupper(sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_ISO3']))
1109
+        $cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'])
1110
+            ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3']))
1111 1111
             : false;
1112
-        $cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['RGN_ID'])
1113
-            ? absint($this->_req_data['cntry'][ $CNT_ISO ]['RGN_ID'])
1112
+        $cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID'])
1113
+            ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID'])
1114 1114
             : null;
1115
-        $cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_name'])
1116
-            ? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_name'])
1115
+        $cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_name'])
1116
+            ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_name'])
1117 1117
             : null;
1118
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_code'])) {
1118
+        if (isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])) {
1119 1119
             $cols_n_values['CNT_cur_code'] = strtoupper(
1120
-                sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_code'])
1120
+                sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])
1121 1121
             );
1122 1122
         }
1123
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_single'])) {
1123
+        if (isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'])) {
1124 1124
             $cols_n_values['CNT_cur_single'] = sanitize_text_field(
1125
-                $this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_single']
1125
+                $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']
1126 1126
             );
1127 1127
         }
1128
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_plural'])) {
1128
+        if (isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'])) {
1129 1129
             $cols_n_values['CNT_cur_plural'] = sanitize_text_field(
1130
-                $this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_plural']
1130
+                $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']
1131 1131
             );
1132 1132
         }
1133
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign'])) {
1133
+        if (isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'])) {
1134 1134
             $cols_n_values['CNT_cur_sign'] = sanitize_text_field(
1135
-                $this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign']
1135
+                $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']
1136 1136
             );
1137 1137
         }
1138
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign_b4'])) {
1138
+        if (isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'])) {
1139 1139
             $cols_n_values['CNT_cur_sign_b4'] = absint(
1140
-                $this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign_b4']
1140
+                $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']
1141 1141
             );
1142 1142
         }
1143
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_plc'])) {
1143
+        if (isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'])) {
1144 1144
             $cols_n_values['CNT_cur_dec_plc'] = absint(
1145
-                $this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_plc']
1145
+                $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']
1146 1146
             );
1147 1147
         }
1148
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_mrk'])) {
1148
+        if (isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'])) {
1149 1149
             $cols_n_values['CNT_cur_dec_mrk'] = sanitize_text_field(
1150
-                $this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_mrk']
1150
+                $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']
1151 1151
             );
1152 1152
         }
1153
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_thsnds'])) {
1153
+        if (isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'])) {
1154 1154
             $cols_n_values['CNT_cur_thsnds'] = sanitize_text_field(
1155
-                $this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_thsnds']
1155
+                $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']
1156 1156
             );
1157 1157
         }
1158
-        $cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_tel_code'])
1159
-            ? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_tel_code'])
1158
+        $cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'])
1159
+            ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'])
1160 1160
             : null;
1161
-        $cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_is_EU'])
1162
-            ? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_is_EU'])
1161
+        $cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'])
1162
+            ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'])
1163 1163
             : false;
1164
-        $cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_active'])
1165
-            ? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_active'])
1164
+        $cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active'])
1165
+            ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active'])
1166 1166
             : false;
1167 1167
         // allow filtering of country data
1168 1168
         $cols_n_values = apply_filters(
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
         return '
1240 1240
 			<tr>
1241 1241
 				<th>
1242
-					' . $label . '
1242
+					' . $label.'
1243 1243
 				</th>';
1244 1244
     }
1245 1245
 
@@ -1255,7 +1255,7 @@  discard block
 block discarded – undo
1255 1255
     {
1256 1256
         return '
1257 1257
 				<td class="general-settings-country-input-td">
1258
-					' . $input . '
1258
+					' . $input.'
1259 1259
 				</td>
1260 1260
 			</tr>';
1261 1261
     }
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
     {
1287 1287
         return '
1288 1288
 				<td class="general-settings-country-state-input-td">
1289
-					' . $input . '
1289
+					' . $input.'
1290 1290
 				</td>';
1291 1291
     }
1292 1292
 
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
                  . esc_html__('Edit', 'event_espresso')
1313 1313
                  . '</a>';
1314 1314
         $links .= ' &nbsp;|&nbsp; ';
1315
-        $links .= '<a href="' . get_permalink($ee_page_id) . '" >' . esc_html__('View', 'event_espresso') . '</a>';
1315
+        $links .= '<a href="'.get_permalink($ee_page_id).'" >'.esc_html__('View', 'event_espresso').'</a>';
1316 1316
 
1317 1317
         return $links;
1318 1318
     }
@@ -1345,9 +1345,9 @@  discard block
 block discarded – undo
1345 1345
             $sc_status = sprintf(esc_html__('Shortcode%sProblem', 'event_espresso'), '&nbsp;');
1346 1346
         }
1347 1347
 
1348
-        return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>'
1348
+        return '<span style="color:'.$pg_colour.'; margin-right:2em;"><strong>'
1349 1349
                . $pg_status
1350
-               . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';
1350
+               . '</strong></span><span style="color:'.$sc_colour.'"><strong>'.$sc_status.'</strong></span>';
1351 1351
     }
1352 1352
 
1353 1353
 
Please login to merge, or discard this patch.
Indentation   +1399 added lines, -1399 removed lines patch added patch discarded remove patch
@@ -20,1414 +20,1414 @@
 block discarded – undo
20 20
 class General_Settings_Admin_Page extends EE_Admin_Page
21 21
 {
22 22
 
23
-    /**
24
-     * _question_group
25
-     * holds the specific question group object for the question group details screen
26
-     *
27
-     * @var object
28
-     */
29
-    protected $_question_group;
30
-
31
-
32
-    /**
33
-     * Initialize basic properties.
34
-     */
35
-    protected function _init_page_props()
36
-    {
37
-        $this->page_slug = GEN_SET_PG_SLUG;
38
-        $this->page_label = GEN_SET_LABEL;
39
-        $this->_admin_base_url = GEN_SET_ADMIN_URL;
40
-        $this->_admin_base_path = GEN_SET_ADMIN;
41
-    }
42
-
43
-
44
-    /**
45
-     * Set ajax hooks
46
-     */
47
-    protected function _ajax_hooks()
48
-    {
49
-        add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings'));
50
-        add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states'));
51
-        add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3);
52
-        add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state'));
53
-    }
54
-
55
-
56
-    /**
57
-     * More page properties initialization.
58
-     */
59
-    protected function _define_page_props()
60
-    {
61
-        $this->_admin_page_title = GEN_SET_LABEL;
62
-        $this->_labels = array(
63
-            'publishbox' => esc_html__('Update Settings', 'event_espresso'),
64
-        );
65
-    }
66
-
67
-
68
-    /**
69
-     * Set page routes property.
70
-     */
71
-    protected function _set_page_routes()
72
-    {
73
-        $this->_page_routes = array(
74
-
75
-            'critical_pages'                => array(
76
-                'func'       => '_espresso_page_settings',
77
-                'capability' => 'manage_options',
78
-            ),
79
-            'update_espresso_page_settings' => array(
80
-                'func'       => '_update_espresso_page_settings',
81
-                'capability' => 'manage_options',
82
-                'noheader'   => true,
83
-            ),
84
-            'default'                       => array(
85
-                'func'       => '_your_organization_settings',
86
-                'capability' => 'manage_options',
87
-            ),
88
-
89
-            'update_your_organization_settings' => array(
90
-                'func'       => '_update_your_organization_settings',
91
-                'capability' => 'manage_options',
92
-                'noheader'   => true,
93
-            ),
94
-
95
-            'admin_option_settings' => array(
96
-                'func'       => '_admin_option_settings',
97
-                'capability' => 'manage_options',
98
-            ),
99
-
100
-            'update_admin_option_settings' => array(
101
-                'func'       => '_update_admin_option_settings',
102
-                'capability' => 'manage_options',
103
-                'noheader'   => true,
104
-            ),
105
-
106
-            'country_settings' => array(
107
-                'func'       => '_country_settings',
108
-                'capability' => 'manage_options',
109
-            ),
110
-
111
-            'update_country_settings' => array(
112
-                'func'       => '_update_country_settings',
113
-                'capability' => 'manage_options',
114
-                'noheader'   => true,
115
-            ),
116
-
117
-            'display_country_settings' => array(
118
-                'func'       => 'display_country_settings',
119
-                'capability' => 'manage_options',
120
-                'noheader'   => true,
121
-            ),
122
-
123
-            'add_new_state' => array(
124
-                'func'       => 'add_new_state',
125
-                'capability' => 'manage_options',
126
-                'noheader'   => true,
127
-            ),
128
-
129
-            'delete_state'            => array(
130
-                'func'       => 'delete_state',
131
-                'capability' => 'manage_options',
132
-                'noheader'   => true,
133
-            ),
134
-            'privacy_settings'        => array(
135
-                'func'       => 'privacySettings',
136
-                'capability' => 'manage_options',
137
-            ),
138
-            'update_privacy_settings' => array(
139
-                'func'               => 'updatePrivacySettings',
140
-                'capability'         => 'manage_options',
141
-                'noheader'           => true,
142
-                'headers_sent_route' => 'privacy_settings',
143
-            ),
144
-        );
145
-    }
146
-
147
-
148
-    /**
149
-     * Set page configuration property
150
-     */
151
-    protected function _set_page_config()
152
-    {
153
-        $this->_page_config = array(
154
-            'critical_pages'        => array(
155
-                'nav'           => array(
156
-                    'label' => esc_html__('Critical Pages', 'event_espresso'),
157
-                    'order' => 50,
158
-                ),
159
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
160
-                'help_tabs'     => array(
161
-                    'general_settings_critical_pages_help_tab' => array(
162
-                        'title'    => esc_html__('Critical Pages', 'event_espresso'),
163
-                        'filename' => 'general_settings_critical_pages',
164
-                    ),
165
-                ),
166
-                // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
167
-                // 'help_tour'     => array('Critical_Pages_Help_Tour'),
168
-                'require_nonce' => false,
169
-            ),
170
-            'default'               => array(
171
-                'nav'           => array(
172
-                    'label' => esc_html__('Your Organization', 'event_espresso'),
173
-                    'order' => 20,
174
-                ),
175
-                'help_tabs'     => array(
176
-                    'general_settings_your_organization_help_tab' => array(
177
-                        'title'    => esc_html__('Your Organization', 'event_espresso'),
178
-                        'filename' => 'general_settings_your_organization',
179
-                    ),
180
-                ),
181
-                // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
182
-                // 'help_tour'     => array('Your_Organization_Help_Tour'),
183
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
184
-                'require_nonce' => false,
185
-            ),
186
-            'admin_option_settings' => array(
187
-                'nav'           => array(
188
-                    'label' => esc_html__('Admin Options', 'event_espresso'),
189
-                    'order' => 60,
190
-                ),
191
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
192
-                'help_tabs'     => array(
193
-                    'general_settings_admin_options_help_tab' => array(
194
-                        'title'    => esc_html__('Admin Options', 'event_espresso'),
195
-                        'filename' => 'general_settings_admin_options',
196
-                    ),
197
-                ),
198
-                // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
199
-                // 'help_tour'     => array('Admin_Options_Help_Tour'),
200
-                'require_nonce' => false,
201
-            ),
202
-            'country_settings'      => array(
203
-                'nav'           => array(
204
-                    'label' => esc_html__('Countries', 'event_espresso'),
205
-                    'order' => 70,
206
-                ),
207
-                'help_tabs'     => array(
208
-                    'general_settings_countries_help_tab' => array(
209
-                        'title'    => esc_html__('Countries', 'event_espresso'),
210
-                        'filename' => 'general_settings_countries',
211
-                    ),
212
-                ),
213
-                // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
214
-                // 'help_tour'     => array('Countries_Help_Tour'),
215
-                'require_nonce' => false,
216
-            ),
217
-            'privacy_settings'      => array(
218
-                'nav'           => array(
219
-                    'label' => esc_html__('Privacy', 'event_espresso'),
220
-                    'order' => 80,
221
-                ),
222
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
223
-                'require_nonce' => false,
224
-            ),
225
-        );
226
-    }
227
-
228
-
229
-    protected function _add_screen_options()
230
-    {
231
-    }
232
-
233
-
234
-    protected function _add_feature_pointers()
235
-    {
236
-    }
237
-
238
-
239
-    /**
240
-     * Enqueue global scripts and styles for all routes in the General Settings Admin Pages.
241
-     */
242
-    public function load_scripts_styles()
243
-    {
244
-        // styles
245
-        wp_enqueue_style('espresso-ui-theme');
246
-        // scripts
247
-        wp_enqueue_script('ee_admin_js');
248
-    }
249
-
250
-
251
-    /**
252
-     * Execute logic running on `admin_init`
253
-     */
254
-    public function admin_init()
255
-    {
256
-        EE_Registry::$i18n_js_strings['invalid_server_response'] = wp_strip_all_tags(__(
257
-            'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.',
258
-            'event_espresso'
259
-        ));
260
-        EE_Registry::$i18n_js_strings['error_occurred'] = wp_strip_all_tags(__(
261
-            'An error occurred! Please refresh the page and try again.',
262
-            'event_espresso'
263
-        ));
264
-        EE_Registry::$i18n_js_strings['confirm_delete_state'] = wp_strip_all_tags(__(
265
-            'Are you sure you want to delete this State / Province?',
266
-            'event_espresso'
267
-        ));
268
-        $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
269
-        EE_Registry::$i18n_js_strings['ajax_url'] = admin_url(
270
-            'admin-ajax.php?page=espresso_general_settings',
271
-            $protocol
272
-        );
273
-    }
274
-
275
-
276
-    public function admin_notices()
277
-    {
278
-    }
279
-
280
-
281
-    public function admin_footer_scripts()
282
-    {
283
-    }
284
-
285
-
286
-    /**
287
-     * Enqueue scripts and styles for the default route.
288
-     */
289
-    public function load_scripts_styles_default()
290
-    {
291
-        // styles
292
-        wp_enqueue_style('thickbox');
293
-        // scripts
294
-        wp_enqueue_script('media-upload');
295
-        wp_enqueue_script('thickbox');
296
-        wp_register_script(
297
-            'organization_settings',
298
-            GEN_SET_ASSETS_URL . 'your_organization_settings.js',
299
-            array('jquery', 'media-upload', 'thickbox'),
300
-            EVENT_ESPRESSO_VERSION,
301
-            true
302
-        );
303
-        wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
304
-        wp_enqueue_script('organization_settings');
305
-        wp_enqueue_style('organization-css');
306
-        $confirm_image_delete = array(
307
-            'text' => wp_strip_all_tags(
308
-                __(
309
-                    'Do you really want to delete this image? Please remember to save your settings to complete the removal.',
310
-                    'event_espresso'
311
-                )
312
-            ),
313
-        );
314
-        wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete);
315
-    }
316
-
317
-
318
-    /**
319
-     * Enqueue scripts and styles for the country settings route.
320
-     */
321
-    public function load_scripts_styles_country_settings()
322
-    {
323
-        // scripts
324
-        wp_register_script(
325
-            'gen_settings_countries',
326
-            GEN_SET_ASSETS_URL . 'gen_settings_countries.js',
327
-            array('ee_admin_js'),
328
-            EVENT_ESPRESSO_VERSION,
329
-            true
330
-        );
331
-        wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
332
-        wp_enqueue_script('gen_settings_countries');
333
-        wp_enqueue_style('organization-css');
334
-    }
335
-
336
-
337
-    /*************        Espresso Pages        *************/
338
-    /**
339
-     * _espresso_page_settings
340
-     *
341
-     * @throws \EE_Error
342
-     * @throws DomainException
343
-     * @throws DomainException
344
-     * @throws InvalidDataTypeException
345
-     * @throws InvalidArgumentException
346
-     */
347
-    protected function _espresso_page_settings()
348
-    {
349
-        // Check to make sure all of the main pages are setup properly,
350
-        // if not create the default pages and display an admin notice
351
-        EEH_Activation::verify_default_pages_exist();
352
-        $this->_transient_garbage_collection();
353
-        $this->_template_args['values'] = $this->_yes_no_values;
354
-        $this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id)
355
-            ? EE_Registry::instance()->CFG->core->reg_page_id
356
-            : null;
357
-        $this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id)
358
-            ? get_page(EE_Registry::instance()->CFG->core->reg_page_id)
359
-            : false;
360
-        $this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id)
361
-            ? EE_Registry::instance()->CFG->core->txn_page_id
362
-            : null;
363
-        $this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id)
364
-            ? get_page(EE_Registry::instance()->CFG->core->txn_page_id)
365
-            : false;
366
-        $this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id)
367
-            ? EE_Registry::instance()->CFG->core->thank_you_page_id
368
-            : null;
369
-        $this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id)
370
-            ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id)
371
-            : false;
372
-        $this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id)
373
-            ? EE_Registry::instance()->CFG->core->cancel_page_id
374
-            : null;
375
-        $this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id)
376
-            ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id)
377
-            : false;
378
-        $this->_set_add_edit_form_tags('update_espresso_page_settings');
379
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
380
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
381
-            GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php',
382
-            $this->_template_args,
383
-            true
384
-        );
385
-        $this->display_admin_page_with_sidebar();
386
-    }
387
-
388
-
389
-    /**
390
-     * Handler for updating espresso page settings.
391
-     *
392
-     * @throws EE_Error
393
-     */
394
-    protected function _update_espresso_page_settings()
395
-    {
396
-        // capture incoming request data && set page IDs
397
-        EE_Registry::instance()->CFG->core->reg_page_id = isset($this->_req_data['reg_page_id'])
398
-            ? absint($this->_req_data['reg_page_id'])
399
-            : EE_Registry::instance()->CFG->core->reg_page_id;
400
-        EE_Registry::instance()->CFG->core->txn_page_id = isset($this->_req_data['txn_page_id'])
401
-            ? absint($this->_req_data['txn_page_id'])
402
-            : EE_Registry::instance()->CFG->core->txn_page_id;
403
-        EE_Registry::instance()->CFG->core->thank_you_page_id = isset($this->_req_data['thank_you_page_id'])
404
-            ? absint($this->_req_data['thank_you_page_id'])
405
-            : EE_Registry::instance()->CFG->core->thank_you_page_id;
406
-        EE_Registry::instance()->CFG->core->cancel_page_id = isset($this->_req_data['cancel_page_id'])
407
-            ? absint($this->_req_data['cancel_page_id'])
408
-            : EE_Registry::instance()->CFG->core->cancel_page_id;
409
-
410
-        EE_Registry::instance()->CFG->core = apply_filters(
411
-            'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core',
412
-            EE_Registry::instance()->CFG->core,
413
-            $this->_req_data
414
-        );
415
-        $what = esc_html__('Critical Pages & Shortcodes', 'event_espresso');
416
-        $this->_redirect_after_action(
417
-            $this->_update_espresso_configuration(
418
-                $what,
419
-                EE_Registry::instance()->CFG->core,
420
-                __FILE__,
421
-                __FUNCTION__,
422
-                __LINE__
423
-            ),
424
-            $what,
425
-            '',
426
-            array(
427
-                'action' => 'critical_pages',
428
-            ),
429
-            true
430
-        );
431
-    }
432
-
433
-
434
-    /*************        Your Organization        *************/
435
-
436
-
437
-    /**
438
-     * @throws DomainException
439
-     * @throws EE_Error
440
-     * @throws InvalidArgumentException
441
-     * @throws InvalidDataTypeException
442
-     * @throws InvalidInterfaceException
443
-     */
444
-    protected function _your_organization_settings()
445
-    {
446
-        $this->_template_args['admin_page_content'] = '';
447
-        try {
448
-            /** @var EventEspresso\admin_pages\general_settings\OrganizationSettings $organization_settings_form */
449
-            $organization_settings_form = $this->loader->getShared(
450
-                'EventEspresso\admin_pages\general_settings\OrganizationSettings'
451
-            );
452
-            $this->_template_args['admin_page_content'] = $organization_settings_form->display();
453
-        } catch (Exception $e) {
454
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
455
-        }
456
-        $this->_set_add_edit_form_tags('update_your_organization_settings');
457
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
458
-        $this->display_admin_page_with_sidebar();
459
-    }
460
-
461
-
462
-    /**
463
-     * Handler for updating organization settings.
464
-     *
465
-     * @throws EE_Error
466
-     */
467
-    protected function _update_your_organization_settings()
468
-    {
469
-        try {
470
-            /** @var EventEspresso\admin_pages\general_settings\OrganizationSettings $organization_settings_form */
471
-            $organization_settings_form = $this->loader->getShared(
472
-                'EventEspresso\admin_pages\general_settings\OrganizationSettings'
473
-            );
474
-            $success = $organization_settings_form->process($this->_req_data);
475
-            EE_Registry::instance()->CFG = apply_filters(
476
-                'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG',
477
-                EE_Registry::instance()->CFG
478
-            );
479
-        } catch (Exception $e) {
480
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
481
-            $success = false;
482
-        }
483
-
484
-        if ($success) {
485
-            $success = $this->_update_espresso_configuration(
486
-                esc_html__('Your Organization Settings', 'event_espresso'),
487
-                EE_Registry::instance()->CFG,
488
-                __FILE__,
489
-                __FUNCTION__,
490
-                __LINE__
491
-            );
492
-        }
493
-
494
-        $this->_redirect_after_action($success, '', '', array('action' => 'default'), true);
495
-    }
496
-
497
-
498
-
499
-    /*************        Admin Options        *************/
500
-
501
-
502
-    /**
503
-     * _admin_option_settings
504
-     *
505
-     * @throws \EE_Error
506
-     * @throws \LogicException
507
-     */
508
-    protected function _admin_option_settings()
509
-    {
510
-        $this->_template_args['admin_page_content'] = '';
511
-        try {
512
-            $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
513
-            // still need this for the old school form in Extend_General_Settings_Admin_Page
514
-            $this->_template_args['values'] = $this->_yes_no_values;
515
-            // also need to account for the do_action that was in the old template
516
-            $admin_options_settings_form->setTemplateArgs($this->_template_args);
517
-            $this->_template_args['admin_page_content'] = $admin_options_settings_form->display();
518
-        } catch (Exception $e) {
519
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
520
-        }
521
-        $this->_set_add_edit_form_tags('update_admin_option_settings');
522
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
523
-        $this->display_admin_page_with_sidebar();
524
-    }
525
-
526
-
527
-    /**
528
-     * _update_admin_option_settings
529
-     *
530
-     * @throws \EE_Error
531
-     * @throws InvalidDataTypeException
532
-     * @throws \EventEspresso\core\exceptions\InvalidFormSubmissionException
533
-     * @throws \InvalidArgumentException
534
-     * @throws \LogicException
535
-     */
536
-    protected function _update_admin_option_settings()
537
-    {
538
-        try {
539
-            $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
540
-            $admin_options_settings_form->process($this->_req_data[ $admin_options_settings_form->slug() ]);
541
-            EE_Registry::instance()->CFG->admin = apply_filters(
542
-                'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin',
543
-                EE_Registry::instance()->CFG->admin
544
-            );
545
-        } catch (Exception $e) {
546
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
547
-        }
548
-        $this->_redirect_after_action(
549
-            apply_filters(
550
-                'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success',
551
-                $this->_update_espresso_configuration(
552
-                    'Admin Options',
553
-                    EE_Registry::instance()->CFG->admin,
554
-                    __FILE__,
555
-                    __FUNCTION__,
556
-                    __LINE__
557
-                )
558
-            ),
559
-            'Admin Options',
560
-            'updated',
561
-            array('action' => 'admin_option_settings')
562
-        );
563
-    }
564
-
565
-
566
-    /*************        Countries        *************/
567
-
568
-
569
-    /**
570
-     * @return string
571
-     */
572
-    protected function getCountryIsoForSite()
573
-    {
574
-        return ! empty(EE_Registry::instance()->CFG->organization->CNT_ISO)
575
-            ? EE_Registry::instance()->CFG->organization->CNT_ISO
576
-            : 'US';
577
-    }
578
-
579
-
580
-    /**
581
-     * @param string          $CNT_ISO
582
-     * @param EE_Country|null $country
583
-     * @return EE_Base_Class|EE_Country
584
-     * @throws EE_Error
585
-     * @throws InvalidArgumentException
586
-     * @throws InvalidDataTypeException
587
-     * @throws InvalidInterfaceException
588
-     * @throws ReflectionException
589
-     */
590
-    protected function verifyOrGetCountryFromIso($CNT_ISO, EE_Country $country = null)
591
-    {
592
-        /** @var EE_Country $country */
593
-        return $country instanceof EE_Country && $country->ID() === $CNT_ISO
594
-            ? $country
595
-            : EEM_Country::instance()->get_one_by_ID($CNT_ISO);
596
-    }
597
-
598
-
599
-    /**
600
-     * Output Country Settings view.
601
-     *
602
-     * @throws DomainException
603
-     * @throws EE_Error
604
-     * @throws InvalidArgumentException
605
-     * @throws InvalidDataTypeException
606
-     * @throws InvalidInterfaceException
607
-     * @throws ReflectionException
608
-     */
609
-    protected function _country_settings()
610
-    {
611
-        $CNT_ISO_for_site = $this->getCountryIsoForSite();
612
-        $CNT_ISO = isset($this->_req_data['country'])
613
-            ? strtoupper(sanitize_text_field($this->_req_data['country']))
614
-            : $CNT_ISO_for_site;
615
-
616
-        // load field generator helper
617
-
618
-        $this->_template_args['values'] = $this->_yes_no_values;
619
-
620
-        $this->_template_args['countries'] = new EE_Question_Form_Input(
621
-            EE_Question::new_instance(
622
-                array(
623
-                    'QST_ID'           => 0,
624
-                    'QST_display_text' => esc_html__('Select Country', 'event_espresso'),
625
-                    'QST_system'       => 'admin-country',
626
-                )
627
-            ),
628
-            EE_Answer::new_instance(
629
-                array(
630
-                    'ANS_ID'    => 0,
631
-                    'ANS_value' => $CNT_ISO,
632
-                )
633
-            ),
634
-            array(
635
-                'input_id'       => 'country',
636
-                'input_name'     => 'country',
637
-                'input_prefix'   => '',
638
-                'append_qstn_id' => false,
639
-            )
640
-        );
641
-        $country = $this->verifyOrGetCountryFromIso($CNT_ISO_for_site);
642
-        add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
643
-        add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
644
-        $this->_template_args['country_details_settings'] = $this->display_country_settings(
645
-            $country->ID(),
646
-            $country
647
-        );
648
-        $this->_template_args['country_states_settings'] = $this->display_country_states(
649
-            $country->ID(),
650
-            $country
651
-        );
652
-        $this->_template_args['CNT_name_for_site'] = $country->name();
653
-
654
-        $this->_set_add_edit_form_tags('update_country_settings');
655
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
656
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
657
-            GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php',
658
-            $this->_template_args,
659
-            true
660
-        );
661
-        $this->display_admin_page_with_no_sidebar();
662
-    }
663
-
664
-
665
-    /**
666
-     *        display_country_settings
667
-     *
668
-     * @param string          $CNT_ISO
669
-     * @param EE_Country|null $country
670
-     * @return mixed string | array$country
671
-     * @throws DomainException
672
-     * @throws EE_Error
673
-     * @throws InvalidArgumentException
674
-     * @throws InvalidDataTypeException
675
-     * @throws InvalidInterfaceException
676
-     * @throws ReflectionException
677
-     */
678
-    public function display_country_settings($CNT_ISO = '', EE_Country $country = null)
679
-    {
680
-        $CNT_ISO_for_site = $this->getCountryIsoForSite();
681
-
682
-        $CNT_ISO = isset($this->_req_data['country'])
683
-            ? strtoupper(sanitize_text_field($this->_req_data['country']))
684
-            : $CNT_ISO;
685
-        if (! $CNT_ISO) {
686
-            return '';
687
-        }
688
-
689
-        // for ajax
690
-        remove_all_filters('FHEE__EEH_Form_Fields__label_html');
691
-        remove_all_filters('FHEE__EEH_Form_Fields__input_html');
692
-        add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
693
-        add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
694
-        $country = $this->verifyOrGetCountryFromIso($CNT_ISO, $country);
695
-        $CNT_cur_disabled = $CNT_ISO !== $CNT_ISO_for_site;
696
-        $this->_template_args['CNT_cur_disabled'] = $CNT_cur_disabled;
697
-
698
-        $country_input_types = array(
699
-            'CNT_active'      => array(
700
-                'type'             => 'RADIO_BTN',
701
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
702
-                'class'            => '',
703
-                'options'          => $this->_yes_no_values,
704
-                'use_desc_4_label' => true,
705
-            ),
706
-            'CNT_ISO'         => array(
707
-                'type'       => 'TEXT',
708
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
709
-                'class'      => 'small-text',
710
-            ),
711
-            'CNT_ISO3'        => array(
712
-                'type'       => 'TEXT',
713
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
714
-                'class'      => 'small-text',
715
-            ),
716
-            'RGN_ID'          => array(
717
-                'type'       => 'TEXT',
718
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
719
-                'class'      => 'small-text',
720
-            ),
721
-            'CNT_name'        => array(
722
-                'type'       => 'TEXT',
723
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
724
-                'class'      => 'regular-text',
725
-            ),
726
-            'CNT_cur_code'    => array(
727
-                'type'       => 'TEXT',
728
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
729
-                'class'      => 'small-text',
730
-                'disabled'   => $CNT_cur_disabled,
731
-            ),
732
-            'CNT_cur_single'  => array(
733
-                'type'       => 'TEXT',
734
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
735
-                'class'      => 'medium-text',
736
-                'disabled'   => $CNT_cur_disabled,
737
-            ),
738
-            'CNT_cur_plural'  => array(
739
-                'type'       => 'TEXT',
740
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
741
-                'class'      => 'medium-text',
742
-                'disabled'   => $CNT_cur_disabled,
743
-            ),
744
-            'CNT_cur_sign'    => array(
745
-                'type'         => 'TEXT',
746
-                'input_name'   => 'cntry[' . $CNT_ISO . ']',
747
-                'class'        => 'small-text',
748
-                'htmlentities' => false,
749
-                'disabled'     => $CNT_cur_disabled,
750
-            ),
751
-            'CNT_cur_sign_b4' => array(
752
-                'type'             => 'RADIO_BTN',
753
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
754
-                'class'            => '',
755
-                'options'          => $this->_yes_no_values,
756
-                'use_desc_4_label' => true,
757
-                'disabled'         => $CNT_cur_disabled,
758
-            ),
759
-            'CNT_cur_dec_plc' => array(
760
-                'type'       => 'RADIO_BTN',
761
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
762
-                'class'      => '',
763
-                'options'    => array(
764
-                    array('id' => 0, 'text' => ''),
765
-                    array('id' => 1, 'text' => ''),
766
-                    array('id' => 2, 'text' => ''),
767
-                    array('id' => 3, 'text' => ''),
768
-                ),
769
-                'disabled'   => $CNT_cur_disabled,
770
-            ),
771
-            'CNT_cur_dec_mrk' => array(
772
-                'type'             => 'RADIO_BTN',
773
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
774
-                'class'            => '',
775
-                'options'          => array(
776
-                    array(
777
-                        'id'   => ',',
778
-                        'text' => esc_html__(', (comma)', 'event_espresso'),
779
-                    ),
780
-                    array('id' => '.', 'text' => esc_html__('. (decimal)', 'event_espresso')),
781
-                ),
782
-                'use_desc_4_label' => true,
783
-                'disabled'         => $CNT_cur_disabled,
784
-            ),
785
-            'CNT_cur_thsnds'  => array(
786
-                'type'             => 'RADIO_BTN',
787
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
788
-                'class'            => '',
789
-                'options'          => array(
790
-                    array(
791
-                        'id'   => ',',
792
-                        'text' => esc_html__(', (comma)', 'event_espresso'),
793
-                    ),
794
-                    array(
795
-                        'id' => '.',
796
-                        'text' => esc_html__('. (decimal)', 'event_espresso')
797
-                    ),
798
-                    array(
799
-                        'id' => '&nbsp;',
800
-                        'text' => esc_html__('(space)', 'event_espresso')
801
-                    )
802
-                ),
803
-                'use_desc_4_label' => true,
804
-                'disabled'         => $CNT_cur_disabled,
805
-            ),
806
-            'CNT_tel_code'    => array(
807
-                'type'       => 'TEXT',
808
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
809
-                'class'      => 'small-text',
810
-            ),
811
-            'CNT_is_EU'       => array(
812
-                'type'             => 'RADIO_BTN',
813
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
814
-                'class'            => '',
815
-                'options'          => $this->_yes_no_values,
816
-                'use_desc_4_label' => true,
817
-            ),
818
-        );
819
-        $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object(
820
-            $country,
821
-            $country_input_types
822
-        );
823
-        $country_details_settings = EEH_Template::display_template(
824
-            GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php',
825
-            $this->_template_args,
826
-            true
827
-        );
828
-
829
-        if (defined('DOING_AJAX')) {
830
-            $notices = EE_Error::get_notices(false, false, false);
831
-            echo wp_json_encode(
832
-                array(
833
-                    'return_data' => $country_details_settings,
834
-                    'success'     => $notices['success'],
835
-                    'errors'      => $notices['errors'],
836
-                )
837
-            );
838
-            die();
839
-        } else {
840
-            return $country_details_settings;
841
-        }
842
-    }
843
-
844
-
845
-    /**
846
-     * @param string          $CNT_ISO
847
-     * @param EE_Country|null $country
848
-     * @return string
849
-     * @throws DomainException
850
-     * @throws EE_Error
851
-     * @throws InvalidArgumentException
852
-     * @throws InvalidDataTypeException
853
-     * @throws InvalidInterfaceException
854
-     * @throws ReflectionException
855
-     */
856
-    public function display_country_states($CNT_ISO = '', EE_Country $country = null)
857
-    {
858
-
859
-        $CNT_ISO = isset($this->_req_data['country'])
860
-            ? sanitize_text_field($this->_req_data['country'])
861
-            : $CNT_ISO;
862
-        if (! $CNT_ISO) {
863
-            return '';
864
-        }
865
-        // for ajax
866
-        remove_all_filters('FHEE__EEH_Form_Fields__label_html');
867
-        remove_all_filters('FHEE__EEH_Form_Fields__input_html');
868
-        add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2);
869
-        add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2);
870
-        $states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO));
871
-        if (empty($states)) {
872
-            /** @var EventEspresso\core\services\address\CountrySubRegionDao $countrySubRegionDao */
873
-            $countrySubRegionDao = $this->loader->getShared(
874
-                'EventEspresso\core\services\address\CountrySubRegionDao'
875
-            );
876
-            if ($countrySubRegionDao instanceof EventEspresso\core\services\address\CountrySubRegionDao) {
877
-                $country = $this->verifyOrGetCountryFromIso($CNT_ISO, $country);
878
-                if ($countrySubRegionDao->saveCountrySubRegions($country)) {
879
-                    $states = EEM_State::instance()->get_all_states_for_these_countries(
880
-                        array($CNT_ISO => $CNT_ISO)
881
-                    );
882
-                }
883
-            }
884
-        }
885
-        if (is_array($states)) {
886
-            foreach ($states as $STA_ID => $state) {
887
-                if ($state instanceof EE_State) {
888
-                    // STA_abbrev    STA_name    STA_active
889
-                    $state_input_types = array(
890
-                        'STA_abbrev' => array(
891
-                            'type'       => 'TEXT',
892
-                            'input_name' => 'states[' . $STA_ID . ']',
893
-                            'class'      => 'mid-text',
894
-                        ),
895
-                        'STA_name'   => array(
896
-                            'type'       => 'TEXT',
897
-                            'input_name' => 'states[' . $STA_ID . ']',
898
-                            'class'      => 'regular-text',
899
-                        ),
900
-                        'STA_active' => array(
901
-                            'type'             => 'RADIO_BTN',
902
-                            'input_name'       => 'states[' . $STA_ID . ']',
903
-                            'options'          => $this->_yes_no_values,
904
-                            'use_desc_4_label' => true,
905
-                        ),
906
-                    );
907
-                    $this->_template_args['states'][ $STA_ID ]['inputs'] =
908
-                        EE_Question_Form_Input::generate_question_form_inputs_for_object(
909
-                            $state,
910
-                            $state_input_types
911
-                        );
912
-                    $query_args = array(
913
-                        'action'     => 'delete_state',
914
-                        'STA_ID'     => $STA_ID,
915
-                        'CNT_ISO'    => $CNT_ISO,
916
-                        'STA_abbrev' => $state->abbrev(),
917
-                    );
918
-                    $this->_template_args['states'][ $STA_ID ]['delete_state_url'] =
919
-                        EE_Admin_Page::add_query_args_and_nonce(
920
-                            $query_args,
921
-                            GEN_SET_ADMIN_URL
922
-                        );
923
-                }
924
-            }
925
-        } else {
926
-            $this->_template_args['states'] = false;
927
-        }
928
-
929
-        $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(
930
-            array('action' => 'add_new_state'),
931
-            GEN_SET_ADMIN_URL
932
-        );
933
-
934
-        $state_details_settings = EEH_Template::display_template(
935
-            GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php',
936
-            $this->_template_args,
937
-            true
938
-        );
939
-
940
-        if (defined('DOING_AJAX')) {
941
-            $notices = EE_Error::get_notices(false, false, false);
942
-            echo wp_json_encode(
943
-                array(
944
-                    'return_data' => $state_details_settings,
945
-                    'success'     => $notices['success'],
946
-                    'errors'      => $notices['errors'],
947
-                )
948
-            );
949
-            die();
950
-        } else {
951
-            return $state_details_settings;
952
-        }
953
-    }
954
-
955
-
956
-    /**
957
-     *        add_new_state
958
-     *
959
-     * @access    public
960
-     * @return void
961
-     * @throws EE_Error
962
-     * @throws InvalidArgumentException
963
-     * @throws InvalidDataTypeException
964
-     * @throws InvalidInterfaceException
965
-     */
966
-    public function add_new_state()
967
-    {
968
-
969
-        $success = true;
970
-
971
-        $CNT_ISO = isset($this->_req_data['CNT_ISO'])
972
-            ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO']))
973
-            : false;
974
-        if (! $CNT_ISO) {
975
-            EE_Error::add_error(
976
-                esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'),
977
-                __FILE__,
978
-                __FUNCTION__,
979
-                __LINE__
980
-            );
981
-            $success = false;
982
-        }
983
-        $STA_abbrev = isset($this->_req_data['STA_abbrev'])
984
-            ? sanitize_text_field($this->_req_data['STA_abbrev'])
985
-            : false;
986
-        if (! $STA_abbrev) {
987
-            EE_Error::add_error(
988
-                esc_html__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'),
989
-                __FILE__,
990
-                __FUNCTION__,
991
-                __LINE__
992
-            );
993
-            $success = false;
994
-        }
995
-        $STA_name = isset($this->_req_data['STA_name'])
996
-            ? sanitize_text_field($this->_req_data['STA_name'])
997
-            : false;
998
-        if (! $STA_name) {
999
-            EE_Error::add_error(
1000
-                esc_html__('No State name or an invalid State name was received.', 'event_espresso'),
1001
-                __FILE__,
1002
-                __FUNCTION__,
1003
-                __LINE__
1004
-            );
1005
-            $success = false;
1006
-        }
1007
-
1008
-        if ($success) {
1009
-            $cols_n_values = array(
1010
-                'CNT_ISO'    => $CNT_ISO,
1011
-                'STA_abbrev' => $STA_abbrev,
1012
-                'STA_name'   => $STA_name,
1013
-                'STA_active' => true,
1014
-            );
1015
-            $success = EEM_State::instance()->insert($cols_n_values);
1016
-            EE_Error::add_success(esc_html__('The State was added successfully.', 'event_espresso'));
1017
-        }
1018
-
1019
-        if (defined('DOING_AJAX')) {
1020
-            $notices = EE_Error::get_notices(false, false, false);
1021
-            echo wp_json_encode(array_merge($notices, array('return_data' => $CNT_ISO)));
1022
-            die();
1023
-        } else {
1024
-            $this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings'));
1025
-        }
1026
-    }
1027
-
1028
-
1029
-    /**
1030
-     *        delete_state
1031
-     *
1032
-     * @access    public
1033
-     * @return        boolean
1034
-     * @throws EE_Error
1035
-     * @throws InvalidArgumentException
1036
-     * @throws InvalidDataTypeException
1037
-     * @throws InvalidInterfaceException
1038
-     */
1039
-    public function delete_state()
1040
-    {
1041
-        $CNT_ISO = isset($this->_req_data['CNT_ISO'])
1042
-            ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO']))
1043
-            : false;
1044
-        $STA_ID = isset($this->_req_data['STA_ID'])
1045
-            ? sanitize_text_field($this->_req_data['STA_ID'])
1046
-            : false;
1047
-        $STA_abbrev = isset($this->_req_data['STA_abbrev'])
1048
-            ? sanitize_text_field($this->_req_data['STA_abbrev'])
1049
-            : false;
1050
-        if (! $STA_ID) {
1051
-            EE_Error::add_error(
1052
-                esc_html__('No State ID or an invalid State ID was received.', 'event_espresso'),
1053
-                __FILE__,
1054
-                __FUNCTION__,
1055
-                __LINE__
1056
-            );
1057
-            return false;
1058
-        }
1059
-
1060
-        $success = EEM_State::instance()->delete_by_ID($STA_ID);
1061
-        if ($success !== false) {
1062
-            do_action(
1063
-                'AHEE__General_Settings_Admin_Page__delete_state__state_deleted',
1064
-                $CNT_ISO,
1065
-                $STA_ID,
1066
-                array('STA_abbrev' => $STA_abbrev)
1067
-            );
1068
-            EE_Error::add_success(esc_html__('The State was deleted successfully.', 'event_espresso'));
1069
-        }
1070
-        if (defined('DOING_AJAX')) {
1071
-            $notices = EE_Error::get_notices(false, false);
1072
-            $notices['return_data'] = true;
1073
-            echo wp_json_encode($notices);
1074
-            die();
1075
-        } else {
1076
-            $this->_redirect_after_action(
1077
-                $success,
1078
-                'State',
1079
-                'deleted',
1080
-                array('action' => 'country_settings')
1081
-            );
1082
-        }
1083
-    }
1084
-
1085
-
1086
-    /**
1087
-     *        _update_country_settings
1088
-     *
1089
-     * @access    protected
1090
-     * @return void
1091
-     * @throws EE_Error
1092
-     * @throws InvalidArgumentException
1093
-     * @throws InvalidDataTypeException
1094
-     * @throws InvalidInterfaceException
1095
-     */
1096
-    protected function _update_country_settings()
1097
-    {
1098
-        // grab the country ISO code
1099
-        $CNT_ISO = isset($this->_req_data['country'])
1100
-            ? strtoupper(sanitize_text_field($this->_req_data['country']))
1101
-            : false;
1102
-        if (! $CNT_ISO) {
1103
-            EE_Error::add_error(
1104
-                esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'),
1105
-                __FILE__,
1106
-                __FUNCTION__,
1107
-                __LINE__
1108
-            );
1109
-
1110
-            return;
1111
-        }
1112
-        $cols_n_values = array();
1113
-        $cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_ISO3'])
1114
-            ? strtoupper(sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_ISO3']))
1115
-            : false;
1116
-        $cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['RGN_ID'])
1117
-            ? absint($this->_req_data['cntry'][ $CNT_ISO ]['RGN_ID'])
1118
-            : null;
1119
-        $cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_name'])
1120
-            ? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_name'])
1121
-            : null;
1122
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_code'])) {
1123
-            $cols_n_values['CNT_cur_code'] = strtoupper(
1124
-                sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_code'])
1125
-            );
1126
-        }
1127
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_single'])) {
1128
-            $cols_n_values['CNT_cur_single'] = sanitize_text_field(
1129
-                $this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_single']
1130
-            );
1131
-        }
1132
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_plural'])) {
1133
-            $cols_n_values['CNT_cur_plural'] = sanitize_text_field(
1134
-                $this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_plural']
1135
-            );
1136
-        }
1137
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign'])) {
1138
-            $cols_n_values['CNT_cur_sign'] = sanitize_text_field(
1139
-                $this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign']
1140
-            );
1141
-        }
1142
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign_b4'])) {
1143
-            $cols_n_values['CNT_cur_sign_b4'] = absint(
1144
-                $this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign_b4']
1145
-            );
1146
-        }
1147
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_plc'])) {
1148
-            $cols_n_values['CNT_cur_dec_plc'] = absint(
1149
-                $this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_plc']
1150
-            );
1151
-        }
1152
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_mrk'])) {
1153
-            $cols_n_values['CNT_cur_dec_mrk'] = sanitize_text_field(
1154
-                $this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_mrk']
1155
-            );
1156
-        }
1157
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_thsnds'])) {
1158
-            $cols_n_values['CNT_cur_thsnds'] = sanitize_text_field(
1159
-                $this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_thsnds']
1160
-            );
1161
-        }
1162
-        $cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_tel_code'])
1163
-            ? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_tel_code'])
1164
-            : null;
1165
-        $cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_is_EU'])
1166
-            ? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_is_EU'])
1167
-            : false;
1168
-        $cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_active'])
1169
-            ? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_active'])
1170
-            : false;
1171
-        // allow filtering of country data
1172
-        $cols_n_values = apply_filters(
1173
-            'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values',
1174
-            $cols_n_values
1175
-        );
1176
-
1177
-        // where values
1178
-        $where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO));
1179
-        // run the update
1180
-        $success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values);
1181
-
1182
-        if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== false) {
1183
-            // allow filtering of states data
1184
-            $states = apply_filters(
1185
-                'FHEE__General_Settings_Admin_Page___update_country_settings__states',
1186
-                $this->_req_data['states']
1187
-            );
1188
-
1189
-            // loop thru state data ( looks like : states[75][STA_name] )
1190
-            foreach ($states as $STA_ID => $state) {
1191
-                $cols_n_values = array(
1192
-                    'CNT_ISO'    => $CNT_ISO,
1193
-                    'STA_abbrev' => sanitize_text_field($state['STA_abbrev']),
1194
-                    'STA_name'   => sanitize_text_field($state['STA_name']),
1195
-                    'STA_active' => (bool) absint($state['STA_active']),
1196
-                );
1197
-                // where values
1198
-                $where_cols_n_values = array(array('STA_ID' => $STA_ID));
1199
-                // run the update
1200
-                $success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values);
1201
-                if ($success !== false) {
1202
-                    do_action(
1203
-                        'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved',
1204
-                        $CNT_ISO,
1205
-                        $STA_ID,
1206
-                        $cols_n_values
1207
-                    );
1208
-                }
1209
-            }
1210
-        }
1211
-        // check if country being edited matches org option country, and if so, then  update EE_Config with new settings
1212
-        if (
1213
-            isset(EE_Registry::instance()->CFG->organization->CNT_ISO)
1214
-            && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO
1215
-        ) {
1216
-            EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO);
1217
-            EE_Registry::instance()->CFG->update_espresso_config();
1218
-        }
1219
-
1220
-        if ($success !== false) {
1221
-            EE_Error::add_success(
1222
-                esc_html__('Country Settings updated successfully.', 'event_espresso')
1223
-            );
1224
-        }
1225
-        $this->_redirect_after_action(
1226
-            $success,
1227
-            '',
1228
-            '',
1229
-            array('action' => 'country_settings', 'country' => $CNT_ISO),
1230
-            true
1231
-        );
1232
-    }
1233
-
1234
-
1235
-    /**
1236
-     *        form_form_field_label_wrap
1237
-     *
1238
-     * @access        public
1239
-     * @param        string $label
1240
-     * @return        string
1241
-     */
1242
-    public function country_form_field_label_wrap($label, $required_text)
1243
-    {
1244
-        return '
23
+	/**
24
+	 * _question_group
25
+	 * holds the specific question group object for the question group details screen
26
+	 *
27
+	 * @var object
28
+	 */
29
+	protected $_question_group;
30
+
31
+
32
+	/**
33
+	 * Initialize basic properties.
34
+	 */
35
+	protected function _init_page_props()
36
+	{
37
+		$this->page_slug = GEN_SET_PG_SLUG;
38
+		$this->page_label = GEN_SET_LABEL;
39
+		$this->_admin_base_url = GEN_SET_ADMIN_URL;
40
+		$this->_admin_base_path = GEN_SET_ADMIN;
41
+	}
42
+
43
+
44
+	/**
45
+	 * Set ajax hooks
46
+	 */
47
+	protected function _ajax_hooks()
48
+	{
49
+		add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings'));
50
+		add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states'));
51
+		add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3);
52
+		add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state'));
53
+	}
54
+
55
+
56
+	/**
57
+	 * More page properties initialization.
58
+	 */
59
+	protected function _define_page_props()
60
+	{
61
+		$this->_admin_page_title = GEN_SET_LABEL;
62
+		$this->_labels = array(
63
+			'publishbox' => esc_html__('Update Settings', 'event_espresso'),
64
+		);
65
+	}
66
+
67
+
68
+	/**
69
+	 * Set page routes property.
70
+	 */
71
+	protected function _set_page_routes()
72
+	{
73
+		$this->_page_routes = array(
74
+
75
+			'critical_pages'                => array(
76
+				'func'       => '_espresso_page_settings',
77
+				'capability' => 'manage_options',
78
+			),
79
+			'update_espresso_page_settings' => array(
80
+				'func'       => '_update_espresso_page_settings',
81
+				'capability' => 'manage_options',
82
+				'noheader'   => true,
83
+			),
84
+			'default'                       => array(
85
+				'func'       => '_your_organization_settings',
86
+				'capability' => 'manage_options',
87
+			),
88
+
89
+			'update_your_organization_settings' => array(
90
+				'func'       => '_update_your_organization_settings',
91
+				'capability' => 'manage_options',
92
+				'noheader'   => true,
93
+			),
94
+
95
+			'admin_option_settings' => array(
96
+				'func'       => '_admin_option_settings',
97
+				'capability' => 'manage_options',
98
+			),
99
+
100
+			'update_admin_option_settings' => array(
101
+				'func'       => '_update_admin_option_settings',
102
+				'capability' => 'manage_options',
103
+				'noheader'   => true,
104
+			),
105
+
106
+			'country_settings' => array(
107
+				'func'       => '_country_settings',
108
+				'capability' => 'manage_options',
109
+			),
110
+
111
+			'update_country_settings' => array(
112
+				'func'       => '_update_country_settings',
113
+				'capability' => 'manage_options',
114
+				'noheader'   => true,
115
+			),
116
+
117
+			'display_country_settings' => array(
118
+				'func'       => 'display_country_settings',
119
+				'capability' => 'manage_options',
120
+				'noheader'   => true,
121
+			),
122
+
123
+			'add_new_state' => array(
124
+				'func'       => 'add_new_state',
125
+				'capability' => 'manage_options',
126
+				'noheader'   => true,
127
+			),
128
+
129
+			'delete_state'            => array(
130
+				'func'       => 'delete_state',
131
+				'capability' => 'manage_options',
132
+				'noheader'   => true,
133
+			),
134
+			'privacy_settings'        => array(
135
+				'func'       => 'privacySettings',
136
+				'capability' => 'manage_options',
137
+			),
138
+			'update_privacy_settings' => array(
139
+				'func'               => 'updatePrivacySettings',
140
+				'capability'         => 'manage_options',
141
+				'noheader'           => true,
142
+				'headers_sent_route' => 'privacy_settings',
143
+			),
144
+		);
145
+	}
146
+
147
+
148
+	/**
149
+	 * Set page configuration property
150
+	 */
151
+	protected function _set_page_config()
152
+	{
153
+		$this->_page_config = array(
154
+			'critical_pages'        => array(
155
+				'nav'           => array(
156
+					'label' => esc_html__('Critical Pages', 'event_espresso'),
157
+					'order' => 50,
158
+				),
159
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
160
+				'help_tabs'     => array(
161
+					'general_settings_critical_pages_help_tab' => array(
162
+						'title'    => esc_html__('Critical Pages', 'event_espresso'),
163
+						'filename' => 'general_settings_critical_pages',
164
+					),
165
+				),
166
+				// disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
167
+				// 'help_tour'     => array('Critical_Pages_Help_Tour'),
168
+				'require_nonce' => false,
169
+			),
170
+			'default'               => array(
171
+				'nav'           => array(
172
+					'label' => esc_html__('Your Organization', 'event_espresso'),
173
+					'order' => 20,
174
+				),
175
+				'help_tabs'     => array(
176
+					'general_settings_your_organization_help_tab' => array(
177
+						'title'    => esc_html__('Your Organization', 'event_espresso'),
178
+						'filename' => 'general_settings_your_organization',
179
+					),
180
+				),
181
+				// disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
182
+				// 'help_tour'     => array('Your_Organization_Help_Tour'),
183
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
184
+				'require_nonce' => false,
185
+			),
186
+			'admin_option_settings' => array(
187
+				'nav'           => array(
188
+					'label' => esc_html__('Admin Options', 'event_espresso'),
189
+					'order' => 60,
190
+				),
191
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
192
+				'help_tabs'     => array(
193
+					'general_settings_admin_options_help_tab' => array(
194
+						'title'    => esc_html__('Admin Options', 'event_espresso'),
195
+						'filename' => 'general_settings_admin_options',
196
+					),
197
+				),
198
+				// disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
199
+				// 'help_tour'     => array('Admin_Options_Help_Tour'),
200
+				'require_nonce' => false,
201
+			),
202
+			'country_settings'      => array(
203
+				'nav'           => array(
204
+					'label' => esc_html__('Countries', 'event_espresso'),
205
+					'order' => 70,
206
+				),
207
+				'help_tabs'     => array(
208
+					'general_settings_countries_help_tab' => array(
209
+						'title'    => esc_html__('Countries', 'event_espresso'),
210
+						'filename' => 'general_settings_countries',
211
+					),
212
+				),
213
+				// disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
214
+				// 'help_tour'     => array('Countries_Help_Tour'),
215
+				'require_nonce' => false,
216
+			),
217
+			'privacy_settings'      => array(
218
+				'nav'           => array(
219
+					'label' => esc_html__('Privacy', 'event_espresso'),
220
+					'order' => 80,
221
+				),
222
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
223
+				'require_nonce' => false,
224
+			),
225
+		);
226
+	}
227
+
228
+
229
+	protected function _add_screen_options()
230
+	{
231
+	}
232
+
233
+
234
+	protected function _add_feature_pointers()
235
+	{
236
+	}
237
+
238
+
239
+	/**
240
+	 * Enqueue global scripts and styles for all routes in the General Settings Admin Pages.
241
+	 */
242
+	public function load_scripts_styles()
243
+	{
244
+		// styles
245
+		wp_enqueue_style('espresso-ui-theme');
246
+		// scripts
247
+		wp_enqueue_script('ee_admin_js');
248
+	}
249
+
250
+
251
+	/**
252
+	 * Execute logic running on `admin_init`
253
+	 */
254
+	public function admin_init()
255
+	{
256
+		EE_Registry::$i18n_js_strings['invalid_server_response'] = wp_strip_all_tags(__(
257
+			'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.',
258
+			'event_espresso'
259
+		));
260
+		EE_Registry::$i18n_js_strings['error_occurred'] = wp_strip_all_tags(__(
261
+			'An error occurred! Please refresh the page and try again.',
262
+			'event_espresso'
263
+		));
264
+		EE_Registry::$i18n_js_strings['confirm_delete_state'] = wp_strip_all_tags(__(
265
+			'Are you sure you want to delete this State / Province?',
266
+			'event_espresso'
267
+		));
268
+		$protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
269
+		EE_Registry::$i18n_js_strings['ajax_url'] = admin_url(
270
+			'admin-ajax.php?page=espresso_general_settings',
271
+			$protocol
272
+		);
273
+	}
274
+
275
+
276
+	public function admin_notices()
277
+	{
278
+	}
279
+
280
+
281
+	public function admin_footer_scripts()
282
+	{
283
+	}
284
+
285
+
286
+	/**
287
+	 * Enqueue scripts and styles for the default route.
288
+	 */
289
+	public function load_scripts_styles_default()
290
+	{
291
+		// styles
292
+		wp_enqueue_style('thickbox');
293
+		// scripts
294
+		wp_enqueue_script('media-upload');
295
+		wp_enqueue_script('thickbox');
296
+		wp_register_script(
297
+			'organization_settings',
298
+			GEN_SET_ASSETS_URL . 'your_organization_settings.js',
299
+			array('jquery', 'media-upload', 'thickbox'),
300
+			EVENT_ESPRESSO_VERSION,
301
+			true
302
+		);
303
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
304
+		wp_enqueue_script('organization_settings');
305
+		wp_enqueue_style('organization-css');
306
+		$confirm_image_delete = array(
307
+			'text' => wp_strip_all_tags(
308
+				__(
309
+					'Do you really want to delete this image? Please remember to save your settings to complete the removal.',
310
+					'event_espresso'
311
+				)
312
+			),
313
+		);
314
+		wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete);
315
+	}
316
+
317
+
318
+	/**
319
+	 * Enqueue scripts and styles for the country settings route.
320
+	 */
321
+	public function load_scripts_styles_country_settings()
322
+	{
323
+		// scripts
324
+		wp_register_script(
325
+			'gen_settings_countries',
326
+			GEN_SET_ASSETS_URL . 'gen_settings_countries.js',
327
+			array('ee_admin_js'),
328
+			EVENT_ESPRESSO_VERSION,
329
+			true
330
+		);
331
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
332
+		wp_enqueue_script('gen_settings_countries');
333
+		wp_enqueue_style('organization-css');
334
+	}
335
+
336
+
337
+	/*************        Espresso Pages        *************/
338
+	/**
339
+	 * _espresso_page_settings
340
+	 *
341
+	 * @throws \EE_Error
342
+	 * @throws DomainException
343
+	 * @throws DomainException
344
+	 * @throws InvalidDataTypeException
345
+	 * @throws InvalidArgumentException
346
+	 */
347
+	protected function _espresso_page_settings()
348
+	{
349
+		// Check to make sure all of the main pages are setup properly,
350
+		// if not create the default pages and display an admin notice
351
+		EEH_Activation::verify_default_pages_exist();
352
+		$this->_transient_garbage_collection();
353
+		$this->_template_args['values'] = $this->_yes_no_values;
354
+		$this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id)
355
+			? EE_Registry::instance()->CFG->core->reg_page_id
356
+			: null;
357
+		$this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id)
358
+			? get_page(EE_Registry::instance()->CFG->core->reg_page_id)
359
+			: false;
360
+		$this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id)
361
+			? EE_Registry::instance()->CFG->core->txn_page_id
362
+			: null;
363
+		$this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id)
364
+			? get_page(EE_Registry::instance()->CFG->core->txn_page_id)
365
+			: false;
366
+		$this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id)
367
+			? EE_Registry::instance()->CFG->core->thank_you_page_id
368
+			: null;
369
+		$this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id)
370
+			? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id)
371
+			: false;
372
+		$this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id)
373
+			? EE_Registry::instance()->CFG->core->cancel_page_id
374
+			: null;
375
+		$this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id)
376
+			? get_page(EE_Registry::instance()->CFG->core->cancel_page_id)
377
+			: false;
378
+		$this->_set_add_edit_form_tags('update_espresso_page_settings');
379
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
380
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
381
+			GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php',
382
+			$this->_template_args,
383
+			true
384
+		);
385
+		$this->display_admin_page_with_sidebar();
386
+	}
387
+
388
+
389
+	/**
390
+	 * Handler for updating espresso page settings.
391
+	 *
392
+	 * @throws EE_Error
393
+	 */
394
+	protected function _update_espresso_page_settings()
395
+	{
396
+		// capture incoming request data && set page IDs
397
+		EE_Registry::instance()->CFG->core->reg_page_id = isset($this->_req_data['reg_page_id'])
398
+			? absint($this->_req_data['reg_page_id'])
399
+			: EE_Registry::instance()->CFG->core->reg_page_id;
400
+		EE_Registry::instance()->CFG->core->txn_page_id = isset($this->_req_data['txn_page_id'])
401
+			? absint($this->_req_data['txn_page_id'])
402
+			: EE_Registry::instance()->CFG->core->txn_page_id;
403
+		EE_Registry::instance()->CFG->core->thank_you_page_id = isset($this->_req_data['thank_you_page_id'])
404
+			? absint($this->_req_data['thank_you_page_id'])
405
+			: EE_Registry::instance()->CFG->core->thank_you_page_id;
406
+		EE_Registry::instance()->CFG->core->cancel_page_id = isset($this->_req_data['cancel_page_id'])
407
+			? absint($this->_req_data['cancel_page_id'])
408
+			: EE_Registry::instance()->CFG->core->cancel_page_id;
409
+
410
+		EE_Registry::instance()->CFG->core = apply_filters(
411
+			'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core',
412
+			EE_Registry::instance()->CFG->core,
413
+			$this->_req_data
414
+		);
415
+		$what = esc_html__('Critical Pages & Shortcodes', 'event_espresso');
416
+		$this->_redirect_after_action(
417
+			$this->_update_espresso_configuration(
418
+				$what,
419
+				EE_Registry::instance()->CFG->core,
420
+				__FILE__,
421
+				__FUNCTION__,
422
+				__LINE__
423
+			),
424
+			$what,
425
+			'',
426
+			array(
427
+				'action' => 'critical_pages',
428
+			),
429
+			true
430
+		);
431
+	}
432
+
433
+
434
+	/*************        Your Organization        *************/
435
+
436
+
437
+	/**
438
+	 * @throws DomainException
439
+	 * @throws EE_Error
440
+	 * @throws InvalidArgumentException
441
+	 * @throws InvalidDataTypeException
442
+	 * @throws InvalidInterfaceException
443
+	 */
444
+	protected function _your_organization_settings()
445
+	{
446
+		$this->_template_args['admin_page_content'] = '';
447
+		try {
448
+			/** @var EventEspresso\admin_pages\general_settings\OrganizationSettings $organization_settings_form */
449
+			$organization_settings_form = $this->loader->getShared(
450
+				'EventEspresso\admin_pages\general_settings\OrganizationSettings'
451
+			);
452
+			$this->_template_args['admin_page_content'] = $organization_settings_form->display();
453
+		} catch (Exception $e) {
454
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
455
+		}
456
+		$this->_set_add_edit_form_tags('update_your_organization_settings');
457
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
458
+		$this->display_admin_page_with_sidebar();
459
+	}
460
+
461
+
462
+	/**
463
+	 * Handler for updating organization settings.
464
+	 *
465
+	 * @throws EE_Error
466
+	 */
467
+	protected function _update_your_organization_settings()
468
+	{
469
+		try {
470
+			/** @var EventEspresso\admin_pages\general_settings\OrganizationSettings $organization_settings_form */
471
+			$organization_settings_form = $this->loader->getShared(
472
+				'EventEspresso\admin_pages\general_settings\OrganizationSettings'
473
+			);
474
+			$success = $organization_settings_form->process($this->_req_data);
475
+			EE_Registry::instance()->CFG = apply_filters(
476
+				'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG',
477
+				EE_Registry::instance()->CFG
478
+			);
479
+		} catch (Exception $e) {
480
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
481
+			$success = false;
482
+		}
483
+
484
+		if ($success) {
485
+			$success = $this->_update_espresso_configuration(
486
+				esc_html__('Your Organization Settings', 'event_espresso'),
487
+				EE_Registry::instance()->CFG,
488
+				__FILE__,
489
+				__FUNCTION__,
490
+				__LINE__
491
+			);
492
+		}
493
+
494
+		$this->_redirect_after_action($success, '', '', array('action' => 'default'), true);
495
+	}
496
+
497
+
498
+
499
+	/*************        Admin Options        *************/
500
+
501
+
502
+	/**
503
+	 * _admin_option_settings
504
+	 *
505
+	 * @throws \EE_Error
506
+	 * @throws \LogicException
507
+	 */
508
+	protected function _admin_option_settings()
509
+	{
510
+		$this->_template_args['admin_page_content'] = '';
511
+		try {
512
+			$admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
513
+			// still need this for the old school form in Extend_General_Settings_Admin_Page
514
+			$this->_template_args['values'] = $this->_yes_no_values;
515
+			// also need to account for the do_action that was in the old template
516
+			$admin_options_settings_form->setTemplateArgs($this->_template_args);
517
+			$this->_template_args['admin_page_content'] = $admin_options_settings_form->display();
518
+		} catch (Exception $e) {
519
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
520
+		}
521
+		$this->_set_add_edit_form_tags('update_admin_option_settings');
522
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
523
+		$this->display_admin_page_with_sidebar();
524
+	}
525
+
526
+
527
+	/**
528
+	 * _update_admin_option_settings
529
+	 *
530
+	 * @throws \EE_Error
531
+	 * @throws InvalidDataTypeException
532
+	 * @throws \EventEspresso\core\exceptions\InvalidFormSubmissionException
533
+	 * @throws \InvalidArgumentException
534
+	 * @throws \LogicException
535
+	 */
536
+	protected function _update_admin_option_settings()
537
+	{
538
+		try {
539
+			$admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
540
+			$admin_options_settings_form->process($this->_req_data[ $admin_options_settings_form->slug() ]);
541
+			EE_Registry::instance()->CFG->admin = apply_filters(
542
+				'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin',
543
+				EE_Registry::instance()->CFG->admin
544
+			);
545
+		} catch (Exception $e) {
546
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
547
+		}
548
+		$this->_redirect_after_action(
549
+			apply_filters(
550
+				'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success',
551
+				$this->_update_espresso_configuration(
552
+					'Admin Options',
553
+					EE_Registry::instance()->CFG->admin,
554
+					__FILE__,
555
+					__FUNCTION__,
556
+					__LINE__
557
+				)
558
+			),
559
+			'Admin Options',
560
+			'updated',
561
+			array('action' => 'admin_option_settings')
562
+		);
563
+	}
564
+
565
+
566
+	/*************        Countries        *************/
567
+
568
+
569
+	/**
570
+	 * @return string
571
+	 */
572
+	protected function getCountryIsoForSite()
573
+	{
574
+		return ! empty(EE_Registry::instance()->CFG->organization->CNT_ISO)
575
+			? EE_Registry::instance()->CFG->organization->CNT_ISO
576
+			: 'US';
577
+	}
578
+
579
+
580
+	/**
581
+	 * @param string          $CNT_ISO
582
+	 * @param EE_Country|null $country
583
+	 * @return EE_Base_Class|EE_Country
584
+	 * @throws EE_Error
585
+	 * @throws InvalidArgumentException
586
+	 * @throws InvalidDataTypeException
587
+	 * @throws InvalidInterfaceException
588
+	 * @throws ReflectionException
589
+	 */
590
+	protected function verifyOrGetCountryFromIso($CNT_ISO, EE_Country $country = null)
591
+	{
592
+		/** @var EE_Country $country */
593
+		return $country instanceof EE_Country && $country->ID() === $CNT_ISO
594
+			? $country
595
+			: EEM_Country::instance()->get_one_by_ID($CNT_ISO);
596
+	}
597
+
598
+
599
+	/**
600
+	 * Output Country Settings view.
601
+	 *
602
+	 * @throws DomainException
603
+	 * @throws EE_Error
604
+	 * @throws InvalidArgumentException
605
+	 * @throws InvalidDataTypeException
606
+	 * @throws InvalidInterfaceException
607
+	 * @throws ReflectionException
608
+	 */
609
+	protected function _country_settings()
610
+	{
611
+		$CNT_ISO_for_site = $this->getCountryIsoForSite();
612
+		$CNT_ISO = isset($this->_req_data['country'])
613
+			? strtoupper(sanitize_text_field($this->_req_data['country']))
614
+			: $CNT_ISO_for_site;
615
+
616
+		// load field generator helper
617
+
618
+		$this->_template_args['values'] = $this->_yes_no_values;
619
+
620
+		$this->_template_args['countries'] = new EE_Question_Form_Input(
621
+			EE_Question::new_instance(
622
+				array(
623
+					'QST_ID'           => 0,
624
+					'QST_display_text' => esc_html__('Select Country', 'event_espresso'),
625
+					'QST_system'       => 'admin-country',
626
+				)
627
+			),
628
+			EE_Answer::new_instance(
629
+				array(
630
+					'ANS_ID'    => 0,
631
+					'ANS_value' => $CNT_ISO,
632
+				)
633
+			),
634
+			array(
635
+				'input_id'       => 'country',
636
+				'input_name'     => 'country',
637
+				'input_prefix'   => '',
638
+				'append_qstn_id' => false,
639
+			)
640
+		);
641
+		$country = $this->verifyOrGetCountryFromIso($CNT_ISO_for_site);
642
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
643
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
644
+		$this->_template_args['country_details_settings'] = $this->display_country_settings(
645
+			$country->ID(),
646
+			$country
647
+		);
648
+		$this->_template_args['country_states_settings'] = $this->display_country_states(
649
+			$country->ID(),
650
+			$country
651
+		);
652
+		$this->_template_args['CNT_name_for_site'] = $country->name();
653
+
654
+		$this->_set_add_edit_form_tags('update_country_settings');
655
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
656
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
657
+			GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php',
658
+			$this->_template_args,
659
+			true
660
+		);
661
+		$this->display_admin_page_with_no_sidebar();
662
+	}
663
+
664
+
665
+	/**
666
+	 *        display_country_settings
667
+	 *
668
+	 * @param string          $CNT_ISO
669
+	 * @param EE_Country|null $country
670
+	 * @return mixed string | array$country
671
+	 * @throws DomainException
672
+	 * @throws EE_Error
673
+	 * @throws InvalidArgumentException
674
+	 * @throws InvalidDataTypeException
675
+	 * @throws InvalidInterfaceException
676
+	 * @throws ReflectionException
677
+	 */
678
+	public function display_country_settings($CNT_ISO = '', EE_Country $country = null)
679
+	{
680
+		$CNT_ISO_for_site = $this->getCountryIsoForSite();
681
+
682
+		$CNT_ISO = isset($this->_req_data['country'])
683
+			? strtoupper(sanitize_text_field($this->_req_data['country']))
684
+			: $CNT_ISO;
685
+		if (! $CNT_ISO) {
686
+			return '';
687
+		}
688
+
689
+		// for ajax
690
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
691
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
692
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
693
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
694
+		$country = $this->verifyOrGetCountryFromIso($CNT_ISO, $country);
695
+		$CNT_cur_disabled = $CNT_ISO !== $CNT_ISO_for_site;
696
+		$this->_template_args['CNT_cur_disabled'] = $CNT_cur_disabled;
697
+
698
+		$country_input_types = array(
699
+			'CNT_active'      => array(
700
+				'type'             => 'RADIO_BTN',
701
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
702
+				'class'            => '',
703
+				'options'          => $this->_yes_no_values,
704
+				'use_desc_4_label' => true,
705
+			),
706
+			'CNT_ISO'         => array(
707
+				'type'       => 'TEXT',
708
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
709
+				'class'      => 'small-text',
710
+			),
711
+			'CNT_ISO3'        => array(
712
+				'type'       => 'TEXT',
713
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
714
+				'class'      => 'small-text',
715
+			),
716
+			'RGN_ID'          => array(
717
+				'type'       => 'TEXT',
718
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
719
+				'class'      => 'small-text',
720
+			),
721
+			'CNT_name'        => array(
722
+				'type'       => 'TEXT',
723
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
724
+				'class'      => 'regular-text',
725
+			),
726
+			'CNT_cur_code'    => array(
727
+				'type'       => 'TEXT',
728
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
729
+				'class'      => 'small-text',
730
+				'disabled'   => $CNT_cur_disabled,
731
+			),
732
+			'CNT_cur_single'  => array(
733
+				'type'       => 'TEXT',
734
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
735
+				'class'      => 'medium-text',
736
+				'disabled'   => $CNT_cur_disabled,
737
+			),
738
+			'CNT_cur_plural'  => array(
739
+				'type'       => 'TEXT',
740
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
741
+				'class'      => 'medium-text',
742
+				'disabled'   => $CNT_cur_disabled,
743
+			),
744
+			'CNT_cur_sign'    => array(
745
+				'type'         => 'TEXT',
746
+				'input_name'   => 'cntry[' . $CNT_ISO . ']',
747
+				'class'        => 'small-text',
748
+				'htmlentities' => false,
749
+				'disabled'     => $CNT_cur_disabled,
750
+			),
751
+			'CNT_cur_sign_b4' => array(
752
+				'type'             => 'RADIO_BTN',
753
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
754
+				'class'            => '',
755
+				'options'          => $this->_yes_no_values,
756
+				'use_desc_4_label' => true,
757
+				'disabled'         => $CNT_cur_disabled,
758
+			),
759
+			'CNT_cur_dec_plc' => array(
760
+				'type'       => 'RADIO_BTN',
761
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
762
+				'class'      => '',
763
+				'options'    => array(
764
+					array('id' => 0, 'text' => ''),
765
+					array('id' => 1, 'text' => ''),
766
+					array('id' => 2, 'text' => ''),
767
+					array('id' => 3, 'text' => ''),
768
+				),
769
+				'disabled'   => $CNT_cur_disabled,
770
+			),
771
+			'CNT_cur_dec_mrk' => array(
772
+				'type'             => 'RADIO_BTN',
773
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
774
+				'class'            => '',
775
+				'options'          => array(
776
+					array(
777
+						'id'   => ',',
778
+						'text' => esc_html__(', (comma)', 'event_espresso'),
779
+					),
780
+					array('id' => '.', 'text' => esc_html__('. (decimal)', 'event_espresso')),
781
+				),
782
+				'use_desc_4_label' => true,
783
+				'disabled'         => $CNT_cur_disabled,
784
+			),
785
+			'CNT_cur_thsnds'  => array(
786
+				'type'             => 'RADIO_BTN',
787
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
788
+				'class'            => '',
789
+				'options'          => array(
790
+					array(
791
+						'id'   => ',',
792
+						'text' => esc_html__(', (comma)', 'event_espresso'),
793
+					),
794
+					array(
795
+						'id' => '.',
796
+						'text' => esc_html__('. (decimal)', 'event_espresso')
797
+					),
798
+					array(
799
+						'id' => '&nbsp;',
800
+						'text' => esc_html__('(space)', 'event_espresso')
801
+					)
802
+				),
803
+				'use_desc_4_label' => true,
804
+				'disabled'         => $CNT_cur_disabled,
805
+			),
806
+			'CNT_tel_code'    => array(
807
+				'type'       => 'TEXT',
808
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
809
+				'class'      => 'small-text',
810
+			),
811
+			'CNT_is_EU'       => array(
812
+				'type'             => 'RADIO_BTN',
813
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
814
+				'class'            => '',
815
+				'options'          => $this->_yes_no_values,
816
+				'use_desc_4_label' => true,
817
+			),
818
+		);
819
+		$this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object(
820
+			$country,
821
+			$country_input_types
822
+		);
823
+		$country_details_settings = EEH_Template::display_template(
824
+			GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php',
825
+			$this->_template_args,
826
+			true
827
+		);
828
+
829
+		if (defined('DOING_AJAX')) {
830
+			$notices = EE_Error::get_notices(false, false, false);
831
+			echo wp_json_encode(
832
+				array(
833
+					'return_data' => $country_details_settings,
834
+					'success'     => $notices['success'],
835
+					'errors'      => $notices['errors'],
836
+				)
837
+			);
838
+			die();
839
+		} else {
840
+			return $country_details_settings;
841
+		}
842
+	}
843
+
844
+
845
+	/**
846
+	 * @param string          $CNT_ISO
847
+	 * @param EE_Country|null $country
848
+	 * @return string
849
+	 * @throws DomainException
850
+	 * @throws EE_Error
851
+	 * @throws InvalidArgumentException
852
+	 * @throws InvalidDataTypeException
853
+	 * @throws InvalidInterfaceException
854
+	 * @throws ReflectionException
855
+	 */
856
+	public function display_country_states($CNT_ISO = '', EE_Country $country = null)
857
+	{
858
+
859
+		$CNT_ISO = isset($this->_req_data['country'])
860
+			? sanitize_text_field($this->_req_data['country'])
861
+			: $CNT_ISO;
862
+		if (! $CNT_ISO) {
863
+			return '';
864
+		}
865
+		// for ajax
866
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
867
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
868
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2);
869
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2);
870
+		$states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO));
871
+		if (empty($states)) {
872
+			/** @var EventEspresso\core\services\address\CountrySubRegionDao $countrySubRegionDao */
873
+			$countrySubRegionDao = $this->loader->getShared(
874
+				'EventEspresso\core\services\address\CountrySubRegionDao'
875
+			);
876
+			if ($countrySubRegionDao instanceof EventEspresso\core\services\address\CountrySubRegionDao) {
877
+				$country = $this->verifyOrGetCountryFromIso($CNT_ISO, $country);
878
+				if ($countrySubRegionDao->saveCountrySubRegions($country)) {
879
+					$states = EEM_State::instance()->get_all_states_for_these_countries(
880
+						array($CNT_ISO => $CNT_ISO)
881
+					);
882
+				}
883
+			}
884
+		}
885
+		if (is_array($states)) {
886
+			foreach ($states as $STA_ID => $state) {
887
+				if ($state instanceof EE_State) {
888
+					// STA_abbrev    STA_name    STA_active
889
+					$state_input_types = array(
890
+						'STA_abbrev' => array(
891
+							'type'       => 'TEXT',
892
+							'input_name' => 'states[' . $STA_ID . ']',
893
+							'class'      => 'mid-text',
894
+						),
895
+						'STA_name'   => array(
896
+							'type'       => 'TEXT',
897
+							'input_name' => 'states[' . $STA_ID . ']',
898
+							'class'      => 'regular-text',
899
+						),
900
+						'STA_active' => array(
901
+							'type'             => 'RADIO_BTN',
902
+							'input_name'       => 'states[' . $STA_ID . ']',
903
+							'options'          => $this->_yes_no_values,
904
+							'use_desc_4_label' => true,
905
+						),
906
+					);
907
+					$this->_template_args['states'][ $STA_ID ]['inputs'] =
908
+						EE_Question_Form_Input::generate_question_form_inputs_for_object(
909
+							$state,
910
+							$state_input_types
911
+						);
912
+					$query_args = array(
913
+						'action'     => 'delete_state',
914
+						'STA_ID'     => $STA_ID,
915
+						'CNT_ISO'    => $CNT_ISO,
916
+						'STA_abbrev' => $state->abbrev(),
917
+					);
918
+					$this->_template_args['states'][ $STA_ID ]['delete_state_url'] =
919
+						EE_Admin_Page::add_query_args_and_nonce(
920
+							$query_args,
921
+							GEN_SET_ADMIN_URL
922
+						);
923
+				}
924
+			}
925
+		} else {
926
+			$this->_template_args['states'] = false;
927
+		}
928
+
929
+		$this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(
930
+			array('action' => 'add_new_state'),
931
+			GEN_SET_ADMIN_URL
932
+		);
933
+
934
+		$state_details_settings = EEH_Template::display_template(
935
+			GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php',
936
+			$this->_template_args,
937
+			true
938
+		);
939
+
940
+		if (defined('DOING_AJAX')) {
941
+			$notices = EE_Error::get_notices(false, false, false);
942
+			echo wp_json_encode(
943
+				array(
944
+					'return_data' => $state_details_settings,
945
+					'success'     => $notices['success'],
946
+					'errors'      => $notices['errors'],
947
+				)
948
+			);
949
+			die();
950
+		} else {
951
+			return $state_details_settings;
952
+		}
953
+	}
954
+
955
+
956
+	/**
957
+	 *        add_new_state
958
+	 *
959
+	 * @access    public
960
+	 * @return void
961
+	 * @throws EE_Error
962
+	 * @throws InvalidArgumentException
963
+	 * @throws InvalidDataTypeException
964
+	 * @throws InvalidInterfaceException
965
+	 */
966
+	public function add_new_state()
967
+	{
968
+
969
+		$success = true;
970
+
971
+		$CNT_ISO = isset($this->_req_data['CNT_ISO'])
972
+			? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO']))
973
+			: false;
974
+		if (! $CNT_ISO) {
975
+			EE_Error::add_error(
976
+				esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'),
977
+				__FILE__,
978
+				__FUNCTION__,
979
+				__LINE__
980
+			);
981
+			$success = false;
982
+		}
983
+		$STA_abbrev = isset($this->_req_data['STA_abbrev'])
984
+			? sanitize_text_field($this->_req_data['STA_abbrev'])
985
+			: false;
986
+		if (! $STA_abbrev) {
987
+			EE_Error::add_error(
988
+				esc_html__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'),
989
+				__FILE__,
990
+				__FUNCTION__,
991
+				__LINE__
992
+			);
993
+			$success = false;
994
+		}
995
+		$STA_name = isset($this->_req_data['STA_name'])
996
+			? sanitize_text_field($this->_req_data['STA_name'])
997
+			: false;
998
+		if (! $STA_name) {
999
+			EE_Error::add_error(
1000
+				esc_html__('No State name or an invalid State name was received.', 'event_espresso'),
1001
+				__FILE__,
1002
+				__FUNCTION__,
1003
+				__LINE__
1004
+			);
1005
+			$success = false;
1006
+		}
1007
+
1008
+		if ($success) {
1009
+			$cols_n_values = array(
1010
+				'CNT_ISO'    => $CNT_ISO,
1011
+				'STA_abbrev' => $STA_abbrev,
1012
+				'STA_name'   => $STA_name,
1013
+				'STA_active' => true,
1014
+			);
1015
+			$success = EEM_State::instance()->insert($cols_n_values);
1016
+			EE_Error::add_success(esc_html__('The State was added successfully.', 'event_espresso'));
1017
+		}
1018
+
1019
+		if (defined('DOING_AJAX')) {
1020
+			$notices = EE_Error::get_notices(false, false, false);
1021
+			echo wp_json_encode(array_merge($notices, array('return_data' => $CNT_ISO)));
1022
+			die();
1023
+		} else {
1024
+			$this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings'));
1025
+		}
1026
+	}
1027
+
1028
+
1029
+	/**
1030
+	 *        delete_state
1031
+	 *
1032
+	 * @access    public
1033
+	 * @return        boolean
1034
+	 * @throws EE_Error
1035
+	 * @throws InvalidArgumentException
1036
+	 * @throws InvalidDataTypeException
1037
+	 * @throws InvalidInterfaceException
1038
+	 */
1039
+	public function delete_state()
1040
+	{
1041
+		$CNT_ISO = isset($this->_req_data['CNT_ISO'])
1042
+			? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO']))
1043
+			: false;
1044
+		$STA_ID = isset($this->_req_data['STA_ID'])
1045
+			? sanitize_text_field($this->_req_data['STA_ID'])
1046
+			: false;
1047
+		$STA_abbrev = isset($this->_req_data['STA_abbrev'])
1048
+			? sanitize_text_field($this->_req_data['STA_abbrev'])
1049
+			: false;
1050
+		if (! $STA_ID) {
1051
+			EE_Error::add_error(
1052
+				esc_html__('No State ID or an invalid State ID was received.', 'event_espresso'),
1053
+				__FILE__,
1054
+				__FUNCTION__,
1055
+				__LINE__
1056
+			);
1057
+			return false;
1058
+		}
1059
+
1060
+		$success = EEM_State::instance()->delete_by_ID($STA_ID);
1061
+		if ($success !== false) {
1062
+			do_action(
1063
+				'AHEE__General_Settings_Admin_Page__delete_state__state_deleted',
1064
+				$CNT_ISO,
1065
+				$STA_ID,
1066
+				array('STA_abbrev' => $STA_abbrev)
1067
+			);
1068
+			EE_Error::add_success(esc_html__('The State was deleted successfully.', 'event_espresso'));
1069
+		}
1070
+		if (defined('DOING_AJAX')) {
1071
+			$notices = EE_Error::get_notices(false, false);
1072
+			$notices['return_data'] = true;
1073
+			echo wp_json_encode($notices);
1074
+			die();
1075
+		} else {
1076
+			$this->_redirect_after_action(
1077
+				$success,
1078
+				'State',
1079
+				'deleted',
1080
+				array('action' => 'country_settings')
1081
+			);
1082
+		}
1083
+	}
1084
+
1085
+
1086
+	/**
1087
+	 *        _update_country_settings
1088
+	 *
1089
+	 * @access    protected
1090
+	 * @return void
1091
+	 * @throws EE_Error
1092
+	 * @throws InvalidArgumentException
1093
+	 * @throws InvalidDataTypeException
1094
+	 * @throws InvalidInterfaceException
1095
+	 */
1096
+	protected function _update_country_settings()
1097
+	{
1098
+		// grab the country ISO code
1099
+		$CNT_ISO = isset($this->_req_data['country'])
1100
+			? strtoupper(sanitize_text_field($this->_req_data['country']))
1101
+			: false;
1102
+		if (! $CNT_ISO) {
1103
+			EE_Error::add_error(
1104
+				esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'),
1105
+				__FILE__,
1106
+				__FUNCTION__,
1107
+				__LINE__
1108
+			);
1109
+
1110
+			return;
1111
+		}
1112
+		$cols_n_values = array();
1113
+		$cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_ISO3'])
1114
+			? strtoupper(sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_ISO3']))
1115
+			: false;
1116
+		$cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['RGN_ID'])
1117
+			? absint($this->_req_data['cntry'][ $CNT_ISO ]['RGN_ID'])
1118
+			: null;
1119
+		$cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_name'])
1120
+			? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_name'])
1121
+			: null;
1122
+		if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_code'])) {
1123
+			$cols_n_values['CNT_cur_code'] = strtoupper(
1124
+				sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_code'])
1125
+			);
1126
+		}
1127
+		if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_single'])) {
1128
+			$cols_n_values['CNT_cur_single'] = sanitize_text_field(
1129
+				$this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_single']
1130
+			);
1131
+		}
1132
+		if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_plural'])) {
1133
+			$cols_n_values['CNT_cur_plural'] = sanitize_text_field(
1134
+				$this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_plural']
1135
+			);
1136
+		}
1137
+		if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign'])) {
1138
+			$cols_n_values['CNT_cur_sign'] = sanitize_text_field(
1139
+				$this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign']
1140
+			);
1141
+		}
1142
+		if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign_b4'])) {
1143
+			$cols_n_values['CNT_cur_sign_b4'] = absint(
1144
+				$this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign_b4']
1145
+			);
1146
+		}
1147
+		if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_plc'])) {
1148
+			$cols_n_values['CNT_cur_dec_plc'] = absint(
1149
+				$this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_plc']
1150
+			);
1151
+		}
1152
+		if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_mrk'])) {
1153
+			$cols_n_values['CNT_cur_dec_mrk'] = sanitize_text_field(
1154
+				$this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_mrk']
1155
+			);
1156
+		}
1157
+		if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_thsnds'])) {
1158
+			$cols_n_values['CNT_cur_thsnds'] = sanitize_text_field(
1159
+				$this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_thsnds']
1160
+			);
1161
+		}
1162
+		$cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_tel_code'])
1163
+			? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_tel_code'])
1164
+			: null;
1165
+		$cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_is_EU'])
1166
+			? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_is_EU'])
1167
+			: false;
1168
+		$cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_active'])
1169
+			? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_active'])
1170
+			: false;
1171
+		// allow filtering of country data
1172
+		$cols_n_values = apply_filters(
1173
+			'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values',
1174
+			$cols_n_values
1175
+		);
1176
+
1177
+		// where values
1178
+		$where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO));
1179
+		// run the update
1180
+		$success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values);
1181
+
1182
+		if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== false) {
1183
+			// allow filtering of states data
1184
+			$states = apply_filters(
1185
+				'FHEE__General_Settings_Admin_Page___update_country_settings__states',
1186
+				$this->_req_data['states']
1187
+			);
1188
+
1189
+			// loop thru state data ( looks like : states[75][STA_name] )
1190
+			foreach ($states as $STA_ID => $state) {
1191
+				$cols_n_values = array(
1192
+					'CNT_ISO'    => $CNT_ISO,
1193
+					'STA_abbrev' => sanitize_text_field($state['STA_abbrev']),
1194
+					'STA_name'   => sanitize_text_field($state['STA_name']),
1195
+					'STA_active' => (bool) absint($state['STA_active']),
1196
+				);
1197
+				// where values
1198
+				$where_cols_n_values = array(array('STA_ID' => $STA_ID));
1199
+				// run the update
1200
+				$success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values);
1201
+				if ($success !== false) {
1202
+					do_action(
1203
+						'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved',
1204
+						$CNT_ISO,
1205
+						$STA_ID,
1206
+						$cols_n_values
1207
+					);
1208
+				}
1209
+			}
1210
+		}
1211
+		// check if country being edited matches org option country, and if so, then  update EE_Config with new settings
1212
+		if (
1213
+			isset(EE_Registry::instance()->CFG->organization->CNT_ISO)
1214
+			&& $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO
1215
+		) {
1216
+			EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO);
1217
+			EE_Registry::instance()->CFG->update_espresso_config();
1218
+		}
1219
+
1220
+		if ($success !== false) {
1221
+			EE_Error::add_success(
1222
+				esc_html__('Country Settings updated successfully.', 'event_espresso')
1223
+			);
1224
+		}
1225
+		$this->_redirect_after_action(
1226
+			$success,
1227
+			'',
1228
+			'',
1229
+			array('action' => 'country_settings', 'country' => $CNT_ISO),
1230
+			true
1231
+		);
1232
+	}
1233
+
1234
+
1235
+	/**
1236
+	 *        form_form_field_label_wrap
1237
+	 *
1238
+	 * @access        public
1239
+	 * @param        string $label
1240
+	 * @return        string
1241
+	 */
1242
+	public function country_form_field_label_wrap($label, $required_text)
1243
+	{
1244
+		return '
1245 1245
 			<tr>
1246 1246
 				<th>
1247 1247
 					' . $label . '
1248 1248
 				</th>';
1249
-    }
1250
-
1251
-
1252
-    /**
1253
-     *        form_form_field_input__wrap
1254
-     *
1255
-     * @access        public
1256
-     * @param        string $label
1257
-     * @return        string
1258
-     */
1259
-    public function country_form_field_input__wrap($input, $label)
1260
-    {
1261
-        return '
1249
+	}
1250
+
1251
+
1252
+	/**
1253
+	 *        form_form_field_input__wrap
1254
+	 *
1255
+	 * @access        public
1256
+	 * @param        string $label
1257
+	 * @return        string
1258
+	 */
1259
+	public function country_form_field_input__wrap($input, $label)
1260
+	{
1261
+		return '
1262 1262
 				<td class="general-settings-country-input-td">
1263 1263
 					' . $input . '
1264 1264
 				</td>
1265 1265
 			</tr>';
1266
-    }
1267
-
1268
-
1269
-    /**
1270
-     *        form_form_field_label_wrap
1271
-     *
1272
-     * @access        public
1273
-     * @param        string $label
1274
-     * @param        string $required_text
1275
-     * @return        string
1276
-     */
1277
-    public function state_form_field_label_wrap($label, $required_text)
1278
-    {
1279
-        return $required_text;
1280
-    }
1281
-
1282
-
1283
-    /**
1284
-     *        form_form_field_input__wrap
1285
-     *
1286
-     * @access        public
1287
-     * @param        string $label
1288
-     * @return        string
1289
-     */
1290
-    public function state_form_field_input__wrap($input, $label)
1291
-    {
1292
-        return '
1266
+	}
1267
+
1268
+
1269
+	/**
1270
+	 *        form_form_field_label_wrap
1271
+	 *
1272
+	 * @access        public
1273
+	 * @param        string $label
1274
+	 * @param        string $required_text
1275
+	 * @return        string
1276
+	 */
1277
+	public function state_form_field_label_wrap($label, $required_text)
1278
+	{
1279
+		return $required_text;
1280
+	}
1281
+
1282
+
1283
+	/**
1284
+	 *        form_form_field_input__wrap
1285
+	 *
1286
+	 * @access        public
1287
+	 * @param        string $label
1288
+	 * @return        string
1289
+	 */
1290
+	public function state_form_field_input__wrap($input, $label)
1291
+	{
1292
+		return '
1293 1293
 				<td class="general-settings-country-state-input-td">
1294 1294
 					' . $input . '
1295 1295
 				</td>';
1296
-    }
1297
-
1298
-
1299
-    /***********/
1300
-
1301
-
1302
-    /**
1303
-     * displays edit and view links for critical EE pages
1304
-     *
1305
-     * @access public
1306
-     * @param int $ee_page_id
1307
-     * @return string
1308
-     */
1309
-    public static function edit_view_links($ee_page_id)
1310
-    {
1311
-        $links = '<a href="'
1312
-                 . add_query_arg(
1313
-                     array('post' => $ee_page_id, 'action' => 'edit'),
1314
-                     admin_url('post.php')
1315
-                 )
1316
-                 . '" >'
1317
-                 . esc_html__('Edit', 'event_espresso')
1318
-                 . '</a>';
1319
-        $links .= ' &nbsp;|&nbsp; ';
1320
-        $links .= '<a href="' . get_permalink($ee_page_id) . '" >' . esc_html__('View', 'event_espresso') . '</a>';
1321
-
1322
-        return $links;
1323
-    }
1324
-
1325
-
1326
-    /**
1327
-     * displays page and shortcode status for critical EE pages
1328
-     *
1329
-     * @param WP page object $ee_page
1330
-     * @return string
1331
-     */
1332
-    public static function page_and_shortcode_status($ee_page, $shortcode)
1333
-    {
1334
-
1335
-        // page status
1336
-        if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') {
1337
-            $pg_colour = 'green';
1338
-            $pg_status = sprintf(esc_html__('Page%sStatus%sOK', 'event_espresso'), '&nbsp;', '&nbsp;');
1339
-        } else {
1340
-            $pg_colour = 'red';
1341
-            $pg_status = sprintf(esc_html__('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;');
1342
-        }
1343
-
1344
-        // shortcode status
1345
-        if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== false) {
1346
-            $sc_colour = 'green';
1347
-            $sc_status = sprintf(esc_html__('Shortcode%sOK', 'event_espresso'), '&nbsp;');
1348
-        } else {
1349
-            $sc_colour = 'red';
1350
-            $sc_status = sprintf(esc_html__('Shortcode%sProblem', 'event_espresso'), '&nbsp;');
1351
-        }
1352
-
1353
-        return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>'
1354
-               . $pg_status
1355
-               . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';
1356
-    }
1357
-
1358
-
1359
-    /**
1360
-     * generates a dropdown of all parent pages - copied from WP core
1361
-     *
1362
-     * @param int $default
1363
-     * @param int $parent
1364
-     * @param int $level
1365
-     */
1366
-    public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0)
1367
-    {
1368
-        global $wpdb;
1369
-        $items = $wpdb->get_results(
1370
-            $wpdb->prepare(
1371
-                "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order",
1372
-                $parent
1373
-            )
1374
-        );
1375
-
1376
-        if ($items) {
1377
-            foreach ($items as $item) {
1378
-                $pad = str_repeat('&nbsp;', $level * 3);
1379
-                if ($item->ID == $default) {
1380
-                    $current = ' selected="selected"';
1381
-                } else {
1382
-                    $current = '';
1383
-                }
1384
-
1385
-                echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad "
1386
-                     . esc_html($item->post_title)
1387
-                     . "</option>";
1388
-                parent_dropdown($default, $item->ID, $level + 1);
1389
-            }
1390
-        }
1391
-    }
1392
-
1393
-
1394
-    /**
1395
-     * Loads the scripts for the privacy settings form
1396
-     */
1397
-    public function load_scripts_styles_privacy_settings()
1398
-    {
1399
-        $form_handler = $this->loader->getShared('EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler');
1400
-        $form_handler->enqueueStylesAndScripts();
1401
-    }
1402
-
1403
-
1404
-    /**
1405
-     * display the privacy settings form
1406
-     */
1407
-    public function privacySettings()
1408
-    {
1409
-        $this->_set_add_edit_form_tags('update_privacy_settings');
1410
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
1411
-        $form_handler = $this->loader->getShared('EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler');
1412
-        $this->_template_args['admin_page_content'] = $form_handler->display();
1413
-        $this->display_admin_page_with_sidebar();
1414
-    }
1415
-
1416
-
1417
-    /**
1418
-     * Update the privacy settings from form data
1419
-     *
1420
-     * @throws EE_Error
1421
-     */
1422
-    public function updatePrivacySettings()
1423
-    {
1424
-        $form_handler = $this->loader->getShared('EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler');
1425
-        $success = $form_handler->process($this->get_request_data());
1426
-        $this->_redirect_after_action(
1427
-            $success,
1428
-            esc_html__('Registration Form Options', 'event_espresso'),
1429
-            'updated',
1430
-            array('action' => 'privacy_settings')
1431
-        );
1432
-    }
1296
+	}
1297
+
1298
+
1299
+	/***********/
1300
+
1301
+
1302
+	/**
1303
+	 * displays edit and view links for critical EE pages
1304
+	 *
1305
+	 * @access public
1306
+	 * @param int $ee_page_id
1307
+	 * @return string
1308
+	 */
1309
+	public static function edit_view_links($ee_page_id)
1310
+	{
1311
+		$links = '<a href="'
1312
+				 . add_query_arg(
1313
+					 array('post' => $ee_page_id, 'action' => 'edit'),
1314
+					 admin_url('post.php')
1315
+				 )
1316
+				 . '" >'
1317
+				 . esc_html__('Edit', 'event_espresso')
1318
+				 . '</a>';
1319
+		$links .= ' &nbsp;|&nbsp; ';
1320
+		$links .= '<a href="' . get_permalink($ee_page_id) . '" >' . esc_html__('View', 'event_espresso') . '</a>';
1321
+
1322
+		return $links;
1323
+	}
1324
+
1325
+
1326
+	/**
1327
+	 * displays page and shortcode status for critical EE pages
1328
+	 *
1329
+	 * @param WP page object $ee_page
1330
+	 * @return string
1331
+	 */
1332
+	public static function page_and_shortcode_status($ee_page, $shortcode)
1333
+	{
1334
+
1335
+		// page status
1336
+		if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') {
1337
+			$pg_colour = 'green';
1338
+			$pg_status = sprintf(esc_html__('Page%sStatus%sOK', 'event_espresso'), '&nbsp;', '&nbsp;');
1339
+		} else {
1340
+			$pg_colour = 'red';
1341
+			$pg_status = sprintf(esc_html__('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;');
1342
+		}
1343
+
1344
+		// shortcode status
1345
+		if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== false) {
1346
+			$sc_colour = 'green';
1347
+			$sc_status = sprintf(esc_html__('Shortcode%sOK', 'event_espresso'), '&nbsp;');
1348
+		} else {
1349
+			$sc_colour = 'red';
1350
+			$sc_status = sprintf(esc_html__('Shortcode%sProblem', 'event_espresso'), '&nbsp;');
1351
+		}
1352
+
1353
+		return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>'
1354
+			   . $pg_status
1355
+			   . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';
1356
+	}
1357
+
1358
+
1359
+	/**
1360
+	 * generates a dropdown of all parent pages - copied from WP core
1361
+	 *
1362
+	 * @param int $default
1363
+	 * @param int $parent
1364
+	 * @param int $level
1365
+	 */
1366
+	public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0)
1367
+	{
1368
+		global $wpdb;
1369
+		$items = $wpdb->get_results(
1370
+			$wpdb->prepare(
1371
+				"SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order",
1372
+				$parent
1373
+			)
1374
+		);
1375
+
1376
+		if ($items) {
1377
+			foreach ($items as $item) {
1378
+				$pad = str_repeat('&nbsp;', $level * 3);
1379
+				if ($item->ID == $default) {
1380
+					$current = ' selected="selected"';
1381
+				} else {
1382
+					$current = '';
1383
+				}
1384
+
1385
+				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad "
1386
+					 . esc_html($item->post_title)
1387
+					 . "</option>";
1388
+				parent_dropdown($default, $item->ID, $level + 1);
1389
+			}
1390
+		}
1391
+	}
1392
+
1393
+
1394
+	/**
1395
+	 * Loads the scripts for the privacy settings form
1396
+	 */
1397
+	public function load_scripts_styles_privacy_settings()
1398
+	{
1399
+		$form_handler = $this->loader->getShared('EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler');
1400
+		$form_handler->enqueueStylesAndScripts();
1401
+	}
1402
+
1403
+
1404
+	/**
1405
+	 * display the privacy settings form
1406
+	 */
1407
+	public function privacySettings()
1408
+	{
1409
+		$this->_set_add_edit_form_tags('update_privacy_settings');
1410
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
1411
+		$form_handler = $this->loader->getShared('EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler');
1412
+		$this->_template_args['admin_page_content'] = $form_handler->display();
1413
+		$this->display_admin_page_with_sidebar();
1414
+	}
1415
+
1416
+
1417
+	/**
1418
+	 * Update the privacy settings from form data
1419
+	 *
1420
+	 * @throws EE_Error
1421
+	 */
1422
+	public function updatePrivacySettings()
1423
+	{
1424
+		$form_handler = $this->loader->getShared('EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler');
1425
+		$success = $form_handler->process($this->get_request_data());
1426
+		$this->_redirect_after_action(
1427
+			$success,
1428
+			esc_html__('Registration Form Options', 'event_espresso'),
1429
+			'updated',
1430
+			array('action' => 'privacy_settings')
1431
+		);
1432
+	}
1433 1433
 }
Please login to merge, or discard this patch.
registration_form/templates/question_groups_main_meta_box.template.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 assert($question_group);
10 10
 assert($question_group instanceof EE_Question_Group);
11 11
 /* @var EE_Question[] $all_questions */
12
-assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions)));// list of unused questions
12
+assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions))); // list of unused questions
13 13
 foreach ($all_questions as $unused_question) {
14 14
     assert($unused_question);
15 15
     assert($unused_question instanceof EE_Question);
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
                 <input id="QSG_identifier" name="QSG_identifier<?php echo $id; ?>"
55 55
                        value="<?php $question_group->f('QSG_identifier') ?>" type="text"
56 56
                        class="regular-text"<?php echo $disabled; ?>>
57
-                <?php if (! empty($QSG_system)) { ?>
57
+                <?php if ( ! empty($QSG_system)) { ?>
58 58
                     <p><span class="description" style="color:#D54E21;">
59 59
                             <?php _e('System question group! This field cannot be changed.', 'event_espresso') ?>
60 60
                     </span><br/></p>
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
                     foreach ($all_questions as $question_ID => $question) {
156 156
                         if ($question instanceof EE_Question) {
157 157
                             /*@var $question EE_Question*/
158
-                            $checked = isset($question_group_questions[ $question_ID ]) ? ' checked="checked"' : '';
158
+                            $checked = isset($question_group_questions[$question_ID]) ? ' checked="checked"' : '';
159 159
                             // disable questions from the personal information question group
160 160
                             // is it required in the current question group? if so don't allow admins to remove it
161 161
                             $disabled = in_array(
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
                                     );
205 205
                                     $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL);
206 206
 
207
-                                    echo '<a href="' . $edit_link . '" target="_blank" title="' .
207
+                                    echo '<a href="'.$edit_link.'" target="_blank" title="'.
208 208
                                         sprintf(
209 209
                                             esc_attr__('Edit %s', 'event_espresso'),
210 210
                                             $question->admin_label()
Please login to merge, or discard this patch.
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  discard block
 block discarded – undo
13 13
 /* @var EE_Question[] $all_questions */
14 14
 assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions)));// list of unused questions
15 15
 foreach ($all_questions as $unused_question) {
16
-    assert($unused_question);
17
-    assert($unused_question instanceof EE_Question);
16
+	assert($unused_question);
17
+	assert($unused_question instanceof EE_Question);
18 18
 }
19 19
 /* @var array $values . Array of arrays, where each sub-array contains 2 keys: 'id' (internal value) and 'name' (label for displaying) */
20 20
 assert(is_array($values));
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
             <th>
34 34
                 <label for="QSG_name">
35 35
                     <?php _e('Group Name', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link(
36
-                        'group_name_info'
37
-                    ); ?>
36
+						'group_name_info'
37
+					); ?>
38 38
                 </label>
39 39
             </th>
40 40
             <td>
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
             <th>
49 49
                 <label for="QSG_identifier">
50 50
                     <?php _e('Group Identifier', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link(
51
-                        'group_identifier_info'
52
-                    ); ?>
51
+						'group_identifier_info'
52
+					); ?>
53 53
                 </label>
54 54
             </th>
55 55
             <td>
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
             <th>
69 69
                 <label for="QSG_desc">
70 70
                     <?php _e('Description', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link(
71
-                        'group_description_info'
72
-                    ); ?>
71
+						'group_description_info'
72
+					); ?>
73 73
                 </label>
74 74
             </th>
75 75
             <td>
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
             <th>
83 83
                 <label for="QSG_order">
84 84
                     <?php _e('Question Group Order', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link(
85
-                        'group_order_info'
86
-                    ); ?>
85
+						'group_order_info'
86
+					); ?>
87 87
                 </label>
88 88
             </th>
89 89
             <td>
@@ -96,17 +96,17 @@  discard block
 block discarded – undo
96 96
             <th>
97 97
                 <label>
98 98
                     <?php _e('Show Name', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link(
99
-                        'show_group_name_info'
100
-                    ); ?>
99
+						'show_group_name_info'
100
+					); ?>
101 101
                 </label>
102 102
             </th>
103 103
             <td>
104 104
                 <label for="QSG_show_group_name">
105 105
                     <?php echo EEH_Form_Fields::select_input(
106
-                        'QSG_show_group_name',
107
-                        $values,
108
-                        $question_group->show_group_name()
109
-                    ); ?>
106
+						'QSG_show_group_name',
107
+						$values,
108
+						$question_group->show_group_name()
109
+					); ?>
110 110
                     <p class="description"><?php _e('Show Group Name on Registration Page?', 'event_espresso'); ?></p>
111 111
                 </label>
112 112
             </td>
@@ -116,20 +116,20 @@  discard block
 block discarded – undo
116 116
             <th>
117 117
                 <label>
118 118
                     <?php _e(' Show Description', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link(
119
-                        'show_group_description_info'
120
-                    ); ?>
119
+						'show_group_description_info'
120
+					); ?>
121 121
                 </label>
122 122
             </th>
123 123
             <td>
124 124
                 <label for="QSG_show_group_order">
125 125
                     <?php echo EEH_Form_Fields::select_input(
126
-                        'QSG_show_group_desc',
127
-                        $values,
128
-                        $question_group->show_group_desc()
129
-                    ); ?>
126
+						'QSG_show_group_desc',
127
+						$values,
128
+						$question_group->show_group_desc()
129
+					); ?>
130 130
                     <p class="description"><?php
131
-                        _e(' Show Group Description on Registration Page?', 'event_espresso');
132
-                    ?></p>
131
+						_e(' Show Group Description on Registration Page?', 'event_espresso');
132
+					?></p>
133 133
                 </label>
134 134
                 <input type="hidden" name="QSG_system" value="<?php echo $question_group->system_group(); ?>">
135 135
             </td>
@@ -145,85 +145,85 @@  discard block
 block discarded – undo
145 145
     <div class="form-table question-group-questions inside">
146 146
         <div class="padding">
147 147
             <p><span class="description"><?php
148
-                    _e(
149
-                        'Select which questions should be shown in this group by checking or unchecking boxes. You can drag and drop questions to reorder them. Your changes will be updated when you save.',
150
-                        'event_espresso'
151
-                    ); ?></span></p>
148
+					_e(
149
+						'Select which questions should be shown in this group by checking or unchecking boxes. You can drag and drop questions to reorder them. Your changes will be updated when you save.',
150
+						'event_espresso'
151
+					); ?></span></p>
152 152
             <div>
153 153
                 <ul class="question-list-sortable">
154 154
                     <?php
155
-                    $question_order = 0;
156
-                    $question_group_questions = $question_group->questions();
157
-                    foreach ($all_questions as $question_ID => $question) {
158
-                        if ($question instanceof EE_Question) {
159
-                            /*@var $question EE_Question*/
160
-                            $checked = isset($question_group_questions[ $question_ID ]) ? ' checked="checked"' : '';
161
-                            // disable questions from the personal information question group
162
-                            // is it required in the current question group? if so don't allow admins to remove it
163
-                            $disabled = in_array(
164
-                                $question->system_ID(),
165
-                                EEM_Question::instance()->required_system_questions_in_system_question_group(
166
-                                    $QSG_system
167
-                                )
168
-                            ) ? 'disabled="disabled"' : '';
169
-                            // limit where system questions can appear
170
-                            if (
171
-                                $question->system_ID() &&
172
-                                ! in_array(
173
-                                    $question->system_ID(),
174
-                                    EEM_Question::instance()->allowed_system_questions_in_system_question_group(
175
-                                        $QSG_system
176
-                                    )
177
-                                )
178
-                            ) {
179
-                                continue; // skip over system question not assigned to this group except for the address system group cause we want the address questions to display even if they aren't selected (but still not show the personal system questions).  The third condition checks if we're displaying a non system question group and the question is a system question, then we skip because for non-system question groups we only want to show non-system questions.
180
-                            }
181
-                            ?>
155
+					$question_order = 0;
156
+					$question_group_questions = $question_group->questions();
157
+					foreach ($all_questions as $question_ID => $question) {
158
+						if ($question instanceof EE_Question) {
159
+							/*@var $question EE_Question*/
160
+							$checked = isset($question_group_questions[ $question_ID ]) ? ' checked="checked"' : '';
161
+							// disable questions from the personal information question group
162
+							// is it required in the current question group? if so don't allow admins to remove it
163
+							$disabled = in_array(
164
+								$question->system_ID(),
165
+								EEM_Question::instance()->required_system_questions_in_system_question_group(
166
+									$QSG_system
167
+								)
168
+							) ? 'disabled="disabled"' : '';
169
+							// limit where system questions can appear
170
+							if (
171
+								$question->system_ID() &&
172
+								! in_array(
173
+									$question->system_ID(),
174
+									EEM_Question::instance()->allowed_system_questions_in_system_question_group(
175
+										$QSG_system
176
+									)
177
+								)
178
+							) {
179
+								continue; // skip over system question not assigned to this group except for the address system group cause we want the address questions to display even if they aren't selected (but still not show the personal system questions).  The third condition checks if we're displaying a non system question group and the question is a system question, then we skip because for non-system question groups we only want to show non-system questions.
180
+							}
181
+							?>
182 182
                             <li class="ee-question-sortable">
183 183
                                 <label for="question-<?php echo $question_ID ?>">
184 184
                                     <input type="checkbox" name="questions[<?php echo $question_ID; ?>]"
185 185
                                            id="question-<?php echo $question_ID; ?>"
186 186
                                            value="<?php echo $question_ID; ?>"<?php echo $disabled; ?><?php echo $checked; ?>/>
187 187
                                     <span class="question-text"><?php
188
-                                        echo trim($question->display_text())
189
-                                             . (95 <= strlen(trim($question->display_text()))
190
-                                                ? "&hellip;"
191
-                                                : '');
192
-                                                                ?>
188
+										echo trim($question->display_text())
189
+											 . (95 <= strlen(trim($question->display_text()))
190
+												? "&hellip;"
191
+												: '');
192
+																?>
193 193
                                     </span>
194 194
                                     <input class="question-group-QGQ_order" type="hidden"
195 195
                                            name="question_orders[<?php echo $question_ID; ?>]"
196 196
                                            value="<?php echo $question_order; ?>">
197 197
                                 </label>
198 198
                                 <?php
199
-                                if (
200
-                                    EE_Registry::instance()->CAP->current_user_can(
201
-                                        'ee_edit_question',
202
-                                        'espresso_registration_form_edit_question',
203
-                                        $question->ID()
204
-                                    )
205
-                                ) {
206
-                                    $edit_query_args = array(
207
-                                        'action' => 'edit_question',
208
-                                        'QST_ID' => $question->ID(),
209
-                                    );
210
-                                    $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL);
199
+								if (
200
+									EE_Registry::instance()->CAP->current_user_can(
201
+										'ee_edit_question',
202
+										'espresso_registration_form_edit_question',
203
+										$question->ID()
204
+									)
205
+								) {
206
+									$edit_query_args = array(
207
+										'action' => 'edit_question',
208
+										'QST_ID' => $question->ID(),
209
+									);
210
+									$edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL);
211 211
 
212
-                                    echo '<a href="' . $edit_link . '" target="_blank" title="' .
213
-                                        sprintf(
214
-                                            esc_attr__('Edit %s', 'event_espresso'),
215
-                                            $question->admin_label()
216
-                                        )
217
-                                        . '"><span class="dashicons dashicons-edit"></span>
212
+									echo '<a href="' . $edit_link . '" target="_blank" title="' .
213
+										sprintf(
214
+											esc_attr__('Edit %s', 'event_espresso'),
215
+											$question->admin_label()
216
+										)
217
+										. '"><span class="dashicons dashicons-edit"></span>
218 218
                                         </a>';
219
-                                }
220
-                                ?>
219
+								}
220
+								?>
221 221
                             </li>
222 222
                             <?php
223
-                            $question_order++;
224
-                        }
225
-                    }
226
-                    ?>
223
+							$question_order++;
224
+						}
225
+					}
226
+					?>
227 227
                 </ul>
228 228
             </div>
229 229
         </div>
Please login to merge, or discard this patch.