当前位置: 首页>>代码示例>>PHP>>正文


PHP SearchEngine::allowedSearchFields方法代码示例

本文整理汇总了PHP中SearchEngine::allowedSearchFields方法的典型用法代码示例。如果您正苦于以下问题:PHP SearchEngine::allowedSearchFields方法的具体用法?PHP SearchEngine::allowedSearchFields怎么用?PHP SearchEngine::allowedSearchFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SearchEngine的用法示例。


在下文中一共展示了SearchEngine::allowedSearchFields方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: gettext

			value="<?php 
echo $words;
?>
" /></td>
	</tr>
	<tr>
		<td><?php 
echo gettext("Search fields:");
?>
</td>
		<td>
		<?php 
echo '<ul class="searchchecklist">' . "\n";
$selected_fields = array();
$engine = new SearchEngine();
$available_fields = $engine->allowedSearchFields();
foreach ($available_fields as $key => $value) {
    if ($value & $fields) {
        $selected_fields[$key] = $value;
    }
}
generateUnorderedListFromArray($selected_fields, $available_fields, '_SEARCH_', false, true, true);
echo '</ul>';
?>
		
		</td>
	</tr>

</table>

<input type="submit" value="<?php 
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:31,代码来源:admin-dynamic-album.php

示例2: gettext

        echo gettext("A reminder hint for the password.");
        ?>
										</td>
									</tr>
									<?php 
    }
    ?>
								<tr>
									<td><?php 
    echo gettext("Search behavior settings:");
    ?>
</td>
									<?php 
    $engine = new SearchEngine();
    $fields = $engine->getSearchFieldList();
    $set_fields = $engine->allowedSearchFields();
    $fields = array_diff($fields, $set_fields);
    ?>
								<script>
																					$(function() {
																					$("#resizable").resizable({
																					maxWidth: 350,
																									minWidth: 350, minHeight: 120,
																									resize: function(event, ui) {
																									$('#searchchecklist').height($('#resizable').height());
																									}
																					});
																					});</script>
								<td>
									<?php 
    echo gettext('Fields list:');
开发者ID:JoniWeiss,项目名称:JoniWebGirl,代码行数:31,代码来源:admin-options.php

示例3: 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[
//.........这里部分代码省略.........
开发者ID:IliyanGochev,项目名称:zenphoto,代码行数:101,代码来源:template-functions.php

示例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);
    ?>
');
//.........这里部分代码省略.........
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:101,代码来源:template-functions.php

示例5: 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
* @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 $reseticonsource optional theme based icon for reset search icon
* @since 1.1.3
*/
function printSearchForm($prevtext = NULL, $id = 'search', $buttonSource = NULL, $buttontext = '', $iconsource = NULL, $query_fields = NULL, $object_list = NULL, $reseticonsource = NULL)
{
    global $_zp_adminJS_loaded;
    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");
    } else {
        $buttontext = sanitize($buttontext);
    }
    $zf = WEBPATH . "/" . ZENFOLDER;
    $searchwords = getSearchWords();
    if (substr($searchwords, -1, 1) == ',') {
        $searchwords = substr($searchwords, 0, -1);
    }
    if (empty($searchwords)) {
        $hint = '%s';
    } else {
        $hint = gettext('%s within previous results');
    }
    if (empty($buttonSource)) {
        $type = 'submit';
        $button = 'value="' . $buttontext . '" title="' . sprintf($hint, $buttontext) . '"';
    } else {
        $buttonSource = 'src="' . $buttonSource . '" alt="' . $buttontext . '"';
        $button = 'title="' . sprintf($hint, $buttontext) . '"';
        $type = 'image';
    }
    if (empty($iconsource)) {
        $iconsource = WEBPATH . '/' . ZENFOLDER . '/images/searchfields_icon.png';
    }
    if (empty($reseticonsource)) {
        $reseticonsource = WEBPATH . '/' . ZENFOLDER . '/images/reset_icon.png';
    }
    if (MOD_REWRITE) {
        $searchurl = '/page/search/';
    } else {
        $searchurl = "/index.php?p=search";
    }
    $engine = new SearchEngine();
    $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 WEBPATH . $searchurl;
    ?>
" id="search_form">
			<script type="text/javascript">
				// <!-- <![CDATA[
				function reset_search() {
					lastsearch='';
					$('#reset_search').hide();
					$('#search_submit').attr('title', '<?php 
    echo $buttontext;
    ?>
');
					$('#search_input').val('');
				}
				var lastsearch = '<?php 
    echo addslashes(html_entity_decode(addslashes($searchwords)));
//.........这里部分代码省略.........
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:101,代码来源:template-functions.php

示例6: 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.) If tokens are separated by spaces, the OR function is presumed.
 *
 * 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
 * @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
 * @since 1.1.3
 */
