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


PHP mb_stripos函数代码示例

本文整理汇总了PHP中mb_stripos函数的典型用法代码示例。如果您正苦于以下问题:PHP mb_stripos函数的具体用法?PHP mb_stripos怎么用?PHP mb_stripos使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: zenCacheConstants

 /**
  * Back compat. with `ZENCACHE_` constants.
  *
  * @since 150422 Rewrite.
  */
 public static function zenCacheConstants()
 {
     $_global_ns = mb_strtoupper(GLOBAL_NS);
     if (!($constants = get_defined_constants(true)) || empty($constants['user'])) {
         return;
         // Nothing to do; i.e. no user-defined constants.
     }
     foreach ($constants['user'] as $_constant => $_value) {
         if (mb_stripos($_constant, 'ZENCACHE_') !== 0) {
             continue;
             // Nothing to do here.
         }
         if (!($_constant_sub_name = mb_substr($_constant, 9))) {
             continue;
             // Nothing to do here.
         }
         if (!defined($_global_ns . '_' . $_constant_sub_name)) {
             define($_global_ns . '_' . $_constant_sub_name, $_value);
         }
     }
     if (isset($_SERVER['ZENCACHE_ALLOWED']) && !isset($_SERVER[$_global_ns . '_ALLOWED'])) {
         $_SERVER[$_global_ns . '_ALLOWED'] = $_SERVER['ZENCACHE_ALLOWED'];
     }
     unset($_constant, $_value, $_global_ns);
     // Housekeeping.
 }
开发者ID:arobbins,项目名称:sblog,代码行数:31,代码来源:AdvCacheBackCompat.php

示例2: contains

 /**
  * @param $haystack
  * @param $needle
  * @param bool $caseSensitive
  * @return bool
  */
 private function contains($haystack, $needle, $caseSensitive = true)
 {
     if ($caseSensitive) {
         return mb_strpos($haystack, $needle, 0, mb_internal_encoding()) !== false;
     }
     return mb_stripos($haystack, $needle, 0, mb_internal_encoding()) !== false;
 }
开发者ID:kidker,项目名称:utm-url-parser,代码行数:13,代码来源:UtmParser.php

示例3: parse

 protected function parse($st)
 {
     if (preg_replace_callback('#GeoPoint\\(.{1,200}АЗС.+?\\)\\);#su', function ($x) {
         if (!preg_match('#' . '(?<lon>[\\d\\.]+),(?<lat>[\\d\\.]+)' . '.+?(?<operator>(Партнер )?О[ОА]О .+?), АЗС' . '.+?№\\s*(?<ref>[\\dА-Я/-]+)' . '.+?Адрес: (?<_addr>.+?)<' . '(?<text>.+)' . "#su", $x[0], $obj)) {
             return;
         }
         // организация
         $op = $obj['operator'];
         $op = preg_replace('/Партнер.+?»/u', '', $op);
         $op = str_replace('«', '"', $op);
         $op = str_replace('»', '"', $op);
         $obj['operator'] = trim($op);
         // виды топлива
         $obj["fuel:octane_98"] = mb_stripos($obj['text'], 'Аи-98') ? 'yes' : '';
         $obj["fuel:octane_95"] = mb_stripos($obj['text'], 'Аи-95') ? 'yes' : '';
         $obj["fuel:octane_92"] = mb_stripos($obj['text'], 'Аи-92') ? 'yes' : '';
         $obj["fuel:octane_80"] = mb_stripos($obj['text'], 'Аи-80') ? 'yes' : '';
         $obj["fuel:lpg"] = mb_strpos($obj['text'], 'Газ') ? 'yes' : '';
         $obj["fuel:diesel"] = mb_strpos($obj['text'], 'Дизель') ? 'yes' : '';
         // карты
         $obj['payment:cards'] = mb_strpos($obj['text'], 'банковским') ? 'yes' : '';
         $obj['payment:fuel_cards'] = mb_strpos($obj['text'], 'топливным') ? 'yes' : '';
         $this->addObject($this->makeObject($obj));
     }, $st)) {
     }
 }
开发者ID:KooLru,项目名称:validator,代码行数:26,代码来源:bashneft.php

