当前位置: 首页>>代码示例>>PHP>>正文


PHP root_url函数代码示例

本文整理汇总了PHP中root_url函数的典型用法代码示例。如果您正苦于以下问题:PHP root_url函数的具体用法?PHP root_url怎么用?PHP root_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了root_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: restrict

 public function restrict($permission, $uri = '')
 {
     // If user isn't logged in, redirect to the login page.
     if (!$this->is_logged and $this->uri->rsegment(1) !== 'login') {
         redirect(root_url(ADMINDIR . '/login'));
     }
     if (empty($permission)) {
         return TRUE;
     }
     // Split the permission string into array and
     // remove the last element and use it as  the permission action
     $permission = explode('.', $permission);
     $action = '';
     if (count($permission) === 3) {
         $action = strtolower(array_pop($permission));
     }
     $permission = implode('.', $permission);
     // Check whether the user has the proper permissions action.
     if (($has_permission = $this->checkPermittedActions($permission, $action, TRUE)) === TRUE) {
         return TRUE;
     }
     if ($uri === '') {
         // get the previous page from the session.
         $uri = referrer_url();
         // If previous page and current page are the same, but the user no longer
         // has permission, redirect to site URL to prevent an infinite loop.
         if ($uri === current_url() and !$this->CI->input->post()) {
             $uri = site_url();
         }
     }
     if (!$this->CI->input->is_ajax_request()) {
         // remove later
         redirect($uri);
     }
 }
开发者ID:AKCore,项目名称:TastyIgniter,代码行数:35,代码来源:User.php

示例2: index

 public function index()
 {
     if ($this->input->post() and $this->_addCustomer() === TRUE) {
         // checks if $_POST data is set and if registration validation was successful
         $this->alert->set('alert', $this->lang->line('alert_account_created'));
         // display success message and redirect to account login page
         redirect('account/login');
     }
     $this->template->setTitle($this->lang->line('text_register_heading'));
     $data['login_url'] = site_url('account/login');
     if ($this->config->item('registration_terms') > 0) {
         $data['registration_terms'] = str_replace(root_url(), '/', site_url('pages?popup=1&page_id=' . $this->config->item('registration_terms')));
     } else {
         $data['registration_terms'] = FALSE;
     }
     $this->load->model('Security_questions_model');
     // load the security questions model
     $data['questions'] = array();
     $results = $this->Security_questions_model->getQuestions();
     // retrieve array of security questions from getQuestions method in Security questions model
     foreach ($results as $result) {
         // loop through security questions array
         $data['questions'][] = array('id' => $result['question_id'], 'text' => $result['text']);
     }
     $data['captcha'] = $this->createCaptcha();
     $this->template->render('account/register', $data);
 }
开发者ID:allrested,项目名称:TastyIgniter,代码行数:27,代码来源:Register.php

