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 | |
/** | |
* More info : http://www.google.com/support/webmasters/bin/answer.py?answer=189077&hl=en | |
*/ | |
/** | |
* Implements hook_preprocess_page() | |
*/ | |
function mymodule_preprocess_page(&$vars) { | |
global $language; |
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 | |
// To enable this, set 403 path to 'error-403' on admin/settings/error-reporting | |
// or do variable_set('site_403', 'error-403'); in a hook_update_N, in your .install file. | |
function mymodule_menu() { | |
return array( | |
'error-403' => array( | |
'title' => "Access denied", | |
'page callback' => 'mymodule_error_403', |
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 | |
function mymodule_update_N() { | |
$return = array(); | |
$blocks = mymodule_block('list'); | |
foreach($blocks as $delta => $block) { | |
$cache = ($block['cache']) ? $block['cache'] : BLOCK_CACHE_PER_ROLE; | |
$return[] = update_sql('UPDATE {blocks} SET cache = '.$cache.' WHERE module = "mymodule" AND delta = "'.$delta.'" '); |
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 | |
/** | |
* Implementation of hook_form_alter(). | |
*/ | |
function mymodule_form_alter(&$form, $form_state, $form_id) { | |
// Appelé la 1ere fois, sur node/add/mycontenttype | |
if($form_id == 'mycontenttype_node_form') { |
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
Les fichiers TXT ne doivent pas être lisibles. Ajouter au .htaccess : | |
<Files *\.txt> | |
order allow,deny | |
deny from all | |
</Files> | |
<Files robots\.txt> | |
order allow,deny | |
allow from all | |
</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
/** | |
* Implements hook_init(). | |
*/ | |
function mymodule_init() { | |
// Override Drupal default header. | |
// See http://www.journeymm.com/blogs/drupal/drupal-loginlogout-caching-problem | |
// and http://sriramk.com/blog/2007/06/firefox-and-ie-deal-with-no-cache.html | |
header("Cache-Control: no-store, no-cache, must-revalidate"); | |
header("Cache-Control: post-check=0, pre-check=0", FALSE); | |
} |
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 | |
// Add custom data to submission | |
function mymodule_webform_submission_load(&$submissions) { | |
foreach ($submissions as $sid => $submission) { | |
$submissions[$sid]->data['mydata']['value'][] = $mydata; | |
} | |
} | |
// Alter registry to override theme_webform_results_table |
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
// In a js file | |
disqus_config = function() { | |
this.callbacks.afterRender.push(function() { /* your code */ }); | |
this.callbacks.onNewComment.push(function() { /* your code */ }); | |
/* Available callbacks are afterRender, onInit, onNewComment, onPaginate, onReady, preData, preInit, preReset */ | |
} |
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
.rounded(@radius: 0) { | |
-webkit-border-radius: @radius; | |
-moz-border-radius: @radius; | |
border-radius: @radius; | |
} | |
.border-radius(@topright: 0; @bottomright: 0; @bottomleft: 0; @topleft: 0) { | |
-webkit-border-top-right-radius: @topright; | |
-webkit-border-bottom-right-radius: @bottomright; | |
-webkit-border-bottom-left-radius: @bottomleft; | |
-webkit-border-top-left-radius: @topleft; |
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
$.fn.enlargeYourClick = function(selector){ | |
$(selector).click(function(e){ | |
// don't handle if user click on a link, or if he click with mouse wheel | |
if (e.target.tagName != "A" && e.button != 1) { | |
var dest = $(this).find('a:first').attr('href'); | |
if (dest) {window.location = dest}; | |
} | |
}); | |
} |
OlderNewer