Now all modules are in core modules folder

This commit is contained in:
Manuel Cillero 2017-08-08 12:14:45 +02:00
parent 5ba1cdfa0b
commit 05b6a91b0c
1907 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,58 @@
<?php
/**
* @file custom_search-result.tpl.php
* Theme implementation for displaying a single search result.
*
* This template renders a single search result and is collected into
* custom_search-results.tpl.php. This and the parent template are
* dependent to one another sharing the markup for definition lists.
*
* Available variables:
* - $url: URL of the result.
* - $title: Title of the result.
* - $snippet: A small preview of the result. Does not apply to user searches.
* - $info: String of all the meta information ready for print. Does not apply
* to user searches.
* - $info_split: Contains same data as $info, split into a keyed array.
* - $type: The type of search, e.g., "node" or "user".
*
* Default keys within $info_split:
* - $info_split['type']: Node type.
* - $info_split['user']: Author of the node linked to users profile. Depends
* on permission.
* - $info_split['date']: Last update of the node. Short formatted.
* - $info_split['comment']: Number of comments output as "% comments", %
* being the count. Depends on comment.module.
* - $info_split['upload']: Number of attachments output as "% attachments", %
* being the count. Depends on upload.module.
*
* Since $info_split is keyed, a direct print of the item is possible.
* This array does not apply to user searches so it is recommended to check
* for their existance before printing. The default keys of 'type', 'user' and
* 'date' always exist for node searches. Modules may provide other data.
*
* <?php if (isset($info_split['comment'])) : ?>
* <span class="info-comment">
* <?php print $info_split['comment']; ?>
* </span>
* <?php endif; ?>
*
* To check for all available data within $info_split, use the code below.
*
* <?php print '<pre>'. check_plain(print_r($info_split, 1)) .'</pre>'; ?>
*
* @see template_preprocess_custom_search_result()
*/
?>
<dt class="title">
<a href="<?php print $url; ?>"><?php print $title; ?></a>
</dt>
<dd>
<?php if ($snippet) : ?>
<p class="search-snippet"><?php print $snippet; ?></p>
<?php endif; ?>
<?php if ($info) : ?>
<p class="search-info"><?php print $info; ?></p>
<?php endif; ?>
</dd>

View file

@ -0,0 +1,37 @@
<?php
/**
* @file custom_search-results.tpl.php
* Theme implementation for displaying search results.
*
* This template collects each invocation of theme_search_result(). This and
* the child template are dependant to one another sharing the markup for
* definition lists.
*
* Note that modules may implement their own search type and theme function
* completely bypassing this template.
*
* Available variables:
* - $search_results: All results as it is rendered through
* search-result.tpl.php
* - $type: The type of search, e.g., "node" or "user".
* - $filter: Rendered content types filter
* - $filter_positon: above/below/disabled
*
* @see template_preprocess_custom_search_results()
*/
?>
<?php if (isset($filter) && $filter != '' && $filter_position == 'above') { ?>
<div class="custom-search-filter">
<?php print $filter; ?>
</div>
<?php } ?>
<dl class="search-results <?php print $type; ?>-results">
<?php print $search_results; ?>
</dl>
<?php if (isset($filter) && $filter != '' && $filter_position == 'below') { ?>
<div class="custom-search-filter">
<?php print $filter; ?>
</div>
<?php } ?>
<?php print $pager; ?>

View file

