View module.php
This file contains 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 | |
// https://jonleverrier.com/notes/weeknote-2 | |
// - If the request is not from the control panel | |
// - If the request is not from the console | |
// - If a user is not logged in (for debug toolbar in the front-end) | |
if ( | |
!Craft::$app->request->isCpRequest && | |
!Craft::$app->request->isConsoleRequest && | |
!Craft::$app->getUser()->getIdentity() | |
) |
View sitemap.twig
This file contains 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
{# | |
Craft CMS 3 Sitemap Example | |
This sitemap example presumes you have some custom fields setup. These are: | |
- contentShowInSitemap | |
- contentSitemapChangeFreq | |
- contentSitemapPriority | |
#} | |
{# | |
Sitemap Configuration |
View gulpfile.js
This file contains 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
// Alphasite Build Tool | |
// Verion: 2.0 | |
// Author: jon@youandme.digital | |
// | |
// Built and tested on: | |
// - Node: v.10.14.1 | |
// - NPM: v.6.4.1 | |
// - Gulp: v.4.0 | |
// load required npm plugins (from a-z) |
View getAsset.snippet.php
This file contains 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 | |
/** | |
* getAsset | |
* v.0.0.2 | |
* | |
* This snippet retrieves CSS and JS files from your local file system, | |
* which is handy when you are adding a revision suffix to your build files. | |
* For example: 's.min.cdbbec54.js' or 'c.min.543e2b40.css'. | |
* | |
* The script attempts to serve and look for the latest file in |
View criticalCSS.snippet.php
This file contains 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 | |
/** | |
* Critical CSS | |
* v.0.0.3 | |
* | |
* This snippet helps you manage and serve your critical CSS in MODX. | |
* It does not generate critical CSS (ccss) for you. | |
* | |
* Why use ccss when we have http/2? | |
* Serving ccss when using http/2 still optimises First Contentful Paint, |
View welcomeMessage.plugin.php
This file contains 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 | |
/** | |
* A sample plugin to display the "welcome message" to all users, login for the first time in Revo manager | |
* | |
* @var modX $modx | |
* @var array $scriptProperties | |
* @var modPlugin $this | |
* | |
* @see modPlugin::process() | |
* |
View logOutput.snippet.php
This file contains 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 | |
/* | |
logOutput snippet for MODX | |
Use like this: | |
[[!logOutput? &input=`[[+placeholder]]`]] or | |
*/ | |
if (empty($input)) { |
View getFormSteps.snippet.php
This file contains 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 | |
/** | |
* getFromSteps v.1.0 | |
* An unoffical utility snippet for Formalicious by Sterc | |
* | |
* This utility snippet outputs all the steps for a multistep form | |
* based on a given form ID | |
* | |
* Usage: | |
* Put the snippet in your &stepTpl and call the snippet like this: |
View pdfcrowd.plugin.php
This file contains 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 | |
/** | |
* PDF Crowd MODX Plugin | |
* | |
* Using the API from PDF Crowd, this plugin will convert a MODX resource in to | |
* PDF format and then save it to your web server in a specified location. | |
* | |
* The plugin is setup to trigger witin a certain MODX context. | |
* For example, a "pdf" context. | |
* |
View getImgSizeFromUrl.snippet.php
This file contains 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 | |
/** | |
* getImgSizeFromUrl snippet for MODX | |
* Retrieves the height and width of an image from a remote url | |
* | |
* example usage: [[!getImgSizeFromUrl? &url='https://path/to/myimg.jpg' &tpl=`myTpl`]] | |
* placeholders to use in the myTpl chunk are [[+height]]] and [[+width]] | |
* | |
* @author Jon Leverrier (jon@youandmedigital.com) | |
* @version 1.0 |
NewerOlder