Skip to content

Instantly share code, notes, and snippets.

View lynt-smitka's full-sized avatar

Vladimír Smitka lynt-smitka

View GitHub Profile
@lynt-smitka
lynt-smitka / putenv.php
Created April 17, 2022 12:18
Redefine putenv
if (!function_exists('putenv')) {
function putenv($string){
return false;
}
}
<?php
/**
* Plugin Name: Managed plugins
* Description: Managed plugins detection
* Author: Vladimir Smitka
* Author URI: https://lynt.cz/
* License: GNU General Public License v3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
7zip coreutils dig gawk git github greenshot grep gzip heidisql irfanview jq mpc-hc-fork netcat nmap pspad sed sumatrapdf totalcommander touch vim vscode wget winbox windows-terminal winmerge winscp xmlstarlet
@lynt-smitka
lynt-smitka / prefer_gd.php
Created March 24, 2022 14:36
WordPress default image editor
add_action( 'wp_image_editors', function() {
return array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' );
} );
add_filter( 'document_title_parts', function( $title ) {
if ( is_home() || is_front_page() ) {
unset($title['tagline']);
}
return $title;
} );
add_filter( 'document_title_parts', function( $title ) {
unset( $title['site'] );
return $title;
} );
@lynt-smitka
lynt-smitka / function.php
Created June 30, 2021 17:43
Oxygen - shortcode render
function lynt_save_oxygen( $meta_id, $object_id, $meta_key, $meta_value ) {
if ( 'ct_builder_shortcodes' !== $meta_key ) return;
$post = get_post( $object_id );
if ( 'page' !== $post->post_type ) return;
$content = "<!-- wp:html -->\n" . do_shortcode( $meta_value ) . "\n<!-- /wp:html -->";
$postarr = [
'ID' => $post->ID,
'post_content' => $content
];
wp_update_post( $postarr );
add_filter( 'wp_image_editors', 'lynt_wp_image_editors' );
function lynt_wp_image_editors( $editors ) {
//return array( 'WP_Image_Editor_GD' ); //only GD
//return array( 'WP_Image_Editor_Imagick' ); //only Imagick
}
<?php
echo realpath(__FILE__);