Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1120 from ci-bonfire/develop
Browse files Browse the repository at this point in the history
Release 0.7.4
  • Loading branch information
mwhitneysdsu committed Jun 8, 2015
2 parents ce85f3c + 0f49817 commit 0c4a1ef
Show file tree
Hide file tree
Showing 15 changed files with 551 additions and 413 deletions.
2 changes: 1 addition & 1 deletion application/config/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
// Bonfire-specific Constants
// -----------------------------------------------------------------------------

define('BONFIRE_VERSION', 'v0.7.3');
define('BONFIRE_VERSION', 'v0.7.4');

// -----------------------------------------------------------------------------
// The 'App Area' allows you to specify the base folder used for all of the contexts
Expand Down
3 changes: 2 additions & 1 deletion application/hooks/App_hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ public function checkSiteStatus()
}

if (! $this->ci->auth->has_permission('Site.Signin.Offline')) {
if (! in_array($this->ci->uri->ruri_string(), $this->allowOffline)) {
$ruriString = '/' . ltrim(str_replace($this->ci->router->directory, '', $this->ci->uri->ruri_string()), '/');
if (! in_array($ruriString, $this->allowOffline)) {
$offlineReason = $this->ci->settings_lib->item('site.offline_reason');
include (APPPATH . 'errors/offline.php');
die();
Expand Down
36 changes: 36 additions & 0 deletions bonfire/core/BF_Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,20 @@ class BF_Router extends CI_Router

private $located = 0;

/**
* Class constructor runs the route mapping function in CI3.
*
* @param array $routing Optional configuration values.
*
* @return void
*/
public function __construct($routing = null)
{
parent::__construct($routing);

log_message('info', 'BF_Router class initialized');
}

/**
* Get the name of the current module.
*
Expand Down Expand Up @@ -227,6 +241,28 @@ public function locate($segments)
$this->located = -1;
}

/**
* Set the default controller.
*
* NOTE: this method should be protected for use with CI3, but must be public
* for use with CI2.
*
* @return void
*/
public function _set_default_controller()
{
if (empty($this->directory)) {
// Set the default controller module path.
$this->_set_module_path($this->default_controller);
}

parent::_set_default_controller();

if (empty($this->class)) {
$this->_set_404override_controller();
}
}

/**
* Set module path.
*
Expand Down
2 changes: 2 additions & 0 deletions bonfire/docs/_toc.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ developer/tut_blog = Simple Blog Tutorial
developer/changelog = Change Log

[Upgrade Notes]
developer/upgrade/074 = 0.7.3 to 0.7.4
developer/upgrade/073 = 0.7.2 to 0.7.3
developer/upgrade/072 = 0.7.1 to 0.7.2
developer/upgrade/071 = 0.7.0 to 0.7.1

Expand Down
20 changes: 17 additions & 3 deletions bonfire/docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
# Change Log

## Under development
## Released versions

### 0.7.4

#### New Features:

#### Closes Issues:
* #1119 Module Builder xss_clean error
* #1116 Syntax error in the builder-built view (when adding a required input field), pt 2
* #1115 Can't save settings, 'module' field not being sent to settings table
* #1114 Differences in Routing between CI2 and CI3
* #1113 Syntax error in the builder-built view (when adding a required input field)
* #1112 Can't login to site when offline in CI3

#### Additional Changes:

#### Known Issues:

### 0.7.3

Expand Down Expand Up @@ -43,8 +59,6 @@

#### Known Issues:

## Released versions

### 0.7.2

#### New Features:
Expand Down
358 changes: 196 additions & 162 deletions bonfire/docs/layouts_and_views.md

Large diffs are not rendered by default.

15 changes: 10 additions & 5 deletions bonfire/docs/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,15 @@ Returns the name of the active theme.
Returns the full URL to the currently active theme.
If `$resource` is supplied, returns the full URL to that resource within the currently active theme (does not validate the existence of the resource within the theme).

### themeView($view[, $data = null[, $ignore_mobile = false]])

Set an insertion point for a view (`$view`) within a view.
- `$view`: The name of the view to be rendered.
- `$data`: An array of data to be passed to the view.
- `$ignore_mobile`:
- If `true`, the library will not attempt to find a version of this view named for mobile devices (prefixed with `mobile_`).
- If `false` (default), the library will attempt to find a version of this view named for mobile devices when it detects that the page is being accessed from a mobile device.

### remove_theme_path($path)

Remove a theme path (`$path`) from the list of paths to be used when searching for themed views.
Expand Down Expand Up @@ -251,11 +260,7 @@ If `$item` does not match, an empty string is returned.
### theme_view($view[, $data = null[, $ignore_mobile = false]])

Set an insertion point for a view (`$view`) within a view.
- `$view`: The name of the view to be rendered.
- `$data`: An array of data to be passed to the view.
- `$ignore_mobile`:
- If `true`, the library will not attempt to find a version of this view named for mobile devices (prefixed with `mobile_`).
- If `false` (default), the library will attempt to find a version of this view named for mobile devices when it detects that the page is being accessed from a mobile device.
A helper function for `Template::themeView()`.

## Properties

Expand Down
1 change: 0 additions & 1 deletion bonfire/docs/tut_blog.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ Create a new file in your new `config` folder, called `config.php`.
'version' => '1.0.1',
);


Not all of these settings will be used for the Blog module, but you should understand how they work.

- **name** is the human-readable name of your module.
Expand Down
9 changes: 5 additions & 4 deletions bonfire/docs/upgrade/073.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

1. Update/install the files in the `/bonfire` directory.
2. Update `/application/config/autoload.php` (be sure to migrate your customizations).
3. Update `/application/hooks/App_hooks.php`.
4. Add `\application\language\english\bf_form_validation_lang.php`
5. The following have been deprecated:
3. Update `/application/config/constants.php` (update BONFIRE_VERSION).
4. Update `/application/hooks/App_hooks.php`.
5. Add `\application\language\english\bf_form_validation_lang.php`
6. The following have been deprecated:
<table>
<thead>
<tr>
Expand All @@ -21,4 +22,4 @@
</tr>
</tbody>
</table>
6. If you are not using the installer, add `$config['bonfire.installed'] = "1";` to `/application/config/application.php`.
7. If you are not using the installer, add `$config['bonfire.installed'] = "1";` to `/application/config/application.php`.
12 changes: 12 additions & 0 deletions bonfire/docs/upgrade/074.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Upgrading Bonfire

## 0.7.3 to 0.7.4

1. Update `/application/hooks/App_hooks.php`.
2. Update `/application/config/constants.php` (update BONFIRE_VERSION).
3. Update all files in `/bonfire/`, or:
- Update `/bonfire/core/BF_Router.php`.
- Update all files in `/bonfire/docs/`.
- Update `/bonfire/libraries/Template.php`.
- Update all files in `/bonfire/modules/builder/`.
- Update `/bonfire/modules/settings/libraries/Settings_lib.php`.
70 changes: 42 additions & 28 deletions bonfire/libraries/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @package Bonfire
* @author Bonfire Dev Team
* @copyright Copyright (c) 2011 - 2015, Bonfire Dev Team
* @license https://opensource.org/licenses/MIT The MIT License
* @license https://opensource.org/licenses/MIT The MIT License
* @link https://cibonfire.com
* @since Version 1.0
* @filesource
Expand Down Expand Up @@ -122,9 +122,9 @@ public static function init()
}

// Store our settings
self::$default_theme = self::$ci->config->item('template.default_theme');
self::$default_theme = self::$ci->config->item('template.default_theme');
self::$layout = self::$ci->config->item('template.default_layout');
self::$parse_views = self::$ci->config->item('template.parse_views');
self::$parse_views = self::$ci->config->item('template.parse_views');
self::$site_path = self::$ci->config->item('template.site_path');
self::$theme_paths = self::$ci->config->item('template.theme_paths');

Expand Down Expand Up @@ -709,6 +709,44 @@ public static function load_view($view = null, $data = null, $override = '', $is
}
}

/**
* Load a view (from the current theme) and return the content of that view.
*
* Allows for simple mobile templates by checking for a filename prefixed with
* 'mobile_' when loading the view (if $ignoreMobile is false). For example,
* if $view is 'index', the mobile version would be 'mobile_index'. If the file
* is not found with the mobile prefix, it will load the regular view.
*
* @param string $view The name of the view to load.
* @param array $data An array of data to pass to the view.
* @param boolean $ignoreMobile Disable loading mobile_ prefixed views (if true).
*
* @return string The content of the loaded view.
*/
public static function themeView($view = null, $data = null, $ignoreMobile = false)
{
if (empty($view)) {
return '';
}

$output = '';

// If allowed, try to load the mobile version of the file.
if (! $ignoreMobile) {
self::$ci->load->library('user_agent');
if (self::$ci->agent->is_mobile()) {
self::load_view("mobile_{$view}", $data, null, true, $output);
}
}

// If output is empty, either mobile is ignored or no mobile file was found.
if (empty($output)) {
self::load_view($view, $data, null, true, $output);
}

return $output;
}

//--------------------------------------------------------------------------
// !PRIVATE METHODS
//--------------------------------------------------------------------------
Expand All @@ -717,8 +755,6 @@ public static function load_view($view = null, $data = null, $override = '', $is
* Searches through the the active theme and the default theme to try to find
* a view file. If found, it returns the rendered view.
*
* @access private
*
* @param string $view The name of the view to find.
* @param array $data An array of key/value pairs to pass to the views.
*
Expand Down Expand Up @@ -845,28 +881,7 @@ protected static function debug_message($message, $force = false)
*/
function theme_view($view = null, $data = null, $ignore_mobile = false)
{
if (empty($view)) {
return '';
}

$output ='';

// If allowed, try to load the mobile version of the file.
if (! $ignore_mobile) {
$ci =& get_instance();

$ci->load->library('user_agent');
if ($ci->agent->is_mobile()) {
Template::load_view("mobile_{$view}", $data, null, true, $output);
}
}

// If output is empty, either mobile is ignored or no mobile file was found.
if (empty($output)) {
Template::load_view($view, $data, null, true, $output);
}

return $output;
return Template::themeView($view, $data, $ignore_mobile);
}

/**
Expand Down Expand Up @@ -1034,4 +1049,3 @@ function breadcrumb($my_segments = null, $wrap = false, $echo = true)

return $output;
}
/* End of file ./application/libraries/template.php */
Loading

0 comments on commit 0c4a1ef

Please sign in to comment.