diff --git a/bonfire/docs/_toc.ini b/bonfire/docs/_toc.ini
index 1609f0d65..425c7e0a0 100644
--- a/bonfire/docs/_toc.ini
+++ b/bonfire/docs/_toc.ini
@@ -1,10 +1,10 @@
[Start Here]
-developer/getting_started_with_bonfire = Getting Started With Bonfire
-developer/installation = Installing Bonfire
-developer/ci2 = CodeIgniter 2.x Support in Bonfire
-developer/site_structure = Site Structure
-developer/tut_blog = Simple Blog Tutorial
-developer/changelog = Change Log
+developer/start_here/getting_started_with_bonfire = Getting Started With Bonfire
+developer/start_here/installation = Installing Bonfire
+developer/start_here/ci2 = CodeIgniter 2.x Support in Bonfire
+developer/start_here/site_structure = Site Structure
+developer/start_here/tut_blog = Simple Blog Tutorial
+developer/start_here/changelog = Change Log
[Upgrade Notes]
developer/upgrade/090 = 0.8.2 to 0.9.0
@@ -23,34 +23,34 @@ developer/upgrade/072 = 0.7.1 to 0.7.2
developer/upgrade/071 = 0.7.0 to 0.7.1
[Basic Concepts]
-developer/bonfire_models = Bonfire Models
-developer/bonfire_controllers = Bonfire Controllers
-developer/routes = Improved Routes
-developer/contexts = Contexts
-developer/roles_and_permissions = Roles and Permissions
-developer/layouts_and_views = Layouts and Views
-developer/working_with_assets = Working with Assets
-developer/system_events = System Events
+developer/basic_concepts/bonfire_models = Bonfire Models
+developer/basic_concepts/bonfire_controllers = Bonfire Controllers
+developer/basic_concepts/routes = Improved Routes
+developer/basic_concepts/contexts = Contexts
+developer/basic_concepts/roles_and_permissions = Roles and Permissions
+developer/basic_concepts/layouts_and_views = Layouts and Views
+developer/basic_concepts/working_with_assets = Working with Assets
+developer/basic_concepts/system_events = System Events
[Going Deeper]
-developer/changing_the_admin_URL = Changing CONSTANTS for better security
-developer/removing_index = Removing index.php from the URL
-developer/global_helpers = Global Helper Functions
-developer/keyboard_shortcuts = Keyboard Shortcuts
-developer/performance_tips = Performance Tips
-developer/writing_docs = Writing Documentation
+developer/going_deeper/changing_the_admin_URL = Changing CONSTANTS for better security
+developer/going_deeper/removing_index = Removing index.php from the URL
+developer/going_deeper/global_helpers = Global Helper Functions
+developer/going_deeper/keyboard_shortcuts = Keyboard Shortcuts
+developer/going_deeper/performance_tips = Performance Tips
+developer/going_deeper/writing_docs = Writing Documentation
[Contributing To Bonfire]
-developer/how_to_contribute = How To Contribute
-developer/issue_tracking_and_pull_requests = Submitting Bug Reports and Feature Requests
-developer/coding_conventions = Coding Conventions
+developer/contributing/how_to_contribute = How To Contribute
+developer/contributing/issue_tracking_and_pull_requests = Submitting Bug Reports and Feature Requests
+developer/contributing/coding_conventions = Coding Conventions
[Bonfire Libraries]
-developer/assets = Assets
-developer/commonmark = CommonMark
-developer/console = Console
-developer/events = Events
-developer/installer_lib = Installer
-developer/modules = Modules
-developer/route = Route
-developer/template = Template
\ No newline at end of file
+developer/libraries/assets = Assets
+developer/libraries/commonmark = CommonMark
+developer/libraries/console = Console
+developer/libraries/events = Events
+developer/libraries/installer_lib = Installer
+developer/libraries/modules = Modules
+developer/libraries/route = Route
+developer/libraries/template = Template
\ No newline at end of file
diff --git a/bonfire/docs/bonfire_controllers.md b/bonfire/docs/basic_concepts/bonfire_controllers.md
similarity index 100%
rename from bonfire/docs/bonfire_controllers.md
rename to bonfire/docs/basic_concepts/bonfire_controllers.md
diff --git a/bonfire/docs/bonfire_models.md b/bonfire/docs/basic_concepts/bonfire_models.md
similarity index 100%
rename from bonfire/docs/bonfire_models.md
rename to bonfire/docs/basic_concepts/bonfire_models.md
diff --git a/bonfire/docs/contexts.md b/bonfire/docs/basic_concepts/contexts.md
similarity index 100%
rename from bonfire/docs/contexts.md
rename to bonfire/docs/basic_concepts/contexts.md
diff --git a/bonfire/docs/layouts_and_views.md b/bonfire/docs/basic_concepts/layouts_and_views.md
similarity index 100%
rename from bonfire/docs/layouts_and_views.md
rename to bonfire/docs/basic_concepts/layouts_and_views.md
diff --git a/bonfire/docs/roles_and_permissions.md b/bonfire/docs/basic_concepts/roles_and_permissions.md
similarity index 100%
rename from bonfire/docs/roles_and_permissions.md
rename to bonfire/docs/basic_concepts/roles_and_permissions.md
diff --git a/bonfire/docs/routes.md b/bonfire/docs/basic_concepts/routes.md
similarity index 100%
rename from bonfire/docs/routes.md
rename to bonfire/docs/basic_concepts/routes.md
diff --git a/bonfire/docs/system_events.md b/bonfire/docs/basic_concepts/system_events.md
similarity index 100%
rename from bonfire/docs/system_events.md
rename to bonfire/docs/basic_concepts/system_events.md
diff --git a/bonfire/docs/working_with_assets.md b/bonfire/docs/basic_concepts/working_with_assets.md
similarity index 100%
rename from bonfire/docs/working_with_assets.md
rename to bonfire/docs/basic_concepts/working_with_assets.md
diff --git a/bonfire/docs/coding_conventions.md b/bonfire/docs/contributing/coding_conventions.md
similarity index 100%
rename from bonfire/docs/coding_conventions.md
rename to bonfire/docs/contributing/coding_conventions.md
diff --git a/bonfire/docs/how_to_contribute.md b/bonfire/docs/contributing/how_to_contribute.md
similarity index 100%
rename from bonfire/docs/how_to_contribute.md
rename to bonfire/docs/contributing/how_to_contribute.md
diff --git a/bonfire/docs/issue_tracking_and_pull_requests.md b/bonfire/docs/contributing/issue_tracking_and_pull_requests.md
similarity index 100%
rename from bonfire/docs/issue_tracking_and_pull_requests.md
rename to bonfire/docs/contributing/issue_tracking_and_pull_requests.md
diff --git a/bonfire/docs/changing_the_admin_URL.md b/bonfire/docs/going_deeper/changing_the_admin_URL.md
similarity index 100%
rename from bonfire/docs/changing_the_admin_URL.md
rename to bonfire/docs/going_deeper/changing_the_admin_URL.md
diff --git a/bonfire/docs/global_helpers.md b/bonfire/docs/going_deeper/global_helpers.md
similarity index 100%
rename from bonfire/docs/global_helpers.md
rename to bonfire/docs/going_deeper/global_helpers.md
diff --git a/bonfire/docs/keyboard_shortcuts.md b/bonfire/docs/going_deeper/keyboard_shortcuts.md
similarity index 100%
rename from bonfire/docs/keyboard_shortcuts.md
rename to bonfire/docs/going_deeper/keyboard_shortcuts.md
diff --git a/bonfire/docs/performance_tips.md b/bonfire/docs/going_deeper/performance_tips.md
similarity index 100%
rename from bonfire/docs/performance_tips.md
rename to bonfire/docs/going_deeper/performance_tips.md
diff --git a/bonfire/docs/removing_index.md b/bonfire/docs/going_deeper/removing_index.md
similarity index 100%
rename from bonfire/docs/removing_index.md
rename to bonfire/docs/going_deeper/removing_index.md
diff --git a/bonfire/docs/writing_docs.md b/bonfire/docs/going_deeper/writing_docs.md
similarity index 100%
rename from bonfire/docs/writing_docs.md
rename to bonfire/docs/going_deeper/writing_docs.md
diff --git a/bonfire/docs/assets.md b/bonfire/docs/libraries/assets.md
similarity index 100%
rename from bonfire/docs/assets.md
rename to bonfire/docs/libraries/assets.md
diff --git a/bonfire/docs/commonmark.md b/bonfire/docs/libraries/commonmark.md
similarity index 100%
rename from bonfire/docs/commonmark.md
rename to bonfire/docs/libraries/commonmark.md
diff --git a/bonfire/docs/console.md b/bonfire/docs/libraries/console.md
similarity index 100%
rename from bonfire/docs/console.md
rename to bonfire/docs/libraries/console.md
diff --git a/bonfire/docs/events.md b/bonfire/docs/libraries/events.md
similarity index 100%
rename from bonfire/docs/events.md
rename to bonfire/docs/libraries/events.md
diff --git a/bonfire/docs/installer_lib.md b/bonfire/docs/libraries/installer_lib.md
similarity index 100%
rename from bonfire/docs/installer_lib.md
rename to bonfire/docs/libraries/installer_lib.md
diff --git a/bonfire/docs/modules.md b/bonfire/docs/libraries/modules.md
similarity index 100%
rename from bonfire/docs/modules.md
rename to bonfire/docs/libraries/modules.md
diff --git a/bonfire/docs/route.md b/bonfire/docs/libraries/route.md
similarity index 100%
rename from bonfire/docs/route.md
rename to bonfire/docs/libraries/route.md
diff --git a/bonfire/docs/template.md b/bonfire/docs/libraries/template.md
similarity index 100%
rename from bonfire/docs/template.md
rename to bonfire/docs/libraries/template.md
diff --git a/bonfire/docs/changelog.md b/bonfire/docs/start_here/changelog.md
similarity index 100%
rename from bonfire/docs/changelog.md
rename to bonfire/docs/start_here/changelog.md
diff --git a/bonfire/docs/ci2.md b/bonfire/docs/start_here/ci2.md
similarity index 100%
rename from bonfire/docs/ci2.md
rename to bonfire/docs/start_here/ci2.md
diff --git a/bonfire/docs/getting_started_with_bonfire.md b/bonfire/docs/start_here/getting_started_with_bonfire.md
similarity index 100%
rename from bonfire/docs/getting_started_with_bonfire.md
rename to bonfire/docs/start_here/getting_started_with_bonfire.md
diff --git a/bonfire/docs/installation.md b/bonfire/docs/start_here/installation.md
similarity index 100%
rename from bonfire/docs/installation.md
rename to bonfire/docs/start_here/installation.md
diff --git a/bonfire/docs/site_structure.md b/bonfire/docs/start_here/site_structure.md
similarity index 100%
rename from bonfire/docs/site_structure.md
rename to bonfire/docs/start_here/site_structure.md
diff --git a/bonfire/docs/tut_blog.md b/bonfire/docs/start_here/tut_blog.md
similarity index 100%
rename from bonfire/docs/tut_blog.md
rename to bonfire/docs/start_here/tut_blog.md
diff --git a/bonfire/modules/activities/controllers/Reports.php b/bonfire/modules/activities/controllers/Reports.php
index 9c1f9fbcd..8b56c6e17 100644
--- a/bonfire/modules/activities/controllers/Reports.php
+++ b/bonfire/modules/activities/controllers/Reports.php
@@ -59,6 +59,8 @@ public function __construct()
$this->load->model('activities/activity_model');
+ $this->load->helper('date_helper');
+
Assets::add_js(
array(
'bootstrap',
@@ -358,11 +360,12 @@ private function getActivity($which = 'activity_user', $filterValue = false)
break;
case 'activity_date':
foreach ($this->activity_model->find_all_by($activityDeletedField, 0) as $e) {
- $options[$e->activity_id] = $e->created_on;
+ $options[$e->activity_id] = user_time(strtotime($e->created_on), null);
if ($filterValue == $e->activity_id) {
$name = $e->created_on;
}
}
+
$where = 'activity_id';
Template::set('hasPermissionDeleteDate', $this->auth->has_permission($this->permissionDeleteDate));
break;
diff --git a/bonfire/modules/activities/views/reports/view.php b/bonfire/modules/activities/views/reports/view.php
index 081988918..b1886ce5d 100644
--- a/bonfire/modules/activities/views/reports/view.php
+++ b/bonfire/modules/activities/views/reports/view.php
@@ -73,7 +73,7 @@
username); ?> |
activity; ?> |
module; ?> |
- created)); ?> |
+ created), null, 'M j, Y g:i A'); ?> |
diff --git a/bonfire/modules/docs/controllers/Docs.php b/bonfire/modules/docs/controllers/Docs.php
index 3aa57ef4b..a81ba10a2 100644
--- a/bonfire/modules/docs/controllers/Docs.php
+++ b/bonfire/modules/docs/controllers/Docs.php
@@ -33,7 +33,7 @@ class Docs extends Base_Controller
protected $docsTypeBf = 'developer';
protected $docsTypeMod = 'module';
- protected $ignoreFiles = array('_404.md');
+ protected $ignoreFiles = ['_404.md'];
protected $tocFile;
private $showAppDocs;
@@ -66,17 +66,28 @@ public function __construct()
redirect();
}
- // Was a doc group provided?
- if (! $this->docsGroup) {
- redirect('docs/' . config_item('docs.default_group'));
- }
-
- $this->showAppDocs = config_item('docs.show_app_docs');
- $this->showDevDocs = config_item('docs.show_dev_docs');
$this->tocFile = config_item('docs.toc_file') ?: '_toc.ini';
$commonmark_driver = config_item('docs.commonmark_driver');
$this->docsParser = empty($commonmark_driver) ? null : $commonmark_driver;
+ $this->showAppDocs = config_item('docs.show_app_docs');
+ $this->showDevDocs = config_item('docs.show_dev_docs');
+
+ Template::set_theme(config_item('docs.theme'), 'docs');
+
+ $this->load->helper('form');
+
+ // Was a doc group provided?
+ if (! $this->docsGroup) {
+ if ($this->showAppDocs) {
+ redirect('docs/application');
+ } elseif ($this->showDevDocs) {
+ redirect('docs/developer');
+ } else {
+ redirect('docs/' . config_item('docs.default_group'));
+ }
+ }
+
// Make sure we can still get to the search method.
if ($this->docsGroup == 'search') {
$this->docsGroup = false;
@@ -93,14 +104,10 @@ public function __construct()
show_error(lang('docs_not_allowed'));
}
-
- Template::set_theme(config_item('docs.theme'), 'docs');
-
- $this->load->helper('form');
}
/**
- * Display the list of documents available and the current document
+ * Display the list of documents available and the current document.
*
* @return void
*/
@@ -108,10 +115,10 @@ public function index()
{
$data = array();
- $content = $this->read_page($this->uri->segment_array());
- $content = $this->post_process($content);
+ $content = $this->readPage($this->uri->segment_array());
+ $content = $this->postProcess($content);
- $data['sidebar'] = $this->build_sidebar();
+ $data['sidebar'] = $this->buildSidebar();
$data['content'] = $content;
Template::set($data);
@@ -130,6 +137,20 @@ public function search()
$terms = $this->input->post('search_terms');
if ($terms) {
+ // Set docsGroup and, if both are disabled...
+ if (! $this->showAppDocs && ! $this->showDevDocs) {
+ $docsGroup = config_item('docs.default_group');
+ $this->docsGroup = $docsGroup;
+
+ // If $docsGroup is "application".
+ if (strpos($docsGroup, "application") !== false) {
+ $this->showAppDocs = true;
+ } elseif (strpos($docsGroup, "developer") !== false) {
+ // If $docsGroup is "developer".
+ $this->showDevDocs = true;
+ }
+ }
+
$search_folders = array();
if ($this->showAppDocs) {
$search_folders[] = APPPATH . $this->docsDir;
@@ -139,6 +160,30 @@ public function search()
$search_folders[] = BFPATH . $this->docsDir;
}
+ // Include modules when searching.
+ foreach (Modules::list_modules() as $module) {
+ // Get module 'docs' path.
+ $path = Modules::path($module, 'docs');
+
+ // Skip APPPATH . $this->docsDir string.
+ if (strpos($path, "{$module}/docs") !== false) {
+ $path = str_replace(realpath(BFPATH), rtrim(BFPATH, '/'), $path);
+
+ // Trim trailing APPATH directory separator.
+ $apppath = rtrim(APPPATH, DIRECTORY_SEPARATOR);
+
+ // Add if showAppDocs and if $path contains $appath.
+ if ($this->showAppDocs && strpos($path, $apppath) !== false) {
+ $search_folders[] = $path;
+ }
+
+ // Add if showDevDocs and if $path contains BFPATH.
+ if ($this->showDevDocs && strpos($path, BFPATH) !== false) {
+ $search_folders[] = $path;
+ }
+ }
+ }
+
Template::set('results', $this->docsearch->search($terms, $search_folders));
}
@@ -161,41 +206,40 @@ public function search()
*
* @return string The HTML for the sidebar.
*/
- private function build_sidebar()
+ private function buildSidebar()
{
$data = array();
// Get the list of docs based on the current docs group
// (application-specific or developer docs)
if ($this->docsGroup == $this->docsTypeApp) {
- $data['docs'] = $this->get_folder_files(APPPATH . $this->docsDir, $this->docsTypeApp);
+ $data['docs'] = $this->getFolderFiles(APPPATH . $this->docsDir, $this->docsTypeApp);
} elseif ($this->docsGroup == $this->docsTypeBf) {
- $data['docs'] = $this->get_folder_files(BFPATH . $this->docsDir, $this->docsTypeBf);
+ $data['docs'] = $this->getFolderFiles(BFPATH . $this->docsDir, $this->docsTypeBf);
}
// Get the docs for the modules
- $data['module_docs'] = $this->get_module_docs();
+ $data['module_docs'] = $this->getModuleDocs();
// Set the remaining data for the view
$data['docsDir'] = $this->docsDir;
$data['docsExt'] = $this->docsExt;
- return $this->post_process($this->load->view('docs/_sidebar', $data, true));
+ return $this->postProcess($this->load->view('docs/_sidebar', $data, true));
}
/**
* Retrieves the list of files in a folder and preps the name and filename
* so it's ready for creating the HTML.
*
- * @param String $folder The path to the folder to retrieve.
- * @param String $type The type of documentation being retrieved
+ * @param string $folder The path to the folder to retrieve.
+ * @param string $type The type of documentation being retrieved
* ('application', 'bonfire', or the name of the module).
- * @param Array $ignoredFolders A list of sub-folders we should ignore.
+ * @param array $ignoredFolders A list of sub-folders we should ignore.
*
- * @return Array An associative array @see parse_ini_file for format
- * details.
+ * @return array An associative array @see parse_ini_file for format details.
*/
- private function get_folder_files($folder, $type, $ignoredFolders = array())
+ private function getFolderFiles($folder, $type, $ignoredFolders = array())
{
if (! is_dir($folder)) {
return array();
@@ -266,7 +310,7 @@ private function get_folder_files($folder, $type, $ignoredFolders = array())
*
* @return array
*/
- private function get_module_docs()
+ private function getModuleDocs()
{
$docs_modules = array();
foreach (Modules::list_modules() as $module) {
@@ -282,7 +326,7 @@ private function get_module_docs()
}
if (is_dir($path)) {
- $files = $this->get_folder_files($path, $module, $ignored_folders);
+ $files = $this->getFolderFiles($path, $module, $ignored_folders);
if (is_array($files) && count($files)) {
$docs_modules[$module] = $files;
}
@@ -296,11 +340,11 @@ private function get_module_docs()
/**
* Does the actual work of reading in and parsing the help file.
*
- * @param array $segments The uri_segments array.
+ * @param array $segments The uri_segments array.
*
* @return string
*/
- private function read_page($segments = array())
+ private function readPage($segments = array())
{
$content = null;
$defaultType = $this->docsTypeApp;
@@ -381,9 +425,9 @@ private function read_page($segments = array())
*
* @param $content
*
- * @return string The post-processed HTML.
+ * @return string The post-processed HTML.
*/
- private function post_process($content)
+ private function postProcess($content)
{
$xml = new SimpleXMLElement('' . $content . '
');
diff --git a/bonfire/modules/docs/libraries/docsearch.php b/bonfire/modules/docs/libraries/docsearch.php
index 87605be26..1e2b2eabd 100644
--- a/bonfire/modules/docs/libraries/docsearch.php
+++ b/bonfire/modules/docs/libraries/docsearch.php
@@ -69,12 +69,12 @@ public function __construct()
/**
* The entry point for performing a search of the documentation.
*
- * @param null $terms
+ * @param string $terms
* @param array $folders
*
* @return array|null
*/
- public function search ($terms = null, $folders = array())
+ public function search($terms = null, $folders = array())
{
if (empty($terms) || empty($folders)) {
return null;
@@ -84,7 +84,7 @@ public function search ($terms = null, $folders = array())
$results = array();
foreach ($folders as $folder) {
- $results = array_merge($results, $this->search_folder($terms, $folder));
+ $results = array_merge($results, $this->searchFolder($terms, $folder));
}
return $results;
@@ -93,15 +93,15 @@ public function search ($terms = null, $folders = array())
/**
* Searches a single directory worth of files.
*
- * @param $term
- * @param $folder
+ * @param string $term
+ * @param string $folder
*
* @return array The results.
*/
- private function search_folder($term, $folder)
+ private function searchFolder($term, $folder)
{
$results = array();
- $map = directory_map($folder, 2);
+ $map = bcDirectoryMap($folder, 2);
// Make sure we have something to work with.
if (empty($map) || ! is_array($map)) {
@@ -118,7 +118,7 @@ private function search_folder($term, $folder)
// Is it a folder?
if (is_array($file) && count($file)) {
- $results = array_merge($results, $this->search_folder($term, "{$folder}/{$dir}"));
+ $results = array_merge($results, $this->searchFolder($term, "{$folder}/{$dir}"));
continue;
}
@@ -160,15 +160,56 @@ private function search_folder($term, $folder)
continue;
}
- $result_url = '/docs/'. str_replace('docs', '', $folder) . str_replace('.md', '', $file);
- $result_url = str_replace(BFPATH, 'developer/', $result_url);
- $result_url = str_replace(APPPATH, 'application/', $result_url);
+ // Remove trailing directory separator.
+ $apppath = rtrim(APPPATH, DIRECTORY_SEPARATOR);
+ $filename = str_replace('.md', '', $file);
+
+ // Does $folder contain BFPATH?
+ if (strpos($folder, BFPATH) !== false) {
+ // Does $folder contain BFPATH . 'docs'?
+ if (strpos($folder, BFPATH . 'docs') !== false) {
+ $result_url = str_replace(BFPATH . 'docs', '', $folder);
+ $result_url = '/docs/developer' . $result_url . '/' . $filename;
+ } elseif (strpos($folder, BFPATH . 'modules/') !== false) {
+ // Does $folder contain BFPATH . 'modules/'?
+ // Does $folder end with '/docs/developer'?
+ if (substr($folder, -strlen('/docs/developer')) == '/docs/developer') {
+ // Remove '/docs/developer' from $folder.
+ $result_url = str_replace('/docs/developer', '', $folder);
+ $result_url = str_replace(BFPATH . 'modules/', '/docs/developer/', $result_url);
+ $result_url .= '/' . $filename;
+ } else {
+ $result_url = str_replace(BFPATH . 'modules/', '/docs/application/', $folder);
+ // Remove trailing 'docs' from $result_url.
+ $result_url = rtrim($result_url, 'docs');
+ $result_url .= $filename;
+ }
+ }
+ } elseif (strpos($folder, APPPATH . 'docs') !== false) {
+ // Does $folder contain APPATH?
+ $result_url = str_replace(APPPATH . 'docs', '', $folder);
+ $result_url = '/docs/application' . $result_url . '/' . $filename;
+ } elseif (strpos($folder, $apppath . '/modules/') !== false) {
+ // $folder contains $apppath /modules/.
+ // Does $folder end with '/docs/developer'?
+ if (substr($folder, -strlen('/docs/developer')) == '/docs/developer') {
+ // Remove '/docs/developer' from $folder.
+ $result_url = str_replace('/docs/developer', '', $folder);
+ $result_url = str_replace($apppath . '/modules/', '/docs/developer/', $result_url);
+ $result_url .= '/' . $filename;
+ } else {
+ $result_url = str_replace($apppath . '/modules/', '/docs/application/', $folder);
+ // Remove trailing 'docs' from $result_url.
+ $result_url = rtrim($result_url, 'docs');
+ $result_url .= $filename;
+ }
+ }
$results[] = array(
- 'title' => $this->extract_title($excerpt, $file),
+ 'title' => $this->extractTitle($excerpt, $file),
'file' => $folder .'/'. $file,
'url' => $result_url,
- 'extract' => $this->build_extract($excerpt, $term, $match[0][0])
+ 'extract' => $this->buildExtract($excerpt, $term, $match[0][0]),
);
++$file_count;
@@ -182,22 +223,22 @@ private function search_folder($term, $folder)
/**
* Handles extracting the text surrounding our match and basic match formatting.
*
- * @param $excerpt
- * @param $term
- * @param $match_string
+ * @param string $excerpt
+ * @param string $term
+ * @param string $match_string
*
* @return string
*/
- private function build_extract($excerpt, $term, $match_string)
+ private function buildExtract($excerpt, $term, $match_string)
{
- // Find the character positions within the string that our match was found at.
+ // Find the character positions within the string that the match was found.
// That way we'll know from what positions before and after this we want to grab it in.
- $start_offset = stripos($excerpt, $match_string);
+ $start_offset = stripos($excerpt, $match_string);
// Modify the start and end positions based on $this->excerpt_length / 2.
$buffer = floor($this->excerpt_length / 2);
- // Adjust our start position
+ // Adjust our start position.
$start_offset = $start_offset - $buffer;
if ($start_offset < 0) {
$start_offset = 0;
@@ -208,7 +249,7 @@ private function build_extract($excerpt, $term, $match_string)
$extract = character_limiter($extract, $this->excerpt_length);
// Wrap the search term in a span we can style.
- $extract = str_ireplace($term, ''. $term .'', $extract);
+ $extract = str_ireplace($term, '' . $term . '', $extract);
return $extract;
}
@@ -217,11 +258,12 @@ private function build_extract($excerpt, $term, $match_string)
* Extracts the title from a bit of markdown formatted text. If it doesn't
* have an h1 or h2, then it uses the filename.
*
- * @param $excerpt
- * @param $file
+ * @param string $excerpt
+ * @param string $file
+ *
* @return string
*/
- private function extract_title($excerpt, $file)
+ private function extractTitle($excerpt, $file)
{
$title = '';
diff --git a/bonfire/modules/emailer/controllers/Settings.php b/bonfire/modules/emailer/controllers/Settings.php
index 9c17c04da..5d6dcf7ee 100644
--- a/bonfire/modules/emailer/controllers/Settings.php
+++ b/bonfire/modules/emailer/controllers/Settings.php
@@ -264,6 +264,7 @@ public function preview($id = 0)
*/
public function create()
{
+ $this->load->helper('date_helper');
$this->load->model('users/user_model');
if (isset($_POST['create'])) {
diff --git a/bonfire/modules/emailer/views/settings/create.php b/bonfire/modules/emailer/views/settings/create.php
index 06888d07b..6b18d2e41 100644
--- a/bonfire/modules/emailer/views/settings/create.php
+++ b/bonfire/modules/emailer/views/settings/create.php
@@ -70,7 +70,7 @@
display_name; ?> |
email) ? '' : mailto($user->email); ?> |
- last_login == '0000-00-00 00:00:00' ? '---' : date('M j, y g:i A', strtotime($user->last_login)); ?> |
+ last_login == '0000-00-00 00:00:00' ? '---' : user_time(strtotime($user->last_login), null, 'M j, y g:i A'); ?> |
active) : ?>
diff --git a/bonfire/modules/users/controllers/Settings.php b/bonfire/modules/users/controllers/Settings.php
index 4c5024a6b..4fb9f99ca 100644
--- a/bonfire/modules/users/controllers/Settings.php
+++ b/bonfire/modules/users/controllers/Settings.php
@@ -65,6 +65,8 @@ public function __construct()
*/
public function index($filter = 'all', $offset = 0)
{
+ $this->load->helper('date_helper');
+
$this->auth->restrict($this->permissionManage);
// Fetch roles for the filter and the list.
@@ -538,9 +540,10 @@ private function saveUser($type = 'insert', $id = 0, $metaFields = array(), $cur
$this->user_model->save_meta_for($id, $metaData);
}
+ // Add result to payload.
+ $payload['result'] = $result;
// Any modules needing to save data?
- $postData = $this->input->post();
- Events::trigger('save_user', $postData);
+ Events::trigger('save_user', $payload);
return $result;
}
diff --git a/bonfire/modules/users/controllers/Users.php b/bonfire/modules/users/controllers/Users.php
index 83ea701e7..969234bc8 100644
--- a/bonfire/modules/users/controllers/Users.php
+++ b/bonfire/modules/users/controllers/Users.php
@@ -607,6 +607,8 @@ private function saveUser($type = 'insert', $id = 0, $metaFields = array())
$this->user_model->save_meta_for($id, $metaData);
}
+ // Add result to payload.
+ $payload['result'] = $result;
// Trigger event after saving the user.
Events::trigger('save_user', $payload);
diff --git a/bonfire/modules/users/views/settings/index.php b/bonfire/modules/users/views/settings/index.php
index a1a0fa8af..7c65a9b36 100644
--- a/bonfire/modules/users/views/settings/index.php
+++ b/bonfire/modules/users/views/settings/index.php
@@ -101,7 +101,7 @@
| display_name; ?> |
email ? mailto($user->email) : ''; ?> |
role_id]->role_name; ?> |
- last_login != '0000-00-00 00:00:00' ? date('M j, y g:i A', strtotime($user->last_login)) : '---'; ?> |
+ last_login != '0000-00-00 00:00:00' ? user_time(strtotime($user->last_login), null, 'M j, y g:i A') : '---'; ?> |
active) : ?>
diff --git a/index.php b/index.php
index 99bfd52b9..02d5b0003 100644
--- a/index.php
+++ b/index.php
@@ -1,4 +1,7 @@
-
+
@@ -29,13 +32,12 @@
- Welcome to Bonfire v0.7-dev
+ Welcome to Bonfire v
Some things have changed since the last version, specifically pertaining to the installer. Here is the new way Bonfire v0.7-dev handles the installation.
Before continuing:
- Create your database manually
- Edit your application/config/database.php file accordingly
- - Also, you may want to rename 1.htaccess to .htaccess if you wish to use mod_rewrite. =D
Oops!
@@ -47,15 +49,14 @@
ServerAlias Bonfire.Root.local
</VirtualHost>
+
Please Note: Since this is a developmental release there will be bugs. If you uncover any please read this before submitting your detailed bug report here.
+
If you feel like you can contribute either by adding features or fixing issues please fork the repo, start your work in a new branch, and submit pull requests for review.
"Let's make this the best kick-start to any CodeIgniter project." ~ The CI-Bonfire Team
-
-
-
-
-
\ No newline at end of file
diff --git a/tests/_support/database.php b/tests/_support/database.php
index e5105e6ba..78d82c7c7 100644
--- a/tests/_support/database.php
+++ b/tests/_support/database.php
@@ -56,6 +56,10 @@ public function result() { }
public function row_array() { }
public function result_array() { }
public function num_rows() { }
+
+ // Fixed Fatal error: Call to undefined method MockMY_DB::error()
+ // when running user_model_test.php
+ public function error() { }
}
/*
diff --git a/tests/bonfire/core/MY_Model_test.php b/tests/bonfire/core/MY_Model_test.php
index 2449b11ce..32a933fe5 100644
--- a/tests/bonfire/core/MY_Model_test.php
+++ b/tests/bonfire/core/MY_Model_test.php
@@ -314,7 +314,7 @@ public function test_reset_model()
public function test_triggered_insert()
{
- $this->model->db->expectOnce('insert', array('records_table', array('title' => 'MyTitle', 'created_on' => time()) ));
+ $this->model->db->expectOnce('insert', array('records_table', array('title' => 'MyTitle', 'created_on' => date('U', time())) ));
$this->model->db->expectOnce('insert_id');
$this->model->db->returns('insert', true);
$this->model->db->returns('insert_id', 5);
@@ -335,8 +335,8 @@ public function test_triggered_insert_batch()
);
$triggered_data = array(
- array('created_on' => time(), 'title' => 'My Title'),
- array('created_on' => time(), 'title' => 'Another Title')
+ array('created_on' => date('U', time()), 'title' => 'My Title'),
+ array('created_on' => date('U', time()), 'title' => 'Another Title')
);
$this->model->db->expectOnce('insert_batch', array( 'records_table', $triggered_data ));
@@ -350,7 +350,7 @@ public function test_triggered_update()
{
$triggered_data = array(
'column' => 'value',
- 'modified_on' => time()
+ 'modified_on' => date('U', time())
);
$this->model->db->expectOnce('update', array( 'records_table', $triggered_data, array('id' => 5) ));
@@ -369,8 +369,8 @@ public function test_triggered_update_batch()
);
$triggered_data = array(
- array('title' => 'My Title', 'modified_on' => time()),
- array('title' => 'Another Title', 'modified_on' => time())
+ array('title' => 'My Title', 'modified_on' => date('U', time())),
+ array('title' => 'Another Title', 'modified_on' => date('U', time()))
);
$this->model->db->expectOnce('update_batch', array( 'records_table', $triggered_data, 'title' ));
@@ -384,7 +384,7 @@ public function test_triggered_update_where()
{
$triggered_data = array(
'column' => 'value',
- 'modified_on' => time()
+ 'modified_on' => date('U', time())
);
$this->model->db->expectOnce('update', array( 'records_table', $triggered_data, array('id' => 5) ));
diff --git a/tests/bonfire/helpers/address_helper_test.php b/tests/bonfire/helpers/address_helper_test.php
index b430713e8..96e0657c9 100644
--- a/tests/bonfire/helpers/address_helper_test.php
+++ b/tests/bonfire/helpers/address_helper_test.php
@@ -78,7 +78,7 @@ public function test_state_select_selects_correct_state()
public function test_state_select_uses_passed_name()
{
$select = state_select('', 'MO', 'US', 'valid_states');
- $this->assertTrue(strpos($select, 'name="valid_states"') !== false);
+ $this->assertTrue(strpos($select, "name='valid_states'") !== false);
}
//--------------------------------------------------------------------
@@ -86,7 +86,7 @@ public function test_state_select_uses_passed_name()
public function test_state_select_sets_id_to_name()
{
$select = state_select('', 'MO', 'US', 'valid_states');
- $this->assertTrue(strpos($select, 'id="valid_states"') !== false);
+ $this->assertTrue(strpos($select, "id='valid_states'") !== false);
}
//--------------------------------------------------------------------
@@ -94,7 +94,7 @@ public function test_state_select_sets_id_to_name()
public function test_state_select_sets_class()
{
$select = state_select('', 'MO', 'US', 'valid_states', 'myClass');
- $this->assertTrue(strpos($select, 'class="myClass"') !== false);
+ $this->assertTrue(strpos($select, "class='myClass'") !== false);
}
//--------------------------------------------------------------------
@@ -148,7 +148,7 @@ public function test_country_select_selects_country()
public function test_country_select_uses_passed_name()
{
$select = country_select('', 'US', 'myName');
- $this->assertTrue(strpos($select, 'name="myName"') !== false);
+ $this->assertTrue(strpos($select, "name='myName'") !== false);
}
//--------------------------------------------------------------------
@@ -156,7 +156,7 @@ public function test_country_select_uses_passed_name()
public function test_country_select_sets_id_to_name()
{
$select = country_select('', 'US', 'myName');
- $this->assertTrue(strpos($select, 'id="myName"') !== false);
+ $this->assertTrue(strpos($select, "id='myName'") !== false);
}
//--------------------------------------------------------------------
@@ -164,7 +164,7 @@ public function test_country_select_sets_id_to_name()
public function test_country_select_sets_class()
{
$select = country_select('', 'US', 'myName', 'myClass');
- $this->assertTrue(strpos($select, 'class="myClass"') !== false);
+ $this->assertTrue(strpos($select, "class='myClass'") !== false);
}
//--------------------------------------------------------------------
diff --git a/tests/bonfire/libraries/assets_test.php b/tests/bonfire/libraries/assets_test.php
index 65aef3db0..bc612e31c 100644
--- a/tests/bonfire/libraries/assets_test.php
+++ b/tests/bonfire/libraries/assets_test.php
@@ -84,7 +84,7 @@ public function test_css_does_not_show_missing_files()
public function test_css_includes_media_type()
{
$r = Assets::css();
- $this->assertTrue(strpos($r, 'media="screen"') !== false, 'Value = "'. htmlentities($r) .'"');
+ $this->assertTrue(strpos($r, "media='screen'") !== false, 'Value = "'. htmlentities($r) .'"');
}
//--------------------------------------------------------------------
@@ -92,7 +92,7 @@ public function test_css_includes_media_type()
public function test_css_includes_media_type_with_string_passed()
{
$r = Assets::css('screen');
- $this->assertTrue(strpos($r, 'media="screen"') !== false, 'Value = "'. htmlentities($r) .'"');
+ $this->assertTrue(strpos($r, "media='screen'") !== false, 'Value = "'. htmlentities($r) .'"');
}
//--------------------------------------------------------------------
|