Completed
Branch fix-message-active-toggle (c2556b)
by
unknown
36:41 queued 26:55
created
core/db_models/fields/EE_Serialized_Text_Field.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
     public function __construct($table_column, $nicename, $nullable, $default_value = null)
20 20
     {
21 21
         parent::__construct($table_column, $nicename, $nullable, $default_value);
22
-        $this->setSchemaType(array('object','string'));
22
+        $this->setSchemaType(array('object', 'string'));
23 23
     }
24 24
 
25 25
 
Please login to merge, or discard this patch.
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -8,72 +8,72 @@
 block discarded – undo
8 8
  */
9 9
 class EE_Serialized_Text_Field extends EE_Text_Field_Base
10 10
 {
11
-    /**
12
-     * @param string $table_column
13
-     * @param string $nicename
14
-     * @param bool   $nullable
15
-     * @param null   $default_value
16
-     */
17
-    public function __construct($table_column, $nicename, $nullable, $default_value = null)
18
-    {
19
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
20
-        $this->setSchemaType(array('object','string'));
21
-    }
11
+	/**
12
+	 * @param string $table_column
13
+	 * @param string $nicename
14
+	 * @param bool   $nullable
15
+	 * @param null   $default_value
16
+	 */
17
+	public function __construct($table_column, $nicename, $nullable, $default_value = null)
18
+	{
19
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
20
+		$this->setSchemaType(array('object','string'));
21
+	}
22 22
 
23 23
 
24
-    /**
25
-     * Value SHOULD be an array, and we want to now convert it to a serialized string
26
-     *
27
-     * @param array $value_of_field_on_model_object
28
-     * @return string
29
-     */
30
-    public function prepare_for_use_in_db($value_of_field_on_model_object)
31
-    {
32
-        return maybe_serialize($value_of_field_on_model_object);
33
-    }
24
+	/**
25
+	 * Value SHOULD be an array, and we want to now convert it to a serialized string
26
+	 *
27
+	 * @param array $value_of_field_on_model_object
28
+	 * @return string
29
+	 */
30
+	public function prepare_for_use_in_db($value_of_field_on_model_object)
31
+	{
32
+		return maybe_serialize($value_of_field_on_model_object);
33
+	}
34 34
 
35
-    public function prepare_for_set($value_inputted_for_field_on_model_object)
36
-    {
37
-        $value_inputted_for_field_on_model_object = EEH_Array::maybe_unserialize($value_inputted_for_field_on_model_object);
38
-        if (is_string($value_inputted_for_field_on_model_object)) {
39
-            return parent::prepare_for_set($value_inputted_for_field_on_model_object);
40
-        } elseif (is_array($value_inputted_for_field_on_model_object)) {
41
-            return array_map(array($this, 'prepare_for_set'), $value_inputted_for_field_on_model_object);
42
-        } else {// so they passed NULL or an INT or something wack
43
-            return $value_inputted_for_field_on_model_object;
44
-        }
45
-    }
35
+	public function prepare_for_set($value_inputted_for_field_on_model_object)
36
+	{
37
+		$value_inputted_for_field_on_model_object = EEH_Array::maybe_unserialize($value_inputted_for_field_on_model_object);
38
+		if (is_string($value_inputted_for_field_on_model_object)) {
39
+			return parent::prepare_for_set($value_inputted_for_field_on_model_object);
40
+		} elseif (is_array($value_inputted_for_field_on_model_object)) {
41
+			return array_map(array($this, 'prepare_for_set'), $value_inputted_for_field_on_model_object);
42
+		} else {// so they passed NULL or an INT or something wack
43
+			return $value_inputted_for_field_on_model_object;
44
+		}
45
+	}
46 46
 
47
-    /**
48
-     * Value provided should definetely be a serialized string. We should unserialize into an array
49
-     *
50
-     * @param string $value_found_in_db_for_model_object
51
-     * @return array
52
-     */
53
-    public function prepare_for_set_from_db($value_found_in_db_for_model_object)
54
-    {
55
-        return EEH_Array::maybe_unserialize($value_found_in_db_for_model_object);
56
-    }
47
+	/**
48
+	 * Value provided should definetely be a serialized string. We should unserialize into an array
49
+	 *
50
+	 * @param string $value_found_in_db_for_model_object
51
+	 * @return array
52
+	 */
53
+	public function prepare_for_set_from_db($value_found_in_db_for_model_object)
54
+	{
55
+		return EEH_Array::maybe_unserialize($value_found_in_db_for_model_object);
56
+	}
57 57
 
58
-    /**
59
-     * Gets a string representation of the array
60
-     *
61
-     * @param type   $value_on_field_to_be_outputted
62
-     * @param string $schema , possible values are ',', others can be added
63
-     * @return string
64
-     */
65
-    public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
66
-    {
67
-        switch ($schema) {
68
-            case 'print_r':
69
-                $pretty_value = print_r($value_on_field_to_be_outputted, true);
70
-                break;
71
-            case 'as_table':
72
-                $pretty_value = EEH_Template::layout_array_as_table($value_on_field_to_be_outputted);
73
-                break;
74
-            default:
75
-                $pretty_value = implode(", ", $value_on_field_to_be_outputted);
76
-        }
77
-        return $pretty_value;
78
-    }
58
+	/**
59
+	 * Gets a string representation of the array
60
+	 *
61
+	 * @param type   $value_on_field_to_be_outputted
62
+	 * @param string $schema , possible values are ',', others can be added
63
+	 * @return string
64
+	 */
65
+	public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
66
+	{
67
+		switch ($schema) {
68
+			case 'print_r':
69
+				$pretty_value = print_r($value_on_field_to_be_outputted, true);
70
+				break;
71
+			case 'as_table':
72
+				$pretty_value = EEH_Template::layout_array_as_table($value_on_field_to_be_outputted);
73
+				break;
74
+			default:
75
+				$pretty_value = implode(", ", $value_on_field_to_be_outputted);
76
+		}
77
+		return $pretty_value;
78
+	}
79 79
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_DB_Only_Float_Field.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -3,16 +3,16 @@
 block discarded – undo
3 3
 
4 4
 class EE_DB_Only_Float_Field extends EE_DB_Only_Field_Base
5 5
 {
6
-    /**
7
-     * @param string $table_column
8
-     * @param string $nicename
9
-     * @param bool   $nullable
10
-     * @param null   $default_value
11
-     */
12
-    public function __construct($table_column, $nicename, $nullable, $default_value = null)
13
-    {
14
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
15
-        $this->setSchemaType('number');
16
-    }
6
+	/**
7
+	 * @param string $table_column
8
+	 * @param string $nicename
9
+	 * @param bool   $nullable
10
+	 * @param null   $default_value
11
+	 */
12
+	public function __construct($table_column, $nicename, $nullable, $default_value = null)
13
+	{
14
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
15
+		$this->setSchemaType('number');
16
+	}
17 17
 
18 18
 }
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/single-espresso_events.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 				<div id="espresso-event-details-dv" class="" >
20 20
 			<?php
21 21
 				// Start the Loop.
22
-				while ( have_posts() ) : the_post();
22
+				while (have_posts()) : the_post();
23 23
 					//  Include the post TYPE-specific template for the content.
24
-					espresso_get_template_part( 'content', 'espresso_events' );
24
+					espresso_get_template_part('content', 'espresso_events');
25 25
 					// If comments are open or we have at least one comment, load up the comment template.
26
-					if ( comments_open() || get_comments_number() ) {
26
+					if (comments_open() || get_comments_number()) {
27 27
 						comments_template();
28 28
 					}
29 29
 				endwhile;
@@ -35,6 +35,6 @@  discard block
 block discarded – undo
35 35
 	</div><!-- #primary -->
36 36
 
37 37
 <?php
38
-get_sidebar( 'content' );
38
+get_sidebar('content');
39 39
 get_sidebar();
40 40
 get_footer();
41 41
\ No newline at end of file
Please login to merge, or discard this patch.
core/services/commands/transaction/CreateTransactionCommand.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
     public function getCapCheck()
58 58
     {
59 59
         // need cap for non-AJAX admin requests
60
-        if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
60
+        if ( ! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
61 61
             // there's no specific caps for editing/creating transactions,
62 62
             // so that's why we are using ee_edit_registrations
63 63
             return new CapCheck('ee_edit_registrations', 'create_new_transaction');
Please login to merge, or discard this patch.
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -20,60 +20,60 @@
 block discarded – undo
20 20
  */
21 21
 class CreateTransactionCommand extends Command implements CommandRequiresCapCheckInterface
22 22
 {
23
-    /**
24
-     * @var EE_Checkout $checkout
25
-     */
26
-    protected $checkout;
23
+	/**
24
+	 * @var EE_Checkout $checkout
25
+	 */
26
+	protected $checkout;
27 27
 
28
-    /**
29
-     * @var array $transaction_details
30
-     */
31
-    protected $transaction_details;
28
+	/**
29
+	 * @var array $transaction_details
30
+	 */
31
+	protected $transaction_details;
32 32
 
33 33
 
34
-    /**
35
-     * CreateTransactionCommand constructor.
36
-     *
37
-     * @param EE_Checkout $checkout
38
-     * @param array       $transaction_details
39
-     */
40
-    public function __construct(EE_Checkout $checkout = null, array $transaction_details = array())
41
-    {
42
-        $this->checkout            = $checkout;
43
-        $this->transaction_details = $transaction_details;
44
-    }
34
+	/**
35
+	 * CreateTransactionCommand constructor.
36
+	 *
37
+	 * @param EE_Checkout $checkout
38
+	 * @param array       $transaction_details
39
+	 */
40
+	public function __construct(EE_Checkout $checkout = null, array $transaction_details = array())
41
+	{
42
+		$this->checkout            = $checkout;
43
+		$this->transaction_details = $transaction_details;
44
+	}
45 45
 
46 46
 
47
-    /**
48
-     * @return CapCheckInterface
49
-     * @throws InvalidDataTypeException
50
-     */
51
-    public function getCapCheck()
52
-    {
53
-        // need cap for non-AJAX admin requests
54
-        if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
55
-            // there's no specific caps for editing/creating transactions,
56
-            // so that's why we are using ee_edit_registrations
57
-            return new CapCheck('ee_edit_registrations', 'create_new_transaction');
58
-        }
59
-        return new PublicCapabilities('', 'create_new_transaction');
60
-    }
47
+	/**
48
+	 * @return CapCheckInterface
49
+	 * @throws InvalidDataTypeException
50
+	 */
51
+	public function getCapCheck()
52
+	{
53
+		// need cap for non-AJAX admin requests
54
+		if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
55
+			// there's no specific caps for editing/creating transactions,
56
+			// so that's why we are using ee_edit_registrations
57
+			return new CapCheck('ee_edit_registrations', 'create_new_transaction');
58
+		}
59
+		return new PublicCapabilities('', 'create_new_transaction');
60
+	}
61 61
 
62 62
 
63
-    /**
64
-     * @return EE_Checkout
65
-     */
66
-    public function checkout()
67
-    {
68
-        return $this->checkout;
69
-    }
63
+	/**
64
+	 * @return EE_Checkout
65
+	 */
66
+	public function checkout()
67
+	{
68
+		return $this->checkout;
69
+	}
70 70
 
71 71
 
72
-    /**
73
-     * @return array
74
-     */
75
-    public function transactionDetails()
76
-    {
77
-        return $this->transaction_details;
78
-    }
72
+	/**
73
+	 * @return array
74
+	 */
75
+	public function transactionDetails()
76
+	{
77
+		return $this->transaction_details;
78
+	}
79 79
 }
Please login to merge, or discard this patch.
core/services/commands/attendee/CreateAttendeeCommand.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
     public function getCapCheck()
82 82
     {
83 83
         // need cap for non-AJAX admin requests
84
-        if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
84
+        if ( ! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
85 85
             return new CapCheck('ee_edit_contacts', 'create_new_contact');
86 86
         }
87 87
         return new PublicCapabilities('', 'create_new_contact');
Please login to merge, or discard this patch.
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -19,62 +19,62 @@
 block discarded – undo
19 19
  */
20 20
 class CreateAttendeeCommand extends Command implements CommandRequiresCapCheckInterface
21 21
 {
22
-    /**
23
-     * array of details where keys are names of EEM_Attendee model fields
24
-     *
25
-     * @var array $attendee_details
26
-     */
27
-    protected $attendee_details;
22
+	/**
23
+	 * array of details where keys are names of EEM_Attendee model fields
24
+	 *
25
+	 * @var array $attendee_details
26
+	 */
27
+	protected $attendee_details;
28 28
 
29
-    /**
30
-     * an existing registration to associate this attendee with
31
-     *
32
-     * @var EE_Registration $registration
33
-     */
34
-    protected $registration;
29
+	/**
30
+	 * an existing registration to associate this attendee with
31
+	 *
32
+	 * @var EE_Registration $registration
33
+	 */
34
+	protected $registration;
35 35
 
36 36
 
37
-    /**
38
-     * CreateAttendeeCommand constructor.
39
-     *
40
-     * @param array           $attendee_details
41
-     * @param EE_Registration $registration
42
-     */
43
-    public function __construct(array $attendee_details, EE_Registration $registration)
44
-    {
45
-        $this->attendee_details = $attendee_details;
46
-        $this->registration = $registration;
47
-    }
37
+	/**
38
+	 * CreateAttendeeCommand constructor.
39
+	 *
40
+	 * @param array           $attendee_details
41
+	 * @param EE_Registration $registration
42
+	 */
43
+	public function __construct(array $attendee_details, EE_Registration $registration)
44
+	{
45
+		$this->attendee_details = $attendee_details;
46
+		$this->registration = $registration;
47
+	}
48 48
 
49 49
 
50
-    /**
51
-     * @return array
52
-     */
53
-    public function attendeeDetails()
54
-    {
55
-        return $this->attendee_details;
56
-    }
50
+	/**
51
+	 * @return array
52
+	 */
53
+	public function attendeeDetails()
54
+	{
55
+		return $this->attendee_details;
56
+	}
57 57
 
58 58
 
59
-    /**
60
-     * @return EE_Registration
61
-     */
62
-    public function registration()
63
-    {
64
-        return $this->registration;
65
-    }
59
+	/**
60
+	 * @return EE_Registration
61
+	 */
62
+	public function registration()
63
+	{
64
+		return $this->registration;
65
+	}
66 66
 
67 67
 
68
-    /**
69
-     * @return CapCheckInterface
70
-     * @throws InvalidDataTypeException
71
-     */
72
-    public function getCapCheck()
73
-    {
74
-        // need cap for non-AJAX admin requests
75
-        if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
76
-            return new CapCheck('ee_edit_contacts', 'create_new_contact');
77
-        }
78
-        return new PublicCapabilities('', 'create_new_contact');
79
-    }
68
+	/**
69
+	 * @return CapCheckInterface
70
+	 * @throws InvalidDataTypeException
71
+	 */
72
+	public function getCapCheck()
73
+	{
74
+		// need cap for non-AJAX admin requests
75
+		if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
76
+			return new CapCheck('ee_edit_contacts', 'create_new_contact');
77
+		}
78
+		return new PublicCapabilities('', 'create_new_contact');
79
+	}
80 80
 }
Please login to merge, or discard this patch.
events/help_tabs/events_default_settings_max_tickets.help_tab.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <p>
2 2
     <?php esc_html_e(
3
-        'Use this to control what the default will be for maximum tickets on an order when creating a new event.',
4
-        'event_espresso'
5
-    ); ?>
3
+		'Use this to control what the default will be for maximum tickets on an order when creating a new event.',
4
+		'event_espresso'
5
+	); ?>
6 6
 </p>
