本文整理汇总了PHP中mb_stristr函数的典型用法代码示例。如果您正苦于以下问题:PHP mb_stristr函数的具体用法?PHP mb_stristr怎么用?PHP mb_stristr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mb_stristr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:sillyleo,项目名称:philipbjorge.com,代码行数:7,代码来源:helpers.php
示例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;
}
开发者ID:andreas-glaser,项目名称:php-helpers,代码行数:17,代码来源:StringHelper.php
示例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);
}
}
}
开发者ID:a2call,项目名称:commsy,代码行数:25,代码来源:02_wiki_change_config.php
示例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);
}
}
开发者ID:jasonlam604,项目名称:stringizer,代码行数:11,代码来源:StringFirstOccurrence.php
示例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;
}
开发者ID:Jusophos,项目名称:nForm,代码行数:54,代码来源:html.generator.lib.php
示例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;
}
}
}
}
开发者ID:Boulboulouboule,项目名称:Happens,代码行数:11,代码来源:EventsTracker.php
示例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;
}
开发者ID:Ribeiro,项目名称:Spotify-for-Alfred,代码行数:12,代码来源:Control.php
示例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;
}
开发者ID:phpsong,项目名称:ExtJS5-Yii2,代码行数:16,代码来源:Base.php
示例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;
}
开发者ID:a2call,项目名称:commsy,代码行数:14,代码来源:ajax_search.php
示例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'];
}
}
开发者ID:a2call,项目名称:commsy,代码行数:15,代码来源:cs_class_factory.php
示例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);
}
}
}
开发者ID:a2call,项目名称:commsy,代码行数:15,代码来源:03_wiki_change_config.php
示例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;
}
开发者ID:a2call,项目名称:commsy,代码行数:47,代码来源:cs_virus_scan.php
示例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;
}
开发者ID:a2call,项目名称:commsy,代码行数:47,代码来源:cs_ajax_ckeditor_image_browse_controller.php
示例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;
}
开发者ID:rainlethe,项目名称:self,代码行数:17,代码来源:FromString.php
示例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;
}
开发者ID:Ribeiro,项目名称:Spotify-for-Alfred,代码行数:17,代码来源:SetupCountryCode.php
示例16: save
public function save($form_data, $additional = array())
{
$room_config = $form_data['room_config'];
// prepare sorting array
$sorting = array();
$num_latest_dummies = 0;
foreach ($room_config as $config) {
switch ($config['type']) {
case 'title':
$sorting[] = '-1$$' . $config['value'];
$num_latest_dummies = 0;
break;
case 'room':
$sorting[] = $config['value'];
$num_latest_dummies = 0;
break;
case 'dummy':
$sorting[] = '-3';
$num_latest_dummies++;
break;
}
}
// remove all tailing dummies per title
$sorting = array_reverse($sorting);
$is_before_title = true;
foreach ($sorting as $key => $id) {
// if dummy
if ($id == '-3' && $is_before_title) {
unset($sorting[$key]);
// if title
} elseif (mb_stristr($id, '-1$$')) {
$is_before_title = true;
} else {
$is_before_title = false;
}
}
$sorting = array_reverse($sorting);
// save
$current_user = $this->_environment->getCurrentUserItem();
$own_room_item = $current_user->getOwnRoom();
$own_room_item->setCustomizedRoomIDArray($sorting);
$own_room_item->save();
// set return
$this->_popup_controller->setSuccessfullItemIDReturn($own_room_item->getItemID());
}
开发者ID:a2call,项目名称:commsy,代码行数:45,代码来源:cs_popup_breadcrumb_controller.php
示例17: asHTML
/** get errorbox as HTML
* this method returns the errorbox in HTML-Code
*
* @return string errorbox view as HMTL
*/
function asHTML()
{
$html = '';
$html .= '<!-- BEGIN OF ERRORBOX -->' . LF;
if (!$this->_width and ($this->_environment->inPortal() or $this->_environment->inServer())) {
$text = 'width: 60%;';
} elseif ($this->_width and !mb_stristr($this->_width, 'em') and !mb_stristr($this->_width, '%')) {
$width = round($this->_width / 12, 0);
$text = ' width: ' . $width . 'em;';
} elseif (mb_stristr($this->_width, 'em') or mb_stristr($this->_width, '%')) {
$text = ' width: ' . $this->_width;
} else {
$text = 'width: 35em;';
}
$html .= '<div style="width:100%; text-align:center; padding-top:5px; padding-bottom:0px;">' . LF;
$html .= '<center>' . LF;
$html .= '<table style="border: 2px solid #FF0000; margin: 0px; ' . $text . '" summary="Layout">' . LF;
if (!empty($this->_title)) {
$html .= ' <tr><td style="text-align: left;">' . LF;
#$html .= '<img src="images/warn.gif" style="vertical-align: top; text-align: left; padding-left: 0px; padding-right: 10px;" alt="'.$this->_translator->getMessage('RUBRIC_WARN_CHANGER').'"></img>'.LF;
$html .= '<span style="font-size:12pt; font-weight:bold">' . $this->_title . '</span>' . LF;
if (!empty($this->_description)) {
$html .= ' <span>(' . $this->_description . ')</span>' . LF;
}
$html .= ' </td></tr>' . LF;
}
$html .= ' <tr>' . LF;
$html .= ' <td style="text-align: left;">' . $this->_text . '</td>' . LF;
$html .= ' </tr>' . LF;
if ($this->_with_login) {
$html .= ' <tr>' . LF;
$html .= ' <td style="text-align: left;">' . LF;
$html .= ' <form method="post" action="' . curl($this->_environment->getCurrentContextID(), 'context', 'login') . '" name="login">' . LF;
// TBD
$html .= ' </form>' . LF;
$html .= ' </td>' . LF;
$html .= ' </tr>' . LF;
}
$html .= '</table>' . LF;
$html .= '</center>' . LF;
$html .= '</div>' . LF;
$html .= '<!-- END OF ERRORBOX -->' . LF . LF;
return $html;
}
开发者ID:a2call,项目名称:commsy,代码行数:49,代码来源:cs_errorbox_view.php
示例18: getNodesWithText
protected function getNodesWithText($search_for, $xml)
{
$nodes = array();
#only works with us_EN, bad americano!
// $nodes = array_merge($nodes, $this->getSpecificNodeWithText('label',$search_for, $xml));
// $nodes = array_merge($nodes, $this->getSpecificNodeWithText('comment',$search_for, $xml));
//get the nodes
$nodes = array_merge($nodes, $xml->xpath('//label'));
$nodes = array_merge($nodes, $xml->xpath('//comment'));
//filter the nodes
$found = array();
$helper = Mage::helper('adminhtml');
foreach ($nodes as $node) {
if (mb_stristr($helper->__((string) $node), $search_for) !== false) {
$found[] = $node;
}
}
return $found;
}
开发者ID:itmyprofession,项目名称:Pulsestorm,代码行数:19,代码来源:Configsearch.php
示例19: __construct
public function __construct($options)
{
$this->search = $options['search'];
$this->currentURI = $options['URIs'][$options['depth'] - 1];
$explodedURI = explode(":", $this->currentURI);
$this->type = $explodedURI[1];
$this->rawType = $this->type == "artist" ? "album" : "track";
$fetcher = new JsonFetcher("http://ws.spotify.com/lookup/1/.json?uri={$this->currentURI}&extras={$this->rawType}detail");
$json = $fetcher->run();
$this->title = $json->{$this->type}->name;
$this->raw = array();
if ($this->rawType == "album") {
$albums = array();
$this->query = implode(" ⟩", $options['args']);
foreach ($json->artist->albums as $key => $value) {
$value = $value->album;
if (in_array($value->name, $albums)) {
continue;
}
$currentResult['title'] = $value->name;
$currentResult['type'] = 'album';
$currentResult['href'] = $value->href;
if ($this->search != '' && !mb_stristr($currentResult['title'], $this->search)) {
continue;
}
$this->raw[] = $currentResult;
$albums[] = $value->name;
}
} else {
foreach ($json->album->tracks as $key => $value) {
$currentResult['title'] = $value->name;
$currentResult['type'] = 'track';
$currentResult['href'] = $value->href;
$currentResult['number'] = $value->{'track-number'};
$currentResult['popularity'] = $value->popularity;
$currentResult['length'] = $value->length;
if ($this->search != '' && !mb_stristr($currentResult['title'], $this->search)) {
continue;
}
$this->raw[] = $currentResult;
}
}
}
开发者ID:jesseflorig,项目名称:config,代码行数:43,代码来源:Detail.php
示例20: _getItemAsHTML
/** get the item of the list view as HTML
* this method returns the single item in HTML-Code
*
* overwritten method form the upper class
*
* @return string item as HMTL
*/
function _getItemAsHTML($item)
{
$context_item = $this->_environment->getCurrentContextItem();
$html = ' <td width="25%" style="vertical-align: baseline; padding-bottom:10px;">' . LF;
if (!$context_item->isClosed() or mb_stristr($item->getLink(), 'configuration') and mb_stristr($item->getLink(), 'archive') or mb_stristr($item->getLink(), 'configuration') and mb_stristr($item->getLink(), 'preferences')) {
$html .= ' ' . '<span style="font-weight:bold">' . $item->getLink() . '</span>' . LF;
} else {
$html .= ' ' . '<span style="font-weight:bold">' . $item->getTitle() . '</span>' . LF;
}
$html .= ' <br/>' . LF;
$html .= ' <span style="width:70%; vertical-align: baseline;">' . LF;
if (!$context_item->isClosed() or mb_stristr($item->getLink(), 'configuration') and mb_stristr($item->getLink(), 'archive') or mb_stristr($item->getLink(), 'configuration') and mb_stristr($item->getLink(), 'preferences')) {
$html .= ' ' . $item->getLinkIcon() . ' ' . $item->getDescription() . LF;
} else {
$html .= ' ' . $item->getIcon() . ' ' . $item->getDescription() . LF;
}
$html .= ' </span></td>' . LF;
return $html;
}
开发者ID:a2call,项目名称:commsy,代码行数:26,代码来源:cs_link_preference_list_view.php
注:本文中的mb_stristr函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论