: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Get string between two strings.
* @param string $string string to find.
* @param string $start start string.
* @param string $end end string.
public static function get_string_between( string $string, string $start, string $end ) : string
$ini = strpos( $string, $start );
$ini += strlen( $start );
$len = strpos( $string, $end, $ini ) - $ini;
return substr( $string, $ini, $len );
* Preg matches shortcode and return cleaned output.
* @param string $content given content.
public static function get_shortcode_content( string $content, $password ) : string
preg_match( '/\\[passster.*password="' . $password . '".*?\\]/', $content, $matches );
if ( isset( $matches ) && !empty($matches) ) {
foreach ( $matches as $match ) {
$string = self::get_string_between( $content, $match, '[/passster]' );