Completed
Branch DECAF-4.7 (a62460)
by
unknown
399:50 queued 385:55
created
admin/extend/registrations/templates/newsletter-send-form.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
                 <input type="hidden" id="get_newsletter_form_content_nonce" name="get_newsletter_form_content_nonce" value="<?php echo $ajax_nonce; ?>">
33 33
                 <input type="hidden" name="batch_message[id_type]" value="<?php echo $id_type; ?>">
34 34
                 <input id="newsletter-batch-ids" type="hidden" name="batch_message[ids]" value="">
35
-                <h3 class="newsletter-send-form-title"><?php printf( __('Sending batch message to %s people...', 'event_espresso'), '[NUMPEOPLE]' ); ?></h3>
35
+                <h3 class="newsletter-send-form-title"><?php printf(__('Sending batch message to %s people...', 'event_espresso'), '[NUMPEOPLE]'); ?></h3>
36 36
                 <label for="batch-message-template-selector"><?php _e('Select Template:', 'event_espresso'); ?></label>
37 37
                 <?php echo $template_selector; ?>
38 38
                 <div class="batch-message-edit-fields" style="display:none;">
Please login to merge, or discard this patch.
caffeinated/admin/extend/support/Extend_Support_Admin_Page.core.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -29,16 +29,16 @@  discard block
 block discarded – undo
29 29
  */
30 30
 class Extend_Support_Admin_Page extends Support_Admin_Page {
31 31
 
32
-	public function __construct( $routing = TRUE ) {
33
-		parent::__construct( $routing );
34
-		define( 'EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'support/templates/' );
32
+	public function __construct($routing = TRUE) {
33
+		parent::__construct($routing);
34
+		define('EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'support/templates/');
35 35
 	}
36 36
 
37 37
 
38 38
 
39 39
 
40 40
 	protected function _extend_page_config() {
41
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'support';
41
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'support';
42 42
 		//new routes and new configs (or overrides )
43 43
 		$new_page_routes = array(
44 44
 			'faq' => array(
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 				'capability' => 'ee_read_ee'
47 47
 				)
48 48
 			);
49
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
49
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
50 50
 
51 51
 		$new_page_config = array(
52 52
 			'faq' => array(
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 				'require_nonce' => FALSE
58 58
 				)
59 59
 			);
60
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
60
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
61 61
 
62 62
 		$this->_page_config['default']['metaboxes'][] = '_installation_boxes';
63 63
 	}
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 
67 67
 
68 68
 	protected function _faq() {
69
-		$template_path = EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH . 'support_admin_details_faq.template.php';
70
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, '', TRUE);
69
+		$template_path = EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH.'support_admin_details_faq.template.php';
70
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, '', TRUE);
71 71
 		$this->display_admin_page_with_sidebar();
72 72
 
73 73
 	}
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 
76 76
 
77 77
 	protected function _installation_boxes() {
78
-		$callback_args = array('template_path' => EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH . 'support_admin_details_additional_information.template.php');
79
-		add_meta_box( 'espresso_additional_information_support', __('Additional Information', 'event_espresso'), create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE);' ), $this->_current_screen_id, 'normal', 'high', $callback_args);
78
+		$callback_args = array('template_path' => EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH.'support_admin_details_additional_information.template.php');
79
+		add_meta_box('espresso_additional_information_support', __('Additional Information', 'event_espresso'), create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE);'), $this->_current_screen_id, 'normal', 'high', $callback_args);
80 80
 	}
81 81
 
82 82
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
admin/extend/support/templates/support_admin_details_faq.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 		</dt>
39 39
 		<dd>
40 40
             <p>
41
-            <?php printf( __('You can add the events or venues page as items to the navigation menu by going to Appearance --> Menus and check the boxes found under the %sEvent Espresso Pages%s section. Then click the Add to Menu button and finally click on the Save Menu button.', 'event_espresso'), '<strong>', '</strong>' ); ?>
41
+            <?php printf(__('You can add the events or venues page as items to the navigation menu by going to Appearance --> Menus and check the boxes found under the %sEvent Espresso Pages%s section. Then click the Add to Menu button and finally click on the Save Menu button.', 'event_espresso'), '<strong>', '</strong>'); ?>
42 42
             <br />
43 43
 			<?php _e('Quick Link:', 'event_espresso'); ?>
44 44
 			<a href="<?php echo site_url('/wp-admin/nav-menus.php'); ?>"><?php _e('Menu Manager', 'event_espresso'); ?></a>
Please login to merge, or discard this patch.
caffeinated/admin/hooks/Global_EE_Caf_Hooks.class.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -36,25 +36,25 @@  discard block
 block discarded – undo
36 36
 
37 37
 
38 38
 	private function _do_hooks() {
39
-		add_filter('FHEE_show_sponsors_meta_box', '__return_false', 10 );
40
-		add_filter('FHEE_show_ratings_request_meta_box', '__return_false', 10 );
41
-		add_filter('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array( $this, 'forums_lazy_loading'), 10 );
42
-		add_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content', array( $this, 'extra_news_box_content' ), 10 );
39
+		add_filter('FHEE_show_sponsors_meta_box', '__return_false', 10);
40
+		add_filter('FHEE_show_ratings_request_meta_box', '__return_false', 10);
41
+		add_filter('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array($this, 'forums_lazy_loading'), 10);
42
+		add_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content', array($this, 'extra_news_box_content'), 10);
43 43
 	}
44 44
 
45 45
 
46 46
 
47 47
 
48
-	public function extra_news_box_content( $content ) {
49
-		echo '<h4 style="margin:0">' . __('From the Forums', 'event_espresso') . '</h4>';
48
+	public function extra_news_box_content($content) {
49
+		echo '<h4 style="margin:0">'.__('From the Forums', 'event_espresso').'</h4>';
50 50
 		echo '<div id="ee_forum_posts_content">';
51 51
 		$url = 'http://eventespresso.com/forum/event-espresso-support/feed/';
52
-		EE_Admin_Page::cached_rss_display( 'ee_forum_posts_content', $url);
52
+		EE_Admin_Page::cached_rss_display('ee_forum_posts_content', $url);
53 53
 		echo '</div>';
54 54
 	}
55 55
 
56 56
 
57
-	public function forums_lazy_loading( $ids ) {
57
+	public function forums_lazy_loading($ids) {
58 58
 		$ids[] = 'ee_forum_posts_content';
59 59
 		return $ids;
60 60
 	}
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
caffeinated/admin/new/pricing/Price_Types_List_Table.class.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
  */
29 29
 class Price_Types_List_Table extends EE_Admin_List_Table {
30 30
 
31
-	public function __construct( $admin_page ) {
31
+	public function __construct($admin_page) {
32 32
 		parent::__construct($admin_page);
33
-		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
33
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
34 34
 		$this->_PRT = EEM_Price_Type::instance();
35 35
 	}
36 36
 
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 
40 40
 	protected function _setup_data() {
41 41
 		$trashed = $this->_admin_page->get_view() == 'trashed' ? TRUE : FALSE;
42
-		$this->_data = $this->_admin_page->get_price_types_overview_data( $this->_per_page, FALSE, $trashed );
43
-		$this->_all_data_count = $this->_admin_page->get_price_types_overview_data( $this->_per_page, TRUE, FALSE );
44
-		$this->_trashed_count = $this->_admin_page->get_price_types_overview_data( $this->_per_page, TRUE, TRUE );
42
+		$this->_data = $this->_admin_page->get_price_types_overview_data($this->_per_page, FALSE, $trashed);
43
+		$this->_all_data_count = $this->_admin_page->get_price_types_overview_data($this->_per_page, TRUE, FALSE);
44
+		$this->_trashed_count = $this->_admin_page->get_price_types_overview_data($this->_per_page, TRUE, TRUE);
45 45
 	}
46 46
 
47 47
 
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
 		$this->_columns = array(
58 58
 				'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
59 59
 				'name' => __('Name', 'event_espresso'),
60
-				'base_type' => '<div class="jst-cntr">' . __('Base Type', 'event_espresso') . '</div>',
61
-				'percent' => '<div class="jst-cntr">' . __('Applied', 'event_espresso') . '<br/>' . __('as ', 'event_espresso') . '<span class="big-text">' . __('%', 'event_espresso') . '</span>' . __(' or ', 'event_espresso') . '<span class="big-text">' . __('$', 'event_espresso') . '</span></div>',
62
-				'order' => '<div class="jst-cntr">' . __('Order of', 'event_espresso') . '<br/>' . __('Application', 'event_espresso') . '</div>'
60
+				'base_type' => '<div class="jst-cntr">'.__('Base Type', 'event_espresso').'</div>',
61
+				'percent' => '<div class="jst-cntr">'.__('Applied', 'event_espresso').'<br/>'.__('as ', 'event_espresso').'<span class="big-text">'.__('%', 'event_espresso').'</span>'.__(' or ', 'event_espresso').'<span class="big-text">'.__('$', 'event_espresso').'</span></div>',
62
+				'order' => '<div class="jst-cntr">'.__('Order of', 'event_espresso').'<br/>'.__('Application', 'event_espresso').'</div>'
63 63
 			);
64 64
 
65 65
 		$this->_sortable_columns = array(
66 66
 			// TRUE means its already sorted
67
-			'name' => array( 'name' => FALSE )
67
+			'name' => array('name' => FALSE)
68 68
 		);
69 69
 
70 70
 		$this->_hidden_columns = array();
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
 	protected function _add_view_counts() {
84 84
 		$this->_views['all']['count'] = $this->_all_data_count;
85
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price_types', 'pricing_trash_price_type' ) ) {
85
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price_types', 'pricing_trash_price_type')) {
86 86
 			$this->_views['trashed']['count'] = $this->_trashed_count;
87 87
 		}
88 88
 	}
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 
93 93
 
94 94
 	function column_cb($item) {
95
-		if ( $item->base_type() !== 1 )
96
-			return sprintf( '<input type="checkbox" name="checkbox[%1$s]" />', /* $1%s */ $item->ID() );
95
+		if ($item->base_type() !== 1)
96
+			return sprintf('<input type="checkbox" name="checkbox[%1$s]" />', /* $1%s */ $item->ID());
97 97
 		return '';
98 98
 	}
99 99
 
@@ -106,30 +106,30 @@  discard block
 block discarded – undo
106 106
 		//Build row actions
107 107
 		$actions = array();
108 108
 		// edit price link
109
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_default_price_type', 'pricing_edit_price_type', $item->ID() ) ) {
110
-			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_price_type', 'id'=>$item->ID() ), PRICING_ADMIN_URL );
111
-			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Price Type', 'event_espresso' ) . '">' . __( 'Edit', 'event_espresso' ) . '</a>';
109
+		if (EE_Registry::instance()->CAP->current_user_can('ee_edit_default_price_type', 'pricing_edit_price_type', $item->ID())) {
110
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_price_type', 'id'=>$item->ID()), PRICING_ADMIN_URL);
111
+			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Price Type', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>';
112 112
 		}
113 113
 
114
-		$name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_default_price_type', 'pricing_edit_price_type', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Price Type', 'event_espresso' ) . '">' . stripslashes( $item->name() ) . '</a>' : $item->name();
114
+		$name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_default_price_type', 'pricing_edit_price_type', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Price Type', 'event_espresso').'">'.stripslashes($item->name()).'</a>' : $item->name();
115 115
 
116
-		if ( $item->base_type() !== 1 ) {
117
-			if ( $this->_view == 'all' ) {
116
+		if ($item->base_type() !== 1) {
117
+			if ($this->_view == 'all') {
118 118
 				// trash price link
119
-				if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price_type', 'pricing_trash_price_type', $item->ID() ) ) {
120
-					$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_price_type', 'id'=>$item->ID(), 'noheader' => TRUE ), PRICING_ADMIN_URL );
121
-					$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Move Price Type to Trash', 'event_espresso' ) . '">' . __( 'Move to Trash', 'event_espresso' ) . '</a>';
119
+				if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price_type', 'pricing_trash_price_type', $item->ID())) {
120
+					$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_price_type', 'id'=>$item->ID(), 'noheader' => TRUE), PRICING_ADMIN_URL);
121
+					$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Move Price Type to Trash', 'event_espresso').'">'.__('Move to Trash', 'event_espresso').'</a>';
122 122
 				}
123 123
 			} else {
124 124
 				// restore price link
125
-				if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price_type', 'pricing_restore_price_type', $item->ID() ) ) {
126
-					$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_price_type', 'id'=>$item->ID(), 'noheader' => TRUE ), PRICING_ADMIN_URL );
127
-					$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Price Type', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>';
125
+				if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price_type', 'pricing_restore_price_type', $item->ID())) {
126
+					$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_price_type', 'id'=>$item->ID(), 'noheader' => TRUE), PRICING_ADMIN_URL);
127
+					$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Price Type', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>';
128 128
 				}
129 129
 				// delete price link
130
-				if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price_type', 'pricing_delete_price_type', $item->ID() ) ) {
131
-					$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_price_type', 'id'=>$item->ID(), 'noheader' => TRUE ), PRICING_ADMIN_URL );
132
-					$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Price Type Permanently', 'event_espresso' ) . '">' . __( 'Delete Permanently', 'event_espresso' ) . '</a>';
130
+				if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price_type', 'pricing_delete_price_type', $item->ID())) {
131
+					$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_price_type', 'id'=>$item->ID(), 'noheader' => TRUE), PRICING_ADMIN_URL);
132
+					$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Price Type Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>';
133 133
 				}
134 134
 			}
135 135
 		}
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
 
148 148
 
149 149
 	function column_base_type($item) {
150
-		return '<div class="jst-cntr">' . $item->base_type_name()  . '</div>';
150
+		return '<div class="jst-cntr">'.$item->base_type_name().'</div>';
151 151
 	}
152 152
 
153 153
 
154 154
 
155 155
 
156 156
 	function column_percent($item) {
157
-		return '<div class="jst-cntr">' . ( $item->is_percent() ? '%' : EE_Registry::instance()->CFG->currency->sign ) . '</div>';
157
+		return '<div class="jst-cntr">'.($item->is_percent() ? '%' : EE_Registry::instance()->CFG->currency->sign).'</div>';
158 158
 	}
159 159
 
160 160
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 
163 163
 
164 164
 	function column_order($item) {
165
-		return '<div class="jst-cntr">' . $item->order() . '</div>';
165
+		return '<div class="jst-cntr">'.$item->order().'</div>';
166 166
 	}
167 167
 
168 168
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 
3 5
 /**
4 6
  * Event Espresso
@@ -92,8 +94,9 @@  discard block
 block discarded – undo
92 94
 
93 95
 
94 96
 	function column_cb($item) {
95
-		if ( $item->base_type() !== 1 )
96
-			return sprintf( '<input type="checkbox" name="checkbox[%1$s]" />', /* $1%s */ $item->ID() );
97
+		if ( $item->base_type() !== 1 ) {
98
+					return sprintf( '<input type="checkbox" name="checkbox[%1$s]" />', /* $1%s */ $item->ID() );
99
+		}
97 100
 		return '';
98 101
 	}
99 102
 
Please login to merge, or discard this patch.
caffeinated/admin/new/pricing/Prices_List_Table.class.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,10 +79,10 @@
 block discarded – undo
79 79
 						'amount' => array( 'amount' => FALSE )
80 80
 			);
81 81
 
82
-        $this->_hidden_columns = array(
82
+		$this->_hidden_columns = array(
83 83
 			);
84 84
 
85
-        $this->_ajax_sorting_callback = 'update_prices_order';
85
+		$this->_ajax_sorting_callback = 'update_prices_order';
86 86
 
87 87
 	}
88 88
 
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 	 */
37 37
 	protected $_price_types = array();
38 38
 
39
-	public function __construct( $admin_page ) {
39
+	public function __construct($admin_page) {
40 40
 		parent::__construct($admin_page);
41
-		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
41
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
42 42
 		$this->_PRT = EEM_Price_Type::instance();
43 43
 		$this->_price_types = $this->_PRT->get_all_deleted_and_undeleted();
44 44
 	}
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 
49 49
 	protected function _setup_data() {
50 50
 		$trashed = $this->_admin_page->get_view() == 'trashed' ? TRUE : FALSE;
51
-		$this->_data = $this->_admin_page->get_prices_overview_data( $this->_per_page, FALSE, $trashed );
52
-		$this->_all_data_count = $this->_admin_page->get_prices_overview_data( $this->_per_page, TRUE, FALSE );
53
-		$this->_trashed_count = $this->_admin_page->get_prices_overview_data( $this->_per_page, TRUE, TRUE );
51
+		$this->_data = $this->_admin_page->get_prices_overview_data($this->_per_page, FALSE, $trashed);
52
+		$this->_all_data_count = $this->_admin_page->get_prices_overview_data($this->_per_page, TRUE, FALSE);
53
+		$this->_trashed_count = $this->_admin_page->get_prices_overview_data($this->_per_page, TRUE, TRUE);
54 54
 	}
55 55
 
56 56
 
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 
75 75
 			$this->_sortable_columns = array(
76 76
 						// TRUE means its already sorted
77
-						'name' => array( 'name' => FALSE ),
78
-						'type' => array( 'type' => FALSE ),
79
-						'amount' => array( 'amount' => FALSE )
77
+						'name' => array('name' => FALSE),
78
+						'type' => array('type' => FALSE),
79
+						'amount' => array('amount' => FALSE)
80 80
 			);
81 81
 
82 82
         $this->_hidden_columns = array(
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
 	protected function _add_view_counts() {
100 100
 		$this->_views['all']['count'] = $this->_all_data_count;
101
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price') ) {
101
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) {
102 102
 			$this->_views['trashed']['count'] = $this->_trashed_count;
103 103
 		}
104 104
 	}
@@ -112,16 +112,16 @@  discard block
 block discarded – undo
112 112
 	 * @param  object $item the current item
113 113
 	 * @return string
114 114
 	 */
115
-	protected function _get_row_class( $item ) {
115
+	protected function _get_row_class($item) {
116 116
 		static $row_class = '';
117
-		$row_class = ( $row_class == '' ? 'alternate' : '' );
117
+		$row_class = ($row_class == '' ? 'alternate' : '');
118 118
 
119 119
 		$new_row = $row_class;
120 120
 
121
-		if ( $item->type_obj()->base_type() !== 1 && $item->type_obj()->base_type() !== 4 )
121
+		if ($item->type_obj()->base_type() !== 1 && $item->type_obj()->base_type() !== 4)
122 122
 			$new_row .= ' rowsortable';
123 123
 
124
-		return ' class="' . $new_row . '"';
124
+		return ' class="'.$new_row.'"';
125 125
 	}
126 126
 
127 127
 
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 
132 132
 
133 133
 	function column_cb($item) {
134
-		if ( $item->type_obj()->base_type() !== 1 )
135
-			return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', /* $1%s */ $item->ID() );
134
+		if ($item->type_obj()->base_type() !== 1)
135
+			return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', /* $1%s */ $item->ID());
136 136
 		return '';
137 137
 	}
138 138
 
@@ -145,31 +145,31 @@  discard block
 block discarded – undo
145 145
 		//Build row actions
146 146
 		$actions = array();
147 147
 		// edit price link
148
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_default_price', 'pricing_edit_price', $item->ID() ) ) {
149
-			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_price', 'id'=>$item->ID() ), PRICING_ADMIN_URL );
150
-			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Price', 'event_espresso' ) . '">' . __( 'Edit', 'event_espresso' ) . '</a>';
148
+		if (EE_Registry::instance()->CAP->current_user_can('ee_edit_default_price', 'pricing_edit_price', $item->ID())) {
149
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_price', 'id'=>$item->ID()), PRICING_ADMIN_URL);
150
+			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Price', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>';
151 151
 		}
152 152
 
153
-		$name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_default_price', 'edit_price', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Price', 'event_espresso' ) . '">' . stripslashes( $item->name() ) . '</a>' : $item->name();
153
+		$name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_default_price', 'edit_price', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Price', 'event_espresso').'">'.stripslashes($item->name()).'</a>' : $item->name();
154 154
 
155
-		if ( $item->type_obj()->base_type() !== 1 ) {
155
+		if ($item->type_obj()->base_type() !== 1) {
156 156
 			if ($this->_view == 'all') {
157 157
 				// trash price link
158
-				if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price', 'pricing_trash_price', $item->ID() ) ) {
159
-					$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_price', 'id'=>$item->ID(), 'noheader' => TRUE ), PRICING_ADMIN_URL );
160
-					$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Move Price to Trash', 'event_espresso' ) . '">' . __( 'Move to Trash', 'event_espresso' ) . '</a>';
158
+				if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_trash_price', $item->ID())) {
159
+					$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_price', 'id'=>$item->ID(), 'noheader' => TRUE), PRICING_ADMIN_URL);
160
+					$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Move Price to Trash', 'event_espresso').'">'.__('Move to Trash', 'event_espresso').'</a>';
161 161
 				}
162 162
 			} else {
163
-				if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price', 'pricing_restore_price', $item->ID() ) ) {
163
+				if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_restore_price', $item->ID())) {
164 164
 					// restore price link
165
-					$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_price', 'id'=>$item->ID(), 'noheader' => TRUE ), PRICING_ADMIN_URL );
166
-					$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Price', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>';
165
+					$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_price', 'id'=>$item->ID(), 'noheader' => TRUE), PRICING_ADMIN_URL);
166
+					$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Price', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>';
167 167
 				}
168 168
 
169 169
 				// delete price link
170
-				if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price', 'pricing_delete_price', $item->ID() ) ) {
171
-					$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_price', 'id'=>$item->ID(), 'noheader' => TRUE ), PRICING_ADMIN_URL );
172
-					$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Price Permanently', 'event_espresso' ) . '">' . __( 'Delete Permanently', 'event_espresso' ) . '</a>';
170
+				if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_delete_price', $item->ID())) {
171
+					$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_price', 'id'=>$item->ID(), 'noheader' => TRUE), PRICING_ADMIN_URL);
172
+					$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Price Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>';
173 173
 				}
174 174
 			}
