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 simple function that uses mtime to delete files older than a given age (in seconds) | |
* Very handy to rotate backup or log files, for example... | |
* | |
* $dir String whhere the files are | |
* $max_age Int in seconds | |
* return String[] the list of deleted files | |
*/ |
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
<? | |
$mobile_browser = false; // set mobile browser as false till we can prove otherwise | |
$user_agent = $_SERVER['HTTP_USER_AGENT']; // get the user agent value - this should be cleaned to ensure no nefarious input gets executed | |
$accept = $_SERVER['HTTP_ACCEPT']; // get the content accept value - this should be cleaned to ensure no nefarious input gets executed | |
switch(true){ // using a switch against the following statements which could return true is more efficient than the previous method of using if statements | |
case (preg_match('/ipad/i',$user_agent)); // we find the word ipad in the user agent | |
$mobile_browser = false; // mobile browser is either true or false depending on the setting of ipad when calling the function | |
$status = 'Apple iPad'; |
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
//chunk youtube-video-tpl | |
<div class="col-1-3"> | |
<a class="mediabox" rel="ytv" href="http://www.youtube.com/embed/[[+id]]"> | |
<img src="[[+thumb]]" alt=""> | |
<h3>[[+title]]</h3> | |
</a> | |
</div> | |
//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
<label>Street Address #: <small>123</small></label><br> | |
<input type="text" id="stAddNum"><br> | |
<label>Street Address Name: <small>Elm</small></label><br> | |
<input type="text" id="stAdd"><br> | |
<label>Address Type: <small>St, Ave, Ln, Rd, etc</small></label><br> | |
<input type="text" id="stAddPrefix"><br> | |
<label>City: </label><br> | |
<input type="text" id="city"><br> | |
<label>State: <small>Abbreviation</small></label><br> | |
<input type="text" id="state"><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
TimeEncryptor: | |
<?php | |
$encryptedValue = base64_encode(time()); | |
return $encryptedValue; | |
SpamKiller: | |
<?php | |
/* | |
Custom Spam Killer Functions | |
used in conjuction with <input type="hidden" name="formitTimeEncryptor" value="[[!TimeEncryptor]]" /> |
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 | |
header("Content-Type:application/json"); | |
$id = $_GET["id"]; | |
if(empty($id)){ die(); } | |
$obj = $modx->getObject('modResource', $id); | |
$output = []; |
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
/*~~~~ CONTAINERS December 2013 - http://www.w3counter.com/globalstats.php ~~~~*/ | |
/* 1600x900 4.09% */ | |
.container{ | |
margin: 0 auto; | |
padding:0; | |
height:auto; | |
width:1410px; /* 3 Columns would be 470px */ | |
} | |
/* 1440x900 5.26% */ | |
@media (max-width: 1440px){ .container{width: 1230px; /* 3 Columns would be 410px */ } } |
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 | |
//4 levels deep | |
$title = ''; | |
//first level parent | |
$parentId = $modx->resource->get('parent'); | |
if($parentId == 0){ | |
$title = $modx->parseChunk('interior-title', array('title' => $modx->resource->get('pagetitle') )); | |
return $title; |
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
Group 1 = Category | Combo Box | |
Group 2 = Keywords | Tag field | |
Category Template | |
Snippet = [[cateName]] | |
<?php | |
$get = modX::sanitize($_GET, $modx->sanitizePatterns); | |
$tag = ucfirst(urldecode($get['categories'])); | |
$tag = str_replace("-"," ", $tag); |
NewerOlder