GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( e54387...b62a26 )
by Lonnie
10s
created
application/config/forge.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
 // Before any _generators are run, the current environment will be
38 38
 // tested to verify it's an allowed environment.
39 39
 //
40
-    $config['forge.allowed_environments'] = [
41
-        'development',
42
-        'travis'
43
-    ];
40
+	$config['forge.allowed_environments'] = [
41
+		'development',
42
+		'travis'
43
+	];
44 44
 
45 45
 //--------------------------------------------------------------------
46 46
 // Themer to Use
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 // Define the themer to use when rendering our template files.
49 49
 // This should include the fully namespaced classname.
50 50
 //
51
-    $config['forge.themer'] = '\Myth\Themers\ViewThemer';
51
+	$config['forge.themer'] = '\Myth\Themers\ViewThemer';
52 52
 
53 53
 //--------------------------------------------------------------------
54 54
 // Generator Collections
@@ -60,6 +60,6 @@  discard block
 block discarded – undo
60 60
 //
61 61
 // The 'keys' are aliases that can be used to reference the view from.
62 62
 //
63
-    $config['forge.collections'] = [
64
-        'sprint'    => MYTHPATH .'_generators/'
65
-    ];
66 63
\ No newline at end of file
64
+	$config['forge.collections'] = [
65
+		'sprint'    => MYTHPATH .'_generators/'
66
+	];
67 67
\ No newline at end of file
Please login to merge, or discard this patch.
application/third_party/HMVC/Router.php 1 patch
Indentation   +270 added lines, -270 removed lines patch added patch discarded remove patch
@@ -34,277 +34,277 @@
 block discarded – undo
34 34
  */
35 35
 
36 36
 if (!defined("BASEPATH"))
37
-    exit("No direct script access allowed");
37
+	exit("No direct script access allowed");
38 38
 
