Shortcodes Ultimate - Version 4.2.0

Version Description

Be careful! This is a great update and completely new code! Don't forget, you can always install old version.

Upgrade normally via your Wordpress admin -> Plugins panel.

Download this release

Release Info

Developer gn_themes
Plugin Icon 128x128 Shortcodes Ultimate
Version 4.2.0
Comparing to
See all releases

Code changes from version 4.1.9 to 4.2.0

assets/css/generator.css CHANGED
@@ -83,7 +83,7 @@
83
/* Dropdown choices */
84
#su-generator-choices {
85
margin-top: 20px;
86
- text-align: center;
87
}
88
#su-generator-choices:after {
89
display: block;
@@ -91,10 +91,12 @@
91
content: '';
92
}
93
#su-generator-choices > span {
94
display: inline-block;
95
- width: 88px;
96
- height: 88px;
97
- padding: 5px;
98
overflow: hidden;
99
border: 1px solid #fff;
100
border-bottom-style: dotted;
@@ -104,7 +106,7 @@
104
border-radius: 0;
105
color: #222;
106
vertical-align: top;
107
- text-align: center;
108
cursor: pointer;
109
}
110
#su-generator-choices span:hover {
@@ -118,30 +120,32 @@
118
box-shadow: 0 0 20px #fff inset;
119
}
120
#su-generator-choices span img {
121
- display: inline;
122
- width: 32px;
123
- height: 32px;
124
- margin: 12px 0;
125
- opacity: 0.3;
126
- -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
127
- filter: alpha(opacity=30);
128
- -moz-opacity: 0.3;
129
- -khtml-opacity: 0.3;
130
}
131
#su-generator-choices span:hover img {
132
- opacity: 1;
133
- -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
134
- filter: alpha(opacity=100);
135
- -moz-opacity: 1;
136
- -khtml-opacity: 1;
137
}
138
- #su-generator-choices strong {
139
- display: inline-block;
140
- width: 88px;
141
- height: 32px;
142
- overflow: hidden;
143
- text-transform: uppercase;
144
- font-size: 0.9em;
145
}
146
147
/* Breadcrumbs */
83
/* Dropdown choices */
84
#su-generator-choices {
85
margin-top: 20px;
86
+ text-align: left;
87
}
88
#su-generator-choices:after {
89
display: block;
91
content: '';
92
}
93
#su-generator-choices > span {
94
+ position: relative;
95
display: inline-block;
96
+ width: 140px;
97
+ height: 28px;
98
+ line-height: 28px;
99
+ padding: 0 5px 0 28px;
100
overflow: hidden;
101
border: 1px solid #fff;
102
border-bottom-style: dotted;
106
border-radius: 0;
107
color: #222;
108
vertical-align: top;
109
+ text-align: left;
110
cursor: pointer;
111
}
112
#su-generator-choices span:hover {
120
box-shadow: 0 0 20px #fff inset;
121
}
122
#su-generator-choices span img {
123
+ position: absolute;
124
+ left: 7px;
125
+ top: 7px;
126
+ width: 14px;
127
+ height: 14px;
128
}
129
#su-generator-choices span:hover img {
130
+ position: absolute;
131
+ left: 5px;
132
+ top: 5px;
133
+ width: 18px;
134
+ height: 18px;
135
}
136
+ #su-generator-choices span i {
137
+ position: absolute;
138
+ top: 7px;
139
+ left: 7px;
140
+ color: #aaa;
141
+ font-size: 14px;
142
+ }
143
+ #su-generator-choices span:hover i {
144
+ top: 5px;
145
+ left: 5px;
146
+ color: #aaa;
147
+ color: #000;
148
+ font-size: 18px;
149
}
150
151
/* Breadcrumbs */
inc/core/class.assets.php CHANGED
@@ -38,6 +38,8 @@ class Shortcodes_Ultimate_Assets {
38
public static function register() {
39
// Get plugin object
40
$shult = shortcodes_ultimate();
41
// qTip
42
wp_register_style( 'qtip', $shult->assets( 'css', 'qtip.css' ), false, '2.1.1', 'all' );
43
wp_register_script( 'qtip', $shult->assets( 'js', 'qtip.js' ), array( 'jquery' ), '2.1.1', true );
@@ -112,7 +114,7 @@ class Shortcodes_Ultimate_Assets {
112
public static function custom_css() {
113
$shult = shortcodes_ultimate();
114
// Get custom CSS and apply filters to it
115
- $custom_css = apply_filters( 'su/assets/custom_css', str_replace( ''', '\'', html_entity_decode( $shult->get_option( 'custom_css' ) ) ) );
116
// Print CSS if exists
117
if ( $custom_css ) echo "\n\n<!-- Shortcodes Ultimate custom CSS - begin -->\n<style type='text/css'>\n" . stripslashes( str_replace( array( '%theme_url%', '%home_url%', '%plugin_url%' ), array( get_stylesheet_directory_uri(), get_option( 'home' ), $shult->url ), $custom_css ) ) . "\n</style>\n<!-- Shortcodes Ultimate custom CSS - end -->\n\n";
118
}
38
public static function register() {
39
// Get plugin object
40
$shult = shortcodes_ultimate();
41
+ // Font Awesome
42
+ wp_register_style( 'font-awesome', $shult->assets( 'css', 'font-awesome.css' ), false, '3.2.1', 'all' );
43
// qTip
44
wp_register_style( 'qtip', $shult->assets( 'css', 'qtip.css' ), false, '2.1.1', 'all' );
45
wp_register_script( 'qtip', $shult->assets( 'js', 'qtip.js' ), array( 'jquery' ), '2.1.1', true );
114
public static function custom_css() {
115
$shult = shortcodes_ultimate();
116
// Get custom CSS and apply filters to it
117
+ $custom_css = apply_filters( 'su/assets/custom_css', str_replace( '&#039;', '\'', html_entity_decode( (string) $shult->get_option( 'custom_css' ) ) ) );
118
// Print CSS if exists
119
if ( $custom_css ) echo "\n\n<!-- Shortcodes Ultimate custom CSS - begin -->\n<style type='text/css'>\n" . stripslashes( str_replace( array( '%theme_url%', '%home_url%', '%plugin_url%' ), array( get_stylesheet_directory_uri(), get_option( 'home' ), $shult->url ), $custom_css ) ) . "\n</style>\n<!-- Shortcodes Ultimate custom CSS - end -->\n\n";
120
}
inc/core/class.data.php CHANGED
@@ -16,14 +16,16 @@ class Shortcodes_Ultimate_Data {
16
*/
17
public static function register() {
18
// Loop through shortcodes
19
- foreach ( ( array ) self::shortcodes() as $shortcode => $data ) {
20
- // Prepare shortcode function name
21
- $function = ( isset( $data['function'] ) ) ? $data['function'] : 'su_' . $shortcode . '_shortcode';
22
// Register shortcode
23
- add_shortcode( su_compatibility_mode_prefix() . $shortcode, $function );
24
}
25
- // Register [media] manually
26
- add_shortcode( su_compatibility_mode_prefix() . 'media', 'su_media_shortcode' );
27
}
28
29
/**
@@ -77,7 +79,8 @@ class Shortcodes_Ultimate_Data {
77
)
78
),
79
'usage' => '[heading] Content [/heading]<br/>[heading size="5"] Content [/heading]', 'content' => __( 'Heading text', 'su' ),
80
- 'desc' => __( 'Styled heading', 'su' )
81
),
82
// tabs
83
'tabs' => array(
@@ -108,7 +111,8 @@ class Shortcodes_Ultimate_Data {
108
),
109
'usage' => '[tabs style="default"] [tab title="Tab name"] Tab content [/tab] [/tabs]',
110
'content' => __( "[%prefix_tab title=\"Title 1\"]Content 1[/%prefix_tab]\n[%prefix_tab title=\"Title 2\"]Content 2[/%prefix_tab]\n[%prefix_tab title=\"Title 3\"]Content 3[/%prefix_tab]", 'su' ),
111
- 'desc' => __( 'Tabs container', 'su' )
112
),
113
// tab
114
'tab' => array(
@@ -135,7 +139,8 @@ class Shortcodes_Ultimate_Data {
135
),
136
'usage' => '[tabs] [tab title="Tab name"] Tab content [/tab] [/tabs]',
137
'content' => __( 'Tab content', 'su' ),
138
- 'desc' => __( 'Single tab', 'su' )
139
),
140
// spoiler
141
'spoiler' => array(
@@ -170,7 +175,10 @@ class Shortcodes_Ultimate_Data {
170
'desc' => __( 'Extra CSS class', 'su' )
171
)
172
),
173
- 'usage' => '[spoiler title="Spoiler title"] Hidden text [/spoiler]', 'content' => __( 'Hidden content', 'su' ), 'desc' => __( 'Spoiler with hidden content', 'su' )
174
),
175
// accordion
176
'accordion' => array(
@@ -186,7 +194,8 @@ class Shortcodes_Ultimate_Data {
186
),
187
'usage' => '[accordion]<br/>[spoiler open="yes"] content [/spoiler]<br/>[spoiler] content [/spoiler]<br/>[spoiler] content [/spoiler]<br/>[/accordion]',
188
'content' => __( "[%prefix_spoiler]Content[/%prefix_spoiler]\n[%prefix_spoiler]Content[/%prefix_spoiler]\n[%prefix_spoiler]Content[/%prefix_spoiler]", 'su' ),
189
- 'desc' => __( 'Accordion with spoilers', 'su' )
190
),
191
// divider
192
'divider' => array(
@@ -212,7 +221,8 @@ class Shortcodes_Ultimate_Data {
212
)
213
),
214
'usage' => '[divider top="yes" text="Go to top"]',
215
- 'desc' => __( 'Content divider with optional TOP link', 'su' )
216
),
217
// spacer
218
'spacer' => array(
@@ -235,7 +245,8 @@ class Shortcodes_Ultimate_Data {
235
)
236
),
237
'usage' => '[spacer size="20"]',
238
- 'desc' => __( 'Empty space with adjustable height', 'su' )
239
),
240
// highlight
241
'highlight' => array(
@@ -263,7 +274,8 @@ class Shortcodes_Ultimate_Data {
263
)
264
),
265
'usage' => '[highlight background="#DDFF99" color="#000000"] Content [/highlight]', 'content' => __( 'Highlighted text', 'su' ),
266
- 'desc' => __( 'Highlighted text', 'su' )
267
),
268
// label
269
'label' => array(
@@ -292,7 +304,8 @@ class Shortcodes_Ultimate_Data {
292
)
293
),
294
'usage' => '[label type="info"] Information [/label]', 'content' => __( 'Label', 'su' ),
295
- 'desc' => __( 'Styled label', 'su' )
296
),
297
// quote
298
'quote' => array(
@@ -319,7 +332,8 @@ class Shortcodes_Ultimate_Data {
319
)
320
),
321
'usage' => '[quote style="default"] Content [/quote]', 'content' => __( 'Quote', 'su' ),
322
- 'desc' => __( 'Blockquote alternative', 'su' )
323
),
324
// pullquote
325
'pullquote' => array(
@@ -343,7 +357,8 @@ class Shortcodes_Ultimate_Data {
343
)
344
),
345
'usage' => '[pullquote align="left"] Content [/pullquote]', 'content' => __( 'Pullquote', 'su' ),
346
- 'desc' => __( 'Pullquote', 'su' )
347
),
348
// dropcap
349
'dropcap' => array(
@@ -374,7 +389,8 @@ class Shortcodes_Ultimate_Data {
374
)
375
),
376
'usage' => '[dropcap style="default"]D[/dropcap]ropcap', 'content' => __( 'D', 'su' ),
377
- 'desc' => __( 'Dropcap', 'su' )
378
),
379
// frame
380
'frame' => array(
@@ -401,7 +417,8 @@ class Shortcodes_Ultimate_Data {
401
),
402
'usage' => '[frame align="center"]<img src="image.jpg">[/frame]',
403
'content' => '<img src="http://lorempixel.com/g/400/200/" />',
404
- 'desc' => __( 'Styled image frame', 'su' )
405
),
406
// row
407
'row' => array(
@@ -417,7 +434,8 @@ class Shortcodes_Ultimate_Data {
417
),
418
'usage' => '[row]<br/>[column size="1/2"] 50% [/column]<br/>[column size="1/4"] 25% [/column]<br/>[column size="1/4"] 25% [/column]<br/>[/row]',
419
'content' => __( "[%prefix_column size=\"1/3\"]Content[/%prefix_column]\n[%prefix_column size=\"1/3\"]Content[/%prefix_column]\n[%prefix_column size=\"1/3\"]Content[/%prefix_column]", 'su' ),
420
- 'desc' => __( 'Row for flexible columns', 'su' )
421
),
422
// column
423
'column' => array(
@@ -457,7 +475,10 @@ class Shortcodes_Ultimate_Data {
457
'desc' => __( 'Extra CSS class', 'su' )
458
)
459
),
460
- 'usage' => '[row]<br/>[column size="6"] 50% [/column]<br/>[column size="3"] 25% [/column]<br/>[column size="3"] 25% [/column]<br/>[/row]', 'content' => __( 'Column content', 'su' ), 'desc' => __( 'Flexible and responsive columns', 'su' )
461
),
462
// list
463
'list' => array(
@@ -494,7 +515,9 @@ class Shortcodes_Ultimate_Data {
494
)
495
),
496
'usage' => '[list style="check"] <ul> <li> List item </li> </ul> [/list]',
497
- 'content' => __( "<ul>\n<li>List item</li>\n<li>List item</li>\n<li>List item</li>\n</ul>", 'su' ), 'desc' => __( 'Styled unordered list', 'su' )
498
),
499
// button
500
'button' => array(
@@ -608,8 +631,10 @@ class Shortcodes_Ultimate_Data {
608
'desc' => __( 'Extra CSS class', 'su' )
609
)
610
),
611
- 'usage' => '[button url="#" background="#b00" size="3" style="default"] Button text [/button]', 'content' => __( 'Button text', 'su' ),
612
- 'desc' => __( 'Styled button', 'su' )
613
),
614
// service
615
'service' => array(
@@ -642,7 +667,10 @@ class Shortcodes_Ultimate_Data {
642
'desc' => __( 'Extra CSS class', 'su' )
643
)
644
),
645
- 'usage' => '[service title="Service title" icon="service.png" size="32"] Service description [/service]', 'content' => __( 'Service description', 'su' ), 'desc' => __( 'Service box with title', 'su' )
646
),
647
// box
648
'box' => array(
@@ -696,7 +724,8 @@ class Shortcodes_Ultimate_Data {
696
),
697
'usage' => '[box title="Box title"] Content [/box]',
698
'content' => __( 'Box content', 'su' ),
699
- 'desc' => __( 'Colored box with caption', 'su' )
700
),
701
// note
702
'note' => array(
@@ -730,7 +759,8 @@ class Shortcodes_Ultimate_Data {
730
)
731
),
732
'usage' => '[note background="#FFCC00"] Content [/note]', 'content' => __( 'Note text', 'su' ),
733
- 'desc' => __( 'Colored box', 'su' )
734
),
735
// lightbox
736
'lightbox' => array(
@@ -762,7 +792,8 @@ class Shortcodes_Ultimate_Data {
762
),
763
'usage' => '[lightbox src="http://example.com/" type="iframe"] Open example.com [/lightbox]',
764
'content' => __( '[%prefix_button] Click Here to Watch the Video [/%prefix_button]', 'su' ),
765
- 'desc' => __( 'Lightbox window with custom content', 'su' )
766
),
767
// tooltip
768
'tooltip' => array(
@@ -864,7 +895,8 @@ class Shortcodes_Ultimate_Data {
864
),
865
'usage' => '[tooltip] Hover me [/lightbox]',
866
'content' => __( '[%prefix_button] Hover me to open tooltip [/%prefix_button]', 'su' ),
867
- 'desc' => __( 'Tooltip window with custom content', 'su' )
868
),
869
// private
870
'private' => array(
@@ -879,8 +911,9 @@ class Shortcodes_Ultimate_Data {
879
)
880
),
881
'usage' => '[private] Private content [/private]',
882
- 'content' => __( 'Private note text', 'su' ),
883
- 'desc' => __( 'Private note for post authors', 'su' )
884
),
885
// youtube
886
'youtube' => array(
@@ -930,7 +963,9 @@ class Shortcodes_Ultimate_Data {
930
'desc' => __( 'Extra CSS class', 'su' )
931
)
932
),
933
- 'usage' => '[youtube url="http://www.youtube.com/watch?v=NbE8INOjTKM"]', 'desc' => __( 'YouTube video', 'su' )
934
),
935
// vimeo
936
'vimeo' => array(
@@ -979,7 +1014,9 @@ class Shortcodes_Ultimate_Data {
979
'desc' => __( 'Extra CSS class', 'su' )
980
)
981
),
982
- 'usage' => '[vimeo url="http://vimeo.com/21294655"]', 'desc' => __( 'Vimeo video', 'su' )
983
),
984
// screenr
985
'screenr' => array(
@@ -1021,7 +1058,9 @@ class Shortcodes_Ultimate_Data {
1021
'desc' => __( 'Extra CSS class', 'su' )
1022
)
1023
),
1024
- 'usage' => '[screenr url="http://www.screenr.com/OuWH"]', 'desc' => __( 'Screenr video', 'su' )
1025
),
1026
// audio
1027
'audio' => array(
@@ -1060,7 +1099,8 @@ class Shortcodes_Ultimate_Data {
1060
)
1061
),
1062
'usage' => '[audio url="http://example.com/audio.mp3"]',
1063
- 'desc' => __( 'Custom audio player', 'su' )
1064
),
1065
// video
1066
'video' => array(
@@ -1129,7 +1169,8 @@ class Shortcodes_Ultimate_Data {
1129
)
1130
),
1131
'usage' => '[video url="http://example.com/video.mp4"]',
1132
- 'desc' => __( 'Custom video player', 'su' )
1133
),
1134
// table
1135
'table' => array(
@@ -1151,7 +1192,8 @@ class Shortcodes_Ultimate_Data {
1151
),
1152
'usage' => '[table style="default"] <table> ... </table> [/table]<br/>[table style="default" url="http://example.com/file.csv"] [/table]',
1153
'content' => __( "<table>\n<tr>\n\t<td>Table</td>\n\t<td>Table</td>\n</tr>\n<tr>\n\t<td>Table</td>\n\t<td>Table</td>\n</tr>\n</table>", 'su' ),
1154
- 'desc' => __( 'Styled table from HTML or CSV file', 'su' )
1155
),
1156
// permalink
1157
'permalink' => array(
@@ -1182,7 +1224,8 @@ class Shortcodes_Ultimate_Data {
1182
),
1183
'usage' => '[permalink id=52]<br/>[permalink id="52" target="blank"] Content [/permalink]',
1184
'content' => '',
1185
- 'desc' => __( 'Permalink to specified post/page', 'su' )
1186
),
1187
// members
1188
'members' => array(
@@ -1215,7 +1258,8 @@ class Shortcodes_Ultimate_Data {
1215
),
1216
'usage' => '[members style="default"] Content for logged members [/members]',
1217
'content' => __( 'Content for logged members', 'su' ),
1218
- 'desc' => __( 'Content for logged in members only', 'su' )
1219
),
1220
// guests
1221
'guests' => array(
@@ -1229,7 +1273,10 @@ class Shortcodes_Ultimate_Data {
1229
'desc' => __( 'Extra CSS class', 'su' )
1230
)
1231
),
1232
- 'usage' => '[guests] Content for guests [/guests]', 'content' => __( 'Content for guests', 'su' ), 'desc' => __( 'Content for guests only', 'su' )
1233
),
1234
// feed
1235
'feed' => array(
@@ -1254,7 +1301,9 @@ class Shortcodes_Ultimate_Data {
1254
'desc' => __( 'Extra CSS class', 'su' )
1255
)
1256
),
1257
- 'usage' => '[feed url="http://rss1.smashingmagazine.com/feed/" limit="5"]', 'desc' => __( 'Feed grabber', 'su' )
1258
),
1259
// menu
1260
'menu' => array(
@@ -1273,7 +1322,9 @@ class Shortcodes_Ultimate_Data {
1273
'desc' => __( 'Extra CSS class', 'su' )
1274
)
1275
),
1276
- 'usage' => '[menu name="Main menu"]', 'desc' => __( 'Custom menu by name', 'su' )
1277
),
1278
// subpages
1279
'subpages' => array(
@@ -1299,7 +1350,9 @@ class Shortcodes_Ultimate_Data {
1299
'desc' => __( 'Extra CSS class', 'su' )
1300
)
1301
),
1302
- 'usage' => '[subpages]<br/>[subpages depth="2" p="122"]', 'desc' => __( 'List of sub pages', 'su' )
1303
),
1304
// siblings
1305
'siblings' => array(
@@ -1319,7 +1372,9 @@ class Shortcodes_Ultimate_Data {
1319
'desc' => __( 'Extra CSS class', 'su' )
1320
)
1321
),
1322
- 'usage' => '[siblings]<br/>[siblings depth="2"]', 'desc' => __( 'List of cureent page siblings', 'su' )
1323
),
1324
// document
1325
'document' => array(
@@ -1363,7 +1418,9 @@ class Shortcodes_Ultimate_Data {
1363
'desc' => __( 'Extra CSS class', 'su' )
1364
)
1365
),
1366
- 'usage' => '[document url="file.doc" width="600" height="400"]', 'desc' => __( 'Document viewer by Google', 'su' )
1367
),
1368
// gmap
1369
'gmap' => array(
@@ -1407,7 +1464,9 @@ class Shortcodes_Ultimate_Data {
1407
'desc' => __( 'Extra CSS class', 'su' )
1408
)
1409
),
1410
- 'usage' => '[gmap width="600" height="400" address="New York"]', 'desc' => __( 'Maps by Google', 'su' )
1411
),
1412
// slider
1413
'slider' => array(
@@ -1497,7 +1556,9 @@ class Shortcodes_Ultimate_Data {
1497
'desc' => __( 'Extra CSS class', 'su' )
1498
)
1499
),
1500
- 'usage' => '[slider gallery="1"]', 'desc' => __( 'Customizable image slider', 'su' )
1501
),
1502
// carousel
1503
'carousel' => array(
@@ -1603,7 +1664,9 @@ class Shortcodes_Ultimate_Data {
1603
'desc' => __( 'Extra CSS class', 'su' )
1604
)
1605
),
1606
- 'usage' => '[carousel gallery="1"]', 'desc' => __( 'Customizable image carousel', 'su' )
1607
),
1608
// custom_gallery
1609
'custom_gallery' => array(
@@ -1654,7 +1717,9 @@ class Shortcodes_Ultimate_Data {
1654
'desc' => __( 'Extra CSS class', 'su' )
1655
)
1656
),
1657
- 'usage' => '[custom_gallery gallery="1"]', 'desc' => __( 'Customizable image gallery', 'su' )
1658
),
1659
// posts
1660
'posts' => array(
@@ -1786,7 +1851,8 @@ class Shortcodes_Ultimate_Data {
1786
)
1787
),
1788
'usage' => '[posts template="templates/posts.php"]',
1789
- 'desc' => __( 'Custom posts query with customizable template', 'su' )
1790
)
1791
) );
1792
// Return result
16
*/
17
public static function register() {
18
// Loop through shortcodes
19
+ foreach ( ( array ) self::shortcodes() as $id => $data ) {
20
+ unset( $func );
21
+ if ( isset( $data['function'] ) ) $func = $data['function'];
22
+ elseif ( method_exists( 'Shortcodes_Ultimate_Shortcodes', $id ) ) $func = array( 'Shortcodes_Ultimate_Shortcodes', $id );
23
+ elseif ( method_exists( 'Shortcodes_Ultimate_Shortcodes', 'su_' . $id ) ) $func = array( 'Shortcodes_Ultimate_Shortcodes', 'su_' . $id );
24
// Register shortcode
25
+ if ( isset( $func ) ) add_shortcode( su_cmpt() . $id, $func );
26
}
27
+ // Register [media] manually // 3.x
28
+ add_shortcode( su_cmpt() . 'media', array( 'Shortcodes_Ultimate_Shortcodes', 'media' ) );
29
}
30
31
/**
79
)
80
),
81
'usage' => '[heading] Content [/heading]<br/>[heading size="5"] Content [/heading]', 'content' => __( 'Heading text', 'su' ),
82
+ 'desc' => __( 'Styled heading', 'su' ),
83
+ 'icon' => 'icon-h-sign'
84
),
85
// tabs
86
'tabs' => array(
111
),
112
'usage' => '[tabs style="default"] [tab title="Tab name"] Tab content [/tab] [/tabs]',
113
'content' => __( "[%prefix_tab title=\"Title 1\"]Content 1[/%prefix_tab]\n[%prefix_tab title=\"Title 2\"]Content 2[/%prefix_tab]\n[%prefix_tab title=\"Title 3\"]Content 3[/%prefix_tab]", 'su' ),
114
+ 'desc' => __( 'Tabs container', 'su' ),
115
+ 'icon' => 'icon-list-alt'
116
),
117
// tab
118
'tab' => array(
139
),
140
'usage' => '[tabs] [tab title="Tab name"] Tab content [/tab] [/tabs]',
141
'content' => __( 'Tab content', 'su' ),
142
+ 'desc' => __( 'Single tab', 'su' ),
143
+ 'icon' => 'icon-list-alt'
144
),
145
// spoiler
146
'spoiler' => array(
175
'desc' => __( 'Extra CSS class', 'su' )
176
)
177
),
178
+ 'usage' => '[spoiler title="Spoiler title"] Hidden text [/spoiler]',
179
+ 'content' => __( 'Hidden content', 'su' ),
180
+ 'desc' => __( 'Spoiler with hidden content', 'su' ),
181
+ 'icon' => 'icon-list-ul'
182
),
183
// accordion
184
'accordion' => array(
194
),
195
'usage' => '[accordion]<br/>[spoiler open="yes"] content [/spoiler]<br/>[spoiler] content [/spoiler]<br/>[spoiler] content [/spoiler]<br/>[/accordion]',
196
'content' => __( "[%prefix_spoiler]Content[/%prefix_spoiler]\n[%prefix_spoiler]Content[/%prefix_spoiler]\n[%prefix_spoiler]Content[/%prefix_spoiler]", 'su' ),
197
+ 'desc' => __( 'Accordion with spoilers', 'su' ),
198
+ 'icon' => 'icon-list'
199
),
200
// divider
201
'divider' => array(
221
)
222
),
223
'usage' => '[divider top="yes" text="Go to top"]',
224
+ 'desc' => __( 'Content divider with optional TOP link', 'su' ),
225
+ 'icon' => 'icon-ellipsis-horizontal'
226
),
227
// spacer
228
'spacer' => array(
245
)
246
),
247
'usage' => '[spacer size="20"]',
248
+ 'desc' => __( 'Empty space with adjustable height', 'su' ),
249
+ 'icon' => 'icon-resize-vertical'
250
),
251
// highlight
252
'highlight' => array(
274
)
275
),
276
'usage' => '[highlight background="#DDFF99" color="#000000"] Content [/highlight]', 'content' => __( 'Highlighted text', 'su' ),
277
+ 'desc' => __( 'Highlighted text', 'su' ),
278
+ 'icon' => 'icon-pencil'
279
),
280
// label
281
'label' => array(
304
)
305
),
306
'usage' => '[label type="info"] Information [/label]', 'content' => __( 'Label', 'su' ),
307
+ 'desc' => __( 'Styled label', 'su' ),
308
+ 'icon' => 'icon-tag'
309
),
310
// quote
311
'quote' => array(
332
)
333
),
334
'usage' => '[quote style="default"] Content [/quote]', 'content' => __( 'Quote', 'su' ),
335
+ 'desc' => __( 'Blockquote alternative', 'su' ),
336
+ 'icon' => 'icon-quote-right'
337
),
338
// pullquote
339
'pullquote' => array(
357
)
358
),
359
'usage' => '[pullquote align="left"] Content [/pullquote]', 'content' => __( 'Pullquote', 'su' ),
360
+ 'desc' => __( 'Pullquote', 'su' ),
361
+ 'icon' => 'icon-quote-left'
362
),
363
// dropcap
364
'dropcap' => array(
389
)
390
),
391
'usage' => '[dropcap style="default"]D[/dropcap]ropcap', 'content' => __( 'D', 'su' ),
392
+ 'desc' => __( 'Dropcap', 'su' ),
393
+ 'icon' => 'icon-bold'
394
),
395
// frame
396
'frame' => array(
417
),
418
'usage' => '[frame align="center"]<img src="image.jpg">[/frame]',
419
'content' => '<img src="http://lorempixel.com/g/400/200/" />',
420
+ 'desc' => __( 'Styled image frame', 'su' ),
421
+ 'icon' => 'icon-picture'
422
),
423
// row
424
'row' => array(
434
),
435
'usage' => '[row]<br/>[column size="1/2"] 50% [/column]<br/>[column size="1/4"] 25% [/column]<br/>[column size="1/4"] 25% [/column]<br/>[/row]',
436
'content' => __( "[%prefix_column size=\"1/3\"]Content[/%prefix_column]\n[%prefix_column size=\"1/3\"]Content[/%prefix_column]\n[%prefix_column size=\"1/3\"]Content[/%prefix_column]", 'su' ),
437
+ 'desc' => __( 'Row for flexible columns', 'su' ),
438
+ 'icon' => 'icon-columns'
439
),
440
// column
441
'column' => array(
475
'desc' => __( 'Extra CSS class', 'su' )
476
)
477
),
478
+ 'usage' => '[row]<br/>[column size="6"] 50% [/column]<br/>[column size="3"] 25% [/column]<br/>[column size="3"] 25% [/column]<br/>[/row]',
479
+ 'content' => __( 'Column content', 'su' ),
480
+ 'desc' => __( 'Flexible and responsive columns', 'su' ),
481
+ 'icon' => 'icon-columns'
482
),
483
// list
484
'list' => array(
515
)
516
),
517
'usage' => '[list style="check"] <ul> <li> List item </li> </ul> [/list]',
518
+ 'content' => __( "<ul>\n<li>List item</li>\n<li>List item</li>\n<li>List item</li>\n</ul>", 'su' ),
519
+ 'desc' => __( 'Styled unordered list', 'su' ),
520
+ 'icon' => 'icon-list-ol'
521
),
522
// button
523
'button' => array(
631
'desc' => __( 'Extra CSS class', 'su' )
632
)
633
),
634
+ 'usage' => '[button url="#" background="#b00" size="3" style="default"] Button text [/button]',
635
+ 'content' => __( 'Button text', 'su' ),
636
+ 'desc' => __( 'Styled button', 'su' ),
637
+ 'icon' => 'icon-heart'
638
),
639
// service
640
'service' => array(
667
'desc' => __( 'Extra CSS class', 'su' )
668
)
669
),
670
+ 'usage' => '[service title="Service title" icon="service.png" size="32"] Service description [/service]',
671
+ 'content' => __( 'Service description', 'su' ),
672
+ 'desc' => __( 'Service box with title', 'su' ),
673
+ 'icon' => 'icon-check'
674
),
675
// box
676
'box' => array(
724
),
725
'usage' => '[box title="Box title"] Content [/box]',
726
'content' => __( 'Box content', 'su' ),
727
+ 'desc' => __( 'Colored box with caption', 'su' ),
728
+ 'icon' => 'icon-list-alt'
729
),
730
// note
731
'note' => array(
759
)
760
),
761
'usage' => '[note background="#FFCC00"] Content [/note]', 'content' => __( 'Note text', 'su' ),
762
+ 'desc' => __( 'Colored box', 'su' ),
763
+ 'icon' => 'icon-list-alt'
764
),
765
// lightbox
766
'lightbox' => array(
792
),
793
'usage' => '[lightbox src="http://example.com/" type="iframe"] Open example.com [/lightbox]',
794
'content' => __( '[%prefix_button] Click Here to Watch the Video [/%prefix_button]', 'su' ),
795
+ 'desc' => __( 'Lightbox window with custom content', 'su' ),
796
+ 'icon' => 'icon-external-link'
797
),
798
// tooltip
799
'tooltip' => array(
895
),
896
'usage' => '[tooltip] Hover me [/lightbox]',
897
'content' => __( '[%prefix_button] Hover me to open tooltip [/%prefix_button]', 'su' ),
898
+ 'desc' => __( 'Tooltip window with custom content', 'su' ),
899
+ 'icon' => 'icon-comment-alt'
900
),
901
// private
902
'private' => array(
911
)
912
),
913
'usage' => '[private] Private content [/private]',
914
+ 'content' => __( 'Private note text', 'su' ),
915
+ 'desc' => __( 'Private note for post authors', 'su' ),
916
+ 'icon' => 'icon-lock'
917
),
918
// youtube
919
'youtube' => array(
963
'desc' => __( 'Extra CSS class', 'su' )
964
)
965
),
966
+ 'usage' => '[youtube url="http://www.youtube.com/watch?v=NbE8INOjTKM"]',
967
+ 'desc' => __( 'YouTube video', 'su' ),
968
+ 'icon' => 'icon-youtube-play'
969
),
970
// vimeo
971
'vimeo' => array(
1014
'desc' => __( 'Extra CSS class', 'su' )
1015
)
1016
),
1017
+ 'usage' => '[vimeo url="http://vimeo.com/21294655"]',
1018
+ 'desc' => __( 'Vimeo video', 'su' ),
1019
+ 'icon' => 'icon-youtube-play'
1020
),
1021
// screenr
1022
'screenr' => array(
1058
'desc' => __( 'Extra CSS class', 'su' )
1059
)
1060
),
1061
+ 'usage' => '[screenr url="http://www.screenr.com/OuWH"]',
1062
+ 'desc' => __( 'Screenr video', 'su' ),
1063
+ 'icon' => 'icon-youtube-play'
1064
),
1065
// audio
1066
'audio' => array(
1099
)
1100
),
1101
'usage' => '[audio url="http://example.com/audio.mp3"]',
1102
+ 'desc' => __( 'Custom audio player', 'su' ),
1103
+ 'icon' => 'icon-play-circle'
1104
),
1105
// video
1106
'video' => array(
1169
)
1170
),
1171
'usage' => '[video url="http://example.com/video.mp4"]',
1172
+ 'desc' => __( 'Custom video player', 'su' ),
1173
+ 'icon' => 'icon-play-circle'
1174
),
1175
// table
1176
'table' => array(
1192
),
1193
'usage' => '[table style="default"] <table> ... </table> [/table]<br/>[table style="default" url="http://example.com/file.csv"] [/table]',
1194
'content' => __( "<table>\n<tr>\n\t<td>Table</td>\n\t<td>Table</td>\n</tr>\n<tr>\n\t<td>Table</td>\n\t<td>Table</td>\n</tr>\n</table>", 'su' ),
1195
+ 'desc' => __( 'Styled table from HTML or CSV file', 'su' ),
1196
+ 'icon' => 'icon-table'
1197
),
1198
// permalink
1199
'permalink' => array(
1224
),
1225
'usage' => '[permalink id=52]<br/>[permalink id="52" target="blank"] Content [/permalink]',
1226
'content' => '',
1227
+ 'desc' => __( 'Permalink to specified post/page', 'su' ),
1228
+ 'icon' => 'icon-link'
1229
),
1230
// members
1231
'members' => array(
1258
),
1259
'usage' => '[members style="default"] Content for logged members [/members]',
1260
'content' => __( 'Content for logged members', 'su' ),
1261
+ 'desc' => __( 'Content for logged in members only', 'su' ),
1262
+ 'icon' => 'icon-lock'
1263
),
1264
// guests
1265
'guests' => array(
1273
'desc' => __( 'Extra CSS class', 'su' )
1274
)
1275
),
1276
+ 'usage' => '[guests] Content for guests [/guests]',
1277
+ 'content' => __( 'Content for guests', 'su' ),
1278
+ 'desc' => __( 'Content for guests only', 'su' ),
1279
+ 'icon' => 'icon-user'
1280
),
1281
// feed
1282
'feed' => array(
1301
'desc' => __( 'Extra CSS class', 'su' )
1302
)
1303
),
1304
+ 'usage' => '[feed url="http://rss1.smashingmagazine.com/feed/" limit="5"]',
1305
+ 'desc' => __( 'Feed grabber', 'su' ),
1306
+ 'icon' => 'icon-rss'
1307
),
1308
// menu
1309
'menu' => array(
1322
'desc' => __( 'Extra CSS class', 'su' )
1323
)
1324
),
1325
+ 'usage' => '[menu name="Main menu"]',
1326
+ 'desc' => __( 'Custom menu by name', 'su' ),
1327
+ 'icon' => 'icon-reorder'
1328
),
1329
// subpages
1330
'subpages' => array(
1350
'desc' => __( 'Extra CSS class', 'su' )
1351
)
1352
),
1353
+ 'usage' => '[subpages]<br/>[subpages depth="2" p="122"]',
1354
+ 'desc' => __( 'List of sub pages', 'su' ),
1355
+ 'icon' => 'icon-reorder'
1356
),
1357
// siblings
1358
'siblings' => array(
1372
'desc' => __( 'Extra CSS class', 'su' )
1373
)
1374
),
1375
+ 'usage' => '[siblings]<br/>[siblings depth="2"]',
1376
+ 'desc' => __( 'List of cureent page siblings', 'su' ),
1377
+ 'icon' => 'icon-reorder'
1378
),
1379
// document
1380
'document' => array(
1418
'desc' => __( 'Extra CSS class', 'su' )
1419
)
1420
),
1421
+ 'usage' => '[document url="file.doc" width="600" height="400"]',
1422
+ 'desc' => __( 'Document viewer by Google', 'su' ),
1423
+ 'icon' => 'icon-file-text'
1424
),
1425
// gmap
1426
'gmap' => array(
1464
'desc' => __( 'Extra CSS class', 'su' )
1465
)
1466
),
1467
+ 'usage' => '[gmap width="600" height="400" address="New York"]',
1468
+ 'desc' => __( 'Maps by Google', 'su' ),
1469
+ 'icon' => 'icon-globe'
1470
),
1471
// slider
1472
'slider' => array(
1556
'desc' => __( 'Extra CSS class', 'su' )
1557
)
1558
),
1559
+ 'usage' => '[slider gallery="1"]',
1560
+ 'desc' => __( 'Customizable image slider', 'su' ),
1561
+ 'icon' => 'icon-picture'
1562
),
1563
// carousel
1564
'carousel' => array(
1664
'desc' => __( 'Extra CSS class', 'su' )
1665
)
1666
),
1667
+ 'usage' => '[carousel gallery="1"]',
1668
+ 'desc' => __( 'Customizable image carousel', 'su' ),
1669
+ 'icon' => 'icon-picture'
1670
),
1671
// custom_gallery
1672
'custom_gallery' => array(
1717
'desc' => __( 'Extra CSS class', 'su' )
1718
)
1719
),
1720
+ 'usage' => '[custom_gallery gallery="1"]',
1721
+ 'desc' => __( 'Customizable image gallery', 'su' ),
1722
+ 'icon' => 'icon-picture'
1723
),
1724
// posts
1725
'posts' => array(
1851
)
1852
),
1853
'usage' => '[posts template="templates/posts.php"]',
1854
+ 'desc' => __( 'Custom posts query with customizable template', 'su' ),
1855
+ 'icon' => 'icon-th-list'
1856
)
1857
) );
1858
// Return result
inc/core/class.generator.php CHANGED
@@ -1,7 +1,6 @@
1
<?php
2
-
3
/**
4
- * Class for managing shortcodes generator
5
*/
6
class Shortcodes_Ultimate_Generator {
7
@@ -24,14 +23,6 @@ class Shortcodes_Ultimate_Generator {
24
25
/**
26
* Generator button
27
- *
28
- * @param string $target
29
- * @param unknown
30
- * @param string $class
31
- * @param bool $icon
32
- * @param bool $echo
33
- *
34
- * @return string
35
*/
36
public static function button( $args = array() ) {
37
// Check access
@@ -43,7 +34,7 @@ class Shortcodes_Ultimate_Generator {
43
'target' => 'content',
44
'text' => __( 'Insert shortcode', 'su' ),
45
'class' => 'button',
46
- 'icon' => $shult->assets( 'images/generator', 'icon.png' ),
47
'echo' => true,
48
'shortcode' => false
49
) );
@@ -55,7 +46,7 @@ class Shortcodes_Ultimate_Generator {
55
add_action( 'wp_footer', array( __CLASS__, 'popup' ) );
56
add_action( 'admin_footer', array( __CLASS__, 'popup' ) );
57
// Request assets
58
- su_query_asset( 'css', array( 'farbtastic', 'qtip', 'magnific-popup', 'su-generator' ) );
59
su_query_asset( 'js', array( 'jquery', 'jquery-ui-widget', 'iframe-transport', 'fileupload', 'farbtastic', 'qtip', 'magnific-popup', 'su-generator' ) );
60
// Print/return result
61
if ( $args['echo'] ) echo $button;
@@ -63,7 +54,7 @@ class Shortcodes_Ultimate_Generator {
63
}
64
65
/**
66
- * Delete cache on plugin activation
67
*/
68
public static function reset() {
69
// Clear popup cache
@@ -77,6 +68,7 @@ class Shortcodes_Ultimate_Generator {
77
* Generator popup form
78
*/
79
public static function popup() {
80
// Get cache
81
$output = get_transient( 'su/generator/popup' );
82
if ( $output ) echo $output;
@@ -103,8 +95,8 @@ class Shortcodes_Ultimate_Generator {
103
<?php
104
// Choices loop
105
foreach ( (array) Shortcodes_Ultimate_Data::shortcodes() as $name => $shortcode ) {
106
- $icon = ( isset( $shortcode['icon'] ) ) ? $shortcode['icon'] : $shult->assets( 'images/icons', $name ) . '.png';
107
- echo '<span data-shortcode="' . $name . '" title="' . esc_attr( $shortcode['desc'] ) . '" data-desc="' . esc_attr( $shortcode['desc'] ) . '" data-group="' . $shortcode['group'] . '"><img src="' . $icon . '" alt="" width="32" height="32" /><strong>' . $shortcode['name'] . '</strong></span>' . "\n";
108
}
109
?>
110
</div>
1
<?php
2
/**
3
+ * Shortcode Generator
4
*/
5
class Shortcodes_Ultimate_Generator {
6
23
24
/**
25
* Generator button
26
*/
27
public static function button( $args = array() ) {
28
// Check access
34
'target' => 'content',
35
'text' => __( 'Insert shortcode', 'su' ),
36
'class' => 'button',
37
+ 'icon' => plugins_url( 'assets/images/generator/icon.png', SU_PLUGIN_FILE ),
38
'echo' => true,
39
'shortcode' => false
40
) );
46
add_action( 'wp_footer', array( __CLASS__, 'popup' ) );
47
add_action( 'admin_footer', array( __CLASS__, 'popup' ) );
48
// Request assets
49
+ su_query_asset( 'css', array( 'farbtastic', 'qtip', 'magnific-popup', 'font-awesome', 'su-generator' ) );
50
su_query_asset( 'js', array( 'jquery', 'jquery-ui-widget', 'iframe-transport', 'fileupload', 'farbtastic', 'qtip', 'magnific-popup', 'su-generator' ) );
51
// Print/return result
52
if ( $args['echo'] ) echo $button;
54
}
55
56
/**
57
+ * Cache reset
58
*/
59
public static function reset() {
60
// Clear popup cache
68
* Generator popup form
69
*/
70
public static function popup() {
71
+ self::reset(); //////////////////////////////////////////////////////////////////////////////////////////
72
// Get cache
73
$output = get_transient( 'su/generator/popup' );
74
if ( $output ) echo $output;
95
<?php
96
// Choices loop
97
foreach ( (array) Shortcodes_Ultimate_Data::shortcodes() as $name => $shortcode ) {
98
+ $icon = ( isset( $shortcode['icon'] ) ) ? $shortcode['icon'] : '';
99
+ echo '<span data-shortcode="' . $name . '" title="' . esc_attr( $shortcode['desc'] ) . '" data-desc="' . esc_attr( $shortcode['desc'] ) . '" data-group="' . $shortcode['group'] . '">' . Shortcodes_Ultimate_Tools::icon( $icon ) . $shortcode['name'] . '</span>' . "\n";
100
}
101
?>
102
</div>
inc/core/class.shortcodes.php ADDED
@@ -0,0 +1,1069 @@
1
+ <?php
2
+
3
+ class Shortcodes_Ultimate_Shortcodes {
4
+ static $tabs = array();
5
+ static $tab_count = 0;
6
+
7
+ function __construct() {}
8
+
9
+ public static function heading( $atts = null, $content = null ) {
10
+ $atts = shortcode_atts( array(
11
+ 'size' => 3,
12
+ 'align' => 'center',
13
+ 'class' => ''
14
+ ), $atts );
15
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-content-shortcodes' );
16
+ $size = round( ( $atts['size'] + 7 ) * 1.3 );
17
+ return '<div class="su-heading su-heading-align-' . $atts['align'] . su_ecssc( $atts ) . '" style="font-size:' . $size . 'px"><div class="su-heading-inner">' . $content . '</div></div>';
18
+ }
19
+
20
+ public static function tabs( $atts = null, $content = null ) {
21
+ $atts = shortcode_atts( array(
22
+ 'active' => 1,
23
+ 'vertical' => 'no',
24
+ 'style' => null, // 3.x
25
+ 'class' => ''
26
+ ), $atts );
27
+ if ( $atts['style'] == '3' ) $atts['vertical'] = 'yes';
28
+ self::$tabs = array();
29
+ self::$tab_count = 0;
30
+ do_shortcode( $content );
31
+ $return = '';
32
+ $tabs = $panes = array();
33
+ if ( is_array( self::$tabs ) ) {
34
+ if ( self::$tab_count < $atts['active'] ) $atts['active'] = self::$tab_count;
35
+ foreach ( self::$tabs as $tab ) {
36
+ $tabs[] = '<span class="' . su_ecssc( $tab ) . $tab['disabled'] . '">' . su_scattr( $tab['title'] ) . '</span>';
37
+ $panes[] = '<div class="su-tabs-pane' . su_ecssc( $tab ) . '">' . $tab['content'] . '</div>';
38
+ }
39
+ $vertical = ( $atts['vertical'] === 'yes' ) ? ' su-tabs-vertical' : '';
40
+ $return = '<div class="su-tabs' . $vertical . su_ecssc( $atts ) . '" data-active="' . (string) $atts['active'] . '"><div class="su-tabs-nav">' . implode( '', $tabs ) . '</div><div class="su-tabs-panes">' . implode( "\n", $panes ) . '</div><div style="clear:both;height:0"></div></div>';
41
+ }
42
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-box-shortcodes' );
43
+ Shortcodes_Ultimate_Assets::add( 'js', 'jquery' );
44
+ Shortcodes_Ultimate_Assets::add( 'js', 'su-other-shortcodes' );
45
+ return $return;
46
+ }
47
+
48
+ public static function tab( $atts = null, $content = null ) {
49
+ $atts = shortcode_atts( array(
50
+ 'title' => __( 'Tab title', 'su' ),
51
+ 'disabled' => 'no',
52
+ 'class' => ''
53
+ ), $atts );
54
+ $x = self::$tab_count;
55
+ self::$tabs[$x] = array(
56
+ 'title' => $atts['title'],
57
+ 'content' => do_shortcode( $content ),
58
+ 'disabled' => ( $atts['disabled'] === 'yes' ) ? ' su-tabs-disabled' : '',
59
+ 'class' => $atts['class']
60
+ );
61
+ self::$tab_count++;
62
+ }
63
+
64
+ public static function spoiler( $atts = null, $content = null ) {
65
+ $atts = shortcode_atts( array(
66
+ 'title' => __( 'Spoiler title', 'su' ),
67
+ 'open' => 'no',
68
+ 'style' => 'default',
69
+ 'class' => ''
70
+ ), $atts );
71
+ $atts['style'] = str_replace( array( '1', '2' ), array( 'default', 'fancy' ), $atts['style'] );
72
+ $closed = ( $atts['open'] !== 'yes' ) ? ' su-spoiler-closed' : '';
73
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-box-shortcodes' );
74
+ Shortcodes_Ultimate_Assets::add( 'js', 'jquery' );
75
+ Shortcodes_Ultimate_Assets::add( 'js', 'su-other-shortcodes' );
76
+ return '<div class="su-spoiler su-spoiler-style-' . $atts['style'] . $closed . su_ecssc( $atts ) . '"><div class="su-spoiler-title"><span class="su-spoiler-icon"></span>' . su_scattr( $atts['title'] ) . '</div><div class="su-spoiler-content">' . su_do_shortcode( $content, 's' ) . '</div></div>';
77
+ }
78
+
79
+ public static function accordion( $atts = null, $content = null ) {
80
+ $atts = shortcode_atts( array( 'class' => '' ), $atts );
81
+ return '<div class="su-accordion' . su_ecssc( $atts ) . '">' . do_shortcode( $content ) . '</div>';
82
+ }
83
+
84
+ public static function divider( $atts = null, $content = null ) {
85
+ $atts = shortcode_atts( array(
86
+ 'top' => 'yes',
87
+ 'text' => __( 'Go to top', 'su' ),
88
+ 'class' => ''
89
+ ), $atts );
90
+ $top = ( $atts['top'] === 'yes' ) ? '<a href="#">' . su_scattr( $atts['text'] ) . '</a>' : '';
91
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-content-shortcodes' );
92
+ return '<div class="su-divider' . su_ecssc( $atts ) . '">' . $top . '</div>';
93
+ }
94
+
95
+ public static function spacer( $atts = null, $content = null ) {
96
+ $atts = shortcode_atts( array(
97
+ 'size' => 0,
98
+ 'class' => ''
99
+ ), $atts );
100
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-content-shortcodes' );
101
+ return '<div class="su-spacer' . su_ecssc( $atts ) . '" style="height:' . $atts['size'] . 'px"></div>';
102
+ }
103
+
104
+ public static function highlight( $atts = null, $content = null ) {
105
+ $atts = shortcode_atts( array(
106
+ 'background' => '#ddff99',
107
+ 'bg' => null, // 3.x
108
+ 'color' => '#000000',
109
+ 'class' => ''
110
+ ), $atts );
111
+ if ( $atts['bg'] !== null ) $atts['background'] = $atts['bg'];
112
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-content-shortcodes' );
113
+ return '<span class="su-highlight' . su_ecssc( $atts ) . '" style="background:' . $atts['background'] . ';color:' . $atts['color'] . '">&nbsp;' . do_shortcode( $content ) . '&nbsp;</span>';
114
+ }
115
+
116
+ public static function label( $atts = null, $content = null ) {
117
+ $atts = shortcode_atts( array(
118
+ 'type' => 'default',
119
+ 'style' => null, // 3.x
120
+ 'class' => ''
121
+ ), $atts );
122
+ if ( $atts['style'] !== null ) $atts['type'] = $atts['style'];
123
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-content-shortcodes' );
124
+ return '<span class="su-label su-label-type-' . $atts['type'] . su_ecssc( $atts ) . '">' . do_shortcode( $content ) . '</span>';
125
+ }
126
+
127
+ public static function quote( $atts = null, $content = null ) {
128
+ $atts = shortcode_atts( array(
129
+ 'cite' => false,
130
+ 'url' => false,
131
+ 'class' => ''
132
+ ), $atts );
133
+ $cite_link = ( $atts['url'] && $atts['cite'] ) ? '<a href="' . $atts['url'] . '">' . $atts['cite'] . '</a>'
134
+ : $atts['cite'];
135
+ $cite = ( $atts['cite'] ) ? '<span class="su-quote-cite">&mdash; ' . $cite_link . '</span>' : '';
136
+ $cite_class = ( $atts['cite'] ) ? ' su-quote-has-cite' : '';
137
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-box-shortcodes' );
138
+ return '<div class="su-quote' . $cite_class . su_ecssc( $atts ) . '"><div class="su-quote-inner">' . do_shortcode( $content ) . su_scattr( $cite ) . '</div></div>';
139
+ }
140
+
141
+ public static function pullquote( $atts = null, $content = null ) {
142
+ $atts = shortcode_atts( array(
143
+ 'align' => 'left',
144
+ 'class' => ''
145
+ ), $atts );
146
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-box-shortcodes' );
147
+ return '<div class="su-pullquote su-pullquote-align-' . $atts['align'] . su_ecssc( $atts ) . '">' . do_shortcode( $content ) . '</div>';
148
+ }
149
+
150
+ public static function dropcap( $atts = null, $content = null ) {
151
+ $atts = shortcode_atts( array(
152
+ 'style' => 'default',
153
+ 'size' => 3,
154
+ 'class' => ''
155
+ ), $atts );
156
+ $atts['style'] = str_replace( array( '1', '2', '3' ), array( 'default', 'light', 'default' ), $atts['style'] ); // 3.x
157
+ // Calculate font-size
158
+ $em = $atts['size'] * 0.5 . 'em';
159
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-content-shortcodes' );
160
+ return '<span class="su-dropcap su-dropcap-style-' . $atts['style'] . su_ecssc( $atts ) . '" style="font-size:' . $em . '">' . do_shortcode( $content ) . '</span>';
161
+ }
162
+
163
+ public static function frame( $atts = null, $content = null ) {
164
+ $atts = shortcode_atts( array(
165
+ 'style' => 'default',
166
+ 'align' => 'left',
167
+ 'class' => ''
168
+ ), $atts );
169
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-content-shortcodes' );
170
+ Shortcodes_Ultimate_Assets::add( 'js', 'su-other-shortcodes' );
171
+ return '<span class="su-frame su-frame-align-' . $atts['align'] . ' su-frame-style-' . $atts['style'] . su_ecssc( $atts ) . '"><span class="su-frame-inner">' . do_shortcode( $content ) . '</span></span>';
172
+ }
173
+
174
+ public static function row( $atts = null, $content = null ) {
175
+ $atts = shortcode_atts( array( 'class' => '' ), $atts );
176
+ return '<div class="su-row' . su_ecssc( $atts ) . '">' . su_do_shortcode( $content, 'r' ) . '</div>';
177
+ }
178
+
179
+ public static function column( $atts = null, $content = null ) {
180
+ $atts = shortcode_atts( array(
181
+ 'size' => '1/2',
182
+ 'center' => 'no',
183
+ 'last' => null,
184
+ 'class' => ''
185
+ ), $atts );
186
+ if ( $atts['last'] !== null && $atts['last'] == '1' ) $atts['class'] .= ' su-column-last';
187
+ if ( $atts['center'] === 'yes' ) $atts['class'] .= ' su-column-centered';
188
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-box-shortcodes' );
189
+ return '<div class="su-column su-column-size-' . str_replace( '/', '-', $atts['size'] ) . su_ecssc( $atts ) . '"><div class="su-column-inner">' . su_do_shortcode( $content, 'c' ) . '</div></div>';
190
+ }
191
+
192
+ public static function su_list( $atts = null, $content = null ) {
193
+ $atts = shortcode_atts( array(
194
+ 'style' => 'star',
195
+ 'class' => ''
196
+ ), $atts );
197
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-content-shortcodes' );
198
+ return '<div class="su-list su-list-style-' . $atts['style'] . su_ecssc( $atts ) . '">' . su_do_shortcode( $content, 'l' ) . '</div>';
199
+ }
200
+
201
+ public static function button( $atts = null, $content = null ) {
202
+ $atts = shortcode_atts( array(
203
+ 'url' => get_option( 'home' ),
204
+ 'link' => null, // 3.x
205
+ 'target' => 'self',
206
+ 'style' => 'default',
207
+ 'background' => '#2D89EF',
208
+ 'color' => '#FFFFFF',
209
+ 'dark' => null, // 3.x
210
+ 'size' => 3,
211
+ 'wide' => 'no',
212
+ 'center' => 'no',
213
+ 'radius' => 'auto',
214
+ 'icon' => false,
215
+ 'ts_color' => 'dark',
216
+ 'ts_pos' => 'none',
217
+ 'desc' => '',
218
+ 'class' => ''
219
+ ), $atts );
220
+
221
+ if ( $atts['link'] !== null ) $atts['url'] = $atts['link'];
222
+ if ( $atts['dark'] !== null ) {
223
+ $atts['background'] = $atts['color'];
224
+ $atts['color'] = ( $atts['dark'] ) ? '#000' : '#fff';
225
+ }
226
+ if ( is_numeric( $atts['style'] ) ) $atts['style'] = str_replace( array( '1', '2', '3', '4', '5' ), array( 'default', 'glass', 'bubbles', 'noise', 'stroked' ), $atts['style'] ); // 3.x
227
+ // Prepare vars
228
+ $a_css = array();
229
+ $span_css = array();
230
+ $img_css = array();
231
+ $small_css = array();
232
+ $radius = '0px';
233
+ $before = $after = '';
234
+ // Text shadow values
235
+ $shadows = array(
236
+ 'none' => '0 0',
237
+ 'top' => '0 -1px',
238
+ 'right' => '1px 0',
239
+ 'bottom' => '0 1px',
240
+ 'left' => '-1px 0',
241
+ 'top-right' => '1px -1px',
242
+ 'top-left' => '-1px -1px',
243
+ 'bottom-right' => '1px 1px',
244
+ 'bottom-left' => '-1px 1px'
245
+ );
246
+ // Common styles for button
247
+ $styles = array(
248
+ 'size' => round( ( $atts['size'] + 7 ) * 1.3 ),
249
+ 'ts_color' => ( $atts['ts_color'] === 'light' ) ? su_hex_shift( $atts['background'], 'lighter', 50 ) : su_hex_shift( $atts['background'], 'darker', 40 ),
250
+ 'ts_pos' => $shadows[$atts['ts_pos']]
251
+ );
252
+ // Calculate border-radius
253
+ if ( $atts['radius'] == 'auto' ) $radius = round( $atts['size'] + 2 ) . 'px';
254
+ elseif ( $atts['radius'] == 'round' ) $radius = round( ( ( $atts['size'] * 2 ) + 2 ) * 2 + $styles['size'] ) . 'px';
255
+ elseif ( is_numeric( $atts['radius'] ) ) $radius = intval( $atts['radius'] ) . 'px';
256
+ // CSS rules for <a> tag
257
+ $a_rules = array(
258
+ 'color' => $atts['color'],
259
+ 'background-color' => $atts['background'],
260
+ 'border-color' => su_hex_shift( $atts['background'], 'darker', 20 ),
261
+ 'border-radius' => $radius,
262
+ '-moz-border-radius' => $radius,
263
+ '-webkit-border-radius' => $radius
264
+ );
265
+ // CSS rules for <span> tag
266
+ $span_rules = array(
267
+ 'color' => $atts['color'],
268
+ 'padding' => ( $atts['icon'] ) ? round( ( $atts['size'] ) / 2 + 4 ) . 'px ' . round( $atts['size'] * 2 + 10 ) . 'px' : '0px ' . round( $atts['size'] * 2 + 10 ) . 'px',
269
+ 'font-size' => $styles['size'] . 'px',
270
+ 'line-height' => ( $atts['icon'] ) ? round( $styles['size'] * 1.5 ) . 'px' : round( $styles['size'] * 2 ) . 'px',
271
+ 'border-color' => su_hex_shift( $atts['background'], 'lighter', 30 ),
272
+ 'border-radius' => $radius,
273
+ '-moz-border-radius' => $radius,
274
+ '-webkit-border-radius' => $radius,
275
+ 'text-shadow' => $styles['ts_pos'] . ' 1px ' . $styles['ts_color'],
276
+ '-moz-text-shadow' => $styles['ts_pos'] . ' 1px ' . $styles['ts_color'],
277
+ '-webkit-text-shadow' => $styles['ts_pos'] . ' 1px ' . $styles['ts_color']
278
+ );
279
+ // CSS rules for <img> tag
280
+ $img_rules = array(
281
+ 'width' => round( $styles['size'] * 1.5 ) . 'px',
282
+ 'height' => round( $styles['size'] * 1.5 ) . 'px'
283
+ );
284
+ // CSS rules for <small> tag
285
+ $small_rules = array(
286
+ 'padding-bottom' => round( ( $atts['size'] ) / 2 + 4 ) . 'px',
287
+ 'color' => $atts['color']
288
+ );
289
+ // Create style attr value for <a> tag
290
+ foreach ( $a_rules as $a_rule => $a_value ) $a_css[] = $a_rule . ':' . $a_value;
291
+ // Create style attr value for <span> tag
292
+ foreach ( $span_rules as $span_rule => $span_value ) $span_css[] = $span_rule . ':' . $span_value;
293
+ // Create style attr value for <img> tag
294
+ foreach ( $img_rules as $img_rule => $img_value ) $img_css[] = $img_rule . ':' . $img_value;
295
+ // Create style attr value for <img> tag
296
+ foreach ( $small_rules as $small_rule => $small_value ) $small_css[] = $small_rule . ':' . $small_value;
297
+ // Prepare button classes
298
+ $classes = array( 'su-button', 'su-button-style-' . $atts['style'] );
299
+ // Additional classes
300
+ if ( $atts['class'] ) $classes[] = $atts['class'];
301
+ // Wide class
302
+ if ( $atts['wide'] === 'yes' ) $classes[] = 'su-button-wide';
303
+ // Prepare icon
304
+ $icon = ( $atts['icon'] ) ? '<img src="' . $atts['icon'] . '" alt="' . esc_attr( $content ) . '" style="' . implode( $img_css, ';' ) . '" />' : '';
305
+ // Prepare <small> with description
306
+ $desc = ( $atts['desc'] ) ? '<small style="' . implode( $small_css, ';' ) . '">' . su_scattr( $atts['desc'] ) . '</small>' : '';
307
+ // Wrap with div if button centered
308
+ if ( $atts['center'] === 'yes' ) {
309
+ $before .= '<div class="su-button-center">';
310
+ $after .= '</div>';
311
+ }
312
+ // Replace icon marker in content,
313
+ // add float-icon class to rearrange margins
314
+ if ( strpos( $content, '%icon%' ) !== false ) {
315
+ $content = str_replace( '%icon%', $icon, $content );
316
+ $classes[] = 'su-button-float-icon';
317
+ }
318
+ // Button text has no icon marker, append icon to begin of the text
319
+ else $content = $icon . ' ' . $content;
320
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-content-shortcodes' );
321
+ return $before . '<a href="' . $atts['url'] . '" class="' . implode( $classes, ' ' ) . '" style="' . implode( $a_css, ';' ) . '" target="_' . $atts['target'] . '"><span style="' . implode( $span_css, ';' ) . '">' . $content . $desc . '</span></a>' . $after;
322
+ }
323
+
324
+ public static function service( $atts = null, $content = null ) {
325
+ $atts = shortcode_atts( array(
326
+ 'title' => __( 'Service title', 'su' ),
327
+ 'icon' => plugins_url( 'assets/images/service.png', SU_PLUGIN_FILE ),
328
+ 'size' => 32,
329
+ 'class' => ''
330
+ ), $atts );
331
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-box-shortcodes' );
332
+ return '<div class="su-service' . su_ecssc( $atts ) . '"><div class="su-service-title" style="padding:' . round( ( $atts['size'] - 16 ) / 2 ) . 'px 0 ' . round( ( $atts['size'] - 16 ) / 2 ) . 'px ' . ( $atts['size'] + 15 ) . 'px"><img src="' . su_scattr( $atts['icon'] ) . '" width="' . $atts['size'] . '" height="' . $atts['size'] . '" alt="' . $atts['title'] . '" /> ' . su_scattr( $atts['title'] ) . '</div><div class="su-service-content" style="padding:0 0 0 ' . ( $atts['size'] + 15 ) . 'px">' . do_shortcode( $content ) . '</div></div>';
333
+ }
334
+
335
+ public static function box( $atts = null, $content = null ) {
336
+ $atts = shortcode_atts( array(
337
+ 'title' => __( 'This is box title', 'su' ),
338
+ 'style' => 'default',
339
+ 'box_color' => '#333333',
340
+ 'title_color' => '#FFFFFF',
341
+ 'color' => null, // 3.x
342
+ 'radius' => '3',
343
+ 'class' => ''
344
+ ), $atts );
345
+ if ( $atts['color'] !== null ) $atts['box_color'] = $atts['color'];
346
+ // Prepare border-radius
347
+ $radius = ( $atts['radius'] != '0' ) ?
348
+ 'border-radius:' . $atts['radius'] . 'px;-moz-border-radius:' . $atts['radius'] .
349
+ 'px;-webkit-border-radius:' . $atts['radius'] . 'px;' : '';
350
+ $title_radius = ( $atts['radius'] != '0' ) ? $atts['radius'] - 1 : '';
351
+ $title_radius = ( $title_radius ) ?
352
+ '-webkit-border-top-left-radius:' . $title_radius . 'px;-webkit-border-top-right-radius:' . $title_radius .
353
+ 'px;-moz-border-radius-topleft:' . $title_radius . 'px;-moz-border-radius-topright:' . $title_radius .
354
+ 'px;border-top-left-radius:' . $title_radius . 'px;border-top-right-radius:' . $title_radius . 'px;' : '';
355
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-box-shortcodes' );
356
+ // Return result
357
+ return
358
+ '<div class="su-box su-box-style-' . $atts['style'] . su_ecssc( $atts ) . '" style="border-color:' .
359
+ su_hex_shift( $atts['box_color'], 'darker', 20 ) . ';' . $radius .
360
+ '"><div class="su-box-title" style="background-color:' . $atts['box_color'] . ';color:' .
361
+ $atts['title_color'] . ';' . $title_radius . '">' . su_scattr( $atts['title'] ) . '</div><div class="su-box-content">' .
362
+ su_do_shortcode( $content, 'b' ) . '</div></div>';
363
+ }
364
+
365
+ public static function note( $atts = null, $content = null ) {
366
+ $atts = shortcode_atts( array(
367
+ 'note_color' => '#FFFF66',
368
+ 'text_color' => '#333333',
369
+ 'background' => null, // 3.x
370
+ 'color' => null, // 3.x
371
+ 'radius' => '3',
372
+ 'class' => ''
373
+ ), $atts );
374
+ if ( $atts['color'] !== null ) $atts['note_color'] = $atts['color'];
375
+ if ( $atts['background'] !== null ) $atts['note_color'] = $atts['background'];
376
+ // Prepare border-radius
377
+ $radius = ( $atts['radius'] != '0' ) ? 'border-radius:' . $atts['radius'] . 'px;-moz-border-radius:' . $atts['radius'] . 'px;-webkit-border-radius:' . $atts['radius'] . 'px;' : '';
378
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-box-shortcodes' );
379
+ return '<div class="su-note' . su_ecssc( $atts ) . '" style="border-color:' . su_hex_shift( $atts['note_color'], 'darker', 10 ) . ';' . $radius . '"><div class="su-note-inner" style="background-color:' . $atts['note_color'] . ';border-color:' . su_hex_shift( $atts['note_color'], 'lighter', 80 ) . ';color:' . $atts['text_color'] . ';' . $radius . '">' . su_do_shortcode( $content, 'n' ) . '</div></div>';
380
+ }
381
+
382
+ public static function lightbox( $atts = null, $content = null ) {
383
+ $atts = shortcode_atts( array(
384
+ 'src' => 'http://www.youtube.com/watch?v=NbE8INOjTKM',
385
+ 'type' => 'iframe',
386
+ 'class' => ''
387
+ ), $atts );
388
+ Shortcodes_Ultimate_Assets::add( 'css', 'magnific-popup' );
389
+ Shortcodes_Ultimate_Assets::add( 'js', 'jquery' );
390
+ Shortcodes_Ultimate_Assets::add( 'js', 'magnific-popup' );
391
+ Shortcodes_Ultimate_Assets::add( 'js', 'su-other-shortcodes' );
392
+ return '<span class="su-lightbox' . su_ecssc( $atts ) . '" data-mfp-src="' . su_scattr( $atts['src'] ) . '" data-mfp-type="' . $atts['type'] . '">' . do_shortcode( $content ) . '</span>';
393
+ }
394
+
395
+ public static function tooltip( $atts = null, $content = null ) {
396
+ $atts = shortcode_atts( array(
397
+ 'style' => 'yellow',
398
+ 'position' => 'north',
399
+ 'shadow' => 'no',
400
+ 'rounded' => 'no',
401
+ 'size' => 'default',
402
+ 'title' => '',
403
+ 'content' => __( 'Tooltip text', 'su' ),
404
+ 'behavior' => 'hover',
405
+ 'close' => 'no',
406
+ 'class' => ''
407
+ ), $atts );
408
+ // Prepare style
409
+ $atts['style'] = ( in_array( $atts['style'], array( 'light', 'dark', 'green', 'red', 'blue', 'youtube', 'tipsy', 'bootstrap', 'jtools', 'tipped', 'cluetip' ) ) ) ? $atts['style'] : 'plain';
410
+ // Position
411
+ $atts['position'] = str_replace( array( 'top', 'right', 'bottom', 'left' ), array( 'north', 'east', 'south', 'west' ), $atts['position'] );
412
+ $position = array(
413
+ 'my' => str_replace( array( 'north', 'east', 'south', 'west' ), array( 'bottom center', 'center left', 'top center', 'center right' ), $atts['position'] ),
414
+ 'at' => str_replace( array( 'north', 'east', 'south', 'west' ), array( 'top center', 'center right', 'bottom center', 'center left' ), $atts['position'] )
415
+ );
416
+ // Prepare classes
417
+ $classes = array( 'su-qtip qtip-' . $atts['style'] );
418
+ $classes[] = 'su-qtip-size-' . $atts['size'];
419
+ if ( $atts['shadow'] === 'yes' ) $classes[] = 'qtip-shadow';
420
+ if ( $atts['rounded'] === 'yes' ) $classes[] = 'qtip-rounded';
421
+ // Query assets
422
+ Shortcodes_Ultimate_Assets::add( 'css', 'qtip' );
423
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-other-shortcodes' );
424
+ Shortcodes_Ultimate_Assets::add( 'js', 'jquery' );
425
+ Shortcodes_Ultimate_Assets::add( 'js', 'qtip' );
426
+ Shortcodes_Ultimate_Assets::add( 'js', 'su-other-shortcodes' );
427
+ return '<span class="su-tooltip' . su_ecssc( $atts ) . '" data-close="' . $atts['close'] . '" data-behavior="' . $atts['behavior'] . '" data-my="' . $position['my'] . '" data-at="' . $position['at'] . '" data-classes="' . implode( ' ', $classes ) . '" data-title="' . $atts['title'] . '" title="' . esc_attr( $atts['content'] ) . '">' . do_shortcode( $content ) . '</span>';
428
+ }
429
+
430
+ public static function su_private( $atts = null, $content = null ) {
431
+ $atts = shortcode_atts( array( 'class' => '' ), $atts );
432
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-other-shortcodes' );
433
+ return ( current_user_can( 'publish_posts' ) ) ? '<div class="su-private' . su_ecssc( $atts ) . '"><div class="su-private-shell">' . do_shortcode( $content ) . '</div></div>' : '';
434
+ }
435
+
436
+ public static function media( $atts = null, $content = null ) {
437
+ // Check YouTube video
438
+ if ( strpos( $atts['url'], 'youtu' ) !== false ) return su_youtube( $atts );
439
+ // Check Vimeo video
440
+ elseif ( strpos( $atts['url'], 'vimeo' ) !== false ) return su_vimeo( $atts );
441
+ // Image
442
+ else return '<img src="' . $atts['url'] . '" width="' . $atts['width'] . '" height="' . $atts['height'] . '" style="max-width:100%" />';
443
+ }
444
+
445
+ public static function youtube( $atts = null, $content = null ) {
446
+ // Prepare data
447
+ $return = array();
448
+ $atts = shortcode_atts( array(
449
+ 'url' => 'http://www.youtube.com/watch?v=NbE8INOjTKM',
450
+ 'width' => 600,
451
+ 'height' => 400,
452
+ 'autoplay' => 'no',
453
+ 'responsive' => 'yes',
454
+ 'class' => ''
455
+ ), $atts );
456
+ $atts['url'] = su_scattr( $atts['url'] );
457
+ $id = ( preg_match( '%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $atts['url'], $match ) ) ? $match[1] : false;
458
+ // Check that url is specified
459
+ if ( !$id ) return '<p class="su-error">YouTube: ' . __( 'please specify correct url', 'su' ) . '</p>';
460
+ // Prepare autoplay
461
+ $autoplay = ( $atts['autoplay'] === 'yes' ) ? '?autoplay=1' : '';
462
+ // Create player
463
+ $return[] = '<div class="su-youtube su-responsive-media-' . $atts['responsive'] . su_ecssc( $atts ) . '">';
464
+ $return[] = '<iframe width="' . $atts['width'] . '" height="' . $atts['height'] . '" src="http://www.youtube.com/embed/' . $id . $autoplay . '" frameborder="0" allowfullscreen="true"></iframe>';
465
+ $return[] = '</div>';
466
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-media-shortcodes' );
467
+ // Return result
468
+ return implode( '', $return );
469
+ }
470
+
471
+ public static function vimeo( $atts = null, $content = null ) {
472
+ // Prepare data
473
+ $return = array();
474
+ $atts = shortcode_atts( array(
475
+ 'url' => 'http://vimeo.com/21294655',
476
+ 'width' => 600,
477
+ 'height' => 400,
478
+ 'autoplay' => 'no',
479
+ 'responsive' => 'yes',
480
+ 'class' => ''
481
+ ), $atts );
482
+ $atts['url'] = su_scattr( $atts['url'] );
483
+ $id = ( preg_match( '~(?:<iframe [^>]*src=")?(?:https?:\/\/(?:[\w]+\.)*vimeo\.com(?:[\/\w]*\/videos?)?\/([0-9]+)[^\s]*)"?(?:[^>]*></iframe>)?(?:<p>.*</p>)?~ix', $atts['url'], $match ) ) ? $match[1] : false;
484
+ // Check that url is specified
485
+ if ( !$id ) return '<p class="su-error">Vimeo: ' . __( 'please specify correct url', 'su' ) . '</p>';
486
+ // Prepare autoplay
487
+ $autoplay = ( $atts['autoplay'] === 'yes' ) ? '&amp;autoplay=1' : '';
488
+ // Create player
489
+ $return[] = '<div class="su-vimeo su-responsive-media-' . $atts['responsive'] . su_ecssc( $atts ) . '">';
490
+ $return[] = '<iframe width="' . $atts['width'] . '" height="' . $atts['height'] .
491
+ '" src="http://player.vimeo.com/video/' . $id . '?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff' .
492
+ $autoplay . '" frameborder="0" allowfullscreen="true"></iframe>';
493
+ $return[] = '</div>';
494
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-media-shortcodes' );
495
+ // Return result
496
+ return implode( '', $return );
497
+ }
498
+
499
+ public static function screenr( $atts = null, $content = null ) {
500
+ // Prepare data
501
+ $return = array();
502
+ $atts = shortcode_atts( array(
503
+ 'url' => 'http://www.screenr.com/OuWH',
504
+ 'width' => 600,
505
+ 'height' => 400,
506
+ 'responsive' => 'yes',
507
+ 'class' => ''
508
+ ), $atts );
509
+ $atts['url'] = su_scattr( $atts['url'] );
510
+ $id = ( preg_match( '~(?:<iframe [^>]*src=")?(?:https?:\/\/(?:[\w]+\.)*screenr\.com(?:[\/\w]*\/videos?)?\/([a-zA-Z0-9]+)[^\s]*)"?(?:[^>]*></iframe>)?(?:<p>.*</p>)?~ix', $atts['url'], $match ) ) ? $match[1] : false;
511
+ // Check that url is specified
512
+ if ( !$id ) return '<p class="su-error">Screenr: ' . __( 'please specify correct url', 'su' ) . '</p>';
513
+ // Create player
514
+ $return[] = '<div class="su-screenr su-responsive-media-' . $atts['responsive'] . su_ecssc( $atts ) . '">';
515
+ $return[] = '<iframe width="' . $atts['width'] . '" height="' . $atts['height'] .
516
+ '" src="http://screenr.com/embed/' . $id . '" frameborder="0" allowfullscreen="true"></iframe>';
517
+ $return[] = '</div>';
518
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-media-shortcodes' );
519
+ // Return result
520
+ return implode( '', $return );
521
+ }
522
+
523
+ public static function audio( $atts = null, $content = null ) {
524
+ $atts = shortcode_atts( array(
525
+ 'url' => 'http://www.jplayer.org/audio/mp3/TSP-01-Cro_magnon_man.mp3',
526
+ 'width' => 'auto',
527
+ 'title' => '',
528
+ 'autoplay' => 'no',
529
+ 'loop' => 'no',
530
+ 'class' => ''
531
+ ), $atts );
532
+ $atts['url'] = su_scattr( $atts['url'] );
533
+ // Generate unique ID
534
+ $id = uniqid( 'su_audio_player_' );
535
+ // Prepare width
536
+ $width = ( $atts['width'] !== 'auto' ) ? 'max-width:' . $atts['width'] : '';
537
+ // Check that url is specified
538
+ if ( !$atts['url'] ) return '<p class="su-error">Audio: ' . __( 'please specify correct url', 'su' ) . '</p>';
539
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-players-shortcodes' );
540
+ Shortcodes_Ultimate_Assets::add( 'js', 'jquery' );
541
+ Shortcodes_Ultimate_Assets::add( 'js', 'jplayer' );
542
+ Shortcodes_Ultimate_Assets::add( 'js', 'su-players-shortcodes' );
543
+ Shortcodes_Ultimate_Assets::add( 'js', 'su-players-shortcodes' );
544
+ // Create player
545
+ return '<div class="su-audio' . su_ecssc( $atts ) . '" data-id="' . $id . '" data-audio="' . $atts['url'] . '" data-swf="' . plugins_url( 'assets/other/Jplayer.swf', SU_PLUGIN_FILE ) . '" data-autoplay="' . $atts['autoplay'] . '" data-loop="' . $atts['loop'] . '" style="' . $width . '"><div id="' . $id . '" class="jp-jplayer"></div><div id="' . $id . '_container" class="jp-audio"><div class="jp-type-single"><div class="jp-gui jp-interface"><div class="jp-controls"><span class="jp-play"></span><span class="jp-pause"></span><span class="jp-stop"></span><span class="jp-mute"></span><span class="jp-unmute"></span><span class="jp-volume-max"></span></div><div class="jp-progress"><div class="jp-seek-bar"><div class="jp-play-bar"></div></div></div><div class="jp-volume-bar"><div class="jp-volume-bar-value"></div></div><div class="jp-current-time"></div><div class="jp-duration"></div></div><div class="jp-title">' . $atts['title'] . '</div></div></div></div>';
546
+ }
547
+
548
+ public static function video( $atts = null, $content = null ) {
549
+ $atts = shortcode_atts( array(
550
+ 'url' => 'http://www.jplayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v',
551
+ 'poster' => 'http://www.jplayer.org/video/poster/Big_Buck_Bunny_Trailer_480x270.png',
552
+ 'title' => '',
553
+ 'width' => 600,
554
+ 'height' => 300,
555
+ 'controls' => 'yes',
556
+ 'autoplay' => 'no',
557
+ 'loop' => 'no',
558
+ 'class' => ''
559
+ ), $atts );
560
+ $atts['url'] = su_scattr( $atts['url'] );
561
+ // Generate unique ID
562
+ $id = uniqid( 'su_video_player_' );
563
+ // Check that url is specified
564
+ if ( !$atts['url'] ) return '<p class="su-error">Video: ' . __( 'please specify correct url', 'su' ) . '</p>';
565
+ // Prepare title
566
+ $title = ( $atts['title'] ) ? '<div class="jp-title">' . $atts['title'] . '</div>' : '';
567
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-players-shortcodes' );
568
+ Shortcodes_Ultimate_Assets::add( 'js', 'jquery' );
569
+ Shortcodes_Ultimate_Assets::add( 'js', 'jplayer' );
570
+ Shortcodes_Ultimate_Assets::add( 'js', 'su-players-shortcodes' );
571
+ // Create player
572
+ return '<div style="width:' . $atts['width'] . 'px"><div id="' . $id . '" class="su-video jp-video su-video-controls-' . $atts['controls'] . su_ecssc( $atts ) . '" data-id="' . $id . '" data-video="' . $atts['url'] . '" data-swf="' . plugins_url( 'assets/other/Jplayer.swf', SU_PLUGIN_FILE ) . '" data-autoplay="' . $atts['autoplay'] . '" data-loop="' . $atts['loop'] . '" data-poster="' . $atts['poster'] . '"><div id="' . $id . '_player" class="jp-jplayer" style="width:' . $atts['width'] . 'px;height:' . $atts['height'] . 'px"></div>' . $title . '<div class="jp-start jp-play"></div><div class="jp-gui"><div class="jp-interface"><div class="jp-progress"><div class="jp-seek-bar"><div class="jp-play-bar"></div></div></div><div class="jp-current-time"></div><div class="jp-duration"></div><div class="jp-controls-holder"><span class="jp-play"></span><span class="jp-pause"></span><span class="jp-mute"></span><span class="jp-unmute"></span><span class="jp-full-screen"></span><span class="jp-restore-screen"></span><div class="jp-volume-bar"><div class="jp-volume-bar-value"></div></div></div></div></div></div></div>';
573
+ }
574
+
575
+ public static function table( $atts = null, $content = null ) {
576
+ $atts = shortcode_atts( array(
577
+ 'url' => false,
578
+ 'class' => ''
579
+ ), $atts );
580
+ $return = '<div class="su-table' . su_ecssc( $atts ) . '">';
581
+ $return .= ( $atts['url'] ) ? su_parse_csv( $atts['url'] ) : do_shortcode( $content );
582
+ $return .= '</div>';
583
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-content-shortcodes' );
584
+ Shortcodes_Ultimate_Assets::add( 'js', 'jquery' );
585
+ Shortcodes_Ultimate_Assets::add( 'js', 'su-other-shortcodes' );
586
+ return $return;
587
+ }
588
+
589
+ public static function permalink( $atts = null, $content = null ) {
590
+ $atts = shortcode_atts( array(
591
+ 'id' => 1,
592
+ 'p' => null, // 3.x
593
+ 'target' => 'self',
594
+ 'class' => ''
595
+ ), $atts );
596
+ if ( $atts['p'] !== null ) $atts['id'] = $atts['p'];
597
+ $atts['id'] = su_scattr( $atts['id'] );
598
+ // Prepare link text
599
+ $text = ( $content ) ? $content : get_the_title( $atts['id'] );
600
+ return '<a href="' . get_permalink( $atts['id'] ) . '" class="' . su_ecssc( $atts ) . '" title="' . $text . '" target="_' . $atts['target'] . '">' . $text . '</a>';
601
+ }
602
+
603
+ public static function members( $atts = null, $content = null ) {
604
+ $atts = shortcode_atts( array(
605
+ 'message' => __( 'This content is for registered users only. Please %login%.', 'su' ),
606
+ 'color' => '#ffcc00',
607
+ 'style' => null, // 3.x
608
+ 'login_text' => __( 'login', 'su' ),
609
+ 'login_url' => wp_login_url(),
610
+ 'login' => null, // 3.x
611
+ 'class' => ''
612
+ ), $atts );
613
+ if ( $atts['style'] !== null ) $atts['color'] = str_replace( array( '0', '1', '2' ), array( '#fff', '#FFFF29', '#1F9AFF' ), $atts['style'] );
614
+ // Check feed
615
+ if ( is_feed() ) return;
616
+ // Check authorization
617
+ if ( !is_user_logged_in() ) {
618
+ if ( $atts['login'] !== null && $atts['login'] == '0' ) return; // 3.x
619
+ // Prepare login link
620
+ $login = '<a href="' . esc_attr( $atts['login_url'] ) . '">' . $atts['login_text'] . '</a>';
621
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-other-shortcodes' );
622
+ return '<div class="su-members' . su_ecssc( $atts ) . '" style="background-color:' . su_hex_shift( $atts['color'], 'lighter', 50 ) . ';border-color:' .su_hex_shift( $atts['color'], 'darker', 20 ) . ';color:' .su_hex_shift( $atts['color'], 'darker', 60 ) . '">' . str_replace( '%login%', $login, su_scattr( $atts['message'] ) ) . '</div>';
623
+ }
624
+ // Return original content
625
+ else return do_shortcode( $content );
626
+ }
627
+
628
+ public static function guests( $atts = null, $content = null ) {
629
+ $atts = shortcode_atts( array( 'class' => '' ), $atts );
630
+ $return = '';
631
+ if ( !is_user_logged_in() && !is_null( $content ) ) {
632
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-other-shortcodes' );
633
+ $return = '<div class="su-guests' . su_ecssc( $atts ) . '">' . do_shortcode( $content ) . '</div>';
634
+ }
635
+ return $return;
636
+ }
637
+
638
+ public static function feed( $atts = null, $content = null ) {
639
+ $atts = shortcode_atts( array(
640
+ 'url' => get_bloginfo_rss( 'rss2_url' ),
641
+ 'limit' => 3,
642
+ 'class' => ''
643
+ ), $atts );
644
+ if ( !function_exists( 'wp_rss' ) ) include_once ABSPATH . WPINC . '/rss.php';
645
+ ob_start();
646
+ echo '<div class="su-feed' . su_ecssc( $atts ) . '">';
647
+ wp_rss( $atts['url'], $atts['limit'] );
648
+ echo '</div>';
649
+ $return = ob_get_contents();
650
+ ob_end_clean();
651
+ return $return;
652
+ }
653
+
654
+ public static function subpages( $atts = null, $content = null ) {
655
+ $atts = shortcode_atts( array(
656
+ 'depth' => 1,
657
+ 'p' => false,
658
+ 'class' => ''
659
+ ), $atts );
660
+ global $post;
661
+ $child_of = ( $atts['p'] ) ? $atts['p'] : get_the_ID();
662
+ $return = wp_list_pages( array(
663
+ 'title_li' => '',
664
+ 'echo' => 0,
665
+ 'child_of' => $child_of,
666
+ 'depth' => $atts['depth']
667
+ ) );
668
+ return ( $return ) ? '<ul class="su-subpages' . su_ecssc( $atts ) . '">' . $return . '</ul>' : false;
669
+ }
670
+
671
+ public static function siblings( $atts = null, $content = null ) {
672
+ $atts = shortcode_atts( array( 'depth' => 1, 'class' => '' ), $atts );
673
+ global $post;
674
+ $return = wp_list_pages( array( 'title_li' => '',
675
+ 'echo' => 0,
676
+ 'child_of' => $post->post_parent,
677
+ 'depth' => $atts['depth'],
678
+ 'exclude' => $post->ID ) );
679
+ return ( $return ) ? '<ul class="su-siblings' . su_ecssc( $atts ) . '">' . $return . '</ul>' : false;
680
+ }
681
+
682
+ public static function menu( $atts = null, $content = null ) {
683
+ $atts = shortcode_atts( array( 'name' => false, 'class' => '' ), $atts );
684
+ $return = wp_nav_menu( array(
685
+ 'echo' => false,
686
+ 'menu' => $atts['name'],
687
+ 'container' => false,
688
+ 'fallback_cb' => array( __CLASS__, 'menu_fb' ),
689
+ 'class' => $atts['class']
690
+ ) );
691
+ return ( $atts['name'] ) ? $return : false;
692
+ }
693
+
694
+ public static function menu_fb() {
695
+ return __( 'This menu doesn\'t exists, or has no elements', 'su' );
696
+ }
697
+
698
+ public static function document( $atts = null, $content = null ) {
699
+ $atts = shortcode_atts( array(
700
+ 'url' => '',
701
+ 'file' => null, // 3.x
702
+ 'width' => 600,
703
+ 'height' => 400,
704
+ 'responsive' => 'yes',
705
+ 'class' => ''
706
+ ), $atts );
707
+ if ( $atts['file'] !== null ) $atts['url'] = $atts['file'];
708
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-media-shortcodes' );
709
+ return '<div class="su-document su-responsive-media-' . $atts['responsive'] . '"><iframe src="http://docs.google.com/viewer?embedded=true&url=' . $atts['url'] . '" width="' . $atts['width'] . '" height="' . $atts['height'] . '" class="su-document' . su_ecssc( $atts ) . '"></iframe></div>';
710
+ }
711
+
712
+ public static function gmap( $atts = null, $content = null ) {
713
+ $atts = shortcode_atts( array(
714
+ 'width' => 600,
715
+ 'height' => 400,
716
+ 'responsive' => 'yes',
717
+ 'address' => 'New York',
718
+ 'class' => ''
719
+ ), $atts );
720
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-media-shortcodes' );
721
+ return '<div class="su-gmap su-responsive-media-' . $atts['responsive'] . su_ecssc( $atts ) . '"><iframe width="' . $atts['width'] . '" height="' . $atts['height'] . '" src="http://maps.google.com/maps?q=' . urlencode( su_scattr( $atts['address'] ) ) . '&amp;output=embed"></iframe></div>';
722
+ }
723
+
724
+ public static function slider( $atts = null, $content = null ) {
725
+ // Prepare vars
726
+ $shult = shortcodes_ultimate();
727
+ $return = '';
728
+ $atts = shortcode_atts( array(
729
+ 'gallery' => 1,
730
+ 'width' => 600,
731
+ 'height' => 300,
732
+ 'responsive' => 'yes',
733
+ 'title' => 'yes',
734
+ 'centered' => 'yes',
735
+ 'arrows' => 'yes',
736
+ 'pages' => 'yes',
737
+ 'mousewheel' => 'yes',
738
+ 'autoplay' => 3000,
739
+ 'speed' => 600,
740
+ 'target' => 'yes',
741
+ 'class' => ''
742
+ ), $atts );
743
+ // Prepare unique ID
744
+ $id = uniqid( 'su_slider_' );
745
+ // Links target
746
+ $target = ( $atts['target'] === 'yes' ) ? ' target="_blank"' : '';
747
+ // Centered class
748
+ $centered = ( $atts['centered'] === 'yes' ) ? ' su-slider-centered' : '';
749
+ // Wheel control
750
+ $mousewheel = ( $atts['mousewheel'] === 'yes' ) ? 'true' : 'false';
751
+ // Prepare gallery
752
+ $galleries = $shult->get_option( 'galleries' );
753
+ $gallery = ( is_numeric( $atts['gallery'] ) && $atts['gallery'] > 0 ) ? $galleries[$atts['gallery'] - 1] : 1;
754
+ // Prepare slides
755
+ $slides = ( count( ( array ) $gallery['items'] ) ) ? $gallery['items'] : array();
756
+ // Prepare width and height
757
+ $size = ( $atts['responsive'] === 'yes' ) ? 'width:100%' : 'width:' . intval( $atts['width'] ) . 'px;height:' . intval( $atts['height'] ) . 'px';
758
+ // Slides not found
759
+ if ( !count( $slides ) || !is_array( $slides ) ) $return = '<p class="su-error">Slider: ' . __( 'images not found', 'su' ) . '</p>';
760
+ // Slides are found
761
+ else {
762
+ // Open slider
763
+ $return .= '<div id="' . $id . '" class="su-slider' . $centered . ' su-slider-pages-' . $atts['pages'] . ' su-slider-responsive-' . $atts['responsive'] . su_ecssc( $atts ) . '" style="' . $size . '" data-autoplay="' . $atts['autoplay'] . '" data-speed="' . $atts['speed'] . '" data-mousewheel="' . $mousewheel . '"><div class="su-slider-slides">';
764
+ // Create slides
765
+ foreach ( (array) $slides as $slide ) {
766
+ // Crop the image
767
+ $image = su_image_resize( $slide['image'], $atts['width'], $atts['height'] );
768
+ // Prepare slide title
769
+ $title = ( $atts['title'] === 'yes' && $slide['title'] ) ? '<span class="su-slider-slide-title">' . stripslashes( $slide['title'] ) . '</span>' : '';
770
+ // Open slide
771
+ $return .= '<div class="su-slider-slide">';
772
+ // Slide content with link
773
+ if ( $slide['link'] ) $return .= '<a href="' . $slide['link'] . '"' . $target . '><img src="' . $image['url'] . '" alt="' . esc_attr( $slide['title'] ) . '" />' . $title . '</a>';
774
+ // Slide content without link
775
+ else $return .= '<a><img src="' . $slide['image'] . '" alt="' . esc_attr( $slide['title'] ) . '" />' . $title . '</a>';
776
+ // Close slide
777
+ $return .= '</div>';
778
+ }
779
+ // Close slides
780
+ $return .= '</div>';
781
+ // Open nav section
782
+ $return .= '<div class="su-slider-nav">';
783
+ // Append direction nav
784
+ if ( $atts['arrows'] === 'yes'
785
+ ) $return .= '<div class="su-slider-direction"><span class="su-slider-prev"></span><span class="su-slider-next"></span></div>';
786
+ // Append pagination nav
787
+ $return .= '<div class="su-slider-pagination"></div>';
788
+ // Close nav section
789
+ $return .= '</div>';
790
+ // Close slider
791
+ $return .= '</div>';
792
+ }
793
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-galleries-shortcodes' );
794
+ Shortcodes_Ultimate_Assets::add( 'js', 'jquery' );
795
+ Shortcodes_Ultimate_Assets::add( 'js', 'swiper' );
796
+ Shortcodes_Ultimate_Assets::add( 'js', 'su-galleries-shortcodes' );
797
+ return $return;
798
+ }
799
+
800
+ public static function carousel( $atts = null, $content = null ) {
801
+ // Prepare vars
802
+ $shult = shortcodes_ultimate();
803
+ $return = '';
804
+ $atts = shortcode_atts( array(
805
+ 'gallery' => 1,
806
+ 'width' => 600,
807
+ 'height' => 100,
808
+ 'responsive' => 'yes',
809
+ 'items' => 3,
810
+ 'scroll' => 1,
811
+ 'title' => 'yes',
812
+ 'centered' => 'yes',
813
+ 'arrows' => 'yes',
814
+ 'pages' => 'no',
815
+ 'mousewheel' => 'yes',
816
+ 'autoplay' => 3000,
817
+ 'speed' => 600,
818
+ 'target' => 'yes',
819
+ 'class' => ''
820
+ ), $atts );
821
+ // Prepare unique ID
822
+ $id = uniqid( 'su_carousel_' );
823
+ // Links target
824
+ $target = ( $atts['target'] === 'yes' ) ? ' target="_blank"' : '';
825
+ // Centered class
826
+ $centered = ( $atts['centered'] === 'yes' ) ? ' su-carousel-centered' : '';
827
+ // Wheel control
828
+ $mousewheel = ( $atts['mousewheel'] === 'yes' ) ? 'true' : 'false';
829
+ // Prepare gallery
830
+ $galleries = $shult->get_option( 'galleries' );
831
+ $gallery = ( is_numeric( $atts['gallery'] ) && $atts['gallery'] > 0 ) ? $galleries[$atts['gallery'] - 1] : 1;
832
+ // Prepare slides
833
+ $slides = ( count( ( array ) $gallery['items'] ) ) ? $gallery['items'] : array();
834
+ // Prepare width and height
835
+ $size = ( $atts['responsive'] === 'yes' ) ? 'width:100%' : 'width:' . intval( $atts['width'] ) . 'px;height:' . intval( $atts['height'] ) . 'px';
836
+ // Slides not found
837
+ if ( !count( $slides ) || !is_array( $slides ) ) $return = '<p class="su-error">Carousel: ' . __( 'images not found', 'su' ) . '</p>';
838
+ // Slides are found
839
+ else {
840
+ // Open slider
841
+ $return .= '<div id="' . $id . '" class="su-carousel' . $centered . ' su-carousel-pages-' . $atts['pages'] . ' su-carousel-responsive-' . $atts['responsive'] . su_ecssc( $atts ) . '" style="' . $size . '" data-autoplay="' . $atts['autoplay'] . '" data-speed="' . $atts['speed'] . '" data-mousewheel="' . $mousewheel . '" data-items="' . $atts['items'] . '" data-scroll="' . $atts['scroll'] . '"><div class="su-carousel-slides">';
842
+ // Create slides
843
+ foreach ( (array) $slides as $slide ) {
844
+ // Crop the image
845
+ $image = su_image_resize( $slide['image'], round( $atts['width'] / $atts['items'] ), $atts['height'] );
846
+ // Prepare slide title
847
+ $title = ( $atts['title'] === 'yes' && $slide['title'] ) ? '<span class="su-carousel-slide-title">' . stripslashes( $slide['title'] ) . '</span>' : '';
848
+ // Open slide
849
+ $return .= '<div class="su-carousel-slide">';
850
+ // Slide content with link
851
+ if ( $slide['link'] ) $return .= '<a href="' . $slide['link'] . '"' . $target . '><img src="' . $image['url'] . '" alt="' . esc_attr( $slide['title'] ) . '" />' . $title . '</a>';
852
+ // Slide content without link
853
+ else $return .= '<a><img src="' . $slide['image'] . '" alt="' . esc_attr( $slide['title'] ) . '" />' . $title . '</a>';
854
+ // Close slide
855
+ $return .= '</div>';
856
+ }
857
+ // Close slides
858
+ $return .= '</div>';
859
+ // Open nav section
860
+ $return .= '<div class="su-carousel-nav">';
861
+ // Append direction nav
862
+ if ( $atts['arrows'] === 'yes'
863
+ ) $return .= '<div class="su-carousel-direction"><span class="su-carousel-prev"></span><span class="su-carousel-next"></span></div>';
864
+ // Append pagination nav
865
+ $return .= '<div class="su-carousel-pagination"></div>';
866
+ // Close nav section
867
+ $return .= '</div>';
868
+ // Close slider
869
+ $return .= '</div>';
870
+ }
871
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-galleries-shortcodes' );
872
+ Shortcodes_Ultimate_Assets::add( 'js', 'jquery' );
873
+ Shortcodes_Ultimate_Assets::add( 'js', 'swiper' );
874
+ Shortcodes_Ultimate_Assets::add( 'js', 'su-galleries-shortcodes' );
875
+ return $return;
876
+ }
877
+
878
+ public static function custom_gallery( $atts = null, $content = null ) {
879
+ // Prepare vars
880
+ $shult = shortcodes_ultimate();
881
+ $return = '';
882
+ $atts = shortcode_atts( array(
883
+ 'gallery' => 1,
884
+ 'width' => 90,
885
+ 'height' => 90,
886
+ 'title' => 'hover',
887
+ 'target' => 'yes',
888
+ 'class' => ''
889
+ ), $atts );
890
+ // Links target
891
+ $target = ( $atts['target'] === 'yes' ) ? ' target="_blank"' : '';
892
+ // Prepare gallery
893
+ $galleries = $shult->get_option( 'galleries' );
894
+ $gallery = ( is_numeric( $atts['gallery'] ) && $atts['gallery'] > 0 ) ? $galleries[$atts['gallery'] - 1] : 1;
895
+ // Prepare slides
896
+ $slides = ( count( ( array ) $gallery['items'] ) ) ? $gallery['items'] : array();
897
+ // Slides not found
898
+ if ( !count( $slides ) || !is_array( $slides ) ) $return = '<p class="su-error">Custom gallery: ' . __( 'images not found', 'su' ) . '</p>';
899
+ // Slides are found
900
+ else {
901
+ // Open gallery
902
+ $return .= '<div class="su-custom-gallery su-custom-gallery-title-' . $atts['title'] . su_ecssc( $atts ) . '">';
903
+ // Create slides
904
+ foreach ( (array) $slides as $slide ) {
905
+ // Crop image
906
+ $image = su_image_resize( $slide['image'], $atts['width'], $atts['height'] );
907
+ // Prepare slide title
908
+ $title = ( $slide['title'] ) ? '<span class="su-custom-gallery-title">' . stripslashes( $slide['title'] ) . '</span>' : '';
909
+ // Open slide
910
+ $return .= '<div class="su-custom-gallery-slide">';
911
+ // Slide content with link
912
+ if ( $slide['link'] ) $return .= '<a href="' . $slide['link'] . '"' . $target . '><img src="' . $image['url'] . '" alt="' . esc_attr( $slide['title'] ) . '" width="' . $atts['width'] . '" height="' . $atts['height'] . '" />' . $title . '</a>';
913
+ // Slide content without link
914
+ else $return .= '<a><img src="' . $slide['image'] . '" alt="' . esc_attr( $slide['title'] ) . '" width="' . $atts['width'] . '" height="' . $atts['height'] . '" />' . $title . '</a>';
915
+ // Close slide
916
+ $return .= '</div>';
917
+ }
918
+ // Clear floats
919
+ $return .= '<div class="su-clear"></div>';
920
+ // Close gallery
921
+ $return .= '</div>';
922
+ }
923
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-galleries-shortcodes' );
924
+ return $return;
925
+ }
926
+
927
+ public static function posts( $atts = null, $content = null ) {
928
+ // Prepare error var
929
+ $error = null;
930
+ // Parse attributes
931
+ $atts = shortcode_atts( array(
932
+ 'template' => 'templates/default-loop.php',
933
+ 'id' => false,
934
+ 'posts_per_page' => get_option( 'posts_per_page' ),
935
+ 'post_type' => 'post',
936
+ 'taxonomy' => 'category',
937
+ 'tax_term' => false,
938
+ 'tax_operator' => 'IN',
939
+ 'author' => '',
940
+ 'meta_key' => '',
941
+ 'offset' => 0,
942
+ 'order' => 'DESC',
943
+ 'orderby' => 'date',
944
+ 'post_parent' => false,
945
+ 'post_status' => 'publish',
946
+ 'ignore_sticky_posts' => 'no'
947
+ ), $atts );
948
+
949
+ $original_atts = $atts;
950
+
951
+ $author = sanitize_text_field( $atts['author'] );
952
+ $id = $atts['id']; // Sanitized later as an array of integers
953
+ $ignore_sticky_posts = ( bool ) ( $atts['ignore_sticky_posts'] === 'yes' ) ? true : false;
954
+ $meta_key = sanitize_text_field( $atts['meta_key'] );
955
+ $offset = intval( $atts['offset'] );
956
+ $order = sanitize_key( $atts['order'] );
957
+ $orderby = sanitize_key( $atts['orderby'] );
958
+ $post_parent = $atts['post_parent'];
959
+ $post_status = $atts['post_status'];
960
+ $post_type = sanitize_text_field( $atts['post_type'] );
961
+ $posts_per_page = intval( $atts['posts_per_page'] );
962
+ $tag = sanitize_text_field( $atts['tag'] );
963
+ $tax_operator = $atts['tax_operator'];
964
+ $tax_term = sanitize_text_field( $atts['tax_term'] );
965
+ $taxonomy = sanitize_key( $atts['taxonomy'] );
966
+ // Set up initial query for post
967
+ $args = array(
968
+ 'category_name' => '',
969
+ 'order' => $order,
970
+ 'orderby' => $orderby,
971
+ 'post_type' => explode( ',', $post_type ),
972
+ 'posts_per_page' => $posts_per_page,
973
+ 'tag' => $tag
974
+ );
975
+ // Ignore Sticky Posts
976
+ if ( $ignore_sticky_posts ) $args['ignore_sticky_posts'] = true;
977
+ // Meta key (for ordering)
978
+ if ( !empty( $meta_key ) ) $args['meta_key'] = $meta_key;
979
+ // If Post IDs
980
+ if ( $id ) {
981
+ $posts_in = array_map( 'intval', explode( ',', $id ) );
982
+ $args['post__in'] = $posts_in;
983
+ }
984
+ // Post Author
985
+ if ( !empty( $author ) ) $args['author_name'] = $author;
986
+ // Offset
987
+ if ( !empty( $offset ) ) $args['offset'] = $offset;
988
+ // Post Status
989
+ $post_status = explode( ', ', $post_status );
990
+ $validated = array();
991
+ $available = array( 'publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash', 'any' );
992
+ foreach ( $post_status as $unvalidated ) {
993
+ if ( in_array( $unvalidated, $available ) ) $validated[] = $unvalidated;
994
+ }
995
+ if ( !empty( $validated ) ) $args['post_status'] = $validated;
996
+ // If taxonomy attributes, create a taxonomy query
997
+ if ( !empty( $taxonomy ) && !empty( $tax_term ) ) {
998
+ // Term string to array
999
+ $tax_term = explode( ',', $tax_term );
1000
+ // Validate operator
1001
+ if ( !in_array( $tax_operator, array( 'IN', 'NOT IN', 'AND' ) ) ) $tax_operator = 'IN';
1002
+ $tax_args = array( 'tax_query' => array( array( 'taxonomy' => $taxonomy,
1003
+ 'field' => 'slug',
1004
+ 'terms' => $tax_term,
1005
+ 'operator' => $tax_operator ) ) );
1006
+ // Check for multiple taxonomy queries
1007
+ $count = 2;
1008
+ $more_tax_queries = false;
1009
+ while ( isset( $original_atts['taxonomy_' . $count] ) && !empty( $original_atts['taxonomy_' . $count] ) &&
1010
+ isset( $original_atts['tax_' . $count . '_term'] ) &&
1011
+ !empty( $original_atts['tax_' . $count . '_term'] ) ) {
1012
+ // Sanitize values
1013
+ $more_tax_queries = true;
1014
+ $taxonomy = sanitize_key( $original_atts['taxonomy_' . $count] );
1015
+ $terms = explode( ', ', sanitize_text_field( $original_atts['tax_' . $count . '_term'] ) );
1016
+ $tax_operator = isset( $original_atts['tax_' . $count . '_operator'] ) ? $original_atts[
1017
+ 'tax_' . $count . '_operator'] : 'IN';
1018
+ $tax_operator = in_array( $tax_operator, array( 'IN', 'NOT IN', 'AND' ) ) ? $tax_operator : 'IN';
1019
+ $tax_args['tax_query'][] = array( 'taxonomy' => $taxonomy,
1020
+ 'field' => 'slug',
1021
+ 'terms' => $terms,
1022
+ 'operator' => $tax_operator );
1023
+ $count++;
1024
+ }
1025
+ if ( $more_tax_queries ):
1026
+ $tax_relation = 'AND';
1027
+ if ( isset( $original_atts['tax_relation'] ) &&
1028
+ in_array( $original_atts['tax_relation'], array( 'AND', 'OR' ) )
1029
+ ) $tax_relation = $original_atts['tax_relation'];
1030
+ $args['tax_query']['relation'] = $tax_relation;
1031
+ endif;
1032
+ $args = array_merge( $args, $tax_args );
1033
+ }
1034
+
1035
+ // If post parent attribute, set up parent
1036
+ if ( $post_parent ) {
1037
+ if ( 'current' == $post_parent ) {
1038
+ global $post;
1039
+ $post_parent = $post->ID;
1040
+ }
1041
+ $args['post_parent'] = intval( $post_parent );
1042
+ }
1043
+ // Save original posts
1044
+ global $posts;
1045
+ $original_posts = $posts;
1046
+ // Query posts
1047
+ $posts = new WP_Query( $args );
1048
+ // Buffer output
1049
+ ob_start();
1050
+ // Search for template in stylesheet directory
1051
+ if ( file_exists( STYLESHEETPATH . '/' . $atts['template'] ) ) load_template( STYLESHEETPATH . '/' . $atts['template'], false );
1052
+ // Search for template in theme directory
1053
+ elseif ( file_exists( TEMPLATEPATH . '/' . $atts['template'] ) ) load_template( TEMPLATEPATH . '/' . $atts['template'], false );
1054
+ // Search for template in plugin directory
1055
+ elseif ( path_join( dirname( SU_PLUGIN_FILE ), $atts['template'] ) ) load_template( path_join( dirname( SU_PLUGIN_FILE ), $atts['template'] ), false );
1056
+ // Template not found
1057
+ else echo '<p class="su-error">Posts: ' . __( 'template not found', 'su' ) . '</p>';
1058
+ $output = ob_get_contents();
1059
+ ob_end_clean();
1060
+ // Return original posts
1061
+ $posts = $original_posts;
1062
+ // Reset the query
1063
+ wp_reset_postdata();
1064
+ Shortcodes_Ultimate_Assets::add( 'css', 'su-other-shortcodes' );
1065
+ return $output;
1066
+ }
1067
+ }
1068
+
1069
+ new Shortcodes_Ultimate_Shortcodes;
inc/core/shortcodes.php DELETED
@@ -1,1448 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Shortcode: heading
5
- *
6
- * @param array $atts Shortcode attributes
7
- * @param string $content
8
- *
9
- * @return string Output html
10
- */
11
- function su_heading_shortcode( $atts, $content = null ) {
12
- $atts = shortcode_atts( array(
13
- 'size' => 3,
14
- 'align' => 'center',
15
- 'class' => ''
16
- ), $atts );
17
- su_query_asset( 'css', 'su-content-shortcodes' );
18
- $size = round( ( $atts['size'] + 7 ) * 1.3 );
19
- return '<div class="su-heading su-heading-align-' . $atts['align'] . su_ecssc( $atts ) . '" style="font-size:' . $size . 'px"><div class="su-heading-inner">' . $content . '</div></div>';
20
- }
21
-
22
- /**
23
- * Shortcode: tabs
24
- *
25
- * @param array $atts Shortcode attributes
26
- * @param string $content
27
- *
28
- * @return string Output html
29
- */
30
- function su_tabs_shortcode( $atts, $content ) {
31
- $atts = shortcode_atts( array(
32
- 'active' => 1,
33
- 'vertical' => 'no',
34
- 'style' => null, // 3.x
35
- 'class' => ''
36
- ), $atts );
37
- if ( $atts['style'] == '3' ) $atts['vertical'] = 'yes';
38
- $GLOBALS['tab_count'] = 0;
39
- do_shortcode( $content );
40
- $return = '';
41
- $tabs = $panes = array();
42
- if ( is_array( $GLOBALS['tabs'] ) ) {
43
- if ( $GLOBALS['tab_count'] < $atts['active'] ) $atts['active'] = $GLOBALS['tab_count'];
44
- foreach ( $GLOBALS['tabs'] as $tab ) {
45
- $tabs[] = '<span class="' . su_ecssc( $tab ) . $tab['disabled'] . '">' . su_scattr( $tab['title'] ) . '</span>';
46
- $panes[] = '<div class="su-tabs-pane' . su_ecssc( $tab ) . '">' . $tab['content'] . '</div>';
47
- }
48
- $vertical = ( $atts['vertical'] === 'yes' ) ? ' su-tabs-vertical' : '';
49
- $return = '<div class="su-tabs' . $vertical . su_ecssc( $atts ) . '" data-active="' . (string) $atts['active'] . '"><div class="su-tabs-nav">' . implode( '', $tabs ) . '</div><div class="su-tabs-panes">' . implode( "\n", $panes ) . '</div><div style="clear:both;height:0"></div></div>';
50
- }
51
- // Unset globals
52
- unset( $GLOBALS['tabs'], $GLOBALS['tab_count'] );
53
- su_query_asset( 'css', 'su-box-shortcodes' );
54
- su_query_asset( 'js', 'jquery' );
55
- su_query_asset( 'js', 'su-other-shortcodes' );
56
- return $return;
57
- }
58
-
59
- /**
60
- * Shortcode: tab
61
- *
62
- * @param array $atts Shortcode attributes
63
- * @param string $content
64
- *
65
- * @return string Output html
66
- */
67
- function su_tab_shortcode( $atts, $content ) {
68
- $atts = shortcode_atts( array(
69
- 'title' => __( 'Tab title', 'su' ),
70
- 'disabled' => 'no',
71
- 'class' => ''
72
- ), $atts );
73
- $x = $GLOBALS['tab_count'];
74
- $GLOBALS['tabs'][$x] = array(
75
- 'title' => $atts['title'],
76
- 'content' => do_shortcode( $content ),
77
- 'disabled' => ( $atts['disabled'] === 'yes' ) ? ' su-tabs-disabled' : '',
78
- 'class' => $atts['class']
79
- );
80
- $GLOBALS['tab_count']++;
81
- }
82
-
83
- /**
84
- * Shortcode: spoiler
85
- *
86
- * @param array $atts Shortcode attributes
87
- * @param string $content
88
- *
89
- * @return string Output html
90
- */
91
- function su_spoiler_shortcode( $atts, $content = null ) {
92
- $atts = shortcode_atts( array(
93
- 'title' => __( 'Spoiler title', 'su' ),
94
- 'open' => 'no',
95
- 'style' => 'default',
96
- 'class' => ''
97
- ), $atts );
98
- $atts['style'] = str_replace( array( '1', '2' ), array( 'default', 'fancy' ), $atts['style'] );
99
- $closed = ( $atts['open'] !== 'yes' ) ? ' su-spoiler-closed' : '';
100
- su_query_asset( 'css', 'su-box-shortcodes' );
101
- su_query_asset( 'js', 'jquery' );
102
- su_query_asset( 'js', 'su-other-shortcodes' );
103
- return '<div class="su-spoiler su-spoiler-style-' . $atts['style'] . $closed . su_ecssc( $atts ) . '"><div class="su-spoiler-title"><span class="su-spoiler-icon"></span>' . su_scattr( $atts['title'] ) . '</div><div class="su-spoiler-content">' . su_do_shortcode( $content, 's' ) . '</div></div>';
104
- }
105
-
106
- /**
107
- * Shortcode: accordion
108
- *
109
- * @param array $atts Shortcode attributes
110
- * @param string $content
111
- *
112
- * @return string Output html
113
- */
114
- function su_accordion_shortcode( $atts = null, $content = null ) {
115
- $atts = shortcode_atts( array( 'class' => '' ), $atts );
116
- return '<div class="su-accordion' . su_ecssc( $atts ) . '">' . do_shortcode( $content ) . '</div>';
117
- }
118
-
119
- /**
120
- * Shortcode: divider
121
- *
122
- * @param array $atts Shortcode attributes
123
- * @param string $content
124
- *
125
- * @return string Output html
126
- */
127
- function su_divider_shortcode( $atts, $content = null ) {
128
- $atts = shortcode_atts( array(
129
- 'top' => 'yes',
130
- 'text' => __( 'Go to top', 'su' ),
131
- 'class' => ''
132
- ), $atts );
133
- $top = ( $atts['top'] === 'yes' ) ? '<a href="#">' . su_scattr( $atts['text'] ) . '</a>' : '';
134
- su_query_asset( 'css', 'su-content-shortcodes' );
135
- return '<div class="su-divider' . su_ecssc( $atts ) . '">' . $top . '</div>';
136
- }
137
-
138
- /**
139
- * Shortcode: spacer
140
- *
141
- * @param array $atts Shortcode attributes
142
- * @param string $content
143
- *
144
- * @return string Output html
145
- */
146
- function su_spacer_shortcode( $atts, $content = null ) {
147
- $atts = shortcode_atts( array(
148
- 'size' => 0,
149
- 'class' => ''
150
- ), $atts );
151
- su_query_asset( 'css', 'su-content-shortcodes' );
152
- return '<div class="su-spacer' . su_ecssc( $atts ) . '" style="height:' . $atts['size'] . 'px"></div>';
153
- }
154
-
155
- /**
156
- * Shortcode: highlight
157
- *
158
- * @param array $atts Shortcode attributes
159
- * @param string $content
160
- *
161
- * @return string Output html
162
- */
163
- function su_highlight_shortcode( $atts, $content = null ) {
164
- $atts = shortcode_atts( array(
165
- 'background' => '#ddff99',
166
- 'bg' => null, // 3.x
167
- 'color' => '#000000',
168
- 'class' => ''
169
- ), $atts );
170
- if ( $atts['bg'] !== null ) $atts['background'] = $atts['bg'];
171
- su_query_asset( 'css', 'su-content-shortcodes' );
172
- return '<span class="su-highlight' . su_ecssc( $atts ) . '" style="background:' . $atts['background'] . ';color:' . $atts['color'] . '">&nbsp;' . do_shortcode( $content ) . '&nbsp;</span>';
173
- }
174
-
175
- /**
176
- * Shortcode: label
177
- *
178
- * @param array $atts Shortcode attributes
179
- * @param string $content
180
- *
181
- * @return string Output html
182
- */
183
- function su_label_shortcode( $atts, $content = null ) {
184
- $atts = shortcode_atts( array(
185
- 'type' => 'default',
186
- 'style' => null, // 3.x
187
- 'class' => ''
188
- ), $atts );
189
- if ( $atts['style'] !== null ) $atts['type'] = $atts['style'];
190
- su_query_asset( 'css', 'su-content-shortcodes' );
191
- return '<span class="su-label su-label-type-' . $atts['type'] . su_ecssc( $atts ) . '">' . do_shortcode( $content ) . '</span>';
192
- }
193
-
194
- /**
195
- * Shortcode: quote
196
- *
197
- * @param array $atts Shortcode attributes
198
- * @param string $content
199
- *
200
- * @return string Output html
201
- */
202
- function su_quote_shortcode( $atts, $content = null ) {
203
- $atts = shortcode_atts( array(
204
- 'cite' => false,
205
- 'url' => false,
206
- 'class' => ''
207
- ), $atts );
208
- $cite_link = ( $atts['url'] && $atts['cite'] ) ? '<a href="' . $atts['url'] . '">' . $atts['cite'] . '</a>'
209
- : $atts['cite'];
210
- $cite = ( $atts['cite'] ) ? '<span class="su-quote-cite">&mdash; ' . $cite_link . '</span>' : '';
211
- $cite_class = ( $atts['cite'] ) ? ' su-quote-has-cite' : '';
212
- su_query_asset( 'css', 'su-box-shortcodes' );
213
- return '<div class="su-quote' . $cite_class . su_ecssc( $atts ) . '"><div class="su-quote-inner">' . do_shortcode( $content ) . su_scattr( $cite ) . '</div></div>';
214
- }
215
-
216
- /**
217
- * Shortcode: pullquote
218
- *
219
- * @param array $atts Shortcode attributes
220
- * @param string $content
221
- *
222
- * @return string Output html
223
- */
224
- function su_pullquote_shortcode( $atts, $content = null ) {
225
- $atts = shortcode_atts( array(
226
- 'align' => 'left',
227
- 'class' => ''
228
- ), $atts );
229
- su_query_asset( 'css', 'su-box-shortcodes' );
230
- return '<div class="su-pullquote su-pullquote-align-' . $atts['align'] . su_ecssc( $atts ) . '">' . do_shortcode( $content ) . '</div>';
231
- }
232
-
233
- /**
234