Skip to content

Instantly share code, notes, and snippets.

View brettneedshelp
function force_of_gravity() { ?>
if (get_post_meta(get_the_ID(), "image", true)) || (get_post_meta(get_the_ID(), "text", true)) { ?>
<b>Submitted by: </b><?php echo get_post_meta(get_the_ID(), "name", true) ?> in <?php echo get_post_meta(get_the_ID(), "location", true); ?>
<?php endif; ?>
<?php
}
add_action('thesis_hook_before_content', 'force_of_gravity');
View brettneedshelp
function force_of_gravity() {
if (get_post_meta(get_the_ID(), "image", true)) || (get_post_meta(get_the_ID(), "text", true)): ?>
<b>Submitted by: </b><?php echo get_post_meta(get_the_ID(), "name", true) ?> in <?php echo get_post_meta(get_the_ID(), "location", true); ?>
<?php endif; ?>
<?php
}
add_action('thesis_hook_before_content', 'force_of_gravity');
View Magento gitignore File
/media/*
/var/*
/app/etc/local.xml
/app/etc/use_cache.ser
/nbproject/*
/downloader/pearlib/cache/*
/downloader/pearlib/download/*
/downloader/pearlib/temp/*
/.htaccess
.svn
@shanestillwell
shanestillwell / time.html
Created Oct 29, 2010
Select HTML Time (15 minute increments)
View time.html
<select name="time" id="time">
<option value="5:00 AM">5:00 AM</option>
<option value="5:15 AM">5:15 AM</option>
<option value="5:30 AM">5:30 AM</option>
<option value="5:45 AM">5:45 AM</option>
<option value="6:00 AM">6:00 AM</option>
<option value="6:15 AM">6:15 AM</option>
<option value="6:30 AM">6:30 AM</option>
<option value="6:45 AM">6:45 AM</option>
@shanestillwell
shanestillwell / time.php
Created Oct 29, 2010
PHP array of time in 15 minute increments
View time.php
$time = array(
"5:00 AM" => "5:00 AM",
"5:15 AM" => "5:15 AM",
"5:30 AM" => "5:30 AM",
"5:45 AM" => "5:45 AM",
"6:00 AM" => "6:00 AM",
"6:15 AM" => "6:15 AM",
"6:30 AM" => "6:30 AM",
"6:45 AM" => "6:45 AM",
@shanestillwell
shanestillwell / provinces.xml
Created Oct 29, 2010
Provinces in XML format
View provinces.xml
<?xml version="1.0" encoding="UTF-8"?>
<countries>
<AD>
<region>Andorra</region>
<region>Parròquia de Canillo</region>
<region>Parròquia d'Encamp</region>
<region>Parròquia de la Massana</region>
<region>Parròquia d'Ordino</region>
<region>Parròquia de Sant Julià de Lòria</region>
<region>Parròquia d'Andorra la Vella</region>
@shanestillwell
shanestillwell / recursive.php
Created Dec 27, 2010
Recursive Array Search
View recursive.php
// Recursivly search through an array, if the key is found, then return TRUE
private function _recursiveArraySearch($haystack, $needle, $index = null)
{
$aIt = new RecursiveArrayIterator($haystack);
$it = new RecursiveIteratorIterator($aIt);
while($it->valid())
{
if (((isset($index) AND ($it->key() == $index)) OR (!isset($index))) AND ($it->current() == $needle)) {
//return $aIt->key();
@shanestillwell
shanestillwell / test_zend_auth_login
Created Dec 27, 2010
Create an instance of Zend_Auth with the user_id you want.
View test_zend_auth_login
protected function _logIn($id = 4)
{
$user = Doctrine_Core::getTable('Default_Model_User')->find(4);
Zend_Auth::getInstance()->getStorage()->write($user);
}
@shanestillwell
shanestillwell / BootstrapFile.php
Created Jan 3, 2011
Edit the Bootstrap for the Zend Tool to pull the APPLICATION_ENV from the shell.
View BootstrapFile.php
--- BootstrapFile.php (saved version)
+++ (current document)
@@ -106,9 +106,11 @@
define('APPLICATION_PATH', $this->_applicationDirectory->getPath());
$applicationOptions = array();
$applicationOptions['config'] = $this->_applicationConfigFile->getPath();
+
+ $env = getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development';
$this->_applicationInstance = new Zend_Application(
@shanestillwell
shanestillwell / toHeirarchy.php
Created Jan 4, 2011
Converts a NestedSet array into a mutli-dimensional array (Hydrates the flat array returned by Doctrine)
View toHeirarchy.php
/**
* original http://groups.google.com/group/doctrine-user/browse_thread/thread/8674c5f27de54e0c
*/
public function toHierarchy($collection)
{
// Trees mapped
$trees = array();
$l = 0;
You can’t perform that action at this time.