summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorlsces <lester@lsces.co.uk>2025-08-27 17:22:06 +0100
committerlsces <lester@lsces.co.uk>2025-08-27 17:22:06 +0100
commitb334f17af5468923c93bad566f4e343378986569 (patch)
tree3d47f5a6e97aabf84f30714d136cde9244b04d04 /modules
parent109e45dae91f26175779c15d99889486589ef1a3 (diff)
downloadsearch-b334f17af5468923c93bad566f4e343378986569.tar.gz
search-b334f17af5468923c93bad566f4e343378986569.tar.bz2
search-b334f17af5468923c93bad566f4e343378986569.zip
Code updated to PHP8.4 and namespace
Diffstat (limited to 'modules')
-rw-r--r--modules/mod_ajax_search.tpl6
-rw-r--r--modules/mod_global_search.php10
-rw-r--r--modules/mod_global_search.tpl7
-rw-r--r--modules/mod_package_search.php12
4 files changed, 19 insertions, 16 deletions
diff --git a/modules/mod_ajax_search.tpl b/modules/mod_ajax_search.tpl
index 4375f6a..5ab1a4b 100644
--- a/modules/mod_ajax_search.tpl
+++ b/modules/mod_ajax_search.tpl
@@ -1,7 +1,7 @@
{* this needs to go in <head>, but we don't have a way of doing that from a module yet. *}
-<script type="text/javascript" src="{$smarty.const.UTIL_PKG_URL}javascript/libs/prototype.js"></script>
-<script type="text/javascript" src="{$smarty.const.UTIL_PKG_URL}javascript/libs/live_search.js"></script>
-<script type="text/javascript">
+<script src="{$smarty.const.UTIL_PKG_URL}javascript/libs/prototype.js"></script>
+<script src="{$smarty.const.UTIL_PKG_URL}javascript/libs/live_search.js"></script>
+<script>
var search = new LiveSearch($('search_box'), $('search_results'));
</script>
{* end of <head> section *}
diff --git a/modules/mod_global_search.php b/modules/mod_global_search.php
index f658299..5e8c51c 100644
--- a/modules/mod_global_search.php
+++ b/modules/mod_global_search.php
@@ -17,11 +17,12 @@
/**
* Initialization
*/
-global $gLibertySystem;
-require_once(SEARCH_PKG_PATH."search_lib.php");
+global $gLibertySystem;
+use Bitweaver\Search\SearchLib;
+use Bitweaver\KernelTools;
if( empty( $contentTypes ) ) {
- $contentTypes = array( '' => tra( 'All Content' ) );
+ $contentTypes = [ '' => KernelTools::tra( 'All Content' ) ];
foreach( $gLibertySystem->mContentTypes as $cType ) {
if (SearchLib::has_permission($cType["content_type_guid"])
and ( ! $gBitSystem->getConfig('search_restrict_types') ||
@@ -30,5 +31,4 @@ if( empty( $contentTypes ) ) {
}
}
}
-$_template->tpl_vars['contentTypes'] = new Smarty_variable( $contentTypes );
-?>
+$gBitSmarty->assign( 'contentTypes', $contentTypes );
diff --git a/modules/mod_global_search.tpl b/modules/mod_global_search.tpl
index 455a82e..15a7659 100644
--- a/modules/mod_global_search.tpl
+++ b/modules/mod_global_search.tpl
@@ -1,7 +1,10 @@
-{* $Header$ *}
-
+{strip}
+{if empty($moduleTitle)}
+ {assign var=moduleTitle value=""}
+{/if}
{if $gBitSystem->isPackageActive( 'search' )}
{bitmodule title="$moduleTitle" name="search_new"}
{include file="bitpackage:search/global_mini_search.tpl"}
{/bitmodule}
{/if}
+{/strip} \ No newline at end of file
diff --git a/modules/mod_package_search.php b/modules/mod_package_search.php
index 071d475..925fc66 100644
--- a/modules/mod_package_search.php
+++ b/modules/mod_package_search.php
@@ -14,16 +14,17 @@
* @subpackage modules
*/
+use Bitweaver\Search\SearchLib;
+use Bitweaver\KernelTools;
+
/**
* Initialization
*/
-require_once(SEARCH_PKG_PATH."search_lib.php");
-
+ global $gBitSystem, $gLibertySystem;
+
$tplName = $gBitSystem->getActivePackage().'_mini_search.tpl';
$searchTemplatePath = BIT_ROOT_URL.constant( strtoupper( $gBitSystem->getActivePackage() ).'_PKG_PATH' ).'templates/'.$tplName;
- global $gLibertySystem;
-
if( file_exists( $searchTemplatePath ) ) {
$searchTemplateRsrc = 'bitpackage:'.$gBitSystem->getActivePackage().'/'.$tplName;
$searchTitle = ucfirst( $gBitSystem->getActivePackage() );
@@ -33,7 +34,7 @@ require_once(SEARCH_PKG_PATH."search_lib.php");
}
if( empty( $contentTypes ) ) {
- $contentTypes = array( '' => tra( 'All Content' ) );
+ $contentTypes = [ '' => KernelTools::tra( 'All Content' ) ];
foreach( $gLibertySystem->mContentTypes as $cType ) {
if (SearchLib::has_permission($cType["content_type_guid"])
and ( ! $gBitSystem->getConfig('search_restrict_types') ||
@@ -46,4 +47,3 @@ require_once(SEARCH_PKG_PATH."search_lib.php");
$gBitSmarty->assign( 'searchTitle', $searchTitle );
$gBitSmarty->assign( 'miniSearchRsrc', $searchTemplateRsrc );
-?>