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 | |
defined( 'ABSPATH' ) or die( 'Plugin file cannot be accessed directly.' ); | |
class HoneypotSpamTrap { | |
protected $fields; | |
public function __construct() {} | |
// Set fields and setup actions for comments and registration forms |
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
// delete previous days folders | |
function delete_old_folders() { | |
$uploads = wp_upload_dir(); | |
$uploadPath = trailingslashit( $uploads['path'] ) . 'user-uploads/'; | |
$folders = new RecursiveIteratorIterator( | |
new RecursiveDirectoryIterator($uploadPath, RecursiveDirectoryIterator::SKIP_DOTS), | |
RecursiveIteratorIterator::CHILD_FIRST | |
); | |
foreach( $folders as $name => $folder ){ |
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
// save button | |
jQuery('.save-crop').on('click', function() { | |
console.log('saving the cropped image'); | |
jQuery('#cropperModal').foundation('reveal', 'close'); // TODO: this doesn't seem to work... | |
currentFile.cropData = jQuery('#cropper').cropper('getData'); | |
var printOverlay = new Image(); | |
jQuery(printOverlay).on('load', function() { | |
console.log('creating Print Overlay '); | |
// create a 300dpi scaled canvas based off of print overlay width/height | |
var scaledCanvas = jQuery('#cropper').cropper('getCroppedCanvas', {width: this.width, height: this.height}); |
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
function upandup_ajax_cropper_upload() { | |
$response = array(); | |
if ( check_ajax_referer( 'upandup_cropper_nonce', 'nonce', false ) ) { | |
$uploads = wp_upload_dir(); | |
$uploadPath = trailingslashit( $uploads['path'] ); | |
$uploadURL = trailingslashit( $uploads['url'] ); | |
// get and sanitize global variables | |
if ( isset( $_POST['sessionID'] ) ) { | |
$sessionID = sanitize_text_field( $_POST['sessionID'] ); | |
$uploadPath .= $sessionID . '/'; |
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
if ( current_user_can( 'edit_posts' ) ) { | |
// Tell the TinyMCE editor to use a custom stylesheet | |
// See http://codex.wordpress.org/Function_Reference/add_editor_style | |
add_theme_support( 'editor_style' ); | |
add_editor_style( 'assets/css/editor-style.css' ); | |
// Prevent WordPress from uploading duplicate files | |
// Checks to see if both filenames match and then overwrites only if the filesizes are different | |
function groundup_remove_duplicate_attachment( $file ) { | |
$upload_dir = wp_upload_dir(); |
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
/** | |
* Add a spam-trap to comment form and registration form | |
* | |
* Include hidden fields. If it receives an input, we have a bot! | |
* Add a unique number (changes daily) to all the fields to keep bots from learning what fields to ignore. | |
* Store spam entries as spam so that the bot is not aware the form failed | |
*/ | |
function get_decoy_fields() { | |
$decoys = array( 'firstname', 'lastname', 'email2', 'address', 'address2', 'city', 'state', 'zipcode', 'telephone', 'phone'); | |
return $decoys; |
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
/** | |
* Add a spam-trap to comment form and registration form | |
* | |
* Include a hidden field called name and set it to hidden. If it receives an input, we have a bot! | |
*/ | |
function get_decoy_fields() { | |
$decoys = array( 'firstname', 'lastname', 'email2', 'address', 'address2', 'city', 'state', 'zipcode', 'telephone', 'phone'); | |
return $decoys; | |
} | |
function get_dailyID() { |
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
// Required global settings and mixins for Foundation | |
@import "foundation/foundation-global"; | |
// Find the opposite lightness value of a color for more contrast. Neutral colors will see less difference | |
@function reverse-lightness($color, $percent: 'auto') { | |
@if(lightness($color) < 50%) { // dark colors | |
@if($percent == 'auto') { | |
$percent: 2* ( 50 - lightness($color)); | |
} | |
$color: lighten($color, $percent); |