<description><![CDATA[<?php echo $this->cparams->get('rss_channel_description', null); ?> ]]></description> <language><?php echo $this->rssLang; ?> </language> <webMaster><?php echo htmlspecialchars($this->cparams->get('rss_webmaster_email', $this->joomlaConfig->get('mailfrom', null)) . ' ' . '(' . $this->cparams->get('rss_webmaster_name', $this->joomlaConfig->get('fromname', null)) . ')', ENT_COMPAT, 'UTF-8'); ?> </webMaster> <pubDate><?php $dateObj = new JDate(); $dateObj->setTimezone(new DateTimeZone($this->globalConfig->get('offset'))); echo htmlspecialchars($dateObj->toRFC822(true), ENT_COMPAT, 'UTF-8'); ?> </pubDate> <generator>JSitemap Pro</generator> <atom:link rel="self" type="application/rss+xml" href="<?php $current = JUri::getInstance(); echo htmlspecialchars($current->toString(array('scheme', 'user', 'pass', 'host', 'port', 'path', 'query')), ENT_COMPAT, 'UTF-8'); ?> "/> <?php if ($channelImage = $this->cparams->get('rss_channel_image', null)) { ?> <image> <url><?php echo $this->liveSite . '/' . $channelImage; ?>
?> <strong><?php echo JText::_('LIB_REDCORE_COPYRIGHT'); ?> </strong>: <?php echo (string) $xml->copyright; ?> <br /> <?php } ?> <strong><?php echo JText::_('LIB_REDCORE_API_HAL_WEBSERVICE_DOCUMENTATION_GENERATED'); ?> </strong>: <?php echo $date->toRFC822(); ?> <br /> <strong><?php echo JText::_('LIB_REDCORE_API_HAL_WEBSERVICE_DOCUMENTATION_SUPPORTED_FORMATS'); ?> </strong>: json (<?php echo JText::_('JDEFAULT'); ?> ), xml<br /> <strong> <?php echo JText::_('LIB_REDCORE_API_HAL_WEBSERVICE_DOCUMENTATION_CLIENT'); ?> :
/** * Testing toRFC822 * * @param mixed $tz Which time zone? (can be string or numeric * @param string $setTime What time should be set? * @param bool $local Local (true) or GMT? * @param string $expected What should the resulting time string look like? * * @return void * @dataProvider casesToRFC822 **/ public function testToRFC822($tz, $setTime, $local, $expected) { $language = JFactory::getLanguage(); $debug = $language->setDebug(true); if (is_null($tz)) { $testJDate = new JDate($setTime); } else { $testJDate = new JDate($setTime, $tz); } $this->assertThat($testJDate->toRFC822($local), $this->equalTo($expected)); $language->setDebug($debug); }
function display($tpl = null) { if (!JobBoardListHelper::rssEnabled()) { jexit(JText::_('COM_JOBBOARD_FEEDS_NOACCES')); } $catid = $this->selcat; $keywd = $this->keysrch; $document =& JFactory::getDocument(); $document->setLink(JRoute::_('index.php?option=com_jobboard&selcat=' . $catid)); // get category name $db =& JFactory::getDBO(); $query = 'SELECT ' . $db->nameQuote('type') . ' FROM ' . $db->nameQuote('#__jobboard_categories') . ' WHERE ' . $db->nameQuote('id') . ' = ' . $catid; $db->setQuery($query); $seldesc = $db->loadResult(); // get "show location" settings: $query = 'SELECT ' . $db->nameQuote('use_location') . ' FROM ' . $db->nameQuote('#__jobboard_config') . ' WHERE ' . $db->nameQuote('id') . ' = 1'; $db->setQuery($query); $use_location = $db->loadResult(); // get the items to add to the feed $where = $catid == 1 ? '' : ' WHERE c.' . $db->nameQuote('id') . ' = ' . $catid; $tag_include = strlen($keywd); if ($tag_include > 0 && $catid == 1) { $tag_requested = $this->checkTagRequest($keywd); $where .= $tag_requested != '' ? " WHERE j." . $db->nameQuote('job_tags') . " LIKE '%{$tag_requested}%' " : ''; } $limit = 10; $where .= ' AND (DATE_FORMAT(j.expiry_date,"%Y-%m-%d") >= CURDATE() OR DATE_FORMAT(j.expiry_date,"%Y-%m-%d") = 0000-00-00) '; $query = 'SELECT j.`id` , j.`post_date` , j.`job_title` , j.`job_type` , j.`country` , c.`type` AS category , cl.`description` AS job_level , j.`description` , j.`city` FROM `#__jobboard_jobs` AS j INNER JOIN `#__jobboard_categories` AS c ON (j.`category` = c.`id`) INNER JOIN `#__jobboard_career_levels` AS cl ON (j.`career_level` = cl.`id`) ' . $where . ' ORDER BY j.`post_date` DESC LIMIT ' . $limit; $db->setQuery($query); $rows = $db->loadObjectList(); $site_name = $_SERVER['SERVER_NAME']; if ($tag_requested != '') { $document->setDescription(JText::_('JOBS_WITH') . ' "' . ucfirst($tag_requested) . '" ' . JText::_('KEYWD_TAG')); $rss_title = $site_name . ': ' . JText::_('JOBS_WITH') . ' "' . ucfirst($tag_requested) . '" '; } else { $document->setDescription(JText::_('RSS_LATEST_JOBS') . ': ' . $seldesc); $rss_title = $site_name . ': ' . JText::_('RSS_LATEST_JOBS') . ': ' . $seldesc; } $document->setTitle($rss_title); foreach ($rows as $row) { // create a new feed item $job = new JFeedItem(); // assign values to the item $job_date = new JDate($row->post_date); $job_pubDate = new JDate(); $job->category = $row->category; $job->date = $job_date->toRFC822(); $job->description = $this->trimDescr(html_entity_decode($this->escape($row->description)), '.'); $link = htmlentities('index.php?option=com_jobboard&view=job&id=' . $row->id); $job->link = JRoute::_($link); $job->pubDate = $job_pubDate->toRFC822(); if ($use_location) { $job_location = $row->country != 266 ? ', ' . $row->city : ', ' . JText::_('WORK_FROM_ANYWHERE'); } else { $job_location = ''; } $job->title = JText::_('JOB_VACANCY') . ': ' . html_entity_decode($this->escape($row->job_title . $job_location . ' (' . JText::_($row->job_type) . ')')); // add item to the feed $document->addItem($job); } }
/** * Render the feed * * @access public * @return string */ function render() { $now = new JDate(); $data =& $this->_doc; $uri =& JFactory::getURI(); $url = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port')); $feed = "<rss version=\"2.0\">\n"; $feed .= "\t<channel>\n"; $feed .= "\t\t<title>" . $data->title . "</title>\n"; $feed .= "\t\t<description>" . $data->description . "</description>\n"; $feed .= "\t\t<link>" . $url . $data->link . "</link>\n"; $feed .= "\t\t<lastBuildDate>" . htmlspecialchars($now->toRFC822(), ENT_COMPAT, 'UTF-8') . "</lastBuildDate>\n"; $feed .= "\t\t<generator>" . $data->getGenerator() . "</generator>\n"; if ($data->image != null) { $feed .= "\t\t<image>\n"; $feed .= "\t\t\t<url>" . $data->image->url . "</url>\n"; $feed .= "\t\t\t<title>" . htmlspecialchars($data->image->title, ENT_COMPAT, 'UTF-8') . "</title>\n"; $feed .= "\t\t\t<link>" . $data->image->link . "</link>\n"; if ($data->image->width != "") { $feed .= "\t\t\t<width>" . $data->image->width . "</width>\n"; } if ($data->image->height != "") { $feed .= "\t\t\t<height>" . $data->image->height . "</height>\n"; } if ($data->image->description != "") { $feed .= "\t\t\t<description><![CDATA[" . $data->image->description . "]]></description>\n"; } $feed .= "\t\t</image>\n"; } if ($data->language != "") { $feed .= "\t\t<language>" . $data->language . "</language>\n"; } if ($data->copyright != "") { $feed .= "\t\t<copyright>" . htmlspecialchars($data->copyright, ENT_COMPAT, 'UTF-8') . "</copyright>\n"; } if ($data->editor != "") { $feed .= "\t\t<managingEditor>" . htmlspecialchars($data->editor, ENT_COMPAT, 'UTF-8') . "</managingEditor>\n"; } if ($data->webmaster != "") { $feed .= "\t\t<webMaster>" . htmlspecialchars($data->webmaster, ENT_COMPAT, 'UTF-8') . "</webMaster>\n"; } if ($data->pubDate != "") { $pubDate = new JDate($data->pubDate); $feed .= "\t\t<pubDate>" . htmlspecialchars($pubDate->toRFC822(), ENT_COMPAT, 'UTF-8') . "</pubDate>\n"; } if ($data->category != "") { $feed .= "\t\t<category>" . htmlspecialchars($data->category, ENT_COMPAT, 'UTF-8') . "</category>\n"; } if ($data->docs != "") { $feed .= "\t\t<docs>" . htmlspecialchars($data->docs, ENT_COMPAT, 'UTF-8') . "</docs>\n"; } if ($data->ttl != "") { $feed .= "\t\t<ttl>" . htmlspecialchars($data->ttl, ENT_COMPAT, 'UTF-8') . "</ttl>\n"; } if ($data->rating != "") { $feed .= "\t\t<rating>" . htmlspecialchars($data->rating, ENT_COMPAT, 'UTF-8') . "</rating>\n"; } if ($data->skipHours != "") { $feed .= "\t\t<skipHours>" . htmlspecialchars($data->skipHours, ENT_COMPAT, 'UTF-8') . "</skipHours>\n"; } if ($data->skipDays != "") { $feed .= "\t\t<skipDays>" . htmlspecialchars($data->skipDays, ENT_COMPAT, 'UTF-8') . "</skipDays>\n"; } for ($i = 0; $i < count($data->items); $i++) { $feed .= "\t\t<item>\n"; $feed .= "\t\t\t<title>" . htmlspecialchars(strip_tags($data->items[$i]->title), ENT_COMPAT, 'UTF-8') . "</title>\n"; $feed .= "\t\t\t<link>" . $url . $data->items[$i]->link . "</link>\n"; $feed .= "\t\t\t<description><![CDATA[" . $this->_relToAbs($data->items[$i]->description) . "]]></description>\n"; if ($data->items[$i]->author != "") { $feed .= "\t\t\t<author>" . htmlspecialchars($data->items[$i]->author, ENT_COMPAT, 'UTF-8') . "</author>\n"; } /* // on hold if ($data->items[$i]->source!="") { $data.= " <source>".htmlspecialchars($data->items[$i]->source, ENT_COMPAT, 'UTF-8')."</source>\n"; } */ if ($data->items[$i]->category != "") { $feed .= "\t\t\t<category>" . htmlspecialchars($data->items[$i]->category, ENT_COMPAT, 'UTF-8') . "</category>\n"; } if ($data->items[$i]->comments != "") { $feed .= "\t\t\t<comments>" . htmlspecialchars($data->items[$i]->comments, ENT_COMPAT, 'UTF-8') . "</comments>\n"; } if ($data->items[$i]->date != "") { $itemDate = new JDate($data->items[$i]->date); $feed .= "\t\t\t<pubDate>" . htmlspecialchars($itemDate->toRFC822(), ENT_COMPAT, 'UTF-8') . "</pubDate>\n"; } if ($data->items[$i]->guid != "") { $feed .= "\t\t\t<guid>" . htmlspecialchars($data->items[$i]->guid, ENT_COMPAT, 'UTF-8') . "</guid>\n"; } if ($data->items[$i]->enclosure != NULL) { $feed .= "\t\t\t<enclosure url=\""; $feed .= $data->items[$i]->enclosure->url; $feed .= "\" length=\""; $feed .= $data->items[$i]->enclosure->length; $feed .= "\" type=\""; $feed .= $data->items[$i]->enclosure->type; $feed .= "\"/>\n"; } $feed .= "\t\t</item>\n"; } $feed .= "\t</channel>\n"; $feed .= "</rss>\n"; return $feed; }
/** * Testing toRFC822 * * @param mixed $tz Which time zone? (can be string or numeric * @param string $setTime What time should be set? * @param bool $local Local (true) or GMT? * @param string $expected What should the resulting time string look like? * * @return void * @dataProvider casesToRFC822 **/ public function testToRFC822($tz, $setTime, $local, $expected) { if (is_null($tz)) { $testJDate = new JDate($setTime); } else { $testJDate = new JDate($setTime, $tz); } $this->assertThat($testJDate->toRFC822($local), $this->equalTo($expected)); }
function display($tpl = null) { $keywd = JString::strtolower($this->keysrch); $document =& JFactory::getDocument(); $document->setLink(JRoute::_('index.php?option=com_jobboard&view=list&selcat=' . $this->selcat)); $db =& JFactory::getDBO(); $this->use_location =& $this->get('LocConf'); // get the items to add to the feed $where = $this->selcat == 1 ? '' : ' WHERE c.' . $db->nameQuote('id') . ' = ' . $this->selcat; $tag_requested = ''; $tag_include = strlen($keywd); if ($tag_include > 0 && $this->selcat == 1) { $tag_requested = $this->checkTagRequest($keywd); $where .= $tag_requested != '' ? " WHERE j." . $db->nameQuote('job_tags') . " LIKE '%{$tag_requested}%' " : ''; } $limit = 10; $where .= ' AND (DATE_FORMAT(j.' . $db->nameQuote('expiry_date') . ',"%Y-%m-%d") >= CURDATE() OR DATE_FORMAT(j.' . $db->nameQuote('expiry_date') . ',"%Y-%m-%d") = 0000-00-00) '; $query = 'SELECT j.' . $db->nameQuote('id') . ' , j.' . $db->nameQuote('post_date') . ' , j.' . $db->nameQuote('job_title') . ' , j.' . $db->nameQuote('job_type') . ' , j.' . $db->nameQuote('country') . ' , c.' . $db->nameQuote('type') . ' AS category , cl.' . $db->nameQuote('description') . ' AS job_level , j.' . $db->nameQuote('description') . ' , j.' . $db->nameQuote('city') . ' FROM ' . $db->nameQuote('#__jobboard_jobs') . ' AS j INNER JOIN ' . $db->nameQuote('#__jobboard_categories') . ' AS c ON (j.' . $db->nameQuote('category') . ' = c.' . $db->nameQuote('id') . ') INNER JOIN ' . $db->nameQuote('#__jobboard_career_levels') . ' AS cl ON (j.' . $db->nameQuote('career_level') . ' = cl.' . $db->nameQuote('id') . ') ' . $where . ' ORDER BY j.' . $db->nameQuote('post_date') . ' DESC LIMIT ' . $limit; $db->setQuery($query); $rows = $db->loadObjectList(); $site_name = $_SERVER['SERVER_NAME']; if ($tag_requested != '') { $document->setDescription(JText::_('JOBS_WITH') . ' "' . ucfirst($tag_requested) . '" ' . JText::_('KEYWD_TAG')); $rss_title = $site_name . ': ' . JText::_('JOBS_WITH') . ' "' . ucfirst($tag_requested) . '" '; } else { $document->setDescription(JText::_('RSS_LATEST_JOBS') . ': ' . $this->seldesc); $rss_title = $site_name . ': ' . JText::_('RSS_LATEST_JOBS') . ': ' . $this->seldesc; } $document->setTitle($rss_title); foreach ($rows as $row) { // create a new feed item $job = new JFeedItem(); // assign values to the item $job_date = new JDate($row->post_date); $job_pubDate = new JDate(); $job->category = $row->category; $job->date = $job_date->toRFC822(); $job->description = $this->trimDescr(html_entity_decode($this->escape($row->description)), '.'); $link = htmlentities('index.php?option=com_jobboard&view=job&id=' . $row->id); $job->link = JRoute::_($link); $job->pubDate = $job_pubDate->toRFC822(); if ($this->use_location) { $job_location = $row->country != 266 ? ', ' . $row->city : ', ' . JText::_('WORK_FROM_ANYWHERE'); } else { $job_location = ''; } $job->title = JText::_('JOB_VACANCY') . ': ' . html_entity_decode($this->escape($row->job_title . $job_location . ' (' . JText::_($row->job_type) . ')')); // add item to the feed $document->addItem($job); } }
/** * Testing toRFC822 * * @param mixed $tz Which time zone? (can be string or numeric * @param string $setTime What time should be set? * @param bool $local Local (true) or GMT? * @param string $expected What should the resulting time string look like? * * @return void * * @dataProvider casesToRFC822 * @since 11.3 * @covers JDate::toRFC822 */ public function testToRFC822($tz, $setTime, $local, $expected) { $testJDate = new JDate($setTime, $tz); $this->assertEquals($expected, $testJDate->toRFC822($local)); }