Set a feedback message
@param  string $sType    The type of message to set
@param  string $sMessage The message to set
@return Object
495156
public function set($sType, $sMessage)
    {
        $sType    = strtoupper(trim($sType));
        $sMessage = trim($sMessage);

        $this->aMessages[$sType] = $sMessage;

        return $this;
    }
165849
protected function CallPayPalExpressCheckout($sMessageConsumer)
    {
        $oGlobal = TGlobal::instance();

        $sReturnURLBase = $this->getActivePageService()->getActivePage()->GetRealURLPlain(array(), true);
        if ('.html' == substr($sReturnURLBase, -5)) {
            $sReturnURLBase = substr($sReturnURLBase, 0, -5);
        }
        if ('/' != substr($sReturnURLBase, -1)) {
            $sReturnURLBase .= '/';
        }
        $sSuccessURL = $sReturnURLBase.self::URL_IDENTIFIER.'success/spot_'.$oGlobal->GetExecutingModulePointer()->sModuleSpotName;
        $sCancelURL = $sReturnURLBase.self::URL_IDENTIFIER.'cancel/spot_'.$oGlobal->GetExecutingModulePointer()->sModuleSpotName;

        $oBasket = TShopBasket::GetInstance();

        $aParameter = array();
        $aParameter['PAYMENTREQUEST_0_AMT'] = number_format($oBasket->dCostTotal, 2); // the total value to charge (use US-Format (1000.00)
        $aParameter['PAYMENTREQUEST_0_CURRENCYCODE'] = $this->GetCurrencyIdentifier();
        $aParameter['RETURNURL'] = $sSuccessURL; // go to the checkout complete page
        $aParameter['CANCELURL'] = $sCancelURL; //urldecode(str_replace('&amp;','&',$oActivePage->GetRealURL(array('paypalreturn'=>'1'),$aExcludes,true))); // return to the cancel page

        // styling
        $aParameter['HDRIMG'] = ''; // - : specify an image to appear at the top left of the payment page
        $aParameter['HDRBORDERCOLOR'] = ''; // - : set the border color around the header of the payment page
        $aParameter['HDRBACKCOLOR'] = ''; // - : set the background color for the background of the header of the payment page
        $aParameter['PAYFLOWCOLOR'] = ''; // - : set the background color for the payment page

        //$aParameter['notify_url'] = $this->GetInstantPaymentNotificationListenerURL(); // instant payment notification url

        $logger = $this->getPaypalLogger();

        $logger->info('Parameters sent to the PayPal API', $aParameter);
        $aResponse = $this->ExecutePayPalCall('SetExpressCheckout', $aParameter);

        $sSuccess = false;
        // store relevant data in session - and redirect to paypal
        if (array_key_exists('ACK', $aResponse)) {
            $sAckResponse = strtoupper($aResponse['ACK']);
            if ('SUCCESS' == $sAckResponse) {
                $this->sPayPalToken = urldecode($aResponse['TOKEN']);
                $payPalURL = $this->GetConfigParameter('url').'?cmd=_express-checkout&token='.$this->sPayPalToken;
                $this->getRedirect()->redirect($payPalURL);
                $sSuccess = true;
            }
        }
        if (!$sSuccess) {
            $sResponse = self::GetPayPalErrorMessage($aResponse);
            $logger->critical('PayPal payment could not be initiated.', array($sResponse));

            $oMsgManager = TCMSMessageManager::GetInstance();
            $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-PAYMENT-ERROR', array('errorMsg' => 'Error Number: '.$aResponse['L_ERRORCODE0']));
        }

        return $sSuccess;
    }
