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 | |
/* | |
* Extended Doctrine Query class providing a few additional functions | |
* for wrapping your where clauses more efficiently | |
*/ | |
class Doctrine_Query_Extra extends Doctrine_Query | |
{ | |
protected $_startClause = false; | |
/** |
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 debug() | |
{ | |
$sql = $this->getSqlQuery(); | |
$params = $this->getParams(); | |
foreach ($params as $key => $type) | |
{ | |
foreach ($type as $param) | |
{ | |
$sql = preg_replace('/\?/', is_int($param) ? $param : "'$param'", $sql, 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
<?php | |
/** | |
* sfValidatorCCExpirationDate validates the expiration date for a credit card. | |
* | |
* @author Brent Shaffer <[email protected]> | |
*/ | |
class sfValidatorCCExpirationDate extends sfValidatorDate | |
{ |
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 | |
/** | |
* sfProgressBar | |
* | |
* Draw a nifty progress bar for command-line tasks | |
* | |
* USAGE: | |
* // Create Progress Bar instance, pass number of increments | |
* $progressBar = new sfProgressBar($eventDispatcher); | |
* $progressBar->start($numItems); |
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 BaseForm extends sfFormSymfony | |
{ | |
public function makeReadOnly($field = null) | |
{ | |
if ($field instanceof sfWidget) | |
{ | |
$field->setAttribute('disabled', 'disabled'); |
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 | |
/** | |
* options: | |
* * widget: The widget to trigger the ajax event | |
* * update: A JQuery selector for the DOM element to update with the response | |
* * url: A url or symfony route to call to update the element above. The selected value of the widget is automatically appended to this url (ex: '@objects?object_id=' will end up calling '@objects?object_id=2' if "2" is the value selected in your widget) | |
* * on_empty: Text to update the "update" DOM element with if the widget value is empty | |
* * update_on_load: whether to call the AJAX function on page load | |
*/ |
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 | |
function duration($seconds, $max_periods = 3) | |
{ | |
$periods = array("year" => 31536000, "month" => 2419200, "week" => 604800, "day" => 86400, "hour" => 3600, "minute" => 60, "second" => 1); | |
$i = 1; | |
foreach ( $periods as $period => $period_seconds ) | |
{ | |
$period_duration = floor($seconds / $period_seconds); | |
$seconds = $seconds % $period_seconds; |
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 A implements ArrayAccess, Iterator, Countable | |
{ | |
public function __construct($arr) { | |
$this->arr = is_array($arr) ? $arr : func_get_args(); | |
} | |
public function __toString() { | |
return print_r($this->arr, true); | |
} |
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
# The first argument is the application (default: frontend) | |
export app=$1 | |
if [ ! -n "$app" ]; then | |
export app="frontend" | |
fi | |
# The second argument is the environment. (default: dev) | |
export env=$2 |
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 sfFactory | |
{ | |
protected static | |
$lastRandom = array(), | |
$lastIncrement = array(); |
OlderNewer