示例3: index

 public function index()
 {
     $this->template->setTitle($this->lang->line('text_title'));
     $this->template->setHeading($this->lang->line('text_heading'));
     $this->template->setStyleTag(root_url('assets/js/daterange/daterangepicker-bs3.css'), 'daterangepicker-css', '100400');
     $this->template->setScriptTag(root_url('assets/js/daterange/moment.min.js'), 'daterange-moment-js', '1000451');
     $this->template->setScriptTag(root_url('assets/js/daterange/daterangepicker.js'), 'daterangepicker-js', '1000452');
     $this->template->setScriptTag(root_url('assets/js/Chart.min.js'), 'chart-min-js', '1000453');
     $data['total_menus'] = $this->Dashboard_model->getTotalMenus();
     $data['current_month'] = mdate('%Y-%m', time());
     $data['months'] = array();
     $pastMonth = date('Y-m-d', strtotime(date('Y-m-01') . ' -3 months'));
     $futureMonth = date('Y-m-d', strtotime(date('Y-m-01') . ' +3 months'));
     for ($i = $pastMonth; $i <= $futureMonth; $i = date('Y-m-d', strtotime($i . ' +1 months'))) {
         $data['months'][mdate('%Y-%m', strtotime($i))] = mdate('%F', strtotime($i));
     }
     $data['default_location_id'] = $this->config->item('default_location_id');
     $data['locations'] = array();
     $results = $this->Locations_model->getLocations();
     foreach ($results as $result) {
         $data['locations'][] = array('location_id' => $result['location_id'], 'location_name' => $result['location_name']);
     }
     $filter = array();
     $filter['page'] = '1';
     $filter['limit'] = '10';
     $data['activities'] = array();
     $this->load->model('Activities_model');
     $results = $this->Activities_model->getList($filter);
     foreach ($results as $result) {
         $data['activities'][] = array('activity_id' => $result['activity_id'], 'icon' => 'fa fa-tasks', 'message' => $result['message'], 'time' => mdate('%h:%i %A', strtotime($result['date_added'])), 'time_elapsed' => time_elapsed($result['date_added']), 'state' => $result['status'] === '1' ? 'read' : 'unread');
     }
     $data['top_customers'] = array();
     $results = $this->Dashboard_model->getTopCustomers($filter);
     foreach ($results as $result) {
         $data['top_customers'][] = array('first_name' => $result['first_name'], 'last_name' => $result['last_name'], 'total_orders' => $result['total_orders'], 'total_sale' => $result['total_sale']);
     }
     $filter = array();
     $filter['page'] = '';
     $filter['limit'] = 10;
     $filter['sort_by'] = 'orders.date_added';
     $filter['order_by'] = 'DESC';
     $data['order_by_active'] = 'DESC';
     $data['orders'] = array();
     $this->load->model('Orders_model');
     $results = $this->Orders_model->getList($filter);
     foreach ($results as $result) {
         $current_date = mdate('%d-%m-%Y', time());
         $date_added = mdate('%d-%m-%Y', strtotime($result['date_added']));
         if ($current_date === $date_added) {
             $date_added = $this->lang->line('text_today');
         } else {
             $date_added = mdate('%d %M %y', strtotime($date_added));
         }
         $data['orders'][] = array('order_id' => $result['order_id'], 'location_name' => $result['location_name'], 'first_name' => $result['first_name'], 'last_name' => $result['last_name'], 'order_status' => $result['status_name'], 'status_color' => $result['status_color'], 'order_time' => mdate('%H:%i', strtotime($result['order_time'])), 'order_type' => $result['order_type'] === '1' ? $this->lang->line('text_delivery') : $this->lang->line('text_collection'), 'date_added' => $date_added, 'edit' => site_url('orders/edit?id=' . $result['order_id']));
     }
     $this->template->render('dashboard', $data);
 }
开发者ID:labeetotrent,项目名称:latthiya,代码行数:57,代码来源:Dashboard.php

示例4: __construct

 /**
  * Class constructor
  *
  */
 public function __construct()
 {
     parent::__construct();
     log_message('info', 'Base Controller Class Initialized');
     // Load session
     $this->load->library('session');
     $this->load->library('alert');
     // Load database if connected
     $DATABASE = $this->load->database('default', TRUE);
     if ($DATABASE->conn_id !== FALSE) {
         // Load system configuration from database
         $this->config->load_db_config();
         // Load extension library
         $this->load->library('extension');
         // Load template library
         $this->load->library('template');
     }
     // Redirect to setup if app requires setup
     if (APPDIR !== 'setup' and TI_VERSION !== $this->config->item('ti_version')) {
         redirect(root_url('setup/'));
     }
     // Check app for setup or maintenance for production environments.
     if (ENVIRONMENT === 'production') {
         // Redirect to root url if app has already been set up
         if (APPDIR === 'setup' and $this->uri->rsegment(1) !== 'success' and TI_VERSION === $this->config->item('ti_version')) {
             redirect(root_url('setup/success'));
         }
         // Saving queries can vastly increase the memory usage, so better to turn off in production
         if ($DATABASE->conn_id !== FALSE) {
             $this->db->save_queries = FALSE;
         }
         // Show maintenance message if maintenance is enabled
         if ($this->maintenanceEnabled()) {
             show_error($this->config->item('maintenance_message'), '503', 'Maintenance Enabled');
         }
     } else {
         if (ENVIRONMENT === 'development') {
             if ($DATABASE->conn_id !== FALSE) {
                 $this->db->db_debug = TRUE;
             }
         }
     }
     if (ENVIRONMENT !== 'testing') {
         // If the requested controller is a module controller then load the module config
         if ($this->extension and $this->router and $_module = $this->router->fetch_module()) {
             // Load the module configuration file and retrieve its items.
             // Shows 404 error message on failure to load
             $this->extension->loadConfig($_module, TRUE);
         }
     }
     // Enable profiler for development environments.
     if (!$this->input->is_ajax_request()) {
         $this->output->enable_profiler(TI_DEBUG);
     }
     $this->form_validation->CI =& $this;
 }
