class-shortcodes-ultimate-admin-pro-features.php
4.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?php
class Shortcodes_Ultimate_Admin_Pro_Features
{
public function __construct()
{
}
public function register_shortcodes()
{
if ( did_action( 'su/extra/ready' ) ) {
return;
}
foreach ( $this->get_shortcodes() as $shortcode ) {
su_add_shortcode( wp_parse_args( $shortcode, array(
'group' => 'extra',
'image' => $this->get_image_url( 'icon-available-shortcodes.png' ),
'icon' => $this->get_image_url( 'icon-generator.png' ),
'desc' => '',
'callback' => '__return_empty_string',
'atts' => array(),
'generator_callback' => array( $this, 'generator_callback' ),
) ) );
}
}
public function register_group( $groups )
{
if ( did_action( 'su/extra/ready' ) ) {
return $groups;
}
$groups['extra'] = _x( 'Pro Shortcodes', 'Custom shortcodes group name', 'shortcodes-ultimate' );
return $groups;
}
public function generator_callback( $shortcode )
{
su_partial( 'admin/partials/pro-features/generator.php', array(
'shortcode' => $shortcode,
'image_url' => $this->get_image_url(),
) );
}
public function get_image_url( $path = '' )
{
return plugin_dir_url( __FILE__ ) . 'images/pro-features/' . $path;
}
private function get_shortcodes()
{
return array(
array(
'id' => 'splash',
'name' => __( 'Splash screen', 'shortcodes-ultimate' ),
),
array(
'id' => 'exit_popup',
'name' => __( 'Exit popup', 'shortcodes-ultimate' ),
),
array(
'id' => 'panel',
'name' => __( 'Panel', 'shortcodes-ultimate' ),
),
array(
'id' => 'photo_panel',
'name' => __( 'Photo panel', 'shortcodes-ultimate' ),
),
array(
'id' => 'icon_panel',
'name' => __( 'Icon panel', 'shortcodes-ultimate' ),
),
array(
'id' => 'icon_text',
'name' => __( 'Text with icon', 'shortcodes-ultimate' ),
),
array(
'id' => 'progress_pie',
'name' => __( 'Progress pie', 'shortcodes-ultimate' ),
),
array(
'id' => 'progress_bar',
'name' => __( 'Progress bar', 'shortcodes-ultimate' ),
),
array(
'id' => 'member',
'name' => __( 'Member', 'shortcodes-ultimate' ),
),
array(
'id' => 'section',
'name' => __( 'Section', 'shortcodes-ultimate' ),
),
array(
'id' => 'pricing_table',
'name' => __( 'Pricing table', 'shortcodes-ultimate' ),
),
array(
'id' => 'testimonial',
'name' => __( 'Testimonial', 'shortcodes-ultimate' ),
),
array(
'id' => 'icon',
'name' => __( 'Icon', 'shortcodes-ultimate' ),
),
array(
'id' => 'content_slider',
'name' => __( 'Content slider', 'shortcodes-ultimate' ),
),
array(
'id' => 'shadow',
'name' => __( 'Shadow', 'shortcodes-ultimate' ),
)
);
}
public function add_generator_cta( $shortcodes )
{
if ( did_action( 'su/skins/ready' ) || su_fs()->can_use_premium_code() ) {
return $shortcodes;
}
$cta = sprintf(
'<span>%1$s</span><br><a href="%3$s" target="_blank" class="button">%2$s →</a>',
// translators: please keep the original markup with <nobr> tags
__( 'Get more styles for this shortcode with the <nobr>PRO version</nobr>', 'shortcodes-ultimate' ),
__( 'Upgrade to PRO', 'shortcodes-ultimate' ),
esc_attr( su_get_utm_link(
'https://getshortcodes.com/pricing/',
'wp-dashboard',
'generator',
'style'
) )
);
foreach ( array(
'heading',
'tabs',
'tab',
'accordion',
'spoiler',
'quote'
) as $shortcode ) {
unset( $shortcodes[$shortcode]['note'] );
$shortcodes[$shortcode]['generator_cta'] = $cta;
}
return $shortcodes;
}
}