7 7
\ No newline at end of file
Please login to merge, or discard this patch.
core/services/notices/ConvertNoticesToEeErrors.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
             $error_string = esc_html__('The following errors occurred:', 'event_espresso');
44 44
             foreach ($notices->getError() as $notice) {
45 45
                 if ($this->getThrowExceptions()) {
46
-                    $error_string .= '<br />' . $notice->message();
46
+                    $error_string .= '<br />'.$notice->message();
47 47
                 } else {
48 48
                     EE_Error::add_error(
49 49
                         $notice->message(),
Please login to merge, or discard this patch.
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -13,54 +13,54 @@
 block discarded – undo
13 13
  */
14 14
 class ConvertNoticesToEeErrors extends NoticeConverter
15 15
 {
16
-    /**
17
-     * Converts Notice objects into EE_Error notifications
18
-     *
19
-     * @param NoticesContainerInterface $notices
20
-     * @throws EE_Error
21
-     */
22
-    public function process(NoticesContainerInterface $notices)
23
-    {
24
-        $this->setNotices($notices);
25
-        $notices = $this->getNotices();
26
-        if ($notices->hasAttention()) {
27
-            foreach ($notices->getAttention() as $notice) {
28
-                EE_Error::add_attention(
29
-                    $notice->message(),
30
-                    $notice->file(),
31
-                    $notice->func(),
32
-                    $notice->line()
33
-                );
34
-            }
35
-        }
36
-        if ($notices->hasError()) {
37
-            $error_string = esc_html__('The following errors occurred:', 'event_espresso');
38
-            foreach ($notices->getError() as $notice) {
39
-                if ($this->getThrowExceptions()) {
40
-                    $error_string .= '<br />' . $notice->message();
41
-                } else {
42
-                    EE_Error::add_error(
43
-                        $notice->message(),
44
-                        $notice->file(),
45
-                        $notice->func(),
46
-                        $notice->line()
47
-                    );
48
-                }
49
-            }
50
-            if ($this->getThrowExceptions()) {
51
-                throw new EE_Error($error_string);
52
-            }
53
-        }
54
-        if ($notices->hasSuccess()) {
55
-            foreach ($notices->getSuccess() as $notice) {
56
-                EE_Error::add_success(
57
-                    $notice->message(),
58
-                    $notice->file(),
59
-                    $notice->func(),
60
-                    $notice->line()
61
-                );
62
-            }
63
-        }
64
-        $this->clearNotices();
65
-    }
16
+	/**
17
+	 * Converts Notice objects into EE_Error notifications
18
+	 *
19
+	 * @param NoticesContainerInterface $notices
20
+	 * @throws EE_Error
21
+	 */
22
+	public function process(NoticesContainerInterface $notices)
23
+	{
24
+		$this->setNotices($notices);
25
+		$notices = $this->getNotices();
26
+		if ($notices->hasAttention()) {
27
+			foreach ($notices->getAttention() as $notice) {
28
+				EE_Error::add_attention(
29
+					$notice->message(),
30
+					$notice->file(),
31
+					$notice->func(),
32
+					$notice->line()
33
+				);
34
+			}
35
+		}
36
+		if ($notices->hasError()) {
37
+			$error_string = esc_html__('The following errors occurred:', 'event_espresso');
38
+			foreach ($notices->getError() as $notice) {
39
+				if ($this->getThrowExceptions()) {
40
+					$error_string .= '<br />' . $notice->message();
41
+				} else {
42
+					EE_Error::add_error(
43
+						$notice->message(),
44
+						$notice->file(),
45
+						$notice->func(),
46
+						$notice->line()
47
+					);
48
+				}
49
+			}
50
+			if ($this->getThrowExceptions()) {
51
+				throw new EE_Error($error_string);
52
+			}
53
+		}
54
+		if ($notices->hasSuccess()) {
55
+			foreach ($notices->getSuccess() as $notice) {
56
+				EE_Error::add_success(
57
+					$notice->message(),
58
+					$notice->file(),
59
+					$notice->func(),
60
+					$notice->line()
61
+				);
62
+			}
63
+		}
64
+		$this->clearNotices();
65
+	}
66 66
 }
Please login to merge, or discard this patch.
core/domain/services/admin/AdminToolBar.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     {
121 121
         wp_register_style(
122 122
             'espresso-admin-toolbar',
123
-            EE_GLOBAL_ASSETS_URL . 'css/espresso-admin-toolbar.css',
123
+            EE_GLOBAL_ASSETS_URL.'css/espresso-admin-toolbar.css',
124 124
             array('dashicons'),
125 125
             EVENT_ESPRESSO_VERSION
126 126
         );
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                 'href'  => $this->events_admin_url,
144 144
                 'meta'  => array(
145 145
                     'title' => esc_html__('Event Espresso', 'event_espresso'),
146
-                    'class' => $this->menu_class . 'first',
146
+                    'class' => $this->menu_class.'first',
147 147
                 ),
148 148
             )
149 149
         );
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
                     'meta'   => array(
492 492
                         'title'  => esc_html__('Approved', 'event_espresso'),
493 493
                         'target' => '',
494
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-approved',
494
+                        'class'  => $this->menu_class.' ee-toolbar-icon-approved',
495 495
                     ),
496 496
                 )
497 497
             );
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
                     'meta'   => array(
529 529
                         'title'  => esc_html__('Pending Payment', 'event_espresso'),
530 530
                         'target' => '',
531
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-pending',
531
+                        'class'  => $this->menu_class.' ee-toolbar-icon-pending',
532 532
                     ),
533 533
                 )
534 534
             );
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
                     'meta'   => array(
566 566
                         'title'  => esc_html__('Not Approved', 'event_espresso'),
567 567
                         'target' => '',
568
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-not-approved',
568
+                        'class'  => $this->menu_class.' ee-toolbar-icon-not-approved',
569 569
                     ),
570 570
                 )
571 571
             );
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
                     'meta'   => array(
603 603
                         'title'  => esc_html__('Cancelled', 'event_espresso'),
604 604
                         'target' => '',
605
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-cancelled',
605
+                        'class'  => $this->menu_class.' ee-toolbar-icon-cancelled',
606 606
                     ),
