Page Builder: PageLayer – Drag and Drop website builder - Version 1.4.4

Version Description

(Jan 22, 2021) = * [Feature] Added the option to revert a setting to the default. * [Feature] Added All Archive type for all registered posts for Pagelayer Templates. * [Feature] CSS output of Pagelayer per page will reduce by 10% making the page faster. * [Bug-Fix] On some servers, the comments are removed from the HTML output, causing editing to break. This is now fixed.

Download this release

Release Info

Developer pagelayer
Plugin Icon 128x128 Page Builder: PageLayer – Drag and Drop website builder
Version 1.4.4
Comparing to
See all releases

Code changes from version 1.4.3 to 1.4.4

css/pagelayer-editor.css CHANGED
@@ -656,6 +656,10 @@ visibility: visible !important;
656
  border-bottom: 1px dashed #686870;
657
  }
658
 
 
 
 
 
659
  .pagelayer-elp-label-div{
660
  padding:4px 0px 4px 0px;
661
  position:relative;
@@ -768,7 +772,7 @@ background-color: #3E8EF7;
768
  background-color: #1066fd;
769
  }
770
 
771
- .pagelayer-elp-screen .pagelayer-prop-screen:hover{
772
  color: #3E8EF7;
773
  }
774
 
@@ -792,6 +796,26 @@ color:#bdbdbd;
792
  color: #3e8ef7;
793
  }
794
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
795
  .pagelayer-elp-desc{
796
  color: rgba(49, 52, 57, 0.8);
797
  font-size: 12px;
656
  border-bottom: 1px dashed #686870;
657
  }
658
 
659
+ .pagelayer-form-item:hover .pagelayer-elp-default[data_show=true]{
660
+ display:initial;
661
+ }
662
+
663
  .pagelayer-elp-label-div{
664
  padding:4px 0px 4px 0px;
665
  position:relative;
772
  background-color: #1066fd;
773
  }
774
 
775
+ .pagelayer-elp-screen .pagelayer-prop-screen:hover, .pagelayer-elp-default:hover i{
776
  color: #3E8EF7;
777
  }
778
 
796
  color: #3e8ef7;
797
  }
798
 
