本文整理汇总了PHP中JDate::toISO8601方法的典型用法代码示例。如果您正苦于以下问题:PHP JDate::toISO8601方法的具体用法?PHP JDate::toISO8601怎么用?PHP JDate::toISO8601使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JDate
的用法示例。
在下文中一共展示了JDate::toISO8601方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Render the feed
*
* @access public
* @return string
*/
function render()
{
$now = new JDate();
$data =& $this->_doc;
$feed = "<feed xmlns=\"http://www.w3.org/2005/Atom\" xml:base=\"" . $data->getBase() . "\"";
if ($data->language != "") {
$feed .= " xml:lang=\"" . $data->language . "\"";
}
$feed .= ">\n";
$feed .= "\t<title type=\"text\">" . htmlspecialchars($data->title, ENT_COMPAT, 'UTF-8') . "</title>\n";
$feed .= "\t<subtitle type=\"text\">" . htmlspecialchars($data->description, ENT_COMPAT, 'UTF-8') . "</subtitle>\n";
$feed .= "\t<link rel=\"alternate\" type=\"text/html\" href=\"" . $data->link . "\"/>\n";
$feed .= "\t<id>" . $data->link . "</id>\n";
$feed .= "\t<updated>" . htmlspecialchars($now->toISO8601(), ENT_COMPAT, 'UTF-8') . "</updated>\n";
if ($data->editor != "") {
$feed .= "\t<author>\n";
$feed .= "\t\t<name>" . $data->editor . "</name>\n";
if ($data->editorEmail != "") {
$feed .= "\t\t<email>" . $data->editorEmail . "</email>\n";
}
$feed .= "\t</author>\n";
}
$feed .= "\t<generator uri=\"http://joomla.org\" version=\"1.5\">" . $data->getGenerator() . "</generator>\n";
$feed .= "<link rel=\"self\" type=\"application/atom+xml\" href=\"" . $data->syndicationURL . "\" />\n";
for ($i = 0; $i < count($data->items); $i++) {
$feed .= "\t<entry>\n";
$feed .= "\t\t<title>" . htmlspecialchars(strip_tags($data->items[$i]->title), ENT_COMPAT, 'UTF-8') . "</title>\n";
$feed .= ' <link rel="alternate" type="text/html" href="' . $data->items[$i]->link . "\"/>\n";
if ($data->items[$i]->date == "") {
$data->items[$i]->date = time();
}
$itemDate = new JDate($data->items[$i]->date);
$feed .= "\t\t<published>" . htmlspecialchars($itemDate->toISO8601(), ENT_COMPAT, 'UTF-8') . "</published>\n";
$feed .= "\t\t<updated>" . htmlspecialchars($itemDate->toISO8601(), ENT_COMPAT, 'UTF-8') . "</updated>\n";
$feed .= "\t\t<id>" . htmlspecialchars($data->items[$i]->link, ENT_COMPAT, 'UTF-8') . "</id>\n";
if ($data->items[$i]->author != "") {
$feed .= "\t\t<author>\n";
$feed .= "\t\t\t<name>" . htmlspecialchars($data->items[$i]->author, ENT_COMPAT, 'UTF-8') . "</name>\n";
$feed .= "\t\t</author>\n";
}
if ($data->items[$i]->description != "") {
$feed .= "\t\t<summary type=\"html\">" . htmlspecialchars($data->items[$i]->description, ENT_COMPAT, 'UTF-8') . "</summary>\n";
$feed .= "\t\t<content type=\"html\">" . htmlspecialchars($data->items[$i]->description, ENT_COMPAT, 'UTF-8') . "</content>\n";
}
if ($data->items[$i]->enclosure != NULL) {
$feed .= "\t\t<link rel=\"enclosure\" href=\"" . $data->items[$i]->enclosure->url . "\" type=\"" . $data->items[$i]->enclosure->type . "\" length=\"" . $data->items[$i]->enclosure->length . "\" />\n";
}
$feed .= "\t</entry>\n";
}
$feed .= "</feed>\n";
return $feed;
}
示例2: add
public function add($name, $email, $comment, $ip, JDate $date)
{
$db = JFactory::getDbo();
$query = 'INSERT INTO Comments (Name, Email, Comment, Ip, date)
VALUES (' . $db->quote($name) . ', ' . $db->quote($email) . ', ' . $db->quote($comment) . ', ' . $db->quote(ip2long($ip)) . ', ' . $db->quote($date->toISO8601()) . ');';
$db->setQuery($query);
return $db->execute();
}
示例3: toExternal
/**
* Method to transform an internal representation to an external one.
*
* @param string $definition Field definition.
*
* @return string The date string in ISO 8601 format.
*/
public static function toExternal($definition)
{
if (empty($definition) || $definition == '0000-00-00 00:00:00') {
return '';
}
$date = new JDate($definition);
return $date->toISO8601();
}
示例4: add
private function add()
{
$name = $this->input->post->getString('name');
$email = $this->input->post->getString('email');
$comment = $this->input->post->getString('comment');
if (!empty($name) && !empty($email) && !empty($comment)) {
$ip = $this->input->server->getString('REMOTE_ADDR');
$date = new JDate();
$db = JFactory::getDbo();
$query = 'INSERT INTO Comments (Name, Email, Comment, Ip, date)
VALUES (' . $db->quote($name) . ', ' . $db->quote($email) . ', ' . $db->quote($comment) . ', ' . $db->quote(ip2long($ip)) . ', ' . $db->quote($date->toISO8601()) . ');';
$db->setQuery($query);
$db->execute();
}
$this->redirect('index.php');
}
示例5: getRepositoryList
/**
* Method to get the list of comments in a repository.
*
* @param string $owner The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param string $sort The sort field - created or updated.
* @param string $direction The sort order- asc or desc. Ignored without sort parameter.
* @param JDate $since A timestamp in ISO 8601 format.
*
* @throws UnexpectedValueException
* @throws DomainException
* @since 11.3
*
* @return array
*/
public function getRepositoryList($owner, $repo, $sort = 'created', $direction = 'asc', JDate $since = null)
{
// Build the request path.
$path = '/repos/' . $owner . '/' . $repo . '/issues/comments';
if (false == in_array($sort, array('created', 'updated'))) {
throw new UnexpectedValueException(sprintf('%1$s - sort field must be "created" or "updated"', __METHOD__));
}
if (false == in_array($direction, array('asc', 'desc'))) {
throw new UnexpectedValueException(sprintf('%1$s - direction field must be "asc" or "desc"', __METHOD__));
}
$path .= '?sort=' . $sort;
$path .= '&direction=' . $direction;
if ($since) {
$path .= '&since=' . $since->toISO8601();
}
// Send the request.
return $this->processResponse($this->client->get($this->fetchUrl($path)));
}
示例6: getList
/**
* Method to list commits for a repository.
*
* A special note on pagination: Due to the way Git works, commits are paginated based on SHA
* instead of page number.
* Please follow the link headers as outlined in the pagination overview instead of constructing
* page links yourself.
*
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param string $sha Sha or branch to start listing commits from.
* @param string $path Only commits containing this file path will be returned.
* @param string $author GitHub login, name, or email by which to filter by commit author.
* @param JDate $since ISO 8601 Date - Only commits after this date will be returned.
* @param JDate $until ISO 8601 Date - Only commits before this date will be returned.
*
* @throws DomainException
* @since 12.1
*
* @return array
*/
public function getList($user, $repo, $sha = '', $path = '', $author = '', JDate $since = null, JDate $until = null)
{
// Build the request path.
$rPath = '/repos/' . $user . '/' . $repo . '/commits?';
$rPath .= $sha ? '&sha=' . $sha : '';
$rPath .= $path ? '&path=' . $path : '';
$rPath .= $author ? '&author=' . $author : '';
$rPath .= $since ? '&since=' . $since->toISO8601() : '';
$rPath .= $until ? '&until=' . $until->toISO8601() : '';
// Send the request.
$response = $this->client->get($this->fetchUrl($rPath));
// Validate the response code.
if ($response->code != 200) {
// Decode the error response and throw an exception.
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
return json_decode($response->body);
}
示例7: substr
</video:title>
<video:description><![CDATA[<?php
echo substr($this->apiJsonResponse[0]->description, 0, 2048);
?>
]]></video:description>
<video:player_loc allow_embed="yes" autoplay="ap=1"><?php
echo "http://player.vimeo.com/video/" . $this->videoID;
?>
</video:player_loc>
<video:duration><?php
echo $this->apiJsonResponse[0]->duration;
?>
</video:duration>
<video:view_count><?php
echo $this->apiJsonResponse[0]->stats_number_of_plays;
?>
</video:view_count>
<video:publication_date><?php
$dateObj = new JDate($this->apiJsonResponse[0]->upload_date);
$dateObj->setTimezone(new DateTimeZone('UTC'));
echo $dateObj->toISO8601(true);
?>
</video:publication_date>
<video:uploader><?php
echo htmlspecialchars($this->apiJsonResponse[0]->user_name, ENT_COMPAT, 'UTF-8');
?>
</video:uploader>
<video:live>no</video:live>
</video:video>
<?php
}
示例8: formCallback
private function formCallback($data)
{
JLoader::import('joomla.utilities.date');
$isValid = true;
// Load the relevant subscription row
if ($isValid) {
$id = $data['sid'];
$subscription = null;
if ($id > 0) {
$subscription = F0FModel::getTmpInstance('Subscriptions', 'AkeebasubsModel')->setId($id)->getItem();
if ($subscription->akeebasubs_subscription_id <= 0 || $subscription->akeebasubs_subscription_id != $id) {
$subscription = null;
$isValid = false;
}
} else {
$isValid = false;
}
if (!$isValid) {
$responseData['akeebasubs_failure_reason'] = 'The subscription ID is invalid';
}
}
if ($isValid && isset($data['token']) && isset($data['PayerID'])) {
$level = F0FModel::getTmpInstance('Levels', 'AkeebasubsModel')->setId($subscription->akeebasubs_level_id)->getItem();
$requestData = (object) array('METHOD' => 'DoExpressCheckoutPayment', 'USER' => $this->getMerchantUsername(), 'PWD' => $this->getMerchantPassword(), 'SIGNATURE' => $this->getMerchantSignature(), 'VERSION' => '85.0', 'TOKEN' => $data['token'], 'PAYERID' => $data['PayerID'], 'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale', 'PAYMENTREQUEST_0_AMT' => sprintf('%.2f', $subscription->gross_amount), 'PAYMENTREQUEST_0_CURRENCYCODE' => strtoupper(AkeebasubsHelperCparams::getParam('currency', 'EUR')), 'PAYMENTREQUEST_0_INVNUM' => $subscription->akeebasubs_subscription_id, 'PAYMENTREQUEST_0_DESC' => '[' . $subscription->akeebasubs_subscription_id . '] ' . $level->title, 'IPADDRESS' => $_SERVER['REMOTE_ADDR']);
$requestQuery = http_build_query($requestData);
$requestContext = stream_context_create(array('http' => array('method' => 'POST', 'header' => "Connection: close\r\n" . "Content-Length: " . strlen($requestQuery) . "\r\n", 'content' => $requestQuery)));
$responseQuery = file_get_contents($this->getPaymentURL(), false, $requestContext);
// Payment Response
$responseData = array();
parse_str($responseQuery, $responseData);
if (!preg_match('/^SUCCESS/', strtoupper($responseData['ACK']))) {
$isValid = false;
$level = F0FModel::getTmpInstance('Levels', 'AkeebasubsModel')->setId($subscription->akeebasubs_level_id)->getItem();
$error_url = 'index.php?option=' . JRequest::getCmd('option') . '&view=level&slug=' . $level->slug . '&layout=' . JRequest::getCmd('layout', 'default');
$error_url = JRoute::_($error_url, false);
JFactory::getApplication()->redirect($error_url, $responseData['L_LONGMESSAGE0'], 'error');
} else {
if (!preg_match('/^SUCCESS/', strtoupper($responseData['PAYMENTINFO_0_ACK']))) {
$isValid = false;
$responseData['akeebasubs_failure_reason'] = "PayPal error code: " . $responseData['PAYMENTINFO_0_ERRORCODE'];
}
}
if ($level->recurring) {
// Create recurring payment profile
$nextPayment = new JDate("+{$level->duration} day");
$callbackUrl = JURI::base() . 'index.php?option=com_akeebasubs&view=callback&paymentmethod=paypalproexpress&sid=' . $subscription->akeebasubs_subscription_id;
$recurringRequestData = (object) array('METHOD' => 'CreateRecurringPaymentsProfile', 'NOTIFYURL' => $callbackUrl, 'USER' => $this->getMerchantUsername(), 'PWD' => $this->getMerchantPassword(), 'SIGNATURE' => $this->getMerchantSignature(), 'VERSION' => '85.0', 'PAYMENTACTION' => 'Sale', 'TOKEN' => $data['token'], 'PAYERID' => $data['PayerID'], 'IPADDRESS' => $_SERVER['REMOTE_ADDR'], 'AMT' => sprintf('%.2f', $subscription->gross_amount), 'TAXAMT' => sprintf('%.2f', $subscription->tax_amount), 'CURRENCYCODE' => strtoupper(AkeebasubsHelperCparams::getParam('currency', 'EUR')), 'DESC' => $level->title, 'PROFILEREFERENCE' => $subscription->akeebasubs_subscription_id, 'PROFILESTARTDATE' => $nextPayment->toISO8601(), 'BILLINGPERIOD' => 'Day', 'BILLINGFREQUENCY' => $level->duration);
$recurringRequestQuery = http_build_query($recurringRequestData);
$recurringRequestContext = stream_context_create(array('http' => array('method' => 'POST', 'header' => "Connection: close\r\n" . "Content-Length: " . strlen($recurringRequestQuery) . "\r\n", 'content' => $recurringRequestQuery)));
$recurringResponseQuery = file_get_contents($this->getPaymentURL(), false, $recurringRequestContext);
// Response of payment profile
$recurringResponseData = array();
parse_str($recurringResponseQuery, $recurringResponseData);
if (!preg_match('/^SUCCESS/', strtoupper($recurringResponseData['ACK']))) {
$isValid = false;
$error_url = 'index.php?option=' . JRequest::getCmd('option') . '&view=level&slug=' . $level->slug . '&layout=' . JRequest::getCmd('layout', 'default');
$error_url = JRoute::_($error_url, false);
JFactory::getApplication()->redirect($error_url, $recurringResponseData['L_LONGMESSAGE0'], 'error');
} else {
$recurringCheckData = (object) array('METHOD' => 'GetRecurringPaymentsProfileDetails', 'USER' => $this->getMerchantUsername(), 'PWD' => $this->getMerchantPassword(), 'SIGNATURE' => $this->getMerchantSignature(), 'VERSION' => '85.0', 'PROFILEID' => $recurringResponseData['PROFILEID']);
$recurringCheckQuery = http_build_query($recurringCheckData);
$recurringCheckContext = stream_context_create(array('http' => array('method' => 'POST', 'header' => "Connection: close\r\n" . "Content-Length: " . strlen($recurringCheckQuery) . "\r\n", 'content' => $recurringCheckQuery)));
$recurringCheckQuery = file_get_contents($this->getPaymentURL(), false, $recurringCheckContext);
// Response of payment profile
$recurringCheckData = array();
parse_str($recurringCheckQuery, $recurringCheckData);
if (!preg_match('/^SUCCESS/', strtoupper($recurringCheckData['ACK']))) {
$isValid = false;
$error_url = 'index.php?option=' . JRequest::getCmd('option') . '&view=level&slug=' . $level->slug . '&layout=' . JRequest::getCmd('layout', 'default');
$error_url = JRoute::_($error_url, false);
JFactory::getApplication()->redirect($error_url, $recurringCheckData['L_LONGMESSAGE0'], 'error');
}
if (strtoupper($responseData['PAYMENTINFO_0_CURRENCYCODE']) !== strtoupper($recurringCheckData['CURRENCYCODE'])) {
$isValid = false;
$responseData['akeebasubs_failure_reason'] = "Currency code doesn't match.";
}
if (strtoupper($responseData['PAYMENTINFO_0_AMT']) !== strtoupper($recurringCheckData['AMT'])) {
$isValid = false;
$responseData['akeebasubs_failure_reason'] = "Amount doesn't match.";
}
if (strtoupper($recurringCheckData['BILLINGPERIOD']) !== "DAY") {
$isValid = false;
$responseData['akeebasubs_failure_reason'] = "Recurring period doesn't match.";
}
if ($recurringCheckData['BILLINGFREQUENCY'] != $level->duration) {
$isValid = false;
$responseData['akeebasubs_failure_reason'] = "Recurring duration doesn't match";
}
}
}
}
if ($isValid && !is_null($subscription)) {
if ($subscription->processor_key == $responseData['PAYMENTINFO_0_TRANSACTIONID']) {
$isValid = false;
$responseData['akeebasubs_failure_reason'] = "I will not process the same TRANSACTIONID " . $responseData['PAYMENTINFO_0_TRANSACTIONID'] . " twice";
}
}
if ($isValid) {
if (strtoupper(AkeebasubsHelperCparams::getParam('currency', 'EUR')) != strtoupper($responseData['PAYMENTINFO_0_CURRENCYCODE'])) {
$isValid = false;
//.........这里部分代码省略.........
示例9: markReadRepository
/**
* Mark notifications as read in a repository.
*
* Marking all notifications in a repository as “read” removes them from the default view on GitHub.com.
*
* @param string $owner Repository owner.
* @param string $repo Repository name.
* @param boolean $unread Changes the unread status of the threads.
* @param boolean $read Inverse of “unread”.
* @param JDate $last_read_at Describes the last point that notifications were checked.
* Anything updated since this time will not be updated. Default: Now. Expected in ISO 8601 format.
*
* @since 3.3 (CMS)
*
* @return object
*/
public function markReadRepository($owner, $repo, $unread, $read, JDate $last_read_at = null)
{
// Build the request path.
$path = '/repos/' . $owner . '/' . $repo . '/notifications';
$data = array('unread' => $unread, 'read' => $read);
if ($last_read_at) {
$data['last_read_at'] = $last_read_at->toISO8601();
}
return $this->processResponse($this->client->put($this->fetchUrl($path), json_encode($data)), 205);
}
示例10: testToISO8601
/**
* Testing toISO8601
*
* @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 casesToISO8601
**/
public function testToISO8601($tz, $setTime, $local, $expected)
{
if (is_null($tz)) {
$testJDate = new JDate($setTime);
} else {
$testJDate = new JDate($setTime, $tz);
}
$this->assertThat($testJDate->toISO8601($local), $this->equalTo($expected));
}
示例11: getListByRepository
/**
* Method to list issues.
*
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param string $milestone The milestone number, 'none', or *.
* @param string $state The optional state to filter requests by. [open, closed]
* @param string $assignee The assignee name, 'none', or *.
* @param string $mentioned The GitHub user name.
* @param string $labels The list of comma separated Label names. Example: bug,ui,@high.
* @param string $sort The sort order: created, updated, comments, default: created.
* @param string $direction The list direction: asc or desc, default: desc.
* @param JDate $since The date/time since when issues should be returned.
* @param integer $page The page number from which to get items.
* @param integer $limit The number of items on a page.
*
* @throws DomainException
* @since 11.3
*
* @return array
*/
public function getListByRepository($user, $repo, $milestone = null, $state = null, $assignee = null, $mentioned = null, $labels = null, $sort = null, $direction = null, JDate $since = null, $page = 0, $limit = 0)
{
// Build the request path.
$path = '/repos/' . $user . '/' . $repo . '/issues';
$uri = new JUri($this->fetchUrl($path, $page, $limit));
if ($milestone) {
$uri->setVar('milestone', $milestone);
}
if ($state) {
$uri->setVar('state', $state);
}
if ($assignee) {
$uri->setVar('assignee', $assignee);
}
if ($mentioned) {
$uri->setVar('mentioned', $mentioned);
}
if ($labels) {
$uri->setVar('labels', $labels);
}
if ($sort) {
$uri->setVar('sort', $sort);
}
if ($direction) {
$uri->setVar('direction', $direction);
}
if ($since) {
$uri->setVar('since', $since->toISO8601());
}
// Send the request.
$response = $this->client->get((string) $uri);
// Validate the response code.
if ($response->code != 200) {
// Decode the error response and throw an exception.
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
return json_decode($response->body);
}
示例12: __construct
/**
* Class constructor
*
* @access public
* @param string $format
* @param string $language
* @return Object&
*/
public function __construct($format, $language)
{
// Init properties
$this->format = $format;
$this->language = $language;
// Date format for index XML file
$dateObj = new JDate();
$globalConfig = JFactory::getConfig();
$dateObj->setTimezone(new DateTimeZone($globalConfig->get('offset')));
$this->ISO8601Date = $dateObj->toISO8601(true);
// Live site for index XML file
$uriInstance = JURI::getInstance();
$this->liveSite = $uriInstance->getScheme() . '://' . $uriInstance->getHost() . '/';
// Create DOM model
$this->doc = new DOMDocument();
$this->chunkFiles = array();
$this->targetTag = null;
$this->chunksCounter = 0;
$this->itemLimit = 5;
}
示例13: getFormattedDate
function getFormattedDate($strdate, $format = 'd m Y')
{
jimport('joomla.utilities.date');
$user =& JFactory::getUser();
if ($user->get('id')) {
$tz = $user->getParam('timezone');
} else {
$conf =& JFactory::getConfig();
$tz = $conf->getValue('config.offset');
}
// Given time
$jdate = new JDate($strdate);
$jdate->setOffset($tz);
$date = $jdate->toISO8601();
return Date_Difference::getStringResolved($date);
}
示例14: __construct
/**
* Class constructor
*
* @access public
* @param string $format
* @param string $language
* @param int $dataset
* @return Object&
*/
public function __construct($format, $language, $dataset)
{
// Init properties
$this->format = $format;
$this->language = $language;
$this->dataset = $dataset;
$this->cParams = JComponentHelper::getParams('com_jmap');
// Default root nodes
$this->defaultRootNodes = array('xml' => array('rootNodeName' => 'urlset', 'rootNodeAttributes' => 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"'), 'images' => array('rootNodeName' => 'urlset', 'rootNodeAttributes' => 'xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"'), 'gnews' => array('rootNodeName' => 'urlset', 'rootNodeAttributes' => 'xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"'), 'mobile' => array('rootNodeName' => 'urlset', 'rootNodeAttributes' => 'xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"'), 'videos' => array('rootNodeName' => 'urlset', 'rootNodeAttributes' => 'xmlns:video="http://www.google.com/schemas/sitemap-video/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"'));
// Date format for index XML file
$dateObj = new JDate();
$globalConfig = JFactory::getConfig();
$dateObj->setTimezone(new DateTimeZone($globalConfig->get('offset')));
$this->ISO8601Date = $dateObj->toISO8601(true);
// Live site for index XML file
$uriInstance = JURI::getInstance();
$this->liveSite = $uriInstance->getScheme() . '://' . $uriInstance->getHost() . '/';
// Create DOM model
$this->doc = new DOMDocument();
$this->chunkFiles = array();
$this->targetTag = null;
$this->chunksCounter = 0;
$this->itemLimit = 5;
}
示例15: formCallback
private function formCallback($data)
{
JLoader::import('joomla.utilities.date');
$isRecurring = $data['METHOD'] == 'CreateRecurringPaymentsProfile';
$jNow = new JDate();
$responseData = array();
// Load the relevant subscription row
$isValid = true;
if ($isValid) {
$id = $isRecurring ? (int) $data['PROFILEREFERENCE'] : (int) $data['INVNUM'];
$subscription = null;
if ($id > 0) {
$subscription = F0FModel::getTmpInstance('Subscriptions', 'AkeebasubsModel')->setId($id)->getItem();
if ($subscription->akeebasubs_subscription_id <= 0 || $subscription->akeebasubs_subscription_id != $id) {
$subscription = null;
$isValid = false;
}
} else {
$isValid = false;
}
if (!$isValid) {
$responseData['akeebasubs_failure_reason'] = 'The referenced subscription ID is invalid';
}
}
// Call paypal to check the payment
if ($isValid) {
// Build the payment request
$requestData = array();
foreach ($data as $key => $val) {
if ($key == 'option' || $key == 'view' || $key == 'paymentmethod') {
continue;
}
$requestData[$key] = trim($val);
if ($key == 'CVV2') {
break;
}
}
if ($isRecurring) {
$requestData['PROFILESTARTDATE'] = $jNow->toISO8601();
}
$requestQuery = http_build_query($requestData);
if ($this->getApiMethod() == 'file_get_contents') {
$requestContext = stream_context_create(array('http' => array('method' => 'POST', 'header' => "Connection: close\r\n" . "Content-Length: " . strlen($requestQuery) . "\r\n", 'content' => $requestQuery)));
$responseQuery = file_get_contents($this->getPaymentURL(), false, $requestContext);
} else {
$http_header = array('X-PAYPAL-SECURITY-USERID' => $this->getMerchantUsername(), 'X-PAYPAL-SECURITY-PASSWORD' => $this->getMerchantPassword(), 'X-PAYPAL-SECURITY-SIGNATURE' => $this->getMerchantSignature());
$curlOptions = array(CURLOPT_HTTPHEADER => $http_header, CURLOPT_URL => $this->getPaymentURL(), CURLOPT_VERBOSE => 1, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_RETURNTRANSFER => 1, CURLOPT_POST => 1, CURLOPT_POSTFIELDS => $requestQuery);
$ch = curl_init();
curl_setopt_array($ch, $curlOptions);
$responseQuery = curl_exec($ch);
//make the request
if (curl_errno($ch)) {
$this->_errors = curl_error($ch);
curl_close($ch);
return false;
} else {
curl_close($ch);
}
}
// Payment Response
parse_str($responseQuery, $responseData);
if (!preg_match('/^Success/', $responseData['ACK'])) {
$responseData['akeebasubs_failure_reason'] = $responseData['L_LONGMESSAGE0'];
$isValid = false;
} else {
if ($isRecurring) {
// If recurring payment do another request to paypal, to receive
// the details (the amount and transaction id) of the payment.
$recDetailsRequestData = array('METHOD' => 'GetRecurringPaymentsProfileDetails', 'USER' => $this->getMerchantUsername(), 'PWD' => $this->getMerchantPassword(), 'SIGNATURE' => $this->getMerchantSignature(), 'VERSION' => '85.0', 'PROFILEID' => $responseData['PROFILEID']);
$recDetailsRequestQuery = http_build_query($recDetailsRequestData);
$recDetailsRequestContext = stream_context_create(array('http' => array('method' => 'POST', 'header' => "Connection: close\r\n" . "Content-Length: " . strlen($recDetailsRequestQuery) . "\r\n", 'content' => $recDetailsRequestQuery)));
$recDetailsResponseQuery = file_get_contents($this->getPaymentURL(), false, $recDetailsRequestContext);
$recDetailsResponseData = array();
parse_str($recDetailsResponseQuery, $recDetailsResponseData);
$responseData = $recDetailsResponseData;
if (!preg_match('/^Success/', $responseData['ACK'])) {
$responseData['akeebasubs_failure_reason'] = $responseData['L_LONGMESSAGE0'];
$isValid = false;
}
}
}
}
// Check that TRANSACTIONID has not been previously processed
$transactionId = $isRecurring ? $responseData['CORRELATIONID'] : $responseData['TRANSACTIONID'];
if ($isValid && !is_null($subscription)) {
if ($subscription->processor_key == $transactionId) {
$isValid = false;
$responseData['akeebasubs_failure_reason'] = "I will not process the same TRANSACTIONID/CORRELATIONID " . $responseData['TRANSACTIONID'] . " twice";
}
}
// Check that CURRENCYCODE is correct
if ($isValid && !is_null($subscription)) {
$currency = strtoupper(AkeebasubsHelperCparams::getParam('currency', 'EUR'));
if ($currency != $responseData['CURRENCYCODE']) {
$isValid = false;
$responseData['akeebasubs_failure_reason'] = "The currency code doesn't match (expected: " . $currency . ", received: " . $responseData['CURRENCYCODE'] . ")";
}
}
// Check that amount is correct
$isPartialRefund = false;
//.........这里部分代码省略.........