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
// from here: http://www.concrete5.org/documentation/how-tos/developers/dynamically-concatenate-minify-gzip-and-server-side-cache-multip/ | |
function minifyCSS($css) { | |
$css = trim($css); | |
$css = str_replace("\r\n", "\n", $css); | |
$search = array("/\/\*[^!][\d\D]*?\*\/|\t+/", "/\s+/", "/\}\s+/"); | |
$replace = array(null, " ", "}\n"); | |
$css = preg_replace($search, $replace, $css); | |
$search = array("/;[\s+]/", "/[\s+];/", "/\s+\{\\s+/", "/\\:\s+\\#/", "/,\s+/i", "/\\:\s+\\\'/i", "/\\:\s+([0-9]+|[A-F]+)/i", "/\{\\s+/", "/;}/"); | |
$replace = array(";", ";", "{", ":#", ",", ":\'", ":$1", "{", "}"); |
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
function getTheURL($url_id) { | |
$opg = Page::getById($url_id); | |
$url=Loader::helper('navigation'); | |
$canonical=$url->getCollectionURL($opg); | |
$canonical=preg_replace("/index.php\?cID=1$/","",$canonical); | |
echo $canonical; | |
} | |
<a href="<?php getTheURL(140); ?>"> |
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
$owner = $c->getVersionObject()->getVersionAuthorUserName(); |
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
function truncate($string,$words) { | |
$truncated = preg_replace('/((\w+\W*){' . $words . '}(\w+))(.*)/', '${1}', $string); | |
if ( strlen($string) > strlen($truncated) ) { | |
$truncated .= '...'; | |
} | |
return $truncated; | |
} |
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
$c->getCollectionTypeHandle(); |
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
$currentPage = Page::getCurrentPage(); | |
if ($currentPage->getCollectionID() == 1) { | |
... | |
} |
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
$a = new Area('Main'); | |
$a->display($c); |
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
// Stack | |
$nav = Stack::getByName('main_nav'); | |
$nav->display(); | |
// Block | |
$nav = Block::getByName('main_nav'); | |
$nav->display(); |
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
$u = new User; | |
if ( $u->isLoggedIn() ){ | |
... | |
} |
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
global $c; | |
if ($c->isEditMode()) { | |
} |
NewerOlder