本文整理汇总了PHP中URL::site方法的典型用法代码示例。如果您正苦于以下问题:PHP URL::site方法的具体用法?PHP URL::site怎么用?PHP URL::site使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URL
的用法示例。
在下文中一共展示了URL::site方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: html
public function html()
{
$this->_view->set_var('tag', 'form');
!$this->_view->attr('action') and URL::site(Request::current()->detect_uri());
!$this->_view->attr('method') and $this->_view->attr('method', 'post');
!$this->_view->attr('action') and $this->_view->attr('action', '');
}
示例2: before
public function before()
{
parent::before();
$this->assign('seoinfo', Common::getChannelSeo(3));
$this->assign('cmsurl', URL::site());
$this->assign('website', Common::getWebUrl());
}
示例3: action_login
public function action_login()
{
// Проверям, вдруг пользователь уже зашел
if (Auth::instance()->logged_in()) {
// И если это так, то отправляем его сразу на страницу администратора
return $this->request->redirect('member');
}
// Если же пользователь не зашел, но данные на страницу пришли, то:
if ($_POST) {
// Создаем переменную, отвечающую за связь с моделью данных User
$user = ORM::factory('user');
// в $status помещаем результат функции login
$status = Auth::instance()->login($_POST['username'], $_POST['password']);
// Если логин успешен, то
if ($status) {
// Отправляем пользователя на его страницу
$this->request->redirect('member');
} else {
// Иначе ничего не получилось, пишем failed
$this->template->messages['err_msg'] = 'Ошибка входа!';
}
}
// Грузим view логина
$this->template->content = View::factory(URL::site('login'));
}
示例4: pay
public function pay($data, $clientEmail)
{
if (is_array($data)) {
$this->_setDataFromArray($data);
} else {
if (is_object($data)) {
$this->_setDataFromObject($data);
}
}
$this->_dataRequired['id'] = $this->_dotpayID;
$this->_dataOptional['email'] = $clientEmail;
if (empty($this->_dataOptional['URL'])) {
$this->_dataOptional['URL'] = URL::site($this->returnAction(), TRUE);
}
foreach ($this->_dataRequired as $field) {
if (empty($field)) {
return FALSE;
}
}
$fields = array_merge($this->_dataRequired, $this->_dataOptional);
$hidden = array();
foreach ($fields as $key => $value) {
if (!empty($value)) {
$hidden[$key] = $value;
}
}
$view = View::factory('dotpay/pay')->set('amount', $this->_amountFormat($this->_dataRequired['amount']))->set('description', $this->_dataRequired['description'])->set('control', $this->_dataRequired['control'])->set('paymentURL', self::PAYMENT_URL)->bind('hidden', $hidden);
if ($this->_config->selectChannel) {
$view->set('paymentChannels', $this->_config->channels);
}
return $view;
}
示例5: action_list
/**
* Get list of pages
*
* @uses Config::load
* @uses Config_Group::get
* @uses URL::site
* @uses Cache::set
*/
public function action_list()
{
if (empty($this->_items)) {
$config = Config::load('page');
// Cache is Empty so Re-Cache
$pages = ORM::factory('page')->where('status', '=', 'publish')->order_by('pubdate', 'DESC')->limit($this->_limit)->offset($this->_offset)->find_all();
$items = array();
foreach ($pages as $page) {
$item = array();
$item['guid'] = $page->id;
$item['title'] = $page->title;
$item['link'] = URL::site($page->url, TRUE);
if ($config->get('use_submitted', FALSE)) {
$item['author'] = $page->user->nick;
}
$item['description'] = $page->teaser;
$item['pubDate'] = $page->pubdate;
$items[] = $item;
}
$this->_cache->set($this->_cache_key, $items, $this->_ttl);
$this->_items = $items;
}
if (isset($this->_items[0])) {
$this->_info['title'] = __('Pages - Recent updates');
$this->_info['link'] = Route::url('rss', array('controller' => 'page'), TRUE);
$this->_info['pubDate'] = $this->_items[0]['pubDate'];
}
}
示例6: action_save
/**
* 添加保存
*/
public function action_save()
{
$this->_autoRender = FALSE;
$name = Arr::get($_POST, 'name', '');
$describe = Arr::get($_POST, 'describe', '');
if (!$name) {
return Prompt::jsonWarning('名称不能为空');
}
if (!$describe) {
return Prompt::jsonWarning('描述不能为空');
}
$values = array('name' => $name, 'describe' => $describe, 'account_id' => 0);
try {
$result = Model::factory('Project')->create($values)->getArray();
if (!$result) {
//TODO 日志
return Prompt::jsonError('添加项目失败');
}
} catch (Exception $e) {
//TODO 日志
return Prompt::jsonError('添加项目失败');
}
//TODO 日志
return Prompt::jsonSuccess('添加项目成功', URL::site('project/add'));
}
示例7: action_login
/**
* Action login
*/
public function action_login()
{
$post = $this->request->post();
$username = Arr::get($post, 'username');
$password = Arr::get($post, 'password');
$remember = Arr::get($post, 'remember') ?: 0;
// If there is post login
if ($this->request->post('login')) {
// ログインチェック
if (Auth::instance()->login($username, $password, $remember)) {
// ロールチェック
if (Auth::instance()->logged_in('direct') or Auth::instance()->logged_in('admin') or Auth::instance()->logged_in('edit')) {
// Add success notice
Notice::add(Notice::SUCCESS, Kohana::message('auth', 'login_success'), array(':user' => $username));
// Redirect to home
$this->redirect(URL::site($this->settings->backend_name, 'http'));
} else {
// Add error notice
Notice::add(Notice::ERROR, Kohana::message('auth', 'login_refusal'), NULL, Kohana::message('auth', 'login_refusal_messages'));
}
} else {
// Add error notice
Notice::add(Notice::ERROR, Kohana::message('auth', 'login_failed'), NULL, Kohana::message('auth', 'login_failed_messages'));
}
}
/**
* View
*/
// Get content
$content_file = Tpl::get_file('login', $this->settings->back_tpl_dir . '/auth');
$this->content = Tpl::factory($content_file)->set('post', $post);
}
示例8: walkTree
function walkTree($nodes, $level = 0)
{
static $i = 1;
foreach ($nodes as $key => $value) {
if ($value['start'] == 1) {
echo '<tr>
<td>' . $i . '</td>
<td>' . $value['display_name'] . '</td>
<td>' . $value['dir'] . '</td>
<td>' . $value['date_create'] . '</td>
<td>
<a href="' . URL::site(Request::current()->param('language') . '/admin/folders/edit/' . $value['id']) . '">Edit</a>
|
<a href="' . URL::site(Request::current()->param('language') . '/admin/folders/delete/' . $value['id']) . '">Delete</a>
</td>
</tr>' . "\n";
} else {
echo '<tr>
<td>' . $i . '</td>
<td>' . str_repeat('---', $level) . $value['display_name'] . '</td>
<td>' . $value['dir'] . '</td>
<td>' . $value['date_create'] . '</td>
<td>
<a href="' . URL::site(Request::current()->param('language') . '/admin/folders/edit/' . $value['id']) . '">Edit</a>
|
<a href="' . URL::site(Request::current()->param('language') . '/admin/folders/delete/' . $value['id']) . '">Delete</a>
</td>
</tr>' . "\n";
}
$i++;
if ($value['children']) {
walkTree($value['children'], $level + 1);
}
}
}
示例9: action_permissions
public function action_permissions()
{
$view = View::factory('role/permissions')->bind('acl', $acl)->set('action', URL::site('role/permissions'))->bind('role_id', $role_id)->bind('is_current_role', $is_current_role)->bind('role_name', $role_name)->set('cancel', URL::site('role'));
$post = array();
if ($this->request->method() === 'POST' && $this->request->post()) {
$post = $this->request->post();
$role_id = $post['role_id'];
$role = ORM::factory('role', $role_id);
$role->permissions = serialize($post['acl']);
$role->save();
Session::instance()->set('success', 'User permissions saved successfully.');
Request::current()->redirect('role/index');
}
$role_id = $this->request->param('params');
$role = ORM::factory('role', $role_id);
$role_name = $role->name;
$permissions = $role->permissions && $role->permissions !== NULL ? unserialize($role->permissions) : array();
$acl_array = Acl::acl_array($permissions);
${$acl} = array();
foreach ($acl_array as $resource => $levels) {
$acl[$resource] = array();
$text_resource = Kohana::message('acl', $resource);
foreach ($levels as $level => $permission) {
$acl[$resource][$level] = array('resource' => $text_resource, 'level' => Inflector::humanize($level), 'permission' => $permission, 'repr_key' => Acl::repr_key($resource, $level));
}
}
// check whether the role being edited is the role of the current user
// if yes, show a warning before user tries to deny all permissions
$user_role_id = Auth::instance()->get_user()->roles->find()->id;
$is_current_role = $role_id == $user_role_id;
Breadcrumbs::add(array('Role', Url::site('role')));
Breadcrumbs::add(array('Set Permission', Url::site('role/permissions/' . $role_id)));
$this->content = $view;
}
示例10: backend
/**
* Returns a string with a backend url string based on arguments
*
* @param string $controller
* @param string $action
* @param mixed $id
* @return string
*/
public static function backend($controller = null, $action = null, $id = null)
{
if (!is_array($controller)) {
$controller = array('controller' => $controller, 'action' => $action, 'id' => $id);
}
return URL::site(Route::get('backend')->uri($controller));
}
示例11: getUrl
public function getUrl($id, $typeid)
{
$cmsUrl = URL::site();
$url = '';
switch ($typeid) {
case 1:
$url = $cmsUrl . 'lines/show/id/' . $id;
break;
case 2:
$url = $cmsUrl . 'hotels/show/id/' . $id;
break;
case 3:
$url = $cmsUrl . 'cars/show/id/' . $id;
break;
case 4:
$url = $cmsUrl . 'raider/show/id/' . $id;
break;
case 5:
$url = $cmsUrl . 'spot/show/id/' . $id;
break;
case 6:
$url = $cmsUrl . 'photo/show/id/' . $id;
break;
case 8:
$url = $cmsUrl . 'visa/show/id/' . $id;
break;
case 13:
$url = $cmsUrl . 'tuan/show/id/' . $id;
break;
}
return $url;
}
示例12: redirect_url
/**
* Get the URL to redirect to.
* @return string
*/
public function redirect_url($return_url)
{
$this->provider->identity = Provider_OpenID::$config[$this->provider_name]['url'];
$this->provider->returnUrl = URL::site($return_url, true);
$this->provider->required = array('namePerson', 'namePerson/first', 'namePerson/last', 'contact/email');
return $this->provider->authUrl();
}
示例13: before
public function before()
{
$this->ttl = 3600;
$template = $this->template;
$this->template = NULL;
parent::before();
if ($this->auto_render === TRUE) {
$this->template = View_Theme::factory($template);
}
$this->config = Kohana::$config->load($this->config)->as_array();
$this->assets = '/assets/' . $this->config['theme'] . '/';
$this->template->page = URL::site(rawurldecode(Request::$initial->uri()));
$this->template->code = $this->request->action();
$this->template->message = '';
// Internal request only!
if (Request::$initial !== Request::$current) {
// Скрываем, т.к. выводится лишняя информация
// if ($message = rawurldecode( $this->request->param('message') ))
// {
// $this->template->message = $message;
// }
} else {
$this->request->action(404);
}
if ($this->request->initial()->is_ajax() === TRUE) {
$this->response->status((int) $this->request->action());
$this->response->body(isset($message) ? $message : 'Page not found');
}
}
示例14: open
/**
* Generates an opening HTML form tag.
*
* // Form will submit back to the current page using POST
* echo Form::open();
*
* // Form will submit to 'search' using GET
* echo Form::open('search', array('method' => 'get'));
*
* // When "file" inputs are present, you must include the "enctype"
* echo Form::open(NULL, array('enctype' => 'multipart/form-data'));
*
* @param mixed form action, defaults to the current request URI, or [Request] class to use
* @param array html attributes
* @return string
* @uses Request::instance
* @uses URL::site
* @uses HTML::attributes
*/
public static function open($action = NULL, array $attributes = NULL)
{
if ($action instanceof Request) {
// Use the current URI
$action = $action->uri();
}
if (!$action) {
// Allow empty form actions (submits back to the current url).
$action = '';
} elseif (strpos($action, '://') === FALSE) {
// Make the URI absolute
$action = URL::site($action);
}
// Add the form action to the attributes
$attributes['action'] = $action;
// Only accept the default character set
$attributes['accept-charset'] = Kohana::$charset;
if (!isset($attributes['method'])) {
// Use POST method
$attributes['method'] = 'post';
}
// Only render the CSRF field when the POST method is used
$hidden_csrf_field = $attributes['method'] == 'post' ? self::hidden('form_auth_id', CSRF::token()) : '';
return '<form' . HTML::attributes($attributes) . '>' . $hidden_csrf_field;
}
示例15: on_page_load
public function on_page_load()
{
$email_ctx_id = $this->get('email_id_ctx', 'email');
$email = $this->_ctx->get($email_ctx_id);
$referrer_page = Request::current()->referrer();
$next_page = $this->get('next_url', Request::current()->referrer());
if (!Valid::email($email)) {
Messages::errors(__('Use a valid e-mail address.'));
HTTP::redirect($referrer_page);
}
$user = ORM::factory('user', array('email' => $email));
if (!$user->loaded()) {
Messages::errors(__('No user found!'));
HTTP::redirect($referrer_page);
}
$reflink = ORM::factory('user_reflink')->generate($user, 'forgot', array('next_url' => URL::site($this->next_url, TRUE)));
if (!$reflink) {
Messages::errors(__('Reflink generate error'));
HTTP::redirect($referrer_page);
}
Observer::notify('admin_login_forgot_before', $user);
try {
Email_Type::get('user_request_password')->send(array('username' => $user->username, 'email' => $user->email, 'reflink' => Route::url('reflink', array('code' => $reflink)), 'code' => $reflink));
Messages::success(__('Email with reflink send to address set in your profile'));
} catch (Exception $e) {
Messages::error(__('Something went wrong'));
}
HTTP::redirect($next_page);
}