Changeset 2782154
- Timestamp:
- 09/08/2022 07:59:53 PM (4 years ago)
- Location:
- lct-useful-shortcodes-functions/trunk
- Files:
-
- 2 added
- 16 edited
-
assets/js/helpers.js (modified) (21 diffs)
-
assets/js/helpers.min.js (modified) (1 diff)
-
available/email-reminder/includes/classes/PDER.php (modified) (2 diffs)
-
code/__init.php (modified) (1 diff)
-
code/admin/taxonomies.php (modified) (4 diffs)
-
code/api/_helpers.php (modified) (2 diffs)
-
code/api/debug.php (modified) (5 diffs)
-
code/plugins/Avada/api/overrides.php (modified) (9 diffs)
-
code/plugins/acf/_shortcodes.php (modified) (2 diffs)
-
code/plugins/acf/api/form.php (modified) (6 diffs)
-
code/plugins/acf/api/get.php (modified) (5 diffs)
-
code/plugins/acf/field_settings.php (modified) (1 diff)
-
code/plugins/acf/instant_save.php (modified) (2 diffs)
-
code/templates/templates/header-v6-v5.php (added)
-
code/templates/templates/menu-mobile-main-v8.php (added)
-
code/wp_api/general.php (modified) (1 diff)
-
lct-useful-shortcodes-functions.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lct-useful-shortcodes-functions/trunk/assets/js/helpers.js
r2771323 r2782154 1 /** 2 * Clean up the data 3 * @since 2020.5 4 * @verified 2019.02.07 5 */ 6 var lct_acf_data_check = function( data ) { 7 if( typeof data.lct === 'undefined' ) 8 data.lct = {}; 9 10 11 return data; 12 }; 13 14 15 /** 16 * ACF: parse value 17 * @since 2020.5 18 * @verified 2019.02.07 19 */ 20 var lct_parseString = function( val ) { 21 return val ? '' + val : ''; 22 }; 23 24 25 /** 26 * ACF: are values equal 27 * @since 2020.5 28 * @verified 2019.02.07 29 */ 30 var lct_isEqualTo = function( v1, v2 ) { 31 return (lct_parseString( v1 ).toLowerCase() === lct_parseString( v2 ).toLowerCase()); 32 }; 33 34 35 /** 36 * ACF: inArray 37 * @since 2020.5 38 * @verified 2019.02.07 39 */ 40 var lct_inArray = function( v1, array ) { 41 if( jQuery.isArray( array ) === false ) 42 return false; 43 44 45 array = array.map( function( v2 ) { 46 return lct_parseString( v2 ); 47 } ); 48 49 50 return (array.indexOf( v1 ) > -1); 51 }; 52 53 54 /** 55 * Get a value of a parameter 56 * @since 2020.5 57 * @verified 2020.02.19 58 */ 59 var lct_get_url_parameter = function( name, url ) { 60 if( url === undefined ) 61 url = location.search; 62 63 64 name = name.replace( /[\[]/, '\\[' ).replace( /[\]]/, '\\]' ); 65 var regex = new RegExp( '[\\?&]' + name + '=([^&#]*)' ); 66 var results = regex.exec( url ); 67 68 69 return results === null ? '' : decodeURIComponent( results[ 1 ].replace( /\+/g, ' ' ) ); 70 }; 1 var lct_is_dev = false; 71 2 72 3 73 4 /** 74 5 * Send the actual ACF AJAX sync call 75 * @param string action76 * @param object args6 * @param action string 7 * @param args object 77 8 * @returns {*} 78 9 * @since 2020.5 79 * @verified 20 19.02.0780 */ 81 function lct_acf_sync_ajax( action, args ) {10 * @verified 2022.08.31 11 */ 12 var lct_acf_sync_ajax = function( action, args ) { 82 13 return lct_acf_ajax( action, args, false ); 83 } 14 }; 84 15 85 16 86 17 /** 87 18 * Send the actual ACF AJAX call 88 * @param string action89 * @param object args90 * @param bool async19 * @param action string 20 * @param args object 21 * @param async bool 91 22 * @returns resp { 92 23 * status (string) => fail || valid || redirect || reload (use as last resort) 93 * data (object) => mixed //Any combination of variables that may be useful for a specific call 94 * details (string) => mixed //Explanatory info about why the status is what it is, only used for debugging 24 * atts (object) => mixed //Any combination of attributes that may be useful for a specific call 95 25 * html (string) => mixed //html to be relayed to the main content container 96 26 * response_html (string) => mixed //html to be relayed to the response container 27 * alert_status (string) => general || error || success || notice || blank || custom (See: FusionSC_Alert{}render()) 28 * alert_html (string) => mixed //html to be relayed to the alert container 97 29 * results (mixed) => mixed //ACF queries return this 98 30 * more (bool) => false || true //NOT TRACKED //ACF queries return this 99 31 * } 100 32 * @since 2020.5 101 * @verified 2022.0 1.25102 */ 103 function lct_acf_ajax( action, args, async ) {33 * @verified 2022.08.31 34 */ 35 var lct_acf_ajax = function( action, args, async ) { 104 36 /** 105 37 * Set main vars 106 38 */ 107 if( args === undefined )39 if( typeof args === 'undefined' ) { 108 40 args = {}; 109 if( async === undefined ) 41 } 42 if( async === 'undefined' ) { 110 43 async = true; 44 } 111 45 112 46 … … 114 48 * Prep the form_obj 115 49 */ 116 varpost_id = null;117 varform_obj = { action: action };50 let post_id = null; 51 let form_obj = { action: action }; 118 52 jQuery.each( args, function( k, v ) { 119 53 form_obj[ k ] = v; 120 54 } ); 121 if( typeof form_obj.post_id !== 'undefined' ) 55 if( typeof form_obj.post_id !== 'undefined' ) { 122 56 post_id = form_obj.post_id; 57 } 123 58 124 59 … … 132 67 * Set the post_id after ACF sets it 133 68 */ 134 if( post_id ) 69 if( post_id ) { 135 70 form_obj.post_id = post_id; 71 } 136 72 137 73 … … 139 75 * Send the actual AJAX call 140 76 */ 141 varcall_obj = jQuery.ajax( {77 let call_obj = jQuery.ajax( { 142 78 url: lct_custom.ajax_url, 143 79 method: 'POST', … … 170 106 * Set main vars 171 107 */ 172 if( typeof resp.data === 'undefined' ) 173 resp.data = {}; 174 if( typeof resp.details === 'undefined' ) 175 resp.details = ''; 176 if( typeof resp.html === 'undefined' ) 108 if( typeof resp.atts === 'undefined' ) { 109 resp.atts = {}; 110 } 111 if( typeof resp.html === 'undefined' ) { 177 112 resp.html = ''; 178 if( typeof resp.response_html === 'undefined' ) 113 } 114 if( typeof resp.response_html === 'undefined' ) { 179 115 resp.response_html = ''; 180 if( typeof resp.results === 'undefined' ) 116 } 117 if( typeof resp.alert_status === 'undefined' ) { 118 resp.alert_status = 'general'; 119 } 120 if( typeof resp.alert_html === 'undefined' ) { 121 resp.alert_html = ''; 122 } 123 if( typeof resp.results === 'undefined' ) { 181 124 resp.results = ''; 125 } 182 126 183 127 … … 187 131 if( resp.status === 'fail' ) { 188 132 console.log( 'AJAX Call Status: ' + resp.status ); 189 console.log( 'AJAX Call Details: ' + resp.details);133 console.log( 'AJAX Call Alert HTML: ' + resp.alert_html ); 190 134 console.log( 'AJAX Call HTML: ' + resp.html ); 191 135 return; … … 198 142 if( 199 143 resp.status === 'redirect' && 200 typeof resp. data.url !== 'undefined'144 typeof resp.atts.url !== 'undefined' 201 145 ) { 202 window.location.replace( resp. data.url );146 window.location.replace( resp.atts.url ); 203 147 return; 204 148 } … … 234 178 * Make an error log 235 179 */ 236 varanswer = '[' + call_status + '] ' + error_text;180 let answer = '[' + call_status + '] ' + error_text; 237 181 console.log( 'Opps, that went bad! :: Details:', '\n', 'AJAX Action:', action, '\n', 'Error:', answer ); 238 182 … … 251 195 * Set main vars 252 196 */ 253 if( typeof resp.data === 'undefined' ) 254 resp.data = {}; 255 if( typeof resp.details === 'undefined' ) 256 resp.details = ''; 257 if( typeof resp.html === 'undefined' ) 197 if( typeof resp.atts === 'undefined' ) { 198 resp.atts = {}; 199 } 200 if( typeof resp.html === 'undefined' ) { 258 201 resp.html = ''; 259 if( typeof resp.response_html === 'undefined' ) 202 } 203 if( typeof resp.response_html === 'undefined' ) { 260 204 resp.response_html = ''; 261 if( typeof resp.results === 'undefined' ) 205 } 206 if( typeof resp.alert_status === 'undefined' ) { 207 resp.alert_status = 'general'; 208 } 209 if( typeof resp.alert_html === 'undefined' ) { 210 resp.alert_html = ''; 211 } 212 if( typeof resp.results === 'undefined' ) { 262 213 resp.results = ''; 214 } 263 215 } ); 264 216 265 217 266 218 return call_obj; 267 } 219 }; 268 220 269 221 270 222 /** 271 223 * Send the actual ACF API sync call 272 * @param string api_route273 * @param object args224 * @param api_route string 225 * @param args object 274 226 * @returns {*} 275 227 * @since 2020.5 276 * @verified 20 19.02.13277 */ 278 function lct_acf_sync_api_GET( api_route, args ) {228 * @verified 2022.08.31 229 */ 230 var lct_acf_sync_api_GET = function( api_route, args ) { 279 231 return lct_acf_sync_api_call( api_route, 'GET', args ); 280 } 232 }; 281 233 282 234 283 235 /** 284 236 * Send the actual ACF API sync call 285 * @param string api_route286 * @param object args237 * @param api_route string 238 * @param args object 287 239 * @returns {*} 288 240 * @since 2020.5 289 * @verified 20 19.02.13290 */ 291 function lct_acf_sync_api_POST( api_route, args ) {241 * @verified 2022.08.31 242 */ 243 var lct_acf_sync_api_POST = function( api_route, args ) { 292 244 return lct_acf_sync_api_call( api_route, 'POST', args ); 293 } 245 }; 294 246 295 247 296 248 /** 297 249 * Send the actual ACF API sync call 298 * @param string api_route299 * @param string method300 * @param object args250 * @param api_route string 251 * @param method string 252 * @param args object 301 253 * @returns {*} 302 254 * @since 2020.5 303 * @verified 20 19.02.13304 */ 305 function lct_acf_sync_api_call( api_route, method, args ) {255 * @verified 2022.08.31 256 */ 257 var lct_acf_sync_api_call = function( api_route, method, args ) { 306 258 return lct_acf_api_call( api_route, method, args, false ); 307 } 259 }; 308 260 309 261 310 262 /** 311 263 * Send the actual ACF API call 312 * @param string api_route313 * @param object args264 * @param api_route string 265 * @param args object 314 266 * @returns {*} 315 267 * @since 2020.5 316 * @verified 20 19.02.13317 */ 318 function lct_acf_api_GET( api_route, args ) {268 * @verified 2022.08.31 269 */ 270 var lct_acf_api_GET = function( api_route, args ) { 319 271 return lct_acf_api_call( api_route, 'GET', args ); 320 } 272 }; 321 273 322 274 323 275 /** 324 276 * Send the actual ACF API call 325 * @param string api_route326 * @param object args277 * @param api_route string 278 * @param args object 327 279 * @returns {*} 328 280 * @since 2020.5 329 * @verified 20 19.02.13330 */ 331 function lct_acf_api_POST( api_route, args ) {281 * @verified 2022.08.31 282 */ 283 var lct_acf_api_POST = function( api_route, args ) { 332 284 return lct_acf_api_call( api_route, 'POST', args ); 333 } 285 }; 334 286 335 287 336 288 /** 337 289 * Send the actual ACF API call 338 * @param string api_route339 * @param string method340 * @param object args341 * @param bool async290 * @param api_route string 291 * @param method string 292 * @param args object 293 * @param async bool 342 294 * @returns resp { 343 295 * status (string) => fail || valid || redirect || reload (use as last resort) 344 * data (object) => mixed //Any combination of variables that may be useful for a specific call 345 * details (string) => mixed //Explanatory info about why the status is what it is, only used for debugging 296 * atts (object) => mixed //Any combination of attributes that may be useful for a specific call 346 297 * html (string) => mixed //html to be relayed to the main content container 347 298 * response_html (string) => mixed //html to be relayed to the response container 299 * alert_status (string) => general || error || success || notice || blank || custom (See: FusionSC_Alert{}render()) 300 * alert_html (string) => mixed //html to be relayed to the alert container 348 301 * } 349 * @since 2020.5350 * @verified 2022.0 1.25351 */ 352 function lct_acf_api_call( api_route, method, args, async ) {302 * @since 2020.5 303 * @verified 2022.08.31 304 */ 305 var lct_acf_api_call = function( api_route, method, args, async ) { 353 306 /** 354 307 * Set main vars 355 308 */ 356 if( method === undefined ) 309 if( method === undefined ) { 357 310 method = 'GET'; 358 if( args === undefined ) 311 } 312 if( args === undefined ) { 359 313 args = {}; 360 if( async === undefined ) 314 } 315 if( async === undefined ) { 361 316 async = true; 317 } 362 318 363 319 … … 365 321 * Prep the form_obj 366 322 */ 367 varpost_id = null;368 varform_obj = {};323 let post_id = null; 324 let form_obj = {}; 369 325 jQuery.each( args, function( k, v ) { 370 if( k === 'acf_form' ) //Skip acf_form326 if( k === 'acf_form' ) { //Skip acf_form 371 327 return; 328 } 372 329 373 330 374 331 form_obj[ k ] = v; 375 332 } ); 376 if( typeof form_obj.post_id !== 'undefined' ) 333 if( typeof form_obj.post_id !== 'undefined' ) { 377 334 post_id = form_obj.post_id; 335 } 378 336 379 337 … … 387 345 * Set the post_id after ACF sets it 388 346 */ 389 if( post_id ) 347 if( post_id ) { 390 348 form_obj.post_id = post_id; 349 } 391 350 392 351 … … 394 353 * Set form_obj to acf_form if it exists 395 354 */ 396 if( typeof args.acf_form !== 'undefined' ) 355 if( typeof args.acf_form !== 'undefined' ) { 397 356 form_obj = args.acf_form.serialize(); 357 } 398 358 399 359 … … 401 361 * Send the actual API call 402 362 */ 403 varcall_obj = jQuery.ajax( {363 let call_obj = jQuery.ajax( { 404 364 url: lct_custom.api_url + api_route, 405 365 method: method, … … 425 385 * Check the status of the status 426 386 */ 427 if( typeof resp.status === 'undefined' ) 387 if( typeof resp.status === 'undefined' ) { 428 388 resp.status = 'unknown'; 389 } 429 390 430 391 … … 432 393 * Set main vars 433 394 */ 434 if( typeof resp.data === 'undefined' ) 435 resp.data = {}; 436 if( typeof resp.details === 'undefined' ) 437 resp.details = ''; 438 if( typeof resp.html === 'undefined' ) 395 if( typeof resp.atts === 'undefined' ) { 396 resp.atts = {}; 397 } 398 if( typeof resp.html === 'undefined' ) { 439 399 resp.html = ''; 440 if( typeof resp.response_html === 'undefined' ) 400 } 401 if( typeof resp.response_html === 'undefined' ) { 441 402 resp.response_html = ''; 403 } 404 if( typeof resp.alert_status === 'undefined' ) { 405 resp.alert_status = 'general'; 406 } 407 if( typeof resp.alert_html === 'undefined' ) { 408 resp.alert_html = ''; 409 } 410 411 412 /** 413 * Set the alert 414 */ 415 if( typeof vm_alert_area !== 'undefined' ) { 416 if( resp.status === 'fail' ) { 417 resp.alert_html = 'The API request failed. Please refresh & try again. Contact the site admin if it continues.<br />' + resp.alert_html; 418 } 419 420 421 if( resp.alert_html ) { 422 args = { 423 'type': resp.alert_status, 424 'content': resp.alert_html, 425 }; 426 vm_alert_area.display_alert( args ); 427 } 428 } 442 429 443 430 … … 447 434 if( resp.status === 'fail' ) { 448 435 console.log( 'API Call Status: ' + resp.status ); 449 console.log( 'API Call Details: ' + resp.details);436 console.log( 'API Call Alert HTML: ' + resp.alert_html ); 450 437 console.log( 'API Call HTML: ' + resp.html ); 438 439 451 440 return; 452 441 } … … 458 447 if( 459 448 resp.status === 'redirect' && 460 typeof resp. data.url !== 'undefined'449 typeof resp.atts.url !== 'undefined' 461 450 ) { 462 window.location.replace( resp. data.url );451 window.location.replace( resp.atts.url ); 463 452 return; 464 453 } … … 477 466 * The outcome is unknown or invalid 478 467 */ 479 if( resp.status !== 'valid' ) 468 if( resp.status !== 'valid' ) { 480 469 console.log( 'API Call Status: ' + resp.status ); 470 } 481 471 482 472 … … 491 481 * Check the status of the status 492 482 */ 493 if( typeof resp_obj.status === 'undefined' ) 483 if( typeof resp_obj.status === 'undefined' ) { 494 484 resp_obj.status = 'unknown'; 485 } 495 486 496 487 … … 498 489 * Make an error log 499 490 */ 500 varanswer = '[' + call_status + '] ' + error_text;491 let answer = '[' + call_status + '] ' + error_text; 501 492 console.log( 'Opps, that went bad! :: Details:', '\n', 'Call:', api_route, '\n', 'Error:', answer ); 493 494 495 /** 496 * Set the alert 497 */ 498 if( typeof vm_alert_area !== 'undefined' ) { 499 let content = '<h2 style="margin: 20px 0;">The API request failed.<br />Please refresh & try again. Contact the site admin if it continues.</h2>'; 500 501 502 if( 503 typeof resp_obj !== 'undefined' && 504 typeof resp_obj.responseJSON !== 'undefined' && 505 typeof resp_obj.responseJSON.message !== 'undefined' 506 ) { 507 content = resp_obj.responseJSON.message; 508 } 509 510 511 vm_alert_area.update_alert( content, false ); 512 } 502 513 503 514 … … 515 526 * Set main vars 516 527 */ 517 if( typeof resp.data === 'undefined' ) 518 resp.data = {}; 519 if( typeof resp.details === 'undefined' ) 520 resp.details = ''; 521 if( typeof resp.html === 'undefined' ) 528 if( typeof resp.atts === 'undefined' ) { 529 resp.atts = {}; 530 } 531 if( typeof resp.html === 'undefined' ) { 522 532 resp.html = ''; 523 if( typeof resp.response_html === 'undefined' ) 533 } 534 if( typeof resp.response_html === 'undefined' ) { 524 535 resp.response_html = ''; 536 } 537 if( typeof resp.alert_status === 'undefined' ) { 538 resp.alert_status = 'general'; 539 } 540 if( typeof resp.alert_html === 'undefined' ) { 541 resp.alert_html = ''; 542 } 525 543 } ); 526 544 527 545 528 546 return call_obj; 529 } 547 }; 548 549 550 /** 551 * Clean up the data 552 * @since 2020.5 553 * @verified 2022.08.23 554 */ 555 var lct_acf_data_check = function( data ) { 556 if( typeof data.lct === 'undefined' ) { 557 data.lct = {}; 558 } 559 560 561 return data; 562 }; 563 564 565 /** 566 * ACF: parse value 567 * @since 2020.5 568 * @verified 2019.02.07 569 */ 570 var lct_parseString = function( val ) { 571 return val ? '' + val : ''; 572 }; 573 574 575 /** 576 * ACF: are values equal 577 * @since 2020.5 578 * @verified 2019.02.07 579 */ 580 var lct_isEqualTo = function( v1, v2 ) { 581 return (lct_parseString( v1 ).toLowerCase() === lct_parseString( v2 ).toLowerCase()); 582 }; 583 584 585 /** 586 * ACF: inArray 587 * @since 2020.5 588 * @verified 2022.08.23 589 */ 590 var lct_inArray = function( v1, array ) { 591 if( jQuery.isArray( array ) === false ) { 592 return false; 593 } 594 595 596 array = array.map( function( v2 ) { 597 return lct_parseString( v2 ); 598 } ); 599 600 601 return (array.indexOf( v1 ) > -1); 602 }; 603 604 605 /** 606 * Get a value of a parameter 607 * @since 2020.5 608 * @verified 2022.08.23 609 */ 610 var lct_get_url_parameter = function( name, url ) { 611 if( url === undefined ) { 612 url = location.search; 613 } 614 615 616 name = name.replace( /[\[]/, '\\[' ).replace( /[\]]/, '\\]' ); 617 var regex = new RegExp( '[\\?&]' + name + '=([^&#]*)' ); 618 var results = regex.exec( url ); 619 620 621 return results === null ? '' : decodeURIComponent( results[ 1 ].replace( /\+/g, ' ' ) ); 622 }; 623 624 625 /** 626 * Custom methods go below here 627 */ -
lct-useful-shortcodes-functions/trunk/assets/js/helpers.min.js
r2771323 r2782154 1 var lct_ acf_data_check=function(t){return void 0===t.lct&&(t.lct={}),t},lct_parseString=function(t){return t?""+t:""},lct_isEqualTo=function(t,a){return lct_parseString(t).toLowerCase()===lct_parseString(a).toLowerCase()},lct_inArray=function(t,a){return!1!==jQuery.isArray(a)&&-1<(a=a.map(function(t){return lct_parseString(t)})).indexOf(t)},lct_get_url_parameter=function(t,a){void 0===a&&(a=location.search),t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");t=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(a);return null===t?"":decodeURIComponent(t[1].replace(/\+/g," "))};function lct_acf_sync_ajax(t,a){return lct_acf_ajax(t,a,!1)}function lct_acf_ajax(o,t,a){void 0===t&&(t={}),void 0===a&&(a=!0);var l=null,n={action:o};return jQuery.each(t,function(t,a){n[t]=a}),void 0!==n.post_id&&(l=n.post_id),n=acf.prepareForAjax(n),l&&(n.post_id=l),jQuery.ajax({url:lct_custom.ajax_url,method:"POST",dataType:"json",async:a,data:n}).done(function(t){void 0===t.status&&(t.status="unknown"),void 0===t.data&&(t.data={}),void 0===t.details&&(t.details=""),void 0===t.html&&(t.html=""),void 0===t.response_html&&(t.response_html=""),void 0===t.results&&(t.results=""),"fail"===t.status?(console.log("AJAX Call Status: "+t.status),console.log("AJAX Call Details: "+t.details),console.log("AJAX Call HTML: "+t.html)):"redirect"===t.status&&void 0!==t.data.url?window.location.replace(t.data.url):"reload"===t.status&&window.location.reload()}).fail(function(t,a,l){void 0===t.status&&(t.status="unknown"),console.log("Opps, that went bad! :: Details:","\n","AJAX Action:",o,"\n","Error:","["+a+"] "+l)}).always(function(t){void 0===t.data&&(t.data={}),void 0===t.details&&(t.details=""),void 0===t.html&&(t.html=""),void 0===t.response_html&&(t.response_html=""),void 0===t.results&&(t.results="")})}function lct_acf_sync_api_GET(t,a){return lct_acf_sync_api_call(t,"GET",a)}function lct_acf_sync_api_POST(t,a){return lct_acf_sync_api_call(t,"POST",a)}function lct_acf_sync_api_call(t,a,l){return lct_acf_api_call(t,a,l,!1)}function lct_acf_api_GET(t,a){return lct_acf_api_call(t,"GET",a)}function lct_acf_api_POST(t,a){return lct_acf_api_call(t,"POST",a)}function lct_acf_api_call(o,t,a,l){void 0===t&&(t="GET"),void 0===a&&(a={}),void 0===l&&(l=!0);var n=null,e={};return jQuery.each(a,function(t,a){"acf_form"!==t&&(e[t]=a)}),void 0!==e.post_id&&(n=e.post_id),e=acf.prepareForAjax(e),n&&(e.post_id=n),void 0!==a.acf_form&&(e=a.acf_form.serialize()),jQuery.ajax({url:lct_custom.api_url+o,method:t,dataType:"json",async:l,data:e,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",lct_custom.wpapi_nonce)}}).done(function(t){void 0===t.status&&(t.status="unknown"),void 0===t.data&&(t.data={}),void 0===t.details&&(t.details=""),void 0===t.html&&(t.html=""),void 0===t.response_html&&(t.response_html=""),"fail"===t.status?(console.log("API Call Status: "+t.status),console.log("API Call Details: "+t.details),console.log("API Call HTML: "+t.html)):"redirect"===t.status&&void 0!==t.data.url?window.location.replace(t.data.url):"reload"===t.status?window.location.reload():"valid"!==t.status&&console.log("API Call Status: "+t.status)}).fail(function(t,a,l){void 0===t.status&&(t.status="unknown"),console.log("Opps, that went bad! :: Details:","\n","Call:",o,"\n","Error:","["+a+"] "+l)}).always(function(t){void 0===t.data&&(t.data={}),void 0===t.details&&(t.details=""),void 0===t.html&&(t.html=""),void 0===t.response_html&&(t.response_html="")})}1 var lct_is_dev=!1,lct_acf_sync_ajax=function(t,a){return lct_acf_ajax(t,a,!1)},lct_acf_ajax=function(l,t,a){void 0===t&&(t={}),"undefined"===a&&(a=!0);let e=null,o={action:l};return jQuery.each(t,function(t,a){o[t]=a}),void 0!==o.post_id&&(e=o.post_id),o=acf.prepareForAjax(o),e&&(o.post_id=e),jQuery.ajax({url:lct_custom.ajax_url,method:"POST",dataType:"json",async:a,data:o}).done(function(t){void 0===t.status&&(t.status="unknown"),void 0===t.atts&&(t.atts={}),void 0===t.html&&(t.html=""),void 0===t.response_html&&(t.response_html=""),void 0===t.alert_status&&(t.alert_status="general"),void 0===t.alert_html&&(t.alert_html=""),void 0===t.results&&(t.results=""),"fail"===t.status?(console.log("AJAX Call Status: "+t.status),console.log("AJAX Call Alert HTML: "+t.alert_html),console.log("AJAX Call HTML: "+t.html)):"redirect"===t.status&&void 0!==t.atts.url?window.location.replace(t.atts.url):"reload"===t.status&&window.location.reload()}).fail(function(t,a,e){void 0===t.status&&(t.status="unknown"),console.log("Opps, that went bad! :: Details:","\n","AJAX Action:",l,"\n","Error:","["+a+"] "+e)}).always(function(t){void 0===t.atts&&(t.atts={}),void 0===t.html&&(t.html=""),void 0===t.response_html&&(t.response_html=""),void 0===t.alert_status&&(t.alert_status="general"),void 0===t.alert_html&&(t.alert_html=""),void 0===t.results&&(t.results="")})},lct_acf_sync_api_GET=function(t,a){return lct_acf_sync_api_call(t,"GET",a)},lct_acf_sync_api_POST=function(t,a){return lct_acf_sync_api_call(t,"POST",a)},lct_acf_sync_api_call=function(t,a,e){return lct_acf_api_call(t,a,e,!1)},lct_acf_api_GET=function(t,a){return lct_acf_api_call(t,"GET",a)},lct_acf_api_POST=function(t,a){return lct_acf_api_call(t,"POST",a)},lct_acf_api_call=function(l,t,a,e){void 0===t&&(t="GET"),void 0===a&&(a={}),void 0===e&&(e=!0);let o=null,s={};return jQuery.each(a,function(t,a){"acf_form"!==t&&(s[t]=a)}),void 0!==s.post_id&&(o=s.post_id),s=acf.prepareForAjax(s),o&&(s.post_id=o),void 0!==a.acf_form&&(s=a.acf_form.serialize()),jQuery.ajax({url:lct_custom.api_url+l,method:t,dataType:"json",async:e,data:s,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",lct_custom.wpapi_nonce)}}).done(function(t){void 0===t.status&&(t.status="unknown"),void 0===t.atts&&(t.atts={}),void 0===t.html&&(t.html=""),void 0===t.response_html&&(t.response_html=""),void 0===t.alert_status&&(t.alert_status="general"),void 0===t.alert_html&&(t.alert_html=""),"undefined"!=typeof vm_alert_area&&("fail"===t.status&&(t.alert_html="The API request failed. Please refresh & try again. Contact the site admin if it continues.<br />"+t.alert_html),t.alert_html&&(a={type:t.alert_status,content:t.alert_html},vm_alert_area.display_alert(a))),"fail"===t.status?(console.log("API Call Status: "+t.status),console.log("API Call Alert HTML: "+t.alert_html),console.log("API Call HTML: "+t.html)):"redirect"===t.status&&void 0!==t.atts.url?window.location.replace(t.atts.url):"reload"===t.status?window.location.reload():"valid"!==t.status&&console.log("API Call Status: "+t.status)}).fail(function(a,t,e){if(void 0===a.status&&(a.status="unknown"),console.log("Opps, that went bad! :: Details:","\n","Call:",l,"\n","Error:","["+t+"] "+e),"undefined"!=typeof vm_alert_area){let t='<h2 style="margin: 20px 0;">The API request failed.<br />Please refresh & try again. Contact the site admin if it continues.</h2>';void 0!==a&&void 0!==a.responseJSON&&void 0!==a.responseJSON.message&&(t=a.responseJSON.message),vm_alert_area.update_alert(t,!1)}}).always(function(t){void 0===t.atts&&(t.atts={}),void 0===t.html&&(t.html=""),void 0===t.response_html&&(t.response_html=""),void 0===t.alert_status&&(t.alert_status="general"),void 0===t.alert_html&&(t.alert_html="")})},lct_acf_data_check=function(t){return void 0===t.lct&&(t.lct={}),t},lct_parseString=function(t){return t?""+t:""},lct_isEqualTo=function(t,a){return lct_parseString(t).toLowerCase()===lct_parseString(a).toLowerCase()},lct_inArray=function(t,a){return!1!==jQuery.isArray(a)&&-1<(a=a.map(function(t){return lct_parseString(t)})).indexOf(t)},lct_get_url_parameter=function(t,a){void 0===a&&(a=location.search),t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");t=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(a);return null===t?"":decodeURIComponent(t[1].replace(/\+/g," "))}; -
lct-useful-shortcodes-functions/trunk/available/email-reminder/includes/classes/PDER.php
r2771323 r2782154 328 328 * 329 329 * @since 2018.26 330 * @verified 2022.08. 04330 * @verified 2022.08.26 331 331 */ 332 332 function send_ereminder( $post_id ) { … … 645 645 646 646 if ( function_exists( 'afwp_create_logged_error' ) ) 647 afwp_create_logged_error( null, [ 'afwp::: data' => $error ] );647 afwp_create_logged_error( null, [ 'afwp:::wp_error' => $error ] ); 648 648 else 649 649 lct_debug_to_error_log( $error ); -
lct-useful-shortcodes-functions/trunk/code/__init.php
r2771323 r2782154 490 490 */ 491 491 lct_set_plugin( 'advanced-custom-fields-pro/acf.php', 'acf' ); //Last Check: Never 492 lct_set_plugin( 'advanced-features-wp/afwp.php', 'afwp' ); //Last Check: Never 492 493 lct_set_plugin( 'admin-menu-editor/menu-editor.php', 'admin-menu-editor' ); //Last Check: Never 493 494 lct_set_plugin( 'calendarize-it/calendarize-it.php', 'rhc' ); //Last Check: 4.5.2.80997 -
lct-useful-shortcodes-functions/trunk/code/admin/taxonomies.php
r2679272 r2782154 587 587 * 588 588 * @since 2017.96 589 * @verified 2022.0 2.08589 * @verified 2022.09.07 590 590 */ 591 591 function disable_status_slug_editing() { … … 593 593 594 594 595 if ( lct_is_status_taxonomy( $current_screen->taxonomy ) ) { //If the taxonomy is a status taxonomy ?> 595 if ( 596 ! lct_plugin_active( 'afwp' ) && 597 lct_is_status_taxonomy( $current_screen->taxonomy ) 598 ) { //If the taxonomy is a status taxonomy ?> 596 599 <style> 597 600 .inline-edit-col .input-text-wrap input[name="slug"]{ … … 622 625 * 623 626 * @since 2017.96 624 * @verified 2022.0 2.08627 * @verified 2022.09.07 625 628 */ 626 629 function disable_status_slug_editing_on_term() { … … 628 631 629 632 630 if ( lct_is_status_taxonomy( $current_screen->taxonomy ) ) { //If the taxonomy is a status taxonomy ?> 633 if ( 634 ! lct_plugin_active( 'afwp' ) && 635 lct_is_status_taxonomy( $current_screen->taxonomy ) 636 ) { //If the taxonomy is a status taxonomy ?> 631 637 <style> 632 638 .term-slug-wrap td input[name="slug"], -
lct-useful-shortcodes-functions/trunk/code/api/_helpers.php
r2690235 r2782154 3694 3694 * @date 2020.11.24 3695 3695 * @since 2020.14 3696 * @verified 202 0.11.243696 * @verified 2022.08.19 3697 3697 */ 3698 3698 function lct_previous_function( $sep = '::', $level = 2 ) { … … 3701 3701 3702 3702 3703 if ( lct_not_empty( $bt[ $level ]['class'] ) ) 3703 if ( 3704 ! empty( $bt[ $level ]['class'] ) && 3705 lct_not_empty( $bt[ $level ]['class'] ) 3706 ) { 3704 3707 $r = $bt[ $level ]['class'] . $sep . $r; 3708 } 3705 3709 3706 3710 -
lct-useful-shortcodes-functions/trunk/code/api/debug.php
r2771323 r2782154 246 246 * Send debug info to the site's error_log 247 247 * 248 * @param mixed $data248 * @param string|array|WP_Error|mixed $data 249 249 * 250 250 * @since 0.0 251 * @verified 2022.08. 03251 * @verified 2022.08.30 252 252 */ 253 253 function lct_debug_to_error_log( $data ) { … … 263 263 ( $error_code = $data->get_error_code() ) 264 264 ) { 265 $error_message = $data->get_error_message( $error_code ); 265 $data_new = sprintf( '[n][sep]Error Code: %s', $error_code ); 266 267 268 if ( $tmp = $data->get_error_message( $error_code ) ) 269 $data_new .= sprintf( '[n][sep]Error Message: %s', $tmp ); 266 270 267 271 … … 270 274 271 275 272 $error_data = array_merge( [ 'ERROR_CODE' => $error_code, 'ERROR_MESSAGE' => $error_message ], $error_data ); 273 274 275 $data = $error_data; 276 } 277 278 279 if ( function_exists( 'afwp_acf_json_encode' ) ) 280 $data = afwp_acf_json_encode( $data ); 281 else 282 $data = wp_json_encode( $data ); 276 function_exists( 'afwp_acf_json_encode' ) ? $error_data = afwp_acf_json_encode( $error_data ) : $error_data = wp_json_encode( $error_data ); 277 278 279 $data_new .= sprintf( '[n][sep]Error Data: %s', $error_data ); 280 281 282 $data = 'WP_Error{} :: ' . $error_code . $data_new; 283 } else { 284 function_exists( 'afwp_acf_json_encode' ) ? $data = afwp_acf_json_encode( $data ) : $data = wp_json_encode( $data ); 285 } 283 286 } 284 287 $data = str_replace( [ '[n]', '[sep]' ], [ "\n", $sep ], $data ); … … 294 297 295 298 /** 296 * Error Details299 * Error backtrace details 297 300 */ 298 301 $backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 3 ); 299 $file = lct_strip_path( $backtrace[0]['file'] ) . ':' . $backtrace[0]['line']; 300 $file_2 = lct_strip_path( $backtrace[1]['file'] ) . ':' . $backtrace[1]['line']; 301 $file_3 = lct_strip_path( $backtrace[2]['file'] ) . ':' . $backtrace[2]['line']; 302 if ( 303 ! empty( $backtrace[1]['function'] ) && 304 $backtrace[1]['function'] === 'create_logged_error' 305 ) { 306 $backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 5 ); 307 $file = lct_strip_path( $backtrace[2]['file'] ) . ':' . $backtrace[2]['line']; 308 $file_2 = lct_strip_path( $backtrace[3]['file'] ) . ':' . $backtrace[3]['line']; 309 $file_3 = lct_strip_path( $backtrace[4]['file'] ) . ':' . $backtrace[4]['line']; 310 } else { 311 $file = lct_strip_path( $backtrace[0]['file'] ) . ':' . $backtrace[0]['line']; 312 $file_2 = lct_strip_path( $backtrace[1]['file'] ) . ':' . $backtrace[1]['line']; 313 $file_3 = lct_strip_path( $backtrace[2]['file'] ) . ':' . $backtrace[2]['line']; 314 } 315 316 317 /** 318 * Set user 319 */ 320 $user = 'guest'; 321 if ( 322 get_current_user_id() && 323 ( $tmp = wp_get_current_user() ) 324 ) { 325 $user = $tmp->display_name . ' (' . $tmp->ID . ')'; 326 } 327 328 329 /** 330 * Set request type 331 */ 332 $request_type = []; 333 function_exists( 'lct_doing_ajax' ) ? ( lct_doing_ajax() ? $tmp = 'YES' : $tmp = 'no' ) : $tmp = 'unknown';; 334 $request_type[] = 'ajax: ' . $tmp; 335 function_exists( 'lct_doing_api' ) ? ( lct_doing_api() ? $tmp = 'YES' : $tmp = 'no' ) : $tmp = 'unknown';; 336 $request_type[] = 'api: ' . $tmp; 337 function_exists( 'lct_doing_cron' ) ? ( lct_doing_cron() ? $tmp = 'YES' : $tmp = 'no' ) : $tmp = 'unknown';; 338 $request_type[] = 'cron: ' . $tmp; 339 340 341 /** 342 * Set REQUEST 343 */ 344 function_exists( 'afwp_acf_json_encode' ) ? $request = afwp_acf_json_encode( $_REQUEST ) : $request = wp_json_encode( $_REQUEST ); 302 345 303 346 … … 310 353 $message[] = $sep . 'called from: ' . $file_2; 311 354 $message[] = $sep . 'called from: ' . $file_3; 312 $message[] = $sep . 'on page: ' . $_SERVER['REQUEST_URI']; 355 $message[] = $sep . 'on page: ' . ( $tmp = $_SERVER['REQUEST_URI'] ?? 'unknown' ); 356 $message[] = $sep . 'referer: ' . ( $tmp = $_SERVER['HTTP_REFERER'] ?? 'unknown' ); 357 $message[] = $sep . 'user agent: ' . ( $tmp = $_SERVER['HTTP_USER_AGENT'] ?? 'unknown' ); 358 $message[] = $sep . 'logged in user: ' . $user; 359 $message[] = $sep . 'request type: ' . implode( ' :: ', $request_type ); 360 $message[] = $sep . 'request: ' . $request; 313 361 $message[] = $sep . 'END OF THIS ERROR END OF THIS ERROR' . "\n\n"; 314 362 -
lct-useful-shortcodes-functions/trunk/code/plugins/Avada/api/overrides.php
r2679272 r2782154 38 38 * @return string 39 39 * @since 2019.25 40 * @verified 2022.0 1.0440 * @verified 2022.08.17 41 41 */ 42 42 function lct_avada_template_version_router( $template ) { … … 68 68 case 7.5: 69 69 case 7.6: 70 case 7.7: 71 case 7.8: 70 72 $piece = 'v3'; 71 73 break; … … 101 103 case 7.5: 102 104 case 7.6: 105 case 7.7: 106 case 7.8: 103 107 $template = 'templates/header-1'; 104 108 $piece = 'v3'; … … 141 145 case 7.5: 142 146 case 7.6: 147 case 7.7: 148 case 7.8: 143 149 $template = 'templates/header-1'; 144 150 $piece = 'v3'; … … 174 180 case 7.5: 175 181 case 7.6: 182 case 7.7: 183 case 7.8: 176 184 $piece = 'v2'; 177 185 break; … … 204 212 case 7.5: 205 213 case 7.6: 214 case 7.7: 215 case 7.8: 206 216 $piece = 'v2'; 207 217 break; … … 238 248 case 7.5: 239 249 case 7.6: 250 case 7.7: 240 251 $piece = 'v4'; 241 252 break; 242 253 243 254 255 case 7.8: 256 $piece = 'v5'; 257 break; 258 259 244 260 default: 245 $piece = 'v 4';261 $piece = 'v5'; 246 262 } 247 263 break; … … 264 280 case 7.5: 265 281 case 7.6: 282 case 7.7: 283 case 7.8: 266 284 $piece = 'v2'; 267 285 break; … … 311 329 case 7.5: 312 330 case 7.6: 331 case 7.7: 313 332 $piece = 'v7'; 314 333 break; 315 334 316 335 336 case 7.8: 337 $piece = 'v8'; 338 break; 339 340 317 341 default: 318 $piece = 'v 7';342 $piece = 'v8'; 319 343 } 320 344 break; -
lct-useful-shortcodes-functions/trunk/code/plugins/acf/_shortcodes.php
r2679272 r2782154 1980 1980 * @return string 1981 1981 * @since 2017.42 1982 * @verified 20 17.06.061982 * @verified 2022.08.24 1983 1983 */ 1984 1984 function acf( $a ) { … … 2017 2017 2018 2018 if ( function_exists( 'acf_shortcode' ) ) { 2019 $field = acf_maybe_get_field( $a['field'], $a['post_id'] ); 2020 2021 2022 switch ( $field['type'] ) { 2019 $field_type = ''; 2020 2021 if ( 2022 ( $field = acf_maybe_get_field( $a['field'], $a['post_id'] ) ) && 2023 ! empty( $field['type'] ) 2024 ) { 2025 $field_type = $field['type']; 2026 } 2027 2028 2029 switch ( $field_type ) { 2023 2030 case 'taxonomy': 2024 2031 $shortcode = acf_shortcode( $a ); -
lct-useful-shortcodes-functions/trunk/code/plugins/acf/api/form.php
r2692503 r2782154 79 79 * @return bool|string 80 80 * @since 7.49 81 * @verified 2022.0 2.0981 * @verified 2022.08.22 82 82 */ 83 83 function lct_acf_form2( $a ) { … … 563 563 */ 564 564 if ( 565 isset( $a['form'] ) && 566 ! empty( $a['lct_hide_submit'] ) && 565 567 $a['form'] === false && 566 568 $a['lct_hide_submit'] === true … … 794 796 * @return mixed 795 797 * @since 2017.34 796 * @verified 2022.0 1.06798 * @verified 2022.09.07 797 799 */ 798 800 function lct_acf_format_value( $raw_value, $post_id, $field, $clear_cache = false, $class = null ) { … … 877 879 878 880 if ( 879 ( $tmp = $field[ get_cnst( 'class_selector' ) ] ) && 880 ! empty( $tmp ) && 881 ! empty( $field[ get_cnst( 'class_selector' ) ] ) && 881 882 in_array( 'dompdf_only_show_checked', $field[ get_cnst( 'class_selector' ) ] ) 882 883 ) { … … 1324 1325 1325 1326 foreach ( $field['value'] as $key_part ) { 1326 $value[] = $field['choices'][ $key_part ]; 1327 if ( isset( $field['choices'][ $key_part ] ) ) 1328 $value[] = $field['choices'][ $key_part ]; 1327 1329 } 1328 1330 … … 1494 1496 */ 1495 1497 } else { 1496 $value = lct_acf_format_value_user( $value, $field['return_format'] ); 1498 $return_format = 'id'; 1499 if ( $field['return_format'] ) 1500 $return_format = $field['return_format']; 1501 1502 1503 $value = lct_acf_format_value_user( $value, $return_format ); 1497 1504 $value = apply_filters( 'lct/acf/format_value/type_user/value', $value, $field, $class ); 1498 1505 -
lct-useful-shortcodes-functions/trunk/code/plugins/acf/api/get.php
r2679272 r2782154 1103 1103 * @return mixed 1104 1104 * @since 5.2 1105 * @verified 20 16.09.301105 * @verified 2022.08.24 1106 1106 */ 1107 1107 function get_label( $field_name, $post_id = false ) { … … 1109 1109 1110 1110 1111 return $field['label']; 1111 if ( isset( $field['label'] ) ) 1112 return $field['label']; 1113 1114 1115 return ''; 1112 1116 } 1113 1117 } … … 1131 1135 1132 1136 /** 1133 * When you are saving an ACF form they store the values in an array with the field_key as the thearray key.1137 * When you are saving an ACF form they store the values in an array with the field_key as the array key. 1134 1138 * This function allows you to look up a value by the selector as well 1135 1139 * … … 1230 1234 1231 1235 /** 1232 * When you are saving an ACF form they store the values in an array with the field_key as the thearray key.1236 * When you are saving an ACF form they store the values in an array with the field_key as the array key. 1233 1237 * This function allows you to look up a value by the selector as well 1234 1238 * … … 1289 1293 1290 1294 /** 1291 * When you are saving an ACF form they store the values in an array with the field_key as the thearray key.1295 * When you are saving an ACF form they store the values in an array with the field_key as the array key. 1292 1296 * This function allows you to look up a value by the selector as well 1293 1297 * -
lct-useful-shortcodes-functions/trunk/code/plugins/acf/field_settings.php
r2591087 r2782154 515 515 * @return array 516 516 * @since 7.51 517 * @verified 20 16.12.09517 * @verified 2022.09.07 518 518 */ 519 519 function update_field_update_choices( $field ) { 520 if ( 521 ( $tmp = $field[ get_cnst( 'preset_choices' ) ] ) && 522 ! empty( $tmp ) 523 ) { 520 if ( ! empty( $field[ get_cnst( 'preset_choices' ) ] ) ) 524 521 $field['choices'] = []; 525 }526 522 527 523 -
lct-useful-shortcodes-functions/trunk/code/plugins/acf/instant_save.php
r2679272 r2782154 545 545 * @return mixed 546 546 * @since 0.0 547 * @verified 202 0.06.13547 * @verified 2022.08.24 548 548 */ 549 549 function non_ajax_add_comment( $value, $post_id, $field ) { … … 649 649 650 650 651 if ( 652 array_diff( $check_old, $check_new ) || 653 array_diff( $check_new, $check_old ) 654 ) { 651 if ( afwp_acf_json_encode( $check_old ) !== afwp_acf_json_encode( $check_new ) ) 655 652 $should_add_comment = true; 656 }657 653 } else if ( $vars[ $this->meta->value_old ] != $vars[ $this->meta->value ] ) { 658 654 $should_add_comment = true; -
lct-useful-shortcodes-functions/trunk/code/wp_api/general.php
r2679272 r2782154 33 33 * @var array 34 34 */ 35 public $response_data = [35 public array $response_data = [ 36 36 'status' => 'fail', 37 'data' => [], 38 'details' => 'Nothing Happened', 37 'atts' => [], 39 38 'html' => null, 40 39 'response_html' => null, 40 'alert_status' => null, 41 'alert_html' => null, 41 42 ]; 42 43 /** -
lct-useful-shortcodes-functions/trunk/lct-useful-shortcodes-functions.php
r2771323 r2782154 4 4 * Plugin URI: https://www.simplesmithmedia.com 5 5 * Description: Shortcodes & Functions that will help make your life easier. 6 * Version: 2022. 56 * Version: 2022.6 7 7 * Author: SimpleSmithMedia 8 8 * Author URI: https://www.simplesmithmedia.com -
lct-useful-shortcodes-functions/trunk/readme.txt
r2771323 r2782154 3 3 Tags: Functions, Shortcodes 4 4 Requires at least: 5.0 5 Tested up to: 5.9.36 Requires PHP: 5.65 Tested up to: 6.0.1 6 Requires PHP: 7.4 7 7 License: GPLv2 or later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 33 33 34 34 == Changelog == 35 = 2022.6 = 36 *Release Date - 8 September 2022* 37 38 * PHP v8.1 Ready 39 * WP v6.0.1 Ready 40 * Avada v7.8.1 Ready 41 * Updated: 42 * lct_avada_template_version_router() 43 * Improved: 44 * lct_previous_function() 45 * lct_debug_to_error_log() 46 * lct_acf_form2() 47 * lct_acf_format_value() 48 * get_label() 49 * [lct_acf] 50 * lct_acf_instant_save{}non_ajax_add_comment() 51 * PDER{}send_ereminder() 52 * lct_acf_field_settings{}update_field_update_choices() 53 * lct_taxonomies{}disable_status_slug_editing() 54 * lct_taxonomies{}disable_status_slug_editing_on_term() 55 35 56 = 2022.5 = 36 57 *Release Date - 16 August 2022*
Note: See TracChangeset
for help on using the changeset viewer.