Skip to content

Instantly share code, notes, and snippets.

@gaupoit
gaupoit / ppf-form-action-url.php
Last active May 26, 2020 05:11
Form action URL
<?php
add_filter( 'ppwp_ppf_action_url', 'ppwp_get_custom_ppf_action_url', 999, 1 );
/**
* Replace the default URL to current page.
*
* @param string $default_url The default URL.
*
* @return mixed
*/
@gaupoit
gaupoit / ppw-integrate-with-pro-photo7.php
Last active May 20, 2020 01:27
Integrate PPWP with Pro Photo 7 theme
<?php
add_filter( 'plugin_loaded', 'add_prophoto_middleware' );
function add_prophoto_middleware() {
add_action('pp_render_content', 'ppw_check_password_protection' );
add_action('wp', 'ppw_prevent_caching' );
}
function ppw_prevent_caching() {
global $post;
@gaupoit
gaupoit / .eslintrc
Created May 7, 2020 02:39
Ymese Eslint
{
"parser": "babel-eslint",
"extends": [
"prettier",
"airbnb"
],
"plugins": [
"react",
"jsx-a11y"
],
@gaupoit
gaupoit / package.json
Created May 7, 2020 02:32
Standard Webpack Build
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/preset-env": "^7.9.0",
"autoprefixer": "^6.7.7",
"babel-core": "^6.26.3",
"babel-eslint": "^7.1.1",
"babel-loader": "^7.1.5",
"babel-plugin-import": "^1.13.0",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-plugin-transform-regenerator": "^6.22.0",
@gaupoit
gaupoit / pda-video-integrate-jPlayer.js
Last active April 24, 2020 10:17
Integrate PDA Videos with jPlayer
(function ($) {
'use strict';
$(document).ready(function () {
// Init jPlayer.
$("#jquery_jplayer_1").jPlayer({
cssSelectorAncestor: "#jp_container_1",
swfPath: "/js",
supplied: "mp3, oga",
useStateClassSkin: true,
@gaupoit
gaupoit / pda-integrate-nmedia.php
Last active April 20, 2020 11:15
Integrate Prevent Direct Access Gold with WordPress File Manager Plugin
<?php
add_action( 'pda_s3_pre_sync', 'pda_fix_nmedia_files' ); // Add this line if you are using PDA S3 Integration
add_action( 'pda_before_protect_file', 'pda_fix_nmedia_files' );
/**
* Try to correct the _wp_attached_file data.
*
* Files are uploaded by nmedia plugin its _wp_attached_file are post_url.
* This function tries to correct them:
* 1. Get the post parent because nmedia creates two kind of post data. One appears in the WordPress Media UI and its parent is managed by nmedia.
@gaupoit
gaupoit / customPlayer.js
Created March 27, 2020 12:36
Handle players event
(function ($) {
'use strict';
$(window).load(function () {
$('video').on('ended', function (evt) {
console.log('Video ended');
});
});
})(jQuery);
@gaupoit
gaupoit / mime-types.php
Last active November 18, 2019 09:58
Mime Types
<?php
$mine_types = array(
'txt' => 'text/plain',
'htm' => 'text/html',
'html' => 'text/html',
'php' => 'text/html',
'css' => 'text/css',
'js' => 'application/javascript',
'json' => 'application/json',
@gaupoit
gaupoit / filter-protected-url-by-wp-query.php
Last active October 15, 2019 04:42
Filter the URLs protected by Prevent Direct Access plugin
<?php
$args = array(
'post_type' => 'attachment',
'post_status' => 'any',
'meta_query' => array(
array(
'key' => '_pda_protection',
'value' => '1'
)
)
@gaupoit
gaupoit / index.html
Created September 13, 2019 07:54 — forked from shiawuen/index.html
Sample to upload file by chunk
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>test upload by chunk</title>
</head>
<body>
<input type="file" id="f" />
<script src="script.js"></script>