本文整理汇总了PHP中oxRegistry::getUtils方法的典型用法代码示例。如果您正苦于以下问题:PHP oxRegistry::getUtils方法的具体用法?PHP oxRegistry::getUtils怎么用?PHP oxRegistry::getUtils使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oxRegistry
的用法示例。
在下文中一共展示了oxRegistry::getUtils方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
/**
* Composes and sends user written message, returns false if some parameters
* are missing.
*
* @return bool
*/
public function send()
{
$aParams = oxRegistry::getConfig()->getRequestParameter('editval');
// checking email address
if (!oxRegistry::getUtils()->isValidEmail($aParams['oxuser__oxusername'])) {
oxRegistry::get("oxUtilsView")->addErrorToDisplay('ERROR_MESSAGE_INPUT_NOVALIDEMAIL');
return false;
}
// spam spider prevension
$sMac = oxRegistry::getConfig()->getRequestParameter('c_mac');
$sMacHash = oxRegistry::getConfig()->getRequestParameter('c_mach');
$oCaptcha = $this->getCaptcha();
if (!$oCaptcha->pass($sMac, $sMacHash)) {
// even if there is no exception, use this as a default display method
oxRegistry::get("oxUtilsView")->addErrorToDisplay('MESSAGE_WRONG_VERIFICATION_CODE');
return false;
}
$sSubject = oxRegistry::getConfig()->getRequestParameter('c_subject');
if (!$aParams['oxuser__oxfname'] || !$aParams['oxuser__oxlname'] || !$aParams['oxuser__oxusername'] || !$sSubject) {
// even if there is no exception, use this as a default display method
oxRegistry::get("oxUtilsView")->addErrorToDisplay('ERROR_MESSAGE_INPUT_NOTALLFIELDS');
return false;
}
$oLang = oxRegistry::getLang();
$sMessage = $oLang->translateString('MESSAGE_FROM') . " " . $oLang->translateString($aParams['oxuser__oxsal']) . " " . $aParams['oxuser__oxfname'] . " " . $aParams['oxuser__oxlname'] . "(" . $aParams['oxuser__oxusername'] . ")<br /><br />" . nl2br(oxRegistry::getConfig()->getRequestParameter('c_message'));
$oEmail = oxNew('oxemail');
if ($oEmail->sendContactMail($aParams['oxuser__oxusername'], $sSubject, $sMessage)) {
$this->_blContactSendStatus = 1;
} else {
oxRegistry::get("oxUtilsView")->addErrorToDisplay('ERROR_MESSAGE_CHECK_EMAIL');
}
}
示例2: processCallBack
/**
* Processes PayPal callback
*
* @return null
*/
public function processCallBack()
{
$oPayPalService = $this->getPayPalCheckoutService();
$this->_setParamsForCallbackResponse($oPayPalService);
$sRequest = $oPayPalService->callbackResponse();
oxRegistry::getUtils()->showMessageAndExit($sRequest);
}
示例3: _doStartUpChecks
/**
* Extends the startup checks with Barzahlen plugin version check.
*
* @return array
*/
protected function _doStartUpChecks()
{
$aMessage = parent::_doStartUpChecks();
$oxConfig = $this->getConfig();
$sShopId = $oxConfig->getShopId();
$sModule = oxConfig::OXMODULE_MODULE_PREFIX . $this->_sModuleId;
$sPluginCheck = $oxConfig->getShopConfVar('bzPluginCheck', $sShopId, $sModule);
// only check once a week
if ($sPluginCheck != null && $sPluginCheck > strtotime("-1 week")) {
return $aMessage;
}
$oxConfig->saveShopConfVar('str', 'bzPluginCheck', time(), $sShopId, $sModule);
$sBzShopId = $oxConfig->getShopConfVar('bzShopId', $sShopId, $sModule);
$sShopsystem = 'OXID 4.7/5.0';
$sShopsystemVersion = $oxConfig->getVersion();
$sPluginVersion = self::CURRENTVERSION;
try {
$oChecker = new Barzahlen_Version_Check();
$newAvailable = $oChecker->isNewVersionAvailable($sBzShopId, $sShopsystem, $sShopsystemVersion, $sPluginVersion);
} catch (Exception $e) {
oxRegistry::getUtils()->writeToLog(date('c') . " " . $e . "\r\r", self::LOGFILE);
}
if ($newAvailable) {
$aMessage['warning'] .= (!empty($aMessage['warning']) ? "<br>" : '') . sprintf(oxRegistry::getLang()->translateString('BZ__NEW_PLUGIN_AVAILABLE'), $oChecker->getNewPluginVersion(), $oChecker->getNewPluginUrl());
}
return $aMessage;
}
示例4: sendForgotPwdEmail
public function sendForgotPwdEmail($sEmailAddress, $sSubject = null)
{
oxRegistry::getUtils()->writeToLog($sEmailAddress . " haz forgot pwd!", 'pwd.log');
$ret = parent::sendForgotPwdEmail($sEmailAddress, $sSubject);
oxRegistry::getUtils()->writeToLog($sEmailAddress . " haz forgot pwd!!!!", 'pwd.log');
return $this->isDebug() ? $this : $ret;
}
示例5: genVariantFromSell
/**
* Generate variants from selection lists
*
* @param array $aSels ids of selection list
* @param object $oArticle parent article
*/
public function genVariantFromSell($aSels, $oArticle)
{
$oVariants = $oArticle->getAdminVariants();
$myConfig = $this->getConfig();
$myUtils = oxRegistry::getUtils();
$myLang = oxRegistry::getLang();
$aConfLanguages = $myLang->getLanguageIds();
foreach ($aSels as $sSelId) {
$oSel = oxNew("oxi18n");
$oSel->setEnableMultilang(false);
$oSel->init('oxselectlist');
$oSel->load($sSelId);
$sVarNameUpdate = "";
foreach ($aConfLanguages as $sKey => $sLang) {
$sPrefix = $myLang->getLanguageTag($sKey);
$aSelValues = $myUtils->assignValuesFromText($oSel->{"oxselectlist__oxvaldesc" . $sPrefix}->value);
foreach ($aSelValues as $sI => $oValue) {
$aValues[$sI][$sKey] = $oValue;
}
$aSelTitle[$sKey] = $oSel->{"oxselectlist__oxtitle" . $sPrefix}->value;
$sMdSeparator = $oArticle->oxarticles__oxvarname->value ? $this->_sMdSeparator : '';
if ($sVarNameUpdate) {
$sVarNameUpdate .= ", ";
}
$sVarName = oxDb::getDb()->quote($sMdSeparator . $aSelTitle[$sKey]);
$sVarNameUpdate .= "oxvarname" . $sPrefix . " = CONCAT(oxvarname" . $sPrefix . ", " . $sVarName . ")";
}
$oMDVariants = $this->_assignValues($aValues, $oVariants, $oArticle, $aConfLanguages);
if ($myConfig->getConfigParam('blUseMultidimensionVariants')) {
$oAttribute = oxNew("oxattribute");
$oAttribute->assignVarToAttribute($oMDVariants, $aSelTitle);
}
$this->_updateArticleVarName($sVarNameUpdate, $oArticle->oxarticles__oxid->value);
}
}
示例6: render
/**
* Checks if given token is valid, formats HTTP headers,
* and outputs file to buffer.
*
* If token is not valid, redirects to start page.
*/
public function render()
{
$sFileOrderId = oxRegistry::getConfig()->getRequestParameter('sorderfileid');
if ($sFileOrderId) {
$oArticleFile = oxNew('oxFile');
try {
/** @var oxOrderFile $oOrderFile */
$oOrderFile = oxNew('oxOrderFile');
if ($oOrderFile->load($sFileOrderId)) {
$sFileId = $oOrderFile->getFileId();
$blLoadedAndExists = $oArticleFile->load($sFileId) && $oArticleFile->exist();
if ($sFileId && $blLoadedAndExists && $oOrderFile->processOrderFile()) {
$oArticleFile->download();
} else {
$sError = "ERROR_MESSAGE_FILE_DOESNOT_EXIST";
}
}
} catch (oxException $oEx) {
$sError = "ERROR_MESSAGE_FILE_DOWNLOAD_FAILED";
}
} else {
$sError = "ERROR_MESSAGE_WRONG_DOWNLOAD_LINK";
}
if ($sError) {
$oEx = new oxExceptionToDisplay();
$oEx->setMessage($sError);
oxRegistry::get("oxUtilsView")->addErrorToDisplay($oEx, false);
oxRegistry::getUtils()->redirect(oxRegistry::getConfig()->getShopUrl() . 'index.php?cl=account_downloads');
}
}
示例7: send
/**
* Composes and sends drawal form, returns false if some parameters are missing
*
* @return bool
*/
public function send()
{
$aParams = $this->getConfig()->getRequestParameter('editval');
// checking email address
if (!oxRegistry::getUtils()->isValidEmail($aParams['pswdf_email'])) {
oxRegistry::get("oxUtilsView")->addErrorToDisplay('ERROR_MESSAGE_INPUT_NOVALIDEMAIL');
return false;
}
// spam spider prevension
$sMac = $this->getConfig()->getRequestParameter('c_mac');
$sMacHash = $this->getConfig()->getRequestParameter('c_mach');
$oCaptcha = $this->getCaptcha();
if (!$oCaptcha->pass($sMac, $sMacHash)) {
// even if there is no exception, use this as a default display method
oxRegistry::get("oxUtilsView")->addErrorToDisplay('MESSAGE_WRONG_VERIFICATION_CODE');
return false;
}
$sSubject = $this->getConfig()->getRequestParameter('c_subject');
if (!$aParams['pswdf_ordernr'] || !$aParams['pswdf_articles'] || !$aParams['pswdf_orderdate'] || !$aParams['pswdf_receiveddate'] || !$aParams['pswdf_name'] || !$aParams['pswdf_address'] || !$aParams['pswdf_email'] || !$aParams['pswdf_drawaldate']) {
// even if there is no exception, use this as a default display method
oxRegistry::get("oxUtilsView")->addErrorToDisplay('ERROR_MESSAGE_INPUT_NOTALLFIELDS');
return false;
}
$oShop = $this->getConfig()->getActiveShop();
$oLang = oxRegistry::getLang();
$sMessage = $oLang->translateString('PSWDF_MSG2') . "\r\n\r\n" . $oLang->translateString('PSWDF_ORDERNR') . " " . $aParams['pswdf_ordernr'] . "\r\n" . $oLang->translateString('PSWDF_DATE_ARTICLES') . " " . $aParams['pswdf_articles'] . "\r\n" . $oLang->translateString('PSWDF_DATE_ORDER') . " " . $aParams['pswdf_orderdate'] . "\r\n" . $oLang->translateString('PSWDF_DATE_RECEIVED') . " " . $aParams['pswdf_receiveddate'] . "\r\n\r\n" . $oLang->translateString('PSWDF_NAME') . " " . $aParams['pswdf_name'] . "\r\n" . $oLang->translateString('PSWDF_ADDRESS') . " " . $aParams['pswdf_address'] . "\r\n" . $oLang->translateString('PSWDF_EMAIL') . " " . $aParams['pswdf_email'] . "\r\n" . $oLang->translateString('PSWDF_DATE_DRAWAL') . " " . $aParams['pswdf_drawaldate'] . "\r\n";
$oEmail = oxNew('oxemail');
$blSendToOwner = $oEmail->sendEmail($oShop->oxshops__oxorderemail->value, $oLang->translateString('PSWDF_SUBJECT') . " " . $aParams['pswdf_name'] . " (#" . $aParams['pswdf_ordernr'] . ")", $sMessage);
$blSendToCustomer = $oEmail->sendEmail($aParams['pswdf_email'], $oLang->translateString('PSWDF_SUBJECT_CUSTOMER') . " " . $aParams['pswdf_name'] . " (#" . $aParams['pswdf_ordernr'] . ")", $sMessage);
if ($blSendToOwner && $blSendToCustomer) {
$this->_blDrawalFormSendStatus = 1;
} else {
oxRegistry::get("oxUtilsView")->addErrorToDisplay('ERROR_MESSAGE_CHECK_EMAIL');
}
}
示例8: handlePageNotFoundError
/**
* handler for 404 (page not found) error
*
* @param string $sUrl url which was given, can be not specified in some cases
*
* @return void
*/
public function handlePageNotFoundError($sUrl = '')
{
// module active?
if (!oxRegistry::getConfig()->getConfigParam("psRedirect404_status")) {
return parent::handlePageNotFoundError($sUrl = '');
}
$iShortest = -1;
$iHeaderType = 302;
$sSearchString = $this->_clearUrl($sUrl);
// psRedirect404
// checks based on levenshtein algorithm closest url from
// oxid seo urls (oxseo) and redirect with header 302 to this page
try {
foreach ($this->_getSeoUrls() as $value) {
$sUrl = $this->_clearUrl($value[0]);
$sLevRes = levenshtein($sSearchString, $sUrl);
#echo $sLevRes." - ".$sUrl." (".$value[0].")<br>";
if ($sLevRes <= $iShortest || $iShortest < 0) {
$sClosest = $value[0];
$iShortest = $sLevRes;
if ($sLevRes <= 10 && oxRegistry::getConfig()->getConfigParam("psRedirect404_redirecttype") == "auto") {
$iHeaderType = 301;
}
}
}
if (!oxRegistry::getConfig()->getConfigParam("psRedirect404_redirecttype") == "301") {
$iHeaderType = 301;
}
oxRegistry::getUtils()->redirect(oxRegistry::getConfig()->getShopUrl() . $sClosest, false, $iHeaderType);
} catch (Exception $e) {
}
$this->showMessageAndExit("Found");
}
示例9: render
/**
* Kicks off the notification process and sends out the header after a
* successful or not successful hash validation.
*
* @return string current template file name
*/
public function render()
{
parent::render();
$oUpdateHandler = $this->_getUpdateHandler();
if (!$oUpdateHandler->checkData($_GET)) {
$this->_sendHeader(self::STATUS_BAD_REQUEST);
return;
}
switch ($oUpdateHandler->getState()) {
case self::STATE_PAID:
case self::STATE_EXPIRED:
$success = $oUpdateHandler->updatePayment();
break;
case self::STATE_REFUND_COMPLETED:
case self::STATE_REFUND_EXPIRED:
$success = $oUpdateHandler->updateRefund();
break;
default:
oxRegistry::getUtils()->writeToLog(date('c') . 'Notification failed: Unknown state - ' . $oUpdateHandler->getState() . "\r\r", self::LOGFILE);
$success = false;
break;
}
if (!$success) {
$this->_sendHeader(self::STATUS_BAD_REQUEST);
return;
}
$this->_sendHeader(self::STATUS_OK);
return 'page/shop/start.tpl';
}
示例10: send
/**
* Composes and sends user written message, returns false if some parameters
* are missing.
*
* @return bool
*/
public function send()
{
$aParams = oxRegistry::getConfig()->getRequestParameter('editval');
// checking email address
if (!oxRegistry::getUtils()->isValidEmail($aParams['oxuser__oxusername'])) {
oxRegistry::get("oxUtilsView")->addErrorToDisplay('ERROR_MESSAGE_INPUT_NOVALIDEMAIL');
return false;
}
$sSubject = oxRegistry::getConfig()->getRequestParameter('c_subject');
if (!$aParams['oxuser_oxfnameandlname'] || !$aParams['oxuser__oxusername'] || !$sSubject) {
// even if there is no exception, use this as a default display method
oxRegistry::get("oxUtilsView")->addErrorToDisplay('ERROR_MESSAGE_INPUT_NOTALLFIELDS');
return false;
}
$oLang = oxRegistry::getLang();
$sMessage = $oLang->translateString('MESSAGE_FROM') . " " . $oLang->translateString($aParams['oxuser__oxsal']) . " " . $aParams['oxuser_oxfnameandlname'] . " " . $aParams['oxuser__oxlname'] . " " . $aParams['oxuser__oxcompany'] . " (" . $aParams['oxuser__oxusername'] . ")<br /><br />" . ($sOnlyMessage = nl2br(oxRegistry::getConfig()->getRequestParameter('c_message')));
$aSpamwords = $this->getConfig()->getConfigParam('aJsSpamProtection');
if ($aSpamwords == 0) {
foreach ($aSpamwords as $sSpamword) {
$sSpamwordToLower = strtolower($sSpamword);
if (strpos(strtolower($sSubject), $sSpamwordToLower) !== false || strpos(strtolower($aParams['oxuser__oxusername']), $sSpamwordToLower) !== false || strpos(strtolower($aParams['oxuser_oxfnameandlname']), $sSpamwordToLower) !== false || strpos(strtolower($aParams['oxuser__oxcompany']), $sSpamwordToLower) !== false || strpos(strtolower($sOnlyMessage), $sSpamwordToLower) !== false) {
$this->_blSpamStatus = 1;
return false;
}
}
}
$oEmail = oxNew('oxemail');
if ($oEmail->sendContactMail($aParams['oxuser__oxusername'], $sSubject, $sMessage)) {
$this->_blContactSendStatus = 1;
} else {
oxRegistry::get("oxUtilsView")->addErrorToDisplay('ERROR_MESSAGE_CHECK_EMAIL');
}
}
示例11: testLoadVoucherList
public function testLoadVoucherList()
{
$myUtils = oxRegistry::getUtils();
$oVouchers = oxNew('oxvoucherlist');
$oVouchers->selectString('select * from oxvouchers where oxvouchers.oxvoucherserieid = "' . $this->_sOxid . '"');
$this->assertEquals(self::MAX_LOOP_AMOUNT, $oVouchers->count());
}
示例12: request_product
public function request_product()
{
$myConfig = $this->getConfig();
$myUtils = oxRegistry::getUtils();
//control captcha
$sMac = oxRegistry::getConfig()->getRequestParameter('c_mac');
$sMacHash = oxRegistry::getConfig()->getRequestParameter('c_mach');
$oCaptcha = $this->getCaptcha();
if (!$oCaptcha->pass($sMac, $sMacHash)) {
oxRegistry::get("oxUtilsView")->addErrorToDisplay('MESSAGE_WRONG_VERIFICATION_CODE');
return;
}
/** @var oxMailValidator $oMailValidator */
$oMailValidator = oxNew('oxMailValidator');
$aParams = oxRegistry::getConfig()->getRequestParameter('pa');
if (!isset($aParams['email']) || !$oMailValidator->isValidEmail($aParams['email'])) {
oxRegistry::get("oxUtilsView")->addErrorToDisplay('MESSAGE_INVALID_EMAIL');
return;
}
$aParams['aid'] = $this->getProduct()->getId();
$oArticleRequest = oxNew("psarticlerequest");
$oArticleRequest->psarticlerequest__oxuserid = new oxField(oxRegistry::getSession()->getVariable('usr'));
$oArticleRequest->psarticlerequest__oxemail = new oxField($aParams['email']);
$oArticleRequest->psarticlerequest__oxartid = new oxField($aParams['aid']);
$oArticleRequest->psarticlerequest__oxshopid = new oxField($myConfig->getShopId());
$oArticleRequest->psarticlerequest__oxlang = new oxField(oxRegistry::getLang()->getBaseLanguage());
$oArticleRequest->psarticlerequest__oxstatus = new oxField(psArticleRequest::STATUS_RECEIVED);
$oArticleRequest->save();
$oEmail = oxNew("oxEmail");
$oEmail->sendArticleRequestNotification($aParams, $oArticleRequest);
$this->_iArticleRequestStatus = 1;
oxRegistry::get("oxUtilsView")->addErrorToDisplay('PS_ARTICLEREQUEST_SUCCESS');
}
示例13: prepareOrder
/**
* Paymorrow function for Verifying Form Data against Paymorrow Services
*/
public function prepareOrder()
{
/** @var OxpsPaymorrowRequestControllerProxy $oPmGateWay */
$oPmGateWay = oxNew('OxpsPaymorrowRequestControllerProxy');
$oUtils = oxRegistry::getUtils();
$oUtils->setHeader("Content-Type: application/json");
$oUtils->showMessageAndExit($oPmGateWay->prepareOrder($_POST));
}
示例14: render
/**
* Executes parent method parent::render(), prints shop and
* PHP configuration information.
*
* @return string
*/
public function render()
{
if ($this->getConfig()->isDemoShop()) {
return oxRegistry::getUtils()->showMessageAndExit("Access denied !");
}
parent::render();
return "tools.tpl";
}
示例15: init
public function init()
{
parent::init();
if (!oxRegistry::getConfig()->getRequestParameter('fnc')) {
$oViewConf = $this->getViewConfig();
oxRegistry::getUtils()->redirect($oViewConf->getHomeLink(), false);
}
}