Skip to content

Instantly share code, notes, and snippets.

View Stanton's full-sized avatar
💃

Paul Stanton Stanton

💃
View GitHub Profile
@Stanton
Stanton / gist:1200761
Created September 7, 2011 14:48
imageGenerator
<?php
/**
* image Generator -- see trac ticket #778
*
* takes an image and does some magic on it.
*/
/**
* Resizes an image
*
* Once an image has been generated by this function, it is cached and subsequent
@Stanton
Stanton / gist:1167702
Created August 24, 2011 09:58
Just for funzies
<?php
// Now this is a story, all about how my $dirTree got flipped-turned upside down
$reversed_dirTree = array_reverse($dirTree);
// and I'd like to take a minute, just sit right there, I'll tell you how loop the object to get the default category down there.
foreach ($reversed_dirTree as $dirTree_category) {
if (in_array($dirTree_category->name, $directory_category_names)) {
$parent_cat_name = $dirTree_category->name;
}
}
?>
<?php
$value = ($short_form == 'sent') ? 'Sent' : 'Send';
?>
<input type="submit" value="<?=$value;?>" />
<?php
function getNeighbours($moblog, $limit = 3, $order = 'Moblog.modified') {
// check for existence of order param in session, and use it if so
if ($this->Session->check('Moblog.order')) {
$order = $this->Session->read('Moblog.order');
}
// modify the find statements based on the order param
$(document).ready(function(){
setTimeout(function() {
document.body.innerHTML = document.body.innerHTML.replace(/\u200a/g, " ");
return true;
}, 0);
});
$(document).ready(function(){
$('body').html( $('body').html().replace(/\s—\s/g, " — ") );
});
<?php
// get the parent category name
$ektcat = trim($dirTree[0]->name);
// Detect category and insert section header images
if($ektcat==='Student Enterprise') {
print header_image('student_enterprise_image2.jpg',$ektcat);
print '
<ul class="section_subnavigation">
<? the_tags(
"<ul class=\"entry-tags\">\r\n\t\t\t\t\t<li><strong>Tags:</strong></li>\r\n\t\t\t\t\t<li>",
"</li>\r\n\t\t\t\t\t<li>",
"</li>\r\n\t\t\t\t</ul>"
); ?>
<?php
$query = $select
.COURSEFINDER_TABLE.".id,
".COURSEFINDER_TABLE.".type,
".COURSEFINDER_TABLE.".programTitle,
".COURSEFINDER_TABLE.".UCAScode,
".COURSEFINDER_TABLE.".adminID,
".COURSEFINDER_METADATA_TABLE.".subject,
".COURSEFINDER_METADATA_TABLE.".description " .
"FROM ".COURSEFINDER_TABLE." " .
<?php
function functions() {
// actions for individual moblogs, rotate, hide & delete
if(!empty($this->data)) {
$redirect = '/moblogs/view/'.$this->data['Moblog']['id'];
if(isset($this->data['Function']['nsfw'])) {
if(isset($this->data['Function']['nsfw'])) {
//update dbase to set NSFW flag
$this->Moblog->nsfw($this->data['Moblog']['id'],$this->data['Function']['nsfw']);
$log = ($this->data['Function']['nsfw']) ? 'NSFW' : 'SAFE';