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 | |
//to have multiple sidebars in wordpress: | |
function mytheme_widgets_init() { | |
register_sidebar(array( | |
'name' => __( 'sidebar1', 'mytheme' ), | |
'id' => 'sidebar1-area', | |
'description' => __( 'The first sidebar area', 'mytheme' ), | |
'before_widget' => '', | |
'after_widget' => '', | |
'before_title' => '<h2>', |
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 | |
/** | |
* return the first element of the array | |
* @note If you are in a foreach loop, this will not reset the pointer to the first element of the array like calling reset($myarray) would | |
* @see reset | |
* @param array $array The array | |
* @return mixed the first element of the array | |
*/ | |
function array_first(array $array){ |
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 | |
$s = new smushit(); | |
$smushed = $s->compress('http://thechronicleherald.ca/sites/default/files/imagecache/story_thumb/stories/photos/11-18-10_cl111710auditor2_1.jpg'); | |
print_r($smushed); |
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 | |
abstract class Singleton { | |
private function __construct() { | |
// empty | |
} | |
public static function getInstance() { | |
static $instance = null; |
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 | |
//make sure that page is an int, and at least 1... | |
$data['page'] = (isset($_GET['page'])) ? (int) $_GET['page'] : 1; | |
//make sure that page is at least 1 | |
if ($data['page'] <= 0) { | |
$data['page'] = 1; | |
} | |
//remove one from page for the query | |
$offset = $data['page'] - 1; |
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
# This patch file was generated by NetBeans IDE | |
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder. | |
# It uses platform neutral UTF-8 encoding. | |
# Above lines and this line are ignored by the patching process. | |
--- fileuploader.js | |
+++ fileuploader.js | |
@@ -1195,7 +1195,9 @@ | |
// build query string | |
params = params || {}; | |
params['qqfile'] = name; |
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
<p> | |
<ul> | |
<font class="header-md">HEADER</font> | |
<ul> | |
<table width="500"> | |
<tr> | |
<td> | |
<p> | |
<a href="somewhere" class="blue-header-sm">Header</a>text<br> | |
<a href="somewhere" class="blue-header-sm">Header</a>text<br> |
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 previous_business_day($timestamp, $holidays = array()) { | |
do { | |
$timestamp = $timestamp - 86400; | |
$day_of_week = date('l', $timestamp); | |
$due = date('Y-m-d', $timestamp); | |
} while (in_array($day_of_week, array('Sunday', 'Saturday')) || in_array($due, $holidays)); | |
$checkdate = date('l Y-m-d', $timestamp); | |
return $checkdate; | |
} |
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 | |
/** | |
* Get the schema definition of a table, or the whole database schema. | |
* | |
* | |
* @param $table The name of the table. If not given, the schema of all tables is returned. | |
* @param $rebuild If true, the schema will be rebuilt instead of retrieved from the cache. | |
*/ | |
function get_schema($table = NULL, $rebuild = FALSE) { | |
static $schema = array(); |