This file contains hidden or 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 | |
function {theme_name}_preprocess(&$vars, $hook) { | |
if (arg(0) != 'admin' && $hook == "page") { | |
// Get an array of all JavaScripts that have been added | |
$javascript = drupal_add_js(NULL, NULL, 'header'); | |
// Remove the original jQuery library and Drupal's JS include | |
unset($javascript['core']['misc/jquery.js']); | |
unset($javascript['core']['misc/drupal.js']); | |
This file contains hidden or 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 | |
function daterange_range($starttime, $endtime = null) { | |
$return = ""; | |
//set the endtime to the start time if there isn't an endtime provided | |
$endtime = empty($endtime) ? $starttime : $endtime; | |
//turn them into timestamps if they are not timestamps already | |
$endtime = ((int)$endtime == $endtime && is_int($endtime))? $endtime:strtotime($endtime); | |
$starttime = ((int)$starttime == $starttime && is_int($starttime))? $starttime:strtotime($starttime); | |
//boolean values to prevent test duplication, |
This file contains hidden or 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 | |
//$values is an associative array where the keys are field names and values are the values we want in the database | |
//create a string with enough %s's for fields and values. Wrap the values in single quotes. | |
$percents_fields = ""; | |
$percents_values = ""; | |
foreach($values as $field => $value) { | |
$percents_fields = "%s, "; |
This file contains hidden or 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
//change the # in the url when switching tabs | |
//makes refresh work! | |
$("#tabsMenu li a").click(function(){ | |
window.location.hash = $(this).attr("href"); | |
}); | |
//make back/forward buttons work on tabs | |
if($("#tabsMenu").length > 0) { | |
//prevent scrolling when clicking on a tab | |
var doit = true; |
This file contains hidden or 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 | |
$ops = array('-', '+'); | |
$answer = -1; | |
while($answer < 0 || $answer > 99) { | |
$num1 = rand(0, 100); | |
$num2 = rand(0, 100); | |
$num1 -= 50; | |
$num2 -= 50; |
This file contains hidden or 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 | |
$uid = 120; | |
$user = user_load(array('uid' => $uid)); | |
$op = 'status_activated'; | |
_user_mail_notify($op, $user); |
This file contains hidden or 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 | |
//you could also add this to your theme's template.php file, by replacing "phptemplate_image_button" with "themename_image_button" in the function name. | |
function phptemplate_image_button($element) { | |
// Make sure not to overwrite classes. | |
if (isset($element['#attributes']['class'])) { | |
$element['#attributes']['class'] = 'form-'. $element['#button_type'] .' '. $element['#attributes']['class']; | |
} | |
else { | |
$element['#attributes']['class'] = 'form-'. $element['#button_type']; | |
} |
This file contains hidden or 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 | |
//we want the node, outside of node.tpl.php! | |
$node = $variables['node']; |
This file contains hidden or 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
$('<img>').attr('src',function(){ | |
return $('#mydiv1').css('background-image'); | |
}).load(function(){ | |
$('<img>').attr('src',function(){ | |
return $('#mydiv2').css('background-image'); | |
}).load(function(){ | |
$('<img>').attr('src',function(){ | |
return $('#mydiv3').css('background-image'); | |
}).load(function(){ | |
//done loading background images of all 3 divs |
This file contains hidden or 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
<Macro name="Die Print_r" Ctrl="yes" Alt="yes" Shift="no" Key="68"> | |
<Action type="0" message="2304" wParam="0" lParam="0" sParam="" /> | |
<Action type="1" message="2170" wParam="0" lParam="0" sParam="d" /> | |
<Action type="1" message="2170" wParam="0" lParam="0" sParam="i" /> | |
<Action type="1" message="2170" wParam="0" lParam="0" sParam="e" /> | |
<Action type="0" message="2326" wParam="0" lParam="0" sParam="" /> | |
<Action type="0" message="2326" wParam="0" lParam="0" sParam="" /> | |
<Action type="0" message="2326" wParam="0" lParam="0" sParam="" /> | |
<Action type="1" message="2170" wParam="0" lParam="0" sParam="e" /> | |
<Action type="1" message="2170" wParam="0" lParam="0" sParam="c" /> |