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

Version Description

(October 28, 2020) = * [Feature] The post properties in Pagelayer editor has been further improved, now clicking on the setting icon modal will be shown, from where you can setting up post properties. * [Feature] Advanced Custom fields are now supported in the Pagelayer Editors new post properties. * [Feature] The tabs, accordion and collapse widgets have been further improved. Now user can drag widgets inside these widgets. * [Feature] Added single page Import support for PopularFX templates. * [Task] From this version onwards, we are starting to save the post content in block format. * [Bug-Fix] If the Pagelayer editor was not enabled for the post type, the "Edit with pagelayer" link was shown. This is fixed. * [Bug-Fix] If the comment was closed for the post, the comment count in the post info widget was still showing. This is fixed. * [Bug-Fix] In the some cases the link was not rendering properly in th list widget. This is fixed.

Download this release

Release Info

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

Code changes from version 1.3.1 to 1.3.2

css/pagelayer-editor.css CHANGED
@@ -3525,3 +3525,53 @@ cursor:pointer;
3525
  }
3526
 
3527
  /* Editor notice end*/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3525
  }
3526
 
3527
  /* Editor notice end*/
3528
+ /* Pagelayer post setting modal start*/
3529
+ .pagelayer-props-modal{
3530
+ position: fixed;
3531
+ left: 0;
3532
+ top: 0;
3533
+ right: 0;
3534
+ bottom: 0;
3535
+ z-index: 1100;
3536
+ background-color:#2d2d2d8c;
3537
+ display:none;
3538
+ }
3539
+
3540
+ .pagelayer-props-holder{
3541
+ position:relative;
3542
+ height: 100%;
3543
+ overflow: auto;
3544
+ display: flex;
3545
+ justify-content: center;
3546
+ align-items: center;
3547
+ width: 100%;
3548
+ margin:auto;
3549
+ max-height: 967px;
3550
+ }
3551
+
3552
+ .pagelayer-props-wrap{
3553
+ position:relative;
3554
+ height: 90%;
3555
+ width: 90%;
3556
+ margin:auto;
3557
+ overflow: auto;
3558
+ display: flex;
3559
+ justify-content: center;
3560
+ align-items: center;
3561
+ border-radius: 10px
3562
+ }
3563
+
3564
+ .pagelayer-props-wrap .pagelayer-meta-iframe{
3565
+ position: relative;
3566
+ width: 100%;
3567
+ height: 100%;
3568
+ border: 0px;
3569
+ }
3570
+
3571
+ .pagelayer-props-modal-close{
3572
+ position: absolute;
3573
+ top: 20px;
3574
+ right: 25px;
3575
+ z-index: 999;
3576
+ }
3577
+ /* Pagelayer post setting modal end*/
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.1');
9
  define('PAGELAYER_DIR', dirname(PAGELAYER_FILE));
10
  define('PAGELAYER_SLUG', 'pagelayer');
11
  define('PAGELAYER_URL', plugins_url('', PAGELAYER_FILE));
@@ -209,7 +209,10 @@ function pagelayer_admin_menu() {
209
 
210
  // Settings Page
211
  add_submenu_page('pagelayer', __('Pagelayer Editor'), __('Settings'), $capability, 'pagelayer', 'pagelayer_page_handler');
212
-
 
 
 
213
  // UI Settings
214
  add_submenu_page('pagelayer', __('Website Settings'), __('Website Settings'), $capability, 'pagelayer_website_settings', 'pagelayer_website_page');
215
 
@@ -236,12 +239,12 @@ function pagelayer_admin_menu() {
236
 
237
  }
238
 
239
- // Import Page
240
- add_submenu_page('pagelayer', __('Import a Theme and its Templates'), __('Import Theme'), $capability, 'pagelayer_import', 'pagelayer_import_page');
241
-
242
  // License Page
243
  add_submenu_page('pagelayer', __('Pagelayer Editor'), __('License'), $capability, 'pagelayer_license', 'pagelayer_license_page');
244
 
 
 
 
245
  }
246
 
247
  // This function will handle the Settings Pages in PageLayer
@@ -266,6 +269,149 @@ function pagelayer_getting_started(){
266
 
267
  }
268
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
  // This function will handle the Settings Pages in PageLayer
270
  function pagelayer_page_handler(){
271
 
@@ -354,7 +500,7 @@ function pagelayer_enqueue_frontend($force = false){
354
  $is_pagelayer = true;
355
  }
356
 
357
- if(preg_match('/\[pl_audio/is', $v->post_content)){
358
  $is_audio = true;
359
  }
360
  }
@@ -661,6 +807,11 @@ function pagelayer_after_title(){
661
  return;
662
  }
663
 
 
 
 
 
 
664
  $link = pagelayer_shortlink($post->ID).'&pagelayer-live=1';
665
 
666
  echo '
@@ -676,6 +827,11 @@ function pagelayer_gutenberg_after_title(){
676
 
677
  global $post;
678
 
 
 
 
 
 
679
  $link = pagelayer_shortlink($post->ID).'&pagelayer-live=1';
680
 
681
  echo '
@@ -721,7 +877,14 @@ function pagelayer_old_slug_redirect($link){
721
  add_filter( 'post_row_actions', 'pagelayer_quick_link', 10, 2 );
722
  add_filter( 'page_row_actions', 'pagelayer_quick_link', 10, 2 );
723
  function pagelayer_quick_link($actions, $post){
724
- $link = pagelayer_shortlink($post->ID).'&pagelayer-live=1';
 
 
 
 
 
 
 
725
 
726
  $actions['pagelayer'] = '<a href="'.esc_url( $link ).'">'.__( 'Edit using Pagelayer', 'pagelayer') .'</a>';
727
 
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.2');
9
  define('PAGELAYER_DIR', dirname(PAGELAYER_FILE));
10
  define('PAGELAYER_SLUG', 'pagelayer');
11
  define('PAGELAYER_URL', plugins_url('', PAGELAYER_FILE));
209
 
210
  // Settings Page
211
  add_submenu_page('pagelayer', __('Pagelayer Editor'), __('Settings'), $capability, 'pagelayer', 'pagelayer_page_handler');
212
+
213
+ // Meta Settings Page
214
+ add_submenu_page('admin.php', __('Meta Settings'), __('Meta Settings'), 'edit_posts', 'pagelayer_meta_setting', 'pagelayer_meta_handler');
215
+
216
  // UI Settings
217
  add_submenu_page('pagelayer', __('Website Settings'), __('Website Settings'), $capability, 'pagelayer_website_settings', 'pagelayer_website_page');
218
 
239
 
240
  }
241
 
 
 
 
242
  // License Page
243
  add_submenu_page('pagelayer', __('Pagelayer Editor'), __('License'), $capability, 'pagelayer_license', 'pagelayer_license_page');
244
 
245
+ // Import Page
246
+ add_submenu_page('admin.php', __('Import a Theme and its Templates'), __('Import Theme'), $capability, 'pagelayer_import', 'pagelayer_import_page');
247
+
248
  }
249
 
250
  // This function will handle the Settings Pages in PageLayer
269
 
270
  }
271
 
272
+ // This function will handle the post_metas Pages in PageLayer
273
+ function pagelayer_meta_handler(){
274
+
275
+ global $wp_version, $pagelayer;
276
+
277
+ include_once(PAGELAYER_DIR.'/main/post_metas.php');
278
+
279
+ pagelayer_meta_page();
280
+
281
+ }
282
+
283
+ // Pagelayer post meta page view handler
284
+ add_action('admin_head', 'pagelayer_post_meta_page');
285
+ function pagelayer_post_meta_page() {
286
+
287
+ // Set Current screen
288
+ set_current_screen();
289
+ $screen = get_current_screen();
290
+ $meta_id = 'admin_page_pagelayer_meta_setting';
291
+
292
+ if( !is_admin() || trim($screen->id) != $meta_id ) {
293
+ return;
294
+ }
295
+
296
+ if(!isset($_REQUEST['post'])){
297
+ return;
298
+ }
299
+
300
+ // Remove all the notice hooks
301
+ remove_all_actions('admin_notices');
302
+ remove_all_actions('all_admin_notices');
303
+
304
+ $_REQUEST['post'] = (int) $_REQUEST['post'];
305
+ $post = get_post( $_REQUEST['post'] );
306
+
307
+ $meta_box_url = admin_url( 'post.php' );
308
+ $meta_box_url = add_query_arg(
309
+ array(
310
+ 'post' => $post->ID,
311
+ 'action' => 'editpost',
312
+ ),
313
+ $meta_box_url
314
+ );
315
+
316
+ echo '<style>
317
+ .'.$meta_id.' #adminmenumain, .'.$meta_id.' #wpfooter, .'.$meta_id.' #wpadminbar{
318
+ display:none;
319
+ }
320
+ .'.$meta_id.' #wpcontent{
321
+ margin:auto;
322
+ }
323
+ </style>
324
+
325
+ <script type="text/javascript">
326
+
327
+ jQuery(document).ready(function(e){
328
+ pagelayer_prevent_click_metas();
329
+ });
330
+
331
+ // Prevent the click Inside the meta pages
332
+ function pagelayer_prevent_click_metas(){
333
+ jQuery(document).on("submit", function(event){
334
+ event.preventDefault();
335
+ });
336
+
337
+ jQuery(document).on("click", function(event){
338
+ var target = jQuery(event.target);
339
+ if (target.closest("a").length > 0) {
340
+ event.preventDefault();
341
+ var href = target.closest("a").attr("href");
342
+
343
+ if(!href.match(/(http|https):\/\//g)){
344
+ return;
345
+ }
346
+
347
+ var exp = new RegExp("(http|https):\/\/"+window.location.hostname, "g");
348
+
349
+ // Open new window
350
+ if(href.match(exp)){
351
+
352
+ // Reload same window
353
+ window.parent.location.assign(href);
354
+ }else{
355
+ window.open(href, "_blank");
356
+ }
357
+
358
+ }
359
+ });
360
+ }
361
+
362
+ function pagelayer_post_edit(jEle, e){
363
+
364
+ e.preventDefault();
365
+ var formData = new FormData( jQuery(jEle)[0] );
366
+
367
+ jQuery.ajax({
368
+ url: "'.$meta_box_url.'",
369
+ type: "POST",
370
+ data: formData,
371
+ processData: false,
372
+ contentType: false,
373
+ cache:false,
374
+ success:function(result){
375
+ //window.location.reload();
376
+ alert("Post meta has been updated successfully !");
377
+ },
378
+ error:function(result){
379
+ alert("There is an error while updating post meta !");
380
+ }
381
+ });
382
+ }
383
+
384
+ </script>';
385
+
386
+ }
387
+
388
+ // On post Save handler
389
+ add_action('save_post', 'pagelayer_save_post', 10, 3);
390
+ function pagelayer_save_post( $post_id, $post, $update ) {
391
+
392
+ if( !isset($_REQUEST['is_pagelayer_editor']) ){
393
+ return;
394
+ }
395
+
396
+ // Save Header and footer code
397
+ $header_code = !empty($_REQUEST['pagelayer_header_code']) ? $_REQUEST['pagelayer_header_code'] : '' ;
398
+ $footer_code = !empty($_REQUEST['pagelayer_footer_code']) ? $_REQUEST['pagelayer_footer_code'] : '' ;
399
+
400
+ // Set Custom header footer code
401
+ if(!empty($header_code)){
402
+ update_post_meta($post_id, 'pagelayer_header_code', $header_code);
403
+ }else{
404
+ delete_post_meta($post_id, 'pagelayer_header_code');
405
+ }
406
+
407
+ if(!empty($footer_code)){
408
+ update_post_meta($post_id, 'pagelayer_footer_code', $footer_code);
409
+ }else{
410
+ delete_post_meta($post_id, 'pagelayer_footer_code');
411
+ }
412
+
413
+ }
414
+
415
  // This function will handle the Settings Pages in PageLayer
