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

Version Description

(November 9, 2020) = * [Security-Fix] In the Pagelayer -> Website Settings, the output was not escaped for certain settings. We would like to thank Ram Gall from the WordFence team for pointing this out. Full disclosure will be available after 48 hours from the release of this version.

Download this release

Release Info

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

Code changes from version 1.3.4 to 1.3.5

css/combined.css CHANGED
@@ -4913,6 +4913,36 @@ display: inline-block;
4913
 
4914
  /* Animated Heading End */
4915
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4916
  /********************/
4917
  /*** Freemium End ***/
4918
  /********************/
4913
 
4914
  /* Animated Heading End */
4915
 
4916
+ /* Mega menu css start */
4917
+
4918
+ .pagelayer-mega-menu{
4919
+ width:800px;
4920
+ z-index:99999;
4921
+ text-align:center;
4922
+ }
4923
+
4924
+ .pagelayer-wp_menu .pagelayer-menu-type-vertical .pagelayer-mega-menu{
4925
+ width:100%;
4926
+ }
4927
+
4928
+ @media only screen and (max-width: 768px){
4929
+ .pagelayer-mega-menu{
4930
+ width:500px;
4931
+ }
4932
+
4933
+ .pagelayer-wp-menu-dropdown .pagelayer-mega-menu{
4934
+ width:100%;
4935
+ }
4936
+ }
4937
+
4938
+ @media only screen and (max-width: 360px){
4939
+ .pagelayer-wp-menu-dropdown .pagelayer-mega-menu{
4940
+ width:100%;
4941
+ }
4942
+ }
4943
+
4944
+ /* Mega menu css ends */
4945
+
4946
  /********************/
4947
  /*** Freemium End ***/
4948
  /********************/
css/pagelayer-editor.css CHANGED
@@ -3561,6 +3561,28 @@ align-items: center;
3561
  border-radius: 10px
3562
  }
3563
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3564
  .pagelayer-props-wrap .pagelayer-meta-iframe{
3565
  position: relative;
3566
  width: 100%;
@@ -3574,6 +3596,7 @@ top: 20px;
3574
  right: 25px;
3575
  z-index: 999;
3576
  cursor:pointer;
 
3577
  }
3578
 
3579
  @keyframes highlight {
3561
  border-radius: 10px
3562
  }
3563
 
3564
+ .pagelayer-props-loading-screen{
3565
+ position:absolute;
3566
+ border: 8px solid transparent;
3567
+ border-radius: 50%;
3568
+ border-top: 8px solid #ebebeb;
3569
+ width: 80px;
3570
+ height: 80px;
3571
+ -webkit-animation: propsLoading 0.5s ease-in-out infinite; /* Safari */
3572
+ animation: propsLoading 0.5s ease-in-out infinite;
3573
+ }
3574
+
3575
+ /* Safari */
3576
+ @-webkit-keyframes propsLoading {
3577
+ 0% { -webkit-transform: rotate(0deg); }
3578
+ 100% { -webkit-transform: rotate(360deg); }
3579
+ }
3580
+
3581
+ @keyframes propsLoading {
3582
+ 0% { transform: rotate(0deg); }
3583
+ 100% { transform: rotate(360deg); }
3584
+ }
3585
+
3586
  .pagelayer-props-wrap .pagelayer-meta-iframe{
3587
  position: relative;
3588
  width: 100%;
3596
  right: 25px;
3597
  z-index: 999;
3598
  cursor:pointer;
3599
+ visibility:hidden;
3600
  }
3601
 
3602
  @keyframes highlight {
css/pagelayer-frontend.css CHANGED
@@ -4913,6 +4913,36 @@ display: inline-block;
4913
 
4914
  /* Animated Heading End */
4915
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4916
  /********************/
4917
  /*** Freemium End ***/
4918
  /********************/
4913
 
4914
  /* Animated Heading End */
4915
 
4916
+ /* Mega menu css start */
4917
+
4918
+ .pagelayer-mega-menu{
4919
+ width:800px;
4920
+ z-index:99999;
4921
+ text-align:center;
4922
+ }
4923
+
4924
+ .pagelayer-wp_menu .pagelayer-menu-type-vertical .pagelayer-mega-menu{
4925
+ width:100%;
4926
+ }
4927
+
4928
+ @media only screen and (max-width: 768px){
4929
+ .pagelayer-mega-menu{
4930
+ width:500px;
4931
+ }
4932
+
4933
+ .pagelayer-wp-menu-dropdown .pagelayer-mega-menu{
4934
+ width:100%;
4935
+ }
4936
+ }
4937
+
4938
+ @media only screen and (max-width: 360px){
4939
+ .pagelayer-wp-menu-dropdown .pagelayer-mega-menu{
4940
+ width:100%;
4941
+ }
4942
+ }
4943
+
4944
+ /* Mega menu css ends */
4945
+
4946
  /********************/
4947
  /*** Freemium End ***/
4948
  /********************/
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.3.4');
9
  define('PAGELAYER_DIR', dirname(PAGELAYER_FILE));
10
  define('PAGELAYER_SLUG', 'pagelayer');
11
  define('PAGELAYER_URL', plugins_url('', PAGELAYER_FILE));
@@ -946,5 +946,23 @@ function pagelayer_add_custom_footer(){
946
 
947
  }
948
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
949
  // Pagelayer Template Loading Mechanism
950
  include_once(PAGELAYER_DIR.'/main/template.php');
5
 
6
  define('PAGELAYER_BASE', plugin_basename(PAGELAYER_FILE));
7
  define('PAGELAYER_PRO_BASE', 'pagelayer-pro/pagelayer-pro.php');
8
+ define('PAGELAYER_VERSION', '1.3.5');
9
  define('PAGELAYER_DIR', dirname(PAGELAYER_FILE));
10
  define('PAGELAYER_SLUG', 'pagelayer');
11
  define('PAGELAYER_URL', plugins_url('', PAGELAYER_FILE));
946
 
947
  }
948
 
949
+ // Handle Logout Redirect here
950
+ add_action('wp_logout', 'pagelayer_after_logout');
951
+ function pagelayer_after_logout($user_id){
952
+
953
+ // Get the URL
954
+ $url = get_user_option('pagelayer_logout_url', $user_id);
955
+
956
+ // Now blank it
957
+ update_user_option($user_id, 'pagelayer_logout_url', '');
958
+
959
+ // We will redirect if we have the given item set.
960
+ if(!empty($url)){
961
+ wp_redirect( $url );
962
+ exit();
963
+ }
964
+
965
+ }
966
+
967
  // Pagelayer Template Loading Mechanism
968
  include_once(PAGELAYER_DIR.'/main/template.php');
js/combined.js CHANGED
@@ -80,7 +80,11 @@ jQuery(document).ready(function(){
80
 
81
  jQuery('.pagelayer-social_grp').each(function(){
82
  pagelayer_pl_social_profile(jQuery(this));
83
- });
 
 
 
 
84
 
85
  pagelayer_stars();
86
 
@@ -1216,6 +1220,18 @@ function pagelayer_pl_social_profile(jEle){
1216
  }
1217
  }
1218
 
 
 
 
 
 
 
 
 
 
 
 
 
1219
  ////////////////
1220
  // Freemium End
1221
  ////////////////
80
 
81
  jQuery('.pagelayer-social_grp').each(function(){
82
  pagelayer_pl_social_profile(jQuery(this));
83
+ });
84
+
85
+ jQuery('ul.pagelayer-mega-menu').each(function(){
86
+ pagelayer_mega_menu_position(jQuery(this));
87
+ });
88
 
89
  pagelayer_stars();
90
 
1220
  }
1221
  }
1222
 
1223
+ // Mega menu function which applies id and adjust position
1224
+ function pagelayer_mega_menu_position(mEle){
1225
+
1226
+ var jEle = mEle.find('.pagelayer-mega_menu');
1227
+ var id = jEle.attr('pagelayer-id');
1228
+
1229
+ mEle.attr('pagelayer-mega-menu-id', id);
1230
+
1231
+ colWidth = mEle.parents('.pagelayer-col').first();
1232
+ mEle.offset({'left':(colWidth.offset().left - mEle.parent().offset().left)});
1233
+ }
1234
+
1235
  ////////////////
1236
  // Freemium End
1237
  ////////////////
