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

Version Description

(March 11, 2021) = * [Feature] Added the option to clone the posts/pages. * [Task] Pagelayer has been tested with WordPress 5.7 and we have made required changes. * [Task] Added feature to import taxonomies for the posts. * [Task] Now we are starting importing excerpt content of the posts. * [Bug-Fix] When cloning the image portfolio widget, its clone was not working properly. This is fixed.

Download this release

Release Info

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

Code changes from version 1.4.7 to 1.4.8

fonts/OpenSans-BoldItalic.ttf ADDED
Binary file
init.php CHANGED
@@ -5,7 +5,7 @@ if (!defined('ABSPATH')) exit;
5
 
6
  define('PAGELAYER_BASE', plugin_basename(PAGELAYER_FILE));
7
  define('PAGELAYER_PRO_BASE', 'pagelayer-pro/pagelayer-pro.php');
8
- define('PAGELAYER_VERSION', '1.4.7');
9
  define('PAGELAYER_DIR', dirname(PAGELAYER_FILE));
10
  define('PAGELAYER_SLUG', 'pagelayer');
11
  define('PAGELAYER_URL', plugins_url('', PAGELAYER_FILE));
@@ -953,6 +953,72 @@ function pagelayer_old_slug_redirect($link){
953
  return $link;
954
  }
955
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
956
  add_filter( 'post_row_actions', 'pagelayer_quick_link', 10, 2 );
957
  add_filter( 'page_row_actions', 'pagelayer_quick_link', 10, 2 );
958
  function pagelayer_quick_link($actions, $post){
@@ -1080,5 +1146,17 @@ function pagelayer_replace_media(){
1080
 
1081
  }
1082
 
 
 
 
 
 
 
 
 
 
 
 
 
1083
  // Pagelayer Template Loading Mechanism
1084
  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.4.8');
9
  define('PAGELAYER_DIR', dirname(PAGELAYER_FILE));
10
  define('PAGELAYER_SLUG', 'pagelayer');
11
  define('PAGELAYER_URL', plugins_url('', PAGELAYER_FILE));
953
  return $link;
954
  }
955
 
956
+ // Clone Post
957
+ add_action('admin_action_pagelayer_clone_post', 'pagelayer_clone_post');
958
+ function pagelayer_clone_post(){
959
+
960
+ // Nonce verification
961
+ check_admin_referer('pagelayer-options');
962
+
963
+ if(!current_user_can('edit_posts')){
964
+ wp_die('You don\'t have access to clone this post.');
965
+ }
966
+
967
+ // Get the original post id
968
+ $post_id = (int) $_REQUEST['post'];
969
+ $post = get_post( $post_id );
970
+
971
+ // If post data exists, create the post clone
972
+ if(empty($post)){
973
+ wp_die('No post found');
974
+ }
975
+
976
+ $current_user = wp_get_current_user();
977
+ $new_post_author = $current_user->ID;
978
+
979
+ unset($post->ID);
980
+ $post->post_author = $new_post_author;
981
+ $post->post_name = $post->post_name.'_clone';
982
+ $post->post_status = 'draft';
983
+ $post->post_title = $post->post_title.' Clone';
984
+
985
+ $new_post_id = wp_insert_post( $post );
986
+
987
+ if(empty($new_post_id)){
988
+ wp_die('Post creation failed, could not find original post: ' . $post_id);
989
+ }
990
+
991
+ // Get all current post terms and set them to the new post draft
992
+ $taxonomies = get_object_taxonomies($post->post_type);
993
+ foreach ($taxonomies as $taxonomy) {
994
+ $post_terms = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'slugs'));
995
+ wp_set_object_terms($new_post_id, $post_terms, $taxonomy, false);
996
+ }
997
+
998
+ // Clone all post meta info
999
+ $post_meta_infos = get_post_meta($post_id);
1000
+ if (count($post_meta_infos) > 0) {
1001
+ foreach ($post_meta_infos as $meta_key => $meta_value){
1002
+ add_post_meta($new_post_id, $meta_key, wp_slash( maybe_unserialize($meta_value[0]) ));
1003
+ }
1004
+ }
1005
+
1006
+ // Finally, redirect to the edit post screen for the new draft
1007
+ wp_redirect( pagelayer_livelink($new_post_id) );
1008
+ exit;
1009
+
1010
+ }
1011
+
1012
+ // Add the clone link to action list for post_row_actions
1013
+ add_filter('post_row_actions', 'pagelayer_clone_post_link', 10, 2);
1014
+ add_filter('page_row_actions', 'pagelayer_clone_post_link', 10, 2);
1015
+ function pagelayer_clone_post_link( $actions, $post ) {
1016
+ if (current_user_can('edit_posts') && $post->post_status !== 'trash' && !defined('SITEPAD') && get_option('pagelayer_disable_clone') != 1) {
1017
+ $actions['clone'] = '<a href="'.wp_nonce_url('admin.php?action=pagelayer_clone_post&post='.$post->ID, 'pagelayer-options') . '" rel="permalink">'.__( 'Clone', 'pagelayer') .'</a>';
1018
+ }
1019
+ return $actions;
1020
+ }
1021
+
1022
  add_filter( 'post_row_actions', 'pagelayer_quick_link', 10, 2 );