开发者ID:AbsoluteBreeze,项目名称:TastyIgniter,代码行数:60,代码来源:Base_Controller.php

示例5: __construct

 /**
  * Class constructor
  *
  */
 public function __construct()
 {
     parent::__construct();
     log_message('info', 'Base Controller Class Initialized');
     // Load session
     $this->load->library('session');
     $this->load->library('alert');
     // Load installer library and database config items
     $this->load->library('installer');
     // If 'config/updated.txt' exists, system needs upgrade
     if (is_file(IGNITEPATH . 'config/updated.txt')) {
         if ($this->installer->upgrade()) {
             redirect(root_url(ADMINDIR . '/dashboard'));
         }
     }
     // Redirect to setup if app requires setup
     if (($installed = $this->installer->isInstalled()) !== TRUE and APPDIR !== 'setup') {
         redirect(root_url('setup'));
     }
     // If database is connected, then app is ready
     if ($this->installer->db_exists === TRUE) {
         // Load template library
         $this->load->library('template');
         // Load extension library
         $this->load->library('extension');
         // If the requested controller is a module controller then load the module config
         if (ENVIRONMENT !== 'testing') {
             if ($this->extension and $this->router and $_module = $this->router->fetch_module()) {
                 // Load the module configuration file and retrieve its items.
                 // Shows 404 error message on failure to load
                 $this->extension->loadConfig($_module, TRUE);
             }
         }
         // Saving queries can vastly increase the memory usage, so better to turn off in production
         if (ENVIRONMENT === 'production') {
             $this->db->save_queries = FALSE;
         } else {
             if (ENVIRONMENT === 'development') {
                 $this->db->db_debug = TRUE;
             }
         }
     }
     // Check app for maintenance in production environments.
     if (ENVIRONMENT === 'production') {
         // Show maintenance message if maintenance is enabled
         if ($this->maintenanceEnabled()) {
             show_error($this->config->item('maintenance_message'), '503', 'Maintenance Enabled');
         }
     }
     // Enable profiler for development environments.
     if (!$this->input->is_ajax_request()) {
         $this->output->enable_profiler(TI_DEBUG);
     }
     $this->form_validation->CI =& $this;
 }
开发者ID:Bepartofyou,项目名称:TastyIgniter,代码行数:59,代码来源:Base_Controller.php

示例6: __construct

 /**
  * Class constructor
  *
  */
 public function __construct()
 {
     parent::__construct();
     log_message('info', 'Admin Controller Class Initialized');
     $this->load->library('user');
     if (!$this->user->isLogged() and $this->uri->rsegment(1) !== 'login' and $this->uri->rsegment(1) !== 'logout') {
         $this->alert->set('danger', 'You must be logged in to access that page.');
         $this->session->set_tempdata('previous_url', current_url());
         redirect(root_url(ADMINDIR . '/login'));
     }
 }
开发者ID:allrested,项目名称:TastyIgniter,代码行数:15,代码来源:Admin_Controller.php

示例7: parse_template

 public function parse_template($template, $data = array())
 {
     if (!is_string($template) or !is_array($data)) {
         return NULL;
     }
     $data['site_name'] = $this->CI->config->item('site_name');
     $data['signature'] = $this->CI->config->item('site_name');
     $data['site_url'] = root_url();
     $this->CI->load->model('Image_tool_model');
     $data['site_logo'] = $this->CI->Image_tool_model->resize($this->CI->config->item('site_logo'));
     $this->CI->load->library('parser');
     return $this->CI->parser->parse_string($template, $data);
 }
开发者ID:ududsha,项目名称:TastyIgniter,代码行数:13,代码来源:TI_Email.php

示例8: __construct

 public function __construct()
 {
     $this->CI =& get_instance();
     if (ENVIRONMENT !== 'production' and !$this->CI->input->is_ajax_request()) {
         $this->CI->output->enable_profiler(TRUE);
     }
     if (APPDIR !== 'setup' and !$this->CI->config->item('ti_version')) {
         redirect(root_url('setup/'));
     }
     if ($this->CI->config->item('maintenance_mode') === '1') {
         // if customer is not logged in redirect to account login page
         $this->setMaintenance();
     }
 }
