Funnel Builder by CartFlows – Create High Converting Sales Funnels For WordPress - Version 1.1.11

Version Description

Download this release

Release Info

Developer sandesh055
Plugin Icon Funnel Builder by CartFlows – Create High Converting Sales Funnels For WordPress
Version 1.1.11
Comparing to
See all releases

Code changes from version 1.1.10 to 1.1.11

admin/assets/css/global-admin-rtl.css CHANGED
@@ -15,18 +15,20 @@
15
  * *********************
16
  */
17
  @font-face {
18
- font-family: 'cartflows-icon';
19
- src: url('../fonts/cartflows.eot?vgky31');
20
- src: url('../fonts/cartflows.eot?vgky31#iefix') format('embedded-opentype'),
21
- url('../fonts/cartflows.ttf?vgky31') format('truetype'),
22
- url('../fonts/cartflows.woff?vgky31') format('woff'),
23
- url('../fonts/cartflows.svg?vgky31#cartflows') format('svg');
24
  font-weight: normal;
25
  font-style: normal;
26
  }
27
 
28
- [class^="cartflows-icon"], [class*=" cartflows-icon"] {
29
- font-family: 'cartflows-icon' !important;
 
 
30
  speak: none;
31
  font-style: normal;
32
  font-weight: normal;
@@ -37,7 +39,8 @@
37
  -moz-osx-font-smoothing: grayscale;
38
  }
39
 
40
- .cartflows-icon:before {
 
41
  content: "\e900";
42
  color: #f16334;
43
  }
15
  * *********************
16
  */
17
  @font-face {
18
+ font-family: 'cartflows-logo-icon';
19
+ src: url('../fonts/cartflows-logo-icon.eot?kxnn1n');
20
+ src: url('../fonts/cartflows-logo-icon.eot?kxnn1n#iefix') format('embedded-opentype'),
21
+ url('../fonts/cartflows-logo-icon.ttf?kxnn1n') format('truetype'),
22
+ url('../fonts/cartflows-logo-icon.woff?kxnn1n') format('woff'),
23
+ url('../fonts/cartflows-logo-icon.svg?kxnn1n#cartflows-logo-icon') format('svg');
24
  font-weight: normal;
25
  font-style: normal;
26
  }
27
 
28
+ .wcf-cartflows-logo-img [class^="cartflows-icon"], .wcf-cartflows-logo-img [class*=" cartflows-icon"], /* For Pro Compatibility */
29
+ [class^="cartflows-logo-icon"], [class*=" cartflows-logo-icon"]{
30
+ /* use !important to prevent issues with browser extensions that change fonts */
31
+ font-family: 'cartflows-logo-icon' !important;
32
  speak: none;
33
  font-style: normal;
34
  font-weight: normal;
39
  -moz-osx-font-smoothing: grayscale;
40
  }
41
 
42
+ .wcf-cartflows-logo-img .cartflows-icon:before, /* For Pro Compatibility */
43
+ .cartflows-logo-icon:before {
44
  content: "\e900";
45
  color: #f16334;
46
  }
admin/assets/css/global-admin.css CHANGED
@@ -15,18 +15,20 @@
15
  * *********************
16
  */
17
  @font-face {
18
- font-family: 'cartflows-icon';
19
- src: url('../fonts/cartflows.eot?vgky31');
20
- src: url('../fonts/cartflows.eot?vgky31#iefix') format('embedded-opentype'),
21
- url('../fonts/cartflows.ttf?vgky31') format('truetype'),
22
- url('../fonts/cartflows.woff?vgky31') format('woff'),
23
- url('../fonts/cartflows.svg?vgky31#cartflows') format('svg');
24
  font-weight: normal;
25
  font-style: normal;
26
  }
27
 
28
- [class^="cartflows-icon"], [class*=" cartflows-icon"] {
29
- font-family: 'cartflows-icon' !important;
 
 
30
  speak: none;
31
  font-style: normal;
32
  font-weight: normal;
@@ -37,7 +39,8 @@
37
  -moz-osx-font-smoothing: grayscale;
38
  }
39
 
40
- .cartflows-icon:before {
 
41
  content: "\e900";
42
  color: #f16334;
43
  }
15
  * *********************
16
  */
17
  @font-face {
18
+ font-family: 'cartflows-logo-icon';
19
+ src: url('../fonts/cartflows-logo-icon.eot?kxnn1n');
20
+ src: url('../fonts/cartflows-logo-icon.eot?kxnn1n#iefix') format('embedded-opentype'),
21
+ url('../fonts/cartflows-logo-icon.ttf?kxnn1n') format('truetype'),
22
+ url('../fonts/cartflows-logo-icon.woff?kxnn1n') format('woff'),
23
+ url('../fonts/cartflows-logo-icon.svg?kxnn1n#cartflows-logo-icon') format('svg');
24
  font-weight: normal;
25
  font-style: normal;
26
  }
27
 
28
+ .wcf-cartflows-logo-img [class^="cartflows-icon"], .wcf-cartflows-logo-img [class*=" cartflows-icon"], /* For Pro Compatibility */
29
+ [class^="cartflows-logo-icon"], [class*=" cartflows-logo-icon"]{
30
+ /* use !important to prevent issues with browser extensions that change fonts */
31
+ font-family: 'cartflows-logo-icon' !important;
32
  speak: none;
33
  font-style: normal;
34
  font-weight: normal;
39
  -moz-osx-font-smoothing: grayscale;
40
  }
41
 
42
+ .wcf-cartflows-logo-img .cartflows-icon:before, /* For Pro Compatibility */
43
+ .cartflows-logo-icon:before {
44
  content: "\e900";
45
  color: #f16334;
46
  }
admin/assets/fonts/cartflows-logo-icon.eot ADDED
Binary file
admin/assets/fonts/cartflows-logo-icon.svg ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Generated by IcoMoon</metadata>
5
+ <defs>
6
+ <font id="cartflows-logo-icon" horiz-adv-x="1024">
7
+ <font-face units-per-em="1024" ascent="960" descent="-64" />
8
+ <missing-glyph horiz-adv-x="1024" />
9
+ <glyph unicode="&#x20;" horiz-adv-x="512" d="" />
10
+ <glyph unicode="&#xe900;" glyph-name="cartflows-logo-icon" d="M635.333 899.541c-37.123-36.153-60.222-86.62-60.222-142.498v-331.108c0-48.732-39.537-88.258-88.258-88.258h-221.971c-48.721 0-88.258 39.537-88.258 88.258s39.537 88.258 88.258 88.258h243.421v176.613h-243.421c-15.080 0-29.782-1.24-44.183-3.665-125.197-20.976-220.699-130.026-220.699-261.206 0-115.335 73.76-213.455 176.624-249.813 14.207-5.023 28.898-8.893 44.086-11.404 14.401-2.425 29.092-3.676 44.183-3.676h221.96c15.080 0 29.782 1.25 44.183 3.676 15.188 2.501 29.868 6.381 44.086 11.404 102.842 36.357 176.602 134.478 176.602 249.813v88.258c97.549 0 176.624 79.085 176.624 176.624h-176.624v66.237c0 12.18 9.863 22.032 22.043 22.032h44.172c53.852 0 102.669 21.364 138.434 56.18 32.197 31.313 53.852 73.372 58.972 120.444h-241.567c-53.755-0.011-102.669-21.375-138.445-56.169zM264.893 116.892c-48.753 0-88.29-39.526-88.29-88.29 0-48.753 39.526-88.29 88.29-88.29s88.29 39.537 88.29 88.29c0 48.764-39.537 88.29-88.29 88.29zM529.774 116.892c-48.764 0-88.301-39.526-88.301-88.29 0-48.753 39.526-88.29 88.301-88.29 48.753 0 88.29 39.537 88.29 88.29 0 48.764-39.537 88.29-88.29 88.29z" />
11
+ </font></defs></svg>
admin/assets/fonts/cartflows-logo-icon.ttf ADDED
Binary file
admin/assets/fonts/cartflows-logo-icon.woff ADDED
Binary file
admin/assets/fonts/cartflows.eot DELETED
Binary file
admin/assets/fonts/cartflows.svg DELETED
@@ -1,11 +0,0 @@
1
- <?xml version="1.0" standalone="no"?>
2
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3
- <svg xmlns="http://www.w3.org/2000/svg">
4
- <metadata>Generated by IcoMoon</metadata>
5
- <defs>
6
- <font id="icomoon" horiz-adv-x="1024">
7
- <font-face units-per-em="1024" ascent="960" descent="-64" />
8
- <missing-glyph horiz-adv-x="1024" />
9
- <glyph unicode="&#x20;" horiz-adv-x="512" d="" />
10
- <glyph unicode="&#xe900;" glyph-name="cartflows-icon" d="M635.333 899.541c-37.123-36.153-60.222-86.62-60.222-142.498v-331.108c0-48.732-39.537-88.258-88.258-88.258h-221.971c-48.721 0-88.258 39.537-88.258 88.258s39.537 88.258 88.258 88.258h243.421v176.613h-243.421c-15.080 0-29.782-1.24-44.183-3.665-125.197-20.976-220.699-130.026-220.699-261.206 0-115.335 73.76-213.455 176.624-249.813 14.207-5.023 28.898-8.893 44.086-11.404 14.401-2.425 29.092-3.676 44.183-3.676h221.96c15.080 0 29.782 1.25 44.183 3.676 15.188 2.501 29.868 6.381 44.086 11.404 102.842 36.357 176.602 134.478 176.602 249.813v88.258c97.549 0 176.624 79.085 176.624 176.624h-176.624v66.237c0 12.18 9.863 22.032 22.043 22.032h44.172c53.852 0 102.669 21.364 138.434 56.18 32.197 31.313 53.852 73.372 58.972 120.444h-241.567c-53.755-0.011-102.669-21.375-138.445-56.169zM264.893 116.892c-48.753 0-88.29-39.526-88.29-88.29 0-48.753 39.526-88.29 88.29-88.29s88.29 39.537 88.29 88.29c0 48.764-39.537 88.29-88.29 88.29zM529.774 116.892c-48.764 0-88.301-39.526-88.301-88.29 0-48.753 39.526-88.29 88.301-88.29 48.753 0 88.29 39.537 88.29 88.29 0 48.764-39.537 88.29-88.29 88.29z" />
11
- </font></defs></svg>
 
 
 
 
 
 
 
 
 
 
 
admin/assets/fonts/cartflows.ttf DELETED
Binary file
admin/assets/fonts/cartflows.woff DELETED
Binary file
assets/css/checkout-template-divi-rtl.css CHANGED
@@ -46,6 +46,37 @@
46
  }
47
 
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  /*.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type="checkbox"]:checked,
50
  .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type="checkbox"]:not(:checked){
51
  color: #666;
46
  }
47
 
48
 
49
+ .cartflows-canvas #page-container{
50
+ padding-top:0px !important;
51
+ }
52
+
53
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-info,
54
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-message,
55
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-message{
56
+ color: inherit !important;
57
+ }
58
+
59
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-error,
60
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-error,
61
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-error{
62
+ background-color: #fff6f6 !important;
63
+ border: dashed 1px #a00 !important;
64
+ padding: 25px 25px 20px !important;
65
+ color: #a00 !important;
66
+ margin: 1rem 0 1rem !important;
67
+ font-size: 14px !important;
68
+ }
69
+
70
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-error li,
71
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-error li,
72
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-error li{
73
+ font-weight: 400 !important;
74
+ }
75
+
76
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-error li strong{
77
+ font-weight: 400;
78
+ }
79
+
80
  /*.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type="checkbox"]:checked,
81
  .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type="checkbox"]:not(:checked){
82
  color: #666;
assets/css/checkout-template-divi.css CHANGED
@@ -46,6 +46,37 @@
46
  }
47
 
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  /*.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type="checkbox"]:checked,
50
  .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type="checkbox"]:not(:checked){
51
  color: #666;
46
  }
47
 
48
 
49
+ .cartflows-canvas #page-container{
50
+ padding-top:0px !important;
51
+ }
52
+
53
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-info,
54
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-message,
55
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-message{
56
+ color: inherit !important;
57
+ }
58
+
59
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-error,
60
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-error,
61
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-error{
62
+ background-color: #fff6f6 !important;
63
+ border: dashed 1px #a00 !important;
64
+ padding: 25px 25px 20px !important;
65
+ color: #a00 !important;
66
+ margin: 1rem 0 1rem !important;
67
+ font-size: 14px !important;
68
+ }
69
+
70
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-error li,
71
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-error li,
72
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-error li{
73
+ font-weight: 400 !important;
74
+ }
75
+
76
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-error li strong{
77
+ font-weight: 400;
78
+ }
79
+
80
  /*.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type="checkbox"]:checked,
81
  .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type="checkbox"]:not(:checked){
82
  color: #666;
assets/css/checkout-template-rtl.css CHANGED
@@ -152,8 +152,8 @@
152
  .wcf-embed-checkout-form .woocommerce .woocommerce-billing-fields [type="checkbox"]:checked:before,
153
  .wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,
154
  .wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type="checkbox"]:checked:before{
155
- content: "\f147";
156
- margin: -3px -4px 0 0;
157
  color: #F16334;
158
  }
159
 
@@ -210,7 +210,7 @@
210
  .wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before{
211
  display: inline-block;
212
  float: right;
213
- font: normal 21px/1 dashicons;
214
  speak: none;
215
  vertical-align: middle;
216
  width: 6px;
@@ -368,6 +368,7 @@
368
 
369
  .wcf-embed-checkout-form #order_review{
370
  padding: 3px;
 
371
  }
372
 
373
  .wcf-embed-checkout-form #order_review .wcf-custom-coupon-field input[type="text"]{
152
  .wcf-embed-checkout-form .woocommerce .woocommerce-billing-fields [type="checkbox"]:checked:before,
153
  .wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,
154
  .wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type="checkbox"]:checked:before{
155
+ content: "\e600";
156
+ margin: 0;
157
  color: #F16334;
158
  }
159
 
210
  .wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before{
211
  display: inline-block;
212
  float: right;
213
+ font: normal 15px/1 cartflows-icon;
214
  speak: none;
215
  vertical-align: middle;
216
  width: 6px;
368
 
369
  .wcf-embed-checkout-form #order_review{
370
  padding: 3px;
371
+ width: 100%;
372
  }
373
 
374
  .wcf-embed-checkout-form #order_review .wcf-custom-coupon-field input[type="text"]{
assets/css/checkout-template.css CHANGED
@@ -152,8 +152,8 @@
152
  .wcf-embed-checkout-form .woocommerce .woocommerce-billing-fields [type="checkbox"]:checked:before,
153
  .wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,
154
  .wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type="checkbox"]:checked:before{
155
- content: "\f147";
156
- margin: -3px 0 0 -4px;
157
  color: #F16334;
158
  }
159
 
@@ -210,7 +210,7 @@
210
  .wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before{
211
  display: inline-block;
212
  float: left;
213
- font: normal 21px/1 dashicons;
214
  speak: none;
215
  vertical-align: middle;
216
  width: 6px;
@@ -368,6 +368,7 @@
368
 
369
  .wcf-embed-checkout-form #order_review{
370
  padding: 3px;
 
371
  }
372
 
373
  .wcf-embed-checkout-form #order_review .wcf-custom-coupon-field input[type="text"]{
152
  .wcf-embed-checkout-form .woocommerce .woocommerce-billing-fields [type="checkbox"]:checked:before,
153
  .wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,
154
  .wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type="checkbox"]:checked:before{
155
+ content: "\e600";
156
+ margin: 0;
157
  color: #F16334;
158
  }
159
 
210
  .wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before{
211
  display: inline-block;
212
  float: left;
213
+ font: normal 15px/1 cartflows-icon;
214
  speak: none;
215
  vertical-align: middle;
216
  width: 6px;
368
 
369
  .wcf-embed-checkout-form #order_review{
370
  padding: 3px;
371
+ width: 100%;
372
  }
373
 
374
  .wcf-embed-checkout-form #order_review .wcf-custom-coupon-field input[type="text"]{
assets/css/frontend-rtl.css CHANGED
@@ -8,6 +8,46 @@ html {
8
  -webkit-text-size-adjust: 100%; /* 2 */
9
  }
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  /* Sections
12
  ========================================================================== */
13
 
8
  -webkit-text-size-adjust: 100%; /* 2 */
9
  }
10
 
11
+ /* Addition
12
+ ========================================================================== */
13
+
14
+ @font-face {
15
+ font-family: 'cartflows-icon';
16
+ src: url('../fonts/cartflows-icon.eot?81m15v');
17
+ src: url('../fonts/cartflows-icon.eot?81m15v#iefix') format('embedded-opentype'),
18
+ url('../fonts/cartflows-icon.ttf?81m15v') format('truetype'),
19
+ url('../fonts/cartflows-icon.woff?81m15v') format('woff'),
20
+ url('../fonts/cartflows-icon.svg?81m15v#cartflows-icon') format('svg');
21
+ font-weight: normal;
22
+ font-style: normal;
23
+ }
24
+
25
+ .cartflows-icon {
26
+ /* use !important to prevent issues with browser extensions that change fonts */
27
+ font-family: 'cartflows-icon' !important;
28
+ speak: none;
29
+ font-style: normal;
30
+ font-weight: normal;
31
+ font-variant: normal;
32
+ text-transform: none;
33
+ line-height: 1;
34
+
35
+ /* Better Font Rendering =========== */
36
+ -webkit-font-smoothing: antialiased;
37
+ -moz-osx-font-smoothing: grayscale;
38
+ }
39
+
40
+ .cartflows-icon-close:before {
41
+ content: "\e602";
42
+ font-family: 'cartflows-icon';
43
+ }
44
+ .cartflows-icon-cross:before {
45
+ content: "\e601";
46
+ }
47
+ .cartflows-icon-check:before {
48
+ content: "\e600";
49
+ }
50
+
51
  /* Sections
52
  ========================================================================== */
53
 
assets/css/frontend.css CHANGED
@@ -8,6 +8,46 @@ html {
8
  -webkit-text-size-adjust: 100%; /* 2 */
9
  }
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  /* Sections
12
  ========================================================================== */
13
 
8
  -webkit-text-size-adjust: 100%; /* 2 */
9
  }
10
 
11
+ /* Addition
12
+ ========================================================================== */
13
+
14
+ @font-face {
15
+ font-family: 'cartflows-icon';
16
+ src: url('../fonts/cartflows-icon.eot?81m15v');
17
+ src: url('../fonts/cartflows-icon.eot?81m15v#iefix') format('embedded-opentype'),
18
+ url('../fonts/cartflows-icon.ttf?81m15v') format('truetype'),
19
+ url('../fonts/cartflows-icon.woff?81m15v') format('woff'),
20
+ url('../fonts/cartflows-icon.svg?81m15v#cartflows-icon') format('svg');
21
+ font-weight: normal;
22
+ font-style: normal;
23
+ }
24
+
25
+ .cartflows-icon {
26
+ /* use !important to prevent issues with browser extensions that change fonts */
27
+ font-family: 'cartflows-icon' !important;
28
+ speak: none;
29
+ font-style: normal;
30
+ font-weight: normal;
31
+ font-variant: normal;
32
+ text-transform: none;
33
+ line-height: 1;
34
+
35
+ /* Better Font Rendering =========== */
36
+ -webkit-font-smoothing: antialiased;
37
+ -moz-osx-font-smoothing: grayscale;
38
+ }
39
+
40
+ .cartflows-icon-close:before {
41
+ content: "\e602";
42
+ font-family: 'cartflows-icon';
43
+ }
44
+ .cartflows-icon-cross:before {
45
+ content: "\e601";
46
+ }
47
+ .cartflows-icon-check:before {
48
+ content: "\e600";
49
+ }
50
+
51
  /* Sections
52
  ========================================================================== */
53
 
assets/fonts/cartflows-icon.eot ADDED
Binary file
assets/fonts/cartflows-icon.svg ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Generated by IcoMoon</metadata>
5
+ <defs>
6
+ <font id="cartflows-icon" horiz-adv-x="1024">
7
+ <font-face units-per-em="1024" ascent="960" descent="-64" />
8
+ <missing-glyph horiz-adv-x="1024" />
9
+ <glyph unicode="&#x20;" horiz-adv-x="512" d="" />
10
+ <glyph unicode="&#xe600;" glyph-name="check" d="M424.653 102.502c-22.272 0-43.366 10.394-56.883 28.314l-182.938 241.715c-23.808 31.386-17.613 76.083 13.824 99.891 31.488 23.91 76.186 17.613 99.994-13.824l120.371-158.925 302.643 485.99c20.838 33.382 64.87 43.622 98.355 22.784 33.434-20.787 43.725-64.819 22.835-98.304l-357.581-573.952c-12.39-20.019-33.843-32.512-57.344-33.587-1.126-0.102-2.15-0.102-3.277-0.102z" />
11
+ <glyph unicode="&#xe601;" glyph-name="cross" d="M1014.662 137.34c-0.004 0.004-0.008 0.008-0.012 0.010l-310.644 310.65 310.644 310.65c0.004 0.004 0.008 0.006 0.012 0.010 3.344 3.346 5.762 7.254 7.312 11.416 4.246 11.376 1.824 24.682-7.324 33.83l-146.746 146.746c-9.148 9.146-22.45 11.566-33.828 7.32-4.16-1.55-8.070-3.968-11.418-7.31 0-0.004-0.004-0.006-0.008-0.010l-310.648-310.652-310.648 310.65c-0.004 0.004-0.006 0.006-0.010 0.010-3.346 3.342-7.254 5.76-11.414 7.31-11.38 4.248-24.682 1.826-33.83-7.32l-146.748-146.748c-9.148-9.148-11.568-22.452-7.322-33.828 1.552-4.16 3.97-8.072 7.312-11.416 0.004-0.002 0.006-0.006 0.010-0.010l310.65-310.648-310.65-310.652c-0.002-0.004-0.006-0.006-0.008-0.010-3.342-3.346-5.76-7.254-7.314-11.414-4.248-11.376-1.826-24.682 7.322-33.83l146.748-146.746c9.15-9.148 22.452-11.568 33.83-7.322 4.16 1.552 8.070 3.97 11.416 7.312 0.002 0.004 0.006 0.006 0.010 0.010l310.648 310.65 310.648-310.65c0.004-0.002 0.008-0.006 0.012-0.008 3.348-3.344 7.254-5.762 11.414-7.314 11.378-4.246 24.684-1.826 33.828 7.322l146.746 146.748c9.148 9.148 11.57 22.454 7.324 33.83-1.552 4.16-3.97 8.068-7.314 11.414z" />
12
+ <glyph unicode="&#xe602;" glyph-name="close" d="M810 664.667l-238-238 238-238-60-60-238 238-238-238-60 60 238 238-238 238 60 60 238-238 238 238z" />
13
+ </font></defs></svg>
assets/fonts/cartflows-icon.ttf ADDED
Binary file
assets/fonts/cartflows-icon.woff ADDED
Binary file
cartflows.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: CartFlows
4
  * Plugin URI: https://cartflows.com/
5
  * Description: Create beautiful checkout pages & sales flows for WooCommerce.
6
- * Version: 1.1.10
7
  * Author: CartFlows Inc
8
  * Author URI: https://cartflows.com/
9
  * Text Domain: cartflows
@@ -19,6 +19,6 @@
19
  define( 'CARTFLOWS_FILE', __FILE__ );
