Ejemplo n.º 1
0
 function _opml_rss_uris()
 {
     // Really we should parse the XML and use the structure to
     // return something intelligent to programs that want to use it
     // Oh babe! maybe some day...
     $opml = $this->data();
     $rx = FeedWordPressHTML::attributeRegex('outline', 'xmlUrl');
     if (preg_match_all($rx, $opml, $matches, PREG_SET_ORDER)) {
         foreach ($matches as $m) {
             $match = FeedWordPressHTML::attributeMatch($m);
             $r[] = $match['value'];
         }
     }
     return $r;
 }
Ejemplo n.º 2
0
 static function sanitize_content($content, $obj)
 {
     # This kind of sucks. I intend to replace it with
     # lib_filter sometime soon.
     foreach ($obj->strip_attrs as $pair) {
         list($tag, $attr) = $pair;
         $pattern = FeedWordPressHTML::attributeRegex($tag, $attr);
         $content = preg_replace_callback($pattern, array($obj, 'strip_attribute_from_tag'), $content);
     }
     return $content;
 }
Ejemplo n.º 3
0
 public function process_post($data, $post)
 {
     $img_src = FeedWordPressHTML::attributeRegex('img', 'src');
     # Match any image elements in the syndicated item
     preg_match_all($img_src, $data['post_content'], $refs, PREG_SET_ORDER);
     foreach ($refs as $matches) {
         $src = FeedWordPressHTML::attributeMatch($matches);
         if (!isset($data['meta']['_syndicated_image_capture'])) {
             $data['meta']['_syndicated_image_capture'] = array();
         }
         $data['meta']['_syndicated_image_capture'][] = $src['value'];
     }
     $thumb_links = $post->entry->get_links("http://github.com/radgeek/FWPPitchMediaGallery/wiki/thumbnail");
     if (is_array($thumb_links) and count($thumb_links) > 0) {
         foreach ($thumb_links as $href) {
             if (!isset($data['meta']['_syndicated_image_capture'])) {
                 $data['meta']['_syndicated_image_capture'] = array();
             }
             $data['meta']['_syndicated_image_capture'][] = $href;
             if (!isset($data['meta']['_syndicated_image_featured'])) {
                 $data['meta']['_syndicated_image_featured'] = array();
             }
             $data['meta']['_syndicated_image_featured'][] = $href;
         }
     }
     $link_elements = $post->entry->get_links("enclosure");
     if (is_array($link_elements) and count($link_elements) > 0) {
         foreach ($link_elements as $href) {
             if (!isset($data['meta']['_syndicated_image_capture'])) {
                 $data['meta']['_syndicated_image_capture'] = array();
             }
             $data['meta']['_syndicated_image_capture'][] = $href;
         }
     }
     $enclosures = $post->entry->get_enclosures();
     if (is_array($enclosures) and count($enclosures) > 0) {
         foreach ($enclosures as $enclosure) {
             $data['meta']['_syndicated_image_capture'][] = $enclosure->get_link();
         }
     }
     $thumb_id = $post->link->setting('featured image default', 'featured_image_default', NULL);
     if ($thumb_id) {
         $data['meta']['_thumbnail_id'] = $thumb_id;
     }
     return $data;
 }