Skip to content

Instantly share code, notes, and snippets.

@Pathologic
Pathologic / gist:f9da96cce9de50872e505ab74a64351f
Created March 15, 2026 11:11
Evo snippets call converter to php
<!DOCTYPE html>
<html>
<head>
<title>Конвертер вызовов сниппетов MODX</title>
<style>
body { font-family: Arial, sans-serif; max-width: 800px; margin: 20px auto; padding: 0 20px; }
textarea { width: 100%; height: 200px; margin-bottom: 10px; font-family: monospace; }
.button-group { display: flex; gap: 10px; margin-bottom: 10px; }
button { padding: 10px 20px; background: #4CAF50; color: white; border: none; cursor: pointer; border-radius: 4px; }
button:hover { background: #45a049; }
<?php
if ($modx->event->name == 'OnWebPagePrerender') {
$_url = parse_url($_SERVER['REQUEST_URI']);
if($modx->resource->isfolder && !preg_match("/\/$/", $_url['path'])) {
$id = $modx->resource->id;
$url = isset($_url['query']) ? $modx->makeUrl($id, '', $_url['query']) : $modx->makeUrl($id);
$modx->sendRedirect($url, ['responseCode' => 'HTTP/1.1 301 Moved Permanently']);
}
}
<?php
class FastResource
{
protected $fields = array();
protected $tvs = array();
protected $tvIds = array();
protected $tvtpl = array();
protected $tvDefaults = array();
protected $modx = null;
public $newDoc = true;
<?php
/**
* parseTemplate
*
* to parse chunks with DLTemplate
*
* @category snippet
* @version 1.0.0
* @author Pathologic (https://github.com/pathologic)
*/
@Pathologic
Pathologic / plugin.js
Created July 10, 2018 15:42
update of tinymce modxlink plugin
/**
* modxlink.js
*
* Based on link.js but with resource search added.
*
* By default both pagetitle and alias are searched.
*
* Author: markwillis82
* Date: 7/7/15
* update 64j 8/11/17
//<?php
/**
* SG2TV
*
* saves first or last image from SimpleGallery to TV
*
* @category plugin
* @version 1.0.0
* @internal @properties &tvName=TV name;text; &templates=Templates;text; &position=Image to save;list;first,last;first
* @internal @events OnDocFormSave
@Pathologic
Pathologic / GroupByLetter.php
Created December 14, 2017 19:17
Группировка документов по букве
<?php
/* Пример вызова:
[!GroupByLetter?
&parents=`24`
&depth=`3`
&showParent=`0`
&tpl=`@CODE:<a href="[+url+]">[+pagetitle+]</a><br>`
&wrapTpl=`@CODE:<h1>[+letter+]</h1>[+wrap+]`
&ownerTPL=`@CODE:[+dl.wrap+]`
!]
@Pathologic
Pathologic / convert.php
Created December 2, 2017 07:14
MaxiGallery to Simple Gallery converter
<?php
define('MODX_API_MODE', true);
include_once("index.php");
$modx->db->connect();
if (empty ($modx->config)) {
$modx->getSettings();
}
include_once(MODX_BASE_PATH.'assets/plugins/simplegallery/lib/table.class.php');
$modx->invokeEvent("OnManagerPageInit");
$q = $modx->db->query("SELECT * FROM {$modx->getFullTableName('maxigallery')} ORDER BY `gal_id` ASC, `pos` ASC, `id` ASC");
<?php
/**
* Class DLpaginate
*/
class DLpaginate
{
/**
* Script Name: *Digg Style Paginator Class
* Script URI: http://www.mis-algoritmos.com/2007/05/27/digg-style-pagination-class/
<?php
/* filter by TV of date format */
/* &filters=`tvdate:mytv:=:2017-09-28` */
include_once ('tv.filter.php');
/**
* Created by PhpStorm.
* User: Pathologic
* Date: 28.09.17
* Time: 13:09
*/