PluginProbe
Snippet Shortcodes / 1.5.1
Snippet Shortcodes v1.5.1
5.2.1 5.2 5.1.8 5.1.6 5.1.7 5.1.5 trunk 1.0 1.1 1.2 1.3 1.3.1 1.4 1.5 1.5.1 1.6 1.6.1 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.8 2.0 2.0.1 All 74 releases
shortcode-variables / includes / shortcode.php

shortcode.php in Snippet Shortcodes 1.5.1, at includes/shortcode.php

56 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined('ABSPATH') or die('Jog on!');
4
5 function sh_cd_shortcode( $atts )
6 {
7 $shortcode_args = shortcode_atts( array(
8 'slug' => false,
9 'format' => false,
10 'redirect' => false
11 ), $atts );
12
13 return sh_cd_render_shortcode_from_db($shortcode_args);
14
15 }
16 add_shortcode( SH_CD_SHORTCODE, 'sh_cd_shortcode' );
17 add_shortcode( SH_CD_SHORTCODE_SMALL, 'sh_cd_shortcode' );
18
19 function sh_cd_render_shortcode_from_db($shortcode_args)
20 {
21 $slug = $shortcode_args['slug'];
22
23 if ($slug != false && !empty($slug))
24 {
25 // Check if a shortcode preset
26 if (sh_cd_is_shortcode_preset($slug)) {
27 return sh_cd_render_shortcode_presets($shortcode_args);
28 }
29 else
30 {
31 $cached_shortcode = sh_cd_get_cache($slug);
32
33 if ($cached_shortcode != false)
34 {
35 // Process other shortcodes
36 $cached_shortcode = do_shortcode($cached_shortcode);
37
38 return $cached_shortcode;
39 }
40 else
41 {
42 $shortcode = sh_cd_get_shortcode_by_slug($slug);
43
44 if ($shortcode)
45 {
46 sh_cd_set_cache($slug, $shortcode);
47
48 $shortcode = do_shortcode($shortcode);
49
50 return $shortcode;
51 }
52 }
53 }
54 }
55 }
56