PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.2.3
JetFormBuilder — Dynamic Blocks Form Builder v3.2.3
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / includes / classes / http / utm-url.php
jetformbuilder / includes / classes / http Last commit date
http-tools.php 2 years ago utm-url.php 2 years ago
utm-url.php
80 lines
1 <?php
2
3
4 namespace Jet_Form_Builder\Classes\Http;
5
6 use Jet_Form_Builder\Addons\Manager;
7 use Jet_Form_Builder\Classes\Theme\Theme_Info;
8
9 // If this file is called directly, abort.
10 if ( ! defined( 'WPINC' ) ) {
11 die;
12 }
13
14 class Utm_Url {
15
16 private $check_license = false;
17 private $source = '';
18 private $medium = '';
19 private $campaign = '';
20
21 public function __construct( string $source = '' ) {
22 if ( $source ) {
23 $this->set_source( $source );
24 }
25 }
26
27 public function set_source( string $source ): Utm_Url {
28 $this->source = rawurlencode( $source );
29
30 return $this;
31 }
32
33 public function set_license( bool $check_license ): Utm_Url {
34 $this->check_license = $check_license;
35
36 return $this;
37 }
38
39 public function get_medium(): string {
40 if ( ! $this->medium ) {
41 $this->medium = $this->get_raw_medium();
42 }
43
44 return $this->medium;
45 }
46
47 public function add_query( string $url ): string {
48 return add_query_arg(
49 array(
50 'utm_source' => $this->source,
51 'utm_medium' => $this->get_medium(),
52 'utm_campaign' => $this->campaign,
53 ),
54 $url
55 );
56 }
57
58 public function set_campaign( string $campaign ): Utm_Url {
59 $this->campaign = $campaign;
60
61 return $this;
62 }
63
64 private function get_raw_medium(): string {
65 $page = jet_fb_current_page();
66 if ( ! $page ) {
67 $author_slug = ( new Theme_Info() )->author_slug();
68 } else {
69 $author_slug = $page->theme()->author_slug();
70 }
71 $license = $this->check_license
72 ? jet_form_builder()->addons_manager->get_slug()
73 : Manager::NOT_ACTIVE;
74
75 return rawurlencode( "$license/$author_slug" );
76 }
77
78
79 }
80