email-validator-for-contact-form-7
Last commit date
assets
6 years ago
email-validator-for-contact-form-7.php
6 years ago
license.txt
6 years ago
readme.txt
6 years ago
uninstall.php
6 years ago
email-validator-for-contact-form-7.php
498 lines
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | |
| 5 | Plugin Name: Email Validator for Contact Form 7 |
| 6 | |
| 7 | Plugin URI: https://developer.wordpress.org/plugins/email-validator-for-contact-form-7 |
| 8 | |
| 9 | Description: Enables Contact Form 7 users to validate their client’s email address before accepting their messages for sending using MailboxValidator. |
| 10 | |
| 11 | Version: 1.1.2 |
| 12 | |
| 13 | Author: MailboxValidator |
| 14 | |
| 15 | Author URI: https://mailboxvalidator.com |
| 16 | |
| 17 | License: GNU General Public License (GPL) version 3 |
| 18 | |
| 19 | License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 20 | |
| 21 | */ |
| 22 | |
| 23 | |
| 24 | |
| 25 | // Check if Contact Form 7 is been installed or not |
| 26 | |
| 27 | add_action('admin_init', 'mbv_wpcf7_check_wpcf7_installed'); |
| 28 | |
| 29 | |
| 30 | |
| 31 | function mbv_wpcf7_check_wpcf7_installed () { |
| 32 | |
| 33 | if ( is_admin() && current_user_can( "activate_plugins" ) && ! is_plugin_active( "contact-form-7/wp-contact-form-7.php" ) ) { |
| 34 | |
| 35 | add_action( 'admin_notices', 'mbv_wpcf7_nocf7_notice' ); |
| 36 | |
| 37 | deactivate_plugins( plugin_basename( __FILE__ ) ); |
| 38 | |
| 39 | $flag = (int) $_GET['activate']; |
| 40 | |
| 41 | if ( isset( $flag ) ) { |
| 42 | |
| 43 | unset( $_GET['activate'] ); |
| 44 | |
| 45 | } |
| 46 | |
| 47 | } |
| 48 | |
| 49 | } |
| 50 | |
| 51 | |
| 52 | |
| 53 | function mbv_wpcf7_nocf7_notice () { |
| 54 | |
| 55 | $plugin_url = esc_url( admin_url( 'plugin-install.php?tab=search&s=contact+form+7' ) ); |
| 56 | |
| 57 | echo 'Contact Form 7 must be installed before using this plugin. Please installed from <a href="' . $plugin_url . '">here</a>'; |
| 58 | |
| 59 | } |
| 60 | |
| 61 | |
| 62 | |
| 63 | // Show notice if the MBV API key not been saved yet |
| 64 | |
| 65 | function mbv_wpcf7_general_admin_notice(){ |
| 66 | |
| 67 | global $pagenow; |
| 68 | |
| 69 | $options = get_option( 'mbv_wpcf7_email_validator_for_contact_form_7' ); |
| 70 | |
| 71 | if ( $options['api_key'] == '' || $options['api_key'] == ' ' ) { |
| 72 | |
| 73 | echo '<div class="notice notice-warning is-dismissible"> |
| 74 | |
| 75 | <p>Please get your MailboxValidator API key from <a href="https://www.mailboxvalidator.com/plans#api">here</a> and save in <a href="options-general.php?page=email-validator-for-contact-form-7">setting page</a>.</p> |
| 76 | |
| 77 | </div>'; |
| 78 | |
| 79 | } |
| 80 | |
| 81 | // else if ( $pagenow == 'plugins.php' && ( $options['api_key'] == '' || $options['api_key'] == ' ' ) ) { |
| 82 | |
| 83 | // echo '<div class="notice notice-warning is-dismissible"> |
| 84 | |
| 85 | // <p>Please get your MailboxValidator API key from <a href="https://www.mailboxvalidator.com/plans#api">here</a> and save in <a href="options-general.php?page=email-validator-for-contact-form-7">setting page</a>.</p> |
| 86 | |
| 87 | // </div>'; |
| 88 | |
| 89 | // } |
| 90 | |
| 91 | } |
| 92 | |
| 93 | add_action( 'admin_notices', 'mbv_wpcf7_general_admin_notice' ); |
| 94 | |
| 95 | |
| 96 | |
| 97 | // add the admin options page |
| 98 | |
| 99 | add_action( 'admin_menu', 'mbv_wpcf7_plugin_admin_add_page' ); |
| 100 | |
| 101 | |
| 102 | |
| 103 | function mbv_wpcf7_plugin_admin_add_page() { |
| 104 | |
| 105 | add_options_page( 'Email Validator for Contact Form 7', 'Email Validator for Contact Form 7', 'manage_options', 'email-validator-for-contact-form-7', 'mbv_wpcf7_plugin_options_page' ); |
| 106 | |
| 107 | } |
| 108 | |
| 109 | |
| 110 | |
| 111 | // display the admin options page |
| 112 | |
| 113 | function mbv_wpcf7_plugin_options_page() { |
| 114 | |
| 115 | ?> |
| 116 | |
| 117 | <div> |
| 118 | |
| 119 | <h2>Email Validator for Contact Form 7 by MailboxValidator</h2> |
| 120 | |
| 121 | <p>This plugin enables Contact Form 7 users to validate their client’s email address before accepting their messages for sending. It uses MailboxValidator service for email validation. Please get your free MailboxValidator API key from <a href="https://www.mailboxvalidator.com/plans#api">here</a>. Once you save the settings by clicking "Save Changes", your settings will be saved and Contact Form 7 will automatically detect the changes.</p> |
| 122 | |
| 123 | <!--<p>At here you can edit your MailboxValidator API key and switch on or off disposable or free email validator.</p>--> |
| 124 | |
| 125 | <form action="options.php" method="post"> |
| 126 | |
| 127 | <?php settings_fields( 'mbv_wpcf7_email_validator_for_contact_form_7' ); ?> |
| 128 | |
| 129 | <?php do_settings_sections( 'mbv_wpcf7_plugin' ); ?> |
| 130 | |
| 131 | <input name="Submit" type="submit" value="<?php esc_attr_e( 'Save Changes' ); ?>" /> |
| 132 | |
| 133 | </form> |
| 134 | |
| 135 | </div> |
| 136 | |
| 137 | |
| 138 | |
| 139 | <?php |
| 140 | |
| 141 | } |
| 142 | |
| 143 | |
| 144 | |
| 145 | // add the admin settings and such |
| 146 | |
| 147 | add_action( 'admin_init', 'mbv_wpcf7_plugin_admin_init' ); |
| 148 | |
| 149 | |
| 150 | |
| 151 | function mbv_wpcf7_plugin_admin_init(){ |
| 152 | |
| 153 | register_setting( 'mbv_wpcf7_email_validator_for_contact_form_7', 'mbv_wpcf7_email_validator_for_contact_form_7' ); |
| 154 | |
| 155 | add_settings_section( 'mbv_wpcf7_plugin_main', 'Main Settings', 'mbv_wpcf7_plugin_section_text', 'mbv_wpcf7_plugin' ); |
| 156 | |
| 157 | add_settings_field( 'mbv_wpcf7_api_key', 'MailboxValidator API Key', 'mbv_wpcf7_api_key_setting', 'mbv_wpcf7_plugin', 'mbv_wpcf7_plugin_main' ); |
| 158 | |
| 159 | add_settings_field( 'mbv_wpcf7_disposable_option', 'Disposable Email Validation', 'mbv_wpcf7_disposable_setting_option', 'mbv_wpcf7_plugin', 'mbv_wpcf7_plugin_main' ); |
| 160 | |
| 161 | add_settings_field( 'mbv_wpcf7_free_option', 'Free Email Validation', 'mbv_wpcf7_free_setting_option', 'mbv_wpcf7_plugin', 'mbv_wpcf7_plugin_main' ); |
| 162 | |
| 163 | add_settings_field( 'mbv_wpcf7_disposable_error_message', 'Error Message for disposable email', 'mbv_wpcf7_disposable_error_message_setting', 'mbv_wpcf7_plugin', 'mbv_wpcf7_plugin_main' ); |
| 164 | |
| 165 | add_settings_field( 'mbv_wpcf7_free_error_message', 'Error Message for free email', 'mbv_wpcf7_free_error_message_setting', 'mbv_wpcf7_plugin', 'mbv_wpcf7_plugin_main' ); |
| 166 | |
| 167 | } |
| 168 | |
| 169 | |
| 170 | |
| 171 | function mbv_wpcf7_plugin_section_text() { |
| 172 | |
| 173 | echo '<p>At here you can edit your MailboxValidator API key, switch on or off disposable or free email validator and design custom error message for disposable and free email.</p>'; |
| 174 | |
| 175 | } |
| 176 | |
| 177 | |
| 178 | |
| 179 | function mbv_wpcf7_api_key_setting() { |
| 180 | |
| 181 | $options = get_option( 'mbv_wpcf7_email_validator_for_contact_form_7' ); |
| 182 | |
| 183 | $api_key = $options['api_key'] ?? ' '; |
| 184 | |
| 185 | echo '<input id="api_key" name="mbv_wpcf7_email_validator_for_contact_form_7[api_key]" size="40" type="text" value="' . esc_attr( $api_key ). '" />'; |
| 186 | |
| 187 | } |
| 188 | |
| 189 | |
| 190 | |
| 191 | function mbv_wpcf7_disposable_setting_option() { |
| 192 | |
| 193 | $options = get_option( 'mbv_wpcf7_email_validator_for_contact_form_7' ); |
| 194 | |
| 195 | $disposable_on_off = $options['disposable_on_off'] ?? 'on'; |
| 196 | |
| 197 | echo '<label><input type="radio" name="mbv_wpcf7_email_validator_for_contact_form_7[disposable_on_off]" id="disposable_option" value="on"' . ( ( $disposable_on_off == 'on' ) ? ' checked' : '' ) . ' /> On</label><br /> |
| 198 | |
| 199 | <label><input type="radio" name="mbv_wpcf7_email_validator_for_contact_form_7[disposable_on_off]" id="disposable_option" value="off"' . ( ( $disposable_on_off == 'off' ) ? ' checked' : '' ) . ' /> Off</label><br />'; |
| 200 | |
| 201 | } |
| 202 | |
| 203 | |
| 204 | |
| 205 | function mbv_wpcf7_free_setting_option() { |
| 206 | |
| 207 | $options = get_option( 'mbv_wpcf7_email_validator_for_contact_form_7' ); |
| 208 | |
| 209 | $free_on_off = $options['free_on_off'] ?? 'on'; |
| 210 | |
| 211 | echo '<label><input type="radio" name="mbv_wpcf7_email_validator_for_contact_form_7[free_on_off]" id="free_option" value="on"' . ( ( $free_on_off == 'on' ) ? ' checked' : '' ) . ' /> On</label><br /> |
| 212 | |
| 213 | <label><input type="radio" name="mbv_wpcf7_email_validator_for_contact_form_7[free_on_off]" id="free_option" value="off"' . ( ( $free_on_off == 'off' ) ? ' checked' : '' ) . ' /> Off</label><br />'; |
| 214 | |
| 215 | } |
| 216 | |
| 217 | |
| 218 | |
| 219 | function mbv_wpcf7_disposable_error_message_setting() { |
| 220 | |
| 221 | $options = get_option( 'mbv_wpcf7_email_validator_for_contact_form_7' ); |
| 222 | |
| 223 | $disposable_error_message = $options['disposable_error_message'] ?? 'Invalid email address. Please enter a non-disposable email address.'; |
| 224 | |
| 225 | echo '<input id="disposable_error_message" name="mbv_wpcf7_email_validator_for_contact_form_7[disposable_error_message]" style="width:100%" type="text" value="' . $disposable_error_message . '" />'; |
| 226 | |
| 227 | } |
| 228 | |
| 229 | |
| 230 | |
| 231 | function mbv_wpcf7_free_error_message_setting() { |
| 232 | |
| 233 | $options = get_option( 'mbv_wpcf7_email_validator_for_contact_form_7' ); |
| 234 | |
| 235 | $free_error_message = $options['free_error_message'] ?? 'Invalid email address. Please enter a non-free email address.'; |
| 236 | |
| 237 | echo '<input id="free_error_message" name="mbv_wpcf7_email_validator_for_contact_form_7[free_error_message]" style="width:100%" type="text" value="' . $free_error_message . '" />'; |
| 238 | |
| 239 | } |
| 240 | |
| 241 | |
| 242 | |
| 243 | // function mbv_wpcf7_string_length( $string ){ |
| 244 | |
| 245 | // return mb_strlen( $string ); |
| 246 | |
| 247 | // } |
| 248 | |
| 249 | add_action( 'admin_enqueue_scripts', 'plugin_enqueues' ); |
| 250 | |
| 251 | add_action( 'wp_ajax_email_validator_for_contact_form_7_submit_feedback', 'submit_feedback' ); |
| 252 | add_action( 'admin_footer_text', 'admin_footer_text' ); |
| 253 | |
| 254 | // Enqueue the script. |
| 255 | function plugin_enqueues( $hook ) { |
| 256 | |
| 257 | if ( $hook == 'plugins.php' ) { |
| 258 | // Add in required libraries for feedback modal |
| 259 | wp_enqueue_script( 'jquery-ui-dialog' ); |
| 260 | wp_enqueue_style( 'wp-jquery-ui-dialog' ); |
| 261 | |
| 262 | wp_enqueue_script( 'email_validator_for_contact_form_7_admin_script', plugins_url( '/assets/js/feedback.js', __FILE__ ), ['jquery'], null, true ); |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | function admin_footer_text( $footer_text ) { |
| 267 | // $plugin_name = substr( basename( __FILE__ ), 0, strpos( basename( __FILE__ ), '.' ) ); |
| 268 | $plugin_name = 'email-validator-for-contact-form-7'; |
| 269 | $current_screen = get_current_screen(); |
| 270 | |
| 271 | if ( ( $current_screen && strpos( $current_screen->id, $plugin_name ) !== false ) ) { |
| 272 | $footer_text .= sprintf( |
| 273 | __( 'Enjoyed %1$s? Please leave us a %2$s rating. A huge thanks in advance!', $plugin_name ), |
| 274 | '<strong>' . __( 'MailboxValidator Email Validator', $plugin_name ) . '</strong>', |
| 275 | '<a href="https://wordpress.org/support/plugin/' . $plugin_name . '/reviews/?filter=5/#new-post" target="_blank">★★★★★</a>' |
| 276 | ); |
| 277 | } |
| 278 | |
| 279 | if ( $current_screen->id == 'plugins' ) { |
| 280 | return $footer_text . ' |
| 281 | <div id="email-validator-for-contact-form-7-feedback-modal" class="hidden" style="max-width:800px"> |
| 282 | <span id="email-validator-for-contact-form-7-feedback-response"></span> |
| 283 | <p> |
| 284 | <strong>Would you mind sharing with us the reason to deactivate the plugin?</strong> |
| 285 | </p> |
| 286 | <p> |
| 287 | <label> |
| 288 | <input type="radio" name="email-validator-for-contact-form-7-feedback" value="1"> I no longer need the plugin |
| 289 | </label> |
| 290 | </p> |
| 291 | <p> |
| 292 | <label> |
| 293 | <input type="radio" name="email-validator-for-contact-form-7-feedback" value="2"> I couldn\'t get the plugin to work |
| 294 | </label> |
| 295 | </p> |
| 296 | <p> |
| 297 | <label> |
| 298 | <input type="radio" name="email-validator-for-contact-form-7-feedback" value="3"> The plugin doesn\'t meet my requirements |
| 299 | </label> |
| 300 | </p> |
| 301 | <p> |
| 302 | <label> |
| 303 | <input type="radio" name="email-validator-for-contact-form-7-feedback" value="4"> Other concerns |
| 304 | <br><br> |
| 305 | <textarea id="email-validator-for-contact-form-7-feedback-other" style="display:none;width:100%"></textarea> |
| 306 | </label> |
| 307 | </p> |
| 308 | <p> |
| 309 | <div style="float:left"> |
| 310 | <input type="button" id="email-validator-for-contact-form-7-submit-feedback-button" class="button button-danger" value="Submit & Deactivate" /> |
| 311 | </div> |
| 312 | <div style="float:right"> |
| 313 | <a href="#">Skip & Deactivate</a> |
| 314 | </div> |
| 315 | </p> |
| 316 | </div>'; |
| 317 | } |
| 318 | |
| 319 | return $footer_text; |
| 320 | } |
| 321 | |
| 322 | function submit_feedback() { |
| 323 | $feedback = ( isset( $_POST['feedback'] ) ) ? $_POST['feedback'] : ''; |
| 324 | $others = sanitize_text_field (( isset( $_POST['others'] ) ) ? $_POST['others'] : '' ); |
| 325 | |
| 326 | $options = [ |
| 327 | 1 => 'I no longer need the plugin', |
| 328 | 2 => 'I couldn\'t get the plugin to work', |
| 329 | 3 => 'The plugin doesn\'t meet my requirements', |
| 330 | 4 => 'Other concerns' . ( ( $others ) ? ( ' - ' . $others ) : '' ), |
| 331 | ]; |
| 332 | |
| 333 | $url = 'https://www.mailboxvalidator.com/wp-plugin-feedback?' . http_build_query( ['name' => 'email-validator-for-contact-form-7', 'message' => $options[$feedback],] ); |
| 334 | // file_put_contents ( __DIR__ . '/mbv_plugin_logs.log' , $url . PHP_EOL, FILE_APPEND ); |
| 335 | |
| 336 | if ( isset( $options[$feedback] ) ) { |
| 337 | if ( !class_exists( 'WP_Http' ) ) { |
| 338 | include_once ABSPATH . WPINC . '/class-http.php'; |
| 339 | } |
| 340 | |
| 341 | $request = new WP_Http(); |
| 342 | $response = $request->request( 'https://www.mailboxvalidator.com/wp-plugin-feedback?' . http_build_query( [ |
| 343 | 'name' => 'email-validator-for-contact-form-7', |
| 344 | 'message' => $options[$feedback], |
| 345 | ] ), ['timeout' => 5] ); |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | |
| 350 | function mbv_wpcf7_validate_email_check_free( $emailAddress, $api_key ) { |
| 351 | |
| 352 | // Now we need to send the data to MBV API Key and return back the result. |
| 353 | |
| 354 | $url = 'https://api.mailboxvalidator.com/v1/email/free?key=' . str_replace( ' ', '', $api_key ) . '&email=' . str_replace( ' ', '', $emailAddress ); |
| 355 | |
| 356 | $results = file_get_contents( $url ); |
| 357 | |
| 358 | |
| 359 | |
| 360 | // Decode the return json results and return the data. |
| 361 | |
| 362 | $data = json_decode( $results, true ); |
| 363 | |
| 364 | mbv_wpcf7_mailboxvalidator_api_log( 'free', $data['email_address'], $data['is_free'], $data['credits_available'], $data['error_code'], $data['error_message'] ); |
| 365 | |
| 366 | if ( !( $data['error_message'] == '' ) ) { |
| 367 | |
| 368 | if ( $data['is_free'] == 'False' ) { |
| 369 | |
| 370 | return false; |
| 371 | |
| 372 | } else { |
| 373 | |
| 374 | return true; |
| 375 | |
| 376 | } |
| 377 | |
| 378 | } |
| 379 | |
| 380 | } |
| 381 | |
| 382 | |
| 383 | |
| 384 | function mbv_wpcf7_validate_email_check_disposable( $emailAddress, $api_key ) { |
| 385 | |
| 386 | // Now we need to send the data to MBV API Key and return back the result. |
| 387 | |
| 388 | $url = 'https://api.mailboxvalidator.com/v1/email/disposable?key=' . str_replace( ' ', '', $api_key ) . '&email=' . str_replace( ' ', '', $emailAddress ); |
| 389 | |
| 390 | $results = file_get_contents( $url ); |
| 391 | |
| 392 | |
| 393 | |
| 394 | // Decode the return json results and return the data. |
| 395 | |
| 396 | $data = json_decode( $results, true ); |
| 397 | |
| 398 | mbv_wpcf7_mailboxvalidator_api_log( 'disposable', $data['email_address'], $data['is_disposable'], $data['credits_available'], $data['error_code'], $data['error_message'] ); |
| 399 | |
| 400 | if ( !( $data['error_message'] == '' ) ) { |
| 401 | |
| 402 | if ( $data['is_disposable'] == 'False' ) { |
| 403 | |
| 404 | return false; |
| 405 | |
| 406 | } else { |
| 407 | |
| 408 | return true; |
| 409 | |
| 410 | } |
| 411 | |
| 412 | } |
| 413 | |
| 414 | } |
| 415 | |
| 416 | |
| 417 | |
| 418 | function mbv_wpcf7_custom_email_validator_filter( $result, $tags ) { |
| 419 | |
| 420 | // Get option settings to know which validator is been called |
| 421 | |
| 422 | $options = get_option( 'mbv_wpcf7_email_validator_for_contact_form_7' ); |
| 423 | |
| 424 | $tags = new WPCF7_FormTag( $tags ); |
| 425 | |
| 426 | |
| 427 | |
| 428 | $type = $tags->type; |
| 429 | |
| 430 | $name = $tags->name; |
| 431 | |
| 432 | |
| 433 | |
| 434 | if ( ( 'email' == $type || 'email*' == $type ) && !( $options['api_key'] == '' ) ) { |
| 435 | |
| 436 | // do validation for disposable and free |
| 437 | |
| 438 | if( $options['disposable_on_off'] == 'on' ){ |
| 439 | |
| 440 | if( ( mbv_wpcf7_validate_email_check_disposable( sanitize_email ( $_POST[$name] ), $options['api_key'] ) ) == true){ |
| 441 | |
| 442 | $result->invalidate( $tags, __( $options['disposable_error_message'] ?? 'Invalid email address. Please enter a non-disposable email address.', 'email-validator-for-contact-form-7' ) ); |
| 443 | |
| 444 | }elseif ( $options['free_on_off'] == 'on' ){ |
| 445 | |
| 446 | if( ( mbv_wpcf7_validate_email_check_free( sanitize_email ( $_POST[$name] ), $options['api_key'] ) ) == true ){ |
| 447 | |
| 448 | $result->invalidate( $tags, __( $options['free_error_message'] ?? 'Invalid email address. Please enter a non-free email address.', 'email-validator-for-contact-form-7' ) ); |
| 449 | |
| 450 | } |
| 451 | |
| 452 | } |
| 453 | |
| 454 | } elseif ( $options['free_on_off'] == 'on' ){ |
| 455 | |
| 456 | if( ( mbv_wpcf7_validate_email_check_free( sanitize_email ( $_POST[$name] ), $options['api_key'] ) ) == true ){ |
| 457 | |
| 458 | $result->invalidate( $tags, __( $options['free_error_message'] ?? 'Invalid email address. Please enter a non-free email address.', 'email-validator-for-contact-form-7' ) ); |
| 459 | |
| 460 | } |
| 461 | |
| 462 | } |
| 463 | |
| 464 | } |
| 465 | |
| 466 | return $result; |
| 467 | |
| 468 | } |
| 469 | |
| 470 | |
| 471 | |
| 472 | add_filter( 'wpcf7_validate_email', 'mbv_wpcf7_custom_email_validator_filter', 20, 2 ); // Email field |
| 473 | |
| 474 | add_filter( 'wpcf7_validate_email*', 'mbv_wpcf7_custom_email_validator_filter', 20, 2 ); // Req. Email field |
| 475 | |
| 476 | |
| 477 | |
| 478 | function mbv_wpcf7_mailboxvalidator_api_log ( $mode, $api_result1, $api_result2, $api_result3, $api_result4, $api_result5 ) { |
| 479 | |
| 480 | // Log all the MBV api usage to the log file |
| 481 | |
| 482 | file_put_contents( __DIR__ . '/mbv_api_logs.log', 'Email Address: ' . $api_result1 . PHP_EOL, FILE_APPEND ); |
| 483 | |
| 484 | if ( $mode == 'disposable' ) { |
| 485 | file_put_contents( __DIR__ . '/mbv_api_logs.log', 'is_disposable: ' . $api_result2 . PHP_EOL, FILE_APPEND ); |
| 486 | } else { |
| 487 | file_put_contents( __DIR__ . '/mbv_api_logs.log', 'is_free: ' . $api_result2 . PHP_EOL, FILE_APPEND ); |
| 488 | } |
| 489 | |
| 490 | file_put_contents( __DIR__ . '/mbv_api_logs.log', 'Credits Available: ' . $api_result3 . PHP_EOL, FILE_APPEND ); |
| 491 | |
| 492 | file_put_contents( __DIR__ . '/mbv_api_logs.log', 'Error Code: ' . $api_result4 == '' ?: '-' . PHP_EOL, FILE_APPEND ); |
| 493 | |
| 494 | file_put_contents( __DIR__ . '/mbv_api_logs.log', 'Error Message: ' . $api_result5 == '' ?: '-' . PHP_EOL, FILE_APPEND ); |
| 495 | |
| 496 | file_put_contents( __DIR__ . '/mbv_api_logs.log', str_repeat( '-', 120 ) . PHP_EOL, FILE_APPEND ); |
| 497 | |
| 498 | } |