PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.0.3
JetFormBuilder — Dynamic Blocks Form Builder v3.0.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 3 years ago utm-url.php 3 years ago
utm-url.php
75 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 class Utm_Url {
10
11 private $check_license = false;
12 private $source = '';
13 private $medium = '';
14 private $campaign = '';
15
16 public function __construct( string $source = '' ) {
17 if ( $source ) {
18 $this->set_source( $source );
19 }
20 }
21
22 public function set_source( string $source ): Utm_Url {
23 $this->source = rawurlencode( $source );
24
25 return $this;
26 }
27
28 public function set_license( bool $check_license ): Utm_Url {
29 $this->check_license = $check_license;
30
31 return $this;
32 }
33
34 public function get_medium(): string {
35 if ( ! $this->medium ) {
36 $this->medium = $this->get_raw_medium();
37 }
38
39 return $this->medium;
40 }
41
42 public function add_query( string $url ): string {
43 return add_query_arg(
44 array(
45 'utm_source' => $this->source,
46 'utm_medium' => $this->get_medium(),
47 'utm_campaign' => $this->campaign,
48 ),
49 $url
50 );
51 }
52
53 public function set_campaign( string $campaign ): Utm_Url {
54 $this->campaign = $campaign;
55
56 return $this;
57 }
58
59 private function get_raw_medium(): string {
60 $page = jet_fb_current_page();
61 if ( ! $page ) {
62 $author_slug = ( new Theme_Info() )->author_slug();
63 } else {
64 $author_slug = $page->theme()->author_slug();
65 }
66 $license = $this->check_license
67 ? jet_form_builder()->addons_manager->get_slug()
68 : Manager::NOT_ACTIVE;
69
70 return rawurlencode( "$license/$author_slug" );
71 }
72
73
74 }
75