Skip to content

Instantly share code, notes, and snippets.

View jenswittmann's full-sized avatar

Jens Wittmann – Gestaltung & Entwicklung jenswittmann

View GitHub Profile
@jenswittmann
jenswittmann / index.css
Created January 23, 2025 10:54
Test File for @modxcms/revolution #16684
/*! normalize-scss | MIT/GPLv2 License | bit.ly/normalize-scss */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in
* IE on Windows Phone and in iOS.
*/
html {
line-height: 1.15; /* 1 */
@jenswittmann
jenswittmann / modx.jsgrps-min.js
Last active December 30, 2024 09:14
Test File for @modxcms/revolution #16667
/*
*
* Copyright (C) 2024 MODX LLC
*
* This file is part of MODX Revolution and was compiled using Grunt.
*
* MODX Revolution is free software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
@jenswittmann
jenswittmann / CurlyRandomGrid.html
Created October 15, 2024 12:49
CurlyRandomGrid
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8" />
<title>CurlyRandomGrid</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<style>
.grid {
display: grid;
@jenswittmann
jenswittmann / resizeImage.php
Last active October 22, 2023 11:20
MODX resizeImage Snippet (modern pthumb replacement with srcset generation and very low options, but works on IONOS too)
<?php
# vars
$lib = $modx->getOption("resizeImage_imageLib", null, "cli");
$libPath = $modx->getOption("resizeImage_imageLibPath", null, "/Applications/MAMP/Library/bin/convert");
$mode = $modx->getOption("mode", $scriptProperties, "");
$input = $modx->getOption("input", $scriptProperties, "");
$sizes = $modx->getOption("options", $scriptProperties, "");
$quality = $modx->getOption("quality", $scriptProperties, 70);
$cultureKey = $modx->getOption("cultureKey");
@jenswittmann
jenswittmann / pdf2image.php
Last active October 22, 2023 11:16
MODX pdf2image Snippet
<?php
# vars
$filePath = $modx->getOption('input', $scriptProperties, '');
$savePath = "assets/components/phpthumbof/cache/poster_" . md5($filePath) . ".jpg";
# check file exists and is PDF
if (!file_exists(MODX_BASE_PATH . $filePath) || mime_content_type(MODX_BASE_PATH . $filePath) != "application/pdf") {
return $filePath;
}
@jenswittmann
jenswittmann / restirctusermanagement.plugin.php
Created January 22, 2023 19:06
MODX CMP User restriction Plugin
<?php
if ($modx->context->get("key") == "mgr") {
if ($modx->user->get("sudo") || $modx->user->isMember("Administrator")) {
return;
}
switch ($modx->event->name) {
case "OnMODXInit":
$action = $modx->getOption("action", $_REQUEST, "");
@jenswittmann
jenswittmann / a readme.md
Created November 24, 2022 13:16 — forked from Mark-H/a readme.md
modCli; using MODX on the commandline.

modCLI

modCLI is a wrapper for the MODX Revolution Processors, allowing you to pretty much do anything from the commandline that you would normally do within the manager.

To use modCLI, simply download the modcli.php file and put it in the MODX_BASE_PATH of your installation. Next open up the console or terminal, and start firing some commands at it.

Syntax

@jenswittmann
jenswittmann / gist:9d052880af64d00793a619ad32c68c87
Created April 24, 2021 14:29
MODX MIGX CMP for News filtering by TV
{
"formtabs":"",
"contextmenus":"",
"actionbuttons":"",
"columnbuttons":"",
"filters":[
{
"MIGX_id":1,
"name":"categorie",
"label":"Kategorie",
@jenswittmann
jenswittmann / custom-js.html
Created March 4, 2021 10:47
Accordion for WordPress Lay Theme
<!-- Custom HTML at bottom -->
<script>
window.laytheme.on( "newpageshown", function( layoutObj, type, obj ) {
var akkordeonActiveClassName = "akkordeon--active",
akkordeonBtnEls = document.querySelectorAll("[href^='#akkordeon_']");
akkordeonBtnEls.forEach( function( akkordeonBtnEl, i ) {
var akkordeonChildClass = akkordeonBtnEl.getAttribute("href").replace("#", ""),
akkordeonChildEls = document.querySelectorAll( "." + akkordeonChildClass );
akkordeonBtnEl.addEventListener( "click", function( e ) {
@jenswittmann
jenswittmann / dateconvert.php
Created February 18, 2021 10:37
This MODX Snippet convert german date DD.MM.YYYY to YYYY-MM-DD
<?php
/**
* dateConvert
*
* DESCRIPTION
*
* This Snippet convert DD.MM.YYYY to YYYY-MM-DD
*
* PROPERTIES:
*