Changeset 2321931
- Timestamp:
- 06/11/2020 02:38:22 AM (6 years ago)
- Location:
- wprequal/trunk
- Files:
-
- 16 edited
-
app/abstracts/class.Mail.php (modified) (4 diffs)
-
app/classes/class.ContactForm.php (modified) (3 diffs)
-
app/classes/class.ContactFormAdmin.php (modified) (17 diffs)
-
app/classes/class.Email.php (modified) (1 diff)
-
app/classes/class.RegisterForm.php (modified) (2 diffs)
-
app/classes/class.Settings.php (modified) (2 diffs)
-
app/classes/class.Update.php (modified) (2 diffs)
-
app/functions/deactivate.php (modified) (5 diffs)
-
app/functions/refresh.php (modified) (1 diff)
-
assets/js/admin/80_survey-form.js (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
views/contact/admin/details.php (modified) (2 diffs)
-
views/survey/admin/confirmation.php (modified) (2 diffs)
-
views/survey/admin/contact.php (modified) (1 diff)
-
views/survey/admin/slides.php (modified) (1 diff)
-
wprequal.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wprequal/trunk/app/abstracts/class.Mail.php
r2315196 r2321931 37 37 if ( $contact_form_id = get_post_meta( $post_id, 'contact_form_id', TRUE ) ) { 38 38 39 if ( $details = get_post_meta( (int) $contact_form_id, 'details', TRUE ) ) {39 $details = ContactForm::get_details( $contact_form_id ); 40 40 41 Log::write( 'details', $details );41 Log::write( 'details', $details ); 42 42 43 return $details; 44 45 } 43 return $details; 46 44 47 45 } … … 49 47 Log::write( 'no-details', "Post ID: $post_id - Contact Form ID: $contact_form_id" ); 50 48 51 return FALSE;49 return ContactForm::get_details( 0 );; 52 50 53 51 } … … 62 60 public function email_headers( $args ) { 63 61 64 $headers = array(); 65 $headers[] = $this->from_email(); 62 $from_name = $this->from_name(); 63 $from_email = $this->from_email(); 64 65 $headers = []; 66 $headers[] = "From: $from_name <$from_email>"; 66 67 $headers[] = 'MIME-Version: 1.0'; 67 68 … … 121 122 public function from_email() { 122 123 123 $from_email = $this->details['from_email'];124 $from_email = 'leads@wprequal.com'; 124 125 125 $from_email = empty( $from_email ) ? get_option( 'admin_email' ) : $from_email;126 127 $from_email = "From: WPrequal Leads <{$from_email}>";126 if ( ! empty( $this->details['from_email'] ) ) { 127 $from_email = $this->details['from_email']; 128 } 128 129 129 130 Log::write( 'from-email', $from_email ); 130 131 131 return apply_filters( 'wprequal_from_email_header', $from_email ); 132 return apply_filters( 'wprequal_from_email', $from_email ); 133 134 } 135 136 /** 137 * Frome Name. 138 * 139 * @return mixed|void 140 */ 141 142 public function from_name() { 143 144 $from_name = 'WPrequal Leads'; 145 146 if ( ! empty( $this->details['from_name'] ) ) { 147 $from_name = $this->details['from_name']; 148 } 149 150 Log::write( 'from-name', $from_name ); 151 152 return apply_filters( 'wprequal_from_name', $from_name ); 132 153 133 154 } -
wprequal/trunk/app/classes/class.ContactForm.php
r2315196 r2321931 106 106 107 107 add_shortcode( 'wprequal_contact_form', array( $this, 'contact_form' ) ); 108 109 add_filter( 'wprequal_contact_get_details', array( $this, 'get_details' ) );110 108 111 109 } … … 203 201 * @param $post_id 204 202 * 205 * @return array|mixed 206 */ 207 208 public function get_details( $post_id ) { 209 210 if ( is_int( $post_id ) && 0 < $post_id ) { 211 $meta = get_post_meta( $post_id, 'details', TRUE ); 212 } 213 214 return ( ! empty( $meta ) ) ? $meta : array( 203 * @return array 204 */ 205 206 public static function get_details( $post_id ) { 207 208 $details = [ 215 209 'button_text' => 'Submit', 216 'from_email' => get_option( 'wprequal_from_email' ) ?: 'support@wprequal.com', 210 'from_name' => 'WPrequal Leads', 211 'from_email' => get_option( 'wprequal_from_email' ) ?: 'leads@wprequal.com', 217 212 'to_email' => get_option( 'wprequal_email' ) ?: get_option( 'admin_email' ), 218 213 'bcc_email' => get_option( 'wprequal_bcc_email' ) ?: '', 219 214 'sms_text' => get_option( 'wprequal_sms_carrier_gateway' ) ?: '' 220 ); 215 ]; 216 217 if ( is_int( $post_id ) && 0 < $post_id ) { 218 219 if ( $saved = get_post_meta( $post_id, 'details', TRUE ) ) { 220 221 foreach ( $saved as $key => $value ) { 222 223 if ( ! empty( $value ) ) { 224 $details[$key] = $value; 225 } 226 227 } 228 229 } 230 231 } 232 233 return $details; 221 234 222 235 } … … 231 244 232 245 $inputs = $this->get_inputs( $args['contact_form_id'] ); 233 $details = $this->get_details( $args['contact_form_id'] );246 $details = self::get_details( $args['contact_form_id'] ); 234 247 $view = ( $args['type'] === 'contact' ) ? 'contact-form' : 'contact-inputs'; 235 248 -
wprequal/trunk/app/classes/class.ContactFormAdmin.php
r2315196 r2321931 59 59 public function actions() { 60 60 61 add_action( 'admin_menu', array( $this, 'replace_submit_meta_box' ));62 add_action( "add_meta_boxes_{$this->post_type}", array( $this, 'add_meta_box' ));63 add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ));64 add_action( "save_post_{$this->post_type}", array( $this, 'save_inputs' ), 10, 1 );65 66 add_filter( "bulk_actions-edit-{$this->post_type}", array( $this, 'custom_bulk_actions' ), 99 );67 add_filter( 'page_row_actions', array( $this, 'modify_list_row_actions' ), 10, 2 );61 add_action( 'admin_menu', [ $this, 'replace_submit_meta_box' ] ); 62 add_action( "add_meta_boxes_{$this->post_type}", [ $this, 'add_meta_box' ] ); 63 add_action( 'admin_enqueue_scripts', [ $this, 'admin_scripts' ] ); 64 add_action( "save_post_{$this->post_type}", [ $this, 'save_inputs' ], 10, 1 ); 65 66 add_filter( "bulk_actions-edit-{$this->post_type}", [ $this, 'custom_bulk_actions' ], 99 ); 67 add_filter( 'page_row_actions', [ $this, 'modify_list_row_actions' ], 10, 2 ); 68 68 69 69 } … … 81 81 wp_enqueue_script( 'wprequal_admin_js' ); 82 82 83 wp_localize_script( 'wprequal_admin_js', 'contactAdmin', array(83 wp_localize_script( 'wprequal_admin_js', 'contactAdmin', [ 84 84 'inputs' => $this->inputs(), 85 85 'msg' => $this->alert_messages() 86 ));86 ] ); 87 87 88 88 } … … 100 100 public function inputs() { 101 101 102 $inputs = array();102 $inputs = []; 103 103 $views = $this->input_types(); 104 104 … … 119 119 public function input_types() { 120 120 121 return array(121 return [ 122 122 // Contact Fields 123 123 'name' => __( 'Name', 'wprequal' ), … … 135 135 'hidden' => __( 'Hidden', 'wprequal' ), 136 136 'section' => __( 'Section', 'wprequal' ) 137 );137 ]; 138 138 139 139 } … … 147 147 public function contact_fields() { 148 148 149 return array(149 return [ 150 150 'name', 151 151 'email', 152 152 'phone', 153 153 'comments' 154 );154 ]; 155 155 156 156 } … … 180 180 public function default_values() { 181 181 182 return array(182 return [ 183 183 'type' => '{type}', 184 184 'key' => '{key}', … … 188 188 'placeholder' => '', 189 189 'default_value' => '', 190 'labels' => array(),190 'labels' => [], 191 191 'min' => 0, 192 192 'max' => 0, 193 193 'step' => 0, 194 194 'default' => '' 195 );195 ]; 196 196 197 197 } … … 205 205 public function alert_messages() { 206 206 207 return array(207 return [ 208 208 'correctErrors' => __( 'Please correct the errors and try again!' ), 209 209 'onlyOneAllowed' => __( 'Only 1 {label} field is allowed. Please use a lead field instead.' ) 210 );210 ]; 211 211 212 212 } … … 223 223 'contact-fields', 224 224 __( 'Form Builder - Contact Fields', 'wprequal' ), 225 array( $this, 'meta_box'),225 [ $this, 'meta_box' ], 226 226 $this->post_type, 227 227 'side' … … 231 231 'lead-fields', 232 232 __( 'Form Builder - Lead Fields', 'wprequal' ), 233 array( $this, 'meta_box'),233 [ $this, 'meta_box' ], 234 234 $this->post_type, 235 235 'side' … … 239 239 'inputs', 240 240 __( 'Form Builder - Inputs', 'wprequal' ), 241 array( $this, 'meta_box'),241 [ $this, 'meta_box' ], 242 242 $this->post_type, 243 243 'advanced', … … 248 248 'details', 249 249 __( 'Form Builder - Details', 'wprequal' ), 250 array( $this, 'meta_box'),250 [ $this, 'meta_box' ], 251 251 $this->post_type, 252 252 'advanced', … … 257 257 'shortcode', 258 258 __( 'Form Builder - Shortcode', 'wprequal' ), 259 array( $this, 'meta_box'),259 [ $this, 'meta_box' ], 260 260 $this->post_type, 261 261 'side' … … 274 274 275 275 $view_path = $this->view_path; 276 $allow = array( 'shortcode', 'contact-fields', 'details', 'inputs' );276 $allow = [ 'shortcode', 'contact-fields', 'details', 'inputs' ]; 277 277 278 278 if ( ! Core::status( 1 ) && ! in_array( $view['id'], $allow ) ) { … … 318 318 else { 319 319 320 update_post_meta( $post_id, 'inputs', array());320 update_post_meta( $post_id, 'inputs', [] ); 321 321 322 322 } … … 333 333 else { 334 334 335 update_post_meta( $post_id, 'details', array());335 update_post_meta( $post_id, 'details', [] ); 336 336 337 337 } -
wprequal/trunk/app/classes/class.Email.php
r2315196 r2321931 84 84 public function send_email() { 85 85 86 add_action( 'wp_mail_failed', array( $this, 'log_mailer_error' ), 10, 1 );87 add_filter( 'wp_mail', array( $this, 'email_headers' ));86 add_action( 'wp_mail_failed', [ $this, 'log_mailer_error' ], 10, 1 ); 87 add_filter( 'wp_mail', [ $this, 'email_headers' ] ); 88 88 89 89 $contact = get_post_meta( $this->post_id, 'contact', TRUE ); -
wprequal/trunk/app/classes/class.RegisterForm.php
r2315196 r2321931 162 162 163 163 /** 164 * Get the form details.165 *166 * @param $post_id167 *168 * @return array|mixed169 */170 171 public function get_details( $post_id ) {172 173 return apply_filters( 'wprequal_contact_get_details', (int) $post_id );174 175 }176 177 /**178 164 * Get the contact form view. 179 165 * … … 185 171 186 172 $input = $this->get_input( $contact_form_id ); 187 $details = $this->get_details( $contact_form_id );173 $details = ContactForm::get_details( $contact_form_id ); 188 174 189 175 if ( $view = apply_filters( 'wprequal_view', 'contact/form/register-form' ) ) { -
wprequal/trunk/app/classes/class.Settings.php
r2315196 r2321931 152 152 } 153 153 154 return array();154 return []; 155 155 } 156 156 … … 389 389 390 390 default: 391 return array();391 return []; 392 392 } 393 393 -
wprequal/trunk/app/classes/class.Update.php
r2315196 r2321931 422 422 update_post_meta( $contact_form_id, 'inputs', $inputs ); 423 423 424 $details = $fofm->get_details( 0 );424 $details = ContactForm::get_details( 0 ); 425 425 update_post_meta( $contact_form_id, 'details', $details ); 426 426 … … 483 483 update_post_meta( $post_id, 'input', $input ); 484 484 485 $details = $fofm->get_details( 0 );485 $details = ContactForm::get_details( 0 ); 486 486 update_post_meta( $post_id, 'details', $details ); 487 487 -
wprequal/trunk/app/functions/deactivate.php
r2219953 r2321931 27 27 function clear_options() { 28 28 29 $options = array_merge( deactivate_options(), depr icated_options() );29 $options = array_merge( deactivate_options(), deprecated_options() ); 30 30 31 31 foreach ( $options as $option ) { … … 43 43 function deactivate_options() { 44 44 45 return array( 46 WPREQUAL_OPTIONS 47 ); 45 return [ WPREQUAL_OPTIONS ]; 48 46 49 47 } … … 55 53 */ 56 54 57 function depr icated_options() {55 function deprecated_options() { 58 56 59 return array(57 return [ 60 58 'wprequal_dark', 61 59 'wprequal_admin_settings', … … 92 90 // Deprecated v7.5 93 91 'wprequal_settings' 94 );92 ]; 95 93 96 94 } … … 102 100 function clear_transients() { 103 101 104 $transients = array( 105 WPREQUAL_OPTIONS 106 ); 102 $transients = [ WPREQUAL_OPTIONS ]; 107 103 108 104 foreach ( $transients as $transient ) { -
wprequal/trunk/app/functions/refresh.php
r2152886 r2321931 16 16 function refresh() { 17 17 if ( isset( $_GET['wprequal_refresh'] ) ) { 18 deactivate();18 clear_transients(); 19 19 } 20 20 } -
wprequal/trunk/assets/js/admin/80_survey-form.js
r2286071 r2321931 243 243 function populateEditor($this) { 244 244 if (typeof $this.editor !== 'undefined') { 245 $('.editor-' + $this.key).val($this.editor); 245 var value = (! $this.editor || '' === $this.editor) ? '' : $this.editor; 246 $('.editor-' + $this.key).val(value); 246 247 } 247 248 } -
wprequal/trunk/readme.txt
r2321317 r2321931 159 159 == Change Log == 160 160 161 = 7.7.2 = 162 * Improvement - Add from name to email options 163 * Improvement - Additional survey form builder notes 164 * Tweek - Require contact form selection on survey forms 165 * Tweek - Clear transients with refresh 166 161 167 = 7.7.1 = 162 168 * Tweek - Add version to endpoints -
wprequal/trunk/views/contact/admin/details.php
r2315196 r2321931 12 12 namespace WPrequal\App; 13 13 14 $details = $this->get_details( get_the_ID() );14 $details = ContactForm::get_details( get_the_ID() ); 15 15 16 16 extract( $details ); ?> … … 26 26 27 27 <td><input type="text" id="button_text" name="details[button_text]" value="<?php esc_attr_e( $button_text ); ?>" class="regular-text"></td> 28 </tr> 29 30 <tr> 31 <th> 32 <label for="from_name"><?php _e( 'From Name', 'wprequal' ); ?></label> 33 </th> 34 35 <td><input type="text" id="from_name" name="details[from_name]" value="<?php esc_attr_e( $from_name ); ?>" class="regular-text"></td> 36 37 <td><?php _e( 'What name should your leads be sent from?', 'wprequal' ); ?></td> 28 38 </tr> 29 39 -
wprequal/trunk/views/survey/admin/confirmation.php
r2315196 r2321931 10 10 */ 11 11 12 namespace WPrequal\App; 13 14 // FIXME: Fix wp editor or remove these settings 15 $settings = array( 16 'wpautop' => FALSE, 17 'textarea_name' => 'slide[{key}][editor]', 18 'textarea_rows' => 5, 19 'editor_class' => 'editor-{key}' 20 ); ?> 12 namespace WPrequal\App; ?> 21 13 22 14 <?php $this->view( 'survey', 'admin/slide-start' ); ?> … … 32 24 <td colspan="3"> 33 25 <textarea name="slide[{key}][editor]" class="editor-{key} large-text" rows="5"></textarea> 34 <?php //wp_editor( '', 'confirmation-msg', $settings ); ?>35 26 </td> 36 27 -
wprequal/trunk/views/survey/admin/contact.php
r2315196 r2321931 12 12 namespace WPrequal\App; 13 13 14 $args = array( 15 'post_type' => 'wpq_contact_form', 16 'name' => 'slide[{key}][contact_form_id]', 17 'class' => 'contact_form_id regular-text', 18 'id' => 'contact_form_id' 19 ); ?> 14 $args = [ 15 'post_type' => 'wpq_contact_form', 16 'name' => 'slide[{key}][contact_form_id]', 17 'class' => 'contact_form_id regular-text wpq-required', 18 'id' => 'contact_form_id', 19 'show_option_none' => __( 'Select One', 'wprequal' ) 20 ]; ?> 20 21 21 22 <?php $this->view( 'survey', 'admin/slide-start' ); ?> -
wprequal/trunk/views/survey/admin/slides.php
r2315196 r2321931 20 20 <ul class="survey-slides"></ul> 21 21 22 <div><?php _e( 'Note: All forms must end with a contact form, processing slide, and a confirmation message or redirect.', 'wprequal' ); ?></div> 22 <div><b><?php _e( 'Note:', 'wprequal' ); ?></b></div> 23 <div><?php _e( 'All survey forms must end with a contact form with Lead Fields, processing slide, and confirmation message or redirect.', 'wprequal' ); ?></div> 24 <div><?php _e( 'Only 1 contact form with contact fields can be submitted per request. Use contact forms with Text Input lead fields instead.', 'wprequal' ); ?></div> 23 25 24 26 <div class="wpq-loading"> -
wprequal/trunk/wprequal.php
r2321317 r2321931 4 4 Plugin URI: https://wprequal.com 5 5 Description: Mortgage and Real Estate Lead Capture System 6 Version: 7.7. 16 Version: 7.7.2 7 7 Author: WPrequal 8 8 Author URI: https://wprequal.com … … 40 40 41 41 $constants = array( 42 'WPREQUAL_VERSION' => '7.7. 1',42 'WPREQUAL_VERSION' => '7.7.2', 43 43 'WPREQOAL_PLUGIN' => plugin_basename( __FILE__ ), 44 44 'WPREQUAL_OPTIONS' => 'wprequal_options',
Note: See TracChangeset
for help on using the changeset viewer.