Skip to content

Instantly share code, notes, and snippets.

View lkoudal's full-sized avatar

Lars Koudal lkoudal

View GitHub Profile
@lkoudal
lkoudal / detect_playground.php
Created March 20, 2024 14:34 — forked from alanef/detect_playground.php
Detect WP Playground
<?php
if ( 'PHP.wasm' === $_SERVER['SERVER_SOFTWARE'] && 'playground.wordpress.net' === $_SERVER['HTTP_HOST'] ) {
// inside playground.wordpress.net
}
<?php
error_reporting(E_ALL);
// BigDump ver. 0.36b from 2015-04-30
// Staggered import of an large MySQL Dump (like phpMyAdmin 2.x Dump)
// Even through the webservers with hard runtime limit and those in safe mode
// Works fine with latest Chrome, Internet Explorer and Firefox
// Author: Alexey Ozerov (alexey at ozerov dot de)
@lkoudal
lkoudal / WpCsp.php
Created May 24, 2023 00:27 — forked from etherealite/WpCsp.php
Wordpress class to enable Content Security Policies
<?php
class WpCsp {
public function register(): void
{
add_filter('script_loader_tag', [$this, 'filter_script_loader_tag'], 3, 50);
add_filter('wp_inline_script_attributes', [$this, 'action_wp_inline_script_attributes']);
@lkoudal
lkoudal / freemius-api-license-validation.php
Created March 6, 2022 14:55 — forked from vovafeldman/freemius-api-license-validation.php
Validates a license key using Freemius API using the PHP SDK
<?php
// Freemius PHP SDK - https://github.com/Freemius/freemius-php-sdk
require_once './php-sdk-master/freemius/Freemius.php';
define( 'FS__API_SCOPE', 'developer' );
define( 'FS__API_DEV_ID', 1234 );
define( 'FS__API_PUBLIC_KEY', 'pk_YOUR_PUBLIC_KEY' );
define( 'FS__API_SECRET_KEY', 'sk_YOUR_SECRET_KEY' );
// Init SDK.
<?php
// AppSumo AJAX form submission
add_action( 'wp_ajax_nopriv_deo_appsumo_submission', 'deo_appsumo_submission' );
add_action( 'wp_ajax_deo_appsumo_submission', 'deo_appsumo_submission' );
function deo_appsumo_submission() {
check_ajax_referer( 'deo_ajax_nonce', 'nonce' );
@lkoudal
lkoudal / disable_googles_ssb.php
Created February 5, 2022 14:19 — forked from tacoverdo/disable_googles_ssb.php
Disable Google's Sitelink Search Box in WordPress SEO (Premium)
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
// This disables the Google Sitelink Search Box functionality in WordPress SEO (Premium)
add_filter('disable_wpseo_json_ld_search', '__return_true');
@lkoudal
lkoudal / loop-products-woocommerce.php
Created January 25, 2022 22:03 — forked from eliasfaical/loop-products-woocommerce.php
Sample products loop - Woocommerce
<ul class="products">
<?php
$args = array( 'post_type' => 'product', 'posts_per_page' => 1, 'product_cat' => 'camisa' );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
<h2>Shoes</h2>
<li class="product">
<a href="<?php echo get_permalink( $loop->post->ID ) ?>" title="<?php echo esc_attr($loop->post->post_title ? $loop->post->post_title : $loop->post->ID); ?>">
<?php
woocommerce_show_product_sale_flash( $post, $product );
@lkoudal
lkoudal / wp-admin-modal-dialog.php
Created December 13, 2021 20:31 — forked from anttiviljami/wp-admin-modal-dialog.php
WordPress admin modal dialog example
<?php
// enqueue these scripts and styles before admin_head
wp_enqueue_script( 'jquery-ui-dialog' ); // jquery and jquery-ui should be dependencies, didn't check though...
wp_enqueue_style( 'wp-jquery-ui-dialog' );
?>
<!-- The modal / dialog box, hidden somewhere near the footer -->
<div id="my-dialog" class="hidden" style="max-width:800px">
<h3>Dialog content</h3>
<p>This is some terribly exciting content inside this dialog. Don't you agree?</p>
@lkoudal
lkoudal / search_templates
Created October 7, 2021 20:31 — forked from bobpoekert/search_templates
A machine readable list of search engines. Each line is a query template, where all occurrences of {searchTerms} should be replaced with the search query. These were scraped off mycroft.mozdev.org, and tested that they at least respond with a page that contains the input query (to remove pages that lie behind login walls).
http://0-www.sciencedirect.com.www.consuls.org/science?_ob=QuickSearchURL&_method=submitForm&_acct=C000050221&md5=0c4b6db32507e4a332b2aa6dd47a65f4&qs_all={searchTerms}&qs_author=&qs_title=&qs_vol=&qs_issue=&qs_pages=&x=34&y=15
http://0-dictionary.oed.com.library.utulsa.edu/cgi/findword?query_type=word&queryword={searchTerms}
http://100.daum.net/search/search.do?query={searchTerms}
http://1000corks.com/search?st={searchTerms}&src=myc
http://11870.com/konsulto/{searchTerms}
http://1000memories.com/search?q={searchTerms}
http://130.219.35.129/search?q={searchTerms}&btnG=Google+Search&entqr=0&output=xml_no_dtd&sort=date%3AD%3AL%3Ad1&client=default_frontend&ud=1&oe=UTF-8&ie=UTF-8&proxystylesheet=default_frontend&site=default_collection
http://1337x.org/search/{searchTerms}/0/
http://11888.ote.gr/web/guest/white-pages/search?who={searchTerms}&where=
http://140.111.34.46/cgi-bin/newDict/dict.sh?idx=dict.idx&cond={searchTerms}&pieceLen=50&fld=1&cat=&imgFont=1
@lkoudal
lkoudal / AnimationName-1628990281467-118.css
Last active August 15, 2021 01:18 — forked from GradientAnimator/AnimationName-1628990281467-118.css
CSS Gradient Animation krystal-healerhuset BG anim
.css-selector {
    background: linear-gradient(288deg, #8b7acb, #f69786, #f2c4bc, #c4bfd5);
    background-size: 800% 800%;
    -webkit-animation: AnimationName 46s ease infinite;
    -moz-animation: AnimationName 46s ease infinite;
    -o-animation: AnimationName 46s ease infinite;
    animation: AnimationName 46s ease infinite;
}
@-webkit-keyframes AnimationName {
    0%{background-position:30% 0%}