Completed
Branch old/BUG-7514-7935-7936-price-o... (518ae6)
by
unknown
02:21
created
admin_pages/maintenance/templates/ee_migration_was_borked_page.template.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 ?>
4
-<h1><?php _e("Data Migration Error", "event_espresso");?></h1>
5
-<p class='error'><?php printf(__("Your last data migration had a %s FATAL ERROR, and CANNOT be continued%s.", "event_espresso"),"<b>","</b>");?></p>
6
-<a id="show-hide-migration-warnings" class="display-the-hidden"><?php _e("Show Errors", 'event_espresso');?></a>
4
+<h1><?php _e("Data Migration Error", "event_espresso"); ?></h1>
5
+<p class='error'><?php printf(__("Your last data migration had a %s FATAL ERROR, and CANNOT be continued%s.", "event_espresso"), "<b>", "</b>"); ?></p>
6
+<a id="show-hide-migration-warnings" class="display-the-hidden"><?php _e("Show Errors", 'event_espresso'); ?></a>
7 7
 <ul class="migration-warnings" style="display:none">
8
-<?php foreach($most_recent_migration->get_errors() as $error){ ?>
8
+<?php foreach ($most_recent_migration->get_errors() as $error) { ?>
9 9
 	<li><?php echo $error ?></li>
10 10
 <?php }?>
11 11
 </ul>
12
-<h2><?php _e("Fill out the below form to automatically Send Event Espresso a Crash Report", "event_espresso");?></h2>
13
-<form action='<?php echo EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_migration_crash_report'), EE_MAINTENANCE_ADMIN_URL);?>' method='post'>
12
+<h2><?php _e("Fill out the below form to automatically Send Event Espresso a Crash Report", "event_espresso"); ?></h2>
13
+<form action='<?php echo EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_migration_crash_report'), EE_MAINTENANCE_ADMIN_URL); ?>' method='post'>
14 14
 	<table class='widefat'>
15
-		<tr><td><label for='from'><?php _e("From/Reply-To:", "event_espresso");?></label></td><td><input name='from' id='from' type='text' style="width:200px"value='<?php echo get_bloginfo('admin_email','display'); ?>'></td></tr>
16
-		<tr><td><label for='from_name'><?php _e("Your Name", "event_espresso");?></label></td><td><input name='from_name' id='from_name' type='text' style="width:200px"value='<?php printf(__("Admin of %s", "event_espresso"),get_bloginfo('name','display'));?>'></td></tr>
17
-		<tr><td><label for='body'><?php _e("Comments", "event_espresso");?></label></td><td><textarea name="body" id="body" class='system_status_info'><?php _e("Enter any comments about why you think the error may have occurred", "event_espresso");?></textarea>
18
-			<p class='description'><?php _e("Note: the System Information report will also be added to the email's body, which contains information about your Event Espresso, Wordpress, and PHP settings which can be helpful in debugging the problem.", "event_espresso");?></p></td></tr>
19
-		<tr><td colspan="2"><input type="submit" value="<?php _e("Mail Crash Report to Event Espresso", "event_espresso");?>"/></td></tr>
15
+		<tr><td><label for='from'><?php _e("From/Reply-To:", "event_espresso"); ?></label></td><td><input name='from' id='from' type='text' style="width:200px"value='<?php echo get_bloginfo('admin_email', 'display'); ?>'></td></tr>
16
+		<tr><td><label for='from_name'><?php _e("Your Name", "event_espresso"); ?></label></td><td><input name='from_name' id='from_name' type='text' style="width:200px"value='<?php printf(__("Admin of %s", "event_espresso"), get_bloginfo('name', 'display')); ?>'></td></tr>
17
+		<tr><td><label for='body'><?php _e("Comments", "event_espresso"); ?></label></td><td><textarea name="body" id="body" class='system_status_info'><?php _e("Enter any comments about why you think the error may have occurred", "event_espresso"); ?></textarea>
18
+			<p class='description'><?php _e("Note: the System Information report will also be added to the email's body, which contains information about your Event Espresso, Wordpress, and PHP settings which can be helpful in debugging the problem.", "event_espresso"); ?></p></td></tr>
19
+		<tr><td colspan="2"><input type="submit" value="<?php _e("Mail Crash Report to Event Espresso", "event_espresso"); ?>"/></td></tr>
20 20
 	</table>
21 21
 </form>
22 22
 <br>
23
-<p><?php printf(__('...or copy-and-paste the below information to %1$s %2$s %3$s', "event_espresso"),'<a href="mailto:'.EE_SUPPORT_EMAIL.'">',EE_SUPPORT_EMAIL,"</a>");?></p>
24
-<textarea class="system_status_info"><?php print_r( EEM_System_Status::instance()->get_system_stati())?></textarea>
25
-<p><?php printf( __( '%1$sNext Step%2$s', 'event_espresso' ), "<a href='$next_url'>","</a>");?></p>
26
-<p><?php printf( __( '...or %1$sDON\'T send migration crash report%2$s.', 'event_espresso' ), "<a href='$next_url'>","</a>");?></p>
23
+<p><?php printf(__('...or copy-and-paste the below information to %1$s %2$s %3$s', "event_espresso"), '<a href="mailto:'.EE_SUPPORT_EMAIL.'">', EE_SUPPORT_EMAIL, "</a>"); ?></p>
24
+<textarea class="system_status_info"><?php print_r(EEM_System_Status::instance()->get_system_stati())?></textarea>
25
+<p><?php printf(__('%1$sNext Step%2$s', 'event_espresso'), "<a href='$next_url'>", "</a>"); ?></p>
26
+<p><?php printf(__('...or %1$sDON\'T send migration crash report%2$s.', 'event_espresso'), "<a href='$next_url'>", "</a>"); ?></p>
Please login to merge, or discard this patch.
admin_pages/maintenance/templates/ee_system_stati_page.template.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 
8 8
 function ee_resurse_into_array($data) {
9 9
 	if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {//is_object($incomplete_class) actually returns false, hence why we check for it
10
-		$data = (array)$data;
10
+		$data = (array) $data;
11 11
 	}
12 12
 	if (is_array($data)) {
13 13
 		if (EEH_Array::is_associative_array($data)) {
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
 						?>
20 20
 						<tr>
21 21
 							<td>
22
-								<?php echo $data_key;?>
22
+								<?php echo $data_key; ?>
23 23
 							</td>
24 24
 							<td>
25
-								<?php ee_resurse_into_array($data_values);?>
25
+								<?php ee_resurse_into_array($data_values); ?>
26 26
 							</td>
27 27
 						</tr>
28 28
 						<?php
@@ -36,22 +36,22 @@  discard block
 block discarded – undo
36 36
 			<ul>
37 37
 				<?php
38 38
 				foreach ($data as $datum) {
39
-					echo "<li>";ee_resurse_into_array($datum);echo "</li>";
39
+					echo "<li>"; ee_resurse_into_array($datum); echo "</li>";
40 40
 				}?>
41 41
 			</ul>
42 42
 			<?php
43 43
 		}
44
-	}else {
44
+	} else {
45 45
 		//simple value
46 46
 		echo $data;
47 47
 	}
48 48
 }
49 49
 ?>
50 50
 <h1>
51
-	<?php _e("System Information", "event_espresso");?>
51
+	<?php _e("System Information", "event_espresso"); ?>
52 52
 </h1>
53 53
 <div class="padding">
54
-	<h3 class="espresso-header"><?php _e("Raw System Data", "event_espresso");?></h3>
54
+	<h3 class="espresso-header"><?php _e("Raw System Data", "event_espresso"); ?></h3>
55 55
 	<textarea class="system_status_info">
56 56
 		<?php print_r($system_stati)?>
57 57
 	</textarea>
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		<?php
60 60
 		foreach ($system_stati as $status_category_slug => $data) {
61 61
 			if (is_object($data)) {
62
-				$data = (array)$data;
62
+				$data = (array) $data;
63 63
 			}
64 64
 			?>
65 65
 			<thead>
Please login to merge, or discard this patch.
Braces   +3 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@  discard block
 block discarded – undo
30 30
 				</tbody>
31 31
 			</table>
32 32
 			<?php
33
-		}
34
-		else {
33
+		} else {
35 34
 			?>
36 35
 			<ul>
37 36
 				<?php
@@ -41,7 +40,7 @@  discard block
 block discarded – undo
41 40
 			</ul>
42 41
 			<?php
43 42
 		}
44
-	}else {
43
+	} else {
45 44
 		//simple value
46 45
 		echo $data;
47 46
 	}
@@ -86,8 +85,7 @@  discard block
 block discarded – undo
86 85
 				}?>
87 86
 			</tbody>
88 87
 			<?php
89
-			}
90
-			else {
88
+			} else {
91 89
 				?>
92 90
 				<tbody>
93 91
 					<tr>
Please login to merge, or discard this patch.
maintenance/templates/ee_upgrade_addons_before_migrating.template.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 ?>
4
-<h1><?php _e("You must upgrade your Event Espresso Add-ons before Migrating", "event_espresso");?></h1>
5
-<p><?php printf(__("Please %s visit the plugins page%s and upgade all Event Espresso before migrating.", "event_espresso"), "<a href='".admin_url('/plugins.php')."'>","</a>");?></p>
6
-<p><?php _e("You can also deactivate the addons, but all of their data will be lost when your database is migrated", "event_espresso");?></p>
7 4
\ No newline at end of file
5
+<h1><?php _e("You must upgrade your Event Espresso Add-ons before Migrating", "event_espresso"); ?></h1>
6
+<p><?php printf(__("Please %s visit the plugins page%s and upgade all Event Espresso before migrating.", "event_espresso"), "<a href='".admin_url('/plugins.php')."'>", "</a>"); ?></p>
7
+<p><?php _e("You can also deactivate the addons, but all of their data will be lost when your database is migrated", "event_espresso"); ?></p>
8 8
\ No newline at end of file
Please login to merge, or discard this patch.
admin_pages/messages/Messages_Admin_Page.core.php 3 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 
191 191
 	/**
192 192
 	 * 		an array for storing key => value pairs of request actions and their corresponding methods
193
-	*		@access protected
194
-	*		@return void
195
-	*/
193
+	 *		@access protected
194
+	 *		@return void
195
+	 */
196 196
 	protected function _set_page_routes() {
197 197
 		$grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
198 198
 		$grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $grp_id;
@@ -379,18 +379,18 @@  discard block
 block discarded – undo
379 379
 							'title' => __('Message Template Editor', 'event_espresso'),
380 380
 							'callback' => 'edit_message_template_help_tab'
381 381
 							),
382
-                        'message_templates_help_tab' => array(
383
-                            'title' => __('Message Templates', 'event_espresso'),
384
-                            'filename' => 'messages_templates'
385
-                            ),
382
+						'message_templates_help_tab' => array(
383
+							'title' => __('Message Templates', 'event_espresso'),
384
+							'filename' => 'messages_templates'
385
+							),
386 386
 						'message_template_shortcodes' => array(
387 387
 							'title' => __('Message Shortcodes', 'event_espresso'),
388 388
 							'callback' => 'message_template_shortcodes_help_tab'
389 389
 							),
390
-                        'message_preview_help_tab' => array(
391
-                            'title' => __('Message Preview', 'event_espresso'),
392
-                            'filename' => 'messages_preview'
393
-                            ),
390
+						'message_preview_help_tab' => array(
391
+							'title' => __('Message Preview', 'event_espresso'),
392
+							'filename' => 'messages_preview'
393
+							),
394 394
 					),
395 395
 				'require_nonce' => FALSE
396 396
 				),
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 					'order' => 20
416 416
 					),
417 417
 				'metaboxes' => array('_messages_settings_metaboxes'),
418
-                'help_tabs' => array(
418
+				'help_tabs' => array(
419 419
 						'messages_settings_help_tab' => array(
420 420
 							'title' => __('Messages Settings', 'event_espresso'),
421 421
 							'filename' => 'messages_settings'
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 							'title' => __('Activating / Deactivating Messengers', 'event_espresso'),
429 429
 							'filename' => 'messages_settings_messengers'
430 430
 							),
431
-                    ),
431
+					),
432 432
 				'help_tour' => array( 'Messages_Settings_Help_Tour' ),
433 433
 				'require_nonce' => FALSE
434 434
 				)
@@ -2106,9 +2106,9 @@  discard block
 block discarded – undo
2106 2106
 
2107 2107
 	/**
2108 2108
 	 * 	_learn_more_about_message_templates_link
2109
-	*	@access protected
2110
-	*	@return string
2111
-	*/
2109
+	 *	@access protected
2110
+	 *	@return string
2111
+	 */
2112 2112
 	protected function _learn_more_about_message_templates_link() {
2113 2113
 		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>';
2114 2114
 	}
Please login to merge, or discard this patch.
Braces   +54 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,5 +1,6 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
1
+<?php if (!defined('EVENT_ESPRESSO_VERSION') ) {
2 2
 	exit('NO direct script access allowed');
3
+}
3 4
 
4 5
 /**
5 6
  * Event Espresso
@@ -123,8 +124,9 @@  discard block
 block discarded – undo
123 124
 			$ref = str_replace( ' ', '_', $ref );
124 125
 			$classname = 'EE_' . $ref . '_messenger';
125 126
 			require_once( EE_LIBRARIES . 'messages'. DS .'messenger' . DS . $classname . '.class.php' );
126
-			if ( !class_exists($classname) )
127
-				throw new EE_Error( sprintf( __('There is no messenger for the given classname (%s)', 'event_espresso'), $classname ) );
127
+			if ( !class_exists($classname) ) {
128
+							throw new EE_Error( sprintf( __('There is no messenger for the given classname (%s)', 'event_espresso'), $classname ) );
129
+			}
128 130
 
129 131
 			$a = new ReflectionClass( $classname );
130 132
 			$this->_active_messengers[$messenger]['obj'] = $a->newInstance();
@@ -141,14 +143,17 @@  discard block
 block discarded – undo
141 143
 	 * @return void
142 144
 	 */
143 145
 	protected function _load_active_message_type_objects() {
144
-		if ( empty($this->_active_message_types) ) return;
146
+		if ( empty($this->_active_message_types) ) {
147
+			return;
148
+		}
145 149
 		foreach ( $this->_active_message_types as $message_type ) {
146 150
 			$ref = ucwords( str_replace( '_' , ' ', $message_type) );
147 151
 			$ref = str_replace( ' ', '_', $ref );
148 152
 			$classname = 'EE_' . $ref . '_message_type';
149 153
 
150
-			if ( !class_exists($classname) )
151
-				throw new EE_Error( sprintf( __('There is no message type for the given classname (%s)', 'event_espresso'), $classname ) );
154
+			if ( !class_exists($classname) ) {
155
+							throw new EE_Error( sprintf( __('There is no message type for the given classname (%s)', 'event_espresso'), $classname ) );
156
+			}
152 157
 
153 158
 			$a = new ReflectionClass( $classname );
154 159
 			$this->_active_message_types[$message_type]['obj'] = $a->newInstance();
@@ -781,12 +786,14 @@  discard block
 block discarded – undo
781 786
 		$GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID;
782 787
 
783 788
 		//we need messenger and message type.  They should be coming from the event editor. If not here then return error
784
-		if ( empty( $message_type ) || empty( $messenger )  )
785
-			throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));
789
+		if ( empty( $message_type ) || empty( $messenger )  ) {
790
+					throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));
791
+		}
786 792
 
787 793
 		//we need the GRP_ID for the template being used as the base for the new template
788
-		if ( empty( $GRP_ID ) )
789
-			throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) );
794
+		if ( empty( $GRP_ID ) ) {
795
+					throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) );
796
+		}
790 797
 
791 798
 		//let's just make sure the template gets generated!
792 799
 
@@ -902,10 +909,13 @@  discard block
 block discarded – undo
902 909
 							$continue = FALSE;
903 910
 							if ( isset( $extra_array['shortcodes_required'] ) ) {
904 911
 								foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) {
905
-									if ( !array_key_exists( $shortcode, $this->_shortcodes ) )
906
-										$continue = TRUE;
912
+									if ( !array_key_exists( $shortcode, $this->_shortcodes ) ) {
913
+																			$continue = TRUE;
914
+									}
915
+								}
916
+								if ( $continue ) {
917
+									continue;
907 918
 								}
908
-								if ( $continue ) continue;
909 919
 							}
910 920
 
911 921
 							$field_id = $reference_field . '-' . $extra_field . '-content';
@@ -1610,7 +1620,9 @@  discard block
 block discarded – undo
1610 1620
 	protected function _set_shortcodes() {
1611 1621
 
1612 1622
 		//no need to run this if the property is already set
1613
-		if ( !empty($this->_shortcodes ) ) return;
1623
+		if ( !empty($this->_shortcodes ) ) {
1624
+			return;
1625
+		}
1614 1626
 
1615 1627
 		$this->_shortcodes = $this->_get_shortcodes();
1616 1628
 	}
@@ -1647,8 +1659,10 @@  discard block
 block discarded – undo
1647 1659
 	 */
1648 1660
 	protected function _set_message_template_group() {
1649 1661
 
1650
-		if ( !empty( $this->_message_template_group ) )
1651
-			return; //get out if this is already set.
1662
+		if ( !empty( $this->_message_template_group ) ) {
1663
+					return;
1664
+		}
1665
+		//get out if this is already set.
1652 1666
 
1653 1667
 		$GRP_ID =  ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : FALSE;
1654 1668
 		$GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID;
@@ -1656,10 +1670,11 @@  discard block
 block discarded – undo
1656 1670
 		//let's get the message templates
1657 1671
 		$MTP = EEM_Message_Template_Group::instance();
1658 1672
 
1659
-		if ( empty($GRP_ID) )
1660
-			$this->_message_template_group = $MTP->create_default_object();
1661
-		else
1662
-			$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );
1673
+		if ( empty($GRP_ID) ) {
1674
+					$this->_message_template_group = $MTP->create_default_object();
1675
+		} else {
1676
+					$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );
1677
+		}
1663 1678
 
1664 1679
 		$this->_template_pack = $this->_message_template_group->get_template_pack();
1665 1680
 		$this->_variation = $this->_message_template_group->get_template_pack_variation();
@@ -1686,7 +1701,9 @@  discard block
 block discarded – undo
1686 1701
 			<form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm">
1687 1702
 				<?php
1688 1703
 					foreach ( $args as $name => $value ) {
1689
-						if ( $name == 'context' || empty($value) || $name == 'extra' ) continue;
1704
+						if ( $name == 'context' || empty($value) || $name == 'extra' ) {
1705
+							continue;
1706
+						}
1690 1707
 						?>
1691 1708
 						<input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" />
1692 1709
 						<?php
@@ -1819,8 +1836,9 @@  discard block
 block discarded – undo
1819 1836
 
1820 1837
 					//setup notices
1821 1838
 					foreach ( $validates as $field => $error ) {
1822
-						if ( isset($error['msg'] ) )
1823
-							EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ );
1839
+						if ( isset($error['msg'] ) ) {
1840
+													EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ );
1841
+						}
1824 1842
 					}
1825 1843
 
1826 1844
 				} else {
@@ -1966,8 +1984,9 @@  discard block
 block discarded – undo
1966 1984
 	protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = FALSE) {
1967 1985
 
1968 1986
 		//if no $message_types are given then that's okay... this may be a messenger that just adds shortcodes, so we just don't generate any templates.
1969
-		if ( empty( $message_types ) )
1970
-			return true;
1987
+		if ( empty( $message_types ) ) {
1988
+					return true;
1989
+		}
1971 1990
 
1972 1991
 		EE_Registry::instance()->load_helper( 'MSG_Template' );
1973 1992
 
@@ -2087,8 +2106,9 @@  discard block
 block discarded – undo
2087 2106
 		//then delete permanently all the related Message Templates
2088 2107
 		$deleted = $MTG->delete_related_permanently( 'Message_Template' );
2089 2108
 
2090
-		if ( $deleted === 0 )
2091
-			$success = 0;
2109
+		if ( $deleted === 0 ) {
2110
+					$success = 0;
2111
+		}
2092 2112
 
2093 2113
 		//now delete permanently this particular group
2094 2114
 
@@ -2150,8 +2170,9 @@  discard block
 block discarded – undo
2150 2170
 	 */
2151 2171
 	protected function _set_m_mt_settings() {
2152 2172
 		//first if this is already set then lets get out no need to regenerate data.
2153
-		if ( !empty($this->_m_mt_settings) )
2154
-			return;
2173
+		if ( !empty($this->_m_mt_settings) ) {
2174
+					return;
2175
+		}
2155 2176
 
2156 2177
 		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2157 2178
 
@@ -2743,8 +2764,9 @@  discard block
 block discarded – undo
2743 2764
 					case 'message_types' :
2744 2765
 						if ( isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] ) ) {
2745 2766
 							foreach ( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] as $mt => $v ) {
2746
-								if ( isset( $settings['message_types'][$mt] ) )
2747
-									$settings[$messenger . '-message_types'][$mt]['settings'] = isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ? $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] : array();
2767
+								if ( isset( $settings['message_types'][$mt] ) ) {
2768
+																	$settings[$messenger . '-message_types'][$mt]['settings'] = isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ? $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] : array();
2769
+								}
2748 2770
 							}
2749 2771
 						} else {
2750 2772
 							foreach ( $value as $mt => $v ) {
@@ -2761,9 +2783,7 @@  discard block
 block discarded – undo
2761 2783
 				}
2762 2784
 			}
2763 2785
 			$this->_active_messengers[$messenger]['settings'] = $settings;
