PluginProbe
Snippet Shortcodes / 3.0.2
Snippet Shortcodes v3.0.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 +14 -4 2.03.0.2 View file →
@@ -41,10 +41,23 @@
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 +
54 + } else if ( true === is_page() || true === is_single() ) {
55 + printf( '<!-- %s cached: %s / ms: %s -->' . PHP_EOL,
56 + SH_CD_SHORTCODE,
57 + $args[ 'slug' ],
58 + ( true === in_array( $args[ 'slug' ], sh_cd_multisite_slugs() ) ) ? 'y' : 'n'
59 + );
47 60 }
48 61
49 62 // If still no reference to a shortcode then slug doesn't exist
50 63 if ( true === empty( $shortcode ) ) {
@@ -49,11 +62,8 @@
49 62 // If still no reference to a shortcode then slug doesn't exist
50 63 if ( true === empty( $shortcode ) ) {
51 64 return '';
52 65 }
53 -
54 - // Cache it!
55 - sh_cd_cache_set( $args[ 'slug' ], $shortcode );
56 66
57 67 // Process other shortcodes within this one
58 68 $shortcode = do_shortcode( $shortcode );
59 69