本文整理汇总了PHP中Flash类的典型用法代码示例。如果您正苦于以下问题:PHP Flash类的具体用法?PHP Flash怎么用?PHP Flash使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Flash类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: contact
public static function contact($email_subject = '', $email_name = '', $email_address = '', $email_message = '')
{
if (isset($_POST['g-recaptcha-response'])) {
$captcha = $_POST['g-recaptcha-response'];
}
$response = json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=" . CAPTCHA_SECRET . "&response=" . $captcha . "&remoteip=" . $_SERVER['REMOTE_ADDR']), true);
if ($response['success'] == false) {
$flash = new Flash();
$flash->flash('flash_message', 'Captcha field not filled out!', 'warning');
header("Location: " . BASE_URL . '/contact/');
} else {
$to = CONTACT_EMAIL;
$from = $email_address;
//$to = "".$email_address.", somebodyelse@example.com";
$message = "<html>\n <head>\n <title>" . $email_subject . "</title>\n </head>\n <body style='background:#000; font-family: 'Arial', sans-serif;'>\n<div style='width: 800px; margin: 0 auto; border: 2px solid #CCC; border-radius: 5px; background: #FFF;'>\n From: " . $email_name . "<br />\n Email: " . $email_address . "<br />\n Message: " . htmlspecialchars($email_message) . "\n </div>\n </body>\n </html>\n ";
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= 'From: ' . $from . '' . "\r\n";
//$headers .= 'Cc: myboss@example.com' . "\r\n";
mail($to, $email_subject, $message, $headers);
$flash = new Flash();
$flash->flash('flash_message', 'Form submitted! Someone will get back to you shortly.');
header("Location: " . BASE_URL . '/contact/');
}
}
示例2: search_query
public static function search_query($keyword = '', $category = '')
{
if (isset($_GET)) {
$keyword_clean = mysqli_real_escape_string(db_connect(), $keyword);
$category_clean = mysqli_real_escape_string(db_connect(), $category);
if ($category_clean === 'post') {
$search_results = db_select("SELECT * FROM post WHERE title LIKE '%" . $keyword_clean . "%' OR body LIKE '%" . $keyword_clean . "%'");
} elseif ($category_clean === 'category') {
$search_results = db_select("SELECT * FROM category WHERE title LIKE '%" . $keyword_clean . "%' OR description LIKE '%" . $keyword_clean . "%'");
} elseif ($category_clean === 'page') {
$search_results = db_select("SELECT * FROM page WHERE title LIKE '%" . $keyword_clean . "%' OR body LIKE '%" . $keyword_clean . "%'");
} elseif ($category_clean === 'upload') {
$search_results = db_select("SELECT * FROM upload WHERE filename LIKE '%" . $keyword_clean . "%' OR filetype LIKE '%" . $keyword_clean . "%' OR filepath LIKE '%" . $keyword_clean . "%'");
} elseif ($category_clean === 'user') {
$search_results = db_select("SELECT * FROM user WHERE username LIKE '%" . $keyword_clean . "%'");
} else {
// ALL
$search = new Search();
$search_results = $search->searchAllDB($keyword_clean);
//print_r($search_results);
}
} else {
$search_results = '';
$flash = new Flash();
$flash->flash('flash_message', 'No keyword entered!', 'danger');
}
return $search_results;
}
示例3: page_delete
public static function page_delete($id)
{
if (empty($id)) {
header("Location: " . BASE_URL . '/admin/pages');
} else {
db_query("DELETE FROM page WHERE id = " . $id);
$flash = new Flash();
$flash->flash('flash_message', 'Page deleted!');
header("Location: " . BASE_URL . '/admin/pages/');
}
}
示例4: navigation_delete
public static function navigation_delete($id)
{
if (empty($id)) {
$flash = new Flash();
$flash->flash('flash_message', 'Navigation item does not exist!', 'warning');
header("Location: " . BASE_URL . '/admin/navigation/');
} else {
db_query("DELETE FROM navigation WHERE id = " . $id);
$flash = new Flash();
$flash->flash('flash_message', 'Navigation item deleted!');
header("Location: " . BASE_URL . '/admin/navigation/');
}
}
示例5: post_delete
public static function post_delete($id)
{
if (empty($id)) {
$flash = new Flash();
$flash->flash('flash_message', 'Post does not exist!', 'warning');
header("Location: " . BASE_URL . '/admin/posts/');
} else {
db_query("DELETE FROM post WHERE id = " . $id);
$flash = new Flash();
$flash->flash('flash_message', 'Post deleted!');
header("Location: " . BASE_URL . '/admin/posts/');
}
}
示例6: category_delete
public static function category_delete($id)
{
if (empty($id)) {
$flash = new Flash();
$flash->flash('flash_message', 'Category does not exist!', 'warning');
header("Location: " . BASE_URL . '/admin/categories/');
} else {
db_query("DELETE FROM category WHERE id = " . $id);
$flash = new Flash();
$flash->flash('flash_message', 'Category deleted!');
header("Location: " . BASE_URL . '/admin/categories/');
}
}
示例7: getInstance
public static function getInstance()
{
if (!self::$instance) {
self::$instance = new Flash();
}
return self::$instance;
}
示例8: view_allocations
public function view_allocations()
{
$flash = Flash::Instance();
$collection = new SLTransactionCollection($this->_templateobject);
$this->_templateobject->setAdditional('payment_value', 'numeric');
$allocation = DataObjectFactory::Factory('SLAllocation');
$allocationcollection = new SLAllocationCollection($allocation);
$collection->_tablename = $allocationcollection->_tablename;
$sh = $this->setSearchHandler($collection);
$fields = array("our_reference||'-'||transaction_type as id", 'customer', 'slmaster_id', 'transaction_date', 'transaction_type', 'our_reference', 'ext_reference', 'currency', 'gross_value', 'allocation_date');
$sh->setGroupBy($fields);
$fields[] = 'sum(payment_value) as payment_value';
$sh->setFields($fields);
if (isset($this->_data['trans_id'])) {
$allocation->identifierField = 'allocation_id';
$cc = new ConstraintChain();
$cc->add(new Constraint('transaction_id', '=', $this->_data['trans_id']));
$alloc_ids = $allocation->getAll($cc);
if (count($alloc_ids) > 0) {
$sh->addConstraint(new Constraint('allocation_id', 'in', '(' . implode(',', $alloc_ids) . ')'));
} else {
$flash->addError('Error loading allocation');
sendBack();
}
}
parent::index($collection, $sh);
$this->view->set('collection', $collection);
$this->view->set('invoice_module', 'sales_invoicing');
$this->view->set('invoice_controller', 'sinvoices');
$this->view->set('clickaction', 'view');
$this->view->set('clickcontroller', 'slcustomers');
$this->view->set('linkvaluefield', 'slmaster_id');
}
示例9: getFlashes
public static function getFlashes()
{
self::$init();
$copy = self::$flashes;
self::$flashes = array();
return $copy;
}
示例10: removeMember
public function removeMember(Request $request)
{
$classroom = Classroom::findOrFail($request->classroom_id);
$classroom->students()->detach($request->user_id);
\Flash::success('User berhasil dihapus dari kelas.');
return redirect()->back();
}
示例11: settings
public function settings()
{
$errors = false;
if (get_request_method() == 'POST') {
$data = $_POST['settings'];
$settings = array();
$settings['filemanager_base'] = preg_replace('/\\s+/', '', $data['filemanager_base']);
$settings['filemanager_base'] = trim($settings['filemanager_base'], '/');
$settings['filemanager_view'] = isset($data['filemanager_view']) ? $data['filemanager_view'] : 'grid';
// image extensions
if (isset($data['filemanager_images'])) {
$settings['filemanager_images'] = serialize($data['filemanager_images']);
} else {
$errors[] = __("You need to select at least one image extension!");
}
$settings['filemanager_upload_size'] = !empty($data['filemanager_upload_size']) && is_numeric($data['filemanager_upload_size']) ? $data['filemanager_upload_size'] : '0';
$settings['filemanager_dateformat'] = !empty($data['filemanager_dateformat']) ? trim($data['filemanager_dateformat']) : 'd M Y H:i';
$booleans = array('filemanager_enabled', 'filemanager_browse_only', 'filemanager_upload_overwrite', 'filemanager_upload_images_only');
foreach ($booleans as $bool) {
$settings[$bool] = isset($data[$bool]) && $data[$bool] == 1 ? '1' : '0';
}
if (Plugin::setAllSettings($settings, 'ckeditor')) {
Flash::setNow('success', 'Settings were updated successfully');
} else {
$errors[] = __("There was a problem saving the settings.");
}
} else {
$settings = Plugin::getAllSettings('ckeditor');
}
if ($errors !== false) {
Flash::setNow('error', implode('<br/>', $errors));
}
$this->display('settings', array('settings' => $settings));
}
示例12: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$member = BoardMember::findOrFail($id);
$member->delete();
\Flash::success('Bestuurslid verwijderd');
return redirect('admin/board_members');
}
示例13: populate
function populate()
{
if (!isModuleAdmin()) {
$flash = Flash::Instance();
$flash->addError('You don\'t have permission to view the Sales Team summary EGlets');
$this->should_render = false;
return false;
}
$db =& DB::Instance();
$query = 'SELECT s.id,s.name FROM opportunitystatus s WHERE usercompanyid=' . $db->qstr(EGS_COMPANY_ID) . ' ORDER BY position DESC';
$statuses = $db->GetAssoc($query);
$query = 'SELECT DISTINCT assigned FROM opportunities o WHERE o.usercompanyid=' . EGS_COMPANY_ID . ' AND extract(\'' . $this->timeframe . '\' FROM o.enddate)=extract(\'' . $this->timeframe . '\' FROM now())';
$users = $db->GetCol($query);
$options = array();
foreach ($users as $username) {
if (empty($username)) {
continue;
}
$data = array();
foreach ($statuses as $id => $status) {
$query = 'SELECT COALESCE(sum(cost),0) FROM opportunities o WHERE o.assigned=' . $db->qstr($username) . ' AND o.status_id=' . $db->qstr($id) . ' AND o.usercompanyid=' . EGS_COMPANY_ID . ' AND extract(\'' . $this->timeframe . '\' FROM o.enddate)=extract(\'' . $this->timeframe . '\' FROM now())';
$data['x'][] = $status;
$data['y'][] = (double) $db->GetOne($query);
}
$options['seriesList'][] = array('label' => $username, 'legendEntry' => TRUE, 'data' => $data);
}
if (!isset($options['seriesList']) || empty($options['seriesList'])) {
return false;
}
$options['type'] = 'bar';
$options['identifier'] = __CLASS__ . $this->timeframe;
$this->contents = json_encode($options);
}
示例14: run
/**
* In this function, most actions of the module are carried out and the page generation is started, distibuted and rendered.
* @return void
* @see solidbase/lib/Page#run()
*/
function run()
{
global $Templates, $USER, $CONFIG, $Controller, $DB;
if (!$this->may($USER, READ | EDIT)) {
errorPage('401');
return false;
}
/**
* User input types
*/
$_REQUEST->setType('order', 'numeric', true);
$_REQUEST->setType('expand', 'bool');
$_REQUEST->setType('del', 'numeric');
if ($_REQUEST['del']) {
if ($Controller->{$_REQUEST['del']} && $Controller->{$_REQUEST['del']}->delete()) {
Flash::create(__('Newsitem removed'), 'confirmation');
}
}
/**
* Here, the page request and permissions decide what should be shown to the user
*/
$this->setContent('header', __('News'));
$this->setContent('main', $this->mainView());
$Templates->admin->render();
}
示例15: email
/**
* validate email address
* @param string $val
* @param string $context
* @param bool $mx
* @return bool
*/
function email($val, $context = null, $mx = true)
{
$valid = true;
if (!$context) {
$context = 'error.validation.email';
}
if (!empty($val)) {
if (!\Audit::instance()->email($val, false)) {
$val = NULL;
if (!$this->f3->exists($context . '.invalid', $errText)) {
$errText = 'e-mail is not valid';
}
$this->f3->error(400, $errText);
$valid = false;
} elseif ($mx && !\Audit::instance()->email($val, true)) {
$val = NULL;
if (!$this->f3->exists($context . '.host', $errText)) {
$errText = 'unknown mail mx.host';
}
$this->f3->error(400, $errText);
$valid = false;
}
}
if (!$valid) {
\Flash::instance()->setKey($context, 'has-error');
}
return $valid;
}