Skip to content

Instantly share code, notes, and snippets.

View lynt-smitka's full-sized avatar

Vladimír Smitka lynt-smitka

View GitHub Profile

Keybase proof

I hereby claim:

  • I am lynt-smitka on github.
  • I am smitka (https://keybase.io/smitka) on keybase.
  • I have a public key whose fingerprint is B793 750E 66F3 065B 8B84 2160 0C78 9771 CE93 44F3

To claim this, I am signing this object:

PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=monitoring.lynt.cz
Hostname=HOSTNAME
Include=/etc/zabbix/zabbix_agentd.d/*.conf
@lynt-smitka
lynt-smitka / remove_sensitiver_rest.php
Last active November 4, 2020 21:34
Remove sensitive user's data from the REST API response in WP
//Remove sensitive data from REST API
function lynt_remove_sensitive_data_from_rest( $response ) {
if(!current_user_can('list_users')){
//get WP_REST_Response
$data = $response->get_data();
//unset sensitive fields
if(preg_replace('/[\W]+/', '',$data['name']) == preg_replace('/[\W]+/', '',$data['slug'])) $data['name']="Author";
unset($data['link']);
@lynt-smitka
lynt-smitka / WP-unique-static-files.txt
Last active December 15, 2019 01:39
Unique static files in the particular WordPress versions
==4.7==
/customize-controls.js d89eff32867dbead906999d2d33df9dc
/customize-controls.min.js 13ec0e9534db67402cd8e3de6e2ebaeb
/customize-nav-menus.css 2e38f00fdfff5ee896dd3f15f06cf5d3
/customize-nav-menus.js 444b2358c6ad5e0be84b367b2e080a0f
/customize-nav-menus.min.css 080248c963bb67242f323af5cab56734
/customize-nav-menus.min.js bc754d8cb65e8b7cb92f6ec38f5b3632
/customize-nav-menus-rtl.css f47ee453000230a6e509e5eb09d21b53
/customize-nav-menus-rtl.min.css c859a7494e93d515ea023e845b862de0
function lynt_date_shortcode( $atts , $content = null ) {
$atts = shortcode_atts(
array(
'den' => 0,
'start' => '',
'stop' => '',
),
$atts,'lynt_date');
@lynt-smitka
lynt-smitka / wp_customize_mail_headers.php
Created June 24, 2017 10:43
Fix Sender for WordPress mail
add_action('phpmailer_init', 'lynt_customize_mail_headers');
function lynt_customize_mail_headers($phpmailer) {
$phpmailer->Sender = $phpmailer->From;
}
function lynt_gtm_head(){
$block = <<<'GTM_BLOCK'
/* GTM kód do <head> */
GTM_BLOCK;
echo $block;
}
function lynt_gtm_head( $classes ) {
#Do not copy&paste whole file, find only interesting parts!
#HTTP authentification
AuthType Basic
AuthName "Log in"
AuthUserFile /path/to/.htpasswd
Require valid-user
#Security headers
function lynt_remove_hentry( $class ) {
return array_diff( $class, array( 'hentry' ) );
}
add_filter( 'post_class', 'lynt_remove_hentry' );
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<?php
include "wp-config.php";
$conn = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if ($conn->connect_error) {