| @@ -7,10 +7,8 @@ | ||
| 7 | 7 | * @param $slug |
| 8 | 8 | */ |
| 9 | 9 | function sh_cd_is_preset( $slug ) { |
| 10 | 10 | |
| 11 | - $slug = sh_cd_prep_slug( $slug ); | |
| 12 | - | |
| 13 | 11 | // Free preset? |
| 14 | 12 | if ( true === array_key_exists( $slug, sh_cd_shortcode_presets_free_list() ) ) { |
| 15 | 13 | return 'free'; |
| 16 | 14 | } |
| @@ -23,18 +21,8 @@ | ||
| 23 | 21 | return false; |
| 24 | 22 | } |
| 25 | 23 | |
| 26 | 24 | /** |
| 27 | - * Remove old references to the "sc-" prefix | |
| 28 | - */ | |
| 29 | -function sh_cd_prep_slug( $slug ) { | |
| 30 | - | |
| 31 | - $slug = str_replace( 'sc-', '', $slug ); | |
| 32 | - | |
| 33 | - return $slug; | |
| 34 | -} | |
| 35 | - | |
| 36 | -/** | |
| 37 | 25 | * Return all free and premium premade shortcodes |
| 38 | 26 | * |
| 39 | 27 | * @return array |
| 40 | 28 | */ |
| @@ -63,9 +51,9 @@ | ||
| 63 | 51 | return ''; |
| 64 | 52 | } |
| 65 | 53 | |
| 66 | 54 | // Is this a premium shortcode but no license? |
| 67 | - if ( 'premium' === $preset['sh-cd-type'] && false === sh_cd_is_premium() ) { | |
| 55 | + if ( 'premium' === $preset['sh-cd-type'] && false === SH_CD_IS_PREMIUM ) { | |
| 68 | 56 | return sprintf( '<p><strong>%s</strong> %s. <a href="%s">%s</a>.<p>', |
| 69 | 57 | __( 'Ooops!', SH_CD_SLUG ), |
| 70 | 58 | __('Unfortunately this is a Premium shortcode. You need to upgrade "Snippet Shortcodes" to use it', SH_CD_SLUG ), |
| 71 | 59 | sh_cd_license_upgrade_link(), |
| @@ -102,10 +90,8 @@ | ||
| 102 | 90 | * @return bool |
| 103 | 91 | */ |
| 104 | 92 | function sh_cd_shortcode_presets_fetch( $slug ) { |
| 105 | 93 | |
| 106 | - $slug = sh_cd_prep_slug( $slug ); | |
| 107 | - | |
| 108 | 94 | $free_presets = sh_cd_shortcode_presets_free_list(); |
| 109 | 95 | |
| 110 | 96 | // Free preset? |
| 111 | 97 | if ( true === array_key_exists( $slug, $free_presets ) ) { |
| @@ -128,5 +114,67 @@ | ||
| 128 | 114 | } |
| 129 | 115 | |
| 130 | 116 | return false; |
| 131 | 117 | |
| 132 | -} | |
| 118 | +} | |
| 119 | + | |
| 120 | +/** | |
| 121 | + * Render text file for promo | |
| 122 | + */ | |
| 123 | +function sh_cd_shortcode_render_text() { | |
| 124 | + | |
| 125 | + $output = '**Premium Shortcodes**' . PHP_EOL; | |
| 126 | + | |
| 127 | + $shortcodes = sh_cd_shortcode_presets_premium_list(); | |
| 128 | + | |
| 129 | + foreach ( $shortcodes as $key => $data ) { | |
| 130 | + $output .= sprintf('- %s - %s' . PHP_EOL , $key, $data['description'] ); | |
| 131 | + } | |
| 132 | + | |
| 133 | + $output .= '**Free Shortcodes**' . PHP_EOL; | |
| 134 | + | |
| 135 | + $shortcodes = sh_cd_shortcode_presets_free_list(); | |
| 136 | + | |
| 137 | + foreach ( $shortcodes as $key => $data ) { | |
| 138 | + $output .= sprintf('- %s - %s' . PHP_EOL , $key, $data['description'] ); | |
| 139 | + } | |
| 140 | + | |
| 141 | + return $output; | |
| 142 | + | |
| 143 | +} | |
| 144 | +add_shortcode( 'sv-promo', 'sh_cd_shortcode_render_text' ); | |
| 145 | + | |
| 146 | +/** | |
| 147 | + * Shortcode to render free shortcodes (more for promo purposes) | |
| 148 | + * | |
| 149 | + * @return string | |
| 150 | + */ | |
| 151 | +function sh_cd_shortcode_render_table_free() { | |
| 152 | + | |
| 153 | + return sh_cd_display_premade_shortcodes( 'free' ); | |
| 154 | + | |
| 155 | +} | |
| 156 | +add_shortcode( 'sv-promo-free', 'sh_cd_shortcode_render_table_free'); | |
| 157 | + | |
| 158 | +/** | |
| 159 | + * Shortcode to render premium shortcodes (more for promo purposes) | |
| 160 | + * | |
| 161 | + * @return string | |
| 162 | + */ | |
| 163 | +function sh_cd_shortcode_render_table_premium() { | |
| 164 | + | |
| 165 | + return sh_cd_display_premade_shortcodes( 'premium' ); | |
| 166 | + | |
| 167 | +} | |
| 168 | +add_shortcode( 'sv-promo-premium', 'sh_cd_shortcode_render_table_premium'); | |
| 169 | + | |
| 170 | +/** | |
| 171 | + * Shortcode to render all shortcodes (more for promo purposes) | |
| 172 | + * | |
| 173 | + * @return string | |
| 174 | + */ | |
| 175 | +function sh_cd_shortcode_render_table_all() { | |
| 176 | + | |
| 177 | + return sh_cd_display_premade_shortcodes(); | |
| 178 | + | |
| 179 | +} | |
| 180 | +add_shortcode( 'sv-promo-all', 'sh_cd_shortcode_render_table_all'); | |