Changeset 2605428
- Timestamp:
- 09/27/2021 09:18:03 AM (4 years ago)
- Location:
- jackmail-newsletters/trunk
- Files:
-
- 2 added
- 7 edited
-
html/template.php (modified) (3 diffs)
-
html/widget_back.php (modified) (5 diffs)
-
html/widget_front.php (modified) (5 diffs)
-
html/widget_front_script.php (added)
-
html/widget_front_script_double_optin.php (added)
-
jackmail-newsletters.php (modified) (1 diff)
-
js/widget.js (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
widget.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
jackmail-newsletters/trunk/html/template.php
r2161892 r2605428 7 7 <div class="jackmail_name"> 8 8 <span jackmail-content-editable ng-click="t.focus_template_name()" 9 when-enter="t.blur_template_name()" input-value="t.template.name"></span>9 when-enter="t.blur_template_name()" input-value="t.template.name"></span> 10 10 <span ng-hide="t.name_editing" ng-click="t.focus_template_name()" class="dashicons dashicons-edit"></span> 11 11 </div> 12 12 <div class="jackmail_header_buttons"> 13 13 <div jackmail-search></div> 14 <div class="jackmail_campaign_save" jackmail-dropdown-button15 button-value="<?php esc_attr_e( 'Save', 'jackmail-newsletters' ) ?>"16 titles-clicks-array="t.save_choice_select_title_template"17 titles-clicks-array-event="t.save_template_or_create_campaign( key )">18 </div>14 <div class="jackmail_campaign_save" jackmail-dropdown-button 15 button-value="<?php esc_attr_e( 'Save', 'jackmail-newsletters' ) ?>" 16 titles-clicks-array="t.save_choice_select_title_template" 17 titles-clicks-array-event="t.save_template_or_create_campaign( key )"> 18 </div> 19 19 </div> 20 20 </div> … … 29 29 type="button" value="<" title="<?php esc_attr_e( 'Go to templates list', 'jackmail-newsletters' ) ?>"/> 30 30 <input ng-click="t.reset_emailbuilder_content()" class="jackmail_white_button" 31 type="button" value="<?php esc_attr_e( 'Reset content', 'jackmail-newsletters' ) ?>"/>31 type="button" value="<?php esc_attr_e( 'Reset content', 'jackmail-newsletters' ) ?>"/> 32 32 </div> 33 33 </div> … … 42 42 <p> 43 43 <input ng-model="t.template.name" ng-enter="t.hide_name_popup()" ng-echap="t.hide_name_popup()" 44 class="jackmail_name_popup" type="text"/>44 class="jackmail_name_popup" type="text"/> 45 45 </p> 46 46 <p> 47 47 <span ng-click="t.hide_name_popup()" class="jackmail_confirm_icon dashicons dashicons-yes" 48 title="<?php esc_attr_e( 'OK', 'jackmail-newsletters' ) ?>">48 title="<?php esc_attr_e( 'OK', 'jackmail-newsletters' ) ?>"> 49 49 </span> 50 50 <span ng-click="t.hide_name_popup()" class="jackmail_confirm_icon dashicons dashicons-no-alt" 51 title="<?php esc_attr_e( 'Cancel', 'jackmail-newsletters' ) ?>">51 title="<?php esc_attr_e( 'Cancel', 'jackmail-newsletters' ) ?>"> 52 52 </span> 53 53 </p> -
jackmail-newsletters/trunk/html/widget_back.php
r2115987 r2605428 11 11 $lists_details = $params['lists_details']; 12 12 $js_lists_details = $params['js_lists_details']; 13 $id = $params['id'];14 13 $id_list = $params['id_list']; 15 14 $double_optin_scenario_link = $params['double_optin_scenario_link']; 16 15 $emailbuilder_installed = $params['emailbuilder_installed']; 16 $field_id = $this->get_field_id( '' ); 17 $fields_array = json_decode( $fields ); 17 18 ?> 18 <div id="jackmail_widget_content_<?php esc_attr_e( $id ) ?>">19 <div> 19 20 <p> 20 <label for="<?php echo $this->get_field_id( 'title' ) ?> _<?php esc_attr_e( $id ) ?>">21 <label for="<?php echo $this->get_field_id( 'title' ) ?>"> 21 22 <?php _e( 'Title:', 'jackmail-newsletters' ) ?> 22 23 </label> 23 <input autocomplete="off" id="<?php echo $this->get_field_id( 'title' ) ?>_<?php esc_attr_e( $id ) ?>" 24 class="widefat" name="<?php echo $this->get_field_name( 'title' ) ?>" 25 type="text" value="<?php esc_attr_e( $title ) ?>"/> 24 <input autocomplete="off" 25 id="<?php echo $this->get_field_id( 'title' ) ?>" 26 name="<?php echo $this->get_field_name( 'title' ) ?>" 27 class="widefat" 28 type="text" 29 value="<?php esc_attr_e( $title ) ?>"/> 26 30 </p> 27 31 <p> 28 <label for="jackmail_widget_list_<?php echo $id ?>"><?php _e( 'List:', 'jackmail-newsletters' ) ?></label> 29 <select autocomplete="off" class="widefat" id="jackmail_widget_list_<?php echo $id ?>" name="<?php echo $this->get_field_name( 'id_list' ) ?>" 30 onkeyup="jackmail_widget_select_list( '<?php esc_attr_e( $id ) ?>', false, '<?php esc_attr_e( $fields ) ?>', jackmail_lists_details )" 31 onchange="jackmail_widget_select_list( '<?php esc_attr_e( $id ) ?>', false, '<?php esc_attr_e( $fields ) ?>', jackmail_lists_details )"> 32 <label for="<?php echo $this->get_field_id( 'id_list' ) ?>"><?php _e( 'List:', 'jackmail-newsletters' ) ?></label> 33 <select autocomplete="off" 34 class="widefat" 35 id="<?php echo $this->get_field_id( 'id_list' ) ?>" 36 name="<?php echo $this->get_field_name( 'id_list' ) ?>" 37 onkeyup="jackmail_widget_select_list( '<?php esc_attr_e( $field_id ) ?>' )" 38 onchange="jackmail_widget_select_list( '<?php esc_attr_e( $field_id ) ?>' )"> 32 39 <option value=""><?php _e( 'Select a list', 'jackmail-newsletters' ) ?></option> 33 40 <?php 34 41 foreach ( $lists as $list ) { ?> 35 <option value="<?php esc_attr_e( $list->id ) ?>"><?php echo htmlentities( $list->name ) ?></option> 42 <option value="<?php esc_attr_e( $list->id ) ?>"<?php if ( $id_list === $list->id ) { ?> selected="selected"<?php } ?>> 43 <?php echo htmlentities( $list->name ) ?> 44 </option> 36 45 <?php } ?> 37 46 </select> 38 47 </p> 39 <p id="jackmail_widget_fields_<?php echo $id ?>_container"> 40 <input autocomplete="off" type="hidden" id="jackmail_widget_fields_<?php esc_attr_e( $id ) ?>" 41 name="<?php echo $this->get_field_name( 'fields' ) ?>"/> 48 <p id="<?php echo $this->get_field_id( 'fields_container' ) ?>"> 49 <input autocomplete="off" 50 type="hidden" 51 id="<?php echo $this->get_field_id( 'fields' ) ?>" 52 name="<?php echo $this->get_field_name( 'fields' ) ?>" 53 value="<?php esc_attr_e( $fields ) ?>"/> 42 54 <label><?php _e( 'Fields:', 'jackmail-newsletters' ) ?></label> 43 55 <br/> … … 45 57 foreach ( $lists_details as $list_detail ) { 46 58 ?> 47 <span id="jackmail_widget_field_<?php esc_attr_e( $list_detail['id'] ) ?>_<?php esc_attr_e( $id ) ?>_container"> 59 <span id="<?php echo $this->get_field_id( 'list_' . $list_detail['id'] . '_fields' ) ?>" 60 class="<?php echo $this->get_field_id( 'lists_fields' ) ?>" 61 style="display:<?php if ( $id_list === $list_detail['id'] ) { ?>block<?php } else { ?>none<?php } ?>"> 48 62 <?php 49 63 $all_fields = $list_detail['all_fields']; 50 64 foreach ( $all_fields as $key => $field ) { 51 $i d_html = $list_detail['id'] . '_' . ( $key + 1 ) . '_' . $id;65 $i = $key + 1; 52 66 ?> 53 <span id="jackmail_widget_field_<?php esc_attr_e( $id_html ) ?>_container"> 54 <input autocomplete="off" type="checkbox" id="jackmail_widget_field_<?php esc_attr_e( $id_html ) ?>_checkbox" 55 onchange="jackmail_widget_select_list_field( '<?php esc_attr_e( $id ) ?>', <?php echo( $key + 1 ) ?>, jackmail_lists_details )"/> 56 <label id="jackmail_widget_field_<?php esc_attr_e( $id_html ) ?>" for="jackmail_widget_field_<?php esc_attr_e( $id_html ) ?>_checkbox"> 67 <span> 68 <input autocomplete="off"<?php if ( $id_list === $list_detail['id'] && in_array( $i, $fields_array ) ) { ?> checked="checked"<?php } ?> 69 type="checkbox" 70 value="<?php esc_attr_e( $i ) ?>" 71 id="<?php echo $this->get_field_id( 'list_' . $list_detail['id'] . '_field_' . $i . '_checkbox' ) ?>" 72 class="<?php echo $this->get_field_id( 'list_' . $list_detail['id'] . '_field' ) ?> <?php echo $this->get_field_id( 'list_field' ) ?>" 73 onchange="jackmail_widget_select_list_field( '<?php esc_attr_e( $field_id ) ?>' )"/> 74 <label for="<?php echo $this->get_field_id( 'list_' . $list_detail['id'] . '_field_' . $i . '_checkbox' ) ?>"> 57 75 <?php echo htmlentities( ucfirst( mb_strtolower( $field ) ) ) ?> 58 76 </label> … … 63 81 <?php } ?> 64 82 </p> 65 < p>66 <?php if ( $emailbuilder_installed ) { ?>83 <?php if ( $emailbuilder_installed ) { ?> 84 <p id="<?php echo $this->get_field_id( 'jackmail_emailbuilder_installed' ) ?>"> 67 85 <span style="margin-bottom:5px;display:block"> 68 <input type="checkbox" autocomplete="off" 69 onclick="jackmail_widget_select_double_optin( '<?php esc_attr_e( $id ) ?>' )" 70 id="jackmail_double_optin_<?php esc_attr_e( $id ) ?>" 71 name="<?php echo $this->get_field_name( 'double_optin' ) ?>"/> 72 <label for="jackmail_double_optin_<?php esc_attr_e( $id ) ?>"> 86 <input autocomplete="off"<?php if ( $double_optin ) { ?> checked="checked"<?php } ?> 87 type="checkbox" 88 onclick="jackmail_widget_select_double_optin( '<?php esc_attr_e( $field_id ) ?>' )" 89 id="<?php echo $this->get_field_id( 'double_optin' ) ?>" 90 name="<?php echo $this->get_field_name( 'double_optin' ) ?>"/> 91 <label for="<?php echo $this->get_field_id( 'double_optin' ) ?>"> 73 92 <?php _e( 'Double optin', 'jackmail-newsletters' ) ?> 74 93 </label> 75 94 </span> 76 <span id="jackmail_double_optin_configuration_block_<?php esc_attr_e( $id ) ?>"> 95 <span id="<?php echo $this->get_field_id( 'double_optin_configuration' ) ?>" 96 style="display:<?php if ( $double_optin ) { ?>block<?php } else { ?>none<?php } ?>"> 77 97 <span style="margin-bottom:5px;display:block"> 78 98 <a href="<?php echo $double_optin_scenario_link ?>"> … … 81 101 </span> 82 102 <select style="margin-bottom:5px;display:block" 83 autocomplete="off" class="widefat" id="jackmail_widget_confirmation_type_<?php esc_attr_e( $id ) ?>" 84 name="<?php echo $this->get_field_name( 'double_optin_confirmation_type' ) ?>" 85 onkeyup="jackmail_widget_select_confirmation_type( '<?php esc_attr_e( $id ) ?>' )" 86 onchange="jackmail_widget_select_confirmation_type( '<?php esc_attr_e( $id ) ?>' )"> 87 <option value="default"><?php _e( 'Default confirmation message', 'jackmail-newsletters' ) ?></option> 88 <option value="url"><?php _e( 'Customized Url', 'jackmail-newsletters' ) ?></option> 103 autocomplete="off" 104 class="widefat" 105 id="<?php echo $this->get_field_id( 'double_optin_confirmation_type' ) ?>" 106 name="<?php echo $this->get_field_name( 'double_optin_confirmation_type' ) ?>" 107 onkeyup="jackmail_widget_select_confirmation_type( '<?php esc_attr_e( $field_id ) ?>' )" 108 onchange="jackmail_widget_select_confirmation_type( '<?php esc_attr_e( $field_id ) ?>' )"> 109 <option value="default"> 110 <?php _e( 'Default confirmation message', 'jackmail-newsletters' ) ?> 111 </option> 112 <option value="url"<?php if ( $double_optin_confirmation_type === 'url' ) { ?> selected="selected"<?php } ?>> 113 <?php _e( 'Customized Url', 'jackmail-newsletters' ) ?> 114 </option> 89 115 </select> 90 <input style="margin-bottom:5px;display:block" 91 autocomplete="off" id="jackmail_double_optin_confirmation_url_<?php esc_attr_e( $id ) ?>" 92 class="widefat" name="<?php echo $this->get_field_name( 'double_optin_confirmation_url' ) ?>" 93 placeholder="Url" 94 type="text" value="<?php esc_attr_e( $double_optin_confirmation_url ) ?>"/> 116 <input style="margin-bottom:5px;display:<?php if ( $double_optin_confirmation_type === 'url' ) { ?>block<?php } else { ?>none<?php } ?>" 117 autocomplete="off" 118 id="<?php echo $this->get_field_id( 'double_optin_confirmation_url' ) ?>" 119 name="<?php echo $this->get_field_name( 'double_optin_confirmation_url' ) ?>" 120 class="widefat" 121 placeholder="Url" 122 type="text" 123 value="<?php esc_attr_e( $double_optin_confirmation_url ) ?>"/> 95 124 </span> 96 <?php } else { ?> 125 </p> 126 <?php } else { ?> 127 <p> 97 128 <span><?php _e( 'Double optin:', 'jackmail-newsletters' ) ?></span> 98 129 <br/> … … 101 132 <a href="admin.php?page=jackmail_settings#/settings">"<?php _e( 'Settings', 'jackmail-newsletters' ) ?>"</a>. 102 133 </span> 103 <?php } ?>104 134 </p> 135 <?php } ?> 105 136 <p> 106 137 <span style="margin-bottom:5px;display:block"> 107 <input type="checkbox" autocomplete="off" 108 onclick="jackmail_widget_select_gdpr( '<?php esc_attr_e( $id ) ?>' )" 109 id="jackmail_gdpr_<?php esc_attr_e( $id ) ?>" 110 name="<?php echo $this->get_field_name( 'gdpr' ) ?>"/> 111 <label for="jackmail_gdpr_<?php esc_attr_e( $id ) ?>"> 138 <input autocomplete="off"<?php if ( $gdpr ) { ?> checked="checked"<?php } ?> 139 type="checkbox" 140 onclick="jackmail_widget_select_gdpr( '<?php esc_attr_e( $field_id ) ?>' )" 141 id="<?php echo $this->get_field_id( 'gdpr' ) ?>" 142 name="<?php echo $this->get_field_name( 'gdpr' ) ?>"/> 143 <label for="<?php echo $this->get_field_id( 'gdpr' ) ?>"> 112 144 <?php _e( 'GDPR mention', 'jackmail-newsletters' ) ?> 113 145 </label> 114 146 </span> 115 <textarea id="jackmail_gdpr_configuration_block_<?php esc_attr_e( $id ) ?>" 116 name="<?php echo $this->get_field_name( 'gdpr_content' ) ?>" 117 style="width:100%;"><?php echo htmlentities( $gdpr_content ) ?></textarea> 147 <textarea id="<?php echo $this->get_field_id( 'gdpr_content' ) ?>" 148 name="<?php echo $this->get_field_name( 'gdpr_content' ) ?>" 149 style="width:100%;display:<?php if ( $gdpr ) { ?>block<?php } else { ?>none<?php } ?>" 150 ><?php echo htmlentities( $gdpr_content ) ?></textarea> 118 151 </p> 119 <script>120 var jackmail_lists_details = <?php echo $js_lists_details ?>;121 jackmail_widget_set_data(122 '<?php esc_attr_e( $id ) ?>',123 '<?php esc_attr_e( $fields ) ?>',124 '<?php esc_attr_e( $id_list ) ?>',125 jackmail_lists_details,126 '<?php esc_attr_e( $double_optin ) ?>',127 '<?php esc_attr_e( $double_optin_confirmation_type ) ?>',128 '<?php esc_attr_e( $gdpr ) ?>'129 );130 </script>131 152 </div> 132 153 <?php } ?> -
jackmail-newsletters/trunk/html/widget_front.php
r1878945 r2605428 9 9 $after_widget = $params['after_widget']; 10 10 $fields = $params['fields']; 11 $id = $params['id'];12 11 $list_fields = $params['list_fields']; 13 12 $double_optin = $params['double_optin']; … … 19 18 $confirm_email = $params['confirm_data']['email']; 20 19 $confirm_fields = $params['confirm_data']['fields']; 20 $field_id = $this->get_field_id( '' ); 21 $nonce_submit = wp_create_nonce( $action_submit . get_option( 'jackmail_front_nonce' ) ); 22 $nonce_confirm = wp_create_nonce( $action_confirm . get_option( 'jackmail_front_nonce' ) ); 23 $display_gdpr = ( $gdpr === '1' && $gdpr_content !== '' ); 24 $display_double_optin_confirm = ( $confirm_id_list !== '' && $confirm_email !== '' && $confirm_fields !== '' ); 21 25 echo $before_widget; 22 26 echo $title; 23 27 ?> 24 <p id=" jackmail_widget_confirmation_<?php esc_attr_e( $id) ?>"></p>28 <p id="<?php echo $this->get_field_id( 'confirmation' ) ?>"></p> 25 29 <p> 26 <label for="jackmail_widget_email_<?php esc_attr_e( $id ) ?>"><?php _e( 'Email', 'jackmail-newsletters' ) ?></label> 27 <input id="jackmail_widget_email_<?php esc_attr_e( $id ) ?>" name="jackmail_widget_email" type="text" autocomplete="off"/> 30 <label for="<?php echo $this->get_field_id( 'email' ) ?>"> 31 <?php _e( 'Email', 'jackmail-newsletters' ) ?> 32 </label> 33 <input id="<?php echo $this->get_field_id( 'email' ) ?>" 34 name="<?php echo $this->get_field_name( 'email' ) ?>" 35 type="text" 36 autocomplete="off"/> 28 37 </p> 29 38 <?php … … 33 42 ?> 34 43 <p> 35 <label for=" jackmail_widget_field<?php echo $i ?>_<?php esc_attr_e( $id )?>">44 <label for="<?php echo $this->get_field_id( 'field' ) . $i ?>"> 36 45 <?php echo htmlentities( ucfirst( mb_strtolower( $field ) ) ) ?> 37 46 </label> 38 <input id="jackmail_widget_field<?php echo $i ?>_<?php esc_attr_e( $id ) ?>" 39 name="jackmail_widget_field<?php echo $i ?>" 40 type="text" autocomplete="off"/> 47 <input id="<?php echo $this->get_field_id( 'name_field' ) . $i ?>>" 48 class="<?php echo $this->get_field_id( 'name_field' ) ?>" 49 type="hidden" 50 value="<?php esc_attr_e( $field ) ?>"/> 51 <input id="<?php echo $this->get_field_id( 'field' ) . $i ?>" 52 class="<?php echo $this->get_field_id( 'field' ) ?>" 53 name="<?php echo $this->get_field_name( 'field' ) . $i ?>" 54 type="text" 55 autocomplete="off"/> 41 56 </p> 42 57 <?php … … 45 60 ?> 46 61 <?php 47 if ( $ gdpr === '1' && $gdpr_content !== '') {62 if ( $display_gdpr ) { 48 63 ?> 49 64 <p><?php echo $gdpr_content ?></p> … … 52 67 ?> 53 68 <p> 54 <input id="jackmail_widget_submit_<?php esc_attr_e( $id ) ?>" 55 onclick="submit_jackmail_widget_form_<?php esc_attr_e( $id ) ?>()" 56 type="button" value="<?php esc_attr_e( 'OK', 'jackmail-newsletters' ) ?>"/> 69 <input id="<?php echo $this->get_field_id( 'submit' ) ?>" 70 onclick=" 71 event.preventDefault(); 72 submit_jackmail_widget_form( 73 '<?php esc_attr_e( $field_id ) ?>', 74 '<?php esc_attr_e( $url ) ?>', 75 '<?php esc_attr_e( $action_submit ) ?>', 76 '<?php esc_attr_e( $nonce_submit ) ?>', 77 '<?php esc_attr_e( $widget_id ) ?>' 78 )" 79 type="submit" 80 value="<?php esc_attr_e( 'OK', 'jackmail-newsletters' ) ?>" 81 /> 57 82 </p> 58 <div id="jackmail_widget_container_form_<?php esc_attr_e( $id ) ?>"></div> 59 <script type="text/javascript"> 60 function submit_jackmail_widget_form_<?php esc_attr_e( $id ) ?>() { 61 var fields = []; 62 <?php 63 foreach ( $list_fields as $key => $field ) { 64 $i = $key + 1; 65 if ( in_array( $i, $fields ) ) { 66 ?> 67 fields.push( { 68 'field': '<?php esc_attr_e( $field ) ?>', 69 'value': document.getElementById( 'jackmail_widget_field<?php echo $i ?>_<?php esc_attr_e( $id ) ?>' ).value 70 } ); 71 <?php 72 } 73 } 74 ?> 75 var data = { 76 action: '<?php esc_attr_e( $action_submit ) ?>', 77 nonce: '<?php esc_attr_e( wp_create_nonce( $action_submit . get_option( 'jackmail_front_nonce' ) ) ) ?>', 78 jackmail_widget_id: '<?php esc_attr_e( $widget_id ) ?>', 79 jackmail_widget_email: document.getElementById( 'jackmail_widget_email_<?php esc_attr_e( $id ) ?>' ).value, 80 jackmail_widget_fields: JSON.stringify( fields ) 81 }; 82 document.getElementById( 'jackmail_widget_submit_<?php esc_attr_e( $id ) ?>' ).disabled = true; 83 query_jackmail_widget_form_<?php esc_attr_e( $id ) ?>( 84 '<?php esc_attr_e( $url ) ?>', 85 data, 86 function( data ) { 87 data = JSON.parse( data ); 88 document.getElementById( 'jackmail_widget_email_<?php esc_attr_e( $id ) ?>' ).value = ''; 89 <?php 90 foreach ( $list_fields as $key => $field ) { 91 $i = $key + 1; 92 if ( in_array( $i, $fields ) ) { 93 ?> 94 document.getElementById( 'jackmail_widget_field<?php echo $i ?>_<?php esc_attr_e( $id ) ?>' ).value = ''; 95 <?php 96 } 97 } 98 ?> 99 document.getElementById( 'jackmail_widget_confirmation_<?php esc_attr_e( $id ) ?>' ).innerHTML = data.message; 100 alert( data.message ); 101 document.getElementById( 'jackmail_widget_submit_<?php esc_attr_e( $id ) ?>' ).disabled = false; 102 } 103 ); 104 } 105 function query_jackmail_widget_form_<?php esc_attr_e( $id ) ?>( url, data, success ) { 106 var params = Object.keys( data ).map( 107 function( k ) { 108 return encodeURIComponent( k ) + '=' + encodeURIComponent( data[ k ] ); 109 } 110 ).join( '&' ); 111 var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject( 'Microsoft.XMLHTTP' ); 112 xhr.open( 'POST', url ); 113 xhr.onreadystatechange = function() { 114 if ( xhr.readyState > 3 && xhr.status === 200 ) { 115 success( xhr.responseText ); 116 } 117 }; 118 xhr.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' ); 119 xhr.send( params ); 120 return xhr; 121 } 122 <?php if ( $confirm_id_list !== '' && $confirm_email !== '' && $confirm_fields !== '' ) { ?> 123 function confirm_jackmail_widget_form_<?php esc_attr_e( $id ) ?>() { 124 var jackmail_widget_fields = <?php echo $confirm_fields ?>; 125 var data = { 126 action: '<?php esc_attr_e( $action_confirm ) ?>', 127 nonce: '<?php esc_attr_e( wp_create_nonce( $action_confirm . get_option( 'jackmail_front_nonce' ) ) ) ?>', 128 jackmail_widget_id_list: '<?php esc_attr_e( $confirm_id_list ) ?>', 129 jackmail_widget_email: '<?php esc_attr_e( $confirm_email ) ?>', 130 jackmail_widget_fields: JSON.stringify( jackmail_widget_fields ) 131 }; 132 query_jackmail_widget_form_<?php esc_attr_e( $id ) ?>( 133 '<?php esc_attr_e( $url ) ?>', 134 data, 135 function( data ) { 136 data = JSON.parse( data ); 137 document.getElementById( 'jackmail_widget_confirmation_<?php esc_attr_e( $id ) ?>' ).innerHTML = data.message; 138 <?php if ( $double_optin_confirmation_type === 'url' && $double_optin_confirmation_url !== '' ) { ?> 139 if ( data.success === false ) { 140 alert( data.message ); 141 } else { 142 window.location.href = '<?php esc_attr_e( $double_optin_confirmation_url ) ?>'; 143 } 144 <?php } else { ?> 145 alert( data.message ); 146 <?php } ?> 147 } 148 ); 149 } 150 setTimeout( function() { 151 confirm_jackmail_widget_form_<?php esc_attr_e( $id ) ?>(); 152 } ); 153 <?php } ?> 154 </script> 83 <?php if ( $display_double_optin_confirm ) { ?> 84 <span id="jackmail_widget_double_optin_confirm_values"> 85 <input id="jackmail_widget_double_optin_confirm_id" 86 type="hidden" 87 value="<?php esc_attr_e( $field_id ) ?>"/> 88 <input id="jackmail_widget_double_optin_confirm_fields" 89 type="hidden" 90 value="<?php esc_attr_e( $confirm_fields ) ?>"/> 91 <input id="jackmail_widget_double_optin_confirm_action_confirm" 92 type="hidden" 93 value="<?php esc_attr_e( $action_confirm ) ?>"/> 94 <input id="jackmail_widget_double_optin_confirm_nonce" 95 type="hidden" 96 value="<?php esc_attr_e( $nonce_confirm ) ?>"/> 97 <input id="jackmail_widget_double_optin_confirm_id_list" 98 type="hidden" 99 value="<?php esc_attr_e( $confirm_id_list ) ?>"/> 100 <input id="jackmail_widget_double_optin_confirm_email" 101 type="hidden" 102 value="<?php esc_attr_e( $confirm_email ) ?>"/> 103 <input id="jackmail_widget_double_optin_confirm_url" 104 type="hidden" 105 value="<?php esc_attr_e( $url ) ?>"/> 106 <input id="jackmail_widget_double_optin_confirm_confirmation_type" 107 type="hidden" 108 value="<?php esc_attr_e( $double_optin_confirmation_type ) ?>"/> 109 <input id="jackmail_widget_double_optin_confirm_confirmation_url" 110 type="hidden" 111 value="<?php esc_attr_e( $double_optin_confirmation_url ) ?>"/> 112 </span> 113 <?php } ?> 155 114 <?php 156 115 echo $after_widget; -
jackmail-newsletters/trunk/jackmail-newsletters.php
r2577695 r2605428 4 4 Plugin URI: https://www.jackmail.com 5 5 Description: Create and send responsive newsletter with a professional routing platform and a lot of features: automated emails and newsletters, statistics, email & Live Support etc. 6 Version: 1.2.1 86 Version: 1.2.19 7 7 Author: Jackmail & Sarbacane 8 8 Author URI: https://www.jackmail.com -
jackmail-newsletters/trunk/js/widget.js
r1874492 r2605428 1 1 'use strict'; 2 2 3 function jackmail_widget_set_data( id, default_fields, id_list, lists, double_optin, double_optin_confirmation_type, gdpr ) { 4 var content = document.getElementById( 'jackmail_widget_content_' + id ).innerHTML; 5 var random = new Date().getTime() + '' + Math.floor( ( Math.random() * 9999999 ) + 1000000 ); 6 content = content.replace( new RegExp( id, 'g' ), random ); 7 content = content.replace( 'var jackmail_lists_details', '// var jackmail_lists_details' ); 8 document.getElementById( 'jackmail_widget_content_' + id ).innerHTML = content; 9 document.getElementById( 'jackmail_widget_content_' + id ).setAttribute( 'id', 'jackmail_widget_content_' + random ); 10 id = random; 11 document.getElementById( 'jackmail_widget_list_' + id ).value = id_list; 12 jackmail_widget_select_list( id, default_fields, id_list, lists ); 13 if ( double_optin === '1' ) { 14 document.getElementById( 'jackmail_double_optin_' + id ).checked = true; 15 document.getElementById( 'jackmail_widget_confirmation_type_' + id ).value = double_optin_confirmation_type; 3 function jackmail_widget_get_id_list_selected( id ) { 4 return document.getElementById( id + 'id_list' ).options[ document.getElementById( id + 'id_list' ).selectedIndex ].value; 5 } 6 7 function jackmail_widget_select_list( id ) { 8 var id_list_selected = jackmail_widget_get_id_list_selected( id ); 9 var new_selected_fields = []; 10 var i; 11 12 var lists_fields = document.getElementsByClassName( id + 'lists_fields' ); 13 var nb_lists_fields = lists_fields.length; 14 for ( i = 0 ; i < nb_lists_fields ; i++ ) { 15 lists_fields[ i ].style.display = 'none'; 16 } 17 18 var all_fields = document.getElementsByClassName( id + 'list_field' ); 19 var nb_fields = all_fields.length; 20 for ( i = 0 ; i < nb_fields ; i++ ) { 21 all_fields[ i ].checked = false; 22 } 23 24 if ( id_list_selected > 0 ) { 25 var all_lists_fields = document.getElementsByClassName( id + 'list_' + id_list_selected + '_field' ); 26 var nb_all_lists_fields = all_lists_fields.length; 27 for ( i = 0; i < nb_all_lists_fields; i++ ) { 28 all_lists_fields[ i ].checked = true; 29 new_selected_fields.push( parseInt( all_lists_fields [ i ].value ) ); 30 } 31 document.getElementById( id + 'list_' + id_list_selected + '_fields' ).style.display = 'block'; 32 document.getElementById( id + 'fields_container' ).style.display = 'block'; 16 33 } else { 17 document.getElementById( 'jackmail_double_optin_configuration_block_' + id).style.display = 'none';34 document.getElementById( id + 'fields_container' ).style.display = 'none'; 18 35 } 19 jackmail_widget_select_confirmation_type( id ); 20 if ( gdpr === '1' ) { 21 document.getElementById( 'jackmail_gdpr_' + id ).checked = true; 22 } else { 23 document.getElementById( 'jackmail_gdpr_configuration_block_' + id ).style.display = 'none'; 36 37 new_selected_fields.sort(); 38 document.getElementById( id + 'fields' ).value = JSON.stringify( new_selected_fields ); 39 } 40 41 function jackmail_widget_select_list_field( id ) { 42 var id_list_selected = jackmail_widget_get_id_list_selected( id ); 43 var new_selected_fields = []; 44 var i; 45 46 var all_lists_fields = document.getElementsByClassName( id + 'list_' + id_list_selected + '_field' ); 47 var nb_all_lists_fields = all_lists_fields.length; 48 for ( i = 0; i < nb_all_lists_fields; i++ ) { 49 if ( all_lists_fields[ i ].checked === true ) { 50 new_selected_fields.push( parseInt( all_lists_fields[ i ].value ) ); 51 } 52 } 53 new_selected_fields.sort(); 54 document.getElementById( id + 'fields' ).value = JSON.stringify( new_selected_fields ); 55 } 56 57 function jackmail_widget_select_confirmation_type( id ) { 58 if ( jackmail_emailbuilder_installed( id ) ) { 59 var style_display = 'none'; 60 if ( document.getElementById( id + 'double_optin_confirmation_type' ).value === 'url' ) { 61 style_display = 'block'; 62 } 63 document.getElementById( id + 'double_optin_confirmation_url' ).style.display = style_display; 24 64 } 25 65 } 26 66 27 function jackmail_widget_select_list( id, default_fields, id_list, lists ) { 28 var i; 29 var nb_lists = lists.length; 30 var default_fields_array = JSON.parse( default_fields ); 31 var selected_id = document.getElementById( 'jackmail_widget_list_' + id ).value; 32 var current_fields = document.getElementById( 'jackmail_widget_fields_' + id ).value; 33 var fields = []; 34 for ( i = 0; i < nb_lists; i++ ) { 35 var list_id = lists[ i ].id; 36 var all_fields = lists[ i ].all_fields; 37 document.getElementById( 'jackmail_widget_field_' + list_id + '_' + id + '_container' ).style.display = 'none'; 38 var j; 39 var nb_fields = all_fields.length; 40 for ( j = 0; j < nb_fields; j++ ) { 41 var html_id = list_id + '_' + ( j + 1 ) + '_' + id; 42 var checked = false; 43 if ( ( list_id !== id_list ) || ( list_id === id_list && default_fields_array.indexOf( j + 1 ) !== -1 ) ) { 44 checked = true; 45 if ( list_id === selected_id ) { 46 fields.push( j + 1 ); 47 } 48 } 49 document.getElementById( 'jackmail_widget_field_' + html_id + '_checkbox' ).checked = checked; 67 function jackmail_widget_select_double_optin( id ) { 68 if ( jackmail_emailbuilder_installed( id ) ) { 69 var style_display = 'none'; 70 if ( document.getElementById( id + 'double_optin_configuration' ).style.display === 'none') { 71 style_display = 'block'; 50 72 } 73 document.getElementById( id + 'double_optin_configuration' ).style.display = style_display; 51 74 } 52 fields = JSON.stringify( fields );53 if ( fields !== current_fields ) {54 document.getElementById( 'jackmail_widget_fields_' + id ).value = fields;55 }56 if ( selected_id > 0 ) {57 var value = document.getElementById( 'jackmail_widget_field_' + selected_id + '_' + id + '_container' ).innerHTML;58 var display = 'block';59 if ( value.replace( /^\s+/g, '' ).replace( /\s+$/g, '' ) === '' ) {60 display = 'none';61 }62 document.getElementById( 'jackmail_widget_field_' + selected_id + '_' + id + '_container' ).style.display = display;63 document.getElementById( 'jackmail_widget_fields_' + id + '_container' ).style.display = display;64 }65 else {66 document.getElementById( 'jackmail_widget_fields_' + id + '_container' ).style.display = 'none';67 }68 }69 70 function jackmail_widget_select_list_field( id, field_id ) {71 var selected_fields = document.getElementById( 'jackmail_widget_fields_' + id ).value;72 if ( selected_fields !== '' ) {73 selected_fields = JSON.parse( selected_fields );74 }75 else {76 selected_fields = [];77 }78 var i;79 var nb_selected_fields = selected_fields.length;80 var new_selected_fields = [];81 var add_field = true;82 for ( i = 0; i < nb_selected_fields; i++ ) {83 if ( selected_fields[ i ] < field_id || selected_fields[ i ] > field_id ) {84 new_selected_fields.push( selected_fields[ i ] );85 }86 else {87 add_field = false;88 }89 }90 if ( add_field ) {91 new_selected_fields.push( field_id );92 new_selected_fields.sort();93 }94 document.getElementById( 'jackmail_widget_fields_' + id ).value = JSON.stringify( new_selected_fields );95 }96 97 function jackmail_widget_select_confirmation_type( id ) {98 var style_display = 'none';99 if ( document.getElementById( 'jackmail_widget_confirmation_type_' + id ).value === 'url' ) {100 style_display = 'block';101 }102 document.getElementById( 'jackmail_double_optin_confirmation_url_' + id ).style.display = style_display;103 }104 105 function jackmail_widget_select_double_optin( id ) {106 var style_display = 'none';107 if ( document.getElementById( 'jackmail_double_optin_configuration_block_' + id ).style.display === 'none' ) {108 style_display = 'block';109 }110 document.getElementById( 'jackmail_double_optin_configuration_block_' + id ).style.display = style_display;111 75 } 112 76 113 77 function jackmail_widget_select_gdpr( id ) { 114 78 var style_display = 'none'; 115 if ( document.getElementById( 'jackmail_gdpr_configuration_block_' + id).style.display === 'none' ) {79 if ( document.getElementById( id + 'gdpr_content' ).style.display === 'none' ) { 116 80 style_display = 'block'; 117 81 } 118 document.getElementById( 'jackmail_gdpr_configuration_block_' + id).style.display = style_display;82 document.getElementById( id + 'gdpr_content' ).style.display = style_display; 119 83 } 84 85 function jackmail_emailbuilder_installed( id ) { 86 if ( document.getElementById( id + 'jackmail_emailbuilder_installed' ) ) { 87 return true; 88 } 89 return false; 90 } -
jackmail-newsletters/trunk/readme.txt
r2577695 r2605428 5 5 Tested up to: 5.8 6 6 Requires PHP : 5.4 7 Stable tag: 1.2.1 87 Stable tag: 1.2.19 8 8 License: GPLv2 9 9 … … 166 166 == Changelog == 167 167 168 = 1.2.19 = 169 * Widget compatibility for WordPress 5.8 170 168 171 = 1.2.18 = 169 172 * Refused by moderation information -
jackmail-newsletters/trunk/widget.php
r2094328 r2605428 41 41 $lists = $this->get_lists(); 42 42 $lists_details = array(); 43 foreach ( $lists as $ key => $list ) {43 foreach ( $lists as $list ) { 44 44 $fields_explode = $core->explode_fields( $list->fields ); 45 45 $lists_details[] = array( … … 49 49 } 50 50 $params_configuration = $this->get_configuration( $instance ); 51 $double_optin_scenario_link = ''; 52 $double_optin_scenario_id = $core->get_widget_double_optin_scenario(); 53 if ( $double_optin_scenario_id !== false ) { 54 $double_optin_scenario_link = 'admin.php?page=jackmail_scenario#/scenario/widget_double_optin/' . $double_optin_scenario_id . '/create'; 55 } 51 56 $params = array( 52 57 'lists' => $lists, 53 58 'lists_details' => $lists_details, 54 59 'js_lists_details' => $this->get_json_js( $lists_details ), 55 'id' => $core->get_current_timestamp_gmt() . mt_rand( 1000000, 9999999 ), 56 'double_optin_scenario_link' => 'admin.php?page=jackmail_scenario#/scenario/widget_double_optin/' . $core->get_widget_double_optin_scenario() . '/create', 60 'double_optin_scenario_link' => $double_optin_scenario_link, 57 61 'emailbuilder_installed' => $core->emailbuilder_installed() 58 62 ); … … 65 69 $update['id_list'] = isset( $instance['id_list'] ) ? $instance['id_list'] : ''; 66 70 $update['title'] = isset( $instance['title'] ) ? $instance['title'] : ''; 67 $update['fields'] = isset( $instance['fields'] ) ? $instance['fields'] : '[]';71 $update['fields'] = isset( $instance['fields'] ) && $instance['fields'] !== '' ? $instance['fields'] : '[]'; 68 72 return $update; 69 73 } … … 93 97 'id_list' => isset( $instance['id_list'] ) ? $instance['id_list'] : '', 94 98 'title' => isset( $instance['title'] ) ? $instance['title'] : '', 95 'fields' => isset( $instance['fields'] ) ? $instance['fields'] : '[]',99 'fields' => isset( $instance['fields'] ) && $instance['fields'] !== '' ? $instance['fields'] : '[]', 96 100 'double_optin' => $double_optin, 97 101 'double_optin_confirmation_type' => $double_optin_confirmation_type, … … 118 122 if ( isset( $instance['id_list'], $instance['title'], $instance['fields'], 119 123 $instance['double_optin'], $instance['double_optin_confirmation_type'], $instance['double_optin_confirmation_url'] ) ) { 124 if ( ! isset( $args['widget_id'] ) ) { 125 $args['widget_id'] = 'jackmail_widget-0'; 126 } 120 127 if ( isset( $args['before_widget'], $args['before_title'], $args['after_title'], $args['after_widget'], $args['widget_id'] ) ) { 121 128 $id_list = $instance['id_list']; … … 164 171 'gdpr' => $instance['gdpr'], 165 172 'gdpr_content' => strip_tags( $instance['gdpr_content'], '<b><a>' ), 166 'id' => $core->get_current_timestamp_gmt() . mt_rand( 1000000, 9999999 ),167 173 'list_fields' => $core->explode_fields( $list->fields ), 168 174 'confirm_data' => $confirm_data … … 190 196 add_action( 'wp_ajax_nopriv_jackmail_front_widget_confirmed', array( $this, 'front_widget_confirmed_callback' ) ); 191 197 192 add_action( 'wp_footer', array( $this, 'front_widget_ confirmation_script' ) );198 add_action( 'wp_footer', array( $this, 'front_widget_scripts' ) ); 193 199 194 200 } … … 314 320 } 315 321 316 public function front_widget_confirmation_script() { 322 public function front_widget_scripts() { 323 include plugin_dir_path( __FILE__ ) . 'html/widget_front_script.php'; 317 324 if ( isset( $_GET['jackmail_widget_confirm'] ) ) { 318 325 $data = $this->core->request_text_data( $_GET['jackmail_widget_confirm'] ); … … 322 329 ?> 323 330 <script> 324 setTimeout( function () {331 setTimeout( function () { 325 332 alert( '<?php esc_attr_e( 'Your subscription to our list has been confirmed [Test]', 'jackmail-newsletters' ) ?>' ); 326 333 } ); 327 334 </script> 328 335 <?php 336 } else if ( isset( $data['rand'] ) ) { 337 include plugin_dir_path( __FILE__ ) . 'html/widget_front_script_double_optin.php'; 329 338 } 330 339 }
Note: See TracChangeset
for help on using the changeset viewer.