PluginProbe
Snippet Shortcodes / 3.2
Snippet Shortcodes v3.2
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
← All changes | includes/shortcode.user.php +9 -5 2.03.2 View file →
@@ -41,10 +41,17 @@
41 41 // Cached?
42 42 $shortcode = sh_cd_cache_get( $args[ 'slug' ] );
43 43
44 44 // If not in cache, hit the database!
45 - if ( true === empty( $shortcode ) ) {
45 + if ( false === $shortcode ) {
46 +
46 47 $shortcode = sh_cd_db_shortcodes_by_slug( $args[ 'slug' ] );
48 +
49 + // Cache it! If a multisite, only cache the shortcode for 30 seconds. Otherwise fall back to default cache time.
50 + $cache_time = ( true === sh_cd_license_is_premium() && true === in_array( $args[ 'slug' ], sh_cd_multisite_slugs() ) ) ? 30 : NULL;
51 +
52 + sh_cd_cache_set( $args[ 'slug' ], $shortcode, $cache_time );
53 +
47 54 }
48 55
49 56 // If still no reference to a shortcode then slug doesn't exist
50 57 if ( true === empty( $shortcode ) ) {
@@ -50,13 +57,10 @@
50 57 if ( true === empty( $shortcode ) ) {
51 58 return '';
52 59 }
53 60
54 - // Cache it!
55 - sh_cd_cache_set( $args[ 'slug' ], $shortcode );
56 -
57 61 // Process other shortcodes within this one
58 62 $shortcode = do_shortcode( $shortcode );
59 63
60 64 // Replace placeholders with user defined parameters
61 65 return sh_cd_apply_user_defined_parameters( $shortcode, $args );
62 -}
66 +}