| 1 |
<?php |
| 2 |
|
| 3 |
if (!function_exists('wpgrade_remove_spaces_around_shortcodes')) { |
| 4 |
|
| 5 |
function wpgrade_remove_spaces_around_shortcodes( $content ) { |
| 6 |
$array = array( |
| 7 |
'<p>[' => '[', |
| 8 |
']</p>' => ']', |
| 9 |
']<br />' => ']' |
| 10 |
); |
| 11 |
|
| 12 |
$content = strtr( $content, $array ); |
| 13 |
|
| 14 |
return $content; |
| 15 |
} |
| 16 |
} |
| 17 |
|
| 18 |
if (!function_exists('wpgrade_parse_shortcode_content')) { |
| 19 |
|
| 20 |
function wpgrade_parse_shortcode_content( $content ) { |
| 21 |
|
| 22 |
/* Parse nested shortcodes and add formatting. */ |
| 23 |
$content = trim( do_shortcode( shortcode_unautop( $content ) ) ); |
| 24 |
|
| 25 |
/* Remove '' from the start of the string. */ |
| 26 |
if ( substr( $content, 0, 4 ) == '' ) |
| 27 |
$content = substr( $content, 4 ); |
| 28 |
|
| 29 |
/* Remove '' from the end of the string. */ |
| 30 |
if ( substr( $content, -3, 3 ) == '' ) |
| 31 |
$content = substr( $content, 0, -3 ); |
| 32 |
|
| 33 |
/* Remove any instances of ''. */ |
| 34 |
$content = str_replace( array( '<p></p>' ), '', $content ); |
| 35 |
$content = str_replace( array( '<p> </p>' ), '', $content ); |
| 36 |
$content = str_replace( array( '<p> </p>' ), '', $content ); |
| 37 |
|
| 38 |
return $content; |
| 39 |
} |
| 40 |
} |