php - XML feed for Wordpress Social Board plugin modifications -


at work, i've been tasked modifying wordpress social board plugin duplicating rss feed functionality display xml feed specific our calendaring system.

for example, our xml feed outputs:

<?xml version="1.0"?> <events> <event> <eventid>1449080815796</eventid> <sponsorid>14</sponsorid> <inputsponsor>administration</inputsponsor> <displayedsponsor>lesbian, gay, bisexual, , transgender (lgbt) resource center, division of student affairs</displayedsponsor> <displayedsponsorurl></displayedsponsorurl> <date>2016-01-25</date> <timebegin>18:00</timebegin> <timeend>20:00</timeend> <repeat_vcaldef></repeat_vcaldef> <repeat_startdate></repeat_startdate> <repeat_enddate></repeat_enddate> <categoryid>119</categoryid> <category>diversity</category> <title>new 2 &apos;quse discussion group</title> <description>new 2 &apos;quse discussion group students new su/esf , lesbian, gay, bisexual, transgender, queer, asexual, , ally (lgbtqa) campus communities.</description> <location>lgbt resource center (750 ostrom)</location> <price></price> <contact_name>abby fite</contact_name> <contact_phone>443-3983</contact_phone> <contact_email>alfite@syr.edu</contact_email> <url>http://lgbt.syr.edu</url> <recordchangedtime>2015-12-02 13:26:55</recordchangedtime> <recordchangeduser>dsalgbt2</recordchangeduser> </event> </events> 

there 1 place in code formats rss feed:

