本文整理汇总了PHP中Uri::base方法的典型用法代码示例。如果您正苦于以下问题:PHP Uri::base方法的具体用法?PHP Uri::base怎么用?PHP Uri::base使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Uri
的用法示例。
在下文中一共展示了Uri::base方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendReservedEMail
public static function sendReservedEMail($id)
{
$reservation = Model_Lessontime::find($id);
// for teacher
$url = Uri::base() . "teachers/top";
date_default_timezone_set(Config::get("timezone.timezone")[$reservation->teacher->timezone]);
$body = View::forge("email/teachers/reserved", ["url" => $url]);
$body->set("name", $reservation->teacher->firstname);
$body->set("reservation", $reservation);
$sendmail = Email::forge("JIS");
$sendmail->from(Config::get("statics.info_email"), Config::get("statics.info_name"));
$sendmail->to($reservation->teacher->email);
$sendmail->subject("Lesson Booking Confirmation / Game-bootcamp");
$sendmail->html_body(htmlspecialchars_decode($body));
$sendmail->send();
// for student
$url = Uri::base() . "students/top";
date_default_timezone_set(Config::get("timezone.timezone")[$reservation->student->timezone]);
$body = View::forge("email/students/reserved", ["url" => $url]);
$body->set("name", $reservation->student->firstname);
$body->set("reservation", $reservation);
$sendmail = Email::forge("JIS");
$sendmail->from(Config::get("statics.info_email"), Config::get("statics.info_name"));
$sendmail->to($reservation->student->email);
$sendmail->subject("Lesson Booking Confirmation / Game-bootcamp");
$sendmail->html_body(htmlspecialchars_decode($body));
$sendmail->send();
}
示例2: render_menu
protected static function render_menu($menus)
{
$selected = \Uri::segment(1);
$out = '';
foreach ($menus as $k => $v) {
is_int($k) and $k = $v;
if (substr_compare($k, 'divider', 0, 7) == 0) {
$out .= static::$template['menu_divider'];
continue;
}
isset($v['label']) or $v['label'] = \Lang::get($k);
isset($v['link']) or $v['link'] = '#';
isset($v['level']) or $v['level'] = 0;
$user = \Session::get('user_info');
if ($user['level'] < $v['level']) {
continue;
}
if (isset($v['submenu']) and count($v['submenu']) > 0) {
$active = array_key_exists($selected, $v['submenu']) ? ' active' : '';
$out .= str_replace(array('{item_id}', '{active}', '{label}', '{submenu}'), array($k, $active, $v['label'], static::render_menu($v['submenu'])), static::$template['menu_dropdown']);
} else {
$active = $selected == $k ? ' class="active"' : '';
$out .= str_replace(array('{item_id}', '{active}', '{link}', '{label}'), array($k, $active, \Uri::base() . $v['link'], $v['label']), static::$template['menu_item']);
}
}
return $out;
}
示例3: getAdminAvatar
/**
* get admin's avatar picture.
*
* @param integer $account_id
* @return string return element ready for display avatar.
*/
function getAdminAvatar($account_id)
{
// set default avatar
$theme = \Theme::instance();
$doc_root = str_replace('\\', '/', DOCROOT);
$default_avatar_getfile = $theme->asset->get_file('default-avatar.jpg', 'img');
$default_no_avatar = str_replace([$doc_root, \Uri::base()], '', $default_avatar_getfile);
unset($doc_root, $default_avatar_getfile, $theme);
if (!is_numeric($account_id) || intval($account_id) === intval(0)) {
return $default_no_avatar;
}
$cache_name = 'public.themes.sys2.getAdminAvatar-' . \Model_Sites::getSiteId(false) . '-' . $account_id;
$cache_data = \Extension\Cache::getSilence($cache_name);
if (false === $cache_data) {
// if never cached or cache expired.
$result = \DB::select()->as_object()->from('accounts')->where('account_id', $account_id)->execute();
if (count($result) > 0) {
$row = $result->current();
if ($row->account_avatar != null) {
$return_val = $row->account_avatar;
\Cache::set($cache_name, $return_val, 86400);
unset($cache_name);
return $return_val;
}
}
if (!isset($return_val) || isset($return_val) && $return_val == null) {
// not found account or not found avatar.
\Cache::set($cache_name, $default_no_avatar, 86400);
unset($cache_name);
return $default_no_avatar;
}
}
unset($cache_name);
return $cache_data;
}
示例4: before
public function before()
{
parent::before();
$auth = \Auth::instance('SimpleAuth');
if (\Input::get('logout')) {
$auth->logout();
\Response::redirect(\Uri::base(false) . 'admin/login');
}
$uri = explode('/', \Uri::string());
if ($auth->check()) {
if (count($uri) < 3 && (empty($uri[1]) || $uri[1] == 'login')) {
\Response::redirect(\Uri::base(false) . 'admin/list');
}
// Load admin Config for List View and default to first tab
$this->data['tabs'] = $this->template->tabs = \Config::get('admin.tabs');
$this->data['table'] = $this->param('item', '');
// get item from URI
if (!$this->data['table']) {
list($this->data['table']) = array_slice(array_keys($this->data['tabs']), 0, 1);
}
$this->template->table = $this->data['table'];
} elseif (count($uri) > 1 && $uri[1] != 'login') {
\Response::redirect(\Uri::base(false) . 'admin/login');
}
if ($this->auto_render === true) {
// set up defaults
$this->template->body = '';
}
return true;
}
示例5: sidebar
public function sidebar($options = array())
{
$identifier = array('nav' => array('id' => 'sidebar', 'class' => 'sidebar nav-collapse collapse'), 'ul' => array('id' => 'side-nav', 'class' => 'side-nav'), 'li' => array('id' => '', 'class' => '', 'role' => ''));
if (isset($options['nav'])) {
$identifier['nav'] = $options['nav'];
}
if (isset($options['ul'])) {
$identifier['ul'] = $options['ul'];
}
if (isset($options['li'])) {
$identifier['li'] = $options['li'];
}
$ul = ' <nav id="' . $identifier['nav']['id'] . '" class="' . $identifier['nav']['class'] . '">
<ul id="' . $identifier['ul']['id'] . '" class="' . $identifier['ul']['class'] . '">';
foreach ($options['data'] as $k => $v) {
if (isset($v['filter'])) {
if ($v['filter'] == '*') {
$ul .= '<li><a href="' . Uri::base() . $v['link'] . '">' . $v['name'] . '</a></li>';
} elseif (in_array(\Auth\Auth::instance()->get('group')->id, $v['filter'])) {
$ul .= '<li><a href="' . Uri::base() . $v['link'] . '">' . $v['name'] . '</a></li>';
}
}
}
$ul .= '</ul></nav>';
return $ul;
}
示例6: pagination
private function pagination($model, $options)
{
$config = array('pagination_url' => Uri::base() . $options['controller'] . '/' . $options['page'], 'total_items' => count($model), 'per_page' => isset($options['per_page']) ? $options['per_page'] : '', 'uri_segment' => 'page', 'wrapper' => '<div class="clearfix"><div class="pagination no-margin">{pagination}</div></div>', 'first' => '<li class="first">{link}</li>', 'fist-marker' => 'First', 'first-link' => '<a href="{uri}">{page}</a>', 'previous' => '<li class="previous">{link}</li>', 'previous-marker' => 'Previous', 'previous-link' => '<a href="{uri}">{page}</a>', 'previous-inactive' => '<li class="previous-inactive">{link}</li>', 'previous-inactive-link' => '<a href="{uri}" rel="prev">{page}</a>', 'regular' => '<li>{link}</li>', 'regular-link' => '<a href="{uri}">{page}</a>', 'active' => '<li class="active">{link}</li>', 'active-link' => '<a href="{uri}">{page}</a>', 'next' => '<li class="next">{link}</li>', 'next-marker' => 'Next', 'next-link' => '<a href="{uri}" rel="next">{page}</a>', 'next-inactive' => '<li class="next-inactive">{link}</li>', 'next-inactive-link' => '<a href="{uri}" rel="next">{page}</a>', 'last' => '<li class="last">{link}</li>', 'last-marker' => 'Last', 'last-link' => '<a href="{uri}">{page}</a>');
$pagination = Pagination::forge('table', $config);
$data = $options['model']::query()->rows_offset($pagination->per_page)->rows_limit($pagination->offset)->get();
return $pagination->render();
}
示例7: action_index
public function action_index()
{
$this->template = View::forge("teachers/template");
$this->template->auth_status = false;
$this->template->title = "Forgotpassword";
// login
if (Input::post("email", null) !== null and Security::check_token()) {
$email = Input::post('email', null);
$user = Model_User::find("first", ["where" => [["email", $email]]]);
if ($user != null) {
$token = Model_Forgotpasswordtoken::forge();
$token->user_id = $user->id;
$token->token = sha1("asadsada23424{$user->email}" . time());
$token->save();
$url = Uri::base() . "teachers/forgotpassword/form/{$token->token}";
$body = View::forge("email/forgotpassword", ["url" => $url]);
$sendmail = Email::forge("JIS");
$sendmail->from(Config::get("statics.info_email"), Config::get("statics.info_name"));
$sendmail->to($email);
$sendmail->subject("forgot password");
$sendmail->html_body(htmlspecialchars_decode($body));
$sendmail->send();
}
$view = View::forge("teachers/forgotpassword/sent");
$this->template->content = $view;
} else {
$view = View::forge("teachers/forgotpassword/index");
$this->template->content = $view;
}
}
示例8: action_index
/**
* @author NamNT
* action index
*/
public function action_index()
{
$model = new \Model_Person();
$filter = array();
$data = array();
if (Input::get()) {
$filter = Input::get();
$query_string = http_build_query($filter);
\Session::set('url_filter_persons', $query_string);
$person_url = $query_string ? '?' . $query_string : '';
} else {
$person_url = '';
}
if (Input::get('export', false)) {
$filter['per_page'] = 100000;
$download_his = new \Model_Downloadhis();
$download = array('param' => json_encode($filter), 'content' => json_encode(Input::server()));
$download_his->set_data($download);
if ($download_his->save_data()) {
$this->export($model->get_filter_person($filter));
}
}
$config = ['pagination_url' => \Uri::base() . 'job/persons/index' . $person_url, 'total_items' => $model->count_data($filter), 'per_page' => \Constants::$default_limit_pagination, 'uri_segment' => 'page', 'num_links' => \Constants::$default_num_links, 'show_last' => true];
\Fuel\Core\Cookie::set('person_url', \Uri::main() . $person_url, 30 * 60);
$pagination = \Uospagination::forge('mypagination', $config);
$filter['offset'] = $pagination->offset;
$filter['limit'] = $pagination->per_page;
$data['listPerson'] = $model->get_filter_person($filter);
$data['groups'] = (new \Model_Mgroups())->get_type(1);
$this->template->title = 'UOS求人システム';
$this->template->content = \View::forge('persons/persons', $data);
}
示例9: img
/**
* Creates an html image tag
*
* Sets the alt atribute to filename of it is not supplied.
*
* @param string the source
* @param array the attributes array
* @return string the image tag
*/
public static function img($src, $attr = array())
{
if (!preg_match('#^(\\w+://)# i', $src)) {
$src = \Uri::base(false) . $src;
}
$attr['src'] = $src;
$attr['alt'] = isset($attr['alt']) ? $attr['alt'] : pathinfo($src, PATHINFO_FILENAME);
return html_tag('img', $attr);
}
示例10: displayForm
/** inheritdoc */
public static function displayForm($value, &$settings, $model)
{
$settings = static::settings($settings);
$include_label = isset($settings['label']) ? $settings['label'] : true;
$required = isset($settings['required']) ? $settings['required'] : false;
$errors = $model->getErrorsForField($settings['mapping']['fieldName']);
$has_errors = count($errors) > 0;
// Check stylesSet URL
$stylesSet = \Arr::get($settings, 'stylesSet');
if (!empty($stylesSet) && substr($stylesSet, 0, 1) == '/') {
// Add an absolute URL to the start
$settings['stylesSet'] = rtrim(\Uri::base(false), '/') . $stylesSet;
}
// Add ckeditor to the class for the field
$input_attributes = isset($settings['input_attributes']) ? $settings['input_attributes'] : array('class' => 'input-xxlarge');
$input_attributes['class'] = $input_attributes['class'] . " ckeditor-cmf";
$label = !$include_label ? '' : \Form::label($settings['title'] . ($required ? ' *' : '') . ($has_errors ? ' - ' . $errors[0] : ''), $settings['mapping']['fieldName'], array('class' => 'item-label'));
$input = \Form::textarea($settings['mapping']['fieldName'], strval($value), $input_attributes);
// Set up required information for any links specified
if (isset($settings['links']) && is_array($settings['links'])) {
$links = array();
foreach ($settings['links'] as $link_type => $link) {
if (!class_exists($link_type)) {
continue;
}
$link['table_name'] = \CMF\Admin::getTableForClass($link_type);
$link['singular'] = $link_type::singular();
$link['plural'] = $link_type::plural();
$link['icon'] = $link_type::icon();
$links[$link_type] = $link;
}
$settings['links'] = $links;
}
if (isset($settings['stylesSet'])) {
if (file_exists(DOCROOT . ltrim($settings['stylesSet'], '/'))) {
$settings['stylesSet'] = 'default:' . \Uri::base(false) . ltrim($settings['stylesSet'], '/');
} else {
unset($settings['stylesSet']);
}
}
if (isset($settings['contentsCss'])) {
if (strpos($settings['contentsCss'], '.php') === false && !file_exists(DOCROOT . ltrim($settings['contentsCss'], '/'))) {
unset($settings['contentsCss']);
}
}
// Return only the field and label if no wrap is required
if (isset($settings['wrap']) && $settings['wrap'] === false) {
return $label . $input;
}
// Return the widget
if (isset($settings['widget']) && $settings['widget'] === true) {
return array('assets' => array(), 'content' => $input, 'widget' => true, 'widget_title' => $settings['title'], 'widget_icon' => 'align-left', 'js_data' => $settings);
}
// Return the normal field
return array('assets' => array(), 'content' => html_tag('div', array('class' => 'control-group ' . ($has_errors ? ' error' : '')), $label . $input), 'widget' => false, 'js_data' => $settings);
}
示例11: action_404
public function action_404()
{
Lang::load('error', 'error');
$output['error_head'] = Lang::get('error.404_error_head');
$output['error_content'] = Lang::get('error.404_error_content', array('home_link' => Uri::base()));
// <head> output ----------------------------------------------------------------------------------------------
$output['page_title'] = Lang::get('error.404_page_title');
// <head> output ----------------------------------------------------------------------------------------------
return Response::forge(Theme::instance()->view('error/404_v', $output)->auto_filter(false), 404);
}
示例12: getParentBase
public function getParentBase($default = null)
{
if (empty($this->parent_site)) {
if (!is_null($default)) {
return $default;
}
return rtrim(\Uri::base(false), '/');
}
return $this->parent_site;
}
示例13: action_index
public function action_index()
{
$item_id = \Input::get('id', '');
$save_item = \Input::post('save_item');
$post_data = \Input::post('item_field');
$new = \Input::get('new', '');
if (!$this->data['table'] || !isset($this->data['tabs'][$this->data['table']])) {
return $this->return_404();
}
$class = $this->data['tabs'][$this->data['table']];
$this->data['item_config'] = $class::admin_config();
if ($new) {
$item = $class::factory();
} elseif ($item_id) {
$item = $class::find($item_id);
}
if (!$item) {
return $this->return_404();
}
if (($id = $item->id) && \Input::post('delete')) {
$item->delete();
\Response::redirect(\Uri::base(false) . 'admin/list/' . $this->data['table'] . '?delete=' . $id);
}
// Load admin fields for the template or to save
$post_data = \Input::post('item_field');
$post_save = array();
foreach ($this->data['item_config'] as $field => $field_data) {
//TODO: get the factory working properly so we can chain this muh-fuh
$field_type = $field_data['type'];
$new_field = $field_type::factory($class, $item, $field);
$this->data['item_config'][$field]['type'] = $new_field;
if ($save_item) {
$new_field->update_item($post_data);
if (method_exists($field_type, 'post_save')) {
// Create an list of Admin Fields with post-save callbacks.
$post_save[] = $field;
}
}
}
if ($save_item && $item->save()) {
foreach ($post_save as $field) {
$this->data['item_config'][$field]['type']->post_save();
}
$this->data['success'] = 'The record has been saved.';
if ($new) {
\Response::redirect(\Uri::base(false) . 'admin/item/' . $this->data['table'] . "?id={$item->id}&save_success=1");
}
}
if (\Input::get('save_success')) {
$this->data['success'] = 'The record has been saved.';
}
$this->data['item'] = $item;
$this->template->body = 'item.php';
}
示例14: action_index
public function action_index()
{
// log out.
\Model_Accounts::logout();
// go back
if (\Input::referrer() != null && \Input::referrer() != \Uri::main()) {
\Response::redirect(\Input::referrer());
} else {
\Response::redirect(\Uri::base());
}
}
示例15: action_index
public function action_index()
{
$export = \Input::get('export', false);
//set cookie order
\Fuel\Core\Cookie::set('person_url', Uri::base() . 'job/orders');
$this->template->title = 'UOS求人システム';
//get search value
$search_arr = \Input::get();
//set return url after edit
$pagination_url = \Uri::base() . 'job/orders/index';
$return_url = \Uri::current();
if (\Input::get('flag') != null) {
$pagination_url = \Uri::base() . 'job/orders/index' . '?' . http_build_query($_GET);
$return_url = \Uri::current() . '?' . http_build_query($_GET);
}
//config pagination
$config = array('pagination_url' => $pagination_url, 'total_items' => count(\Model_Orders::get_all_order_list(null, null, $search_arr)), 'per_page' => \Constants::$default_limit_pagination, 'uri_segment' => 'page', 'num_links' => \Constants::$default_num_links, 'show_last' => true);
if ($export) {
$config['per_page'] = 100000;
} else {
//setcookie
\Cookie::set('return_url_search', $return_url, 60 * 60 * 24);
}
//setup pagination
$pagination = \Uospagination::forge('orders-pagination', $config);
$model_group = new \Model_Mgroups();
$data['listgroup'] = $model_group->get_type(1);
$model_partner = new \Model_Mpartner();
$data['listpartner'] = $model_partner->get_filter_partner(array('type' => 1));
//get list media
$model_media = new \Model_Mmedia();
$data['listmedias'] = $model_media->get_list_all_media();
if (is_array($data['listmedias']) == false) {
$data['listmedias'] = array();
}
//get list post
$model_post = new \Model_Mpost();
$data['listpost'] = $model_post->get_list_all();
//get list ss
$model_ss = new \Model_Mss();
$data['list_all_ss'] = $model_ss->get_list_all_ss();
//get all orders
$model_order = new \Model_Orders();
$data['listorders'] = \Model_Orders::get_all_order_list($pagination->per_page, $pagination->offset, $search_arr);
if ($export) {
$csv_data = $model_order->csv_process($data['listorders']);
\Model_Orders::export($csv_data);
}
foreach ($data['listorders'] as $key => $value) {
$data['listorders'][$key]['image_content'] = base64_encode($data['listorders'][$key]['image_content']);
$data['listorders'][$key]['price'] = \Model_Orders::cost_of_order($value);
}
$this->template->content = \View::forge('orders/index', $data);
}