20
 
21
  /**
22
- * Extensions
23
  */
24
  require_once 'classes/class-cartflows-loader.php';
3
  * Plugin Name: CartFlows
4
  * Plugin URI: https://cartflows.com/
5
  * Description: Create beautiful checkout pages & sales flows for WooCommerce.
6
+ * Version: 1.1.11
7
  * Author: CartFlows Inc
8
  * Author URI: https://cartflows.com/
9
  * Text Domain: cartflows
19
  define( 'CARTFLOWS_FILE', __FILE__ );
20
 
21
  /**
22
+ * Loader
23
  */
24
  require_once 'classes/class-cartflows-loader.php';
changelog.txt CHANGED
@@ -1,3 +1,8 @@
 
 
 
 
 
1
  Version 1.1.10 - Wednesday, 6th March 2019
2
  - Fix: Divi builder next step link issue.
3
 
@@ -11,7 +16,7 @@ Version 1.1.8 - Wednesday, 27th February 2019
11
  - Fix: Divi flow importer style tag issue.
12
 
13
  Version 1.1.7 - Monday, 25th February 2019
14
- - New: DIVI templates.
15
  - Fix: Shipping fields label issue.
16
 
17
  Version 1.1.6 - Thursday, 07th February 2019
1
+ Version 1.1.11 - Tuesday, 19th March 2019
2
+ - Fix: Checkbox tick on checkout was not visible in some cases.
3
+ - Fix: Width issue of order review.
4
+ - Fix: Selling the wrong main product in firefox.
5
+
6
  Version 1.1.10 - Wednesday, 6th March 2019
7
  - Fix: Divi builder next step link issue.
8
 
16
  - Fix: Divi flow importer style tag issue.
17
 
18
  Version 1.1.7 - Monday, 25th February 2019
19
+ - New: Divi templates.
20
  - Fix: Shipping fields label issue.
21
 
22
  Version 1.1.6 - Thursday, 07th February 2019
