Skip to content

Instantly share code, notes, and snippets.

Vladimír Smitka lynt-smitka

Block or report user

Report or block lynt-smitka

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 nonmod_params-nginx.conf
if ($query_string ~ "^(?<pre>.*?)(&?fbclid=[a-zA-Z0-9_-]+)(?<post>.*?)$"){
rewrite ^(.*)$ $1?$pre$post?;
}
if ($query_string ~ "^(?<pre>.*?)(&?utm_source=[a-zA-Z0-9_-]+)(?<post>.*?)$"){
rewrite ^(.*)$ $1?$pre$post?;
}
if ($query_string ~ "^(?<pre>.*?)(&?utm_medium=[a-zA-Z0-9_-]+)(?<post>.*?)$"){
rewrite ^(.*)$ $1?$pre$post?;
}
if ($query_string ~ "^(?<pre>.*?)(&?utm_campaign=[a-zA-Z0-9_-]+)(?<post>.*?)$"){
View nonmod_params.htaccess
RewriteCond %{QUERY_STRING} ^(.*?)(&?(?:fbclid|gclid|utm_source|utm_medium|utm_campaign|utm_term|utm_content)=[a-zA-Z0-9_-]+)(.*?)$
RewriteRule ^(.*)$ /$1?%1%3 [L,NE]
View kt_init.inc.php
/* cache proměnná pro podadresáře */
$subdirsCache=array();
/**
* Získání všech názvů podadresářů pro zadaný adresář
*
* @author Martin Hlaváč
* @link http://www.ktstudio.cz
*
* @return array
@lynt-smitka
lynt-smitka / optimized-list.txt
Created May 24, 2019
wordfence whitelisted services optimized list
View optimized-list.txt
5.45.179.103/32
10.0.0.0/8
23.239.9.227/32
31.13.24.0/21
31.13.64.0/18
31.220.7.237/32
37.97.188.103/32
37.157.246.146/32
37.235.48.42/32
37.235.52.25/32
@lynt-smitka
lynt-smitka / .blackfire.yml
Last active Apr 24, 2019
Blackfire.io for WP
View .blackfire.yml
metrics:
do_action:
label: "do_action calls"
matching_calls:
php:
- callee:
selector: '=do_action'
argument: { 1: "^" }
apply_filters:
View warm.py
#!/usr/bin/python
import requests
from defusedxml import ElementTree
feeds = [
'https://<web1>/page-sitemap.xml',
'https://<web2>/page-sitemap.xml'
]
for feed in feeds:
View contributor-edit-existing-pages.php
$member = get_role('contributor');
$member->add_cap('edit_published_pages');
$member->add_cap('publish_pages');
function lynt_kill_new() {
if (current_user_can('contributor')) {
global $wp_post_types;
$wp_post_types['page']->cap->create_posts = 'do_not_allow';
}
}
View wp-disable-block-editor.php
add_filter('use_block_editor_for_post', '__return_false', 10);
add_filter('use_block_editor_for_post_type', '__return_false', 10);
View subpages-shotcode.php
function lynt_subpages() {
global $post;
$args = sprintf('echo=0&title_li=&child_of=%d', $post->ID);
return '<ul>'.wp_list_pages($args).'</ul>';
}
add_shortcode('list_subpages', 'lynt_subpages');
View wp-only-for-users.php
function lynt_redirect_to_login(){
if ( is_page(123) && !is_user_logged_in() ) auth_redirect();
}
add_action('get_header', 'lynt_redirect_to_login');
// in_category('private-category') - test if the current post exists in particular category
// wp_get_post_parent_id(get_the_ID()) === 2 - test if the current page is the child of the page defined by its ID
You can’t perform that action at this time.