Version Description
- Fixed: Dynamic choices not displaying correctly for Multiple Choice and Checkbox fields.
Download this release
Release Info
| Developer | jaredatch |
| Plugin | |
| Version | 1.4.5.1 |
| Comparing to | |
| See all releases | |
Code changes from version 1.4.5 to 1.4.5.1
- assets/js/admin.js +1 -1603
- changelog.txt +3 -0
- includes/fields/class-base.php +2 -2
- includes/fields/class-checkbox.php +2 -2
- includes/fields/class-radio.php +2 -2
- includes/functions.php +7 -6
- languages/wpforms.pot +8 -8
- readme.txt +3 -0
- wpforms.php +2 -2
assets/js/admin.js
CHANGED
|
@@ -1,1603 +1 @@
|
|
| 1 |
-
/* global wp, _, wpforms_admin, jconfirm, wpCookies, Choices, List */
|
| 2 |
-
|
| 3 |
-
;(function($) {
|
| 4 |
-
|
| 5 |
-
'use strict';
|
| 6 |
-
|
| 7 |
-
// Global settings access.
|
| 8 |
-
var s;
|
| 9 |
-
|
| 10 |
-
// Admin object.
|
| 11 |
-
var WPFormsAdmin = {
|
| 12 |
-
|
| 13 |
-
// Settings.
|
| 14 |
-
settings: {
|
| 15 |
-
iconActivate: '<i class="fa fa-toggle-on fa-flip-horizontal" aria-hidden="true"></i>',
|
| 16 |
-
iconDeactivate: '<i class="fa fa-toggle-on" aria-hidden="true"></i>',
|
| 17 |
-
iconInstall: '<i class="fa fa-cloud-download" aria-hidden="true"></i>',
|
| 18 |
-
iconSpinner: '<i class="fa fa-spinner fa-spin" aria-hidden="true"></i>',
|
| 19 |
-
mediaFrame: false
|
| 20 |
-
},
|
| 21 |
-
|
| 22 |
-
/**
|
| 23 |
-
* Start the engine.
|
| 24 |
-
*
|
| 25 |
-
* @since 1.3.9
|
| 26 |
-
*/
|
| 27 |
-
init: function() {
|
| 28 |
-
|
| 29 |
-
// Settings shortcut.
|
| 30 |
-
s = this.settings;
|
| 31 |
-
|
| 32 |
-
// Document ready.
|
| 33 |
-
$( document ).ready( WPFormsAdmin.ready );
|
| 34 |
-
|
| 35 |
-
// Forms Overview.
|
| 36 |
-
WPFormsAdmin.initFormOverview();
|
| 37 |
-
|
| 38 |
-
// Entries Single (Details).
|
| 39 |
-
WPFormsAdmin.initEntriesSingle();
|
| 40 |
-
|
| 41 |
-
// Entries List.
|
| 42 |
-
WPFormsAdmin.initEntriesList();
|
| 43 |
-
|
| 44 |
-
// Welcome activation.
|
| 45 |
-
WPFormsAdmin.initWelcome();
|
| 46 |
-
|
| 47 |
-
// Addons List.
|
| 48 |
-
WPFormsAdmin.initAddons();
|
| 49 |
-
|
| 50 |
-
// Settings.
|
| 51 |
-
WPFormsAdmin.initSettings();
|
| 52 |
-
|
| 53 |
-
// Tools.
|
| 54 |
-
WPFormsAdmin.initTools();
|
| 55 |
-
|
| 56 |
-
// Upgrades (Tools view).
|
| 57 |
-
WPFormsAdmin.initUpgrades();
|
| 58 |
-
},
|
| 59 |
-
|
| 60 |
-
/**
|
| 61 |
-
* Document ready.
|
| 62 |
-
*
|
| 63 |
-
* @since 1.3.9
|
| 64 |
-
*/
|
| 65 |
-
ready: function() {
|
| 66 |
-
|
| 67 |
-
// To prevent jumping (since WP core moves the notices with js),
|
| 68 |
-
// they are hidden initally with CSS, then revealed below with JS,
|
| 69 |
-
// which runs after they have been moved.
|
| 70 |
-
$( '.notice' ).show();
|
| 71 |
-
|
| 72 |
-
// If there are screen options we have to move them.
|
| 73 |
-
$( '#screen-meta-links, #screen-meta' ).prependTo( '#wpforms-header-temp' ).show();
|
| 74 |
-
|
| 75 |
-
// Init fancy selects via choices.js.
|
| 76 |
-
WPFormsAdmin.initChoicesJS();
|
| 77 |
-
|
| 78 |
-
// Init checkbox multiselects columns.
|
| 79 |
-
WPFormsAdmin.initCheckboxMultiselectColumns();
|
| 80 |
-
|
| 81 |
-
// Init colorpickers via minicolors.js.
|
| 82 |
-
$( '.wpforms-color-picker' ).minicolors();
|
| 83 |
-
|
| 84 |
-
// Init fancy File Uploads.
|
| 85 |
-
$( '.wpforms-file-upload' ).each( function(){
|
| 86 |
-
var $input = $( this ).find( 'input[type=file]' ),
|
| 87 |
-
$label = $( this ).find( 'label' ),
|
| 88 |
-
labelVal = $label.html();
|
| 89 |
-
$input.on( 'change', function( event ) {
|
| 90 |
-
var fileName = '';
|
| 91 |
-
if ( this.files && this.files.length > 1 ) {
|
| 92 |
-
fileName = ( this.getAttribute( 'data-multiple-caption' ) || '' ).replace( '{count}', this.files.length );
|
| 93 |
-
} else if( event.target.value ) {
|
| 94 |
-
fileName = event.target.value.split( '\\' ).pop();
|
| 95 |
-
}
|
| 96 |
-
if ( fileName ) {
|
| 97 |
-
$label.find( '.fld' ).html( fileName );
|
| 98 |
-
} else {
|
| 99 |
-
$label.html( labelVal );
|
| 100 |
-
}
|
| 101 |
-
});
|
| 102 |
-
// Firefox bug fix.
|
| 103 |
-
$input.on( 'focus', function(){ $input.addClass( 'has-focus' ); }).on( 'blur', function(){ $input.removeClass( 'has-focus' ); });
|
| 104 |
-
});
|
| 105 |
-
|
| 106 |
-
// jquery-confirm defaults.
|
| 107 |
-
jconfirm.defaults = {
|
| 108 |
-
closeIcon: true,
|
| 109 |
-
backgroundDismiss: true,
|
| 110 |
-
escapeKey: true,
|
| 111 |
-
animationBounce: 1,
|
| 112 |
-
useBootstrap: false,
|
| 113 |
-
theme: 'modern',
|
| 114 |
-
boxWidth: '400px',
|
| 115 |
-
animateFromElement: false
|
| 116 |
-
};
|
| 117 |
-
|
| 118 |
-
// Upgrade information modal for upgrade links.
|
| 119 |
-
$( document ).on( 'click', '.wpforms-upgrade-modal', function() {
|
| 120 |
-
|
| 121 |
-
$.alert({
|
| 122 |
-
title: false,
|
| 123 |
-
content: wpforms_admin.upgrade_modal,
|
| 124 |
-
icon: 'fa fa-info-circle',
|
| 125 |
-
type: 'blue',
|
| 126 |
-
boxWidth: '565px',
|
| 127 |
-
buttons: {
|
| 128 |
-
confirm: {
|
| 129 |
-
text: wpforms_admin.ok,
|
| 130 |
-
btnClass: 'btn-confirm',
|
| 131 |
-
keys: [ 'enter' ]
|
| 132 |
-
}
|
| 133 |
-
}
|
| 134 |
-
});
|
| 135 |
-
});
|
| 136 |
-
|
| 137 |
-
// Action available for each binding.
|
| 138 |
-
$( document ).trigger( 'wpformsReady' );
|
| 139 |
-
},
|
| 140 |
-
|
| 141 |
-
/**
|
| 142 |
-
* Initilize Choices JS elements.
|
| 143 |
-
*
|
| 144 |
-
* @since 1.4.2
|
| 145 |
-
*/
|
| 146 |
-
initChoicesJS: function() {
|
| 147 |
-
|
| 148 |
-
$( '.choicesjs-select' ).each( function() {
|
| 149 |
-
var $this = $( this ),
|
| 150 |
-
args = { searchEnabled: false };
|
| 151 |
-
if ( $this.attr( 'multiple' ) ) {
|
| 152 |
-
args.searchEnabled = true;
|
| 153 |
-
args.removeItemButton = true;
|
| 154 |
-
}
|
| 155 |
-
if ( $this.data( 'placeholder' ) ) {
|
| 156 |
-
args.placeholderValue = $this.data( 'placeholder' );
|
| 157 |
-
}
|
| 158 |
-
if ( $this.data( 'sorting' ) === 'off' ) {
|
| 159 |
-
args.shouldSort = false;
|
| 160 |
-
}
|
| 161 |
-
if ( $this.data( 'search' ) ) {
|
| 162 |
-
args.searchEnabled = true;
|
| 163 |
-
}
|
| 164 |
-
new Choices( $this[0], args );
|
| 165 |
-
});
|
| 166 |
-
},
|
| 167 |
-
|
| 168 |
-
/**
|
| 169 |
-
* Initilize checkbox mulit-select columns.
|
| 170 |
-
*
|
| 171 |
-
* @since 1.4.2
|
| 172 |
-
*/
|
| 173 |
-
initCheckboxMultiselectColumns: function() {
|
| 174 |
-
|
| 175 |
-
$( document ).on( 'change', '.checkbox-multiselect-columns input', function() {
|
| 176 |
-
|
| 177 |
-
var $this = $( this ),
|
| 178 |
-
$parent = $this.parent(),
|
| 179 |
-
$container = $this.closest( '.checkbox-multiselect-columns' ),
|
| 180 |
-
label = $parent.text(),
|
| 181 |
-
itemID = 'check-item-' + $this.val(),
|
| 182 |
-
$item = $container.find( '#' + itemID );
|
| 183 |
-
|
| 184 |
-
if ( $this.prop( 'checked' ) ) {
|
| 185 |
-
$this.parent().addClass( 'checked' );
|
| 186 |
-
if ( ! $item.length ) {
|
| 187 |
-
$container.find('.second-column ul').append( '<li id="'+itemID+'">'+label+'</li>' );
|
| 188 |
-
}
|
| 189 |
-
} else {
|
| 190 |
-
$this.parent().removeClass( 'checked' );
|
| 191 |
-
$container.find( '#' + itemID ).remove();
|
| 192 |
-
}
|
| 193 |
-
});
|
| 194 |
-
|
| 195 |
-
$( document ).on( 'click', '.checkbox-multiselect-columns .all', function( event ) {
|
| 196 |
-
|
| 197 |
-
event.preventDefault();
|
| 198 |
-
|
| 199 |
-
$( this ).closest( '.checkbox-multiselect-columns' ).find( 'input[type=checkbox]' ).prop( 'checked', true ).trigger( 'change' );
|
| 200 |
-
$( this ).remove();
|
| 201 |
-
});
|
| 202 |
-
},
|
| 203 |
-
|
| 204 |
-
//--------------------------------------------------------------------//
|
| 205 |
-
// Forms Overview
|
| 206 |
-
//--------------------------------------------------------------------//
|
| 207 |
-
|
| 208 |
-
/**
|
| 209 |
-
* Element bindings for Form Overview page.
|
| 210 |
-
*
|
| 211 |
-
* @since 1.3.9
|
| 212 |
-
*/
|
| 213 |
-
initFormOverview: function() {
|
| 214 |
-
|
| 215 |
-
// Confirm form entry deletion and duplications.
|
| 216 |
-
$( document ).on( 'click', '#wpforms-overview .wp-list-table .delete a, #wpforms-overview .wp-list-table .duplicate a', function( event ) {
|
| 217 |
-
|
| 218 |
-
event.preventDefault();
|
| 219 |
-
|
| 220 |
-
var url = $( this ).attr( 'href' ),
|
| 221 |
-
msg = $( this ).parent().hasClass( 'delete' ) ? wpforms_admin.form_delete_confirm : wpforms_admin.form_duplicate_confirm;
|
| 222 |
-
|
| 223 |
-
// Trigger alert modal to confirm.
|
| 224 |
-
$.confirm({
|
| 225 |
-
title: false,
|
| 226 |
-
content: msg,
|
| 227 |
-
backgroundDismiss: false,
|
| 228 |
-
closeIcon: false,
|
| 229 |
-
icon: 'fa fa-exclamation-circle',
|
| 230 |
-
type: 'orange',
|
| 231 |
-
buttons: {
|
| 232 |
-
confirm: {
|
| 233 |
-
text: wpforms_admin.ok,
|
| 234 |
-
btnClass: 'btn-confirm',
|
| 235 |
-
keys: [ 'enter' ],
|
| 236 |
-
action: function(){
|
| 237 |
-
window.location = url;
|
| 238 |
-
}
|
| 239 |
-
},
|
| 240 |
-
cancel: {
|
| 241 |
-
text: wpforms_admin.cancel,
|
| 242 |
-
keys: [ 'esc' ]
|
| 243 |
-
}
|
| 244 |
-
}
|
| 245 |
-
});
|
| 246 |
-
});
|
| 247 |
-
},
|
| 248 |
-
|
| 249 |
-
//--------------------------------------------------------------------//
|
| 250 |
-
// Entry Single (Details)
|
| 251 |
-
//--------------------------------------------------------------------//
|
| 252 |
-
|
| 253 |
-
/**
|
| 254 |
-
* Element bindings for Entries Single (Details) page.
|
| 255 |
-
*
|
| 256 |
-
* @since 1.3.9
|
| 257 |
-
*/
|
| 258 |
-
initEntriesSingle: function() {
|
| 259 |
-
|
| 260 |
-
// Entry navigation hotkeys.
|
| 261 |
-
// We only want to listen on the applicable admin page.
|
| 262 |
-
if ( 'wpforms-entries' === WPFormsAdmin.getQueryString( 'page' ) && 'details' === WPFormsAdmin.getQueryString( 'view' ) ) {
|
| 263 |
-
WPFormsAdmin.entryHotkeys();
|
| 264 |
-
}
|
| 265 |
-
|
| 266 |
-
// Confirm entry deletion.
|
| 267 |
-
$( document ).on( 'click', '#wpforms-entries-single .submitdelete', function( event ) {
|
| 268 |
-
|
| 269 |
-
event.preventDefault();
|
| 270 |
-
|
| 271 |
-
var url = $( this ).attr( 'href' );
|
| 272 |
-
|
| 273 |
-
// Trigger alert modal to confirm.
|
| 274 |
-
$.confirm({
|
| 275 |
-
title: false,
|
| 276 |
-
content: wpforms_admin.entry_delete_confirm,
|
| 277 |
-
backgroundDismiss: false,
|
| 278 |
-
closeIcon: false,
|
| 279 |
-
icon: 'fa fa-exclamation-circle',
|
| 280 |
-
type: 'orange',
|
| 281 |
-
buttons: {
|
| 282 |
-
confirm: {
|
| 283 |
-
text: wpforms_admin.ok,
|
| 284 |
-
btnClass: 'btn-confirm',
|
| 285 |
-
keys: [ 'enter' ],
|
| 286 |
-
action: function(){
|
| 287 |
-
window.location = url;
|
| 288 |
-
}
|
| 289 |
-
},
|
| 290 |
-
cancel: {
|
| 291 |
-
text: wpforms_admin.cancel,
|
| 292 |
-
keys: [ 'esc' ]
|
| 293 |
-
}
|
| 294 |
-
}
|
| 295 |
-
});
|
| 296 |
-
});
|
| 297 |
-
|
| 298 |
-
// Open Print preview in new window.
|
| 299 |
-
$( document ).on( 'click', '#wpforms-entries-single .wpforms-entry-print a', function( event ) {
|
| 300 |
-
|
| 301 |
-
event.preventDefault();
|
| 302 |
-
|
| 303 |
-
window.open( $( this ).attr( 'href' ) );
|
| 304 |
-
});
|
| 305 |
-
|
| 306 |
-
// Toggle displaying empty fields.
|
| 307 |
-
$( document ).on( 'click', '#wpforms-entries-single .wpforms-empty-field-toggle', function( event ) {
|
| 308 |
-
|
| 309 |
-
event.preventDefault();
|
| 310 |
-
|
| 311 |
-
// Handle cookie.
|
| 312 |
-
if ( wpCookies.get( 'wpforms_entry_hide_empty' ) === 'true') {
|
| 313 |
-
|
| 314 |
-
// User was hiding empty fields, so now display them.
|
| 315 |
-
wpCookies.remove('wpforms_entry_hide_empty');
|
| 316 |
-
$( this ).text( wpforms_admin.entry_empty_fields_hide );
|
| 317 |
-
} else {
|
| 318 |
-
|
| 319 |
-
// User was seeing empty fields, so now hide them.
|
| 320 |
-
wpCookies.set( 'wpforms_entry_hide_empty', 'true', 2592000 ); // 1month.
|
| 321 |
-
$( this ).text( wpforms_admin.entry_empty_fields_show );
|
| 322 |
-
}
|
| 323 |
-
|
| 324 |
-
$( '.wpforms-entry-field.empty' ).toggle();
|
| 325 |
-
});
|
| 326 |
-
|
| 327 |
-
// Display notes editor.
|
| 328 |
-
$( document ).on( 'click', '#wpforms-entries-single .wpforms-entry-notes-new .add', function( event ) {
|
| 329 |
-
|
| 330 |
-
event.preventDefault();
|
| 331 |
-
|
| 332 |
-
$( this ).hide().next( 'form' ).slideToggle();
|
| 333 |
-
});
|
| 334 |
-
|
| 335 |
-
// Cancel note.
|
| 336 |
-
$( document ).on( 'click', '#wpforms-entries-single .wpforms-entry-notes-new .cancel', function( event ) {
|
| 337 |
-
|
| 338 |
-
event.preventDefault();
|
| 339 |
-
|
| 340 |
-
$( this ).closest( 'form' ).slideToggle();
|
| 341 |
-
$('.wpforms-entry-notes-new .add').show();
|
| 342 |
-
});
|
| 343 |
-
|
| 344 |
-
// Delete note.
|
| 345 |
-
$( document ).on( 'click', '#wpforms-entries-single .wpforms-entry-notes-byline .note-delete', function( event ) {
|
| 346 |
-
|
| 347 |
-
event.preventDefault();
|
| 348 |
-
|
| 349 |
-
var url = $( this ).attr( 'href' );
|
| 350 |
-
|
| 351 |
-
// Trigger alert modal to confirm.
|
| 352 |
-
$.confirm({
|
| 353 |
-
title: false,
|
| 354 |
-
content: wpforms_admin.entry_note_delete_confirm,
|
| 355 |
-
backgroundDismiss: false,
|
| 356 |
-
closeIcon: false,
|
| 357 |
-
icon: 'fa fa-exclamation-circle',
|
| 358 |
-
type: 'orange',
|
| 359 |
-
buttons: {
|
| 360 |
-
confirm: {
|
| 361 |
-
text: wpforms_admin.ok,
|
| 362 |
-
btnClass: 'btn-confirm',
|
| 363 |
-
keys: [ 'enter' ],
|
| 364 |
-
action: function(){
|
| 365 |
-
window.location = url;
|
| 366 |
-
}
|
| 367 |
-
},
|
| 368 |
-
cancel: {
|
| 369 |
-
text: wpforms_admin.cancel,
|
| 370 |
-
keys: [ 'esc' ]
|
| 371 |
-
}
|
| 372 |
-
}
|
| 373 |
-
});
|
| 374 |
-
});
|
| 375 |
-
},
|
| 376 |
-
|
| 377 |
-
/**
|
| 378 |
-
* Hotkeys for Entries Single (Details) page.
|
| 379 |
-
*
|
| 380 |
-
* j triggers previous entry, k triggers next entry.
|
| 381 |
-
*
|
| 382 |
-
* @since 1.4.0
|
| 383 |
-
*/
|
| 384 |
-
entryHotkeys: function() {
|
| 385 |
-
|
| 386 |
-
$( document ).keydown( function( event ) {
|
| 387 |
-
if ( 74 === event.keyCode && ! WPFormsAdmin.isFormTypeNode( event.target.nodeName ) ) {
|
| 388 |
-
// j key has been pressed outside of a form element, go to
|
| 389 |
-
// the previous entry.
|
| 390 |
-
var prevEntry = $('#wpforms-entry-prev-link').attr( 'href' );
|
| 391 |
-
if ( '#' !== prevEntry ) {
|
| 392 |
-
window.location.href = prevEntry;
|
| 393 |
-
}
|
| 394 |
-
} else if ( 75 === event.keyCode && ! WPFormsAdmin.isFormTypeNode( event.target.nodeName ) ) {
|
| 395 |
-
// k key has been pressed outside of a form element, go to
|
| 396 |
-
// the previous entry.
|
| 397 |
-
var nextEntry = $('#wpforms-entry-next-link').attr( 'href' );
|
| 398 |
-
if ( '#' !== nextEntry ) {
|
| 399 |
-
window.location.href = nextEntry;
|
| 400 |
-
}
|
| 401 |
-
}
|
| 402 |
-
});
|
| 403 |
-
},
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
//--------------------------------------------------------------------//
|
| 407 |
-
// Entry List
|
| 408 |
-
//--------------------------------------------------------------------//
|
| 409 |
-
|
| 410 |
-
/**
|
| 411 |
-
* Element bindings for Entries List table page.
|
| 412 |
-
*
|
| 413 |
-
* @since 1.3.9
|
| 414 |
-
*/
|
| 415 |
-
initEntriesList: function() {
|
| 416 |
-
|
| 417 |
-
$( document ).on( 'click', '#wpforms-entries-table-edit-columns', function( event ) {
|
| 418 |
-
|
| 419 |
-
event.preventDefault();
|
| 420 |
-
|
| 421 |
-
WPFormsAdmin.entriesListFieldColumn();
|
| 422 |
-
});
|
| 423 |
-
|
| 424 |
-
// Toogle form selector dropdown.
|
| 425 |
-
$( document ).on( 'click', '#wpforms-entries-list .form-selector .toggle', function( event ) {
|
| 426 |
-
|
| 427 |
-
event.preventDefault();
|
| 428 |
-
|
| 429 |
-
$( this ).toggleClass( 'active' ).next( '.form-list' ).toggle();
|
| 430 |
-
|
| 431 |
-
});
|
| 432 |
-
|
| 433 |
-
// Confirm entry deletion.
|
| 434 |
-
$( document ).on( 'click', '#wpforms-entries-list .wp-list-table .delete', function( event ) {
|
| 435 |
-
|
| 436 |
-
event.preventDefault();
|
| 437 |
-
|
| 438 |
-
var url = $( this ).attr( 'href' );
|
| 439 |
-
|
| 440 |
-
// Trigger alert modal to confirm.
|
| 441 |
-
$.confirm({
|
| 442 |
-
title: false,
|
| 443 |
-
content: wpforms_admin.entry_delete_confirm,
|
| 444 |
-
backgroundDismiss: false,
|
| 445 |
-
closeIcon: false,
|
| 446 |
-
icon: 'fa fa-exclamation-circle',
|
| 447 |
-
type: 'orange',
|
| 448 |
-
buttons: {
|
| 449 |
-
confirm: {
|
| 450 |
-
text: wpforms_admin.ok,
|
| 451 |
-
btnClass: 'btn-confirm',
|
| 452 |
-
keys: [ 'enter' ],
|
| 453 |
-
action: function(){
|
| 454 |
-
window.location = url;
|
| 455 |
-
}
|
| 456 |
-
},
|
| 457 |
-
cancel: {
|
| 458 |
-
text: wpforms_admin.cancel,
|
| 459 |
-
keys: [ 'esc' ]
|
| 460 |
-
}
|
| 461 |
-
}
|
| 462 |
-
});
|
| 463 |
-
});
|
| 464 |
-
|
| 465 |
-
// Toggle entry stars.
|
| 466 |
-
$( document ).on( 'click', '#wpforms-entries-list .wp-list-table .indicator-star', function( event ) {
|
| 467 |
-
|
| 468 |
-
event.preventDefault();
|
| 469 |
-
|
| 470 |
-
var $this = $( this ),
|
| 471 |
-
task = '',
|
| 472 |
-
total = Number( $( '#wpforms-entries-list .starred-num' ).text() ),
|
| 473 |
-
id = $this.data( 'id' );
|
| 474 |
-
|
| 475 |
-
if ( $this.hasClass( 'star' ) ) {
|
| 476 |
-
task = 'star';
|
| 477 |
-
total++;
|
| 478 |
-
$this.attr( 'title', wpforms_admin.entry_unstar );
|
| 479 |
-
} else {
|
| 480 |
-
task = 'unstar';
|
| 481 |
-
total--;
|
| 482 |
-
$this.attr( 'title', wpforms_admin.entry_star );
|
| 483 |
-
}
|
| 484 |
-
$this.toggleClass( 'star unstar' );
|
| 485 |
-
$( '#wpforms-entries-list .starred-num' ).text( total );
|
| 486 |
-
|
| 487 |
-
var data = {
|
| 488 |
-
task : task,
|
| 489 |
-
action : 'wpforms_entry_list_star',
|
| 490 |
-
nonce : wpforms_admin.nonce,
|
| 491 |
-
entry_id: id
|
| 492 |
-
};
|
| 493 |
-
$.post( wpforms_admin.ajax_url, data );
|
| 494 |
-
});
|
| 495 |
-
|
| 496 |
-
// Toggle entry read state.
|
| 497 |
-
$( document ).on( 'click', '#wpforms-entries-list .wp-list-table .indicator-read', function( event ) {
|
| 498 |
-
|
| 499 |
-
event.preventDefault();
|
| 500 |
-
|
| 501 |
-
var $this = $( this ),
|
| 502 |
-
task = '',
|
| 503 |
-
total = Number( $( '#wpforms-entries-list .unread-num' ).text() ),
|
| 504 |
-
id = $this.data( 'id' );
|
| 505 |
-
|
| 506 |
-
if ( $this.hasClass( 'read' ) ) {
|
| 507 |
-
task = 'read';
|
| 508 |
-
total--;
|
| 509 |
-
$this.attr( 'title', wpforms_admin.entry_unread );
|
| 510 |
-
} else {
|
| 511 |
-
task = 'unread';
|
| 512 |
-
total++;
|
| 513 |
-
$this.attr( 'title', wpforms_admin.entry_read );
|
| 514 |
-
}
|
| 515 |
-
$this.toggleClass( 'read unread' );
|
| 516 |
-
$( '#wpforms-entries-list .unread-num' ).text( total );
|
| 517 |
-
|
| 518 |
-
var data = {
|
| 519 |
-
task : task,
|
| 520 |
-
action : 'wpforms_entry_list_read',
|
| 521 |
-
nonce : wpforms_admin.nonce,
|
| 522 |
-
entry_id: id
|
| 523 |
-
};
|
| 524 |
-
$.post( wpforms_admin.ajax_url, data );
|
| 525 |
-
});
|
| 526 |
-
|
| 527 |
-
// Confirm mass entry deletion - this deletes ALL entries.
|
| 528 |
-
$( document ).on( 'click', '#wpforms-entries-list .form-details-actions-deleteall', function( event ) {
|
| 529 |
-
|
| 530 |
-
event.preventDefault();
|
| 531 |
-
|
| 532 |
-
var url = $( this ).attr( 'href' );
|
| 533 |
-
|
| 534 |
-
// Trigger alert modal to confirm.
|
| 535 |
-
$.confirm({
|
| 536 |
-
title: wpforms_admin.heads_up,
|
| 537 |
-
content: wpforms_admin.entry_delete_all_confirm,
|
| 538 |
-
backgroundDismiss: false,
|
| 539 |
-
closeIcon: false,
|
| 540 |
-
icon: 'fa fa-exclamation-circle',
|
| 541 |
-
type: 'orange',
|
| 542 |
-
buttons: {
|
| 543 |
-
confirm: {
|
| 544 |
-
text: wpforms_admin.ok,
|
| 545 |
-
btnClass: 'btn-confirm',
|
| 546 |
-
keys: [ 'enter' ],
|
| 547 |
-
action: function(){
|
| 548 |
-
window.location = url;
|
| 549 |
-
}
|
| 550 |
-
},
|
| 551 |
-
cancel: {
|
| 552 |
-
text: wpforms_admin.cancel,
|
| 553 |
-
keys: [ 'esc' ]
|
| 554 |
-
}
|
| 555 |
-
}
|
| 556 |
-
});
|
| 557 |
-
});
|
| 558 |
-
},
|
| 559 |
-
|
| 560 |
-
/**
|
| 561 |
-
* Display settings to change the entry list field columns/
|
| 562 |
-
*
|
| 563 |
-
* @since 1.4.0
|
| 564 |
-
*/
|
| 565 |
-
entriesListFieldColumn: function() {
|
| 566 |
-
|
| 567 |
-
$.alert({
|
| 568 |
-
title: wpforms_admin.entry_field_columns,
|
| 569 |
-
boxWidth: '500px',
|
| 570 |
-
content: s.iconSpinner + $( '#wpforms-field-column-select' ).html(),
|
| 571 |
-
onContentReady: function() {
|
| 572 |
-
|
| 573 |
-
var $modalContent = this.$content,
|
| 574 |
-
$select = $modalContent.find( 'select' ),
|
| 575 |
-
choices = new Choices( $select[0], {
|
| 576 |
-
maxItemCount: 5,
|
| 577 |
-
placeholderValue: wpforms_admin.fields_select+'...',
|
| 578 |
-
removeItemButton: true,
|
| 579 |
-
shouldSort: false,
|
| 580 |
-
callbackOnInit: function() {
|
| 581 |
-
$modalContent.find( '.fa' ).remove();
|
| 582 |
-
$modalContent.find( 'form' ).show();
|
| 583 |
-
}
|
| 584 |
-
});
|
| 585 |
-
|
| 586 |
-
$( '.jconfirm-content-pane, .jconfirm-box' ).css( 'overflow','visible' );
|
| 587 |
-
|
| 588 |
-
choices.passedElement.addEventListener( 'change', function() {
|
| 589 |
-
choices.hideDropdown();
|
| 590 |
-
}, false );
|
| 591 |
-
},
|
| 592 |
-
buttons: {
|
| 593 |
-
confirm: {
|
| 594 |
-
text: wpforms_admin.save_refresh,
|
| 595 |
-
btnClass: 'btn-confirm',
|
| 596 |
-
keys: ['enter'],
|
| 597 |
-
action: function() {
|
| 598 |
-
this.$content.find( 'form' ).submit();
|
| 599 |
-
}
|
| 600 |
-
},
|
| 601 |
-
cancel: {
|
| 602 |
-
text: wpforms_admin.cancel,
|
| 603 |
-
keys: [ 'esc' ]
|
| 604 |
-
}
|
| 605 |
-
}
|
| 606 |
-
});
|
| 607 |
-
},
|
| 608 |
-
|
| 609 |
-
//--------------------------------------------------------------------//
|
| 610 |
-
// Welcome Activation.
|
| 611 |
-
//--------------------------------------------------------------------//
|
| 612 |
-
|
| 613 |
-
/**
|
| 614 |
-
* Welcome activation page.
|
| 615 |
-
*
|
| 616 |
-
* @since 1.3.9
|
| 617 |
-
*/
|
| 618 |
-
initWelcome: function() {
|
| 619 |
-
|
| 620 |
-
// Open modal and play How To video.
|
| 621 |
-
$( document ).on( 'click', '#wpforms-welcome .play-video', function( event ) {
|
| 622 |
-
|
| 623 |
-
event.preventDefault();
|
| 624 |
-
|
| 625 |
-
var video = '<div class="video-container"><iframe width="1280" height="720" src="https://www.youtube-nocookie.com/embed/yDyvSGV7tP4?rel=0&showinfo=0&autoplay=1" frameborder="0" allowfullscreen></iframe></div>';
|
| 626 |
-
|
| 627 |
-
$.dialog({
|
| 628 |
-
title: false,
|
| 629 |
-
content: video,
|
| 630 |
-
closeIcon: true,
|
| 631 |
-
boxWidth: '70%'
|
| 632 |
-
});
|
| 633 |
-
});
|
| 634 |
-
},
|
| 635 |
-
|
| 636 |
-
//--------------------------------------------------------------------//
|
| 637 |
-
// Addons List.
|
| 638 |
-
//--------------------------------------------------------------------//
|
| 639 |
-
|
| 640 |
-
/**
|
| 641 |
-
* Element bindings for Addons List page.
|
| 642 |
-
*
|
| 643 |
-
* @since 1.3.9
|
| 644 |
-
*/
|
| 645 |
-
initAddons: function() {
|
| 646 |
-
|
| 647 |
-
// Some actions have to be delayed to document.ready.
|
| 648 |
-
$( document ).on( 'wpformsReady', function() {
|
| 649 |
-
|
| 650 |
-
// Only run on the addons page.
|
| 651 |
-
if ( $( '#wpforms-admin-addons' ).length ) {
|
| 652 |
-
|
| 653 |
-
// Display all addon boxes as the same height.
|
| 654 |
-
$( '.addon-item .details' ).matchHeight( { byrow: false, property: 'height' } );
|
| 655 |
-
|
| 656 |
-
// Addons searching.
|
| 657 |
-
var addonSearch = new List('wpforms-admin-addons-list', {
|
| 658 |
-
valueNames: [ 'addon-name' ]
|
| 659 |
-
});
|
| 660 |
-
|
| 661 |
-
$( '#wpforms-admin-addons-search' ).on( 'keyup', function() {
|
| 662 |
-
addonSearch.search( $( this ).val() );
|
| 663 |
-
});
|
| 664 |
-
}
|
| 665 |
-
});
|
| 666 |
-
|
| 667 |
-
// Display all addon boxes as the same height.
|
| 668 |
-
$( document ).on( 'wpformsReady', function() {
|
| 669 |
-
|
| 670 |
-
// Only run on the addons page because the matchHeight jQuery
|
| 671 |
-
// library is not loaded globally.
|
| 672 |
-
if ( $( '#wpforms-admin-addons' ).length ) {
|
| 673 |
-
$( '.addon-item .details' ).matchHeight( { byrow: false, property: 'min-height' } );
|
| 674 |
-
}
|
| 675 |
-
});
|
| 676 |
-
|
| 677 |
-
// Toogle an addon state.
|
| 678 |
-
$( document ).on( 'click', '#wpforms-admin-addons .addon-item button', function( event ) {
|
| 679 |
-
|
| 680 |
-
event.preventDefault();
|
| 681 |
-
|
| 682 |
-
WPFormsAdmin.addonToggle( $( this ) );
|
| 683 |
-
});
|
| 684 |
-
},
|
| 685 |
-
|
| 686 |
-
/**
|
| 687 |
-
* Toggle addon state.
|
| 688 |
-
*
|
| 689 |
-
* @since 1.3.9
|
| 690 |
-
*/
|
| 691 |
-
addonToggle: function( el ) {
|
| 692 |
-
|
| 693 |
-
var $this = $( el ),
|
| 694 |
-
$addon = $this.closest( '.addon-item' ),
|
| 695 |
-
plugin = $this.attr( 'data-plugin' ),
|
| 696 |
-
action,
|
| 697 |
-
cssClass,
|
| 698 |
-
statusText,
|
| 699 |
-
buttonText,
|
| 700 |
-
errorText,
|
| 701 |
-
successText;
|
| 702 |
-
|
| 703 |
-
$this.prop( 'disabled', true ).addClass( 'loading' );
|
| 704 |
-
$this.html( s.iconSpinner );
|
| 705 |
-
|
| 706 |
-
if ( $this.hasClass( 'status-active' ) ) {
|
| 707 |
-
// Deactivate.
|
| 708 |
-
action = 'wpforms_deactivate_addon';
|
| 709 |
-
cssClass = 'status-inactive';
|
| 710 |
-
statusText = wpforms_admin.addon_inactive;
|
| 711 |
-
buttonText = s.iconActivate + wpforms_admin.addon_activate;
|
| 712 |
-
errorText = s.iconDeactivate + wpforms_admin.addon_deactivate;
|
| 713 |
-
|
| 714 |
-
} else if ( $this.hasClass( 'status-inactive' ) ) {
|
| 715 |
-
// Activate.
|
| 716 |
-
action = 'wpforms_activate_addon';
|
| 717 |
-
cssClass = 'status-active';
|
| 718 |
-
statusText = wpforms_admin.addon_active;
|
| 719 |
-
buttonText = s.iconDeactivate + wpforms_admin.addon_deactivate;
|
| 720 |
-
errorText = s.iconActivate + wpforms_admin.addon_activate;
|
| 721 |
-
|
| 722 |
-
} else if ( $this.hasClass( 'status-download' ) ) {
|
| 723 |
-
// Install.
|
| 724 |
-
action = 'wpforms_install_addon';
|
| 725 |
-
cssClass = 'status-inactive';
|
| 726 |
-
statusText = wpforms_admin.addon_inactive;
|
| 727 |
-
buttonText = s.iconActivate + wpforms_admin.addon_activate;
|
| 728 |
-
errorText = s.iconInstall + wpforms_admin.addon_install;
|
| 729 |
-
} else {
|
| 730 |
-
return;
|
| 731 |
-
}
|
| 732 |
-
|
| 733 |
-
var data = {
|
| 734 |
-
action: action,
|
| 735 |
-
nonce : wpforms_admin.nonce,
|
| 736 |
-
plugin: plugin
|
| 737 |
-
};
|
| 738 |
-
$.post( wpforms_admin.ajax_url, data, function( res ) {
|
| 739 |
-
|
| 740 |
-
if ( res.success ){
|
| 741 |
-
if ( 'wpforms_install_addon' === action ) {
|
| 742 |
-
$this.attr( 'data-plugin', res.data.basename );
|
| 743 |
-
successText = res.data.msg;
|
| 744 |
-
} else {
|
| 745 |
-
successText = res.data;
|
| 746 |
-
}
|
| 747 |
-
$addon.find( '.actions' ).append( '<div class="msg success">'+successText+'</div>' );
|
| 748 |
-
$addon.find( 'span.status-label' ).removeClass( 'status-active status-inactive status-download' ).addClass( cssClass ).text( statusText );
|
| 749 |
-
$this.removeClass( 'status-active status-inactive status-download' ).addClass( cssClass ).html( buttonText );
|
| 750 |
-
} else {
|
| 751 |
-
$addon.find( '.actions' ).append( '<div class="msg error">'+res.data+'</div>' );
|
| 752 |
-
$this.html( errorText );
|
| 753 |
-
}
|
| 754 |
-
|
| 755 |
-
$this.prop( 'disabled', false ).removeClass( 'loading' );
|
| 756 |
-
|
| 757 |
-
// Automatically clear addon messages after 3 seconds.
|
| 758 |
-
setTimeout( function() {
|
| 759 |
-
$( '.addon-item .msg' ).remove();
|
| 760 |
-
}, 3000 );
|
| 761 |
-
|
| 762 |
-
}).fail( function( xhr ) {
|
| 763 |
-
console.log( xhr.responseText );
|
| 764 |
-
});
|
| 765 |
-
},
|
| 766 |
-
|
| 767 |
-
//--------------------------------------------------------------------//
|
| 768 |
-
// Settings.
|
| 769 |
-
//--------------------------------------------------------------------//
|
| 770 |
-
|
| 771 |
-
/**
|
| 772 |
-
* Element bindings for Settings page.
|
| 773 |
-
*
|
| 774 |
-
* @since 1.3.9
|
| 775 |
-
*/
|
| 776 |
-
initSettings: function() {
|
| 777 |
-
|
| 778 |
-
// Watch for hashes and scroll to if found.
|
| 779 |
-
// Display all addon boxes as the same height.
|
| 780 |
-
$( document ).on( 'wpformsReady', function() {
|
| 781 |
-
|
| 782 |
-
// Only proceed if we're on the settings page.
|
| 783 |
-
if ( ! $( '#wpforms-settings' ).length ) {
|
| 784 |
-
return;
|
| 785 |
-
}
|
| 786 |
-
|
| 787 |
-
var integrationFocus = WPFormsAdmin.getQueryString( 'wpforms-integration' ),
|
| 788 |
-
jumpTo = WPFormsAdmin.getQueryString( 'jump' );
|
| 789 |
-
|
| 790 |
-
if ( integrationFocus ) {
|
| 791 |
-
$( 'body' ).animate({
|
| 792 |
-
scrollTop: $( '#wpforms-integration-'+integrationFocus ).offset().top
|
| 793 |
-
}, 1000 );
|
| 794 |
-
} else if ( jumpTo ) {
|
| 795 |
-
$( 'body' ).animate({
|
| 796 |
-
scrollTop: $( '#'+jumpTo ).offset().top
|
| 797 |
-
}, 1000 );
|
| 798 |
-
}
|
| 799 |
-
});
|
| 800 |
-
|
| 801 |
-
// Image upload fields.
|
| 802 |
-
$( document ).on( 'click', '.wpforms-setting-row-image button', function( event ) {
|
| 803 |
-
|
| 804 |
-
event.preventDefault();
|
| 805 |
-
|
| 806 |
-
WPFormsAdmin.imageUploadModal( $( this ) );
|
| 807 |
-
});
|
| 808 |
-
|
| 809 |
-
// Verify license key.
|
| 810 |
-
$( document ).on( 'click', '#wpforms-setting-license-key-verify', function( event ) {
|
| 811 |
-
|
| 812 |
-
event.preventDefault();
|
| 813 |
-
|
| 814 |
-
WPFormsAdmin.licenseVerify( $( this ) );
|
| 815 |
-
});
|
| 816 |
-
|
| 817 |
-
// Deactivate license key.
|
| 818 |
-
$( document ).on( 'click', '#wpforms-setting-license-key-deactivate', function( event ) {
|
| 819 |
-
|
| 820 |
-
event.preventDefault();
|
| 821 |
-
|
| 822 |
-
WPFormsAdmin.licenseDeactivate( $( this ) );
|
| 823 |
-
});
|
| 824 |
-
|
| 825 |
-
// Refresh license key.
|
| 826 |
-
$( document ).on( 'click', '#wpforms-setting-license-key-refresh', function( event ) {
|
| 827 |
-
|
| 828 |
-
event.preventDefault();
|
| 829 |
-
|
| 830 |
-
WPFormsAdmin.licenseRefresh( $( this ) );
|
| 831 |
-
});
|
| 832 |
-
|
| 833 |
-
/**
|
| 834 |
-
* @todo Refactor providers settings tab. Code below is legacy.
|
| 835 |
-
*/
|
| 836 |
-
|
| 837 |
-
// Integration connect.
|
| 838 |
-
$( document ).on( 'click', '.wpforms-settings-provider-connect', function( event ) {
|
| 839 |
-
|
| 840 |
-
event.preventDefault();
|
| 841 |
-
|
| 842 |
-
WPFormsAdmin.integrationConnect( $( this ) );
|
| 843 |
-
});
|
| 844 |
-
|
| 845 |
-
// Integration account disconnect.
|
| 846 |
-
$( document ).on( 'click', '.wpforms-settings-provider-accounts-list a', function( event ) {
|
| 847 |
-
|
| 848 |
-
event.preventDefault();
|
| 849 |
-
|
| 850 |
-
WPFormsAdmin.integrationDisconnect( $( this ) );
|
| 851 |
-
});
|
| 852 |
-
|
| 853 |
-
// Integration individual display toggling.
|
| 854 |
-
$( document ).on( 'click', '.wpforms-settings-provider-header', function( event ) {
|
| 855 |
-
|
| 856 |
-
event.preventDefault();
|
| 857 |
-
|
| 858 |
-
$( this ).parent().find( '.wpforms-settings-provider-accounts' ).slideToggle();
|
| 859 |
-
$( this ).parent().find( '.wpforms-settings-provider-logo i' ).toggleClass( 'fa-chevron-right fa-chevron-down' );
|
| 860 |
-
});
|
| 861 |
-
|
| 862 |
-
// Integration accounts display toggling.
|
| 863 |
-
$( document ).on( 'click', '.wpforms-settings-provider-accounts-toggle a', function( event ) {
|
| 864 |
-
|
| 865 |
-
event.preventDefault();
|
| 866 |
-
|
| 867 |
-
var $connectFields = $( this ).parent().next( '.wpforms-settings-provider-accounts-connect' );
|
| 868 |
-
$connectFields.find( 'input[type=text], input[type=password]' ).val('');
|
| 869 |
-
$connectFields.slideToggle();
|
| 870 |
-
});
|
| 871 |
-
},
|
| 872 |
-
|
| 873 |
-
/**
|
| 874 |
-
* Image upload modal window.
|
| 875 |
-
*
|
| 876 |
-
* @since 1.3.0
|
| 877 |
-
*/
|
| 878 |
-
imageUploadModal: function( el ) {
|
| 879 |
-
|
| 880 |
-
if ( s.media_frame ) {
|
| 881 |
-
s.media_frame.open();
|
| 882 |
-
return;
|
| 883 |
-
}
|
| 884 |
-
|
| 885 |
-
var $setting = $( el ).closest( '.wpforms-setting-field' );
|
| 886 |
-
|
| 887 |
-
s.media_frame = wp.media.frames.wpforms_media_frame = wp.media({
|
| 888 |
-
className: 'media-frame wpforms-media-frame',
|
| 889 |
-
frame: 'select',
|
| 890 |
-
multiple: false,
|
| 891 |
-
title: wpforms_admin.upload_image_title,
|
| 892 |
-
library: {
|
| 893 |
-
type: 'image'
|
| 894 |
-
},
|
| 895 |
-
button: {
|
| 896 |
-
text: wpforms_admin.upload_image_button
|
| 897 |
-
}
|
| 898 |
-
});
|
| 899 |
-
|
| 900 |
-
s.media_frame.on( 'select', function(){
|
| 901 |
-
// Grab our attachment selection and construct a JSON representation of the model.
|
| 902 |
-
var media_attachment = s.media_frame.state().get( 'selection' ).first().toJSON();
|
| 903 |
-
|
| 904 |
-
// Send the attachment URL to our custom input field via jQuery.
|
| 905 |
-
$setting.find( 'input[type=text]' ).val( media_attachment.url );
|
| 906 |
-
$setting.find( 'img' ).remove();
|
| 907 |
-
$setting.prepend( '<img src="'+media_attachment.url+'">' );
|
| 908 |
-
});
|
| 909 |
-
|
| 910 |
-
// Now that everything has been set, let's open up the frame.
|
| 911 |
-
s.media_frame.open();
|
| 912 |
-
},
|
| 913 |
-
|
| 914 |
-
/**
|
| 915 |
-
* Verify a license key.
|
| 916 |
-
*
|
| 917 |
-
* @since 1.3.9
|
| 918 |
-
*/
|
| 919 |
-
licenseVerify: function( el ) {
|
| 920 |
-
|
| 921 |
-
var $this = $( el ),
|
| 922 |
-
$row = $this.closest( '.wpforms-setting-row' ),
|
| 923 |
-
buttonWidth = $this.outerWidth(),
|
| 924 |
-
buttonLabel = $this.text(),
|
| 925 |
-
data = {
|
| 926 |
-
action: 'wpforms_verify_license',
|
| 927 |
-
nonce: wpforms_admin.nonce,
|
| 928 |
-
license: $('#wpforms-setting-license-key').val()
|
| 929 |
-
};
|
| 930 |
-
|
| 931 |
-
$this.html( s.iconSpinner ).css( 'width', buttonWidth ).prop( 'disabled', true );
|
| 932 |
-
|
| 933 |
-
$.post( wpforms_admin.ajax_url, data, function( res ) {
|
| 934 |
-
|
| 935 |
-
var icon = 'fa fa-check-circle',
|
| 936 |
-
color = 'green',
|
| 937 |
-
msg;
|
| 938 |
-
|
| 939 |
-
if ( res.success ){
|
| 940 |
-
msg = res.data.msg;
|
| 941 |
-
$row.find( '.type, .desc, #wpforms-setting-license-key-deactivate' ).show();
|
| 942 |
-
$row.find( '.type strong' ).text( res.data.type );
|
| 943 |
-
$('.wpforms-license-notice').remove();
|
| 944 |
-
} else {
|
| 945 |
-
icon = 'fa fa-exclamation-circle';
|
| 946 |
-
color = 'orange';
|
| 947 |
-
msg = res.data;
|
| 948 |
-
$row.find( '.type, .desc, #wpforms-setting-license-key-deactivate' ).hide();
|
| 949 |
-
}
|
| 950 |
-
|
| 951 |
-
$.alert({
|
| 952 |
-
title: false,
|
| 953 |
-
content: msg,
|
| 954 |
-
icon: icon,
|
| 955 |
-
type: color,
|
| 956 |
-
buttons: {
|
| 957 |
-
confirm: {
|
| 958 |
-
text: wpforms_admin.ok,
|
| 959 |
-
btnClass: 'btn-confirm',
|
| 960 |
-
keys: [ 'enter' ]
|
| 961 |
-
}
|
| 962 |
-
}
|
| 963 |
-
});
|
| 964 |
-
|
| 965 |
-
$this.html( buttonLabel ).css( 'width', 'auto' ).prop( 'disabled', false );
|
| 966 |
-
|
| 967 |
-
}).fail( function( xhr ) {
|
| 968 |
-
console.log( xhr.responseText );
|
| 969 |
-
});
|
| 970 |
-
},
|
| 971 |
-
|
| 972 |
-
/**
|
| 973 |
-
* Verify a license key.
|
| 974 |
-
*
|
| 975 |
-
* @since 1.3.9
|
| 976 |
-
*/
|
| 977 |
-
licenseDeactivate: function( el ) {
|
| 978 |
-
|
| 979 |
-
var $this = $( el ),
|
| 980 |
-
$row = $this.closest( '.wpforms-setting-row' ),
|
| 981 |
-
buttonWidth = $this.outerWidth(),
|
| 982 |
-
buttonLabel = $this.text(),
|
| 983 |
-
data = {
|
| 984 |
-
action: 'wpforms_deactivate_license',
|
| 985 |
-
nonce: wpforms_admin.nonce
|
| 986 |
-
};
|
| 987 |
-
|
| 988 |
-
$this.html( s.iconSpinner ).css( 'width', buttonWidth ).prop( 'disabled', true );
|
| 989 |
-
|
| 990 |
-
$.post( wpforms_admin.ajax_url, data, function( res ) {
|
| 991 |
-
|
| 992 |
-
var icon = 'fa fa-info-circle',
|
| 993 |
-
color = 'blue',
|
| 994 |
-
msg = res.data;
|
| 995 |
-
|
| 996 |
-
if ( res.success ){
|
| 997 |
-
$row.find( '#wpforms-setting-license-key' ).val('');
|
| 998 |
-
$row.find( '.type, .desc, #wpforms-setting-license-key-deactivate' ).hide();
|
| 999 |
-
} else {
|
| 1000 |
-
icon = 'fa fa-exclamation-circle';
|
| 1001 |
-
color = 'orange';
|
| 1002 |
-
}
|
| 1003 |
-
|
| 1004 |
-
$.alert({
|
| 1005 |
-
title: false,
|
| 1006 |
-
content: msg,
|
| 1007 |
-
icon: icon,
|
| 1008 |
-
type: color,
|
| 1009 |
-
buttons: {
|
| 1010 |
-
confirm: {
|
| 1011 |
-
text: wpforms_admin.ok,
|
| 1012 |
-
btnClass: 'btn-confirm',
|
| 1013 |
-
keys: [ 'enter' ]
|
| 1014 |
-
}
|
| 1015 |
-
}
|
| 1016 |
-
});
|
| 1017 |
-
|
| 1018 |
-
$this.html( buttonLabel ).css( 'width', 'auto' ).prop( 'disabled', false );
|
| 1019 |
-
|
| 1020 |
-
}).fail( function( xhr ) {
|
| 1021 |
-
console.log( xhr.responseText );
|
| 1022 |
-
});
|
| 1023 |
-
},
|
| 1024 |
-
|
| 1025 |
-
/**
|
| 1026 |
-
* Refresh a license key.
|
| 1027 |
-
*
|
| 1028 |
-
* @since 1.3.9
|
| 1029 |
-
*/
|
| 1030 |
-
licenseRefresh: function( el ) {
|
| 1031 |
-
|
| 1032 |
-
var $this = $( el ),
|
| 1033 |
-
$row = $this.closest( '.wpforms-setting-row' ),
|
| 1034 |
-
data = {
|
| 1035 |
-
action: 'wpforms_refresh_license',
|
| 1036 |
-
nonce: wpforms_admin.nonce,
|
| 1037 |
-
license: $('#wpforms-setting-license-key').val()
|
| 1038 |
-
};
|
| 1039 |
-
|
| 1040 |
-
$.post( wpforms_admin.ajax_url, data, function( res ) {
|
| 1041 |
-
|
| 1042 |
-
var icon = 'fa fa-check-circle',
|
| 1043 |
-
color = 'green',
|
| 1044 |
-
msg;
|
| 1045 |
-
|
| 1046 |
-
if ( res.success ){
|
| 1047 |
-
msg = res.data.msg;
|
| 1048 |
-
$row.find( '.type strong' ).text( res.data.type );
|
| 1049 |
-
} else {
|
| 1050 |
-
icon = 'fa fa-exclamation-circle';
|
| 1051 |
-
color = 'orange';
|
| 1052 |
-
msg = res.data;
|
| 1053 |
-
$row.find( '.type, .desc, #wpforms-setting-license-key-deactivate' ).hide();
|
| 1054 |
-
}
|
| 1055 |
-
|
| 1056 |
-
$.alert({
|
| 1057 |
-
title: false,
|
| 1058 |
-
content: msg,
|
| 1059 |
-
icon: icon,
|
| 1060 |
-
type: color,
|
| 1061 |
-
buttons: {
|
| 1062 |
-
confirm: {
|
| 1063 |
-
text: wpforms_admin.ok,
|
| 1064 |
-
btnClass: 'btn-confirm',
|
| 1065 |
-
keys: [ 'enter' ]
|
| 1066 |
-
}
|
| 1067 |
-
}
|
| 1068 |
-
});
|
| 1069 |
-
|
| 1070 |
-
}).fail( function( xhr ) {
|
| 1071 |
-
console.log( xhr.responseText );
|
| 1072 |
-
});
|
| 1073 |
-
},
|
| 1074 |
-
|
| 1075 |
-
/**
|
| 1076 |
-
* Connect integration provider account.
|
| 1077 |
-
*
|
| 1078 |
-
* @since 1.3.9
|
| 1079 |
-
*/
|
| 1080 |
-
integrationConnect: function( el ) {
|
| 1081 |
-
|
| 1082 |
-
var $this = $( el ),
|
| 1083 |
-
buttonWidth = $this.outerWidth(),
|
| 1084 |
-
buttonLabel = $this.text(),
|
| 1085 |
-
$provider = $this.closest( '.wpforms-settings-provider' ),
|
| 1086 |
-
data = {
|
| 1087 |
-
action : 'wpforms_settings_provider_add',
|
| 1088 |
-
data : $this.closest( 'form' ).serialize(),
|
| 1089 |
-
provider: $this.data( 'provider' ),
|
| 1090 |
-
nonce : wpforms_admin.nonce
|
| 1091 |
-
};
|
| 1092 |
-
|
| 1093 |
-
$this.html( 'Connecting...' ).css( 'width', buttonWidth ).prop( 'disabled', true );
|
| 1094 |
-
|
| 1095 |
-
$.post( wpforms_admin.ajax_url, data, function( res ) {
|
| 1096 |
-
|
| 1097 |
-
if ( res.success ){
|
| 1098 |
-
$provider.find( '.wpforms-settings-provider-accounts-list ul' ).append( res.data.html );
|
| 1099 |
-
$provider.addClass( 'connected' );
|
| 1100 |
-
$this.closest( '.wpforms-settings-provider-accounts-connect' ).slideToggle();
|
| 1101 |
-
} else {
|
| 1102 |
-
var msg = wpforms_admin.provider_auth_error;
|
| 1103 |
-
if ( res.data.error_msg ) {
|
| 1104 |
-
msg += "\n" + res.data.error_msg; // jshint ignore:line
|
| 1105 |
-
}
|
| 1106 |
-
$.alert({
|
| 1107 |
-
title: false,
|
| 1108 |
-
content: msg,
|
| 1109 |
-
icon: 'fa fa-exclamation-circle',
|
| 1110 |
-
type: 'orange',
|
| 1111 |
-
buttons: {
|
| 1112 |
-
confirm: {
|
| 1113 |
-
text: wpforms_admin.ok,
|
| 1114 |
-
btnClass: 'btn-confirm',
|
| 1115 |
-
keys: [ 'enter' ]
|
| 1116 |
-
}
|
| 1117 |
-
}
|
| 1118 |
-
});
|
| 1119 |
-
console.log(res);
|
| 1120 |
-
}
|
| 1121 |
-
|
| 1122 |
-
$this.html( buttonLabel ).css( 'width', 'auto' ).prop( 'disabled', false );
|
| 1123 |
-
|
| 1124 |
-
}).fail( function( xhr ) {
|
| 1125 |
-
console.log( xhr.responseText );
|
| 1126 |
-
});
|
| 1127 |
-
},
|
| 1128 |
-
|
| 1129 |
-
/**
|
| 1130 |
-
* Remove integration provider account.
|
| 1131 |
-
*
|
| 1132 |
-
* @since 1.3.9
|
| 1133 |
-
*/
|
| 1134 |
-
integrationDisconnect: function( el ) {
|
| 1135 |
-
|
| 1136 |
-
var $this = $( el ),
|
| 1137 |
-
data = {
|
| 1138 |
-
action : 'wpforms_settings_provider_disconnect',
|
| 1139 |
-
provider: $this.data( 'provider' ),
|
| 1140 |
-
key : $this.data( 'key'),
|
| 1141 |
-
nonce : wpforms_admin.nonce
|
| 1142 |
-
};
|
| 1143 |
-
|
| 1144 |
-
$.confirm({
|
| 1145 |
-
title: wpforms_admin.heads_up,
|
| 1146 |
-
content: wpforms_admin.provider_delete_confirm,
|
| 1147 |
-
backgroundDismiss: false,
|
| 1148 |
-
closeIcon: false,
|
| 1149 |
-
icon: 'fa fa-exclamation-circle',
|
| 1150 |
-
type: 'orange',
|
| 1151 |
-
buttons: {
|
| 1152 |
-
confirm: {
|
| 1153 |
-
text: wpforms_admin.ok,
|
| 1154 |
-
btnClass: 'btn-confirm',
|
| 1155 |
-
keys: [ 'enter' ],
|
| 1156 |
-
action: function(){
|
| 1157 |
-
$.post( wpforms_admin.ajax_url, data, function( res ) {
|
| 1158 |
-
if ( res.success ){
|
| 1159 |
-
$this.parent().parent().remove();
|
| 1160 |
-
} else {
|
| 1161 |
-
console.log( res );
|
| 1162 |
-
}
|
| 1163 |
-
}).fail( function( xhr ) {
|
| 1164 |
-
console.log( xhr.responseText );
|
| 1165 |
-
});
|
| 1166 |
-
}
|
| 1167 |
-
},
|
| 1168 |
-
cancel: {
|
| 1169 |
-
text: wpforms_admin.cancel,
|
| 1170 |
-
keys: [ 'esc' ]
|
| 1171 |
-
}
|
| 1172 |
-
}
|
| 1173 |
-
});
|
| 1174 |
-
},
|
| 1175 |
-
|
| 1176 |
-
//--------------------------------------------------------------------//
|
| 1177 |
-
// Tools.
|
| 1178 |
-
//--------------------------------------------------------------------//
|
| 1179 |
-
|
| 1180 |
-
/**
|
| 1181 |
-
* Element bindings for Tools page.
|
| 1182 |
-
*
|
| 1183 |
-
* @since 1.4.2
|
| 1184 |
-
*/
|
| 1185 |
-
initTools: function() {
|
| 1186 |
-
|
| 1187 |
-
// Run import for a specific provider.
|
| 1188 |
-
$( document ).on( 'click', '#wpforms-ssl-verify', function( event ) {
|
| 1189 |
-
|
| 1190 |
-
event.preventDefault();
|
| 1191 |
-
|
| 1192 |
-
WPFormsAdmin.verifySSLConnection();
|
| 1193 |
-
});
|
| 1194 |
-
|
| 1195 |
-
// Run import for a specific provider.
|
| 1196 |
-
$( document ).on( 'click', '#wpforms-importer-forms-submit', function( event ) {
|
| 1197 |
-
|
| 1198 |
-
event.preventDefault();
|
| 1199 |
-
|
| 1200 |
-
// Check to confirm user as selected a form.
|
| 1201 |
-
if ( $( '#wpforms-importer-forms input:checked' ).length ) {
|
| 1202 |
-
|
| 1203 |
-
var ids = [];
|
| 1204 |
-
$( '#wpforms-importer-forms input:checked' ).each( function ( i ) {
|
| 1205 |
-
ids[i] = $( this ).val();
|
| 1206 |
-
});
|
| 1207 |
-
|
| 1208 |
-
if ( ! wpforms_admin.isPro ) {
|
| 1209 |
-
// We need to analyze the forms before starting the
|
| 1210 |
-
// actual import.
|
| 1211 |
-
WPFormsAdmin.analyzeForms( ids );
|
| 1212 |
-
} else {
|
| 1213 |
-
// Begin the import process.
|
| 1214 |
-
WPFormsAdmin.importForms( ids );
|
| 1215 |
-
}
|
| 1216 |
-
|
| 1217 |
-
} else {
|
| 1218 |
-
|
| 1219 |
-
// User didn't actually select a form so alert them.
|
| 1220 |
-
$.alert({
|
| 1221 |
-
title: false,
|
| 1222 |
-
content: wpforms_admin.importer_forms_required,
|
| 1223 |
-
icon: 'fa fa-info-circle',
|
| 1224 |
-
type: 'blue',
|
| 1225 |
-
buttons: {
|
| 1226 |
-
confirm: {
|
| 1227 |
-
text: wpforms_admin.ok,
|
| 1228 |
-
btnClass: 'btn-confirm',
|
| 1229 |
-
keys: [ 'enter' ]
|
| 1230 |
-
}
|
| 1231 |
-
}
|
| 1232 |
-
});
|
| 1233 |
-
}
|
| 1234 |
-
});
|
| 1235 |
-
|
| 1236 |
-
// Continue import after analyzing.
|
| 1237 |
-
$( document ).on( 'click', '#wpforms-importer-continue-submit', function( event ) {
|
| 1238 |
-
|
| 1239 |
-
event.preventDefault();
|
| 1240 |
-
|
| 1241 |
-
WPFormsAdmin.importForms( s.formIDs );
|
| 1242 |
-
});
|
| 1243 |
-
},
|
| 1244 |
-
|
| 1245 |
-
/**
|
| 1246 |
-
* Perform test connection to verify that the current web host
|
| 1247 |
-
* can successfully make outbound SSL connections.
|
| 1248 |
-
*
|
| 1249 |
-
* @since 1.4.5
|
| 1250 |
-
*/
|
| 1251 |
-
verifySSLConnection: function() {
|
| 1252 |
-
|
| 1253 |
-
var $btn = $( '#wpforms-ssl-verify' ),
|
| 1254 |
-
btnLabel = $btn.text(),
|
| 1255 |
-
btnWidth = $btn.outerWidth(),
|
| 1256 |
-
$settings = $btn.parent(),
|
| 1257 |
-
data = {
|
| 1258 |
-
action: 'wpforms_verify_ssl',
|
| 1259 |
-
nonce: wpforms_admin.nonce
|
| 1260 |
-
};
|
| 1261 |
-
|
| 1262 |
-
$btn.css( 'width', btnWidth ).prop( 'disabled', true ).text( wpforms_admin.testing );
|
| 1263 |
-
|
| 1264 |
-
// Trigger AJAX to test connection
|
| 1265 |
-
$.post( wpforms_admin.ajax_url, data, function( res ) {
|
| 1266 |
-
|
| 1267 |
-
console.log( res );
|
| 1268 |
-
|
| 1269 |
-
// Remove any previous alerts.
|
| 1270 |
-
$settings.find( '.wpforms-alert, .wpforms-ssl-error' ).remove();
|
| 1271 |
-
|
| 1272 |
-
if ( res.success ){
|
| 1273 |
-
$btn.before( '<div class="wpforms-alert wpforms-alert-success">' + res.data.msg + '</div>' );
|
| 1274 |
-
} else {
|
| 1275 |
-
$btn.before( '<div class="wpforms-alert wpforms-alert-danger">' + res.data.msg + '</div>' );
|
| 1276 |
-
$btn.before( '<div class="wpforms-ssl-error pre-error">' + res.data.debug + '</div>' );
|
| 1277 |
-
}
|
| 1278 |
-
|
| 1279 |
-
$btn.css( 'width', btnWidth ).prop( 'disabled', false ).text( btnLabel );
|
| 1280 |
-
});
|
| 1281 |
-
},
|
| 1282 |
-
|
| 1283 |
-
/**
|
| 1284 |
-
* Begins the process of analyzing the forms.
|
| 1285 |
-
*
|
| 1286 |
-
* This runs for non-Pro installs to check if any of the forms to be
|
| 1287 |
-
* imported contain fields
|
| 1288 |
-
* not currently available.
|
| 1289 |
-
*
|
| 1290 |
-
* @since 1.4.2
|
| 1291 |
-
*/
|
| 1292 |
-
analyzeForms: function( forms ) {
|
| 1293 |
-
|
| 1294 |
-
var $processAnalyze = $( '#wpforms-importer-analyze' );
|
| 1295 |
-
|
| 1296 |
-
// Display total number of forms we have to import.
|
| 1297 |
-
$processAnalyze.find( '.form-total' ).text( forms.length );
|
| 1298 |
-
$processAnalyze.find( '.form-current' ).text( '1' );
|
| 1299 |
-
|
| 1300 |
-
// Hide the form select section.
|
| 1301 |
-
$( '#wpforms-importer-forms' ).hide();
|
| 1302 |
-
|
| 1303 |
-
// Show Analyze status.
|
| 1304 |
-
$processAnalyze.show();
|
| 1305 |
-
|
| 1306 |
-
// Create global analyze queue.
|
| 1307 |
-
s.analyzeQueue = forms;
|
| 1308 |
-
s.analyzed = 0;
|
| 1309 |
-
s.analyzeUpgrade = [];
|
| 1310 |
-
s.formIDs = forms;
|
| 1311 |
-
|
| 1312 |
-
// Analyze the first form in the queue.
|
| 1313 |
-
WPFormsAdmin.analyzeForm();
|
| 1314 |
-
},
|
| 1315 |
-
|
| 1316 |
-
/**
|
| 1317 |
-
* Analyze a single form from the queue.
|
| 1318 |
-
*
|
| 1319 |
-
* @since 1.4.2
|
| 1320 |
-
*/
|
| 1321 |
-
analyzeForm: function() {
|
| 1322 |
-
|
| 1323 |
-
var $analyzeSettings = $( '#wpforms-importer-analyze' ),
|
| 1324 |
-
formID = _.first( s.analyzeQueue ),
|
| 1325 |
-
provider = WPFormsAdmin.getQueryString( 'provider' ),
|
| 1326 |
-
data = {
|
| 1327 |
-
action: 'wpforms_import_form_' + provider,
|
| 1328 |
-
analyze: 1,
|
| 1329 |
-
form_id: formID,
|
| 1330 |
-
nonce: wpforms_admin.nonce
|
| 1331 |
-
};
|
| 1332 |
-
|
| 1333 |
-
// Trigger AJAX analyze for this form.
|
| 1334 |
-
$.post( wpforms_admin.ajax_url, data, function( res ) {
|
| 1335 |
-
|
| 1336 |
-
if ( res.success ){
|
| 1337 |
-
|
| 1338 |
-
if ( ! _.isEmpty( res.data.upgrade_plain ) || ! _.isEmpty( res.data.upgrade_omit ) ) {
|
| 1339 |
-
s.analyzeUpgrade.push({
|
| 1340 |
-
name: res.data.name,
|
| 1341 |
-
fields: _.union( res.data.upgrade_omit, res.data.upgrade_plain )
|
| 1342 |
-
});
|
| 1343 |
-
}
|
| 1344 |
-
|
| 1345 |
-
// Remove this form ID from the queue.
|
| 1346 |
-
s.analyzeQueue = _.without( s.analyzeQueue, formID );
|
| 1347 |
-
s.analyzed++;
|
| 1348 |
-
|
| 1349 |
-
if ( _.isEmpty( s.analyzeQueue ) ) {
|
| 1350 |
-
|
| 1351 |
-
if ( _.isEmpty( s.analyzeUpgrade ) ) {
|
| 1352 |
-
// Continue to import forms as no Pro fields were
|
| 1353 |
-
// found.
|
| 1354 |
-
WPFormsAdmin.importForms( s.formIDs );
|
| 1355 |
-
} else {
|
| 1356 |
-
// We found Pro fields, so alert the user.
|
| 1357 |
-
var upgradeDetails = wp.template( 'wpforms-importer-upgrade' );
|
| 1358 |
-
$analyzeSettings.find( '.upgrade' ).append( upgradeDetails( s.analyzeUpgrade ) );
|
| 1359 |
-
$analyzeSettings.find( '.upgrade' ).show();
|
| 1360 |
-
$analyzeSettings.find( '.process-analyze' ).hide();
|
| 1361 |
-
}
|
| 1362 |
-
|
| 1363 |
-
} else {
|
| 1364 |
-
// Analyze next form in the queue.
|
| 1365 |
-
$analyzeSettings.find( '.form-current' ).text( s.analyzed+1 );
|
| 1366 |
-
WPFormsAdmin.analyzeForm();
|
| 1367 |
-
}
|
| 1368 |
-
}
|
| 1369 |
-
});
|
| 1370 |
-
},
|
| 1371 |
-
|
| 1372 |
-
/**
|
| 1373 |
-
* Begins the process of importing the forms.
|
| 1374 |
-
*
|
| 1375 |
-
* @since 1.4.2
|
| 1376 |
-
*/
|
| 1377 |
-
importForms: function( forms ) {
|
| 1378 |
-
|
| 1379 |
-
var $processSettings = $( '#wpforms-importer-process' );
|
| 1380 |
-
|
| 1381 |
-
// Display total number of forms we have to import.
|
| 1382 |
-
$processSettings.find( '.form-total' ).text( forms.length );
|
| 1383 |
-
$processSettings.find( '.form-current' ).text( '1' );
|
| 1384 |
-
|
| 1385 |
-
// Hide the form select and form analyze sections.
|
| 1386 |
-
$( '#wpforms-importer-forms, #wpforms-importer-analyze' ).hide();
|
| 1387 |
-
|
| 1388 |
-
// Show processing status.
|
| 1389 |
-
$processSettings.show();
|
| 1390 |
-
|
| 1391 |
-
// Create global import queue.
|
| 1392 |
-
s.importQueue = forms;
|
| 1393 |
-
s.imported = 0;
|
| 1394 |
-
|
| 1395 |
-
// Import the first form in the queue.
|
| 1396 |
-
WPFormsAdmin.importForm();
|
| 1397 |
-
},
|
| 1398 |
-
|
| 1399 |
-
/**
|
| 1400 |
-
* Imports a single form from the import queue.
|
| 1401 |
-
*
|
| 1402 |
-
* @since 1.4.2
|
| 1403 |
-
*/
|
| 1404 |
-
importForm: function() {
|
| 1405 |
-
|
| 1406 |
-
var $processSettings = $( '#wpforms-importer-process' ),
|
| 1407 |
-
formID = _.first( s.importQueue ),
|
| 1408 |
-
provider = WPFormsAdmin.getQueryString( 'provider' ),
|
| 1409 |
-
data = {
|
| 1410 |
-
action: 'wpforms_import_form_' + provider,
|
| 1411 |
-
form_id: formID,
|
| 1412 |
-
nonce: wpforms_admin.nonce
|
| 1413 |
-
};
|
| 1414 |
-
|
| 1415 |
-
// Trigger AJAX import for this form.
|
| 1416 |
-
$.post( wpforms_admin.ajax_url, data, function( res ) {
|
| 1417 |
-
|
| 1418 |
-
if ( res.success ){
|
| 1419 |
-
var statusUpdate;
|
| 1420 |
-
|
| 1421 |
-
if ( res.data.error ) {
|
| 1422 |
-
statusUpdate = wp.template( 'wpforms-importer-status-error' );
|
| 1423 |
-
} else {
|
| 1424 |
-
statusUpdate = wp.template( 'wpforms-importer-status-update' );
|
| 1425 |
-
}
|
| 1426 |
-
|
| 1427 |
-
$processSettings.find( '.status' ).prepend( statusUpdate( res.data ) );
|
| 1428 |
-
$processSettings.find( '.status' ).show();
|
| 1429 |
-
|
| 1430 |
-
// Remove this form ID from the queue.
|
| 1431 |
-
s.importQueue = _.without( s.importQueue, formID );
|
| 1432 |
-
s.imported++;
|
| 1433 |
-
|
| 1434 |
-
if ( _.isEmpty( s.importQueue ) ) {
|
| 1435 |
-
$processSettings.find( '.process-count' ).hide();
|
| 1436 |
-
$processSettings.find( '.forms-completed' ).text( s.imported );
|
| 1437 |
-
$processSettings.find( '.process-completed' ).show();
|
| 1438 |
-
} else {
|
| 1439 |
-
// Import next form in the queue.
|
| 1440 |
-
$processSettings.find( '.form-current' ).text( s.imported+1 );
|
| 1441 |
-
WPFormsAdmin.importForm();
|
| 1442 |
-
}
|
| 1443 |
-
}
|
| 1444 |
-
});
|
| 1445 |
-
},
|
| 1446 |
-
|
| 1447 |
-
//--------------------------------------------------------------------//
|
| 1448 |
-
// Upgrades (Tabs view).
|
| 1449 |
-
//--------------------------------------------------------------------//
|
| 1450 |
-
|
| 1451 |
-
/**
|
| 1452 |
-
* Element bindings for Tools page.
|
| 1453 |
-
*
|
| 1454 |
-
* @since 1.4.3
|
| 1455 |
-
*/
|
| 1456 |
-
initUpgrades: function() {
|
| 1457 |
-
|
| 1458 |
-
// Prepare to run the v1.4.3 upgrade routine.
|
| 1459 |
-
$( document ).on( 'click', '#wpforms-upgrade-143 button', function( event ) {
|
| 1460 |
-
|
| 1461 |
-
event.preventDefault();
|
| 1462 |
-
|
| 1463 |
-
var $this = $( this ),
|
| 1464 |
-
buttonWidth = $this.outerWidth(),
|
| 1465 |
-
$status = $( '#wpforms-upgrade-143 .status' ),
|
| 1466 |
-
data = {
|
| 1467 |
-
action: 'wpforms_upgrade_143',
|
| 1468 |
-
nonce: wpforms_admin.nonce,
|
| 1469 |
-
init: true,
|
| 1470 |
-
incomplete: $this.data( 'incomplete' )
|
| 1471 |
-
};
|
| 1472 |
-
|
| 1473 |
-
// Change the button to indicate we are doing initial processing.
|
| 1474 |
-
$this.html( s.iconSpinner ).css( 'width', buttonWidth ).prop( 'disabled', true );
|
| 1475 |
-
|
| 1476 |
-
// Get the total number of entries, then kick off the routine.
|
| 1477 |
-
$.post( wpforms_admin.ajax_url, data, function( res ) {
|
| 1478 |
-
if ( res.success ){
|
| 1479 |
-
|
| 1480 |
-
// Set initial values.
|
| 1481 |
-
s.upgraded = Number( res.data.upgraded );
|
| 1482 |
-
s.upgradeTotal = Number( res.data.total );
|
| 1483 |
-
var percent = Math.round( ( Number( s.upgraded ) / Number( s.upgradeTotal ) ) * 100 );
|
| 1484 |
-
|
| 1485 |
-
// Show the status area.
|
| 1486 |
-
$this.remove();
|
| 1487 |
-
$status.find( '.bar' ).css( 'width', percent + '%' );
|
| 1488 |
-
$status.show().find( '.total' ).text( s.upgradeTotal );
|
| 1489 |
-
$status.find( '.current' ).text( s.upgraded );
|
| 1490 |
-
$status.find( '.percent' ).text( percent + '%' );
|
| 1491 |
-
|
| 1492 |
-
// Begin the actual upgrade routine.
|
| 1493 |
-
WPFormsAdmin.upgrade143();
|
| 1494 |
-
}
|
| 1495 |
-
});
|
| 1496 |
-
});
|
| 1497 |
-
},
|
| 1498 |
-
|
| 1499 |
-
/**
|
| 1500 |
-
* The v1.4.3 entry fields upgrade routine.
|
| 1501 |
-
*
|
| 1502 |
-
* @since 1.4.3
|
| 1503 |
-
*/
|
| 1504 |
-
upgrade143: function() {
|
| 1505 |
-
|
| 1506 |
-
var $status = $( '#wpforms-upgrade-143 .status' ),
|
| 1507 |
-
data = {
|
| 1508 |
-
action: 'wpforms_upgrade_143',
|
| 1509 |
-
nonce: wpforms_admin.nonce,
|
| 1510 |
-
upgraded: s.upgraded
|
| 1511 |
-
};
|
| 1512 |
-
|
| 1513 |
-
// Get the total number of entries, then kick off the routine.
|
| 1514 |
-
$.post( wpforms_admin.ajax_url, data, function( res ) {
|
| 1515 |
-
if ( res.success ){
|
| 1516 |
-
|
| 1517 |
-
s.upgraded = Number( s.upgraded ) + Number( res.data.count );
|
| 1518 |
-
var percent = Math.round( ( Number( s.upgraded ) / Number( s.upgradeTotal ) ) * 100 );
|
| 1519 |
-
|
| 1520 |
-
// Update progress bar.
|
| 1521 |
-
$status.find( '.bar' ).css( 'width', percent + '%' );
|
| 1522 |
-
|
| 1523 |
-
if ( Number( res.data.count ) < 10 ) {
|
| 1524 |
-
// This batch completed the upgrade routine.
|
| 1525 |
-
$status.find( '.progress-bar' ).addClass( 'complete' );
|
| 1526 |
-
$status.find( '.msg' ).text( wpforms_admin.upgrade_completed );
|
| 1527 |
-
} else {
|
| 1528 |
-
|
| 1529 |
-
$status.find( '.current' ).text( s.upgraded );
|
| 1530 |
-
$status.find( '.percent' ).text( percent + '%' );
|
| 1531 |
-
|
| 1532 |
-
// Batch the next round of entries.
|
| 1533 |
-
WPFormsAdmin.upgrade143();
|
| 1534 |
-
}
|
| 1535 |
-
}
|
| 1536 |
-
});
|
| 1537 |
-
},
|
| 1538 |
-
|
| 1539 |
-
//--------------------------------------------------------------------//
|
| 1540 |
-
// Helper functions.
|
| 1541 |
-
//--------------------------------------------------------------------//
|
| 1542 |
-
|
| 1543 |
-
/**
|
| 1544 |
-
* Return if the target nodeName is a form element.
|
| 1545 |
-
*
|
| 1546 |
-
* @since 1.4.0
|
| 1547 |
-
*/
|
| 1548 |
-
isFormTypeNode: function( name ) {
|
| 1549 |
-
|
| 1550 |
-
name = name || false;
|
| 1551 |
-
|
| 1552 |
-
if ( 'TEXTAREA' === name || 'INPUT' === name || 'SELECT' === name ){
|
| 1553 |
-
return true;
|
| 1554 |
-
}
|
| 1555 |
-
|
| 1556 |
-
return false;
|
| 1557 |
-
},
|
| 1558 |
-
|
| 1559 |
-
/**
|
| 1560 |
-
* Get query string in a URL.
|
| 1561 |
-
*
|
| 1562 |
-
* @since 1.3.9
|
| 1563 |
-
*/
|
| 1564 |
-
getQueryString: function( name ) {
|
| 1565 |
-
|
| 1566 |
-
var match = new RegExp( '[?&]' + name + '=([^&]*)' ).exec( window.location.search );
|
| 1567 |
-
return match && decodeURIComponent( match[1].replace(/\+/g, ' ') );
|
| 1568 |
-
},
|
| 1569 |
-
|
| 1570 |
-
/**
|
| 1571 |
-
* Debug output helper.
|
| 1572 |
-
*
|
| 1573 |
-
* @since 1.4.4
|
| 1574 |
-
* @param msg
|
| 1575 |
-
*/
|
| 1576 |
-
debug: function( msg ) {
|
| 1577 |
-
|
| 1578 |
-
if ( WPFormsAdmin.isDebug() ) {
|
| 1579 |
-
if ( typeof msg === 'object' || msg.constructor === Array ) {
|
| 1580 |
-
console.log( 'WPForms Debug:' );
|
| 1581 |
-
console.log( msg );
|
| 1582 |
-
} else {
|
| 1583 |
-
console.log( 'WPForms Debug: ' + msg );
|
| 1584 |
-
}
|
| 1585 |
-
}
|
| 1586 |
-
},
|
| 1587 |
-
|
| 1588 |
-
/**
|
| 1589 |
-
* Is debug mode.
|
| 1590 |
-
*
|
| 1591 |
-
* @since 1.4.4
|
| 1592 |
-
*/
|
| 1593 |
-
isDebug: function() {
|
| 1594 |
-
|
| 1595 |
-
return ( window.location.hash && '#wpformsdebug' === window.location.hash );
|
| 1596 |
-
}
|
| 1597 |
-
};
|
| 1598 |
-
|
| 1599 |
-
WPFormsAdmin.init();
|
| 1600 |
-
|
| 1601 |
-
window.WPFormsAdmin = WPFormsAdmin;
|
| 1602 |
-
|
| 1603 |
-
})( jQuery );
|
| 1 |
+
!function(e){"use strict";var t,n={settings:{iconActivate:'<i class="fa fa-toggle-on fa-flip-horizontal" aria-hidden="true"></i>',iconDeactivate:'<i class="fa fa-toggle-on" aria-hidden="true"></i>',iconInstall:'<i class="fa fa-cloud-download" aria-hidden="true"></i>',iconSpinner:'<i class="fa fa-spinner fa-spin" aria-hidden="true"></i>',mediaFrame:!1},init:function(){t=this.settings,e(document).ready(n.ready),n.initFormOverview(),n.initEntriesSingle(),n.initEntriesList(),n.initWelcome(),n.initAddons(),n.initSettings(),n.initTools(),n.initUpgrades()},ready:function(){e(".notice").show(),e("#screen-meta-links, #screen-meta").prependTo("#wpforms-header-temp").show(),n.initChoicesJS(),n.initCheckboxMultiselectColumns(),e(".wpforms-color-picker").minicolors(),e(".wpforms-file-upload").each(function(){var t=e(this).find("input[type=file]"),n=e(this).find("label"),o=n.html();t.on("change",function(e){var t="";this.files&&this.files.length>1?t=(this.getAttribute("data-multiple-caption")||"").replace("{count}",this.files.length):e.target.value&&(t=e.target.value.split("\\").pop()),t?n.find(".fld").html(t):n.html(o)}),t.on("focus",function(){t.addClass("has-focus")}).on("blur",function(){t.removeClass("has-focus")})}),jconfirm.defaults={closeIcon:!0,backgroundDismiss:!0,escapeKey:!0,animationBounce:1,useBootstrap:!1,theme:"modern",boxWidth:"400px",animateFromElement:!1},e(document).on("click",".wpforms-upgrade-modal",function(){e.alert({title:!1,content:wpforms_admin.upgrade_modal,icon:"fa fa-info-circle",type:"blue",boxWidth:"565px",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}})}),e(document).trigger("wpformsReady")},initChoicesJS:function(){e(".choicesjs-select").each(function(){var t=e(this),n={searchEnabled:!1};t.attr("multiple")&&(n.searchEnabled=!0,n.removeItemButton=!0),t.data("placeholder")&&(n.placeholderValue=t.data("placeholder")),"off"===t.data("sorting")&&(n.shouldSort=!1),t.data("search")&&(n.searchEnabled=!0),new Choices(t[0],n)})},initCheckboxMultiselectColumns:function(){e(document).on("change",".checkbox-multiselect-columns input",function(){var t=e(this),n=t.parent(),o=t.closest(".checkbox-multiselect-columns"),i=n.text(),r="check-item-"+t.val(),s=o.find("#"+r);t.prop("checked")?(t.parent().addClass("checked"),s.length||o.find(".second-column ul").append('<li id="'+r+'">'+i+"</li>")):(t.parent().removeClass("checked"),o.find("#"+r).remove())}),e(document).on("click",".checkbox-multiselect-columns .all",function(t){t.preventDefault(),e(this).closest(".checkbox-multiselect-columns").find("input[type=checkbox]").prop("checked",!0).trigger("change"),e(this).remove()})},initFormOverview:function(){e(document).on("click","#wpforms-overview .wp-list-table .delete a, #wpforms-overview .wp-list-table .duplicate a",function(t){t.preventDefault();var n=e(this).attr("href"),o=e(this).parent().hasClass("delete")?wpforms_admin.form_delete_confirm:wpforms_admin.form_duplicate_confirm;e.confirm({title:!1,content:o,backgroundDismiss:!1,closeIcon:!1,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){window.location=n}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})})},initEntriesSingle:function(){"wpforms-entries"===n.getQueryString("page")&&"details"===n.getQueryString("view")&&n.entryHotkeys(),e(document).on("click","#wpforms-entries-single .submitdelete",function(t){t.preventDefault();var n=e(this).attr("href");e.confirm({title:!1,content:wpforms_admin.entry_delete_confirm,backgroundDismiss:!1,closeIcon:!1,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){window.location=n}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})}),e(document).on("click","#wpforms-entries-single .wpforms-entry-print a",function(t){t.preventDefault(),window.open(e(this).attr("href"))}),e(document).on("click","#wpforms-entries-single .wpforms-empty-field-toggle",function(t){t.preventDefault(),"true"===wpCookies.get("wpforms_entry_hide_empty")?(wpCookies.remove("wpforms_entry_hide_empty"),e(this).text(wpforms_admin.entry_empty_fields_hide)):(wpCookies.set("wpforms_entry_hide_empty","true",2592e3),e(this).text(wpforms_admin.entry_empty_fields_show)),e(".wpforms-entry-field.empty").toggle()}),e(document).on("click","#wpforms-entries-single .wpforms-entry-notes-new .add",function(t){t.preventDefault(),e(this).hide().next("form").slideToggle()}),e(document).on("click","#wpforms-entries-single .wpforms-entry-notes-new .cancel",function(t){t.preventDefault(),e(this).closest("form").slideToggle(),e(".wpforms-entry-notes-new .add").show()}),e(document).on("click","#wpforms-entries-single .wpforms-entry-notes-byline .note-delete",function(t){t.preventDefault();var n=e(this).attr("href");e.confirm({title:!1,content:wpforms_admin.entry_note_delete_confirm,backgroundDismiss:!1,closeIcon:!1,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){window.location=n}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})})},entryHotkeys:function(){e(document).keydown(function(t){if(74!==t.keyCode||n.isFormTypeNode(t.target.nodeName)){if(75===t.keyCode&&!n.isFormTypeNode(t.target.nodeName)){var o=e("#wpforms-entry-next-link").attr("href");"#"!==o&&(window.location.href=o)}}else{var i=e("#wpforms-entry-prev-link").attr("href");"#"!==i&&(window.location.href=i)}})},initEntriesList:function(){e(document).on("click","#wpforms-entries-table-edit-columns",function(e){e.preventDefault(),n.entriesListFieldColumn()}),e(document).on("click","#wpforms-entries-list .form-selector .toggle",function(t){t.preventDefault(),e(this).toggleClass("active").next(".form-list").toggle()}),e(document).on("click","#wpforms-entries-list .wp-list-table .delete",function(t){t.preventDefault();var n=e(this).attr("href");e.confirm({title:!1,content:wpforms_admin.entry_delete_confirm,backgroundDismiss:!1,closeIcon:!1,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){window.location=n}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})}),e(document).on("click","#wpforms-entries-list .wp-list-table .indicator-star",function(t){t.preventDefault();var n=e(this),o="",i=Number(e("#wpforms-entries-list .starred-num").text()),r=n.data("id");n.hasClass("star")?(o="star",i++,n.attr("title",wpforms_admin.entry_unstar)):(o="unstar",i--,n.attr("title",wpforms_admin.entry_star)),n.toggleClass("star unstar"),e("#wpforms-entries-list .starred-num").text(i);var s={task:o,action:"wpforms_entry_list_star",nonce:wpforms_admin.nonce,entry_id:r};e.post(wpforms_admin.ajax_url,s)}),e(document).on("click","#wpforms-entries-list .wp-list-table .indicator-read",function(t){t.preventDefault();var n=e(this),o="",i=Number(e("#wpforms-entries-list .unread-num").text()),r=n.data("id");n.hasClass("read")?(o="read",i--,n.attr("title",wpforms_admin.entry_unread)):(o="unread",i++,n.attr("title",wpforms_admin.entry_read)),n.toggleClass("read unread"),e("#wpforms-entries-list .unread-num").text(i);var s={task:o,action:"wpforms_entry_list_read",nonce:wpforms_admin.nonce,entry_id:r};e.post(wpforms_admin.ajax_url,s)}),e(document).on("click","#wpforms-entries-list .form-details-actions-deleteall",function(t){t.preventDefault();var n=e(this).attr("href");e.confirm({title:wpforms_admin.heads_up,content:wpforms_admin.entry_delete_all_confirm,backgroundDismiss:!1,closeIcon:!1,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){window.location=n}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})})},entriesListFieldColumn:function(){e.alert({title:wpforms_admin.entry_field_columns,boxWidth:"500px",content:t.iconSpinner+e("#wpforms-field-column-select").html(),onContentReady:function(){var t=this.$content,n=t.find("select"),o=new Choices(n[0],{maxItemCount:5,placeholderValue:wpforms_admin.fields_select+"...",removeItemButton:!0,shouldSort:!1,callbackOnInit:function(){t.find(".fa").remove(),t.find("form").show()}});e(".jconfirm-content-pane, .jconfirm-box").css("overflow","visible"),o.passedElement.addEventListener("change",function(){o.hideDropdown()},!1)},buttons:{confirm:{text:wpforms_admin.save_refresh,btnClass:"btn-confirm",keys:["enter"],action:function(){this.$content.find("form").submit()}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})},initWelcome:function(){e(document).on("click","#wpforms-welcome .play-video",function(t){t.preventDefault();e.dialog({title:!1,content:'<div class="video-container"><iframe width="1280" height="720" src="https://www.youtube-nocookie.com/embed/yDyvSGV7tP4?rel=0&showinfo=0&autoplay=1" frameborder="0" allowfullscreen></iframe></div>',closeIcon:!0,boxWidth:"70%"})})},initAddons:function(){e(document).on("wpformsReady",function(){if(e("#wpforms-admin-addons").length){e(".addon-item .details").matchHeight({byrow:!1,property:"height"});var t=new List("wpforms-admin-addons-list",{valueNames:["addon-name"]});e("#wpforms-admin-addons-search").on("keyup",function(){t.search(e(this).val())})}}),e(document).on("wpformsReady",function(){e("#wpforms-admin-addons").length&&e(".addon-item .details").matchHeight({byrow:!1,property:"min-height"})}),e(document).on("click","#wpforms-admin-addons .addon-item button",function(t){t.preventDefault(),n.addonToggle(e(this))})},addonToggle:function(n){var o,i,r,s,a,c,m=e(n),d=m.closest(".addon-item"),l=m.attr("data-plugin");if(m.prop("disabled",!0).addClass("loading"),m.html(t.iconSpinner),m.hasClass("status-active"))o="wpforms_deactivate_addon",i="status-inactive",r=wpforms_admin.addon_inactive,s=t.iconActivate+wpforms_admin.addon_activate,a=t.iconDeactivate+wpforms_admin.addon_deactivate;else if(m.hasClass("status-inactive"))o="wpforms_activate_addon",i="status-active",r=wpforms_admin.addon_active,s=t.iconDeactivate+wpforms_admin.addon_deactivate,a=t.iconActivate+wpforms_admin.addon_activate;else{if(!m.hasClass("status-download"))return;o="wpforms_install_addon",i="status-inactive",r=wpforms_admin.addon_inactive,s=t.iconActivate+wpforms_admin.addon_activate,a=t.iconInstall+wpforms_admin.addon_install}var f={action:o,nonce:wpforms_admin.nonce,plugin:l};e.post(wpforms_admin.ajax_url,f,function(t){t.success?("wpforms_install_addon"===o?(m.attr("data-plugin",t.data.basename),c=t.data.msg):c=t.data,d.find(".actions").append('<div class="msg success">'+c+"</div>"),d.find("span.status-label").removeClass("status-active status-inactive status-download").addClass(i).text(r),m.removeClass("status-active status-inactive status-download").addClass(i).html(s)):(d.find(".actions").append('<div class="msg error">'+t.data+"</div>"),m.html(a)),m.prop("disabled",!1).removeClass("loading"),setTimeout(function(){e(".addon-item .msg").remove()},3e3)}).fail(function(e){console.log(e.responseText)})},initSettings:function(){e(document).on("wpformsReady",function(){if(e("#wpforms-settings").length){var t=n.getQueryString("wpforms-integration"),o=n.getQueryString("jump");t?e("body").animate({scrollTop:e("#wpforms-integration-"+t).offset().top},1e3):o&&e("body").animate({scrollTop:e("#"+o).offset().top},1e3)}}),e(document).on("click",".wpforms-setting-row-image button",function(t){t.preventDefault(),n.imageUploadModal(e(this))}),e(document).on("click","#wpforms-setting-license-key-verify",function(t){t.preventDefault(),n.licenseVerify(e(this))}),e(document).on("click","#wpforms-setting-license-key-deactivate",function(t){t.preventDefault(),n.licenseDeactivate(e(this))}),e(document).on("click","#wpforms-setting-license-key-refresh",function(t){t.preventDefault(),n.licenseRefresh(e(this))}),e(document).on("click",".wpforms-settings-provider-connect",function(t){t.preventDefault(),n.integrationConnect(e(this))}),e(document).on("click",".wpforms-settings-provider-accounts-list a",function(t){t.preventDefault(),n.integrationDisconnect(e(this))}),e(document).on("click",".wpforms-settings-provider-header",function(t){t.preventDefault(),e(this).parent().find(".wpforms-settings-provider-accounts").slideToggle(),e(this).parent().find(".wpforms-settings-provider-logo i").toggleClass("fa-chevron-right fa-chevron-down")}),e(document).on("click",".wpforms-settings-provider-accounts-toggle a",function(t){t.preventDefault();var n=e(this).parent().next(".wpforms-settings-provider-accounts-connect");n.find("input[type=text], input[type=password]").val(""),n.slideToggle()})},imageUploadModal:function(n){if(t.media_frame)t.media_frame.open();else{var o=e(n).closest(".wpforms-setting-field");t.media_frame=wp.media.frames.wpforms_media_frame=wp.media({className:"media-frame wpforms-media-frame",frame:"select",multiple:!1,title:wpforms_admin.upload_image_title,library:{type:"image"},button:{text:wpforms_admin.upload_image_button}}),t.media_frame.on("select",function(){var e=t.media_frame.state().get("selection").first().toJSON();o.find("input[type=text]").val(e.url),o.find("img").remove(),o.prepend('<img src="'+e.url+'">')}),t.media_frame.open()}},licenseVerify:function(n){var o=e(n),i=o.closest(".wpforms-setting-row"),r=o.outerWidth(),s=o.text(),a={action:"wpforms_verify_license",nonce:wpforms_admin.nonce,license:e("#wpforms-setting-license-key").val()};o.html(t.iconSpinner).css("width",r).prop("disabled",!0),e.post(wpforms_admin.ajax_url,a,function(t){var n,r="fa fa-check-circle",a="green";t.success?(n=t.data.msg,i.find(".type, .desc, #wpforms-setting-license-key-deactivate").show(),i.find(".type strong").text(t.data.type),e(".wpforms-license-notice").remove()):(r="fa fa-exclamation-circle",a="orange",n=t.data,i.find(".type, .desc, #wpforms-setting-license-key-deactivate").hide()),e.alert({title:!1,content:n,icon:r,type:a,buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}}),o.html(s).css("width","auto").prop("disabled",!1)}).fail(function(e){console.log(e.responseText)})},licenseDeactivate:function(n){var o=e(n),i=o.closest(".wpforms-setting-row"),r=o.outerWidth(),s=o.text(),a={action:"wpforms_deactivate_license",nonce:wpforms_admin.nonce};o.html(t.iconSpinner).css("width",r).prop("disabled",!0),e.post(wpforms_admin.ajax_url,a,function(t){var n="fa fa-info-circle",r="blue",a=t.data;t.success?(i.find("#wpforms-setting-license-key").val(""),i.find(".type, .desc, #wpforms-setting-license-key-deactivate").hide()):(n="fa fa-exclamation-circle",r="orange"),e.alert({title:!1,content:a,icon:n,type:r,buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}}),o.html(s).css("width","auto").prop("disabled",!1)}).fail(function(e){console.log(e.responseText)})},licenseRefresh:function(t){var n=e(t).closest(".wpforms-setting-row"),o={action:"wpforms_refresh_license",nonce:wpforms_admin.nonce,license:e("#wpforms-setting-license-key").val()};e.post(wpforms_admin.ajax_url,o,function(t){var o,i="fa fa-check-circle",r="green";t.success?(o=t.data.msg,n.find(".type strong").text(t.data.type)):(i="fa fa-exclamation-circle",r="orange",o=t.data,n.find(".type, .desc, #wpforms-setting-license-key-deactivate").hide()),e.alert({title:!1,content:o,icon:i,type:r,buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}})}).fail(function(e){console.log(e.responseText)})},integrationConnect:function(t){var n=e(t),o=n.outerWidth(),i=n.text(),r=n.closest(".wpforms-settings-provider"),s={action:"wpforms_settings_provider_add",data:n.closest("form").serialize(),provider:n.data("provider"),nonce:wpforms_admin.nonce};n.html("Connecting...").css("width",o).prop("disabled",!0),e.post(wpforms_admin.ajax_url,s,function(t){if(t.success)r.find(".wpforms-settings-provider-accounts-list ul").append(t.data.html),r.addClass("connected"),n.closest(".wpforms-settings-provider-accounts-connect").slideToggle();else{var o=wpforms_admin.provider_auth_error;t.data.error_msg&&(o+="\n"+t.data.error_msg),e.alert({title:!1,content:o,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}}),console.log(t)}n.html(i).css("width","auto").prop("disabled",!1)}).fail(function(e){console.log(e.responseText)})},integrationDisconnect:function(t){var n=e(t),o={action:"wpforms_settings_provider_disconnect",provider:n.data("provider"),key:n.data("key"),nonce:wpforms_admin.nonce};e.confirm({title:wpforms_admin.heads_up,content:wpforms_admin.provider_delete_confirm,backgroundDismiss:!1,closeIcon:!1,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){e.post(wpforms_admin.ajax_url,o,function(e){e.success?n.parent().parent().remove():console.log(e)}).fail(function(e){console.log(e.responseText)})}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})},initTools:function(){e(document).on("click","#wpforms-ssl-verify",function(e){e.preventDefault(),n.verifySSLConnection()}),e(document).on("click","#wpforms-importer-forms-submit",function(t){if(t.preventDefault(),e("#wpforms-importer-forms input:checked").length){var o=[];e("#wpforms-importer-forms input:checked").each(function(t){o[t]=e(this).val()}),wpforms_admin.isPro?n.importForms(o):n.analyzeForms(o)}else e.alert({title:!1,content:wpforms_admin.importer_forms_required,icon:"fa fa-info-circle",type:"blue",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}})}),e(document).on("click","#wpforms-importer-continue-submit",function(e){e.preventDefault(),n.importForms(t.formIDs)})},verifySSLConnection:function(){var t=e("#wpforms-ssl-verify"),n=t.text(),o=t.outerWidth(),i=t.parent(),r={action:"wpforms_verify_ssl",nonce:wpforms_admin.nonce};t.css("width",o).prop("disabled",!0).text(wpforms_admin.testing),e.post(wpforms_admin.ajax_url,r,function(e){console.log(e),i.find(".wpforms-alert, .wpforms-ssl-error").remove(),e.success?t.before('<div class="wpforms-alert wpforms-alert-success">'+e.data.msg+"</div>"):(t.before('<div class="wpforms-alert wpforms-alert-danger">'+e.data.msg+"</div>"),t.before('<div class="wpforms-ssl-error pre-error">'+e.data.debug+"</div>")),t.css("width",o).prop("disabled",!1).text(n)})},analyzeForms:function(o){var i=e("#wpforms-importer-analyze");i.find(".form-total").text(o.length),i.find(".form-current").text("1"),e("#wpforms-importer-forms").hide(),i.show(),t.analyzeQueue=o,t.analyzed=0,t.analyzeUpgrade=[],t.formIDs=o,n.analyzeForm()},analyzeForm:function(){var o=e("#wpforms-importer-analyze"),i=_.first(t.analyzeQueue),r={action:"wpforms_import_form_"+n.getQueryString("provider"),analyze:1,form_id:i,nonce:wpforms_admin.nonce};e.post(wpforms_admin.ajax_url,r,function(e){if(e.success)if(_.isEmpty(e.data.upgrade_plain)&&_.isEmpty(e.data.upgrade_omit)||t.analyzeUpgrade.push({name:e.data.name,fields:_.union(e.data.upgrade_omit,e.data.upgrade_plain)}),t.analyzeQueue=_.without(t.analyzeQueue,i),t.analyzed++,_.isEmpty(t.analyzeQueue))if(_.isEmpty(t.analyzeUpgrade))n.importForms(t.formIDs);else{var r=wp.template("wpforms-importer-upgrade");o.find(".upgrade").append(r(t.analyzeUpgrade)),o.find(".upgrade").show(),o.find(".process-analyze").hide()}else o.find(".form-current").text(t.analyzed+1),n.analyzeForm()})},importForms:function(o){var i=e("#wpforms-importer-process");i.find(".form-total").text(o.length),i.find(".form-current").text("1"),e("#wpforms-importer-forms, #wpforms-importer-analyze").hide(),i.show(),t.importQueue=o,t.imported=0,n.importForm()},importForm:function(){var o=e("#wpforms-importer-process"),i=_.first(t.importQueue),r={action:"wpforms_import_form_"+n.getQueryString("provider"),form_id:i,nonce:wpforms_admin.nonce};e.post(wpforms_admin.ajax_url,r,function(e){if(e.success){var r;r=e.data.error?wp.template("wpforms-importer-status-error"):wp.template("wpforms-importer-status-update"),o.find(".status").prepend(r(e.data)),o.find(".status").show(),t.importQueue=_.without(t.importQueue,i),t.imported++,_.isEmpty(t.importQueue)?(o.find(".process-count").hide(),o.find(".forms-completed").text(t.imported),o.find(".process-completed").show()):(o.find(".form-current").text(t.imported+1),n.importForm())}})},initUpgrades:function(){e(document).on("click","#wpforms-upgrade-143 button",function(o){o.preventDefault();var i=e(this),r=i.outerWidth(),s=e("#wpforms-upgrade-143 .status"),a={action:"wpforms_upgrade_143",nonce:wpforms_admin.nonce,init:!0,incomplete:i.data("incomplete")};i.html(t.iconSpinner).css("width",r).prop("disabled",!0),e.post(wpforms_admin.ajax_url,a,function(e){if(e.success){t.upgraded=Number(e.data.upgraded),t.upgradeTotal=Number(e.data.total);var o=Math.round(Number(t.upgraded)/Number(t.upgradeTotal)*100);i.remove(),s.find(".bar").css("width",o+"%"),s.show().find(".total").text(t.upgradeTotal),s.find(".current").text(t.upgraded),s.find(".percent").text(o+"%"),n.upgrade143()}})})},upgrade143:function(){var o=e("#wpforms-upgrade-143 .status"),i={action:"wpforms_upgrade_143",nonce:wpforms_admin.nonce,upgraded:t.upgraded};e.post(wpforms_admin.ajax_url,i,function(e){if(e.success){t.upgraded=Number(t.upgraded)+Number(e.data.count);var i=Math.round(Number(t.upgraded)/Number(t.upgradeTotal)*100);o.find(".bar").css("width",i+"%"),Number(e.data.count)<10?(o.find(".progress-bar").addClass("complete"),o.find(".msg").text(wpforms_admin.upgrade_completed)):(o.find(".current").text(t.upgraded),o.find(".percent").text(i+"%"),n.upgrade143())}})},isFormTypeNode:function(e){return"TEXTAREA"===(e=e||!1)||"INPUT"===e||"SELECT"===e},getQueryString:function(e){var t=new RegExp("[?&]"+e+"=([^&]*)").exec(window.location.search);return t&&decodeURIComponent(t[1].replace(/\+/g," "))},debug:function(e){n.isDebug()&&("object"==typeof e||e.constructor===Array?(console.log("WPForms Debug:"),console.log(e)):console.log("WPForms Debug: "+e))},isDebug:function(){return window.location.hash&&"#wpformsdebug"===window.location.hash}};n.init(),window.WPFormsAdmin=n}(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
changelog.txt
CHANGED
|
@@ -1,5 +1,8 @@
|
|
| 1 |
== Changelog ==
|
| 2 |
|
|
|
|
|
|
|
|
|
|
| 3 |
= 1.4.5 =
|
| 4 |
- Added: Image choices feature with Checkbox and Multiple Choice fields; Images can now be uploaded and displayed with your choices!
|
| 5 |
- Added: Custom input masks for Single Line Text fields (Advanced Options).
|
| 1 |
== Changelog ==
|
| 2 |
|
| 3 |
+
= 1.4.5.1 =
|
| 4 |
+
- Fixed: Dynamic choices not displaying correctly for Multiple Choice and Checkbox fields.
|
| 5 |
+
|
| 6 |
= 1.4.5 =
|
| 7 |
- Added: Image choices feature with Checkbox and Multiple Choice fields; Images can now be uploaded and displayed with your choices!
|
| 8 |
- Added: Custom input masks for Single Line Text fields (Advanced Options).
|
includes/fields/class-base.php
CHANGED
|
@@ -572,7 +572,7 @@ abstract class WPForms_Field {
|
|
| 572 |
$note = sprintf( '<div class="wpforms-alert-warning wpforms-alert-small wpforms-alert %s">',
|
| 573 |
! empty( $field['choices_images'] ) ? '' : 'wpforms-hidden'
|
| 574 |
);
|
| 575 |
-
$note .= esc_html__( 'Images are not cropped or resized. For best
|
| 576 |
$note .= '</div>';
|
| 577 |
|
| 578 |
// Field contents.
|
|
@@ -983,7 +983,7 @@ abstract class WPForms_Field {
|
|
| 983 |
}
|
| 984 |
|
| 985 |
$list_class = array( 'primary-input' );
|
| 986 |
-
$images = empty( $field['
|
| 987 |
|
| 988 |
if ( $images ) {
|
| 989 |
$list_class[] = 'wpforms-image-choices';
|
| 572 |
$note = sprintf( '<div class="wpforms-alert-warning wpforms-alert-small wpforms-alert %s">',
|
| 573 |
! empty( $field['choices_images'] ) ? '' : 'wpforms-hidden'
|
| 574 |
);
|
| 575 |
+
$note .= esc_html__( 'Images are not cropped or resized. For best results, they should be the same size and 250x250 pixels or smaller.', 'wpforms' );
|
| 576 |
$note .= '</div>';
|
| 577 |
|
| 578 |
// Field contents.
|
| 983 |
}
|
| 984 |
|
| 985 |
$list_class = array( 'primary-input' );
|
| 986 |
+
$images = empty( $field['dynamic_choices'] ) && ! empty( $field['choices_images'] );
|
| 987 |
|
| 988 |
if ( $images ) {
|
| 989 |
$list_class[] = 'wpforms-image-choices';
|
includes/fields/class-checkbox.php
CHANGED
|
@@ -113,7 +113,7 @@ class WPForms_Field_Checkbox extends WPForms_Field {
|
|
| 113 |
$form_id = absint( $form_data['id'] );
|
| 114 |
$field_id = absint( $field['id'] );
|
| 115 |
$choices = $field['choices'];
|
| 116 |
-
$dynamic = wpforms_get_field_dynamic_choices( $field, $form_id );
|
| 117 |
|
| 118 |
if ( $dynamic ) {
|
| 119 |
$choices = $dynamic;
|
|
@@ -380,7 +380,7 @@ class WPForms_Field_Checkbox extends WPForms_Field {
|
|
| 380 |
wpforms_html_attributes( $choice['container']['id'], $choice['container']['class'], $choice['container']['data'], $choice['container']['attr'] )
|
| 381 |
);
|
| 382 |
|
| 383 |
-
if ( empty( $field['
|
| 384 |
|
| 385 |
// Image choices.
|
| 386 |
printf( '<label %s>',
|
| 113 |
$form_id = absint( $form_data['id'] );
|
| 114 |
$field_id = absint( $field['id'] );
|
| 115 |
$choices = $field['choices'];
|
| 116 |
+
$dynamic = wpforms_get_field_dynamic_choices( $field, $form_id, $form_data );
|
| 117 |
|
| 118 |
if ( $dynamic ) {
|
| 119 |
$choices = $dynamic;
|
| 380 |
wpforms_html_attributes( $choice['container']['id'], $choice['container']['class'], $choice['container']['data'], $choice['container']['attr'] )
|
| 381 |
);
|
| 382 |
|
| 383 |
+
if ( empty( $field['dynamic_choices'] ) && ! empty( $field['choices_images'] ) ) {
|
| 384 |
|
| 385 |
// Image choices.
|
| 386 |
printf( '<label %s>',
|
includes/fields/class-radio.php
CHANGED
|
@@ -103,7 +103,7 @@ class WPForms_Field_Radio extends WPForms_Field {
|
|
| 103 |
$form_id = absint( $form_data['id'] );
|
| 104 |
$field_id = absint( $field['id'] );
|
| 105 |
$choices = $field['choices'];
|
| 106 |
-
$dynamic = wpforms_get_field_dynamic_choices( $field, $form_id );
|
| 107 |
|
| 108 |
if ( $dynamic ) {
|
| 109 |
$choices = $dynamic;
|
|
@@ -333,7 +333,7 @@ class WPForms_Field_Radio extends WPForms_Field {
|
|
| 333 |
wpforms_html_attributes( $choice['container']['id'], $choice['container']['class'], $choice['container']['data'], $choice['container']['attr'] )
|
| 334 |
);
|
| 335 |
|
| 336 |
-
if ( empty( $field['
|
| 337 |
|
| 338 |
// Image choices.
|
| 339 |
printf( '<label %s>',
|
| 103 |
$form_id = absint( $form_data['id'] );
|
| 104 |
$field_id = absint( $field['id'] );
|
| 105 |
$choices = $field['choices'];
|
| 106 |
+
$dynamic = wpforms_get_field_dynamic_choices( $field, $form_id, $form_data );
|
| 107 |
|
| 108 |
if ( $dynamic ) {
|
| 109 |
$choices = $dynamic;
|
| 333 |
wpforms_html_attributes( $choice['container']['id'], $choice['container']['class'], $choice['container']['data'], $choice['container']['attr'] )
|
| 334 |
);
|
| 335 |
|
| 336 |
+
if ( empty( $field['dynamic_choices'] ) && ! empty( $field['choices_images'] ) ) {
|
| 337 |
|
| 338 |
// Image choices.
|
| 339 |
printf( '<label %s>',
|
includes/functions.php
CHANGED
|
@@ -1336,20 +1336,21 @@ function _wpforms_get_hierarchical_object_flatten( $array, &$output, $ref_name =
|
|
| 1336 |
*
|
| 1337 |
* @since 1.4.5
|
| 1338 |
*
|
| 1339 |
-
* @param array $field
|
| 1340 |
-
* @param int $form_id
|
|
|
|
| 1341 |
*
|
| 1342 |
* @return false|array
|
| 1343 |
*/
|
| 1344 |
-
function wpforms_get_field_dynamic_choices( $field, $form_id ) {
|
| 1345 |
|
| 1346 |
-
if ( empty( $field['
|
| 1347 |
return false;
|
| 1348 |
}
|
| 1349 |
|
| 1350 |
$choices = array();
|
| 1351 |
|
| 1352 |
-
if ( 'post_type' === $field['
|
| 1353 |
|
| 1354 |
if ( empty( $field['dynamic_post_type'] ) ) {
|
| 1355 |
return false;
|
|
@@ -1378,7 +1379,7 @@ function wpforms_get_field_dynamic_choices( $field, $form_id ) {
|
|
| 1378 |
);
|
| 1379 |
}
|
| 1380 |
|
| 1381 |
-
} elseif ( 'taxonomy' === $field['
|
| 1382 |
|
| 1383 |
if ( empty( $field['dynamic_taxonomy'] ) ) {
|
| 1384 |
return false;
|
| 1336 |
*
|
| 1337 |
* @since 1.4.5
|
| 1338 |
*
|
| 1339 |
+
* @param array $field Field settings.
|
| 1340 |
+
* @param int $form_id Form ID.
|
| 1341 |
+
* @param array $form_data Form data.
|
| 1342 |
*
|
| 1343 |
* @return false|array
|
| 1344 |
*/
|
| 1345 |
+
function wpforms_get_field_dynamic_choices( $field, $form_id, $form_data = array() ) {
|
| 1346 |
|
| 1347 |
+
if ( empty( $field['dynamic_choices'] ) ) {
|
| 1348 |
return false;
|
| 1349 |
}
|
| 1350 |
|
| 1351 |
$choices = array();
|
| 1352 |
|
| 1353 |
+
if ( 'post_type' === $field['dynamic_choices'] ) {
|
| 1354 |
|
| 1355 |
if ( empty( $field['dynamic_post_type'] ) ) {
|
| 1356 |
return false;
|
| 1379 |
);
|
| 1380 |
}
|
| 1381 |
|
| 1382 |
+
} elseif ( 'taxonomy' === $field['dynamic_choices'] ) {
|
| 1383 |
|
| 1384 |
if ( empty( $field['dynamic_taxonomy'] ) ) {
|
| 1385 |
return false;
|
languages/wpforms.pot
CHANGED
|
@@ -2,9 +2,9 @@
|
|
| 2 |
# This file is distributed under the same license as the WPForms package.
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
| 5 |
-
"Project-Id-Version: WPForms 1.4.5\n"
|
| 6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wpforms\n"
|
| 7 |
-
"POT-Creation-Date: 2018-03-
|
| 8 |
"MIME-Version: 1.0\n"
|
| 9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
| 10 |
"Content-Transfer-Encoding: 8bit\n"
|
|
@@ -1031,9 +1031,9 @@ msgid ""
|
|
| 1031 |
"a>?"
|
| 1032 |
msgstr ""
|
| 1033 |
|
| 1034 |
-
#. #-#-#-#-# wpforms.pot (WPForms 1.4.5) #-#-#-#-#
|
| 1035 |
#. Plugin Name of the plugin/theme
|
| 1036 |
-
#. #-#-#-#-# wpforms.pot (WPForms 1.4.5) #-#-#-#-#
|
| 1037 |
#. Author of the plugin/theme
|
| 1038 |
#: includes/admin/class-menu.php:39 includes/admin/class-menu.php:40
|
| 1039 |
#: includes/admin/class-menu.php:51 includes/admin/class-menu.php:103
|
|
@@ -1335,7 +1335,7 @@ msgid "Required"
|
|
| 1335 |
msgstr ""
|
| 1336 |
|
| 1337 |
#: includes/admin/class-settings.php:401 includes/class-frontend.php:1016
|
| 1338 |
-
#: includes/functions.php:
|
| 1339 |
msgid "This field is required."
|
| 1340 |
msgstr ""
|
| 1341 |
|
|
@@ -2441,7 +2441,7 @@ msgstr ""
|
|
| 2441 |
|
| 2442 |
#: includes/fields/class-base.php:575
|
| 2443 |
msgid ""
|
| 2444 |
-
"Images are not cropped or resized. For best
|
| 2445 |
"size and 250x250 pixels or smaller."
|
| 2446 |
msgstr ""
|
| 2447 |
|
|
@@ -6057,9 +6057,9 @@ msgstr ""
|
|
| 6057 |
msgid "Please deactivate WPForms Lite before activating WPForms."
|
| 6058 |
msgstr ""
|
| 6059 |
|
| 6060 |
-
#. #-#-#-#-# wpforms.pot (WPForms 1.4.5) #-#-#-#-#
|
| 6061 |
#. Plugin URI of the plugin/theme
|
| 6062 |
-
#. #-#-#-#-# wpforms.pot (WPForms 1.4.5) #-#-#-#-#
|
| 6063 |
#. Author URI of the plugin/theme
|
| 6064 |
msgid "https://wpforms.com"
|
| 6065 |
msgstr ""
|
| 2 |
# This file is distributed under the same license as the WPForms package.
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
| 5 |
+
"Project-Id-Version: WPForms 1.4.5.1\n"
|
| 6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wpforms\n"
|
| 7 |
+
"POT-Creation-Date: 2018-03-20 19:14:47+00:00\n"
|
| 8 |
"MIME-Version: 1.0\n"
|
| 9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
| 10 |
"Content-Transfer-Encoding: 8bit\n"
|
| 1031 |
"a>?"
|
| 1032 |
msgstr ""
|
| 1033 |
|
| 1034 |
+
#. #-#-#-#-# wpforms.pot (WPForms 1.4.5.1) #-#-#-#-#
|
| 1035 |
#. Plugin Name of the plugin/theme
|
| 1036 |
+
#. #-#-#-#-# wpforms.pot (WPForms 1.4.5.1) #-#-#-#-#
|
| 1037 |
#. Author of the plugin/theme
|
| 1038 |
#: includes/admin/class-menu.php:39 includes/admin/class-menu.php:40
|
| 1039 |
#: includes/admin/class-menu.php:51 includes/admin/class-menu.php:103
|
| 1335 |
msgstr ""
|
| 1336 |
|
| 1337 |
#: includes/admin/class-settings.php:401 includes/class-frontend.php:1016
|
| 1338 |
+
#: includes/functions.php:1701
|
| 1339 |
msgid "This field is required."
|
| 1340 |
msgstr ""
|
| 1341 |
|
| 2441 |
|
| 2442 |
#: includes/fields/class-base.php:575
|
| 2443 |
msgid ""
|
| 2444 |
+
"Images are not cropped or resized. For best results, they should be the same "
|
| 2445 |
"size and 250x250 pixels or smaller."
|
| 2446 |
msgstr ""
|
| 2447 |
|
| 6057 |
msgid "Please deactivate WPForms Lite before activating WPForms."
|
| 6058 |
msgstr ""
|
| 6059 |
|
| 6060 |
+
#. #-#-#-#-# wpforms.pot (WPForms 1.4.5.1) #-#-#-#-#
|
| 6061 |
#. Plugin URI of the plugin/theme
|
| 6062 |
+
#. #-#-#-#-# wpforms.pot (WPForms 1.4.5.1) #-#-#-#-#
|
| 6063 |
#. Author URI of the plugin/theme
|
| 6064 |
msgid "https://wpforms.com"
|
| 6065 |
msgstr ""
|
readme.txt
CHANGED
|
@@ -211,6 +211,9 @@ Syed Balkhi
|
|
| 211 |
|
| 212 |
== Changelog ==
|
| 213 |
|
|
|
|
|
|
|
|
|
|
| 214 |
= 1.4.5 =
|
| 215 |
- Added: Image choices feature with Checkbox and Multiple Choice fields; Images can now be uploaded and displayed with your choices!
|
| 216 |
- Added: Custom input masks for Single Line Text fields (Advanced Options).
|
| 211 |
|
| 212 |
== Changelog ==
|
| 213 |
|
| 214 |
+
= 1.4.5.1 =
|
| 215 |
+
- Fixed: Dynamic choices not displaying correctly for Multiple Choice and Checkbox fields.
|
| 216 |
+
|
| 217 |
= 1.4.5 =
|
| 218 |
- Added: Image choices feature with Checkbox and Multiple Choice fields; Images can now be uploaded and displayed with your choices!
|
| 219 |
- Added: Custom input masks for Single Line Text fields (Advanced Options).
|
wpforms.php
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
* Description: Beginner friendly WordPress contact form plugin. Use our Drag & Drop form builder to create your WordPress forms.
|
| 6 |
* Author: WPForms
|
| 7 |
* Author URI: https://wpforms.com
|
| 8 |
-
* Version: 1.4.5
|
| 9 |
* Text Domain: wpforms
|
| 10 |
* Domain Path: languages
|
| 11 |
*
|
|
@@ -92,7 +92,7 @@ if ( class_exists( 'WPForms' ) ) {
|
|
| 92 |
*
|
| 93 |
* @var string
|
| 94 |
*/
|
| 95 |
-
public $version = '1.4.5';
|
| 96 |
|
| 97 |
/**
|
| 98 |
* The form data handler instance.
|
| 5 |
* Description: Beginner friendly WordPress contact form plugin. Use our Drag & Drop form builder to create your WordPress forms.
|
| 6 |
* Author: WPForms
|
| 7 |
* Author URI: https://wpforms.com
|
| 8 |
+
* Version: 1.4.5.1
|
| 9 |
* Text Domain: wpforms
|
| 10 |
* Domain Path: languages
|
| 11 |
*
|
| 92 |
*
|
| 93 |
* @var string
|
| 94 |
*/
|
| 95 |
+
public $version = '1.4.5.1';
|
| 96 |
|
| 97 |
/**
|
| 98 |
* The form data handler instance.
|