classes/class-cartflows-admin.php CHANGED
@@ -1,437 +1,437 @@
1
- <?php
2
- /**
3
- * CartFlows Admin.
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- /**
9
- * Class Cartflows_Admin.
10
- */
11
- class Cartflows_Admin {
12
-
13
- /**
14
- * Calls on initialization
15
- *
16
- * @since 1.0.0
17
- */
18
- public static function init() {
19
-
20
- self::initialise_plugin();
21
- self::init_hooks();
22
- }
23
-
24
- /**
25
- * Init Hooks.
26
- *
27
- * @since 1.0.0
28
- * @return void
29
- */
30
- static public function init_hooks() {
31
-
32
- if ( ! is_admin() ) {
33
- return;
34
- }
35
-
36
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-admin-fields.php';
37
-
38
- // Add CARTFLOWS menu option to admin.
39
- add_action( 'network_admin_menu', __CLASS__ . '::menu' );
40
- add_action( 'admin_menu', __CLASS__ . '::menu' );
41
- add_action( 'admin_menu', __CLASS__ . '::submenu', 999 );
42
-
43
- add_action( 'cartflows_render_admin_content', __CLASS__ . '::render_content' );
44
-
45
- // Enqueue admin scripts.
46
- if ( isset( $_REQUEST['page'] ) && CARTFLOWS_SETTINGS == $_REQUEST['page'] ) {
47
-
48
- add_action( 'admin_enqueue_scripts', __CLASS__ . '::styles_scripts' );
49
-
50
- self::save_settings();
51
- }
52
-
53
- /* Global Addmin Script */
54
- add_action( 'admin_enqueue_scripts', __CLASS__ . '::global_admin_scripts', 20 );
55
-
56
- add_action( 'admin_footer', __CLASS__ . '::global_admin_data', 9555 );
57
-
58
- /* Add lite version class to body */
59
- add_action( 'admin_body_class', __CLASS__ . '::add_admin_body_class' );
60
- }
61
-
62
- /**
63
- * Initialises the Plugin Name.
64
- *
65
- * @since 1.0.0
66
- * @return void
67
- */
68
- static public function initialise_plugin() {
69
-
70
- $name = 'Cartflows';
71
- $short_name = 'Cflows';
72
-
73
- define( 'CARTFLOWS_PLUGIN_NAME', $name );
74
- define( 'CARTFLOWS_PLUGIN_SHORT_NAME', $short_name );
75
- }
76
-
77
- /**
78
- * Renders the admin settings menu.
79
- *
80
- * @since 1.0.0
81
- * @return void
82
- */
83
- static public function menu() {
84
-
85
- if ( ! current_user_can( 'manage_options' ) ) {
86
- return;
87
- }
88
-
89
- add_menu_page(
90
- 'CartFlows',
91
- 'CartFlows',
92
- 'manage_options',
93
- CARTFLOWS_SLUG,
94
- __CLASS__ . '::render',
95
- 'data:image/svg+xml;base64,' . base64_encode( file_get_contents( CARTFLOWS_DIR . 'assets/images/cartflows-icon.svg' ) ),
96
- 39.7
97
- );
98
-
99
- }
100
-
101
- /**
102
- * Add submenu to admin menu.
103
- *
104
- * @since 1.0.0
105
- */
106
- static function submenu() {
107
-
108
- $parent_slug = CARTFLOWS_SLUG;
109
- $page_title = __( 'Settings', 'cartflows' );
110
- $menu_title = __( 'Settings', 'cartflows' );
111
- $capability = 'manage_options';
112
- $menu_slug = 'cartflows_settings';
113
- $callback = __CLASS__ . '::render';
114
-
115
- add_submenu_page(
116
- $parent_slug,
117
- $page_title,
118
- $menu_title,
119
- $capability,
120
- $menu_slug,
121
- $callback
122
- );
123
- }
124
-
125
- /**
126
- * Renders the admin settings.
127
- *
128
- * @since 1.0.0
129
- * @return void
130
- */
131
- static public function render() {
132
- $action = ( isset( $_GET['action'] ) ) ? sanitize_text_field( $_GET['action'] ) : '';
133
- $action = ( ! empty( $action ) && '' != $action ) ? $action : 'general';
134
- $action = str_replace( '_', '-', $action );
135
-
136
- // Enable header icon filter below.
137
- $header_wrapper_class = apply_filters( 'cartflows_header_wrapper_class', array( $action ) );
138
-
139
- include_once CARTFLOWS_DIR . 'includes/admin/cartflows-admin.php';
140
- }
141
-
142
- /**
143
- * Renders the admin settings content.
144
- *
145
- * @since 1.0.0
146
- * @return void
147
- */
148
- static public function render_content() {
149
-
150
- $action = ( isset( $_GET['action'] ) ) ? sanitize_text_field( $_GET['action'] ) : '';
151
- $action = ( ! empty( $action ) && '' != $action ) ? $action : 'general';
152
- $action = str_replace( '_', '-', $action );
153
- $action = 'general';
154
-
155
- $header_wrapper_class = apply_filters( 'cartflows_header_wrapper_class', array( $action ) );
156
-
157
- include_once CARTFLOWS_DIR . 'includes/admin/cartflows-general.php';
158
- }
159
-
160
- /**
161
- * Save Global Setting options.
162
- *
163
- * @since 1.0.0
164
- */
165
- static public function save_common_settings() {
166
-
167
- if ( isset( $_POST['cartflows-common-settings-nonce'] ) && wp_verify_nonce( $_POST['cartflows-common-settings-nonce'], 'cartflows-common-settings' ) ) {
168
-
169
- $url = $_SERVER['REQUEST_URI'];
170
- $input_settings = array();
171
- $new_settings = array();
172
-
173
- if ( isset( $_POST['_cartflows_common'] ) ) {
174
-
175
- $input_settings = $_POST['_cartflows_common'];
176
-
177
- // Loop through the input and sanitize each of the values.
178
- foreach ( $input_settings as $key => $val ) {
179
-
180
- if ( is_array( $val ) ) {
181
- foreach ( $val as $k => $v ) {
182
- $new_settings[ $key ][ $k ] = ( isset( $val[ $k ] ) ) ? sanitize_text_field( $v ) : '';
183
- }
184
- } else {
185
- $new_settings[ $key ] = ( isset( $input_settings[ $key ] ) ) ? sanitize_text_field( $val ) : '';
186
- }
187
- }
188
- }
189
-
190
- Cartflows_Helper::update_admin_settings_option( '_cartflows_common', $new_settings, true );
191
-
192
- $query = array(
193
- 'message' => 'saved',
194
- );
195
-
196
- $redirect_to = add_query_arg( $query, $url );
197
-
198
- wp_redirect( $redirect_to );
199
- exit;
200
- } // End if statement.
201
- }
202
-
203
- /**
204
- * Check is cartflows admin.
205
- *
206
- * @since 1.0.0
207
- * @return boolean
208
- */
209
- static public function is_global_admin() {
210
-
211
- $current_screen = get_current_screen();
212
-
213
- if (
214
- is_object( $current_screen ) &&
215
- isset( $current_screen->post_type ) &&
216
- ( CARTFLOWS_FLOW_POST_TYPE === $current_screen->post_type ||
217
- CARTFLOWS_STEP_POST_TYPE === $current_screen->post_type
218
- )
219
- ) {
220
- return true;
221
- }
222
- return false;
223
- }
224
-
225
- /**
226
- * Check is flow admin.
227
- *
228
- * @since 1.0.0
229
- * @return boolean
230
- */
231
- static public function is_flow_edit_admin() {
232
-
233
- $current_screen = get_current_screen();
234
-
235
- if (
236
- is_object( $current_screen ) &&
237
- isset( $current_screen->post_type ) &&
238
- ( CARTFLOWS_FLOW_POST_TYPE === $current_screen->post_type ) &&
239
- isset( $current_screen->base ) &&
240
- ( 'post' === $current_screen->base )
241
- ) {
242
- return true;
243
- }
244
- return false;
245
- }
246
-
247
- /**
248
- * Global Admin Scripts.
249
- *
250
- * @since 1.0.0
251
- */
252
- static public function global_admin_scripts() {
253
-
254
- $localize = array(
255
- 'ajaxurl' => admin_url( 'admin-ajax.php' ),
256
- 'ajax_nonce' => wp_create_nonce( 'cartflows-nonce' ),
257
- );
258
-
259
- wp_localize_script( 'jquery', 'cartflows_admin', apply_filters( 'cartflows_admin_js_localize', $localize ) );
260
-
261
- if ( self::is_global_admin() ) {
262
-
263
- // Styles.
264
- wp_enqueue_style( 'cartflows-global-admin', CARTFLOWS_URL . 'admin/assets/css/global-admin.css', array(), CARTFLOWS_VER );
265
- wp_style_add_data( 'cartflows-global-admin', 'rtl', 'replace' );
266
-
267
- wp_enqueue_script(
268
- 'wcf-global-admin',
269
- CARTFLOWS_URL . 'admin/assets/js/global-admin.js',
270
- array( 'jquery' ),
271
- CARTFLOWS_VER,
272
- true
273
- );
274
-
275
- do_action( 'cartflows_global_admin_scripts' );
276
- }
277
- }
278
-
279
- /**
280
- * Global Admin Data.
281
- *
282
- * @since 1.0.0
283
- */
284
- static public function global_admin_data() {
285
-
286
- $current_screen = get_current_screen();
287
-
288
- if ( ! $current_screen ) {
289
- return;
290
- }
291
-
292
- if ( 'edit-' . CARTFLOWS_FLOW_POST_TYPE != $current_screen->id ) {
293
- return;
294
- }
295
-
296
- $default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
297
- ?>
298
-
299
- <div id="wcf-remote-flow-importer" class="wcf-templates-popup-overlay">
300
- <div class="wcf-templates-popup-content">
301
- <div class="spinner"></div>
302
- <div class="wcf-templates-wrap wcf-templates-wrap-flows">
303
-
304
- <div id="wcf-remote-flow-actions" class="wcf-template-header">
305
- <div class="wcf-template-logo-wrap">
306
- <span class="wcf-cartflows-logo-img">
307
- <span class="cartflows-icon"></span>
308
- </span>
309
- <span class="wcf-cartflows-title"><?php _e( 'Flows Library', 'cartflows' ); ?></span>
310
- </div>
311
- <div class="wcf-tab-wrapper">
312
- <?php if ( 'other' !== $default_page_builder ) { ?>
313
- <div id="wcf-get-started-steps">
314
- <ul class="filter-links ">
315
- <li>
316
- <a href="#" class="current" data-slug="ready-templates" data-title="<?php _e( 'Ready Templates', 'cartflows' ); ?>"><?php _e( 'Ready Templates', 'cartflows' ); ?></a>
317
- </li>
318
- <li>
319
- <a href="#" data-slug="canvas" data-title="<?php _e( 'Create Your Own', 'cartflows' ); ?>"><?php _e( 'Create Your Own', 'cartflows' ); ?></a>
320
- </li>
321
- </ul>
322
- </div>
323
- <?php } ?>
324
- </div>
325
- <div class="wcf-popup-close-wrap">
326
- <span class="close-icon"><span class="wcf-cartflow-icons dashicons dashicons-no"></span></span>
327
- </div>
328
- </div>
329
- <!-- <div class="wcf-search-form">
330
- <label class="screen-reader-text" for="wp-filter-search-input"><?php _e( 'Search Sites', 'cartflows' ); ?> </label>
331
- <input placeholder="<?php _e( 'Search Flow...', 'cartflows' ); ?>" type="text" aria-describedby="live-search-desc" class="wcf-flow-search-input">
332
- </div> -->
333
-
334
- <div id="wcf-remote-content">
335
- <?php if ( 'other' !== $default_page_builder ) { ?>
336
- <div id="wcf-ready-templates">
337
- <div id="wcf-remote-filters">
338
- <div id="wcf-page-builders"></div>
339
- <div id="wcf-categories"></div>
340
- </div>
341
- <div class="wcf-page-builder-notice"></div>
342
- <div id="wcf-remote-flow-list" class="wcf-remote-list wcf-template-list-wrap"><span class="spinner is-active"></span></div>
343
- <div id="wcf-upcoming-page-builders" style="display: none;" class="wcf-remote-list wcf-template-list-wrap"></div>
344
- </div>
345
- <?php } ?>
346
- <div id="wcf-start-from-scratch" style="<?php echo ( 'other' !== $default_page_builder ) ? 'display: none;' : ''; ?>">
347
- <div class="inner">
348
- <a href="#" class="button button-hero button-primary cartflows-flow-import-blank"><?php _e( 'Design Your Flow', 'cartflows' ); ?></a>
349
- <p class="wcf-learn-how"><a href="https://cartflows.com/docs/cartflows-step-types/" target="_blank"><?php _e( 'Learn How', 'cartflows' ); ?> <i class="dashicons dashicons-external"></i></a></p>
350
- </div>
351
- </div>
352
- </div>
353
- </div>
354
- </div>
355
- </div>
356
-
357
- <?php
358
- }
359
-
360
- /**
361
- * Enqueues the needed CSS/JS for the builder's admin settings page.
362
- *
363
- * @since 1.0.0
364
- */
365
- static public function styles_scripts() {
366
-
367
- // Styles.
368
- wp_enqueue_style( 'cartflows-admin-settings', CARTFLOWS_URL . 'admin/assets/css/admin-menu-settings.css', array(), CARTFLOWS_VER );
369
- wp_style_add_data( 'cartflows-admin-settings', 'rtl', 'replace' );
370
-
371
- // Script.
372
- wp_enqueue_script( 'cartflows-admin-settings', CARTFLOWS_URL . 'admin/assets/js/admin-menu-settings.js', array( 'jquery', 'wp-util', 'updates' ), CARTFLOWS_VER );
373
-
374
- $localize = array(
375
- 'ajax_nonce' => wp_create_nonce( 'cartflows-widget-nonce' ),
376
- );
377
-
378
- wp_localize_script( 'cartflows-admin-settings', 'cartflows', apply_filters( 'cartflows_js_localize', $localize ) );
379
- }
380
-
381
- /**
382
- * Save All admin settings here
383
- */
384
- static public function save_settings() {
385
-
386
- // Only admins can save settings.
387
- if ( ! current_user_can( 'manage_options' ) ) {
388
- return;
389
- }
390
-
391
- self::save_common_settings();
392
-
393
- // Let extensions hook into saving.
394
- do_action( 'cartflows_admin_settings_save' );
395
- }
396
-
397
- /**
398
- * Get and return page URL
399
- *
400
- * @param string $menu_slug Menu name.
401
- * @since 1.0.0
402
- * @return string page url
403
- */
404
- static public function get_page_url( $menu_slug ) {
405
-
406
- $parent_page = self::$default_menu_position;
407
-
408
- if ( strpos( $parent_page, '?' ) !== false ) {
409
- $query_var = '&page=' . self::$plugin_slug;
410
- } else {
411
- $query_var = '?page=' . self::$plugin_slug;
412
- }
413
-
414
- $parent_page_url = admin_url( $parent_page . $query_var );
415
-
416
- $url = $parent_page_url . '&action=' . $menu_slug;
417
-
418
- return esc_url( $url );
419
- }
420
-
421
- /**
422
- * Admin body classes.
423
- *
424
- * Body classes to be added to <body> tag in admin page
425
- *
426
- * @param String $classes body classes returned from the filter.
427
- * @return String body classes to be added to <body> tag in admin page
428
- */
429
- static public function add_admin_body_class( $classes ) {
430
-
431
- $classes .= ' cartflows-' . CARTFLOWS_VER;
432
-
433
- return $classes;
434
- }
435
- }
436
-
437
- Cartflows_Admin::init();
1
+ <?php
2
+ /**
3
+ * CartFlows Admin.
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ /**
9
+ * Class Cartflows_Admin.
10
+ */
11
+ class Cartflows_Admin {
12
+
13
+ /**
14
+ * Calls on initialization
15
+ *
16
+ * @since 1.0.0
17
+ */
18
+ public static function init() {
19
+
20
+ self::initialise_plugin();
21
+ self::init_hooks();
22
+ }
23
+
24
+ /**
25
+ * Init Hooks.
26
+ *
27
+ * @since 1.0.0
28
+ * @return void
29
+ */
30
+ static public function init_hooks() {
31
+
32
+ if ( ! is_admin() ) {
33
+ return;
34
+ }
35
+
36
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-admin-fields.php';
37
+
38
+ // Add CARTFLOWS menu option to admin.
39
+ add_action( 'network_admin_menu', __CLASS__ . '::menu' );
40
+ add_action( 'admin_menu', __CLASS__ . '::menu' );
41
+ add_action( 'admin_menu', __CLASS__ . '::submenu', 999 );
42
+
43
+ add_action( 'cartflows_render_admin_content', __CLASS__ . '::render_content' );
44
+
45
+ // Enqueue admin scripts.
46
+ if ( isset( $_REQUEST['page'] ) && CARTFLOWS_SETTINGS == $_REQUEST['page'] ) {
47
+
48
+ add_action( 'admin_enqueue_scripts', __CLASS__ . '::styles_scripts' );
49
+
50
+ self::save_settings();
51
+ }
52
+
53
+ /* Global Addmin Script */
54
+ add_action( 'admin_enqueue_scripts', __CLASS__ . '::global_admin_scripts', 20 );
55
+
56
+ add_action( 'admin_footer', __CLASS__ . '::global_admin_data', 9555 );
57
+
58
+ /* Add lite version class to body */
59
+ add_action( 'admin_body_class', __CLASS__ . '::add_admin_body_class' );
60
+ }
61
+
62
+ /**
63
+ * Initialises the Plugin Name.
64
+ *
65
+ * @since 1.0.0
66
+ * @return void
67
+ */
68
+ static public function initialise_plugin() {
69
+
70
+ $name = 'Cartflows';
71
+ $short_name = 'Cflows';
72
+
73
+ define( 'CARTFLOWS_PLUGIN_NAME', $name );
74
+ define( 'CARTFLOWS_PLUGIN_SHORT_NAME', $short_name );
75
+ }
76
+
77
+ /**
78
+ * Renders the admin settings menu.
79
+ *
80
+ * @since 1.0.0
81
+ * @return void
82
+ */
83
+ static public function menu() {
84
+
85
+ if ( ! current_user_can( 'manage_options' ) ) {
86
+ return;
87
+ }
88
+
89
+ add_menu_page(
90
+ 'CartFlows',
91
+ 'CartFlows',
92
+ 'manage_options',
93
+ CARTFLOWS_SLUG,
94
+ __CLASS__ . '::render',
95
+ 'data:image/svg+xml;base64,' . base64_encode( file_get_contents( CARTFLOWS_DIR . 'assets/images/cartflows-icon.svg' ) ),
96
+ 39.7
97
+ );
98
+
99
+ }
100
+
101
+ /**
102
+ * Add submenu to admin menu.
103
+ *
104
+ * @since 1.0.0
105
+ */
106
+ static function submenu() {
107
+
108
+ $parent_slug = CARTFLOWS_SLUG;
109
+ $page_title = __( 'Settings', 'cartflows' );
110
+ $menu_title = __( 'Settings', 'cartflows' );
111
+ $capability = 'manage_options';
112
+ $menu_slug = 'cartflows_settings';
113
+ $callback = __CLASS__ . '::render';
114
+
115
+ add_submenu_page(
116
+ $parent_slug,
117
+ $page_title,
118
+ $menu_title,
119
+ $capability,
120
+ $menu_slug,
121
+ $callback
122
+ );
123
+ }
124
+
125
+ /**
126
+ * Renders the admin settings.
127
+ *
128
+ * @since 1.0.0
129
+ * @return void
130
+ */
131
+ static public function render() {
132
+ $action = ( isset( $_GET['action'] ) ) ? sanitize_text_field( $_GET['action'] ) : '';
133
+ $action = ( ! empty( $action ) && '' != $action ) ? $action : 'general';
134
+ $action = str_replace( '_', '-', $action );
135
+
136
+ // Enable header icon filter below.
137
+ $header_wrapper_class = apply_filters( 'cartflows_header_wrapper_class', array( $action ) );
138
+
139
+ include_once CARTFLOWS_DIR . 'includes/admin/cartflows-admin.php';
140
+ }
141
+
142
+ /**
143
+ * Renders the admin settings content.
144
+ *
145
+ * @since 1.0.0
146
+ * @return void
147
+ */
148
+ static public function render_content() {
149
+
150
+ $action = ( isset( $_GET['action'] ) ) ? sanitize_text_field( $_GET['action'] ) : '';
151
+ $action = ( ! empty( $action ) && '' != $action ) ? $action : 'general';
152
+ $action = str_replace( '_', '-', $action );
153
+ $action = 'general';
154
+
155
+ $header_wrapper_class = apply_filters( 'cartflows_header_wrapper_class', array( $action ) );
156
+
157
+ include_once CARTFLOWS_DIR . 'includes/admin/cartflows-general.php';
158
+ }
159
+
160
+ /**
161
+ * Save Global Setting options.
162
+ *
163
+ * @since 1.0.0
164
+ */
165
+ static public function save_common_settings() {
166
+
167
+ if ( isset( $_POST['cartflows-common-settings-nonce'] ) && wp_verify_nonce( $_POST['cartflows-common-settings-nonce'], 'cartflows-common-settings' ) ) {
168
+
169
+ $url = $_SERVER['REQUEST_URI'];
170
+ $input_settings = array();
171
+ $new_settings = array();
172
+
173
+ if ( isset( $_POST['_cartflows_common'] ) ) {
174
+
175
+ $input_settings = $_POST['_cartflows_common'];
176
+
177
+ // Loop through the input and sanitize each of the values.
178
+ foreach ( $input_settings as $key => $val ) {
179
+
180
+ if ( is_array( $val ) ) {
181
+ foreach ( $val as $k => $v ) {
182
+ $new_settings[ $key ][ $k ] = ( isset( $val[ $k ] ) ) ? sanitize_text_field( $v ) : '';
183
+ }
184
+ } else {
185
+ $new_settings[ $key ] = ( isset( $input_settings[ $key ] ) ) ? sanitize_text_field( $val ) : '';
186
+ }
187
+ }
188
+ }
189
+
190
+ Cartflows_Helper::update_admin_settings_option( '_cartflows_common', $new_settings, true );
191
+
192
+ $query = array(
193
+ 'message' => 'saved',
194
+ );
195
+
196
+ $redirect_to = add_query_arg( $query, $url );
197
+
198
+ wp_redirect( $redirect_to );
199
+ exit;
200
+ } // End if statement.
201
+ }
202
+
203
+ /**
204
+ * Check is cartflows admin.
205
+ *
206
+ * @since 1.0.0
207
+ * @return boolean
208
+ */
209
+ static public function is_global_admin() {
210
+
211
+ $current_screen = get_current_screen();
212
+
213
+ if (
214
+ is_object( $current_screen ) &&
215
+ isset( $current_screen->post_type ) &&
216
+ ( CARTFLOWS_FLOW_POST_TYPE === $current_screen->post_type ||
217
+ CARTFLOWS_STEP_POST_TYPE === $current_screen->post_type
218
+ )
219
+ ) {
220
+ return true;
221
+ }
222
+ return false;
223
+ }
224
+
225
+ /**
226
+ * Check is flow admin.
227
+ *
228
+ * @since 1.0.0
229
+ * @return boolean
230
+ */
231
+ static public function is_flow_edit_admin() {
232
+
233
+ $current_screen = get_current_screen();
234
+
235
+ if (
236
+ is_object( $current_screen ) &&
237
+ isset( $current_screen->post_type ) &&
238
+ ( CARTFLOWS_FLOW_POST_TYPE === $current_screen->post_type ) &&
239
+ isset( $current_screen->base ) &&
240
+ ( 'post' === $current_screen->base )
241
+ ) {
242
+ return true;
243
+ }
244
+ return false;
245
+ }
246
+
247
+ /**
248
+ * Global Admin Scripts.
249
+ *
250
+ * @since 1.0.0
251
+ */
252
+ static public function global_admin_scripts() {
253
+
254
+ $localize = array(
255
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
256
+ 'ajax_nonce' => wp_create_nonce( 'cartflows-nonce' ),
257
+ );
258
+
259
+ wp_localize_script( 'jquery', 'cartflows_admin', apply_filters( 'cartflows_admin_js_localize', $localize ) );
260
+
261
+ if ( self::is_global_admin() ) {
262
+
263
+ // Styles.
264
+ wp_enqueue_style( 'cartflows-global-admin', CARTFLOWS_URL . 'admin/assets/css/global-admin.css', array(), CARTFLOWS_VER );
265
+ wp_style_add_data( 'cartflows-global-admin', 'rtl', 'replace' );
266
+
267
+ wp_enqueue_script(
268
+ 'wcf-global-admin',
269
+ CARTFLOWS_URL . 'admin/assets/js/global-admin.js',
270
+ array( 'jquery' ),
271
+ CARTFLOWS_VER,
272
+ true
273
+ );
274
+
275
+ do_action( 'cartflows_global_admin_scripts' );
276
+ }
277
+ }
278
+
279
+ /**
280
+ * Global Admin Data.
281
+ *
282
+ * @since 1.0.0
283
+ */
284
+ static public function global_admin_data() {
285
+
286
+ $current_screen = get_current_screen();
287
+
288
+ if ( ! $current_screen ) {
289
+ return;
290
+ }
291
+
292
+ if ( 'edit-' . CARTFLOWS_FLOW_POST_TYPE != $current_screen->id ) {
293
+ return;
294
+ }
295
+
296
+ $default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
297
+ ?>
298
+
299
+ <div id="wcf-remote-flow-importer" class="wcf-templates-popup-overlay">
300
+ <div class="wcf-templates-popup-content">
301
+ <div class="spinner"></div>
302
+ <div class="wcf-templates-wrap wcf-templates-wrap-flows">
303
+
304
+ <div id="wcf-remote-flow-actions" class="wcf-template-header">
305
+ <div class="wcf-template-logo-wrap">
306
+ <span class="wcf-cartflows-logo-img">
307
+ <span class="cartflows-logo-icon"></span>
308
+ </span>
309
+ <span class="wcf-cartflows-title"><?php _e( 'Flows Library', 'cartflows' ); ?></span>
310
+ </div>
311
+ <div class="wcf-tab-wrapper">
312
+ <?php if ( 'other' !== $default_page_builder ) { ?>
313
+ <div id="wcf-get-started-steps">
314
+ <ul class="filter-links ">
315
+ <li>
316
+ <a href="#" class="current" data-slug="ready-templates" data-title="<?php _e( 'Ready Templates', 'cartflows' ); ?>"><?php _e( 'Ready Templates', 'cartflows' ); ?></a>
317
+ </li>
318
+ <li>
319
+ <a href="#" data-slug="canvas" data-title="<?php _e( 'Create Your Own', 'cartflows' ); ?>"><?php _e( 'Create Your Own', 'cartflows' ); ?></a>
320
+ </li>
321
+ </ul>
322
+ </div>
323
+ <?php } ?>
324
+ </div>
325
+ <div class="wcf-popup-close-wrap">
326
+ <span class="close-icon"><span class="wcf-cartflow-icons dashicons dashicons-no"></span></span>
327
+ </div>
328
+ </div>
329
+ <!-- <div class="wcf-search-form">
330
+ <label class="screen-reader-text" for="wp-filter-search-input"><?php _e( 'Search Sites', 'cartflows' ); ?> </label>
331
+ <input placeholder="<?php _e( 'Search Flow...', 'cartflows' ); ?>" type="text" aria-describedby="live-search-desc" class="wcf-flow-search-input">
332
+ </div> -->
333
+
334
+ <div id="wcf-remote-content">
335
+ <?php if ( 'other' !== $default_page_builder ) { ?>
336
+ <div id="wcf-ready-templates">
337
+ <div id="wcf-remote-filters">
338
+ <div id="wcf-page-builders"></div>
339
+ <div id="wcf-categories"></div>
340
+ </div>
341
+ <div class="wcf-page-builder-notice"></div>
342
+ <div id="wcf-remote-flow-list" class="wcf-remote-list wcf-template-list-wrap"><span class="spinner is-active"></span></div>
343
+ <div id="wcf-upcoming-page-builders" style="display: none;" class="wcf-remote-list wcf-template-list-wrap"></div>
344
+ </div>
345
+ <?php } ?>
346
+ <div id="wcf-start-from-scratch" style="<?php echo ( 'other' !== $default_page_builder ) ? 'display: none;' : ''; ?>">
347
+ <div class="inner">
348
+ <a href="#" class="button button-hero button-primary cartflows-flow-import-blank"><?php _e( 'Design Your Flow', 'cartflows' ); ?></a>
349
+ <p class="wcf-learn-how"><a href="https://cartflows.com/docs/cartflows-step-types/" target="_blank"><?php _e( 'Learn How', 'cartflows' ); ?> <i class="dashicons dashicons-external"></i></a></p>
350
+ </div>
351
+ </div>
352
+ </div>
353
+ </div>
354
+ </div>
355
+ </div>
356
+
357
+ <?php
358
+ }
359
+
360
+ /**
361
+ * Enqueues the needed CSS/JS for the builder's admin settings page.
362
+ *
363
+ * @since 1.0.0
364
+ */
365
+ static public function styles_scripts() {
366
+
367
+ // Styles.
368
+ wp_enqueue_style( 'cartflows-admin-settings', CARTFLOWS_URL . 'admin/assets/css/admin-menu-settings.css', array(), CARTFLOWS_VER );
369
+ wp_style_add_data( 'cartflows-admin-settings', 'rtl', 'replace' );
370
+
371
+ // Script.
372
+ wp_enqueue_script( 'cartflows-admin-settings', CARTFLOWS_URL . 'admin/assets/js/admin-menu-settings.js', array( 'jquery', 'wp-util', 'updates' ), CARTFLOWS_VER );
373
+
374
+ $localize = array(
375
+ 'ajax_nonce' => wp_create_nonce( 'cartflows-widget-nonce' ),
376
+ );
377
+
378
+ wp_localize_script( 'cartflows-admin-settings', 'cartflows', apply_filters( 'cartflows_js_localize', $localize ) );
379
+ }
380
+
381
+ /**
382
+ * Save All admin settings here
383
+ */
384
+ static public function save_settings() {
385
+
386
+ // Only admins can save settings.
387
+ if ( ! current_user_can( 'manage_options' ) ) {
388
+ return;
389
+ }
390
+
391
+ self::save_common_settings();
392
+
393
+ // Let extensions hook into saving.
394
+ do_action( 'cartflows_admin_settings_save' );
395
+ }
396
+
397
+ /**
398
+ * Get and return page URL
399
+ *
400
+ * @param string $menu_slug Menu name.
401
+ * @since 1.0.0
402
+ * @return string page url
403
+ */
404
+ static public function get_page_url( $menu_slug ) {
405
+
406
+ $parent_page = self::$default_menu_position;
407
+
408
+ if ( strpos( $parent_page, '?' ) !== false ) {
409
+ $query_var = '&page=' . self::$plugin_slug;
410
+ } else {
411
+ $query_var = '?page=' . self::$plugin_slug;
412
+ }
413
+
414
+ $parent_page_url = admin_url( $parent_page . $query_var );
415
+
416
+ $url = $parent_page_url . '&action=' . $menu_slug;
417
+
418
+ return esc_url( $url );
419
+ }
420
+
421
+ /**
422
+ * Admin body classes.
423
+ *
424
+ * Body classes to be added to <body> tag in admin page
425
+ *
426
+ * @param String $classes body classes returned from the filter.
427
+ * @return String body classes to be added to <body> tag in admin page
428
+ */
429
+ static public function add_admin_body_class( $classes ) {
430
+
431
+ $classes .= ' cartflows-' . CARTFLOWS_VER;
432
+
433
+ return $classes;
434
+ }
435
+ }
436
+
437
+ Cartflows_Admin::init();
classes/class-cartflows-compatibility.php CHANGED
@@ -1,400 +1,400 @@
1
- <?php
2
- /**
3
- * Page builder compatibility
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- if ( ! class_exists( 'Cartflows_Compatibility' ) ) {
9
-
10
- /**
11
- * Class for page builder compatibility
12
- */
13
- class Cartflows_Compatibility {
14
-
15
- /**
16
- * Member Variable
17
- *
18
- * @var object instance
19
- */
20
- private static $instance;
21
-
22
- /**
23
- * Initiator
24
- */
25
- public static function get_instance() {
26
- if ( ! isset( self::$instance ) ) {
27
- self::$instance = new self;
28
- }
29
- return self::$instance;
30
- }
31
-
32
- /**
33
- * Constructor
34
- */
35
- public function __construct() {
36
-
37
- $this->load_files();
38
-
39
- // Override post meta.
40
- add_action( 'wp', array( $this, 'override_meta' ), 0 );
41
-
42
- add_action( 'wp_enqueue_scripts', array( $this, 'load_fontawesome' ), 10000 );
43
- }
44
-
45
- /**
46
- * Load page builder compatibility files
47
- */
48
- public function load_files() {
49
- if ( class_exists( '\Elementor\Plugin' ) ) {
50
- require_once CARTFLOWS_DIR . 'classes/class-cartflows-elementor-compatibility.php';
51
- }
52
-
53
- if ( $this->is_divi_enabled() ) {
54
- require_once CARTFLOWS_DIR . 'classes/class-cartflows-divi-compatibility.php';
55
- }
56
-
57
- if ( $this->is_bb_enabled() ) {
58
- require_once CARTFLOWS_DIR . 'classes/class-cartflows-bb-compatibility.php';
59
- }
60
-
61
- if ( class_exists( 'TCB_Post' ) ) {
62
- require_once CARTFLOWS_DIR . 'classes/class-cartflows-thrive-compatibility.php';
63
- }
64
- }
65
-
66
- /**
67
- * Check if it is beaver builder enabled.
68
- *
69
- * @since 1.1.4
70
- */
71
- public function is_bb_enabled() {
72
-
73
- if ( class_exists( 'FLBuilderModel' ) ) {
74
- return true;
75
- }
76
-
77
- return false;
78
- }
79
-
80
- /**
81
- * Check if elementor preview mode is on.
82
- */
83
- public function is_elementor_preview_mode() {
84
-
85
- if ( class_exists( '\Elementor\Plugin' ) ) {
86
-
87
- if ( \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
88
- return true;
89
- }
90
- }
91
-
92
- return false;
93
- }
94
-
95
- /**
96
- * Get Current Theme.
97
- */
98
- public function get_current_theme() {
99
-
100
- $theme_name = '';
101
- $theme = wp_get_theme();
102
-
103
- if ( isset( $theme->parent_theme ) && '' != $theme->parent_theme || null != $theme->parent_theme ) {
104
- $theme_name = $theme->parent_theme;
105
- } else {
106
- $theme_name = $theme->name;
107
- }
108
-
109
- return $theme_name;
110
- }
111
-
112
- /**
113
- * Check if it is beaver builder preview mode
114
- */
115
- public function is_bb_preview_mode() {
116
-
117
- if ( class_exists( 'FLBuilderModel' ) ) {
118
- if ( FLBuilderModel::is_builder_active() ) {
119
- return true;
120
- } else {
121
- return false;
122
- }
123
- }
124
-
125
- return false;
126
- }
127
-
128
- /**
129
- * Check for page builder preview mode.
130
- */
131
- public function is_page_builder_preview() {
132
-
133
- if ( $this->is_elementor_preview_mode() || $this->is_bb_preview_mode() || $this->is_divi_builder_preview() ) {
134
- return true;
135
- }
136
-
137
- return false;
138
- }
139
-
140
- /**
141
- * Check if divi builder enabled for post id.
142
- */
143
- public function is_divi_builder_preview() {
144
-
145
- if ( isset( $_GET['et_fb'] ) && '1' === $_GET['et_fb'] ) {
146
- return true;
147
- }
148
-
149
- return false;
150
- }
151
-
152
- /**
153
- * Check if divi builder enabled for post id.
154
- *
155
- * @param int $post_id post id.
156
- */
157
- public function is_divi_builder_enabled( $post_id ) {
158
-
159
- if ( function_exists( 'et_pb_is_pagebuilder_used' ) && et_pb_is_pagebuilder_used( $post_id ) ) {
160
- return true;
161
- }
162
-
163
- return false;
164
- }
165
-
166
- /**
167
- * Check if compatibility theme enabled.
168
- */
169
- function is_compatibility_theme_enabled() {
170
-
171
- $theme = wp_get_theme();
172
-
173
- $is_compatibility = false;
174
-
175
- if ( $this->is_divi_enabled( $theme ) || $this->is_flatsome_enabled( $theme ) ) {
176
-
177
- $is_compatibility = true;
178
- }
179
-
180
- return apply_filters( 'cartflows_is_compatibility_theme', $is_compatibility );
181
- }
182
-
183
- /**
184
- * Check if divi builder enabled for post id.
185
- *
186
- * @param object $theme theme data.
187
- * @return boolean
188
- */
189
- function is_divi_enabled( $theme = false ) {
190
-
191
- if ( ! $theme ) {
192
- $theme = wp_get_theme();
193
- }
194
-
195
- if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme ) {
196
- return true;
197
- }
198
-
199
- return false;
200
- }
201
-
202
- /**
203
- * Check if Divi theme is install status.
204
- *
205
- * @return boolean
206
- */
207
- function is_divi_theme_installed() {
208
- foreach ( (array) wp_get_themes() as $theme_dir => $theme ) {
209
- if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme ) {
210
- return true;
211
- }
212
- }
213
- return false;
214
- }
215
-
216
- /**
217
- * Check if Flatsome enabled for post id.
218
- *
219
- * @param object $theme theme data.
220
- * @return boolean
221
- */
222
- function is_flatsome_enabled( $theme = false ) {
223
-
224
- if ( ! $theme ) {
225
- $theme = wp_get_theme();
226
- }
227
-
228
- if ( 'Flatsome' == $theme->name || 'Flatsome' == $theme->parent_theme ) {
229
- return true;
230
- }
231
-
232
- return false;
233
- }
234
-
235
- /**
236
- * Check if The7 enabled for post id.
237
- *
238
- * @param object $theme theme data.
239
- * @return boolean
240
- */
241
- function is_the_seven_enabled( $theme = false ) {
242
-
243
- if ( ! $theme ) {
244
- $theme = wp_get_theme();
245
- }
246
-
247
- if ( 'The7' == $theme->name || 'The7' == $theme->parent_theme ) {
248
- return true;
249
- }
250
-
251
- return false;
252
- }
253
-
254
- /**
255
- * Check if OceanWp enabled for post id.
256
- *
257
- * @param object $theme theme data.
258
- * @return boolean
259
- */
260
- function is_oceanwp_enabled( $theme = false ) {
261
-
262
- if ( ! $theme ) {
263
- $theme = wp_get_theme();
264
- }
265
-
266
- if ( 'OceanWP' == $theme->name || 'OceanWP' == $theme->parent_theme ) {
267
- return true;
268
- }
269
-
270
- return false;
271
- }
272
-
273
- /**
274
- * Check for thrive architect edit page.
275
- *
276
- * @param int $post_id post id.
277
- */
278
- public function is_thrive_edit_page( $post_id ) {
279
-
280
- if ( true === $this->is_thrive_builder_page( $post_id ) ) {
281
- return true;
282
- } else {
283
- return false;
284
- }
285
- }
286
-
287
- /**
288
- * Check if the page being rendered is the main ID on the editor page.
289
- *
290
- * @since 1.0.0
291
- * @param String $post_id Post ID which is to be rendered.
292
- * @return boolean True if current if is being rendered is not being edited.
293
- */
294
- private function is_thrive_builder_page( $post_id ) {
295
- $tve = ( isset( $_GET['tve'] ) && 'true' == $_GET['tve'] ) ? true : false;
296
- $post = isset( $_GET['post'] ) ? sanitize_text_field( $_GET['post'] ) : false;
297
-
298
- return ( true == $tve && $post_id !== $post );
299
- }
300
-
301
- /**
302
- * Overwrite meta for page
303
- */
304
- public function override_meta() {
305
-
306
- // don't override meta for `elementor_library` post type.
307
- if ( 'elementor_library' == get_post_type() ) {
308
- return;
309
- }
310
-
311
- if ( ! is_singular() ) {
312
- return;
313
- }
314
-
315
- global $post;
316
- $post_id = $post->ID;
317
- $post_type = get_post_type();
318
-
319
- if ( 'cartflows_step' == $post_type && ( $this->is_elementor_preview_mode()
320
- || $this->is_bb_preview_mode() || $this->is_thrive_edit_page( $post_id )
321
- || $this->is_divi_builder_enabled( $post_id ) ) ) {
322
-
323
- if ( '' == $post->post_content ) {
324
-
325
- $this->overwrite_template( $post_id );
326
- }
327
- }
328
- }
329
-
330
- /**
331
- * Assign cartflow canvas template to page.
332
- *
333
- * @param int $post_id post ID.
334
- */
335
- public function overwrite_template( $post_id ) {
336
-
337
- $template = 'cartflows-canvas';
338
- $key = '_wp_page_template';
339
-
340
- $record_exists = get_post_meta( $post_id, $key, true );
341
-
342
- if ( 'cartflows-canvas' == $record_exists ) {
343
- return;
344
- }
345
-
346
- // As elementor doesn't allow update post meta using update_post_meta, run wpdb query to update post meta.
347
- if ( class_exists( '\Elementor\Plugin' ) ) {
348
-
349
- global $wpdb;
350
-
351
- if ( '' == $record_exists || ! $record_exists ) {
352
-
353
- $wpdb->insert(
354
- $wpdb->prefix . 'postmeta',
355
- array(
356
- 'post_id' => $post_id,
357
- 'meta_key' => $key,
358
- 'meta_value' => $template, // ... and so on
359
- )
360
- );
361
- } else {
362
-
363
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = %s WHERE meta_key = %s AND post_id = %s;", $template, $key, $post_id ) );
364
- }
365
- } else {
366
-
367
- update_post_meta( $post_id, $key, $template );
368
- }
369
- }
370
-
371
- /**
372
- * Load font awesome style from oceanwp on checkout page.
373
- */
374
- public function load_fontawesome() {
375
-
376
- $theme = get_template();
377
-
378
- if ( 'oceanwp' == strtolower( $theme ) && wcf()->utils->is_step_post_type() ) {
379
-
380
- $load_fa = apply_filters( 'cartflows_maybe_load_font_awesome', true );
381
-
382
- if ( $load_fa ) {
383
-
384
- wp_enqueue_style( 'font-awesome', OCEANWP_CSS_DIR_URI . 'third/font-awesome.min.css', false );
385
- }
386
-
387
- $custom_css = '
388
- #oceanwp-cart-sidebar-wrap,
389
- #owp-qv-wrap{
390
- display: none;
391
- }';
392
-
393
- wp_add_inline_style( 'wcf-frontend-global', $custom_css );
394
- }
395
- }
396
- }
397
- }
398
-
399
- Cartflows_Compatibility::get_instance();
400
-
1
+ <?php
2
+ /**
3
+ * Page builder compatibility
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ if ( ! class_exists( 'Cartflows_Compatibility' ) ) {
9
+
10
+ /**
11
+ * Class for page builder compatibility
12
+ */
13
+ class Cartflows_Compatibility {
14
+
15
+ /**
16
+ * Member Variable
17
+ *
18
+ * @var object instance
19
+ */
20
+ private static $instance;
21
+
22
+ /**
23
+ * Initiator
24
+ */
25
+ public static function get_instance() {
26
+ if ( ! isset( self::$instance ) ) {
27
+ self::$instance = new self;
28
+ }
29
+ return self::$instance;
30
+ }
31
+
32
+ /**
33
+ * Constructor
34
+ */
35
+ public function __construct() {
36
+
37
+ $this->load_files();
38
+
39
+ // Override post meta.
40
+ add_action( 'wp', array( $this, 'override_meta' ), 0 );
41
+
42
+ add_action( 'wp_enqueue_scripts', array( $this, 'load_fontawesome' ), 10000 );
43
+ }
44
+
45
+ /**
46
+ * Load page builder compatibility files
47
+ */
48
+ public function load_files() {
49
+ if ( class_exists( '\Elementor\Plugin' ) ) {
50
+ require_once CARTFLOWS_DIR . 'classes/class-cartflows-elementor-compatibility.php';
51
+ }
52
+
53
+ if ( $this->is_divi_enabled() ) {
54
+ require_once CARTFLOWS_DIR . 'classes/class-cartflows-divi-compatibility.php';
55
+ }
56
+
57
+ if ( $this->is_bb_enabled() ) {
58
+ require_once CARTFLOWS_DIR . 'classes/class-cartflows-bb-compatibility.php';
59
+ }
60
+
61
+ if ( class_exists( 'TCB_Post' ) ) {
62
+ require_once CARTFLOWS_DIR . 'classes/class-cartflows-thrive-compatibility.php';
63
+ }
64
+ }
65
+
66
+ /**
67
+ * Check if it is beaver builder enabled.
68
+ *
69
+ * @since 1.1.4
70
+ */
71
+ public function is_bb_enabled() {
72
+
73
+ if ( class_exists( 'FLBuilderModel' ) ) {
74
+ return true;
75
+ }
76
+
77
+ return false;
78
+ }
79
+
80
+ /**
81
+ * Check if elementor preview mode is on.
82
+ */
83
+ public function is_elementor_preview_mode() {
84
+
85
+ if ( class_exists( '\Elementor\Plugin' ) ) {
86
+
87
+ if ( \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
88
+ return true;
89
+ }
90
+ }
91
+
92
+ return false;
93
+ }
94
+
95
+ /**
96
+ * Get Current Theme.
97
+ */
98
+ public function get_current_theme() {
99
+
100
+ $theme_name = '';
101
+ $theme = wp_get_theme();
102
+
103
+ if ( isset( $theme->parent_theme ) && '' != $theme->parent_theme || null != $theme->parent_theme ) {
104
+ $theme_name = $theme->parent_theme;
105
+ } else {
106
+ $theme_name = $theme->name;
107
+ }
108
+
109
+ return $theme_name;
110
+ }
111
+
112
+ /**
113
+ * Check if it is beaver builder preview mode
114
+ */
115
+ public function is_bb_preview_mode() {
116
+
117
+ if ( class_exists( 'FLBuilderModel' ) ) {
118
+ if ( FLBuilderModel::is_builder_active() ) {
119
+ return true;
120
+ } else {
121
+ return false;
122
+ }
123
+ }
124
+
125
+ return false;
126
+ }
127
+
128
+ /**
129
+ * Check for page builder preview mode.
130
+ */
131
+ public function is_page_builder_preview() {
132
+
133
+ if ( $this->is_elementor_preview_mode() || $this->is_bb_preview_mode() || $this->is_divi_builder_preview() ) {
134
+ return true;
135
+ }
136
+
137
+ return false;
138
+ }
139
+
140
+ /**
141
+ * Check if divi builder enabled for post id.
142
+ */
143
+ public function is_divi_builder_preview() {
144
+
145
+ if ( isset( $_GET['et_fb'] ) && '1' === $_GET['et_fb'] ) {
146
+ return true;
147
+ }
148
+
149
+ return false;
150
+ }
151
+
152
+ /**
153
+ * Check if divi builder enabled for post id.
154
+ *
155
+ * @param int $post_id post id.
156
+ */
157
+ public function is_divi_builder_enabled( $post_id ) {
158
+
159
+ if ( function_exists( 'et_pb_is_pagebuilder_used' ) && et_pb_is_pagebuilder_used( $post_id ) ) {
160
+ return true;
161
+ }
162
+
163
+ return false;
164
+ }
165
+
166
+ /**
167
+ * Check if compatibility theme enabled.
168
+ */
169
+ function is_compatibility_theme_enabled() {
170
+
171
+ $theme = wp_get_theme();
172
+
173
+ $is_compatibility = false;
174
+
175
+ if ( $this->is_divi_enabled( $theme ) || $this->is_flatsome_enabled( $theme ) ) {
176
+
177
+ $is_compatibility = true;
178
+ }
179
+
180
+ return apply_filters( 'cartflows_is_compatibility_theme', $is_compatibility );
181
+ }
182
+
183
+ /**
184
+ * Check if divi builder enabled for post id.
185
+ *
186
+ * @param object $theme theme data.
187
+ * @return boolean
188
+ */
189
+ function is_divi_enabled( $theme = false ) {
190
+
191
+ if ( ! $theme ) {
192
+ $theme = wp_get_theme();
193
+ }
194
+
195
+ if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme ) {
196
+ return true;
197
+ }
198
+
199
+ return false;
200
+ }
201
+
202
+ /**
203
+ * Check if Divi theme is install status.
204
+ *
205
+ * @return boolean
206
+ */
207
+ function is_divi_theme_installed() {
208
+ foreach ( (array) wp_get_themes() as $theme_dir => $theme ) {
209
+ if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme ) {
210
+ return true;
211
+ }
212
+ }
213
+ return false;
214
+ }
215
+
216
+ /**
217
+ * Check if Flatsome enabled for post id.
218
+ *
219
+ * @param object $theme theme data.
220
+ * @return boolean
221
+ */
222
+ function is_flatsome_enabled( $theme = false ) {
223
+
224
+ if ( ! $theme ) {
225
+ $theme = wp_get_theme();
226
+ }
227
+
228
+ if ( 'Flatsome' == $theme->name || 'Flatsome' == $theme->parent_theme ) {
229
+ return true;
230
+ }
231
+
232
+ return false;
233
+ }
234
+
235
+ /**
236
+ * Check if The7 enabled for post id.
237
+ *
238
+ * @param object $theme theme data.
239
+ * @return boolean
240
+ */
241
+ function is_the_seven_enabled( $theme = false ) {
242
+
243
+ if ( ! $theme ) {
244
+ $theme = wp_get_theme();
245
+ }
246
+
247
+ if ( 'The7' == $theme->name || 'The7' == $theme->parent_theme ) {
248
+ return true;
249
+ }
250
+
251
+ return false;
252
+ }
253
+
254
+ /**
255
+ * Check if OceanWp enabled for post id.
256
+ *
257
+ * @param object $theme theme data.
258
+ * @return boolean
259
+ */
260
+ function is_oceanwp_enabled( $theme = false ) {
261
+
262
+ if ( ! $theme ) {
263
+ $theme = wp_get_theme();
264
+ }
265
+
266
+ if ( 'OceanWP' == $theme->name || 'OceanWP' == $theme->parent_theme ) {
267
+ return true;
268
+ }
269
+
270
+ return false;
271
+ }
272
+
273
+ /**
274
+ * Check for thrive architect edit page.
275
+ *
276
+ * @param int $post_id post id.
277
+ */
278
+ public function is_thrive_edit_page( $post_id ) {
279
+
280
+ if ( true === $this->is_thrive_builder_page( $post_id ) ) {
281
+ return true;
282
+ } else {
283
+ return false;
284
+ }
285
+ }
286
+
287
+ /**
288
+ * Check if the page being rendered is the main ID on the editor page.
289
+ *
290
+ * @since 1.0.0
291
+ * @param String $post_id Post ID which is to be rendered.
292
+ * @return boolean True if current if is being rendered is not being edited.
293
+ */
294
+ private function is_thrive_builder_page( $post_id ) {
295
+ $tve = ( isset( $_GET['tve'] ) && 'true' == $_GET['tve'] ) ? true : false;
296
+ $post = isset( $_GET['post'] ) ? sanitize_text_field( $_GET['post'] ) : false;
297
+
298
+ return ( true == $tve && $post_id !== $post );
299
+ }
300
+
301
+ /**
302
+ * Overwrite meta for page
303
+ */
304
+ public function override_meta() {
305
+
306
+ // don't override meta for `elementor_library` post type.
307
+ if ( 'elementor_library' == get_post_type() ) {
308
+ return;
309
+ }
310
+
311
+ if ( ! is_singular() ) {
312
+ return;
313
+ }
314
+
315
+ global $post;
316
+ $post_id = $post->ID;
317
+ $post_type = get_post_type();
318
+
319
+ if ( 'cartflows_step' == $post_type && ( $this->is_elementor_preview_mode()
320
+ || $this->is_bb_preview_mode() || $this->is_thrive_edit_page( $post_id )
321
+ || $this->is_divi_builder_enabled( $post_id ) ) ) {
322
+
323
+ if ( '' == $post->post_content ) {
324
+
325
+ $this->overwrite_template( $post_id );
326
+ }
327
+ }
328
+ }
329
+
330
+ /**
331
+ * Assign cartflow canvas template to page.
332
+ *
333
+ * @param int $post_id post ID.
334
+ */
335
+ public function overwrite_template( $post_id ) {
336
+
337
+ $template = 'cartflows-canvas';
338
+ $key = '_wp_page_template';
339
+
340
+ $record_exists = get_post_meta( $post_id, $key, true );
341
+
342
+ if ( 'cartflows-canvas' == $record_exists ) {
343
+ return;
344
+ }
345
+
346
+ // As elementor doesn't allow update post meta using update_post_meta, run wpdb query to update post meta.
347
+ if ( class_exists( '\Elementor\Plugin' ) ) {
348
+
349
+ global $wpdb;
350
+
351
+ if ( '' == $record_exists || ! $record_exists ) {
352
+
353
+ $wpdb->insert(
354
+ $wpdb->prefix . 'postmeta',
355
+ array(
356
+ 'post_id' => $post_id,
357
+ 'meta_key' => $key,
358
+ 'meta_value' => $template, // ... and so on
359
+ )
360
+ );
361
+ } else {
362
+
363
+ $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = %s WHERE meta_key = %s AND post_id = %s;", $template, $key, $post_id ) );
364
+ }
365
+ } else {
366
+
367
+ update_post_meta( $post_id, $key, $template );
368
+ }
369
+ }
370
+
371
+ /**
372
+ * Load font awesome style from oceanwp on checkout page.
373
+ */
374
+ public function load_fontawesome() {
375
+
376
+ $theme = get_template();
377
+
378
+ if ( 'oceanwp' == strtolower( $theme ) && wcf()->utils->is_step_post_type() ) {
379
+
380
+ $load_fa = apply_filters( 'cartflows_maybe_load_font_awesome', true );
381
+
382
+ if ( $load_fa ) {
383
+
384
+ wp_enqueue_style( 'font-awesome', OCEANWP_CSS_DIR_URI . 'third/font-awesome.min.css', false );
385
+ }
386
+
387
+ $custom_css = '
388
+ #oceanwp-cart-sidebar-wrap,
389
+ #owp-qv-wrap{
390
+ display: none;
391
+ }';
392
+
393
+ wp_add_inline_style( 'wcf-frontend-global', $custom_css );
394
+ }
395
+ }
396
+ }
397
+ }
398
+
399
+ Cartflows_Compatibility::get_instance();
400
+
classes/class-cartflows-helper.php CHANGED
@@ -1,458 +1,464 @@
1
- <?php
2
- /**
3
- * CARTFLOWS Helper.
4
- *
5
- * @package CARTFLOWS
6
- */
7
-
8
- if ( ! defined( 'ABSPATH' ) ) {
9
- exit; // Exit if accessed directly.
10
- }
11
-
12
- /**
13
- * Class Cartflows_Helper.
14
- */
15
- class Cartflows_Helper {
16
-
17
- /**
18
- * Common global data
19
- *
20
- * @var zapier
21
- */
22
- private static $common = null;
23
-
24
- /**
25
- * Installed Plugins
26
- *
27
- * @since 1.1.4
28
- *
29
- * @access private
30
- * @var array Installed plugins list.
31
- */
32
- private static $installed_plugins = null;
33
-
34
- /**
35
- * Checkout Fields
36
- *
37
- * @var checkout_fields
38
- */
39
- private static $checkout_fields = null;
40
-
41
- /**
42
- * Returns an option from the database for
43
- * the admin settings page.
44
- *
45
- * @param string $key The option key.
46
- * @param mixed $default Option default value if option is not available.
47
- * @param boolean $network_override Whether to allow the network admin setting to be overridden on subsites.
48
- * @return string Return the option value
49
- */
50
- public static function get_admin_settings_option( $key, $default = false, $network_override = false ) {
51
-
52
- // Get the site-wide option if we're in the network admin.
53
- if ( $network_override && is_multisite() ) {
54
- $value = get_site_option( $key, $default );
55
- } else {
56
- $value = get_option( $key, $default );
57
- }
58
-
59
- return $value;
60
- }
61
-
62
- /**
63
- * Updates an option from the admin settings page.
64
- *
65
- * @param string $key The option key.
66
- * @param mixed $value The value to update.
67
- * @param bool $network Whether to allow the network admin setting to be overridden on subsites.
68
- * @return mixed
69
- */
70
- static public function update_admin_settings_option( $key, $value, $network = false ) {
71
-
72
- // Update the site-wide option since we're in the network admin.
73
- if ( $network && is_multisite() ) {
74
- update_site_option( $key, $value );
75
- } else {
76
- update_option( $key, $value );
77
- }
78
-
79
- }
80
-
81
- /**
82
- * Get single setting
83
- *
84
- * @since 1.1.4
85
- *
86
- * @param string $key Option key.
87
- * @param string $default Option default value if not exist.
88
- * @return mixed
89
- */
90
- static public function get_common_setting( $key = '', $default = '' ) {
91
- $settings = self::get_common_settings();
92
-
93
- if ( $settings && array_key_exists( $key, $settings ) ) {
94
- return $settings[ $key ];
95
- }
96
-
97
- return $default;
98
- }
99
-
100
- /**
101
- * Get required plugins for page builder
102
- *
103
- * @since 1.1.4
104
- *
105
- * @param string $page_builder_slug Page builder slug.
106
- * @param string $default Default page builder.
107
- * @return array selected page builder required plugins list.
108
- */
109
- public static function get_required_plugins_for_page_builder( $page_builder_slug = '', $default = 'elementor' ) {
110
- $plugins = self::get_plugins_groupby_page_builders();
111
-
112
- if ( array_key_exists( $page_builder_slug, $plugins ) ) {
113
- return $plugins[ $page_builder_slug ];
114
- }
115
-
116
- return $plugins[ $default ];
117
- }
118
-
119
- /**
120
- * Get Plugins list by page builder.
121
- *
122
- * @since 1.1.4
123
- *
124
- * @return array Required Plugins list.
125
- */
126
- public static function get_plugins_groupby_page_builders() {
127
-
128
- $divi_status = self::get_plugin_status( 'divi-builder/divi-builder.php' );
129
- $theme_status = 'not-installed';
130
- if ( $divi_status ) {
131
- if ( true === Cartflows_Compatibility::get_instance()->is_divi_theme_installed() ) {
132
- $theme_status = 'installed';
133
- if ( false === Cartflows_Compatibility::get_instance()->is_divi_enabled() ) {
134
- $theme_status = 'deactivate';
135
- $divi_status = 'activate';
136
- } else {
137
- $divi_status = '';
138
- }
139
- }
140
- }
141
-
142
- $plugins = array(
143
- 'elementor' => array(
144
- 'title' => 'Elementor',
145
- 'plugins' => array(
146
- array(
147
- 'slug' => 'elementor', // For download from wp.org.
148
- 'init' => 'elementor/elementor.php',
149
- 'status' => self::get_plugin_status( 'elementor/elementor.php' ),
150
- ),
151
- ),
152
- ),
153
- 'divi' => array(
154
- 'title' => 'Divi',
155
- 'theme-status' => $theme_status,
156
- 'plugin-status' => $divi_status,
157
- 'plugins' => array(
158
- array(
159
- 'slug' => 'divi-builder', // For download from wp.org.
160
- 'init' => 'divi-builder/divi-builder.php',
161
- 'status' => $divi_status,
162
- ),
163
- ),
164
- ),
165
- );
166
-
167
- $plugins['beaver-builder'] = array(
168
- 'title' => 'Beaver Builder',
169
- 'plugins' => array(),
170
- );
171
-
172
- // Check Pro Exist.
173
- if ( file_exists( WP_PLUGIN_DIR . '/' . 'bb-plugin/fl-builder.php' ) && ! is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) ) {
174
- $plugins['beaver-builder']['plugins'][] = array(
175
- 'slug' => 'bb-plugin',
176
- 'init' => 'bb-plugin/fl-builder.php',
177
- 'status' => self::get_plugin_status( 'bb-plugin/fl-builder.php' ),
178
- );
179
- } else {
180
- $plugins['beaver-builder']['plugins'][] = array(
181
- 'slug' => 'beaver-builder-lite-version', // For download from wp.org.
182
- 'init' => 'beaver-builder-lite-version/fl-builder.php',
183
- 'status' => self::get_plugin_status( 'beaver-builder-lite-version/fl-builder.php' ),
184
- );
185
- }
186
-
187
- if ( file_exists( WP_PLUGIN_DIR . '/' . 'bb-ultimate-addon/bb-ultimate-addon.php' ) && ! is_plugin_active( 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php' ) ) {
188
- $plugins['beaver-builder']['plugins'][] = array(
189
- 'slug' => 'bb-ultimate-addon',
190
- 'init' => 'bb-ultimate-addon/bb-ultimate-addon.php',
191
- 'status' => self::get_plugin_status( 'bb-ultimate-addon/bb-ultimate-addon.php' ),
192
- );
193
- } else {
194
- $plugins['beaver-builder']['plugins'][] = array(
195
- 'slug' => 'ultimate-addons-for-beaver-builder-lite', // For download from wp.org.
196
- 'init' => 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php',
197
- 'status' => self::get_plugin_status( 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php' ),
198
- );
199
- }
200
-
201
- return $plugins;
202
- }
203
-
204
- /**
205
- * Get plugin status
206
- *
207
- * @since 1.1.4
208
- *
209
- * @param string $plugin_init_file Plguin init file.
210
- * @return mixed
211
- */
212
- public static function get_plugin_status( $plugin_init_file ) {
213
-
214
- if ( null == self::$installed_plugins ) {
215
- self::$installed_plugins = get_plugins();
216
- }
217
-
218
- if ( ! isset( self::$installed_plugins[ $plugin_init_file ] ) ) {
219
- return 'install';
220
- } elseif ( ! is_plugin_active( $plugin_init_file ) ) {
221
- return 'activate';
222
- }
223
-
224
- return;
225
- }
226
-
227
- /**
228
- * Get zapier settings.
229
- *
230
- * @return array.
231
- */
232
- static public function get_common_settings() {
233
-
234
- if ( null === self::$common ) {
235
-
236
- $common_default = apply_filters(
237
- 'cartflows_common_settings_default',
238
- array(
239
- 'disallow_indexing' => 'disable',
240
- 'global_checkout' => '',
241
- 'default_page_builder' => 'elementor',
242
- )
243
- );
244
-
245
- $common = Cartflows_Helper::get_admin_settings_option( '_cartflows_common', false, true );
246
-
247
- self::$common = wp_parse_args( $common, $common_default );
248
- }
249
-
250
- return self::$common;
251
- }
252
-
253
- /**
254
- * Get Checkout field.
255
- *
256
- * @param string $key Field key.
257
- * @param int $post_id Post id.
258
- * @return array.
259
- */
260
- static public function get_checkout_fields( $key, $post_id ) {
261
-
262
- $saved_fields = get_post_meta( $post_id, 'wcf_fields_' . $key, true );
263
-
264
- if ( ! $saved_fields ) {
265
- $saved_fields = array();
266
- }
267
-
268
- $fields = array_filter( $saved_fields );
269
-
270
- if ( empty( $fields ) ) {
271
- if ( 'billing' === $key || 'shipping' === $key ) {
272
-
273
- $fields = WC()->countries->get_address_fields( WC()->countries->get_base_country(), $key . '_' );
274
-
275
- update_post_meta( $post_id, 'wcf_fields_' . $key, $fields );
276
- }
277
- }
278
-
279
- return $fields;
280
- }
281
-
282
- /**
283
- * Add Checkout field.
284
- *
285
- * @param string $type Field type.
286
- * @param string $field_key Field key.
287
- * @param array $field_data Field data.
288
- * @param int $post_id Post id.
289
- * @return boolean.
290
- */
291
- static public function add_checkout_field( $type, $field_key, $field_data = array(), $post_id ) {
292
-
293
- $fields = self::get_checkout_fields( $type, $post_id );
294
-
295
- $fields[ $field_key ] = $field_data;
296
-
297
- update_post_meta( $post_id, 'wcf_fields_' . $type, $fields );
298
-
299
- return true;
300
- }
301
-
302
- /**
303
- * Get checkout fields settings.
304
- *
305
- * @param string $type Field type.
306
- * @param string $field_key Field key.
307
- * @param int $post_id Post id.
308
- * @return array.
309
- */
310
- static public function delete_checkout_field( $type, $field_key, $post_id ) {
311
-
312
- $fields = self::get_checkout_fields( $type, $post_id );
313
-
314
- if ( isset( $fields[ $field_key ] ) ) {
315
- unset( $fields[ $field_key ] );
316
- }
317
-
318
- update_post_meta( $post_id, 'wcf_fields_' . $type, $fields );
319
-
320
- return true;
321
- }
322
-
323
- /**
324
- * Get checkout fields settings.
325
- *
326
- * @return array.
327
- */
328
- static public function get_checkout_fields_settings() {
329
-
330
- if ( null === self::$checkout_fields ) {
331
- $checkout_fields_default = array(
332
- 'enable_customization' => 'disable',
333
- 'enable_billing_fields' => 'disable',
334
- );
335
-
336
- $billing_fields = self::get_checkout_fields( 'billing' );
337
-
338
- if ( is_array( $billing_fields ) && ! empty( $billing_fields ) ) {
339
-
340
- foreach ( $billing_fields as $key => $value ) {
341
-
342
- $checkout_fields_default[ $key ] = 'enable';
343
- }
344
- }
345
-
346
- $checkout_fields = Cartflows_Helper::get_admin_settings_option( '_wcf_checkout_fields', false, true );
347
-
348
- self::$checkout_fields = wp_parse_args( $checkout_fields, $checkout_fields_default );
349
- }
350
-
351
- return self::$checkout_fields;
352
- }
353
-
354
- /**
355
- * Get meta options
356
- *
357
- * @since 1.0.0
358
- * @param int $post_id Product ID.
359
- * @param string $key Meta Key.
360
- * @param string $default Default value.
361
- * @return string Meta Value.
362
- */
363
- static public function get_meta_option( $post_id, $key, $default = '' ) {
364
-
365
- $value = get_post_meta( $post_id, $key, true );
366
-
367
- if ( ! $value ) {
368
- $value = $default;
369
- }
370
-
371
- return $value;
372
- }
373
-
374
- /**
375
- * Save meta option
376
- *
377
- * @since 1.0.0
378
- * @param int $post_id Product ID.
379
- * @param array $args Arguments array.
380
- */
381
- static public function save_meta_option( $post_id, $args = array() ) {
382
-
383
- if ( is_array( $args ) && ! empty( $args ) ) {
384
-
385
- foreach ( $args as $key => $value ) {
386
-
387
- update_post_meta( $post_id, $key, $value );
388
- }
389
- }
390
- }
391
-
392
- /**
393
- * Check if Elementor page builder is installed
394
- *
395
- * @since 1.0.0
396
- *
397
- * @access public
398
- */
399
- static public function _is_elementor_installed() {
400
- $path = 'elementor/elementor.php';
401
- $plugins = get_plugins();
402
-
403
- return isset( $plugins[ $path ] );
404
- }
405
-
406
- /**
407
- * Check if Step has product assigned.
408
- *
409
- * @since 1.0.0
410
- * @param int $step_id step ID.
411
- *
412
- * @access public
413
- */
414
- static public function has_product_assigned( $step_id ) {
415
-
416
- $step_type = get_post_meta( $step_id, 'wcf-step-type', true );
417
-
418
- if ( 'checkout' == $step_type ) {
419
- $product = get_post_meta( $step_id, 'wcf-checkout-products', true );
420
- } else {
421
- $product = get_post_meta( $step_id, 'wcf-offer-product', true );
422
- }
423
-
424
- if ( ! empty( $product ) ) {
425
- return true;
426
- }
427
- return false;
428
-
429
- }
430
-
431
- /**
432
- * Get attributes for cartflows wrap.
433
- *
434
- * @since 1.1.4
435
- *
436
- * @access public
437
- */
438
- static public function get_cartflows_container_atts() {
439
-
440
- $attributes = apply_filters( 'cartflows_container_atts', array() );
441
- $atts_string = '';
442
-
443
- foreach ( $attributes as $key => $value ) {
444
-
445
- if ( ! $value ) {
446
- continue;
447
- }
448
-
449
- if ( true === $value ) {
450
- $atts_string .= esc_html( $key ) . ' ';
451
- } else {
452
- $atts_string .= sprintf( '%s="%s" ', esc_html( $key ), esc_attr( $value ) );
453
- }
454
- }
455
-
456
- return $atts_string;
457
- }
458
- }
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CARTFLOWS Helper.
4
+ *
5
+ * @package CARTFLOWS
6
+ */
7
+
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit; // Exit if accessed directly.
10
+ }
11
+
12
+ /**
13
+ * Class Cartflows_Helper.
14
+ */
15
+ class Cartflows_Helper {
16
+
17
+ /**
18
+ * Common global data
19
+ *
20
+ * @var zapier
21
+ */
22
+ private static $common = null;
23
+
24
+ /**
25
+ * Installed Plugins
26
+ *
27
+ * @since 1.1.4
28
+ *
29
+ * @access private
30
+ * @var array Installed plugins list.
31
+ */
32
+ private static $installed_plugins = null;
33
+
34
+ /**
35
+ * Checkout Fields
36
+ *
37
+ * @var checkout_fields
38
+ */
39
+ private static $checkout_fields = null;
40
+
41
+ /**
42
+ * Returns an option from the database for
43
+ * the admin settings page.
44
+ *
45
+ * @param string $key The option key.
46
+ * @param mixed $default Option default value if option is not available.
47
+ * @param boolean $network_override Whether to allow the network admin setting to be overridden on subsites.
48
+ * @return string Return the option value
49
+ */
50
+ public static function get_admin_settings_option( $key, $default = false, $network_override = false ) {
51
+
52
+ // Get the site-wide option if we're in the network admin.
53
+ if ( $network_override && is_multisite() ) {
54
+ $value = get_site_option( $key, $default );
55
+ } else {
56
+ $value = get_option( $key, $default );
57
+ }
58
+
59
+ return $value;
60
+ }
61
+
62
+ /**
63
+ * Updates an option from the admin settings page.
64
+ *
65
+ * @param string $key The option key.
66
+ * @param mixed $value The value to update.
67
+ * @param bool $network Whether to allow the network admin setting to be overridden on subsites.
68
+ * @return mixed
69
+ */
70
+ static public function update_admin_settings_option( $key, $value, $network = false ) {
71
+
72
+ // Update the site-wide option since we're in the network admin.
73
+ if ( $network && is_multisite() ) {
74
+ update_site_option( $key, $value );
75
+ } else {
76
+ update_option( $key, $value );
77
+ }
78
+
79
+ }
80
+
81
+ /**
82
+ * Get single setting
83
+ *
84
+ * @since 1.1.4
85
+ *
86
+ * @param string $key Option key.
87
+ * @param string $default Option default value if not exist.
88
+ * @return mixed
89
+ */
90
+ static public function get_common_setting( $key = '', $default = '' ) {
91
+ $settings = self::get_common_settings();
92
+
93
+ if ( $settings && array_key_exists( $key, $settings ) ) {
94
+ return $settings[ $key ];
95
+ }
96
+
97
+ return $default;
98
+ }
99
+
100
+ /**
101
+ * Get required plugins for page builder
102
+ *
103
+ * @since 1.1.4
104
+ *
105
+ * @param string $page_builder_slug Page builder slug.
106
+ * @param string $default Default page builder.
107
+ * @return array selected page builder required plugins list.
108
+ */
109
+ public static function get_required_plugins_for_page_builder( $page_builder_slug = '', $default = 'elementor' ) {
110
+ $plugins = self::get_plugins_groupby_page_builders();
111
+
112
+ if ( array_key_exists( $page_builder_slug, $plugins ) ) {
113
+ return $plugins[ $page_builder_slug ];
114
+ }
115
+
116
+ return $plugins[ $default ];
117
+ }
118
+
119
+ /**
120
+ * Get Plugins list by page builder.
121
+ *
122
+ * @since 1.1.4
123
+ *
124
+ * @return array Required Plugins list.
125
+ */
126
+ public static function get_plugins_groupby_page_builders() {
127
+
128
+ $divi_status = self::get_plugin_status( 'divi-builder/divi-builder.php' );
129
+ $theme_status = 'not-installed';
130
+ if ( $divi_status ) {
131
+ if ( true === Cartflows_Compatibility::get_instance()->is_divi_theme_installed() ) {
132
+ $theme_status = 'installed';
133
+ if ( false === Cartflows_Compatibility::get_instance()->is_divi_enabled() ) {
134
+ $theme_status = 'deactivate';
135
+ $divi_status = 'activate';
136
+ } else {
137
+ $divi_status = '';
138
+ }
139
+ }
140
+ }
141
+
142
+ $plugins = array(
143
+ 'elementor' => array(
144
+ 'title' => 'Elementor',
145
+ 'plugins' => array(
146
+ array(
147
+ 'slug' => 'elementor', // For download from wp.org.
148
+ 'init' => 'elementor/elementor.php',
149
+ 'status' => self::get_plugin_status( 'elementor/elementor.php' ),
150
+ ),
151
+ ),
152
+ ),
153
+ 'divi' => array(
154
+ 'title' => 'Divi',
155
+ 'theme-status' => $theme_status,
156
+ 'plugin-status' => $divi_status,
157
+ 'plugins' => array(
158
+ array(
159
+ 'slug' => 'divi-builder', // For download from wp.org.
160
+ 'init' => 'divi-builder/divi-builder.php',
161
+ 'status' => $divi_status,
162
+ ),
163
+ ),
164
+ ),
165
+ );
166
+
167
+ $plugins['beaver-builder'] = array(
168
+ 'title' => 'Beaver Builder',
169
+ 'plugins' => array(),
170
+ );
171
+
172
+ // Check Pro Exist.
173
+ if ( file_exists( WP_PLUGIN_DIR . '/' . 'bb-plugin/fl-builder.php' ) && ! is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) ) {
174
+ $plugins['beaver-builder']['plugins'][] = array(
175
+ 'slug' => 'bb-plugin',
176
+ 'init' => 'bb-plugin/fl-builder.php',
177
+ 'status' => self::get_plugin_status( 'bb-plugin/fl-builder.php' ),
178
+ );
179
+ } else {
180
+ $plugins['beaver-builder']['plugins'][] = array(
181
+ 'slug' => 'beaver-builder-lite-version', // For download from wp.org.
182
+ 'init' => 'beaver-builder-lite-version/fl-builder.php',
183
+ 'status' => self::get_plugin_status( 'beaver-builder-lite-version/fl-builder.php' ),
184
+ );
185
+ }
186
+
187
+ if ( file_exists( WP_PLUGIN_DIR . '/' . 'bb-ultimate-addon/bb-ultimate-addon.php' ) && ! is_plugin_active( 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php' ) ) {
188
+ $plugins['beaver-builder']['plugins'][] = array(
189
+ 'slug' => 'bb-ultimate-addon',
190
+ 'init' => 'bb-ultimate-addon/bb-ultimate-addon.php',
191
+ 'status' => self::get_plugin_status( 'bb-ultimate-addon/bb-ultimate-addon.php' ),
192
+ );
193
+ } else {
194
+ $plugins['beaver-builder']['plugins'][] = array(
195
+ 'slug' => 'ultimate-addons-for-beaver-builder-lite', // For download from wp.org.
196
+ 'init' => 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php',
197
+ 'status' => self::get_plugin_status( 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php' ),
198
+ );
199
+ }
200
+
201
+ return $plugins;
202
+ }
203
+
204
+ /**
205
+ * Get plugin status
206
+ *
207
+ * @since 1.1.4
208
+ *
209
+ * @param string $plugin_init_file Plguin init file.
210
+ * @return mixed
211
+ */
212
+ public static function get_plugin_status( $plugin_init_file ) {
213
+
214
+ if ( null == self::$installed_plugins ) {
215
+ self::$installed_plugins = get_plugins();
216
+ }
217
+
218
+ if ( ! isset( self::$installed_plugins[ $plugin_init_file ] ) ) {
219
+ return 'install';
220
+ } elseif ( ! is_plugin_active( $plugin_init_file ) ) {
221
+ return 'activate';
222
+ }
223
+
224
+ return;
225
+ }
226
+
227
+ /**
228
+ * Get zapier settings.
229
+ *
230
+ * @return array.
231
+ */
232
+ static public function get_common_settings() {
233
+
234
+ if ( null === self::$common ) {
235
+
236
+ $common_default = apply_filters(
237
+ 'cartflows_common_settings_default',
238
+ array(
239
+ 'disallow_indexing' => 'disable',
240
+ 'global_checkout' => '',
241
+ 'default_page_builder' => 'elementor',
242
+ )
243
+ );
244
+
245
+ $common = Cartflows_Helper::get_admin_settings_option( '_cartflows_common', false, true );
246
+
247
+ $common = wp_parse_args( $common, $common_default );
248
+
249
+ if ( ! did_action( 'wp' ) ) {
250
+ return $common;
251
+ } else {
252
+ self::$common = $common;
253
+ }
254
+ }
255
+
256
+ return self::$common;
257
+ }
258
+
259
+ /**
260
+ * Get Checkout field.
261
+ *
262
+ * @param string $key Field key.
263
+ * @param int $post_id Post id.
264
+ * @return array.
265
+ */
266
+ static public function get_checkout_fields( $key, $post_id ) {
267
+
268
+ $saved_fields = get_post_meta( $post_id, 'wcf_fields_' . $key, true );
269
+
270
+ if ( ! $saved_fields ) {
271
+ $saved_fields = array();
272
+ }
273
+
274
+ $fields = array_filter( $saved_fields );
275
+
276
+ if ( empty( $fields ) ) {
277
+ if ( 'billing' === $key || 'shipping' === $key ) {
278
+
279
+ $fields = WC()->countries->get_address_fields( WC()->countries->get_base_country(), $key . '_' );
280
+
281
+ update_post_meta( $post_id, 'wcf_fields_' . $key, $fields );
282
+ }
283
+ }
284
+
285
+ return $fields;
286
+ }
287
+
288
+ /**
289
+ * Add Checkout field.
290
+ *
291
+ * @param string $type Field type.
292
+ * @param string $field_key Field key.
293
+ * @param array $field_data Field data.
294
+ * @param int $post_id Post id.
295
+ * @return boolean.
296
+ */
297
+ static public function add_checkout_field( $type, $field_key, $field_data = array(), $post_id ) {
298
+
299
+ $fields = self::get_checkout_fields( $type, $post_id );
300
+
301
+ $fields[ $field_key ] = $field_data;
302
+
303
+ update_post_meta( $post_id, 'wcf_fields_' . $type, $fields );
304
+
305
+ return true;
306
+ }
307
+
308
+ /**
309
+ * Get checkout fields settings.
310
+ *
311
+ * @param string $type Field type.
312
+ * @param string $field_key Field key.
313
+ * @param int $post_id Post id.
314
+ * @return array.
315
+ */
316
+ static public function delete_checkout_field( $type, $field_key, $post_id ) {
317
+
318
+ $fields = self::get_checkout_fields( $type, $post_id );
319
+
320
+ if ( isset( $fields[ $field_key ] ) ) {
321
+ unset( $fields[ $field_key ] );
322
+ }
323
+
324
+ update_post_meta( $post_id, 'wcf_fields_' . $type, $fields );
325
+
326
+ return true;
327
+ }
328
+
329
+ /**
330
+ * Get checkout fields settings.
331
+ *
332
+ * @return array.
333
+ */
334
+ static public function get_checkout_fields_settings() {
335
+
336
+ if ( null === self::$checkout_fields ) {
337
+ $checkout_fields_default = array(
338
+ 'enable_customization' => 'disable',
339
+ 'enable_billing_fields' => 'disable',
340
+ );
341
+
342
+ $billing_fields = self::get_checkout_fields( 'billing' );
343
+
344
+ if ( is_array( $billing_fields ) && ! empty( $billing_fields ) ) {
345
+
346
+ foreach ( $billing_fields as $key => $value ) {
347
+
348
+ $checkout_fields_default[ $key ] = 'enable';
349
+ }
350
+ }
351
+
352
+ $checkout_fields = Cartflows_Helper::get_admin_settings_option( '_wcf_checkout_fields', false, true );
353
+
354
+ self::$checkout_fields = wp_parse_args( $checkout_fields, $checkout_fields_default );
355
+ }
356
+
357
+ return self::$checkout_fields;
358
+ }
359
+
360
+ /**
361
+ * Get meta options
362
+ *
363
+ * @since 1.0.0
364
+ * @param int $post_id Product ID.
365
+ * @param string $key Meta Key.
366
+ * @param string $default Default value.
367
+ * @return string Meta Value.
368
+ */
369
+ static public function get_meta_option( $post_id, $key, $default = '' ) {
370
+
371
+ $value = get_post_meta( $post_id, $key, true );
372
+
373
+ if ( ! $value ) {
374
+ $value = $default;
375
+ }
376
+
377
+ return $value;
378
+ }
379
+
380
+ /**
381
+ * Save meta option
382
+ *
383
+ * @since 1.0.0
384
+ * @param int $post_id Product ID.
385
+ * @param array $args Arguments array.
386
+ */
387
+ static public function save_meta_option( $post_id, $args = array() ) {
388
+
389
+ if ( is_array( $args ) && ! empty( $args ) ) {
390
+
391
+ foreach ( $args as $key => $value ) {
392
+
393
+ update_post_meta( $post_id, $key, $value );
394
+ }
395
+ }
396
+ }
397
+
398
+ /**
399
+ * Check if Elementor page builder is installed
400
+ *
401
+ * @since 1.0.0
402
+ *
403
+ * @access public
404
+ */
405
+ static public function _is_elementor_installed() {
406
+ $path = 'elementor/elementor.php';
407
+ $plugins = get_plugins();
408
+
409
+ return isset( $plugins[ $path ] );
410
+ }
411
+
412
+ /**
413
+ * Check if Step has product assigned.
414
+ *
415
+ * @since 1.0.0
416
+ * @param int $step_id step ID.
417
+ *
418
+ * @access public
419
+ */
420
+ static public function has_product_assigned( $step_id ) {
421
+
422
+ $step_type = get_post_meta( $step_id, 'wcf-step-type', true );
423
+
424
+ if ( 'checkout' == $step_type ) {
425
+ $product = get_post_meta( $step_id, 'wcf-checkout-products', true );
426
+ } else {
427
+ $product = get_post_meta( $step_id, 'wcf-offer-product', true );
428
+ }
429
+
430
+ if ( ! empty( $product ) ) {
431
+ return true;
432
+ }
433
+ return false;
434
+
435
+ }
436
+
437
+ /**
438
+ * Get attributes for cartflows wrap.
439
+ *
440
+ * @since 1.1.4
441
+ *
442
+ * @access public
443
+ */
444
+ static public function get_cartflows_container_atts() {
445
+
446
+ $attributes = apply_filters( 'cartflows_container_atts', array() );
447
+ $atts_string = '';
448
+
449
+ foreach ( $attributes as $key => $value ) {
450
+
451
+ if ( ! $value ) {
452
+ continue;
453
+ }
454
+
455
+ if ( true === $value ) {
456
+ $atts_string .= esc_html( $key ) . ' ';
457
+ } else {
458
+ $atts_string .= sprintf( '%s="%s" ', esc_html( $key ), esc_attr( $value ) );
459
+ }
460
+ }
461
+
462
+ return $atts_string;
463
+ }
464
+ }
classes/class-cartflows-loader.php CHANGED
@@ -115,7 +115,7 @@ if ( ! class_exists( 'Cartflows_Loader' ) ) {
115
  define( 'CARTFLOWS_BASE', plugin_basename( CARTFLOWS_FILE ) );
116
  define( 'CARTFLOWS_DIR', plugin_dir_path( CARTFLOWS_FILE ) );
117
  define( 'CARTFLOWS_URL', plugins_url( '/', CARTFLOWS_FILE ) );
118
- define( 'CARTFLOWS_VER', '1.1.10' );
119
  define( 'CARTFLOWS_SLUG', 'cartflows' );
120
  define( 'CARTFLOWS_SETTINGS', 'cartflows_settings' );
121
 
115
  define( 'CARTFLOWS_BASE', plugin_basename( CARTFLOWS_FILE ) );
116
  define( 'CARTFLOWS_DIR', plugin_dir_path( CARTFLOWS_FILE ) );
117
  define( 'CARTFLOWS_URL', plugins_url( '/', CARTFLOWS_FILE ) );
118
+ define( 'CARTFLOWS_VER', '1.1.11' );
119
  define( 'CARTFLOWS_SLUG', 'cartflows' );
120
  define( 'CARTFLOWS_SETTINGS', 'cartflows_settings' );
121
 
languages/cartflows.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the CartFlows package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: CartFlows 1.1.9\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/cartflows\n"
7
- "POT-Creation-Date: 2019-03-05 11:22:02+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -933,8 +933,8 @@ msgstr ""
933
 
934
  #: modules/flow/classes/class-cartflows-flow-post-type.php:61
935
  #: modules/flow/classes/class-cartflows-flow-post-type.php:63
936
- #: modules/flow/classes/class-cartflows-step-post-type.php:144
937
- #: modules/flow/classes/class-cartflows-step-post-type.php:146
938
  msgid "Add New"
939
  msgstr ""
940
 
@@ -956,57 +956,57 @@ msgstr ""
956
 
957
  #: modules/flow/classes/class-cartflows-flow-post-type.php:252
958
  #: modules/flow/classes/class-cartflows-flow-post-type.php:258
959
- #: modules/flow/classes/class-cartflows-step-post-type.php:392
960
- #: modules/flow/classes/class-cartflows-step-post-type.php:398
961
  #. translators: %s: singular custom post type name
962
  msgid "%s updated."
963
  msgstr ""
964
 
965
  #: modules/flow/classes/class-cartflows-flow-post-type.php:254
966
- #: modules/flow/classes/class-cartflows-step-post-type.php:394
967
  #. translators: %s: singular custom post type name
968
  msgid "Custom %s updated."
969
  msgstr ""
970
 
971
  #: modules/flow/classes/class-cartflows-flow-post-type.php:256
972
- #: modules/flow/classes/class-cartflows-step-post-type.php:396
973
  #. translators: %s: singular custom post type name
974
  msgid "Custom %s deleted."
975
  msgstr ""
976
 
977
  #: modules/flow/classes/class-cartflows-flow-post-type.php:260
978
- #: modules/flow/classes/class-cartflows-step-post-type.php:400
979
  #. translators: %1$s: singular custom post type name ,%2$s: date and time of
980
  #. the revision
981
  msgid "%1$s restored to revision from %2$s"
982
  msgstr ""
983
 
984
  #: modules/flow/classes/class-cartflows-flow-post-type.php:262
985
- #: modules/flow/classes/class-cartflows-step-post-type.php:402
986
  #. translators: %s: singular custom post type name
987
  msgid "%s published."
988
  msgstr ""
989
 
990
  #: modules/flow/classes/class-cartflows-flow-post-type.php:264
991
- #: modules/flow/classes/class-cartflows-step-post-type.php:404
992
  #. translators: %s: singular custom post type name
993
  msgid "%s saved."
994
  msgstr ""
995
 
996
  #: modules/flow/classes/class-cartflows-flow-post-type.php:266
997
- #: modules/flow/classes/class-cartflows-step-post-type.php:406
998
  #. translators: %s: singular custom post type name
999
  msgid "%s submitted."
1000
  msgstr ""
1001
 
1002
  #: modules/flow/classes/class-cartflows-flow-post-type.php:268
1003
- #: modules/flow/classes/class-cartflows-step-post-type.php:408
1004
  #. translators: %s: singular custom post type name
1005
  msgid "%s scheduled for."
1006
  msgstr ""
1007
 
1008
  #: modules/flow/classes/class-cartflows-flow-post-type.php:270
1009
- #: modules/flow/classes/class-cartflows-step-post-type.php:410
1010
  #. translators: %s: singular custom post type name
1011
  msgid "%s draft updated."
1012
  msgstr ""
@@ -1016,61 +1016,61 @@ msgstr ""
1016
  msgid "Next Step"
1017
  msgstr ""
1018
 
1019
- #: modules/flow/classes/class-cartflows-step-post-type.php:140
1020
  msgid "Search Steps"
1021
  msgstr ""
1022
 
1023
- #: modules/flow/classes/class-cartflows-step-post-type.php:141
1024
  msgid "All Steps"
1025
  msgstr ""
1026
 
1027
- #: modules/flow/classes/class-cartflows-step-post-type.php:142
1028
  #: modules/flow/view/meta-flow-steps.php:99
1029
  msgid "Edit Step"
1030
  msgstr ""
1031
 
1032
- #: modules/flow/classes/class-cartflows-step-post-type.php:143
1033
  #: modules/flow/view/meta-flow-steps.php:95
1034
  msgid "View Step"
1035
  msgstr ""
1036
 
1037
- #: modules/flow/classes/class-cartflows-step-post-type.php:145
1038
  msgid "Update Step"
1039
  msgstr ""
1040
 
1041
- #: modules/flow/classes/class-cartflows-step-post-type.php:147
1042
  msgid "New Step Name"
1043
  msgstr ""
1044
 
1045
- #: modules/flow/classes/class-cartflows-step-post-type.php:170
1046
  msgid "Step Type"
1047
  msgstr ""
1048
 
1049
- #: modules/flow/classes/class-cartflows-step-post-type.php:179
1050
  msgid "Step Flow"
1051
  msgstr ""
1052
 
1053
- #: modules/flow/classes/class-cartflows-step-post-type.php:196
1054
  #: modules/flow/view/meta-flow-steps.php:11
1055
  msgid "Landing"
1056
  msgstr ""
1057
 
1058
- #: modules/flow/classes/class-cartflows-step-post-type.php:202
1059
  #: modules/flow/view/meta-flow-steps.php:12
1060
  msgid "Checkout"
1061
  msgstr ""
1062
 
1063
- #: modules/flow/classes/class-cartflows-step-post-type.php:208
1064
  #: modules/flow/view/meta-flow-steps.php:13
1065
  msgid "Thank You"
1066
  msgstr ""
1067
 
1068
- #: modules/flow/classes/class-cartflows-step-post-type.php:214
1069
  #: modules/flow/view/meta-flow-steps.php:14
1070
  msgid "Upsell"
1071
  msgstr ""
1072
 
1073
- #: modules/flow/classes/class-cartflows-step-post-type.php:220
1074
  #: modules/flow/view/meta-flow-steps.php:15
1075
  msgid "Downsell"
1076
  msgstr ""
@@ -1357,17 +1357,17 @@ msgctxt "flow singular name"
1357
  msgid "Flow"
1358
  msgstr ""
1359
 
1360
- #: modules/flow/classes/class-cartflows-step-post-type.php:138
1361
  msgctxt "flow step general name"
1362
  msgid "Steps"
1363
  msgstr ""
1364
 
1365
- #: modules/flow/classes/class-cartflows-step-post-type.php:139
1366
  msgctxt "flow step singular name"
1367
  msgid "Step"
1368
  msgstr ""
1369
 
1370
- #: modules/flow/classes/class-cartflows-step-post-type.php:258
1371
  msgctxt "cartflows"
1372
  msgid "Template for Page Builders"
1373
  msgstr ""
2
  # This file is distributed under the same license as the CartFlows package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: CartFlows 1.1.11\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/cartflows\n"
7
+ "POT-Creation-Date: 2019-03-19 10:13:38+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
933
 
934
  #: modules/flow/classes/class-cartflows-flow-post-type.php:61
935
  #: modules/flow/classes/class-cartflows-flow-post-type.php:63
936
+ #: modules/flow/classes/class-cartflows-step-post-type.php:149
937
+ #: modules/flow/classes/class-cartflows-step-post-type.php:151
938
  msgid "Add New"
939
  msgstr ""
940
 
956
 
957
  #: modules/flow/classes/class-cartflows-flow-post-type.php:252
958
  #: modules/flow/classes/class-cartflows-flow-post-type.php:258
959
+ #: modules/flow/classes/class-cartflows-step-post-type.php:397
960
+ #: modules/flow/classes/class-cartflows-step-post-type.php:403
961
  #. translators: %s: singular custom post type name
962
  msgid "%s updated."
963
  msgstr ""
964
 
965
  #: modules/flow/classes/class-cartflows-flow-post-type.php:254
966
+ #: modules/flow/classes/class-cartflows-step-post-type.php:399
967
  #. translators: %s: singular custom post type name
968
  msgid "Custom %s updated."
969
  msgstr ""
970
 
971
  #: modules/flow/classes/class-cartflows-flow-post-type.php:256
972
+ #: modules/flow/classes/class-cartflows-step-post-type.php:401
973
  #. translators: %s: singular custom post type name
974
  msgid "Custom %s deleted."
975
  msgstr ""
976
 
977
  #: modules/flow/classes/class-cartflows-flow-post-type.php:260
978
+ #: modules/flow/classes/class-cartflows-step-post-type.php:405
979
  #. translators: %1$s: singular custom post type name ,%2$s: date and time of
980
  #. the revision
981
  msgid "%1$s restored to revision from %2$s"
982
  msgstr ""
983
 
984
  #: modules/flow/classes/class-cartflows-flow-post-type.php:262
985
+ #: modules/flow/classes/class-cartflows-step-post-type.php:407
986
  #. translators: %s: singular custom post type name
987
  msgid "%s published."
988
  msgstr ""
989
 
990
  #: modules/flow/classes/class-cartflows-flow-post-type.php:264
991
+ #: modules/flow/classes/class-cartflows-step-post-type.php:409
992
  #. translators: %s: singular custom post type name
993
  msgid "%s saved."
994
  msgstr ""
995
 
996
  #: modules/flow/classes/class-cartflows-flow-post-type.php:266
997
+ #: modules/flow/classes/class-cartflows-step-post-type.php:411
998
  #. translators: %s: singular custom post type name
999
  msgid "%s submitted."
1000
  msgstr ""
1001
 
1002
  #: modules/flow/classes/class-cartflows-flow-post-type.php:268
1003
+ #: modules/flow/classes/class-cartflows-step-post-type.php:413
1004
  #. translators: %s: singular custom post type name
1005
  msgid "%s scheduled for."
1006
  msgstr ""
1007
 
1008
  #: modules/flow/classes/class-cartflows-flow-post-type.php:270
1009
+ #: modules/flow/classes/class-cartflows-step-post-type.php:415
1010
  #. translators: %s: singular custom post type name
1011
  msgid "%s draft updated."
1012
  msgstr ""
1016
  msgid "Next Step"
1017
  msgstr ""
1018
 
1019
+ #: modules/flow/classes/class-cartflows-step-post-type.php:145
1020
  msgid "Search Steps"
1021
  msgstr ""
1022
 
1023
+ #: modules/flow/classes/class-cartflows-step-post-type.php:146
1024
  msgid "All Steps"
1025
  msgstr ""
1026
 
1027
+ #: modules/flow/classes/class-cartflows-step-post-type.php:147
1028
  #: modules/flow/view/meta-flow-steps.php:99
1029
  msgid "Edit Step"
1030
  msgstr ""
1031
 
1032
+ #: modules/flow/classes/class-cartflows-step-post-type.php:148
1033
  #: modules/flow/view/meta-flow-steps.php:95
1034
  msgid "View Step"
1035
  msgstr ""
1036
 
1037
+ #: modules/flow/classes/class-cartflows-step-post-type.php:150
1038
  msgid "Update Step"
1039
  msgstr ""
1040
 
1041
+ #: modules/flow/classes/class-cartflows-step-post-type.php:152
1042
  msgid "New Step Name"
1043
  msgstr ""
1044
 
1045
+ #: modules/flow/classes/class-cartflows-step-post-type.php:175
1046
  msgid "Step Type"
1047
  msgstr ""
1048
 
1049
+ #: modules/flow/classes/class-cartflows-step-post-type.php:184
1050
  msgid "Step Flow"
1051
  msgstr ""
1052
 
1053
+ #: modules/flow/classes/class-cartflows-step-post-type.php:201
1054
  #: modules/flow/view/meta-flow-steps.php:11
1055
  msgid "Landing"
1056
  msgstr ""
1057
 
1058
+ #: modules/flow/classes/class-cartflows-step-post-type.php:207
1059
  #: modules/flow/view/meta-flow-steps.php:12
1060
  msgid "Checkout"
1061
  msgstr ""
1062
 
1063
+ #: modules/flow/classes/class-cartflows-step-post-type.php:213
1064
  #: modules/flow/view/meta-flow-steps.php:13
1065
  msgid "Thank You"
1066
  msgstr ""
1067
 
1068
+ #: modules/flow/classes/class-cartflows-step-post-type.php:219
1069
  #: modules/flow/view/meta-flow-steps.php:14
1070
  msgid "Upsell"
1071
  msgstr ""
1072
 
1073
+ #: modules/flow/classes/class-cartflows-step-post-type.php:225
1074
  #: modules/flow/view/meta-flow-steps.php:15
1075
  msgid "Downsell"
1076
  msgstr ""
1357
  msgid "Flow"
1358
  msgstr ""
1359
 
1360
+ #: modules/flow/classes/class-cartflows-step-post-type.php:143
1361
  msgctxt "flow step general name"
1362
  msgid "Steps"
1363
  msgstr ""
1364
 
1365
+ #: modules/flow/classes/class-cartflows-step-post-type.php:144
1366
  msgctxt "flow step singular name"
1367
  msgid "Step"
1368
  msgstr ""
1369
 
1370
+ #: modules/flow/classes/class-cartflows-step-post-type.php:263
1371
  msgctxt "cartflows"
1372
  msgid "Template for Page Builders"
1373
  msgstr ""
modules/flow/classes/class-cartflows-step-post-type.php CHANGED
@@ -1,465 +1,470 @@
1
- <?php
2
- /**
3
- * Step post type.
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- /**
9
- * Initialization
10
- *
11
- * @since 1.0.0
12
- */
13
- class Cartflows_Step_Post_Type {
14
-
15
-
16
- /**
17
- * Member Variable
18
- *
19
- * @var instance
20
- */
21
- private static $instance;
22
-
23
- /**
24
- * Member Variable
25
- *
26
- * @var body_classes
27
- */
28
- private $body_classes = array();
29
-
30
- /**
31
- * Initiator
32
- */
33
- public static function get_instance() {
34
- if ( ! isset( self::$instance ) ) {
35
- self::$instance = new self;
36
- }
37
- return self::$instance;
38
- }
39
-
40
- /**
41
- * Constructor
42
- */
43
- public function __construct() {
44
-
45
- add_action( 'init', array( $this, 'step_post_type' ) );
46
- add_action( 'init', array( $this, 'add_wp_templates_support' ) );
47
- add_filter( 'post_updated_messages', array( $this, 'post_update_messages' ) );
48
- add_filter( 'post_type_link', array( $this, 'post_type_permalinks' ), 10, 3 );
49
- add_filter( 'wp_unique_post_slug', array( $this, 'prevent_slug_duplicates' ), 10, 6 );
50
- add_action( 'pre_get_posts', array( $this, 'add_cpt_post_names_to_main_query' ), 20 );
51
-
52
- add_filter( 'template_include', array( $this, 'load_page_template' ), 99 );
53
- }
54
-
55
-
56
- /**
57
- * Trys to load page.php for a header, footer or part theme layout.
58
- *
59
- * @since 1.0.0
60
- * @param string $template The current template to be loaded.
61
- * @return string
62
- */
63
- function load_page_template( $template ) {
64
-
65
- global $post;
66
-
67
- if ( 'string' == gettype( $template ) && is_object( $post ) && CARTFLOWS_STEP_POST_TYPE === $post->post_type ) {
68
-
69
- /**
70
- * Remove Next/Prev Navigation
71
- * add_filter('next_post_link', '__return_empty_string');
72
- * add_filter('previous_post_link', '__return_empty_string');
73
- *
74
- * $page = locate_template( array( 'page.php' ) );
75
- *
76
- * if ( ! empty( $page ) ) {
77
- * return $page;
78
- * }
79
- */
80
-
81
- $page_template = get_post_meta( _get_wcf_step_id(), '_wp_page_template', true );
82
-
83
- $page_template = apply_filters( 'cartflows_page_template', $page_template );
84
-
85
- $file = '';
86
-
87
- switch ( $page_template ) {
88
-
89
- case 'cartflows-default':
90
- $file = CARTFLOWS_FLOW_DIR . 'templates/template-default.php';
91
- $this->body_classes[] = $page_template;
92
- break;
93
- case 'cartflows-canvas':
94
- $file = CARTFLOWS_FLOW_DIR . 'templates/template-canvas.php';
95
- $this->body_classes[] = $page_template;
96
- break;
97
- default:
98
- $file = CARTFLOWS_FLOW_DIR . 'templates/template-default.php';
99
- $this->body_classes[] = 'cartflows-default';
100
- break;
101
- }
102
-
103
- // Just to be safe, we check if the file exist first.
104
- if ( file_exists( $file ) ) {
105
-
106
- /* Add Body Class */
107
- add_filter( 'body_class', [ $this, 'body_class' ] );
108
-
109
- return $file;
110
- } else {
111
- echo $file;
112
- }
113
- }
114
-
115
- return $template;
116
- }
117
-
118
- /**
119
- * Body classes.
120
- *
121
- * @since 1.0.0
122
- * @param array $classes Body classes.
123
- * @return array
124
- */
125
- function body_class( $classes = [] ) {
126
-
127
- $classes = array_merge( $classes, $this->body_classes );
128
-
129
- return $classes;
130
- }
131
-
132
- /**
133
- * Create custom post type
134
- */
135
- function step_post_type() {
136
-
137
- $labels = array(
138
- 'name' => esc_html_x( 'Steps', 'flow step general name', 'cartflows' ),
139
- 'singular_name' => esc_html_x( 'Step', 'flow step singular name', 'cartflows' ),
140
- 'search_items' => esc_html__( 'Search Steps', 'cartflows' ),
141
- 'all_items' => esc_html__( 'All Steps', 'cartflows' ),
142
- 'edit_item' => esc_html__( 'Edit Step', 'cartflows' ),
143
- 'view_item' => esc_html__( 'View Step', 'cartflows' ),
144
- 'add_new' => esc_html__( 'Add New', 'cartflows' ),
145
- 'update_item' => esc_html__( 'Update Step', 'cartflows' ),
146
- 'add_new_item' => esc_html__( 'Add New', 'cartflows' ),
147
- 'new_item_name' => esc_html__( 'New Step Name', 'cartflows' ),
148
- );
149
-
150
- $args = array(
151
- 'labels' => $labels,
152
- 'public' => true,
153
- 'query_var' => true,
154
- 'can_export' => true,
155
- 'exclude_from_search' => true,
156
- 'show_ui' => true,
157
- 'show_in_menu' => false,
158
- 'show_in_admin_bar' => true,
159
- 'supports' => array( 'title', 'editor', 'elementor', 'revisions' ),
160
- 'capability_type' => 'post',
161
- 'capabilities' => array(
162
- 'create_posts' => 'do_not_allow', // Prior to Wordpress 4.5, this was false.
163
- ),
164
- 'map_meta_cap' => true,
165
- );
166
-
167
- register_post_type( CARTFLOWS_STEP_POST_TYPE, $args );
168
-
169
- $args = array(
170
- 'label' => __( 'Step Type', 'cartflows' ),
171
- 'public' => false,
172
- 'rewrite' => false,
173
- 'hierarchical' => false,
174
- );
175
-
176
- register_taxonomy( CARTFLOWS_TAXONOMY_STEP_TYPE, CARTFLOWS_STEP_POST_TYPE, $args );
177
-
178
- $args = array(
179
- 'label' => __( 'Step Flow', 'cartflows' ),
180
- 'public' => false,
181
- 'rewrite' => false,
182
- 'hierarchical' => false,
183
- );
184
-
185
- register_taxonomy( CARTFLOWS_TAXONOMY_STEP_FLOW, CARTFLOWS_STEP_POST_TYPE, $args );
186
-
187
- /**
188
- * Register 'Elementor' & 'Beaver Builder' site types.
189
- *
190
- * @see self::add_terms();
191
- */
192
- $taxonomy = CARTFLOWS_TAXONOMY_STEP_TYPE;
193
-
194
- $terms = array(
195
- array(
196
- 'name' => __( 'Landing', 'cartflows' ),
197
- 'args' => array(
198
- 'slug' => 'landing',
199
- ),
200
- ),
201
- array(
202
- 'name' => __( 'Checkout', 'cartflows' ),
203
- 'args' => array(
204
- 'slug' => 'checkout',
205
- ),
206
- ),
207
- array(
208
- 'name' => __( 'Thank You', 'cartflows' ),
209
- 'args' => array(
210
- 'slug' => 'thankyou',
211
- ),
212
- ),
213
- array(
214
- 'name' => __( 'Upsell', 'cartflows' ),
215
- 'args' => array(
216
- 'slug' => 'upsell',
217
- ),
218
- ),
219
- array(
220
- 'name' => __( 'Downsell', 'cartflows' ),
221
- 'args' => array(
222
- 'slug' => 'downsell',
223
- ),
224
- ),
225
- );
226
-
227
- $this->add_terms( $taxonomy, $terms );
228
- }
229
-
230
- /**
231
- * Add WordPress templates.
232
- *
233
- * Adds Cartflows templates to steps
234
- *
235
- * @since 1.0.0
236
- * @access public
237
- */
238
- function add_wp_templates_support() {
239
- add_filter( 'theme_' . CARTFLOWS_STEP_POST_TYPE . '_templates', array( $this, 'add_page_templates' ), 99, 4 );
240
- }
241
-
242
- /**
243
- * Add page templates.
244
- *
245
- * @since 1.0.0
246
- * @access public
247
- *
248
- * @param array $page_templates Array of page templates.
249
- *
250
- * @param object $wp_theme wp theme.
251
- * @param object $post post.
252
- *
253
- * @return array Page templates.
254
- */
255
- function add_page_templates( $page_templates, $wp_theme, $post ) {
256
-
257
- $page_templates = array(
258
- 'cartflows-canvas' => _x( 'Template for Page Builders', 'cartflows' ),
259
- );
260
-
261
- return $page_templates;
262
- }
263
-
264
- /**
265
- * Have WordPress match postname to any of our public post types.
266
- * All of our public post types can have /post-name/ as the slug, so they need to be unique across all posts.
267
- * By default, WordPress only accounts for posts and pages where the slug is /post-name/.
268
- *
269
- * @param string $query query statement.
270
- */
271
- function add_cpt_post_names_to_main_query( $query ) {
272
-
273
- // Bail if this is not the main query.
274
- if ( ! $query->is_main_query() ) {
275
- return;
276
- }
277
-
278
- // Bail if this query doesn't match our very specific rewrite rule.
279
- if ( ! isset( $query->query['page'] ) || 2 !== count( $query->query ) ) {
280
- return;
281
- }
282
-
283
- // Bail if we're not querying based on the post name.
284
- if ( empty( $query->query['name'] ) ) {
285
- return;
286
- }
287
-
288
- // Add cartflows step post type to existing post type array.
289
- if ( isset( $query->query_vars['post_type'] ) && is_array( $query->query_vars['post_type'] ) ) {
290
-
291
- $post_types = $query->query_vars['post_type'];
292
-
293
- $post_types[] = CARTFLOWS_STEP_POST_TYPE;
294
-
295
- $query->set( 'post_type', $post_types );
296
-
297
- } else {
298
-
299
- // Add CPT to the list of post types WP will include when it queries based on the post name.
300
- $query->set( 'post_type', array( 'post', 'page', CARTFLOWS_STEP_POST_TYPE ) );
301
- }
302
- }
303
-
304
- /**
305
- * Modify permalink
306
- *
307
- * @param string $post_link post link.
308
- * @param array $post post data.
309
- * @param string $leavename leave name.
310
- * @return string
311
- */
312
- function post_type_permalinks( $post_link, $post, $leavename ) {
313
-
314
- // If elementor page preview, return post link as it is.
315
- if ( isset( $_REQUEST['elementor-preview'] ) ) {
316
- return $post_link;
317
- }
318
-
319
- $structure = get_option( 'permalink_structure' );
320
-
321
- if ( '/%postname%/' === $structure ) {
322
-
323
- if ( isset( $post->post_type ) && CARTFLOWS_STEP_POST_TYPE == $post->post_type ) {
324
-
325
- $post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
326
- }
327
- }
328
-
329
- return $post_link;
330
- }
331
-
332
- /**
333
- * Prevent slug duplicated
334
- *
335
- * @param string $slug post slug.
336
- * @param int $post_ID post id.
337
- * @param string $post_status post status.
338
- * @param string $post_type post type.
339
- * @param int $post_parent post parent id.
340
- * @param string $original_slug original slug.
341
- * @return string
342
- */
343
- function prevent_slug_duplicates( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
344
-
345
- $check_post_types = array(
346
- 'post',
347
- 'page',
348
- CARTFLOWS_STEP_POST_TYPE,
349
- );
350
-
351
- if ( ! in_array( $post_type, $check_post_types ) ) {
352
- return $slug;
353
- }
354
-
355
- if ( CARTFLOWS_STEP_POST_TYPE == $post_type ) {
356
- // Saving a post, check for duplicates in POST or PAGE post types.
357
- $post_match = get_page_by_path( $slug, 'OBJECT', 'post' );
358
- $page_match = get_page_by_path( $slug, 'OBJECT', 'page' );
359
-
360
- if ( $post_match || $page_match ) {
361
- $slug .= '-2';
362
- }
363
- } else {
364
-
365
- // Saving a POST or PAGE, check for duplicates in CARTFLOWS_STEP_POST_TYPE post type.
366
- $custom_post_type_match = get_page_by_path( $slug, 'OBJECT', CARTFLOWS_STEP_POST_TYPE );
367
-
368
- if ( $custom_post_type_match ) {
369
- $slug .= '-2';
370
- }
371
- }
372
-
373
- return $slug;
374
- }
375
-
376
- /**
377
- * Add Update messages for any custom post type
378
- *
379
- * @param array $messages Array of default messages.
380
- */
381
- function post_update_messages( $messages ) {
382
-
383
- $custom_post_type = get_post_type( get_the_ID() );
384
-
385
- if ( CARTFLOWS_STEP_POST_TYPE == $custom_post_type ) {
386
-
387
- $obj = get_post_type_object( $custom_post_type );
388
- $singular_name = $obj->labels->singular_name;
389
- $messages[ $custom_post_type ] = array(
390
- 0 => '', // Unused. Messages start at index 1.
391
- /* translators: %s: singular custom post type name */
392
- 1 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
393
- /* translators: %s: singular custom post type name */
394
- 2 => sprintf( __( 'Custom %s updated.', 'cartflows' ), $singular_name ),
395
- /* translators: %s: singular custom post type name */
396
- 3 => sprintf( __( 'Custom %s deleted.', 'cartflows' ), $singular_name ),
397
- /* translators: %s: singular custom post type name */
398
- 4 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
399
- /* translators: %1$s: singular custom post type name ,%2$s: date and time of the revision */
400
- 5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s', 'cartflows' ), $singular_name, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
401
- /* translators: %s: singular custom post type name */
402
- 6 => sprintf( __( '%s published.', 'cartflows' ), $singular_name ),
403
- /* translators: %s: singular custom post type name */
404
- 7 => sprintf( __( '%s saved.', 'cartflows' ), $singular_name ),
405
- /* translators: %s: singular custom post type name */
406
- 8 => sprintf( __( '%s submitted.', 'cartflows' ), $singular_name ),
407
- /* translators: %s: singular custom post type name */
408
- 9 => sprintf( __( '%s scheduled for.', 'cartflows' ), $singular_name ),
409
- /* translators: %s: singular custom post type name */
410
- 10 => sprintf( __( '%s draft updated.', 'cartflows' ), $singular_name ),
411
- );
412
- }
413
-
414
- return $messages;
415
- }
416
-
417
- /**
418
- * Add Terms for Taxonomy.
419
- *
420
- * => Example.
421
- *
422
- * $taxonomy = '{taxonomy}';
423
- * $terms = array(
424
- * array(
425
- * 'name' => 'Free',
426
- * ),
427
- * array(
428
- * 'name' => 'Premium',
429
- * ),
430
- * );
431
- *
432
- * self::add_terms( $taxonomy, $terms );
433
- *
434
- * @since 1.0.0
435
- * @param string $taxonomy Taxonomy Name.
436
- * @param array $terms Terms list.
437
- * @return void
438
- */
439
- function add_terms( $taxonomy = '', $terms = array() ) {
440
-
441
- foreach ( $terms as $key => $term ) {
442
-
443
- $term_exist = term_exists( $term['name'], $taxonomy );
444
-
445
- if ( empty( $term_exist ) ) {
446
-
447
- /**
448
- * Add additional args if passed from request.
449
- *
450
- * @see https://codex.wordpress.org/Function_Reference/wp_insert_term
451
- */
452
- if ( array_key_exists( 'args', $term ) ) {
453
- wp_insert_term( $term['name'], $taxonomy, $term['args'] );
454
- } else {
455
- wp_insert_term( $term['name'], $taxonomy );
456
- }
457
- }
458
- }
459
- }
460
- }
461
-
462
- /**
463
- * Kicking this off by calling 'get_instance()' method
464
- */
465
- Cartflows_Step_Post_Type::get_instance();
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Step post type.
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ /**
9
+ * Initialization
10
+ *
11
+ * @since 1.0.0
12
+ */
13
+ class Cartflows_Step_Post_Type {
14
+
15
+
16
+ /**
17
+ * Member Variable
18
+ *
19
+ * @var instance
20
+ */
21
+ private static $instance;
22
+
23
+ /**
24
+ * Member Variable
25
+ *
26
+ * @var body_classes
27
+ */
28
+ private $body_classes = array();
29
+
30
+ /**
31
+ * Initiator
32
+ */
33
+ public static function get_instance() {
34
+ if ( ! isset( self::$instance ) ) {
35
+ self::$instance = new self;
36
+ }
37
+ return self::$instance;
38
+ }
39
+
40
+ /**
41
+ * Constructor
42
+ */
43
+ public function __construct() {
44
+
45
+ add_action( 'init', array( $this, 'step_post_type' ) );
46
+ add_action( 'init', array( $this, 'add_wp_templates_support' ) );
47
+ add_filter( 'post_updated_messages', array( $this, 'post_update_messages' ) );
48
+ add_filter( 'post_type_link', array( $this, 'post_type_permalinks' ), 10, 3 );
49
+ add_filter( 'wp_unique_post_slug', array( $this, 'prevent_slug_duplicates' ), 10, 6 );
50
+ add_action( 'pre_get_posts', array( $this, 'add_cpt_post_names_to_main_query' ), 20 );
51
+
52
+ add_filter( 'template_include', array( $this, 'load_page_template' ), 99 );
53
+ }
54
+
55
+
56
+ /**
57
+ * Trys to load page.php for a header, footer or part theme layout.
58
+ *
59
+ * @since 1.0.0
60
+ * @param string $template The current template to be loaded.
61
+ * @return string
62
+ */
63
+ function load_page_template( $template ) {
64
+
65
+ global $post;
66
+
67
+ if ( 'string' == gettype( $template ) && is_object( $post ) && CARTFLOWS_STEP_POST_TYPE === $post->post_type ) {
68
+
69
+ /**
70
+ * Remove Next/Prev Navigation
71
+ * add_filter('next_post_link', '__return_empty_string');
72
+ * add_filter('previous_post_link', '__return_empty_string');
73
+ *
74
+ * $page = locate_template( array( 'page.php' ) );
75
+ *
76
+ * if ( ! empty( $page ) ) {
77
+ * return $page;
78
+ * }
79
+ */
80
+
81
+ /* Remove Next / Previous Rel Link */
82
+ remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
83
+ add_filter( 'next_post_rel_link', '__return_empty_string' );
84
+ add_filter( 'previous_post_rel_link', '__return_empty_string' );
85
+
86
+ $page_template = get_post_meta( _get_wcf_step_id(), '_wp_page_template', true );
87
+
88
+ $page_template = apply_filters( 'cartflows_page_template', $page_template );
89
+
90
+ $file = '';
91
+
92
+ switch ( $page_template ) {
93
+
94
+ case 'cartflows-default':
95
+ $file = CARTFLOWS_FLOW_DIR . 'templates/template-default.php';
96
+ $this->body_classes[] = $page_template;
97
+ break;
98
+ case 'cartflows-canvas':
99
+ $file = CARTFLOWS_FLOW_DIR . 'templates/template-canvas.php';
100
+ $this->body_classes[] = $page_template;
101
+ break;
102
+ default:
103
+ $file = CARTFLOWS_FLOW_DIR . 'templates/template-default.php';
104
+ $this->body_classes[] = 'cartflows-default';
105
+ break;
106
+ }
107
+
108
+ // Just to be safe, we check if the file exist first.
109
+ if ( file_exists( $file ) ) {
110
+
111
+ /* Add Body Class */
112
+ add_filter( 'body_class', [ $this, 'body_class' ] );
113
+
114
+ return $file;
115
+ } else {
116
+ echo $file;
117
+ }
118
+ }
119
+
120
+ return $template;
121
+ }
122
+
123
+ /**
124
+ * Body classes.
125
+ *
126
+ * @since 1.0.0
127
+ * @param array $classes Body classes.
128
+ * @return array
129
+ */
130
+ function body_class( $classes = [] ) {
131
+
132
+ $classes = array_merge( $classes, $this->body_classes );
133
+
134
+ return $classes;
135
+ }
136
+
137
+ /**
138
+ * Create custom post type
139
+ */
140
+ function step_post_type() {
141
+
142
+ $labels = array(
143
+ 'name' => esc_html_x( 'Steps', 'flow step general name', 'cartflows' ),
144
+ 'singular_name' => esc_html_x( 'Step', 'flow step singular name', 'cartflows' ),
145
+ 'search_items' => esc_html__( 'Search Steps', 'cartflows' ),
146
+ 'all_items' => esc_html__( 'All Steps', 'cartflows' ),
147
+ 'edit_item' => esc_html__( 'Edit Step', 'cartflows' ),
148
+ 'view_item' => esc_html__( 'View Step', 'cartflows' ),
149
+ 'add_new' => esc_html__( 'Add New', 'cartflows' ),
150
+ 'update_item' => esc_html__( 'Update Step', 'cartflows' ),
151
+ 'add_new_item' => esc_html__( 'Add New', 'cartflows' ),
152
+ 'new_item_name' => esc_html__( 'New Step Name', 'cartflows' ),
153
+ );
154
+
155
+ $args = array(
156
+ 'labels' => $labels,
157
+ 'public' => true,
158
+ 'query_var' => true,
159
+ 'can_export' => true,
160
+ 'exclude_from_search' => true,
161
+ 'show_ui' => true,
162
+ 'show_in_menu' => false,
163
+ 'show_in_admin_bar' => true,
164
+ 'supports' => array( 'title', 'editor', 'elementor', 'revisions' ),
165
+ 'capability_type' => 'post',
166
+ 'capabilities' => array(
167
+ 'create_posts' => 'do_not_allow', // Prior to Wordpress 4.5, this was false.
168
+ ),
169
+ 'map_meta_cap' => true,
170
+ );
171
+
172
+ register_post_type( CARTFLOWS_STEP_POST_TYPE, $args );
173
+
174
+ $args = array(
175
+ 'label' => __( 'Step Type', 'cartflows' ),
176
+ 'public' => false,
177
+ 'rewrite' => false,
178
+ 'hierarchical' => false,
179
+ );
180
+
181
+ register_taxonomy( CARTFLOWS_TAXONOMY_STEP_TYPE, CARTFLOWS_STEP_POST_TYPE, $args );
182
+
183
+ $args = array(
184
+ 'label' => __( 'Step Flow', 'cartflows' ),
185
+ 'public' => false,
186
+ 'rewrite' => false,
187
+ 'hierarchical' => false,
188
+ );
189
+
190
+ register_taxonomy( CARTFLOWS_TAXONOMY_STEP_FLOW, CARTFLOWS_STEP_POST_TYPE, $args );
191
+
192
+ /**
193
+ * Register 'Elementor' & 'Beaver Builder' site types.
194
+ *
195
+ * @see self::add_terms();
196
+ */
197
+ $taxonomy = CARTFLOWS_TAXONOMY_STEP_TYPE;
198
+
199
+ $terms = array(
200
+ array(
201
+ 'name' => __( 'Landing', 'cartflows' ),
202
+ 'args' => array(
203
+ 'slug' => 'landing',
204
+ ),
205
+ ),
206
+ array(
207
+ 'name' => __( 'Checkout', 'cartflows' ),
208
+ 'args' => array(
209
+ 'slug' => 'checkout',
210
+ ),
211
+ ),
212
+ array(
213
+ 'name' => __( 'Thank You', 'cartflows' ),
214
+ 'args' => array(
215
+ 'slug' => 'thankyou',
216
+ ),
217
+ ),
218
+ array(
219
+ 'name' => __( 'Upsell', 'cartflows' ),
220
+ 'args' => array(
221
+ 'slug' => 'upsell',
222
+ ),
223
+ ),
224
+ array(
225
+ 'name' => __( 'Downsell', 'cartflows' ),
226
+ 'args' => array(
227
+ 'slug' => 'downsell',
228
+ ),
229
+ ),
230
+ );
231
+
232
+ $this->add_terms( $taxonomy, $terms );
233
+ }
234
+
235
+ /**
236
+ * Add WordPress templates.
237
+ *
238
+ * Adds Cartflows templates to steps
239
+ *
240
+ * @since 1.0.0
241
+ * @access public
242
+ */
243
+ function add_wp_templates_support() {
244
+ add_filter( 'theme_' . CARTFLOWS_STEP_POST_TYPE . '_templates', array( $this, 'add_page_templates' ), 99, 4 );
245
+ }
246
+
247
+ /**
248
+ * Add page templates.
249
+ *
250
+ * @since 1.0.0
251
+ * @access public
252
+ *
253
+ * @param array $page_templates Array of page templates.
254
+ *
255
+ * @param object $wp_theme wp theme.
256
+ * @param object $post post.
257
+ *
258
+ * @return array Page templates.
259
+ */
260
+ function add_page_templates( $page_templates, $wp_theme, $post ) {
261
+
262
+ $page_templates = array(
263
+ 'cartflows-canvas' => _x( 'Template for Page Builders', 'cartflows' ),
264
+ );
265
+
266
+ return $page_templates;
267
+ }
268
+
269
+ /**
270
+ * Have WordPress match postname to any of our public post types.
271
+ * All of our public post types can have /post-name/ as the slug, so they need to be unique across all posts.
272
+ * By default, WordPress only accounts for posts and pages where the slug is /post-name/.
273
+ *
274
+ * @param string $query query statement.
275
+ */
276
+ function add_cpt_post_names_to_main_query( $query ) {
277
+
278
+ // Bail if this is not the main query.
279
+ if ( ! $query->is_main_query() ) {
280
+ return;
281
+ }
282
+
283
+ // Bail if this query doesn't match our very specific rewrite rule.
284
+ if ( ! isset( $query->query['page'] ) || 2 !== count( $query->query ) ) {
285
+ return;
286
+ }
287
+
288
+ // Bail if we're not querying based on the post name.
289
+ if ( empty( $query->query['name'] ) ) {
290
+ return;
291
+ }
292
+
293
+ // Add cartflows step post type to existing post type array.
294
+ if ( isset( $query->query_vars['post_type'] ) && is_array( $query->query_vars['post_type'] ) ) {
295
+
296
+ $post_types = $query->query_vars['post_type'];
297
+
298
+ $post_types[] = CARTFLOWS_STEP_POST_TYPE;
299
+
300
+ $query->set( 'post_type', $post_types );
301
+
302
+ } else {
303
+
304
+ // Add CPT to the list of post types WP will include when it queries based on the post name.
305
+ $query->set( 'post_type', array( 'post', 'page', CARTFLOWS_STEP_POST_TYPE ) );
306
+ }
307
+ }
308
+
309
+ /**
310
+ * Modify permalink
311
+ *
312
+ * @param string $post_link post link.
313
+ * @param array $post post data.
314
+ * @param string $leavename leave name.
315
+ * @return string
316
+ */
317
+ function post_type_permalinks( $post_link, $post, $leavename ) {
318
+
319
+ // If elementor page preview, return post link as it is.
320
+ if ( isset( $_REQUEST['elementor-preview'] ) ) {
321
+ return $post_link;
322
+ }
323
+
324
+ $structure = get_option( 'permalink_structure' );
325
+
326
+ if ( '/%postname%/' === $structure ) {
327
+
328
+ if ( isset( $post->post_type ) && CARTFLOWS_STEP_POST_TYPE == $post->post_type ) {
329
+
330
+ $post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
331
+ }
332
+ }
333
+
334
+ return $post_link;
335
+ }
336
+
337
+ /**
338
+ * Prevent slug duplicated
339
+ *
340
+ * @param string $slug post slug.
341
+ * @param int $post_ID post id.
342
+ * @param string $post_status post status.
343
+ * @param string $post_type post type.
344
+ * @param int $post_parent post parent id.
345
+ * @param string $original_slug original slug.
346
+ * @return string
347
+ */
348
+ function prevent_slug_duplicates( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
349
+
350
+ $check_post_types = array(
351
+ 'post',
352
+ 'page',
353
+ CARTFLOWS_STEP_POST_TYPE,
354
+ );
355
+
356
+ if ( ! in_array( $post_type, $check_post_types ) ) {
357
+ return $slug;
358
+ }
359
+
360
+ if ( CARTFLOWS_STEP_POST_TYPE == $post_type ) {
361
+ // Saving a post, check for duplicates in POST or PAGE post types.
362
+ $post_match = get_page_by_path( $slug, 'OBJECT', 'post' );
363
+ $page_match = get_page_by_path( $slug, 'OBJECT', 'page' );
364
+
365
+ if ( $post_match || $page_match ) {
366
+ $slug .= '-2';
367
+ }
368
+ } else {
369
+
370
+ // Saving a POST or PAGE, check for duplicates in CARTFLOWS_STEP_POST_TYPE post type.
371
+ $custom_post_type_match = get_page_by_path( $slug, 'OBJECT', CARTFLOWS_STEP_POST_TYPE );
372
+
373
+ if ( $custom_post_type_match ) {
374
+ $slug .= '-2';
375
+ }
376
+ }
377
+
378
+ return $slug;
379
+ }
380
+
381
+ /**
382
+ * Add Update messages for any custom post type
383
+ *
384
+ * @param array $messages Array of default messages.
385
+ */
386
+ function post_update_messages( $messages ) {
387
+
388
+ $custom_post_type = get_post_type( get_the_ID() );
389
+
390
+ if ( CARTFLOWS_STEP_POST_TYPE == $custom_post_type ) {
391
+
392
+ $obj = get_post_type_object( $custom_post_type );
393
+ $singular_name = $obj->labels->singular_name;
394
+ $messages[ $custom_post_type ] = array(
395
+ 0 => '', // Unused. Messages start at index 1.
396
+ /* translators: %s: singular custom post type name */
397
+ 1 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
398
+ /* translators: %s: singular custom post type name */
399
+ 2 => sprintf( __( 'Custom %s updated.', 'cartflows' ), $singular_name ),
400
+ /* translators: %s: singular custom post type name */
401
+ 3 => sprintf( __( 'Custom %s deleted.', 'cartflows' ), $singular_name ),
402
+ /* translators: %s: singular custom post type name */
403
+ 4 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
404
+ /* translators: %1$s: singular custom post type name ,%2$s: date and time of the revision */
405
+ 5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s', 'cartflows' ), $singular_name, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
406
+ /* translators: %s: singular custom post type name */
407
+ 6 => sprintf( __( '%s published.', 'cartflows' ), $singular_name ),
408
+ /* translators: %s: singular custom post type name */
409
+ 7 => sprintf( __( '%s saved.', 'cartflows' ), $singular_name ),
410
+ /* translators: %s: singular custom post type name */
411
+ 8 => sprintf( __( '%s submitted.', 'cartflows' ), $singular_name ),
412
+ /* translators: %s: singular custom post type name */
413
+ 9 => sprintf( __( '%s scheduled for.', 'cartflows' ), $singular_name ),
414
+ /* translators: %s: singular custom post type name */
415
+ 10 => sprintf( __( '%s draft updated.', 'cartflows' ), $singular_name ),
416
+ );
417
+ }
418
+
419
+ return $messages;
420
+ }
421
+
422
+ /**
423
+ * Add Terms for Taxonomy.
424
+ *
425
+ * => Example.
426
+ *
427
+ * $taxonomy = '{taxonomy}';
428
+ * $terms = array(
429
+ * array(
430
+ * 'name' => 'Free',
431
+ * ),
432
+ * array(
433
+ * 'name' => 'Premium',
434
+ * ),
435
+ * );
436
+ *
437
+ * self::add_terms( $taxonomy, $terms );
438
+ *
439
+ * @since 1.0.0
440
+ * @param string $taxonomy Taxonomy Name.
441
+ * @param array $terms Terms list.
442
+ * @return void
443
+ */
444
+ function add_terms( $taxonomy = '', $terms = array() ) {
445
+
446
+ foreach ( $terms as $key => $term ) {
447
+
448
+ $term_exist = term_exists( $term['name'], $taxonomy );
449
+
450
+ if ( empty( $term_exist ) ) {
451
+
452
+ /**
453
+ * Add additional args if passed from request.
454
+ *
455
+ * @see https://codex.wordpress.org/Function_Reference/wp_insert_term
456
+ */
457
+ if ( array_key_exists( 'args', $term ) ) {
458
+ wp_insert_term( $term['name'], $taxonomy, $term['args'] );
459
+ } else {
460
+ wp_insert_term( $term['name'], $taxonomy );
461
+ }
462
+ }
463
+ }
464
+ }
465
+ }
466
+
467
+ /**
468
+ * Kicking this off by calling 'get_instance()' method
469
+ */
470
+ Cartflows_Step_Post_Type::get_instance();
modules/flow/templates/template-canvas.php CHANGED
@@ -1,47 +1,49 @@
1
- <?php
2
- /**
3
- * Template Name: No Header Footer
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- ?>
9
-
10
- <!DOCTYPE html>
11
- <html <?php language_attributes(); ?> class="no-js">
12
- <head>
13
- <meta charset="<?php bloginfo( 'charset' ); ?>">
14
- <meta name="viewport" content="width=device-width, initial-scale=1">
15
- <link rel="profile" href="http://gmpg.org/xfn/11">
16
- <?php wp_head(); ?>
17
- </head>
18
-
19
- <body <?php body_class(); ?>>
20
-
21
- <?php
22
-
23
- $atts_string = Cartflows_Helper::get_cartflows_container_atts();
24
-
25
- ?>
26
- <div class="cartflows-container" <?php echo trim( $atts_string ); ?>>
27
-
28
- <?php
29
- do_action( 'cartflows_container_top' );
30
- while ( have_posts() ) :
31
-
32
- the_post();
33
- the_content();
34
-
35
- endwhile;
36
- do_action( 'cartflows_container_bottom' );
37
- ?>
38
- </div>
39
-
40
- <?php do_action( 'cartflows_wp_footer' ); ?>
41
-
42
- <?php wp_footer(); ?>
43
- </body>
44
-
45
- </html>
46
-
47
- <?php
 
 
1
+ <?php
2
+ /**
3
+ * Template Name: No Header Footer
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ ?>
9
+
10
+ <!DOCTYPE html>
11
+ <html <?php language_attributes(); ?> class="no-js">
12
+ <head>
13
+ <meta charset="<?php bloginfo( 'charset' ); ?>">
14
+ <meta name="viewport" content="width=device-width, initial-scale=1">
15
+ <link rel="profile" href="http://gmpg.org/xfn/11">
16
+ <?php wp_head(); ?>
17
+ </head>
18
+
19
+ <body <?php body_class(); ?>>
20
+
21
+ <?php do_action( 'cartflows_body_top' ); ?>
22
+
23
+ <?php
24
+
25
+ $atts_string = Cartflows_Helper::get_cartflows_container_atts();
26
+
27
+ ?>
28
+ <div class="cartflows-container" <?php echo trim( $atts_string ); ?>>
29
+
30
+ <?php
31
+ do_action( 'cartflows_container_top' );
32
+ while ( have_posts() ) :
33
+
34
+ the_post();
35
+ the_content();
36
+
37
+ endwhile;
38
+ do_action( 'cartflows_container_bottom' );
39
+ ?>
40
+ </div>
41
+
42
+ <?php do_action( 'cartflows_wp_footer' ); ?>
43
+
44
+ <?php wp_footer(); ?>
45
+ </body>
46
+
47
+ </html>
48
+
49
+ <?php
modules/flow/templates/template-default.php CHANGED
@@ -1,51 +1,54 @@
1
- <?php
2
- /**
3
- * Template Name: No Header Footer
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- ?>
9
-
10
- <!DOCTYPE html>
11
- <html <?php language_attributes(); ?> class="no-js">
12
- <head>
13
- <meta charset="<?php bloginfo( 'charset' ); ?>">
14
- <meta name="viewport" content="width=device-width, initial-scale=1">
15
- <link rel="profile" href="http://gmpg.org/xfn/11">
16
- <?php wp_head(); ?>
17
- </head>
18
-
19
- <body <?php body_class(); ?>>
20
- <?php
21
-
22
- $atts_string = Cartflows_Helper::get_cartflows_container_atts();
23
-
24
- ?>
25
- <div class="cartflows-container" <?php echo trim( $atts_string ); ?>>
26
- <?php
27
- do_action( 'cartflows_container_top' );
28
- ?>
29
- <div class="cartflows-primary">
30
- <?php
31
- while ( have_posts() ) :
32
-
33
- the_post();
34
- the_content();
35
-
36
- endwhile;
37
- ?>
38
- </div>
39
- <?php
40
- do_action( 'cartflows_container_bottom' );
41
- ?>
42
- </div>
43
-
44
- <?php do_action( 'cartflows_wp_footer' ); ?>
45
-
46
- <?php wp_footer(); ?>
47
- </body>
48
-
49
- </html>
50
-
51
- <?php
 
 
 
1
+ <?php
2
+ /**
3
+ * Template Name: No Header Footer
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ ?>
9
+
10
+ <!DOCTYPE html>
11
+ <html <?php language_attributes(); ?> class="no-js">
12
+ <head>
13
+ <meta charset="<?php bloginfo( 'charset' ); ?>">
14
+ <meta name="viewport" content="width=device-width, initial-scale=1">
15
+ <link rel="profile" href="http://gmpg.org/xfn/11">
16
+ <?php wp_head(); ?>
17
+ </head>
18
+
19
+ <body <?php body_class(); ?>>
20
+
21
+ <?php do_action( 'cartflows_body_top' ); ?>
22
+
23
+ <?php
24
+
25
+ $atts_string = Cartflows_Helper::get_cartflows_container_atts();
26
+
27
+ ?>
28
+ <div class="cartflows-container" <?php echo trim( $atts_string ); ?>>
29
+ <?php
30
+ do_action( 'cartflows_container_top' );
31
+ ?>
32
+ <div class="cartflows-primary">
33
+ <?php
34
+ while ( have_posts() ) :
35
+
36
+ the_post();
37
+ the_content();
38
+
39
+ endwhile;
40
+ ?>
41
+ </div>
42
+ <?php
43
+ do_action( 'cartflows_container_bottom' );
44
+ ?>
45
+ </div>
46
+
47
+ <?php do_action( 'cartflows_wp_footer' ); ?>
48
+
49
+ <?php wp_footer(); ?>
50
+ </body>
51
+
52
+ </html>
53
+
54
+ <?php
modules/flow/view/meta-flow-steps.php CHANGED
@@ -1,200 +1,200 @@
1
- <?php
2
- /**
3
- * View Flow steps
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- $default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
9
-
10
- $get_steps = array(
11
- 'landing' => __( 'Landing', 'cartflows' ),
12
- 'checkout' => __( 'Checkout', 'cartflows' ),
13
- 'thankyou' => __( 'Thank You', 'cartflows' ),
14
- 'upsell' => __( 'Upsell', 'cartflows' ),
15
- 'downsell' => __( 'Downsell', 'cartflows' ),
16
-
17
- );
18
-
19
- ?>
20
- <div class="wcf-flow-steps-meta-box">
21
- <div class="wcf-flow-settings">
22
- <?php do_action( 'cartflows_above_flow_steps' ); ?>
23
- <div class="wcf-flow-steps-wrap">
24
- <div class="wcf-flow-steps-container">
25
- <?php if ( is_array( $options['steps'] ) ) { ?>
26
- <?php foreach ( $options['steps'] as $index => $data ) { ?>
27
- <?php
28
- $term_slug = '';
29
- $term_name = '';
30
- $step_wrap_class = '';
31
- $has_product_assigned = true;
32
- $is_global_checkout = '';
33
- $common = '';
34
-
35
- if ( isset( $data['type'] ) ) {
36
- $term_slug = $data['type'];
37
- $term_name = $get_steps[ $data['type'] ];
38
- }
39
-
40
- if ( ! _is_cartflows_pro() && ( 'upsell' === $term_slug || 'downsell' === $term_slug ) ) {
41
- $step_wrap_class .= ' invalid-step';
42
- }
43
-
44
- if ( isset( $_GET['highlight-step-id'] ) && $_GET['highlight-step-id'] == $data['id'] ) {
45
- $step_wrap_class .= ' wcf-new-step-highlight';
46
- }
47
-
48
- if ( 'checkout' === $term_slug ) {
49
-
50
- $common = Cartflows_Helper::get_common_settings();
51
-
52
- $is_global_checkout = (int) $common['global_checkout'];
53
-
54
- if ( $data['id'] === $is_global_checkout ) {
55
- $step_wrap_class .= ' wcf-global-checkout';
56
- }
57
- }
58
-
59
- if ( 'upsell' === $term_slug || 'downsell' === $term_slug || 'checkout' === $term_slug ) {
60
-
61
- $has_product_assigned = Cartflows_Helper::has_product_assigned( $data['id'] );
62
-
63
- if ( ( ! $has_product_assigned ) && ( $data['id'] != $is_global_checkout ) ) {
64
- $step_wrap_class .= ' wcf-no-product-step';
65
- }
66
- }
67
-
68
- ?>
69
- <div class="wcf-step-wrap <?php echo $step_wrap_class; ?>" data-id="<?php echo $data['id']; ?>" data-term-slug="<?php echo esc_attr( $term_slug ); ?>">
70
- <div class="wcf-step">
71
- <div class="wcf-step-left-content">
72
- <span class="dashicons dashicons-menu"></span>
73
- <span><?php echo wp_trim_words( get_the_title( $data['id'] ), 3 ); ?></span>
74
- <span class="wcf-flow-badge"><?php echo esc_attr( $term_name ); ?></span>
75
-
76
- <?php
77
- if ( ( ! $has_product_assigned ) && ( $data['id'] != $is_global_checkout ) ) {
78
- ?>
79
- <span class="wcf-no-product-badge"><?php _e( 'No Product Assigned', 'cartflows' ); ?></span>
80
- <?php
81
- } elseif ( ( $has_product_assigned ) && ( $data['id'] === $is_global_checkout ) ) {
82
- ?>
83
- <span class="wcf-global-checkout-badge"><?php _e( 'Global Checkout - Remove selected checkout product', 'cartflows' ); ?></span>
84
- <?php
85
- } elseif ( ( ! $has_product_assigned ) && $data['id'] === $is_global_checkout ) {
86
- ?>
87
- <span class="wcf-global-checkout-badge"><?php _e( 'Global Checkout', 'cartflows' ); ?></span>
88
- <?php
89
- }
90
- ?>
91
-
92
- <input type="hidden" class="wcf-steps-hidden" name="wcf-steps[]" value="<?php echo $data['id']; ?>">
93
- </div>
94
- <div class="wcf-steps-action-buttons">
95
- <a href="<?php echo get_permalink( $data['id'] ); ?>" target="_blank" class="wcf-step-view wcf-action-button wp-ui-text-highlight" title="<?php echo __( 'View Step', 'cartflows' ); ?>" >
96
- <span class="dashicons dashicons-visibility"></span>
97
- <span class="wcf-step-act-btn-text">View</span>
98
- </a>
99
- <a href="<?php echo get_edit_post_link( $data['id'] ); ?>" class="wcf-step-edit wcf-action-button wp-ui-text-highlight" title="<?php echo __( 'Edit Step', 'cartflows' ); ?>" >
100
- <span class="dashicons dashicons-edit"></span>
101
- <span class="wcf-step-act-btn-text">Edit</span>
102
- </a>
103
- <a href="<?php echo wp_nonce_url( 'admin.php?action=cartflows_clone_step&post=' . $data['id'], 'step_clone', 'step_clone_nonce' ); ?>" class="wcf-step-clone wcf-action-button wp-ui-text-highlight" title="<?php echo __( 'Clone Step', 'cartflows' ); ?>" data-id="<?php echo $data['id']; ?>">
104
- <span class="dashicons dashicons-admin-page"></span>
105
- <span class="wcf-step-act-btn-text">Clone</span>
106
- </a>
107
- <a href="#" class="wcf-step-delete wcf-action-button wp-ui-text-highlight" title="<?php echo __( 'Delete Step', 'cartflows' ); ?>" data-id="<?php echo $data['id']; ?>">
108
- <span class="dashicons dashicons-trash"></span>
109
- <span class="wcf-step-act-btn-text">Delete</span>
110
- </a>
111
- </div>
112
- </div>
113
- </div><!-- .wcf-step-wrap -->
114
- <?php } ?>
115
- <?php } ?>
116
- </div><!-- .wcf-flow-steps-container -->
117
- </div> <!-- .wcf-flow-steps-wrap -->
118
- <div class="wcf-flow-buttons-wrap"> <!-- .wcf-flow-buttons-wrap -->
119
- <?php do_action( 'cartflows_bellow_flow_steps' ); ?>
120
- <div class='wcf-add-new-step-btn-wrap'>
121
- <button class='wcf-trigger-popup button button-primary'>
122
- <?php echo __( 'Add New Step', 'cartflows' ); ?>
123
- </button>
124
- </div>
125
- </div><!-- .wcf-flow-buttons-wrap -->
126
- </div><!-- .wcf-flow-settings -->
127
-
128
- <div id="wcf-remote-step-importer" class="wcf-templates-popup-overlay">
129
- <div class="wcf-templates-popup-content">
130
- <div class="spinner"></div>
131
- <div class="wcf-templates-wrap wcf-templates-wrap-flows">
132
-
133
- <div id="wcf-remote-step-actions" class="wcf-template-header">
134
- <div class="wcf-template-logo-wrap">
135
- <span class="wcf-cartflows-logo-img">
136
- <span class="cartflows-icon"></span>
137
- </span>
138
- <span class="wcf-cartflows-title"><?php _e( 'Steps Library', 'cartflows' ); ?></span>
139
- </div>
140
- <div class="wcf-tab-wrapper">
141
- <?php if ( 'other' !== $default_page_builder ) { ?>
142
- <div id="wcf-get-started-steps">
143
- <ul class="filter-links ">
144
- <li>
145
- <a href="#" class="current" data-slug="ready-templates" data-title="<?php _e( 'Ready Templates', 'cartflows' ); ?>"><?php _e( 'Ready Templates', 'cartflows' ); ?></a>
146
- </li>
147
- <li>
148
- <a href="#" data-slug="canvas" data-title="<?php _e( 'Create Your Own', 'cartflows' ); ?>"><?php _e( 'Create Your Own', 'cartflows' ); ?></a>
149
- </li>
150
- </ul>
151
- </div>
152
- <?php } ?>
153
- </div>
154
- <div class="wcf-popup-close-wrap">
155
- <span class="close-icon"><span class="wcf-cartflow-icons dashicons dashicons-no"></span></span>
156
- </div>
157
- </div>
158
-
159
- <!--<div class="wcf-search-form">
160
- <label class="screen-reader-text" for="wp-filter-search-input"><?php _e( 'Search Sites', 'cartflows' ); ?> </label>
161
- <input placeholder="<?php _e( 'Search Flow...', 'cartflows' ); ?>" type="text" aria-describedby="live-search-desc" class="wcf-flow-search-input">
162
- </div>-->
163
-
164
- <div id="wcf-remote-content">
165
- <?php if ( 'other' !== $default_page_builder ) { ?>
166
- <div id="wcf-ready-templates">
167
- <div id="wcf-remote-filters">
168
- <div id="wcf-page-builders"></div>
169
- <div id="wcf-categories"></div>
170
- </div>
171
- <div class="wcf-page-builder-notice"></div>
172
- <div id="wcf-remote-step-list" class="wcf-remote-list wcf-template-list-wrap"><span class="spinner is-active"></span></div>
173
- <div id="wcf-upcoming-page-builders" style="display: none;" class="wcf-remote-list wcf-template-list-wrap"></div>
174
- </div>
175
- <?php } ?>
176
- <div id="wcf-start-from-scratch" style="<?php echo ( 'other' !== $default_page_builder ) ? 'display: none;' : ''; ?>">
177
- <div class="inner">
178
- <div id="wcf-scratch-steps-categories">
179
- <select class="step-type-filter-links filter-links">
180
- <option value="" class="current"> Select Step Type </option>
181
- <option value="52" data-group="52" class="Landing" data-slug="landing" data-title="Landing">Landing</option>
182
- <option value="53" data-group="53" class="Checkout" data-slug="checkout" data-title="Checkout">Checkout</option>
183
- <option value="55" data-group="55" class="Upsell" data-slug="upsell" data-title="Upsell">Upsell</option>
184
- <option value="56" data-group="56" class="Downsell" data-slug="downsell" data-title="Downsell">Downsell</option>
185
- <option value="54" data-group="54" class="Thank You" data-slug="thankyou" data-title="Thank You">Thank You</option>
186
- </select>
187
- </div>
188
- <a href="#" class="button button-primary cartflows-step-import-blank"><?php _e( 'Create Step', 'cartflows' ); ?></a>
189
- <?php if ( ! _is_cartflows_pro() ) { ?>
190
- <div class="wcf-template-notice"><p><?php echo __( 'You need a Cartflows Pro version to import Upsell / Downsell', 'cartflows' ); ?></p></div>
191
- <?php } ?>
192
- <p class="wcf-learn-how"><a href="https://cartflows.com/docs/cartflows-step-types/" target="_blank"><?php _e( 'Learn How', 'cartflows' ); ?> <i class="dashicons dashicons-external"></i></a></p>
193
- </div>
194
- </div>
195
- </div>
196
- </div>
197
- </div>
198
- </div><!-- .wcf-templates-popup-overlay -->
199
- </div>
200
- <?php
1
+ <?php
2
+ /**
3
+ * View Flow steps
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ $default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
9
+
10
+ $get_steps = array(
11
+ 'landing' => __( 'Landing', 'cartflows' ),
12
+ 'checkout' => __( 'Checkout', 'cartflows' ),
13
+ 'thankyou' => __( 'Thank You', 'cartflows' ),
14
+ 'upsell' => __( 'Upsell', 'cartflows' ),
15
+ 'downsell' => __( 'Downsell', 'cartflows' ),
16
+
17
+ );
18
+
19
+ ?>
20
+ <div class="wcf-flow-steps-meta-box">
21
+ <div class="wcf-flow-settings">
22
+ <?php do_action( 'cartflows_above_flow_steps' ); ?>
23
+ <div class="wcf-flow-steps-wrap">
24
+ <div class="wcf-flow-steps-container">
25
+ <?php if ( is_array( $options['steps'] ) ) { ?>
26
+ <?php foreach ( $options['steps'] as $index => $data ) { ?>
27
+ <?php
28
+ $term_slug = '';
29
+ $term_name = '';
30
+ $step_wrap_class = '';
31
+ $has_product_assigned = true;
32
+ $is_global_checkout = '';
33
+ $common = '';
34
+
35
+ if ( isset( $data['type'] ) ) {
36
+ $term_slug = $data['type'];
37
+ $term_name = $get_steps[ $data['type'] ];
38
+ }
39
+
40
+ if ( ! _is_cartflows_pro() && ( 'upsell' === $term_slug || 'downsell' === $term_slug ) ) {
41
+ $step_wrap_class .= ' invalid-step';
42
+ }
43
+
44
+ if ( isset( $_GET['highlight-step-id'] ) && $_GET['highlight-step-id'] == $data['id'] ) {
45
+ $step_wrap_class .= ' wcf-new-step-highlight';
46
+ }
47
+
48
+ if ( 'checkout' === $term_slug ) {
49
+
50
+ $common = Cartflows_Helper::get_common_settings();
51
+
52
+ $is_global_checkout = (int) $common['global_checkout'];
53
+
54
+ if ( $data['id'] === $is_global_checkout ) {
55
+ $step_wrap_class .= ' wcf-global-checkout';
56
+ }
57
+ }
58
+
59
+ if ( 'upsell' === $term_slug || 'downsell' === $term_slug || 'checkout' === $term_slug ) {
60
+
61
+ $has_product_assigned = Cartflows_Helper::has_product_assigned( $data['id'] );
62
+
63
+ if ( ( ! $has_product_assigned ) && ( $data['id'] != $is_global_checkout ) ) {
64
+ $step_wrap_class .= ' wcf-no-product-step';
65
+ }
66
+ }
67
+
68
+ ?>
69
+ <div class="wcf-step-wrap <?php echo $step_wrap_class; ?>" data-id="<?php echo $data['id']; ?>" data-term-slug="<?php echo esc_attr( $term_slug ); ?>">
70
+ <div class="wcf-step">
71
+ <div class="wcf-step-left-content">
72
+ <span class="dashicons dashicons-menu"></span>
73
+ <span><?php echo wp_trim_words( get_the_title( $data['id'] ), 3 ); ?></span>
74
+ <span class="wcf-flow-badge"><?php echo esc_attr( $term_name ); ?></span>
75
+
76
+ <?php
77
+ if ( ( ! $has_product_assigned ) && ( $data['id'] != $is_global_checkout ) ) {
78
+ ?>
79
+ <span class="wcf-no-product-badge"><?php _e( 'No Product Assigned', 'cartflows' ); ?></span>
80
+ <?php
81
+ } elseif ( ( $has_product_assigned ) && ( $data['id'] === $is_global_checkout ) ) {
82
+ ?>
83
+ <span class="wcf-global-checkout-badge"><?php _e( 'Global Checkout - Remove selected checkout product', 'cartflows' ); ?></span>
84
+ <?php
85
+ } elseif ( ( ! $has_product_assigned ) && $data['id'] === $is_global_checkout ) {
86
+ ?>
87
+ <span class="wcf-global-checkout-badge"><?php _e( 'Global Checkout', 'cartflows' ); ?></span>
88
+ <?php
89
+ }
90
+ ?>
91
+
92
+ <input type="hidden" class="wcf-steps-hidden" name="wcf-steps[]" value="<?php echo $data['id']; ?>">
93
+ </div>
94
+ <div class="wcf-steps-action-buttons">
95
+ <a href="<?php echo get_permalink( $data['id'] ); ?>" target="_blank" class="wcf-step-view wcf-action-button wp-ui-text-highlight" title="<?php echo __( 'View Step', 'cartflows' ); ?>" >
96
+ <span class="dashicons dashicons-visibility"></span>
97
+ <span class="wcf-step-act-btn-text">View</span>
98
+ </a>
99
+ <a href="<?php echo get_edit_post_link( $data['id'] ); ?>" class="wcf-step-edit wcf-action-button wp-ui-text-highlight" title="<?php echo __( 'Edit Step', 'cartflows' ); ?>" >
100
+ <span class="dashicons dashicons-edit"></span>
101
+ <span class="wcf-step-act-btn-text">Edit</span>
102
+ </a>
103
+ <a href="<?php echo wp_nonce_url( 'admin.php?action=cartflows_clone_step&post=' . $data['id'], 'step_clone', 'step_clone_nonce' ); ?>" class="wcf-step-clone wcf-action-button wp-ui-text-highlight" title="<?php echo __( 'Clone Step', 'cartflows' ); ?>" data-id="<?php echo $data['id']; ?>">
104
+ <span class="dashicons dashicons-admin-page"></span>
105
+ <span class="wcf-step-act-btn-text">Clone</span>
106
+ </a>
107
+ <a href="#" class="wcf-step-delete wcf-action-button wp-ui-text-highlight" title="<?php echo __( 'Delete Step', 'cartflows' ); ?>" data-id="<?php echo $data['id']; ?>">
108
+ <span class="dashicons dashicons-trash"></span>
109
+ <span class="wcf-step-act-btn-text">Delete</span>
110
+ </a>
111
+ </div>
112
+ </div>
113
+ </div><!-- .wcf-step-wrap -->
114
+ <?php } ?>
115
+ <?php } ?>
116
+ </div><!-- .wcf-flow-steps-container -->
117
+ </div> <!-- .wcf-flow-steps-wrap -->
118
+ <div class="wcf-flow-buttons-wrap"> <!-- .wcf-flow-buttons-wrap -->
119
+ <?php do_action( 'cartflows_bellow_flow_steps' ); ?>
120
+ <div class='wcf-add-new-step-btn-wrap'>
121
+ <button class='wcf-trigger-popup button button-primary'>
122
+ <?php echo __( 'Add New Step', 'cartflows' ); ?>
123
+ </button>
124
+ </div>
125
+ </div><!-- .wcf-flow-buttons-wrap -->
126
+ </div><!-- .wcf-flow-settings -->
127
+
128
+ <div id="wcf-remote-step-importer" class="wcf-templates-popup-overlay">
129
+ <div class="wcf-templates-popup-content">
130
+ <div class="spinner"></div>
131
+ <div class="wcf-templates-wrap wcf-templates-wrap-flows">
132
+
133
+ <div id="wcf-remote-step-actions" class="wcf-template-header">
134
+ <div class="wcf-template-logo-wrap">
135
+ <span class="wcf-cartflows-logo-img">
136
+ <span class="cartflows-logo-icon"></span>
137
+ </span>
138
+ <span class="wcf-cartflows-title"><?php _e( 'Steps Library', 'cartflows' ); ?></span>
139
+ </div>
140
+ <div class="wcf-tab-wrapper">
141
+ <?php if ( 'other' !== $default_page_builder ) { ?>
142
+ <div id="wcf-get-started-steps">
143
+ <ul class="filter-links ">
144
+ <li>
145
+ <a href="#" class="current" data-slug="ready-templates" data-title="<?php _e( 'Ready Templates', 'cartflows' ); ?>"><?php _e( 'Ready Templates', 'cartflows' ); ?></a>
146
+ </li>
147
+ <li>
148
+ <a href="#" data-slug="canvas" data-title="<?php _e( 'Create Your Own', 'cartflows' ); ?>"><?php _e( 'Create Your Own', 'cartflows' ); ?></a>
149
+ </li>
150
+ </ul>
151
+ </div>
152
+ <?php } ?>
153
+ </div>
154
+ <div class="wcf-popup-close-wrap">
155
+ <span class="close-icon"><span class="wcf-cartflow-icons dashicons dashicons-no"></span></span>
156
+ </div>
157
+ </div>
158
+
159
+ <!--<div class="wcf-search-form">
160
+ <label class="screen-reader-text" for="wp-filter-search-input"><?php _e( 'Search Sites', 'cartflows' ); ?> </label>
161
+ <input placeholder="<?php _e( 'Search Flow...', 'cartflows' ); ?>" type="text" aria-describedby="live-search-desc" class="wcf-flow-search-input">
162
+ </div>-->
163
+
164
+ <div id="wcf-remote-content">
165
+ <?php if ( 'other' !== $default_page_builder ) { ?>
166
+ <div id="wcf-ready-templates">
167
+ <div id="wcf-remote-filters">
168
+ <div id="wcf-page-builders"></div>
169
+ <div id="wcf-categories"></div>
170
+ </div>
171
+ <div class="wcf-page-builder-notice"></div>
172
+ <div id="wcf-remote-step-list" class="wcf-remote-list wcf-template-list-wrap"><span class="spinner is-active"></span></div>
173
+ <div id="wcf-upcoming-page-builders" style="display: none;" class="wcf-remote-list wcf-template-list-wrap"></div>
174
+ </div>
175
+ <?php } ?>
176
+ <div id="wcf-start-from-scratch" style="<?php echo ( 'other' !== $default_page_builder ) ? 'display: none;' : ''; ?>">
177
+ <div class="inner">
178
+ <div id="wcf-scratch-steps-categories">
179
+ <select class="step-type-filter-links filter-links">
180
+ <option value="" class="current"> Select Step Type </option>
181
+ <option value="52" data-group="52" class="Landing" data-slug="landing" data-title="Landing">Landing</option>
182
+ <option value="53" data-group="53" class="Checkout" data-slug="checkout" data-title="Checkout">Checkout</option>
183
+ <option value="55" data-group="55" class="Upsell" data-slug="upsell" data-title="Upsell">Upsell</option>
184
+ <option value="56" data-group="56" class="Downsell" data-slug="downsell" data-title="Downsell">Downsell</option>
185
+ <option value="54" data-group="54" class="Thank You" data-slug="thankyou" data-title="Thank You">Thank You</option>
186
+ </select>
187
+ </div>
188
+ <a href="#" class="button button-primary cartflows-step-import-blank"><?php _e( 'Create Step', 'cartflows' ); ?></a>
189
+ <?php if ( ! _is_cartflows_pro() ) { ?>
190
+ <div class="wcf-template-notice"><p><?php echo __( 'You need a Cartflows Pro version to import Upsell / Downsell', 'cartflows' ); ?></p></div>
191
+ <?php } ?>
192
+ <p class="wcf-learn-how"><a href="https://cartflows.com/docs/cartflows-step-types/" target="_blank"><?php _e( 'Learn How', 'cartflows' ); ?> <i class="dashicons dashicons-external"></i></a></p>
193
+ </div>
194
+ </div>
195
+ </div>
196
+ </div>
197
+ </div>
198
+ </div><!-- .wcf-templates-popup-overlay -->
199
+ </div>
200
+ <?php
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: woocommerce, cart
5
  Requires at least: 4.4
6
  Requires PHP: 5.6
7
  Tested up to: 5.1
8
- Stable tag: 1.1.10
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -17,7 +17,6 @@ Create beautiful checkout pages & sales flows for WooCommerce.
17
  ★★★★★<br>
18
 
19
  **Funnels are the most effective way to sell products & services.** We created <a href="https://cartflows.com" target="_blank">**CartFlows, a WordPress Funnel Builder**</a>, to help every website owner start using funnels to grow their business, generate more reveue, and have full control over their buyers journey.
20
- ## <center><a href="https://demos.cartflows.com/" target="_blank">Try The Demo</a></center> ##
21
 
22
  [youtube https://www.youtube.com/watch?v=SlE0moPKjMY]
23
 
@@ -94,6 +93,11 @@ Say goodby to using the same ridgid checkout page that everyone else is using. C
94
 
95
  == Changelog ==
96
 
 
 
 
 
 
97
  = Version 1.1.10 - Wednesday, 6th March 2019 =
98
  * Fix: Divi builder next step link issue.
99
 
5
  Requires at least: 4.4
6
  Requires PHP: 5.6
7
  Tested up to: 5.1
8
+ Stable tag: 1.1.11
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
17
  ★★★★★<br>
18
 
19
  **Funnels are the most effective way to sell products & services.** We created <a href="https://cartflows.com" target="_blank">**CartFlows, a WordPress Funnel Builder**</a>, to help every website owner start using funnels to grow their business, generate more reveue, and have full control over their buyers journey.
 
20
 
21
  [youtube https://www.youtube.com/watch?v=SlE0moPKjMY]
22
 
93
 
94
  == Changelog ==
95
 
96
+ = Version 1.1.11 - Tuesday, 19th March 2019 =
97
+ * Fix: Checkbox tick on checkout was not visible in some cases.
98
+ * Fix: Width issue of order review.
99
+ * Fix: Selling the wrong main product in firefox.
100
+
101
  = Version 1.1.10 - Wednesday, 6th March 2019 =
102
  * Fix: Divi builder next step link issue.
103