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 mycommands_drush_command() { | |
$items = array(); | |
$items['one-command'] = array( | |
'description' => 'A command requiring two arguments.', | |
// Declare required arguments. | |
'arguments' => array( | |
'arg1' => 'arg1 description', | |
'arg2' => 'arg2 description', |
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 | |
/** | |
* Contents for file MODULE.module | |
*/ | |
/** | |
* Implements hook_theme(). | |
* | |
* Define here a theme hook to be implemented within MODULE.theme.inc as function theme_THEMEHOOK($vars) {} |
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
class roundcube( | |
$dbprovider, | |
$dbuser = 'roundcube', | |
$dbpass = unset, | |
$dbname = 'roundcube') { | |
#... | |
$defaults = { | |
config => {}, |
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 | |
/** | |
* Implements hook_form_FORM_ID_alter() for node type 'test'. | |
* | |
* Hide field_texto. | |
*/ | |
function fieldautovalue_form_test_node_form_alter(&$form) { | |
$form['field_texto']['#access'] = 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 | |
$URL = 'http://example.com/login.php'; | |
$user = 'USER'; | |
$pass = 'PASS'; | |
$cookie_path = dirname(__FILE__).'/cookie.txt'; | |
/** | |
* Hace login en la web enviando un POST con el usuario y contraseña. |
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 | |
/** | |
* Menu callback. | |
*/ | |
function this_is_a_menu_callback() { | |
$header = array('nid' => 'ID', 'title' => 'Title'); | |
$query = db_select('node', 'n', array('fetch' => PDO::FETCH_ASSOC)) | |
->fields('n', array('nid', '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
<?php | |
/** | |
* Implements hook_commerce_order_update(). | |
*/ | |
function HOOK_commerce_order_update($order) { | |
// Detect a status change. | |
if ($order->status != $order->original->status) { | |
$status = commerce_order_status_load($order->status); | |
$state = commerce_order_state_load($status['state']); |
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 | |
/** | |
* Field handler to present an edit link to a cart line item. | |
*/ | |
class MODULENAME_handler_field_cart_line_item_link_edit extends commerce_cart_handler_field_cart_line_item_link_edit { | |
function render($values) { | |
$text = !empty($this->options['text']) ? $this->options['text'] : t('edit'); | |
$line_item_id = $this->get_value($values, 'line_item_id'); |
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
#!/usr/bin/python | |
# -*- coding: UTF-8 -*- | |
# set the minimum disk space available to alert on (in GB). | |
minimum = 5 | |
# disk space variation (in GB) threshhold. 'delta GB have been consumed between the last two checks'. | |
delta = 1 | |
import commands | |
import pickle |
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 | |
// Array of type => format. | |
$formats = array( | |
'day_monthname_year' => 'j \d\e F \d\e Y', | |
'weekday_day_monthname_year' => 'l j \d\e F \d\e Y', | |
); | |
$query_types = db_insert('date_format_type')->fields(array('type', 'title')); | |
$query_formats = db_insert('date_formats')->fields(array('format', 'type')); | |
foreach ($formats as $type => $format) { |
OlderNewer