开发者ID:AbsoluteBreeze,项目名称:TastyIgniter,代码行数:14,代码来源:Setting.php

示例9: __construct

 /**
  * Class constructor
  *
  */
 public function __construct()
 {
     parent::__construct();
     log_message('info', 'Base Controller Class Initialized');
     // Load session
     $this->load->library('session');
     $this->load->library('alert');
     // Load database and system configuration from database
     $DATABASE = $this->load->database('default', TRUE);
     if ($DATABASE->conn_id !== FALSE) {
         $this->config->load_db_config();
         $this->load->library('extension');
         // Load template library
         $this->load->library('template');
     }
     // Redirect to setup if app requires setup
     if (APPDIR !== 'setup' and !$this->config->item('ti_setup')) {
         redirect(root_url('setup/'));
     }
     // Check app for setup or maintenance for production environments.
     if (ENVIRONMENT === 'production') {
         // Redirect to root url if app has already been set up
         if (APPDIR === 'setup' and $this->config->item('ti_setup')) {
             redirect(root_url());
         }
         // Saving queries can vastly increase the memory usage, so better to turn off in production
         $this->db->save_queries = FALSE;
         // Show maintenance message if maintenance is enabled
         if ($this->maintenanceEnabled()) {
             show_error($this->config->item('maintenance_message'), '503', 'Maintenance Enabled');
         }
     } else {
         if (ENVIRONMENT === 'development') {
             // Enable profiler for development environments.
             if (!$this->input->is_ajax_request()) {
                 $this->output->enable_profiler(TRUE);
             }
         }
     }
     // If the requested controller is a module controller then load the module config
     if ($this->router and $_module = $this->router->fetch_module()) {
         // Load the module configuration file and retrieve the configuration items
         $this->config->load($_module . '/' . $_module, TRUE);
         $config = $this->config->item($_module);
         // Check if the module configuration items are correctly set
         $this->checkModuleConfig($_module, $config);
     }
     $this->form_validation->CI =& $this;
 }
开发者ID:AKCore,项目名称:TastyIgniter,代码行数:53,代码来源:Base_Controller.php

示例10: getList

 public function getList()
 {
     $themes = $this->getThemes();
     $themes_list = list_themes();
     $results = array();
     if (!empty($themes) and !empty($themes_list)) {
         foreach ($themes_list as $theme) {
             $db_theme = (isset($themes[$theme['basename']]) and !empty($themes[$theme['basename']])) ? $themes[$theme['basename']] : array();
             $extension_id = !empty($db_theme['extension_id']) ? $db_theme['extension_id'] : 0;
             $theme_name = !empty($db_theme['name']) ? $db_theme['name'] : $theme['basename'];
             $results[$theme['basename']] = array('extension_id' => $extension_id, 'name' => $theme_name, 'title' => isset($theme['config']['title']) ? $theme['config']['title'] : $theme_name, 'version' => isset($theme['config']['version']) ? $theme['config']['version'] : '', 'description' => isset($theme['config']['description']) ? $theme['config']['description'] : '', 'location' => $theme['location'], 'screenshot' => root_url($theme['path'] . '/screenshot.png'), 'path' => $theme['path'], 'is_writable' => is_writable($theme['path']), 'config' => $theme['config'], 'data' => !empty($db_theme['data']) ? $db_theme['data'] : array(), 'customize' => (isset($theme['config']['customize']) and !empty($theme['config']['customize'])) ? TRUE : FALSE);
         }
     }
     return $results;
 }
开发者ID:ududsha,项目名称:TastyIgniter,代码行数:15,代码来源:Themes_model.php

