Skip to content

Instantly share code, notes, and snippets.

<?php
function budget_theme_registry_alter(&$theme_registry) {
$theme_hook = 'node';
$modulepath = drupal_get_path('module', 'budget');
array_unshift($theme_registry[$theme_hook]['theme paths'], $modulepath);
}
?>
@ceejayoz
ceejayoz / gist:139687
Created July 2, 2009 20:15
Removes nasty MS Word characters from HTML content.
$text = str_replace(chr(130), ',', $text); // baseline single quote
$text = str_replace(chr(132), '"', $text); // baseline double quote
$text = str_replace(chr(133), '...', $text); // ellipsis
$text = str_replace(chr(145), "'", $text); // left single quote
$text = str_replace(chr(146), "'", $text); // right single quote
$text = str_replace(chr(147), '"', $text); // left double quote
$text = str_replace(chr(148), '"', $text); // right double quote
$text = mb_convert_encoding($text, 'HTML-ENTITIES', 'UTF-8');
$items['user/%user/billing'] = array(
'title' => 'Billing',
'page callback' => 'drupal_get_form',
'page arguments' => array('easy_accounts_billing', 1),
'access callback' => TRUE,
'type' => MENU_LOCAL_TASK,
);
<?php
$html = file_get_contents('http://nothnagle.travidia.com/ROP/Ads.aspx?advid=1105344');
preg_match('@<img.+class="adimg".+src="(.*)".*>@Uims', $html, $matches);
$image = $matches[1];
<?php
function google_analytics() {
print "<script type=\"text/javascript\">\n";
print "var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\n";
print "document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));\n";
print "</script>\n";
print "<script type=\"text/javascript\">\n";
print "var pageTracker = _gat._getTracker(\"UA-2899761-10\");\n";
print "pageTracker._initData();\n";
<?php
function classifieds_menu() {
$items = array();
$items['admin/classifieds'] = array(
'title' => 'Classifieds system',
'description' => 'Administer the classifieds system.',
'access arguments' => array('access administration pages'),
'position' => 'left',
$view = new view;
$view->name = 'admin_users';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'users';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
<link type="text/css" rel="stylesheet" href="https://fast.fonts.com/cssapi/b3de3c2a-3625-4aa0-9c59-be2c40df6073.css"/>
font-family:'HelveticaNeueW02-55Roma';
font-family:'HelveticaNeueW01-56It';
font-family:'HelveticaNeueW02-57Cn';
font-family:'HelveticaNeueW01-65Medi';
font-family:'HelveticaNeueW01-66Medi'; (MediumItalic)
font-family:'HelveticaNeueW01-67MdCn 692710';
font-family:'HelveticaNeueW01-67MdCn 692713';
font-family:'HelveticaNeueW01-75Bold';
[**Please, don't use `mysql_*` functions in new code**](http://bit.ly/phpmsql). They are no longer maintained [and are officially deprecated](http://j.mp/XqV7Lp). See the [**red box**](http://j.mp/Te9zIL)? Learn about [*prepared statements*](http://j.mp/T9hLWi) instead, and use [PDO](http://php.net/pdo) or [MySQLi](http://php.net/mysqli) - [this article](http://j.mp/QEx8IB) will help you decide which. If you choose PDO, [here is a good tutorial](http://j.mp/PoWehJ).

Please, don't use mysql_* functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.

INSERT INTO `checklist` (`id`, `type_id`, `setting_key`, `not_empty`, `should_configure`, `must_configure`)
VALUES
(1, 1, 'form', '', 'Most users opt to customize the entry form to some extent.', ''),
(2, 1, 'rules', 'You must provide rules governing your promotion.', '', 'You must provide rules governing your promotion.'),
(3, 1, 'abbreviated_rules', 'You must provide abbreviated rules.', '', '');