Skip to content

Instantly share code, notes, and snippets.

View presswizards's full-sized avatar
🎯
Working on: FreeScout GPT Pro, WAF Suite for Cloudflare

Rob Marlbrough @PressWizards presswizards

🎯
Working on: FreeScout GPT Pro, WAF Suite for Cloudflare
View GitHub Profile
@presswizards
presswizards / hide-inject-email.txt
Created April 14, 2025 18:57
Inject and link email address only on user interaction
// Add this normal link with this specific ID to your page anywhere you want it:
<a id="email-link" href="#">Email Us</a>
// WordPress Code Snippet to add:
function call_email_js_function() {
echo "<script>
function setupEmailInjection() {
document.addEventListener('DOMContentLoaded', function () {
function injectEmail() {
const user = 'hello';
@presswizards
presswizards / utm-to-button.js
Created March 18, 2025 06:58
UTM to button link
document.addEventListener('DOMContentLoaded', function () {
const params = new URLSearchParams(window.location.search);
const utmParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content'];
let utmString = '';
utmParams.forEach(param => {
if (params.has(param)) {
utmString += `${utmString ? '&' : '?'}${param}=${encodeURIComponent(params.get(param))}`;
}
});
@presswizards
presswizards / divi-change-subject.php
Last active March 17, 2025 21:29
Divi Theme Change Contact Form Subject Line to remove site name and tagline
// Instead of creating a custom Contact Form element:
add_filter('gettext', 'edit_divi_contact_form_subject', 10, 3);
function edit_divi_contact_form_subject($translated_text, $text, $domain)
{
if ($text === 'New Message From %1$s%2$s' && $domain === 'et_builder') {
return 'New Contact Form Message';
}
return $translated_text;
}
@presswizards
presswizards / cloudflare_dns_check.sh
Created January 15, 2025 05:28
Cloudflare DNS IP Checker Shell Script
#!/bin/bash
# Cloudflare DNS IP checker shell script:
# This script checks for server IP assigned to DNS records so you can remove them and replace
# the A record with a CNAME that points to the server hostname instead making migrations easy!
# Cloudflare Account 1
CLOUDFLARE_EMAIL="[email protected]" # Replace with your Cloudflare email
CLOUDFLARE_API_KEY="<cloudflare global api key>" # Replace with your Cloudflare global API key
@presswizards
presswizards / cfworker.js
Created September 26, 2024 08:28 — forked from aonsyed/cfworker.js
The WPORG VPN
addEventListener("fetch", event => {
event.respondWith(handleRequest(event.request));
})
/**
* The API key required for access.
* You can use environment variables for secrets like API keys for better security.
*/
const API_KEY = 'your-secure-api-key-here'; // Replace this with your actual API key
@presswizards
presswizards / server-avatar-api.php
Created July 11, 2024 08:15
ServerAvatar API Example
<?php
// Set the API endpoint
$api_endpoint = 'https://api.serveravatar.com/v1/';
// Set the API key
$api_key = 'YOUR_API_KEY_HERE';
// Set the server ID
$server_id = 'YOUR_SERVER_ID_HERE';
@presswizards
presswizards / add_trusted_ips.sh
Created July 11, 2024 08:05
Plesk Add Trusted IPs to fail2ban to prevent badbot blocks
#!/bin/bash
# add to crontab to run once per day or week like so via "crontab -e":
# 0 0 */1 * * ~/add_trusted_ips.sh > /dev/null
# URL containing the list of trusted IPs
URL1="https://optimize.exactlywww.com/exactdn/servers.php"
URL2="https://www.cloudflare.com/ips-v4/"
URL3="https://www.cloudflare.com/ips-v6/"
URL4="https://api.bunny.net/system/edgeserverlist/plain"
@presswizards
presswizards / blesta-affiliate-id.php
Last active July 11, 2024 08:09
Add Blesta Affiliate ID to all links on page
add_action( 'wp_head', function () { ?>
<script>
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, '\\$&');
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));