示例11: edit

 public function edit()
 {
     $template_info = $this->Mail_templates_model->getTemplate((int) $this->input->get('id'));
     if ($template_info) {
         $template_id = $template_info['template_id'];
         $data['_action'] = site_url('mail_templates/edit?id=' . $template_id);
     } else {
         $template_id = 0;
         $data['_action'] = site_url('mail_templates/edit');
     }
     $title = isset($template_info['name']) ? $template_info['name'] : $this->lang->line('text_new');
     $this->template->setTitle(sprintf($this->lang->line('text_edit_heading'), $title));
     $this->template->setHeading(sprintf($this->lang->line('text_edit_heading'), $title));
     $this->template->setButton($this->lang->line('button_save'), array('class' => 'btn btn-primary', 'onclick' => '$(\'#edit-form\').submit();'));
     $this->template->setButton($this->lang->line('button_save_close'), array('class' => 'btn btn-default', 'onclick' => 'saveClose();'));
     $this->template->setButton($this->lang->line('button_icon_back'), array('class' => 'btn btn-default', 'href' => site_url('mail_templates')));
     $this->template->setStyleTag(root_url('assets/js/summernote/summernote.css'), 'summernote-css');
     $this->template->setScriptTag(root_url('assets/js/summernote/summernote.min.js'), 'summernote-js');
     if ($this->input->post() and $template_id = $this->_saveTemplate()) {
         if ($this->input->post('save_close') === '1') {
             redirect('mail_templates');
         }
         redirect('mail_templates/edit?id=' . $template_id);
     }
     if ($template_id === '11') {
         $this->alert->set('info', $this->lang->line('alert_caution_edit'));
     }
     $data['template_id'] = $template_id;
     $data['name'] = $template_info['name'];
     $data['status'] = $template_info['status'];
     $titles = array('registration' => $this->lang->line('text_registration'), 'registration_alert' => $this->lang->line('text_registration_alert'), 'password_reset' => $this->lang->line('text_password_reset'), 'password_reset_alert' => $this->lang->line('text_password_reset_alert'), 'order' => $this->lang->line('text_order'), 'order_alert' => $this->lang->line('text_order_alert'), 'order_update' => $this->lang->line('text_order_update'), 'reservation' => $this->lang->line('text_reservation'), 'reservation_alert' => $this->lang->line('text_reservation_alert'), 'reservation_update' => $this->lang->line('text_reservation_update'), 'internal' => $this->lang->line('text_internal'), 'contact' => $this->lang->line('text_contact'));
     $data['template_data'] = array();
     $template_data = $this->Mail_templates_model->getAllTemplateData($template_id);
     foreach ($titles as $key => $value) {
         foreach ($template_data as $tpl_data) {
             if ($key === $tpl_data['code']) {
                 $data['template_data'][] = array('template_id' => $tpl_data['template_id'], 'template_data_id' => $tpl_data['template_data_id'], 'title' => $value, 'code' => $tpl_data['code'], 'subject' => $tpl_data['subject'], 'body' => html_entity_decode($tpl_data['body']), 'date_added' => mdate('%d %M %y - %H:%i', strtotime($tpl_data['date_added'])), 'date_updated' => mdate('%d %M %y - %H:%i', strtotime($tpl_data['date_updated'])));
             }
         }
     }
     $data['templates'] = array();
     $results = $this->Mail_templates_model->getTemplates();
     foreach ($results as $result) {
         $data['templates'][] = array('template_id' => $result['template_id'], 'name' => $result['name'], 'status' => $result['status']);
     }
     $this->template->render('mail_templates_edit', $data);
 }
开发者ID:Bepartofyou,项目名称:TastyIgniter,代码行数:47,代码来源:Mail_templates.php

示例12: resize

 public function resize($img_path, $width = '', $height = '')
 {
     $thumbs_path = IMAGEPATH . 'thumbs';
     if (!is_dir($thumbs_path)) {
         $this->_createFolder($thumbs_path);
     }
     $setting = $this->config->item('image_tool');
     if (isset($setting['root_folder']) and (strpos($setting['root_folder'], '/') !== 0 or strpos($setting['root_folder'], './') === FALSE)) {
         $root_folder = $setting['root_folder'] . '/';
     } else {
         $root_folder = 'data/';
     }
     if (strpos($img_path, $root_folder) === 0) {
         $img_path = str_replace($root_folder, '', $img_path);
     }
     if (!file_exists(IMAGEPATH . $root_folder . $img_path) or !is_file(IMAGEPATH . $root_folder . $img_path) or strpos($img_path, '/') === 0) {
         return;
     }
     if (is_dir(IMAGEPATH . $root_folder . $img_path) and !is_dir($thumbs_path . '/' . $img_path)) {
         $this->_createFolder($thumbs_path . '/' . $img_path);
     }
     $info = pathinfo($img_path);
     $extension = $info['extension'];
     $img_name = $info['basename'];
     $old_path = IMAGEPATH . $root_folder . $img_path;
     list($img_width, $img_height, $img_type, $attr) = getimagesize($old_path);
     $width = $width === '' ? $img_width : $width;
     $height = $height === '' ? $img_height : $height;
     $new_path = IMAGEPATH . 'thumbs/' . substr($img_path, 0, strrpos($img_path, '.')) . '-' . $width . 'x' . $height . '.' . $extension;
     $new_image = 'thumbs/' . substr($img_path, 0, strrpos($img_path, '.')) . '-' . $width . 'x' . $height . '.' . $extension;
     if (file_exists($old_path) and !file_exists($new_path)) {
         $this->load->library('image_lib');
         $this->image_lib->clear();
         $config['image_library'] = 'gd2';
         $config['source_image'] = $old_path;
         $config['new_image'] = $new_path;
         $config['width'] = $width;
         $config['height'] = $height;
         $this->image_lib->initialize($config);
         if (!$this->image_lib->resize()) {
             return FALSE;
         }
     }
     return root_url() . 'assets/images/' . $new_image;
 }