175 175
 		}
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 		return sprintf('%1$s <span style="color:silver">(id:%2$s)</span>%3$s',
179 179
 										/* $1%s */ $name_link,
180 180
 										/* $2%s */ $item->ID(),
181
-										/* $3%s */ $this->row_actions( $actions )
181
+										/* $3%s */ $this->row_actions($actions)
182 182
 		);
183 183
 	}
184 184
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 
196 196
 
197 197
 	function column_description($item) {
198
-		return stripslashes( $item->desc() );
198
+		return stripslashes($item->desc());
199 199
 	}
200 200
 
201 201
 
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 
205 205
 	function column_amount($item) {
206 206
 		if ($this->_price_types[$item->type()]->is_percent()) {
207
-			return '<div class="pad-amnt-rght">' . number_format($item->amount(), 1) . '%</div>';
207
+			return '<div class="pad-amnt-rght">'.number_format($item->amount(), 1).'%</div>';
208 208
 		} else {
209
-			return '<div class="pad-amnt-rght">' . EEH_Template::format_currency( $item->amount() ) . '</div>';
209
+			return '<div class="pad-amnt-rght">'.EEH_Template::format_currency($item->amount()).'</div>';
210 210
 		}
211 211
 	}
212 212
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 
3 5
 /**
4 6
  * Event Espresso
@@ -118,8 +120,9 @@  discard block
 block discarded – undo
118 120
 
119 121
 		$new_row = $row_class;
120 122
 
121
-		if ( $item->type_obj()->base_type() !== 1 && $item->type_obj()->base_type() !== 4 )
122
-			$new_row .= ' rowsortable';
123
+		if ( $item->type_obj()->base_type() !== 1 && $item->type_obj()->base_type() !== 4 ) {
124
+					$new_row .= ' rowsortable';
125
+		}
123 126
 
124 127
 		return ' class="' . $new_row . '"';
125 128
 	}
@@ -131,8 +134,9 @@  discard block
 block discarded – undo
131 134
 
132 135
 
133 136
 	function column_cb($item) {
134
-		if ( $item->type_obj()->base_type() !== 1 )
135
-			return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', /* $1%s */ $item->ID() );
137
+		if ( $item->type_obj()->base_type() !== 1 ) {
138
+					return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', /* $1%s */ $item->ID() );
139
+		}
136 140
 		return '';
137 141
 	}
138 142
 
Please login to merge, or discard this patch.
caffeinated/admin/new/pricing/Pricing_Admin_Page.core.php 3 patches
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 
79 79
 	/**
80 80
 	 * 		an array for storing request actions and their corresponding methods
81
-	*		@access private
82
-	*		@return void
83
-	*/
81
+	 *		@access private
82
+	 *		@return void
83
+	 */
84 84
 	protected function _set_page_routes() {
85 85
 		$prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0;
86 86
 		$prt_id =  ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0;
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 							'order' => 10
201 201
 						),
202 202
 					'list_table' => 'Prices_List_Table',
203
-                    'help_tabs' => array(
203
+					'help_tabs' => array(
204 204
 						'pricing_default_pricing_help_tab' => array(
205 205
 							'title' => __('Default Pricing', 'event_espresso'),
206 206
 							'filename' => 'pricing_default_pricing'
@@ -223,13 +223,13 @@  discard block
 block discarded – undo
223 223
 							'order' => 20,
224 224
 							'persistent' => FALSE
225 225
 						),
226
-                    'help_tabs' => array(
226
+					'help_tabs' => array(
227 227
 						'add_new_default_price_help_tab' => array(
228 228
 							'title' => __('Add New Default Price', 'event_espresso'),
229 229
 							'filename' => 'pricing_add_new_default_price'
230 230
 							)
231 231
 						),
232
-                    'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'),
232
+					'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'),
233 233
 					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ),
234 234
 					'require_nonce' => FALSE
235 235
 				),
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 							'persistent' => FALSE
242 242
 						),
243 243
 					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ),
244
-                    'help_tabs' => array(
244
+					'help_tabs' => array(
245 245
 						'edit_default_price_help_tab' => array(
246 246
 							'title' => __('Edit Default Price', 'event_espresso'),
247 247
 							'filename' => 'pricing_edit_default_price'
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 							'order' => 30
257 257
 						),
258 258
 					'list_table' => 'Price_Types_List_Table',
259
-                    'help_tabs' => array(
259
+					'help_tabs' => array(
260 260
 						'pricing_price_types_help_tab' => array(
261 261
 							'title' => __('Price Types', 'event_espresso'),
262 262
 							'filename' => 'pricing_price_types'
@@ -280,13 +280,13 @@  discard block
 block discarded – undo
280 280
 							'order' => 40,
281 281
 							'persistent' => FALSE
282 282
 						),
283
-                    'help_tabs' => array(
283
+					'help_tabs' => array(
284 284
 						'add_new_price_type_help_tab' => array(
285 285
 							'title' => __('Add New Price Type', 'event_espresso'),
286 286
 							'filename' => 'pricing_add_new_price_type'
287 287
 							)
288 288
 						),
289
-                    'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ),
289
+					'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ),
290 290
 					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ),
291 291
 					'require_nonce' => FALSE
292 292
 				),
@@ -296,13 +296,13 @@  discard block
 block discarded – undo
296 296
 							'order' => 40,
297 297
 							'persistent' => FALSE
298 298
 						),
299
-                    'help_tabs' => array(
299
+					'help_tabs' => array(
300 300
 						'edit_price_type_help_tab' => array(
301 301
 							'title' => __('Edit Price Type', 'event_espresso'),
302 302
 							'filename' => 'pricing_edit_price_type'
303 303
 							)
304 304
 						),
305
-                    'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ),
305
+					'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ),
306 306
 					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ),
307 307
 
308 308
 					'require_nonce' => FALSE
@@ -433,9 +433,9 @@  discard block
 block discarded – undo
433 433
 
434 434
 	/**
435 435
 	 * 		generates HTML for main Prices Admin page
436
-	*		@access protected
437
-	*		@return void
438
-	*/
436
+	 *		@access protected
437
+	 *		@return void
438
+	 */
439 439
 	protected function _price_overview_list_table() {
440 440
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_new_price', 'add', array(), 'add-new-h2');
441 441
 		$this->admin_page_title .= $this->_learn_more_about_pricing_link();
@@ -449,13 +449,13 @@  discard block
 block discarded – undo
449 449
 
450 450
 
451 451
 	/**
452
-	*	retrieve data for Prices List table
453
-	*	@access public
454
-	* 	@param  int  $per_page    how many prices displayed per page
455
-	* 	@param  boolean $count   return the count or objects
456
-	* 	@param  boolean $trashed   whether the current view is of the trash can - eww yuck!
457
-	* 	@return mixed (int|array)  int = count || array of price objects
458
-	*/
452
+	 *	retrieve data for Prices List table
453
+	 *	@access public
454
+	 * 	@param  int  $per_page    how many prices displayed per page
455
+	 * 	@param  boolean $count   return the count or objects
456
+	 * 	@param  boolean $trashed   whether the current view is of the trash can - eww yuck!
457
+	 * 	@return mixed (int|array)  int = count || array of price objects
458
+	 */
459 459
 	public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) {
460 460
 
461 461
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -525,9 +525,9 @@  discard block
 block discarded – undo
525 525
 
526 526
 	/**
527 527
 	 * 		_price_details
528
-	*		@access protected
529
-	*		@return void
530
-	*/
528
+	 *		@access protected
529
+	 *		@return void
530
+	 */
531 531
 	protected function _edit_price_details() {
532 532
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
533 533
 		// grab price ID
@@ -587,9 +587,9 @@  discard block
 block discarded – undo
587 587
 
588 588
 	/**
589 589
 	 * 		declare price details page metaboxes
590
-	*		@access protected
591
-	*		@return void
592
-	*/
590
+	 *		@access protected
591
+	 *		@return void
592
+	 */
593 593
 	protected function _price_details_meta_boxes() {
594 594
 		add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
595 595
 	}
@@ -601,9 +601,9 @@  discard block
 block discarded – undo
601 601
 
602 602
 	/**
603 603
 	 * 		_edit_price_details_meta_box
604
-	*		@access public
605
-	*		@return void
606
-	*/
604
+	 *		@access public
605
+	 *		@return void
606
+	 */
607 607
 	public function _edit_price_details_meta_box() {
608 608
 		echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE );
609 609
 	}
@@ -614,9 +614,9 @@  discard block
 block discarded – undo
614 614
 
615 615
 	/**
616 616
 	 * 		set_price_column_values
617
-	*		@access protected
618
-	*		@return array
619
-	*/
617
+	 *		@access protected
618
+	 *		@return array
619
+	 */
620 620
 	protected function set_price_column_values() {
621 621
 
622 622
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -643,10 +643,10 @@  discard block
 block discarded – undo
643 643
 
644 644
 	/**
645 645
 	 * 		insert_or_update_price
646
-	*		@param boolean 		$insert - whether to insert or update
647
-	*		@access protected
648
-	*		@return void
649
-	*/
646
+	 *		@param boolean 		$insert - whether to insert or update
647
+	 *		@access protected
648
+	 *		@return void
649
+	 */
650 650
 	protected function _insert_or_update_price( $insert = FALSE ) {
651 651
 
652 652
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
@@ -719,10 +719,10 @@  discard block
 block discarded – undo
719 719
 
720 720
 	/**
721 721
 	 * 		_trash_or_restore_price
722
-	*		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
723
-	*		@access protected
724
-	*		@return void
725
-	*/
722
+	 *		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
723
+	 *		@access protected
724
+	 *		@return void
725
+	 */
726 726
 	protected function _trash_or_restore_price( $trash = TRUE ) {
727 727
 
728 728
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
@@ -802,9 +802,9 @@  discard block
 block discarded – undo
802 802
 
803 803
 	/**
804 804
 	 * 		_delete_price
805
-	*		@access protected
806
-	*		@return void
807
-	*/
805
+	 *		@access protected
806
+	 *		@return void
807
+	 */
808 808
 	protected function _delete_price() {
809 809
 
810 810
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
@@ -881,9 +881,9 @@  discard block
 block discarded – undo
881 881
 
882 882
 	/**
883 883
 	 * 		generates HTML for main Prices Admin page
884
-	*		@access protected
885
-	*		@return void
886
-	*/
884
+	 *		@access protected
885
+	 *		@return void
886
+	 */
887 887
 	protected function _price_types_overview_list_table() {
888 888
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_new_price_type', 'add_type', array(), 'add-new-h2');
889 889
 		$this->admin_page_title .= $this->_learn_more_about_pricing_link();
@@ -897,13 +897,13 @@  discard block
 block discarded – undo
897 897
 
898 898
 
899 899
 	/**
900
-	*	retrieve data for Price Types List table
901
-	*	@access public
902
-	* 	@param  int  $per_page    how many prices displayed per page
903
-	* 	@param  boolean $count   return the count or objects
904
-	* 	@param  boolean $trashed   whether the current view is of the trash can - eww yuck!
905
-	* 	@return mixed (int|array)  int = count || array of price objects
906
-	*/
900
+	 *	retrieve data for Price Types List table
901
+	 *	@access public
902
+	 * 	@param  int  $per_page    how many prices displayed per page
903
+	 * 	@param  boolean $count   return the count or objects
904
+	 * 	@param  boolean $trashed   whether the current view is of the trash can - eww yuck!
905
+	 * 	@return mixed (int|array)  int = count || array of price objects
906
+	 */
907 907
 	public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) {
908 908
 
909 909
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -958,9 +958,9 @@  discard block
 block discarded – undo
958 958
 
959 959
 	/**
960 960
 	 * 		_edit_price_type_details
961
-	*		@access protected
962
-	*		@return void
963
-	*/
961
+	 *		@access protected
962
+	 *		@return void
963
+	 */
964 964
 	protected function _edit_price_type_details() {
965 965
 
966 966
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -1015,9 +1015,9 @@  discard block
 block discarded – undo
1015 1015
 
1016 1016
 	/**
1017 1017
 	 * 		declare price type details page metaboxes
1018
-	*		@access protected
1019
-	*		@return void
1020
-	*/
1018
+	 *		@access protected
1019
+	 *		@return void
1020
+	 */
1021 1021
 	protected function _price_type_details_meta_boxes() {
1022 1022
 		add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1023 1023
 	}
@@ -1028,9 +1028,9 @@  discard block
 block discarded – undo
1028 1028
 
1029 1029
 	/**
1030 1030
 	 * 		_edit_price_type_details_meta_box
1031
-	*		@access public
1032
-	*		@return void
1033
-	*/
1031
+	 *		@access public
1032
+	 *		@return void
1033
+	 */
1034 1034
 	public function _edit_price_type_details_meta_box() {
1035 1035
 		echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE );
1036 1036
 	}
@@ -1040,9 +1040,9 @@  discard block
 block discarded – undo
1040 1040
 
1041 1041
 	/**
1042 1042
 	 * 		set_price_type_column_values
1043
-	*		@access protected
1044
-	*		@return void
1045
-	*/
1043
+	 *		@access protected
1044
+	 *		@return void
1045
+	 */
1046 1046
 	protected function set_price_type_column_values() {
1047 1047
 
1048 1048
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -1090,10 +1090,10 @@  discard block
 block discarded – undo
1090 1090
 
1091 1091
 	/**
1092 1092
 	 * 		_insert_or_update_price_type
1093
-	*		@param boolean 		$new_price_type - whether to insert or update
1094
-	*		@access protected
1095
-	*		@return void
1096
-	*/
1093
+	 *		@param boolean 		$new_price_type - whether to insert or update
1094
+	 *		@access protected
1095
+	 *		@return void
1096
+	 */
1097 1097
 	protected function _insert_or_update_price_type( $new_price_type = FALSE ) {
1098 1098
 
1099 1099
 //		echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
@@ -1134,10 +1134,10 @@  discard block
 block discarded – undo
1134 1134
 
1135 1135
 	/**
1136 1136
 	 * 		_trash_or_restore_price_type
1137
-	*		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
1138
-	*		@access protected
1139
-	*		@return void
1140
-	*/
1137
+	 *		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
1138
+	 *		@access protected
1139
+	 *		@return void
1140
+	 */
1141 1141
 	protected function _trash_or_restore_price_type( $trash = TRUE ) {
1142 1142
 
1143 1143
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
@@ -1191,9 +1191,9 @@  discard block
 block discarded – undo
1191 1191
 
1192 1192
 	/**
1193 1193
 	 * 		_delete_price_type
1194
-	*		@access protected
1195
-	*		@return void
1196
-	*/
1194
+	 *		@access protected
1195
+	 *		@return void
1196
+	 */
1197 1197
 	protected function _delete_price_type() {
1198 1198
 
1199 1199
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
@@ -1230,9 +1230,9 @@  discard block
 block discarded – undo
1230 1230
 
1231 1231
 	/**
1232 1232
 	 * 		_learn_more_about_pricing_link
1233
-	*		@access protected
1234
-	*		@return string
1235
-	*/
1233
+	 *		@access protected
1234
+	 *		@return string
1235
+	 */
1236 1236
 	protected function _learn_more_about_pricing_link() {
1237 1237
 		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>';
1238 1238
 	}
Please login to merge, or discard this patch.
Spacing   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 	 * @param bool $routing
32 32
 	 * @return Pricing_Admin_Page
33 33
 	 */
34
-	public function __construct( $routing = TRUE ) {
35
-		parent::__construct( $routing );
34
+	public function __construct($routing = TRUE) {
35
+		parent::__construct($routing);
36 36
 	}
37 37
 
38 38
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 
51 51
 	protected function _ajax_hooks() {
52
-		add_action('wp_ajax_espresso_update_prices_order', array( $this, 'update_price_order' ));
52
+		add_action('wp_ajax_espresso_update_prices_order', array($this, 'update_price_order'));
53 53
 	}
54 54
 
55 55
 
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	*		@return void
83 83
 	*/
84 84
 	protected function _set_page_routes() {
85
-		$prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0;
86
-		$prt_id =  ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0;
85
+		$prc_id = ! empty($this->_req_data['PRC_ID']) && ! is_array($this->_req_data['PRC_ID']) ? $this->_req_data['PRC_ID'] : 0;
86
+		$prt_id = ! empty($this->_req_data['PRT_ID']) && ! is_array($this->_req_data['PRT_ID']) ? $this->_req_data['PRT_ID'] : 0;
87 87
 		$this->_page_routes = array(
88 88
 			'default' => array(
89 89
 					'func' => '_price_overview_list_table',
@@ -91,38 +91,38 @@  discard block
 block discarded – undo
91 91
 				),
92 92
 			'add_new_price'	=> array(
93 93
 					'func' => '_edit_price_details',
94
-					'args' => array( 'new_price' => TRUE ),
94
+					'args' => array('new_price' => TRUE),
95 95
 					'capability' => 'ee_edit_default_prices'
96 96
 				),
97 97
 			'edit_price'	=> array(
98 98
 					'func' => '_edit_price_details',
99
-					'args' => array( 'new_price' => FALSE ),
99
+					'args' => array('new_price' => FALSE),
100 100
 					'capability' => 'ee_edit_default_price',
101 101
 					'obj_id' => $prc_id
102 102
 				),
103 103
 			'insert_price'	=> array(
104 104
 					'func' => '_insert_or_update_price',
105
-					'args' => array( 'new_price' => TRUE ),
105
+					'args' => array('new_price' => TRUE),
106 106
 					'noheader' => TRUE,
107 107
 					'capability' => 'ee_edit_default_prices',
108 108
 				),
109 109
 			'update_price'	=> array(
110 110
 					'func' => '_insert_or_update_price',
111
-					'args' => array( 'new_price' => FALSE ),
111
+					'args' => array('new_price' => FALSE),
112 112
 					'noheader' => TRUE,
113 113
 					'capability' => 'ee_edit_default_price',
114 114
 					'obj_id' => $prc_id
115 115
 				),
116 116
 			'trash_price'	=> array(
117 117
 					'func' => '_trash_or_restore_price',
118
-					'args' => array( 'trash' => TRUE ),
118
+					'args' => array('trash' => TRUE),
119 119
 					'noheader' => TRUE,
120 120
 					'capability' => 'ee_delete_default_price',
121 121
 					'obj_id' => $prc_id
122 122
 				),
123 123
 			'restore_price'	=> array(
124 124
 					'func' => '_trash_or_restore_price',
125
-					'args' => array( 'trash' => FALSE ),
125
+					'args' => array('trash' => FALSE),
126 126
 					'noheader' => TRUE,
127 127
 					'capability' => 'ee_delete_default_price',
128 128
 					'obj_id' => $prc_id
@@ -154,27 +154,27 @@  discard block
 block discarded – undo
154 154
 				),
155 155
 			'insert_price_type'	=> array(
156 156
 					'func' => '_insert_or_update_price_type',
157
-					'args' => array( 'new_price_type' => TRUE ),
157
+					'args' => array('new_price_type' => TRUE),
158 158
 					'noheader' => TRUE,
159 159
 					'capability' => 'ee_edit_default_price_types'
160 160
 				),
161 161
 			'update_price_type' => array(
162 162
 					'func' => '_insert_or_update_price_type',
163
-					'args' => array( 'new_price_type' => FALSE ),
163
+					'args' => array('new_price_type' => FALSE),
164 164
 					'noheader' => TRUE,
165 165
 					'capability' => 'ee_edit_default_price_type',
166 166
 					'obj_id' => $prt_id
167 167
 				),
168 168
 			'trash_price_type'	=> array(
169 169
 					'func' => '_trash_or_restore_price_type',
170
-					'args' => array( 'trash' => TRUE ),
170
+					'args' => array('trash' => TRUE),
171 171
 					'noheader' => TRUE,
172 172
 					'capability' => 'ee_delete_default_price_type',
173 173
 					'obj_id' => $prt_id
174 174
 				),
175 175
 			'restore_price_type'	=> array(
176 176
 					'func' => '_trash_or_restore_price_type',
177
-					'args' => array( 'trash' => FALSE ),
177
+					'args' => array('trash' => FALSE),
178 178
 					'noheader' => TRUE,
179 179
 					'capability' => 'ee_delete_default_price_type',
180 180
 					'obj_id' => $prt_id
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 							'filename' => 'pricing_default_pricing_views_bulk_actions_search'
215 215
 							)
216 216
 						),
217
-					'help_tour' => array( 'Pricing_Default_Prices_Help_Tour'),
217
+					'help_tour' => array('Pricing_Default_Prices_Help_Tour'),
218 218
 					'require_nonce' => FALSE
219 219
 				),
220 220
 			'add_new_price' => array(
@@ -230,24 +230,24 @@  discard block
 block discarded – undo
230 230
 							)
231 231
 						),
232 232
                     'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'),
233
-					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ),
233
+					'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'),
234 234
 					'require_nonce' => FALSE
235 235
 				),
236 236
 			'edit_price' => array(
237 237
 					'nav' => array(
238 238
 							'label' => __('Edit Default Price', 'event_espresso'),
239 239
 							'order' => 20,
240
-							'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id'] ), $this->_current_page_view_url )  : $this->_admin_base_url,
240
+							'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id']), $this->_current_page_view_url) : $this->_admin_base_url,
241 241
 							'persistent' => FALSE
242 242
 						),
243
-					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ),
243
+					'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'),
244 244
                     'help_tabs' => array(
245 245
 						'edit_default_price_help_tab' => array(
246 246
 							'title' => __('Edit Default Price', 'event_espresso'),
247 247
 							'filename' => 'pricing_edit_default_price'
248 248
 							)
249 249
 						),
250
-					'help_tour' => array( 'Pricing_Edit_Default_Price_Help_Tour' ),
250
+					'help_tour' => array('Pricing_Edit_Default_Price_Help_Tour'),
251 251
 					'require_nonce' => FALSE
252 252
 				),
