本文整理汇总了PHP中in_arrayi函数的典型用法代码示例。如果您正苦于以下问题:PHP in_arrayi函数的具体用法?PHP in_arrayi怎么用?PHP in_arrayi使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了in_arrayi函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: friendlycase
function friendlycase($title)
{
$ourData = get_option('fc_options');
$lowerCaseWords = array_map('trim', explode(',', $ourData['fc_text_lc']));
$upperCaseWords = array_map('trim', explode(',', $ourData['fc_text_uc']));
$ignoredWords = array_map('trim', explode(',', $ourData['fc_text_ig']));
$firstonly = $ourData['fc_firstonly'];
$wrapinspans = $ourData['fc_wrappit'];
$words = explode(' ', $title);
$countCycles = 0;
foreach ($words as $k => $word) {
$countCycles = $countCycles + 1;
if (in_arrayi($word, $lowerCaseWords)) {
$words[$k] = $wrapinspans == 1 ? "<span class='fc_lc'>" . mb_strtolower($word) . "</span>" : mb_strtolower($word);
} elseif (in_arrayi($word, $upperCaseWords)) {
$words[$k] = $wrapinspans == 1 ? "<span class='fc_uc'>" . strtoupper($word) . "</span>" : strtoupper($word);
} elseif (in_arrayi($word, $ignoredWords)) {
$n = in_arrayi($word, $ignoredWords);
$words[$k] = $wrapinspans == 1 ? "<span class='fc_ig'>" . $ignoredWords[$n] . "</span>" : $ignoredWords[$n];
} elseif ($firstonly == 1) {
if ($countCycles == 1) {
$words[$k] = ucwords(mb_strtolower($word));
} else {
$words[$k] = mb_strtolower($word);
}
} else {
$words[$k] = ucwords(mb_strtolower($word));
}
}
$newtitle = implode(' ', $words);
return ucfirst($newtitle);
}
示例2: runValidation
/**
* Run validation on the server side
*
* Method will run the validation on the server side (will not run the JS function type) and return
* the result
*
* @access public
* @param string &$errmsg The error message if the validation fails
* @return bool TRUE if the validation was successful, FALSE if it failed
*/
public function runValidation(&$errmsg)
{
if (!parent::runValidation($errmsg)) {
return false;
}
if ($this->getValue() == '') {
return true;
}
/**
* Just need to check that all our selected values actually existing within our options array
*/
if (empty($this->extraInfo['options'])) {
return true;
}
if (!in_arrayi($this->getValue(), $this->extraInfo['options'])) {
$errmsg = sprintf(GetLang('CustomFieldsValidationInvalidSelectOption'), $this->label);
return false;
}
return true;
}
示例3: dirprofile_init
//.........这里部分代码省略.........
if (local_user()) {
$x = q("select abook_xchan from abook where abook_channel = %d", intval(local_user()));
if ($x) {
foreach ($x as $xx) {
$contacts[] = $xx['abook_xchan'];
}
}
}
if ($url) {
$query = $url . '?f=&hash=' . $hash;
$x = z_fetch_url($query);
logger('dirprofile: return from upstream: ' . print_r($x, true), LOGGER_DATA);
if ($x['success']) {
$t = 0;
$j = json_decode($x['body'], true);
if ($j) {
if ($j['results']) {
$entries = array();
$photo = 'thumb';
foreach ($j['results'] as $rr) {
$profile_link = chanlink_url($rr['url']);
$pdesc = $rr['description'] ? $rr['description'] . '<br />' : '';
$qrlink = zid($rr['url']);
$connect_link = local_user() ? z_root() . '/follow?f=&url=' . urlencode($rr['address']) : '';
$online = remote_online_status($rr['address']);
if (in_array($rr['hash'], $contacts)) {
$connect_link = '';
}
$details = '';
if (strlen($rr['locale'])) {
$details .= $rr['locale'];
}
if (strlen($rr['region'])) {
if (strlen($rr['locale'])) {
$details .= ', ';
}
$details .= $rr['region'];
}
if (strlen($rr['country'])) {
if (strlen($details)) {
$details .= ', ';
}
$details .= $rr['country'];
}
if (strlen($rr['birthday'])) {
if (($years = age($rr['birthday'], 'UTC', '')) != 0) {
$details .= '<br />' . t('Age: ') . $years;
}
}
if (strlen($rr['gender'])) {
$details .= '<br />' . t('Gender: ') . $rr['gender'];
}
$page_type = '';
$profile = $rr;
if (x($profile, 'locale') == 1 || x($profile, 'region') == 1 || x($profile, 'postcode') == 1 || x($profile, 'country') == 1) {
$location = t('Location:');
}
$marital = x($profile, 'marital') == 1 ? t('Status: ') . $profile['marital'] : False;
$sexual = x($profile, 'sexual') == 1 ? t('Sexual Preference: ') . $profile['sexual'] : False;
$homepage = x($profile, 'homepage') == 1 ? t('Homepage: ') . linkify($profile['homepage']) : False;
$hometown = x($profile, 'hometown') == 1 ? t('Hometown: ') . $profile['hometown'] : False;
$about = x($profile, 'about') == 1 ? t('About: ') . bbcode($profile['about']) : False;
$keywords = x($profile, 'keywords') ? $profile['keywords'] : '';
if ($keywords) {
$keywords = str_replace(',', ' ', $keywords);
$keywords = str_replace(' ', ' ', $keywords);
$karr = explode(' ', $keywords);
$out = '';
if ($karr) {
if (local_user()) {
$r = q("select keywords from profile where uid = %d and is_default = 1 limit 1", intval(local_user()));
if ($r) {
$keywords = str_replace(',', ' ', $r[0]['keywords']);
$keywords = str_replace(' ', ' ', $keywords);
$marr = explode(' ', $keywords);
}
}
foreach ($karr as $k) {
if (strlen($out)) {
$out .= ', ';
}
if ($marr && in_arrayi($k, $marr)) {
$out .= '<strong>' . $k . '</strong>';
} else {
$out .= $k;
}
}
}
}
$entry = replace_macros(get_markup_template('direntry_large.tpl'), array('$id' => ++$t, '$profile_link' => $profile_link, '$qrlink' => $qrlink, '$photo' => $rr['photo_l'], '$alttext' => $rr['name'] . ' ' . $rr['address'], '$name' => $rr['name'], '$online' => $online ? t('Online Now') : '', '$details' => $pdesc . $details, '$profile' => $profile, '$address' => $rr['address'], '$location' => $location, '$gender' => $gender, '$pdesc' => $pdesc, '$marital' => $marital, '$homepage' => $homepage, '$hometown' => $hometown, '$about' => $about, '$kw' => $out ? t('Keywords: ') : '', '$keywords' => $out, '$conn_label' => t('Connect'), '$connect' => $connect_link));
echo $entry;
killme();
}
} else {
info(t("Not found.") . EOL);
}
}
}
}
}
示例4: import_directory_profile
/**
* @brief Imports a directory profile.
*
* @param string $hash
* @param array $profile
* @param string $addr
* @param number $ud_flags
* @param number $suppress_update default 0
* @return boolean $updated if something changed
*/
function import_directory_profile($hash, $profile, $addr, $ud_flags = UPDATE_FLAGS_UPDATED, $suppress_update = 0)
{
logger('import_directory_profile', LOGGER_DEBUG);
if (!$hash) {
return false;
}
$arr = array();
$arr['xprof_hash'] = $hash;
$arr['xprof_dob'] = datetime_convert('', '', $profile['birthday'], 'Y-m-d');
// !!!! check this for 0000 year
$arr['xprof_age'] = $profile['age'] ? intval($profile['age']) : 0;
$arr['xprof_desc'] = $profile['description'] ? htmlspecialchars($profile['description'], ENT_COMPAT, 'UTF-8', false) : '';
$arr['xprof_gender'] = $profile['gender'] ? htmlspecialchars($profile['gender'], ENT_COMPAT, 'UTF-8', false) : '';
$arr['xprof_marital'] = $profile['marital'] ? htmlspecialchars($profile['marital'], ENT_COMPAT, 'UTF-8', false) : '';
$arr['xprof_sexual'] = $profile['sexual'] ? htmlspecialchars($profile['sexual'], ENT_COMPAT, 'UTF-8', false) : '';
$arr['xprof_locale'] = $profile['locale'] ? htmlspecialchars($profile['locale'], ENT_COMPAT, 'UTF-8', false) : '';
$arr['xprof_region'] = $profile['region'] ? htmlspecialchars($profile['region'], ENT_COMPAT, 'UTF-8', false) : '';
$arr['xprof_postcode'] = $profile['postcode'] ? htmlspecialchars($profile['postcode'], ENT_COMPAT, 'UTF-8', false) : '';
$arr['xprof_country'] = $profile['country'] ? htmlspecialchars($profile['country'], ENT_COMPAT, 'UTF-8', false) : '';
$arr['xprof_about'] = $profile['about'] ? htmlspecialchars($profile['about'], ENT_COMPAT, 'UTF-8', false) : '';
$arr['xprof_homepage'] = $profile['homepage'] ? htmlspecialchars($profile['homepage'], ENT_COMPAT, 'UTF-8', false) : '';
$arr['xprof_hometown'] = $profile['hometown'] ? htmlspecialchars($profile['hometown'], ENT_COMPAT, 'UTF-8', false) : '';
$clean = array();
if (array_key_exists('keywords', $profile) and is_array($profile['keywords'])) {
import_directory_keywords($hash, $profile['keywords']);
foreach ($profile['keywords'] as $kw) {
$kw = trim(htmlspecialchars($kw, ENT_COMPAT, 'UTF-8', false));
$kw = trim($kw, ',');
$clean[] = $kw;
}
}
$arr['xprof_keywords'] = implode(' ', $clean);
// Self censored, make it so
// These are not translated, so the German "erwachsenen" keyword will not censor the directory profile. Only the English form - "adult".
if (in_arrayi('nsfw', $clean) || in_arrayi('adult', $clean)) {
q("update xchan set xchan_selfcensored = 1 where xchan_hash = '%s'", dbesc($hash));
}
$r = q("select * from xprof where xprof_hash = '%s' limit 1", dbesc($hash));
if ($arr['xprof_age'] > 150) {
$arr['xprof_age'] = 150;
}
if ($arr['xprof_age'] < 0) {
$arr['xprof_age'] = 0;
}
if ($r) {
$update = false;
foreach ($r[0] as $k => $v) {
if (array_key_exists($k, $arr) && $arr[$k] != $v) {
logger('import_directory_profile: update ' . $k . ' => ' . $arr[$k]);
$update = true;
break;
}
}
if ($update) {
q("update xprof set\n\t\t\t\txprof_desc = '%s',\n\t\t\t\txprof_dob = '%s',\n\t\t\t\txprof_age = %d,\n\t\t\t\txprof_gender = '%s',\n\t\t\t\txprof_marital = '%s',\n\t\t\t\txprof_sexual = '%s',\n\t\t\t\txprof_locale = '%s',\n\t\t\t\txprof_region = '%s',\n\t\t\t\txprof_postcode = '%s',\n\t\t\t\txprof_country = '%s',\n\t\t\t\txprof_about = '%s',\n\t\t\t\txprof_homepage = '%s',\n\t\t\t\txprof_hometown = '%s',\n\t\t\t\txprof_keywords = '%s'\n\t\t\t\twhere xprof_hash = '%s'", dbesc($arr['xprof_desc']), dbesc($arr['xprof_dob']), intval($arr['xprof_age']), dbesc($arr['xprof_gender']), dbesc($arr['xprof_marital']), dbesc($arr['xprof_sexual']), dbesc($arr['xprof_locale']), dbesc($arr['xprof_region']), dbesc($arr['xprof_postcode']), dbesc($arr['xprof_country']), dbesc($arr['xprof_about']), dbesc($arr['xprof_homepage']), dbesc($arr['xprof_hometown']), dbesc($arr['xprof_keywords']), dbesc($arr['xprof_hash']));
}
} else {
$update = true;
logger('import_directory_profile: new profile ');
q("insert into xprof (xprof_hash, xprof_desc, xprof_dob, xprof_age, xprof_gender, xprof_marital, xprof_sexual, xprof_locale, xprof_region, xprof_postcode, xprof_country, xprof_about, xprof_homepage, xprof_hometown, xprof_keywords) values ('%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') ", dbesc($arr['xprof_hash']), dbesc($arr['xprof_desc']), dbesc($arr['xprof_dob']), intval($arr['xprof_age']), dbesc($arr['xprof_gender']), dbesc($arr['xprof_marital']), dbesc($arr['xprof_sexual']), dbesc($arr['xprof_locale']), dbesc($arr['xprof_region']), dbesc($arr['xprof_postcode']), dbesc($arr['xprof_country']), dbesc($arr['xprof_about']), dbesc($arr['xprof_homepage']), dbesc($arr['xprof_hometown']), dbesc($arr['xprof_keywords']));
}
$d = array('xprof' => $arr, 'profile' => $profile, 'update' => $update);
call_hooks('import_directory_profile', $d);
if ($d['update'] && !$suppress_update) {
update_modtime($arr['xprof_hash'], random_string() . '@' . get_app()->get_hostname(), $addr, $ud_flags);
}
return $d['update'];
}
示例5: ManageCustomers
private function ManageCustomers($MsgDesc = "", $MsgStatus = "")
{
$GLOBALS['HideClearResults'] = "none";
$numCustomers = 0;
// Fetch any results, place them in the data grid
$GLOBALS['CustomerDataGrid'] = $this->ManageCustomersGrid($numCustomers);
// Was this an ajax based sort? Return the table now
if (isset($_REQUEST['ajax']) && $_REQUEST['ajax'] == 1) {
echo $GLOBALS['CustomerDataGrid'];
return;
}
if (isset($this->_customSearch['searchname'])) {
$GLOBALS['ViewName'] = isc_html_escape($this->_customSearch['searchname']);
} else {
$GLOBALS['ViewName'] = GetLang('AllCustomers');
$GLOBALS['HideDeleteViewLink'] = "none";
}
if (isset($this->_customSearch['searchname'])) {
$GLOBALS['CustomSearchName'] = ": " . isc_html_escape($this->_customSearch['searchname']);
}
// Get the custom search as option fields
$num_custom_searches = 0;
$GLOBALS['CustomSearchOptions'] = $GLOBALS['ISC_CLASS_ADMIN_CUSTOMSEARCH']->GetSearchesAsOptions(@$_GET['searchId'], $num_custom_searches, "AllCustomers", "viewCustomers", "customCustomerSearch");
if (!isset($_REQUEST['searchId'])) {
$GLOBALS['HideDeleteCustomSearch'] = "none";
} else {
$GLOBALS['CustomSearchId'] = (int) $_REQUEST['searchId'];
}
// Do we need to disable the add button?
if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Add_Customer)) {
$GLOBALS['DisableAdd'] = "DISABLED";
}
// Do we need to disable the delete button?
if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Delete_Customers) || $numCustomers == 0) {
$GLOBALS['DisableDelete'] = "DISABLED";
}
// Do we need to disable the expory button?
if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Export_Customers) || $numCustomers == 0) {
$GLOBALS['DisableExport'] = "DISABLED";
}
if (isset($_REQUEST['searchQuery']) || isset($_GET['searchId'])) {
$GLOBALS['HideClearResults'] = "";
}
$GLOBALS['CustomerIntro'] = GetLang('ManageCustomersIntro');
if ($numCustomers > 0) {
if ($MsgDesc == "" && (isset($_REQUEST['searchQuery']) || isset($_GET['searchId']))) {
if ($numCustomers == 1) {
$MsgDesc = GetLang('CustomerSearchResultsBelow1');
} else {
$MsgDesc = sprintf(GetLang('CustomerSearchResultsBelowX'), $numCustomers);
}
$MsgStatus = MSG_SUCCESS;
}
} else {
$GLOBALS['DisplayGrid'] = "none";
if (count($_GET) > 1) {
if ($MsgDesc == "") {
$GLOBALS['Message'] = MessageBox(GetLang('NoCustomerResults'), MSG_ERROR);
}
} else {
// No actual custoemrs
$GLOBALS['DisplaySearch'] = "none";
$GLOBALS['Message'] = MessageBox(GetLang('NoCustomers'), MSG_SUCCESS);
}
}
if (!gzte11(ISC_MEDIUMPRINT)) {
$GLOBALS[base64_decode('SGlkZUV4cG9ydA==')] = "none";
}
if ($MsgDesc != "") {
$GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
}
$flashMessages = GetFlashMessages();
if (is_array($flashMessages) && !empty($flashMessages)) {
$GLOBALS['Message'] = '';
foreach ($flashMessages as $flashMessage) {
$GLOBALS['Message'] .= MessageBox($flashMessage['message'], $flashMessage['type']);
}
}
$GLOBALS['ExportAction'] = "index.php?ToDo=startExport&t=customers";
if (isset($GLOBALS['CustomSearchId']) && $GLOBALS['CustomSearchId'] != '0') {
$GLOBALS['ExportAction'] .= "&searchId=" . $GLOBALS['CustomSearchId'];
} else {
$query_params = explode('&', $_SERVER['QUERY_STRING']);
$params = array();
$ignore = array("ToDo");
foreach ($query_params as $param) {
$arr = explode("=", $param);
if (!in_arrayi($arr[0], $ignore)) {
$params[$arr[0]] = $arr[1];
}
}
if (count($params)) {
$GLOBALS['ExportAction'] .= "&" . http_build_query($params);
}
}
$GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("customers.manage");
$GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate();
}
示例6: GetParams
private function GetParams($query_string = "")
{
if (!$query_string) {
$query_string = $_SERVER['QUERY_STRING'];
}
$query_params = explode('&', $query_string);
$params = array();
$ignore = array("ToDo", "t", "tempId", "searchId");
foreach ($query_params as $param) {
$arr = explode("=", $param);
if (!in_arrayi($arr[0], $ignore)) {
$params[$arr[0]] = $arr[1];
}
}
return $params;
}
示例7: i18n_r
echo '<tr><td>GD Library</td><td><span class="WARNmsg" >' . i18n_r('NOT_INSTALLED') . ' - ' . i18n_r('WARNING') . '</span></td></tr>';
}
if (in_arrayi('zip', $php_modules)) {
echo '<tr><td>ZipArchive</td><td><span class="OKmsg" >' . i18n_r('INSTALLED') . ' - ' . i18n_r('OK') . '</span></td></tr>';
} else {
echo '<tr><td>ZipArchive</td><td><span class="WARNmsg" >' . i18n_r('NOT_INSTALLED') . ' - ' . i18n_r('WARNING') . '</span></td></tr>';
}
if (!in_arrayi('SimpleXML', $php_modules)) {
echo '<tr><td>SimpleXML Module</td><td><span class="ERRmsg" >' . i18n_r('NOT_INSTALLED') . ' - ' . i18n_r('ERROR') . '</span></td></tr>';
} else {
echo '<tr><td>SimpleXML Module</td><td><span class="OKmsg" >' . i18n_r('INSTALLED') . ' - ' . i18n_r('OK') . '</span></td></tr>';
}
if (server_is_apache()) {
echo '<tr><td>Apache web server</td><td><span class="OKmsg" >' . $_SERVER['SERVER_SOFTWARE'] . ' - ' . i18n_r('OK') . '</span></td></tr>';
if (function_exists('apache_get_modules')) {
if (!in_arrayi('mod_rewrite', apache_get_modules())) {
echo '<tr><td>Apache Mod Rewrite</td><td><span class="WARNmsg" >' . i18n_r('NOT_INSTALLED') . ' - ' . i18n_r('WARNING') . '</span></td></tr>';
} else {
echo '<tr><td>Apache Mod Rewrite</td><td><span class="OKmsg" >' . i18n_r('INSTALLED') . ' - ' . i18n_r('OK') . '</span></td></tr>';
}
} else {
echo '<tr><td>Apache Mod Rewrite</td><td><span class="OKmsg" >' . i18n_r('INSTALLED') . ' - ' . i18n_r('OK') . '</span></td></tr>';
}
} else {
if (!getDef('GSNOAPACHECHECK') || GSNOAPACHECHECK == false) {
echo '<tr><td>Apache web server</td><td><span class="ERRmsg" >' . $_SERVER['SERVER_SOFTWARE'] . ' - <b>' . i18n_r('ERROR') . '</b></span></td></tr>';
}
}
?>
</table>
<p class="hint"><?php
示例8: validate_safe_file
function validate_safe_file($file, $name, $mime)
{
global $mime_type_blacklist, $file_ext_blacklist, $mime_type_whitelist, $file_ext_whitelist;
include GSADMININCPATH . 'configuration.php';
$file_extention = pathinfo($name, PATHINFO_EXTENSION);
$file_mime_type = $mime;
if ($mime_type_whitelist && in_arrayi($file_mime_type, $mime_type_whitelist)) {
return true;
} elseif ($file_ext_whitelist && $in_arrayi($file_extention, $file_ext_whitelist)) {
return true;
}
// skip blackist checks if whitelists exist
if ($mime_type_whitelist || $file_ext_whitelist) {
return false;
}
if (in_arrayi($file_mime_type, $mime_type_blacklist)) {
return false;
} elseif (in_arrayi($file_extention, $file_ext_blacklist)) {
return false;
} else {
return true;
}
}
示例9: Form
// Advanced log filter form
$form = new Form(new Form_Button('filterlogentries_submit', 'Filter'));
$section = new Form_Section('Advanced Log Filter');
$group = new Form_Group('');
$group->add(new Form_Input('filterlogentries_sourceipaddress', null, 'text', $filterfieldsarray['srcip']))->setHelp('Source IP Address');
$group->add(new Form_Input('filterlogentries_destinationipaddress', null, 'text', $filterfieldsarray['dstip']))->setHelp('Destination IP Address');
$section->add($group);
$group = new Form_Group('');
$group->add(new Form_Checkbox('actpass', 'Pass', 'Pass', in_arrayi('Pass', $Include_Act)));
$group->add(new Form_Input('filterlogentries_time', null, 'text', $filterfieldsarray['time']))->setHelp('Time');
$group->add(new Form_Input('filterlogentries_sourceport', null, 'text', $filterfieldsarray['srcport']))->setHelp('Source Port');
$group->add(new Form_Input('filterlogentries_protocol', null, 'text', $filterfieldsarray['proto']))->setHelp('Protocol');
$group->add(new Form_Input('filterlogentries_qty', null, 'text', $filterlogentries_qty))->setHelp('Quantity');
$section->add($group);
$group = new Form_Group('');
$group->add(new Form_Checkbox('actblock', 'Block', 'Block', in_arrayi('Block', $Include_Act)));
$group->add(new Form_Input('filterlogentries_interfaces', null, 'text', $filterfieldsarray['interface']))->setHelp('Interface');
$group->add(new Form_Input('filterlogentries_destinationport', null, 'text', $filterfieldsarray['dstport']))->setHelp('Destination Port');
$group->add(new Form_Input('filterlogentries_protocolflags', null, 'text', $filterfieldsarray['tcpflags']))->setHelp('Protocol Flags');
} else {
// Simple log filter form
$form = new Form(new Form_Button('filtersubmit', 'Filter'));
$section = new Form_Section('Log Filter');
$section->addInput(new Form_Select('filterdescriptions', 'Where to show rule descriptions', $interfacefilter, build_if_list()));
$group = new Form_Group('');
$group->add(new Form_Input('filtertext', null, 'text', $filtertext))->setHelp('Filter Expression');
$group->add(new Form_Input('filterlogentries_qty', null, 'text', $filterlogentries_qty))->setHelp('Quantity');
}
$group->setHelp('<a target="_blank" href="http://www.php.net/manual/en/book.pcre.php">' . 'Regular expression reference</a> Precede with exclamation (!) to exclude match.');
$section->add($group);
$form->add($section);
示例10: xml_set_character_data_handler
xml_set_character_data_handler($xml_parser, "contents");
// read the file
$data = file_get_contents($filename);
// parse the file
xml_parse($xml_parser, $data);
// free the xml parser
xml_parser_free($xml_parser);
}
// for each result, split it in to words, and for each word increase that words count
while ($row = mysql_fetch_array($result)) {
$words = preg_split("/[^a-zA-Z]+/", $row['why']);
foreach ($words as $word) {
$word = strtolower(stripslashes(trim($word)));
// if the word is in our filter array
// we will not include it in the count
if (strlen($word) > 1 && strlen($word) < $wordLength && !in_arrayi($word, $filterWords)) {
// checks if the array index exists and if it does increment the value
$word = " " . $word;
if (isset($counts[$word])) {
$counts[$word]++;
} else {
$counts[$word] = 1;
}
}
}
}
arsort($counts);
if ($json_output) {
echo json_encode(array('tags' => $counts));
} else {
foreach ($counts as $word => $count) {
示例11: testInArrayI
public function testInArrayI()
{
$array = ['ab', 'cd', 'EF', "GH"];
$this->assertTrue(in_arrayi('ab', $array));
$this->assertTrue(in_arrayi('ef', $array));
$this->assertTrue(in_arrayi('CD', $array));
$this->assertFalse(in_arrayi('ij', $array));
}
示例12: foreach
foreach ($index_liste as $key_liste => $element_liste) {
if (in_arrayi($element_liste, $valeur_selection)) {
$valeurs_fiche['lien_voir_titre'] = '<a class="BAZ_lien_modifier" href="' . $this->href('', $valeurs_fiche['id_fiche']) . '" title="Voir la fiche">' . $valeurs_fiche['bf_titre'] . '</a>' . "\n";
$valeurs_fiche['lien_voir'] = '<a class="BAZ_lien_modifier" href="' . $this->href('', $valeurs_fiche['id_fiche']) . '" title="Voir la fiche"></a>' . "\n";
$facettes['fiches'][$valeurs_fiche['id_fiche']] = $valeurs_fiche;
$facettes['html'] = baz_voir_fiche(0, $valeurs_fiche);
}
}
if (isset($valeurs_fiche['ficheliees'])) {
foreach ($valeurs_fiche['ficheliees'] as $valeurs_fiche_liee) {
$index_liste = explode(",", $valeurs_fiche_liee['checkbox' . $key_selection]);
if (empty($index_liste[0])) {
$index_liste = explode(",", $valeurs_fiche_liee['liste' . $key_selection]);
}
foreach ($index_liste as $key_liste => $element_liste) {
if (in_arrayi($element_liste, $valeur_selection)) {
$facettes['fiches'][$valeurs_fiche['id_fiche']]['ficheliees'][$valeurs_fiche_liee['id_fiche']] = $valeurs_fiche_liee;
}
}
}
}
}
}
} else {
// Pas de selections : on affiche toutes les fiches TODO : pagination
$valeurs_fiche['lien_voir_titre'] = '<a class="BAZ_lien_modifier" href="' . $this->href('', $valeurs_fiche['id_fiche']) . '" title="Voir la fiche">' . $valeurs_fiche['bf_titre'] . '</a>' . "\n";
$valeurs_fiche['lien_voir'] = '<a class="BAZ_lien_modifier" href="' . $this->href('', $valeurs_fiche['id_fiche']) . '" title="Voir la fiche"></a>' . "\n";
$valeurs_fiche['categorie'] = "";
// On renseigne les categories pour de l'eventuel Facet Javascript.
foreach ($groups as $group) {
$group = preg_replace('/\\*/', '', $group);
示例13: undo
}
$ufile = 'cp_settings.xml';
undo($ufile, $path, $bakpath);
redirect('support.php?rest=true');
}
if (isset($_GET['restored'])) {
$restored = 'true';
} else {
$restored = 'false';
}
# were changes submitted?
if (isset($_POST['submitted'])) {
$success = i18n_r('SETTINGS_UPDATED') . '. <a href="support.php?undo&nonce=' . get_nonce("restore", "support.php") . '">' . i18n_r('UNDO') . '</a>';
}
$php_modules = get_loaded_extensions();
if (in_arrayi('curl', $php_modules)) {
$curl_URL = $api_url . '?v=' . $site_version_no;
$ch = curl_init();
curl_setopt($ch, CURLOPT_TIMEOUT, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $curl_URL);
$data = curl_exec($ch);
curl_close($ch);
if ($data !== false) {
$apikey = json_decode($data);
$verstatus = $apikey->status;
} else {
$apikey = null;
$verstatus = null;
}
} else {
示例14: validate_safe_file
function validate_safe_file($file, $name, $mime)
{
global $mime_type_blacklist;
global $file_ext_blacklist;
$file_extention = pathinfo($name, PATHINFO_EXTENSION);
$file_mime_type = $mime;
if (in_arrayi($file_mime_type, $mime_type_blacklist)) {
return false;
} elseif (in_arrayi($file_extention, $file_ext_blacklist)) {
return false;
} else {
return true;
}
}
示例15: explode
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Minimum Buttons</title>
<meta name="description" content="Minimum Buttons." />
<meta name="keywords" content="minimum, buttons" />
<meta name="author" content="Brandon Evans" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<?php
if ($_POST['submit']) {
$type = explode('.', $_FILES['file']['name']);
$type = $type[count($type) - 1];
if (!in_arrayi($type, $types)) {
?>
<p>The provided file is an unsupported type.</p>
<?php
} else {
$file = file_get_contents($_FILES['file']['tmp_name']);
$frames = 0;
$holds = 0;
$last = array();
$presses = 0;
foreach (preg_split("/(\r?\n)/", $file) as $line) {
// This is only a frame if it starts with a vertical bar.
if ($line[0] == '|') {
$frames++;
$players = array();
// Split up the sections by a vertical bar.