416
  function pagelayer_page_handler(){
417
 
500
  $is_pagelayer = true;
501
  }
502
 
503
+ if(preg_match('/(\[pl_audio|pagelayer\/pl_audio)/is', $v->post_content)){
504
  $is_audio = true;
505
  }
506
  }
807
  return;
808
  }
809
 
810
+ // Is pagelayer supposed to edit this ?
811
+ if(!pagelayer_user_can_edit($post)){
812
+ return;
813
+ }
814
+
815
  $link = pagelayer_shortlink($post->ID).'&pagelayer-live=1';
816
 
817
  echo '
827
 
828
  global $post;
829
 
830
+ // Is pagelayer supposed to edit this ?
831
+ if(!pagelayer_user_can_edit($post)){
832
+ return;
833
+ }
834
+
835
  $link = pagelayer_shortlink($post->ID).'&pagelayer-live=1';
836
 
837
  echo '
877
  add_filter( 'post_row_actions', 'pagelayer_quick_link', 10, 2 );
878
  add_filter( 'page_row_actions', 'pagelayer_quick_link', 10, 2 );
879
  function pagelayer_quick_link($actions, $post){
880
+ global $pagelayer;
881
+
882
+ // Is pagelayer supposed to edit this ?
883
+ if(!pagelayer_user_can_edit($post)){
884
+ return $actions;
885
+ }
886
+
887
+ $link = pagelayer_shortlink($post->ID).'&pagelayer-live=1';
888
 
889
  $actions['pagelayer'] = '<a href="'.esc_url( $link ).'">'.__( 'Edit using Pagelayer', 'pagelayer') .'</a>';
890
 
js/pagelayer-editor.js CHANGED
@@ -550,6 +550,13 @@ function pagelayer_setup_drag(){
550
  // For every other element, we can be over a col or ele
551
  }else{
552
  onWrap = jQuery(ele).closest('.pagelayer-wrap-ele,.pagelayer-wrap-col,.pagelayer-wrap-inner-row');
 
 
 
 
 
 
 
553
  }
554
  //console.log(onWrap);
555
 
@@ -583,14 +590,23 @@ function pagelayer_setup_drag(){
583
  var onEle = pagelayer_ele_by_id(onId);
584
 
585
  // Do we have a parent ?
586
- var pOnId = pagelayer_get_parent(onEle);
587
-
588
- if(pOnId){
 
 
 
 
589
  onId = pOnId;
590
- onEle = pagelayer_ele_by_id(onId);
591
- onWrap = pagelayer_wrap_by_id(onId);
 
 
592
  }
593
 
 
 
 
594
  var changed = false;
595
 
596
  // Was it the same ID like the one we were on before
@@ -1199,6 +1215,13 @@ function pagelayer_element_add_child(pEle, sc){
1199
 
1200
  pagelayer_element_setup('[pagelayer-id='+cid+']', true);
1201
 
 
 
 
 
 
 
 
1202
  // Do we have to create children ?
1203
  if('has_group' in pagelayer_shortcodes[sc]){
1204
 
@@ -3263,14 +3286,6 @@ function pagelayer_save(){
3263
  var pagelayerajaxurl = pagelayer_ajax_url+'&action=pagelayer_save_content&postID='+pagelayer_postID;
3264
  var post = pagelayer_generate_sc(pagelayer_editable);//alert(post);return;
3265
 
3266
- // Do we have page properties ?
3267
- var jEle = jQuery(pagelayer_editable+' [pagelayer-tag=pl_post_props]');
3268
- var props = {};
3269
- if(jEle.length > 0){
3270
- var tmp = pagelayer_data(jEle);
3271
- //console.log(props);
3272
- props = tmp.atts;
3273
- }
3274
 
3275
  // Do we have contact templates ?
3276
  var contacts_props = pagelayer_get_contact_templates();
@@ -3288,7 +3303,6 @@ function pagelayer_save(){
3288
  data: {
3289
  pagelayer_update_content : post,
3290
  pagelayer_nonce: pagelayer_ajax_nonce,
3291
- page_props: props,
3292
  global_widgets: global_data,
3293
  contacts: contacts_props,
3294
  copyright: pagelayer_copyright
@@ -3338,151 +3352,8 @@ function pagelayer_serializeAttributes(attributes) {
3338
  .replace(/\\"/g, "\\u0022");
3339
  }
3340
 
3341
- // Generate Shortcode Post to save
3342
- function pagelayer_generate_sc(selector, selfEle){
3343
-
3344
- selfEle = selfEle || false;
3345
- var txt = '';
3346
-
3347
- var generate_sc_single = function(jEle){
3348
-
3349
- // The ID
3350
- var id = jEle.attr('pagelayer-id');
3351
-
3352
- // If there is an Add element wrapper
3353
- if(pagelayer_empty(id)){
3354
- return;
3355
- }
3356
-
3357
- // Find the type of tag
3358
- var tag = jEle.attr('pagelayer-tag');
3359
- var final_tag = tag;
3360
- var closestEle = jEle.closest('.pagelayer-col-holder');
3361
-
3362
- // Define inner row | Note : Commented as we now have a new widget of type inner_row
3363
- /*if(tag == 'pl_row' && closestEle.length > 0 && closestEle.closest(pagelayer_editable).length > 0){
3364
- final_tag = 'pl_inner_row';
3365
- }*/
3366
-
3367
- if(pagelayer_empty(tag)){
3368
- var err = 'Found an error in the content as the TAG was missing. The console will have more details.';
3369
- alert(err);
3370
- console.log(err);
3371
- console.log(jEle);
3372
- }
3373
-
3374
- // Define inner column
3375
- if(tag == 'pl_col' && closestEle.length > 0 && closestEle.closest(pagelayer_editable).length > 0){
3376
- final_tag = 'pl_inner_col';
3377
- }
3378
- //console.log(tag);
3379
-
3380
- // Is there an innerHTML ele
3381
- var inner = '';
3382
- if('innerHTML' in pagelayer_shortcodes[tag]){
3383
- inner = pagelayer_shortcodes[tag]['innerHTML'];
3384
- }
3385
-
3386
- // Create the tag
3387
- var data = '['+final_tag+' pagelayer-id="'+id+'" ';
3388
-
3389
- // Get the attributes to store
3390
- jQuery.each(jEle[0].attributes, function(i, attrib){
3391
- var res = attrib.name.match(/^pagelayer-a-(.+)/i);
3392
- if(res && res[1] != inner){
3393
- //console.log(attrib.name+' '+res[1]);
3394
- data += ' '+res[1]+'="'+pagelayer_escapeHTML(attrib.value)+'"';
3395
- }
3396
- });
3397
-
3398
- data = data+']';
3399
-
3400
- // Add to the text
3401
- txt = txt+data;
3402
-
3403
- // Any internal function to handle the save ?
3404
- var func = window['pagelayer_tag_'+tag];
3405
- if(typeof func == 'function'){
3406
-
3407
- var content = '';
3408
- content = func(jEle);
3409
-
3410
- if(content.length > 0){
3411
- txt = txt+content;
3412
- }
3413
-
3414
- // If its a Row or Column or Group then it will have children
3415
- }else if(jEle.hasClass('pagelayer-row') || jEle.hasClass('pagelayer-col') || jEle.hasClass('pagelayer-inner_row') || pagelayer_is_group(tag)){
3416
-
3417
- var sel = "[pagelayer-id="+id+"]";
3418
-
3419
- // Any holder which holds children ?
3420
- if('holder' in pagelayer_shortcodes[tag]){
3421
- sel = sel+' '+pagelayer_shortcodes[tag]['holder'];
3422
- }
3423
-
3424
- // Select the top-most element
3425
- sel = jQuery(sel).first();
3426
-
3427
- // Any child selector - Majorly for owl carousel
3428
- // NOTE : Child selector should be very specific with immediate child selection at all levels
3429
- var child_selector = false;
3430
- if('child_selector' in pagelayer_shortcodes[tag]){
3431
- sel = sel.find(pagelayer_shortcodes[tag]['child_selector']);
3432
- }
3433
-
3434
- var childrens = pagelayer_generate_sc(sel);
3435
- if(childrens.length > 0){
3436
- txt = txt+childrens;
3437
- }
3438
-
3439
- // Its a normal element so we might need to handle the content
3440
- }else{
3441
-
3442
- var content = '';
3443
- if(inner.length > 0){
3444
- content = jEle.attr('pagelayer-a-'+inner);
3445
- if(!content){
3446
- content = '';
3447
- }
3448
- }else{
3449
- content = '';//jEle.html();
3450
- }
3451
-
3452
- if(content.length > 0){
3453
- txt = txt+content;
3454
- }
3455
-
3456
- }
3457
-
3458
- // Close the tag
3459
- txt = txt+"[/"+final_tag+"]\n";
3460
-
3461
- };
3462
-
3463
- // Are you an element for which to generate the codes ?
3464
- if(jQuery(selector).hasClass('pagelayer-ele') && selfEle){
3465
-
3466
- generate_sc_single(jQuery(selector));
3467
-
3468
- // The selector is the holder, so loop thru
3469
- }else{
3470
-
3471
- jQuery(selector).children(".pagelayer-ele-wrap").each(function(){
3472
-
3473
- var jEle = jQuery(this).children('.pagelayer-ele');
3474
- generate_sc_single(jEle);
3475
-
3476
- });
3477
-
3478
- }
3479
-
3480
- return txt;
3481
-
3482
- };
3483
-
3484
  // Generate blocks Post to save
3485
- function pagelayer_generate_sc_new(selector, selfEle){
3486
 
3487
  selfEle = selfEle || false;
3488
  var txt = '';
@@ -3568,8 +3439,13 @@ function pagelayer_generate_sc_new(selector, selfEle){
3568
  if('child_selector' in pagelayer_shortcodes[tag]){
3569
  sel = sel.find(pagelayer_shortcodes[tag]['child_selector']);
3570
  }
3571
-
3572
- content = pagelayer_generate_sc(sel);
 
 
 
 
 
3573
 
3574
  // Its a normal element so we might need to handle the content
3575
  }else{
@@ -3588,7 +3464,7 @@ function pagelayer_generate_sc_new(selector, selfEle){
3588
  if (pagelayer_empty(content)) {
3589
  txt += "<!-- ".concat(pagelayer_block_prefix, ":pagelayer/").concat(final_tag, " ").concat(data, " /-->\n");
3590
  }else{
3591
- txt += "<!-- ".concat(pagelayer_block_prefix, ":pagelayer/").concat(final_tag, " ").concat(data, " -->\n") + content + "\n<!-- /".concat(pagelayer_block_prefix, ":pagelayer/").concat(final_tag, " -->\n");
3592
  }
3593
 
3594
  };
@@ -3614,61 +3490,6 @@ function pagelayer_generate_sc_new(selector, selfEle){
3614
 
3615
  };
3616
 
3617
- // Escape charaters in attributes
3618
- var pagelayer_escapeChars = {
3619
- '\\]' : '#93',
3620
- '\\[' : '#91',
3621
- //'=' : '#61',
3622
- '<' : 'lt',
3623
- '>' : 'gt',
3624
- '"' : 'quot',
3625
- //'&' : 'amp',
3626
- '\'' : '#39',
3627
- '\\\\' : '#92'
3628
- };
3629
-
3630
- // To unescape
3631
- var pagelayer_unescapeChars = {
3632
- '#93' : ']',
3633
- '#91' : '[',
3634
- //'#61' : '=',
3635
- 'lt' : '<',
3636
- 'gt' : '>',
3637
- 'quot' : '"',
3638
- //'amp' : '&',
3639
- '#39' : '\'',
3640
- '#92' : '\\'
3641
- };
3642
-
3643
- var pagelayer_escaperegex_S = '[';
3644
- for(var key in pagelayer_escapeChars) {
3645
- pagelayer_escaperegex_S += key;
3646
- }
3647
- pagelayer_escaperegex_S += ']';
3648
-
3649
- var pagelayer_escaperegex = new RegExp( pagelayer_escaperegex_S, 'g');
3650
-
3651
- // The function which escapes everything
3652
- function pagelayer_escapeHTML(str) {
3653
- return str.replace(pagelayer_escaperegex, function(m) {
3654
- if(m == '[' || m == ']') m = '\\'+m;
3655
- if(m == '\\') m = '\\\\';
3656
-
3657
- return '&' + pagelayer_escapeChars[m] + ';';
3658
- });
3659
- };
3660
-
3661
- // This will unescape everything
3662
- function pagelayer_unescapeHTML(str){
3663
- return str.replace(/\&([^;]+);/g, function (entity, entityCode) {
3664
- if(entityCode in pagelayer_unescapeChars){
3665
- return pagelayer_unescapeChars[entityCode];
3666
- }else{
3667
- return entity;
3668
- }
3669
- });
3670
- };
3671
-
3672
  // Show the required leftbar tab
3673
  function pagelayer_leftbar_tab(tab){
3674
  pagelayer.$$('.pagelayer-leftbar-tab').hide();
@@ -3803,10 +3624,43 @@ function pagelayer_leftbar(){
3803
  pagelayer_active = {};
3804
 
3805
  var pl_tag = jQuery(this).attr('pagelayer-tag') || 'pl_post_props';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3806
  pagelayer_post_settings(pl_tag);
 
3807
  });
3808
 
3809
- // On click Pagelayer setting icon
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3810
  var global_widget_list = function(){
3811
 
3812
  var gHtml = '';
550
  // For every other element, we can be over a col or ele
551
  }else{
552
  onWrap = jQuery(ele).closest('.pagelayer-wrap-ele,.pagelayer-wrap-col,.pagelayer-wrap-inner-row');
553
+
554
+ // If we are inside the same widget tag
555
+ // We are allowing for now, hence the following is commented
556
+ /*var sameTag = onWrap.closest(pagelayer_editable +' [pagelayer-tag="'+tag+'"]');
557
+ if(sameTag.length > 0){
558
+ onWrap = sameTag.closest('.pagelayer-wrap-ele');
559
+ }*/
560
  }
561
  //console.log(onWrap);
562
 
590
  var onEle = pagelayer_ele_by_id(onId);
591
 
592
  // Do we have a parent ?
593
+ var have_parent = function(Ele){
594
+ var pOnId = pagelayer_get_parent(Ele);
595
+
596
+ if(pagelayer_empty(pOnId) || tag == 'pl_col'){
597
+ return;
598
+ }
599
+
600
  onId = pOnId;
601
+ onEle = pagelayer_ele_by_id(pOnId);
602
+ onWrap = pagelayer_wrap_by_id(pOnId);
603
+ have_parent(onEle);
604
+
605
  }
606
 
607
+ // Do we have a parent ?
608
+ have_parent(onEle);
609
+
610
  var changed = false;
611
 
612
  // Was it the same ID like the one we were on before
1215
 
1216
  pagelayer_element_setup('[pagelayer-id='+cid+']', true);
1217
 
1218
+ // Certain element have editable areas which are inner rows. For UX we need to add columns for the users
1219
+ if(sc == 'pl_inner_row'){
1220
+ var col = jQuery('<div pagelayer-tag="pl_col"></div>');
1221
+ jQuery('[pagelayer-id="'+id+'"]').find('.pagelayer-row-holder').append(col);
1222
+ cid = pagelayer_onadd(col, false);
1223
+ }
1224
+
1225
  // Do we have to create children ?
1226
  if('has_group' in pagelayer_shortcodes[sc]){
1227
 
3286
  var pagelayerajaxurl = pagelayer_ajax_url+'&action=pagelayer_save_content&postID='+pagelayer_postID;
3287
  var post = pagelayer_generate_sc(pagelayer_editable);//alert(post);return;
3288
 
 
 
 
 
 
 
 
 
3289
 
3290
  // Do we have contact templates ?
3291
  var contacts_props = pagelayer_get_contact_templates();
3303
  data: {
3304
  pagelayer_update_content : post,
3305
  pagelayer_nonce: pagelayer_ajax_nonce,
 
3306
  global_widgets: global_data,
3307
  contacts: contacts_props,
3308
  copyright: pagelayer_copyright
3352
  .replace(/\\"/g, "\\u0022");
3353
  }
3354
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3355
  // Generate blocks Post to save
3356
+ function pagelayer_generate_sc(selector, selfEle){
3357
 
3358
  selfEle = selfEle || false;
3359
  var txt = '';
3439
  if('child_selector' in pagelayer_shortcodes[tag]){
3440
  sel = sel.find(pagelayer_shortcodes[tag]['child_selector']);
3441
  }
3442
+
3443
+ if(jQuery(sel).children(".pagelayer-ele-wrap").length < 1){
3444
+ content = jQuery(sel).html(); // Backward Compatibility
3445
+ }else{
3446
+ content = pagelayer_generate_sc(sel);
3447
+ content = "\n"+content;
3448
+ }
3449
 
3450
  // Its a normal element so we might need to handle the content
3451
  }else{
3464
  if (pagelayer_empty(content)) {
3465
  txt += "<!-- ".concat(pagelayer_block_prefix, ":pagelayer/").concat(final_tag, " ").concat(data, " /-->\n");
3466
  }else{
3467
+ txt += "<!-- ".concat(pagelayer_block_prefix, ":pagelayer/").concat(final_tag, " ").concat(data, " -->").concat(content, "<!-- /").concat(pagelayer_block_prefix, ":pagelayer/").concat(final_tag, " -->\n");
3468
  }
3469
 
3470
  };
3490
 
3491
  };
3492
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3493
  // Show the required leftbar tab
3494
  function pagelayer_leftbar_tab(tab){
3495
  pagelayer.$$('.pagelayer-leftbar-tab').hide();
3624
  pagelayer_active = {};
3625
 
3626
  var pl_tag = jQuery(this).attr('pagelayer-tag') || 'pl_post_props';
3627
+ var nModal = jQuery(this).attr('pagelayer-modal-none');
3628
+
3629
+ if(pl_tag == 'pl_post_props' && pagelayer_empty(nModal) ){
3630
+
3631
+ var propsModal = pagelayer.$$('.pagelayer-props-modal');
3632
+
3633
+ if(propsModal.find('.pagelayer-meta-iframe').length < 1){
3634
+ propsModal.find('.pagelayer-props-wrap').append('<iframe class="pagelayer-meta-iframe" src="'+ pagelayer_post_props +'"></iframe>');
3635
+ }
3636
+
3637
+ propsModal.show();
3638
+ pagelayer.$$('.pagelayer-meta-iframe').contents().find('.pagelayer-tab-items[data-tab="post_props"]').click();
3639
+ return;
3640
+ }
3641
+
3642
  pagelayer_post_settings(pl_tag);
3643
+
3644
  });
3645
 
3646
+ // Pagelayer post advance setting modal handler
3647
+ var propsModal = pagelayer.$$('.pagelayer-props-modal');
3648
+ propsModal.find('.pagelayer-pros-modal-close').on('click', function(event){
3649
+ propsModal.hide();
3650
+ });
3651
+
3652
+ propsModal.on('click', function(event){
3653
+ var target = jQuery(event.target);
3654
+
3655
+ if(target.closest('.pagelayer-props-modal-wrap').length > 0){
3656
+ return;
3657
+ }
3658
+
3659
+ propsModal.hide();
3660
+ });
3661
+
3662
+
3663
+ // On click Pagelayer setting icon
3664
  var global_widget_list = function(){
3665
 
3666
  var gHtml = '';
js/properties.js CHANGED
@@ -243,6 +243,7 @@ function pagelayer_elpd_open(jEle){
243
  //pagelayer_elpd.css('left', pagelayer_elpd_pos[0]);
244
  //pagelayer_elpd.css('top', pagelayer_elpd_pos[1]);
245
  pagelayer_leftbar_tab('pagelayer-elpd');
 
246
  pagelayer.$$('.pagelayer-elpd-header').show();
247
  pagelayer.$$('.pagelayer-logo').hide();
248
 
@@ -2446,11 +2447,18 @@ function pagelayer_elp_spinner(row, prop){
2446
  // The Group Property
2447
  function pagelayer_elp_group(row, prop){
2448
 
 
 
 
 
 
 
 
2449
  // Remove the pagelayer-show-tab
2450
  row.removeAttr('pagelayer-show-tab');
2451
 
2452
  var div = '<div class="pagelayer-elp-group-div"></div>'+
2453
- '<center><button class="pagelayer-elp-button">'+prop['text']+'</button></center>';
2454
 
2455
  row.append(div);
2456
 
@@ -2502,8 +2510,8 @@ function pagelayer_elp_group(row, prop){
2502
  '<div class="pagelayer-elp-group-item-head">'+
2503
  '<span class="pagelayer-elp-group-item-drag"><i class="pli pli-menu" /></span>'+
2504
  '<span class="pagelayer-elp-group-item-title">'+title+'</span>'+
2505
- '<span class="pagelayer-elp-group-item-clone"><i class="pli pli-clone" /></span>'+
2506
- '<span class="pagelayer-elp-group-item-del"><i class="pli pli-trashcan" /></span>'+
2507
  '</div>'+
2508
  '<div class="pagelayer-elp-group-item-body"></div>'+
2509
  '</div>');
243
  //pagelayer_elpd.css('left', pagelayer_elpd_pos[0]);
244
  //pagelayer_elpd.css('top', pagelayer_elpd_pos[1]);
245
  pagelayer_leftbar_tab('pagelayer-elpd');
246
+ pagelayer.$$('.pagelayer-elpd-tabs').show();
247
  pagelayer.$$('.pagelayer-elpd-header').show();
248
  pagelayer.$$('.pagelayer-logo').hide();
249
 
2447
  // The Group Property
2448
  function pagelayer_elp_group(row, prop){
2449
 
2450
+ var btnHidden = '';
2451
+
2452
+ // Hide button, clone and delete
2453
+ if(!pagelayer_empty(prop['hide'])){
2454
+ btnHidden = 'pagelayer-hidden';
2455
+ }
2456
+
2457
  // Remove the pagelayer-show-tab
2458
  row.removeAttr('pagelayer-show-tab');
2459
 
2460
  var div = '<div class="pagelayer-elp-group-div"></div>'+
2461
+ '<center><button class="pagelayer-elp-button '+btnHidden+'">'+prop['text']+'</button></center>';
2462
 
2463
  row.append(div);
2464
 
2510
  '<div class="pagelayer-elp-group-item-head">'+
2511
  '<span class="pagelayer-elp-group-item-drag"><i class="pli pli-menu" /></span>'+
2512
  '<span class="pagelayer-elp-group-item-title">'+title+'</span>'+
2513
+ '<span class="pagelayer-elp-group-item-clone '+btnHidden+'"><i class="pli pli-clone" /></span>'+
2514
+ '<span class="pagelayer-elp-group-item-del '+btnHidden+'"><i class="pli pli-trashcan" /></span>'+
2515
  '</div>'+
2516
  '<div class="pagelayer-elp-group-item-body"></div>'+
2517
  '</div>');
js/widgets.js CHANGED
@@ -911,7 +911,9 @@ var pagelayer_post_info_timer = {};
911
 
912
  // Render the Post info list
913
  function pagelayer_render_pl_post_info_list(el){
914
-
 
 
915
  // Clear any previous timeout
916
  clearTimeout(pagelayer_post_info_timer[el.id]);
917
 
@@ -929,6 +931,13 @@ function pagelayer_render_pl_post_info_list(el){
929
  success: function(response){
930
  var obj = jQuery.parseJSON(response);
931
  //console.log(obj);el['atts'] = obj;
 
 
 
 
 
 
 
932
  el.$.find('.pagelayer-post-info-label').html(obj['post_info_content']);
933
  el.$.find('.pagelayer-post-info-icon img').attr('src', obj['avatar_url']);
934
  el.$.find('.pagelayer-post-info-list-container > a').attr('href', obj['link']);
@@ -939,6 +948,11 @@ function pagelayer_render_pl_post_info_list(el){
939
 
940
  }
941
 
 
 
 
 
 
942
  // Render the contact form
943
  function pagelayer_render_pl_contact(el){
944
 
911
 
912
  // Render the Post info list
913
  function pagelayer_render_pl_post_info_list(el){
914
+
915
+ el.atts['post_info_content'] = 1;
916
+
917
  // Clear any previous timeout
918
  clearTimeout(pagelayer_post_info_timer[el.id]);
919
 
931
  success: function(response){
932
  var obj = jQuery.parseJSON(response);
933
  //console.log(obj);el['atts'] = obj;
934
+
935
+ if( pagelayer_empty(obj['post_info_content']) ){
936
+ el.$.find('.pagelayer-post-info-list-container').remove();
937
+ return;
938
+ }
939
+
940
+ el.$.find('.pagelayer-post-info-list-container').show();
941
  el.$.find('.pagelayer-post-info-label').html(obj['post_info_content']);
942
  el.$.find('.pagelayer-post-info-icon img').attr('src', obj['avatar_url']);
943
  el.$.find('.pagelayer-post-info-list-container > a').attr('href', obj['link']);
948
 
949
  }
950
 
951
+ // Render the Post info list
952
+ function pagelayer_render_html_pl_post_info_list(el){
953
+ el.$.find('.pagelayer-post-info-list-container').hide();
954
+ }
955
+
956
  // Render the contact form
957
  function pagelayer_render_pl_contact(el){
958
 
main/ajax.php CHANGED
@@ -175,56 +175,6 @@ function pagelayer_save_content(){
175
  pagelayer_json_output($msg);
176
  }
177
 
178
- // Any properties ?
179
- if(!empty($_REQUEST['page_props'])){
180
-
181
- $allowed = ['post_title', 'post_name', 'post_excerpt', 'post_status'];
182
-
183
- foreach($allowed as $k){
184
- if(!empty($_REQUEST['page_props'][$k])){
185
- $post[$k] = $_REQUEST['page_props'][$k];
186
- }
187
- }
188
-
189
- if(!empty($post['post_status']) && $post['post_status'] == 'publish'){
190
-
191
- // Allowed to publish pages ?
192
- if($_post->post_type == 'page' && !current_user_can('publish_pages')){
193
- $msg['error'][] = __pl('no_publish_permission');
194
- pagelayer_json_output($msg);
195
- }
196
-
197
- // Allowed to publish posts ?
198
- if($_post->post_type == 'post' && !current_user_can('publish_posts')){
199
- $post['post_status'] = 'pending';
200
- }
201
- }
202
-
203
- $_REQUEST['page_props']['featured_image'] = (int) $_REQUEST['page_props']['featured_image'];
204
- if(!empty($_REQUEST['page_props']['featured_image'])){
205
- set_post_thumbnail($postID, $_REQUEST['page_props']['featured_image']);
206
- }else{
207
- delete_post_thumbnail($postID);
208
- }
209
-
210
- $header_code = !empty($_REQUEST['page_props']['header_code']) ? $_REQUEST['page_props']['header_code'] : '' ;
211
- $footer_code = !empty($_REQUEST['page_props']['footer_code']) ? $_REQUEST['page_props']['footer_code'] : '' ;
212
-
213
- // Set Custom header footer code
214
- if(!empty($header_code)){
215
- update_post_meta($postID, 'pagelayer_header_code', $header_code);
216
- }else{
217
- delete_post_meta($postID, 'pagelayer_header_code');
218
- }
219
-
220
- if(!empty($footer_code)){
221
- update_post_meta($postID, 'pagelayer_footer_code', $footer_code);
222
- }else{
223
- delete_post_meta($postID, 'pagelayer_footer_code');
224
- }
225
-
226
- }
227
-
228
  // Any contact templates ?
229
  if(!empty($_REQUEST['contacts'])){
230
  update_post_meta($postID, 'pagelayer_contact_templates', $_REQUEST['contacts']);
175
  pagelayer_json_output($msg);
176
  }
177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  // Any contact templates ?
179
  if(!empty($_REQUEST['contacts'])){
180
  update_post_meta($postID, 'pagelayer_contact_templates', $_REQUEST['contacts']);
main/functions.php CHANGED
@@ -1603,7 +1603,8 @@ function pagelayer_posts($params, $args = []){
1603
  }
1604
 
1605
  }
1606
- if(!empty($params['comments'])){
 
1607
  $data .= '<span class="pagelayer-wposts-comments"><a href="' . esc_url( get_permalink() ) . '">' . esc_html(get_comments_number()).' '.__pl('comments').'</a></span>'.$sep;
1608
  }
1609
 
@@ -2038,7 +2039,7 @@ function pagelayer_insert_content($post, &$ret){
2038
  $post['post_content'] = str_replace($key, $val, $post['post_content']);
2039
  }
2040
 
2041
- if(defined(PAGELAYER_BLOCK_PREFIX) && PAGELAYER_BLOCK_PREFIX == 'wp'){
2042
  $post['post_content'] = str_replace('<!-- sp:pagelayer', '<!-- wp:pagelayer', $post['post_content']);
2043
  $post['post_content'] = str_replace('<!-- /sp:pagelayer', '<!-- /wp:pagelayer', $post['post_content']);
2044
  }
1603
  }
1604
 
1605
  }
1606
+
1607
+ if(!empty($params['comments']) && comments_open($postsquery->ID)){
1608
  $data .= '<span class="pagelayer-wposts-comments"><a href="' . esc_url( get_permalink() ) . '">' . esc_html(get_comments_number()).' '.__pl('comments').'</a></span>'.$sep;
1609
  }
1610
 
2039
  $post['post_content'] = str_replace($key, $val, $post['post_content']);
2040
  }
2041
 
2042
+ if(defined('PAGELAYER_BLOCK_PREFIX') && PAGELAYER_BLOCK_PREFIX == 'wp'){
2043
  $post['post_content'] = str_replace('<!-- sp:pagelayer', '<!-- wp:pagelayer', $post['post_content']);
2044
  $post['post_content'] = str_replace('<!-- /sp:pagelayer', '<!-- /wp:pagelayer', $post['post_content']);
2045
  }
main/import.php CHANGED
@@ -295,6 +295,105 @@ pagelayer_page_footer(1);
295
 
296
  }
297
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
  // The actual function to import the theme
299
  function pagelayer_import_theme($template_name, $pagelayer_theme_path = ''){
300
 
@@ -353,7 +452,21 @@ global $pagelayer, $pl_error;
353
  }
354
 
355
  // Create the menu
356
- $menu_id = pagelayer_create_header_menu($template_name);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
 
358
  // Check the theme files
359
  foreach($pgl as $k => $v){
@@ -387,13 +500,21 @@ global $pagelayer, $pl_error;
387
  $new_post['post_status'] = 'publish';
388
  $new_post['comment_status'] = 'closed';
389
  $new_post['ping_status'] = 'closed';
390
- //r_print($new_post);die();
391
 
392
  // Lets replace the menu we created
393
  if(!is_wp_error($menu_id)){
394
  $new_post['post_content'] = preg_replace('/\[pl_wp_menu ([^\]]*)nav_list="(\d*)"([^\]]*)\]/is', '[pl_wp_menu ${1}nav_list="'.$menu_id.'"${3}]', $new_post['post_content']);
 
 
 
 
 
 
395
  }
396
 
 
 
397
  // Now insert / update the post
398
  $ret = pagelayer_insert_content($new_post, $err);
399
  $post_id = $ret;
@@ -488,6 +609,11 @@ global $pagelayer, $pl_error;
488
  // Lets replace the menu we created
489
  if(!is_wp_error($menu_id)){
490
  $new_post['post_content'] = preg_replace('/\[pl_wp_menu ([^\]]*)nav_list="(\d*)"([^\]]*)\]/is', '[pl_wp_menu ${1}nav_list="'.$menu_id.'"${3}]', $new_post['post_content']);
 
 
 
 
 
491
  }
492
 
493
  // Now insert / update the post
@@ -572,7 +698,9 @@ global $pagelayer, $pl_error;
572
  }
573
 
574
  // Update the menu
575
- pagelayer_update_header_menu($menu_id, $pages_id_map);
 
 
576
 
577
  return true;
578
 
@@ -656,4 +784,9 @@ function pagelayer_update_header_menu($menu_id, $pages){
656
  $options['auto_add'][] = $menu_id;
657
  update_option('nav_menu_options', $options);
658
 
659
- }
 
 
 
 
 
295
 
296
  }
297
 
298
+ // The actual function to import the theme
299
+ function pagelayer_import_single($template_name, $items, $pagelayer_theme_path = ''){
300
+
301
+ global $wpdb, $wp_rewrite;
302
+ global $pagelayer, $pl_error;
303
+
304
+ if(empty($pagelayer_theme_path)){
305
+ $pagelayer_theme_path = get_stylesheet_directory();
306
+ }
307
+
308
+ if(empty($items)){
309
+ $pl_error[] = 'Items were not submitted';
310
+ return false;
311
+ }
312
+
313
+ /////////////////////////
314
+ // Handle the PAGES Data
315
+ /////////////////////////
316
+
317
+ // Load the new themes pages array
318
+ $data = file_get_contents($pagelayer_theme_path.'/pagelayer-data.conf');
319
+ $data = @json_decode($data, true);
320
+ //r_print($data);die();
321
+
322
+ if(empty($data['page'])){
323
+ $pl_error[] = 'Pages list not found. This is not a proper template !';
324
+ return false;
325
+ }
326
+
327
+ // Check the theme files
328
+ foreach($data['page'] as $k => $v){
329
+
330
+ $path = pagelayer_cleanpath($pagelayer_theme_path.'/data/page/'.$k);
331
+
332
+ // Does it have the title and slug ?
333
+ if(empty($v['post_title']) || empty($v['post_name'])){
334
+ $pl_error[] = 'Something is fishy with this theme as there is no title or slug for '.$k;
335
+ return false;
336
+ }
337
+
338
+ // Does the page exist ?
339
+ if(!file_exists($path) || pagelayer_cleanpath(realpath($path)) != $path){
340
+ $pl_error[] = 'Something is fishy with this theme';
341
+ return false;
342
+ }
343
+
344
+ }
345
+
346
+ $status = empty($_POST['save_as_draft']) ? 'publish' : 'draft';
347
+
348
+ // Now check the pages if it exist in this installation ?
349
+ foreach($data['page'] as $k => $v){
350
+
351
+ if(!in_array($k, $items['page'])){
352
+ continue;
353
+ }
354
+
355
+ $path = pagelayer_cleanpath($pagelayer_theme_path.'/data/page/'.$k);
356
+
357
+ // Is the page there ?
358
+ $page = get_page_by_path($v['post_name']);
359
+ //r_print($page);
360
+
361
+ $new_post = array();
362
+
363
+ // It does exist so save the revision IF its the header and footer
364
+ if(!empty($page) && isset($_POST['overwrite'])){
365
+
366
+ $rev = wp_save_post_revision($page->ID);
367
+
368
+ $new_post['ID'] = $page->ID;
369
+
370
+ }
371
+
372
+ // Make an array
373
+ $new_post['post_content'] = file_get_contents($path);
374
+ $new_post['post_title'] = $v['post_title'];
375
+ $new_post['post_name'] = $v['post_name'];
376
+ $new_post['post_type'] = 'page';
377
+ $new_post['post_status'] = $status;
378
+ //r_print($new_post);die();
379
+
380
+ // Now insert / update the post
381
+ $ret = pagelayer_insert_content($new_post, $err);
382
+
383
+ // Did we save the post ?
384
+ if(empty($ret)){
385
+ $pl_error[] = 'Could not update the page '.$v['post_name'];
386
+ return false;
387
+ }
388
+
389
+ update_post_meta($ret, 'pagelayer_imported_content', $template_name);
390
+
391
+ }
392
+
393
+ return true;
394
+
395
+ }
396
+
397
  // The actual function to import the theme
398
  function pagelayer_import_theme($template_name, $pagelayer_theme_path = ''){
399
 
452
  }
453
 
454
  // Create the menu
455
+ if(empty($_POST['no_header_menu'])){
456
+ $menu_id = pagelayer_create_header_menu($template_name);
457
+ }else{
458
+
459
+ // Get the first menu that has items if we still can't find a menu.
460
+ $menus = wp_get_nav_menus();
461
+ foreach ( $menus as $menu_maybe ) {
462
+ $menu_items = wp_get_nav_menu_items( $menu_maybe->term_id, array( 'update_post_term_cache' => false ) );
463
+ if ( $menu_items ) {
464
+ $menu_id = $menu_maybe->term_id;
465
+ break;
466
+ }
467
+ }
468
+
469
+ }
470
 
471
  // Check the theme files
472
  foreach($pgl as $k => $v){
500
  $new_post['post_status'] = 'publish';
501
  $new_post['comment_status'] = 'closed';
502
  $new_post['ping_status'] = 'closed';
503
+ //pagelayer_print($new_post);die();
504
 
505
  // Lets replace the menu we created
506
  if(!is_wp_error($menu_id)){
507
  $new_post['post_content'] = preg_replace('/\[pl_wp_menu ([^\]]*)nav_list="(\d*)"([^\]]*)\]/is', '[pl_wp_menu ${1}nav_list="'.$menu_id.'"${3}]', $new_post['post_content']);
508
+
509
+ $GLOBALS['pagelayer_import_menu_id'] = $menu_id;
510
+
511
+ // Also for block format
512
+ $new_post['post_content'] = preg_replace_callback('/<!--\s+(?P<closer>\/)?sp:pagelayer\/pl_wp_menu\s+(?P<attrs>{(?:(?:[^}]+|}+(?=})|(?!}\s+\/?-->).)*+)?}\s+)?(?P<void>\/)?-->/s', 'pagelayer_handle_wp_menu', $new_post['post_content']);
513
+
514
  }
515
 
516
+ //pagelayer_print($new_post);die();
517
+
518
  // Now insert / update the post
519
  $ret = pagelayer_insert_content($new_post, $err);
520
  $post_id = $ret;
609
  // Lets replace the menu we created
610
  if(!is_wp_error($menu_id)){
611
  $new_post['post_content'] = preg_replace('/\[pl_wp_menu ([^\]]*)nav_list="(\d*)"([^\]]*)\]/is', '[pl_wp_menu ${1}nav_list="'.$menu_id.'"${3}]', $new_post['post_content']);
612
+
613
+ $GLOBALS['pagelayer_import_menu_id'] = $menu_id;
614
+
615
+ // Also for block format
616
+ $new_post['post_content'] = preg_replace_callback('/<!--\s+(?P<closer>\/)?sp:pagelayer\/pl_wp_menu\s+(?P<attrs>{(?:(?:[^}]+|}+(?=})|(?!}\s+\/?-->).)*+)?}\s+)?(?P<void>\/)?-->/s', 'pagelayer_handle_wp_menu', $new_post['post_content']);
617
  }
618
 
619
  // Now insert / update the post
698
  }
699
 
700
  // Update the menu
701
+ if(empty($_POST['no_header_menu'])){
702
+ pagelayer_update_header_menu($menu_id, $pages_id_map);
703
+ }
704
 
705
  return true;
706
 
784
  $options['auto_add'][] = $menu_id;
785
  update_option('nav_menu_options', $options);
786
 
787
+ }
788
+
789
+ // Callback for menu replacement
790
+ function pagelayer_handle_wp_menu($matches){
791
+ return preg_replace('/nav_list"\s*:\s*"(\d*)"/is', 'nav_list":"'.$GLOBALS['pagelayer_import_menu_id'].'"', $matches[0]);
792
+ }
main/live-body.php CHANGED
@@ -149,7 +149,13 @@ echo '
149
  pagelayer_show_pro_div('Premium Feature<span class="pli pli-cross pagelayer-pro-x"></span>', '', 0);
150
  echo '</div>
151
  <div class="pagelayer-editor-notice"></div>
152
-
 
 
 
 
 
 
153
  <script>
154
  var pagelayer_iframe_cw = document.getElementById("pagelayer-iframe").contentWindow;
155
 
149
  pagelayer_show_pro_div('Premium Feature<span class="pli pli-cross pagelayer-pro-x"></span>', '', 0);
150
  echo '</div>
151
  <div class="pagelayer-editor-notice"></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>
158
+ </div>
159
  <script>
160
  var pagelayer_iframe_cw = document.getElementById("pagelayer-iframe").contentWindow;
161
 
main/live.php CHANGED
@@ -124,6 +124,7 @@ pagelayer_pro_url = "'.PAGELAYER_PRO_URL.'";
124
  pagelayer_pro_txt = "'.addslashes('This feature is a part of <a href="'.$pro_url.'" target="_blank">'.$pro_txt.'</a>. You will need purchase <a href="'.$pro_url.'" target="_blank">'.$pro_txt.'</a> to use this feature.').'";
125
  pagelayer_api_url = "'.PAGELAYER_API.'";
126
  pagelayer_ajax_url = "'.admin_url( 'admin-ajax.php' ).'?&";
 
127
  pagelayer_ajax_nonce = "'.wp_create_nonce('pagelayer_ajax').'";
128
  pagelayer_media_ajax_nonce = "'.wp_create_nonce('media-form').'";
129
  pagelayer_internal_linking_nonce = "'.wp_create_nonce('internal-linking').'";
@@ -144,9 +145,6 @@ pagelayer_recaptch_site_key = "'.(!empty($pagelayer_recaptch_site_key) ? $pagela
144
  pagelayer_post = '. @json_encode($_post) .';
145
  pagelayer_loaded_icons = '.json_encode(pagelayer_enabled_icons()).';
146
  pagelayer_social_urls = '.json_encode(pagelayer_get_social_urls()).';
147
- pagelayer_shortcodes.pl_post_props.params.post_title.default = "'.pagelayer_escapeHTML($post->post_title).'";
148
- pagelayer_shortcodes.pl_post_props.params.post_name.default = "'.pagelayer_escapeHTML($post->post_name).'";
149
- pagelayer_shortcodes.pl_post_props.params.post_status.default = "'.$_post->post_status.'";
150
  pagelayer_global_widgets = '.json_encode($pagelayer->global_widgets).';
151
  pagelayer_saved_sections = '.json_encode($pagelayer->saved_sections).';
152
  pagelayer_global_sections = '.json_encode($pagelayer->global_sections).';';
124
  pagelayer_pro_txt = "'.addslashes('This feature is a part of <a href="'.$pro_url.'" target="_blank">'.$pro_txt.'</a>. You will need purchase <a href="'.$pro_url.'" target="_blank">'.$pro_txt.'</a> to use this feature.').'";
125
  pagelayer_api_url = "'.PAGELAYER_API.'";
126
  pagelayer_ajax_url = "'.admin_url( 'admin-ajax.php' ).'?&";
127
+ pagelayer_post_props = "'.admin_url( 'admin.php?page=pagelayer_meta_setting&post=' ).$post->ID.'";
128
  pagelayer_ajax_nonce = "'.wp_create_nonce('pagelayer_ajax').'";
129
  pagelayer_media_ajax_nonce = "'.wp_create_nonce('media-form').'";
130
  pagelayer_internal_linking_nonce = "'.wp_create_nonce('internal-linking').'";
145
  pagelayer_post = '. @json_encode($_post) .';
146
  pagelayer_loaded_icons = '.json_encode(pagelayer_enabled_icons()).';
147
  pagelayer_social_urls = '.json_encode(pagelayer_get_social_urls()).';
 
 
 
148
  pagelayer_global_widgets = '.json_encode($pagelayer->global_widgets).';
149
  pagelayer_saved_sections = '.json_encode($pagelayer->saved_sections).';
150
  pagelayer_global_sections = '.json_encode($pagelayer->global_sections).';';
main/post_metas.php ADDED
@@ -0,0 +1,547 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ //////////////////////////////////////////////////////////////
4
+ //===========================================================
5
+ // post_metas.php
6
+ //===========================================================
7
+ // PAGELAYER
8
+ // Inspired by the DESIRE to be the BEST OF ALL
9
+ // ----------------------------------------------------------
10
+ // Started by: Pulkit Gupta
11
+ // Date: 23rd Jan 2017
12
+ // Time: 23:00 hrs
13
+ // Site: http://pagelayer.com/wordpress (PAGELAYER)
14
+ // ----------------------------------------------------------
15
+ // Please Read the Terms of use at http://pagelayer.com/tos
16
+ // ----------------------------------------------------------
17
+ //===========================================================
18
+ // (c)Pagelayer Team
19
+ //===========================================================
20
+ //////////////////////////////////////////////////////////////
21
+
22
+ // Are we being accessed directly ?
23
+ if(!defined('PAGELAYER_VERSION')) {
24
+ exit('Hacking Attempt !');
25
+ }
26
+
27
+ // Show the post props
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;
35
+ }
36
+
37
+ $post = get_post($post_ID);
38
+
39
+ if(empty($post)){
40
+ return;
41
+ }
42
+
43
+ if ( ! current_user_can( 'edit_post', $post_ID ) ) {
44
+ wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
45
+ }
46
+
47
+ $post_type = $post->post_type;
48
+ $post_type_object = get_post_type_object( $post_type );
49
+ $user_ID = get_current_user_id();
50
+
51
+ // Set current screen
52
+ set_current_screen($post_type);
53
+
54
+ // Flag that we're not loading the block editor.
55
+ $current_screen = get_current_screen();
56
+ $current_screen->is_block_editor = 0;
57
+
58
+ // Enqueue Scripts
59
+ wp_enqueue_script( 'post' );
60
+
61
+ // Is support media
62
+ $thumbnail_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' );
63
+ if ( ! $thumbnail_support && 'attachment' === $post_type && $post->post_mime_type ) {
64
+ if ( wp_attachment_is( 'audio', $post ) ) {
65
+ $thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' );
66
+ } elseif ( wp_attachment_is( 'video', $post ) ) {
67
+ $thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' );
68
+ }
69
+ }
70
+
71
+ if ( $thumbnail_support ) {
72
+ add_thickbox();
73
+ wp_enqueue_media( array( 'post' => $post_ID ) );
74
+ }
75
+
76
+ $form_extra = '';
77
+ $form_action = 'editpost';
78
+ $nonce_action = 'update-post_' . $post_ID;
79
+ $form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr( $post_ID ) . "' />";
80
+
81
+ // All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action).
82
+ $lib = ABSPATH . 'site-admin/includes/meta-boxes.php';
83
+ $lib = file_exists($lib) ? $lib : ABSPATH . 'wp-admin/includes/meta-boxes.php';
84
+ require_once $lib;
85
+
86
+ register_and_do_post_meta_boxes( $post );
87
+
88
+ $locations = array( 'side', 'normal', 'advanced' );
89
+ $priorities = array( 'high', 'sorted', 'core', 'default', 'low' );
90
+ $to_remove_box = array('revisionsdiv', 'commentsdiv', 'formatdiv');
91
+
92
+ // Remove Meta Boxes
93
+ foreach( $locations as $location ){
94
+ foreach( $priorities as $priority ){
95
+ if( isset( $wp_meta_boxes[ $current_screen->id ][ $location ][ $priority ] ) ){
96
+ foreach( $to_remove_box as $to_remove ) {
97
+ if(array_key_exists($to_remove, $wp_meta_boxes[ $current_screen->id ][ $location ][ $priority ])){
98
+ remove_meta_box($to_remove, $current_screen, $location);
99
+ }
100
+ }
101
+ }
102
+ }
103
+ }
104
+
105
+ // Add format div again to change the position
106
+ if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) {
107
+ add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'default', array( '__back_compat_meta_box' => true ) );
108
+ }
109
+
110
+ // TO show all hidden meta boxes
111
+ add_filter( 'hidden_meta_boxes', function( $hidden, $screen, $use_defaults ){
112
+ return array();
113
+ }, 999, 3);
114
+
115
+ ?>
116
+ <style type="text/css">
117
+ body{
118
+ height: 100vh;
119
+ }
120
+
121
+ #wpcontent,
122
+ #wpbody-content,
123
+ html.wp-toolbar{
124
+ padding:0;
125
+ }
126
+
127
+ .postbox .handle-order-higher, .postbox .handle-order-lower,
128
+ #minor-publishing-actions,
129
+ .site-menu-header{
130
+ display:none;
131
+ }
132
+
133
+ .postbox{
134
+ border: 0;
135
+ border-bottom: 1px solid #ccd0d4;
136
+ }
137
+
138
+ .pagelayer-side-meta .meta-box-sortables{
139
+ display: grid;
140
+ grid-template-columns: repeat(3, 1fr);
141
+ grid-gap: 10px;
142
+ grid-auto-rows: auto;
143
+ }
144
+
145
+ .pagelayer-side-meta .postbox.closed{
146
+ height:max-content;
147
+ }
148
+
149
+ #major-publishing-actions{
150
+ display:none;
151
+ }
152
+
153
+ @media screen and (max-width: 1170px) {
154
+ .pagelayer-side-meta .meta-box-sortables{
155
+ grid-template-columns: repeat(2, 1fr);
156
+ }
157
+ }
158
+
159
+ @media screen and (max-width: 782px){
160
+ .auto-fold #wpcontent {
161
+ padding-left:4px;
162
+ }
163
+ .pagelayer-side-meta .meta-box-sortables{
164
+ grid-template-columns: auto;
165
+ }
166
+ }
167
+
168
+ .pagelayer-modal{
169
+ overflow: hidden;
170
+ position: fixed;
171
+ top:0;
172
+ left:0;
173
+ display: flex;
174
+ -ms-flex-direction: column;
175
+ flex-direction: column;
176
+ width: 100%;
177
+ height: 100vh;
178
+ pointer-events: auto;
179
+ background-color: #292e37;
180
+ background-clip: padding-box;
181
+ font-size: 14px;
182
+ font-weight: 600;
183
+ color : 333;
184
+ }
185
+
186
+ .pagelayer-tab-wrap,
187
+ .pagelayer-modal-holder{
188
+ position: relative;
189
+ display: -webkit-box;
190
+ display: -ms-flexbox;
191
+ display: flex;
192
+ -ms-flex-wrap: wrap;
193
+ flex-wrap: wrap;
194
+ height: calc(100% - 60px);
195
+ }
196
+
197
+ .pagelayer-tab-wrap{
198
+ flex-wrap: nowrap;
199
+ }
200
+
201
+ .pagelayer-modal-sidebar{
202
+ max-width: 256px;
203
+ min-width: 200px;
204
+ width: 100%;
205
+ position: relative;
206
+ color: #fff;
207
+ padding: 30px 20px;
208
+ height: calc(100% + 40px);
209
+ overflow:auto;
210
+ }
211
+
212
+ .pagelayer-sidebar-items{
213
+ padding: 10px;
214
+ }
215
+
216
+ .pagelayer-active-item,
217
+ .pagelayer-sidebar-items:hover{
218
+ background-color: #474c54;
219
+ transition:300ms;
220
+ }
221
+
222
+ .pagelayer-modal-content{
223
+ -webkit-box-flex: 1;
224
+ -ms-flex: 1 1 auto;
225
+ flex: 1 1 auto;
226
+ height: 100%;
227
+ background-color: #ffffff;
228
+ position: relative;
229
+ }
230
+
231
+ .pagelayer-form{
232
+ height:100%;
233
+ flex-grow:1;
234
+ }
235
+
236
+ .pagelayer-modal-holder{
237
+ flex-wrap: nowrap !important;
238
+ }
239
+
240
+ .pagelayer-modal-header{
241
+ padding: 20px 40px 20px 20px;
242
+ border-bottom: 1px solid #f1f1f1;
243
+ }
244
+
245
+ .pagelayer-modal-header h2{
246
+ margin:0;
247
+ }
248
+
249
+ .pagelayer-modal-body{
250
+ background-color: #f1f1f1;
251
+ height:100%;
252
+ }
253
+
254
+ .pagelayer-inner-body{
255
+ overflow:auto;
256
+ padding:20px;
257
+ height:calc(100% - 90px);
258
+ }
259
+
260
+ .pagelayer-inner-footer{
261
+ padding: 20px;
262
+ background-color: #ffffff;
263
+ position:absolute;
264
+ bottom:-65px;
265
+ left:0;
266
+ max-height:65px;
267
+ width:100%;
268
+ border-top: 1px solid #f1f1f1;
269
+ }
270
+
271
+ .pagelayer-meta-tabs{
272
+ display: flex;
273
+ align-items: center;
274
+ justify-content: center;
275
+ }
276
+
277
+ .pagelayer-tab-items{
278
+ cursor:pointer;
279
+ }
280
+
281
+ .pagelayer-meta-tabs .pagelayer-tab-items{
282
+ padding:20px 10px;
283
+ }
284
+
285
+ .pagelayer-meta-tabs .pagelayer-active-item,
286
+ .pagelayer-meta-tabs .pagelayer-tab-items:hover{
287
+ background-color: #f1f1f1;
288
+ transform: scale(1.02);
289
+ color: #3e8ef7;
290
+ }
291
+
292
+ .pagelayer-hidden{
293
+ display:none;
294
+ }
295
+
296
+ .pagelayer-show{
297
+ display:block;
298
+ }
299
+
300
+ .pagelayer-save-btn{
301
+ border: #398439 1px solid;
302
+ color: #fff;
303
+ background: #449d44;
304
+ padding: 5px 10px;
305
+ }
306
+
307
+ .pagelayer-block{
308
+ display:block;
309
+ }
310
+
311
+ .pagelayer-textarea{
312
+ width:70%;
313
+ }
314
+
315
+ .pagelayer-h-full{
316
+ height: 100%;
317
+ }
318
+
319
+ .pagelayer-post-title{
320
+ margin-bottom: 20px;
321
+ }
322
+ </style>
323
+
324
+ <script type="text/javascript">
325
+ jQuery(document).ready(function(){
326
+
327
+ jQuery('.pagelayer-modal .pagelayer-tab-items').on('click', function(){
328
+ var jEle = jQuery(this);
329
+ var show_panel = jEle.attr('data-tab');
330
+ var holder = jEle.closest('.pagelayer-tab-wrap');
331
+
332
+ // Hide all tab panels
333
+ holder.find('[tab-panel]').hide();
334
+ jEle.closest('.pagelayer-tab-holder').find('.pagelayer-tab-items').removeClass('pagelayer-active-item');
335
+
336
+ // Show and active the click panel
337
+ jEle.addClass('pagelayer-active-item');
338
+ holder.find('[tab-panel="'+show_panel+'"]').first().show();
339
+ });
340
+
341
+ // TODO:- conform - Add publish option
342
+ var post_status = jQuery('.pagelayer-modal select[name="post_status"]');
343
+ var publish = post_status.find('option[value="publish"]').length > 0;
344
+ var future = post_status.find('option[value="future"]').length > 0;
345
+
346
+ if(! publish && !future){
347
+ post_status.append('<option value="publish"><?php _e( "Published" ); ?></option>');
348
+ }
349
+
350
+ });
351
+
352
+ function pagelayer_open_body_props(){
353
+
354
+ var doc = jQuery(window.parent.document);
355
+ var setting = doc.find('.pagelayer-settings-icon');
356
+
357
+ if(setting.length < 1){
358
+ return;
359
+ }
360
+
361
+ setting.attr('pagelayer-modal-none', 1);
362
+ setting.click();
363
+ doc.find('.pagelayer-elpd-tabs').hide();
364
+ doc.find('.pagelayer-props-modal').click();
365
+ doc.find('[pagelayer-elpd-tab="options"]').click();
366
+ setting.removeAttr('pagelayer-modal-none');
367
+
368
+ }
369
+ </script>
370
+
371
+ <div class="pagelayer-modal">
372
+ <div class="pagelayer-modal-holder">
373
+ <form name="post" action="post.php" method="post" onsubmit="return pagelayer_post_edit(this, event)" id="post" class="pagelayer-form pagelayer-tab-wrap" <?php $referer = wp_get_referer(); ?>>
374
+
375
+ <?php wp_nonce_field( $nonce_action ); ?>
376
+ <input type="hidden" name="is_pagelayer_editor" value="1" />
377
+ <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID; ?>" />
378
+ <input type="hidden" id="hiddenaction" name="action1" value="<?php echo esc_attr( $form_action ); ?>" />
379
+ <input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr( $form_action ); ?>" />
380
+ <input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
381
+ <input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" />
382
+ <input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status ); ?>" />
383
+ <input type="hidden" id="referredby" name="referredby" value="<?php echo $referer ? esc_url( $referer ) : ''; ?>" />
384
+ <?php if ( ! empty( $active_post_lock ) ) { ?>
385
+ <input type="hidden" id="active_post_lock" value="<?php echo esc_attr( implode( ':', $active_post_lock ) ); ?>" />
386
+ <?php
387
+ }
388
+ if ( 'draft' !== get_post_status( $post ) ) {
389
+ wp_original_referer_field( true, 'previous' );
390
+ }
391
+
392
+ echo $form_extra;
393
+
394
+ wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
395
+ wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
396
+
397
+ ?>
398
+ <!-- Start Tabs-->
399
+ <div class="pagelayer-modal-sidebar pagelayer-tab-holder">
400
+ <div class="pagelayer-sidebar-items pagelayer-tab-items pagelayer-active-item" data-tab="post_props">
401
+ <span class="dashicons dashicons-welcome-write-blog"></span> <?php _e('Properties') ?>
402
+ </div>
403
+ <div class="pagelayer-sidebar-items pagelayer-tab-items" data-tab="advanced_props">
404
+ <span class="dashicons dashicons-welcome-add-page"></span> <?php _e('Advanced') ?>
405
+ </div>
406
+ <div class="pagelayer-sidebar-items pagelayer-tab-items" data-tab="hf_code">
407
+ <span class="dashicons dashicons-editor-code"></span> <?php _e('Header and Footer') ?>
408
+ </div>
409
+ <div class="pagelayer-sidebar-items pagelayer-tab-items" data-tab="hf_code" onclick="pagelayer_open_body_props()">
410
+ <span class="dashicons dashicons-admin-generic"></span> <?php _e('Body Style') ?>
411
+ </div>
412
+ </div>
413
+ <!-- End Tabs-->
414
+ <!-- Start Tab panels -->
415
+ <div class="pagelayer-modal-content pagelayer-show" tab-panel="post_props">
416
+ <div class="pagelayer-modal-header">
417
+ <h2><?php _e('Post Props') ?></h2>
418
+ </div>
419
+ <div class="pagelayer-modal-body">
420
+ <div class="pagelayer-inner-body metabox-holder pagelayer-side-meta">
421
+ <div class="pagelayer-post-title"><?php pagelayer_post_title();?></div>
422
+ <?php do_meta_boxes( $post_type, 'side', $post );?>
423
+ </div>
424
+ <div class="pagelayer-inner-footer">
425
+ <input type="submit" class="pagelayer-save-btn" name="pagelayer_submit" value="<?php _e('Save Changes'); ?>">
426
+ </div>
427
+ </div>
428
+ </div>
429
+ <div class="pagelayer-modal-content pagelayer-hidden" tab-panel="advanced_props">
430
+ <div class="pagelayer-modal-header">
431
+ <h2><?php _e('Advanced Props') ?></h2>
432
+ </div>
433
+ <div class="pagelayer-modal-body">
434
+ <div class="pagelayer-inner-body metabox-holder">
435
+ <?php
436
+ do_meta_boxes( $post_type, 'normal', $post );
437
+ do_meta_boxes( $post_type, 'advanced', $post );
438
+ ?>
439
+ </div>
440
+ <div class="pagelayer-inner-footer">
441
+ <input type="submit" class="pagelayer-save-btn" name="pagelayer_submit2" value="<?php _e('Save Changes'); ?>">
442
+ </div>
443
+ </div>
444
+ </div>
445
+ <div class="pagelayer-modal-content pagelayer-hidden" tab-panel="hf_code">
446
+ <?php pagelayer_post_hf_code(); ?>
447
+ </div>
448
+ <!-- End Tab panels -->
449
+ </form>
450
+ </div>
451
+ </div>
452
+ <?php
453
+
454
+ }
455
+
456
+ // Post Title
457
+ function pagelayer_post_title(){
458
+ global $post_type, $post_type_object, $post, $wp_meta_boxes, $current_screen, $user_ID, $post_ID;
459
+
460
+ if ( !post_type_supports( $post_type, 'title' ) ) {
461
+ return '';
462
+ }
463
+ ?>
464
+ <div id="titlediv">
465
+ <label for="title"><?php _e('Post Title') ?></label>
466
+ <div id="titlewrap">
467
+ <?php
468
+ $title_placeholder = apply_filters( 'enter_title_here', __( 'Add title' ), $post );
469
+ ?>
470
+ <label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo $title_placeholder; ?></label>
471
+ <input type="text" name="post_title" size="30" value="<?php echo esc_attr( $post->post_title ); ?>" id="title" spellcheck="true" autocomplete="off" />
472
+ </div>
473
+ <?php
474
+ //do_action( 'edit_form_before_permalink', $post );
475
+ ?>
476
+ <div class="inside">
477
+ <?php
478
+ $viewable = is_post_type_viewable( $post_type_object );
479
+
480
+ if ( $viewable ) :
481
+ $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html( $post->ID ) : '';
482
+
483
+ // As of 4.4, the Get Shortlink button is hidden by default.
484
+ if ( has_filter( 'pre_get_shortlink' ) || has_filter( 'get_shortlink' ) ) {
485
+ $shortlink = wp_get_shortlink( $post->ID, 'post' );
486
+
487
+ if ( ! empty( $shortlink ) && $shortlink !== $permalink && home_url( '?page_id=' . $post->ID ) !== $permalink ) {
488
+ $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr( $shortlink ) . '" />' .
489
+ '<button type="button" class="button button-small" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val());">' .
490
+ __( 'Get Shortlink' ) .
491
+ '</button>';
492
+ }
493
+ }
494
+
495
+ if ( $post_type_object->public
496
+ && ! ( 'pending' === get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) )
497
+ ) {
498
+ $has_sample_permalink = $sample_permalink_html && 'auto-draft' !== $post->post_status;
499
+ ?>
500
+ <div id="edit-slug-box" class="hide-if-no-js">
501
+ <?php
502
+ if ( $has_sample_permalink ) {
503
+ echo $sample_permalink_html;
504
+ }
505
+ ?>
506
+ </div>
507
+ <?php
508
+ }
509
+ endif;
510
+ ?>
511
+ </div>
512
+ <?php
513
+ wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );
514
+ ?>
515
+ </div><!-- /titlediv -->
516
+ <?php
517
+ }
518
+
519
+ // Header and footer code
520
+ function pagelayer_post_hf_code(){
521
+ global $post_type, $post_type_object, $post, $wp_meta_boxes, $current_screen, $user_ID, $post_ID;
522
+
523
+ ?>
524
+ <div class="pagelayer-modal-header">
525
+ <h2><?php _e('Header and Footer Code') ?></h2>
526
+ </div>
527
+ <div class="pagelayer-modal-body">
528
+ <div class="pagelayer-inner-body">
529
+ <p> <?php _e('You can add custom code like HTML, JavaScript, CSS etc. for the current post.') ?> </p>
530
+
531
+ <!-- Header Code-->
532
+ <label class="pagelayer-block"><?php _e('Header Code'); ?> :- </label>
533
+ <textarea name="pagelayer_header_code" placeholder="Enter your code to add in header" rows="10" class="pagelayer-textarea"><?php echo get_post_meta( $post_ID, 'pagelayer_header_code', true ); ?></textarea>
534
+ <p> <?php echo __('This code will be printed in <code>&lt;head&gt;</code> Section.') ?> </p>
535
+
536
+ <!-- Header Code-->
537
+ <label class="pagelayer-block"><?php _e('Footer Code'); ?> :- </label>
538
+ <textarea name="pagelayer_footer_code" placeholder="Enter your code to add in Footer" rows="10" class="pagelayer-textarea"><?php echo get_post_meta( $post_ID, 'pagelayer_footer_code', true ); ?></textarea>
539
+ <p> <?php echo __('This code will be printed before closing the <code>&lt;/body&gt;</code> Section.') ?> </p>
540
+ </div>
541
+ <div class="pagelayer-inner-footer">
542
+ <input type="submit" class="pagelayer-save-btn" name="pagelayer_submit" value="<?php _e('Save Codes'); ?>">
543
+ </div>
544
+ </div>
545
+ <?php
546
+
547
+ }
main/shortcodes.php CHANGED
@@ -3122,7 +3122,7 @@ pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_list_item', array(
3122
  'not_visible' => 1,
3123
  'innerHTML' => 'item',
3124
  'html' => '<li if="{{item}}" class="pagelayer-list-li">
3125
- <a if-ext="{{item_url}}" class="pagelayer-list-url pagelayer-ele-link" href="{{item_url}}">
3126
  <span class="pagelayer-list-icon-holder">
3127
  <i if="{{show_icon}}" class="pagelayer-list-icon {{icon}}"></i>
3128
  <span if="{{item}}" class="pagelayer-list-item">{{item}}</span>
@@ -7286,7 +7286,7 @@ pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_tabs', array(
7286
  'max' => 50,
7287
  'step' => 1,
7288
  'screen' => 1,
7289
- 'css' => ['{{element}}.pagelayer-tabs .pagelayer-tabcontainer [pagelayer-id]' => 'padding: {{val}}px;'],
7290
  ),
7291
  'tabs_content_border_width' => array(
7292
  'type' => 'padding',
@@ -7322,9 +7322,23 @@ pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_tab', array(
7322
  'name' => __pl('tab'),
7323
  'group' => 'other',
7324
  'not_visible' => 1,
7325
- 'innerHTML' => 'text',
7326
- 'html' => '<div class="pagelayer-tabcontent">{{text}}</div>',
 
 
 
 
7327
  'params' => array(
 
 
 
 
 
 
 
 
 
 
7328
  'default_active' => array(
7329
  'type' => 'checkbox',
7330
  'label' => __pl('Default active tab'),
@@ -7341,13 +7355,6 @@ pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_tab', array(
7341
  'default' => 'Lorem',
7342
  'addAttr' => 'pagelayer-tab-title="{{title}}"'
7343
  ),
7344
- 'text' => array(
7345
- 'type' => 'editor',
7346
- 'label' => __pl('Edit Rich Text'),
7347
- 'default' => 'Lorem ipsum dolor sit amet',
7348
- 'desc' => __pl('Edit the content here or edit directly in the Editor'),
7349
- 'edit' => '.pagelayer-tabcontent',
7350
- ),
7351
  )
7352
  )
7353
  );
@@ -7532,10 +7539,24 @@ pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_accordion_item', array(
7532
  'name' => __pl('Accordion item'),
7533
  'group' => 'other',
7534
  'not_visible' => 1,
7535
- 'innerHTML' => 'text',
 
 
 
 
7536
  'html' => '<a if="{{title}}" class="pagelayer-accordion-tabs">{{title}}<span class="pagelayer-accordion-icon"><i></i></span></a>
7537
- <div if="{{text}}" class="pagelayer-accordion-panel">{{text}}</div>',
7538
  'params' => array(
 
 
 
 
 
 
 
 
 
 
7539
  'default_active' => array(
7540
  'type' => 'checkbox',
7541
  'label' => __pl('Default active tab'),
@@ -7551,13 +7572,6 @@ pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_accordion_item', array(
7551
  'label' => __pl('title'),
7552
  'default' => 'Lorem',
7553
  ),
7554
- 'text' => array(
7555
- 'type' => 'editor',
7556
- 'label' => __pl('Edit Rich Text'),
7557
- 'default' => 'Lorem ipsum dolor sit amet',
7558
- 'desc' => __pl('Edit the content here or edit directly in the Editor'),
7559
- 'edit' => '.pagelayer-accordion-panel',
7560
- ),
7561
  )
7562
  )
7563
  );
@@ -8895,54 +8909,6 @@ pagelayer_add_shortcode(PAGELAYER_SC_PREFIX.'_post_props', array(
8895
  'skip_props' => ['ele_zindex',
8896
  'ele_shadow', 'border_shadow_hover',
8897
  'hide_desktop', 'hide_tablet', 'hide_mobile'],
8898
- 'params' => array(
8899
- 'post_title' => array(
8900
- 'type' => 'text',
8901
- 'label' => __pl('post_title'),
8902
- 'default' => (empty($post->post_title) ? 'No Title' : $post->post_title),
8903
- ),
8904
- 'post_name' => array(
8905
- 'type' => 'text',
8906
- 'label' => __pl('post_name'),
8907
- 'default' => (empty($post->post_name) ? 'no-slug' : $post->post_name),
8908
- ),
8909
- 'post_status' => array(
8910
- 'type' => 'select',
8911
- 'label' => __pl('post_status'),
8912
- 'list' => [
8913
- 'publish' => __pl('Published'),
8914
- 'private' => __pl('private'),
8915
- 'draft' => __pl('Draft')
8916
- ],
8917
- ),
8918
- 'featured_image' => array(
8919
- 'label' => __pl('featured_image'),
8920
- //'desc' => __pl('featured_image_desc'),
8921
- 'type' => 'image',
8922
- 'default' => PAGELAYER_URL.'/images/default-image.png',
8923
- ),
8924
- 'post_excerpt' => array(
8925
- 'type' => 'textarea',
8926
- 'label' => __pl('excerpt'),
8927
- ),
8928
- ),
8929
- 'custom_hf_code' => array(
8930
- 'header_code' => array(
8931
- 'type' => 'textarea',
8932
- 'label' => __pl('header_code'),
8933
- 'rows' => 4,
8934
- 'pro' => 1,
8935
- ),
8936
- 'footer_code' => array(
8937
- 'type' => 'textarea',
8938
- 'label' => __pl('footer_code'),
8939
- 'rows' => 4,
8940
- 'pro' => 1,
8941
- ),
8942
- ),
8943
- 'styles' => array(
8944
- 'custom_hf_code' => __pl('custom_hf_code'),
8945
- ),
8946
  )
8947
  );
8948
 
3122
  'not_visible' => 1,
3123
  'innerHTML' => 'item',
3124
  'html' => '<li if="{{item}}" class="pagelayer-list-li">
3125
+ <a if-ext="{{item_url}}" class="pagelayer-list-url pagelayer-ele-link" href="{{{item_url}}}">
3126
  <span class="pagelayer-list-icon-holder">
3127
  <i if="{{show_icon}}" class="pagelayer-list-icon {{icon}}"></i>
3128
  <span if="{{item}}" class="pagelayer-list-item">{{item}}</span>
7286
  'max' => 50,
7287
  'step' => 1,
7288
  'screen' => 1,
7289
+ 'css' => ['{{element}}.pagelayer-tabs .pagelayer-tabcontainer .pagelayer-tab' => 'padding: {{val}}px;'],
7290
  ),
