Plugin Directory

Changeset 2882562


Ignore:
Timestamp:
03/18/2023 01:05:13 PM (3 years ago)
Author:
wpminds
Message:

init v1.6.2

Location:
simple-wp-events/trunk
Files:
26 edited

Legend:

Unmodified
Added
Removed
  • simple-wp-events/trunk/README.md

    r2807927 r2882562  
    44Donate link: https://wpminds.com/
    55Requires at least: 5.0
    6 Stable tag: 1.5.4
     6Stable tag: 1.6.2
    77Tested up to: 6.0
    88Requires PHP: 7.0
     
    73734. Display Settings
    74745. Forms Settings
     756. Mail Settings
    75767. Event Archive Page
    76778. Event Single Page
     
    7879
    7980== Changelog ==
     81Version-1.6.2
     82Update: Made phone number field on add event page as optional.
     83Added: Input mask for phone number field on add event page.
     84
     85Version-1.6.1
     86Fixed: Subscribe form layout for archive shortcode.
     87Added: Attribute to change single-button text in shortcode widget.
     88
     89Version-1.6.0
     90Added: Form validation errors.
     91Added: Option to send the texting permission info to email.
     92Added: Dark mode in display settings.
     93Added: User notification checkbox for edit entry.
     94Added: Filters to format date on archive page.
     95Fixed: CSS for texting permission checkbox.
     96Update: enqueue select2 file locally.
     97Added: Option to make the form fields required or optional.
     98Added: Option to bulk update existing email confirmation.
     99Update: Add registerant address to the export registrations csv.
     100Added: jQuery input mask for the phone number formatting.
     101
    80102Version-1.5.3
    81103Update: Past events are changed to draft so that they are not indexed.
  • simple-wp-events/trunk/README.txt

    r2807927 r2882562  
    44Donate link: https://wpminds.com/
    55Requires at least: 5.0
    6 Stable tag: 1.5.4
     6Stable tag: 1.6.2
    77Tested up to: 6.0
    88Requires PHP: 7.0
     
    73734. Display Settings
    74745. Forms Settings
     756. Mail Settings
    75767. Event Archive Page
    76778. Event Single Page
     
    7879
    7980== Changelog ==
     81Version-1.6.2
     82Update: Made phone number field on add event page as optional.
     83Added: Input mask for phone number field on add event page.
     84
     85Version-1.6.1
     86Fixed: Subscribe form layout for archive shortcode.
     87Added: Attribute to change single-button text in shortcode widget.
     88
     89Version-1.6.0
     90Added: Form validation errors.
     91Added: Option to send the texting permission info to email.
     92Added: Dark mode in display settings.
     93Added: User notification checkbox for edit entry.
     94Added: Filters to format date on archive page.
     95Fixed: CSS for texting permission checkbox.
     96Update: enqueue select2 file locally.
     97Added: Option to make the form fields required or optional.
     98Added: Option to bulk update existing email confirmation.
     99Update: Add registerant address to the export registrations csv.
     100Added: jQuery input mask for the phone number formatting.
     101
    80102Version-1.5.3
    81103Update: Past events are changed to draft so that they are not indexed.
  • simple-wp-events/trunk/admin/class-wp-events-admin.php

    r2780675 r2882562  
    8686        wp_enqueue_style( $this->plugin_name.'-admin', plugin_dir_url( __FILE__ ) . 'css/wp-events-admin.css', array(), $this->version, 'all' );
    8787        wp_enqueue_style( $this->plugin_name, plugin_dir_url( __DIR__ ) . 'assets/css/wp-events.css', array(), $this->version, 'all' );
    88 
    89         wp_enqueue_style( $this->plugin_name.'-jquery-ui', plugin_dir_url( __FILE__ ) .'css/jquery-ui.min.css', array(), $this->version, 'all' );
     88        //check if current post type is wp_event then add this css file
     89        if( 'wp_events' == wpe_get_current_post_type() ) {
     90            wp_enqueue_style( $this->plugin_name.'-jquery-ui', plugin_dir_url( __FILE__ ) .'css/jquery-ui.min.css', array(), $this->version, 'all' );
     91        }
    9092        wp_enqueue_style( $this->plugin_name.'-select2', plugin_dir_url( __FILE__ ) .'css/select2.min.css', array(), $this->version, 'all' );
    9193    }
     
    115117            wp_enqueue_media();
    116118        }
     119        wp_enqueue_script( 'jquery-inputmask', plugin_dir_url( __DIR__ ) . 'assets/js/jquery.inputmask.min.js', array( 'jquery' ), $this->version, false );
     120
    117121        wp_enqueue_script( 'date-validation', plugin_dir_url( __FILE__ ) . 'js/wp-events-date-validation.js', array( 'jquery' ), $this->version, false );
    118122        wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wp-events-admin.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker', 'date-validation' ), $this->version, false );
     
    419423            <div class="phone event-control wpe-left" id="event-control">
    420424                <label for="wpevent-phone"><?php _e( 'Phone*', 'simple-wp-events' ); ?></label>
    421                 <input id="wpevent-phone" title="(123) 111-1234" class="wp-event-field" type="tel" pattern="^(\([0-9]{3}\) |[0-9]{3}-)[0-9]{3}-[0-9]{4}$" name="wpevent-phone" value="<?php echo get_post_meta( $post->ID, 'wpevent-phone', true );?>"/>
    422                 <p><?php _e( 'format: (123) 123-1234', 'simple-wp-events' ); ?></p>
     425                <input id="wpevent-phone" title="(123) 111-1234" class="wp-event-field" type="tel" name="wpevent-phone" value="<?php echo get_post_meta( $post->ID, 'wpevent-phone', true );?>"/>
    423426                <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
    424427            </div>
     
    426429                <label for="wpevent-external-url"><?php _e( 'External URL', 'simple-wp-events' ); ?></label>
    427430                <input id="wpevent-external-url" class="wp-event-field" type="url" name="wpevent-external-url" value="<?php echo get_post_meta( $post->ID, 'wpevent-external-url', true );?>"/>
    428                 <p><br></p>
    429431                <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
    430432            </div>
     
    12991301     * Changes past events status to draft.
    13001302     *
    1301      * @since 1.5.2
     1303     * @since 1.6.0
    13021304     */
    13031305    public function wpe_past_events_draft() {
  • simple-wp-events/trunk/admin/class-wp-events-shortcodes.php

    r2780675 r2882562  
    204204        $fax             = isset( $form_options['form_fax'] );
    205205        $hearAbout       = isset( $form_options['form_hear_about'] );
     206        $mail_options    = get_option( 'wpe_mail_settings' );
     207        $permission      = isset( $mail_options['enable_texting_email'] );
    206208
    207209        $post_id        = self::$form_data['post'] ?? self::$form_data['post_id'];
     
    216218        $wpe_zip        = sanitize_text_field( self::$form_data['wpe_zip'] ?? self::$form_data['zip'] );
    217219        $wpe_source     = sanitize_text_field( self::$form_data['hear_about_us'] );
     220        $wpe_texting    = self::$form_data['wpe_texting_permission'] == 1 ? 'Yes' : 'No';
    218221
    219222        $registration_details = "<p style='margin: 5px 0'><strong>First name</strong>: $wpe_first_name</p>";
     
    237240        endif;
    238241        $registration_details .= "<p style='margin: 5px 0'><strong>Seats</strong>: $wpe_seats</p>";
     242        if( $permission ):
     243            $registration_details .= "<p style='margin: 5px 0'><strong>Texting Permission</strong>: $wpe_texting</p>";
     244        endif;
    239245
    240246        if( isset( self::$form_data['wpe_guest_first_name'] ) && isset( self::$form_data['wpe_guest_last_name'] ) ) {
  • simple-wp-events/trunk/admin/css/wp-events-admin.css

    r2780675 r2882562  
    540540}
    541541
     542.wpe-header-title {
     543    padding-left: 10px;
     544    margin: 5px 0;
     545    letter-spacing: -1px;
     546}
     547
    542548.wp_events_page_wpe_view_entry #wpcontent,
    543549.wp_events_page_wp_forms_entries #wpcontent,
     
    548554.wp_events_page_wp_events_settings form {
    549555    padding-left: 20px;
    550 }
    551 
    552 .wp_events_page_wp_forms_entries .wrapper {
    553     padding: 0 20px 0 40px;
    554556}
    555557
     
    745747    padding: 0 10px 10px 10px;
    746748}
     749
     750.wpe-display-none {
     751    display: none;
     752}
  • simple-wp-events/trunk/admin/includes/class-wp-events-admin-requests.php

    r2780675 r2882562  
    241241        wpe_send_ajax_response( $post_id );
    242242    }
     243
     244    /**
     245     * Ajax request for updating all seminars confirmation when message
     246     * is updated in settings.
     247     *
     248     * @since 1.6.0
     249     */
     250    public function wpe_update_confirmation() {
     251        $type    = wpe_sanitize( $_POST['type'] );
     252        $message = wpe_sanitize( $_POST['message'] );
     253        $args    = [
     254            'post_type'          => 'wp_events',
     255            'posts_per_page'     => -1,
     256            'post_status'        => 'publish',
     257            'meta_query'         => [
     258                [
     259                    'key'        => 'wpevent-type',
     260                    'value'      => $type,
     261                    'compare'    => 'LIKE',
     262                ],
     263            ],
     264        ];
     265
     266        $events = get_posts( $args );
     267        if( $events ) {
     268            foreach ( $events as $event ) {
     269                // Run a loop and update every meta data
     270                update_post_meta( $event->ID, 'wpevent-confirmation-message', $message );
     271                wpe_send_ajax_response( 1 );
     272            }
     273        }
     274        wpe_send_ajax_response( 0 );
     275    }
    243276}
  • simple-wp-events/trunk/admin/includes/class-wp-events-admin-settings.php

    r2780675 r2882562  
    575575            'Enable Webinar Confirmation email',
    576576            [$this,'wpe_settings_enable_webinar_conformation_callback'],
     577            'wp_events_settings&tab=mail',
     578            'wpe_settings_mail_section'
     579        );
     580
     581        add_settings_field(
     582            'wpe_settings_enable_texting_email',
     583            'Send Texting Permission in email',
     584            [$this,'wpe_settings_enable_texting_email_callback'],
    577585            'wp_events_settings&tab=mail',
    578586            'wpe_settings_mail_section'
     
    786794                        </tr>
    787795                        <tr>
     796                            <th scope="row"><?php _e( 'Update Message for Existing Seminars?', 'simple-wp-events' ); ?></th>
     797                            <td>
     798                                <label class="wpe-checkbox">
     799                                    <input name="wpe_mail_settings[update_all_seminars]" id="wpe_update_all_seminars" value="l_true" type="checkbox" <?php echo isset( $wpe_mail_settings['update_all_seminars'] ) ? 'checked' : ''; ?> />
     800                                    <span class="slider round"></span>
     801                                </label>
     802                                <small><?php _e( 'Check this box to update email confirmation for all existing seminars.', 'simple-wp-events' ); ?></small>
     803                            </td>
     804                        </tr>
     805                        <tr>
    788806                            <th scope="row"><?php _e( 'Webinar Email Message', 'simple-wp-events' ); ?></th>
    789807                            <td>
    790808                            <?php
    791                                 $webinar_success_Message =  isset( $wpe_mail_settings['webinar_success_messages'] ) ? $wpe_mail_settings['webinar_success_message'] : '';
     809                                $webinar_success_Message = isset( $wpe_mail_settings['webinar_success_message'] ) ? $wpe_mail_settings['webinar_success_message'] : '';
    792810                                $disable_editor          = isset( $wpe_mail_settings['enable_webinar_conformation'] ) ? '' : 'disable-editor';
    793811                                echo wpe_editor( $webinar_success_Message, 'webinar_success_message-'. $disable_editor, 'wpe_mail_settings[webinar_success_message]' );
     
    797815                                    <?php echo $this->shortcode_helper_tooltip(); ?>
    798816                                </small>
     817                            </td>
     818                        </tr>
     819                        <tr>
     820                            <th scope="row"><?php _e( 'Update Message for Existing Webinars?', 'simple-wp-events' ); ?></th>
     821                            <td>
     822                                <label class="wpe-checkbox">
     823                                    <input name="wpe_mail_settings[update_all_webinars]" id="wpe_update_all_webinars" value="l_true" type="checkbox" <?php echo isset( $wpe_mail_settings['update_all_webinars'] ) ? 'checked' : ''; ?> />
     824                                    <span class="slider round"></span>
     825                                </label>
     826                                <small><?php _e( 'Check this box to update email confirmation for all existing webinars.', 'simple-wp-events' ); ?></small>
    799827                            </td>
    800828                        </tr>
     
    9811009            <th scope="row"><?php _e( 'Export Registrations', 'simple-wp-events' ); ?></th>
    9821010            <td>
    983                 <input type="submit" id="export-event-entries" class="button button-primary" value="Export Entries">
    984                 <small class="wpe-fields-description"><?php _e( 'Export Registrations to CSV (Leave the filters empty if you want to export all entries.)', 'simple-wp-events' ); ?></small>
     1011                <input type="submit" id="export-event-entries" class="button button-primary" value="Export Registrations">
     1012                <small class="wpe-fields-description"><?php _e( 'Export Registrations to CSV (Leave the filters empty if you want to export all entries).', 'simple-wp-events' ); ?></small>
    9851013            </td>
    9861014        </tr>
     
    13571385        ?>
    13581386        <div id="subscriber-form-settings">
     1387            <div class="wpe-subscriber-form">
     1388            <h2><?php _e( 'Required/Optional Subscriber Form Fields', 'simple-wp-events' ); ?></h2>
     1389                <p><?php _e( 'Check To make the fields required on the form', 'simple-wp-events' ); ?></p>
     1390                <table class="wpe-settings-table">
     1391                    <tr>
     1392                        <td>
     1393                            <span class="label"><?php _e( 'Phone', 'simple-wp-events' ); ?></span>
     1394                        </td>
     1395                        <td>
     1396                            <label class="wpe-checkbox">
     1397                            <input name="wpe_forms_settings[req_subform_phone]" id="wpe_req_subform_phone" value="l_true" type="checkbox" <?php echo isset( $this->wpe_form_settings['req_subform_phone'] ) ? 'checked' : ''; ?> />
     1398                            <span class="slider round"></span>
     1399                            </label>
     1400                        </td>
     1401                        <td>
     1402                            <span class="label"><?php _e( 'Email', 'simple-wp-events' ); ?></span>
     1403                        </td>
     1404                        <td>
     1405                            <label class="wpe-checkbox">
     1406                            <input name="wpe_forms_settings[req_subform_email]" id="wpe_req_subform_email" value="l_true" type="checkbox" <?php echo isset( $this->wpe_form_settings['req_subform_email'] ) ? 'checked' : ''; ?> />
     1407                            <span class="slider round"></span>
     1408                            </label>
     1409                        </td>
     1410                    </tr>
     1411                </table>
     1412            </div>
    13591413            <h2><?php _e( 'Subscriber Form Settings', 'simple-wp-events' ); ?></h2>
    13601414            <p><?php _e( 'All the Subscriber form settings are available here.', 'simple-wp-events' ); ?></p>
     
    14511505                            <label class="wpe-checkbox">
    14521506                            <input name="wpe_forms_settings[form_hear_about]" id="wpe_form_hear_about" value="l_true" type="checkbox" <?php echo isset( $this->wpe_form_settings['form_hear_about'] ) ? 'checked' : ''; ?> />
     1507                            <span class="slider round"></span>
     1508                            </label>
     1509                        </td>
     1510                    </tr>
     1511                </table>
     1512                <h2><?php _e( 'Required/Optional Registration Form Fields', 'simple-wp-events' ); ?></h2>
     1513                <p><?php _e( 'Check To make the fields required on the form', 'simple-wp-events' ); ?></p>
     1514                <table class="wpe-settings-table">
     1515                    <tr>
     1516                        <td>
     1517                            <span class="label"><?php _e( 'Address 1', 'simple-wp-events' ); ?></span>
     1518                        </td>
     1519                        <td>
     1520                            <label class="wpe-checkbox">
     1521                            <input name="wpe_forms_settings[req_form_address1]" id="wpe_req_form_address1" value="l_true" type="checkbox" <?php echo isset( $this->wpe_form_settings['req_form_address1'] ) ? 'checked' : ''; ?> />
     1522                            <span class="slider round"></span>
     1523                            </label>
     1524                        </td>
     1525                        <td>
     1526                            <span class="label"><?php _e( 'Address 2', 'simple-wp-events' ); ?></span>
     1527                        </td>
     1528                        <td>
     1529                            <label class="wpe-checkbox">
     1530                            <input name="wpe_forms_settings[req_form_address2]" id="wpe_req_form_address2" value="l_true" type="checkbox" <?php echo isset( $this->wpe_form_settings['req_form_address2'] ) ? 'checked' : ''; ?> />
     1531                            <span class="slider round"></span>
     1532                            </label>
     1533                        </td>
     1534                    </tr>
     1535                    <tr>
     1536                        <td>
     1537                            <span class="label"><?php _e( 'City', 'simple-wp-events' ); ?></span>
     1538                        </td>
     1539                        <td>
     1540                            <label class="wpe-checkbox">
     1541                            <input name="wpe_forms_settings[req_form_city]" id="wpe_req_form_city" value="l_true" type="checkbox" <?php echo isset( $this->wpe_form_settings['req_form_city'] ) ? 'checked' : ''; ?> />
     1542                            <span class="slider round"></span>
     1543                            </label>
     1544                        </td>
     1545                        <td>
     1546                            <span class="label"><?php _e( 'State', 'simple-wp-events' ); ?></span>
     1547                        </td>
     1548                        <td>
     1549                            <label class="wpe-checkbox">
     1550                            <input name="wpe_forms_settings[req_form_state]" id="wpe_req_form_state" value="l_true" type="checkbox" <?php echo isset( $this->wpe_form_settings['req_form_state'] ) ? 'checked' : ''; ?> />
     1551                            <span class="slider round"></span>
     1552                            </label>
     1553                        </td>
     1554                    </tr>
     1555                    <tr>
     1556                        <td>
     1557                            <span class="label"><?php _e( 'Phone', 'simple-wp-events' ); ?></span>
     1558                        </td>
     1559                        <td>
     1560                            <label class="wpe-checkbox">
     1561                            <input name="wpe_forms_settings[req_form_phone]" id="wpe_req_form_phone" value="l_true" type="checkbox" <?php echo isset( $this->wpe_form_settings['req_form_phone'] ) ? 'checked' : ''; ?> />
     1562                            <span class="slider round"></span>
     1563                            </label>
     1564                        </td>
     1565                        <td>
     1566                            <span class="label"><?php _e( 'Email', 'simple-wp-events' ); ?></span>
     1567                        </td>
     1568                        <td>
     1569                            <label class="wpe-checkbox">
     1570                            <input name="wpe_forms_settings[req_form_email]" id="wpe_req_form_email" value="l_true" type="checkbox" <?php echo isset( $this->wpe_form_settings['req_form_email'] ) ? 'checked' : ''; ?> />
     1571                            <span class="slider round"></span>
     1572                            </label>
     1573                        </td>
     1574                    </tr>
     1575                    <tr>
     1576                        <td>
     1577                            <span class="label"><?php _e( 'Zip', 'simple-wp-events' ); ?></span>
     1578                        </td>
     1579                        <td>
     1580                            <label class="wpe-checkbox">
     1581                            <input name="wpe_forms_settings[req_form_zip]" id="wpe_req_form_zip" value="l_true" type="checkbox" <?php echo isset( $this->wpe_form_settings['req_form_zip'] ) ? 'checked' : ''; ?> />
     1582                            <span class="slider round"></span>
     1583                            </label>
     1584                        </td>
     1585                        <td>
     1586                            <span class="label"><?php _e( 'Fax', 'simple-wp-events' ); ?></span>
     1587                        </td>
     1588                        <td>
     1589                            <label class="wpe-checkbox">
     1590                            <input name="wpe_forms_settings[req_form_fax]" id="wpe_req_form_fax" value="l_true" type="checkbox" <?php echo isset( $this->wpe_form_settings['req_form_fax'] ) ? 'checked' : ''; ?> />
     1591                            <span class="slider round"></span>
     1592                            </label>
     1593                        </td>
     1594                    </tr>
     1595                    <tr>
     1596                        <td>
     1597                            <span class="label"><?php _e( 'Business Name', 'simple-wp-events' ); ?></span>
     1598                        </td>
     1599                        <td>
     1600                            <label class="wpe-checkbox">
     1601                            <input name="wpe_forms_settings[req_form_businessName]" id="wpe_req_form_businessName" value="l_true" type="checkbox" <?php echo isset( $this->wpe_form_settings['req_form_businessName'] ) ? 'checked' : ''; ?> />
    14531602                            <span class="slider round"></span>
    14541603                            </label>
     
    16891838        <?php
    16901839    }
     1840   
    16911841    /**
    16921842     * Disable Webinar confirmation
     
    17011851        </label>
    17021852        <small><?php _e( 'Check this box to enable the webinar confirmation email for registrants.', 'simple-wp-events' ); ?></small>
     1853        <?php
     1854    }
     1855
     1856    /**
     1857     * Send Texting Permission in email
     1858    */
     1859    public function wpe_settings_enable_texting_email_callback() {
     1860        $option = get_option('wpe_mail_settings');
     1861        ?>
     1862           <label class="wpe-checkbox">
     1863            <input name="wpe_mail_settings[enable_texting_email]" id="wpe_enable_texting_email" value="l_true"
     1864                   type="checkbox" <?php echo isset( $option['enable_texting_email'] ) ? 'checked' : ''; ?> />
     1865            <span class="slider round"></span>
     1866        </label>
     1867        <small><?php _e( 'Check this box to send texting permission status in email (for registration form).', 'simple-wp-events' ); ?></small>
    17031868        <?php
    17041869    }
  • simple-wp-events/trunk/admin/includes/wp-events-export-events.php

    r2780675 r2882562  
    298298                        $entry_status = 'Active';
    299299                }
     300
     301                $address1         = $result->addres_one;
     302                $address2         = $result->addres_two != '' ? ', ' . $result->addres_two . ', ' : ', ';
     303                $city             = $result->city;
     304                $state            = $result->state;
     305                $zip              = $result->zip;
     306                $complete_address = $address1 . $address2 . $city . ', ' . $state;
    300307               
    301308                $data[] = array(
     
    304311                    'First Name'          => esc_attr( $result->first_name ),
    305312                    'Last Name'           => esc_attr( $result->last_name ),
     313                    'Address'             => esc_attr( $complete_address ),
    306314                    'Email'               => esc_attr( $result->email ),
    307315                    'Phone'               => esc_attr( $result->phone ),
  • simple-wp-events/trunk/admin/includes/wp-events-view-edit-entry.php

    r2780675 r2882562  
    3939                        'value'         => $results[0]->first_name,
    4040                        'required'      => true,
    41                         'class'         => ['wpe-no-special'],
    4241                    ),
    4342                    'wpe_last_name'     => array(
     
    4544                        'value'         => $results[0]->last_name,
    4645                        'required'      => true,
    47                         'class'         => ['wpe-no-special'],
    4846                    ),
    4947                    'wpe_address'       => array(
    5048                        'label'         => 'Address',
    5149                        'value'         => $results[0]->addres_one,
    52                         'class'         => ['wpe-no-special'],
    5350                    ),
    5451                    'wpe_address_2'     => array(
    5552                        'label'         => 'Address2',
    5653                        'value'         => $results[0]->addres_two,
    57                         'class'         => ['wpe-no-special'],
    5854                    ),
    5955                    'wpe_city'          => array(
    6056                        'label'         => 'City',
    6157                        'value'         => $results[0]->city,
    62                         'class'         => ['wpe-no-special'],
    6358                    ),
    6459                    'wpe_state'         => array(
    6560                        'label'         => 'State',
    6661                        'value'         => $results[0]->state,
    67                         'class'         => ['wpe-no-special'],
    6862                    ),
    6963                    'wpe_zip'           => array(
     
    106100                        'value'         => $results[0]->guests,
    107101                        'guest-class'   => $guest_class,
    108                         'class'         => ['wpe-no-special'],
    109102                    ),
    110103                    'wpe_texting'       => array(
  • simple-wp-events/trunk/admin/js/wp-events-admin.js

    r2780675 r2882562  
    66jQuery(document).ready( function($) {
    77
    8     $('.wpe-form-control .wpe-no-special').on( 'input', function() {
    9         var c = this.selectionStart,
    10             r = /[^a-z0-9 ]/gi,
    11             v = $(this).val();
    12         if( r.test( v ) ) {
    13           $( this ).val( v.replace( r, '' ) );
    14           c--;
    15         }
    16         this.setSelectionRange(c, c);
    17     });
     8    $("#wpevent-phone").inputmask({"mask": "(999) 999-9999"});
    189   
    1910    const startDate = document.getElementById('wpevent-start-date');
     
    203194        });
    204195    }
    205 
    206 
    207         /**
     196   
     197    /**
    208198     * if the pattern not matches with (123) 123-1224 the publish and update button will be disabled
    209199     * */
    210          if ( $( 'body' ).hasClass( 'post-type-wp_events' ) ) {
    211 
    212             function checkPhoneNumber( input ) {
    213                 let regex = /\(\d\d\d+\)\s\d\d\d-\d\d\d\d+/i;
    214                 return regex.test( input );
    215             }
    216             $( document ).ready( function() {
    217                 if ( ! checkPhoneNumber( $( '#wpevent-phone' ).val() ) ) {
    218                     $( '.editor-post-publish-button__button' ).prop( "disabled", true );
    219                 }
    220             });
    221    
    222             /**
    223              * if the date fields are empty disable the publish button
    224              * */
    225             $( '#wpevent-start-date' ).on( "change paste keyup", function() {
    226                 if ( $( '#wpevent-start-date' ) == '' ) {
    227                     $( '.editor-post-publish-button__button' ).prop("disabled", true );
    228                 }
    229                 else if ( checkPhoneNumber( $( '#wpevent-phone' ).val() ) && $( '#wpevent-start-date' ) != '' && $( '#wpevent-end-date' ) != '' ) {
    230                     $( '.editor-post-publish-button__button' ).prop( "disabled", false );
    231                 }
    232             });
    233             $( '#wpevent-end-date' ).on( "change paste keyup", function() {
    234                 if ( $( '#wpevent-end-date' ) == '' ) {
    235                     $( '.editor-post-publish-button__button' ).prop( "disabled", true );
    236                 }
    237                 else if ( checkPhoneNumber($( '#wpevent-phone' ).val()) && $( '#wpevent-start-date' ) != '' && $( '#wpevent-end-date' ) != '' ) {
    238                     $( '.editor-post-publish-button__button' ).prop( "disabled", false );
    239                 }
    240             });
    241             $( '#wpevent-phone' ).on( "change paste keyup", function( input ) {
    242                 var startDate = $( '#wpevent-start-date' ).val();
    243                 var endDate   = $( '#wpevent-end-date' ).val();
    244                 if ( ! checkPhoneNumber( $( '#wpevent-phone' ).val() ) ) {
    245                     $( '.editor-post-publish-button__button' ).prop( "disabled", true );
    246                 }else if ( checkPhoneNumber ($( '#wpevent-phone' ).val() ) && startDate != '' && endDate != '' ) {
    247                     $( '.editor-post-publish-button__button' ).prop( "disabled", false );
    248                 }
    249             });
    250          } 
    251 
    252     //on event single page
    253     if ( $('body').hasClass('post-type-wp_events') ) {
     200    if ( $( 'body' ).hasClass( 'post-type-wp_events' ) ) {
     201
     202        $( document ).ready( function() {
     203            if ( $( '#wpevent-start-date' ).val() == '' || $( '#wpevent-end-date' ).val() == '' ) {
     204                $( '.editor-post-publish-button__button' ).prop( "disabled", true );
     205            }
     206        });
     207
     208        /**
     209         * if the date fields are empty disable the publish button
     210         * */
     211        $( '#wpevent-start-date' ).on( "change paste keyup", function() {
     212            if ( $( '#wpevent-start-date' ).val() == '' ) {
     213                $( '.editor-post-publish-button__button' ).prop("disabled", true );
     214            }
     215            else if ( $( '#wpevent-start-date' ).val() != '' && $( '#wpevent-end-date' ).val() != '' ) {
     216                $( '.editor-post-publish-button__button' ).prop( "disabled", false );
     217            }
     218        });
     219        $( '#wpevent-end-date' ).on( "change paste keyup", function() {
     220            if ( $( '#wpevent-end-date' ).val() == '' ) {
     221                $( '.editor-post-publish-button__button' ).prop( "disabled", true );
     222            }
     223            else if ( $( '#wpevent-start-date' ).val() != '' && $( '#wpevent-end-date' ).val() != '' ) {
     224                $( '.editor-post-publish-button__button' ).prop( "disabled", false );
     225            }
     226        });
     227       
    254228        // on publish button click
    255         $(document).on( 'click', '.editor-post-publish-button', function(e){
    256 
     229        $(document).on( 'click', '.editor-post-publish-button', function( e ){
    257230            metaboxValidation( [startDate, endDate, seats, phone], e );
    258231
     
    696669    }
    697670
     671    if( window.location.href.includes('tab=mail') ) {
     672        var updateMessage = $('#wpe_update_all_seminars').prop("checked");
     673        var message       = '';
     674        $('#wpe_update_all_seminars').change( function(e) {
     675            // checked will equal true if checked or false otherwise
     676            const checked = $(this).is(':checked');
     677            updateMessage = checked;
     678        });
     679        $("#mail_success_message").on('change keyup paste', function( event ) {
     680            message = event.target.value;
     681        });
     682        $('#wpe-save-settings').click( function( e ) {
     683            if( updateMessage == true && message != '' ) {
     684                e.preventDefault();
     685                $.ajax( {
     686                    type: 'POST',
     687                    url: wpe_ajaxobject.ajaxurl,
     688                    dataType: "text",
     689                    data: { action : 'wpe_update_confirmation',
     690                            message : message,
     691                            type : 'seminar' },
     692                    success: function( response ) {
     693                        if( response == 1 ) {
     694                            console.log( 'All seminars updated.' );
     695                        } else {
     696                            console.log( 'No posts to update.' );
     697                        }
     698                    },
     699                    complete: function( response ) {
     700                        $( "#wpe-settings-form" )[0].submit();
     701                    }
     702                });
     703            }
     704        });
     705        var updateWebinar = $('#wpe_update_all_webinars').prop("checked");
     706        var webMessage    = '';
     707        $('#wpe_update_all_webinars').change( function(e) {
     708            // checked will equal true if checked or false otherwise
     709            const checkedWeb = $(this).is(':checked');
     710            updateWebinar    = checkedWeb;
     711        });
     712        $("#webinar_success_message").on('change keyup paste', function( event ) {
     713            webMessage = event.target.value;
     714        });
     715        $('#wpe-save-settings').click( function( e ) {
     716            if( updateWebinar == true && webMessage != '' ) {
     717                e.preventDefault();
     718                $.ajax( {
     719                    type: 'POST',
     720                    url: wpe_ajaxobject.ajaxurl,
     721                    dataType: "text",
     722                    data: { action : 'wpe_update_confirmation',
     723                            message : webMessage,
     724                            type : 'webinar' },
     725                    success: function( response ) {
     726                        if( response == 1 ) {
     727                            console.log( 'All webinars updated.' );
     728                        } else {
     729                            console.log( 'No posts to update.' );
     730                        }
     731                    },
     732                    complete: function( response ) {
     733                        $( "#wpe-settings-form" )[0].submit();
     734                    }
     735                });
     736            }
     737        });
     738    }
     739
    698740    //function calls
    699741    wpe_datepicker();
  • simple-wp-events/trunk/admin/templates/wp-events-admin-settings-display.php

    r2780675 r2882562  
    2525        </div>
    2626    </div>
    27     <form method="post" action="options.php">
     27    <form method="post" action="options.php" id="wpe-settings-form">
    2828    <h2 class="nav-tab-wrapper">
    2929        <?php
     
    3636        ?>
    3737    </div>
    38         <?php submit_button();?>
     38        <?php
     39        $other_attributes = array( 'id' => 'wpe-save-settings' );
     40        submit_button( __( 'Save Settings', 'simple-wp-events' ), 'primary', 'wpe-save-settings', true, $other_attributes ); ?>
    3941    </form>
  • simple-wp-events/trunk/assets/css/wp-events.css

    r2780675 r2882562  
    4242} */
    4343
    44 .wpe-form-control small {
     44.wpe-form-control small, .wpe-above-error-field, .wpe-form-control .wpe-email-error-class,
     45.wpe-form-control .wpe-phone-error-class {
    4546    color: var(--error-color);
    4647    /*position: absolute;*/
     
    4849    /*left: 0;*/
    4950    visibility: hidden;
     51    display: none;
     52    width: 100%;
     53    padding: 2px;
     54    background: #f9eeee;
     55    color: #9b0b0b;
     56    font-weight: bold
     57
     58}
     59
     60.wpe-email-error-class, .wpe-phone-error-class {
     61    font-size: smaller;
     62}
     63
     64.wpe-above-error-field {
     65    text-align: center;
     66    border: 1px solid #9b0b0b;
     67    width: 100%;
     68    border-radius: 5px;
     69    background: none;
     70    margin-bottom: 20px;
     71}
     72
     73.wpe-error-exclamation {
     74    color: white;
     75    border-radius: 50%;
     76    background:#9b0b0b ;
     77    padding: 1px 8px;
    5078}
    5179
     
    5886}
    5987
    60 .wpe-form-control.error small {
     88.wpe-form-control.error small, .wpe-above-error-field.error,
     89.wpe-form-control.correct-email .wpe-email-error-class,
     90.wpe-form-control.correct-phone .wpe-phone-error-class {
    6191    visibility: visible;
     92    display: block;
    6293}
    6394
     
    73104}
    74105
    75 .wpe-subscribe-form-container input,
     106.wpe-subscribe-form-container input:not([type='checkbox']),
    76107.wpe-subscribe-form-container select {
    77108    border: 1px solid #ddd;
     
    79110    padding: 0 15px;
    80111    box-sizing: border-box;
     112}
     113
     114.wpe-subscribe-form-container input[type="checkbox"],
     115.wpe-subscribe-form-container input[type="radio"] {
     116    min-width: 16px;
     117    min-height: 16px;
     118    top: 0;
     119    max-height: 16px;
    81120}
    82121
  • simple-wp-events/trunk/changelog.txt

    r2780675 r2882562  
     1Version-1.6.2
     2Update: Made phone number field on add event page as optional.
     3Added: Input mask for phone number field on add event page.
     4
     5Version-1.6.1
     6Fixed: Subscribe form layout for archive shortcode.
     7Added: Attribute to change single-button text in shortcode widget.
     8
     9Version-1.6.0
     10Added: Form validation errors.
     11Added: Option to send the texting permission info to email.
     12Added: Dark mode in display settings.
     13Added: User notification checkbox for edit entry.
     14Added: Filters to format date on archive page.
     15Fixed: CSS for texting permission checkbox.
     16Update: enqueue select2 file locally.
     17Added: Option to make the form fields required or optional.
     18Added: Option to bulk update existing email confirmation.
     19Update: Add registerant address to the export registrations csv.
     20Added: jQuery input mask for the phone number formatting.
     21
    122Version-1.5.3
    223Update: Past events are changed to draft so that they are not indexed.
  • simple-wp-events/trunk/includes/class-wp-events-activator.php

    r2780675 r2882562  
    8989            'hearaboutus_options'                => 'An Email I Received, Blog / Facebook, Internet / Search Engine, Landing Pages, Radio and TV, Link from another website, Mailing / Postcard, Newsletter, Newspaper, Other, Referral',
    9090            'subscriber_form_texting_permission' => 'I agree to receive texts at the number provided from [wpe_firm_name]. Frequency may vary and include information on appointments, events, and other marketing messages. Message/data rates may apply. To opt-out, text STOP at any time.',
     91            'reg_enable_texting_permission'      => 'yes',
     92            'req_form_address1'                  => 'l_true',
     93            'req_form_city'                      => 'l_true',
     94            'req_form_state'                     => 'l_true',
     95            'req_form_zip'                       => 'l_true',
     96            'req_form_phone'                     => 'l_true',
     97            'req_form_email'                     => 'l_true',
     98            'req_subform_email'                  => 'l_true',
    9199        ];
    92100
  • simple-wp-events/trunk/includes/class-wp-events-db-actions.php

    r2780675 r2882562  
    5858        $charset_collate = $wpdb->get_charset_collate();
    5959        $table_name = $wpdb->prefix . 'events_registration';
    60         $post_table_name = $wpdb->prefix .'posts (ID)';
    6160        $sql = "CREATE TABLE IF NOT EXISTS " . $table_name. " (
    6261                    ID BIGINT PRIMARY KEY AUTO_INCREMENT NOT NULL,
  • simple-wp-events/trunk/includes/class-wp-events.php

    r2780675 r2882562  
    220220        $this->loader->add_action( 'wp_ajax_wpe_update_location', $adminRequests, 'wpe_update_location' ); 
    221221        $this->loader->add_action( 'wp_ajax_wpe_create_location', $adminRequests, 'wpe_create_location' ); 
    222        
     222        $this->loader->add_action( 'wp_ajax_wpe_update_confirmation', $adminRequests, 'wpe_update_confirmation' ); 
    223223    }
    224224
  • simple-wp-events/trunk/includes/wp-events-global-functions.php

    r2780675 r2882562  
    567567     */
    568568    function wpe_get_past_events() {
     569        $past_events = array();
    569570        $args = [
    570571            'post_type'          => 'wp_events',
     
    720721    }
    721722}
     723
     724if( ! function_exists( 'wpe_get_user_timezone' ) ) {
     725    /**
     726     * Returns name of user's local timezone
     727     *
     728     * @since 1.6.0
     729     * @return string
     730     */
     731    function wpe_get_user_timezone() {
     732        $timezone_offset_minutes = isset( $_COOKIE['wpeTimezone'] ) ? $_COOKIE['wpeTimezone'] : '0';
     733        $timezone_name           = timezone_name_from_abbr( "", (int) $timezone_offset_minutes * 60, false );
     734        return $timezone_name;
     735    }
     736}
     737
     738if( ! function_exists( 'wpe_get_current_post_type' ) ) {
     739    /**
     740     * Gets the current post type for admin area
     741     *
     742     * @since 1.8.0
     743     * @return string|null
     744     */
     745    function wpe_get_current_post_type() {
     746   
     747        global $post, $typenow, $current_screen;
     748       
     749        if ( $post && $post->post_type ) return $post->post_type;
     750       
     751        else if( $typenow ) return $typenow;
     752       
     753        else if ( $current_screen && $current_screen->post_type ) return $current_screen->post_type;
     754       
     755        else if( isset($_REQUEST['post_type'] ) ) return sanitize_key( $_REQUEST['post_type'] );
     756       
     757        return null;
     758    }
     759}
  • simple-wp-events/trunk/public/class-wp-events-public.php

    r2780675 r2882562  
    101101         */
    102102
     103        wp_enqueue_script( 'jquery-inputmask', plugin_dir_url( __DIR__ ) . 'assets/js/jquery.inputmask.min.js', array( 'jquery' ), $this->version, false );
    103104        wp_enqueue_script( 'jquery-serialize', plugin_dir_url( __DIR__ ) . 'assets/js/jquery.serializejson.js', array( 'jquery' ), $this->version, false );
    104105        wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wp-events-public.js', array( 'jquery', 'jquery-serialize' ), $this->version, false );
     
    118119                'posts'            => json_encode( $wpe_query->query_vars ), // everything about your loop is here
    119120                'current_page'     => get_query_var( 'paged' ) ? get_query_var('paged') : 1,
    120                 'max_page'         => $wpe_query->max_num_pages
     121                'max_page'         => $wpe_query->max_num_pages,
     122                'wpePluginBase'    => WPE_PLUGIN_BASE,
    121123            )
    122124        ); 
     
    313315        $wpevent_atts = shortcode_atts(
    314316            [
    315                 'title'         => $title,
    316                 'number'        => 3,
    317                 'location'      => 'true',
    318                 'archive'       => 'true',
    319                 'date'          => 'true',
    320                 'class'         => '',
    321                 'category'      => '',
    322                 'button_text'   => __( 'See all ', 'simple-wp-events' ) . $title,
    323                 'type'          => '',
    324                 'single-button' => 'false',
     317                'title'              => $title,
     318                'number'             => 3,
     319                'location'           => 'true',
     320                'archive'            => 'true',
     321                'date'               => 'true',
     322                'class'              => '',
     323                'category'           => '',
     324                'button_text'        => __( 'See all ' . $title, 'simple-wp-events' ),
     325                'type'               => '',
     326                'single-button'      => 'false',
     327                'single-button-text' => 'Register',
    325328            ], $atts
    326329        );
     
    393396                $html .= '<div class="wpe-single-registration">
    394397                            <a class="button wpe-reg-button wpe-single-reg" href="' . $event_permalink . '"
    395                             title="Click to Register">Register</a>
     398                            target="_blank" title="Click to Register">'. esc_html( $wpevent_atts['single-button-text'] ) .'</a>
    396399                        </div>';
    397400            }
     
    404407            }
    405408            do_action( 'wp_events_subscribe_form' );
    406             $html = ob_get_clean();
    407             $html = '<div class="wpevents-shortcode-section wpevents-section">' . $html . '</div>';
     409            $html = ob_get_clean();
     410            if ( $wpevent_atts['class'] !== '' ) {
     411                $html = '<div class="wpevents-shortcode-section '. esc_html( $wpevent_atts['class'] ) .' wpevents-section">' . wp_kses( $html, wpe_get_allowed_html() ) . '</div>';
     412            } else {
     413                $html = '<div class="wpevents-shortcode-section wpevents-section">' . wp_kses( $html, wpe_get_allowed_html() ) . '</div>';
     414            }
    408415        } else {
    409416            if ( $wpevent_atts['archive'] === 'true' ) {
  • simple-wp-events/trunk/public/css/wp-events-public.css

    r2780675 r2882562  
    7575#wpe-button {
    7676    font-size: 18px;
     77    display: inherit;
     78    margin: 0 auto;
    7779}
    7880
     
    415417.wpevents-section {
    416418    text-align: center;
    417     padding: 20px 0;
    418419}
    419420
     
    586587    -webkit-appearance: none;
    587588    margin: 0;
    588 }
    589 
    590 /* Firefox */
    591 input.wpe-field[type=number] {
    592     -moz-appearance: textfield;
    593589}
    594590
     
    659655}
    660656
     657.wpe-display-block .wpe-subscribe-form .wpe-col-2 {
     658    display: block;
     659}
     660
    661661.wpe-register-form-container .wpe-col-2 div , .wpe-subscribe-form .wpe-col-2 div{
    662662    flex: 50%;
     
    809809    background-color: #121016;
    810810    border: 1px solid #fff;
     811}
     812
     813.wpe-dark-mode span.dashicons {
     814    color: #fff;
     815}
     816
     817.wpe-dark-mode .wpe-grid .wpe-row {
     818    border: 1px solid #fff;
     819}
     820
     821.wpe-dark-mode .fc-icon {
     822    color: #000;
     823}
     824
     825.wpe-dark-mode .fc-button:hover .fc-icon {
     826    color: #fff;
     827}
     828
     829.wpe-dark-mode .fc-unthemed td.fc-today {
     830    background: #333;
     831}
     832
     833.wpe-dark-mode button:not(:hover):not(:active):not(.has-text-color) {
     834    color: #000;
    811835}
    812836
  • simple-wp-events/trunk/public/includes/class-wp-events-form-request.php

    r2780675 r2882562  
    314314        $mail_options               = get_option('wpe_mail_settings');
    315315        $firm_info                  = get_option('wpe_firm_settings');
    316         wpe_request_log( $firm_info );
    317316        $event_option               = get_option('wpe_events_settings');
    318317        $from_name                  = $firm_info['mail_from_name'];
     
    360359        if( $notified_user !=='' && $notified_user !== $firm_info['admin_mail'] ) { // if not empty and not identical to the one in mail options send to notified user
    361360            wp_mail( $notified_user, $admin_subject, $admin_message, $headers );
    362             // wpe_request_log( $notified_user );
    363361        } else {
    364362            wp_mail( $firm_info['admin_mail'], $admin_subject, $admin_message, $headers );
    365             wpe_request_log( $firm_info['admin_mail'] );
    366363        }
    367364    }
  • simple-wp-events/trunk/public/includes/wp-events-public-helpers.php

    r2780675 r2882562  
    280280        $event_date_time = wpevent_start_date_time( $post_id );
    281281        $start_date      = isset( $event_date_time['start_date'] ) ? strtotime( $event_date_time['start_date'] ) : 0;
     282        $day_format      = apply_filters( 'wpevents_archive_day_format', 'D' );
     283        $date_format     = apply_filters( 'wpevents_archive_date_format', 'j' );
    282284        ?>
    283285        <div class="wpe-day-date">
     
    285287                <span class="wpe-col-day">
    286288                    <?php
    287                     echo date( "D", $start_date );     //event start day ?>
     289                    echo date( $day_format, $start_date );     //event start day ?>
    288290                </span>
    289291                <span class="wpe-col-date">
    290292                    <?php
    291                     echo date( 'j', $start_date );    //event start date ?>
     293                    echo date( $date_format, $start_date );    //event start date ?>
    292294                </span>
    293295            </div>
  • simple-wp-events/trunk/public/includes/wp-events-registeration-form.php

    r2780675 r2882562  
    3838        $businessName               = isset( $form_options['form_businessName'] );
    3939        $hearAbout                  = isset( $form_options['form_hear_about'] );
     40        $req_addrees1               = isset( $form_options['req_form_address1'] );
     41        $req_addrees2               = isset( $form_options['req_form_address2'] );
     42        $req_city                   = isset( $form_options['req_form_city'] );
     43        $req_state                  = isset( $form_options['req_form_state'] );
     44        $req_zip                    = isset( $form_options['req_form_zip'] );
     45        $req_fax                    = isset( $form_options['req_form_fax'] );
     46        $req_phone                  = isset( $form_options['req_form_phone'] );
     47        $req_email                  = isset( $form_options['req_form_email'] );
     48        $req_businessName           = isset( $form_options['req_form_businessName'] );
    4049        $form_textin_permission     = isset( $form_options['reg_form_texting_permission'] ) ? $form_options['reg_form_texting_permission'] : 'I agree to receive texts at the number provided from [wpe_firm_name]. Frequency may vary and include information on appointments, events, and other marketing messages. Message/data rates may apply. To opt-out, text STOP at any time.';
    4150        $hide_texting_permission    = isset( $form_options['reg_enable_texting_permission'] );
     
    4352        <div class="wpe-main-form-holder">
    4453            <div class="wpe-register-form-container">
    45                 <form method="post" action="<?php echo esc_url( $_SERVER['REQUEST_URI'] ); ?>" class="wpe-register-form" id="wpe-register-form" autocomplete="off">
    46                 <div class="wpe-col-2 wpe-field">
    47                   <div class="wpe-form-control wpe-field-container wpe-left-half">
     54                <form method="post" action="<?php echo esc_url( $_SERVER['REQUEST_URI'] ); ?>" class="wpe-register-form" id="wpe-register-form" novalidate autocomplete="off">
     55                    <div class="wpe-col-full wpe-field">
     56                        <div class="wpe-above-error-field" id="wpe-error-div"><span class="wpe-error-exclamation">! </span><?php _e( 'There was some problem with your submission. Please review the fields below', 'simple-wp-events' ); ?></div>
     57                    </div>
     58                    <div class="wpe-col-2 wpe-field">
     59                        <div class="wpe-form-control wpe-field-container wpe-left-half">
    4860                        <?php if( $labels) { echo'<label for="wpe_first_name">' . __( 'First Name *', 'simple-wp-events' ) . '</label>';}?>
    49                         <input class="wpe-no-special wpe-field" type="text" name="wpe_first_name" id="wpe_first_name" <?php if( !$labels ) {?>placeholder="<?php _e( 'First Name *', 'simple-wp-events' ); ?>" <?php } ?> required>
    50                         <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
     61                        <input class="wpe-field" type="text" name="wpe_first_name" id="wpe_first_name" <?php if( !$labels ) {?>placeholder="<?php _e( 'First Name *', 'simple-wp-events' ); ?>" <?php } ?> required>
     62                        <small><?php _e( 'This field is required.', 'simple-wp-events' ); ?></small>
    5163                   </div>
    5264                   <div class="wpe-form-control wpe-field-container wpe-right-half">
    5365                        <?php if( $labels) { echo'<label for="wpe_last_name">' . __( 'Last Name *', 'simple-wp-events' ) . '</label>';}?>
    54                         <input class="wpe-no-special wpe-field" type="text" name="wpe_last_name" id="wpe_last_name" <?php if( !$labels ) {?>placeholder="<?php _e( 'Last Name *', 'simple-wp-events' ); ?>" <?php } ?>required>
    55                         <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
     66                        <input class="wpe-field" type="text" name="wpe_last_name" id="wpe_last_name" <?php if( !$labels ) {?>placeholder="<?php _e( 'Last Name *', 'simple-wp-events' ); ?>" <?php } ?>required>
     67                        <small><?php _e( 'This field is required.', 'simple-wp-events' ); ?></small>
    5668                   </div>
    5769                </div>
    5870                <div class="wpe-col-2 wpe-field">
    59                 <?php if ( ! $addrees1 ) { ?>
     71                <?php if ( ! $addrees1 ) {
     72                    $star = $req_addrees1 ? ' *' : '';
     73                    ?>
    6074                    <div class="wpe-form-control wpe-field-container wpe-left-half">
    61                         <?php if( $labels) { echo'<label for="wpe_address">' . __( 'Address *', 'simple-wp-events' ) . '</label>';}?>
    62                         <input class="wpe-no-special wpe-field" type="text" name="wpe_address" id="wpe_address" <?php if( !$labels ) {?>placeholder="<?php _e( 'Address *', 'simple-wp-events' ); ?>" <?php } ?>required>
    63                         <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
    64                     </div>
    65                     <?php }   if ( ! $addrees2 ) {?>
     75                        <?php if( $labels) { echo'<label for="wpe_address">' . __( 'Address', 'simple-wp-events' ) . $star .'</label>';}?>
     76                        <input class="wpe-field" type="text" name="wpe_address" id="wpe_address" <?php if( !$labels ) {?>placeholder="<?php _e( 'Address', 'simple-wp-events' ); echo $star; ?>" <?php } echo $req_addrees1 ? 'required' : ''; ?>>
     77                        <small><?php _e( 'This field is required.', 'simple-wp-events' ); ?></small>
     78                    </div>
     79                    <?php }   if ( ! $addrees2 ) {
     80                    $star = $req_addrees2 ? ' *' : '';
     81                    ?>
    6682                    <div class="wpe-form-control wpe-field-container wpe-right-half">
    67                         <?php if( $labels) { echo'<label for="wpe_address_2">' . __( 'Address 2', 'simple-wp-events' ) . '</label>';}?>
    68                         <input class="wpe-no-special wpe-field" type="text" name="wpe_address_2" id="wpe_address_2" <?php if( !$labels ) {?>placeholder="<?php _e( 'Address 2', 'simple-wp-events' ); ?>" <?php } ?>>
    69                         <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
     83                        <?php if( $labels) { echo'<label for="wpe_address_2">' . __( 'Address 2', 'simple-wp-events' ) . $star . '</label>';}?>
     84                        <input class="wpe-field" type="text" name="wpe_address_2" id="wpe_address_2" <?php if( !$labels ) {?>placeholder="<?php _e( 'Address 2', 'simple-wp-events' ); echo $star; ?>" <?php } echo $req_addrees2 ? 'required' : ''; ?>>
     85                        <small><?php _e( 'This field is required.', 'simple-wp-events' ); ?></small>
    7086                    </div>
    7187                    <?php  } ?>
    7288                </div>
    7389                <div class="wpe-col-3 wpe-field">
    74                 <?php if ( ! $city ) { ?>
     90                <?php if ( ! $city ) {
     91                    $star = $req_city ? ' *' : '';
     92                    ?>
    7593                    <div class="wpe-form-control wpe-field-container wpe-left-third">
    76                         <?php if( $labels) { echo'<label for="wpe_city">' . __( 'City *', 'simple-wp-events' ) . '</label>';}?>
    77                         <input class="wpe-no-special wpe-field" type="text" name="wpe_city" id="wpe_city" <?php if( !$labels ) {?>placeholder="<?php _e( 'City *', 'simple-wp-events' ); ?>" <?php } ?>required>
    78                         <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
    79                     </div>
    80                     <?php } if ( ! $state ) { ?>
     94                        <?php if( $labels) { echo'<label for="wpe_city">' . __( 'City *', 'simple-wp-events' ) . $star . '</label>';}?>
     95                        <input class="wpe-field" type="text" name="wpe_city" id="wpe_city" <?php if( !$labels ) {?>placeholder="<?php _e( 'City', 'simple-wp-events' ); echo $star; ?>" <?php } echo $req_city ? 'required' : ''; ?>>
     96                        <small><?php _e( 'This field is required.', 'simple-wp-events' ); ?></small>
     97                    </div>
     98                    <?php } if ( ! $state ) {
     99                    $star = $req_state ? ' *' : '';
     100                    ?>
    81101                    <div class="wpe-form-control wpe-field-container wpe-middle-third">
    82                         <?php if( $labels) { echo'<label for="wpe_state">' . __( 'State *', 'simple-wp-events' ) . '</label>';}?>
    83                         <input class="wpe-no-special wpe-field" type="text" name="wpe_state" id="wpe_state" <?php if( !$labels ) {?>placeholder="<?php _e( 'State *', 'simple-wp-events' ); ?>" <?php } ?>required>
    84                         <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
    85                     </div>
    86                     <?php } if ( ! $zip ) { ?>
     102                        <?php if( $labels) { echo'<label for="wpe_state">' . __( 'State *', 'simple-wp-events' ) . $star . '</label>';}?>
     103                        <input class="wpe-field" type="text" name="wpe_state" id="wpe_state" <?php if( !$labels ) {?>placeholder="<?php _e( 'State', 'simple-wp-events' ); echo $star; ?>" <?php } echo $req_state ? 'required' : ''; ?>>
     104                        <small><?php _e( 'This field is required.', 'simple-wp-events' ); ?></small>
     105                    </div>
     106                    <?php } if ( ! $zip ) {
     107                    $star = $req_zip ? ' *' : '';
     108                    ?>
    87109                    <div class="wpe-form-control wpe-field-container wpe-right-third">
    88                         <?php if( $labels) { echo'<label for="wpe_zip">' . __( 'Zip', 'simple-wp-events' ) . '</label>';}?>
    89                         <input class="wpe-field" type="number" minlength="5" name="wpe_zip" id="wpe_zip" <?php if( !$labels ) {?>placeholder="<?php _e( 'Zip *', 'simple-wp-events' ); ?>" <?php } ?>required>
    90                         <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
     110                        <?php if( $labels) { echo'<label for="wpe_zip">' . __( 'Zip', 'simple-wp-events' ) . $star . '</label>';}?>
     111                        <input class="wpe-field" type="number" name="wpe_zip" id="wpe_zip" <?php if( !$labels ) {?>placeholder="<?php _e( 'Zip', 'simple-wp-events' ); echo $star; ?>" <?php } echo $req_zip ? 'required' : ''; ?>>
     112                        <small><?php _e( 'This field is required.', 'simple-wp-events' ); ?></small>
    91113                    </div>
    92114                    <?php }?>
    93115                </div>
    94116                <div class="wpe-col-3 wpe-field">
     117                    <?php $star = $req_phone ? ' *' : ''; ?>
    95118                    <div class="wpe-form-control wpe-field-container wpe-left-third">
    96                         <?php if ( $labels) { echo'<label for="wpe_phone">' . __( 'Phone/Cell Phone', 'simple-wp-events' ) . '</label>';}?>
    97                         <input class="wpe-field" type="text" pattern="^(\([0-9]{3}\) |[0-9]{3}-)[0-9]{3}-[0-9]{4}$" title="(123) 111-1234" name="wpe_phone" id="wpe_phone" <?php if( !$labels ) {?>placeholder="<?php _e( 'Phone/Cell Phone: (XXX) XXX-XXXX', 'simple-wp-events' ); ?>" <?php } ?>required>
    98                         <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
    99                     </div>
     119                        <?php if ( $labels) { echo'<label for="wpe_phone">' . __( 'Phone/Cell Phone', 'simple-wp-events' ) . $star . '</label>';}?>
     120                        <input class="wpe-field" type="text" title="(123) 111-1234" name="wpe_phone" id="wpe_phone" <?php if( !$labels ) {?>placeholder="<?php _e( 'Phone/Cell Phone', 'simple-wp-events' ); echo $star; ?>" <?php } echo $req_phone ? 'required' : ''; ?>>
     121                        <small><?php _e( 'This field is required.', 'simple-wp-events' ); ?></small>
     122                        <span class="wpe-phone-error-class"><?php _e( 'Please enter phone in correct format - (123) 111-1234', 'simple-wp-events' ); ?></span>
     123                    </div>
     124                    <?php $star = $req_email ? ' *' : ''; ?>
    100125                    <div class="wpe-form-control wpe-field-container wpe-middle-third">
    101                         <?php if( $labels) { echo'<label for="wpe_email">' . __( 'Email *', 'simple-wp-events' ) . '</label>';}?>
    102                         <input class="wpe-field" type="email" name="wpe_email" id="wpe_email" <?php if( !$labels ) {?>placeholder="<?php __( 'Email *', 'simple-wp-events' ); ?>" <?php } ?> required>
    103                         <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
    104                     </div>
    105                     <?php if ( ! $fax ) { ?>
     126                        <?php if( $labels) { echo'<label for="wpe_email">' . __( 'Email', 'simple-wp-events' ) . $star . '</label>';}?>
     127                        <input class="wpe-field" type="email" name="wpe_email" id="wpe_email" <?php if( !$labels ) {?>placeholder="<?php _e( 'Email', 'simple-wp-events' ); echo $star; ?>" <?php } echo $req_email ? 'required' : ''; ?>>
     128                        <small><?php _e( 'This field is required.', 'simple-wp-events' ); ?></small>
     129                        <span class="wpe-email-error-class"><?php _e( 'Please enter a valid email address.', 'simple-wp-events' ); ?></span>
     130                    </div>
     131                    <?php if ( ! $fax ) {
     132                    $star = $req_fax ? ' *' : '';
     133                    ?>
    106134                    <div class="wpe-form-control wpe-field-container wpe-right-third">
    107                         <?php if( $labels) { echo'<label for="wpe_fax">' . __( 'Fax', 'simple-wp-events' ) . '</label>';}?>
    108                         <input class="wpe-field" type="number" name="wpe_fax" id="wpe_fax" <?php if( !$labels ) {?>placeholder="<?php __( 'Fax', 'simple-wp-events' ); ?>"<?php } ?>>
    109                         <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
     135                        <?php if( $labels) { echo'<label for="wpe_fax">' . __( 'Fax', 'simple-wp-events' ) . $star . '</label>';}?>
     136                        <input class="wpe-field" type="number" name="wpe_fax" id="wpe_fax" <?php if( !$labels ) {?>placeholder="<?php _e( 'Fax', 'simple-wp-events' ); echo $star; ?>"<?php } echo $req_fax ? 'required' : ''; ?>>
     137                        <small><?php _e( 'This field is required.', 'simple-wp-events' ); ?></small>
    110138                    </div>
    111139                    <?php } ?>
    112140                </div>
    113                 <?php if ( ! $businessName ) { ?>
    114                 <div class="wpe-col-full wpe-field">
    115                     <div class="wpe-form-control wpe-field-container wpe-full-width">
    116                         <?php if( $labels) { echo'<label for="wpe_business_name">' . __( 'Business Name', 'simple-wp-events' ) . '</label>';}?>
    117                         <input class="wpe-field" type="text" name="wpe_business_name" id="wpe_business_name" <?php if( !$labels ) {?>placeholder="<?php _e( 'Business Name', 'simple-wp-events' ); ?>" <?php } ?>>
    118                         <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
     141                <?php if ( ! $businessName ) {
     142                $star = $req_businessName ? ' *' : '';
     143                ?>
     144                <div class="wpe-col-full wpe-field">
     145                    <div class="wpe-form-control wpe-field-container wpe-full-width">
     146                        <?php if( $labels) { echo'<label for="wpe_business_name">' . __( 'Business Name', 'simple-wp-events' ) . $star . '</label>';}?>
     147                        <input class="wpe-field" type="text" name="wpe_business_name" id="wpe_business_name" <?php if( !$labels ) {?>placeholder="<?php _e( 'Business Name', 'simple-wp-events' ); echo $star; ?>" <?php } echo $req_businessName ? 'required' : ''; ?>>
     148                        <small><?php _e( 'This field is required.', 'simple-wp-events' ); ?></small>
    119149                    </div>
    120150                </div>
     
    132162                        <textarea class="wpe-field" name="wpe_settings[privacy_policy]" id="wpe_privacy_policy" readonly><?php
    133163                            echo trim( esc_html( $option['privacy_policy'] ) );  ?></textarea>
    134                         <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
     164                        <small><?php _e( 'This field is required.', 'simple-wp-events' ); ?></small>
    135165                    </div>
    136166                    <?php } ?>
     
    144174                        <input  type="checkbox" name="wpe_consent_box" id="wpe_consent_box" value="I have read &amp; consent to the above." required>
    145175                        <label for="wpe_consent_box"><?php echo esc_html( $consent_box ); ?></label>
    146                         <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
     176                        <small><?php _e( 'This field is required.', 'simple-wp-events' ); ?></small>
    147177                    </div>
    148178                    <div class="wpe-form-control wpe-field-container wpe-full-width">
    149179                        <input  type="checkbox" name="wpe_disclaimer_box" id="wpe_disclaimer_box" value="I have read &amp; understand your website Disclaimer." required>
    150180                        <label for="wpe_disclaimer_box"> <?php echo esc_html( $disclaimer_box ); ?></label>
    151                         <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
     181                        <small><?php _e( 'This field is required.', 'simple-wp-events' ); ?></small>
    152182                    </div>
    153183                    <?php
     
    157187                        <input  type="checkbox" name="wpe_texting_permission" id="wpe_texting_permission" value="1">
    158188                        <label for="wpe_texting_permission"><?php echo esc_html( do_shortcode( $form_textin_permission ) ); ?></label>
    159                         <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
     189                        <small><?php _e( 'This field is required.', 'simple-wp-events' ); ?></small>
    160190                    </div>
    161191                    <?php
     
    173203                        wpe_get_seats_dropdown();
    174204                        ?>
    175                         <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
     205                        <small><?php _e( 'This field is required.', 'simple-wp-events' ); ?></small>
    176206                    </div>
    177207                </div>
     
    180210                        <div class="wpe-form-control wpe-field-container wpe-left-half">
    181211                            <?php if( $labels) { echo'<label>' . __(  'Guest First Name*', 'simple-wp-events' ) . '</label>';}?>
    182                             <input class="wpe-no-special wpe-field wpe-guest-field" type="text" name="wpe_guest_first_name[]" <?php if( !$labels ) {?>placeholder="<?php _e( 'Guest First Name*', 'simple-wp-events' ); ?>" <?php } ?>>
     212                            <input class="wpe-field wpe-guest-field" type="text" name="wpe_guest_first_name[]" <?php if( !$labels ) {?>placeholder="<?php _e( 'Guest First Name*', 'simple-wp-events' ); ?>" <?php } ?>>
    183213                            <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
    184214                        </div>
    185215                        <div class="wpe-form-control wpe-field-container wpe-right-half">
    186216                            <?php if( $labels) { echo'<label>' . __(  'Guest Last name*', 'simple-wp-events' ) . '</label>';}?>
    187                             <input class="wpe-no-special wpe-field wpe-guest-field" type="text" name="wpe_guest_last_name[]" <?php if( !$labels ) {?>placeholder="<?php _e( 'Guest Last name*', 'simple-wp-events' ); ?>" <?php } ?>>
     217                            <input class="wpe-field wpe-guest-field" type="text" name="wpe_guest_last_name[]" <?php if( !$labels ) {?>placeholder="<?php _e( 'Guest Last name*', 'simple-wp-events' ); ?>" <?php } ?>>
    188218                            <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
    189219                        </div>
  • simple-wp-events/trunk/public/includes/wp-events-subscribe-form.php

    r2780675 r2882562  
    3131        $form_textin_permission     = isset( $form_options['subscriber_form_texting_permission'] ) ? sanitize_text_field( $form_options['subscriber_form_texting_permission'] ) : __( 'I agree to receive texts at the number provided from [wpe_firm_name]. Frequency may vary and include information on appointments, events, and other marketing messages. Message/data rates may apply. To opt-out, text STOP at any time.', 'simple-wp-events' );
    3232        $hide_phone_number          = isset( $form_options['subscriber_enable_phone_number'] );
     33        $req_phone                  = isset( $form_options['req_subform_phone'] );
     34        $req_email                  = isset( $form_options['req_subform_email'] );
    3335        $hide_texting_permission    = isset( $form_options['subscriber_enable_texting_permission'] );
    3436        ?>
    3537        <div class="wpe-form-holder">
    3638            <div class="wpe-subscribe-form-container">
    37                 <form method="post" action="<?php echo esc_url( admin_url('admin-post.php') ); ?>" class="wpe-subscribe-form" id="wpe-subscribe-form" autocomplete="off">
     39                <form method="post" action="<?php echo esc_url( admin_url('admin-post.php') ); ?>" novalidate class="wpe-subscribe-form" id="wpe-subscribe-form" autocomplete="off">
     40                    <div class="wpe-col-full wpe-field">
     41                        <div class="wpe-above-error-field">
     42                            <span class="wpe-error-exclamation">! </span><?php _e( 'There was some problem with your submission. Please review the fields below', 'simple-wp-events' ); ?>
     43                        </div>
     44                    </div>
    3845                    <?php wp_nonce_field('wp_events_subscribe_form','wpe_subscribe_form');
    3946                    if( $form_title != '' ) {
     
    5057                        <div class="wpe-form-control">
    5158                            <?php if( $labels ) { echo'<label for="wpe_username">' . __(  'First Name *', 'simple-wp-events' ) . '</label>';}?>
    52                             <input class="wpe-no-special" type="text" name="wpe_first_name" id="wpe_firstname" <?php if( !$labels ) {?>placeholder="<?php _e( 'First Name*', 'simple-wp-events' ); ?>"<?php }?> required>
    53                             <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
     59                            <input type="text" name="wpe_first_name" id="wpe_firstname" <?php if( !$labels ) {?>placeholder="<?php _e( 'First Name*', 'simple-wp-events' ); ?>"<?php }?> required>
     60                            <small><?php _e( 'This field is required', 'simple-wp-events' ); ?></small>
    5461                        </div>
    5562                        <div class="wpe-form-control">
    5663                            <?php if( $labels ) { echo'<label for="wpe_username">' . __(  'Last Name*', 'simple-wp-events' ) . '</label>';}?>
    57                             <input class="wpe-no-special" type="text" name="wpe_last_name" id="wpe_lastname" <?php if( !$labels ) {?>placeholder="<?php _e( 'Last Name*', 'simple-wp-events' ); ?>"<?php }?> required>
    58                             <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
     64                            <input type="text" name="wpe_last_name" id="wpe_lastname" <?php if( !$labels ) {?>placeholder="<?php _e( 'Last Name*', 'simple-wp-events' ); ?>"<?php }?> required>
     65                            <small><?php _e( 'This field is required', 'simple-wp-events' ); ?></small>
    5966                        </div>
    6067                    </div>
    6168                    <div class="wpe-col-2">
     69                        <?php $star = $req_email ? ' *' : ''; ?>
    6270                        <div class="wpe-form-control">
    63                             <?php if( $labels ) { echo'<label for="wpe_email">' . __(  'Email*', 'simple-wp-events' ) . '</label>';}?>
    64                             <input type="email" name="wpe_email" id="wpe_email" <?php if( !$labels ) {?>placeholder="<?php _e( 'Email*', 'simple-wp-events' ); ?>"<?php }?> required>
    65                             <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
     71                            <?php if( $labels ) { echo'<label for="wpe_email">' . __(  'Email', 'simple-wp-events' ) . $star .'</label>';}?>
     72                            <input type="email" name="wpe_email" id="wpe_email" <?php if( !$labels ) {?>placeholder="<?php _e( 'Email', 'simple-wp-events' ); echo $star; ?>"<?php } echo $req_email ? 'required' : ''; ?>>
     73                            <small><?php _e( 'This field is required', 'simple-wp-events' ); ?></small>
     74                            <span class="wpe-email-error-class"><?php _e( 'Please enter a valid email address.', 'simple-wp-events' ); ?></span>
    6675                        </div>
    6776                        <?php
    6877                        if( $hide_phone_number ) {
    6978                        ?>
     79                        <?php $star = $req_phone ? ' *' : ''; ?>
    7080                        <div class="wpe-form-control">
    71                             <?php if( $labels ) { echo'<label for="wpe_phone">' . __(  'Cell Phone Number*', 'simple-wp-events' ) . '</label>';}?>
    72                             <input type="text" title="(123) 111-1234" name="wpe_phone" id="wpe_phone" <?php if( !$labels ) {?>placeholder="<?php _e( 'Cell Phone Number', 'simple-wp-events' ); ?>"<?php }?>>
    73                             <small><?php _e( 'Error Message', 'simple-wp-events' ); ?></small>
     81                            <?php if( $labels ) { echo'<label for="wpe_phone">Cell Phone Number'. $star .'</label>';}?>
     82                            <input type="text" title="(123) 111-1234" name="wpe_phone" id="wpe_phone" <?php if( !$labels ) {?>placeholder="Cell Phone Number<?php echo $star; ?>"<?php } echo $req_phone ? 'required' : ''; ?>>
     83                            <small><?php _e( 'This field is required', 'simple-wp-events' ); ?></small>
     84                            <span class="wpe-phone-error-class"><?php _e( 'Please enter phone in correct format - (123) 111-1234', 'simple-wp-events' ); ?></span>
    7485                        </div>
    7586                        <?php } ?>
  • simple-wp-events/trunk/public/js/wp-events-public.js

    r2780675 r2882562  
    11jQuery(document).ready(function ($) {
    22    'use strict';
    3 
    4     $('.wpe-form-control .wpe-no-special').on( 'input', function() {
    5         var c = this.selectionStart,
    6             r = /[^a-z0-9 ]/gi,
    7             v = $(this).val();
    8         if( r.test( v ) ) {
    9           $( this ).val( v.replace( r, '' ) );
    10           c--;
    11         }
    12         this.setSelectionRange(c, c);
    13     });
    14 
    15     // $('input#wpe_phone').attr("onkeydown", "phoneNumberFormatter()");
     3   
     4    $("#wpe_phone").inputmask({"mask": "(999) 999-9999"});
    165
    176    /**
     
    6554
    6655    /**
    67      * Registration Form Validation
     56     * email validate function
    6857     * */
    69     //variables
    70     var siteKey   = wpe_ajaxobject.captchaSiteKey;
    71     var secretKey = wpe_ajaxobject.captchaSecretKey;
    72     const form    = $('form').hasClass('wpe-register-form') ? $('#wpe-register-form') : $('#wpe-subscribe-form');
    73 
    74     form.submit(function (e) {
    75         e.preventDefault();
    76         if( $('span.g-recaptcha').text() === 'Captcha not found.' ) {
    77             submitForm( form );
    78         } else {
    79             if( wpe_ajaxobject.captchaType === 'checkbox' && siteKey !== '' && secretKey !== '' ) {
    80                 if ( wpeValidRecaptcha() ) {
    81                     wpeVerifyCaptcha( form );
    82                 }
    83             } else
    84             if( wpe_ajaxobject.captchaType === 'invisible' && siteKey !== '' && secretKey !== '' ) {
    85                 grecaptcha.execute();
    86                 setTimeout( function() {
    87                     wpeVerifyCaptcha( form );
    88                 }, 1000);
    89             }
    90         }
    91     });
    92 
     58    function validateEmail( $email ) {
     59        var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
     60        return emailReg.test( $email );
     61    }
     62
     63    /**
     64     * email validate function
     65     * */
     66    function validatePhone( $phone ) {
     67        var phoneReg = /^(\([0-9]{3}\) |[0-9]{3}-)[0-9]{3}-[0-9]{4}$/;
     68        return phoneReg.test( $phone );
     69    }
     70
     71    if ( $('body').hasClass('single-wp_events') || $('form').hasClass('wpe-subscribe-form') ) {
     72        /**
     73         *Form Validation
     74        * */
     75        //variables
     76        var siteKey      = wpe_ajaxobject.captchaSiteKey;
     77        var secretKey    = wpe_ajaxobject.captchaSecretKey;
     78        var form         = '';
     79        var updatedClass = '';
     80        var allForms     = $("form");
     81        allForms.each( function() {
     82            var form      = $( this );
     83            var formClass = form.attr( 'class' );
     84            if( formClass === 'wpe-register-form' || formClass === 'wpe-subscribe-form' || formClass === 'wpe-waitlist-form' ) {
     85                updatedClass  = formClass; 
     86            }   
     87        });
     88        switch( updatedClass ) {
     89            case 'wpe-register-form':
     90                var form = $( '#wpe-register-form' );
     91                break;
     92            case'wpe-subscribe-form':
     93                var form = $( '#wpe-subscribe-form' );
     94                break;
     95            case'wpe-waitlist-form':
     96                var form = $( '#wpe-waitlist-form' );
     97                break;
     98        }
     99        var formInput = '';
     100        switch( updatedClass ) {
     101            case 'wpe-register-form':
     102                formInput = $( 'form#wpe-register-form :input' );
     103                break;
     104            case'wpe-subscribe-form':
     105                formInput = $( 'form#wpe-subscribe-form :input' );
     106                break;
     107            case'wpe-waitlist-form':
     108                formInput = $( 'form#wpe-waitlist-form :input' );
     109                break;
     110        }
     111           
     112        form.submit( function (e) {
     113            e.preventDefault();
     114           
     115            /**
     116             * check if any of the field is empty
     117             * */
     118            //variables
     119            var valueFalse = '';
     120            formInput.each( function() {
     121                var input = $( this ); //
     122                if ( input.prop( 'required' ) ) {
     123                    $( ".wpe-above-error-field" ).removeClass( 'error' );
     124                    input.parent().removeClass( 'error' );
     125                    $('.wpe-form-control small').css('display', 'none');
     126                    if ( ! input.val() || ( input.is( ':checkbox' ) && ! input.is( ":checked" ) ) ) {
     127                        input.parent().addClass( 'error' );
     128                        $('.wpe-form-control small').css('display', 'block');
     129                        valueFalse = 'dont Reload';
     130                    }
     131                }
     132                input.parent().removeClass( 'correct-email' );
     133                input.parent().removeClass( 'correct-phone' );
     134                if ( input.attr( "id" ) == 'wpe_email' && ! ( input.parent().hasClass( 'error' ) ) ) {
     135                    if ( ! validateEmail( input.val() ) ) {
     136                        input.parent().addClass( 'correct-email' );
     137                        $('.wpe-form-control small').css('display', 'block');
     138                        valueFalse = 'dont Reload';
     139                    }
     140                }
     141                if ( input.val() != '' && input.attr( "id" ) == 'wpe_phone' && ! ( input.parent().hasClass( 'error' ) ) ) {
     142                    if ( ! validatePhone( input.val() ) ) {
     143                        input.parent().addClass( 'correct-phone' );
     144                        $('.wpe-form-control small').css('display', 'block');
     145                        valueFalse = 'dont Reload';
     146                    }
     147                }
     148            });
     149
     150            /**
     151             * if any required field is empty stop the execution and show error
     152             * */
     153            if ( valueFalse == 'dont Reload' ) {
     154                $( ".wpe-above-error-field" ).addClass( 'error' );
     155                document.getElementById("wpe-error-div").scrollIntoView({ behavior: "smooth" });
     156                return false;
     157            }
     158            if( $( 'span.g-recaptcha' ).text() === 'Captcha not found.' ) {
     159                submitForm( form );
     160            } else {
     161                if( wpe_ajaxobject.captchaType === 'checkbox' && siteKey !== '' && secretKey !== '' ) {
     162                    if ( wpeValidRecaptcha() ) {
     163                        wpeVerifyCaptcha( form );
     164                    }
     165                } else if ( wpe_ajaxobject.captchaType === 'invisible' && siteKey !== '' && secretKey !== '' ) {
     166                    grecaptcha.execute();
     167                    setTimeout( function() {
     168                        wpeVerifyCaptcha( form );
     169                    }, 1000);
     170                }
     171            }
     172        });
     173    }
    93174    function submitForm( submittedForm ) {
    94175        // Serialize the data in the form
    95176        const serializedData = submittedForm.serializeJSON();
    96         const action         =  $('form').hasClass('wpe-register-form') ? 'wpe_registration_form' : 'wpe_subscribe_form';
    97         wpe_save_form_data(serializedData, action);
    98     }
    99 
     177        var action = "";
     178        switch( updatedClass ) {
     179            case 'wpe-register-form':
     180                var action = 'wpe_registration_form';
     181                break;
     182            case 'wpe-subscribe-form':
     183                var action = 'wpe_subscribe_form';
     184                break;
     185            case 'wpe-waitlist-form':
     186                var action = 'wpe_waitlist_form';
     187                break;
     188        }
     189        wpe_save_form_data( serializedData, action );
     190    }
     191   
    100192    /**
    101193     * ajax request for handling saving of form data
     
    117209            // pre-request callback function.
    118210            beforeSend: function () {
    119                 $('#wpe-button').attr('disabled', true);
    120                 $('.wpe-button-loader').fadeIn();
     211                $( '#wpe-button' ).attr( 'disabled', true);
     212                $( '.wpe-button-loader' ).fadeIn();
    121213            },
    122214
    123215            // function to be called if the request succeeds.
    124216            success: function (response) {
    125                 $('#wpe-button').attr('disabled', false);
     217                $( '#wpe-button' ).attr( 'disabled', false);
    126218                window.location.href = decodeURIComponent(response.url);
    127                 $('.wpe-button-loader').fadeOut();
     219                $( '.wpe-button-loader' ).fadeOut();
    128220            }
    129221        })
     
    132224    //on event single page
    133225    if ( $('body').hasClass('single-wp_events') || $('body').hasClass('post-type-archive-wp_events') ) {
     226        checkCookie();
    134227        if (window.location.href.includes('thankyou')) {
    135228            $('.thankyou-popup').css('display', 'block');
     
    234327    } );
    235328
     329    function setCookie( cname, cvalue, exdays ) {
     330        const d = new Date();
     331        d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
     332        let expires = "expires="+d.toUTCString();
     333        document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
     334    }
     335     
     336    function getCookie( cname ) {
     337        let name = cname + "=";
     338        let ca = document.cookie.split(';');
     339        for(let i = 0; i < ca.length; i++) {
     340            let c = ca[i];
     341            while (c.charAt(0) == ' ') {
     342            c = c.substring(1);
     343            }
     344            if (c.indexOf(name) == 0) {
     345            return c.substring(name.length, c.length);
     346            }
     347        }
     348        return "";
     349    }
     350     
     351    function checkCookie() {
     352        let timezone = getCookie("wpeTimezone");
     353        if ( timezone == "" ) {
     354            var timezone_offset_minutes = new Date().getTimezoneOffset();
     355            timezone = timezone_offset_minutes == 0 ? 0 : -timezone_offset_minutes;
     356            if ( timezone != "" && timezone != null ) {
     357                setCookie( "wpeTimezone", timezone, 1);
     358            }
     359        }
     360    }
     361     
     362
    236363});
    237364
     
    294421    }
    295422}
    296 
    297 
    298 function phoneNumberFormatter() {
    299     // grab the value of what the user is typing into the input
    300     const inputField = document.getElementById( 'wpe_phone' );
    301  
    302     // next, we're going to format this input with the `formatPhoneNumber` function, which we'll write next.
    303     const formattedInputValue = formatPhoneNumber( inputField.value );
    304  
    305     // Then we'll set the value of the inputField to the formattedValue we generated with the formatPhoneNumber
    306     inputField.value = formattedInputValue;
    307 }
    308  
    309 function formatPhoneNumber( value ) {
    310     // if input value is false eg if the user deletes the input, then just return
    311     if ( !value ) return value;
    312  
    313     // clean the input for any non-digit values.
    314     const phoneNumber = value.replace(/[^\d]/g, '');
    315  
    316     // phoneNumberLength is used to know when to apply our formatting for the phone number
    317     const phoneNumberLength = phoneNumber.length;
    318  
    319     // we need to return the value with no formatting if its less than four digits
    320     // this is to avoid weird behavior that occurs if you  format the area code too early
    321     if ( phoneNumberLength < 4 ) return phoneNumber;
    322  
    323     // if phoneNumberLength is greater than 4 and less the 7 we start to return
    324     // the formatted number
    325     if ( phoneNumberLength < 7 ) {
    326       return `(${phoneNumber.slice(0, 3)}) ${phoneNumber.slice(3)}`;
    327     }
    328  
    329     // finally, if the phoneNumberLength is greater then seven, we add the last
    330     // bit of formatting and return it.
    331     return `(${phoneNumber.slice(0, 3)}) ${phoneNumber.slice(
    332         3,
    333         6
    334         )}-${phoneNumber.slice(6, 9)}`;
    335 }
  • simple-wp-events/trunk/public/templates/single-wp_events.php

    r2780675 r2882562  
    4646                        $wpe_type        = get_post_meta( $post_id, 'wpevent-type', TRUE );
    4747                        $wpe_phone       = get_post_meta( $post_id, 'wpevent-phone', true );
     48                        date_default_timezone_set( wpe_get_user_timezone() );
     49                        $set_timezone    = new DateTimeZone( wpe_get_user_timezone() );
     50                        $start_tz_date   = new DateTime( date('Y-m-d H:i:s', get_post_meta( $post_id , 'wpevent-start-date-time', TRUE ) ), $set_timezone );
     51                        $end_tz_date     = new DateTime( date('Y-m-d H:i:s', get_post_meta( $post_id , 'wpevent-end-date-time', TRUE ) ), $set_timezone );
     52                        date_default_timezone_set( 'UTC' );
    4853                        ?>
    4954                        <?php
     
    141146                                        }
    142147                                        ?>
    143                                         <div class="ics-text" id="get-ics-text">BEGIN:VCALENDAR<?php echo "\n" ?>VERSION:2.0<?php echo "\n" ?>PRODID:-//WPMINDS//NONSGML v1.0//EN<?php echo "\n" ?>CALSCALE:GREGORIAN<?php echo "\n" ?>BEGIN:VEVENT<?php echo "\n" ?>VENUE:<?php echo esc_html( $wpe_venue ); ?><?php echo "\n" ?>DESCRIPTION:<?php echo strip_tags( get_the_excerpt()); ?><?php echo "\n" ?>ADDRESS:<?php echo esc_html( $wpe_addr ); ?><?php echo "\n" ?>DTSTART:<?php echo date('Ymd\THis', get_post_meta( $post_id , 'wpevent-start-date-time', TRUE )); ?><?php echo "\n" ?>DTEND:<?php echo date('Ymd\THis', get_post_meta( $post_id , 'wpevent-end-date-time', TRUE )); ?><?php echo "\n" ?>URL;VALUE=URI:<?php echo get_the_permalink( $post_id ); ?><?php echo "\n" ?>SUMMARY:<?php echo strip_tags( get_the_title()); ?><?php echo "\n" ?>LOCATION:<?php echo wp_kses( $venue_html, wpe_get_allowed_html() ); ?><?php echo "\n" ?>PHONE:<?php echo get_post_meta( $post_id, 'wpevent-phone', true ); ?><?php echo "\n" ?>DTSTAMP:<?php echo date('Ymd\THis'); ?><?php echo "\n" ?>UID:<?php echo uniqid(); ?><?php echo "\n" ?>END:VEVENT<?php echo "\n" ?>END:VCALENDAR</div>
     148                                        <div class="ics-text" id="get-ics-text">BEGIN:VCALENDAR<?php echo "\n" ?>VERSION:2.0<?php echo "\n" ?>PRODID:-//WPMINDS//NONSGML v1.0//EN<?php echo "\n" ?>CALSCALE:GREGORIAN<?php echo "\n" ?>BEGIN:VEVENT<?php echo "\n" ?>VENUE:<?php echo $wpe_venue; ?><?php echo "\n" ?>DESCRIPTION:<?php echo strip_tags( get_the_excerpt()); ?><?php echo "\n" ?>ADDRESS:<?php echo $wpe_addr; ?><?php echo "\n" ?>DTSTART:<?php echo $start_tz_date->format( 'Ymd\THis' ); ?><?php echo "\n" ?>DTEND:<?php echo $end_tz_date->format( 'Ymd\THis' ); ?><?php echo "\n" ?>URL;VALUE=URI:<?php echo get_the_permalink( $post_id ); ?><?php echo "\n" ?>SUMMARY:<?php echo strip_tags( get_the_title()); ?><?php echo "\n" ?>LOCATION:<?php echo $venue_html; ?><?php echo "\n" ?>PHONE:<?php echo get_post_meta( $post_id, 'wpevent-phone', true ); ?><?php echo "\n" ?>DTSTAMP:<?php echo date('Ymd\THis'); ?><?php echo "\n" ?>UID:<?php echo uniqid(); ?><?php echo "\n" ?>END:VEVENT<?php echo "\n" ?>END:VCALENDAR</div>
    144149                                        <div class="filename"><?php echo strip_tags( get_the_title()) .'.ics' ?></div>
    145150                                    </ul>
     
    171176                                if( empty( $post->post_password ) || !post_password_required() ){
    172177                                    // do some stuff
    173                                     do_action( 'wp_events_registration_form' );                          // Displays Events Registration Form
     178                                    do_action ( 'wp_events_registration_form' );                          // Displays Events Registration Form
     179                                    $text = __( 'ThankYou For Registering.', 'simple-wp-events' );
     180                                    wpe_get_thankyou_popup( $text );
    174181                                }
    175182                            }
    176                         } else {
    177                             wpe_get_closed_reg_text();
     183                        }
     184                        else {
     185                            $option = get_option( 'wpe_display_settings' );                         // Displays Text when Waitlisting Form is hide
     186                            $text   = $option['closed_reg'];
     187                            echo esc_html( $text );                         
    178188                        }
    179189                    endwhile;
     
    181191                ?>
    182192            </div>
    183             <?php
    184             $text = __( 'ThankYou For Registering.', 'simple-wp-events' );
    185             wpe_get_thankyou_popup( $text );
    186             ?>
    187193        </div>
    188194    </div>
  • simple-wp-events/trunk/wp-events.php

    r2807927 r2882562  
    1313 * Plugin URI:        https://simplewpevents.com/
    1414 * Description:       The only WordPress plugin to create, manage and update hassle free events
    15  * Version:           1.5.4
     15 * Version:           1.6.2
    1616 * Requires at least: 5.0
    1717 * Requires PHP:      7.0
     
    2020 * License:           GPL-2.0+
    2121 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
    22  * Text Domain:       wp-events
     22 * Text Domain:       simple-wp-events
    2323 */
    2424
     
    3131 * Currently plugin version.
    3232 */
    33 define( 'WP_EVENTS_VERSION', '1.5.4' );
     33define( 'WP_EVENTS_VERSION', '1.6.2' );
    3434
    3535/**
Note: See TracChangeset for help on using the changeset viewer.