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 | |
use SilverStripe\CMS\Controllers\ContentController; | |
use SilverStripe\Control\Director; | |
use SilverStripe\Core\Environment; | |
/** | |
* Below are some methods that can be added to PageController for use in partial caching blocks. | |
* Example: <% cached $EnvCacheKey, $ClassCacheKey('SilverStripe\CMS\Model\SiteTree') unless $DontCache %> | |
*/ |
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 | |
class UniqueURLSegmentExtension extends DataExtension | |
{ | |
private static $db = array( | |
'URLSegment' => 'Varchar(255)', | |
); | |
public function onBeforeWrite() | |
{ |
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
#!/bin/bash | |
# CloudWays - Download local backups for all applications | |
# ======================================================= | |
# * Local backups must be enabled and available. See https://support.cloudways.com/how-to-download-a-full-backup/ | |
# * Add your machine's SSH key to your server so this script needs no input. | |
# * Backups will be saved inside a new folder with today's date within your nominated backup directory. (This might not be the date the backup was taken.) | |
# * Only tested on Digital Ocean VPS so far. | |
# Configuration |
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
<h3>Drag these links in to a folder on your bookmarks bar for easy access</h3> | |
<p> | |
<a href="javascript:void(function(){popDestination = (baseTag = document.getElementsByTagName('base')[0]) ? baseTag.getAttribute('href') + 'dev/' : window.location.protocol + '//' + window.location.host + '/dev/'; window.open(popDestination);})();"> | |
SS:Dev</a><br /> | |
<a href="javascript:void(function(){popDestination = (baseTag = document.getElementsByTagName('base')[0]) ? baseTag.getAttribute('href') + 'dev/build/?flush=all' : window.location.protocol + '//' + window.location.host + '/dev/build/?flush=all'; window.open(popDestination);})();"> | |
SS:Build</a><br /> | |
<a href="javascript:void(function(){popDestination = (baseTag = document.getElementsByTagName('base')[0]) ? baseTag.getAttribute('href') + 'admin/' : window.location.protocol + '//' + window.location.host + '/admin/'; window.open(popDestination);})();"> | |
SS:CMS</a><br /> | |
<a href="javascript:window.location.search = 'flush=all'"> | |
SS:Flush</a><br /> |
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 | |
/** | |
* TextRaw2P class. | |
* Apply this extension to the Text class to access $YourText.Raw2P in templates. | |
* | |
*/ | |
class TextRaw2P extends DataExtension { | |
private static $casting = array( |
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 | |
/** | |
* Hello Page. | |
* Landing page for users when they log in to the website | |
* @author jonom | |
*/ | |
class HelloPage_controller extends Page_controller { | |
/** | |
* Restrict access to logged in users at a minimum |
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 | |
class MaxWidthHeightImageExtension extends DataExtension { | |
/** | |
* Crop an image if it exceeds a certain height. | |
* Use in templates e.g. $Image.SetWidth(200).MaxHeight(200) | |
* | |
* @param integer $maxHeight Max height of image | |
* @return Image |
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 | |
class BalancedImageExtension extends DataExtension { | |
/** | |
* Creates a scaled image that fits within a given container and does not exceed a specified area (square space). | |
* Useful for ensuring a series of images of various dimensions (especially logos) have approximately the same visual weight. | |
* Use in templates with $BalancedImage | |
* | |
* @param integer $containerWidth Max width of image |