39 39
 class HMVC_Router extends CI_Router {
40 40
 
41
-    /**
42
-     * Current module name
43
-     *
44
-     * @var string
45
-     * @access public
46
-     */
47
-    var $module = '';
48
-
49
-    /**
50
-     * Constructor
51
-     *
52
-     * Runs the route mapping function.
53
-     */
54
-    function __construct() {
55
-
56
-        $this->config =& load_class('Config', 'core');
57
-
58
-        // Process 'modules_locations' from config
59
-        $locations = $this->config->item('modules_locations');
60
-
61
-        if (!$locations) {
62
-            $locations = array(APPPATH . 'modules/');
63
-        } else if (!is_array($locations)) {
64
-            $locations = array($locations);
65
-        }
66
-
67
-        // Make sure all paths are the same format
68
-        foreach ($locations as &$location) {
69
-            $location = realpath($location);
70
-            $location = str_replace('\\', '/', $location);
71
-            $location = rtrim($location, '/') . '/';
72
-        }
73
-
74
-        $this->config->set_item('modules_locations', $locations);
75
-
76
-
77
-        parent::__construct();
78
-    }
79
-
80
-    /**
81
-     * Validates the supplied segments.  Attempts to determine the path to
82
-     * the controller.
83
-     *
84
-     * @access	private
85
-     * @param	array
86
-     * @return	array
87
-     */
88
-    function _validate_request($segments) {
89
-        if (count($segments) == 0) {
90
-            return $segments;
91
-        }
92
-
93
-        // Locate the controller with modules support
94
-        if ($located = $this->locate($segments)) {
95
-            return $located;
96
-        }
97
-
98
-        // Is there a 404 override?
99
-        if (!empty($this->routes['404_override'])) {
100
-            $segments = explode('/', $this->routes['404_override']);
101
-            if ($located = $this->locate($segments)) {
102
-                return $located;
103
-            }
104
-        }
105
-
106
-        // Nothing else to do at this point but show a 404
107
-        show_404($segments[0]);
108
-    }
109
-
110
-    /**
111
-     * Parse Routes
112
-     *
113
-     * This function matches any routes that may exist in
114
-     * the config/routes.php file against the URI to
115
-     * determine if the class/method need to be remapped.
116
-     *
117
-     * NOTE: The first segment must stay the name of the
118
-     * module, otherwise it is impossible to detect
119
-     * the current module in this method.
120
-     *
121
-     * @access	private
122
-     * @return	void
123
-     */
124
-    function _parse_routes() {
125
-        // Apply the current module's routing config
126
-
127
-        // CI v3.x has URI starting at segment 1
128
-        $segstart = (intval(substr(CI_VERSION,0,1)) > 2) ? 1 : 0;
129
-
130
-        if ($module = $this->uri->segment($segstart)) {
131
-            foreach ($this->config->item('modules_locations') as $location) {
132
-                if (is_file($file = $location . $module . '/config/routes.php')) {
133
-                    include ($file);
134
-
135
-                    $route = (!isset($route) or !is_array($route)) ? array() : $route;
136
-                    $this->routes = array_merge($this->routes, $route);
137
-                    unset($route);
138
-                }
139
-            }
140
-        }
141
-
142
-        // Let parent do the heavy routing
143
-        return parent::_parse_routes();
144
-    }
145
-
146
-    /**
147
-     * The logic of locating a controller is grouped in this function
148
-     *
149
-     * @param	array
150
-     * @return	array
151
-     */
152
-    function locate($segments) {
153
-        // anon function to ucfirst a string if CI ver > 2 (for backwards compatibility)
154
-        $_ucfirst = function($cn) {return (intval(substr(CI_VERSION,0,1)) > 2) ? ucfirst($cn) : $cn;};
155
-
156
-        list($module, $directory, $controller) = array_pad($segments, 3, NULL);
157
-
158
-        // Look for it in the standar APPPATH/controllers first so that it can override modules.
159
-        $c = count($segments);
160
-        $s = $segments;
161
-        // Loop through our segments and return as soon as a controller
162
-        // is found or when such a directory doesn't exist
163
-        while ($c-- > 0)
164
-        {
165
-            $test = $this->directory
166
-                    .ucfirst($this->translate_uri_dashes === TRUE ? str_replace('-', '_', $s[0]) : $s[0]);
167
-
168
-            if ( ! file_exists(APPPATH.'controllers/'.$test.'.php') && is_dir(APPPATH.'controllers/'.$this->directory.$s[0]))
169
-            {
170
-                $this->set_directory(array_shift($s), TRUE);
171
-                continue;
172
-            }
173
-            elseif (file_exists(APPPATH .'controllers/'. $test .'.php'))
174
-            {
175
-                return $s;
176
-            }
177
-        }
178
-
179
-        unset($s);
180
-
181
-        // Now look for it in all of our modules.
182
-        foreach ($this->config->item('modules_locations') as $location) {
183
-            $relative = $location;
184
-
185
-            // Make path relative to controllers directory
186
-            $start = rtrim(realpath(APPPATH), '/');
187
-            $parts = explode('/', str_replace('\\', '/', $start));
188
-
189
-            // Iterate all parts and replace absolute part with relative part
190
-            for ($i = 1; $i <= count($parts); $i++) {
191
-                $relative = str_replace(implode('/', $parts) . '/', str_repeat('../', $i), $relative, $count);
192
-                array_pop($parts);
193
-
194
-                // Stop iteration if found
195
-                if ($count)
196
-                    break;
197
-            }
198
-
199
-            // Does a module exist? (/modules/xyz/controllers/)
200
-            if (is_dir($source = $location . $module . '/controllers/')) {
201
-                $this->module = $module;
202
-                $this->directory = $relative . $module . '/controllers/';
203
-
204
-                // Module root controller?
205
-                if ($directory && is_file($source . $_ucfirst($directory) . '.php')) {
206
-                    $this->class = $directory;
207
-                    return array_slice($segments, 1);
208
-                }
209
-
210
-                // Module sub-directory?
211
-                if ($directory && is_dir($source . $directory . '/')) {
212
-                    $source = $source . $directory . '/';
213
-                    $this->directory .= $directory . '/';
214
-
215
-                    // Module sub-directory controller?
216
-                    if (is_file($source . $_ucfirst($directory) . '.php')) {
217
-                        return array_slice($segments, 1);
218
-                    }
219
-
220
-                    // Module sub-directory  default controller?
221
-                    if (is_file($source . $_ucfirst($this->default_controller) . '.php')) {
222
-                        $segments[1] = $this->default_controller;
223
-                        return array_slice($segments, 1);
224
-                    }
225
-
226
-                    // Module sub-directory sub-controller?
227
-                    if ($controller && is_file($source . $_ucfirst($controller) . '.php')) {
228
-                        return array_slice($segments, 2);
229
-                    }
230
-                }
231
-
232
-                // Module controller?
233
-                if (is_file($source . $_ucfirst($module) . '.php')) {
234
-                    return $segments;
235
-                }
236
-
237
-                // Module default controller?
238
-                if (is_file($source . $_ucfirst($this->default_controller) . '.php')) {
239
-                    $segments[0] = $this->default_controller;
240
-                    return $segments;
241
-                }
242
-            }
243
-        }
244
-
245
-        // Default controller?
246
-        if (is_file(APPPATH . 'controllers/' . $module . '/' . $_ucfirst($this->default_controller) . '.php')) {
247
-            $segments[0] = $this->default_controller;
248
-            return $segments;
249
-        }
250
-    }
251
-
252
-    /**
253
-     * Set the module name
254
-     *
255
-     * @param	string
256
-     * @return	void
257
-     */
258
-    function set_module($module) {
259
-        $this->module = $module;
260
-    }
261
-
262
-    /**
263
-     * Set default controller
264
-     *
265
-     * First we check in normal APPPATH/controller's location,
266
-     * then in Modules named after the default_controller
267
-     * @author  hArpanet - based on system/core/Router.php
268
-     *
269
-     * @return  void
270
-     */
271
-    protected function _set_default_controller()
272
-    {
273
-        // controller in APPPATH/controllers takes priority over module with same name
274
-        parent::_set_default_controller();
275
-
276
-        // see if parent found a controller
277
-        $class = $this->fetch_class();
278
-
279
-        if (empty($class)) {
280
-
281
-            // no 'normal' controller found,
282
-            // get the class/method from the default_controller route
283
-            if (sscanf($this->default_controller, '%[^/]/%s', $class, $method) !== 2)
284
-            {
285
-                $method = 'index';
286
-            }
287
-
288
-            // try to locate default controller in modules
289
-            if ($located = $this->locate(array($class, $class, $method))) {
290
-
291
-                log_message('debug', 'No URI present. Default module controller set.');
292
-            }
293
-        }
294
-
295
-        // Nothing found - this will trigger 404 later
296
-    }
297
-
298
-    // --------------------------------------------------------------------
299
-
300
-
301
-    /**
302
-     * Fetch the module
303
-     *
304
-     * @access	public
305
-     * @return	string
306
-     */
307
-    function fetch_module() {
308
-        return $this->module;
309
-    }
41
+	/**
42
+	 * Current module name
43
+	 *
44
+	 * @var string
45
+	 * @access public
46
+	 */
47
+	var $module = '';
48
+
49
+	/**
50
+	 * Constructor
51
+	 *
52
+	 * Runs the route mapping function.
53
+	 */
54
+	function __construct() {
55
+
56
+		$this->config =& load_class('Config', 'core');
57
+
58
+		// Process 'modules_locations' from config
59
+		$locations = $this->config->item('modules_locations');
60
+
61
+		if (!$locations) {
62
+			$locations = array(APPPATH . 'modules/');
63
+		} else if (!is_array($locations)) {
64
+			$locations = array($locations);
65
+		}
66
+
67
+		// Make sure all paths are the same format
68
+		foreach ($locations as &$location) {
69
+			$location = realpath($location);
70
+			$location = str_replace('\\', '/', $location);
71
+			$location = rtrim($location, '/') . '/';
72
+		}
73
+
74
+		$this->config->set_item('modules_locations', $locations);
75
+
76
+
77
+		parent::__construct();
78
+	}
79
+
80
+	/**
81
+	 * Validates the supplied segments.  Attempts to determine the path to
82
+	 * the controller.
83
+	 *
84
+	 * @access	private
85
+	 * @param	array
86
+	 * @return	array
87
+	 */
88
+	function _validate_request($segments) {
89
+		if (count($segments) == 0) {
90
+			return $segments;
91
+		}
92
+
93
+		// Locate the controller with modules support
94
+		if ($located = $this->locate($segments)) {
95
+			return $located;
96
+		}
97
+
98
+		// Is there a 404 override?
99
+		if (!empty($this->routes['404_override'])) {
100
+			$segments = explode('/', $this->routes['404_override']);
101
+			if ($located = $this->locate($segments)) {
102
+				return $located;
103
+			}
104
+		}
105
+
106
+		// Nothing else to do at this point but show a 404
107
+		show_404($segments[0]);
108
+	}
109
+
110
+	/**
111
+	 * Parse Routes
112
+	 *
113
+	 * This function matches any routes that may exist in
114
+	 * the config/routes.php file against the URI to
115
+	 * determine if the class/method need to be remapped.
116
+	 *
117
+	 * NOTE: The first segment must stay the name of the
118
+	 * module, otherwise it is impossible to detect
119
+	 * the current module in this method.
120
+	 *
121
+	 * @access	private
122
+	 * @return	void
123
+	 */
124
+	function _parse_routes() {
125
+		// Apply the current module's routing config
126
+
127
+		// CI v3.x has URI starting at segment 1
128
+		$segstart = (intval(substr(CI_VERSION,0,1)) > 2) ? 1 : 0;
129
+
130
+		if ($module = $this->uri->segment($segstart)) {
131
+			foreach ($this->config->item('modules_locations') as $location) {
132
+				if (is_file($file = $location . $module . '/config/routes.php')) {
133
+					include ($file);
134
+
135
+					$route = (!isset($route) or !is_array($route)) ? array() : $route;
136
+					$this->routes = array_merge($this->routes, $route);
137
+					unset($route);
138
+				}
139
+			}
140
+		}
141
+
142
+		// Let parent do the heavy routing
143
+		return parent::_parse_routes();
144
+	}
145
+
146
+	/**
147
+	 * The logic of locating a controller is grouped in this function
148
+	 *
149
+	 * @param	array
150
+	 * @return	array
151
+	 */
152
+	function locate($segments) {
153
+		// anon function to ucfirst a string if CI ver > 2 (for backwards compatibility)
154
+		$_ucfirst = function($cn) {return (intval(substr(CI_VERSION,0,1)) > 2) ? ucfirst($cn) : $cn;};
155
+
156
+		list($module, $directory, $controller) = array_pad($segments, 3, NULL);
157
+
158
+		// Look for it in the standar APPPATH/controllers first so that it can override modules.
159
+		$c = count($segments);
160
+		$s = $segments;
161
+		// Loop through our segments and return as soon as a controller
162
+		// is found or when such a directory doesn't exist
163
+		while ($c-- > 0)
164
+		{
165
+			$test = $this->directory
166
+					.ucfirst($this->translate_uri_dashes === TRUE ? str_replace('-', '_', $s[0]) : $s[0]);
167
+
168
+			if ( ! file_exists(APPPATH.'controllers/'.$test.'.php') && is_dir(APPPATH.'controllers/'.$this->directory.$s[0]))
169
+			{
170
+				$this->set_directory(array_shift($s), TRUE);
171
+				continue;
172
+			}
173
+			elseif (file_exists(APPPATH .'controllers/'. $test .'.php'))
174
+			{
175
+				return $s;
176
+			}
177
+		}
178
+
179
+		unset($s);
180
+
181
+		// Now look for it in all of our modules.
182
+		foreach ($this->config->item('modules_locations') as $location) {
183
+			$relative = $location;
184
+
185
+			// Make path relative to controllers directory
186
+			$start = rtrim(realpath(APPPATH), '/');
187
+			$parts = explode('/', str_replace('\\', '/', $start));
188
+
189
+			// Iterate all parts and replace absolute part with relative part
190
+			for ($i = 1; $i <= count($parts); $i++) {
191
+				$relative = str_replace(implode('/', $parts) . '/', str_repeat('../', $i), $relative, $count);
192
+				array_pop($parts);
193
+
194
+				// Stop iteration if found
195
+				if ($count)
196
+					break;
197
+			}
198
+
199
+			// Does a module exist? (/modules/xyz/controllers/)
200
+			if (is_dir($source = $location . $module . '/controllers/')) {
201
+				$this->module = $module;
202
+				$this->directory = $relative . $module . '/controllers/';
203
+
204
+				// Module root controller?
205
+				if ($directory && is_file($source . $_ucfirst($directory) . '.php')) {
206
+					$this->class = $directory;
207
+					return array_slice($segments, 1);
208
+				}
209
+
210
+				// Module sub-directory?
211
+				if ($directory && is_dir($source . $directory . '/')) {
212
+					$source = $source . $directory . '/';
213
+					$this->directory .= $directory . '/';
214
+
215
+					// Module sub-directory controller?
216
+					if (is_file($source . $_ucfirst($directory) . '.php')) {
217
+						return array_slice($segments, 1);
218
+					}
219
+
220
+					// Module sub-directory  default controller?
221
+					if (is_file($source . $_ucfirst($this->default_controller) . '.php')) {
222
+						$segments[1] = $this->default_controller;
223
+						return array_slice($segments, 1);
224
+					}
225
+
226
+					// Module sub-directory sub-controller?
227
+					if ($controller && is_file($source . $_ucfirst($controller) . '.php')) {
228
+						return array_slice($segments, 2);
229
+					}
230
+				}
231
+
232
+				// Module controller?
233
+				if (is_file($source . $_ucfirst($module) . '.php')) {
234
+					return $segments;
235
+				}
236
+
237
+				// Module default controller?
238
+				if (is_file($source . $_ucfirst($this->default_controller) . '.php')) {
239
+					$segments[0] = $this->default_controller;
240
+					return $segments;
241
+				}
242
+			}
243
+		}
244
+
245
+		// Default controller?
246
+		if (is_file(APPPATH . 'controllers/' . $module . '/' . $_ucfirst($this->default_controller) . '.php')) {
247
+			$segments[0] = $this->default_controller;
248
+			return $segments;
249
+		}
250
+	}
251
+
252
+	/**
253
+	 * Set the module name
254
+	 *
255
+	 * @param	string
256
+	 * @return	void
257
+	 */
258
+	function set_module($module) {
259
+		$this->module = $module;
260
+	}
261
+
262
+	/**
263
+	 * Set default controller
264
+	 *
265
+	 * First we check in normal APPPATH/controller's location,
266
+	 * then in Modules named after the default_controller
267
+	 * @author  hArpanet - based on system/core/Router.php
268
+	 *
269
+	 * @return  void
270
+	 */
271
+	protected function _set_default_controller()
272
+	{
273
+		// controller in APPPATH/controllers takes priority over module with same name
274
+		parent::_set_default_controller();
275
+
276
+		// see if parent found a controller
277
+		$class = $this->fetch_class();
278
+
279
+		if (empty($class)) {
280
+
281
+			// no 'normal' controller found,
282
+			// get the class/method from the default_controller route
283
+			if (sscanf($this->default_controller, '%[^/]/%s', $class, $method) !== 2)
284
+			{
285
+				$method = 'index';
286
+			}
287
+
288
+			// try to locate default controller in modules
289
+			if ($located = $this->locate(array($class, $class, $method))) {
290
+
291
+				log_message('debug', 'No URI present. Default module controller set.');
292
+			}
293
+		}
294
+
295
+		// Nothing found - this will trigger 404 later
296
+	}
297
+
298
+	// --------------------------------------------------------------------
299
+
300
+
301
+	/**
302
+	 * Fetch the module
303
+	 *
304
+	 * @access	public
305
+	 * @return	string
306
+	 */
307
+	function fetch_module() {
308
+		return $this->module;
309
+	}
310 310
 }