开发者ID:AbsoluteBreeze,项目名称:TastyIgniter,代码行数:45,代码来源:Image_tool_model.php

示例13: index

 public function index()
 {
     if (!file_exists(VIEWPATH . '/success.php')) {
         show_404();
     }
     if ($this->session->tempdata('setup') === 'step_3' or $this->config->item('ti_setup') === 'v2.0') {
         $data['heading'] = 'TastyIgniter - Setup - Successful';
         $data['sub_heading'] = 'Installation Successful';
         $data['complete_setup'] = '<a href="' . root_url(ADMINDIR) . '">Login to Administrator Panel</a>';
         $this->load->library('user');
         $this->user->logout();
         $this->load->view('header', $data);
         $this->load->view('success', $data);
         $this->load->view('footer', $data);
     } else {
         redirect('setup');
     }
 }
开发者ID:AKCore,项目名称:TastyIgniter,代码行数:18,代码来源:Success.php

示例14: set_value

" /></td>';
	html += '	<td class="id">';
	html += '		<input type="hidden" name="option_values[' + table_row + '][option_value_id]" class="form-control" value="<?php 
echo set_value("option_values[' + table_row + '][option_value_id]");
?>
" />';
	html += '	-</td>';
	html += '</tr>';

	$('.table-sortable tbody').append(html);

	table_row++;
}
//--></script>
<script src="<?php 
echo root_url("assets/js/jquery-sortable.js");
?>
"></script>
<script type="text/javascript"><!--
$(function () {
	$('.table-sortable').sortable({
		containerSelector: 'table',
		itemPath: '> tbody',
		itemSelector: 'tr',
		placeholder: '<tr class="placeholder"><td colspan="3"></td></tr>',
		handle: '.handle'
	})
})
//--></script>
<?php 
echo get_footer();
开发者ID:allrested,项目名称:TastyIgniter,代码行数:31,代码来源:menu_options_edit.php

