Skip to content

Instantly share code, notes, and snippets.

View klhall1987's full-sized avatar

Kenny Hall klhall1987

View GitHub Profile
<?php if ( ! defined( 'ABSPATH' ) ) exit;
return apply_filters( 'ninja-forms-unique-field-settings', array(
/*
* Checkbox Default Value
*/
'checkbox_default_value' => array(
'name' => 'default_value',
'type' => 'select',
@klhall1987
klhall1987 / Example-is-int.php
Last active November 11, 2015 16:34
is_int example
<?php
$numbers = array(
12,
1551,
'21',
'5115',
'I am a string',
);
@klhall1987
klhall1987 / Example-is-numeric.php
Last active November 11, 2015 16:35
is_numeric
<?php
$numbers = array(
12,
1551,
'21',
'5115',
'I am a string',
);
@klhall1987
klhall1987 / deleteTransient.php
Created October 29, 2015 18:32
Remove Transient
<?php
//will delete the transient named my_cached_data
delete_transient( 'my_cached_data' );
@klhall1987
klhall1987 / getTransient
Created October 29, 2015 18:25
Getting Transient
<?php
//Set transient that will be cached for one hour.
set_transient('my_cached_data' , $my_object , 60*60);
get_transient( 'my_cached_data' );
@klhall1987
klhall1987 / setTransient.php
Created October 29, 2015 18:24
Setting Transients
<?php
get_transient( $transient );
$transient //is the unique string we created earlier.
@klhall1987
klhall1987 / PhoneMethodChaining.php
Last active October 29, 2015 13:03
Method Chaining with phones
<?php
class Phone
{
//Creating private properties
private $_type;
private $_os;
public function setType( $type )
@klhall1987
klhall1987 / set_transient.php
Created October 27, 2015 13:34
Setting Transient
set_transient( $transient , $value , $expiration);
$transient //This is a string that will be used as a unique identifier for your cached data. It must be less than 45 characters.
$value //This will be an array, object, or variable you wish to cache.
$expiration //An integer of the maximum of seconds to keep the data before expiring.
@klhall1987
klhall1987 / MethodChaining.php
Last active October 27, 2015 14:33
Method Chaining
<?php
//Example of single class method chaining
class stringExample
{
private $str;
function __construct()
{
$this->str = '';
//Reassign jQuery call to a variable.
var $j = jQuery;
//Then use the variable as a wrapper for the jQuery call.
$j(#somefunction);