Please login to merge, or discard this patch.
myth/CIModules/docs/controllers/Docs.php 1 patch
Indentation   +259 added lines, -259 removed lines patch added patch discarded remove patch
@@ -33,284 +33,284 @@
 block discarded – undo
33 33
 class Docs extends \Myth\Controllers\ThemedController
34 34
 {
35 35
 
36
-    protected $ignoreFiles = array('_404.md');
36
+	protected $ignoreFiles = array('_404.md');
37 37
 
38
-    protected $tocFile;
38
+	protected $tocFile;
39 39
 
40
-    protected $doc_folders = [];
40
+	protected $doc_folders = [];
41 41
 
42
-    protected $current_group = null;
42
+	protected $current_group = null;
43 43
 
44
-    protected $current_path = null;
44
+	protected $current_path = null;
45 45
 
46
-    private $showAppDocs;
46
+	private $showAppDocs;
47 47
 
48
-    private $showDevDocs;
48
+	private $showDevDocs;
49 49
 
50
-    protected $theme = 'docs';
50
+	protected $theme = 'docs';
51 51
 
52
-    protected $auto_escape = false;
52
+	protected $auto_escape = false;
53 53
 
54
-    //--------------------------------------------------------------------------
54
+	//--------------------------------------------------------------------------
55 55
 
56
-    /**
57
-     * Constructor
58
-     *
59
-     * @return \Docs
60
-     */
61
-    public function __construct()
62
-    {
63
-        parent::__construct();
56
+	/**
57
+	 * Constructor
58
+	 *
59
+	 * @return \Docs
60
+	 */
61
+	public function __construct()
62
+	{
63
+		parent::__construct();
64 64
 
65
-        $this->load->config('docs');
66
-        $this->lang->load('docs');
65
+		$this->load->config('docs');
66
+		$this->lang->load('docs');
67 67
 
68
-        // Save our folders
69
-        $this->doc_folders = config_item('docs.folders');
68
+		// Save our folders
69
+		$this->doc_folders = config_item('docs.folders');
70 70
 
71
-        list($this->current_group, $this->current_path) = $this->determineFromURL();
71
+		list($this->current_group, $this->current_path) = $this->determineFromURL();
72 72
 
73
-        $this->determineVisibleGroups($this->current_group, $this->current_path);
73
+		$this->determineVisibleGroups($this->current_group, $this->current_path);
74 74
 
75
-        $this->load->helper('form');
76
-        $this->load->helper('language');
75
+		$this->load->helper('form');
76
+		$this->load->helper('language');
77 77
 
78
-        $this->docbuilder = new \Myth\Docs\Builder( array('apppath' => APPPATH) );
78
+		$this->docbuilder = new \Myth\Docs\Builder( array('apppath' => APPPATH) );
79 79
 
80
-        $formatter = function ($str) {
81
-            $converter = new \League\CommonMark\CommonMarkConverter();
82
-            return $converter->convertToHtml($str);
83
-        };
84
-        $this->docbuilder->registerFormatter($formatter, true);
85
-    }
80
+		$formatter = function ($str) {
81
+			$converter = new \League\CommonMark\CommonMarkConverter();
82
+			return $converter->convertToHtml($str);
83
+		};
84
+		$this->docbuilder->registerFormatter($formatter, true);
85
+	}
86 86
 
87
-    //--------------------------------------------------------------------
87
+	//--------------------------------------------------------------------
88 88
 
89
-    /**
90
-     * Display the list of documents available and the current document
91
-     *
92
-     * @return void
93
-     */
94
-    public function index()
95
-    {
96
-        $data = array();
89
+	/**
90
+	 * Display the list of documents available and the current document
91
+	 *
92
+	 * @return void
93
+	 */
94
+	public function index()
95
+	{
96
+		$data = array();
97 97
 
98
-        // Make sure the builder knows where to look
99
-        foreach ($this->doc_folders as $alias => $folder) {
100
-            $this->docbuilder->addDocFolder($alias, $folder);
101
-        }
102
-
103
-        try {
104
-            $content = $this->docbuilder->readPage($this->current_path, $this->current_group);
105
-            $content = $this->docbuilder->postProcess($content, site_url(), current_url());
106
-
107
-            $data['sidebar'] = $this->buildSidebar($content);
108
-            $data['toc']     = $this->buildTOC();
109
-            $data['content'] = $content;
110
-            $data['page_title'] = $this->docbuilder->pageTitle();
111
-        } catch (Exception $e) {
112
-            $this->setMessage($e->getMessage(), 'warning');
113
-        }
114
-
115
-        $this->render($data, config_item('docs.cache_time'));
116
-    }
117
-
118
-    //--------------------------------------------------------------------
119
-
120
-    /**
121
-     * Display search results and handles the search itself.
122
-     *
123
-     * @return void
124
-     */
125
-    public function search()
126
-    {
127
-        $this->benchmark->mark('search_start');
128
-        $this->docsearch = new \Myth\Docs\Search();
129
-        $this->load->helper('markdown_extended');
130
-        $this->docsearch->registerFormatter('MarkdownExtended', true);
131
-
132
-        $data = array();
133
-
134
-        $terms = $this->input->post('search_terms');
135
-
136
-        if ($terms) {
137
-            $search_folders = $this->doc_folders;
138
-
139
-            $data['results'] = $this->docsearch->search($terms, $search_folders);
140
-        }
141
-
142
-        $this->benchmark->mark('search_end');
143
-
144
-        $data['search_time']  = $this->benchmark->elapsed_time('search_start', 'search_end');
145
-        $data['search_terms'] = $terms;
146
-        $data['page_title'] = 'Search Results';
147
-
148
-        $this->render($data);
149
-    }
150
-
151
-    //--------------------------------------------------------------------------
152
-    // Private Methods
153
-    //--------------------------------------------------------------------------
154
-
155
-    /**
156
-     * Determines which groups are allowed to be viewed by the current system
157
-     * and the user/environment.
158
-     *
159
-     * todo Allow docs groups to be shown/hidden per-environment, using assoc-array for permitted environments
160
-     */
161
-    private function determineVisibleGroups($current_group, $current_path)
162
-    {
163
-        // Is displaying docs permitted for this environment?
164
-        if (config_item('docs.permitted_environments')
165
-            && !in_array(ENVIRONMENT, config_item('docs.permitted_environments'))
166
-        ) {
167
-            $this->setMessage(lang('docs_env_disabled'), 'danger');
168
-            redirect();
169
-        }
170
-
171
-        $this->showAppDocs = config_item('docs.show_app_docs');
172
-        $this->showDevDocs = config_item('docs.show_dev_docs');
173
-        $this->tocFile     = config_item('docs.toc_file') ?: '_toc.ini';
174
-
175
-        // Make sure we can still get to the search method.
176
-        if ($current_group == 'search') {
177
-            $this->current_group = false;
178
-        } // Are we allowed to show developer docs in this environment?
179
-        elseif ($current_group == 'developer'
180
-                && !$this->showDevDocs
181
-                && ENVIRONMENT != 'development'
182
-        ) {
183
-            if ($this->showAppDocs) {
184
-                $this->setMessage(lang('docs_not_allowed_dev'), 'warning');
185
-
186
-                redirect('docs/application');
187
-            }
188
-
189
-            show_error(lang('docs_not_allowed'));
190
-        }
191
-    }
192
-
193
-    //--------------------------------------------------------------------
194
-
195
-    /**
196
-     * Determines the current doc group and file path from the current URL.
197
-     *
198
-     * Returns an array with the group and file path in the 0 and 1 positions, respectively.
199
-     *
200
-     * @return array
201
-     */
202
-    private function determineFromURL()
203
-    {
204
-        $return = [
205
-            '', // Group
206
-            '', // File Path
207
-        ];
208
-
209
-        $segments = $this->uri->segment_array();
210
-
211
-        // Remove the 'docs' from the array
212
-        // for now, we assume this is the first one
213
-        // since that is how Bonfire is setup to show docs
214
-        // @todo Make it so the path can be modified and this still works.
215
-        array_shift($segments);
216
-
217
-        // If nothing left, then assign the default group and redirect to
218
-        // a page we can do something with...
219
-        if (!count($segments)) {
220
-            redirect('docs/' . config_item('docs.default_group'));
221
-        }
222
-
223
-        // Do we have a group specified? Bonfire Docs requires that a group
224
-        // be part of the URI so it should be the first element on the array.
225
-        $return[0] = array_shift($segments);
226
-
227
-        // If there's any more left, then join them together and they'll
228
-        // form the path to the file. This will allow for subfolders with the
229
-        // docs folder itself.
230
-        $return[1] = count($segments) ? implode('/', $segments) : 'index';
231
-
232
-        return $return;
233
-    }
234
-
235
-    //--------------------------------------------------------------------
236
-
237
-    /**
238
-     * Builds a TOC for the sidebar out of files found in the following folders:
239
-     *      - application/docs
240
-     *      - bonfire/docs
241
-     *      - {module}/docs
242
-     *
243
-     * @param $content  The HTML generated for the page content.
244
-     * @return string   The HTML for the sidebar.
245
-     */
246
-    private function buildSidebar(&$content)
247
-    {
248
-        $data = [];
249
-
250
-        // Set the remaining data for the view
251
-        $data['docsDir'] = 'docs/' . $this->current_group . '/';
252
-        $data['docsExt'] = config_item('docs.extension');
253
-
254
-        $data['docMap'] = $this->docbuilder->buildDocumentMap($content);
255
-
256
-        return $this->docbuilder->postProcess(
257
-            $this->load->view('docs/_document_map', $data, true),
258
-            site_url(),
259
-            current_url()
260
-        );
261
-    }
262
-
263
-    //--------------------------------------------------------------------
264
-
265
-    /**
266
-     * Builds out the nested lists of items that are needed
267
-     */
268
-    private function buildTOC()
269
-    {
270
-        $folder = $this->doc_folders[$this->current_group] . '/';
271
-
272
-        $map = $this->docbuilder->buildTOC($folder);
273
-
274
-        return $this->docbuilder->postProcess(
275
-            $this->load->view('docs/_toc', ['map' => $map], true),
276
-            site_url(),
277
-            current_url()
278
-        );
279
-    }
280
-
281
-    //--------------------------------------------------------------------
282
-
283
-    /**
284
-     * Checks all modules to see if they include docs and prepares their doc
285
-     * information for use in the sidebar.
286
-     *
287
-     * @return array
288
-     */
289
-    private function get_module_docs()
290
-    {
291
-        $docs_modules = array();
292
-        foreach (\Bonfire\Modules::list_modules() as $module) {
293
-            $ignored_folders = array();
294
-            $path            = \Bonfire\Modules::path($module) . $this->docsDir;
295
-
296
-            // If these are developer docs, add the folder to the path.
297
-            if ($this->current_group == $this->docsTypeBf) {
298
-                $path .= '/' . $this->docsTypeBf;
299
-            } // For Application docs, ignore the 'developers' folder.
300
-            else {
301
-                $ignored_folders[] = $this->docsTypeBf;
302
-            }
303
-
304
-            if (is_dir($path)) {
305
-                $files = $this->get_folder_files($path, $module, $ignored_folders);
306
-                if (is_array($files) && count($files)) {
307
-                    $docs_modules[$module] = $files;
308
-                }
309
-            }
310
-        }
311
-
312
-        return $docs_modules;
313
-    }
314
-    //--------------------------------------------------------------------
98
+		// Make sure the builder knows where to look
99
+		foreach ($this->doc_folders as $alias => $folder) {
100
+			$this->docbuilder->addDocFolder($alias, $folder);
101
+		}
102
+
103
+		try {
104
+			$content = $this->docbuilder->readPage($this->current_path, $this->current_group);
105
+			$content = $this->docbuilder->postProcess($content, site_url(), current_url());
106
+
107
+			$data['sidebar'] = $this->buildSidebar($content);
108
+			$data['toc']     = $this->buildTOC();
109
+			$data['content'] = $content;
110
+			$data['page_title'] = $this->docbuilder->pageTitle();
111
+		} catch (Exception $e) {
112
+			$this->setMessage($e->getMessage(), 'warning');
113
+		}
114
+
115
+		$this->render($data, config_item('docs.cache_time'));
116
+	}
117
+
118
+	//--------------------------------------------------------------------
119
+
120
+	/**
121
+	 * Display search results and handles the search itself.
122
+	 *
123
+	 * @return void
124
+	 */
125
+	public function search()
126
+	{
127
+		$this->benchmark->mark('search_start');
128
+		$this->docsearch = new \Myth\Docs\Search();
129
+		$this->load->helper('markdown_extended');
130
+		$this->docsearch->registerFormatter('MarkdownExtended', true);
131
+
132
+		$data = array();
133
+
134
+		$terms = $this->input->post('search_terms');
135
+
136
+		if ($terms) {
137
+			$search_folders = $this->doc_folders;
138
+
139
+			$data['results'] = $this->docsearch->search($terms, $search_folders);
140
+		}
141
+
142
+		$this->benchmark->mark('search_end');
143
+
144
+		$data['search_time']  = $this->benchmark->elapsed_time('search_start', 'search_end');
145
+		$data['search_terms'] = $terms;
146
+		$data['page_title'] = 'Search Results';
147
+
148
+		$this->render($data);
149
+	}
150
+
151
+	//--------------------------------------------------------------------------
152
+	// Private Methods
153
+	//--------------------------------------------------------------------------
154
+
155
+	/**
156
+	 * Determines which groups are allowed to be viewed by the current system
157
+	 * and the user/environment.
158
+	 *
159
+	 * todo Allow docs groups to be shown/hidden per-environment, using assoc-array for permitted environments
160
+	 */
161
+	private function determineVisibleGroups($current_group, $current_path)
162
+	{
163
+		// Is displaying docs permitted for this environment?
164
+		if (config_item('docs.permitted_environments')
165
+			&& !in_array(ENVIRONMENT, config_item('docs.permitted_environments'))
166
+		) {
167
+			$this->setMessage(lang('docs_env_disabled'), 'danger');
168
+			redirect();
169
+		}
170
+
171
+		$this->showAppDocs = config_item('docs.show_app_docs');
172
+		$this->showDevDocs = config_item('docs.show_dev_docs');
173
+		$this->tocFile     = config_item('docs.toc_file') ?: '_toc.ini';
174
+
175
+		// Make sure we can still get to the search method.
176
+		if ($current_group == 'search') {
177
+			$this->current_group = false;
178
+		} // Are we allowed to show developer docs in this environment?
179
+		elseif ($current_group == 'developer'
180
+				&& !$this->showDevDocs
181
+				&& ENVIRONMENT != 'development'
182
+		) {
183
+			if ($this->showAppDocs) {
184
+				$this->setMessage(lang('docs_not_allowed_dev'), 'warning');
185
+
186
+				redirect('docs/application');
187
+			}
188
+
189
+			show_error(lang('docs_not_allowed'));
190
+		}
191
+	}
192
+
193
+	//--------------------------------------------------------------------
194
+
195
+	/**
196
+	 * Determines the current doc group and file path from the current URL.
197
+	 *
198
+	 * Returns an array with the group and file path in the 0 and 1 positions, respectively.
199
+	 *
200
+	 * @return array
201
+	 */
202
+	private function determineFromURL()
203
+	{
204
+		$return = [
205
+			'', // Group
206
+			'', // File Path
207
+		];
208
+
209
+		$segments = $this->uri->segment_array();
210
+
211
+		// Remove the 'docs' from the array
212
+		// for now, we assume this is the first one
213
+		// since that is how Bonfire is setup to show docs
214
+		// @todo Make it so the path can be modified and this still works.
215
+		array_shift($segments);
216
+
217
+		// If nothing left, then assign the default group and redirect to
218
+		// a page we can do something with...
219
+		if (!count($segments)) {
220
+			redirect('docs/' . config_item('docs.default_group'));
221
+		}
222
+
223
+		// Do we have a group specified? Bonfire Docs requires that a group
224
+		// be part of the URI so it should be the first element on the array.
225
+		$return[0] = array_shift($segments);
226
+
227
+		// If there's any more left, then join them together and they'll
228
+		// form the path to the file. This will allow for subfolders with the
229
+		// docs folder itself.
230
+		$return[1] = count($segments) ? implode('/', $segments) : 'index';
231
+
232
+		return $return;
233
+	}
234
+
235
+	//--------------------------------------------------------------------
236
+
237
+	/**
238
+	 * Builds a TOC for the sidebar out of files found in the following folders:
239
+	 *      - application/docs
240
+	 *      - bonfire/docs
241
+	 *      - {module}/docs
242
+	 *
243
+	 * @param $content  The HTML generated for the page content.
244
+	 * @return string   The HTML for the sidebar.
245
+	 */
246
+	private function buildSidebar(&$content)
247
+	{
248
+		$data = [];
249
+
250
+		// Set the remaining data for the view
251
+		$data['docsDir'] = 'docs/' . $this->current_group . '/';
252
+		$data['docsExt'] = config_item('docs.extension');
253
+
254
+		$data['docMap'] = $this->docbuilder->buildDocumentMap($content);
255
+
256
+		return $this->docbuilder->postProcess(
257
+			$this->load->view('docs/_document_map', $data, true),
258
+			site_url(),
259
+			current_url()
260
+		);
261
+	}
262
+
263
+	//--------------------------------------------------------------------
264
+
265
+	/**
266
+	 * Builds out the nested lists of items that are needed
267
+	 */
268
+	private function buildTOC()
269
+	{
270
+		$folder = $this->doc_folders[$this->current_group] . '/';
271
+
272
+		$map = $this->docbuilder->buildTOC($folder);
273
+
274
+		return $this->docbuilder->postProcess(
275
+			$this->load->view('docs/_toc', ['map' => $map], true),
276
+			site_url(),
277
+			current_url()
278
+		);
279
+	}
280
+
281
+	//--------------------------------------------------------------------
282
+
283
+	/**
284
+	 * Checks all modules to see if they include docs and prepares their doc
285
+	 * information for use in the sidebar.
286
+	 *
287
+	 * @return array
288
+	 */
289
+	private function get_module_docs()
290
+	{
291
+		$docs_modules = array();
292
+		foreach (\Bonfire\Modules::list_modules() as $module) {
293
+			$ignored_folders = array();
294
+			$path            = \Bonfire\Modules::path($module) . $this->docsDir;
295
+
296
+			// If these are developer docs, add the folder to the path.
297
+			if ($this->current_group == $this->docsTypeBf) {
298
+				$path .= '/' . $this->docsTypeBf;
299
+			} // For Application docs, ignore the 'developers' folder.
300
+			else {
301
+				$ignored_folders[] = $this->docsTypeBf;
302
+			}
303
+
304
+			if (is_dir($path)) {
305
+				$files = $this->get_folder_files($path, $module, $ignored_folders);
306
+				if (is_array($files) && count($files)) {
307
+					$docs_modules[$module] = $files;
308
+				}
309
+			}
310
+		}
311
+
312
+		return $docs_modules;
313
+	}
314
+	//--------------------------------------------------------------------
315 315
 
316 316
 }