253 253
 			'price_types' => array(
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 							'filename' => 'pricing_price_types_views_bulk_actions_search'
271 271
 							),
272 272
 						),
273
-					'help_tour' => array( 'Pricing_Price_Types_Default_Help_Tour' ),
273
+					'help_tour' => array('Pricing_Price_Types_Default_Help_Tour'),
274 274
 					'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'),
275 275
 					'require_nonce' => FALSE
276 276
 				),
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
 							'filename' => 'pricing_add_new_price_type'
287 287
 							)
288 288
 						),
289
-                    'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ),
290
-					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ),
289
+                    'help_tour' => array('Pricing_Add_New_Price_Type_Help_Tour'),
290
+					'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'),
291 291
 					'require_nonce' => FALSE
292 292
 				),
293 293
 			'edit_price_type' => array(
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
 							'filename' => 'pricing_edit_price_type'
303 303
 							)
304 304
 						),
305
-                    'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ),
306
-					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ),
305
+                    'help_tour' => array('Pricing_Edit_Price_Type_Help_Tour'),
306
+					'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'),
307 307
 
308 308
 					'require_nonce' => FALSE
309 309
 				)
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	public function load_scripts_styles() {
341 341
 		//styles
342 342
 		wp_enqueue_style('espresso-ui-theme');
343
-		wp_register_style( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION );
343
+		wp_register_style('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION);
344 344
 		wp_enqueue_style('espresso_PRICING');
345 345
 
346 346
 		//scripts
@@ -350,8 +350,8 @@  discard block
 block discarded – undo
350 350
 		//wp_enqueue_script('jquery-ui-dialog');
351 351
 		//wp_enqueue_script('jquery-ui-draggable');
352 352
 		//wp_enqueue_script('jquery-ui-datepicker');
353
-		wp_register_script( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
354
-		wp_enqueue_script( 'espresso_PRICING' );
353
+		wp_register_script('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
354
+		wp_enqueue_script('espresso_PRICING');
355 355
 	}
356 356
 
357 357
 
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
 
361 361
 	public function load_scripts_styles_default() {
362
-		wp_enqueue_script( 'espresso_ajax_table_sorting' );
362
+		wp_enqueue_script('espresso_ajax_table_sorting');
363 363
 	}
364 364
 
365 365
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 				)
388 388
 		);
389 389
 
390
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price' ) ) {
390
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) {
391 391
 			$this->_views['trashed'] = array(
392 392
 					'slug' => 'trashed',
393 393
 					'label' => __('Trash', 'event_espresso'),
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 				)
418 418
 		);
419 419
 