607 607
                 )
608 608
             );
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
                     'meta'   => array(
675 675
                         'title'  => esc_html__('Approved', 'event_espresso'),
676 676
                         'target' => '',
677
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-approved',
677
+                        'class'  => $this->menu_class.' ee-toolbar-icon-approved',
678 678
                     ),
679 679
                 )
680 680
             );
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
                     'meta'   => array(
712 712
                         'title'  => esc_html__('Pending', 'event_espresso'),
713 713
                         'target' => '',
714
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-pending',
714
+                        'class'  => $this->menu_class.' ee-toolbar-icon-pending',
715 715
                     ),
716 716
                 )
717 717
             );
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
                     'meta'   => array(
749 749
                         'title'  => esc_html__('Not Approved', 'event_espresso'),
750 750
                         'target' => '',
751
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-not-approved',
751
+                        'class'  => $this->menu_class.' ee-toolbar-icon-not-approved',
752 752
                     ),
753 753
                 )
754 754
             );
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
                     'meta'   => array(
786 786
                         'title'  => esc_html__('Cancelled', 'event_espresso'),
787 787
                         'target' => '',
788
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-cancelled',
788
+                        'class'  => $this->menu_class.' ee-toolbar-icon-cancelled',
789 789
                     ),
790 790
                 )
791 791
             );
Please login to merge, or discard this patch.
Indentation   +776 added lines, -776 removed lines patch added patch discarded remove patch
@@ -18,780 +18,780 @@
 block discarded – undo
18 18
  */
19 19
 class AdminToolBar
