PluginProbe ʕ •ᴥ•ʔ
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More / 3.7.1
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More v3.7.1
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 5 months ago
class-link-util.php
61 lines
1 <?php
2
3 namespace SuperbAddons\Admin\Utils;
4
5 class AdminLinkUtil
6 {
7 public static function GetLinkID()
8 {
9 return apply_filters('superb_addons_link_id', '');
10 }
11
12 public static function GetLink($source, $options = false)
13 {
14 if (!in_array($source, AdminLinkSource::ALLOWED_SOURCE)) {
15 $source = AdminLinkSource::DEFAULT;
16 }
17 $args = array(
18 'su_source' => $source,
19 );
20 $id = self::GetLinkID();
21 if (!empty($id)) {
22 $args['ref'] = substr(sanitize_text_field($id), 0, 25);
23 }
24 $url = is_array($options) && isset($options['url']) ? $options['url'] : 'https://superbthemes.com/superb-addons/';
25 if (is_array($options) && isset($options['anchor'])) {
26 $url .= '#' . $options['anchor'];
27 }
28 return add_query_arg($args, $url);
29 }
30 }
31
32 class AdminLinkSource
33 {
34 const DEFAULT = 'superb-addons';
35 const NOTICE = 'notice';
36 const WP_PLUGIN_PAGE = 'plugin-page';
37 const NAVIGATION = 'navigation';
38 const SETTINGS = 'settings';
39 const LIBRARY_ITEM = 'pattern-library';
40 const LIBRARY_PAGE_ITEM = 'prebuilt-pages';
41 const DESIGNER = 'designer';
42 const CSS = 'css';
43 const CSS_TARGET = 'css-target';
44 const CSS_EXPORT = 'css-export';
45 const SUPPORT = 'support';
46
47 const ALLOWED_SOURCE = array(
48 self::NOTICE,
49 self::WP_PLUGIN_PAGE,
50 self::NAVIGATION,
51 self::SETTINGS,
52 self::LIBRARY_ITEM,
53 self::LIBRARY_PAGE_ITEM,
54 self::DESIGNER,
55 self::CSS,
56 self::CSS_TARGET,
57 self::CSS_EXPORT,
58 self::SUPPORT
59 );
60 }
61