当前位置: 首页>>代码示例>>PHP>>正文


PHP JString::strcmp方法代码示例

本文整理汇总了PHP中JString::strcmp方法的典型用法代码示例。如果您正苦于以下问题:PHP JString::strcmp方法的具体用法?PHP JString::strcmp怎么用?PHP JString::strcmp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JString的用法示例。


在下文中一共展示了JString::strcmp方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _sortObjects

 /**
  * Callback function for sorting an array of objects on a key
  *
  * @param   array  &$a  An array of objects
  * @param   array  &$b  An array of objects
  *
  * @return  integer  Comparison status
  *
  * @see     JArrayHelper::sortObjects()
  * @since   11.1
  */
 protected static function _sortObjects(&$a, &$b)
 {
     $key = self::$sortKey;
     for ($i = 0, $count = count($key); $i < $count; $i++) {
         if (isset(self::$sortDirection[$i])) {
             $direction = self::$sortDirection[$i];
         }
         if (isset(self::$sortCase[$i])) {
             $caseSensitive = self::$sortCase[$i];
         }
         if (isset(self::$sortLocale[$i])) {
             $locale = self::$sortLocale[$i];
         }
         $va = $a->{$key[$i]};
         $vb = $b->{$key[$i]};
         if ((is_bool($va) || is_numeric($va)) && (is_bool($vb) || is_numeric($vb))) {
             $cmp = $va - $vb;
         } elseif ($caseSensitive) {
             $cmp = JString::strcmp($va, $vb, $locale);
         } else {
             $cmp = JString::strcasecmp($va, $vb, $locale);
         }
         if ($cmp > 0) {
             return $direction;
         }
         if ($cmp < 0) {
             return -$direction;
         }
     }
     return 0;
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:42,代码来源:arrayhelper.php

示例2: testStrcmp

 /**
  * @group String
  * @covers JString::strcmp
  * @dataProvider strcmpData
  */
 public function testStrcmp($string1, $string2, $locale, $expect)
 {
     if (substr(php_uname(), 0, 6) == 'Darwin' && $locale != false) {
         $this->markTestSkipped('Darwin bug prevents foreign conversion from working properly');
     } else {
         $actual = JString::strcmp($string1, $string2, $locale);
         if ($actual != 0) {
             $actual = $actual / abs($actual);
         }
         $this->assertEquals($expect, $actual);
     }
 }
开发者ID:GMaup,项目名称:joomla-platform,代码行数:17,代码来源:JStringTest.php

示例3: _sortObjects

 /**
  * Callback function for sorting an array of objects on a key
  *
  * @param   array    $a	An array of objects
  * @param   array    $b	An array of objects
  *
  * @return  integer  	Comparison status
  * @since   11.1
  * @see		JArrayHelper::sortObjects()
  */
 protected static function _sortObjects(&$a, &$b)
 {
     $params = $GLOBALS['JAH_so'];
     for ($i = 0, $count = count($params['key']); $i < $count; $i++) {
         if (isset($params['direction'][$i])) {
             $direction = $params['direction'][$i];
         }
         if (isset($params['casesensitive'][$i])) {
             $casesensitive = $params['casesensitive'][$i];
         }
         if (isset($params['locale'][$i])) {
             $locale = $params['locale'][$i];
         }
         $va = $a->{$params}['key'][$i];
         $vb = $b->{$params}['key'][$i];
         if ((is_bool($va) or is_numeric($va)) and (is_bool($vb) or is_numeric($vb))) {
             $cmp = $va - $vb;
         } elseif ($casesensitive) {
             $cmp = JString::strcmp($va, $vb, $locale);
         } else {
             $cmp = JString::strcasecmp($va, $vb, $locale);
         }
         if ($cmp > 0) {
             return $direction;
         }
         if ($cmp < 0) {
             return -$direction;
         }
     }
     return 0;
 }
开发者ID:ramdesh,项目名称:joomla-platform,代码行数:41,代码来源:arrayhelper.php

示例4: _monthToEnglish

 /**
  * Part of horrible hack for translating non-English words back
  * to something MySQL will understand.
  *
  * @param   string $month Original month name
  * @param   bool   $abbr  Is the month abbreviated
  *
  * @return  string  English month name
  */
 private function _monthToEnglish($month, $abbr = false)
 {
     if ($abbr) {
         if (JString::strcmp($month, FText::_('JANUARY_SHORT')) === 0) {
             return 'Jan';
         }
         if (JString::strcmp($month, FText::_('FEBRUARY_SHORT')) === 0) {
             return 'Feb';
         }
         if (JString::strcmp($month, FText::_('MARCH_SHORT')) === 0) {
             return 'Mar';
         }
         if (JString::strcmp($month, FText::_('APRIL_SHORT')) === 0) {
             return 'Apr';
         }
         if (JString::strcmp($month, FText::_('MAY_SHORT')) === 0) {
             return 'May';
         }
         if (JString::strcmp($month, FText::_('JUNE_SHORT')) === 0) {
             return 'Jun';
         }
         if (JString::strcmp($month, FText::_('JULY_SHORT')) === 0) {
             return 'Jul';
         }
         if (JString::strcmp($month, FText::_('AUGUST_SHORT')) === 0) {
             return 'Aug';
         }
         if (JString::strcmp($month, FText::_('SEPTEMBER_SHORT')) === 0) {
             return 'Sep';
         }
         if (JString::strcmp($month, FText::_('OCTOBER_SHORT')) === 0) {
             return 'Oct';
         }
         if (JString::strcmp($month, FText::_('NOVEMBER_SHORT')) === 0) {
             return 'Nov';
         }
         if (JString::strcmp($month, FText::_('DECEMBER_SHORT')) === 0) {
             return 'Dec';
         }
     } else {
         if (JString::strcmp($month, FText::_('JANUARY')) === 0) {
             return 'January';
         }
         if (JString::strcmp($month, FText::_('FEBRUARY')) === 0) {
             return 'February';
         }
         if (JString::strcmp($month, FText::_('MARCH')) === 0) {
             return 'March';
         }
         if (JString::strcmp($month, FText::_('APRIL')) === 0) {
             return 'April';
         }
         if (JString::strcmp($month, FText::_('MAY')) === 0) {
             return 'May';
         }
         if (JString::strcmp($month, FText::_('JUNE')) === 0) {
             return 'June';
         }
         if (JString::strcmp($month, FText::_('JULY')) === 0) {
             return 'July';
         }
         if (JString::strcmp($month, FText::_('AUGUST')) === 0) {
             return 'August';
         }
         if (JString::strcmp($month, FText::_('SEPTEMBER')) === 0) {
             return 'September';
         }
         if (JString::strcmp($month, FText::_('OCTOBER')) === 0) {
             return 'October';
         }
         if (JString::strcmp($month, FText::_('NOVEMBER')) === 0) {
             return 'November';
         }
         if (JString::strcmp($month, FText::_('DECEMBER')) === 0) {
             return 'December';
         }
     }
     return $month;
 }
开发者ID:glauberm,项目名称:cinevi,代码行数:88,代码来源:date.php

示例5: onIpn

 /**
  * Called from paypal at the end of the transaction
  *
  * @return  void
  */
 public function onIpn()
 {
     $config = JFactory::getConfig();
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_fabrik/tables');
     $log = FabTable::getInstance('log', 'FabrikTable');
     $log->referring_url = $_SERVER['REQUEST_URI'];
     $log->message_type = 'fabrik.ipn.start';
     $log->message = json_encode($_REQUEST);
     $log->store();
     // Lets try to load in the custom returned value so we can load up the form and its parameters
     $custom = JRequest::getVar('custom');
     list($formid, $rowid, $ipn_value) = explode(":", $custom);
     // Pretty sure they are added but double add
     JModel::addIncludePath(COM_FABRIK_FRONTEND . '/models');
     $formModel = JModel::getInstance('Form', 'FabrikFEModel');
     $formModel->setId($formid);
     $listModel = $formModel->getlistModel();
     $params = $formModel->getParams();
     $table = $listModel->getTable();
     $db = $listModel->getDb();
     $query = $db->getQuery(true);
     /* $$$ hugh
      * @TODO shortColName won't handle joined data, need to fix this to use safeColName
      * (don't forget to change quoteName stuff later on as well)
      */
     $renderOrder = JRequest::getInt('renderOrder');
     $ipn_txn_field = (array) $params->get('paypal_ipn_txn_id_element', array());
     $ipn_txn_field = FabrikString::shortColName($ipn_txn_field[$renderOrder]);
     $ipn_payment_field = (array) $params->get('paypal_ipn_payment_element', array());
     $ipn_payment_field = FabrikString::shortColName($ipn_payment_field[$renderOrder]);
     $ipn_field = (array) $params->get('paypal_ipn_element', array());
     $ipn_field = FabrikString::shortColName($ipn_field[$renderOrder]);
     $ipn_status_field = (array) $params->get('paypal_ipn_status_element', array());
     $ipn_status_field = FabrikString::shortColName($ipn_status_field[$renderOrder]);
     $ipn_address_field = (array) $params->get('paypal_ipn_address_element', array());
     $ipn_address_field = FabrikString::shortColName($ipn_address_field[$renderOrder]);
     $w = new FabrikWorker();
     $ipn_value = str_replace('[', '{', $ipn_value);
     $ipn_value = str_replace(']', '}', $ipn_value);
     $ipn_value = $w->parseMessageForPlaceHolder($ipn_value, $_POST);
     $email_from = $admin_email = $config->get('mailfrom');
     // Read the post from PayPal system and add 'cmd'
     $req = 'cmd=_notify-validate';
     foreach ($_POST as $key => $value) {
         $value = urlencode(stripslashes($value));
         $req .= "&{$key}={$value}";
     }
     // Post back to PayPal system to validate
     $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
     $header .= "Host: www.paypal.com:443\r\n";
     $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
     $header .= "Content-Length: " . JString::strlen($req) . "\r\n\r\n";
     if ($_POST['test_ipn'] == 1) {
         $paypalurl = 'ssl://www.sandbox.paypal.com';
     } else {
         $paypalurl = 'ssl://www.paypal.com';
     }
     // Assign posted variables to local variables
     $item_name = JRequest::getVar('item_name');
     $item_number = JRequest::getVar('item_number');
     $payment_status = JRequest::getVar('payment_status');
     $payment_amount = JRequest::getVar('mc_gross');
     $payment_currency = JRequest::getVar('mc_currency');
     $txn_id = JRequest::getVar('txn_id');
     $txn_type = JRequest::getVar('txn_type');
     $receiver_email = JRequest::getVar('receiver_email');
     $payer_email = JRequest::getVar('payer_email');
     $buyer_address = JRequest::getVar('address_status') . ' - ' . JRequest::getVar('address_street') . ' ' . JRequest::getVar('address_zip') . ' ' . JRequest::getVar('address_state') . ' ' . JRequest::getVar('address_city') . ' ' . JRequest::getVar('address_country_code');
     $status = 'ok';
     $err_msg = '';
     if (empty($formid) || empty($rowid)) {
         $status = 'form.paypal.ipnfailure.custom_error';
         $err_msg = "formid or rowid empty in custom: {$custom}";
     } else {
         // @TODO implement a curl alternative as fsockopen is not always available
         $fp = fsockopen($paypalurl, 443, $errno, $errstr, 30);
         if (!$fp) {
             $status = 'form.paypal.ipnfailure.fsock_error';
             $err_msg = "fsock error: {$errno};{$errstr}";
         } else {
             fputs($fp, $header . $req);
             while (!feof($fp)) {
                 $res = fgets($fp, 1024);
                 /* paypal steps (from their docs):
                  * check the payment_status is Completed
                  * check that txn_id has not been previously processed
                  * check that receiver_email is your Primary PayPal email
                  * check that payment_amount/payment_currency are correct
                  * process payment
                  */
                 if (JString::strcmp($res, "VERIFIED") == 0) {
                     // $$tom This block Paypal from updating the IPN field if the payment status evolves (e.g. from Pending to Completed)
                     // $$$ hugh - added check of status, so only barf if there is a status field, and it is Completed for this txn_id
                     if (!empty($ipn_txn_field) && !empty($ipn_status_field)) {
                         $query->clear();
//.........这里部分代码省略.........
开发者ID:rogeriocc,项目名称:fabrik,代码行数:101,代码来源:paypal.php

示例6: testStrcmp

 /**
  * @return  array
  *
  * @dataProvider  getStrcmpData
  * @since   11.2
  * @covers  JString::strcmp
  */
 public function testStrcmp($string1, $string2, $locale, $expect)
 {
     if (substr(php_uname(), 0, 6) == 'Darwin' && $locale != false) {
         $this->markTestSkipped('Darwin bug prevents foreign conversion from working properly');
     } elseif ($locale != false && !setlocale(LC_COLLATE, $locale)) {
         // If the locale is not available, we can't have to transcode the string and can't reliably compare it.
         $this->markTestSkipped("Locale {$locale} is not available.");
     } else {
         $actual = JString::strcmp($string1, $string2, $locale);
         if ($actual != 0) {
             $actual = $actual / abs($actual);
         }
         $this->assertEquals($expect, $actual);
     }
 }
开发者ID:nprasath002,项目名称:joomla-platform,代码行数:22,代码来源:JStringTest.php

示例7: onIpn

 /**
  * Called from subscriptions at the end of the transaction
  *
  * @return  void
  */
 public function onIpn()
 {
     $config = JFactory::getConfig();
     $log = FabTable::getInstance('log', 'FabrikTable');
     $log->referring_url = $_SERVER['REQUEST_URI'];
     $log->message_type = 'fabrik.ipn.start';
     $log->message = json_encode($_REQUEST);
     $log->store();
     // Lets try to load in the custom returned value so we can load up the form and its parameters
     $custom = JRequest::getVar('custom');
     list($formid, $rowid) = explode(":", $custom);
     // Pretty sure they are added but double add
     JModel::addIncludePath(COM_FABRIK_FRONTEND . '/models');
     $formModel = JModel::getInstance('Form', 'FabrikFEModel');
     $formModel->setId($formid);
     $listModel = $formModel->getlistModel();
     $params = $formModel->getParams();
     $table = $listModel->getTable();
     $db = $listModel->getDb();
     $renderOrder = JRequest::getInt('renderOrder');
     $ipn_txn_field = 'pp_txn_id';
     $ipn_payment_field = 'amount';
     $ipn_status_field = 'pp_payment_status';
     $w = $this->getWorker();
     $email_from = $admin_email = $config->get('mailfrom');
     // Read the post from Subscriptions system and add 'cmd'
     $req = 'cmd=_notify-validate';
     foreach ($_POST as $key => $value) {
         $value = urlencode(stripslashes($value));
         $req .= '&' . $key . '=' . $value;
     }
     // Post back to Subscriptions system to validate
     $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
     $header .= "Host: www.paypal.com:443\r\n";
     $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
     $header .= "Content-Length: " . JString::strlen($req) . "\r\n\r\n";
     /* $test = '{"option":"com_fabrik","task":"plugin.pluginAjax","formid":"22","g":"form","plugin":"subscriptions","method":"ipn","XDEBUG_SESSION_START":"shiny","renderOrder":"2","txn_type":"subscr_signup","subscr_id":"I-YU0M7L86HA4T","last_name":"User","residence_country":"GB","mc_currency":"EUR","item_name":"fabrikar.com Monthly Professional  User: professional-recurring-monthly (professional-recurring-monthly)","business":"seller_1229696802_biz@pollen-8.co.uk","recurring":"1","address_street":"1 Main Terrace","verify_sign":"A4ffosV9eZnI9PfOxrUT6ColxyFXA.HeejgAGPEcuVvbmovNY04R-Or-","payer_status":"unverified","test_ipn":"1","payer_email":"buyer_1229696752_per@pollen-8.co.uk","address_status":"confirmed","first_name":"Test","receiver_email":"seller_1229696802_biz@pollen-8.co.uk","address_country_code":"GB","payer_id":"TUCWSC3SURGAN","invoice":"503df6ec03b469.74349485","address_city":"Wolverhampton","reattempt":"1","address_state":"West Midlands","subscr_date":"04:03:28 Aug 29, 2012 PDT","address_zip":"W12 4LQ","custom":"22:6703","charset":"windows-1252","notify_version":"3.5","period3":"1 M","address_country":"United Kingdom","mc_amount3":"40.00","address_name":"Test User","ipn_track_id":"a20981d869e98","Itemid":"77","view":"plugin"}';
     		$test = JArrayHelper::fromObject(json_decode($test));
     		echo "<pre>";print_r($test);exit; */
     $subscriptionsurl = $_POST['test_ipn'] == 1 ? 'ssl://www.sandbox.paypal.com' : 'ssl://www.paypal.com';
     // Assign posted variables to local variables
     $item_name = JRequest::getVar('item_name');
     $item_number = JRequest::getVar('item_number');
     $payment_status = JRequest::getVar('payment_status');
     $payment_amount = JRequest::getVar('mc_gross');
     $payment_currency = JRequest::getVar('mc_currency');
     $txn_id = JRequest::getVar('txn_id');
     $txn_type = JRequest::getVar('txn_type');
     $receiver_email = JRequest::getVar('receiver_email');
     $payer_email = JRequest::getVar('payer_email');
     $status = 'ok';
     $err_msg = '';
     if (empty($formid) || empty($rowid)) {
         $status = 'form.subscriptions.ipnfailure.custom_error';
         $err_msg = "formid or rowid empty in custom: {$custom}";
     } else {
         // @TODO implement a curl alternative as fsockopen is not always available
         $fp = fsockopen($subscriptionsurl, 443, $errno, $errstr, 30);
         if (!$fp) {
             $status = 'form.subscriptions.ipnfailure.fsock_error';
             $err_msg = "fsock error: {$errno};{$errstr}";
         } else {
             fputs($fp, $header . $req);
             while (!feof($fp)) {
                 $res = fgets($fp, 1024);
                 /*subscriptions steps (from their docs):
                  * check the payment_status is Completed
                  * check that txn_id has not been previously processed
                  * check that receiver_email is your Primary Subscriptions email
                  * check that payment_amount/payment_currency are correct
                  * process payment
                  */
                 if (JString::strcmp($res, "VERIFIED") == 0) {
                     $query = $db->getQuery(true);
                     $query->select($ipn_status_field)->from('#__fabrik_subs_invoices')->where($db->quoteName($ipn_txn_field) . ' = ' . $db->quote($txn_id));
                     $db->setQuery($query);
                     $txn_result = $db->loadResult();
                     if (!empty($txn_result)) {
                         if ($txn_result == 'Completed') {
                             if ($payment_status != 'Reversed' && $payment_status != 'Refunded') {
                                 $status = 'form.subscriptions.ipnfailure.txn_seen';
                                 $err_msg = "transaction id already seen as Completed, new payment status makes no sense: {$txn_id}, {$payment_status}";
                             }
                         } elseif ($txn_result == 'Reversed') {
                             if ($payment_status != 'Canceled_Reversal') {
                                 $status = 'form.subscriptions.ipnfailure.txn_seen';
                                 $err_msg = "transaction id already seen as Reversed, new payment status makes no sense: {$txn_id}, {$payment_status}";
                             }
                         }
                     }
                     if ($status == 'ok') {
                         $set_list = array();
                         $set_list[$ipn_txn_field] = $txn_id;
                         $set_list[$ipn_payment_field] = $payment_amount;
                         $set_list[$ipn_status_field] = $payment_status;
//.........这里部分代码省略.........
开发者ID:rogeriocc,项目名称:fabrik,代码行数:101,代码来源:subscriptions.php

示例8: isValidPaymentGateway

 /**
  * Check for valid payment gateway.
  *
  * @param string $gateway
  *
  * @return bool
  */
 protected function isValidPaymentGateway($gateway)
 {
     $value1 = \JString::strtolower($this->serviceAlias);
     $value2 = \JString::strtolower($gateway);
     return (bool) (\JString::strcmp($value1, $value2) === 0);
 }
开发者ID:bellodox,项目名称:CrowdFunding,代码行数:13,代码来源:Plugin.php

示例9: foreach

	<?php 
$leadingcount = 0;
$date = "";
$date_to_print = "";
?>
	<?php 
if (!empty($this->lead_items)) {
    ?>

			<?php 
    foreach ($this->lead_items as &$item) {
        ?>
					<?php 
        $this->item =& $item;
        $date_to_print = JString::strcmp($this->item->publish_down, '0000-00-00 00:00:00') == 0 ? $this->item->publish_up : $this->item->publish_down;
        if (JString::strcmp($date, JHtml::_('date', $date_to_print, JText::_('d/m/Y'))) != 0) {
            ?>
					<div class="row">
						<div class="col-xs-12 date-line">
							<p class="h3"><?php 
            echo JHtml::_('date', $date_to_print, JText::_('d l'));
            ?>
</p>
						</div>
					</div>
					<?php 
        }
        $date = JHtml::_('date', $date_to_print, JText::_('d/m/Y'));
        echo $this->loadTemplate('item');
        ?>
				<?php 
开发者ID:muhack,项目名称:easydayz,代码行数:31,代码来源:list.php

示例10: onIpn


//.........这里部分代码省略.........
     $payment_status = $input->get('payment_status', '', 'string');
     $payment_amount = $input->get('mc_gross', '', 'string');
     $payment_currency = $input->get('mc_currency', '', 'string');
     $txn_id = $input->get('txn_id', '', 'string');
     $txn_type = $input->get('txn_type', '', 'string');
     $receiver_email = $input->get('receiver_email', '', 'string');
     $payer_email = $input->get('payer_email', '', 'string');
     $subscr_id = $input->get('subscr_id', '', 'string');
     $buyer_address = $input->get('address_status', '', 'string') . ' - ' . $input->get('address_street', '', 'string') . ' ' . $input->get('address_zip', '', 'string') . ' ' . $input->get('address_state', '', 'string') . ' ' . $input->get('address_city', '', 'string') . ' ' . $input->get('address_country_code', '', 'string');
     $status = 'form.paypal.ipnfailure.empty';
     $errMsg = '';
     $fullResponse = array();
     if (empty($formId)) {
         $status = 'form.paypal.ipnfailure.custom_error';
         $errMsg = "formid or rowid empty in custom: {$custom}";
     } else {
         // @TODO implement a curl alternative as fsockopen is not always available
         $fp = fsockopen($paypalUrl, 443, $errno, $errstr, 30);
         if (!$fp) {
             $status = 'form.paypal.ipnfailure.fsock_error';
             $errMsg = "fsock error: {$errno};{$errstr}";
         } else {
             fputs($fp, $header . $req);
             while (!feof($fp)) {
                 $res = fgets($fp, 1024);
                 $tres = trim($res);
                 /* paypal steps (from their docs):
                  * check the payment_status is Completed
                  * check that txn_id has not been previously processed
                  * check that receiver_email is your Primary PayPal email
                  * check that payment_amount/payment_currency are correct
                  * process payment
                  */
                 if (JString::strcmp($tres, "VERIFIED") === 0) {
                     $status = 'ok';
                     // $$tom This block Paypal from updating the IPN field if the payment status evolves (e.g. from Pending to Completed)
                     // $$$ hugh - added check of status, so only barf if there is a status field, and it is Completed for this txn_id
                     // $$$ hugh - added check for empty $txn_id, which happens on subscr_foo transaction types
                     if (!empty($ipnTxnField) && !empty($ipnStatusField)) {
                         if (!empty($txn_id)) {
                             $query->clear();
                             $query->select($ipnStatusField)->from($table->db_table_name)->where($db->qn($ipnTxnField) . ' = ' . $db->q($txn_id));
                             $db->setQuery($query);
                             $txn_result = $db->loadResult();
                             if (!empty($txn_result)) {
                                 if ($txn_result == 'Completed') {
                                     if ($payment_status != 'Reversed' && $payment_status != 'Refunded') {
                                         $status = 'form.paypal.ipnfailure.txn_seen';
                                         $errMsg = "transaction id already seen as Completed, new payment status makes no sense: {$txn_id}, {$payment_status}";
                                         $this->doLog($status, $errMsg);
                                     }
                                 } elseif ($txn_result == 'Reversed') {
                                     if ($payment_status != 'Canceled_Reversal') {
                                         $status = 'form.paypal.ipnfailure.txn_seen';
                                         $errMsg = "transaction id already seen as Reversed, new payment status makes no sense: {$txn_id}, {$payment_status}";
                                         $this->doLog($status, $errMsg);
                                     }
                                 }
                             }
                         }
                     } else {
                         $this->doLog('form.paypal.ipndebug.ipn_no_txn_fields', "No IPN txn or status fields specified, can't test for reversed, refunded or cancelled");
                     }
                     if ($status == 'ok') {
                         $set_list = array();
                         if (!empty($ipnField)) {
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:67,代码来源:paypal.php

示例11: isDefaultLanguage

 public static function isDefaultLanguage()
 {
     $lang = JFactory::getLanguage();
     if (JString::strcmp($lang->getDefault(), $lang->getTag()) === 0) {
         return true;
     }
     return false;
 }
开发者ID:jputz12,项目名称:OneNow-Vshop,代码行数:8,代码来源:djcatalog2.php

示例12: testStrcmp

	/**
	 * @group String
	 * @covers JString::strcmp
	 * @dataProvider strcmpData
	 */
	public function testStrcmp($string1, $string2, $locale, $expect)
	{
		$actual = JString::strcmp ($string1, $string2, $locale);
		if ($actual != 0) {
			$actual = $actual/abs($actual);
		}
		$this->assertEquals($expect, $actual);
	}
开发者ID:realityking,项目名称:JAJAX,代码行数:13,代码来源:JStringTest.php

示例13: onIpn

 /**
  * Called from subscriptions at the end of the transaction
  *
  * TO test the IPN you can login to your paypal acc, and go to history -> IPN History
  * then use the 'Notification URL' along with the 'IPN Message' as the querystring
  * PLUS "&fakeit=1"
  *
  * @return  void
  */
 public function onIpn()
 {
     $input = $this->app->input;
     JLog::add($input->server->getString('REQUEST_URI') . ' ' . http_build_query($_REQUEST), JLog::INFO, 'fabrik.ipn.start');
     // Lets try to load in the custom returned value so we can load up the form and its parameters
     $custom = $input->get('custom', '', 'string');
     list($formId, $invoiceId) = explode(':', $custom);
     $input->set('invoiceid', $invoiceId);
     $mail = JFactory::getMailer();
     // Pretty sure they are added but double add
     JModelLegacy::addIncludePath(COM_FABRIK_FRONTEND . '/models');
     $formModel = JModelLegacy::getInstance('Form', 'FabrikFEModel');
     $formModel->setId($formId);
     $listModel = $formModel->getlistModel();
     $params = $formModel->getParams();
     $table = $listModel->getTable();
     $db = $listModel->getDb();
     $renderOrder = $input->getInt('renderOrder');
     $ipn_txn_field = 'pp_txn_id';
     $ipn_payment_field = 'amount';
     $ipn_status_field = 'pp_payment_status';
     $w = $this->getWorker();
     $email_from = $adminEmail = $this->config->get('mailfrom');
     // Read the post from Subscriptions system and add 'cmd'
     $req = 'cmd=_notify-validate';
     // For
     $fake = $input->getInt('fakeit');
     if ($fake == 1) {
         $request = $_GET;
     } else {
         $request = $_POST;
     }
     foreach ($request as $key => $value) {
         if ($key !== 'fakeit') {
             $value = urlencode(stripslashes($value));
             $req .= '&' . $key . '=' . $value;
         }
     }
     $sandBox = $input->get('test_ipn') == 1;
     // Post back to Paypal to validate
     $header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
     $header .= $sandBox ? "Host: www.sandbox.paypal.com:443\r\n" : "Host: www.paypal.com:443\r\n";
     $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
     $header .= "Content-Length: " . JString::strlen($req) . "\r\n\r\n";
     $subscriptionsurl = $sandBox ? 'ssl://www.sandbox.paypal.com' : 'ssl://www.paypal.com';
     // Assign posted variables to local variables
     $item_name = $input->get('item_name', '', 'string');
     $item_number = $input->get('item_number', '', 'string');
     $payment_status = $input->get('payment_status', '', 'string');
     $payment_amount = $input->get('mc_gross', '', 'string');
     $payment_currency = $input->get('mc_currency', '', 'string');
     $txn_id = $input->get('txn_id', '', 'string');
     $txn_type = $input->get('txn_type', '', 'string');
     $receiver_email = $input->get('receiver_email', '', 'string');
     $payer_email = $input->get('payer_email', '', 'string');
     $status = true;
     $res = 'IPN never fired';
     $err_msg = '';
     $err_title = '';
     if (empty($formId) || empty($invoiceId)) {
         $status = false;
         $err_title = 'form.subscriptions.ipnfailure.custom_error';
         $err_msg = "formid or rowid empty in custom: {$custom}";
     } else {
         // @TODO implement a curl alternative as fsockopen is not always available
         $fp = fsockopen($subscriptionsurl, 443, $errno, $errstr, 30);
         if (!$fp) {
             $status = false;
             $err_title = 'form.subscriptions.ipnfailure.fsock_error';
             $err_msg = "fsock error: {$errno};{$errstr}";
         } else {
             fputs($fp, $header . $req);
             while (!feof($fp)) {
                 $res = fgets($fp, 1024);
                 /*subscriptions steps (from their docs):
                  * check the payment_status is Completed
                  * check that txn_id has not been previously processed
                  * check that receiver_email is your Primary Subscriptions email
                  * check that payment_amount/payment_currency are correct
                  * process payment
                  */
                 if (JString::strcmp(strtoupper($res), "VERIFIED") == 0) {
                     $query = $db->getQuery(true);
                     $query->select($ipn_status_field)->from('#__fabrik_subs_invoices')->where($db->quoteName($ipn_txn_field) . ' = ' . $db->quote($txn_id));
                     $db->setQuery($query);
                     $txn_result = $db->loadResult();
                     if ($txn_type == 'subscr_signup') {
                         // Just a notification - no payment yet
                     } else {
                         if (!empty($txn_result) && $txn_type != 'subscr_signup') {
                             if ($txn_result == 'Completed') {
//.........这里部分代码省略.........
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:101,代码来源:subscriptions.php

示例14: defined

<?php

/**
 * @package     Joomla.Site
 * @subpackage  Layout
 *
 * @copyright   Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
// Create a shortcut for params.
$params = $this->item->params;
$images = json_decode($this->item->images);
$urls = json_decode($this->item->urls);
$date_to_print = JString::strcmp($this->item->publish_down, '0000-00-00 00:00:00') == 0 ? $this->item->publish_up : $this->item->publish_down;
?>

<div class="list-course row">
  <div class="col-xs-12 col-sm-2 time">
    <p class="h4"><time datetime="<?php 
echo JHtml::_('date', $date_to_print, 'c');
?>
" itemprop="datePublished">
      <?php 
echo JHtml::_('date', $date_to_print, JText::_('H:i'));
?>
    </time></p>
  </div>
  <div class="col-xs-12 col-sm-6 title">
      <p class="h4"><?php 
echo $this->item->title;
开发者ID:muhack,项目名称:easydayz,代码行数:31,代码来源:list_item.php


注:本文中的JString::strcmp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。