7291
  'tabs_content_border_width' => array(
7292
  'type' => 'padding',
7322
  'name' => __pl('tab'),
7323
  'group' => 'other',
7324
  'not_visible' => 1,
7325
+ 'has_group' => [
7326
+ 'section' => 'params',
7327
+ 'prop' => 'elements'
7328
+ ],
7329
+ 'holder' => '.pagelayer-tabcontent',
7330
+ 'html' => '<div class="pagelayer-tabcontent"></div>',
7331
  'params' => array(
7332
+ 'elements' => array(
7333
+ 'type' => 'group',
7334
+ 'label' => __pl('Inner Row'),
7335
+ 'sc' => PAGELAYER_SC_PREFIX.'_inner_row',
7336
+ 'count' => 1,
7337
+ 'item_label' => array(
7338
+ 'default' => __pl('Inner Row'),
7339
+ ),
7340
+ 'hide' => 1,
7341
+ ),
7342
  'default_active' => array(
7343
  'type' => 'checkbox',
7344
  'label' => __pl('Default active tab'),
7355
  'default' => 'Lorem',
7356
  'addAttr' => 'pagelayer-tab-title="{{title}}"'
7357
  ),
 
 
 
 
 
 
 
7358
  )
7359
  )
7360
  );
7539
  'name' => __pl('Accordion item'),
