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
- * Shortcode: dropcap
235
- *
236
- * @param array $atts Shortcode attributes
237
- * @param string $content
238
- *
239
- * @return string Output html
240
- */
241
- function su_dropcap_shortcode( $atts, $content = null ) {
242
- $atts = shortcode_atts( array(
243
- 'style' => 'default',
244
- 'size' => 3,
245
- 'class' => ''
246
- ), $atts );
247
- $atts['style'] = str_replace( array( '1', '2', '3' ), array( 'default', 'light', 'default' ), $atts['style'] ); // 3.x
248
- // Calculate font-size
249
- $em = $atts['size'] * 0.5 . 'em';
250
- su_query_asset( 'css', 'su-content-shortcodes' );
251
- return '<span class="su-dropcap su-dropcap-style-' . $atts['style'] . su_ecssc( $atts ) . '" style="font-size:' . $em . '">' . do_shortcode( $content ) . '</span>';
252
- }
253
-
254
- /**
255
- * Shortcode: frame
256
- *
257
- * @param array $atts Shortcode attributes
258
- * @param string $content
259
- *
260
- * @return string Output html
261
- */
262
- function su_frame_shortcode( $atts, $content = null ) {
263
- $atts = shortcode_atts( array(
264
- 'style' => 'default',
265
- 'align' => 'left',
266
- 'class' => ''
267
- ), $atts );
268
- su_query_asset( 'css', 'su-content-shortcodes' );
269
- su_query_asset( 'js', 'su-other-shortcodes' );
270
- 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>';
271
- }
272
-
273
- /**
274
- * Shortcode: row
275
- *
276
- * @param array $atts Shortcode attributes
277
- * @param string $content
278
- *
279
- * @return string Output html
280
- */
281
- function su_row_shortcode( $atts = null, $content = null ) {
282
- $atts = shortcode_atts( array( 'class' => '' ), $atts );
283
- return '<div class="su-row' . su_ecssc( $atts ) . '">' . su_do_shortcode( $content, 'r' ) . '</div>';
284
- }
285
-
286
- /**
287
- * Shortcode: column
288
- *
289
- * @param array $atts Shortcode attributes
290
- * @param string $content
291
- *
292
- * @return string Output html
293
- */
294
- function su_column_shortcode( $atts, $content = null ) {
295
- $atts = shortcode_atts( array(
296
- 'size' => '1/2',
297
- 'center' => 'no',
298
- 'last' => null,
299
- 'class' => ''
300
- ), $atts );
301
- if ( $atts['last'] !== null && $atts['last'] == '1' ) $atts['class'] .= ' su-column-last';
302
- if ( $atts['center'] === 'yes' ) $atts['class'] .= ' su-column-centered';
303
- su_query_asset( 'css', 'su-box-shortcodes' );
304
- 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>';
305
- }
306
-
307
- /**
308
- * Shortcode: list
309
- *
310
- * @param array $atts Shortcode attributes
311
- * @param string $content
312
- *
313
- * @return string Output html
314
- */
315
- function su_list_shortcode( $atts, $content = null ) {
316
- $atts = shortcode_atts( array(
317
- 'style' => 'star',
318
- 'class' => ''
319
- ), $atts );
320
- su_query_asset( 'css', 'su-content-shortcodes' );
321
- return '<div class="su-list su-list-style-' . $atts['style'] . su_ecssc( $atts ) . '">' . su_do_shortcode( $content, 'l' ) . '</div>';
322
- }
323
-
324
- /**
325
- * Shortcode: button
326
- *
327
- * @param array $atts Shortcode attributes
328
- * @param string $content
329
- *
330
- * @return string Output html
331
- */
332
- function su_button_shortcode( $atts, $content = null ) {
333
- $atts = shortcode_atts( array(
334
- 'url' => get_option( 'home' ),
335
- 'link' => null, // 3.x
336
- 'target' => 'self',
337
- 'style' => 'default',
338
- 'background' => '#2D89EF',
339
- 'color' => '#FFFFFF',
340
- 'dark' => null, // 3.x
341
- 'size' => 3,
342
- 'wide' => 'no',
343
- 'center' => 'no',
344
- 'radius' => 'auto',
345
- 'icon' => false,
346
- 'ts_color' => 'dark',
347
- 'ts_pos' => 'none',
348
- 'desc' => '',
349
- 'class' => ''
350
- ), $atts );
351
-
352
- if ( $atts['link'] !== null ) $atts['url'] = $atts['link'];
353
- if ( $atts['dark'] !== null ) {
354
- $atts['background'] = $atts['color'];
355
- $atts['color'] = ( $atts['dark'] ) ? '#000' : '#fff';
356
- }
357
- 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
358
-
359
- // Prepare vars
360
- $a_css = array();
361
- $span_css = array();
362
- $img_css = array();
363
- $small_css = array();
364
- $radius = '0px';
365
- $before = $after = '';
366
-
367
- // Text shadow values
368
- $shadows = array(
369
- 'none' => '0 0',
370
- 'top' => '0 -1px',
371
- 'right' => '1px 0',
372
- 'bottom' => '0 1px',
373
- 'left' => '-1px 0',
374
- 'top-right' => '1px -1px',
375
- 'top-left' => '-1px -1px',
376
- 'bottom-right' => '1px 1px',
377
- 'bottom-left' => '-1px 1px'
378
- );
379
-
380
- // Common styles for button
381
- $styles = array(
382
- 'size' => round( ( $atts['size'] + 7 ) * 1.3 ),
383
- 'ts_color' => ( $atts['ts_color'] === 'light' ) ? su_hex_shift( $atts['background'], 'lighter', 50 ) : su_hex_shift( $atts['background'], 'darker', 40 ),
384
- 'ts_pos' => $shadows[$atts['ts_pos']]
385
- );
386
-
387
- // Calculate border-radius
388
- if ( $atts['radius'] == 'auto' ) $radius = round( $atts['size'] + 2 ) . 'px';
389
- elseif ( $atts['radius'] == 'round' ) $radius = round( ( ( $atts['size'] * 2 ) + 2 ) * 2 + $styles['size'] ) . 'px';
390
- elseif ( is_numeric( $atts['radius'] ) ) $radius = intval( $atts['radius'] ) . 'px';
391
-
392
- // CSS rules for <a> tag
393
- $a_rules = array(
394
- 'color' => $atts['color'],
395
- 'background-color' => $atts['background'],
396
- 'border-color' => su_hex_shift( $atts['background'], 'darker', 20 ),
397
- 'border-radius' => $radius,
398
- '-moz-border-radius' => $radius,
399
- '-webkit-border-radius' => $radius
400
- );
401
-
402
- // CSS rules for <span> tag
403
- $span_rules = array(
404
- 'color' => $atts['color'],
405
- 'padding' => ( $atts['icon'] ) ? round( ( $atts['size'] ) / 2 + 4 ) . 'px ' . round( $atts['size'] * 2 + 10 ) . 'px' : '0px ' . round( $atts['size'] * 2 + 10 ) . 'px',
406
- 'font-size' => $styles['size'] . 'px',
407
- 'line-height' => ( $atts['icon'] ) ? round( $styles['size'] * 1.5 ) . 'px' : round( $styles['size'] * 2 ) . 'px',
408
- 'border-color' => su_hex_shift( $atts['background'], 'lighter', 30 ),
409
- 'border-radius' => $radius,
410
- '-moz-border-radius' => $radius,
411
- '-webkit-border-radius' => $radius,
412
- 'text-shadow' => $styles['ts_pos'] . ' 1px ' . $styles['ts_color'],
413
- '-moz-text-shadow' => $styles['ts_pos'] . ' 1px ' . $styles['ts_color'],
414
- '-webkit-text-shadow' => $styles['ts_pos'] . ' 1px ' . $styles['ts_color']
415
- );
416
-
417
- // CSS rules for <img> tag
418
- $img_rules = array(
419
- 'width' => round( $styles['size'] * 1.5 ) . 'px',
420
- 'height' => round( $styles['size'] * 1.5 ) . 'px'
421
- );
422
-
423
- // CSS rules for <small> tag
424
- $small_rules = array(
425
- 'padding-bottom' => round( ( $atts['size'] ) / 2 + 4 ) . 'px',
426
- 'color' => $atts['color']
427
- );
428
-
429
- // Create style attr value for <a> tag
430
- foreach ( $a_rules as $a_rule => $a_value ) $a_css[] = $a_rule . ':' . $a_value;
431
- // Create style attr value for <span> tag
432
- foreach ( $span_rules as $span_rule => $span_value ) $span_css[] = $span_rule . ':' . $span_value;
433
- // Create style attr value for <img> tag
434
- foreach ( $img_rules as $img_rule => $img_value ) $img_css[] = $img_rule . ':' . $img_value;
435
- // Create style attr value for <img> tag
436
- foreach ( $small_rules as $small_rule => $small_value ) $small_css[] = $small_rule . ':' . $small_value;
437
-
438
- // Prepare button classes
439
- $classes = array( 'su-button', 'su-button-style-' . $atts['style'] );
440
- // Additional classes
441
- if ( $atts['class'] ) $classes[] = $atts['class'];
442
- // Wide class
443
- if ( $atts['wide'] === 'yes' ) $classes[] = 'su-button-wide';
444
-
445
- // Prepare icon
446
- $icon = ( $atts['icon'] ) ? '<img src="' . $atts['icon'] . '" alt="' . esc_attr( $content ) . '" style="' . implode( $img_css, ';' ) . '" />' : '';
447
- // Prepare <small> with description
448
- $desc = ( $atts['desc'] ) ? '<small style="' . implode( $small_css, ';' ) . '">' . su_scattr( $atts['desc'] ) . '</small>' : '';
449
- // Wrap with div if button centered
450
- if ( $atts['center'] === 'yes' ) {
451
- $before .= '<div class="su-button-center">';
452
- $after .= '</div>';
453
- }
454
-
455
- // Replace icon marker in content,
456
- // add float-icon class to rearrange margins
457
- if ( strpos( $content, '%icon%' ) !== false ) {
458
- $content = str_replace( '%icon%', $icon, $content );
459
- $classes[] = 'su-button-float-icon';
460
- }
461
- // Button text has no icon marker, append icon to begin of the text
462
- else $content = $icon . ' ' . $content;
463
-
464
- su_query_asset( 'css', 'su-content-shortcodes' );
465
- 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;
466
- }
467
-
468
- /**
469
- * Shortcode: service
470
- *
471
- * @param array $atts Shortcode attributes
472
- * @param string $content
473
- *
474
- * @return string Output html
475
- */
476
- function su_service_shortcode( $atts, $content = null ) {
477
- $atts = shortcode_atts( array(
478
- 'title' => __( 'Service title', 'su' ),
479
- 'icon' => plugins_url( 'assets/images/service.png', SU_PLUGIN_FILE ),
480
- 'size' => 32,
481
- 'class' => ''
482
- ), $atts );
483
- su_query_asset( 'css', 'su-box-shortcodes' );
484
- 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>';
485
- }
486
-
487
- /**
488
- * Shortcode: box
489
- *
490
- * @param array $atts Shortcode attributes
491
- * @param string $content
492
- *
493
- * @return string Output html
494
- */
495
- function su_box_shortcode( $atts, $content = null ) {
496
- $atts = shortcode_atts( array(
497
- 'title' => __( 'This is box title', 'su' ),
498
- 'style' => 'default',
499
- 'box_color' => '#333333',
500
- 'title_color' => '#FFFFFF',
501
- 'color' => null, // 3.x
502
- 'radius' => '3',
503
- 'class' => ''
504
- ), $atts );
505
- if ( $atts['color'] !== null ) $atts['box_color'] = $atts['color'];
506
- // Prepare border-radius
507
- $radius = ( $atts['radius'] != '0' ) ?
508
- 'border-radius:' . $atts['radius'] . 'px;-moz-border-radius:' . $atts['radius'] .
509
- 'px;-webkit-border-radius:' . $atts['radius'] . 'px;' : '';
510
- $title_radius = ( $atts['radius'] != '0' ) ? $atts['radius'] - 1 : '';
511
- $title_radius = ( $title_radius ) ?
512
- '-webkit-border-top-left-radius:' . $title_radius . 'px;-webkit-border-top-right-radius:' . $title_radius .
513
- 'px;-moz-border-radius-topleft:' . $title_radius . 'px;-moz-border-radius-topright:' . $title_radius .
514
- 'px;border-top-left-radius:' . $title_radius . 'px;border-top-right-radius:' . $title_radius . 'px;' : '';
515
- su_query_asset( 'css', 'su-box-shortcodes' );
516
- // Return result
517
- return
518
- '<div class="su-box su-box-style-' . $atts['style'] . su_ecssc( $atts ) . '" style="border-color:' .
519
- su_hex_shift( $atts['box_color'], 'darker', 20 ) . ';' . $radius .
520
- '"><div class="su-box-title" style="background-color:' . $atts['box_color'] . ';color:' .
521
- $atts['title_color'] . ';' . $title_radius . '">' . su_scattr( $atts['title'] ) . '</div><div class="su-box-content">' .
522
- su_do_shortcode( $content, 'b' ) . '</div></div>';
523
- }
524
-
525
- /**
526
- * Shortcode: note
527
- *
528
- * @param array $atts Shortcode attributes
529
- * @param string $content
530
- *
531
- * @return string Output html
532
- */
533
- function su_note_shortcode( $atts, $content = null ) {
534
- $atts = shortcode_atts( array(
535
- 'note_color' => '#FFFF66',
536
- 'text_color' => '#333333',
537
- 'background' => null, // 3.x
538
- 'color' => null, // 3.x
539
- 'radius' => '3',
540
- 'class' => ''
541
- ), $atts );
542
- if ( $atts['color'] !== null ) $atts['note_color'] = $atts['color'];
543
- if ( $atts['background'] !== null ) $atts['note_color'] = $atts['background'];
544
- // Prepare border-radius
545
- $radius = ( $atts['radius'] != '0' ) ? 'border-radius:' . $atts['radius'] . 'px;-moz-border-radius:' . $atts['radius'] . 'px;-webkit-border-radius:' . $atts['radius'] . 'px;' : '';
546
- su_query_asset( 'css', 'su-box-shortcodes' );
547
- 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>';
548
- }
549
-
550
- /**
551
- * Shortcode: lightbox
552
- *
553
- * @param array $atts Shortcode attributes
554
- * @param string $content
555
- *
556
- * @return string Output html
557
- */
558
- function su_lightbox_shortcode( $atts, $content = null ) {
559
- $atts = shortcode_atts( array(
560
- 'src' => 'http://www.youtube.com/watch?v=NbE8INOjTKM',
561
- 'type' => 'iframe',
562
- 'class' => ''
563
- ), $atts );
564
- su_query_asset( 'css', 'magnific-popup' );
565
- su_query_asset( 'js', 'jquery' );
566
- su_query_asset( 'js', 'magnific-popup' );
567
- su_query_asset( 'js', 'su-other-shortcodes' );
568
- return '<span class="su-lightbox' . su_ecssc( $atts ) . '" data-mfp-src="' . su_scattr( $atts['src'] ) . '" data-mfp-type="' . $atts['type'] . '">' . do_shortcode( $content ) . '</span>';
569
- }
570
-
571
- /**
572
- * Shortcode: tooltip
573
- *
574
- * @param array $atts Shortcode attributes
575
- * @param string $content
576
- *
577
- * @return string Output html
578
- */
579
- function su_tooltip_shortcode( $atts, $content = null ) {
580
- $atts = shortcode_atts( array(
581
- 'style' => 'yellow',
582
- 'position' => 'north',
583
- 'shadow' => 'no',
584
- 'rounded' => 'no',
585
- 'size' => 'default',
586
- 'title' => '',
587
- 'content' => __( 'Tooltip text', 'su' ),
588
- 'behavior' => 'hover',
589
- 'close' => 'no',
590
- 'class' => ''
591
- ), $atts );
592
- // Prepare style
593
- $atts['style'] = ( in_array( $atts['style'], array( 'light', 'dark', 'green', 'red', 'blue', 'youtube', 'tipsy', 'bootstrap', 'jtools', 'tipped', 'cluetip' ) ) ) ? $atts['style'] : 'plain';
594
- // Position
595
- $atts['position'] = str_replace( array( 'top', 'right', 'bottom', 'left' ), array( 'north', 'east', 'south', 'west' ), $atts['position'] );
596
- $position = array(
597
- 'my' => str_replace( array( 'north', 'east', 'south', 'west' ), array( 'bottom center', 'center left', 'top center', 'center right' ), $atts['position'] ),
598
- 'at' => str_replace( array( 'north', 'east', 'south', 'west' ), array( 'top center', 'center right', 'bottom center', 'center left' ), $atts['position'] )
599
- );
600
- // Prepare classes
601
- $classes = array( 'su-qtip qtip-' . $atts['style'] );
602
- $classes[] = 'su-qtip-size-' . $atts['size'];
603
- if ( $atts['shadow'] === 'yes' ) $classes[] = 'qtip-shadow';
604
- if ( $atts['rounded'] === 'yes' ) $classes[] = 'qtip-rounded';
605
- // Query assets
606
- su_query_asset( 'css', 'qtip' );
607
- su_query_asset( 'css', 'su-other-shortcodes' );
608
- su_query_asset( 'js', 'jquery' );
609
- su_query_asset( 'js', 'qtip' );
610
- su_query_asset( 'js', 'su-other-shortcodes' );
611
- 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>';
612
- }
613
-
614
- function su_ttc_shortcode( $atts = null, $content = null ) {
615
- return '<span class="su-tooltip-content">' . do_shortcode( $content ) . '</span>';
616
- }
617
-
618
- add_shortcode( 'ttc', 'su_ttc_shortcode' );
619
- add_shortcode( 'tooltip_content', 'su_ttc_shortcode' );
620
-
621
- /**
622
- * Shortcode: private
623
- *
624
- * @param array $atts Shortcode attributes
625
- * @param string $content
626
- *
627
- * @return string Output html
628
- */
629
- function su_private_shortcode( $atts = null, $content = null ) {
630
- $atts = shortcode_atts( array( 'class' => '' ), $atts );
631
- su_query_asset( 'css', 'su-other-shortcodes' );
632
- return ( current_user_can( 'publish_posts' ) ) ? '<div class="su-private' . su_ecssc( $atts ) . '"><div class="su-private-shell">' . do_shortcode( $content ) . '</div></div>' : '';
633
- }
634
-
635
- /**
636
- * Shortcode: media
637
- *
638
- * This is shortcode from version 3.x and it not visible in generator
639
- *
640
- * @param array $atts Shortcode attributes
641
- * @param string $content
642
- *
643
- * @return string Output html
644
- */
645
- function su_media_shortcode( $atts, $content = null ) {
646
- // Check YouTube video
647
- if ( strpos( $atts['url'], 'youtu' ) !== false ) return su_youtube_shortcode( $atts );
648
- // Check Vimeo video
649
- elseif ( strpos( $atts['url'], 'vimeo' ) !== false ) return su_vimeo_shortcode( $atts );
650
- // Image
651
- else return '<img src="' . $atts['url'] . '" width="' . $atts['width'] . '" height="' . $atts['height'] . '" style="max-width:100%" />';
652
- }
653
-
654
- /**
655
- * Shortcode: youtube
656
- *
657
- * @param array $atts Shortcode attributes
658
- * @param string $content
659
- *
660
- * @return string Output html
661
- */
662
- function su_youtube_shortcode( $atts, $content = null ) {
663
- // Prepare data
664
- $return = array();
665
- $atts = shortcode_atts( array(
666
- 'url' => 'http://www.youtube.com/watch?v=NbE8INOjTKM',
667
- 'width' => 600,
668
- 'height' => 400,
669
- 'autoplay' => 'no',
670
- 'responsive' => 'yes',
671
- 'class' => ''
672
- ), $atts );
673
- $atts['url'] = su_scattr( $atts['url'] );
674
- $id = ( preg_match( '%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $atts['url'], $match ) ) ? $match[1] : false;
675
- // Check that url is specified
676
- if ( !$id ) return '<p class="su-error">YouTube: ' . __( 'please specify correct url', 'su' ) . '</p>';
677
- // Prepare autoplay
678
- $autoplay = ( $atts['autoplay'] === 'yes' ) ? '?autoplay=1' : '';
679
- // Create player
680
- $return[] = '<div class="su-youtube su-responsive-media-' . $atts['responsive'] . su_ecssc( $atts ) . '">';
681
- $return[] = '<iframe width="' . $atts['width'] . '" height="' . $atts['height'] . '" src="http://www.youtube.com/embed/' . $id . $autoplay . '" frameborder="0" allowfullscreen="true"></iframe>';
682
- $return[] = '</div>';
683
- su_query_asset( 'css', 'su-media-shortcodes' );
684
- // Return result
685
- return implode( '', $return );
686
- }
687
-
688
- /**
689
- * Shortcode: vimeo
690
- *
691
- * @param array $atts Shortcode attributes
692
- * @param string $content
693
- *
694
- * @return string Output html
695
- */
696
- function su_vimeo_shortcode( $atts, $content = null ) {
697
- // Prepare data
698
- $return = array();
699
- $atts = shortcode_atts( array(
700
- 'url' => 'http://vimeo.com/21294655',
701
- 'width' => 600,
702
- 'height' => 400,
703
- 'autoplay' => 'no',
704
- 'responsive' => 'yes',
705
- 'class' => ''
706
- ), $atts );
707
- $atts['url'] = su_scattr( $atts['url'] );
708
- $id = ( preg_match( '~(?:<iframe [^>]*src=")?(?:https?:\/\/(?:[\w]+\.)*vimeo\.com(?:[\/\w]*\/videos?)?\/([0-9]+)[^\s]*)"?(?:[^>]*></iframe>)?(?:<p>.*</p>)?~ix', $atts['url'], $match ) ) ? $match[1] : false;
709
- // Check that url is specified
710
- if ( !$id ) return '<p class="su-error">Vimeo: ' . __( 'please specify correct url', 'su' ) . '</p>';
711
- // Prepare autoplay
712
- $autoplay = ( $atts['autoplay'] === 'yes' ) ? '&amp;autoplay=1' : '';
713
- // Create player
714
- $return[] = '<div class="su-vimeo su-responsive-media-' . $atts['responsive'] . su_ecssc( $atts ) . '">';
715
- $return[] = '<iframe width="' . $atts['width'] . '" height="' . $atts['height'] .
716
- '" src="http://player.vimeo.com/video/' . $id . '?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff' .
717
- $autoplay . '" frameborder="0" allowfullscreen="true"></iframe>';
718
- $return[] = '</div>';
719
- su_query_asset( 'css', 'su-media-shortcodes' );
720
- // Return result
721
- return implode( '', $return );
722
- }
723
-
724
- /**
725
- * Shortcode: screenr
726
- *
727
- * @param array $atts Shortcode attributes
728
- * @param string $content
729
- *
730
- * @return string Output html
731
- */
732
- function su_screenr_shortcode( $atts, $content = null ) {
733
- // Prepare data
734
- $return = array();
735
- $atts = shortcode_atts( array(
736
- 'url' => 'http://www.screenr.com/OuWH',
737
- 'width' => 600,
738
- 'height' => 400,
739
- 'responsive' => 'yes',
740
- 'class' => ''
741
- ), $atts );
742
- $atts['url'] = su_scattr( $atts['url'] );
743
- $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;
744
- // Check that url is specified
745
- if ( !$id ) return '<p class="su-error">Screenr: ' . __( 'please specify correct url', 'su' ) . '</p>';
746
- // Create player
747
- $return[] = '<div class="su-screenr su-responsive-media-' . $atts['responsive'] . su_ecssc( $atts ) . '">';
748
- $return[] = '<iframe width="' . $atts['width'] . '" height="' . $atts['height'] .
749
- '" src="http://screenr.com/embed/' . $id . '" frameborder="0" allowfullscreen="true"></iframe>';
750
- $return[] = '</div>';
751
- su_query_asset( 'css', 'su-media-shortcodes' );
752
- // Return result
753
- return implode( '', $return );
754
- }
755
-
756
- /**
757
- * Shortcode: audio
758
- *
759
- * @param array $atts Shortcode attributes
760
- * @param string $content
761
- *
762
- * @return string Output html
763
- */
764
- function su_audio_shortcode( $atts, $content = null ) {
765
- $atts = shortcode_atts( array(
766
- 'url' => 'http://www.jplayer.org/audio/mp3/TSP-01-Cro_magnon_man.mp3',
767
- 'width' => 'auto',
768
- 'title' => '',
769
- 'autoplay' => 'no',
770
- 'loop' => 'no',
771
- 'class' => ''
772
- ), $atts );
773
- $atts['url'] = su_scattr( $atts['url'] );
774
- // Generate unique ID
775
- $id = uniqid( 'su_audio_player_' );
776
- // Prepare width
777
- $width = ( $atts['width'] !== 'auto' ) ? 'max-width:' . $atts['width'] : '';
778
- // Check that url is specified
779
- if ( !$atts['url'] ) return '<p class="su-error">Audio: ' . __( 'please specify correct url', 'su' ) . '</p>';
780
- su_query_asset( 'css', 'su-players-shortcodes' );
781
- su_query_asset( 'js', 'jquery' );
782
- su_query_asset( 'js', 'jplayer' );
783
- su_query_asset( 'js', 'su-players-shortcodes' );
784
- su_query_asset( 'js', 'su-players-shortcodes' );
785
- // Create player
786
- 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>';
787
- }
788
-
789
- /**
790
- * Shortcode: video
791
- *
792
- * @param array $atts Shortcode attributes
793
- * @param string $content
794
- *
795
- * @return string Output html
796
- */
797
- function su_video_shortcode( $atts, $content = null ) {
798
- $atts = shortcode_atts( array(
799
- 'url' => 'http://www.jplayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v',
800
- 'poster' => 'http://www.jplayer.org/video/poster/Big_Buck_Bunny_Trailer_480x270.png',
801
- 'title' => '',
802
- 'width' => 600,
803
- 'height' => 300,
804
- 'controls' => 'yes',
805
- 'autoplay' => 'no',
806
- 'loop' => 'no',
807
- 'class' => ''
808
- ), $atts );
809
- $atts['url'] = su_scattr( $atts['url'] );
810
- // Generate unique ID
811
- $id = uniqid( 'su_video_player_' );
812
- // Check that url is specified
813
- if ( !$atts['url'] ) return '<p class="su-error">Video: ' . __( 'please specify correct url', 'su' ) . '</p>';
814
- // Prepare title
815
- $title = ( $atts['title'] ) ? '<div class="jp-title">' . $atts['title'] . '</div>' : '';
816
- su_query_asset( 'css', 'su-players-shortcodes' );
817
- su_query_asset( 'js', 'jquery' );
818
- su_query_asset( 'js', 'jplayer' );
819
- su_query_asset( 'js', 'su-players-shortcodes' );
820
- // Create player
821
- 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>';
822
- }
823
-
824
- /**
825
- * Shortcode: table
826
- *
827
- * @param array $atts Shortcode attributes
828
- * @param string $content
829
- *
830
- * @return string Output html
831
- */
832
- function su_table_shortcode( $atts, $content = null ) {
833
- $atts = shortcode_atts( array(
834
- 'url' => false,
835
- 'class' => ''
836
- ), $atts );
837
- $return = '<div class="su-table' . su_ecssc( $atts ) . '">';
838
- $return .= ( $atts['url'] ) ? su_parse_csv( $atts['url'] ) : do_shortcode( $content );
839
- $return .= '</div>';
840
- su_query_asset( 'css', 'su-content-shortcodes' );
841
- su_query_asset( 'js', 'jquery' );
842
- su_query_asset( 'js', 'su-other-shortcodes' );
843
- return $return;
844
- }
845
-
846
- /**
847
- * Shortcode: permalink
848
- *
849
- * @param unknown $atts
850
- * @param string $content
851
- *
852
- * @return string Output html
853
- */
854
- function su_permalink_shortcode( $atts, $content = null ) {
855
- $atts = shortcode_atts( array(
856
- 'id' => 1,
857
- 'p' => null, // 3.x
858
- 'target' => 'self',
859
- 'class' => ''
860
- ), $atts );
861
- if ( $atts['p'] !== null ) $atts['id'] = $atts['p'];
862
- $atts['id'] = su_scattr( $atts['id'] );
863
- // Prepare link text
864
- $text = ( $content ) ? $content : get_the_title( $atts['id'] );
865
- return '<a href="' . get_permalink( $atts['id'] ) . '" class="' . su_ecssc( $atts ) . '" title="' . $text . '" target="_' . $atts['target'] . '">' . $text . '</a>';
866
- }
867
-
868
- /**
869
- * Shortcode: members
870
- *
871
- * @param array $atts Shortcode attributes
872
- * @param string $content
873
- *
874
- * @return string Output html
875
- */
876
- function su_members_shortcode( $atts, $content = null ) {
877
- $atts = shortcode_atts( array(
878
- 'message' => __( 'This content is for registered users only. Please %login%.', 'su' ),
879
- 'color' => '#ffcc00',
880
- 'style' => null, // 3.x
881
- 'login_text' => __( 'login', 'su' ),
882
- 'login_url' => wp_login_url(),
883
- 'login' => null, // 3.x
884
- 'class' => ''
885
- ), $atts );
886
- if ( $atts['style'] !== null ) $atts['color'] = str_replace( array( '0', '1', '2' ), array( '#fff', '#FFFF29', '#1F9AFF' ), $atts['style'] );
887
- // Check feed
888
- if ( is_feed() ) return;
889
- // Check authorization
890
- if ( !is_user_logged_in() ) {
891
- if ( $atts['login'] !== null && $atts['login'] == '0' ) return; // 3.x
892
- // Prepare login link
893
- $login = '<a href="' . esc_attr( $atts['login_url'] ) . '">' . $atts['login_text'] . '</a>';
894
- su_query_asset( 'css', 'su-other-shortcodes' );
895
- 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>';
896
- }
897
- // Return original content
898
- else return do_shortcode( $content );
899
- }
900
-
901
- /**
902
- * Shortcode: guests
903
- *
904
- * @param null $atts
905
- * @param string $content
906
- *
907
- * @return string Output html
908
- */
909
- function su_guests_shortcode( $atts = null, $content = null ) {
910
- $atts = shortcode_atts( array( 'class' => '' ), $atts );
911
- $return = '';
912
- if ( !is_user_logged_in() && !is_null( $content ) ) {
913
- su_query_asset( 'css', 'su-other-shortcodes' );
914
- $return = '<div class="su-guests' . su_ecssc( $atts ) . '">' . do_shortcode( $content ) . '</div>';
915
- }
916
- return $return;
917
- }
918
-
919
- /**
920
- * Shortcode: feed
921
- *
922
- * @param array $atts Shortcode attributes
923
- * @param string $content
924
- *
925
- * @return string Output html
926
- */
927
- function su_feed_shortcode( $atts, $content = null ) {
928
- $atts = shortcode_atts( array(
929
- 'url' => get_bloginfo_rss( 'rss2_url' ),
930
- 'limit' => 3,
931
- 'class' => ''
932
- ), $atts );
933
- if ( !function_exists( 'wp_rss' ) ) include_once ABSPATH . WPINC . '/rss.php';
934
- ob_start();
935
- echo '<div class="su-feed' . su_ecssc( $atts ) . '">';
936
- wp_rss( $atts['url'], $atts['limit'] );
937
- echo '</div>';
938
- $return = ob_get_contents();
939
- ob_end_clean();
940
- return $return;
941
- }
942
-
943
- /**
944
- * Shortcode: subpages
945
- *
946
- * @param unknown $atts
947
- * @param string $content
948
- *
949
- * @return string Output html
950
- */
951
- function su_subpages_shortcode( $atts, $content = null ) {
952
- $atts = shortcode_atts( array(
953
- 'depth' => 1,
954
- 'p' => false,
955
- 'class' => ''
956
- ), $atts );
957
- global $post;
958
- $child_of = ( $atts['p'] ) ? $atts['p'] : get_the_ID();
959
- $return = wp_list_pages( array(
960
- 'title_li' => '',
961
- 'echo' => 0,
962
- 'child_of' => $child_of,
963
- 'depth' => $atts['depth']
964
- ) );
965
- return ( $return ) ? '<ul class="su-subpages' . su_ecssc( $atts ) . '">' . $return . '</ul>' : false;
966
- }
967
-
968
- /**
969
- * Shortcode: siblings pages
970
- *
971
- * @param unknown $atts
972
- * @param string $content
973
- *
974
- * @return string Output html
975
- */
976
- function su_siblings_shortcode( $atts, $content = null ) {
977
- $atts = shortcode_atts( array( 'depth' => 1, 'class' => '' ), $atts );
978
- global $post;
979
- $return = wp_list_pages( array( 'title_li' => '',
980
- 'echo' => 0,
981
- 'child_of' => $post->post_parent,
982
- 'depth' => $atts['depth'],
983
- 'exclude' => $post->ID ) );
984
- return ( $return ) ? '<ul class="su-siblings' . su_ecssc( $atts ) . '">' . $return . '</ul>' : false;
985
- }
986
-
987
- /**
988
- * Shortcode: menu
989
- *
990
- * @param unknown $atts
991
- * @param string $content
992
- *
993
- * @return string Output html
994
- */
995
- function su_menu_shortcode( $atts, $content = null ) {
996
- $atts = shortcode_atts( array( 'name' => false, 'class' => '' ), $atts );
997
- $return = wp_nav_menu( array( 'echo' => false,
998
- 'menu' => $atts['name'],
999
- 'container' => false,
1000
- 'fallback_cb' => 'su_menu_shortcode_fb_cb',
1001
- 'class' => $atts['class'] ) );
1002
- return ( $atts['name'] ) ? $return : false;
1003
- }
1004
-
1005
- /**
1006
- * Fallback callback function for menu shortcode
1007
- *
1008
- * @return string Text message
1009
- */
1010
- function su_menu_shortcode_fb_cb() {
1011
- return __( 'This menu doesn\'t exists, or has no elements', 'su' );
1012
- }
1013
-
1014
- /**
1015
- * Shortcode: document
1016
- *
1017
- * @param array $atts Shortcode attributes
1018
- * @param string $content
1019
- *
1020
- * @return string Output html
1021
- */
1022
- function su_document_shortcode( $atts, $content = null ) {
1023
- $atts = shortcode_atts( array(
1024
- 'url' => '',
1025
- 'file' => null, // 3.x
1026
- 'width' => 600,
1027
- 'height' => 400,
1028
- 'responsive' => 'yes',
1029
- 'class' => ''
1030
- ), $atts );
1031
- if ( $atts['file'] !== null ) $atts['url'] = $atts['file'];
1032
- su_query_asset( 'css', 'su-media-shortcodes' );
1033
- 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>';
1034
- }
1035
-
1036
- /**
1037
- * Shortcode: gmap
1038
- *
1039
- * @param array $atts Shortcode attributes
1040
- * @param string $content
1041
- *
1042
- * @return string Output html
1043
- */
1044
- function su_gmap_shortcode( $atts, $content = null ) {
1045
- $atts = shortcode_atts( array(
1046
- 'width' => 600,
1047
- 'height' => 400,
1048
- 'responsive' => 'yes',
1049
- 'address' => 'New York',
1050
- 'class' => ''
1051
- ), $atts );
1052
- su_query_asset( 'css', 'su-media-shortcodes' );
1053
- 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>';
1054
- }
1055
-
1056
- /**
1057
- * Shortcode: slider
1058
- *
1059
- * @param array $atts Shortcode attributes
1060
- * @param string $content
1061
- *
1062
- * @return string Output html
1063
- */
1064
- function su_slider_shortcode( $atts, $content = null ) {
1065
- // Prepare vars
1066
- $shult = shortcodes_ultimate();
1067
- $return = '';
1068
- $atts = shortcode_atts( array(
1069
- 'gallery' => 1,
1070
- 'width' => 600,
1071
- 'height' => 300,
1072
- 'responsive' => 'yes',
1073
- 'title' => 'yes',
1074
- 'centered' => 'yes',
1075
- 'arrows' => 'yes',
1076
- 'pages' => 'yes',
1077
- 'mousewheel' => 'yes',
1078
- 'autoplay' => 3000,
1079
- 'speed' => 600,
1080
- 'target' => 'yes',
1081
- 'class' => ''
1082
- ), $atts );
1083
- // Prepare unique ID
1084
- $id = uniqid( 'su_slider_' );
1085
- // Links target
1086
- $target = ( $atts['target'] === 'yes' ) ? ' target="_blank"' : '';
1087
- // Centered class
1088
- $centered = ( $atts['centered'] === 'yes' ) ? ' su-slider-centered' : '';
1089
- // Wheel control
1090
- $mousewheel = ( $atts['mousewheel'] === 'yes' ) ? 'true' : 'false';
1091
- // Prepare gallery
1092
- $galleries = $shult->get_option( 'galleries' );
1093
- $gallery = ( is_numeric( $atts['gallery'] ) && $atts['gallery'] > 0 ) ? $galleries[$atts['gallery'] - 1] : 1;
1094
- // Prepare slides
1095
- $slides = ( count( ( array ) $gallery['items'] ) ) ? $gallery['items'] : array();
1096
- // Prepare width and height
1097
- $size = ( $atts['responsive'] === 'yes' ) ? 'width:100%' : 'width:' . intval( $atts['width'] ) . 'px;height:' . intval( $atts['height'] ) . 'px';
1098
- // Slides not found
1099
- if ( !count( $slides ) || !is_array( $slides ) ) $return = '<p class="su-error">Slider: ' . __( 'images not found', 'su' ) . '</p>';
1100
- // Slides are found
1101
- else {
1102
- // Open slider
1103
- $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">';
1104
- // Create slides
1105
- foreach ( (array) $slides as $slide ) {
1106
- // Crop the image
1107
- $image = su_image_resize( $slide['image'], $atts['width'], $atts['height'] );
1108
- // Prepare slide title
1109
- $title = ( $atts['title'] === 'yes' && $slide['title'] ) ? '<span class="su-slider-slide-title">' . stripslashes( $slide['title'] ) . '</span>' : '';
1110
- // Open slide
1111
- $return .= '<div class="su-slider-slide">';
1112
- // Slide content with link
1113
- if ( $slide['link'] ) $return .= '<a href="' . $slide['link'] . '"' . $target . '><img src="' . $image['url'] . '" alt="' . esc_attr( $slide['title'] ) . '" />' . $title . '</a>';
1114
- // Slide content without link
1115
- else $return .= '<a><img src="' . $slide['image'] . '" alt="' . esc_attr( $slide['title'] ) . '" />' . $title . '</a>';
1116
- // Close slide
1117
- $return .= '</div>';
1118
- }
1119
- // Close slides
1120
- $return .= '</div>';
1121
- // Open nav section
1122
- $return .= '<div class="su-slider-nav">';
1123
- // Append direction nav
1124
- if ( $atts['arrows'] === 'yes'
1125
- ) $return .= '<div class="su-slider-direction"><span class="su-slider-prev"></span><span class="su-slider-next"></span></div>';
1126
- // Append pagination nav
1127
- $return .= '<div class="su-slider-pagination"></div>';
1128
- // Close nav section
1129
- $return .= '</div>';
1130
- // Close slider
1131
- $return .= '</div>';
1132
- }
1133
- su_query_asset( 'css', 'su-galleries-shortcodes' );
1134
- su_query_asset( 'js', 'jquery' );
1135
- su_query_asset( 'js', 'swiper' );
1136
- su_query_asset( 'js', 'su-galleries-shortcodes' );
1137
- return $return;
1138
- }
1139
-
1140
- /**
1141
- * Shortcode: carousel
1142
- *
1143
- * @param array $atts Shortcode attributes
1144
- * @param string $content
1145
- *
1146
- * @return string Output html
1147
- */
1148
- function su_carousel_shortcode( $atts, $content = null ) {
1149
- // Prepare vars
1150
- $shult = shortcodes_ultimate();
1151
- $return = '';
1152
- $atts = shortcode_atts( array(
1153
- 'gallery' => 1,
1154
- 'width' => 600,
1155
- 'height' => 100,
1156
- 'responsive' => 'yes',
1157
- 'items' => 3,
1158
- 'scroll' => 1,
1159
- 'title' => 'yes',
1160
- 'centered' => 'yes',
1161
- 'arrows' => 'yes',
1162
- 'pages' => 'no',
1163
- 'mousewheel' => 'yes',
1164
- 'autoplay' => 3000,
1165
- 'speed' => 600,
1166
- 'target' => 'yes',
1167
- 'class' => ''
1168
- ), $atts );
1169
- // Prepare unique ID
1170
- $id = uniqid( 'su_carousel_' );
1171
- // Links target
1172
- $target = ( $atts['target'] === 'yes' ) ? ' target="_blank"' : '';
1173
- // Centered class
1174
- $centered = ( $atts['centered'] === 'yes' ) ? ' su-carousel-centered' : '';
1175
- // Wheel control
1176
- $mousewheel = ( $atts['mousewheel'] === 'yes' ) ? 'true' : 'false';
1177
- // Prepare gallery
1178
- $galleries = $shult->get_option( 'galleries' );
1179
- $gallery = ( is_numeric( $atts['gallery'] ) && $atts['gallery'] > 0 ) ? $galleries[$atts['gallery'] - 1] : 1;
1180
- // Prepare slides
1181
- $slides = ( count( ( array ) $gallery['items'] ) ) ? $gallery['items'] : array();
1182
- // Prepare width and height
1183
- $size = ( $atts['responsive'] === 'yes' ) ? 'width:100%' : 'width:' . intval( $atts['width'] ) . 'px;height:' . intval( $atts['height'] ) . 'px';
1184
- // Slides not found
1185
- if ( !count( $slides ) || !is_array( $slides ) ) $return = '<p class="su-error">Carousel: ' . __( 'images not found', 'su' ) . '</p>';
1186
- // Slides are found
1187
- else {
1188
- // Open slider
1189
- $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">';
1190
- // Create slides
1191
- foreach ( (array) $slides as $slide ) {
1192
- // Crop the image
1193
- $image = su_image_resize( $slide['image'], round( $atts['width'] / $atts['items'] ), $atts['height'] );
1194
- // Prepare slide title
1195
- $title = ( $atts['title'] === 'yes' && $slide['title'] ) ? '<span class="su-carousel-slide-title">' . stripslashes( $slide['title'] ) . '</span>' : '';
1196
- // Open slide
1197
- $return .= '<div class="su-carousel-slide">';
1198
- // Slide content with link
1199
- if ( $slide['link'] ) $return .= '<a href="' . $slide['link'] . '"' . $target . '><img src="' . $image['url'] . '" alt="' . esc_attr( $slide['title'] ) . '" />' . $title . '</a>';
1200
- // Slide content without link
1201
- else $return .= '<a><img src="' . $slide['image'] . '" alt="' . esc_attr( $slide['title'] ) . '" />' . $title . '</a>';
1202
- // Close slide
1203
- $return .= '</div>';
1204
- }
1205
- // Close slides
1206
- $return .= '</div>';
1207
- // Open nav section
1208
- $return .= '<div class="su-carousel-nav">';
1209
- // Append direction nav
1210
- if ( $atts['arrows'] === 'yes'
1211
- ) $return .= '<div class="su-carousel-direction"><span class="su-carousel-prev"></span><span class="su-carousel-next"></span></div>';
1212
- // Append pagination nav
1213
- $return .= '<div class="su-carousel-pagination"></div>';
1214
- // Close nav section
1215
- $return .= '</div>';
1216
- // Close slider
1217
- $return .= '</div>';
1218
- }
1219
- su_query_asset( 'css', 'su-galleries-shortcodes' );
1220
- su_query_asset( 'js', 'jquery' );
1221
- su_query_asset( 'js', 'swiper' );
1222
- su_query_asset( 'js', 'su-galleries-shortcodes' );
1223
- return $return;
1224
- }
1225
-
1226
- /**
1227
- * Shortcode: custom_gallery
1228
- *
1229
- * @param array $atts Shortcode attributes
1230
- * @param string $content
1231
- *
1232
- * @return string Output html
1233
- */
1234
- function su_custom_gallery_shortcode( $atts, $content = null ) {
1235
- // Prepare vars
1236
- $shult = shortcodes_ultimate();
1237
- $return = '';
1238
- $atts = shortcode_atts( array(
1239
- 'gallery' => 1,
1240
- 'width' => 90,
1241
- 'height' => 90,
1242
- 'title' => 'hover',
1243
- 'target' => 'yes',
1244
- 'class' => ''
1245
- ), $atts );
1246
- // Links target
1247
- $target = ( $atts['target'] === 'yes' ) ? ' target="_blank"' : '';
1248
- // Prepare gallery
1249
- $galleries = $shult->get_option( 'galleries' );
1250
- $gallery = ( is_numeric( $atts['gallery'] ) && $atts['gallery'] > 0 ) ? $galleries[$atts['gallery'] - 1] : 1;
1251
- // Prepare slides
1252
- $slides = ( count( ( array ) $gallery['items'] ) ) ? $gallery['items'] : array();
1253
- // Slides not found
1254
- if ( !count( $slides ) || !is_array( $slides ) ) $return = '<p class="su-error">Custom gallery: ' . __( 'images not found', 'su' ) . '</p>';
1255
- // Slides are found
1256
- else {
1257
- // Open gallery
1258
- $return .= '<div class="su-custom-gallery su-custom-gallery-title-' . $atts['title'] . su_ecssc( $atts ) . '">';
1259
- // Create slides
1260
- foreach ( (array) $slides as $slide ) {
1261
- // Crop image
1262
- $image = su_image_resize( $slide['image'], $atts['width'], $atts['height'] );
1263
- // Prepare slide title
1264
- $title = ( $slide['title'] ) ? '<span class="su-custom-gallery-title">' . stripslashes( $slide['title'] ) . '</span>' : '';
1265
- // Open slide
1266
- $return .= '<div class="su-custom-gallery-slide">';
1267
- // Slide content with link
1268
- 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>';
1269
- // Slide content without link
1270
- else $return .= '<a><img src="' . $slide['image'] . '" alt="' . esc_attr( $slide['title'] ) . '" width="' . $atts['width'] . '" height="' . $atts['height'] . '" />' . $title . '</a>';
1271
- // Close slide
1272
- $return .= '</div>';
1273
- }
1274
- // Clear floats
1275
- $return .= '<div class="su-clear"></div>';
1276
- // Close gallery
1277
- $return .= '</div>';
1278
- }
1279
- su_query_asset( 'css', 'su-galleries-shortcodes' );
1280
- return $return;
1281
- }
1282
-
1283
- /**
1284
- * Shortcode: posts
1285
- *
1286
- * Based on plugin by Bill Erickson <http://www.billerickson.net/shortcode-to-display-posts/>
1287
- *
1288
- * @param array $atts Shortcode attributes
1289
- * @param string $content
1290
- *
1291
- * @return string Output html
1292
- */
1293
- function su_posts_shortcode( $atts, $content = null ) {
1294
- // Prepare error var
1295
- $error = null;
1296
- // Parse attributes
1297
- $atts = shortcode_atts( array(
1298
- 'template' => 'templates/default-loop.php',
1299
- 'id' => false,
1300
- 'posts_per_page' => get_option( 'posts_per_page' ),
1301
- 'post_type' => 'post',
1302
- 'taxonomy' => 'category',
1303
- 'tax_term' => false,
1304
- 'tax_operator' => 'IN',
1305
- 'author' => '',
1306
- 'meta_key' => '',
1307
- 'offset' => 0,
1308
- 'order' => 'DESC',
1309
- 'orderby' => 'date',
1310
- 'post_parent' => false,
1311
- 'post_status' => 'publish',
1312
- 'ignore_sticky_posts' => 'no'
1313
- ), $atts );
1314
-
1315
- $original_atts = $atts;
1316
-
1317
- $author = sanitize_text_field( $atts['author'] );
1318
- $id = $atts['id']; // Sanitized later as an array of integers
1319
- $ignore_sticky_posts = ( bool ) ( $atts['ignore_sticky_posts'] === 'yes' ) ? true : false;
1320
- $meta_key = sanitize_text_field( $atts['meta_key'] );
1321
- $offset = intval( $atts['offset'] );
1322
- $order = sanitize_key( $atts['order'] );
1323
- $orderby = sanitize_key( $atts['orderby'] );
1324
- $post_parent = $atts['post_parent'];
1325
- $post_status = $atts['post_status'];
1326
- $post_type = sanitize_text_field( $atts['post_type'] );
1327
- $posts_per_page = intval( $atts['posts_per_page'] );
1328
- $tag = sanitize_text_field( $atts['tag'] );
1329
- $tax_operator = $atts['tax_operator'];
1330
- $tax_term = sanitize_text_field( $atts['tax_term'] );
1331
- $taxonomy = sanitize_key( $atts['taxonomy'] );
1332
-
1333
- // Set up initial query for post
1334
- $args = array( 'category_name' => '',
1335
- 'order' => $order,
1336
- 'orderby' => $orderby,
1337
- 'post_type' => explode( ',', $post_type ),
1338
- 'posts_per_page' => $posts_per_page,
1339
- 'tag' => $tag, );
1340
-
1341
- // Ignore Sticky Posts
1342
- if ( $ignore_sticky_posts ) $args['ignore_sticky_posts'] = true;
1343
-
1344
- // Meta key (for ordering)
1345
- if ( !empty( $meta_key ) ) $args['meta_key'] = $meta_key;
1346
-
1347
- // If Post IDs
1348
- if ( $id ) {
1349
- $posts_in = array_map( 'intval', explode( ',', $id ) );
1350
- $args['post__in'] = $posts_in;
1351
- }
1352
-
1353
- // Post Author
1354
- if ( !empty( $author ) ) $args['author_name'] = $author;
1355
-
1356
- // Offset
1357
- if ( !empty( $offset ) ) $args['offset'] = $offset;
1358
-
1359
- // Post Status
1360
- $post_status = explode( ', ', $post_status );
1361
- $validated = array();
1362
- $available = array( 'publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash', 'any' );
1363
- foreach ( $post_status as $unvalidated ) {
1364
- if ( in_array( $unvalidated, $available ) ) $validated[] = $unvalidated;
1365
- }
1366
- if ( !empty( $validated ) ) $args['post_status'] = $validated;
1367
-
1368
- // If taxonomy attributes, create a taxonomy query
1369
- if ( !empty( $taxonomy ) && !empty( $tax_term ) ) {
1370
-
1371
- // Term string to array
1372
- $tax_term = explode( ',', $tax_term );
1373
-
1374
- // Validate operator
1375
- if ( !in_array( $tax_operator, array( 'IN', 'NOT IN', 'AND' ) ) ) $tax_operator = 'IN';
1376
-
1377
- $tax_args = array( 'tax_query' => array( array( 'taxonomy' => $taxonomy,
1378
- 'field' => 'slug',
1379
- 'terms' => $tax_term,
1380
- 'operator' => $tax_operator ) ) );
1381
-
1382
- // Check for multiple taxonomy queries
1383
- $count = 2;
1384
- $more_tax_queries = false;
1385
- while ( isset( $original_atts['taxonomy_' . $count] ) && !empty( $original_atts['taxonomy_' . $count] ) &&
1386
- isset( $original_atts['tax_' . $count . '_term'] ) &&
1387
- !empty( $original_atts['tax_' . $count . '_term'] ) ) {
1388
-
1389
- // Sanitize values
1390
- $more_tax_queries = true;
1391
- $taxonomy = sanitize_key( $original_atts['taxonomy_' . $count] );
1392
- $terms = explode( ', ', sanitize_text_field( $original_atts['tax_' . $count . '_term'] ) );
1393
- $tax_operator = isset( $original_atts['tax_' . $count . '_operator'] ) ? $original_atts[
1394
- 'tax_' . $count . '_operator'] : 'IN';
1395
- $tax_operator = in_array( $tax_operator, array( 'IN', 'NOT IN', 'AND' ) ) ? $tax_operator : 'IN';
1396
-
1397
- $tax_args['tax_query'][] = array( 'taxonomy' => $taxonomy,
1398
- 'field' => 'slug',
1399
- 'terms' => $terms,
1400
- 'operator' => $tax_operator );
1401
-
1402
- $count++;
1403
- }
1404
-
1405
- if ( $more_tax_queries ):
1406
- $tax_relation = 'AND';
1407
- if ( isset( $original_atts['tax_relation'] ) &&
1408
- in_array( $original_atts['tax_relation'], array( 'AND', 'OR' ) )
1409
- ) $tax_relation = $original_atts['tax_relation'];
1410
- $args['tax_query']['relation'] = $tax_relation;
1411
- endif;
1412
-
1413
- $args = array_merge( $args, $tax_args );
1414
- }
1415
-
1416
- // If post parent attribute, set up parent
1417
- if ( $post_parent ) {
1418
- if ( 'current' == $post_parent ) {
1419
- global $post;
1420
- $post_parent = $post->ID;
1421
- }
1422
- $args['post_parent'] = intval( $post_parent );
1423
- }
1424
-
1425
- // Save original posts
1426
- global $posts;
1427
- $original_posts = $posts;
1428
- // Query posts
1429
- $posts = new WP_Query( $args );
1430
- // Buffer output
1431
- ob_start();
1432
- // Search for template in stylesheet directory
1433
- if ( file_exists( STYLESHEETPATH . '/' . $atts['template'] ) ) load_template( STYLESHEETPATH . '/' . $atts['template'], false );
1434
- // Search for template in theme directory
1435
- elseif ( file_exists( TEMPLATEPATH . '/' . $atts['template'] ) ) load_template( TEMPLATEPATH . '/' . $atts['template'], false );
1436
- // Search for template in plugin directory
1437
- elseif ( path_join( dirname( SU_PLUGIN_FILE ), $atts['template'] ) ) load_template( path_join( dirname( SU_PLUGIN_FILE ), $atts['template'] ), false );
1438
- // Template not found
1439
- else echo '<p class="su-error">Posts: ' . __( 'template not found', 'su' ) . '</p>';
1440
- $output = ob_get_contents();
1441
- ob_end_clean();
1442
- // Return original posts
1443
- $posts = $original_posts;
1444
- // Reset the query
1445
- wp_reset_postdata();
1446
- su_query_asset( 'css', 'su-other-shortcodes' );
1447
- return $output;
1448
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/core/tools.php CHANGED
@@ -226,6 +226,13 @@ function su_compatibility_mode_prefix() {
226
  else return '';
227
  }
228
 
 
 
 
 
 
 
 
229
  /**
230
  * Tweet relative time (like: 5 seconds ago)
231
  */
@@ -719,6 +726,10 @@ class Shortcodes_Ultimate_Tools {
719
  public static function decode_shortcode( $value ) {
720
  return do_shortcode( str_replace( array( '{', '}' ), array( '[', ']' ), $value ) );
721
  }
 
 
 
 
722
  }
723
 
724
  /**
@@ -726,4 +737,4 @@ class Shortcodes_Ultimate_Tools {
726
  */
727
  function su_scattr( $value ) {
728
  return Shortcodes_Ultimate_Tools::decode_shortcode( $value );
729
- }
226
  else return '';
227
  }
228
 
229
+ /**
230
+ * Shortcut for su_compatibility_mode_prefix()
231
+ */
232
+ function su_cmpt() {
233
+ return su_compatibility_mode_prefix();
234
+ }
235
+
236
  /**
237
  * Tweet relative time (like: 5 seconds ago)
238
  */
726
  public static function decode_shortcode( $value ) {
727
  return do_shortcode( str_replace( array( '{', '}' ), array( '[', ']' ), $value ) );
728
  }
729
+
730
+ public static function icon( $src = 'icon-file' ) {
731
+ return ( strpos( $src, '/' ) !== false ) ? '<img src="' . $src . '" alt="" />' : '<i class="' . $src . '"></i>';
732
+ }
733
  }
734
 
735
  /**
737
  */
738
  function su_scattr( $value ) {
739
  return Shortcodes_Ultimate_Tools::decode_shortcode( $value );
740
+ }
inc/vendor/class.sunrise-framework.php CHANGED
@@ -154,7 +154,8 @@ if ( !class_exists( 'Sunrise_Plugin_Framework_2_1' ) ) {
154
  // Get options from database
155
  $options = get_option( $this->option );
156
  // Check option is specified
157
- $value = ( !empty( $option ) && isset( $options[$option] ) ) ? $options[$option] : $options;
 
158
  // Return result
159
  return ( is_array( $value ) ) ? array_filter( $value, 'esc_attr' ) : esc_attr( stripslashes( $value ) );
160
  }
154
  // Get options from database
155
  $options = get_option( $this->option );
156
  // Check option is specified
157
+ $value = ( isset( $option ) && $option && isset( $options[$option] ) ) ? $options[$option] : null;
158
+ if ( $option === false ) $value = $options;
159
  // Return result
160
  return ( is_array( $value ) ) ? array_filter( $value, 'esc_attr' ) : esc_attr( stripslashes( $value ) );
161
  }