2764
-		}
2765
-
2766
-		else if ( $this->_req_data['type'] == 'message_type' ) {
2786
+		} else if ( $this->_req_data['type'] == 'message_type' ) {
2767 2787
 			$settings = $this->_req_data['message_type_settings'];
2768 2788
 			$messenger = $settings['messenger'];
2769 2789
 			$message_type = $settings['message_type'];
Please login to merge, or discard this patch.
Spacing   +505 added lines, -505 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION'))
2 2
 	exit('NO direct script access allowed');
3 3
 
4 4
 /**
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 * @access public
74 74
 	 * @return void
75 75
 	 */
76
-	public function __construct( $routing = TRUE ) {
76
+	public function __construct($routing = TRUE) {
77 77
 		//make sure MSG Template helper is loaded.
78 78
 		EE_Registry::instance()->load_helper('MSG_Template');
79 79
 		//make sure messages autoloader is running
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
 
95 95
 		$this->_activate_state = isset($this->_req_data['activate_state']) ? (array) $this->_req_data['activate_state'] : array();
96 96
 
97
-		$this->_active_messenger = isset( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : NULL;
97
+		$this->_active_messenger = isset($this->_req_data['messenger']) ? $this->_req_data['messenger'] : NULL;
98 98
 
99
-		EE_Registry::instance()->load_lib( 'messages' );
99
+		EE_Registry::instance()->load_lib('messages');
100 100
 		//we're also going to set the active messengers and active message types in here.
101 101
 		$this->_active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
102
-		$this->_active_messengers = !empty($this->_active_messengers) ?  $this->_active_messengers : array();
103
-		$this->_active_message_types = !empty($this->_active_messenger) && !empty($this->_active_messengers[$this->_active_messenger]) && ! empty(  $this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger . '-message_types'] ) ? array_keys($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger . '-message_types']) : array();
102
+		$this->_active_messengers = ! empty($this->_active_messengers) ? $this->_active_messengers : array();
103
+		$this->_active_message_types = ! empty($this->_active_messenger) && ! empty($this->_active_messengers[$this->_active_messenger]) && ! empty($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger.'-message_types']) ? array_keys($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger.'-message_types']) : array();
104 104
 
105 105
 
106 106
 		//what about saving the objects in the active_messengers and active_message_types?
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 	 * @return void
119 119
 	 */
120 120
 	protected function _load_active_messenger_objects() {
121
-		foreach ( $this->_active_messengers as $messenger => $values ) {
122
-			$ref = ucwords( str_replace( '_' , ' ', $messenger) );
123
-			$ref = str_replace( ' ', '_', $ref );
124
-			$classname = 'EE_' . $ref . '_messenger';
125
-			require_once( EE_LIBRARIES . 'messages'. DS .'messenger' . DS . $classname . '.class.php' );
126
-			if ( !class_exists($classname) )
127
-				throw new EE_Error( sprintf( __('There is no messenger for the given classname (%s)', 'event_espresso'), $classname ) );
128
-
129
-			$a = new ReflectionClass( $classname );
121
+		foreach ($this->_active_messengers as $messenger => $values) {
122
+			$ref = ucwords(str_replace('_', ' ', $messenger));
123
+			$ref = str_replace(' ', '_', $ref);
124
+			$classname = 'EE_'.$ref.'_messenger';
125
+			require_once(EE_LIBRARIES.'messages'.DS.'messenger'.DS.$classname.'.class.php');
126
+			if ( ! class_exists($classname))
127
+				throw new EE_Error(sprintf(__('There is no messenger for the given classname (%s)', 'event_espresso'), $classname));
128
+
129
+			$a = new ReflectionClass($classname);
130 130
 			$this->_active_messengers[$messenger]['obj'] = $a->newInstance();
131 131
 		}
132 132
 	}
@@ -141,16 +141,16 @@  discard block
 block discarded – undo
141 141
 	 * @return void
142 142
 	 */
143 143
 	protected function _load_active_message_type_objects() {
144
-		if ( empty($this->_active_message_types) ) return;
145
-		foreach ( $this->_active_message_types as $message_type ) {
146
-			$ref = ucwords( str_replace( '_' , ' ', $message_type) );
147
-			$ref = str_replace( ' ', '_', $ref );
148
-			$classname = 'EE_' . $ref . '_message_type';
144
+		if (empty($this->_active_message_types)) return;
145
+		foreach ($this->_active_message_types as $message_type) {
146
+			$ref = ucwords(str_replace('_', ' ', $message_type));
147
+			$ref = str_replace(' ', '_', $ref);
148
+			$classname = 'EE_'.$ref.'_message_type';
149 149
 
150
-			if ( !class_exists($classname) )
151
-				throw new EE_Error( sprintf( __('There is no message type for the given classname (%s)', 'event_espresso'), $classname ) );
150
+			if ( ! class_exists($classname))
151
+				throw new EE_Error(sprintf(__('There is no message type for the given classname (%s)', 'event_espresso'), $classname));
152 152
 
153
-			$a = new ReflectionClass( $classname );
153
+			$a = new ReflectionClass($classname);
154 154
 			$this->_active_message_types[$message_type]['obj'] = $a->newInstance();
155 155
 		}
156 156
 	}
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
 
159 159
 
160 160
 	protected function _ajax_hooks() {
161
-		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle' ) );
162
-		add_action('wp_ajax_activate_mt', array( $this, 'activate_mt_toggle') );
163
-		add_action('wp_ajax_ee_msgs_save_settings', array( $this, 'save_settings') );
164
-		add_action('wp_ajax_ee_msgs_update_mt_form', array( $this, 'update_mt_form' ) );
165
-		add_action('wp_ajax_switch_template_pack', array( $this, 'switch_template_pack' ) );
161
+		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle'));
162
+		add_action('wp_ajax_activate_mt', array($this, 'activate_mt_toggle'));
163
+		add_action('wp_ajax_ee_msgs_save_settings', array($this, 'save_settings'));
164
+		add_action('wp_ajax_ee_msgs_update_mt_form', array($this, 'update_mt_form'));
165
+		add_action('wp_ajax_switch_template_pack', array($this, 'switch_template_pack'));
166 166
 	}
167 167
 
168 168
 
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 	*		@return void
195 195
 	*/
196 196
 	protected function _set_page_routes() {
197
-		$grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
198
-		$grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $grp_id;
197
+		$grp_id = ! empty($this->_req_data['GRP_ID']) && ! is_array($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
198
+		$grp_id = empty($grp_id) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $grp_id;
199 199
 
200 200
 		$this->_page_routes = array(
201 201
 				'default'=> array(
@@ -231,35 +231,35 @@  discard block
 block discarded – undo
231 231
 				'insert_message_template' => array(
232 232
 					'func' => '_insert_or_update_message_template',
233 233
 					'capability' => 'ee_edit_messages',
234
-					'args' => array( 'new_template' => TRUE ),
234
+					'args' => array('new_template' => TRUE),
235 235
 					'noheader' => TRUE
236 236
 					 ),
237 237
 				'update_message_template' => array(
238 238
 					'func' => '_insert_or_update_message_template',
239 239
 					'capability' => 'ee_edit_message',
240 240
 					'obj_id' => $grp_id,
241
-					'args' => array( 'new_template' => FALSE ),
241
+					'args' => array('new_template' => FALSE),
242 242
 					'noheader' => TRUE
243 243
 					),
244 244
 				'trash_message_template' => array(
245 245
 					'func' => '_trash_or_restore_message_template',
246 246
 					'capability' => 'ee_delete_message',
247 247
 					'obj_id' => $grp_id,
248
-					'args' => array( 'trash' => TRUE, 'all' => TRUE ),
248
+					'args' => array('trash' => TRUE, 'all' => TRUE),
249 249
 					'noheader' => TRUE
250 250
 					),
251 251
 				'trash_message_template_context' => array(
252 252
 					'func' => '_trash_or_restore_message_template',
253 253
 					'capability' => 'ee_delete_message',
254 254
 					'obj_id' => $grp_id,
255
-					'args' => array( 'trash' => TRUE ),
255
+					'args' => array('trash' => TRUE),
256 256
 					'noheader' => TRUE
257 257
 					),
258 258
 				'restore_message_template' => array(
259 259
 					'func' => '_trash_or_restore_message_template',
260 260
 					'capability' => 'ee_delete_message',
261 261
 					'obj_id' => $grp_id,
262
-					'args' => array( 'trash' => FALSE, 'all' => TRUE ),
262
+					'args' => array('trash' => FALSE, 'all' => TRUE),
263 263
 					'noheader' => TRUE
264 264
 					),
265 265
 				'restore_message_template_context' => array(
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 						'filename' => 'messages_overview_other',
339 339
 					),
340 340
 				),
341
-				'help_tour' => array( 'Messages_Overview_Help_Tour' ),
341
+				'help_tour' => array('Messages_Overview_Help_Tour'),
342 342
 				'require_nonce' => FALSE
343 343
 				),
344 344
 			'custom_mtps' => array(
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 					),
374 374
 				'metaboxes' => array('_publish_post_box', '_register_edit_meta_boxes'),
375 375
 				'has_metaboxes' => TRUE,
376
-				'help_tour' => array( 'Message_Templates_Edit_Help_Tour' ),
376
+				'help_tour' => array('Message_Templates_Edit_Help_Tour'),
377 377
 				'help_tabs' => array(
378 378
 						'edit_message_template' => array(
379 379
 							'title' => __('Message Template Editor', 'event_espresso'),
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 							'filename' => 'messages_settings_messengers'
430 430
 							),
431 431
                     ),
432
-				'help_tour' => array( 'Messages_Settings_Help_Tour' ),
432
+				'help_tour' => array('Messages_Settings_Help_Tour'),
433 433
 				'require_nonce' => FALSE
434 434
 				)
435 435
 			/*'reports' => array(
@@ -478,43 +478,43 @@  discard block
 block discarded – undo
478 478
 
479 479
 
480 480
 	public function messages_help_tab() {
481
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_help_tab.template.php';
482
-		EEH_Template::display_template( $templatepath, array());
481
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_help_tab.template.php';
482
+		EEH_Template::display_template($templatepath, array());
483 483
 	}
484 484
 
485 485
 
486 486
 	public function messengers_help_tab() {
487
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messenger_help_tab.template.php';
488
-		EEH_Template::display_template( $templatepath, array());
487
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messenger_help_tab.template.php';
488
+		EEH_Template::display_template($templatepath, array());
489 489
 	}
490 490
 
491 491
 
492 492
 	public function message_types_help_tab() {
493
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_type_help_tab.template.php';
494
-		EEH_Template::display_template( $templatepath, array());
493
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_type_help_tab.template.php';
494
+		EEH_Template::display_template($templatepath, array());
495 495
 	}
496 496
 
497 497
 
498 498
 	public function messages_overview_help_tab() {
499
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_overview_help_tab.template.php';
500
-		EEH_Template::display_template( $templatepath, array());
499
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_overview_help_tab.template.php';
500
+		EEH_Template::display_template($templatepath, array());
501 501
 	}
502 502
 
503 503
 
504 504
 	public function message_templates_help_tab() {
505
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_templates_help_tab.template.php';
506
-		EEH_Template::display_template( $templatepath, array());
505
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_templates_help_tab.template.php';
506
+		EEH_Template::display_template($templatepath, array());
507 507
 	}
508 508
 
509 509
 
510 510
 	public function edit_message_template_help_tab() {
511
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_templates_editor_help_tab.template.php';
512
-		$args['img1'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/editor.png' . '" alt="' . esc_attr__('Editor Title', 'event_espresso') . '" />';
513
-		$args['img2'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/switch-context.png' . '" alt="' . esc_attr__('Context Switcher and Preview', 'event_espresso') . '" />';
514
-		$args['img3'] = '<img class="left" src="' . EE_MSG_ASSETS_URL . 'images/form-fields.png' . '" alt="' . esc_attr__('Message Template Form Fields', 'event_espresso') . '" />';
515
-		$args['img4'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/shortcodes-metabox.png' . '" alt="' . esc_attr__('Shortcodes Metabox', 'event_espresso') . '" />';
516
-		$args['img5'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/publish-meta-box.png' . '" alt="' . esc_attr__('Publish Metabox', 'event_espresso') . '" />';
517
-		EEH_Template::display_template( $templatepath, $args);
511
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_templates_editor_help_tab.template.php';
512
+		$args['img1'] = '<img src="'.EE_MSG_ASSETS_URL.'images/editor.png'.'" alt="'.esc_attr__('Editor Title', 'event_espresso').'" />';
513
+		$args['img2'] = '<img src="'.EE_MSG_ASSETS_URL.'images/switch-context.png'.'" alt="'.esc_attr__('Context Switcher and Preview', 'event_espresso').'" />';
514
+		$args['img3'] = '<img class="left" src="'.EE_MSG_ASSETS_URL.'images/form-fields.png'.'" alt="'.esc_attr__('Message Template Form Fields', 'event_espresso').'" />';
515
+		$args['img4'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/shortcodes-metabox.png'.'" alt="'.esc_attr__('Shortcodes Metabox', 'event_espresso').'" />';
516
+		$args['img5'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/publish-meta-box.png'.'" alt="'.esc_attr__('Publish Metabox', 'event_espresso').'" />';
517
+		EEH_Template::display_template($templatepath, $args);
518 518
 	}
519 519
 
520 520
 
@@ -522,25 +522,25 @@  discard block
 block discarded – undo
522 522
 	public function message_template_shortcodes_help_tab() {
523 523
 		$this->_set_shortcodes();
524 524
 		$args['shortcodes'] = $this->_shortcodes;
525
-		$template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_shortcodes_help_tab.template.php';
526
-		EEH_Template::display_template( $template_path, $args );
525
+		$template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_shortcodes_help_tab.template.php';
526
+		EEH_Template::display_template($template_path, $args);
527 527
 	}
528 528
 
529 529
 
530 530
 
531 531
 	public function preview_message_help_tab() {
532
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_preview_help_tab.template.php';
533
-		EEH_Template::display_template( $templatepath, array());
532
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_preview_help_tab.template.php';
533
+		EEH_Template::display_template($templatepath, array());
534 534
 	}
535 535
 
536 536
 
537 537
 	public function settings_help_tab() {
538
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_settings_help_tab.template.php';
539
-		$args['img1'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '" alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />';
540
-		$args['img2'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />';
538
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_settings_help_tab.template.php';
539
+		$args['img1'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'" alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />';
540
+		$args['img2'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'.'" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />';
541 541
 		$args['img3'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked="checked"><label for="ee-on-off-toggle-on"></label>';
542 542
 		$args['img4'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox"><label for="ee-on-off-toggle-on"></label>';
543
-		EEH_Template::display_template( $templatepath, $args);
543
+		EEH_Template::display_template($templatepath, $args);
544 544
 	}
545 545
 
546 546
 
@@ -548,24 +548,24 @@  discard block
 block discarded – undo
548 548
 
549 549
 
550 550
 	public function load_scripts_styles() {
551
-		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL . 'ee_message_admin.css', EVENT_ESPRESSO_VERSION );
551
+		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL.'ee_message_admin.css', EVENT_ESPRESSO_VERSION);
552 552
 		wp_enqueue_style('espresso_ee_msg');
553 553
 
554
-		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL . 'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE );
554
+		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL.'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE);
555 555
 	}
556 556
 
557 557
 
558 558
 
559 559
 
560 560
 
561
-	public function wp_editor_css( $mce_css ) {
561
+	public function wp_editor_css($mce_css) {
562 562
 		//if we're on the edit_message_template route
563
-		if ( $this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger  ) {
563
+		if ($this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger) {
564 564
 			$message_type_name = $this->_active_message_type_name;
565 565
 
566 566
 			//we're going to REPLACE the existing mce css
567 567
 			//we need to get the css file location from the active messenger
568
-			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'wpeditor', $this->_variation );
568
+			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'wpeditor', $this->_variation);
569 569
 		}
570 570
 
571 571
 		return $mce_css;
@@ -577,41 +577,41 @@  discard block
 block discarded – undo
577 577
 	public function load_scripts_styles_edit_message_template() {
578 578
 		;
579 579
 		$this->_set_shortcodes();
580
-		EE_Registry::$i18n_js_strings['confirm_default_reset'] = sprintf( __('Are you sure you want to reset the %s %s message templates?  Remember continuing will reset the templates for all contexts in this messenger and message type group.', 'event_espresso'), $this->_message_template_group->messenger_obj()->label['singular'], $this->_message_template_group->message_type_obj()->label['singular'] );
581
-		EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded.  Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso' );
580
+		EE_Registry::$i18n_js_strings['confirm_default_reset'] = sprintf(__('Are you sure you want to reset the %s %s message templates?  Remember continuing will reset the templates for all contexts in this messenger and message type group.', 'event_espresso'), $this->_message_template_group->messenger_obj()->label['singular'], $this->_message_template_group->message_type_obj()->label['singular']);
581
+		EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded.  Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso');
582 582
 
583 583
 
584
-		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL . 'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION );
584
+		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL.'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION);
585 585
 
586 586
 		wp_enqueue_script('ee_admin_js');
587 587
 		wp_enqueue_script('ee_msgs_edit_js');
588 588
 
589
-		wp_localize_script( 'ee_msgs_edit_js', 'eei18n', EE_Registry::$i18n_js_strings );
589
+		wp_localize_script('ee_msgs_edit_js', 'eei18n', EE_Registry::$i18n_js_strings);
590 590
 
591 591
 		//add in special css for tiny_mce
592
-		add_filter( 'mce_css', array( $this, 'wp_editor_css' ) );
592
+		add_filter('mce_css', array($this, 'wp_editor_css'));
593 593
 	}
594 594
 
595 595
 
596 596
 
597 597
 	public function load_scripts_styles_display_preview_message() {
598 598
 		$this->_set_message_template_group();
599
-		if ( isset( $this->_req_data['messenger'] ) ) {
599
+		if (isset($this->_req_data['messenger'])) {
600 600
 			$this->_active_messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj'];
601 601
 		}
602 602
 
603
-		$message_type_name = isset( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : '';
603
+		$message_type_name = isset($this->_req_data['message_type']) ? $this->_req_data['message_type'] : '';
604 604
 
605 605
 
606
-		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation( $this->_template_pack, $message_type_name, TRUE, 'preview', $this->_variation ) );
606
+		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'preview', $this->_variation));
607 607
 	}
608 608
 
609 609
 
610 610
 
611 611
 	public function load_scripts_styles_settings() {
612
-		wp_register_style( 'ee-message-settings', EE_MSG_ASSETS_URL . 'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION );
613
-		wp_enqueue_style( 'ee-text-links' );
614
-		wp_enqueue_style( 'ee-message-settings' );
612
+		wp_register_style('ee-message-settings', EE_MSG_ASSETS_URL.'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION);
613
+		wp_enqueue_style('ee-text-links');
614
+		wp_enqueue_style('ee-message-settings');
615 615
 
616 616
 		wp_enqueue_script('ee-messages-settings');
617 617
 	}
@@ -647,9 +647,9 @@  discard block
 block discarded – undo
647 647
 
648 648
 	protected function _custom_mtps_preview() {
649 649
 		$this->_admin_page_title = __('Custom Message Templates (Preview)', 'event_espresso');
650
-		$this->_template_args['preview_img'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/custom_mtps_preview.png" alt="' . esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso' ) . '" />';
650
+		$this->_template_args['preview_img'] = '<img src="'.EE_MSG_ASSETS_URL.'images/custom_mtps_preview.png" alt="'.esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso').'" />';
651 651
 		$this->_template_args['preview_text'] = '<strong>'.__('Custom Message Templates is a feature that is only available in the caffeinated version of Event Espresso.  With the Custom Message Templates feature, you are able to create custom templates and set them per event.', 'event_espresso').'</strong>';
652
-		$this->display_admin_caf_preview_page( 'custom_message_types', FALSE );
652
+		$this->display_admin_caf_preview_page('custom_message_types', FALSE);
653 653
 	}
654 654
 
655 655
 
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 	 * @param bool $global whether to return just global (true) or custom templates (false)
672 672
 	 * @return array|WP_Error object
673 673
 	 */
674
-	public function get_message_templates( $perpage = 10, $type = 'in_use', $count = FALSE, $all = FALSE, $global = TRUE ) {
674
+	public function get_message_templates($perpage = 10, $type = 'in_use', $count = FALSE, $all = FALSE, $global = TRUE) {
675 675
 		global $espresso_wp_user;
676 676
 		// start with an empty array
677 677
 		$message_templates = array();
@@ -681,24 +681,24 @@  discard block
 block discarded – undo
681 681
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? 'GRP_ID' : $this->_req_data['orderby'];
682 682
 		$orderby = $this->_req_data['orderby'];
683 683
 
684
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) ) ? $this->_req_data['order'] : 'ASC';
684
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
685 685
 
686
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
687
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $perpage;
686
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
687
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $perpage;
688 688
 
689
-		$offset = ($current_page-1)*$per_page;
690
-		$limit = $all ? NULL : array( $offset, $per_page );
689
+		$offset = ($current_page - 1) * $per_page;
690
+		$limit = $all ? NULL : array($offset, $per_page);
691 691
 
692 692
 
693 693
 		//options will match what is in the _views array property
694
-		switch( $type ) {
694
+		switch ($type) {
695 695
 
696 696
 			case 'in_use':
697
-				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, TRUE );
697
+				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, TRUE);
698 698
 				break;
699 699
 
700 700
 			default:
701
-				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global );
701
+				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global);
702 702
 
703 703
 		}
704 704
 
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 		$imts = $installed_objects['message_types'];
735 735
 		$installed = array();
736 736
 
