You are here

function social_content_validate_text in Social Content 7

Strip non utf8 characters that can sometimes come through.

Helper function, used by modules implementing social content types.

Parameters

string $text: Filtered text.

3 calls to social_content_validate_text()
social_content_facebook_post_callback in modules/facebook/social_content_facebook.module
social_content_instagram_post_callback in modules/instagram/social_content_instagram.module
social_content_twitter_post_callback in modules/twitter/social_content_twitter.module

File

./social_content.module, line 492
Social Content module.

Code

function social_content_validate_text($text) {

  // Solution found here: http://stackoverflow.com/a/4266468
  $text = preg_replace('/[^(\\x20-\\x7F)]*/', '', $text);
  return $text;
}