Skip to content

Instantly share code, notes, and snippets.

@vollyimnetz
vollyimnetz / complianz_custom_maps_example.php
Last active February 14, 2022 13:35
Working example of a custom maps integration with complianz (version 6).
<?php
/**
* Add immobilienMapCanvas to the list of complianz-placeholders.
* @param $tags
* @return array
*/
add_filter('cmplz_placeholder_markers', function($tags){
$tags['google-maps'][] = "immobilienMapCanvas";
return $tags;
@vollyimnetz
vollyimnetz / BackendLogger.php
Last active February 17, 2022 10:08
Wordpress Backend Logger
<?php
namespace tm;
/**
* @see https://gist.github.com/vollyimnetz/3670de82fd2b967722875627c27ea446
*/
class BackendLogger {
private static $secondsToRelaod = 5;
private static $version = '1.1';
@vollyimnetz
vollyimnetz / simpleXmlToArray
Created December 9, 2020 15:05 — forked from yeroon/simpleXmlToArray
Converts a simpleXML element into an array. Preserves attributes and everything.
/**
* Converts a simpleXML element into an array. Preserves attributes and everything.
* You can choose to get your elements either flattened, or stored in a custom index that
* you define.
* For example, for a given element
* <field name="someName" type="someType"/>
* if you choose to flatten attributes, you would get:
* $array['field']['name'] = 'someName';
* $array['field']['type'] = 'someType';
* If you choose not to flatten, you get:
@vollyimnetz
vollyimnetz / MessageAlert.vue
Created November 28, 2020 10:18
vuetify - global callable alert and confirm dialogs
<!--
HOW TO USE
add MessageAlert once anywhere inside your vuetify app.
On a place where it always get loaded, i.e. before the closing "v-app"
<MessageAlert entrypoint="my_entrypoint"></MessageAlert>
Now you can use it anywhere in your code:
### promise based
document.my_entrypoint.openAlert({ message:"Thats the text" }).then(() => {
console.log('Alert closed');
@vollyimnetz
vollyimnetz / image-preload.js
Last active October 7, 2020 13:40
image-preload (jQuery based)
/*
@see https://gist.github.com/vollyimnetz/1df01fd0fd87af4564b545a67bec663d
HOW TO USE
data-image-preload="URL"
will add .preloadOverlay as soon as the function kicks in
will add .loaded as soon as the image is loaded
CODE
<div class="imageHolder" style="background-image:url('<?php esc_attr_e($thumb) ?>')" data-image-preload="<?php esc_attr_e($thumb) ?>">
<a class="addToLightbox" href="<?php esc_attr_e($full) ?>"></a>
</div>