本文整理汇总了PHP中CMS::textReplace方法的典型用法代码示例。如果您正苦于以下问题:PHP CMS::textReplace方法的具体用法?PHP CMS::textReplace怎么用?PHP CMS::textReplace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMS
的用法示例。
在下文中一共展示了CMS::textReplace方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: replace
protected function replace($model, $content)
{
if ($model instanceof Order) {
$array['%ORDER_ID%'] = $model->id;
$array['%ORDER_KEY%'] = $model->secret_key;
$array['%TOTAL_PRICE%'] = ShopProduct::formatPrice(Yii::app()->currency->convert($model->full_price));
$array['%USER_NAME%'] = $model->user_name;
$array['%USER_PHONE%'] = $model->user_phone;
$array['%USER_EMAIL%'] = $model->user_email;
$array['%USER_ADDRESS%'] = $model->user_address;
$array['%ORDER_URL%'] = $model->getAbsoluteUrl();
}
$array['%CURRENT_CURRENCY%'] = Yii::app()->currency->active->symbol;
return CMS::textReplace($content, $array);
}
示例2: sendMessage
public function sendMessage()
{
$config = Yii::app()->settings->get('contacts');
$mails = explode(',', $config['form_emails']);
$tempArray = array('{sender_name}' => $this->name, '{sender_email}' => $this->email, '{sender_message}' => CHtml::encode($this->msg), '{sender_phone}' => $this->phone);
$mailer = Yii::app()->mail;
$mailer->From = 'noreply@' . Yii::app()->request->serverName;
$mailer->FromName = Yii::t('ContactsModule.default', 'FB_FORM_NAME');
$mailer->Subject = Yii::t('ContactsModule.default', 'FB_FROM_MESSAGE', array('{name}' => isset($this->name) ? Html::encode($this->name) : $this->email, '{site_name}' => Yii::app()->settings->get('core', 'site_name')));
$mailer->Body = Html::text(CMS::textReplace($config['tempMessage'], $tempArray));
foreach ($mails as $mail) {
$mailer->AddAddress($mail);
}
$mailer->isHtml(true);
$mailer->AddReplyTo($this->email);
$mailer->Send();
}
示例3: replace_subject
public function replace_subject($array)
{
return CMS::textReplace($this->subject, CMap::mergeArray($this->replace_default(), $array));
}
示例4: replaceMeta
public function replaceMeta($text)
{
$array = array("%PRODUCT_NAME%" => $this->name, "%PRODUCT_PRICE%" => $this->price, "%PRODUCT_ARTICLE%" => $this->sku, "%PRODUCT_PCS%" => $this->pcs, "%PRODUCT_BRAND%" => $this->manufacturer->name, "%PRODUCT_MAIN_CATEGORY%" => $this->mainCategory->name, "%CURRENT_CURRENCY%" => Yii::app()->currency->active->symbol);
return CMS::textReplace($text, $array);
}
示例5: replace
protected function replace($order, $list, $content)
{
$replace = array('%ORDER_ID%', '%ORDER_KEY%', '%ORDER_DELIVERY_NAME%', '%ORDER_PAYMENT_NAME%', '%TOTAL_PRICE%', '%USER_NAME%', '%USER_PHONE%', '%USER_EMAIL%', '%USER_ADDRESS%', '%USER_COMMENT%', '%CURRENT_CURRENCY%', '%FOR_PAYMENY%', '%LIST%', '%LINK_TO_ORDER%');
$to = array($order->id, $order->secret_key, $order->deliveryMethod->name, $order->paymentMethod->name, $order->total_price, $order->user_name, $order->user_phone, $order->user_email, $order->user_address, isset($order->user_comment) ? $order->user_comment : '', Yii::app()->currency->active->symbol, ShopProduct::formatPrice($order->total_price + $order->delivery_price), $list, Html::link($this->createAbsoluteUrl('view', array('secret_key' => $order->secret_key)), $this->createAbsoluteUrl('view', array('secret_key' => $order->secret_key))));
return CMS::textReplace($content, $replace, $to);
}
示例6: replaceMeta
public function replaceMeta($text)
{
$replace = array("%CATEGORY_NAME%", "%SUB_CATEGORY_NAME%", "%CURRENT_CURRENCY%");
$to = array($this->name, $this->parent()->find()->name == 'root' ? '' : $this->parent()->find()->name, Yii::app()->currency->active->symbol);
return CMS::textReplace($text, $replace, $to);
}
示例7: getMessage
public function getMessage()
{
$params = array();
$params['%USER_LOGIN%'] = Yii::app()->user->login;
return CMS::textReplace($this->message, $params);
}