本文整理汇总了PHP中Flash类的典型用法代码示例。如果您正苦于以下问题:PHP Flash类的具体用法?PHP Flash怎么用?PHP Flash使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Flash类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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.", [email protected]";
$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: [email protected]' . "\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/');
}
}
开发者ID:gwhitcher,项目名称:gwpress,代码行数:27,代码来源:contact.php
示例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;
}
开发者ID:gwhitcher,项目名称:gwpress,代码行数:28,代码来源:search.php
示例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/');
}
}
开发者ID:gwhitcher,项目名称:gwpress,代码行数:11,代码来源:page.php
示例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/');
}
}
开发者ID:gwhitcher,项目名称:gwpress,代码行数:13,代码来源:navigation.php
示例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/');
}
}
开发者ID:gwhitcher,项目名称:gwpress,代码行数:13,代码来源:post.php
示例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/');
}
}
开发者ID:gwhitcher,项目名称:gwpress,代码行数:13,代码来源:category.php
示例7: getInstance
public static function getInstance()
{
if (!self::$instance) {
self::$instance = new Flash();
}
return self::$instance;
}
开发者ID:priestd09,项目名称:Nibble-stand-alones,代码行数:7,代码来源:Flash.class.php
示例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');
}
开发者ID:uzerpllp,项目名称:uzerp,代码行数:33,代码来源:SltransactionsController.php
示例9: getFlashes
public static function getFlashes()
{
self::$init();
$copy = self::$flashes;
self::$flashes = array();
return $copy;
}
开发者ID:beshad,项目名称:FTTL-MVC,代码行数:7,代码来源:flash.php
示例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();
}
开发者ID:alfrcr,项目名称:ilearn,代码行数:7,代码来源:ClassroomController.php
示例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));
}
开发者ID:sindotnet,项目名称:dashhotel,代码行数:34,代码来源:CkeditorController.php
示例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');
}
开发者ID:svuvis,项目名称:oshusite,代码行数:13,代码来源:BoardMembersController.php
示例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);
}
开发者ID:uzerpllp,项目名称:uzerp,代码行数:33,代码来源:SalesTeamSummaryEGlet.php
示例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();
}
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:30,代码来源:NewsAdmin.php
示例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;
}
开发者ID:xfra35,项目名称:fabulog,代码行数:35,代码来源:validation.php
示例16: detachFrom
public function detachFrom(Request $request)
{
$this->validate($request, ['classroom_id' => 'required', 'assignment_id' => 'required'], ['required' => 'Kolom :attribute diperlukan']);
Assignment::findOrFail($request->assignment_id)->classrooms()->detach($request->classroom_id);
\Flash::success('Tugas berhasil batalkan.');
return redirect()->back();
}
开发者ID:alfrcr,项目名称:ilearn,代码行数:7,代码来源:AssignmentController.php
示例17: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(MembershipApplicationRequest $request)
{
//dd($request->all());
MemApplicant::create($request->all());
Flash::success('Application recieved. Please wait for confirmation');
return redirect('/');
}
开发者ID:kaiservelilia,项目名称:bpmcs,代码行数:13,代码来源:ApplicationsController.php
示例18: route_makeRequest
public function route_makeRequest()
{
$type = pluralize(strip_tags($_GET['type']));
set_time_limit(0);
$fp = fopen("../{$type}/latest.zip", 'w+');
$url = str_replace(" ", "%20", strip_tags($_GET['url']));
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
curl_setopt($ch, CURLOPT_FILE, $fp);
# write curl response to file
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_exec($ch);
curl_close($ch);
fclose($fp);
$zip = new ZipArchive();
if ($zip->open("../{$type}/latest.zip") == true) {
mkdir("../{$type}/latest", 0777);
$zip->extractTo("../{$type}/latest");
$zip->close();
$handle = opendir("../{$type}/latest");
if ($handle) {
while (($file = readdir($handle)) !== false) {
if (is_dir("../{$type}/latest/{$file}")) {
if ($file != '.' and $file != '..') {
rename("../{$type}/latest/{$file}", "../{$type}/{$file}");
}
}
}
}
$this->rrmdir("../{$type}/latest");
unlink("../{$type}/latest.zip");
$this->rrmdir("../{$type}/__MACOSX");
}
Flash::notice(__("Extension downloaded successfully.", "extension_manager"), "/admin/?action=extend_manager");
}
开发者ID:betsyzhang,项目名称:chyrp,代码行数:35,代码来源:extension_manager.php
示例19: add_to_gallery
function add_to_gallery()
{
$gallery_peer = new GalleryPeer();
$gallery = $gallery_peer->find_by_id(Params::get("id_gallery"));
$collection_peer = new GalleryCollectionPeer();
$gallery_collection = $collection_peer->find_by_id($gallery->id_gallery_collection);
$full_folder_path = GalleryCollectionController::GALLERY_COLLECTION_ROOT_DIR . $gallery_collection->folder . "/" . $gallery->folder;
if (Upload::isUploadSuccessful("file")) {
$filename = Random::newHexString() . "_" . Upload::getRealFilename("file");
$gallery_dir = new Dir($full_folder_path);
$uploaded_img = Upload::saveTo("file", $gallery_dir, $filename);
if (isset(Config::instance()->GALLERY_RESIZE_BY_WIDTH)) {
image_w($uploaded_img->getPath(), Config::instance()->GALLERY_RESIZE_BY_WIDTH);
} else {
if (isset(Config::instance()->GALLERY_RESIZE_BY_HEIGHT)) {
image_h($uploaded_img->getPath(), Config::instance()->GALLERY_RESIZE_BY_HEIGHT);
}
}
$peer = new GalleryImagePeer();
$do = $peer->new_do();
$peer->setupByParams($do);
$do->image_name = $filename;
$peer->save($do);
return Redirect::success();
} else {
Flash::error(Upload::getUploadError("file"));
return Redirect::failure();
}
}
开发者ID:mbcraft,项目名称:frozen,代码行数:29,代码来源:GalleryImageController.class.php
示例20: destroy
/**
* Unfollow a user
*
* @param $userIdToUnfollow
* @return Response
*/
public function destroy($userIdToUnfollow)
{
$input = array_add(Input::all(), 'userId', Auth::id());
$this->execute(UnfollowUserCommand::class, $input);
Flash::success("You have now unfollowed this user.");
return Redirect::back();
}
开发者ID:billwaddyjr,项目名称:Larabook-1,代码行数:13,代码来源:FollowsControllers.php
注:本文中的Flash类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论