20 20
 {
21
-    /**
22
-     * @var WP_Admin_Bar $admin_bar
23
-     */
24
-    private $admin_bar;
25
-
26
-    /**
27
-     * @var EE_Capabilities $capabilities
28
-     */
29
-    private $capabilities;
30
-
31
-    /**
32
-     * @var string $events_admin_url
33
-     */
34
-    private $events_admin_url;
35
-
36
-    /**
37
-     * @var string $menu_class
38
-     */
39
-    private $menu_class = 'espresso_menu_item_class';
40
-
41
-    /**
42
-     * @var string $reg_admin_url
43
-     */
44
-    private $reg_admin_url;
45
-
46
-
47
-    /**
48
-     * AdminToolBar constructor.
49
-     *
50
-     * @param EE_Capabilities $capabilities
51
-     */
52
-    public function __construct(EE_Capabilities $capabilities)
53
-    {
54
-        $this->capabilities = $capabilities;
55
-        add_action('admin_bar_menu', array($this, 'espressoToolbarItems'), 100);
56
-        $this->enqueueAssets();
57
-    }
58
-
59
-
60
-    /**
61
-     *    espresso_toolbar_items
62
-     *
63
-     * @access public
64
-     * @param  WP_Admin_Bar $admin_bar
65
-     * @return void
66
-     */
67
-    public function espressoToolbarItems(WP_Admin_Bar $admin_bar)
68
-    {
69
-        // if its an AJAX request, or user is NOT an admin, or in full M-Mode
70
-        if (
71
-            defined('DOING_AJAX')
72
-            || ! $this->capabilities->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')
73
-            || EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance
74
-        ) {
75
-            return;
76
-        }
77
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
78
-        $this->admin_bar = $admin_bar;
79
-        // we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL
80
-        // because they're only defined in each of their respective constructors
81
-        // and this might be a frontend request, in which case they aren't available
82
-        $this->events_admin_url = admin_url('admin.php?page=espresso_events');
83
-        $this->reg_admin_url = admin_url('admin.php?page=espresso_registrations');
84
-        // now let's add all of the menu items
85
-        $this->addTopLevelMenu();
86
-        $this->addEventsSubMenu();
87
-        $this->addEventsAddEditHeader();
88
-        $this->addEventsAddNew();
89
-        $this->addEventsEditCurrentEvent();
90
-        $this->addEventsViewHeader();
91
-        $this->addEventsViewAll();
92
-        $this->addEventsViewToday();
93
-        $this->addEventsViewThisMonth();
94
-        $this->addRegistrationSubMenu();
95
-        $this->addRegistrationOverviewToday();
96
-        $this->addRegistrationOverviewTodayApproved();
97
-        $this->addRegistrationOverviewTodayPendingPayment();
98
-        $this->addRegistrationOverviewTodayNotApproved();
99
-        $this->addRegistrationOverviewTodayCancelled();
100
-        $this->addRegistrationOverviewThisMonth();
101
-        $this->addRegistrationOverviewThisMonthApproved();
102
-        $this->addRegistrationOverviewThisMonthPending();
103
-        $this->addRegistrationOverviewThisMonthNotApproved();
104
-        $this->addRegistrationOverviewThisMonthCancelled();
105
-        $this->addExtensionsAndServices();
106
-    }
107
-
108
-
109
-    /**
110
-     * @return void
111
-     */
112
-    private function enqueueAssets()
113
-    {
114
-        wp_register_style(
115
-            'espresso-admin-toolbar',
116
-            EE_GLOBAL_ASSETS_URL . 'css/espresso-admin-toolbar.css',
117
-            array('dashicons'),
118
-            EVENT_ESPRESSO_VERSION
119
-        );
120
-        wp_enqueue_style('espresso-admin-toolbar');
121
-    }
122
-
123
-
124
-    /**
125
-     * @return void
126
-     */
127
-    private function addTopLevelMenu()
128
-    {
129
-        $this->admin_bar->add_menu(
130
-            array(
131
-                'id'    => 'espresso-toolbar',
132
-                'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'
133
-                           . esc_html_x('Event Espresso', 'admin bar menu group label', 'event_espresso')
134
-                           . '</span>',
135
-                'href'  => $this->events_admin_url,
136
-                'meta'  => array(
137
-                    'title' => esc_html__('Event Espresso', 'event_espresso'),
138
-                    'class' => $this->menu_class . 'first',
139
-                ),
140
-            )
141
-        );
142
-    }
143
-
144
-
145
-    /**
146
-     * @return void
147
-     */
148
-    private function addEventsSubMenu()
149
-    {
150
-        if (
151
-            $this->capabilities->current_user_can(
152
-                'ee_read_events',
153
-                'ee_admin_bar_menu_espresso-toolbar-events'
154
-            )
155
-        ) {
156
-            $this->admin_bar->add_menu(
157
-                array(
158
-                    'id'     => 'espresso-toolbar-events',
159
-                    'parent' => 'espresso-toolbar',
160
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
161
-                                . esc_html__('Events', 'event_espresso'),
162
-                    'href'   => $this->events_admin_url,
163
-                    'meta'   => array(
164
-                        'title'  => esc_html__('Events', 'event_espresso'),
165
-                        'target' => '',
166
-                        'class'  => $this->menu_class,
167
-                    ),
168
-                )
169
-            );
170
-        }
171
-    }
172
-
173
-
174
-    /**
175
-     * @return void
176
-     */
177
-    private function addEventsAddEditHeader()
178
-    {
179
-        if (
180
-            $this->capabilities->current_user_can(
181
-                'ee_read_events',
182
-                'ee_admin_bar_menu_espresso-toolbar-events-view'
183
-            )
184
-        ) {
185
-            $this->admin_bar->add_menu(
186
-                array(
187
-                    'id'     => 'espresso-toolbar-events-add-edit',
188
-                    'parent' => 'espresso-toolbar-events',
189
-                    'title'  => esc_html__('Add / Edit', 'event_espresso'),
190
-                    'href'   => '',
191
-                )
192
-            );
193
-        }
194
-    }
195
-
196
-
197
-    /**
198
-     * @return void
199
-     */
200
-    private function addEventsAddNew()
201
-    {
202
-        if (
203
-            $this->capabilities->current_user_can(
204
-                'ee_edit_events',
205
-                'ee_admin_bar_menu_espresso-toolbar-events-new'
206
-            )
207
-        ) {
208
-            $this->admin_bar->add_menu(
209
-                array(
210
-                    'id'     => 'espresso-toolbar-events-new',
211
-                    'parent' => 'espresso-toolbar-events',
212
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
213
-                                . esc_html__('Add New', 'event_espresso'),
214
-                    'href'   => EEH_URL::add_query_args_and_nonce(
215
-                        array('action' => 'create_new'),
216
-                        $this->events_admin_url
217
-                    ),
218
-                    'meta'   => array(
219
-                        'title'  => esc_html__('Add New', 'event_espresso'),
220
-                        'target' => '',
221
-                        'class'  => $this->menu_class,
222
-                    ),
223
-                )
224
-            );
225
-        }
226
-    }
227
-
228
-
229
-    /**
230
-     * @return void
231
-     */
232
-    private function addEventsEditCurrentEvent()
233
-    {
234
-        if (is_single() && (get_post_type() === 'espresso_events')) {
235
-            // Current post
236
-            global $post;
237
-            if (
238
-                $this->capabilities->current_user_can(
239
-                    'ee_edit_event',
240
-                    'ee_admin_bar_menu_espresso-toolbar-events-edit',
241
-                    $post->ID
242
-                )
243
-            ) {
244
-                $this->admin_bar->add_menu(
245
-                    array(
246
-                        'id'     => 'espresso-toolbar-events-edit',
247
-                        'parent' => 'espresso-toolbar-events',
248
-                        'title'  => '<span class="ee-toolbar-icon"></span>'
249
-                                    . esc_html__('Edit Event', 'event_espresso'),
250
-                        'href'   => EEH_URL::add_query_args_and_nonce(
251
-                            array(
252
-                                'action' => 'edit',
253
-                                'post'   => $post->ID,
254
-                            ),
255
-                            $this->events_admin_url
256
-                        ),
257
-                        'meta'   => array(
258
-                            'title'  => esc_html__('Edit Event', 'event_espresso'),
259
-                            'target' => '',
260
-                            'class'  => $this->menu_class,
261
-                        ),
262
-                    )
263
-                );
264
-            }
265
-        }
266
-    }
267
-
268
-
269
-    /**
270
-     * @return void
271
-     */
272
-    private function addEventsViewHeader()
273
-    {
274
-        if (
275
-            $this->capabilities->current_user_can(
276
-                'ee_read_events',
277
-                'ee_admin_bar_menu_espresso-toolbar-events-view'
278
-            )
279
-        ) {
280
-            $this->admin_bar->add_menu(
281
-                array(
282
-                    'id'     => 'espresso-toolbar-events-view',
283
-                    'parent' => 'espresso-toolbar-events',
284
-                    'title'  => esc_html__('View', 'event_espresso'),
285
-                    'href'   => '',
286
-                )
287
-            );
288
-        }
289
-    }
290
-
291
-
292
-    /**
293
-     * @return void
294
-     */
295
-    private function addEventsViewAll()
296
-    {
297
-        if (
298
-            $this->capabilities->current_user_can(
299
-                'ee_read_events',
300
-                'ee_admin_bar_menu_espresso-toolbar-events-all'
301
-            )
302
-        ) {
303
-            $this->admin_bar->add_menu(
304
-                array(
305
-                    'id'     => 'espresso-toolbar-events-all',
306
-                    'parent' => 'espresso-toolbar-events',
307
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
308
-                                . esc_html__('All', 'event_espresso'),
309
-                    'href'   => $this->events_admin_url,
310
-                    'meta'   => array(
311
-                        'title'  => esc_html__('All', 'event_espresso'),
312
-                        'target' => '',
313
-                        'class'  => $this->menu_class,
314
-                    ),
315
-                )
316
-            );
317
-        }
318
-    }
319
-
320
-
321
-    /**
322
-     * @return void
323
-     */
324
-    private function addEventsViewToday()
325
-    {
326
-        if (
327
-            $this->capabilities->current_user_can(
328
-                'ee_read_events',
329
-                'ee_admin_bar_menu_espresso-toolbar-events-today'
330
-            )
331
-        ) {
332
-            $this->admin_bar->add_menu(
333
-                array(
334
-                    'id'     => 'espresso-toolbar-events-today',
335
-                    'parent' => 'espresso-toolbar-events',
336
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
337
-                                . esc_html__('Today', 'event_espresso'),
338
-                    'href'   => EEH_URL::add_query_args_and_nonce(
339
-                        array(
340
-                            'action' => 'default',
341
-                            'status' => 'today',
342
-                        ),
343
-                        $this->events_admin_url
344
-                    ),
345
-                    'meta'   => array(
346
-                        'title'  => esc_html__('Today', 'event_espresso'),
347
-                        'target' => '',
348
-                        'class'  => $this->menu_class,
349
-                    ),
350
-                )
351
-            );
352
-        }
353
-    }
354
-
355
-
356
-    /**
357
-     * @return void
358
-     */
359
-    private function addEventsViewThisMonth()
360
-    {
361
-        if (
362
-            $this->capabilities->current_user_can(
363
-                'ee_read_events',
364
-                'ee_admin_bar_menu_espresso-toolbar-events-month'
365
-            )
366
-        ) {
367
-            $this->admin_bar->add_menu(
368
-                array(
369
-                    'id'     => 'espresso-toolbar-events-month',
370
-                    'parent' => 'espresso-toolbar-events',
371
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
372
-                                . esc_html__('This Month', 'event_espresso'),
373
-                    'href'   => EEH_URL::add_query_args_and_nonce(
374
-                        array(
375
-                            'action' => 'default',
376
-                            'status' => 'month',
377
-                        ),
378
-                        $this->events_admin_url
379
-                    ),
380
-                    'meta'   => array(
381
-                        'title'  => esc_html__('This Month', 'event_espresso'),
382
-                        'target' => '',
383
-                        'class'  => $this->menu_class,
384
-                    ),
385
-                )
386
-            );
387
-        }
388
-    }
389
-
390
-
391
-    /**
392
-     * @return void
393
-     */
394
-    private function addRegistrationSubMenu()
395
-    {
396
-        if (
397
-            $this->capabilities->current_user_can(
398
-                'ee_read_registrations',
399
-                'ee_admin_bar_menu_espresso-toolbar-registrations'
400
-            )
401
-        ) {
402
-            $this->admin_bar->add_menu(
403
-                array(
404
-                    'id'     => 'espresso-toolbar-registrations',
405
-                    'parent' => 'espresso-toolbar',
406
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
407
-                                . esc_html__('Registrations', 'event_espresso'),
408
-                    'href'   => $this->reg_admin_url,
409
-                    'meta'   => array(
410
-                        'title'  => esc_html__('Registrations', 'event_espresso'),
411
-                        'target' => '',
412
-                        'class'  => $this->menu_class,
413
-                    ),
414
-                )
415
-            );
416
-        }
417
-    }
418
-
419
-
420
-    /**
421
-     * @return void
422
-     */
423
-    private function addRegistrationOverviewToday()
424
-    {
425
-        if (
426
-            $this->capabilities->current_user_can(
427
-                'ee_read_registrations',
428
-                'ee_admin_bar_menu_espresso-toolbar-registrations-today'
429
-            )
430
-        ) {
431
-            $this->admin_bar->add_menu(
432
-                array(
433
-                    'id'     => 'espresso-toolbar-registrations-today',
434
-                    'parent' => 'espresso-toolbar-registrations',
435
-                    'title'  => esc_html__('Today', 'event_espresso'),
436
-                    'href'   => '',
437
-                    'meta'   => array(
438
-                        'title'  => esc_html__('Today', 'event_espresso'),
439
-                        'target' => '',
440
-                        'class'  => $this->menu_class,
441
-                    ),
442
-                )
443
-            );
444
-        }
445
-    }
446
-
447
-
448
-    /**
449
-     * @return void
450
-     */
451
-    private function addRegistrationOverviewTodayApproved()
452
-    {
453
-        if (
454
-            $this->capabilities->current_user_can(
455
-                'ee_read_registrations',
456
-                'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved'
457
-            )
458
-        ) {
459
-            $this->admin_bar->add_menu(
460
-                array(
461
-                    'id'     => 'espresso-toolbar-registrations-today-approved',
462
-                    'parent' => 'espresso-toolbar-registrations',
463
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
464
-                                . esc_html__('Approved', 'event_espresso'),
465
-                    'href'   => EEH_URL::add_query_args_and_nonce(
466
-                        array(
467
-                            'action'      => 'default',
468
-                            'status'      => 'today',
469
-                            '_reg_status' => EEM_Registration::status_id_approved,
470
-                        ),
471
-                        $this->reg_admin_url
472
-                    ),
473
-                    'meta'   => array(
474
-                        'title'  => esc_html__('Approved', 'event_espresso'),
475
-                        'target' => '',
476
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-approved',
477
-                    ),
478
-                )
479
-            );
480
-        }
481
-    }
482
-
483
-
484
-    /**
485
-     * @return void
486
-     */
487
-    private function addRegistrationOverviewTodayPendingPayment()
488
-    {
489
-        if (
490
-            $this->capabilities->current_user_can(
491
-                'ee_read_registrations',
492
-                'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending'
493
-            )
494
-        ) {
495
-            $this->admin_bar->add_menu(
496
-                array(
497
-                    'id'     => 'espresso-toolbar-registrations-today-pending',
498
-                    'parent' => 'espresso-toolbar-registrations',
499
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
500
-                                . esc_html__('Pending', 'event_espresso'),
501
-                    'href'   => EEH_URL::add_query_args_and_nonce(
502
-                        array(
503
-                            'action'      => 'default',
504
-                            'status'      => 'today',
505
-                            '_reg_status' => EEM_Registration::status_id_pending_payment,
506
-                        ),
507
-                        $this->reg_admin_url
508
-                    ),
509
-                    'meta'   => array(
510
-                        'title'  => esc_html__('Pending Payment', 'event_espresso'),
511
-                        'target' => '',
512
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-pending',
513
-                    ),
514
-                )
515
-            );
516
-        }
517
-    }
518
-
519
-
520
-    /**
521
-     * @return void
522
-     */
523
-    private function addRegistrationOverviewTodayNotApproved()
524
-    {
525
-        if (
526
-            $this->capabilities->current_user_can(
527
-                'ee_read_registrations',
528
-                'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved'
529
-            )
530
-        ) {
531
-            $this->admin_bar->add_menu(
532
-                array(
533
-                    'id'     => 'espresso-toolbar-registrations-today-not-approved',
534
-                    'parent' => 'espresso-toolbar-registrations',
535
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
536
-                                . esc_html__('Not Approved', 'event_espresso'),
537
-                    'href'   => EEH_URL::add_query_args_and_nonce(
538
-                        array(
539
-                            'action'      => 'default',
540
-                            'status'      => 'today',
541
-                            '_reg_status' => EEM_Registration::status_id_not_approved,
542
-                        ),
543
-                        $this->reg_admin_url
544
-                    ),
545
-                    'meta'   => array(
546
-                        'title'  => esc_html__('Not Approved', 'event_espresso'),
547
-                        'target' => '',
548
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-not-approved',
549
-                    ),
550
-                )
551
-            );
552
-        }
553
-    }
554
-
555
-
556
-    /**
557
-     * @return void
558
-     */
559
-    private function addRegistrationOverviewTodayCancelled()
560
-    {
561
-        if (
562
-            $this->capabilities->current_user_can(
563
-                'ee_read_registrations',
564
-                'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled'
565
-            )
566
-        ) {
567
-            $this->admin_bar->add_menu(
568
-                array(
569
-                    'id'     => 'espresso-toolbar-registrations-today-cancelled',
570
-                    'parent' => 'espresso-toolbar-registrations',
571
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
572
-                                . esc_html__('Cancelled', 'event_espresso'),
573
-                    'href'   => EEH_URL::add_query_args_and_nonce(
574
-                        array(
575
-                            'action'      => 'default',
576
-                            'status'      => 'today',
577
-                            '_reg_status' => EEM_Registration::status_id_cancelled,
578
-                        ),
579
-                        $this->reg_admin_url
580
-                    ),
581
-                    'meta'   => array(
582
-                        'title'  => esc_html__('Cancelled', 'event_espresso'),
583
-                        'target' => '',
584
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-cancelled',
585
-                    ),
586
-                )
587
-            );
588
-        }
589
-    }
590
-
591
-
592
-    /**
593
-     * @return void
594
-     */
595
-    private function addRegistrationOverviewThisMonth()
596
-    {
597
-        if (
598
-            $this->capabilities->current_user_can(
599
-                'ee_read_registrations',
600
-                'ee_admin_bar_menu_espresso-toolbar-registrations-month'
601
-            )
602
-        ) {
603
-            $this->admin_bar->add_menu(
604
-                array(
605
-                    'id'     => 'espresso-toolbar-registrations-month',
606
-                    'parent' => 'espresso-toolbar-registrations',
607
-                    'title'  => esc_html__('This Month', 'event_espresso'),
608
-                    'href'   => '', // EEH_URL::add_query_args_and_nonce(
609
-                    //     array(
610
-                    //         'action' => 'default',
611
-                    //         'status' => 'month'
612
-                    //     ),
613
-                    //     $this->reg_admin_url
614
-                    // ),
615
-                    'meta'   => array(
616
-                        'title'  => esc_html__('This Month', 'event_espresso'),
617
-                        'target' => '',
618
-                        'class'  => $this->menu_class,
619
-                    ),
620
-                )
621
-            );
622
-        }
623
-    }
624
-
625
-
626
-    /**
627
-     * @return void
628
-     */
629
-    private function addRegistrationOverviewThisMonthApproved()
630
-    {
631
-        if (
632
-            $this->capabilities->current_user_can(
633
-                'ee_read_registrations',
634
-                'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved'
635
-            )
636
-        ) {
637
-            $this->admin_bar->add_menu(
638
-                array(
639
-                    'id'     => 'espresso-toolbar-registrations-month-approved',
640
-                    'parent' => 'espresso-toolbar-registrations',
641
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
642
-                                . esc_html__('Approved', 'event_espresso'),
643
-                    'href'   => EEH_URL::add_query_args_and_nonce(
644
-                        array(
645
-                            'action'      => 'default',
646
-                            'status'      => 'month',
647
-                            '_reg_status' => EEM_Registration::status_id_approved,
648
-                        ),
649
-                        $this->reg_admin_url
650
-                    ),
651
-                    'meta'   => array(
652
-                        'title'  => esc_html__('Approved', 'event_espresso'),
653
-                        'target' => '',
654
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-approved',
655
-                    ),
656
-                )
657
-            );
658
-        }
659
-    }
660
-
661
-
662
-    /**
663
-     * @return void
664
-     */
665
-    private function addRegistrationOverviewThisMonthPending()
666
-    {
667
-        if (
668
-            $this->capabilities->current_user_can(
669
-                'ee_read_registrations',
670
-                'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending'
671
-            )
672
-        ) {
673
-            $this->admin_bar->add_menu(
674
-                array(
675
-                    'id'     => 'espresso-toolbar-registrations-month-pending',
676
-                    'parent' => 'espresso-toolbar-registrations',
677
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
678
-                                . esc_html__('Pending', 'event_espresso'),
679
-                    'href'   => EEH_URL::add_query_args_and_nonce(
680
-                        array(
681
-                            'action'      => 'default',
682
-                            'status'      => 'month',
683
-                            '_reg_status' => EEM_Registration::status_id_pending_payment,
684
-                        ),
685
-                        $this->reg_admin_url
686
-                    ),
687
-                    'meta'   => array(
688
-                        'title'  => esc_html__('Pending', 'event_espresso'),
689
-                        'target' => '',
690
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-pending',
691
-                    ),
692
-                )
693
-            );
694
-        }
695
-    }
696
-
697
-
698
-    /**
699
-     * @return void
700
-     */
701
-    private function addRegistrationOverviewThisMonthNotApproved()
702
-    {
703
-        if (
704
-            $this->capabilities->current_user_can(
705
-                'ee_read_registrations',
706
-                'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved'
707
-            )
708
-        ) {
709
-            $this->admin_bar->add_menu(
710
-                array(
711
-                    'id'     => 'espresso-toolbar-registrations-month-not-approved',
712
-                    'parent' => 'espresso-toolbar-registrations',
713
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
714
-                                . esc_html__('Not Approved', 'event_espresso'),
715
-                    'href'   => EEH_URL::add_query_args_and_nonce(
716
-                        array(
717
-                            'action'      => 'default',
718
-                            'status'      => 'month',
719
-                            '_reg_status' => EEM_Registration::status_id_not_approved,
720
-                        ),
721
-                        $this->reg_admin_url
722
-                    ),
723
-                    'meta'   => array(
724
-                        'title'  => esc_html__('Not Approved', 'event_espresso'),
725
-                        'target' => '',
726
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-not-approved',
727
-                    ),
728
-                )
729
-            );
730
-        }
731
-    }
732
-
733
-
734
-    /**
735
-     * @return void
736
-     */
737
-    private function addRegistrationOverviewThisMonthCancelled()
738
-    {
739
-        if (
740
-            $this->capabilities->current_user_can(
741
-                'ee_read_registrations',
742
-                'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled'
743
-            )
744
-        ) {
745
-            $this->admin_bar->add_menu(
746
-                array(
747
-                    'id'     => 'espresso-toolbar-registrations-month-cancelled',
748
-                    'parent' => 'espresso-toolbar-registrations',
749
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
750
-                                . esc_html__('Cancelled', 'event_espresso'),
751
-                    'href'   => EEH_URL::add_query_args_and_nonce(
752
-                        array(
753
-                            'action'      => 'default',
754
-                            'status'      => 'month',
755
-                            '_reg_status' => EEM_Registration::status_id_cancelled,
756
-                        ),
757
-                        $this->reg_admin_url
758
-                    ),
759
-                    'meta'   => array(
760
-                        'title'  => esc_html__('Cancelled', 'event_espresso'),
761
-                        'target' => '',
762
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-cancelled',
763
-                    ),
764
-                )
765
-            );
766
-        }
767
-    }
768
-
769
-
770
-    /**
771
-     * @return void
772
-     */
773
-    private function addExtensionsAndServices()
774
-    {
775
-        if (
776
-            $this->capabilities->current_user_can(
777
-                'ee_read_ee',
778
-                'ee_admin_bar_menu_espresso-toolbar-extensions-and-services'
779
-            )
780
-        ) {
781
-            $this->admin_bar->add_menu(
782
-                array(
783
-                    'id'     => 'espresso-toolbar-extensions-and-services',
784
-                    'parent' => 'espresso-toolbar',
785
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
786
-                                . esc_html__('Extensions & Services', 'event_espresso'),
787
-                    'href'   => admin_url('admin.php?page=espresso_packages'),
788
-                    'meta'   => array(
789
-                        'title'  => esc_html__('Extensions & Services', 'event_espresso'),
790
-                        'target' => '',
791
-                        'class'  => $this->menu_class,
792
-                    ),
793
-                )
794
-            );
795
-        }
796
-    }
21
+	/**
22
+	 * @var WP_Admin_Bar $admin_bar
23
+	 */
24
+	private $admin_bar;
25
+
26
+	/**
27
+	 * @var EE_Capabilities $capabilities
28
+	 */
29
+	private $capabilities;
30
+
31
+	/**
32
+	 * @var string $events_admin_url
33
+	 */
34
+	private $events_admin_url;
35
+
36
+	/**
37
+	 * @var string $menu_class
38
+	 */
39
+	private $menu_class = 'espresso_menu_item_class';
40
+
41
+	/**
42
+	 * @var string $reg_admin_url
43
+	 */
44
+	private $reg_admin_url;
45
+
46
+
47
+	/**
48
+	 * AdminToolBar constructor.
49
+	 *
50
+	 * @param EE_Capabilities $capabilities
51
+	 */
52
+	public function __construct(EE_Capabilities $capabilities)
53
+	{
54
+		$this->capabilities = $capabilities;
55
+		add_action('admin_bar_menu', array($this, 'espressoToolbarItems'), 100);
56
+		$this->enqueueAssets();
57
+	}
58
+
59
+
60
+	/**
61
+	 *    espresso_toolbar_items
62
+	 *
63
+	 * @access public
64
+	 * @param  WP_Admin_Bar $admin_bar
65
+	 * @return void
66
+	 */
67
+	public function espressoToolbarItems(WP_Admin_Bar $admin_bar)
68
+	{
69
+		// if its an AJAX request, or user is NOT an admin, or in full M-Mode
70
+		if (
71
+			defined('DOING_AJAX')
72
+			|| ! $this->capabilities->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')
73
+			|| EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance
74
+		) {
75
+			return;
76
+		}
77
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
78
+		$this->admin_bar = $admin_bar;
79
+		// we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL
80
+		// because they're only defined in each of their respective constructors
81
+		// and this might be a frontend request, in which case they aren't available
82
+		$this->events_admin_url = admin_url('admin.php?page=espresso_events');
83
+		$this->reg_admin_url = admin_url('admin.php?page=espresso_registrations');
84
+		// now let's add all of the menu items
85
+		$this->addTopLevelMenu();
86
+		$this->addEventsSubMenu();
87
+		$this->addEventsAddEditHeader();
88
+		$this->addEventsAddNew();
89
+		$this->addEventsEditCurrentEvent();
90
+		$this->addEventsViewHeader();
91
+		$this->addEventsViewAll();
92
+		$this->addEventsViewToday();
93
+		$this->addEventsViewThisMonth();
94
+		$this->addRegistrationSubMenu();
95
+		$this->addRegistrationOverviewToday();
96
+		$this->addRegistrationOverviewTodayApproved();
97
+		$this->addRegistrationOverviewTodayPendingPayment();
98
+		$this->addRegistrationOverviewTodayNotApproved();
99
+		$this->addRegistrationOverviewTodayCancelled();
100
+		$this->addRegistrationOverviewThisMonth();
101
+		$this->addRegistrationOverviewThisMonthApproved();
102
+		$this->addRegistrationOverviewThisMonthPending();
103
+		$this->addRegistrationOverviewThisMonthNotApproved();
104
+		$this->addRegistrationOverviewThisMonthCancelled();
105
+		$this->addExtensionsAndServices();
106
+	}
107
+
108
+
109
+	/**
110
+	 * @return void
111
+	 */
112
+	private function enqueueAssets()
113
+	{
114
+		wp_register_style(
115
+			'espresso-admin-toolbar',
116
+			EE_GLOBAL_ASSETS_URL . 'css/espresso-admin-toolbar.css',
117
+			array('dashicons'),
118
+			EVENT_ESPRESSO_VERSION
119
+		);
120
+		wp_enqueue_style('espresso-admin-toolbar');
121
+	}
122
+
123
+
124
+	/**
125
+	 * @return void
126
+	 */
127
+	private function addTopLevelMenu()
128
+	{
129
+		$this->admin_bar->add_menu(
130
+			array(
131
+				'id'    => 'espresso-toolbar',
132
+				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'
133
+						   . esc_html_x('Event Espresso', 'admin bar menu group label', 'event_espresso')
134
+						   . '</span>',
135
+				'href'  => $this->events_admin_url,
136
+				'meta'  => array(
137
+					'title' => esc_html__('Event Espresso', 'event_espresso'),
138
+					'class' => $this->menu_class . 'first',
139
+				),
140
+			)
141
+		);
142
+	}
143
+
144
+
145
+	/**
146
+	 * @return void
147
+	 */
148
+	private function addEventsSubMenu()
149
+	{
150
+		if (
151
+			$this->capabilities->current_user_can(
152
+				'ee_read_events',
153
+				'ee_admin_bar_menu_espresso-toolbar-events'
154
+			)
155
+		) {
156
+			$this->admin_bar->add_menu(
157
+				array(
158
+					'id'     => 'espresso-toolbar-events',
159
+					'parent' => 'espresso-toolbar',
160
+					'title'  => '<span class="ee-toolbar-icon"></span>'
161
+								. esc_html__('Events', 'event_espresso'),
162
+					'href'   => $this->events_admin_url,
163
+					'meta'   => array(
164
+						'title'  => esc_html__('Events', 'event_espresso'),
165
+						'target' => '',
166
+						'class'  => $this->menu_class,
167
+					),
168
+				)
169
+			);
170
+		}
171
+	}
172
+
173
+
174
+	/**
175
+	 * @return void
176
+	 */
177
+	private function addEventsAddEditHeader()
178
+	{
179
+		if (
180
+			$this->capabilities->current_user_can(
181
+				'ee_read_events',
182
+				'ee_admin_bar_menu_espresso-toolbar-events-view'
183
+			)
184
+		) {
185
+			$this->admin_bar->add_menu(
186
+				array(
187
+					'id'     => 'espresso-toolbar-events-add-edit',
188
+					'parent' => 'espresso-toolbar-events',
189
+					'title'  => esc_html__('Add / Edit', 'event_espresso'),
190
+					'href'   => '',
191
+				)
192
+			);
193
+		}
194
+	}
195
+
196
+
197
+	/**
198
+	 * @return void
199
+	 */
200
+	private function addEventsAddNew()
201
+	{
202
+		if (
203
+			$this->capabilities->current_user_can(
204
+				'ee_edit_events',
205
+				'ee_admin_bar_menu_espresso-toolbar-events-new'
206
+			)
207
+		) {
208
+			$this->admin_bar->add_menu(
209
+				array(
210
+					'id'     => 'espresso-toolbar-events-new',
211
+					'parent' => 'espresso-toolbar-events',
212
+					'title'  => '<span class="ee-toolbar-icon"></span>'
213
+								. esc_html__('Add New', 'event_espresso'),
214
+					'href'   => EEH_URL::add_query_args_and_nonce(
215
+						array('action' => 'create_new'),
216
+						$this->events_admin_url
217
+					),
218
+					'meta'   => array(
219
+						'title'  => esc_html__('Add New', 'event_espresso'),
220
+						'target' => '',
221
+						'class'  => $this->menu_class,
222
+					),
223
+				)
224
+			);
225
+		}
226
+	}
227
+
228
+
229
+	/**
230
+	 * @return void
231
+	 */
232
+	private function addEventsEditCurrentEvent()
233
+	{
234
+		if (is_single() && (get_post_type() === 'espresso_events')) {
235
+			// Current post
236
+			global $post;
237
+			if (
238
+				$this->capabilities->current_user_can(
239
+					'ee_edit_event',
240
+					'ee_admin_bar_menu_espresso-toolbar-events-edit',
241
+					$post->ID
242
+				)
243
+			) {
244
+				$this->admin_bar->add_menu(
245
+					array(
246
+						'id'     => 'espresso-toolbar-events-edit',
247
+						'parent' => 'espresso-toolbar-events',
248
+						'title'  => '<span class="ee-toolbar-icon"></span>'
249
+									. esc_html__('Edit Event', 'event_espresso'),
250
+						'href'   => EEH_URL::add_query_args_and_nonce(
251
+							array(
252
+								'action' => 'edit',
253
+								'post'   => $post->ID,
254
+							),
255
+							$this->events_admin_url
256
+						),
257
+						'meta'   => array(
258
+							'title'  => esc_html__('Edit Event', 'event_espresso'),
259
+							'target' => '',
260
+							'class'  => $this->menu_class,
261
+						),
262
+					)
263
+				);
264
+			}
265
+		}
266
+	}
267
+
268
+
269
+	/**
270
+	 * @return void
271
+	 */
272
+	private function addEventsViewHeader()
273
+	{
274
+		if (
275
+			$this->capabilities->current_user_can(
276
+				'ee_read_events',
277
+				'ee_admin_bar_menu_espresso-toolbar-events-view'
278
+			)
279
+		) {
280
+			$this->admin_bar->add_menu(
281
+				array(
282
+					'id'     => 'espresso-toolbar-events-view',
283
+					'parent' => 'espresso-toolbar-events',
284
+					'title'  => esc_html__('View', 'event_espresso'),
285
+					'href'   => '',
286
+				)
287
+			);
288
+		}
289
+	}
290
+
291
+
292
+	/**
293
+	 * @return void
294
+	 */
295
+	private function addEventsViewAll()
296
+	{
297
+		if (
298
+			$this->capabilities->current_user_can(
299
+				'ee_read_events',
300
+				'ee_admin_bar_menu_espresso-toolbar-events-all'
301
+			)
302
+		) {
303
+			$this->admin_bar->add_menu(
304
+				array(
305
+					'id'     => 'espresso-toolbar-events-all',
306
+					'parent' => 'espresso-toolbar-events',
307
+					'title'  => '<span class="ee-toolbar-icon"></span>'
308
+								. esc_html__('All', 'event_espresso'),
309
+					'href'   => $this->events_admin_url,
310
+					'meta'   => array(
311
+						'title'  => esc_html__('All', 'event_espresso'),
312
+						'target' => '',
313
+						'class'  => $this->menu_class,
314
+					),
315
+				)
316
+			);
317
+		}
318
+	}
319
+
320
+
321
+	/**
322
+	 * @return void
323
+	 */
324
+	private function addEventsViewToday()
325
+	{
326
+		if (
327
+			$this->capabilities->current_user_can(
328
+				'ee_read_events',
329
+				'ee_admin_bar_menu_espresso-toolbar-events-today'
330
+			)
331
+		) {
332
+			$this->admin_bar->add_menu(
333
+				array(
334
+					'id'     => 'espresso-toolbar-events-today',
335
+					'parent' => 'espresso-toolbar-events',
336
+					'title'  => '<span class="ee-toolbar-icon"></span>'
337
+								. esc_html__('Today', 'event_espresso'),
338
+					'href'   => EEH_URL::add_query_args_and_nonce(
339
+						array(
340
+							'action' => 'default',
341
+							'status' => 'today',
342
+						),
343
+						$this->events_admin_url
344
+					),
345
+					'meta'   => array(
346
+						'title'  => esc_html__('Today', 'event_espresso'),
347
+						'target' => '',
348
+						'class'  => $this->menu_class,
349
+					),
350
+				)
351
+			);
352
+		}
353
+	}
354
+
355
+
356
+	/**
357
+	 * @return void
358
+	 */
359
+	private function addEventsViewThisMonth()
360
+	{
361
+		if (
362
+			$this->capabilities->current_user_can(
363
+				'ee_read_events',
364
+				'ee_admin_bar_menu_espresso-toolbar-events-month'
365
+			)
366
+		) {
367
+			$this->admin_bar->add_menu(
368
+				array(
369
+					'id'     => 'espresso-toolbar-events-month',
370
+					'parent' => 'espresso-toolbar-events',
371
+					'title'  => '<span class="ee-toolbar-icon"></span>'
372
+								. esc_html__('This Month', 'event_espresso'),
373
+					'href'   => EEH_URL::add_query_args_and_nonce(
374
+						array(
375
+							'action' => 'default',
376
+							'status' => 'month',
377
+						),
378
+						$this->events_admin_url
379
+					),
380
+					'meta'   => array(
381
+						'title'  => esc_html__('This Month', 'event_espresso'),
382
+						'target' => '',
383
+						'class'  => $this->menu_class,
384
+					),
385
+				)
386
+			);
387
+		}
388
+	}
389
+
390
+
391
+	/**
392
+	 * @return void
393
+	 */
394
+	private function addRegistrationSubMenu()
395
+	{
396
+		if (
397
+			$this->capabilities->current_user_can(
398
+				'ee_read_registrations',
399
+				'ee_admin_bar_menu_espresso-toolbar-registrations'
400
+			)
401
+		) {
402
+			$this->admin_bar->add_menu(
403
+				array(
404
+					'id'     => 'espresso-toolbar-registrations',
405
+					'parent' => 'espresso-toolbar',
406
+					'title'  => '<span class="ee-toolbar-icon"></span>'
407
+								. esc_html__('Registrations', 'event_espresso'),
408
+					'href'   => $this->reg_admin_url,
409
+					'meta'   => array(
410
+						'title'  => esc_html__('Registrations', 'event_espresso'),
411
+						'target' => '',
412
+						'class'  => $this->menu_class,
413
+					),
414
+				)
415
+			);
416
+		}
417
+	}
418
+
419
+
420
+	/**
421
+	 * @return void
422
+	 */
423
+	private function addRegistrationOverviewToday()
424
+	{
425
+		if (
426
+			$this->capabilities->current_user_can(
427
+				'ee_read_registrations',
428
+				'ee_admin_bar_menu_espresso-toolbar-registrations-today'
429
+			)
430
+		) {
431
+			$this->admin_bar->add_menu(
432
+				array(
433
+					'id'     => 'espresso-toolbar-registrations-today',
434
+					'parent' => 'espresso-toolbar-registrations',
435
+					'title'  => esc_html__('Today', 'event_espresso'),
436
+					'href'   => '',
437
+					'meta'   => array(
438
+						'title'  => esc_html__('Today', 'event_espresso'),
439
+						'target' => '',
440
+						'class'  => $this->menu_class,
441
+					),
442
+				)
443
+			);
444
+		}
445
+	}
446
+
447
+
448
+	/**
449
+	 * @return void
450
+	 */
451
+	private function addRegistrationOverviewTodayApproved()
452
+	{
453
+		if (
454
+			$this->capabilities->current_user_can(
455
+				'ee_read_registrations',
456
+				'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved'
457
+			)
458
+		) {
459
+			$this->admin_bar->add_menu(
460
+				array(
461
+					'id'     => 'espresso-toolbar-registrations-today-approved',
462
+					'parent' => 'espresso-toolbar-registrations',
463
+					'title'  => '<span class="ee-toolbar-icon"></span>'
464
+								. esc_html__('Approved', 'event_espresso'),
465
+					'href'   => EEH_URL::add_query_args_and_nonce(
466
+						array(
467
+							'action'      => 'default',
468
+							'status'      => 'today',
469
+							'_reg_status' => EEM_Registration::status_id_approved,
470
+						),
471
+						$this->reg_admin_url
472
+					),
473
+					'meta'   => array(
474
+						'title'  => esc_html__('Approved', 'event_espresso'),
475
+						'target' => '',
476
+						'class'  => $this->menu_class . ' ee-toolbar-icon-approved',
477
+					),
478
+				)
479
+			);
480
+		}
481
+	}
482
+
483
+
484
+	/**
485
+	 * @return void
486
+	 */
487
+	private function addRegistrationOverviewTodayPendingPayment()
488
+	{
489
+		if (
490
+			$this->capabilities->current_user_can(
491
+				'ee_read_registrations',
492
+				'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending'
493
+			)
494
+		) {
495
+			$this->admin_bar->add_menu(
496
+				array(
497
+					'id'     => 'espresso-toolbar-registrations-today-pending',
498
+					'parent' => 'espresso-toolbar-registrations',
499
+					'title'  => '<span class="ee-toolbar-icon"></span>'
500
+								. esc_html__('Pending', 'event_espresso'),
501
+					'href'   => EEH_URL::add_query_args_and_nonce(
502
+						array(
503
+							'action'      => 'default',
504
+							'status'      => 'today',
505
+							'_reg_status' => EEM_Registration::status_id_pending_payment,
506
+						),
507
+						$this->reg_admin_url
508
+					),
509
+					'meta'   => array(
510
+						'title'  => esc_html__('Pending Payment', 'event_espresso'),
511
+						'target' => '',
512
+						'class'  => $this->menu_class . ' ee-toolbar-icon-pending',
513
+					),
514
+				)
515
+			);
516
+		}
517
+	}
518
+
519
+
520
+	/**
521
+	 * @return void
522
+	 */
523
+	private function addRegistrationOverviewTodayNotApproved()
524
+	{
525
+		if (
526
+			$this->capabilities->current_user_can(
527
+				'ee_read_registrations',
528
+				'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved'
529
+			)
530
+		) {
531
+			$this->admin_bar->add_menu(
532
+				array(
533
+					'id'     => 'espresso-toolbar-registrations-today-not-approved',
534
+					'parent' => 'espresso-toolbar-registrations',
535
+					'title'  => '<span class="ee-toolbar-icon"></span>'
536
+								. esc_html__('Not Approved', 'event_espresso'),
537
+					'href'   => EEH_URL::add_query_args_and_nonce(
538
+						array(
539
+							'action'      => 'default',
540
+							'status'      => 'today',
541
+							'_reg_status' => EEM_Registration::status_id_not_approved,
542
+						),
543
+						$this->reg_admin_url
544
+					),
545
+					'meta'   => array(
546
+						'title'  => esc_html__('Not Approved', 'event_espresso'),
547
+						'target' => '',
548
+						'class'  => $this->menu_class . ' ee-toolbar-icon-not-approved',
549
+					),
550
+				)
551
+			);
552
+		}
553
+	}
554
+
555
+
556
+	/**
557
+	 * @return void
558
+	 */
559
+	private function addRegistrationOverviewTodayCancelled()
560
+	{
561
+		if (
562
+			$this->capabilities->current_user_can(
563
+				'ee_read_registrations',
564
+				'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled'
565
+			)
566
+		) {
567
+			$this->admin_bar->add_menu(
568
+				array(
569
+					'id'     => 'espresso-toolbar-registrations-today-cancelled',
570
+					'parent' => 'espresso-toolbar-registrations',
571
+					'title'  => '<span class="ee-toolbar-icon"></span>'
572
+								. esc_html__('Cancelled', 'event_espresso'),
573
+					'href'   => EEH_URL::add_query_args_and_nonce(
574
+						array(
575
+							'action'      => 'default',
576
+							'status'      => 'today',
577
+							'_reg_status' => EEM_Registration::status_id_cancelled,
578
+						),
579
+						$this->reg_admin_url
580
+					),
581
+					'meta'   => array(
582
+						'title'  => esc_html__('Cancelled', 'event_espresso'),
583
+						'target' => '',
584
+						'class'  => $this->menu_class . ' ee-toolbar-icon-cancelled',
585
+					),
586
+				)
587
+			);
588
+		}
589
+	}
590
+
591
+
592
+	/**
593
+	 * @return void
594
+	 */
595
+	private function addRegistrationOverviewThisMonth()
596
+	{
597
+		if (
598
+			$this->capabilities->current_user_can(
599
+				'ee_read_registrations',
600
+				'ee_admin_bar_menu_espresso-toolbar-registrations-month'
601
+			)
602
+		) {
603
+			$this->admin_bar->add_menu(
604
+				array(
605
+					'id'     => 'espresso-toolbar-registrations-month',
606
+					'parent' => 'espresso-toolbar-registrations',
607
+					'title'  => esc_html__('This Month', 'event_espresso'),
608
+					'href'   => '', // EEH_URL::add_query_args_and_nonce(
609
+					//     array(
610
+					//         'action' => 'default',
611
+					//         'status' => 'month'
612
+					//     ),
613
+					//     $this->reg_admin_url
614
+					// ),
615
+					'meta'   => array(
616
+						'title'  => esc_html__('This Month', 'event_espresso'),
617
+						'target' => '',
618
+						'class'  => $this->menu_class,
619
+					),
620
+				)
621
+			);
622
+		}
623
+	}
624
+
625
+
626
+	/**
627
+	 * @return void
628
+	 */
629
+	private function addRegistrationOverviewThisMonthApproved()
630
+	{
631
+		if (
632
+			$this->capabilities->current_user_can(
633
+				'ee_read_registrations',
634
+				'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved'
635
+			)
636
+		) {
637
+			$this->admin_bar->add_menu(
638
+				array(
639
+					'id'     => 'espresso-toolbar-registrations-month-approved',
640
+					'parent' => 'espresso-toolbar-registrations',
641
+					'title'  => '<span class="ee-toolbar-icon"></span>'
642
+								. esc_html__('Approved', 'event_espresso'),
643
+					'href'   => EEH_URL::add_query_args_and_nonce(
644
+						array(
645
+							'action'      => 'default',
646
+							'status'      => 'month',
647
+							'_reg_status' => EEM_Registration::status_id_approved,
648
+						),
649
+						$this->reg_admin_url
650
+					),
651
+					'meta'   => array(
652
+						'title'  => esc_html__('Approved', 'event_espresso'),
653
+						'target' => '',
654
+						'class'  => $this->menu_class . ' ee-toolbar-icon-approved',
655
+					),
656
+				)
657
+			);
658
+		}
659
+	}
660
+
661
+
662
+	/**
663
+	 * @return void
664
+	 */
665
+	private function addRegistrationOverviewThisMonthPending()
666
+	{
667
+		if (
668
+			$this->capabilities->current_user_can(
669
+				'ee_read_registrations',
670
+				'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending'
671
+			)
672
+		) {
673
+			$this->admin_bar->add_menu(
674
+				array(
675
+					'id'     => 'espresso-toolbar-registrations-month-pending',
676
+					'parent' => 'espresso-toolbar-registrations',
677
+					'title'  => '<span class="ee-toolbar-icon"></span>'
678
+								. esc_html__('Pending', 'event_espresso'),
679
+					'href'   => EEH_URL::add_query_args_and_nonce(
680
+						array(
681
+							'action'      => 'default',
682
+							'status'      => 'month',
683
+							'_reg_status' => EEM_Registration::status_id_pending_payment,
684
+						),
685
+						$this->reg_admin_url
686
+					),
687
+					'meta'   => array(
688
+						'title'  => esc_html__('Pending', 'event_espresso'),
689
+						'target' => '',
690
+						'class'  => $this->menu_class . ' ee-toolbar-icon-pending',
691
+					),
692
+				)
693
+			);
694
+		}
695
+	}
696
+
697
+
698
+	/**
699
+	 * @return void
700
+	 */
701
+	private function addRegistrationOverviewThisMonthNotApproved()
702
+	{
703
+		if (
704
+			$this->capabilities->current_user_can(
705
+				'ee_read_registrations',
706
+				'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved'
707
+			)
708
+		) {
709
+			$this->admin_bar->add_menu(
710
+				array(
711
+					'id'     => 'espresso-toolbar-registrations-month-not-approved',
712
+					'parent' => 'espresso-toolbar-registrations',
713
+					'title'  => '<span class="ee-toolbar-icon"></span>'
714
+								. esc_html__('Not Approved', 'event_espresso'),
715
+					'href'   => EEH_URL::add_query_args_and_nonce(
716
+						array(
717
+							'action'      => 'default',
718
+							'status'      => 'month',
719
+							'_reg_status' => EEM_Registration::status_id_not_approved,
720
+						),
721
+						$this->reg_admin_url
722
+					),
723
+					'meta'   => array(
724
+						'title'  => esc_html__('Not Approved', 'event_espresso'),
725
+						'target' => '',
726
+						'class'  => $this->menu_class . ' ee-toolbar-icon-not-approved',
727
+					),
728
+				)
729
+			);
730
+		}
731
+	}
732
+
733
+
734
+	/**
735
+	 * @return void
736
+	 */
737
+	private function addRegistrationOverviewThisMonthCancelled()
738
+	{
739
+		if (
740
+			$this->capabilities->current_user_can(
741
+				'ee_read_registrations',
742
+				'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled'
743
+			)
744
+		) {
745
+			$this->admin_bar->add_menu(
746
+				array(
747
+					'id'     => 'espresso-toolbar-registrations-month-cancelled',
748
+					'parent' => 'espresso-toolbar-registrations',
749
+					'title'  => '<span class="ee-toolbar-icon"></span>'
750
+								. esc_html__('Cancelled', 'event_espresso'),
751
+					'href'   => EEH_URL::add_query_args_and_nonce(
752
+						array(
753
+							'action'      => 'default',
754
+							'status'      => 'month',
755
+							'_reg_status' => EEM_Registration::status_id_cancelled,
756
+						),
757
+						$this->reg_admin_url
758
+					),
759
+					'meta'   => array(
760
+						'title'  => esc_html__('Cancelled', 'event_espresso'),
761
+						'target' => '',
762
+						'class'  => $this->menu_class . ' ee-toolbar-icon-cancelled',
763
+					),
764
+				)
765
+			);
766
+		}
767
+	}
768
+
769
+
770
+	/**
771
+	 * @return void
772
+	 */
773
+	private function addExtensionsAndServices()
774
+	{
775
+		if (
776
+			$this->capabilities->current_user_can(
777
+				'ee_read_ee',
778
+				'ee_admin_bar_menu_espresso-toolbar-extensions-and-services'
779
+			)
780
+		) {
781
+			$this->admin_bar->add_menu(
782
+				array(
783
+					'id'     => 'espresso-toolbar-extensions-and-services',
784
+					'parent' => 'espresso-toolbar',
785
+					'title'  => '<span class="ee-toolbar-icon"></span>'
786
+								. esc_html__('Extensions & Services', 'event_espresso'),
787
+					'href'   => admin_url('admin.php?page=espresso_packages'),
788
+					'meta'   => array(
789
+						'title'  => esc_html__('Extensions & Services', 'event_espresso'),
790
+						'target' => '',
791
+						'class'  => $this->menu_class,
792
+					),
793
+				)
794
+			);
795
+		}
796
+	}
797 797
 }
