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 | |
if (!empty($_SERVER['HTTP_CLIENT_IP'])) { | |
$ip = $_SERVER['HTTP_CLIENT_IP'];} | |
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { | |
$ip = $_SERVER['HTTP_X_FORWARDED_FOR']; | |
} else { | |
$ip = $_SERVER['REMOTE_ADDR']; | |
} | |
$url = "http://api.wipmania.com/".$ip; | |
$country = file_get_contents($url); |
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 $password = 'abc'; | |
if (!preg_match('/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{6,12}$/', $password) ) { | |
$error['password_length'] = "Password must be at least 6 characters, containing at least one latter and one number"; | |
} |
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_action('wp_head', function () { | |
global $wp_scripts; | |
foreach($wp_scripts->queue as $handle) { | |
$script = $wp_scripts->registered[$handle]; | |
//-- Weird way to check if script is being enqueued in the footer. | |
if($script->extra['group'] === 1) { |
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
//Order only from 1 shop | |
//https://www.wcvendors.com/help/topic/restrict-clientbuyer-to-order-from-one-vendor-at-a-time/ | |
add_filter( 'woocommerce_add_cart_item_data', 'woo_custom_add_to_cart' ); | |
function woo_custom_add_to_cart( $cart_item_data ) { | |
global $woocommerce; | |
$items = $woocommerce->cart->get_cart(); //getting cart items | |
$_product = array(); | |
foreach($items as $item => $values) { | |
$_product[] = $values['data']->post; | |
} |
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 insert_product ($product_data) | |
{ | |
$post = array( // Set up the basic post data to insert for our product | |
'post_author' => 1, | |
'post_content' => $product_data['description'], | |
'post_status' => 'publish', | |
'post_title' => $product_data['name'], | |
'post_parent' => '', |
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
// ==UserScript== | |
// @name Aliexpress | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://trade.aliexpress.com/orderList.htm* | |
// @grant unsafeWindow | |
// @grant GM_xmlhttpRequest | |
// @grant GM_setClipboard |
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
// Passed to function: ::: | |
//::: lat1, lon1 = Latitude and Longitude of point 1 (in decimal degrees) ::: | |
//::: lat2, lon2 = Latitude and Longitude of point 2 (in decimal degrees) ::: | |
//::: unit = the unit you desire for results ::: | |
//::: where: 'M' is statute miles (default) ::: | |
//::: 'K' is kilometers ::: | |
//::: 'N' is nautical miles | |
function distance(lat1, lon1, lat2, lon2, unit) { | |
if ((lat1 == lat2) && (lon1 == lon2)) { |
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_filter( 'gform_stripe_customer_id', function ( $customer_id, $feed, $entry, $form ) { | |
if ( rgars( $feed, 'meta/transactionType' ) == 'product' && rgars( $feed, 'meta/feedName' ) == 'Create Customer and Payment' ) { | |
$customer_meta = array(); | |
$metadata_field = rgars( $feed, 'meta/metaData' ); | |
foreach ($metadata_field as $metadata) { | |
if ($metadata['custom_key'] == 'Email') { | |
$email_field = $metadata['value']; | |
} |
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
<script> | |
var revapi = jQuery(document).ready(function() { | |
jQuery('#rev_slider_2_3').show().revolution({ | |
waitForInit: true, | |
/* SLIDER SETTINGS CONTINUED */ | |
}); | |
}); | |
// only start the slider once the entire window has loaded | |
revapi.on('revolution.slide.onchange', function(event, data) { | |
var get_id1 = data.currentslide[0]['id']; |