This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* FixedPreLite plugin | |
* | |
* * | |
* Updated by matdave <https://matdave.com> | |
* * | |
* Original author Bob Ray <http://bobsguides.com> | |
* Copyright 2011-2014 Bob Ray | |
* 3/23/11 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$regex = <<<'END' | |
/ | |
( | |
(?: [\x00-\x7F] # single-byte sequences 0xxxxxxx | |
| [\xC0-\xDF][\x80-\xBF] # double-byte sequences 110xxxxx 10xxxxxx | |
| [\xE0-\xEF][\x80-\xBF]{2} # triple-byte sequences 1110xxxx 10xxxxxx * 2 | |
| [\xF0-\xF7][\x80-\xBF]{3} # quadruple-byte sequence 11110xxx 10xxxxxx * 3 | |
){1,100} # ...one or more times |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location ~* \.(?:ico|css|js|jpe?g|png|gif|svg|pdf|mov|mp4|mp3|woff|woff2|otf|ttf)$ { | |
expires 7d; | |
add_header Pragma public; | |
add_header Cache-Control "public"; | |
gzip_vary on; | |
rewrite ^/(it|de|es|fr|cz)(/.*)$ $2 last; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** elFinder Plugin Options **/ | |
switch ($modx->event->name) { | |
case 'FredOnElfinderRoots': | |
$params = $modx->getOption('params', $scriptProperties); | |
if (empty($params)) return false; | |
// Enable Sanitizer | |
$params->bind['upload.pre mkdir.pre mkfile.pre rename.pre archive.pre ls.pre'][] = 'Plugin.Sanitizer.cmdPreprocess'; | |
$params->bind['paste.copyfrom upload.presave'][] = 'Plugin.Sanitizer.onUpLoadPreSave'; | |
$params->plugin['Sanitizer'] = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
switch ($modx->event->name) { | |
case "OnFileManagerUpload": | |
if(!empty($files)){ | |
foreach($files as $file){ | |
$path = $directory . $source->sanitizePath($file['name']); | |
$object = $source->getObjectContents($path); | |
if(empty($object) || empty($object['mime']) || empty($object['content'])) continue; | |
switch($object['mime']) { | |
case 'image/svg': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(empty($input)) return; | |
$url = rtrim($modx->getOption('site_url'), '/').'/'.ltrim($input,'/'); | |
echo "<meta name=\"image\" property=\"og:image\" content=\"$url\" />"; | |
$path = rtrim($modx->getOption('base_path'), '/').'/'.ltrim($input,'/'); | |
$size = @getimagesize($path); | |
if ($size) { | |
$width = $size[0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const showrandom = document.querySelectorAll("[showrandom]"); | |
showrandom.forEach(el=>{ | |
const count = el.getAttribute('showrandom') ? el.getAttribute('showrandom') : 1; | |
const children = el.children; | |
while(children.length > count){ | |
const random = Math.floor(Math.random() * children.length); | |
children[random].remove(); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$base_path = dirname(__FILE__) . '/content/'; | |
if($_GET['q']) { | |
$q = explode('?', $_GET['q']); | |
$file_check = $base_path.preg_replace('"\.html$"', '.php', $q[0]); | |
if (substr($file_check, -1) == "/") { | |
$file_check .= "index.php"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//** On WebPage Pre-Render **// | |
$corePath = $modx->getOption('preview.core_path', null, $modx->getOption('core_path') . 'components/preview/'); | |
require_once $corePath . '/model/preview/preview.class.php'; | |
$preview = new Preview($modx); | |
if(!$modx->user->hasSessionContext('mgr')) return; // currently forcing manager context | |
if(!$modx->getOption('preview.frontendEnabled')) return; // currently forcing manager context | |
$qsItem = $modx->getOption('preview.previewKey'); | |
$compareItem = $modx->getOption('preview.compareKey'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
devices: ( | |
{ | |
name: "Wireless Mouse MX Master 2S"; | |
smartshift: | |
{ | |
# Do not enable free scroll | |
on: true; | |
threshold: 15; # 7 is ideal for work | |
}; | |
hiresscroll: |