1023
  add_filter( 'page_row_actions', 'pagelayer_quick_link', 10, 2 );
1024
  function pagelayer_quick_link($actions, $post){
1146
 
1147
  }
1148
 
1149
+ // Hide admin bar
1150
+ add_action( 'init', 'pagelayer_hide_admin_bar');
1151
+ function pagelayer_hide_admin_bar(){
1152
+
1153
+ // Is it the live mode ?
1154
+ if(!pagelayer_optreq('pagelayer-live', false) || !pagelayer_optreq('pagelayer-iframe', false)){
1155
+ return false;
1156
+ }
1157
+
1158
+ show_admin_bar(false);
1159
+ }
1160
+
1161
  // Pagelayer Template Loading Mechanism
1162
  include_once(PAGELAYER_DIR.'/main/template.php');
main/ajax.php CHANGED
@@ -1750,6 +1750,28 @@ function pagelayer_export_template(){
1750
  // Also put the meta
1751
  file_put_contents($theme_dir.'/data/'.$type.'/'.$v->post_name.'.meta', json_encode($meta, JSON_PRETTY_PRINT));
1752
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1753
  $conf[$type][$v->post_name] = $v;
1754
 
1755
  do_action('pagelayer_'.$type.'_exported', $v, $theme_dir);
@@ -1822,7 +1844,32 @@ function pagelayer_export_template(){
1822
  }
1823
  }
1824
  }
1825
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1826
  // Write the config
1827
  if(!empty($conf)){
1828
  file_put_contents($theme_dir.'/pagelayer-data.conf', json_encode($conf, JSON_PRETTY_PRINT));
@@ -1834,9 +1881,11 @@ function pagelayer_export_template(){
1834
  //$done['media'] = $pagelayer->media_to_export;
1835
  }
1836
 
 
 
1837
  $done['success'] = __pl('temp_export_success');
1838
 
1839
  // Output and die
1840
  pagelayer_json_output($done);
1841
 
1842
- }
1750
  // Also put the meta
1751
  file_put_contents($theme_dir.'/data/'.$type.'/'.$v->post_name.'.meta', json_encode($meta, JSON_PRETTY_PRINT));
1752
 
1753
+ //Export taxonomies in post
1754
+ $taxonomies = get_object_taxonomies( $v->post_type, 'objects' );
1755
+ $post_taxonomies = wp_filter_object_list( $taxonomies, [
1756
+ 'public' => true,
1757
+ 'show_in_nav_menus' => true,
1758
+ ] );
1759
+
1760
+ foreach( $post_taxonomies as $slug => $object ){
1761
+
1762
+ if(empty($v->taxonomies) || !is_array($v->taxonomies)){
1763
+ $v->taxonomies = array();
1764
+ }
1765
+
1766
+ $tax_name = $object->name;
1767
+ $the_terms = get_the_terms($v->ID, $tax_name);
1768
+ $v->taxonomies[$tax_name] = '';
1769
+
1770
+ if(!empty($the_terms)){
1771
+ $v->taxonomies[$tax_name] = implode(',', array_column($the_terms, 'term_id'));
1772
+ }
1773
+ }
1774
+
1775
  $conf[$type][$v->post_name] = $v;
