Skip to content

Instantly share code, notes, and snippets.

gaupoit gaupoit

Block or report user

Report or block gaupoit

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View mime-types.php
<?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 Oct 15, 2019
Filter the URLs protected by Prevent Direct Access plugin
View filter-protected-url-by-wp-query.php
<?php
$args = array(
'post_type' => 'attachment',
'post_status' => 'any',
'meta_query' => array(
array(
'key' => '_pda_protection',
'value' => '1'
)
)
@gaupoit
gaupoit / index.html
Created Sep 13, 2019 — forked from shiawuen/index.html
Sample to upload file by chunk
View index.html
<!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>
View fix-private-link.php
@gaupoit
gaupoit / thank-you.php
Last active Jul 2, 2019
PHP Snippet to implement the contact form redirection
View thank-you.php
add_action( 'wp_footer', 'redirect_cf7' );
function redirect_cf7() {
?>
<script type="text/javascript">
document.addEventListener( 'wpcf7mailsent', function( event ) {
if ( '1460' == event.detail.contactFormId ) { // Sends sumissions on form 1460 to the custom thank you page
location = 'https://example.com/thank-you/';
}
}, false );
View pda_handle_upgrade_extension.php
<?php
/**
* Handle auto upgrade extension
*/
public function pda_handle_upgrade_extension() {
$updates = get_plugin_updates();
$pda_skin = new PDA_WP_Upgrader_Skin();
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
$upgrader = new Plugin_Upgrader( $pda_skin );
foreach ( $updates as $plugin ) {
@gaupoit
gaupoit / pda_wp_upgrader_skin.php
Created May 4, 2019
WP_Upgrader_Skin class without showing the feedback message
View pda_wp_upgrader_skin.php
<?php
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
if ( ! class_exists( 'PDA_WP_Upgrader_Skin' ) ) {
class PDA_WP_Upgrader_Skin extends WP_Upgrader_Skin {
function feedback( $string ) {
return;
}
}
@gaupoit
gaupoit / auto-update.php
Last active May 4, 2019
Snippet to update WordPress plugins automatically
View auto-update.php
<?php
function pda_auto_update_specific_plugins ( $update, $item ) {
$plugins = array (
'wp-pda-ip-block',
'pda-membership-integration',
);
if ( in_array( $item->slug, $plugins ) ) {
return true; // We can add more control logic here, for example only update in the specific version
} else {
@gaupoit
gaupoit / hello.html
Created Feb 23, 2019
hello vue component
View hello.html
<div>
<hello-vue></hello-vue>
</div>
View enqueue_script.php
<?php
wp_enqueue_script(
'csw_bundle',
plugin_dir_url( CSW_BASE_FILE ) . 'admin/js/dist/gists-snippet-bundle.js',
array(),
CSW_VERSION,
true
);
You can’t perform that action at this time.