420
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price_types', 'pricing_trash_price_type' ) ) {
420
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price_types', 'pricing_trash_price_type')) {
421 421
 			 $this->_views['trashed'] = array(
422 422
 					'slug' => 'trashed',
423 423
 					'label' => __('Trash', 'event_espresso'),
@@ -456,18 +456,18 @@  discard block
 block discarded – undo
456 456
 	* 	@param  boolean $trashed   whether the current view is of the trash can - eww yuck!
457 457
 	* 	@return mixed (int|array)  int = count || array of price objects
458 458
 	*/
459
-	public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) {
459
+	public function get_prices_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) {
460 460
 
461
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
461
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
462 462
 		// start with an empty array
463 463
 		$event_pricing = array();
464 464
 
465
-		require_once( PRICING_ADMIN . 'Prices_List_Table.class.php' );
466
-		require_once(EE_MODELS . 'EEM_Price.model.php');
465
+		require_once(PRICING_ADMIN.'Prices_List_Table.class.php');
466
+		require_once(EE_MODELS.'EEM_Price.model.php');
467 467
 		//$PRC = EEM_Price::instance();
468 468
 
469 469
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby'];
470
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
470
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
471 471
 
472 472
 		switch ($this->_req_data['orderby']) {
473 473
 			case 'name':
@@ -480,27 +480,27 @@  discard block
 block discarded – undo
480 480
 				$orderby = array('PRC_amount'=>$order);
481 481
 				break;
482 482
 			default:
483
-				$orderby = array( 'PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order);
483
+				$orderby = array('PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order);
484 484
 		}
485 485
 
486
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
487
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
486
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
487
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
488 488
 
489 489
 		$_where = array(
490 490
 				'PRC_is_default' => 1,
491 491
 				'PRC_deleted'=>$trashed
492 492
 				);
493 493
 
494
-		$offset = ($current_page-1)*$per_page;
495
-		$limit = array( $offset, $per_page );
494
+		$offset = ($current_page - 1) * $per_page;
495
+		$limit = array($offset, $per_page);
496 496
 
497
-		if ( isset( $this->_req_data['s'] ) ) {
498
-			$sstr = '%' . $this->_req_data['s'] . '%';
497
+		if (isset($this->_req_data['s'])) {
498
+			$sstr = '%'.$this->_req_data['s'].'%';
499 499
 			$_where['OR'] = array(
500
-				'PRC_name' => array('LIKE',$sstr ),
501
-				'PRC_desc' => array('LIKE',$sstr ),
502
-				'PRC_amount' => array( 'LIKE',$sstr ),
503
-				'Price_Type.PRT_name' => array( 'LIKE', $sstr )
500
+				'PRC_name' => array('LIKE', $sstr),
501
+				'PRC_desc' => array('LIKE', $sstr),
502
+				'PRC_amount' => array('LIKE', $sstr),
503
+				'Price_Type.PRT_name' => array('LIKE', $sstr)
504 504
 				);
505 505
 		}
506 506
 
@@ -511,9 +511,9 @@  discard block
 block discarded – undo
511 511
 			'group_by'=>'PRC_ID'
512 512
 			);
513 513
 
514
-		if($count){
514
+		if ($count) {
515 515
 			return EEM_Price::instance()->count_deleted_and_undeleted(array($_where));
516
-		}else{
516
+		} else {
517 517
 			return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params);
518 518
 		}
519 519
 	}
@@ -529,40 +529,40 @@  discard block
 block discarded – undo
529 529
 	*		@return void
530 530
 	*/
531 531
 	protected function _edit_price_details() {
532
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
532
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
533 533
 		// grab price ID
534
-		$PRC_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
534
+		$PRC_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
535 535
 		// change page title based on request action
536
-		$this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action ));
536
+		$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
537 537
 		// add PRC_ID to title if editing
538
-		$this->_admin_page_title = $PRC_ID ? $this->_admin_page_title . ' # ' . $PRC_ID : $this->_admin_page_title;
538
+		$this->_admin_page_title = $PRC_ID ? $this->_admin_page_title.' # '.$PRC_ID : $this->_admin_page_title;
539 539
 
540 540
 		// get prices
541
-		require_once(EE_MODELS . 'EEM_Price.model.php');
541
+		require_once(EE_MODELS.'EEM_Price.model.php');
542 542
 		$PRC = EEM_Price::instance();
543 543
 
544
-		if ( $PRC_ID ) {
545
-			$price = $PRC->get_one_by_ID( $PRC_ID );
544
+		if ($PRC_ID) {
545
+			$price = $PRC->get_one_by_ID($PRC_ID);
546 546
 			$additional_hidden_fields = array(
547
-					'PRC_ID' => array( 'type' => 'hidden', 'value' => $PRC_ID )
547
+					'PRC_ID' => array('type' => 'hidden', 'value' => $PRC_ID)
548 548
 				);
549
-			$this->_set_add_edit_form_tags( 'update_price', $additional_hidden_fields );
549
+			$this->_set_add_edit_form_tags('update_price', $additional_hidden_fields);
550 550
 		} else {
551 551
 			$price = $PRC->get_new_price();
552
-			$this->_set_add_edit_form_tags( 'insert_price' );
552
+			$this->_set_add_edit_form_tags('insert_price');
553 553
 		}
554 554
 
555 555
 		$this->_template_args['PRC_ID'] = $PRC_ID;
556 556
 		$this->_template_args['price'] = $price;
557 557
 
558 558
 		// get price types
559
-		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
559
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
560 560
 		$PRT = EEM_Price_Type::instance();
561
-		$price_types = $PRT->get_all( array( array('PBT_ID' => array('!=', 1 ) ) ) );
561
+		$price_types = $PRT->get_all(array(array('PBT_ID' => array('!=', 1))));
562 562
 		$price_type_names = array();
563 563
 		if (empty($price_types)) {
564
-			$msg = __( 'You have no price types defined. Please add a price type before adding a price.', 'event_espresso' );
565
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
564
+			$msg = __('You have no price types defined. Please add a price type before adding a price.', 'event_espresso');
565
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
566 566
 			exit();
567 567
 		} else {
568 568
 			foreach ($price_types as $type) {
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 		$this->_template_args['price_types'] = $price_type_names;
576 576
 		$this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link();
577 577
 
578
-		$this->_set_publish_post_box_vars( 'id', $PRC_ID );
578
+		$this->_set_publish_post_box_vars('id', $PRC_ID);
579 579
 		// the details template wrapper
580 580
 		$this->display_admin_page_with_sidebar();
581 581
 	}
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 	*		@return void
592 592
 	*/
593 593
 	protected function _price_details_meta_boxes() {
594
-		add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
594
+		add_meta_box('edit-price-details-mbox', __('Default Price Details', 'event_espresso'), array($this, '_edit_price_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
595 595
 	}
596 596
 
597 597
 
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 	*		@return void
606 606
 	*/
607 607
 	public function _edit_price_details_meta_box() {
608
-		echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE );
608
+		echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE);
609 609
 	}
610 610
 
611 611
 
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 	*/
620 620
 	protected function set_price_column_values() {
621 621
 
622
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
622
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
623 623
 
624 624
 		$set_column_values = array(
625 625
 				'PRT_ID' => absint($this->_req_data['PRT_ID']),
@@ -647,12 +647,12 @@  discard block
 block discarded – undo
647 647
 	*		@access protected
648 648
 	*		@return void
649 649
 	*/
650
-	protected function _insert_or_update_price( $insert = FALSE ) {
650
+	protected function _insert_or_update_price($insert = FALSE) {
651 651
 
652 652
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
653
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
653
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
654 654
 
655
-		require_once(EE_MODELS . 'EEM_Price.model.php');
655
+		require_once(EE_MODELS.'EEM_Price.model.php');
656 656
 		$PRC = EEM_Price::instance();
657 657
 
658 658
 		// why be so pessimistic ???  : (
@@ -660,14 +660,14 @@  discard block
 block discarded – undo
660 660
 
661 661
 		$set_column_values = $this->set_price_column_values();
662 662
 		// is this a new Price ?
663
-		if ( $insert ) {
663
+		if ($insert) {
664 664
 			// run the insert
665
-			if ( $PRC_ID = $PRC->insert( $set_column_values )) {
665
+			if ($PRC_ID = $PRC->insert($set_column_values)) {
666 666
 				//make sure this new price modifier is attached to the ticket but ONLY if it is not a tax type
667 667
 				$PR = EEM_price::instance()->get_one_by_ID($PRC_ID);
668
-				if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) {
668
+				if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
669 669
 					$ticket = EEM_Ticket::instance()->get_one_by_ID(1);
670
-					$ticket->_add_relation_to( $PR, 'Price' );
670
+					$ticket->_add_relation_to($PR, 'Price');
671 671
 					$ticket->save();
672 672
 				}
673 673
 				$success = 1;
@@ -677,29 +677,29 @@  discard block
 block discarded – undo
677 677
 			}
678 678
 			$action_desc = 'created';
679 679
 		} else {
680
-			$PRC_ID = absint( $this->_req_data['PRC_ID'] );
680
+			$PRC_ID = absint($this->_req_data['PRC_ID']);
681 681
 			// run the update
682
-			$where_cols_n_values = array( 'PRC_ID' => $PRC_ID );
683
-			if ( $PRC->update( $set_column_values, array($where_cols_n_values))) {
682
+			$where_cols_n_values = array('PRC_ID' => $PRC_ID);
683
+			if ($PRC->update($set_column_values, array($where_cols_n_values))) {
684 684
 				$success = 1;
685 685
 			}
686 686
 
687 687
 			$PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
688
-			if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) {
688
+			if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
689 689
 
690 690
 				//if this is $PRC_ID == 1, then we need to update the default ticket attached to this price so the TKT_price value is updated.
691
-				if ( $PRC_ID === 1 ) {
691
+				if ($PRC_ID === 1) {
692 692
 					$ticket = $PR->get_first_related('Ticket');
693
-					if ( $ticket ) {
694
-						$ticket->set('TKT_price', $PR->get('PRC_amount') );
695
-						$ticket->set('TKT_name', $PR->get('PRC_name') );
693
+					if ($ticket) {
694
+						$ticket->set('TKT_price', $PR->get('PRC_amount'));
695
+						$ticket->set('TKT_name', $PR->get('PRC_name'));
696 696
 						$ticket->set('TKT_description', $PR->get('PRC_desc'));
697 697
 						$ticket->save();
698 698
 					}
699 699
 				} else {
700 700
 					//we make sure this price is attached to base ticket. but ONLY if its not a tax ticket type.
701 701
 					$ticket = EEM_Ticket::instance()->get_one_by_ID(1);
702
-					$ticket->_add_relation_to( $PRC_ID, 'Price' );
702
+					$ticket->_add_relation_to($PRC_ID, 'Price');
703 703
 					$ticket->save();
704 704
 				}
705 705
 			}
@@ -707,9 +707,9 @@  discard block
 block discarded – undo
707 707
 			$action_desc = 'updated';
708 708
 		}
709 709
 
710
-		$query_args = array( 'action' => 'edit_price', 'id' => $PRC_ID );
710
+		$query_args = array('action' => 'edit_price', 'id' => $PRC_ID);
711 711
 
712
-		$this->_redirect_after_action( $success, 'Prices', $action_desc, $query_args );
712
+		$this->_redirect_after_action($success, 'Prices', $action_desc, $query_args);
713 713
 
714 714
 	}
715 715
 
@@ -723,12 +723,12 @@  discard block
 block discarded – undo
723 723
 	*		@access protected
724 724
 	*		@return void
725 725
 	*/
726
-	protected function _trash_or_restore_price( $trash = TRUE ) {
726
+	protected function _trash_or_restore_price($trash = TRUE) {
727 727
 
728 728
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
729
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
729
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
730 730
 
731
-		require_once(EE_MODELS . 'EEM_Price.model.php');
731
+		require_once(EE_MODELS.'EEM_Price.model.php');
732 732
 		$PRC = EEM_Price::instance();
733 733
 
734 734
 		$success = 1;
@@ -737,18 +737,18 @@  discard block
 block discarded – undo
737 737
 		//get base ticket for updating
738 738
 		$ticket = EEM_Ticket::instance()->get_one_by_ID(1);
739 739
 		//Checkboxes
740
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
740
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
741 741
 			// if array has more than one element than success message should be plural
742
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
742
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
743 743
 			// cycle thru checkboxes
744
-			while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) {
745
-				if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID) ) ) {
744
+			while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) {
745
+				if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID))) {
746 746
 					$success = 0;
747 747
 				} else {
748 748
 					$PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
749
-					if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) {
749
+					if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
750 750
 						//if trashing then remove relations to base default ticket.  If restoring then add back to base default ticket
751
-						if ( $PRC_deleted ) {
751
+						if ($PRC_deleted) {
752 752
 							$ticket->_remove_relation_to($PRC_ID, 'Price');
753 753
 						} else {
754 754
 							$ticket->_add_relation_to($PRC_ID, 'Price');
@@ -760,14 +760,14 @@  discard block
 block discarded – undo
760 760
 
761 761
 		} else {
762 762
 			// grab single id and delete
763
-			$PRC_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
764
-			if ( empty( $PRC_ID ) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID) ) {
763
+			$PRC_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
764
+			if (empty($PRC_ID) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID)) {
765 765
 				$success = 0;
766 766
 			} else {
767 767
 				$PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
768
-				if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) {
768
+				if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
769 769
 					//if trashing then remove relations to base default ticket.  If restoring then add back to base default ticket
770
-					if ( $PRC_deleted ) {
770
+					if ($PRC_deleted) {
771 771
 						$ticket->_remove_relation_to($PRC_ID, 'Price');
772 772
 					} else {
773 773
 						$ticket->_add_relation_to($PRC_ID, 'Price');
@@ -781,17 +781,17 @@  discard block
 block discarded – undo
781 781
 			'action' => 'default'
782 782
 			);
783 783
 
784
-		if ( $success ) {
785
-			if ( $trash ) {
784
+		if ($success) {
785
+			if ($trash) {
786 786
 				$msg = $success == 2 ? __('The Prices have been trashed.', 'event_espresso') : __('The Price has been trashed.', 'event_espresso');
787 787
 			} else {
788 788
 				$msg = $success == 2 ? __('The Prices have been restored.', 'event_espresso') : __('The Price has been restored.', 'event_espresso');
789 789
 			}
790 790
 
791
-			EE_Error::add_success( $msg );
791
+			EE_Error::add_success($msg);
792 792
 		}
793 793
 
794
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
794
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
795 795
 
796 796
 	}
797 797
 
@@ -808,19 +808,19 @@  discard block
 block discarded – undo
808 808
 	protected function _delete_price() {
809 809
 
810 810
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
811
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
811
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
812 812
 
813
-		require_once(EE_MODELS . 'EEM_Price.model.php');
813
+		require_once(EE_MODELS.'EEM_Price.model.php');
814 814
 		$PRC = EEM_Price::instance();
815 815
 
816 816
 		$success = 1;
817 817
 		//Checkboxes
818
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
818
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
819 819
 			// if array has more than one element than success message should be plural
820
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
820
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
821 821
 			// cycle thru bulk action checkboxes
822
-			while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) {
823
-				if (!$PRC->delete_permanently_by_ID(absint($PRC_ID))) {
822
+			while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) {
823
+				if ( ! $PRC->delete_permanently_by_ID(absint($PRC_ID))) {
824 824
 					$success = 0;
825 825
 				}
826 826
 			}
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 
835 835
 		}
836 836
 
837
-		$this->_redirect_after_action( $success, 'Prices', 'deleted', array() );
837
+		$this->_redirect_after_action($success, 'Prices', 'deleted', array());
838 838
 
839 839
 	}
840 840
 
@@ -842,16 +842,16 @@  discard block
 block discarded – undo
842 842
 
843 843
 
844 844
 	public function update_price_order() {
845
-		$success = __( 'Price order was updated successfully.', 'event_espresso' );
845
+		$success = __('Price order was updated successfully.', 'event_espresso');
846 846
 
847 847
 		// grab our row IDs
848
-		$row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) : FALSE;
848
+		$row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(',', rtrim($this->_req_data['row_ids'], ',')) : FALSE;
849 849
 
850
-		if ( is_array( $row_ids )) {
851
-			for ( $i = 0; $i < count( $row_ids ); $i++ ) {
850
+		if (is_array($row_ids)) {
851
+			for ($i = 0; $i < count($row_ids); $i++) {
852 852
 				//Update the prices when re-ordering
853 853
 				$id = absint($row_ids[$i]);
854
-				if ( EEM_Price::instance()->update ( array( 'PRC_order' => $i+1 ), array(array( 'PRC_ID' => $id ) )) === FALSE ) {
854
+				if (EEM_Price::instance()->update(array('PRC_order' => $i + 1), array(array('PRC_ID' => $id))) === FALSE) {
855 855
 					$success = FALSE;
856 856
 				}
857 857
 			}
@@ -859,9 +859,9 @@  discard block
 block discarded – undo
859 859
 			$success = FALSE;
860 860
 		}
861 861
 
862
-		$errors = ! $success ? __( 'An error occurred. The price order was not updated.', 'event_espresso' ) : FALSE;
862
+		$errors = ! $success ? __('An error occurred. The price order was not updated.', 'event_espresso') : FALSE;
863 863
 
864
-		echo json_encode( array( 'return_data' => FALSE, 'success' => $success, 'errors' => $errors ));
864
+		echo json_encode(array('return_data' => FALSE, 'success' => $success, 'errors' => $errors));
865 865
 		die();
866 866
 	}
867 867
 
@@ -904,46 +904,46 @@  discard block
 block discarded – undo
904 904
 	* 	@param  boolean $trashed   whether the current view is of the trash can - eww yuck!
905 905
 	* 	@return mixed (int|array)  int = count || array of price objects
906 906
 	*/
907
-	public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) {
907
+	public function get_price_types_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) {
908 908
 
909
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
909
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
910 910
 		// start with an empty array
911 911
 
912
-		require_once( PRICING_ADMIN . 'Price_Types_List_Table.class.php' );
913
-		require_once( EE_MODELS . 'EEM_Price_Type.model.php' );
912
+		require_once(PRICING_ADMIN.'Price_Types_List_Table.class.php');
913
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
914 914
 
915 915
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby'];
916
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
916
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
917 917
 		switch ($this->_req_data['orderby']) {
918 918
 			case 'name':
919
-				$orderby = array( 'PRT_name' => $order);
919
+				$orderby = array('PRT_name' => $order);
920 920
 				break;
921 921
 			default:
922
-				$orderby = array( 'PRT_order' => $order);
922
+				$orderby = array('PRT_order' => $order);
923 923
 		}
924 924
 
925 925
 
926
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
927
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
926
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
927
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
928 928
 
929
-		$offset = ($current_page-1)*$per_page;
930
-		$limit = array( $offset, $per_page );
929
+		$offset = ($current_page - 1) * $per_page;
930
+		$limit = array($offset, $per_page);
931 931
 
932
-		$_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1 ) );
932
+		$_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1));
933 933
 
934
-		if ( isset( $this->_req_data['s'] ) ) {
935
-			$sstr = '%' . $this->_req_data['s'] . '%';
934
+		if (isset($this->_req_data['s'])) {
935
+			$sstr = '%'.$this->_req_data['s'].'%';
936 936
 			$_where['OR'] = array(
937
-				'PRT_name' => array( 'LIKE', $sstr )
937
+				'PRT_name' => array('LIKE', $sstr)
938 938
 				);
939 939
 		}
940 940
 		$query_params = array(
941 941
 			$_where,
942 942
 			'order_by'=>$orderby,
943 943
 			'limit'=>$limit);
944
-		if($count){
944
+		if ($count) {
945 945
 			return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params);
946
-		}else{
946
+		} else {
947 947
 			return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params);
948 948
 		}
949 949
 
@@ -963,25 +963,25 @@  discard block
 block discarded – undo
963 963
 	*/
964 964
 	protected function _edit_price_type_details() {
965 965
 
966
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
966
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
967 967
 
968 968
 
969 969
 		// grab price type ID
970
-		$PRT_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
970
+		$PRT_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
971 971
 		// change page title based on request action
972
-		$this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action ));
972
+		$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
973 973
 		// add PRT_ID to title if editing
974
-		$this->_admin_page_title = $PRT_ID ? $this->_admin_page_title . ' # ' . $PRT_ID : $this->_admin_page_title;
974
+		$this->_admin_page_title = $PRT_ID ? $this->_admin_page_title.' # '.$PRT_ID : $this->_admin_page_title;
975 975
 
976 976
 //		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
977 977
 
978
-		if ( $PRT_ID ) {
979
-			$price_type = EEM_Price_Type::instance()->get_one_by_ID( $PRT_ID );
980
-			$additional_hidden_fields = array( 'PRT_ID' => array( 'type' => 'hidden', 'value' => $PRT_ID ));
981
-			$this->_set_add_edit_form_tags( 'update_price_type', $additional_hidden_fields );
978
+		if ($PRT_ID) {
979
+			$price_type = EEM_Price_Type::instance()->get_one_by_ID($PRT_ID);
980
+			$additional_hidden_fields = array('PRT_ID' => array('type' => 'hidden', 'value' => $PRT_ID));
981
+			$this->_set_add_edit_form_tags('update_price_type', $additional_hidden_fields);
982 982
 		} else {
983 983
 			$price_type = EEM_Price_Type::instance()->get_new_price_type();
984
-			$this->_set_add_edit_form_tags( 'insert_price_type' );
984
+			$this->_set_add_edit_form_tags('insert_price_type');
985 985
 		}
986 986
 
987 987
 		$this->_template_args['PRT_ID'] = $PRT_ID;
@@ -990,19 +990,19 @@  discard block
 block discarded – undo
990 990
 
991 991
 		$base_types = EEM_Price_Type::instance()->get_base_types();
992 992
 		$select_values = array();
993
-		foreach ( $base_types as $ref => $text ) {
994
-			if ( $ref == EEM_Price_Type::base_type_base_price ) {
993
+		foreach ($base_types as $ref => $text) {
994
+			if ($ref == EEM_Price_Type::base_type_base_price) {
995 995
 				//do not allow creation of base_type_base_prices because that's a system only base type.
996 996
 				continue;
997 997
 			}
998
-			$values[] = array( 'id' => $ref, 'text' => $text );
998
+			$values[] = array('id' => $ref, 'text' => $text);
999 999
 		}
1000 1000
 
1001 1001
 
1002 1002
 		$this->_template_args['base_type_select'] = EEH_Form_Fields::select_input('base_type', $values, $price_type->base_type(), 'id="price-type-base-type-slct"');
1003 1003
 		$this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link();
1004
-		$redirect_URL = add_query_arg( array( 'action' => 'price_types'), $this->_admin_base_url );
1005
-		$this->_set_publish_post_box_vars( 'id', $PRT_ID, FALSE, $redirect_URL );
1004
+		$redirect_URL = add_query_arg(array('action' => 'price_types'), $this->_admin_base_url);
1005
+		$this->_set_publish_post_box_vars('id', $PRT_ID, FALSE, $redirect_URL);
1006 1006
 		// the details template wrapper
1007 1007
 		$this->display_admin_page_with_sidebar();
1008 1008
 
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
 	*		@return void
1020 1020
 	*/
1021 1021
 	protected function _price_type_details_meta_boxes() {
1022
-		add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1022
+		add_meta_box('edit-price-details-mbox', __('Price Type Details', 'event_espresso'), array($this, '_edit_price_type_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
1023 1023
 	}
1024 1024
 
1025 1025
 
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
 	*		@return void
1033 1033
 	*/
1034 1034
 	public function _edit_price_type_details_meta_box() {
1035
-		echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE );
1035
+		echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE);
1036 1036
 	}
1037 1037
 
1038 1038
 
@@ -1045,9 +1045,9 @@  discard block
 block discarded – undo
1045 1045
 	*/
1046 1046
 	protected function set_price_type_column_values() {
1047 1047
 
1048
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1048
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1049 1049
 
1050
-		$base_type = !empty( $this->_req_data['base_type'] ) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price;
1050
+		$base_type = ! empty($this->_req_data['base_type']) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price;
1051 1051
 
1052 1052
 		switch ($base_type) {
1053 1053
 
@@ -1094,12 +1094,12 @@  discard block
 block discarded – undo
1094 1094
 	*		@access protected
1095 1095
 	*		@return void
1096 1096
 	*/
1097
-	protected function _insert_or_update_price_type( $new_price_type = FALSE ) {
1097
+	protected function _insert_or_update_price_type($new_price_type = FALSE) {
1098 1098
 
1099 1099
 //		echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
1100
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1100
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1101 1101
 
1102
-		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
1102
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
1103 1103
 		$PRT = EEM_Price_Type::instance();
1104 1104
 
1105 1105
 		// why be so pessimistic ???  : (
@@ -1107,24 +1107,24 @@  discard block
 block discarded – undo
1107 1107
 
1108 1108
 		$set_column_values = $this->set_price_type_column_values();
1109 1109
 		// is this a new Price ?
1110
-		if ( $new_price_type ) {
1110
+		if ($new_price_type) {
1111 1111
 			// run the insert
1112
-			if ( $PRT_ID = $PRT->insert( $set_column_values )) {
1112
+			if ($PRT_ID = $PRT->insert($set_column_values)) {
1113 1113
 				$success = 1;
1114 1114
 			}
1115 1115
 			$action_desc = 'created';
1116 1116
 		} else {
1117 1117
 			$PRT_ID = absint($this->_req_data['PRT_ID']);
1118 1118
 			// run the update
1119
-			$where_cols_n_values = array('PRT_ID' => $PRT_ID );
1120
-			if ( $PRT->update( $set_column_values, array( $where_cols_n_values ))) {
1119
+			$where_cols_n_values = array('PRT_ID' => $PRT_ID);
1120
+			if ($PRT->update($set_column_values, array($where_cols_n_values))) {
1121 1121
 				$success = 1;
1122 1122
 			}
1123 1123
 			$action_desc = 'updated';
1124 1124
 		}
1125 1125
 
1126
-		$query_args = array( 'action'=> 'edit_price_type', 'id' => $PRT_ID );
1127
-		$this->_redirect_after_action( $success, 'Price Type', $action_desc, $query_args );
1126
+		$query_args = array('action'=> 'edit_price_type', 'id' => $PRT_ID);
1127
+		$this->_redirect_after_action($success, 'Price Type', $action_desc, $query_args);
1128 1128
 
1129 1129
 	}
1130 1130
 
@@ -1138,49 +1138,49 @@  discard block
 block discarded – undo
1138 1138
 	*		@access protected
1139 1139
 	*		@return void
1140 1140
 	*/
1141
-	protected function _trash_or_restore_price_type( $trash = TRUE ) {
1141
+	protected function _trash_or_restore_price_type($trash = TRUE) {
1142 1142
 
1143 1143
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
1144
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1144
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1145 1145
 
1146
-		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
1146
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
1147 1147
 		$PRT = EEM_Price_Type::instance();
1148 1148
 
1149 1149
 		$success = 1;
1150 1150
 		$PRT_deleted = $trash ? TRUE : FALSE;
1151 1151
 		//Checkboxes
1152
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1152
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1153 1153
 			// if array has more than one element than success message should be plural
1154
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1155
-			$what = count( $this->_req_data['checkbox'] ) > 1 ? 'Price Types' : 'Price Type';
1154
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1155
+			$what = count($this->_req_data['checkbox']) > 1 ? 'Price Types' : 'Price Type';
1156 1156
 			// cycle thru checkboxes
1157
-			while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) {
1158
-				if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID ) ) {
1157
+			while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) {
1158
+				if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) {
1159 1159
 					$success = 0;
1160 1160
 				}
1161 1161
 			}
1162 1162
 
1163 1163
 		} else {
1164 1164
 			// grab single id and delete
1165
-			$PRT_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
1166
-			if ( empty( $PRT_ID ) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID )) {
1165
+			$PRT_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
1166
+			if (empty($PRT_ID) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) {
1167 1167
 				$success = 0;
1168 1168
 			}
1169 1169
 			$what = 'Price Type';
1170 1170
 
1171 1171
 		}
1172 1172
 
1173
-		$query_args = array( 'action' => 'price_types' );
1174
-		if ( $success ) {
1175
-			if ( $trash ) {
1173
+		$query_args = array('action' => 'price_types');
1174
+		if ($success) {
1175
+			if ($trash) {
1176 1176
 				$msg = $success > 1 ? __('The Price Types have been trashed.', 'event_espresso') : __('The Price Type has been trashed.', 'event_espresso');
1177 1177
 			} else {
1178 1178
 				$msg = $success > 1 ? __('The Price Types have been restored.', 'event_espresso') : __('The Price Type has been restored.', 'event_espresso');
1179 1179
 			}
1180
-			EE_Error::add_success( $msg );
1180
+			EE_Error::add_success($msg);
1181 1181
 		}
1182 1182
 
1183
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
1183
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
1184 1184
 
1185 1185
 	}
1186 1186
 
@@ -1197,19 +1197,19 @@  discard block
 block discarded – undo
1197 1197
 	protected function _delete_price_type() {
1198 1198
 
1199 1199
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
1200
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1200
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1201 1201
 
1202 1202
 		$PRT = EEM_Price_Type::instance();
1203 1203
 
1204 1204
 		$success = 1;
1205 1205
 		//Checkboxes
1206
-		if (!empty($this->_req_data['checkbox'])) {
1206
+		if ( ! empty($this->_req_data['checkbox'])) {
1207 1207
 			// if array has more than one element than success message should be plural
1208
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1208
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1209 1209
 			$what = $PRT->item_name($success);
1210 1210
 			// cycle thru bulk action checkboxes
1211
-			while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) {
1212
-				if (!$PRT->delete_permanently_by_ID($PRT_ID) ) {
1211
+			while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) {
1212
+				if ( ! $PRT->delete_permanently_by_ID($PRT_ID)) {
1213 1213
 					$success = 0;
1214 1214
 				}
1215 1215
 			}
@@ -1217,8 +1217,8 @@  discard block
 block discarded – undo
1217 1217
 		}
1218 1218
 
1219 1219
 
1220
-		$query_args = array( 'action'=> 'price_types' );
1221
-		$this->_redirect_after_action( $success, $what, 'deleted', $query_args );
1220
+		$query_args = array('action'=> 'price_types');
1221
+		$this->_redirect_after_action($success, $what, 'deleted', $query_args);
1222 1222
 
1223 1223
 	}
1224 1224
 
@@ -1234,7 +1234,7 @@  discard block
 block discarded – undo
1234 1234
 	*		@return string
1235 1235
 	*/
1236 1236
 	protected function _learn_more_about_pricing_link() {
1237
-		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>';
1237
+		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how pricing works', 'event_espresso').'</a>';
1238 1238
 	}
1239 1239
 
1240 1240
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -513,7 +515,7 @@  discard block
 block discarded – undo
513 515
 
514 516
 		if($count){
515 517
 			return EEM_Price::instance()->count_deleted_and_undeleted(array($_where));
516
-		}else{
518
+		} else{
517 519
 			return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params);
518 520
 		}
519 521
 	}
@@ -943,7 +945,7 @@  discard block
 block discarded – undo
943 945
 			'limit'=>$limit);
944 946
 		if($count){
945 947
 			return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params);
946
-		}else{
948
+		} else{
947 949
 			return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params);
948 950
 		}
949 951
 
Please login to merge, or discard this patch.
caffeinated/admin/new/pricing/Pricing_Admin_Page_Init.core.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 *
24 24
 * ------------------------------------------------------------------------
25 25
 */
26
-class Pricing_Admin_Page_Init extends EE_Admin_Page_Init  {
26
+class Pricing_Admin_Page_Init extends EE_Admin_Page_Init {
27 27
 
28 28
 
29 29
 
@@ -36,20 +36,20 @@  discard block
 block discarded – undo
36 36
 	 */
37 37
 	public function __construct() {
38 38
 
39
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
39
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
40 40
 
41
-		define( 'PRICING_PG_SLUG', 'pricing' );
42
-		define( 'PRICING_LABEL', __('Pricing', 'event_espresso'));
43
-		define( 'PRICING_PG_NAME', ucwords( str_replace( '_', '', PRICING_PG_SLUG )));
44
-		define( 'PRICING_ADMIN', EE_CORE_CAF_ADMIN . 'new' . DS . PRICING_PG_SLUG . DS );
45
-		define( 'PRICING_ADMIN_URL', admin_url( 'admin.php?page=' . PRICING_PG_SLUG ));
46
-		define( 'PRICING_ASSETS_PATH', PRICING_ADMIN . 'assets' . DS );
47
-		define( 'PRICING_ASSETS_URL', EE_CORE_CAF_ADMIN_URL . 'new' . DS . PRICING_PG_SLUG .'/assets/' );
48
-		define( 'PRICING_TEMPLATE_PATH', PRICING_ADMIN . 'templates' . DS );
49
-		define( 'PRICING_TEMPLATE_URL', EE_CORE_CAF_ADMIN_URL . 'new' . DS . PRICING_PG_SLUG . DS . 'templates/' );
41
+		define('PRICING_PG_SLUG', 'pricing');
42
+		define('PRICING_LABEL', __('Pricing', 'event_espresso'));
43
+		define('PRICING_PG_NAME', ucwords(str_replace('_', '', PRICING_PG_SLUG)));
44
+		define('PRICING_ADMIN', EE_CORE_CAF_ADMIN.'new'.DS.PRICING_PG_SLUG.DS);
45
+		define('PRICING_ADMIN_URL', admin_url('admin.php?page='.PRICING_PG_SLUG));
46
+		define('PRICING_ASSETS_PATH', PRICING_ADMIN.'assets'.DS);
47
+		define('PRICING_ASSETS_URL', EE_CORE_CAF_ADMIN_URL.'new'.DS.PRICING_PG_SLUG.'/assets/');
48
+		define('PRICING_TEMPLATE_PATH', PRICING_ADMIN.'templates'.DS);
49
+		define('PRICING_TEMPLATE_URL', EE_CORE_CAF_ADMIN_URL.'new'.DS.PRICING_PG_SLUG.DS.'templates/');
50 50
 
51 51
 		parent::__construct();
52
-		$this->_folder_path = EE_CORE_CAF_ADMIN . 'new' . DS . $this->_folder_name . DS;
52
+		$this->_folder_path = EE_CORE_CAF_ADMIN.'new'.DS.$this->_folder_name.DS;
53 53
 
54 54
 	}
55 55
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
 
66 66
 	protected function _set_menu_map() {
67
-		$this->_menu_map = new EE_Admin_Page_Sub_Menu( array(
67
+		$this->_menu_map = new EE_Admin_Page_Sub_Menu(array(
68 68
 			'menu_group' => 'management',
69 69
 			'menu_order' => 20,
70 70
 			'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
caffeinated/admin/new/pricing/espresso_events_Pricing_Hooks.class.php 3 patches
Braces   +30 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -166,8 +167,9 @@  discard block
 block discarded – undo
166 167
 
167 168
 	public function caf_updates( $update_callbacks ) {
168 169
 		foreach ( $update_callbacks as $key => $callback ) {
169
-			if ( $callback[1] == '_default_tickets_update' )
170
-				unset( $update_callbacks[$key] );
170
+			if ( $callback[1] == '_default_tickets_update' ) {
171
+							unset( $update_callbacks[$key] );
172
+			}
171 173
 		}
172 174
 
173 175
 		$update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' );
@@ -268,8 +270,9 @@  discard block
 block discarded – undo
268 270
 			$dtts_to_delete = array_diff( $old_datetimes, array_keys($saved_dtts) );
269 271
 			foreach ( $dtts_to_delete as $id ) {
270 272
 				$id = absint( $id );
271
-				if ( empty( $id ) )
272
-					continue;
273
+				if ( empty( $id ) ) {
274
+									continue;
275
+				}
273 276
 
274 277
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
275 278
 
@@ -507,8 +510,9 @@  discard block
 block discarded – undo
507 510
 				}
508 511
 
509 512
 				//if we have a new_tkt... let's add to it as well
510
-				if ( !empty( $new_tkt ) )
511
-					$new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime' );
513
+				if ( !empty( $new_tkt ) ) {
514
+									$new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime' );
515
+				}
512 516
 			}
513 517
 
514 518
 
@@ -518,8 +522,9 @@  discard block
 block discarded – undo
518 522
 			foreach ( $dtts_removed as $dttrow ) {
519 523
 				$dttrow = (int) $dttrow;
520 524
 				//its entirely possible that a datetime got deleted (instead of just removed from relationship.  So make sure we skip over this if the dtt isn't in the saved_dtts array)
521
-				if ( empty($saved_dtts[$dttrow] ) || ! $saved_dtts[$dttrow] instanceof EE_Datetime )
522
-					continue;
525
+				if ( empty($saved_dtts[$dttrow] ) || ! $saved_dtts[$dttrow] instanceof EE_Datetime ) {
526
+									continue;
527
+				}
523 528
 
524 529
 				$TKT->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
525 530
 
@@ -529,8 +534,9 @@  discard block
 block discarded – undo
529 534
 					$saved_dtts[$dttrow]->save();
530 535
 				}
531 536
 
532
-				if ( !empty( $new_tkt ) )
533
-					$new_tkt->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
537
+				if ( !empty( $new_tkt ) ) {
538
+									$new_tkt->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
539
+				}
534 540
 			}
535 541
 
536 542
 
@@ -572,8 +578,9 @@  discard block
 block discarded – undo
572 578
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
573 579
 
574 580
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
575
-			if ( $tkt_to_remove->get('TKT_is_default') )
576
-				continue;
581
+			if ( $tkt_to_remove->get('TKT_is_default') ) {
582
+							continue;
583
+			}
577 584
 
578 585
 			//if this tkt has any registrations attached so then we just ARCHIVE because we don't actually permanently delete these tickets.
579 586
 			if ( $tkt_to_remove->count_related('Registration') > 0 ) {
@@ -634,13 +641,16 @@  discard block
 block discarded – undo
634 641
 		}
635 642
 
636 643
 		//possibly need to save tkt
637
-		if ( ! $ticket->ID() )
638
-			$ticket->save();
644
+		if ( ! $ticket->ID() ) {
645
+					$ticket->save();
646
+		}
639 647
 
640 648
 		foreach ( $prices as $row => $prc ) {
641 649
 			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
642
-			if ( empty($prt_id) )
643
-				continue; //prices MUST have a price type id.
650
+			if ( empty($prt_id) ) {
651
+							continue;
652
+			}
653
+			//prices MUST have a price type id.
644 654
 			$PRC_values = array(
645 655
 				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
646 656
 				'PRT_ID' => $prt_id,
@@ -784,8 +794,9 @@  discard block
 block discarded – undo
784 794
 				$datetime_tickets[$dttid][] = $tktrow;
785 795
 
786 796
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
787
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
788
-					$ticket_datetimes[$tktid][] = $dttrow;
797
+				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) ) {
798
+									$ticket_datetimes[$tktid][] = $dttrow;
799
+				}
789 800
 			}
790 801
 		}
791 802
 
Please login to merge, or discard this patch.
Doc Comments   +20 added lines, -3 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 * Handles saving everything related to Tickets (datetimes, tickets, prices)
130 130
 	 * @param  EE_Event $evtobj The Event object we're attaching data to
131 131
 	 * @param  array    $data   The request data from the form
132
-	 * @return bool             success or fail
132
+	 * @return boolean|null             success or fail
133 133
 	 */
134 134
 	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
135 135
 		//first we need to start with datetimes cause they are the "root" items attached to events.
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @param  EE_Event         $evtobj     Event object being updated
233 233
 	 * @param  EE_Datetime[]    $saved_dtts an array of datetime ids being updated
234 234
 	 * @param  array            $data       incoming request data
235
-	 * @return bool                 		success or fail
235
+	 * @return boolean|null                 		success or fail
236 236
 	 */
237 237
 	private function _update_tkts( $evtobj, $saved_dtts, $data ) {
238 238
 		//stripslashes because WP filtered the $_POST ($data) array to add slashes
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	 * @param bool 		$new_prices Whether attach existing incoming prices or create new ones.
521 521
 	 * @param int|bool 		$base_price if FALSE then NOT doing a base price add.
522 522
 	 * @param int|bool 		$base_price_id  if present then this is the base_price_id being updated.
523
-	 * @return  void
523
+	 * @return  EE_Ticket
524 524
 	 */
525 525
 	private function  _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) {
526 526
 
@@ -732,6 +732,9 @@  discard block
 block discarded – undo
732 732
 
733 733
 
734 734
 
735
+	/**
736
+	 * @param integer $dttrow
737
+	 */
735 738
 	private function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
736 739
 
737 740
 		$dtt_display_template_args = array(
@@ -745,6 +748,10 @@  discard block
 block discarded – undo
745 748
 
746 749
 
747 750
 
751
+	/**
752
+	 * @param EE_Datetime|null $dtt
753
+	 * @param boolean $default
754
+	 */
748 755
 	private function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) {
749 756
 
750 757
 		$template_args = array(
@@ -773,6 +780,10 @@  discard block
 block discarded – undo
773 780
 	}
774 781
 
775 782
 
783
+	/**
784
+	 * @param EE_Datetime|null $dtt
785
+	 * @param boolean $default
786
+	 */
776 787
 	private function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
777 788
 
778 789
 		$template_args = array(
@@ -977,6 +988,9 @@  discard block
 block discarded – undo
977 988
 
978 989
 
979 990
 
991
+	/**
992
+	 * @param boolean $default
993
+	 */
980 994
 	private function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
981 995
 		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
982 996
 		$template_args = array(
@@ -1083,6 +1097,9 @@  discard block
 block discarded – undo
1083 1097
 
1084 1098
 
1085 1099
 
1100
+	/**
1101
+	 * @param boolean $default
1102
+	 */
1086 1103
 	private function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1087 1104
 		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1088 1105
 		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
Please login to merge, or discard this patch.
Spacing   +328 added lines, -328 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -40,21 +40,21 @@  discard block
 block discarded – undo
40 40
 		$this->_name = 'pricing';
41 41
 
42 42
 		//capability check
43
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_default_prices', 'advanced_ticket_datetime_metabox' ) ) {
43
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices', 'advanced_ticket_datetime_metabox')) {
44 44
 			return;
45 45
 		}
46 46
 
47 47
 		//if we were going to add our own metaboxes we'd use the below.
48 48
 		$this->_metaboxes = array(
49 49
 			0 => array(
50
-				'page_route' => array('edit','create_new'),
50
+				'page_route' => array('edit', 'create_new'),
51 51
 				'func' => 'pricing_metabox',
52 52
 				'label' => __('Event Tickets & Datetimes', 'event_espresso'),
53 53
 				'priority' => 'high',
54 54
 				'context' => 'normal'
55 55
 				),
56 56
 
57
-			);/**/
57
+			); /**/
58 58
 
59 59
 		$this->_remove_metaboxes = array(
60 60
 			0 => array(
@@ -67,35 +67,35 @@  discard block
 block discarded – undo
67 67
 		$this->_scripts_styles = array(
68 68
 			'registers' => array(
69 69
 				'ee-tickets-datetimes-css' => array(
70
-					'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css',
70
+					'url' => PRICING_ASSETS_URL.'event-tickets-datetimes.css',
71 71
 					'type' => 'css'
72 72
 					),
73 73
 				'ee-dtt-ticket-metabox' => array(
74
-					'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js',
74
+					'url' => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js',
75 75
 					'depends' => array('ee-datepicker', 'ee-dialog', 'underscore')
76 76
 					)
77 77
 				),
78 78
 			'deregisters' => array(
79
-				'event-editor-css' => array('type' => 'css' ),
79
+				'event-editor-css' => array('type' => 'css'),
80 80
 				'event-datetime-metabox' => array('type' => 'js')
81 81
 				),
82 82
 			'enqueues' => array(
83
-				'ee-tickets-datetimes-css' => array( 'edit', 'create_new' ),
84
-				'ee-dtt-ticket-metabox' => array( 'edit', 'create_new' )
83
+				'ee-tickets-datetimes-css' => array('edit', 'create_new'),
84
+				'ee-dtt-ticket-metabox' => array('edit', 'create_new')
85 85
 				),
86 86
 			'localize' => array(
87 87
 				'ee-dtt-ticket-metabox' => array(
88 88
 					'DTT_TRASH_BLOCK' => array(
89 89
 						'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', 'event_espresso'),
90 90
 						'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', 'event_espresso'),
91
-						'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', 'event_espresso') . '</button>',
91
+						'cancel_button' => '<button class="button-secondary ee-modal-cancel">'.__('Cancel', 'event_espresso').'</button>',
92 92
 						'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
93 93
 						'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket.  Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
94
-						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button>'
94
+						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button>'
95 95
 						),
96 96
 					'DTT_ERROR_MSG' => array(
97 97
 						'no_ticket_name' => __('General Admission', 'event_espresso'),
98
-						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button></div>'
98
+						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button></div>'
99 99
 						),
100 100
 					'DTT_OVERSELL_WARNING' => array(
101 101
 						'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.', 'event_espresso'),
@@ -106,19 +106,19 @@  discard block
 block discarded – undo
106 106
 			);
107 107
 
108 108
 
109
-		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array( $this, 'autosave_handling' ), 10 );
110
-		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 );
109
+		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array($this, 'autosave_handling'), 10);
110
+		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10);
111 111
 	}
112 112
 
113 113
 
114 114
 
115
-	public function caf_updates( $update_callbacks ) {
116
-		foreach ( $update_callbacks as $key => $callback ) {
117
-			if ( $callback[1] == '_default_tickets_update' )
118
-				unset( $update_callbacks[$key] );
115
+	public function caf_updates($update_callbacks) {
116
+		foreach ($update_callbacks as $key => $callback) {
117
+			if ($callback[1] == '_default_tickets_update')
118
+				unset($update_callbacks[$key]);
119 119
 		}
120 120
 
121
-		$update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' );
121
+		$update_callbacks[] = array($this, 'dtt_and_tickets_caf_update');
122 122
 		return $update_callbacks;
123 123
 	}
124 124
 
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
 	 * @param  array    $data   The request data from the form
132 132
 	 * @return bool             success or fail
133 133
 	 */
134
-	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
134
+	public function dtt_and_tickets_caf_update($evtobj, $data) {
135 135
 		//first we need to start with datetimes cause they are the "root" items attached to events.
136
-		$saved_dtts = $this->_update_dtts( $evtobj, $data );
136
+		$saved_dtts = $this->_update_dtts($evtobj, $data);
137 137
 		//next tackle the tickets (and prices?)
138
-		$success = $this->_update_tkts( $evtobj, $saved_dtts, $data );
138
+		$success = $this->_update_tkts($evtobj, $saved_dtts, $data);
139 139
 	}
140 140
 
141 141
 
@@ -146,76 +146,76 @@  discard block
 block discarded – undo
146 146
 	 * @param  array    	$data    the request data from the form
147 147
 	 * @return EE_Datetime           array of EE_Datetime ids created/updated.
148 148
 	 */
149
-	private function _update_dtts( $evt_obj, $data ) {
150
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
149
+	private function _update_dtts($evt_obj, $data) {
150
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
151 151
 		$success = TRUE;
152 152
 
153
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
154
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
153
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
154
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
155 155
 			$datetime_values = array(
156
-				'DTT_ID' => !empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
157
-				'DTT_name' => !empty( $dtt['DTT_name'] ) ? $dtt['DTT_name'] : '',
158
-				'DTT_description' => !empty( $dtt['DTT_description'] ) ? $dtt['DTT_description'] : '',
156
+				'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
157
+				'DTT_name' => ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '',
158
+				'DTT_description' => ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '',
159 159
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
160 160
 				'DTT_EVT_end' => $dtt['DTT_EVT_end'],
161
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? INF : $dtt['DTT_reg_limit'],
162
-				'DTT_order' => !isset( $dtt['DTT_order'] ) ? $row : $dtt['DTT_order'],
161
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? INF : $dtt['DTT_reg_limit'],
162
+				'DTT_order' => ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'],
163 163
 				);
164 164
 
165 165
 			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
166 166
 
167
-			if ( !empty( $dtt['DTT_ID'] ) ) {
168
-				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) )->get_one_by_ID($dtt['DTT_ID'] );
169
-				foreach ( $datetime_values as $field => $value ) {
170
-					$DTM->set( $field, $value );
167
+			if ( ! empty($dtt['DTT_ID'])) {
168
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']);
169
+				foreach ($datetime_values as $field => $value) {
170
+					$DTM->set($field, $value);
171 171
 				}
172 172
 
173 173
 				//make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.  We need to do this so we dont' TRASH the parent DTT.
174 174
 				$saved_dtts[$DTM->ID()] = $DTM;
175 175
 			} else {
176
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values, $timezone ), FALSE, FALSE );
176
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values, $timezone), FALSE, FALSE);
177 177
 			}
178 178
 
179 179
 			$DTM->save();
180
-			$DTT = $evt_obj->_add_relation_to( $DTM, 'Datetime' );
180
+			$DTT = $evt_obj->_add_relation_to($DTM, 'Datetime');
181 181
 
182 182
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
183
-			if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) {
184
-				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') );
183
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
184
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
185 185
 				EE_Registry::instance()->load_helper('DTT_Helper');
186 186
 				EE_Registry::instance()->load_helper('DTT_Helper');
187 187
 				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
188 188
 				$DTT->save();
189 189
 			}
190
-			$datetimes_start_times[$DTT->start_date_and_time('Y-m-d','H:i:s')] = $DTT->ID();
190
+			$datetimes_start_times[$DTT->start_date_and_time('Y-m-d', 'H:i:s')] = $DTT->ID();
191 191
 			//now we got to make sure we add the new DTT_ID to the $saved_dtts array  because it is possible there was a new one created for the autosave.
192 192
 			$saved_dtts[$DTT->ID()] = $DTT;
193 193
 			$saved_dtt_objs[$row] = $DTT;
194 194
 
195
-			$success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
195
+			$success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
196 196
 		}
197 197
 
198 198
 		//now we need to REMOVE any dtts that got deleted.  Keep in mind that this process will only kick in for DTT's that don't have any DTT_sold on them. So its safe to permanently delete at this point.
199
-		$old_datetimes = explode(',', $data['datetime_IDs'] );
199
+		$old_datetimes = explode(',', $data['datetime_IDs']);
200 200
 		$old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes;
201 201
 
202
-		if ( is_array( $old_datetimes ) ) {
203
-			$dtts_to_delete = array_diff( $old_datetimes, array_keys($saved_dtts) );
204
-			foreach ( $dtts_to_delete as $id ) {
205
-				$id = absint( $id );
206
-				if ( empty( $id ) )
202
+		if (is_array($old_datetimes)) {
203
+			$dtts_to_delete = array_diff($old_datetimes, array_keys($saved_dtts));
204
+			foreach ($dtts_to_delete as $id) {
205
+				$id = absint($id);
206
+				if (empty($id))
207 207
 					continue;
208 208
 
209 209
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
210 210
 
211 211
 				//remove tkt relationships.
212 212
 				$related_tickets = $dtt_to_remove->get_many_related('Ticket');
213
-				foreach ( $related_tickets as $tkt ) {
213
+				foreach ($related_tickets as $tkt) {
214 214
 					$dtt_to_remove->_remove_relation_to($tkt, 'Ticket');
215 215
 				}
216 216
 
217 217
 
218
-				$evt_obj->_remove_relation_to( $id, 'Datetime' );
218
+				$evt_obj->_remove_relation_to($id, 'Datetime');
219 219
 			}
220 220
 		}
221 221
 
@@ -234,63 +234,63 @@  discard block
 block discarded – undo
234 234
 	 * @param  array            $data       incoming request data
235 235
 	 * @return bool                 		success or fail
236 236
 	 */
237
-	private function _update_tkts( $evtobj, $saved_dtts, $data ) {
237
+	private function _update_tkts($evtobj, $saved_dtts, $data) {
238 238
 		//stripslashes because WP filtered the $_POST ($data) array to add slashes
239 239
 		$data = stripslashes_deep($data);
240
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
240
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
241 241
 		$success = TRUE;
242 242
 		$saved_tickets = $dtts_on_existing = array();
243
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
243
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
244 244
 
245 245
 		//load money helper
246
-		EE_Registry::instance()->load_helper( 'Money' );
246
+		EE_Registry::instance()->load_helper('Money');
247 247
 
248
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
248
+		foreach ($data['edit_tickets'] as $row => $tkt) {
249 249
 
250 250
 			$update_prices = $create_new_TKT = $ticket_sold = FALSE;
251 251
 			$new_default = $new_tkt = NULL;
252 252
 
253 253
 			//figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session.
254 254
 
255
-			$starting_tkt_dtt_rows = explode(',',$data['starting_ticket_datetime_rows'][$row]);
256
-			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row] );
255
+			$starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]);
256
+			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]);
257 257
 			$dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows);
258 258
 			$dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows);
259 259
 
260 260
 			//note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models.
261 261
 			//note incoming ['TKT_price'] value is already in standard notation (via js).
262
-			$ticket_price = isset( $tkt['TKT_price'] ) ?  round ( (float) $tkt['TKT_price'], 3 ) : 0;
262
+			$ticket_price = isset($tkt['TKT_price']) ? round((float) $tkt['TKT_price'], 3) : 0;
263 263
 
264 264
 			//note incoming base price needs converted from localized value.
265
-			$base_price = isset( $tkt['TKT_base_price'] ) ? EEH_Money::convert_to_float_from_localized_money( $tkt['TKT_base_price'] ) : 0;
265
+			$base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0;
266 266
 			//if ticket price == 0 and $base_price != 0 then ticket price == base_price
267 267
 			$ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price;
268
-			$base_price_id = isset( $tkt['TKT_base_price_ID'] ) ? $tkt['TKT_base_price_ID'] : 0;
268
+			$base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0;
269 269
 
270 270
 			$price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array();
271 271
 
272 272
 			$TKT_values = array(
273
-				'TKT_ID' => !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
274
-				'TTM_ID' => !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
275
-				'TKT_name' => !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
276
-				'TKT_description' => !empty( $tkt['TKT_description'] ) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
277
-				'TKT_start_date' => isset( $tkt['TKT_start_date'] ) ? $tkt['TKT_start_date'] : current_time('mysql'),
278
-				'TKT_end_date' => isset( $tkt['TKT_end_date'] ) ? $tkt['TKT_end_date'] : current_time('mysql'),
279
-				'TKT_qty' => empty( $tkt['TKT_qty'] ) ? INF : $tkt['TKT_qty'],
280
-				'TKT_uses' => empty( $tkt['TKT_uses'] ) ? INF : $tkt['TKT_uses'],
281
-				'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
282
-				'TKT_max' => empty( $tkt['TKT_max'] ) ? INF : $tkt['TKT_max'],
273
+				'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
274
+				'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
275
+				'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
276
+				'TKT_description' => ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
277
+				'TKT_start_date' => isset($tkt['TKT_start_date']) ? $tkt['TKT_start_date'] : current_time('mysql'),
278
+				'TKT_end_date' => isset($tkt['TKT_end_date']) ? $tkt['TKT_end_date'] : current_time('mysql'),
279
+				'TKT_qty' => empty($tkt['TKT_qty']) ? INF : $tkt['TKT_qty'],
280
+				'TKT_uses' => empty($tkt['TKT_uses']) ? INF : $tkt['TKT_uses'],
281
+				'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
282
+				'TKT_max' => empty($tkt['TKT_max']) ? INF : $tkt['TKT_max'],
283 283
 				'TKT_row' => $row,
284
-				'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : 0,
285
-				'TKT_taxable' => !empty( $tkt['TKT_taxable'] ) ? 1 : 0,
286
-				'TKT_required' => !empty( $tkt['TKT_required'] ) ? 1 : 0,
284
+				'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0,
285
+				'TKT_taxable' => ! empty($tkt['TKT_taxable']) ? 1 : 0,
286
+				'TKT_required' => ! empty($tkt['TKT_required']) ? 1 : 0,
287 287
 				'TKT_price' => $ticket_price
288 288
 				);
289 289
 
290 290
 
291 291
 
292 292
 			//if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
293
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
293
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
294 294
 				$TKT_values['TKT_ID'] = 0;
295 295
 				$TKT_values['TKT_is_default'] = 0;
296 296
 				$update_prices = TRUE;
@@ -300,25 +300,25 @@  discard block
 block discarded – undo
300 300
 			//we actually do our saves ahead of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified.
301 301
 			//keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
302 302
 
303
-			if ( !empty( $TKT_values['TKT_ID'] ) ) {
304
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $timezone ) )->get_one_by_ID( $tkt['TKT_ID'] );
303
+			if ( ! empty($TKT_values['TKT_ID'])) {
304
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']);
305 305
 
306
-				$ticket_sold = $TKT->count_related('Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false;
306
+				$ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false;
307 307
 
308 308
 				//let's just check the total price for the existing ticket and determine if it matches the new total price.  if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket.
309 309
 				$orig_price = $TKT->price();
310
-				$create_new_TKT = $ticket_sold && $ticket_price != $orig_price && !$TKT->get('TKT_deleted') ? TRUE : FALSE;
310
+				$create_new_TKT = $ticket_sold && $ticket_price != $orig_price && ! $TKT->get('TKT_deleted') ? TRUE : FALSE;
311 311
 
312 312
 				//set new values
313
-				foreach ( $TKT_values as $field => $value ) {
314
-					$TKT->set( $field, $value );
313
+				foreach ($TKT_values as $field => $value) {
314
+					$TKT->set($field, $value);
315 315
 				}
316 316
 
317 317
 				//make sure price is set if it hasn't been already
318
-				$TKT->set( 'TKT_price', $ticket_price );
318
+				$TKT->set('TKT_price', $ticket_price);
319 319
 
320 320
 				//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
321
-				if ( $create_new_TKT ) {
321
+				if ($create_new_TKT) {
322 322
 					//@TODO need to move this logic into its own method that just receives the ticket object (and other necessary info)
323 323
 					$new_tkt = clone($TKT);
324 324
 
@@ -328,26 +328,26 @@  discard block
 block discarded – undo
328 328
 					//TKT will get archived later b/c we are NOT adding it to the saved_tickets array.
329 329
 
330 330
 					//if existing $TKT has sold amount, then we need to adjust the qty for the new TKT to = the remaining available.
331
-					if ( $TKT->get('TKT_sold') > 0 ) {
331
+					if ($TKT->get('TKT_sold') > 0) {
332 332
 						$new_qty = $TKT->get('TKT_qty') - $TKT->get('TKT_sold');
333 333
 						$new_tkt->set_qty($new_qty);
334 334
 					}
335 335
 
336 336
 
337 337
 					//create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it.
338
-					$new_tkt->set( 'TKT_ID', 0 );
339
-					$new_tkt->set( 'TKT_deleted', 0 );
340
-					$new_tkt->set( 'TKT_price', $ticket_price );
341
-					$new_tkt->set( 'TKT_sold', 0 );
338
+					$new_tkt->set('TKT_ID', 0);
339
+					$new_tkt->set('TKT_deleted', 0);
340
+					$new_tkt->set('TKT_price', $ticket_price);
341
+					$new_tkt->set('TKT_sold', 0);
342 342
 
343 343
 					//now we update the prices just for this ticket
344
-					$new_tkt = $this->_add_prices_to_ticket( $price_rows, $new_tkt, TRUE );
344
+					$new_tkt = $this->_add_prices_to_ticket($price_rows, $new_tkt, TRUE);
345 345
 
346 346
 					//and we update the base price
347
-					$new_tkt =  $this->_add_prices_to_ticket( array(), $new_tkt, TRUE, $base_price, $base_price_id );
347
+					$new_tkt = $this->_add_prices_to_ticket(array(), $new_tkt, TRUE, $base_price, $base_price_id);
348 348
 
349
-					foreach ( $dtts_on_existing as $adddtt ) {
350
-						$new_tkt->_add_relation_to( $adddtt, 'Datetime' );
349
+					foreach ($dtts_on_existing as $adddtt) {
350
+						$new_tkt->_add_relation_to($adddtt, 'Datetime');
351 351
 					}
352 352
 
353 353
 				}
@@ -355,38 +355,38 @@  discard block
 block discarded – undo
355 355
 			} else {
356 356
 				//no TKT_id so a new TKT
357 357
 				$TKT_values['TKT_price'] = $ticket_price;
358
-				$TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values, $timezone ), FALSE, FALSE );
358
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values, $timezone), FALSE, FALSE);
359 359
 				$update_prices = TRUE;
360 360
 			}
361 361
 
362 362
 			$TKT->save(); //make sure any current values have been saved.
363 363
 
364 364
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
365
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
366
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
365
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
366
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
367 367
 				EE_Registry::instance()->load_helper('DTT_Helper');
368 368
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
369 369
 			}
370 370
 
371 371
 			//let's make sure the base price is handled
372
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT;
372
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, $base_price_id) : $TKT;
373 373
 
374 374
 			//add/update price_modifiers
375
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( $price_rows, $TKT, $update_prices ) : $TKT;
375
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT;
376 376
 
377 377
 			//need to make sue that the TKT_price is accurate after saving the prices.
378 378
 			$TKT->ensure_TKT_Price_correct();
379 379
 
380 380
 
381 381
 			//handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave.
382
-			if ( ! defined('DOING_AUTOSAVE' ) ) {
383
-				if ( !empty($tkt['TKT_is_default_selector'] ) ) {
382
+			if ( ! defined('DOING_AUTOSAVE')) {
383
+				if ( ! empty($tkt['TKT_is_default_selector'])) {
384 384
 					$update_prices = TRUE;
385 385
 					$new_default = clone $TKT;
386
-					$new_default->set( 'TKT_ID', 0 );
387
-					$new_default->set( 'TKT_is_default', 1 );
388
-					$new_default->set( 'TKT_row', 1 );
389
-					$new_default->set( 'TKT_price', $ticket_price );
386
+					$new_default->set('TKT_ID', 0);
387
+					$new_default->set('TKT_is_default', 1);
388
+					$new_default->set('TKT_row', 1);
389
+					$new_default->set('TKT_price', $ticket_price);
390 390
 					//remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object)
391 391
 					$new_default->_remove_relations('Datetime');
392 392
 					$new_default->save();
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 					$new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices);
395 395
 
396 396
 					//don't forget the base price!
397
-					$new_default = $this->_add_prices_to_ticket( array(), $new_default, $update_prices, $base_price, $base_price_id );
397
+					$new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, $base_price_id);
398 398
 				}
399 399
 			}
400 400
 
@@ -402,42 +402,42 @@  discard block
 block discarded – undo
402 402
 
403 403
 
404 404
 			//first let's do the add_relation_to()
405
-			$dtts_added = empty( $dtts_added ) || ( is_array( $dtts_added ) && ( isset( $dtts_added[0] ) && $dtts_added[0] == '' ) ) ? array() : $dtts_added;
405
+			$dtts_added = empty($dtts_added) || (is_array($dtts_added) && (isset($dtts_added[0]) && $dtts_added[0] == '')) ? array() : $dtts_added;
406 406
 
407
-			foreach ( $dtts_added as $dttrow ) {
407
+			foreach ($dtts_added as $dttrow) {
408 408
 				$dttrow = (int) $dttrow;
409 409
 				$TKT->_add_relation_to($saved_dtts[$dttrow], 'Datetime');
410 410
 
411 411
 				//now wait a minute.  Does this tkt have any sold?  Cause if it does then we need to add that to the DTT sold because this DTT is getting added.
412
-				if ( $TKT->get('TKT_sold') > 0 ) {
413
-					$saved_dtts[$dttrow]->increase_sold($TKT->get('TKT_sold') );
412
+				if ($TKT->get('TKT_sold') > 0) {
413
+					$saved_dtts[$dttrow]->increase_sold($TKT->get('TKT_sold'));
414 414
 					$saved_dtts[$dttrow]->save();
415 415
 				}
416 416
 
417 417
 				//if we have a new_tkt... let's add to it as well
418
-				if ( !empty( $new_tkt ) )
419
-					$new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime' );
418
+				if ( ! empty($new_tkt))
419
+					$new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime');
420 420
 			}
421 421
 
422 422
 
423
-			$dtts_removed = empty( $dtts_removed ) || ( is_array( $dtts_removed ) && isset( $dtts_removed[0] ) && $dtts_removed[0] == '' ) ? array() : $dtts_removed;
423
+			$dtts_removed = empty($dtts_removed) || (is_array($dtts_removed) && isset($dtts_removed[0]) && $dtts_removed[0] == '') ? array() : $dtts_removed;
424 424
 
425 425
 			//now let's do the remove_relation_to()
426
-			foreach ( $dtts_removed as $dttrow ) {
426
+			foreach ($dtts_removed as $dttrow) {
427 427
 				$dttrow = (int) $dttrow;
428 428
 				//its entirely possible that a datetime got deleted (instead of just removed from relationship.  So make sure we skip over this if the dtt isn't in the saved_dtts array)
429
-				if ( empty($saved_dtts[$dttrow] ) || ! $saved_dtts[$dttrow] instanceof EE_Datetime )
429
+				if (empty($saved_dtts[$dttrow]) || ! $saved_dtts[$dttrow] instanceof EE_Datetime)
430 430
 					continue;
431 431
 
432 432
 				$TKT->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
433 433
 
434 434
 				//now wait a minute.  Does this tkt have any sold? Cause if it does then we need to remove it's sold from the DTT_sold.
435
-				if ( $TKT->get('TKT_sold') > 0 ) {
436
-					$saved_dtts[$dttrow]->decrease_sold($TKT->get('TKT_sold') );
435
+				if ($TKT->get('TKT_sold') > 0) {
436
+					$saved_dtts[$dttrow]->decrease_sold($TKT->get('TKT_sold'));
437 437
 					$saved_dtts[$dttrow]->save();
438 438
 				}
439 439
 
440
-				if ( !empty( $new_tkt ) )
440
+				if ( ! empty($new_tkt))
441 441
 					$new_tkt->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
442 442
 			}
443 443
 
@@ -448,43 +448,43 @@  discard block
 block discarded – undo
448 448
 			//let's assign any tickets that have been setup to the saved_tickets tracker
449 449
 			//save existing TKT
450 450
 			$TKT->save();
451
-			if ( $create_new_TKT ) {
451
+			if ($create_new_TKT) {
452 452
 				//save new TKT
453 453
 				$new_tkt->save();
454 454
 				//add new ticket to array
455 455
 				$saved_tickets[$new_tkt->ID()] = $new_tkt;
456 456
 
457
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data );
457
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data);
458 458
 
459 459
 			} else {
460 460
 				//add tkt to saved tkts
461 461
 				//save existing TKT
462 462
 				$saved_tickets[$TKT->ID()] = $TKT;
463 463
 
464
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data );
464
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data);
465 465
 			}
466 466
 
467 467
 		}
468 468
 
469 469
 		//now we need to handle tickets actually "deleted permanently".  There are cases where we'd want this to happen (i.e. autosaves are happening and then in between autosaves the user trashes a ticket).  Or a draft event was saved and in the process of editing a ticket is trashed.  No sense in keeping all the related data in the db!
470
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
471
-		$tickets_removed = array_diff( $old_tickets, array_keys($saved_tickets) );
470
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
471
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
472 472
 		/*var_dump($old_tickets);
473 473
 		var_dump($saved_tickets);
474 474
 		var_dump($tickets_removed);*/
475 475
 
476
-		foreach ( $tickets_removed as $id ) {
477
-			$id = absint( $id );
476
+		foreach ($tickets_removed as $id) {
477
+			$id = absint($id);
478 478
 
479 479
 			//get the ticket for this id
480 480
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
481 481
 
482 482
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
483
-			if ( $tkt_to_remove->get('TKT_is_default') )
483
+			if ($tkt_to_remove->get('TKT_is_default'))
484 484
 				continue;
485 485
 
486 486
 			//if this tkt has any registrations attached so then we just ARCHIVE because we don't actually permanently delete these tickets.
487
-			if ( $tkt_to_remove->count_related('Registration') > 0 ) {
487
+			if ($tkt_to_remove->count_related('Registration') > 0) {
488 488
 				$tkt_to_remove->delete();
489 489
 				continue;
490 490
 			}
@@ -492,14 +492,14 @@  discard block
 block discarded – undo
492 492
 			//need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold)
493 493
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
494 494
 
495
-			foreach( $dtts as $dtt ) {
495
+			foreach ($dtts as $dtt) {
496 496
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
497 497
 			}
498 498
 
499 499
 			//need to do the same for prices (except these prices can also be deleted because again, tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
500 500
 			$tkt_to_remove->delete_related_permanently('Price');
501 501
 
502
-			do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove );
502
+			do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove);
503 503
 
504 504
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
505 505
 			$tkt_to_remove->delete_permanently();
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 	 * @param int|bool 		$base_price_id  if present then this is the base_price_id being updated.
523 523
 	 * @return  void
524 524
 	 */
525
-	private function  _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) {
525
+	private function  _add_prices_to_ticket($prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE) {
526 526
 
527 527
 		//let's just get any current prices that may exist on the given ticket so we can remove any prices that got trashed in this session.
528 528
 		$current_prices_on_ticket = $base_price !== FALSE ? $ticket->base_price(TRUE) : $ticket->price_modifiers();
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 		$updated_prices = array();
531 531
 
532 532
 		// if $base_price ! FALSE then updating a base price.
533
-		if ( $base_price !== FALSE ) {
533
+		if ($base_price !== FALSE) {
534 534
 			$prices[1] = array(
535 535
 				'PRC_ID' => $new_prices || $base_price_id === 1 ? NULL : $base_price_id,
536 536
 				'PRT_ID' => 1,
@@ -541,47 +541,47 @@  discard block
 block discarded – undo
541 541
 		}
542 542
 
543 543
 		//possibly need to save tkt
544
-		if ( ! $ticket->ID() )
544
+		if ( ! $ticket->ID())
545 545
 			$ticket->save();
546 546
 
547
-		foreach ( $prices as $row => $prc ) {
548
-			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
549
-			if ( empty($prt_id) )
547
+		foreach ($prices as $row => $prc) {
548
+			$prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL;
549
+			if (empty($prt_id))
550 550
 				continue; //prices MUST have a price type id.
551 551
 			$PRC_values = array(
552
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
552
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
553 553
 				'PRT_ID' => $prt_id,
554
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
555
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
556
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
554
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
555
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
556
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
557 557
 				'PRC_is_default' => 0, //make sure we set PRC_is_default to 0 for all ticket saves from event_editor
558 558
 				'PRC_order' => $row
559 559
 				);
560
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
560
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
561 561
 				$PRC_values['PRC_ID'] = 0;
562
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
562
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
563 563
 			} else {
564
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
564
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
565 565
 				//update this price with new values
566
-				foreach ( $PRC_values as $field => $newprc ) {
567
-					$PRC->set( $field, $newprc );
566
+				foreach ($PRC_values as $field => $newprc) {
567
+					$PRC->set($field, $newprc);
568 568
 				}
569 569
 			}
570 570
 			$PRC->save();
571 571
 			$prcid = $PRC->ID();
572 572
 			$updated_prices[$prcid] = $PRC;
573
-			$ticket->_add_relation_to( $PRC, 'Price' );
573
+			$ticket->_add_relation_to($PRC, 'Price');
574 574
 		}
575 575
 
576 576
 		//now let's remove any prices that got removed from the ticket
577
-		if ( !empty ( $current_prices_on_ticket ) ) {
577
+		if ( ! empty ($current_prices_on_ticket)) {
578 578
 			$current = array_keys($current_prices_on_ticket);
579 579
 			$updated = array_keys($updated_prices);
580 580
 			$prices_to_remove = array_diff($current, $updated);
581
-			if ( !empty( $prices_to_remove ) ) {
582
-				foreach ( $prices_to_remove as $prc_id ) {
581
+			if ( ! empty($prices_to_remove)) {
582
+				foreach ($prices_to_remove as $prc_id) {
583 583
 					$p = $current_prices_on_ticket[$prc_id];
584
-					$ticket->_remove_relation_to( $p, 'Price' );
584
+					$ticket->_remove_relation_to($p, 'Price');
585 585
 
586 586
 					//delete permanently the price
587 587
 					$p->delete_permanently();
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 
595 595
 
596 596
 
597
-	public function autosave_handling( $event_admin_obj ) {
597
+	public function autosave_handling($event_admin_obj) {
598 598
 		return $event_admin_obj; //doing nothing for the moment.
599 599
 		//todo when I get to this remember that I need to set the template args on the $event_admin_obj (use the set_template_args() method)
600 600
 
@@ -628,12 +628,12 @@  discard block
 block discarded – undo
628 628
 
629 629
 		//default main template args
630 630
 		$main_template_args = array(
631
-			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
631
+			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
632 632
 			'existing_datetime_ids' => '',
633 633
 			'total_dtt_rows' => 1,
634
-			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
634
+			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
635 635
 			'datetime_rows' => '',
636
-			'show_tickets_container' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
636
+			'show_tickets_container' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
637 637
 			'ticket_rows' => '',
638 638
 			'existing_ticket_ids' => '',
639 639
 			'total_ticket_rows' => 1,
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 
644 644
 		$timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : NULL;
645 645
 
646
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
646
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
647 647
 
648 648
 		/**
649 649
 		 * 1. Start with retrieving Datetimes
@@ -651,25 +651,25 @@  discard block
 block discarded – undo
651 651
 		 * 3. For each ticket get related prices
652 652
 		 */
653 653
 
654
-		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) );
655
-		$times = $DTM->get_all_event_dates( $evtID );
654
+		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone));
655
+		$times = $DTM->get_all_event_dates($evtID);
656 656
 
657 657
 
658 658
 
659 659
 		$main_template_args['total_dtt_rows'] = count($times);
660
-		foreach ( $times as $time ) {
660
+		foreach ($times as $time) {
661 661
 			$dttid = $time->get('DTT_ID');
662 662
 			$dttrow = $time->get('DTT_order');
663 663
 			$existing_datetime_ids[] = $dttid;
664 664
 
665 665
 			//tickets attached
666
-			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array( array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC' ) ) ) : array();
666
+			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array(array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC'))) : array();
667 667
 
668 668
 			//if there are no related tickets this is likely a new event OR autodraft
669 669
 			// event so we need to generate the default tickets because dtts
670 670
 			// ALWAYS have at least one related ticket!!.  EXCEPT, we dont' do this if there is already more than one
671 671
 			// datetime on the event.
672
-			if ( empty ( $related_tickets ) && count( $times ) < 2 ) {
672
+			if (empty ($related_tickets) && count($times) < 2) {
673 673
 				$related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
674 674
 			}
675 675
 
@@ -678,11 +678,11 @@  discard block
 block discarded – undo
678 678
 
679 679
 			//loop through and setup the ticket rows and make sure the order is set.
680 680
 			$order = 0;
681
-			foreach ( $related_tickets as $ticket ) {
681
+			foreach ($related_tickets as $ticket) {
682 682
 				$tktid = $ticket->get('TKT_ID');
683 683
 				$tktrow = $ticket->get('TKT_row');
684 684
 				//we only want unique tickets in our final display!!
685
-				if ( !in_array( $tktid, $existing_ticket_ids ) ) {
685
+				if ( ! in_array($tktid, $existing_ticket_ids)) {
686 686
 					$existing_ticket_ids[] = $tktid;
687 687
 					$all_tickets[] = $ticket;
688 688
 				}
@@ -691,89 +691,89 @@  discard block
 block discarded – undo
691 691
 				$datetime_tickets[$dttid][] = $tktrow;
692 692
 
693 693
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
694
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
694
+				if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid]))
695 695
 					$ticket_datetimes[$tktid][] = $dttrow;
696 696
 			}
697 697
 		}
698 698
 
699
-		$main_template_args['total_ticket_rows'] = count( $existing_ticket_ids );
700
-		$main_template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids );
701
-		$main_template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids );
699
+		$main_template_args['total_ticket_rows'] = count($existing_ticket_ids);
700
+		$main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
701
+		$main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
702 702
 
703 703
 		//sort $all_tickets by order
704
-		usort( $all_tickets, function( $a, $b ) {
704
+		usort($all_tickets, function($a, $b) {
705 705
 			$a_order = (int) $a->get('TKT_order');
706 706
 			$b_order = (int) $b->get('TKT_order');
707
-			if ( $a_order == $b_order ) {
707
+			if ($a_order == $b_order) {
708 708
 				return 0;
709 709
 			}
710
-			return ( $a_order < $b_order ) ? -1 : 1;
710
+			return ($a_order < $b_order) ? -1 : 1;
711 711
 		});
712 712
 
713 713
 		//k NOW we have all the data we need for setting up the dtt rows and ticket rows so we start our dtt loop again.
714 714
 		$dttrow = 1;
715
-		foreach ( $times as $time ) {
716
-			$main_template_args['datetime_rows'] .= $this->_get_datetime_row( $dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times );
715
+		foreach ($times as $time) {
716
+			$main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times);
717 717
 			$dttrow++;
718 718
 		}
719 719
 
720 720
 		//then loop through all tickets for the ticket rows.
721 721
 		$tktrow = 1;
722
-		foreach ( $all_tickets as $ticket ) {
723
-			$main_template_args['ticket_rows'] .= $this->_get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets );
722
+		foreach ($all_tickets as $ticket) {
723
+			$main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets);
724 724
 			$tktrow++;
725 725
 		}
726 726
 
727 727
 		$main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets);
728
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php';
729
-		EEH_Template::display_template( $template, $main_template_args );
728
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php';
729
+		EEH_Template::display_template($template, $main_template_args);
730 730
 		return;
731 731
 	}
732 732
 
733 733
 
734 734
 
735
-	private function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
735
+	private function _get_datetime_row($dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array()) {
736 736
 
737 737
 		$dtt_display_template_args = array(
738
-			'dtt_edit_row' => $this->_get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ),
739
-			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ),
738
+			'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts),
739
+			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default),
740 740
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow
741 741
 			);
742
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php';
743
-		return EEH_Template::display_template( $template, $dtt_display_template_args, TRUE);
742
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php';
743
+		return EEH_Template::display_template($template, $dtt_display_template_args, TRUE);
744 744
 	}
745 745
 
746 746
 
747 747
 
748
-	private function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) {
748
+	private function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) {
749 749
 
750 750
 		$template_args = array(
751 751
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
752 752
 			'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes',
753
-			'edit_dtt_expanded' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
753
+			'edit_dtt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
754 754
 			'DTT_ID' => $default ? '' : $dtt->ID(),
755 755
 			'DTT_name' => $default ? '' : $dtt->name(),
756 756
 			'DTT_description' => $default ? '' : $dtt->description(),
757
-			'DTT_EVT_start' => $default ? '' : $dtt->start_date( 'Y-m-d h:i a'),
758
-			'DTT_EVT_end' => $default ? '' : $dtt->end_date( 'Y-m-d h:i a'),
759
-			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit','input'),
757
+			'DTT_EVT_start' => $default ? '' : $dtt->start_date('Y-m-d h:i a'),
758
+			'DTT_EVT_end' => $default ? '' : $dtt->end_date('Y-m-d h:i a'),
759
+			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'),
760 760
 			'DTT_order' => $default ? 'DTTNUM' : $dttrow,
761 761
 			'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'),
762
-			'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
763
-			'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0  ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
762
+			'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
763
+			'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
764 764
 			);
765 765
 
766
-		$template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
766
+		$template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
767 767
 
768 768
 		//allow filtering of template args at this point.
769
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event );
769
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event);
770 770
 
771
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php';
772
-		return EEH_Template::display_template( $template, $template_args, TRUE );
771
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php';
772
+		return EEH_Template::display_template($template, $template_args, TRUE);
773 773
 	}
774 774
 
775 775
 
776
-	private function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
776
+	private function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) {
777 777
 
778 778
 		$template_args = array(
779 779
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
@@ -781,61 +781,61 @@  discard block
 block discarded – undo
781 781
 			'DTT_description' => $default ? '' : $dtt->description(),
782 782
 			'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '',
783 783
 			'show_tickets_row' => ' style="display:none;"', //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '',
784
-			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
784
+			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
785 785
 			'DTT_ID' => $default ? '' : $dtt->ID()
786 786
 			);
787 787
 
788 788
 		//need to setup the list items (but only if this isnt' a default skeleton setup)
789
-		if ( !$default ) {
789
+		if ( ! $default) {
790 790
 			$tktrow = 1;
791
-			foreach ( $all_tickets as $ticket ) {
792
-				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default );
791
+			foreach ($all_tickets as $ticket) {
792
+				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default);
793 793
 				$tktrow++;
794 794
 			}
795 795
 		}
796 796
 
797 797
 		//filter template args at this point
798
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event );
798
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event);
799 799
 
800
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php';
801
-		return EEH_Template::display_template( $template, $template_args, TRUE );
800
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php';
801
+		return EEH_Template::display_template($template, $template_args, TRUE);
802 802
 	}
803 803
 
804 804
 
805 805
 
806
-	private function _get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ) {
807
-		$tktid = !empty( $ticket ) ? $ticket->ID() : 0;
808
-		$dtt_tkts = $dtt instanceof EE_Datetime && isset( $datetime_tickets[$dtt->ID()] ) ? $datetime_tickets[$dtt->ID()] : array();
806
+	private function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) {
807
+		$tktid = ! empty($ticket) ? $ticket->ID() : 0;
808
+		$dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array();
809 809
 
810
-		$displayrow = !empty( $ticket ) ? $ticket->get('TKT_row') : 0;
810
+		$displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0;
811 811
 		$template_args = array(
812 812
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
813
-			'tkt_row' => $default && empty( $ticket ) ? 'TICKETNUM' : $tktrow,
813
+			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
814 814
 			'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '',
815 815
 			'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '',
816
-			'TKT_name' => $default && empty( $ticket ) ? 'TKTNAME' : $ticket->get('TKT_name'),
817
-			'tkt_status_class' => ( $default && empty( $ticket ) ) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(),
816
+			'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'),
817
+			'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(),
818 818
 			);
819 819
 
820 820
 		//filter template args
821
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event );
821
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event);
822 822
 
823
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php';
824
-		return EEH_Template::display_template( $template, $template_args, TRUE );
823
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php';
824
+		return EEH_Template::display_template($template, $template_args, TRUE);
825 825
 	}
826 826
 
827 827
 
828 828
 
829 829
 
830
-	private function _get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array() ) {
831
-		$prices = !empty($ticket) && !$default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC') ) ) : array();
830
+	private function _get_ticket_row($tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array()) {
831
+		$prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array();
832 832
 
833 833
 		// check if we're dealing with a default ticket in which case we don't want any starting_ticket_datetime_row values set (otherwise there won't be any new relationships created for tickets based off of the default ticket).  This will future proof in case there is ever any behaviour change between what the primary_key defaults to.
834
-		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default') ) ? TRUE : FALSE;
834
+		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? TRUE : FALSE;
835 835
 
836
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
836
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
837 837
 
838
-		$ticket_subtotal = !empty( $ticket ) ? $ticket->get_ticket_subtotal() : 0;
838
+		$ticket_subtotal = ! empty($ticket) ? $ticket->get_ticket_subtotal() : 0;
839 839
 		$base_price = $ticket instanceof EE_Ticket ? $ticket->base_price() : NULL;
840 840
 		$count_price_mods = EEM_Price::instance()->get_all_default_prices(TRUE);
841 841
 
@@ -843,24 +843,24 @@  discard block
 block discarded – undo
843 843
 		$template_args = array(
844 844
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
845 845
 			'TKT_order' => $default ? 'TICKETNUM' : $tktrow, //on initial page load this will always be the correct order.
846
-			'tkt_status_class' => $default ? ' tkt-status-' . EE_Ticket::onsale : $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(),
846
+			'tkt_status_class' => $default ? ' tkt-status-'.EE_Ticket::onsale : $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(),
847 847
 			'display_edit_tkt_row' => ' style="display:none;"', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 || $default ? ' style="display:none"' : '',
848 848
 			'edit_tkt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
849 849
 			'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets',
850 850
 			'TKT_name' => $default ? '' : $ticket->get('TKT_name'),
851 851
 			'TKT_start_date' => $ticket instanceof EE_Ticket ? $ticket->get_date('TKT_start_date', 'Y-m-d h:i a') : '',
852
-			'TKT_end_date' => $ticket instanceof EE_Ticket ? $ticket->get_date('TKT_end_date', 'Y-m-d h:i a' ) : '',
853
-			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
852
+			'TKT_end_date' => $ticket instanceof EE_Ticket ? $ticket->get_date('TKT_end_date', 'Y-m-d h:i a') : '',
853
+			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
854 854
 			'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), FALSE, FALSE),
855 855
 			'TKT_price_code' => EE_Registry::instance()->CFG->currency->code,
856 856
 			'TKT_price_amount' => $default ? 0 : $ticket_subtotal,
857
-			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty','symbol'),
858
-			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty','input'),
859
-			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses','input'),
860
-			'TKT_min' => $default ? '' : ( $ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min') ),
861
-			'TKT_max' => $default ? '' :  $ticket->get_pretty('TKT_max','input'),
857
+			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'),
858
+			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty', 'input'),
859
+			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'),
860
+			'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')),
861
+			'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'),
862 862
 			'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'),
863
-			'TKT_registrations' => $default ? 0 : $ticket->count_registrations( array( array( 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ) ) ),
863
+			'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array(array('STS_ID' => array('!=', EEM_Registration::status_id_incomplete)))),
864 864
 			'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'),
865 865
 			'TKT_description' => $default ? '' : $ticket->get('TKT_description'),
866 866
 			'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'),
@@ -869,99 +869,99 @@  discard block
 block discarded – undo
869 869
 			'ticket_price_rows' => '',
870 870
 			'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', 'localized_float'),
871 871
 			'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(),
872
-			'show_price_modifier' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) ? '' : ' style="display:none;"',
873
-			'show_price_mod_button' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) || ( !$default && $ticket->get('TKT_deleted') ) ? ' style="display:none;"' : '',
872
+			'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"',
873
+			'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '',
874 874
 			'total_price_rows' => count($prices) > 1 ? count($prices) : 1,