示例4: tags

 /**
  * Balance HTML markup/tags.
  *
  * @since 150424 Initial release.
  *
  * @param mixed $value Any input value.
  *
  * @throws Exception If missing DOM extension.
  *
  * @return string|array|object Balanced value (i.e., HTML markup).
  *
  * @internal This works with HTML fragments only. No on a full document.
  * i.e., If the input contains `</html>` or `</body>` it is left as-is.
  */
 public function tags($value)
 {
     if (is_array($value) || is_object($value)) {
         foreach ($value as $_key => &$_value) {
             $_value = $this->tags($_value);
         }
         // unset($_key, $_value);
         return $value;
     }
     if (!($string = (string) $value)) {
         return $string;
         // Nothing to do.
     } elseif (mb_stripos($string, '</html>') !== false) {
         return $string;
         // Not a fragment; leave as-is.
     } elseif (mb_stripos($string, '</body>') !== false) {
         return $string;
         // Not a fragment; leave as-is.
     }
     $html = '<html>' . '   <head>' . '       <meta charset="utf-8">' . '       <meta http-equiv="content-type" content="text/html; charset=utf-8">' . '   </head>' . '   <body>' . $string . '</body>' . '</html>';
     $Dom = new \DOMDocument();
     $Dom->loadHTML($html);
     $string = $Dom->saveHTML($Dom->getElementsByTagName('body')->item(0));
     $string = preg_replace(['/\\<body\\>/ui', '/\\<\\/body\\>/ui'], '', $string);
     $string = $this->c::htmlTrim($string);
     return $string;
 }
开发者ID:websharks,项目名称:core,代码行数:41,代码来源:HtmlBalance.php

