本文整理汇总了PHP中SearchEngine::codifySearchString方法的典型用法代码示例。如果您正苦于以下问题:PHP SearchEngine::codifySearchString方法的具体用法?PHP SearchEngine::codifySearchString怎么用?PHP SearchEngine::codifySearchString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchEngine
的用法示例。
在下文中一共展示了SearchEngine::codifySearchString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printSearchForm
/**
* Prints the search form
*
* Search works on a list of tokens entered into the search form.
*
* Tokens may be part of boolean expressions using &, |, !, and parens. (Comma is retained as a synonom of | for
* backwords compatibility.)
*
* Tokens may be enclosed in quotation marks to create exact pattern matches or to include the boolean operators and
* parens as part of the tag..
*
* @param string $prevtext text to go before the search form
* @param string $id css id for the search form, default is 'search'
* @param string $buttonSource optional path to the image for the button or if not a path to an image,
* this will be the button hint
* @param string $buttontext optional text for the button ("Search" will be the default text)
* @param string $iconsource optional theme based icon for the search fields toggle
* @param array $query_fields override selection for enabled fields with this list
* @param array $objects_list optional array of things to search eg. [albums]=>[list], etc.
* if the list is simply 0, the objects will be omitted from the search
* @param string $within set to true to search within current results, false to search fresh
* @since 1.1.3
*/
function printSearchForm($prevtext = NULL, $id = 'search', $buttonSource = NULL, $buttontext = '', $iconsource = NULL, $query_fields = NULL, $object_list = NULL, $within = NULL)
{
global $_zp_adminJS_loaded, $_zp_current_search;
$engine = new SearchEngine();
if (!is_null($_zp_current_search) && !$_zp_current_search->getSearchWords()) {
$engine->clearSearchWords();
}
if (!is_null($object_list)) {
if (array_key_exists(0, $object_list)) {
// handle old form albums list
trigger_error(gettext('printSearchForm $album_list parameter is deprecated. Pass array("albums"=>array(album, album, ...)) instead.'), E_USER_NOTICE);
$object_list = array('albums' => $object_list);
}
}
if (empty($buttontext)) {
$buttontext = gettext("Search");
}
$zf = WEBPATH . "/" . ZENFOLDER;
$searchwords = $engine->codifySearchString();
if (substr($searchwords, -1, 1) == ',') {
$searchwords = substr($searchwords, 0, -1);
}
if (empty($searchwords)) {
$within = false;
$hint = '%s';
} else {
$hint = gettext('%s within previous results');
}
if (preg_match('!\\/(.*)[\\.png|\\.jpg|\\.jpeg|\\.gif]$!', $buttonSource)) {
$buttonSource = 'src="' . $buttonSource . '" alt="' . $buttontext . '"';
$button = 'title="' . sprintf($hint, $buttontext) . '"';
$type = 'image';
} else {
$type = 'submit';
if ($buttonSource) {
$button = 'value="' . $buttontext . '" title="' . sprintf($hint, $buttonSource) . '"';
$buttonSource = '';
} else {
$button = 'value="' . $buttontext . '" title="' . sprintf($hint, $buttontext) . '"';
}
}
if (empty($iconsource)) {
$iconsource = WEBPATH . '/' . ZENFOLDER . '/images/searchfields_icon.png';
}
if (is_null($within)) {
$within = getOption('search_within');
}
if (MOD_REWRITE) {
$searchurl = SEO_WEBPATH . '/' . _SEARCH_ . '/';
} else {
$searchurl = WEBPATH . "/index.php?p=search";
}
if (!$within) {
$engine->clearSearchWords();
}
$fields = $engine->allowedSearchFields();
if (!$_zp_adminJS_loaded) {
$_zp_adminJS_loaded = true;
?>
<script type="text/javascript" src="<?php
echo WEBPATH . '/' . ZENFOLDER;
?>
/js/admin.js"></script>
<?php
}
?>
<div id="<?php
echo $id;
?>
">
<!-- search form -->
<form method="post" action="<?php
echo $searchurl;
?>
" id="search_form">
<script type="text/javascript">
// <!-- <![CDATA[
//.........这里部分代码省略.........
示例2: gettext
printTabs();
echo "\n" . '<div id="content">';
zp_apply_filter('admin_note', 'albums', 'dynamic');
echo "<h1>" . gettext("zenphoto Create Dynamic Album") . "</h1>\n";
if (isset($_POST['savealbum'])) {
// we fell through, some kind of error
echo "<div class=\"errorbox space\">";
echo "<h2>" . gettext("Failed to save the album file") . "</h2>";
echo "</div>\n";
}
$albumlist = array();
genAlbumUploadList($albumlist);
$params = trim(zp_getCookie('zenphoto_search_params'));
$search->setSearchParams($params);
$fields = $search->fieldList;
$albumname = $words = $search->codifySearchString();
$images = $search->getImages(0);
foreach ($images as $image) {
$folder = $image['folder'];
$filename = $image['filename'];
$imagelist[] = '/' . $folder . '/' . $filename;
}
$subalbums = $search->getAlbums(0);
foreach ($subalbums as $folder) {
getSubalbumImages($folder);
}
$albumname = sanitize_path($albumname);
$albumname = seoFriendly($albumname);
$old = '';
while ($old != $albumname) {
$old = $albumname;
示例3: gettext
echo "\n" . '<div id="main">';
printTabs();
echo "\n" . '<div id="content">';
zp_apply_filter('admin_note', 'albums', 'dynamic');
echo "<h1>" . gettext("Create Dynamic Album") . "</h1>\n";
if (isset($_POST['savealbum'])) {
// we fell through, some kind of error
echo "<div class=\"errorbox space\">";
echo "<h2>" . gettext("Failed to save the album file") . "</h2>";
echo "</div>\n";
}
$albumlist = array();
genAlbumList($albumlist);
$fields = $search->fieldList;
$albumname = $search->getSearchWords();
$words = $search->codifySearchString();
$images = $search->getImages(0);
foreach ($images as $image) {
$folder = $image['folder'];
$filename = $image['filename'];
$imagelist[] = '/' . $folder . '/' . $filename;
}
$subalbums = $search->getAlbums(0);
foreach ($subalbums as $folder) {
getSubalbumImages($folder);
}
$albumname = sanitize_path($albumname);
$albumname = seoFriendly($albumname);
$old = '';
while ($old != $albumname) {
$old = $albumname;
示例4: printSearchForm
/**
* Prints the search form
*
* Search works on a list of tokens entered into the search form.
*
* Tokens may be part of boolean expressions using &, |, !, and parens. (Comma is retained as a synonom of | for
* backwords compatibility.)
*
* Tokens may be enclosed in quotation marks to create exact pattern matches or to include the boolean operators and
* parens as part of the tag..
*
* @param string $prevtext text to go before the search form
* @param string $id css id for the search form, default is 'search'
* @param string $buttonSource optional path to the image for the button or if not a path to an image,
* this will be the button hint
* @param string $buttontext optional text for the button ("Search" will be the default text)
* @param string $iconsource optional theme based icon for the search fields toggle
* @param array $query_fields override selection for enabled fields with this list
* @param array $objects_list optional array of things to search eg. [albums]=>[list], etc.
* if the list is simply 0, the objects will be omitted from the search
* @param string $within set to true to search within current results, false to search fresh
* @since 1.1.3
*/
function printSearchForm($prevtext = NULL, $id = 'search', $buttonSource = NULL, $buttontext = '', $iconsource = NULL, $query_fields = NULL, $object_list = NULL, $within = NULL)
{
global $_zp_adminJS_loaded, $_zp_current_search, $_zp_current_album;
$engine = new SearchEngine();
if (!is_null($_zp_current_search) && !$_zp_current_search->getSearchWords()) {
$engine->clearSearchWords();
}
if (empty($buttontext)) {
$buttontext = gettext("Search");
}
$zf = WEBPATH . "/" . ZENFOLDER;
$searchwords = $engine->codifySearchString();
if (substr($searchwords, -1, 1) == ',') {
$searchwords = substr($searchwords, 0, -1);
}
if (empty($searchwords)) {
$within = false;
$hint = '%s';
} else {
$hint = gettext('%s within previous results');
}
if (preg_match('!\\/(.*)[\\.png|\\.jpg|\\.jpeg|\\.gif]$!', $buttonSource)) {
$buttonSource = 'src="' . $buttonSource . '" alt="' . $buttontext . '"';
$button = 'title="' . sprintf($hint, $buttontext) . '"';
$type = 'image';
} else {
$type = 'submit';
if ($buttonSource) {
$button = 'value="' . $buttontext . '" title="' . sprintf($hint, $buttonSource) . '"';
$buttonSource = '';
} else {
$button = 'value="' . $buttontext . '" title="' . sprintf($hint, $buttontext) . '"';
}
}
if (empty($iconsource)) {
$iconsource = WEBPATH . '/' . ZENFOLDER . '/images/searchfields_icon.png';
}
if (is_null($within)) {
$within = getOption('search_within');
}
if (MOD_REWRITE) {
$searchurl = SEO_WEBPATH . '/' . _SEARCH_ . '/';
} else {
$searchurl = WEBPATH . "/index.php?p=search";
}
if (!$within) {
$engine->clearSearchWords();
}
$fields = $engine->allowedSearchFields();
if (!$_zp_adminJS_loaded) {
$_zp_adminJS_loaded = true;
?>
<script type="text/javascript" src="<?php
echo WEBPATH . '/' . ZENFOLDER;
?>
/js/admin.js"></script>
<?php
}
?>
<div id="<?php
echo $id;
?>
">
<!-- search form -->
<script type="text/javascript">
// <!-- <![CDATA[
var within = <?php
echo (int) $within;
?>
;
function search_(way) {
within = way;
if (way) {
$('#search_submit').attr('title', '<?php
echo sprintf($hint, $buttontext);
?>
');
//.........这里部分代码省略.........