875 875
 			'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '',
876 876
 			'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts),
877 877
 			'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts),
878
-			'existing_ticket_price_ids' => $default, '', implode(',', array_keys( $prices) ),
878
+			'existing_ticket_price_ids' => $default, '', implode(',', array_keys($prices)),
879 879
 			'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'),
880
-			'TKT_taxable' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? ' checked="checked"' : '',
881
-			'display_subtotal' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none"',
880
+			'TKT_taxable' => ! empty($ticket) && $ticket->get('TKT_taxable') ? ' checked="checked"' : '',
881
+			'display_subtotal' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none"',
882 882
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
883
-			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE ),
883
+			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE),
884 884
 			'TKT_subtotal_amount' => $ticket_subtotal,
885
-			'tax_rows' => $this->_get_tax_rows( $tktrow, $ticket ),
886
-			'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE: FALSE,
887
-			'ticket_archive_class' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? ' ticket-archived' : '',
888
-			'trash_icon' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable',
889
-			'clone_icon' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable'
885
+			'tax_rows' => $this->_get_tax_rows($tktrow, $ticket),
886
+			'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE,
887
+			'ticket_archive_class' => ! empty($ticket) && $ticket->get('TKT_deleted') ? ' ticket-archived' : '',
888
+			'trash_icon' => ! empty($ticket) && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable',
889
+			'clone_icon' => ! empty($ticket) && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable'
890 890
 			);