示例5: serviceLoginForm

 public function serviceLoginForm($sParams = '', $sForceRelocate = '')
 {
     if (isLogged()) {
         return false;
     }
     // get all auth types
     $aAuthTypes = BxDolDb::getInstance()->fromCache('sys_objects_auths', 'getAll', 'SELECT * FROM `sys_objects_auths`');
     // define additional auth types
     if ($aAuthTypes) {
         $aAddInputEl[''] = _t('_Basic');
         // procces all additional menu's items
         foreach ($aAuthTypes as $iKey => $aItems) {
             $aAddInputEl[$aItems['Link']] = _t($aItems['Title']);
         }
         $aAuthTypes = array('type' => 'select', 'caption' => _t('_Auth type'), 'values' => $aAddInputEl, 'value' => '', 'attrs' => array('onchange' => 'if (this.value) { location.href = "' . BX_DOL_URL_ROOT . '" + this.value }'));
     } else {
         $aAuthTypes = array('type' => 'hidden');
     }
     $oForm = BxDolForm::getObjectInstance('sys_login', 'sys_login');
     $sCustomHtmlBefore = '';
     $sCustomHtmlAfter = '';
     bx_alert('profile', 'show_login_form', 0, 0, array('oForm' => $oForm, 'sParams' => &$sParams, 'sCustomHtmlBefore' => &$sCustomHtmlBefore, 'sCustomHtmlAfter' => &$sCustomHtmlAfter, 'aAuthTypes' => &$aAuthTypes));
     if ($sForceRelocate && 0 === mb_stripos($sForceRelocate, BX_DOL_URL_ROOT)) {
         $oForm->aInputs['relocate']['value'] = $sForceRelocate;
     } elseif ('homepage' == $sForceRelocate) {
         $oForm->aInputs['relocate']['value'] = BX_DOL_URL_ROOT;
     }
     $sFormCode = $oForm->getCode();
     $sJoinText = '';
     if (strpos($sParams, 'no_join_text') === false) {
         $sJoinText = '<hr class="bx-def-hr bx-def-margin-sec-topbottom" /><div>' . _t('_sys_txt_login_description', BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=create-account')) . '</div>';
     }
     BxDolTemplate::getInstance()->addJs(array('jquery.form.min.js'));
     return $sCustomHtmlBefore . $sFormCode . $sCustomHtmlAfter . $sJoinText;
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:35,代码来源:BxBaseServiceLogin.php

示例6: testmb_strpos

 /**
  * @covers Patchwork\PHP\Override\Mbstring::mb_strpos
  * @covers Patchwork\PHP\Override\Mbstring::mb_stripos
  * @covers Patchwork\PHP\Override\Mbstring::mb_strrpos
  * @covers Patchwork\PHP\Override\Mbstring::mb_strripos
  */
 function testmb_strpos()
 {
     $this->assertSame(false, @mb_strpos('abc', ''));
     $this->assertSame(false, @mb_strpos('abc', 'a', -1));
     $this->assertSame(false, mb_strpos('abc', 'd'));
     $this->assertSame(false, mb_strpos('abc', 'a', 3));
     $this->assertSame(1, mb_strpos('한국어', '국'));
     $this->assertSame(3, mb_stripos('DÉJÀ', 'à'));
     $this->assertSame(false, mb_strrpos('한국어', ''));
     $this->assertSame(1, mb_strrpos('한국어', '국'));
     $this->assertSame(3, mb_strripos('DÉJÀ', 'à'));
     $this->assertSame(1, mb_stripos('aςσb', 'ΣΣ'));
     $this->assertSame(1, mb_strripos('aςσb', 'ΣΣ'));
     $this->assertSame(false, @p::mb_strpos('abc', ''));
     $this->assertSame(false, @p::mb_strpos('abc', 'a', -1));
     $this->assertSame(false, p::mb_strpos('abc', 'd'));
     $this->assertSame(false, p::mb_strpos('abc', 'a', 3));
     $this->assertSame(1, p::mb_strpos('한국어', '국'));
     $this->assertSame(3, p::mb_stripos('DÉJÀ', 'à'));
     $this->assertSame(false, p::mb_strrpos('한국어', ''));
     $this->assertSame(1, p::mb_strrpos('한국어', '국'));
     $this->assertSame(3, p::mb_strripos('DÉJÀ', 'à'));
     $this->assertSame(1, p::mb_stripos('aςσb', 'ΣΣ'));
     $this->assertSame(1, p::mb_strripos('aςσb', 'ΣΣ'));
 }
开发者ID:nicolas-grekas,项目名称:Patchwork-sandbox,代码行数:31,代码来源:MbstringTest.php

示例7: test_encoding

function test_encoding($path)
{
    static $ur_exclude = ['lib2/html2text.class.php', 'lib2/imagebmp.inc.php', 'lib2/Net/IDNA2'];
    $contents = file_get_contents($path, false, null, 0, 2048);
    $ur = stripos($contents, "Unicode Reminder");
    if ($ur) {
        if (mb_trim(mb_substr($contents, $ur + 17, 2)) != "メモ") {
            $ur = mb_stripos($contents, "Unicode Reminder");
            if (mb_trim(mb_substr($contents, $ur + 17, 2)) != "メモ") {
                echo "Bad Unicode Reminder found in {$path}: " . mb_trim(mb_substr($contents, $ur + 17, 2)) . "\n";
            } else {
                echo "Unexpected non-ASCII chars (BOMs?) in header of {$path}\n";
            }
        }
    } else {
        $ok = false;
        foreach ($ur_exclude as $exclude) {
            if (mb_strpos($path, $exclude) === 0) {
                $ok = true;
            }
        }
        if (!$ok) {
            echo "No Unicode Reminder found in {$path}\n";
        }
    }
}
开发者ID:kratenko,项目名称:oc-server3,代码行数:26,代码来源:find_bad_encodings.php

示例8: sanitizeOutput

 /**
  * @return void
  */
 public function sanitizeOutput()
 {
     $t = $this;
     $encrypt_prefix = $this->security_config->get('encrypt_form_name_with_prefix');
     $new_content = preg_replace_callback('@(?<=\\<form[^>]*>)(.+?)(?=</form>)@is', function ($match) use($t, $encrypt_prefix) {
         $form_inner_html = preg_replace_callback('@(?<=\\<[^>]+name\\s*=\\s*["\']?)([^\'"]+)(?=["\' ])@is', function ($sub_match) use($t, $encrypt_prefix) {
             if (mb_stripos($sub_match[1], $encrypt_prefix) === 0) {
                 return $encrypt_prefix . $t->simple_encrypt->encrypt(str_replace($encrypt_prefix, '', $sub_match[1]));
             } else {
                 return $sub_match[1];
             }
         }, $match[1]);
         foreach ((array) $t->html_output->getForm() as $k => $v) {
             if (!$v) {
                 continue;
             }
             if (mb_stripos($k, $encrypt_prefix) === 0) {
                 $k = $encrypt_prefix . $t->simple_encrypt->encrypt(str_replace($encrypt_prefix, '', $k));
             }
             $form_inner_html .= "<input name=\"{$k}\" value=\"{$v}\" type=\"hidden\"/>";
         }
         return $form_inner_html;
     }, $t->html_output->get(HtmlOutput::CONTENT));
     $t->html_output->set(HtmlOutput::CONTENT, $new_content);
 }
开发者ID:lixiongyou,项目名称:pudding,代码行数:28,代码来源:EncryptFormName.php

示例9: __construct

 public function __construct(HttpUrl $claimedId, HttpClient $httpClient)
 {
     $this->claimedId = $claimedId->makeComparable();
     if (!$claimedId->isValid()) {
         throw new OpenIdException('invalid claimed id');
     }
     $this->httpClient = $httpClient;
     $response = $httpClient->send(HttpRequest::create()->setHeaderVar('Accept', self::HEADER_ACCEPT)->setMethod(HttpMethod::get())->setUrl($claimedId));
     if ($response->getStatus()->getId() != 200) {
         throw new OpenIdException('can\'t fetch document');
     }
     $contentType = $response->getHeader('content-type');
     if (mb_stripos($contentType, self::HEADER_CONT_TYPE) !== false) {
         $this->parseXRDS($response->getBody());
     } elseif ($response->hasHeader(self::HEADER_XRDS_LOCATION)) {
         $this->loadXRDS($response->getHeader(self::HEADER_XRDS_LOCATION));
     } else {
         $this->parseHTML($response->getBody());
     }
     if (!$this->server || !$this->server->isValid()) {
         throw new OpenIdException('bad server');
     } else {
         $this->server->makeComparable();
     }
     if (!$this->realId) {
         $this->realId = $claimedId;
     } elseif (!$this->realId->isValid()) {
         throw new OpenIdException('bad delegate');
     } else {
         $this->realId->makeComparable();
     }
 }
开发者ID:justthefish,项目名称:hesper,代码行数:32,代码来源:OpenIdCredentials.php

示例10: __construct

 public function __construct(BASE_CLASS_WidgetParameter $paramObject)
 {
     parent::__construct();
     $text = OW::getLanguage()->text('base', 'welcome_widget_content');
     $text = str_replace('</li>', "</li>\n", $text);
     //if the tags are written in a line it is necessary to make a compulsory hyphenation?
     $photoKey = str_replace('{$key}', self::KEY_PHOTO_UPLOAD, self::PATTERN);
     $avatarKey = str_replace('{$key}', self::KEY_CHANGE_AVATAR, self::PATTERN);
     if (OW::getPluginManager()->isPluginActive('photo') && mb_stripos($text, self::KEY_PHOTO_UPLOAD) !== false) {
         $label = OW::getLanguage()->text('photo', 'upload_photos');
         $js = OW::getEventManager()->call('photo.getAddPhotoURL');
         $langLabel = $this->getLangLabel($photoKey, $text, self::KEY_PHOTO_UPLOAD);
         if ($langLabel != NULL) {
             $label = $langLabel;
         }
         $text = preg_replace($photoKey, '<li><a href="javascript://" onclick="' . $js . '();">' . $label . '</a></li>', $text);
     } else {
         $text = preg_replace($photoKey, '', $text);
     }
     if (mb_stripos($text, self::KEY_CHANGE_AVATAR) !== false) {
         $label = OW::getLanguage()->text('base', 'avatar_change');
         $js = ' $("#welcomeWinget_loadAvatarChangeCmp").click(function(){' . 'document.avatarFloatBox = OW.ajaxFloatBox("BASE_CMP_AvatarChange", [], {width: 749, title: ' . json_encode($label) . '});' . '});';
         OW::getDocument()->addOnloadScript($js);
         $langLabel = $this->getLangLabel($avatarKey, $text, self::KEY_CHANGE_AVATAR);
         if ($langLabel != NULL) {
             $label = $langLabel;
         }
         $text = preg_replace($avatarKey, '<li><a id="welcomeWinget_loadAvatarChangeCmp" href="javascript://">' . $label . '</a></li>', $text);
     } else {
         $text = preg_replace($avatarKey, '', $text);
     }
     $this->assign('text', $text);
 }
开发者ID:hardikamutech,项目名称:loov,代码行数:33,代码来源:welcome_widget.php

示例11: test_encoding

function test_encoding($path)
{
    static $ur_exclude = array('lang/de/ocstyle/search1/search.result.caches', 'lib2/b2evo-captcha', 'lib2/HTMLPurifier', 'lib2/html2text.class.php', 'lib2/imagebmp.inc.php', 'lib2/Net/IDNA2', 'lib2/smarty');
    $contents = file_get_contents($path, false, null, 0, 2048);
    $ur = stripos($contents, "Unicode Reminder");
    if ($ur) {
        if (mb_trim(mb_substr($contents, $ur + 17, 2)) != "メモ") {
            $ur = mb_stripos($contents, "Unicode Reminder");
            if (mb_trim(mb_substr($contents, $ur + 17, 2)) != "メモ") {
                echo "Bad Unicode Reminder found in {$path}: " . mb_trim(mb_substr($contents, $ur + 17, 2)) . "\n";
            } else {
                echo "Unexpected non-ASCII chars (BOMs?) in header of {$path}\n";
            }
        }
    } else {
        $ok = false;
        foreach ($ur_exclude as $exclude) {
            if (mb_strpos($path, $exclude) === 0) {
                $ok = true;
            }
        }
        if (!$ok) {
            echo "No Unicode Reminder found in {$path}\n";
        }
    }
}
开发者ID:kirstenko,项目名称:oc-server3,代码行数:26,代码来源:find_bad_encodings.php

示例12: validateEquals

 protected function validateEquals($input)
 {
     if (is_array($input)) {
         return in_array($this->containsValue, $input);
     }
     return false !== mb_stripos($input, $this->containsValue, 0, mb_detect_encoding($input));
 }
开发者ID:rafaelgandi,项目名称:wasabi_artisan,代码行数:7,代码来源:Contains.php

示例13: supportsExtension

 public function supportsExtension($ext)
 {
     return (new \Yasca\Core\IteratorBuilder())->from($this->getSupportedFileTypes())->where(static function ($supportedExt) use($ext) {
         //PHP 5.4 does not have a multibyte-safe case insensitive compare
         return \mb_strlen($supportedExt) === \mb_strlen($ext) && \mb_stripos($supportedExt, $ext) === 0;
     })->any();
 }
开发者ID:pombredanne,项目名称:yasca,代码行数:7,代码来源:Plugin.php

示例14: splitOnTag

 /**
  * find needle in between html tags and add highlighting
  *
  * @param string $needle   string to find
  * @param string $haystack html text to find needle in
  * @param string $pre      insert before needle
  * @param string $post     insert after needle
  *
  * @return mixed return from preg_replace_callback()
  */
 protected static function splitOnTag($needle, $haystack, $pre, $post)
 {
     $encoding = static::ENCODING;
     return preg_replace_callback('#((?:(?!<[/a-z]).)*)([^>]*>|$)#si', function ($capture) use($needle, $pre, $post, $encoding) {
         $haystack = $capture[1];
         if (function_exists('mb_substr')) {
             $p1 = mb_stripos($haystack, $needle, 0, $encoding);
             $l1 = mb_strlen($needle, $encoding);
             $ret = '';
             while ($p1 !== false) {
                 $ret .= mb_substr($haystack, 0, $p1, $encoding) . $pre . mb_substr($haystack, $p1, $l1, $encoding) . $post;
                 $haystack = mb_substr($haystack, $p1 + $l1, null, $encoding);
                 $p1 = mb_stripos($haystack, $needle, 0, $encoding);
             }
         } else {
             $p1 = stripos($haystack, $needle);
             $l1 = strlen($needle);
             $ret = '';
             while ($p1 !== false) {
                 $ret .= substr($haystack, 0, $p1) . $pre . substr($haystack, $p1, $l1) . $post;
                 $haystack = substr($haystack, $p1 + $l1);
                 $p1 = stripos($haystack, $needle);
             }
         }
         $ret .= $haystack . $capture[2];
         return $ret;
     }, $haystack);
 }
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:38,代码来源:Highlighter.php

示例15: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $referer = $request->server->get('referer');
     // Referer is not provided, we continue
     if (is_null($referer) or env('APP_ENV', 'production') !== 'production') {
         return $next($request);
     }
     // Handle the dictionnary.
     // @todo Refactor that
     $dir = realpath(dirname(__FILE__) . '/../../../../../') . '/';
     $path = $dir . 'spammers.json';
     $file = file_get_contents($path);
     // Dictionnary is not readable, abort.
     if (empty($file)) {
         abort(500, 'Unable to read spammers.json');
     }
     $dictionary = json_decode($file);
     // Parse the referer
     $url = new Parser(new PublicSuffixList([]));
     $host = $url->parseHost($referer)->host;
     // Compare dictionary against the referer...
     $search = Arr::where($dictionary, function ($key, $value) use($host) {
         return mb_stripos($host, $value) !== false;
     });
     // ...and check for results
     if (count($search) > 0) {
         abort(500, 'Spammers protection');
     }
     // No spam, we can continue :)
     return $next($request);
 }
开发者ID:akibatech,项目名称:analytics-spammers,代码行数:38,代码来源:CheckForSpammers.php


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