Skip to content

Instantly share code, notes, and snippets.

View joseph-farruggio's full-sized avatar

Joseph Farruggio joseph-farruggio

View GitHub Profile
@joseph-farruggio
joseph-farruggio / getReviews.php
Created September 23, 2017 00:36
Birdeye Get Reviews
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.birdeye.com/resources/v1/review/businessId/".$businessId."?sindex=".$sIndex."&count=".$reviewCount."&api_key=".$apiKey);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json",
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="redirect all requests" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
</conditions>
<action type="Rewrite" url="index.html" appendQueryString="true" />

/* Form Validation Code */

Javascript form validation checks for values in the name and message input fields. Custom error labels are appended as friendly reminders that a value is required.

// Wait for the DOM to be ready
jQuery(document).ready(function( $ ) {
    // Require jQuery Validate plugin
    $("input").prop('required',true);
    $.getScript( 'https://cdn.jsdelivr.net/jquery.validation/1.15.1/jquery.validate.min.js' ).done( function() {
    	// When user focuses and exits the input field
<?php
if($_POST && isset($_POST['name'], $_POST['email'], $_POST['website'], $_POST['subject'], $_POST['message'])) {
//user posted variables
$name = strip_tags($_POST['name']);
$email = strip_tags($_POST['email']);
$website = strip_tags($_POST['website']);
$subject = strip_tags($_POST['subject']);
$message = strip_tags($_POST['message']);
@joseph-farruggio
joseph-farruggio / functions.php
Created December 10, 2018 21:38
WooCommerce Custom Product Fields
<?php
/**
* Output ring size field.
*/
function iconic_output_engraving_field() {
global $product;
$sizes = $product->get_attribute( 'pa_ring-sizes' ); $sizes = explode(", ",$sizes);
if($sizes[0]!=''){ // if product sizes are available ?>
@joseph-farruggio
joseph-farruggio / active-plugins.php
Created April 3, 2019 06:54
Two versions of a script that disables plugins except specific pages
<?php
/**
* @package active-plugins
* @version 1.0
*
* Plugin Name: Active Plugins
* Plugin URI: http://wordpress.org/extend/plugins/#
* Description: This is a development plugin
* Author: Carlo Daniele
* Version: 1.0
<?php
/**
* GeneratePress child theme functions and definitions.
*
* Add your custom PHP in this file.
* Only edit this file if you have direct access to it on your server (to fix errors if they happen).
*/
function generatepress_child_enqueue_scripts() {
if ( is_rtl() ) {
[
{
"key": "group_5be5a1136a415",
"title": "Block: Hero",
"fields": [
{
"key": "field_5e0afdc64f5a3",
"label": "Content",
"name": "",
"type": "tab",
Redirect 301 "/spring-trends" "/baby-easter-outfits"
Redirect 301 "/safe-baby-sunscreen" "/baby-sunscreen"
Redirect 301 "/finding-a-pediatrician" "/find-a-pediatrician"
Redirect 410 "/royal-baby"
Redirect 410 "/dream-on-me-crib-collapse"
Redirect 410 "/recalled-playtex-infant-carrier"
Redirect 410 "/ikea-lamps-recalled-for-death"
Redirect 301 "/baby-photo-props" "/newborn-photo-props"
Redirect 301 "/category/incredible-infants/helpful-gadgets" "/category/incredible-infants/clothes-things"
Redirect 410 "/fall-fashion-mom-and-baby-2014"
{
id: '581',
'$uid': '73e7c58f8dcaf08275e9ede885e170e0',
internal: { typeName: 'WordPressPost',
origin: undefined,
mimeType: undefined,
content: undefined,
timestamp: 1595134058463
},
date: '2020-07-08T18: 58: 21',