Please login to merge, or discard this patch.
myth/Settings/Settings.php 1 patch
Indentation   +248 added lines, -248 removed lines patch added patch discarded remove patch
@@ -40,253 +40,253 @@
 block discarded – undo
40 40
  */
41 41
 class Settings {
42 42
 
43
-    /**
44
-     * Holds instantiated data stores.
45
-     *
46
-     * @var array
47
-     */
48
-    protected static $stores = [];
49
-
50
-    protected static $default_store = '';
51
-
52
-    protected static $initialized = false;
53
-
54
-    //--------------------------------------------------------------------
55
-
56
-    /**
57
-     * Fires up instances of the datastores and gets us ready to roll.
58
-     */
59
-    public static function init()
60
-    {
61
-        if (self::$initialized === true)
62
-        {
63
-            return;
64
-        }
65
-
66
-        // Load up and instantiate our setting stores.
67
-        $user_stores = config_item('settings.stores');
68
-
69
-        if (is_array($user_stores))
70
-        {
71
-            foreach ($user_stores as $alias => $class)
72
-            {
73
-                self::$stores[ strtolower($alias) ] = new $class();
74
-            }
75
-        }
76
-
77
-        self::$default_store = config_item('settings.default_store');
78
-
79
-        if (empty(self::$stores[ self::$default_store ]))
80
-        {
81
-            show_error( lang('settings.bad_default') );
82
-        }
83
-    }
84
-
85
-    //--------------------------------------------------------------------
86
-
87
-    /**
88
-     * Inserts/Replaces a single setting item.
89
-     *
90
-     * @param $key
91
-     * @param null $value
92
-     * @param string $group
93
-     * @param string $store
94
-     */
95
-    public static function save($key, $value=null, $group='app', $store=null)
96
-    {
97
-        self::init();
98
-
99
-        if (empty($store) || empty(self::$stores[$store]))
100
-        {
101
-            // we've already determined that the default store exists
102
-            // in the init() method.
103
-            $store = self::$default_store;
104
-        }
105
-
106
-        return self::$stores[ $store ]->save($key, $value, $group);
107
-    }
108
-
109
-    //--------------------------------------------------------------------
110
-
111
-    /**
112
-     * Retrieves a single item. If not $store is specified, will loop
113
-     * through the stores in order until it finds it. If $store is
114
-     * specified, will only look within that store for it.
115
-     *
116
-     * @param $key
117
-     * @param string $group
118
-     * @param string $store
119
-     * @return mixed
120
-     */
121
-    public static function get($key, $group='app', $store=null)
122
-    {
123
-        self::init();
124
-
125
-        $group = strtolower($group);
126
-
127
-        // If the store is specified but doesn't exist, crap out
128
-        // so that they developer has a chance to fix it.
129
-        if (! is_null($store) && empty(self::$stores[$store]))
130
-        {
131
-            show_error( sprintf( lang('settings.cant_retrieve'), $store ) );
132
-        }
133
-
134
-        // If $store is set, get the value from that store only.
135
-        if (! empty($store))
136
-        {
137
-            return self::$stores[$store]->get($key, $group);
138
-        }
139
-
140
-        // Otherwise loop through each store until we find it
141
-        foreach (self::$stores as $s)
142
-        {
143
-            if ($found = $s->get($key, $group))
144
-            {
145
-                return $found;
146
-            }
147
-        }
148
-
149
-        // Still here... guess we didn't find anything, then...
150
-        return false;
151
-    }
152
-
153
-    //--------------------------------------------------------------------
154
-
155
-    /**
156
-     * Deletes a single item.
157
-     *
158
-     * @param $key
159
-     * @param $group
160
-     * @param $store
161
-     * @return mixed
162
-     */
163
-    public static function delete($key, $group='app', $store=null)
164
-    {
165
-        self::init();
166
-
167
-        $group = strtolower($group);
168
-
169
-        // If the store is specified but doesn't exist, crap out
170
-        // so that they developer has a chance to fix it.
171
-        if (! is_null($store) && empty(self::$stores[$store]))
172
-        {
173
-            show_error( sprintf( lang('settings.cant_retrieve'), $store ) );
174
-        }
175
-
176
-        // If $store is set, get the value from that store only.
177
-        if (! empty($store))
178
-        {
179
-            return self::$stores[$store]->delete($key, $group);
180
-        }
181
-
182
-        // Otherwise delete from the default store
183
-        return self::$stores[ self::$default_store ]->delete($key, $group);
184
-    }
185
-
186
-    //--------------------------------------------------------------------
187
-
188
-    /**
189
-     * Searches the store for any items with $field = $value.
190
-     *
191
-     * @param $field
192
-     * @param $value
193
-     * @return mixed
194
-     */
195
-    public static function findBy($field, $value)
196
-    {
197
-        self::init();
198
-
199
-        foreach (self::$stores as $s)
200
-        {
201
-            if ($found = $s->findBy($field, $value))
202
-            {
203
-                return $found;
204
-            }
205
-        }
206
-
207
-        return false;
208
-    }
209
-
210
-    //--------------------------------------------------------------------
211
-
212
-    /**
213
-     * Retrieves all items in the store either globally or for a single group.
214
-     *
215
-     * @param string $group
216
-     * @return mixed
217
-     */
218
-    public static function all($group=null, $store=null)
219
-    {
220
-        self::init();
221
-
222
-        $group = strtolower($group);
223
-
224
-        if (! empty($store))
225
-        {
226
-            return self::$stores[ $store ]->all($group);
227
-        }
228
-
229
-        // Otherwise combine the results from all stores
230
-        $results = [];
231
-
232
-        foreach (self::$stores as $s)
233
-        {
234
-            $found = $s->all($group);
235
-            if ($found)
236
-            {
237
-                $results = array_merge($results, (array)$found);
238
-            }
239
-        }
240
-
241
-        return $results;
242
-    }
243
-
244
-    //--------------------------------------------------------------------
245
-
246
-    /**
247
-     * Appends a new datastore the end of the curent stores.
248
-     *
249
-     * @param $alias
250
-     * @param $class
251
-     * @return bool
252
-     */
253
-    public static function addStore($alias, $class)
254
-    {
255
-        self::init();
256
-
257
-        if (class_exists($class))
258
-        {
259
-            self::$stores[ strtolower($alias) ] = new $class();
260
-            return true;
261
-        }
262
-
263
-        return false;
264
-    }
265
-
266
-    //--------------------------------------------------------------------
267
-
268
-    /**
269
-     * Removes a datastore from the list of stores currently available.
270
-     *
271
-     * @param $alias
272
-     * @return bool
273
-     */
274
-    public static function removeStore($alias)
275
-    {
276
-        self::init();
277
-
278
-        $alias = strtolower($alias);
279
-
280
-        if (empty(self::$stores[$alias]))
281
-        {
282
-            return false;
283
-        }
284
-
285
-        unset(self::$stores[$alias]);
286
-
287
-        return true;
288
-    }
289
-
290
-    //--------------------------------------------------------------------
43
+	/**
44
+	 * Holds instantiated data stores.
45
+	 *
46
+	 * @var array
47
+	 */
48
+	protected static $stores = [];
49
+
50
+	protected static $default_store = '';
51
+
52
+	protected static $initialized = false;
53
+
54
+	//--------------------------------------------------------------------
55
+
56
+	/**
57
+	 * Fires up instances of the datastores and gets us ready to roll.
58
+	 */
59
+	public static function init()
60
+	{
61
+		if (self::$initialized === true)
62
+		{
63
+			return;
64
+		}
65
+
66
+		// Load up and instantiate our setting stores.
67
+		$user_stores = config_item('settings.stores');
68
+
69
+		if (is_array($user_stores))
70
+		{
71
+			foreach ($user_stores as $alias => $class)
72
+			{
73
+				self::$stores[ strtolower($alias) ] = new $class();
74
+			}
75
+		}
76
+
77
+		self::$default_store = config_item('settings.default_store');
78
+
79
+		if (empty(self::$stores[ self::$default_store ]))
80
+		{
81
+			show_error( lang('settings.bad_default') );
82
+		}
83
+	}
84
+
85
+	//--------------------------------------------------------------------
86
+
87
+	/**
88
+	 * Inserts/Replaces a single setting item.
89
+	 *
90
+	 * @param $key
91
+	 * @param null $value
92
+	 * @param string $group
93
+	 * @param string $store
94
+	 */
95
+	public static function save($key, $value=null, $group='app', $store=null)
96
+	{
97
+		self::init();
98
+
99
+		if (empty($store) || empty(self::$stores[$store]))
100
+		{
101
+			// we've already determined that the default store exists
102
+			// in the init() method.
103
+			$store = self::$default_store;
104
+		}
105
+
106
+		return self::$stores[ $store ]->save($key, $value, $group);
107
+	}
108
+
109
+	//--------------------------------------------------------------------
110
+
111
+	/**
112
+	 * Retrieves a single item. If not $store is specified, will loop
113
+	 * through the stores in order until it finds it. If $store is
114
+	 * specified, will only look within that store for it.
115
+	 *
116
+	 * @param $key
117
+	 * @param string $group
118
+	 * @param string $store
119
+	 * @return mixed
120
+	 */
121
+	public static function get($key, $group='app', $store=null)
122
+	{
123
+		self::init();
124
+
125
+		$group = strtolower($group);
126
+
127
+		// If the store is specified but doesn't exist, crap out
128
+		// so that they developer has a chance to fix it.
129
+		if (! is_null($store) && empty(self::$stores[$store]))
130
+		{
131
+			show_error( sprintf( lang('settings.cant_retrieve'), $store ) );
132
+		}
133
+
134
+		// If $store is set, get the value from that store only.
135
+		if (! empty($store))
136
+		{
137
+			return self::$stores[$store]->get($key, $group);
138
+		}
139
+
140
+		// Otherwise loop through each store until we find it
141
+		foreach (self::$stores as $s)
142
+		{
143
+			if ($found = $s->get($key, $group))
144
+			{
145
+				return $found;
146
+			}
147
+		}
148
+
149
+		// Still here... guess we didn't find anything, then...
150
+		return false;
151
+	}
152
+
153
+	//--------------------------------------------------------------------
154
+
155
+	/**
156
+	 * Deletes a single item.
157
+	 *
158
+	 * @param $key
159
+	 * @param $group
160
+	 * @param $store
161
+	 * @return mixed
162
+	 */
163
+	public static function delete($key, $group='app', $store=null)
164
+	{
165
+		self::init();
166
+
167
+		$group = strtolower($group);
168
+
169
+		// If the store is specified but doesn't exist, crap out
170
+		// so that they developer has a chance to fix it.
171
+		if (! is_null($store) && empty(self::$stores[$store]))
172
+		{
173
+			show_error( sprintf( lang('settings.cant_retrieve'), $store ) );
174
+		}
175
+
176
+		// If $store is set, get the value from that store only.
177
+		if (! empty($store))
178
+		{
179
+			return self::$stores[$store]->delete($key, $group);
180
+		}
181
+
182
+		// Otherwise delete from the default store
183
+		return self::$stores[ self::$default_store ]->delete($key, $group);
184
+	}
185
+
186
+	//--------------------------------------------------------------------
187
+
188
+	/**
189
+	 * Searches the store for any items with $field = $value.
190
+	 *
191
+	 * @param $field
192
+	 * @param $value
193
+	 * @return mixed
194
+	 */
195
+	public static function findBy($field, $value)
196
+	{
197
+		self::init();
198
+
199
+		foreach (self::$stores as $s)
200
+		{
201
+			if ($found = $s->findBy($field, $value))
202
+			{
203
+				return $found;
204
+			}
205
+		}
206
+
207
+		return false;
208
+	}
209
+
210
+	//--------------------------------------------------------------------
211
+
212
+	/**
213
+	 * Retrieves all items in the store either globally or for a single group.
214
+	 *
215
+	 * @param string $group
216
+	 * @return mixed
217
+	 */
218
+	public static function all($group=null, $store=null)
219
+	{
220
+		self::init();
221
+
222
+		$group = strtolower($group);
223
+
224
+		if (! empty($store))
225
+		{
226
+			return self::$stores[ $store ]->all($group);
227
+		}
228
+
229
+		// Otherwise combine the results from all stores
230
+		$results = [];
231
+
232
+		foreach (self::$stores as $s)
233
+		{
234
+			$found = $s->all($group);
235
+			if ($found)
236
+			{
237
+				$results = array_merge($results, (array)$found);
238
+			}
239
+		}
240
+
241
+		return $results;
242
+	}
243
+
244
+	//--------------------------------------------------------------------
245
+
246
+	/**
247
+	 * Appends a new datastore the end of the curent stores.
248
+	 *
249
+	 * @param $alias
250
+	 * @param $class
251
+	 * @return bool
252
+	 */
253
+	public static function addStore($alias, $class)
254
+	{
255
+		self::init();
256
+
257
+		if (class_exists($class))
258
+		{
259
+			self::$stores[ strtolower($alias) ] = new $class();
260
+			return true;
261
+		}
262
+
263
+		return false;
264
+	}
265
+
266
+	//--------------------------------------------------------------------
267
+
268
+	/**
269
+	 * Removes a datastore from the list of stores currently available.
270
+	 *
271
+	 * @param $alias
272
+	 * @return bool
273
+	 */
274
+	public static function removeStore($alias)
275
+	{
276
+		self::init();
277
+
278
+		$alias = strtolower($alias);
279
+
280
+		if (empty(self::$stores[$alias]))
281
+		{
282
+			return false;
283
+		}
284
+
285
+		unset(self::$stores[$alias]);
286
+
287
+		return true;
288
+	}
289
+
290
+	//--------------------------------------------------------------------
291 291
 
292 292
 }
