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 / 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:
*
@jenswittmann
jenswittmann / csvparse.php
Created February 18, 2021 10:37
This MODX Snippet parse CSV Data and return it to chunk
<?php
/**
* csvParse
*
* DESCRIPTION
*
* This Snippet parse CSV Data and return it to chunk
*
* PROPERTIES:
*
@jenswittmann
jenswittmann / alphabeticalLetters.php
Last active February 15, 2021 13:17
Get alphabetical Letters from MODX PDO Collection
<?php
/**
* alphabeticalLetters
*
* DESCRIPTION
*
* This Snippet return alphabetical Letters from Collection
*
* PROPERTIES:
*