js/pagelayer-admin.js CHANGED
@@ -14,6 +14,7 @@ jQuery(document).ready(function(){
14
  tEle.addClass('nav-tab-active');
15
  context.find('.'+sel).hide();
16
  context.find(tEle.attr('href')).show();
 
17
 
18
  return false;
19
 
@@ -21,9 +22,9 @@ jQuery(document).ready(function(){
21
 
22
  // Make setting nav-tab-active optional.
23
  jQuery('.nav-tab-wrapper.pagelayer-wrapper').each(function(){
24
-
25
  var jEle = jQuery(this);
26
- var hash = location.hash.slice(1);
27
 
28
  if(hash){
29
  var active_tab_ele = jEle.find('[href="#'+hash+'"]');
14
  tEle.addClass('nav-tab-active');
15
  context.find('.'+sel).hide();
16
  context.find(tEle.attr('href')).show();
17
+ location.hash = tEle.attr('href')+'_tab';
18
 
19
  return false;
20
 
22
 
23
  // Make setting nav-tab-active optional.
24
  jQuery('.nav-tab-wrapper.pagelayer-wrapper').each(function(){
25
+
26
  var jEle = jQuery(this);
27
+ var hash = location.hash.slice(1, -4);
28
 
29
  if(hash){
30
  var active_tab_ele = jEle.find('[href="#'+hash+'"]');
js/pagelayer-editor.js CHANGED
@@ -3638,7 +3638,12 @@ function pagelayer_leftbar(){
3638
  var propsModal = pagelayer.$$('.pagelayer-props-modal');
3639
 
3640
  if(propsModal.find('.pagelayer-meta-iframe').length < 1){
3641
- propsModal.find('.pagelayer-props-wrap').append('<iframe class="pagelayer-meta-iframe" src="'+ pagelayer_post_props +'"></iframe>');
 
 
 
 
 
3642
  }
3643
 
3644
  propsModal.show();
@@ -3652,7 +3657,7 @@ function pagelayer_leftbar(){
3652
 
3653
  // Pagelayer post advance setting modal handler
3654
  var propsModal = pagelayer.$$('.pagelayer-props-modal');
3655
- propsModal.find('.pagelayer-pros-modal-close').on('click', function(event){
3656
  propsModal.hide();
3657
  });
3658
 
3638
  var propsModal = pagelayer.$$('.pagelayer-props-modal');
3639
 
3640
  if(propsModal.find('.pagelayer-meta-iframe').length < 1){
3641
+ propsModal.find('.pagelayer-props-wrap').append('<iframe class="pagelayer-meta-iframe" src="'+ pagelayer_post_props +'" style="display:none"></iframe>');
3642
+ propsModal.find('.pagelayer-meta-iframe').load(function(){
3643
+ propsModal.find('.pagelayer-props-loading-screen').hide();
3644
+ propsModal.find('.pagelayer-props-modal-close').css('visibility','visible');
3645
+ jQuery(this).show();
3646
+ });
3647
  }
3648
 
3649
  propsModal.show();
3657
 
3658
  // Pagelayer post advance setting modal handler
3659
  var propsModal = pagelayer.$$('.pagelayer-props-modal');
3660
+ propsModal.find('.pagelayer-props-modal-close').on('click', function(event){
3661
  propsModal.hide();
3662
  });
3663
 
js/pagelayer-frontend.js CHANGED
@@ -80,7 +80,11 @@ jQuery(document).ready(function(){
80
 
81
  jQuery('.pagelayer-social_grp').each(function(){
82
  pagelayer_pl_social_profile(jQuery(this));
83
- });
 
 
 
 
84
 
85
  pagelayer_stars();
86
 
@@ -1216,6 +1220,18 @@ function pagelayer_pl_social_profile(jEle){
1216
  }
1217
  }
1218
 
 
 
 
 
 
 
 
 
 
 
 
 
1219
  ////////////////
1220
  // Freemium End
1221
  ////////////////
80
 
81
  jQuery('.pagelayer-social_grp').each(function(){
82
  pagelayer_pl_social_profile(jQuery(this));
83
+ });
84
+
85
+ jQuery('ul.pagelayer-mega-menu').each(function(){
86
+ pagelayer_mega_menu_position(jQuery(this));
87
+ });
88
 
89
  pagelayer_stars();
90
 
1220
  }
1221
  }
1222
 
1223
+ // Mega menu function which applies id and adjust position
1224
+ function pagelayer_mega_menu_position(mEle){
1225
+
1226
+ var jEle = mEle.find('.pagelayer-mega_menu');
1227
+ var id = jEle.attr('pagelayer-id');
1228
+
1229
+ mEle.attr('pagelayer-mega-menu-id', id);
1230
+
1231
+ colWidth = mEle.parents('.pagelayer-col').first();
1232
+ mEle.offset({'left':(colWidth.offset().left - mEle.parent().offset().left)});
1233
+ }
1234
+
1235
  ////////////////
1236
  // Freemium End
1237
  ////////////////
js/widgets.js CHANGED
@@ -1188,6 +1188,28 @@ function pagelayer_render_end_pl_anim_heading(el){
1188
  pagelayer_anim_heading(jEle);
1189
  }
1190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1191
  ////////////////
1192
  // Freemium End
1193
  ////////////////
1188
  pagelayer_anim_heading(jEle);
1189
  }
1190
 
1191
+ // Mega Menu popup handler
1192
+ pagelayer_add_action('pagelayer_setup_history', function(){
1193
+
1194
+ if(!('pagelayer_template_type' in pagelayer_post && pagelayer_post['pagelayer_template_type'] == 'menu')){
1195
+ return;
1196
+ }
1197
+
1198
+ jQuery(pagelayer_editable).wrap('<div class="pagelayer-mega-menu-editor" >'+'</div>');
1199
+
1200
+ pagelayer.$$('.pagelayer-settings-icon').attr("pagelayer-tag", "pl_mega_menu");
1201
+ pagelayer.$$(".pagelayer-settings-icon").click();
1202
+ pagelayer_mega_menu(jQuery('.pagelayer-mega-menu-editor'), pagelayer_post['ID']);
1203
+ });
1204
+
1205
+ // Mega menu function place content editable in the menu
1206
+ function pagelayer_mega_menu(mEle, postId){
1207
+ var mainEle = jQuery('.pagelayer-mega-menu [menu-id="'+postId+'"]');
1208
+ mainEle.empty();
1209
+ mainEle.append(mEle);
1210
+ mainEle.parents('.pagelayer-mega-menu').show();
1211
+ }
1212
+
1213
  ////////////////
1214
  // Freemium End
1215
  ////////////////
main/ajax.php CHANGED
@@ -525,10 +525,7 @@ function pagelayer_update_site_title(){
525
  }
526
 
527
  update_option('blogname', $site_title);
528
-
529
- $wpdb->query("UPDATE `sm_sitemeta`
530
- SET meta_value = '".$site_title."'
531
- WHERE meta_key = 'site_name'");
532
  wp_die();
533
  }
534
 
@@ -571,6 +568,7 @@ function pagelayer_fetch_primary_menu(){
571
  check_ajax_referer('pagelayer_ajax', 'pagelayer_nonce');
572
 
573
  if(isset($_POST['nav_list'])){
 
574
  echo wp_nav_menu([
575
  'menu' => wp_get_nav_menu_object($_POST['nav_list']),
576
  'menu_id' => $_POST["nav_list"],
@@ -853,9 +851,9 @@ function pagelayer_fetch_featured_img(){
853
  check_ajax_referer('pagelayer_ajax', 'pagelayer_nonce');
854
 
855
  if($_POST['size']){
856
- echo get_the_post_thumbnail_url($_POST['post_id'], $_POST['size']);
857
  }else{
858
- echo get_the_post_thumbnail_url($_POST['post_id']);
859
  }
860
  wp_die();
861
  }
@@ -905,7 +903,7 @@ function pagelayer_archive_posts_data(){
905
  pagelayer_load_shortcodes();
906
 
907
  foreach($_POST['atts'] as $k => $v){
908
- $r[] = $k.'="'.pagelayer_escapeHTML($v).'"';
909
  }
910
 
911
  $string = implode(' ', $r);
@@ -935,6 +933,7 @@ function pagelayer_contact_submit(){
935
  }
936
 
937
  $formdata = $_POST;
 
938
 
939
  if(isset($_POST['g-recaptcha-response']) ){
940
 
@@ -959,7 +958,7 @@ function pagelayer_contact_submit(){
959
  $custom_templ = array();
960
  $use_custom = false;
961
  $use_html = false;
962
- $pagelayer_id = $formdata['cfa-pagelayer-id'];
963
 
964
  if(isset($formdata['cfa-custom-template']) && !empty($formdata['cfa-post-id'])){
965
  $post_id = (int) $formdata['cfa-post-id'];
@@ -1026,6 +1025,7 @@ function pagelayer_contact_submit(){
1026
  }
1027
 
1028
  $body .= $k."\t : \t $".$k."\n";
 
1029
  }
1030
 
1031
  $body .= "\n\n --\n This e-mail was sent from a contact form (".get_home_url().")";
@@ -1042,6 +1042,13 @@ function pagelayer_contact_submit(){
1042
  add_action('phpmailer_init', 'pagelayer_cf_email_attachment', 10, 1);
1043
  }
1044
 
 
 
 
 
 
 
 
1045
  // Add Site Title as option in formdata
1046
  $formdata['site_title'] = get_bloginfo( 'name' );
1047
 
@@ -1083,7 +1090,10 @@ function pagelayer_contact_submit(){
1083
  // Handle Login Submit
1084
  add_action('wp_ajax_pagelayer_login_submit', 'pagelayer_login_submit');
1085
  add_action('wp_ajax_nopriv_pagelayer_login_submit', 'pagelayer_login_submit');
1086
- function pagelayer_login_submit(){
 
 
 
1087
 
1088
  $fdata = $_POST['form_data'];
1089
  parse_str($fdata, $formdata);
@@ -1093,17 +1103,18 @@ function pagelayer_login_submit(){
1093
  $creds['user_password'] = $formdata['password'];
1094
  $creds['remember'] = $formdata['remember_me'];
1095
 
1096
- // If After logout URL, then save
1097
- if(!empty($formdata['logout_url'])){
1098
- update_user_option('pagelayer_logout_url', $formdata['logout_url']);
1099
- }
1100
-
1101
  // Login the user
1102
  $user = wp_signon( $creds, false );
1103
 
1104
  if ( is_wp_error($user) ){
1105
  $data['error'] = $user->get_error_message();
1106
  }else{
 
 
 
 
 
 
1107
  $data['redirect'] = (empty($formdata['login_url']) ? '' : $formdata['login_url']);
1108
  $data['error'] = '';
1109
  }
@@ -1112,24 +1123,6 @@ function pagelayer_login_submit(){
1112
 
1113
  }
1114
 
1115
- // Handle Logout Redirect here
1116
- add_action('wp_logout', 'pagelayer_after_logout');
1117
- function pagelayer_after_logout(){
1118
-
1119
- // Get the URL
1120
- $url = get_user_option('pagelayer_logout_url');
1121
-
1122
- // Now blank it
1123
- update_user_option('pagelayer_logout_url', '');
1124
-
1125
- // We will redirect if we have the given item set.
1126
- if(!empty($url)){
1127
- wp_redirect( $url );
1128
- exit();
1129
- }
1130
-
1131
- }
1132
-
1133
  // Get Page List for SiteMap
1134
  add_action('wp_ajax_pagelayer_get_pages_list', 'pagelayer_get_pages_list');
1135
  function pagelayer_get_pages_list(){
@@ -1228,18 +1221,19 @@ function pagelayer_search_ids() {
1228
  }
1229
  break;
1230
 
1231
- /* case 'menu':
1232
 
1233
- $menuItems = wp_get_nav_menu_items( $_POST['object_type']);
1234
 
1235
  foreach ( $menuItems as $item ) {
1236
- if($item -> menu_item_parent !=0){
 
1237
  continue;
1238
  }
1239
- $sel_opt .= '<span class="pagelayer-temp-search-sel-span" value="'. $item -> ID .'">'. $item -> title .'</span>';
1240
  }
1241
 
1242
- break;*/
1243
 
1244
 
1245
  default:
525
  }
526
 
527
  update_option('blogname', $site_title);
528
+
 
 
 
529
  wp_die();
530
  }
531
 
568
  check_ajax_referer('pagelayer_ajax', 'pagelayer_nonce');
569
 
570
  if(isset($_POST['nav_list'])){
571
+ $_POST['nav_list'] = (int) $_POST['nav_list'];
572
  echo wp_nav_menu([
573
  'menu' => wp_get_nav_menu_object($_POST['nav_list']),
574
  'menu_id' => $_POST["nav_list"],
851
  check_ajax_referer('pagelayer_ajax', 'pagelayer_nonce');
852
 
853
  if($_POST['size']){
854
+ echo get_the_post_thumbnail_url((int)$_POST['post_id'], sanitize_text_field($_POST['size']));
855
  }else{
856
+ echo get_the_post_thumbnail_url((int)$_POST['post_id']);
857
  }
858
  wp_die();
859
  }
903
  pagelayer_load_shortcodes();
904
 
905
  foreach($_POST['atts'] as $k => $v){
906
+ $r[] = esc_html($k).'="'.pagelayer_escapeHTML($v).'"';
907
  }
908
 
909
  $string = implode(' ', $r);
933
  }
934
 
935
  $formdata = $_POST;
936
+ // NOTE : NEVER add anything to $formdata except $_POST vars
937
 
938
  if(isset($_POST['g-recaptcha-response']) ){
939
 
958
  $custom_templ = array();
959
  $use_custom = false;
960
  $use_html = false;
961
+ $pagelayer_id = sanitize_text_field($formdata['cfa-pagelayer-id']);
962
 
963
  if(isset($formdata['cfa-custom-template']) && !empty($formdata['cfa-post-id'])){
964
  $post_id = (int) $formdata['cfa-post-id'];
1025
  }
1026
 
1027
  $body .= $k."\t : \t $".$k."\n";
1028
+
1029
  }
1030
 
1031
  $body .= "\n\n --\n This e-mail was sent from a contact form (".get_home_url().")";
1042
  add_action('phpmailer_init', 'pagelayer_cf_email_attachment', 10, 1);
1043
  }
1044
 
1045
+ // If we are using HTML, then we should escape html as well
1046
+ if(!empty($use_html)){
1047
+ foreach($formdata as $k => $i){
1048
+ $formdata[$k] = esc_html($i);
1049
+ }
1050
+ }
1051
+
1052
  // Add Site Title as option in formdata
1053
  $formdata['site_title'] = get_bloginfo( 'name' );
1054
 
1090
  // Handle Login Submit
1091
  add_action('wp_ajax_pagelayer_login_submit', 'pagelayer_login_submit');
1092
  add_action('wp_ajax_nopriv_pagelayer_login_submit', 'pagelayer_login_submit');
1093
+ function pagelayer_login_submit(){
1094
+
1095
+ // Some AJAX security
1096
+ check_ajax_referer('pagelayer_global', 'pagelayer_nonce');
1097
 
1098
  $fdata = $_POST['form_data'];
1099
  parse_str($fdata, $formdata);
1103
  $creds['user_password'] = $formdata['password'];
1104
  $creds['remember'] = $formdata['remember_me'];
1105
 
 
 
 
 
 
1106
  // Login the user
1107
  $user = wp_signon( $creds, false );
1108
 
1109
  if ( is_wp_error($user) ){
1110
  $data['error'] = $user->get_error_message();
1111
  }else{
1112
+
1113
+ // If After logout URL, then save
1114
+ if(!empty($formdata['logout_url'])){
1115
+ update_user_option($user->ID, 'pagelayer_logout_url', $formdata['logout_url']);
1116
+ }
1117
+
1118
  $data['redirect'] = (empty($formdata['login_url']) ? '' : $formdata['login_url']);
1119
  $data['error'] = '';
1120
  }
1123
 
1124
  }
1125
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1126
  // Get Page List for SiteMap
1127
  add_action('wp_ajax_pagelayer_get_pages_list', 'pagelayer_get_pages_list');
1128
  function pagelayer_get_pages_list(){
1221
  }
1222
  break;
1223
 
1224
+ case 'menu':
1225
 
1226
+ $menuItems = wp_get_nav_menu_items( (int)$_POST['object_type']);
1227
 
1228
  foreach ( $menuItems as $item ) {
1229
+
1230
+ if($item -> menu_item_parent !=0 ){
1231
  continue;
1232
  }
1233
+ $sel_opt .= '<span class="pagelayer-temp-search-sel-span" value="'. $item -> ID .'">'. $item -> title.'</span>';
1234
  }
1235
 
1236
+ break;
1237
 
1238
 
1239
  default:
main/functions.php CHANGED
@@ -141,7 +141,7 @@ function pagelayer_optreq($name, $default = ''){
141
  // For filling in posted values
142
  function pagelayer_POSTval($name, $default = ''){
143
 
144
- return (!empty($_POST) ? (!isset($_POST[$name]) ? '' : $_POST[$name]) : $default);
145
 
146
  }
147
 
141
  // For filling in posted values
142
  function pagelayer_POSTval($name, $default = ''){
143
 
144
+ return (!empty($_POST) ? (!isset($_POST[$name]) ? '' : esc_html($_POST[$name])) : $default);
145
 
146
  }
147
 
main/import.php CHANGED
@@ -39,6 +39,7 @@ function pagelayer_import(){
39
  $pagelayer_pages = @json_decode(file_get_contents($pagelayer_theme_path.'/pagelayer-data.conf'), true);
40
 
41
  if(isset($_POST['theme'])){
 
42
  $GLOBALS['pl_saved'] = pagelayer_import_theme($pagelayer_theme->template);
43
  }
44
 
@@ -185,8 +186,9 @@ font-weight: 600;
185
 
186
  <!-- Modal content -->
187
  <div class="pagelayer-modal-content">
188
- <form id="pagelayer-import-form" method="post" enctype="multipart/form-data">
189
- <input name="theme" value="'.get_template().'" type="hidden" />
 
190
  <div><input type="checkbox" name="delete_old_import" id="delete_old_import" /> Delete Previously Imported Content</div>
191
  <div><input type="checkbox" name="overwrite" /> Overwrite existing Pages with same name</div>
192
  <div><input type="checkbox" name="set_home_page" checked /> Set the Home Page as per the content</div>
39
  $pagelayer_pages = @json_decode(file_get_contents($pagelayer_theme_path.'/pagelayer-data.conf'), true);
40
 
41
  if(isset($_POST['theme'])){
42
+ check_admin_referer('pagelayer-import');
43
  $GLOBALS['pl_saved'] = pagelayer_import_theme($pagelayer_theme->template);
44
  }
45
 
186
 
187
  <!-- Modal content -->
188
  <div class="pagelayer-modal-content">
189
+ <form id="pagelayer-import-form" method="post" enctype="multipart/form-data">';
190
+ wp_nonce_field('pagelayer-import');
191
+ echo '<input name="theme" value="'.get_template().'" type="hidden" />
192
  <div><input type="checkbox" name="delete_old_import" id="delete_old_import" /> Delete Previously Imported Content</div>
193
  <div><input type="checkbox" name="overwrite" /> Overwrite existing Pages with same name</div>
194
  <div><input type="checkbox" name="set_home_page" checked /> Set the Home Page as per the content</div>
main/live-body.php CHANGED
@@ -152,6 +152,7 @@ echo '</div>
152
  <div class="pagelayer-props-modal">
153
  <div class="pagelayer-props-holder">
154
  <div class="pagelayer-props-wrap">
 
155
  <i class="pagelayer-props-modal-close pli pli-cross" aria-hidden="true"></i>
156
  </div>
157
  </div>
152
  <div class="pagelayer-props-modal">
153
  <div class="pagelayer-props-holder">
154
  <div class="pagelayer-props-wrap">
155
+ <div class="pagelayer-props-loading-screen"></div>
156
  <i class="pagelayer-props-modal-close pli pli-cross" aria-hidden="true"></i>
157
  </div>
158
  </div>
main/live.php CHANGED
@@ -238,10 +238,7 @@ filter:blur(2px);
238
  if(empty($data)){
239
 
240
  // Is it a Gutenburg Post ?
241
- if(false){
242
-
243
- // Regular post
244
- }else{
245
 
246
  // Add our surrounding tag
247
  $post->post_content = '['.PAGELAYER_SC_PREFIX.'_row]
@@ -252,6 +249,15 @@ filter:blur(2px);
252
  [/'.PAGELAYER_SC_PREFIX.'_col]
253
  [/'.PAGELAYER_SC_PREFIX.'_row]';
254
 
 
 
 
 
 
 
 
 
 
255
  // Update the post
256
  $new_post = array(
257
  'ID' => $post->ID,
@@ -261,11 +267,11 @@ filter:blur(2px);
261
  // Update the post into the database
262
  wp_update_post($new_post);
263
 
264
- }
 
 
 
265
 
266
- // Convert to pagelayer accessed post
267
- if(!add_post_meta($post->ID, 'pagelayer-data', time(), true)){
268
- update_post_meta($post->ID, 'pagelayer-data', time());
269
  }
270
  }
271
 
238
  if(empty($data)){
239
 
240
  // Is it a Gutenburg Post ?
241
+ if(!empty($post->post_content)){
 
 
 
242
 
243
  // Add our surrounding tag
244
  $post->post_content = '['.PAGELAYER_SC_PREFIX.'_row]
249
  [/'.PAGELAYER_SC_PREFIX.'_col]
250
  [/'.PAGELAYER_SC_PREFIX.'_row]';
251
 
252
+ // Regular post, but its empty so we will add our blocks !
253
+ }else{
254
+
255
+ // Add our surrounding tag
256
+ $post->post_content = '<!-- '.PAGELAYER_BLOCK_PREFIX.':pagelayer/pl_row {"stretch":"auto","col_gap":"10","width_content":"auto","row_height":"default","overlay_hover_delay":"400","row_shape_top_color":"#227bc3","row_shape_top_width":"100","row_shape_top_height":"100","row_shape_bottom_color":"#e44993","row_shape_bottom_width":"100","row_shape_bottom_height":"100","pagelayer-id":""} -->
257
+ <!-- '.PAGELAYER_BLOCK_PREFIX.':pagelayer/pl_col {"overlay_hover_delay":"400","pagelayer-id":""} -->
258
+ <!-- /'.PAGELAYER_BLOCK_PREFIX.':pagelayer/pl_col -->
259
+ <!-- /'.PAGELAYER_BLOCK_PREFIX.':pagelayer/pl_row -->';
260
+
261
  // Update the post
262
  $new_post = array(
263
  'ID' => $post->ID,
267
  // Update the post into the database
268
  wp_update_post($new_post);
269
 
270
+ // Convert to pagelayer accessed post
271
+ if(!add_post_meta($post->ID, 'pagelayer-data', time(), true)){
272
+ update_post_meta($post->ID, 'pagelayer-data', time());
273
+ }
274
 
 
 
 
275
  }
276
  }
277
 
main/post_metas.php CHANGED
@@ -28,7 +28,7 @@ if(!defined('PAGELAYER_VERSION')) {
28
  function pagelayer_meta_page(){
29
  global $post_type, $post_type_object, $post, $wp_meta_boxes, $current_screen, $user_ID, $post_ID;
30
 
31
- $post_ID = @$_GET['post'];
32
 
33
  if(empty($post_ID)){
34
  return;
28
  function pagelayer_meta_page(){
29
  global $post_type, $post_type_object, $post, $wp_meta_boxes, $current_screen, $user_ID, $post_ID;
30
 
31
+ $post_ID = (int) @$_GET['post'];
32
 
33
  if(empty($post_ID)){
34
  return;
main/settings.php CHANGED
@@ -178,11 +178,15 @@ function pagelayer_settings_page(){
178
  $option_name = 'pl_gen_setting';
179
  $new_value = '';
180
 
181
- if(isset($_REQUEST['submit'])){
 
182
  check_admin_referer('pagelayer-options');
183
  }
184
 
185
- if(isset($_REQUEST['pl_support_ept'])){
 
 
 
186
 
187
  $pl_support_ept = $_REQUEST['pl_support_ept'];
188
 
@@ -197,113 +201,140 @@ function pagelayer_settings_page(){
197
 
198
  $support_ept = get_option( 'pl_support_ept');
199
 
 
 
200
  }
201
 
202
 
203
- if(isset($_REQUEST['pagelayer_icons_set'])){
204
  $pagelayer_icons_set = $_REQUEST['pagelayer_icons_set'];
205
 
206
  // Update it
207
  update_option('pagelayer_icons_set', $pagelayer_icons_set);
 
 
208
  }
209
 
210
  $socials = ['pagelayer-facebook-url','pagelayer-twitter-url','pagelayer-instagram-url','pagelayer-linkedin-url','pagelayer-youtube-url','pagelayer-gplus-url','pagelayer-copyright','pagelayer-phone','pagelayer-address'];
211
 
212
  foreach( $socials as $social ){
213
- if(isset($_REQUEST[$social])){
214
  $url = $_REQUEST[$social];
215
  update_option($social, $url);
 
216
  }
217
  }
218
 
219
- if(isset($_REQUEST['pagelayer_cf_to_email'])){
220
 
221
  $to_email = $_REQUEST['pagelayer_cf_to_email'];
222
 
223
  update_option( 'pagelayer_cf_to_email', $to_email );
224
 
 
 
225
  }
226
 
227
  if(defined('PAGELAYER_PREMIUM')){
228
 
229
- if(isset($_REQUEST['pagelayer_cf_subject'])){
230
 
231
  $subject = $_REQUEST['pagelayer_cf_subject'];
232
 
233
  update_option('pagelayer_cf_subject', $subject, 'no');
 
 
234
 
235
  }
236
 
237
- if(isset($_REQUEST['pagelayer_cf_headers'])){
238
 
239
  $subject = $_REQUEST['pagelayer_cf_headers'];
240
 
241
  update_option('pagelayer_cf_headers', $subject, 'no');
 
 
242
 
243
  }
244
 
245
- if(isset($_REQUEST['pagelayer_cf_from_email'])){
246
 
247
  $subject = $_REQUEST['pagelayer_cf_from_email'];
248
 
249
  update_option('pagelayer_cf_from_email', $subject, 'no');
 
 
250
 
251
  }
252
 
253
- if(isset($_REQUEST['pagelayer_cf_success'])){
254
 
255
  $success = $_REQUEST['pagelayer_cf_success'];
256
 
257
  update_option( 'pagelayer_cf_success', $success, 'no');
 
 
258
 
259
  }
260
 
261
- if(isset($_REQUEST['pagelayer_cf_failed'])){
262
 
263
  $failed = $_REQUEST['pagelayer_cf_failed'];
264
 
265
  update_option( 'pagelayer_cf_failed', $failed, 'no');
 
 
266
 
267
  }
268
 
269
- if(isset($_REQUEST['pagelayer_recaptcha_failed'])){
270
 
271
  $failed = $_REQUEST['pagelayer_recaptcha_failed'];
272
 
273
  update_option( 'pagelayer_recaptcha_failed', $failed, 'no');
 
 
274
 
275
  }
276
 
277
- if(isset($_REQUEST['pagelayer_google_captcha'])){
278
 
279
  $captcha = $_REQUEST['pagelayer_google_captcha'];
280
 
281
  update_option( 'pagelayer_google_captcha', $captcha );
 
 
282
 
283
  }
284
 
285
- if(isset($_REQUEST['pagelayer_google_captcha_secret'])){
286
 
287
  $captcha_secret = $_REQUEST['pagelayer_google_captcha_secret'];
288
 
289
  update_option( 'pagelayer_google_captcha_secret', $captcha_secret );
 
 
290
 
291
  }
292
 
293
- if(isset($_REQUEST['pagelayer_google_captcha_lang'])){
294
 
295
  $captcha_secret = $_REQUEST['pagelayer_google_captcha_lang'];
296
 
297
  update_option( 'pagelayer_google_captcha_lang', $captcha_secret );
 
 
298
 
299
  }
300
 
301
  // Facebook APP ID
302
- if(isset($_REQUEST['pagelayer-fbapp-id'])){
303
  $fb_app_id = $_REQUEST['pagelayer-fbapp-id'];
304
 
305
  // Save it
306
  update_option( 'pagelayer-fbapp-id', $fb_app_id );
 
 
307
  }
308
  }
309
 
@@ -381,6 +412,16 @@ function pagelayer_settings_page(){
381
  $recap_lang['zu'] = 'Zulu';
382
 
383
  pagelayer_page_header('Pagelayer Settings');
 
 
 
 
 
 
 
 
 
 
384
 
385
  ?>
386
  <form class="pagelayer-setting-form" method="post" action="">
178
  $option_name = 'pl_gen_setting';
179
  $new_value = '';
180
 
181
+ // DO an admin referrer check
182
+ if(!empty($_POST)){
183
  check_admin_referer('pagelayer-options');
184
  }
185
 
186
+ // We do a $_POST check and hence we are checking the POST var here as well
187
+ // Everywhere down as well, $_POST should be used to save data
188
+
189
+ if(isset($_POST['pl_support_ept'])){
190
 
191
  $pl_support_ept = $_REQUEST['pl_support_ept'];
192
 
201
 
202
  $support_ept = get_option( 'pl_support_ept');
203
 
204
+ $done = 1;
205
+
206
  }
207
 
208
 
209
+ if(isset($_POST['pagelayer_icons_set'])){
210
  $pagelayer_icons_set = $_REQUEST['pagelayer_icons_set'];
211
 
212
  // Update it
213
  update_option('pagelayer_icons_set', $pagelayer_icons_set);
214
+
215
+ $done = 1;
216
  }
217
 
218
  $socials = ['pagelayer-facebook-url','pagelayer-twitter-url','pagelayer-instagram-url','pagelayer-linkedin-url','pagelayer-youtube-url','pagelayer-gplus-url','pagelayer-copyright','pagelayer-phone','pagelayer-address'];
219
 
220
  foreach( $socials as $social ){
221
+ if(isset($_POST[$social])){
222
  $url = $_REQUEST[$social];
223
  update_option($social, $url);
224
+ $done = 1;
225
  }
226
  }
227
 
228
+ if(isset($_POST['pagelayer_cf_to_email'])){
229
 
230
  $to_email = $_REQUEST['pagelayer_cf_to_email'];
231
 
232
  update_option( 'pagelayer_cf_to_email', $to_email );
233
 
234
+ $done = 1;
235
+
236
  }
237
 
238
  if(defined('PAGELAYER_PREMIUM')){
239
 
240
+ if(isset($_POST['pagelayer_cf_subject'])){
241
 
242
  $subject = $_REQUEST['pagelayer_cf_subject'];
243
 
244
  update_option('pagelayer_cf_subject', $subject, 'no');
245
+
246
+ $done = 1;
247
 
248
  }
249
 
250
+ if(isset($_POST['pagelayer_cf_headers'])){
251
 
252
  $subject = $_REQUEST['pagelayer_cf_headers'];
253
 
254
  update_option('pagelayer_cf_headers', $subject, 'no');
255
+
256
+ $done = 1;
257
 
258
  }
259
 
260
+ if(isset($_POST['pagelayer_cf_from_email'])){
261
 
262
  $subject = $_REQUEST['pagelayer_cf_from_email'];
263
 
264
  update_option('pagelayer_cf_from_email', $subject, 'no');
265
+
266
+ $done = 1;
267
 
268
  }
269
 
270
+ if(isset($_POST['pagelayer_cf_success'])){
271
 
272
  $success = $_REQUEST['pagelayer_cf_success'];
273
 
274
  update_option( 'pagelayer_cf_success', $success, 'no');
275
+
276
+ $done = 1;
277
 
278
  }
279
 
280
+ if(isset($_POST['pagelayer_cf_failed'])){
281
 
282
  $failed = $_REQUEST['pagelayer_cf_failed'];
283
 
284
  update_option( 'pagelayer_cf_failed', $failed, 'no');
285
+
286
+ $done = 1;
287
 
288
  }
289
 
290
+ if(isset($_POST['pagelayer_recaptcha_failed'])){
291
 
292
  $failed = $_REQUEST['pagelayer_recaptcha_failed'];
293
 
294
  update_option( 'pagelayer_recaptcha_failed', $failed, 'no');
295
+
296
+ $done = 1;
297
 
298
  }
299
 
300
+ if(isset($_POST['pagelayer_google_captcha'])){
301
 
302
  $captcha = $_REQUEST['pagelayer_google_captcha'];
303
 
304
  update_option( 'pagelayer_google_captcha', $captcha );
305
+
306
+ $done = 1;
307
 
308
  }
309
 
310
+ if(isset($_POST['pagelayer_google_captcha_secret'])){
311
 
312
  $captcha_secret = $_REQUEST['pagelayer_google_captcha_secret'];
313
 
314
  update_option( 'pagelayer_google_captcha_secret', $captcha_secret );
315
+
316
+ $done = 1;
317
 
318
  }
319
 
320
+ if(isset($_POST['pagelayer_google_captcha_lang'])){
321
 
322
  $captcha_secret = $_REQUEST['pagelayer_google_captcha_lang'];
323
 
324
  update_option( 'pagelayer_google_captcha_lang', $captcha_secret );
325
+
326
+ $done = 1;
327
 
328
  }
329
 
330
  // Facebook APP ID
331
+ if(isset($_POST['pagelayer-fbapp-id'])){
332
  $fb_app_id = $_REQUEST['pagelayer-fbapp-id'];
333
 
334
  // Save it
335
  update_option( 'pagelayer-fbapp-id', $fb_app_id );
336
+
337
+ $done = 1;
338
  }
339
  }
340
 
412
  $recap_lang['zu'] = 'Zulu';
413
 
414
  pagelayer_page_header('Pagelayer Settings');
415
+
416
+ // Saved ?
417
+ if(!empty($done)){
418
+ echo '<div class="notice notice-success"><p>'. __('The settings were saved successfully', 'pagelayer'). '</p></div><br />';
419
+ }
420
+
421
+ // Any errors ?
422
+ if(!empty($pl_error)){
423
+ pagelayer_report_error($pl_error);echo '<br />';
424
+ }
425
 
426
  ?>
427
  <form class="pagelayer-setting-form" method="post" action="">
main/template.php CHANGED
@@ -49,7 +49,11 @@ global $pagelayer;
49
  'section' => array(
50
  'label' => __('Section'),
51
  'no_condition' => 1, // To hide the conditions options
52
- ),
 
 
 
 
53
  'global_section' => array(
54
  'label' => __('Global Section'),
55
  'no_condition' => 1, // To hide the conditions options
@@ -79,6 +83,9 @@ global $pagelayer;
79
  return ( is_singular() && ! is_embed() ) || is_404();
80
  },
81
  ),
 
 
 
82
  ],
83
  // NOTE: Templates list array name should be dispay_on name with suffix _templates
84
  'archives_templates'=> [
@@ -132,6 +139,8 @@ global $pagelayer;
132
  //'direct_child_of' => __('Direct Child Of'),
133
  //'any_child_of' => __('Any Child Of'),
134
  ], // conditions by post type
 
 
135
 
136
  );
137
 
@@ -291,6 +300,25 @@ function pagelayer_builder_archives_conditions($post_types = []){
291
  }
292
 
293
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
294
 
295
  return $condition;
296
  }
@@ -380,6 +408,7 @@ function pagelayer_builder_post_type() {
380
  // Add any other templates as well
381
  $pagelayer->builder['archives_templates'] += pagelayer_builder_archives_conditions();
382
  $pagelayer->builder['singular_templates'] += pagelayer_builder_singular_conditions();
 
383
 
384
  }
385
 
@@ -719,6 +748,8 @@ function pagelayer_builder_template_redirect(){
719
  // If there is a match for a footer
720
  $pagelayer->template_footer = pagelayer_builder_try_to_apply('footer');
721
 
 
 
722
  // If the post type is pagelayer-template, then we are viewing i.e. EDITING PAGELAYER
723
  if(!empty($post) && $post->post_type == $pagelayer->builder['name']){
724
 
@@ -736,6 +767,7 @@ function pagelayer_builder_template_redirect(){
736
  $pagelayer->template_header = $post->ID;// Fill in that we are rendering the header we want to edit
737
  $pagelayer->template_post = 0;
738
  $pagelayer->template_footer = 0;
 
739
 
740
  // If the type is footer
741
  }elseif( $pagelayer_template_type == 'footer' ){
@@ -744,6 +776,7 @@ function pagelayer_builder_template_redirect(){
744
  $pagelayer->template_header = 0;
745
  $pagelayer->template_post = 0;
746
  $pagelayer->template_footer = $post->ID;// Fill in that we are rendering the footer we want to edit
 
747
 
748
  }
749
 
@@ -918,6 +951,12 @@ function pagelayer_template_include($template){
918
  $pagelayer_enqueue_frontend = true;
919
  add_action('get_header', 'pagelayer_get_header');
920
  add_action('get_footer', 'pagelayer_get_footer');
 
 
 
 
 
 
921
  }
922
 
923
  // Handle the sidebar settings !
@@ -1220,6 +1259,97 @@ function pagelayer_get_footer($name) {
1220
 
1221
  }
1222
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1223
  // Any sidebar to load ?
1224
  function pagelayer_get_sidebar($name = '') {
1225
 
@@ -1342,7 +1472,7 @@ function pagelayer_get_post_content($id){
1342
  // Reset the id
1343
  $pagelayer->rendering_template_id = 0;
1344
 
1345
- return $content;
1346
 
1347
  }
1348
 
49
  'section' => array(
50
  'label' => __('Section'),
51
  'no_condition' => 1, // To hide the conditions options
52
+ ),/*
53
+ 'menu' => array(
54
+ 'label' => __('Menu'),
55
+ 'need_selection' => 'menu'
56
+ ), */
57
  'global_section' => array(
58
  'label' => __('Global Section'),
59
  'no_condition' => 1, // To hide the conditions options
83
  return ( is_singular() && ! is_embed() ) || is_404();
84
  },
85
  ),
86
+ 'menu' => array(
87
+ 'label' => __('Menu')
88
+ ),
89
  ],
90
  // NOTE: Templates list array name should be dispay_on name with suffix _templates
91
  'archives_templates'=> [
139
  //'direct_child_of' => __('Direct Child Of'),
140
  //'any_child_of' => __('Any Child Of'),
141
  ], // conditions by post type
142
+ 'menu_templates' => [
143
+ ]
144
 
145
  );
146
 
300
  }
301
 
302
  }
303
+ return $condition;
304
+ }
305
+
306
+ function pagelayer_builder_menu_conditions($post_types = []){
307
+
308
+ $condition = [];
309
+
310
+ $menus = wp_get_nav_menus();
311
+
312
+ foreach($menus as $menu){
313
+
314
+ $condition += [
315
+ $menu->slug => array(
316
+ 'label' => __($menu->name),
317
+ 'filter_type' => 'menu',
318
+ 'object_type' => $menu->term_taxonomy_id
319
+ )
320
+ ];
321
+ }
322
 
323
  return $condition;
324
  }
408
  // Add any other templates as well
409
  $pagelayer->builder['archives_templates'] += pagelayer_builder_archives_conditions();
410
  $pagelayer->builder['singular_templates'] += pagelayer_builder_singular_conditions();
411
+ $pagelayer->builder['menu_templates'] += pagelayer_builder_menu_conditions();
412
 
413
  }
414
 
748
  // If there is a match for a footer
749
  $pagelayer->template_footer = pagelayer_builder_try_to_apply('footer');
750
 
751
+ $pagelayer->template_menu = pagelayer_builder_template_ids('menu');
752
+
753
  // If the post type is pagelayer-template, then we are viewing i.e. EDITING PAGELAYER
754
  if(!empty($post) && $post->post_type == $pagelayer->builder['name']){
755
 
767
  $pagelayer->template_header = $post->ID;// Fill in that we are rendering the header we want to edit
768
  $pagelayer->template_post = 0;
769
  $pagelayer->template_footer = 0;
770
+ $pagelayer->template_menu = 0;
771
 
772
  // If the type is footer
773
  }elseif( $pagelayer_template_type == 'footer' ){
776
  $pagelayer->template_header = 0;
777
  $pagelayer->template_post = 0;
778
  $pagelayer->template_footer = $post->ID;// Fill in that we are rendering the footer we want to edit
779
+ $pagelayer->template_menu = 0;
780
 
781
  }
782
 
951
  $pagelayer_enqueue_frontend = true;
952
  add_action('get_header', 'pagelayer_get_header');
953
  add_action('get_footer', 'pagelayer_get_footer');
954
+ }
955
+
956
+ // Mega menu
957
+ if(!empty($pagelayer->template_menu)){
958
+ pagelayer_pre_menu_build();
959
+ add_filter('wp_nav_menu', 'pagelayer_nav_menu', 10, 2);
960
  }
961
 
962
  // Handle the sidebar settings !
1259
 
1260
  }
1261
 
1262
+ // Mega menu pre build function for building menu before wp_nav_menu hook call
1263
+ function pagelayer_pre_menu_build(){
1264
+
1265
+ global $pagelayer, $pagelayer_menu;
1266
+
1267
+ if(empty($pagelayer->template_menu)){
1268
+ return;
1269
+ }
1270
+
1271
+ $menuInfo = [];
1272
+ $count = 0;
1273
+ $prevId = [];
1274
+ foreach($pagelayer->template_menu as $menuId){
1275
+
1276
+ $menuInfo = get_post_meta( $menuId, 'pagelayer_template_conditions', true );
1277
+
1278
+ if(empty($menuInfo[0]['sub_template']) || $menuInfo[0]['type']!='include' || in_array($menuInfo[0]['id'], $prevId) || $menuInfo[0]['template'] != 'menu'){
1279
+ $prevId[] = $menuInfo[0]['id'];
1280
+ continue;
1281
+ }
1282
+
1283
+ $preMenuItems = wp_get_nav_menu_items( $menuInfo[0]['sub_template'] );
1284
+
1285
+ if($count==0){
1286
+ foreach ( $preMenuItems as $item ) {
1287
+ $count++;
1288
+ if($item->post_title == '' && is_nav_menu_item( $item->ID ) && $item->title == ''){
1289
+ wp_delete_post( $item->ID, true );
1290
+ }
1291
+ }
1292
+ }
1293
+
1294
+ $taxonomyId = wp_get_nav_menu_object($menuInfo[0]['sub_template'] );
1295
+ $newItemId = wp_update_nav_menu_item( $taxonomyId->term_taxonomy_id , 0, array(
1296
+ 'menu-item-title' => '',
1297
+ 'menu-item-url' => '#',
1298
+ 'menu-item-status' => 'publish',
1299
+ 'menu-item-parent-id' => $menuInfo[0]['id']
1300
+ ));
1301
+
1302
+ $pagelayer_menu[] = [
1303
+ 'item_parent' => $menuInfo[0]['id'],
1304
+ 'newItemId' => $newItemId,
1305
+ 'menu_temp' => '<div class="pagelayer_mega_menu_container" menu-id="'.$menuId.'">'. pagelayer_get_post_content($menuId).'</div>'
1306
+ ];
1307
+ }
1308
+ }
1309
+
1310
+ // Mega menu wp_nav_menu hook
1311
+ function pagelayer_nav_menu($nav_menu, $args){
1312
+
1313
+ global $pagelayer, $pagelayer_menu;
1314
+
1315
+ if(empty($pagelayer_menu) || empty($pagelayer->template_menu)){
1316
+ return $nav_menu;
1317
+ }
1318
+
1319
+ $nav_menu = explode('>', $nav_menu);
1320
+
1321
+ foreach($pagelayer_menu as $prop){
1322
+ foreach($nav_menu as $key => $htmlItem){
1323
+
1324
+ if(strpos($htmlItem, 'menu-item-'.$prop['item_parent']) > 0){
1325
+ for($i=$key+1; $i<count($nav_menu); $i++){
1326
+ if(strpos($nav_menu[$i], 'sub-menu') > 0){
1327
+ $nav_menu[$i] = str_replace('sub-menu', 'sub-menu pagelayer-mega-menu', $nav_menu[$i]);
1328
+ break;
1329
+ }
1330
+ }
1331
+ }
1332
+
1333
+ if(strpos($htmlItem, 'menu-item-'.$prop['newItemId']) > 0){
1334
+
1335
+ $menu_item = ' menu-item-'.$prop['newItemId'];
1336
+
1337
+ $nav_menu[$key] = str_replace($menu_item, $menu_item.' pagelayer-mega-menu-li ', $nav_menu[$key]);
1338
+
1339
+ $nav_menu[$key] .= '>'.$prop['menu_temp'].'>';
1340
+ break;
1341
+ }
1342
+ }
1343
+ }
1344
+
1345
+ $nav_menu = implode('>', $nav_menu);
1346
+ $nav_menu = str_replace('>>', '', $nav_menu);
1347
+
1348
+ return $nav_menu;
1349
+ }
1350
+
1351
+ /* Mega menu ends */
1352
+
1353
  // Any sidebar to load ?
1354
  function pagelayer_get_sidebar($name = '') {
1355
 
1472
  // Reset the id
1473
  $pagelayer->rendering_template_id = 0;
1474
 
1475
+ return $content;
1476
 
1477
  }
1478
 
main/website.php CHANGED
@@ -33,9 +33,11 @@ function pagelayer_website_settings(){
33
 
34
  pagelayer_load_font_options();
35
 
36
- if(isset($_REQUEST['submit'])){
37
-
38
  check_admin_referer('pagelayer-options');
 
 
 
39
 
40
  $font_settings = ['body', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'pagelayer_color' => 'color', 'pagelayer_sidebar' => 'sidebar'];
41
 
@@ -277,7 +279,7 @@ function pagelayer_website_settings_T(){
277
  <tr>
278
  <th valign="top"><?php echo __('Width');?> : </th>
279
  <td>
280
- <input type="number" name="sidebar[width]" min="1" step="1" value="<?php echo (!empty($_POST) ? $_POST['sidebar']['width'] : (!empty($pagelayer->settings['sidebar']['width']) ? $pagelayer->settings['sidebar']['width'] : '20') );?>" /><span>%</span>
281
  </td>
282
  </tr>
283
  </table>
@@ -389,7 +391,7 @@ function pagelayer_website_color($text, $field){
389
  <tr>
390
  <th scope="row">'.$text.'</th>
391
  <td>
392
- <a href="#" class="pagelayer-show-vanilla"><div class="pagelayer-color-div pagelayer-color-none"></div><span class="dashicons dashicons-no"></span></a><input type="hidden" name="color['.$field.']" value="'.$val.'">
393
  </td>
394
  </tr>
395
  </table>';
@@ -417,7 +419,7 @@ function pagelayer_website_font_settings($prefix){
417
  <select name="<?php echo $prefix;?>[font-family]">
418
  <?php
419
  foreach($pagelayer->fonts as $k => $font){
420
- echo '<option value="'.$font.'" '.($vals[$prefix]['font-family'] == $font ? 'selected' : '').'>'. (empty($font) ? 'Default': $font) .'</option>';
421
  }
422
  ?>
423
  </select>
@@ -433,7 +435,7 @@ function pagelayer_website_font_settings($prefix){
433
  <option value="" <?php echo (empty($vals[$prefix]['font-size']) ? 'selected="seleted"' : '');?>>Default</option>
434
  <option value="custom" <?php echo (!empty($vals[$prefix]['font-size']) ? 'selected="seleted"' : '');?>>Custom</option>
435
  </select>
436
- <input type="number" name="<?php echo $prefix;?>[font-size]" <?php echo (!empty($vals[$prefix]['font-size']) ? 'value="'.$vals[$prefix]['font-size'].'"' : '');?> /><span>px</span>
437
  </label>
438
  </td>
439
  </tr>
@@ -445,7 +447,7 @@ function pagelayer_website_font_settings($prefix){
445
  <select name="<?php echo $prefix;?>[font-style]">
446
  <?php
447
  foreach($pagelayer->font_style as $k => $var){
448
- echo '<option value="'.$k.'" '.($vals[$prefix]['font-style'] == $k ? 'selected' : '').'>'.$var.'</option>';
449
  }
450
  ?>
451
  </select>
@@ -460,7 +462,7 @@ function pagelayer_website_font_settings($prefix){
460
  <select name="<?php echo $prefix;?>[font-weight]">
461
  <?php
462
  foreach($pagelayer->font_weight as $k => $var){
463
- echo '<option value="'.$k.'" '.($vals[$prefix]['font-weight'] == $k ? 'selected' : '').'>'.$var.'</option>';
464
  }
465
  ?>
466
  </select>
@@ -475,7 +477,7 @@ function pagelayer_website_font_settings($prefix){
475
  <select name="<?php echo $prefix;?>[text-transform]">
476
  <?php
477
  foreach($pagelayer->text_transform as $k => $var){
478
- echo '<option value="'.$k.'" '.($vals[$prefix]['text-transform'] == $k ? 'selected' : '').'>'.$var.'</option>';
479
  }
480
  ?>
481
  </select>
@@ -491,7 +493,7 @@ function pagelayer_website_font_settings($prefix){
491
  <option value="" <?php echo (empty($vals[$prefix]['line-height']) ? 'selected="seleted"' : '');?>>Default</option>
492
  <option value="custom" <?php echo (!empty($vals[$prefix]['line-height']) ? 'selected="seleted"' : '');?>>Custom</option>
493
  </select>
494
- <input type="number" name="<?php echo $prefix;?>[line-height]" min="0.1" step="0.1" <?php echo (!empty($vals[$prefix]['line-height']) ? 'value="'.$vals[$prefix]['line-height'].'"' : '');?> />
495
  </label>
496
  </td>
497
  </tr>
@@ -504,7 +506,7 @@ function pagelayer_website_font_settings($prefix){
504
  <option value="" <?php echo (empty($vals[$prefix]['letter-spacing']) ? 'selected="seleted"' : '');?>>Default</option>
505
  <option value="custom" <?php echo (!empty($vals[$prefix]['letter-spacing']) ? 'selected="seleted"' : '');?>>Custom</option>
506
  </select>
507
- <input type="number" name="<?php echo $prefix;?>[letter-spacing]" min="1" step="1" <?php echo (!empty($vals[$prefix]['letter-spacing']) ? 'value="'.$vals[$prefix]['letter-spacing'].'"' : '');?> /><span>px</span>
508
  </label>
509
  </td>
510
  </tr>
@@ -517,7 +519,7 @@ function pagelayer_website_font_settings($prefix){
517
  <option value="" <?php echo (empty($vals[$prefix]['word-spacing']) ? 'selected="seleted"' : '');?>>Default</option>
518
  <option value="custom" <?php echo (!empty($vals[$prefix]['word-spacing']) ? 'selected="seleted"' : '');?>>Custom</option>
519
  </select>
520
- <input type="number" name="<?php echo $prefix;?>[word-spacing]" min="1" step="1" <?php echo (!empty($vals[$prefix]['word-spacing']) ? 'value="'.$vals[$prefix]['word-spacing'].'"' : '');?> /><span>px</span>
521
  </label>
522
  </td>
523
  </tr>
33
 
34
  pagelayer_load_font_options();
35
 
36
+ if(!empty($_POST)){
 
37
  check_admin_referer('pagelayer-options');
38
+ }
39
+
40
+ if(isset($_POST['submit'])){
41
 
42
  $font_settings = ['body', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'pagelayer_color' => 'color', 'pagelayer_sidebar' => 'sidebar'];
43
 
279
  <tr>
280
  <th valign="top"><?php echo __('Width');?> : </th>
281
  <td>
282
+ <input type="number" name="sidebar[width]" min="1" step="1" value="<?php echo (!empty($_POST) ? esc_html($_POST['sidebar']['width']) : (!empty($pagelayer->settings['sidebar']['width']) ? esc_html($pagelayer->settings['sidebar']['width']) : '20') );?>" /><span>%</span>
283
  </td>
284
  </tr>
285
  </table>
391
  <tr>
392
  <th scope="row">'.$text.'</th>
393
  <td>
394
+ <a href="#" class="pagelayer-show-vanilla"><div class="pagelayer-color-div pagelayer-color-none"></div><span class="dashicons dashicons-no"></span></a><input type="hidden" name="color['.$field.']" value="'.esc_html($val).'">
395
  </td>
396
  </tr>
397
  </table>';
419
  <select name="<?php echo $prefix;?>[font-family]">
420
  <?php
421
  foreach($pagelayer->fonts as $k => $font){
422
+ echo '<option value="'.esc_html($font).'" '.($vals[$prefix]['font-family'] == $font ? 'selected' : '').'>'. esc_html(empty($font) ? 'Default': $font) .'</option>';
423
  }
424
  ?>
425
  </select>
435
  <option value="" <?php echo (empty($vals[$prefix]['font-size']) ? 'selected="seleted"' : '');?>>Default</option>
436
  <option value="custom" <?php echo (!empty($vals[$prefix]['font-size']) ? 'selected="seleted"' : '');?>>Custom</option>
437
  </select>
438
+ <input type="number" name="<?php echo $prefix;?>[font-size]" <?php echo (!empty($vals[$prefix]['font-size']) ? 'value="'.esc_html($vals[$prefix]['font-size']).'"' : '');?> /><span>px</span>
439
  </label>
440
  </td>
441
  </tr>
447
  <select name="<?php echo $prefix;?>[font-style]">
448
  <?php
449
  foreach($pagelayer->font_style as $k => $var){
450
+ echo '<option value="'.esc_html($k).'" '.($vals[$prefix]['font-style'] == $k ? 'selected' : '').'>'.esc_html($var).'</option>';
451
  }
452
  ?>
453
  </select>
462
  <select name="<?php echo $prefix;?>[font-weight]">
463
  <?php
464
  foreach($pagelayer->font_weight as $k => $var){
465
+ echo '<option value="'.esc_html($k).'" '.($vals[$prefix]['font-weight'] == $k ? 'selected' : '').'>'.esc_html($var).'</option>';
466
  }
467
  ?>
468
  </select>
477
  <select name="<?php echo $prefix;?>[text-transform]">
478
  <?php
479
  foreach($pagelayer->text_transform as $k => $var){
480
+ echo '<option value="'.esc_html($k).'" '.($vals[$prefix]['text-transform'] == $k ? 'selected' : '').'>'.esc_html($var).'</option>';
481
  }
482
  ?>
483
  </select>
493
  <option value="" <?php echo (empty($vals[$prefix]['line-height']) ? 'selected="seleted"' : '');?>>Default</option>
494
  <option value="custom" <?php echo (!empty($vals[$prefix]['line-height']) ? 'selected="seleted"' : '');?>>Custom</option>
495
  </select>
496
+ <input type="number" name="<?php echo $prefix;?>[line-height]" min="0.1" step="0.1" <?php echo (!empty($vals[$prefix]['line-height']) ? 'value="'.esc_html($vals[$prefix]['line-height']).'"' : '');?> />
497
  </label>
498
  </td>
499
  </tr>
506
  <option value="" <?php echo (empty($vals[$prefix]['letter-spacing']) ? 'selected="seleted"' : '');?>>Default</option>
507
  <option value="custom" <?php echo (!empty($vals[$prefix]['letter-spacing']) ? 'selected="seleted"' : '');?>>Custom</option>
508
  </select>
509
+ <input type="number" name="<?php echo $prefix;?>[letter-spacing]" min="1" step="1" <?php echo (!empty($vals[$prefix]['letter-spacing']) ? 'value="'.esc_html($vals[$prefix]['letter-spacing']).'"' : '');?> /><span>px</span>
510
  </label>
511
  </td>
512
  </tr>
519
  <option value="" <?php echo (empty($vals[$prefix]['word-spacing']) ? 'selected="seleted"' : '');?>>Default</option>
520
  <option value="custom" <?php echo (!empty($vals[$prefix]['word-spacing']) ? 'selected="seleted"' : '');?>>Custom</option>
521
  </select>
522
+ <input type="number" name="<?php echo $prefix;?>[word-spacing]" min="1" step="1" <?php echo (!empty($vals[$prefix]['word-spacing']) ? 'value="'.esc_html($vals[$prefix]['word-spacing']).'"' : '');?> /><span>px</span>
523
  </label>
524
  </td>
525
  </tr>
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.3.4
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.3.5
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.5
6
  Requires PHP: 5.5
7
- Stable tag: 1.3.4
8
  License: LGPL v2.1
9
  License URI: http://www.gnu.org/licenses/lgpl-2.1.html
10
 
@@ -109,9 +109,12 @@ Do you have questions related to PageLayer ? Use the following links :
109
 
110
  == Changelog ==
111
 
 
 
 
112
  = 1.3.4 (November 4, 2020) =
113
- * [Added] Added option for the top / bottom position for the contact form success / failed message.
114
- * [Added] Added "Open link in new window (tab)" option to the social widget.
115
  * [Bug-Fix] After submitting the contact form the default success/failed message was not shown if the message was not set from the setting. This is fixed.
116
  * [Bug-Fix] The post content widget was not working properly for the password protected posts. This is fixed.
117
 
4
  Requires at least: 4.7
5
  Tested up to: 5.5
6
  Requires PHP: 5.5
7
+ Stable tag: 1.3.5
8
  License: LGPL v2.1
9
  License URI: http://www.gnu.org/licenses/lgpl-2.1.html
10
 
109
 
110
  == Changelog ==
111
 
112
+ = 1.3.5 (November 9, 2020) =
113
+ * [Security-Fix] In the Pagelayer -> Website Settings, the output was not escaped for certain settings. We would like to thank Ram Gall from the WordFence team for pointing this out. Full disclosure will be available after 48 hours from the release of this version.
114
+
115
  = 1.3.4 (November 4, 2020) =
116
+ * [Improvement] Added option for the top / bottom position for the contact form success / failed message.
117
+ * [Improvement] Added "Open link in new window (tab)" option to the social widget.
118
  * [Bug-Fix] After submitting the contact form the default success/failed message was not shown if the message was not set from the setting. This is fixed.
119
  * [Bug-Fix] The post content widget was not working properly for the password protected posts. This is fixed.
120