View source
<?php
function example_update_7000() {
$ret = array();
return $ret;
return $ret;
if (TRUE) {
$ret = array();
return $ret;
}
}
function example_update_7001() {
$ret = array();
return $ret;
}
function example_update_7002() {
$ret = array();
return $ret;
}
function example_absolute_includes() {
define('EVENT_PATH', drupal_get_path('module', 'event'));
include EVENT_PATH . '/event.theme';
require EVENT_PATH . '/ical.inc';
include EVENT_PATH . '/event.theme';
require EVENT_PATH . '/ical.inc';
include './' . $path;
require './' . $path;
include $path;
require $path;
if (variable_get('event_nodeapi_' . $form['type']['#value'], 'never') != 'never') {
include_once EVENT_PATH . '/event_timezones.inc';
require_once EVENT_PATH . '/event_timezones.inc';
}
include_once './' . drupal_get_path('module', 'og_panels') . '/includes/groupcontext.inc';
include_once drupal_get_path('module', 'og_panels') . '/includes/groupcontext.inc';
echo './' . drupal_get_path('module', 'og_panels') . '/includes/groupcontext.inc';
if (function_exists('drupal_set_content')) {
if (module_exists('content')) {
include_once drupal_get_path('module', 'fivestar') . '/fivestar_field.inc';
}
}
if (module_exists('comment')) {
include_once drupal_get_path('module', 'fivestar') . '/fivestar_comment.inc';
}
include_once drupal_get_path('module', 'fivestar') . '/fivestar_color.inc';
require_once drupal_get_path('module', 'transactions') . '/transactions.inc';
}
function example_function_exists() {
if (function_exists('xx')) {
}
if (function_exists($xx['y'])) {
}
}
function example_set_session() {
$_SESSION['site_offline'] = variable_get('site_offline', FALSE);
if ($_SESSION['site_offline'] == FALSE) {
variable_set('site_offline', TRUE);
}
$_SESSION['update_results'] = $results;
$_SESSION['update_success'] = $success;
$_SESSION['updates_remaining'] = $operations;
$_SESSION['batch_form_state'] = $_batch['form_state'];
if ($message) {
if (!isset($_SESSION['messages'])) {
$_SESSION['messages'] = array();
}
}
if (!isset($_SESSION['messages'][$type])) {
}
$_SESSION['book_update_6000_orphans']['from'] = 0;
$_SESSION['book_update_6000'] = array();
$_SESSION['dblog_overview_filter'][$name] = $form_state['values'][$name];
$_SESSION['dblog_overview_filter'] = array();
$session =& $_SESSION['node_overview_filter'];
$_SESSION['node_overview_filter'][] = array(
$filter,
$form_state['values'][$filter],
);
$_SESSION['openid']['service'] = $services[0];
}
function example_request_time() {
$nextWeek = time() + 7 * 24 * 60 * 60;
$nextWeek = 8 * time() + 7 * 24 * 60 * 60;
}
function example_rebuild_functions() {
drupal_rebuild_theme_registry();
drupal_rebuild_code_registry();
}
function example_uninstall_module() {
drupal_uninstall_module($module);
}
function example_module_list() {
foreach (module_list() as $module) {
}
}
function example_http_request() {
drupal_http_request('http://example.com/', array(
'Header-Title' => 'value',
), 'GET', NULL, 0);
drupal_http_request('http://example.com/', array(
'Header-Title' => 'value',
), 'GET', 'Some data', 0);
drupal_http_request('http://example.com/', array(
'Header-Title' => 'value',
), 'POST', 'Some data', 3);
drupal_http_request('http://example.com/', array(
'Header-Title' => 'value',
), 'POST', 'Some data');
drupal_http_request('http://example.com/', array(
'Header-Title' => 'value',
), 'POST');
drupal_http_request('http://example.com/');
}
function example_moved_statistics_settings() {
drupal_goto($path = 'admin/reports/settings');
}
function example_system_theme_data() {
module_rebuild_cache();
system_theme_data();
}
function example_static_variable() {
static $menu1;
static $menu2 = 2;
static $menu3 = array();
static $menu4 = 'xx';
}
function example_html_head() {
$data = 'my header';
drupal_set_html_head($data);
if (drupal_set_html_head($data)) {
}
}
function example_drupal_eval() {
drupal_eval('<?php print "Hello World"; ? >');
$text = drupal_eval('<?php print "Hello World"; ? >');
if ($text = drupal_eval('<?php print "Hello World"; ? >')) {
}
print_r(drupal_eval('<?php print "Hello World"; ? >'));
echo print_r(drupal_eval('<?php print "Hello World"; ? >'), 1);
}
function example_http_header_functions() {
drupal_set_header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal server error');
drupal_set_header('HTTP/1.1 503 Service unavailable');
drupal_set_header('HTTP/1.1 403 Forbidden');
drupal_set_header('Content-Type: text/plain');
drupal_set_header('Content-Type: text/javascript; charset=utf-8');
drupal_set_header('Content-Type: octet/stream');
drupal_set_header('Content-Disposition: attachment; filename="' . $filename . '"');
drupal_set_header('Content-Length: ' . filesize(file_directory_path() . '/' . $filename));
drupal_set_header($_SERVER["SERVER_PROTOCOL"] . " 500 Internal server error");
drupal_set_header("HTTP/1.1 503 Service unavailable");
drupal_set_header("HTTP/1.1 403 Forbidden");
drupal_set_header("Content-Type: text/plain");
drupal_set_header("Content-Type: text/javascript; charset=utf-8");
drupal_set_header("Content-Type: octet/stream");
drupal_set_header("Content-Disposition: attachment; filename='" . $filename . "'");
drupal_set_header("Content-Length: " . filesize(file_directory_path() . "/" . $filename));
$headers = drupal_get_headers();
foreach (drupal_get_headers() as $name => $value) {
}
}
function example_file_download() {
if (_mymodule_access($filepath)) {
return array(
'Content-Type: text/plain',
);
}
}
function example_set_content() {
drupal_set_content('footer', 'Adding custom text to footer');
$full_footer = drupal_get_content();
if ($full_footer = drupal_get_content()) {
}
}
function example_time_limit() {
$time_limit = 5;
set_time_limit($time_limit);
if (set_time_limit($time_limit) > 5) {
}
}
function example_remove_drupal_urlencode() {
$string = drupal_urlencode('test');
}
function example_perm() {
return array(
'administer my module',
$perm_1['one'],
'permission two',
$perm_2[1]['2'],
);
}
function example_perm() {
$perm = array(
'administer my module',
$perm_1['one'],
'permission two',
$perm_2[1]['2'],
);
return $perm;
}
function example_perm() {
$perm = array();
$perm['administer my module'] = array();
$perm[$perm_1['one']] = array();
$perm['permission two'] = array();
$perm[$perm_2[1]['2']] = array();
return $perm;
}
function example_perm_items() {
$options = array();
foreach (module_implements('perm') as $module) {
$function = $module . '_perm';
if ($permissions = $function('perm')) {
asort($permissions);
foreach ($permissions as $permission => $description) {
$options[t('@module module', array(
'@module' => $module,
))][$permission] = t($permission);
}
}
}
foreach ($modules as $module) {
$permissions = array_merge($permissions, array_keys(module_invoke($module, 'perm')));
}
if (in_array($module, module_implements('perm')) && $admin_access) {
$admin_tasks[-1] = l(t('Configure permissions'), 'admin/user/permissions', array(
'fragment' => 'module-' . $module,
));
}
}
function example_php_permissions() {
$access = user_access('use PHP for block visibility');
if ($access = user_access('use PHP for block visibility')) {
}
}
function example_access($op, $node, $account) {
if ($op == 'create') {
return user_access('create stories', $account);
}
if ($op == 'update' || $op == 'delete') {
if (user_access('edit own stories', $account) && $account->uid == $node->uid) {
return TRUE;
}
}
}
function example_dbtng() {
db_query("INSERT INTO {mytable} (intvar, stringvar, floatvar) VALUES (%d, '%s', %f)", 5, 'hello world', 3.14);
$sql = "INSERT INTO {mytable} (intvar, stringvar, floatvar) VALUES (%d, '%s', %f)";
db_query($sql, 5, 'hello world', 3.14);
$values = array(
5,
'hello world',
3.14,
);
db_query($sql, $values);
$id = db_last_insert_id();
db_query("UPDATE {node} SET title='%s', status=%d WHERE uid=%d", 'hello world', 1, 5);
db_query("DELETE FROM {node} WHERE uid=%d AND created < %d", 5, time() - 3600);
}
function example_schema() {
return array(
'forum' => array(
'description' => t('Stores the relationship of nodes to forum terms.'),
'fields' => array(
'nid' => array(
'description' => t('The {node}.nid of the node.'),
),
),
),
'foo_url' => array(
'description' => t('Stores URLs that appear in <a href=....> tags.'),
'fields' => array(
'url' => array(
'description' => t('The URL.'),
),
),
),
'example' => array(
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'nid',
),
),
);
}
function example_schema() {
$schema = array(
'forum' => array(
'description' => t('Stores the relationship of nodes to forum terms.'),
'fields' => array(
'nid' => array(
'description' => t('The {node}.nid of the node.'),
),
),
),
'foo_url' => array(
'description' => t('Stores URLs that appear in <a href=....> tags.'),
'fields' => array(
'url' => array(
'description' => t('The URL.'),
),
),
),
'example' => array(
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'nid',
),
),
);
return $schema;
}
function example_schema() {
$schema['forum'] = array(
'description' => t('Stores the relationship of nodes to forum terms.'),
'fields' => array(
'nid' => array(
'description' => t('The {node}.nid of the node.'),
),
),
);
$schema['foo_url'] = array(
'description' => t('Stores URLs that appear in <a href=....> tags.'),
'fields' => array(
'url' => array(
'description' => t('The URL.'),
),
),
);
$schema['example'] = array(
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'nid',
),
);
return $schema;
}
function example_install() {
if ($results = drupal_install_schema('example')) {
}
}
function example_uninstall() {
$result = db_query("SELECT * FROM {example}");
while ($data = db_fetch_object($result)) {
db_query("DELETE FROM {variable} WHERE name = '%s'", 'example_' . $data->nid);
}
drupal_uninstall_schema('example');
}
function example_schema_ret() {
db_add_field($ret, $table, $new_name);
db_add_index($ret, $table, $new_name);
db_add_primary_key($ret, $table, $new_name);
db_add_unique_key($ret, $table, $new_name);
db_change_field($ret, $table, $new_name);
db_create_table($ret, $table, $new_name);
db_create_table_sql($ret, $table, $new_name);
db_drop_field($ret, $table, $new_name);
db_drop_index($ret, $table, $new_name);
db_drop_primary_key($ret, $table, $new_name);
db_drop_table($ret, $table, $new_name);
db_drop_unique_key($ret, $table, $new_name);
db_field_names($ret, $table, $new_name);
db_field_set_default($ret, $table, $new_name);
db_field_set_no_default($ret, $table, $new_name);
db_rename_table($ret, $table, $new_name);
}
function example_db_result() {
$val = db_result(db_query('SELECT nid FROM {node}'));
$val = db_result(db_query('
SELECT nid FROM {node}
LIMIT 1
'));
$val = db_result(db_query('SELECT title FROM {node} WHERE nid = %d ', $nid));
$val = db_result(db_query('
SELECT title FROM {node}
WHERE nid = %d
', $nid));
$query = db_query('SELECT * FROM {node}');
$val = db_result($query);
}
function example_db_column_exists() {
$ret = db_column_exists('table', 'field');
$ret = db_column_exists($table, $field);
if ($ret = db_column_exists('table', 'field')) {
}
}
function example_db_is_active() {
if (db_is_active()) {
}
if (function_exists('db_is_active')) {
}
}
function example_menu_link_alter(&$item, $menu) {
if (strpos($item['link_path'], 'admin') === 0 && empty($item['mlid'])) {
$item['hidden'] = 1;
}
}
function example_admin_path_changes() {
$menu['admin/reports/settings'] = array();
$menu['admin/build/modules/'] = array();
$menu['admin/build/modules/custom-module'] = array();
$menu['admin/build/themes'] = array();
$menu['admin/build/themes/custom-theme'] = array();
$menu['admin/build/path'] = array();
$menu['admin/build/path/path-setting'] = array();
$menu['admin/build/block'] = array();
$menu['admin/build/block/block-setting'] = array();
$menu['admin/build/menu'] = array();
$menu['admin/build/menu/menu-setting'] = array();
$menu['admin/content/types'] = array();
$menu['admin/content/taxonomy'] = array();
$menu['admin/content/forum'] = array();
$menu['admin/build/testing'] = array();
$menu['admin/settings/site-maintenance'] = array();
$menu['admin/settings/performance'] = array();
$menu['admin/settings/filters'] = array();
$menu['admin/settings/search'] = array();
$menu['admin/settings/clean-urls'] = array();
}
function example_menu_tree_data() {
$sql = "menu_tree_data\n SELECT m.load_functions, m.to_arg_functions, m.access_callback, m.access_arguments, m.page_callback, m.page_arguments, m.title, m.title_callback, m.title_arguments, m.type, m.description, ml.*\n FROM {menu_links} ml LEFT JOIN {menu_router} m ON m.path = ml.router_path\n WHERE ml.menu_name = '%s'\n ORDER BY p1 ASC, p2 ASC, p3 ASC, p4 ASC, p5 ASC, p6 ASC, p7 ASC, p8 ASC, p9 ASC";
$result = db_query($sql, $menu['menu_name']);
$tree = menu_tree_data($result);
$sql = "\n SELECT b.*, m.load_functions, m.to_arg_functions, m.access_callback, m.access_arguments, m.page_callback, m.page_arguments, m.title, m.title_callback, m.title_arguments, m.type, ml.*\n FROM {menu_links} ml INNER JOIN {menu_router} m ON m.path = ml.router_path\n INNER JOIN {book} b ON ml.mlid = b.mlid\n WHERE " . implode(' AND ', $match) . "\n ORDER BY p1 ASC, p2 ASC, p3 ASC, p4 ASC, p5 ASC, p6 ASC, p7 ASC, p8 ASC, p9 ASC";
$data['tree'] = menu_tree_data(db_query($sql, $args), array(), $item['depth']);
}
function example_block($op, $delta, $edit) {
if ($op == 'configure') {
if ($delta == 'exciting') {
$form['items'] = array(
'#type' => 'select',
'#title' => t('Number of items'),
'#default_value' => variable_get('mymodule_block_items', 0),
'#options' => array(
'1',
'2',
'3',
),
);
return $form;
}
}
elseif ($op == 'list') {
$blocks['exciting'] = array(
'info' => t('An exciting block provided by Mymodule.'),
'weight' => 0,
'status' => 1,
'region' => 'sidebar_first',
);
$blocks['amazing'] = array(
'info' => t('An amazing block provided by Mymodule.'),
'cache' => DRUPAL_CACHE_PER_ROLE | DRUPAL_CACHE_PER_PAGE,
);
return $blocks;
}
elseif ($op == 'save') {
if ($delta == 'exciting') {
variable_set('mymodule_block_items', $edit['items']);
}
}
elseif ($op == 'view') {
switch ($delta) {
case 'exciting':
$block = array(
'subject' => t('Default title of the exciting block'),
'content' => mymodule_display_block_exciting(),
);
break;
case 'amazing':
$block = array(
'subject' => t('Default title of the amazing block'),
'content' => mymodule_display_block_amazing(),
);
break;
}
return $block;
}
switch ($op) {
case 'configure':
if ($delta == 'exciting') {
$form['items'] = array(
'#type' => 'select',
'#title' => t('Number of items'),
'#default_value' => variable_get('mymodule_block_items', 0),
'#options' => array(
'1',
'2',
'3',
),
);
return $form;
}
break;
case 'list':
$blocks['exciting'] = array(
'info' => t('An exciting block provided by Mymodule.'),
'weight' => 0,
'status' => 1,
'region' => 'sidebar_first',
);
$blocks['amazing'] = array(
'info' => t('An amazing block provided by Mymodule.'),
'cache' => DRUPAL_CACHE_PER_ROLE | DRUPAL_CACHE_PER_PAGE,
);
return $blocks;
break;
case 'save':
if ($delta == 'exciting') {
variable_set('mymodule_block_items', $edit['items']);
}
break;
case 'view':
switch ($delta) {
case 'exciting':
$block = array(
'subject' => t('Default title of the exciting block'),
'content' => mymodule_display_block_exciting(),
);
break;
case 'amazing':
$block = array(
'subject' => t('Default title of the amazing block'),
'content' => mymodule_display_block_amazing(),
);
break;
}
return $block;
break;
}
foreach (array(
'configure',
'list',
'view',
) as $op) {
}
}
function example_block($op, $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks[0] = array(
'info' => t('Example block #1'),
);
$blocks[1] = array(
'info' => t('Example block #2'),
);
return $blocks;
break;
case 'configure':
if ($delta == 0) {
$form['block_example'] = array(
'#type' => 'textfield',
'#title' => t('Block Example Field'),
'#default_value' => variable_get('example_block_example_field', ''),
);
}
break;
case 'save':
if ($delta == 0) {
variable_set('example_block_example_field', $edit['block_example_string']);
}
break;
case 'view':
switch ($delta) {
case 0:
$block['subject'] = t('Example Block #1');
$block['content'] = variable_get('example_block_example_field', '');
break;
case 1:
$block['subject'] = t('Example Block #1');
$block['content'] = t('Example Block #2');
break;
}
return $block;
break;
}
}
function example_block_db_tables() {
$result = db_query("SELECT * FROM {blocks}");
$result = db_query("SELECT * FROM {blocks_roles}");
$result = db_query("SELECT * FROM {boxes}");
}
function example_custom_block() {
block_box_delete($form);
block_box_delete_submit();
block_box_form();
$box = block_box_get(1);
$box = block_box_get($id);
block_custom_block_save($edit, $delta);
db_query("SELECT * FROM {box}");
db_query("SELECT * FROM {BOX}");
}
function example_comment_load() {
if ($value) {
db_query($query, $cid);
$comment = _comment_load($cid);
_comment_update_node_statistics($comment->nid);
}
}
function example_menu() {
global $user;
$items = array();
$access = user_access('administer all signups');
$items['node/%_comment/signup'] = array(
'title' => user_access('access administration pages') ? t('Signup') : t('Signup settings'),
'description' => 'Add a signup node.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'signup_settings_page',
),
'access callback' => $access,
'type' => MENU_LOCAL_TASK,
);
$items['admin/content/signup'] = array(
'title' => 'Signup overview',
'description' => t('View all signup-enabled posts, and open or close signups on them.'),
'page callback' => 'example_signup_admin_form',
'access callback' => $access,
'type' => MENU_LOCAL_TASK,
);
}
function example_comment_validate() {
if ($x = comment_validate('xx')) {
}
$y = comment_validate($xx['y']);
}
function example_comment_node_url() {
$var = 'xx/' . comment_node_url() . 'yy';
if (comment_node_url() == '') {
}
return comment_node_url();
}
function example_comment(&$a1, $op) {
if ($op == 'insert' || $op == 'update') {
$nid = $a1['nid'];
}
if ($op == "insert") {
}
elseif ($op == "update") {
}
elseif ($op == "view") {
}
elseif ($op == "validate") {
}
elseif ($op == "publish") {
}
elseif ($op == "unpublish") {
}
elseif ($op == "delete") {
}
switch ($op) {
case "insert":
break;
case "update":
break;
case "view":
break;
case "validate":
break;
case "publish":
break;
case "unpublish":
break;
case "delete":
break;
}
cache_clear_all_like(drupal_url(array(
'id' => $nid,
)));
}
function example_check_markup() {
$node->body = check_markup($node->body, $node->format);
$content = check_markup($block->body, $block->format, FALSE);
}
function example_drupal_set_title() {
drupal_set_title($node->title);
drupal_set_title(check_plain($node->title));
drupal_set_title(t("@name's blog", array(
'@name' => $account->name,
)));
drupal_set_title(t("@name's blog is %status", array(
'@name' => $account->name,
'%status' => 'very popular',
)));
drupal_set_title(t("@name's blog is %status in !country", array(
'@name' => $account->name,
'%status' => 'very popular',
'!country' => 'my country',
)));
if (drupal_set_title(t("@name's blog", array(
'@name' => $account->name,
)))) {
}
drupal_set_title('check_plain' . $node->title);
drupal_set_title('check_plain' . check_plain($node->title . 'xxx') . 'yyy' . check_plain($node->title2));
}
function example_filter($op, $delta = 0, $format = -1, $text = '', $cache_id = 0) {
switch ($op) {
case 'list':
return array(
0 => t('Limit allowed HTML tags'),
1 => t('Convert line breaks'),
2 => t('Convert URLs into links'),
3 => t('Correct broken HTML'),
4 => t('Escape all HTML'),
);
case 'description':
switch ($delta) {
case 0:
return t('Allows you to restrict the HTML tags the user can use. It will also remove harmful content such as JavaScript events, JavaScript URLs and CSS styles from those tags that are not removed.');
case 1:
return t('Converts line breaks into HTML (i.e. <br> and <p>) tags.');
case 2:
return t('Turns web and e-mail addresses into clickable links.');
case 3:
return t('Corrects faulty and chopped off HTML in postings.');
case 4:
return t('Escapes all HTML tags, so they will be visible instead of being effective.');
default:
return;
}
case 'process':
switch ($delta) {
case 0:
return _filter_html($text, $format);
case 1:
return _filter_autop($text);
case 2:
return _filter_url($text, $format);
case 3:
return _filter_htmlcorrector($text);
case 4:
return trim(check_plain($text));
default:
return $text;
}
case 'settings':
switch ($delta) {
case 0:
return _filter_html_settings($format);
case 2:
return _filter_url_settings($format);
default:
return;
}
default:
return $text;
}
}
function example_filter_tips($delta, $format, $long = FALSE) {
switch ($delta) {
case 0:
if ($allowed_html = variable_get("allowed_html_{$format}", '<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>')) {
switch ($long) {
case 0:
return t('Allowed HTML tags: @tags', array(
'@tags' => $allowed_html,
));
case 1:
$output = '<p>' . t('Allowed HTML tags: @tags', array(
'@tags' => $allowed_html,
)) . '</p>';
if (!variable_get("filter_html_help_{$format}", 1)) {
return $output;
}
}
}
break;
case 1:
switch ($long) {
case 0:
return t('Lines and paragraphs break automatically.');
case 1:
return t('Lines and paragraphs are automatically recognized. The <br /> line break, <p> paragraph and </p> close paragraph tags are inserted automatically. If paragraphs are not recognized simply add a couple blank lines.');
}
break;
case 2:
return t('Web page addresses and e-mail addresses turn into links automatically.');
break;
case 4:
return t('No HTML tags allowed.');
break;
}
}
function example_hook_filter_urls() {
$form[$id]['roles'] = array(
'#markup' => $default ? t('All roles may use default format') : ($roles ? implode(', ', $roles) : t('No roles may use this format')),
);
$form[$id]['edit'] = array(
'#markup' => l(t('edit'), 'admin/settings/filters/' . $id),
);
$form[$id]['delete'] = array(
'#markup' => $default ? '' : l(t('delete'), 'admin/settings/filters/delete/' . $id),
);
if ($url = 'admin/settings/filters/delete/' . $id) {
}
}
function example_hook_filter_formats_parameters() {
$formats = filter_formats();
$formats = filter_formats($index);
}
function example_taxonomy_get_tree() {
if ($vocabularies) {
foreach ($vocabularies as $vocabulary) {
$terms = module_invoke('taxonomy', 'get_tree', $vocabulary->vid, 0, 2);
$terms = module_invoke('taxonomy', 'get_tree', $vocabulary->vid, 0, 2, NULL);
$terms = module_invoke('taxonomy', 'get_tree', $vocabulary->vid, 0, 2, $max_depth);
$terms = module_invoke('taxonomy', 'get_tree', $vocabulary->vid, 0, -1);
$terms = module_invoke('taxonomy', 'get_tree', $vocabulary->vid, 0, -1, NULL);
$terms = module_invoke('taxonomy', 'get_tree', $vocabulary->vid, 0, -1, $max_depth);
$terms = module_invoke('taxonomy', 'get_tree', $vocabulary->vid, 0);
foreach ($terms as $term) {
$term_name = $term->name;
foreach (module_invoke('taxonomy', 'get_parents', $term->tid, 'tid') as $parent) {
}
}
}
}
if (!empty($children[$vid][$child])) {
$tree = array_merge($tree, taxonomy_get_tree($vid, $child, $depth, $max_depth));
}
foreach ($tids as $index => $tid) {
$term = taxonomy_get_term_data($tid);
$tree = taxonomy_get_tree($term->vid, $tid, 2);
$tree = taxonomy_get_tree($term->vid, $tid, 2, NULL);
$tree = taxonomy_get_tree($term->vid, $tid, 2, $depth);
$tree = taxonomy_get_tree($term->vid, $tid, -1);
$tree = taxonomy_get_tree($term->vid, $tid, -1, NULL);
$tree = taxonomy_get_tree($term->vid, $tid, -1, $depth);
$tree = taxonomy_get_tree($term->vid, $tid);
}
}
function example_taxonomy_tables() {
$result = db_query(db_rewrite_sql("SELECT t.tid, t.vid FROM {term_data} t INNER JOIN {vocabulary_node_types} n ON t.vid = n.vid WHERE t.tid IN (" . db_placeholders($term_list) . ") AND n.type = '%s'", 't', 'tid'), $params);
$result2 = db_query(db_rewrite_sql("SELECT v.vid, v.name, v.required, v.multiple FROM {vocabulary} v INNER JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s'", 'v', 'vid'), $node->type);
while ($vocabulary = db_fetch_object($result2)) {
$row = array(
'description' => 'The {term_data}.tid of the forum term assigned to the node.',
);
}
$result = db_query(db_rewrite_sql('SELECT t.tid, t.vid, t.name, t.description, t.weight FROM {term_data} t WHERE t.tid = %d AND t.vid = %d', 't', 'tid'), $tid, variable_get('forum_nav_vocabulary', ''));
foreach ($node->taxonomy as $term) {
if (db_result(db_query('SELECT COUNT(*) FROM {term_data} WHERE tid = %d AND vid = %d', $term, $vocabulary))) {
}
}
$old_tid = db_result(db_query_range("SELECT t.tid FROM {term_node} t INNER JOIN {node} n ON t.vid = n.vid WHERE n.nid = %d ORDER BY t.vid DESC", $node->nid, 0, 1));
if ($op == 'delete' && $term['vid'] == variable_get('forum_nav_vocabulary', '')) {
switch ($type) {
case 'term':
$results = db_query('SELECT tn.nid FROM {term_node} tn WHERE tn.tid = %d', $term['tid']);
$tn_alias = $query
->join('term_node', 'tn', 'tn.vid = n.vid');
$td_alias = $query
->join('term_data', 'td', 'tn.tid = tn.tid');
case 'new':
$title = t('New forum topics');
$sql = db_rewrite_sql("SELECT n.nid, n.title, l.comment_count FROM {node} n INNER JOIN {term_node} tn ON tn.vid = n.vid INNER JOIN {term_data} td ON td.tid = tn.tid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 AND td.vid = %d ORDER BY n.nid DESC");
break;
}
$sql = "SELECT r.tid, COUNT(n.nid) AS topic_count, SUM(l.comment_count) AS comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {term_node} r ON n.vid = r.vid WHERE n.status = 1 GROUP BY r.tid";
$sql = "SELECT ncs.last_comment_timestamp, IF (ncs.last_comment_uid != 0, u2.name, ncs.last_comment_name) AS last_comment_name, ncs.last_comment_uid FROM {node} n INNER JOIN {users} u1 ON n.uid = u1.uid INNER JOIN {term_node} tn ON n.vid = tn.vid INNER JOIN {node_comment_statistics} ncs ON n.nid = ncs.nid INNER JOIN {users} u2 ON ncs.last_comment_uid=u2.uid WHERE n.status = 1 AND tn.tid = %d ORDER BY ncs.last_comment_timestamp DESC";
}
$sql = "SELECT COUNT(n.nid) FROM {node} n INNER JOIN {term_node} tn ON n.vid = tn.vid AND tn.tid = %d LEFT JOIN {history} h ON n.nid = h.nid AND h.uid = %d WHERE n.status = 1 AND n.created > %d AND h.nid IS NULL";
$sql = db_rewrite_sql("SELECT n.nid, r.tid, n.title, n.type, n.sticky, u.name, u.uid, n.created AS timestamp, n.comment AS comment_mode, l.last_comment_timestamp, IF(l.last_comment_uid != 0, cu.name, l.last_comment_name) AS last_comment_name, l.last_comment_uid, l.comment_count AS num_comments, f.tid AS forum_tid FROM {node_comment_statistics} l INNER JOIN {node} n ON n.nid = l.nid INNER JOIN {users} cu ON l.last_comment_uid = cu.uid INNER JOIN {term_node} r ON n.vid = r.vid INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {forum} f ON n.vid = f.vid WHERE n.status = 1 AND r.tid = %d");
$sql_count = db_rewrite_sql("SELECT COUNT(n.nid) FROM {node} n INNER JOIN {term_node} r ON n.vid = r.vid AND r.tid = %d WHERE n.status = 1");
$sql = "SELECT n.nid, n.title, n.sticky, l.comment_count, l.last_comment_timestamp FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 ORDER BY n.sticky DESC, " . _forum_get_topic_order_sql(variable_get('forum_order', 1));
$term = db_fetch_array(db_query("SELECT * FROM {term_data} t WHERE t.vid = %d AND t.name = '%s' AND t.description = '%s'", variable_get('forum_nav_vocabulary', ''), $name, $description));
$parent_tid = db_result(db_query("SELECT t.parent FROM {term_hierarchy} t WHERE t.tid = %d", $tid));
$join .= "INNER JOIN {term_node} {$table} ON n.nid = {$table}.nid ";
$join1 .= ' INNER JOIN {term_node} tn ON n.vid = tn.vid';
$join1 .= ' INNER JOIN {term_node} tn ON n.vid = tn.vid';
$row = array(
'description' => 'The {term_data}.tid of the term.',
);
$results = pager_query(db_rewrite_sql('SELECT t.*, h.parent FROM {term_data} t INNER JOIN {term_hierarchy} h ON t.tid = h.tid WHERE t.vid = %d ORDER BY weight, name', 't', 'tid'), $page_increment, 0, NULL, $vocabulary->vid);
$total_entries = db_query(db_rewrite_sql('SELECT count(*) FROM {term_data} t INNER JOIN {term_hierarchy} h ON t.tid = h.tid WHERE t.vid = :vid'), array(
':vid' => $vocabulary->vid,
));
db_query('UPDATE {term_data} SET weight = 0 WHERE vid = %d', $form_state['values']['vid']);
db_insert('term_synonym');
}
function example_taxonomy_crud() {
taxonomy_get_term($tid);
taxonomy_save_term($form_values);
taxonomy_del_term($tid);
taxonomy_vocabulary_load($vid);
taxonomy_save_vocabulary($edit);
taxonomy_del_vocabulary($vid);
}
function example_taxonomy_form_all() {
$form = array();
$form['term'] = array(
'#type' => 'select',
'#title' => t('Term'),
'#options' => taxonomy_form_all(),
'#description' => t('Select a term to apply to the node. Keep in mind that the selected product node type must have the selected vocabulary enabled.'),
'#default_value' => $settings['term'],
);
$terms = taxonomy_form_all();
if ($terms) {
$form['term'] = array(
'#type' => 'select',
'#title' => t('Term'),
'#options' => $terms,
'#description' => t('Select a term to apply to the node. Keep in mind that the selected product node type must have the selected vocabulary enabled.'),
'#default_value' => $settings['term'],
);
}
return $form;
}
function example_no_synonyms_taxonomy() {
$synonyms = taxonomy_get_synonyms($tid);
$synonyms = taxonomy_get_synonyms(0);
function_call(taxonomy_get_synonyms($tid));
$root = taxonomy_get_synonym_root($synonyms[0]);
$root = taxonomy_get_synonym_root(0);
$synonyms = db_query("SELECT * FROM {term_synonym} s WHERE s.name = '%s'", $synonym);
}
function example_drupal_add_js_external() {
drupal_set_html_head('<script type="text/javascript" src="http://example.com/example.js" />');
drupal_set_html_head('<script src="http://example.com/example.js" type="text/javascript" />');
drupal_set_html_head('<SCRIPT SRC="http://example.com/example.js" TYPE="text/javascript" />');
drupal_set_html_head("<script type='text/javascript' src='http://example.com/example.js' />");
drupal_set_html_head("<script src='http://example.com/example.js' type='text/javascript' />");
drupal_set_html_head("<SCRIPT SRC='http://example.com/example.js' TYPE='text/javascript' />");
}
function example_drupal_add_js_options() {
drupal_add_js('misc/collapse.js');
drupal_add_js('misc/collapse.js', 'module');
drupal_add_js('misc/collapse.js', 'module', 'footer');
drupal_add_js('misc/collapse.js', 'module', 'header', FALSE, TRUE, TRUE);
drupal_add_js('misc/collapse.js', 'module', 'header', FALSE, TRUE, FALSE);
drupal_add_js('misc/collapse.js', 'module', 'header', FALSE, FALSE, TRUE);
drupal_add_js('misc/collapse.js', 'module', 'header', TRUE, FALSE, TRUE);
drupal_add_js('misc/collapse.js', 'core');
drupal_add_js('misc/collapse.js', 'core', 'footer');
drupal_add_js('misc/collapse.js', 'core', 'footer', TRUE, FALSE, TRUE);
drupal_add_css('/modules/devel/devel.css');
drupal_add_css('/modules/devel/devel.css', 'module');
drupal_add_css('/modules/devel/devel.css', 'module', 'screen');
drupal_add_css('/modules/devel/devel.css', 'module', 'all', FALSE);
drupal_add_css('/modules/devel/devel.css', 'theme');
drupal_add_css('/modules/devel/devel.css', 'theme', 'screen');
drupal_add_css('/modules/devel/devel.css', 'theme', 'all', FALSE);
}
function example_jquery_ui() {
jquery_ui_add(array(
'ui.accordion',
'ui.dialog',
));
jquery_ui_add('ui.accordion');
$files = array(
'ui.accordion',
'ui.dialog',
);
jquery_ui_add($files);
$file = 'ui.accordion';
jquery_ui_add($file);
}
function example_drupal_add_css_inline() {
$color = variable_get('backgroundcolor', '#FFFFFF');
drupal_set_html_head("<style type='text/css'>body {background-color: {$color}}</style>");
drupal_set_html_head('<style type="text/css">div {background-url: url("images/test.png");}</style>');
drupal_set_html_head('
<style type="text/css">
div {
background-url: url("images/test.png");
}
</style>
');
}
function example_form_clean_id() {
$class = form_clean_id('string');
$id = form_clean_id($id);
$class = form_clean_id(implode('-', $form['element']['#parents']));
$form['element']['#attributes']['class'] = form_clean_id(implode('-', $form['element']['#parents']));
}
function example_theme() {
return array(
'example_node_list' => array(
'arguments' => array(
'items' => NULL,
'title' => NULL,
),
),
'example_node_search_admin' => array(
'arguments' => array(
'form' => NULL,
),
),
'example_user_list' => array(
'arguments' => array(
'users' => NULL,
'title' => NULL,
),
),
'example_user_list_2' => array(
'arguments' => array(
'users1' => NULL,
'title1' => NULL,
'users2' => NULL,
'title2' => NULL,
),
),
'example_coder_review_warning_msg' => array(
'arguments' => array(
'error' => NULL,
),
),
'example_coder_review_table_cols' => array(
'arguments' => array(
'form' => NULL,
),
),
'example_phpapi' => array(
'arguments' => array(
'function' => NULL,
),
),
'example_missing' => array(),
'example_empty' => array(
'arguments' => array(),
),
);
}
function example_theme() {
$theme = array(
'example_node_list' => array(
'arguments' => array(
'items' => NULL,
'title' => NULL,
),
),
'example_node_search_admin' => array(
'arguments' => array(
'form' => NULL,
),
),
'example_user_list' => array(
'arguments' => array(
'users' => NULL,
'title' => NULL,
),
),
'example_user_list_2' => array(
'arguments' => array(
'users1' => NULL,
'title1' => NULL,
'users2' => NULL,
'title2' => NULL,
),
),
'example_coder_review_warning_msg' => array(
'arguments' => array(
'error' => NULL,
),
),
'example_coder_review_table_cols' => array(
'arguments' => array(
'form' => NULL,
),
),
'example_phpapi' => array(
'arguments' => array(
'function' => NULL,
),
),
);
return $theme;
}
function example_theme() {
$theme = array();
$theme['example_node_list'] = array(
'arguments' => array(
'items' => NULL,
'title' => NULL,
),
);
$theme['example_node_search_admin'] = array(
'arguments' => array(
'form' => NULL,
),
);
$theme['example_user_list'] = array(
'arguments' => array(
'users' => NULL,
'title' => NULL,
),
);
$theme['example_user_list_2'] = array(
'arguments' => array(
'users1' => NULL,
'title1' => NULL,
'users2' => NULL,
'title2' => NULL,
),
);
$theme['example_coder_review_warning_msg'] = array(
'arguments' => array(
'error' => NULL,
),
);
$theme['example_coder_review_table_cols'] = array(
'arguments' => array(
'form' => NULL,
),
);
$theme['example_phpapi'] = array(
'arguments' => array(
'function' => NULL,
),
);
return $theme;
}
function example_theme_changes() {
theme('aggregator_summary_items', $summary_items, $source);
theme('book_export_html', $title, $contents, $depth);
theme('user_list', $users, $title);
theme('image', $path, $alt, $title, $attributes, $getsize);
theme('image_style', $style_name, $path, $alt, $title, $attributes, $getsize);
theme('menu_admin_overview', $title, $name, $description);
theme('rdf_template_variable_wrapper', $content, $attributes, $context, $inline);
theme("user_list", $users, $title);
theme('example_user_list', $users, $title);
theme('example_user_list_2', $users1, $title1, $users2, $title2);
theme("example_user_list", $users, $title);
theme("example_user_list_2", $users1, $title1, $users2, $title2);
theme('example_user_list_xx', $users, $title);
theme("example_user_list_xx", $users, $title);
theme('xxx', $users, $title);
$hook = 'user_list';
theme($hook, $users, $title);
theme('user_list');
theme('example_user_list');
}
function theme_example_node_list($items = NULL, $title = NULL) {
$output = '<blink>' . drupal_render($element['child1']) . '</blink>';
$output .= drupal_render($element);
return $output;
}
function theme_example_node_search_admin($form = NULL) {
}
function theme_example_user_list($users = NULL, $title = NULL) {
}
function theme_example_user_list_2($users1 = NULL, $title1 = NULL, $users2 = NULL, $title2 = NULL) {
}
function theme_example_coder_review_warning_msg($error = NULL) {
}
function theme_example_coder_review_table_cols($form = NULL) {
}
function theme_example_phpapi($function = NULL) {
}
function theme_example_missing() {
}
function theme_example_undefined($function = NULL) {
}
function example_theme_page() {
$form = array();
print theme('page', $form);
print theme("page", $form);
return theme('page', $output);
}
function example_placeholder() {
$placeholder = theme('placeholder');
$placeholder = theme("placeholder");
$placeholder = theme('placeholder', array(
'text' => $format->name,
));
$placeholder = theme("placeholder", array(
"text" => $format->name,
));
}
function example_theme_pager() {
$pager = theme('pager', $tags, $limit, $element, $parameters, $quantity);
$pager = theme('pager', $tags, $limit, $element, $parameters);
$pager = theme('pager', $tags, $limit, $element);
$pager = theme('pager', $tags, $limit);
$pager = theme('pager', $tags);
$pager = theme('pager', array(), 100, 0, array(), 200);
$pager = theme('pager');
}
function example_theme_username() {
$user = user_load(1);
print theme('username', $user);
print theme("username", $user_load(1));
}
function example_form_alter(&$form, &$form_state, $form_id) {
if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] . '_node_form' == $form_id) {
}
if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] . '_node_form' == $form_id && $form['type']['#value'] == 'page') {
}
if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] . '_node_form' == $form_id) {
}
if (isset($form['#node']) && isset($form['type']) && $form['type']['#value'] . '_node_form' == $form_id) {
}
}
function example_process_functions() {
$form['element'] = array(
'#default_value' => $status,
'#options' => $options,
'#process' => array(
'expand_checkboxes',
'system_modules_disable',
),
);
$form['element'] = array(
'#process' => array(
'form_process_ahah',
),
);
$form['element'] = array(
'#process' => array(
'form_process_weight',
'form_process_ahah',
),
);
$type['image_button'] = array(
'#input' => TRUE,
'#button_type' => 'submit',
'#executes_submit_callback' => TRUE,
'#process' => array(
'form_expand_ahah',
),
'#return_value' => TRUE,
'#has_garbage_value' => TRUE,
'#src' => NULL,
'#size' => 60,
'#maxlength' => 128,
'#autocomplete_path' => FALSE,
'#process' => array(
'form_expand_ahah',
),
);
$type['radios'] = array(
'#input' => TRUE,
'#process' => array(
'expand_radios',
),
);
$type['radio'] = array(
'#input' => TRUE,
'#default_value' => NULL,
'#process' => array(
'form_expand_ahah',
),
);
}
function example_drupal_execute() {
drupal_execute('story_node_form', $form_state, (object) $node);
if (drupal_execute('story_node_form', $form_state, (object) $node)) {
}
}
function example_menu() {
$items['admin/config/development/coder/upgrade'] = array(
'title' => 'Upgrade',
'description' => 'Convert module code from version 6.x to 7.x.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'example_conversions_form',
),
'access arguments' => array(
'administer code conversions',
),
'type' => MENU_LOCAL_TASK,
);
$items['admin/content/signup'] = array(
'title' => 'Signup overview',
'description' => 'View all signup-enabled posts, and open or close signups on them.',
'page callback' => 'example_signup_admin_form',
'access callback' => $access,
'type' => MENU_LOCAL_TASK,
);
$loop_items = example_items_get();
foreach ($loop_items as $key => $loop_item) {
if (!empty($loop_item['menu'])) {
foreach ($loop_item['menu'] as $op => $menu_item) {
if ($menu_item != EXAMPLE_MENU_DISABLED) {
if ($menu_item == EXAMPLE_MENU_DEFAULT) {
$menu_item = !empty($info['default']['menu'][$op]) ? $info['default']['menu'][$op] : array();
}
$items['admin/config/development/coder/upgrade2'] = array(
'title' => 'Upgrade',
'description' => 'Convert module code from version 6.x to 7.x.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'example_conversions_form2',
),
'access arguments' => array(
'administer code conversions',
),
'type' => MENU_LOCAL_TASK,
);
$items['admin/content/signup2'] = array(
'title' => $op,
'page callback' => 'example_user_form2',
'access callback' => 'example_user_access',
'type' => MENU_CALLBACK,
'file path' => drupal_get_path('module', $loop_item['module']),
);
$default_menu_fields = array(
'title' => $op,
'page callback' => 'drupal_get_form',
'access callback' => 'example_user_access',
'type' => MENU_CALLBACK,
'file path' => drupal_get_path('module', $loop_item['module']),
);
$admin_path = 'admin/%/' . $op . '/' . $loop_item['handler'];
$items[$admin_path] = array_merge($default_menu_fields, $menu_item);
$items[$admin_path]['page arguments'][] = 'example_admin_form3';
$items[$admin_path]['page arguments'][] = 1;
$default_menu_fields = array(
'title' => $op,
'page callback' => 'example_user_form3',
'access callback' => 'example_user_access',
'type' => MENU_CALLBACK,
'file path' => drupal_get_path('module', $loop_item['module']),
);
$user_path = 'user/%user/example/%/' . $op . '/' . $loop_item['handler'];
$default_menu_fields['access arguments'] = array(
1,
3,
4,
);
$items[$user_path] = array_merge($default_menu_fields, $menu_item);
$items[$user_path]['page arguments'][] = 1;
$items[$user_path]['page arguments'][] = 3;
}
}
}
}
return $items;
}
function example_conversions_form(&$form_state) {
$form = array();
return $form;
}
function example_signup_admin_form(&$form_state) {
$form = array();
return $form;
}
function example_conversions_form2(&$form_state) {
$form = array();
return $form;
}
function example_admin_form3(&$form_state, $p0) {
$form = array();
return $form;
}
function example_user_form2(&$form_state, $p0, $p1) {
$form = array();
return $form;
}
function example_drupal_get_form() {
$form = drupal_get_form('example_my_form', $p0);
return drupal_get_form($form_id);
}
function example_my_form(&$form_state, $p0) {
$form = array();
return $form;
}
function example_elements() {
$type['filter_format'] = array(
'#input' => TRUE,
);
return $type;
}
function example_fapi_changes() {
$form['#redirect'] = 'node/1';
$form["#redirect"] = $node;
$form_state['#redirect'] = 'node/1';
$_REQUEST['destination'] = 'node/1';
$_REQUEST["destination"] = $node;
$_GET['destination'] = 'node/1';
}
function example_file_scan_directory() {
$link = l($text, $path, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE, $html = FALSE);
file_scan_directory($dir, $mask, $nomask = array(
'.',
'..',
'CVS',
), $callback = 0, $recurse = TRUE, $key = 'filename', $min_depth = 0, $depth = 0);
file_scan_directory($dir, $mask, $nomask, $callback, $recurse, $key, $min_depth, $depth);
file_scan_directory($dir, $mask, array(
'.',
'..',
'CVS',
), 0, TRUE, 'filename', 0, 0);
file_scan_directory($dir, $mask, array(
'.',
'..',
'CVS',
), 0, TRUE, 'filename', 0);
file_scan_directory($dir, $mask, array(
'.svn',
'.cvs',
'xx',
), 10, FALSE, 'basename', 5);
$mask = '\\.module$';
file_scan_directory($dir, $mask, array(
".",
"..",
"CVS",
), 0, TRUE, 'filename', 0, 0);
$mask = '\\.module$';
$nomask = array(
".",
"..",
"CVS",
);
file_scan_directory($dir, $mask, $nomask, $callback, $recurse, $key, $min_depth, $depth);
file_scan_directory($dir, '\\.module$', array(
'.',
'..',
'CVS',
), 0, TRUE, 'filename', 0, 0);
foreach (file_scan_directory(DRUPAL_ROOT . '/includes/database', '^[a-z/]*$', array(
'.',
'..',
'CVS',
), 0, FALSE) as $file) {
include_once "{$file->filename}/install.inc";
include_once "{$file->filename}/database.inc";
$drivers[$file->basename] = $file->filename;
}
}
function example_file_set_status() {
file_set_status($file, FILE_STATUS_PERMANENT);
if (file_set_status($file, FILE_STATUS_PERMANENT)) {
}
$file->status &= FILE_STATUS_PERMANENT;
$file = file_save($file);
}
function example_remove_file_status_temporary() {
$file->status = FILE_STATUS_TEMPORARY;
$file = array(
'status' => FILE_STATUS_TEMPORARY,
);
function_call(FILE_STATUS_TEMPORARY);
}
function example_drupal_system_listing() {
$files = drupal_system_listing('\\.module$', 'modules', 'name', 0);
$files = drupal_system_listing("\\.module\$", 'modules', 'name', 0);
$mask = '\\.module$';
$files = drupal_system_listing($mask, 'modules', 'name', 0);
}
function example_file_prepare_directory() {
file_check_directory($full_path, FILE_CREATE_DIRECTORY);
file_check_directory('file/test', FILE_CREATE_DIRECTORY);
}
function example_user_cancel($edit, $uid) {
user_delete($form_state['values'], $form_state['values']['_account']->uid);
}
function example_user($op, &$edit, &$user, $category = NULL) {
if ($op == 'delete') {
db_query('UPDATE {node} SET uid = 0 WHERE uid = %d', $user->uid);
db_query('UPDATE {node_revisions} SET uid = 0 WHERE uid = %d', $user->uid);
}
elseif ($op == 'form' && $category == 'account') {
$form['comment_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Comment settings'),
'#collapsible' => TRUE,
'#weight' => 4,
);
$form['comment_settings']['signature'] = array(
'#type' => 'textarea',
'#title' => t('Signature'),
'#default_value' => $edit['signature'],
'#description' => t('Your signature will be publicly displayed at the end of your comments.'),
);
return $form;
}
else {
db_query('UPDATE {node} SET uid = 0 WHERE uid = %d', $user->uid);
db_query('UPDATE {node_revisions} SET uid = 0 WHERE uid = %d', $user->uid);
}
switch ($op_test) {
case 'after_update':
break;
}
switch ($op) {
case 'after_update':
break;
case 'categories':
break;
case 'delete':
break;
case 'form':
break;
case 'insert':
break;
case 'load':
break;
case 'login':
break;
case 'logout':
break;
case 'register':
break;
case 'submit':
break;
case 'update':
break;
case 'validate':
break;
case 'view':
break;
}
}
function example_user_load_multiple() {
user_load();
user_load(100);
user_load('100');
$uid = 100;
user_load($uid);
$uid = '100';
user_load($uid);
$user_params = array(
'uid' => arg(1),
);
user_load($user_params);
$user_params = array(
'name' => $edit['author'],
);
user_load($user_params);
$user_params = array(
'uid' => arg(1),
'mail' => $name,
'status' => 1,
);
user_load($user_params);
if (isset($edit['author']) && !($account = user_load(array(
'name' => $edit['author'],
)))) {
form_set_error('author', t('You have to specify a valid author.'));
}
$account = user_load(array(
'uid' => $node->uid,
));
if ($account = user_load(array(
'uid' => arg(1),
))) {
}
if ($account = user_load(array(
'uid' => arg(1),
'mail' => $name,
'status' => 1,
))) {
}
$user = user_load(array(
'uid' => $array['uid'],
));
$account = user_load(array(
'uid' => (int) $uid,
));
$account = user_load(array(
'mail' => $name,
'status' => 1,
));
}
function example_2_user_load_multiple($parameter) {
$user = user_load($parameter);
}
function example_user_authenticate() {
global $user;
$user = user_authenticate($form_values);
$user = user_authenticate(array(
'name' => $username,
'pass' => $password,
));
}
function example_profile_alter(&$account) {
foreach ($account->content as $key => $field) {
}
}
function example_node_load() {
$node = node_load(1);
$node = node_load($nid);
$node = node_load(array(
'nid' => 1,
));
$node = node_load(arg(1));
if ($node = node_load(1)) {
}
$node = node_load(1, 1);
$node = node_load($nid, $revision);
$node = node_load(array(
'nid' => 1,
), 1);
$node = node_load(1, 1, TRUE);
$node = node_load(array(
'nid' => 1,
), 1, TRUE);
$node = node_load($nid, $revision, $reset);
$node = node_load(array(
'title' => $title,
));
$node = node_load(array(
'title' => $title,
), 1);
$node = node_load(array(
'title' => $title,
), $vid);
$node = node_load(array(
'title' => $title,
), 1, TRUE);
if ($node = node_load(array(
'title' => $title,
))) {
}
}
function example_node_info() {
return array(
'blog' => array(
'name' => t('Blog entry'),
'module' => 'blog',
'description' => t('A <em>blog entry</em> is a single post to an online journal.'),
),
"example_item" => array(
"name" => t('Example item'),
"module" => 'node',
"description" => 'Test the node to node_content upgrade.',
"title_label" => t('Example item'),
"body_label" => t('Description'),
),
);
}
function example_node_info() {
$info = array(
'forum' => array(
'name' => t('Forum topic'),
'module' => 'forum',
'description' => t('A <em>forum topic</em> starts a new discussion thread within a forum.'),
'title_label' => t('Subject'),
),
"example_item" => array(
"name" => t('Example item'),
"module" => 'node',
"description" => 'Test the node to node_content upgrade.',
"title_label" => t('Example item'),
"body_label" => t('Description'),
),
);
return $info;
}
function example_node_info() {
$info = array();
$info['deadwood_item'] = array(
'name' => t('Deadwood item'),
'module' => 'deadwood',
'description' => 'Item for a deadwood conversion category.',
'title_label' => t('Deadwood item'),
'body_label' => t('Description'),
);
$info['example_item'] = array(
"name" => t('Example item'),
"module" => 'node',
"description" => 'Test the node to node_content upgrade.',
"title_label" => t('Example item'),
"body_label" => t('Description'),
);
return $info;
}
function example_node_info($reset = FALSE) {
static $types = array();
$title_label = t('Name');
$body_label = t('Description');
if (empty($types) || $reset) {
$types = array();
$types['product'] = array(
'name' => t('Product'),
'module' => 'uc_product',
'description' => t('This node displays the representation of a product for sale on the website. It includes all the unique information that can be attributed to a specific model number.'),
'title_label' => $title_label,
'body_label' => $body_label,
);
$result = db_query("SELECT pcid, name, description FROM {uc_product_classes}");
while ($class = db_fetch_object($result)) {
$types[$class->pcid] = array(
'name' => $class->name,
'module' => 'uc_product',
'description' => $class->description,
'title_label' => $title_label,
'body_label' => $body_label,
);
}
}
return $types;
}
function default_profile_tasks(&$task, $url) {
$types = array(
array(
'type' => 'page',
'name' => st('Page'),
'module' => 'node',
'description' => st("A <em>page</em>, similar in form to a <em>story</em>, is a simple method for creating and displaying information that rarely changes, such as an \"About us\" section of a website. By default, a <em>page</em> entry does not allow visitor comments and is not featured on the site's initial home page."),
'custom' => TRUE,
'modified' => TRUE,
'locked' => FALSE,
'help' => '',
'min_word_count' => '',
),
array(
'type' => 'story',
'name' => st('Story'),
'module' => 'node',
'description' => st("A <em>story</em>, similar in form to a <em>page</em>, is ideal for creating and displaying content that informs or engages website visitors. Press releases, site announcements, and informal blog-like entries may all be created with a <em>story</em> entry. By default, a <em>story</em> entry is automatically featured on the site's initial home page, and provides the ability to post comments."),
'custom' => TRUE,
'modified' => TRUE,
'locked' => FALSE,
'help' => '',
'min_word_count' => '',
),
);
foreach ($types as $type) {
$type = (object) _node_type_set_defaults($type);
node_type_save($type);
}
}
function _book_install_type_create() {
$book_node_type = array(
'type' => 'book',
'name' => t('Book page'),
'module' => 'node',
'description' => t('A <em>book page</em> is a page of content, organized into a collection of related entries collectively known as a <em>book</em>. A <em>book page</em> automatically displays links to adjacent pages, providing a simple navigation system for organizing and reviewing structured content.'),
'custom' => TRUE,
'modified' => TRUE,
'locked' => FALSE,
);
$book_node_type = (object) _node_type_set_defaults($book_node_type);
node_type_save($book_node_type);
variable_set('node_options_book', array(
'status',
));
variable_set('book_allowed_types', array(
'book',
));
variable_set('book_child_type', 'book');
}
function example_link($type, $node = NULL, $teaser = FALSE) {
$links = array();
if ($type == 'node' && $node->type == 'blog') {
if (arg(0) != 'blog' || arg(1) != $node->uid) {
$links['blog_usernames_blog'] = array(
'title' => t("!username's blog", array(
'!username' => $node->name,
)),
'href' => "blog/{$node->uid}",
'attributes' => array(
'title' => t("Read !username's latest blog entries.", array(
'!username' => $node->name,
)),
),
);
}
}
if ($type == 'comment' && $node->type == 'blog') {
if (arg(0) != 'blog' || arg(1) != $node->uid) {
$links['blog_usernames_blog'] = array(
'title' => t("!username's blog", array(
'!username' => $node->name,
)),
'href' => "blog/{$node->uid}",
'attributes' => array(
'title' => t("Read !username's latest blog entries.", array(
'!username' => $node->name,
)),
),
);
}
}
return $links;
}
function node_build_content($node, $build_mode = 'full') {
}
function taxonomy_node_view($node) {
if ($node->build_mode == NODE_BUILD_RSS) {
foreach ($node->taxonomy as $term) {
$node->rss_elements[] = array(
'key' => 'category',
'value' => $term->name,
'attributes' => array(
'domain' => url(taxonomy_term_path($term), array(
'absolute' => TRUE,
)),
),
);
}
}
}
function example_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
if ($op == 'delete') {
$node->nid = 0;
}
elseif ($op == 'prepare translation' && $a3 == 'account') {
$node->title = 'Get rid of the deadwood.';
}
else {
$node->body = 'Coder Upgrade is awesome.';
}
switch ($op) {
case 'alter':
break;
case 'delete':
break;
case 'delete revision':
break;
case 'insert':
break;
case 'load':
break;
case 'prepare':
break;
case 'prepare translation':
break;
case 'print':
break;
case 'rss item':
break;
case 'search result':
break;
case 'presave':
break;
case 'update':
break;
case 'update index':
break;
case 'validate':
break;
case 'view':
break;
case 'presave':
if ($node->nid && $node->moderate) {
$node->score = 0;
$node->users = '';
$node->votes = 0;
}
break;
case 'insert':
case 'update':
if ($node->moderate && user_access('access submission queue')) {
drupal_set_message(t('The post is queued for approval'));
}
elseif ($node->moderate) {
drupal_set_message(t('The post is queued for approval. The editors will decide whether it should be published.'));
}
break;
case 'view':
$node->content['my_additional_field'] = array(
'#value' => theme('mymodule_my_additional_field', $additional_field),
'#weight' => 10,
);
break;
}
}
function example_node_type($op, $info) {
if ($op == 'delete') {
variable_del('comment_' . $info->type);
}
elseif ($op == 'update' && $info->type == 'xxx' || $info->old_type == 3) {
if (!empty($info->old_type) && $info->old_type != $info->type) {
$setting = variable_get('comment_' . $info->old_type, COMMENT_NODE_READ_WRITE);
variable_del('comment_' . $info->old_type);
variable_set('comment_' . $info->type, $setting);
}
}
switch ($op) {
case 'delete':
case 'insert':
variable_del('comment_' . $info->type);
break;
case 'update':
if (!empty($info->old_type) && $info->old_type != $info->type) {
$setting = variable_get('comment_' . $info->old_type, COMMENT_NODE_READ_WRITE);
variable_del('comment_' . $info->old_type);
variable_set('comment_' . $info->type, $setting);
}
break;
}
}
function example_node_invoke_nodeapi() {
node_invoke_nodeapi($node, 'alter');
node_invoke_nodeapi($node, 'delete');
node_invoke_nodeapi($node, 'delete revision');
node_invoke_nodeapi($node, 'insert');
node_invoke_nodeapi($node, 'load');
node_invoke_nodeapi($node, 'prepare');
node_invoke_nodeapi($node, 'prepare translation');
node_invoke_nodeapi($node, 'presave');
node_invoke_nodeapi($node, 'search result');
node_invoke_nodeapi($node, 'update index');
node_invoke_nodeapi($node, 'update');
node_invoke_nodeapi($node, 'print');
node_invoke_nodeapi($node, 'rss item');
node_invoke_nodeapi($node, 'view');
node_invoke_nodeapi($node, 'view', TRUE);
node_invoke_nodeapi($node, 'view', FALSE, TRUE);
node_invoke_nodeapi($node, 'view', NULL, TRUE);
node_invoke_nodeapi($node, 'validate', $form);
node_invoke_nodeapi($node, $op);
node_invoke_nodeapi($node, $op, $a3);
node_invoke_nodeapi($node, $op, $a3, $a4);
}
function example_node_type_get_functions() {
$types = node_get_types();
$type = node_get_types('type');
$base = node_get_types('module');
$name = node_get_types('name');
$types = node_get_types('types');
$names = node_get_types('names');
$type = node_get_types('type', $node);
$base = node_get_types('module', $node);
$name = node_get_types('name', $node);
$types = node_get_types('types', $node);
$names = node_get_types('names', $node);
$type = node_get_types('type', $node, TRUE);
$base = node_get_types('module', $node, TRUE);
$name = node_get_types('name', $node, TRUE);
$node_types = node_get_types('types', NULL, TRUE);
$node_types = node_get_types('types', $node, TRUE);
$node_names = node_get_types('names', NULL, TRUE);
$node_names = node_get_types('names', $node, TRUE);
$type = node_get_types('type', NULL, FALSE);
$base = node_get_types('module', NULL, FALSE);
$name = node_get_types('name', NULL, FALSE);
$node_types = node_get_types('types', NULL, FALSE);
$node_types = node_get_types('types', NULL, FALSE);
$node_names = node_get_types('names', NULL, FALSE);
$node_names = node_get_types('names', NULL, FALSE);
$op = 'type';
$type = node_get_types($op, NULL, FALSE);
$node_types = array_map('check_plain', node_get_types('names'));
$node_types = array_keys(node_get_types());
$type_array = array(
'bundles' => node_get_types('names'),
);
$forum_types[$type] = array(
'title' => t('Post new @node_type', array(
'@node_type' => node_get_types('name', $type),
)),
'href' => 'node/add/' . str_replace('_', '-', $type) . '/' . $variables['tid'],
);
$form['name'][$node->nid] = array(
'#markup' => check_plain(node_get_types('name', $node)),
);
$form['name'][$node->nid] = array(
'#markup' => check_plain(node_get_types('name', $node, TRUE)),
);
$type = node_get_types('type', str_replace('-', '_', $arg[2]));
$function = node_get_types('base', $type) . '_load';
foreach (node_get_types() as $type => $name) {
}
foreach (node_get_types('types', NULL, TRUE) as $type) {
}
foreach (node_get_types('types', NULL, FALSE) as $type) {
}
}
function example_load($node) {
return db_fetch_object(db_query('SELECT * FROM {mytable} WHERE vid = %d', $node->vid));
}
function example_load($node) {
$additions = db_fetch_object(db_query('SELECT * FROM {mytable} WHERE vid = %d', $node->vid));
return $additions;
}
function example_locale_context() {
t('Welcome to our site', array(), 'de');
t('!user, welcome to our site', array(
'!user' => theme('username', $user),
), 'de');
t('!long-month-name May');
t('May');
t('!long-month-name May', array(), 'de');
t('May', array(), 'de');
$output = format_plural($node->comment_count, '1 comment', '@count comments', array(), 'de');
}
function example_example() {
}
function example_example() {
}
function example_example() {
}
function example_example() {
}
function example_book_toc() {
$toc = book_toc($bid, array(), 9);
$toc = book_toc($bid, array(
'item',
), 9);
$form = array(
'#type' => 'select',
'#title' => t('Parent item'),
'#default_value' => $book_link['plid'],
'#description' => t('The parent page in the book. The maximum depth for a book and all child pages is !maxdepth. Some pages in the selected book may not be available as parents if selecting them would exceed this limit.', array(
'!maxdepth' => MENU_MAX_DEPTH,
)),
'#options' => book_toc($book_link['bid'], array(
$book_link['mlid'],
), $book_link['parent_depth_limit']),
'#attributes' => array(
'class' => array(
'book-title-select',
),
),
);
}
function example_referer_uri() {
if (is_array(referer_uri())) {
}
$y = referer_uri();
}
function example_drupal_clone() {
if ($x = drupal_clone($xx['y'])) {
}
$y = drupal_clone($xx['y']);
$this->object1 = drupal_clone($this->object1);
}
function example_actions_synchronize() {
actions_synchronize($actions_in_code = array(), $delete_orphans = FALSE);
}
function example_url_is_external() {
}
function example_drupal_valid_path() {
if (!menu_valid_path(array(
'link_path' => $form_state['values']['site_frontpage_1'],
))) {
}
$item = array(
'link_path' => $form_state['values']['site_frontpage_2A'],
);
if (!menu_valid_path($item)) {
}
$item = array(
'link_path' => $form_state['values']['site_frontpage_2B'],
'link_title' => $var,
);
if (!menu_valid_path($item)) {
}
$item['link_path'] = $form_state['values']['site_frontpage_3'];
$item['link_title'] = $var;
if (!menu_valid_path($item)) {
}
if (!menu_valid_path($item->xx)) {
}
if (!menu_valid_path($item['xx'])) {
}
}
function example_action_info() {
return array(
'comment_unpublish_action' => array(
'description' => t('Unpublish comment'),
'type' => 'comment',
'configurable' => FALSE,
'hooks' => array(
'comment' => array(
'insert',
'update',
),
),
),
'comment_unpublish_by_keyword_action' => array(
'description' => t('Unpublish comment containing keyword(s)'),
'type' => 'comment',
'configurable' => TRUE,
'hooks' => array(
'comment' => array(
'insert',
'update',
),
"taxonomy" => array(
"insert",
"update",
"delete",
"view",
),
),
),
);
}
function example_action_info() {
$info = array(
'comment_unpublish_action' => array(
'description' => t('Unpublish comment'),
'type' => 'comment',
'configurable' => FALSE,
'hooks' => array(
'comment' => array(
'insert',
'update',
),
),
),
'comment_unpublish_by_keyword_action' => array(
'description' => t('Unpublish comment containing keyword(s)'),
'type' => 'comment',
'configurable' => TRUE,
'hooks' => array(
'comment' => array(
'insert',
'update',
),
"taxonomy" => array(
"insert",
"update",
"delete",
"view",
),
),
),
);
return $info;
}
function example_action_info() {
$info['comment_unpublish_action'] = array(
'description' => t('Unpublish comment'),
'type' => 'comment',
'configurable' => FALSE,
'hooks' => array(
'comment' => array(
'insert',
'update',
),
),
);
$info['comment_unpublish_by_keyword_action'] = array(
'description' => t('Unpublish comment containing keyword(s)'),
'type' => 'comment',
'configurable' => TRUE,
'hooks' => array(
'comment' => array(
'insert',
'update',
),
"taxonomy" => array(
"insert",
"update",
"delete",
"view",
),
),
);
return $info;
}
function example_hook_info() {
return array(
'node' => array(
'nodeapi' => array(
'presave' => array(
'runs when' => t('When either saving a new post or updating an existing post'),
),
'insert' => array(
'runs when' => t('After saving a new post'),
),
'update' => array(
'runs when' => t('After saving an updated post'),
),
'delete' => array(
'runs when' => t('After deleting a post'),
),
'view' => array(
'runs when' => t('When content is viewed by an authenticated user'),
),
),
),
'taxonomy' => array(
'taxonomy' => array(
'insert' => array(
'runs when' => t('After saving a new term to the database'),
),
'update' => array(
'runs when' => t('After saving an updated term to the database'),
),
'delete' => array(
'runs when' => t('After deleting a term'),
),
),
),
);
}
function example_hook_info() {
$info = array(
'node' => array(
'nodeapi' => array(
'presave' => array(
'runs when' => t('When either saving a new post or updating an existing post'),
),
'insert' => array(
'runs when' => t('After saving a new post'),
),
'update' => array(
'runs when' => t('After saving an updated post'),
),
'delete' => array(
'runs when' => t('After deleting a post'),
),
'view' => array(
'runs when' => t('When content is viewed by an authenticated user'),
),
),
),
'taxonomy' => array(
'taxonomy' => array(
'insert' => array(
'runs when' => t('After saving a new term to the database'),
),
'update' => array(
'runs when' => t('After saving an updated term to the database'),
),
'delete' => array(
'runs when' => t('After deleting a term'),
),
),
),
);
return $info;
}
function example_hook_info() {
$info['node'] = array(
'nodeapi' => array(
'presave' => array(
'runs when' => t('When either saving a new post or updating an existing post'),
),
'insert' => array(
'runs when' => t('After saving a new post'),
),
'update' => array(
'runs when' => t('After saving an updated post'),
),
'delete' => array(
'runs when' => t('After deleting a post'),
),
'view' => array(
'runs when' => t('When content is viewed by an authenticated user'),
),
),
);
$info['taxonomy'] = array(
'taxonomy' => array(
'insert' => array(
'runs when' => t('After saving a new term to the database'),
),
'update' => array(
'runs when' => t('After saving an updated term to the database'),
),
'delete' => array(
'runs when' => t('After deleting a term'),
),
),
);
return $info;
}
function example_drupal_goto_params() {
drupal_goto('/node/1');
drupal_goto('/node/1', 'a=b&c=d');
drupal_goto('/node/1', 'a=b&c=d', $fragment);
drupal_goto('/node/1', $query, $fragment);
drupal_goto('/node/1', 'a=b&c=d', $fragment, 301);
drupal_goto('/node/1', NULL, $fragment);
drupal_goto('/node/1', NULL, NULL, 301);
drupal_goto('/node/1', '');
drupal_goto('/node/1', "");
$query = 'a=b&c=d';
drupal_goto($path);
drupal_goto($path, $query);
drupal_goto($path, $query, $fragment);
drupal_goto($path, $query, $fragment);
drupal_goto($path, $query, $fragment, 301);
drupal_goto($path, NULL, $fragment);
drupal_goto($path, NULL, NULL, 301);
drupal_goto($path, QUERY, FRAGMENT);
}
function example_date_format() {
$shortdate = format_date($log->timestamp, 'small');
$mediumdate = format_date($log->timestamp, 'medium');
$longdate = format_date($log->timestamp, 'large');
}
function example_url_query_parameter() {
$url = url("node/1");
$url = url("node/1", array(
"absolute" => TRUE,
));
$url = url("node/1", array(
"query" => "a=b&c=d%40e",
));
$url = url("node/1", array(
"absolute" => TRUE,
"query" => "a=b&c=d%40e",
));
$url = url('node/1', array(
'absolute' => TRUE,
'query' => 'a=b&c[]=d&c[]=e',
));
$url = url("node/1", array(
"alias" => TRUE,
"query" => "a=b&c=d%40e",
"fragment" => 'test',
));
$url = url("node/1", array(
'query' => array(
'a' => 'b',
'c' => 'd%40e',
),
));
$url = url('node/1', array(
'absolute' => TRUE,
'query' => array(
'a' => 'b',
'c' => array(
'd',
'e',
),
),
));
$url = url("node/1", array(
"alias" => TRUE,
"query" => array(
'a' => 'b',
'c' => 'd%40e',
),
"fragment" => 'test',
));
}
function example_watchdog_emerg() {
watchdog('example', 'This is an example emergency message', WATCHDOG_EMERG);
$severity = WATCHDOG_EMERG;
watchdog('example', 'This is an example emergency message', $severity);
}