本文整理汇总了PHP中HTML::forward方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML::forward方法的具体用法?PHP HTML::forward怎么用?PHP HTML::forward使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML
的用法示例。
在下文中一共展示了HTML::forward方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirectToI18nUrl
static function redirectToI18nUrl()
{
$uri = get_request_uri();
$pos = strpos($uri, "/" . get_sub_root() . get_language());
if ($pos === false || $pos !== false && $pos != 0) {
$uri = get_request_uri(false);
$uri = preg_replace('/\\/' . str_replace('/', '\\/', get_sub_root()) . '/', get_language() . '/', $uri, 1);
HTML::forward($uri);
}
}
示例2: isset
<?php
$id = isset($vars[1]) ? $vars[1] : null;
$object = Menu::findById($id);
if (is_null($object)) {
HTML::forward('core/404');
}
// handle form submission
if (isset($_POST['submit'])) {
$error_flag = false;
/// validation
// validation for $name
$name = isset($_POST["name"]) ? strip_tags($_POST["name"]) : null;
if (empty($name)) {
Message::register(new Message(Message::DANGER, i18n(array("en" => "name is required.", "zh" => "请填写name"))));
$error_flag = true;
}
/// proceed submission
// proceed for $name
$object->setName($name);
if ($error_flag == false) {
if ($object->save()) {
Message::register(new Message(Message::SUCCESS, i18n(array("en" => "Record saved", "zh" => "记录保存成功"))));
HTML::forwardBackToReferer();
} else {
Message::register(new Message(Message::DANGER, i18n(array("en" => "Record failed to save", "zh" => "记录保存失败"))));
}
}
}
$html = new HTML();
$html->renderOut('core/backend/html_header', array('title' => i18n(array('en' => 'Edit Menu', 'zh' => 'Edit 菜单'))));
示例3: isset
if (isset($_POST['submit'])) {
$password = isset($_POST['password']) ? trim(strip_tags($_POST['password'])) : null;
$password_confirm = isset($_POST['password_confirm']) ? trim(strip_tags($_POST['password_confirm'])) : null;
// validation
if (is_null($password) || strlen($password) < 6) {
Message::register(new Message(Message::DANGER, i18n(array('en' => 'Password needs to be more than 6 characters. Please try again', 'zh' => '密码至少需要6位。请重试'))));
HTML::forwardBackToReferer();
} else {
if ($password != $password_confirm) {
Message::register(new Message(Message::DANGER, i18n(array('en' => 'Password and confirmed password don\'t match. Please try again', 'zh' => '密码和确认密码不符。 请重试'))));
HTML::forwardBackToReferer();
}
}
// success
$user->putPassword($password);
$user->save();
Message::register(new Message(Message::SUCCESS, i18n(array('en' => 'Your password has been successfully updated. You may sign in below', 'zh' => '您的密码已经成功更新了。您现在可以登录了'))));
HTML::forward('users');
}
// override this call if "site" module has the override controller
$override_controller = MODULESROOT . '/site/controllers/siteuser/forget_password_reset.php';
if (is_file($override_controller)) {
require $override_controller;
exit;
}
// default
$html = new HTML();
$html->renderOut('core/backend/single_form_header', array('title' => i18n(array('en' => 'Reset your password', 'zh' => '重置您的密码'))));
echo SiteUser::renderPasswordResetForm();
$html->renderOut('core/backend/single_form_footer', array('extra' => '<div style="text-align: center;"><small class="signup"><a href="' . uri('users') . '">' . i18n(array('en' => 'go back to login', 'zh' => '返回登录界面')) . '</a></small></div>'));
exit;
示例4: Message
<?php
Log::truncate();
Message::register(new Message(Message::SUCCESS, 'Log emptied'));
HTML::forward('admin/log/list');
示例5: isset
<?php
$uid = isset($vars[1]) ? $vars[1] : null;
$salt = isset($vars[2]) ? $vars[2] : null;
$salt = is_null($salt) ? $salt : decrypt($salt);
// validation
if (is_null($uid) || is_null($salt)) {
HTML::forward('core/404');
}
$user = SiteUser::findById($uid);
if (is_null($user) || $user->getSalt() != $salt) {
Message::register(new Message(Message::INFO, i18n(array('en' => 'This account activate link has expired', 'zh' => '本账号激活链接已失效')) . '<br /><small><a href="' . uri('users') . '">' . i18n(array('en' => 'go to login page', 'zh' => '前往登录页面')) . '</a></small>'));
HTML::forward('core/404');
}
// mail activate the user
$activated = $user->getEmailActivated();
if ($activated == 1) {
Message::register(new Message(Message::INFO, i18n(array('en' => 'You\'ve already activated your acount. No need to do it again.', 'zh' => '您的账号已被激活,无需再次激活')) . '<br /><small><a href="' . uri('users') . '">' . i18n(array('en' => 'login now', 'zh' => '马上登录')) . '</a></small>'));
} else {
$user->setEmailActivated(1);
$user->save();
Message::register(new Message(Message::SUCCESS, i18n(array('en' => 'Congratulation! Your account has been successfully activated.', 'zh' => '恭喜!您的账号已经被成功激活')) . '<br /><small><a href="' . uri('users') . '">' . i18n(array('en' => 'login now', 'zh' => '马上登录')) . '</a></small>'));
}
HTML::forward('confirm');
示例6: array
<?php
// check if already login, if yes, redirect to homepage
if (is_login()) {
HTML::forward('');
}
// handle form submission
if (isset($_POST['submit'])) {
$messages = array();
$email = isset($_POST['email']) ? trim(strip_tags($_POST['email'])) : null;
/** validation **/
if (empty($email)) {
$messages[] = new Message(Message::DANGER, i18n(array('en' => 'Please enter the e-mail address you registered with us', 'zh' => '请填写您注册是使用的电子邮箱')));
} else {
$user = SiteUser::findByEmail($email);
if (is_null($user)) {
$messages[] = new Message(Message::DANGER, i18n(array('en' => 'No record found registered with this e-mail', 'zh' => '未找到使用该邮箱注册的记录')));
}
}
// if succeed, send email
if (sizeof($messages) == 0) {
if ($user = SiteUser::findByEmail($email)) {
$user->sendPasswordResetEmail();
}
Message::register(new Message(Message::SUCCESS, i18n(array('en' => 'We\'ve sent an email to your mail box to reset your password. Please check your mail box.', 'zh' => '我们已向您注册的邮箱发送密码重置链接,请查看您的邮箱并点击链接重置您的密码'))));
} else {
Message::register($messages);
}
HTML::forwardBackToReferer();
}
// override this call if "site" module has the override controller
示例7: unauthorised_action
function unauthorised_action()
{
HTML::forward('users/unauthorised');
}
示例8: Message
Message::register($messages);
HTML::forward($_SERVER['HTTP_REFERER'] . '#contact-form');
}
// check spam
if (module_enabled('form') && !Form::checkSpamToken('global contact form')) {
$message = new Message(Message::DANGER, i18n(array('en' => 'Form login session expired. Please try again', 'zh' => '表单提交时限过期,请重新尝试登录')));
Message::register($message);
HTML::forward($_SERVER['HTTP_REFERER'] . '#contact-form');
}
/** success action **/
Message::register(new Message(Message::SUCCESS, i18n(array('en' => 'Thank you for your contact ;) We will get back to you soon.', 'zh' => '感谢您的留言 ;) 我们会及时和您沟通'))));
if (module_enabled('mail')) {
$message = array();
foreach ($_POST['contact'] as $key => $val) {
$message[] = "<p><strong>{$key}</strong>:<br />" . str_replace("\n", "<br />", $val) . "</p><br />";
}
$message = implode("\n", $message);
sendemailAdmin('Site contact form', $message);
}
HTML::forward($_SERVER['HTTP_REFERER'] . '#contact-form');
}
$html = new HTML();
$html->renderOut('site/components/html_header', array('title' => 'Contact', 'body_class' => 'page page-template page-template-templates page-template-full-width page-template-templatesfull-width-php has-toolbar'));
$html->output('<div id="page-container">');
//$html->renderOut('site/components/toptoolbar');
$html->renderOut('site/components/header');
$html->renderOut('site/contact', array('pagetitle' => $page->getTitle(), 'content' => $page->getContent(), 'googlemap' => $html->render('site/components/googlemap', array('latitude' => '-33.877348', 'longitude' => '151.2079613')), 'full_page_sidebar_right' => $html->render('site/components/full_page_sidebar_right', array('blocks' => array(Block::findByName('Get in Touch'), Block::findByName('Apply Now'))))));
$html->renderOut('site/components/footer');
$html->output('</div>');
$html->renderOut('site/components/page_footer');
$html->renderOut('site/components/html_footer');
示例9: HTML
<?php
/** views **/
$html = new HTML();
$html->forward('admin/dashboard');
示例10: isset
$password = isset($_POST['password']) ? strip_tags($_POST['password']) : null;
$settings = Vars::getSettings();
foreach ($settings['users'] as $u) {
if ($u['email'] == $email && $u['password'] == $password) {
$authentication_success = true;
}
}
// if success
if ($authentication_success) {
$user = User::findByEmail($email);
$user->login();
HTML::forwardBackToReferer();
// if fail
} else {
$message = new Message(Message::DANGER, 'Username or password incorrect. Please try again.');
Message::register($message);
}
// if not form submission, show the login form
}
/** views **/
$html = new HTML();
$html->renderOut('core/backend/html_header', array('title' => 'Please login'), true);
$html->renderOut('core/backend/single_form_header', array('title' => i18n(array('en' => 'Backend login', 'zh' => '登录后台'))));
$html->renderOut('core/backend/login', array(), true);
$html->renderOut('core/backend/single_form_footer');
$html->renderOut('core/backend/html_footer');
exit;
// if already login, go to admin home apge
} else {
HTML::forward('admin');
}
示例11: isset
<?php
$maintenance = Vars::findByName('maintenance');
$maintenance = $maintenance ? $maintenance->getValue() : 0;
// handle form submission
if (isset($_POST['submit'])) {
$switch = isset($_POST['switch']) && $_POST['switch'] == 1 ? 1 : 0;
$var = new Vars();
$var->setName('maintenance');
$var->setValue($switch);
$var->save();
Message::register(new Message(Message::SUCCESS, i18n(array('en' => 'Maintenance mode updated', 'zh' => '系统维护模式已更新'))));
HTML::forward('admin/maintenance');
exit;
}
// presentation
$html = new HTML();
$html->renderOut('core/backend/html_header', array('title' => i18n(array('en' => 'Maintenance mode', 'zh' => '系统维护设置'))), true);
$html->output('<div id="wrapper">');
$html->renderOut('core/backend/header');
$html->renderOut('core/backend/maintenance', array('maintenance' => $maintenance));
$html->output('</div>');
$html->renderOut('core/backend/html_footer');
exit;
示例12: preg_replace
<?php
$lang_to = $vars[1];
$url = preg_replace('/\\/' . get_language() . '/', '/' . $lang_to, $_SERVER['HTTP_REFERER'], 1);
HTML::forward($url);
示例13:
<?php
if (is_login()) {
HTML::forward('articles');
}
?>
Homepage