799
+ /* Default button css start */
800
+ .pagelayer-elp-default{
801
+ display:none;
802
+ width: 20px;
803
+ height: 20px;
804
+ cursor: pointer;
805
+ margin:4px;
806
+ }
807
+
808
+ .pagelayer-elp-default:focus{
809
+ outline:none;
810
+ }
811
+
812
+ .pagelayer-elp-default i{
813
+ font-size: 10px;
814
+ color: black;
815
+ }
816
+
817
+ /* Default button css ends */
818
+
819
  .pagelayer-elp-desc{
820
  color: rgba(49, 52, 57, 0.8);
821
  font-size: 12px;
init.php CHANGED
@@ -5,7 +5,7 @@ if (!defined('ABSPATH')) exit;
5
 
6
  define('PAGELAYER_BASE', plugin_basename(PAGELAYER_FILE));
7
  define('PAGELAYER_PRO_BASE', 'pagelayer-pro/pagelayer-pro.php');
8
- define('PAGELAYER_VERSION', '1.4.3');
9
  define('PAGELAYER_DIR', dirname(PAGELAYER_FILE));
10
  define('PAGELAYER_SLUG', 'pagelayer');
11
  define('PAGELAYER_URL', plugins_url('', PAGELAYER_FILE));
@@ -606,8 +606,8 @@ function pagelayer_enqueue_frontend($force = false){
606
 
607
  // Load the google fonts
608
  add_action('wp_footer', 'pagelayer_enqueue_fonts', 5);
609
-
610
- function pagelayer_enqueue_fonts(){
611
  global $pagelayer;
612
 
613
  if(empty($pagelayer->cache['enqueue_frontend'])){
@@ -633,7 +633,11 @@ function pagelayer_enqueue_fonts(){
633
  }
634
 
635
  foreach($pagelayer->runtime_fonts as $font => $weights){
636
- $url[] = $font.':'.implode(',', $weights);
 
 
 
 
637
  }
638
 
639
  // If no fonts are to be set, then we dont set
@@ -641,9 +645,13 @@ function pagelayer_enqueue_fonts(){
641
  return false;
642
  }
643
 
644
- wp_register_style('pagelayer-google-font', 'https://fonts.googleapis.com/css?family='.rawurlencode(implode('|', $url)), array(), PAGELAYER_VERSION);
645
- wp_enqueue_style('pagelayer-google-font');
 
 
646
 
 
 
647
  }
648
 
649
  // Load any header we have
@@ -782,6 +790,14 @@ if(!empty($screen_style['mobile'])){
782
 
783
  $styles .= PHP_EOL.'</style>';
784
 
 
 
 
 
 
 
 
 
785
  echo $styles;
786
  }
787
 
@@ -870,8 +886,8 @@ function pagelayer_after_title(){
870
 
871
  echo '
872
  <div id="pagelayer-editor-button-row" style="margin-top:15px; display:inline-block;">
873
- <a id="pagelayer-editor-button" href="'.$link.'" class="button button-primary button-large" style="height:auto; padding:6px; font-size:18px;">
874
- <img src="'.PAGELAYER_URL.'/images/pagelayer-logo-40.png" align="top" width="24" /> <span>'.__('Edit with Pagelayer').'</span>
875
  </a>
876
  </div>';
877
 
@@ -890,8 +906,8 @@ function pagelayer_gutenberg_after_title(){
890
 
891
  echo '
892
  <div id="pagelayer-editor-button-row" style="margin-left:15px; display:none">
893
- <a id="pagelayer-editor-button" href="'.$link.'" class="button button-primary button-large" style="height:auto; padding:6px; font-size:18px;">
894
- <img src="'.PAGELAYER_URL.'/images/pagelayer-logo-40.png" align="top" width="24" /> <span>'.__('Edit with Pagelayer').'</span>
895
  </a>
896
  </div>
897
 
5
 
6
  define('PAGELAYER_BASE', plugin_basename(PAGELAYER_FILE));
7
  define('PAGELAYER_PRO_BASE', 'pagelayer-pro/pagelayer-pro.php');
8
+ define('PAGELAYER_VERSION', '1.4.4');
9
  define('PAGELAYER_DIR', dirname(PAGELAYER_FILE));
10
  define('PAGELAYER_SLUG', 'pagelayer');
11
  define('PAGELAYER_URL', plugins_url('', PAGELAYER_FILE));
606
 
607
  // Load the google fonts
608
  add_action('wp_footer', 'pagelayer_enqueue_fonts', 5);
609
+ function pagelayer_enqueue_fonts($suffix = '-header'){
610
+
611
  global $pagelayer;
612
 
613
  if(empty($pagelayer->cache['enqueue_frontend'])){
633
  }
634
 
635
  foreach($pagelayer->runtime_fonts as $font => $weights){
636
+ $v = $font.':'.implode(',', $weights);
637
+ if(!in_array($v, $pagelayer->fonts_sent)){
638
+ $url[] = $v;
639
+ $pagelayer->fonts_sent[] = $v;
640
+ }
641
  }
642
 
643
  // If no fonts are to be set, then we dont set
645
  return false;
646
  }
647
 
648
+ $fonts_url = 'https://fonts.googleapis.com/css?family='.rawurlencode(implode('|', $url));
649
+
650
+ wp_register_style('pagelayer-google-font'.$suffix, $fonts_url, array(), PAGELAYER_VERSION);
651
+ wp_enqueue_style('pagelayer-google-font'.$suffix);
652
 
653
+ echo '<link rel="preload" href="'.$fonts_url.'" as="fetch" crossorigin="anonymous">';
654
+
655
  }
656
 
657
  // Load any header we have
790
 
791
  $styles .= PHP_EOL.'</style>';
792
 
793
+ // Lets just build a temporary list of fonts so that we can add prefetch !
794
+ pagelayer_enqueue_fonts();
795
+
796
+ if(!empty($pagelayer->runtime_fonts)){
797
+ echo '<link rel="dns-prefetch" href="https://fonts.gstatic.com">
798
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous">';
799
+ }
800
+
801
  echo $styles;
802
  }
803
 
886
 
887
  echo '
888
  <div id="pagelayer-editor-button-row" style="margin-top:15px; display:inline-block;">
889
+ <a id="pagelayer-editor-button" href="'.$link.'" class="button button-primary button-large" style="height:auto; padding:6px; font-size:18px; display:flex; align-items:center;">
890
+ <img src="'.PAGELAYER_URL.'/images/pagelayer-logo-40.png" width="24" style="margin-right:4px" /> <span>'.__('Edit with Pagelayer').'</span>
891
  </a>
892
  </div>';
893
 
906
 
907
  echo '
908
  <div id="pagelayer-editor-button-row" style="margin-left:15px; display:none">
909
+ <a id="pagelayer-editor-button" href="'.$link.'" class="button button-primary button-large" style="height:auto; padding:6px; font-size:18px; display:flex; align-items:center;">
910
+ <img src="'.PAGELAYER_URL.'/images/pagelayer-logo-40.png" align="top" width="24" style="margin-right:4px"/> <span>'.__('Edit with Pagelayer').'</span>
911
  </a>
912
  </div>
913
 
js/pagelayer-editor.js CHANGED
@@ -94,6 +94,9 @@ function pagelayer_start(){
94
  // Setup the ELPD
95
  pagelayer_elpd_setup();
96
 
 
 
 
97
  // Setup the properties of the elements
98
  pagelayer_element_setup();
99
 
@@ -1273,6 +1276,12 @@ function pagelayer_id(jEle){
1273
 
1274
  }
1275
 
 
 
 
 
 
 
1276
  // Assign the jQuery object an ID
1277
  function pagelayer_assign_id(jEle){
1278
 
@@ -1335,6 +1344,16 @@ function pagelayer_edit_element(selector){
1335
  pagelayer_element_clicked(selector);
1336
  }
1337
 
 
 
 
 
 
 
 
 
 
 
1338
  // Setup the properties on a single click
1339
  function pagelayer_element_setup(selector, render){
1340
 
@@ -1515,6 +1534,7 @@ function pagelayer_element_unsetup(selector, id){
1515
  var html = src[0].outerHTML;
1516
 
1517
  var jEle = jQuery(html);
 
1518
  jEle.removeAttr('pagelayer-id');
1519
  jEle.find('[pagelayer-id]').removeAttr('pagelayer-id');
1520
  jEle.find('[pagelayer-parent]').removeAttr('pagelayer-parent');// Remove the parent attribute as it will be reset during pagelayer_element_setup
@@ -2597,10 +2617,18 @@ function pagelayer_el_data_ref(jEle){
2597
  pagelayer.el[id]['attr'] = {};
2598
  }
2599
 
 
 
 
 
2600
  if(!('tmp' in pagelayer.el[id])){
2601
  pagelayer.el[id]['tmp'] = {};
2602
  }
2603
 
 
 
 
 
2604
  return pagelayer.el[id];
2605
  };
2606
 
@@ -2968,7 +2996,7 @@ function pagelayer_hex8_to_rgba(val){
2968
  // Replace the variables
2969
  function pagelayer_parse_el_vars(str, el){
2970
 
2971
- str = str.split('{{element}}').join(el.CSS.sel);
2972
  str = str.split('{{wrap}}').join(el.CSS.wrap);
2973
  str = str.split('{{ele_id}}').join(el.id);
2974
 
@@ -3011,12 +3039,16 @@ function pagelayer_sc_render(jEle){
3011
  remove_attr: [],
3012
  css: [],
3013
  edit: [],
 
3014
  sel: '[pagelayer-id="'+el.id+'"]',
3015
  wrap: '[pagelayer-wrap-id="'+el.id+'"]'
3016
  };
3017
 
3018
  // Create a reference
3019
  el.CSS = elCSS;
 
 
 
3020
 
3021
  //console.log(el.atts);
3022
 
@@ -3379,7 +3411,7 @@ function pagelayer_sc_render(jEle){
3379
  if(!pagelayer_empty(all_props['overide_css_selector'])){
3380
  for(var r in rules){
3381
  var overide_css_selector = pagelayer_parse_el_vars(all_props['overide_css_selector'], el);
3382
- rules[r] = rules[r].split(el.CSS.sel).join(overide_css_selector);
3383
  rules[r] = rules[r].split(el.CSS.wrap).join(overide_css_selector);
3384
  }
3385
  }
@@ -3554,6 +3586,10 @@ function pagelayer_close(){
3554
  window.top.location.href = pagelayer_returnURL;
3555
  }
3556
  };
 
 
 
 
3557
 
3558
  function pagelayer_serializeAttributes(attributes) {
3559
  return JSON.stringify(attributes) // Don't break HTML comments.
@@ -3899,9 +3935,8 @@ function pagelayer_leftbar(){
3899
 
3900
  // Indivdual icon
3901
  for(var y in pagelayer_global_widgets){
3902
-
3903
- var sc = pagelayer_tag( jQuery(pagelayer_global_widgets[y]['$']) );
3904
-
3905
 
3906
  if(!(sc in pagelayer_shortcodes) || 'not_visible' in pagelayer_shortcodes[sc]){
3907
  continue;
94
  // Setup the ELPD
95
  pagelayer_elpd_setup();
96
 
97
+ // Dump the data we have
98
+ pagelayer_element_dump_data();
99
+
100
  // Setup the properties of the elements
101
  pagelayer_element_setup();
102
 
1276
 
1277
  }
1278
 
1279
+ // Remove Pagelayer ID class
1280
+ function pagelayer_remove_id_calss(jEle){
1281
+ var id = jEle.attr('pagelayer-id');
1282
+ jEle.removeClass('p-'+id);
1283
+ }
1284
+
1285
  // Assign the jQuery object an ID
1286
  function pagelayer_assign_id(jEle){
1287
 
1344
  pagelayer_element_clicked(selector);
1345
  }
1346
 
1347
+ // Dump the data from the el to the elements
1348
+ function pagelayer_element_dump_data(){
1349
+ for(var x in pagelayer.el){
1350
+ var jEle = pagelayer_ele_by_id(x);
1351
+ if(jEle.length > 0){
1352
+ pagelayer_el_dump_data(jEle);
1353
+ }
1354
+ }
1355
+ }
1356
+
1357
  // Setup the properties on a single click
1358
  function pagelayer_element_setup(selector, render){
1359
 
1534
  var html = src[0].outerHTML;
1535
 
1536
  var jEle = jQuery(html);
1537
+ pagelayer_remove_id_calss(jEle);
1538
  jEle.removeAttr('pagelayer-id');
1539
  jEle.find('[pagelayer-id]').removeAttr('pagelayer-id');
1540
  jEle.find('[pagelayer-parent]').removeAttr('pagelayer-parent');// Remove the parent attribute as it will be reset during pagelayer_element_setup
2617
  pagelayer.el[id]['attr'] = {};
2618
  }
2619
 
2620
+ if(Array.isArray(pagelayer.el[id]['attr'])){
2621
+ pagelayer.el[id]['attr'] = {};
2622
+ }
2623
+
2624
  if(!('tmp' in pagelayer.el[id])){
2625
  pagelayer.el[id]['tmp'] = {};
2626
  }
2627
 
2628
+ if(Array.isArray(pagelayer.el[id]['tmp'])){
2629
+ pagelayer.el[id]['tmp'] = {};
2630
+ }
2631
+
2632
  return pagelayer.el[id];
2633
  };
2634
 
2996
  // Replace the variables
2997
  function pagelayer_parse_el_vars(str, el){
2998
 
2999
+ str = str.split('{{element}}').join(el.CSS.cssSel);
3000
  str = str.split('{{wrap}}').join(el.CSS.wrap);
3001
  str = str.split('{{ele_id}}').join(el.id);
3002
 
3039
  remove_attr: [],
3040
  css: [],
3041
  edit: [],
3042
+ cssSel: '.p-'+el.id,
3043
  sel: '[pagelayer-id="'+el.id+'"]',
3044
  wrap: '[pagelayer-wrap-id="'+el.id+'"]'
3045
  };
3046
 
3047
  // Create a reference
3048
  el.CSS = elCSS;
3049
+
3050
+ // Make sure if we have the class selector
3051
+ el.$.addClass('p-'+el.id);
3052
 
3053
  //console.log(el.atts);
3054
 
3411
  if(!pagelayer_empty(all_props['overide_css_selector'])){
3412
  for(var r in rules){
3413
  var overide_css_selector = pagelayer_parse_el_vars(all_props['overide_css_selector'], el);
3414
+ rules[r] = rules[r].split(el.CSS.cssSel).join(overide_css_selector);
3415
  rules[r] = rules[r].split(el.CSS.wrap).join(overide_css_selector);
3416
  }
3417
  }
3586
  window.top.location.href = pagelayer_returnURL;
3587
  }
3588
  };
3589
+
3590
+ function pagelayer_htmlEntities(str) {
3591
+ return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
3592
+ }
3593
 
3594
  function pagelayer_serializeAttributes(attributes) {
3595
  return JSON.stringify(attributes) // Don't break HTML comments.
3935
 
3936
  // Indivdual icon
3937
  for(var y in pagelayer_global_widgets){
3938
+ var wEle = jQuery(pagelayer_global_widgets[y]['$']);
3939
+ var sc = pagelayer_tag( wEle );
 
3940
 
3941
  if(!(sc in pagelayer_shortcodes) || 'not_visible' in pagelayer_shortcodes[sc]){
3942
  continue;
js/pagelayer-frontend.js CHANGED
@@ -529,9 +529,13 @@ function pagelayer_pl_video(jEle){
529
  if(vidSrc[vidSrc.indexOf('&autoplay=')+10] == 0){
530
  vidElm.removeAttr('autoplay');
531
  vidElm[0].pause();
 
 
 
532
  }
533
  if(vidSrc[vidSrc.indexOf('&mute=')+6] == 1){
534
  vidElm[0].muted = "muted";
 
535
  }
536
  });
537
 
529
  if(vidSrc[vidSrc.indexOf('&autoplay=')+10] == 0){
530
  vidElm.removeAttr('autoplay');
531
  vidElm[0].pause();
532
+ }else if(vidSrc[vidSrc.indexOf('&autoplay=')+10] == 1){
533
+ vidElm.attr('autoplay','');
534
+ vidElm.attr('playsinline','');
535
  }
536
  if(vidSrc[vidSrc.indexOf('&mute=')+6] == 1){
537
  vidElm[0].muted = "muted";
538
+ vidElm.attr('muted','');
539
  }
540
  });
541
 
js/properties.js CHANGED
@@ -420,38 +420,51 @@ function pagelayer_elpd_row(holder, tab, section, props, name){
420
  // Append the row
421
  holder.append(row);
422
 
423
- if('group' in prop){
424
- row.attr('pagelayer-access-item', prop.group);
425
- }
426
 
427
- var fn_ui = window['pagelayer_elp_'+prop['type']+'_ui'];
 
 
 
 
 
 
 
428
 
429
- // Is there a UI Handler ?
430
- if(typeof fn_ui == 'function'){
431
-
432
- fn_ui(row, prop);
433
-
434
- // Use the default mechanism
435
- }else{
436
-
437
- // The label
438
- pagelayer_elp_label(row, prop);
439
-
440
- // The main property
441
- fn(row, prop);
442
-
443
- // Is there a description ?
444
- if(!pagelayer_empty(prop['desc'])){
445
- pagelayer_elp_desc(row, prop['desc']);
446
- }
447
 
 
 
 
 
 
 
 
 
 
448
  }
449
 
450
- return row;
 
 
 
451
 
452
  }
453
 
454
- };
 
455
 
456
  // Show the rows as per the active tab and also handle the rows that are supposed to be shown or not
457
  function pagelayer_elpd_show_rows(){
@@ -711,11 +724,12 @@ function _pagelayer_set_atts(row, val, no_default){
711
  var id = row.closest('[pagelayer-element-id]').attr('pagelayer-element-id');
712
  var jEle = jQuery('[pagelayer-id='+id+']');
713
  var tag = pagelayer_tag(jEle);
714
- var prop_name = row.attr('pagelayer-elp-name');
 
715
 
716
  // Is there a unit ?
717
  var uEle = row.find('.pagelayer-elp-units');
718
- if(uEle.length > 0){
719
  var unit = uEle.find('[selected]').html();
720
  if(Array.isArray(val)){
721
  for(var i in val){
@@ -753,9 +767,14 @@ function _pagelayer_set_atts(row, val, no_default){
753
 
754
  // Render
755
  pagelayer_sc_render(jEle);
 
 
 
 
 
756
 
757
- if('onchange' in pagelayer.props_ref[tag][prop_name]){
758
- var fn = window[pagelayer.props_ref[tag][prop_name]['onchange']];
759
  if(typeof fn === 'function'){
760
  fn(jEle, row, val);
761
  }
@@ -911,6 +930,27 @@ function pagelayer_elp_label(row, prop){
911
 
912
  }
913
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
914
  };
915
 
916
  // Create the Description
@@ -922,7 +962,7 @@ function pagelayer_elp_desc(row, label){
922
  function pagelayer_elp_text(row, prop){
923
 
924
  var div = '<div class="pagelayer-elp-text-div">'+
925
- '<input type="text" class="pagelayer-elp-text" name="'+prop.c['name']+'" value="'+prop.c['val']+'"></input>'+
926
  '</div>';
927
 
928
  row.append(div);
@@ -3198,7 +3238,7 @@ function pagelayer_elp_typography(row, prop){
3198
  '<div class="pagelayer-elp-typo-div">'+
3199
  '<div class="pagelayer-elp-typo pagelayer-elp-typo-fonts">'+
3200
  '<label class="pagelayer-elp-label">'+pagelayer_l('font_family')+'</label>'+
3201
- '<div class="pagelayer-elp-typo-sele" data-val="'+val[0]+'">'+val[0]+'</div>'+
3202
  '<div class="pagelayer-ele-type-sec">'+
3203
  '<input class="pagelayer-elp-typo-search" placeholder="Search here..."></input>'+
3204
  '<div class="pagelayer-elp-typo-container">';
@@ -3298,7 +3338,7 @@ function pagelayer_elp_typography(row, prop){
3298
  row.find('.pagelayer-elp-typo-container').on('click', function(e){
3299
  var jEle = jQuery(e.target);
3300
  var set_val = jEle.attr('value');
3301
- row.find('.pagelayer-elp-typo-sele').data('val',set_val).html(set_val);
3302
  row.find('.pagelayer-ele-type-sec').slideUp();
3303
  val = [];
3304
  val[0] = set_val;
@@ -3340,7 +3380,9 @@ function pagelayer_elp_typography(row, prop){
3340
  value = value.replace(' ', '+');
3341
 
3342
  if(jQuery('#pagelayer-google-fonts').length == 0){
3343
-
 
 
3344
  jQuery('head').append('<link id="pagelayer-google-fonts" href="https://fonts.googleapis.com/css?family='+value+':100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">');
3345
 
3346
  }else{
@@ -3539,3 +3581,36 @@ function pagelayer_select_frame(tag, state){
3539
  return frame;
3540
 
3541
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
420
  // Append the row
421
  holder.append(row);
422
 
423
+ return pagelayer_elpd_render_row(row, prop);
 
 
424
 
425
+ }
426
+
427
+ };
428
+
429
+ // Render a row
430
+ function pagelayer_elpd_render_row(row, prop){
431
+
432
+ var fn = window['pagelayer_elp_'+prop['type']];
433
 
434
+ if('group' in prop){
435
+ row.attr('pagelayer-access-item', prop.group);
436
+ }
437
+
438
+ var fn_ui = window['pagelayer_elp_'+prop['type']+'_ui'];
439
+
440
+ // Is there a UI Handler ?
441
+ if(typeof fn_ui == 'function'){
442
+
443
+ fn_ui(row, prop);
444
+
445
+ // Use the default mechanism
446
+ }else{
 
 
 
 
 
447
 
448
+ // The label
449
+ pagelayer_elp_label(row, prop);
450
+
451
+ // The main property
452
+ fn(row, prop);
453
+
454
+ // Showing default button or not
455
+ if(pagelayer_properties_filter(prop['type']) && pagelayer_empty(row.find('.pagelayer-pro-req').length)){
456
+ pagelayer_show_default_button(row, prop, prop.c['val']);
457
  }
458
 
459
+ // Is there a description ?
460
+ if(!pagelayer_empty(prop['desc'])){
461
+ pagelayer_elp_desc(row, prop['desc']);
462
+ }
463
 
464
  }
465
 
466
+ return row;
467
+ }
468
 
469
  // Show the rows as per the active tab and also handle the rows that are supposed to be shown or not
470
  function pagelayer_elpd_show_rows(){
724
  var id = row.closest('[pagelayer-element-id]').attr('pagelayer-element-id');
725
  var jEle = jQuery('[pagelayer-id='+id+']');
726
  var tag = pagelayer_tag(jEle);
727
+ var prop_name = row.attr('pagelayer-elp-name');
728
+ var prop = pagelayer.props_ref[tag][prop_name];
729
 
730
  // Is there a unit ?
731
  var uEle = row.find('.pagelayer-elp-units');
732
+ if(uEle.length > 0 && !pagelayer_empty(val)){
733
  var unit = uEle.find('[selected]').html();
734
  if(Array.isArray(val)){
735
  for(var i in val){
767
 
768
  // Render
769
  pagelayer_sc_render(jEle);
770
+
771
+ // Show default button or not
772
+ if(pagelayer_properties_filter(prop) && pagelayer_empty(row.find('.pagelayer-pro-req').length)){
773
+ pagelayer_show_default_button(row, prop, val);
774
+ }
775
 
776
+ if('onchange' in prop){
777
+ var fn = window[prop['onchange']];
778
  if(typeof fn === 'function'){
779
  fn(jEle, row, val);
780
  }
930
 
931
  }
932
 
933
+ // Include default button
934
+ if(pagelayer_properties_filter(prop['type']) && pagelayer_empty(row.find('.pagelayer-pro-req').length)){
935
+
936
+ var defaultButton = '<span class="pagelayer-elp-default" title="'+pagelayer_l('back_to_default')+'" ><i class="fas fa-undo"></i></span>';
937
+ label.append(defaultButton);
938
+
939
+ label.find('.pagelayer-elp-default').on('click', function(){
940
+
941
+ prop.c['val'] = ('default' in prop) ? prop.default : '';
942
+ _pagelayer_set_atts(row, prop.c['val']);
943
+
944
+ jQuery(this).attr('data_show',false);
945
+
946
+ // Empty the row
947
+ row.html('');
948
+
949
+ // Re-render the row
950
+ pagelayer_elpd_render_row(row, prop);
951
+
952
+ });
953
+ }
954
  };
955
 
956
  // Create the Description
962
  function pagelayer_elp_text(row, prop){
963
 
964
  var div = '<div class="pagelayer-elp-text-div">'+
965
+ '<input type="text" class="pagelayer-elp-text" name="'+prop.c['name']+'" value="'+pagelayer_htmlEntities(prop.c['val'])+'"></input>'+
966
  '</div>';
967
 
968
  row.append(div);
3238
  '<div class="pagelayer-elp-typo-div">'+
3239
  '<div class="pagelayer-elp-typo pagelayer-elp-typo-fonts">'+
3240
  '<label class="pagelayer-elp-label">'+pagelayer_l('font_family')+'</label>'+
3241
+ '<div class="pagelayer-elp-typo-sele" data-val="'+val[0]+'">'+ ((val[0]=="") ? "Default" : val[0]) +'</div>'+
3242
  '<div class="pagelayer-ele-type-sec">'+
3243
  '<input class="pagelayer-elp-typo-search" placeholder="Search here..."></input>'+
3244
  '<div class="pagelayer-elp-typo-container">';
3338
  row.find('.pagelayer-elp-typo-container').on('click', function(e){
3339
  var jEle = jQuery(e.target);
3340
  var set_val = jEle.attr('value');
3341
+ (set_val == '') ? row.find('.pagelayer-elp-typo-sele').data('val',set_val).html('Default') : row.find('.pagelayer-elp-typo-sele').data('val',set_val).html(set_val);
3342
  row.find('.pagelayer-ele-type-sec').slideUp();
3343
  val = [];
3344
  val[0] = set_val;
3380
  value = value.replace(' ', '+');
3381
 
3382
  if(jQuery('#pagelayer-google-fonts').length == 0){
3383
+ if(value==''){
3384
+ return;
3385
+ }
3386
  jQuery('head').append('<link id="pagelayer-google-fonts" href="https://fonts.googleapis.com/css?family='+value+':100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">');
3387
 
3388
  }else{
3581
  return frame;
3582
 
3583
  }
3584
+
3585
+ // function to show default button
3586
+ function pagelayer_show_default_button(row, prop, value){
3587
+
3588
+ // Default button is visible or not
3589
+ if(row.find('.pagelayer-elp-default').attr('data_show')){
3590
+ return;
3591
+ }
3592
+
3593
+ // value is an object or not
3594
+ if(typeof value == 'object'){
3595
+ // Checking value for NaN, empty and default.
3596
+ for(var i=0; i<value.length; i++){
3597
+ if(value[i]!=prop.default && value[i]==value[i] && value[i] != ''){
3598
+ row.find('.pagelayer-elp-default').attr('data_show',true);
3599
+ break;
3600
+ }
3601
+ }
3602
+ }else{
3603
+ if('default' in prop && value!=prop.default){
3604
+ row.find('.pagelayer-elp-default').attr('data_show',true);
3605
+ }else if(value!=prop.default && value==value && value!=''){
3606
+ row.find('.pagelayer-elp-default').attr('data_show',true);
3607
+ }
3608
+ }
3609
+ }
3610
+
3611
+ // Function which checks the properties to not to show default button
3612
+ function pagelayer_properties_filter(property){
3613
+ var propTypeDefault = ['image', 'text', 'editor', 'textarea', 'checkbox', 'access', 'modal', 'group', 'radio'];
3614
+
3615
+ return (jQuery.inArray(property, propTypeDefault) == -1)
3616
+ }
js/widgets.js CHANGED
@@ -1069,7 +1069,11 @@ function pagelayer_render_pl_contact_item(el){
1069
  function pagelayer_render_pl_post_content(el){
1070
  el.atts['post_content'] = 'Post Content Holder';
1071
  el.CSS.css.push({'sel': '{{element}} .entry-content', 'val': 'min-height:20px;background-color:#e3e3e3;'});
1072
- return;
 
 
 
 
1073
  }
1074
 
1075
  // Render the flipbox
1069
  function pagelayer_render_pl_post_content(el){
1070
  el.atts['post_content'] = 'Post Content Holder';
1071
  el.CSS.css.push({'sel': '{{element}} .entry-content', 'val': 'min-height:20px;background-color:#e3e3e3;'});
1072
+ }
1073
+
1074
+ // Render the post excertp
1075
+ function pagelayer_render_pl_post_excerpt(el){
1076
+ el.tmp['post_excerpt'] = '<div class="pagelayer-post-excerpt pagelayer-empty-widget"></div>';
1077
  }
1078
 
1079
  // Render the flipbox
languages/en.json CHANGED
@@ -1839,5 +1839,7 @@
1839
  "text_decoration" : "Text Decoration",
1840
  "elem_styles" : "Element Styles",
1841
  "body_style" : "Body Style",
1842
- "item_alignment" : "Item Alignment"
 
 
1843
  }
1839
  "text_decoration" : "Text Decoration",
1840
  "elem_styles" : "Element Styles",
1841
  "body_style" : "Body Style",
1842
+ "item_alignment" : "Item Alignment",
1843
+ "back_to_default" : "Restore Default",
1844
+ "disable_category" : "Disable Category"
1845
  }
lib/pquery/gan_node_html.php CHANGED
@@ -191,7 +191,7 @@ class DomNode implements IQuery {
191
  * the value, e.g. selected="selected" will be selected.
192
  * @var bool
193
  */
194
- var $attribute_shorttag = true;
195
 
196
  /**
197
  * Function map used for the selector filter
@@ -336,7 +336,7 @@ class DomNode implements IQuery {
336
  $s .= ' '.$a;
337
  if ((!$this->attribute_shorttag) || ($v !== $a)) {
338
  $quote = '"';//(strpos($v, '"') === false) ? '"' : "'";
339
- $v = str_replace('"', '&amp;quot;', $v);
340
  $s .= '='.$quote.$v.$quote;
341
  }
342
  }
@@ -395,7 +395,7 @@ class DomNode implements IQuery {
395
  * @return string
396
  */
397
  function getOuterText() {
398
- return html_entity_decode($this->toString(), ENT_HTML5);
399
  }
400
 
401
  /**
@@ -437,7 +437,7 @@ class DomNode implements IQuery {
437
  * @return string
438
  */
439
  function getInnerText() {
440
- return html_entity_decode($this->toString(true, true, 1), ENT_HTML5);
441
  }
442
 
443
  /**
@@ -464,7 +464,7 @@ class DomNode implements IQuery {
464
  * @return string
465
  */
466
  function getPlainText() {
467
- return preg_replace('`\s+`', ' ', html_entity_decode($this->toString(true, true, true), ENT_HTML5));
468
  }
469
 
470
  /**
@@ -477,7 +477,7 @@ class DomNode implements IQuery {
477
  if ($enc !== false) {
478
  $txt = mb_convert_encoding($txt, 'UTF-8', $enc);
479
  }
480
- return preg_replace('`\s+`', ' ', html_entity_decode($txt, ENT_HTML5, 'UTF-8'));
481
  }
482
 
483
  /**
@@ -487,7 +487,7 @@ class DomNode implements IQuery {
487
  function setPlainText($text) {
488
  $this->clear();
489
  if (trim($text)) {
490
- $this->addText(htmlentities($text, ENT_HTML5));
491
  }
492
  }
493
 
191
  * the value, e.g. selected="selected" will be selected.
192
  * @var bool
193
  */
194
+ var $attribute_shorttag = false;
195
 
196
  /**
197
  * Function map used for the selector filter
336
  $s .= ' '.$a;
337
  if ((!$this->attribute_shorttag) || ($v !== $a)) {
338
  $quote = '"';//(strpos($v, '"') === false) ? '"' : "'";
339
+ $v = str_replace('"', '&quot;', $v);
340
  $s .= '='.$quote.$v.$quote;
341
  }
342
  }
395
  * @return string
396
  */
397
  function getOuterText() {
398
+ return $this->toString();
399
  }
400
 
401
  /**
437
  * @return string
438
  */
439
  function getInnerText() {
440
+ return $this->toString(true, true, 1);
441
  }
442
 
443
  /**
464
  * @return string
465
  */
466
  function getPlainText() {
467
+ return preg_replace('`\s+`', ' ', $this->toString(true, true, true));
468
  }
469
 
470
  /**
477
  if ($enc !== false) {
478
  $txt = mb_convert_encoding($txt, 'UTF-8', $enc);
479
  }
480
+ return preg_replace('`\s+`', ' ', $txt);
481
  }
482
 
483
  /**
487
  function setPlainText($text) {
488
  $this->clear();
489
  if (trim($text)) {
490
+ $this->addText($text);
491
  }
492
  }
493
 
main/ajax.php CHANGED
@@ -530,7 +530,7 @@ function pagelayer_get_section_shortcodes(){
530
  pagelayer_load_shortcodes();
531
 
532
  if(!empty($data['code'])){
533
- $data['code'] = pagelayer_the_content($data['code']);
534
  }
535
 
536
  pagelayer_json_output($data);
@@ -722,7 +722,7 @@ function pagelayer_apply_revision(){
722
  pagelayer_load_shortcodes();
723
 
724
  $ret['id'] = $revisionID;
725
- $ret['content'] = pagelayer_the_content($post->post_content);
726
 
727
  if (is_wp_error($postID)) {
728
  $ret['error'] = __pl('rev_load_error');
@@ -1292,7 +1292,6 @@ function pagelayer_search_ids() {
1292
  wp_die();
1293
  }
1294
 
1295
-
1296
  // Save the post data from pagelayer setting page
1297
  add_action('wp_ajax_pagelayer_save_template', 'pagelayer_save_template');
1298
  function pagelayer_save_template() {
530
  pagelayer_load_shortcodes();
531
 
532
  if(!empty($data['code'])){
533
+ $data['code'] = pagelayer_the_content($data['code'], true);
534
  }
535
 
536
  pagelayer_json_output($data);
722
  pagelayer_load_shortcodes();
723
 
724
  $ret['id'] = $revisionID;
725
+ $ret['content'] = pagelayer_the_content($post->post_content, true);
726
 
727
  if (is_wp_error($postID)) {
728
  $ret['error'] = __pl('rev_load_error');
1292
  wp_die();
1293
  }
1294
 
 
1295
  // Save the post data from pagelayer setting page
1296
  add_action('wp_ajax_pagelayer_save_template', 'pagelayer_save_template');
1297
  function pagelayer_save_template() {
main/class.php CHANGED
@@ -50,6 +50,7 @@ class PageLayer{
50
 
51
  // Runtime fonts
52
  var $runtime_fonts = array();
 
53
 
54
  // Array of all the template paths
55
  var $all_template_paths = array();
@@ -77,6 +78,8 @@ class PageLayer{
77
 
78
  var $css = array();
79
  var $css_settings = array();
 
 
80
 
81
  function __construct() {
82
 
50
 
51
  // Runtime fonts
52
  var $runtime_fonts = array();
53
+ var $fonts_sent = array();
54
 
55
  // Array of all the template paths
56
  var $all_template_paths = array();
78
 
79
  var $css = array();
80
  var $css_settings = array();
81
+
82
+ var $data_attr = array();
83
 
84
  function __construct() {
85
 
main/functions.php CHANGED
@@ -577,9 +577,23 @@ function pagelayer_memory_limit($mb){
577
  }
578
 
579
  // Pagelayer the content
580
- function pagelayer_the_content($content){
 
 
 
581
  $content = do_blocks( $content );
582
  $content = do_shortcode( $content );
 
 
 
 
 
 
 
 
 
 
 
583
  return $content;
584
  }
585
 
@@ -651,7 +665,7 @@ function pagelayer_load_shortcodes(){
651
  $global_data = [];
652
  $global_data['post_id'] = $template->ID;
653
  $global_data['title'] = $template->post_title;
654
- $global_data['$'] = pagelayer_the_content($template->post_content);
655
  $global_widgets[$pagelayer_template_type][$template->ID] = $global_data;
656
 
657
  }
@@ -2253,22 +2267,29 @@ function pagelayer_export_media_files($id, &$url = ''){
2253
  }
2254
 
2255
  // Insert a post which is a Pagelayer Post
2256
- function pagelayer_insert_content($post, &$ret){
2257
-
2258
- $post = apply_filters('pagelayer_start_insert_content', $post);
2259
 
2260
  // Replace Vars
2261
  $template_vars = pagelayer_template_vars();
2262
 
2263
  foreach($template_vars as $key => $val){
2264
- $post['post_content'] = str_replace($key, $val, $post['post_content']);
2265
  }
2266
 
2267
  if(defined('PAGELAYER_BLOCK_PREFIX') && PAGELAYER_BLOCK_PREFIX == 'wp'){
2268
- $post['post_content'] = str_replace('<!-- sp:pagelayer', '<!-- wp:pagelayer', $post['post_content']);
2269
- $post['post_content'] = str_replace('<!-- /sp:pagelayer', '<!-- /wp:pagelayer', $post['post_content']);
2270
  }
 
 
 
2271
 
 
 
 
 
 
 
2272
  //pagelayer_print($post);die();
2273
 
2274
  // Add slashes for safe insert
@@ -2775,6 +2796,17 @@ function pagelayer_captcha_verify(){
2775
  return false;
2776
  }
2777
 
 
 
 
 
 
 
 
 
 
 
 
2778
 
2779
  function pagelayer_enable_giver(){
2780
  global $pagelayer;
577
  }
578
 
579
  // Pagelayer the content
580
+ function pagelayer_the_content($content, $dump = false){
581
+ global $pagelayer;
582
+
583
+ $content = pagelayer_sanitize_content( $content );
584
  $content = do_blocks( $content );
585
  $content = do_shortcode( $content );
586
+
587
+ if($dump){
588
+ preg_match_all('/pagelayer-id="(.*?)"/', $content, $matches);
589
+ $matches = array_unique($matches[1]);
590
+
591
+ foreach($matches as $id){
592
+ $data_attr = '<!-- '.pagelayer_serialize_attributes($pagelayer->data_attr[$id]).' -->';
593
+ $content = preg_replace('/<div ([^>]*)pagelayer-id="'.preg_quote($id).'"([^>]*)>/is', '<div ${1}pagelayer-id="'.$id.'"${2}>'. $data_attr, $content);
594
+ }
595
+ }
596
+
597
  return $content;
598
  }
599
 
665
  $global_data = [];
666
  $global_data['post_id'] = $template->ID;
667
  $global_data['title'] = $template->post_title;
668
+ $global_data['$'] = pagelayer_the_content($template->post_content, true);
669
  $global_widgets[$pagelayer_template_type][$template->ID] = $global_data;
670
 
671
  }
2267
  }
2268
 
2269
  // Insert a post which is a Pagelayer Post
2270
+ function pagelayer_sanitize_content($content){
 
 
2271
 
2272
  // Replace Vars
2273
  $template_vars = pagelayer_template_vars();
2274
 
2275
  foreach($template_vars as $key => $val){
2276
+ $content = str_replace($key, $val, $content);
2277
  }
2278
 
2279
  if(defined('PAGELAYER_BLOCK_PREFIX') && PAGELAYER_BLOCK_PREFIX == 'wp'){
2280
+ $content = str_replace('<!-- sp:pagelayer', '<!-- wp:pagelayer', $content);
2281
+ $content = str_replace('<!-- /sp:pagelayer', '<!-- /wp:pagelayer', $content);
2282
  }
2283
+
2284
+ return $content;
2285
+ }
2286
 
2287
+ // Insert a post which is a Pagelayer Post
2288
+ function pagelayer_insert_content($post, &$ret){
2289
+
2290
+ $post = apply_filters('pagelayer_start_insert_content', $post);
2291
+
2292
+ $post['post_content'] = pagelayer_sanitize_content($post['post_content']);
2293
  //pagelayer_print($post);die();
2294
 
2295
  // Add slashes for safe insert
2796
  return false;
2797
  }
2798
 
2799
+ // Pagelayer serialize attributes
2800
+ function pagelayer_serialize_attributes( $block_attributes ) {
2801
+ $encoded_attributes = json_encode( $block_attributes );
2802
+ $encoded_attributes = preg_replace( '/--/', '\\u002d\\u002d', $encoded_attributes );
2803
+ $encoded_attributes = preg_replace( '/</', '\\u003c', $encoded_attributes );
2804
+ $encoded_attributes = preg_replace( '/>/', '\\u003e', $encoded_attributes );
2805
+ // Regex: /\\"/
2806
+ $encoded_attributes = preg_replace( '/\\\\"/', '\\u0022', $encoded_attributes );
2807
+
2808
+ return $encoded_attributes;
2809
+ }
2810
 
2811
  function pagelayer_enable_giver(){
2812
  global $pagelayer;
main/import.php CHANGED
@@ -912,6 +912,9 @@ global $pagelayer, $pl_error, $sitepad;
912
  // Save that we have imported the theme
913
  update_option('pagelayer_theme_'.$template_name.'_imported', time(), true);
914
 
 
 
 
915
  return true;
916
 
917
  }
@@ -1310,11 +1313,11 @@ function pagelayer_blog_templates($pgl){
1310
  [pl_post_info_list pagelayer-id="9lTHiEQJQqESt6YG" type="comments" info_link="true" info_icon_on="true" info_icon="fas fa-comment"]
1311
  [/pl_post_info_list]
1312
  [/pl_post_info]
1313
- [pl_post_excerpt pagelayer-id="NklzzZGW3ve1X8BS" ele_margin="15px,0px,15px,0px" align="left"]
1314
  [/pl_post_excerpt]
1315
  [pl_featured_img pagelayer-id="sZLiICVhGCbBTx1a" size="full" img_filter="0,100,100,0,0,100,100" caption_color="#0986c0" img_hover_delay="400" custom_size="70%,0%" align="center"]
1316
  [/pl_featured_img]
1317
- [pl_post_content pagelayer-id="7JbkxQEvq0skyUUl" ele_margin="35px,0px,35px,0px" font_size="NaN"]
1318
  [/pl_post_content]
1319
  [pl_post_info pagelayer-id="tvno5FCIKdwGa8IE" layout="horizontal" space_between="5" align="left" icon_colors="normal" text_colors="normal" input_typo=",,,,,,Solid,,,,"]
1320
  [pl_post_info_list pagelayer-id="SwoZ4cxl3XFMLE3l" type="terms" info_link="true" info_icon_on="" info_icon="fas fa-user-circle" taxonomy="category" info_before="Category :"]
912
  // Save that we have imported the theme
913
  update_option('pagelayer_theme_'.$template_name.'_imported', time(), true);
914
 
915
+ // Blank woocommerce fix
916
+ update_option('pagelayer_template_product_fix', 0);
917
+
918
  return true;
919
 
920
  }
1313
  [pl_post_info_list pagelayer-id="9lTHiEQJQqESt6YG" type="comments" info_link="true" info_icon_on="true" info_icon="fas fa-comment"]
1314
  [/pl_post_info_list]
1315
  [/pl_post_info]
1316
+ [pl_post_excerpt pagelayer-id="NklzzZGW3ve1X8BS" pe_margin="20px,0px,15px,0px" align="left"]
1317
  [/pl_post_excerpt]
1318
  [pl_featured_img pagelayer-id="sZLiICVhGCbBTx1a" size="full" img_filter="0,100,100,0,0,100,100" caption_color="#0986c0" img_hover_delay="400" custom_size="70%,0%" align="center"]
1319
  [/pl_featured_img]
1320
+ [pl_post_content pagelayer-id="7JbkxQEvq0skyUUl" ele_margin="25px,0px,35px,0px" font_size="NaN"]
1321
  [/pl_post_content]
1322
  [pl_post_info pagelayer-id="tvno5FCIKdwGa8IE" layout="horizontal" space_between="5" align="left" icon_colors="normal" text_colors="normal" input_typo=",,,,,,Solid,,,,"]
1323
  [pl_post_info_list pagelayer-id="SwoZ4cxl3XFMLE3l" type="terms" info_link="true" info_icon_on="" info_icon="fas fa-user-circle" taxonomy="category" info_before="Category :"]
main/live.php CHANGED
@@ -224,6 +224,15 @@ filter:blur(2px);
224
 
225
  // Footer function to add certain things
226
  function wp_footer(){
 
 
 
 
 
 
 
 
 
227
  wp_enqueue_script('heartbeat');
228
  _wp_footer_scripts();
229
  }
224
 
225
  // Footer function to add certain things
226
  function wp_footer(){
227
+
228
+ global $pagelayer;
229
+
230
+ if(!empty($pagelayer->data_attr)){
231
+ echo '<script>
232
+ pagelayer.el = '.json_encode($pagelayer->data_attr).';
233
+ </script>';
234
+ }
235
+
236
  wp_enqueue_script('heartbeat');
237
  _wp_footer_scripts();
238
  }
main/settings.php CHANGED
@@ -496,7 +496,7 @@ function pagelayer_settings_page(){
496
  </tr>
497
  <tr>
498
  <th><?php _e('Phone Number');?></th>
499
- <td><input type="tel" name="pagelayer-phone" <?php echo 'value="'.pagelayer_get_option('pagelayer-phone').'"';?> /></td>
500
  </tr>
501
 
502
  <tr>
@@ -508,7 +508,7 @@ function pagelayer_settings_page(){
508
  ?>
509
  <label>
510
  <input name="pagelayer_cf_to_email" type="email" placeholder="email@domain.com" <?php if(get_option('pagelayer_cf_to_email')){
511
- echo 'value="'.get_option('pagelayer_cf_to_email').'"';
512
  }?>/>
513
  </label>
514
  <?php } ?>
@@ -536,27 +536,27 @@ function pagelayer_settings_page(){
536
  <table>
537
  <tr>
538
  <th><?php _e('Facebook');?></th>
539
- <td><input type="text" name="pagelayer-facebook-url" <?php echo 'value="'.get_option('pagelayer-facebook-url').'"';?>/></td>
540
  </tr>
541
  <tr>
542
  <th><?php _e('Twitter');?></th>
543
- <td><input type="text" name="pagelayer-twitter-url" <?php echo 'value="'.get_option('pagelayer-twitter-url').'"';?>/></td>
544
  </tr>
545
  <tr>
546
  <th><?php _e('Instagram');?></th>
547
- <td><input type="text" name="pagelayer-instagram-url" <?php echo 'value="'.get_option('pagelayer-instagram-url').'"'; ?>/></td>
548
  </tr>
549
  <tr>
550
  <th><?php _e('LinkedIn');?></th>
551
- <td><input type="text" name="pagelayer-linkedin-url" <?php echo 'value="'.get_option('pagelayer-linkedin-url').'"'; ?>/></td>
552
  </tr>
553
  <tr>
554
  <th><?php _e('YouTube');?></th>
555
- <td><input type="text" name="pagelayer-youtube-url" <?php echo 'value="'.get_option('pagelayer-youtube-url').'"'; ?>/></td>
556
  </tr>
557
  <tr>
558
  <th><?php _e('Google+');?></th>
559
- <td><input type="text" name="pagelayer-gplus-url" <?php echo 'value="'.get_option('pagelayer-gplus-url').'"'; ?>/></td>
560
  </tr>
561
  </table>
562
  </div>
@@ -591,7 +591,7 @@ function pagelayer_settings_page(){
591
  <td>
592
  <label>
593
  <input name="pagelayer_cf_to_email" type="text" placeholder="email@domain.com" <?php if(get_option('pagelayer_cf_to_email')){
594
- echo 'value="'.get_option('pagelayer_cf_to_email').'"';
595
  }?>/>
596
  </label>
597
  </td>
@@ -602,7 +602,7 @@ function pagelayer_settings_page(){
602
  <label>
603
  <input name="pagelayer_cf_from_email" type="text" placeholder="My Site <email@domain.com>" <?php
604
  if(get_option('pagelayer_cf_from_email')){
605
- echo 'value="'.get_option('pagelayer_cf_from_email').'"';
606
  }?>/>
607
  </label>
608
  </td>
@@ -612,7 +612,7 @@ function pagelayer_settings_page(){
612
  <td>
613
  <label>
614
  <input name="pagelayer_cf_subject" type="text" placeholder="Subject" <?php if(get_option('pagelayer_cf_subject')){
615
- echo 'value="'.get_option('pagelayer_cf_subject').'"';
616
  }?> />
617
  </label>
618
  </td>
@@ -636,7 +636,7 @@ function pagelayer_settings_page(){
636
  <td>
637
  <label>
638
  <input name="pagelayer_cf_success" type="text" placeholder="Success" <?php if(get_option('pagelayer_cf_success')){
639
- echo 'value="'.get_option('pagelayer_cf_success').'"';
640
  }?> />
641
  </label>
642
  </td>
@@ -646,7 +646,7 @@ function pagelayer_settings_page(){
646
  <td>
647
  <label>
648
  <input name="pagelayer_cf_failed" type="text" placeholder="Failed" <?php if(get_option('pagelayer_cf_failed')){
649
- echo 'value="'.get_option('pagelayer_cf_failed').'"';
650
  }?> />
651
  </label>
652
  </td>
@@ -656,7 +656,7 @@ function pagelayer_settings_page(){
656
  <td>
657
  <label>
658
  <input name="pagelayer_recaptcha_failed" type="text" placeholder="The CAPTCHA verification failed. Please try again." <?php
659
- echo 'value="'.get_option('pagelayer_recaptcha_failed', __pl('cap_ver_fail')).'"';
660
  ?> />
661
  </label>
662
  </td>
@@ -670,7 +670,7 @@ function pagelayer_settings_page(){
670
  <td>
671
  <label>
672
  <input name="pagelayer_google_captcha" type="text" placeholder="Site key" <?php if(get_option('pagelayer_google_captcha')){
673
- echo 'value="'.get_option('pagelayer_google_captcha').'"';
674
  }?> />
675
  </label>
676
  </td>
@@ -680,7 +680,7 @@ function pagelayer_settings_page(){
680
  <td>
681
  <label>
682
  <input name="pagelayer_google_captcha_secret" type="text" placeholder="Secret key" <?php if(get_option('pagelayer_google_captcha_secret')){
683
- echo 'value="'.get_option('pagelayer_google_captcha_secret').'"';
684
  }?> />
685
  </label>
686
  </td>
496
  </tr>
497
  <tr>
498
  <th><?php _e('Phone Number');?></th>
499
+ <td><input type="tel" name="pagelayer-phone" <?php echo 'value="'.esc_html(pagelayer_get_option('pagelayer-phone')).'"';?> /></td>
500
  </tr>
501
 
502
  <tr>
508
  ?>
509
  <label>
510
  <input name="pagelayer_cf_to_email" type="email" placeholder="email@domain.com" <?php if(get_option('pagelayer_cf_to_email')){
511
+ echo 'value="'.esc_html(get_option('pagelayer_cf_to_email')).'"';
512
  }?>/>
513
  </label>
514
  <?php } ?>
536
  <table>
537
  <tr>
538
  <th><?php _e('Facebook');?></th>
539
+ <td><input type="text" name="pagelayer-facebook-url" <?php echo 'value="'.esc_html(get_option('pagelayer-facebook-url')).'"';?>/></td>
540
  </tr>
541
  <tr>
542
  <th><?php _e('Twitter');?></th>
543
+ <td><input type="text" name="pagelayer-twitter-url" <?php echo 'value="'.esc_html(get_option('pagelayer-twitter-url')).'"';?>/></td>
544
  </tr>
545
  <tr>
546
  <th><?php _e('Instagram');?></th>
547
+ <td><input type="text" name="pagelayer-instagram-url" <?php echo 'value="'.esc_html(get_option('pagelayer-instagram-url')).'"'; ?>/></td>
548
  </tr>
549
  <tr>
550
  <th><?php _e('LinkedIn');?></th>
551
+ <td><input type="text" name="pagelayer-linkedin-url" <?php echo 'value="'.esc_html(get_option('pagelayer-linkedin-url')).'"'; ?>/></td>
552
  </tr>
553
  <tr>
554
  <th><?php _e('YouTube');?></th>
555
+ <td><input type="text" name="pagelayer-youtube-url" <?php echo 'value="'.esc_html(get_option('pagelayer-youtube-url')).'"'; ?>/></td>
556
  </tr>
557
  <tr>
558
  <th><?php _e('Google+');?></th>
559
+ <td><input type="text" name="pagelayer-gplus-url" <?php echo 'value="'.esc_html(get_option('pagelayer-gplus-url')).'"'; ?>/></td>
560
  </tr>
561
  </table>
562
  </div>
591
  <td>
592
  <label>
593
  <input name="pagelayer_cf_to_email" type="text" placeholder="email@domain.com" <?php if(get_option('pagelayer_cf_to_email')){
594
+ echo 'value="'.esc_html(get_option('pagelayer_cf_to_email')).'"';
595
  }?>/>
596
  </label>
597
  </td>
602
  <label>
603
  <input name="pagelayer_cf_from_email" type="text" placeholder="My Site <email@domain.com>" <?php
604
  if(get_option('pagelayer_cf_from_email')){
605
+ echo 'value="'.esc_html(get_option('pagelayer_cf_from_email')).'"';
606
  }?>/>
607
  </label>
608
  </td>
612
  <td>
613
  <label>
614
  <input name="pagelayer_cf_subject" type="text" placeholder="Subject" <?php if(get_option('pagelayer_cf_subject')){
615
+ echo 'value="'.esc_html(get_option('pagelayer_cf_subject')).'"';
616
  }?> />
617
  </label>
618
  </td>
636
  <td>
637
  <label>
638
  <input name="pagelayer_cf_success" type="text" placeholder="Success" <?php if(get_option('pagelayer_cf_success')){
639
+ echo 'value="'.esc_html(get_option('pagelayer_cf_success')).'"';
640
  }?> />
641
  </label>
642
  </td>
646
  <td>
647
  <label>
648
  <input name="pagelayer_cf_failed" type="text" placeholder="Failed" <?php if(get_option('pagelayer_cf_failed')){
649
+ echo 'value="'.esc_html(get_option('pagelayer_cf_failed')).'"';
650
  }?> />
651
  </label>
652
  </td>
656
  <td>
657
  <label>
658
  <input name="pagelayer_recaptcha_failed" type="text" placeholder="The CAPTCHA verification failed. Please try again." <?php
659
+ echo 'value="'.esc_html(get_option('pagelayer_recaptcha_failed', __pl('cap_ver_fail'))).'"';
660
  ?> />
661
  </label>
662
  </td>
670
  <td>
671
  <label>
672
  <input name="pagelayer_google_captcha" type="text" placeholder="Site key" <?php if(get_option('pagelayer_google_captcha')){
673
+ echo 'value="'.esc_html(get_option('pagelayer_google_captcha')).'"';
674
  }?> />
675
  </label>
676
  </td>
680
  <td>
681
  <label>
682
  <input name="pagelayer_google_captcha_secret" type="text" placeholder="Secret key" <?php if(get_option('pagelayer_google_captcha_secret')){
683
+ echo 'value="'.esc_html(get_option('pagelayer_google_captcha_secret')).'"';
684
  }?> />
685
  </label>
686
  </td>
main/shortcode_functions.php CHANGED
@@ -124,6 +124,7 @@ function pagelayer_render_shortcode($atts, $content = '', $tag = '', $inner_bloc
124
  $el['content'] = $content;
125
  $el['inner_blocks'] = $inner_blocks;
126
  $el['selector'] = '[pagelayer-id="'.$el['id'].'"]';
 
127
  $el['wrap'] = '[pagelayer-wrap-id="'.$el['id'].'"]';
128
 
129
  // Remove pagelayer-id from attr
@@ -134,12 +135,12 @@ function pagelayer_render_shortcode($atts, $content = '', $tag = '', $inner_bloc
134
 
135
  $innerHTML = @$pagelayer->shortcodes[$tag]['innerHTML'];
136
  if(!empty($innerHTML) && !empty($content)){
137
- $_content = str_replace('&', '&amp;', $content);
138
- $el['oAtts'][$innerHTML] = $_content;
139
- $el['atts'][$innerHTML] = $_content;
140
  }
141
 
142
  // The default class
 
143
  $el['classes'][] = $class;
144
 
145
  //pagelayer_print($el);
@@ -337,7 +338,7 @@ function pagelayer_render_shortcode($atts, $content = '', $tag = '', $inner_bloc
337
  foreach($param['css'] as $k => $v){
338
 
339
  // Make the selector
340
- $selector = (!is_numeric($k) ? $k : $el['selector']);
341
  $selector = pagelayer_parse_el_vars($selector, $el);
342
 
343
  $ender = '';
@@ -412,17 +413,8 @@ function pagelayer_render_shortcode($atts, $content = '', $tag = '', $inner_bloc
412
  pagelayer_create_sc($el, $is_block);
413
  }
414
 
415
- if(empty($el['oAtts'])){
416
- $el['oAtts'] = (object)[];
417
- }
418
-
419
- if(empty($el['tmp'])){
420
- $el['tmp'] = (object)[];
421
- }
422
-
423
  $div = '<div pagelayer-id="'.$el['id'].'">
424
- '.(pagelayer_is_live() ? '<!-- '.pagelayer_serialize_attributes(['attr' => $el['oAtts'], 'tmp' => $el['tmp']]).' -->' : '').'
425
- <style pagelayer-style-id="'.$el['id'].'"></style>';
426
 
427
  $is_group = !empty($pagelayer->shortcodes[$tag]['params']['elements']) ? true : false;
428
 
@@ -612,7 +604,7 @@ function pagelayer_render_shortcode($atts, $content = '', $tag = '', $inner_bloc
612
 
613
  if(!empty($pagelayer->shortcodes[$tag]['overide_css_selector'])){
614
  $overide_css_selector = pagelayer_parse_el_vars($pagelayer->shortcodes[$tag]['overide_css_selector'], $el);
615
- $style = str_replace($el['selector'], $overide_css_selector, $style);
616
  $style = str_replace($el['wrap'], $overide_css_selector, $style);
617
  }
618
 
@@ -643,21 +635,10 @@ function pagelayer_render_shortcode($atts, $content = '', $tag = '', $inner_bloc
643
 
644
  }
645
 
646
- // Pagelayer serialize attributes
647
- function pagelayer_serialize_attributes( $block_attributes ) {
648
- $encoded_attributes = json_encode( $block_attributes );
649
- $encoded_attributes = preg_replace( '/--/', '\\u002d\\u002d', $encoded_attributes );
650
- $encoded_attributes = preg_replace( '/</', '\\u003c', $encoded_attributes );
651
- $encoded_attributes = preg_replace( '/>/', '\\u003e', $encoded_attributes );
652
- // Regex: /\\"/
653
- $encoded_attributes = preg_replace( '/\\\\"/', '\\u0022', $encoded_attributes );
654
-
655
- return $encoded_attributes;
656
- }
657
-
658
  // Change pagelayer id in html
659
  function pagelayer_change_id($content){
660
-
 
661
  if(pagelayer_is_live()){
662
 
663
  preg_match_all('/pagelayer-id="(.*?)"/', $content, $matches);
@@ -675,8 +656,12 @@ function pagelayer_change_id($content){
675
  // Creates the shortcode and returns a base64 encoded files
676
  function pagelayer_create_sc(&$el, $is_block = 0){
677
 
 
 
678
  $a = $tmp = array();
679
 
 
 
680
  /*if(!empty($el['oAtts'])){
681
 
682
  foreach($el['oAtts'] as $k => $v){
@@ -727,7 +712,7 @@ function pagelayer_parse_el_vars($str, &$el){
727
  $is_editable = true;
728
  }
729
 
730
- $str = str_replace('{{element}}', $el['selector'], $str);
731
  $is_live = pagelayer_is_live();
732
  if(!empty($is_live) && $is_editable){
733
  $str = str_replace('{{wrap}}', $el['wrap'], $str);
124
  $el['content'] = $content;
125
  $el['inner_blocks'] = $inner_blocks;
126
  $el['selector'] = '[pagelayer-id="'.$el['id'].'"]';
127
+ $el['cssSel'] = '.p-'.$el['id'];
128
  $el['wrap'] = '[pagelayer-wrap-id="'.$el['id'].'"]';
129
 
130
  // Remove pagelayer-id from attr
135
 
136
  $innerHTML = @$pagelayer->shortcodes[$tag]['innerHTML'];
137
  if(!empty($innerHTML) && !empty($content)){
138
+ $el['oAtts'][$innerHTML] = $content;
139
+ $el['atts'][$innerHTML] = $content;
 
140
  }
141
 
142
  // The default class
143
+ $el['classes'][] = 'p-'.$el['id'];
144
  $el['classes'][] = $class;
145
 
146
  //pagelayer_print($el);
338
  foreach($param['css'] as $k => $v){
339
 
340
  // Make the selector
341
+ $selector = (!is_numeric($k) ? $k : $el['cssSel']);
342
  $selector = pagelayer_parse_el_vars($selector, $el);
343
 
344
  $ender = '';
413
  pagelayer_create_sc($el, $is_block);
414
  }
415
 
 
 
 
 
 
 
 
 
416
  $div = '<div pagelayer-id="'.$el['id'].'">
417
+ <style pagelayer-style-id="'.$el['id'].'"></style>';
 
418
 
419
  $is_group = !empty($pagelayer->shortcodes[$tag]['params']['elements']) ? true : false;
420
 
604
 
605
  if(!empty($pagelayer->shortcodes[$tag]['overide_css_selector'])){
606
  $overide_css_selector = pagelayer_parse_el_vars($pagelayer->shortcodes[$tag]['overide_css_selector'], $el);
607
+ $style = str_replace($el['cssSel'], $overide_css_selector, $style);
608
  $style = str_replace($el['wrap'], $overide_css_selector, $style);
609
  }
610
 
635
 
636
  }
637
 
 
 
 
 
 
 
 
 
 
 
 
 
638
  // Change pagelayer id in html
639
  function pagelayer_change_id($content){
640
+ global $pagelayer;
641
+
642
  if(pagelayer_is_live()){
643
 
644
  preg_match_all('/pagelayer-id="(.*?)"/', $content, $matches);
656
  // Creates the shortcode and returns a base64 encoded files
657
  function pagelayer_create_sc(&$el, $is_block = 0){
658
 
659
+ global $pagelayer;
660
+
661
  $a = $tmp = array();
662
 
663
+ $pagelayer->data_attr[$el['id']] = ['attr' => $el['oAtts'], 'tmp' => $el['tmp']];
664
+
665
  /*if(!empty($el['oAtts'])){
666
 
667
  foreach($el['oAtts'] as $k => $v){
712
  $is_editable = true;
713
  }
714
 
715
+ $str = str_replace('{{element}}', $el['cssSel'], $str);
716
  $is_live = pagelayer_is_live();
717
  if(!empty($is_live) && $is_editable){
718
  $str = str_replace('{{wrap}}', $el['wrap'], $str);
main/template.php CHANGED
@@ -248,14 +248,15 @@ function pagelayer_builder_archives_conditions($post_types = []){
248
 
249
  if(empty($post_types)){
250
  $post_types = pagelayer_get_public_post_types();
251
- unset( $post_types['product'] );
252
  }
253
 
254
  foreach ( $post_types as $post_type => $label ) {
 
255
  //$post_type_object = get_post_type_object( $post_type );
256
  if ( ! get_post_type_archive_link( $post_type ) ) {
257
  continue;
258
- }
259
 
260
  $condition[$label] = [ //TC: Need to change the name of variable
261
  $post_type => array(
@@ -298,8 +299,34 @@ function pagelayer_builder_archives_conditions($post_types = []){
298
  ];
299
 
300
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
 
302
  }
 
303
  return $condition;
304
  }
305
 
@@ -854,6 +881,62 @@ if(!defined('PAGELAYER_PREMIUM')){
854
 
855
  }
856
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
857
  // Pagelayer Template Loading Mechanism
858
  add_action('setup_theme', 'pagelayer_template_setup_theme', 5);
859
  function pagelayer_template_setup_theme(){
248
 
249
  if(empty($post_types)){
250
  $post_types = pagelayer_get_public_post_types();
251
+ //unset( $post_types['product'] );
252
  }
253
 
254
  foreach ( $post_types as $post_type => $label ) {
255
+
256
  //$post_type_object = get_post_type_object( $post_type );
257
  if ( ! get_post_type_archive_link( $post_type ) ) {
258
  continue;
259
+ }
260
 
261
  $condition[$label] = [ //TC: Need to change the name of variable
262
  $post_type => array(
299
  ];
300
 
301
  }
302
+
303
+ $all = 'pagelayer_all_'.$post_type;
304
+
305
+ $condition[$label] += [
306
+ $all => array(
307
+ 'label' => 'All '.$label.' Archive',
308
+ 'check_conditions' => function ( $args = null ) use ($post_type, $condition, $all, $label){
309
+
310
+ foreach($condition[$label] as $k => $v){
311
+ if($all == $k){
312
+ continue;
313
+ }
314
+
315
+ $ret = $v['check_conditions']($args);
316
+
317
+ if(!empty($ret)){
318
+ return $ret;
319
+ }
320
+
321
+ }
322
+
323
+ },
324
+ 'no_id_section' => 1, // Id select section not required
325
+ ),
326
+ ];
327
 
328
  }
329
+
330
  return $condition;
331
  }
332
 
881
 
882
  }
883
 
884
+ // Fix the default blog template we insert for woocommerce
885
+ function pagelayer_template_product_fix(){
886
+
887
+ global $pagelayer;
888
+
889
+ // Have we already fixed
890
+ $fixed = get_option('pagelayer_template_product_fix');
891
+ if(!empty($fixed)){
892
+ return;
893
+ }
894
+
895
+ // Make sure we have templates
896
+ pagelayer_builder_load_templates();
897
+
898
+
899
+ if(empty($pagelayer->templates)){
900
+ return;
901
+ }
902
+
903
+ foreach($pagelayer->templates as $k => $v){
904
+ if($v->post_name == 'blog-template'){
905
+ $blog = $v;
906
+ }
907
+ }
908
+
909
+ if(empty($blog)){
910
+ return;
911
+ }
912
+
913
+ // Get meta
914
+ $dis_conditions = get_post_meta( $blog->ID, 'pagelayer_template_conditions', true );
915
+ //print_r($dis_conditions);
916
+
917
+ foreach($dis_conditions as $k => $v){
918
+ if(!empty($v['sub_template']) && $v['sub_template'] == 'pagelayer_all_product'){
919
+ $found = 1;
920
+ }
921
+ }
922
+ //echo $found;return;
923
+
924
+ // We need to add conditions
925
+ if(empty($found)){
926
+
927
+ $dis_conditions[] = ['type' => 'exclude',
928
+ 'template' => 'archives',
929
+ 'sub_template' => 'pagelayer_all_product',
930
+ 'id' => ''];
931
+
932
+ update_post_meta( $blog->ID, 'pagelayer_template_conditions', $dis_conditions );
933
+
934
+ }
935
+
936
+ update_option('pagelayer_template_product_fix', time());
937
+
938
+ }
939
+
940
  // Pagelayer Template Loading Mechanism
941
  add_action('setup_theme', 'pagelayer_template_setup_theme', 5);
942
  function pagelayer_template_setup_theme(){
pagelayer.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: PageLayer
4
  Plugin URI: http://wordpress.org/plugins/pagelayer/
5
  Description: PageLayer is a WordPress page builder plugin. Its very easy to use and very light on the browser.
6
- Version: 1.4.3
7
  Author: Pagelayer Team
8
  Author URI: https://pagelayer.com/
9
  License: LGPL v2.1
3
  Plugin Name: PageLayer
4
  Plugin URI: http://wordpress.org/plugins/pagelayer/
5
  Description: PageLayer is a WordPress page builder plugin. Its very easy to use and very light on the browser.
6
+ Version: 1.4.4
7
  Author: Pagelayer Team
8
  Author URI: https://pagelayer.com/
9
  License: LGPL v2.1
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: page builder, editor, landing page, drag-and-drop, pagelayer, form-builder
4
  Requires at least: 4.7
5
  Tested up to: 5.6
6
  Requires PHP: 5.5
7
- Stable tag: 1.4.3
8
  License: LGPL v2.1
9
  License URI: http://www.gnu.org/licenses/lgpl-2.1.html
10
 
@@ -109,6 +109,12 @@ Do you have questions related to PageLayer ? Use the following links :
109
 
110
  == Changelog ==
111
 
 
 
 
 
 
 
112
  = 1.4.3 (Jan 09, 2021) =
113
  * [Added] Added alignment option to the sub-menu in the primary menu widget.
114
  * [Bug-Fix] The element pagelayer-id has been further improved to fix ModSecurity issues.
4
  Requires at least: 4.7
5
  Tested up to: 5.6
6
  Requires PHP: 5.5
7
+ Stable tag: 1.4.4
8
  License: LGPL v2.1
9
  License URI: http://www.gnu.org/licenses/lgpl-2.1.html
10
 
109
 
110
  == Changelog ==
111
 
112
+ = 1.4.4 (Jan 22, 2021) =
113
+ * [Feature] Added the option to revert a setting to the default.
114
+ * [Feature] Added All Archive type for all registered posts for Pagelayer Templates.
115
+ * [Feature] CSS output of Pagelayer per page will reduce by 10% making the page faster.
116
+ * [Bug-Fix] On some servers, the comments are removed from the HTML output, causing editing to break. This is now fixed.
117
+
118
  = 1.4.3 (Jan 09, 2021) =
119
  * [Added] Added alignment option to the sub-menu in the primary menu widget.
120
  * [Bug-Fix] The element pagelayer-id has been further improved to fix ModSecurity issues.