@@ -5,39 +5,39 @@ discard block |
||
5 | 5 | /** @type string $reset_db_action_url */ |
6 | 6 | /** @type EE_Data_Migration_Script_Base $most_recent_migration */ |
7 | 7 | ?> |
8 | -<?php if ( $success ) { ?> |
|
9 | - <h1><?php _e( "Data Migration Report Sent", "event_espresso" ); ?></h1> |
|
10 | - <p><?php _e( "A migration crash report email was sent to Event Espresso. You should hear back from us soon.", "event_espresso" ); ?></p> |
|
8 | +<?php if ($success) { ?> |
|
9 | + <h1><?php _e("Data Migration Report Sent", "event_espresso"); ?></h1> |
|
10 | + <p><?php _e("A migration crash report email was sent to Event Espresso. You should hear back from us soon.", "event_espresso"); ?></p> |
|
11 | 11 | <?php } else {//didn't send email properly ?> |
12 | - <h1><?php _e( "Migration Report not sent", "event_espresso" ); ?></h1> |
|
13 | - <p><?php _e( "An error occurred and we were not able to automatically send a report to Event Espresso support.", "event_espresso" ); ?></p> |
|
14 | - <p><?php printf( __( "Please copy-and-paste the system information below to %s", "event_espresso" ), '<a href="mailto:' . EE_SUPPORT_EMAIL . '">' .EE_SUPPORT_EMAIL . "</a>" ); ?></p> |
|
12 | + <h1><?php _e("Migration Report not sent", "event_espresso"); ?></h1> |
|
13 | + <p><?php _e("An error occurred and we were not able to automatically send a report to Event Espresso support.", "event_espresso"); ?></p> |
|
14 | + <p><?php printf(__("Please copy-and-paste the system information below to %s", "event_espresso"), '<a href="mailto:'.EE_SUPPORT_EMAIL.'">'.EE_SUPPORT_EMAIL."</a>"); ?></p> |
|
15 | 15 | <label> |
16 | - <?php _e( "system status info", "event_espresso" ); ?> |
|
17 | - <textarea name="system_status_info" class="system_status_info"><?php print_r( EEM_System_Status::instance()->get_system_stati() ); ?></textarea> |
|
16 | + <?php _e("system status info", "event_espresso"); ?> |
|
17 | + <textarea name="system_status_info" class="system_status_info"><?php print_r(EEM_System_Status::instance()->get_system_stati()); ?></textarea> |
|
18 | 18 | </label> |
19 | 19 | <?php } ?> |
20 | 20 | |
21 | 21 | |
22 | -<h1><?php _e( "What's next?", 'event_espresso' ); ?></h1> |
|
23 | -<p><?php _e( "Well, it depends on your situation:", 'event_espresso' ); ?></p> |
|
22 | +<h1><?php _e("What's next?", 'event_espresso'); ?></h1> |
|
23 | +<p><?php _e("Well, it depends on your situation:", 'event_espresso'); ?></p> |
|
24 | 24 | <div class='ee-table-wrap'> |
25 | 25 | <table> |
26 | 26 | <thead> |
27 | 27 | <tr> |
28 | - <th><?php _e( "Your Situation", 'event_espresso' ); ?></th> |
|
29 | - <th><?php _e( "Suggested Action", 'event_espresso' ); ?></th> |
|
28 | + <th><?php _e("Your Situation", 'event_espresso'); ?></th> |
|
29 | + <th><?php _e("Suggested Action", 'event_espresso'); ?></th> |
|
30 | 30 | </tr> |
31 | 31 | </thead> |
32 | 32 | <tbody> |
33 | 33 | <tr> |
34 | - <td><p class='big-text'><?php _e( "I want to retry migrating my data", 'event_espresso' ); ?></p></td> |
|
34 | + <td><p class='big-text'><?php _e("I want to retry migrating my data", 'event_espresso'); ?></p></td> |
|
35 | 35 | <td> |
36 | 36 | <p> |
37 | 37 | <?php |
38 | 38 | printf( |
39 | - __( 'First, %1$s check the forums %2$s to see if there is a solution before re-attempting to migrate. Often it helps to deactivate other plugins which may have conflicts; or it may help to add %3$s to your %4$s wp-config.php%5$s (which will make the migrations run slower, but may resolve any memory exhaustion errors.', 'event_espresso' ), |
|
40 | - "<a href='" . EE_SUPPORT_EMAIL . "' target='_blank'>", |
|
39 | + __('First, %1$s check the forums %2$s to see if there is a solution before re-attempting to migrate. Often it helps to deactivate other plugins which may have conflicts; or it may help to add %3$s to your %4$s wp-config.php%5$s (which will make the migrations run slower, but may resolve any memory exhaustion errors.', 'event_espresso'), |
|
40 | + "<a href='".EE_SUPPORT_EMAIL."' target='_blank'>", |
|
41 | 41 | '</a>', |
42 | 42 | '<pre lang="php">define( EE_MIGRATION_STEP_SIZE, 10 );</pre>', |
43 | 43 | '<b>', |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | <p> |
50 | 50 | <?php |
51 | 51 | printf( |
52 | - __( 'To retry migrating your data: restore to the backup you made before the migration and reactivate EE (and any addons you are using) and re-run the migration scripts. If you did not make a database migration and are migrating from EE3: delete your EE4 data (use the %1$s Reset/Delete Data tab above%2$s), and then reactivate EE4, and then re-run the migration scripts. If you did not make a database backup, are not migrating from EE3, have found a solution to the fatal error you received, and are willing to possibly have some data lost, %3$sattempt to continue migrating%2$s.', 'event_espresso' ), |
|
52 | + __('To retry migrating your data: restore to the backup you made before the migration and reactivate EE (and any addons you are using) and re-run the migration scripts. If you did not make a database migration and are migrating from EE3: delete your EE4 data (use the %1$s Reset/Delete Data tab above%2$s), and then reactivate EE4, and then re-run the migration scripts. If you did not make a database backup, are not migrating from EE3, have found a solution to the fatal error you received, and are willing to possibly have some data lost, %3$sattempt to continue migrating%2$s.', 'event_espresso'), |
|
53 | 53 | "<a href='$reset_db_page_url'>", |
54 | 54 | "</a>", |
55 | 55 | "<a class='button-primary' href='$reattempt_action_url'>" |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | </tr> |
61 | 61 | <tr> |
62 | 62 | <td> |
63 | - <p class='big-text'><?php _e( "I want to hear from Support before proceeding", 'event_espresso' ); ?></p> |
|
63 | + <p class='big-text'><?php _e("I want to hear from Support before proceeding", 'event_espresso'); ?></p> |
|
64 | 64 | </td> |
65 | 65 | <td> |
66 | 66 | <?php |
67 | 67 | printf( |
68 | - __( 'Just make sure you\'ve %1$s checked for a solution in the forums,%2$s and properly contacted Support. We will get back to you as soon as possible', 'event_espresso' ), |
|
69 | - "<a href='" . EE_SUPPORT_EMAIL . "'>", |
|
68 | + __('Just make sure you\'ve %1$s checked for a solution in the forums,%2$s and properly contacted Support. We will get back to you as soon as possible', 'event_espresso'), |
|
69 | + "<a href='".EE_SUPPORT_EMAIL."'>", |
|
70 | 70 | "</a>" |
71 | 71 | ); |
72 | 72 | ?> |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | </tr> |
75 | 75 | <tr> |
76 | 76 | <td> |
77 | - <p class='big-text'><?php printf( __( 'I don\'t need my old EE %s data', 'event_espresso' ), $most_recent_migration->slug() ); ?></p> |
|
77 | + <p class='big-text'><?php printf(__('I don\'t need my old EE %s data', 'event_espresso'), $most_recent_migration->slug()); ?></p> |
|
78 | 78 | </td> |
79 | 79 | <td> |
80 | 80 | <?php |
81 | 81 | printf( |
82 | - __( 'If you are ok with losing all the EE %1$s data, you can skip the migrations and %2$s use EE4 with only default Data%3$s', 'event_espresso' ), |
|
82 | + __('If you are ok with losing all the EE %1$s data, you can skip the migrations and %2$s use EE4 with only default Data%3$s', 'event_espresso'), |
|
83 | 83 | $most_recent_migration->slug(), |
84 | 84 | "<a id='do-not-migrate' class='do-not-migrate button-primary' href='$reset_db_action_url'>", |
85 | 85 | "</a>" |
@@ -89,20 +89,20 @@ discard block |
||
89 | 89 | </tr> |
90 | 90 | <tr> |
91 | 91 | <td> |
92 | - <p class='big-text'><?php printf( __( 'I want to go back to my old version of EE %1$s', 'event_espresso' ), $most_recent_migration->slug() ); ?> |
|
92 | + <p class='big-text'><?php printf(__('I want to go back to my old version of EE %1$s', 'event_espresso'), $most_recent_migration->slug()); ?> |
|
93 | 93 | </td> |
94 | 94 | <td> |
95 | 95 | <p> |
96 | 96 | <?php |
97 | 97 | printf( |
98 | - __( 'Then we suggest you re-activate the old version of EE %3$s and restore your database to the backup you made just before migrating . If you didn\'t backup your database and are migrating from EE3, you can also delete your EE4 data (use on the %1$s"Reset/Delete Data" tab above%2$s), and then reactivate EE3 from the plugins page. Note: some of your EE3 shortcodes may have been changed to their EE4 equivalents, so you will need to change them back.', 'event_espresso' ), |
|
98 | + __('Then we suggest you re-activate the old version of EE %3$s and restore your database to the backup you made just before migrating . If you didn\'t backup your database and are migrating from EE3, you can also delete your EE4 data (use on the %1$s"Reset/Delete Data" tab above%2$s), and then reactivate EE3 from the plugins page. Note: some of your EE3 shortcodes may have been changed to their EE4 equivalents, so you will need to change them back.', 'event_espresso'), |
|
99 | 99 | "<a href='$reset_db_page_url'>", |
100 | 100 | "</a>", |
101 | 101 | $most_recent_migration->slug() |
102 | 102 | ); |
103 | 103 | ?> |
104 | 104 | </p> |
105 | - <p><?php _e( "If you ever decide to re-attempt using EE4, you will again be given the option to migrate your EE3 data or not.", 'event_espresso' ); ?></p> |
|
105 | + <p><?php _e("If you ever decide to re-attempt using EE4, you will again be given the option to migrate your EE3 data or not.", 'event_espresso'); ?></p> |
|
106 | 106 | </td> |
107 | 107 | </tr> |
108 | 108 |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | * @type string $reset_db_page_link |
17 | 17 | */ |
18 | 18 | |
19 | -if ( $show_backup_db_text ) { ?> |
|
20 | -<h1><span class="dashicons dashicons-migrate"></span><?php _e("Database Migration Manager", "event_espresso");?></h1> |
|
19 | +if ($show_backup_db_text) { ?> |
|
20 | +<h1><span class="dashicons dashicons-migrate"></span><?php _e("Database Migration Manager", "event_espresso"); ?></h1> |
|
21 | 21 | <?php } ?> |
22 | 22 | <div class="padding"> |
23 | 23 | <div id="migration-prep"> |
24 | 24 | |
25 | - <?php if ( $script_names ) { ?> |
|
25 | + <?php if ($script_names) { ?> |
|
26 | 26 | <h3 class="espresso-header"> |
27 | 27 | <span class="dashicons dashicons-flag ee-icon-size-22"></span> |
28 | 28 | <?php |
@@ -39,34 +39,34 @@ discard block |
||
39 | 39 | ?> |
40 | 40 | </h3> |
41 | 41 | <p> |
42 | - <?php echo apply_filters('FHEE__ee_migration_page__p_after_header',sprintf(__("Since you have already been using Event Espresso and have previous event and registration data in your database, you have the option to migrate, or copy over, this existing data into a format that is compatible with %s.", "event_espresso"),$next_db_state),$next_db_state);?> |
|
42 | + <?php echo apply_filters('FHEE__ee_migration_page__p_after_header', sprintf(__("Since you have already been using Event Espresso and have previous event and registration data in your database, you have the option to migrate, or copy over, this existing data into a format that is compatible with %s.", "event_espresso"), $next_db_state), $next_db_state); ?> |
|
43 | 43 | </p> |
44 | - <?php } elseif ( $show_most_recent_migration ) { ?> |
|
44 | + <?php } elseif ($show_most_recent_migration) { ?> |
|
45 | 45 | <h3 class="espresso-header"> |
46 | 46 | <span class="dashicons dashicons-awards ee-icon-size-22"></span> |
47 | - <?php echo apply_filters('FHEE__ee_migration_page__done_migration_header',sprintf(__('Congratulations! Your database is "up-to-date" and you are ready to begin using %s', "event_espresso"),$ultimate_db_state));?> |
|
47 | + <?php echo apply_filters('FHEE__ee_migration_page__done_migration_header', sprintf(__('Congratulations! Your database is "up-to-date" and you are ready to begin using %s', "event_espresso"), $ultimate_db_state)); ?> |
|
48 | 48 | </h3> |
49 | 49 | <p> |
50 | - <?php echo apply_filters('FHEE__ee_migration_page__p_after_done_migration_header',sprintf(__("Time to find out about all the great new features %s has to offer.", "event_espresso"),$ultimate_db_state));?> |
|
51 | - <b><a id="get-started-after-migrate" class="button-primary" href="<?php echo add_query_arg( array( 'page' => 'espresso_about' ), admin_url( 'admin.php' )); ?>"> |
|
52 | - <?php _e("Let's Get Started", "event_espresso");?> <span class="dashicons dashicons-arrow-right ee-icon-size-22" style="margin:0;"></span> |
|
50 | + <?php echo apply_filters('FHEE__ee_migration_page__p_after_done_migration_header', sprintf(__("Time to find out about all the great new features %s has to offer.", "event_espresso"), $ultimate_db_state)); ?> |
|
51 | + <b><a id="get-started-after-migrate" class="button-primary" href="<?php echo add_query_arg(array('page' => 'espresso_about'), admin_url('admin.php')); ?>"> |
|
52 | + <?php _e("Let's Get Started", "event_espresso"); ?> <span class="dashicons dashicons-arrow-right ee-icon-size-22" style="margin:0;"></span> |
|
53 | 53 | </a></b> |
54 | 54 | </p> |
55 | 55 | <?php } ?> |
56 | 56 | |
57 | 57 | |
58 | - <?php if ($show_backup_db_text){ ?> |
|
58 | + <?php if ($show_backup_db_text) { ?> |
|
59 | 59 | <div id="migration-options-dv"> |
60 | 60 | <h2> |
61 | 61 | <span class="dashicons dashicons-admin-tools"></span> |
62 | - <?php _e("Migration Options", "event_espresso");?> |
|
63 | - <span class="tiny-text lt-grey-text"> <?php _e(' to migrate or not to migrate?', "event_espresso");?></span> |
|
62 | + <?php _e("Migration Options", "event_espresso"); ?> |
|
63 | + <span class="tiny-text lt-grey-text"> <?php _e(' to migrate or not to migrate?', "event_espresso"); ?></span> |
|
64 | 64 | </h2> |
65 | 65 | <div class="ee-table-wrap"> |
66 | 66 | <table> |
67 | 67 | <tbody> |
68 | 68 | <tr> |
69 | - <td><h3><?php _e('1', 'event_espresso');?></h3></td> |
|
69 | + <td><h3><?php _e('1', 'event_espresso'); ?></h3></td> |
|
70 | 70 | <td> |
71 | 71 | <?php |
72 | 72 | echo apply_filters( |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | __('%1$sYes. I have backed up my database%2$s, %3$sunderstand the risks involved%4$s, and am ready to migrate my existing %5$s data to %6$s.', "event_espresso"), |
76 | 76 | '<strong>', |
77 | 77 | '</strong>', |
78 | - '<a id="migration-risks" class="" title="' . esc_attr__('click for more details', "event_espresso") . '">', |
|
78 | + '<a id="migration-risks" class="" title="'.esc_attr__('click for more details', "event_espresso").'">', |
|
79 | 79 | '</a>', |
80 | 80 | $current_db_state, |
81 | 81 | $next_db_state |
@@ -84,18 +84,18 @@ discard block |
||
84 | 84 | $next_db_state |
85 | 85 | ); |
86 | 86 | ?> |
87 | - <a id="display-migration-details" class="display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="migration-details" ><?php _e('click for more details', "event_espresso");?> +</a> |
|
88 | - <a id="hide-migration-details" class="hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="migration-details" style="display:none;" ><?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), ' ' ); ?></a> |
|
87 | + <a id="display-migration-details" class="display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="migration-details" ><?php _e('click for more details', "event_espresso"); ?> +</a> |
|
88 | + <a id="hide-migration-details" class="hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="migration-details" style="display:none;" ><?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '); ?></a> |
|
89 | 89 | </td> |
90 | 90 | <td> |
91 | - <a id="db-backed-up" class="toggle-migration-monitor button-primary"><?php echo apply_filters('FHEE__ee_migration_page__option_1_button_text',sprintf(__("Migrate My %s Data to %s", "event_espresso"),$current_db_state,$next_db_state),$current_db_state,$next_db_state);?></a> |
|
91 | + <a id="db-backed-up" class="toggle-migration-monitor button-primary"><?php echo apply_filters('FHEE__ee_migration_page__option_1_button_text', sprintf(__("Migrate My %s Data to %s", "event_espresso"), $current_db_state, $next_db_state), $current_db_state, $next_db_state); ?></a> |
|
92 | 92 | </td> |
93 | 93 | </tr> |
94 | 94 | <tr> |
95 | 95 | <td colspan="3" style="padding: 0"> |
96 | 96 | <div id="migration-details-dv" style="display: none; padding: 1em;"> |
97 | 97 | |
98 | - <span class="reminder-spn"><?php printf(__("%s Important: %s Before migrating, please back up your database and files.", "event_espresso"),"<b>","</b>");?></span> |
|
98 | + <span class="reminder-spn"><?php printf(__("%s Important: %s Before migrating, please back up your database and files.", "event_espresso"), "<b>", "</b>"); ?></span> |
|
99 | 99 | <p> |
100 | 100 | <?php |
101 | 101 | printf( |
@@ -111,27 +111,27 @@ discard block |
||
111 | 111 | ); |
112 | 112 | ?> |
113 | 113 | </p> |
114 | - <?php do_action('AHEE__ee_migration_page__option_1_extra_details');?> |
|
114 | + <?php do_action('AHEE__ee_migration_page__option_1_extra_details'); ?> |
|
115 | 115 | </div> |
116 | 116 | </td> |
117 | 117 | </tr> |
118 | 118 | <tr> |
119 | - <td><h3><?php _e('2', 'event_espresso');?></h3></td> |
|
119 | + <td><h3><?php _e('2', 'event_espresso'); ?></h3></td> |
|
120 | 120 | <td> |
121 | - <?php echo apply_filters( 'FHEE__ee_migration_page__option_2_main',sprintf(__('I do NOT want to migrate my %1$s data to %2$s at this time and just want to use %3$s without migrating data.', "event_espresso"),$current_db_state,$next_db_state,$ultimate_db_state),$current_db_state,$next_db_state,$ultimate_db_state);?><br /> |
|
122 | - <span class="reminder-spn"><?php _e( 'Please Note: In order to avoid errors, any existing Event Espresso data (events, ticket, registrations, etc) in your db will be erased! Regular WP data will NOT be affected.', 'event_espresso' );?></span> |
|
123 | - <a id="display-no-migration-details" class="display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="no-migration-details"><?php _e('click for more details', "event_espresso");?> +</a> |
|
124 | - <a id="hide-no-migration-details" class="hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="no-migration-details" style="display:none;" ><?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), ' ' ); ?></a> |
|
121 | + <?php echo apply_filters('FHEE__ee_migration_page__option_2_main', sprintf(__('I do NOT want to migrate my %1$s data to %2$s at this time and just want to use %3$s without migrating data.', "event_espresso"), $current_db_state, $next_db_state, $ultimate_db_state), $current_db_state, $next_db_state, $ultimate_db_state); ?><br /> |
|
122 | + <span class="reminder-spn"><?php _e('Please Note: In order to avoid errors, any existing Event Espresso data (events, ticket, registrations, etc) in your db will be erased! Regular WP data will NOT be affected.', 'event_espresso'); ?></span> |
|
123 | + <a id="display-no-migration-details" class="display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="no-migration-details"><?php _e('click for more details', "event_espresso"); ?> +</a> |
|
124 | + <a id="hide-no-migration-details" class="hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="no-migration-details" style="display:none;" ><?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '); ?></a> |
|
125 | 125 | </td> |
126 | 126 | <td> |
127 | - <a id="do-not-migrate" class="do-not-migrate button-primary" href="<?php echo $reset_db_page_link;?>"><?php echo apply_filters('FHEE__ee_migration_page__option_2_button_text',sprintf(__("Just Start %s and Delete Existing Data", "event_espresso"),$ultimate_db_state),$ultimate_db_state);?></a> |
|
127 | + <a id="do-not-migrate" class="do-not-migrate button-primary" href="<?php echo $reset_db_page_link; ?>"><?php echo apply_filters('FHEE__ee_migration_page__option_2_button_text', sprintf(__("Just Start %s and Delete Existing Data", "event_espresso"), $ultimate_db_state), $ultimate_db_state); ?></a> |
|
128 | 128 | </td> |
129 | 129 | </tr> |
130 | 130 | <tr> |
131 | 131 | <td colspan="3" style="padding: 0"> |
132 | 132 | <div id="no-migration-details-dv" style="display: none; padding: 1em;"> |
133 | 133 | <p> |
134 | - <?php echo apply_filters('FHEE__ee_migration_page__option_2_details',sprintf(__("If your existing Event and Registration Data is no longer relevant nor required, you can just start up %s without performing a data migration.", "event_espresso"),$ultimate_db_state),$ultimate_db_state);?> |
|
134 | + <?php echo apply_filters('FHEE__ee_migration_page__option_2_details', sprintf(__("If your existing Event and Registration Data is no longer relevant nor required, you can just start up %s without performing a data migration.", "event_espresso"), $ultimate_db_state), $ultimate_db_state); ?> |
|
135 | 135 | </p> |
136 | 136 | </div> |
137 | 137 | </td> |
@@ -139,20 +139,20 @@ discard block |
||
139 | 139 | </tbody> |
140 | 140 | </table> |
141 | 141 | </div> |
142 | - <?php do_action('AHEE__ee_migration_page__after_migration_options_table');?> |
|
142 | + <?php do_action('AHEE__ee_migration_page__after_migration_options_table'); ?> |
|
143 | 143 | </div> |
144 | 144 | <?php } ?> |
145 | 145 | |
146 | 146 | <?php |
147 | - if ( $show_most_recent_migration ) { |
|
148 | - if( $most_recent_migration && $most_recent_migration instanceof EE_Data_Migration_Script_Base ) { |
|
149 | - if( $most_recent_migration->can_continue() ) { |
|
147 | + if ($show_most_recent_migration) { |
|
148 | + if ($most_recent_migration && $most_recent_migration instanceof EE_Data_Migration_Script_Base) { |
|
149 | + if ($most_recent_migration->can_continue()) { |
|
150 | 150 | //tell the user they should continue their migration because it appears to be unfinished... well, assuming there were no errors ?> |
151 | 151 | <h3 class="espresso-header"> |
152 | 152 | <span class="dashicons dashicons-star-half ee-icon-size-22"></span> |
153 | - <?php printf(__("It appears that your previous Data Migration Task (%s) is incomplete, and should be resumed", "event_espresso"),$most_recent_migration->pretty_name());?> |
|
153 | + <?php printf(__("It appears that your previous Data Migration Task (%s) is incomplete, and should be resumed", "event_espresso"), $most_recent_migration->pretty_name()); ?> |
|
154 | 154 | </h3> |
155 | - <?php } elseif ( $most_recent_migration->is_broken() ) { |
|
155 | + <?php } elseif ($most_recent_migration->is_broken()) { |
|
156 | 156 | //tell the user the migration failed and they should notify EE?> |
157 | 157 | <h3 class="espresso-header"> |
158 | 158 | <span class="dashicons dashicons-no ee-icon-size-22"></span> |
@@ -161,19 +161,19 @@ discard block |
||
161 | 161 | <?php } |
162 | 162 | |
163 | 163 | //display errors or not of the most recent migration ran |
164 | - if ( $most_recent_migration->get_errors() ){ ?> |
|
164 | + if ($most_recent_migration->get_errors()) { ?> |
|
165 | 165 | <div class="ee-attention"> |
166 | - <strong><?php printf(__("Warnings occurred during your last migration (%s):",'event_espresso'),$most_recent_migration->pretty_name()) ?></strong> |
|
167 | - <a id="show-hide-migration-warnings" class="display-the-hidden"><?php _e("Show Warnings", 'event_espresso');?></a> |
|
166 | + <strong><?php printf(__("Warnings occurred during your last migration (%s):", 'event_espresso'), $most_recent_migration->pretty_name()) ?></strong> |
|
167 | + <a id="show-hide-migration-warnings" class="display-the-hidden"><?php _e("Show Warnings", 'event_espresso'); ?></a> |
|
168 | 168 | <ul class="migration-warnings" style="display:none"> |
169 | - <?php foreach($most_recent_migration->get_errors() as $error){ ?> |
|
169 | + <?php foreach ($most_recent_migration->get_errors() as $error) { ?> |
|
170 | 170 | <li><?php echo $error ?></li> |
171 | 171 | <?php }?> |
172 | 172 | </ul> |
173 | 173 | </div> |
174 | 174 | <?php } else { |
175 | 175 | //there were no errors during the last migration, just say so?> |
176 | - <h2><?php printf(__("The last data migration task (%s) ran successfully without errors.", "event_espresso"),$most_recent_migration->pretty_name())?></h2> |
|
176 | + <h2><?php printf(__("The last data migration task (%s) ran successfully without errors.", "event_espresso"), $most_recent_migration->pretty_name())?></h2> |
|
177 | 177 | <?php } |
178 | 178 | } else { |
179 | 179 | } |
@@ -184,12 +184,12 @@ discard block |
||
184 | 184 | </div> |
185 | 185 | <!--end of #migration-prep--> |
186 | 186 | |
187 | - <?php if ($show_migration_progress){?> |
|
187 | + <?php if ($show_migration_progress) {?> |
|
188 | 188 | <div id='migration-monitor' <?php echo $show_backup_db_text ? "style='display:none'" : ''?>> |
189 | - <?php if( $show_backup_db_text){?> |
|
189 | + <?php if ($show_backup_db_text) {?> |
|
190 | 190 | <p> |
191 | 191 | <a class="toggle-migration-monitor small-text" style="cursor: pointer;"> |
192 | - <span class="dashicons dashicons-arrow-left-alt2" style="top:0;"></span><?php _e("return to previous screen", "event_espresso");?> |
|
192 | + <span class="dashicons dashicons-arrow-left-alt2" style="top:0;"></span><?php _e("return to previous screen", "event_espresso"); ?> |
|
193 | 193 | </a> |
194 | 194 | <br/> |
195 | 195 | |
@@ -198,33 +198,33 @@ discard block |
||
198 | 198 | <div id='progress-area'> |
199 | 199 | <h3 class="espresso-header"> |
200 | 200 | <?php |
201 | - echo sprintf( _n( |
|
201 | + echo sprintf(_n( |
|
202 | 202 | "In order to import all of your existing Event Espresso data, the following upgrade task needs to be performed:", |
203 | 203 | "In order to import all of your existing Event Espresso data, the following %s upgrade tasks need to be performed:", |
204 | 204 | count($script_names), |
205 | 205 | "event_espresso" |
206 | - ), count( $script_names ) );?> |
|
206 | + ), count($script_names)); ?> |
|
207 | 207 | </h3> |
208 | 208 | <ul style="list-style: inside;"> |
209 | - <?php foreach($script_names as $script_name){?> |
|
209 | + <?php foreach ($script_names as $script_name) {?> |
|
210 | 210 | <li style="margin: 0 0 1em 1em; line-height: 1.1em;"><?php echo $script_name?></li> |
211 | 211 | <?php }?> |
212 | 212 | </ul> |
213 | 213 | <br/> |
214 | 214 | <?php if (count($script_names) > 1) {?> |
215 | - <p><?php _e("Please note: after each task is completed you will need to continue the data migration, or report an error to Event Espresso.", "event_espresso");?></p> |
|
215 | + <p><?php _e("Please note: after each task is completed you will need to continue the data migration, or report an error to Event Espresso.", "event_espresso"); ?></p> |
|
216 | 216 | <?php }?> |
217 | 217 | |
218 | 218 | <div class="ee-attention"> |
219 | 219 | <p> |
220 | 220 | <span class="reminder-spn"> |
221 | - <strong><?php _e("Please Note:", "event_espresso");?></strong> |
|
221 | + <strong><?php _e("Please Note:", "event_espresso"); ?></strong> |
|
222 | 222 | </span> |
223 | 223 | <br/> |
224 | - <?php _e("Depending on the number of events and the complexity of the information in your database, this could take a few minutes.", "event_espresso");?> |
|
224 | + <?php _e("Depending on the number of events and the complexity of the information in your database, this could take a few minutes.", "event_espresso"); ?> |
|
225 | 225 | </p> |
226 | 226 | <p> |
227 | - <?php printf(__("%sPlease be patient and do NOT navigate away from this page once the migration has begun%s. If any issues arise due to existing malformed data, an itemized report will be made available to you after the migration has completed.", "event_espresso"),'<strong>', '</strong>' );?> |
|
227 | + <?php printf(__("%sPlease be patient and do NOT navigate away from this page once the migration has begun%s. If any issues arise due to existing malformed data, an itemized report will be made available to you after the migration has completed.", "event_espresso"), '<strong>', '</strong>'); ?> |
|
228 | 228 | </p> |
229 | 229 | <p> |
230 | 230 | <?php _e("Click the button below to begin the migration process.", "event_espresso") ?> |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | <!-- #progress-responsive --> |
240 | 240 | |
241 | 241 | <button id='start-migration' class='button-primary'> |
242 | - <?php echo $show_continue_current_migration_script ? __("Continue Migration", "event_espresso") : __("Begin Migration", "event_espresso");?> |
|
242 | + <?php echo $show_continue_current_migration_script ? __("Continue Migration", "event_espresso") : __("Begin Migration", "event_espresso"); ?> |
|
243 | 243 | </button> |
244 | 244 | <br class="clear"/> |
245 | 245 | |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | </div> |
256 | 256 | |
257 | 257 | <?php } |
258 | - if ( $show_maintenance_switch ) { |
|
258 | + if ($show_maintenance_switch) { |
|
259 | 259 | ?> |
260 | - <h2><span class="dashicons dashicons-admin-tools"></span><?php _e('Set Event Espresso Maintenance Mode', 'event_espresso');?></h2> |
|
260 | + <h2><span class="dashicons dashicons-admin-tools"></span><?php _e('Set Event Espresso Maintenance Mode', 'event_espresso'); ?></h2> |
|
261 | 261 | <form method='post' action='<?php echo $update_migration_script_page_link?>'> |
262 | 262 | <div class="ee-table-wrap"> |
263 | 263 | <table> |
@@ -266,9 +266,9 @@ discard block |
||
266 | 266 | <input type="radio" id="maintenance_mode_level_off" name="maintenance_mode_level" value="0" <?php echo EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_0_not_in_maintenance ? 'checked="checked"' : ''?>> |
267 | 267 | </td> |
268 | 268 | <th align="left"> |
269 | - <label for="maintenance_mode_level_off"><?php _e('Maintenance Mode OFF', 'event_espresso');?></label> |
|
269 | + <label for="maintenance_mode_level_off"><?php _e('Maintenance Mode OFF', 'event_espresso'); ?></label> |
|
270 | 270 | <p class='description' style="font-weight: normal;"> |
271 | - <?php _e("This is the normal operating mode for Event Espresso and allows all functionality to be viewed by all site visitors.", "event_espresso");?> |
|
271 | + <?php _e("This is the normal operating mode for Event Espresso and allows all functionality to be viewed by all site visitors.", "event_espresso"); ?> |
|
272 | 272 | </p> |
273 | 273 | </th> |
274 | 274 | </tr> |
@@ -281,14 +281,14 @@ discard block |
||
281 | 281 | <?php _e('Maintenance Mode ON', 'event_espresso')?> |
282 | 282 | </label> |
283 | 283 | <p class='description' style="font-weight: normal;"> |
284 | - <?php _e("This disables Event Espresso frontend functionality for all site visitors that are not administrators, and allows you to configure and/or test things on the frontend of your website before others can see.", "event_espresso");?> |
|
284 | + <?php _e("This disables Event Espresso frontend functionality for all site visitors that are not administrators, and allows you to configure and/or test things on the frontend of your website before others can see.", "event_espresso"); ?> |
|
285 | 285 | </p> |
286 | 286 | </th> |
287 | 287 | </tr> |
288 | 288 | </table> |
289 | 289 | </div> |
290 | 290 | <p> |
291 | - <input type='submit' class="button-primary" value='<?php _e("Update Maintenance Mode", "event_espresso");?>'> |
|
291 | + <input type='submit' class="button-primary" value='<?php _e("Update Maintenance Mode", "event_espresso"); ?>'> |
|
292 | 292 | </p> |
293 | 293 | </form> |
294 | 294 | <?php |
@@ -1,26 +1,26 @@ |
||
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> |
@@ -30,8 +30,7 @@ discard block |
||
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 |
||
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 |
||
86 | 85 | }?> |
87 | 86 | </tbody> |
88 | 87 | <?php |
89 | - } |
|
90 | - else { |
|
88 | + } else { |
|
91 | 89 | ?> |
92 | 90 | <tbody> |
93 | 91 | <tr> |
@@ -7,7 +7,7 @@ discard block |
||
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 |
||
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,31 +36,31 @@ discard block |
||
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 | - <h2><?php _e("Raw System Data", "event_espresso");?></h2> |
|
54 | + <h2><?php _e("Raw System Data", "event_espresso"); ?></h2> |
|
55 | 55 | <textarea class="system_status_info"> |
56 | 56 | <?php print_r($system_stati)?> |
57 | 57 | </textarea> |
58 | - <h2><?php _e("System Data (formatted)", "event_espresso");?></h2> |
|
58 | + <h2><?php _e("System Data (formatted)", "event_espresso"); ?></h2> |
|
59 | 59 | <table class="widefat"> |
60 | 60 | <?php |
61 | 61 | foreach ($system_stati as $status_category_slug => $data) { |
62 | 62 | if (is_object($data)) { |
63 | - $data = (array)$data; |
|
63 | + $data = (array) $data; |
|
64 | 64 | } |
65 | 65 | ?> |
66 | 66 | <thead> |
@@ -1,6 +1,6 @@ |
||
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 |
@@ -1,5 +1,6 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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']; |
@@ -190,9 +190,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | ) |
@@ -1564,14 +1564,14 @@ discard block |
||
1564 | 1564 | |
1565 | 1565 | |
1566 | 1566 | /** |
1567 | - * This returns the shortcode selector skeleton for a given context and field. |
|
1568 | - * |
|
1569 | - * @since 4.9.rc.000 |
|
1570 | - * |
|
1567 | + * This returns the shortcode selector skeleton for a given context and field. |
|
1568 | + * |
|
1569 | + * @since 4.9.rc.000 |
|
1570 | + * |
|
1571 | 1571 | * @param string $field The name of the field retrieving shortcodes for. |
1572 | - * @param string $linked_input_id The css id of the input that the shortcodes get added to. |
|
1573 | - * @return string |
|
1574 | - */ |
|
1572 | + * @param string $linked_input_id The css id of the input that the shortcodes get added to. |
|
1573 | + * @return string |
|
1574 | + */ |
|
1575 | 1575 | protected function _get_shortcode_selector( $field, $linked_input_id ) { |
1576 | 1576 | $template_args = array( |
1577 | 1577 | 'shortcodes' => $this->_get_shortcodes( array( $field ), true ), |
@@ -2111,9 +2111,9 @@ discard block |
||
2111 | 2111 | |
2112 | 2112 | /** |
2113 | 2113 | * _learn_more_about_message_templates_link |
2114 | - * @access protected |
|
2115 | - * @return string |
|
2116 | - */ |
|
2114 | + * @access protected |
|
2115 | + * @return string |
|
2116 | + */ |
|
2117 | 2117 | protected function _learn_more_about_message_templates_link() { |
2118 | 2118 | return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>'; |
2119 | 2119 | } |
@@ -1,4 +1,4 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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( |
@@ -479,43 +479,43 @@ discard block |
||
479 | 479 | |
480 | 480 | |
481 | 481 | public function messages_help_tab() { |
482 | - $templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_help_tab.template.php'; |
|
483 | - EEH_Template::display_template( $templatepath, array()); |
|
482 | + $templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_help_tab.template.php'; |
|
483 | + EEH_Template::display_template($templatepath, array()); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | |
487 | 487 | public function messengers_help_tab() { |
488 | - $templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messenger_help_tab.template.php'; |
|
489 | - EEH_Template::display_template( $templatepath, array()); |
|
488 | + $templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messenger_help_tab.template.php'; |
|
489 | + EEH_Template::display_template($templatepath, array()); |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | |
493 | 493 | public function message_types_help_tab() { |
494 | - $templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_type_help_tab.template.php'; |
|
495 | - EEH_Template::display_template( $templatepath, array()); |
|
494 | + $templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_type_help_tab.template.php'; |
|
495 | + EEH_Template::display_template($templatepath, array()); |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | |
499 | 499 | public function messages_overview_help_tab() { |
500 | - $templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_overview_help_tab.template.php'; |
|
501 | - EEH_Template::display_template( $templatepath, array()); |
|
500 | + $templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_overview_help_tab.template.php'; |
|
501 | + EEH_Template::display_template($templatepath, array()); |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | |
505 | 505 | public function message_templates_help_tab() { |
506 | - $templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_templates_help_tab.template.php'; |
|
507 | - EEH_Template::display_template( $templatepath, array()); |
|
506 | + $templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_templates_help_tab.template.php'; |
|
507 | + EEH_Template::display_template($templatepath, array()); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | |
511 | 511 | public function edit_message_template_help_tab() { |
512 | - $templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_templates_editor_help_tab.template.php'; |
|
513 | - $args['img1'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/editor.png' . '" alt="' . esc_attr__('Editor Title', 'event_espresso') . '" />'; |
|
514 | - $args['img2'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/switch-context.png' . '" alt="' . esc_attr__('Context Switcher and Preview', 'event_espresso') . '" />'; |
|
515 | - $args['img3'] = '<img class="left" src="' . EE_MSG_ASSETS_URL . 'images/form-fields.png' . '" alt="' . esc_attr__('Message Template Form Fields', 'event_espresso') . '" />'; |
|
516 | - $args['img4'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/shortcodes-metabox.png' . '" alt="' . esc_attr__('Shortcodes Metabox', 'event_espresso') . '" />'; |
|
517 | - $args['img5'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/publish-meta-box.png' . '" alt="' . esc_attr__('Publish Metabox', 'event_espresso') . '" />'; |
|
518 | - EEH_Template::display_template( $templatepath, $args); |
|
512 | + $templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_templates_editor_help_tab.template.php'; |
|
513 | + $args['img1'] = '<img src="'.EE_MSG_ASSETS_URL.'images/editor.png'.'" alt="'.esc_attr__('Editor Title', 'event_espresso').'" />'; |
|
514 | + $args['img2'] = '<img src="'.EE_MSG_ASSETS_URL.'images/switch-context.png'.'" alt="'.esc_attr__('Context Switcher and Preview', 'event_espresso').'" />'; |
|
515 | + $args['img3'] = '<img class="left" src="'.EE_MSG_ASSETS_URL.'images/form-fields.png'.'" alt="'.esc_attr__('Message Template Form Fields', 'event_espresso').'" />'; |
|
516 | + $args['img4'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/shortcodes-metabox.png'.'" alt="'.esc_attr__('Shortcodes Metabox', 'event_espresso').'" />'; |
|
517 | + $args['img5'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/publish-meta-box.png'.'" alt="'.esc_attr__('Publish Metabox', 'event_espresso').'" />'; |
|
518 | + EEH_Template::display_template($templatepath, $args); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | |
@@ -523,25 +523,25 @@ discard block |
||
523 | 523 | public function message_template_shortcodes_help_tab() { |
524 | 524 | $this->_set_shortcodes(); |
525 | 525 | $args['shortcodes'] = $this->_shortcodes; |
526 | - $template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_shortcodes_help_tab.template.php'; |
|
527 | - EEH_Template::display_template( $template_path, $args ); |
|
526 | + $template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_shortcodes_help_tab.template.php'; |
|
527 | + EEH_Template::display_template($template_path, $args); |
|
528 | 528 | } |
529 | 529 | |
530 | 530 | |
531 | 531 | |
532 | 532 | public function preview_message_help_tab() { |
533 | - $templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_preview_help_tab.template.php'; |
|
534 | - EEH_Template::display_template( $templatepath, array()); |
|
533 | + $templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_preview_help_tab.template.php'; |
|
534 | + EEH_Template::display_template($templatepath, array()); |
|
535 | 535 | } |
536 | 536 | |
537 | 537 | |
538 | 538 | public function settings_help_tab() { |
539 | - $templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_settings_help_tab.template.php'; |
|
540 | - $args['img1'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '" alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />'; |
|
541 | - $args['img2'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />'; |
|
539 | + $templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_settings_help_tab.template.php'; |
|
540 | + $args['img1'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'" alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />'; |
|
541 | + $args['img2'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'.'" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />'; |
|
542 | 542 | $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>'; |
543 | 543 | $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>'; |
544 | - EEH_Template::display_template( $templatepath, $args); |
|
544 | + EEH_Template::display_template($templatepath, $args); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | |
@@ -549,24 +549,24 @@ discard block |
||
549 | 549 | |
550 | 550 | |
551 | 551 | public function load_scripts_styles() { |
552 | - wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL . 'ee_message_admin.css', EVENT_ESPRESSO_VERSION ); |
|
552 | + wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL.'ee_message_admin.css', EVENT_ESPRESSO_VERSION); |
|
553 | 553 | wp_enqueue_style('espresso_ee_msg'); |
554 | 554 | |
555 | - 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 | + 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); |
|
556 | 556 | } |
557 | 557 | |
558 | 558 | |
559 | 559 | |
560 | 560 | |
561 | 561 | |
562 | - public function wp_editor_css( $mce_css ) { |
|
562 | + public function wp_editor_css($mce_css) { |
|
563 | 563 | //if we're on the edit_message_template route |
564 | - if ( $this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger ) { |
|
564 | + if ($this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger) { |
|
565 | 565 | $message_type_name = $this->_active_message_type_name; |
566 | 566 | |
567 | 567 | //we're going to REPLACE the existing mce css |
568 | 568 | //we need to get the css file location from the active messenger |
569 | - $mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'wpeditor', $this->_variation ); |
|
569 | + $mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'wpeditor', $this->_variation); |
|
570 | 570 | } |
571 | 571 | |
572 | 572 | return $mce_css; |
@@ -584,37 +584,37 @@ discard block |
||
584 | 584 | $this->_message_template_group->messenger_obj()->label['singular'], |
585 | 585 | $this->_message_template_group->message_type_obj()->label['singular'] |
586 | 586 | ); |
587 | - 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' ); |
|
587 | + 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'); |
|
588 | 588 | |
589 | - wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL . 'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION ); |
|
589 | + wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL.'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION); |
|
590 | 590 | |
591 | 591 | wp_enqueue_script('ee_admin_js'); |
592 | 592 | wp_enqueue_script('ee_msgs_edit_js'); |
593 | 593 | |
594 | 594 | //add in special css for tiny_mce |
595 | - add_filter( 'mce_css', array( $this, 'wp_editor_css' ) ); |
|
595 | + add_filter('mce_css', array($this, 'wp_editor_css')); |
|
596 | 596 | } |
597 | 597 | |
598 | 598 | |
599 | 599 | |
600 | 600 | public function load_scripts_styles_display_preview_message() { |
601 | 601 | $this->_set_message_template_group(); |
602 | - if ( isset( $this->_req_data['messenger'] ) ) { |
|
602 | + if (isset($this->_req_data['messenger'])) { |
|
603 | 603 | $this->_active_messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj']; |
604 | 604 | } |
605 | 605 | |
606 | - $message_type_name = isset( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : ''; |
|
606 | + $message_type_name = isset($this->_req_data['message_type']) ? $this->_req_data['message_type'] : ''; |
|
607 | 607 | |
608 | 608 | |
609 | - wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation( $this->_template_pack, $message_type_name, TRUE, 'preview', $this->_variation ) ); |
|
609 | + wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'preview', $this->_variation)); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | |
613 | 613 | |
614 | 614 | public function load_scripts_styles_settings() { |
615 | - wp_register_style( 'ee-message-settings', EE_MSG_ASSETS_URL . 'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION ); |
|
616 | - wp_enqueue_style( 'ee-text-links' ); |
|
617 | - wp_enqueue_style( 'ee-message-settings' ); |
|
615 | + wp_register_style('ee-message-settings', EE_MSG_ASSETS_URL.'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION); |
|
616 | + wp_enqueue_style('ee-text-links'); |
|
617 | + wp_enqueue_style('ee-message-settings'); |
|
618 | 618 | |
619 | 619 | wp_enqueue_script('ee-messages-settings'); |
620 | 620 | } |
@@ -650,9 +650,9 @@ discard block |
||
650 | 650 | |
651 | 651 | protected function _custom_mtps_preview() { |
652 | 652 | $this->_admin_page_title = __('Custom Message Templates (Preview)', 'event_espresso'); |
653 | - $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' ) . '" />'; |
|
653 | + $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').'" />'; |
|
654 | 654 | $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>'; |
655 | - $this->display_admin_caf_preview_page( 'custom_message_types', FALSE ); |
|
655 | + $this->display_admin_caf_preview_page('custom_message_types', FALSE); |
|
656 | 656 | } |
657 | 657 | |
658 | 658 | |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | * @param bool $global whether to return just global (true) or custom templates (false) |
675 | 675 | * @return array|WP_Error object |
676 | 676 | */ |
677 | - public function get_message_templates( $perpage = 10, $type = 'in_use', $count = FALSE, $all = FALSE, $global = TRUE ) { |
|
677 | + public function get_message_templates($perpage = 10, $type = 'in_use', $count = FALSE, $all = FALSE, $global = TRUE) { |
|
678 | 678 | global $espresso_wp_user; |
679 | 679 | // start with an empty array |
680 | 680 | $message_templates = array(); |
@@ -684,24 +684,24 @@ discard block |
||
684 | 684 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? 'GRP_ID' : $this->_req_data['orderby']; |
685 | 685 | $orderby = $this->_req_data['orderby']; |
686 | 686 | |
687 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) ) ? $this->_req_data['order'] : 'ASC'; |
|
687 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
688 | 688 | |
689 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
690 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $perpage; |
|
689 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
690 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $perpage; |
|
691 | 691 | |
692 | - $offset = ($current_page-1)*$per_page; |
|
693 | - $limit = $all ? NULL : array( $offset, $per_page ); |
|
692 | + $offset = ($current_page - 1) * $per_page; |
|
693 | + $limit = $all ? NULL : array($offset, $per_page); |
|
694 | 694 | |
695 | 695 | |
696 | 696 | //options will match what is in the _views array property |
697 | - switch( $type ) { |
|
697 | + switch ($type) { |
|
698 | 698 | |
699 | 699 | case 'in_use': |
700 | - $templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, TRUE ); |
|
700 | + $templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, TRUE); |
|
701 | 701 | break; |
702 | 702 | |
703 | 703 | default: |
704 | - $templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global ); |
|
704 | + $templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global); |
|
705 | 705 | |
706 | 706 | } |
707 | 707 | |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | $imts = $installed_objects['message_types']; |
738 | 738 | $installed = array(); |
739 | 739 | |
740 | - foreach ( $imts as $message_type ) { |
|
740 | + foreach ($imts as $message_type) { |
|
741 | 741 | $installed[$message_type->name]['obj'] = $message_type; |
742 | 742 | } |
743 | 743 | |
@@ -769,24 +769,24 @@ discard block |
||
769 | 769 | * @access protected |
770 | 770 | * @return void |
771 | 771 | */ |
772 | - protected function _add_message_template( $message_type = '', $messenger='', $GRP_ID = '' ) { |
|
772 | + protected function _add_message_template($message_type = '', $messenger = '', $GRP_ID = '') { |
|
773 | 773 | //set values override any request data |
774 | - $message_type = !empty( $message_type ) ? $message_type : ''; |
|
775 | - $message_type = empty( $message_type ) && !empty( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : $message_type; |
|
774 | + $message_type = ! empty($message_type) ? $message_type : ''; |
|
775 | + $message_type = empty($message_type) && ! empty($this->_req_data['message_type']) ? $this->_req_data['message_type'] : $message_type; |
|
776 | 776 | |
777 | - $messenger = !empty( $messenger ) ? $messenger : ''; |
|
778 | - $messenger = empty( $messenger ) && !empty( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : $messenger; |
|
777 | + $messenger = ! empty($messenger) ? $messenger : ''; |
|
778 | + $messenger = empty($messenger) && ! empty($this->_req_data['messenger']) ? $this->_req_data['messenger'] : $messenger; |
|
779 | 779 | |
780 | - $GRP_ID = !empty( $GRP_ID ) ? $GRP_ID : ''; |
|
781 | - $GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID; |
|
780 | + $GRP_ID = ! empty($GRP_ID) ? $GRP_ID : ''; |
|
781 | + $GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : $GRP_ID; |
|
782 | 782 | |
783 | 783 | //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 ) ) |
|
784 | + if (empty($message_type) || empty($messenger)) |
|
785 | 785 | throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso')); |
786 | 786 | |
787 | 787 | //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' ) ); |
|
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')); |
|
790 | 790 | |
791 | 791 | //let's just make sure the template gets generated! |
792 | 792 | |
@@ -805,8 +805,8 @@ discard block |
||
805 | 805 | * @param string $messenger messenger slug |
806 | 806 | * @param int $GRP_ID GRP_ID for the related message template group this new template will be based off of. |
807 | 807 | */ |
808 | - public function add_message_template( $message_type, $messenger, $GRP_ID ) { |
|
809 | - $this->_add_message_template( $message_type, $messenger, $GRP_ID ); |
|
808 | + public function add_message_template($message_type, $messenger, $GRP_ID) { |
|
809 | + $this->_add_message_template($message_type, $messenger, $GRP_ID); |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | |
@@ -817,36 +817,36 @@ discard block |
||
817 | 817 | * @return void |
818 | 818 | */ |
819 | 819 | protected function _edit_message_template() { |
820 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, ''); |
|
820 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
821 | 821 | |
822 | 822 | //we filter the tinyMCE settings to remove the validation since message templates by their nature will not have valid html in the templates. |
823 | - add_filter( 'tiny_mce_before_init', array( $this, 'filter_tinymce_init'), 10, 2 ); |
|
823 | + add_filter('tiny_mce_before_init', array($this, 'filter_tinymce_init'), 10, 2); |
|
824 | 824 | |
825 | - $GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
825 | + $GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
826 | 826 | |
827 | 827 | $this->_set_shortcodes(); //this also sets the _message_template property. |
828 | 828 | $message_template_group = $this->_message_template_group; |
829 | 829 | $c_label = $message_template_group->context_label(); |
830 | 830 | $c_config = $message_template_group->contexts_config(); |
831 | 831 | |
832 | - reset( $c_config ); |
|
833 | - $context = isset( $this->_req_data['context']) && !empty($this->_req_data['context'] ) ? strtolower($this->_req_data['context']) : key($c_config); |
|
832 | + reset($c_config); |
|
833 | + $context = isset($this->_req_data['context']) && ! empty($this->_req_data['context']) ? strtolower($this->_req_data['context']) : key($c_config); |
|
834 | 834 | |
835 | 835 | |
836 | - if ( empty($GRP_ID) ) { |
|
836 | + if (empty($GRP_ID)) { |
|
837 | 837 | $action = 'insert_message_template'; |
838 | 838 | $button_both = FALSE; |
839 | - $button_text = array( __( 'Save','event_espresso') ); |
|
839 | + $button_text = array(__('Save', 'event_espresso')); |
|
840 | 840 | $button_actions = array('something_different'); |
841 | 841 | $referrer = FALSE; |
842 | - $edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => TRUE ), EE_MSG_ADMIN_URL ); |
|
842 | + $edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => TRUE), EE_MSG_ADMIN_URL); |
|
843 | 843 | } else { |
844 | 844 | $action = 'update_message_template'; |
845 | 845 | $button_both = TRUE; |
846 | 846 | $button_text = array(); |
847 | 847 | $button_actions = array(); |
848 | 848 | $referrer = $this->_admin_base_url; |
849 | - $edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => TRUE ), EE_MSG_ADMIN_URL ); |
|
849 | + $edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => TRUE), EE_MSG_ADMIN_URL); |
|
850 | 850 | } |
851 | 851 | |
852 | 852 | //set active messenger for this view |
@@ -856,13 +856,13 @@ discard block |
||
856 | 856 | |
857 | 857 | //Do we have any validation errors? |
858 | 858 | $validators = $this->_get_transient(); |
859 | - $v_fields = !empty($validators) ? array_keys($validators) : array(); |
|
859 | + $v_fields = ! empty($validators) ? array_keys($validators) : array(); |
|
860 | 860 | |
861 | 861 | |
862 | 862 | //we need to assemble the title from Various details |
863 | - $context_label = sprintf( __('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label'] )); |
|
863 | + $context_label = sprintf(__('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label'])); |
|
864 | 864 | |
865 | - $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 ); |
|
865 | + $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); |
|
866 | 866 | |
867 | 867 | $this->_template_args['GRP_ID'] = $GRP_ID; |
868 | 868 | $this->_template_args['message_template'] = $message_template_group; |
@@ -873,7 +873,7 @@ discard block |
||
873 | 873 | $MSG = new EE_messages(); |
874 | 874 | $template_field_structure = $MSG->get_fields($message_template_group->messenger(), $message_template_group->message_type()); |
875 | 875 | |
876 | - if ( !$template_field_structure ) { |
|
876 | + if ( ! $template_field_structure) { |
|
877 | 877 | $template_field_structure = FALSE; |
878 | 878 | $template_fields = __('There was an error in assembling the fields for this display (you should see an error message)', 'event_espresso'); |
879 | 879 | } |
@@ -883,38 +883,38 @@ discard block |
||
883 | 883 | |
884 | 884 | |
885 | 885 | //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. |
886 | - if ( is_array($template_field_structure[$context]) && isset( $template_field_structure[$context]['extra']) ) { |
|
887 | - foreach ( $template_field_structure[$context]['extra'] as $reference_field => $new_fields ) { |
|
888 | - unset( $template_field_structure[$context][$reference_field] ); |
|
886 | + if (is_array($template_field_structure[$context]) && isset($template_field_structure[$context]['extra'])) { |
|
887 | + foreach ($template_field_structure[$context]['extra'] as $reference_field => $new_fields) { |
|
888 | + unset($template_field_structure[$context][$reference_field]); |
|
889 | 889 | } |
890 | 890 | } |
891 | 891 | |
892 | 892 | //let's loop through the template_field_structure and actually assemble the input fields! |
893 | - if ( !empty($template_field_structure) ) { |
|
894 | - $id_prefix= 'ee-msg-edit-template-fields-'; |
|
895 | - foreach ( $template_field_structure[$context] as $template_field => $field_setup_array ) { |
|
893 | + if ( ! empty($template_field_structure)) { |
|
894 | + $id_prefix = 'ee-msg-edit-template-fields-'; |
|
895 | + foreach ($template_field_structure[$context] as $template_field => $field_setup_array) { |
|
896 | 896 | //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. |
897 | - if ( $template_field == 'extra' ) { |
|
897 | + if ($template_field == 'extra') { |
|
898 | 898 | $this->_template_args['is_extra_fields'] = TRUE; |
899 | - foreach ( $field_setup_array as $reference_field => $new_fields_array ) { |
|
900 | - foreach ( $new_fields_array as $extra_field => $extra_array ) { |
|
899 | + foreach ($field_setup_array as $reference_field => $new_fields_array) { |
|
900 | + foreach ($new_fields_array as $extra_field => $extra_array) { |
|
901 | 901 | //let's verify if we need this extra field via the shortcodes parameter. |
902 | 902 | $continue = FALSE; |
903 | - if ( isset( $extra_array['shortcodes_required'] ) ) { |
|
904 | - foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) { |
|
905 | - if ( !array_key_exists( $shortcode, $this->_shortcodes ) ) |
|
903 | + if (isset($extra_array['shortcodes_required'])) { |
|
904 | + foreach ((array) $extra_array['shortcodes_required'] as $shortcode) { |
|
905 | + if ( ! array_key_exists($shortcode, $this->_shortcodes)) |
|
906 | 906 | $continue = TRUE; |
907 | 907 | } |
908 | - if ( $continue ) continue; |
|
908 | + if ($continue) continue; |
|
909 | 909 | } |
910 | 910 | |
911 | - $field_id = $reference_field . '-' . $extra_field . '-content'; |
|
911 | + $field_id = $reference_field.'-'.$extra_field.'-content'; |
|
912 | 912 | $template_form_fields[$field_id] = $extra_array; |
913 | - $template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $reference_field . '][content][' . $extra_field . ']'; |
|
914 | - $css_class = isset( $extra_array['css_class'] ) ? $extra_array['css_class'] : ''; |
|
915 | - $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 | + $template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$reference_field.'][content]['.$extra_field.']'; |
|
914 | + $css_class = isset($extra_array['css_class']) ? $extra_array['css_class'] : ''; |
|
915 | + $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; |
|
916 | 916 | $content = $message_templates[$context][$reference_field]->get('MTP_content'); |
917 | - $template_form_fields[$field_id]['value'] = !empty($message_templates) && isset($content[$extra_field]) ? stripslashes( html_entity_decode( $content[$extra_field], ENT_QUOTES, "UTF-8") ) : ''; |
|
917 | + $template_form_fields[$field_id]['value'] = ! empty($message_templates) && isset($content[$extra_field]) ? stripslashes(html_entity_decode($content[$extra_field], ENT_QUOTES, "UTF-8")) : ''; |
|
918 | 918 | |
919 | 919 | //do we have a validation error? if we do then let's use that value instead |
920 | 920 | $template_form_fields[$field_id]['value'] = isset($validators[$extra_field]) ? $validators[$extra_field]['value'] : $template_form_fields[$field_id]['value']; |
@@ -924,32 +924,32 @@ discard block |
||
924 | 924 | |
925 | 925 | //shortcode selector |
926 | 926 | $field_name_to_use = $extra_field == 'main' ? 'content' : $extra_field; |
927 | - $template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector( $field_name_to_use, $field_id ); |
|
927 | + $template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector($field_name_to_use, $field_id); |
|
928 | 928 | |
929 | - if ( isset( $extra_array['input'] ) && $extra_array['input'] == 'wp_editor' ) { |
|
929 | + if (isset($extra_array['input']) && $extra_array['input'] == 'wp_editor') { |
|
930 | 930 | //we want to decode the entities |
931 | - $template_form_fields[$field_id]['value'] = stripslashes( html_entity_decode( $template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8") ); |
|
931 | + $template_form_fields[$field_id]['value'] = stripslashes(html_entity_decode($template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8")); |
|
932 | 932 | |
933 | 933 | }/**/ |
934 | 934 | } |
935 | - $templatefield_MTP_id = $reference_field . '-MTP_ID'; |
|
936 | - $templatefield_templatename_id = $reference_field . '-name'; |
|
935 | + $templatefield_MTP_id = $reference_field.'-MTP_ID'; |
|
936 | + $templatefield_templatename_id = $reference_field.'-name'; |
|
937 | 937 | |
938 | 938 | $template_form_fields[$templatefield_MTP_id] = array( |
939 | - 'name' => 'MTP_template_fields[' . $reference_field . '][MTP_ID]', |
|
939 | + 'name' => 'MTP_template_fields['.$reference_field.'][MTP_ID]', |
|
940 | 940 | 'label' => NULL, |
941 | 941 | 'input' => 'hidden', |
942 | 942 | 'type' => 'int', |
943 | 943 | 'required' => FALSE, |
944 | 944 | 'validation' => FALSE, |
945 | - 'value' => !empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '', |
|
945 | + 'value' => ! empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '', |
|
946 | 946 | 'css_class' => '', |
947 | 947 | 'format' => '%d', |
948 | 948 | 'db-col' => 'MTP_ID' |
949 | 949 | ); |
950 | 950 | |
951 | 951 | $template_form_fields[$templatefield_templatename_id] = array( |
952 | - 'name' => 'MTP_template_fields[' . $reference_field . '][name]', |
|
952 | + 'name' => 'MTP_template_fields['.$reference_field.'][name]', |
|
953 | 953 | 'label' => NULL, |
954 | 954 | 'input' => 'hidden', |
955 | 955 | 'type' => 'string', |
@@ -963,10 +963,10 @@ discard block |
||
963 | 963 | } |
964 | 964 | continue; //skip the next stuff, we got the necessary fields here for this dataset. |
965 | 965 | } else { |
966 | - $field_id = $template_field . '-content'; |
|
966 | + $field_id = $template_field.'-content'; |
|
967 | 967 | $template_form_fields[$field_id] = $field_setup_array; |
968 | - $template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $template_field . '][content]'; |
|
969 | - $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') : ''; |
|
968 | + $template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$template_field.'][content]'; |
|
969 | + $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') : ''; |
|
970 | 970 | |
971 | 971 | //do we have a validator error for this field? if we do then we'll use that value instead |
972 | 972 | $template_form_fields[$field_id]['value'] = isset($validators[$template_field]) ? $validators[$template_field]['value'] : $template_form_fields[$field_id]['value']; |
@@ -974,12 +974,12 @@ discard block |
||
974 | 974 | |
975 | 975 | $template_form_fields[$field_id]['db-col'] = 'MTP_content'; |
976 | 976 | $css_class = isset($field_setup_array['css_class']) ? $field_setup_array['css_class'] : ''; |
977 | - $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; |
|
977 | + $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; |
|
978 | 978 | |
979 | 979 | //shortcode selector |
980 | - $template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector( $template_field, $field_id ); |
|
980 | + $template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector($template_field, $field_id); |
|
981 | 981 | |
982 | - if ( isset( $field_setup_array['input'] ) && $field_setup_array['input'] == 'wp_editor' ) { |
|
982 | + if (isset($field_setup_array['input']) && $field_setup_array['input'] == 'wp_editor') { |
|
983 | 983 | //we want to decode the entities |
984 | 984 | $template_form_fields[$field_id]['value'] = $template_form_fields[$field_id]['value']; |
985 | 985 | }/**/ |
@@ -987,25 +987,25 @@ discard block |
||
987 | 987 | |
988 | 988 | //k took care of content field(s) now let's take care of others. |
989 | 989 | |
990 | - $templatefield_MTP_id = $template_field . '-MTP_ID'; |
|
991 | - $templatefield_field_templatename_id = $template_field . '-name'; |
|
990 | + $templatefield_MTP_id = $template_field.'-MTP_ID'; |
|
991 | + $templatefield_field_templatename_id = $template_field.'-name'; |
|
992 | 992 | |
993 | 993 | //foreach template field there are actually two form fields created |
994 | 994 | $template_form_fields[$templatefield_MTP_id] = array( |
995 | - 'name' => 'MTP_template_fields[' . $template_field . '][MTP_ID]', |
|
995 | + 'name' => 'MTP_template_fields['.$template_field.'][MTP_ID]', |
|
996 | 996 | 'label' => NULL, |
997 | 997 | 'input' => 'hidden', |
998 | 998 | 'type' => 'int', |
999 | 999 | 'required' => FALSE, |
1000 | 1000 | 'validation' => TRUE, |
1001 | - 'value' => !empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '', |
|
1001 | + 'value' => ! empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '', |
|
1002 | 1002 | 'css_class' => '', |
1003 | 1003 | 'format' => '%d', |
1004 | 1004 | 'db-col' => 'MTP_ID' |
1005 | 1005 | ); |
1006 | 1006 | |
1007 | 1007 | $template_form_fields[$templatefield_field_templatename_id] = array( |
1008 | - 'name' => 'MTP_template_fields[' . $template_field . '][name]', |
|
1008 | + 'name' => 'MTP_template_fields['.$template_field.'][name]', |
|
1009 | 1009 | 'label' => NULL, |
1010 | 1010 | 'input' => 'hidden', |
1011 | 1011 | 'type' => 'string', |
@@ -1149,15 +1149,15 @@ discard block |
||
1149 | 1149 | 'value' => $GRP_ID |
1150 | 1150 | ); |
1151 | 1151 | $sidebar_form_fields['ee-msg-evt-nonce'] = array( |
1152 | - 'name' => $action . '_nonce', |
|
1152 | + 'name' => $action.'_nonce', |
|
1153 | 1153 | 'input' => 'hidden', |
1154 | 1154 | 'type' => 'string', |
1155 | - 'value' => wp_create_nonce( $action . '_nonce') |
|
1155 | + 'value' => wp_create_nonce($action.'_nonce') |
|
1156 | 1156 | ); |
1157 | 1157 | |
1158 | 1158 | $sidebar_array = array('ee-msg-is-global', 'ee-msg-is-override', 'ee-msg-deleted', 'ee-msg-is-active'); |
1159 | 1159 | |
1160 | - if ( isset($this->_req_data['template_switch']) && $this->_req_data['template_switch'] ) { |
|
1160 | + if (isset($this->_req_data['template_switch']) && $this->_req_data['template_switch']) { |
|
1161 | 1161 | $sidebar_form_fields['ee-msg-template-switch'] = array( |
1162 | 1162 | 'name' => 'template_switch', |
1163 | 1163 | 'input' => 'hidden', |
@@ -1167,19 +1167,19 @@ discard block |
||
1167 | 1167 | } |
1168 | 1168 | |
1169 | 1169 | |
1170 | - $template_fields = $this->_generate_admin_form_fields( $template_form_fields ); |
|
1171 | - $sidebar_fields = $this->_generate_admin_form_fields( $sidebar_form_fields ); |
|
1170 | + $template_fields = $this->_generate_admin_form_fields($template_form_fields); |
|
1171 | + $sidebar_fields = $this->_generate_admin_form_fields($sidebar_form_fields); |
|
1172 | 1172 | |
1173 | 1173 | |
1174 | 1174 | } //end if ( !empty($template_field_structure) ) |
1175 | 1175 | |
1176 | 1176 | //set extra content for publish box |
1177 | 1177 | $this->_template_args['publish_box_extra_content'] = $sidebar_fields; |
1178 | - $this->_set_publish_post_box_vars( 'id', $GRP_ID ); |
|
1178 | + $this->_set_publish_post_box_vars('id', $GRP_ID); |
|
1179 | 1179 | |
1180 | 1180 | //add preview button |
1181 | - $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 ); |
|
1182 | - $preview_button = '<a href="' . $preview_url . '" class="button-secondary messages-preview-button">' . __('Preview', 'event_espresso') . '</a>'; |
|
1181 | + $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); |
|
1182 | + $preview_button = '<a href="'.$preview_url.'" class="button-secondary messages-preview-button">'.__('Preview', 'event_espresso').'</a>'; |
|
1183 | 1183 | |
1184 | 1184 | |
1185 | 1185 | //setup context switcher |
@@ -1206,16 +1206,16 @@ discard block |
||
1206 | 1206 | $this->_template_args['before_admin_page_content'] .= $this->_add_form_element_before(); |
1207 | 1207 | $this->_template_args['after_admin_page_content'] = $this->_add_form_element_after(); |
1208 | 1208 | |
1209 | - $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'; |
|
1209 | + $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'; |
|
1210 | 1210 | |
1211 | 1211 | //send along EE_Message_Template_Group object for further template use. |
1212 | 1212 | $this->_template_args['MTP'] = $message_template_group; |
1213 | 1213 | |
1214 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_template_path, $this->_template_args, TRUE ); |
|
1214 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE); |
|
1215 | 1215 | |
1216 | 1216 | |
1217 | 1217 | //finally, let's set the admin_page title |
1218 | - $this->_admin_page_title = sprintf( __('Editing %s', 'event_espresso'), $title ); |
|
1218 | + $this->_admin_page_title = sprintf(__('Editing %s', 'event_espresso'), $title); |
|
1219 | 1219 | |
1220 | 1220 | |
1221 | 1221 | //we need to take care of setting the shortcodes property for use elsewhere. |
@@ -1228,7 +1228,7 @@ discard block |
||
1228 | 1228 | } |
1229 | 1229 | |
1230 | 1230 | |
1231 | - public function filter_tinymce_init( $mceInit, $editor_id ) { |
|
1231 | + public function filter_tinymce_init($mceInit, $editor_id) { |
|
1232 | 1232 | return $mceInit; |
1233 | 1233 | } |
1234 | 1234 | |
@@ -1239,7 +1239,7 @@ discard block |
||
1239 | 1239 | } |
1240 | 1240 | |
1241 | 1241 | public function _add_form_element_before() { |
1242 | - return '<form method="post" action="' . $this->_template_args["edit_message_template_form_url"] . '" id="ee-msg-edit-frm">'; |
|
1242 | + return '<form method="post" action="'.$this->_template_args["edit_message_template_form_url"].'" id="ee-msg-edit-frm">'; |
|
1243 | 1243 | } |
1244 | 1244 | |
1245 | 1245 | public function _add_form_element_after() { |
@@ -1257,32 +1257,32 @@ discard block |
||
1257 | 1257 | * @return json json object |
1258 | 1258 | */ |
1259 | 1259 | public function switch_template_pack() { |
1260 | - $GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0; |
|
1261 | - $template_pack = ! empty( $this->_req_data['template_pack'] ) ? $this->_req_data['template_pack'] : ''; |
|
1260 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0; |
|
1261 | + $template_pack = ! empty($this->_req_data['template_pack']) ? $this->_req_data['template_pack'] : ''; |
|
1262 | 1262 | |
1263 | 1263 | //verify we have needed values. |
1264 | - if ( empty( $GRP_ID ) || empty( $template_pack ) ) { |
|
1264 | + if (empty($GRP_ID) || empty($template_pack)) { |
|
1265 | 1265 | $this->_template_args['error'] = TRUE; |
1266 | - EE_Error::add_error( __('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1266 | + EE_Error::add_error(__('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1267 | 1267 | } else { |
1268 | 1268 | //get template, set the new template_pack and then reset to default |
1269 | - $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID ); |
|
1269 | + $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID); |
|
1270 | 1270 | |
1271 | - $mtpg->set_template_pack_name( $template_pack ); |
|
1271 | + $mtpg->set_template_pack_name($template_pack); |
|
1272 | 1272 | $this->_req_data['msgr'] = $mtpg->messenger(); |
1273 | 1273 | $this->_req_data['mt'] = $mtpg->message_type(); |
1274 | 1274 | |
1275 | 1275 | $query_args = $this->_reset_to_default_template(); |
1276 | 1276 | |
1277 | - if ( empty( $query_args['id'] ) ) { |
|
1278 | - EE_Error::add_error( __('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1277 | + if (empty($query_args['id'])) { |
|
1278 | + EE_Error::add_error(__('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1279 | 1279 | $this->_template_args['error'] = TRUE; |
1280 | 1280 | } else { |
1281 | - $template_label =$mtpg->get_template_pack()->label; |
|
1281 | + $template_label = $mtpg->get_template_pack()->label; |
|
1282 | 1282 | $template_pack_labels = $mtpg->messenger_obj()->get_supports_labels(); |
1283 | - 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 ) ); |
|
1283 | + 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)); |
|
1284 | 1284 | //generate the redirect url for js. |
1285 | - $url = self::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1285 | + $url = self::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1286 | 1286 | $this->_template_args['data']['redirect_url'] = $url; |
1287 | 1287 | $this->_template_args['success'] = true; |
1288 | 1288 | } |
@@ -1303,56 +1303,56 @@ discard block |
||
1303 | 1303 | protected function _reset_to_default_template() { |
1304 | 1304 | $success = TRUE; |
1305 | 1305 | $templates = array(); |
1306 | - $GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0; |
|
1306 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0; |
|
1307 | 1307 | //we need to make sure we've got the info we need. |
1308 | - if ( !isset( $this->_req_data['msgr'] ) && !isset( $this->_req_data['mt'] ) && !isset( $this->_req_data['GRP_ID'] ) ) { |
|
1309 | - 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__ ); |
|
1308 | + if ( ! isset($this->_req_data['msgr']) && ! isset($this->_req_data['mt']) && ! isset($this->_req_data['GRP_ID'])) { |
|
1309 | + 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__); |
|
1310 | 1310 | $success = FALSE; |
1311 | 1311 | } |
1312 | 1312 | |
1313 | 1313 | //all templates will be reset to whatever the defaults are for the global template matching the messenger and message type. |
1314 | - $success = !empty( $GRP_ID ) ? TRUE : FALSE; |
|
1314 | + $success = ! empty($GRP_ID) ? TRUE : FALSE; |
|
1315 | 1315 | |
1316 | - if ( $success ) { |
|
1316 | + if ($success) { |
|
1317 | 1317 | |
1318 | 1318 | //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. |
1319 | - $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID ); |
|
1319 | + $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID); |
|
1320 | 1320 | |
1321 | 1321 | |
1322 | 1322 | //note this is ONLY deleteing the template fields (Message Template rows) NOT the message template group. |
1323 | - $success = $this->_delete_mtp_permanently( $GRP_ID, FALSE ); |
|
1323 | + $success = $this->_delete_mtp_permanently($GRP_ID, FALSE); |
|
1324 | 1324 | |
1325 | - if ( $success ) { |
|
1325 | + if ($success) { |
|
1326 | 1326 | //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. |
1327 | - $templates = $this->_generate_new_templates( $this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, TRUE ); |
|
1327 | + $templates = $this->_generate_new_templates($this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, TRUE); |
|
1328 | 1328 | } |
1329 | 1329 | |
1330 | 1330 | } |
1331 | 1331 | |
1332 | 1332 | //any error messages? |
1333 | - if ( !$success ) { |
|
1334 | - EE_Error::add_error( __('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1333 | + if ( ! $success) { |
|
1334 | + EE_Error::add_error(__('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1335 | 1335 | } |
1336 | 1336 | |
1337 | 1337 | //all good, let's add a success message! |
1338 | - if ( $success && ! empty( $templates ) ) { |
|
1338 | + if ($success && ! empty($templates)) { |
|
1339 | 1339 | $templates = $templates[0]; //the info for the template we generated is the first element in the returned array. |
1340 | 1340 | EE_Error::overwrite_success(); |
1341 | - EE_Error::add_success( __('Templates have been reset to defaults.', 'event_espresso') ); |
|
1341 | + EE_Error::add_success(__('Templates have been reset to defaults.', 'event_espresso')); |
|
1342 | 1342 | } |
1343 | 1343 | |
1344 | 1344 | |
1345 | 1345 | $query_args = array( |
1346 | - 'id' => isset( $templates['GRP_ID'] ) ? $templates['GRP_ID'] : NULL, |
|
1347 | - 'context' => isset( $templates['MTP_context'] ) ? $templates['MTP_context'] : NULL, |
|
1348 | - 'action' => isset( $templates['GRP_ID'] ) ? 'edit_message_template' : 'default' |
|
1346 | + 'id' => isset($templates['GRP_ID']) ? $templates['GRP_ID'] : NULL, |
|
1347 | + 'context' => isset($templates['MTP_context']) ? $templates['MTP_context'] : NULL, |
|
1348 | + 'action' => isset($templates['GRP_ID']) ? 'edit_message_template' : 'default' |
|
1349 | 1349 | ); |
1350 | 1350 | |
1351 | 1351 | //if called via ajax then we return query args otherwise redirect |
1352 | - if ( defined('DOING_AJAX') && DOING_AJAX ) { |
|
1352 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
1353 | 1353 | return $query_args; |
1354 | 1354 | } else { |
1355 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
1355 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
1356 | 1356 | } |
1357 | 1357 | |
1358 | 1358 | } |
@@ -1365,20 +1365,20 @@ discard block |
||
1365 | 1365 | * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview. |
1366 | 1366 | * @return void |
1367 | 1367 | */ |
1368 | - public function _preview_message( $send = FALSE ) { |
|
1368 | + public function _preview_message($send = FALSE) { |
|
1369 | 1369 | //first make sure we've got the necessary parameters |
1370 | - if ( !isset( $this->_req_data['message_type'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['GRP_ID'] ) ) { |
|
1371 | - EE_Error::add_error( __('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1370 | + if ( ! isset($this->_req_data['message_type']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['GRP_ID'])) { |
|
1371 | + EE_Error::add_error(__('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1372 | 1372 | } |
1373 | 1373 | |
1374 | - EE_Registry::instance()->REQ->set( 'GRP_ID', $this->_req_data['GRP_ID'] ); |
|
1374 | + EE_Registry::instance()->REQ->set('GRP_ID', $this->_req_data['GRP_ID']); |
|
1375 | 1375 | |
1376 | 1376 | $MSG = new EE_messages(); |
1377 | 1377 | |
1378 | 1378 | //get the preview! |
1379 | - $preview = $MSG->preview_message( $this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send ); |
|
1379 | + $preview = $MSG->preview_message($this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send); |
|
1380 | 1380 | |
1381 | - if ( $send ) { |
|
1381 | + if ($send) { |
|
1382 | 1382 | return $preview; |
1383 | 1383 | } |
1384 | 1384 | |
@@ -1388,16 +1388,16 @@ discard block |
||
1388 | 1388 | 'context' => $this->_req_data['context'], |
1389 | 1389 | 'action' => 'edit_message_template' |
1390 | 1390 | ); |
1391 | - $go_back_url = parent::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1392 | - $preview_button = '<a href="' . $go_back_url . '" class="button-secondary messages-preview-go-back-button">' . __('Go Back to Edit', 'event_espresso') . '</a>'; |
|
1391 | + $go_back_url = parent::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1392 | + $preview_button = '<a href="'.$go_back_url.'" class="button-secondary messages-preview-go-back-button">'.__('Go Back to Edit', 'event_espresso').'</a>'; |
|
1393 | 1393 | |
1394 | 1394 | //let's provide a helpful title for context |
1395 | - $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']) ); |
|
1395 | + $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'])); |
|
1396 | 1396 | |
1397 | 1397 | |
1398 | 1398 | //setup display of preview. |
1399 | 1399 | $this->_admin_page_title = $preview_title; |
1400 | - $this->_template_args['admin_page_content'] = $preview_button . '<br />' .stripslashes($preview); |
|
1400 | + $this->_template_args['admin_page_content'] = $preview_button.'<br />'.stripslashes($preview); |
|
1401 | 1401 | $this->_template_args['data']['force_json'] = TRUE; |
1402 | 1402 | } |
1403 | 1403 | |
@@ -1425,9 +1425,9 @@ discard block |
||
1425 | 1425 | * @return void |
1426 | 1426 | */ |
1427 | 1427 | protected function _register_edit_meta_boxes() { |
1428 | - add_meta_box( 'mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array( $this, 'shortcode_meta_box' ), $this->_current_screen->id, 'side', 'default' ); |
|
1429 | - add_meta_box( 'mtp_extra_actions', __('Extra Actions', 'event_espresso'), array( $this, 'extra_actions_meta_box' ), $this->_current_screen->id, 'side', 'high' ); |
|
1430 | - add_meta_box( 'mtp_templates', __('Template Styles', 'event_espresso'), array( $this, 'template_pack_meta_box' ), $this->_current_screen->id, 'side', 'high' ); |
|
1428 | + add_meta_box('mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array($this, 'shortcode_meta_box'), $this->_current_screen->id, 'side', 'default'); |
|
1429 | + add_meta_box('mtp_extra_actions', __('Extra Actions', 'event_espresso'), array($this, 'extra_actions_meta_box'), $this->_current_screen->id, 'side', 'high'); |
|
1430 | + add_meta_box('mtp_templates', __('Template Styles', 'event_espresso'), array($this, 'template_pack_meta_box'), $this->_current_screen->id, 'side', 'high'); |
|
1431 | 1431 | } |
1432 | 1432 | |
1433 | 1433 | |
@@ -1448,10 +1448,10 @@ discard block |
||
1448 | 1448 | |
1449 | 1449 | $tp_select_values = array(); |
1450 | 1450 | |
1451 | - foreach ( $template_packs as $tp ) { |
|
1451 | + foreach ($template_packs as $tp) { |
|
1452 | 1452 | //only include template packs that support this messenger and message type! |
1453 | 1453 | $supports = $tp->get_supports(); |
1454 | - if ( ! isset( $supports[$this->_message_template_group->messenger()] ) || ! in_array( $this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()] ) ) { |
|
1454 | + if ( ! isset($supports[$this->_message_template_group->messenger()]) || ! in_array($this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()])) { |
|
1455 | 1455 | //not supported |
1456 | 1456 | continue; |
1457 | 1457 | } |
@@ -1463,7 +1463,7 @@ discard block |
||
1463 | 1463 | } |
1464 | 1464 | |
1465 | 1465 | //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. |
1466 | - if ( empty( $tp_select_values ) ) { |
|
1466 | + if (empty($tp_select_values)) { |
|
1467 | 1467 | $tp_select_values[] = array( |
1468 | 1468 | 'text' => __('Default', 'event_espresso'), |
1469 | 1469 | 'id' => 'default' |
@@ -1471,27 +1471,27 @@ discard block |
||
1471 | 1471 | } |
1472 | 1472 | |
1473 | 1473 | //setup variation select values for the currently selected template. |
1474 | - $variations = $this->_message_template_group->get_template_pack()->get_variations( $this->_message_template_group->messenger(), $this->_message_template_group->message_type() ); |
|
1474 | + $variations = $this->_message_template_group->get_template_pack()->get_variations($this->_message_template_group->messenger(), $this->_message_template_group->message_type()); |
|
1475 | 1475 | $variations_select_values = array(); |
1476 | - foreach ( $variations as $variation => $label ) { |
|
1476 | + foreach ($variations as $variation => $label) { |
|
1477 | 1477 | $variations_select_values[] = array( |
1478 | 1478 | 'text' => $label, |
1479 | 1479 | 'id' => $variation |
1480 | 1480 | ); |
1481 | 1481 | } |
1482 | 1482 | |
1483 | - $template_pack_labels= $this->_message_template_group->messenger_obj()->get_supports_labels(); |
|
1483 | + $template_pack_labels = $this->_message_template_group->messenger_obj()->get_supports_labels(); |
|
1484 | 1484 | |
1485 | - $template_args['template_packs_selector'] = EEH_Form_Fields::select_input( 'MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name() ); |
|
1486 | - $template_args['variations_selector'] = EEH_Form_Fields::select_input( 'MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation() ); |
|
1485 | + $template_args['template_packs_selector'] = EEH_Form_Fields::select_input('MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name()); |
|
1486 | + $template_args['variations_selector'] = EEH_Form_Fields::select_input('MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation()); |
|
1487 | 1487 | $template_args['template_pack_label'] = $template_pack_labels->template_pack; |
1488 | 1488 | $template_args['template_variation_label'] = $template_pack_labels->template_variation; |
1489 | 1489 | $template_args['template_pack_description'] = $template_pack_labels->template_pack_description; |
1490 | 1490 | $template_args['template_variation_description'] = $template_pack_labels->template_variation_description; |
1491 | 1491 | |
1492 | - $template = EE_MSG_TEMPLATE_PATH . 'template_pack_and_variations_metabox.template.php'; |
|
1492 | + $template = EE_MSG_TEMPLATE_PATH.'template_pack_and_variations_metabox.template.php'; |
|
1493 | 1493 | |
1494 | - EEH_Template::display_template( $template, $template_args ); |
|
1494 | + EEH_Template::display_template($template, $template_args); |
|
1495 | 1495 | } |
1496 | 1496 | |
1497 | 1497 | |
@@ -1512,52 +1512,52 @@ discard block |
||
1512 | 1512 | 'GRP_ID' => $this->_message_template_group->GRP_ID() |
1513 | 1513 | ); |
1514 | 1514 | |
1515 | - $button = $this->get_action_link_or_button( 'reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button' ); |
|
1515 | + $button = $this->get_action_link_or_button('reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button'); |
|
1516 | 1516 | |
1517 | 1517 | |
1518 | 1518 | //test button |
1519 | 1519 | //first we need to see if there are any fields |
1520 | 1520 | $fields = $this->_message_template_group->messenger_obj()->get_test_settings_fields(); |
1521 | 1521 | |
1522 | - if ( !empty( $fields ) ) { |
|
1522 | + if ( ! empty($fields)) { |
|
1523 | 1523 | //yup there be fields |
1524 | - foreach ( $fields as $field => $config ) { |
|
1525 | - $field_id = $this->_message_template_group->messenger() . '_' . $field; |
|
1524 | + foreach ($fields as $field => $config) { |
|
1525 | + $field_id = $this->_message_template_group->messenger().'_'.$field; |
|
1526 | 1526 | $existing = $this->_message_template_group->messenger_obj()->get_existing_test_settings(); |
1527 | - $default = isset( $config['default'] ) ? $config['default'] : ''; |
|
1528 | - $default = isset( $config['value'] ) ? $config['value'] : $default; |
|
1527 | + $default = isset($config['default']) ? $config['default'] : ''; |
|
1528 | + $default = isset($config['value']) ? $config['value'] : $default; |
|
1529 | 1529 | |
1530 | 1530 | //if type is hidden and the value is empty something may have gone wrong so let's correct with the defaults |
1531 | 1531 | $fix = $config['input'] == 'hidden' && isset($existing[$field]) && empty($existing[$field]) ? $default : ''; |
1532 | - $existing[$field] = isset( $existing[$field] ) && empty( $fix ) ? $existing[$field] : $fix; |
|
1532 | + $existing[$field] = isset($existing[$field]) && empty($fix) ? $existing[$field] : $fix; |
|
1533 | 1533 | |
1534 | 1534 | $template_form_fields[$field_id] = array( |
1535 | - 'name' => 'test_settings_fld[' . $field . ']', |
|
1535 | + 'name' => 'test_settings_fld['.$field.']', |
|
1536 | 1536 | 'label' => $config['label'], |
1537 | 1537 | 'input' => $config['input'], |
1538 | 1538 | 'type' => $config['type'], |
1539 | 1539 | 'required' => $config['required'], |
1540 | 1540 | 'validation' => $config['validation'], |
1541 | - 'value' => isset( $existing[$field] ) ? $existing[$field] : $default, |
|
1541 | + 'value' => isset($existing[$field]) ? $existing[$field] : $default, |
|
1542 | 1542 | 'css_class' => $config['css_class'], |
1543 | - 'options' => isset( $config['options'] ) ? $config['options'] : array(), |
|
1543 | + 'options' => isset($config['options']) ? $config['options'] : array(), |
|
1544 | 1544 | 'default' => $default, |
1545 | 1545 | 'format' => $config['format'] |
1546 | 1546 | ); |
1547 | 1547 | } |
1548 | 1548 | } |
1549 | 1549 | |
1550 | - $test_settings_fields = !empty( $template_form_fields) ? $this->_generate_admin_form_fields( $template_form_fields, 'string', 'ee_tst_settings_flds' ) : ''; |
|
1550 | + $test_settings_fields = ! empty($template_form_fields) ? $this->_generate_admin_form_fields($template_form_fields, 'string', 'ee_tst_settings_flds') : ''; |
|
1551 | 1551 | |
1552 | 1552 | $test_settings_html = ''; |
1553 | 1553 | //print out $test_settings_fields |
1554 | - if ( !empty( $test_settings_fields ) ) { |
|
1554 | + if ( ! empty($test_settings_fields)) { |
|
1555 | 1555 | echo $test_settings_fields; |
1556 | - $test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="' . __('Test Send', 'event_espresso') . '" /><div style="clear:both"></div>'; |
|
1556 | + $test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="'.__('Test Send', 'event_espresso').'" /><div style="clear:both"></div>'; |
|
1557 | 1557 | } |
1558 | 1558 | |
1559 | 1559 | //and button |
1560 | - echo $test_settings_html . '<p>' . __('Need to reset this message type and start over?', 'event_espresso') . '</p>' . '<div class="publishing-action alignright resetbutton">' . $button . '</div><div style="clear:both"></div>'; |
|
1560 | + echo $test_settings_html.'<p>'.__('Need to reset this message type and start over?', 'event_espresso').'</p>'.'<div class="publishing-action alignright resetbutton">'.$button.'</div><div style="clear:both"></div>'; |
|
1561 | 1561 | } |
1562 | 1562 | |
1563 | 1563 | |
@@ -1572,13 +1572,13 @@ discard block |
||
1572 | 1572 | * @param string $linked_input_id The css id of the input that the shortcodes get added to. |
1573 | 1573 | * @return string |
1574 | 1574 | */ |
1575 | - protected function _get_shortcode_selector( $field, $linked_input_id ) { |
|
1575 | + protected function _get_shortcode_selector($field, $linked_input_id) { |
|
1576 | 1576 | $template_args = array( |
1577 | - 'shortcodes' => $this->_get_shortcodes( array( $field ), true ), |
|
1577 | + 'shortcodes' => $this->_get_shortcodes(array($field), true), |
|
1578 | 1578 | 'fieldname' => $field, |
1579 | 1579 | 'linked_input_id' => $linked_input_id |
1580 | 1580 | ); |
1581 | - return EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'shortcode_selector_skeleton.template.php', $template_args, true ); |
|
1581 | + return EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'shortcode_selector_skeleton.template.php', $template_args, true); |
|
1582 | 1582 | } |
1583 | 1583 | |
1584 | 1584 | |
@@ -1592,13 +1592,13 @@ discard block |
||
1592 | 1592 | $shortcodes = $this->_get_shortcodes(array(), FALSE); //just make sure shortcodes property is set |
1593 | 1593 | $messenger = $this->_message_template_group->messenger_obj(); |
1594 | 1594 | //now let's set the content depending on the status of the shortcodes array |
1595 | - if ( empty( $shortcodes ) ) { |
|
1596 | - $content = '<p>' . __('There are no valid shortcodes available', 'event_espresso') . '</p>'; |
|
1595 | + if (empty($shortcodes)) { |
|
1596 | + $content = '<p>'.__('There are no valid shortcodes available', 'event_espresso').'</p>'; |
|
1597 | 1597 | echo $content; |
1598 | 1598 | } else { |
1599 | 1599 | $alt = 0; |
1600 | 1600 | ?> |
1601 | - <div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf( __('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso' ), '<span class="dashicons dashicons-menu"></span>' ); ?></p> |
|
1601 | + <div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf(__('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso'), '<span class="dashicons dashicons-menu"></span>'); ?></p> |
|
1602 | 1602 | <?php |
1603 | 1603 | } |
1604 | 1604 | |
@@ -1615,7 +1615,7 @@ discard block |
||
1615 | 1615 | protected function _set_shortcodes() { |
1616 | 1616 | |
1617 | 1617 | //no need to run this if the property is already set |
1618 | - if ( !empty($this->_shortcodes ) ) return; |
|
1618 | + if ( ! empty($this->_shortcodes)) return; |
|
1619 | 1619 | |
1620 | 1620 | $this->_shortcodes = $this->_get_shortcodes(); |
1621 | 1621 | } |
@@ -1632,14 +1632,14 @@ discard block |
||
1632 | 1632 | * @param boolean $merged Whether to merge all the shortcodes into one list of unique shortcodes |
1633 | 1633 | * @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. |
1634 | 1634 | */ |
1635 | - protected function _get_shortcodes( $fields = array(), $merged = TRUE ) { |
|
1635 | + protected function _get_shortcodes($fields = array(), $merged = TRUE) { |
|
1636 | 1636 | $this->_set_message_template_group(); |
1637 | 1637 | |
1638 | 1638 | //we need the messenger and message template to retrieve the valid shortcodes array. |
1639 | - $GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
1640 | - $context = isset( $this->_req_data['context'] ) ? $this->_req_data['context'] : key( $this->_message_template_group->contexts_config() ); |
|
1639 | + $GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
1640 | + $context = isset($this->_req_data['context']) ? $this->_req_data['context'] : key($this->_message_template_group->contexts_config()); |
|
1641 | 1641 | |
1642 | - return !empty($GRP_ID) ? $this->_message_template_group->get_shortcodes( $context, $fields, $merged ) : array(); |
|
1642 | + return ! empty($GRP_ID) ? $this->_message_template_group->get_shortcodes($context, $fields, $merged) : array(); |
|
1643 | 1643 | } |
1644 | 1644 | |
1645 | 1645 | |
@@ -1652,19 +1652,19 @@ discard block |
||
1652 | 1652 | */ |
1653 | 1653 | protected function _set_message_template_group() { |
1654 | 1654 | |
1655 | - if ( !empty( $this->_message_template_group ) ) |
|
1655 | + if ( ! empty($this->_message_template_group)) |
|
1656 | 1656 | return; //get out if this is already set. |
1657 | 1657 | |
1658 | - $GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : FALSE; |
|
1659 | - $GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID; |
|
1658 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? absint($this->_req_data['GRP_ID']) : FALSE; |
|
1659 | + $GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $GRP_ID; |
|
1660 | 1660 | |
1661 | 1661 | //let's get the message templates |
1662 | 1662 | $MTP = EEM_Message_Template_Group::instance(); |
1663 | 1663 | |
1664 | - if ( empty($GRP_ID) ) |
|
1664 | + if (empty($GRP_ID)) |
|
1665 | 1665 | $this->_message_template_group = $MTP->create_default_object(); |
1666 | 1666 | else |
1667 | - $this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID ); |
|
1667 | + $this->_message_template_group = $MTP->get_one_by_ID($GRP_ID); |
|
1668 | 1668 | |
1669 | 1669 | $this->_template_pack = $this->_message_template_group->get_template_pack(); |
1670 | 1670 | $this->_variation = $this->_message_template_group->get_template_pack_variation(); |
@@ -1690,26 +1690,26 @@ discard block |
||
1690 | 1690 | <div class="ee-msg-switcher-container"> |
1691 | 1691 | <form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm"> |
1692 | 1692 | <?php |
1693 | - foreach ( $args as $name => $value ) { |
|
1694 | - if ( $name == 'context' || empty($value) || $name == 'extra' ) continue; |
|
1693 | + foreach ($args as $name => $value) { |
|
1694 | + if ($name == 'context' || empty($value) || $name == 'extra') continue; |
|
1695 | 1695 | ?> |
1696 | 1696 | <input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" /> |
1697 | 1697 | <?php |
1698 | 1698 | } |
1699 | 1699 | //setup nonce_url |
1700 | - wp_nonce_field($args['action'] . '_nonce', $args['action'] . '_nonce', false); |
|
1700 | + wp_nonce_field($args['action'].'_nonce', $args['action'].'_nonce', false); |
|
1701 | 1701 | ?> |
1702 | 1702 | <select name="context"> |
1703 | 1703 | <?php |
1704 | 1704 | $context_templates = $template_group_object->context_templates(); |
1705 | - if ( is_array($context_templates) ) : |
|
1706 | - foreach ( $context_templates as $context => $template_fields ) : |
|
1705 | + if (is_array($context_templates)) : |
|
1706 | + foreach ($context_templates as $context => $template_fields) : |
|
1707 | 1707 | $checked = ($context == $args['context']) ? 'selected="selected"' : ''; |
1708 | 1708 | ?> |
1709 | 1709 | <option value="<?php echo $context; ?>" <?php echo $checked; ?>><?php echo $context_details[$context]['label']; ?></option> |
1710 | 1710 | <?php endforeach; endif; ?> |
1711 | 1711 | </select> |
1712 | - <?php $button_text = sprintf( __('Switch %s', 'event_espresso'), ucwords($context_label['label']) ); ?> |
|
1712 | + <?php $button_text = sprintf(__('Switch %s', 'event_espresso'), ucwords($context_label['label'])); ?> |
|
1713 | 1713 | <input id="submit-msg-context-switcher-sbmt" class="button-secondary" type="submit" value="<?php echo $button_text; ?>"> |
1714 | 1714 | </form> |
1715 | 1715 | <?php echo $args['extra']; ?> |
@@ -1733,8 +1733,8 @@ discard block |
||
1733 | 1733 | * @param int $index This helps us know which template field to select from the request array. |
1734 | 1734 | */ |
1735 | 1735 | protected function _set_message_template_column_values($index) { |
1736 | - if ( is_array($this->_req_data['MTP_template_fields'][$index]['content'] ) ) { |
|
1737 | - foreach ( $this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value ) { |
|
1736 | + if (is_array($this->_req_data['MTP_template_fields'][$index]['content'])) { |
|
1737 | + foreach ($this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value) { |
|
1738 | 1738 | $this->_req_data['MTP_template_fields'][$index]['content'][$field] = $value; |
1739 | 1739 | } |
1740 | 1740 | } else { |
@@ -1766,27 +1766,27 @@ discard block |
||
1766 | 1766 | |
1767 | 1767 | |
1768 | 1768 | |
1769 | - protected function _insert_or_update_message_template($new = FALSE ) { |
|
1769 | + protected function _insert_or_update_message_template($new = FALSE) { |
|
1770 | 1770 | |
1771 | - do_action ( 'AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1771 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1772 | 1772 | $success = 0; |
1773 | 1773 | $override = FALSE; |
1774 | 1774 | |
1775 | 1775 | //setup notices description |
1776 | - $messenger = !empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'] ) ) : false; |
|
1777 | - $message_type = !empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'] ) ) : false; |
|
1778 | - $context = !empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'] ) ) : false; |
|
1776 | + $messenger = ! empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'])) : false; |
|
1777 | + $message_type = ! empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'])) : false; |
|
1778 | + $context = ! empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'])) : false; |
|
1779 | 1779 | |
1780 | - $item_desc = $messenger ? $messenger . ' ' . $message_type . ' ' . $context . ' ' : ''; |
|
1780 | + $item_desc = $messenger ? $messenger.' '.$message_type.' '.$context.' ' : ''; |
|
1781 | 1781 | $item_desc .= 'Message Template'; |
1782 | 1782 | $query_args = array(); |
1783 | 1783 | $validates = ''; |
1784 | 1784 | |
1785 | 1785 | //if this is "new" then we need to generate the default contexts for the selected messenger/message_type for user to edit. |
1786 | - if ( $new ) { |
|
1787 | - $GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0; |
|
1788 | - if ( $edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID ) ) { |
|
1789 | - if ( empty($edit_array) ) { |
|
1786 | + if ($new) { |
|
1787 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0; |
|
1788 | + if ($edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID)) { |
|
1789 | + if (empty($edit_array)) { |
|
1790 | 1790 | $success = 0; |
1791 | 1791 | } else { |
1792 | 1792 | $success = 1; |
@@ -1805,34 +1805,34 @@ discard block |
||
1805 | 1805 | |
1806 | 1806 | |
1807 | 1807 | //run update for each template field in displayed context |
1808 | - if ( !isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'] ) ) { |
|
1809 | - 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__ ); |
|
1808 | + if ( ! isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'])) { |
|
1809 | + 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__); |
|
1810 | 1810 | $success = 0; |
1811 | 1811 | $action_desc = ''; |
1812 | 1812 | |
1813 | 1813 | } else { |
1814 | 1814 | //first validate all fields! |
1815 | - $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']); |
|
1815 | + $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']); |
|
1816 | 1816 | |
1817 | 1817 | //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. |
1818 | - if ( is_array($validates) && !empty($validates) ) { |
|
1818 | + if (is_array($validates) && ! empty($validates)) { |
|
1819 | 1819 | //add the transient so when the form loads we know which fields to highlight |
1820 | - $this->_add_transient( 'edit_message_template', $validates ); |
|
1820 | + $this->_add_transient('edit_message_template', $validates); |
|
1821 | 1821 | |
1822 | 1822 | $success = 0; |
1823 | - $action_desc =''; |
|
1823 | + $action_desc = ''; |
|
1824 | 1824 | |
1825 | 1825 | //setup notices |
1826 | - foreach ( $validates as $field => $error ) { |
|
1827 | - if ( isset($error['msg'] ) ) |
|
1828 | - EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ ); |
|
1826 | + foreach ($validates as $field => $error) { |
|
1827 | + if (isset($error['msg'])) |
|
1828 | + EE_Error::add_error($error['msg'], __FILE__, __FUNCTION__, __LINE__); |
|
1829 | 1829 | } |
1830 | 1830 | |
1831 | 1831 | } else { |
1832 | - foreach ( $this->_req_data['MTP_template_fields'] as $template_field => $content ) { |
|
1832 | + foreach ($this->_req_data['MTP_template_fields'] as $template_field => $content) { |
|
1833 | 1833 | $set_column_values = $this->_set_message_template_column_values($template_field); |
1834 | 1834 | |
1835 | - $where_cols_n_values = array( 'MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']); |
|
1835 | + $where_cols_n_values = array('MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']); |
|
1836 | 1836 | |
1837 | 1837 | $message_template_fields = array( |
1838 | 1838 | 'GRP_ID' => $set_column_values['GRP_ID'], |
@@ -1840,10 +1840,10 @@ discard block |
||
1840 | 1840 | 'MTP_context' => $set_column_values['MTP_context'], |
1841 | 1841 | 'MTP_content' => $set_column_values['MTP_content'] |
1842 | 1842 | ); |
1843 | - if ( $updated = $MTP->update( $message_template_fields, array( $where_cols_n_values ) ) ) { |
|
1844 | - if ( $updated === FALSE ) { |
|
1845 | - $msg = sprintf( __('%s field was NOT updated for some reason', 'event_espresso'), $template_field ); |
|
1846 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1843 | + if ($updated = $MTP->update($message_template_fields, array($where_cols_n_values))) { |
|
1844 | + if ($updated === FALSE) { |
|
1845 | + $msg = sprintf(__('%s field was NOT updated for some reason', 'event_espresso'), $template_field); |
|
1846 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1847 | 1847 | } else { |
1848 | 1848 | $success = 1; |
1849 | 1849 | } |
@@ -1860,24 +1860,24 @@ discard block |
||
1860 | 1860 | 'MTP_is_override' => $set_column_values['MTP_is_override'], |
1861 | 1861 | 'MTP_deleted' => $set_column_values['MTP_deleted'], |
1862 | 1862 | 'MTP_is_active' => $set_column_values['MTP_is_active'], |
1863 | - 'MTP_name' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_name'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '', |
|
1864 | - 'MTP_description' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_description'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : '' |
|
1863 | + 'MTP_name' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_name']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '', |
|
1864 | + 'MTP_description' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_description']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : '' |
|
1865 | 1865 | ); |
1866 | 1866 | |
1867 | - $mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID'] ); |
|
1868 | - $updated = $MTPG->update( $mtpg_fields, array($mtpg_where) ); |
|
1867 | + $mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID']); |
|
1868 | + $updated = $MTPG->update($mtpg_fields, array($mtpg_where)); |
|
1869 | 1869 | |
1870 | - if ( $updated === FALSE ) { |
|
1871 | - $msg = sprintf( __('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID'] ); |
|
1872 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1870 | + if ($updated === FALSE) { |
|
1871 | + $msg = sprintf(__('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID']); |
|
1872 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1873 | 1873 | } else { |
1874 | 1874 | //k now we need to ensure the template_pack and template_variation fields are set. |
1875 | - $template_pack = ! empty( $this->_req_data['MTP_template_pack' ] ) ? $this->_req_data['MTP_template_pack'] : 'default'; |
|
1876 | - $template_variation = ! empty( $this->_req_data['MTP_template_variation'] ) ? $this->_req_data['MTP_template_variation'] : 'default'; |
|
1877 | - $mtpg_obj = $MTPG->get_one_by_ID( $set_column_values['GRP_ID'] ); |
|
1878 | - if ( $mtpg_obj instanceof EE_Message_Template_Group ) { |
|
1879 | - $mtpg_obj->set_template_pack_name( $template_pack ); |
|
1880 | - $mtpg_obj->set_template_pack_variation( $template_variation ); |
|
1875 | + $template_pack = ! empty($this->_req_data['MTP_template_pack']) ? $this->_req_data['MTP_template_pack'] : 'default'; |
|
1876 | + $template_variation = ! empty($this->_req_data['MTP_template_variation']) ? $this->_req_data['MTP_template_variation'] : 'default'; |
|
1877 | + $mtpg_obj = $MTPG->get_one_by_ID($set_column_values['GRP_ID']); |
|
1878 | + if ($mtpg_obj instanceof EE_Message_Template_Group) { |
|
1879 | + $mtpg_obj->set_template_pack_name($template_pack); |
|
1880 | + $mtpg_obj->set_template_pack_variation($template_variation); |
|
1881 | 1881 | } |
1882 | 1882 | $success = 1; |
1883 | 1883 | } |
@@ -1887,7 +1887,7 @@ discard block |
||
1887 | 1887 | } |
1888 | 1888 | |
1889 | 1889 | //we return things differently if doing ajax |
1890 | - if ( defined('DOING_AJAX') && DOING_AJAX ) { |
|
1890 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
1891 | 1891 | $this->_template_args['success'] = $success; |
1892 | 1892 | $this->_template_args['error'] = ! $success ? TRUE : FALSE; |
1893 | 1893 | $this->_template_args['content'] = ''; |
@@ -1895,9 +1895,9 @@ discard block |
||
1895 | 1895 | 'grpID' => $edit_array['GRP_ID'], |
1896 | 1896 | 'templateName' => $edit_array['template_name'] |
1897 | 1897 | ); |
1898 | - if ( $success ) { |
|
1898 | + if ($success) { |
|
1899 | 1899 | EE_Error::overwrite_success(); |
1900 | - 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') ); |
|
1900 | + 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')); |
|
1901 | 1901 | } |
1902 | 1902 | |
1903 | 1903 | $this->_return_json(); |
@@ -1905,13 +1905,13 @@ discard block |
||
1905 | 1905 | |
1906 | 1906 | |
1907 | 1907 | //was a test send triggered? |
1908 | - if ( isset( $this->_req_data['test_button'] ) ) { |
|
1908 | + if (isset($this->_req_data['test_button'])) { |
|
1909 | 1909 | EE_Error::overwrite_success(); |
1910 | - $this->_do_test_send( $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type'] ); |
|
1910 | + $this->_do_test_send($this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']); |
|
1911 | 1911 | $override = TRUE; |
1912 | 1912 | } |
1913 | 1913 | |
1914 | - if ( empty( $query_args ) ) { |
|
1914 | + if (empty($query_args)) { |
|
1915 | 1915 | $query_args = array( |
1916 | 1916 | 'id' => $this->_req_data['GRP_ID'], |
1917 | 1917 | 'context' => $this->_req_data['MTP_context'], |
@@ -1919,7 +1919,7 @@ discard block |
||
1919 | 1919 | ); |
1920 | 1920 | } |
1921 | 1921 | |
1922 | - $this->_redirect_after_action( $success, $item_desc, $action_desc, $query_args, $override ); |
|
1922 | + $this->_redirect_after_action($success, $item_desc, $action_desc, $query_args, $override); |
|
1923 | 1923 | } |
1924 | 1924 | |
1925 | 1925 | |
@@ -1932,24 +1932,24 @@ discard block |
||
1932 | 1932 | * @param string $message_type message type being tested |
1933 | 1933 | * @return void |
1934 | 1934 | */ |
1935 | - protected function _do_test_send( $context, $messenger, $message_type ) { |
|
1935 | + protected function _do_test_send($context, $messenger, $message_type) { |
|
1936 | 1936 | //set things up for preview |
1937 | 1937 | $this->_req_data['messenger'] = $messenger; |
1938 | 1938 | $this->_req_data['message_type'] = $message_type; |
1939 | 1939 | $this->_req_data['context'] = $context; |
1940 | - $this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : ''; |
|
1940 | + $this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : ''; |
|
1941 | 1941 | |
1942 | 1942 | //let's save any existing fields that might be required by the messenger |
1943 | - if ( isset( $this->_req_data['test_settings_fld'] ) ) { |
|
1944 | - $this->_active_messengers[$messenger]['obj']->set_existing_test_settings( $this->_req_data['test_settings_fld'] ); |
|
1943 | + if (isset($this->_req_data['test_settings_fld'])) { |
|
1944 | + $this->_active_messengers[$messenger]['obj']->set_existing_test_settings($this->_req_data['test_settings_fld']); |
|
1945 | 1945 | } |
1946 | 1946 | |
1947 | 1947 | $success = $this->_preview_message(TRUE); |
1948 | 1948 | |
1949 | - if ( $success ) { |
|
1950 | - EE_Error::add_success( __('Test message sent', 'event_espresso') ); |
|
1949 | + if ($success) { |
|
1950 | + EE_Error::add_success(__('Test message sent', 'event_espresso')); |
|
1951 | 1951 | } else { |
1952 | - EE_Error::add_error( __('The test message was not sent', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1952 | + EE_Error::add_error(__('The test message was not sent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1953 | 1953 | } |
1954 | 1954 | } |
1955 | 1955 | |
@@ -1971,12 +1971,12 @@ discard block |
||
1971 | 1971 | protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = FALSE) { |
1972 | 1972 | |
1973 | 1973 | //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. |
1974 | - if ( empty( $message_types ) ) |
|
1974 | + if (empty($message_types)) |
|
1975 | 1975 | return true; |
1976 | 1976 | |
1977 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
1977 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
1978 | 1978 | |
1979 | - return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID, $global); |
|
1979 | + return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID, $global); |
|
1980 | 1980 | |
1981 | 1981 | } |
1982 | 1982 | |
@@ -1992,33 +1992,33 @@ discard block |
||
1992 | 1992 | * @param boolean $all whether this is going to trash/restore all contexts within a template group (TRUE) OR just an individual context (FALSE). |
1993 | 1993 | * @return void |
1994 | 1994 | */ |
1995 | - protected function _trash_or_restore_message_template($trash = TRUE, $all = FALSE ) { |
|
1996 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1995 | + protected function _trash_or_restore_message_template($trash = TRUE, $all = FALSE) { |
|
1996 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1997 | 1997 | $MTP = EEM_Message_Template_Group::instance(); |
1998 | 1998 | |
1999 | 1999 | $success = 1; |
2000 | 2000 | |
2001 | 2001 | //incoming GRP_IDs |
2002 | - if ( $all ) { |
|
2002 | + if ($all) { |
|
2003 | 2003 | //Checkboxes |
2004 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array($this->_req_data['checkbox'] ) ) { |
|
2004 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2005 | 2005 | //if array has more than one element then success message should be plural. |
2006 | 2006 | //todo: what about nonce? |
2007 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2007 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2008 | 2008 | |
2009 | 2009 | //cycle through checkboxes |
2010 | - while ( list( $GRP_ID, $value ) = each ($this->_req_data['checkbox']) ) { |
|
2011 | - $trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID ); |
|
2012 | - if ( ! $trashed_or_restored ) { |
|
2010 | + while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2011 | + $trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID); |
|
2012 | + if ( ! $trashed_or_restored) { |
|
2013 | 2013 | $success = 0; |
2014 | 2014 | } |
2015 | 2015 | } |
2016 | 2016 | } else { |
2017 | 2017 | //grab single GRP_ID and handle |
2018 | - $GRP_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
2019 | - if ( ! empty( $GRP_ID ) ) { |
|
2020 | - $trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID ); |
|
2021 | - if ( ! $trashed_or_restored ) { |
|
2018 | + $GRP_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
2019 | + if ( ! empty($GRP_ID)) { |
|
2020 | + $trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID); |
|
2021 | + if ( ! $trashed_or_restored) { |
|
2022 | 2022 | $success = 0; |
2023 | 2023 | } |
2024 | 2024 | } else { |
@@ -2030,13 +2030,13 @@ discard block |
||
2030 | 2030 | |
2031 | 2031 | $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
2032 | 2032 | |
2033 | - $action_desc = !empty( $this->_req_data['template_switch'] ) ? __('switched') : $action_desc; |
|
2033 | + $action_desc = ! empty($this->_req_data['template_switch']) ? __('switched') : $action_desc; |
|
2034 | 2034 | |
2035 | 2035 | $item_desc = $all ? _n('Message Template Group', 'Message Template Groups', $success, 'event_espresso') : _n('Message Template Context', 'Message Template Contexts', $success, 'event_espresso'); |
2036 | 2036 | |
2037 | - $item_desc = !empty( $this->_req_data['template_switch'] ) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc; |
|
2037 | + $item_desc = ! empty($this->_req_data['template_switch']) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc; |
|
2038 | 2038 | |
2039 | - $this->_redirect_after_action( $success, $item_desc, $action_desc, array() ); |
|
2039 | + $this->_redirect_after_action($success, $item_desc, $action_desc, array()); |
|
2040 | 2040 | |
2041 | 2041 | } |
2042 | 2042 | |
@@ -2052,26 +2052,26 @@ discard block |
||
2052 | 2052 | * @return void |
2053 | 2053 | */ |
2054 | 2054 | protected function _delete_message_template() { |
2055 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2055 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2056 | 2056 | |
2057 | 2057 | $success = 1; |
2058 | 2058 | |
2059 | 2059 | //checkboxes |
2060 | - if ( !empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'] ) ) { |
|
2060 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2061 | 2061 | //if array has more than one element then success message should be plural |
2062 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2062 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2063 | 2063 | |
2064 | 2064 | //cycle through bulk action checkboxes |
2065 | - while ( list( $GRP_ID, $value ) = each($this->_req_data['checkbox'] ) ) { |
|
2066 | - $success = $this->_delete_mtp_permanently( $GRP_ID ); |
|
2065 | + while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2066 | + $success = $this->_delete_mtp_permanently($GRP_ID); |
|
2067 | 2067 | } |
2068 | 2068 | } else { |
2069 | 2069 | //grab single grp_id and delete |
2070 | - $GRP_ID = absint($this->_req_data['id'] ); |
|
2071 | - $success = $this->_delete_mtp_permanently( $GRP_ID ); |
|
2070 | + $GRP_ID = absint($this->_req_data['id']); |
|
2071 | + $success = $this->_delete_mtp_permanently($GRP_ID); |
|
2072 | 2072 | } |
2073 | 2073 | |
2074 | - $this->_redirect_after_action( $success, 'Message Templates', 'deleted', array() ); |
|
2074 | + $this->_redirect_after_action($success, 'Message Templates', 'deleted', array()); |
|
2075 | 2075 | |
2076 | 2076 | } |
2077 | 2077 | |
@@ -2084,20 +2084,20 @@ discard block |
||
2084 | 2084 | * @param bool $include_group whether to delete the Message Template Group as well. |
2085 | 2085 | * @return success boolean to indicate the success of the deletes or not. |
2086 | 2086 | */ |
2087 | - private function _delete_mtp_permanently( $GRP_ID, $include_group = TRUE ) { |
|
2087 | + private function _delete_mtp_permanently($GRP_ID, $include_group = TRUE) { |
|
2088 | 2088 | $success = 1; |
2089 | 2089 | $MTPG = EEM_Message_Template_Group::instance(); |
2090 | 2090 | //first let's GET this group |
2091 | - $MTG = $MTPG->get_one_by_ID( $GRP_ID ); |
|
2091 | + $MTG = $MTPG->get_one_by_ID($GRP_ID); |
|
2092 | 2092 | //then delete permanently all the related Message Templates |
2093 | - $deleted = $MTG->delete_related_permanently( 'Message_Template' ); |
|
2093 | + $deleted = $MTG->delete_related_permanently('Message_Template'); |
|
2094 | 2094 | |
2095 | - if ( $deleted === 0 ) |
|
2095 | + if ($deleted === 0) |
|
2096 | 2096 | $success = 0; |
2097 | 2097 | |
2098 | 2098 | //now delete permanently this particular group |
2099 | 2099 | |
2100 | - if ( $include_group && ! $MTG->delete_permanently() ) { |
|
2100 | + if ($include_group && ! $MTG->delete_permanently()) { |
|
2101 | 2101 | $success = 0; |
2102 | 2102 | } |
2103 | 2103 | return $success; |
@@ -2115,7 +2115,7 @@ discard block |
||
2115 | 2115 | * @return string |
2116 | 2116 | */ |
2117 | 2117 | protected function _learn_more_about_message_templates_link() { |
2118 | - return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>'; |
|
2118 | + return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how message templates works', 'event_espresso').'</a>'; |
|
2119 | 2119 | } |
2120 | 2120 | |
2121 | 2121 | |
@@ -2129,14 +2129,14 @@ discard block |
||
2129 | 2129 | */ |
2130 | 2130 | protected function _settings() { |
2131 | 2131 | |
2132 | - EE_Registry::instance()->load_helper( 'Tabbed_Content' ); |
|
2132 | + EE_Registry::instance()->load_helper('Tabbed_Content'); |
|
2133 | 2133 | |
2134 | 2134 | $this->_set_m_mt_settings(); |
2135 | 2135 | |
2136 | - $selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2136 | + $selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2137 | 2137 | |
2138 | 2138 | //let's setup the messenger tabs |
2139 | - $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger ); |
|
2139 | + $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger); |
|
2140 | 2140 | $this->_template_args['before_admin_page_content'] = '<div class="ui-widget ui-helper-clearfix">'; |
2141 | 2141 | $this->_template_args['after_admin_page_content'] = '</div><!-- end .ui-widget -->'; |
2142 | 2142 | |
@@ -2155,10 +2155,10 @@ discard block |
||
2155 | 2155 | */ |
2156 | 2156 | protected function _set_m_mt_settings() { |
2157 | 2157 | //first if this is already set then lets get out no need to regenerate data. |
2158 | - if ( !empty($this->_m_mt_settings) ) |
|
2158 | + if ( ! empty($this->_m_mt_settings)) |
|
2159 | 2159 | return; |
2160 | 2160 | |
2161 | - $selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2161 | + $selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2162 | 2162 | |
2163 | 2163 | //get all installed messengers and message_types |
2164 | 2164 | $installed_message_objects = $this->_get_installed_message_objects(); |
@@ -2168,10 +2168,10 @@ discard block |
||
2168 | 2168 | |
2169 | 2169 | //assemble the array for the _tab_text_links helper |
2170 | 2170 | |
2171 | - foreach ( $messengers as $messenger ) { |
|
2171 | + foreach ($messengers as $messenger) { |
|
2172 | 2172 | $this->_m_mt_settings['messenger_tabs'][$messenger->name] = array( |
2173 | 2173 | 'label' => ucwords($messenger->label['singular']), |
2174 | - 'class' => isset( $this->_active_messengers[$messenger->name] ) ? 'messenger-active' : '', |
|
2174 | + 'class' => isset($this->_active_messengers[$messenger->name]) ? 'messenger-active' : '', |
|
2175 | 2175 | 'href' => $messenger->name, |
2176 | 2176 | 'title' => __('Modify this Messenger', 'event_espresso'), |
2177 | 2177 | 'slug' => $messenger->name, |
@@ -2181,23 +2181,23 @@ discard block |
||
2181 | 2181 | $message_types_for_messenger = $messenger->get_valid_message_types(); |
2182 | 2182 | |
2183 | 2183 | //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. |
2184 | - $selected_settings = isset( $this->_active_messengers[$messenger->name]['settings'] ) ? $this->_active_messengers[$messenger->name]['settings'] : array(); |
|
2185 | - foreach ( $message_types as $message_type ) { |
|
2184 | + $selected_settings = isset($this->_active_messengers[$messenger->name]['settings']) ? $this->_active_messengers[$messenger->name]['settings'] : array(); |
|
2185 | + foreach ($message_types as $message_type) { |
|
2186 | 2186 | //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. |
2187 | - if ( ! in_array( $message_type->name, $message_types_for_messenger ) ) { |
|
2187 | + if ( ! in_array($message_type->name, $message_types_for_messenger)) { |
|
2188 | 2188 | continue; |
2189 | 2189 | } |
2190 | 2190 | |
2191 | - $a_or_i = isset( $selected_settings[$messenger->name . '-message_types'][$message_type->name] ) && $selected_settings[$messenger->name . '-message_types'][$message_type->name] ? 'active' : 'inactive'; |
|
2191 | + $a_or_i = isset($selected_settings[$messenger->name.'-message_types'][$message_type->name]) && $selected_settings[$messenger->name.'-message_types'][$message_type->name] ? 'active' : 'inactive'; |
|
2192 | 2192 | |
2193 | 2193 | $this->_m_mt_settings['message_type_tabs'][$messenger->name][$a_or_i][$message_type->name] = array( |
2194 | 2194 | 'label' => ucwords($message_type->label['singular']), |
2195 | - 'class' => 'message-type-' . $a_or_i, |
|
2196 | - 'slug_id' => $message_type->name . '-messagetype-' . $messenger->name, |
|
2197 | - 'mt_nonce' => wp_create_nonce($message_type->name . '_nonce'), |
|
2198 | - 'href' => 'espresso_' . $message_type->name . '_message_type_settings', |
|
2195 | + 'class' => 'message-type-'.$a_or_i, |
|
2196 | + 'slug_id' => $message_type->name.'-messagetype-'.$messenger->name, |
|
2197 | + 'mt_nonce' => wp_create_nonce($message_type->name.'_nonce'), |
|
2198 | + 'href' => 'espresso_'.$message_type->name.'_message_type_settings', |
|
2199 | 2199 | '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'), |
2200 | - 'content' => $a_or_i == 'active' ? $this->_message_type_settings_content( $message_type, $messenger, TRUE ) : $this->_message_type_settings_content( $message_type, $messenger ), |
|
2200 | + 'content' => $a_or_i == 'active' ? $this->_message_type_settings_content($message_type, $messenger, TRUE) : $this->_message_type_settings_content($message_type, $messenger), |
|
2201 | 2201 | 'slug' => $message_type->name, |
2202 | 2202 | 'active' => $a_or_i == 'active' ? TRUE : FALSE, |
2203 | 2203 | 'obj' => $message_type |
@@ -2214,34 +2214,34 @@ discard block |
||
2214 | 2214 | * @param boolean $active Whether the message type is active or not |
2215 | 2215 | * @return string html output for the content |
2216 | 2216 | */ |
2217 | - protected function _message_type_settings_content( $message_type, $messenger, $active = FALSE ) { |
|
2217 | + protected function _message_type_settings_content($message_type, $messenger, $active = FALSE) { |
|
2218 | 2218 | //get message type fields |
2219 | 2219 | $fields = $message_type->get_admin_settings_fields(); |
2220 | - $settings_template_args['template_form_fields']= ''; |
|
2220 | + $settings_template_args['template_form_fields'] = ''; |
|
2221 | 2221 | |
2222 | - if ( !empty( $fields ) && $active ) { |
|
2222 | + if ( ! empty($fields) && $active) { |
|
2223 | 2223 | |
2224 | - $existing_settings = $message_type->get_existing_admin_settings( $messenger->name ); |
|
2224 | + $existing_settings = $message_type->get_existing_admin_settings($messenger->name); |
|
2225 | 2225 | |
2226 | - foreach( $fields as $fldname => $fldprops ) { |
|
2227 | - $field_id = $messenger->name . '-' . $message_type->name . '-' . $fldname; |
|
2226 | + foreach ($fields as $fldname => $fldprops) { |
|
2227 | + $field_id = $messenger->name.'-'.$message_type->name.'-'.$fldname; |
|
2228 | 2228 | $template_form_field[$field_id] = array( |
2229 | - 'name' => 'message_type_settings[' . $fldname . ']', |
|
2229 | + 'name' => 'message_type_settings['.$fldname.']', |
|
2230 | 2230 | 'label' => $fldprops['label'], |
2231 | 2231 | 'input' => $fldprops['field_type'], |
2232 | 2232 | 'type' => $fldprops['value_type'], |
2233 | 2233 | 'required' => $fldprops['required'], |
2234 | 2234 | 'validation' => $fldprops['validation'], |
2235 | - 'value' => isset( $existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2236 | - 'options' => isset( $fldprops['options'] ) ? $fldprops['options'] : array(), |
|
2237 | - 'default' => isset( $existing_settings[$fldname] ) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2235 | + 'value' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2236 | + 'options' => isset($fldprops['options']) ? $fldprops['options'] : array(), |
|
2237 | + 'default' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2238 | 2238 | 'css_class' => 'no-drag', |
2239 | 2239 | 'format' => $fldprops['format'] |
2240 | 2240 | ); |
2241 | 2241 | } |
2242 | 2242 | |
2243 | 2243 | |
2244 | - $settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_mt_activate_form' ) : ''; |
|
2244 | + $settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_mt_activate_form') : ''; |
|
2245 | 2245 | } |
2246 | 2246 | |
2247 | 2247 | $settings_template_args['description'] = $message_type->description; |
@@ -2261,13 +2261,13 @@ discard block |
||
2261 | 2261 | ) |
2262 | 2262 | ); |
2263 | 2263 | |
2264 | - $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' ); |
|
2265 | - $settings_template_args['show_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : ''; |
|
2264 | + $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array'); |
|
2265 | + $settings_template_args['show_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : ''; |
|
2266 | 2266 | |
2267 | 2267 | |
2268 | 2268 | |
2269 | - $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_mt_settings_content.template.php'; |
|
2270 | - $content = EEH_Template::display_template( $template, $settings_template_args, TRUE ); |
|
2269 | + $template = EE_MSG_TEMPLATE_PATH.'ee_msg_mt_settings_content.template.php'; |
|
2270 | + $content = EEH_Template::display_template($template, $settings_template_args, TRUE); |
|
2271 | 2271 | return $content; |
2272 | 2272 | } |
2273 | 2273 | |
@@ -2284,21 +2284,21 @@ discard block |
||
2284 | 2284 | $m_boxes = $mt_boxes = array(); |
2285 | 2285 | $m_template_args = $mt_template_args = array(); |
2286 | 2286 | |
2287 | - $selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2287 | + $selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2288 | 2288 | |
2289 | - foreach ( $this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array ) { |
|
2289 | + foreach ($this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array) { |
|
2290 | 2290 | |
2291 | - $hide_on_message = isset( $this->_active_messengers[$messenger] ) ? '' : 'hidden'; |
|
2292 | - $hide_off_message = isset( $this->_active_messengers[$messenger] ) ? 'hidden' : ''; |
|
2291 | + $hide_on_message = isset($this->_active_messengers[$messenger]) ? '' : 'hidden'; |
|
2292 | + $hide_off_message = isset($this->_active_messengers[$messenger]) ? 'hidden' : ''; |
|
2293 | 2293 | |
2294 | 2294 | //messenger meta boxes |
2295 | 2295 | $active = $selected_messenger == $messenger ? TRUE : FALSE; |
2296 | - $active_mt_tabs = isset( $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] ) ? $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : ''; |
|
2297 | - $m_boxes[$messenger . '_a_box'] = sprintf( __('%s Settings', 'event_espresso'), $tab_array['label'] ); |
|
2298 | - $m_template_args[$messenger . '_a_box'] = array( |
|
2299 | - 'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '', |
|
2300 | - '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'] ) : '', |
|
2301 | - 'content' => $this->_get_messenger_box_content( $tab_array['obj'] ), |
|
2296 | + $active_mt_tabs = isset($this->_m_mt_settings['message_type_tabs'][$messenger]['active']) ? $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : ''; |
|
2297 | + $m_boxes[$messenger.'_a_box'] = sprintf(__('%s Settings', 'event_espresso'), $tab_array['label']); |
|
2298 | + $m_template_args[$messenger.'_a_box'] = array( |
|
2299 | + 'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '', |
|
2300 | + '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']) : '', |
|
2301 | + 'content' => $this->_get_messenger_box_content($tab_array['obj']), |
|
2302 | 2302 | 'hidden' => $active ? '' : ' hidden', |
2303 | 2303 | 'hide_on_message' => $hide_on_message, |
2304 | 2304 | 'messenger' => $messenger, |
@@ -2307,10 +2307,10 @@ discard block |
||
2307 | 2307 | |
2308 | 2308 | |
2309 | 2309 | //message type meta boxes (which is really just the inactive container for each messenger showing inactive message types for that messenger) |
2310 | - $mt_boxes[$messenger . '_i_box'] = __('Inactive Message Types', 'event_espresso'); |
|
2311 | - $mt_template_args[$messenger . '_i_box'] = array( |
|
2312 | - 'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '', |
|
2313 | - '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'] ) : '', |
|
2310 | + $mt_boxes[$messenger.'_i_box'] = __('Inactive Message Types', 'event_espresso'); |
|
2311 | + $mt_template_args[$messenger.'_i_box'] = array( |
|
2312 | + 'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '', |
|
2313 | + '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']) : '', |
|
2314 | 2314 | 'hidden' => $active ? '' : ' hidden', |
2315 | 2315 | 'hide_on_message' => $hide_on_message, |
2316 | 2316 | 'hide_off_message' => $hide_off_message, |
@@ -2320,19 +2320,19 @@ discard block |
||
2320 | 2320 | } |
2321 | 2321 | |
2322 | 2322 | //register messenger metaboxes |
2323 | - $m_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_mt_meta_box.template.php'; |
|
2324 | - foreach ( $m_boxes as $box => $label ) { |
|
2325 | - $callback_args = array( 'template_path' => $m_template_path, 'template_args' => $m_template_args[$box] ); |
|
2326 | - $msgr = str_replace( '_a_box', '', $box ); |
|
2327 | - 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 ); |
|
2323 | + $m_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_mt_meta_box.template.php'; |
|
2324 | + foreach ($m_boxes as $box => $label) { |
|
2325 | + $callback_args = array('template_path' => $m_template_path, 'template_args' => $m_template_args[$box]); |
|
2326 | + $msgr = str_replace('_a_box', '', $box); |
|
2327 | + 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); |
|
2328 | 2328 | } |
2329 | 2329 | |
2330 | 2330 | //register message type metaboxes |
2331 | - $mt_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_meta_box.template.php'; |
|
2332 | - foreach ( $mt_boxes as $box => $label ) { |
|
2333 | - $callback_args = array( 'template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box] ); |
|
2334 | - $mt = str_replace( '_i_box', '', $box ); |
|
2335 | - 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 ); |
|
2331 | + $mt_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_meta_box.template.php'; |
|
2332 | + foreach ($mt_boxes as $box => $label) { |
|
2333 | + $callback_args = array('template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box]); |
|
2334 | + $mt = str_replace('_i_box', '', $box); |
|
2335 | + 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); |
|
2336 | 2336 | } |
2337 | 2337 | |
2338 | 2338 | } |
@@ -2343,13 +2343,13 @@ discard block |
||
2343 | 2343 | * @param array $tab_array This is an array of message type tab details used to generate the tabs |
2344 | 2344 | * @return string html formatted tabs |
2345 | 2345 | */ |
2346 | - protected function _get_mt_tabs( $tab_array ) { |
|
2346 | + protected function _get_mt_tabs($tab_array) { |
|
2347 | 2347 | $tab_array = (array) $tab_array; |
2348 | - $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_mt_settings_tab_item.template.php'; |
|
2348 | + $template = EE_MSG_TEMPLATE_PATH.'ee_msg_details_mt_settings_tab_item.template.php'; |
|
2349 | 2349 | $tabs = ''; |
2350 | 2350 | |
2351 | - foreach ( $tab_array as $tab ) { |
|
2352 | - $tabs .= EEH_Template::display_template( $template, $tab, TRUE ); |
|
2351 | + foreach ($tab_array as $tab) { |
|
2352 | + $tabs .= EEH_Template::display_template($template, $tab, TRUE); |
|
2353 | 2353 | } |
2354 | 2354 | |
2355 | 2355 | return $tabs; |
@@ -2363,7 +2363,7 @@ discard block |
||
2363 | 2363 | * @param object $messenger The messenger we're setting up content for |
2364 | 2364 | * @return string html formatted content |
2365 | 2365 | */ |
2366 | - protected function _get_messenger_box_content( $messenger ) { |
|
2366 | + protected function _get_messenger_box_content($messenger) { |
|
2367 | 2367 | |
2368 | 2368 | $fields = $messenger->get_admin_settings_fields(); |
2369 | 2369 | $settings_template_args['template_form_fields'] = ''; |
@@ -2372,27 +2372,27 @@ discard block |
||
2372 | 2372 | $settings_template_args['active'] = isset($this->_active_messengers[$messenger->name]) ? TRUE : FALSE; |
2373 | 2373 | |
2374 | 2374 | |
2375 | - if ( !empty( $fields ) ) { |
|
2375 | + if ( ! empty($fields)) { |
|
2376 | 2376 | |
2377 | 2377 | $existing_settings = $messenger->get_existing_admin_settings(); |
2378 | 2378 | |
2379 | - foreach( $fields as $fldname => $fldprops ) { |
|
2380 | - $field_id = $messenger->name . '-' . $fldname; |
|
2379 | + foreach ($fields as $fldname => $fldprops) { |
|
2380 | + $field_id = $messenger->name.'-'.$fldname; |
|
2381 | 2381 | $template_form_field[$field_id] = array( |
2382 | - 'name' => 'messenger_settings[' . $field_id . ']', |
|
2382 | + 'name' => 'messenger_settings['.$field_id.']', |
|
2383 | 2383 | 'label' => $fldprops['label'], |
2384 | 2384 | 'input' => $fldprops['field_type'], |
2385 | 2385 | 'type' => $fldprops['value_type'], |
2386 | 2386 | 'required' => $fldprops['required'], |
2387 | 2387 | 'validation' => $fldprops['validation'], |
2388 | - 'value' => isset( $existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'], |
|
2388 | + 'value' => isset($existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'], |
|
2389 | 2389 | 'css_class' => '', |
2390 | 2390 | 'format' => $fldprops['format'] |
2391 | 2391 | ); |
2392 | 2392 | } |
2393 | 2393 | |
2394 | 2394 | |
2395 | - $settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_m_activate_form' ) : ''; |
|
2395 | + $settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_m_activate_form') : ''; |
|
2396 | 2396 | } |
2397 | 2397 | |
2398 | 2398 | //we also need some hidden fields |
@@ -2408,8 +2408,8 @@ discard block |
||
2408 | 2408 | ); |
2409 | 2409 | |
2410 | 2410 | //make sure any active message types that are existing are included in the hidden fields |
2411 | - if ( isset( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] ) ) { |
|
2412 | - foreach ( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values ) { |
|
2411 | + if (isset($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'])) { |
|
2412 | + foreach ($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values) { |
|
2413 | 2413 | $settings_template_args['hidden_fields']['messenger_settings[message_types]['.$mt.']'] = array( |
2414 | 2414 | 'type' => 'hidden', |
2415 | 2415 | 'value' => $mt |
@@ -2417,25 +2417,25 @@ discard block |
||
2417 | 2417 | } |
2418 | 2418 | } |
2419 | 2419 | |
2420 | - $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' ); |
|
2420 | + $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array'); |
|
2421 | 2421 | |
2422 | - $active = isset( $this->_active_messengers[$messenger->name] ) ? TRUE : FALSE; |
|
2422 | + $active = isset($this->_active_messengers[$messenger->name]) ? TRUE : FALSE; |
|
2423 | 2423 | |
2424 | 2424 | $settings_template_args['messenger'] = $messenger->name; |
2425 | 2425 | $settings_template_args['description'] = $messenger->description; |
2426 | 2426 | $settings_template_args['show_hide_edit_form'] = $active ? '' : ' hidden'; |
2427 | 2427 | |
2428 | 2428 | |
2429 | - $settings_template_args['show_hide_edit_form'] = isset( $this->_active_messengers[$messenger->name] ) ? $settings_template_args['show_hide_edit_form'] : ' hidden'; |
|
2429 | + $settings_template_args['show_hide_edit_form'] = isset($this->_active_messengers[$messenger->name]) ? $settings_template_args['show_hide_edit_form'] : ' hidden'; |
|
2430 | 2430 | |
2431 | - $settings_template_args['show_hide_edit_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : $settings_template_args['show_hide_edit_form']; |
|
2431 | + $settings_template_args['show_hide_edit_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : $settings_template_args['show_hide_edit_form']; |
|
2432 | 2432 | |
2433 | 2433 | |
2434 | 2434 | $settings_template_args['on_off_action'] = $active ? 'messenger-off' : 'messenger-on'; |
2435 | - $settings_template_args['nonce'] = wp_create_nonce('activate_' . $messenger->name . '_toggle_nonce'); |
|
2435 | + $settings_template_args['nonce'] = wp_create_nonce('activate_'.$messenger->name.'_toggle_nonce'); |
|
2436 | 2436 | $settings_template_args['on_off_status'] = $active ? true : false; |
2437 | - $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_m_settings_content.template.php'; |
|
2438 | - $content = EEH_Template::display_template( $template, $settings_template_args, TRUE); |
|
2437 | + $template = EE_MSG_TEMPLATE_PATH.'ee_msg_m_settings_content.template.php'; |
|
2438 | + $content = EEH_Template::display_template($template, $settings_template_args, TRUE); |
|
2439 | 2439 | return $content; |
2440 | 2440 | } |
2441 | 2441 | |
@@ -2449,39 +2449,39 @@ discard block |
||
2449 | 2449 | public function activate_messenger_toggle() { |
2450 | 2450 | $success = TRUE; |
2451 | 2451 | //let's check that we have required data |
2452 | - if ( !isset( $this->_req_data[ 'messenger' ] ) ) { |
|
2453 | - EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2452 | + if ( ! isset($this->_req_data['messenger'])) { |
|
2453 | + EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2454 | 2454 | $success = FALSE; |
2455 | 2455 | } |
2456 | 2456 | |
2457 | 2457 | //do a nonce check here since we're not arriving via a normal route |
2458 | - $nonce = isset($this->_req_data[ 'activate_nonce' ]) ? sanitize_text_field( $this->_req_data[ 'activate_nonce'] ) : ''; |
|
2459 | - $nonce_ref = 'activate_' . $this->_req_data['messenger'] . '_toggle_nonce'; |
|
2458 | + $nonce = isset($this->_req_data['activate_nonce']) ? sanitize_text_field($this->_req_data['activate_nonce']) : ''; |
|
2459 | + $nonce_ref = 'activate_'.$this->_req_data['messenger'].'_toggle_nonce'; |
|
2460 | 2460 | |
2461 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
2461 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
2462 | 2462 | |
2463 | 2463 | |
2464 | 2464 | |
2465 | - if ( !isset( $this->_req_data[ 'status' ])) { |
|
2466 | - EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2465 | + if ( ! isset($this->_req_data['status'])) { |
|
2466 | + EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2467 | 2467 | $success = FALSE; |
2468 | 2468 | } |
2469 | 2469 | |
2470 | 2470 | //do check to verify we have a valid status. |
2471 | 2471 | $status = $this->_req_data['status']; |
2472 | 2472 | |
2473 | - if ( $status != 'off' && $status != 'on' ) { |
|
2474 | - 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__ ); |
|
2473 | + if ($status != 'off' && $status != 'on') { |
|
2474 | + 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__); |
|
2475 | 2475 | $success = FALSE; |
2476 | 2476 | } |
2477 | 2477 | |
2478 | - if ( $success ) { |
|
2478 | + if ($success) { |
|
2479 | 2479 | //made it here? Stop dawdling then!! |
2480 | - if ( $status == 'off' ) { |
|
2480 | + if ($status == 'off') { |
|
2481 | 2481 | //off = deactivate. get it? |
2482 | - $success = $this->_activate_messenger( $this->_req_data['messenger'], TRUE ); |
|
2482 | + $success = $this->_activate_messenger($this->_req_data['messenger'], TRUE); |
|
2483 | 2483 | } else { |
2484 | - $success = $this->_activate_messenger( $this->_req_data['messenger'] ); |
|
2484 | + $success = $this->_activate_messenger($this->_req_data['messenger']); |
|
2485 | 2485 | } |
2486 | 2486 | } |
2487 | 2487 | |
@@ -2507,26 +2507,26 @@ discard block |
||
2507 | 2507 | |
2508 | 2508 | |
2509 | 2509 | //let's make sure we have the necessary data |
2510 | - if ( !isset( $this->_req_data[ 'message_type' ] ) ) { |
|
2511 | - EE_Error::add_error( __('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2510 | + if ( ! isset($this->_req_data['message_type'])) { |
|
2511 | + EE_Error::add_error(__('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2512 | 2512 | $success = FALSE; |
2513 | 2513 | } |
2514 | 2514 | |
2515 | 2515 | |
2516 | 2516 | //do a nonce check here since we're not arriving via a normal route |
2517 | - $nonce = isset( $this->_req_data['mt_nonce'] ) ? sanitize_text_field( $this->_req_data['mt_nonce'] ) : ''; |
|
2518 | - $nonce_ref = $this->_req_data['message_type'] . '_nonce'; |
|
2517 | + $nonce = isset($this->_req_data['mt_nonce']) ? sanitize_text_field($this->_req_data['mt_nonce']) : ''; |
|
2518 | + $nonce_ref = $this->_req_data['message_type'].'_nonce'; |
|
2519 | 2519 | |
2520 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
2520 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
2521 | 2521 | |
2522 | 2522 | |
2523 | - if ( !isset( $this->_req_data[ 'messenger' ] ) ) { |
|
2524 | - EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2523 | + if ( ! isset($this->_req_data['messenger'])) { |
|
2524 | + EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2525 | 2525 | $success = FALSE; |
2526 | 2526 | } |
2527 | 2527 | |
2528 | - if ( !isset( $this->_req_data[ 'status' ])) { |
|
2529 | - EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2528 | + if ( ! isset($this->_req_data['status'])) { |
|
2529 | + EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2530 | 2530 | $success = FALSE; |
2531 | 2531 | } |
2532 | 2532 | |
@@ -2534,16 +2534,16 @@ discard block |
||
2534 | 2534 | //do check to verify we have a valid status. |
2535 | 2535 | $status = $this->_req_data['status']; |
2536 | 2536 | |
2537 | - if ( $status != 'activate' && $status != 'deactivate' ) { |
|
2538 | - 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__ ); |
|
2537 | + if ($status != 'activate' && $status != 'deactivate') { |
|
2538 | + 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__); |
|
2539 | 2539 | $success = FALSE; |
2540 | 2540 | } |
2541 | 2541 | |
2542 | 2542 | |
2543 | - if ( $success ) { |
|
2543 | + if ($success) { |
|
2544 | 2544 | //made it here? um, what are you waiting for then? |
2545 | 2545 | $deactivate = $status == 'deactivate' ? TRUE : FALSE; |
2546 | - $success = $this->_activate_messenger( $this->_req_data['messenger'], $deactivate, $this->_req_data['message_type'] ); |
|
2546 | + $success = $this->_activate_messenger($this->_req_data['messenger'], $deactivate, $this->_req_data['message_type']); |
|
2547 | 2547 | } |
2548 | 2548 | |
2549 | 2549 | $this->_template_args['success'] = $success; |
@@ -2570,28 +2570,28 @@ discard block |
||
2570 | 2570 | $templates = TRUE; |
2571 | 2571 | $this->_set_m_mt_settings(); |
2572 | 2572 | |
2573 | - if ( !$deactivate ) { |
|
2573 | + if ( ! $deactivate) { |
|
2574 | 2574 | |
2575 | 2575 | |
2576 | 2576 | //we are activating. we can use $this->_m_mt_settings to get all the installed messengers |
2577 | - $this->_active_messengers[$messenger]['settings'] = !isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings']; |
|
2577 | + $this->_active_messengers[$messenger]['settings'] = ! isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings']; |
|
2578 | 2578 | $this->_active_messengers[$messenger]['obj'] = $this->_m_mt_settings['messenger_tabs'][$messenger]['obj']; |
2579 | 2579 | |
2580 | 2580 | //get has_active so we can sure its kept up to date. |
2581 | - $has_activated = get_option( 'ee_has_activated_messages' ); |
|
2581 | + $has_activated = get_option('ee_has_activated_messages'); |
|
2582 | 2582 | |
2583 | - if ( empty( $has_activated[$messenger] ) ) { |
|
2583 | + if (empty($has_activated[$messenger])) { |
|
2584 | 2584 | $has_activated[$messenger] = array(); |
2585 | 2585 | } |
2586 | 2586 | |
2587 | 2587 | //k we need to get what default message types are to be associated with the messenger that's been activated. |
2588 | 2588 | $default_types = $message_type ? (array) $message_type : $this->_active_messengers[$messenger]['obj']->get_default_message_types(); |
2589 | 2589 | |
2590 | - foreach ( $default_types as $type ) { |
|
2590 | + foreach ($default_types as $type) { |
|
2591 | 2591 | $settings_fields = $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$type]['obj']->get_admin_settings_fields(); |
2592 | - if ( !empty( $settings_fields ) ) { |
|
2592 | + if ( ! empty($settings_fields)) { |
|
2593 | 2593 | //we have fields for this message type so let's get the defaults for saving. |
2594 | - foreach ( $settings_fields as $field => $values ) { |
|
2594 | + foreach ($settings_fields as $field => $values) { |
|
2595 | 2595 | $settings[$field] = $values['default']; |
2596 | 2596 | } |
2597 | 2597 | //let's set the data for reloading this message type form in ajax |
@@ -2599,9 +2599,9 @@ discard block |
||
2599 | 2599 | } else { |
2600 | 2600 | $settings = array(); |
2601 | 2601 | } |
2602 | - $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$type]['settings'] = $settings; |
|
2602 | + $this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$type]['settings'] = $settings; |
|
2603 | 2603 | |
2604 | - if ( ! in_array( $type, $has_activated[$messenger] ) ) { |
|
2604 | + if ( ! in_array($type, $has_activated[$messenger])) { |
|
2605 | 2605 | $has_activated[$messenger][] = $type; |
2606 | 2606 | } |
2607 | 2607 | } |
@@ -2609,41 +2609,41 @@ discard block |
||
2609 | 2609 | //any default settings for the messenger? |
2610 | 2610 | $msgr_settings = $this->_active_messengers[$messenger]['obj']->get_admin_settings_fields(); |
2611 | 2611 | |
2612 | - if ( !empty( $msgr_settings ) ) { |
|
2613 | - foreach ( $msgr_settings as $field => $value ) { |
|
2612 | + if ( ! empty($msgr_settings)) { |
|
2613 | + foreach ($msgr_settings as $field => $value) { |
|
2614 | 2614 | $this->_active_messengers[$messenger]['settings'][$field] = $value; |
2615 | 2615 | } |
2616 | 2616 | } |
2617 | 2617 | |
2618 | 2618 | //update settings in database |
2619 | - EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers ); |
|
2620 | - update_option( 'ee_has_activated_messages', $has_activated ); |
|
2619 | + EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers); |
|
2620 | + update_option('ee_has_activated_messages', $has_activated); |
|
2621 | 2621 | |
2622 | 2622 | |
2623 | 2623 | //generate new templates (if necessary) |
2624 | - $templates = $this->_generate_new_templates( $messenger, $default_types, 0, TRUE ); |
|
2624 | + $templates = $this->_generate_new_templates($messenger, $default_types, 0, TRUE); |
|
2625 | 2625 | |
2626 | 2626 | EE_Error::overwrite_success(); |
2627 | 2627 | |
2628 | 2628 | //if generation failed then we need to remove the active messenger. |
2629 | - if ( !$templates ) { |
|
2629 | + if ( ! $templates) { |
|
2630 | 2630 | unset($this->_active_messengers[$messenger]); |
2631 | - EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers ); |
|
2631 | + EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers); |
|
2632 | 2632 | } else { |
2633 | 2633 | //all is good let's do a success message |
2634 | - if ( $message_type ) { |
|
2635 | - 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'] ) ) ); |
|
2634 | + if ($message_type) { |
|
2635 | + 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']))); |
|
2636 | 2636 | |
2637 | 2637 | //if message type was invoice then let's make sure we activate the invoice payment method. |
2638 | - if ( $message_type == 'invoice' ) { |
|
2639 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
2640 | - $pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
|
2641 | - if ( $pm instanceof EE_Payment_Method ) { |
|
2642 | - 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' ) ); |
|
2638 | + if ($message_type == 'invoice') { |
|
2639 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
2640 | + $pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice'); |
|
2641 | + if ($pm instanceof EE_Payment_Method) { |
|
2642 | + 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')); |
|
2643 | 2643 | } |
2644 | 2644 | } |
2645 | 2645 | } else { |
2646 | - EE_Error::add_success( sprintf( __('%s messenger has been successfully activated', 'event_espresso'), ucwords( $this->_active_messengers[$messenger]['obj']->label['singular'] ) ) ); |
|
2646 | + EE_Error::add_success(sprintf(__('%s messenger has been successfully activated', 'event_espresso'), ucwords($this->_active_messengers[$messenger]['obj']->label['singular']))); |
|
2647 | 2647 | } |
2648 | 2648 | } |
2649 | 2649 | |
@@ -2659,36 +2659,36 @@ discard block |
||
2659 | 2659 | $update_array = array( |
2660 | 2660 | 'MTP_messenger' => $messenger); |
2661 | 2661 | |
2662 | - if ( $message_type ) { |
|
2662 | + if ($message_type) { |
|
2663 | 2663 | $update_array['MTP_message_type'] = $message_type; |
2664 | 2664 | } |
2665 | 2665 | |
2666 | - $success = $MTP->update( array( 'MTP_is_active' => 0 ), array($update_array) ); |
|
2666 | + $success = $MTP->update(array('MTP_is_active' => 0), array($update_array)); |
|
2667 | 2667 | |
2668 | 2668 | $messenger_obj = $this->_active_messengers[$messenger]['obj']; |
2669 | 2669 | |
2670 | 2670 | //if this is a message type deactivation then we're only unsetting the message type otherwise unset the messenger |
2671 | - if ( $message_type ) { |
|
2672 | - unset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] ); |
|
2671 | + if ($message_type) { |
|
2672 | + unset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type]); |
|
2673 | 2673 | } else { |
2674 | - unset( $this->_active_messengers[$messenger] ); |
|
2674 | + unset($this->_active_messengers[$messenger]); |
|
2675 | 2675 | } |
2676 | 2676 | |
2677 | - EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers ); |
|
2677 | + EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers); |
|
2678 | 2678 | EE_Error::overwrite_success(); |
2679 | - if ( $message_type ) { |
|
2680 | - 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']) ) ); |
|
2679 | + if ($message_type) { |
|
2680 | + 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']))); |
|
2681 | 2681 | } else { |
2682 | - EE_Error::add_success( sprintf( __('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular'] ) ) ); |
|
2682 | + EE_Error::add_success(sprintf(__('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular']))); |
|
2683 | 2683 | } |
2684 | 2684 | |
2685 | 2685 | //if messenger was html or message type was invoice then let's make sure we deactivate invoice payment method. |
2686 | - if ( $messenger == 'html' || $message_type == 'invoice') { |
|
2687 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
2688 | - $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( 'invoice' ); |
|
2689 | - if ( $count_updated > 0 ) { |
|
2690 | - $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' ); |
|
2691 | - EE_Error::add_attention( $msg ); |
|
2686 | + if ($messenger == 'html' || $message_type == 'invoice') { |
|
2687 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
2688 | + $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method('invoice'); |
|
2689 | + if ($count_updated > 0) { |
|
2690 | + $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'); |
|
2691 | + EE_Error::add_attention($msg); |
|
2692 | 2692 | } |
2693 | 2693 | } |
2694 | 2694 | |
@@ -2705,8 +2705,8 @@ discard block |
||
2705 | 2705 | * @return string html data |
2706 | 2706 | */ |
2707 | 2707 | public function update_mt_form() { |
2708 | - if ( !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['message_type'] ) ) { |
|
2709 | - EE_Error::add_error( __('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2708 | + if ( ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['message_type'])) { |
|
2709 | + EE_Error::add_error(__('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__); |
|
2710 | 2710 | $this->_return_json(); |
2711 | 2711 | } |
2712 | 2712 | |
@@ -2715,7 +2715,7 @@ discard block |
||
2715 | 2715 | $message_type = $message_types[$this->_req_data['message_type']]['obj']; |
2716 | 2716 | $messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj']; |
2717 | 2717 | |
2718 | - $content = $this->_message_type_settings_content ( $message_type, $messenger, TRUE, TRUE ); |
|
2718 | + $content = $this->_message_type_settings_content($message_type, $messenger, TRUE, TRUE); |
|
2719 | 2719 | $this->_template_args['success'] = true; |
2720 | 2720 | $this->_template_args['content'] = $content; |
2721 | 2721 | $this->_return_json(); |
@@ -2729,36 +2729,36 @@ discard block |
||
2729 | 2729 | * @return json success or fail message |
2730 | 2730 | */ |
2731 | 2731 | public function save_settings() { |
2732 | - if ( !isset( $this->_req_data['type'] ) ) { |
|
2733 | - EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2732 | + if ( ! isset($this->_req_data['type'])) { |
|
2733 | + EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2734 | 2734 | $this->_template_args['error'] = TRUE; |
2735 | 2735 | $this->_return_json(); |
2736 | 2736 | } |
2737 | 2737 | |
2738 | 2738 | |
2739 | - if ( $this->_req_data['type'] == 'messenger' ) { |
|
2739 | + if ($this->_req_data['type'] == 'messenger') { |
|
2740 | 2740 | $settings = $this->_req_data['messenger_settings']; //this should be an array. |
2741 | 2741 | $messenger = $settings['messenger']; |
2742 | 2742 | //let's setup the settings data |
2743 | - foreach ( $settings as $key => $value ) { |
|
2744 | - switch ( $key ) { |
|
2743 | + foreach ($settings as $key => $value) { |
|
2744 | + switch ($key) { |
|
2745 | 2745 | case 'messenger' : |
2746 | - unset( $settings['messenger'] ); |
|
2746 | + unset($settings['messenger']); |
|
2747 | 2747 | break; |
2748 | 2748 | case 'message_types' : |
2749 | - if ( isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] ) ) { |
|
2750 | - foreach ( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] as $mt => $v ) { |
|
2751 | - if ( isset( $settings['message_types'][$mt] ) ) |
|
2752 | - $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(); |
|
2749 | + if (isset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'])) { |
|
2750 | + foreach ($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'] as $mt => $v) { |
|
2751 | + if (isset($settings['message_types'][$mt])) |
|
2752 | + $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(); |
|
2753 | 2753 | } |
2754 | 2754 | } else { |
2755 | - foreach ( $value as $mt => $v ) { |
|
2755 | + foreach ($value as $mt => $v) { |
|
2756 | 2756 | //let's see if this message type is already present and has settings. |
2757 | - $settings[$messenger . '-message_types'][$mt]['settings'] = array(); |
|
2757 | + $settings[$messenger.'-message_types'][$mt]['settings'] = array(); |
|
2758 | 2758 | } |
2759 | 2759 | } |
2760 | 2760 | //k settings are set let's get rid of the message types index |
2761 | - unset( $settings['message_types'] ); |
|
2761 | + unset($settings['message_types']); |
|
2762 | 2762 | break; |
2763 | 2763 | default : |
2764 | 2764 | $settings[$key] = $value; |
@@ -2768,36 +2768,36 @@ discard block |
||
2768 | 2768 | $this->_active_messengers[$messenger]['settings'] = $settings; |
2769 | 2769 | } |
2770 | 2770 | |
2771 | - else if ( $this->_req_data['type'] == 'message_type' ) { |
|
2771 | + else if ($this->_req_data['type'] == 'message_type') { |
|
2772 | 2772 | $settings = $this->_req_data['message_type_settings']; |
2773 | 2773 | $messenger = $settings['messenger']; |
2774 | 2774 | $message_type = $settings['message_type']; |
2775 | 2775 | |
2776 | - foreach ( $settings as $key => $value ) { |
|
2777 | - switch ( $key ) { |
|
2776 | + foreach ($settings as $key => $value) { |
|
2777 | + switch ($key) { |
|
2778 | 2778 | case 'messenger' : |
2779 | - unset( $settings['messenger'] ); |
|
2779 | + unset($settings['messenger']); |
|
2780 | 2780 | break; |
2781 | 2781 | case 'message_type' : |
2782 | - unset( $settings['message_type'] ); |
|
2782 | + unset($settings['message_type']); |
|
2783 | 2783 | break; |
2784 | 2784 | default : |
2785 | 2785 | $settings['settings'][$key] = $value; |
2786 | - unset( $settings[$key] ); |
|
2786 | + unset($settings[$key]); |
|
2787 | 2787 | break; |
2788 | 2788 | } |
2789 | 2789 | } |
2790 | 2790 | |
2791 | - $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] = $settings; |
|
2791 | + $this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type] = $settings; |
|
2792 | 2792 | } |
2793 | 2793 | |
2794 | 2794 | //okay we should have the data all setup. Now we just update! |
2795 | - $success = EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers ); |
|
2795 | + $success = EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers); |
|
2796 | 2796 | |
2797 | - if ( $success ) { |
|
2798 | - EE_Error::add_success( __('Settings updated', 'event_espresso') ); |
|
2797 | + if ($success) { |
|
2798 | + EE_Error::add_success(__('Settings updated', 'event_espresso')); |
|
2799 | 2799 | } else { |
2800 | - EE_Error::add_error( __('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2800 | + EE_Error::add_error(__('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2801 | 2801 | } |
2802 | 2802 | |
2803 | 2803 | $this->_template_args['success'] = $success; |
@@ -1,29 +1,29 @@ |
||
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 |
@@ -1,4 +1,4 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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, |
@@ -1,5 +1,6 @@ |
||
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 | * |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -1,6 +1,7 @@ discard block |
||
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 |
||
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] ); |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 |
@@ -1,6 +1,7 @@ |
||
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 |