/**
  * Filters a single syndication URL.
  *
  * @param string $string A string that is expected to be a syndication URL.
  * @return string|bool The filtered and escaped URL string, or FALSE if invalid.
  * @used-by clean_urls
  */
 public static function clean_url($string)
 {
     $url = trim($string);
     if (!filter_var($url, FILTER_VALIDATE_URL)) {
         return false;
     }
     // Rewrite these to https as needed
     $secure = apply_filters('syn_rewrite_secure', array('facebook.com', 'twitter.com'));
     if (in_array(extract_domain_name($url), $secure)) {
         $url = preg_replace("/^http:/i", "https:", $url);
     }
     $url = esc_url_raw($url);
     return $url;
 }
 /**
  * Returns an array of domains with the post type terminologies
  *
  * @return array A translated post type string for specific domain or 'a post'
  */
 public static function get_post_type_string($url)
 {
     $strings = array('twitter.com' => _x('a tweet', 'Post kind'), 'vimeo.com' => _x('a video', 'Post kind'), 'youtube.com' => _x('a video', 'Post kind'), 'instagram.com' => _x('an image', 'Post kind'));
     $domain = extract_domain_name($url);
     if (array_key_exists($domain, $strings)) {
         return apply_filters('kind_post_type_string', $strings[$domain]);
     } else {
         return _x('a post', 'Post kind');
     }
 }
 private static function mf2parse($content, $url)
 {
     $data = array();
     $host = extract_domain_name($url);
     switch ($host) {
         case 'twitter.com':
             $parsed = Mf2\Shim\parseTwitter($content, $url);
             break;
         default:
             $parsed = Mf2\parse($content, $url);
     }
     if (mf2_cleaner::isMicroformatCollection($parsed)) {
         $entries = mf2_cleaner::findMicroformatsByType($parsed, 'h-entry');
         if ($entries) {
             $entry = $entries[0];
             if (mf2_cleaner::isMicroformat($entry)) {
                 foreach ($entry['properties'] as $key => $value) {
                     $data[$key] = mf2_cleaner::getPlaintext($entry, $key);
                 }
                 $data['published'] = mf2_cleaner::getPublished($entry);
                 $data['updated'] = mf2_cleaner::getUpdated($entry);
                 $data['name'] = mf2_cleaner::getPlaintext($entry, 'name');
                 $data['content'] = mf2_cleaner::getHtml($entry, 'content');
                 $data['summary'] = mf2_cleaner::getHtml($entry, 'summary');
                 $data['name'] = trim(preg_replace('/https?:\\/\\/([^ ]+|$)/', '', $data['name']));
                 $author = mf2_cleaner::getAuthor($entry);
                 if ($author) {
                     $data['author'] = array();
                     foreach ($author['properties'] as $key => $value) {
                         $data['author'][$key] = mf2_cleaner::getPlaintext($author, $key);
                     }
                     $data['author'] = array_filter($data['author']);
                 }
             }
         }
     }
     return array_filter($data);
 }