PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 1.2.1
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v1.2.1
2.8.0 2.7.0 2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 All 44 releases
sellkit / includes / dynamic-keywords / keywords / keyword-base.php

keyword-base.php in SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster 1.2.1, at includes/dynamic-keywords/keywords/keyword-base.php

114 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined( 'ABSPATH' ) || die();
4 /**
5 * Tag Base.
6 *
7 * @since 1.1.0
8 */
9 abstract class Tag_Base {
10
11 /**
12 * Order data.
13 *
14 * @var object
15 * @since 1.1.0
16 */
17 public static $order = null;
18
19 public function __construct() {
20 if ( ! is_wc_endpoint_url( 'order-received' ) ) {
21 return;
22 }
23 }
24
25 /**
26 * Get order data.
27 *
28 * @since 1.1.0
29 */
30 public function get_keyword_content() {
31 return $this->render_content();
32 }
33
34 /**
35 * Get shortcode default data.
36 *
37 * @since 1.1.0
38 * @param array $atts shortcode attributes.
39 */
40 public function shortcode_content( $atts ) {
41 $atts = shortcode_atts( [
42 'fallback' => '',
43 ], $atts );
44
45 return $atts['fallback'];
46 }
47
48 /**
49 * Get shortcode default data.
50 *
51 * @since 1.1.0
52 */
53 public function get_data() {
54 if ( ! empty( $this::$order ) ) {
55 return $this::$order;
56 }
57
58 $order_key = ! empty( sellkit_htmlspecialchars( INPUT_GET, 'order-key' ) ) ? sellkit_htmlspecialchars( INPUT_GET, 'order-key' ) : sellkit_htmlspecialchars( INPUT_GET, 'key' );
59
60 if ( empty( $order_key ) ) {
61 return;
62 }
63
64 $order_id = wc_get_order_id_by_order_key( $order_key );
65
66 $this::$order = wc_get_order( $order_id );
67
68 return $this::$order;
69 }
70
71 /**
72 * Get Keywords type.
73 *
74 * @since 1.1.0
75 */
76 public static function get_keywords_type() {
77 return 'order_keyword';
78 }
79
80 /**
81 * Get keyword id.
82 *
83 * @since 1.1.0
84 * @access public
85 * @abstract
86 *
87 * @return string
88 */
89 abstract public function get_id();
90
91 /**
92 * Get keyword title.
93 *
94 * @since 1.1.0
95 * @access public
96 * @abstract
97 *
98 * @return string
99 */
100 abstract public function get_title();
101
102 /**
103 * Render content.
104 *
105 * @since 1.1.0
106 * @access public
107 * @param array $atts array of shortcode arguments.
108 * @abstract
109 *
110 * @return string
111 */
112 abstract public function render_content( $atts );
113 }
114