7540
  'group' => 'other',
7541
  'not_visible' => 1,
7542
+ 'has_group' => [
7543
+ 'section' => 'params',
7544
+ 'prop' => 'elements'
7545
+ ],
7546
+ 'holder' => '.pagelayer-accordion-panel',
7547
  'html' => '<a if="{{title}}" class="pagelayer-accordion-tabs">{{title}}<span class="pagelayer-accordion-icon"><i></i></span></a>
7548
+ <div class="pagelayer-accordion-panel"></div>',
7549
  'params' => array(
7550
+ 'elements' => array(
7551
+ 'type' => 'group',
7552
+ 'label' => __pl('Inner Row'),
7553
+ 'sc' => PAGELAYER_SC_PREFIX.'_inner_row',
7554
+ 'count' => 1,
7555
+ 'item_label' => array(
7556
+ 'default' => __pl('Inner Row'),
7557
+ ),
7558
+ 'hide' => 1,
7559
+ ),
7560
  'default_active' => array(
7561
  'type' => 'checkbox',
7562
  'label' => __pl('Default active tab'),
7572
  'label' => __pl('title'),
7573
  'default' => 'Lorem',
7574
  ),
 
 
 
 
 
 
 
7575
  )
7576
  )
7577
  );
8909
  'skip_props' => ['ele_zindex',
8910
  'ele_shadow', 'border_shadow_hover',
8911
  'hide_desktop', 'hide_tablet', 'hide_mobile'],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8912
  )