1776
 
1777
  do_action('pagelayer_'.$type.'_exported', $v, $theme_dir);
1844
  }
1845
  }
1846
  }
1847
+
1848
+ // Export all the taxonomies
1849
+ $post_types = pagelayer_get_public_post_types();
1850
+
1851
+ foreach ( $post_types as $post_type => $label ) {
1852
+ $type_taxonomies = get_object_taxonomies( $post_type, 'objects' );
1853
+ $taxonomies = wp_filter_object_list( $type_taxonomies, [
1854
+ 'public' => true,
1855
+ 'show_in_nav_menus' => true,
1856
+ ] );
1857
+
1858
+ foreach( $taxonomies as $slug => $object ){
1859
+
1860
+ $query_params = [
1861
+ 'taxonomy' => $object->name,
1862
+ 'hide_empty' => false,
1863
+ ];
1864
+ $terms = get_terms( $query_params );
1865
+
1866
+ foreach($terms as $term){
1867
+ $conf['taxonomies'][$term->term_id] = $term;
1868
+ }
1869
+ }
1870
+
1871
+ }
1872
+
1873
  // Write the config
1874
  if(!empty($conf)){
1875
  file_put_contents($theme_dir.'/pagelayer-data.conf', json_encode($conf, JSON_PRETTY_PRINT));
1881
  //$done['media'] = $pagelayer->media_to_export;
1882
  }
1883
 
1884
+ do_action('pagelayer_template_export_completed');
1885
+
1886
  $done['success'] = __pl('temp_export_success');
1887
 
1888
  // Output and die
1889
  pagelayer_json_output($done);
1890
 
1891
+ }
main/class.php CHANGED
@@ -76,6 +76,9 @@ class PageLayer{
76
  // For saved sections
77
  var $saved_sections = array();
78
 
 
 
 
79
  var $css = array();
80
  var $css_settings = array();
81
 
76
  // For saved sections
77
  var $saved_sections = array();
78
 
79
+ // For saved default params
80
+ var $default_params = array();
81
+
82
  var $css = array();
83
  var $css_settings = array();
84
 
main/functions.php CHANGED
@@ -400,6 +400,10 @@ function pagelayer_shortlink($id){
400
  $link = home_url( '?p=' . $post_id );
401
  }
402
 
 
 
 
 
403
  $link .= substr_count($link, '?') > 0 ? '' : '?';
404
  return $link;
405
  }
