Skip to content

Instantly share code, notes, and snippets.

/*
* If this doenst work then try the below
*/
echo $this->Form->input('Applicant.date_of_birth', array(
'type' => 'date',
'dateFormat' => 'DMY',
'minYear' => date('Y') - 110,
'maxYear' => date('Y')- 18,
)
);
$dob = explode('-', $applicationData['Applicant']['date_of_birth']);
$dobDayArray = explode(' ', $dob[2]);
$dobDay = $dobDayArray[0];
$dobMonth = $dob[1];
$dobYear = $dob[0];
echo $this->Form->input('Applicant.date_of_birth', array(
'type' => 'date',
'dateFormat' => 'DMY',
//current find results look like this
array
0 =>
array
0 =>
array
'year' => string '2012' (length=4)
'month' => string 'May' (length=3)
'count' => string '5' (length=1)
1 =>
//set error handling up
libxml_use_internal_errors(true);
//path to the validation file
$validationSchema = dirname(__FILE__).DS.'docs'.DS.'tff'.DS.'XMLImport.xsd';
//set up a new document to work with
$doc = new DOMDocument();
$doc->formatOutput = true;
$doc->preserveWhiteSpace = false;
class User extends AppModel {
public $name = 'User';
public $belongsTo = array(
'FriendOne' => array(
'className' => 'Friend',
'foreignKey' => 'friend_1_id',
),
'FriendTwo' => array(
'className' => 'Friend',
'foreignKey' => 'friend_2_id',
@veganista
veganista / UsersControllerTest.php
Created May 4, 2012 20:37
CakePHP Controller Tetsing
<?php
/* Users Test cases generated on: 2012-03-13 19:59:39 : 1331668779*/
App::uses('UsersController', 'Controller');
/**
* TestUsersController *
*/
class TestUsersController extends UsersController {
/**
* Auto render
@veganista
veganista / check.sql
Created July 21, 2011 11:13
Sql For checking if wordpress is infected with some malicious links
SELECT
*
FROM
wp_posts
WHERE
post_content LIKE '%basicpills.com%'
OR post_content LIKE '%getrxpills.com%'
OR post_content LIKE '%antibiotics-shop.com%'
OR post_content LIKE '%generic-ed-pharmacy.com%'
OR post_content LIKE '%rx-prices.com%'
<a href="http://(basicpills.com|getrxpills.com|antibiotics-shop.com|generic-ed-pharmacy.com|rx-prices.com|hotspill.com).+?(</a>)
@veganista
veganista / snippet.php
Created June 16, 2011 13:16
Loading another page's content in wordpress
<?php
$page = get_page_by_path('page-parts/testimonials-intro');
//echo do_shortcode($page->post_content);
echo do_shortcode(wpautop($page->post_content)); // this will add the paragaphs automatically this can be a bit more useful than the above
?>
@veganista
veganista / gist:1016987
Created June 9, 2011 15:31
Applications view
<div class="applicants form">
<?php echo $this->Form->create('PrimaryApplicant', array('url' => array('controller' => 'applications', 'personal')));?>
<?php echo $this->element('forms/personal'); ?>
<?php echo $this->Form->submit('Continue', array('div' => false)); ?>
<?php echo $this->Form->submit('Cancel', array('name' => 'Cancel', 'div' => false, 'class' => 'cancel')); ?>
<?php echo $this->Form->end();?>
</div>