本文整理汇总了PHP中Gpf_Settings类的典型用法代码示例。如果您正苦于以下问题:PHP Gpf_Settings类的具体用法?PHP Gpf_Settings怎么用?PHP Gpf_Settings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Gpf_Settings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: readRequestVariables
public function readRequestVariables() {
$input = $this->readXmlData();
$this->debug("Input get: ".$input);
try {
$xml = new SimpleXMLElement($input);
} catch (Exception $e) {
$this->setPaymentStatus("Failed");
$this->debug('Wrong XML format.');
$this->outputError();
return;
}
// assign posted variables to local variables
$customField = 'custom_field_'.Gpf_Settings::get(UltraCart_Config::CUSTOM_FIELD_NUMBER);
$this->debug("Custom field number: ".Gpf_Settings::get(UltraCart_Config::CUSTOM_FIELD_NUMBER));
$cookieValue = (string)$xml->order->$customField;
$this->setCookie($cookieValue);
$this->setTotalCost($this->computeTotalCost($xml));
$this->setEmail((string)$xml->order->email);
$this->setTransactionID((string)$xml->order->order_id);
$this->setProductID((string)$xml->order->item->item_id);
$this->setPaymentStatus((string)$xml->order->payment_status);
$this->outputSuccess();
}
示例2: executeCurl
protected function executeCurl($xmlRequest, $headers) {
$url = '';
if (!$this->containsProtocol(Gpf_Settings::get(BusinessCatalyst_Config::BC_DOMAIN_NAME))) {
$url = 'http://';
}
$url .= Gpf_Settings::get(BusinessCatalyst_Config::BC_DOMAIN_NAME);
if (!$this->endsWithSlash($url)) {
$url .= '/';
}
$url .= 'catalystwebservice/catalystcrmwebservice.asmx';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlRequest);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER ,1);
$response = curl_exec($ch);
if ($response === false) {
Pap_Contexts_Action::getContextInstance()->debug('Error in communication with bc: ' . curl_error($ch));
throw new Gpf_Exception(curl_error($ch));
}
return $response;
}
示例3: load
/**
* @anonym
* @service custom_separator read
* @param Gpf_Rpc_Params $params
* @return Gpf_Rpc_Form
*/
public function load(Gpf_Rpc_Params $params) {
$form = new Gpf_Rpc_Form($params);
$form->addField(self::PROCESS_WHOLE_CART_AS_ONE_TRANSACTION, Gpf_Settings::get(self::PROCESS_WHOLE_CART_AS_ONE_TRANSACTION));
$form->addField(self::MERCHANT_ID, Gpf_Settings::get(self::MERCHANT_ID));
$form->addField(self::API_SIGNATURE, Gpf_Settings::get(self::API_SIGNATURE));
return $form;
}
示例4: validate
/**
* Validate Db_Row
*
* @param Gpf_DbEngine_Row $row
* @throws Gpf_DbEngine_Row_ConstraintException
*/
public function validate(Gpf_DbEngine_Row $row)
{
if (Gpf_Settings::get(Gpf_Settings_Gpf::PASSWORD_MIN_LENGTH) > Gpf_Settings::get(Gpf_Settings_Gpf::PASSWORD_MAX_LENGTH)) {
return;
}
if (strlen($row->get($this->passwordField)) < Gpf_Settings::get(Gpf_Settings_Gpf::PASSWORD_MIN_LENGTH)) {
throw new Gpf_DbEngine_Row_PasswordConstraintException($this->passwordField, $this->_('Minimum length of password is %s characters', Gpf_Settings::get(Gpf_Settings_Gpf::PASSWORD_MIN_LENGTH)));
}
if (strlen($row->get($this->passwordField)) > Gpf_Settings::get(Gpf_Settings_Gpf::PASSWORD_MAX_LENGTH)) {
throw new Gpf_DbEngine_Row_PasswordConstraintException($this->passwordField, $this->_('Maximum length of password is %s characters', Gpf_Settings::get(Gpf_Settings_Gpf::PASSWORD_MAX_LENGTH)));
}
if (Gpf_Settings::get(Gpf_Settings_Gpf::PASSWORD_LETTERS) == Gpf::YES) {
if (preg_match('/[a-zA-Z]/', $row->get($this->passwordField)) == 0) {
throw new Gpf_DbEngine_Row_PasswordConstraintException($this->passwordField, $this->_('Password has to contain at least one letter (a-z, A-Z)'));
}
}
if (Gpf_Settings::get(Gpf_Settings_Gpf::PASSWORD_DIGITS) == Gpf::YES) {
if (preg_match('/[0-9]/', $row->get($this->passwordField)) == 0) {
throw new Gpf_DbEngine_Row_PasswordConstraintException($this->passwordField, $this->_('Password has to contain at least one digit (0-9)'));
}
}
if (Gpf_Settings::get(Gpf_Settings_Gpf::PASSWORD_SPECIAL) == Gpf::YES) {
if (preg_match('/[' . preg_quote(Gpf_Common_String::SPECIAL_CHARS) . ']/', $row->get($this->passwordField)) == 0) {
throw new Gpf_DbEngine_Row_PasswordConstraintException($this->passwordField, $this->_('Password has to contain at least one special character (%s)', Gpf_Common_String::SPECIAL_CHARS));
}
}
}
示例5: __construct
public function __construct()
{
$this->username = Gpf_Settings::get(Gpf_Settings_Gpf::FTP_USERNAME);
$this->password = Gpf_Settings::get(Gpf_Settings_Gpf::FTP_PASSWORD);
$this->hostname = Gpf_Settings::get(Gpf_Settings_Gpf::FTP_HOSTNAME);
$this->directory = Gpf_Settings::get(Gpf_Settings_Gpf::FTP_DIRECTORY);
}
示例6: report
/**
* @service report_problem write
*
* @param Gpf_Rpc_Params $params
* @return Gpf_Rpc_Form
*/
public function report(Gpf_Rpc_Params $params) {
$form = new Gpf_Rpc_Form($params);
$subject = 'PAP4: '.$form->getFieldValue('subject');
$message = 'License: '.$form->getFieldValue('licenseId').'<br>'.
'Product: <b>'.Gpf_Settings::get(Pap_Settings::BRANDING_TEXT_POST_AFFILIATE_PRO).' '.Gpf_Settings::get(Gpf_Settings_Gpf::VARIATION).'</b><br>'.
'Version: <b>'.Gpf_Application::getInstance()->getVersion().'</b><br>'.
'Url: <a href="'.Gpf_Paths::getInstance()->getFullBaseServerUrl().'">'.Gpf_Paths::getInstance()->getFullBaseServerUrl().'</a><br>'.
'-------------------------------------------------------------------------------<br>'.
$form->getFieldValue('message');
$mail = new Gpf_Db_Mail();
$mail->setSubject($subject);
$mail->setHtmlBody($message);
$mail->setFromMail($form->getFieldValue('email'));
$mail->setRecipients("support@qualityunit.com");
try {
$mail->insert();
$mail->scheduleNow(true);
$form->setInfoMessage($this->_("Email sent"));
} catch (Exception $e) {
$form->setErrorMessage($this->_("Error while sending mail"));
}
return $form;
}
示例7: getDatabase
/**
* @return Gpf_DbEngine_Database
*/
public static function getDatabase()
{
if (self::$database === null) {
self::create(Gpf_Settings::get(Gpf_Settings_Gpf::DB_HOSTNAME), Gpf_Settings::get(Gpf_Settings_Gpf::DB_USERNAME), Gpf_Settings::get(Gpf_Settings_Gpf::DB_PASSWORD), Gpf_Settings::get(Gpf_Settings_Gpf::DB_DATABASE));
}
return self::$database;
}
示例8: normalizePassword
/**
* Add minimum one character into password from string includeCharacters
* if it doesn't contain already such character
*
* @param $settingName
* @param $includeCharacters
* @param $password
* @return unknown_type
*/
private static function normalizePassword($settingName, $includeCharacters, $password)
{
if (Gpf_Settings::get($settingName) == Gpf::YES && !preg_match('/[' . preg_quote($includeCharacters) . ']/', $password)) {
$password[rand(0, strlen($password) - 1)] = $includeCharacters[rand(0, strlen($includeCharacters) - 1)];
}
return $password;
}
示例9: getValidityInSeconds
private function getValidityInSeconds() {
$validity = Gpf_Settings::get(Pap_Settings::IP_VALIDITY_SETTING_NAME);
if($validity == '' || $validity == '0' || !is_numeric($validity)) {
throw new Gpf_Exception(" IP address validity period is not correct: '$validity'");
}
$validityPeriod = Gpf_Settings::get(Pap_Settings::IP_VALIDITY_FORMAT_SETTING_NAME);
if(!in_array($validityPeriod, array(Pap_Merchants_Config_TrackingForm::VALIDITY_DAYS,
Pap_Merchants_Config_TrackingForm::VALIDITY_HOURS,
Pap_Merchants_Config_TrackingForm::VALIDITY_MINUTES))) {
throw new Gpf_Exception(" IP address validity period is not correct: '$validityPeriod'");
}
switch($validityPeriod) {
case Pap_Merchants_Config_TrackingForm::VALIDITY_DAYS:
return $validity * 86400;
case Pap_Merchants_Config_TrackingForm::VALIDITY_HOURS:
return $validity * 3600;
case Pap_Merchants_Config_TrackingForm::VALIDITY_MINUTES:
return $validity * 60;
default: return 0;
}
}
示例10: loadItems
protected function loadItems($userId) {
$maxTiers = Gpf_Settings::get(Pap_Settings::TIERS_VISIBLE_TO_AFFILIATE);
if ($maxTiers == -1) {
return parent::loadItems($userId);
}
$currentUserId = Gpf_Session::getAuthUser()->getPapUserId();
$numberOfTiers = -1;
if($userId != '') {
try {
$numberOfTiers = $this->getNumberOfTiersToAncestor($userId, $currentUserId);
} catch (Gpf_Exception $e) {
}
}
if ($userId == '' && $maxTiers == 0) {
return new Gpf_Data_RecordSet();
}
if ($numberOfTiers >= $maxTiers-2) {
$lastTier = true;
} else {
$lastTier = false;
}
return parent::loadItems($userId, $lastTier);
}
示例11: updateCompressedCommissionsTask
private function updateCompressedCommissionsTask($recurrencePreset) {
if (Gpf_Settings::get(Pap_Features_CompressedCommissionPlacementModel_Definition::PROCESSING_ENABLED) == Gpf::YES) {
$this->insertCompressedCommissionsTask($recurrencePreset);
} else {
$this->removeCompressedCommissionsTask();
}
}
示例12: save
/**
* @service cronjob write
* @param $fields
*/
public function save(Gpf_Rpc_Params $params) {
$form = new Gpf_Rpc_Form($params);
Gpf_Settings::set(Gpf_Settings_Gpf::CRON_RUN_INTERVAL, $form->getFieldValue(Gpf_Settings_Gpf::CRON_RUN_INTERVAL));
$form->setInfoMessage($this->_("Cron runtime saved"));
return $form;
}
示例13: addCommission
public function addCommission(Pap_Contexts_Signup $signupContext) {
if (($user = $signupContext->getUserObject()) == null) {
return;
}
$campaignId = Gpf_Settings::get(SignupActionCommissions_Config::AFTER_SIGNUP_ACTION_CAMPAIGNID);
$actionCode = Gpf_Settings::get(SignupActionCommissions_Config::AFTER_SIGNUP_ACTION_CODE);
if ($actionCode == '') {
Gpf_Log::error('SignupActionCommissions plugin: No Action code set');
return;
}
$saleTracker = new Pap_Tracking_ActionTracker();
$action = $saleTracker->createAction($actionCode);
$action->setAffiliateID($user->getId());
$action->setStatus($user->getStatus());
$action->setOrderId(SignupActionCommissions_Config::DEFAULT_ORDER_ID);
if ($campaignId != '') {
$action->setCampaignID($campaignId);
}
try {
$saleTracker->register();
} catch (Gpf_Exception $e) {
Gpf_Log::error('SignupActionCommissions plugin: '.$e->getMessage());
}
}
示例14: checkMultipleSignupsFromSameIp
/**
* checks for duplicate signups from same IP
*
* @return boolean
*/
private function checkMultipleSignupsFromSameIp(Pap_Signup_SignupFormContext $context) {
$checkIt = Gpf_Settings::get(Pap_Settings::REPEATING_SIGNUPS_SETTING_NAME);
if($checkIt != Gpf::YES) {
return true;
}
$checkPeriod = Gpf_Settings::get(Pap_Settings::REPEATING_SIGNUPS_SECONDS_SETTING_NAME);
$checkAction = Gpf_Settings::get(Pap_Settings::REPEATING_SIGNUPS_ACTION_SETTING_NAME);
if($checkPeriod == '' || $checkPeriod == '0' || !is_numeric($checkPeriod)) {
return true;
}
if($checkAction != self::ACTION_DECLINE && $checkAction != self::ACTION_DONTSAVE) {
return true;
}
$userObject = new Pap_Common_User();
$recordsCount = $userObject->getNumberOfUsersFromSameIP($context->getIp(), $checkPeriod);
if(($recordsCount > 0) && ($checkAction == self::ACTION_DONTSAVE)) {
$context->getForm()->setErrorMessage($this->_("Not saved by fraud protection"));
$context->setAllowSave(false);
return false;
} else if (($recordsCount > 0) && ($checkAction == self::ACTION_DECLINE)) {
$context->getRow()->setStatus(Gpf_Db_User::DECLINED);
}
return true;
}
示例15: loadSettingsEmailNotifications
public function loadSettingsEmailNotifications(Gpf_Rpc_Form $form) {
$form->setField(Pap_Features_SplitCommissions_Definition::NOTIFICATION_ON_SALE_SUMMARY,
Gpf_Settings::get(Pap_Features_SplitCommissions_Definition::NOTIFICATION_ON_SALE_SUMMARY));
$form->setField(Pap_Features_SplitCommissions_Definition::NOTIFICATION_ON_SALE_SUMMARY_STATUS,
Gpf_Settings::get(Pap_Features_SplitCommissions_Definition::NOTIFICATION_ON_SALE_SUMMARY_STATUS));
}