@@ -1,34 +1,34 @@ discard block |
||
| 1 | 1 | <?php namespace Myth\Api\Server; |
| 2 | 2 | /** |
| 3 | - * Sprint |
|
| 4 | - * |
|
| 5 | - * A set of power tools to enhance the CodeIgniter framework and provide consistent workflow. |
|
| 6 | - * |
|
| 7 | - * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
| 8 | - * of this software and associated documentation files (the "Software"), to deal |
|
| 9 | - * in the Software without restriction, including without limitation the rights |
|
| 10 | - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
| 11 | - * copies of the Software, and to permit persons to whom the Software is |
|
| 12 | - * furnished to do so, subject to the following conditions: |
|
| 13 | - * |
|
| 14 | - * The above copyright notice and this permission notice shall be included in |
|
| 15 | - * all copies or substantial portions of the Software. |
|
| 16 | - * |
|
| 17 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
| 18 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
| 19 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
| 20 | - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
| 21 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
| 22 | - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
| 23 | - * THE SOFTWARE. |
|
| 24 | - * |
|
| 25 | - * @package Sprint |
|
| 26 | - * @author Lonnie Ezell |
|
| 27 | - * @copyright Copyright 2014-2015, New Myth Media, LLC (http://newmythmedia.com) |
|
| 28 | - * @license http://opensource.org/licenses/MIT (MIT) |
|
| 29 | - * @link http://sprintphp.com |
|
| 30 | - * @since Version 1.0 |
|
| 31 | - */ |
|
| 3 | + * Sprint |
|
| 4 | + * |
|
| 5 | + * A set of power tools to enhance the CodeIgniter framework and provide consistent workflow. |
|
| 6 | + * |
|
| 7 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
| 8 | + * of this software and associated documentation files (the "Software"), to deal |
|
| 9 | + * in the Software without restriction, including without limitation the rights |
|
| 10 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
| 11 | + * copies of the Software, and to permit persons to whom the Software is |
|
| 12 | + * furnished to do so, subject to the following conditions: |
|
| 13 | + * |
|
| 14 | + * The above copyright notice and this permission notice shall be included in |
|
| 15 | + * all copies or substantial portions of the Software. |
|
| 16 | + * |
|
| 17 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
| 18 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
| 19 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
| 20 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
| 21 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
| 22 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
| 23 | + * THE SOFTWARE. |
|
| 24 | + * |
|
| 25 | + * @package Sprint |
|
| 26 | + * @author Lonnie Ezell |
|
| 27 | + * @copyright Copyright 2014-2015, New Myth Media, LLC (http://newmythmedia.com) |
|
| 28 | + * @license http://opensource.org/licenses/MIT (MIT) |
|
| 29 | + * @link http://sprintphp.com |
|
| 30 | + * @since Version 1.0 |
|
| 31 | + */ |
|
| 32 | 32 | |
| 33 | 33 | use Myth\Auth\AuthTrait; |
| 34 | 34 | use Myth\Controllers\BaseController; |
@@ -141,8 +141,8 @@ discard block |
||
| 141 | 141 | * @var array |
| 142 | 142 | */ |
| 143 | 143 | protected $codes = array( |
| 144 | - 'created' => 201, |
|
| 145 | - 'deleted' => 200, |
|
| 144 | + 'created' => 201, |
|
| 145 | + 'deleted' => 200, |
|
| 146 | 146 | 'invalid_request' => 400, |
| 147 | 147 | 'unsupported_response_type' => 400, |
| 148 | 148 | 'invalid_scope' => 400, |
@@ -166,32 +166,32 @@ discard block |
||
| 166 | 166 | 'not_implemented' => 501 |
| 167 | 167 | ); |
| 168 | 168 | |
| 169 | - /** |
|
| 170 | - * Convert common browser-sent langauge |
|
| 171 | - * strings to a folder name in the languages folder |
|
| 172 | - * that we want to use. |
|
| 173 | - * |
|
| 174 | - * Primarily used for converting to english when |
|
| 175 | - * viewing the API in a browser. |
|
| 176 | - * |
|
| 177 | - * @var array |
|
| 178 | - */ |
|
| 179 | - protected $lang_map = [ |
|
| 180 | - 'en-us' => 'english', |
|
| 181 | - 'en' => 'english', |
|
| 182 | - 'eng' => 'english', |
|
| 183 | - 'en-au' => 'english', |
|
| 184 | - 'en-nz' => 'english', |
|
| 185 | - 'en-za' => 'english', |
|
| 186 | - 'en-tt' => 'english', |
|
| 187 | - 'en-gb' => 'english', |
|
| 188 | - 'en-ca' => 'english', |
|
| 189 | - 'en-ie' => 'english', |
|
| 190 | - 'en-jm' => 'english', |
|
| 191 | - 'en-bz' => 'english', |
|
| 192 | - ]; |
|
| 193 | - |
|
| 194 | - /** |
|
| 169 | + /** |
|
| 170 | + * Convert common browser-sent langauge |
|
| 171 | + * strings to a folder name in the languages folder |
|
| 172 | + * that we want to use. |
|
| 173 | + * |
|
| 174 | + * Primarily used for converting to english when |
|
| 175 | + * viewing the API in a browser. |
|
| 176 | + * |
|
| 177 | + * @var array |
|
| 178 | + */ |
|
| 179 | + protected $lang_map = [ |
|
| 180 | + 'en-us' => 'english', |
|
| 181 | + 'en' => 'english', |
|
| 182 | + 'eng' => 'english', |
|
| 183 | + 'en-au' => 'english', |
|
| 184 | + 'en-nz' => 'english', |
|
| 185 | + 'en-za' => 'english', |
|
| 186 | + 'en-tt' => 'english', |
|
| 187 | + 'en-gb' => 'english', |
|
| 188 | + 'en-ca' => 'english', |
|
| 189 | + 'en-ie' => 'english', |
|
| 190 | + 'en-jm' => 'english', |
|
| 191 | + 'en-bz' => 'english', |
|
| 192 | + ]; |
|
| 193 | + |
|
| 194 | + /** |
|
| 195 | 195 | * If you wish to override the default authentication |
| 196 | 196 | * library used for authentication, set this to the |
| 197 | 197 | * fully namespaced class name. |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | */ |
| 545 | 545 | public function grabVar($name) |
| 546 | 546 | { |
| 547 | - return array_key_exists($name, $this->vars) ? $this->vars[$name] : false; |
|
| 547 | + return array_key_exists($name, $this->vars) ? $this->vars[$name] : false; |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | //-------------------------------------------------------------------- |
@@ -757,12 +757,12 @@ discard block |
||
| 757 | 757 | // Remove weight and strip space |
| 758 | 758 | list($lang) = explode(';', $lang); |
| 759 | 759 | |
| 760 | - $lang = strtolower(trim($lang)); |
|
| 760 | + $lang = strtolower(trim($lang)); |
|
| 761 | 761 | |
| 762 | - if (array_key_exists($lang, $this->lang_map)) |
|
| 763 | - { |
|
| 764 | - $lang = $this->lang_map[$lang]; |
|
| 765 | - } |
|
| 762 | + if (array_key_exists($lang, $this->lang_map)) |
|
| 763 | + { |
|
| 764 | + $lang = $this->lang_map[$lang]; |
|
| 765 | + } |
|
| 766 | 766 | |
| 767 | 767 | $return_langs[] = $lang; |
| 768 | 768 | } |
@@ -782,10 +782,10 @@ discard block |
||
| 782 | 782 | */ |
| 783 | 783 | public function detectFields() |
| 784 | 784 | { |
| 785 | - if (! array_key_exists('fields', $_GET)) |
|
| 786 | - { |
|
| 787 | - return; |
|
| 788 | - } |
|
| 785 | + if (! array_key_exists('fields', $_GET)) |
|
| 786 | + { |
|
| 787 | + return; |
|
| 788 | + } |
|
| 789 | 789 | |
| 790 | 790 | $fields = explode(',', $_GET['fields']); |
| 791 | 791 | |
@@ -814,7 +814,7 @@ discard block |
||
| 814 | 814 | return; |
| 815 | 815 | } |
| 816 | 816 | |
| 817 | - $model = new LogModel(); |
|
| 817 | + $model = new LogModel(); |
|
| 818 | 818 | |
| 819 | 819 | $data = [ |
| 820 | 820 | 'duration' => microtime(true) - $this->start_time, |