本文整理汇总了PHP中CBPTXT::T方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPTXT::T方法的具体用法?PHP CBPTXT::T怎么用?PHP CBPTXT::T使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPTXT
的用法示例。
在下文中一共展示了CBPTXT::T方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: drawUserSomethings
/**
* Draws the user profile tab "Subscriptions" (if enabled, user is the profile owner, and something to display.
*
* @param UserTable $user
* @param boolean $itsmyself
* @param string $htmlSubscribed
* @return string
*/
public function drawUserSomethings($user, $itsmyself, $htmlSubscribed)
{
global $_CB_framework, $ueConfig;
$this->htmlSubscribed = $htmlSubscribed;
$subscriptions = $this->_model;
if (count($subscriptions) == 1) {
$subTxt = CBPTXT::T(cbpaidApp::settingsParams()->get('subscription_name', 'subscription'));
} else {
$subTxt = CBPTXT::T(cbpaidApp::settingsParams()->get('subscriptions_name', 'subscriptions'));
}
if ($itsmyself) {
$userName = null;
} else {
$userName = getNameFormat($user->name, $user->username, $ueConfig['name_format']);
}
if ($_CB_framework->getUi() == 1) {
if ($itsmyself) {
$this->htmlTabTitle = sprintf(CBPTXT::Th("Your current %s"), $subTxt);
} else {
$this->htmlTabTitle = sprintf(CBPTXT::Th("%s's current %s"), $userName, $subTxt);
}
} else {
if ($itsmyself) {
$this->htmlTabTitle = sprintf(CBPTXT::Th("Your current and past %s"), $subTxt);
} else {
$this->htmlTabTitle = sprintf(CBPTXT::Th("%s's current and past %s"), $userName, $subTxt);
}
}
return $this->display();
}
示例2: buttonText
/**
* Returns text for button for upgrade, renewals, etc.
*
* @param string $type 'upgrade', 'pay', 'renew', 'reactivate', 'resubscribe', 'unsubscribe', 'delete', default is Apply
* @return string translated button text (without htmlspecialchars, it will be applied on the returned text.
*/
public function buttonText( $type ) {
switch ( $type ) {
case 'upgrade':
return CBPTXT::T("Buy");
case 'pay':
return CBPTXT::T("Buy Now");
default:
return parent::buttonText( $type );
}
}
示例3: drawUserUpgradePlans
/**
* Draws the plans upgrade proposals
*
* @param UserTable $user
* @param int $plansDisplayed
* @param string $htmlUpgrades
* @param string $htmlspecialcharedBaseUrl
* @param array $hiddenFlds
* @param array $buttonTexts
* @param string $buttonName
* @return string
*/
public function drawUserUpgradePlans($user, $plansDisplayed, $htmlUpgrades, $htmlspecialcharedBaseUrl, $hiddenFlds, $buttonTexts, $buttonName)
{
$this->htmlUpgrades = $htmlUpgrades;
$this->htmlspecialcharedBaseUrl = $htmlspecialcharedBaseUrl;
$this->hiddenFlds = $hiddenFlds;
$this->buttonName = $buttonName;
$this->buttonText = implode(' / ', $buttonTexts);
$subTxt = CBPTXT::T(cbpaidApp::settingsParams()->get('subscription_name', 'subscription'));
if ($plansDisplayed == 1) {
$this->htmlTitle = sprintf(CBPTXT::Th("Your current %s upgrade possibility:"), $subTxt);
} else {
$this->htmlTitle = sprintf(CBPTXT::Th("Your current %s upgrade possibilities:"), $subTxt);
}
return $this->display();
}
示例4: sendMail
/**
* Builds and sends e-mail
*
* @param UserTable $user
* @param string $mailFrom_email
* @param string $mailFrom_name
* @param string $mailTo
* @param string $mailSubject
* @param string $mailBody
* @param string $mailHtml
* @param string $mailCC
* @param string $mailBCC
* @param string $mailAttachments
* @param string[] $extraStrings
* @return void
*/
protected function sendMail( $user, $mailFrom_email, $mailFrom_name, $mailTo, $mailSubject, $mailBody, $mailHtml, $mailCC, $mailBCC, $mailAttachments, $extraStrings ) {
global $_CB_framework;
cbimport( 'cb.tabs' );
$cbUser = CBuser::getInstance( $user->id );
if ( ! $cbUser ) {
return;
}
$mailFrom_email = trim( $cbUser->replaceUserVars( $mailFrom_email, false, false, array(), false ) );
$mailFrom_name = trim( $cbUser->replaceUserVars( $mailFrom_name, false, false, array(), false ) );
$mailTo = trim( $cbUser->replaceUserVars( $mailTo, false, false, array(), false ) );
$mailCC = trim( $cbUser->replaceUserVars( $mailCC, false, false, array(), false ) );
$mailBCC = trim( $cbUser->replaceUserVars( $mailBCC, false, false, array(), false ) );
$mailSubject = trim( $cbUser->replaceUserVars( CBPTXT::T( $mailSubject ), false, false, $extraStrings, false ) );
$mailBody = trim( $cbUser->replaceUserVars( CBPTXT::T( $mailBody ), false, false, $extraStrings, false ) );
$mailAttachments = trim( $mailAttachments );
if ( $mailTo != '' ) {
$mailTo = preg_split( '/ *, */', $mailTo );
} else {
return;
}
if ( $mailCC != '' ) {
$mailCC = preg_split( '/ *, */', $mailCC );
} else {
$mailCC = null;
}
if ( $mailBCC != '' ) {
$mailBCC = preg_split( '/ *, */', $mailBCC );
} else {
$mailBCC = null;
}
if ( $mailAttachments != '' ) {
$mailAttachments = preg_split( '/ *, */', $mailAttachments );
} else {
$mailAttachments = null;
}
if ( $mailTo && ( $mailSubject || $mailBody ) ) {
comprofilerMail( $mailFrom_email, $mailFrom_name, $mailTo, $_CB_framework->getCfg( 'sitename' ).' - '.$mailSubject, $mailBody, $mailHtml, $mailCC, $mailBCC, $mailAttachments );
}
}
示例5: canDelete
/**
* Check for whether dependancies exist for this object in the db schema
*
* @param int $oid Optional key index
* @return boolean TRUE: OK to delete, FALSE: not OK to delete, error in $this->_error
*/
public function canDelete($oid = null)
{
$k = $this->_tbl_key;
if ($oid) {
$this->{$k} = $oid;
}
$query = "SELECT COUNT(*)" . "\n FROM `#__cbsubs_subscriptions`" . "\n WHERE `plan_id` = " . (int) $this->{$k};
$this->_db->setQuery($query);
$obj = null;
$count = $this->_db->loadResult($obj);
if ($count > 0) {
$this->setError(CBPTXT::T("Subscriptions exist for this plan"));
return false;
}
return parent::canDelete($oid);
}
开发者ID:jasonrgd,项目名称:Digital-Publishing-Platform-Joomla,代码行数:22,代码来源:cbpaidProductUsersubscription.php
示例6: renderCurrencySymbol
/**
* Renders the currency symbol according to global settings
*
* @param string|null $currency
* @param boolean $html
* @return string
*/
public function renderCurrencySymbol( $currency, $html ) {
$params = $this->params;
if ( $currency === null ) {
$currency = $params->get( 'currency_code', 'USD' );
}
$priceCurrencyFormat = $params->get('price_currency_format', '%2$s %1$s' );
if ( $html ) {
if ( strpos( $priceCurrencyFormat, '%3' ) !== false ) {
$currencySymbols = array ( 'EUR' => '€', 'USD' => '$', 'GBP' => '£', 'JPY' => '¥', 'CHF' => 'Fr.', 'CAD' => 'C$', 'AUD' => '$', 'BRL' => 'R$', 'CNY' => '¥', 'DKK' => 'KR', 'ZAR' => 'R', 'SEK' => 'KR' ); //TBD: move to currency table
$textHtmlSymbol = isset( $currencySymbols[$currency] ) ? $currencySymbols[$currency] : CBPTXT::Th( $currency );
} else {
$textHtmlSymbol = CBPTXT::Th( $currency );
}
$textHtmlSymbol = '<span class="cbregPcur">' . $textHtmlSymbol . '</span>';
} else {
$textHtmlSymbol = CBPTXT::T( $currency );
}
return $textHtmlSymbol;
}
示例7: renderColumn
/**
* Renders a $variable for an $output
*
* @param string $variable
* @param string $output
* @param boolean $rounded
* @return string|null
*/
public function renderColumn($variable, $output = 'html', $rounded = false)
{
$html = $output == 'html';
switch ($variable) {
case 'rate':
$ret = $this->renderItemRate($html);
break;
case 'discount_amount':
case 'tax_amount':
$ret = $this->renderJustItemRates($variable, $html, $rounded);
break;
case 'first_rate':
case 'first_discount_amount':
case 'first_tax_amount':
$ret = cbpaidMoney::getInstance()->renderPrice($this->{$variable}, $this->currency, $html, $rounded);
break;
case 'quantity':
// removes insignifiant zeros after ., as well as the . itself if no decimals:
$matches = null;
$matched = preg_match("/^(.+?)[.]?[0]*\$/", $this->get($variable), $matches);
$ret = $matched ? $matches[1] : null;
break;
case 'validity_period':
if ($this->start_date && $this->stop_date && $this->start_date != '0000-00-00 00:00:00' && $this->stop_date != '0000-00-00 00:00:00') {
$showTime = false;
$startDate = cbFormatDate($this->start_date, 1, $showTime);
$stopDate = cbFormatDate($this->stop_date, 1, $showTime);
$ret = htmlspecialchars($startDate);
if ($stopDate && $startDate != $stopDate) {
$ret .= ($html ? ' - ' : ' - ') . htmlspecialchars($stopDate);
}
if ($this->second_stop_date && $this->second_stop_date != '0000-00-00 00:00:00') {
$secondStartDate = cbFormatDate($this->_db->getUtcDateTime(cbpaidTimes::getInstance()->strToTime($this->stop_date) + 1), 1, $showTime);
$secondStopDate = cbFormatDate($this->second_stop_date, 1, $showTime);
$retsecond = htmlspecialchars($secondStartDate) . ($html ? ' - ' : ' - ') . htmlspecialchars($secondStopDate);
$ret = sprintf($html ? CBPTXT::Th("%s, then %s") : CBPTXT::T("%s, then %s"), $ret, $retsecond);
}
} else {
$ret = null;
}
break;
case 'tax_rule_id':
if ($this->tax_rule_id && is_callable(array('cbpaidTaxRule', 'getInstance'))) {
$ret = cbpaidTaxRule::getInstance((int) $this->tax_rule_id)->getShortCode();
} else {
$ret = null;
}
break;
case 'original_rate':
case 'first_original_rate':
$ret = null;
break;
case 'ordering':
case 'artnum':
case 'description':
case 'discount_text':
default:
$value = $this->get($variable);
if ($value !== null) {
$ret = htmlspecialchars($this->get($variable));
} else {
$ret = null;
}
break;
}
return $ret;
}
示例8: displayWithTemplate
/**
* Displays $text inside a standard CB div, and sets page title and pathway too
*
* @param string $text
* @return string
*/
public static function displayWithTemplate($text)
{
global $_CB_framework;
$regTitle = strip_tags(CBPTXT::T(cbpaidApp::settingsParams()->get('regTitle', "Subscriptions")));
outputCbTemplate();
$_CB_framework->setPageTitle($regTitle);
$_CB_framework->appendPathWay($regTitle);
$pre = '<div class="cbPageOuter"><div class="cbPageInner" id="cbregField">';
$post = '</div></div><div class="cbClr"> </div>';
return $pre . $text . $post;
}
示例9: store
/**
* store() function override, instead of storing it imports.
*
* @param boolean $updateNulls
* @return boolean
*/
public function store($updateNulls = false)
{
$return = '';
// Check if file uploads are enabled
if (!(bool) ini_get('file_uploads')) {
$this->_error = CBPTXT::T("Importer") . ' - ' . CBPTXT::T("error:") . ' ' . CBPTXT::T("The importer can't continue before file uploads are enabled in PHP settings.");
return false;
}
if (!$this->import_type) {
$this->_error = CBPTXT::T("Importer") . ' - ' . CBPTXT::T("error:") . ' ' . CBPTXT::T("No import type selected");
return false;
}
$fromFile = cbStartOfStringMatch($this->import_type, 'file_');
if ($fromFile) {
$userfile = $_FILES['userfile'];
if (!$userfile || $userfile == null) {
$this->_error = CBPTXT::T("Importer") . ' - ' . CBPTXT::T("error:") . ' ' . CBPTXT::T("No file selected");
return false;
}
if (isset($userfile['error']) && $userfile['error']) {
$errors_array = array(1 => CBPTXT::T("The uploaded file exceeds the upload_max_filesize directive in php.ini."), 2 => CBPTXT::T("The uploaded file exceeds the maximum size allowed by this form."), 3 => CBPTXT::T("The uploaded file was only partially uploaded."), 4 => CBPTXT::T("No file was selected and uploaded."), 6 => CBPTXT::T("Missing a temporary folder in php.ini."), 7 => CBPTXT::T("Failed to write file to disk."), 8 => CBPTXT::T("File upload stopped by extension."));
if (in_array($userfile['error'], $errors_array)) {
$fileErrorTxt = $errors_array[$userfile['error']];
} else {
$fileErrorTxt = CBPTXT::T("File upload error number ") . htmlspecialchars($userfile['error']);
}
$this->_error = CBPTXT::T("Importer") . ' - ' . CBPTXT::T("error:") . ' ' . $fileErrorTxt;
return false;
}
if (!$userfile['tmp_name'] || !is_uploaded_file($userfile['tmp_name'])) {
$this->_error = CBPTXT::T("Importer") . ' - ' . CBPTXT::T("error:") . ' ' . CBPTXT::T("No temporary file name");
return false;
}
if ($userfile['size'] == 0) {
$this->_error = CBPTXT::T("Importer") . ' - ' . CBPTXT::T("error:") . ' ' . CBPTXT::T("Empty file");
return false;
}
} else {
$userfile = null;
}
if ($this->import_type == 'cms_acl') {
if (!$this->usergroup) {
$this->_error = CBPTXT::T("Importer") . ' - ' . CBPTXT::T("error:") . ' ' . CBPTXT::T("No usergroup selected");
return false;
}
}
if ($this->import_type == 'subscription') {
if (!$this->from_plan) {
$this->_error = CBPTXT::T("Importer") . ' - ' . CBPTXT::T("error:") . ' ' . CBPTXT::T("No subscription plan selected");
return false;
}
if (!$this->from_sub_status) {
$this->_error = CBPTXT::T("Importer") . ' - ' . CBPTXT::T("error:") . ' ' . CBPTXT::T("No subscription status selected");
return false;
}
}
if ($this->import_type != 'file_uid_plan_exp') {
if (!$this->plan) {
$this->_error = CBPTXT::T("Importer") . ' - ' . CBPTXT::T("error:") . ' ' . CBPTXT::T("No plan selected");
return false;
}
if (!$this->state) {
$this->_error = CBPTXT::T("Importer") . ' - ' . CBPTXT::T("error:") . ' ' . CBPTXT::T("No subscription state selected");
return false;
}
if (!$this->date) {
$this->_error = CBPTXT::T("Importer") . ' - ' . CBPTXT::T("error:") . ' ' . CBPTXT::T("No subscription date selected");
return false;
}
}
if ($fromFile) {
$tmpName = $userfile['tmp_name'];
$fileSize = (int) $userfile['size'];
// $fileType = $userfile['type'];
} else {
$tmpName = null;
$fileSize = null;
}
$planStateDate = array();
switch ($this->import_type) {
case 'file_uid':
$fp = fopen($tmpName, 'r');
$content = fread($fp, $fileSize);
fclose($fp);
unlink($tmpName);
$userIdList = explode(',', trim($content));
break;
case 'file_uid_plan_exp':
$userIdList = array();
$fp = fopen($tmpName, 'r');
if ($fp) {
$n = 0;
while (!feof($fp)) {
$line = trim(str_replace('"', '', fgets($fp, 256)));
//.........这里部分代码省略.........
开发者ID:jasonrgd,项目名称:Digital-Publishing-Platform-Joomla,代码行数:101,代码来源:cbpaidSubscriptionsImporter.php
示例10: _renderPeriodOfValiditiy
/**
* Returns formatted time period ( xxx weeks , or xxx years xxx months xxx days xxx hours xxx minutes xxx seconds
*
* @param string $varName 'validity' or 'fist_validity'
* @param int $occurrences [default: 1] multiply period by the occurrences before displaying
* @param boolean $displayOne [default: true] displays also if only 1 unit of something
* @param boolean $displayCalendarYearStart [default: true] displays start of calendar year if not January 1st
* @return string
*/
private function _renderPeriodOfValiditiy( $varName, $occurrences = 1, $displayOne = true, $displayCalendarYearStart = true ) {
// $ycdhmsArray = $this->_timedObject->getValidity( $varName );
// $prefix = ( $this->_timedObject->isCalendarValidity( $varName ) ? CBPTXT::T("calendar ") : '' );
// return $this->_timedObject->renderPeriod( $ycdhmsArray, $occurrences, $displayOne, $prefix );
$ycdhmsArray = $this->getValidity( $varName );
$prefix = ( $this->isCalendarValidity( $varName ) ? CBPTXT::T("calendar ") : '' );
$text = $this->renderPeriod( $ycdhmsArray, $occurrences, $displayOne, $prefix );
$calStart = $this->calendarYearStart( $varName );
if ( $prefix && ( $calStart != '01-01' ) && $displayCalendarYearStart ) {
list( $m, $d ) = explode( '-', $calStart );
$text .= ' ' . CBPTXT::T("starting") . ' ' . date( 'F j', mktime( 0, 0, 0, $m, $d, 2004 ) );
}
return $text;
}
示例11: _planGetAndCheckReqParamArray
/**
* gets the chosen plans from the form, and checks if they are allowed for that user
* also gets the options of the plans
* In detail:
* gets an array of array of int as an array of int (removing first level), verifying that if index is not 0 the parent exists
* In each plan object there is a ->_options variable with a Registry object with the option values of the plan
*
* @param UserTable $user Reflecting the user being registered or saved
* @param string $name name of parameter in REQUEST URL
* @param cbpaidProduct[] $allowedPlans array of cbpaidProduct which are allowed
* @param boolean $isRegistration TRUE: Registration process (guest), or FALSE: upgrade-process (logged-in user)
* @param string $reason Subscription reason: 'N'=new subscription (default), 'R'=renewal, 'U'=update
* @param boolean $returnPlans TRUE: returns plan objects or FALSE: returns plan ids only.
* @param string $postfix postfix for identifying multiple plans spaces (optional)
* @return int[]|cbpaidProduct[]|string ARRAY of int|of cbpaidProducts : Plans which are selected within hierarchy (according to the post, to be rechecked !) or STRING: error message.
*/
protected function & _planGetAndCheckReqParamArray( &$user, $name, &$allowedPlans, $isRegistration, $reason, $returnPlans = false, $postfix = '' ) {
global $_CB_framework, $_POST;
$params =& cbpaidApp::settingsParams();
$enableFreeRegisteredUser = $params->get( 'enableFreeRegisteredUser', 1 );
$createAlsoFreeSubscriptions = $params->get( 'createAlsoFreeSubscriptions', 0 );
$ui = $_CB_framework->getUi();
if ( ! $isRegistration ) {
if ( $ui == 1 ) {
$userId = (int) cbGetParam( $_POST, 'user', 0 );
} else {
$userId = (int) cbGetParam( $_POST, 'id', 0 );
}
} else {
$userId = null;
}
$selectedPlanIds = $this->_plangetReqParamArray( $name, $postfix );
/// $validSub = array();
// 1. checks that selected plans hierarchy is respected:
$ok = true;
$plansMgr = null;
foreach ( $selectedPlanIds as $id ) {
if ( $id != 0 ) { // ignore "None" plan in backend edit profile
$ok = false;
// foreach ( $allowedPlans as $planid => $p ) {
if ( isset( $allowedPlans[(int) $id] ) ) {
$p = $allowedPlans[(int) $id];
if ( $id == $p->id ) {
$parentOk = true;
$parentId = $p->get( 'parent' );
if ( $parentId != 0 ) {
// the selected plan has a parent plan: check if parent plan is also chosen or already subscribed and active:
$parentOk = false;
foreach ($selectedPlanIds as $selPlanId ) {
if ( $parentId == $selPlanId ) {
$parentOk = true;
break;
}
}
if ( ( ! $isRegistration ) && ( ! $parentOk ) ) {
// try to see if user is subscribed already to the parent plan:
if ( $userId ) {
if ( $plansMgr === null ) {
$plansMgr =& cbpaidPlansMgr::getInstance();
}
$plan = $plansMgr->loadPlan( $parentId );
/** @var $plan cbpaidProduct */
if ( $plan ) {
// Check if allow free lifetime users without need to create such subscriptions:
if ( $enableFreeRegisteredUser && ( ! $createAlsoFreeSubscriptions ) && $plan->isLifetimeValidity() && $plan->isFree() ) {
$parentOk = true;
} else {
$sub = $plan->newSubscription();
/** @var $sub cbpaidSomething */
if ( $sub->loadValidUserSubscription( $userId ) ) {
$parentOk = true;
/// $validSub[$parentId] = $sub->id;
}
}
}
}
}
}
if ( $parentOk ) {
$ok = true;
}
break;
}
}
if ( ! $ok ) {
break;
}
}
}
if ( ! $ok ) {
$selectedPlanIds = CBPTXT::T("Chosen plans combination is not allowed (you must choose coherent plans selection, e.g. parent subscriptions to a plan must be active).");
} else {
// 2. Check that all exclusivities are respected:
$plansMgr =& cbpaidPlansMgr::getInstance();
//.........这里部分代码省略.........
示例12: getPaymentBasketPaymentForm
/**
* display basket and payment buttons or redirect for payment depending if multiple payment choices or intro text present:
*
* @param UserTable $user
* @param cbpaidPaymentBasket $paymentBasket
* @param string $introText
* @param boolean $ajax TRUE if AJAX refresh inside #cbregPayMethodsChoice, FALSE: wraps in <div id="cbregPayMethodsChoice">
* @return string HTML (or DOES REDIRECT if $redirectNow = ! ( ( $nbClasses != 1 ) || $introText ) == TRUE)
*/
public function getPaymentBasketPaymentForm( &$user, &$paymentBasket, $introText, $ajax = false ) {
global $_PLUGINS;
$result = null;
$params = cbpaidApp::settingsParams();
$invoicingAddressQuery = $params->get( 'invoicing_address_query' );
$basket_requiredterms = $params->get( 'basket_requiredterms' );
$basket_requiredtermserror = $params->get( 'basket_requiredtermserror' );
$payment_method_selection_type = $params->get( 'payment_method_selection_type', 'buttons' );
$allow_select_currency = $params->get( 'allow_select_currency', '0' );
$redirectNow = null;
$payChoicesArray = $this->getPaymentMethodsParams( $user, $paymentBasket, $introText, $redirectNow );
$chosenPaymentMethod = $paymentBasket->gateway_account ? $paymentBasket->gateway_account . '-' . $paymentBasket->payment_type : ''; // cbGetParam( $_POST, 'payment_method' );
$payChoicesHtmlRadiosArray = array();
$chosenPaymentSelector = null;
$payChoicesHtmlBottomArray = $this->_renderPayChoicesArray( $payChoicesArray, $paymentBasket, $redirectNow, $chosenPaymentMethod, $payChoicesHtmlRadiosArray, $chosenPaymentSelector );
if ( $redirectNow == 'redirect' && is_string( $payChoicesHtmlBottomArray ) ) {
cbRedirect( $payChoicesHtmlBottomArray );
}
$subscriptionsGUI = new cbpaidControllerUI();
$subscriptionsGUI->addcbpaidjsplugin();
if ( ( $payment_method_selection_type == 'radios') && ( $chosenPaymentMethod != '' ) && $chosenPaymentSelector ) {
// Select button to draw:
$payChoicePayButton = $this->getPayMethodButton( $user, $paymentBasket, $paymentBasket->gateway_account, $paymentBasket->payment_type, $chosenPaymentSelector );
/** @var $chosenPaymentSelector cbpaidGatewaySelector */
$this->modifyAspectPayMethodButton( $payChoicePayButton, $chosenPaymentSelector->paymentType );
$dummy = null;
$payChoicePayButtonHtmlArray = $this->_renderPayChoicesArray( array( $payChoicePayButton ), $paymentBasket, 'buttons', $chosenPaymentMethod, $payChoicesHtmlRadiosArray, $dummy );
$payChoicesHtmlBottomArray = array_merge( $payChoicesHtmlBottomArray, $payChoicePayButtonHtmlArray );
}
if ( true ) {
// always add cancel link
cbpaidApp::import( 'processors.cancelpay.cancelpay' );
$cancelmethod = new cbpaidGatewayAccountcancelpay();
$payClass = $cancelmethod->getPayMean();
$payChoicesHtmlBottomArray[] = $payClass->getPaymentBasketProcess( $user, $paymentBasket, 'buttons' ); // never redirectNow a cancel link :D !
}
$basketHtml = $paymentBasket->displayBasket();
if ( $allow_select_currency == 2 ) {
$currencySelector = $this->displayCurrencySelector( $paymentBasket );
} else {
$currencySelector = null;
}
$txtConclusion = $params->get('conclusion_text');
$txtFinal = $params->get('final_text');
$txtTerms = null;
if ( $basket_requiredterms == 1 ) {
global $_CB_database, $_CB_framework;
$query = 'SELECT ' . $_CB_database->NameQuote( 'params' )
. "\n FROM " . $_CB_database->NameQuote( '#__comprofiler_fields' )
. "\n WHERE " . $_CB_database->NameQuote( 'name' ) . " = " . $_CB_database->Quote( 'acceptedterms' );
$_CB_database->setQuery( $query );
$tcParams = new Registry( $_CB_database->loadResult() );
$termsOutput = $tcParams->get( 'terms_output', 'url' );
$termsDisplay = $tcParams->get( 'terms_display', 'modal' );
$termsURL = $tcParams->get( 'terms_url', null );
$termsText = $tcParams->get( 'terms_text', null );
$termsWidth = (int) $tcParams->get( 'terms_width', 400 );
$termsHeight = (int) $tcParams->get( 'terms_height', 200 );
if ( ! $termsHeight ) {
$termsHeight = 200;
}
if ( ( ( $termsOutput == 'url' ) && $termsURL ) || ( ( $termsOutput == 'text' ) && $termsText ) ) {
if ( $termsDisplay == 'iframe' ) {
if ( $termsOutput == 'url' ) {
$txtTerms .= '<iframe class="cbTermsFrameURL" height="' . $termsHeight . '" width="' . ( $termsWidth ? $termsWidth : '100%' ) . '" src="' . htmlspecialchars( $termsURL ) . '"></iframe>';
} else {
$txtTerms .= '<div class="cbTermsFrameText" style="height:' . $termsHeight . 'px;width:' . ( $termsWidth ? $termsWidth . 'px' : '100%' ) . ';overflow:auto;">' . CBPTXT::T( $termsText ) . '</div>';
}
}
if ( $termsDisplay != 'iframe' ) {
$attributes = ' class="cbTermsLink"';
if ( ( $termsOutput == 'text' ) && ( $termsDisplay == 'window' ) ) {
$termsDisplay = 'modal';
}
//.........这里部分代码省略.........
示例13: getOptions
/**
* Evaluates $postdata which is the $_POST array of the form submission of the cbpaidProductView::draw() form,
* and returns the filtered unescaped options.
*
* @param string $selectionId html input tag attribute id='' field for the input
* @param string $selectionName html input tag attribute name='' field for the input
* @param string $selectionValue html input tag attribute value='' field for the input
* @param string $reason Payment reason: 'N'=new subscription (default), 'R'=renewal, 'U'=update
* @return ParamsInterface Product's selected options
*/
public function getOptions($selectionId, $selectionName, $selectionValue, $reason)
{
$optionParams = new Registry('');
$this->_setOptionNames($selectionId, $selectionName, false);
$selectedvalue = (double) $this->_getReqParam($this->_donselName);
$donval = abs((double) $this->_getReqParam($this->_donvalName));
$this->fixedchoices = $this->_model->getParam('fixedchoices', 1);
$this->defaultchoice = $this->_model->getParam('defaultchoice', '');
$minimumDonation = (double) $this->_model->getParam('minimumdonation', '');
$maximumDonation = (double) $this->_model->getParam('maximumdonation', '');
$this->donateamounts = explode(',', $this->_model->getParam('donateamount', ''));
$this->_trimArray($this->donateamounts);
$amount = 0;
if ($this->fixedchoices > 1 && in_array($selectedvalue, $this->donateamounts)) {
$amount = $selectedvalue;
} elseif ($selectedvalue == '' && $this->fixedchoices != 2) {
if ($donval < $minimumDonation) {
return CBPTXT::T("Amount too small") . '.';
} elseif ($maximumDonation != 0 && $donval > $maximumDonation) {
return CBPTXT::T("Amount too large") . '.';
}
$amount = $donval;
}
if ($amount == 0) {
return CBPTXT::T("Amount not allowed") . '.';
}
$optionParams->set('amount', $amount);
return $optionParams;
}
示例14: getTabComponent
/**
* WARNING: UNCHECKED ACCESS! On purpose unchecked access for M2M operations
* Generates the HTML to display for a specific component-like page for the tab. WARNING: unchecked access !
* @param TabTable|null $tab the tab database entry
* @param UserTable $user the user being displayed
* @param int $ui 1 for front-end, 2 for back-end
* @param array $postdata _POST data for saving edited tab content as generated with getEditTab
* @return mixed either string HTML for tab content, or false if ErrorMSG generated
*/
public function getTabComponent( /** @noinspection PhpUnusedParameterInspection */ $tab, $user, $ui, $postdata ) {
global $_CB_database, $_CB_framework, $_POST;
$return = '';
$paid = false;
$oldignoreuserabort = ignore_user_abort(true);
$allowHumanHtmlOutput = true; // this will be reverted in case of M2M server-to-server notifications
$act = $this->base->_getReqParam( 'act' );
$actPosted = isset($_POST[$this->base->_getPagingParamName('act')]);
if ( $act === null ) {
$act = $this->base->input( 'act', null, GetterInterface::COMMAND );
$actPosted = $this->base->input( 'post/act', null, GetterInterface::COMMAND ) !== null;
}
$post_user_id = (int) cbGetParam( $_GET, 'user', 0 );
if ( $actPosted && ( $post_user_id > 0 ) ) {
$access = false;
$myId = $_CB_framework->myId();
if ( is_object( $user ) ) {
if ( $myId == 0 ) {
if ( in_array( $act, array( 'saveeditinvoiceaddress', 'saveeditbasketintegration', 'showbskt' ) ) ) {
$access = true;
} else {
$paidsubsManager =& cbpaidSubscriptionsMgr::getInstance();
if ( ! $paidsubsManager->checkExpireMe( __FUNCTION__, $user->id, false ) ) {
// expired subscriptions: we will allow limited access to:
if ( in_array( $act, array( 'upgrade', 'pay', 'reactivate', 'resubscribe', 'display_subscriptions' ) ) ) {
$access = true;
}
}
}
} else {
if ( ( $ui == 1 && ( $user->id == $myId ) )
|| ( cbpaidApp::authoriseAction( 'cbsubs.usersubscriptionmanage' ) ) ) {
$access = true;
}
}
} else {
$return = CBPTXT::T("User does not exist") . '.';
}
if ( ! $access ) {
$return .= '<br />' . CBPTXT::T("Not authorized action") . '.';
return $return;
}
cbSpoofCheck( 'plugin' ); // anti-spoofing check
// renew or upgrade subscription payment form:
$params = $this->params;
$now = $_CB_framework->now();
$subscriptionsGUI = new cbpaidControllerUI();
$subscriptionIds = $subscriptionsGUI->getEditPostedBoxes( 'id' );
if ( $subscriptionIds == array( 0 ) ) {
$subscriptionIds = array();
}
if ( $post_user_id && ( $user->id == $post_user_id ) ) {
outputCbTemplate();
$this->base->outputRegTemplate();
outputCbJs();
switch ( $act ) {
case 'upgrade': // upgrade an existing subscription
// display basket and payment buttons or redirect for payment depending if multiple payment choices or intro text present:
$chosenPlans = $subscriptionsGUI->getAndCheckChosenUpgradePlans( $postdata, $user, $now );
if ( ( ! is_array( $chosenPlans ) ) || ( count( $chosenPlans ) == 0 ) ) {
$subTxt = CBPTXT::T( $params->get( 'subscription_name', 'subscription' ) );
$return .= ( is_string( $chosenPlans ) ? $chosenPlans . '<br />' : '' )
. sprintf( CBPTXT::Th("Please press back button and select the %s plan to which you would like to upgrade."), $subTxt );
break;
}
$introText = CBPTXT::Th( $params->get( 'intro_text_upgrade', null ) );
//TBD: check if already exists (reload protection):
$paymentBasket = cbpaidControllerOrder::createSubscriptionsAndPayment( $user, $chosenPlans, $postdata, $subscriptionIds, null, 'R', CBPTXT::T("Upgrade"), 'U' );
if ( is_object( $paymentBasket ) ) {
$return = cbpaidControllerOrder::showBasketForPayment( $user, $paymentBasket, $introText );
} else {
$return = $paymentBasket; // show messages as nothing to pay.
}
break;
case 'pay': // pay for an unpaid subscription
// display basket and payment buttons or redirect for payment depending if multiple payment choices or intro text present:
$plan = $this->base->_getReqParam( 'plan' );
if ( ( ! $plan ) || ( ! isset( $subscriptionIds[$plan] ) ) || ( ! $subscriptionIds[$plan] ) ) {
$subTxt = CBPTXT::T( $params->get( 'subscription_name', 'subscription' ) );
$return .= sprintf( CBPTXT::Th("Please press back button and select a %s plan."), $subTxt );
//.........这里部分代码省略.........
示例15: getFormattedExpirationDateText
/**
* Get a correct display of the formatted validity of a plan: override if needed
*
* @return string Formatted text giving validity of this subscription
*/
public function getFormattedExpirationDateText() {
if ( $this->status == 'A' ) {
$params =& cbpaidApp::settingsParams();
return CBPTXT::T( $params->get( 'regtextLifetime', 'Lifetime Subscription' ) );
} else {
return CBPTXT::T('Not active');
}
}