elseif ( $feed_class == 'rss' ) {                 $rss_output = (@$this->sboption['section_rss']['rss_output']) ? $this->sboption['section_rss']['rss_output'] : array('title' => true, 'thumb' => true, 'text' => true, 'user' => true, 'tags' => false, 'share' => true, 'info' => true);                 $iframe = @$this->sboption['section_rss']['rss_iframe'];                 $fcount = 0;                 if ( $channel = @$feed->channel ) { // rss                     if (@$channel->item)                     foreach($channel->item $item) {                         $link = @$item->link;                         if ( $this->make_remove($link) ) {                         $fcount++;                          $thumb = $url = '';                         foreach($item->children('media', true)->thumbnail $thumbnail) {                             $thumb = $thumbnail->attributes()->url;                         }                         if ( ! $thumb) {                             foreach($item->children('media', true)->content $content) {                                 $thumb = $content->children('media', true)->thumbnail->attributes()->url;                                 if (@$content->attributes()->type == 'image/jpeg')                                     $url = @$content->attributes()->url;                             }                         }                         if ( ! $thumb) {                             if (@$item->enclosure->attributes()->type == 'image/jpeg')                                 $thumb = @$item->enclosure->attributes()->url;                         }                          if (@$item->category && @$rss_output['tags'])                         foreach($item->category $category) {                             $cats[] = (string) $category;                         }                          // set snippet or full text                         $text = $description = '';                         if (@$this->sboption['section_rss']['rss_text'])                             $description = $item->description;                         else                             $description = (@$item->children("content", true)->encoded) ? $item->children("content", true)->encoded : $item->description;                          if (@$description) {                             $description = preg_replace("/<script.*?\/script>/s", "", $description);                             if (@$attr['words']) {                                 if ( ! $thumb) {                                     $thumb = sb_getsrc($description);                                 }                                 $text = $this->word_limiter($description, $link);                             } else {                                 $text = $description;                             }                         }                         if ($iframe) {                             if ( ! $url)                                 $url = (@$thumb) ? $thumb : '';                         }                          $sbi = $this->make_timestr($item->pubdate, $link);                         $itemdata = array(                         'thumb' => (@$thumb) ? $thumb : '',                         'thumburl' => $url,                         'title' => '<a href="' . $link . '"'.$target.'>' . (@$attr['titles'] ? $this->title_limiter($item->title) : $item->title) . '</a>',                         'text' => $text,                         'tags' => @implode(', ', $cats),                         'url' => $link,                         'iframe' => $iframe ? 'icbox' : '',                         'date' => $item->pubdate,                         'user' => array(                             'name' => $channel->title,                             'url' => $channel->link,                             'image' => @$channel->image->url                             ),                         'type' => 'pencil',                         'icon' => array(@$themeoption['social_icons'][12], @$themeoption['type_icons'][0])                         );                         $final[$sbi] = $layoutobj->sb_create_item($feed_class, $itemdata, $attr, $rss_output, $sbi);                         if ( isset($slideshow) ) {                             $itemdata['text'] = @$this->format_text($description);                             if ($url)                                 $itemdata['thumb'] = $url;                             $finalslide[$sbi] = $slidelayoutobj->sb_create_slideitem($feed_class, $itemdata, $attr, $rss_output, $sbi);                         }                          if ( $fcount >= $results ) break;                         }                     }                 } elseif ( $entry = @$feed->entry ) { // atom                     // feed link                     foreach($feed->link $link) {                         if ($link->attributes()->rel == 'alternate')                             $user_url = $link->attributes()->href;                     }                     foreach($feed->entry $item) {                         $link = @$item->link[0]->attributes()->href;                         if ( $this->make_remove($link) ) {                         $fcount++;                          $title = (string) $item->title;                         $thumb = $url = '';                         foreach($item->media $thumbnail) {                             $thumb = $thumbnail->attributes()->url;                         }                         if ( ! $thumb) {                             foreach($item->link $linkitem) {                                 if (@$linkitem->attributes()->rel == 'enclosure') {                                     if (@$linkitem->attributes()->type == 'image/jpeg')                                         $thumb = @$content->attributes()->url;                                 }                             }                         }                          $cats = '';                         if (@$item->category && @$rss_output['tags']) {                             foreach($item->category $category) {                                 $cats .= $category->attributes()->term.', ';                             }                             $cats = rtrim($cats, ", ");                         }                          // set snippet or full text                         $text = $description = '';                         if (@$this->sboption['section_rss']['rss_text']) {                             $description = (string) $item->summary;                         } else {                             $content = (string) @$item->content;                             $description = ($content) ? $content : (string) $item->summary;                         }                          if (@$description) {                             if (@$attr['words']) {                                 if ( ! $thumb) {                                     $thumb = sb_getsrc($description);                                 }                                 $text = $this->word_limiter($description, $link);                             }                             else {                                 $text = $description;                             }                         }                         if ($iframe)                             $url = (@$thumb) ? $thumb : '';                          $sbi = $this->make_timestr($item->published, $link);                         $itemdata = array(                         'thumb' => @$thumb,                         'thumburl' => $url,                         'title' => '<a href="' . $link . '"'.$target.'>' . (@$attr['titles'] ? $this->title_limiter($title) : $title) . '</a>',                         'text' => @$text,                         'tags' => @$cats,                         'url' => $link,                         'iframe' => $iframe ? 'icbox' : '',                         'date' => $item->published,                         'user' => array(                             'name' => $feed->title,                             'url' => @$user_url,                             'image' => @$feed->logo                             ),                         'type' => 'pencil',                         'icon' => array(@$themeoption['social_icons'][12], @$themeoption['type_icons'][0])                         );                         $final[$sbi] = $layoutobj->sb_create_item($feed_class, $itemdata, $attr, $rss_output, $sbi);                         if ( isset($slideshow) ) {                             $itemdata['text'] = @$this->format_text($description);                             if ($url)                                 $itemdata['thumb'] = $url;                             $finalslide[$sbi] = $slidelayoutobj->sb_create_slideitem($feed_class, $itemdata, $attr, $rss_output, $sbi);                         }                          if ( $fcount >= $results ) break;                         }                     }                 }             } 

i've duplicated code feed class , modified, not pulling values seems:

    elseif ( $feed_class == 'dsa' ) {                 $rss_output = (@$this->sboption['section_dsa']['dsa_output']) ? $this->sboption['section_dsa']['dsa_output'] : array('title' => true, 'thumb' => true, 'text' => true, 'user' => true, 'tags' => false, 'share' => true, 'info' => true);                 $iframe = @$this->sboption['section_dsa']['dsa_iframe'];                 $fcount = 0;                 if ( $channel = @$feed->events ) { // rss                     if (@$channel->event)                     foreach($channel->event $item) {                         $link = @$item->displayedsponsorurl;                         if ( $this->make_remove($link) ) {                         $fcount++;                          $thumb = $url = '';                         foreach($item->children('media', true)->thumbnail $thumbnail) {                             $thumb = $thumbnail->attributes()->url;                         }                         if ( ! $thumb) {                             foreach($item->children('media', true)->content $content) {                                 $thumb = $content->children('media', true)->thumbnail->attributes()->url;                                 if (@$content->attributes()->type == 'image/jpeg')                                     $url = @$content->attributes()->url;                             }                         }                         if ( ! $thumb) {                             if (@$item->enclosure->attributes()->type == 'image/jpeg')                                 $thumb = @$item->enclosure->attributes()->url;                         }                          if (@$item->category && @$rss_output['tags'])                         foreach($item->category $category) {                             $cats[] = (string) $category;                         }                          // set snippet or full text                         $text = $description = '';                         if (@$this->sboption['section_dsa']['dsa_text'])                             $description = $item->description;                         else                             $description = (@$item->children("content", true)->encoded) ? $item->children("content", true)->encoded : $item->description;                          if (@$description) {                             $description = preg_replace("/<script.*?\/script>/s", "", $description);                             if (@$attr['words']) {                                 if ( ! $thumb) {                                     $thumb = sb_getsrc($description);                                 }                                 $text = $this->word_limiter($description, $link);                             } else {                                 $text = $description;                             }                         }                         if ($iframe) {                             if ( ! $url)                                 $url = (@$thumb) ? $thumb : '';                         }                          $sbi = $this->make_timestr($item->pubdate, $link);                         $itemdata = array(                         'thumb' => (@$thumb) ? $thumb : '',                         'thumburl' => $url,                         'title' => '<a href="' . $link . '"'.$target.'>' . (@$attr['titles'] ? $this->title_limiter($item->title) : $item->title) . '</a>',                         'text' => $text,                         'tags' => @implode(', ', $cats),                         'url' => $link,                         'iframe' => $iframe ? 'icbox' : '',                         'date' => $item->date,                         'user' => array(                             'name' => $channel->title,                             'url' => $channel->link,                             'image' => @$channel->image->url                             ),                         'type' => 'pencil',                         'icon' => array(@$themeoption['social_icons'][12], @$themeoption['type_icons'][0])                         );                         $final[$sbi] = $layoutobj->sb_create_item($feed_class, $itemdata, $attr, $rss_output, $sbi);                         if ( isset($slideshow) ) {                             $itemdata['text'] = @$this->format_text($description);                             if ($url)                                 $itemdata['thumb'] = $url;                             $finalslide[$sbi] = $slidelayoutobj->sb_create_slideitem($feed_class, $itemdata, $attr, $rss_output, $sbi);                         }                          if ( $fcount >= $results ) break;                         }                     }                 } elseif ( $entry = @$feed->entry ) { // atom                     // feed link                     foreach($feed->link $link) {                         if ($link->attributes()->rel == 'alternate')                             $user_url = $link->attributes()->href;                     }                     foreach($feed->entry $item) {                         $link = @$item->link[0]->attributes()->href;                         if ( $this->make_remove($link) ) {                         $fcount++;                          $title = (string) $item->title;                         $thumb = $url = '';                         foreach($item->media $thumbnail) {                             $thumb = $thumbnail->attributes()->url;                         }                         if ( ! $thumb) {                             foreach($item->link $linkitem) {                                 if (@$linkitem->attributes()->rel == 'enclosure') {                                     if (@$linkitem->attributes()->type == 'image/jpeg')                                         $thumb = @$content->attributes()->url;                                 }                             }                         }                          $cats = '';                         if (@$item->category && @$rss_output['tags']) {                             foreach($item->category $category) {                                 $cats .= $category->attributes()->term.', ';                             }                             $cats = rtrim($cats, ", ");                         }                          // set snippet or full text                         $text = $description = '';                         if (@$this->sboption['section_dsa']['dsa_text']) {                             $description = (string) $item->summary;                         } else {                             $content = (string) @$item->content;                             $description = ($content) ? $content : (string) $item->summary;                         }                          if (@$description) {                             if (@$attr['words']) {                                 if ( ! $thumb) {                                     $thumb = sb_getsrc($description);                                 }                                 $text = $this->word_limiter($description, $link);                             }                             else {                                 $text = $description;                             }                         }                         if ($iframe)                             $url = (@$thumb) ? $thumb : '';                          $sbi = $this->make_timestr($item->published, $link);                         $itemdata = array(                         'thumb' => @$thumb,                         'thumburl' => $url,                         'title' => '<a href="' . $link . '"'.$target.'>' . (@$attr['titles'] ? $this->title_limiter($title) : $title) . '</a>',                         'text' => @$text,                         'tags' => @$cats,                         'url' => $link,                         'iframe' => $iframe ? 'icbox' : '',                         'date' => $item->published,                         'user' => array(                             'name' => $feed->title,                             'url' => @$user_url,                             'image' => @$feed->logo                             ),                         'type' => 'pencil',                         'icon' => array(@$themeoption['social_icons'][12], @$themeoption['type_icons'][0])                         );                         $final[$sbi] = $layoutobj->sb_create_item($feed_class, $itemdata, $attr, $rss_output, $sbi);                         if ( isset($slideshow) ) {                             $itemdata['text'] = @$this->format_text($description);                             if ($url)                                 $itemdata['thumb'] = $url;                             $finalslide[$sbi] = $slidelayoutobj->sb_create_slideitem($feed_class, $itemdata, $attr, $rss_output, $sbi);                         }                          if ( $fcount >= $results ) break;                         }                     }                 }             } 

i apologize being highly specific question. inexperienced php, wordpress plugins , have been tasked working asap...

am missing operators not pulling in values? haven't set values yet, i'm modifying ones exist before moving onto adding anything.

there no direct errors logs pulled, believe it's not pulling in right values, i'm not sure how fix that.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -