This file contains 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 Google Tag Manager javascript code as close to | |
the opening <head> tag as possible | |
=====================================================*/ | |
function add_gtm_head(){ ?> | |
<!-- Google Tag Manager --> | |
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | |
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | |
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | |
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); | |
})(window,document,'script','dataLayer','GTM-XXXX');</script> |
This file contains 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
<script> | |
(function($) { | |
$(document).ready(function() { | |
var $videos = $('.play_once video'); | |
$videos.each(function() { | |
var $video = $(this)[0]; | |
$video.removeAttr('loop'); |
This file contains 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
// Put in your themes functions.php file | |
add_filter( 'gform_pre_send_email', 'before_email', 10, 3); | |
function before_email( $email, $form, $entry ) { | |
// Add your own words to the array, or convert a CSV like I did | |
$swear_array = ['very','bad','language','word','array']; | |
$swear_alert = ""; | |
$email_message = strval(strip_tags($email['message'])); | |
foreach ($swear_array as $swear) { | |
if (preg_match("/\b".$swear."\b/i", $email_message)) { |
This file contains 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() { | |
// Main function for creatng the animation loop | |
function createImgAnimation(imgInfo){ | |
// Pad zero's for Adobe Media Encoder output filenames | |
Number.prototype.pad = function(size) { | |
var s = String(this); | |
while (s.length < (size || 2)) {s = "0" + s;} | |
return s; | |
} |
This file contains 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 | |
/* | |
This code handles loading a file from the /protected-directory/ directory. | |
(!) Be sure to change line 44 below to point to your protected directory if something other than /protected/ | |
(!) Be sure to change line 64 below to check the levels you need. | |
(!) Add this code to your active theme's functions.php or a custom plugin. | |
(!) You should have a corresponding bit of code in your Apache .htaccess file to redirect files to this script. e.g. | |
### |
This file contains 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
// Martins Super Amazing Optimized Particle Network | |
function getRandomArbitrary(min, max) { | |
return Math.random() * (max - min) + min; | |
} | |
(function(factory) { | |
// Establish the root object, `window` in the browser, or `global` on the server. | |
var root = (typeof self === 'object' && self.self === self && self) || (typeof global === 'object' && global.global === global && global); |
This file contains 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 | |
// Get user name and/or IP | |
function get_user_data_processing_function(){ | |
$name = []; | |
// Sanitize $_GET parameters to avoid XSS and other attacks | |
$urlName = preg_replace('/[^-a-zA-Z0-9_]/', '', $_GET['n']); | |
if($urlName){ | |
// Get user name from URL variable | |
$name['name'] = $urlName; | |
} |