Please login to merge, or discard this patch.
myth/Mail/LogMailService.php 1 patch
Indentation   +285 added lines, -285 removed lines patch added patch discarded remove patch
@@ -40,289 +40,289 @@
 block discarded – undo
40 40
  */
41 41
 class LogMailService implements MailServiceInterface {
42 42
 
43
-    protected $ci = null;
44
-
45
-    protected $format = 'html';
46
-    protected $headers = [];
47
-    protected $subject = null;
48
-
49
-    protected $html_message = null;
50
-    protected $text_message = null;
51
-
52
-    //--------------------------------------------------------------------
53
-
54
-    public function __construct()
55
-    {
56
-        $this->ci =& get_instance();
57
-
58
-        $this->ci->load->library('email');
59
-    }
60
-
61
-    //--------------------------------------------------------------------
62
-
63
-
64
-    /**
65
-     * Does the actual delivery of a message. In this case, though, we simply
66
-     * write the html and text files out to the log folder/emails.
67
-     *
68
-     * The filename format is: yyyymmddhhiiss_email.{format}
69
-     *
70
-     * @param bool  $clear_after    If TRUE, will reset the class after sending.
71
-     *
72
-     * @return mixed
73
-     */
74
-    public function send($clear_after=true)
75
-    {
76
-
77
-        // Ensure we have enough data
78
-        if (empty($this->to) || empty($this->subject) ||
79
-            (empty($this->html_message) && empty($this->text_message))
80
-        )
81
-        {
82
-            throw new \RuntimeException( lang('mail.invalid_log_data') );
83
-        }
84
-
85
-        $symbols = ['#', '%', '&', '{', '}', '\\', '/', '<', '>', '*', '?', ' ', '$', '!', '\'', '"', ':', '@', '+', '`', '='];
86
-
87
-        $email = str_replace($symbols, '.', strtolower($this->to) );
88
-
89
-        $filename = date('YmdHis_'). $email;
90
-
91
-        // Ensure the emails folder exists in the log folder.
92
-        $path = config_item('log_path');
93
-        $path = ! empty( $path ) ? $path : APPPATH .'logs/';
94
-        $path = rtrim($path, '/ ') .'/email/';
95
-
96
-        if (! is_dir($path))
97
-        {
98
-            mkdir($path, 0777, true);
99
-        }
100
-
101
-        get_instance()->load->helper('file');
102
-
103
-        // Write our HTML file out
104
-        if (! empty($this->html_message) && ! write_file( $path . $filename . '.html', $this->html_message ) )
105
-        {
106
-            throw new \RuntimeException( sprintf( lang('mail.error_html_log'), $path, $filename) );
107
-        }
108
-
109
-        // Write our TEXT file out
110
-        if (! empty($this->text_message) && ! write_file( $path . $filename . '.txt', $this->text_message ) )
111
-        {
112
-            throw new \RuntimeException( sprintf( lang('mail.error_text_log'), $path, $filename) );
113
-        }
114
-
115
-        return true;
116
-    }
117
-
118
-    //--------------------------------------------------------------------
119
-
120
-    /**
121
-     * Adds an attachment to the current email that is being built.
122
-     *
123
-     * @param string    $filename
124
-     * @param string    $disposition    like 'inline'. Default is 'attachment'
125
-     * @param string    $newname        If you'd like to rename the file for delivery
126
-     * @param string    $mime           Custom defined mime type.
127
-     */
128
-    public function attach($filename, $disposition=null, $newname=null, $mime=null)
129
-    {
130
-        return;
131
-    }
132
-
133
-    //--------------------------------------------------------------------
134
-
135
-    /**
136
-     * Sets a header value for the email. Not every service will provide this.
137
-     *
138
-     * @param $field
139
-     * @param $value
140
-     * @return mixed
141
-     */
142
-    public function setHeader($field, $value)
143
-    {
144
-        $this->headers[$field] = $value;
145
-
146
-        return $this;
147
-    }
148
-
149
-    //--------------------------------------------------------------------
150
-
151
-    //--------------------------------------------------------------------
152
-    // Options
153
-    //--------------------------------------------------------------------
154
-
155
-    /**
156
-     * Sets the email address to send the email to.
157
-     *
158
-     * @param $email
159
-     * @return mixed
160
-     */
161
-    public function to($email)
162
-    {
163
-        $this->to = $email;
164
-
165
-        return $this;
166
-    }
167
-
168
-    //--------------------------------------------------------------------
169
-
170
-    /**
171
-     * Sets who the email is coming from.
172
-     *
173
-     * @param $email
174
-     * @param null $name
175
-     * @return mixed
176
-     */
177
-    public function from($email, $name=null)
178
-    {
179
-        if (! empty($name))
180
-        {
181
-            $this->from = [$email, $name];
182
-        }
183
-        else
184
-        {
185
-            $this->from = $email;
186
-        }
187
-
188
-        return $this;
189
-    }
190
-
191
-    //--------------------------------------------------------------------
192
-
193
-    /**
194
-     * Sets a single additional email address to 'cc'.
195
-     *
196
-     * @param $email
197
-     * @return mixed
198
-     */
199
-    public function cc($email)
200
-    {
201
-        $this->cc = $email;
202
-
203
-        return $this;
204
-    }
205
-
206
-    //--------------------------------------------------------------------
207
-
208
-    /**
209
-     * Sets a single email address to 'bcc' to.
210
-     *
211
-     * @param $email
212
-     * @return mixed
213
-     */
214
-    public function bcc($email)
215
-    {
216
-        $this->bcc = $email;
217
-
218
-        return $this;
219
-    }
220
-
221
-    //--------------------------------------------------------------------
222
-
223
-    /**
224
-     * Sets the reply to address.
225
-     *
226
-     * @param $email
227
-     * @return mixed
228
-     */
229
-    public function reply_to($email, $name=null)
230
-    {
231
-        if (! empty($name))
232
-        {
233
-            $this->reply_to = [$email, $name];
234
-        }
235
-        else
236
-        {
237
-            $this->reply_to = $email;
238
-        }
239
-
240
-        return $this;
241
-    }
242
-
243
-    //--------------------------------------------------------------------
244
-
245
-    /**
246
-     * Sets the subject line of the email.
247
-     *
248
-     * @param $subject
249
-     * @return mixed
250
-     */
251
-    public function subject($subject)
252
-    {
253
-        $this->subject = $subject;
254
-
255
-        return $this;
256
-    }
257
-
258
-    //--------------------------------------------------------------------
259
-
260
-    /**
261
-     * Sets the HTML portion of the email address. Optional.
262
-     *
263
-     * @param $message
264
-     * @return mixed
265
-     */
266
-    public function html_message($message)
267
-    {
268
-        $this->html_message = $message;
269
-
270
-        return $this;
271
-    }
272
-
273
-    //--------------------------------------------------------------------
274
-
275
-    /**
276
-     * Sets the text portion of the email address. Optional.
277
-     *
278
-     * @param $message
279
-     * @return mixed
280
-     */
281
-    public function text_message($message)
282
-    {
283
-        $this->text_message = $message;
284
-
285
-        return $this;
286
-    }
287
-
288
-    //--------------------------------------------------------------------
289
-
290
-    /**
291
-     * Sets the format to send the email in. Either 'html' or 'text'.
292
-     *
293
-     * @param $format
294
-     * @return mixed
295
-     */
296
-    public function format($format)
297
-    {
298
-        $this->format = $format;
299
-
300
-        return $this;
301
-    }
302
-
303
-    //--------------------------------------------------------------------
304
-    /**
305
-     * Resets the state to blank, ready for a new email. Useful when
306
-     * sending emails in a loop and you need to make sure that the
307
-     * email is reset.
308
-     *
309
-     * @param bool $clear_attachments
310
-     * @return mixed
311
-     */
312
-    public function reset($clear_attachments=true)
313
-    {
314
-        $this->to = null;
315
-        $this->from = null;
316
-        $this->reply_to = null;
317
-        $this->cc = null;
318
-        $this->bcc = null;
319
-        $this->subject = null;
320
-        $this->html_message = null;
321
-        $this->text_message = null;
322
-        $this->headers = [];
323
-
324
-        return $this;
325
-    }
326
-
327
-    //--------------------------------------------------------------------
43
+	protected $ci = null;
44
+
45
+	protected $format = 'html';
46
+	protected $headers = [];
47
+	protected $subject = null;
48
+
49
+	protected $html_message = null;
50
+	protected $text_message = null;
51
+
52
+	//--------------------------------------------------------------------
53
+
54
+	public function __construct()
55
+	{
56
+		$this->ci =& get_instance();
57
+
58
+		$this->ci->load->library('email');
59
+	}
60
+
61
+	//--------------------------------------------------------------------
62
+
63
+
64
+	/**
65
+	 * Does the actual delivery of a message. In this case, though, we simply
66
+	 * write the html and text files out to the log folder/emails.
67
+	 *
68
+	 * The filename format is: yyyymmddhhiiss_email.{format}
69
+	 *
70
+	 * @param bool  $clear_after    If TRUE, will reset the class after sending.
71
+	 *
72
+	 * @return mixed
73
+	 */
74
+	public function send($clear_after=true)
75
+	{
76
+
77
+		// Ensure we have enough data
78
+		if (empty($this->to) || empty($this->subject) ||
79
+			(empty($this->html_message) && empty($this->text_message))
80
+		)
81
+		{
82
+			throw new \RuntimeException( lang('mail.invalid_log_data') );
83
+		}
84
+
85
+		$symbols = ['#', '%', '&', '{', '}', '\\', '/', '<', '>', '*', '?', ' ', '$', '!', '\'', '"', ':', '@', '+', '`', '='];
86
+
87
+		$email = str_replace($symbols, '.', strtolower($this->to) );
88
+
89
+		$filename = date('YmdHis_'). $email;
90
+
91
+		// Ensure the emails folder exists in the log folder.
92
+		$path = config_item('log_path');
93
+		$path = ! empty( $path ) ? $path : APPPATH .'logs/';
94
+		$path = rtrim($path, '/ ') .'/email/';
95
+
96
+		if (! is_dir($path))
97
+		{
98
+			mkdir($path, 0777, true);
99
+		}
100
+
101
+		get_instance()->load->helper('file');
102
+
103
+		// Write our HTML file out
104
+		if (! empty($this->html_message) && ! write_file( $path . $filename . '.html', $this->html_message ) )
105
+		{
106
+			throw new \RuntimeException( sprintf( lang('mail.error_html_log'), $path, $filename) );
107
+		}
108
+
109
+		// Write our TEXT file out
110
+		if (! empty($this->text_message) && ! write_file( $path . $filename . '.txt', $this->text_message ) )
111
+		{
112
+			throw new \RuntimeException( sprintf( lang('mail.error_text_log'), $path, $filename) );
113
+		}
114
+
115
+		return true;
116
+	}
117
+
118
+	//--------------------------------------------------------------------
119
+
120
+	/**
121
+	 * Adds an attachment to the current email that is being built.
122
+	 *
123
+	 * @param string    $filename
124
+	 * @param string    $disposition    like 'inline'. Default is 'attachment'
125
+	 * @param string    $newname        If you'd like to rename the file for delivery
126
+	 * @param string    $mime           Custom defined mime type.
127
+	 */
128
+	public function attach($filename, $disposition=null, $newname=null, $mime=null)
129
+	{
130
+		return;
131
+	}
132
+
133
+	//--------------------------------------------------------------------
134
+
135
+	/**
136
+	 * Sets a header value for the email. Not every service will provide this.
137
+	 *
138
+	 * @param $field
139
+	 * @param $value
140
+	 * @return mixed
141
+	 */
142
+	public function setHeader($field, $value)
143
+	{
144
+		$this->headers[$field] = $value;
145
+
146
+		return $this;
147
+	}
148
+
149
+	//--------------------------------------------------------------------
150
+
151
+	//--------------------------------------------------------------------
152
+	// Options
153
+	//--------------------------------------------------------------------
154
+
155
+	/**
156
+	 * Sets the email address to send the email to.
157
+	 *
158
+	 * @param $email
159
+	 * @return mixed
160
+	 */
161
+	public function to($email)
162
+	{
163
+		$this->to = $email;
164
+
165
+		return $this;
166
+	}
167
+
168
+	//--------------------------------------------------------------------
169
+
170
+	/**
171
+	 * Sets who the email is coming from.
172
+	 *
173
+	 * @param $email
174
+	 * @param null $name
175
+	 * @return mixed
176
+	 */
177
+	public function from($email, $name=null)
178
+	{
179
+		if (! empty($name))
180
+		{
181
+			$this->from = [$email, $name];
182
+		}
183
+		else
184
+		{
185
+			$this->from = $email;
186
+		}
187
+
188
+		return $this;
189
+	}
190
+
191
+	//--------------------------------------------------------------------
192
+
193
+	/**
194
+	 * Sets a single additional email address to 'cc'.
195
+	 *
196
+	 * @param $email
197
+	 * @return mixed
198
+	 */
199
+	public function cc($email)
200
+	{
201
+		$this->cc = $email;
202
+
203
+		return $this;
204
+	}
205
+
206
+	//--------------------------------------------------------------------
207
+
208
+	/**
209
+	 * Sets a single email address to 'bcc' to.
210
+	 *
211
+	 * @param $email
212
+	 * @return mixed
213
+	 */
214
+	public function bcc($email)
215
+	{
216
+		$this->bcc = $email;
217
+
218
+		return $this;
219
+	}
220
+
221
+	//--------------------------------------------------------------------
222
+
223
+	/**
224
+	 * Sets the reply to address.
225
+	 *
226
+	 * @param $email
227
+	 * @return mixed
228
+	 */
229
+	public function reply_to($email, $name=null)
230
+	{
231
+		if (! empty($name))
232
+		{
233
+			$this->reply_to = [$email, $name];
234
+		}
235
+		else
236
+		{
237
+			$this->reply_to = $email;
238
+		}
239
+
240
+		return $this;
241
+	}
242
+
243
+	//--------------------------------------------------------------------
244
+
245
+	/**
246
+	 * Sets the subject line of the email.
247
+	 *
248
+	 * @param $subject
249
+	 * @return mixed
250
+	 */
251
+	public function subject($subject)
252
+	{
253
+		$this->subject = $subject;
254
+
255
+		return $this;
256
+	}
257
+
258
+	//--------------------------------------------------------------------
259
+
260
+	/**
261
+	 * Sets the HTML portion of the email address. Optional.
262
+	 *
263
+	 * @param $message
264
+	 * @return mixed
265
+	 */
266
+	public function html_message($message)
267
+	{
268
+		$this->html_message = $message;
269
+
270
+		return $this;
271
+	}
272
+
273
+	//--------------------------------------------------------------------
274
+
275
+	/**
276
+	 * Sets the text portion of the email address. Optional.
277
+	 *
278
+	 * @param $message
279
+	 * @return mixed
280
+	 */
281
+	public function text_message($message)
282
+	{
283
+		$this->text_message = $message;
284
+
285
+		return $this;
286
+	}
287
+
288
+	//--------------------------------------------------------------------
289
+
290
+	/**
291
+	 * Sets the format to send the email in. Either 'html' or 'text'.
292
+	 *
293
+	 * @param $format
294
+	 * @return mixed
295
+	 */
296
+	public function format($format)
297
+	{
298
+		$this->format = $format;
299
+
300
+		return $this;
301
+	}
302
+
303
+	//--------------------------------------------------------------------
304
+	/**
305
+	 * Resets the state to blank, ready for a new email. Useful when
306
+	 * sending emails in a loop and you need to make sure that the
307
+	 * email is reset.
308
+	 *
309
+	 * @param bool $clear_attachments
310
+	 * @return mixed
311
+	 */
312
+	public function reset($clear_attachments=true)
313
+	{
314
+		$this->to = null;
315
+		$this->from = null;
316
+		$this->reply_to = null;
317
+		$this->cc = null;
318
+		$this->bcc = null;
319
+		$this->subject = null;
320
+		$this->html_message = null;
321
+		$this->text_message = null;
322
+		$this->headers = [];
323
+
324
+		return $this;
325
+	}
326
+
327
+	//--------------------------------------------------------------------
328 328
 }