8913
  );
8914
 
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.1
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.2
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.1
8
  License: LGPL v2.1
9
  License URI: http://www.gnu.org/licenses/lgpl-2.1.html
10
 
@@ -109,6 +109,16 @@ Do you have questions related to PageLayer ? Use the following links :
109
 
110
  == Changelog ==
111
 
 
 
 
 
 
 
 
 
 
 
112
  = 1.3.1 (October 13, 2020) =
113
  * [Improvement] Added the option to save the popup cookie on closing as well.
114
  * [Improvement] Added Cell Width options for Table Cells.
4
  Requires at least: 4.7
5
  Tested up to: 5.5
6
  Requires PHP: 5.5
7
+ Stable tag: 1.3.2
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.2 (October 28, 2020) =
113
+ * [Feature] The post properties in Pagelayer editor has been further improved, now clicking on the setting icon modal will be shown, from where you can setting up post properties.
114
+ * [Feature] Advanced Custom fields are now supported in the Pagelayer Editors new post properties.
115
+ * [Feature] The tabs, accordion and collapse widgets have been further improved. Now user can drag widgets inside these widgets.
116
+ * [Feature] Added single page Import support for PopularFX templates.
117
+ * [Task] From this version onwards, we are starting to save the post content in block format.
118
+ * [Bug-Fix] If the Pagelayer editor was not enabled for the post type, the "Edit with pagelayer" link was shown. This is fixed.
119
+ * [Bug-Fix] If the comment was closed for the post, the comment count in the post info widget was still showing. This is fixed.
120
+ * [Bug-Fix] In the some cases the link was not rendering properly in th list widget. This is fixed.
121
+
122
  = 1.3.1 (October 13, 2020) =
123
  * [Improvement] Added the option to save the popup cookie on closing as well.
124
  * [Improvement] Added Cell Width options for Table Cells.