Skip to content

Instantly share code, notes, and snippets.

Josh Pollock Shelob9

Block or report user

Report or block Shelob9

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View add-on.php
<?php
/**
* Plugin Name: Test Add-on
*/
add_action('wp_enqueue_scripts', function () {
wp_enqueue_script(
'cf-add-on-test',
esc_url_raw(plugins_url('test-add-on.js', __FILE__)),
View redirect-processor.php
<?php
/**
* On form submit, do a redirect to a diffrent site, then complete submission
*/
add_action('caldera_forms_submit_process_start', function (
$form,
$referrer,
$process_id
) {
//If we have a already done redirect, do nothing
View block-submission-based-on-field.js
jQuery(document).ready(function($) {
//variable to prevent blocking all
var blockedOnce = false;
$(document).on("cf.ajax.request", function(e, obj) {
//only block submission once
if (!blockedOnce) {
//Make sure window.cf2 is set properly
if (!window.cf2) {
window.cf2 = {};
}
@Shelob9
Shelob9 / Subscription.php
Last active Aug 3, 2019
Laravel Spark with Laravel Nova
View Subscription.php
<?php
namespace App\Nova;
use Laravel\Nova\Fields\BelongsTo;
use Laravel\Nova\Fields\Date;
use Laravel\Nova\Fields\ID;
use Illuminate\Http\Request;
use Laravel\Nova\Http\Requests\NovaRequest;
View caldera_forms_private_upload_directory.php
<?php
add_filter( 'caldera_forms_private_upload_directory', function( $directory, $field_id, $form_id, $transient_id ){
//IMPORTANT -- Change this to the ID of your field, or remove this conditional to affect all fields.
if( 'fld111' === $field_id ){
//see: https://developer.wordpress.org/reference/functions/wp_get_upload_dir/
$uploads = wp_get_upload_dir();
$directory = $uploads[ 'basedir' ] . '/somepath';
}
return $directory;
},10,4);
@Shelob9
Shelob9 / app.docker
Last active Jul 11, 2019
Docker Compose for Laravel. Put all files besides docker-compose.yml into /docker
View app.docker
FROM php:7.3-fpm
RUN apt-get update && apt-get install -y mysql-client
RUN docker-php-ext-install pdo_mysql
WORKDIR /var/www
View docker-compose.yml
version: '2'
services:
web:
build:
context: ./
dockerfile: docker/web.docker
volumes:
- ./:/var/www
ports:
- "8080:80"
View docker-compose.yml
version: '2'
services:
web:
build:
context: ./
dockerfile: docker/web.docker
volumes:
- ./:/var/www
ports:
- "8080:80"
@Shelob9
Shelob9 / caldera_forms_api_allow_entry_view-show-all.php
Last active Jul 9, 2019
Allows entries to be viewed via Caldera Forms REST API
View caldera_forms_api_allow_entry_view-show-all.php
<?php
/**
Show for all forms
*/
add_filter( 'caldera_forms_api_allow_entry_view','__return_true' ){
View create-entry.php
<?php
/**
* Create a Caldera Forms entry programatically
*/
//Get the form entry is related to
//@TODO Change the form ID (cf123...)
$form = Caldera_Forms_Forms::get_form('cf1234456');
//Basic entry information
$entryDetials = new Caldera_Forms_Entry_Entry();
You can’t perform that action at this time.