Please login to merge, or discard this patch.
myth/Mail/Queue.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,8 +34,8 @@
 block discarded – undo
34 34
 
35 35
 class Queue extends CIDbModel {
36 36
 
37
-    protected $table_name = 'mail_queue';
37
+	protected $table_name = 'mail_queue';
38 38
 
39
-    protected $set_created = false;
40
-    protected $set_modified = false;
39
+	protected $set_created = false;
40
+	protected $set_modified = false;
41 41
 }
Please login to merge, or discard this patch.
application/config/auth.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 // you might not want the extra risk associated with this cookie-based
77 77
 // solution.
78 78
 //
79
-    $config['auth.allow_remembering'] = true;
79
+	$config['auth.allow_remembering'] = true;
80 80
 
81 81
 //--------------------------------------------------------------------
82 82
 // Remember Me Salt
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 // If you are using Remember Me functionality, you should consider
87 87
 // changing this value to be unique to your site.
88 88
 //
89
-    $config['auth.salt'] = 'ASimpleSalt';
89
+	$config['auth.salt'] = 'ASimpleSalt';
90 90
 
91 91
 //--------------------------------------------------------------------
92 92
 // Remember Length
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 //      6 months - 14515200
107 107
 //      1 year   - 29030400
108 108
 //
109
-    $config['auth.remember_length'] = 1209600;
109
+	$config['auth.remember_length'] = 1209600;
110 110
 
