Skip to content

Instantly share code, notes, and snippets.

View kjohnson's full-sized avatar

Kyle B. Johnson kjohnson

View GitHub Profile
@kjohnson
kjohnson / pdf.php
Created March 12, 2015 14:48
Repeatable Logo for Ninja Forms PDF Submissions
<?php
/**
* PDF Submission with repeatable Logo
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
?>
<html>
<head>
@kjohnson
kjohnson / attachment.php
Created March 12, 2015 17:30
Attach Email to Ninja Forms Notifications
public function my_custom_add_attachment( $attachments, $id ) {
global $ninja_forms_processing;
// Get our submission ID
$sub_id = $ninja_forms_processing->get_form_setting( 'sub_id' );
// convert submission id to array
$sub_ids = array( $sub_id );
// File to Attach
@kjohnson
kjohnson / current-date-short-code.php
Created March 13, 2015 15:36
Current Date Short Code
<?php
/*
* Plugin Name: Current Date Short Code
*/
function current_date_short_code_func($args) {
if ( ! isset( $args['format'] ) )
{
$args['format'] = 'm/d/Y';
<?php
/**
* Plugin Name: Ninja Forms JS Debug
*/
define("NINJA_FORMS_JS_DEBUG", true);
a:4:{s:4:"data";a:7:{s:12:"date_updated";s:19:"2015-03-17 19:56:34";s:14:"clear_complete";s:1:"1";s:13:"hide_complete";s:1:"1";s:10:"show_title";s:1:"0";s:6:"status";s:0:"";s:10:"form_title";s:21:"Auto-Total Issue Test";s:8:"last_sub";s:1:"2";}s:2:"id";N;s:5:"field";a:9:{i:0;a:7:{s:2:"id";s:4:"2769";s:7:"form_id";s:3:"249";s:4:"type";s:7:"_number";s:5:"order";s:1:"0";s:4:"data";a:17:{s:5:"label";s:6:"Number";s:15:"input_limit_msg";s:17:"character(s) left";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:10:"number_min";s:0:"";s:10:"number_max";s:0:"";s:11:"number_step";s:0:"";s:3:"req";s:1:"0";s:17:"calc_auto_include";s:1:"0";s:8:"num_sort";s:1:"0";s:11:"admin_label";s:0:"";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:9:"show_desc";s:1:"0";s:8:"desc_pos";s:4:"none";s:9:"desc_text";s:0:"";}s:6:"fav_id";N;s:6:"def_id";N;}i:1;a:7:{s:2:"id";s:4:"2770";s:7:"form_id";s:3:"249";s:4:"type";s:5:"_calc";s:5:"order";s:1:"1";s:4:"data";a:23:{s:5:"label";s:11:"Calculation";s:15:"input_limit
function get_ninja_forms_version() {
$plugin_settings = get_option( 'ninja_forms_settings' );
return isset( $plugin_settings['version'] ) ? $plugin_settings['version'] : '';
}
@kjohnson
kjohnson / nf-datepicker-localize-de.js
Created March 19, 2015 19:05
Ninja Forms Datepicker Localization German
jQuery(document).ready( function() {
jQuery.datepicker.setDefaults(
{
prevText: '&#x3c;zurück', prevStatus: '',
prevJumpText: '&#x3c;&#x3c;', prevJumpStatus: '',
nextText: 'Vor&#x3e;', nextStatus: '',
nextJumpText: '&#x3e;&#x3e;', nextJumpStatus: '',
currentText: 'heute', currentStatus: '',
todayText: 'heute', todayStatus: '',
clearText: '-', clearStatus: '',
jQuery('.datepicker').datepicker({
// Show the 'close' and 'today' buttons
showButtonPanel: true,
closeText: objectL10n.closeText,
currentText: objectL10n.currentText,
monthNames: objectL10n.monthNames,
monthNamesShort: objectL10n.monthNamesShort,
dayNames: objectL10n.dayNames,
dayNamesShort: objectL10n.dayNamesShort,
dayNamesMin: objectL10n.dayNamesMin,
@kjohnson
kjohnson / gulpfile.js
Last active August 29, 2015 14:17
Gulp starter for JS
var gulp = require('gulp');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
gulp.task('js', function () {
return gulp.src('assets/js/**/*.js') //select all javascript files under js/ and any subdirectory
.pipe(uglify())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('assets/js/')); //the destination folder
});
@kjohnson
kjohnson / test.php
Last active August 29, 2015 14:18
Assign and return a property value in a single line
class Test {
public $var;
public function get_var() {
return $this->var = "Hello, world!";
}
}
$test = new Test();