function printSearchForm($prevtext = NULL, $id = 'search', $buttonSource = NULL, $buttontext = '', $iconsource = NULL)
{
    global $_zp_adminJS_loaded;
    if (empty($buttontext)) {
        $buttontext = gettext("Search");
    } else {
        $buttontext = sanitize($buttontext);
    }
    if (checkforPassword(true)) {
        return;
    }
    $zf = WEBPATH . "/" . ZENFOLDER;
    $dataid = $id . '_data';
    $searchwords = isset($_POST['words']) ? html_encode(sanitize($_REQUEST['words'], 0), false) : '';
    $fields = getOption('search_fields');
    if (empty($buttonSource)) {
        $type = 'submit';
    } else {
        $buttonSource = 'src="' . $buttonSource . '" alt="' . $buttontext . '"';
        $type = 'image';
    }
    if (empty($iconsource)) {
        $iconsource = WEBPATH . '/' . ZENFOLDER . '/images/searchfields_icon.png';
    }
    if (getOption('mod_rewrite')) {
        $searchurl = '/page/search/';
    } else {
        $searchurl = "/index.php?p=search";
    }
    $engine = new SearchEngine();
    $fields = array_flip($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="search"><!-- search form -->

	<form method="post" action="<?php 
    echo WEBPATH . $searchurl;
    ?>
" id="search_form">
	<?php 
    echo $prevtext;
    ?>
	<input type="text" name="words" value="<?php 
    echo $searchwords;
    ?>
" id="search_input" size="10" />
	<?php 
    if (count($fields) > 1) {
        ?>
		<a href="javascript: toggle('searchextrashow');"><img src="<?php 
        echo $iconsource;
        ?>
" alt="<?php 
        echo gettext('select search fields');
        ?>
" id="searchfields_icon" /></a>
	<?php 
    }
    ?>
	<input type="<?php 
    echo $type;
    ?>
" value="<?php 
    echo $buttontext;
    ?>
" class="pushbutton" id="search_submit" <?php 
    echo $buttonSource;
    ?>
 />
	<br />
	<?php 
    if (count($fields) > 1) {
        natcasesort($fields);
        $fields = array_flip($fields);
//.........这里部分代码省略.........
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:101,代码来源:template-functions.php

示例7: constructor

 /**
  *
  * This method establishes the current set of database fields. It will add the
  * fields to the database if they are not already present. Fields from previous
  * constructor calls that are no longer in the list will be removed from the
  * database (along with any data associated with them.)
  *
  * @param array $newfields
  */
 function constructor($me, $newfields)
 {
     $database = array();
     foreach (getDBTables() as $table) {
         $tablecols = db_list_fields($table);
         foreach ($tablecols as $key => $datum) {
             $database[$table][$datum['Field']] = $datum;
         }
     }
     $current = $fields = $searchDefault = array();
     if (extensionEnabled($me)) {
         //need to update the database tables.
         foreach ($newfields as $newfield) {
             $table = $newfield['table'];
             $name = $newfield['name'];
             if (!($existng = isset($database[$table][$name]))) {
                 if (isset($newfield['searchDefault']) && $newfield['searchDefault']) {
                     $searchDefault[] = $name;
                 }
             }
             if (is_null($newfield['type'])) {
                 if ($name == 'tags') {
                     setOption('adminTagsTab', 1);
                 }
             } else {
                 switch (strtolower($newfield['type'])) {
                     default:
                         $dbType = strtoupper($newfield['type']);
                         break;
                     case 'int':
                         $dbType = strtoupper($newfield['type']) . '(' . min(255, $newfield['size']) . ')';
                         if (isset($newfield['attribute'])) {
                             $dbType .= ' ' . $newfield['attribute'];
                             unset($newfield['attribute']);
                         }
                         break;
                     case 'varchar':
                         $dbType = strtoupper($newfield['type']) . '(' . min(255, $newfield['size']) . ')';
                         break;
                 }
                 if ($existng) {
                     if (strtoupper($database[$table][$name]['Type']) != $dbType || empty($database[$table][$name]['Comment'])) {
                         $cmd = ' CHANGE `' . $name . '`';
                     } else {
                         $cmd = NULL;
                     }
                     unset($database[$table][$name]);
                 } else {
                     $cmd = ' ADD COLUMN';
                 }
                 $sql = 'ALTER TABLE ' . prefix($newfield['table']) . $cmd . ' `' . $name . '` ' . $dbType;
                 if (isset($newfield['attribute'])) {
                     $sql .= ' ' . $newfield['attribute'];
                 }
                 if (isset($newfield['default'])) {
                     $sql .= ' DEFAULT ' . $newfield['default'];
                 }
                 $sql .= " COMMENT 'optional_{$me}'";
                 if ((!$cmd || setupQuery($sql)) && in_array($newfield['table'], array('albums', 'images', 'news', 'news_categories', 'pages'))) {
                     $fields[] = strtolower($newfield['name']);
                 }
                 $current[$newfield['table']][$newfield['name']] = $dbType;
             }
         }
         setOption(get_class($this) . '_addedFields', serialize($current));
         if (!empty($searchDefault)) {
             $fieldExtenderMutex = new zpMutex('fE');
             $fieldExtenderMutex->lock();
             $engine = new SearchEngine();
             $set_fields = $engine->allowedSearchFields();
             $set_fields = array_unique(array_merge($set_fields, $searchDefault));
             setOption('search_fields', implode(',', $set_fields));
             $fieldExtenderMutex->unlock();
         }
     } else {
         purgeOption(get_class($this) . '_addedFields');
     }
     foreach ($database as $table => $fields) {
         //drop fields no longer defined
         foreach ($fields as $field => $orphaned) {
             if ($orphaned['Comment'] == "optional_{$me}") {
                 $sql = 'ALTER TABLE ' . prefix($table) . ' DROP `' . $field . '`';
                 setupQuery($sql);
             }
         }
     }
 }
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:96,代码来源:fieldExtender.php


注:本文中的SearchEngine::allowedSearchFields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。