Last active
August 29, 2015 14:14
-
-
Save gabriel-seb/3814d8092e58b427c5c5 to your computer and use it in GitHub Desktop.
Codeigniter basic settings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti* | |
| RewriteEngine on | |
| RewriteCond $1 !^(index\.php|resources|robots\.txt) | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteRule ^(.*)$ index.php/$1 [L,QSA] | |
| #RewriteCond %{HTTP_REFERER} !^$ | |
| #RewriteCond %{HTTP_REFERER} !^/.*$ [NC] | |
| #RewriteCond %{HTTP_REFERER} !^$ [NC] | |
| #RewriteCond %{HTTP_REFERER} !^.*$ [NC] | |
| #RewriteCond %{HTTP_REFERER} !^$ [NC] | |
| #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ path/to/default/image.png [R,NC] | |
| php_value allow_url_fopen On | |
| #DESABILITAR EM AMBIENTE DE PRODUCAO | |
| #php_flag display_startup_errors on | |
| #php_flag display_errors on | |
| #php_flag html_errors on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if (!defined('BASEPATH')) | |
| exit('No direct script access allowed'); | |
| class Controller_Name extends CI_Controller { | |
| public function __construct() { | |
| parent::__construct(); | |
| } | |
| public function index() { | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Model_Name extends CI_Model { | |
| public function __construct() { | |
| parent::__construct(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Dump helper. Functions to dump variables to the screen, in a nicley formatted manner. | |
| * @author Joost van Veen | |
| * @version 1.0 | |
| */ | |
| if ( ! function_exists('dump')) { | |
| function dump($var, $label = 'Dump', $echo = TRUE) | |
| { | |
| // Store dump in variable | |
| ob_start(); | |
| var_dump($var); | |
| $output = ob_get_clean(); | |
| // Add formatting | |
| $output = preg_replace("/\]\=\>\n(\s+)/m", "] => ", $output); | |
| $output = '<pre style="background: #FFFEEF; color: #000; border: 1px dotted #000; padding: 10px; margin: 10px 0; text-align: left;">' . $label . ' => ' . $output . '</pre>'; | |
| // Output | |
| if ($echo == TRUE) { | |
| echo $output; | |
| } else { | |
| return $output; | |
| } | |
| } | |
| } | |
| /** | |
| * Executa o dump e mata o processamento | |
| */ | |
| if ( ! function_exists('dump_exit')) { | |
| function dump_exit($var, $label = 'Dump', $echo = TRUE) | |
| { | |
| dump($var, $label, $echo); | |
| exit; | |
| } | |
| } | |
| /** | |
| * Alias para dump_exit | |
| */ | |
| if ( ! function_exists('dd')) { | |
| function dd($var, $label = 'Dump', $echo = TRUE) | |
| { | |
| dump_exit($var, $label, $echo); | |
| } | |
| } | |
| /** | |
| * Alias para dump | |
| */ | |
| if ( ! function_exists('d')) { | |
| function d($var, $label = 'Dump', $echo = TRUE) | |
| { | |
| dump($var, $label, $echo); | |
| } | |
| } | |
| /** | |
| * Dump com a última query executada | |
| */ | |
| if ( ! function_exists('dl')) { | |
| function dl() | |
| { | |
| $ci = & get_instance(); | |
| dump($ci->db->last_query()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment