This file contains 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
#allows a single uri through the .htaccess password protection | |
SetEnvIf Request_URI "/testing_uri$" test_uri | |
#allows everything if its on a certain host | |
SetEnvIf HOST "^testing.yoursite.com" testing_url | |
SetEnvIf HOST "^yoursite.com" live_url | |
Order Deny,Allow | |
AuthName "Restricted Area" | |
AuthType Basic |
This file contains 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
function _is_ajax() | |
{ | |
return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')); | |
} |
This file contains 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 MY_Log extends CI_Log | |
{ | |
var $mongo; | |
function __construct() | |
{ | |
$this->mongo = new Mongo("localhost"); |
This file contains 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 Blog_model extends Model | |
{ | |
function __construct() | |
{ | |
parent::Model(); | |
} |
This file contains 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
function insert_blog_post($data) | |
{ | |
$this->db->insert('blog_posts', $data); | |
return $this->db->insert_id(); | |
} |
This file contains 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
function get_blog_post($where) | |
{ | |
$this->db->where($where); | |
$query = $this->db->get(‘blog_posts’, 1); | |
if($query->num_rows() == 1) | |
{ | |
return $query->row_array(); | |
} | |
return FALSE; | |
} |
This file contains 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
function update_blog_posts($where, $data) | |
{ | |
$this->db->where($where); | |
$this->db->update(‘blog_posts’, $data); | |
return $this->db->affected_rows(); | |
} |
This file contains 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
function delete_blog_posts($where) | |
{ | |
$this->db->where($where); | |
$this->db->delete(‘blog_posts’); | |
return $this->db->affected_rows(); | |
} |
This file contains 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
function ordinal($n) | |
{ | |
$ln = (int) substr($n, -1); | |
$sln = (int) substr($n, -2); | |
$r = array('st','nd','rd'); | |
$es = (($sln < 11 || $sln > 19) && $ln > 0 && $ln < 4); | |
return $n . ($es ? $r[$ln - 1] : 'th'); | |
} |
This file contains 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 | |
function array_element($array, $key, $default = false) | |
{ | |
$key = explode('.', $key); | |
if(count($key) > 1) | |
{ | |
if ( ! is_array($array) || ! array_key_exists($key[0], $array)) | |
{ | |
return $default; |
OlderNewer