1137333
protected function setBodyWithAttachments(Mail\Message $oMessage, array $aAttachments, $sHtml, $sPlain)
    {
        $oContent = $this->getContentMessage($sHtml, $sPlain);

        $oContentPart = new Mime\Part($oContent->generateMessage());
        $oContentPart->setType(Mime\Mime::MULTIPART_ALTERNATIVE);
        $oContentPart->setBoundary($oContent->getMime()->boundary());

        $oBody = new Mime\Message();
        $oBody->addPart($oContentPart);

        foreach ($aAttachments as $aAttachmentData) {
            if (isset($aAttachmentData['file_path']) && is_readable($aAttachmentData['file_path'])) {
                $aAttachmentData['file_data'] = file_get_contents($aAttachmentData['file_path']);
            }

            if (isset($aAttachmentData['file_data']) && $aAttachmentData['file_data'] != '') {
                $oAttachment = new Mime\Part();
                $oAttachment
                    ->setContent($aAttachmentData['file_data'])
                    ->setType(Mime\Mime::TYPE_OCTETSTREAM)
                    ->setFileName($aAttachmentData['name'])
                    ->setDisposition(Mime\Mime::DISPOSITION_ATTACHMENT)
                    ->setEncoding(Mime\Mime::ENCODING_BASE64);

                $oBody->addPart($oAttachment);
            }
        }

        $oMessage->setBody($oBody);

        return $this;
    }
1194046
protected function setBody(Mail\Message $oMessage, array $aAttachments, $sHtml, $sPlain)
    {
        if (empty($aAttachments)) {
            $this->setBodyWithoutAttachments($oMessage, $sHtml, $sPlain);

            return $this;
        }

        $this->setBodyWithAttachments($oMessage, $aAttachments, $sHtml, $sPlain);

        return $this;
    }
519083
public function createMessage($subject = null, $body = null, $contentType = null, $charset = null)
    {
        $message = Swift_Message::newInstance($subject, $body, $contentType, $charset);

        if(null !== $this->fromEmail) {
            
            if(null === $this->fromName) {
                $message->setFrom($this->fromEmail);
            } else {
                $message->setFrom($this->fromEmail, $this->fromName);
            }
            
        }

        return $message;
    }
170405
public function ValidateBasketContents($sMessageManager)
    {
        $bIsValid = true;
        $oMessage = TCMSMessageManager::GetInstance();
        $iPt = $this->getItemPointer();
        $this->GoToStart();
        while ($oTmp = $this->Next()) {
            if ($oTmp->TotalStockAvailable() < $oTmp->dAmount) {
                $aErrorCodes = $oTmp->GetSQLWithTablePrefix();
                $aErrorCodes['dStockWanted'] = $oTmp->dAmount;
                if ($oTmp->TotalStockAvailable() > 0) {
                    $aErrorCodes['dStockAvailable'] = $oTmp->TotalStockAvailable();
                    $oMessage->AddMessage($sMessageManager, 'ERROR-ADD-TO-BASKET-NOT-ENOUGH-STOCK', $aErrorCodes);
                    $this->validateBasketContentBuyable($oTmp, $sMessageManager);
                } else {
                    $oMessage->AddMessage($sMessageManager, 'ERROR-ADD-TO-BASKET-NO-STOCK', $aErrorCodes);
                }
                $oTmp->dAmount = $oTmp->TotalStockAvailable();
                $this->UpdateItemAmount($oTmp);
                $bIsValid = false;
            } else {
                $bIsValid = $this->validateBasketContentBuyable($oTmp, $sMessageManager) && $bIsValid;
            }
        }
        if ($iPt > $this->Length()) {
            $iPt = $this->Length();
        }
        $this->setItemPointer($iPt);

        return $bIsValid;
    }
1250157
private function processLeadingIndentationTags ($sMessage)
    {
        $bTagFound = true;
        while ($bTagFound && strlen($sMessage) > 0) {
            if (substr($sMessage, 0, $this->iIndentTagLength) == $this->aConfig['indent_tag']) {
                $this->iIndentationLevel++;
                $sMessage = substr($sMessage, $this->iIndentTagLength);
            } elseif (substr($sMessage, 0, $this->iUnindentTagLength) == $this->aConfig['unindent_tag']) {
                $this->iIndentationLevel = max(0, $this->iIndentationLevel-1);
                $sMessage = substr($sMessage, $this->iUnindentTagLength);
            } else {
                $bTagFound = false;
            }
        }
        return $sMessage;
    }
1311296
public function addError(string $strKey, string $strMessage)
    {
        $this->aErrors[$strKey] = $strMessage;
        return $this;
    }
445413
public static function debug($sType, $sMessage, $bHead = FALSE) {

		if (!self::init()) {
			return FALSE;
		}

		if (!is_string($sType) && !preg_match('#[0-9a-z\_]{1, 30}#', $sType)) {
			return FALSE;
		}

		$sFile = self::$_sDebugPath . $sType;

		if (!self::_prepareWriteFile($sFile)) {
			return FALSE;
		}

		if (!is_string($sMessage)) {
			$sMessage = json_encode($sMessage, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
		}

		$sMessage = preg_replace('#\e\[?.*?[\@-~]#', '', $sMessage);

		if ($bHead) {

			$fTime = microtime(TRUE);

			$sTime = date(Config::get('log')['time_format'], $fTime);
			$sTime .= substr(sprintf('%.03f' ,$fTime), -4);

			$fTimeCost = sprintf('%10s', sprintf('%.06f', $fTime - $_SERVER['REQUEST_TIME_FLOAT']));
			$sHead = '[' . $sTime . '] [' . $fTimeCost . '] ' . "\n"
				. ($_SERVER['REQUEST_URI'] ?: $_SERVER['SCRIPT_FILENAME'])."\n"
				. "\n";
			$sMessage = $sHead.$sMessage."\n";
		}

		$sMessage .= "\n";

		return file_put_contents($sFile, $sMessage, FILE_APPEND | LOCK_EX);
	}
581632
public void setClientInfo (String msg, String ltype)
    {
        message = msg;
        localtype = ltype;
        bundle = null;
        timestamp = System.currentTimeMillis();
    }
81236
function setMessageObject(ResponseInterface $httpMessage)
    {
        if (!$httpMessage instanceof ResponseInterface)
            throw new \InvalidArgumentException(sprintf(
                'This plugin need response object instance of iHttpResponse, "%s" given.'
                , get_class($httpMessage)
            ));

        $this->messageObject = $httpMessage;
        return $this;
    }
796708
protected function getErrorMessage($nCode, $strMessage = null)
    {
        $strReturn = 'Failure: ';
        if (null !== $this->strResourcePath) {
            $strReturn = 'Path: "'.$this->strResourcePath.'" ';
        }
        $strReturn .= 'Name: "'.$this->strResourceName.'"';
        $strReturn .= ' Code: ';
        switch ($nCode) {
            case self::FAILURE_IO:
                $strReturn .= 'General IO Error';
                break;
            case self::FAILURE_NOT_WRITEABLE:
                $strReturn .= 'not writeable';
                break;
            case self::FAILURE_NOT_READABLE:
                $strReturn .= 'not readable';
                break;
            case self::FAILURE_NOT_FOUND:
                $strReturn .= 'not found';
                break;
            default:
                $strReturn .= (string) $nCode;
                break;
        }
        if (null !== $strMessage) {
            $strReturn .= ' with message: "'.$strMessage.'"';
        }

        return $strReturn;
    }
517475
public function setMessage($type, $message)
    {
        if (!is_null($message)) {
            $this->messages[] = [
                'message' => $message,
                'type'    => $type,
            ];
        }

        return $this;
    }
92718
final public static function setError (string $errorMessage=NULL) : bool
	{
		static::$error = "";
		if (!static::hasValue($errorMessage)) return FALSE;
		static::$error = "Check the following field(s) ".stripComma($errorMessage)." and try again.";
		return TRUE;
	}
1120217
public static function addMessage($msg, string $type = 'danger', bool $postponed = false) {
		if (!$postponed) {
			if (is_array($msg)) {
				foreach ($msg as $k=>$v) {
					Application::set(['messages', $type], $v, ['append'=>true]);
				}
			} else {
				Application::set(['messages', $type], $msg, ['append'=>true]);
			}
		} else { // postponed messages go into session
			if (is_array($msg)) {
				foreach ($msg as $k=>$v) {
					Session::set(['numbers', 'messages', $type], $v, ['append'=>true]);
				}
			} else {
				Session::set(['numbers', 'messages', $type], $msg, ['append'=>true]);
			}
		}
	}
99311
public function setMessage($sMessage, $blOverride = false)
    {
        if ($blOverride) {
            $this->_aMessages = [];
        }

        $this->_aMessages[] = $sMessage;
    }
1259799
protected function setStringIntoTag($sString, $sTag, $features = null)
    {
        return '<' . $sTag . $this->buildAttributesForTag($features) . '>' . $sString . '</' . $sTag . '>';
    }