Please login to merge, or discard this patch.
core/services/cache/BasicCacheManager.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         // with these parameters
141 141
         $cache_id .= filter_input(INPUT_SERVER, 'QUERY_STRING', FILTER_SANITIZE_URL);
142 142
         // then md5 the above to control it's length, add all of our prefixes, and truncate
143
-        return substr($this->cachePrefix() . $id_prefix . '-' . md5($cache_id), 0, 182);
143
+        return substr($this->cachePrefix().$id_prefix.'-'.md5($cache_id), 0, 182);
144 144
     }
145 145
 
146 146
 
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
         return '
171 171
 <div class="ee-cached-content-notice" style="position:fixed; bottom:0; left: 0;">
172 172
     <p style="font-size:9px;font-weight:normal;color:#666;line-height: 12px;margin:0 0 3px 5px">
173
-        <b>' . $type . '</b><span style="color:#999"> : </span>
174
-        <span>' . $cache_id . '</span>
175
-        <span style="margin-left:2em;">' . __FILE__ . '</span>
173
+        <b>' . $type.'</b><span style="color:#999"> : </span>
174
+        <span>' . $cache_id.'</span>
175
+        <span style="margin-left:2em;">' . __FILE__.'</span>
176 176
     </p>
177 177
 </div>';
178 178
     }
