PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 2.8.16
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v2.8.16
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
wpfunnels / includes / core / shortcodes / class-wpfnl-shortcodes.php

class-wpfnl-shortcodes.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 2.8.16, at includes/core/shortcodes/class-wpfnl-shortcodes.php

120 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WPFunnels Shortcode
4 *
5 * @package WPFunnels\Shortcodes
6 */
7 namespace WPFunnels\Shortcodes;
8
9
10 use WPFunnels\Data_Store\Wpfnl_Steps_Store_Data;
11 use WPFunnels\Traits\SingletonTrait;
12 use WPFunnels\Wpfnl_functions;
13 use WPFunnels\Shortcodes\Wpfnl_Shortcode_Order_details;
14 use WPFunnels\Shortcodes\Wpfnl_Shortcode_NextStepButton;
15 use WPFunnels\Shortcodes\Wpfnl_Shortcode_Checkout;
16 use WPFunnels\Shortcodes\WC_Shortcode_Optin;
17
18
19 /**
20 * Class Wpfnl_Shortcodes
21 *
22 * @package WPFunnels\Shortcodes
23 */
24 class Wpfnl_Shortcodes {
25
26 use SingletonTrait;
27
28
29 public static function init() {
30 $shortcodes = array(
31 'wpfunnels_order_details' => __CLASS__ . '::render_order_details',
32 'wpf_next_step_button' => __CLASS__ . '::render_next_step_button',
33 'wpf_checkout' => __CLASS__ . '::render_checkout',
34 'wpf_optin_form' => __CLASS__ . '::render_optin_form',
35 );
36
37 foreach ( $shortcodes as $shortcode => $function ) {
38 add_shortcode( $shortcode, $function );
39 }
40 }
41
42 public function __construct() {
43 add_action( 'wp_enqueue_scripts', array( $this, 'thankyou_scripts' ), 21 );
44 }
45
46
47 /**
48 * Render order details markup
49 *
50 * @return string
51 *
52 * @since 2.0.3
53 */
54 public static function render_order_details( $atts ) {
55 $shortcode = new Wpfnl_Shortcode_Order_details( (array) $atts );
56 return $shortcode->get_content();
57 }
58
59
60 /**
61 * Render next step button
62 *
63 * @return string
64 */
65 public static function render_next_step_button( $atts ){
66 $shortcode = new Wpfnl_Shortcode_NextStepButton( (array) $atts );
67 return $shortcode->get_content();
68 }
69
70
71 /**
72 * Render checkout
73 *
74 * @return string
75 */
76 public static function render_checkout( $atts ){
77 $shortcode = new Wpfnl_Shortcode_Checkout( (array) $atts );
78 return $shortcode->get_content();
79 }
80
81 /**
82 * Render optin form
83 *
84 * @return string
85 */
86 public static function render_optin_form( $atts ){
87 $shortcode = new WC_Shortcode_Optin( (array) $atts );
88 return $shortcode->get_content();
89 }
90
91
92
93
94 public function thankyou_scripts() {
95 global $post;
96 if ( Wpfnl_functions::check_if_this_is_step_type('thankyou') ) {
97 $style = $this->generate_style();
98 wp_add_inline_style('wpfnl-public', $style);
99 }
100 }
101
102
103
104
105 public function generate_style()
106 {
107 global $post;
108 $output = '';
109 $thankyou = new Wpfnl_Steps_Store_Data();
110 $thankyou->read($post->ID);
111 $order_overview = $thankyou->get_internal_metas_by_key('_wpfnl_thankyou_order_overview');
112 $order_details = $thankyou->get_internal_metas_by_key('_wpfnl_thankyou_order_details');
113 $billing_details = $thankyou->get_internal_metas_by_key('_wpfnl_thankyou_billing_details');
114 $shipping_details = $thankyou->get_internal_metas_by_key('_wpfnl_thankyou_shipping_details');
115 $style_file = WPFNL_DIR.'public/modules/thankyou/css/dynamic-css.php';
116 include $style_file;
117 return $output;
118 }
119 }
120