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 isUploadSupported() { | |
if (navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\/(1.0|2.0|2.5|3.0))/)) { | |
return false; | |
} | |
var elem = document.createElement('input'); | |
elem.type = 'file'; | |
return !elem.disabled; | |
}; |
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 readFile(file) { | |
var reader = new FileReader(); | |
reader.onloadend = function () { | |
processFile(reader.result, file.type); | |
} | |
reader.onerror = function () { | |
alert('There was an error reading the file!'); | |
} |
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 sendFile(fileData) { | |
var formData = new FormData(); | |
formData.append('imageData', fileData); | |
$.ajax({ | |
type: 'POST', | |
url: '/your/upload/url', | |
data: formData, | |
contentType: false, |
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 processFile(dataURL, fileType) { | |
var maxWidth = 800; | |
var maxHeight = 800; | |
var image = new Image(); | |
image.src = dataURL; | |
image.onload = function () { | |
var width = image.width; | |
var height = image.height; |
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
if (window.File && window.FileReader && window.FormData) { | |
var $inputField = $('#file'); | |
$inputField.on('change', function (e) { | |
var file = e.target.files[0]; | |
if (file) { | |
if (/^image\//i.test(file.type)) { | |
readFile(file); | |
} else { |
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
<input id="file" type="file" accept="image/*"> |
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 | |
if(!function_exists('wc_get_products')) { | |
return; | |
} | |
$paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1; | |
$ordering = WC()->query->get_catalog_ordering_args(); | |
$ordering['orderby'] = array_shift(explode(' ', $ordering['orderby'])); | |
$ordering['orderby'] = stristr($ordering['orderby'], 'price') ? 'meta_value_num' : $ordering['orderby']; |
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 | |
/** | |
* Change the default shortcode button text for both shortcodes | |
*/ | |
add_filter( 'wcepe_external_product_shortcode', 'wcepe_change_default_button_text' ); | |
add_filter( 'wcepe_recent_external_products_shortcode', 'wcepe_change_default_button_text' ); | |
function wcepe_change_default_button_text( $atts ) { |
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 | |
/** | |
* Plugin Name: Email Confirmation | |
* Description: Send an email to the user with confirmation code and store form data in database until user confirms. | |
* Author: Cedric Ruiz | |
*/ | |
class EmailConfirmation | |
{ | |
const PREFIX = 'email-confirmation-'; |
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 | |
# SHORTS | |
# DIRECTORY SEPARATOR | |
define( 'DS', DIRECTORY_SEPARATOR ); | |
# PATH SEPARATOR | |
define( 'PS', PATH_SEPARATOR ); | |
# Absolute path to the WordPress directory. | |
! defined( 'ABSPATH' ) | |
AND define( 'ABSPATH', dirname( __FILE__ ).DS ); |
OlderNewer