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
/** | |
* Is Local | |
* | |
* Checks if the current site is hosted locally or not. | |
* | |
* @static | |
* @return boolean whether or not the site is hosted locally | |
*/ | |
public static function isLocal() | |
{ |
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
var userAgent = navigator.userAgent.toLowerCase(); | |
var isIE = userAgent.indexOf('msie') != -1; | |
var isIphone = userAgent.indexOf('iphone') != -1 || userAgent.indexOf('ipad') != -1 | |
var isAndroid = userAgent.indexOf('android') != -1; |
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
public function __set($name, $value) | |
{ | |
if (isset($this->$name)) | |
{ | |
trigger_error('Cannot set variable after declaration', E_USER_ERROR); | |
return false; | |
} | |
else | |
{ | |
$this->$name = $value; |
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 | |
require_once 'pickles.php'; | |
new CustomController(); | |
?> |
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 | |
// Empty model | |
$model = new Model(); | |
// Pull by ID | |
$model = new Model(123); | |
// Pull by condition(s) | |
$model = new Model(array('conditions' => array('id' => 123))); |
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 | |
// Pulls the records with ID 1-10 | |
$city = new City(array('conditions' => array('id BETWEEN' => array(1, 10)))); | |
// Loops through the records | |
while ($city->record) | |
{ | |
// Sets the active field to 0 for the current record | |
$city->record['active'] = 0; |
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 search extends Module | |
{ | |
public function __default() | |
{ | |
// Pulls all the active cities | |
$city = new City('list', array('fields' => 'slug, name', 'conditions' => array('active' => '1'))); | |
$cities = array_merge(array(null => 'select your city'), $city->records); |
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 search extends Module | |
{ | |
public function __default() | |
{ | |
// Pulls all the active cities | |
$city = new City('list', array('fields' => 'slug, name', 'conditions' => array('active' => '1'))); | |
$cities = array_merge(array(null => 'select your city'), $city->records); |
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 | |
/** | |
* Rounds a float with direction. | |
* | |
* Since round() doesn't support an optional rounding mode until 5.3 I | |
* had to roll my own function to do so in the meantime. | |
* | |
* Note: Does not support negative precision. | |
* |
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
[DATABASE] | |
default = DBMS | |
[DBMS] | |
driver = mysql | |
hostname = localhost | |
username = username | |
password = password | |
database = database |
OlderNewer