@ -0,0 +1,52 @@
<?php
/**
* @file custom_search-order-form.tpl.php
* Default theme implementation to configure search form elements.
*/
$element_regions = array(
'block' => array('title' => t('Block'), 'count' => 0),
'popup' => array('title' => t('Popup'), 'count' => 0),
);
foreach (element_children($form) as $element) $element_regions[$form[$element]['region']['#value']]['count']++;
// Add table javascript.
drupal_add_js('misc/tableheader.js');
drupal_add_js(drupal_get_path('module', 'custom_search') .'/js/custom_search_sort.js');
foreach ($element_regions as $region => $title) {
drupal_add_tabledrag('elements', 'match', 'sibling', 'region-select', 'region-select-'. $region, NULL, FALSE);
drupal_add_tabledrag('elements', 'order', 'sibling', 'sort-select', 'sort-select-'. $region);
}
?>
<table id="elements" class="sticky-enabled">
<thead>
<tr>
<th><?php print t('Element'); ?></th>
<th><?php print t('Region'); ?></th>
<th><?php print t('Weight'); ?></th>
</tr>
</thead>
<tbody>
<?php $row = 0; ?>
<?php foreach ($element_regions as $region => $region_data): ?>
<tr class="region region-<?php print $region?>">
<td colspan="3" class="region"><?php print $region_data['title']; ?></td>
</tr>
<tr class="region-message region-<?php print $region?>-message <?php print((!$region_data['count']) ? 'region-empty' : 'region-populated'); ?>">
<td colspan="3"><em><?php print t('No elements in this region'); ?></em></td>
</tr>
<?php foreach (element_children($form) as $element):
$data = $form[$element];
if ($data['region']['#value'] == $region): ?>
<tr class="draggable <?php print $row % 2 == 0 ? 'odd' : 'even'; ?>">
<td class="element"><?php print $data['#title']; ?></td>
<td><?php print drupal_render($data['region']); ?></td>
<td><?php print drupal_render($data['sort']); ?></td>
</tr>
<?php $row++; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php endforeach; ?>
</tbody>
</table>

View file

@ -0,0 +1,68 @@
<?php
/**
* @file
* User page callbacks for the custom_search module.
*/
/*
* Presents links to filter the search results.
*/
function custom_search_preprocess_search_results(&$variables) {
if ($variables['type'] == 'node') {
$variables['filter_position'] = variable_get('custom_search_filter', 'disabled');
// save # of results for collapsing advanced search
$GLOBALS['custom_search_nb_results'] = count($variables['results']);
// generate the filter
if (user_access('use custom search') && $variables['filter_position'] != 'disabled') {
// Get search words (minus type:node_type)
$keys = search_get_keys();
if (strpos($keys, 'type:') !== FALSE) {
$keys = drupal_substr($keys, 0, strpos($keys, 'type:')-1);
}
// Get Custom Search authorized types
$searchable_node_types = variable_get('custom_search_node_types', array());
$searchable_node_types = array_keys(array_filter($searchable_node_types, 'custom_search_filter_array'));
if (!count($searchable_node_types)) $searchable_node_types = array_keys(node_get_types('names'));
$node_types = db_query("SELECT type, name FROM {node_type} WHERE type IN (" . db_placeholders($searchable_node_types, 'varchar') . ")", $searchable_node_types);
// Build menu
$items = array();
$items[] = l(variable_get('custom_search_type_selector_all', CUSTOM_SEARCH_ALL_TEXT_DEFAULT), 'search/node/' . $keys);
while ($node_type = db_fetch_array($node_types)) {
// count # of results per type
$nbresults = 0;
foreach ($variables['results'] as $result) {
if ($result['node']->type == $node_type['type']) $nbresults++;
}
if ($nbresults) $items[] = l($node_type['name'], 'search/node/' . $keys . ' type:' . $node_type['type']);
}
if (!isset($variables['filter-title'])) {
$variables['filter-title'] = filter_xss(variable_get('custom_search_filter_label', CUSTOM_SEARCH_FILTER_LABEL_DEFAULT));
}
if (count($items) > 2) $variables['filter'] = theme('item_list', $items, $variables['filter-title']);
}
}
}
/*
* Customisation of the results info.
*/
function custom_search_preprocess_search_result(&$variables) {
// used to identify the correct info string
$comment_str = preg_replace("/[0-9] (\b[a-z]*\b).*/", "$1", t('1 comment'));
$attachment_str = preg_replace("/@*[a-z0-9]* (\b[a-z]*\b).*/", "$1", t('1 attachment'));
$infos = array();
if (isset($variables['info_split'])) {
foreach ($variables['info_split'] as $key => $info) {
if (!is_numeric($key)) {
if (variable_get('custom_search_results_info_' . $key, TRUE)) array_push($infos, $info);
}
else {
if (variable_get('custom_search_results_info_comment', TRUE) && !empty($comment_str) && strpos($info, $comment_str) !== FALSE) array_push($infos, $info);
if (variable_get('custom_search_results_info_upload', TRUE) && !empty($attachment_str) && strpos($info, $attachment_str) !== FALSE) array_push($infos, $info);
}
}
}
$variables['info'] = implode(' - ', $infos);
}