@@ -608,7 +612,7 @@ function pagelayer_create_id(){
608
 
609
  // Loads the shortcodes
610
  function pagelayer_load_shortcodes(){
611
- global $pagelayer;
612
 
613
  if(!empty($pagelayer->shortcode_loaded)){
614
  return;
@@ -684,7 +688,7 @@ function pagelayer_load_shortcodes(){
684
  // Add the shortcodes to the pagelayer list
685
  function pagelayer_add_shortcode($tag, $params = array()){
686
 
687
- global $pagelayer;
688
 
689
  if($tag == 'pl_row'){
690
  $inner_tag = 'pl_inner_row';
@@ -755,11 +759,38 @@ function pagelayer_add_shortcode($tag, $params = array()){
755
  }
756
  }
757
  //die();*/
758
-
 
 
759
  // Insert the shortcode
760
  $pagelayer->shortcodes[$tag] = $params;
761
  $pagelayer->groups[$params['group']][] = $tag;
762
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
763
  }
764
 
765
  // Add a freemium shortcode i.e. available for render, but not to drag or edit
@@ -816,7 +847,7 @@ function pagelayer_permalink($id){
816
  }
817
 
818
  // Returns the Image values
819
- function pagelayer_image($id){
820
 
821
  global $pagelayer;
822
 
@@ -2818,4 +2849,29 @@ function pagelayer_load_font_options(){
2818
 
2819
  function pagelayer_is_utf8($str) {
2820
  return (bool) preg_match('//u', $str);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2821
  }
400
  $link = home_url( '?p=' . $post_id );
401
  }
402
 
403
+ if(function_exists('is_post_status_viewable') && !is_post_status_viewable($post_id)){
404
+ $link = get_permalink( $post->ID );
405
+ }
406
+
407
  $link .= substr_count($link, '?') > 0 ? '' : '?';
408
  return $link;
409
  }
612
 
613
  // Loads the shortcodes
614
  function pagelayer_load_shortcodes(){
615
+ global $pagelayer, $post;
616
 
617
  if(!empty($pagelayer->shortcode_loaded)){
618
  return;
688
  // Add the shortcodes to the pagelayer list
689
  function pagelayer_add_shortcode($tag, $params = array()){
690
 
691
+ global $pagelayer, $post;
692
 
693
  if($tag == 'pl_row'){
694
  $inner_tag = 'pl_inner_row';
759
  }
760
  }
761
  //die();*/
762
+
763
+ $params = apply_filters( 'pagelayer_shortcode_params', $params, $tag );
764
+
765
  // Insert the shortcode
766
  $pagelayer->shortcodes[$tag] = $params;
767
  $pagelayer->groups[$params['group']][] = $tag;
768
+
769
+ // Export the default values
770
+ foreach($pagelayer->tabs as $tab){
771
+
772
+ if(empty($pagelayer->shortcodes[$tag][$tab])){
773
+ continue;
774
+ }
775
+
776
+ foreach($pagelayer->shortcodes[$tag][$tab] as $section => $Lsection){
777
+
778
+ $props = empty($pagelayer->shortcodes[$tag][$section]) ? @$pagelayer->styles[$section] : @$pagelayer->shortcodes[$tag][$section];
779
+
780
+ //echo $tab.' - '.$section.' - <br>';
781
+
782
+ if(empty($props)){
783
+ continue;
784
+ }
785
+
786
+ foreach($props as $prop => $param){
787
+
788
+ if(isset($param['export-def']) && isset($param['default']) && $param['export-def'] == 1)
789
+ // Set default values to export for JS
790
+ $pagelayer->default_params[$tag][$prop] = $param['default'];
791
+ }
792
+ }
793
+ }
794
  }
795
 
796
  // Add a freemium shortcode i.e. available for render, but not to drag or edit
847
  }
848
 
849
  // Returns the Image values
850
+ function pagelayer_image($id = 0){
851
 
852
  global $pagelayer;
853
 
2849
 
2850
  function pagelayer_is_utf8($str) {
2851
  return (bool) preg_match('//u', $str);
2852
+ }
2853
+
2854
+ // Create blank images
2855
+ function pagelayer_create_blank_image($width, $height){
2856
+
2857
+ $im = @imagecreate($width, $height);
2858
+
2859
+ if(empty($im)){
2860
+ return false;
2861
+ }
2862
+
2863
+ $background_color = imagecolorallocate($im, 220, 220, 220);
2864
+ $text_color = imagecolorallocate($im, 110, 110, 110);
2865
+ $string = $width.' x '.$height;
2866
+ $font_size = 30;
2867
+ $sx = ($width / 2) - (strlen($string) * $font_size / 2);
2868
+ $sy = ($height / 2) - ($font_size / 2);
2869
+ $font = realpath(PAGELAYER_DIR.'/fonts/OpenSans-BoldItalic.ttf');
2870
+ imagettftext($im, $font_size, 0, $sx, $sy, $text_color, $font, $string);
2871
+ ob_start();
2872
+ imagepng($im);
2873
+ imagedestroy($im);
2874
+
2875
+ return ob_get_clean();
2876
+
2877
  }
main/import.php CHANGED
@@ -512,9 +512,64 @@ global $pagelayer, $pl_error, $sitepad;
512
  require_once ABSPATH . PAGELAYER_CMS_DIR_PREFIX.'-admin/includes/file.php';
513
  }
514
 
 
515
  $_media = list_files($pagelayer_theme_path.'/images', 1);
516
  //r_print($_media);die();
517
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
518
  foreach($_media as $k => $v){
519
  $file_name = basename($v);
520
  $ret = pagelayer_upload_media($file_name, file_get_contents($v));
@@ -659,6 +714,12 @@ global $pagelayer, $pl_error, $sitepad;
659
 
660
  //pagelayer_print($data);
661
 
 
 
 
 
 
 
662
  foreach($data as $data_type => $data_v){
663
 
664
  $pagelayer->imported[$data_type] = 1;
@@ -669,7 +730,7 @@ global $pagelayer, $pl_error, $sitepad;
669
  continue;
670
  }
671
 
672
- if($data_type == 'menus'){
673
  continue;
674
  }
675
 
@@ -721,11 +782,42 @@ global $pagelayer, $pl_error, $sitepad;
721
 
722
  // Make an array
723
  $new_post['post_content'] = file_get_contents($path);
 
724
  $new_post['post_title'] = $v['post_title'];
725
  $new_post['post_name'] = $v['post_name'];
726
  $new_post['post_type'] = $data_type;
727
  $new_post['post_status'] = 'publish';
728
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
729
  // Meta file path
730
  $meta_path = pagelayer_cleanpath($pagelayer_theme_path.'/data/'.$data_type.'/'.$k.'.meta');
731
 
@@ -919,6 +1011,67 @@ global $pagelayer, $pl_error, $sitepad;
919
 
920
  }
921
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
922
  add_filter('pagelayer_start_insert_content', 'pagelayer_import_start_insert_content');
923
  function pagelayer_import_start_insert_content($post){
924
 
@@ -1347,3 +1500,40 @@ function pagelayer_blog_templates($pgl){
1347
  return $pgl;
1348
 
1349
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
512
  require_once ABSPATH . PAGELAYER_CMS_DIR_PREFIX.'-admin/includes/file.php';
513
  }
514
 
515
+
516
  $_media = list_files($pagelayer_theme_path.'/images', 1);
517
  //r_print($_media);die();
518
 
519
+ // Download images
520
+ if(!empty($_REQUEST['download_imgs']) && file_exists($pagelayer_theme_path.'/images.json')){
521
+
522
+ $images_list = @json_decode(file_get_contents($pagelayer_theme_path.'/images.json'), true);
523
+ //r_print($images_list);die();
524
+
525
+ foreach($images_list as $k => $v){
526
+
527
+ if(empty($v['download_url'])){
528
+ continue;
529
+ }
530
+
531
+ $dest_dir = $pagelayer_theme_path.'/images';
532
+ $dest_file = $dest_dir.'/'.$k;
533
+ $image_file = file_get_contents($v['download_url']);
534
+
535
+ // Compare image md5
536
+ if($v['md5'] != md5($image_file)){
537
+ continue;
538
+ }
539
+
540
+ if(file_exists($dest_file)){
541
+ $imagesize = getimagesize($dest_file);
542
+
543
+ // Download and resize image
544
+ $resize_file = pagelayer_resizeImage($v['download_url'], $imagesize[0], $imagesize[1]);
545
+ if(!empty($resize_file)){
546
+ $image_file = $resize_file;
547
+ }
548
+ }
549
+
550
+ // Put image in file
551
+ file_put_contents($dest_file, $image_file);
552
+
553
+ }
554
+
555
+ // Update option to set no
556
+ update_option('pagelayer_import_images_'.$template_name, 'yes');
557
+
558
+ }elseif(empty($_REQUEST['download_imgs']) && !file_exists($pagelayer_theme_path.'/images.json')){
559
+ foreach($_media as $k => $v){
560
+ $imagesize = getimagesize($v);
561
+
562
+ // Create blank image
563
+ if(strpos($imagesize['mime'], "image/" ) !== false) {
564
+ $blank_image = pagelayer_create_blank_image($imagesize[0], $imagesize[1]);
565
+ file_put_contents($v, $blank_image);
566
+ }
567
+ }
568
+
569
+ // Update option to set no
570
+ update_option('pagelayer_import_images_'.$template_name, 'no');
571
+ }
572
+
573
  foreach($_media as $k => $v){
574
  $file_name = basename($v);
575
  $ret = pagelayer_upload_media($file_name, file_get_contents($v));
714
 
715
  //pagelayer_print($data);
716
 
717
+ // Import taxonomies
718
+ $taxonomy_ids = array();
719
+ if(!empty($data['taxonomies'])){
720
+ $taxonomy_ids = pagelayer_import_taxonomies($data['taxonomies']);
721
+ }
722
+
723
  foreach($data as $data_type => $data_v){
724
 
725
  $pagelayer->imported[$data_type] = 1;
730
  continue;
731
  }
732
 
733
+ if($data_type == 'menus' || $data_type == 'taxonomies'){
734
  continue;
735
  }
736
 
782
 
783
  // Make an array
784
  $new_post['post_content'] = file_get_contents($path);
785
+ $new_post['post_excerpt'] = $v['post_excerpt'];
786
  $new_post['post_title'] = $v['post_title'];
787
  $new_post['post_name'] = $v['post_name'];
788
  $new_post['post_type'] = $data_type;
789
  $new_post['post_status'] = 'publish';
790
 
791
+ // Category register
792
+ if(!empty($v['taxonomies'])){
793
+
794
+ foreach($v['taxonomies'] as $tax => $tax_ids){
795
+
796
+ if(!empty($tax_ids)){
797
+
798
+ // Need to replace ids with new ids
799
+ $tax_ids = explode(',', $tax_ids);
800
+
801
+ foreach($tax_ids as $key => $id){
802
+ $tax_ids[$key] = (int) $taxonomy_ids[$id];
803
+ }
804
+
805
+ switch ($tax) {
806
+ case 'category':
807
+ $new_post['post_category'] = $tax_ids;
808
+ break;
809
+ case 'post_tag':
810
+ $new_post['tags_input'] = $tax_ids;
811
+ break;
812
+ default:
813
+ $new_post['tax_input'][$tax] = $tax_ids;
814
+ }
815
+ }
816
+
817
+ }
818
+
819
+ }
820
+
821
  // Meta file path
822
  $meta_path = pagelayer_cleanpath($pagelayer_theme_path.'/data/'.$data_type.'/'.$k.'.meta');
823
 
1011
 
1012
  }
1013
 
1014
+ // Import Taxonomies Handler
1015
+ function pagelayer_import_taxonomies($taxonomy){
1016
+
1017
+ $new_ids = array();
1018
+
1019
+ foreach($taxonomy as $term_id => $term){
1020
+
1021
+ $parent_id = null;
1022
+ $term_par = 0;
1023
+
1024
+ // If tern has parent
1025
+ if(!empty($term['parent']) && empty($new_ids[$term['parent']])){
1026
+
1027
+ // Get parent taxonomy
1028
+ $par_terms = get_terms( array(
1029
+ 'taxonomy' => $term['taxonomy'],
1030
+ 'hide_empty' => false,
1031
+ 'meta_key' => 'pagelayer_imported_id',
1032
+ 'meta_value' => $term['parent']
1033
+ ) );
1034
+
1035
+ $par_terms_len = count($par_terms) - 1;
1036
+
1037
+ // If not exists
1038
+ if(is_wp_error($par_terms) || empty($par_terms)){
1039
+ $par_ids = pagelayer_import_taxonomies(array($term['parent'] => $taxonomy[$term['parent']]));
1040
+ $term_par = $parent_id = $par_ids[$term['parent']];
1041
+ $new_ids[$term['parent']] = $parent_id;
1042
+ }elseif($par_terms_len > -1){
1043
+ $term_par = $parent_id = $par_terms[$par_terms_len]->term_id;
1044
+ }
1045
+
1046
+ }elseif(!empty($new_ids[$term['parent']])){
1047
+ $term_par = $parent_id = $new_ids[$term['parent']];
1048
+ }
1049
+
1050
+ $exist_term = term_exists($term['name'], $term['taxonomy'], $parent_id );
1051
+
1052
+ if($exist_term === null){
1053
+ $tax_details = wp_insert_term($term['name'], $term['taxonomy'] ,array('description' => $term['description'],'parent' => $term_par, 'slug' => $term['slug']));
1054
+ if(!(is_wp_error( $tax_details ))){
1055
+ $new_id = $tax_details['term_id'];
1056
+ }
1057
+ }elseif(is_array($exist_term)){
1058
+ $new_id = $exist_term['term_id'];
1059
+ }else{
1060
+ $new_id = $exist_term;
1061
+ }
1062
+
1063
+ // ID is empty?
1064
+ if(empty($new_id)){
1065
+ continue;
1066
+ }
1067
+
1068
+ update_term_meta( $new_id, 'pagelayer_imported_id', $term_id);
1069
+ $new_ids[$term_id] = $new_id;
1070
+ }
1071
+
1072
+ return $new_ids;
1073
+ }
1074
+
1075
  add_filter('pagelayer_start_insert_content', 'pagelayer_import_start_insert_content');
1076
  function pagelayer_import_start_insert_content($post){
1077
 
1500
  return $pgl;
1501
 
1502
  }
1503
+
1504
+ // Resize Image
1505
+ function pagelayer_resizeImage($filename, $newwidth, $newheight){
1506
+
1507
+ $imagesize = getimagesize($filename);
1508
+ $width = $imagesize[0];
1509
+ $height = $imagesize[1];
1510
+
1511
+ // Calculate the Height and width
1512
+ if($width <= $newwidth || $height <= $newheight){
1513
+ return false;
1514
+ }
1515
+
1516
+ $thumb = imagecreatetruecolor($newwidth, $newheight);
1517
+
1518
+ switch($imagesize['mime']) {
1519
+ case 'image/jpg':
1520
+ case 'image/jpeg':
1521
+ $source = imagecreatefromjpeg($filename);
1522
+ break;
1523
+ case 'image/gif':
1524
+ $source = imagecreatefromgif($filename);
1525
+ break;
1526
+ case 'image/png':
1527
+ $source = imagecreatefrompng($filename);
1528
+ break;
1529
+ }
1530
+
1531
+ imagecopyresampled($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
1532
+ imagedestroy($source);
1533
+ ob_start();
1534
+ imagepng($thumb);
1535
+ $image = ob_get_clean();
1536
+ imagedestroy($thumb);
1537
+
1538
+ return $image;
1539
+ }
main/settings.php CHANGED
@@ -433,6 +433,20 @@ function pagelayer_settings_page(){
433
  // Media Replace
434
  $media_replace = get_option( 'pagelayer_disable_media_replace');
435
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
436
  // Saved ?
437
  if(!empty($done)){
438
  echo '<div class="notice notice-success"><p>'. __('The settings were saved successfully', 'pagelayer'). '</p></div><br />';
@@ -491,6 +505,14 @@ function pagelayer_settings_page(){
491
  </label>
492
  </td>
493
  </tr>
 
 
 
 
 
 
 
 
494
  </table>
495
  </div>
496
  <div class="pagelayer-tab-panel" id="icons">
433
  // Media Replace
434
  $media_replace = get_option( 'pagelayer_disable_media_replace');
435
 
436
+ // Clone Templates.
437
+ if(isset($_POST['submit']) || isset($_POST['pagelayer_disable_clone'])){
438
+
439
+ $disable_clone = empty($_REQUEST['pagelayer_disable_clone']) ? 0 : 1;
440
+
441
+ update_option( 'pagelayer_disable_clone', $disable_clone );
442
+
443
+ $done = 1;
444
+
445
+ }
446
+
447
+ // Media Replace
448
+ $disable_clone = get_option('pagelayer_disable_clone');
449
+
450
  // Saved ?
451
  if(!empty($done)){
452
  echo '<div class="notice notice-success"><p>'. __('The settings were saved successfully', 'pagelayer'). '</p></div><br />';
505
  </label>
506
  </td>
507
  </tr>
508
+ <tr>
509
+ <th scope="row"><?php _e('Disable Clone');?></th>
510
+ <td>
511
+ <label>
512
+ <input type="checkbox" name="pagelayer_disable_clone" <?php echo (!empty( $disable_clone) ? ' checked' : '');?> /><?php _e('Disable Clone') ?></br>
513
+ </label>
514
+ </td>
515
+ </tr>
516
  </table>
517
  </div>
518
  <div class="pagelayer-tab-panel" id="icons">
main/template.php CHANGED
@@ -540,7 +540,7 @@ function pagelayer_builder_columns( $column, $post_id ) {
540
 
541
  case 'pagelayer_template_conditions' :
542
  $dis_conditions = get_post_meta( $post_id, 'pagelayer_template_conditions', true );
543
- if( !empty($dis_conditions) ){
544
  $dis_html = '';
545
  foreach($dis_conditions as $condi){
546
  $dis_html .= '<span>';
540
 
541
  case 'pagelayer_template_conditions' :
542
  $dis_conditions = get_post_meta( $post_id, 'pagelayer_template_conditions', true );
543
+ if( !empty($dis_conditions) && is_array($dis_conditions)){
544
  $dis_html = '';
545
  foreach($dis_conditions as $condi){
546
  $dis_html .= '<span>';
pagelayer.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: PageLayer
4
  Plugin URI: http://wordpress.org/plugins/pagelayer/
5
  Description: PageLayer is a WordPress page builder plugin. Its very easy to use and very light on the browser.
6
- Version: 1.4.7
7
  Author: Pagelayer Team
8
  Author URI: https://pagelayer.com/
9
  License: LGPL v2.1
3
  Plugin Name: PageLayer
4
  Plugin URI: http://wordpress.org/plugins/pagelayer/
5
  Description: PageLayer is a WordPress page builder plugin. Its very easy to use and very light on the browser.
6
+ Version: 1.4.8
7
  Author: Pagelayer Team
8
  Author URI: https://pagelayer.com/
9
  License: LGPL v2.1
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: pagelayer
3
  Tags: page builder, editor, drag-and-drop, landing page, replace image, pagelayer, form-builder, popup, widgets, softaculous, visual editor, wysiwyg, design, maintenance mode, coming soon, under construction, website builder, landing page builder, front-end builder, site-builder
4
  Requires at least: 4.7
5
- Tested up to: 5.6
6
  Requires PHP: 5.5
7
- Stable tag: 1.4.7
8
  License: LGPL v2.1
9
  License URI: http://www.gnu.org/licenses/lgpl-2.1.html
10
 
@@ -109,6 +109,13 @@ Do you have questions related to PageLayer ? Use the following links :
109
 
110
  == Changelog ==
111
 
 
 
 
 
 
 
 
112
  = 1.4.7 (Feb 26, 2021) =
113
  * [Feature] Added the option to scroll to the top of any element or body in button widget.
114
  * [Bug-Fix] In some cases the background color of the checked radio button in the contact form widget was not working properly. This is fixed.
2
  Contributors: pagelayer
3
  Tags: page builder, editor, drag-and-drop, landing page, replace image, pagelayer, form-builder, popup, widgets, softaculous, visual editor, wysiwyg, design, maintenance mode, coming soon, under construction, website builder, landing page builder, front-end builder, site-builder
4
  Requires at least: 4.7
5
+ Tested up to: 5.7
6
  Requires PHP: 5.5
7
+ Stable tag: 1.4.8
8
  License: LGPL v2.1
9
  License URI: http://www.gnu.org/licenses/lgpl-2.1.html
10
 
109
 
110
  == Changelog ==
111
 
112
+ = 1.4.8 (March 11, 2021) =
113
+ * [Feature] Added the option to clone the posts/pages.
114
+ * [Task] Pagelayer has been tested with WordPress 5.7 and we have made required changes.
115
+ * [Task] Added feature to import taxonomies for the posts.
116
+ * [Task] Now we are starting importing excerpt content of the posts.
117
+ * [Bug-Fix] When cloning the image portfolio widget, its clone was not working properly. This is fixed.
118
+
119
  = 1.4.7 (Feb 26, 2021) =
120
  * [Feature] Added the option to scroll to the top of any element or body in button widget.
121
  * [Bug-Fix] In some cases the background color of the checked radio button in the contact form widget was not working properly. This is fixed.