891 891
 
892
-		$template_args['trash_hidden'] = count( $all_tickets ) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
892
+		$template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
893 893
 
894 894
 		//handle rows that should NOT be empty
895
-		if ( empty( $template_args['TKT_start_date'] ) ) {
895
+		if (empty($template_args['TKT_start_date'])) {
896 896
 			//if empty then the start date will be now.
897 897
 			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
898
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
898
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
899 899
 		}
900 900
 
901
-		if ( empty( $template_args['TKT_end_date'] ) ) {
901
+		if (empty($template_args['TKT_end_date'])) {
902 902
 
903 903
 			//get the earliest datetime (if present);
904
-			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
904
+			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
905 905
 
906
-			if ( !empty( $earliest_dtt ) ) {
906
+			if ( ! empty($earliest_dtt)) {
907 907
 				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
908 908
 			} else {
909 909
 				//default so let's just use what's been set for the default date-time which is 30 days from now.
910
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(24, 0, 0, date("m"), date("d") + 29, date("Y") )  );
910
+				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(24, 0, 0, date("m"), date("d") + 29, date("Y")));
911 911
 			}
912
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
912
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
913 913
 		}
914 914
 
915 915
 		//generate ticket_datetime items
916
-		if ( ! $default ) {
916
+		if ( ! $default) {
917 917
 			$dttrow = 1;
918
-			foreach ( $all_dtts as $dtt ) {
919
-				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default );
918
+			foreach ($all_dtts as $dtt) {
919
+				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default);
920 920
 				$dttrow++;
921 921
 			}
922 922
 		}
923 923
 
924 924
 		$prcrow = 1;
925
-		foreach ( $prices as $price ) {
926
-			if ( $price->is_base_price() ) {
925
+		foreach ($prices as $price) {
926
+			if ($price->is_base_price()) {
927 927
 				$prcrow++;
928 928
 				continue;
929 929
 			}
930
-			$show_trash = ( count( $prices ) > 1 && $prcrow === 1 ) || count( $prices ) === 1  ? FALSE : TRUE;
931
-			$show_create = count( $prices ) > 1 && count( $prices ) !== $prcrow ? FALSE : TRUE;
932
-			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create );
930
+			$show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? FALSE : TRUE;
931
+			$show_create = count($prices) > 1 && count($prices) !== $prcrow ? FALSE : TRUE;
932
+			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create);
933 933
 			$prcrow++;
934 934
 		}
935 935
 
936 936
 		//filter $template_args
937
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event );
937
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event);
938 938
 
