Skip to content

Instantly share code, notes, and snippets.

@robertuniqid
robertuniqid / gist:e020d0e509f6df1d4ccb
Created June 21, 2015 22:44
Easy Development - Template Helper Meith
var TemplateHelper = {
Init : function() {
var objectInstance = this;
this.EventManager.registerEvent('displayMovement');
this.Component.Init(objectInstance);
jQuery(window).bind('resize scroll', function(){
@robertuniqid
robertuniqid / gist:f82c78169afac160efd5
Created June 23, 2015 09:48
WooCommerce - Get Newest Order ID By UserID and Product ID
<?php
global $wpdb;
$query = 'SELECT oinfo.ID
FROM ' . $wpdb->base_prefix . 'woocommerce_order_items as oitem
LEFT JOIN ' . $wpdb->base_prefix . 'posts as oinfo ON oinfo.ID = oitem.order_id
LEFT JOIN ' . $wpdb->base_prefix . 'postmeta as ometa ON ometa.post_id = oinfo.ID AND ometa.meta_key = "_customer_user"
LEFT JOIN ' . $wpdb->base_prefix . 'woocommerce_order_itemmeta as oimeta ON oimeta.order_item_id = oitem.order_item_id
AND oimeta.meta_key = "_product_id"
@robertuniqid
robertuniqid / .js
Created January 25, 2016 22:35
Force in-site iFrames to point to URL's and have an certain suffix or URL Paramter. I've used this to change the layout to a different one, in order to achieve an "Quick Access" Interface for minimal 2-3 inputs tables on a larger project. This is a great alternative if you're also working in Laravel and you want to avoid taking this case into ac…
var Layout = {
_handleSmartIFrameContainers : function() {
var objectInstance = this;
jQuery('[data-smart-iframe]').each(function() {
var smartIFrameContainer = jQuery(this);
jQuery(this).find(jQuery(this).attr('data-smart-iframe')).bind("click", function(event) {
event.preventDefault();
@robertuniqid
robertuniqid / directory-navigation-ftp.php
Created May 9, 2016 20:58
PHP FTP Connection Helper ( including sorting like Filezilla )
<?php
// Not the most optimal solution, but it's the best for the way I need it.
class DirectoryNavigationFTP {
public $connectionEntity;
/**
* @var bool|resource
@robertuniqid
robertuniqid / WPEPAssetMatcher.php
Last active July 10, 2016 23:58
WPEP - Extract Image from different paths within WordPress from JSON data. Can be adapted.
<?php
namespace WPEPAddOnImportExport\Coordinator;
class AssetMatcher {
public $website_url;
public function __construct() {
$this->website_url = get_site_url();
@robertuniqid
robertuniqid / filter-proxy.php
Last active May 2, 2017 10:07
Easily attach filters in WordPress, then remove them.
<?php
// This is an PHP Trait http://php.net/manual/ro/language.oop5.traits.php
trait FilterProxy {
protected $_filter_proxy_storage = [];
public function _filter_proxy_setup( $information ) {
if( empty( $information ) )
@robertuniqid
robertuniqid / query.sql
Created May 28, 2017 11:55
EDD Child & Parent License Expiration.
SELECT p.ID as license_id,
c_exp.meta_value as child_expiration,
p_exp.meta_value as parent_expiration
FROM `wp_posts` p
LEFT JOIN `wp_postmeta` c_exp ON c_exp.post_id = p.ID AND c_exp.meta_key = "_edd_sl_expiration"
LEFT JOIN `wp_postmeta` p_exp ON p_exp.post_id = p.post_parent AND p_exp.meta_key = "_edd_sl_expiration"
WHERE p.`post_type` = 'edd_license'
AND p.post_parent != 0
@robertuniqid
robertuniqid / main.js
Created June 14, 2017 14:17
jQuery Function to Serialize Object, like in a PHP $_POST request from HTML, the main issue came with combining checkboxes & hidden inputs, and I've made this adaptation to handle this..
$.fn.wpepSerializeObject = function () {
"use strict";
var result = {},
objectInstance = this;
var extend = function (i, element) {
var node = result[element.name];
if ('undefined' !== typeof node && node !== null) {
@robertuniqid
robertuniqid / example.php
Last active August 8, 2017 19:59
Formidable WPEP Verification
<?php
$user_entries = FrmEntry::getAll( [
'form_id' => $required_form_id_any,
'user_id' => get_current_user_id(),
'parent_item_id' => 0
] );
if( empty( $user_entries ) )
@robertuniqid
robertuniqid / example.php
Created August 14, 2017 17:54
WPEP PlaceHolder Image
<?php
if( !defined( 'WPEP_PLACEHOLDER_IMAGE' ) )
define( "WPEP_PLACEHOLDER_IMAGE", "your-image-link-goes-here" );
?>