示例15: edit

 public function edit()
 {
     $this->user->restrict('Site.Themes.Access');
     $theme_name = $this->input->get('name');
     $theme_location = $this->input->get('location');
     $url = '?';
     $url .= 'name=' . $theme_name . '&location=' . $theme_location;
     if (!($theme = $this->Themes_model->getTheme($theme_name))) {
         $this->alert->set('danger', $this->lang->line('error_theme_not_found'));
         redirect('themes');
     }
     $_GET['extension_id'] = $theme['extension_id'];
     $theme_config = isset($theme['config']) ? $theme['config'] : FALSE;
     $this->load->library('customizer');
     $this->customizer->initialize($theme);
     if ($this->input->post() and $this->_updateTheme($theme) === TRUE) {
         if ($this->input->post('save_close') === '1') {
             redirect('themes/edit' . '?name=' . $theme_name . '&location=' . $theme_location);
         }
         redirect(current_url());
     }
     $this->template->setTitle(sprintf($this->lang->line('text_edit_heading'), $theme['title']));
     $this->template->setHeading(sprintf($this->lang->line('text_edit_heading'), $theme['title']));
     $this->template->setButton($this->lang->line('button_save'), array('class' => 'btn btn-primary', 'onclick' => '$(\'#edit-form\').submit();'));
     $this->template->setButton($this->lang->line('button_save_close'), array('class' => 'btn btn-default', 'onclick' => 'saveClose();'));
     $this->template->setBackButton('btn btn-back', site_url('themes'));
     $this->template->setStyleTag(root_url('assets/js/colorpicker/css/bootstrap-colorpicker.min.css'), 'bootstrap-colorpicker-css');
     $this->template->setStyleTag(root_url('assets/js/codemirror/codemirror.css'), 'codemirror-css');
     $this->template->setStyleTag(root_url('assets/js/fancybox/jquery.fancybox.css'), 'jquery-fancybox-css');
     $this->template->setScriptTag(root_url('assets/js/colorpicker/js/bootstrap-colorpicker.min.js'), 'bootstrap-colorpicker-js');
     $this->template->setScriptTag(root_url('assets/js/codemirror/codemirror.js'), 'codemirror-js', '300');
     $this->template->setScriptTag(root_url('assets/js/codemirror/xml/xml.js'), 'codemirror-xml-js', '301');
     $this->template->setScriptTag(root_url('assets/js/codemirror/css/css.js'), 'codemirror-css-js', '302');
     $this->template->setScriptTag(root_url('assets/js/codemirror/javascript/javascript.js'), 'codemirror-javascript-js', '303');
     $this->template->setScriptTag(root_url('assets/js/codemirror/php/php.js'), 'codemirror-php-js', '304');
     $this->template->setScriptTag(root_url('assets/js/codemirror/htmlmixed/htmlmixed.js'), 'codemirror-htmlmixed-js', '305');
     $this->template->setScriptTag(root_url('assets/js/codemirror/clike/clike.js'), 'codemirror-clike-js', '306');
     $this->template->setScriptTag(root_url('assets/js/jquery-sortable.js'), 'jquery-sortable-js');
     $this->template->setScriptTag(root_url("assets/js/fancybox/jquery.fancybox.js"), 'jquery-fancybox-js');
     $data['file'] = array();
     if ($this->input->get('file')) {
         $url .= '&file=' . $this->input->get('file');
         $theme_file = load_theme_file($this->input->get('file'), $theme_name, $theme_location);
         if (isset($theme_file['type']) and $theme_file['type'] === 'img') {
             $theme_file['heading'] = sprintf($this->lang->line('text_viewing'), $this->input->get('file'), $theme_name);
         } else {
             if (isset($theme_file['type']) and $theme_file['type'] === 'file') {
                 $theme_file['heading'] = sprintf($this->lang->line('text_editing'), $this->input->get('file'), $theme_name);
             } else {
                 $this->alert->set('danger', $this->lang->line('error_file_not_supported'));
             }
         }
         $data['file'] = $theme_file;
     }
     $theme_files = '';
     $tree_link = site_url('themes/edit' . $url . '&file={link}');
     $theme_files .= $this->_themeTree($theme_name, $theme_location, $tree_link);
     $data['name'] = $theme['name'];
     $data['theme_files'] = $theme_files;
     $data['theme_config'] = $theme_config;
     $data['is_customizable'] = (isset($theme['customize']) and $theme['customize']) ? TRUE : FALSE;
     $data['customizer_nav'] = $this->customizer->getNavView();
     $data['customizer_sections'] = $this->customizer->getSectionsView();
     $data['sections'] = $data['error_fields'] = array();
     if (!empty($data['is_customizable'])) {
         if (isset($theme_config['error_fields']) and is_array($theme_config['error_fields'])) {
             foreach ($theme_config['error_fields'] as $error_field) {
                 if (isset($error_field['field']) and isset($error_field['error'])) {
                     $data['error_fields'][$error_field['field']] = $error_field['error'];
                 }
             }
         }
     }
     $data['_action'] = site_url('themes/edit' . $url);
     $data['mode'] = '';
     if (!empty($data['file']['ext'])) {
         if ($data['file']['ext'] === 'php') {
             $data['mode'] = 'application/x-httpd-php';
         } else {
             if ($data['file']['ext'] === 'css') {
                 $data['mode'] = 'css';
             } else {
                 $data['mode'] = 'javascript';
             }
         }
     }
     $this->template->render('themes_edit', $data);
 }
开发者ID:labeetotrent,项目名称:latthiya,代码行数:88,代码来源:Themes.php


注:本文中的root_url函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。