本文整理汇总了PHP中e函数的典型用法代码示例。如果您正苦于以下问题:PHP e函数的具体用法?PHP e怎么用?PHP e使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了e函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: newQuestion
public function newQuestion()
{
// POST İLE GÖNDERİLEN DEĞERLERİ ALALIM.
$postData = Input::all();
// FORM KONTROLLERİNİ BELİRLEYELİM
$rules = array('title' => 'required|between:3,256', 'content' => 'required');
// HATA MESAJLARINI OLUŞTURALIM
$messages = array('title.required' => 'Lütfen sorunuzun başlığını yazın', 'title.between' => 'Soru başlığı minumum 3 maksimum 256 karakterden oluşabilir', 'content.required' => 'Lütfen sorunuza ait detayları yazın');
// KONTROL (VALIDATION) İŞLEMİNİ GERÇEKLEŞTİRELİM
$validator = Validator::make($postData, $rules, $messages);
// EĞER VALİDASYON BAŞARISIZ OLURSA HATALARI GÖSTERELİM
if ($validator->fails()) {
// HATA MESAJLARI VE INPUT DEĞERLERİYLE FORMA YÖNLENDİRELİM
return Redirect::route('newQuestionForm')->withInput()->withErrors($validator->messages());
} else {
// SORUYU VERİTABANINA EKLEYELİM
$question = new Questions();
$question->user_id = Auth::user()->id;
$question->title = e(trim($postData['title']));
$question->content = e(trim($postData['content']));
$question->created_at = date('Y-m-d H:i:s');
$question->created_ip = Request::getClientIp();
$question->save();
// KULLANICIYI SORULARIN LİSTELENDİĞİ SAYFAYA YÖNLENDİRELİM
return Redirect::route('allQuestions');
}
}
示例2: action_edit
public function action_edit($id = null)
{
$student = Model_Student::find('first', ['where' => ['user_id' => $id]]);
if (!$student) {
$student = Model_Student::forge(['user_id' => $id]);
}
$val = Model_Student::validate('edit');
if ($val->run()) {
$student->user_id = Input::post('user_id');
$student->year_level = Input::post('year_level');
$student->course_id = Input::post('course_id');
if ($student->save()) {
Session::set_flash('success', e('Updated student #' . $id));
Response::redirect('site/student');
} else {
Session::set_flash('error', e('Could not update student #' . $id));
}
} else {
if (Input::method() == 'POST') {
$student->user_id = $val->validated('user_id');
$student->year_level = $val->validated('year_level');
$student->course_id = $val->validated('course_id');
Session::set_flash('error', $val->error());
}
$this->template->set_global('student', $student, false);
}
$this->template->title = "Students";
$this->template->content = View::forge('site/student/edit');
}
示例3: save
public function save()
{
if (!is_null($this->id)) {
$sql = "UPDATE campaign_choices SET ";
} else {
$sql = "INSERT INTO campaign_choices SET ";
}
if (!is_null($this->choice)) {
$sql .= "choice = \"" . e($this->choice) . "\", ";
}
if (!is_null($this->campaign)) {
$sql .= "campaign_id = \"" . e($this->campaign) . "\", ";
}
$sql .= "parent = \"";
if (!is_null($this->parent)) {
$sql .= e($this->parent);
} else {
$sql .= '0';
}
$sql .= "\", ";
if (!is_null($this->id)) {
$sql .= 'id="' . e($this->id) . '" where id="' . $this->id . '"';
} else {
$sql = trim($sql, ', ');
}
Database::singleton()->query($sql);
if (is_null($this->id)) {
$this->id = Database::singleton()->lastInsertedID();
}
}
示例4: showOption
function showOption($option, $title)
{
?>
<input type="checkbox" name="<?php
echo $option;
?>
" value="1" id="<?php
echo $option;
?>
" <?php
if (get_option('surveys_' . $option)) {
print " checked='checked'";
}
?>
/>
<label for="<?php
echo $option;
?>
"><?php
e($title);
?>
</label><br />
<?php
}
示例5: actualizarMisionVision
public function actualizarMisionVision()
{
$response = 0;
$id_centro = e(Input::get('id_centro'));
$mision_centro = e(Input::get('mision_centro'));
$vision_centro = e(Input::get('vision_centro'));
$quienes_somos_centro = e(Input::get('quienes_somos_centro'));
$centro = Centro::buscar_centro($id_centro);
if (!is_null(Input::file('img_centro'))) {
$file_img_vieja = $centro->img_centro;
$file_img_centro = Input::file('img_centro');
$img_centro = $file_img_centro->getClientOriginalName();
} else {
$img_centro = $centro->img_centro;
}
$response = Centro::actualizar_centro_mision_vision_quienes($id_centro, $mision_centro, $vision_centro, $quienes_somos_centro, $img_centro);
if ($response == 1) {
if (!is_null(Input::file('img_centro'))) {
$file_img_centro->move('img', $file_img_centro->getClientOriginalName());
File::delete('img/' . $file_img_vieja);
}
return Redirect::to(URL::previous())->with('mensaje', 'Centro de Investigacion Actualizado Insertado Correctamente');
} else {
return Redirect::to(URL::previous())->with('mensaje', 'Ha ocurrido un error');
}
}
示例6: save
public function save()
{
if (isset($this->id) && $this->id != "") {
if ($save = $this->sql->prepare("UPDATE wolfvtc_menu SET (name=?, url=?, weight=?) WHERE id=?")) {
// update info
$save->bind_param("ssii", e($this->name), e($this->url), intval($this->weight), intval($this->id));
if ($save->execute) {
return TRUE;
} else {
return FALSE;
}
} else {
return FALSE;
}
} else {
if ($save = $this->sql->prepare("INSERT INTO wolfvtc_menu (name, url, weight) VALUES (?, ?, ?)")) {
// add new link
$save->bind_param("ss", e($this->name), e($this->url), intval($this->weight));
if ($save->execute) {
return TRUE;
} else {
return FALSE;
}
} else {
return FALSE;
}
}
}
示例7: render
function render()
{
$json = json_encode($this->obj);
$html =& Dispatcher::loadHelper('html');
$html->headerNoCache();
e($json);
}
示例8: rules
/**
* @return array
* @throws Exception
*/
public function rules()
{
$what = Input::get('what');
$rules = ['description' => 'required|min:1,max:255', 'what' => 'required|in:withdrawal,deposit,transfer', 'amount' => 'numeric|required|min:0.01', 'date' => 'required|date', 'process_date' => 'date', 'book_date' => 'date', 'interest_date' => 'date', 'category' => 'between:1,255', 'amount_currency_id_amount' => 'required|exists:transaction_currencies,id', 'piggy_bank_id' => 'numeric', 'due_date' => 'date', 'payment_date' => 'date', 'internal_reference' => 'min:1,max:255', 'notes' => 'min:1,max:65536'];
switch ($what) {
case strtolower(TransactionType::WITHDRAWAL):
$rules['source_account_id'] = 'required|exists:accounts,id|belongsToUser:accounts';
$rules['destination_account_name'] = 'between:1,255';
if (intval(Input::get('budget_id')) != 0) {
$rules['budget_id'] = 'exists:budgets,id|belongsToUser:budgets';
}
break;
case strtolower(TransactionType::DEPOSIT):
$rules['source_account_name'] = 'between:1,255';
$rules['destination_account_id'] = 'required|exists:accounts,id|belongsToUser:accounts';
break;
case strtolower(TransactionType::TRANSFER):
$rules['source_account_id'] = 'required|exists:accounts,id|belongsToUser:accounts|different:destination_account_id';
$rules['destination_account_id'] = 'required|exists:accounts,id|belongsToUser:accounts|different:source_account_id';
break;
default:
throw new FireflyException('Cannot handle transaction type of type ' . e($what) . '.');
}
return $rules;
}
示例9: getNote
public function getNote()
{
$Parsedown = new Parsedown();
if ($this->note) {
return $Parsedown->text(e($this->note));
}
}
示例10: link
/**
* Построение ссылки
*
* @param string $url
* @param boolean $absolute_flag
* @param string $protocol
* @return string
*/
public static function link($url = '', $absolute_flag = FALSE, $protocol = 'http')
{
$link = '';
$cogear = getInstance();
if (!$url) {
return $protocol . '://' . SITE_URL . '/';
} else {
if (TRUE === $url) {
return l() . cogear()->router->getUri();
}
}
$url = parse_url($url);
if ($absolute_flag) {
$link .= $protocol . '://';
$link .= SITE_URL;
} elseif (defined('FOLDER')) {
$link .= '/' . FOLDER;
}
isset($url['host']) && ($link = $protocol . '://' . $url['host']);
isset($url['path']) && ($link .= '/' . ltrim($url['path'], '/'));
isset($url['query']) && ($link .= '?' . $url['query']);
isset($url['fragment']) && ($link .= '#' . $url['fragment']);
event('link', $link);
if (cogear()->input->get('splash') === '') {
$link .= e();
}
return $link;
}
示例11: getIcon
/**
* @return string
*/
public function getIcon()
{
if (!isset($this->icon)) {
return;
}
return '<i class="fa fa-' . e($this->icon) . ' menu-icon"></i>';
}
示例12: h
function h($value, $number = 1)
{
if ($number < 0 || $number > 6) {
$number = 1;
}
e($value, 'h' . $number, array('class' => 'heading-' . $number));
}
示例13: check
static function check($res)
{
if ($res->errcode != 0) {
Log . e("FAIL: " . json_encode($res));
exit("Failed: " . json_encode($res));
}
}
示例14: render
/**
* Render the notifications' script tag
*
* @return string
* @internal param bool $flashed Whether to get the
*
*/
public function render()
{
$notifications = $this->session->get('toastr::notifications');
if (!$notifications) {
$notifications = [];
}
$output = '<script type="text/javascript">';
$lastConfig = [];
foreach ($notifications as $notification) {
$config = $this->config->get('toastr.options');
if (count($notification['options']) > 0) {
// Merge user supplied options with default options
$config = array_merge($config, $notification['options']);
}
// Config persists between toasts
if ($config != $lastConfig) {
$output .= 'toastr.options = ' . json_encode($config) . ';';
$lastConfig = $config;
}
// Toastr output
$output .= 'toastr.' . $notification['type'] . "('" . str_replace("'", "\\'", str_replace(['<', '>'], ['<', '>'], e($notification['message']))) . "'" . (isset($notification['title']) ? ", '" . str_replace("'", "\\'", htmlentities($notification['title'])) . "'" : null) . ');';
}
$output .= '</script>';
return $output;
}
示例15: render
public function render($__data)
{
?>
<ul>
<?php
foreach ($this->variable($__data, 'messages.success', [], '', [], 'traversable') as $i => $messagesSuccessItem) {
?>
<li><?php
echo e($this->variable($messagesSuccessItem, 'message', [], '', null, 'string'));
?>
</li>
<?php
}
?>
</ul>
<ul>
<?php
foreach ($this->variable($__data, 'messages.error', [], '', [], 'traversable') as $i => $messagesErrorItem) {
?>
<li><?php
echo e($this->variable($messagesErrorItem, 'message', [], '', null, 'string'));
?>
</li>
<?php
}
?>
</ul><?php
}