939
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php';
940
-		return EEH_Template::display_template( $template, $template_args, TRUE );
939
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php';
940
+		return EEH_Template::display_template($template, $template_args, TRUE);
941 941
 	}
942 942
 
943 943
 
944 944
 
945 945
 
946 946
 
947
-	private function _get_tax_rows( $tktrow, $ticket ) {
947
+	private function _get_tax_rows($tktrow, $ticket) {
948 948
 		$tax_rows = '';
949
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
949
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php';
950 950
 		$template_args = array();
951
-		$taxes = empty( $ticket ) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
952
-		foreach ( $taxes as $tax ) {
953
-			$tax_added = $this->_get_tax_added( $tax, $ticket );
951
+		$taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
952
+		foreach ($taxes as $tax) {
953
+			$tax_added = $this->_get_tax_added($tax, $ticket);
954 954
 			$template_args = array(
955
-				'display_tax' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
955
+				'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
956 956
 				'tax_id' => $tax->ID(),
957 957
 				'tkt_row' => $tktrow,
958 958
 				'tax_label' => $tax->get('PRC_name'),
959 959
 				'tax_added' => $tax_added,
960
-				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE ),
960
+				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE),
961 961
 				'tax_amount' => $tax->get('PRC_amount')
962 962
 				);
963
-			$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event  );
964
-			$tax_rows .= EEH_Template::display_template( $template, $template_args, TRUE );
963
+			$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event);
964
+			$tax_rows .= EEH_Template::display_template($template, $template_args, TRUE);
965 965
 		}