737
-		foreach ( $imts as $message_type ) {
737
+		foreach ($imts as $message_type) {
738 738
 			$installed[$message_type->name]['obj'] = $message_type;
739 739
 		}
740 740
 
@@ -766,24 +766,24 @@  discard block
 block discarded – undo
766 766
 	 * @access  protected
767 767
 	 * @return void
768 768
 	 */
769
-	protected function _add_message_template(  $message_type = '', $messenger='', $GRP_ID = '' ) {
769
+	protected function _add_message_template($message_type = '', $messenger = '', $GRP_ID = '') {
770 770
 		//set values override any request data
771
-		$message_type = !empty( $message_type ) ? $message_type : '';
772
-		$message_type = empty( $message_type ) && !empty( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : $message_type;
771
+		$message_type = ! empty($message_type) ? $message_type : '';
772
+		$message_type = empty($message_type) && ! empty($this->_req_data['message_type']) ? $this->_req_data['message_type'] : $message_type;
773 773
 
774
-		$messenger = !empty( $messenger ) ? $messenger : '';
775
-		$messenger = empty( $messenger ) && !empty( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : $messenger;
774
+		$messenger = ! empty($messenger) ? $messenger : '';
775
+		$messenger = empty($messenger) && ! empty($this->_req_data['messenger']) ? $this->_req_data['messenger'] : $messenger;
776 776
 
777
-		$GRP_ID = !empty( $GRP_ID ) ? $GRP_ID : '';
778
-		$GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID;
777
+		$GRP_ID = ! empty($GRP_ID) ? $GRP_ID : '';
778
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : $GRP_ID;
779 779
 
780 780
 		//we need messenger and message type.  They should be coming from the event editor. If not here then return error
781
-		if ( empty( $message_type ) || empty( $messenger )  )
781
+		if (empty($message_type) || empty($messenger))
782 782
 			throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));
783 783
 
784 784
 		//we need the GRP_ID for the template being used as the base for the new template
785
-		if ( empty( $GRP_ID ) )
786
-			throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) );
785
+		if (empty($GRP_ID))
786
+			throw new EE_Error(__('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso'));
787 787
 
788 788
 		//let's just make sure the template gets generated!
789 789
 
@@ -802,8 +802,8 @@  discard block
 block discarded – undo
802 802
 	 * @param string $messenger    messenger slug
803 803
 	 * @param int      $GRP_ID         GRP_ID for the related message template group this new template will be based off of.
804 804
 	 */
805
-	public function add_message_template( $message_type, $messenger, $GRP_ID ) {
806
-		$this->_add_message_template( $message_type, $messenger, $GRP_ID );
805
+	public function add_message_template($message_type, $messenger, $GRP_ID) {
806
+		$this->_add_message_template($message_type, $messenger, $GRP_ID);
807 807
 	}
808 808
 
809 809
 
@@ -814,36 +814,36 @@  discard block
 block discarded – undo
814 814
 	 * @return void
815 815
 	 */
816 816
 	protected function _edit_message_template() {
817
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '');
817
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
818 818
 
819 819
 		//we filter the tinyMCE settings to remove the validation since message templates by their nature will not have valid html in the templates.
820
-		add_filter( 'tiny_mce_before_init', array( $this, 'filter_tinymce_init'), 10, 2 );
820
+		add_filter('tiny_mce_before_init', array($this, 'filter_tinymce_init'), 10, 2);
821 821
 
822
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
822
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
823 823
 
824 824
 		$this->_set_shortcodes(); //this also sets the _message_template property.
825 825
 		$message_template_group = $this->_message_template_group;
826 826
 		$c_label = $message_template_group->context_label();
827 827
 		$c_config = $message_template_group->contexts_config();
828 828
 
829
-		reset( $c_config );
830
-		$context = isset( $this->_req_data['context']) && !empty($this->_req_data['context'] ) ? strtolower($this->_req_data['context']) : key($c_config);
829
+		reset($c_config);
830
+		$context = isset($this->_req_data['context']) && ! empty($this->_req_data['context']) ? strtolower($this->_req_data['context']) : key($c_config);
831 831
 
832 832
 
833
-		if ( empty($GRP_ID) ) {
833
+		if (empty($GRP_ID)) {
834 834
 			$action = 'insert_message_template';
835 835
 			$button_both = FALSE;
836
-			$button_text = array( __( 'Save','event_espresso') );
836
+			$button_text = array(__('Save', 'event_espresso'));
837 837
 			$button_actions = array('something_different');
838 838
 			$referrer = FALSE;
839
-			$edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
839
+			$edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => TRUE), EE_MSG_ADMIN_URL);
840 840
 		} else {
841 841
 			$action = 'update_message_template';
842 842
 			$button_both = TRUE;
843 843
 			$button_text = array();
844 844
 			$button_actions = array();
845 845
 			$referrer = $this->_admin_base_url;
846
-			$edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
846
+			$edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => TRUE), EE_MSG_ADMIN_URL);
847 847
 		}
848 848
 
849 849
 		//set active messenger for this view
@@ -853,13 +853,13 @@  discard block
 block discarded – undo
853 853
 
854 854
 		//Do we have any validation errors?
855 855
 		$validators = $this->_get_transient();
856
-		$v_fields = !empty($validators) ? array_keys($validators) : array();
856
+		$v_fields = ! empty($validators) ? array_keys($validators) : array();
857 857
 
858 858
 
859 859
 		//we need to assemble the title from Various details
860
-		$context_label = sprintf( __('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label'] ));
860
+		$context_label = sprintf(__('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label']));
861 861
 
862
-		$title = sprintf( __(' %s %s Template %s', 'event_espresso'), ucwords($message_template_group->messenger_obj()->label['singular']), ucwords($message_template_group->message_type_obj()->label['singular']), $context_label );
862
+		$title = sprintf(__(' %s %s Template %s', 'event_espresso'), ucwords($message_template_group->messenger_obj()->label['singular']), ucwords($message_template_group->message_type_obj()->label['singular']), $context_label);
863 863
 
864 864
 		$this->_template_args['GRP_ID'] = $GRP_ID;
865 865
 		$this->_template_args['message_template'] = $message_template_group;
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 		$MSG = new EE_messages();
871 871
 		$template_field_structure = $MSG->get_fields($message_template_group->messenger(), $message_template_group->message_type());
872 872
 