111 111
 
112 112
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 // Throttling exponentially increases the time between allowed login
124 124
 // attempts.
125 125
 //
126
-    $config['auth.allow_throttling'] = true;
126
+	$config['auth.allow_throttling'] = true;
127 127
 
128 128
 //--------------------------------------------------------------------
129 129
 // Max Throttling Time
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 //
135 135
 // This is the number of SECONDS max.
136 136
 //
137
-    $config['auth.max_throttle_time'] = 50;
137
+	$config['auth.max_throttle_time'] = 50;
138 138
 
139 139
 //--------------------------------------------------------------------
140 140
 // Start Throttling After
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 // Throttling will start after X number of attempts. Before this,
143 143
 // the user can make attempts like normal.
144 144
 //
145
-    $config['auth.allowed_login_attempts'] = 5;
145
+	$config['auth.allowed_login_attempts'] = 5;
146 146
 
147 147
 //--------------------------------------------------------------------
148 148
 // Distributed Brute Force Checks
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 // The amount to multiply the average daily logins over the last 3 months
151 151
 // by to determine if we might be under a distributed brute force attempt.
152 152
 //
153
-    $config['auth.dbrute_multiplier'] = 3;
153
+	$config['auth.dbrute_multiplier'] = 3;
154 154
 
155 155
 //--------------------------------------------------------------------
