PluginProbe ʕ •ᴥ•ʔ
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More / 4.0.7
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More v4.0.7
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 4.0.0 trunk 1.0.0 2.0.0 2.0.1 2.0.2 2.0.3 3.0 3.0.1 3.0.2 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.2.0 3.2.1 3.2.2 3.2.4 3.2.5 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.4.5 3.4.6 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.6 3.5.7 3.5.8 3.5.9 3.6.0 3.6.1 3.6.2 3.7.0 3.7.1
superb-blocks / src / admin / utils / class-link-util.php
superb-blocks / src / admin / utils Last commit date
class-link-util.php 4 days ago
class-link-util.php
81 lines
1 <?php
2
3 namespace SuperbAddons\Admin\Utils;
4
5 use SuperbAddons\Data\Controllers\LinkController;
6
7 class AdminLinkUtil
8 {
9 public static function GetLinkID()
10 {
11 return apply_filters('superb_addons_link_id', '');
12 }
13
14 public static function GetLink($source, $options = false)
15 {
16 if (!in_array($source, AdminLinkSource::ALLOWED_SOURCE)) {
17 $source = AdminLinkSource::DEFAULT;
18 }
19 $args = array(
20 'su_source' => $source,
21 );
22 $id = self::GetLinkID();
23 if (!empty($id)) {
24 $args['ref'] = substr(sanitize_text_field($id), 0, 25);
25 }
26 if (is_array($options) && isset($options['experiment'])) {
27 $args = array_merge($args, LinkController::GetLinkExpArgs($options['experiment']));
28 }
29 $url = is_array($options) && isset($options['url']) ? $options['url'] : 'https://superbthemes.com/superb-addons/';
30 if (is_array($options) && isset($options['anchor'])) {
31 $url .= '#' . $options['anchor'];
32 }
33 return add_query_arg($args, $url);
34 }
35
36 public static function GetExpLink($source, $options = false)
37 {
38 $options = is_array($options) ? $options : array();
39 if (!isset($options['experiment'])) {
40 $options['experiment'] = 'upsell';
41 }
42 return self::GetLink($source, $options);
43 }
44 }
45
46 class AdminLinkSource
47 {
48 const DEFAULT = 'superb-addons';
49 const NOTICE = 'notice';
50 const NOTICE_LOCK = 'notice-lock';
51 const WP_PLUGIN_PAGE = 'plugin-page';
52 const NAVIGATION = 'navigation';
53 const NAVIGATION_CTA = 'navigation-cta';
54 const SETTINGS = 'settings';
55 const LIBRARY_ITEM = 'pattern-library';
56 const LIBRARY_PAGE_ITEM = 'prebuilt-pages';
57 const DESIGNER = 'designer';
58 const CSS = 'css';
59 const CSS_TARGET = 'css-target';
60 const CSS_EXPORT = 'css-export';
61 const FORMS = 'forms';
62 const SUPPORT = 'support';
63
64 const ALLOWED_SOURCE = array(
65 self::NOTICE,
66 self::NOTICE_LOCK,
67 self::WP_PLUGIN_PAGE,
68 self::NAVIGATION,
69 self::NAVIGATION_CTA,
70 self::SETTINGS,
71 self::LIBRARY_ITEM,
72 self::LIBRARY_PAGE_ITEM,
73 self::DESIGNER,
74 self::CSS,
75 self::CSS_TARGET,
76 self::CSS_EXPORT,
77 self::FORMS,
78 self::SUPPORT
79 );
80 }
81