966 966
 
967 967
 
@@ -969,81 +969,81 @@  discard block
 block discarded – undo
969 969
 	}
970 970
 
971 971
 
972
-	private function _get_tax_added( EE_Price $tax, $ticket ) {
973
-		$subtotal = empty( $ticket ) ? 0 : $ticket->get_ticket_subtotal();
972
+	private function _get_tax_added(EE_Price $tax, $ticket) {
973
+		$subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal();
974 974
 		return $subtotal * $tax->get('PRC_amount') / 100;
975 975
 	}
976 976
 
977 977
 
978 978
 
979 979
 
980
-	private function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
981
-		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
980
+	private function _get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE) {
981
+		$send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
982 982
 		$template_args = array(
983 983
 			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
984 984
 			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
985 985
 			'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices',
986
-			'price_type_selector' => $default && empty( $price ) ? $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ) : $this->_get_price_type_selector( $tktrow, $prcrow, $price, $default, $send_disabled ),
986
+			'price_type_selector' => $default && empty($price) ? $this->_get_base_price_template($tktrow, $prcrow, $price, $default) : $this->_get_price_type_selector($tktrow, $prcrow, $price, $default, $send_disabled),
987 987
 			'PRC_ID' => $default && empty($price) ? 0 : $price->ID(),
988 988
 			'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'),
989 989
 			'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'),
990 990
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
991 991
 			'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"',
992
-			'show_plus' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
993
-			'show_minus' => $default && empty( $price ) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
994
-			'show_currency_symbol' => $default && empty( $price ) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : '' ),
995
-			'PRC_amount' => $default && empty( $price ) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
996
-			'show_percentage' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_percent() ? '' : ' style="display:none;"' ),
992
+			'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
993
+			'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
994
+			'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''),
995
+			'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
996
+			'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'),
997 997
 			'show_trash_icon' => $show_trash ? '' : ' style="display:none;"',
998 998
 			'show_create_button' => $show_create ? '' : ' style="display:none;"',
999
-			'PRC_desc' => $default && empty( $price ) ? '' : $price->get('PRC_desc'),
1000
-			'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE
999
+			'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'),
1000
+			'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1001 1001
 			);
1002 1002
 
1003
-	$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event );
1003
+	$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event);
1004 1004
 
1005
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php';
1006
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1005
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php';
1006
+		return EEH_Template::display_template($template, $template_args, TRUE);
1007 1007
 	}
1008 1008
 
1009 1009
 
1010
-	private function _get_price_type_selector( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1011
-		if ( $price->is_base_price() ) {
1012
-			return $this->_get_base_price_template( $tktrow, $prcrow, $price, $default );
1010
+	private function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1011
+		if ($price->is_base_price()) {
1012
+			return $this->_get_base_price_template($tktrow, $prcrow, $price, $default);
1013 1013
 		} else {
1014
-			return $this->_get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled );
1014
+			return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled);
1015 1015
 		}
1016 1016
 
1017 1017
 	}
1018 1018
 
1019 1019
 
1020
-	private function _get_base_price_template( $tktrow, $prcrow, $price, $default ) {
1020
+	private function _get_base_price_template($tktrow, $prcrow, $price, $default) {
1021 1021
 		$template_args = array(
1022 1022
 				'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1023
-				'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1024
-				'PRT_ID' => $default && empty( $price ) ? 1 : $price->get('PRT_ID'),
1023
+				'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1024
+				'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'),
1025 1025
 				'PRT_name' => __('Price', 'event_espresso'),
1026 1026
 				'price_selected_operator' => '+',
1027 1027
 				'price_selected_is_percent' => 0
1028 1028
 			);
1029
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php';
1029
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php';
1030 1030
 
1031
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event );
1031
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event);
1032 1032
 
1033
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1033
+		return EEH_Template::display_template($template, $template_args, TRUE);
1034 1034
 	}
1035 1035
 
1036 1036
 
1037 1037
 
1038
-	private function _get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1039
-		$select_name = $default && empty( $price ) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]';
1040
-		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3' ) ) ) );
1041
-		$price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php';
1042
-		$all_price_types = $default && empty( $price ) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso')) ) : array();
1043
-		$selected_price_type_id = $default && empty( $price ) ? 0 : $price->type();
1038
+	private function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1039
+		$select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]';
1040
+		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array(array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3'))));
1041
+		$price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php';
1042
+		$all_price_types = $default && empty($price) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso'))) : array();
1043
+		$selected_price_type_id = $default && empty($price) ? 0 : $price->type();
1044 1044
 		$price_option_spans = '';
1045 1045
 		//setup pricetypes for selector
1046
-		foreach ( $price_types as $price_type ) {
1046
+		foreach ($price_types as $price_type) {
1047 1047
 			$all_price_types[] = array(
1048 1048
 				'id' => $price_type->ID(),
1049 1049
 				'text' => $price_type->get('PRT_name'),
@@ -1055,50 +1055,50 @@  discard block
 block discarded – undo
1055 1055
 				'PRT_operator' => $price_type->is_discount() ? '-' : '+',
1056 1056
 				'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0
1057 1057
 				);
1058
-			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE );
1058
+			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE);
1059 1059
 		}
1060 1060
 
1061
-		$select_params = $disabled ? 'style="width:auto;" disabled'  : 'style="width:auto;"';
1061
+		$select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"';
1062 1062
 		$main_name = $select_name;
1063
-		$select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name;
1063
+		$select_name = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name;
1064 1064
 
1065 1065
 		$template_args = array(
1066 1066
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1067
-			'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1068
-			'price_modifier_selector' => EEH_Form_Fields::select_input( $select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID' ),
1067
+			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1068
+			'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID'),
1069 1069
 			'main_name' => $main_name,
1070 1070
 			'selected_price_type_id' => $selected_price_type_id,
1071 1071
 			'price_option_spans' => $price_option_spans,
1072
-			'price_selected_operator' => $default && empty( $price ) ? '' : ( $price->is_discount() ? '-' : '+' ),
1073
-			'price_selected_is_percent' => $default && empty( $price ) ? '' : ( $price->is_percent() ? 1 : 0 ),
1072
+			'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'),
1073
+			'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0),
1074 1074
 			'disabled' => $disabled
1075 1075
 			);
1076 1076
 
1077
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event );
1077
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event);
1078 1078
 
1079
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php';
1079
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php';
1080 1080
 
1081
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1081
+		return EEH_Template::display_template($template, $template_args, TRUE);
1082 1082
 	}
1083 1083
 
1084 1084
 
1085 1085
 
1086
-	private function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1087
-		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1088
-		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
1089
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1086
+	private function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) {
1087
+		$dttid = ! empty($dtt) ? $dtt->ID() : 0;
1088
+		$displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0;
1089
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1090 1090
 		$template_args = array(
1091
-			'dtt_row' => $default && empty( $dtt ) ? 'DTTNUM' : $dttrow,
1091
+			'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow,
1092 1092
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1093
-			'ticket_datetime_selected' => in_array( $displayrow, $tkt_dtts ) ? ' ticket-selected' : '',
1094
-			'ticket_datetime_checked' => in_array( $displayrow, $tkt_dtts ) ? ' checked="checked"' : '',
1095
-			'DTT_name' => $default && empty( $dtt ) ? 'DTTNAME' : $dtt->get_dtt_display_name( TRUE ),
1093
+			'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '',
1094
+			'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '',
1095
+			'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(TRUE),
1096 1096
 			'tkt_status_class' => '',
1097 1097
 			);
1098 1098
 
1099
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event );
1100
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1101
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1099
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event);
1100
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1101
+		return EEH_Template::display_template($template, $template_args, TRUE);
1102 1102
 	}
1103 1103
 
1104 1104
 
@@ -1106,53 +1106,53 @@  discard block
 block discarded – undo
1106 1106
 	private function _get_ticket_js_structure($all_dtts, $all_tickets) {
1107 1107
 		$template_args = array(
1108 1108
 			'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', NULL, TRUE, $all_dtts),
1109
-			'default_ticket_row' => $this->_get_ticket_row( 'TICKETNUM', NULL, array(), array(), TRUE),
1110
-			'default_price_row' => $this->_get_ticket_price_row( 'TICKETNUM', 'PRICENUM', NULL, TRUE, NULL ),
1109
+			'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', NULL, array(), array(), TRUE),
1110
+			'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', NULL, TRUE, NULL),
1111 1111
 			'default_price_rows' => '',
1112 1112
 			'default_base_price_amount' => 0,
1113 1113
 			'default_base_price_name' => '',
1114 1114
 			'default_base_price_description' => '',
1115
-			'default_price_modifier_selector_row' => $this->_get_price_modifier_template( 'TICKETNUM', 'PRICENUM', NULL, TRUE ),
1116
-			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row( 'DTTNUM', NULL, array(), array(), TRUE ),
1115
+			'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', NULL, TRUE),
1116
+			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', NULL, array(), array(), TRUE),
1117 1117
 			'existing_available_datetime_tickets_list' => '',
1118 1118
 			'existing_available_ticket_datetimes_list' => '',
1119
-			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ),
1120
-			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE )
1119
+			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE),
1120
+			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE)
1121 1121
 			);
1122 1122
 
1123 1123
 		$tktrow = 1;
1124
-		foreach ( $all_tickets as $ticket ) {
1125
-			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( 'DTTNUM', $tktrow, NULL, $ticket, array(), TRUE );
1124
+		foreach ($all_tickets as $ticket) {
1125
+			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', $tktrow, NULL, $ticket, array(), TRUE);
1126 1126
 			$tktrow++;
1127 1127
 		}
1128 1128
 
1129 1129
 
1130 1130
 		$dttrow = 1;
1131
-		foreach ( $all_dtts as $dtt ) {
1132
-			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE );
1131
+		foreach ($all_dtts as $dtt) {
1132
+			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE);
1133 1133
 			$dttrow++;
1134 1134
 		}
1135 1135
 
1136 1136
 		$default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices();
1137 1137
 		$prcrow = 1;
1138
-		foreach ( $default_prices as $price ) {
1139
-			if ( $price->is_base_price() ) {
1138
+		foreach ($default_prices as $price) {
1139
+			if ($price->is_base_price()) {
1140 1140
 				$template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float');
1141 1141
 				$template_args['default_base_price_name'] = $price->get('PRC_name');
1142 1142
 				$template_args['default_base_price_description'] = $price->get('PRC_desc');
1143 1143
 				$prcrow++;
1144 1144
 				continue;
1145 1145
 			}
1146
-			$show_trash = ( count( $default_prices ) > 1 && $prcrow === 1 ) || count( $default_prices ) === 1  ? FALSE : TRUE;
1147
-			$show_create = count( $default_prices ) > 1 && count( $default_prices ) !== $prcrow ? FALSE : TRUE;
1148
-			$template_args['default_price_rows'] .= $this->_get_ticket_price_row( 'TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create );
1146
+			$show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? FALSE : TRUE;
1147
+			$show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? FALSE : TRUE;
1148
+			$template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create);
1149 1149
 			$prcrow++;
1150 1150
 		}
1151 1151
 
1152
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event );
1152
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event);
1153 1153
 
1154
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php';
1155
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1154
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php';
1155
+		return EEH_Template::display_template($template, $template_args, TRUE);
1156 1156
 	}
1157 1157
 
1158 1158
 
Please login to merge, or discard this patch.