Please login to merge, or discard this patch.
Indentation   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -14,135 +14,135 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class BasicCacheManager implements CacheManagerInterface
16 16
 {
17
-    /**
18
-     * @type string
19
-     */
20
-    const CACHE_PREFIX = 'ee_cache_';
21
-
22
-
23
-    /**
24
-     * @var CacheStorageInterface $cache_storage
25
-     */
26
-    private $cache_storage;
27
-
28
-
29
-    /**
30
-     * BasicCacheManager constructor.
31
-     *
32
-     * @param CacheStorageInterface $cache_storage [required]
33
-     */
34
-    public function __construct(CacheStorageInterface $cache_storage)
35
-    {
36
-        $this->cache_storage = $cache_storage;
37
-    }
38
-
39
-
40
-    /**
41
-     * returns a string that will be prepended to all cache identifiers
42
-     *
43
-     * @return string
44
-     */
45
-    public function cachePrefix()
46
-    {
47
-        return BasicCacheManager::CACHE_PREFIX;
48
-    }
49
-
50
-
51
-    /**
52
-     * @param string  $id_prefix [required] Prepended to all cache IDs. Can be helpful in finding specific cache types.
53
-     *                           May also be helpful to include an additional specific identifier,
54
-     *                           such as a post ID as part of the $id_prefix so that individual caches
55
-     *                           can be found and/or cleared. ex: "venue-28", or "shortcode-156".
56
-     *                           BasicCacheManager::CACHE_PREFIX will also be prepended to the cache id.
57
-     * @param string  $cache_id  [required] Additional identifying details that make this cache unique.
58
-     *                           It is advisable to use some of the actual data
59
-     *                           that is used to generate the content being cached,
60
-     *                           in order to guarantee that the cache id is unique for that content.
61
-     *                           The cache id will be md5'd before usage to make it more db friendly,
62
-     *                           and the entire cache id string will be truncated to 190 characters.
63
-     * @param Closure $callback  [required] since the point of caching is to avoid generating content when not
64
-     *                           necessary,
65
-     *                           we wrap our content creation in a Closure so that it is not executed until needed.
66
-     * @param int     $expiration
67
-     * @return Closure|mixed
68
-     */
69
-    public function get($id_prefix, $cache_id, Closure $callback, $expiration = HOUR_IN_SECONDS)
70
-    {
71
-        $content = '';
72
-        $expiration = absint(
73
-            apply_filters(
74
-                'FHEE__CacheManager__get__cache_expiration',
75
-                $expiration,
76
-                $id_prefix,
77
-                $cache_id
78
-            )
79
-        );
80
-        $cache_id = $this->generateCacheIdentifier($id_prefix, $cache_id);
81
-        // is caching enabled for this content ?
82
-        if ($expiration) {
83
-            $content = $this->cache_storage->get($cache_id);
84
-        }
85
-        // any existing content ?
86
-        if (empty($content)) {
87
-            // nope! let's generate some new stuff
88
-            $content = $callback();
89
-            // save the new content if caching is enabled
90
-            if ($expiration) {
91
-                $this->cache_storage->add($cache_id, $content, $expiration);
92
-                if (EE_DEBUG) {
93
-                    $content .= $this->displayCacheNotice($cache_id, 'REFRESH CACHE');
94
-                }
95
-            }
96
-        } else {
97
-            if (EE_DEBUG) {
98
-                $content .= $this->displayCacheNotice($cache_id, 'CACHED CONTENT');
99
-            }
100
-        }
101
-        return $content;
102
-    }
103
-
104
-
105
-    /**
106
-     * Generates a unique identifier string for the cache
107
-     *
108
-     * @param string $id_prefix [required] see BasicCacheManager::get()
109
-     * @param string $cache_id  [required] see BasicCacheManager::get()
110
-     * @return string
111
-     */
112
-    private function generateCacheIdentifier($id_prefix, $cache_id)
113
-    {
114
-        // let's make the cached content unique for this "page"
115
-        $cache_id .= filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL);
116
-        // with these parameters
117
-        $cache_id .= filter_input(INPUT_SERVER, 'QUERY_STRING', FILTER_SANITIZE_URL);
118
-        // then md5 the above to control it's length, add all of our prefixes, and truncate
119
-        return substr($this->cachePrefix() . $id_prefix . '-' . md5($cache_id), 0, 182);
120
-    }
121
-
122
-
123
-    /**
124
-     * @param array|string $cache_id [required] Could be an ID prefix affecting many caches
125
-     *                               or a specific ID targeting a single cache item
126
-     * @return void
127
-     */
128
-    public function clear($cache_id)
129
-    {
130
-        // ensure incoming arg is in an array
131
-        $cache_id = is_array($cache_id) ? $cache_id : array($cache_id);
132
-        // delete corresponding transients for the supplied id prefix
133
-        $this->cache_storage->deleteMany($cache_id);
134
-    }
135
-
136
-
137
-    /**
138
-     * @param array|string $cache_id [required] Could be an ID prefix affecting many caches
139
-     *                               or a specific ID targeting a single cache item
140
-     * @param string       $type
141
-     * @return string
142
-     */
143
-    private function displayCacheNotice($cache_id, $type)
144
-    {
145
-        return '
17
+	/**
18
+	 * @type string
19
+	 */
20
+	const CACHE_PREFIX = 'ee_cache_';
21
+
22
+
23
+	/**
24
+	 * @var CacheStorageInterface $cache_storage
25
+	 */
26
+	private $cache_storage;
27
+
28
+
29
+	/**
30
+	 * BasicCacheManager constructor.
31
+	 *
32
+	 * @param CacheStorageInterface $cache_storage [required]
33
+	 */
34
+	public function __construct(CacheStorageInterface $cache_storage)
35
+	{
36
+		$this->cache_storage = $cache_storage;
37
+	}
38
+
39
+
40
+	/**
41
+	 * returns a string that will be prepended to all cache identifiers
42
+	 *
43
+	 * @return string
44
+	 */
45
+	public function cachePrefix()
46
+	{
47
+		return BasicCacheManager::CACHE_PREFIX;
48
+	}
49
+
50
+
51
+	/**
52
+	 * @param string  $id_prefix [required] Prepended to all cache IDs. Can be helpful in finding specific cache types.
53
+	 *                           May also be helpful to include an additional specific identifier,
54
+	 *                           such as a post ID as part of the $id_prefix so that individual caches
55
+	 *                           can be found and/or cleared. ex: "venue-28", or "shortcode-156".
56
+	 *                           BasicCacheManager::CACHE_PREFIX will also be prepended to the cache id.
57
+	 * @param string  $cache_id  [required] Additional identifying details that make this cache unique.
58
+	 *                           It is advisable to use some of the actual data
59
+	 *                           that is used to generate the content being cached,
60
+	 *                           in order to guarantee that the cache id is unique for that content.
61
+	 *                           The cache id will be md5'd before usage to make it more db friendly,
62
+	 *                           and the entire cache id string will be truncated to 190 characters.
63
+	 * @param Closure $callback  [required] since the point of caching is to avoid generating content when not
64
+	 *                           necessary,
65
+	 *                           we wrap our content creation in a Closure so that it is not executed until needed.
66
+	 * @param int     $expiration
67
+	 * @return Closure|mixed
68
+	 */
69
+	public function get($id_prefix, $cache_id, Closure $callback, $expiration = HOUR_IN_SECONDS)
70
+	{
71
+		$content = '';
72
+		$expiration = absint(
73
+			apply_filters(
74
+				'FHEE__CacheManager__get__cache_expiration',
75
+				$expiration,
76
+				$id_prefix,
77
+				$cache_id
78
+			)
79
+		);
80
+		$cache_id = $this->generateCacheIdentifier($id_prefix, $cache_id);
81
+		// is caching enabled for this content ?
82
+		if ($expiration) {
83
+			$content = $this->cache_storage->get($cache_id);
84
+		}
85
+		// any existing content ?
86
+		if (empty($content)) {
87
+			// nope! let's generate some new stuff
88
+			$content = $callback();
89
+			// save the new content if caching is enabled
90
+			if ($expiration) {
91
+				$this->cache_storage->add($cache_id, $content, $expiration);
92
+				if (EE_DEBUG) {
93
+					$content .= $this->displayCacheNotice($cache_id, 'REFRESH CACHE');
94
+				}
95
+			}
96
+		} else {
97
+			if (EE_DEBUG) {
98
+				$content .= $this->displayCacheNotice($cache_id, 'CACHED CONTENT');
99
+			}
100
+		}
101
+		return $content;
102
+	}
103
+
104
+
105
+	/**
106
+	 * Generates a unique identifier string for the cache
107
+	 *
108
+	 * @param string $id_prefix [required] see BasicCacheManager::get()
109
+	 * @param string $cache_id  [required] see BasicCacheManager::get()
110
+	 * @return string
111
+	 */
112
+	private function generateCacheIdentifier($id_prefix, $cache_id)
113
+	{
114
+		// let's make the cached content unique for this "page"
115
+		$cache_id .= filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL);
116
+		// with these parameters
117
+		$cache_id .= filter_input(INPUT_SERVER, 'QUERY_STRING', FILTER_SANITIZE_URL);
118
+		// then md5 the above to control it's length, add all of our prefixes, and truncate
119
+		return substr($this->cachePrefix() . $id_prefix . '-' . md5($cache_id), 0, 182);
120
+	}
121
+
122
+
123
+	/**
124
+	 * @param array|string $cache_id [required] Could be an ID prefix affecting many caches
125
+	 *                               or a specific ID targeting a single cache item
126
+	 * @return void
127
+	 */
128
+	public function clear($cache_id)
129
+	{
130
+		// ensure incoming arg is in an array
131
+		$cache_id = is_array($cache_id) ? $cache_id : array($cache_id);
132
+		// delete corresponding transients for the supplied id prefix
133
+		$this->cache_storage->deleteMany($cache_id);
134
+	}
135
+
136
+
137
+	/**
138
+	 * @param array|string $cache_id [required] Could be an ID prefix affecting many caches
139
+	 *                               or a specific ID targeting a single cache item
140
+	 * @param string       $type
141
+	 * @return string
142
+	 */
143
+	private function displayCacheNotice($cache_id, $type)
144
+	{
145
+		return '
146 146
 <div class="ee-cached-content-notice" style="position:fixed; bottom:0; left: 0;">
147 147
     <p style="font-size:9px;font-weight:normal;color:#666;line-height: 12px;margin:0 0 3px 5px">
148 148
         <b>' . $type . '</b><span style="color:#999"> : </span>
@@ -150,5 +150,5 @@  discard block
 block discarded – undo
150 150
         <span style="margin-left:2em;">' . __FILE__ . '</span>
151 151
     </p>
152 152
 </div>';
153
-    }
153
+	}
154 154
 }
Please login to merge, or discard this patch.