本文整理汇总了PHP中mb_stristr函数的典型用法代码示例。如果您正苦于以下问题:PHP mb_stristr函数的具体用法?PHP mb_stristr怎么用?PHP mb_stristr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mb_stristr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clean_stristr
function clean_stristr($title, $content)
{
// Strips out tags (after converting special chars), whitespace and trailing ellipses (...s).
$title = trim(preg_replace('/\\s+/', '', strip_tags(htmlspecialchars_decode($title, ENT_QUOTES))), ".");
$content = trim(preg_replace('/\\s+/', '', strip_tags(htmlspecialchars_decode($content, ENT_QUOTES))), ".");
return mb_stristr($content, $title) !== FALSE;
}
示例2: contains
/**
* @param $haystack
* @param $needle
* @param bool $caseSensitive
* @param string $encoding
*
* @return bool
*
* @author Andreas Glaser
*/
public static function contains($haystack, $needle, $caseSensitive = true, $encoding = 'UTF-8')
{
if ($caseSensitive === false) {
return mb_stristr($haystack, $needle, null, $encoding) !== false;
}
return mb_strstr($haystack, $needle, null, $encoding) !== false;
}
示例3: changeWikis2
function changeWikis2 ($directory,$count) {
$directory_handle = opendir($directory);
while ( false !== ($entry = readdir($directory_handle)) ) {
if ($entry != '.' and $entry != '..' and is_dir($directory.'/'.$entry)) {
changeWikis2($directory.'/'.$entry,$count);
} elseif (is_file($directory.'/'.$entry) and $entry == 'commsy_config.php') {
$str = file_get_contents($directory.'/'.$entry);
if ( mb_stristr($str,'$COMMSY_ROOM_ID') and !mb_stristr($str,'session_name') ) {
$str = str_replace(array("\r\n", "\r"), "\n", $str);
$str_array = explode("\n",$str);
$str_out = '';
foreach ( $str_array as $value ) {
$str_out .= $value.LF;
if ( mb_stristr($value, '$COMMSY_ROOM_ID = "') ) {
$str_out .= 'session_name(\'SESSID-\'.$COMMSY_ROOM_ID);'.LF;
}
}
if ( !empty($str_out) ) {
file_put_contents($directory.'/'.$entry,trim($str_out));
}
}
update_progress_bar($count);
}
}
}
示例4: execute
/**
* StringFirstOccurrence
*/
public function execute()
{
if ($this->isCaseInsensitive()) {
return mb_stristr($this->getValue(), $this->needle, $this->beforeNeedle);
} else {
return mb_strstr($this->getValue(), $this->needle, $this->beforeNeedle);
}
}
示例5: _generateField
protected function _generateField(&$field_id, &$field)
{
global $NFORM_CONFIG;
$this->_processField($field);
// Data management
$label = $field_id;
if (array_key_exists('label', $field)) {
$label = $field['label'];
}
$required = '';
if (array_key_exists('flags', $field)) {
if (mb_stristr($field['flags'], 'required') !== false) {
$required = '<span class="' . $NFORM_CONFIG['class_prefix'] . 'required">' . $NFORM_CONFIG['required_symbol'] . '</span>';
}
}
$type = 'string';
if (array_key_exists('type', $field)) {
$type = $field['type'];
}
// Generate
$tmp = '<div id="' . $NFORM_CONFIG['class_prefix'] . 'row_' . $field_id . '" class="' . $NFORM_CONFIG['class_prefix'] . 'row">' . "\r\n";
$tmp .= "\t" . '<label for="' . $NFORM_CONFIG['id'] . $field_id . '">' . $label . $required . '</label>' . "\r\n";
if ($type == 'plaintext') {
$tmp .= "\t" . '<textarea';
} else {
if ($type == 'password') {
$tmp .= "\t" . '<input type="password"';
} else {
$tmp .= "\t" . '<input type="text"';
}
}
$tmp .= ' name="' . $field_id . '"';
$tmp .= ' id="' . $NFORM_CONFIG['id'] . $field_id . '"';
if ($this->_tabindex !== false) {
$this->_tabindex++;
$tmp .= ' tabindex="' . $this->_tabindex . '"';
}
if (array_key_exists('maxlength', $field)) {
$tmp .= ' maxlength="' . $field['maxlength'] . '"';
}
if (array_key_exists('title', $field)) {
$tmp .= ' title="' . $field['title'] . '"';
}
if ($type == 'plaintext') {
$tmp .= '></textarea>' . "\r\n";
} else {
$tmp .= ' />' . "\r\n";
}
// message
$tmp .= "\t" . '<div class="' . $NFORM_CONFIG['class_prefix'] . 'message" id="' . $NFORM_CONFIG['id'] . 'message_' . $field_id . '">';
$tmp .= '</div>' . "\r\n";
$tmp .= '</div>' . "\r\n";
$this->_content .= $tmp;
}
示例6: keywordFinder
private static function keywordFinder($lastTweets, $keywords)
{
$tweets = json_decode($lastTweets);
foreach ($tweets as $key => $tweet) {
foreach ($keywords as $key => $keyword) {
if (mb_stristr($tweet->text, $keyword->keyname) != FALSE) {
return $tweet;
}
}
}
}
示例7: output
public function output()
{
$results = array();
foreach ($this->commands as $command) {
if ($this->search != null && !@mb_stristr($command['name'] . ' ' . $command['keys'], $this->search)) {
continue;
}
$results[] = array('title' => $command['name'], 'arg' => $command['action'], 'icon' => $command['icon']);
}
$results[] = array('title' => 'Controls', 'subtitle' => 'Access this menu at any time by typing `c`', 'icon' => 'include/images/info.png');
return $results;
}
示例8: getLogo
/**
*
* @return string url
*/
public function getLogo()
{
$files = $this->attachedFiles;
if ($files !== null) {
foreach ($files as $file) {
if (mb_stristr(self::LOGO, $file->name)) {
return $file->url;
}
}
}
return false;
}
示例9: compareWithSearchText
function compareWithSearchText($search_text, $value) {
if(mb_stristr($value, $search_text)) {
$marker_color = getMarkerColor();
if($marker_color === 'green') {
$replace = '(:mainsearch_text_green:)$0(:mainsearch_text_green_end:)';
} else if($marker_color === 'yellow') {
$replace = '(:mainsearch_text_yellow:)$0(:mainsearch_text_yellow_end:)';
}
$value = preg_replace('~' . preg_quote($search_text, '/') . '~iu', $replace, $value);
}
return $value;
}
示例10: includeClass
public function includeClass($name)
{
if (!empty($this->_class_array[$name]['switchable']) and $this->_class_array[$name]['switchable'] and !empty($this->_design_folder) and !empty($this->_class_array[$name]['folder']) and !mb_stristr($this->_class_array[$name]['folder'], '/' . $this->_design_folder . '/')) {
$this->_class_array[$name]['folder'] .= $this->_design_folder . '/';
}
if (empty($this->_class_array[$name]['folder'])) {
trigger_error('don\'t know where class ' . $name . ' is', E_USER_ERROR);
} elseif (empty($this->_class_array[$name]['filename'])) {
trigger_error('don\'t know the filename of ' . $name, E_USER_ERROR);
} elseif (!file_exists($this->_class_array[$name]['folder'] . $this->_class_array[$name]['filename'])) {
trigger_error('file ' . $this->_class_array[$name]['folder'] . $this->_class_array[$name]['filename'] . ' does not exist', E_USER_ERROR);
} else {
include_once $this->_class_array[$name]['folder'] . $this->_class_array[$name]['filename'];
}
}
示例11: changeWikis
function changeWikis ($directory,$count) {
$directory_handle = opendir($directory);
while ( false !== ($entry = readdir($directory_handle)) ) {
if ($entry != '.' and $entry != '..' and is_dir($directory.'/'.$entry)) {
changeWikis($directory.'/'.$entry,$count);
} elseif (is_file($directory.'/'.$entry) and $entry == 'commsy_config.php') {
$str = file_get_contents($directory.'/'.$entry);
if ( mb_stristr($str,'authuser.php') and !mb_stristr($str,'authusercommsy.php') ) {
$str = str_replace('include_once("$FarmD/scripts/authuser.php");','include_once("$FarmD/cookbook/authusercommsy.php");'.LF.'include_once("$FarmD/scripts/authuser.php");',$str);
file_put_contents($directory.'/'.$entry,$str);
}
update_progress_bar($count);
}
}
}
示例12: isClean
function isClean($filename, $orig_filename = '')
{
$ret_val = true;
if (!empty($filename) and file_exists($filename)) {
// call scanner on file
if (isset($this->_php) and !empty($this->_php) and $this->_php) {
// viren scanning with PHP - clamscan - lib
if ($virus_name = cl_scanfile($filename)) {
if (!empty($orig_filename)) {
$filename_text = $orig_filename;
} else {
$filename_text = $filename;
}
if (mb_strtoupper($virus_name, 'UTF-8') != 'OVERSIZED.ZIP') {
$this->_virus_name = $virus_name;
$this->_output = $this->_translator->getMessage('VIRUS_VIRUS_FOUND', $virus_name, $filename_text);
unlink($filename);
$ret_val = false;
}
}
} elseif (file_exists($this->_path . "/" . $this->_bin)) {
// viren scanning with shell command
$output = shell_exec($this->_path . "/" . $this->_bin . " " . escapeshellcmd($filename . " | grep FOUND"));
if ($output != '' and mb_stristr($output, 'FOUND')) {
// maybe its only the filename, so remove it from output
$output = str_replace($filename . ': ', "", $output);
if (mb_stristr($output, 'FOUND') and !mb_stristr($output, 'Oversized.Zip')) {
// still a 'FOUND' in output?
$ret_val = false;
$virus_name = str_replace(' FOUND', "", $output);
$this->_virus_name = $virus_name;
if (!empty($orig_filename)) {
$filename_text = $orig_filename;
} else {
$filename_text = $filename;
}
$this->_output = $this->_translator->getMessage('VIRUS_VIRUS_FOUND', $virus_name, $filename_text);
unlink($filename);
}
}
} else {
$ret_val = false;
$this->_output = $this->_translator->getMessage('VIRUS_SCANNER_NOT_FOUND', $this->_path . "/" . $this->_bin);
}
}
return $ret_val;
}
示例13: actionGetHTML
public function actionGetHTML()
{
$environment = $this->_environment;
$translator = $environment->getTranslationObject();
$files = array();
if (isset($_GET['iid']) and $_GET['iid'] != 'NEW') {
$item_manager = $environment->getItemManager();
$item = $item_manager->getItem($_GET['iid']);
$file_list_files = $item->getFileList();
if (!$file_list_files->isEmpty()) {
$file = $file_list_files->getFirst();
while ($file) {
if (mb_stristr(mb_strtolower($file->getFilename(), 'UTF-8'), 'png') or mb_stristr(mb_strtolower($file->getFilename(), 'UTF-8'), 'jpg') or mb_stristr(mb_strtolower($file->getFilename(), 'UTF-8'), 'jpeg') or mb_stristr(mb_strtolower($file->getFilename(), 'UTF-8'), 'gif')) {
$files[$file->getFileID()] = $file->getFilename();
}
$file = $file_list_files->getNext();
}
}
}
$temp_files_upload = array();
$file_manager = $environment->getFileManager();
$file_list_files_upload = $file_manager->getTempItemListBySessionID($environment->getSessionID());
$file_item = $file_list_files_upload->getFirst();
while ($file_item) {
$files[$file_item->getFileID()] = $file_item->getFilename();
$file_item = $file_list_files_upload->getNext();
}
unset($file_manager);
$html = '';
$html .= '<script type="text/javascript" src="javascript/jQuery/jquery-1.4.1.min.js"></script>' . LF;
$html .= '<script type="text/javascript" src="javascript/jQuery/commsy/commsy_ckeditor.js"></script>' . LF;
$html .= '<div style="text-align:center; widht:100%;">';
$html .= '<br/><br/>' . LF;
$html .= '<form id="ckeditor_file_form">' . LF;
$html .= '<input type="hidden" id="ckeditor_file_func_number" value="' . $_GET['CKEditorFuncNum'] . '" />' . LF;
$html .= '<select id="ckeditor_file_select">' . LF;
foreach ($files as $id => $filename) {
$link = 'commsy.php/' . $filename . '?cid=' . $environment->getCurrentContextID() . '&mod=material&fct=getfile&iid=' . $id;
$html .= '<option name="ckeditor_file" value="' . $link . '">' . $filename . '</option>' . LF;
}
$html .= '</select>' . LF;
$html .= '<br/><br/>' . LF;
$html .= '<input type="submit" value="' . $translator->getMessage('COMMON_CHOOSE_BUTTON') . '">' . LF;
$html .= '</form>' . LF;
$html .= '</div>';
echo $html;
}
示例14: find
function find($needle, $ignoreCase = false, $reverse = false)
{
if ($ignoreCase) {
if ($reverse) {
$this->__invar = mb_strrichr($this->__invar, $needle);
} else {
$this->__invar = mb_stristr($this->__invar, $needle);
}
} else {
if ($reverse) {
$this->__invar = mb_strrchr($this->__invar, $needle);
} else {
$this->__invar = mb_strstr($this->__invar, $needle);
}
}
return $this;
}
示例15: output
public function output()
{
$results = array();
foreach ($this->countries as $country) {
if ($this->search != null && !@mb_stristr($country['name'] . ' ' . $country['code'], $this->search)) {
continue;
}
$currentResult = array('title' => $country['name'], 'subtitle' => "Set your country to “{$country['code']}.”", 'arg' => 'country⟩' . $country['code'], 'autocomplete' => 'Country Code ⟩' . $country['name']);
$results[] = $currentResult;
}
if ($results == null) {
$results[] = array('title' => 'Could not find country', 'subtitle' => 'We are looking for a country called "' . $this->search . '"', 'autocomplete' => 'Country Code ⟩', 'valid' => 'no');
} else {
usort($results, array($this, 'countrySort'));
}
return $results;
}