readme.txt CHANGED
@@ -95,54 +95,40 @@ Upgrade normally via your Wordpress admin -> Plugins panel.
95
 
96
  == Changelog ==
97
 
98
- = 4.1.9 =
 
 
99
  * Removed warning at settings page - [forum topic](http://wordpress.org/support/topic/warning-on-settings-page)
100
  * Removed another warning (undefined index) - [forum topic](http://wordpress.org/support/topic/undefined-index-with-wp_debug-true)
101
  * Changed syntax for shortcodes inside of attributes - [documentation](http://gndev.info/kb/how-to-use-another-shortcodes-inside-of-attributes/)
102
  * Small performance improvemets
103
  * Aded font-awesome.css. Will be completely included in closest versions
104
-
105
- = 4.1.8 =
106
  * Added default taxonomy value for [posts]
107
  * Added default post_type value for [posts]
108
  * Added ability to use shortcodes inside of attributes
109
  * Translated into Japanese
110
-
111
- = 4.1.7 =
112
  * Fixed [button wide=yes]
113
  * Fixed media query for [column]
114
  * Added new attr [column center=yes]
115
  * Improved js code for spoilers and tabs
116
  * Improved js code for generator
117
-
118
- = 4.1.6 =
119
  * Added pot file
120
  * Fixed [button] css code
121
  * Updated [accordion], [spoiler] and [tabs] js code
122
  * Fixed [tooltip]
123
  * Updated Greek translation
124
-
125
- = 4.1.5 =
126
  * Fixed [lightbox]
127
  * Disabled wp_footer check
128
-
129
- = 4.1.4 =
130
  * Fixed wp_footer notice, again
131
-
132
- = 4.1.3 =
133
  * Small fix for tooltips
134
  * Fixed wp_footer notice
135
  * Greek translation
136
-
137
- = 4.1.2 =
138
  * Added compatibility mode prefix for spoilers inside of accordion
139
  * Updated qTip plugin
140
  * Added shortcode [tooltip]
141
  * Added new attribute. [tab disabled="yes"]. Now, any tab can be disabled. [Forum topic](http://wordpress.org/support/topic/tabs-how-to-disable-one-of-the-tabs)
142
  * Added [accordion] scrolling. [Forum topic](http://wordpress.org/support/topic/accordion-usability-issue)
143
  * Added wp_footer check. User will be noticed if current theme doen't includes wp_footer
144
-
145
- = 4.1.1 =
146
  * Updated caching mechanism. Cache will be reseted when you add or remove terms
147
  * Updated galleries mechanism. Removed some conflicts
148
  * Fixed spoiler background for style=fancy
95
 
96
  == Changelog ==
97
 
98
+ = 4.2 =
99
+ * Font Awesome icons (in Generator)
100
+ * Fixed warning in footer - [forum topic](http://wordpress.org/support/topic/bug-showing-in-online-site-after-updating-the-plugin)
101
  * Removed warning at settings page - [forum topic](http://wordpress.org/support/topic/warning-on-settings-page)
102
  * Removed another warning (undefined index) - [forum topic](http://wordpress.org/support/topic/undefined-index-with-wp_debug-true)
103
  * Changed syntax for shortcodes inside of attributes - [documentation](http://gndev.info/kb/how-to-use-another-shortcodes-inside-of-attributes/)
104
  * Small performance improvemets
105
  * Aded font-awesome.css. Will be completely included in closest versions
 
 
106
  * Added default taxonomy value for [posts]
107
  * Added default post_type value for [posts]
108
  * Added ability to use shortcodes inside of attributes
109
  * Translated into Japanese
 
 
110
  * Fixed [button wide=yes]
111
  * Fixed media query for [column]
112
  * Added new attr [column center=yes]
113
  * Improved js code for spoilers and tabs
114
  * Improved js code for generator
 
 
115
  * Added pot file
116
  * Fixed [button] css code
117
  * Updated [accordion], [spoiler] and [tabs] js code
118
  * Fixed [tooltip]
119
  * Updated Greek translation
 
 
120
  * Fixed [lightbox]
121
  * Disabled wp_footer check
 
 
122
  * Fixed wp_footer notice, again
 
 
123
  * Small fix for tooltips
124
  * Fixed wp_footer notice
125
  * Greek translation
 
 
126
  * Added compatibility mode prefix for spoilers inside of accordion
127
  * Updated qTip plugin
128
  * Added shortcode [tooltip]
129
  * Added new attribute. [tab disabled="yes"]. Now, any tab can be disabled. [Forum topic](http://wordpress.org/support/topic/tabs-how-to-disable-one-of-the-tabs)
130
  * Added [accordion] scrolling. [Forum topic](http://wordpress.org/support/topic/accordion-usability-issue)
131
  * Added wp_footer check. User will be noticed if current theme doen't includes wp_footer
 
 
132
  * Updated caching mechanism. Cache will be reseted when you add or remove terms
133
  * Updated galleries mechanism. Removed some conflicts
134
  * Fixed spoiler background for style=fancy
shortcodes-ultimate.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Shortcodes Ultimate
4
  Plugin URI: http://gndev.info/shortcodes-ultimate/
5
- Version: 4.1.9
6
  Author: Vladimir Anokhin
7
  Author URI: http://gndev.info/
8
  Description: Supercharge your WordPress theme with mega pack of shortcodes
@@ -23,7 +23,7 @@ require_once 'inc/core/class.shortcodes-ultimate.php';
23
  require_once 'inc/core/class.assets.php';
24
  require_once 'inc/core/class.data.php';
25
  require_once 'inc/core/tools.php';
26
- require_once 'inc/core/shortcodes.php';
27
  require_once 'inc/core/class.generator.php';
28
  require_once 'inc/core/class.widget.php';
29
  require_once 'inc/core/class.vote.php';
2
  /*
3
  Plugin Name: Shortcodes Ultimate
4
  Plugin URI: http://gndev.info/shortcodes-ultimate/
5
+ Version: 4.2.0
6
  Author: Vladimir Anokhin
7
  Author URI: http://gndev.info/
8
  Description: Supercharge your WordPress theme with mega pack of shortcodes
23
  require_once 'inc/core/class.assets.php';
24
  require_once 'inc/core/class.data.php';
25
  require_once 'inc/core/tools.php';
26
+ require_once 'inc/core/class.shortcodes.php';
27
  require_once 'inc/core/class.generator.php';
28
  require_once 'inc/core/class.widget.php';
29
  require_once 'inc/core/class.vote.php';