本文整理汇总了PHP中Common::myStringReplace方法的典型用法代码示例。如果您正苦于以下问题:PHP Common::myStringReplace方法的具体用法?PHP Common::myStringReplace怎么用?PHP Common::myStringReplace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Common
的用法示例。
在下文中一共展示了Common::myStringReplace方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareString
/**
* Prepare string from a template
* @param type $template
* @return type
*/
protected function prepareString($template)
{
//supported placeholder : {table} {date} {row_detais}
$details = '';
foreach ($this->getOwner()->metadata->tableSchema->columns as $columnName => $column) {
$details .= $columnName . '=' . $this->getOwner()->{$columnName} . ', ';
}
return Common::myStringReplace($template, array('{date}' => Yii::app()->localtime->fromLocalDateTime(time()), '{table}' => $this->getOwner()->tableName(), '{row_details}' => $details));
}
示例2: sendAccActivationEmail
public function sendAccActivationEmail()
{
$owner = $this->getOwner();
$template = SettingsEmailTemplate::model()->getRow('*', '`key`=:t1', array(':t1' => SettingsEmailTemplate::KEY_ACCOUNT_ACTIVATION));
if (empty($template)) {
return FALSE;
}
$site_name = Yii::app()->settings->get(Constants::CATEGORY_GENERAL, Constants::KEY_SITE_NAME, Yii::app()->name);
//placeholders: {name},{link},
$body = Common::myStringReplace($template['body'], array('{name}' => $owner->username, '{link}' => Yii::app()->createAbsoluteUrl('auth/default/activate', array('id' => $owner->id, 'token' => $owner->activation_code))));
MsgEmailOutbox::model()->push(array('from_name' => $site_name, 'from_email' => $template['from'], 'to_email' => $owner->email, 'subject' => $template['subject'], 'message' => $body));
}
示例3: sendEmail
public function sendEmail()
{
$this->user_model->password_reset_code = Common::generateSalt();
$this->user_model->password_reset_request_date = date('Y-m-d H:i:s');
$this->user_model->save(false);
$template = SettingsEmailTemplate::model()->getRow('*', '`key`=:t1', array(':t1' => SettingsEmailTemplate::KEY_FORGOT_PASSWORD));
if (empty($template)) {
return FALSE;
}
//placeholders : {name},{link}
$body = Common::myStringReplace($template['body'], array('{name}' => Person::model()->get($this->user_model->id, 'CONCAT(first_name," ",last_name)'), '{link}' => Yii::app()->createAbsoluteUrl('auth/default/resetPassword', array('id' => $this->user_model->id, 'token' => $this->user_model->password_reset_code))));
//$from, $this->user_model->email, $template->title, $template->body, true
MsgEmailOutbox::model()->push(array('from_name' => Yii::app()->settings->get(Constants::CATEGORY_GENERAL, Constants::KEY_SITE_NAME, Yii::app()->name), 'from_email' => $template['from'], 'to_email' => $this->user_model->email, 'subject' => $template['subject'], 'message' => $body));
}
示例4: run
public function run()
{
echo CHtml::beginForm($this->action, $this->method, $this->formHtmlOptions);
$search_field = Common::myStringReplace($this->search_field_template, array('{{label_text}}' => Lang::t('Search'), '{{search_field}}' => CHtml::activeTextField($this->model, $this->search_field_name, $this->searchFieldHtmlOptions)));
echo $search_field;
echo CHtml::endForm();
}
示例5: run
public function run()
{
$graph_type_filter = '';
$date_range_filter = '';
$filter_form = '';
if ($this->showGraphTypeFilter) {
$graph_type_filter = CHtml::dropDownList(HighCharts::GET_PARAM_GRAPH_TYPE, HighCharts::getGraphType(), HighCharts::graphTypes(), $this->graphTypeFilterHtmlOptions);
}
if ($this->showDateRangeFilter) {
$date_range_string = $this->date_range_from . ' - ' . $this->date_range_to;
$date_range_filter = CHtml::tag('span', array(), $date_range_string);
$date_range_hidden = CHtml::hiddenField(HighCharts::GET_PARAM_DATE_RANGE);
$date_range_filter_container = CHtml::tag('div', $this->dateRangeFilterHtmlOptions, $date_range_hidden . '<i class="icon-calendar icon-large"></i> ' . $date_range_filter . ' <b class = "caret"></b>');
}
if ($this->showFilter) {
$filter_form .= CHtml::beginForm(Yii::app()->createUrl($this->owner->route, $this->owner->actionParams), 'get', $this->filterFormHtmlOptions);
$filter_form .= Common::myStringReplace($this->filterFormTemplate, array('{graph_type}' => $graph_type_filter, '{date_range}' => $date_range_filter_container));
$filter_form .= CHtml::hiddenField(HighCharts::GET_PARAM_HIGHCHART_FLAG, true);
$filter_form .= CHtml::endForm();
}
$chart = CHtml::tag('div', array('id' => $this->chartID), '', true);
$contents = Common::myStringReplace($this->chartTemplate, array('{filter_form}' => $filter_form, '{chart}' => $chart));
echo CHtml::tag('div', $this->htmlOptions, $contents);
}
示例6: renderSearchInfo
public function renderSearchInfo()
{
if (!isset($_GET[self::SEARCH_GET_KEY])) {
return FALSE;
}
$text = CHtml::encode($_GET[self::SEARCH_GET_KEY]);
$search_info = Common::myStringReplace($this->search_info_template, array('{search_term}' => $text, '{count}' => number_format($this->dataProvider->getTotalItemCount())));
echo $search_info;
}