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 | |
$html_dom = filter_dom_load($body); | |
$links = $html_dom->getElementsByTagName('a'); | |
foreach ($links as $link) { | |
$url = $link->getAttribute('href'); | |
// Do something. | |
$link->setAttribute('href', $url); | |
$link->setAttribute('rel', 'nofollow'); | |
} | |
return filter_dom_serialize($html_dom); |
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
(function($) { | |
Drupal.behaviors.Foo = { | |
attach:function (context, settings) { | |
// unbind() because click events firing multiple times. | |
$('#foo a.update', context).unbind().click(function (event) { | |
// Get parrent of item. | |
var item = $(this).closest(".item"); | |
// Get some data of item. |
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
#!/bin/bash | |
echo "Select on option:" | |
echo "1) Set up new PoPToP server AND create one user" | |
echo "2) Create additional users" | |
read x | |
if test $x -eq 1; then | |
echo "Enter username that you want to create (eg. client1 or john):" | |
read u | |
echo "Specify password that you want the server to use:" | |
read p |
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 bar_form($form, &$state) { | |
$form['bar'] = array( | |
'#type' => 'textfield', | |
'#title' => t('Bar'), | |
'#autocomplete_path' => 'taxonomy/autocomplete/field_bar_term', // Field name here. | |
'#element_validate' => array('foo_taxonomy_autocomplete_validate'), | |
); | |
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
(function ($) { | |
Drupal.behaviors.moduleName = { | |
attach: function(context, settings) { | |
console.log(settings.module_name.foo); // bar | |
} | |
}; | |
})(jQuery); |
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 | |
$foo = isset($array['foo']) ? $array['foo'] : null; | |
$bar = isset($array['bar']) ? $array['bar'] : null; | |
# With php notices | |
$foo = $array['foo'] ? : null; | |
$bar = $array['bar'] ? : null; | |
# DefaultingArrayObject |
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 | |
/** | |
* Implements hook_rules_event_info(). | |
*/ | |
function hook_rules_event_info() { | |
return array( | |
'list_of_users' => array( | |
'label' => t('List of users example'), | |
'group' => t('Example'), | |
'variables' => array( |
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 | |
ctools_include('ajax'); | |
ctools_include('modal'); | |
ctools_modal_add_js(); | |
drupal_add_library('module', 'fancybox.modal'); // Include js here. | |
$path = 'some_path/nojs'; | |
$content = ctools_modal_text_button($text, $path, '', $class); |
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
[{"id":1,"name":"X99.7","description":"Not known","value":"X99.7"},{"id":2,"name":"X99.8","description":"Outpatient procedure carried out but no appropriate OPCS-4 code available","value":"X99.8"},{"id":3,"name":"X99.9","description":"No outpatient procedure carried out","value":"X99.9"},{"id":4,"name":"A01.3","description":"Partial lobectomy of brain","value":"A01.3"},{"id":5,"name":"A01.8","description":"Other specified major excision of tissue of brain","value":"A01.8"},{"id":6,"name":"A01.9","description":"Unspecified major excision of tissue of brain","value":"A01.9"},{"id":7,"name":"A02.4","description":"Excision of lesion of tissue of occipital lobe of brain","value":"A02.4"},{"id":8,"name":"A02.5","description":"Excision of lesion of tissue of cerebellum","value":"A02.5"},{"id":9,"name":"A03.4","description":"Stereotactic ablation of tissue of brain stem","value":"A03.4"},{"id":10,"name":"A03.9","description":"Unspecified stereotactic ablation of tissue of brain","value":"A03.9"},{"id":11,"name":"A04. |
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 | |
/** | |
* Implements hook_entity_info_alter(). | |
*/ | |
function foo_entity_info_alter(&$entity_info) { | |
$entity_info['node']['view modes']['another_teaser'] = array( | |
'label' => t('Another teaser'), | |
'custom settings' => TRUE, | |
); |