873
-		if ( !$template_field_structure ) {
873
+		if ( ! $template_field_structure) {
874 874
 			$template_field_structure = FALSE;
875 875
 			$template_fields = __('There was an error in assembling the fields for this display (you should see an error message)', 'event_espresso');
876 876
 		}
@@ -880,38 +880,38 @@  discard block
 block discarded – undo
880 880
 
881 881
 
882 882
 		//if we have the extra key.. then we need to remove the content index from the template_field_structure as it will get handled in the "extra" array.
883
-		if ( is_array($template_field_structure[$context]) && isset( $template_field_structure[$context]['extra']) ) {
884
-			foreach ( $template_field_structure[$context]['extra'] as $reference_field => $new_fields ) {
885
-				unset( $template_field_structure[$context][$reference_field] );
883
+		if (is_array($template_field_structure[$context]) && isset($template_field_structure[$context]['extra'])) {
884
+			foreach ($template_field_structure[$context]['extra'] as $reference_field => $new_fields) {
885
+				unset($template_field_structure[$context][$reference_field]);
886 886
 			}
887 887
 		}
888 888
 
889 889
 		//let's loop through the template_field_structure and actually assemble the input fields!
890
-		if ( !empty($template_field_structure) ) {
891
-			$id_prefix= 'ee-msg-edit-template-fields-';
892
-			foreach ( $template_field_structure[$context] as $template_field => $field_setup_array ) {
890
+		if ( ! empty($template_field_structure)) {
891
+			$id_prefix = 'ee-msg-edit-template-fields-';
892
+			foreach ($template_field_structure[$context] as $template_field => $field_setup_array) {
893 893
 				//if this is an 'extra' template field then we need to remove any existing fields that are keyed up in the extra array and reset them.
894
-				if ( $template_field == 'extra' ) {
894
+				if ($template_field == 'extra') {
895 895
 					$this->_template_args['is_extra_fields'] = TRUE;
896
-					foreach ( $field_setup_array as $reference_field => $new_fields_array ) {
897
-						foreach ( $new_fields_array as $extra_field =>  $extra_array ) {
896
+					foreach ($field_setup_array as $reference_field => $new_fields_array) {
897
+						foreach ($new_fields_array as $extra_field =>  $extra_array) {
898 898
 							//let's verify if we need this extra field via the shortcodes parameter.
899 899
 							$continue = FALSE;
900
-							if ( isset( $extra_array['shortcodes_required'] ) ) {
901
-								foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) {
902
-									if ( !array_key_exists( $shortcode, $this->_shortcodes ) )
900
+							if (isset($extra_array['shortcodes_required'])) {
901
+								foreach ((array) $extra_array['shortcodes_required'] as $shortcode) {
902
+									if ( ! array_key_exists($shortcode, $this->_shortcodes))
903 903
 										$continue = TRUE;
904 904
 								}
905
-								if ( $continue ) continue;
905
+								if ($continue) continue;
906 906
 							}
907 907
 
908
-							$field_id = $reference_field . '-' . $extra_field . '-content';
908
+							$field_id = $reference_field.'-'.$extra_field.'-content';
909 909
 							$template_form_fields[$field_id] = $extra_array;
910
-							$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $reference_field . '][content][' . $extra_field . ']';
911
-							$css_class = isset( $extra_array['css_class'] ) ? $extra_array['css_class'] : '';
912
-							$template_form_fields[$field_id]['css_class'] = !empty( $v_fields ) && in_array($extra_field, $v_fields) && ( is_array($validators[$extra_field] ) && isset( $validators[$extra_field]['msg'] ) ) ? 'validate-error ' . $css_class : $css_class;
910
+							$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$reference_field.'][content]['.$extra_field.']';
911
+							$css_class = isset($extra_array['css_class']) ? $extra_array['css_class'] : '';
912
+							$template_form_fields[$field_id]['css_class'] = ! empty($v_fields) && in_array($extra_field, $v_fields) && (is_array($validators[$extra_field]) && isset($validators[$extra_field]['msg'])) ? 'validate-error '.$css_class : $css_class;
913 913
 							$content = $message_templates[$context][$reference_field]->get('MTP_content');
914
-							$template_form_fields[$field_id]['value'] = !empty($message_templates) && isset($content[$extra_field]) ? stripslashes( html_entity_decode( $content[$extra_field], ENT_QUOTES, "UTF-8") ) : '';
914
+							$template_form_fields[$field_id]['value'] = ! empty($message_templates) && isset($content[$extra_field]) ? stripslashes(html_entity_decode($content[$extra_field], ENT_QUOTES, "UTF-8")) : '';
915 915
 
916 916
 							//do we have a validation error?  if we do then let's use that value instead
917 917
 							$template_form_fields[$field_id]['value'] = isset($validators[$extra_field]) ? $validators[$extra_field]['value'] : $template_form_fields[$field_id]['value'];
@@ -919,30 +919,30 @@  discard block
 block discarded – undo
919 919
 
920 920
 							$template_form_fields[$field_id]['db-col'] = 'MTP_content';
921 921
 
922
-							if ( isset( $extra_array['input'] ) && $extra_array['input'] == 'wp_editor' ) {
922
+							if (isset($extra_array['input']) && $extra_array['input'] == 'wp_editor') {
923 923
 								//we want to decode the entities
924
-								$template_form_fields[$field_id]['value'] = stripslashes( html_entity_decode( $template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8") );
924
+								$template_form_fields[$field_id]['value'] = stripslashes(html_entity_decode($template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8"));
925 925
 
926 926
 							}/**/
927 927
 						}
928
-						$templatefield_MTP_id = $reference_field . '-MTP_ID';
929
-						$templatefield_templatename_id = $reference_field . '-name';
928
+						$templatefield_MTP_id = $reference_field.'-MTP_ID';
929
+						$templatefield_templatename_id = $reference_field.'-name';
930 930
 
931 931
 						$template_form_fields[$templatefield_MTP_id] = array(
932
-							'name' => 'MTP_template_fields[' . $reference_field . '][MTP_ID]',
932
+							'name' => 'MTP_template_fields['.$reference_field.'][MTP_ID]',
933 933
 							'label' => NULL,
934 934
 							'input' => 'hidden',
935 935
 							'type' => 'int',
936 936
 							'required' => FALSE,
937 937
 							'validation' => FALSE,
938
-							'value' => !empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '',
938
+							'value' => ! empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '',
939 939
 							'css_class' => '',
940 940
 							'format' => '%d',
941 941
 							'db-col' => 'MTP_ID'
942 942
 						);
943 943
 
944 944
 						$template_form_fields[$templatefield_templatename_id] = array(
945
-							'name' => 'MTP_template_fields[' . $reference_field . '][name]',
945
+							'name' => 'MTP_template_fields['.$reference_field.'][name]',
946 946
 							'label' => NULL,
947 947
 							'input' => 'hidden',
948 948
 							'type' => 'string',
@@ -956,10 +956,10 @@  discard block
 block discarded – undo
956 956
 					}
957 957
 					continue; //skip the next stuff, we got the necessary fields here for this dataset.
958 958
 				} else {
959
-					$field_id = $template_field . '-content';
959
+					$field_id = $template_field.'-content';
960 960
 					$template_form_fields[$field_id] = $field_setup_array;
961
-					$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $template_field . '][content]';
962
-					$template_form_fields[$field_id]['value'] = !empty($message_templates) && is_array($message_templates[$context]) && isset($message_templates[$context][$template_field]) ?$message_templates[$context][$template_field]->get('MTP_content') : '';
961
+					$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$template_field.'][content]';
962
+					$template_form_fields[$field_id]['value'] = ! empty($message_templates) && is_array($message_templates[$context]) && isset($message_templates[$context][$template_field]) ? $message_templates[$context][$template_field]->get('MTP_content') : '';
963 963
 
964 964
 					//do we have a validator error for this field?  if we do then we'll use that value instead
965 965
 					$template_form_fields[$field_id]['value'] = isset($validators[$template_field]) ? $validators[$template_field]['value'] : $template_form_fields[$field_id]['value'];
@@ -967,9 +967,9 @@  discard block
 block discarded – undo
967 967
 
968 968
 					$template_form_fields[$field_id]['db-col'] = 'MTP_content';
969 969
 					$css_class = isset($field_setup_array['css_class']) ? $field_setup_array['css_class'] : '';
970
-					$template_form_fields[$field_id]['css_class'] = !empty( $v_fields ) && in_array( $template_field, $v_fields ) && isset( $validators[$template_field]['msg'] ) ? 'validate-error ' . $css_class : $css_class;
970
+					$template_form_fields[$field_id]['css_class'] = ! empty($v_fields) && in_array($template_field, $v_fields) && isset($validators[$template_field]['msg']) ? 'validate-error '.$css_class : $css_class;
971 971
 
972
-					if ( isset( $field_setup_array['input'] ) && $field_setup_array['input'] == 'wp_editor' ) {
972
+					if (isset($field_setup_array['input']) && $field_setup_array['input'] == 'wp_editor') {
973 973
 						//we want to decode the entities
974 974
 						$template_form_fields[$field_id]['value'] = $template_form_fields[$field_id]['value'];
975 975
 					}/**/
@@ -977,25 +977,25 @@  discard block
 block discarded – undo
977 977
 
978 978
 				//k took care of content field(s) now let's take care of others.
979 979
 
980
-				$templatefield_MTP_id = $template_field . '-MTP_ID';
981
-				$templatefield_field_templatename_id = $template_field . '-name';
980
+				$templatefield_MTP_id = $template_field.'-MTP_ID';
981
+				$templatefield_field_templatename_id = $template_field.'-name';
982 982
 
983 983
 				//foreach template field there are actually two form fields created
984 984
 				$template_form_fields[$templatefield_MTP_id] = array(
985
-					'name' => 'MTP_template_fields[' . $template_field . '][MTP_ID]',
985
+					'name' => 'MTP_template_fields['.$template_field.'][MTP_ID]',
986 986
 					'label' => NULL,
987 987
 					'input' => 'hidden',
988 988
 					'type' => 'int',
989 989
 					'required' => FALSE,
990 990
 					'validation' => TRUE,
991
-					'value' => !empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '',
991
+					'value' => ! empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '',
992 992
 					'css_class' => '',
993 993
 					'format' => '%d',
994 994
 					'db-col' => 'MTP_ID'
995 995
 				);
996 996
 
997 997
 				$template_form_fields[$templatefield_field_templatename_id] = array(
998
-					'name' => 'MTP_template_fields[' . $template_field . '][name]',
998
+					'name' => 'MTP_template_fields['.$template_field.'][name]',
999 999
 					'label' => NULL,
1000 1000
 					'input' => 'hidden',
1001 1001
 					'type' => 'string',
@@ -1139,15 +1139,15 @@  discard block
 block discarded – undo
1139 1139
 				'value' => $GRP_ID
1140 1140
 				);
1141 1141
 			$sidebar_form_fields['ee-msg-evt-nonce'] = array(
1142
-				'name' => $action . '_nonce',
1142
+				'name' => $action.'_nonce',
1143 1143
 				'input' => 'hidden',
1144 1144
 				'type' => 'string',
1145
-				'value' => wp_create_nonce( $action . '_nonce')
1145
+				'value' => wp_create_nonce($action.'_nonce')
1146 1146
 				);
1147 1147
 
1148 1148
 			$sidebar_array = array('ee-msg-is-global', 'ee-msg-is-override', 'ee-msg-deleted', 'ee-msg-is-active');
1149 1149
 
1150
-			if ( isset($this->_req_data['template_switch']) && $this->_req_data['template_switch'] ) {
1150
+			if (isset($this->_req_data['template_switch']) && $this->_req_data['template_switch']) {
1151 1151
 				$sidebar_form_fields['ee-msg-template-switch'] = array(
1152 1152
 					'name' => 'template_switch',
1153 1153
 					'input' => 'hidden',
@@ -1158,19 +1158,19 @@  discard block
 block discarded – undo
1158 1158
 
1159 1159
 			//send to field generator
1160 1160
 
1161
-			$template_fields = $this->_generate_admin_form_fields( $template_form_fields );
1162
-			$sidebar_fields = $this->_generate_admin_form_fields( $sidebar_form_fields );
1161
+			$template_fields = $this->_generate_admin_form_fields($template_form_fields);
1162
+			$sidebar_fields = $this->_generate_admin_form_fields($sidebar_form_fields);
1163 1163
 
1164 1164
 
1165 1165
 		} //end if ( !empty($template_field_structure) )
1166 1166
 
1167 1167
 		//set extra content for publish box
1168 1168
 		$this->_template_args['publish_box_extra_content'] = $sidebar_fields;
1169
-		$this->_set_publish_post_box_vars( 'id', $GRP_ID );
1169
+		$this->_set_publish_post_box_vars('id', $GRP_ID);
1170 1170
 
1171 1171
 		//add preview button
1172
-		$preview_url = parent::add_query_args_and_nonce( array( 'message_type' => $message_template_group->message_type(), 'messenger' => $message_template_group->messenger(), 'context' => $context,'GRP_ID' => $GRP_ID, 'action' => 'preview_message' ), $this->_admin_base_url );
1173
-		$preview_button = '<a href="' . $preview_url . '" class="button-secondary messages-preview-button">' . __('Preview', 'event_espresso') . '</a>';
1172
+		$preview_url = parent::add_query_args_and_nonce(array('message_type' => $message_template_group->message_type(), 'messenger' => $message_template_group->messenger(), 'context' => $context, 'GRP_ID' => $GRP_ID, 'action' => 'preview_message'), $this->_admin_base_url);
1173
+		$preview_button = '<a href="'.$preview_url.'" class="button-secondary messages-preview-button">'.__('Preview', 'event_espresso').'</a>';
1174 1174
 
1175 1175
 
1176 1176
 		//setup context switcher
@@ -1196,16 +1196,16 @@  discard block
 block discarded – undo
1196 1196
 		$this->_template_args['before_admin_page_content'] .= $this->_add_form_element_before();
1197 1197
 		$this->_template_args['after_admin_page_content'] = $this->_add_form_element_after();
1198 1198
 
1199
-		$this->_template_path = $this->_template_args['GRP_ID'] ? EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_edit_meta_box.template.php' : EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_add_meta_box.template.php';
1199
+		$this->_template_path = $this->_template_args['GRP_ID'] ? EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_edit_meta_box.template.php' : EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_add_meta_box.template.php';
1200 1200
 
1201 1201
 		//send along EE_Message_Template_Group object for further template use.
1202 1202
 		$this->_template_args['MTP'] = $message_template_group;
1203 1203
 
1204
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_template_path, $this->_template_args, TRUE );
1204
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE);
1205 1205
 
1206 1206
 
1207 1207
 		//finally, let's set the admin_page title
1208
-		$this->_admin_page_title = sprintf( __('Editing %s', 'event_espresso'), $title );
1208
+		$this->_admin_page_title = sprintf(__('Editing %s', 'event_espresso'), $title);
1209 1209
 
1210 1210
 
1211 1211
 		//we need to take care of setting the shortcodes property for use elsewhere.
@@ -1218,7 +1218,7 @@  discard block
 block discarded – undo
1218 1218
 	}
1219 1219
 
1220 1220
 
1221
-	public function filter_tinymce_init( $mceInit, $editor_id ) {
1221
+	public function filter_tinymce_init($mceInit, $editor_id) {
1222 1222
 		return $mceInit;
1223 1223
 	}
1224 1224
 
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 	}
1230 1230
 
1231 1231
 	public function _add_form_element_before() {
1232
-		return '<form method="post" action="' . $this->_template_args["edit_message_template_form_url"] . '" id="ee-msg-edit-frm">';
1232
+		return '<form method="post" action="'.$this->_template_args["edit_message_template_form_url"].'" id="ee-msg-edit-frm">';
1233 1233
 	}
1234 1234
 
1235 1235
 	public function _add_form_element_after() {
@@ -1247,32 +1247,32 @@  discard block
 block discarded – undo
1247 1247
 	 * @return json json object
1248 1248
 	 */
1249 1249
 	public function switch_template_pack() {
1250
-		$GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1251
-		$template_pack = ! empty( $this->_req_data['template_pack'] ) ? $this->_req_data['template_pack'] : '';
1250
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1251
+		$template_pack = ! empty($this->_req_data['template_pack']) ? $this->_req_data['template_pack'] : '';
1252 1252
 
1253 1253
 		//verify we have needed values.
1254
-		if ( empty( $GRP_ID ) || empty( $template_pack ) ) {
1254
+		if (empty($GRP_ID) || empty($template_pack)) {
1255 1255
 			$this->_template_args['error'] = TRUE;
1256
-			EE_Error::add_error( __('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  );
1256
+			EE_Error::add_error(__('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1257 1257
 		} else {
1258 1258
 			//get template, set the new template_pack and then reset to default
1259
-			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1259
+			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1260 1260
 
1261
-			$mtpg->set_template_pack_name( $template_pack );
1261
+			$mtpg->set_template_pack_name($template_pack);
1262 1262
 			$this->_req_data['msgr'] = $mtpg->messenger();
1263 1263
 			$this->_req_data['mt'] = $mtpg->message_type();
1264 1264
 
1265 1265
 			$query_args = $this->_reset_to_default_template();
1266 1266
 
1267
-			if ( empty( $query_args['id'] ) ) {
1268
-				EE_Error::add_error( __('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1267
+			if (empty($query_args['id'])) {
1268
+				EE_Error::add_error(__('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1269 1269
 				$this->_template_args['error'] = TRUE;
1270 1270
 			} else {
1271
-				$template_label =$mtpg->get_template_pack()->label;
1271
+				$template_label = $mtpg->get_template_pack()->label;
1272 1272
 				$template_pack_labels = $mtpg->messenger_obj()->get_supports_labels();
1273
-				EE_Error::add_success( sprintf( __('This message template has been successfully switched to use the %s %s.  Please wait while the page reloads with your new template.', 'event_espresso'), $template_label, $template_pack_labels->template_pack ) );
1273
+				EE_Error::add_success(sprintf(__('This message template has been successfully switched to use the %s %s.  Please wait while the page reloads with your new template.', 'event_espresso'), $template_label, $template_pack_labels->template_pack));
1274 1274
 				//generate the redirect url for js.
1275
-				$url = self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1275
+				$url = self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1276 1276
 				$this->_template_args['data']['redirect_url'] = $url;
1277 1277
 				$this->_template_args['success'] = true;
1278 1278
 			}
@@ -1293,56 +1293,56 @@  discard block
 block discarded – undo
1293 1293
 	protected function _reset_to_default_template() {
1294 1294
 		$success = TRUE;
1295 1295
 		$templates = array();
1296
-		$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1296
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1297 1297
 		//we need to make sure we've got the info we need.
1298
-		if ( !isset( $this->_req_data['msgr'] ) && !isset( $this->_req_data['mt'] ) && !isset( $this->_req_data['GRP_ID'] ) ) {
1299
-			EE_Error::add_error( __('In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset.  At least one of these is missing.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1298
+		if ( ! isset($this->_req_data['msgr']) && ! isset($this->_req_data['mt']) && ! isset($this->_req_data['GRP_ID'])) {
1299
+			EE_Error::add_error(__('In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset.  At least one of these is missing.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1300 1300
 			$success = FALSE;
1301 1301
 		}
1302 1302
 
1303 1303
 		//all templates will be reset to whatever the defaults are for the global template matching the messenger and message type.
1304
-		$success = !empty( $GRP_ID ) ? TRUE : FALSE;
1304
+		$success = ! empty($GRP_ID) ? TRUE : FALSE;
1305 1305
 
1306
-		if ( $success ) {
1306
+		if ($success) {
1307 1307
 
1308 1308
 			//let's first determine if the incoming template is a global template, if it isn't then we need to get the global template matching messenger and message type.
1309
-			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1309
+			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1310 1310
 
1311 1311
 
1312 1312
 			//note this is ONLY deleteing the template fields (Message Template rows) NOT the message template group.
1313
-			$success = $this->_delete_mtp_permanently( $GRP_ID, FALSE );
1313
+			$success = $this->_delete_mtp_permanently($GRP_ID, FALSE);
1314 1314
 
1315
-			if ( $success ) {
1315
+			if ($success) {
1316 1316
 				//if successfully deleted, lets generate the new ones.  Note. We set GLOBAL to true, because resets on ANY template will use the related global template defaults for regeneration.  This means that if a custom template is reset it resets to whatever the related global template is.  HOWEVER, we DO keep the template pack and template variation set for the current custom template when resetting.
1317
-				$templates = $this->_generate_new_templates( $this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, TRUE );
1317
+				$templates = $this->_generate_new_templates($this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, TRUE);
1318 1318
 			}
1319 1319
 
1320 1320
 		}
1321 1321
 
1322 1322
 		//any error messages?
1323
-		if ( !$success ) {
1324
-			EE_Error::add_error( __('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1323
+		if ( ! $success) {
1324
+			EE_Error::add_error(__('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1325 1325
 		}
1326 1326
 
1327 1327
 		//all good, let's add a success message!
1328
-		if ( $success && ! empty( $templates ) ) {
1328
+		if ($success && ! empty($templates)) {
1329 1329
 			$templates = $templates[0]; //the info for the template we generated is the first element in the returned array.
1330 1330
 			EE_Error::overwrite_success();
1331
-			EE_Error::add_success( __('Templates have been reset to defaults.', 'event_espresso') );
1331
+			EE_Error::add_success(__('Templates have been reset to defaults.', 'event_espresso'));
1332 1332
 		}
1333 1333
 
1334 1334
 
1335 1335
 		$query_args = array(
1336
-			'id' => isset( $templates['GRP_ID'] ) ? $templates['GRP_ID'] : NULL,
1337
-			'context' => isset( $templates['MTP_context'] ) ? $templates['MTP_context'] : NULL,
1338
-			'action' => isset( $templates['GRP_ID'] ) ? 'edit_message_template' : 'default'
1336
+			'id' => isset($templates['GRP_ID']) ? $templates['GRP_ID'] : NULL,
1337
+			'context' => isset($templates['MTP_context']) ? $templates['MTP_context'] : NULL,
1338
+			'action' => isset($templates['GRP_ID']) ? 'edit_message_template' : 'default'
1339 1339
 			);
1340 1340
 
1341 1341
 		//if called via ajax then we return query args otherwise redirect
1342
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
1342
+		if (defined('DOING_AJAX') && DOING_AJAX) {
1343 1343
 			return $query_args;
1344 1344
 		} else {
1345
-			$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
1345
+			$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
1346 1346
 		}
1347 1347
 
1348 1348
 	}
@@ -1355,20 +1355,20 @@  discard block
 block discarded – undo
1355 1355
 	 * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview.
1356 1356
 	 * @return void
1357 1357
 	 */
1358
-	public function _preview_message( $send = FALSE ) {
1358
+	public function _preview_message($send = FALSE) {
1359 1359
 		//first make sure we've got the necessary parameters
1360
-		if ( !isset( $this->_req_data['message_type'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['GRP_ID'] ) ) {
1361
-			EE_Error::add_error( __('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1360
+		if ( ! isset($this->_req_data['message_type']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['GRP_ID'])) {
1361
+			EE_Error::add_error(__('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1362 1362
 		}
1363 1363
 
1364
-		EE_Registry::instance()->REQ->set( 'GRP_ID', $this->_req_data['GRP_ID'] );
1364
+		EE_Registry::instance()->REQ->set('GRP_ID', $this->_req_data['GRP_ID']);
1365 1365
 
1366 1366
 		$MSG = new EE_messages();
1367 1367
 
1368 1368
 		//get the preview!
1369
-		$preview = $MSG->preview_message( $this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send );
1369
+		$preview = $MSG->preview_message($this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send);
1370 1370
 
1371
-		if ( $send ) {
1371
+		if ($send) {
1372 1372
 			return $preview;
1373 1373
 		}
1374 1374
 
@@ -1378,16 +1378,16 @@  discard block
 block discarded – undo
1378 1378
 			'context' => $this->_req_data['context'],
1379 1379
 			'action' => 'edit_message_template'
1380 1380
 			);
1381
-		$go_back_url = parent::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1382
-		$preview_button = '<a href="' . $go_back_url . '" class="button-secondary messages-preview-go-back-button">' . __('Go Back to Edit', 'event_espresso') . '</a>';
1381
+		$go_back_url = parent::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1382
+		$preview_button = '<a href="'.$go_back_url.'" class="button-secondary messages-preview-go-back-button">'.__('Go Back to Edit', 'event_espresso').'</a>';
1383 1383
 
1384 1384
 		//let's provide a helpful title for context
1385
-		$preview_title = sprintf( __('Viewing Preview for %s %s Message Template', 'event_espresso'), ucwords($this->_active_messengers[$this->_req_data['messenger']]['obj']->label['singular']), ucwords($this->_active_message_types[$this->_req_data['message_type']]['obj']->label['singular']) );
1385
+		$preview_title = sprintf(__('Viewing Preview for %s %s Message Template', 'event_espresso'), ucwords($this->_active_messengers[$this->_req_data['messenger']]['obj']->label['singular']), ucwords($this->_active_message_types[$this->_req_data['message_type']]['obj']->label['singular']));
1386 1386
 
1387 1387
 
1388 1388
 		//setup display of preview.
1389 1389
 		$this->_admin_page_title = $preview_title;
1390
-		$this->_template_args['admin_page_content'] = $preview_button . '<br />' .stripslashes($preview);
1390
+		$this->_template_args['admin_page_content'] = $preview_button.'<br />'.stripslashes($preview);
1391 1391
 		$this->_template_args['data']['force_json'] = TRUE;
1392 1392
 	}
1393 1393
 
@@ -1415,9 +1415,9 @@  discard block
 block discarded – undo
1415 1415
 	 * @return void
1416 1416
 	 */
1417 1417
 	protected function _register_edit_meta_boxes() {
1418
-		add_meta_box( 'mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array( $this, 'shortcode_meta_box' ), $this->_current_screen->id, 'side', 'default' );
1419
-		add_meta_box( 'mtp_extra_actions', __('Extra Actions', 'event_espresso'), array( $this, 'extra_actions_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1420
-		add_meta_box( 'mtp_templates', __('Template Styles', 'event_espresso'), array( $this, 'template_pack_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1418
+		add_meta_box('mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array($this, 'shortcode_meta_box'), $this->_current_screen->id, 'side', 'default');
1419
+		add_meta_box('mtp_extra_actions', __('Extra Actions', 'event_espresso'), array($this, 'extra_actions_meta_box'), $this->_current_screen->id, 'side', 'high');
1420
+		add_meta_box('mtp_templates', __('Template Styles', 'event_espresso'), array($this, 'template_pack_meta_box'), $this->_current_screen->id, 'side', 'high');
1421 1421
 	}
1422 1422
 
1423 1423
 
@@ -1438,10 +1438,10 @@  discard block
 block discarded – undo
1438 1438
 
1439 1439
 		$tp_select_values = array();
1440 1440
 
1441
-		foreach ( $template_packs as $tp ) {
1441
+		foreach ($template_packs as $tp) {
1442 1442
 			//only include template packs that support this messenger and message type!
1443 1443
 			$supports = $tp->get_supports();
1444
-			if ( ! isset( $supports[$this->_message_template_group->messenger()] ) || ! in_array( $this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()] ) ) {
1444
+			if ( ! isset($supports[$this->_message_template_group->messenger()]) || ! in_array($this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()])) {
1445 1445
 				//not supported
1446 1446
 				continue;
1447 1447
 			}
@@ -1453,7 +1453,7 @@  discard block
 block discarded – undo
1453 1453
 		}
1454 1454
 
1455 1455
 		//if empty $tp_select_values then we make sure default is set because EVERY message type should be supported by the default template pack.  This still allows for the odd template pack to override.
1456
-		if ( empty( $tp_select_values ) ) {
1456
+		if (empty($tp_select_values)) {
1457 1457
 			$tp_select_values[] = array(
1458 1458
 				'text' => __('Default', 'event_espresso'),
1459 1459
 				'id' => 'default'
@@ -1461,27 +1461,27 @@  discard block
 block discarded – undo
1461 1461
 		}
1462 1462
 
1463 1463
 		//setup variation select values for the currently selected template.
1464
-		$variations = $this->_message_template_group->get_template_pack()->get_variations( $this->_message_template_group->messenger(), $this->_message_template_group->message_type() );
1464
+		$variations = $this->_message_template_group->get_template_pack()->get_variations($this->_message_template_group->messenger(), $this->_message_template_group->message_type());
1465 1465
 		$variations_select_values = array();
1466
-		foreach ( $variations as $variation => $label ) {
1466
+		foreach ($variations as $variation => $label) {
1467 1467
 			$variations_select_values[] = array(
1468 1468
 				'text' => $label,
1469 1469
 				'id' => $variation
1470 1470
 				);
1471 1471
 		}
1472 1472
 
1473
-		$template_pack_labels= $this->_message_template_group->messenger_obj()->get_supports_labels();
1473
+		$template_pack_labels = $this->_message_template_group->messenger_obj()->get_supports_labels();
1474 1474
 
1475
-		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input( 'MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name() );
1476
-		$template_args['variations_selector'] = EEH_Form_Fields::select_input( 'MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation() );
1475
+		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input('MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name());
1476
+		$template_args['variations_selector'] = EEH_Form_Fields::select_input('MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation());
1477 1477
 		$template_args['template_pack_label'] = $template_pack_labels->template_pack;
1478 1478
 		$template_args['template_variation_label'] = $template_pack_labels->template_variation;
1479 1479
 		$template_args['template_pack_description'] = $template_pack_labels->template_pack_description;
1480 1480
 		$template_args['template_variation_description'] = $template_pack_labels->template_variation_description;
1481 1481
 
1482
-		$template = EE_MSG_TEMPLATE_PATH . 'template_pack_and_variations_metabox.template.php';
1482
+		$template = EE_MSG_TEMPLATE_PATH.'template_pack_and_variations_metabox.template.php';
1483 1483
 
1484
-		EEH_Template::display_template( $template, $template_args );
1484
+		EEH_Template::display_template($template, $template_args);
1485 1485
 	}
1486 1486
 
1487 1487
 
@@ -1502,52 +1502,52 @@  discard block
 block discarded – undo
1502 1502
 			'GRP_ID' => $this->_message_template_group->GRP_ID()
1503 1503
 			);
1504 1504
 
1505
-		$button = $this->get_action_link_or_button( 'reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button' );
1505
+		$button = $this->get_action_link_or_button('reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button');
1506 1506
 
1507 1507
 
1508 1508
 		//test button
1509 1509
 		//first we need to see if there are any fields
1510 1510
 		$fields = $this->_message_template_group->messenger_obj()->get_test_settings_fields();
1511 1511
 
1512
-		if ( !empty( $fields ) ) {
1512
+		if ( ! empty($fields)) {
1513 1513
 			//yup there be fields
1514
-			foreach ( $fields as $field => $config ) {
1515
-				$field_id = $this->_message_template_group->messenger() . '_' . $field;
1514
+			foreach ($fields as $field => $config) {
1515
+				$field_id = $this->_message_template_group->messenger().'_'.$field;
1516 1516
 				$existing = $this->_message_template_group->messenger_obj()->get_existing_test_settings();
1517
-				$default = isset( $config['default'] ) ? $config['default'] : '';
1518
-				$default = isset( $config['value'] ) ? $config['value'] : $default;
1517
+				$default = isset($config['default']) ? $config['default'] : '';
1518
+				$default = isset($config['value']) ? $config['value'] : $default;
1519 1519
 
1520 1520
 				//if type is hidden and the value is empty something may have gone wrong so let's correct with the defaults
1521 1521
 				$fix = $config['input'] == 'hidden' && isset($existing[$field]) && empty($existing[$field]) ? $default : '';
1522
-				$existing[$field] = isset( $existing[$field] ) && empty( $fix ) ? $existing[$field] : $fix;
1522
+				$existing[$field] = isset($existing[$field]) && empty($fix) ? $existing[$field] : $fix;
1523 1523
 
1524 1524
 				$template_form_fields[$field_id] = array(
1525
-					'name' => 'test_settings_fld[' . $field . ']',
1525
+					'name' => 'test_settings_fld['.$field.']',
1526 1526
 					'label' => $config['label'],
1527 1527
 					'input' => $config['input'],
1528 1528
 					'type' => $config['type'],
1529 1529
 					'required' => $config['required'],
1530 1530
 					'validation' => $config['validation'],
1531
-					'value' => isset( $existing[$field] ) ? $existing[$field] : $default,
1531
+					'value' => isset($existing[$field]) ? $existing[$field] : $default,
1532 1532
 					'css_class' => $config['css_class'],
1533
-					'options' => isset( $config['options'] ) ? $config['options'] : array(),
1533
+					'options' => isset($config['options']) ? $config['options'] : array(),
1534 1534
 					'default' => $default,
1535 1535
 					'format' => $config['format']
1536 1536
 					);
1537 1537
 			}
1538 1538
 		}
1539 1539
 
1540
-		$test_settings_fields = !empty( $template_form_fields) ? $this->_generate_admin_form_fields( $template_form_fields, 'string', 'ee_tst_settings_flds' ) : '';
1540
+		$test_settings_fields = ! empty($template_form_fields) ? $this->_generate_admin_form_fields($template_form_fields, 'string', 'ee_tst_settings_flds') : '';
1541 1541
 
1542 1542
 		$test_settings_html = '';
1543 1543
 		//print out $test_settings_fields
1544
-		if ( !empty( $test_settings_fields ) ) {
1544
+		if ( ! empty($test_settings_fields)) {
1545 1545
 			echo $test_settings_fields;
1546
-			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="' . __('Test Send', 'event_espresso') . '" />';
1546
+			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="'.__('Test Send', 'event_espresso').'" />';
1547 1547
 		}
1548 1548
 
1549 1549
 		//and button
1550
-		echo $test_settings_html . '<div class="publishing-action alignright resetbutton">' . $button . '</div><div style="clear:both"></div>';
1550
+		echo $test_settings_html.'<div class="publishing-action alignright resetbutton">'.$button.'</div><div style="clear:both"></div>';
1551 1551
 	}
1552 1552
 
1553 1553
 
@@ -1561,15 +1561,15 @@  discard block
 block discarded – undo
1561 1561
 		$shortcodes = $this->_get_shortcodes(array(), FALSE); //just make sure shortcodes property is set
1562 1562
 		$messenger = $this->_message_template_group->messenger_obj();
1563 1563
 		//now let's set the content depending on the status of the shortcodes array
1564
-		if ( empty( $shortcodes ) ) {
1565
-			$content = '<p>' . __('There are no valid shortcodes available', 'event_espresso') . '</p>';
1564
+		if (empty($shortcodes)) {
1565
+			$content = '<p>'.__('There are no valid shortcodes available', 'event_espresso').'</p>';
1566 1566
 			echo $content;
1567 1567
 		} else {
1568 1568
 			$alt = 0;
1569 1569
 			?>
1570
-			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php _e('This is a list of shortcodes that have been organized by content areas where they can be used: ', 'event_espresso' ); ?></p>
1570
+			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php _e('This is a list of shortcodes that have been organized by content areas where they can be used: ', 'event_espresso'); ?></p>
1571 1571
 
1572
-			<?php foreach ( $shortcodes as $field => $allshortcodes ) : ?>
1572
+			<?php foreach ($shortcodes as $field => $allshortcodes) : ?>
1573 1573
 				<?php
1574 1574
 				//get the field label
1575 1575
 				$field_label = $messenger->get_field_label($field);
@@ -1579,8 +1579,8 @@  discard block
 block discarded – undo
1579 1579
 					<div class="ee-shortcode-table-scroll">
1580 1580
 						<table class="widefat ee-shortcode-table">
1581 1581
 							<tbody>
1582
-					<?php foreach ( $allshortcodes as $code => $label ) : ?>
1583
-						<?php $alt_class = !($alt%2) ? 'class="alternate"' : ''; ?>
1582
+					<?php foreach ($allshortcodes as $code => $label) : ?>
1583
+						<?php $alt_class = ! ($alt % 2) ? 'class="alternate"' : ''; ?>
1584 1584
 						<tr <?php echo $alt_class; ?>>
1585 1585
 							<td><?php echo $code; ?></td>
1586 1586
 						</tr>
@@ -1607,7 +1607,7 @@  discard block
 block discarded – undo
1607 1607
 	protected function _set_shortcodes() {
1608 1608
 
1609 1609
 		//no need to run this if the property is already set
1610
-		if ( !empty($this->_shortcodes ) ) return;
1610
+		if ( ! empty($this->_shortcodes)) return;
1611 1611
 
1612 1612
 		$this->_shortcodes = $this->_get_shortcodes();
1613 1613
 	}
@@ -1624,14 +1624,14 @@  discard block
 block discarded – undo
1624 1624
 	 * @param  boolean $merged Whether to merge all the shortcodes into one list of unique shortcodes
1625 1625
 	 * @return array          Shortcodes indexed by fieldname and the an array of shortcode/label pairs OR if merged is true just an array of shortcode/label pairs.
1626 1626
 	 */
1627
-	protected function _get_shortcodes( $fields = array(), $merged = TRUE ) {
1627
+	protected function _get_shortcodes($fields = array(), $merged = TRUE) {
1628 1628
 		$this->_set_message_template_group();
1629 1629
 
1630 1630
 		//we need the messenger and message template to retrieve the valid shortcodes array.
1631
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
1632
-		$context = isset( $this->_req_data['context'] ) ? $this->_req_data['context'] : key( $this->_message_template_group->contexts_config() );
1631
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
1632
+		$context = isset($this->_req_data['context']) ? $this->_req_data['context'] : key($this->_message_template_group->contexts_config());
1633 1633
 
1634
-		return !empty($GRP_ID) ? $this->_message_template_group->get_shortcodes( $context, $fields, $merged ) : array();
1634
+		return ! empty($GRP_ID) ? $this->_message_template_group->get_shortcodes($context, $fields, $merged) : array();
1635 1635
 	}
1636 1636
 
1637 1637
 
@@ -1644,19 +1644,19 @@  discard block
 block discarded – undo
1644 1644
 	 */
1645 1645
 	protected function _set_message_template_group() {
1646 1646
 
1647
-		if ( !empty( $this->_message_template_group ) )
1647
+		if ( ! empty($this->_message_template_group))
1648 1648
 			return; //get out if this is already set.
1649 1649
 
1650
-		$GRP_ID =  ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : FALSE;
1651
-		$GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID;
1650
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? absint($this->_req_data['GRP_ID']) : FALSE;
1651
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $GRP_ID;
1652 1652
 
1653 1653
 		//let's get the message templates
1654 1654
 		$MTP = EEM_Message_Template_Group::instance();
1655 1655
 
1656
-		if ( empty($GRP_ID) )
1656
+		if (empty($GRP_ID))
1657 1657
 			$this->_message_template_group = $MTP->create_default_object();
1658 1658
 		else
1659
-			$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );
1659
+			$this->_message_template_group = $MTP->get_one_by_ID($GRP_ID);
1660 1660
 
1661 1661
 		$this->_template_pack = $this->_message_template_group->get_template_pack();
1662 1662
 		$this->_variation = $this->_message_template_group->get_template_pack_variation();
@@ -1682,26 +1682,26 @@  discard block
 block discarded – undo
1682 1682
 		<div class="ee-msg-switcher-container">
1683 1683
 			<form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm">
1684 1684
 				<?php
1685
-					foreach ( $args as $name => $value ) {
1686
-						if ( $name == 'context' || empty($value) || $name == 'extra' ) continue;
1685
+					foreach ($args as $name => $value) {
1686
+						if ($name == 'context' || empty($value) || $name == 'extra') continue;
1687 1687
 						?>
1688 1688
 						<input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" />
1689 1689
 						<?php
1690 1690
 					}
1691 1691
 					//setup nonce_url
1692
-					wp_nonce_field($args['action'] . '_nonce', $args['action'] . '_nonce', false);
1692
+					wp_nonce_field($args['action'].'_nonce', $args['action'].'_nonce', false);
1693 1693
 				?>
1694 1694
 				<select name="context">
1695 1695
 					<?php
1696 1696
 					$context_templates = $template_group_object->context_templates();
1697
-					if ( is_array($context_templates) ) :
1698
-							foreach ( $context_templates as $context => $template_fields ) :
1697
+					if (is_array($context_templates)) :
1698
+							foreach ($context_templates as $context => $template_fields) :
1699 1699
 								$checked = ($context == $args['context']) ? 'selected="selected"' : '';
1700 1700
 					?>
1701 1701
 					<option value="<?php echo $context; ?>" <?php echo $checked; ?>><?php echo $context_details[$context]['label']; ?></option>
1702 1702
 					<?php endforeach; endif; ?>
1703 1703
 				</select>
1704
-				<?php $button_text = sprintf( __('Switch %s', 'event_espresso'), ucwords($context_label['label']) ); ?>
1704
+				<?php $button_text = sprintf(__('Switch %s', 'event_espresso'), ucwords($context_label['label'])); ?>
1705 1705
 				<input id="submit-msg-context-switcher-sbmt" class="button-secondary" type="submit" value="<?php echo $button_text; ?>">
1706 1706
 			</form>
1707 1707
 			<?php echo $args['extra']; ?>
@@ -1725,8 +1725,8 @@  discard block
 block discarded – undo
1725 1725
 	 * @param int $index This helps us know which template field to select from the request array.
1726 1726
 	 */
1727 1727
 	protected function _set_message_template_column_values($index) {
1728
-		if ( is_array($this->_req_data['MTP_template_fields'][$index]['content'] ) ) {
1729
-			foreach ( $this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value ) {
1728
+		if (is_array($this->_req_data['MTP_template_fields'][$index]['content'])) {
1729
+			foreach ($this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value) {
1730 1730
 				$this->_req_data['MTP_template_fields'][$index]['content'][$field] = $value;
1731 1731
 			}
1732 1732
 		} else {
@@ -1758,27 +1758,27 @@  discard block
 block discarded – undo
1758 1758
 
1759 1759
 
1760 1760
 
1761
-	protected function _insert_or_update_message_template($new = FALSE ) {
1761
+	protected function _insert_or_update_message_template($new = FALSE) {
1762 1762
 
1763
-		do_action ( 'AHEE_log', __FILE__, __FUNCTION__, '');
1763
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1764 1764
 		$success = 0;
1765 1765
 		$override = FALSE;
1766 1766
 
1767 1767
 		//setup notices description
1768
-		$messenger = !empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'] ) ) : false;
1769
-		$message_type = !empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'] ) ) : false;
1770
-		$context = !empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'] ) ) : false;
1768
+		$messenger = ! empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'])) : false;
1769
+		$message_type = ! empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'])) : false;
1770
+		$context = ! empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'])) : false;
1771 1771
 
1772
-		$item_desc = $messenger ? $messenger . ' ' . $message_type . ' ' . $context . ' ' : '';
1772
+		$item_desc = $messenger ? $messenger.' '.$message_type.' '.$context.' ' : '';
1773 1773
 		$item_desc .= 'Message Template';
1774 1774
 		$query_args = array();
1775 1775
 		$validates = '';
1776 1776
 
1777 1777
 		//if this is "new" then we need to generate the default contexts for the selected messenger/message_type for user to edit.
1778
-		if ( $new ) {
1779
-			$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1780
-			if ( $edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID ) ) {
1781
-				if ( empty($edit_array) ) {
1778
+		if ($new) {
1779
+			$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1780
+			if ($edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID)) {
1781
+				if (empty($edit_array)) {
1782 1782
 					$success = 0;
1783 1783
 				} else {
1784 1784
 					$success = 1;
@@ -1797,34 +1797,34 @@  discard block
 block discarded – undo
1797 1797
 
1798 1798
 
1799 1799
 			//run update for each template field in displayed context
1800
-			if ( !isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'] ) ) {
1801
-				EE_Error::add_error( __('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1800
+			if ( ! isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'])) {
1801
+				EE_Error::add_error(__('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1802 1802
 				$success = 0;
1803 1803
 				$action_desc = '';
1804 1804
 
1805 1805
 			} else {
1806 1806
 				//first validate all fields!
1807
-				$validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'],  $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
1807
+				$validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
1808 1808
 
1809 1809
 				//if $validate returned error messages (i.e. is_array()) then we need to process them and setup an appropriate response. HMM, dang this isn't correct, $validates will ALWAYS be an array.  WE need to make sure there is no actual error messages in validates.
1810
-				if ( is_array($validates) && !empty($validates) ) {
1810
+				if (is_array($validates) && ! empty($validates)) {
1811 1811
 					//add the transient so when the form loads we know which fields to highlight
1812
-					$this->_add_transient( 'edit_message_template', $validates );
1812
+					$this->_add_transient('edit_message_template', $validates);
1813 1813
 
1814 1814
 					$success = 0;
1815
-					$action_desc ='';
1815
+					$action_desc = '';
1816 1816
 
1817 1817
 					//setup notices
1818
-					foreach ( $validates as $field => $error ) {
1819
-						if ( isset($error['msg'] ) )
1820
-							EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ );
1818
+					foreach ($validates as $field => $error) {
1819
+						if (isset($error['msg']))
1820
+							EE_Error::add_error($error['msg'], __FILE__, __FUNCTION__, __LINE__);
1821 1821
 					}
1822 1822
 
1823 1823
 				} else {
1824
-					foreach ( $this->_req_data['MTP_template_fields'] as $template_field => $content ) {
1824
+					foreach ($this->_req_data['MTP_template_fields'] as $template_field => $content) {
1825 1825
 						$set_column_values = $this->_set_message_template_column_values($template_field);
1826 1826
 
1827
-						$where_cols_n_values = array( 'MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']);
1827
+						$where_cols_n_values = array('MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']);
1828 1828
 
1829 1829
 						$message_template_fields = array(
1830 1830
 							'GRP_ID' => $set_column_values['GRP_ID'],
@@ -1832,10 +1832,10 @@  discard block
 block discarded – undo
1832 1832
 							'MTP_context' => $set_column_values['MTP_context'],
1833 1833
 							'MTP_content' => $set_column_values['MTP_content']
1834 1834
 							);
1835
-						if ( $updated = $MTP->update( $message_template_fields, array( $where_cols_n_values ) ) ) {
1836
-							if ( $updated === FALSE ) {
1837
-								$msg = sprintf( __('%s field was NOT updated for some reason', 'event_espresso'), $template_field );
1838
-								EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ );
1835
+						if ($updated = $MTP->update($message_template_fields, array($where_cols_n_values))) {
1836
+							if ($updated === FALSE) {
1837
+								$msg = sprintf(__('%s field was NOT updated for some reason', 'event_espresso'), $template_field);
1838
+								EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1839 1839
 							} else {
1840 1840
 								$success = 1;
1841 1841
 							}
@@ -1852,24 +1852,24 @@  discard block
 block discarded – undo
1852 1852
 						'MTP_is_override' => $set_column_values['MTP_is_override'],
1853 1853
 						'MTP_deleted' => $set_column_values['MTP_deleted'],
1854 1854
 						'MTP_is_active' => $set_column_values['MTP_is_active'],
1855
-						'MTP_name' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_name'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '',
1856
-						'MTP_description' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_description'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : ''
1855
+						'MTP_name' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_name']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '',
1856
+						'MTP_description' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_description']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : ''
1857 1857
 						);
1858 1858
 
1859
-					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID'] );
1860
-					$updated = $MTPG->update( $mtpg_fields, array($mtpg_where) );
1859
+					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID']);
1860
+					$updated = $MTPG->update($mtpg_fields, array($mtpg_where));
1861 1861
 
1862
-					if ( $updated === FALSE ) {
1863
-						$msg = sprintf( __('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID'] );
1864
-						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ );
1862
+					if ($updated === FALSE) {
1863
+						$msg = sprintf(__('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID']);
1864
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1865 1865
 					} else {
1866 1866
 						//k now we need to ensure the template_pack and template_variation fields are set.
1867
-						$template_pack = ! empty( $this->_req_data['MTP_template_pack' ] ) ? $this->_req_data['MTP_template_pack'] : 'default';
1868
-						$template_variation = ! empty( $this->_req_data['MTP_template_variation'] ) ? $this->_req_data['MTP_template_variation'] : 'default';
1869
-						$mtpg_obj = $MTPG->get_one_by_ID( $set_column_values['GRP_ID'] );
1870
-						if ( $mtpg_obj instanceof EE_Message_Template_Group ) {
1871
-							$mtpg_obj->set_template_pack_name( $template_pack );
1872
-							$mtpg_obj->set_template_pack_variation( $template_variation );
1867
+						$template_pack = ! empty($this->_req_data['MTP_template_pack']) ? $this->_req_data['MTP_template_pack'] : 'default';
1868
+						$template_variation = ! empty($this->_req_data['MTP_template_variation']) ? $this->_req_data['MTP_template_variation'] : 'default';
1869
+						$mtpg_obj = $MTPG->get_one_by_ID($set_column_values['GRP_ID']);
1870
+						if ($mtpg_obj instanceof EE_Message_Template_Group) {
1871
+							$mtpg_obj->set_template_pack_name($template_pack);
1872
+							$mtpg_obj->set_template_pack_variation($template_variation);
1873 1873
 						}
1874 1874
 						$success = 1;
1875 1875
 					}
@@ -1879,7 +1879,7 @@  discard block
 block discarded – undo
1879 1879
 		}
1880 1880
 
1881 1881
 		//we return things differently if doing ajax
1882
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
1882
+		if (defined('DOING_AJAX') && DOING_AJAX) {
1883 1883
 			$this->_template_args['success'] = $success;
1884 1884
 			$this->_template_args['error'] = ! $success ? TRUE : FALSE;
1885 1885
 			$this->_template_args['content'] = '';
@@ -1887,9 +1887,9 @@  discard block
 block discarded – undo
1887 1887
 				'grpID' => $edit_array['GRP_ID'],
1888 1888
 				'templateName' => $edit_array['template_name']
1889 1889
 				);
1890
-			if ( $success ) {
1890
+			if ($success) {
1891 1891
 				EE_Error::overwrite_success();
1892
-				EE_Error::add_success( __('The new template has been created and automatically selected for this event.  You can edit the new template by clicking the edit button.  Note before this template is assigned to this event, the event must be saved.', 'event_espresso') );
1892
+				EE_Error::add_success(__('The new template has been created and automatically selected for this event.  You can edit the new template by clicking the edit button.  Note before this template is assigned to this event, the event must be saved.', 'event_espresso'));
1893 1893
 			}
1894 1894
 
1895 1895
 			$this->_return_json();
@@ -1897,13 +1897,13 @@  discard block
 block discarded – undo
1897 1897
 
1898 1898
 
1899 1899
 		//was a test send triggered?
1900
-		if ( isset( $this->_req_data['test_button'] ) ) {
1900
+		if (isset($this->_req_data['test_button'])) {
1901 1901
 			EE_Error::overwrite_success();
1902
-			$this->_do_test_send( $this->_req_data['MTP_context'],  $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type'] );
1902
+			$this->_do_test_send($this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
1903 1903
 			$override = TRUE;
1904 1904
 		}
1905 1905
 
1906
-		if ( empty( $query_args ) ) {
1906
+		if (empty($query_args)) {
1907 1907
 			$query_args = array(
1908 1908
 				'id' => $this->_req_data['GRP_ID'],
1909 1909
 				'context' => $this->_req_data['MTP_context'],
@@ -1911,7 +1911,7 @@  discard block
 block discarded – undo
1911 1911
 				);
1912 1912
 		}
1913 1913
 
1914
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, $query_args, $override );
1914
+		$this->_redirect_after_action($success, $item_desc, $action_desc, $query_args, $override);
1915 1915
 	}
1916 1916
 
1917 1917
 
@@ -1924,24 +1924,24 @@  discard block
 block discarded – undo
1924 1924
 	 * @param  string $message_type message type being tested
1925 1925
 	 * @return void
1926 1926
 	 */
1927
-	protected function _do_test_send( $context, $messenger, $message_type ) {
1927
+	protected function _do_test_send($context, $messenger, $message_type) {
1928 1928
 		//set things up for preview
1929 1929
 		$this->_req_data['messenger'] = $messenger;
1930 1930
 		$this->_req_data['message_type'] = $message_type;
1931 1931
 		$this->_req_data['context'] = $context;
1932
-		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : '';
1932
+		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : '';
1933 1933
 
1934 1934
 		//let's save any existing fields that might be required by the messenger
1935
-		if ( isset( $this->_req_data['test_settings_fld'] ) ) {
1936
-			$this->_active_messengers[$messenger]['obj']->set_existing_test_settings( $this->_req_data['test_settings_fld'] );
1935
+		if (isset($this->_req_data['test_settings_fld'])) {
1936
+			$this->_active_messengers[$messenger]['obj']->set_existing_test_settings($this->_req_data['test_settings_fld']);
1937 1937
 		}
1938 1938
 
1939 1939
 		$success = $this->_preview_message(TRUE);
1940 1940
 
1941
-		if ( $success ) {
1942
-			EE_Error::add_success( __('Test message sent', 'event_espresso') );
1941
+		if ($success) {
1942
+			EE_Error::add_success(__('Test message sent', 'event_espresso'));
1943 1943
 		} else {
1944
-			EE_Error::add_error( __('The test message was not sent', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1944
+			EE_Error::add_error(__('The test message was not sent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1945 1945
 		}
1946 1946
 	}
1947 1947
 
@@ -1963,12 +1963,12 @@  discard block
 block discarded – undo
1963 1963
 	protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = FALSE) {
1964 1964
 
1965 1965
 		//if no $message_types are given then that's okay... this may be a messenger that just adds shortcodes, so we just don't generate any templates.
1966
-		if ( empty( $message_types ) )
1966
+		if (empty($message_types))
1967 1967
 			return true;
1968 1968
 
1969
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
1969
+		EE_Registry::instance()->load_helper('MSG_Template');
1970 1970
 
1971
-		return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID,  $global);
1971
+		return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID, $global);
1972 1972
 
1973 1973
 	}
1974 1974
 
@@ -1984,33 +1984,33 @@  discard block
 block discarded – undo
1984 1984
 	 * @param boolean $all whether this is going to trash/restore all contexts within a template group (TRUE) OR just an individual context (FALSE).
1985 1985
 	 * @return void
1986 1986
 	 */
1987
-	protected function _trash_or_restore_message_template($trash = TRUE, $all = FALSE ) {
1988
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1987
+	protected function _trash_or_restore_message_template($trash = TRUE, $all = FALSE) {
1988
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1989 1989
 		$MTP = EEM_Message_Template_Group::instance();
1990 1990
 
1991 1991
 		$success = 1;
1992 1992
 
1993 1993
 		//incoming GRP_IDs
1994
-		if ( $all ) {
1994
+		if ($all) {
1995 1995
 			//Checkboxes
1996
-			if ( !empty( $this->_req_data['checkbox'] ) && is_array($this->_req_data['checkbox'] ) ) {
1996
+			if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1997 1997
 				//if array has more than one element then success message should be plural.
1998 1998
 				//todo: what about nonce?
1999
-				$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1999
+				$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2000 2000
 
2001 2001
 				//cycle through checkboxes
2002
-				while ( list( $GRP_ID, $value ) = each ($this->_req_data['checkbox']) ) {
2003
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2004
-					if ( ! $trashed_or_restored ) {
2002
+				while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2003
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2004
+					if ( ! $trashed_or_restored) {
2005 2005
 						$success = 0;
2006 2006
 					}
2007 2007
 				}
2008 2008
 			} else {
2009 2009
 				//grab single GRP_ID and handle
2010
-				$GRP_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
2011
-				if ( ! empty( $GRP_ID ) ) {
2012
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2013
-					if ( ! $trashed_or_restored ) {
2010
+				$GRP_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
2011
+				if ( ! empty($GRP_ID)) {
2012
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2013
+					if ( ! $trashed_or_restored) {
2014 2014
 						$success = 0;
2015 2015
 					}
2016 2016
 				} else {
@@ -2022,13 +2022,13 @@  discard block
 block discarded – undo
2022 2022
 
2023 2023
 		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2024 2024
 
2025
-		$action_desc = !empty( $this->_req_data['template_switch'] ) ? __('switched') : $action_desc;
2025
+		$action_desc = ! empty($this->_req_data['template_switch']) ? __('switched') : $action_desc;
2026 2026
 
2027 2027
 		$item_desc = $all ? _n('Message Template Group', 'Message Template Groups', $success, 'event_espresso') : _n('Message Template Context', 'Message Template Contexts', $success, 'event_espresso');
2028 2028
 
2029
-		$item_desc = !empty( $this->_req_data['template_switch'] ) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2029
+		$item_desc = ! empty($this->_req_data['template_switch']) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2030 2030
 
2031
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, array() );
2031
+		$this->_redirect_after_action($success, $item_desc, $action_desc, array());
2032 2032
 
2033 2033
 	}
2034 2034
 
@@ -2044,26 +2044,26 @@  discard block
 block discarded – undo
2044 2044
 	 * @return void
2045 2045
 	 */
2046 2046
 	protected function _delete_message_template() {
2047
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2047
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2048 2048
 
2049 2049
 		$success = 1;
2050 2050
 
2051 2051
 		//checkboxes
2052
-		if ( !empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'] ) ) {
2052
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2053 2053
 			//if array has more than one element then success message should be plural
2054
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2054
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2055 2055
 
2056 2056
 			//cycle through bulk action checkboxes
2057
-			while ( list( $GRP_ID, $value ) = each($this->_req_data['checkbox'] ) ) {
2058
-				$success = $this->_delete_mtp_permanently( $GRP_ID );
2057
+			while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2058
+				$success = $this->_delete_mtp_permanently($GRP_ID);
2059 2059
 			}
2060 2060
 		} else {
2061 2061
 			//grab single grp_id and delete
2062
-			$GRP_ID = absint($this->_req_data['id'] );
2063
-			$success = $this->_delete_mtp_permanently( $GRP_ID );
2062
+			$GRP_ID = absint($this->_req_data['id']);
2063
+			$success = $this->_delete_mtp_permanently($GRP_ID);
2064 2064
 		}
2065 2065
 
2066
-		$this->_redirect_after_action( $success, 'Message Templates', 'deleted', array() );
2066
+		$this->_redirect_after_action($success, 'Message Templates', 'deleted', array());
2067 2067
 
2068 2068
 	}
2069 2069
 
@@ -2076,20 +2076,20 @@  discard block
 block discarded – undo
2076 2076
 	 * @param  bool $include_group whether to delete the Message Template Group as well.
2077 2077
 	 * @return success        boolean to indicate the success of the deletes or not.
2078 2078
 	 */
2079
-	private function _delete_mtp_permanently( $GRP_ID, $include_group = TRUE ) {
2079
+	private function _delete_mtp_permanently($GRP_ID, $include_group = TRUE) {
2080 2080
 		$success = 1;
2081 2081
 		$MTPG = EEM_Message_Template_Group::instance();
2082 2082
 		//first let's GET this group
2083
-		$MTG = $MTPG->get_one_by_ID( $GRP_ID );
2083
+		$MTG = $MTPG->get_one_by_ID($GRP_ID);
2084 2084
 		//then delete permanently all the related Message Templates
2085
-		$deleted = $MTG->delete_related_permanently( 'Message_Template' );
2085
+		$deleted = $MTG->delete_related_permanently('Message_Template');
2086 2086
 
2087
-		if ( $deleted === 0 )
2087
+		if ($deleted === 0)
2088 2088
 			$success = 0;
2089 2089
 
2090 2090
 		//now delete permanently this particular group
2091 2091
 
2092
-		if ( $include_group && ! $MTG->delete_permanently() ) {
2092
+		if ($include_group && ! $MTG->delete_permanently()) {
2093 2093
 			$success = 0;
2094 2094
 		}
2095 2095
 		return $success;
@@ -2107,7 +2107,7 @@  discard block
 block discarded – undo
2107 2107
 	*	@return string
2108 2108
 	*/
2109 2109
 	protected function _learn_more_about_message_templates_link() {
2110
-		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>';
2110
+		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how message templates works', 'event_espresso').'</a>';
2111 2111
 	}
2112 2112
 
2113 2113
 
@@ -2121,14 +2121,14 @@  discard block
 block discarded – undo
2121 2121
 	 */
2122 2122
 	protected function _settings() {
2123 2123
 
2124
-		EE_Registry::instance()->load_helper( 'Tabbed_Content' );
2124
+		EE_Registry::instance()->load_helper('Tabbed_Content');
2125 2125
 
2126 2126
 		$this->_set_m_mt_settings();
2127 2127
 
2128
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2128
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2129 2129
 
2130 2130
 		//let's setup the messenger tabs
2131
-		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger );
2131
+		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger);
2132 2132
 		$this->_template_args['before_admin_page_content'] = '<div class="ui-widget ui-helper-clearfix">';
2133 2133
 		$this->_template_args['after_admin_page_content'] = '</div><!-- end .ui-widget -->';
2134 2134
 
@@ -2147,10 +2147,10 @@  discard block
 block discarded – undo
2147 2147
 	 */
2148 2148
 	protected function _set_m_mt_settings() {
2149 2149
 		//first if this is already set then lets get out no need to regenerate data.
2150
-		if ( !empty($this->_m_mt_settings) )
2150
+		if ( ! empty($this->_m_mt_settings))
2151 2151
 			return;
2152 2152
 
2153
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2153
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2154 2154
 
2155 2155
 		//get all installed messengers and message_types
2156 2156
 		$installed_message_objects = $this->_get_installed_message_objects();
@@ -2160,10 +2160,10 @@  discard block
 block discarded – undo
2160 2160
 
2161 2161
 		//assemble the array for the _tab_text_links helper
2162 2162
 
2163
-		foreach ( $messengers as $messenger ) {
2163
+		foreach ($messengers as $messenger) {
2164 2164
 			$this->_m_mt_settings['messenger_tabs'][$messenger->name] = array(
2165 2165
 				'label' => ucwords($messenger->label['singular']),
2166
-				'class' => isset( $this->_active_messengers[$messenger->name] ) ? 'messenger-active' : '',
2166
+				'class' => isset($this->_active_messengers[$messenger->name]) ? 'messenger-active' : '',
2167 2167
 				'href' => $messenger->name,
2168 2168
 				'title' => __('Modify this Messenger', 'event_espresso'),
2169 2169
 				'slug' => $messenger->name,
@@ -2173,23 +2173,23 @@  discard block
 block discarded – undo
2173 2173
 			$message_types_for_messenger = $messenger->get_valid_message_types();
2174 2174
 
2175 2175
 			//assemble the array for the ACTIVE and INACTIVE message types with the selected messenger //note that all message types will be in the inactive box if the messenger is NOT active.
2176
-			$selected_settings = isset( $this->_active_messengers[$messenger->name]['settings'] ) ? $this->_active_messengers[$messenger->name]['settings'] : array();
2177
-			foreach ( $message_types as $message_type ) {
2176
+			$selected_settings = isset($this->_active_messengers[$messenger->name]['settings']) ? $this->_active_messengers[$messenger->name]['settings'] : array();
2177
+			foreach ($message_types as $message_type) {
2178 2178
 				//first we need to verify that this message type is valid with this messenger. Cause if it isn't then it shouldn't show in either the inactive OR active metabox.
2179
-				if ( ! in_array( $message_type->name, $message_types_for_messenger ) ) {
2179
+				if ( ! in_array($message_type->name, $message_types_for_messenger)) {
2180 2180
 					continue;
2181 2181
 				}
2182 2182
 
2183
-				$a_or_i = isset( $selected_settings[$messenger->name . '-message_types'][$message_type->name] ) && $selected_settings[$messenger->name . '-message_types'][$message_type->name] ? 'active' : 'inactive';
2183
+				$a_or_i = isset($selected_settings[$messenger->name.'-message_types'][$message_type->name]) && $selected_settings[$messenger->name.'-message_types'][$message_type->name] ? 'active' : 'inactive';
2184 2184
 
2185 2185
 				$this->_m_mt_settings['message_type_tabs'][$messenger->name][$a_or_i][$message_type->name] = array(
2186 2186
 						'label' => ucwords($message_type->label['singular']),
2187
-						'class' => 'message-type-' . $a_or_i,
2188
-						'slug_id' => $message_type->name . '-messagetype-' . $messenger->name,
2189
-						'mt_nonce' => wp_create_nonce($message_type->name . '_nonce'),
2190
-						'href' => 'espresso_' . $message_type->name . '_message_type_settings',
2187
+						'class' => 'message-type-'.$a_or_i,
2188
+						'slug_id' => $message_type->name.'-messagetype-'.$messenger->name,
2189
+						'mt_nonce' => wp_create_nonce($message_type->name.'_nonce'),
2190
+						'href' => 'espresso_'.$message_type->name.'_message_type_settings',
2191 2191
 						'title' => $a_or_i == 'active' ? __('Drag this message type to the Inactive window to deactivate', 'event_espresso') : __('Drag this message type to the messenger to activate', 'event_espresso'),
2192
-						'content' => $a_or_i == 'active' ? $this->_message_type_settings_content( $message_type, $messenger, TRUE ) : $this->_message_type_settings_content( $message_type, $messenger ),
2192
+						'content' => $a_or_i == 'active' ? $this->_message_type_settings_content($message_type, $messenger, TRUE) : $this->_message_type_settings_content($message_type, $messenger),
2193 2193
 						'slug' => $message_type->name,
2194 2194
 						'active' => $a_or_i == 'active' ? TRUE : FALSE,
2195 2195
 						'obj' => $message_type
@@ -2206,34 +2206,34 @@  discard block
 block discarded – undo
2206 2206
 	 * @param  boolean $active       Whether the message type is active or not
2207 2207
 	 * @return string                html output for the content
2208 2208
 	 */
2209
-	protected function _message_type_settings_content( $message_type, $messenger, $active = FALSE ) {
2209
+	protected function _message_type_settings_content($message_type, $messenger, $active = FALSE) {
2210 2210
 		//get message type fields
2211 2211
 		$fields = $message_type->get_admin_settings_fields();
2212
-		$settings_template_args['template_form_fields']= '';
2212
+		$settings_template_args['template_form_fields'] = '';
2213 2213
 
2214
-		if ( !empty( $fields ) && $active ) {
2214
+		if ( ! empty($fields) && $active) {
2215 2215
 
2216
-			$existing_settings = $message_type->get_existing_admin_settings( $messenger->name );
2216
+			$existing_settings = $message_type->get_existing_admin_settings($messenger->name);
2217 2217
 
2218
-			foreach( $fields as $fldname => $fldprops ) {
2219
-				$field_id = $messenger->name . '-' . $message_type->name . '-' . $fldname;
2218
+			foreach ($fields as $fldname => $fldprops) {
2219
+				$field_id = $messenger->name.'-'.$message_type->name.'-'.$fldname;
2220 2220
 				$template_form_field[$field_id] = array(
2221
-					'name' => 'message_type_settings[' . $fldname . ']',
2221
+					'name' => 'message_type_settings['.$fldname.']',
2222 2222
 					'label' => $fldprops['label'],
2223 2223
 					'input' => $fldprops['field_type'],
2224 2224
 					'type' => $fldprops['value_type'],
2225 2225
 					'required' => $fldprops['required'],
2226 2226
 					'validation' => $fldprops['validation'],
2227
-					'value' => isset( $existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2228
-					'options' => isset( $fldprops['options'] ) ? $fldprops['options'] : array(),
2229
-					'default' => isset( $existing_settings[$fldname] ) ? $existing_settings[$fldname] : $fldprops['default'],
2227
+					'value' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2228
+					'options' => isset($fldprops['options']) ? $fldprops['options'] : array(),
2229
+					'default' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2230 2230
 					'css_class' => 'no-drag',
2231 2231
 					'format' => $fldprops['format']
2232 2232
 					);
2233 2233
 			}
2234 2234
 
2235 2235
 
2236
-			$settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_mt_activate_form' ) : '';
2236
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_mt_activate_form') : '';
2237 2237
 		}
2238 2238
 
2239 2239
 		$settings_template_args['description'] = $message_type->description;
@@ -2253,13 +2253,13 @@  discard block
 block discarded – undo
2253 2253
 					)
2254 2254
 				);
2255 2255
 
2256
-		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );
2257
-		$settings_template_args['show_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : '';
2256
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
2257
+		$settings_template_args['show_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : '';
2258 2258
 
2259 2259
 
2260 2260
 
2261
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_mt_settings_content.template.php';
2262
-		$content = EEH_Template::display_template( $template, $settings_template_args, TRUE );
2261
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_mt_settings_content.template.php';
2262
+		$content = EEH_Template::display_template($template, $settings_template_args, TRUE);
2263 2263
 		return $content;
2264 2264
 	}
2265 2265
 
@@ -2276,21 +2276,21 @@  discard block
 block discarded – undo
2276 2276
 		$m_boxes = $mt_boxes = array();
2277 2277
 		$m_template_args = $mt_template_args = array();
2278 2278
 
2279
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2279
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2280 2280
 
2281
-		foreach ( $this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array ) {
2281
+		foreach ($this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array) {
2282 2282
 
2283
-			$hide_on_message = isset( $this->_active_messengers[$messenger] ) ? '' : 'hidden';
2284
-			$hide_off_message = isset( $this->_active_messengers[$messenger] ) ? 'hidden' : '';
2283
+			$hide_on_message = isset($this->_active_messengers[$messenger]) ? '' : 'hidden';
2284
+			$hide_off_message = isset($this->_active_messengers[$messenger]) ? 'hidden' : '';
2285 2285
 
2286 2286
 			//messenger meta boxes
2287 2287
 			$active = $selected_messenger == $messenger ? TRUE : FALSE;
2288
-			$active_mt_tabs = isset(  $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] ) ?  $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : '';
2289
-			$m_boxes[$messenger . '_a_box'] = sprintf( __('%s Settings', 'event_espresso'), $tab_array['label'] );
2290
-			$m_template_args[$messenger . '_a_box'] = array(
2291
-					'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2292
-					'inactive_message_types' => isset( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) ? $this->_get_mt_tabs( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) : '',
2293
-					'content' => $this->_get_messenger_box_content( $tab_array['obj'] ),
2288
+			$active_mt_tabs = isset($this->_m_mt_settings['message_type_tabs'][$messenger]['active']) ? $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : '';
2289
+			$m_boxes[$messenger.'_a_box'] = sprintf(__('%s Settings', 'event_espresso'), $tab_array['label']);
2290
+			$m_template_args[$messenger.'_a_box'] = array(
2291
+					'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2292
+					'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) : '',
2293
+					'content' => $this->_get_messenger_box_content($tab_array['obj']),
2294 2294
 					'hidden' => $active ? '' : ' hidden',
2295 2295
 					'hide_on_message' => $hide_on_message,
2296 2296
 					'messenger' => $messenger,
@@ -2299,10 +2299,10 @@  discard block
 block discarded – undo
2299 2299
 
2300 2300
 
2301 2301
 			//message type meta boxes (which is really just the inactive container for each messenger showing inactive message types for that messenger)
2302
-			$mt_boxes[$messenger . '_i_box'] = __('Inactive Message Types', 'event_espresso');
2303
-			$mt_template_args[$messenger . '_i_box'] = array(
2304
-				'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2305
-				'inactive_message_types' => isset( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) ? $this->_get_mt_tabs( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) : '',
2302
+			$mt_boxes[$messenger.'_i_box'] = __('Inactive Message Types', 'event_espresso');
2303
+			$mt_template_args[$messenger.'_i_box'] = array(
2304
+				'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2305
+				'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) : '',
2306 2306
 				'hidden' => $active ? '' : ' hidden',
2307 2307
 				'hide_on_message' => $hide_on_message,
2308 2308
 				'hide_off_message' => $hide_off_message,
@@ -2312,19 +2312,19 @@  discard block
 block discarded – undo
2312 2312
 		}
2313 2313
 
2314 2314
 		//register messenger metaboxes
2315
-		$m_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_mt_meta_box.template.php';
2316
-		foreach ( $m_boxes as $box => $label ) {
2317
-			$callback_args = array( 'template_path' => $m_template_path, 'template_args' => $m_template_args[$box] );
2318
-			$msgr = str_replace( '_a_box', '', $box );
2319
-			add_meta_box( 'espresso_' . $msgr . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args );
2315
+		$m_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_mt_meta_box.template.php';
2316
+		foreach ($m_boxes as $box => $label) {
2317
+			$callback_args = array('template_path' => $m_template_path, 'template_args' => $m_template_args[$box]);
2318
+			$msgr = str_replace('_a_box', '', $box);
2319
+			add_meta_box('espresso_'.$msgr.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args);
2320 2320
 		}
2321 2321
 
2322 2322
 		//register message type metaboxes
2323
-		$mt_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_meta_box.template.php';
2324
-		foreach ( $mt_boxes as $box => $label ) {
2325
-			$callback_args = array( 'template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box] );
2326
-			$mt = str_replace( '_i_box', '', $box );
2327
-			add_meta_box( 'espresso_' . $mt . '_inactive_mts', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'side', 'high', $callback_args );
2323
+		$mt_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_meta_box.template.php';
2324
+		foreach ($mt_boxes as $box => $label) {
2325
+			$callback_args = array('template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box]);
2326
+			$mt = str_replace('_i_box', '', $box);
2327
+			add_meta_box('espresso_'.$mt.'_inactive_mts', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'side', 'high', $callback_args);
2328 2328
 		}
2329 2329
 
2330 2330
 	}
@@ -2335,13 +2335,13 @@  discard block
 block discarded – undo
2335 2335
 	 * @param  array $tab_array  This is an array of message type tab details used to generate the tabs
2336 2336
 	 * @return string            html formatted tabs
2337 2337
 	 */
2338
-	protected function _get_mt_tabs( $tab_array ) {
2338
+	protected function _get_mt_tabs($tab_array) {
2339 2339
 		$tab_array = (array) $tab_array;
2340
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_mt_settings_tab_item.template.php';
2340
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_details_mt_settings_tab_item.template.php';
2341 2341
 		$tabs = '';
2342 2342
 
2343
-		foreach ( $tab_array as $tab ) {
2344
-			$tabs .=  EEH_Template::display_template( $template, $tab, TRUE );
2343
+		foreach ($tab_array as $tab) {
2344
+			$tabs .= EEH_Template::display_template($template, $tab, TRUE);
2345 2345
 		}
2346 2346
 
2347 2347
 		return $tabs;
@@ -2355,7 +2355,7 @@  discard block
 block discarded – undo
2355 2355
 	 * @param  object $messenger The messenger we're setting up content for
2356 2356
 	 * @return string            html formatted content
2357 2357
 	 */
2358
-	protected function _get_messenger_box_content( $messenger ) {
2358
+	protected function _get_messenger_box_content($messenger) {
2359 2359
 
2360 2360
 		$fields = $messenger->get_admin_settings_fields();
2361 2361
 		$settings_template_args['template_form_fields'] = '';
@@ -2364,27 +2364,27 @@  discard block
 block discarded – undo
2364 2364
 		$settings_template_args['active'] = isset($this->_active_messengers[$messenger->name]) ? TRUE : FALSE;
2365 2365
 
2366 2366
 
2367
-		if ( !empty( $fields ) ) {
2367
+		if ( ! empty($fields)) {
2368 2368
 
2369 2369
 			$existing_settings = $messenger->get_existing_admin_settings();
2370 2370
 
2371
-			foreach( $fields as $fldname => $fldprops ) {
2372
-				$field_id = $messenger->name . '-' . $fldname;
2371
+			foreach ($fields as $fldname => $fldprops) {
2372
+				$field_id = $messenger->name.'-'.$fldname;
2373 2373
 				$template_form_field[$field_id] = array(
2374
-					'name' => 'messenger_settings[' . $field_id . ']',
2374
+					'name' => 'messenger_settings['.$field_id.']',
2375 2375
 					'label' => $fldprops['label'],
2376 2376
 					'input' => $fldprops['field_type'],
2377 2377
 					'type' => $fldprops['value_type'],
2378 2378
 					'required' => $fldprops['required'],
2379 2379
 					'validation' => $fldprops['validation'],
2380
-					'value' => isset( $existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'],
2380
+					'value' => isset($existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'],
2381 2381
 					'css_class' => '',
2382 2382
 					'format' => $fldprops['format']
2383 2383
 					);
2384 2384
 			}
2385 2385
 
2386 2386
 
2387
-			$settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_m_activate_form' ) : '';
2387
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_m_activate_form') : '';
2388 2388
 		}
2389 2389
 
2390 2390
 		//we also need some hidden fields
@@ -2400,8 +2400,8 @@  discard block
 block discarded – undo
2400 2400
 			);
2401 2401
 
2402 2402
 		//make sure any active message types that are existing are included in the hidden fields
2403
-		if ( isset( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] ) ) {
2404
-			foreach ( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values ) {
2403
+		if (isset($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'])) {
2404
+			foreach ($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values) {
2405 2405
 				$settings_template_args['hidden_fields']['messenger_settings[message_types]['.$mt.']'] = array(
2406 2406
 						'type' => 'hidden',
2407 2407
 						'value' => $mt
@@ -2409,25 +2409,25 @@  discard block
 block discarded – undo
2409 2409
 			}
2410 2410
 		}
2411 2411
 
2412
-		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );
2412
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
2413 2413
 
2414
-		$active = isset( $this->_active_messengers[$messenger->name] ) ? TRUE : FALSE;
2414
+		$active = isset($this->_active_messengers[$messenger->name]) ? TRUE : FALSE;
2415 2415
 
2416 2416
 		$settings_template_args['messenger'] = $messenger->name;
2417 2417
 		$settings_template_args['description'] = $messenger->description;
2418 2418
 		$settings_template_args['show_hide_edit_form'] = $active ? '' : ' hidden';
2419 2419
 
2420 2420
 
2421
-		$settings_template_args['show_hide_edit_form'] = isset( $this->_active_messengers[$messenger->name] ) ? $settings_template_args['show_hide_edit_form'] : ' hidden';
2421
+		$settings_template_args['show_hide_edit_form'] = isset($this->_active_messengers[$messenger->name]) ? $settings_template_args['show_hide_edit_form'] : ' hidden';
2422 2422
 
2423
-		$settings_template_args['show_hide_edit_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : $settings_template_args['show_hide_edit_form'];
2423
+		$settings_template_args['show_hide_edit_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : $settings_template_args['show_hide_edit_form'];
2424 2424
 
2425 2425
 
2426 2426
 		$settings_template_args['on_off_action'] = $active ? 'messenger-off' : 'messenger-on';
2427
-		$settings_template_args['nonce'] = wp_create_nonce('activate_' . $messenger->name . '_toggle_nonce');
2427
+		$settings_template_args['nonce'] = wp_create_nonce('activate_'.$messenger->name.'_toggle_nonce');
2428 2428
 		$settings_template_args['on_off_status'] = $active ? true : false;
2429
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_m_settings_content.template.php';
2430
-		$content = EEH_Template::display_template( $template, $settings_template_args, TRUE);
2429
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_m_settings_content.template.php';
2430
+		$content = EEH_Template::display_template($template, $settings_template_args, TRUE);
2431 2431
 		return $content;
2432 2432
 	}
2433 2433
 
@@ -2441,39 +2441,39 @@  discard block
 block discarded – undo
2441 2441
 	public function activate_messenger_toggle() {
2442 2442
 		$success = TRUE;
2443 2443
 		//let's check that we have required data
2444
-		if ( !isset( $this->_req_data[ 'messenger' ] ) ) {
2445
-			EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2444
+		if ( ! isset($this->_req_data['messenger'])) {
2445
+			EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2446 2446
 			$success = FALSE;
2447 2447
 		}
2448 2448
 
2449 2449
 		//do a nonce check here since we're not arriving via a normal route
2450
-		$nonce = isset($this->_req_data[ 'activate_nonce' ]) ? sanitize_text_field( $this->_req_data[ 'activate_nonce'] ) : '';
2451
-		$nonce_ref = 'activate_' . $this->_req_data['messenger'] . '_toggle_nonce';
2450
+		$nonce = isset($this->_req_data['activate_nonce']) ? sanitize_text_field($this->_req_data['activate_nonce']) : '';
2451
+		$nonce_ref = 'activate_'.$this->_req_data['messenger'].'_toggle_nonce';
2452 2452
 
2453
-		$this->_verify_nonce( $nonce, $nonce_ref );
2453
+		$this->_verify_nonce($nonce, $nonce_ref);
2454 2454
 
2455 2455
 
2456 2456
 
2457
-		if ( !isset( $this->_req_data[ 'status' ])) {
2458
-			EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2457
+		if ( ! isset($this->_req_data['status'])) {
2458
+			EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2459 2459
 			$success = FALSE;
2460 2460
 		}
2461 2461
 
2462 2462
 		//do check to verify we have a valid status.
2463 2463
 		$status = $this->_req_data['status'];
2464 2464
 
2465
-		if ( $status != 'off' && $status != 'on' ) {
2466
-			EE_Error::add_error( sprintf( __('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'), $this->_req_data['status'] ), __FILE__, __FUNCTION__, __LINE__ );
2465
+		if ($status != 'off' && $status != 'on') {
2466
+			EE_Error::add_error(sprintf(__('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'), $this->_req_data['status']), __FILE__, __FUNCTION__, __LINE__);
2467 2467
 			$success = FALSE;
2468 2468
 		}
2469 2469
 
2470
-		if ( $success ) {
2470
+		if ($success) {
2471 2471
 			//made it here?  Stop dawdling then!!
2472
-			if ( $status == 'off' ) {
2472
+			if ($status == 'off') {
2473 2473
 				//off = deactivate.  get it?
2474
-				$success = $this->_activate_messenger( $this->_req_data['messenger'], TRUE );
2474
+				$success = $this->_activate_messenger($this->_req_data['messenger'], TRUE);
2475 2475
 			} else {
2476
-				$success = $this->_activate_messenger( $this->_req_data['messenger'] );
2476
+				$success = $this->_activate_messenger($this->_req_data['messenger']);
2477 2477
 			}
2478 2478
 		}
2479 2479
 
@@ -2499,26 +2499,26 @@  discard block
 block discarded – undo
2499 2499
 
2500 2500
 
2501 2501
 		//let's make sure we have the necessary data
2502
-		if ( !isset( $this->_req_data[ 'message_type' ] ) ) {
2503
-			EE_Error::add_error( __('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2502
+		if ( ! isset($this->_req_data['message_type'])) {
2503
+			EE_Error::add_error(__('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2504 2504
 			$success = FALSE;
2505 2505
 		}
2506 2506
 
2507 2507
 
2508 2508
 		//do a nonce check here since we're not arriving via a normal route
2509
-		$nonce = isset( $this->_req_data['mt_nonce'] ) ? sanitize_text_field( $this->_req_data['mt_nonce'] ) : '';
2510
-		$nonce_ref = $this->_req_data['message_type'] . '_nonce';
2509
+		$nonce = isset($this->_req_data['mt_nonce']) ? sanitize_text_field($this->_req_data['mt_nonce']) : '';
2510
+		$nonce_ref = $this->_req_data['message_type'].'_nonce';
2511 2511
 
2512
-		$this->_verify_nonce( $nonce, $nonce_ref );
2512
+		$this->_verify_nonce($nonce, $nonce_ref);
2513 2513
 
2514 2514
 
2515
-		if ( !isset( $this->_req_data[ 'messenger' ] ) ) {
2516
-			EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2515
+		if ( ! isset($this->_req_data['messenger'])) {
2516
+			EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2517 2517
 			$success = FALSE;
2518 2518
 		}
2519 2519
 
2520
-		if ( !isset( $this->_req_data[ 'status' ])) {
2521
-			EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2520
+		if ( ! isset($this->_req_data['status'])) {
2521
+			EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2522 2522
 			$success = FALSE;
2523 2523
 		}
2524 2524
 
@@ -2526,16 +2526,16 @@  discard block
 block discarded – undo
2526 2526
 		//do check to verify we have a valid status.
2527 2527
 		$status = $this->_req_data['status'];
2528 2528
 
2529
-		if ( $status != 'activate' && $status != 'deactivate' ) {
2530
-			EE_Error::add_error( sprintf( __('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'), $this->_req_data['status'] ), __FILE__, __FUNCTION__, __LINE__ );
2529
+		if ($status != 'activate' && $status != 'deactivate') {
2530
+			EE_Error::add_error(sprintf(__('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'), $this->_req_data['status']), __FILE__, __FUNCTION__, __LINE__);
2531 2531
 			$success = FALSE;
2532 2532
 		}
2533 2533
 
2534 2534
 
2535
-		if ( $success ) {
2535
+		if ($success) {
2536 2536
 			//made it here? um, what are you waiting for then?
2537 2537
 			$deactivate = $status == 'deactivate' ? TRUE : FALSE;
2538
-			$success = $this->_activate_messenger( $this->_req_data['messenger'], $deactivate, $this->_req_data['message_type'] );
2538
+			$success = $this->_activate_messenger($this->_req_data['messenger'], $deactivate, $this->_req_data['message_type']);
2539 2539
 		}
2540 2540
 
2541 2541
 		$this->_template_args['success'] = $success;
@@ -2562,28 +2562,28 @@  discard block
 block discarded – undo
2562 2562
 		$templates = TRUE;
2563 2563
 		$this->_set_m_mt_settings();
2564 2564
 
2565
-		if ( !$deactivate ) {
2565
+		if ( ! $deactivate) {
2566 2566
 
2567 2567
 
2568 2568
 			//we are activating.  we can use $this->_m_mt_settings to get all the installed messengers
2569
-			$this->_active_messengers[$messenger]['settings'] = !isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings'];
2569
+			$this->_active_messengers[$messenger]['settings'] = ! isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings'];
2570 2570
 			$this->_active_messengers[$messenger]['obj'] = $this->_m_mt_settings['messenger_tabs'][$messenger]['obj'];
2571 2571
 
2572 2572
 			//get has_active so we can sure its kept up to date.
2573
-			$has_activated = get_option( 'ee_has_activated_messages' );
2573
+			$has_activated = get_option('ee_has_activated_messages');
2574 2574
 
2575
-			if ( empty( $has_activated[$messenger] ) ) {
2575
+			if (empty($has_activated[$messenger])) {
2576 2576
 				$has_activated[$messenger] = array();
2577 2577
 			}
2578 2578
 
2579 2579
 			//k we need to get what default message types are to be associated with the messenger that's been activated.
2580 2580
 			$default_types = $message_type ? (array) $message_type : $this->_active_messengers[$messenger]['obj']->get_default_message_types();
2581 2581
 
2582
-			foreach ( $default_types as $type ) {
2582
+			foreach ($default_types as $type) {
2583 2583
 				$settings_fields = $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$type]['obj']->get_admin_settings_fields();
2584
-				if ( !empty( $settings_fields ) ) {
2584
+				if ( ! empty($settings_fields)) {
2585 2585
 					//we have fields for this message type so let's get the defaults for saving.
2586
-					foreach ( $settings_fields as $field => $values ) {
2586
+					foreach ($settings_fields as $field => $values) {
2587 2587
 						$settings[$field] = $values['default'];
2588 2588
 					}
2589 2589
 					//let's set the data for reloading this message type form in ajax
@@ -2591,9 +2591,9 @@  discard block
 block discarded – undo
2591 2591
 				} else {
2592 2592
 					$settings = array();
2593 2593
 				}
2594
-				$this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$type]['settings'] =  $settings;
2594
+				$this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$type]['settings'] = $settings;
2595 2595
 
2596
-				if ( ! in_array( $type, $has_activated[$messenger] ) ) {
2596
+				if ( ! in_array($type, $has_activated[$messenger])) {
2597 2597
 					$has_activated[$messenger][] = $type;
2598 2598
 				}
2599 2599
 			}
@@ -2601,41 +2601,41 @@  discard block
 block discarded – undo
2601 2601
 			//any default settings for the messenger?
2602 2602
 			$msgr_settings = $this->_active_messengers[$messenger]['obj']->get_admin_settings_fields();
2603 2603
 
2604
-			if ( !empty( $msgr_settings ) ) {
2605
-				foreach ( $msgr_settings as $field => $value ) {
2604
+			if ( ! empty($msgr_settings)) {
2605
+				foreach ($msgr_settings as $field => $value) {
2606 2606
 					$this->_active_messengers[$messenger]['settings'][$field] = $value;
2607 2607
 				}
2608 2608
 			}
2609 2609
 
2610 2610
 			//update settings in database
2611
-			EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2612
-			update_option( 'ee_has_activated_messages', $has_activated );
2611
+			EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2612
+			update_option('ee_has_activated_messages', $has_activated);
2613 2613
 
2614 2614
 
2615 2615
 			//generate new templates (if necessary)
2616
-			$templates = $this->_generate_new_templates( $messenger, $default_types, 0, TRUE );
2616
+			$templates = $this->_generate_new_templates($messenger, $default_types, 0, TRUE);
2617 2617
 
2618 2618
 			EE_Error::overwrite_success();
2619 2619
 
2620 2620
 			//if generation failed then we need to remove the active messenger.
2621
-			if ( !$templates ) {
2621
+			if ( ! $templates) {
2622 2622
 				unset($this->_active_messengers[$messenger]);
2623
-				EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2623
+				EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2624 2624
 			} else {
2625 2625
 				//all is good let's do a success message
2626
-				if ( $message_type ) {
2627
-					EE_Error::add_success( sprintf( __('%s message type has been successfully activated with the %s messenger', 'event_espresso'),ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$message_type]['obj']->label['singular']), ucwords( $this->_active_messengers[$messenger]['obj']->label['singular'] ) ) );
2626
+				if ($message_type) {
2627
+					EE_Error::add_success(sprintf(__('%s message type has been successfully activated with the %s messenger', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$message_type]['obj']->label['singular']), ucwords($this->_active_messengers[$messenger]['obj']->label['singular'])));
2628 2628
 
2629 2629
 					//if message type was invoice then let's make sure we activate the invoice payment method.
2630
-					if ( $message_type == 'invoice' ) {
2631
-						EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
2632
-						$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
2633
-						if ( $pm instanceof EE_Payment_Method ) {
2634
-							EE_Error::add_attention( __('Activating the invoice message type also automatically activates the invoice payment method.  If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso' ) );
2630
+					if ($message_type == 'invoice') {
2631
+						EE_Registry::instance()->load_lib('Payment_Method_Manager');
2632
+						$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
2633
+						if ($pm instanceof EE_Payment_Method) {
2634
+							EE_Error::add_attention(__('Activating the invoice message type also automatically activates the invoice payment method.  If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso'));
2635 2635
 						}
2636 2636
 					}
2637 2637
 				} else {
2638
-					EE_Error::add_success( sprintf( __('%s messenger has been successfully activated', 'event_espresso'), ucwords( $this->_active_messengers[$messenger]['obj']->label['singular'] ) ) );
2638
+					EE_Error::add_success(sprintf(__('%s messenger has been successfully activated', 'event_espresso'), ucwords($this->_active_messengers[$messenger]['obj']->label['singular'])));
2639 2639
 				}
2640 2640
 			}
2641 2641
 
@@ -2651,36 +2651,36 @@  discard block
 block discarded – undo
2651 2651
 			$update_array = array(
2652 2652
 				'MTP_messenger' => $messenger);
2653 2653
 
2654
-			if ( $message_type ) {
2654
+			if ($message_type) {
2655 2655
 				$update_array['MTP_message_type'] = $message_type;
2656 2656
 			}
2657 2657
 
2658
-			$success = $MTP->update( array( 'MTP_is_active' => 0 ), array($update_array) );
2658
+			$success = $MTP->update(array('MTP_is_active' => 0), array($update_array));
2659 2659
 
2660 2660
 			$messenger_obj = $this->_active_messengers[$messenger]['obj'];
2661 2661
 
2662 2662
 			//if this is a message type deactivation then we're only unsetting the message type otherwise unset the messenger
2663
-			if ( $message_type ) {
2664
-				unset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] );
2663
+			if ($message_type) {
2664
+				unset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type]);
2665 2665
 			} else {
2666
-				unset( $this->_active_messengers[$messenger] );
2666
+				unset($this->_active_messengers[$messenger]);
2667 2667
 			}
2668 2668
 
2669
-			EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2669
+			EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2670 2670
 			EE_Error::overwrite_success();
2671
-			if ( $message_type ) {
2672
-				EE_Error::add_success( sprintf( __('%s message type has been successfully deactivated', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['active'][$message_type]['obj']->label['singular']) ) );
2671
+			if ($message_type) {
2672
+				EE_Error::add_success(sprintf(__('%s message type has been successfully deactivated', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['active'][$message_type]['obj']->label['singular'])));
2673 2673
 			} else {
2674
-				EE_Error::add_success( sprintf( __('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular'] ) ) );
2674
+				EE_Error::add_success(sprintf(__('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular'])));
2675 2675
 			}
2676 2676
 
2677 2677
 			//if messenger was html or message type was invoice then let's make sure we deactivate invoice payment method.
2678
-			if ( $messenger == 'html'  || $message_type == 'invoice') {
2679
-				EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
2680
-				$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( 'invoice' );
2681
-				if ( $count_updated > 0 ) {
2682
-					$msg = $message_type == 'invoice' ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then vist the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' ) : __('Deactivating the html messenger also automatically deactivates the invoice payment method.  In order for invoices to be generated the html messenger must be be active.  If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' );
2683
-					EE_Error::add_attention( $msg );
2678
+			if ($messenger == 'html' || $message_type == 'invoice') {
2679
+				EE_Registry::instance()->load_lib('Payment_Method_Manager');
2680
+				$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method('invoice');
2681
+				if ($count_updated > 0) {
2682
+					$msg = $message_type == 'invoice' ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then vist the payment methods admin page to reactivate the invoice payment method.', 'event_espresso') : __('Deactivating the html messenger also automatically deactivates the invoice payment method.  In order for invoices to be generated the html messenger must be be active.  If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso');
2683
+					EE_Error::add_attention($msg);
2684 2684
 				}
2685 2685
 			}
2686 2686
 
@@ -2697,8 +2697,8 @@  discard block
 block discarded – undo
2697 2697
 	 * @return string html data
2698 2698
 	 */
2699 2699
 	public function update_mt_form() {
2700
-		if ( !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['message_type'] ) ) {
2701
-			EE_Error::add_error( __('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__ );
2700
+		if ( ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['message_type'])) {
2701
+			EE_Error::add_error(__('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__);
2702 2702
 			$this->_return_json();
2703 2703
 		}
2704 2704
 
@@ -2707,7 +2707,7 @@  discard block
 block discarded – undo
2707 2707
 		$message_type = $message_types[$this->_req_data['message_type']]['obj'];
2708 2708
 		$messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj'];
2709 2709
 
2710
-		$content = $this->_message_type_settings_content ( $message_type, $messenger, TRUE, TRUE );
2710
+		$content = $this->_message_type_settings_content($message_type, $messenger, TRUE, TRUE);
2711 2711
 		$this->_template_args['success'] = true;
2712 2712
 		$this->_template_args['content'] = $content;
2713 2713
 		$this->_return_json();
@@ -2721,36 +2721,36 @@  discard block
 block discarded – undo
2721 2721
 	 * @return json success or fail message
2722 2722
 	 */
2723 2723
 	public function save_settings() {
2724
-		if ( !isset( $this->_req_data['type'] ) ) {
2725
-			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2724
+		if ( ! isset($this->_req_data['type'])) {
2725
+			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2726 2726
 			$this->_template_args['error'] = TRUE;
2727 2727
 			$this->_return_json();
2728 2728
 		}
2729 2729
 
2730 2730
 
2731
-		if ( $this->_req_data['type'] == 'messenger' ) {
2731
+		if ($this->_req_data['type'] == 'messenger') {
2732 2732
 			$settings = $this->_req_data['messenger_settings']; //this should be an array.
2733 2733
 			$messenger = $settings['messenger'];
2734 2734
 			//let's setup the settings data
2735
-			foreach ( $settings as $key => $value ) {
2736
-				switch ( $key ) {
2735
+			foreach ($settings as $key => $value) {
2736
+				switch ($key) {
2737 2737
 					case 'messenger' :
2738
-						unset( $settings['messenger'] );
2738
+						unset($settings['messenger']);
2739 2739
 						break;
2740 2740
 					case 'message_types' :
2741
-						if ( isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] ) ) {
2742
-							foreach ( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] as $mt => $v ) {
2743
-								if ( isset( $settings['message_types'][$mt] ) )
2744
-									$settings[$messenger . '-message_types'][$mt]['settings'] = isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ? $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] : array();
2741
+						if (isset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'])) {
2742
+							foreach ($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'] as $mt => $v) {
2743
+								if (isset($settings['message_types'][$mt]))
2744
+									$settings[$messenger.'-message_types'][$mt]['settings'] = isset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]) ? $this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt] : array();
2745 2745
 							}
2746 2746
 						} else {
2747
-							foreach ( $value as $mt => $v ) {
2747
+							foreach ($value as $mt => $v) {
2748 2748
 								//let's see if this message type is already present and has settings.
2749
-								$settings[$messenger . '-message_types'][$mt]['settings'] = array();
2749
+								$settings[$messenger.'-message_types'][$mt]['settings'] = array();
2750 2750
 							}
2751 2751
 						}
2752 2752
 						//k settings are set let's get rid of the message types index
2753
-						unset( $settings['message_types'] );
2753
+						unset($settings['message_types']);
2754 2754
 						break;
2755 2755
 					default :
2756 2756
 						$settings[$key] = $value;
@@ -2760,36 +2760,36 @@  discard block
 block discarded – undo
2760 2760
 			$this->_active_messengers[$messenger]['settings'] = $settings;
2761 2761
 		}
2762 2762
 
2763
-		else if ( $this->_req_data['type'] == 'message_type' ) {
2763
+		else if ($this->_req_data['type'] == 'message_type') {
2764 2764
 			$settings = $this->_req_data['message_type_settings'];
2765 2765
 			$messenger = $settings['messenger'];
2766 2766
 			$message_type = $settings['message_type'];
2767 2767
 
2768
-			foreach ( $settings as $key => $value ) {
2769
-				switch ( $key ) {
2768
+			foreach ($settings as $key => $value) {
2769
+				switch ($key) {
2770 2770
 					case 'messenger' :
2771
-						unset( $settings['messenger'] );
2771
+						unset($settings['messenger']);
2772 2772
 						break;
2773 2773
 					case 'message_type' :
2774
-						unset( $settings['message_type'] );
2774
+						unset($settings['message_type']);
2775 2775
 						break;
2776 2776
 					default :
2777 2777
 						$settings['settings'][$key] = $value;
2778
-						unset( $settings[$key] );
2778
+						unset($settings[$key]);
2779 2779
 						break;
2780 2780
 				}
2781 2781
 			}
2782 2782
 
2783
-			$this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] = $settings;
2783
+			$this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type] = $settings;
2784 2784
 		}
2785 2785
 
2786 2786
 		//okay we should have the data all setup.  Now we just update!
2787
-		$success = EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2787
+		$success = EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2788 2788
 
2789
-		if ( $success ) {
2790
-			EE_Error::add_success( __('Settings updated', 'event_espresso') );
2789
+		if ($success) {
2790
+			EE_Error::add_success(__('Settings updated', 'event_espresso'));
2791 2791
 		} else {
2792
-			EE_Error::add_error( __('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2792
+			EE_Error::add_error(__('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2793 2793
 		}
2794 2794
 
2795 2795
 		$this->_template_args['success'] = $success;
Please login to merge, or discard this patch.
admin_pages/messages/Messages_Admin_Page_Init.core.php 3 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@
 block discarded – undo
1 1
 <?php if (!defined('EVENT_ESPRESSO_VERSION') )
2 2
 	exit('NO direct script access allowed');
3 3
 /**
4
- * Event Espresso
5
- *
6
- * Event Registration and Management Plugin for Wordpress
7
- *
8
- * @package		Event Espresso
9
- * @author		Seth Shoultes
10
- * @copyright	(c)2009-2012 Event Espresso All Rights Reserved.
11
- * @license		@link http://eventespresso.com/support/terms-conditions/  ** see Plugin Licensing * *
12
- * @link		http://www.eventespresso.com
13
- * @version		4.0
14
- *
15
- * ------------------------------------------------------------------------
16
- *
17
- * Messages_Admin_Page_Init
18
- *
19
- * for setup of the message admin pages
20
- *
21
- * @package		Event Espresso
22
- * @subpackage	includes/core/message/EE_Message_Admin_Page_Init.core.php
23
- * @author		Darren Ethier
24
- *
25
- * ------------------------------------------------------------------------
26
- */
4
+	 * Event Espresso
5
+	 *
6
+	 * Event Registration and Management Plugin for Wordpress
7
+	 *
8
+	 * @package		Event Espresso
9
+	 * @author		Seth Shoultes
10
+	 * @copyright	(c)2009-2012 Event Espresso All Rights Reserved.
11
+	 * @license		@link http://eventespresso.com/support/terms-conditions/  ** see Plugin Licensing * *
12
+	 * @link		http://www.eventespresso.com
13
+	 * @version		4.0
14
+	 *
15
+	 * ------------------------------------------------------------------------
16
+	 *
17
+	 * Messages_Admin_Page_Init
18
+	 *
19
+	 * for setup of the message admin pages
20
+	 *
21
+	 * @package		Event Espresso
22
+	 * @subpackage	includes/core/message/EE_Message_Admin_Page_Init.core.php
23
+	 * @author		Darren Ethier
24
+	 *
25
+	 * ------------------------------------------------------------------------
26
+	 */
27 27
 class Messages_Admin_Page_Init extends EE_Admin_Page_Init  {
28 28
 	/**
29 29
 	 *constructor
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION'))
2 2
 	exit('NO direct script access allowed');
3 3
 /**
4 4
  * Event Espresso
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * ------------------------------------------------------------------------
26 26
  */
27
-class Messages_Admin_Page_Init extends EE_Admin_Page_Init  {
27
+class Messages_Admin_Page_Init extends EE_Admin_Page_Init {
28 28
 	/**
29 29
 	 *constructor
30 30
 	 *@Constructor
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	public function __construct() {
35 35
 
36
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
36
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
37 37
 
38
-		define( 'EE_MSG_PG_SLUG', 'espresso_messages' );
39
-		define( 'EE_MSG_PG_NAME', ucwords( str_replace( '_', '', EE_MSG_PG_SLUG )));
40
-		define( 'EE_MSG_ADMIN', EE_ADMIN_PAGES . 'messages' . DS );
41
-		define( 'EE_MSG_ADMIN_URL', admin_url( 'admin.php?page=' . EE_MSG_PG_SLUG ));
42
-		define( 'EE_MSG_ASSETS_PATH', EE_MSG_ADMIN . 'assets' . DS );
43
-		define( 'EE_MSG_ASSETS_URL', EE_ADMIN_PAGES_URL  . 'messages/assets/' );
44
-		define( 'EE_MSG_TEMPLATE_PATH', EE_MSG_ADMIN . 'templates' . DS );
45
-		define( 'EE_MSG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'messages/templates/' );
38
+		define('EE_MSG_PG_SLUG', 'espresso_messages');
39
+		define('EE_MSG_PG_NAME', ucwords(str_replace('_', '', EE_MSG_PG_SLUG)));
40
+		define('EE_MSG_ADMIN', EE_ADMIN_PAGES.'messages'.DS);
41
+		define('EE_MSG_ADMIN_URL', admin_url('admin.php?page='.EE_MSG_PG_SLUG));
42
+		define('EE_MSG_ASSETS_PATH', EE_MSG_ADMIN.'assets'.DS);
43
+		define('EE_MSG_ASSETS_URL', EE_ADMIN_PAGES_URL.'messages/assets/');
44
+		define('EE_MSG_TEMPLATE_PATH', EE_MSG_ADMIN.'templates'.DS);
45
+		define('EE_MSG_TEMPLATE_URL', EE_ADMIN_PAGES_URL.'messages/templates/');
46 46
 
47 47
 		parent::__construct();
48 48
 	}
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
 
59 59
 	protected function _set_menu_map() {
60
-		$this->_menu_map = new EE_Admin_Page_Sub_Menu( array(
60
+		$this->_menu_map = new EE_Admin_Page_Sub_Menu(array(
61 61
 			'menu_group' => 'management',
62 62
 			'menu_order' => 10,
63 63
 			'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,6 @@
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
1
+<?php if (!defined('EVENT_ESPRESSO_VERSION') ) {
2 2
 	exit('NO direct script access allowed');
3
+}
3 4
 /**
4 5
  * Event Espresso
5 6
  *
Please login to merge, or discard this patch.
admin_pages/messages/Messages_Template_List_Table.class.php 2 patches
Spacing   +44 added lines, -44 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
 /**
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 
32 32
 
33 33
 	protected function _setup_data() {
34
-		$this->_data = $this->_admin_page->get_message_templates( $this->_per_page, $this->_view, FALSE);
35
-		$this->_all_data_count = $this->_admin_page->get_message_templates( $this->_per_page, $this->_view, TRUE, TRUE );
34
+		$this->_data = $this->_admin_page->get_message_templates($this->_per_page, $this->_view, FALSE);
35
+		$this->_all_data_count = $this->_admin_page->get_message_templates($this->_per_page, $this->_view, TRUE, TRUE);
36 36
 	}
37 37
 
38 38
 
@@ -41,21 +41,21 @@  discard block
 block discarded – undo
41 41
 
42 42
 	protected function _set_properties() {
43 43
 		$this->_wp_list_args = array(
44
-			'singular' => __('Message Template Group', 'event_espresso' ),
45
-			'plural' => __('Message Template', 'event_espresso' ),
44
+			'singular' => __('Message Template Group', 'event_espresso'),
45
+			'plural' => __('Message Template', 'event_espresso'),
46 46
 			'ajax' => TRUE, //for now,
47 47
 			'screen' => $this->_admin_page->get_current_screen()->id
48 48
 			);
49 49
 		$this->_columns = array(
50 50
 			//'cb' => '<input type="checkbox" />', //no deleting default (global) templates!
51 51
 			'message_type' => __('Message Type', 'event_espresso'),
52
-			'messenger' => __( 'Messenger', 'event_espresso'),
53
-			'description' => __( 'Description', 'event_espresso' ),
52
+			'messenger' => __('Messenger', 'event_espresso'),
53
+			'description' => __('Description', 'event_espresso'),
54 54
 			//'messages_sent' => __( 'Total Sent', 'event_espresso' ) //todo this will come later when we've got message tracking in place.
55 55
 			);
56 56
 
57 57
 		$this->_sortable_columns = array(
58
-			'messenger' => array( 'MTP_messenger' => TRUE ),
58
+			'messenger' => array('MTP_messenger' => TRUE),
59 59
 			//'message_type' => array( 'MTP_message_type' => FALSE )
60 60
 			);
61 61
 
@@ -74,16 +74,16 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @return string
76 76
 	 */
77
-	public function single_row( $item ) {
77
+	public function single_row($item) {
78 78
 		$message_type = $item->message_type_obj();
79 79
 		$messenger = $item->messenger_obj();
80 80
 
81
-		if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger ) {
81
+		if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger) {
82 82
 			echo '';
83 83
 			return;
84 84
 		}
85 85
 
86
-		parent::single_row( $item );
86
+		parent::single_row($item);
87 87
 	}
88 88
 
89 89
 
@@ -92,24 +92,24 @@  discard block
 block discarded – undo
92 92
 
93 93
 	protected function _get_table_filters() {
94 94
 		$filters = array();
95
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
95
+		EE_Registry::instance()->load_helper('Form_Fields');
96 96
 		$messengers = $this->_admin_page->get_active_messengers();
97 97
 		$message_types = $this->_admin_page->get_installed_message_types();
98 98
 
99 99
 
100 100
 		//setup messengers for selects
101
-		$i=1;
101
+		$i = 1;
102 102
 		$m_values[0]['id'] = 'all';
103
-		$m_values[0]['text'] = __('All Messengers', 'event_espresso' );
104
-		foreach ( $messengers as $messenger => $args ) {
103
+		$m_values[0]['text'] = __('All Messengers', 'event_espresso');
104
+		foreach ($messengers as $messenger => $args) {
105 105
 			$m_values[$i]['id'] = $messenger;
106 106
 			$m_values[$i]['text'] = ucwords($args['obj']->label['singular']);
107 107
 			$i++;
108 108
 		}
109 109
 
110 110
 		//lets do the same for message types
111
-		$i=1;
112
-		foreach ( $message_types as $message_type => $args ) {
111
+		$i = 1;
112
+		foreach ($message_types as $message_type => $args) {
113 113
 			$mt_values[$i]['id'] = $message_type;
114 114
 			$mt_values[$i]['text'] = ucwords($args['obj']->label['singular']);
115 115
 			$i++;
@@ -125,28 +125,28 @@  discard block
 block discarded – undo
125 125
 			'text' => __('Show All', 'event_espresso')
126 126
 			);
127 127
 
128
-		$msgr_filters = !empty($m_values) ? array_merge( $msgr_default, $m_values ) : array();
129
-		$mt_filters = !empty($mt_values) ? array_merge( $mt_default, $mt_values ) : array();
128
+		$msgr_filters = ! empty($m_values) ? array_merge($msgr_default, $m_values) : array();
129
+		$mt_filters = ! empty($mt_values) ? array_merge($mt_default, $mt_values) : array();
130 130
 
131
-		if ( empty( $m_values ) )
131
+		if (empty($m_values))
132 132
 			$msgr_filters[0] = array(
133 133
 				'id' => 'no_messenger_options',
134 134
 				'text' => __('No Messengers active', 'event_espresso')
135 135
 				);
136 136
 
137
-		if ( empty($mt_values) )
137
+		if (empty($mt_values))
138 138
 			$mt_filters[0] = array(
139 139
 				'id' => 'no_message_type_options',
140 140
 				'text' => __('No Message Types active', 'event_espresso')
141 141
 				);
142 142
 
143
-		if ( count( $messengers ) >= 1  && !empty( $m_values ) ) {
144
-			unset( $msgr_filters[0] );
145
-			$msgr_filters = array_values( $msgr_filters ); //reindex keys
143
+		if (count($messengers) >= 1 && ! empty($m_values)) {
144
+			unset($msgr_filters[0]);
145
+			$msgr_filters = array_values($msgr_filters); //reindex keys
146 146
 		}
147 147
 
148
-		$filters[] = EEH_Form_Fields::select_input('ee_messenger_filter_by', $msgr_filters, isset($this->_req_data['ee_messenger_filter_by']) ? sanitize_key( $this->_req_data['ee_messenger_filter_by']) : '' );
149
-		$filters[] = EEH_Form_Fields::select_input('ee_message_type_filter_by', $mt_filters, isset($this->_req_data['ee_message_type_filter_by']) ? sanitize_key( $this->_req_data['ee_message_type_filter_by']) : '');
148
+		$filters[] = EEH_Form_Fields::select_input('ee_messenger_filter_by', $msgr_filters, isset($this->_req_data['ee_messenger_filter_by']) ? sanitize_key($this->_req_data['ee_messenger_filter_by']) : '');
149
+		$filters[] = EEH_Form_Fields::select_input('ee_message_type_filter_by', $mt_filters, isset($this->_req_data['ee_message_type_filter_by']) ? sanitize_key($this->_req_data['ee_message_type_filter_by']) : '');
150 150
 		return $filters;
151 151
 	}
152 152
 
@@ -154,20 +154,20 @@  discard block
 block discarded – undo
154 154
 	 * we're just removing the search box for message templates, not needed.
155 155
 	 * @return string (empty);
156 156
 	 */
157
-	function search_box( $text, $input_id ) {
157
+	function search_box($text, $input_id) {
158 158
 		return '';
159 159
 	}
160 160
 
161 161
 
162 162
 	protected function _add_view_counts() {
163
-		foreach ( $this->_views as $view => $args )  {
164
-			$this->_views[$view]['count'] = $this->_admin_page->get_message_templates( $this->_per_page, $view, TRUE, TRUE );
163
+		foreach ($this->_views as $view => $args) {
164
+			$this->_views[$view]['count'] = $this->_admin_page->get_message_templates($this->_per_page, $view, TRUE, TRUE);
165 165
 		}
166 166
 	}
167 167
 
168 168
 
169 169
 
170
-	public function column_cb( $item ) {
170
+	public function column_cb($item) {
171 171
 		return '';
172 172
 	}
173 173
 
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 
176 176
 
177 177
 
178
-	function column_description( $item ) {
179
-		return '<p>' . $item->message_type_obj()->description . '</p>';
178
+	function column_description($item) {
179
+		return '<p>'.$item->message_type_obj()->description.'</p>';
180 180
 	}
181 181
 
182 182
 
@@ -191,27 +191,27 @@  discard block
 block discarded – undo
191 191
 		$actions = array();
192 192
 
193 193
 		// edit link but only if item isn't trashed.
194
-		if ( !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ) {
195
-			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_message_template', 'id'=>$item->GRP_ID() ), EE_MSG_ADMIN_URL );
196
-			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template Group', 'event_espresso' ) . '">' . __( 'Edit', 'event_espresso' ) . '</a>';
194
+		if ( ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID())) {
195
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID()), EE_MSG_ADMIN_URL);
196
+			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template Group', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>';
197 197
 		}
198 198
 
199
-		$name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template Group', 'event_espresso' ) . '">' . ucwords( $item->messenger_obj()->label['singular'] ) . '</a>' : ucwords( $item->messenger_obj()->label['singular'] );
199
+		$name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template Group', 'event_espresso').'">'.ucwords($item->messenger_obj()->label['singular']).'</a>' : ucwords($item->messenger_obj()->label['singular']);
200 200
 
201 201
 		//we want to display the contexts in here so we need to set them up
202 202
 		$c_label = $item->context_label();
203 203
 		$c_configs = $item->contexts_config();
204 204
 		$ctxt = array();
205 205
 		$context_templates = $item->context_templates();
206
-		foreach ( $context_templates as $context => $template_fields ) {
207
-			$mtp_to = !empty( $context_templates[$context]['to'] ) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL;
208
-			$inactive = empty( $mtp_to ) && !empty( $context_templates[$context]['to'] ) ? ' class="mtp-inactive"' : '';
206
+		foreach ($context_templates as $context => $template_fields) {
207
+			$mtp_to = ! empty($context_templates[$context]['to']) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL;
208
+			$inactive = empty($mtp_to) && ! empty($context_templates[$context]['to']) ? ' class="mtp-inactive"' : '';
209 209
 			$context_title = ucwords($c_configs[$context]['label']);
210
-			$edit_link = EE_Admin_Page::add_query_args_and_nonce( array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL );
211
-			$ctxt[] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? '<a' . $inactive . ' href="'. $edit_link . '" title="' . esc_attr__('Edit Context', 'event_espresso') . '">' . $context_title . '</a>' : $context_title;
210
+			$edit_link = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL);
211
+			$ctxt[] = EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a'.$inactive.' href="'.$edit_link.'" title="'.esc_attr__('Edit Context', 'event_espresso').'">'.$context_title.'</a>' : $context_title;
212 212
 		}
213 213
 
214
-		$ctx_content = !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? sprintf( __('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural']) ) . implode(' | ', $ctxt) : '';
214
+		$ctx_content = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? sprintf(__('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural'])).implode(' | ', $ctxt) : '';
215 215
 
216 216
 
217 217
 		//Return the name contents
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 										/* $1%s */ $name_link,
220 220
 										/* $2%s */ $item->GRP_ID(),
221 221
 										/* %4$s */ $ctx_content,
222
-										/* $3%s */ $this->row_actions( $actions )
222
+										/* $3%s */ $this->row_actions($actions)
223 223
 		);
224 224
 	}
225 225
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 * @return string       message_type name
230 230
 	 */
231 231
 	function column_message_type($item) {
232
-		return ucwords($item->message_type_obj()->label['singular'] );
232
+		return ucwords($item->message_type_obj()->label['singular']);
233 233
 	}
234 234
 
235 235
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -5 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
@@ -128,17 +129,19 @@  discard block
 block discarded – undo
128 129
 		$msgr_filters = !empty($m_values) ? array_merge( $msgr_default, $m_values ) : array();
129 130
 		$mt_filters = !empty($mt_values) ? array_merge( $mt_default, $mt_values ) : array();
130 131
 
131
-		if ( empty( $m_values ) )
132
-			$msgr_filters[0] = array(
132
+		if ( empty( $m_values ) ) {
133
+					$msgr_filters[0] = array(
133 134
 				'id' => 'no_messenger_options',
134 135
 				'text' => __('No Messengers active', 'event_espresso')
135 136
 				);
137
+		}
136 138
 
137
-		if ( empty($mt_values) )
138
-			$mt_filters[0] = array(
139
+		if ( empty($mt_values) ) {
140
+					$mt_filters[0] = array(
139 141
 				'id' => 'no_message_type_options',
140 142
 				'text' => __('No Message Types active', 'event_espresso')
141 143
 				);
144
+		}
142 145
 
143 146
 		if ( count( $messengers ) >= 1  && !empty( $m_values ) ) {
144 147
 			unset( $msgr_filters[0] );
Please login to merge, or discard this patch.
admin_pages/messages/espresso_events_Messages_Hooks.class.php 2 patches
Spacing   +2 added lines, -2 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
 /**
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 class espresso_events_Messages_Hooks extends EE_Admin_Hooks {
31 31
 
32 32
 
33
-	public function __construct( EE_Admin_Page $admin_page ) {
33
+	public function __construct(EE_Admin_Page $admin_page) {
34 34
 		parent::__construct($admin_page);
35 35
 	}
36 36
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 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
Please login to merge, or discard this patch.
admin_pages/messages/help_tabs/messages_overview_messengers.help_tab.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1 1
 <h3><?php _e('Messengers', 'event_espresso'); ?></h3>
2 2
 <p>
3
-<?php printf( __('Messengers are the vehicles that deliver messages to individuals (recipients). By default, every install of Event Espresso has the %sEmail%s messenger active. The Email messenger is a vehicle for delivering messages.  Other possible vehicles might be any social media applications, 3rd party API\'s etc.', 'event_espresso'), '<strong>', '</strong>' ); ?>
3
+<?php printf(__('Messengers are the vehicles that deliver messages to individuals (recipients). By default, every install of Event Espresso has the %sEmail%s messenger active. The Email messenger is a vehicle for delivering messages.  Other possible vehicles might be any social media applications, 3rd party API\'s etc.', 'event_espresso'), '<strong>', '</strong>'); ?>
4 4
 </p>
5 5
\ No newline at end of file
Please login to merge, or discard this patch.
admin_pages/messages/help_tabs/messages_settings_messengers.help_tab.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <h3><?php _e('Activating / Deactivating Messengers', 'event_espresso'); ?></h3>
2 2
 <p><?php _e('You can select Messengers via the tabs across the top of the settings page. The available messengers you see depends on what version of Event Espresso you have and what addons are installed. Every install include an "Email" messenger tab.  When you click one of those tabs it will display that messenger.', 'event_espresso'); ?></p>
3 3
 <p><?php _e('There are two ways to determine whether a messenger is active or not.  The first way is via the messenger tab itself.', 'event_espresso'); ?></p>
4
-<p><?php echo _e('The green colored gear <img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '" alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" /> indicates that this messenger is currently active.', 'event_espresso'); echo _e(' The white colored gear <img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" /> indicates the messenger is inactive. This is very helpful for seeing at a glance all the messengers that are active when you first view the page.', 'event_espresso'); ?></p>
4
+<p><?php echo _e('The green colored gear <img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'" alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" /> indicates that this messenger is currently active.', 'event_espresso'); echo _e(' The white colored gear <img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'.'" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" /> indicates the messenger is inactive. This is very helpful for seeing at a glance all the messengers that are active when you first view the page.', 'event_espresso'); ?></p>
5 5
 <p><?php _e('The second way to determine whether a messenger is active or not is via the "on/off" button in the top right corner of the active messenger displayed content:', 'event_espresso'); ?></p>
6
-<p><?php printf( __('%1$s means of course that the messenger is active and %2$s means the messenger is inactive.', 'event_espresso'), '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked="checked" disabled><label for="ee-on-off-toggle-on"></label></div>', '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" disabled><label for="ee-on-off-toggle-on"></label></div>' ); ?></p>
7
-<p><?php _e( 'The on/off toggle is also what you use to activate or deactivate a messenger.', 'event_espresso' ); ?></p>
8
-<p><?php _e( 'What happens when you click the toggle to activate is the messenger is activated and the system determines what default message types are activated with the messenger.  Then, if there are any default settings for either the messenger or message types those settings are saved.  Next, the system will generate any default templates (if none have been generated before, if there are previously generated templates then they are reactivated).  Finally, you will see the display change to reflect that the messenger is active. If the messenger has settings you can modify them then. Any message types that have settings will also automatically expand so you can see the default settings and make any changes as necessary to fit your needs. Usually the defaults are sufficient however.', 'event_espresso'); ?></p>
9
-<p><?php _e( 'When you deactivate a messenger, the system will first check if there are any custom event templates for that messenger. If there are you will be unable to deactivate the messenger. This is a fail safe to make sure you know that no messages will go out for those specific events so you don\'t accidentally deactivate.  If this check passes, then the system will deactivate any global templates for that messenger (note the templates are not erased, they just become inactive, so if you decide to reactivate the messenger later all your customizations are preserved). Then the display will change to reflect the deactivation.', 'event_espresso'); ?></p>
6
+<p><?php printf(__('%1$s means of course that the messenger is active and %2$s means the messenger is inactive.', 'event_espresso'), '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked="checked" disabled><label for="ee-on-off-toggle-on"></label></div>', '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" disabled><label for="ee-on-off-toggle-on"></label></div>'); ?></p>
7
+<p><?php _e('The on/off toggle is also what you use to activate or deactivate a messenger.', 'event_espresso'); ?></p>
8
+<p><?php _e('What happens when you click the toggle to activate is the messenger is activated and the system determines what default message types are activated with the messenger.  Then, if there are any default settings for either the messenger or message types those settings are saved.  Next, the system will generate any default templates (if none have been generated before, if there are previously generated templates then they are reactivated).  Finally, you will see the display change to reflect that the messenger is active. If the messenger has settings you can modify them then. Any message types that have settings will also automatically expand so you can see the default settings and make any changes as necessary to fit your needs. Usually the defaults are sufficient however.', 'event_espresso'); ?></p>
9
+<p><?php _e('When you deactivate a messenger, the system will first check if there are any custom event templates for that messenger. If there are you will be unable to deactivate the messenger. This is a fail safe to make sure you know that no messages will go out for those specific events so you don\'t accidentally deactivate.  If this check passes, then the system will deactivate any global templates for that messenger (note the templates are not erased, they just become inactive, so if you decide to reactivate the messenger later all your customizations are preserved). Then the display will change to reflect the deactivation.', 'event_espresso'); ?></p>
10 10
 <p><strong><?php _e('Important', 'event_espresso'); ?></strong><br />
11 11
 <?php _e('Although customizations made to global templates are preserved when a messenger is deactivated, any settings for that messenger (or the message types that were attached to it) are lost on deactivation.  Also, once you deactivate a messenger, no more messages will be delivered using that messenger for any of your events.', 'event_espresso'); ?></p>
Please login to merge, or discard this patch.