156 156
 // Additional Suspension Time for Distributed Brute Force Attempts
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 // This is the number of SECONDS that will be added to all login
159 159
 // attempts that are being throttled.
160 160
 //
161
-    $config['auth.distributed_brute_add_time'] = 45;
161
+	$config['auth.distributed_brute_add_time'] = 45;
162 162
 
163 163
 
164 164
 //--------------------------------------------------------------------
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 //      - 30 bits of entropy = minimum for a web service with business critical applications (e.g. SAAS).
177 177
 //      - 40 bits of entropy = minimum for a bank or other financial service.
178 178
 //
179
-    $config['auth.min_password_strength'] = 18;
179
+	$config['auth.min_password_strength'] = 18;
180 180
 
181 181
 //--------------------------------------------------------------------
182 182
 // Use Dictionary
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 // dictionary to eliminate common words and their variations that would
186 186
 // be pretty simply for a hacking attempt to guess?
187 187
 //
188
-    $config['auth.use_dictionary'] = false;
188
+	$config['auth.use_dictionary'] = false;
189 189
 
190 190
 //--------------------------------------------------------------------
191 191
 // PASSWORD HASHING COST
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 //      - 'email'   The are sent an email with an activation link/code
209 209
 //      - 'manual'  Requires manual approval by a site administrator.
210 210
 //
211
-    $config['auth.activation_method'] = 'auto';
211
+	$config['auth.activation_method'] = 'auto';
212 212
 
213 213
 
214 214
 //--------------------------------------------------------------------
@@ -220,4 +220,4 @@  discard block
 block discarded – undo
220 220
 //--------------------------------------------------------------------
221 221
 // Sets the Default role id to use when creating new users.
222 222
 //
223
-    $config['auth.default_role_id'] = 3;
223
+	$config['auth.default_role_id'] = 3;
Please login to merge, or discard this patch.
application/config/events.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
 // Send New User Registration Email
52 52
 Events::on('didRegisterUser', function($data) {
53 53
 
54
-    if ($data['method'] != 'email')
55
-    {
56
-        return true;
57
-    }
54
+	if ($data['method'] != 'email')
55
+	{
56
+		return true;
57
+	}
58 58
 
59
-    return Mail::deliver('UserMailer:didRegister', [$data]);
59
+	return Mail::deliver('UserMailer:didRegister', [$data]);
60 60
 
61 61
 }, EVENTS_PRIORITY_NORMAL);
62 62
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 // Send Forgotten Password email
66 66
 Events::on('didRemindUser', function($user, $token) {
67 67
 
68
-    return Mail::deliver('UserMailer:remindUser', [$user, $token]);
68
+	return Mail::deliver('UserMailer:remindUser', [$user, $token]);
69 69
 
70 70
 }, EVENTS_PRIORITY_NORMAL);
71 71
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 // Send Reset Password notice
75 75
 Events::on('didResetPassword', function($user) {
76 76
 
77
-    return Mail::deliver('UserMailer:resetPassword', [$user]);
77
+	return Mail::deliver('UserMailer:resetPassword', [$user]);
78 78
 
79 79
 }, EVENTS_PRIORITY_NORMAL);
80 80
 
Please login to merge, or discard this patch.
application/database/migrations/20160111121139_UpdateLoginAttemptsTable.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -10,57 +10,57 @@
 block discarded – undo
10 10
  */
11 11
 class Migration_UpdateLoginAttemmptsTable extends CI_Migration {
12 12
 
13
-    public function up()
14
-    {
15
-        $fields = array(
16
-            'type' => array(
17
-                'type'       => 'varchar',
18
-                'constraint' => 64,
19
-                'null'       => false,
20
-                'default'    => 'app',
21
-                'after'      => 'id'
22
-            ),
23
-            'ip_address' => array(
24
-                'type'       => 'varchar',
25
-                'constraint' => 255,
26
-                'null'       => true,
27
-                'after'      => 'type'
28
-            ),
29
-            'user_id' => array(
30
-                'type'       => 'int',
31
-                'constraint' => 11,
32
-                'unsigned'   => true,
33
-                'null'       => true,
34
-                'after'      => 'ip_address'
35
-            )
36
-        );
13
+	public function up()
14
+	{
15
+		$fields = array(
16
+			'type' => array(
17
+				'type'       => 'varchar',
18
+				'constraint' => 64,
19
+				'null'       => false,
20
+				'default'    => 'app',
21
+				'after'      => 'id'
22
+			),
23
+			'ip_address' => array(
24
+				'type'       => 'varchar',
25
+				'constraint' => 255,
26
+				'null'       => true,
27
+				'after'      => 'type'
28
+			),
29
+			'user_id' => array(
30
+				'type'       => 'int',
31
+				'constraint' => 11,
32
+				'unsigned'   => true,
33
+				'null'       => true,
34
+				'after'      => 'ip_address'
35
+			)
36
+		);
37 37
 
38
-        $this->dbforge->add_column('auth_login_attempts', $fields);
38
+		$this->dbforge->add_column('auth_login_attempts', $fields);
39 39
 
40
-        $this->db->query('ALTER TABLE `auth_login_attempts` ADD KEY (`user_id`)');
40
+		$this->db->query('ALTER TABLE `auth_login_attempts` ADD KEY (`user_id`)');
41 41
 
42
-        $this->dbforge->drop_column('auth_login_attempts', 'email');
43
-    }
42
+		$this->dbforge->drop_column('auth_login_attempts', 'email');
43
+	}
44 44
 
45
-    //--------------------------------------------------------------------
45
+	//--------------------------------------------------------------------
46 46
 
47
-    public function down()
48
-    {
49
-        $this->dbforge->drop_column('auth_login_attempts', 'type');
50
-        $this->dbforge->drop_column('auth_login_attempts', 'ip_address');
51
-        $this->dbforge->drop_column('auth_login_attempts', 'user_id');
47
+	public function down()
48
+	{
49
+		$this->dbforge->drop_column('auth_login_attempts', 'type');
50
+		$this->dbforge->drop_column('auth_login_attempts', 'ip_address');
51
+		$this->dbforge->drop_column('auth_login_attempts', 'user_id');
52 52
 
53
-        $column = ['email' => [
54
-            'type'       => 'varchar',
55
-            'constraint' => 255,
56
-            'after'      => 'id'
57
-        ]];
53
+		$column = ['email' => [
54
+			'type'       => 'varchar',
55
+			'constraint' => 255,
56
+			'after'      => 'id'
57
+		]];
58 58
 
59
-        $this->dbforge->add_column('auth_login_attempts', $column);
59
+		$this->dbforge->add_column('auth_login_attempts', $column);
60 60
 
61
-        $this->db->query('ALTER TABLE `auth_login_attempts` ADD KEY (`email`)');
62
-    }
61
+		$this->db->query('ALTER TABLE `auth_login_attempts` ADD KEY (`email`)');
62
+	}
63 63
 
64
-    //--------------------------------------------------------------------
64
+	//--------------------------------------------------------------------
65 65
 
66 66
 }
67 67
\ No newline at end of file
Please login to merge, or discard this patch.